brainsmatics 1.1.6 → 1.1.7

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.
@@ -4498,7 +4498,7 @@ echarts.use([`+U+"]);":"Unknown series "+D))}return}if(f==="tooltip"){if(E){proc
4498
4498
  }
4499
4499
  `,transparent:!1,depthWrite:!1,depthTest:!1}),Ft=new hf(et,$t);Ft.translateX(Ee),Ft.translateY(st),Ft.translateZ(ue),Ft.myMeshType="neuronSphere",Ft.name=`${ze}-${bt.line[0].start_name}`,Ft.userData.color="#1771FF",Ft.myMeshType="neuronSphere",Ft.name=`${ze}-${bt.line[0].start_name}`,Ft.userData.color="#1771FF",mr(Ft),Xe.add(Ft),Xe.name=`swcPointGroup${ze}`,Tt.current.push(Xe),_e.current.add(Xe);let dn=1;for(let At=0;At<bt.line.length;At++){let It=[],Kn=[bt.position[0].x,bt.position[0].y,bt.position[0].z];for(let Fn=bt.line[At].start;Fn<=bt.line[At].end;Fn++){Fn===bt.line[At].start&&(Kn=[bt.position[Fn].x,bt.position[Fn].y,bt.position[Fn].z]);let wn=bt.position[Fn].x,ir=bt.position[Fn].y,Ir=bt.position[Fn].z;(Math.sqrt((wn-Kn[0])*(wn-Kn[0])+(ir-Kn[1])*(ir-Kn[1])+(Ir-Kn[2])*(Ir-Kn[2]))>dn||Fn===bt.line[At].end||Fn===bt.line[At].start)&&(It.push(new Ie(wn,ir,Ir)),Kn=[wn,ir,Ir])}let lr=new Ea(new Di().setFromPoints(It),new Jc({color:it}));lr.myMeshType="SWC",De.add(lr)}De.scale.set(Hi.current,Hi.current,Hi.current),De.translateX(Ee),De.translateY(st),De.translateZ(ue),De.name=ze,De.myMeshType="SWC",re.current[ze]=De,_e.current.add(re.current[ze]),ot&&ot()})},yi=function(ut){return ut.replace("/","_").replace(" ","_")},gi=(ut,Oe,ze)=>{var ot;ze.color=Oe;let it=_e.current.children.find(pt=>pt.name==ze.name);if(s=="vessel")i.current[ze.name]&&it&&it.traverse(function(pt){(pt instanceof Ea||pt instanceof Jn)&&pt.material.color.set(ze.color)});else if(s=="fbx"){if(na.current[ze.name]&&it){let pt;if(ze.color.includes("rgba")){const Xe=ze.color.lastIndexOf(",");pt=ze.color.slice(Xe+1,-1)}const bt=new Ar(ze.color);let st=new URL(window.location.href),Ee=new URLSearchParams(st.search),ue=Ee.get("fbxColor"),De={};ue&&(De=JSON.parse(ue)),De[`${ze.name}`]=ze.color,Ee.set("fbxColor",JSON.stringify(De)),st.search=Ee.toString(),window.history.replaceState({},"",st),it.traverse(function(Xe){Xe instanceof Jn&&(Xe.material.color.set(bt),pt&&(Xe.material.transparent=!0,Xe.material.opacity=pt))})}}else if(s=="soma")Q.current.includes(ze.name)&&it&&it.traverse(function(pt){pt instanceof hf&&(pt.material.uniforms.color.value=Et(ze.color))});else if(s=="swc"){const pt=new Ar(ze.color);let bt;if(ze.color.includes("rgba")){const ue=ze.color.lastIndexOf(",");bt=parseFloat(ze.color.slice(ue+1,-1))}if(re.current[ze.name]&&it){let ue=new URL(window.location.href),De=new URLSearchParams(ue.search);Kt.current[ze.name]=ze.color.replace("#","!"),De.set("neuronsColor",encodeURIComponent(JSON.stringify(Kt.current))),ue.search=De.toString(),window.history.replaceState({},"",ue),it.traverse(function(Xe){Xe instanceof Ea&&(Xe.material.color.set(pt),bt&&(Xe.material.transparent=!0,Xe.material.opacity=bt,Xe.material.needsUpdate=!0))})}_e.current.traverse(ue=>{ue.myMeshType==="neuronSphere"&&ue.userData.type=="end"&&ze.name===ue.name.split("-")[0]&&(ue.material.uniforms.color.value=pt,ue.userData.color=ut,bt&&(ue.material.uniforms.opacity.value=bt))});let[st,Ee]=Ia(vt.current,ze.name);for(let ue in Ee){let De=ue;ue.indexOf("_")>-1&&(De=ue.split("_")[0]);let Xe=(ot=vt.current[`${De}`])==null?void 0:ot.find(et=>et.name===ze.name);Xe&&(Xe.color=pt)}_e.current.traverse(ue=>{if(ue.name==="lineNameMesh"&&ue.userData.type=="end"&&ze.name===ue.userData.wholeName.split("-")[0]){let De=ze.color;ue.material.color.set(De),ue.userData.initColor=De}})}},tr=S.useCallback((ut,Oe,ze,it,ot)=>{ut.stopPropagation();let pt=new URL(window.location.href),bt=new URLSearchParams(pt.search),st=Oe,Ee=Tre(st,Se.current),De=am(st,Se.current).children,Xe=U+"/data/"+ie.current+"/"+yi(st)+".FBX";for(var et=0;et<Ee.length;et++){if(ci(Ee[et],!0),we.includes(Ee[et])){We(Ft=>Ft.filter(dn=>dn!==Ee[et]));const $t=JSON.stringify(we.filter(Ft=>Ft!==Ee[et]));bt.set("regionsExpanded",$t)}Q.current=Q.current.filter($t=>$t!==Ee[et])}if(we.includes(st)){We(Ft=>Ft.filter(dn=>dn!==st));const $t=JSON.stringify(we.filter(Ft=>Ft!==st));bt.set("regionsExpanded",$t),Q.current.includes(st)||Q.current.push(st),na.current[st]?(_e.current.remove(na.current[st]),na.current[st].children[0].material.color.set(it),_e.current.add(na.current[st]),dg.current&&(_e.current.remove(Ma.current[st]),Ma.current[st].children[0].material.color.set(it),_e.current.add(Ma.current[st]))):bd(Xe,st,it,.6,parseInt(ot));for(var et=0;et<De.length;et++)Q.current=Q.current.filter(dn=>dn!==De[et].name),ci(De[et].name,!0),Ze.current=0,delete oe.current[De[et].name]}else{const $t=document.getElementById("spinner"),Ft=JSON.stringify([...we,st]);bt.set("regionsExpanded",Ft),We(dn=>[...dn,st]),$t&&($t.style.display="block"),na.current[st]?(_e.current.remove(na.current[st]),na.current[st].children[0].material.color.set("#DBDBDB"),_e.current.add(na.current[st]),dg.current&&(_e.current.remove(Ma.current[st]),Ma.current[st].children[0].material.color.set("#DBDBDB"),_e.current.add(Ma.current[st]))):bd(Xe,st,"#DBDBDB",.6,parseInt(ot)),Q.current=Q.current.filter(dn=>dn!==st);for(var et=0;et<De.length;et++)if(De[et]["3D"]){let At=parseInt(De[et].z),It=De[et].color,Kn=U+"/data/"+ie.current+"/"+yi(De[et].name)+".FBX";Q.current.push(De[et].name),ro(Kn,De[et].name,It,.6,At,function(){$t&&($t.style.display="none")})}}m(Q.current);const ht=JSON.stringify(Q.current);bt.set("regionsChecked",ht),pt.search=bt.toString(),window.history.replaceState({},"",pt)},[v,f,we]),_r=(ut,Oe,ze)=>{if(Oe===Q.current[0]&&b)return;const it=Q.current.indexOf(Oe);if(it!==-1){if(b){if(E){const st=E.current.filter(Ee=>Ee!==Oe);E.current=st}ut.target.style.color="black"}m(st=>st.filter(Ee=>Ee!==Oe)),Q.current.splice(it,1);let ot=new URL(window.location.href),pt=new URLSearchParams(ot.search);const bt=JSON.stringify(Q.current);s==="fbx"?pt.set("regionsChecked",bt):s==="vessel"&&pt.set("vesselsChecked",bt),ot.search=pt.toString(),window.history.replaceState({},"",ot),ci(Oe,!0)}else{b&&(E&&E.current.push(Oe),ut.target.style.color="red"),Q.current.push(Oe),m([...Q.current]);let ot=new URL(window.location.href),pt=new URLSearchParams(ot.search);const bt=JSON.stringify(Q.current);s==="fbx"?pt.set("regionsChecked",bt):s==="vessel"&&pt.set("vesselsChecked",bt),ot.search=pt.toString(),window.history.replaceState({},"",ot);let st=U+"/data/FBX/"+Oe+".FBX";bd(st,Oe,ze,.8,0)}},vr=S.useMemo(()=>{var ot,pt;let ut=Y&&Y.split(" ")[0]||"",Oe=typeof ee=="string"?ee.split(" ")[0]:"",ze=["MO","MOs","MOp","CP","Isocortex"];if(s=="swc"){let bt=[],st=[];if(x&&Oe){let Ee=((ot=x[Oe])==null?void 0:ot.axon)||[];bt=[...bt,...Ee]}if(x&&ut){let Ee=((pt=x[ut])==null?void 0:pt.soma)||[];st=[...st,...Ee]}if(Oe&&ut){let Ee=new Set(bt),ue=new Set(st);Ge.current=[...Ee].filter(De=>ue.has(De))}else Oe?Ge.current=bt:ut&&(Ge.current=st)}const it=bt=>bt&&bt.map((st,Ee)=>{Kz.push(st),st.nameflag?st.key=st.nameflag:st.key=st.name;let ue=st.name;if(localStorage.getItem("lang")=="zh_cn"&&st.cname&&(ue=st.cname),s==="vessel"){const $t=Vv(st.key,n);$t[$t.length-1]}if(st.path||(s==="vessel"?st.path=U+"/data/Vessel/":s==="fbx"&&(st.path=U+"/data/FBX/")),MSe){let $t=JSON.parse(MSe),dn=Object.keys($t).find(At=>At===st.name);dn&&(st.color=$t[dn])}const De=ct.reduce(($t,Ft)=>{const[dn,At]=Ft.split(":");return $t[dn]=At,$t},{}),Xe=($t,Ft)=>$t in De?De[$t]===Ft[$t]:!0;let et;const ht=ee&&st["3D"]&&ue.toLowerCase().indexOf(ee.toLowerCase())!==-1||b&&Q.current.slice(1).includes(ue)||s=="vessel"&&ee&&ue.toLowerCase().indexOf(ee.toLowerCase())!==-1;if(s==="fbx"||s==="vessel")return et=S.createElement("span",{style:{display:"flex",alignItems:"center"},onClick:$t=>$t.stopPropagation()},S.createElement(kE,{format:"rgb",defaultValue:st.color,onChange:($t,Ft)=>gi($t,Ft,st)}),S.createElement(ji,{placement:"right",title:st.fullname},S.createElement("div",{onClick:$t=>_r($t,st.key,st.color),style:ht?{color:"red",whiteSpace:"nowrap"}:{color:"black",whiteSpace:"nowrap"}},ue)),Dn.includes(st.name)?S.createElement(ji,{placement:"right",title:h("5000.6041")||"新标注"},S.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"},S.createElement("g",{id:"#1296dbff"},S.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,B!=null&&B.includes("neurons")&&ze.includes(st.name)&&(D=="task3D"||D=="3Dneurons")?S.createElement(ji,{placement:"right",title:h("5000.6040")||"投射丰富"},S.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(st.name)},50)}},S.createElement("g",{id:"#1296dbff"},S.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,S.createElement("div",{ref:Ee==0?u:null,style:{width:20,height:20,marginLeft:8}},st.children&&y&&(D=="task3D"||D=="3Dlabel")?S.createElement(ji,{placement:"right",title:we.includes(st.key)?"Assemle":"Expand"},we.includes(st.key)?S.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 128 128",version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:$t=>tr($t,st.key,`${st.key}`,st.color,st.z)},S.createElement("g",{id:"#1296dbff"},S.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"}),S.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"}),S.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"})),S.createElement("g",{id:"#8da6d9ff"},S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}))):S.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 128 128",version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:$t=>tr($t,st.key,`${st.key}`,st.color,st.z)},S.createElement("g",{id:"#1296dbff"},S.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"}),S.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"}),S.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)),st.title=et,st.key=st.name,st["3D"]==!1&&(st.disabled=!0),b||we.includes(st.name)?st.disableCheckbox=!0:st.disableCheckbox=!1,st.children&&(st.children=it(st.children)),st;if(s=="swc"){if(Oe||ut)return Ge.current&&Ge.current.includes(ue)&&Xe("strain",st)&&Xe("age",st)&&Xe("weight",st)&&Xe("gender",st)&&Xe("injected_viruses",st)&&Xe("imaging_system",st)&&Xe("species",st)?(st.title=st.name,st.key=st.name,st.color=st.color?st.color:"#045404",!Bn||st.show?st:null):null}else{const $t=ee&&ue.toLowerCase().indexOf(ee.toLowerCase())!==-1;return et=S.createElement(ji,{placement:"right",title:st.fullname},S.createElement("span",{style:{display:"flex",alignItems:"center"},onClick:Ft=>Ft.stopPropagation()},st.children&&s=="swc"?null:S.createElement(kE,{disabled:s=="swc",format:"rgb",defaultValue:s=="swc"?"#045404":st.color,onChange:(Ft,dn)=>gi(Ft,dn,st)}),S.createElement("div",{style:$t?{color:"red"}:{}},ue))),st.title=et,st.key=st.name,st.children&&(st.children=it(st.children)),st}});return it(n).filter(Boolean)},[ee,n,Y,we,b,y,A,ye,ct,x,Bn,D]),fr=new Tw;S.useEffect(()=>{fr.load("/staticresource/fonts/helvetiker_bold.typeface.json",ut=>{})},[]);const Gr=(ut,Oe)=>{m(bt=>[...bt,ut]),Q.current.push(ut);let ze=new URL(window.location.href),it=new URLSearchParams(ze.search);const ot=JSON.stringify(Q.current);it.set("neuronsChecked",ot),ze.search=it.toString(),window.history.replaceState({},"",ze);let pt=Jr(vr,ut);fetch(pt.path).then(bt=>bt.json()).then(bt=>{on(bt)}),re.current[ut]?(Ht({name:ut,color:Oe}),yt(!0)):Kr(pt.path,6,ut,pt.color,function(){Ta(ut,pt.color),Ht({name:ut,color:Oe}),yt(!0)})},qi=[{title:"Name",dataIndex:"name"},{title:"Color",dataIndex:"Picker",width:50,render:(ut,Oe)=>(Kt.current[Oe.name]&&(Oe.color=Kt.current[Oe.name]),S.createElement(kE,{disabled:!Oe.show,format:"rgb",defaultValue:Oe.color?Oe.color:"#045404",onChange:(ze,it)=>gi(ze,it,Oe)}))},{title:"Ana.",dataIndex:"Ana",align:"center",render:(ut,Oe)=>S.createElement(ji,{placement:"right",title:h("5000.7008")||"分析"},S.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",cursor:"pointer",pointerEvents:Oe.show?"auto":"none",onClick:ze=>{Gr(Oe.name,Oe.color)}},S.createElement("g",{id:"#515151ff"},S.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"}),S.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"}),S.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"}),S.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:(ut,Oe)=>S.createElement(ji,{placement:"right",title:h("5000.6003")||"投射路径"},S.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",cursor:"pointer",pointerEvents:Oe.show?"auto":"none",onClick:ze=>{xi(Oe.name)}},S.createElement("g",{id:"#1296dbff"},S.createElement("path",{fill:_&&Oe.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:(ut,Oe)=>{const ze=Oe.type;return S.createElement(ji,{placement:"right",title:h("5000.6038",{name:ze})||'数据来源"'+ze+'"'},S.createElement("a",{href:Oe.url,target:"_blank"},S.createElement("img",{src:Oe.image,width:"20px",height:"20px"})))}}],Oi=ut=>{for(var Oe=window.location.search.substring(1),ze=Oe.split("&"),it=0;it<ze.length;it++){var ot=ze[it].split("=");if(ot[0]==ut)return ot[1]}return!1},zi=(ut,Oe)=>{let it=am(rh(ut,Oe),Oe).children;for(var ot=[],pt=0;pt<it.length;pt++)it[pt]["3D"]&&ot.push(it[pt].name);return ot},ca=()=>{const ut=Object.keys(oe.current);Object.keys(oe.current).length!==0&&ka(ut,oe.current,.2,0,void 0,!0)};S.useEffect(()=>{ca()},[f]);const ro=(ut,Oe,ze,it,ot,pt)=>{var bt=new vo;if(bt.setFromAxisAngle(new Ie(1,0,0),Math.PI/2),!na.current[Oe]){var st=new PD;it=it||.1,st.load(ut,function(Ee){Ee.scale.set(Hi.current,Hi.current,Hi.current),Ee.applyQuaternion(bt),ot&&Ee.translateY(ot*Hi.current*.1),Ee.children[0].material.transparent=!0,Ee.children[0].material.opacity=it,Ee.children[0].material.depthTest=!1,Ee.children[0].material.color.set(ze);let ue=Ee.clone();if(Oe!="Brain"){var De=new Ii,Xe=new Ie(1,0,0);De.set(1-2*Xe.x*Xe.x,-2*Xe.x*Xe.y,-2*Xe.x*Xe.z,0,-2*Xe.x*Xe.y,1-2*Xe.y*Xe.y,-2*Xe.y*Xe.z,0,-2*Xe.x*Xe.z,-2*Xe.y*Xe.z,1-2*Xe.z*Xe.z,0,0,0,0,1),ue.applyMatrix4(De),ue.translateX(-eo.current),ue.translateY(ja.current),ue.translateZ(-Ya.current),ue.name=Oe,ue.myMeshType="FBX",ue.children[0].name=Oe,ue.children[0].myMeshType="FBX",Ma.current[Oe]=ue,dg.current&&_e.current.add(ue)}Ee.translateX(eo.current),Ee.translateY(ja.current),Ee.translateZ(-Ya.current),Ee.name=Oe,Ee.myMeshType="FBX",Ee.children[0].name=Oe,Ee.children[0].myMeshType="FBX",na.current[Oe]=Ee,_e.current.add(na.current[Oe]);var et=new Ie,ht=new rs().setFromObject(Ee);ht.getCenter(et);var $t=new Ie;ht.getSize($t);var Ft=$t.x*$t.y*$t.z;By.current[Oe]=[et,Ft];for(var dn=Vv(Oe,Se.current),At=0;At<dn.length;At++)if(o!=null&&o.current&&oe.current[dn[At]])if(ge.current||fe.current){Ee.translateOnAxis(oe==null?void 0:oe.current[dn[At]].axis,o.current*(oe==null?void 0:oe.current[dn[At]].length));var It=oe==null?void 0:oe.current[dn[At]].axis.clone();It.x=It.x*-1,ue.translateOnAxis(It,o.current*(oe==null?void 0:oe.current[dn[At]].length))}else{var It=oe[dn[At]].axis.clone();It.x=It.x*-1,ue.translateOnAxis(It,o.current*(oe==null?void 0:oe.current[dn[At]].length)),Ee.translateOnAxis(oe==null?void 0:oe.current[dn[At]].axis,o.current*(oe==null?void 0:oe.current[dn[At]].length))}na.current[Oe]=Ee;let Kn=zi(Oe,Se.current);for(var lr=!0,Fn=0;Fn<Kn.length;Fn++)Kn[Fn]in na.current||(lr=!1);if(lr){for(var wn=0,Fn=0;Fn<Kn.length;Fn++){var ir=Kn[Fn];if(!ge.current)if(fe.current){let ln=new Ie(0,0,5);oe.current[ir]={axis:By.current[ir][0].clone().sub(ln).applyAxisAngle(new Ie(1,0,0),-1*Math.PI/2).normalize(),length:Math.cbrt(By.current[ir][1])}}else ae.current;wn=wn+oe.current[ir].length}if(!(fe.current||ge.current))for(Fn=0;Fn<Kn.length;Fn++)oe.current[Kn[Fn]].length=oe.current[Kn[Fn]].length/wn*Kn.length;var Ir=setInterval(function(){if(o!=null&&o.current&&Ze.current<(o==null?void 0:o.current)){Ze.current=Ze.current+.2;let En;Ze.current>(o==null?void 0:o.current)&&(En=(o==null?void 0:o.current)-Ze.current+.2,Ze.current=o.current),ka(Kn,oe.current,.2,0,En)}else Ze.current=0,clearInterval(Ir)},20)}pt&&pt()})}},ka=(ut,Oe,ze,it,ot,pt=!1)=>{var bt,st;if(ge.current||fe.current)var Ee=.2;else var Ee=ze;for(var ue in ut){var De=ut[ue];bt=na.current[De],st=Ma.current[De];var Xe=Oe[De].axis,et=Xe.clone();et.x=et.x*-1;var ht=Oe[De].length;if(pt&&o){na.current[ut[ue]].locationLength=o==null?void 0:o.current,na.current[ut[ue]].position.set(0,0,0),na.current[ut[ue]].translateX(eo.current),na.current[ut[ue]].translateY(ja.current),na.current[ut[ue]].translateZ(-Ya.current),na.current[ut[ue]].translateOnAxis(Xe,(o==null?void 0:o.current)*ht),Ma.current[ut[ue]].position.set(0,0,0),Ma.current[ut[ue]].translateX(-eo.current),Ma.current[ut[ue]].translateY(ja.current),Ma.current[ut[ue]].translateZ(-Ya.current),Ma.current[ut[ue]].locationLength=o==null?void 0:o.current,Ma.current[ut[ue]].translateOnAxis(et,(o==null?void 0:o.current)*ht);continue}switch(it){case 0:ot?(na.current[ut[ue]].translateOnAxis(Xe,ot*ht),Ma.current[ut[ue]].translateOnAxis(et,ot*ht)):(na.current[ut[ue]].translateOnAxis(Xe,Ee*ht),Ma.current[ut[ue]].translateOnAxis(et,Ee*ht));break;case 1:Ee<=0?(bt.translateOnAxis(Xe,-1*Math.sqrt(Math.abs(Ee*ht))),st.translateOnAxis(et,-1*Math.sqrt(Math.abs(Ee*ht)))):(bt.translateOnAxis(Xe,Math.sqrt(Ee*ht)),st.translateOnAxis(et,Math.sqrt(Ee*ht)));break;case 2:Ee<=0?(bt.translateOnAxis(Xe,-1*Math.pow(Ee,2)*ht),st.translateOnAxis(et,-1*Math.pow(Ee,2)*ht)):(bt.translateOnAxis(Xe,Math.pow(Ee,2)*ht),st.translateOnAxis(et,Math.pow(Ee,2)*ht));break}}},To=ut=>{for(let Oe=0;Oe<ut.length;Oe++){const ze=ut[Oe],{key:it,cname:ot}=ze;localStorage.getItem("lang")=="zh_cn"&&ot?ve.current.push({key:it,title:ot}):ve.current.push({key:it,title:it}),ze.children&&To(ze.children)}},oo=ut=>{const{value:Oe}=ut.target;if(Oe!=""){ke.current=!1,Kz=[];const ze=ve.current.map(ot=>ot.title.toLowerCase().indexOf(Oe.toLowerCase())>-1?rh(ot.key,n):null).filter((ot,pt,bt)=>!!(ot&&bt.indexOf(ot)===pt));let it=[];for(let ot in ze){let pt=ze[ot];if(pt){let bt=Vv(pt,n);Oe.length===1?(bt.length>2&&(bt=bt.slice(bt.length-3,bt.length)),it.push(...bt)):it.push(pt,...bt)}}it.filter((ot,pt,bt)=>!!(ot&&bt.indexOf(ot)===pt)),W(it),X(!0),K(Oe)}else W(Te.current),K(""),ke.current=!0},ti=(ut,Oe)=>(...it)=>{clearTimeout(Z.current),Z.current=setTimeout(()=>{ut(...it)},Oe)},Dr=ti(oo,50),Ua=ut=>{W(ut),Kz=[],X(!1)},Ta=(ut,Oe)=>{re.current[ut]&&re.current[ut].children[0].material.color.set(Oe)},ha=S.useCallback((ut,Oe,ze,it)=>{let ot=ut,pt="",bt;if(s!=="swc"){if(ot=Oe.node.name,pt=Oe.node.path,bt=Oe.node.color,ot===Q.current[0]&&C===2)return;if(E){const ht=E.current.indexOf(ot);ht>-1?E.current.splice(ht,1):Q.current.length!==0&&E.current.push(ot)}let Ee=v.findIndex(ht=>ht==ot),ue=JSON.parse(JSON.stringify(v));Ee>-1?ue.splice(Ee,1):ue.push(ot),m(ue),Q.current=ue;let De=new URL(window.location.href),Xe=new URLSearchParams(De.search);const et=JSON.stringify(ue);s==="fbx"?Xe.set("regionsChecked",et):s==="vessel"&&Xe.set("vesselsChecked",et),De.search=Xe.toString(),window.history.replaceState({},"",De)}const st=document.getElementById("spinner");switch(s){case"vessel":{ot=="Unnamed vein"&&(ot="Unnamed_Vein");let Ee=pt+ot+".js";Oe.checked?(cy=!0,st&&(st.style.display="block"),an(Ee,8,bt,ot,function(){st&&(st.style.display="none")})):(cy=!1,st&&(st.style.display="none"),si(ot));break}case"swc":{if(ze){if(it){let Ee=Oe.map((ue,De)=>new Promise((Xe,et)=>{if(Oe)if(re.current[ue.name])Xe("");else{if(m(ht=>[...ht,ue.name]),De===Oe.length-1){let ht=new URL(window.location.href),$t=new URLSearchParams(ht.search),Ft=Oe.map(It=>It.name);Q.current.push(...Ft);const dn=[...v,...Ft],At=JSON.stringify(dn);$t.set("neuronsChecked",At),ht.search=$t.toString(),window.history.replaceState({},"",ht)}st&&(st.style.display="block"),Kr(ue.path,6,ue.name,ue.color,function(){Ta(ue.name,"#045404"),Xe("")})}else{cy=!1,Ja(ue.name);let ht=new URL(window.location.href),$t=new URLSearchParams(ht.search);const dn=JSON.stringify([]);$t.set("neuronsChecked",dn),ht.search=$t.toString(),window.history.replaceState({},"",ht),Xe("")}}));Promise.all(Ee).then(()=>{st&&(st.style.display="none")})}else if(!re.current[ut.name]){Q.current.push(ut.name),st&&(st.style.display="block"),m(Xe=>[...Xe,ut.name]);let Ee=new URL(window.location.href),ue=new URLSearchParams(Ee.search);const De=JSON.stringify(Q.current);ue.set("neuronsChecked",De),Ee.search=ue.toString(),window.history.replaceState({},"",Ee),Kr(ut.path,6,ut.name,ut.color,function(){Ta(ut.name,"#045404"),st&&(st.style.display="none"),setTimeout(()=>{V&&V("欢迎来和我一起探索更多<strong>"+ut.name+"</strong>脑区相关内容")},5e3)})}}else if(it)Oe.forEach((Ee,ue)=>{if(Oe){if(m(De=>De.filter(Xe=>Xe!==Ee.name)),Q.current=Q.current.filter(De=>De!==Ee.name),Ja(Ee.name),ue===Oe.length-1){let De=new URL(window.location.href),Xe=new URLSearchParams(De.search);const et=JSON.stringify(Q.current);Xe.set("neuronsChecked",et),De.search=Xe.toString(),window.history.replaceState({},"",De)}if(_&&Ee.name in _.current){de(De=>De.filter(Xe=>Xe!==Ee.name));for(let De in _.current[Ee.name])_e.current.remove(_.current[Ee.name][De]);delete _.current[Ee.name]}}});else{if(_&&ut.name in _.current){de(Xe=>Xe.filter(et=>et!==ut.name));for(let Xe in _.current[ut.name])_e.current.remove(_.current[ut.name][Xe]);delete _.current[ut.name]}Ja(ut.name),Q.current=Q.current.filter(Xe=>Xe!==ut.name),m(Xe=>Xe.filter(et=>et!==ut.name));let Ee=new URL(window.location.href),ue=new URLSearchParams(Ee.search);const De=JSON.stringify(Q.current);ue.set("neuronsChecked",De),Ee.search=ue.toString(),window.history.replaceState({},"",Ee)}break}case"soma":{wre(ot,vr).forEach(ue=>{Oe.checked?(cy=!0,re.current[ot]||(p!=null&&p.current?cn(pt,ue.color,ot):cn(U+"/data/json/"+ot,ue.color,ot))):(cy=!1,Ja(ot))});break}case"fbx":{let Ee=parseInt(Oe.node.z),ue=U+"/data/FBX/"+yi(ot)+".FBX";Oe.checked?(st&&(st.style.display="block"),bd(ue,ot,bt,.8,Ee,"FBX",function(){st&&(st.style.display="none"),setTimeout(()=>{V&&V("欢迎来和我一起探索更多 <strong>"+ot+"</strong> 脑区相关内容")},5e3)})):ci(ot)}}},[v]),gs=()=>{if(Se.current.length>0&&s!=="swc"&&v.length>0&&(s==="fbx"||s==="vessel"))return new Promise((ut,Oe)=>{const ze=document.getElementById("spinner");let it=0;for(let ot=0;ot<v.length;ot++){let pt=am(v[ot],Se.current);if(pt){let bt={node:{...pt,checked:!0}};if(s==="fbx"){let st=U+"/data/FBX/"+yi(pt.key)+".FBX";bd(st,pt.key,pt.color,.8,pt.z,"FBX",function(){ze&&nr.current===!0&&(ze.style.display="none"),it+=1,it===v.length&&ut("")})}else if(s==="vessel"){let st=pt.name,Ee=bt.node.path;st=="Unnamed vein"&&(st="Unnamed_Vein");let ue=Ee+st+".js";cy=!0,ze&&(ze.style.display="block"),an(ue,8,pt.color,st,function(){ze&&nr.current===!0&&(ze.style.display="none"),it+=1,it===v.length&&ut("")})}}}}).then(ut=>{if(ISe){let Oe=JSON.parse(ISe);for(let ze=0;ze<Oe.length;ze++){let it=am(Oe[ze],Se.current);it&&tr({stopPropagation:()=>{}},it.key,`${it.key}`,it.color,it.z)}}})},Mo=()=>{if(Jz&&JSON.parse(Jz).length!=0){nr.current=!1;const ut=document.getElementById("spinner"),Oe=JSON.parse(Jz);let ze=0;ut&&(ut.style.display="block");for(let it=0;it<Oe.length;it++){it!==Oe.length-1&&ut&&(ut.style.display="block");let ot=n.find(pt=>pt.name===Oe[it]);ot&&(Kt.current[Oe[it]]?ot.color=Kt.current[Oe[it]].replace("!","#"):ot.color="#045404",Kr(ot.path,6,ot.name,ot.color,function(){if(Ta(ot.name,ot.color),ASe){const pt=JSON.parse(ASe);for(let bt=0;bt<pt.length;bt++)ot.name==pt[bt]&&xi(ot.name)}ze++,ze===Oe.length&&ut&&(ut.style.display="none",nr.current=!0)}))}}};S.useEffect(()=>{!en.current&&n&&n.length>0&&(Mo(),gs(),en.current=!0)},[n]);const ci=(ut,Oe=!1)=>{na.current[ut]&&(_e.current.remove(na.current[ut]),na.current[ut].children[0].geometry.dispose(),Oe&&delete na.current[ut]),Ma.current[ut]&&(_e.current.remove(Ma.current[ut]),Ma.current[ut].children[0].geometry.dispose(),Oe&&delete Ma.current[ut]),oe.current[ut]&&Oe&&delete oe.current[ut]},Ia=(ut,Oe)=>{const ze={},it={};for(const ot in ut){const pt=ut[ot];for(const bt of pt)if(bt.name==Oe){if(bt.color==="#1771FF"){ze[ot]={point:bt.point,color:bt.color,type:bt.type};break}if(bt.color==="#A7B5A1"){ze[ot]={point:bt.point,color:bt.color,type:bt.type};break}ze[ot]={point:bt.point,color:bt.color,type:bt.type}}}for(const ot in ut){const pt=ut[ot];for(const bt of pt)if(bt.name==Oe){if(bt.type=="cell"){it[ot]={point:bt.point,color:bt.color,type:bt.type};break}bt.type==="end"&&(bt.point[0]<570?it[ot]={point:bt.point,color:bt.color,type:bt.type}:it[ot+"_111"]={point:bt.point,color:bt.color,type:bt.type}),!it[ot]&&!it[ot+"_111"]&&bt.point[0]<570&&(it[ot]={point:bt.point,color:bt.color,type:bt.type})}}return[ze,it]},ls=(ut,Oe)=>{if(Object.keys(ut).length>0){const ze=ki.current.position;let it=_e.current.getObjectByName("DR-anterior"),ot=0;it&&(ot=ze.distanceTo(it.position));for(let pt in ut){let{point:bt,color:st,type:Ee}=ut[pt];_tn.load(U+"/fonts/helvetiker_bold.typeface.json",function(ue){const De=new MD(pt.replace("_111",""),{font:ue,size:.3,height:.01}),Xe=new Ml({color:st,specular:0,shininess:0}),et=new Jn(De,Xe),ht=ot<6?.2:ot<9?.3:.5;et.scale.set(ht,ht,ht),et.position.set(bt[0]*.01,bt[1]*.01,bt[2]*.01),et.name="lineNameMesh",et.userData.name=pt.replace("_111",""),et.userData.wholeName=`${Oe}-${pt.replace("_111","")}`,et.userData.initColor=st,et.userData.type=Ee,et.translateY(Ya.current),et.translateZ(ja.current),et.translateX(eo.current),De.center(),_!=null&&_.current&&_.current[Oe].push(et),_e.current.add(et)})}}else setTimeout(()=>{const[ze,it]=Ia(vt.current,Oe);ls(it,Oe)},100)},xi=(ut,Oe,ze)=>{let it=new URL(window.location.href),ot=new URLSearchParams(it.search),pt,bt;if(ze?[pt,bt]=Ia(ze,ut):[pt,bt]=Ia(vt.current,ut),_!=null&&_.current){const st=document.getElementById("spinner");if(ut in _.current){for(let ue in _.current[ut])de(De=>De.filter(Xe=>Xe!==ut)),_e.current.remove(_.current[ut][ue]);const Ee=ye.filter(ue=>ue!==ut);ot.set("neuronsText",JSON.stringify(Ee)),delete _.current[ut]}else{if(_.current[ut]=[],de(Ee=>[...Ee,ut]),ot.set("neuronsText",JSON.stringify([...ye,ut])),!(ut in re.current)){m(De=>[...De,ut]),Q.current=[...Q.current,ut];const Ee=JSON.stringify(Q.current);ot.set("neuronsChecked",Ee);let ue=Jr(vr,ut);if(st&&(st.style.display="block"),!re.current[ut]){let De=ue.color;ue.path&&De&&Kr(ue.path,6,ut,De,function(){De&&Ta(ut,De),st&&(st.style.display="none")})}}ls(bt,ut)}it.search=ot.toString(),window.history.replaceState({},"",it)}},Ja=ut=>{re.current[ut]&&(_e.current.remove(re.current[ut]),re.current[ut]=null,delete re.current[ut]);const Oe=_e.current.getObjectByName(`swcPointGroup${ut}`);Oe&&_e.current.remove(Oe)},yr=ut=>ut.map(Oe=>({value:Oe.name+" "+Oe.fullname,title:S.createElement(ji,{placement:"right",title:Oe.fullname},S.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},Oe.name," ",Oe.fullname)),children:Oe.children?yr(Oe.children):void 0})),si=ut=>{_e.current.remove(xv),_e.current.remove(Iu),i.current[ut]&&(_e.current.remove(i.current[ut].contentobj),i.current[ut].contentobj.traverse(function(Oe){Oe.type=="Mesh"&&(Oe.geometry.dispose(),Oe.geometry=null)}),i.current[ut].contentmaterial.dispose(),i.current[ut].contentmaterial=null,i.current[ut]=null,delete i.current[ut])},an=(ut,Oe,ze,it,ot)=>{i.current[it]?(_e.current.add(i.current[it].obj),ot&&ot()):fetch(ut).then(pt=>pt.json()).then(pt=>{var bt=new Kc,st=new LD({color:ze}),Ee=!1;pt.line.length>1e4&&(Ee=!0);let ue=1;for(let Xe=0;Xe<pt.line.length;Xe++)pt.line[Xe].layer>ue&&(ue=pt.line[Xe].layer);ue++;for(let Xe=0;Xe<pt.line.length;Xe++){let et=(ue-pt.line[Xe].layer)*20/ue,ht=0,$t=[];for(let Fn=pt.line[Xe].start;Fn<=pt.line[Xe].end;Fn++){let wn=pt.position[Fn].x,ir=pt.position[Fn].y,Ir=pt.position[Fn].z;ht++,$t.push(new Ie(wn,ir,Ir))}let Ft=new SA($t);ht=Ee?Math.ceil(ht/5):ht;const dn=new pI,At=new Jn(new OD(Ft,ht,et,Oe,!1),st);At.scale.set(1,1,1),dn.addLevel(At,0);const It=80,Kn=[$t[0]];for(let Fn=1;Fn<$t.length;Fn++){const wn=Kn[Kn.length-1],ir=$t[Fn];(wn.distanceTo(ir)>It||Fn===$t.length-1)&&Kn.push(ir)}const lr=new Ea(new Di().setFromPoints(Kn),new Jc({color:ze}));lr.scale.set(1,1,1),dn.addLevel(lr,10),dn.name=it,dn.myMeshType="Vessel",dn.autoUpdate=!1,bt.add(dn)}bt.scale.set(Hi.current*.1,Hi.current*.1,Hi.current*.1),bt.translateX(eo.current),bt.translateY(Ya.current),bt.translateZ(ja.current),bt.name=it,bt.myMeshType="Vessel",_e.current.add(bt);let De={contentobj:bt,contentmaterial:st};i.current[it]=De,ot&&ot()})},Et=ut=>{ut=ut.replace("#","");const Oe=parseInt(ut.slice(0,2),16),ze=parseInt(ut.slice(2,4),16),it=parseInt(ut.slice(4,6),16),ot=Oe/255,pt=ze/255,bt=it/255;return new Ie(ot,pt,bt)},cn=(ut,Oe,ze,it)=>{fetch(ut).then(ot=>ot.json()).then(ot=>{let pt=new hf,bt=new Di,st=[];for(let ue=0;ue<ot.position.length;ue++){let De=ot.position[ue].split(","),Xe=De[0],et=De[1],ht=De[2];st.push(Xe*Hi.current*.099,et*Hi.current*.099,ht*Hi.current*.099)}bt.setAttribute("position",new la(st,3)),Et(Oe);let Ee=new AD({size:pe.current/100,color:new Ar(Oe)});pt=new hf(bt,Ee),pt.translateX(eo.current),pt.translateY(Ya.current),pt.translateZ(ja.current-.45),pt.name=ze,re.current[ze]=pt,_e.current.add(pt)}),it&&it()},Bt=ut=>{dt.current=!0;let Oe=new URL(window.location.href),ze=new URLSearchParams(Oe.search);ze.set("neuronsProjects",JSON.stringify(ut)),Oe.search=ze.toString(),window.history.replaceState({},"",Oe),ut!=""?K(ut):(K(ut),W(Te.current))},Gn=ti(Bt,50),Qn=ut=>{dt.current=!0;let Oe=new URL(window.location.href),ze=new URLSearchParams(Oe.search);ze.set("neuronsSomaLocates",ut?JSON.stringify(ut):""),Oe.search=ze.toString(),window.history.replaceState({},"",Oe),ut!=""?te(ut):(te(ut),W(Te.current))},Ur=ti(Qn,50),ii=()=>{let ut=[na.current,Ma.current,oe.current];for(let ot of ut)for(let pt in ot)pt!="Brain"&&ci(pt,!0);de([]),Object.keys(re.current).forEach(ot=>{for(let pt in _==null?void 0:_.current[ot])_e.current.remove(_==null?void 0:_.current[ot][pt]);Ja(ot)}),Object.keys(i.current).forEach(ot=>{si(ot)}),m([]),_&&(_.current={}),Q.current=[];let Oe=new URL(window.location.href),ze=new URLSearchParams(Oe.search);const it=JSON.stringify(Q.current);s==="fbx"?ze.set("regionsChecked",it):s==="vessel"?ze.set("vesselsChecked",it):s==="swc"&&(ze.set("neuronsChecked",it),ze.set("neuronsText",it)),Oe.search=ze.toString(),window.history.replaceState({},"",Oe)},mi=(ut,Oe)=>{let ze=0;for(const it of ut.toLowerCase())if(it===Oe[ze]&&(ze++,ze===Oe.length))return!0;return!1},Hr=ut=>{if(ut){const Oe=ut.toLowerCase(),ze=Be.current.map(it=>{const ot=it.name&&it.name.toLowerCase()===Oe,pt=it.fullname&&mi(it.fullname,Oe);return{...it,matchPriority:ot?1:pt?2:3}}).filter(it=>it.matchPriority<3).sort((it,ot)=>it.matchPriority-ot.matchPriority).map(it=>({value:`${it.name} ${it.fullname}`,label:`${it.name} ${it.fullname}`}));Ue(ze)}else Ue([])};S.useEffect(()=>{dt.current&&(Y?Le.current&&Le.current.focus():Ne.current&&Ne.current.focus())},[Y]),S.useEffect(()=>{dt.current&&(ee?at.current&&at.current.focus():qe.current&&qe.current.focus())},[ee]);const Jr=(ut,Oe)=>{let ze=null,it=null;for(let ot=0;ot<ut.length;ot++)if(ut[ot].name==Oe)return ze=ut[ot].path,it=ut[ot].color,{path:ze,color:it};return{path:ze,color:it}},wi={emptyText:S.createElement(Rv,{description:S.createElement("div",{style:{color:"#ccc"}},"Neurons that meet the filter criteria entered in the input boxes above will be displayed here.")})},Ln={selectedRowKeys:v,onSelectAll:(ut,Oe,ze)=>{ha(Oe,ze,ut,!0)},onSelect:(ut,Oe,ze)=>{ha(ut,ze,Oe,!1)},getCheckboxProps:ut=>({name:ut.name})},er=ut=>{let Oe=new URL(window.location.href),ze=new URLSearchParams(Oe.search);const it=JSON.stringify(ut);ze.set("neuronsFilterInfo",it),Oe.search=ze.toString(),window.history.replaceState({},"",Oe),St(ut)},sn=ut=>{_t(ut)};return S.createElement("div",{ref:l,style:{transition:"all ease-in 0.5s"}},s==="swc"?S.createElement(S.Fragment,null,Y?S.createElement(hA,{ref:Le,style:{width:"100%",marginBottom:8},options:he,placeholder:h("5000.5040")||"Input the region that soma locates",onSearch:Hr,onChange:Ur,value:Y}):S.createElement(UE,{ref:Ne,showSearch:!0,style:{width:"100%",marginBottom:8},value:Y,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:h("5000.5040")||"Input the region that soma locates",allowClear:!0,treeDefaultExpandAll:!1,onChange:Qn,onSearch:Qn,treeData:yr(r)}),ee?S.createElement(hA,{ref:at,style:{width:"100%",marginBottom:8},options:he,placeholder:h("5000.5041")||"Input the region that neuron projects",onSearch:Hr,onChange:Gn,value:ee}):S.createElement(UE,{showSearch:!0,ref:qe,style:{width:"100%"},value:ee,dropdownStyle:{maxHeight:400,overflow:"hidden",marginBottom:8},placeholder:h("5000.5041")||"Input the region that neuron projects",allowClear:!0,treeDefaultExpandAll:!1,onChange:Bt,onSearch:Bt,treeData:yr(r)}),z&&S.createElement(S.Fragment,null,S.createElement(UE,{treeData:Me,value:ct,onChange:er,treeCheckable:!0,placeholder:"Filter by data information",style:{width:"100%",marginTop:8}}),S.createElement(ts,{style:{marginTop:"5px"}},S.createElement(Qy,{onChange:ut=>{Rn(ut.target.checked)}},h("7000.7025")||"只展示可用神经元"),S.createElement(ts,{style:{fontStyle:"italic",marginTop:"5px"}},h("7000.7026")||"点击Color按钮,修改神经元颜色;点击Ana.按钮,显示神经元投射路径分析结果;点击Path按钮,在主界面显示神经元经过的脑结构;Src按钮展示了神经元数据的来源"))),S.createElement("div",null,S.createElement(Wo,{className:"Echart",open:nt,onOk:()=>{yt(!1)},onCancel:()=>{yt(!1)},width:"auto",footer:null},S.createElement(lg,{activeKey:Fe,onChange:sn},S.createElement(Yz,{tab:h("5000.7009")||"神经元末梢分布",key:"1"},tn&&S.createElement($i,null,"Isocortex"),S.createElement(Xl,{ref:Nt,className:"Isocortex",Name:"Isocortex",t:h,data_change:Gt,data_c:vt.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"]}),jt&&S.createElement($i,null,"HPF"),S.createElement(Xl,{ref:gr[0],className:"HPF",Name:"HPF",t:h,data_change:Gt,data_c:vt.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"]}),S.createElement(Xl,{ref:gr[1],className:"HPF",Name:"HPF",t:h,data_change:Gt,data_c:vt.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),S.createElement(Xl,{ref:gr[2],className:"HPF",Name:"HPF",t:h,data_change:Gt,data_c:vt.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),vn&&S.createElement($i,null,"CNU"),S.createElement(Xl,{ref:Lr,className:"CNU",Name:"CNU",t:h,data_change:Gt,data_c:vt.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:["_"]}),pr&&S.createElement($i,null,"OLF"),S.createElement(Xl,{ref:rr[0],className:"OLF",Name:"OLF",t:h,data_change:Gt,data_c:vt.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),S.createElement(Xl,{ref:rr[1],className:"OLF",Name:"OLF",t:h,data_change:Gt,data_c:vt.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"]}),zr&&S.createElement($i,null,"TH"),S.createElement(Xl,{ref:Dt,className:"TH",Name:"TH",t:h,data_change:Gt,data_c:vt.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:["_"]}),Xn&&S.createElement($i,null,"HY"),S.createElement(Xl,{ref:Lt,className:"HY",Name:"HY",t:h,data_change:Gt,data_c:vt.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:["_"]}),Vt&&S.createElement($i,null,"MB"),S.createElement(Xl,{ref:Zt,className:"MB",Name:"MB",t:h,data_change:Gt,data_c:vt.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:["_"]}),Wt&&S.createElement($i,null,"HB"),S.createElement(Xl,{ref:zt,className:"HB",Name:"HB",t:h,data_change:Gt,data_c:vt.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:["_"]}),On&&S.createElement($i,null,"CB"),S.createElement(Xl,{ref:yn[0],className:"CB",Name:"CB",t:h,data_change:Gt,data_c:vt.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"]}),S.createElement(Xl,{ref:yn[1],className:"CB",Name:"CB",t:h,data_change:Gt,data_c:vt.current,col:["FN","IP","DN","VeCB"],row:["_"]})),S.createElement(Yz,{tab:h("5000.7011")||"神经元投射模式",key:"2"},r?S.createElement(vze,{data:Ut,fbxTreeDatas:r}):null),S.createElement(Yz,{tab:h("5000.7012")||"投射长度分布",key:"3"},tn&&S.createElement($i,null,"Isocortex"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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"]}),jt&&S.createElement($i,null,"HPF"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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"]}),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),vn&&S.createElement($i,null,"CNU"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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:["_"]}),pr&&S.createElement($i,null,"OLF"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),zr&&S.createElement($i,null,"TH"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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:["_"]}),Xn&&S.createElement($i,null,"HY"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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:["_"]}),Vt&&S.createElement($i,null,"MB"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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:["_"]}),Wt&&S.createElement($i,null,"HB"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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:["_"]}),On&&S.createElement($i,null,"CB"),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,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"]}),S.createElement(Zl,{t:h,data_change:Gt,data_c:Ut,col:["FN","IP","DN","VeCB"],row:["_"]})))),S.createElement(F6,{className:"SwcTable",rowSelection:Ln,columns:qi,dataSource:vr,locale:wi}))):S.createElement(S.Fragment,null,S.createElement(xtn,{style:{marginBottom:8},placeholder:"Search",onChange:Dr,onKeyPress:ut=>{ut.stopPropagation()}}),S.createElement(_3,{showLine:!0,onExpand:Ua,defaultExpandParent:!0,expandedKeys:G,onCheck:ha,checkable:!0,selectable:!1,treeData:vr,checkedKeys:v,checkStrictly:!0,autoExpandParent:H,style:{paddingLeft:"2px"}})))});let Itn=new URL(window.location.href),Atn=new URLSearchParams(Itn.search),PSe=Atn.get("brainContourOpacity");const Rtn=t=>{const{regionData:e}=t,[n,r]=S.useState(!1);return S.useEffect(()=>{let i=PSe?JSON.parse(PSe):.3;py({filepath:e+"/data/FBX/outline.FBX",index:"Brain",color:"0xcccccc",opacity:i,offsetZ:0,R:1,callback:function(){r(!1)}})},[]),S.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"}},S.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},S.createElement(cD,{spinning:!0,size:"large"}),S.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,l=Math.max(32,o+(o>>1)+7),u=new Uint8Array(l>>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){l+=8,l*=1+a/r.length*2,l=l>>3<<3;const f=new Uint8Array(l);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,l=[];for(;o<s;){const u=a[o++];if(u===0)break;if(!(u&128))l.push(u);else if((u&224)===192){const d=a[o++]&63;l.push((u&31)<<6|d)}else if((u&240)===224){const d=a[o++]&63,f=a[o++]&63;l.push((u&31)<<12|d<<6|f)}else if((u&248)===240){const d=a[o++]&63,f=a[o++]&63,p=a[o++]&63;let h=(u&7)<<18|d<<12|f<<6|p;h>65535&&(h-=65536,l.push(h>>>10&1023|55296),h=56320|h&1023),l.push(h)}}return String.fromCharCode.apply(null,l)},t.TextEncoder=e,t.TextDecoder=n})(typeof window<"u"?window:typeof self<"u"?self:globalThis);function DSe(t,e="utf8"){return new TextDecoder(e).decode(t)}const Otn=new TextEncoder;function Ltn(t){return Otn.encode(t)}const Ntn=1024*8,Mtn=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),Qz={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 xk{constructor(e=Ntn,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 xk)&&(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=Qz[n].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,a=this.buffer.slice(i,i+r);if(this.littleEndian===Mtn&&n!=="uint8"&&n!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const l=new Qz[n](s.buffer);return this.offset+=r,l.reverse(),l}const o=new Qz[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 DSe(this.readBytes(e))}decodeText(e=1,n="utf-8"){return DSe(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(Ltn(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function Ptn(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 Dtn(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 ktn(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 zQ={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"},yze={};for(const t in zQ)yze[zQ[t]]=Number(t);const Utn=Object.freeze(Object.defineProperty({__proto__:null,tagsById:zQ,tagsByName:yze},Symbol.toStringTag,{value:"Module"})),HQ={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"},bze={};for(const t in HQ)bze[HQ[t]]=Number(t);const Ftn=Object.freeze(Object.defineProperty({__proto__:null,tagsById:HQ,tagsByName:bze},Symbol.toStringTag,{value:"Module"})),GQ={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"},Eze={};for(const t in GQ)Eze[GQ[t]]=Number(t);const Btn=Object.freeze(Object.defineProperty({__proto__:null,tagsById:GQ,tagsByName:Eze},Symbol.toStringTag,{value:"Module"})),kSe={standard:Btn,exif:Utn,gps:Ftn};class Sze{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(kSe[this.kind].tagsByName[e]);throw new Error("expected a number or string")}get map(){if(!this._hasMap){const e=kSe[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 Cze=new Map([[1,[1,USe]],[2,[1,ztn]],[3,[2,Htn]],[4,[4,Gtn]],[5,[8,jtn]],[6,[1,Wtn]],[7,[1,USe]],[8,[2,Xtn]],[9,[4,Ztn]],[10,[8,qtn]],[11,[4,Ytn]],[12,[8,Ktn]]]);function $tn(t,e){const n=Cze.get(t);if(!n)throw new Error(`type not found: ${t}`);return n[0]*e}function Vtn(t,e,n){const r=Cze.get(e);if(!r)throw new Error(`type not found: ${e}`);return r[1](t,n)}function USe(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 ztn(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 Htn(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 Gtn(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 jtn(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 Wtn(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 Xtn(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 Ztn(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 qtn(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 Ytn(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 Ktn(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 Jtn=256,FSe=257,BSe=258,$Se=9;let wE=[];function Qtn(){if(wE.length===0){for(let e=0;e<256;e++)wE.push([e]);const t=[];for(let e=256;e<4096;e++)wE.push(t)}}const enn=[511,1023,2047,4095],tnn=[0,0,0,0,0,0,0,0,0,511,1023,2047,4095];class nnn{constructor(e){this.nextData=0,this.nextBits=0,this.bytePointer=0,this.tableLength=BSe,this.currentBitLength=$Se,this.stripArray=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),this.outData=new xk(e.byteLength),this.initializeTable()}decode(){let e=0,n=0;for(;(e=this.getNextCode())!==FSe;)if(e===Jtn){if(this.initializeTable(),e=this.getNextCode(),e===FSe)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(){Qtn(),this.tableLength=BSe,this.currentBitLength=$Se}writeString(e){this.outData.writeBytes(e)}stringFromCode(e){return wE[e]}isInTable(e){return e<this.tableLength}addStringToTable(e){if(wE[this.tableLength++]=e,wE.length>4096)throw wE=[],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===tnn[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&enn[this.currentBitLength-9];return this.nextBits-=this.currentBitLength,this.bytePointer>this.stripArray.length?257:e}}function rnn(t){return new nnn(t).decode()}const inn=/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;class VSe extends Sze{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=inn.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 QO(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 QO(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 QO(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 QO(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 QO(t){return typeof t=="number"?[t]:t}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const ann=4,zSe=0,HSe=1,onn=2;function Ww(t){let e=t.length;for(;--e>=0;)t[e]=0}const snn=0,xze=1,lnn=2,cnn=3,unn=258,zae=29,d8=256,QA=d8+1+zae,r3=30,Hae=19,_ze=2*QA+1,TE=15,eH=16,dnn=7,Gae=256,wze=16,Tze=17,Ize=18,jQ=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]),PN=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]),fnn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Aze=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pnn=512,Iv=new Array((QA+2)*2);Ww(Iv);const PI=new Array(r3*2);Ww(PI);const e6=new Array(pnn);Ww(e6);const t6=new Array(unn-cnn+1);Ww(t6);const jae=new Array(zae);Ww(jae);const R7=new Array(r3);Ww(R7);function tH(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 Rze,Oze,Lze;function nH(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const Nze=t=>t<256?e6[t]:e6[256+(t>>>7)],n6=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},_p=(t,e,n)=>{t.bi_valid>eH-n?(t.bi_buf|=e<<t.bi_valid&65535,n6(t,t.bi_buf),t.bi_buf=e>>eH-t.bi_valid,t.bi_valid+=n-eH):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},y0=(t,e,n)=>{_p(t,n[e*2],n[e*2+1])},Mze=(t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},hnn=t=>{t.bi_valid===16?(n6(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)},gnn=(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,l=e.stat_desc.max_length;let u,d,f,p,h,g,y=0;for(p=0;p<=TE;p++)t.bl_count[p]=0;for(n[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<_ze;u++)d=t.heap[u],p=n[n[d*2+1]*2+1]+1,p>l&&(p=l,y++),n[d*2+1]=p,!(d>r)&&(t.bl_count[p]++,h=0,d>=s&&(h=o[d-s]),g=n[d*2],t.opt_len+=g*(p+h),a&&(t.static_len+=g*(i[d*2+1]+h)));if(y!==0){do{for(p=l-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[l]--,y-=2}while(y>0);for(p=l;p!==0;p--)for(d=t.bl_count[p];d!==0;)f=t.heap[--u],!(f>r)&&(n[f*2+1]!==p&&(t.opt_len+=(p-n[f*2+1])*n[f*2],n[f*2+1]=p),d--)}},Pze=(t,e,n)=>{const r=new Array(TE+1);let i=0,a,o;for(a=1;a<=TE;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]=Mze(r[s]++,s))}},mnn=()=>{let t,e,n,r,i;const a=new Array(TE+1);for(n=0,r=0;r<zae-1;r++)for(jae[r]=n,t=0;t<1<<jQ[r];t++)t6[n++]=r;for(t6[n-1]=r,i=0,r=0;r<16;r++)for(R7[r]=i,t=0;t<1<<PN[r];t++)e6[i++]=r;for(i>>=7;r<r3;r++)for(R7[r]=i<<7,t=0;t<1<<PN[r]-7;t++)e6[256+i++]=r;for(e=0;e<=TE;e++)a[e]=0;for(t=0;t<=143;)Iv[t*2+1]=8,t++,a[8]++;for(;t<=255;)Iv[t*2+1]=9,t++,a[9]++;for(;t<=279;)Iv[t*2+1]=7,t++,a[7]++;for(;t<=287;)Iv[t*2+1]=8,t++,a[8]++;for(Pze(Iv,QA+1,a),t=0;t<r3;t++)PI[t*2+1]=5,PI[t*2]=Mze(t,5);Rze=new tH(Iv,jQ,d8+1,QA,TE),Oze=new tH(PI,PN,0,r3,TE),Lze=new tH(new Array(0),fnn,0,Hae,dnn)},Dze=t=>{let e;for(e=0;e<QA;e++)t.dyn_ltree[e*2]=0;for(e=0;e<r3;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Hae;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Gae*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},kze=t=>{t.bi_valid>8?n6(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},GSe=(t,e,n,r)=>{const i=e*2,a=n*2;return t[i]<t[a]||t[i]===t[a]&&r[e]<=r[n]},rH=(t,e,n)=>{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i<t.heap_len&&GSe(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!GSe(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r},jSe=(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?y0(t,i,e):(o=t6[i],y0(t,o+d8+1,e),s=jQ[o],s!==0&&(i-=jae[o],_p(t,i,s)),r--,o=Nze(r),y0(t,o,n),s=PN[o],s!==0&&(r-=R7[o],_p(t,r,s)));while(a<t.sym_next);y0(t,Gae,e)},WQ=(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,l=-1,u;for(t.heap_len=0,t.heap_max=_ze,o=0;o<a;o++)n[o*2]!==0?(t.heap[++t.heap_len]=l=o,t.depth[o]=0):n[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=l<2?++l:0,n[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=r[u*2+1]);for(e.max_code=l,o=t.heap_len>>1;o>=1;o--)rH(t,n,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],rH(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++,rH(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],gnn(t,e),Pze(n,l,t.bl_count)},WSe=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,l=7,u=4;for(o===0&&(l=138,u=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=e[(r+1)*2+1],!(++s<l&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[wze*2]++):s<=10?t.bl_tree[Tze*2]++:t.bl_tree[Ize*2]++,s=0,i=a,o===0?(l=138,u=3):a===o?(l=6,u=3):(l=7,u=4))},XSe=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,l=7,u=4;for(o===0&&(l=138,u=3),r=0;r<=n;r++)if(a=o,o=e[(r+1)*2+1],!(++s<l&&a===o)){if(s<u)do y0(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(y0(t,a,t.bl_tree),s--),y0(t,wze,t.bl_tree),_p(t,s-3,2)):s<=10?(y0(t,Tze,t.bl_tree),_p(t,s-3,3)):(y0(t,Ize,t.bl_tree),_p(t,s-11,7));s=0,i=a,o===0?(l=138,u=3):a===o?(l=6,u=3):(l=7,u=4)}},vnn=t=>{let e;for(WSe(t,t.dyn_ltree,t.l_desc.max_code),WSe(t,t.dyn_dtree,t.d_desc.max_code),WQ(t,t.bl_desc),e=Hae-1;e>=3&&t.bl_tree[Aze[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},ynn=(t,e,n,r)=>{let i;for(_p(t,e-257,5),_p(t,n-1,5),_p(t,r-4,4),i=0;i<r;i++)_p(t,t.bl_tree[Aze[i]*2+1],3);XSe(t,t.dyn_ltree,e-1),XSe(t,t.dyn_dtree,n-1)},bnn=t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return zSe;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return HSe;for(n=32;n<d8;n++)if(t.dyn_ltree[n*2]!==0)return HSe;return zSe};let ZSe=!1;const Enn=t=>{ZSe||(mnn(),ZSe=!0),t.l_desc=new nH(t.dyn_ltree,Rze),t.d_desc=new nH(t.dyn_dtree,Oze),t.bl_desc=new nH(t.bl_tree,Lze),t.bi_buf=0,t.bi_valid=0,Dze(t)},Uze=(t,e,n,r)=>{_p(t,(snn<<1)+(r?1:0),3),kze(t),n6(t,n),n6(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},Snn=t=>{_p(t,xze<<1,3),y0(t,Gae,Iv),hnn(t)},Cnn=(t,e,n,r)=>{let i,a,o=0;t.level>0?(t.strm.data_type===onn&&(t.strm.data_type=bnn(t)),WQ(t,t.l_desc),WQ(t,t.d_desc),o=vnn(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?Uze(t,e,n,r):t.strategy===ann||a===i?(_p(t,(xze<<1)+(r?1:0),3),jSe(t,Iv,PI)):(_p(t,(lnn<<1)+(r?1:0),3),ynn(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),jSe(t,t.dyn_ltree,t.dyn_dtree)),Dze(t),r&&kze(t)},xnn=(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[(t6[n]+d8+1)*2]++,t.dyn_dtree[Nze(e)*2]++),t.sym_next===t.sym_end);var _nn=Enn,wnn=Uze,Tnn=Cnn,Inn=xnn,Ann=Snn,Rnn={_tr_init:_nn,_tr_stored_block:wnn,_tr_flush_block:Tnn,_tr_tally:Inn,_tr_align:Ann};const Onn=(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 r6=Onn;const Lnn=()=>{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},Nnn=new Uint32Array(Lnn()),Mnn=(t,e,n,r)=>{const i=Nnn,a=r+n;t^=-1;for(let o=r;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1};var gd=Mnn,j3={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"},f8={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:Pnn,_tr_stored_block:XQ,_tr_flush_block:Dnn,_tr_tally:Hy,_tr_align:knn}=Rnn,{Z_NO_FLUSH:Gy,Z_PARTIAL_FLUSH:Unn,Z_FULL_FLUSH:Fnn,Z_FINISH:ig,Z_BLOCK:qSe,Z_OK:Ud,Z_STREAM_END:YSe,Z_STREAM_ERROR:O0,Z_DATA_ERROR:Bnn,Z_BUF_ERROR:iH,Z_DEFAULT_COMPRESSION:$nn,Z_FILTERED:Vnn,Z_HUFFMAN_ONLY:eL,Z_RLE:znn,Z_FIXED:Hnn,Z_DEFAULT_STRATEGY:Gnn,Z_UNKNOWN:jnn,Z_DEFLATED:_k}=f8,Wnn=9,Xnn=15,Znn=8,qnn=29,Ynn=256,ZQ=Ynn+1+qnn,Knn=30,Jnn=19,Qnn=2*ZQ+1,ern=15,fs=3,Oy=258,L0=Oy+fs+1,trn=32,W3=42,Wae=57,qQ=69,YQ=73,KQ=91,JQ=103,IE=113,j5=666,jf=1,Xw=2,xS=3,Zw=4,nrn=3,AE=(t,e)=>(t.msg=j3[e],e),KSe=t=>t*2-(t>4?9:0),hy=t=>{let e=t.length;for(;--e>=0;)t[e]=0},rrn=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 irn=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,jy=irn;const Kp=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))},ah=(t,e)=>{Dnn(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Kp(t.strm)},Vs=(t,e)=>{t.pending_buf[t.pending++]=e},Y4=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},QQ=(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=r6(t.adler,e,i,n):t.state.wrap===2&&(t.adler=gd(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},Fze=(t,e)=>{let n=t.max_chain_length,r=t.strstart,i,a,o=t.prev_length,s=t.nice_match;const l=t.strstart>t.w_size-L0?t.strstart-(t.w_size-L0):0,u=t.window,d=t.w_mask,f=t.prev,p=t.strstart+Oy;let h=u[r+o-1],g=u[r+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(u[i+o]!==g||u[i+o-1]!==h||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<p);if(a=Oy-(p-r),r=p-Oy,a>o){if(t.match_start=e,o=a,a>=s)break;h=u[r+o-1],g=u[r+o]}}while((e=f[e&d])>l&&--n!==0);return o<=t.lookahead?o:t.lookahead},X3=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-L0)&&(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),rrn(t),r+=e),t.strm.avail_in===0)break;if(n=QQ(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=fs)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=jy(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=jy(t,t.ins_h,t.window[i+fs-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<fs)););}while(t.lookahead<L0&&t.strm.avail_in!==0)},Bze=(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!==ig||e===Gy||r!==i+t.strm.avail_in)))break;o=e===ig&&r===i+t.strm.avail_in?1:0,XQ(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,Kp(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&&(QQ(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?Zw:e!==Gy&&e!==ig&&t.strm.avail_in===0&&t.strstart===t.block_start?Xw:(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&&(QQ(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===ig)&&e!==Gy&&t.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=e===ig&&t.strm.avail_in===0&&r===i?1:0,XQ(t,t.block_start,r,o),t.block_start+=r,Kp(t.strm)),o?xS:jf)},aH=(t,e)=>{let n,r;for(;;){if(t.lookahead<L0){if(X3(t),t.lookahead<L0&&e===Gy)return jf;if(t.lookahead===0)break}if(n=0,t.lookahead>=fs&&(t.ins_h=jy(t,t.ins_h,t.window[t.strstart+fs-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-L0&&(t.match_length=Fze(t,n)),t.match_length>=fs)if(r=Hy(t,t.strstart-t.match_start,t.match_length-fs),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=fs){t.match_length--;do t.strstart++,t.ins_h=jy(t,t.ins_h,t.window[t.strstart+fs-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=jy(t,t.ins_h,t.window[t.strstart+1]);else r=Hy(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(ah(t,!1),t.strm.avail_out===0))return jf}return t.insert=t.strstart<fs-1?t.strstart:fs-1,e===ig?(ah(t,!0),t.strm.avail_out===0?xS:Zw):t.sym_next&&(ah(t,!1),t.strm.avail_out===0)?jf:Xw},xx=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<L0){if(X3(t),t.lookahead<L0&&e===Gy)return jf;if(t.lookahead===0)break}if(n=0,t.lookahead>=fs&&(t.ins_h=jy(t,t.ins_h,t.window[t.strstart+fs-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=fs-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-L0&&(t.match_length=Fze(t,n),t.match_length<=5&&(t.strategy===Vnn||t.match_length===fs&&t.strstart-t.match_start>4096)&&(t.match_length=fs-1)),t.prev_length>=fs&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-fs,r=Hy(t,t.strstart-1-t.prev_match,t.prev_length-fs),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=jy(t,t.ins_h,t.window[t.strstart+fs-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=fs-1,t.strstart++,r&&(ah(t,!1),t.strm.avail_out===0))return jf}else if(t.match_available){if(r=Hy(t,0,t.window[t.strstart-1]),r&&ah(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return jf}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=Hy(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<fs-1?t.strstart:fs-1,e===ig?(ah(t,!0),t.strm.avail_out===0?xS:Zw):t.sym_next&&(ah(t,!1),t.strm.avail_out===0)?jf:Xw},arn=(t,e)=>{let n,r,i,a;const o=t.window;for(;;){if(t.lookahead<=Oy){if(X3(t),t.lookahead<=Oy&&e===Gy)return jf;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=fs&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=t.strstart+Oy;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=Oy-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=fs?(n=Hy(t,1,t.match_length-fs),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Hy(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(ah(t,!1),t.strm.avail_out===0))return jf}return t.insert=0,e===ig?(ah(t,!0),t.strm.avail_out===0?xS:Zw):t.sym_next&&(ah(t,!1),t.strm.avail_out===0)?jf:Xw},orn=(t,e)=>{let n;for(;;){if(t.lookahead===0&&(X3(t),t.lookahead===0)){if(e===Gy)return jf;break}if(t.match_length=0,n=Hy(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(ah(t,!1),t.strm.avail_out===0))return jf}return t.insert=0,e===ig?(ah(t,!0),t.strm.avail_out===0?xS:Zw):t.sym_next&&(ah(t,!1),t.strm.avail_out===0)?jf:Xw};function Qm(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 W5=[new Qm(0,0,0,0,Bze),new Qm(4,4,8,4,aH),new Qm(4,5,16,8,aH),new Qm(4,6,32,32,aH),new Qm(4,4,16,16,xx),new Qm(8,16,32,32,xx),new Qm(8,16,128,128,xx),new Qm(8,32,128,256,xx),new Qm(32,128,258,1024,xx),new Qm(32,258,258,4096,xx)],srn=t=>{t.window_size=2*t.w_size,hy(t.head),t.max_lazy_match=W5[t.level].max_lazy,t.good_match=W5[t.level].good_length,t.nice_match=W5[t.level].nice_length,t.max_chain_length=W5[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=fs-1,t.match_available=0,t.ins_h=0};function lrn(){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=_k,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(Qnn*2),this.dyn_dtree=new Uint16Array((2*Knn+1)*2),this.bl_tree=new Uint16Array((2*Jnn+1)*2),hy(this.dyn_ltree),hy(this.dyn_dtree),hy(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ern+1),this.heap=new Uint16Array(2*ZQ+1),hy(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*ZQ+1),hy(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 p8=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==W3&&e.status!==Wae&&e.status!==qQ&&e.status!==YQ&&e.status!==KQ&&e.status!==JQ&&e.status!==IE&&e.status!==j5?1:0},$ze=t=>{if(p8(t))return AE(t,O0);t.total_in=t.total_out=0,t.data_type=jnn;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Wae:e.wrap?W3:IE,t.adler=e.wrap===2?0:1,e.last_flush=-2,Pnn(e),Ud},Vze=t=>{const e=$ze(t);return e===Ud&&srn(t.state),e},crn=(t,e)=>p8(t)||t.state.wrap!==2?O0:(t.state.gzhead=e,Ud),zze=(t,e,n,r,i,a)=>{if(!t)return O0;let o=1;if(e===$nn&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Wnn||n!==_k||r<8||r>15||e<0||e>9||a<0||a>Hnn||r===8&&o!==1)return AE(t,O0);r===8&&(r=9);const s=new lrn;return t.state=s,s.strm=t,s.status=W3,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+fs-1)/fs),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,Vze(t)},urn=(t,e)=>zze(t,e,_k,Xnn,Znn,Gnn),drn=(t,e)=>{if(p8(t)||e>qSe||e<0)return t?AE(t,O0):O0;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===j5&&e!==ig)return AE(t,t.avail_out===0?iH:O0);const r=n.last_flush;if(n.last_flush=e,n.pending!==0){if(Kp(t),t.avail_out===0)return n.last_flush=-1,Ud}else if(t.avail_in===0&&KSe(e)<=KSe(r)&&e!==ig)return AE(t,iH);if(n.status===j5&&t.avail_in!==0)return AE(t,iH);if(n.status===W3&&n.wrap===0&&(n.status=IE),n.status===W3){let i=_k+(n.w_bits-8<<4)<<8,a=-1;if(n.strategy>=eL||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,i|=a<<6,n.strstart!==0&&(i|=trn),i+=31-i%31,Y4(n,i),n.strstart!==0&&(Y4(n,t.adler>>>16),Y4(n,t.adler&65535)),t.adler=1,n.status=IE,Kp(t),n.pending!==0)return n.last_flush=-1,Ud}if(n.status===Wae){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>=eL||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=gd(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=qQ;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>=eL||n.level<2?4:0),Vs(n,nrn),n.status=IE,Kp(t),n.pending!==0)return n.last_flush=-1,Ud}if(n.status===qQ){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=gd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Kp(t),n.pending!==0)return n.last_flush=-1,Ud;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=gd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=YQ}if(n.status===YQ){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=gd(t.adler,n.pending_buf,n.pending-i,i)),Kp(t),n.pending!==0)return n.last_flush=-1,Ud;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=gd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=KQ}if(n.status===KQ){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=gd(t.adler,n.pending_buf,n.pending-i,i)),Kp(t),n.pending!==0)return n.last_flush=-1,Ud;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=gd(t.adler,n.pending_buf,n.pending-i,i))}n.status=JQ}if(n.status===JQ){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Kp(t),n.pending!==0))return n.last_flush=-1,Ud;Vs(n,t.adler&255),Vs(n,t.adler>>8&255),t.adler=0}if(n.status=IE,Kp(t),n.pending!==0)return n.last_flush=-1,Ud}if(t.avail_in!==0||n.lookahead!==0||e!==Gy&&n.status!==j5){let i=n.level===0?Bze(n,e):n.strategy===eL?orn(n,e):n.strategy===znn?arn(n,e):W5[n.level].func(n,e);if((i===xS||i===Zw)&&(n.status=j5),i===jf||i===xS)return t.avail_out===0&&(n.last_flush=-1),Ud;if(i===Xw&&(e===Unn?knn(n):e!==qSe&&(XQ(n,0,0,!1),e===Fnn&&(hy(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Kp(t),t.avail_out===0))return n.last_flush=-1,Ud}return e!==ig?Ud:n.wrap<=0?YSe:(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)):(Y4(n,t.adler>>>16),Y4(n,t.adler&65535)),Kp(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ud:YSe)},frn=t=>{if(p8(t))return O0;const e=t.state.status;return t.state=null,e===IE?AE(t,Bnn):Ud},prn=(t,e)=>{let n=e.length;if(p8(t))return O0;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==W3||r.lookahead)return O0;if(i===1&&(t.adler=r6(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){i===0&&(hy(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(n-r.w_size,n),0),e=l,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,X3(r);r.lookahead>=fs;){let l=r.strstart,u=r.lookahead-(fs-1);do r.ins_h=jy(r,r.ins_h,r.window[l+fs-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=fs-1,X3(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=fs-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,r.wrap=i,Ud};var hrn=urn,grn=zze,mrn=Vze,vrn=$ze,yrn=crn,brn=drn,Ern=frn,Srn=prn,Crn="pako deflate (from Nodeca project)",DI={deflateInit:hrn,deflateInit2:grn,deflateReset:mrn,deflateResetKeep:vrn,deflateSetHeader:yrn,deflate:brn,deflateEnd:Ern,deflateSetDictionary:Srn,deflateInfo:Crn};const xrn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var _rn=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)xrn(n,r)&&(t[r]=n[r])}}return t},wrn=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},wk={assign:_rn,flattenChunks:wrn};let Hze=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hze=!1}const i6=new Uint8Array(256);for(let t=0;t<256;t++)i6[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;i6[254]=i6[254]=1;var Trn=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 Irn=(t,e)=>{if(e<65534&&t.subarray&&Hze)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 Arn=(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=i6[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 Irn(a,i)},Rrn=(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+i6[t[n]]>e?n:e},a6={string2buf:Trn,buf2string:Arn,utf8border:Rrn};function Orn(){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 Gze=Orn;const jze=Object.prototype.toString,{Z_NO_FLUSH:Lrn,Z_SYNC_FLUSH:Nrn,Z_FULL_FLUSH:Mrn,Z_FINISH:Prn,Z_OK:O7,Z_STREAM_END:Drn,Z_DEFAULT_COMPRESSION:krn,Z_DEFAULT_STRATEGY:Urn,Z_DEFLATED:Frn}=f8;function Xae(t){this.options=wk.assign({level:krn,method:Frn,chunkSize:16384,windowBits:15,memLevel:8,strategy:Urn},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 Gze,this.strm.avail_out=0;let n=DI.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==O7)throw new Error(j3[n]);if(e.header&&DI.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=a6.string2buf(e.dictionary):jze.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=DI.deflateSetDictionary(this.strm,r),n!==O7)throw new Error(j3[n]);this._dict_set=!0}}Xae.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?Prn:Lrn,typeof t=="string"?n.input=a6.string2buf(t):jze.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===Nrn||a===Mrn)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=DI.deflate(n,a),i===Drn)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=DI.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===O7;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};Xae.prototype.onData=function(t){this.chunks.push(t)};Xae.prototype.onEnd=function(t){t===O7&&(this.result=wk.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const tL=16209,Brn=16191;var $rn=function(e,n){let r,i,a,o,s,l,u,d,f,p,h,g,y,v,m,b,E,C,x,_,A,P,R,N;const D=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),l=D.dmax,u=D.wsize,d=D.whave,f=D.wnext,p=D.window,h=D.hold,g=D.bits,y=D.lencode,v=D.distcode,m=(1<<D.lenbits)-1,b=(1<<D.distbits)-1;e:do{g<15&&(h+=R[r++]<<g,g+=8,h+=R[r++]<<g,g+=8),E=y[h&m];t:for(;;){if(C=E>>>24,h>>>=C,g-=C,C=E>>>16&255,C===0)N[a++]=E&65535;else if(C&16){x=E&65535,C&=15,C&&(g<C&&(h+=R[r++]<<g,g+=8),x+=h&(1<<C)-1,h>>>=C,g-=C),g<15&&(h+=R[r++]<<g,g+=8,h+=R[r++]<<g,g+=8),E=v[h&b];n:for(;;){if(C=E>>>24,h>>>=C,g-=C,C=E>>>16&255,C&16){if(_=E&65535,C&=15,g<C&&(h+=R[r++]<<g,g+=8,g<C&&(h+=R[r++]<<g,g+=8)),_+=h&(1<<C)-1,_>l){e.msg="invalid distance too far back",D.mode=tL;break e}if(h>>>=C,g-=C,C=a-o,_>C){if(C=_-C,C>d&&D.sane){e.msg="invalid distance too far back",D.mode=tL;break e}if(A=0,P=p,f===0){if(A+=u-C,C<x){x-=C;do N[a++]=p[A++];while(--C);A=a-_,P=N}}else if(f<C){if(A+=u+f-C,C-=f,C<x){x-=C;do N[a++]=p[A++];while(--C);if(A=0,f<x){C=f,x-=C;do N[a++]=p[A++];while(--C);A=a-_,P=N}}}else if(A+=f-C,C<x){x-=C;do N[a++]=p[A++];while(--C);A=a-_,P=N}for(;x>2;)N[a++]=P[A++],N[a++]=P[A++],N[a++]=P[A++],x-=3;x&&(N[a++]=P[A++],x>1&&(N[a++]=P[A++]))}else{A=a-_;do N[a++]=N[A++],N[a++]=N[A++],N[a++]=N[A++],x-=3;while(x>2);x&&(N[a++]=N[A++],x>1&&(N[a++]=N[A++]))}}else if(C&64){e.msg="invalid distance code",D.mode=tL;break e}else{E=v[(E&65535)+(h&(1<<C)-1)];continue n}break}}else if(C&64)if(C&32){D.mode=Brn;break e}else{e.msg="invalid literal/length code",D.mode=tL;break e}else{E=y[(E&65535)+(h&(1<<C)-1)];continue t}break}}while(r<i&&a<s);x=g>>3,r-=x,g-=x<<3,h&=(1<<g)-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),D.hold=h,D.bits=g};const _x=15,JSe=852,QSe=592,eCe=0,oH=1,tCe=2,Vrn=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]),zrn=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]),Hrn=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]),Grn=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]),jrn=(t,e,n,r,i,a,o,s)=>{const l=s.bits;let u=0,d=0,f=0,p=0,h=0,g=0,y=0,v=0,m=0,b=0,E,C,x,_,A,P=null,R;const N=new Uint16Array(_x+1),D=new Uint16Array(_x+1);let U=null,z,B,j;for(u=0;u<=_x;u++)N[u]=0;for(d=0;d<r;d++)N[e[n+d]]++;for(h=l,p=_x;p>=1&&N[p]===0;p--);if(h>p&&(h=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<p&&N[f]===0;f++);for(h<f&&(h=f),v=1,u=1;u<=_x;u++)if(v<<=1,v-=N[u],v<0)return-1;if(v>0&&(t===eCe||p!==1))return-1;for(D[1]=0,u=1;u<_x;u++)D[u+1]=D[u]+N[u];for(d=0;d<r;d++)e[n+d]!==0&&(o[D[e[n+d]]++]=d);if(t===eCe?(P=U=o,R=20):t===oH?(P=Vrn,U=zrn,R=257):(P=Hrn,U=Grn,R=0),b=0,d=0,u=f,A=a,g=h,y=0,x=-1,m=1<<h,_=m-1,t===oH&&m>JSe||t===tCe&&m>QSe)return 1;for(;;){z=u-y,o[d]+1<R?(B=0,j=o[d]):o[d]>=R?(B=U[o[d]-R],j=P[o[d]-R]):(B=32+64,j=0),E=1<<u-y,C=1<<g,f=C;do C-=E,i[A+(b>>y)+C]=z<<24|B<<16|j|0;while(C!==0);for(E=1<<u-1;b&E;)E>>=1;if(E!==0?(b&=E-1,b+=E):b=0,d++,--N[u]===0){if(u===p)break;u=e[n+o[d]]}if(u>h&&(b&_)!==x){for(y===0&&(y=h),A+=f,g=u-y,v=1<<g;g+y<p&&(v-=N[g+y],!(v<=0));)g++,v<<=1;if(m+=1<<g,t===oH&&m>JSe||t===tCe&&m>QSe)return 1;x=b&_,i[x]=h<<24|g<<16|A-a|0}}return b!==0&&(i[A+b]=u-y<<24|64<<16|0),s.bits=h,0};var kI=jrn;const Wrn=0,Wze=1,Xze=2,{Z_FINISH:nCe,Z_BLOCK:Xrn,Z_TREES:nL,Z_OK:_S,Z_STREAM_END:Zrn,Z_NEED_DICT:qrn,Z_STREAM_ERROR:bg,Z_DATA_ERROR:Zze,Z_MEM_ERROR:qze,Z_BUF_ERROR:Yrn,Z_DEFLATED:rCe}=f8,Tk=16180,iCe=16181,aCe=16182,oCe=16183,sCe=16184,lCe=16185,cCe=16186,uCe=16187,dCe=16188,fCe=16189,L7=16190,fv=16191,sH=16192,pCe=16193,lH=16194,hCe=16195,gCe=16196,mCe=16197,vCe=16198,rL=16199,iL=16200,yCe=16201,bCe=16202,ECe=16203,SCe=16204,CCe=16205,cH=16206,xCe=16207,_Ce=16208,Ec=16209,Yze=16210,Kze=16211,Krn=852,Jrn=592,Qrn=15,ein=Qrn,wCe=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function tin(){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 WS=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Tk||e.mode>Kze?1:0},Jze=t=>{if(WS(t))return bg;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=Tk,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(Krn),e.distcode=e.distdyn=new Int32Array(Jrn),e.sane=1,e.back=-1,_S},Qze=t=>{if(WS(t))return bg;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Jze(t)},eHe=(t,e)=>{let n;if(WS(t))return bg;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?bg:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,Qze(t))},tHe=(t,e)=>{if(!t)return bg;const n=new tin;t.state=n,n.strm=t,n.window=null,n.mode=Tk;const r=eHe(t,e);return r!==_S&&(t.state=null),r},nin=t=>tHe(t,ein);let TCe=!0,uH,dH;const rin=t=>{if(TCe){uH=new Int32Array(512),dH=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(kI(Wze,t.lens,0,288,uH,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;kI(Xze,t.lens,0,32,dH,0,t.work,{bits:5}),TCe=!1}t.lencode=uH,t.lenbits=9,t.distcode=dH,t.distbits=5},nHe=(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},iin=(t,e)=>{let n,r,i,a,o,s,l,u,d,f,p,h,g,y,v=0,m,b,E,C,x,_,A,P;const R=new Uint8Array(4);let N,D;const U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(WS(t)||!t.output||!t.input&&t.avail_in!==0)return bg;n=t.state,n.mode===fv&&(n.mode=sH),o=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,f=s,p=l,P=_S;e:for(;;)switch(n.mode){case Tk:if(n.wrap===0){n.mode=sH;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=gd(n.check,R,2,0),u=0,d=0,n.mode=iCe;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=Ec;break}if((u&15)!==rCe){t.msg="unknown compression method",n.mode=Ec;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=Ec;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=u&512?fCe:fv,u=0,d=0;break;case iCe:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.flags=u,(n.flags&255)!==rCe){t.msg="unknown compression method",n.mode=Ec;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=Ec;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=gd(n.check,R,2,0)),u=0,d=0,n.mode=aCe;case aCe: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=gd(n.check,R,4,0)),u=0,d=0,n.mode=oCe;case oCe: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=gd(n.check,R,2,0)),u=0,d=0,n.mode=sCe;case sCe: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=gd(n.check,R,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=lCe;case lCe:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(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+h),A)),n.flags&512&&n.wrap&4&&(n.check=gd(n.check,r,h,a)),s-=h,a+=h,n.length-=h),n.length))break e;n.length=0,n.mode=cCe;case cCe:if(n.flags&2048){if(s===0)break e;h=0;do A=r[a+h++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&h<s);if(n.flags&512&&n.wrap&4&&(n.check=gd(n.check,r,h,a)),s-=h,a+=h,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=uCe;case uCe:if(n.flags&4096){if(s===0)break e;h=0;do A=r[a+h++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&h<s);if(n.flags&512&&n.wrap&4&&(n.check=gd(n.check,r,h,a)),s-=h,a+=h,A)break e}else n.head&&(n.head.comment=null);n.mode=dCe;case dCe: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=Ec;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=fv;break;case fCe:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}t.adler=n.check=wCe(u),u=0,d=0,n.mode=L7;case L7:if(n.havedict===0)return t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,qrn;t.adler=n.check=1,n.mode=fv;case fv:if(e===Xrn||e===nL)break e;case sH:if(n.last){u>>>=d&7,d-=d&7,n.mode=cH;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=pCe;break;case 1:if(rin(n),n.mode=rL,e===nL){u>>>=2,d-=2;break e}break;case 2:n.mode=gCe;break;case 3:t.msg="invalid block type",n.mode=Ec}u>>>=2,d-=2;break;case pCe: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=Ec;break}if(n.length=u&65535,u=0,d=0,n.mode=lH,e===nL)break e;case lH:n.mode=hCe;case hCe:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(a,a+h),o),s-=h,a+=h,l-=h,o+=h,n.length-=h;break}n.mode=fv;break;case gCe: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=Ec;break}n.have=0,n.mode=mCe;case mCe:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.lens[U[n.have++]]=u&7,u>>>=3,d-=3}for(;n.have<19;)n.lens[U[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},P=kI(Wrn,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid code lengths set",n.mode=Ec;break}n.have=0,n.mode=vCe;case vCe:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[u&(1<<n.lenbits)-1],m=v>>>24,b=v>>>16&255,E=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(E<16)u>>>=m,d-=m,n.lens[n.have++]=E;else{if(E===16){for(D=m+2;d<D;){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=Ec;break}A=n.lens[n.have-1],h=3+(u&3),u>>>=2,d-=2}else if(E===17){for(D=m+3;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,A=0,h=3+(u&7),u>>>=3,d-=3}else{for(D=m+7;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,A=0,h=11+(u&127),u>>>=7,d-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Ec;break}for(;h--;)n.lens[n.have++]=A}}if(n.mode===Ec)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Ec;break}if(n.lenbits=9,N={bits:n.lenbits},P=kI(Wze,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid literal/lengths set",n.mode=Ec;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},P=kI(Xze,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,P){t.msg="invalid distances set",n.mode=Ec;break}if(n.mode=rL,e===nL)break e;case rL:n.mode=iL;case iL:if(s>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,$rn(t,p),o=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,n.mode===fv&&(n.back=-1);break}for(n.back=0;v=n.lencode[u&(1<<n.lenbits)-1],m=v>>>24,b=v>>>16&255,E=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(b&&!(b&240)){for(C=m,x=b,_=E;v=n.lencode[_+((u&(1<<C+x)-1)>>C)],m=v>>>24,b=v>>>16&255,E=v&65535,!(C+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=m,d-=m,n.back+=m,n.length=E,b===0){n.mode=CCe;break}if(b&32){n.back=-1,n.mode=fv;break}if(b&64){t.msg="invalid literal/length code",n.mode=Ec;break}n.extra=b&15,n.mode=yCe;case yCe:if(n.extra){for(D=n.extra;d<D;){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=bCe;case bCe:for(;v=n.distcode[u&(1<<n.distbits)-1],m=v>>>24,b=v>>>16&255,E=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(!(b&240)){for(C=m,x=b,_=E;v=n.distcode[_+((u&(1<<C+x)-1)>>C)],m=v>>>24,b=v>>>16&255,E=v&65535,!(C+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=m,d-=m,n.back+=m,b&64){t.msg="invalid distance code",n.mode=Ec;break}n.offset=E,n.extra=b&15,n.mode=ECe;case ECe:if(n.extra){for(D=n.extra;d<D;){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=Ec;break}n.mode=SCe;case SCe:if(l===0)break e;if(h=p-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Ec;break}h>n.wnext?(h-=n.wnext,g=n.wsize-h):g=n.wnext-h,h>n.length&&(h=n.length),y=n.window}else y=i,g=o-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[o++]=y[g++];while(--h);n.length===0&&(n.mode=iL);break;case CCe:if(l===0)break e;i[o++]=n.length,l--,n.mode=iL;break;case cH:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[a++]<<d,d+=8}if(p-=l,t.total_out+=p,n.total+=p,n.wrap&4&&p&&(t.adler=n.check=n.flags?gd(n.check,i,p,o-p):r6(n.check,i,p,o-p)),p=l,n.wrap&4&&(n.flags?u:wCe(u))!==n.check){t.msg="incorrect data check",n.mode=Ec;break}u=0,d=0}n.mode=xCe;case xCe: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=Ec;break}u=0,d=0}n.mode=_Ce;case _Ce:P=Zrn;break e;case Ec:P=Zze;break e;case Yze:return qze;case Kze:default:return bg}return t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,(n.wsize||p!==t.avail_out&&n.mode<Ec&&(n.mode<cH||e!==nCe))&&nHe(t,t.output,t.next_out,p-t.avail_out),f-=t.avail_in,p-=t.avail_out,t.total_in+=f,t.total_out+=p,n.total+=p,n.wrap&4&&p&&(t.adler=n.check=n.flags?gd(n.check,i,p,t.next_out-p):r6(n.check,i,p,t.next_out-p)),t.data_type=n.bits+(n.last?64:0)+(n.mode===fv?128:0)+(n.mode===rL||n.mode===lH?256:0),(f===0&&p===0||e===nCe)&&P===_S&&(P=Yrn),P},ain=t=>{if(WS(t))return bg;let e=t.state;return e.window&&(e.window=null),t.state=null,_S},oin=(t,e)=>{if(WS(t))return bg;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,_S):bg},sin=(t,e)=>{const n=e.length;let r,i,a;return WS(t)||(r=t.state,r.wrap!==0&&r.mode!==L7)?bg:r.mode===L7&&(i=1,i=r6(i,e,n,0),i!==r.check)?Zze:(a=nHe(t,e,n,n),a?(r.mode=Yze,qze):(r.havedict=1,_S))};var lin=Qze,cin=eHe,uin=Jze,din=nin,fin=tHe,pin=iin,hin=ain,gin=oin,min=sin,vin="pako inflate (from Nodeca project)",Av={inflateReset:lin,inflateReset2:cin,inflateResetKeep:uin,inflateInit:din,inflateInit2:fin,inflate:pin,inflateEnd:hin,inflateGetHeader:gin,inflateSetDictionary:min,inflateInfo:vin};function yin(){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 bin=yin;const rHe=Object.prototype.toString,{Z_NO_FLUSH:Ein,Z_FINISH:Sin,Z_OK:o6,Z_STREAM_END:fH,Z_NEED_DICT:pH,Z_STREAM_ERROR:Cin,Z_DATA_ERROR:ICe,Z_MEM_ERROR:xin}=f8;function h8(t){this.options=wk.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 Gze,this.strm.avail_out=0;let n=Av.inflateInit2(this.strm,e.windowBits);if(n!==o6)throw new Error(j3[n]);if(this.header=new bin,Av.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=a6.string2buf(e.dictionary):rHe.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=Av.inflateSetDictionary(this.strm,e.dictionary),n!==o6)))throw new Error(j3[n])}h8.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?Sin:Ein,rHe.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=Av.inflate(n,o),a===pH&&i&&(a=Av.inflateSetDictionary(n,i),a===o6?a=Av.inflate(n,o):a===ICe&&(a=pH));n.avail_in>0&&a===fH&&n.state.wrap>0&&t[n.next_in]!==0;)Av.inflateReset(n),a=Av.inflate(n,o);switch(a){case Cin:case ICe:case pH:case xin:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===fH))if(this.options.to==="string"){let l=a6.utf8border(n.output,n.next_out),u=n.next_out-l,d=a6.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+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===o6&&s===0)){if(a===fH)return a=Av.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};h8.prototype.onData=function(t){this.chunks.push(t)};h8.prototype.onEnd=function(t){t===o6&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=wk.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Zae(t,e){const n=new h8(e);if(n.push(t),n.err)throw n.msg||j3[n.err];return n.result}function _in(t,e){return e=e||{},e.raw=!0,Zae(t,e)}var win=h8,Tin=Zae,Iin=_in,Ain=Zae,Rin=f8,Oin={Inflate:win,inflate:Tin,inflateRaw:Iin,ungzip:Ain,constants:Rin};const{Inflate:P4n,inflate:Lin,inflateRaw:D4n,ungzip:k4n}=Oin;var iHe=Lin;function Nin(t){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=iHe(e);return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Min={ignoreImageData:!1};class aHe extends xk{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 Ev("ifdCount",e)}get pageCount(){let e=0;for(this.decodeHeader();this._nextIFD;)e++,this.decodeIFD({ignoreImageData:!0},!0);if(e>0)return e;throw Ev("ifdCount",e)}decode(e={}){const{pages:n}=e;Fin(n);const r=n?Math.max(...n):1/0;e={...Min,...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 VSe;else{if(!e.kind)throw new Error("kind is missing");r=new Sze(e.kind)}const i=this.readUint16();for(let a=0;a<i;a++)this.decodeIFDEntry(r);if(!e.ignoreImageData){if(!(r instanceof VSe))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}$tn(i,a)>4&&this.seek(this.readUint32());const s=Vtn(this,i,a);if(e.fields.set(r,s),r===34665||r===34853){const l=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=l}this.seek(n),this.skip(12)}decodeImageData(e){const n=e.orientation;if(n&&n!==1)throw Ev("orientation",n);switch(e.type){case 0:case 1:case 2:case 3:this.readStripData(e);break;default:throw Ev("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=Pin(o,i,a),u=e.rowsPerStrip*n*e.samplesPerPixel,d=e.stripOffsets,f=e.stripByteCounts||Ptn(e);let p=o,h=0;for(let g=0;g<d.length;g++){const y=new DataView(this.buffer,this.byteOffset+d[g],f[g]),v=p>u?u:p;p-=v;let m=y;switch(e.compression){case 1:break;case 5:{m=rnn(y);break}case 8:{m=Nin(y);break}case 2:throw Ev("Compression","CCITT Group 3");case 32773:throw Ev("Compression","PackBits");default:throw Ev("Compression",e.compression)}h=this.fillUncompressed(i,a,s,m,h,v)}e.data=s}fillUncompressed(e,n,r,i,a,o){if(e===8)return Din(r,i,a,o);if(e===16)return kin(r,i,a,o,this.isLittleEndian());if(e===32&&n===3)return Uin(r,i,a,o,this.isLittleEndian());throw Ev("bitDepth",e)}applyPredictor(e){const n=e.bitsPerSample;switch(e.predictor){case 1:break;case 2:{if(n===8)Dtn(e.data,e.width,e.components);else if(n===16)ktn(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 Pin(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 Ev("bit depth / sample format",`${e} / ${n}`)}function Din(t,e,n,r){for(let i=0;i<r;i++)t[n++]=e.getUint8(i);return n}function kin(t,e,n,r,i){for(let a=0;a<r*2;a+=2)t[n++]=e.getUint16(a,i);return n}function Uin(t,e,n,r,i){for(let a=0;a<r*4;a+=4)t[n++]=e.getFloat32(a,i);return n}function Ev(t,e){return new Error(`Unsupported ${t}: ${e}`)}function Fin(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 hH(t,e){return new aHe(t).decode(e)}function ACe(t){return new aHe(t).pageCount}function Zd(t){return(e,...n)=>Bin(t,e,n)}function qw(t,e){return Zd(oHe(t,e).get)}const{apply:Bin,construct:U4n,defineProperty:F4n,get:B4n,getOwnPropertyDescriptor:oHe,getPrototypeOf:qae,has:$4n,ownKeys:$in,set:V4n,setPrototypeOf:z4n}=Reflect,{iterator:g8,species:H4n,toStringTag:Vin,for:G4n}=Symbol,zin=Object,{create:Yae,defineProperty:Hin,freeze:j4n,is:W4n}=zin,Gin=Array,jin=Gin.prototype,sHe=jin[g8],Win=Zd(sHe),lHe=ArrayBuffer,Xin=lHe.prototype;qw(Xin,"byteLength");const RCe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;RCe&&qw(RCe.prototype,"byteLength");const cHe=qae(Uint8Array);cHe.from;const ip=cHe.prototype;ip[g8];Zd(ip.keys);Zd(ip.values);Zd(ip.entries);Zd(ip.set);Zd(ip.reverse);Zd(ip.fill);Zd(ip.copyWithin);Zd(ip.sort);Zd(ip.slice);Zd(ip.subarray);qw(ip,"buffer");qw(ip,"byteOffset");qw(ip,"length");qw(ip,Vin);const Zin=Uint8Array,uHe=Uint16Array,Kae=Uint32Array,qin=Float32Array,s6=qae([][g8]()),dHe=Zd(s6.next),Yin=Zd(function*(){}().next),Kin=qae(s6),Jin=DataView.prototype,Qin=Zd(Jin.getUint16),Jae=WeakMap,fHe=Jae.prototype,pHe=Zd(fHe.get),ean=Zd(fHe.set),hHe=new Jae,tan=Yae(null,{next:{value:function(){const e=pHe(hHe,this);return dHe(e)}},[g8]:{value:function(){return this}}});function nan(t){if(t[g8]===sHe&&s6.next===dHe)return t;const e=Yae(tan);return ean(hHe,e,Win(t)),e}const ran=new Jae,ian=Yae(Kin,{next:{value:function(){const e=pHe(ran,this);return Yin(e)},writable:!0,configurable:!0}});for(const t of $in(s6))t!=="next"&&Hin(ian,t,oHe(s6,t));const gHe=new lHe(4),aan=new qin(gHe),oan=new Kae(gHe),e0=new uHe(512),t0=new Zin(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(e0[t]=0,e0[t|256]=32768,t0[t]=24,t0[t|256]=24):e<-14?(e0[t]=1024>>-e-14,e0[t|256]=1024>>-e-14|32768,t0[t]=-e-1,t0[t|256]=-e-1):e<=15?(e0[t]=e+15<<10,e0[t|256]=e+15<<10|32768,t0[t]=13,t0[t|256]=13):e<128?(e0[t]=31744,e0[t|256]=64512,t0[t]=24,t0[t|256]=24):(e0[t]=31744,e0[t|256]=64512,t0[t]=13,t0[t|256]=13)}const Qae=new Kae(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,Qae[t]=e|n}for(let t=1024;t<2048;++t)Qae[t]=939524096+(t-1024<<13);const Yw=new Kae(64);for(let t=1;t<31;++t)Yw[t]=t<<23;Yw[31]=1199570944;Yw[32]=2147483648;for(let t=33;t<63;++t)Yw[t]=2147483648+(t-32<<23);Yw[63]=3347054592;const mHe=new uHe(64);for(let t=1;t<64;++t)t!==32&&(mHe[t]=1024);function san(t){const e=t>>10;return oan[0]=Qae[mHe[e]+(t&1023)]+Yw[e],aan[0]}function vHe(t,e,...n){return san(Qin(t,e,...nan(n)))}var i3={},lan={get exports(){return i3},set exports(t){i3=t}};function yHe(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 l=o[s],u=e+"\\="+l+"([^"+l+"]*)"+l;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]}}lan.exports=yHe;i3.default=yHe;var N7={},can={get exports(){return N7},set exports(t){N7=t}},M7={},uan={get exports(){return M7},set exports(t){M7=t}},P7={},dan={get exports(){return P7},set exports(t){P7=t}};function bHe(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index:-1}dan.exports=bHe;P7.default=bHe;var D7={},fan={get exports(){return D7},set exports(t){D7=t}};function EHe(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index+i[0].length-1:-1}fan.exports=EHe;D7.default=EHe;var k7={},pan={get exports(){return k7},set exports(t){k7=t}};function SHe(t,e){const n=new RegExp(e,"g"),r=t.match(n);return r?r.length:0}pan.exports=SHe;k7.default=SHe;const han=P7,gH=D7,OCe=k7;function CHe(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=han(t,`<${e}[
4500
4500
  >/]`,a);if(r&&console.log("[xml-utils] start:",o),o===-1)return;const s=t.slice(o+e.length);let l=gH(s,"^[^<]*[ /]>",0);const u=l!==-1&&s[l-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",u),u===!1)if(i){let h=0,g=1,y=0;for(;(l=gH(s,"[ /]"+e+">",h))!==-1;){const v=s.substring(h,l+1);if(g+=OCe(v,"<"+e+`[
4501
- >]`),y+=OCe(v,"</"+e+">"),y>=g)break;h=l}}else l=gH(s,"[ /]"+e+">",0);const d=o+e.length+l+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let p;return u?p=null:p=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:p,outer:f,start:o,end:d}}uan.exports=CHe;M7.default=CHe;const gan=M7;function xHe(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=gan(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}can.exports=xHe;N7.default=xHe;const UI={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"},c0={};for(const t in UI)UI.hasOwnProperty(t)&&(c0[UI[t]]=parseInt(t,10));const man=[c0.BitsPerSample,c0.ExtraSamples,c0.SampleFormat,c0.StripByteCounts,c0.StripOffsets,c0.StripRowCounts,c0.TileByteCounts,c0.TileOffsets,c0.SubIFDs],mH={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"},Ro={};for(const t in mH)mH.hasOwnProperty(t)&&(Ro[mH[t]]=parseInt(t,10));const jp={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},van={Unspecified:0,Assocalpha:1,Unassalpha:2},yan={Version:0,AddCompression:1},ban={None:0,Deflate:1,Zstandard:2},Ean={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 San(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 Can(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 xan(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,l=0;s<t.length;++s,l+=3){const u=t[s];i[l]=e[u]/65536*256,i[l+1]=e[u+a]/65536*256,i[l+2]=e[u+o]/65536*256}return i}function _an(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],l=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-l)/256)*((255-u)/256)}return r}function wan(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],l=t[i+2];r[a]=o+1.402*(l-128),r[a+1]=o-.34414*(s-128)-.71414*(l-128),r[a+2]=o+1.772*(s-128)}return r}const Tan=.95047,Ian=1,Aan=1.08883;function Ran(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,l=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-l/200,p,h,g;d=Tan*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=Ian*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=Aan*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),p=d*3.2406+u*-1.5372+f*-.4986,h=d*-.9689+u*1.8758+f*.0415,g=d*.0557+u*-.204+f*1.057,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,r[a]=Math.max(0,Math.min(1,p))*255,r[a+1]=Math.max(0,Math.min(1,h))*255,r[a+2]=Math.max(0,Math.min(1,g))*255}return r}const _He=new Map;function _b(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>_He.set(n,e))}async function Oan(t){const e=_He.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}_b([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));_b(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));_b(6,()=>{throw new Error("old style JPEG compression is not supported.")});_b(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));_b([8,32946],()=>Promise.resolve().then(()=>require("./deflate-cc810523.js")).then(t=>t.default));_b(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));_b(34887,()=>Promise.resolve().then(()=>require("./lerc-56294b2d.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));_b(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function Ik(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function Lan(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=Ik(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 p=Math.min(Math.round(a*f),e-1),h=s[d*e+p];l[u*r+f]=h}}return l})}function a3(t,e,n){return(1-n)*t+n*e}function Nan(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=Ik(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=a*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1),b=s[f*e+v],E=s[f*e+m],C=s[p*e+v],x=s[p*e+m],_=a3(a3(b,E,y),a3(C,x,y),d%1);l[u*r+h]=_}}return l})}function Man(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return Lan(t,e,n,r,i);case"bilinear":case"linear":return Nan(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Pan(t,e,n,r,i,a){const o=e/r,s=n/i,l=Ik(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 p=Math.min(Math.round(o*f),e-1);for(let h=0;h<a;++h){const g=t[d*e*a+p*a+h];l[u*r*a+f*a+h]=g}}}return l}function Dan(t,e,n,r,i,a){const o=e/r,s=n/i,l=Ik(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=o*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1);for(let b=0;b<a;++b){const E=t[f*e*a+v*a+b],C=t[f*e*a+m*a+b],x=t[p*e*a+v*a+b],_=t[p*e*a+m*a+b],A=a3(a3(E,C,y),a3(x,_,y),d%1);l[u*r*a+h*a+b]=A}}}return l}function kan(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return Pan(t,e,n,r,i,a);case"bilinear":case"linear":return Dan(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function Uan(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function eee(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 Fan(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function Ban(t,e,n,r,i,a,o){const s=new DataView(t),l=n===2?o*a:o*a*r,u=n===2?1:r,d=eee(e,i,l),f=parseInt("1".repeat(i),2);if(e===1){let p;n===1?p=r*i:p=i;let h=a*p;h&7&&(h=h+7&-8);for(let g=0;g<o;++g){const y=g*h;for(let v=0;v<a;++v){const m=y+v*u*i;for(let b=0;b<u;++b){const E=m+b*i,C=(g*a+v)*u+b,x=Math.floor(E/8),_=E%8;if(_+i<=8)d[C]=s.getUint8(x)>>8-i-_&f;else if(_+i<=16)d[C]=s.getUint16(x)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(x)<<8|s.getUint8(x+2);d[C]=A>>24-i-_&f}else d[C]=s.getUint32(x)>>32-i-_&f}}}}return d.buffer}class $an{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 vHe(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 eee(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 l;const{tiles:u}=this;this.planarConfiguration===1?l=n*o+e:this.planarConfiguration===2&&(l=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[l],f=this.fileDirectory.TileByteCounts[l]):(d=this.fileDirectory.StripOffsets[l],f=this.fileDirectory.StripByteCounts[l]);const p=(await this.source.fetch([{offset:d,length:f}],a))[0];let h;return u===null||!u[l]?(h=(async()=>{let g=await i.decode(this.fileDirectory,p);const y=this.getSampleFormat(),v=this.getBitsPerSample();return Fan(y,v)&&(g=Ban(g,y,this.planarConfiguration,this.getSamplesPerPixel(),v,this.getTileWidth(),this.getBlockHeight(n))),g})(),u!==null&&(u[l]=h)):h=u[l],{x:e,y:n,sample:r,data:await h}}async _readRaster(e,n,r,i,a,o,s,l,u){const d=this.getTileWidth(),f=this.getTileHeight(),p=this.getWidth(),h=this.getHeight(),g=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(p/d)),v=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(h/f)),b=e[2]-e[0];let E=this.getBytesPerPixel();const C=[],x=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?C.push(Uan(this.fileDirectory.BitsPerSample,0,n[P])/8):C.push(0),x.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=v;P<m;++P)for(let R=g;R<y;++R){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(R,P,0,a,u));for(let D=0;D<n.length;++D){const U=D,z=n[D];this.planarConfiguration===2&&(E=this.getSampleByteSize(z),N=this.getTileOrStrip(R,P,z,a,u));const B=N.then(j=>{const V=j.data,G=new DataView(V),W=this.getBlockHeight(j.y),Z=j.y*f,H=j.x*d,X=Z+W,ee=(j.x+1)*d,K=x[U],Y=Math.min(W,W-(X-e[3]),h-Z),te=Math.min(d,d-(ee-e[2]),p-H);for(let re=Math.max(0,e[1]-Z);re<Y;++re)for(let Q=Math.max(0,e[0]-H);Q<te;++Q){const oe=(re*d+Q)*E,ge=K.call(G,oe+C[U],A);let pe;i?(pe=(re+Z-e[1])*b*n.length+(Q+H-e[0])*n.length+U,r[pe]=ge):(pe=(re+Z-e[1])*b+Q+H-e[0],r[U][pe]=ge)}});_.push(B)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=kan(r,e[2]-e[0],e[3]-e[1],o,s,n.length,l):P=Man(r,e[2]-e[0],e[3]-e[1],o,s,l),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:l,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],p=d[3]-d[1],h=f*p,g=this.getSamplesPerPixel();if(!n||!n.length)for(let b=0;b<g;++b)n.push(b);else for(let b=0;b<n.length;++b)if(n[b]>=g)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,E=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=eee(b,E,h*n.length),l&&y.fill(l)}else{y=[];for(let b=0;b<n.length;++b){const E=this.getArrayForSample(n[b],h);Array.isArray(l)&&b<l.length?E.fill(l[b]):l&&!Array.isArray(l)&&E.fill(l),y.push(E)}}const v=i||await Oan(this.fileDirectory);return await this._readRaster(d,n,y,r,v,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:l}={}){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===jp.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==van.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:l})}let f;switch(d){case jp.WhiteIsZero:case jp.BlackIsZero:case jp.Palette:f=[0];break;case jp.CMYK:f=[0,1,2,3];break;case jp.YCbCr:case jp.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const p={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:l},{fileDirectory:h}=this,g=await this.readRasters(p),y=2**this.fileDirectory.BitsPerSample[0];let v;switch(d){case jp.WhiteIsZero:v=San(g,y);break;case jp.BlackIsZero:v=Can(g,y);break;case jp.Palette:v=xan(g,h.ColorMap);break;case jp.CMYK:v=_an(g);break;case jp.YCbCr:v=wan(g);break;case jp.CIELab:v=Ran(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(v.length/3),b=new Uint8Array(v.length/3),E=new Uint8Array(v.length/3);for(let C=0,x=0;C<v.length;C+=3,++x)m[x]=v[C],b[x]=v[C+1],E[x]=v[C+2];v=[m,b,E]}return v.width=g.width,v.height=g.height,v}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=N7(r,"Item");e===null?i=i.filter(a=>i3(a,"sample")===void 0):i=i.filter(a=>Number(i3(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[i3(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,l,u,d,f]=this.fileDirectory.ModelTransformation,h=[[0,0],[0,n],[r,0],[r,n]].map(([v,m])=>[s+i*v+a*m,f+l*v+u*m]),g=h.map(v=>v[0]),y=h.map(v=>v[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],l=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,l),Math.min(s,u),Math.max(o,l),Math.max(s,u)]}}}const Van=$an;class zan{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 vHe(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class Han{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 Gan{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 eoe extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,eoe),this.name="AbortError"}}class jan extends Gan{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new eoe("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Wan(t){return new jan(t)}function tee(t){switch(t){case Ro.BYTE:case Ro.ASCII:case Ro.SBYTE:case Ro.UNDEFINED:return 1;case Ro.SHORT:case Ro.SSHORT:return 2;case Ro.LONG:case Ro.SLONG:case Ro.FLOAT:case Ro.IFD:return 4;case Ro.RATIONAL:case Ro.SRATIONAL:case Ro.DOUBLE:case Ro.LONG8:case Ro.SLONG8:case Ro.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function Xan(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=Ean[e[r]],a=e[r+1]?UI[e[r+1]]:null,o=e[r+2],s=e[r+3];let l=null;if(!a)l=s;else{if(l=t[a],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof l=="string"?l=l.substring(s,s+o-1):l.subarray&&(l=l.subarray(s,s+o),o===1&&(l=l[0]))}n[i]=l}return n}function Tx(t,e,n,r){let i=null,a=null;const o=tee(e);switch(e){case Ro.BYTE:case Ro.ASCII:case Ro.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case Ro.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case Ro.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case Ro.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case Ro.LONG:case Ro.IFD:i=new Uint32Array(n),a=t.readUint32;break;case Ro.SLONG:i=new Int32Array(n),a=t.readInt32;break;case Ro.LONG8:case Ro.IFD8:i=new Array(n),a=t.readUint64;break;case Ro.SLONG8:i=new Array(n),a=t.readInt64;break;case Ro.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case Ro.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case Ro.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case Ro.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Ro.RATIONAL||e===Ro.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===Ro.ASCII?new TextDecoder("utf-8").decode(i):i}class Zan{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class aL extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class qan{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const l=await this.getImage();let u=l;const d=await this.getImageCount(),f=l.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[g,y]=l.getOrigin(),[v,m]=l.getResolution();s=[g+n[0]*v,y+n[1]*m,g+n[2]*v,y+n[3]*m]}const h=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(h[2]-h[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(h[3]-h[1])/i}}if(a||o){const h=[];for(let g=0;g<d;++g){const y=await this.getImage(g),{SubfileType:v,NewSubfileType:m}=y.fileDirectory;(g===0||v===2||m&1)&&h.push(y)}h.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<h.length;++g){const y=h[g],v=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>v||o&&o>m)break}}let p=n;if(s){const[h,g]=l.getOrigin(),[y,v]=u.getResolution(l);p=[Math.round((s[0]-h)/y),Math.round((s[1]-g)/v),Math.round((s[2]-h)/y),Math.round((s[3]-g)/v)],p=[Math.min(p[0],p[2]),Math.min(p[1],p[3]),Math.max(p[0],p[2]),Math.max(p[1],p[3])]}return u.readRasters({...e,window:p})}}class toe extends qan{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 Han((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 l=e+(this.bigTiff?8:2);for(let f=0;f<a;l+=n,++f){const p=i.readUint16(l),h=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,v;const m=tee(h),b=l+(this.bigTiff?12:8);if(m*g<=(this.bigTiff?8:4))y=Tx(i,h,g,b);else{const E=i.readOffset(b),C=tee(h)*g;if(i.covers(E,C))y=Tx(i,h,g,E);else{const x=await this.getSlice(E,C);y=Tx(x,h,g,E)}}g===1&&man.indexOf(p)===-1&&!(h===Ro.RATIONAL||h===Ro.SRATIONAL)?v=y[0]:v=y,s[UI[p]]=v}const u=Xan(s),d=i.readOffset(e+r+n*a);return new Zan(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 aL?new aL(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new aL(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new Van(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 aL)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===Tx(i,Ro.ASCII,n.length,e)){const o=Tx(i,Ro.ASCII,r,e).split(`
4501
+ >]`),y+=OCe(v,"</"+e+">"),y>=g)break;h=l}}else l=gH(s,"[ /]"+e+">",0);const d=o+e.length+l+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let p;return u?p=null:p=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:p,outer:f,start:o,end:d}}uan.exports=CHe;M7.default=CHe;const gan=M7;function xHe(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=gan(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}can.exports=xHe;N7.default=xHe;const UI={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"},c0={};for(const t in UI)UI.hasOwnProperty(t)&&(c0[UI[t]]=parseInt(t,10));const man=[c0.BitsPerSample,c0.ExtraSamples,c0.SampleFormat,c0.StripByteCounts,c0.StripOffsets,c0.StripRowCounts,c0.TileByteCounts,c0.TileOffsets,c0.SubIFDs],mH={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"},Ro={};for(const t in mH)mH.hasOwnProperty(t)&&(Ro[mH[t]]=parseInt(t,10));const jp={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},van={Unspecified:0,Assocalpha:1,Unassalpha:2},yan={Version:0,AddCompression:1},ban={None:0,Deflate:1,Zstandard:2},Ean={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 San(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 Can(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 xan(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,l=0;s<t.length;++s,l+=3){const u=t[s];i[l]=e[u]/65536*256,i[l+1]=e[u+a]/65536*256,i[l+2]=e[u+o]/65536*256}return i}function _an(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],l=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-l)/256)*((255-u)/256)}return r}function wan(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],l=t[i+2];r[a]=o+1.402*(l-128),r[a+1]=o-.34414*(s-128)-.71414*(l-128),r[a+2]=o+1.772*(s-128)}return r}const Tan=.95047,Ian=1,Aan=1.08883;function Ran(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,l=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-l/200,p,h,g;d=Tan*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=Ian*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=Aan*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),p=d*3.2406+u*-1.5372+f*-.4986,h=d*-.9689+u*1.8758+f*.0415,g=d*.0557+u*-.204+f*1.057,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,r[a]=Math.max(0,Math.min(1,p))*255,r[a+1]=Math.max(0,Math.min(1,h))*255,r[a+2]=Math.max(0,Math.min(1,g))*255}return r}const _He=new Map;function _b(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>_He.set(n,e))}async function Oan(t){const e=_He.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}_b([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));_b(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));_b(6,()=>{throw new Error("old style JPEG compression is not supported.")});_b(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));_b([8,32946],()=>Promise.resolve().then(()=>require("./deflate-059d209a.js")).then(t=>t.default));_b(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));_b(34887,()=>Promise.resolve().then(()=>require("./lerc-befc55c4.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));_b(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function Ik(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function Lan(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=Ik(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 p=Math.min(Math.round(a*f),e-1),h=s[d*e+p];l[u*r+f]=h}}return l})}function a3(t,e,n){return(1-n)*t+n*e}function Nan(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=Ik(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=a*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1),b=s[f*e+v],E=s[f*e+m],C=s[p*e+v],x=s[p*e+m],_=a3(a3(b,E,y),a3(C,x,y),d%1);l[u*r+h]=_}}return l})}function Man(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return Lan(t,e,n,r,i);case"bilinear":case"linear":return Nan(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Pan(t,e,n,r,i,a){const o=e/r,s=n/i,l=Ik(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 p=Math.min(Math.round(o*f),e-1);for(let h=0;h<a;++h){const g=t[d*e*a+p*a+h];l[u*r*a+f*a+h]=g}}}return l}function Dan(t,e,n,r,i,a){const o=e/r,s=n/i,l=Ik(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=o*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1);for(let b=0;b<a;++b){const E=t[f*e*a+v*a+b],C=t[f*e*a+m*a+b],x=t[p*e*a+v*a+b],_=t[p*e*a+m*a+b],A=a3(a3(E,C,y),a3(x,_,y),d%1);l[u*r*a+h*a+b]=A}}}return l}function kan(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return Pan(t,e,n,r,i,a);case"bilinear":case"linear":return Dan(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function Uan(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function eee(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 Fan(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function Ban(t,e,n,r,i,a,o){const s=new DataView(t),l=n===2?o*a:o*a*r,u=n===2?1:r,d=eee(e,i,l),f=parseInt("1".repeat(i),2);if(e===1){let p;n===1?p=r*i:p=i;let h=a*p;h&7&&(h=h+7&-8);for(let g=0;g<o;++g){const y=g*h;for(let v=0;v<a;++v){const m=y+v*u*i;for(let b=0;b<u;++b){const E=m+b*i,C=(g*a+v)*u+b,x=Math.floor(E/8),_=E%8;if(_+i<=8)d[C]=s.getUint8(x)>>8-i-_&f;else if(_+i<=16)d[C]=s.getUint16(x)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(x)<<8|s.getUint8(x+2);d[C]=A>>24-i-_&f}else d[C]=s.getUint32(x)>>32-i-_&f}}}}return d.buffer}class $an{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 vHe(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 eee(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 l;const{tiles:u}=this;this.planarConfiguration===1?l=n*o+e:this.planarConfiguration===2&&(l=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[l],f=this.fileDirectory.TileByteCounts[l]):(d=this.fileDirectory.StripOffsets[l],f=this.fileDirectory.StripByteCounts[l]);const p=(await this.source.fetch([{offset:d,length:f}],a))[0];let h;return u===null||!u[l]?(h=(async()=>{let g=await i.decode(this.fileDirectory,p);const y=this.getSampleFormat(),v=this.getBitsPerSample();return Fan(y,v)&&(g=Ban(g,y,this.planarConfiguration,this.getSamplesPerPixel(),v,this.getTileWidth(),this.getBlockHeight(n))),g})(),u!==null&&(u[l]=h)):h=u[l],{x:e,y:n,sample:r,data:await h}}async _readRaster(e,n,r,i,a,o,s,l,u){const d=this.getTileWidth(),f=this.getTileHeight(),p=this.getWidth(),h=this.getHeight(),g=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(p/d)),v=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(h/f)),b=e[2]-e[0];let E=this.getBytesPerPixel();const C=[],x=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?C.push(Uan(this.fileDirectory.BitsPerSample,0,n[P])/8):C.push(0),x.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=v;P<m;++P)for(let R=g;R<y;++R){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(R,P,0,a,u));for(let D=0;D<n.length;++D){const U=D,z=n[D];this.planarConfiguration===2&&(E=this.getSampleByteSize(z),N=this.getTileOrStrip(R,P,z,a,u));const B=N.then(j=>{const V=j.data,G=new DataView(V),W=this.getBlockHeight(j.y),Z=j.y*f,H=j.x*d,X=Z+W,ee=(j.x+1)*d,K=x[U],Y=Math.min(W,W-(X-e[3]),h-Z),te=Math.min(d,d-(ee-e[2]),p-H);for(let re=Math.max(0,e[1]-Z);re<Y;++re)for(let Q=Math.max(0,e[0]-H);Q<te;++Q){const oe=(re*d+Q)*E,ge=K.call(G,oe+C[U],A);let pe;i?(pe=(re+Z-e[1])*b*n.length+(Q+H-e[0])*n.length+U,r[pe]=ge):(pe=(re+Z-e[1])*b+Q+H-e[0],r[U][pe]=ge)}});_.push(B)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=kan(r,e[2]-e[0],e[3]-e[1],o,s,n.length,l):P=Man(r,e[2]-e[0],e[3]-e[1],o,s,l),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:l,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],p=d[3]-d[1],h=f*p,g=this.getSamplesPerPixel();if(!n||!n.length)for(let b=0;b<g;++b)n.push(b);else for(let b=0;b<n.length;++b)if(n[b]>=g)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,E=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=eee(b,E,h*n.length),l&&y.fill(l)}else{y=[];for(let b=0;b<n.length;++b){const E=this.getArrayForSample(n[b],h);Array.isArray(l)&&b<l.length?E.fill(l[b]):l&&!Array.isArray(l)&&E.fill(l),y.push(E)}}const v=i||await Oan(this.fileDirectory);return await this._readRaster(d,n,y,r,v,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:l}={}){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===jp.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==van.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:l})}let f;switch(d){case jp.WhiteIsZero:case jp.BlackIsZero:case jp.Palette:f=[0];break;case jp.CMYK:f=[0,1,2,3];break;case jp.YCbCr:case jp.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const p={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:l},{fileDirectory:h}=this,g=await this.readRasters(p),y=2**this.fileDirectory.BitsPerSample[0];let v;switch(d){case jp.WhiteIsZero:v=San(g,y);break;case jp.BlackIsZero:v=Can(g,y);break;case jp.Palette:v=xan(g,h.ColorMap);break;case jp.CMYK:v=_an(g);break;case jp.YCbCr:v=wan(g);break;case jp.CIELab:v=Ran(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(v.length/3),b=new Uint8Array(v.length/3),E=new Uint8Array(v.length/3);for(let C=0,x=0;C<v.length;C+=3,++x)m[x]=v[C],b[x]=v[C+1],E[x]=v[C+2];v=[m,b,E]}return v.width=g.width,v.height=g.height,v}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=N7(r,"Item");e===null?i=i.filter(a=>i3(a,"sample")===void 0):i=i.filter(a=>Number(i3(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[i3(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,l,u,d,f]=this.fileDirectory.ModelTransformation,h=[[0,0],[0,n],[r,0],[r,n]].map(([v,m])=>[s+i*v+a*m,f+l*v+u*m]),g=h.map(v=>v[0]),y=h.map(v=>v[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],l=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,l),Math.min(s,u),Math.max(o,l),Math.max(s,u)]}}}const Van=$an;class zan{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 vHe(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class Han{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 Gan{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 eoe extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,eoe),this.name="AbortError"}}class jan extends Gan{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new eoe("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Wan(t){return new jan(t)}function tee(t){switch(t){case Ro.BYTE:case Ro.ASCII:case Ro.SBYTE:case Ro.UNDEFINED:return 1;case Ro.SHORT:case Ro.SSHORT:return 2;case Ro.LONG:case Ro.SLONG:case Ro.FLOAT:case Ro.IFD:return 4;case Ro.RATIONAL:case Ro.SRATIONAL:case Ro.DOUBLE:case Ro.LONG8:case Ro.SLONG8:case Ro.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function Xan(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=Ean[e[r]],a=e[r+1]?UI[e[r+1]]:null,o=e[r+2],s=e[r+3];let l=null;if(!a)l=s;else{if(l=t[a],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof l=="string"?l=l.substring(s,s+o-1):l.subarray&&(l=l.subarray(s,s+o),o===1&&(l=l[0]))}n[i]=l}return n}function Tx(t,e,n,r){let i=null,a=null;const o=tee(e);switch(e){case Ro.BYTE:case Ro.ASCII:case Ro.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case Ro.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case Ro.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case Ro.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case Ro.LONG:case Ro.IFD:i=new Uint32Array(n),a=t.readUint32;break;case Ro.SLONG:i=new Int32Array(n),a=t.readInt32;break;case Ro.LONG8:case Ro.IFD8:i=new Array(n),a=t.readUint64;break;case Ro.SLONG8:i=new Array(n),a=t.readInt64;break;case Ro.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case Ro.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case Ro.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case Ro.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Ro.RATIONAL||e===Ro.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===Ro.ASCII?new TextDecoder("utf-8").decode(i):i}class Zan{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class aL extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class qan{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const l=await this.getImage();let u=l;const d=await this.getImageCount(),f=l.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[g,y]=l.getOrigin(),[v,m]=l.getResolution();s=[g+n[0]*v,y+n[1]*m,g+n[2]*v,y+n[3]*m]}const h=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(h[2]-h[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(h[3]-h[1])/i}}if(a||o){const h=[];for(let g=0;g<d;++g){const y=await this.getImage(g),{SubfileType:v,NewSubfileType:m}=y.fileDirectory;(g===0||v===2||m&1)&&h.push(y)}h.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<h.length;++g){const y=h[g],v=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>v||o&&o>m)break}}let p=n;if(s){const[h,g]=l.getOrigin(),[y,v]=u.getResolution(l);p=[Math.round((s[0]-h)/y),Math.round((s[1]-g)/v),Math.round((s[2]-h)/y),Math.round((s[3]-g)/v)],p=[Math.min(p[0],p[2]),Math.min(p[1],p[3]),Math.max(p[0],p[2]),Math.max(p[1],p[3])]}return u.readRasters({...e,window:p})}}class toe extends qan{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 Han((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 l=e+(this.bigTiff?8:2);for(let f=0;f<a;l+=n,++f){const p=i.readUint16(l),h=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,v;const m=tee(h),b=l+(this.bigTiff?12:8);if(m*g<=(this.bigTiff?8:4))y=Tx(i,h,g,b);else{const E=i.readOffset(b),C=tee(h)*g;if(i.covers(E,C))y=Tx(i,h,g,E);else{const x=await this.getSlice(E,C);y=Tx(x,h,g,E)}}g===1&&man.indexOf(p)===-1&&!(h===Ro.RATIONAL||h===Ro.SRATIONAL)?v=y[0]:v=y,s[UI[p]]=v}const u=Xan(s),d=i.readOffset(e+r+n*a);return new Zan(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 aL?new aL(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new aL(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new Van(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 aL)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===Tx(i,Ro.ASCII,n.length,e)){const o=Tx(i,Ro.ASCII,r,e).split(`
4502
4502
  `)[0],s=Number(o.split("=")[1].split(" ")[0])+o.length;s>r&&(i=await this.getSlice(e,s));const l=Tx(i,Ro.ASCII,s,e);this.ghostValues={},l.split(`
4503
4503
  `).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 zan(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 l=a.getUint16(2,s);let u;if(l===42)u=!1;else if(l===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 toe(e,s,u,d,n)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function LCe(t,e){return toe.fromSource(Wan(t),e)}const Yan=({axon_check:t,fbxTreeDatas:e,setLeftMenuTabIndex:n,swcRef:r,setIsChartOpen:i,setEchartValue:a,setChartValue:o,reset:s})=>{const l=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),[p,h]=S.useState(""),[g,y]=S.useState(""),[v,m]=S.useState({x:0,y:0}),b=S.useRef([]),E=S.useRef([]),C=S.useRef(null),x=S.useRef(null),[_,A]=S.useState(!0),P=S.useRef("#000"),[R,N]=S.useState(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"]),[D,U]=S.useState({nodes:[],links:[],categories:[]});let z=S.useRef(null),B=!1;const j=(X,ee)=>{N(K=>[...K.filter(Y=>!X.includes(Y)),...ee])};S.useEffect(()=>{N(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"])},[s]);const V=(X,ee)=>ee.map(K=>{const Y=X.find(re=>re.id===K.source),te=X.find(re=>re.id===K.target);return{...K,lineStyle:{color:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:te.itemStyle.color},{offset:1,color:Y.itemStyle.color}]},width:1,curveness:.3}}});S.useEffect(()=>{G(R)},[R]);const G=X=>{fetch("/app-api/d-api/connectivity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:X})}).then(ee=>ee.json()).then(ee=>{ee.code==200?U(ee.node):fc.error(ee.message)})};S.useEffect(()=>{u.current=t7(l.current),u.current.clear();const X=()=>u.current.getOption().series[0].data,ee={tooltip:{formatter:Q=>{var oe,ge;return Q.dataType==="node"?`${Q.data.fullname} (${Q.data.name})<br>Downstream: ${((oe=t[Q.data.name].down)==null?void 0:oe.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:D.nodes,links:V(D.nodes,D.links),categories:D.categories,roam:!0,label:{show:!0,position:"right",formatter:"{b}",textStyle:{fontSize:20}},lineStyle:{color:"source",curveness:.3}}]};function K(Q){if(Q.event.event.preventDefault(),Q.dataType=="node"){const oe=Y(Q.data.name,e);let ge=W(oe);ge&&j(ge,[oe.name])}if(Q.dataType=="edge"){const oe=X().find(pe=>pe.id===Q.data.source),ge=X().find(pe=>pe.id===Q.data.target);b.current=t[oe.name].soma.filter(function(pe){return t[ge.name].axon.indexOf(pe)>-1}),E.current=t[ge.name].soma.filter(function(pe){return t[oe.name].axon.indexOf(pe)>-1}),h(oe.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 Y=(Q,oe)=>{let ge={name:""};for(let pe=0;pe<oe.length;pe++){const fe=oe[pe];if(fe.children){if(fe.children.some(ae=>ae.name===Q)){ge=fe;break}else if(Y(Q,fe.children)){ge=Y(Q,fe.children);break}}}return ge},te=Q=>{clearTimeout(z.current),B=!0,a(Q.data.name),o(Q.data.name),i(!1)},re=Q=>{z.current=setTimeout(()=>{if(!B){const oe=Z(Q.data.name,e);if(oe){let ge=[];"children"in oe?(oe.children.forEach(pe=>{ge.push(pe.name)}),j([Q.data.name],ge)):fc.error("No child node")}}B=!1},300)};return u.current.setOption(ee),u.current.on("click",re),u.current.on("dblclick",te),u.current.on("contextmenu",K),()=>{u.current.off("click",re),u.current.off("dblclick",te),u.current.off("contextmenu",K)}},[e,D]);const W=X=>{const ee=[],K=Y=>{ee.push(Y.name),Y.children&&Y.children.forEach(te=>K(te))};return K(X),ee},Z=(X,ee)=>{let K=[],Y=!1,te;for(let re=0;re<ee.length;re++)K.push(ee[re]);for(;K.length>0&&!Y;){let re=K.pop();if(re.name==X){Y=!0,te=re;break}else if(re.children)for(let Q=0;Q<re.children.length;Q++)K.push(re.children[Q])}return te},H=[{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:X=>{n(3),r.current.setSearchValue(g),r.current.setSomaValue(p),f(!1),i(!1)}},p," →",g,": ",b.current.length," projection neruon(s)")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:X=>{n(3),r.current.setSearchValue(p),r.current.setSomaValue(g),f(!1),i(!1)}},g," →",p,": ",E.current.length," projection neruon(s)")}];return S.createElement(S.Fragment,null,S.createElement("div",{style:{overflow:"hidden",position:"absolute",width:"500px",height:"200px"}},S.createElement("div",{ref:C,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"}},S.createElement("p",{style:{paddingLeft:"10px",paddingRight:"10px"}},"- Mouse-over a node to see upstream and downstream neuron numbers",S.createElement("br",null),"- Left-click a node to expand its children structures",S.createElement("br",null),"- Righ-click a node to collapse to its parent structure",S.createElement("br",null),"- Double-click a node to visualize all its projections in the main window",S.createElement("br",null),"- Righ-click a line to see the projections between two connected nodes",S.createElement("br",null),"- Left-click the popup menu of the line to inquire the projection neurons"),S.createElement("a",{style:{zIndex:9,position:"absolute",bottom:"-28px",left:0,display:"flex"},onClick:()=>{A(!_)}},S.createElement("div",{style:{width:"90px",height:"28px",display:"flex",justifyContent:"center",borderBottomRightRadius:"5px",borderBottomLeftRadius:"5px",backgroundColor:"#f1f1f180"}},S.createElement("div",{style:{display:"flex",alignItems:"center",color:"#000"}},"Help   ",S.createElement("div",{ref:x,style:{width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:_?"10px solid #000":0,borderTop:_?0:"10px solid #000"}})))))),S.createElement(DS,{menu:{items:H},open:d,overlayStyle:{position:"absolute",left:v.x,top:v.y,width:"auto",minWidth:"auto",border:`2px solid ${P}`},overlayClassName:"pipeline_dropdown"},S.createElement("div",{ref:l,style:{width:"100%",height:"calc(100vh - 75px)"},onMouseEnter:()=>{f(!1)}})))};class Kan{constructor(e,n,r,i,a,o,s){jm(this,"name");jm(this,"branches");jm(this,"indices");jm(this,"points");jm(this,"numSoma");jm(this,"vao");jm(this,"vbo");jm(this,"ebo");jm(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 l=null,u=e.split(`
4504
4504
  `),d=0;d<u.length;++d)if(u[d][0]!="#"){if(u[d].length==0&&l!=null){l.count=this.indices.length-l.start,this.branches.push(l),l=null;continue}var f=u[d].trim().split(" "),p=parseInt(f[0]);if(i!=null)if(a!=null)var h=parseFloat(f[2])+parseFloat(a[0])-parseFloat(i[0]),g=parseFloat(f[3])+parseFloat(a[2])-parseFloat(i[2]),y=parseFloat(f[4])+parseFloat(a[4])-parseFloat(i[4]);else var h=parseFloat(f[2])+parseFloat(r[0])-parseFloat(i[0]),g=parseFloat(f[3])+parseFloat(r[2])-parseFloat(i[2]),y=parseFloat(f[4])+parseFloat(r[4])-parseFloat(i[4]);else if(a!=null)var h=parseFloat(f[2])+parseFloat(a[0])-parseFloat(r[0]),g=parseFloat(f[3])+parseFloat(a[2])-parseFloat(r[2]),y=parseFloat(f[4])+parseFloat(a[4])-parseFloat(r[4]);else if(o)var h=parseFloat(f[2])+parseFloat(r[0])-s[0],g=parseFloat(f[3])+parseFloat(r[2])-s[2],y=parseFloat(f[4])+parseFloat(r[4])-s[4];else var h=parseFloat(f[2]),g=parseFloat(f[3]),y=parseFloat(f[4]);var v=parseInt(f[6]);p==1?(l={start:0},this.indices.push(0),this.numSoma=1):v!=p-1||v==-1?(l.count=this.indices.length-l.start,this.branches.push(l),l={start:this.indices.length},v!=-1?this.indices.push(v-1):this.numSoma+=1,this.indices.push(this.points.length/3)):this.indices.push(this.points.length/3),this.points.push(h),this.points.push(g),this.points.push(y)}l&&(l.count=this.indices.length-l.start,this.branches.push(l))}}const Jan="1.2.0",Qan=S.createContext({}),eon=Qan,ton={classNames:{},styles:{},className:"",style:{}},non=t=>{const e=S.useContext(eon);return S.useMemo(()=>({...ton,...e[t]}),[e[t]])},ron=non;function Z3(){return Z3=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Z3.apply(null,arguments)}function U7(){const{getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r,theme:i}=S.useContext(xg.ConfigContext);return{theme:i,getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r}}process.env.NODE_ENV;const ion=QI(_K.defaultAlgorithm),aon={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},wHe=(t,e,n)=>{const r=n.getDerivativeToken(t),{override:i,...a}=e;let o={...r,override:i};return o=EP(o),a&&Object.entries(a).forEach(([s,l])=>{const{theme:u,...d}=l;let f=d;u&&(f=wHe({...o,...d},{override:d},u)),o[s]=f}),o};function oon(){const{token:t,hashed:e,theme:n=ion,override:r,cssVar:i}=S.useContext(_K._internalContext),[a,o,s]=GAe(n,[_K.defaultSeed,t],{salt:`${Jan}-${e||""}`,override:r,getComputedToken:wHe,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:cte,ignore:j6e,preserve:aon}});return[n,s,e?o:"",a,i]}const{genStyleHooks:son,genComponentStyleHook:X4n,genSubStyleComponent:Z4n}=G6e({usePrefix:()=>{const{getPrefixCls:t,iconPrefixCls:e}=U7();return{iconPrefixCls:e,rootPrefixCls:t()}},useToken:()=>{const[t,e,n,r,i]=oon();return{theme:t,realToken:e,hashId:n,token:r,cssVar:i}},useCSP:()=>{const{csp:t}=U7();return t??{}},layer:{name:"antdx",dependencies:["antd"]}});function oL(t){return typeof t=="string"}const lon=(t,e,n,r)=>{const i=w.useRef(""),[a,o]=w.useState(1),s=e&&oL(t);return Zo(()=>{!s&&oL(t)?o(t.length):oL(t)&&oL(i.current)&&t.indexOf(i.current)!==0&&o(1),i.current=t},[t]),w.useEffect(()=>{if(s&&a<t.length){const u=setTimeout(()=>{o(d=>d+n)},r);return()=>{clearTimeout(u)}}},[a,e,t]),[s?t.slice(0,a):t,s&&a<t.length]},con=lon;function uon(t){return w.useMemo(()=>{if(!t)return[!1,0,0,null];let e={step:1,interval:50,suffix:null};return typeof t=="object"&&(e={...e,...t}),[!0,e.step,e.interval,e.suffix]},[t])}const don=({prefixCls:t})=>S.createElement("span",{className:`${t}-dot`},S.createElement("i",{className:`${t}-dot-item`,key:"item-1"}),S.createElement("i",{className:`${t}-dot-item`,key:"item-2"}),S.createElement("i",{className:`${t}-dot-item`,key:"item-3"})),fon=don,pon=t=>{const{componentCls:e,paddingSM:n,padding:r}=t;return{[e]:{[`${e}-content`]:{"&-filled,&-outlined,&-shadow":{padding:`${je(n)} ${je(r)}`,borderRadius:t.borderRadiusLG},"&-filled":{backgroundColor:t.colorFillContent},"&-outlined":{border:`1px solid ${t.colorBorderSecondary}`},"&-shadow":{boxShadow:t.boxShadowTertiary}}}}},hon=t=>{const{componentCls:e,fontSize:n,lineHeight:r,paddingSM:i,padding:a,calc:o}=t,s=o(n).mul(r).div(2).add(i).equal(),l=`${e}-content`;return{[e]:{[l]:{"&-round":{borderRadius:{_skip_check_:!0,value:s},paddingInline:o(a).mul(1.25).equal()}},[`&-start ${l}-corner`]:{borderStartStartRadius:t.borderRadiusXS},[`&-end ${l}-corner`]:{borderStartEndRadius:t.borderRadiusXS}}}},gon=t=>{const{componentCls:e,padding:n}=t;return{[`${e}-list`]:{display:"flex",flexDirection:"column",gap:n,overflowY:"auto","&::-webkit-scrollbar":{width:8,backgroundColor:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:t.colorTextTertiary,borderRadius:t.borderRadiusSM},"&":{scrollbarWidth:"thin",scrollbarColor:`${t.colorTextTertiary} transparent`}}}},mon=gon,von=new Ka("loadingMove",{"0%":{transform:"translateY(0)"},"10%":{transform:"translateY(4px)"},"20%":{transform:"translateY(0)"},"30%":{transform:"translateY(-4px)"},"40%":{transform:"translateY(0)"}}),yon=new Ka("cursorBlink",{"0%":{opacity:1},"50%":{opacity:0},"100%":{opacity:1}}),bon=t=>{const{componentCls:e,fontSize:n,lineHeight:r,paddingSM:i,colorText:a,calc:o}=t;return{[e]:{display:"flex",columnGap:i,[`&${e}-end`]:{justifyContent:"end",flexDirection:"row-reverse",[`& ${e}-content-wrapper`]:{alignItems:"flex-end"}},[`&${e}-rtl`]:{direction:"rtl"},[`&${e}-typing ${e}-content:last-child::after`]:{content:'"|"',fontWeight:900,userSelect:"none",opacity:1,marginInlineStart:"0.1em",animationName:yon,animationDuration:"0.8s",animationIterationCount:"infinite",animationTimingFunction:"linear"},[`& ${e}-avatar`]:{display:"inline-flex",justifyContent:"center",alignSelf:"flex-start"},[`& ${e}-header, & ${e}-footer`]:{fontSize:n,lineHeight:r,color:t.colorText},[`& ${e}-header`]:{marginBottom:t.paddingXXS},[`& ${e}-footer`]:{marginTop:i},[`& ${e}-content-wrapper`]:{flex:"auto",display:"flex",flexDirection:"column",alignItems:"flex-start",minWidth:0,maxWidth:"100%"},[`& ${e}-content`]:{position:"relative",boxSizing:"border-box",minWidth:0,maxWidth:"100%",color:a,fontSize:t.fontSize,lineHeight:t.lineHeight,minHeight:o(i).mul(2).add(o(r).mul(n)).equal(),wordBreak:"break-word",[`& ${e}-dot`]:{position:"relative",height:"100%",display:"flex",alignItems:"center",columnGap:t.marginXS,padding:`0 ${je(t.paddingXXS)}`,"&-item":{backgroundColor:t.colorPrimary,borderRadius:"100%",width:4,height:4,animationName:von,animationDuration:"2s",animationIterationCount:"infinite",animationTimingFunction:"linear","&:nth-child(1)":{animationDelay:"0s"},"&:nth-child(2)":{animationDelay:"0.2s"},"&:nth-child(3)":{animationDelay:"0.4s"}}}}}}},Eon=()=>({}),THe=son("Bubble",t=>{const e=aa(t,{});return[bon(e),mon(e),pon(e),hon(e)]},Eon),IHe=S.createContext({}),Son=(t,e)=>{const{prefixCls:n,className:r,rootClassName:i,style:a,classNames:o={},styles:s={},avatar:l,placement:u="start",loading:d=!1,loadingRender:f,typing:p,content:h="",messageRender:g,variant:y="filled",shape:v,onTypingComplete:m,header:b,footer:E,...C}=t,{onUpdate:x}=S.useContext(IHe),_=S.useRef(null);S.useImperativeHandle(e,()=>({nativeElement:_.current}));const{direction:A,getPrefixCls:P}=U7(),R=P("bubble",n),N=ron("bubble"),[D,U,z,B]=uon(p),[j,V]=con(h,D,U,z);S.useEffect(()=>{x==null||x()},[j]);const G=S.useRef(!1);S.useEffect(()=>{!V&&!d?G.current||(G.current=!0,m==null||m()):G.current=!1},[V,d]);const[W,Z,H]=THe(R),X=Je(R,i,N.className,r,Z,H,`${R}-${u}`,{[`${R}-rtl`]:A==="rtl",[`${R}-typing`]:V&&!d&&!g&&!B}),ee=S.useMemo(()=>S.isValidElement(l)?l:S.createElement(Fdt,l),[l]),K=S.useMemo(()=>g?g(j):j,[j,g]);let Y;d?Y=f?f():S.createElement(fon,{prefixCls:R}):Y=S.createElement(S.Fragment,null,K,V&&B);let te=S.createElement("div",{style:{...N.styles.content,...s.content},className:Je(`${R}-content`,`${R}-content-${y}`,v&&`${R}-content-${v}`,N.classNames.content,o.content)},Y);return(b||E)&&(te=S.createElement("div",{className:`${R}-content-wrapper`},b&&S.createElement("div",{className:Je(`${R}-header`,N.classNames.header,o.header),style:{...N.styles.header,...s.header}},b),te,E&&S.createElement("div",{className:Je(`${R}-footer`,N.classNames.footer,o.footer),style:{...N.styles.footer,...s.footer}},typeof E=="function"?E(K):E))),W(S.createElement("div",Z3({style:{...N.style,...a},className:X},C,{ref:_}),l&&S.createElement("div",{style:{...N.styles.avatar,...s.avatar},className:Je(`${R}-avatar`,N.classNames.avatar,o.avatar)},ee),te))},AHe=S.forwardRef(Son);process.env.NODE_ENV!=="production"&&(AHe.displayName="Bubble");const noe=AHe;function Con(t,e){const n=w.useCallback((r,i)=>typeof e=="function"?e(r,i):e?e[r.role]||{}:{},[e]);return w.useMemo(()=>(t||[]).map((r,i)=>{const a=r.key??`preset_${i}`;return{...n(r,i),...r,key:a}}),[t,n])}const xon=({_key:t,...e},n)=>w.createElement(noe,Z3({},e,{ref:r=>{var i;r?n.current[t]=r:(i=n.current)==null||delete i[t]}})),_on=w.memo(w.forwardRef(xon)),won=1,Ton=(t,e)=>{const{prefixCls:n,rootClassName:r,className:i,items:a,autoScroll:o=!0,roles:s,...l}=t,u=Ip(l,{attr:!0,aria:!0}),d=w.useRef(null),f=w.useRef({}),{getPrefixCls:p}=U7(),h=p("bubble",n),g=`${h}-list`,[y,v,m]=THe(h),[b,E]=w.useState(!1);w.useEffect(()=>(E(!0),()=>{E(!1)}),[]);const C=Con(a,s),[x,_]=w.useState(!0),[A,P]=w.useState(0),R=U=>{const z=U.target;_(z.scrollHeight-Math.abs(z.scrollTop)-z.clientHeight<=won)};w.useEffect(()=>{o&&d.current&&x&&d.current.scrollTo({top:d.current.scrollHeight})},[A]),w.useEffect(()=>{var U;if(o){const z=(U=C[C.length-2])==null?void 0:U.key,B=f.current[z];if(B){const{nativeElement:j}=B,{top:V,bottom:G}=j.getBoundingClientRect(),{top:W,bottom:Z}=d.current.getBoundingClientRect();V<Z&&G>W&&(P(X=>X+1),_(!0))}}},[C.length]),w.useImperativeHandle(e,()=>({nativeElement:d.current,scrollTo:({key:U,offset:z,behavior:B="smooth",block:j})=>{if(typeof z=="number")d.current.scrollTo({top:z,behavior:B});else if(U!==void 0){const V=f.current[U];if(V){const G=C.findIndex(W=>W.key===U);_(G===C.length-1),V.nativeElement.scrollIntoView({behavior:B,block:j})}}}}));const N=Pl(()=>{o&&P(U=>U+1)}),D=w.useMemo(()=>({onUpdate:N}),[]);return y(w.createElement(IHe.Provider,{value:D},w.createElement("div",Z3({},u,{className:Je(g,r,i,v,m,{[`${g}-reach-end`]:x}),ref:d,onScroll:R}),C.map(({key:U,...z})=>w.createElement(_on,Z3({},z,{key:U,_key:U,ref:f,typing:b?z.typing:!1}))))))},RHe=w.forwardRef(Ton);process.env.NODE_ENV!=="production"&&(RHe.displayName="BubbleList");const Ion=RHe;noe.List=Ion;function NCe(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);const o=n.slice(i,r).trim();(o||!a)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function OHe(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Aon=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ron=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oon={};function MCe(t,e){return((e||Oon).jsx?Ron:Aon).test(t)}const Lon=/[ \t\n\f\r]/g;function Non(t){return typeof t=="object"?t.type==="text"?PCe(t.value):!1:PCe(t)}function PCe(t){return t.replace(Lon,"")===""}let m8=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};m8.prototype.normal={};m8.prototype.property={};m8.prototype.space=void 0;function LHe(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new m8(n,r,e)}function l6(t){return t.toLowerCase()}let Np=class{constructor(e,n){this.attribute=n,this.property=e}};Np.prototype.attribute="";Np.prototype.booleanish=!1;Np.prototype.boolean=!1;Np.prototype.commaOrSpaceSeparated=!1;Np.prototype.commaSeparated=!1;Np.prototype.defined=!1;Np.prototype.mustUseProperty=!1;Np.prototype.number=!1;Np.prototype.overloadedBoolean=!1;Np.prototype.property="";Np.prototype.spaceSeparated=!1;Np.prototype.space=void 0;let Mon=0;const Co=XS(),Au=XS(),NHe=XS(),jr=XS(),jl=XS(),o3=XS(),qp=XS();function XS(){return 2**++Mon}const nee=Object.freeze(Object.defineProperty({__proto__:null,boolean:Co,booleanish:Au,commaOrSpaceSeparated:qp,commaSeparated:o3,number:jr,overloadedBoolean:NHe,spaceSeparated:jl},Symbol.toStringTag,{value:"Module"})),vH=Object.keys(nee);let roe=class extends Np{constructor(e,n,r,i){let a=-1;if(super(e,n),DCe(this,"space",i),typeof r=="number")for(;++a<vH.length;){const o=vH[a];DCe(this,vH[a],(r&nee[o])===nee[o])}}};roe.prototype.defined=!0;function DCe(t,e,n){n&&(t[e]=n)}function Kw(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const a=new roe(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),e[r]=a,n[l6(r)]=r,n[l6(a.attribute)]=r}return new m8(e,n,t.space)}const MHe=Kw({properties:{ariaActiveDescendant:null,ariaAtomic:Au,ariaAutoComplete:null,ariaBusy:Au,ariaChecked:Au,ariaColCount:jr,ariaColIndex:jr,ariaColSpan:jr,ariaControls:jl,ariaCurrent:null,ariaDescribedBy:jl,ariaDetails:null,ariaDisabled:Au,ariaDropEffect:jl,ariaErrorMessage:null,ariaExpanded:Au,ariaFlowTo:jl,ariaGrabbed:Au,ariaHasPopup:null,ariaHidden:Au,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jl,ariaLevel:jr,ariaLive:null,ariaModal:Au,ariaMultiLine:Au,ariaMultiSelectable:Au,ariaOrientation:null,ariaOwns:jl,ariaPlaceholder:null,ariaPosInSet:jr,ariaPressed:Au,ariaReadOnly:Au,ariaRelevant:null,ariaRequired:Au,ariaRoleDescription:jl,ariaRowCount:jr,ariaRowIndex:jr,ariaRowSpan:jr,ariaSelected:Au,ariaSetSize:jr,ariaSort:null,ariaValueMax:jr,ariaValueMin:jr,ariaValueNow:jr,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function PHe(t,e){return e in t?t[e]:e}function DHe(t,e){return PHe(t,e.toLowerCase())}const Pon=Kw({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:o3,acceptCharset:jl,accessKey:jl,action:null,allow:null,allowFullScreen:Co,allowPaymentRequest:Co,allowUserMedia:Co,alt:null,as:null,async:Co,autoCapitalize:null,autoComplete:jl,autoFocus:Co,autoPlay:Co,blocking:jl,capture:null,charSet:null,checked:Co,cite:null,className:jl,cols:jr,colSpan:null,content:null,contentEditable:Au,controls:Co,controlsList:jl,coords:jr|o3,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Co,defer:Co,dir:null,dirName:null,disabled:Co,download:NHe,draggable:Au,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Co,formTarget:null,headers:jl,height:jr,hidden:Co,high:jr,href:null,hrefLang:null,htmlFor:jl,httpEquiv:jl,id:null,imageSizes:null,imageSrcSet:null,inert:Co,inputMode:null,integrity:null,is:null,isMap:Co,itemId:null,itemProp:jl,itemRef:jl,itemScope:Co,itemType:jl,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Co,low:jr,manifest:null,max:null,maxLength:jr,media:null,method:null,min:null,minLength:jr,multiple:Co,muted:Co,name:null,nonce:null,noModule:Co,noValidate:Co,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Co,optimum:jr,pattern:null,ping:jl,placeholder:null,playsInline:Co,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Co,referrerPolicy:null,rel:jl,required:Co,reversed:Co,rows:jr,rowSpan:jr,sandbox:jl,scope:null,scoped:Co,seamless:Co,selected:Co,shadowRootClonable:Co,shadowRootDelegatesFocus:Co,shadowRootMode:null,shape:null,size:jr,sizes:null,slot:null,span:jr,spellCheck:Au,src:null,srcDoc:null,srcLang:null,srcSet:null,start:jr,step:null,style:null,tabIndex:jr,target:null,title:null,translate:null,type:null,typeMustMatch:Co,useMap:null,value:Au,width:jr,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jl,axis:null,background:null,bgColor:null,border:jr,borderColor:null,bottomMargin:jr,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Co,declare:Co,event:null,face:null,frame:null,frameBorder:null,hSpace:jr,leftMargin:jr,link:null,longDesc:null,lowSrc:null,marginHeight:jr,marginWidth:jr,noResize:Co,noHref:Co,noShade:Co,noWrap:Co,object:null,profile:null,prompt:null,rev:null,rightMargin:jr,rules:null,scheme:null,scrolling:Au,standby:null,summary:null,text:null,topMargin:jr,valueType:null,version:null,vAlign:null,vLink:null,vSpace:jr,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Co,disableRemotePlayback:Co,prefix:null,property:null,results:jr,security:null,unselectable:null},space:"html",transform:DHe}),Don=Kw({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:qp,accentHeight:jr,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:jr,amplitude:jr,arabicForm:null,ascent:jr,attributeName:null,attributeType:null,azimuth:jr,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:jr,by:null,calcMode:null,capHeight:jr,className:jl,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:jr,diffuseConstant:jr,direction:null,display:null,dur:null,divisor:jr,dominantBaseline:null,download:Co,dx:null,dy:null,edgeMode:null,editable:null,elevation:jr,enableBackground:null,end:null,event:null,exponent:jr,externalResourcesRequired:null,fill:null,fillOpacity:jr,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:o3,g2:o3,glyphName:o3,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:jr,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:jr,horizOriginX:jr,horizOriginY:jr,id:null,ideographic:jr,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:jr,k:jr,k1:jr,k2:jr,k3:jr,k4:jr,kernelMatrix:qp,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:jr,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:jr,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:jr,overlineThickness:jr,paintOrder:null,panose1:null,path:null,pathLength:jr,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jl,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:jr,pointsAtY:jr,pointsAtZ:jr,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qp,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qp,rev:qp,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qp,requiredFeatures:qp,requiredFonts:qp,requiredFormats:qp,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:jr,specularExponent:jr,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:jr,strikethroughThickness:jr,string:null,stroke:null,strokeDashArray:qp,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:jr,strokeOpacity:jr,strokeWidth:null,style:null,surfaceScale:jr,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qp,tabIndex:jr,tableValues:null,target:null,targetX:jr,targetY:jr,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:qp,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:jr,underlineThickness:jr,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:jr,values:null,vAlphabetic:jr,vMathematical:jr,vectorEffect:null,vHanging:jr,vIdeographic:jr,version:null,vertAdvY:jr,vertOriginX:jr,vertOriginY:jr,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:jr,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:PHe}),kHe=Kw({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),UHe=Kw({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:DHe}),FHe=Kw({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),kon={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Uon=/[A-Z]/g,kCe=/-[a-z]/g,Fon=/^data[-\w.:]+$/i;function ioe(t,e){const n=l6(e);let r=e,i=Np;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Fon.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(kCe,$on);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!kCe.test(a)){let o=a.replace(Uon,Bon);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=roe}return new i(r,e)}function Bon(t){return"-"+t.toLowerCase()}function $on(t){return t.charAt(1).toUpperCase()}const Ak=LHe([MHe,Pon,kHe,UHe,FHe],"html"),Jw=LHe([MHe,Don,kHe,UHe,FHe],"svg");function UCe(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function BHe(t){return t.join(" ").trim()}var aoe={},FCe=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Von=/\n/g,zon=/^\s*/,Hon=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Gon=/^:\s*/,jon=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Won=/^[;\s]*/,Xon=/^\s+|\s+$/g,Zon=`
@@ -5089,7 +5089,7 @@ void main(){
5089
5089
  // color = vec4(0.0,0.0,0.0,1.f);
5090
5090
  // };
5091
5091
  }
5092
- `;let wxn=new URL(window.location.href),qd=new URLSearchParams(wxn.search),w5e=qd.get("leftHemisphereVisibility"),T5e=qd.get("coordinateVisibility"),I5e=qd.get("datumMarkVisibility"),A5e=qd.get("cranialVisibility"),R5e=qd.get("gridVisibility"),O5e=qd.get("terminalVisibility"),L5e=qd.get("branchingVisibility"),N5e=qd.get("branchingColor"),M5e=qd.get("brainContourVisibility"),P5e=qd.get("brainContourOpacity"),G7=qd.get("otherAtlases"),j7=qd.get("atlasReslicingInfo"),W7=qd.get("sectionPointPosition"),D5e=qd.get("echart_Value"),zZ=qd.get("tiffDataPath"),k5e=qd.get("tiffInfo"),U5e=qd.get("swcUrl");const Txn={leftHemisphereVisibility:w5e?JSON.parse(w5e):!1,coordinateVisibility:T5e?JSON.parse(T5e):!0,datumMarkVisibility:I5e?JSON.parse(I5e):!0,cranialVisibility:A5e?JSON.parse(A5e):!1,gridVisibility:R5e?JSON.parse(R5e):!0,terminalVisibility:O5e?JSON.parse(O5e):!0,branchingVisibility:L5e?JSON.parse(L5e):!0,branchingColor:N5e||"#A7B5A1",brainContourVisibility:M5e?JSON.parse(M5e):!0,brainContourOpacity:P5e?JSON.parse(P5e):.3,otherAtlases:G7||"None",atlasReslicingInfo:j7?JSON.parse(j7):{},sectionPointPosition:W7?JSON.parse(W7):{}},Ixn=(t,e)=>{let n=new URL(window.location.href),r=new URLSearchParams(n.search),i=e;typeof e!="string"&&(i=JSON.stringify(i)),r.set(t,i),n.search=r.toString(),window.history.replaceState({},"",n)},Axn={set(t,e,n){return t[e]=n,Ixn(e,n),!0}},qa=new Proxy(Txn,Axn),fWe=S.forwardRef((t,e)=>{const{regionData:n,setoffset_factor:r,offset_factor_R:i,t:a,hrefStr:o,leftTreeRef:s,setJiaoduRef:l,jiaoduRef:u,mouseflag:d,renderer:f,controls:p,menutagShow:h,setMenuTag:g,startselect:y,linemeshs_jing:v,points:m,points2:b,activetabIndex:E,material:C,setShowimage:x,childRef:_,checkItems:A,setoutflag:P,fetchCoordinateFunc:R,setendPoint:N,clickPoint:D,outflagRef:U,axis_font:z,setdatum:B,modeChoose:j,setShowModeChoose:V,virusModeValue:G,setShowTabNums:W,pipelineClickEvent:Z,automaticGroup:H,focusVirusLineItem:X,setMenuTagShow:ee,responsefunc:K,mode:Y,setCheckItems:te,setLeftMenuTabIndex:re,updatePage:Q,swcItem:oe,axon_check:ge,swcnameMesh:pe,setMode:fe,vesselRef:ae,swcRef:Se,vesselStr:ie,lableStr:ye,setShowSettingModal:de,showSettingModal:Te,fbxTreeDatas:Be,composer:Ye,setEchartValue:ke,echartValue:we,sectionsInfoRef:We,sectionsInfo:ve,setSectionsInfo:he,gray_value:Ue,setLuguchecked:Le,Luguchecked:Ne,datum:at,setGridShow:qe,PointShow:Ze,nodeStr:dt,lefttab:Tt,righttab:vt,atlasData:ct,setTip:St,tip:Ge,startRegionAnimation:nt,setFunctionLoopSwcData:yt,azimuth:Me,setAzimuth:gt}=t,[Gt,Ht]=S.useState(!1),[jt,Yt]=S.useState(!1),[tn,gn]=S.useState(!1),[On,In]=S.useState(!1),[Xn,Tr]=S.useState(!1),[zr,jn]=S.useState(!1),[Wt,zn]=S.useState(!1),[vn,cr]=S.useState(!1),[pr,mt]=S.useState(qa.atlasReslicingInfo.angleX||120),[Vt,fn]=S.useState(qa.atlasReslicingInfo.angleY||320),[Fe,_t]=S.useState(qa.atlasReslicingInfo.angleZ||270),[Nt,Dt]=S.useState(qa.atlasReslicingInfo.positionX||0),[Lt,Zt]=S.useState(qa.atlasReslicingInfo.positionY||0),[zt,en]=S.useState(qa.atlasReslicingInfo.positionZ||0),[Nn,Kt]=S.useState(qa.atlasReslicingInfo.translateX||!0),[Ut,on]=S.useState(qa.atlasReslicingInfo.translateY||!0),[Bn,Rn]=S.useState(qa.atlasReslicingInfo.translateZ||!0),[gr,Lr]=S.useState(qa.atlasReslicingInfo.rotate||!0),[rr,yn]=S.useState(qa.atlasReslicingInfo.ButtonDisabled||!0),[nr,Dn]=S.useState(!1),[kn,Un]=S.useState(!1),[mr,Kr]=S.useState(!1),[yi,gi]=S.useState(!1),[tr,_r]=S.useState(a("5000.0006")||"显示数据块"),[vr,fr]=S.useState(1),[Gr,qi]=S.useState(1),[Oi,zi]=S.useState([]),[ca,ro]=S.useState([]),[ka,To]=S.useState([]),[oo,ti]=S.useState(!1),[Dr,Ua]=S.useState({}),[Ta,ha]=S.useState(!1),[gs,Mo]=S.useState(""),[ci,Ia]=S.useState("Config_DAPI.ini"),[ls,xi]=S.useState("applySTAM2CCF"),[Ja,yr]=S.useState("800"),[si,an]=S.useState(0),[Et,cn]=S.useState(!1),[Bt,Gn]=S.useState(!1),[Qn,Ur]=S.useState(!1),[ii,mi]=S.useState(!1),[Hr,Jr]=S.useState(!0),[wi,Ln]=S.useState(2),[er,sn]=S.useState(!1),[ut,Oe]=S.useState({}),ze=S.useRef(qa.atlasReslicingInfo.direction1||4),it=S.useRef(null),[ot,pt]=S.useState(a("4000.0208")||"选择靶点"),[bt,st]=S.useState(!1),Ee=S.useRef(null),ue=S.useRef(window.location.href.split("/")[2]),De=S.useRef(new q_(ki.current,f==null?void 0:f.domElement)),Xe=S.useRef(0),et=S.useRef(0),ht=S.useRef(new Jn),$t=S.useRef(new Ie),Ft=S.useRef(new Ie),dn=S.useRef(new Jn),At=S.useRef(new Ie(1,0,0)),It=S.useRef(new Jn),Kn=S.useRef(null),lr=S.useRef(new hI),Fn=S.useRef(null),wn=S.useRef([]),ir=S.useRef(null),Ir=S.useRef(new Jn),En=S.useRef(new Kc),[ln,ui]=S.useState(qa.otherAtlases),Fr={min:new Ie(59.74305725097656,69.15838623046875,.9565062522888184),max:new Ie(1081.3045654296875,800.6698608398438,1400.156005859375)},[ai,Fs]=S.useState([]),Va=S.useRef({}),Io=S.useRef(!1),bi=S.useRef([0,0]),di=S.useRef([0,0]),ua=S.useRef(""),xs=S.useRef(!1),[so,Bo]=S.useState(!1),[tc,js]=S.useState(!1),[Rs,lo]=S.useState(0),[co,Os]=S.useState(0),[yl,bl]=S.useState({}),[hr,cs]=S.useState([]),Ls=S.useRef(null),_s=S.useRef(null),[Ns,bo]=S.useState(""),[Po,$o]=S.useState(null),[Qa,io]=S.useState(D5e||""),[Ws,Il]=S.useState(!1);S.useState("");const za=S.useRef(""),[ms,Bs]=S.useState(qa.leftHemisphereVisibility),Ic=S.useRef([]);S.useRef([]);const[El,Fl]=S.useState(!1),[Ac,zc]=S.useState(!1),Bl=S.useRef(!0),sl=S.useRef(!0),vs=S.useRef(""),Rc=S.useRef({target:p.current.target.clone(),position:p.current.object.position.clone(),up:p.current.object.up.clone(),enabled:p.current.enabled}),[Su,nc]=S.useState(0),[eu,wd]=S.useState(!0),Hc=S.useRef(!0),Td=S.useRef(null),ll=S.useRef(new Jn),[nd,Vu]=S.useState(qa.brainContourVisibility),[rc,Al]=S.useState(["Task1","Task2"]),[Xs,Yd]=S.useState(["Task1"]),[as,ic]=S.useState([{key:"Task1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"Task2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),$s=S.useRef([{key:"tags1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"tags2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),Gc=S.useRef(null),gc=S.useRef(null),[Id,Oc]=S.useState(qa.coordinateVisibility),[zu,tu]=S.useState(qa.brainContourOpacity),[jc,$l]=S.useState(qa.atlasReslicingInfo.direction1||4),[Kd,Lc]=S.useState({}),[mc,Nc]=S.useState({}),[Sl,Ui]=S.useState({});S.useRef();const cl=S.useRef([]),ul=S.useRef({brightness:.95,darkness:0,opacity:1,opacity2:1,color:{r:0,g:0,b:0},color2:{r:255,g:255,b:255}}),Mc=S.useRef(new Set),Pc=S.useRef(0),[Cu,Hu]=S.useState(""),[Jd,Gu]=S.useState(!1);S.useState([]),S.useRef([]),S.useState([]),S.useState(""),S.useRef(!0),S.useRef(null);const[Wc,nu]=S.useState(10),[xu,rd]=S.useState(!1);S.useImperativeHandle(e,()=>({tabChange:uo,setYinDaoOpen1:Ht,setYinDaoOpen2:Yt,setYinDaoOpen3:gn,setYinDaoOpen4:In,setYinDaoOpen5:Tr,setYinDaoOpen6:jn,setYinDaoOpen7:zn,setDontShowAgain:wd,modeValue:si})),S.useEffect(()=>{cl.current=Be},[Be]);const T=Ce=>{Mc.current.delete(Ce.key)},k=(Ce,$e,Ke)=>{if(Ce.length<=3)return Ce;Ce.sort((rn,hn)=>rn[$e]-hn[$e]||rn[Ke]-hn[Ke]);const lt=[],Rt=[],Jt=(rn,hn,pn)=>(hn[$e]-rn[$e])*(pn[Ke]-rn[Ke])-(hn[Ke]-rn[Ke])*(pn[$e]-rn[$e]);for(const rn of Ce){for(;lt.length>=2&&Jt(lt[lt.length-2],lt[lt.length-1],rn)<=0;)lt.pop();lt.push(rn)}for(let rn=Ce.length-1;rn>=0;rn--){const hn=Ce[rn];for(;Rt.length>=2&&Jt(Rt[Rt.length-2],Rt[Rt.length-1],hn)<=0;)Rt.pop();Rt.push(hn)}return Rt.pop(),lt.pop(),lt.concat(Rt)},q=(Ce,$e)=>{const Ke=_e.current.getObjectByName("azimuth"),lt=_e.current.getObjectByName("azimuth_outline"),Rt=_e.current.getObjectByName("azimuth_edge");Rt&&_e.current.remove(Rt),Ke&&_e.current.remove(Ke),lt&&_e.current.remove(lt);const Jt=_e.current.getObjectByName("Brain");if(!Jt)return;const rn=new rs().setFromObject(Jt),hn=rn.min,pn=rn.max,Cr=pn.x-hn.x,sr=pn.y-hn.y,Cn=pn.z-hn.z,ur=new Ie((hn.x+pn.x)/2,(hn.y+pn.y)/2,(hn.z+pn.z)/2);let ar=new Di,Er=[],Qr,Ba;const Fi=new Bc({color:new Ar("#d4d2d2"),transparent:!0,opacity:.6});if(Ce==="cor"){const Es=gf.clamp($e,hn.z,pn.z);Ba=new zs(Cr,sr,.01),Qr=new Jn(Ba,Fi),Qr.name="azimuth",Qr.position.set(ur.x,ur.y,Es);for(let Ol=0;Ol<Jt.children[0].geometry.attributes.position.array.length;Ol+=3){let kp=Jt.children[0].geometry.attributes.position.array[Ol],ef=Jt.children[0].geometry.attributes.position.array[Ol+1],kc=Jt.children[0].geometry.attributes.position.array[Ol+2]*Hi.current+ja.current;Math.abs(kc-Es)<.18&&Er.findIndex(Hl=>Hl.equals(new Ie(kp,ef,(Es-ja.current)/Hi.current)))===-1&&Er.push(new Ie(kp,ef,(Es-ja.current)/Hi.current))}if(Er.length>2){Er=k(Er,"x","y");const Ol=new SA(Er);Ol.closed=!0,Ol.tension=.5;const kp=Ol.getPoints(Er.length*20);ar.setFromPoints(kp)}else ar.setFromPoints(Er)}else if(Ce==="sag"){const Es=gf.clamp($e,hn.x,pn.x);Ba=new zs(.01,sr,Cn),Qr=new Jn(Ba,Fi),Qr.name="azimuth",Qr.position.set(Es,ur.y,ur.z);for(let Ol=0;Ol<Jt.children[0].geometry.attributes.position.array.length;Ol+=3){let kp=Jt.children[0].geometry.attributes.position.array[Ol],ef=Jt.children[0].geometry.attributes.position.array[Ol+1],Mg=Jt.children[0].geometry.attributes.position.array[Ol+2],kc=kp*Hi.current+eo.current;Math.abs(kc-Es)<.18&&Er.findIndex(Hl=>Hl.equals(new Ie((Es-eo.current)/Hi.current,ef,Mg)))===-1&&Er.push(new Ie((Es-eo.current)/Hi.current,ef,Mg))}if(Er.length>2){Er=k(Er,"y","z");const Ol=new SA(Er);Ol.closed=!0,Ol.tension=.5;const kp=Ol.getPoints(Er.length*20);ar.setFromPoints(kp)}else ar.setFromPoints(Er)}else return;Qr.userData.initPosition=Qr.position.clone(),Qr.userData.initRotation=Qr.rotation.clone();const sa=new m4(Ba),fl=new Jc({color:"#2b2a2a"}),Jo=new hI(sa,fl);Jo.name="azimuth_edge",Jo.position.set(Qr.position.x,Qr.position.y,Qr.position.z);const $a=new Jc({color:16711680}),Xa=new Ea(ar,$a);return Xa.name="azimuth_outline",Xa.scale.set(Hi.current,Hi.current,Hi.current),Xa.position.set(eo.current,Ya.current,ja.current),_e.current.add(Qr,Xa,Jo),Qr},ce=Ce=>{if(Ce.stopPropagation(),Mc.current.add(Ce.key),Mc.current.has("Alt")&&(Mc.current.has("c")||Mc.current.has("C")))try{const $e=f.domElement.toDataURL("image/png"),Ke=document.createElement("a");Ke.href=$e,Ke.download="scene.png",Ke.click(),Mc.current=new Set}catch($e){console.error("Error downloading canvas:",$e),alert("抱歉,无法下载画布。请查看控制台获取更多信息。")}};S.useEffect(()=>{fetch(n+"/data/json/name.json").then(Ke=>Ke.json()).then(Ke=>{bl(Ke)}),fetch(n+"/data/TreeData/nuclear.json").then(Ke=>Ke.json()).then(Ke=>{cs(Ke)});const Ce=new qc(.05,32,32),$e=new Ml({color:392960,transparent:!0});if(ll.current=new Jn(Ce,$e),ll.current.name="sectionSphere",W7){let Ke=JSON.parse(W7);ll.current.position.set(Ke.x,Ke.y,Ke.z)}return qa.cranialVisibility&&ga(!0),zZ&&Dp(),U5e&&P8(U5e),document.addEventListener("keydown",ce),document.addEventListener("keyup",T),window.addEventListener("beforeunload",uT),()=>{document.removeEventListener("keydown",ce),document.removeEventListener("keyup",T),window.removeEventListener("beforeunload",uT)}},[]),S.useEffect(()=>{fetch("/staticresource/data/SWC/swc_foler/15257/BIL_15257_1.js").then(Ce=>Ce.json()).then(Ce=>{Nc(Ce)}).catch(Ce=>{console.error("Fetch error:",Ce)})},[]);const xe=(Ce,$e)=>eu?S.createElement("div",{style:{position:"absolute",top:"4px",right:"50px"}},S.createElement(Qy,{defaultChecked:!1,onChange:Ke=>{Ke.target.checked?localStorage.setItem(Ce,"true"):localStorage.setItem(Ce,"false"),$e()},style:{marginTop:"10px"}},"Don't show again")):null,rt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,S.createElement("div",null,a("8000.0001")||"如①所示,在主窗口左侧的是数据面板,用户可以在该选项卡下选择STAM的解剖命名树,配准到STAM上的完整脑血管图谱和神经元数据。用户也可以切换两个不同版本的命名系统。"),S.createElement("div",null,a("8000.0002")||"如②所示,主窗口中可以加载脑区、核团的三维模型。"),S.createElement("div",null,a("8000.0003")||"如③所示,用户可以切换不同的模式或者功能模块"),S.createElement("div",null,a("8000.00031")||"如④所示,工具栏从左到右依次是,回到首页、切换水平面、切换矢状面、切换水平面、重置视角、显示设置、反馈")),cover:S.createElement("video",{src:`${n}/guide/topo.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",style:{width:"min-content"},target:ir.current},{title:a("8000.0032")||"解剖结构、脑血管和神经元查询",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,a("8000.0004")||"Regions选项卡包含的是STAM的解剖命名树,用户可以在该选项卡下的复选框中选择任意数量的感兴趣结构,在主窗口中可视化;Vessels选项卡包含了一套配准到STAM上的完整脑血管图谱,用户可以在此选择感兴趣的血管分支;Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。用户也可以选择切换到Brain maps 4.0 ontology,该命名树中的结构同样可以被检索、选中并可视化。"),target:s.current,placement:"right"},{title:a("8000.0033")||"可视化解剖子结构并切换坐标原点",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,a("8000.0005")||"用户可以点击Regions选项卡下的解剖命名树中蓝色的方块图标,此时主窗口中会以组装的形式可视化用户点击结构的所有子结构,同时展开幅度可在右侧面板设置。默认情况下,该坐标系统以Bregma点作为原点。户也可以将坐标原点切换为STAM的其它任意19个颅骨或颅内基准点,主窗口中可视化对象的坐标值将根据新的原点重新计算。右击任意基准点,可以保存以基准点为坐标原点的STAM标签图像。"),placement:"center",target:ir.current},{title:a("8000.0034")||"可视化功能设置",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo3.gif`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,a("8000.0006")||"用户可以在页面底部切换到setting选项卡。Left hemisphere开关决定是否展示左半脑,默认为Off。Coordinate开关决定是否在主窗口中显示坐标数值,默认为On。Datum Marks开关决定是否在主窗口中显示基准点,默认为On。Cranial开关决定是否在主窗口中显示颅骨的三维轮廓,默认为Off。"),target:document.getElementsByClassName("bottom_tabs_outer_div")[0]}],Xt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?xe("Virtual",function(){}):null,a("8000.0007")||"我们提供了虚拟手术导航服务,用户可以通过交互操作,模拟向小鼠脑注射病毒的立体定位手术过程。STAM会根据用户操作,返回注射位点与作为坐标原点的颅骨或颅内基准点之间的距离和注射角度信息。"),cover:S.createElement("video",{src:`${n}/guide/surgery.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0035")||"自动导航模式",cover:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?xe("Virtual",function(){}):null,a("8000.0008")||"首先选择要注射的脑区。接下来在脑区上选择注射靶点。用户继续点击Select target按钮,注射脑区的三维模型表面会出现一个跟随鼠标移动的绿点。然后,点击Auto进入自动模式,左侧数据面板中的Structure for injecting选项卡变为Regions to avoid。用户点击需要避开脑区、核团的名称,被选中的文字会变为高亮的红色,同时这些结构的三维轮廓也会显示在主窗口中。接下来点击右侧面板中的Intellectual planning按钮,等待若干秒后,STAM会返回一条从注射靶点出发、并且避开所有用户选中脑区、核团的路径。"),target:s.current,placement:"right"},{title:a("8000.0036")||"手动导航模式",cover:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?xe("Virtual",function(){}):null,a("8000.0009")||"用户点击Manually进入手动规划模式,此时用户标记的注射靶点变为蓝色圆点,并出现一条从注射靶点出发、连接到鼠标当前的位置的红色虚射线,该射线与STAM外轮廓的交点(即注射位点)会被标记为绿色。当用户找到合适的注射路径后,可点击鼠标左键标记,被标记的路径会在主窗口中形成一条蓝色实线,注射位点则被标记为蓝色圆锥,且该路径所穿过的脑区、核团名称也会按照其空间位置排列在实线上。在右侧面板中,会出现该注射路径与三个标准解剖方向的夹角、注射靶点,以及注射位点的信息。用户点击右侧面板上的Reset按钮,即可重新开始整个注射手术流程。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],mn=[{title:a("5000.5084")||"步骤一",description:a("5000.5082")||"请选择注射模式,如果选择自动模式,点击左侧细胞名称选择细胞核进行旁路",target:Ee.current}],_n=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?xe("Reg",function(){}):null,a("8000.0011")||"如①所示,用户可上传PI或DAPI染色的单张脑片图像,该服务将通过约1分钟的服务器端计算,从STAM中重切出一张与用户上传的脑片位置最接近的图谱切面,并根据计算出来的角度和位置显示在主窗口中。"),cover:S.createElement("video",{src:`${n}/guide/registration.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0037")||"上传脑片图像并计算或下载配准结果",cover:S.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?xe("Reg",function(){}):null,a("8000.0012")||"用户可以从本地上传待配准的tif/tiff格式的二维脑片图像。然后选择上传图像的类型。接着点击Calculate the corresponding plane from the atlas按钮组中的Start按钮,等待后台返回计算结果。计算完成后,Start按钮下方会出现计算结果的预览图,可左键单击放大查看。Start按钮右侧的Save按钮此时也变为可点击,用户单击该按钮,可以将计算结果下载到本地。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],or=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0014")||"如①和②所示,用户可以在STAM所在的三维空间中选取任意感兴趣范围,并以不同的采样倍数下载自己选取范围内的原始图像。"),cover:S.createElement("video",{src:`${n}/guide/datasharing.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0047")||"平移模式选择原始图像数据的范围",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0015")||"用户可以点击“Select the range”按钮,然后主窗口中出现一个橙色线条的方框。用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制方框在各个方向上的平移,当某个方向的箭头被用户选中时,该箭头会变为高亮的黄色。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0039")||"缩放模式选择原始图像数据的范围并预览图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0016")||"用户也可以通过按下键盘上的“A”,将范围选取操作从平移模式切换为缩放模式。此时方框的箭头会变为方块,拖动方块,就可以改变方框的大小。经过上述操作明确了待下载数据的空间范围后,可以点击“预览下载图像”按钮,通过体绘制,在主窗口中对该范围内的图像进行可视化,"),placement:"center",target:ir.current},{title:a("8000.0040")||"选择数据的采样倍数并下载",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing3.gif`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0017")||"拖动“Set the downsampling rate”滑动条,用户可以选择待下载数据的采样倍数;具体的倍数值可通过滑块上方的黑色背景提示文字查看。当数据量没有超过1 GB时,点击Downloading按钮可直接下载;当超过该数值,点击Downloading按钮会唤起用户终端的邮箱管理工具(如Outlook等),并自动将待下载范围和采样倍数信息填入邮件中,此时用户点击邮件发送按钮,即可向STAM网站发送数据下载申请。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],ni=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?xe("Map",function(){}):null,a("8000.0018")||"我们支持用户上传此前已经配准到Common Coordinate Framework(CCF)的三维图像数据和神经元完整形态数据,并将其映射到STAM上,并直接在三维空间中进行可视化;我们也支持反向映射,即将已经配准到STAM的同类型数据映射到CCF上。"),cover:S.createElement("video",{src:`${n}/guide/mapping.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0041")||"上传三维图像数据并计算",cover:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?xe("Map",function(){}):null,a("8000.0019")||"用户点击右侧面板的Upload按钮,上传已配准到CCF或者STAM的三维图像数据或神经元形态学数据。上传结束后,在Select the direction of conversion单选框中,确定数据的映射方向是从STAM到CCF还是反过来。此后点击Start按钮,STAM的服务器端开始计算,Start按钮变为等待状态。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0042")||"计算完成后预览或下载结果",cover:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?xe("Map",function(){}):null,a("8000.0020")||"等待约10分钟后,STAM的服务器端完成计算并返回结果。此时Save按钮和View result按钮均变为可点击状态。点击Save按钮,可以将计算结果下载到本地;点击View result按钮,可以在主窗口中预览计算结果。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Pi=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?xe("Res",function(){}):null,S.createElement("div",null,a("8000.0021")||"我们提供了沿任意角度可视化脑图谱切面的服务。用户可以查看感兴趣的STAM任意位置和角度的切面,浏览该切面上的脑区、核团标注,并由该图谱切面跳转到STAM任意切面服务所提供的各向同性1微米分辨率切面。"),S.createElement("div",null,a("8000.0022")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同。位于正中区域的是主窗口。"),S.createElement("div",null,a("8000.0023")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。具体的平移、旋转数值可通过滑块上方的黑色背景提示文字查看。")),cover:S.createElement("video",{src:`${n}/guide/reslicing.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0043")||"平移或旋转图谱切面",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?xe("Res",function(){}):null,a("8000.0024")||"用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制图谱切面的平移。用户也可以通过按下键盘上的“R”,将范围选取操作从平移模式切换为旋转模式。此时箭头会变为球形,沿球形拖动,就可以控制图谱切面的旋转。"),placement:"center",target:ir.current},{title:a("8000.0044")||"下载高分辨率的STAM图谱3D标签图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?xe("Res",function(){}):null,a("8000.0025")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。点击viewer higher resolution image按钮可以跳转到任意剖面可视化界面。点击Requesting STAM labels按钮,填入许可证即可下载各向同性10微米分辨率的STAM图谱3D标签图像。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],da=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?xe("Neu",function(){}):null,S.createElement("div",null,a("8000.0026")||"我们提供全脑的胞体或投射靶区的神经环路数据可视化服务。用户可以选择感兴趣的任意胞体或投射靶区在脑区、核团的神经环路数据,并查看数据对应的脑区、核团标注。"),S.createElement("div",null,a("8000.0027")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同,其中Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。"),S.createElement("div",null,a("8000.0028")||"如②所示,用户可以在搜索框中搜索感兴趣脑区、核团。"),S.createElement("div",null,a("8000.0029")||"如③所示,这是一个由若干个脑区、核团子结构组成的神经环路连接示意图。")),cover:S.createElement("video",{src:`${n}/guide/neuronal.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0045")||"查看神经环路连接示意图并交互",cover:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?xe("Neu",function(){}):null,a("8000.0030")||"用户可以点击“whole-brain connectivity diagram”按钮或在搜索框中搜索感兴趣脑区、核团,即可弹出由若干个脑区、核团子结构组成的神经环路连接示意图。不同圆点表示不同的脑区、核团结构,圆点旁边显示的是脑区、核团的名称。用户可以将鼠标移动到圆点、脑区或核团的名称上,左击或右击圆点。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0046")||"显示用户指定脑区上下游连接关系",cover:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?xe("Neu",function(){}):null,a("8000.0031")||"双击任意一个代表某个脑区、核团结构的圆点,神经环路连接示意图窗口隐藏,回到主窗口页面,显示该结构的上下游连接关系。在Upstream窗口中展示了投射到选中脑区、核团的神经环路,在Downstream窗口中展示了选中脑区、核团的投射靶区。用户可以用复选框选择任意数量的感兴趣神经元,在主窗口中可视化。"),target:s.current,placement:"right"}];S.useEffect(()=>{const Ce=Eh("index"),$e=Eh("type"),Ke=Eh("structure");($e||Ce)&&setTimeout(()=>{switch(Ce=="Assembling"?(!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false")&&Ht(!0):Ce=="Virtual_Inject"?(!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false")&&Yt(!0):Ce=="Slicing"?(!localStorage.getItem("Res")||localStorage.getItem("Res")==="false")&&jn(!0):Ce=="Mapping"?(!localStorage.getItem("Map")||localStorage.getItem("Map")==="false")&&jn(!0):Ce=="Downloading"?(!localStorage.getItem("Down")||localStorage.getItem("Down")==="false")&&Tr(!0):Ce=="Neuronal"?(!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false")&&zn(!0):Ce=="Registration"&&(!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false")&&In(!0),$e){case"simple":document.title="STAM-SimpleViewer",fe(0);case"normal":uo(1,!0),document.title="STAM-NormalViewer";break;case"virtual":document.title="STAM-Surgery",uo(2,!0);break;case"slicing":uo(3,!0),document.title="STAM-Reslicing";break;case"registration":uo(4,!0),document.title="STAM-Registration";break;case"downloading":uo(5,!0),document.title="STAM-Downloading";break;case"mapping":uo(6,!0),document.title="STAM-AtlasMapping";break;case"circuits":uo(7,!0),document.title="STAM-NeuronalCircuits",setTimeout(()=>{Ke&&(io(Ke),ke(Ke))},500);break;case"other":uo(8,!0),document.title="STAM-OtherAtlas";break;case"setting":uo(9,!0),document.title="STAM-ViewSetting";break;case"functionalLoop":uo(12,!0),document.title="STAM-FunctionalLoop";break}},500)},[]),S.useEffect(()=>{Xe.current=(f==null?void 0:f.domElement.clientWidth)-1,et.current=(f==null?void 0:f.domElement.clientHeight)-1;let Ce=-(Fr.min.x+Fr.max.x)*Hi.current/2,$e=Fr.max.clone().multiplyScalar(Hi.current).add(new Ie(Ce,Ya.current,ja.current)),Ke=Fr.min.clone().multiplyScalar(Hi.current).add(new Ie(Ce,Ya.current,ja.current));$t.current=$e,Ft.current=Ke;let lt=new Ml({visible:!1});if(dn.current=new Jn(new zs($t.current.x-Ft.current.x,$t.current.y-Ft.current.y,$t.current.z-Ft.current.z),lt),dn.current.position.set(($t.current.x+Ft.current.x)/2,($t.current.y+Ft.current.y)/2,($t.current.z+Ft.current.z)/2),Ab(),G7){let Rt=G7;Rt=="CCF"&&py({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En),Rt=="WHS"&&py({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En)}},[]),S.useEffect(()=>{Xe.current=(f==null?void 0:f.domElement.clientWidth)-1,et.current=(f==null?void 0:f.domElement.clientHeight)-1},[f==null?void 0:f.domElement.clientWidth]),S.useEffect(()=>{const Ce=new rs;Ce.expandByObject(It.current);const $e=R.current(Ce.min.clone()),Ke=R.current(Ce.max.clone());let lt=new Jp(Pp(650,620,`${$e.x.toFixed(2)},${$e.y.toFixed(2)},${$e.z.toFixed(2)}`,"#ccc")),Rt=new mp(new $f({map:lt}));Rt.name="startText";let Jt=new Jp(Pp(650,620,`${Ke.x.toFixed(2)},${Ke.y.toFixed(2)},${Ke.z.toFixed(2)}`,"#ccc")),rn=new mp(new $f({map:Jt}));rn.name="endText",Rt.position.set(Ce.min.x,Ce.min.y+.2,Ce.min.z),rn.position.set(Ce.max.x,Ce.max.y+.6,Ce.max.z);let hn=_e.current.getObjectByName("startText"),pn=_e.current.getObjectByName("endText");hn&&pn&&(_e.current.remove(hn,pn),_e.current.add(Rt,rn))},[Q]),S.useEffect(()=>{var Cr,sr;let Ce={},$e=[],Ke=[],lt={},Rt=[],Jt=[],rn="",hn=new URL(window.location.href),pn=new URLSearchParams(hn.search);if(ge&&Be.length>0){if(rn=we&&Rl(Be,we),we==""){_.current.removeFBX(za.current,!0);const Cn=_.current.checkedKeys.current.findIndex(ar=>ar===za.current);Cn>-1&&_.current.checkedKeys.current.splice(Cn,1),we==""&&(za.current="");const ur=JSON.stringify(_.current.checkedKeys.current);pn.delete("echart_Value"),pn.set("regionsChecked",ur),hn.search=pn.toString(),window.history.replaceState({},"",hn)}if(we!=""){if(rn==null&&we)if(we=="fiber tract fiber tracts")rn="fiber tract";else{let Cn=we.match(/^[\w\/]+/);rn=Cn?Cn[0]:""}if(rn){let Cn=((Cr=ge[rn])==null?void 0:Cr.soma)||[];Rt=Rt.concat(Cn);let ur=((sr=ge[rn])==null?void 0:sr.axon)||[];Jt=Jt.concat(ur),Rt=Array.from(new Set(Rt)),Jt=Array.from(new Set(Jt)),Jt&&Jt.forEach(Fi=>{var sa,fl,Jo;for(const $a in ge)(fl=(sa=ge[$a])==null?void 0:sa.soma)!=null&&fl.includes(Fi)&&((Jo=ge[$a])==null?void 0:Jo.id)==1&&($a in Ce?Ce[$a].includes(Fi)||Ce[$a].push(Fi):Ce[$a]=[Fi])}),Rt&&Rt.forEach(Fi=>{var sa,fl,Jo;for(const $a in ge)(fl=(sa=ge[$a])==null?void 0:sa.axon)!=null&&fl.includes(Fi)&&((Jo=ge[$a])==null?void 0:Jo.id)==1&&($a in lt?lt[$a].includes(Fi)||lt[$a].push(Fi):lt[$a]=[Fi])});for(let Fi in lt)if(Fi!=rn){let sa=ad(Be,Fi.replace("_","/"));sa&&Ke.push({name:Fi.replace("_","/"),itemStyle:{color:sa.color},lineStyle:{color:"#ccc"},value:lt[Fi].length})}for(let Fi in Ce)if(Fi!=rn){let sa=ad(Be,Fi.replace("_","/"));sa&&$e.push({name:Fi.replace("_","/"),itemStyle:{color:sa.color},lineStyle:{color:"#ccc"},value:Ce[Fi].length})}Il(!0);let ar=ad(Be,rn.replace("_","/"));const Er=[{name:rn.replace("_","/"),itemStyle:{color:ar&&ar.color},lineStyle:{color:"#ccc"},children:$e}],Qr=[{name:rn.replace("_","/"),itemStyle:{color:ar&&ar.color},lineStyle:{color:"#ccc"},children:Ke}];if(za.current!=rn){_.current.removeFBX(za.current,!0);const Fi=_.current.checkedKeys.current.findIndex(Jo=>Jo===za.current);Fi>-1&&_.current.checkedKeys.current.splice(Fi,1);const sa=ad(_.current.treeDatas,rn.replace("_","/"));let fl=n+"/data/FBX/"+rn+".FBX";sa&&bd(fl,rn,sa.color,.8,0,"FBX"),_.current.checkedKeys.current.push(rn),te(_.current.checkedKeys.current),za.current=rn,pn.set("echart_Value",we||""),hn.search=pn.toString(),window.history.replaceState({},"",hn)}const Ba={series:[{type:"tree",top:"1%",bottom:"1%",symbolSize:7,emphasis:{focus:"ancestor",lineStyle:{color:"#000"}},expandAndCollapse:!0,animationDuration:550,animationDurationUpdate:750}]};if(Ls.current&&_s.current){_s.current.style.height=Ke.length*2*10+"px",Ls.current.style.height=$e.length*2*10+"px";const Fi=t7(Ls.current);Fi.setOption({...Ba,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Xa,Es,Ol,kp,ef){const Mg=Xa[0],kc=Xa[1];return[Mg+10,kc]},formatter:function(Xa){const Es=rn==Xa.name?"":Xa.name+"->",Ol=Xa.value?", "+Xa.value+" neurons":"";return`${Es}${rn}${Ol}`}},series:[{...Ba.series[0],left:"30%",right:"30%",label:{position:"right",verticalAlign:"middle",align:"left"},leaves:{label:{position:"left",verticalAlign:"middle",align:"right"}},orient:"RL",data:Er}]});const sa=t7(_s.current);sa.setOption({...Ba,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Xa,Es,Ol,kp,ef){const Mg=Xa[0],kc=Xa[1],sd=ef.contentSize[0];return[Mg-sd-10,kc]},formatter:function(Xa){const Es=rn==Xa.name?"":"->"+Xa.name+", "+Xa.value+" neurons";return`${rn}${Es}`}},series:[{...Ba.series[0],left:"20%",right:"40%",label:{position:"left",verticalAlign:"middle",align:"right"},leaves:{label:{position:"right",verticalAlign:"middle",align:"left"}},orient:"LR",data:Qr}]});const fl=()=>{Fi.resize(),sa.resize()},Jo=Xa=>{if(re(Tt.indexOf("neurons")+1),Se.current.ProcessedData.current=!1,Xa.data&&Xa.data.name){Se.current.setSearchValue(rn.replace("_","/")),Se.current.setSomaValue(Xa.data.name.replace("_","/"));const Es=vc(Er[0],Xa.data.name);Fi.setOption({series:[{data:[Es]}]}),sa.setOption({series:[{data:Qr}]})}},$a=Xa=>{if(re(Tt.indexOf("neurons")+1),Se.current.ProcessedData.current=!1,Xa.data&&Xa.data.name){Se.current.setSearchValue(Xa.data.name.replace("_","/")),Se.current.setSomaValue(rn.replace("_","/"));const Es=vc(Qr[0],Xa.data.name);sa.setOption({series:[{data:[Es]}]}),Fi.setOption({series:[{data:Er}]})}};return window.addEventListener("resize",fl),Fi.on("click",Jo),sa.on("click",$a),Er[0].children[0]&&Jo({data:{name:Er[0].children[0].name}}),Ui({Upstream:$e,Downstream:Ke}),()=>{Fi.off("click",Jo),sa.off("click",$a),window.removeEventListener("resize",fl),Fi.dispose(),sa.dispose()}}}}else Il(!1),_s.current&&Ls.current&&(_s.current.style.height="0px",Ls.current.style.height="0px"),Ui({})}},[we,Be,ge]),S.useEffect(()=>{const Ce=Eh("index"),$e=Eh("type"),Ke=(Ce||$e)&&sl.current;if(Y===2)sl.current?(uo(2,!0,!Ke),sl.current=!1):uo(2),Jr(!0),p.current.noRotate=!0,p.current.noPan=!0,f.domElement.addEventListener("mousedown",vT),f.domElement.addEventListener("mousemove",Ha),f.domElement.addEventListener("mouseup",Rb),W(1);else{_e.current.rotation.set(0,0,0),p.current.noRotate=!1,p.current.noPan=!1,f.domElement.removeEventListener("mousedown",vT),f.domElement.removeEventListener("mousemove",Ha),f.domElement.removeEventListener("mouseup",Rb),W(3),nC(),sl.current?(uo(1,!0,!Ke),sl.current=!1):uo(1),V(!1);const lt=_e.current.getObjectByName("targetPoint");lt&&_e.current.remove(lt)}},[Y]),S.useEffect(()=>{Oi.length>0&&st(!0)},[Oi]);const us=Ce=>{const{positionx:$e,positiony:Ke,positionz:lt}=Ce;let Rt=new URL(window.location.href),rn=new URLSearchParams(Rt.search).get("atlasReslicingInfo"),hn={};rn&&(hn=JSON.parse(rn)),Dt($e),Zt(Ke),en(lt),hn.positionX=$e,hn.positionY=Ke,hn.positionZ=lt;let pn=new Ie($e,Ke,lt);qa.atlasReslicingInfo=hn,qa.sectionPointPosition=pn,ll.current&&ll.current.position.set(pn.x,pn.y,pn.z)},Vo=Ce=>{qi(Ce)},uo=(Ce,$e=!1,Ke=!0)=>{if(Ce==vr)return;if(_e.current.remove(ll.current),fr(Ce),he({}),Le(0),Y===0&&Ce=="1"?Lg("0",Ke,$e):Lg(Ce,Ke,$e),$e||(Ce=="7"||Ce=="3"?aC(!0):aC(!1)),E&&(E.current=Ce),Ce!==2){const Jo=_e.current.getObjectByName("syrings");Jo&&_e.current.remove(Jo),V(!1),$e||Xc()}if(Ce==2){ki.current.position.set(18,-10,-10),ki.current.rotation.set(2.9896,0,0),p.current.reset(),p.current.target.set(0,0,0),p.current.object.position.set(18,-10,-10),p.current.object.up.set(0,-1,0),p.current.update(),ki.current.updateMatrixWorld();const Jo=JSON.stringify({cameraPosition:ki.current.position,cameraRotation:ki.current.rotation}),$a=JSON.stringify({controlsTarget:p.current.target,controlsPosition:p.current.object.position,controlsUp:p.current.object.up});let Xa=new URL(window.location.href),Es=new URLSearchParams(Xa.search);Es.set("cameraInfo",Jo),Es.set("controllerInfo",$a),Xa.search=Es.toString(),window.history.replaceState({},"",Xa)}Ab(),zi([]),Ia("Config_DAPI.ini"),Fn.current=null,Ua({}),$e||ae.current&&Se.current&&_.current&&(ae.current.removeALL(),Se.current.removeALL(),_.current.removeALL()),Ce==1?x(!0):x(!1),pt(a("4000.0208")||"选择靶点"),l(""),y.current=!1,d.current=!1;const lt=_e.current.getObjectByName("sphereBig"),Rt=_e.current.getObjectByName("sphereMiddelClick"),Jt=_e.current.getObjectByName("dashedLine"),rn=_e.current.getObjectByName("Line"),hn=_e.current.getObjectByName("transformControls"),pn=_e.current.getObjectByName("sectionSphere"),Cr=_e.current.getObjectByName("correspondingPlaneDataSwc"),sr=_e.current.getObjectByName("azimuth"),Cn=[];_e.current.traverse(Jo=>{Jo.userData.isAtlasMapping==="true"&&Cn.push(Jo)}),Cn.forEach(Jo=>{_e.current.remove(Jo)}),sr&&_e.current.remove(sr),Cr&&_e.current.remove(Cr),pn&&_e.current.remove(pn),hn&&_e.current.remove(hn),m.current=[],b.current=[],Jt&&_e.current.remove(Jt),rn&&_e.current.remove(rn),lt&&_e.current.remove(lt),Rt&&_e.current.remove(Rt);const ur=_e.current.children.filter(Jo=>Jo.userData.name==="registrationPng");ur&&_e.current.remove(...ur),U.current=!1;const ar=_e.current.children.filter(Jo=>Jo.name==="brainRegionPoints"||Jo.name==="brainRegionLine"||Jo.name==="cardContainer");ar&&_e.current.remove(...ar),P(!1);const Er=_e.current.getObjectByName("HorizontalView"),Qr=_e.current.getObjectByName("SagittalView"),Ba=_e.current.getObjectByName("arbitrarySlice"),Fi=_e.current.getObjectByName("CoronalView"),sa=_e.current.getObjectByName("functionLoopGroup");sa&&sa.remove(...sa.children),Ce!=3&&(Er&&(_e.current.remove(Er),Un(!1)),Qr&&(_e.current.remove(Qr),Dn(!1)),Ba&&(_e.current.remove(Ba),gi(!1)),Fi&&(_e.current.remove(Fi),Kr(!1))),Ce==3&&setTimeout(()=>{zl(ze.current,$e)},10),Gu(!1),k8(),gt(1);const fl=document.querySelector(".tabsCompnent .ant-tabs-content-holder");fl&&Ce==12?fl.style.padding="0px":fl.style.padding="10px"},Ms=Ce=>{r(Ce),i.current=Ce},vc=(Ce,$e)=>{const Ke=JSON.parse(JSON.stringify(Ce)),lt=Rt=>{Rt.name===$e?Rt.lineStyle.color="#000":Rt.lineStyle.color="#ccc",Rt.children&&Rt.children.forEach(Jt=>{lt(Jt)})};return lt(Ke),Ke},Rl=(Ce,$e)=>{for(let Ke of Ce){if(Ke.name.toLowerCase()===$e.toLowerCase()||Ke.fullname.toLowerCase()===$e.toLowerCase())return Ke.name;if(Ke.children){const lt=Rl(Ke.children,$e);if(lt)return lt}}return null},Ad=()=>{y.current=!y.current,d.current=!1,v.current&&_e.current.remove(v.current)},Rd=()=>{if(d.current=!1,ot==(a("4000.0208")||"选择靶点"))pt(a("4000.0242")||"清除靶点");else if(ot===(a("4000.0126")||"重置"))an(0),G.current="",pt(a("4000.0208")||"选择靶点"),V(!1),Xc(),W(1),gt(1),Ov.current&&(Ov.current.abort(),Ov.current=null);else{pt(a("4000.0208")||"选择靶点"),m.current=[],b.current=[],gt(1),V(!1);const Ce=_e.current.getObjectByName("dashedLine"),$e=_e.current.getObjectByName("sphereBig"),Ke=_e.current.getObjectByName("sphereMiddelClick"),lt=_e.current.getObjectByName("targetPoint"),Rt=_e.current.getObjectByName("azimuth"),Jt=_e.current.getObjectByName("azimuth_outline"),rn=_e.current.getObjectByName("azimuth_edge");rn&&_e.current.remove(rn),Rt&&_e.current.remove(Rt),Jt&&_e.current.remove(Jt),Ce&&$e&&_e.current.remove(Ce,$e),Ke&&_e.current.remove(Ke),lt&&_e.current.remove(lt),d.current=!1}Ad()};S.useEffect(()=>{j&&si==0&&cr(!0),si!=0&&j&&pt(a("4000.0126")||"重置")},[j]);const Xc=()=>{m.current=[],b.current=[];const Ce=_e.current.getObjectByName("dashedLine"),$e=_e.current.getObjectByName("sphereBig"),Ke=_e.current.getObjectByName("sphereMiddelClick"),lt=_e.current.getObjectByName("targetPoint"),Rt=_e.current.getObjectByName("azimuth"),Jt=_e.current.getObjectByName("azimuth_outline"),rn=_e.current.getObjectByName("azimuth_edge");rn&&_e.current.remove(rn),Rt&&_e.current.remove(Rt),Jt&&_e.current.remove(Jt),Ce&&$e&&_e.current.remove(Ce,$e),Ke&&_e.current.remove(Ke),lt&&_e.current.remove(lt),nC(),P(!1),H.current=[],y.current=!0,d.current=!1,U.current=!1,_.current.removeALL(),v.current&&_e.current.remove(v.current),re(1),l("")};function ac(){if(!vs.current||!vs.current.startsWith("data:image/png;base64,")){alert("Please enter a valid Base64 encoded PNG string (e.g., data:image/png;base64,...).");return}const Ce=document.createElement("a");Ce.href=vs.current,Ce.download="downloaded_image.png";const $e=document.createElement("a");$e.href="/staticresource/data/json/rgb_value.zip",$e.download="rgb_value.zip",document.body.appendChild($e),document.body.appendChild(Ce),$e.click(),setTimeout(()=>{Ce.click();let Ke=new URL(window.location.href),Rt=new URLSearchParams(Ke.search).get("type");const Jt=window.location.origin+window.location.pathname+`?type=${Rt}&currentSlice=2d`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Jt,time:0})}).then(rn=>rn.json()).then(rn=>{})},200),document.body.removeChild($e),document.body.removeChild(Ce)}const Vl=(Ce,$e)=>{clearTimeout(Td.current),Td.current=setTimeout(()=>{const Ke=_e.current.getObjectByName("Brain");let lt=new vo;lt.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);let Rt=new Ie,Jt=new fS;if($e)if(Ke&&(Rt=$e.position.clone().applyMatrix4(Ke.matrixWorld.clone().invert()).applyQuaternion(lt)),Ce==1)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:Rt.z})}).then(rn=>rn.ok?rn.json():Wo.error({title:rn.message})).then(rn=>{const hn=rn.base64;vs.current=hn;let pn=Jt.load(hn);pn.center.set(.5,.5),pn.rotation=Math.PI,$e.material.map=pn});else if(Ce==2)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Rt.x,y:0,z:0})}).then(rn=>rn.ok?rn.json():Wo.error({title:rn.message})).then(rn=>{const hn=rn.base64;let pn=Jt.load(hn);const sr=$e.geometry.attributes.uv.array,Cn=ar=>{sr[ar+0]=1,sr[ar+1]=0,sr[ar+2]=1,sr[ar+3]=1,sr[ar+4]=0,sr[ar+5]=0,sr[ar+6]=0,sr[ar+7]=1},ur=ar=>{sr[ar+0]=1,sr[ar+1]=1,sr[ar+2]=1,sr[ar+3]=0,sr[ar+4]=0,sr[ar+5]=1,sr[ar+6]=0,sr[ar+7]=0};Cn(0),ur(8),$e.geometry.attributes.uv.needsUpdate=!0,$e.material.map=pn});else if(Ce==3)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Rt.y,z:0})}).then(rn=>(rn.ok,rn.json())).then(rn=>{if(rn.message){Wo.error({content:rn.message});return}const hn=rn.base64;vs.current=hn;let pn=Jt.load(hn);const sr=$e.geometry.attributes.uv.array;(ur=>{sr[ur+0]=1,sr[ur+1]=0,sr[ur+2]=0,sr[ur+3]=0,sr[ur+4]=1,sr[ur+5]=1,sr[ur+6]=0,sr[ur+7]=1})(24),$e.geometry.attributes.uv.needsUpdate=!0,$e.material.map=pn});else{const rn=$e.rotation.x/Math.PI*180,hn=$e.rotation.y/Math.PI*180,pn=$e.rotation.z/Math.PI*180;fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[rn,hn,pn],center:[Rt.x,Rt.y,Rt.z]})}).then(Cr=>Cr.ok?Cr.json():Wo.error({title:Cr.message})).then(Cr=>{const sr=Cr.base64;vs.current=sr;let Cn=Jt.load(sr);const ar=$e.geometry.attributes.uv.array;(Qr=>{ar[Qr+0]=0,ar[Qr+1]=0,ar[Qr+2]=1,ar[Qr+3]=0,ar[Qr+4]=0,ar[Qr+5]=1,ar[Qr+6]=1,ar[Qr+7]=1})(24),$e.geometry.attributes.uv.needsUpdate=!0,$e.material.map=Cn})}},100)},Eo=(Ce,$e)=>{let Ke,lt=0,Rt=new URL(window.location.href),rn=new URLSearchParams(Rt.search).get("atlasReslicingInfo"),hn={};rn&&(hn=JSON.parse(rn)),ze.current==1?(_e.current.children.forEach(function(pn,Cr){$e==3&&pn.name=="CoronalView"&&(lt=Cr)}),Ke=new Ie(0,0,Ce),_e.current.children[lt].position.setZ(Ke.z),Vl(ze.current,_e.current.children[lt])):ze.current==2?(_e.current.children.forEach(function(pn,Cr){$e==1&&pn.name=="SagittalView"&&(lt=Cr)}),Ke=new Ie(Ce,0,0),_e.current.children[lt].position.setX(Ke.x),Vl(ze.current,_e.current.children[lt])):ze.current==3?(_e.current.children.forEach(function(pn,Cr){$e==2&&pn.name=="HorizontalView"&&(lt=Cr)}),Ke=new Ie(0,Ce,0),_e.current.children[lt].position.setY(Ke.y),Vl(ze.current,_e.current.children[lt])):ze.current==4&&(_e.current.children.forEach(function(pn,Cr){pn.name=="arbitrarySlice"&&(lt=Cr)}),$e==3&&(en(Ce),hn.positionZ=Ce,qa.atlasReslicingInfo=hn,Ke=new Ie(Nt,Lt,Ce),_e.current.children[lt].position.setZ(Ke.z)),$e==2&&(Zt(Ce),hn.positionY=Ce,qa.atlasReslicingInfo=hn,Ke=new Ie(zt,Ce,zt),_e.current.children[lt].position.setY(Ke.y)),$e==1&&(Dt(Ce),hn.positionX=Ce,qa.atlasReslicingInfo=hn,Ke=new Ie(Ce,Lt,zt),_e.current.children[lt].position.setX(Ke.x)),Vl(ze.current,_e.current.children[lt]))},ju=Ce=>{let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("atlasReslicingInfo"),Rt={};lt&&(Rt=JSON.parse(lt)),ze.current==2&&(Dt(Ce),Zt(-5.33),en(-8),Eo(Ce,1),Rt.positionX=Ce,Rt.positionY=-5.33,Rt.positionZ=-8,qa.atlasReslicingInfo=Rt),ze.current==4&&Eo(Ce,1)},Qd=Ce=>{let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("atlasReslicingInfo"),Rt={};lt&&(Rt=JSON.parse(lt)),ze.current==3&&(Zt(Ce),en(-8),Dt(-5.17),Rt.positionX=-5.17,Rt.positionY=Ce,Rt.positionZ=-8,qa.atlasReslicingInfo=Rt,Eo(Ce,2)),ze.current==4&&Eo(Ce,2)},Ps=Ce=>{let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("atlasReslicingInfo"),Rt={};lt&&(Rt=JSON.parse(lt)),ze.current==1&&(en(Ce),Dt(-5.17),Zt(-5.33),Eo(Ce,3),Rt.positionX=-5.17,Rt.positionY=-5.33,Rt.positionZ=Ce,qa.atlasReslicingInfo=Rt),ze.current==4&&Eo(Ce,3)},Wu=(Ce,$e)=>{let Ke=0,lt=new URL(window.location.href),Jt=new URLSearchParams(lt.search).get("atlasReslicingInfo"),rn={};Jt&&(rn=JSON.parse(Jt)),_e.current.children.forEach(function(Cn,ur){Cn.name=="arbitrarySlice"&&(Ke=ur)});let hn=_e.current.children[Ke];hn.rotation.set(hn.userData.initRotation.x,hn.userData.initRotation.y,hn.userData.initRotation.z);let pn=0,Cr=0,sr=0;$e==1&&(mt(Ce),rn.angleX=Ce,qa.atlasReslicingInfo=rn,pn=Ce*Math.PI/180,Cr=Vt*Math.PI/180,sr=Fe*Math.PI/180),$e==2&&(fn(Ce),rn.angleY=Ce,qa.atlasReslicingInfo=rn,pn=pr*Math.PI/180,Cr=Ce*Math.PI/180,sr=Fe*Math.PI/180),$e==3&&(_t(Ce),rn.angleZ=Ce,qa.atlasReslicingInfo=rn,pn=pr*Math.PI/180,Cr=Vt*Math.PI/180,sr=Ce*Math.PI/180),hn.rotation.x=pn,hn.rotation.y=Cr,hn.rotation.z=sr,_e.current.children.forEach(function(Cn,ur){Cn.name=="arbitrarySlice"&&(Ke=ur)}),Vl(ze.current,_e.current.children[Ke])},Cl=(Ce,$e=!1)=>{let Ke;const lt=Ce||o;if(ze.current==4||$e)setTimeout(()=>{let Rt="atlas.brainsmatics.org",Jt=[],rn=parseInt(((zt+8)/14*14e3).toString()),hn=parseInt(((Lt+5.33)/7.37*9e3).toString());$e?(Jt[0]=90+Dr.angles[0],Jt[1]=Dr.angles[1],Jt[2]=Dr.angles[2],rn=Dr.tx*14e3,hn=450):(Jt[0]=pr,Jt[1]=Vt,Jt[2]=Fe);let pn=parseInt(((Nt+5.17)/10.34*11400).toString()),Cr=ct||"http://"+Rt,sr="http://"+Rt+'/program/frontend/#!{"dimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"position":['+pn+","+hn+","+rn+'],"crossSectionOrientation":[0.7071067690849304,0,0,-0.7071067690849304],"crossSectionScale":19.05662684586283,"projectionOrientation":[0.10079027712345123,0.01086505874991417,-0.5527856945991516,-0.827134370803833],"projectionScale":74319.80669416502,"projectionDepth":-49.99956451007631,"layers":[{"type":"image","source":{"url":"precomputed://'+Cr+'/data/RGB_raw","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]},"inputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]}}},"tab":"rendering","shader":"#uicontrol invlerp normalized\\nvoid main() {\\n emitRGB(vec3(toNormalized(getDataValue(0)),\\n toNormalized(getDataValue(1)),\\n toNormalized(getDataValue(2))));\\n}\\n","channelDimensions":{"c^":[1,""]},"name":"raw"},{"type":"segmentation","source":{"url":"precomputed://'+Cr+'/data/seg_half","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"inputDimensions":{"x":[0.00001,"m"],"y":[0.00001,"m"],"z":[0.00001,"m"]}}},"tab":"segments","segments":["10","100","1000","1002","1004","1005","1006","1007","1008","1009","1010","1011","1012","1013","1014","1015","1016","1017","1018","1019","1020","1021","1022","1023","1024","1025","1026","1100","104","105","106","107","108","11","110","111","112","113","114","115","117","118","119","12","120","122","123","124","125","126","129","13","130","131","134","138","14","141","142","143","146","147","149","15","150","152","154","156","159","16","160","162","164","165","166","167","168","170","172","173","174","176","177","178","179","18","180","181","182","183","186","189","19","190","192","193","194","195","196","199","2","20","201","202","203","204","206","207","208","21","212","215","216","217","219","22","220","221","223","224","225","228","229","23","230","231","232","234","235","236","237","238","239","24","241","242","243","245","246","247","248","25","250","251","253","254","256","257","259","26","260","265","266","267","268","27","271","272","273","275","276","279","28","280","282","283","284","287","29","291","293","294","295","296","297","298","3","30","300","303","304","305","306","31","311","312","313","315","319","32","320","321","322","323","324","325","326","329","33","330","331","332","333","335","336","337","338","34","340","341","342","343","344","347","348","349","35","350","351","352","354","355","356","357","359","36","361","362","365","366","367","368","369","37","371","372","373","374","375","376","377","378","38","380","385","386","387","389","39","390","391","392","393","394","395","397","399","4","40","401","402","405","407","409","41","412","413","414","415","416","417","419","42","422","423","424","426","427","428","43","430","432","435","438","439","44","440","441","442","443","444","445","446","449","45","450","451","452","453","454","456","458","459","46","460","461","462","463","464","465","466","467","47","470","473","474","475","476","478","479","48","480","481","484","485","486","487","488","49","490","491","493","494","497","498","499","5","50","500","501","503","504","505","507","508","51","510","511","512","513","514","516","517","518","519","52","520","528","529","53","533","535","536","537","538","539","54","540","541","542","544","545","546","548","549","55","550","553","554","555","556","557","559","56","561","562","563","565","568","57","570","571","572","573","574","575","576","578","579","58","581","582","584","586","59","591","593","594","595","597","599","6","60","601","602","604","606","61","611","612","613","614","615","616","617","618","619","62","620","621","622","623","624","625","627","628","629","63","631","632","635","637","638","639","64","641","642","643","644","645","646","647","648","65","650","652","653","656","657","658","660","661","662","665","666","667","67","671","672","673","674","677","678","679","68","680","681","682","683","684","686","687","688","690","693","695","696","697","698","699","7","701","702","704","706","707","708","709","710","711","712","713","716","717","72","720","721","722","724","725","727","729","731","733","734","735","736","737","74","740","744","746","748","749","750","752","754","755","757","758","759","76","760","762","763","764","765","767","768","769","770","771","772","773","774","775","776","778","779","78","780","783","784","785","787","789","790","791","793","796","797","798","799","8","80","803","804","808","809","81","810","812","816","818","819","82","821","823","824","826","827","829","83","830","831","832","834","835","837","839","84","840","841","842","843","844","846","849","850","851","855","856","857","858","86","861","863","864","865","867","868","869","87","870","871","872","874","875","876","877","878","879","88","880","881","883","885","888","889","89","892","893","894","895","896","898","899","9","90","901","902","906","908","909","91","911","913","915","916","917","919","92","920","921","925","926","927","928","929","93","931","934","935","936","937","938","940","941","942","944","945","946","951","953","954","955","956","957","959","96","963","964","965","966","969","97","970","971","972","973","977","978","980","981","982","983","989","99","991","992","993","995","996","997","998","999"],"segmentQuery":"<id","segmentColors":{"2":"#777b7b","3":"#777979","4":"#848989","5":"#8e9494","6":"#8c9191","7":"#778383","8":"#778181","9":"#93a2a2","10":"#5e6767","11":"#93c1c1","12":"#6b7474","13":"#93c0c0","14":"#8eacac","15":"#727979","16":"#91afaf","18":"#93b4b4","19":"#729c9c","20":"#212d2d","21":"#304242","22":"#2d3e3e","23":"#2b3232","24":"#1e2929","25":"#707676","26":"#7c8383","27":"#89bbbb","28":"#608383","29":"#7c9d9d","30":"#777d7d","31":"#7a8080","32":"#778080","33":"#7f8585","34":"#6d8a8a","35":"#829d9d","36":"#545d5d","37":"#93a4a4","38":"#4c5454","39":"#474f4f","40":"#8cbebe","41":"#7a9a9a","42":"#93b8b8","43":"#84a0a0","44":"#93a1a1","45":"#93baba","46":"#84b4b4","47":"#6d9595","48":"#82b0b0","49":"#6b9191","50":"#7fadad","51":"#87a3a3","52":"#636c6c","53":"#596363","54":"#334545","55":"#2b3b3b","56":"#666f6f","57":"#476161","58":"#939898","59":"#637e7e","60":"#7aa0a0","61":"#7fa5a5","62":"#444d4d","63":"#f2bb3a","64":"#77d1ff","65":"#3ddeff","67":"#2cc15e","68":"#ffd877","72":"#ffbfad","74":"#e5d60b","76":"#40c3dd","78":"#f7e1af","80":"#3bdddd","81":"#a0dfff","82":"#d67259","83":"#ffab93","84":"#f2c04b","86":"#91503f","87":"#3cabc1","88":"#3db4cc","89":"#f7d585","90":"#723f32","91":"#ffb49e","92":"#f4cf53","93":"#ffbf0f","96":"#f2dca7","97":"#e2d92f","99":"#f4d05a","100":"#399eb2","104":"#4dcc77","105":"#f7da96","106":"#d35dac","107":"#ffd15e","108":"#3cd1d1","110":"#55ccb8","111":"#3aa2b7","112":"#bc782f","113":"#8cccc1","114":"#f7d68a","115":"#82ccbf","117":"#6acc8a","118":"#b2af07","119":"#ffd044","120":"#75d1ff","122":"#ef8064","123":"#37dbfc","124":"#c6499d","125":"#66cbff","126":"#ffc32d","129":"#66ccbb","130":"#f7dea3","131":"#fc957b","134":"#ffb5a0","138":"#84493a","141":"#8accc1","142":"#e5d609","143":"#45d9f7","146":"#d8cb17","147":"#f2dca4","149":"#d1ca06","150":"#ce8333","152":"#67afa3","154":"#f2bd43","156":"#ffcf3f","159":"#f79279","160":"#f29d43","162":"#e5d604","164":"#b2af01","165":"#75e5e5","166":"#ffc83f","167":"#ffbdaa","168":"#74c4ed","170":"#ccc50c","172":"#ffa78e","173":"#42cae5","174":"#a2dcf9","176":"#af702b","177":"#965342","178":"#f4bc04","179":"#51cc7a","180":"#d68733","181":"#3ac4e0","182":"#ffc021","183":"#f7d483","186":"#f2dda9","189":"#3eb766","190":"#72ccbd","192":"#f4927a","193":"#f7dc9e","194":"#d1ca04","195":"#fc976c","196":"#fc67ca","199":"#52e5e5","201":"#ffd366","202":"#ffca2d","203":"#ed9436","204":"#ffe7a0","206":"#74ccbd","207":"#33cc66","208":"#36d9f9","212":"#71e2e2","215":"#edd39c","216":"#d38634","217":"#ed9b44","219":"#ccc345","220":"#60e5e5","221":"#c96b54","223":"#ccc62a","224":"#34d0ef","225":"#ffd454","228":"#ea9a44","229":"#f4cf55","230":"#3bcece","231":"#a85c4a","232":"#ffad96","234":"#ffd97a","235":"#ffda7f","236":"#ffc61c","237":"#c6c00d","238":"#f2b935","239":"#ffc107","241":"#ffdf89","242":"#64e5e5","243":"#edca80","245":"#ccc863","246":"#ea7d62","247":"#c9489e","248":"#3fdbdb","250":"#edd5a3","251":"#2bc45e","253":"#ffca44","254":"#f7d380","256":"#ffc832","257":"#f7e0aa","259":"#ffd351","260":"#6bb6db","265":"#d8cb15","266":"#37cc68","267":"#378c9e","268":"#38c9b1","271":"#6bbaad","272":"#39c2dd","273":"#ffc32b","275":"#37ccb3","276":"#3fc1db","279":"#eab94f","280":"#eab84b","282":"#d37158","283":"#38c4c4","284":"#ffdb82","287":"#f7d588","291":"#f9be48","293":"#f49369","294":"#d149a3","295":"#f4cc49","296":"#63a096","297":"#ffe69e","298":"#ff9b70","300":"#f7a27e","303":"#f7a042","304":"#ccc241","305":"#88ccc0","306":"#eaba52","311":"#34ceed","312":"#d8cc1e","313":"#91daff","315":"#f9c04d","319":"#ff996d","320":"#4be5e5","321":"#ffcdbf","322":"#ddd75a","323":"#ffd263","324":"#e0785e","325":"#70e0e0","326":"#ffcf42","329":"#a4defc","330":"#69b2a6","331":"#67a1bf","332":"#57cc7e","333":"#ffbf11","335":"#ea8e77","336":"#ffc73a","337":"#76c9f2","338":"#7f4638","340":"#c16953","341":"#46defc","342":"#f7e1ad","343":"#68aed1","344":"#ff9367","347":"#c4be0d","348":"#6ab7aa","349":"#ffb805","350":"#639bb7","351":"#38bcff","352":"#ed63bf","354":"#f2bc3e","355":"#ffd154","356":"#f2da9d","357":"#e5d606","359":"#9bddff","361":"#ffc311","362":"#ffbb11","365":"#ffa58e","366":"#ffbe1c","367":"#ffb807","368":"#34c8e5","369":"#c1bb0d","371":"#ffbe0c","372":"#a3e0ff","373":"#774234","374":"#3995a8","375":"#d849a9","376":"#3daf63","377":"#ffe8a3","378":"#41cc6f","380":"#ffc823","385":"#ccc751","386":"#5bcc81","387":"#ccc85f","389":"#41bfd8","390":"#36bca6","391":"#edce8b","392":"#54e5e5","393":"#3baa60","394":"#36a9e2","395":"#ef9637","397":"#ffc72d","399":"#68a89d","401":"#ffcc4c","402":"#fc50c3","405":"#3a9aad","407":"#d17057","409":"#77e5e5","412":"#7ee5e5","413":"#b2af05","414":"#67acce","415":"#f2bf48","416":"#c66c55","417":"#5fccb9","419":"#69bfb0","422":"#f265c3","423":"#ffb90a","424":"#41bf6b","426":"#e861bb","427":"#56c6ff","428":"#80ccbf","430":"#389e5a","432":"#ffda7c","435":"#53ccb7","438":"#57e5e5","439":"#f9c252","440":"#ffc416","441":"#ffd259","442":"#6cccbc","443":"#ffa991","444":"#74c4ef","445":"#eadf07","446":"#ffc023","449":"#f7e3b4","450":"#4fcc79","451":"#ffb6a0","452":"#f99c39","453":"#75caf4","454":"#a55b48","456":"#99dcff","458":"#ff976b","459":"#3fcc6e","460":"#ffbd19","461":"#ccc62c","462":"#35d4f4","463":"#76ccbd","464":"#ffd04f","465":"#ccc861","466":"#3aa35d","467":"#ba7b37","470":"#ffe08c","473":"#ff916d","474":"#37bfa8","475":"#efab0b","476":"#ffa187","478":"#66a59b","479":"#efa802","480":"#754033","481":"#ccc859","484":"#6accbb","485":"#3cad62","486":"#f79b38","487":"#b2af08","488":"#f4cb44","490":"#edcf90","491":"#ffcc35","493":"#ccc855","494":"#43cc70","497":"#ea9335","498":"#44e5e5","499":"#edcc84","500":"#ffa791","501":"#39a0b5","503":"#c9c30c","504":"#ffa389","505":"#ffc430","507":"#f9a47f","508":"#63ccba","510":"#f2dfae","511":"#ffd56b","512":"#a35a47","513":"#e89843","514":"#ffd7cc","516":"#5be5e5","517":"#6bc689","518":"#ffc20c","519":"#ccc85d","520":"#3db6ce","528":"#f2da9f","529":"#ffd051","533":"#35cc67","535":"#dd765d","536":"#39a05c","537":"#f2be46","538":"#3fbad3","539":"#77cef9","540":"#3dbeff","541":"#ed9078","542":"#c14799","544":"#9b5544","545":"#8c4d3d","546":"#ffc10a","548":"#f4be0c","549":"#f7e2b2","550":"#3fbfff","553":"#edd49e","554":"#bf6852","555":"#55cc7d","556":"#368a9b","557":"#bc6651","559":"#ffcd4f","561":"#35cae8","562":"#efa907","563":"#ccc347","565":"#3dd3d3","568":"#59ccb8","570":"#ffce54","571":"#39c0db","572":"#e2da31","573":"#f2bb3c","574":"#93dbff","575":"#824739","576":"#e89135","578":"#82e5e5","579":"#68ccff","581":"#ffd256","582":"#ffdf87","584":"#45dbf9","586":"#e08d35","591":"#ffbc05","593":"#ff906b","594":"#84d6ff","595":"#41c16c","597":"#f24fbc","599":"#ddd75f","601":"#ffe18e","602":"#7be5e5","604":"#36c1aa","606":"#ff8e68","611":"#368ea0","612":"#5bc8ff","613":"#79e5e5","614":"#3ba55f","615":"#a5e1ff","616":"#d64aa7","617":"#ffc61e","618":"#3de5e5","619":"#e24ab0","620":"#c6833b","621":"#edcb82","622":"#59c7ff","623":"#3db565","624":"#f9bb3e","625":"#2bbc5b","627":"#ffcb30","628":"#f9a143","629":"#ffc228","631":"#edcd89","632":"#d8cc1c","635":"#efac0e","637":"#7fd4ff","638":"#35d2f2","639":"#ffcd3a","641":"#ffd9ce","642":"#ffbf1e","643":"#eab84d","644":"#ffc9ba","645":"#41ccb4","646":"#f9ba3b","647":"#cec80c","648":"#f4bd09","650":"#3cb1c9","652":"#ffc528","653":"#ce4aa2","656":"#f4bd07","657":"#5dad78","658":"#ff8c66","660":"#ffbba8","661":"#79d0fc","662":"#ffd559","665":"#ffe69b","666":"#ffd456","667":"#ffca47","671":"#f9c14f","672":"#7a4335","673":"#ffbd0a","674":"#ffde84","677":"#f4ca3f","678":"#659fbc","679":"#3ba5ba","680":"#ffa787","681":"#e87c61","682":"#e8a310","683":"#ffc730","684":"#f9bd45","686":"#ba4693","687":"#ba762e","688":"#eade02","690":"#fc9d37","693":"#e8a412","695":"#eadf04","696":"#f4c93d","697":"#ed7f63","698":"#efaa09","699":"#ffcfc1","701":"#ccc349","702":"#ed4eb8","704":"#ffd35b","706":"#2cc960","707":"#d85fb0","708":"#f4c835","709":"#935141","710":"#3fccb4","711":"#ffce3d","712":"#c46a54","713":"#41c5e0","716":"#8cd8ff","717":"#f765c6","720":"#38bed8","721":"#b2af00","722":"#2bbf5d","724":"#b74792","725":"#f2ba37","727":"#37c6af","729":"#f4cd4b","731":"#3fdfff","733":"#67bcae","734":"#43cce8","735":"#49c2ff","736":"#3bcccc","737":"#f2d896","740":"#f4c93a","744":"#edd5a1","746":"#ffc3b2","748":"#4fbff7","749":"#f2d99b","750":"#3cadc4","752":"#84ccc0","754":"#c67e31","755":"#f4cc46","757":"#f29179","758":"#379b59","759":"#ffa382","760":"#f2deab","762":"#ffe8a5","763":"#ddd75d","764":"#bf792f","765":"#f4bc02","767":"#42c0ff","768":"#e58d77","769":"#ffc535","770":"#62e5e5","771":"#5dcc82","772":"#3ca7bc","773":"#f4d15d","774":"#ffc519","775":"#e84cb4","776":"#45cc72","778":"#6cb8dd","779":"#dd8c35","780":"#edd093","783":"#ffc532","784":"#ffb9a5","785":"#ffd65b","787":"#3dccb4","789":"#80e5e5","790":"#649dba","791":"#f49f44","793":"#67afd3","796":"#40e5e5","797":"#f7dda0","798":"#47ccb5","799":"#ccc857","803":"#45ccb5","804":"#ffbd07","808":"#b2458e","809":"#dd4bad","810":"#a8e2ff","812":"#ffa37c","816":"#40bc69","818":"#6eccbc","819":"#68b1d6","821":"#d88934","823":"#44d7f4","824":"#cc5ba6","826":"#4fc4ff","827":"#3ed6d6","829":"#eabb54","830":"#f9b939","831":"#ffc005","832":"#ffd775","834":"#d18534","835":"#ffd260","837":"#c47d31","839":"#39bfbf","840":"#ffcd51","841":"#ffdd82","842":"#bf4897","843":"#e5d602","844":"#49e5e5","846":"#f74fbf","849":"#e88d76","850":"#f4a07c","851":"#ffaf99","855":"#ffc928","856":"#63cbff","857":"#f4d058","858":"#c45aa1","861":"#30cc64","863":"#c95ca5","864":"#ffd059","865":"#47cc73","867":"#f9b834","868":"#edc97b","869":"#ffca2b","870":"#f4c838","871":"#ffc942","872":"#3cb263","874":"#ffb29b","875":"#ffbd16","876":"#f2d898","877":"#ccc62e","878":"#ffd468","879":"#ccc243","880":"#e25fb7","881":"#ffd1c4","883":"#f9937a","885":"#f29837","888":"#e2da34","889":"#379957","892":"#e2795f","893":"#5faf79","894":"#ffc721","895":"#ffc30f","896":"#65a398","898":"#efa904","899":"#4fccb7","901":"#2bc65f","902":"#ffc83d","906":"#5bccb9","908":"#eab748","909":"#ffb39e","911":"#8e4e3e","913":"#ff9f84","915":"#89d7ff","916":"#edd29a","917":"#6ccc8c","919":"#f2c04d","920":"#3dcc6c","921":"#44d1ed","925":"#ce6e56","926":"#d15eaa","927":"#e59744","928":"#fca580","929":"#39c6c6","931":"#6cc98b","934":"#41c8e2","935":"#6bcdff","936":"#ffd147","937":"#874a3b","938":"#5ec9ff","940":"#f49938","941":"#3fba68","942":"#e060b5","944":"#edc97d","945":"#7cccbe","946":"#5caa76","951":"#a05846","953":"#ffc1af","954":"#ffa57f","955":"#ffa58c","956":"#ffc62b","957":"#ffcf56","959":"#50c3fc","963":"#f7dfa8","964":"#db755c","965":"#82d5ff","966":"#ffd34f","969":"#3db0c6","970":"#38bcbc","971":"#54e2ff","972":"#44c0ff","973":"#f7db99","977":"#ffc5b5","978":"#ffba0c","980":"#ffbb0f","981":"#cc8233","982":"#ccc23f","983":"#ffcc32","989":"#ffc935","991":"#db8a34","992":"#ffa584","993":"#f9bd43","995":"#edcf8e","996":"#37baba","997":"#66aacc","998":"#43ccb5","999":"#3eb8d1","1000":"#db5eb1","1002":"#3de2e2","1004":"#37ade8","1005":"#36c4ac","1006":"#d8cc1a","1007":"#54c6ff","1008":"#aa5e4b","1009":"#ef8f77","1010":"#4fc1f9","1011":"#1c2626","1012":"#a5e1ff","1013":"#a5e1ff","1014":"#a5e1ff","1015":"#a5e1ff","1016":"#47cc74","1017":"#47cc75","1018":"#47cc76","1019":"#47cc77","1020":"#47cc78","1021":"#f99c40","1022":"#f99c41","1023":"#ff9368","1024":"#8b51ff","1025":"#8d54ff","1026":"#894fff","1100":"#3ce0e0"},"name":"seg2"}],"showDefaultAnnotations":false,"sliceAngleRotaX":"'+Jt[0]+'","sliceAngleRotaY":"'+Jt[1]+'","sliceAngleRotaZ":"'+Jt[2]+'","selectedLayer":{"visible":true,"layer":"seg2"},"crossSectionBackgroundColor":"#ffffff","projectionBackgroundColor":"#ffffff","layout":"hzkdPanel"}';window.open(sr,"_blank")},300);else if(ze.current==1)Ke=parseInt(((zt+8)/13.9919970598834*700).toString()),window.open("http://"+ue.current+"/STAM/reference/index.html?lang=en_us&3Dname="+lt+"&inp="+Ke+"&section=coronal");else if(ze.current==2){let Rt=Nt;Nt<0&&(Rt=-Nt),Ke=parseInt((Rt/5.17*256).toString()),Nt==0&&(Ke=1),window.open("http://"+ue.current+"/STAM/reference/index.html?lang=en_us&3Dname="+lt+"&inp="+Ke+"&section=sagittal")}else ze.current==3&&(Ke=parseInt(((Lt+5.33)/7.37*367).toString()),window.open("http://"+ue.current+"/STAM/reference/index.html?lang=en_us&3Dname="+lt+"&inp="+Ke+"&section=horizontal"))},ys=(Ce,$e,Ke,lt,Rt,Jt,rn,hn,pn,Cr,sr)=>{let Cn=new URL(window.location.href),ar=new URLSearchParams(Cn.search).get("atlasReslicingInfo"),Er={};ar&&(Er=JSON.parse(ar)),Er.angleX=Ce,Er.angleY=$e,Er.angleZ=Ke,Er.positionZ=Jt,Er.positionX=lt,Er.positionY=Rt,Er.translateX=rn,Er.translateY=hn,Er.translateZ=pn,Er.ButtonDisabled=sr,Er.rotate=Cr,Er.direction1=ze.current,qa.atlasReslicingInfo=Er,mt(Ce),fn($e),_t(Ke),en(Jt),Dt(lt),Zt(Rt),Kt(rn),on(hn),Rn(pn),Lr(Cr),yn(sr)},zl=(Ce,$e=!1)=>{_e.current.remove(ll.current);let Ke=ll.current.position;if($e&&j7){let Rt=JSON.parse(j7);Ke=new Ie(Rt.positionX,Rt.positionY,Rt.positionZ)}let lt=Ce;if($l(lt),lt==1){De.current.enabled=!1,_e.current.remove(De.current),nc(0),ze.current=1,ys(90,0,0,-5.17,-5.33,Ke.z,!0,!0,!1,!0,!1);const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Rt&&(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)),Jt&&(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)),rn&&(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1)),hn?(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)):Kr(!0)}else if(lt==2){nc(0),De.current.enabled=!1,_e.current.remove(De.current),ys(90,270,0,Ke.x,-5.33,-8,!1,!0,!0,!0,!1),ze.current=2;const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Jt?(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)):Dn(!0),Rt&&(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)),hn&&(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)),rn&&(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1))}else if(lt==3){De.current.enabled=!1,_e.current.remove(De.current),ys(360,0,0,-5.17,Ke.y,-8,!0,!1,!0,!0,!1),ze.current=3,nc(0);const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Jt&&(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)),hn&&(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)),rn&&(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1)),Rt?(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)):Un(!0)}else if(lt==4){ze.current=4,_e.current.remove(De.current),ys(120,320,270,Ke.x,Ke.y,Ke.z,!1,!1,!1,!1,!1);const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Jt&&(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)),hn&&(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)),Rt&&(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)),rn?(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1)):gi(!0)}},op=Ce=>{var $e=Vv(Ce,cl.current);if(A.includes(Ce)){_.current.removeFBX(Ce,!0);const Ke=_.current.checkedKeys.current.findIndex(rn=>rn===Ce);Ke>-1&&_.current.checkedKeys.current.splice(Ke,1),te(_.current.checkedKeys.current);let lt=new URL(window.location.href),Rt=new URLSearchParams(lt.search);const Jt=JSON.stringify(_.current.checkedKeys.current);Rt.set("regionsChecked",Jt),lt.search=Rt.toString(),window.history.replaceState({},"",lt),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):$e.forEach(rn=>{_.current.setExpandedKeys(hn=>hn.filter(pn=>pn!==rn))})}else if(Ce){let Ke=Ce.replace("/","_");const lt=_.current.fetchColor(Ce);if(lt){let Rt=n+"/data/FBX/"+Ke+".FBX";bd(Rt,Ce,lt,.8,0,"FBX"),_.current.checkedKeys.current.push(Ce);const Jt=Array.from(new Set([..._.current.expandedKeys,...$e]));_.current.setExpandedKeys(Jt),te(_.current.checkedKeys.current);let rn=new URL(window.location.href),hn=new URLSearchParams(rn.search);const pn=JSON.stringify(_.current.checkedKeys.current);hn.set("regionsChecked",pn),rn.search=hn.toString(),window.history.replaceState({},"",rn)}}Oe({})},id=Ce=>{var $e=Vv(Ce,cl.current);if(A.includes(Ce)){_.current.removeFBX(Ce,!0);const Ke=_.current.checkedKeys.current.findIndex(lt=>lt===Ce);Ke>-1&&_.current.checkedKeys.current.splice(Ke,1),te(_.current.checkedKeys.current),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):$e.forEach(lt=>{_.current.setExpandedKeys(Rt=>Rt.filter(Jt=>Jt!==lt))})}else if(Ce){let Ke=Ce.replace("/","_");const lt=_.current.fetchColor(Ce);if(lt){let Rt=n+"/data/FBX/"+Ke+".FBX";bd(Rt,Ce,lt,.8,0,"FBX"),_.current.checkedKeys.current.push(Ce);const Jt=Array.from(new Set([..._.current.expandedKeys,...$e]));_.current.setExpandedKeys(Jt),te(_.current.checkedKeys.current)}}Oe({})},km=Ce=>{var $e;if(A.includes(Ce)){_.current.removeFBX(Ce,!0);const Ke=_.current.checkedKeys.current.findIndex(rn=>rn===Ce);Ke>-1&&_.current.checkedKeys.current.splice(Ke,1),te(_.current.checkedKeys.current);let lt=new URL(window.location.href),Rt=new URLSearchParams(lt.search);const Jt=JSON.stringify(_.current.checkedKeys.current);Rt.set("regionsChecked",Jt),lt.search=Rt.toString(),window.history.replaceState({},"",lt)}else if(Ce){const Ke=_.current.fetchColor(Ce.replace("_","/"));let lt=n+"/data/FBX/"+Ce.replace("/","_")+".FBX";bd(lt,Ce,Ke,.8,0),_.current.checkedKeys.current.push(Ce),te(_.current.checkedKeys.current);let Rt=new URL(window.location.href),Jt=new URLSearchParams(Rt.search);const rn=JSON.stringify(_.current.checkedKeys.current);Jt.set("regionsChecked",rn),Rt.search=Jt.toString(),window.history.replaceState({},"",Rt)}($e=f.domElement)==null||$e.addEventListener("mousemove",K.current,!1)},g1=Ce=>{if(Ce in Se.current.neurons_line.current){Se.current.removeSWCAll(Ce),Se.current.setCheckItems(Rt=>Rt.filter(Jt=>Jt!==Ce)),Se.current.setPathOpen(Rt=>Rt.filter(Jt=>Jt!==Ce));let $e=new URL(window.location.href),Ke=new URLSearchParams($e.search);const lt=JSON.stringify(Se.current.checkItems.filter(Rt=>Rt!==Ce));if(Ke.set("neuronsChecked",lt),$e.search=Ke.toString(),window.history.replaceState({},"",$e),Ce in pe.current){for(let Rt in pe.current[Ce])_e.current.remove(pe.current[Ce][Rt]);delete pe.current[Ce]}}},m1=()=>{if(!xs.current){js(!0);return}const Ce=document.createElement("a");Ce.href=n+"/zip/9.8.label.zip",Ce.download="9.8.label.zip",Ce.click();let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("type");const Rt=window.location.origin+window.location.pathname+`?type=${lt}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Rt,time:0,key:ua.current})}).then(Jt=>Jt.json()).then(Jt=>{})},ad=(Ce,$e)=>{for(let Ke of Ce){if(Ke.name.toLowerCase()===$e.toLowerCase())return{color:Ke.color,path:Ke.path,fullname:Ke.fullname};if(Ke.children){const lt=ad(Ke.children,$e);if(lt)return lt}}return null},yh=(Ce,$e)=>{for(let Ke of Ce){if(Ke.name.toLowerCase()===$e.toLowerCase()&&!Ke.children)return{color:Ke.color,path:Ke.path};if(Ke.children){const lt=yh(Ke.children,$e);if(lt)return lt}}return null},nn=(Ce,$e)=>{const Ke=[];for(const lt in Ce)Ce[lt].includes($e)&&Ke.push(lt);return Ke},oc=(Ce,$e=[])=>{if(Array.isArray(Ce))for(let Ke of Ce)oc(Ke,$e);if(typeof Ce=="object")if(Ce.hasOwnProperty("children"))oc(Ce.children,$e);else return Ce.name&&$e.push(Ce.name),Ce.name},sc=(Ce,$e,Ke=[])=>{if(Array.isArray(Ce))for(let lt of Ce)sc(lt,$e,Ke);typeof Ce=="object"&&(Ce.hasOwnProperty("children")&&sc(Ce.children,$e,Ke),Ce.name===$e&&(Ce.hasOwnProperty("children")?oc(Ce.children,Ke):Ce.name&&Ke.push(Ce.name)))},Um=Ce=>{if(Ce in ae.current.vesselObj.current){ae.current.setCheckItems(Rt=>Rt.filter(Jt=>Jt!==Ce)),ae.current.removeVessel(Ce);let $e=new URL(window.location.href),Ke=new URLSearchParams($e.search);const lt=JSON.stringify(ae.current.checkItems.filter(Rt=>Rt!==Ce));Ke.set("vesselsChecked",lt),$e.search=Ke.toString(),window.history.replaceState({},"",$e)}},bh=Ce=>()=>{io(Ce),ke(Ce)};function Xr(Ce,$e){return[...new Set([...Ce,...$e])]}const Mn=Ce=>{const $e=[],Ke=[];if(ae.current&&_.current){const lt=ae.current,Rt=_.current;sc(lt.treeDatas,Ce,$e);const Jt=Ic.current.indexOf(Ce);if(Jt!==-1){Ic.current.splice(Jt,1),$e.forEach(sr=>{Ke.push(nn(yl,sr))});const rn=Ke.reduce((sr,Cn)=>Xr(sr,Cn),[]);let hn=A;rn.forEach(sr=>{yh(Rt.treeDatas,sr)!=null&&(hn=hn.filter(ur=>ur!==sr),Rt.removeFBX(sr,!0))}),te(hn);let pn=new URL(window.location.href),Cr=new URLSearchParams(pn.search);Cr.set("regionsChecked",JSON.stringify(hn)),pn.search=Cr.toString(),window.history.replaceState({},"",pn),Ic.current.length===0&&Rt.setExpandedKeys(Rt.defexpandedKeys.current)}else{Ic.current.push(Ce),$e.forEach(Cn=>{Ke.push(nn(yl,Cn))});const rn=Ke.reduce((Cn,ur)=>Xr(Cn,ur),[]),hn=Array.from(new Set([...Rt.expandedKeys,...rn]));Rt.setExpandedKeys(hn);let pn=[...A];rn.forEach(Cn=>{const ur=yh(Rt.treeDatas,Cn);if(ur!=null){const ar=`${n}/data/FBX/${Cn}.FBX`;pn.push(Cn),Rt.LoadFBX(ar,Cn,ur.color,.8,0)}}),te(pn);let Cr=new URL(window.location.href),sr=new URLSearchParams(Cr.search);sr.set("regionsChecked",JSON.stringify(pn)),Cr.search=sr.toString(),window.history.replaceState({},"",Cr)}}},oi=(Ce,$e)=>{for(let Ke in Ce)if(Ce[Ke].name===$e){if(Ce[Ke]["2D"])return $e;{const lt=X0($e,hr);return oi(hr,lt)}}else if(Ce[Ke].children){const lt=oi(Ce[Ke].children,$e);if(lt)return lt}return null},Dc=S.useMemo(()=>(vr==3||vr==4)&&!(X||ye)?[vr==3&&jc!=1?{key:"3",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(1),ee(!0)}},a("5000.6025")||"切换到冠状面")}:null,vr==3&&jc!=2?{key:"4",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(2),ee(!0)}},a("5000.6026")||"切换到矢状面")}:null,vr==3&&jc!=3?{key:"5",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(3),ee(!0)}},a("5000.6027")||"切换到水平面")}:null,vr==3&&jc!=4?{key:"6",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(4),ee(!0)}},a("5000.6028")||"切换到任意面")}:null,ve.brains?{key:"1",label:S.createElement("a",{target:"_blank",type:"primary",onClick:()=>{Cl(ve.brains,vr==4),ee(!0)}},a("5000.6018")||"查看更高分辨率图像")}:null,ve.brains?{key:"2",label:S.createElement("a",{target:"_blank",onClick:()=>{op(ve.brains),ee(!0)}},_.current.checkedKeys.current.includes(ve.brains)?a("5000.6023",{name:ve.brains})||`隐藏${ve.brains}的三维形貌`:a("5000.6024",{name:ve.brains})||`显示${ve.brains}的三维形貌`)}:null]:X||ye?[X?{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:()=>{km(X),ee(!0)}},_.current.checkedKeys.current.includes(X)?a("5000.5056")||"隐藏核团":a("5000.5057")||"显示核团")}:null,vr!=7&&(vt.length==0||vt.includes("neurons"))&&ye?{key:"3",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{uo(7),ee(!0),setTimeout(()=>{io(X),ke(X),V(!1),an(0)},50)}},a("5000.6015")||"查询位于或投射到该结构的神经元")}:null,ye?{key:"6",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ce=_e.current.getObjectByName(ye);if(Ce){const $e=new rs().setFromObject(Ce),Ke=new Ie;$e.getCenter(Ke),p.current.target.copy(Ke),ee(!0)}}},a("7000.7019")||"设置为焦点")}:null,ye&&vr==5?{key:"5",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ce=new rs,$e=_e.current.getObjectByName(ye);if($e){Ce.expandByObject($e.clone());let Ke=Ce.min,lt=Ce.max,Rt=new Ie;Ce.getCenter(Rt);const Jt=lt.x-Ke.x,rn=lt.y-Ke.y,hn=lt.z-Ke.z;It.current.scale.x=Jt,It.current.scale.y=rn,It.current.scale.z=hn,It.current.position.set(Rt.x,Rt.y,Rt.z);const pn=It.current.geometry.clone();pn.scale(It.current.scale.x,It.current.scale.y,It.current.scale.z),pn.translate(Rt.x,Rt.y,Rt.z);const Cr=new m4(pn);lr.current.geometry=Cr,_e.current.remove(Ir.current);const sr=a("5000.0006")||"显示数据块";if(tr===sr){_r(a("5000.0007")||"隐藏数据块"),De.current=new q_(ki.current,f==null?void 0:f.domElement),De.current.setMode("translate"),De.current.enabled=!0,De.current.visible=!0,De.current.name="transformControls",De.current.attach(It.current),_e.current.add(It.current,De.current,lr.current),mT(),document.addEventListener("keypress",iC);const Cn=new rs;Cn.expandByObject(It.current);const ur=R.current(Cn.min.clone()),ar=R.current(Cn.max.clone());let Er=new Jp(Pp(650,620,`${ur.x.toFixed(2)},${ur.y.toFixed(2)},${ur.z.toFixed(2)}`,"#ccc")),Qr=new mp(new $f({map:Er}));Qr.name="startText";let Ba=new Jp(Pp(650,620,`${ar.x.toFixed(2)},${ar.y.toFixed(2)},${ar.z.toFixed(2)}`,"#ccc")),Fi=new mp(new $f({map:Ba}));Fi.name="endText",Qr.position.set(Cn.min.x,Cn.min.y+.2,Cn.min.z),Fi.position.set(Cn.max.x,Cn.max.y+.6,Cn.max.z);const sa=_e.current.getObjectByName("startText"),fl=_e.current.getObjectByName("endText");sa&&fl&&_e.current.remove(sa,fl),_e.current.add(Ir.current,Qr,Fi)}ee(!0),Oe({})}}},a("5000.6022",{lableStr:ye})||"设置 "+ye+" 的包围盒为下载范围")}:null].filter(Ce=>Ce!==null):oe?[{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{Se.current.showSwctext(oe),ee(!0)}},oe in pe.current?a("5000.5060")||"隐藏文字":a("5000.5061")||"显示文字")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{g1(oe),ee(!0)}},a("5000.6004")||"隐藏该神经元")}]:ie?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{Mn(ie),ee(!0)}},Ic.current.includes(ie)?a("5000.0209")||"Hide Label":a("5000.0208")||"Show Label")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{Um(ie),ee(!0)}},a("5000.6021")||"隐藏该分支")}]:dt.Lable?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{if(dt.name){const Ce=_e.current.getObjectByName(dt.name);if(Ce){const $e=new rs().setFromObject(Ce),Ke=new Ie;$e.getCenter(Ke),p.current.target.copy(Ke),ee(!0)}}}},a("7000.7019")||"设置为焦点")},{key:"2",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{dt.Lable&&km(dt.Lable),ee(!0)}},_.current.checkedKeys.current.includes(dt.Lable)?a("5000.6023",{name:dt.Lable})||`隐藏${dt.Lable}的三维形貌`:a("5000.6024",{name:dt.Lable})||`显示${dt.Lable}的三维形貌`)}]:[],[X,ie,oe,ye,vr,Ns,ve,Po,dt]),Eh=Ce=>{Ce=Ce.replace(/[\[\]]/g,"\\$&");var $e=new RegExp("[?&]"+Ce+"(=([^&#]*)|&|#|$)"),Ke=$e.exec(window.location.href);return Ke?Ke[2]?decodeURIComponent(Ke[2].replace(/\+/g," ")):"":null},X0=(Ce,$e)=>{let Ke="";for(let lt in $e){const Rt=$e[lt];if(Rt.children){if(Rt.children.some(Jt=>Jt.name===Ce)){Ke=Rt.name;break}else if(X0(Ce,Rt.children)){Ke=X0(Ce,Rt.children);break}}}return Ke},uT=()=>{let Ce=new URL(window.location.href),$e=new URLSearchParams(Ce.search);const Ke=Math.ceil((performance.now()-Pc.current)/1e3)-1;Pc.current=performance.now();let lt=$e.get("type");if(lt){const Rt=window.location.origin+window.location.pathname+`?type=${lt}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Rt,time:Ke})}).then(Jt=>Jt.json()).then(Jt=>{})}},_u=(Ce,$e,Ke)=>{let lt=new URL(window.location.href),Rt=new URLSearchParams(lt.search);const Jt=Math.ceil((performance.now()-Pc.current)/1e3)-1;let rn=Rt.get(Ce);if(rn&&!Ke){Pc.current=performance.now();const pn=window.location.origin+window.location.pathname+`?${Ce}=${rn}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:pn,time:Jt})})}Rt.set(Ce,$e),lt.search=Rt.toString(),window.history.replaceState({},"",lt);const hn=window.location.origin+window.location.pathname+`?${Ce}=${$e}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:hn,time:0})})},Lg=(Ce,$e,Ke)=>{if($e)switch(parseInt(Ce)){case 0:document.title="STAM-SimpleViewer",_u("type","simple",Ke);break;case 1:document.title="STAM-NormalViewer",_u("type","normal",Ke);break;case 2:document.title="STAM-Surgery",_u("type","virtual",Ke);break;case 3:document.title="STAM-Reslicing",_u("type","slicing",Ke);break;case 4:document.title="STAM-Registration",_u("type","registration",Ke);break;case 5:document.title="STAM-Downloading",_u("type","downloading",Ke);break;case 6:document.title="STAM-AtlasMapping",_u("type","mapping",Ke);break;case 7:document.title="STAM-Connectivity",_u("type","circuits",Ke);break;case 8:document.title="STAM-OtherAtlas",_u("type","other",Ke);break;case 9:document.title="STAM-ViewSetting",_u("type","setting",Ke);break;case 10:document.title="STAM-neuronRegistration",_u("type","neuronRegistration",Ke);break;case 11:document.title="STAM-CloudChart",_u("type","cloudChart",Ke);break;case 12:document.title="STAM-FunctionalLoop",_u("type","functionalLoop",Ke);break}};S.useEffect(()=>{ve.brains&&$o(oi(hr,ve.brains))},[ve]),S.useEffect(()=>{ye&&bo(oi(hr,ye)),g(Dc),Bl.current=h},[h,X,A,ie,ye,oe,vr,we,ve,Po,dt]);const Z0=async Ce=>{Mo(Ce.url||Ce.preview),ha(!0)},dT=(Ce,$e)=>{const Ke=new FormData;Ke.append("file",Ce.file),fetch("/app-api/up-api/update",{method:"post",body:Ke}).then(lt=>lt.json()).then(lt=>{if(lt.code===200)if(fc.success("update success"),$e===2){const Rt=as.findIndex(Jt=>Jt.key===Xs[0]);if(Rt>-1){let Jt=JSON.parse(JSON.stringify($s.current)),rn=Jt[Rt];rn.fileList2=[{url:"data:image/png;base64,"+lt.base64_url}],ic(Jt),$s.current=Jt}}else{const Rt=as.findIndex(Jt=>Jt.key===Xs[0]);if(Rt>-1){let Jt=JSON.parse(JSON.stringify($s.current)),rn=Jt[Rt];rn.fileList=[{url:"data:image/png;base64,"+lt.base64_url}],rn.correspondingPlaneData={},rn.filename=lt.path,ic(Jt);const hn=_e.current.children.filter(pn=>pn.userData.name==="registrationPng");hn&&_e.current.remove(...hn),$s.current=Jt}Fn.current=lt.path}else lt.message&&Wo.error({content:lt.message})})},Fa=async(Ce,$e)=>{const Ke=Ce.type==="image/tiff"||Ce.type==="image/tif",lt=Ce.name.endsWith(".swc");let Rt,Jt;return await new Promise(hn=>{if(Ke){const pn=new FileReader;pn.readAsArrayBuffer(Ce),pn.onload=async Cr=>{var sr;if((sr=Cr.target)!=null&&sr.result){const Cn=Cr.target.result;if(Cn instanceof ArrayBuffer){const ar=await(await LCe(Cn)).getImage(),Er=ar.getWidth(),Qr=ar.getHeight();if(!$e){const Ba=as.findIndex(Fi=>Fi.key===Xs[0]);if(Ba>-1){let Fi=JSON.parse(JSON.stringify(as)),sa=Fi[Ba];sa.firstRegistrationImg={width:Er,height:Qr},ic(Fi),$s.current=Fi}}if($e===2){const Ba=as.findIndex(Fi=>Fi.key===Xs[0]);if(Ba>-1){const{firstRegistrationImg:Fi}=as[Ba];(Fi.width!==Er||Qr!==Fi.height)&&(fc.error("The size of the second TIFF image needs to be consistent with the first one!"),hn(!1))}}hn(!0)}}}}else hn(!0)}).then(hn=>hn?(vr==6?(Rt=Ke||lt,Jt="You can only upload tif or swc files!"):(Rt=Ke,Jt="You can only upload tif files!"),Rt||fc.error(Jt),Rt):!1)},v1=(Ce,$e)=>{const Ke=new FormData;Ke.append("file",Ce.file),console.log(Ce.file),Ce.file.name.split(".")[1]=="swc"?rd(!0):rd(!1),fetch("/app-api/d-api/upload",{method:"post",body:Ke}).then(lt=>lt.json()).then(lt=>{lt.code===200?(fc.success("update success"),$e===2?ro([{url:"data:image/png;base64,"+lt.base64_url}]):(zi([{url:"data:image/png;base64,"+lt.base64_url}]),Ua({}),Fn.current=lt.path)):lt.message&&Wo.error({content:a("5000.0003")||"上传失败,请联系管理员"})})},Ib=Ce=>{fetch(Ce).then($e=>$e.json()).then($e=>{let Ke=new Lo;const lt=new Kc,Rt=Ce.split("/").pop();let Jt={};const rn=[];_e.current.traverse(Cn=>{Cn.userData.isAtlasMapping==="true"&&rn.push(Cn)}),rn.forEach(Cn=>{_e.current.remove(Cn)}),$e.line.forEach((Cn,ur)=>{var ar=$e.position[Cn.end],Er=$e.position[Cn.start],Qr=new Jn(new qc(.01,32,32),new Bc({color:"#A7B5A1",transparent:!0}));Qr.position.set(ar.x*.01,ar.y*.01,ar.z*.01);var Ba=new Jn(new qc(.01,32,32),new Bc({color:"#00ffff",transparent:!0}));Ba.position.set(Er.x*.01,Er.y*.01,Er.z*.01),Qr.translateX(eo.current),Qr.translateY(Ya.current),Qr.translateZ(ja.current),Ba.translateX(eo.current),Ba.translateY(Ya.current),Ba.translateZ(ja.current),Qr.myMeshType="neuronSphere",Qr.name=`${Rt}/${Cn.end_name}`,Qr.userData.color="#A7B5A1",Ba.myMeshType="neuronSphere",Ba.name=`${Rt}/${Cn.start_name}`,Ba.userData.color="#00ffff",lt.add(Qr),lt.add(Ba),Cn.start_name&&(Jt.hasOwnProperty(Cn.start_name)?Jt[`${Cn.start_name}`].push({name:Rt,point:[Er.x,Er.y,Er.z],color:"#00ffff"}):(Jt[`${Cn.start_name}`]=[],Jt[`${Cn.start_name}`].push({name:Rt,point:[Er.x,Er.y,Er.z],color:ur===0?"#1771FF":"#00ffff"}))),Cn.end_name&&(Jt.hasOwnProperty(Cn.end_name)?Jt[`${Cn.end_name}`].push({name:Rt,point:[ar.x,ar.y,ar.z],color:"#A7B5A1"}):(Jt[`${Cn.end_name}`]=[],Jt[`${Cn.end_name}`].push({name:Rt,point:[ar.x,ar.y,ar.z],color:"#A7B5A1"})))});let hn=new Jn(new qc(.02,32,32),new Bc({color:"#1771FF",transparent:!0}));hn.position.set($e.position[0].x*.01,$e.position[0].y*.01,$e.position[0].z*.01),hn.translateX(eo.current),hn.translateY(Ya.current),hn.translateZ(ja.current),lt.add(hn),lt.name=`swcPointGroup${Rt}`,lt.userData.isAtlasMapping="true";const pn={};for(const Cn in Jt){const ur=Jt[Cn];for(const ar of ur)if(ar.name==Rt){if(ar.color==="#1771FF"){pn[Cn]={point:ar.point,color:ar.color};break}if(ar.color==="#A7B5A1"){pn[Cn]={point:ar.point,color:ar.color};break}pn[Cn]={point:ar.point,color:ar.color}}}for(let Cn in pn){const{point:ur,color:ar}=pn[Cn];var Cr=new Jp(Pp(400,300,Cn.replace("_","/"),ar));let Er=new mp(new $f({map:Cr,transparent:!0,alphaTest:.5}));Er.scale.set(.5,.5,.5),Er.position.set(ur[0]*.01,ur[1]*.01,ur[2]*.01),Er.translateX(eo.current),Er.name="lineNameMesh",Er.userData.name=Cn.replace("_","/"),Er.userData.wholeName=`${Rt}-${Cn}`,Er.userData.isAtlasMapping="true",Er.userData.initColor=ar,Er.translateY(Ya.current),Er.translateZ(ja.current),_e.current.add(Er)}_e.current.add(lt);for(let Cn=0;Cn<$e.line.length;Cn++){let ur=[];for(let Er=$e.line[Cn].start;Er<=$e.line[Cn].end;Er++){let Qr=$e.position[Er].x,Ba=$e.position[Er].y,Fi=$e.position[Er].z;ur.push(new Ie(Qr,Ba,Fi))}let ar=new Ea(new Di().setFromPoints(ur),new Jc({color:"green"}));Ke.add(ar),mi(!1)}Ke.scale.set(Hi.current,Hi.current,Hi.current),Ke.translateX(eo.current),Ke.translateY(Ya.current),Ke.translateZ(ja.current),Ke.name="correspondingPlaneDataSwc";const sr=_e.current.getObjectByName("correspondingPlaneDataSwc");sr&&_e.current.remove(sr),_e.current.add(Ke)})},dl=()=>{const Ce=_e.current.getObjectByName("Brain");if(Ce)if(mi(Ke=>!Ke),Dr.file[1].indexOf(".js")>-1)Ib("/app-api/d-api/dowload/"+Dr.file[1]);else{var $e=new vo;$e.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const Ke=(Ce==null?void 0:Ce.children[0]).geometry.boundingBox.min,lt=(Ce==null?void 0:Ce.children[0]).geometry.boundingBox.max,Rt={bwidth:0,bheight:2.6,bdepth:0,ewidth:lt.x-Ke.x,eheight:lt.y-Ke.y,edepth:lt.z-Ke.z,owidth:lt.x-Ke.x,oheight:lt.y-Ke.y,odepth:lt.z-Ke.z};let Jt=new Ie(.005238113403320366,-1.6508567881694614,6133353495929583e-20),rn=new Ie(-5.097530670166015,-4.308416134996751,-7.990437196406743),hn=new Ie(5.118084411621094,3.006702558657828,6.001559863476661);const pn=new rs;pn.expandByObject(Ce.clone()),rn=pn.min,hn=pn.max,Jt=pn.getCenter(Jt);const Cr=hn.x-rn.x,sr=hn.y-rn.y,Cn=hn.z-rn.z;It.current.scale.set(Cr,sr,Cn),It.current.position.set(Jt.x,Jt.y,Jt.z),wn.current.length===0?fetch("/app-api/d-api/dowload/"+Dr.file[1]).then(ur=>ur.arrayBuffer()).then(ur=>{const ar=new Uint8Array(ur);let Er=hH(ar),Qr=ACe(ar);wn.current=Er,y1(Er,Rt,Qr)}):setTimeout(()=>{y1(wn.current,Rt,wn.current.length)},200)}},bs=Ce=>{const $e=as.findIndex(Ke=>Ke.key===Xs[0]);if($e>-1){let Ke=JSON.parse(JSON.stringify(as)),lt=Ke[$e];lt.registrationRadioShowType=Ce.target.value,ic(Ke),$s.current=Ke,_e.current.getObjectByName(`png${$e}`)&&fT(Ce.target.value)}},Fm=Ce=>{if(mi(!0),ui(Ce.target.value),qa.otherAtlases=Ce.target.value,_e.current){const $e=_e.current.getObjectByName("outline");$e&&_e.current.remove($e)}Ce.target.value=="CCF"&&py({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En),Ce.target.value=="WHS"&&py({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En),mi(!1)},M8=Ce=>{if(an(Ce.target.value),Ce.target.value===2){G.current="automatic",P(!0),U.current=!0,W(2),m.current.length>=2&&(m.current.pop(),b.current.pop());const $e=_e.current.getObjectByName("dashedLine"),Ke=_e.current.getObjectByName("sphereBig"),lt=_e.current.getObjectByName("sphereMiddelClick"),Rt=_e.current.getObjectByName("Line");$e&&Ke&&_e.current.remove($e,Ke),lt&&_e.current.remove(lt),Rt&&_e.current.remove(Rt),nC()}else G.current="manual",P(!1),U.current=!1,W(3),nC();d&&(d.current=!0),pt(a("4000.0126")||"重置")},eU=Ce=>{if(Ce>-1){let $e=JSON.parse(JSON.stringify($s.current)),Ke=$e[Ce];Ke.startButtonLoading=!0,Ke.correspondingPlaneData={},ic($e),$s.current=$e;const lt=new FormData;lt.append("file",Ke.filename),lt.append("typeName",Ke.radioValue.toString()),fetch("/app-api/up-api/calculate",{method:"post",body:lt}).then(Rt=>{if(Rt.ok)return Rt.json();throw Wo.error({content:a("5000.7027")||"计算失败"}),new Error(Rt.statusText)}).then(Rt=>{const Jt=Rt;let rn=JSON.parse(JSON.stringify($s.current));const hn=rn[Ce];hn.correspondingPlaneData=Jt,hn.startButtonLoading=!1,$s.current=rn,ic(rn)})}},tC=()=>{const Ce=as.findIndex($e=>$e.key===Xs[0]);if(Ce>-1){let $e=as[Ce];const Ke=document.createElement("a");Ke.href="/app-api/up-api/zip/"+$e.correspondingPlaneData.url,Ke.download=$e.correspondingPlaneData.url,Ke.click()}},fT=Ce=>{const $e=as.findIndex(sr=>sr.key===Xs[0]);if($e>-1){const sr=_e.current.getObjectByName(`png${$e}`);sr&&_e.current.remove(sr)}var Ke=_e.current.getObjectByName("Brain");if(Ke&&$e>-1){let sr=as[$e];const{correspondingPlaneData:Cn,registrationRadioShowType:ur,fileList:ar,fileList2:Er}=sr;var lt=new rs().setFromObject(Ke),Rt=lt.max.y-lt.min.y,Jt=lt.max.x-lt.min.x;Rt=Rt/Math.cos(Cn.angles[0]*Math.PI/180),Jt=Jt/Math.cos(Cn.angles[1]*Math.PI/180);var rn=new V6(Jt,Rt,1,1),hn=new Bc({side:Ed,transparent:!0,alphaTest:.1}),pn=new Jn(rn,hn);pn.name=`png${$e}`;let Qr=ur;Ce&&(Qr=Ce),pn.userData.imgType=Qr,pn.userData.name="registrationPng",_e.current.add(pn);var Cr=new fS;pn.position.set(lt.min.x+(lt.max.x-lt.min.x)/2,lt.min.y+(lt.max.y-lt.min.y)/2,(lt.max.z-lt.min.z)*Cn.tx+lt.min.z),Cr.load(Qr==="3"?Er[0].url:Qr==="1"?Cn.base64_url:ar[0].url,function(Ba){hn.map=Ba,hn.needsUpdate=!0}),pn.rotateOnAxis(new Ie(0,0,1),Math.PI),pn.rotateOnAxis(new Ie(1,0,0),Math.PI/180*-Cn.angles[0]),pn.rotateOnAxis(new Ie(0,1,0),Math.PI/180*Cn.angles[2]),pn.rotateOnAxis(new Ie(0,0,1),Math.PI/180*Cn.angles[1]),Ce!="1"&&(Hc.current?pn.scale.x=1:pn.scale.x=-1)}},Ab=()=>{const Ce=new zs(1,1,1),$e=new Bc({color:16777215,opacity:.1,transparent:!0,depthWrite:!1}),Ke=new Jn(Ce,$e);_e.current.remove(It.current,lr.current,Ir.current),It.current=Ke.clone(),Ir.current=new Jn;const lt=new m4(Ce),Rt=new Jc({color:16536881}),Jt=new hI(lt,Rt);lr.current=Jt},tU=()=>{const Ce=a("5000.0006")||"显示数据块";if(tr===Ce){_r(a("5000.0007")||"隐藏数据块"),De.current=new q_(ki.current,f==null?void 0:f.domElement),De.current.setMode("translate"),De.current.enabled=!0,De.current.visible=!0,De.current.name="transformControls",De.current.attach(It.current),_e.current.add(It.current,De.current,lr.current),mT(),document.addEventListener("keypress",iC);const $e=new rs;$e.expandByObject(It.current);const Ke=R.current($e.min.clone()),lt=R.current($e.max.clone());let Rt=new Jp(Pp(650,620,`${Ke.x.toFixed(2)},${Ke.y.toFixed(2)},${Ke.z.toFixed(2)}`,"#ccc")),Jt=new mp(new $f({map:Rt}));Jt.name="startText";let rn=new Jp(Pp(650,620,`${lt.x.toFixed(2)},${lt.y.toFixed(2)},${lt.z.toFixed(2)}`,"#ccc")),hn=new mp(new $f({map:rn}));hn.name="endText",Jt.position.set($e.min.x,$e.min.y+.2,$e.min.z),hn.position.set($e.max.x,$e.max.y+.6,$e.max.z);const pn=_e.current.getObjectByName("startText"),Cr=_e.current.getObjectByName("endText");pn&&Cr&&_e.current.remove(pn,Cr),_e.current.add(Ir.current,Jt,hn)}else{document.removeEventListener("keypress",iC),_r(a("5000.0006")||"显示数据块"),De.current.enabled=!1,De.current.visible=!1,De.current.detach();const $e=_e.current.getObjectByName("startText"),Ke=_e.current.getObjectByName("endText");$e&&Ke&&_e.current.remove($e,Ke),_e.current.remove(De.current),_e.current.remove(It.current,lr.current,Ir.current)}},Pp=(Ce,$e,Ke,lt)=>{var Rt=document.createElement("canvas");Rt.width=Ce,Rt.height=$e,Rt.style.border="1px solid #000";let Jt=Rt.getContext("2d");return Jt.font="80px Arial",Jt.fillStyle=lt,Jt.fillText(Ke,40,80),Rt},y1=(Ce,$e,Ke)=>{const lt=Ce[0].width/$e.owidth,Rt=Ce[0].height/$e.oheight,Jt=Ke/$e.odepth,rn=Math.ceil($e.bwidth*lt),hn=Math.ceil($e.bheight*Rt),pn=Math.ceil($e.bdepth*Jt),Cr=Math.floor($e.ewidth*lt),sr=Math.floor($e.eheight*Rt),Cn=Math.floor($e.edepth*Jt),ur=Cr-rn,ar=sr-hn,Er=new vPe(null,ur,ar,Cn-pn);Er.format=oPe,Er.minFilter=pf,Er.magFilter=pf,Er.unpackAlignment=1,Er.needsUpdate=!0;const Qr=f.getContext();f.initTexture(Er);const Ba=f.properties.get(Er).__webglTexture;Qr.bindBuffer(Qr.PIXEL_UNPACK_BUFFER,null),Qr.bindTexture(Qr.TEXTURE_3D,Ba);for(let sa=0;sa<Ce.length;sa++){let fl=[];if(sa>=pn&&sa<Cn){for(let $a=0;$a<Ce[sa].data.length;$a++){let Xa=$a%Ce[sa].width,Es=$a/Ce[sa].width;rn<=Xa&&Xa<Cr&&Es>=hn&&Es<sr&&fl.push(Ce[sa].data[$a])}const Jo=new Uint8Array(fl);Qr.bindTexture(Qr.TEXTURE_3D,Ba),Qr.bindBuffer(Qr.PIXEL_UNPACK_BUFFER,null),Qr.bindBuffer(Qr.ARRAY_BUFFER,null),Qr.texSubImage3D(Qr.TEXTURE_3D,0,0,0,sa-pn,ur,ar,1,Qr.RED,Qr.UNSIGNED_BYTE,Jo)}}Kn.current=Er,C.current=new A0({glslVersion:cg,uniforms:{map:{value:Kn.current},cameraPos:{value:ki.current.position},volume_dims:{value:new Ie(ur,ar,Ke)},canvas_dims:{value:new Sr(f.domElement.width,f.domElement.height)},isClicked:{value:0},steps:{value:Ke},brightness:{value:ul.current.brightness},darkness:{value:ul.current.darkness},opacity:{value:ul.current.opacity},opacity2:{value:ul.current.opacity2},lowcolor:{value:new Ie(ul.current.color.r/255,ul.current.color.g/255,ul.current.color.b/255)},highcolor:{value:new Ie(ul.current.color2.r/255,ul.current.color2.g/255,ul.current.color2.b/255)}},side:Xf,vertexShader:xxn,fragmentShader:_xn}),_e.current.remove(Ir.current);const Fi=new zs(1,1,1);Ir.current=new Jn(Fi,C.current),Ir.current.applyMatrix4(It.current.matrixWorld),Ir.current.scale.set(It.current.scale.x,It.current.scale.y,It.current.scale.z),Ir.current.position.set(It.current.position.x,It.current.position.y,It.current.position.z),_e.current.add(Ir.current),mi(sa=>!sa)},nC=()=>{const Ce=[];_e.current.traverse($e=>{$e.name==="lineName"&&Ce.push($e)}),Ce.forEach($e=>{_e.current.remove($e)})},pT=()=>{const Ce=new rs;Ce.expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if($e){mi(pn=>!pn);var Ke=new vo;Ke.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const lt=($e==null?void 0:$e.children[0]).geometry.boundingBox.min,Rt=($e==null?void 0:$e.children[0]).geometry.boundingBox.max,Jt=Ce.min.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),rn=Ce.max.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),hn={bwidth:Jt.x-lt.x,bheight:Jt.y-lt.y,bdepth:Jt.z-lt.z,ewidth:rn.x-lt.x,eheight:rn.y-lt.y,edepth:rn.z-lt.z,owidth:Rt.x-lt.x,oheight:Rt.y-lt.y,odepth:Rt.z-lt.z};wn.current.length===0?fetch(n+"/data/TIFF/1-0.5_0.tif").then(pn=>pn.arrayBuffer()).then(pn=>{const Cr=new Uint8Array(pn);let sr=hH(Cr),Cn=ACe(Cr);wn.current=sr,y1(sr,hn,Cn)}):setTimeout(()=>{y1(wn.current,hn,wn.current.length)},200)}},P8=Ce=>{fetch(Ce).then($e=>$e.text()).then($e=>{const Ke=[0,0,0,0,0,0];let lt=new Kan($e,Ce||"",Ke,void 0,void 0,3,Ke);const Rt=new LD({color:65280,side:Ed});let Jt=new Lo;for(let rn=0;rn<lt.branches.length;rn++){let hn=lt.branches[rn],pn=[];for(let Cn=hn.start;Cn<hn.start+hn.count;Cn++){let ur=lt.indices[Cn],ar=lt.points[3*ur],Er=lt.points[3*ur+1],Qr=lt.points[3*ur+2];pn.push(new Ie(ar,Er,Qr))}const Cr=new Di().setFromPoints(pn);let sr=new Ea(Cr,Rt);Jt.add(sr)}Jt.scale.set(Hi.current,Hi.current,Hi.current),Jt.position.set(eo.current,Ya.current,ja.current),Jt.name="swcUrlDataLine",_e.current.add(Jt)})},Dp=()=>{new rs().expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if(!k5e||!zZ)return;const Ke=JSON.parse(k5e);if($e){mi(Cr=>!Cr);const lt=Ke.min,Rt=Ke.max,Jt=Ke.max_resample,rn={bwidth:lt.x,bheight:lt.y,bdepth:lt.z,ewidth:Jt.x,eheight:Jt.y,edepth:Jt.z,owidth:Jt.x-lt.x,oheight:Jt.y-lt.y,odepth:Jt.z-lt.z},hn={x:(Rt.x-lt.x)*Hi.current,y:(Rt.y-lt.y)*Hi.current,z:(Rt.z-lt.z)*Hi.current},pn={x:((Rt.x-lt.x)/2+lt.x)*Hi.current+eo.current,y:((Rt.y-lt.y)/2+lt.y)*Hi.current+Ya.current,z:((Rt.z-lt.z)/2+lt.z)*Hi.current+ja.current};It.current.scale.set(hn.x,hn.y,hn.z),It.current.position.set(pn.x,pn.y,pn.z),wn.current.length===0?fetch(zZ).then(Cr=>Cr.arrayBuffer()).then(async Cr=>{try{const sr=await LCe(Cr),Cn=await sr.getImageCount(),ur=[];for(let Er=0;Er<Cn;Er++){const Qr=await sr.getImage(Er),Ba=await Qr.readRasters(),Fi=Qr.getWidth(),sa=Qr.getHeight();ur.push({width:Fi,height:sa,data:Ba[0]})}let ar=Cn;wn.current=ur,y1(wn.current,rn,ar)}catch(sr){console.log("e",sr)}}):setTimeout(()=>{y1(wn.current,rn,wn.current.length)},200)}else setTimeout(()=>{Dp()},1e3)};S.useEffect(()=>{Qa?Gc.current&&Gc.current.focus():gc.current&&gc.current.focus()},[Qa]);const rC=Ce=>Ce.map($e=>({value:$e.name+" "+$e.fullname,title:S.createElement(ji,{placement:"right",title:$e.fullname},S.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},$e.name," ",$e.fullname)),children:$e.children?rC($e.children):void 0})),D8=S.useMemo(()=>{const Ce=new rs;Ce.expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if($e){var Ke=new vo;Ke.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const lt=($e==null?void 0:$e.children[0]).geometry.boundingBox.min,Rt=Ce.min.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),Jt=Ce.max.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),rn={bwidth:Rt.x-lt.x,bheight:Rt.y-lt.y,bdepth:Rt.z-lt.z,ewidth:Jt.x-lt.x,eheight:Jt.y-lt.y,edepth:Jt.z-lt.z};Va.current=rn;const hn=(rn.ewidth-rn.bwidth)*11.1545988258317*(rn.eheight-rn.bheight)*12.31190150478796*(rn.edepth-rn.bdepth)*10;let pn=0;switch(wi){case 1:pn=hn*.8;break;case 2:pn=hn*.8/8;break;case 3:pn=hn*.8/8/8;break;case 4:pn=hn*.8/8/8/8;break;case 5:pn=hn*.8/8/8/8/8;break;case 6:pn=hn*.8/8/8/8/8/8;break}return tr===(a("5000.0006")||"显示数据块")?"0KB":pn>1024*1024*1024*1024?(pn/(1024*1024*1024*1024)).toFixed(2)+"TB":pn>1024*1024*1024?(pn/(1024*1024*1024)).toFixed(2)+"GB":pn>1024*1024&&pn<1024*1024*1024?(pn/(1024*1024)).toFixed(2)+"MB":pn>1024&&pn<1024*1024?(pn/1024).toFixed(2)+"KB":pn&&pn<1024?pn.toFixed(2)+"B":"0KB"}else return"0KB"},[ut,tr]),hT=()=>{if(!xs.current){js(!0);return}const Ce=new rs;Ce.expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if($e){var Ke=new vo;Ke.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const lt=($e==null?void 0:$e.children[0]).geometry.boundingBox.min,Rt=($e==null?void 0:$e.children[0]).geometry.boundingBox.max,Jt=Ce.min.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),rn=Ce.max.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),hn={bwidth:Jt.x-lt.x,bheight:Jt.y-lt.y,bdepth:Jt.z-lt.z,ewidth:rn.x-lt.x,eheight:rn.y-lt.y,edepth:rn.z-lt.z,owidth:Rt.x-lt.x,oheight:Rt.y-lt.y,odepth:Rt.z-lt.z,zoom:!1,level:wi};Va.current=hn;const pn=(hn.ewidth-hn.bwidth)*11.1545988258317*(hn.eheight-hn.bheight)*12.31190150478796*(hn.edepth-hn.bdepth)*10;switch(wi){case 1:if(pn*.8>1024*1024*1024){sn(!0);return}break;case 2:if(pn*.8/8>1024*1024*1024){sn(!0);return}break;case 3:if(pn*.8/8/8>1024*1024*1024){sn(!0);return}break;case 4:if(pn*.8/8/8/8>1024*1024*1024){sn(!0);return}break;case 5:if(pn*.8/8/8/8/8>1024*1024*1024){sn(!0);return}break;case 6:if(pn*.8/8/8/8/8/8>1024*1024*1024){sn(!0);return}break}ti(!0),fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(hn)}).then(Cr=>Cr.json()).then(Cr=>{gT(Cr)})}},gT=Ce=>{fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Ce})}).then($e=>{const Ke=$e.headers.get("content-type");return Ke?Ke.includes("application/json")?$e.json():Ke.includes("application/octet-stream")?$e.arrayBuffer():(Ke.includes("text/html")||Ke.includes("text/plain")||Ke.includes("application/xml")||Ke.includes("text/xml"),$e.text()):$e.text()}).then($e=>{if(typeof $e=="string")setTimeout(()=>{gT(Ce)},2e3);else{const Ke=document.createElement("a"),lt=new Blob([$e]),Rt=window.URL.createObjectURL(lt);Ke.style.display="none",Ke.href=Rt,Ke.download="temp.tiff",Ke.click(),window.URL.revokeObjectURL(Rt),ti(!1);let Jt=new URL(window.location.href),hn=new URLSearchParams(Jt.search).get("type");const pn=window.location.origin+window.location.pathname+`?type=${hn}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:pn,time:0,key:ua.current})}).then(Cr=>Cr.json()).then(Cr=>{})}}).catch($e=>{ti(!1),Wo.error({title:a("5000.7026")||"请求超时,下载失败"})})},iC=S.useCallback(Ce=>{Ce.stopPropagation(),(Ce.key==="a"||Ce.key==="A")&&(De.current.getMode()==="translate"?De.current.setMode("scale"):De.current.setMode("translate"))},[]),mT=()=>{let $e=_e.current.getObjectByName("Brain"),Ke=new Ie(-5.097530670166015,-5.308416134996751,-7.990437196406743),lt=new Ie(5.118084411621094,2.006702558657828,6.001559863476661);if($e){const hn=new rs;hn.expandByObject($e.clone()),Ke=hn.min,lt=hn.max}const Rt=lt.x-Ke.x,Jt=lt.y-Ke.y,rn=lt.z-Ke.z;De.current.addEventListener("change",()=>{const hn=It.current.scale,pn=It.current.position;hn.x<1&&It.current.scale.setX(1),hn.x>Rt&&It.current.scale.setX(Rt),hn.y<1&&It.current.scale.setY(1),hn.y>Jt&&It.current.scale.setY(Jt),hn.z<1&&It.current.scale.setZ(1),hn.z>rn&&It.current.scale.setZ(rn),pn.x<Ke.x+It.current.scale.x/2&&It.current.position.setX(Ke.x+It.current.scale.x/2),pn.x>lt.x-It.current.scale.x/2&&It.current.position.setX(lt.x-It.current.scale.x/2),pn.y<Ke.y+It.current.scale.y/2&&It.current.position.setY(Ke.y+It.current.scale.y/2),pn.y>lt.y-It.current.scale.y/2&&It.current.position.setY(lt.y-It.current.scale.y/2),pn.z<Ke.z+It.current.scale.z/2&&It.current.position.setZ(Ke.z+It.current.scale.z/2),pn.z>lt.z-It.current.scale.z/2&&It.current.position.setZ(lt.z-It.current.scale.z/2);const Cr=It.current.geometry.clone();Cr.scale(It.current.scale.x,It.current.scale.y,It.current.scale.z),Cr.translate(It.current.position.x,It.current.position.y,It.current.position.z);const sr=new m4(Cr);lr.current.geometry=sr,Oe({})}),De.current.addEventListener("dragging-changed",function(hn){hn.value?(p.current.enableRotate=!1,p.current.enabled=!1,Rc.current={target:p.current.target.clone(),position:p.current.object.position.clone(),up:p.current.object.up.clone(),enabled:p.current.enabled}):(p.current.enableRotate=!0,p.current.enabled=!0,p.current.reset(),p.current.target.copy(Rc.current.target),p.current.object.position.copy(Rc.current.position),p.current.object.up.copy(Rc.current.up),p.current.update());const pn=It.current.geometry.clone();pn.scale(It.current.scale.x,It.current.scale.y,It.current.scale.z),pn.translate(It.current.position.x,It.current.position.y,It.current.position.z);const Cr=new m4(pn);lr.current.geometry=Cr;const sr=new rs;sr.expandByObject(It.current);const Cn=R.current(sr.min.clone()),ur=R.current(sr.max.clone());let ar=new Jp(Pp(650,620,`${Cn.x.toFixed(2)},${Cn.y.toFixed(2)},${Cn.z.toFixed(2)}`,"#ccc")),Er=new mp(new $f({map:ar}));Er.name="startText";let Qr=new Jp(Pp(650,620,`${ur.x.toFixed(2)},${ur.y.toFixed(2)},${ur.z.toFixed(2)}`,"#ccc")),Ba=new mp(new $f({map:Qr}));Ba.name="endText",Er.position.set(sr.min.x,sr.min.y+.2,sr.min.z),Ba.position.set(sr.max.x,sr.max.y+.6,sr.max.z);const Fi=_e.current.getObjectByName("startText"),sa=_e.current.getObjectByName("endText");Fi&&sa&&_e.current.remove(Fi,sa),_e.current.add(Ir.current,Er,Ba)})},k8=()=>{document.removeEventListener("keypress",iC),_r(a("5000.0006")||"显示数据块"),De.current.enabled=!1,De.current.visible=!1,De.current.detach(),_e.current.remove(De.current),_e.current.remove(It.current,lr.current,Ir.current);const Ce=_e.current.getObjectByName("dashedLine");Ce&&_e.current.remove(Ce);const $e=_e.current.getObjectByName("startText"),Ke=_e.current.getObjectByName("endText");$e&&Ke&&_e.current.remove($e,Ke)},Ng=Ce=>{xi(Ce.target.value)},vT=S.useCallback(Ce=>{Io.current=!0,bi.current=[Ce.x,Ce.y],di.current=[Ce.x,Ce.y]},[]),Ha=S.useCallback(Ce=>{if(Io.current){const $e=[Ce.x,Ce.y],Ke=.005,lt=$e[0]-bi.current[0];$e[1]-bi.current[1];const Rt=lt*Ke,Jt=new Ie;Jt.copy(ki.current.position).sub(p.current.target);const rn=new p9t().setFromVector3(Jt);rn.theta+=Rt,rn.makeSafe(),Jt.setFromSpherical(rn),ki.current.position.copy(p.current.target).add(Jt),ki.current.lookAt(p.current.target),bi.current=[Ce.x,Ce.y]}},[]),Rb=S.useCallback(Ce=>{Io.current=!1;const $e=[Ce.x,Ce.y],Ke=Math.abs($e[0]-di.current[0]),lt=Math.abs($e[1]-di.current[1]);Ke<2&&lt<2?f.domElement.addEventListener("click",Z.current):f.domElement.removeEventListener("click",Z.current)},[]),Ob=()=>{if(!localStorage.getItem("imgKey")){Bo(!0);return}cn(!0),st(!1),Ua({});let Ce={taskType:ls,moving_name:Fn.current,key:localStorage.getItem("imgKey"),swc_space:Ja,resolution:Wc};fetch("/app-api/d-api/count",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ce)}).then($e=>$e.ok?$e.json():(cn(!1),$e.json().then(Ke=>{throw st(!0),$e.status===401&&Wo.confirm({content:Ke.message,onOk(){fetch("/app-api/d-api/update_key",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:localStorage.getItem("imgKey")})}).then(lt=>lt.json())},onCancel(){}}),$e.status===429?Wo.error({content:a("5000.7029")||"请求过于频繁,请稍后再试"}):Wo.error({content:a("5000.7027")||"计算失败"}),new Error(Ke.message||$e.statusText)}))).then($e=>{$e.code===200&&Ua($e),cn(!1)}).catch($e=>{cn(!1),console.error($e)}).finally(()=>{cn(!1)})},Lb=()=>{const Ce=document.createElement("a");Dr.file[0].split(".")[1]=="swc"?Ce.href="/app-api/d-api/dowload/"+Dr.file[0].split(".")[0]+"_ori.swc":Ce.href="/app-api/d-api/dowload/"+Dr.file[0],Ce.download=Dr.file[0],Ce.click()},b1=Ce=>{B&&B(Ce),qa.datumMarkVisibility=Ce},E1=Ce=>{Oc(Ce),qa.coordinateVisibility=Ce,Ce?z&&z.current.forEach($e=>{$e.visible=!0}):z&&z.current.forEach($e=>{$e.visible=!1})},od=()=>{Fl(!1)},U8=()=>{Fl(!1)},aC=Ce=>{if(Bs(Ce),qa.leftHemisphereVisibility=Ce,Ce){for(let $e in Ma.current)Ma.current[$e]&&A.includes($e)&&_e.current.add(Ma.current[$e]);dg.current=!0}else{for(let $e in Ma.current)Ma.current[$e]&&_e.current.remove(Ma.current[$e]);dg.current=!1}},ga=Ce=>{if(qa.cranialVisibility=Ce,Lc({}),Ce)py({filepath:n+"/data/FBX/ExtractedSurface.FBX",index:"ExtractedSurface",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En);else if(_e.current){const $e=_e.current.getObjectByName("ExtractedSurface");$e&&_e.current.remove($e)}},ws=()=>{if(Ur(!0),mi(!0),D){const Ce={flag:dg.current,point:[D.current.x,D.current.y,D.current.z],fbx:H.current};fetch("/app-api/c-api/compute",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ce)}).then($e=>{if($e.ok)return $e.json();throw Ur(!1),mi(!1),Wo.error({content:a("5000.7028")||"没有合适的路径"}),new Error($e.statusText)}).then($e=>{Ur(!1),mi(!1),$e.code===200&&N?N(new Ie($e.point[0],$e.point[1],$e.point[2])):Wo.error({content:a("5000.7027")||"计算失败"})})}},yc=Ce=>{Ce!=null&&(io(Ce),(Ce===""||Ce.includes(" "))&&ke(Ce))},oC=(Ce,$e)=>{let Ke=0;for(const lt of Ce.toLowerCase())if(lt===$e[Ke]&&(Ke++,Ke===$e.length))return!0;return!1},F8=Ce=>{if(Ce){const $e=Ce.toLowerCase(),Ke=Se.current.defAllexpandedKeys.current.map(lt=>{const Rt=lt.name&&lt.name.toLowerCase()===$e,Jt=lt.fullname&&oC(lt.fullname,$e);return{...lt,matchPriority:Rt?1:Jt?2:3}}).filter(lt=>lt.matchPriority<3).sort((lt,Rt)=>lt.matchPriority-Rt.matchPriority).map(lt=>({value:`${lt.name} ${lt.fullname}`,label:`${lt.name} ${lt.fullname}`}));Fs(Ke)}else Fs([])},yT=Ce=>{const $e=new URLSearchParams;for(const Ke in Ce)$e.append(Ke,Ce[Ke]);vr==3||vr==5?$e.append("aplType","2"):$e.append("aplType","1"),fetch("/app-api/java-api/brainsweb-service/apldetail/add",{method:"post",body:$e}).then(Ke=>{if(Ke.ok)return Ke.json();throw Wo.error({content:a("5000.5047")||"提交失败"}),new Error(Ke.statusText)}).then(Ke=>{Ke.code==1?fc.error("Repeat Email"):fc.success(a("5000.5048")||"提交成功"),Bo(!1),lo(0)})},bT=Ce=>{console.log("Failed:",Ce)},Si=async Ce=>{let $e="";Ce==="DAPI"?$e="/staticresource/data/TIFF/image_356_t.tif":Ce==="PI"&&($e="/staticresource/data/TIFF/image_570_t.tif");try{const Ke=$e.split("/").pop()||"",Rt=await(await fetch($e)).blob(),Jt=new File([Rt],Ke,{type:"image/tiff"}),rn=as.findIndex(Cn=>Cn.key===Xs[0]);let pn=await new Promise(Cn=>{const ur=new FileReader;ur.readAsArrayBuffer(Rt),ur.onload=function(ar){var Er,Qr;if((Er=ar.target)!=null&&Er.result){const Ba=new Uint8Array((Qr=ar.target)==null?void 0:Qr.result);let Fi=hH(Ba);const{width:sa,height:fl}=Fi[0];Cn({width:sa,height:fl})}},ur.onerror=function(ar){console.error("failed")}});const{width:Cr,height:sr}=pn;if(rn>-1){let Cn=JSON.parse(JSON.stringify(as)),ur=Cn[rn];ur.fileList=[Jt],ur.firstRegistrationImg={width:Cr,height:sr},ic(Cn),$s.current=Cn}dT({file:Jt})}catch(Ke){console.error("Error fetching file:",Ke)}},Ao=async Ce=>{let $e="",Ke="";Ce==="3D"?($e="/staticresource/data/TIFF/test.tif",Ke="image/tiff"):Ce==="swc"&&($e="/staticresource/data/TIFF/fixed.swc",Ke="file/swc");try{const Rt=await(await fetch($e)).blob();let Jt=$e.split("/").pop();if(Jt){const rn=new File([Rt],Jt,{type:Ke});zi([rn]),v1({file:rn})}}catch(lt){console.error("Error fetching file:",lt)}};return S.createElement(S.Fragment,null,S.createElement("div",{className:"outBox",style:{right:`${Hr?"430px":"150px"}`},onClick:()=>{const Ce=document.querySelector(".tabsCompnent>.ant-tabs-content-holder");Ce&&Hr?(Ce.style.padding="0px",Ce.style.borderLeft="none"):(vr!=12&&(Ce.style.padding="10px"),Ce.style.borderLeft="1px solid rgb(225, 218, 218)"),Jr($e=>!$e)}},S.createElement("div",{className:"contractrightbox"},S.createElement("div",{className:"smallTriangle",style:{transform:`${Hr?"rotate(180deg)":"rotate(0)"}`}}))),S.createElement(lg,{className:"tabsCompnent",onChange:uo,activeKey:vr.toString(),style:{position:"absolute",right:0,bottom:0,width:`${Hr?"430px":"150px"}`,height:vt.length!=10?"100%":"calc(100% - 42px)",userSelect:"none",borderTop:"1px solid rgb(225, 218, 218)"},tabPosition:"right",tabBarStyle:{width:150,background:"#fff",borderLeft:"1px solid #e1dada"}},vt.includes("label")&&S.createElement(zg,{tab:a("4000.0202")||"组装",key:"1",disabled:Y===2},Hr?S.createElement(S.Fragment,null,S.createElement("div",{style:{width:"200px",height:"100px"}},S.createElement(ts,{ref:it},S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:10},a("4000.0205")||"长度",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:1,max:10,onChange:Ms}))))):null),vt.includes("virtual")&&S.createElement(zg,{tab:a("4000.0203")||"病毒标记",key:"2",disabled:Y===1||Y===0},S.createElement("div",{style:{backgroundColor:"rgba(255,255,255,0.6)",borderRadius:"5px",marginTop:"5px",display:Hr?"block":"none"}},S.createElement("div",null,S.createElement(Na,{disabled:!(A.length>0),className:"ant-btn ant-btn-primary",onClick:Rd},ot),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),a("5000.7046")||"路径规划模式",": ",S.createElement(La.Group,{style:{display:`${j?"block":"none"}`},onChange:M8,value:si,ref:Ee},S.createElement(La,{value:1},a("5000.5035")||"手动"),S.createElement(La,{value:2},a("5000.5034")||"自动")),j?S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}):null,si===2?S.createElement(Na,{className:"ant-btn ant-btn-primary",loading:Qn,disabled:!(A.length>0),onClick:ws},a("5000.5017")||"计算"):null),a("5000.6039")||"平颅方位",":",S.createElement(La.Group,{onChange:Ce=>{Le(Ce.target.value),Ce.target.value?_e.current.rotation.set(-8.3/180*Math.PI,0,0):_e.current.rotation.set(0,0,0)},style:{marginLeft:6},value:Ne},S.createElement(La,{value:0},a("5000.6042")||"关闭"),S.createElement(La,{value:1},a("5000.6043")||"启用")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),j&&S.createElement(S.Fragment,null,a("5000.7047")||"路径限制",": ",S.createElement(La.Group,{value:Me,onChange:Ce=>{if(gt(Ce.target.value),Ce.target.value==2)q("cor",b.current[0].z);else if(Ce.target.value==3)q("sag",b.current[0].x);else{const $e=_e.current.getObjectByName("azimuth"),Ke=_e.current.getObjectByName("azimuth_outline"),lt=_e.current.getObjectByName("azimuth_edge");lt&&_e.current.remove(lt),$e&&_e.current.remove($e),Ke&&_e.current.remove(Ke)}}},S.createElement(La,{value:1},a("5000.7048")||"任意角度"),S.createElement(La,{value:2},a("4000.0103")||"冠状面"),S.createElement(La,{value:3},a("4000.0104")||"矢状面")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})),S.createElement("div",{dangerouslySetInnerHTML:{__html:u}}))),vt.includes("reslicing")&&S.createElement(zg,{tab:a("4000.0204")||"图谱切面",key:"3",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement("div",{style:{width:"276px"}},S.createElement(ts,null,a("7000.7024")||"控制模式",":  ",S.createElement(La.Group,{value:Su,onChange:Ce=>{Ce.target.value==0?De.current.setMode("translate"):De.current.setMode("rotate"),nc(Ce.target.value)}},S.createElement(La,{value:0},a("7000.7022")||"平移"),S.createElement(La,{value:1,disabled:jc!=4},a("7000.7023")||"旋转")),S.createElement("span",{style:{fontStyle:"italic"}},a("5000.0019")||"提示:按R键进入旋转模式")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,a("7000.7021")||"重切片模式",":",S.createElement("br",null),S.createElement(La.Group,{value:jc.toString(),onChange:Ce=>zl(Number(Ce.target.value))},S.createElement(La.Button,{value:"1",style:{padding:"0 5px"}},"Coronal"),S.createElement(La.Button,{value:"2",style:{padding:"0 5px"}},"Sagittal"),S.createElement(La.Button,{value:"3",style:{padding:"0 5px"}},"Horizontal"),S.createElement(La.Button,{value:"4",style:{padding:"0 5px"}},"Arbitrary"))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0210")||"平移-X",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:-5.17,max:5.17,onChange:ju,step:.01,value:Nt,disabled:Nn}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0211")||"平移-Y",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:-5.33,max:2.04,onChange:Qd,step:.01,value:Lt,disabled:Ut}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0212")||"平移-Z",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:-8,max:6,onChange:Ps,step:.01,value:zt,disabled:Bn}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0213")||"角度-X",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:0,max:360,step:1,value:pr,onChange:Ce=>Wu(Ce,1),disabled:gr}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0214")||"角度-Y",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:0,max:360,step:1,value:Vt,onChange:Ce=>Wu(Ce,2),disabled:gr}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0215")||"角度-Z",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:0,max:360,step:1,value:Fe,onChange:Ce=>Wu(Ce,3),disabled:gr})))),S.createElement(Na,{style:{marginTop:20,marginLeft:10},type:"primary",disabled:rr,onClick:()=>ac()},"Download current slice"),S.createElement(Na,{style:{marginTop:20},type:"primary",disabled:rr,onClick:()=>Cl()},a("7000.0107")||"查看更高分辨率的图像"),S.createElement($i,{style:{margin:"10px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement("div",null,S.createElement("i",null,a("5000.6008")||"点击下方按钮,申请下载各向同性10微米分辨率的STAM图谱3D标签图像")),S.createElement(Na,{style:{marginTop:20},type:"primary",onClick:()=>{m1()}},a("5000.6009")||"请求STAM标签"),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),vt.includes("registration")&&S.createElement(zg,{tab:a("5000.0001")||"脑片配准",key:"4",disabled:Y===2||Y===0},Hr?S.createElement("div",{style:{maxHeight:"calc(100vh - 60px)",overflowY:"auto",overflowX:"hidden"}},rc.map((Ce,$e)=>S.createElement(S.Fragment,null,S.createElement(yA.CheckableTag,{key:Ce,checked:Xs.includes(Ce),onChange:()=>Yd([Ce])},Ce))),rc.length<10?S.createElement(yA,{icon:S.createElement(w5,null),onClick:()=>{Al(Ce=>[...Ce,`Task${rc.length+1}`]),ic(Ce=>[...Ce,{key:`Task${rc.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),$s.current=[...$s.current,{key:`Task${rc.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]}},"New task"):null,as.map((Ce,$e)=>{if(Ce.key===Xs[0]){const{key:Ke,fileList:lt,fileList2:Rt,correspondingPlaneData:Jt,registrationRadioShowType:rn,startButtonLoading:hn}=Ce;return S.createElement("div",{key:Ke},S.createElement(ts,null,S.createElement(Do,null,S.createElement("p",null,S.createElement("span",null,a("5000.6033")||"Upload slice, or use the test "),S.createElement("a",{onClick:()=>{Si("DAPI")}},"DAPI "),"&",S.createElement("a",{onClick:()=>{Si("PI")}}," PI "),a("5000.6034")||"slices:"))),S.createElement(ts,null,S.createElement(Do,null,S.createElement(l9,{accept:"image/tiff",listType:"picture-card",fileList:lt,onPreview:Z0,customRequest:dT,beforeUpload:pn=>Fa(pn),onRemove:()=>{const pn=as.findIndex(Cr=>Cr.key===Xs[0]);if(pn>-1){let Cr=JSON.parse(JSON.stringify(as)),sr=Cr[pn];sr.fileList=[],ic(Cr),$s.current=Cr}}},S.createElement("button",{style:{border:0,background:"none"},type:"button"},S.createElement(w5,null),S.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,null,S.createElement("p",null,S.createElement("span",null,a("5000.7000")||"(可选) 上传第二张脑片图像,默认该图像已经配准到了第一张上传的脑片图像上")))),S.createElement(ts,null,S.createElement(Do,null,S.createElement(l9,{accept:"image/tiff",listType:"picture-card",fileList:Rt,onPreview:Z0,customRequest:pn=>dT(pn,2),beforeUpload:pn=>Fa(pn,2),onRemove:()=>{const pn=as.findIndex(Cr=>Cr.key===Xs[0]);if(pn>-1){let Cr=JSON.parse(JSON.stringify(as)),sr=Cr[pn];sr.fileList2=[],ic(Cr),$s.current=Cr}}},S.createElement("button",{style:{border:0,background:"none"},type:"button"},S.createElement(w5,null),S.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,a("7000.0106")||"计算与上传图像对应的图谱切面",":")),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,S.createElement(Na,{loading:hn,disabled:lt.length<1,onClick:()=>eU($e)},a("7000.0108")||"开始计算"),S.createElement(Na,{onClick:tC,disabled:!Jt.url},a("7000.0109")||"下载保存"))),S.createElement(ts,{style:{marginTop:5}},Jt.base64_url&&S.createElement(rB,{src:Jt.base64_url,width:100})),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Na,{onClick:()=>fT(rn),disabled:!Jt.url},a("5000.0004")||"显示结果"),S.createElement(Do,{style:{display:"flex",alignItems:"center",marginLeft:5}})),S.createElement(ts,null,S.createElement(La.Group,{onChange:bs,value:rn},S.createElement(La,{value:"1"},a("5000.7001")||"atlas"),S.createElement(ts,null,"slice:   ",S.createElement(Qy,{onChange:pn=>{Hc.current=pn.target.checked;const Cr=pn.target.checked?-1:1;_e.current.traverse(sr=>{sr.userData.name==="registrationPng"&&sr.userData.imgType!=1&&sr.scale.set(Cr,1,1)})},disabled:rn!="2"},a("5000.7013")||"左右翻转"),S.createElement("div",{style:{wordWrap:"break-word",width:200}},S.createElement(La,{value:"2"},a("5000.7002")||"first"),Rt.length<1?null:S.createElement(La,{value:"3"},a("5000.7003")||"second"))))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}))}else return null})):null),vt.includes("download")&&S.createElement(zg,{tab:a("5000.0005")||"数据下载",key:"5",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement(ts,null,S.createElement(Do,null,a("5000.0009")||"提示:按A键切换平移和缩放模式")),S.createElement(ts,null,S.createElement(Do,null,S.createElement(Na,{onClick:tU},tr))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,S.createElement(Na,{disabled:tr===(a("5000.0006")||"选取下载范围"),onClick:pT},a("5000.0008")||"预览图像"))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{alignItems:"center"}},S.createElement(Do,null,a("5000.0010")||"设置采样倍数",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:1,max:6,step:1,defaultValue:2,value:wi,onChange:Ce=>{Ln(Ce),Oe({})},tooltip:{formatter:Ce=>Ce?Math.pow(2,Ce-1):null}}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,null,S.createElement(Na,{loading:oo,disabled:tr===(a("5000.0006")||"选取下载范围"),onClick:hT},a("5000.0005")||"数据下载"))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,null,a("5000.5031")||"数据块大小:"),S.createElement(Do,null,D8)),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),vt.includes("mapping")&&S.createElement(zg,{tab:a("5000.5014")||"图谱映射",key:"6",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement(ts,null,S.createElement(Do,null,S.createElement("p",null,a("5000.6035")||"Upload 3D image or swc file already mapped to STAM or CCF, otherwise use the test ",S.createElement("a",{onClick:()=>{Ao("3D")}},a("5000.6036")||"3D image")," or ",S.createElement("a",{onClick:()=>{Ao("swc")}},a("5000.6037")||"swc file:"))),S.createElement(Do,null,S.createElement(l9,{listType:"picture-card",fileList:Oi,onPreview:Z0,customRequest:v1,beforeUpload:Ce=>Fa(Ce,1),onRemove:()=>{zi([])}},S.createElement("button",{style:{border:0,background:"none"},type:"button"},S.createElement(w5,null),S.createElement("div",{style:{marginTop:8}},"Upload"))))),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,{span:12},S.createElement(Vh,{min:1,max:100,onChange:Ce=>{nu(Ce)},disabled:!xu,value:typeof Wc=="number"?Wc:0})),S.createElement(Do,{span:3},S.createElement(MLe,{min:1,max:100,style:{margin:"0 16px"},value:Wc,disabled:!xu,onChange:Ce=>{Ce&&nu(Ce)}})),"m"),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,a("5000.5015")||"选择转换方向",":"),S.createElement(Do,null,S.createElement(Do,null,S.createElement("span",{style:{fontSize:"13px",fontStyle:"italic"}},a("5000.7040")||"CCF的垂直方向尺寸已扩展到9mm"),S.createElement(La.Group,{onChange:Ce=>{yr(Ce.target.value)},value:Ja},S.createElement(La,{value:"900"},a("5000.7041")||"YES"),S.createElement(La,{value:"800"},a("5000.7042")||"NO"))),S.createElement(La.Group,{onChange:Ng,value:ls},S.createElement(La,{value:"applySTAM2CCF"},"STAM-",">","CCF"),S.createElement(La,{value:"applyCCF2STAM"},"CCF-",">","STAM")))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,S.createElement(Na,{loading:Et,disabled:!bt,onClick:Ob},a("7000.0108")||"开始计算"),S.createElement(Na,{onClick:Lb,disabled:!Dr.file},a("7000.0109")||"下载保存"))),S.createElement(ts,{style:{marginTop:5}},Dr.base64_url&&S.createElement(rB,{src:Dr.base64_url,width:100})),S.createElement(ts,{style:{marginTop:5}},S.createElement(Na,{onClick:dl,disabled:!(Dr.file&&Dr.file[1])},a("5000.0004")||"显示结果")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement("p",null,a("7000.7014")||"您也可以在此下载",S.createElement("a",{href:`${n}/data/Fiji.zip`},"Fji")," / ",S.createElement("a",{href:n+"/data/ImageJ.zip"},"ImageJ"),S.createElement("span",null,a("7000.7015")||"的插件;您可能需要使用测试数据,请"),S.createElement("a",{href:`${n}/data/test.zip`},a("7000.7016")||"在此"),S.createElement("span",null,a("7000.7017")||"下载"))):null),vt.includes("neurons")&&S.createElement(zg,{tab:a("5000.5052")||"神经环路",key:"7",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement("p",null,S.createElement("span",null,a("5000.6029")||"Navigate the "),S.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{Fl(!0)}},a("5000.6030")||"whole-brain connectivity diagram"),S.createElement("span",null,a("5000.6031")||"consisting of single neuronal projections,or:")),Qa?S.createElement(hA,{ref:Gc,style:{width:"100%"},options:ai,placeholder:a("5000.5053")||"Input the inquired structure",onSearch:F8,onChange:yc,value:Qa}):S.createElement(UE,{showSearch:!0,ref:gc,style:{width:"100%"},value:Qa,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:yc,onSearch:yc,treeData:rC(Be)}),S.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},S.createElement("span",null,a("5000.6001")||"Input an inquired structure to visualize the connectivity map, for example, "),S.createElement("a",{onClick:bh("CP"),style:{textDecoration:"underline"}},"CP"),", ",S.createElement("a",{onClick:bh("PIR1"),style:{textDecoration:"underline"}},"PIR1"),", or ",S.createElement("a",{onClick:bh("Primary motor area, Layer 6a"),style:{textDecoration:"underline"}}," Primary motor area, Layer 6a")),Qa?S.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},S.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{const Ce=[];Ce.push(Qa),["Upstream","Downstream"].forEach(Cr=>{Ce.push(Cr),Ce.push("name,neurons"),Sl[Cr].forEach(sr=>{Ce.push(`${sr.name},"${sr.value}"`)})});let $e=Ce.join(`
5092
+ `;let wxn=new URL(window.location.href),qd=new URLSearchParams(wxn.search),w5e=qd.get("leftHemisphereVisibility"),T5e=qd.get("coordinateVisibility"),I5e=qd.get("datumMarkVisibility"),A5e=qd.get("cranialVisibility"),R5e=qd.get("gridVisibility"),O5e=qd.get("terminalVisibility"),L5e=qd.get("branchingVisibility"),N5e=qd.get("branchingColor"),M5e=qd.get("brainContourVisibility"),P5e=qd.get("brainContourOpacity"),G7=qd.get("otherAtlases"),j7=qd.get("atlasReslicingInfo"),W7=qd.get("sectionPointPosition"),D5e=qd.get("echart_Value"),zZ=qd.get("tiffDataPath"),k5e=qd.get("tiffInfo"),U5e=qd.get("swcUrl");const Txn={leftHemisphereVisibility:w5e?JSON.parse(w5e):!1,coordinateVisibility:T5e?JSON.parse(T5e):!0,datumMarkVisibility:I5e?JSON.parse(I5e):!0,cranialVisibility:A5e?JSON.parse(A5e):!1,gridVisibility:R5e?JSON.parse(R5e):!0,terminalVisibility:O5e?JSON.parse(O5e):!0,branchingVisibility:L5e?JSON.parse(L5e):!0,branchingColor:N5e||"#A7B5A1",brainContourVisibility:M5e?JSON.parse(M5e):!0,brainContourOpacity:P5e?JSON.parse(P5e):.3,otherAtlases:G7||"None",atlasReslicingInfo:j7?JSON.parse(j7):{},sectionPointPosition:W7?JSON.parse(W7):{}},Ixn=(t,e)=>{let n=new URL(window.location.href),r=new URLSearchParams(n.search),i=e;typeof e!="string"&&(i=JSON.stringify(i)),r.set(t,i),n.search=r.toString(),window.history.replaceState({},"",n)},Axn={set(t,e,n){return t[e]=n,Ixn(e,n),!0}},qa=new Proxy(Txn,Axn),fWe=S.forwardRef((t,e)=>{const{regionData:n,setoffset_factor:r,offset_factor_R:i,t:a,hrefStr:o,leftTreeRef:s,setJiaoduRef:l,jiaoduRef:u,mouseflag:d,renderer:f,controls:p,menutagShow:h,setMenuTag:g,startselect:y,linemeshs_jing:v,points:m,points2:b,activetabIndex:E,material:C,setShowimage:x,childRef:_,checkItems:A,setoutflag:P,fetchCoordinateFunc:R,setendPoint:N,clickPoint:D,outflagRef:U,axis_font:z,setdatum:B,modeChoose:j,setShowModeChoose:V,virusModeValue:G,setShowTabNums:W,pipelineClickEvent:Z,automaticGroup:H,focusVirusLineItem:X,setMenuTagShow:ee,responsefunc:K,mode:Y,setCheckItems:te,setLeftMenuTabIndex:re,updatePage:Q,swcItem:oe,axon_check:ge,swcnameMesh:pe,setMode:fe,vesselRef:ae,swcRef:Se,vesselStr:ie,lableStr:ye,setShowSettingModal:de,showSettingModal:Te,fbxTreeDatas:Be,composer:Ye,setEchartValue:ke,echartValue:we,sectionsInfoRef:We,sectionsInfo:ve,setSectionsInfo:he,gray_value:Ue,setLuguchecked:Le,Luguchecked:Ne,datum:at,setGridShow:qe,PointShow:Ze,nodeStr:dt,lefttab:Tt,righttab:vt,atlasData:ct,setTip:St,tip:Ge,startRegionAnimation:nt,setFunctionLoopSwcData:yt,azimuth:Me,setAzimuth:gt}=t,[Gt,Ht]=S.useState(!1),[jt,Yt]=S.useState(!1),[tn,gn]=S.useState(!1),[On,In]=S.useState(!1),[Xn,Tr]=S.useState(!1),[zr,jn]=S.useState(!1),[Wt,zn]=S.useState(!1),[vn,cr]=S.useState(!1),[pr,mt]=S.useState(qa.atlasReslicingInfo.angleX||120),[Vt,fn]=S.useState(qa.atlasReslicingInfo.angleY||320),[Fe,_t]=S.useState(qa.atlasReslicingInfo.angleZ||270),[Nt,Dt]=S.useState(qa.atlasReslicingInfo.positionX||0),[Lt,Zt]=S.useState(qa.atlasReslicingInfo.positionY||0),[zt,en]=S.useState(qa.atlasReslicingInfo.positionZ||0),[Nn,Kt]=S.useState(qa.atlasReslicingInfo.translateX||!0),[Ut,on]=S.useState(qa.atlasReslicingInfo.translateY||!0),[Bn,Rn]=S.useState(qa.atlasReslicingInfo.translateZ||!0),[gr,Lr]=S.useState(qa.atlasReslicingInfo.rotate||!0),[rr,yn]=S.useState(qa.atlasReslicingInfo.ButtonDisabled||!0),[nr,Dn]=S.useState(!1),[kn,Un]=S.useState(!1),[mr,Kr]=S.useState(!1),[yi,gi]=S.useState(!1),[tr,_r]=S.useState(a("5000.0006")||"显示数据块"),[vr,fr]=S.useState(1),[Gr,qi]=S.useState(1),[Oi,zi]=S.useState([]),[ca,ro]=S.useState([]),[ka,To]=S.useState([]),[oo,ti]=S.useState(!1),[Dr,Ua]=S.useState({}),[Ta,ha]=S.useState(!1),[gs,Mo]=S.useState(""),[ci,Ia]=S.useState("Config_DAPI.ini"),[ls,xi]=S.useState("applySTAM2CCF"),[Ja,yr]=S.useState("800"),[si,an]=S.useState(0),[Et,cn]=S.useState(!1),[Bt,Gn]=S.useState(!1),[Qn,Ur]=S.useState(!1),[ii,mi]=S.useState(!1),[Hr,Jr]=S.useState(!0),[wi,Ln]=S.useState(2),[er,sn]=S.useState(!1),[ut,Oe]=S.useState({}),ze=S.useRef(qa.atlasReslicingInfo.direction1||4),it=S.useRef(null),[ot,pt]=S.useState(a("4000.0208")||"选择靶点"),[bt,st]=S.useState(!1),Ee=S.useRef(null),ue=S.useRef(window.location.href.split("/")[2]),De=S.useRef(new q_(ki.current,f==null?void 0:f.domElement)),Xe=S.useRef(0),et=S.useRef(0),ht=S.useRef(new Jn),$t=S.useRef(new Ie),Ft=S.useRef(new Ie),dn=S.useRef(new Jn),At=S.useRef(new Ie(1,0,0)),It=S.useRef(new Jn),Kn=S.useRef(null),lr=S.useRef(new hI),Fn=S.useRef(null),wn=S.useRef([]),ir=S.useRef(null),Ir=S.useRef(new Jn),En=S.useRef(new Kc),[ln,ui]=S.useState(qa.otherAtlases),Fr={min:new Ie(59.74305725097656,69.15838623046875,.9565062522888184),max:new Ie(1081.3045654296875,800.6698608398438,1400.156005859375)},[ai,Fs]=S.useState([]),Va=S.useRef({}),Io=S.useRef(!1),bi=S.useRef([0,0]),di=S.useRef([0,0]),ua=S.useRef(""),xs=S.useRef(!1),[so,Bo]=S.useState(!1),[tc,js]=S.useState(!1),[Rs,lo]=S.useState(0),[co,Os]=S.useState(0),[yl,bl]=S.useState({}),[hr,cs]=S.useState([]),Ls=S.useRef(null),_s=S.useRef(null),[Ns,bo]=S.useState(""),[Po,$o]=S.useState(null),[Qa,io]=S.useState(D5e||""),[Ws,Il]=S.useState(!1);S.useState("");const za=S.useRef(""),[ms,Bs]=S.useState(qa.leftHemisphereVisibility),Ic=S.useRef([]);S.useRef([]);const[El,Fl]=S.useState(!1),[Ac,zc]=S.useState(!1),Bl=S.useRef(!0),sl=S.useRef(!0),vs=S.useRef(""),Rc=S.useRef({target:p.current.target.clone(),position:p.current.object.position.clone(),up:p.current.object.up.clone(),enabled:p.current.enabled}),[Su,nc]=S.useState(0),[eu,wd]=S.useState(!0),Hc=S.useRef(!0),Td=S.useRef(null),ll=S.useRef(new Jn),[nd,Vu]=S.useState(qa.brainContourVisibility),[rc,Al]=S.useState(["Task1","Task2"]),[Xs,Yd]=S.useState(["Task1"]),[as,ic]=S.useState([{key:"Task1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"Task2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),$s=S.useRef([{key:"tags1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"tags2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),Gc=S.useRef(null),gc=S.useRef(null),[Id,Oc]=S.useState(qa.coordinateVisibility),[zu,tu]=S.useState(qa.brainContourOpacity),[jc,$l]=S.useState(qa.atlasReslicingInfo.direction1||4),[Kd,Lc]=S.useState({}),[mc,Nc]=S.useState({}),[Sl,Ui]=S.useState({});S.useRef();const cl=S.useRef([]),ul=S.useRef({brightness:.95,darkness:0,opacity:1,opacity2:1,color:{r:0,g:0,b:0},color2:{r:255,g:255,b:255}}),Mc=S.useRef(new Set),Pc=S.useRef(0),[Cu,Hu]=S.useState(""),[Jd,Gu]=S.useState(!1);S.useState([]),S.useRef([]),S.useState([]),S.useState(""),S.useRef(!0),S.useRef(null);const[Wc,nu]=S.useState(10),[xu,rd]=S.useState(!1);S.useImperativeHandle(e,()=>({tabChange:uo,setYinDaoOpen1:Ht,setYinDaoOpen2:Yt,setYinDaoOpen3:gn,setYinDaoOpen4:In,setYinDaoOpen5:Tr,setYinDaoOpen6:jn,setYinDaoOpen7:zn,setDontShowAgain:wd,modeValue:si})),S.useEffect(()=>{cl.current=Be},[Be]);const T=Ce=>{Mc.current.delete(Ce.key)},k=(Ce,$e,Ke)=>{if(Ce.length<=3)return Ce;Ce.sort((rn,hn)=>rn[$e]-hn[$e]||rn[Ke]-hn[Ke]);const lt=[],Rt=[],Jt=(rn,hn,pn)=>(hn[$e]-rn[$e])*(pn[Ke]-rn[Ke])-(hn[Ke]-rn[Ke])*(pn[$e]-rn[$e]);for(const rn of Ce){for(;lt.length>=2&&Jt(lt[lt.length-2],lt[lt.length-1],rn)<=0;)lt.pop();lt.push(rn)}for(let rn=Ce.length-1;rn>=0;rn--){const hn=Ce[rn];for(;Rt.length>=2&&Jt(Rt[Rt.length-2],Rt[Rt.length-1],hn)<=0;)Rt.pop();Rt.push(hn)}return Rt.pop(),lt.pop(),lt.concat(Rt)},q=(Ce,$e)=>{const Ke=_e.current.getObjectByName("azimuth"),lt=_e.current.getObjectByName("azimuth_outline"),Rt=_e.current.getObjectByName("azimuth_edge");Rt&&_e.current.remove(Rt),Ke&&_e.current.remove(Ke),lt&&_e.current.remove(lt);const Jt=_e.current.getObjectByName("Brain");if(!Jt)return;const rn=new rs().setFromObject(Jt),hn=rn.min,pn=rn.max,Cr=pn.x-hn.x,sr=pn.y-hn.y,Cn=pn.z-hn.z,ur=new Ie((hn.x+pn.x)/2,(hn.y+pn.y)/2,(hn.z+pn.z)/2);let ar=new Di,Er=[],Qr,Ba;const Fi=new Bc({color:new Ar("#d4d2d2"),transparent:!0,opacity:.6});if(Ce==="cor"){const Es=gf.clamp($e,hn.z,pn.z);Ba=new zs(Cr,sr,.01),Qr=new Jn(Ba,Fi),Qr.name="azimuth",Qr.position.set(ur.x,ur.y,Es);for(let Ol=0;Ol<Jt.children[0].geometry.attributes.position.array.length;Ol+=3){let kp=Jt.children[0].geometry.attributes.position.array[Ol],ef=Jt.children[0].geometry.attributes.position.array[Ol+1],kc=Jt.children[0].geometry.attributes.position.array[Ol+2]*Hi.current+ja.current;Math.abs(kc-Es)<.18&&Er.findIndex(Hl=>Hl.equals(new Ie(kp,ef,(Es-ja.current)/Hi.current)))===-1&&Er.push(new Ie(kp,ef,(Es-ja.current)/Hi.current))}if(Er.length>2){Er=k(Er,"x","y");const Ol=new SA(Er);Ol.closed=!0,Ol.tension=.5;const kp=Ol.getPoints(Er.length*20);ar.setFromPoints(kp)}else ar.setFromPoints(Er)}else if(Ce==="sag"){const Es=gf.clamp($e,hn.x,pn.x);Ba=new zs(.01,sr,Cn),Qr=new Jn(Ba,Fi),Qr.name="azimuth",Qr.position.set(Es,ur.y,ur.z);for(let Ol=0;Ol<Jt.children[0].geometry.attributes.position.array.length;Ol+=3){let kp=Jt.children[0].geometry.attributes.position.array[Ol],ef=Jt.children[0].geometry.attributes.position.array[Ol+1],Mg=Jt.children[0].geometry.attributes.position.array[Ol+2],kc=kp*Hi.current+eo.current;Math.abs(kc-Es)<.18&&Er.findIndex(Hl=>Hl.equals(new Ie((Es-eo.current)/Hi.current,ef,Mg)))===-1&&Er.push(new Ie((Es-eo.current)/Hi.current,ef,Mg))}if(Er.length>2){Er=k(Er,"y","z");const Ol=new SA(Er);Ol.closed=!0,Ol.tension=.5;const kp=Ol.getPoints(Er.length*20);ar.setFromPoints(kp)}else ar.setFromPoints(Er)}else return;Qr.userData.initPosition=Qr.position.clone(),Qr.userData.initRotation=Qr.rotation.clone();const sa=new m4(Ba),fl=new Jc({color:"#2b2a2a"}),Jo=new hI(sa,fl);Jo.name="azimuth_edge",Jo.position.set(Qr.position.x,Qr.position.y,Qr.position.z);const $a=new Jc({color:16711680}),Xa=new Ea(ar,$a);return Xa.name="azimuth_outline",Xa.scale.set(Hi.current,Hi.current,Hi.current),Xa.position.set(eo.current,Ya.current,ja.current),_e.current.add(Qr,Xa,Jo),Qr},ce=Ce=>{if(Ce.stopPropagation(),Mc.current.add(Ce.key),Mc.current.has("Alt")&&(Mc.current.has("c")||Mc.current.has("C")))try{const $e=f.domElement.toDataURL("image/png"),Ke=document.createElement("a");Ke.href=$e,Ke.download="scene.png",Ke.click(),Mc.current=new Set}catch($e){console.error("Error downloading canvas:",$e),alert("抱歉,无法下载画布。请查看控制台获取更多信息。")}};S.useEffect(()=>{fetch(n+"/data/json/name.json").then(Ke=>Ke.json()).then(Ke=>{bl(Ke)}),fetch(n+"/data/TreeData/nuclear.json").then(Ke=>Ke.json()).then(Ke=>{cs(Ke)});const Ce=new qc(.05,32,32),$e=new Ml({color:392960,transparent:!0});if(ll.current=new Jn(Ce,$e),ll.current.name="sectionSphere",W7){let Ke=JSON.parse(W7);ll.current.position.set(Ke.x,Ke.y,Ke.z)}return qa.cranialVisibility&&ga(!0),zZ&&Dp(),U5e&&P8(U5e),document.addEventListener("keydown",ce),document.addEventListener("keyup",T),window.addEventListener("beforeunload",uT),()=>{document.removeEventListener("keydown",ce),document.removeEventListener("keyup",T),window.removeEventListener("beforeunload",uT)}},[]),S.useEffect(()=>{fetch("/staticresource/data/SWC/swc_foler/15257/BIL_15257_1.js").then(Ce=>Ce.json()).then(Ce=>{Nc(Ce)}).catch(Ce=>{console.error("Fetch error:",Ce)})},[]);const xe=(Ce,$e)=>eu?S.createElement("div",{style:{position:"absolute",top:"4px",right:"50px"}},S.createElement(Qy,{defaultChecked:!1,onChange:Ke=>{Ke.target.checked?localStorage.setItem(Ce,"true"):localStorage.setItem(Ce,"false"),$e()},style:{marginTop:"10px"}},"Don't show again")):null,rt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,S.createElement("div",null,a("8000.0001")||"如①所示,在主窗口左侧的是数据面板,用户可以在该选项卡下选择STAM的解剖命名树,配准到STAM上的完整脑血管图谱和神经元数据。用户也可以切换两个不同版本的命名系统。"),S.createElement("div",null,a("8000.0002")||"如②所示,主窗口中可以加载脑区、核团的三维模型。"),S.createElement("div",null,a("8000.0003")||"如③所示,用户可以切换不同的模式或者功能模块"),S.createElement("div",null,a("8000.00031")||"如④所示,工具栏从左到右依次是,回到首页、切换水平面、切换矢状面、切换水平面、重置视角、显示设置、反馈")),cover:S.createElement("video",{src:`${n}/guide/topo.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",style:{width:"min-content"},target:ir.current},{title:a("8000.0032")||"解剖结构、脑血管和神经元查询",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,a("8000.0004")||"Regions选项卡包含的是STAM的解剖命名树,用户可以在该选项卡下的复选框中选择任意数量的感兴趣结构,在主窗口中可视化;Vessels选项卡包含了一套配准到STAM上的完整脑血管图谱,用户可以在此选择感兴趣的血管分支;Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。用户也可以选择切换到Brain maps 4.0 ontology,该命名树中的结构同样可以被检索、选中并可视化。"),target:s.current,placement:"right"},{title:a("8000.0033")||"可视化解剖子结构并切换坐标原点",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,a("8000.0005")||"用户可以点击Regions选项卡下的解剖命名树中蓝色的方块图标,此时主窗口中会以组装的形式可视化用户点击结构的所有子结构,同时展开幅度可在右侧面板设置。默认情况下,该坐标系统以Bregma点作为原点。户也可以将坐标原点切换为STAM的其它任意19个颅骨或颅内基准点,主窗口中可视化对象的坐标值将根据新的原点重新计算。右击任意基准点,可以保存以基准点为坐标原点的STAM标签图像。"),placement:"center",target:ir.current},{title:a("8000.0034")||"可视化功能设置",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo3.gif`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?xe("Assem",function(){}):null,a("8000.0006")||"用户可以在页面底部切换到setting选项卡。Left hemisphere开关决定是否展示左半脑,默认为Off。Coordinate开关决定是否在主窗口中显示坐标数值,默认为On。Datum Marks开关决定是否在主窗口中显示基准点,默认为On。Cranial开关决定是否在主窗口中显示颅骨的三维轮廓,默认为Off。"),target:document.getElementsByClassName("bottom_tabs_outer_div")[0]}],Xt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?xe("Virtual",function(){}):null,a("8000.0007")||"我们提供了虚拟手术导航服务,用户可以通过交互操作,模拟向小鼠脑注射病毒的立体定位手术过程。STAM会根据用户操作,返回注射位点与作为坐标原点的颅骨或颅内基准点之间的距离和注射角度信息。"),cover:S.createElement("video",{src:`${n}/guide/surgery.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0035")||"自动导航模式",cover:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?xe("Virtual",function(){}):null,a("8000.0008")||"首先选择要注射的脑区。接下来在脑区上选择注射靶点。用户继续点击Select target按钮,注射脑区的三维模型表面会出现一个跟随鼠标移动的绿点。然后,点击Auto进入自动模式,左侧数据面板中的Structure for injecting选项卡变为Regions to avoid。用户点击需要避开脑区、核团的名称,被选中的文字会变为高亮的红色,同时这些结构的三维轮廓也会显示在主窗口中。接下来点击右侧面板中的Intellectual planning按钮,等待若干秒后,STAM会返回一条从注射靶点出发、并且避开所有用户选中脑区、核团的路径。"),target:s.current,placement:"right"},{title:a("8000.0036")||"手动导航模式",cover:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?xe("Virtual",function(){}):null,a("8000.0009")||"用户点击Manually进入手动规划模式,此时用户标记的注射靶点变为蓝色圆点,并出现一条从注射靶点出发、连接到鼠标当前的位置的红色虚射线,该射线与STAM外轮廓的交点(即注射位点)会被标记为绿色。当用户找到合适的注射路径后,可点击鼠标左键标记,被标记的路径会在主窗口中形成一条蓝色实线,注射位点则被标记为蓝色圆锥,且该路径所穿过的脑区、核团名称也会按照其空间位置排列在实线上。在右侧面板中,会出现该注射路径与三个标准解剖方向的夹角、注射靶点,以及注射位点的信息。用户点击右侧面板上的Reset按钮,即可重新开始整个注射手术流程。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],mn=[{title:a("5000.5084")||"步骤一",description:a("5000.5082")||"请选择注射模式,如果选择自动模式,点击左侧细胞名称选择细胞核进行旁路",target:Ee.current}],_n=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?xe("Reg",function(){}):null,a("8000.0011")||"如①所示,用户可上传PI或DAPI染色的单张脑片图像,该服务将通过约1分钟的服务器端计算,从STAM中重切出一张与用户上传的脑片位置最接近的图谱切面,并根据计算出来的角度和位置显示在主窗口中。"),cover:S.createElement("video",{src:`${n}/guide/registration.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0037")||"上传脑片图像并计算或下载配准结果",cover:S.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?xe("Reg",function(){}):null,a("8000.0012")||"用户可以从本地上传待配准的tif/tiff格式的二维脑片图像。然后选择上传图像的类型。接着点击Calculate the corresponding plane from the atlas按钮组中的Start按钮,等待后台返回计算结果。计算完成后,Start按钮下方会出现计算结果的预览图,可左键单击放大查看。Start按钮右侧的Save按钮此时也变为可点击,用户单击该按钮,可以将计算结果下载到本地。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],or=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0014")||"如①和②所示,用户可以在STAM所在的三维空间中选取任意感兴趣范围,并以不同的采样倍数下载自己选取范围内的原始图像。"),cover:S.createElement("video",{src:`${n}/guide/datasharing.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0047")||"平移模式选择原始图像数据的范围",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0015")||"用户可以点击“Select the range”按钮,然后主窗口中出现一个橙色线条的方框。用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制方框在各个方向上的平移,当某个方向的箭头被用户选中时,该箭头会变为高亮的黄色。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0039")||"缩放模式选择原始图像数据的范围并预览图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0016")||"用户也可以通过按下键盘上的“A”,将范围选取操作从平移模式切换为缩放模式。此时方框的箭头会变为方块,拖动方块,就可以改变方框的大小。经过上述操作明确了待下载数据的空间范围后,可以点击“预览下载图像”按钮,通过体绘制,在主窗口中对该范围内的图像进行可视化,"),placement:"center",target:ir.current},{title:a("8000.0040")||"选择数据的采样倍数并下载",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing3.gif`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?xe("Down",function(){}):null,a("8000.0017")||"拖动“Set the downsampling rate”滑动条,用户可以选择待下载数据的采样倍数;具体的倍数值可通过滑块上方的黑色背景提示文字查看。当数据量没有超过1 GB时,点击Downloading按钮可直接下载;当超过该数值,点击Downloading按钮会唤起用户终端的邮箱管理工具(如Outlook等),并自动将待下载范围和采样倍数信息填入邮件中,此时用户点击邮件发送按钮,即可向STAM网站发送数据下载申请。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],ni=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?xe("Map",function(){}):null,a("8000.0018")||"我们支持用户上传此前已经配准到Common Coordinate Framework(CCF)的三维图像数据和神经元完整形态数据,并将其映射到STAM上,并直接在三维空间中进行可视化;我们也支持反向映射,即将已经配准到STAM的同类型数据映射到CCF上。"),cover:S.createElement("video",{src:`${n}/guide/mapping.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0041")||"上传三维图像数据并计算",cover:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?xe("Map",function(){}):null,a("8000.0019")||"用户点击右侧面板的Upload按钮,上传已配准到CCF或者STAM的三维图像数据或神经元形态学数据。上传结束后,在Select the direction of conversion单选框中,确定数据的映射方向是从STAM到CCF还是反过来。此后点击Start按钮,STAM的服务器端开始计算,Start按钮变为等待状态。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0042")||"计算完成后预览或下载结果",cover:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?xe("Map",function(){}):null,a("8000.0020")||"等待约10分钟后,STAM的服务器端完成计算并返回结果。此时Save按钮和View result按钮均变为可点击状态。点击Save按钮,可以将计算结果下载到本地;点击View result按钮,可以在主窗口中预览计算结果。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Pi=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?xe("Res",function(){}):null,S.createElement("div",null,a("8000.0021")||"我们提供了沿任意角度可视化脑图谱切面的服务。用户可以查看感兴趣的STAM任意位置和角度的切面,浏览该切面上的脑区、核团标注,并由该图谱切面跳转到STAM任意切面服务所提供的各向同性1微米分辨率切面。"),S.createElement("div",null,a("8000.0022")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同。位于正中区域的是主窗口。"),S.createElement("div",null,a("8000.0023")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。具体的平移、旋转数值可通过滑块上方的黑色背景提示文字查看。")),cover:S.createElement("video",{src:`${n}/guide/reslicing.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0043")||"平移或旋转图谱切面",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?xe("Res",function(){}):null,a("8000.0024")||"用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制图谱切面的平移。用户也可以通过按下键盘上的“R”,将范围选取操作从平移模式切换为旋转模式。此时箭头会变为球形,沿球形拖动,就可以控制图谱切面的旋转。"),placement:"center",target:ir.current},{title:a("8000.0044")||"下载高分辨率的STAM图谱3D标签图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing2.gif`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?xe("Res",function(){}):null,a("8000.0025")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。点击viewer higher resolution image按钮可以跳转到任意剖面可视化界面。点击Requesting STAM labels按钮,填入许可证即可下载各向同性10微米分辨率的STAM图谱3D标签图像。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],da=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?xe("Neu",function(){}):null,S.createElement("div",null,a("8000.0026")||"我们提供全脑的胞体或投射靶区的神经环路数据可视化服务。用户可以选择感兴趣的任意胞体或投射靶区在脑区、核团的神经环路数据,并查看数据对应的脑区、核团标注。"),S.createElement("div",null,a("8000.0027")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同,其中Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。"),S.createElement("div",null,a("8000.0028")||"如②所示,用户可以在搜索框中搜索感兴趣脑区、核团。"),S.createElement("div",null,a("8000.0029")||"如③所示,这是一个由若干个脑区、核团子结构组成的神经环路连接示意图。")),cover:S.createElement("video",{src:`${n}/guide/neuronal.mp4`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:ir.current,style:{width:"min-content"}},{title:a("8000.0045")||"查看神经环路连接示意图并交互",cover:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?xe("Neu",function(){}):null,a("8000.0030")||"用户可以点击“whole-brain connectivity diagram”按钮或在搜索框中搜索感兴趣脑区、核团,即可弹出由若干个脑区、核团子结构组成的神经环路连接示意图。不同圆点表示不同的脑区、核团结构,圆点旁边显示的是脑区、核团的名称。用户可以将鼠标移动到圆点、脑区或核团的名称上,左击或右击圆点。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0046")||"显示用户指定脑区上下游连接关系",cover:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?xe("Neu",function(){}):null,a("8000.0031")||"双击任意一个代表某个脑区、核团结构的圆点,神经环路连接示意图窗口隐藏,回到主窗口页面,显示该结构的上下游连接关系。在Upstream窗口中展示了投射到选中脑区、核团的神经环路,在Downstream窗口中展示了选中脑区、核团的投射靶区。用户可以用复选框选择任意数量的感兴趣神经元,在主窗口中可视化。"),target:s.current,placement:"right"}];S.useEffect(()=>{const Ce=Eh("index"),$e=Eh("type"),Ke=Eh("structure");($e||Ce)&&setTimeout(()=>{switch(Ce=="Assembling"?(!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false")&&Ht(!0):Ce=="Virtual_Inject"?(!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false")&&Yt(!0):Ce=="Slicing"?(!localStorage.getItem("Res")||localStorage.getItem("Res")==="false")&&jn(!0):Ce=="Mapping"?(!localStorage.getItem("Map")||localStorage.getItem("Map")==="false")&&jn(!0):Ce=="Downloading"?(!localStorage.getItem("Down")||localStorage.getItem("Down")==="false")&&Tr(!0):Ce=="Neuronal"?(!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false")&&zn(!0):Ce=="Registration"&&(!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false")&&In(!0),$e){case"simple":document.title="STAM-SimpleViewer",fe(0);case"normal":uo(1,!0),document.title="STAM-NormalViewer";break;case"virtual":document.title="STAM-Surgery",uo(2,!0);break;case"slicing":uo(3,!0),document.title="STAM-Reslicing";break;case"registration":uo(4,!0),document.title="STAM-Registration";break;case"downloading":uo(5,!0),document.title="STAM-Downloading";break;case"mapping":uo(6,!0),document.title="STAM-AtlasMapping";break;case"circuits":uo(7,!0),document.title="STAM-NeuronalCircuits",setTimeout(()=>{Ke&&(io(Ke),ke(Ke))},500);break;case"other":uo(8,!0),document.title="STAM-OtherAtlas";break;case"setting":uo(9,!0),document.title="STAM-ViewSetting";break;case"functionalLoop":uo(12,!0),document.title="STAM-FunctionalLoop";break}},500)},[]),S.useEffect(()=>{Xe.current=(f==null?void 0:f.domElement.clientWidth)-1,et.current=(f==null?void 0:f.domElement.clientHeight)-1;let Ce=-(Fr.min.x+Fr.max.x)*Hi.current/2,$e=Fr.max.clone().multiplyScalar(Hi.current).add(new Ie(Ce,Ya.current,ja.current)),Ke=Fr.min.clone().multiplyScalar(Hi.current).add(new Ie(Ce,Ya.current,ja.current));$t.current=$e,Ft.current=Ke;let lt=new Ml({visible:!1});if(dn.current=new Jn(new zs($t.current.x-Ft.current.x,$t.current.y-Ft.current.y,$t.current.z-Ft.current.z),lt),dn.current.position.set(($t.current.x+Ft.current.x)/2,($t.current.y+Ft.current.y)/2,($t.current.z+Ft.current.z)/2),Ab(),G7){let Rt=G7;Rt=="CCF"&&py({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En),Rt=="WHS"&&py({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En)}},[]),S.useEffect(()=>{Xe.current=(f==null?void 0:f.domElement.clientWidth)-1,et.current=(f==null?void 0:f.domElement.clientHeight)-1},[f==null?void 0:f.domElement.clientWidth]),S.useEffect(()=>{const Ce=new rs;Ce.expandByObject(It.current);const $e=R.current(Ce.min.clone()),Ke=R.current(Ce.max.clone());let lt=new Jp(Pp(650,620,`${$e.x.toFixed(2)},${$e.y.toFixed(2)},${$e.z.toFixed(2)}`,"#ccc")),Rt=new mp(new $f({map:lt}));Rt.name="startText";let Jt=new Jp(Pp(650,620,`${Ke.x.toFixed(2)},${Ke.y.toFixed(2)},${Ke.z.toFixed(2)}`,"#ccc")),rn=new mp(new $f({map:Jt}));rn.name="endText",Rt.position.set(Ce.min.x,Ce.min.y+.2,Ce.min.z),rn.position.set(Ce.max.x,Ce.max.y+.6,Ce.max.z);let hn=_e.current.getObjectByName("startText"),pn=_e.current.getObjectByName("endText");hn&&pn&&(_e.current.remove(hn,pn),_e.current.add(Rt,rn))},[Q]),S.useEffect(()=>{var Cr,sr;let Ce={},$e=[],Ke=[],lt={},Rt=[],Jt=[],rn="",hn=new URL(window.location.href),pn=new URLSearchParams(hn.search);if(ge&&Be.length>0){if(rn=we&&Rl(Be,we),we==""){_.current.removeFBX(za.current,!0);const Cn=_.current.checkedKeys.current.findIndex(ar=>ar===za.current);Cn>-1&&_.current.checkedKeys.current.splice(Cn,1),we==""&&(za.current="");const ur=JSON.stringify(_.current.checkedKeys.current);pn.delete("echart_Value"),pn.set("regionsChecked",ur),hn.search=pn.toString(),window.history.replaceState({},"",hn)}if(we!=""){if(rn==null&&we)if(we=="fiber tract fiber tracts")rn="fiber tract";else{let Cn=we.match(/^[\w\/]+/);rn=Cn?Cn[0]:""}if(rn){let Cn=((Cr=ge[rn])==null?void 0:Cr.soma)||[];Rt=Rt.concat(Cn);let ur=((sr=ge[rn])==null?void 0:sr.axon)||[];Jt=Jt.concat(ur),Rt=Array.from(new Set(Rt)),Jt=Array.from(new Set(Jt)),Jt&&Jt.forEach(Fi=>{var sa,fl,Jo;for(const $a in ge)(fl=(sa=ge[$a])==null?void 0:sa.soma)!=null&&fl.includes(Fi)&&((Jo=ge[$a])==null?void 0:Jo.id)==1&&($a in Ce?Ce[$a].includes(Fi)||Ce[$a].push(Fi):Ce[$a]=[Fi])}),Rt&&Rt.forEach(Fi=>{var sa,fl,Jo;for(const $a in ge)(fl=(sa=ge[$a])==null?void 0:sa.axon)!=null&&fl.includes(Fi)&&((Jo=ge[$a])==null?void 0:Jo.id)==1&&($a in lt?lt[$a].includes(Fi)||lt[$a].push(Fi):lt[$a]=[Fi])});for(let Fi in lt)if(Fi!=rn){let sa=ad(Be,Fi.replace("_","/"));sa&&Ke.push({name:Fi.replace("_","/"),itemStyle:{color:sa.color},lineStyle:{color:"#ccc"},value:lt[Fi].length})}for(let Fi in Ce)if(Fi!=rn){let sa=ad(Be,Fi.replace("_","/"));sa&&$e.push({name:Fi.replace("_","/"),itemStyle:{color:sa.color},lineStyle:{color:"#ccc"},value:Ce[Fi].length})}Il(!0);let ar=ad(Be,rn.replace("_","/"));const Er=[{name:rn.replace("_","/"),itemStyle:{color:ar&&ar.color},lineStyle:{color:"#ccc"},children:$e}],Qr=[{name:rn.replace("_","/"),itemStyle:{color:ar&&ar.color},lineStyle:{color:"#ccc"},children:Ke}];if(za.current!=rn){_.current.removeFBX(za.current,!0);const Fi=_.current.checkedKeys.current.findIndex(Jo=>Jo===za.current);Fi>-1&&_.current.checkedKeys.current.splice(Fi,1);const sa=ad(_.current.treeDatas,rn.replace("_","/"));let fl=n+"/data/FBX/"+rn+".FBX";sa&&bd(fl,rn,sa.color,.8,0,"FBX"),_.current.checkedKeys.current.push(rn),te(_.current.checkedKeys.current),za.current=rn,pn.set("echart_Value",we||""),hn.search=pn.toString(),window.history.replaceState({},"",hn)}const Ba={series:[{type:"tree",top:"1%",bottom:"1%",symbolSize:7,emphasis:{focus:"ancestor",lineStyle:{color:"#000"}},expandAndCollapse:!0,animationDuration:550,animationDurationUpdate:750}]};if(Ls.current&&_s.current){_s.current.style.height=Ke.length*2*10+"px",Ls.current.style.height=$e.length*2*10+"px";const Fi=t7(Ls.current);Fi.setOption({...Ba,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Xa,Es,Ol,kp,ef){const Mg=Xa[0],kc=Xa[1];return[Mg+10,kc]},formatter:function(Xa){const Es=rn==Xa.name?"":Xa.name+"->",Ol=Xa.value?", "+Xa.value+" neurons":"";return`${Es}${rn}${Ol}`}},series:[{...Ba.series[0],left:"30%",right:"30%",label:{position:"right",verticalAlign:"middle",align:"left"},leaves:{label:{position:"left",verticalAlign:"middle",align:"right"}},orient:"RL",data:Er}]});const sa=t7(_s.current);sa.setOption({...Ba,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Xa,Es,Ol,kp,ef){const Mg=Xa[0],kc=Xa[1],sd=ef.contentSize[0];return[Mg-sd-10,kc]},formatter:function(Xa){const Es=rn==Xa.name?"":"->"+Xa.name+", "+Xa.value+" neurons";return`${rn}${Es}`}},series:[{...Ba.series[0],left:"20%",right:"40%",label:{position:"left",verticalAlign:"middle",align:"right"},leaves:{label:{position:"right",verticalAlign:"middle",align:"left"}},orient:"LR",data:Qr}]});const fl=()=>{Fi.resize(),sa.resize()},Jo=Xa=>{if(re(Tt.indexOf("neurons")+1),Se.current.ProcessedData.current=!1,Xa.data&&Xa.data.name){Se.current.setSearchValue(rn.replace("_","/")),Se.current.setSomaValue(Xa.data.name.replace("_","/"));const Es=vc(Er[0],Xa.data.name);Fi.setOption({series:[{data:[Es]}]}),sa.setOption({series:[{data:Qr}]})}},$a=Xa=>{if(re(Tt.indexOf("neurons")+1),Se.current.ProcessedData.current=!1,Xa.data&&Xa.data.name){Se.current.setSearchValue(Xa.data.name.replace("_","/")),Se.current.setSomaValue(rn.replace("_","/"));const Es=vc(Qr[0],Xa.data.name);sa.setOption({series:[{data:[Es]}]}),Fi.setOption({series:[{data:Er}]})}};return window.addEventListener("resize",fl),Fi.on("click",Jo),sa.on("click",$a),Er[0].children[0]&&Jo({data:{name:Er[0].children[0].name}}),Ui({Upstream:$e,Downstream:Ke}),()=>{Fi.off("click",Jo),sa.off("click",$a),window.removeEventListener("resize",fl),Fi.dispose(),sa.dispose()}}}}else Il(!1),_s.current&&Ls.current&&(_s.current.style.height="0px",Ls.current.style.height="0px"),Ui({})}},[we,Be,ge]),S.useEffect(()=>{const Ce=Eh("index"),$e=Eh("type"),Ke=(Ce||$e)&&sl.current;if(Y===2)sl.current?(uo(2,!0,!Ke),sl.current=!1):uo(2),Jr(!0),p.current.noRotate=!0,p.current.noPan=!0,f.domElement.addEventListener("mousedown",vT),f.domElement.addEventListener("mousemove",Ha),f.domElement.addEventListener("mouseup",Rb),W(1);else{_e.current.rotation.set(0,0,0),p.current.noRotate=!1,p.current.noPan=!1,f.domElement.removeEventListener("mousedown",vT),f.domElement.removeEventListener("mousemove",Ha),f.domElement.removeEventListener("mouseup",Rb),W(3),nC(),sl.current?(uo(1,!0,!Ke),sl.current=!1):uo(1),V(!1);const lt=_e.current.getObjectByName("targetPoint");lt&&_e.current.remove(lt)}},[Y]),S.useEffect(()=>{Oi.length>0&&st(!0)},[Oi]);const us=Ce=>{const{positionx:$e,positiony:Ke,positionz:lt}=Ce;let Rt=new URL(window.location.href),rn=new URLSearchParams(Rt.search).get("atlasReslicingInfo"),hn={};rn&&(hn=JSON.parse(rn)),Dt($e),Zt(Ke),en(lt),hn.positionX=$e,hn.positionY=Ke,hn.positionZ=lt;let pn=new Ie($e,Ke,lt);qa.atlasReslicingInfo=hn,qa.sectionPointPosition=pn,ll.current&&ll.current.position.set(pn.x,pn.y,pn.z)},Vo=Ce=>{qi(Ce)},uo=(Ce,$e=!1,Ke=!0)=>{if(Ce==vr)return;if(_e.current.remove(ll.current),fr(Ce),he({}),Le(0),Y===0&&Ce=="1"?Lg("0",Ke,$e):Lg(Ce,Ke,$e),$e||(Ce=="7"||Ce=="3"?aC(!0):aC(!1)),E&&(E.current=Ce),Ce!==2){const Jo=_e.current.getObjectByName("syrings");Jo&&_e.current.remove(Jo),V(!1),$e||Xc()}if(Ce==2){ki.current.position.set(18,-10,-10),ki.current.rotation.set(2.9896,0,0),p.current.reset(),p.current.target.set(0,0,0),p.current.object.position.set(18,-10,-10),p.current.object.up.set(0,-1,0),p.current.update(),ki.current.updateMatrixWorld();const Jo=JSON.stringify({cameraPosition:ki.current.position,cameraRotation:ki.current.rotation}),$a=JSON.stringify({controlsTarget:p.current.target,controlsPosition:p.current.object.position,controlsUp:p.current.object.up});let Xa=new URL(window.location.href),Es=new URLSearchParams(Xa.search);Es.set("cameraInfo",Jo),Es.set("controllerInfo",$a),Xa.search=Es.toString(),window.history.replaceState({},"",Xa)}Ab(),zi([]),Ia("Config_DAPI.ini"),Fn.current=null,Ua({}),$e||ae.current&&Se.current&&_.current&&(ae.current.removeALL(),Se.current.removeALL(),_.current.removeALL()),Ce==1?x(!0):x(!1),pt(a("4000.0208")||"选择靶点"),l(""),y.current=!1,d.current=!1;const lt=_e.current.getObjectByName("sphereBig"),Rt=_e.current.getObjectByName("sphereMiddelClick"),Jt=_e.current.getObjectByName("dashedLine"),rn=_e.current.getObjectByName("Line"),hn=_e.current.getObjectByName("transformControls"),pn=_e.current.getObjectByName("sectionSphere"),Cr=_e.current.getObjectByName("correspondingPlaneDataSwc"),sr=_e.current.getObjectByName("azimuth"),Cn=[];_e.current.traverse(Jo=>{Jo.userData.isAtlasMapping==="true"&&Cn.push(Jo)}),Cn.forEach(Jo=>{_e.current.remove(Jo)}),sr&&_e.current.remove(sr),Cr&&_e.current.remove(Cr),pn&&_e.current.remove(pn),hn&&_e.current.remove(hn),m.current=[],b.current=[],Jt&&_e.current.remove(Jt),rn&&_e.current.remove(rn),lt&&_e.current.remove(lt),Rt&&_e.current.remove(Rt);const ur=_e.current.children.filter(Jo=>Jo.userData.name==="registrationPng");ur&&_e.current.remove(...ur),U.current=!1;const ar=_e.current.children.filter(Jo=>Jo.name==="brainRegionPoints"||Jo.name==="brainRegionLine"||Jo.name==="cardContainer");ar&&_e.current.remove(...ar),P(!1);const Er=_e.current.getObjectByName("HorizontalView"),Qr=_e.current.getObjectByName("SagittalView"),Ba=_e.current.getObjectByName("arbitrarySlice"),Fi=_e.current.getObjectByName("CoronalView"),sa=_e.current.getObjectByName("functionLoopGroup");sa&&sa.remove(...sa.children),Ce!=3&&(Er&&(_e.current.remove(Er),Un(!1)),Qr&&(_e.current.remove(Qr),Dn(!1)),Ba&&(_e.current.remove(Ba),gi(!1)),Fi&&(_e.current.remove(Fi),Kr(!1))),Ce==3&&setTimeout(()=>{zl(ze.current,$e)},10),Gu(!1),k8(),gt(1);const fl=document.querySelector(".tabsCompnent .ant-tabs-content-holder");fl&&Ce==12?fl.style.padding="0px":fl.style.padding="10px"},Ms=Ce=>{r(Ce),i.current=Ce},vc=(Ce,$e)=>{const Ke=JSON.parse(JSON.stringify(Ce)),lt=Rt=>{Rt.name===$e?Rt.lineStyle.color="#000":Rt.lineStyle.color="#ccc",Rt.children&&Rt.children.forEach(Jt=>{lt(Jt)})};return lt(Ke),Ke},Rl=(Ce,$e)=>{for(let Ke of Ce){if(Ke.name.toLowerCase()===$e.toLowerCase()||Ke.fullname.toLowerCase()===$e.toLowerCase())return Ke.name;if(Ke.children){const lt=Rl(Ke.children,$e);if(lt)return lt}}return null},Ad=()=>{y.current=!y.current,d.current=!1,v.current&&_e.current.remove(v.current)},Rd=()=>{if(d.current=!1,ot==(a("4000.0208")||"选择靶点"))pt(a("4000.0242")||"清除靶点");else if(ot===(a("4000.0126")||"重置"))an(0),G.current="",pt(a("4000.0208")||"选择靶点"),V(!1),Xc(),W(1),gt(1),Ov.current&&(Ov.current.abort(),Ov.current=null);else{pt(a("4000.0208")||"选择靶点"),m.current=[],b.current=[],gt(1),V(!1);const Ce=_e.current.getObjectByName("dashedLine"),$e=_e.current.getObjectByName("sphereBig"),Ke=_e.current.getObjectByName("sphereMiddelClick"),lt=_e.current.getObjectByName("targetPoint"),Rt=_e.current.getObjectByName("azimuth"),Jt=_e.current.getObjectByName("azimuth_outline"),rn=_e.current.getObjectByName("azimuth_edge");rn&&_e.current.remove(rn),Rt&&_e.current.remove(Rt),Jt&&_e.current.remove(Jt),Ce&&$e&&_e.current.remove(Ce,$e),Ke&&_e.current.remove(Ke),lt&&_e.current.remove(lt),d.current=!1}Ad()};S.useEffect(()=>{j&&si==0&&cr(!0),si!=0&&j&&pt(a("4000.0126")||"重置")},[j]);const Xc=()=>{m.current=[],b.current=[];const Ce=_e.current.getObjectByName("dashedLine"),$e=_e.current.getObjectByName("sphereBig"),Ke=_e.current.getObjectByName("sphereMiddelClick"),lt=_e.current.getObjectByName("targetPoint"),Rt=_e.current.getObjectByName("azimuth"),Jt=_e.current.getObjectByName("azimuth_outline"),rn=_e.current.getObjectByName("azimuth_edge");rn&&_e.current.remove(rn),Rt&&_e.current.remove(Rt),Jt&&_e.current.remove(Jt),Ce&&$e&&_e.current.remove(Ce,$e),Ke&&_e.current.remove(Ke),lt&&_e.current.remove(lt),nC(),P(!1),H.current=[],y.current=!0,d.current=!1,U.current=!1,_.current.removeALL(),v.current&&_e.current.remove(v.current),re(1),l("")};function ac(){if(!vs.current||!vs.current.startsWith("data:image/png;base64,")){alert("Please enter a valid Base64 encoded PNG string (e.g., data:image/png;base64,...).");return}const Ce=document.createElement("a");Ce.href=vs.current,Ce.download="downloaded_image.png";const $e=document.createElement("a");$e.href="/staticresource/data/json/rgb_value.zip",$e.download="rgb_value.zip",document.body.appendChild($e),document.body.appendChild(Ce),$e.click(),setTimeout(()=>{Ce.click();let Ke=new URL(window.location.href),Rt=new URLSearchParams(Ke.search).get("type");const Jt=window.location.origin+window.location.pathname+`?type=${Rt}&currentSlice=2d`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Jt,time:0})}).then(rn=>rn.json()).then(rn=>{})},200),document.body.removeChild($e),document.body.removeChild(Ce)}const Vl=(Ce,$e)=>{clearTimeout(Td.current),Td.current=setTimeout(()=>{const Ke=_e.current.getObjectByName("Brain");let lt=new vo;lt.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);let Rt=new Ie,Jt=new fS;if($e)if(Ke&&(Rt=$e.position.clone().applyMatrix4(Ke.matrixWorld.clone().invert()).applyQuaternion(lt)),Ce==1)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:Rt.z})}).then(rn=>rn.ok?rn.json():Wo.error({title:rn.message})).then(rn=>{const hn=rn.base64;vs.current=hn;let pn=Jt.load(hn);pn.center.set(.5,.5),pn.rotation=Math.PI,$e.material.map=pn});else if(Ce==2)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Rt.x,y:0,z:0})}).then(rn=>rn.ok?rn.json():Wo.error({title:rn.message})).then(rn=>{const hn=rn.base64;let pn=Jt.load(hn);const sr=$e.geometry.attributes.uv.array,Cn=ar=>{sr[ar+0]=1,sr[ar+1]=0,sr[ar+2]=1,sr[ar+3]=1,sr[ar+4]=0,sr[ar+5]=0,sr[ar+6]=0,sr[ar+7]=1},ur=ar=>{sr[ar+0]=1,sr[ar+1]=1,sr[ar+2]=1,sr[ar+3]=0,sr[ar+4]=0,sr[ar+5]=1,sr[ar+6]=0,sr[ar+7]=0};Cn(0),ur(8),$e.geometry.attributes.uv.needsUpdate=!0,$e.material.map=pn});else if(Ce==3)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Rt.y,z:0})}).then(rn=>(rn.ok,rn.json())).then(rn=>{if(rn.message){Wo.error({content:rn.message});return}const hn=rn.base64;vs.current=hn;let pn=Jt.load(hn);const sr=$e.geometry.attributes.uv.array;(ur=>{sr[ur+0]=1,sr[ur+1]=0,sr[ur+2]=0,sr[ur+3]=0,sr[ur+4]=1,sr[ur+5]=1,sr[ur+6]=0,sr[ur+7]=1})(24),$e.geometry.attributes.uv.needsUpdate=!0,$e.material.map=pn});else{const rn=$e.rotation.x/Math.PI*180,hn=$e.rotation.y/Math.PI*180,pn=$e.rotation.z/Math.PI*180;fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[rn,hn,pn],center:[Rt.x,Rt.y,Rt.z]})}).then(Cr=>Cr.ok?Cr.json():Wo.error({title:Cr.message})).then(Cr=>{const sr=Cr.base64;vs.current=sr;let Cn=Jt.load(sr);const ar=$e.geometry.attributes.uv.array;(Qr=>{ar[Qr+0]=0,ar[Qr+1]=0,ar[Qr+2]=1,ar[Qr+3]=0,ar[Qr+4]=0,ar[Qr+5]=1,ar[Qr+6]=1,ar[Qr+7]=1})(24),$e.geometry.attributes.uv.needsUpdate=!0,$e.material.map=Cn})}},100)},Eo=(Ce,$e)=>{let Ke,lt=0,Rt=new URL(window.location.href),rn=new URLSearchParams(Rt.search).get("atlasReslicingInfo"),hn={};rn&&(hn=JSON.parse(rn)),ze.current==1?(_e.current.children.forEach(function(pn,Cr){$e==3&&pn.name=="CoronalView"&&(lt=Cr)}),Ke=new Ie(0,0,Ce),_e.current.children[lt].position.setZ(Ke.z),Vl(ze.current,_e.current.children[lt])):ze.current==2?(_e.current.children.forEach(function(pn,Cr){$e==1&&pn.name=="SagittalView"&&(lt=Cr)}),Ke=new Ie(Ce,0,0),_e.current.children[lt].position.setX(Ke.x),Vl(ze.current,_e.current.children[lt])):ze.current==3?(_e.current.children.forEach(function(pn,Cr){$e==2&&pn.name=="HorizontalView"&&(lt=Cr)}),Ke=new Ie(0,Ce,0),_e.current.children[lt].position.setY(Ke.y),Vl(ze.current,_e.current.children[lt])):ze.current==4&&(_e.current.children.forEach(function(pn,Cr){pn.name=="arbitrarySlice"&&(lt=Cr)}),$e==3&&(en(Ce),hn.positionZ=Ce,qa.atlasReslicingInfo=hn,Ke=new Ie(Nt,Lt,Ce),_e.current.children[lt].position.setZ(Ke.z)),$e==2&&(Zt(Ce),hn.positionY=Ce,qa.atlasReslicingInfo=hn,Ke=new Ie(zt,Ce,zt),_e.current.children[lt].position.setY(Ke.y)),$e==1&&(Dt(Ce),hn.positionX=Ce,qa.atlasReslicingInfo=hn,Ke=new Ie(Ce,Lt,zt),_e.current.children[lt].position.setX(Ke.x)),Vl(ze.current,_e.current.children[lt]))},ju=Ce=>{let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("atlasReslicingInfo"),Rt={};lt&&(Rt=JSON.parse(lt)),ze.current==2&&(Dt(Ce),Zt(-5.33),en(-8),Eo(Ce,1),Rt.positionX=Ce,Rt.positionY=-5.33,Rt.positionZ=-8,qa.atlasReslicingInfo=Rt),ze.current==4&&Eo(Ce,1)},Qd=Ce=>{let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("atlasReslicingInfo"),Rt={};lt&&(Rt=JSON.parse(lt)),ze.current==3&&(Zt(Ce),en(-8),Dt(-5.17),Rt.positionX=-5.17,Rt.positionY=Ce,Rt.positionZ=-8,qa.atlasReslicingInfo=Rt,Eo(Ce,2)),ze.current==4&&Eo(Ce,2)},Ps=Ce=>{let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("atlasReslicingInfo"),Rt={};lt&&(Rt=JSON.parse(lt)),ze.current==1&&(en(Ce),Dt(-5.17),Zt(-5.33),Eo(Ce,3),Rt.positionX=-5.17,Rt.positionY=-5.33,Rt.positionZ=Ce,qa.atlasReslicingInfo=Rt),ze.current==4&&Eo(Ce,3)},Wu=(Ce,$e)=>{let Ke=0,lt=new URL(window.location.href),Jt=new URLSearchParams(lt.search).get("atlasReslicingInfo"),rn={};Jt&&(rn=JSON.parse(Jt)),_e.current.children.forEach(function(Cn,ur){Cn.name=="arbitrarySlice"&&(Ke=ur)});let hn=_e.current.children[Ke];hn.rotation.set(hn.userData.initRotation.x,hn.userData.initRotation.y,hn.userData.initRotation.z);let pn=0,Cr=0,sr=0;$e==1&&(mt(Ce),rn.angleX=Ce,qa.atlasReslicingInfo=rn,pn=Ce*Math.PI/180,Cr=Vt*Math.PI/180,sr=Fe*Math.PI/180),$e==2&&(fn(Ce),rn.angleY=Ce,qa.atlasReslicingInfo=rn,pn=pr*Math.PI/180,Cr=Ce*Math.PI/180,sr=Fe*Math.PI/180),$e==3&&(_t(Ce),rn.angleZ=Ce,qa.atlasReslicingInfo=rn,pn=pr*Math.PI/180,Cr=Vt*Math.PI/180,sr=Ce*Math.PI/180),hn.rotation.x=pn,hn.rotation.y=Cr,hn.rotation.z=sr,_e.current.children.forEach(function(Cn,ur){Cn.name=="arbitrarySlice"&&(Ke=ur)}),Vl(ze.current,_e.current.children[Ke])},Cl=(Ce,$e=!1)=>{let Ke;const lt=Ce||o;if(ze.current==4||$e)setTimeout(()=>{let Rt="atlas.brainsmatics.org",Jt=[],rn=parseInt(((zt+8)/14*14e3).toString()),hn=parseInt(((Lt+5.33)/7.37*9e3).toString());$e?(Jt[0]=90+Dr.angles[0],Jt[1]=Dr.angles[1],Jt[2]=Dr.angles[2],rn=Dr.tx*14e3,hn=450):(Jt[0]=pr,Jt[1]=Vt,Jt[2]=Fe);let pn=parseInt(((Nt+5.17)/10.34*11400).toString()),Cr=ct||"http://"+Rt,sr="http://"+Rt+'/program/frontend/#!{"dimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"position":['+pn+","+hn+","+rn+'],"crossSectionOrientation":[0.7071067690849304,0,0,-0.7071067690849304],"crossSectionScale":19.05662684586283,"projectionOrientation":[0.10079027712345123,0.01086505874991417,-0.5527856945991516,-0.827134370803833],"projectionScale":74319.80669416502,"projectionDepth":-49.99956451007631,"layers":[{"type":"image","source":{"url":"precomputed://'+Cr+'/data/RGB_raw","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]},"inputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]}}},"tab":"rendering","shader":"#uicontrol invlerp normalized\\nvoid main() {\\n emitRGB(vec3(toNormalized(getDataValue(0)),\\n toNormalized(getDataValue(1)),\\n toNormalized(getDataValue(2))));\\n}\\n","channelDimensions":{"c^":[1,""]},"name":"raw"},{"type":"segmentation","source":{"url":"precomputed://'+Cr+'/data/seg_half","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"inputDimensions":{"x":[0.00001,"m"],"y":[0.00001,"m"],"z":[0.00001,"m"]}}},"tab":"segments","segments":["10","100","1000","1002","1004","1005","1006","1007","1008","1009","1010","1011","1012","1013","1014","1015","1016","1017","1018","1019","1020","1021","1022","1023","1024","1025","1026","1100","104","105","106","107","108","11","110","111","112","113","114","115","117","118","119","12","120","122","123","124","125","126","129","13","130","131","134","138","14","141","142","143","146","147","149","15","150","152","154","156","159","16","160","162","164","165","166","167","168","170","172","173","174","176","177","178","179","18","180","181","182","183","186","189","19","190","192","193","194","195","196","199","2","20","201","202","203","204","206","207","208","21","212","215","216","217","219","22","220","221","223","224","225","228","229","23","230","231","232","234","235","236","237","238","239","24","241","242","243","245","246","247","248","25","250","251","253","254","256","257","259","26","260","265","266","267","268","27","271","272","273","275","276","279","28","280","282","283","284","287","29","291","293","294","295","296","297","298","3","30","300","303","304","305","306","31","311","312","313","315","319","32","320","321","322","323","324","325","326","329","33","330","331","332","333","335","336","337","338","34","340","341","342","343","344","347","348","349","35","350","351","352","354","355","356","357","359","36","361","362","365","366","367","368","369","37","371","372","373","374","375","376","377","378","38","380","385","386","387","389","39","390","391","392","393","394","395","397","399","4","40","401","402","405","407","409","41","412","413","414","415","416","417","419","42","422","423","424","426","427","428","43","430","432","435","438","439","44","440","441","442","443","444","445","446","449","45","450","451","452","453","454","456","458","459","46","460","461","462","463","464","465","466","467","47","470","473","474","475","476","478","479","48","480","481","484","485","486","487","488","49","490","491","493","494","497","498","499","5","50","500","501","503","504","505","507","508","51","510","511","512","513","514","516","517","518","519","52","520","528","529","53","533","535","536","537","538","539","54","540","541","542","544","545","546","548","549","55","550","553","554","555","556","557","559","56","561","562","563","565","568","57","570","571","572","573","574","575","576","578","579","58","581","582","584","586","59","591","593","594","595","597","599","6","60","601","602","604","606","61","611","612","613","614","615","616","617","618","619","62","620","621","622","623","624","625","627","628","629","63","631","632","635","637","638","639","64","641","642","643","644","645","646","647","648","65","650","652","653","656","657","658","660","661","662","665","666","667","67","671","672","673","674","677","678","679","68","680","681","682","683","684","686","687","688","690","693","695","696","697","698","699","7","701","702","704","706","707","708","709","710","711","712","713","716","717","72","720","721","722","724","725","727","729","731","733","734","735","736","737","74","740","744","746","748","749","750","752","754","755","757","758","759","76","760","762","763","764","765","767","768","769","770","771","772","773","774","775","776","778","779","78","780","783","784","785","787","789","790","791","793","796","797","798","799","8","80","803","804","808","809","81","810","812","816","818","819","82","821","823","824","826","827","829","83","830","831","832","834","835","837","839","84","840","841","842","843","844","846","849","850","851","855","856","857","858","86","861","863","864","865","867","868","869","87","870","871","872","874","875","876","877","878","879","88","880","881","883","885","888","889","89","892","893","894","895","896","898","899","9","90","901","902","906","908","909","91","911","913","915","916","917","919","92","920","921","925","926","927","928","929","93","931","934","935","936","937","938","940","941","942","944","945","946","951","953","954","955","956","957","959","96","963","964","965","966","969","97","970","971","972","973","977","978","980","981","982","983","989","99","991","992","993","995","996","997","998","999"],"segmentQuery":"<id","segmentColors":{"2":"#777b7b","3":"#777979","4":"#848989","5":"#8e9494","6":"#8c9191","7":"#778383","8":"#778181","9":"#93a2a2","10":"#5e6767","11":"#93c1c1","12":"#6b7474","13":"#93c0c0","14":"#8eacac","15":"#727979","16":"#91afaf","18":"#93b4b4","19":"#729c9c","20":"#212d2d","21":"#304242","22":"#2d3e3e","23":"#2b3232","24":"#1e2929","25":"#707676","26":"#7c8383","27":"#89bbbb","28":"#608383","29":"#7c9d9d","30":"#777d7d","31":"#7a8080","32":"#778080","33":"#7f8585","34":"#6d8a8a","35":"#829d9d","36":"#545d5d","37":"#93a4a4","38":"#4c5454","39":"#474f4f","40":"#8cbebe","41":"#7a9a9a","42":"#93b8b8","43":"#84a0a0","44":"#93a1a1","45":"#93baba","46":"#84b4b4","47":"#6d9595","48":"#82b0b0","49":"#6b9191","50":"#7fadad","51":"#87a3a3","52":"#636c6c","53":"#596363","54":"#334545","55":"#2b3b3b","56":"#666f6f","57":"#476161","58":"#939898","59":"#637e7e","60":"#7aa0a0","61":"#7fa5a5","62":"#444d4d","63":"#f2bb3a","64":"#77d1ff","65":"#3ddeff","67":"#2cc15e","68":"#ffd877","72":"#ffbfad","74":"#e5d60b","76":"#40c3dd","78":"#f7e1af","80":"#3bdddd","81":"#a0dfff","82":"#d67259","83":"#ffab93","84":"#f2c04b","86":"#91503f","87":"#3cabc1","88":"#3db4cc","89":"#f7d585","90":"#723f32","91":"#ffb49e","92":"#f4cf53","93":"#ffbf0f","96":"#f2dca7","97":"#e2d92f","99":"#f4d05a","100":"#399eb2","104":"#4dcc77","105":"#f7da96","106":"#d35dac","107":"#ffd15e","108":"#3cd1d1","110":"#55ccb8","111":"#3aa2b7","112":"#bc782f","113":"#8cccc1","114":"#f7d68a","115":"#82ccbf","117":"#6acc8a","118":"#b2af07","119":"#ffd044","120":"#75d1ff","122":"#ef8064","123":"#37dbfc","124":"#c6499d","125":"#66cbff","126":"#ffc32d","129":"#66ccbb","130":"#f7dea3","131":"#fc957b","134":"#ffb5a0","138":"#84493a","141":"#8accc1","142":"#e5d609","143":"#45d9f7","146":"#d8cb17","147":"#f2dca4","149":"#d1ca06","150":"#ce8333","152":"#67afa3","154":"#f2bd43","156":"#ffcf3f","159":"#f79279","160":"#f29d43","162":"#e5d604","164":"#b2af01","165":"#75e5e5","166":"#ffc83f","167":"#ffbdaa","168":"#74c4ed","170":"#ccc50c","172":"#ffa78e","173":"#42cae5","174":"#a2dcf9","176":"#af702b","177":"#965342","178":"#f4bc04","179":"#51cc7a","180":"#d68733","181":"#3ac4e0","182":"#ffc021","183":"#f7d483","186":"#f2dda9","189":"#3eb766","190":"#72ccbd","192":"#f4927a","193":"#f7dc9e","194":"#d1ca04","195":"#fc976c","196":"#fc67ca","199":"#52e5e5","201":"#ffd366","202":"#ffca2d","203":"#ed9436","204":"#ffe7a0","206":"#74ccbd","207":"#33cc66","208":"#36d9f9","212":"#71e2e2","215":"#edd39c","216":"#d38634","217":"#ed9b44","219":"#ccc345","220":"#60e5e5","221":"#c96b54","223":"#ccc62a","224":"#34d0ef","225":"#ffd454","228":"#ea9a44","229":"#f4cf55","230":"#3bcece","231":"#a85c4a","232":"#ffad96","234":"#ffd97a","235":"#ffda7f","236":"#ffc61c","237":"#c6c00d","238":"#f2b935","239":"#ffc107","241":"#ffdf89","242":"#64e5e5","243":"#edca80","245":"#ccc863","246":"#ea7d62","247":"#c9489e","248":"#3fdbdb","250":"#edd5a3","251":"#2bc45e","253":"#ffca44","254":"#f7d380","256":"#ffc832","257":"#f7e0aa","259":"#ffd351","260":"#6bb6db","265":"#d8cb15","266":"#37cc68","267":"#378c9e","268":"#38c9b1","271":"#6bbaad","272":"#39c2dd","273":"#ffc32b","275":"#37ccb3","276":"#3fc1db","279":"#eab94f","280":"#eab84b","282":"#d37158","283":"#38c4c4","284":"#ffdb82","287":"#f7d588","291":"#f9be48","293":"#f49369","294":"#d149a3","295":"#f4cc49","296":"#63a096","297":"#ffe69e","298":"#ff9b70","300":"#f7a27e","303":"#f7a042","304":"#ccc241","305":"#88ccc0","306":"#eaba52","311":"#34ceed","312":"#d8cc1e","313":"#91daff","315":"#f9c04d","319":"#ff996d","320":"#4be5e5","321":"#ffcdbf","322":"#ddd75a","323":"#ffd263","324":"#e0785e","325":"#70e0e0","326":"#ffcf42","329":"#a4defc","330":"#69b2a6","331":"#67a1bf","332":"#57cc7e","333":"#ffbf11","335":"#ea8e77","336":"#ffc73a","337":"#76c9f2","338":"#7f4638","340":"#c16953","341":"#46defc","342":"#f7e1ad","343":"#68aed1","344":"#ff9367","347":"#c4be0d","348":"#6ab7aa","349":"#ffb805","350":"#639bb7","351":"#38bcff","352":"#ed63bf","354":"#f2bc3e","355":"#ffd154","356":"#f2da9d","357":"#e5d606","359":"#9bddff","361":"#ffc311","362":"#ffbb11","365":"#ffa58e","366":"#ffbe1c","367":"#ffb807","368":"#34c8e5","369":"#c1bb0d","371":"#ffbe0c","372":"#a3e0ff","373":"#774234","374":"#3995a8","375":"#d849a9","376":"#3daf63","377":"#ffe8a3","378":"#41cc6f","380":"#ffc823","385":"#ccc751","386":"#5bcc81","387":"#ccc85f","389":"#41bfd8","390":"#36bca6","391":"#edce8b","392":"#54e5e5","393":"#3baa60","394":"#36a9e2","395":"#ef9637","397":"#ffc72d","399":"#68a89d","401":"#ffcc4c","402":"#fc50c3","405":"#3a9aad","407":"#d17057","409":"#77e5e5","412":"#7ee5e5","413":"#b2af05","414":"#67acce","415":"#f2bf48","416":"#c66c55","417":"#5fccb9","419":"#69bfb0","422":"#f265c3","423":"#ffb90a","424":"#41bf6b","426":"#e861bb","427":"#56c6ff","428":"#80ccbf","430":"#389e5a","432":"#ffda7c","435":"#53ccb7","438":"#57e5e5","439":"#f9c252","440":"#ffc416","441":"#ffd259","442":"#6cccbc","443":"#ffa991","444":"#74c4ef","445":"#eadf07","446":"#ffc023","449":"#f7e3b4","450":"#4fcc79","451":"#ffb6a0","452":"#f99c39","453":"#75caf4","454":"#a55b48","456":"#99dcff","458":"#ff976b","459":"#3fcc6e","460":"#ffbd19","461":"#ccc62c","462":"#35d4f4","463":"#76ccbd","464":"#ffd04f","465":"#ccc861","466":"#3aa35d","467":"#ba7b37","470":"#ffe08c","473":"#ff916d","474":"#37bfa8","475":"#efab0b","476":"#ffa187","478":"#66a59b","479":"#efa802","480":"#754033","481":"#ccc859","484":"#6accbb","485":"#3cad62","486":"#f79b38","487":"#b2af08","488":"#f4cb44","490":"#edcf90","491":"#ffcc35","493":"#ccc855","494":"#43cc70","497":"#ea9335","498":"#44e5e5","499":"#edcc84","500":"#ffa791","501":"#39a0b5","503":"#c9c30c","504":"#ffa389","505":"#ffc430","507":"#f9a47f","508":"#63ccba","510":"#f2dfae","511":"#ffd56b","512":"#a35a47","513":"#e89843","514":"#ffd7cc","516":"#5be5e5","517":"#6bc689","518":"#ffc20c","519":"#ccc85d","520":"#3db6ce","528":"#f2da9f","529":"#ffd051","533":"#35cc67","535":"#dd765d","536":"#39a05c","537":"#f2be46","538":"#3fbad3","539":"#77cef9","540":"#3dbeff","541":"#ed9078","542":"#c14799","544":"#9b5544","545":"#8c4d3d","546":"#ffc10a","548":"#f4be0c","549":"#f7e2b2","550":"#3fbfff","553":"#edd49e","554":"#bf6852","555":"#55cc7d","556":"#368a9b","557":"#bc6651","559":"#ffcd4f","561":"#35cae8","562":"#efa907","563":"#ccc347","565":"#3dd3d3","568":"#59ccb8","570":"#ffce54","571":"#39c0db","572":"#e2da31","573":"#f2bb3c","574":"#93dbff","575":"#824739","576":"#e89135","578":"#82e5e5","579":"#68ccff","581":"#ffd256","582":"#ffdf87","584":"#45dbf9","586":"#e08d35","591":"#ffbc05","593":"#ff906b","594":"#84d6ff","595":"#41c16c","597":"#f24fbc","599":"#ddd75f","601":"#ffe18e","602":"#7be5e5","604":"#36c1aa","606":"#ff8e68","611":"#368ea0","612":"#5bc8ff","613":"#79e5e5","614":"#3ba55f","615":"#a5e1ff","616":"#d64aa7","617":"#ffc61e","618":"#3de5e5","619":"#e24ab0","620":"#c6833b","621":"#edcb82","622":"#59c7ff","623":"#3db565","624":"#f9bb3e","625":"#2bbc5b","627":"#ffcb30","628":"#f9a143","629":"#ffc228","631":"#edcd89","632":"#d8cc1c","635":"#efac0e","637":"#7fd4ff","638":"#35d2f2","639":"#ffcd3a","641":"#ffd9ce","642":"#ffbf1e","643":"#eab84d","644":"#ffc9ba","645":"#41ccb4","646":"#f9ba3b","647":"#cec80c","648":"#f4bd09","650":"#3cb1c9","652":"#ffc528","653":"#ce4aa2","656":"#f4bd07","657":"#5dad78","658":"#ff8c66","660":"#ffbba8","661":"#79d0fc","662":"#ffd559","665":"#ffe69b","666":"#ffd456","667":"#ffca47","671":"#f9c14f","672":"#7a4335","673":"#ffbd0a","674":"#ffde84","677":"#f4ca3f","678":"#659fbc","679":"#3ba5ba","680":"#ffa787","681":"#e87c61","682":"#e8a310","683":"#ffc730","684":"#f9bd45","686":"#ba4693","687":"#ba762e","688":"#eade02","690":"#fc9d37","693":"#e8a412","695":"#eadf04","696":"#f4c93d","697":"#ed7f63","698":"#efaa09","699":"#ffcfc1","701":"#ccc349","702":"#ed4eb8","704":"#ffd35b","706":"#2cc960","707":"#d85fb0","708":"#f4c835","709":"#935141","710":"#3fccb4","711":"#ffce3d","712":"#c46a54","713":"#41c5e0","716":"#8cd8ff","717":"#f765c6","720":"#38bed8","721":"#b2af00","722":"#2bbf5d","724":"#b74792","725":"#f2ba37","727":"#37c6af","729":"#f4cd4b","731":"#3fdfff","733":"#67bcae","734":"#43cce8","735":"#49c2ff","736":"#3bcccc","737":"#f2d896","740":"#f4c93a","744":"#edd5a1","746":"#ffc3b2","748":"#4fbff7","749":"#f2d99b","750":"#3cadc4","752":"#84ccc0","754":"#c67e31","755":"#f4cc46","757":"#f29179","758":"#379b59","759":"#ffa382","760":"#f2deab","762":"#ffe8a5","763":"#ddd75d","764":"#bf792f","765":"#f4bc02","767":"#42c0ff","768":"#e58d77","769":"#ffc535","770":"#62e5e5","771":"#5dcc82","772":"#3ca7bc","773":"#f4d15d","774":"#ffc519","775":"#e84cb4","776":"#45cc72","778":"#6cb8dd","779":"#dd8c35","780":"#edd093","783":"#ffc532","784":"#ffb9a5","785":"#ffd65b","787":"#3dccb4","789":"#80e5e5","790":"#649dba","791":"#f49f44","793":"#67afd3","796":"#40e5e5","797":"#f7dda0","798":"#47ccb5","799":"#ccc857","803":"#45ccb5","804":"#ffbd07","808":"#b2458e","809":"#dd4bad","810":"#a8e2ff","812":"#ffa37c","816":"#40bc69","818":"#6eccbc","819":"#68b1d6","821":"#d88934","823":"#44d7f4","824":"#cc5ba6","826":"#4fc4ff","827":"#3ed6d6","829":"#eabb54","830":"#f9b939","831":"#ffc005","832":"#ffd775","834":"#d18534","835":"#ffd260","837":"#c47d31","839":"#39bfbf","840":"#ffcd51","841":"#ffdd82","842":"#bf4897","843":"#e5d602","844":"#49e5e5","846":"#f74fbf","849":"#e88d76","850":"#f4a07c","851":"#ffaf99","855":"#ffc928","856":"#63cbff","857":"#f4d058","858":"#c45aa1","861":"#30cc64","863":"#c95ca5","864":"#ffd059","865":"#47cc73","867":"#f9b834","868":"#edc97b","869":"#ffca2b","870":"#f4c838","871":"#ffc942","872":"#3cb263","874":"#ffb29b","875":"#ffbd16","876":"#f2d898","877":"#ccc62e","878":"#ffd468","879":"#ccc243","880":"#e25fb7","881":"#ffd1c4","883":"#f9937a","885":"#f29837","888":"#e2da34","889":"#379957","892":"#e2795f","893":"#5faf79","894":"#ffc721","895":"#ffc30f","896":"#65a398","898":"#efa904","899":"#4fccb7","901":"#2bc65f","902":"#ffc83d","906":"#5bccb9","908":"#eab748","909":"#ffb39e","911":"#8e4e3e","913":"#ff9f84","915":"#89d7ff","916":"#edd29a","917":"#6ccc8c","919":"#f2c04d","920":"#3dcc6c","921":"#44d1ed","925":"#ce6e56","926":"#d15eaa","927":"#e59744","928":"#fca580","929":"#39c6c6","931":"#6cc98b","934":"#41c8e2","935":"#6bcdff","936":"#ffd147","937":"#874a3b","938":"#5ec9ff","940":"#f49938","941":"#3fba68","942":"#e060b5","944":"#edc97d","945":"#7cccbe","946":"#5caa76","951":"#a05846","953":"#ffc1af","954":"#ffa57f","955":"#ffa58c","956":"#ffc62b","957":"#ffcf56","959":"#50c3fc","963":"#f7dfa8","964":"#db755c","965":"#82d5ff","966":"#ffd34f","969":"#3db0c6","970":"#38bcbc","971":"#54e2ff","972":"#44c0ff","973":"#f7db99","977":"#ffc5b5","978":"#ffba0c","980":"#ffbb0f","981":"#cc8233","982":"#ccc23f","983":"#ffcc32","989":"#ffc935","991":"#db8a34","992":"#ffa584","993":"#f9bd43","995":"#edcf8e","996":"#37baba","997":"#66aacc","998":"#43ccb5","999":"#3eb8d1","1000":"#db5eb1","1002":"#3de2e2","1004":"#37ade8","1005":"#36c4ac","1006":"#d8cc1a","1007":"#54c6ff","1008":"#aa5e4b","1009":"#ef8f77","1010":"#4fc1f9","1011":"#1c2626","1012":"#a5e1ff","1013":"#a5e1ff","1014":"#a5e1ff","1015":"#a5e1ff","1016":"#47cc74","1017":"#47cc75","1018":"#47cc76","1019":"#47cc77","1020":"#47cc78","1021":"#f99c40","1022":"#f99c41","1023":"#ff9368","1024":"#8b51ff","1025":"#8d54ff","1026":"#894fff","1100":"#3ce0e0"},"name":"seg2"}],"showDefaultAnnotations":false,"sliceAngleRotaX":"'+Jt[0]+'","sliceAngleRotaY":"'+Jt[1]+'","sliceAngleRotaZ":"'+Jt[2]+'","selectedLayer":{"visible":true,"layer":"seg2"},"crossSectionBackgroundColor":"#ffffff","projectionBackgroundColor":"#ffffff","layout":"hzkdPanel"}';window.open(sr,"_blank")},300);else if(ze.current==1)Ke=parseInt(((zt+8)/13.9919970598834*700).toString()),window.open("http://"+ue.current+"/STAM/reference/index.html?lang=en_us&3Dname="+lt+"&inp="+Ke+"&section=coronal");else if(ze.current==2){let Rt=Nt;Nt<0&&(Rt=-Nt),Ke=parseInt((Rt/5.17*256).toString()),Nt==0&&(Ke=1),window.open("http://"+ue.current+"/STAM/reference/index.html?lang=en_us&3Dname="+lt+"&inp="+Ke+"&section=sagittal")}else ze.current==3&&(Ke=parseInt(((Lt+5.33)/7.37*367).toString()),window.open("http://"+ue.current+"/STAM/reference/index.html?lang=en_us&3Dname="+lt+"&inp="+Ke+"&section=horizontal"))},ys=(Ce,$e,Ke,lt,Rt,Jt,rn,hn,pn,Cr,sr)=>{let Cn=new URL(window.location.href),ar=new URLSearchParams(Cn.search).get("atlasReslicingInfo"),Er={};ar&&(Er=JSON.parse(ar)),Er.angleX=Ce,Er.angleY=$e,Er.angleZ=Ke,Er.positionZ=Jt,Er.positionX=lt,Er.positionY=Rt,Er.translateX=rn,Er.translateY=hn,Er.translateZ=pn,Er.ButtonDisabled=sr,Er.rotate=Cr,Er.direction1=ze.current,qa.atlasReslicingInfo=Er,mt(Ce),fn($e),_t(Ke),en(Jt),Dt(lt),Zt(Rt),Kt(rn),on(hn),Rn(pn),Lr(Cr),yn(sr)},zl=(Ce,$e=!1)=>{_e.current.remove(ll.current);let Ke=ll.current.position;if($e&&j7){let Rt=JSON.parse(j7);Ke=new Ie(Rt.positionX,Rt.positionY,Rt.positionZ)}let lt=Ce;if($l(lt),lt==1){De.current.enabled=!1,_e.current.remove(De.current),nc(0),ze.current=1,ys(90,0,0,-5.17,-5.33,Ke.z,!0,!0,!1,!0,!1);const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Rt&&(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)),Jt&&(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)),rn&&(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1)),hn?(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)):Kr(!0)}else if(lt==2){nc(0),De.current.enabled=!1,_e.current.remove(De.current),ys(90,270,0,Ke.x,-5.33,-8,!1,!0,!0,!0,!1),ze.current=2;const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Jt?(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)):Dn(!0),Rt&&(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)),hn&&(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)),rn&&(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1))}else if(lt==3){De.current.enabled=!1,_e.current.remove(De.current),ys(360,0,0,-5.17,Ke.y,-8,!0,!1,!0,!0,!1),ze.current=3,nc(0);const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Jt&&(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)),hn&&(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)),rn&&(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1)),Rt?(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)):Un(!0)}else if(lt==4){ze.current=4,_e.current.remove(De.current),ys(120,320,270,Ke.x,Ke.y,Ke.z,!1,!1,!1,!1,!1);const Rt=_e.current.getObjectByName("HorizontalView"),Jt=_e.current.getObjectByName("SagittalView"),rn=_e.current.getObjectByName("arbitrarySlice"),hn=_e.current.getObjectByName("CoronalView");Jt&&(Jt.position.x=Ke.x,_e.current.remove(Jt),Dn(!1)),hn&&(hn.position.z=Ke.z,_e.current.remove(hn),Kr(!1)),Rt&&(Rt.position.y=Ke.y,_e.current.remove(Rt),Un(!1)),rn?(rn.position.set(Ke.x,Ke.y,Ke.z),_e.current.remove(rn),gi(!1)):gi(!0)}},op=Ce=>{var $e=Vv(Ce,cl.current);if(A.includes(Ce)){_.current.removeFBX(Ce,!0);const Ke=_.current.checkedKeys.current.findIndex(rn=>rn===Ce);Ke>-1&&_.current.checkedKeys.current.splice(Ke,1),te(_.current.checkedKeys.current);let lt=new URL(window.location.href),Rt=new URLSearchParams(lt.search);const Jt=JSON.stringify(_.current.checkedKeys.current);Rt.set("regionsChecked",Jt),lt.search=Rt.toString(),window.history.replaceState({},"",lt),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):$e.forEach(rn=>{_.current.setExpandedKeys(hn=>hn.filter(pn=>pn!==rn))})}else if(Ce){let Ke=Ce.replace("/","_");const lt=_.current.fetchColor(Ce);if(lt){let Rt=n+"/data/FBX/"+Ke+".FBX";bd(Rt,Ce,lt,.8,0,"FBX"),_.current.checkedKeys.current.push(Ce);const Jt=Array.from(new Set([..._.current.expandedKeys,...$e]));_.current.setExpandedKeys(Jt),te(_.current.checkedKeys.current);let rn=new URL(window.location.href),hn=new URLSearchParams(rn.search);const pn=JSON.stringify(_.current.checkedKeys.current);hn.set("regionsChecked",pn),rn.search=hn.toString(),window.history.replaceState({},"",rn)}}Oe({})},id=Ce=>{var $e=Vv(Ce,cl.current);if(A.includes(Ce)){_.current.removeFBX(Ce,!0);const Ke=_.current.checkedKeys.current.findIndex(lt=>lt===Ce);Ke>-1&&_.current.checkedKeys.current.splice(Ke,1),te(_.current.checkedKeys.current),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):$e.forEach(lt=>{_.current.setExpandedKeys(Rt=>Rt.filter(Jt=>Jt!==lt))})}else if(Ce){let Ke=Ce.replace("/","_");const lt=_.current.fetchColor(Ce);if(lt){let Rt=n+"/data/FBX/"+Ke+".FBX";bd(Rt,Ce,lt,.8,0,"FBX"),_.current.checkedKeys.current.push(Ce);const Jt=Array.from(new Set([..._.current.expandedKeys,...$e]));_.current.setExpandedKeys(Jt),te(_.current.checkedKeys.current)}}Oe({})},km=Ce=>{var $e;if(A.includes(Ce)){_.current.removeFBX(Ce,!0);const Ke=_.current.checkedKeys.current.findIndex(rn=>rn===Ce);Ke>-1&&_.current.checkedKeys.current.splice(Ke,1),te(_.current.checkedKeys.current);let lt=new URL(window.location.href),Rt=new URLSearchParams(lt.search);const Jt=JSON.stringify(_.current.checkedKeys.current);Rt.set("regionsChecked",Jt),lt.search=Rt.toString(),window.history.replaceState({},"",lt)}else if(Ce){const Ke=_.current.fetchColor(Ce.replace("_","/"));let lt=n+"/data/FBX/"+Ce.replace("/","_")+".FBX";bd(lt,Ce,Ke,.8,0),_.current.checkedKeys.current.push(Ce),te(_.current.checkedKeys.current);let Rt=new URL(window.location.href),Jt=new URLSearchParams(Rt.search);const rn=JSON.stringify(_.current.checkedKeys.current);Jt.set("regionsChecked",rn),Rt.search=Jt.toString(),window.history.replaceState({},"",Rt)}($e=f.domElement)==null||$e.addEventListener("mousemove",K.current,!1)},g1=Ce=>{if(Ce in Se.current.neurons_line.current){Se.current.removeSWCAll(Ce),Se.current.setCheckItems(Rt=>Rt.filter(Jt=>Jt!==Ce)),Se.current.setPathOpen(Rt=>Rt.filter(Jt=>Jt!==Ce));let $e=new URL(window.location.href),Ke=new URLSearchParams($e.search);const lt=JSON.stringify(Se.current.checkItems.filter(Rt=>Rt!==Ce));if(Ke.set("neuronsChecked",lt),$e.search=Ke.toString(),window.history.replaceState({},"",$e),Ce in pe.current){for(let Rt in pe.current[Ce])_e.current.remove(pe.current[Ce][Rt]);delete pe.current[Ce]}}},m1=()=>{if(!xs.current){js(!0);return}const Ce=document.createElement("a");Ce.href=n+"/zip/9.8.label.zip",Ce.download="9.8.label.zip",Ce.click();let $e=new URL(window.location.href),lt=new URLSearchParams($e.search).get("type");const Rt=window.location.origin+window.location.pathname+`?type=${lt}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Rt,time:0,key:ua.current})}).then(Jt=>Jt.json()).then(Jt=>{})},ad=(Ce,$e)=>{for(let Ke of Ce){if(Ke.name.toLowerCase()===$e.toLowerCase())return{color:Ke.color,path:Ke.path,fullname:Ke.fullname};if(Ke.children){const lt=ad(Ke.children,$e);if(lt)return lt}}return null},yh=(Ce,$e)=>{for(let Ke of Ce){if(Ke.name.toLowerCase()===$e.toLowerCase()&&!Ke.children)return{color:Ke.color,path:Ke.path};if(Ke.children){const lt=yh(Ke.children,$e);if(lt)return lt}}return null},nn=(Ce,$e)=>{const Ke=[];for(const lt in Ce)Ce[lt].includes($e)&&Ke.push(lt);return Ke},oc=(Ce,$e=[])=>{if(Array.isArray(Ce))for(let Ke of Ce)oc(Ke,$e);if(typeof Ce=="object")if(Ce.hasOwnProperty("children"))oc(Ce.children,$e);else return Ce.name&&$e.push(Ce.name),Ce.name},sc=(Ce,$e,Ke=[])=>{if(Array.isArray(Ce))for(let lt of Ce)sc(lt,$e,Ke);typeof Ce=="object"&&(Ce.hasOwnProperty("children")&&sc(Ce.children,$e,Ke),Ce.name===$e&&(Ce.hasOwnProperty("children")?oc(Ce.children,Ke):Ce.name&&Ke.push(Ce.name)))},Um=Ce=>{if(Ce in ae.current.vesselObj.current){ae.current.setCheckItems(Rt=>Rt.filter(Jt=>Jt!==Ce)),ae.current.removeVessel(Ce);let $e=new URL(window.location.href),Ke=new URLSearchParams($e.search);const lt=JSON.stringify(ae.current.checkItems.filter(Rt=>Rt!==Ce));Ke.set("vesselsChecked",lt),$e.search=Ke.toString(),window.history.replaceState({},"",$e)}},bh=Ce=>()=>{io(Ce),ke(Ce)};function Xr(Ce,$e){return[...new Set([...Ce,...$e])]}const Mn=Ce=>{const $e=[],Ke=[];if(ae.current&&_.current){const lt=ae.current,Rt=_.current;sc(lt.treeDatas,Ce,$e);const Jt=Ic.current.indexOf(Ce);if(Jt!==-1){Ic.current.splice(Jt,1),$e.forEach(sr=>{Ke.push(nn(yl,sr))});const rn=Ke.reduce((sr,Cn)=>Xr(sr,Cn),[]);let hn=A;rn.forEach(sr=>{yh(Rt.treeDatas,sr)!=null&&(hn=hn.filter(ur=>ur!==sr),Rt.removeFBX(sr,!0))}),te(hn);let pn=new URL(window.location.href),Cr=new URLSearchParams(pn.search);Cr.set("regionsChecked",JSON.stringify(hn)),pn.search=Cr.toString(),window.history.replaceState({},"",pn),Ic.current.length===0&&Rt.setExpandedKeys(Rt.defexpandedKeys.current)}else{Ic.current.push(Ce),$e.forEach(Cn=>{Ke.push(nn(yl,Cn))});const rn=Ke.reduce((Cn,ur)=>Xr(Cn,ur),[]),hn=Array.from(new Set([...Rt.expandedKeys,...rn]));Rt.setExpandedKeys(hn);let pn=[...A];rn.forEach(Cn=>{const ur=yh(Rt.treeDatas,Cn);if(ur!=null){const ar=`${n}/data/FBX/${Cn}.FBX`;pn.push(Cn),Rt.LoadFBX(ar,Cn,ur.color,.8,0)}}),te(pn);let Cr=new URL(window.location.href),sr=new URLSearchParams(Cr.search);sr.set("regionsChecked",JSON.stringify(pn)),Cr.search=sr.toString(),window.history.replaceState({},"",Cr)}}},oi=(Ce,$e)=>{for(let Ke in Ce)if(Ce[Ke].name===$e){if(Ce[Ke]["2D"])return $e;{const lt=X0($e,hr);return oi(hr,lt)}}else if(Ce[Ke].children){const lt=oi(Ce[Ke].children,$e);if(lt)return lt}return null},Dc=S.useMemo(()=>(vr==3||vr==4)&&!(X||ye)?[vr==3&&jc!=1?{key:"3",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(1),ee(!0)}},a("5000.6025")||"切换到冠状面")}:null,vr==3&&jc!=2?{key:"4",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(2),ee(!0)}},a("5000.6026")||"切换到矢状面")}:null,vr==3&&jc!=3?{key:"5",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(3),ee(!0)}},a("5000.6027")||"切换到水平面")}:null,vr==3&&jc!=4?{key:"6",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{zl(4),ee(!0)}},a("5000.6028")||"切换到任意面")}:null,ve.brains?{key:"1",label:S.createElement("a",{target:"_blank",type:"primary",onClick:()=>{Cl(ve.brains,vr==4),ee(!0)}},a("5000.6018")||"查看更高分辨率图像")}:null,ve.brains?{key:"2",label:S.createElement("a",{target:"_blank",onClick:()=>{op(ve.brains),ee(!0)}},_.current.checkedKeys.current.includes(ve.brains)?a("5000.6023",{name:ve.brains})||`隐藏${ve.brains}的三维形貌`:a("5000.6024",{name:ve.brains})||`显示${ve.brains}的三维形貌`)}:null]:X||ye?[X?{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:()=>{km(X),ee(!0)}},_.current.checkedKeys.current.includes(X)?a("5000.5056")||"隐藏核团":a("5000.5057")||"显示核团")}:null,vr!=7&&(vt.length==0||vt.includes("neurons"))&&ye?{key:"3",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{uo(7),ee(!0),setTimeout(()=>{io(X),ke(X),V(!1),an(0)},50)}},a("5000.6015")||"查询位于或投射到该结构的神经元")}:null,ye?{key:"6",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ce=_e.current.getObjectByName(ye);if(Ce){const $e=new rs().setFromObject(Ce),Ke=new Ie;$e.getCenter(Ke),p.current.target.copy(Ke),ee(!0)}}},a("7000.7019")||"设置为焦点")}:null,ye&&vr==5?{key:"5",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ce=new rs,$e=_e.current.getObjectByName(ye);if($e){Ce.expandByObject($e.clone());let Ke=Ce.min,lt=Ce.max,Rt=new Ie;Ce.getCenter(Rt);const Jt=lt.x-Ke.x,rn=lt.y-Ke.y,hn=lt.z-Ke.z;It.current.scale.x=Jt,It.current.scale.y=rn,It.current.scale.z=hn,It.current.position.set(Rt.x,Rt.y,Rt.z);const pn=It.current.geometry.clone();pn.scale(It.current.scale.x,It.current.scale.y,It.current.scale.z),pn.translate(Rt.x,Rt.y,Rt.z);const Cr=new m4(pn);lr.current.geometry=Cr,_e.current.remove(Ir.current);const sr=a("5000.0006")||"显示数据块";if(tr===sr){_r(a("5000.0007")||"隐藏数据块"),De.current=new q_(ki.current,f==null?void 0:f.domElement),De.current.setMode("translate"),De.current.enabled=!0,De.current.visible=!0,De.current.name="transformControls",De.current.attach(It.current),_e.current.add(It.current,De.current,lr.current),mT(),document.addEventListener("keypress",iC);const Cn=new rs;Cn.expandByObject(It.current);const ur=R.current(Cn.min.clone()),ar=R.current(Cn.max.clone());let Er=new Jp(Pp(650,620,`${ur.x.toFixed(2)},${ur.y.toFixed(2)},${ur.z.toFixed(2)}`,"#ccc")),Qr=new mp(new $f({map:Er}));Qr.name="startText";let Ba=new Jp(Pp(650,620,`${ar.x.toFixed(2)},${ar.y.toFixed(2)},${ar.z.toFixed(2)}`,"#ccc")),Fi=new mp(new $f({map:Ba}));Fi.name="endText",Qr.position.set(Cn.min.x,Cn.min.y+.2,Cn.min.z),Fi.position.set(Cn.max.x,Cn.max.y+.6,Cn.max.z);const sa=_e.current.getObjectByName("startText"),fl=_e.current.getObjectByName("endText");sa&&fl&&_e.current.remove(sa,fl),_e.current.add(Ir.current,Qr,Fi)}ee(!0),Oe({})}}},a("5000.6022",{lableStr:ye})||"设置 "+ye+" 的包围盒为下载范围")}:null].filter(Ce=>Ce!==null):oe?[{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{Se.current.showSwctext(oe),ee(!0)}},oe in pe.current?a("5000.5060")||"隐藏文字":a("5000.5061")||"显示文字")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{g1(oe),ee(!0)}},a("5000.6004")||"隐藏该神经元")}]:ie?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{Mn(ie),ee(!0)}},Ic.current.includes(ie)?a("5000.0209")||"Hide Label":a("5000.0208")||"Show Label")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ce=>{Um(ie),ee(!0)}},a("5000.6021")||"隐藏该分支")}]:dt.Lable?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{if(dt.name){const Ce=_e.current.getObjectByName(dt.name);if(Ce){const $e=new rs().setFromObject(Ce),Ke=new Ie;$e.getCenter(Ke),p.current.target.copy(Ke),ee(!0)}}}},a("7000.7019")||"设置为焦点")},{key:"2",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{dt.Lable&&km(dt.Lable),ee(!0)}},_.current.checkedKeys.current.includes(dt.Lable)?a("5000.6023",{name:dt.Lable})||`隐藏${dt.Lable}的三维形貌`:a("5000.6024",{name:dt.Lable})||`显示${dt.Lable}的三维形貌`)}]:[],[X,ie,oe,ye,vr,Ns,ve,Po,dt]),Eh=Ce=>{Ce=Ce.replace(/[\[\]]/g,"\\$&");var $e=new RegExp("[?&]"+Ce+"(=([^&#]*)|&|#|$)"),Ke=$e.exec(window.location.href);return Ke?Ke[2]?decodeURIComponent(Ke[2].replace(/\+/g," ")):"":null},X0=(Ce,$e)=>{let Ke="";for(let lt in $e){const Rt=$e[lt];if(Rt.children){if(Rt.children.some(Jt=>Jt.name===Ce)){Ke=Rt.name;break}else if(X0(Ce,Rt.children)){Ke=X0(Ce,Rt.children);break}}}return Ke},uT=()=>{let Ce=new URL(window.location.href),$e=new URLSearchParams(Ce.search);const Ke=Math.ceil((performance.now()-Pc.current)/1e3)-1;Pc.current=performance.now();let lt=$e.get("type");if(lt){const Rt=window.location.origin+window.location.pathname+`?type=${lt}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Rt,time:Ke})}).then(Jt=>Jt.json()).then(Jt=>{})}},_u=(Ce,$e,Ke)=>{let lt=new URL(window.location.href),Rt=new URLSearchParams(lt.search);const Jt=Math.ceil((performance.now()-Pc.current)/1e3)-1;let rn=Rt.get(Ce);if(rn&&!Ke){Pc.current=performance.now();const pn=window.location.origin+window.location.pathname+`?${Ce}=${rn}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:pn,time:Jt})})}Rt.set(Ce,$e),lt.search=Rt.toString(),window.history.replaceState({},"",lt);const hn=window.location.origin+window.location.pathname+`?${Ce}=${$e}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:hn,time:0})})},Lg=(Ce,$e,Ke)=>{if($e)switch(parseInt(Ce)){case 0:document.title="STAM-SimpleViewer",_u("type","simple",Ke);break;case 1:document.title="STAM-NormalViewer",_u("type","normal",Ke);break;case 2:document.title="STAM-Surgery",_u("type","virtual",Ke);break;case 3:document.title="STAM-Reslicing",_u("type","slicing",Ke);break;case 4:document.title="STAM-Registration",_u("type","registration",Ke);break;case 5:document.title="STAM-Downloading",_u("type","downloading",Ke);break;case 6:document.title="STAM-AtlasMapping",_u("type","mapping",Ke);break;case 7:document.title="STAM-Connectivity",_u("type","circuits",Ke);break;case 8:document.title="STAM-OtherAtlas",_u("type","other",Ke);break;case 9:document.title="STAM-ViewSetting",_u("type","setting",Ke);break;case 10:document.title="STAM-neuronRegistration",_u("type","neuronRegistration",Ke);break;case 11:document.title="STAM-CloudChart",_u("type","cloudChart",Ke);break;case 12:document.title="STAM-FunctionalLoop",_u("type","functionalLoop",Ke);break}};S.useEffect(()=>{ve.brains&&$o(oi(hr,ve.brains))},[ve]),S.useEffect(()=>{ye&&bo(oi(hr,ye)),g(Dc),Bl.current=h},[h,X,A,ie,ye,oe,vr,we,ve,Po,dt]);const Z0=async Ce=>{Mo(Ce.url||Ce.preview),ha(!0)},dT=(Ce,$e)=>{const Ke=new FormData;Ke.append("file",Ce.file),fetch("/app-api/up-api/update",{method:"post",body:Ke}).then(lt=>lt.json()).then(lt=>{if(lt.code===200)if(fc.success("update success"),$e===2){const Rt=as.findIndex(Jt=>Jt.key===Xs[0]);if(Rt>-1){let Jt=JSON.parse(JSON.stringify($s.current)),rn=Jt[Rt];rn.fileList2=[{url:"data:image/png;base64,"+lt.base64_url}],ic(Jt),$s.current=Jt}}else{const Rt=as.findIndex(Jt=>Jt.key===Xs[0]);if(Rt>-1){let Jt=JSON.parse(JSON.stringify($s.current)),rn=Jt[Rt];rn.fileList=[{url:"data:image/png;base64,"+lt.base64_url}],rn.correspondingPlaneData={},rn.filename=lt.path,ic(Jt);const hn=_e.current.children.filter(pn=>pn.userData.name==="registrationPng");hn&&_e.current.remove(...hn),$s.current=Jt}Fn.current=lt.path}else lt.message&&Wo.error({content:lt.message})})},Fa=async(Ce,$e)=>{const Ke=Ce.type==="image/tiff"||Ce.type==="image/tif",lt=Ce.name.endsWith(".swc");let Rt,Jt;return await new Promise(hn=>{if(Ke){const pn=new FileReader;pn.readAsArrayBuffer(Ce),pn.onload=async Cr=>{var sr;if((sr=Cr.target)!=null&&sr.result){const Cn=Cr.target.result;if(Cn instanceof ArrayBuffer){const ar=await(await LCe(Cn)).getImage(),Er=ar.getWidth(),Qr=ar.getHeight();if(!$e){const Ba=as.findIndex(Fi=>Fi.key===Xs[0]);if(Ba>-1){let Fi=JSON.parse(JSON.stringify(as)),sa=Fi[Ba];sa.firstRegistrationImg={width:Er,height:Qr},ic(Fi),$s.current=Fi}}if($e===2){const Ba=as.findIndex(Fi=>Fi.key===Xs[0]);if(Ba>-1){const{firstRegistrationImg:Fi}=as[Ba];(Fi.width!==Er||Qr!==Fi.height)&&(fc.error("The size of the second TIFF image needs to be consistent with the first one!"),hn(!1))}}hn(!0)}}}}else hn(!0)}).then(hn=>hn?(vr==6?(Rt=Ke||lt,Jt="You can only upload tif or swc files!"):(Rt=Ke,Jt="You can only upload tif files!"),Rt||fc.error(Jt),Rt):!1)},v1=(Ce,$e)=>{const Ke=new FormData;Ke.append("file",Ce.file),console.log(Ce.file),Ce.file.name.split(".")[1]=="swc"?rd(!0):rd(!1),fetch("/app-api/d-api/upload",{method:"post",body:Ke}).then(lt=>lt.json()).then(lt=>{lt.code===200?(fc.success("update success"),$e===2?ro([{url:"data:image/png;base64,"+lt.base64_url}]):(zi([{url:"data:image/png;base64,"+lt.base64_url}]),Ua({}),Fn.current=lt.path)):lt.message&&Wo.error({content:a("5000.0003")||"上传失败,请联系管理员"})})},Ib=Ce=>{fetch(Ce).then($e=>$e.json()).then($e=>{let Ke=new Lo;const lt=new Kc,Rt=Ce.split("/").pop();let Jt={};const rn=[];_e.current.traverse(Cn=>{Cn.userData.isAtlasMapping==="true"&&rn.push(Cn)}),rn.forEach(Cn=>{_e.current.remove(Cn)}),$e.line.forEach((Cn,ur)=>{var ar=$e.position[Cn.end],Er=$e.position[Cn.start],Qr=new Jn(new qc(.01,32,32),new Bc({color:"#A7B5A1",transparent:!0}));Qr.position.set(ar.x*.01,ar.y*.01,ar.z*.01);var Ba=new Jn(new qc(.01,32,32),new Bc({color:"#00ffff",transparent:!0}));Ba.position.set(Er.x*.01,Er.y*.01,Er.z*.01),Qr.translateX(eo.current),Qr.translateY(Ya.current),Qr.translateZ(ja.current),Ba.translateX(eo.current),Ba.translateY(Ya.current),Ba.translateZ(ja.current),Qr.myMeshType="neuronSphere",Qr.name=`${Rt}/${Cn.end_name}`,Qr.userData.color="#A7B5A1",Ba.myMeshType="neuronSphere",Ba.name=`${Rt}/${Cn.start_name}`,Ba.userData.color="#00ffff",lt.add(Qr),lt.add(Ba),Cn.start_name&&(Jt.hasOwnProperty(Cn.start_name)?Jt[`${Cn.start_name}`].push({name:Rt,point:[Er.x,Er.y,Er.z],color:"#00ffff"}):(Jt[`${Cn.start_name}`]=[],Jt[`${Cn.start_name}`].push({name:Rt,point:[Er.x,Er.y,Er.z],color:ur===0?"#1771FF":"#00ffff"}))),Cn.end_name&&(Jt.hasOwnProperty(Cn.end_name)?Jt[`${Cn.end_name}`].push({name:Rt,point:[ar.x,ar.y,ar.z],color:"#A7B5A1"}):(Jt[`${Cn.end_name}`]=[],Jt[`${Cn.end_name}`].push({name:Rt,point:[ar.x,ar.y,ar.z],color:"#A7B5A1"})))});let hn=new Jn(new qc(.02,32,32),new Bc({color:"#1771FF",transparent:!0}));hn.position.set($e.position[0].x*.01,$e.position[0].y*.01,$e.position[0].z*.01),hn.translateX(eo.current),hn.translateY(Ya.current),hn.translateZ(ja.current),lt.add(hn),lt.name=`swcPointGroup${Rt}`,lt.userData.isAtlasMapping="true";const pn={};for(const Cn in Jt){const ur=Jt[Cn];for(const ar of ur)if(ar.name==Rt){if(ar.color==="#1771FF"){pn[Cn]={point:ar.point,color:ar.color};break}if(ar.color==="#A7B5A1"){pn[Cn]={point:ar.point,color:ar.color};break}pn[Cn]={point:ar.point,color:ar.color}}}for(let Cn in pn){const{point:ur,color:ar}=pn[Cn];var Cr=new Jp(Pp(400,300,Cn.replace("_","/"),ar));let Er=new mp(new $f({map:Cr,transparent:!0,alphaTest:.5}));Er.scale.set(.5,.5,.5),Er.position.set(ur[0]*.01,ur[1]*.01,ur[2]*.01),Er.translateX(eo.current),Er.name="lineNameMesh",Er.userData.name=Cn.replace("_","/"),Er.userData.wholeName=`${Rt}-${Cn}`,Er.userData.isAtlasMapping="true",Er.userData.initColor=ar,Er.translateY(Ya.current),Er.translateZ(ja.current),_e.current.add(Er)}_e.current.add(lt);for(let Cn=0;Cn<$e.line.length;Cn++){let ur=[];for(let Er=$e.line[Cn].start;Er<=$e.line[Cn].end;Er++){let Qr=$e.position[Er].x,Ba=$e.position[Er].y,Fi=$e.position[Er].z;ur.push(new Ie(Qr,Ba,Fi))}let ar=new Ea(new Di().setFromPoints(ur),new Jc({color:"green"}));Ke.add(ar),mi(!1)}Ke.scale.set(Hi.current,Hi.current,Hi.current),Ke.translateX(eo.current),Ke.translateY(Ya.current),Ke.translateZ(ja.current),Ke.name="correspondingPlaneDataSwc";const sr=_e.current.getObjectByName("correspondingPlaneDataSwc");sr&&_e.current.remove(sr),_e.current.add(Ke)})},dl=()=>{const Ce=_e.current.getObjectByName("Brain");if(Ce)if(mi(Ke=>!Ke),Dr.file[1].indexOf(".js")>-1)Ib("/app-api/d-api/dowload/"+Dr.file[1]);else{var $e=new vo;$e.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const Ke=(Ce==null?void 0:Ce.children[0]).geometry.boundingBox.min,lt=(Ce==null?void 0:Ce.children[0]).geometry.boundingBox.max,Rt={bwidth:0,bheight:2.6,bdepth:0,ewidth:lt.x-Ke.x,eheight:lt.y-Ke.y,edepth:lt.z-Ke.z,owidth:lt.x-Ke.x,oheight:lt.y-Ke.y,odepth:lt.z-Ke.z};let Jt=new Ie(.005238113403320366,-1.6508567881694614,6133353495929583e-20),rn=new Ie(-5.097530670166015,-4.308416134996751,-7.990437196406743),hn=new Ie(5.118084411621094,3.006702558657828,6.001559863476661);const pn=new rs;pn.expandByObject(Ce.clone()),rn=pn.min,hn=pn.max,Jt=pn.getCenter(Jt);const Cr=hn.x-rn.x,sr=hn.y-rn.y,Cn=hn.z-rn.z;It.current.scale.set(Cr,sr,Cn),It.current.position.set(Jt.x,Jt.y,Jt.z),wn.current.length===0?fetch("/app-api/d-api/dowload/"+Dr.file[1]).then(ur=>ur.arrayBuffer()).then(ur=>{const ar=new Uint8Array(ur);let Er=hH(ar),Qr=ACe(ar);wn.current=Er,y1(Er,Rt,Qr)}):setTimeout(()=>{y1(wn.current,Rt,wn.current.length)},200)}},bs=Ce=>{const $e=as.findIndex(Ke=>Ke.key===Xs[0]);if($e>-1){let Ke=JSON.parse(JSON.stringify(as)),lt=Ke[$e];lt.registrationRadioShowType=Ce.target.value,ic(Ke),$s.current=Ke,_e.current.getObjectByName(`png${$e}`)&&fT(Ce.target.value)}},Fm=Ce=>{if(mi(!0),ui(Ce.target.value),qa.otherAtlases=Ce.target.value,_e.current){const $e=_e.current.getObjectByName("outline");$e&&_e.current.remove($e)}Ce.target.value=="CCF"&&py({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En),Ce.target.value=="WHS"&&py({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En),mi(!1)},M8=Ce=>{if(an(Ce.target.value),Ce.target.value===2){G.current="automatic",P(!0),U.current=!0,W(2),m.current.length>=2&&(m.current.pop(),b.current.pop());const $e=_e.current.getObjectByName("dashedLine"),Ke=_e.current.getObjectByName("sphereBig"),lt=_e.current.getObjectByName("sphereMiddelClick"),Rt=_e.current.getObjectByName("Line");$e&&Ke&&_e.current.remove($e,Ke),lt&&_e.current.remove(lt),Rt&&_e.current.remove(Rt),nC()}else G.current="manual",P(!1),U.current=!1,W(3),nC();d&&(d.current=!0),pt(a("4000.0126")||"重置")},eU=Ce=>{if(Ce>-1){let $e=JSON.parse(JSON.stringify($s.current)),Ke=$e[Ce];Ke.startButtonLoading=!0,Ke.correspondingPlaneData={},ic($e),$s.current=$e;const lt=new FormData;lt.append("file",Ke.filename),lt.append("typeName",Ke.radioValue.toString()),fetch("/app-api/up-api/calculate",{method:"post",body:lt}).then(Rt=>{if(Rt.ok)return Rt.json();throw Wo.error({content:a("5000.7027")||"计算失败"}),new Error(Rt.statusText)}).then(Rt=>{const Jt=Rt;let rn=JSON.parse(JSON.stringify($s.current));const hn=rn[Ce];hn.correspondingPlaneData=Jt,hn.startButtonLoading=!1,$s.current=rn,ic(rn)})}},tC=()=>{const Ce=as.findIndex($e=>$e.key===Xs[0]);if(Ce>-1){let $e=as[Ce];const Ke=document.createElement("a");Ke.href="/app-api/up-api/zip/"+$e.correspondingPlaneData.url,Ke.download=$e.correspondingPlaneData.url,Ke.click()}},fT=Ce=>{const $e=as.findIndex(sr=>sr.key===Xs[0]);if($e>-1){const sr=_e.current.getObjectByName(`png${$e}`);sr&&_e.current.remove(sr)}var Ke=_e.current.getObjectByName("Brain");if(Ke&&$e>-1){let sr=as[$e];const{correspondingPlaneData:Cn,registrationRadioShowType:ur,fileList:ar,fileList2:Er}=sr;var lt=new rs().setFromObject(Ke),Rt=lt.max.y-lt.min.y,Jt=lt.max.x-lt.min.x;Rt=Rt/Math.cos(Cn.angles[0]*Math.PI/180),Jt=Jt/Math.cos(Cn.angles[1]*Math.PI/180);var rn=new V6(Jt,Rt,1,1),hn=new Bc({side:Ed,transparent:!0,alphaTest:.1}),pn=new Jn(rn,hn);pn.name=`png${$e}`;let Qr=ur;Ce&&(Qr=Ce),pn.userData.imgType=Qr,pn.userData.name="registrationPng",_e.current.add(pn);var Cr=new fS;pn.position.set(lt.min.x+(lt.max.x-lt.min.x)/2,lt.min.y+(lt.max.y-lt.min.y)/2,(lt.max.z-lt.min.z)*Cn.tx+lt.min.z),Cr.load(Qr==="3"?Er[0].url:Qr==="1"?Cn.base64_url:ar[0].url,function(Ba){hn.map=Ba,hn.needsUpdate=!0}),pn.rotateOnAxis(new Ie(0,0,1),Math.PI),pn.rotateOnAxis(new Ie(1,0,0),Math.PI/180*-Cn.angles[0]),pn.rotateOnAxis(new Ie(0,1,0),Math.PI/180*Cn.angles[2]),pn.rotateOnAxis(new Ie(0,0,1),Math.PI/180*Cn.angles[1]),Ce!="1"&&(Hc.current?pn.scale.x=1:pn.scale.x=-1)}},Ab=()=>{const Ce=new zs(1,1,1),$e=new Bc({color:16777215,opacity:.1,transparent:!0,depthWrite:!1}),Ke=new Jn(Ce,$e);_e.current.remove(It.current,lr.current,Ir.current),It.current=Ke.clone(),Ir.current=new Jn;const lt=new m4(Ce),Rt=new Jc({color:16536881}),Jt=new hI(lt,Rt);lr.current=Jt},tU=()=>{const Ce=a("5000.0006")||"显示数据块";if(tr===Ce){_r(a("5000.0007")||"隐藏数据块"),De.current=new q_(ki.current,f==null?void 0:f.domElement),De.current.setMode("translate"),De.current.enabled=!0,De.current.visible=!0,De.current.name="transformControls",De.current.attach(It.current),_e.current.add(It.current,De.current,lr.current),mT(),document.addEventListener("keypress",iC);const $e=new rs;$e.expandByObject(It.current);const Ke=R.current($e.min.clone()),lt=R.current($e.max.clone());let Rt=new Jp(Pp(650,620,`${Ke.x.toFixed(2)},${Ke.y.toFixed(2)},${Ke.z.toFixed(2)}`,"#ccc")),Jt=new mp(new $f({map:Rt}));Jt.name="startText";let rn=new Jp(Pp(650,620,`${lt.x.toFixed(2)},${lt.y.toFixed(2)},${lt.z.toFixed(2)}`,"#ccc")),hn=new mp(new $f({map:rn}));hn.name="endText",Jt.position.set($e.min.x,$e.min.y+.2,$e.min.z),hn.position.set($e.max.x,$e.max.y+.6,$e.max.z);const pn=_e.current.getObjectByName("startText"),Cr=_e.current.getObjectByName("endText");pn&&Cr&&_e.current.remove(pn,Cr),_e.current.add(Ir.current,Jt,hn)}else{document.removeEventListener("keypress",iC),_r(a("5000.0006")||"显示数据块"),De.current.enabled=!1,De.current.visible=!1,De.current.detach();const $e=_e.current.getObjectByName("startText"),Ke=_e.current.getObjectByName("endText");$e&&Ke&&_e.current.remove($e,Ke),_e.current.remove(De.current),_e.current.remove(It.current,lr.current,Ir.current)}},Pp=(Ce,$e,Ke,lt)=>{var Rt=document.createElement("canvas");Rt.width=Ce,Rt.height=$e,Rt.style.border="1px solid #000";let Jt=Rt.getContext("2d");return Jt.font="80px Arial",Jt.fillStyle=lt,Jt.fillText(Ke,40,80),Rt},y1=(Ce,$e,Ke)=>{const lt=Ce[0].width/$e.owidth,Rt=Ce[0].height/$e.oheight,Jt=Ke/$e.odepth,rn=Math.ceil($e.bwidth*lt),hn=Math.ceil($e.bheight*Rt),pn=Math.ceil($e.bdepth*Jt),Cr=Math.floor($e.ewidth*lt),sr=Math.floor($e.eheight*Rt),Cn=Math.floor($e.edepth*Jt),ur=Cr-rn,ar=sr-hn,Er=new vPe(null,ur,ar,Cn-pn);Er.format=oPe,Er.minFilter=pf,Er.magFilter=pf,Er.unpackAlignment=1,Er.needsUpdate=!0;const Qr=f.getContext();f.initTexture(Er);const Ba=f.properties.get(Er).__webglTexture;Qr.bindBuffer(Qr.PIXEL_UNPACK_BUFFER,null),Qr.bindTexture(Qr.TEXTURE_3D,Ba);for(let sa=0;sa<Ce.length;sa++){let fl=[];if(sa>=pn&&sa<Cn){for(let $a=0;$a<Ce[sa].data.length;$a++){let Xa=$a%Ce[sa].width,Es=$a/Ce[sa].width;rn<=Xa&&Xa<Cr&&Es>=hn&&Es<sr&&fl.push(Ce[sa].data[$a])}const Jo=new Uint8Array(fl);Qr.bindTexture(Qr.TEXTURE_3D,Ba),Qr.bindBuffer(Qr.PIXEL_UNPACK_BUFFER,null),Qr.bindBuffer(Qr.ARRAY_BUFFER,null),Qr.texSubImage3D(Qr.TEXTURE_3D,0,0,0,sa-pn,ur,ar,1,Qr.RED,Qr.UNSIGNED_BYTE,Jo)}}Kn.current=Er,C.current=new A0({glslVersion:cg,uniforms:{map:{value:Kn.current},cameraPos:{value:ki.current.position},volume_dims:{value:new Ie(ur,ar,Ke)},canvas_dims:{value:new Sr(f.domElement.width,f.domElement.height)},isClicked:{value:0},steps:{value:Ke},brightness:{value:ul.current.brightness},darkness:{value:ul.current.darkness},opacity:{value:ul.current.opacity},opacity2:{value:ul.current.opacity2},lowcolor:{value:new Ie(ul.current.color.r/255,ul.current.color.g/255,ul.current.color.b/255)},highcolor:{value:new Ie(ul.current.color2.r/255,ul.current.color2.g/255,ul.current.color2.b/255)}},side:Xf,vertexShader:xxn,fragmentShader:_xn}),_e.current.remove(Ir.current);const Fi=new zs(1,1,1);Ir.current=new Jn(Fi,C.current),Ir.current.applyMatrix4(It.current.matrixWorld),Ir.current.scale.set(It.current.scale.x,It.current.scale.y,It.current.scale.z),Ir.current.position.set(It.current.position.x,It.current.position.y,It.current.position.z),_e.current.add(Ir.current),mi(sa=>!sa)},nC=()=>{const Ce=[];_e.current.traverse($e=>{$e.name==="lineName"&&Ce.push($e)}),Ce.forEach($e=>{_e.current.remove($e)})},pT=()=>{const Ce=new rs;Ce.expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if($e){mi(pn=>!pn);var Ke=new vo;Ke.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const lt=($e==null?void 0:$e.children[0]).geometry.boundingBox.min,Rt=($e==null?void 0:$e.children[0]).geometry.boundingBox.max,Jt=Ce.min.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),rn=Ce.max.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),hn={bwidth:Jt.x-lt.x,bheight:Jt.y-lt.y,bdepth:Jt.z-lt.z,ewidth:rn.x-lt.x,eheight:rn.y-lt.y,edepth:rn.z-lt.z,owidth:Rt.x-lt.x,oheight:Rt.y-lt.y,odepth:Rt.z-lt.z};wn.current.length===0?fetch(n+"/data/TIFF/1-0.5_0.tif").then(pn=>pn.arrayBuffer()).then(pn=>{const Cr=new Uint8Array(pn);let sr=hH(Cr),Cn=ACe(Cr);wn.current=sr,y1(sr,hn,Cn)}):setTimeout(()=>{y1(wn.current,hn,wn.current.length)},200)}},P8=Ce=>{fetch(Ce).then($e=>$e.text()).then($e=>{const Ke=[0,0,0,0,0,0];let lt=new Kan($e,Ce||"",Ke,void 0,void 0,3,Ke);const Rt=new LD({color:65280,side:Ed});let Jt=new Lo;for(let rn=0;rn<lt.branches.length;rn++){let hn=lt.branches[rn],pn=[];for(let Cn=hn.start;Cn<hn.start+hn.count;Cn++){let ur=lt.indices[Cn],ar=lt.points[3*ur],Er=lt.points[3*ur+1],Qr=lt.points[3*ur+2];pn.push(new Ie(ar,Er,Qr))}const Cr=new Di().setFromPoints(pn);let sr=new Ea(Cr,Rt);Jt.add(sr)}Jt.scale.set(Hi.current,Hi.current,Hi.current),Jt.position.set(eo.current,Ya.current,ja.current),Jt.name="swcUrlDataLine",_e.current.add(Jt)})},Dp=()=>{new rs().expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if(!k5e||!zZ)return;const Ke=JSON.parse(k5e);if($e){mi(Cr=>!Cr);const lt=Ke.min,Rt=Ke.max,Jt=Ke.max_resample,rn={bwidth:lt.x,bheight:lt.y,bdepth:lt.z,ewidth:Jt.x,eheight:Jt.y,edepth:Jt.z,owidth:Jt.x-lt.x,oheight:Jt.y-lt.y,odepth:Jt.z-lt.z},hn={x:(Rt.x-lt.x)*Hi.current,y:(Rt.y-lt.y)*Hi.current,z:(Rt.z-lt.z)*Hi.current},pn={x:((Rt.x-lt.x)/2+lt.x)*Hi.current+eo.current,y:((Rt.y-lt.y)/2+lt.y)*Hi.current+Ya.current,z:((Rt.z-lt.z)/2+lt.z)*Hi.current+ja.current};It.current.scale.set(hn.x,hn.y,hn.z),It.current.position.set(pn.x,pn.y,pn.z),wn.current.length===0?fetch(zZ).then(Cr=>Cr.arrayBuffer()).then(async Cr=>{try{const sr=await LCe(Cr),Cn=await sr.getImageCount(),ur=[];for(let Er=0;Er<Cn;Er++){const Qr=await sr.getImage(Er),Ba=await Qr.readRasters(),Fi=Qr.getWidth(),sa=Qr.getHeight();ur.push({width:Fi,height:sa,data:Ba[0]})}let ar=Cn;wn.current=ur,y1(wn.current,rn,ar)}catch(sr){console.log("e",sr)}}):setTimeout(()=>{y1(wn.current,rn,wn.current.length)},200)}else setTimeout(()=>{Dp()},1e3)};S.useEffect(()=>{Qa?Gc.current&&Gc.current.focus():gc.current&&gc.current.focus()},[Qa]);const rC=Ce=>Ce.map($e=>({value:$e.name+" "+$e.fullname,title:S.createElement(ji,{placement:"right",title:$e.fullname},S.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},$e.name," ",$e.fullname)),children:$e.children?rC($e.children):void 0})),D8=S.useMemo(()=>{const Ce=new rs;Ce.expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if($e){var Ke=new vo;Ke.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const lt=($e==null?void 0:$e.children[0]).geometry.boundingBox.min,Rt=Ce.min.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),Jt=Ce.max.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),rn={bwidth:Rt.x-lt.x,bheight:Rt.y-lt.y,bdepth:Rt.z-lt.z,ewidth:Jt.x-lt.x,eheight:Jt.y-lt.y,edepth:Jt.z-lt.z};Va.current=rn;const hn=(rn.ewidth-rn.bwidth)*11.1545988258317*(rn.eheight-rn.bheight)*12.31190150478796*(rn.edepth-rn.bdepth)*10;let pn=0;switch(wi){case 1:pn=hn*.8;break;case 2:pn=hn*.8/8;break;case 3:pn=hn*.8/8/8;break;case 4:pn=hn*.8/8/8/8;break;case 5:pn=hn*.8/8/8/8/8;break;case 6:pn=hn*.8/8/8/8/8/8;break}return tr===(a("5000.0006")||"显示数据块")?"0KB":pn>1024*1024*1024*1024?(pn/(1024*1024*1024*1024)).toFixed(2)+"TB":pn>1024*1024*1024?(pn/(1024*1024*1024)).toFixed(2)+"GB":pn>1024*1024&&pn<1024*1024*1024?(pn/(1024*1024)).toFixed(2)+"MB":pn>1024&&pn<1024*1024?(pn/1024).toFixed(2)+"KB":pn&&pn<1024?pn.toFixed(2)+"B":"0KB"}else return"0KB"},[ut,tr]),hT=()=>{if(!xs.current){js(!0);return}const Ce=new rs;Ce.expandByObject(It.current);const $e=_e.current.getObjectByName("Brain");if($e){var Ke=new vo;Ke.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const lt=($e==null?void 0:$e.children[0]).geometry.boundingBox.min,Rt=($e==null?void 0:$e.children[0]).geometry.boundingBox.max,Jt=Ce.min.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),rn=Ce.max.clone().applyMatrix4($e.matrixWorld.clone().invert()).applyQuaternion(Ke),hn={bwidth:Jt.x-lt.x,bheight:Jt.y-lt.y,bdepth:Jt.z-lt.z,ewidth:rn.x-lt.x,eheight:rn.y-lt.y,edepth:rn.z-lt.z,owidth:Rt.x-lt.x,oheight:Rt.y-lt.y,odepth:Rt.z-lt.z,zoom:!1,level:wi};Va.current=hn;const pn=(hn.ewidth-hn.bwidth)*11.1545988258317*(hn.eheight-hn.bheight)*12.31190150478796*(hn.edepth-hn.bdepth)*10;switch(wi){case 1:if(pn*.8>1024*1024*1024){sn(!0);return}break;case 2:if(pn*.8/8>1024*1024*1024){sn(!0);return}break;case 3:if(pn*.8/8/8>1024*1024*1024){sn(!0);return}break;case 4:if(pn*.8/8/8/8>1024*1024*1024){sn(!0);return}break;case 5:if(pn*.8/8/8/8/8>1024*1024*1024){sn(!0);return}break;case 6:if(pn*.8/8/8/8/8/8>1024*1024*1024){sn(!0);return}break}ti(!0),fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(hn)}).then(Cr=>Cr.json()).then(Cr=>{gT(Cr)})}},gT=Ce=>{fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Ce})}).then($e=>{const Ke=$e.headers.get("content-type");return Ke?Ke.includes("application/json")?$e.json():Ke.includes("application/octet-stream")?$e.arrayBuffer():(Ke.includes("text/html")||Ke.includes("text/plain")||Ke.includes("application/xml")||Ke.includes("text/xml"),$e.text()):$e.text()}).then($e=>{if(typeof $e=="string")setTimeout(()=>{gT(Ce)},2e3);else{const Ke=document.createElement("a"),lt=new Blob([$e]),Rt=window.URL.createObjectURL(lt);Ke.style.display="none",Ke.href=Rt,Ke.download="temp.tiff",Ke.click(),window.URL.revokeObjectURL(Rt),ti(!1);let Jt=new URL(window.location.href),hn=new URLSearchParams(Jt.search).get("type");const pn=window.location.origin+window.location.pathname+`?type=${hn}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:pn,time:0,key:ua.current})}).then(Cr=>Cr.json()).then(Cr=>{})}}).catch($e=>{ti(!1),Wo.error({title:a("5000.7026")||"请求超时,下载失败"})})},iC=S.useCallback(Ce=>{Ce.stopPropagation(),(Ce.key==="a"||Ce.key==="A")&&(De.current.getMode()==="translate"?De.current.setMode("scale"):De.current.setMode("translate"))},[]),mT=()=>{let $e=_e.current.getObjectByName("Brain"),Ke=new Ie(-5.097530670166015,-5.308416134996751,-7.990437196406743),lt=new Ie(5.118084411621094,2.006702558657828,6.001559863476661);if($e){const hn=new rs;hn.expandByObject($e.clone()),Ke=hn.min,lt=hn.max}const Rt=lt.x-Ke.x,Jt=lt.y-Ke.y,rn=lt.z-Ke.z;De.current.addEventListener("change",()=>{const hn=It.current.scale,pn=It.current.position;hn.x<1&&It.current.scale.setX(1),hn.x>Rt&&It.current.scale.setX(Rt),hn.y<1&&It.current.scale.setY(1),hn.y>Jt&&It.current.scale.setY(Jt),hn.z<1&&It.current.scale.setZ(1),hn.z>rn&&It.current.scale.setZ(rn),pn.x<Ke.x+It.current.scale.x/2&&It.current.position.setX(Ke.x+It.current.scale.x/2),pn.x>lt.x-It.current.scale.x/2&&It.current.position.setX(lt.x-It.current.scale.x/2),pn.y<Ke.y+It.current.scale.y/2&&It.current.position.setY(Ke.y+It.current.scale.y/2),pn.y>lt.y-It.current.scale.y/2&&It.current.position.setY(lt.y-It.current.scale.y/2),pn.z<Ke.z+It.current.scale.z/2&&It.current.position.setZ(Ke.z+It.current.scale.z/2),pn.z>lt.z-It.current.scale.z/2&&It.current.position.setZ(lt.z-It.current.scale.z/2);const Cr=It.current.geometry.clone();Cr.scale(It.current.scale.x,It.current.scale.y,It.current.scale.z),Cr.translate(It.current.position.x,It.current.position.y,It.current.position.z);const sr=new m4(Cr);lr.current.geometry=sr,Oe({})}),De.current.addEventListener("dragging-changed",function(hn){hn.value?(p.current.enableRotate=!1,p.current.enabled=!1,Rc.current={target:p.current.target.clone(),position:p.current.object.position.clone(),up:p.current.object.up.clone(),enabled:p.current.enabled}):(p.current.enableRotate=!0,p.current.enabled=!0,p.current.reset(),p.current.target.copy(Rc.current.target),p.current.object.position.copy(Rc.current.position),p.current.object.up.copy(Rc.current.up),p.current.update());const pn=It.current.geometry.clone();pn.scale(It.current.scale.x,It.current.scale.y,It.current.scale.z),pn.translate(It.current.position.x,It.current.position.y,It.current.position.z);const Cr=new m4(pn);lr.current.geometry=Cr;const sr=new rs;sr.expandByObject(It.current);const Cn=R.current(sr.min.clone()),ur=R.current(sr.max.clone());let ar=new Jp(Pp(650,620,`${Cn.x.toFixed(2)},${Cn.y.toFixed(2)},${Cn.z.toFixed(2)}`,"#ccc")),Er=new mp(new $f({map:ar}));Er.name="startText";let Qr=new Jp(Pp(650,620,`${ur.x.toFixed(2)},${ur.y.toFixed(2)},${ur.z.toFixed(2)}`,"#ccc")),Ba=new mp(new $f({map:Qr}));Ba.name="endText",Er.position.set(sr.min.x,sr.min.y+.2,sr.min.z),Ba.position.set(sr.max.x,sr.max.y+.6,sr.max.z);const Fi=_e.current.getObjectByName("startText"),sa=_e.current.getObjectByName("endText");Fi&&sa&&_e.current.remove(Fi,sa),_e.current.add(Ir.current,Er,Ba)})},k8=()=>{document.removeEventListener("keypress",iC),_r(a("5000.0006")||"显示数据块"),De.current.enabled=!1,De.current.visible=!1,De.current.detach(),_e.current.remove(De.current),_e.current.remove(It.current,lr.current,Ir.current);const Ce=_e.current.getObjectByName("dashedLine");Ce&&_e.current.remove(Ce);const $e=_e.current.getObjectByName("startText"),Ke=_e.current.getObjectByName("endText");$e&&Ke&&_e.current.remove($e,Ke)},Ng=Ce=>{xi(Ce.target.value)},vT=S.useCallback(Ce=>{Io.current=!0,bi.current=[Ce.x,Ce.y],di.current=[Ce.x,Ce.y]},[]),Ha=S.useCallback(Ce=>{if(Io.current){const $e=[Ce.x,Ce.y],Ke=.005,lt=$e[0]-bi.current[0];$e[1]-bi.current[1];const Rt=lt*Ke,Jt=new Ie;Jt.copy(ki.current.position).sub(p.current.target);const rn=new p9t().setFromVector3(Jt);rn.theta+=Rt,rn.makeSafe(),Jt.setFromSpherical(rn),ki.current.position.copy(p.current.target).add(Jt),ki.current.lookAt(p.current.target),bi.current=[Ce.x,Ce.y]}},[]),Rb=S.useCallback(Ce=>{Io.current=!1;const $e=[Ce.x,Ce.y],Ke=Math.abs($e[0]-di.current[0]),lt=Math.abs($e[1]-di.current[1]);Ke<2&&lt<2?f.domElement.addEventListener("click",Z.current):f.domElement.removeEventListener("click",Z.current)},[]),Ob=()=>{if(!localStorage.getItem("imgKey")){Bo(!0);return}cn(!0),st(!1),Ua({});let Ce={taskType:ls,moving_name:Fn.current,key:localStorage.getItem("imgKey"),swc_space:Ja,resolution:Wc};fetch("/app-api/d-api/count",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ce)}).then($e=>$e.ok?$e.json():(cn(!1),$e.json().then(Ke=>{throw st(!0),$e.status===401&&Wo.confirm({content:Ke.message,onOk(){fetch("/app-api/d-api/update_key",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:localStorage.getItem("imgKey")})}).then(lt=>lt.json())},onCancel(){}}),$e.status===429?Wo.error({content:a("5000.7029")||"请求过于频繁,请稍后再试"}):Wo.error({content:a("5000.7027")||"计算失败"}),new Error(Ke.message||$e.statusText)}))).then($e=>{$e.code===200&&Ua($e),cn(!1)}).catch($e=>{cn(!1),console.error($e)}).finally(()=>{cn(!1)})},Lb=()=>{const Ce=document.createElement("a");Dr.file[0].split(".")[1]=="swc"?Ce.href="/app-api/d-api/dowload/"+Dr.file[0].split(".")[0]+"_ori.swc":Ce.href="/app-api/d-api/dowload/"+Dr.file[0],Ce.download=Dr.file[0],Ce.click()},b1=Ce=>{B&&B(Ce),qa.datumMarkVisibility=Ce},E1=Ce=>{Oc(Ce),qa.coordinateVisibility=Ce,Ce?z&&z.current.forEach($e=>{$e.visible=!0}):z&&z.current.forEach($e=>{$e.visible=!1})},od=()=>{Fl(!1)},U8=()=>{Fl(!1)},aC=Ce=>{if(Bs(Ce),qa.leftHemisphereVisibility=Ce,Ce){for(let $e in Ma.current)Ma.current[$e]&&A.includes($e)&&_e.current.add(Ma.current[$e]);dg.current=!0}else{for(let $e in Ma.current)Ma.current[$e]&&_e.current.remove(Ma.current[$e]);dg.current=!1}},ga=Ce=>{if(qa.cranialVisibility=Ce,Lc({}),Ce)py({filepath:n+"/data/FBX/ExtractedSurface.FBX",index:"ExtractedSurface",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},En);else if(_e.current){const $e=_e.current.getObjectByName("ExtractedSurface");$e&&_e.current.remove($e)}},ws=()=>{if(Ur(!0),mi(!0),D){const Ce={flag:dg.current,point:[D.current.x,D.current.y,D.current.z],fbx:H.current};fetch("/app-api/c-api/compute",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ce)}).then($e=>{if($e.ok)return $e.json();throw Ur(!1),mi(!1),Wo.error({content:a("5000.7028")||"没有合适的路径"}),new Error($e.statusText)}).then($e=>{Ur(!1),mi(!1),$e.code===200&&N?N(new Ie($e.point[0],$e.point[1],$e.point[2])):Wo.error({content:a("5000.7027")||"计算失败"})})}},yc=Ce=>{Ce!=null&&(io(Ce),(Ce===""||Ce.includes(" "))&&ke(Ce))},oC=(Ce,$e)=>{let Ke=0;for(const lt of Ce.toLowerCase())if(lt===$e[Ke]&&(Ke++,Ke===$e.length))return!0;return!1},F8=Ce=>{if(Ce){const $e=Ce.toLowerCase(),Ke=Se.current.defAllexpandedKeys.current.map(lt=>{const Rt=lt.name&&lt.name.toLowerCase()===$e,Jt=lt.fullname&&oC(lt.fullname,$e);return{...lt,matchPriority:Rt?1:Jt?2:3}}).filter(lt=>lt.matchPriority<3).sort((lt,Rt)=>lt.matchPriority-Rt.matchPriority).map(lt=>({value:`${lt.name} ${lt.fullname}`,label:`${lt.name} ${lt.fullname}`}));Fs(Ke)}else Fs([])},yT=Ce=>{const $e=new URLSearchParams;for(const Ke in Ce)$e.append(Ke,Ce[Ke]);vr==3||vr==5?$e.append("aplType","2"):$e.append("aplType","1"),fetch("/app-api/java-api/brainsweb-service/apldetail/add",{method:"post",body:$e}).then(Ke=>{if(Ke.ok)return Ke.json();throw Wo.error({content:a("5000.5047")||"提交失败"}),new Error(Ke.statusText)}).then(Ke=>{Ke.code==1?fc.error("Repeat Email"):fc.success(a("5000.5048")||"提交成功"),Bo(!1),lo(0)})},bT=Ce=>{console.log("Failed:",Ce)},Si=async Ce=>{let $e="";Ce==="DAPI"?$e="/staticresource/data/TIFF/image_356_t.tif":Ce==="PI"&&($e="/staticresource/data/TIFF/image_570_t.tif");try{const Ke=$e.split("/").pop()||"",Rt=await(await fetch($e)).blob(),Jt=new File([Rt],Ke,{type:"image/tiff"}),rn=as.findIndex(Cn=>Cn.key===Xs[0]);let pn=await new Promise(Cn=>{const ur=new FileReader;ur.readAsArrayBuffer(Rt),ur.onload=function(ar){var Er,Qr;if((Er=ar.target)!=null&&Er.result){const Ba=new Uint8Array((Qr=ar.target)==null?void 0:Qr.result);let Fi=hH(Ba);const{width:sa,height:fl}=Fi[0];Cn({width:sa,height:fl})}},ur.onerror=function(ar){console.error("failed")}});const{width:Cr,height:sr}=pn;if(rn>-1){let Cn=JSON.parse(JSON.stringify(as)),ur=Cn[rn];ur.fileList=[Jt],ur.firstRegistrationImg={width:Cr,height:sr},ic(Cn),$s.current=Cn}dT({file:Jt})}catch(Ke){console.error("Error fetching file:",Ke)}},Ao=async Ce=>{let $e="",Ke="";Ce==="3D"?($e="/staticresource/data/TIFF/test.tif",Ke="image/tiff"):Ce==="swc"&&($e="/staticresource/data/TIFF/fixed.swc",Ke="file/swc");try{const Rt=await(await fetch($e)).blob();let Jt=$e.split("/").pop();if(Jt){const rn=new File([Rt],Jt,{type:Ke});zi([rn]),v1({file:rn})}}catch(lt){console.error("Error fetching file:",lt)}};return S.createElement(S.Fragment,null,S.createElement("div",{className:"outBox",style:{right:`${Hr?"430px":"150px"}`},onClick:()=>{const Ce=document.querySelector(".tabsCompnent>.ant-tabs-content-holder");Ce&&Hr?(Ce.style.padding="0px",Ce.style.borderLeft="none"):(vr!=12&&(Ce.style.padding="10px"),Ce.style.borderLeft="1px solid rgb(225, 218, 218)"),Jr($e=>!$e)}},S.createElement("div",{className:"contractrightbox"},S.createElement("div",{className:"smallTriangle",style:{transform:`${Hr?"rotate(180deg)":"rotate(0)"}`}}))),S.createElement(lg,{className:"tabsCompnent",onChange:uo,activeKey:vr.toString(),style:{position:"absolute",right:0,bottom:0,width:`${Hr?"430px":"150px"}`,height:vt.length!=10?"100%":"calc(100% - 42px)",userSelect:"none",borderTop:"1px solid rgb(225, 218, 218)"},tabPosition:"right",tabBarStyle:{width:150,background:"#fff",borderLeft:"1px solid #e1dada"}},vt.includes("label")&&S.createElement(zg,{tab:a("4000.0202")||"组装",key:"1",disabled:Y===2},Hr?S.createElement(S.Fragment,null,S.createElement("div",{style:{width:"200px",height:"100px"}},S.createElement(ts,{ref:it},S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:10},a("4000.0205")||"长度",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:1,max:10,onChange:Ms}))))):null),vt.includes("virtual")&&S.createElement(zg,{tab:a("4000.0203")||"病毒标记",key:"2",disabled:Y===1||Y===0},S.createElement("div",{style:{backgroundColor:"rgba(255,255,255,0.6)",borderRadius:"5px",marginTop:"5px",display:Hr?"block":"none"}},S.createElement("div",null,S.createElement(Na,{disabled:!(A.length>0),className:"ant-btn ant-btn-primary",onClick:Rd},ot),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),a("5000.7046")||"路径规划模式",": ",S.createElement(La.Group,{style:{display:`${j?"block":"none"}`},onChange:M8,value:si,ref:Ee},S.createElement(La,{value:1},a("5000.5035")||"手动"),S.createElement(La,{value:2},a("5000.5034")||"自动")),j?S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}):null,si===2?S.createElement(Na,{className:"ant-btn ant-btn-primary",loading:Qn,disabled:!(A.length>0),onClick:ws},a("5000.5017")||"计算"):null),a("5000.6039")||"平颅方位",":",S.createElement(La.Group,{onChange:Ce=>{Le(Ce.target.value),Ce.target.value?_e.current.rotation.set(-8.3/180*Math.PI,0,0):_e.current.rotation.set(0,0,0)},style:{marginLeft:6},value:Ne},S.createElement(La,{value:0},a("5000.6042")||"关闭"),S.createElement(La,{value:1},a("5000.6043")||"启用")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),j&&S.createElement(S.Fragment,null,a("5000.7047")||"路径限制",": ",S.createElement(La.Group,{value:Me,onChange:Ce=>{if(gt(Ce.target.value),Ce.target.value==2)q("cor",b.current[0].z);else if(Ce.target.value==3)q("sag",b.current[0].x);else{const $e=_e.current.getObjectByName("azimuth"),Ke=_e.current.getObjectByName("azimuth_outline"),lt=_e.current.getObjectByName("azimuth_edge");lt&&_e.current.remove(lt),$e&&_e.current.remove($e),Ke&&_e.current.remove(Ke)}}},S.createElement(La,{value:1},a("5000.7048")||"任意角度"),S.createElement(La,{value:2},a("4000.0103")||"冠状面"),S.createElement(La,{value:3},a("4000.0104")||"矢状面")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})),S.createElement("div",{dangerouslySetInnerHTML:{__html:u}}))),vt.includes("reslicing")&&S.createElement(zg,{tab:a("4000.0204")||"图谱切面",key:"3",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement("div",{style:{width:"276px"}},S.createElement(ts,null,a("7000.7024")||"控制模式",":  ",S.createElement(La.Group,{value:Su,onChange:Ce=>{Ce.target.value==0?De.current.setMode("translate"):De.current.setMode("rotate"),nc(Ce.target.value)}},S.createElement(La,{value:0},a("7000.7022")||"平移"),S.createElement(La,{value:1,disabled:jc!=4},a("7000.7023")||"旋转")),S.createElement("span",{style:{fontStyle:"italic"}},a("5000.0019")||"提示:按R键进入旋转模式")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,a("7000.7021")||"重切片模式",":",S.createElement("br",null),S.createElement(La.Group,{value:jc.toString(),onChange:Ce=>zl(Number(Ce.target.value))},S.createElement(La.Button,{value:"1",style:{padding:"0 5px"}},"Coronal"),S.createElement(La.Button,{value:"2",style:{padding:"0 5px"}},"Sagittal"),S.createElement(La.Button,{value:"3",style:{padding:"0 5px"}},"Horizontal"),S.createElement(La.Button,{value:"4",style:{padding:"0 5px"}},"Arbitrary"))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0210")||"平移-X",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:-5.17,max:5.17,onChange:ju,step:.01,value:Nt,disabled:Nn}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0211")||"平移-Y",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:-5.33,max:2.04,onChange:Qd,step:.01,value:Lt,disabled:Ut}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0212")||"平移-Z",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:-8,max:6,onChange:Ps,step:.01,value:zt,disabled:Bn}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0213")||"角度-X",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:0,max:360,step:1,value:pr,onChange:Ce=>Wu(Ce,1),disabled:gr}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0214")||"角度-Y",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:0,max:360,step:1,value:Vt,onChange:Ce=>Wu(Ce,2),disabled:gr}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),S.createElement(ts,null,S.createElement(Do,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0215")||"角度-Z",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:0,max:360,step:1,value:Fe,onChange:Ce=>Wu(Ce,3),disabled:gr})))),S.createElement(Na,{style:{marginTop:20,marginLeft:10},type:"primary",disabled:rr,onClick:()=>ac()},"Download current slice"),S.createElement(Na,{style:{marginTop:20},type:"primary",disabled:rr,onClick:()=>Cl()},a("7000.0107")||"查看更高分辨率的图像"),S.createElement($i,{style:{margin:"10px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement("div",null,S.createElement("i",null,a("5000.6008")||"点击下方按钮,申请下载各向同性10微米分辨率的STAM图谱3D标签图像")),S.createElement(Na,{style:{marginTop:20},type:"primary",onClick:()=>{m1()}},a("5000.6009")||"请求STAM标签"),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),vt.includes("registration")&&S.createElement(zg,{tab:a("5000.0001")||"脑片配准",key:"4",disabled:Y===2||Y===0},Hr?S.createElement("div",{style:{maxHeight:"calc(100vh - 60px)",overflowY:"auto",overflowX:"hidden"}},rc.map((Ce,$e)=>S.createElement(S.Fragment,null,S.createElement(yA.CheckableTag,{key:Ce,checked:Xs.includes(Ce),onChange:()=>Yd([Ce])},Ce))),rc.length<10?S.createElement(yA,{icon:S.createElement(w5,null),onClick:()=>{Al(Ce=>[...Ce,`Task${rc.length+1}`]),ic(Ce=>[...Ce,{key:`Task${rc.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),$s.current=[...$s.current,{key:`Task${rc.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]}},"New task"):null,as.map((Ce,$e)=>{if(Ce.key===Xs[0]){const{key:Ke,fileList:lt,fileList2:Rt,correspondingPlaneData:Jt,registrationRadioShowType:rn,startButtonLoading:hn}=Ce;return S.createElement("div",{key:Ke},S.createElement(ts,null,S.createElement(Do,null,S.createElement("p",null,S.createElement("span",null,a("5000.6033")||"Upload slice, or use the test "),S.createElement("a",{onClick:()=>{Si("DAPI")}},"DAPI "),"&",S.createElement("a",{onClick:()=>{Si("PI")}}," PI "),a("5000.6034")||"slices:"))),S.createElement(ts,null,S.createElement(Do,null,S.createElement(l9,{accept:"image/tiff",listType:"picture-card",fileList:lt,onPreview:Z0,customRequest:dT,beforeUpload:pn=>Fa(pn),onRemove:()=>{const pn=as.findIndex(Cr=>Cr.key===Xs[0]);if(pn>-1){let Cr=JSON.parse(JSON.stringify(as)),sr=Cr[pn];sr.fileList=[],ic(Cr),$s.current=Cr}}},S.createElement("button",{style:{border:0,background:"none"},type:"button"},S.createElement(w5,null),S.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,null,S.createElement("p",null,S.createElement("span",null,a("5000.7000")||"(可选) 上传第二张脑片图像,默认该图像已经配准到了第一张上传的脑片图像上")))),S.createElement(ts,null,S.createElement(Do,null,S.createElement(l9,{accept:"image/tiff",listType:"picture-card",fileList:Rt,onPreview:Z0,customRequest:pn=>dT(pn,2),beforeUpload:pn=>Fa(pn,2),onRemove:()=>{const pn=as.findIndex(Cr=>Cr.key===Xs[0]);if(pn>-1){let Cr=JSON.parse(JSON.stringify(as)),sr=Cr[pn];sr.fileList2=[],ic(Cr),$s.current=Cr}}},S.createElement("button",{style:{border:0,background:"none"},type:"button"},S.createElement(w5,null),S.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,a("7000.0106")||"计算与上传图像对应的图谱切面",":")),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,S.createElement(Na,{loading:hn,disabled:lt.length<1,onClick:()=>eU($e)},a("7000.0108")||"开始计算"),S.createElement(Na,{onClick:tC,disabled:!Jt.url},a("7000.0109")||"下载保存"))),S.createElement(ts,{style:{marginTop:5}},Jt.base64_url&&S.createElement(rB,{src:Jt.base64_url,width:100})),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Na,{onClick:()=>fT(rn),disabled:!Jt.url},a("5000.0004")||"显示结果"),S.createElement(Do,{style:{display:"flex",alignItems:"center",marginLeft:5}})),S.createElement(ts,null,S.createElement(La.Group,{onChange:bs,value:rn},S.createElement(La,{value:"1"},a("5000.7001")||"atlas"),S.createElement(ts,null,"slice:   ",S.createElement(Qy,{onChange:pn=>{Hc.current=pn.target.checked;const Cr=pn.target.checked?-1:1;_e.current.traverse(sr=>{sr.userData.name==="registrationPng"&&sr.userData.imgType!=1&&sr.scale.set(Cr,1,1)})},disabled:rn!="2"},a("5000.7013")||"左右翻转"),S.createElement("div",{style:{wordWrap:"break-word",width:200}},S.createElement(La,{value:"2"},a("5000.7002")||"first"),Rt.length<1?null:S.createElement(La,{value:"3"},a("5000.7003")||"second"))))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}))}else return null})):null),vt.includes("download")&&S.createElement(zg,{tab:a("5000.0005")||"数据下载",key:"5",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement(ts,null,S.createElement(Do,null,a("5000.0009")||"提示:按A键切换平移和缩放模式")),S.createElement(ts,null,S.createElement(Do,null,S.createElement(Na,{onClick:tU},tr))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,S.createElement(Na,{disabled:tr===(a("5000.0006")||"选取下载范围"),onClick:pT},a("5000.0008")||"预览图像"))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{alignItems:"center"}},S.createElement(Do,null,a("5000.0010")||"设置采样倍数",":"),S.createElement(Do,{span:12},S.createElement(Vh,{min:1,max:6,step:1,defaultValue:2,value:wi,onChange:Ce=>{Ln(Ce),Oe({})},tooltip:{formatter:Ce=>Ce?Math.pow(2,Ce-1):null}}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,null,S.createElement(Na,{loading:oo,disabled:tr===(a("5000.0006")||"选取下载范围"),onClick:hT},a("5000.0005")||"数据下载"))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,null,S.createElement(Do,null,a("5000.5031")||"数据块大小:"),S.createElement(Do,null,D8)),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),vt.includes("mapping")&&S.createElement(zg,{tab:a("5000.5014")||"图谱映射",key:"6",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement(ts,null,S.createElement(Do,null,S.createElement("p",null,a("5000.6035")||"Upload 3D image or swc file already mapped to STAM or CCF, otherwise use the test ",S.createElement("a",{onClick:()=>{Ao("3D")}},a("5000.6036")||"3D image")," or ",S.createElement("a",{onClick:()=>{Ao("swc")}},a("5000.6037")||"swc file:"))),S.createElement(Do,null,S.createElement(l9,{listType:"picture-card",fileList:Oi,onPreview:Z0,customRequest:v1,beforeUpload:Ce=>Fa(Ce,1),onRemove:()=>{zi([])}},S.createElement("button",{style:{border:0,background:"none"},type:"button"},S.createElement(w5,null),S.createElement("div",{style:{marginTop:8}},"Upload"))))),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,{span:12},S.createElement(Vh,{min:1,max:100,onChange:Ce=>{nu(Ce)},disabled:!xu,value:typeof Wc=="number"?Wc:0})),S.createElement(Do,{span:3},S.createElement(MLe,{min:1,max:100,style:{margin:"0 16px"},value:Wc,disabled:!xu,onChange:Ce=>{Ce&&nu(Ce)}}))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,a("5000.5015")||"选择转换方向",":"),S.createElement(Do,null,S.createElement(Do,null,S.createElement("span",{style:{fontSize:"13px",fontStyle:"italic"}},a("5000.7040")||"CCF的垂直方向尺寸已扩展到9mm"),S.createElement(La.Group,{onChange:Ce=>{yr(Ce.target.value)},value:Ja},S.createElement(La,{value:"900"},a("5000.7041")||"YES"),S.createElement(La,{value:"800"},a("5000.7042")||"NO"))),S.createElement(La.Group,{onChange:Ng,value:ls},S.createElement(La,{value:"applySTAM2CCF"},"STAM-",">","CCF"),S.createElement(La,{value:"applyCCF2STAM"},"CCF-",">","STAM")))),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement(ts,{style:{marginTop:5}},S.createElement(Do,null,S.createElement(Na,{loading:Et,disabled:!bt,onClick:Ob},a("7000.0108")||"开始计算"),S.createElement(Na,{onClick:Lb,disabled:!Dr.file},a("7000.0109")||"下载保存"))),S.createElement(ts,{style:{marginTop:5}},Dr.base64_url&&S.createElement(rB,{src:Dr.base64_url,width:100})),S.createElement(ts,{style:{marginTop:5}},S.createElement(Na,{onClick:dl,disabled:!(Dr.file&&Dr.file[1])},a("5000.0004")||"显示结果")),S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),S.createElement("p",null,a("7000.7014")||"您也可以在此下载",S.createElement("a",{href:`${n}/data/Fiji.zip`},"Fji")," / ",S.createElement("a",{href:n+"/data/ImageJ.zip"},"ImageJ"),S.createElement("span",null,a("7000.7015")||"的插件;您可能需要使用测试数据,请"),S.createElement("a",{href:`${n}/data/test.zip`},a("7000.7016")||"在此"),S.createElement("span",null,a("7000.7017")||"下载"))):null),vt.includes("neurons")&&S.createElement(zg,{tab:a("5000.5052")||"神经环路",key:"7",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement("p",null,S.createElement("span",null,a("5000.6029")||"Navigate the "),S.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{Fl(!0)}},a("5000.6030")||"whole-brain connectivity diagram"),S.createElement("span",null,a("5000.6031")||"consisting of single neuronal projections,or:")),Qa?S.createElement(hA,{ref:Gc,style:{width:"100%"},options:ai,placeholder:a("5000.5053")||"Input the inquired structure",onSearch:F8,onChange:yc,value:Qa}):S.createElement(UE,{showSearch:!0,ref:gc,style:{width:"100%"},value:Qa,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:yc,onSearch:yc,treeData:rC(Be)}),S.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},S.createElement("span",null,a("5000.6001")||"Input an inquired structure to visualize the connectivity map, for example, "),S.createElement("a",{onClick:bh("CP"),style:{textDecoration:"underline"}},"CP"),", ",S.createElement("a",{onClick:bh("PIR1"),style:{textDecoration:"underline"}},"PIR1"),", or ",S.createElement("a",{onClick:bh("Primary motor area, Layer 6a"),style:{textDecoration:"underline"}}," Primary motor area, Layer 6a")),Qa?S.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},S.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{const Ce=[];Ce.push(Qa),["Upstream","Downstream"].forEach(Cr=>{Ce.push(Cr),Ce.push("name,neurons"),Sl[Cr].forEach(sr=>{Ce.push(`${sr.name},"${sr.value}"`)})});let $e=Ce.join(`
5093
5093
  `);const Ke=new Blob([$e],{type:"text/csv;charset=utf-8;"}),lt=URL.createObjectURL(Ke),Rt=document.createElement("a");Rt.href=lt,Rt.download="neuronal_data.csv",Rt.click(),URL.revokeObjectURL(lt);let Jt=new URL(window.location.href),hn=new URLSearchParams(Jt.search).get("type");const pn=window.location.origin+window.location.pathname+`?type=${hn}&download=queriedResults`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:pn,time:0})}).then(Cr=>Cr.json()).then(Cr=>{})}},a("5000.7030")||"Click here to download the queried results")):null,S.createElement($i,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:280},dashed:!0}),S.createElement("div",{style:{width:"100%",height:"calc(100vh - 330px)",overflow:"scroll",paddingTop:"10px"}},S.createElement("div",{style:Ws?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},Ws&&S.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5054")||"Upstream"),S.createElement("div",{ref:Ls,style:{width:"100%"}})),S.createElement("br",null),S.createElement("div",{style:Ws?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},Ws&&S.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5055")||"Downstream"),S.createElement("div",{ref:_s,style:{width:"100%"}})))):null),vt.includes("neuronRegistration")&&S.createElement(zg,{tab:a("5000.7032")||"神经元配准",key:"10",disabled:Y===2||Y===0},Hr?S.createElement(S.Fragment,null,S.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},S.createElement(l9,{accept:".swc",fileList:ka,beforeUpload:Ce=>(To($e=>[...$e,Ce]),!1),multiple:!0,onRemove:Ce=>{To($e=>$e.filter(Ke=>Ke.uid!==Ce.uid))}},S.createElement(Na,{icon:S.createElement(ESt,null)},"Upload")),S.createElement(Na,{loading:Bt,disabled:ka.length<1,onClick:()=>{Gn(!0),console.log("swcFileList",ka);const Ce=new FormData;for(let $e=0;$e<ka.length;$e++)Ce.append("swcFile",ka[$e]);fetch("/app-api/d-api/countAll",{method:"POST",body:Ce}).then($e=>{if(!$e.ok)throw Wo.error({content:a("5000.7027")||"计算失败"}),Gn(!1),new Error("Network response was not ok");return $e.json()}).then($e=>{Hu($e.path),Gn(!1),Wo.success({content:a("4000.0226")||"成功"})})}},a("7000.0108")||"开始计算")),S.createElement("div",{style:{marginTop:10}},S.createElement(Na,{disabled:Cu=="",onClick:async()=>{const Ce=`/app-api/d-api/dowloadswc/${Cu}/processed_js_files.zip`;try{const $e=await fetch(Ce,{method:"GET"});if(!$e.ok)throw new Error("下载失败");const Ke=await $e.blob(),lt=window.URL.createObjectURL(Ke),Rt=document.createElement("a");Rt.href=lt,Rt.download="processed_js_files.zip",document.body.appendChild(Rt),Rt.click(),Rt.remove(),window.URL.revokeObjectURL(lt)}catch($e){console.error("下载出错:",$e)}}},a("7000.0109")||"下载结果"),S.createElement(Na,{disabled:Cu=="",onClick:()=>{for(let Ce=0;Ce<ka.length;Ce++)Ib(`/app-api/d-api/dowloadswc/${Cu}/${ka[Ce].name.slice(0,ka[Ce].name.length-4)}.js`)}},a("5000.0004")||"显示结果"))):null),vt.includes("functionalLoop")&&S.createElement(zg,{tab:a("5000.7043")||"功能环路",key:"12",disabled:Y===2||Y===0},S.createElement(dWe,{t:a,loadFunctionLoopFBX:id,style:{display:`${Hr?"block":"none"}`},setFunctionLoopSwcData:yt,fbxCheckItems:A,rightTabIndex:vr,setLeftMenuTabIndex:re}))),gs&&S.createElement(rB,{wrapperStyle:{display:"none"},preview:{visible:Ta,onVisibleChange:Ce=>ha(Ce),afterOpenChange:Ce=>!Ce&&Mo("")},src:gs}),S.createElement(A1,{open:Gt,onClose:()=>Ht(!1),steps:rt}),S.createElement(A1,{open:jt,onClose:()=>Yt(!1),steps:Xt,mask:!0}),S.createElement(A1,{open:tn,onClose:()=>gn(!1),steps:Pi,mask:!0}),S.createElement(A1,{open:On,onClose:()=>In(!1),steps:_n,mask:!0}),S.createElement(A1,{open:Xn,onClose:()=>Tr(!1),steps:or,mask:!0}),S.createElement(A1,{open:zr,onClose:()=>jn(!1),steps:ni,mask:!0}),S.createElement(A1,{open:Wt,onClose:()=>zn(!1),steps:da,mask:!0}),S.createElement(A1,{open:vn,onClose:()=>cr(!1),steps:mn,mask:!0}),S.createElement(Y5,{direction:2,percentage:.2,pointMax:$t.current,pointMin:Ft.current,color:16777215,sliceImgNum:205,slicePath:n+"/data/SLICE/",transformControls:De,controls:p,canvas_width:Xe,canvas_height:et,handleStateUpdate:us,cube_helper:dn,renderer:f,showMesh:nr,setAngleX:mt,setAngleY:fn,setAngleZ:_t,gray_value:Ue,slicing_url:vs,setSectionsInfo:he,sectionsInfoRef:We,sectionPointRef:ll,composer:Ye,menutagShowRef:Bl,tabIndex:vr}),S.createElement(Y5,{direction:3,percentage:.2,pointMax:$t.current,pointMin:Ft.current,color:16777215,sliceImgNum:160,slicePath:n+"/data/SLICE/",transformControls:De,controls:p,canvas_width:Xe,canvas_height:et,handleStateUpdate:us,cube_helper:dn,renderer:f,showMesh:kn,setAngleX:mt,setAngleY:fn,setAngleZ:_t,gray_value:Ue,slicing_url:vs,setSectionsInfo:he,sectionsInfoRef:We,sectionPointRef:ll,composer:Ye,menutagShowRef:Bl,tabIndex:vr}),S.createElement(Y5,{direction:1,percentage:.2,pointMax:$t.current,pointMin:Ft.current,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:De,controls:p,canvas_width:Xe,canvas_height:et,handleStateUpdate:us,cube_helper:dn,renderer:f,showMesh:mr,setAngleX:mt,setAngleY:fn,setAngleZ:_t,gray_value:Ue,slicing_url:vs,setSectionsInfo:he,sectionsInfoRef:We,sectionPointRef:ll,composer:Ye,menutagShowRef:Bl,tabIndex:vr}),S.createElement(Y5,{direction:4,percentage:.5,pointMax:$t.current,pointMin:Ft.current,slice_arbitrary:ht,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:De,controls:p,canvas_width:Xe,canvas_height:et,handleStateUpdate:us,normalVector:At,cube_helper:dn,renderer:f,showMesh:yi,setAngleX:mt,setAngleY:fn,setAngleZ:_t,slicing_url:vs,settransformControlsType:nc,gray_value:Ue,setSectionsInfo:he,sectionsInfoRef:We,sectionPointRef:ll,composer:Ye,menutagShowRef:Bl,tabIndex:vr}),S.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${ii?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},S.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},S.createElement(cD,{spinning:!0,size:"large"}),S.createElement("br",null),"Loading....wait...")),S.createElement(Wo,{open:er,centered:!0,okText:a("5000.0011")||"发送邮件",cancelText:a("5000.0112")||"取消",onOk:()=>{const Ce={imageRange:Va.current,keyNum:ua.current,size:D8};fetch("/app-api/java-api/brainsweb-service/websharing/add",{method:"post",body:JSON.stringify(Ce),headers:{"Content-Type":"application/json"}}).then($e=>{if(!$e.ok)throw"error";return $e.json()}).then($e=>{sn(!1),Wo.success({content:a("5000.7034")||"发送成功"}),ti(!1)}).catch($e=>{Wo.error({content:a("5000.7035")||"服务端异常"}),sn(!1),ti(!1)})},onCancel:()=>sn(!1)},a("5000.0012")||"当前下载文件已超出服务器传输限制,您可以选择降低采样等级或者发送邮件,是否发送邮件?"),S.createElement(Wo,{open:so,centered:!0,footer:null,onCancel:()=>{Bo(!1),lo(0)}},Rs===0?S.createElement(S.Fragment,null,S.createElement("div",{style:{marginTop:20}},a("5000.5044")||"当前key信息尚未验证,不可计算,请选择申请key或者填写Key"),S.createElement("div",{style:{textAlign:"right",marginTop:20}},S.createElement(Na,{style:{marginRight:10},onClick:()=>{Rs===0?lo(1):(lo(0),Bo(!1))}},a("5000.5042")||"申请Key"),S.createElement(Na,{type:"primary",onClick:()=>{Rs===0?lo(2):(lo(0),Bo(!1))}},a("5000.5043")||"填写key"))):Rs===1?S.createElement(S.Fragment,null,S.createElement(dc,{name:"register",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:yT,onFinishFailed:bT,autoComplete:"off"},S.createElement(dc.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},S.createElement(uu,null)),S.createElement(dc.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},S.createElement(uu,null)),S.createElement(dc.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},S.createElement(uu,null)),S.createElement(dc.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},S.createElement(_5e,null)),S.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.5051")||"提示:key值将会发送到所填邮箱账号上,请提交完后关注邮箱是否收到信息。"),S.createElement(dc.Item,{wrapperCol:{offset:10,span:16}},S.createElement(Na,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):S.createElement(S.Fragment,null,a("5000.5049")||"key值",": ",S.createElement(uu,{style:{width:380},placeholder:"brains-wl2mwcUzjU",onChange:Ce=>{localStorage.setItem("imgKey",Ce.target.value)}}),S.createElement("div",{style:{textAlign:"center",marginTop:20}},S.createElement(Na,{type:"primary",onClick:()=>{Bo(!1),localStorage.getItem("imgKey")||localStorage.setItem("imgKey","brains-wl2mwcUzjU"),Ob()}},a("5000.5050")||"保存")))),S.createElement(Wo,{open:tc,centered:!0,footer:null,onCancel:()=>{js(!1),Os(0)}},co===0?S.createElement(S.Fragment,null,S.createElement("div",{style:{marginTop:20}},a("5000.6011")||"请注意,使用此功能需要提供下载许可号,如果您没有下载许可号,请点击下方按钮向我们申请"),S.createElement("div",{style:{textAlign:"right",marginTop:20}},S.createElement(Na,{style:{marginRight:10},onClick:()=>{co===0?Os(1):(Os(0),js(!1))}},a("5000.6012")||"申请下载许可号"),S.createElement(Na,{type:"primary",onClick:()=>{co===0?Os(2):(Os(0),js(!1))}},a("5000.6013")||"填写下载许可号"))):co===1?S.createElement(S.Fragment,null,S.createElement(dc,{name:"register2",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:yT,onFinishFailed:bT,autoComplete:"off"},S.createElement(dc.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},S.createElement(uu,null)),S.createElement(dc.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},S.createElement(uu,null)),S.createElement(dc.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},S.createElement(uu,null)),S.createElement(dc.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},S.createElement(_5e,null)),S.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.6010")||"提示:下载所用的许可号将会发送到您所填写的邮箱,请在提交结束后关注是否收到包含许可号的邮件。"),S.createElement(dc.Item,{wrapperCol:{offset:10,span:16}},S.createElement(Na,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):S.createElement(S.Fragment,null,a("5000.6014")||"许可号",": ",S.createElement(uu,{style:{width:380},onChange:Ce=>{ua.current=Ce.target.value}}),S.createElement("div",{style:{textAlign:"center",marginTop:20}},S.createElement(Na,{type:"primary",onClick:()=>{fetch("/app-api/d-api/check",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:ua.current,aplType:2})}).then(Ce=>Ce.ok?(js(!1),xs.current=!0,vr==3?m1():hT(),Ce.json()):(xs.current=!1,Ce.json())).then(Ce=>{Ce.message&&Wo.error({content:Ce.message})})}},a("5000.5050")||"保存")))),S.createElement(Wo,{open:Te,centered:!0,footer:null,onCancel:()=>{de(!1)}},S.createElement(lg,{tabPosition:"left",onChange:Vo,style:{minHeight:250},key:Q,activeKey:Gr.toString(),defaultActiveKey:"1"},S.createElement(zg,{tab:a("5000.7006")||"可见性",key:"1"},S.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},S.createElement("div",null,a("4000.0217")||"左半脑",": ",S.createElement(vv,{onChange:aC,checked:ms})),S.createElement("div",null,a("4000.0218")||"坐标",": ",S.createElement(vv,{checked:Id,onChange:E1})),S.createElement("div",null,a("4000.0219")||"基准点",": ",S.createElement(vv,{checked:at,onChange:b1})),S.createElement("div",null,a("5000.5016")||"颅骨",": ",S.createElement(vv,{checked:qa.cranialVisibility,onChange:ga})),S.createElement("div",null,a("5000.6044")||"网格",": ",S.createElement(vv,{checked:qa.gridVisibility,defaultChecked:!0,onChange:Ce=>{qe(Ce),qa.gridVisibility=Ce}})),vt.includes("neurons")?S.createElement("div",null,a("5000.7005")||"末梢点",": ",S.createElement(vv,{defaultChecked:!0,checked:qa.terminalVisibility,onChange:Ce=>{Ze.current.end=Ce,qa.terminalVisibility=Ce,Lc({}),_e.current.traverse($e=>{$e.myMeshType==="neuronSphere"&&$e.userData.type=="end"&&($e.visible=Ce)})}})):null,vt.includes("neurons")?S.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a("5000.7007")||"分支点",": ",S.createElement(vv,{defaultChecked:!0,checked:qa.branchingVisibility,onChange:Ce=>{Ze.current.start=Ce,qa.branchingVisibility=Ce,Lc({}),_e.current.traverse($e=>{$e.myMeshType==="neuronSphere"&&$e.userData.type=="start"&&($e.visible=Ce)})}}),S.createElement(kE,{style:{marginLeft:"15px"},format:"rgb",defaultValue:"#A7B5A1",value:qa.branchingColor,onChange:(Ce,$e)=>{qa.branchingColor=$e,Lc({});let Ke;if($e.includes("rgba")){const lt=$e.lastIndexOf(",");Ke=parseFloat($e.slice(lt+1,-1))}_e.current.traverse(lt=>{lt.myMeshType==="neuronSphere"&&lt.userData.type=="start"&&(Ze.current.start_color=$e,lt.material.uniforms.color.value=new Ar(Ze==null?void 0:Ze.current.start_color),lt.userData.color=$e,Ke&&(lt.material.uniforms.opacity.value=Ke))})}})):null,S.createElement("div",{style:{display:"flex",gap:"10px",whiteSpace:"nowrap"}},a("5000.6045")||"外轮廓",": ",S.createElement(vv,{checked:nd,onChange:Ce=>{if(qa.brainContourVisibility=Ce,Ce){let $e=_e.current.getObjectByName("Brain");$e&&($e.visible=!0,Vu(!0))}else{let $e=_e.current.getObjectByName("Brain");$e&&($e.visible=!1,Vu(!1))}}}),S.createElement("div",{style:{marginLeft:"15px",display:"flex"}},a("5000.7004")||"阻光度",": ",S.createElement(Vh,{style:{width:"100px",margin:"6px 5px"},min:0,max:1,step:.1,disabled:!nd,onChange:Ce=>{tu(Ce),qa.brainContourOpacity=Ce;let $e=_e.current.getObjectByName("Brain");$e&&($e.children[0].material.opacity=Ce)},value:typeof zu=="number"?zu:0}))))),S.createElement(zg,{tab:a("5000.5024")||"其它图谱",key:"2"},S.createElement(La.Group,{onChange:Fm,value:ln},S.createElement(Dy,{direction:"vertical"},S.createElement(La,{value:"None"},"None"),S.createElement(La,{value:"CCF"},"CCF"),S.createElement(La,{value:"WHS"},"WHS")))))),S.createElement(Wo,{className:"Echart",title:S.createElement(S.Fragment,null,S.createElement("span",null,"Connectivity diagram"),S.createElement(Na,{onClick:()=>{zc(!Ac)},style:{marginLeft:"15px"}},"Reset ",S.createElement(EMe,{style:{verticalAlign:"super"}}))),style:{position:"absolute",top:"0",bottom:"0",left:"323px",right:"440px",margin:"auto"},open:El,onOk:od,onCancel:U8,width:"auto",footer:null},ge?S.createElement(Yan,{axon_check:ge,fbxTreeDatas:Be,setLeftMenuTabIndex:re,swcRef:Se,setIsChartOpen:Fl,setEchartValue:ke,setChartValue:io,reset:Ac}):null),S.createElement("div",{ref:ir,className:"class",style:{width:0,height:0,overflow:"hidden",position:"fixed",top:"50%",left:"50%"}}))}),Rxn=S.memo(t=>{const{direction:e,percentage:n,pointMax:r,pointMin:i,color:a,sliceImgNum:o,slicePath:s,transformControls:l,controls:u,handleStateUpdate:d,canvas_width:f,canvas_height:p,cube_helper:h,renderer:g,showMesh:y,slice_arbitrary:v,normalVector:m,canMouseMove:b=!0,setAngleX:E,setAngleY:C,setAngleZ:x,gray_value:_,setSectionsInfo:A,sectionsInfoRef:P,sectionPointRef:R,composer:N,menutagShowRef:D,tabIndex:U,settransformControlsType:z,slicing_url:B}=t,j=S.useRef([]),V=S.useRef(null),G=S.useRef(new fS),W=S.useRef(new Ml),Z=S.useRef(0),H=S.useRef(0),X=S.useRef(0),ee=S.useRef(new Sr),K=S.useRef(new TA),Y=S.useRef(!1),te=S.useRef({target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled}),re=S.useRef(null);S.useEffect(()=>(V.current=null,j.current=[new Qp(new Ie(-1,0,0),-1*i.x),new Qp(new Ie(0,1,0),-1*i.y),new Qp(new Ie(0,0,1),-1*i.z),new Qp(new Ie(1,0,0),r.x),new Qp(new Ie(0,-1,0),r.y),new Qp(new Ie(0,0,-1),r.z)],pe(),()=>{v!=null&&v.current&&document.removeEventListener("keydown",ge)}),[r,i]),S.useEffect(()=>{if(y){if(V.current)if(v!=null&&v.current){const ie=R.current.position;v.current=V.current,v.current.position.set(ie.x,ie.y,ie.z),_e.current.add(v.current),Se()}else{const ie=R.current.position;if(V.current){let ye=V.current.name;ye==="CoronalView"?V.current.position.z=ie.z:ye==="SagittalView"?V.current.position.x=ie.x:ye==="HorizontalView"&&(V.current.position.y=ie.y)}_e.current.add(V.current),Se()}if(b){if(g.domElement.addEventListener("mouseup",ae),Q(),l.current=new q_(ki.current,g==null?void 0:g.domElement),l.current.setMode("translate"),l.current.enabled=!0,l.current.visible=!0,V.current){let ie=V.current.name;ie==="CoronalView"?(l.current.showX=!1,l.current.showY=!1):ie==="SagittalView"?(l.current.showY=!1,l.current.showZ=!1):ie==="HorizontalView"&&(l.current.showX=!1,l.current.showZ=!1)}oe()}}else g.domElement.removeEventListener("mouseup",ae);return()=>{g.domElement.removeEventListener("mouseup",ae),g.domElement.style.cursor="default",v!=null&&v.current&&document.removeEventListener("keydown",ge)}},[y,Y]);const Q=()=>{v!=null&&v.current&&document.addEventListener("keydown",ge)},oe=()=>{if(V!=null&&V.current){l.current.remove(V.current),_e.current.getObjectByName("transformControls")&&_e.current.remove(l.current),l.current.name="transformControls",l.current.attach(V.current),l.current.space="local",_e.current.add(l.current);let ye=_e.current.getObjectByName("Brain"),de=new Ie(-5.097530670166015,-5.308416134996751,-7.990437196406743),Te=new Ie(5.118084411621094,2.006702558657828,6.001559863476661);if(ye){const Be=new rs;Be.expandByObject(ye.clone()),de=Be.min,Te=Be.max,l.current.addEventListener("change",()=>{if(V.current){V.current.updateMatrixWorld();const Ye=V.current.position;Ye.x<de.x&&V.current.position.setX(de.x),Ye.x>Te.x&&V.current.position.setX(Te.x),Ye.y<de.y&&V.current.position.setY(de.y),Ye.y>Te.y&&V.current.position.setY(Te.y),Ye.z<de.z&&V.current.position.setZ(de.z),Ye.z>Te.z&&V.current.position.setZ(Te.z)}}),l.current.addEventListener("dragging-changed",function(Ye){var ke,we,We;if(Ye.value){if(u.current.enableRotate=!1,u.current.enabled=!1,te.current={target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled},W.current){let ve=G.current.load(s+"2.png");W.current.map=ve}}else u.current.enableRotate=!0,u.current.enabled=!0,u.current.reset(),u.current.target.copy(te.current.target),u.current.object.position.copy(te.current.position),u.current.object.up.copy(te.current.up),u.current.update(),Se();if(l.current.mode==="rotate"){let ve=l.current.object;if(ve){let he=(((ke=ve==null?void 0:ve.rotation)==null?void 0:ke.x)+2*Math.PI)%(2*Math.PI),Ue=(((we=ve==null?void 0:ve.rotation)==null?void 0:we.y)+2*Math.PI)%(2*Math.PI),Le=(((We=ve==null?void 0:ve.rotation)==null?void 0:We.z)+2*Math.PI)%(2*Math.PI),Ne=(he*180/Math.PI).toFixed(0),at=(Ue*180/Math.PI).toFixed(0),qe=(Le*180/Math.PI).toFixed(0);if(E(parseInt(Ne)),C(parseInt(at)),x(parseInt(qe)),ve.matrixWorld.invert()){if(m!=null&&m.current){const dt=new Ie(0,1,0);m.current=dt.applyEuler(ve==null?void 0:ve.rotation)}}else console.log("逆矩阵计算失败")}}if(l.current.mode==="translate"){let ve=l.current.object;if(ve){let he=ve.position;d&&d({positionx:he.x,positiony:he.y,positionz:he.z})}}})}else setTimeout(()=>{oe()},50)}},ge=ie=>{if(ie.key==="r"){let ye=!Y.current;Y.current=ye,ye?(l.current.setMode("rotate"),z&&z(1)):(l.current.setMode("translate"),z&&z(0))}},pe=()=>{G.current=new fS;let ie=G.current.load(s+"1.png"),ye=new Ml({specular:0,color:"#fff",shininess:20,transparent:!0,map:ie,clippingPlanes:j.current,clipShadows:!0,alphaTest:.1});W.current=ye;let de=r.x-i.x,Te=r.y-i.y,Be=r.z-i.z,Ye=(r.x+i.x)/2,ke=(r.y+i.y)/2,we=(r.z+i.z)/2,We=n,ve;e==1?(Be=.01,we=(1-We)*i.z+We*r.z,ve=new Jn(new zs(de,Te,Be),ye),ve.position.set(Ye,ke,we),ve.name="CoronalView"):e==2?(de=.01,Ye=(1-We)*i.x+We*r.x,ve=new Jn(new zs(de,Te,Be),ye),ve.position.set(Ye,ke,we),ve.name="SagittalView"):e==3?(Te=.01,ke=(1-We)*i.y+We*r.y,ve=new Jn(new zs(de,Te,Be),ye),ve.position.set(Ye,ke,we),ve.name="HorizontalView"):e==4&&(Te=.01,de=de*2,Be=Be*2,ke=(1-We)*i.y+We*r.y,ve=new Jn(new zs(de,Te,Be),ye),ve.position.set(Ye,ke,we),ve.rotation.set(120/180*Math.PI,320/180*Math.PI,270/180*Math.PI),ve.material.needsUpdate=!0,m!=null&&m.current&&(m.current=new Ie(0,1,0))),Z.current=de,H.current=Te,X.current=Be,ve&&(ve.userData.initposition=ve.position.clone(),ve.userData.initRotation=ve.rotation.clone(),V.current=ve,v!=null&&v.current&&(v.current=ve)),e==4&&(v!=null&&v.current)&&(v.current.name="arbitrarySlice")},fe=(ie,ye,de)=>{const Te=Math.cos(ye),Be=Math.sin(ye),Ye=ie.x-de.x,ke=ie.y-de.y,we=Ye*Te-ke*Be,We=Ye*Be+ke*Te;return new Sr(we+de.x,We+de.y)},ae=ie=>{ie.stopPropagation(),ie.preventDefault(),ee.current.x=ie.offsetX/f.current*2-1,ee.current.y=-(ie.offsetY/p.current)*2+1,K.current.setFromCamera(ee.current,ki.current);let ye=K.current.intersectObjects(_e.current.children,!0);if(clearTimeout(re.current),ye.length>0)if(v!=null&&v.current){let de=ye.findIndex(Te=>Te.object==v.current);if(de==-1&&U==3)(P.current.gray||P.current.brains)&&(re.current=setTimeout(()=>{A({}),P.current={}},50));else{const Te=ye[de].uv,Be=ye[de].point;if(ie.button===2){R.current.position.set(Be.x,Be.y,Be.z);let we=new URL(window.location.href),We=new URLSearchParams(we.search),ve=JSON.stringify(Be);We.set("sectionPointPosition",ve),we.search=We.toString(),window.history.replaceState({},"",we);const he=_e.current.getObjectByName("sectionSphere");he?he.position.set(Be.x,Be.y,Be.z):_e.current.add(R.current)}const ke=ye[de].object.material.map;if(ke){const we=ke.image,We=ke.rotation,ve=ke.center,he=fe(Te,-We,ve),Ue=document.createElement("canvas"),Le=Ue.getContext("2d");we&&(Ue.width=we.width,Ue.height=we.height),Le.drawImage(we,0,0);const Ne=Le.getImageData(0,0,Ue.width,Ue.height),at=Math.floor(he.x*Ue.width),Ze=(Math.floor((1-he.y)*Ue.height)*Ue.width+at)*4,dt=Ne.data[Ze],Tt=Ne.data[Ze+1],vt=Ne.data[Ze+2],ct=_.current[`${dt},${Tt},${vt}`];re.current=setTimeout(()=>{dt===0&&P.current.gray===0||(A({gray:`${dt},${Tt},${vt}`,brains:ct,left:ie.clientX,top:ie.clientY}),P.current={gray:dt,brains:ct,left:ie.clientX,top:ie.clientY})},50)}}}else{let de=ye.findIndex(Te=>Te.object==V.current);if(de===-1&&U==3)P.current.gray&&(re.current=setTimeout(()=>{A({}),P.current={}},50));else{const Te=ye[de].uv,Be=ye[de].point;if(ie.button===2){R.current.position.set(Be.x,Be.y,Be.z);let we=new URL(window.location.href),We=new URLSearchParams(we.search),ve=JSON.stringify(Be);We.set("sectionPointPosition",ve),we.search=We.toString(),window.history.replaceState({},"",we);const he=_e.current.getObjectByName("sectionSphere");he?he.position.set(Be.x,Be.y,Be.z):_e.current.add(R.current)}const ke=ye[de].object.material.map;if(ke){const we=ke.image,We=ke.rotation,ve=ke.center,he=fe(Te,-We,ve),Ue=document.createElement("canvas"),Le=Ue.getContext("2d");Ue.width=we.width,Ue.height=we.height,Le.drawImage(we,0,0);const Ne=Le.getImageData(0,0,Ue.width,Ue.height),at=Math.floor(he.x*Ue.width),Ze=(Math.floor((1-he.y)*Ue.height)*Ue.width+at)*4,dt=Ne.data[Ze],Tt=Ne.data[Ze+1],vt=Ne.data[Ze+2],ct=_.current[`${dt},${Tt},${vt}`];re.current=setTimeout(()=>{dt===0&&P.current.gray===0||(A({gray:`${dt},${Tt},${vt}`,brains:ct,left:ie.clientX,top:ie.clientY}),P.current={gray:dt,brains:ct,left:ie.clientX,top:ie.clientY})},50)}}}else P.current.gray&&U==3&&(re.current=setTimeout(()=>{A({}),P.current={}},50))},Se=()=>{var Te,Be,Ye,ke,we,We;const ie=_e.current.getObjectByName("Brain");let ye=new vo;ye.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);let de=new Ie;if(V.current){let ve=(((Be=(Te=V.current)==null?void 0:Te.rotation)==null?void 0:Be.x)+2*Math.PI)%(2*Math.PI),he=(((ke=(Ye=V.current)==null?void 0:Ye.rotation)==null?void 0:ke.y)+2*Math.PI)%(2*Math.PI),Ue=(((We=(we=V.current)==null?void 0:we.rotation)==null?void 0:We.z)+2*Math.PI)%(2*Math.PI),Le=parseInt((ve*180/Math.PI).toFixed(0)),Ne=parseInt((he*180/Math.PI).toFixed(0)),at=parseInt((Ue*180/Math.PI).toFixed(0));if(ie)de=V.current.position.clone().applyMatrix4(ie.matrixWorld.clone().invert()).applyQuaternion(ye);else{setTimeout(()=>{Se()},50);return}e==1?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:de.z})}).then(qe=>qe.ok?qe.json():Wo.error({title:qe.message})).then(qe=>{const Ze=qe.base64;B.current=Ze;let dt=G.current.load(Ze);dt.center.set(.5,.5),dt.rotation=Math.PI,W.current&&(W.current.map=dt)}):e==2?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:de.x,y:0,z:0})}).then(qe=>qe.ok?qe.json():Wo.error({title:qe.message})).then(qe=>{const Ze=qe.base64;B.current=Ze;let dt=G.current.load(Ze);if(V.current){const vt=V.current.geometry.attributes.uv.array,ct=Ge=>{vt[Ge+0]=1,vt[Ge+1]=0,vt[Ge+2]=1,vt[Ge+3]=1,vt[Ge+4]=0,vt[Ge+5]=0,vt[Ge+6]=0,vt[Ge+7]=1},St=Ge=>{vt[Ge+0]=1,vt[Ge+1]=1,vt[Ge+2]=1,vt[Ge+3]=0,vt[Ge+4]=0,vt[Ge+5]=1,vt[Ge+6]=0,vt[Ge+7]=0};ct(0),St(8),V.current.geometry.attributes.uv.needsUpdate=!0,W.current&&(W.current.map=dt)}}):e==3?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:de.y,z:0})}).then(qe=>qe.ok?qe.json():Wo.error({title:qe.message})).then(qe=>{const Ze=qe.base64;B.current=Ze;let dt=G.current.load(Ze);if(V.current){const vt=V.current.geometry.attributes.uv.array;(St=>{vt[St+0]=1,vt[St+1]=0,vt[St+2]=0,vt[St+3]=0,vt[St+4]=1,vt[St+5]=1,vt[St+6]=0,vt[St+7]=1})(24),V.current.geometry.attributes.uv.needsUpdate=!0,W.current&&(W.current.map=dt)}}):fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[Le,Ne,at],center:[de.x,de.y,de.z]})}).then(qe=>qe.ok?qe.json():Wo.error({title:qe.message})).then(qe=>{const Ze=qe.base64;B.current=Ze;let dt=G.current.load(Ze);if(V.current){const vt=V.current.geometry.attributes.uv.array;(St=>{vt[St+0]=0,vt[St+1]=0,vt[St+2]=1,vt[St+3]=0,vt[St+4]=0,vt[St+5]=1,vt[St+6]=1,vt[St+7]=1})(24),V.current.geometry.attributes.uv.needsUpdate=!0,W.current&&(W.current.map=dt)}})}};return S.createElement(S.Fragment,null)}),Y5=Rxn;class F5e extends _m{constructor(e){super(e)}load(e,n,r,i){const a=this,o=new G6(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(s){try{n(a.parse(s))}catch(l){i?i(l):console.error(l),a.manager.itemError(e)}},r,i)}parse(e){function n(u){const d=new DataView(u),f=32/8*3+32/8*3*3+16/8,p=d.getUint32(80,!0);if(80+32/8+p*f===d.byteLength)return!0;const g=[115,111,108,105,100];for(let y=0;y<5;y++)if(r(g,d,y))return!1;return!0}function r(u,d,f){for(let p=0,h=u.length;p<h;p++)if(u[p]!==d.getUint8(f+p))return!1;return!0}function i(u){const d=new DataView(u),f=d.getUint32(80,!0);let p,h,g,y=!1,v,m,b,E,C;for(let D=0;D<80-10;D++)d.getUint32(D,!1)==1129270351&&d.getUint8(D+4)==82&&d.getUint8(D+5)==61&&(y=!0,v=new Float32Array(f*3*3),m=d.getUint8(D+6)/255,b=d.getUint8(D+7)/255,E=d.getUint8(D+8)/255,C=d.getUint8(D+9)/255);const x=84,_=12*4+2,A=new Di,P=new Float32Array(f*3*3),R=new Float32Array(f*3*3),N=new Ar;for(let D=0;D<f;D++){const U=x+D*_,z=d.getFloat32(U,!0),B=d.getFloat32(U+4,!0),j=d.getFloat32(U+8,!0);if(y){const V=d.getUint16(U+48,!0);V&32768?(p=m,h=b,g=E):(p=(V&31)/31,h=(V>>5&31)/31,g=(V>>10&31)/31)}for(let V=1;V<=3;V++){const G=U+V*12,W=D*3*3+(V-1)*3;P[W]=d.getFloat32(G,!0),P[W+1]=d.getFloat32(G+4,!0),P[W+2]=d.getFloat32(G+8,!0),R[W]=z,R[W+1]=B,R[W+2]=j,y&&(N.set(p,h,g).convertSRGBToLinear(),v[W]=N.r,v[W+1]=N.g,v[W+2]=N.b)}}return A.setAttribute("position",new Hs(P,3)),A.setAttribute("normal",new Hs(R,3)),y&&(A.setAttribute("color",new Hs(v,3)),A.hasColors=!0,A.alpha=C),A}function a(u){const d=new Di,f=/solid([\s\S]*?)endsolid/g,p=/facet([\s\S]*?)endfacet/g,h=/solid\s(.+)/;let g=0;const y=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,v=new RegExp("vertex"+y+y+y,"g"),m=new RegExp("normal"+y+y+y,"g"),b=[],E=[],C=[],x=new Ie;let _,A=0,P=0,R=0;for(;(_=f.exec(u))!==null;){P=R;const N=_[0],D=(_=h.exec(N))!==null?_[1]:"";for(C.push(D);(_=p.exec(N))!==null;){let B=0,j=0;const V=_[0];for(;(_=m.exec(V))!==null;)x.x=parseFloat(_[1]),x.y=parseFloat(_[2]),x.z=parseFloat(_[3]),j++;for(;(_=v.exec(V))!==null;)b.push(parseFloat(_[1]),parseFloat(_[2]),parseFloat(_[3])),E.push(x.x,x.y,x.z),B++,R++;j!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+g),B!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+g),g++}const U=P,z=R-P;d.userData.groupNames=C,d.addGroup(U,z,A),A++}return d.setAttribute("position",new la(b,3)),d.setAttribute("normal",new la(E,3)),d}function o(u){return typeof u!="string"?new TextDecoder().decode(u):u}function s(u){if(typeof u=="string"){const d=new Uint8Array(u.length);for(let f=0;f<u.length;f++)d[f]=u.charCodeAt(f)&255;return d.buffer||d}else return u}const l=s(e);return n(l)?i(l):a(o(e))}}const pWe=t=>{const{scene:e,percentage:n,layerxyz:r}=t,i=S.useRef(),a=S.useRef(new Lo),o=.012,s=-7,l=-5.6,u=-8.3,d=S.useRef(0),f=S.useRef(0),p=S.useRef(0),h=S.useRef(0),g=S.useRef(0),y=S.useRef(0),v=S.useRef(0),m=S.useRef(0),b=S.useRef(0),E=S.useRef(0),C=S.useRef(0),x=S.useRef(0),_=S.useRef(),A=S.useRef(0),P=S.useRef();S.useEffect(()=>{R(n,r)},[n,r]);const R=(B,j)=>{var Z;_.current&&(e.current.remove(_.current),_.current.geometry.dispose());var V=new Bc({color:1973790});V.transparent=!0,V.opacity=.9;const G=new Di,W=new Float32Array([0,-6,0,0,6,0]);G.setAttribute("position",new Hs(W,3)),j=="y"?(a.current.position.set(0,0,0),a.current.rotation.y=0,a.current.translateX(s),a.current.translateY(l),a.current.translateZ(u),_.current=new Ea(G,V),_.current.name="axis",(Z=_.current)==null||Z.rotation.set(Math.PI/2,0,0),_.current.scale.set(1,2,1),_.current.position.set((m.current+v.current)/2,b.current+(E.current-b.current)*B,(x.current+C.current)/2),A.current=2):j=="x"?(a.current.position.set(0,0,0),a.current.rotation.y=-90*Math.PI/180,a.current.translateX(s),a.current.translateY(l),a.current.translateZ(u),_.current=new Ea(G,V),_.current.name="axis",_.current.position.set((m.current+v.current)/2,(E.current+b.current)/2,v.current+(m.current-v.current)*(B/2+.5)),A.current=1):j=="z"&&(a.current.position.set(0,0,0),a.current.rotation.y=0,a.current.translateX(s),a.current.translateY(l),a.current.translateZ(u),_.current=new Ea(G,V),_.current.name="axis",_.current.position.set((m.current+v.current)/2,(E.current+b.current)/2,C.current+(x.current-C.current)*B),A.current=0),_.current&&e.current.add(_.current)},N=()=>{let B=new Ml({specular:16775920,color:16775920,shininess:10,visible:!1});P.current=new Jn(new zs(m.current-v.current,E.current-b.current,x.current-C.current),B),P.current.position.set((m.current+v.current)/2,(E.current+b.current)/2,(x.current+C.current)/2)},D=()=>{var B,j,V,G,W,Z;i.current&&(i.current.computeBoundingBox(),d.current=((B=i.current.boundingBox)==null?void 0:B.max.x)||0,f.current=((j=i.current.boundingBox)==null?void 0:j.min.x)||0,p.current=((V=i.current.boundingBox)==null?void 0:V.max.y)||0,h.current=((G=i.current.boundingBox)==null?void 0:G.min.y)||0,g.current=((W=i.current.boundingBox)==null?void 0:W.max.z)||0,y.current=((Z=i.current.boundingBox)==null?void 0:Z.min.z)||0,v.current=f.current*o+s,m.current=d.current*o+s,b.current=h.current*o+l,E.current=p.current*o+l,C.current=y.current*o+u,x.current=g.current*o+u)},U=()=>{let B;return A.current==2?(_.current&&(B=((_.current.position.y-b.current)/(E.current-b.current)).toFixed(4)),parseFloat(B)):A.current==1?(_.current&&(B=((_.current.position.x-v.current)/(m.current-v.current)).toFixed(4)),parseFloat(B)):A.current==0?(_.current&&(B=((_.current.position.z-C.current)/(x.current-C.current)).toFixed(4)),parseFloat(B)):0},z=async(B,j)=>{if(j=="2"){var V=new F5e;V.load(B,function(W){i.current=W;var Z=new Ml({transparent:!0,opacity:.5,depthTest:!1}),H=new Jn(i.current,Z);a.current.add(H),a.current.position.set(0,0,0),a.current.scale.set(o,o,o),a.current.castShadow=!0,a.current.receiveShadow=!0,a.current.translateX(s),a.current.translateY(l),a.current.translateZ(u),e.current.add(a.current),D(),R(n,r),N()})}else{var V=new F5e,G=new Lo;V.load(B,function(Z){var Y,te,re,Q,oe,ge;var H=Z,X=new Ml({transparent:!0,opacity:.5,depthTest:!1}),ee=new Jn(H,X);G.add(ee),G.position.set(0,0,0),G.scale.set(o,o,o),G.castShadow=!0,G.receiveShadow=!0,G.translateX(s),G.translateY(l),G.translateZ(u),e.current.add(G),e.current.remove(a.current),i.current&&i.current.dispose(),H.computeBoundingBox(),d.current=((Y=H.boundingBox)==null?void 0:Y.max.x)||0,f.current=((te=H.boundingBox)==null?void 0:te.min.x)||0,p.current=((re=H.boundingBox)==null?void 0:re.max.y)||0,h.current=((Q=H.boundingBox)==null?void 0:Q.min.y)||0,g.current=((oe=H.boundingBox)==null?void 0:oe.max.z)||0,y.current=((ge=H.boundingBox)==null?void 0:ge.min.z)||0,v.current=f.current*o+s,m.current=d.current*o+s,b.current=h.current*o+l,E.current=p.current*o+l,C.current=y.current*o+u,x.current=g.current*o+u;var K=U();R(K,A.current),P.current&&e.current.remove(P.current),P.current&&P.current.geometry.dispose(),N()})}};return S.useEffect(()=>{z("/staticresource/data/STL/Brain.stl","2")},[]),S.createElement("div",null)};/*!
5094
5094
  * sweetalert2 v11.22.1
5095
5095
  * Released under the MIT License.