brainsmatics 1.1.78 → 1.1.80

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.
@@ -4797,7 +4797,7 @@ Coefficient`,nameTextStyle:{fontSize:12,overflow:"break",width:80,lineHeight:14}
4797
4797
  y:<strong>${Er.toFixed(8)}</strong>
4798
4798
  `}},series:[{data:Ft.data,type:"line",markLine:{symbol:"none",silent:!0,data:Hn!==-1?[{xAxis:Hn,lineStyle:{type:"solid",color:"#c23531"},label:{show:!0,formatter:"{b}"}}]:[]}},{name:"Event Catcher",type:"bar",barWidth:"100%",data:Ft.data,itemStyle:{color:"transparent"},tooltip:{show:!1}}]},zt&&ct.setOption(zt),ct.on("click",ar=>{bn(ar.name)});let kn={dataset:[{source:An}],tooltip:{position:"top",trigger:"item",formatter:function(ar){const Er=ar&&ar.value!==void 0?ar.value:ar&&ar.data&&ar.data.value!==void 0?ar.data.value:ar&&ar.data?ar.data:null,Lr=Array.isArray(Er)?Er:[],Rr=ar&&ar.marker?ar.marker:"",vr=Lr[2]??"",Ti=Lr[3]??"",Oi=Lr[0]??"",ca=Lr[1]??"";return`${Rr} <strong>${vr}</strong><br/>name: ${Ti}<br/>X: ${Oi}<br/>Y: ${ca}`}},visualMap:{orient:"horizontal",type:"piecewise",top:20,left:"center",dimension:mn,pieces:Tt,show:!1},grid:{left:40,top:65+20*Math.ceil(Tt.length/5)},xAxis:{name:p("5000.7057")||"t-SNE 1",nameLocation:"end",nameRotate:90},yAxis:{name:p("5000.7058")||"t-SNE 2"},series:{type:"scatter",encode:{tooltip:[0,1]},symbolSize:10,itemStyle:{borderColor:"#555"},datasetIndex:0}};const Yn=yt(Tt,We.getWidth(),We,mn);We.setOption({graphic:Yn}),kn&&We.setOption(kn),mt&&(mt.style.display="none"),We.on("click",ar=>{const Er=ar&&ar.value!==void 0?ar.value:ar&&ar.data&&ar.data.value!==void 0?ar.data.value:ar&&ar.data?ar.data:null;Array.isArray(Er)&&Er[3]&&Sn(Er[3],ar.color)})}return()=>{let je=On.current;if(je){let ct=qh(je);ct==null||ct.dispose()}if(gr.current){let ct=qh(gr.current);ct==null||ct.dispose()}}},[rr,Dr]);const St=(je,ct,We,mt)=>{var An,un;const Ft=je.value,jt=ct.getOption(),rt=jt.dataset&&jt.dataset[0]&&jt.dataset[0].source||[],mn=cr.current.includes(Ft)?cr.current.filter(Tt=>Tt!==Ft):cr.current.concat(Ft);if(cr.current=mn,be.current.traverse(Tt=>{if(Tt.myMeshType==="SWC"&&Tt.traverse(zt=>{zt instanceof fa&&zt.material.color.set(Tt.userData.initColor)}),Tt.name.indexOf("swcPointGroup")!==-1)for(let zt in Tt.children){let Hn=Tt.children[zt];Hn.userData.type==="cell"&&Hn.myMeshType==="neuronSphere"&&(Hn.material.uniforms.color.value=new xr(Hn.userData.color),Hn.material.uniforms.size.value=.1)}}),cr.current.length===0){ct.setOption({series:[{data:rt}],graphic:yt(We,ct.getWidth(),ct,mt)});return}if(jt.series&&((An=jt.series)==null?void 0:An.length)>0){const Tt=rt.map(zt=>{const Hn=Array.isArray(zt)?zt[mt]:zt[mt]??zt.cluster,kn=cr.current.includes(Hn);return{value:zt,itemStyle:{borderColor:kn?"#ff0000":"transparent",borderWidth:kn?2:0,opacity:kn?1:.15}}});jt.series=[{data:Tt}],jt.graphic=yt(We,ct.getWidth(),ct,mt),ct.setOption(jt);for(let zt=0;zt<cr.current.length;zt++){const Hn=cr.current[zt],kn=rt.filter(Yn=>(Array.isArray(Yn)?Yn[mt]:Yn[mt]??Yn.cluster)===Hn);for(let Yn=0;Yn<kn.length;Yn++){const ar=kn[Yn][3],Er=(un=We.find(Lr=>Lr.value===Hn))==null?void 0:un.color;if(ar){const Lr=n.find(Rr=>Rr.path.indexOf(ar)!==-1);if(Lr){const Rr=be.current.getObjectByName(Lr.name);be.current.traverse(vr=>{if(vr.name===`swcPointGroup${Lr.name}`)for(let Ti in vr.children){let Oi=vr.children[Ti];Oi.userData.type==="cell"&&Oi.myMeshType==="neuronSphere"&&(Oi.material.uniforms.color.value=new xr(Er),Oi.material.uniforms.size.value=.5)}}),Rr&&Rr.traverse(vr=>{vr instanceof fa&&("#"+vr.material.color.getHex().toString(16).padStart(6,"0")===Er?vr.material.color.set(Rr.userData.initColor):vr.material.color.set(Er))})}}}}}};function yt(je,ct,We,mt){const un=Math.floor((ct-40)/50);return je.map((Tt,zt)=>{const Hn=Math.floor(zt/un),Yn=30+zt%un*50,ar=25+Hn*20;return{type:"group",left:Yn,top:ar,children:[{type:"rect",shape:{width:20,height:15},style:{fill:Tt.color,stroke:cr.current.includes(Tt.value)?"#ff0000":"#333"},onclick:()=>St(Tt,We,je,mt),cursor:"pointer",tooltip:{show:!1}},{type:"text",left:20+2,top:3,style:{text:Tt.label,fill:"#000",fontSize:14},onclick:()=>St(Tt,We,je,mt),cursor:"pointer",tooltip:{show:!1}}]}})}const bn=je=>{const ct=document.getElementById("spinner");ct&&(ct.style.display="block");const We=Ft=>{const rt=String(Ft||"").replace(/\\/g,"/").split("/").filter(Boolean),mn=rt.length>0?rt[rt.length-1]:"",An=rt.length>1?rt[rt.length-2]:"",un=mn.replace(/\.js$/i,"").replace(/\.swc$/i,"");return(An==="BIL"||An==="STAM")&&un&&!un.startsWith(`${An}_`)?`${An}_${un}.js`:un?`${un}.js`:""},mt=[];for(let Ft=0;Ft<v.length;Ft++){const jt=n.find(rt=>rt.name===v[Ft]);if(jt){const rt=We(jt.path);rt&&mt.push(rt)}}fetch("/app-api/echarts-api/echarts_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:mt,n_clusters:je})}).then(Ft=>{if(Ft.ok)return Ft.json();throw ct&&(ct.style.display="none"),si.error({title:"Error",content:"Failed to fetch data for charts."}),new Error("Network response was not ok.")}).then(Ft=>{be.current.traverse(jt=>{jt.myMeshType==="SWC"&&jt.traverse(rt=>{rt instanceof fa&&rt.material.color.set(jt.userData.initColor)})}),Qn(Ft),cr.current=[]})},Sn=(je,ct)=>{if(je){const We=n.find(mt=>mt.path.indexOf(je)!==-1);if(We){be.current.traverse(Ft=>{if(Ft.myMeshType==="SWC"&&Ft.traverse(jt=>{jt instanceof fa&&jt.material.color.set(Ft.userData.initColor)}),Ft.name.indexOf("swcPointGroup")!==-1)for(let jt in Ft.children){let rt=Ft.children[jt];rt.userData.type==="cell"&&rt.myMeshType==="neuronSphere"&&(rt.material.uniforms.color.value=new xr(rt.userData.color),rt.material.uniforms.size.value=.1)}});const mt=be.current.getObjectByName(We.name);mt&&(be.current.traverse(Ft=>{if(Ft.name===`swcPointGroup${We.name}`)for(let jt in Ft.children){let rt=Ft.children[jt];rt.userData.type==="cell"&&rt.myMeshType==="neuronSphere"&&(rt.material.uniforms.color.value=new xr(ct),rt.material.uniforms.size.value=.3)}}),mt.traverse(Ft=>{Ft instanceof fa&&("#"+Ft.material.color.getHex().toString(16).padStart(6,"0")===ct?Ft.material.color.set(mt.userData.initColor):Ft.material.color.set(ct))}))}}};return b.createElement("div",{ref:l,style:{transition:"all ease-in 0.5s"}},s==="swc"?b.createElement(b.Fragment,null,X?b.createElement(uP,{ref:Lt,style:{width:"100%",marginBottom:8},options:Ye,placeholder:p("5000.5040")||"Input the region that soma locates",onSearch:Nt,onChange:_r,value:X}):b.createElement(M2,{ref:Fe,showSearch:!0,style:{width:"100%",marginBottom:8},value:X,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:p("5000.5040")||"Input the region that soma locates",allowClear:!0,treeDefaultExpandAll:!1,onChange:zn,onSearch:zn,treeData:an(r)}),b.createElement(M2,{showSearch:!0,ref:Et,style:{width:"100%",marginBottom:8},value:W,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:p("5000.5041")||"Input the region that neuron projects",allowClear:!0,treeDefaultExpandAll:!1,treeCheckable:!0,maxTagCount:1,maxTagPlaceholder:je=>`+${je.length}`,onChange:xi,onSearch:xi,treeData:an(r)}),B&&b.createElement(b.Fragment,null,b.createElement(M2,{treeData:gt,value:Xe,onChange:ve,treeCheckable:!0,placeholder:"Filter by data information",style:{width:"100%",marginTop:8}}),b.createElement(Ha,{style:{marginTop:"5px"}},b.createElement(Pp,{onChange:je=>{yn(je.target.checked)}},p("7000.7025")||"只展示可用神经元"),b.createElement(Ha,{style:{fontStyle:"italic",marginTop:"5px"}},p("7000.7026")||"点击Color按钮,修改神经元颜色;点击Ana.按钮,显示神经元投射路径分析结果;点击Path按钮,在主界面显示神经元经过的脑结构;Src按钮展示了神经元数据的来源"))),b.createElement("div",null,b.createElement(si,{className:"Echart",open:Ve,onOk:()=>{vt(!1)},onCancel:()=>{vt(!1)},width:"auto",footer:null},b.createElement(Ng,{activeKey:Mt,onChange:Ke},b.createElement(NG,{tab:p("5000.7009")||"神经元末梢分布",key:"1"},on&&b.createElement(Ni,null,"Isocortex"),b.createElement(cs,{ref:hn,className:"Isocortex",Name:"Isocortex",t:p,data_change:it,data_c:Je.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"]}),Ot&&b.createElement(Ni,null,"HPF"),b.createElement(cs,{ref:Vt[0],className:"HPF",Name:"HPF",t:p,data_change:it,data_c:Je.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"]}),b.createElement(cs,{ref:Vt[1],className:"HPF",Name:"HPF",t:p,data_change:it,data_c:Je.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),b.createElement(cs,{ref:Vt[2],className:"HPF",Name:"HPF",t:p,data_change:it,data_c:Je.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),Wt&&b.createElement(Ni,null,"CNU"),b.createElement(cs,{ref:En,className:"CNU",Name:"CNU",t:p,data_change:it,data_c:Je.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:["_"]}),sn&&b.createElement(Ni,null,"OLF"),b.createElement(cs,{ref:fn[0],className:"OLF",Name:"OLF",t:p,data_change:it,data_c:Je.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),b.createElement(cs,{ref:fn[1],className:"OLF",Name:"OLF",t:p,data_change:it,data_c:Je.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"]}),Me&&b.createElement(Ni,null,"TH"),b.createElement(cs,{ref:Cn,className:"TH",Name:"TH",t:p,data_change:it,data_c:Je.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:["_"]}),At&&b.createElement(Ni,null,"HY"),b.createElement(cs,{ref:Zt,className:"HY",Name:"HY",t:p,data_change:it,data_c:Je.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:["_"]}),Rt&&b.createElement(Ni,null,"MB"),b.createElement(cs,{ref:Qt,className:"MB",Name:"MB",t:p,data_change:it,data_c:Je.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:["_"]}),Yt&&b.createElement(Ni,null,"HB"),b.createElement(cs,{ref:ht,className:"HB",Name:"HB",t:p,data_change:it,data_c:Je.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:["_"]}),Qe&&b.createElement(Ni,null,"CB"),b.createElement(cs,{ref:pn[0],className:"CB",Name:"CB",t:p,data_change:it,data_c:Je.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"]}),b.createElement(cs,{ref:pn[1],className:"CB",Name:"CB",t:p,data_change:it,data_c:Je.current,col:["FN","IP","DN","VeCB"],row:["_"]})),b.createElement(NG,{tab:p("5000.7011")||"神经元投射模式",key:"2"},r?b.createElement(dne,{data:Ge,fbxTreeDatas:r}):null),b.createElement(NG,{tab:p("5000.7012")||"投射长度分布",key:"3"},on&&b.createElement(Ni,null,"Isocortex"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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"]}),Ot&&b.createElement(Ni,null,"HPF"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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"]}),b.createElement(us,{t:p,data_change:it,data_c:Ge,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),b.createElement(us,{t:p,data_change:it,data_c:Ge,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),Wt&&b.createElement(Ni,null,"CNU"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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:["_"]}),sn&&b.createElement(Ni,null,"OLF"),b.createElement(us,{t:p,data_change:it,data_c:Ge,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),b.createElement(us,{t:p,data_change:it,data_c:Ge,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),Me&&b.createElement(Ni,null,"TH"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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:["_"]}),At&&b.createElement(Ni,null,"HY"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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:["_"]}),Rt&&b.createElement(Ni,null,"MB"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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:["_"]}),Yt&&b.createElement(Ni,null,"HB"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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:["_"]}),Qe&&b.createElement(Ni,null,"CB"),b.createElement(us,{t:p,data_change:it,data_c:Ge,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"]}),b.createElement(us,{t:p,data_change:it,data_c:Ge,col:["FN","IP","DN","VeCB"],row:["_"]})))),b.createElement(q2,{className:"SwcTable",rowSelection:ke,columns:wi,dataSource:mi,locale:Pn}),b.createElement("div",{style:{top:0,left:0,width:"100%",height:"100vh",display:rr?"block":"none",zIndex:998,overflowX:"hidden",position:"absolute",background:"#fff"}},b.createElement(ri,{type:"text",shape:"circle",icon:b.createElement(kp,null),style:{position:"absolute",right:4,top:4},onClick:()=>{Cr(!1),cr.current=[];let je=document.getElementById("leftContent");je&&(je.style.overflow="auto"),be.current.traverse(ct=>{ct.myMeshType==="SWC"&&ct.traverse(We=>{We instanceof fa&&We.material.color.set(ct.userData.initColor)})})}}),b.createElement("div",{style:{marginTop:40}},b.createElement("h1",{style:{marginLeft:15,margin:0,display:"block",textAlign:"center"}},p("5000.7052")||"基于神经元形态的聚类及评估"),b.createElement("div",{style:{display:"flex",justifyContent:"center",marginTop:10}},b.createElement("a",{onClick:()=>{si.info({title:p("5000.7061")||"Introduction",content:b.createElement("div",null,b.createElement("p",null,p("5000.7056")||"折线图:本图根据投射靶区分布情况,对所选单神经元进行了不同数量的聚类,并对聚类结果使用轮廓系数进行了评估。通常来说,轮廓系数越大,表示聚类效果越好。您可以点击鼠标左键,选中一个您满意的聚类数。"))})}},p("5000.7061")||"使用说明"))),b.createElement("div",{ref:On,style:{width:"100%",height:"300px"}}),b.createElement("div",null,b.createElement("h1",{style:{marginLeft:25,margin:0,display:"block",textAlign:"center"}},p("5000.7059")||"Visualization of neuron clusters"),b.createElement("div",{style:{display:"flex",justifyContent:"center",marginTop:10}},b.createElement("a",{onClick:()=>{si.info({title:p("5000.7061")||"使用说明",content:b.createElement("div",null,b.createElement("p",null,p("5000.7060")||"点状图:本图根据t-SNE算法,将神经元以散点形式绘制在了由2个主成分所构成的分布图上,每种颜色代表1个类别。点击分布图中的任意一个点,该点所对应的神经元将在主窗口中被重新渲染为所属类别的颜色。点击分布图上方代表任意一个类别的色块,所有属于该类别的神经元都将在主窗口中被重新渲染为该类别的颜色。"))})}},p("5000.7061")||"使用说明"))),b.createElement("div",{ref:gr,style:{width:"100%",height:"440px"}})))):b.createElement(b.Fragment,null,b.createElement(pHt,{style:{marginBottom:8},placeholder:"Search",onChange:fs,onKeyPress:je=>{je.stopPropagation()}}),b.createElement(i3,{showLine:!0,onExpand:Ba,defaultExpandParent:!0,expandedKeys:Q,onCheck:kr,checkable:!0,selectable:!1,treeData:mi,checkedKeys:v,checkStrictly:!0,autoExpandParent:re,style:{paddingLeft:"2px"}})))});let yHt=new URL(window.location.href),bHt=new URLSearchParams(yHt.search),lye=bHt.get("brainContourOpacity");const xHt=t=>{const{regionData:e}=t,[n,r]=b.useState(!1);return b.useEffect(()=>{let i=lye?JSON.parse(lye):.3;a2({filepath:e+"/data/FBX/outline.FBX",index:"Brain",color:"0xcccccc",opacity:i,offsetZ:0,R:1,callback:function(){r(!1)}})},[]),b.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"}},b.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},b.createElement(V1,{spinning:!0,size:"large"}),b.createElement("br",null),"Loading....wait..."))},gY={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"},cOe={};for(const t in gY)cOe[gY[t]]=Number(t);const CHt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:gY,tagsByName:cOe},Symbol.toStringTag,{value:"Module"})),mY={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"},uOe={};for(const t in mY)uOe[mY[t]]=Number(t);const wHt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:mY,tagsByName:uOe},Symbol.toStringTag,{value:"Module"})),vY={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"},dOe={};for(const t in vY)dOe[vY[t]]=Number(t);const SHt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:vY,tagsByName:dOe},Symbol.toStringTag,{value:"Module"}));function cye(t,e="utf8"){return new TextDecoder(e).decode(t)}const _Ht=new TextEncoder;function EHt(t){return _Ht.encode(t)}const THt=1024*8,IHt=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),FG={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 qU{constructor(e=THt,n={}){Ln(this,"buffer");Ln(this,"byteLength");Ln(this,"byteOffset");Ln(this,"length");Ln(this,"offset");Ln(this,"lastWrittenByte");Ln(this,"littleEndian");Ln(this,"_data");Ln(this,"_mark");Ln(this,"_marks");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 qU)&&(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=r,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=FG[n].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,a=this.buffer.slice(i,i+r);if(this.littleEndian===IHt&&n!=="uint8"&&n!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const l=new FG[n](s.buffer);return this.offset+=r,l.reverse(),l}const o=new FG[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 cye(this.readBytes(e))}decodeText(e=1,n="utf8"){return cye(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(EHt(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function AHt(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 MHt(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 LHt(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 uye={standard:SHt,exif:CHt,gps:wHt};class fOe{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(uye[this.kind].tagsByName[e]);throw new Error("expected a number or string")}get map(){if(!this._hasMap){const e=uye[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 hOe=new Map([[1,[1,dye]],[2,[1,PHt]],[3,[2,NHt]],[4,[4,DHt]],[5,[8,kHt]],[6,[1,UHt]],[7,[1,dye]],[8,[2,FHt]],[9,[4,BHt]],[10,[8,VHt]],[11,[4,$Ht]],[12,[8,zHt]]]);function RHt(t,e){const n=hOe.get(t);if(!n)throw new Error(`type not found: ${t}`);return n[0]*e}function OHt(t,e,n){const r=hOe.get(e);if(!r)throw new Error(`type not found: ${e}`);return r[1](t,n)}function dye(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 PHt(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 NHt(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 DHt(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 kHt(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 UHt(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 FHt(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 BHt(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 VHt(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 $Ht(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 zHt(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 HHt=256,fye=257,hye=258,pye=9;let LC=[];function GHt(){if(LC.length===0){for(let e=0;e<256;e++)LC.push([e]);const t=[];for(let e=256;e<4096;e++)LC.push(t)}}const jHt=[511,1023,2047,4095],WHt=[0,0,0,0,0,0,0,0,0,511,1023,2047,4095];class XHt{constructor(e){this.nextData=0,this.nextBits=0,this.bytePointer=0,this.tableLength=hye,this.currentBitLength=pye,this.stripArray=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),this.outData=new qU(e.byteLength),this.initializeTable()}decode(){let e=0,n=0;for(;(e=this.getNextCode())!==fye;)if(e===HHt){if(this.initializeTable(),e=this.getNextCode(),e===fye)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(){GHt(),this.tableLength=hye,this.currentBitLength=pye}writeString(e){this.outData.writeBytes(e)}stringFromCode(e){return LC[e]}isInTable(e){return e<this.tableLength}addStringToTable(e){if(LC[this.tableLength++]=e,LC.length>4096)throw LC=[],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===WHt[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&jHt[this.currentBitLength-9];return this.nextBits-=this.currentBitLength,this.bytePointer>this.stripArray.length?257:e}}function ZHt(t){return new XHt(t).decode()}const KHt=/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;class gye extends fOe{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=KHt.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 OS(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 OS(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 OS(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 OS(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}get tileWidth(){return this.get("TileWidth")}get tileHeight(){return this.get("TileLength")}get tileOffsets(){return OS(this.get("TileOffsets"))}get tileByteCounts(){return OS(this.get("TileByteCounts"))}get tiled(){return this.tileWidth!==void 0&&this.tileHeight!==void 0&&this.tileOffsets!==void 0&&this.tileByteCounts!==void 0}}function OS(t){return typeof t=="number"?[t]:t}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const YHt=4,mye=0,vye=1,qHt=2;function J4(t){let e=t.length;for(;--e>=0;)t[e]=0}const JHt=0,pOe=1,QHt=2,eGt=3,tGt=258,fne=29,eM=256,G8=eM+1+fne,lE=30,hne=19,gOe=2*G8+1,RC=15,BG=16,nGt=7,pne=256,mOe=16,vOe=17,yOe=18,yY=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]),WO=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]),rGt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bOe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),iGt=512,p1=new Array((G8+2)*2);J4(p1);const P6=new Array(lE*2);J4(P6);const j8=new Array(iGt);J4(j8);const W8=new Array(tGt-eGt+1);J4(W8);const gne=new Array(fne);J4(gne);const eD=new Array(lE);J4(eD);function VG(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 xOe,COe,wOe;function $G(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const SOe=t=>t<256?j8[t]:j8[256+(t>>>7)],X8=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},Jh=(t,e,n)=>{t.bi_valid>BG-n?(t.bi_buf|=e<<t.bi_valid&65535,X8(t,t.bi_buf),t.bi_buf=e>>BG-t.bi_valid,t.bi_valid+=n-BG):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},ev=(t,e,n)=>{Jh(t,n[e*2],n[e*2+1])},_Oe=(t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},aGt=t=>{t.bi_valid===16?(X8(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)},oGt=(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,h,p,g,y=0;for(h=0;h<=RC;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<gOe;u++)d=t.heap[u],h=n[n[d*2+1]*2+1]+1,h>l&&(h=l,y++),n[d*2+1]=h,!(d>r)&&(t.bl_count[h]++,p=0,d>=s&&(p=o[d-s]),g=n[d*2],t.opt_len+=g*(h+p),a&&(t.static_len+=g*(i[d*2+1]+p)));if(y!==0){do{for(h=l-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[l]--,y-=2}while(y>0);for(h=l;h!==0;h--)for(d=t.bl_count[h];d!==0;)f=t.heap[--u],!(f>r)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),d--)}},EOe=(t,e,n)=>{const r=new Array(RC+1);let i=0,a,o;for(a=1;a<=RC;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]=_Oe(r[s]++,s))}},sGt=()=>{let t,e,n,r,i;const a=new Array(RC+1);for(n=0,r=0;r<fne-1;r++)for(gne[r]=n,t=0;t<1<<yY[r];t++)W8[n++]=r;for(W8[n-1]=r,i=0,r=0;r<16;r++)for(eD[r]=i,t=0;t<1<<WO[r];t++)j8[i++]=r;for(i>>=7;r<lE;r++)for(eD[r]=i<<7,t=0;t<1<<WO[r]-7;t++)j8[256+i++]=r;for(e=0;e<=RC;e++)a[e]=0;for(t=0;t<=143;)p1[t*2+1]=8,t++,a[8]++;for(;t<=255;)p1[t*2+1]=9,t++,a[9]++;for(;t<=279;)p1[t*2+1]=7,t++,a[7]++;for(;t<=287;)p1[t*2+1]=8,t++,a[8]++;for(EOe(p1,G8+1,a),t=0;t<lE;t++)P6[t*2+1]=5,P6[t*2]=_Oe(t,5);xOe=new VG(p1,yY,eM+1,G8,RC),COe=new VG(P6,WO,0,lE,RC),wOe=new VG(new Array(0),rGt,0,hne,nGt)},TOe=t=>{let e;for(e=0;e<G8;e++)t.dyn_ltree[e*2]=0;for(e=0;e<lE;e++)t.dyn_dtree[e*2]=0;for(e=0;e<hne;e++)t.bl_tree[e*2]=0;t.dyn_ltree[pne*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},IOe=t=>{t.bi_valid>8?X8(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},yye=(t,e,n,r)=>{const i=e*2,a=n*2;return t[i]<t[a]||t[i]===t[a]&&r[e]<=r[n]},zG=(t,e,n)=>{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i<t.heap_len&&yye(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!yye(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r},bye=(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?ev(t,i,e):(o=W8[i],ev(t,o+eM+1,e),s=yY[o],s!==0&&(i-=gne[o],Jh(t,i,s)),r--,o=SOe(r),ev(t,o,n),s=WO[o],s!==0&&(r-=eD[o],Jh(t,r,s)));while(a<t.sym_next);ev(t,pne,e)},bY=(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=gOe,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--)zG(t,n,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],zG(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++,zG(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],oGt(t,e),EOe(n,l,t.bl_count)},xye=(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[mOe*2]++):s<=10?t.bl_tree[vOe*2]++:t.bl_tree[yOe*2]++,s=0,i=a,o===0?(l=138,u=3):a===o?(l=6,u=3):(l=7,u=4))},Cye=(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 ev(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(ev(t,a,t.bl_tree),s--),ev(t,mOe,t.bl_tree),Jh(t,s-3,2)):s<=10?(ev(t,vOe,t.bl_tree),Jh(t,s-3,3)):(ev(t,yOe,t.bl_tree),Jh(t,s-11,7));s=0,i=a,o===0?(l=138,u=3):a===o?(l=6,u=3):(l=7,u=4)}},lGt=t=>{let e;for(xye(t,t.dyn_ltree,t.l_desc.max_code),xye(t,t.dyn_dtree,t.d_desc.max_code),bY(t,t.bl_desc),e=hne-1;e>=3&&t.bl_tree[bOe[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},cGt=(t,e,n,r)=>{let i;for(Jh(t,e-257,5),Jh(t,n-1,5),Jh(t,r-4,4),i=0;i<r;i++)Jh(t,t.bl_tree[bOe[i]*2+1],3);Cye(t,t.dyn_ltree,e-1),Cye(t,t.dyn_dtree,n-1)},uGt=t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return mye;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return vye;for(n=32;n<eM;n++)if(t.dyn_ltree[n*2]!==0)return vye;return mye};let wye=!1;const dGt=t=>{wye||(sGt(),wye=!0),t.l_desc=new $G(t.dyn_ltree,xOe),t.d_desc=new $G(t.dyn_dtree,COe),t.bl_desc=new $G(t.bl_tree,wOe),t.bi_buf=0,t.bi_valid=0,TOe(t)},AOe=(t,e,n,r)=>{Jh(t,(JHt<<1)+(r?1:0),3),IOe(t),X8(t,n),X8(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},fGt=t=>{Jh(t,pOe<<1,3),ev(t,pne,p1),aGt(t)},hGt=(t,e,n,r)=>{let i,a,o=0;t.level>0?(t.strm.data_type===qHt&&(t.strm.data_type=uGt(t)),bY(t,t.l_desc),bY(t,t.d_desc),o=lGt(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?AOe(t,e,n,r):t.strategy===YHt||a===i?(Jh(t,(pOe<<1)+(r?1:0),3),bye(t,p1,P6)):(Jh(t,(QHt<<1)+(r?1:0),3),cGt(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),bye(t,t.dyn_ltree,t.dyn_dtree)),TOe(t),r&&IOe(t)},pGt=(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[(W8[n]+eM+1)*2]++,t.dyn_dtree[SOe(e)*2]++),t.sym_next===t.sym_end);var gGt=dGt,mGt=AOe,vGt=hGt,yGt=pGt,bGt=fGt,xGt={_tr_init:gGt,_tr_stored_block:mGt,_tr_flush_block:vGt,_tr_tally:yGt,_tr_align:bGt};const CGt=(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 Z8=CGt;const wGt=()=>{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},SGt=new Uint32Array(wGt()),_Gt=(t,e,n,r)=>{const i=SGt,a=r+n;t^=-1;for(let o=r;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1};var Nd=_Gt,QE={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"},tM={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:EGt,_tr_stored_block:xY,_tr_flush_block:TGt,_tr_tally:B2,_tr_align:IGt}=xGt,{Z_NO_FLUSH:V2,Z_PARTIAL_FLUSH:AGt,Z_FULL_FLUSH:MGt,Z_FINISH:P0,Z_BLOCK:Sye,Z_OK:gf,Z_STREAM_END:_ye,Z_STREAM_ERROR:hv,Z_DATA_ERROR:LGt,Z_BUF_ERROR:HG,Z_DEFAULT_COMPRESSION:RGt,Z_FILTERED:OGt,Z_HUFFMAN_ONLY:fR,Z_RLE:PGt,Z_FIXED:NGt,Z_DEFAULT_STRATEGY:DGt,Z_UNKNOWN:kGt,Z_DEFLATED:JU}=tM,UGt=9,FGt=15,BGt=8,VGt=29,$Gt=256,CY=$Gt+1+VGt,zGt=30,HGt=19,GGt=2*CY+1,jGt=15,Ds=3,w2=258,pv=w2+Ds+1,WGt=32,e4=42,mne=57,wY=69,SY=73,_Y=91,EY=103,OC=113,qI=666,yh=1,Q4=2,C3=3,e5=4,XGt=3,PC=(t,e)=>(t.msg=QE[e],e),Eye=t=>t*2-(t>4?9:0),o2=t=>{let e=t.length;for(;--e>=0;)t[e]=0},ZGt=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 KGt=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,$2=KGt;const bp=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))},Rp=(t,e)=>{TGt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,bp(t.strm)},ll=(t,e)=>{t.pending_buf[t.pending++]=e},tI=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},TY=(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=Z8(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Nd(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},MOe=(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-pv?t.strstart-(t.w_size-pv):0,u=t.window,d=t.w_mask,f=t.prev,h=t.strstart+w2;let p=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]!==p||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&r<h);if(a=w2-(h-r),r=h-w2,a>o){if(t.match_start=e,o=a,a>=s)break;p=u[r+o-1],g=u[r+o]}}while((e=f[e&d])>l&&--n!==0);return o<=t.lookahead?o:t.lookahead},t4=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-pv)&&(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),ZGt(t),r+=e),t.strm.avail_in===0)break;if(n=TY(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=Ds)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=$2(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=$2(t,t.ins_h,t.window[i+Ds-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<Ds)););}while(t.lookahead<pv&&t.strm.avail_in!==0)},LOe=(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!==P0||e===V2||r!==i+t.strm.avail_in)))break;o=e===P0&&r===i+t.strm.avail_in?1:0,xY(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,bp(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&&(TY(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?e5:e!==V2&&e!==P0&&t.strm.avail_in===0&&t.strstart===t.block_start?Q4:(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&&(TY(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===P0)&&e!==V2&&t.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=e===P0&&t.strm.avail_in===0&&r===i?1:0,xY(t,t.block_start,r,o),t.block_start+=r,bp(t.strm)),o?C3:yh)},GG=(t,e)=>{let n,r;for(;;){if(t.lookahead<pv){if(t4(t),t.lookahead<pv&&e===V2)return yh;if(t.lookahead===0)break}if(n=0,t.lookahead>=Ds&&(t.ins_h=$2(t,t.ins_h,t.window[t.strstart+Ds-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-pv&&(t.match_length=MOe(t,n)),t.match_length>=Ds)if(r=B2(t,t.strstart-t.match_start,t.match_length-Ds),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Ds){t.match_length--;do t.strstart++,t.ins_h=$2(t,t.ins_h,t.window[t.strstart+Ds-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=$2(t,t.ins_h,t.window[t.strstart+1]);else r=B2(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Rp(t,!1),t.strm.avail_out===0))return yh}return t.insert=t.strstart<Ds-1?t.strstart:Ds-1,e===P0?(Rp(t,!0),t.strm.avail_out===0?C3:e5):t.sym_next&&(Rp(t,!1),t.strm.avail_out===0)?yh:Q4},PS=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<pv){if(t4(t),t.lookahead<pv&&e===V2)return yh;if(t.lookahead===0)break}if(n=0,t.lookahead>=Ds&&(t.ins_h=$2(t,t.ins_h,t.window[t.strstart+Ds-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=Ds-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-pv&&(t.match_length=MOe(t,n),t.match_length<=5&&(t.strategy===OGt||t.match_length===Ds&&t.strstart-t.match_start>4096)&&(t.match_length=Ds-1)),t.prev_length>=Ds&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Ds,r=B2(t,t.strstart-1-t.prev_match,t.prev_length-Ds),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=$2(t,t.ins_h,t.window[t.strstart+Ds-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=Ds-1,t.strstart++,r&&(Rp(t,!1),t.strm.avail_out===0))return yh}else if(t.match_available){if(r=B2(t,0,t.window[t.strstart-1]),r&&Rp(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return yh}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=B2(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Ds-1?t.strstart:Ds-1,e===P0?(Rp(t,!0),t.strm.avail_out===0?C3:e5):t.sym_next&&(Rp(t,!1),t.strm.avail_out===0)?yh:Q4},YGt=(t,e)=>{let n,r,i,a;const o=t.window;for(;;){if(t.lookahead<=w2){if(t4(t),t.lookahead<=w2&&e===V2)return yh;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Ds&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=t.strstart+w2;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=w2-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Ds?(n=B2(t,1,t.match_length-Ds),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=B2(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Rp(t,!1),t.strm.avail_out===0))return yh}return t.insert=0,e===P0?(Rp(t,!0),t.strm.avail_out===0?C3:e5):t.sym_next&&(Rp(t,!1),t.strm.avail_out===0)?yh:Q4},qGt=(t,e)=>{let n;for(;;){if(t.lookahead===0&&(t4(t),t.lookahead===0)){if(e===V2)return yh;break}if(t.match_length=0,n=B2(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Rp(t,!1),t.strm.avail_out===0))return yh}return t.insert=0,e===P0?(Rp(t,!0),t.strm.avail_out===0?C3:e5):t.sym_next&&(Rp(t,!1),t.strm.avail_out===0)?yh:Q4};function Lm(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 JI=[new Lm(0,0,0,0,LOe),new Lm(4,4,8,4,GG),new Lm(4,5,16,8,GG),new Lm(4,6,32,32,GG),new Lm(4,4,16,16,PS),new Lm(8,16,32,32,PS),new Lm(8,16,128,128,PS),new Lm(8,32,128,256,PS),new Lm(32,128,258,1024,PS),new Lm(32,258,258,4096,PS)],JGt=t=>{t.window_size=2*t.w_size,o2(t.head),t.max_lazy_match=JI[t.level].max_lazy,t.good_match=JI[t.level].good_length,t.nice_match=JI[t.level].nice_length,t.max_chain_length=JI[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Ds-1,t.match_available=0,t.ins_h=0};function QGt(){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=JU,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(GGt*2),this.dyn_dtree=new Uint16Array((2*zGt+1)*2),this.bl_tree=new Uint16Array((2*HGt+1)*2),o2(this.dyn_ltree),o2(this.dyn_dtree),o2(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(jGt+1),this.heap=new Uint16Array(2*CY+1),o2(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*CY+1),o2(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 nM=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==e4&&e.status!==mne&&e.status!==wY&&e.status!==SY&&e.status!==_Y&&e.status!==EY&&e.status!==OC&&e.status!==qI?1:0},ROe=t=>{if(nM(t))return PC(t,hv);t.total_in=t.total_out=0,t.data_type=kGt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?mne:e.wrap?e4:OC,t.adler=e.wrap===2?0:1,e.last_flush=-2,EGt(e),gf},OOe=t=>{const e=ROe(t);return e===gf&&JGt(t.state),e},ejt=(t,e)=>nM(t)||t.state.wrap!==2?hv:(t.state.gzhead=e,gf),POe=(t,e,n,r,i,a)=>{if(!t)return hv;let o=1;if(e===RGt&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>UGt||n!==JU||r<8||r>15||e<0||e>9||a<0||a>NGt||r===8&&o!==1)return PC(t,hv);r===8&&(r=9);const s=new QGt;return t.state=s,s.strm=t,s.status=e4,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+Ds-1)/Ds),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,OOe(t)},tjt=(t,e)=>POe(t,e,JU,FGt,BGt,DGt),njt=(t,e)=>{if(nM(t)||e>Sye||e<0)return t?PC(t,hv):hv;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===qI&&e!==P0)return PC(t,t.avail_out===0?HG:hv);const r=n.last_flush;if(n.last_flush=e,n.pending!==0){if(bp(t),t.avail_out===0)return n.last_flush=-1,gf}else if(t.avail_in===0&&Eye(e)<=Eye(r)&&e!==P0)return PC(t,HG);if(n.status===qI&&t.avail_in!==0)return PC(t,HG);if(n.status===e4&&n.wrap===0&&(n.status=OC),n.status===e4){let i=JU+(n.w_bits-8<<4)<<8,a=-1;if(n.strategy>=fR||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,i|=a<<6,n.strstart!==0&&(i|=WGt),i+=31-i%31,tI(n,i),n.strstart!==0&&(tI(n,t.adler>>>16),tI(n,t.adler&65535)),t.adler=1,n.status=OC,bp(t),n.pending!==0)return n.last_flush=-1,gf}if(n.status===mne){if(t.adler=0,ll(n,31),ll(n,139),ll(n,8),n.gzhead)ll(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)),ll(n,n.gzhead.time&255),ll(n,n.gzhead.time>>8&255),ll(n,n.gzhead.time>>16&255),ll(n,n.gzhead.time>>24&255),ll(n,n.level===9?2:n.strategy>=fR||n.level<2?4:0),ll(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ll(n,n.gzhead.extra.length&255),ll(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Nd(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=wY;else if(ll(n,0),ll(n,0),ll(n,0),ll(n,0),ll(n,0),ll(n,n.level===9?2:n.strategy>=fR||n.level<2?4:0),ll(n,XGt),n.status=OC,bp(t),n.pending!==0)return n.last_flush=-1,gf}if(n.status===wY){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=Nd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,bp(t),n.pending!==0)return n.last_flush=-1,gf;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=Nd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=SY}if(n.status===SY){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=Nd(t.adler,n.pending_buf,n.pending-i,i)),bp(t),n.pending!==0)return n.last_flush=-1,gf;i=0}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,ll(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Nd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=_Y}if(n.status===_Y){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=Nd(t.adler,n.pending_buf,n.pending-i,i)),bp(t),n.pending!==0)return n.last_flush=-1,gf;i=0}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,ll(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Nd(t.adler,n.pending_buf,n.pending-i,i))}n.status=EY}if(n.status===EY){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(bp(t),n.pending!==0))return n.last_flush=-1,gf;ll(n,t.adler&255),ll(n,t.adler>>8&255),t.adler=0}if(n.status=OC,bp(t),n.pending!==0)return n.last_flush=-1,gf}if(t.avail_in!==0||n.lookahead!==0||e!==V2&&n.status!==qI){let i=n.level===0?LOe(n,e):n.strategy===fR?qGt(n,e):n.strategy===PGt?YGt(n,e):JI[n.level].func(n,e);if((i===C3||i===e5)&&(n.status=qI),i===yh||i===C3)return t.avail_out===0&&(n.last_flush=-1),gf;if(i===Q4&&(e===AGt?IGt(n):e!==Sye&&(xY(n,0,0,!1),e===MGt&&(o2(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),bp(t),t.avail_out===0))return n.last_flush=-1,gf}return e!==P0?gf:n.wrap<=0?_ye:(n.wrap===2?(ll(n,t.adler&255),ll(n,t.adler>>8&255),ll(n,t.adler>>16&255),ll(n,t.adler>>24&255),ll(n,t.total_in&255),ll(n,t.total_in>>8&255),ll(n,t.total_in>>16&255),ll(n,t.total_in>>24&255)):(tI(n,t.adler>>>16),tI(n,t.adler&65535)),bp(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?gf:_ye)},rjt=t=>{if(nM(t))return hv;const e=t.state.status;return t.state=null,e===OC?PC(t,LGt):gf},ijt=(t,e)=>{let n=e.length;if(nM(t))return hv;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==e4||r.lookahead)return hv;if(i===1&&(t.adler=Z8(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){i===0&&(o2(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,t4(r);r.lookahead>=Ds;){let l=r.strstart,u=r.lookahead-(Ds-1);do r.ins_h=$2(r,r.ins_h,r.window[l+Ds-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=Ds-1,t4(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Ds-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,r.wrap=i,gf};var ajt=tjt,ojt=POe,sjt=OOe,ljt=ROe,cjt=ejt,ujt=njt,djt=rjt,fjt=ijt,hjt="pako deflate (from Nodeca project)",N6={deflateInit:ajt,deflateInit2:ojt,deflateReset:sjt,deflateResetKeep:ljt,deflateSetHeader:cjt,deflate:ujt,deflateEnd:djt,deflateSetDictionary:fjt,deflateInfo:hjt};const pjt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var gjt=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)pjt(n,r)&&(t[r]=n[r])}}return t},mjt=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},QU={assign:gjt,flattenChunks:mjt};let NOe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{NOe=!1}const K8=new Uint8Array(256);for(let t=0;t<256;t++)K8[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;K8[254]=K8[254]=1;var vjt=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 yjt=(t,e)=>{if(e<65534&&t.subarray&&NOe)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 bjt=(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=K8[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 yjt(a,i)},xjt=(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+K8[t[n]]>e?n:e},Y8={string2buf:vjt,buf2string:bjt,utf8border:xjt};function Cjt(){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 DOe=Cjt;const kOe=Object.prototype.toString,{Z_NO_FLUSH:wjt,Z_SYNC_FLUSH:Sjt,Z_FULL_FLUSH:_jt,Z_FINISH:Ejt,Z_OK:tD,Z_STREAM_END:Tjt,Z_DEFAULT_COMPRESSION:Ijt,Z_DEFAULT_STRATEGY:Ajt,Z_DEFLATED:Mjt}=tM;function vne(t){this.options=QU.assign({level:Ijt,method:Mjt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ajt},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 DOe,this.strm.avail_out=0;let n=N6.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==tD)throw new Error(QE[n]);if(e.header&&N6.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Y8.string2buf(e.dictionary):kOe.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=N6.deflateSetDictionary(this.strm,r),n!==tD)throw new Error(QE[n]);this._dict_set=!0}}vne.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?Ejt:wjt,typeof t=="string"?n.input=Y8.string2buf(t):kOe.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===Sjt||a===_jt)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=N6.deflate(n,a),i===Tjt)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=N6.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===tD;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};vne.prototype.onData=function(t){this.chunks.push(t)};vne.prototype.onEnd=function(t){t===tD&&(this.result=QU.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const hR=16209,Ljt=16191;var Rjt=function(e,n){let r,i,a,o,s,l,u,d,f,h,p,g,y,v,m,C,x,w,S,_,T,R,M,N;const D=e.state;r=e.next_in,M=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,h=D.window,p=D.hold,g=D.bits,y=D.lencode,v=D.distcode,m=(1<<D.lenbits)-1,C=(1<<D.distbits)-1;e:do{g<15&&(p+=M[r++]<<g,g+=8,p+=M[r++]<<g,g+=8),x=y[p&m];t:for(;;){if(w=x>>>24,p>>>=w,g-=w,w=x>>>16&255,w===0)N[a++]=x&65535;else if(w&16){S=x&65535,w&=15,w&&(g<w&&(p+=M[r++]<<g,g+=8),S+=p&(1<<w)-1,p>>>=w,g-=w),g<15&&(p+=M[r++]<<g,g+=8,p+=M[r++]<<g,g+=8),x=v[p&C];n:for(;;){if(w=x>>>24,p>>>=w,g-=w,w=x>>>16&255,w&16){if(_=x&65535,w&=15,g<w&&(p+=M[r++]<<g,g+=8,g<w&&(p+=M[r++]<<g,g+=8)),_+=p&(1<<w)-1,_>l){e.msg="invalid distance too far back",D.mode=hR;break e}if(p>>>=w,g-=w,w=a-o,_>w){if(w=_-w,w>d&&D.sane){e.msg="invalid distance too far back",D.mode=hR;break e}if(T=0,R=h,f===0){if(T+=u-w,w<S){S-=w;do N[a++]=h[T++];while(--w);T=a-_,R=N}}else if(f<w){if(T+=u+f-w,w-=f,w<S){S-=w;do N[a++]=h[T++];while(--w);if(T=0,f<S){w=f,S-=w;do N[a++]=h[T++];while(--w);T=a-_,R=N}}}else if(T+=f-w,w<S){S-=w;do N[a++]=h[T++];while(--w);T=a-_,R=N}for(;S>2;)N[a++]=R[T++],N[a++]=R[T++],N[a++]=R[T++],S-=3;S&&(N[a++]=R[T++],S>1&&(N[a++]=R[T++]))}else{T=a-_;do N[a++]=N[T++],N[a++]=N[T++],N[a++]=N[T++],S-=3;while(S>2);S&&(N[a++]=N[T++],S>1&&(N[a++]=N[T++]))}}else if(w&64){e.msg="invalid distance code",D.mode=hR;break e}else{x=v[(x&65535)+(p&(1<<w)-1)];continue n}break}}else if(w&64)if(w&32){D.mode=Ljt;break e}else{e.msg="invalid literal/length code",D.mode=hR;break e}else{x=y[(x&65535)+(p&(1<<w)-1)];continue t}break}}while(r<i&&a<s);S=g>>3,r-=S,g-=S<<3,p&=(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=p,D.bits=g};const NS=15,Tye=852,Iye=592,Aye=0,jG=1,Mye=2,Ojt=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]),Pjt=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]),Njt=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]),Djt=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]),kjt=(t,e,n,r,i,a,o,s)=>{const l=s.bits;let u=0,d=0,f=0,h=0,p=0,g=0,y=0,v=0,m=0,C=0,x,w,S,_,T,R=null,M;const N=new Uint16Array(NS+1),D=new Uint16Array(NS+1);let F=null,B,U,z;for(u=0;u<=NS;u++)N[u]=0;for(d=0;d<r;d++)N[e[n+d]]++;for(p=l,h=NS;h>=1&&N[h]===0;h--);if(p>h&&(p=h),h===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<h&&N[f]===0;f++);for(p<f&&(p=f),v=1,u=1;u<=NS;u++)if(v<<=1,v-=N[u],v<0)return-1;if(v>0&&(t===Aye||h!==1))return-1;for(D[1]=0,u=1;u<NS;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===Aye?(R=F=o,M=20):t===jG?(R=Ojt,F=Pjt,M=257):(R=Njt,F=Djt,M=0),C=0,d=0,u=f,T=a,g=p,y=0,S=-1,m=1<<p,_=m-1,t===jG&&m>Tye||t===Mye&&m>Iye)return 1;for(;;){B=u-y,o[d]+1<M?(U=0,z=o[d]):o[d]>=M?(U=F[o[d]-M],z=R[o[d]-M]):(U=32+64,z=0),x=1<<u-y,w=1<<g,f=w;do w-=x,i[T+(C>>y)+w]=B<<24|U<<16|z|0;while(w!==0);for(x=1<<u-1;C&x;)x>>=1;if(x!==0?(C&=x-1,C+=x):C=0,d++,--N[u]===0){if(u===h)break;u=e[n+o[d]]}if(u>p&&(C&_)!==S){for(y===0&&(y=p),T+=f,g=u-y,v=1<<g;g+y<h&&(v-=N[g+y],!(v<=0));)g++,v<<=1;if(m+=1<<g,t===jG&&m>Tye||t===Mye&&m>Iye)return 1;S=C&_,i[S]=p<<24|g<<16|T-a|0}}return C!==0&&(i[T+C]=u-y<<24|64<<16|0),s.bits=p,0};var D6=kjt;const Ujt=0,UOe=1,FOe=2,{Z_FINISH:Lye,Z_BLOCK:Fjt,Z_TREES:pR,Z_OK:w3,Z_STREAM_END:Bjt,Z_NEED_DICT:Vjt,Z_STREAM_ERROR:X0,Z_DATA_ERROR:BOe,Z_MEM_ERROR:VOe,Z_BUF_ERROR:$jt,Z_DEFLATED:Rye}=tM,eF=16180,Oye=16181,Pye=16182,Nye=16183,Dye=16184,kye=16185,Uye=16186,Fye=16187,Bye=16188,Vye=16189,nD=16190,e1=16191,WG=16192,$ye=16193,XG=16194,zye=16195,Hye=16196,Gye=16197,jye=16198,gR=16199,mR=16200,Wye=16201,Xye=16202,Zye=16203,Kye=16204,Yye=16205,ZG=16206,qye=16207,Jye=16208,Ic=16209,$Oe=16210,zOe=16211,zjt=852,Hjt=592,Gjt=15,jjt=Gjt,Qye=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Wjt(){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 q3=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<eF||e.mode>zOe?1:0},HOe=t=>{if(q3(t))return X0;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=eF,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(zjt),e.distcode=e.distdyn=new Int32Array(Hjt),e.sane=1,e.back=-1,w3},GOe=t=>{if(q3(t))return X0;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,HOe(t)},jOe=(t,e)=>{let n;if(q3(t))return X0;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?X0:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,GOe(t))},WOe=(t,e)=>{if(!t)return X0;const n=new Wjt;t.state=n,n.strm=t,n.window=null,n.mode=eF;const r=jOe(t,e);return r!==w3&&(t.state=null),r},Xjt=t=>WOe(t,jjt);let e2e=!0,KG,YG;const Zjt=t=>{if(e2e){KG=new Int32Array(512),YG=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(D6(UOe,t.lens,0,288,KG,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;D6(FOe,t.lens,0,32,YG,0,t.work,{bits:5}),e2e=!1}t.lencode=KG,t.lenbits=9,t.distcode=YG,t.distbits=5},XOe=(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},Kjt=(t,e)=>{let n,r,i,a,o,s,l,u,d,f,h,p,g,y,v=0,m,C,x,w,S,_,T,R;const M=new Uint8Array(4);let N,D;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(q3(t)||!t.output||!t.input&&t.avail_in!==0)return X0;n=t.state,n.mode===e1&&(n.mode=WG),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,h=l,R=w3;e:for(;;)switch(n.mode){case eF:if(n.wrap===0){n.mode=WG;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,M[0]=u&255,M[1]=u>>>8&255,n.check=Nd(n.check,M,2,0),u=0,d=0,n.mode=Oye;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=Ic;break}if((u&15)!==Rye){t.msg="unknown compression method",n.mode=Ic;break}if(u>>>=4,d-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){t.msg="invalid window size",n.mode=Ic;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=u&512?Vye:e1,u=0,d=0;break;case Oye:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.flags=u,(n.flags&255)!==Rye){t.msg="unknown compression method",n.mode=Ic;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=Ic;break}n.head&&(n.head.text=u>>8&1),n.flags&512&&n.wrap&4&&(M[0]=u&255,M[1]=u>>>8&255,n.check=Nd(n.check,M,2,0)),u=0,d=0,n.mode=Pye;case Pye: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&&(M[0]=u&255,M[1]=u>>>8&255,M[2]=u>>>16&255,M[3]=u>>>24&255,n.check=Nd(n.check,M,4,0)),u=0,d=0,n.mode=Nye;case Nye: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&&(M[0]=u&255,M[1]=u>>>8&255,n.check=Nd(n.check,M,2,0)),u=0,d=0,n.mode=Dye;case Dye: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&&(M[0]=u&255,M[1]=u>>>8&255,n.check=Nd(n.check,M,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=kye;case kye:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),T)),n.flags&512&&n.wrap&4&&(n.check=Nd(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break e;n.length=0,n.mode=Uye;case Uye:if(n.flags&2048){if(s===0)break e;p=0;do T=r[a+p++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=Nd(n.check,r,p,a)),s-=p,a+=p,T)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=Fye;case Fye:if(n.flags&4096){if(s===0)break e;p=0;do T=r[a+p++],n.head&&T&&n.length<65536&&(n.head.comment+=String.fromCharCode(T));while(T&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=Nd(n.check,r,p,a)),s-=p,a+=p,T)break e}else n.head&&(n.head.comment=null);n.mode=Bye;case Bye: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=Ic;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=e1;break;case Vye:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}t.adler=n.check=Qye(u),u=0,d=0,n.mode=nD;case nD: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,Vjt;t.adler=n.check=1,n.mode=e1;case e1:if(e===Fjt||e===pR)break e;case WG:if(n.last){u>>>=d&7,d-=d&7,n.mode=ZG;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=$ye;break;case 1:if(Zjt(n),n.mode=gR,e===pR){u>>>=2,d-=2;break e}break;case 2:n.mode=Hye;break;case 3:t.msg="invalid block type",n.mode=Ic}u>>>=2,d-=2;break;case $ye: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=Ic;break}if(n.length=u&65535,u=0,d=0,n.mode=XG,e===pR)break e;case XG:n.mode=zye;case zye:if(p=n.length,p){if(p>s&&(p=s),p>l&&(p=l),p===0)break e;i.set(r.subarray(a,a+p),o),s-=p,a+=p,l-=p,o+=p,n.length-=p;break}n.mode=e1;break;case Hye: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=Ic;break}n.have=0,n.mode=Gye;case Gye:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.lens[F[n.have++]]=u&7,u>>>=3,d-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},R=D6(Ujt,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,R){t.msg="invalid code lengths set",n.mode=Ic;break}n.have=0,n.mode=jye;case jye:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[u&(1<<n.lenbits)-1],m=v>>>24,C=v>>>16&255,x=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(x<16)u>>>=m,d-=m,n.lens[n.have++]=x;else{if(x===16){for(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=Ic;break}T=n.lens[n.have-1],p=3+(u&3),u>>>=2,d-=2}else if(x===17){for(D=m+3;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,T=0,p=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,T=0,p=11+(u&127),u>>>=7,d-=7}if(n.have+p>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Ic;break}for(;p--;)n.lens[n.have++]=T}}if(n.mode===Ic)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Ic;break}if(n.lenbits=9,N={bits:n.lenbits},R=D6(UOe,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,R){t.msg="invalid literal/lengths set",n.mode=Ic;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},R=D6(FOe,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,R){t.msg="invalid distances set",n.mode=Ic;break}if(n.mode=gR,e===pR)break e;case gR:n.mode=mR;case mR: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,Rjt(t,h),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===e1&&(n.back=-1);break}for(n.back=0;v=n.lencode[u&(1<<n.lenbits)-1],m=v>>>24,C=v>>>16&255,x=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(C&&!(C&240)){for(w=m,S=C,_=x;v=n.lencode[_+((u&(1<<w+S)-1)>>w)],m=v>>>24,C=v>>>16&255,x=v&65535,!(w+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=w,d-=w,n.back+=w}if(u>>>=m,d-=m,n.back+=m,n.length=x,C===0){n.mode=Yye;break}if(C&32){n.back=-1,n.mode=e1;break}if(C&64){t.msg="invalid literal/length code",n.mode=Ic;break}n.extra=C&15,n.mode=Wye;case Wye: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=Xye;case Xye:for(;v=n.distcode[u&(1<<n.distbits)-1],m=v>>>24,C=v>>>16&255,x=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(!(C&240)){for(w=m,S=C,_=x;v=n.distcode[_+((u&(1<<w+S)-1)>>w)],m=v>>>24,C=v>>>16&255,x=v&65535,!(w+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=w,d-=w,n.back+=w}if(u>>>=m,d-=m,n.back+=m,C&64){t.msg="invalid distance code",n.mode=Ic;break}n.offset=x,n.extra=C&15,n.mode=Zye;case Zye: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=Ic;break}n.mode=Kye;case Kye:if(l===0)break e;if(p=h-l,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Ic;break}p>n.wnext?(p-=n.wnext,g=n.wsize-p):g=n.wnext-p,p>n.length&&(p=n.length),y=n.window}else y=i,g=o-n.offset,p=n.length;p>l&&(p=l),l-=p,n.length-=p;do i[o++]=y[g++];while(--p);n.length===0&&(n.mode=mR);break;case Yye:if(l===0)break e;i[o++]=n.length,l--,n.mode=mR;break;case ZG:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[a++]<<d,d+=8}if(h-=l,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?Nd(n.check,i,h,o-h):Z8(n.check,i,h,o-h)),h=l,n.wrap&4&&(n.flags?u:Qye(u))!==n.check){t.msg="incorrect data check",n.mode=Ic;break}u=0,d=0}n.mode=qye;case qye: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=Ic;break}u=0,d=0}n.mode=Jye;case Jye:R=Bjt;break e;case Ic:R=BOe;break e;case $Oe:return VOe;case zOe:default:return X0}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||h!==t.avail_out&&n.mode<Ic&&(n.mode<ZG||e!==Lye))&&XOe(t,t.output,t.next_out,h-t.avail_out),f-=t.avail_in,h-=t.avail_out,t.total_in+=f,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?Nd(n.check,i,h,t.next_out-h):Z8(n.check,i,h,t.next_out-h)),t.data_type=n.bits+(n.last?64:0)+(n.mode===e1?128:0)+(n.mode===gR||n.mode===XG?256:0),(f===0&&h===0||e===Lye)&&R===w3&&(R=$jt),R},Yjt=t=>{if(q3(t))return X0;let e=t.state;return e.window&&(e.window=null),t.state=null,w3},qjt=(t,e)=>{if(q3(t))return X0;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,w3):X0},Jjt=(t,e)=>{const n=e.length;let r,i,a;return q3(t)||(r=t.state,r.wrap!==0&&r.mode!==nD)?X0:r.mode===nD&&(i=1,i=Z8(i,e,n,0),i!==r.check)?BOe:(a=XOe(t,e,n,n),a?(r.mode=$Oe,VOe):(r.havedict=1,w3))};var Qjt=GOe,eWt=jOe,tWt=HOe,nWt=Xjt,rWt=WOe,iWt=Kjt,aWt=Yjt,oWt=qjt,sWt=Jjt,lWt="pako inflate (from Nodeca project)",g1={inflateReset:Qjt,inflateReset2:eWt,inflateResetKeep:tWt,inflateInit:nWt,inflateInit2:rWt,inflate:iWt,inflateEnd:aWt,inflateGetHeader:oWt,inflateSetDictionary:sWt,inflateInfo:lWt};function cWt(){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 uWt=cWt;const ZOe=Object.prototype.toString,{Z_NO_FLUSH:dWt,Z_FINISH:fWt,Z_OK:q8,Z_STREAM_END:qG,Z_NEED_DICT:JG,Z_STREAM_ERROR:hWt,Z_DATA_ERROR:t2e,Z_MEM_ERROR:pWt}=tM;function rM(t){this.options=QU.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 DOe,this.strm.avail_out=0;let n=g1.inflateInit2(this.strm,e.windowBits);if(n!==q8)throw new Error(QE[n]);if(this.header=new uWt,g1.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Y8.string2buf(e.dictionary):ZOe.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=g1.inflateSetDictionary(this.strm,e.dictionary),n!==q8)))throw new Error(QE[n])}rM.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?fWt:dWt,ZOe.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=g1.inflate(n,o),a===JG&&i&&(a=g1.inflateSetDictionary(n,i),a===q8?a=g1.inflate(n,o):a===t2e&&(a=JG));n.avail_in>0&&a===qG&&n.state.wrap>0&&t[n.next_in]!==0;)g1.inflateReset(n),a=g1.inflate(n,o);switch(a){case hWt:case t2e:case JG:case pWt:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===qG))if(this.options.to==="string"){let l=Y8.utf8border(n.output,n.next_out),u=n.next_out-l,d=Y8.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===q8&&s===0)){if(a===qG)return a=g1.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};rM.prototype.onData=function(t){this.chunks.push(t)};rM.prototype.onEnd=function(t){t===q8&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=QU.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function yne(t,e){const n=new rM(e);if(n.push(t),n.err)throw n.msg||QE[n.err];return n.result}function gWt(t,e){return e=e||{},e.raw=!0,yne(t,e)}var mWt=rM,vWt=yne,yWt=gWt,bWt=yne,xWt=tM,CWt={Inflate:mWt,inflate:vWt,inflateRaw:yWt,ungzip:bWt,constants:xWt};const{Inflate:Xin,inflate:wWt,inflateRaw:Zin,ungzip:Kin}=CWt;var KOe=wWt;function SWt(t){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=KOe(e);return new DataView(n.buffer,n.byteOffset,n.byteLength)}const _Wt={ignoreImageData:!1};class J8 extends qU{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 s1("ifdCount",e)}get pageCount(){let e=0;for(this.decodeHeader();this._nextIFD;)e++,this.decodeIFD({ignoreImageData:!0},!0);if(e>0)return e;throw s1("ifdCount",e)}decode(e={}){const{pages:n}=e;EWt(n);const r=n?Math.max(...n):1/0;e={..._Wt,...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 gye;else{if(!e.kind)throw new Error("kind is missing");r=new fOe(e.kind)}const i=this.readUint16();for(let a=0;a<i;a++)this.decodeIFDEntry(r);if(!e.ignoreImageData){if(!(r instanceof gye))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}RHt(i,a)>4&&this.seek(this.readUint32());const s=OHt(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 s1("orientation",n);switch(e.type){case 0:case 1:case 2:case 3:e.tiled?this.readTileData(e):this.readStripData(e);break;default:throw s1("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]}}static uncompress(e,n=1){switch(n){case 1:return e;case 5:return ZHt(e);case 8:case 32946:return SWt(e);case 2:throw s1("Compression","CCITT Group 3");case 32773:throw s1("Compression","PackBits");default:throw s1("Compression",n)}}readStripData(e){const n=e.width,r=e.height,i=n*r*e.samplesPerPixel,a=e.stripOffsets,o=e.stripByteCounts||AHt(e),s=this.isLittleEndian(),l=n*e.rowsPerStrip*e.samplesPerPixel,u=n2e(i,e.bitsPerSample,e.sampleFormat);let d=0;for(let f=0;f<a.length;f++){const h=new DataView(this.buffer,this.byteOffset+a[f],o[f]),p=J8.uncompress(h,e.compression),g=Math.min(l,i-d);for(let y=0;y<g;++y){const v=this.sampleValue(p,y,e.sampleFormat,e.bitsPerSample,s);u[d+y]=v}d+=g}e.data=u}readTileData(e){if(!e.tileWidth||!e.tileHeight)return;const n=e.width,r=e.height,i=n*r*e.samplesPerPixel,a=e.tileWidth,o=e.tileHeight,s=Math.floor((n+a-1)/a),l=Math.floor((r+o-1)/o),u=e.tileOffsets,d=e.tileByteCounts,f=this.isLittleEndian(),h=n2e(i,e.bitsPerSample,e.sampleFormat);for(let p=0;p<s;++p)for(let g=0;g<l;++g){const y=g*s+p,v=new DataView(this.buffer,u[y],d[y]),m=J8.uncompress(v,e.compression);for(let C=0;C<a;++C)for(let x=0;x<o;++x){const w=p*a+C,S=g*o+x;if(w>=n||S>=r)continue;const _=x*a+C,T=this.sampleValue(m,_,e.sampleFormat,e.bitsPerSample,f),R=S*n+w;h[R]=T}}e.data=h}sampleValue(e,n,r,i,a){if(i===8)return e.getUint8(n);if(i===16)return e.getUint16(2*n,a);if(i===32&&r===3)return e.getFloat32(4*n,a);if(i===64&&r===3)return e.getFloat64(8*n,a);throw s1("bitDepth",i)}applyPredictor(e){const n=e.bitsPerSample;switch(e.predictor){case 1:break;case 2:{if(n===8)MHt(e.data,e.width,e.components);else if(n===16)LHt(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 n2e(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);if(e===64&&n===3)return new Float64Array(t);throw s1("bit depth / sample format",`${e} / ${n}`)}function s1(t,e){return new Error(`Unsupported ${t}: ${e}`)}function EWt(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 QG(t,e){return new J8(t).decode(e)}function r2e(t){return new J8(t).pageCount}function Ef(t){return(e,...n)=>TWt(t,e,n)}function t5(t,e){return Ef(YOe(t,e).get)}const{apply:TWt,construct:Yin,defineProperty:qin,get:Jin,getOwnPropertyDescriptor:YOe,getPrototypeOf:bne,has:Qin,ownKeys:IWt,set:ean,setPrototypeOf:tan}=Reflect,{iterator:iM,species:nan,toStringTag:AWt,for:ran}=Symbol,MWt=Object,{create:xne,defineProperty:LWt,freeze:ian,is:aan}=MWt,RWt=Array,OWt=RWt.prototype,qOe=OWt[iM],PWt=Ef(qOe),JOe=ArrayBuffer,NWt=JOe.prototype;t5(NWt,"byteLength");const i2e=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;i2e&&t5(i2e.prototype,"byteLength");const QOe=bne(Uint8Array);QOe.from;const Mh=QOe.prototype;Mh[iM];Ef(Mh.keys);Ef(Mh.values);Ef(Mh.entries);Ef(Mh.set);Ef(Mh.reverse);Ef(Mh.fill);Ef(Mh.copyWithin);Ef(Mh.sort);Ef(Mh.slice);Ef(Mh.subarray);t5(Mh,"buffer");t5(Mh,"byteOffset");t5(Mh,"length");t5(Mh,AWt);const DWt=Uint8Array,ePe=Uint16Array,Cne=Uint32Array,kWt=Float32Array,Q8=bne([][iM]()),tPe=Ef(Q8.next),UWt=Ef(function*(){}().next),FWt=bne(Q8),BWt=DataView.prototype,VWt=Ef(BWt.getUint16),wne=WeakMap,nPe=wne.prototype,rPe=Ef(nPe.get),$Wt=Ef(nPe.set),iPe=new wne,zWt=xne(null,{next:{value:function(){const e=rPe(iPe,this);return tPe(e)}},[iM]:{value:function(){return this}}});function HWt(t){if(t[iM]===qOe&&Q8.next===tPe)return t;const e=xne(zWt);return $Wt(iPe,e,PWt(t)),e}const GWt=new wne,jWt=xne(FWt,{next:{value:function(){const e=rPe(GWt,this);return UWt(e)},writable:!0,configurable:!0}});for(const t of IWt(Q8))t!=="next"&&LWt(jWt,t,YOe(Q8,t));const aPe=new JOe(4),WWt=new kWt(aPe),XWt=new Cne(aPe),Rm=new ePe(512),Om=new DWt(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(Rm[t]=0,Rm[t|256]=32768,Om[t]=24,Om[t|256]=24):e<-14?(Rm[t]=1024>>-e-14,Rm[t|256]=1024>>-e-14|32768,Om[t]=-e-1,Om[t|256]=-e-1):e<=15?(Rm[t]=e+15<<10,Rm[t|256]=e+15<<10|32768,Om[t]=13,Om[t|256]=13):e<128?(Rm[t]=31744,Rm[t|256]=64512,Om[t]=24,Om[t|256]=24):(Rm[t]=31744,Rm[t|256]=64512,Om[t]=13,Om[t|256]=13)}const Sne=new Cne(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,Sne[t]=e|n}for(let t=1024;t<2048;++t)Sne[t]=939524096+(t-1024<<13);const n5=new Cne(64);for(let t=1;t<31;++t)n5[t]=t<<23;n5[31]=1199570944;n5[32]=2147483648;for(let t=33;t<63;++t)n5[t]=2147483648+(t-32<<23);n5[63]=3347054592;const oPe=new ePe(64);for(let t=1;t<64;++t)t!==32&&(oPe[t]=1024);function ZWt(t){const e=t>>10;return XWt[0]=Sne[oPe[e]+(t&1023)]+n5[e],WWt[0]}function sPe(t,e,...n){return ZWt(VWt(t,e,...HWt(n)))}var cE={},KWt={get exports(){return cE},set exports(t){cE=t}};function lPe(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]}}KWt.exports=lPe;cE.default=lPe;var rD={},YWt={get exports(){return rD},set exports(t){rD=t}},iD={},qWt={get exports(){return iD},set exports(t){iD=t}},aD={},JWt={get exports(){return aD},set exports(t){aD=t}};function cPe(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index:-1}JWt.exports=cPe;aD.default=cPe;var oD={},QWt={get exports(){return oD},set exports(t){oD=t}};function uPe(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index+i[0].length-1:-1}QWt.exports=uPe;oD.default=uPe;var sD={},eXt={get exports(){return sD},set exports(t){sD=t}};function dPe(t,e){const n=new RegExp(e,"g"),r=t.match(n);return r?r.length:0}eXt.exports=dPe;sD.default=dPe;const tXt=aD,ej=oD,a2e=sD;function fPe(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=tXt(t,`<${e}[
4799
4799
  >/]`,a);if(r&&console.log("[xml-utils] start:",o),o===-1)return;const s=t.slice(o+e.length);let l=ej(s,"^[^<]*[ /]>",0);const u=l!==-1&&s[l-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",u),u===!1)if(i){let p=0,g=1,y=0;for(;(l=ej(s,"[ /]"+e+">",p))!==-1;){const v=s.substring(p,l+1);if(g+=a2e(v,"<"+e+`[
4800
- >]`),y+=a2e(v,"</"+e+">"),y>=g)break;p=l}}else l=ej(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 h;return u?h=null:h=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:h,outer:f,start:o,end:d}}qWt.exports=fPe;iD.default=fPe;const nXt=iD;function hPe(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=nXt(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}YWt.exports=hPe;rD.default=hPe;const k6={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"},Bm={};for(const t in k6)k6.hasOwnProperty(t)&&(Bm[k6[t]]=parseInt(t,10));const rXt=[Bm.BitsPerSample,Bm.ExtraSamples,Bm.SampleFormat,Bm.StripByteCounts,Bm.StripOffsets,Bm.StripRowCounts,Bm.TileByteCounts,Bm.TileOffsets,Bm.SubIFDs],tj={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"},zo={};for(const t in tj)tj.hasOwnProperty(t)&&(zo[tj[t]]=parseInt(t,10));const vp={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},iXt={Unspecified:0,Assocalpha:1,Unassalpha:2},aXt={Version:0,AddCompression:1},oXt={None:0,Deflate:1,Zstandard:2},sXt={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 lXt(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 cXt(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 uXt(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 dXt(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 fXt(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 hXt=.95047,pXt=1,gXt=1.08883;function mXt(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,h,p,g;d=hXt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=pXt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=gXt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,g=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,g))*255}return r}const pPe=new Map;function xb(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>pPe.set(n,e))}async function vXt(t){const e=pPe.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}xb([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));xb(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));xb(6,()=>{throw new Error("old style JPEG compression is not supported.")});xb(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));xb([8,32946],()=>Promise.resolve().then(()=>require("./deflate-60fec9f3.js")).then(t=>t.default));xb(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));xb(34887,()=>Promise.resolve().then(()=>require("./lerc-ee296c33.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));xb(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function tF(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function yXt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=tF(s,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(o*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=s[d*e+h];l[u*r+f]=p}}return l})}function uE(t,e,n){return(1-n)*t+n*e}function bXt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=tF(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const g=a*p,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1),C=s[f*e+v],x=s[f*e+m],w=s[h*e+v],S=s[h*e+m],_=uE(uE(C,x,y),uE(w,S,y),d%1);l[u*r+p]=_}}return l})}function xXt(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return yXt(t,e,n,r,i);case"bilinear":case"linear":return bXt(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function CXt(t,e,n,r,i,a){const o=e/r,s=n/i,l=tF(t,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(o*f),e-1);for(let p=0;p<a;++p){const g=t[d*e*a+h*a+p];l[u*r*a+f*a+p]=g}}}return l}function wXt(t,e,n,r,i,a){const o=e/r,s=n/i,l=tF(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const g=o*p,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1);for(let C=0;C<a;++C){const x=t[f*e*a+v*a+C],w=t[f*e*a+m*a+C],S=t[h*e*a+v*a+C],_=t[h*e*a+m*a+C],T=uE(uE(x,w,y),uE(S,_,y),d%1);l[u*r*a+p*a+C]=T}}}return l}function SXt(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return CXt(t,e,n,r,i,a);case"bilinear":case"linear":return wXt(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function _Xt(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function IY(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 EXt(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function TXt(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=IY(e,i,l),f=parseInt("1".repeat(i),2);if(e===1){let h;n===1?h=r*i:h=i;let p=a*h;p&7&&(p=p+7&-8);for(let g=0;g<o;++g){const y=g*p;for(let v=0;v<a;++v){const m=y+v*u*i;for(let C=0;C<u;++C){const x=m+C*i,w=(g*a+v)*u+C,S=Math.floor(x/8),_=x%8;if(_+i<=8)d[w]=s.getUint8(S)>>8-i-_&f;else if(_+i<=16)d[w]=s.getUint16(S)>>16-i-_&f;else if(_+i<=24){const T=s.getUint16(S)<<8|s.getUint8(S+2);d[w]=T>>24-i-_&f}else d[w]=s.getUint32(S)>>32-i-_&f}}}}return d.buffer}class IXt{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 sPe(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 IY(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 h=(await this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[l]?(p=(async()=>{let g=await i.decode(this.fileDirectory,h);const y=this.getSampleFormat(),v=this.getBitsPerSample();return EXt(y,v)&&(g=TXt(g,y,this.planarConfiguration,this.getSamplesPerPixel(),v,this.getTileWidth(),this.getBlockHeight(n))),g})(),u!==null&&(u[l]=p)):p=u[l],{x:e,y:n,sample:r,data:await p}}async _readRaster(e,n,r,i,a,o,s,l,u){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),g=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),v=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),C=e[2]-e[0];let x=this.getBytesPerPixel();const w=[],S=[];for(let R=0;R<n.length;++R)this.planarConfiguration===1?w.push(_Xt(this.fileDirectory.BitsPerSample,0,n[R])/8):w.push(0),S.push(this.getReaderForSample(n[R]));const _=[],{littleEndian:T}=this;for(let R=v;R<m;++R)for(let M=g;M<y;++M){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(M,R,0,a,u));for(let D=0;D<n.length;++D){const F=D,B=n[D];this.planarConfiguration===2&&(x=this.getSampleByteSize(B),N=this.getTileOrStrip(M,R,B,a,u));const U=N.then(z=>{const H=z.data,j=new DataView(H),K=this.getBlockHeight(z.y),te=z.y*f,Q=z.x*d,Z=te+K,J=(z.x+1)*d,re=S[F],G=Math.min(K,K-(Z-e[3]),p-te),W=Math.min(d,d-(J-e[2]),h-Q);for(let ee=Math.max(0,e[1]-te);ee<G;++ee)for(let X=Math.max(0,e[0]-Q);X<W;++X){const Y=(ee*d+X)*x,ie=re.call(j,Y+w[F],T);let se;i?(se=(ee+te-e[1])*C*n.length+(X+Q-e[0])*n.length+F,r[se]=ie):(se=(ee+te-e[1])*C+X+Q-e[0],r[F][se]=ie)}});_.push(U)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let R;return i?R=SXt(r,e[2]-e[0],e[3]-e[1],o,s,n.length,l):R=xXt(r,e[2]-e[0],e[3]-e[1],o,s,l),R.width=o,R.height=s,R}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],h=d[3]-d[1],p=f*h,g=this.getSamplesPerPixel();if(!n||!n.length)for(let C=0;C<g;++C)n.push(C);else for(let C=0;C<n.length;++C)if(n[C]>=g)return Promise.reject(new RangeError(`Invalid sample index '${n[C]}'.`));let y;if(r){const C=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=IY(C,x,p*n.length),l&&y.fill(l)}else{y=[];for(let C=0;C<n.length;++C){const x=this.getArrayForSample(n[C],p);Array.isArray(l)&&C<l.length?x.fill(l[C]):l&&!Array.isArray(l)&&x.fill(l),y.push(x)}}const v=i||await vXt(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===vp.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==iXt.Unspecified&&s){m=[];for(let C=0;C<this.fileDirectory.BitsPerSample.length;C+=1)m.push(C)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:l})}let f;switch(d){case vp.WhiteIsZero:case vp.BlackIsZero:case vp.Palette:f=[0];break;case vp.CMYK:f=[0,1,2,3];break;case vp.YCbCr:case vp.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:l},{fileDirectory:p}=this,g=await this.readRasters(h),y=2**this.fileDirectory.BitsPerSample[0];let v;switch(d){case vp.WhiteIsZero:v=lXt(g,y);break;case vp.BlackIsZero:v=cXt(g,y);break;case vp.Palette:v=uXt(g,p.ColorMap);break;case vp.CMYK:v=dXt(g);break;case vp.YCbCr:v=fXt(g);break;case vp.CIELab:v=mXt(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(v.length/3),C=new Uint8Array(v.length/3),x=new Uint8Array(v.length/3);for(let w=0,S=0;w<v.length;w+=3,++S)m[S]=v[w],C[S]=v[w+1],x[S]=v[w+2];v=[m,C,x]}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=rD(r,"Item");e===null?i=i.filter(a=>cE(a,"sample")===void 0):i=i.filter(a=>Number(cE(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[cE(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,p=[[0,0],[0,n],[r,0],[r,n]].map(([v,m])=>[s+i*v+a*m,f+l*v+u*m]),g=p.map(v=>v[0]),y=p.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 AXt=IXt;class MXt{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 sPe(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class LXt{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 RXt{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 _ne extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,_ne),this.name="AbortError"}}class OXt extends RXt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new _ne("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function PXt(t){return new OXt(t)}function AY(t){switch(t){case zo.BYTE:case zo.ASCII:case zo.SBYTE:case zo.UNDEFINED:return 1;case zo.SHORT:case zo.SSHORT:return 2;case zo.LONG:case zo.SLONG:case zo.FLOAT:case zo.IFD:return 4;case zo.RATIONAL:case zo.SRATIONAL:case zo.DOUBLE:case zo.LONG8:case zo.SLONG8:case zo.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function NXt(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=sXt[e[r]],a=e[r+1]?k6[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 DS(t,e,n,r){let i=null,a=null;const o=AY(e);switch(e){case zo.BYTE:case zo.ASCII:case zo.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case zo.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case zo.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case zo.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case zo.LONG:case zo.IFD:i=new Uint32Array(n),a=t.readUint32;break;case zo.SLONG:i=new Int32Array(n),a=t.readInt32;break;case zo.LONG8:case zo.IFD8:i=new Array(n),a=t.readUint64;break;case zo.SLONG8:i=new Array(n),a=t.readInt64;break;case zo.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case zo.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case zo.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case zo.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===zo.RATIONAL||e===zo.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===zo.ASCII?new TextDecoder("utf-8").decode(i):i}class DXt{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class vR extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class kXt{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 p=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(p[3]-p[1])/i}}if(a||o){const p=[];for(let g=0;g<d;++g){const y=await this.getImage(g),{SubfileType:v,NewSubfileType:m}=y.fileDirectory;(g===0||v===2||m&1)&&p.push(y)}p.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<p.length;++g){const y=p[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 h=n;if(s){const[p,g]=l.getOrigin(),[y,v]=u.getResolution(l);h=[Math.round((s[0]-p)/y),Math.round((s[1]-g)/v),Math.round((s[2]-p)/y),Math.round((s[3]-g)/v)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters({...e,window:h})}}class Ene extends kXt{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 LXt((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 h=i.readUint16(l),p=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,v;const m=AY(p),C=l+(this.bigTiff?12:8);if(m*g<=(this.bigTiff?8:4))y=DS(i,p,g,C);else{const x=i.readOffset(C),w=AY(p)*g;if(i.covers(x,w))y=DS(i,p,g,x);else{const S=await this.getSlice(x,w);y=DS(S,p,g,x)}}g===1&&rXt.indexOf(h)===-1&&!(p===zo.RATIONAL||p===zo.SRATIONAL)?v=y[0]:v=y,s[k6[h]]=v}const u=NXt(s),d=i.readOffset(e+r+n*a);return new DXt(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 vR?new vR(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new vR(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new AXt(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 vR)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===DS(i,zo.ASCII,n.length,e)){const o=DS(i,zo.ASCII,r,e).split(`
4800
+ >]`),y+=a2e(v,"</"+e+">"),y>=g)break;p=l}}else l=ej(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 h;return u?h=null:h=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:h,outer:f,start:o,end:d}}qWt.exports=fPe;iD.default=fPe;const nXt=iD;function hPe(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=nXt(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}YWt.exports=hPe;rD.default=hPe;const k6={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"},Bm={};for(const t in k6)k6.hasOwnProperty(t)&&(Bm[k6[t]]=parseInt(t,10));const rXt=[Bm.BitsPerSample,Bm.ExtraSamples,Bm.SampleFormat,Bm.StripByteCounts,Bm.StripOffsets,Bm.StripRowCounts,Bm.TileByteCounts,Bm.TileOffsets,Bm.SubIFDs],tj={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"},zo={};for(const t in tj)tj.hasOwnProperty(t)&&(zo[tj[t]]=parseInt(t,10));const vp={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},iXt={Unspecified:0,Assocalpha:1,Unassalpha:2},aXt={Version:0,AddCompression:1},oXt={None:0,Deflate:1,Zstandard:2},sXt={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 lXt(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 cXt(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 uXt(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 dXt(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 fXt(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 hXt=.95047,pXt=1,gXt=1.08883;function mXt(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,h,p,g;d=hXt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=pXt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=gXt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,g=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,g))*255}return r}const pPe=new Map;function xb(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>pPe.set(n,e))}async function vXt(t){const e=pPe.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}xb([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));xb(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));xb(6,()=>{throw new Error("old style JPEG compression is not supported.")});xb(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));xb([8,32946],()=>Promise.resolve().then(()=>require("./deflate-82b14489.js")).then(t=>t.default));xb(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));xb(34887,()=>Promise.resolve().then(()=>require("./lerc-e9d617c0.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));xb(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function tF(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function yXt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=tF(s,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(o*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=s[d*e+h];l[u*r+f]=p}}return l})}function uE(t,e,n){return(1-n)*t+n*e}function bXt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=tF(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const g=a*p,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1),C=s[f*e+v],x=s[f*e+m],w=s[h*e+v],S=s[h*e+m],_=uE(uE(C,x,y),uE(w,S,y),d%1);l[u*r+p]=_}}return l})}function xXt(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return yXt(t,e,n,r,i);case"bilinear":case"linear":return bXt(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function CXt(t,e,n,r,i,a){const o=e/r,s=n/i,l=tF(t,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(o*f),e-1);for(let p=0;p<a;++p){const g=t[d*e*a+h*a+p];l[u*r*a+f*a+p]=g}}}return l}function wXt(t,e,n,r,i,a){const o=e/r,s=n/i,l=tF(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const g=o*p,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1);for(let C=0;C<a;++C){const x=t[f*e*a+v*a+C],w=t[f*e*a+m*a+C],S=t[h*e*a+v*a+C],_=t[h*e*a+m*a+C],T=uE(uE(x,w,y),uE(S,_,y),d%1);l[u*r*a+p*a+C]=T}}}return l}function SXt(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return CXt(t,e,n,r,i,a);case"bilinear":case"linear":return wXt(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function _Xt(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function IY(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 EXt(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function TXt(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=IY(e,i,l),f=parseInt("1".repeat(i),2);if(e===1){let h;n===1?h=r*i:h=i;let p=a*h;p&7&&(p=p+7&-8);for(let g=0;g<o;++g){const y=g*p;for(let v=0;v<a;++v){const m=y+v*u*i;for(let C=0;C<u;++C){const x=m+C*i,w=(g*a+v)*u+C,S=Math.floor(x/8),_=x%8;if(_+i<=8)d[w]=s.getUint8(S)>>8-i-_&f;else if(_+i<=16)d[w]=s.getUint16(S)>>16-i-_&f;else if(_+i<=24){const T=s.getUint16(S)<<8|s.getUint8(S+2);d[w]=T>>24-i-_&f}else d[w]=s.getUint32(S)>>32-i-_&f}}}}return d.buffer}class IXt{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 sPe(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 IY(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 h=(await this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[l]?(p=(async()=>{let g=await i.decode(this.fileDirectory,h);const y=this.getSampleFormat(),v=this.getBitsPerSample();return EXt(y,v)&&(g=TXt(g,y,this.planarConfiguration,this.getSamplesPerPixel(),v,this.getTileWidth(),this.getBlockHeight(n))),g})(),u!==null&&(u[l]=p)):p=u[l],{x:e,y:n,sample:r,data:await p}}async _readRaster(e,n,r,i,a,o,s,l,u){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),g=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),v=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),C=e[2]-e[0];let x=this.getBytesPerPixel();const w=[],S=[];for(let R=0;R<n.length;++R)this.planarConfiguration===1?w.push(_Xt(this.fileDirectory.BitsPerSample,0,n[R])/8):w.push(0),S.push(this.getReaderForSample(n[R]));const _=[],{littleEndian:T}=this;for(let R=v;R<m;++R)for(let M=g;M<y;++M){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(M,R,0,a,u));for(let D=0;D<n.length;++D){const F=D,B=n[D];this.planarConfiguration===2&&(x=this.getSampleByteSize(B),N=this.getTileOrStrip(M,R,B,a,u));const U=N.then(z=>{const H=z.data,j=new DataView(H),K=this.getBlockHeight(z.y),te=z.y*f,Q=z.x*d,Z=te+K,J=(z.x+1)*d,re=S[F],G=Math.min(K,K-(Z-e[3]),p-te),W=Math.min(d,d-(J-e[2]),h-Q);for(let ee=Math.max(0,e[1]-te);ee<G;++ee)for(let X=Math.max(0,e[0]-Q);X<W;++X){const Y=(ee*d+X)*x,ie=re.call(j,Y+w[F],T);let se;i?(se=(ee+te-e[1])*C*n.length+(X+Q-e[0])*n.length+F,r[se]=ie):(se=(ee+te-e[1])*C+X+Q-e[0],r[F][se]=ie)}});_.push(U)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let R;return i?R=SXt(r,e[2]-e[0],e[3]-e[1],o,s,n.length,l):R=xXt(r,e[2]-e[0],e[3]-e[1],o,s,l),R.width=o,R.height=s,R}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],h=d[3]-d[1],p=f*h,g=this.getSamplesPerPixel();if(!n||!n.length)for(let C=0;C<g;++C)n.push(C);else for(let C=0;C<n.length;++C)if(n[C]>=g)return Promise.reject(new RangeError(`Invalid sample index '${n[C]}'.`));let y;if(r){const C=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=IY(C,x,p*n.length),l&&y.fill(l)}else{y=[];for(let C=0;C<n.length;++C){const x=this.getArrayForSample(n[C],p);Array.isArray(l)&&C<l.length?x.fill(l[C]):l&&!Array.isArray(l)&&x.fill(l),y.push(x)}}const v=i||await vXt(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===vp.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==iXt.Unspecified&&s){m=[];for(let C=0;C<this.fileDirectory.BitsPerSample.length;C+=1)m.push(C)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:l})}let f;switch(d){case vp.WhiteIsZero:case vp.BlackIsZero:case vp.Palette:f=[0];break;case vp.CMYK:f=[0,1,2,3];break;case vp.YCbCr:case vp.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:l},{fileDirectory:p}=this,g=await this.readRasters(h),y=2**this.fileDirectory.BitsPerSample[0];let v;switch(d){case vp.WhiteIsZero:v=lXt(g,y);break;case vp.BlackIsZero:v=cXt(g,y);break;case vp.Palette:v=uXt(g,p.ColorMap);break;case vp.CMYK:v=dXt(g);break;case vp.YCbCr:v=fXt(g);break;case vp.CIELab:v=mXt(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(v.length/3),C=new Uint8Array(v.length/3),x=new Uint8Array(v.length/3);for(let w=0,S=0;w<v.length;w+=3,++S)m[S]=v[w],C[S]=v[w+1],x[S]=v[w+2];v=[m,C,x]}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=rD(r,"Item");e===null?i=i.filter(a=>cE(a,"sample")===void 0):i=i.filter(a=>Number(cE(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[cE(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,p=[[0,0],[0,n],[r,0],[r,n]].map(([v,m])=>[s+i*v+a*m,f+l*v+u*m]),g=p.map(v=>v[0]),y=p.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 AXt=IXt;class MXt{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 sPe(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class LXt{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 RXt{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 _ne extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,_ne),this.name="AbortError"}}class OXt extends RXt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new _ne("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function PXt(t){return new OXt(t)}function AY(t){switch(t){case zo.BYTE:case zo.ASCII:case zo.SBYTE:case zo.UNDEFINED:return 1;case zo.SHORT:case zo.SSHORT:return 2;case zo.LONG:case zo.SLONG:case zo.FLOAT:case zo.IFD:return 4;case zo.RATIONAL:case zo.SRATIONAL:case zo.DOUBLE:case zo.LONG8:case zo.SLONG8:case zo.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function NXt(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=sXt[e[r]],a=e[r+1]?k6[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 DS(t,e,n,r){let i=null,a=null;const o=AY(e);switch(e){case zo.BYTE:case zo.ASCII:case zo.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case zo.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case zo.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case zo.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case zo.LONG:case zo.IFD:i=new Uint32Array(n),a=t.readUint32;break;case zo.SLONG:i=new Int32Array(n),a=t.readInt32;break;case zo.LONG8:case zo.IFD8:i=new Array(n),a=t.readUint64;break;case zo.SLONG8:i=new Array(n),a=t.readInt64;break;case zo.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case zo.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case zo.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case zo.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===zo.RATIONAL||e===zo.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===zo.ASCII?new TextDecoder("utf-8").decode(i):i}class DXt{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class vR extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class kXt{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 p=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(p[3]-p[1])/i}}if(a||o){const p=[];for(let g=0;g<d;++g){const y=await this.getImage(g),{SubfileType:v,NewSubfileType:m}=y.fileDirectory;(g===0||v===2||m&1)&&p.push(y)}p.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<p.length;++g){const y=p[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 h=n;if(s){const[p,g]=l.getOrigin(),[y,v]=u.getResolution(l);h=[Math.round((s[0]-p)/y),Math.round((s[1]-g)/v),Math.round((s[2]-p)/y),Math.round((s[3]-g)/v)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters({...e,window:h})}}class Ene extends kXt{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 LXt((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 h=i.readUint16(l),p=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,v;const m=AY(p),C=l+(this.bigTiff?12:8);if(m*g<=(this.bigTiff?8:4))y=DS(i,p,g,C);else{const x=i.readOffset(C),w=AY(p)*g;if(i.covers(x,w))y=DS(i,p,g,x);else{const S=await this.getSlice(x,w);y=DS(S,p,g,x)}}g===1&&rXt.indexOf(h)===-1&&!(p===zo.RATIONAL||p===zo.SRATIONAL)?v=y[0]:v=y,s[k6[h]]=v}const u=NXt(s),d=i.readOffset(e+r+n*a);return new DXt(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 vR?new vR(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new vR(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new AXt(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 vR)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===DS(i,zo.ASCII,n.length,e)){const o=DS(i,zo.ASCII,r,e).split(`
4801
4801
  `)[0],s=Number(o.split("=")[1].split(" ")[0])+o.length;s>r&&(i=await this.getSlice(e,s));const l=DS(i,zo.ASCII,s,e);this.ghostValues={},l.split(`
4802
4802
  `).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 MXt(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 Ene(e,s,u,d,n)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function lD(t,e){return Ene.fromSource(PXt(t),e)}const UXt=({axon_check:t,fbxTreeDatas:e,setLeftMenuTabIndex:n,swcRef:r,setIsChartOpen:i,setEchartValue:a,setChartValue:o,reset:s})=>{const l=b.useRef(null),u=b.useRef(null),[d,f]=b.useState(!1),[h,p]=b.useState(""),[g,y]=b.useState(""),[v,m]=b.useState({x:0,y:0}),C=b.useRef([]),x=b.useRef([]),w=b.useRef(null),S=b.useRef(null),[_,T]=b.useState(!0),R=b.useRef("#000"),[M,N]=b.useState(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"]),[D,F]=b.useState({nodes:[],links:[],categories:[]});let B=b.useRef(null),U=!1;const z=(Z,J)=>{N(re=>[...re.filter(G=>!Z.includes(G)),...J])};b.useEffect(()=>{N(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"])},[s]);const H=(Z,J)=>J.map(re=>{const G=Z.find(ee=>ee.id===re.source),W=Z.find(ee=>ee.id===re.target);return{...re,lineStyle:{color:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:W.itemStyle.color},{offset:1,color:G.itemStyle.color}]},width:1,curveness:.3}}});b.useEffect(()=>{j(M)},[M]);const j=Z=>{fetch("/app-api/d-api/connectivity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Z})}).then(J=>J.json()).then(J=>{J.code==200?F(J.node):Pr.error(J.message)})};b.useEffect(()=>{u.current=qh(l.current),u.current.clear();const Z=()=>u.current.getOption().series[0].data,J={tooltip:{formatter:X=>{var Y,ie;return X.dataType==="node"?`${X.data.fullname} (${X.data.name})<br>Downstream: ${((Y=t[X.data.name].down)==null?void 0:Y.length)??0} projection neuron(s)<br>Upstream: projected by ${((ie=t[X.data.name].up)==null?void 0:ie.length)??0} neuron(s)`:(X.dataType,"")}},animationDurationUpdate:1500,animationEasingUpdate:"quinticInOut",series:[{name:"Les Miserables",type:"graph",layout:"circular",circular:{rotateLabel:!0},data:D.nodes,links:H(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 re(X){if(X.event.event.preventDefault(),X.dataType=="node"){const Y=G(X.data.name,e);let ie=K(Y);ie&&z(ie,[Y.name])}if(X.dataType=="edge"){const Y=Z().find(se=>se.id===X.data.source),ie=Z().find(se=>se.id===X.data.target);C.current=t[Y.name].soma.filter(function(se){return t[ie.name].axon.indexOf(se)>-1}),x.current=t[ie.name].soma.filter(function(se){return t[Y.name].axon.indexOf(se)>-1}),p(Y.name),y(ie.name),m({x:X.event.event.clientX+2,y:X.event.event.clientY}),f(!0),R.current=X.data.lineStyle.color.colorStops[0].color}}const G=(X,Y)=>{let ie={name:""};for(let se=0;se<Y.length;se++){const le=Y[se];if(le.children){if(le.children.some(q=>q.name===X)){ie=le;break}else if(G(X,le.children)){ie=G(X,le.children);break}}}return ie},W=X=>{clearTimeout(B.current),U=!0,a(X.data.name),o(X.data.name),i(!1)},ee=X=>{B.current=setTimeout(()=>{if(!U){const Y=te(X.data.name,e);if(Y){let ie=[];"children"in Y?(Y.children.forEach(se=>{ie.push(se.name)}),z([X.data.name],ie)):Pr.error("No child node")}}U=!1},300)};return u.current.setOption(J),u.current.on("click",ee),u.current.on("dblclick",W),u.current.on("contextmenu",re),()=>{u.current.off("click",ee),u.current.off("dblclick",W),u.current.off("contextmenu",re)}},[e,D]);const K=Z=>{const J=[],re=G=>{J.push(G.name),G.children&&G.children.forEach(W=>re(W))};return re(Z),J},te=(Z,J)=>{let re=[],G=!1,W;for(let ee=0;ee<J.length;ee++)re.push(J[ee]);for(;re.length>0&&!G;){let ee=re.pop();if(ee.name==Z){G=!0,W=ee;break}else if(ee.children)for(let X=0;X<ee.children.length;X++)re.push(ee.children[X])}return W},Q=[{key:"1",label:b.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Z=>{n(3),r.current.setSearchValue(g),r.current.setSomaValue(h),f(!1),i(!1)}},h," →",g,": ",C.current.length," projection neruon(s)")},{key:"2",label:b.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Z=>{n(3),r.current.setSearchValue(h),r.current.setSomaValue(g),f(!1),i(!1)}},g," →",h,": ",x.current.length," projection neruon(s)")}];return b.createElement(b.Fragment,null,b.createElement("div",{style:{overflow:"hidden",position:"absolute",width:"500px",height:"200px"}},b.createElement("div",{ref:w,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"}},b.createElement("p",{style:{paddingLeft:"10px",paddingRight:"10px"}},"- Mouse-over a node to see upstream and downstream neuron numbers",b.createElement("br",null),"- Left-click a node to expand its children structures",b.createElement("br",null),"- Righ-click a node to collapse to its parent structure",b.createElement("br",null),"- Double-click a node to visualize all its projections in the main window",b.createElement("br",null),"- Righ-click a line to see the projections between two connected nodes",b.createElement("br",null),"- Left-click the popup menu of the line to inquire the projection neurons"),b.createElement("a",{style:{zIndex:9,position:"absolute",bottom:"-28px",left:0,display:"flex"},onClick:()=>{T(!_)}},b.createElement("div",{style:{width:"90px",height:"28px",display:"flex",justifyContent:"center",borderBottomRightRadius:"5px",borderBottomLeftRadius:"5px",backgroundColor:"#f1f1f180"}},b.createElement("div",{style:{display:"flex",alignItems:"center",color:"#000"}},"Help   ",b.createElement("div",{ref:S,style:{width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:_?"10px solid #000":0,borderTop:_?0:"10px solid #000"}})))))),b.createElement(Q1,{menu:{items:Q},open:d,overlayStyle:{position:"absolute",left:v.x,top:v.y,width:"auto",minWidth:"auto",border:`2px solid ${R}`},overlayClassName:"pipeline_dropdown"},b.createElement("div",{ref:l,style:{width:"100%",height:"calc(100vh - 75px)"},onMouseEnter:()=>{f(!1)}})))};class FXt{constructor(e,n,r,i,a,o,s){Ln(this,"name");Ln(this,"branches");Ln(this,"indices");Ln(this,"points");Ln(this,"numSoma");Ln(this,"vao");Ln(this,"vbo");Ln(this,"ebo");Ln(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(`
4803
4803
  `),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(" "),h=parseInt(f[0]);if(i!=null)if(a!=null)var p=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 p=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 p=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 p=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 p=parseFloat(f[2]),g=parseFloat(f[3]),y=parseFloat(f[4]);var v=parseInt(f[6]);h==1?(l={start:0},this.indices.push(0),this.numSoma=1):v!=h-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(p),this.points.push(g),this.points.push(y)}l&&(l.count=this.indices.length-l.start,this.branches.push(l))}}const BXt="1.6.1",VXt=b.createContext({}),$Xt=VXt,zXt={classNames:{},styles:{},className:"",style:{}},HXt=t=>{const e=b.useContext($Xt);return b.useMemo(()=>({...zXt,...e[t]}),[e[t]])},nF=HXt;function S3(){const{getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r,theme:i}=b.useContext(ip.ConfigContext);return{theme:i,getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r}}process.env.NODE_ENV;const GXt=Q6(RX.defaultAlgorithm),jXt={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},gPe=(t,e,n)=>{const r=n.getDerivativeToken(t),{override:i,...a}=e;let o={...r,override:i};return o=KD(o),a&&Object.entries(a).forEach(([s,l])=>{const{theme:u,...d}=l;let f=d;u&&(f=gPe({...o,...d},{override:d},u)),o[s]=f}),o};function WXt(){const{token:t,hashed:e,theme:n=GXt,override:r,cssVar:i}=b.useContext(RX._internalContext),[a,o,s]=ECe(n,[RX.defaultSeed,t],{salt:`${BXt}-${e||""}`,override:r,getComputedToken:gPe,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:xq,ignore:l3e,preserve:jXt}});return[n,s,e?o:"",a,i]}const{genStyleHooks:rF,genComponentStyleHook:oan,genSubStyleComponent:san}=o3e({usePrefix:()=>{const{getPrefixCls:t,iconPrefixCls:e}=S3();return{iconPrefixCls:e,rootPrefixCls:t()}},useToken:()=>{const[t,e,n,r,i]=WXt();return{theme:t,realToken:e,hashId:n,token:r,cssVar:i}},useCSP:()=>{const{csp:t}=S3();return t??{}},layer:{name:"antdx",dependencies:["antd"]}});function XXt(t,e){return b.useImperativeHandle(t,()=>{const n=e(),{nativeElement:r}=n;return new Proxy(r,{get(i,a){return n[a]?n[a]:Reflect.get(i,a)}})})}const mPe=E.createContext({}),o2e=()=>({height:0}),s2e=t=>({height:t.scrollHeight});function ZXt(t){const{title:e,onOpenChange:n,open:r,children:i,className:a,style:o,classNames:s={},styles:l={},closable:u,forceRender:d}=t,{prefixCls:f}=E.useContext(mPe),h=`${f}-header`;return E.createElement(md,{motionEnter:!0,motionLeave:!0,motionName:`${h}-motion`,leavedClassName:`${h}-motion-hidden`,onEnterStart:o2e,onEnterActive:s2e,onLeaveStart:s2e,onLeaveActive:o2e,visible:r,forceRender:d},({className:p,style:g})=>E.createElement("div",{className:lt(h,p,a),style:{...g,...o}},(u!==!1||e)&&E.createElement("div",{className:lt(`${h}-header`,s.header),style:{...l.header}},E.createElement("div",{className:`${h}-title`},e),u!==!1&&E.createElement("div",{className:`${h}-close`},E.createElement(ri,{type:"text",icon:E.createElement(kp,null),size:"small",onClick:()=>{n==null||n(!r)}}))),i&&E.createElement("div",{className:lt(`${h}-content`,s.content),style:{...l.content}},i)))}const iF=E.createContext(null);function KXt(t,e){const{className:n,action:r,onClick:i,...a}=t,o=E.useContext(iF),{prefixCls:s,disabled:l}=o,u=a.disabled??l??o[`${r}Disabled`];return E.createElement(ri,gn({type:"text"},a,{ref:e,onClick:d=>{var f;u||((f=o[r])==null||f.call(o),i==null||i(d))},className:lt(s,n,{[`${s}-disabled`]:u})}))}const aF=E.forwardRef(KXt);function YXt(t,e){return E.createElement(aF,gn({icon:E.createElement(s0t,null)},t,{action:"onClear",ref:e}))}const qXt=E.forwardRef(YXt),JXt=b.memo(t=>{const{className:e}=t;return b.createElement("svg",{color:"currentColor",viewBox:"0 0 1000 1000",xmlns:"http://www.w3.org/2000/svg",className:e},b.createElement("title",null,"Stop Loading"),b.createElement("rect",{fill:"currentColor",height:"250",rx:"24",ry:"24",width:"250",x:"375",y:"375"}),b.createElement("circle",{cx:"500",cy:"500",fill:"none",r:"450",stroke:"currentColor",strokeWidth:"100",opacity:"0.45"}),b.createElement("circle",{cx:"500",cy:"500",fill:"none",r:"450",stroke:"currentColor",strokeWidth:"100",strokeDasharray:"600 9999999"},b.createElement("animateTransform",{attributeName:"transform",dur:"1s",from:"0 500 500",repeatCount:"indefinite",to:"360 500 500",type:"rotate"})))}),QXt=JXt;function eZt(t,e){const{prefixCls:n}=E.useContext(iF),{className:r}=t;return E.createElement(aF,gn({icon:E.createElement(QXt,{className:`${n}-loading-icon`}),color:"primary",variant:"text",shape:"circle"},t,{className:lt(r,`${n}-loading-button`),action:"onCancel",ref:e}))}const vPe=E.forwardRef(eZt);function tZt(t,e){return E.createElement(aF,gn({icon:E.createElement(Ppt,null),type:"primary",shape:"circle"},t,{action:"onSend",ref:e}))}const yPe=E.forwardRef(tZt),nI=1e3,rI=4,XO=140,l2e=XO/2,yR=250,c2e=500,bR=.8;function nZt({className:t}){return b.createElement("svg",{color:"currentColor",viewBox:`0 0 ${nI} ${nI}`,xmlns:"http://www.w3.org/2000/svg",className:t},b.createElement("title",null,"Speech Recording"),Array.from({length:rI}).map((e,n)=>{const r=(nI-XO*rI)/(rI-1),i=n*(r+XO),a=nI/2-yR/2,o=nI/2-c2e/2;return b.createElement("rect",{fill:"currentColor",rx:l2e,ry:l2e,height:yR,width:XO,x:i,y:a,key:n},b.createElement("animate",{attributeName:"height",values:`${yR}; ${c2e}; ${yR}`,keyTimes:"0; 0.5; 1",dur:`${bR}s`,begin:`${bR/rI*n}s`,repeatCount:"indefinite"}),b.createElement("animate",{attributeName:"y",values:`${a}; ${o}; ${a}`,keyTimes:"0; 0.5; 1",dur:`${bR}s`,begin:`${bR/rI*n}s`,repeatCount:"indefinite"}))}))}function rZt(t,e){const{speechRecording:n,onSpeechDisabled:r,prefixCls:i}=E.useContext(iF);let a=null;return n?a=E.createElement(nZt,{className:`${i}-recording-icon`}):r?a=E.createElement(Upt,null):a=E.createElement($pt,null),E.createElement(aF,gn({icon:a,color:"primary",variant:"text"},t,{action:"onSpeech",ref:e}))}const bPe=E.forwardRef(rZt),iZt=t=>{const{componentCls:e,calc:n}=t,r=`${e}-header`;return{[e]:{[r]:{borderBottomWidth:t.lineWidth,borderBottomStyle:"solid",borderBottomColor:t.colorBorder,"&-header":{background:t.colorFillAlter,fontSize:t.fontSize,lineHeight:t.lineHeight,paddingBlock:n(t.paddingSM).sub(t.lineWidthBold).equal(),paddingInlineStart:t.padding,paddingInlineEnd:t.paddingXS,display:"flex",borderRadius:{_skip_check_:!0,value:n(t.borderRadius).mul(2).equal()},borderEndStartRadius:0,borderEndEndRadius:0,[`${r}-title`]:{flex:"auto"}},"&-content":{padding:t.padding},"&-motion":{transition:["height","border"].map(i=>`${i} ${t.motionDurationSlow}`).join(","),overflow:"hidden","&-enter-start, &-leave-active":{borderBottomColor:"transparent"},"&-hidden":{display:"none"}}}}}},aZt=iZt,oZt=t=>{const{componentCls:e,padding:n,paddingSM:r,paddingXS:i,paddingXXS:a,lineWidth:o,lineWidthBold:s,calc:l}=t;return{[e]:{position:"relative",width:"100%",boxSizing:"border-box",boxShadow:`${t.boxShadowTertiary}`,transition:`background ${t.motionDurationSlow}`,borderRadius:{_skip_check_:!0,value:l(t.borderRadius).mul(2).equal()},borderColor:t.colorBorder,borderWidth:0,borderStyle:"solid","&:after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",transition:`border-color ${t.motionDurationSlow}`,borderRadius:{_skip_check_:!0,value:"inherit"},borderStyle:"inherit",borderColor:"inherit",borderWidth:o},"&:focus-within":{boxShadow:`${t.boxShadowSecondary}`,borderColor:t.colorPrimary,"&:after":{borderWidth:s}},"&-disabled":{background:t.colorBgContainerDisabled},[`&${e}-rtl`]:{direction:"rtl"},[`${e}-content`]:{display:"flex",gap:i,width:"100%",paddingBlock:r,paddingInlineStart:n,paddingInlineEnd:r,boxSizing:"border-box",alignItems:"flex-end"},[`${e}-prefix`]:{flex:"none"},[`${e}-input`]:{padding:0,borderRadius:0,flex:"auto",alignSelf:"center",minHeight:"auto"},[`${e}-actions-list`]:{flex:"none",display:"flex","&-presets":{gap:t.paddingXS}},[`${e}-actions-btn`]:{"&-disabled":{opacity:.45},"&-loading-button":{padding:0,border:0},"&-loading-icon":{height:t.controlHeight,width:t.controlHeight,verticalAlign:"top"},"&-recording-icon":{height:"1.2em",width:"1.2em",verticalAlign:"top"}},[`${e}-footer`]:{paddingInlineStart:n,paddingInlineEnd:r,paddingBlockEnd:r,paddingBlockStart:a,boxSizing:"border-box"}}}},sZt=()=>({}),lZt=rF("Sender",t=>{const{paddingXS:e,calc:n}=t,r=ba(t,{SenderContentMaxWidth:`calc(100% - ${ft(n(e).add(32).equal())})`});return[oZt(r),aZt(r)]},sZt);let cD;!cD&&typeof window<"u"&&(cD=window.SpeechRecognition||window.webkitSpeechRecognition);function cZt(t,e){const n=ja(t),[r,i,a]=b.useMemo(()=>typeof e=="object"?[e.recording,e.onRecordingChange,typeof e.recording=="boolean"]:[void 0,void 0,!1],[e]),[o,s]=b.useState(null);b.useEffect(()=>{if(typeof navigator<"u"&&"permissions"in navigator){let y=null;return navigator.permissions.query({name:"microphone"}).then(v=>{s(v.state),v.onchange=function(){s(this.state)},y=v}),()=>{y&&(y.onchange=null)}}},[]);const l=cD&&o!=="denied",u=b.useRef(null),[d,f]=ro(!1,{value:r}),h=b.useRef(!1),p=()=>{if(l&&!u.current){const y=new cD;y.onstart=()=>{f(!0)},y.onend=()=>{f(!1)},y.onresult=v=>{var m,C,x;if(!h.current){const w=(x=(C=(m=v.results)==null?void 0:m[0])==null?void 0:C[0])==null?void 0:x.transcript;n(w)}h.current=!1},u.current=y}},g=ja(y=>{y&&!d||(h.current=y,a?i==null||i(!d):(p(),u.current&&(d?(u.current.stop(),i==null||i(!1)):(u.current.start(),i==null||i(!0)))))});return[l,g,d]}function uZt(t,e,n){return Zf(t,e)||n}const u2e={SendButton:yPe,ClearButton:qXt,LoadingButton:vPe,SpeechButton:bPe},dZt=b.forwardRef((t,e)=>{const{prefixCls:n,styles:r={},classNames:i={},className:a,rootClassName:o,style:s,defaultValue:l,value:u,readOnly:d,submitType:f="enter",onSubmit:h,loading:p,components:g,onCancel:y,onChange:v,actions:m,onKeyPress:C,onKeyDown:x,disabled:w,allowSpeech:S,prefix:_,footer:T,header:R,onPaste:M,onPasteFile:N,autoSize:D={maxRows:8},...F}=t,{direction:B,getPrefixCls:U}=S3(),z=U("sender",n),H=b.useRef(null),j=b.useRef(null);XXt(e,()=>{var Oe,Ue;return{nativeElement:H.current,focus:(Oe=j.current)==null?void 0:Oe.focus,blur:(Ue=j.current)==null?void 0:Ue.blur}});const K=nF("sender"),te=`${z}-input`,[Q,Z,J]=lZt(z),re=lt(z,K.className,a,o,Z,J,{[`${z}-rtl`]:B==="rtl",[`${z}-disabled`]:w}),G=`${z}-actions-btn`,W=`${z}-actions-list`,[ee,X]=ro(l||"",{value:u}),Y=(Oe,Ue)=>{X(Oe),v&&v(Oe,Ue)},[ie,se,le]=cZt(Oe=>{Y(`${ee} ${Oe}`)},S),q=uZt(g,["input"],qs.TextArea),oe={...Yl(F,{attr:!0,aria:!0,data:!0}),ref:j},he=()=>{ee&&h&&!p&&h(ee)},ue=()=>{Y("")},_e=b.useRef(!1),Ce=()=>{_e.current=!0},Pe=()=>{_e.current=!1},Ae=Oe=>{const Ue=Oe.key==="Enter"&&!_e.current;switch(f){case"enter":Ue&&!Oe.shiftKey&&(Oe.preventDefault(),he());break;case"shiftEnter":Ue&&Oe.shiftKey&&(Oe.preventDefault(),he());break}C==null||C(Oe)},Se=Oe=>{var Ye;const Ue=(Ye=Oe.clipboardData)==null?void 0:Ye.files;Ue!=null&&Ue.length&&N&&(N(Ue[0],Ue),Oe.preventDefault()),M==null||M(Oe)},Re=Oe=>{var Ue,Ye;Oe.target!==((Ue=H.current)==null?void 0:Ue.querySelector(`.${te}`))&&Oe.preventDefault(),(Ye=j.current)==null||Ye.focus()};let ge=b.createElement(UJ,{className:`${W}-presets`},S&&b.createElement(bPe,null),p?b.createElement(vPe,null):b.createElement(yPe,null));typeof m=="function"?ge=m(ge,{components:u2e}):(m||m===!1)&&(ge=m);const pe={prefixCls:G,onSend:he,onSendDisabled:!ee,onClear:ue,onClearDisabled:!ee,onCancel:y,onCancelDisabled:!p,onSpeech:()=>se(!1),onSpeechDisabled:!ie,speechRecording:le,disabled:w},ye=typeof T=="function"?T({components:u2e}):T||null;return Q(b.createElement("div",{ref:H,className:re,style:{...K.style,...s}},R&&b.createElement(mPe.Provider,{value:{prefixCls:z}},R),b.createElement(iF.Provider,{value:pe},b.createElement("div",{className:lt(`${z}-content`,K.classNames.content,i.content),style:{...K.styles.content,...r.content},onMouseDown:Re},_&&b.createElement("div",{className:lt(`${z}-prefix`,K.classNames.prefix,i.prefix),style:{...K.styles.prefix,...r.prefix}},_),b.createElement(q,gn({},oe,{disabled:w,style:{...K.styles.input,...r.input},className:lt(te,K.classNames.input,i.input),autoSize:D,value:ee,onChange:Oe=>{Y(Oe.target.value,Oe),se(!0)},onPressEnter:Ae,onCompositionStart:Ce,onCompositionEnd:Pe,onKeyDown:x,onPaste:Se,variant:"borderless",readOnly:d})),ge&&b.createElement("div",{className:lt(W,K.classNames.actions,i.actions),style:{...K.styles.actions,...r.actions}},ge)),ye&&b.createElement("div",{className:lt(`${z}-footer`,K.classNames.footer,i.footer),style:{...K.styles.footer,...r.footer}},ye))))}),Tne=dZt;process.env.NODE_ENV!=="production"&&(Tne.displayName="Sender");Tne.Header=ZXt;const fZt=Tne;function xR(t){return typeof t=="string"}function hZt(t,e){let n=0;const r=Math.min(t.length,e.length);for(;n<r&&t[n]===e[n];)n++;return n}const pZt=(t,e,n,r)=>{const i=E.useRef(""),[a,o]=E.useState(1),s=e&&xR(t);return ka(()=>{if(!s&&xR(t))o(t.length);else if(xR(t)&&xR(i.current)&&t.indexOf(i.current)!==0){if(!t||!i.current){o(1);return}const u=hZt(t,i.current);o(u===0?1:u+1)}i.current=t},[t]),E.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]},gZt=pZt;function mZt(t){return E.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 vZt=({prefixCls:t})=>b.createElement("span",{className:`${t}-dot`},b.createElement("i",{className:`${t}-dot-item`,key:"item-1"}),b.createElement("i",{className:`${t}-dot-item`,key:"item-2"}),b.createElement("i",{className:`${t}-dot-item`,key:"item-3"})),yZt=vZt,bZt=t=>{const{componentCls:e,paddingSM:n,padding:r}=t;return{[e]:{[`${e}-content`]:{"&-filled,&-outlined,&-shadow":{padding:`${ft(n)} ${ft(r)}`,borderRadius:t.borderRadiusLG},"&-filled":{backgroundColor:t.colorFillContent},"&-outlined":{border:`1px solid ${t.colorBorderSecondary}`},"&-shadow":{boxShadow:t.boxShadowTertiary}}}}},xZt=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}}}},CZt=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`}}}},wZt=CZt,SZt=new Wo("loadingMove",{"0%":{transform:"translateY(0)"},"10%":{transform:"translateY(4px)"},"20%":{transform:"translateY(0)"},"30%":{transform:"translateY(-4px)"},"40%":{transform:"translateY(0)"}}),_Zt=new Wo("cursorBlink",{"0%":{opacity:1},"50%":{opacity:0},"100%":{opacity:1}}),EZt=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:_Zt,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 ${ft(t.paddingXXS)}`,"&-item":{backgroundColor:t.colorPrimary,borderRadius:"100%",width:4,height:4,animationName:SZt,animationDuration:"2s",animationIterationCount:"infinite",animationTimingFunction:"linear","&:nth-child(1)":{animationDelay:"0s"},"&:nth-child(2)":{animationDelay:"0.2s"},"&:nth-child(3)":{animationDelay:"0.4s"}}}}}}},TZt=()=>({}),xPe=rF("Bubble",t=>{const e=ba(t,{});return[EZt(e),wZt(e),bZt(e),xZt(e)]},TZt),CPe=b.createContext({}),IZt=(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:h,content:p="",messageRender:g,variant:y="filled",shape:v,onTypingComplete:m,header:C,footer:x,_key:w,...S}=t,{onUpdate:_}=b.useContext(CPe),T=b.useRef(null);b.useImperativeHandle(e,()=>({nativeElement:T.current}));const{direction:R,getPrefixCls:M}=S3(),N=M("bubble",n),D=nF("bubble"),[F,B,U,z]=mZt(h),[H,j]=gZt(p,F,B,U);b.useEffect(()=>{_==null||_()},[H]);const K=b.useRef(!1);b.useEffect(()=>{!j&&!d?K.current||(K.current=!0,m==null||m()):K.current=!1},[j,d]);const[te,Q,Z]=xPe(N),J=lt(N,i,D.className,r,Q,Z,`${N}-${u}`,{[`${N}-rtl`]:R==="rtl",[`${N}-typing`]:j&&!d&&!g&&!z}),re=b.useMemo(()=>b.isValidElement(l)?l:b.createElement(HSe,l),[l]),G=b.useMemo(()=>g?g(H):H,[H,g]),W=Y=>typeof Y=="function"?Y(H,{key:w}):Y;let ee;d?ee=f?f():b.createElement(yZt,{prefixCls:N}):ee=b.createElement(b.Fragment,null,G,j&&z);let X=b.createElement("div",{style:{...D.styles.content,...s.content},className:lt(`${N}-content`,`${N}-content-${y}`,v&&`${N}-content-${v}`,D.classNames.content,o.content)},ee);return(C||x)&&(X=b.createElement("div",{className:`${N}-content-wrapper`},C&&b.createElement("div",{className:lt(`${N}-header`,D.classNames.header,o.header),style:{...D.styles.header,...s.header}},W(C)),X,x&&b.createElement("div",{className:lt(`${N}-footer`,D.classNames.footer,o.footer),style:{...D.styles.footer,...s.footer}},W(x)))),te(b.createElement("div",gn({style:{...D.style,...a},className:J},S,{ref:T}),l&&b.createElement("div",{style:{...D.styles.avatar,...s.avatar},className:lt(`${N}-avatar`,D.classNames.avatar,o.avatar)},re),X))},wPe=b.forwardRef(IZt);process.env.NODE_ENV!=="production"&&(wPe.displayName="Bubble");const Ine=wPe;function AZt(t,e){const n=E.useCallback((r,i)=>typeof e=="function"?e(r,i):e?e[r.role]||{}:{},[e]);return E.useMemo(()=>(t||[]).map((r,i)=>{const a=r.key??`preset_${i}`;return{...n(r,i),...r,key:a}}),[t,n])}const MZt=({_key:t,...e},n)=>E.createElement(Ine,gn({},e,{_key:t,ref:r=>{var i;r?n.current[t]=r:(i=n.current)==null||delete i[t]}})),LZt=E.memo(E.forwardRef(MZt)),RZt=1,OZt=(t,e)=>{const{prefixCls:n,rootClassName:r,className:i,items:a,autoScroll:o=!0,roles:s,onScroll:l,...u}=t,d=Yl(u,{attr:!0,aria:!0}),f=E.useRef(null),h=E.useRef({}),{getPrefixCls:p}=S3(),g=p("bubble",n),y=`${g}-list`,[v,m,C]=xPe(g),[x,w]=E.useState(!1);E.useEffect(()=>(w(!0),()=>{w(!1)}),[]);const S=AZt(a,s),[_,T]=E.useState(!0),[R,M]=E.useState(0),N=B=>{const U=B.target;T(U.scrollHeight-Math.abs(U.scrollTop)-U.clientHeight<=RZt),l==null||l(B)};E.useEffect(()=>{o&&f.current&&_&&f.current.scrollTo({top:f.current.scrollHeight})},[R]),E.useEffect(()=>{var B;if(o){const U=(B=S[S.length-2])==null?void 0:B.key,z=h.current[U];if(z){const{nativeElement:H}=z,{top:j,bottom:K}=H.getBoundingClientRect(),{top:te,bottom:Q}=f.current.getBoundingClientRect();j<Q&&K>te&&(M(J=>J+1),T(!0))}}},[S.length]),E.useImperativeHandle(e,()=>({nativeElement:f.current,scrollTo:({key:B,offset:U,behavior:z="smooth",block:H})=>{if(typeof U=="number")f.current.scrollTo({top:U,behavior:z});else if(B!==void 0){const j=h.current[B];if(j){const K=S.findIndex(te=>te.key===B);T(K===S.length-1),j.nativeElement.scrollIntoView({behavior:z,block:H})}}}}));const D=ja(()=>{o&&M(B=>B+1)}),F=E.useMemo(()=>({onUpdate:D}),[]);return v(E.createElement(CPe.Provider,{value:F},E.createElement("div",gn({},d,{className:lt(y,r,i,m,C,{[`${y}-reach-end`]:_}),ref:f,onScroll:N}),S.map(({key:B,...U})=>E.createElement(LZt,gn({},U,{key:B,_key:B,ref:h,typing:x?U.typing:!1}))))))},SPe=E.forwardRef(OZt);process.env.NODE_ENV!=="production"&&(SPe.displayName="BubbleList");const PZt=SPe;Ine.List=PZt;const _Pe=b.createContext(null),NZt=({children:t})=>{const{prefixCls:e}=b.useContext(_Pe);return b.createElement("div",{className:lt(`${e}-group-title`)},t&&b.createElement(dQ.Text,null,t))},d2e=NZt,f2e=t=>{t.stopPropagation()},DZt=t=>{const{prefixCls:e,info:n,className:r,direction:i,onClick:a,active:o,menu:s,...l}=t,u=Yl(l,{aria:!0,data:!0,attr:!0}),{disabled:d}=n,f=lt(r,`${e}-item`,{[`${e}-item-active`]:o&&!d},{[`${e}-item-disabled`]:d}),h=()=>{!d&&a&&a(n)},{trigger:p,...g}=s||{},y=g==null?void 0:g.getPopupContainer,v=m=>{const C=b.createElement(Sk,{onClick:f2e,className:`${e}-menu-icon`});return p?typeof p=="function"?p(m,{originNode:C}):p:C};return b.createElement("li",gn({title:typeof n.label=="object"?void 0:`${n.label}`},u,{className:f,onClick:h}),n.icon&&b.createElement("div",{className:`${e}-icon`},n.icon),b.createElement(dQ.Text,{className:`${e}-label`},n.label),!d&&s&&b.createElement("div",{onClick:f2e},b.createElement(Q1,{menu:g,placement:i==="rtl"?"bottomLeft":"bottomRight",trigger:["click"],disabled:d,getPopupContainer:y},v(n))))},kZt=DZt,nj="__ungrouped",UZt=(t,e=[])=>{const[n,r,i]=b.useMemo(()=>{if(!t)return[!1,void 0,void 0];let a={sort:void 0,title:void 0};return typeof t=="object"&&(a={...a,...t}),[!0,a.sort,a.title]},[t]);return b.useMemo(()=>{if(!n)return[[{name:nj,data:e,title:void 0}],n];const a=e.reduce((l,u)=>{const d=u.group||nj;return l[d]||(l[d]=[]),l[d].push(u),l},{});return[(r?Object.keys(a).sort(r):Object.keys(a)).map(l=>({name:l===nj?void 0:l,title:i,data:a[l]})),n]},[e,t])},FZt=UZt,BZt=t=>{const{componentCls:e}=t;return{[e]:{display:"flex",flexDirection:"column",gap:t.paddingXXS,overflowY:"auto",padding:t.paddingSM,margin:0,listStyle:"none","ul, ol":{margin:0,padding:0,listStyle:"none"},[`&${e}-rtl`]:{direction:"rtl"},[`& ${e}-list`]:{display:"flex",gap:t.paddingXXS,flexDirection:"column",[`& ${e}-item`]:{paddingInlineStart:t.paddingXL},[`& ${e}-label`]:{color:t.colorTextDescription,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[`& ${e}-item`]:{display:"flex",height:t.controlHeightLG,minHeight:t.controlHeightLG,gap:t.paddingXS,padding:`0 ${ft(t.paddingXS)}`,alignItems:"center",borderRadius:t.borderRadiusLG,cursor:"pointer",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,"&:hover":{backgroundColor:t.colorBgTextHover},"&-active":{backgroundColor:t.colorBgTextHover,[`& ${e}-label, ${e}-menu-icon`]:{color:t.colorText}},"&-disabled":{cursor:"not-allowed",[`& ${e}-label`]:{color:t.colorTextDisabled}},"&:hover, &-active":{[`& ${e}-menu-icon`]:{opacity:.6}},[`${e}-menu-icon:hover`]:{opacity:1}},[`& ${e}-label`]:{flex:1,color:t.colorText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},[`& ${e}-menu-icon`]:{opacity:0,fontSize:t.fontSizeXL},[`& ${e}-group-title`]:{display:"flex",alignItems:"center",height:t.controlHeightLG,minHeight:t.controlHeightLG,padding:`0 ${ft(t.paddingXS)}`}}}},VZt=()=>({}),$Zt=rF("Conversations",t=>{const e=ba(t,{});return BZt(e)},VZt),EPe=t=>{const{prefixCls:e,rootClassName:n,items:r,activeKey:i,defaultActiveKey:a,onActiveChange:o,menu:s,styles:l={},classNames:u={},groupable:d,className:f,style:h,...p}=t,g=Yl(p,{attr:!0,aria:!0,data:!0}),[y,v]=ro(a,{value:i}),[m,C]=FZt(d,r),{getPrefixCls:x,direction:w}=S3(),S=x("conversations",e),_=nF("conversations"),[T,R,M]=$Zt(S),N=lt(S,_.className,f,n,R,M,{[`${S}-rtl`]:w==="rtl"}),D=F=>{v(F.key),o&&o(F.key)};return T(b.createElement("ul",gn({},g,{style:{..._.style,...h},className:N}),m.map((F,B)=>{var z;const U=F.data.map((H,j)=>{const{label:K,disabled:te,icon:Q,...Z}=H;return b.createElement(kZt,gn({},Z,{key:H.key||`key-${j}`,info:H,prefixCls:S,direction:w,className:lt(u.item,_.classNames.item,H.className),style:{..._.styles.item,...l.item,...H.style},menu:typeof s=="function"?s(H):s,active:y===H.key,onClick:D}))});return C?b.createElement("li",{key:F.name||`key-${B}`},b.createElement(_Pe.Provider,{value:{prefixCls:S}},((z=F.title)==null?void 0:z.call(F,F.name,{components:{GroupTitle:d2e}}))||b.createElement(d2e,{key:F.name},F.name)),b.createElement("ul",{className:`${S}-list`},U)):U})))};process.env.NODE_ENV!=="production"&&(EPe.displayName="Conversations");const zZt=EPe,HZt=t=>{const{componentCls:e,antCls:n}=t;return{[e]:{[`${n}-cascader-menus ${n}-cascader-menu`]:{height:"auto"},[`${e}-item`]:{"&-icon":{marginInlineEnd:t.paddingXXS},"&-extra":{marginInlineStart:t.padding}},[`&${e}-block`]:{[`${e}-item-extra`]:{marginInlineStart:"auto"}}}}},GZt=()=>({}),jZt=rF("Suggestion",t=>{const e=ba(t,{});return HZt(e)},GZt);function WZt(t,e,n,r,i){const[a,o]=b.useState([]),s=(p,g=a)=>{let y=t;for(let v=0;v<p-1;v+=1){const m=g[v],C=y.find(x=>x.value===m);if(!C)break;y=C.children||[]}return y},l=p=>p.map((g,y)=>{const m=s(y+1,p).find(C=>C.value===g);return m==null?void 0:m.value}),u=p=>{const g=a.length||1,y=s(g),v=y.findIndex(x=>x.value===a[g-1]),m=y.length,C=y[(v+p+m)%m];o([...a.slice(0,g-1),C.value])},d=()=>{a.length>1&&o(a.slice(0,a.length-1))},f=()=>{const p=s(a.length+1);p.length&&o([...a,p[0].value])},h=ja(p=>{if(e)switch(p.key){case"ArrowDown":u(1),p.preventDefault();break;case"ArrowUp":u(-1),p.preventDefault();break;case"ArrowRight":n?d():f(),p.preventDefault();break;case"ArrowLeft":n?f():d(),p.preventDefault();break;case"Enter":s(a.length+1).length||r(l(a)),p.preventDefault();break;case"Escape":i(),p.preventDefault();break}});return b.useEffect(()=>{e&&Array.isArray(t)&&t.length>0&&o([t[0].value])},[e]),[a,h]}const rj=s3e.split(".").map(Number),XZt=rj[0]>5||rj[0]===5&&rj[1]>=25;function TPe(t){const{prefixCls:e,className:n,rootClassName:r,style:i,children:a,open:o,onOpenChange:s,items:l,onSelect:u,block:d}=t,{direction:f,getPrefixCls:h}=S3(),p=h("suggestion",e),g=`${p}-item`,y=f==="rtl",v=nF("suggestion"),[m,C,x]=jZt(p),[w,S]=ro(!1,{value:o}),[_,T]=b.useState(),R=te=>{S(te),s==null||s(te)},M=ja(te=>{te===!1?R(!1):(T(te),R(!0))}),N=()=>{R(!1)},D=b.useMemo(()=>typeof l=="function"?l(_):l,[l,_]),F=te=>b.createElement(UJ,{className:g},te.icon&&b.createElement("div",{className:`${g}-icon`},te.icon),te.label,te.extra&&b.createElement("div",{className:`${g}-extra`},te.extra)),B=te=>{u&&u(te[te.length-1]),R(!1)},[U,z]=WZt(D,w,y,B,N),H=a==null?void 0:a({onTrigger:M,onKeyDown:z}),j=te=>{te||N()},K={};return XZt?K.onOpenChange=j:K.onDropdownVisibleChange=j,m(b.createElement(wet,gn({options:D,open:w,value:U,placement:y?"topRight":"topLeft"},K,{optionRender:F,rootClassName:lt(r,p,C,x,{[`${p}-block`]:d}),onChange:B,dropdownMatchSelectWidth:d}),b.createElement("div",{className:lt(p,v.className,r,n,`${p}-wrapper`,C,x),style:{...v.style,...i}},H)))}process.env.NODE_ENV!=="production"&&(TPe.displayName="Suggestion");function ZZt(){const{getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r,theme:i}=b.useContext(ip.ConfigContext);return{theme:i,getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r}}function Ane(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var J3=Ane();function IPe(t){J3=t}var U6={exec:()=>null};function Tl(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(bh.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var bh={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},KZt=/^(?:[ \t]*(?:\n|$))+/,YZt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qZt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,aM=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,JZt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Mne=/(?:[*+-]|\d{1,9}[.)])/,APe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,MPe=Tl(APe).replace(/bull/g,Mne).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),QZt=Tl(APe).replace(/bull/g,Mne).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Lne=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,eKt=/^[^\n]+/,Rne=/(?!\s*\])(?:\\.|[^\[\]\\])+/,tKt=Tl(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Rne).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nKt=Tl(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mne).getRegex(),oF="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",One=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rKt=Tl("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",One).replace("tag",oF).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),LPe=Tl(Lne).replace("hr",aM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oF).getRegex(),iKt=Tl(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",LPe).getRegex(),Pne={blockquote:iKt,code:YZt,def:tKt,fences:qZt,heading:JZt,hr:aM,html:rKt,lheading:MPe,list:nKt,newline:KZt,paragraph:LPe,table:U6,text:eKt},h2e=Tl("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",aM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oF).getRegex(),aKt={...Pne,lheading:QZt,table:h2e,paragraph:Tl(Lne).replace("hr",aM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",h2e).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oF).getRegex()},oKt={...Pne,html:Tl(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",One).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:U6,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Tl(Lne).replace("hr",aM).replace("heading",` *#{1,6} *[^
@@ -5251,7 +5251,7 @@ void main(){
5251
5251
  }
5252
5252
  }
5253
5253
  `,transparent:!1,depthWrite:!1,depthTest:!1}),lr=new Vc(hr,ma);lr.translateX(Vn),lr.translateY(wn),lr.translateZ(dr),lr.myMeshType="neuronSphere",lr.name=`${Ze}-${Jt.line[0].start_name}`,lr.userData.color="#1771FF",lr.myMeshType="neuronSphere",lr.name=`${Ze}-${Jt.line[0].start_name}`,lr.userData.color="#1771FF",C5(lr);const vi={};for(const Mr in tu.current){const Yi=tu.current[Mr];for(const fi of Yi)if(fi.name==Ze){if(fi.color==="#1771FF"){vi[Mr]={point:fi.point,color:fi.color,type:fi.type};break}if(fi.color==="#A7B5A1"){vi[Mr]={point:fi.point,color:fi.color,type:fi.type};break}vi[Mr]={point:fi.point,color:fi.color,type:fi.type}}}for(let Mr in vi){const{point:Yi,color:fi,type:xa}=vi[Mr];tQt.load(n+"/fonts/helvetiker_bold.typeface.json",function(Pi){const so=new Xf(Mr.replace("_111",""),{font:Pi,size:.3,height:.01}),Ws=new $o({color:fi,specular:0,shininess:0}),Rs=new Wn(so,Ws),Xl=Yr<6?.2:Yr<9?.3:.5;Rs.scale.set(Xl,Xl,Xl),Rs.position.set(Yi[0]*.01,Yi[1]*.01,Yi[2]*.01),Rs.name="lineNameMesh",Rs.userData.name=Mr.replace("_111",""),Rs.userData.wholeName=`${Ze}-${Mr.replace("_111","")}`,Rs.userData.initColor=fi,Rs.userData.type=xa,Rs.userData.isAtlasMapping="true",Rs.translateY(Ki.current),Rs.translateZ(ra.current),Rs.translateX(na.current),so.center(),Gt.add(Rs)})}Gt.add(lr),Gt.name=`swcPointGroup${Ze}`,Gt.userData.isAtlasMapping="true";let Yr=1;for(let Mr=0;Mr<Jt.line.length;Mr++){let Yi=[],fi=[Jt.position[0].x,Jt.position[0].y,Jt.position[0].z];for(let Pi=Jt.line[Mr].start;Pi<=Jt.line[Mr].end;Pi++){Pi===Jt.line[Mr].start&&(fi=[Jt.position[Pi].x,Jt.position[Pi].y,Jt.position[Pi].z]);let so=Jt.position[Pi].x,Ws=Jt.position[Pi].y,Rs=Jt.position[Pi].z;(Math.sqrt((so-fi[0])*(so-fi[0])+(Ws-fi[1])*(Ws-fi[1])+(Rs-fi[2])*(Rs-fi[2]))>Yr||Pi===Jt.line[Mr].end||Pi===Jt.line[Mr].start)&&(Yi.push(new Te(so,Ws,Rs)),fi=[so,Ws,Rs])}let xa=new fa(new Mi().setFromPoints(Yi),new Ll({color:Ne}));xa.myMeshType="SWC",er.add(xa)}er.scale.set(Sr.current,Sr.current,Sr.current),er.translateX(Vn),er.translateY(wn),er.translateZ(dr),er.name=Ze||"",er.userData.isAtlasMapping="true",er.myMeshType="SWC",Gt.add(er),Yo.current=JSON.parse(JSON.stringify(tu.current)),Gp.current=Yo.current,Le&&Le(),console.log(tu.current),Nt(!1)}),be.current.add(Gt),zr.current[Ze||""]=Gt},VF=()=>{const xe=be.current.getObjectByName("Brain");if(xe)if(Nt(Ne=>!Ne),Ma.file[1].indexOf(".js")>-1)w5("/app-api/d-api/dowload/"+Ma.file[1]);else{var Le=new fo;Le.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const Ne=(xe==null?void 0:xe.children[0]).geometry.boundingBox.min,Ze=(xe==null?void 0:xe.children[0]).geometry.boundingBox.max,kt={bwidth:0,bheight:2.6,bdepth:0,ewidth:Ze.x-Ne.x,eheight:Ze.y-Ne.y,edepth:Ze.z-Ne.z,owidth:Ze.x-Ne.x,oheight:Ze.y-Ne.y,odepth:Ze.z-Ne.z};let Gt=new Te(.005238113403320366,-1.6508567881694614,6133353495929583e-20),Jt=new Te(-5.097530670166015,-4.308416134996751,-7.990437196406743),wn=new Te(5.118084411621094,3.006702558657828,6.001559863476661);const Vn=new Qo;Vn.expandByObject(xe.clone()),Jt=Vn.min,wn=Vn.max,Gt=Vn.getCenter(Gt);const dr=wn.x-Jt.x,er=wn.y-Jt.y,hr=wn.z-Jt.z;Tt.current.scale.set(dr,er,hr),Tt.current.position.set(Gt.x,Gt.y,Gt.z),Yn.current.length===0?fetch("/app-api/d-api/dowload/"+Ma.file[1]).then(ci=>ci.arrayBuffer()).then(ci=>{const ma=new Uint8Array(ci);let lr=QG(ma),vi=r2e(ma);Yn.current=lr,fy(lr,kt,vi)}):setTimeout(()=>{fy(Yn.current,kt,Yn.current.length)},200)}},BM=xe=>{const Le=Na.findIndex(Ne=>Ne.key===Fr[0]);if(Le>-1){let Ne=JSON.parse(JSON.stringify(Na)),Ze=Ne[Le];Ze.registrationRadioShowType=xe.target.value,$a(Ne),Ra.current=Ne,be.current.getObjectByName(`png${Le}`)&&$M(xe.target.value,!0)}},rf=xe=>{if(Nt(!0),vr(xe.target.value),Qe.otherAtlases=xe.target.value,be.current){const Le=be.current.getObjectByName("outline");Le&&be.current.remove(Le)}xe.target.value=="CCF"&&a2({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Lr),xe.target.value=="WHS"&&a2({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Lr),Nt(!1)},$F=xe=>{if(an(xe.target.value),xe.target.value===2){j.current="automatic",R(!0),F.current=!0,K(2),m.current.length>=2&&(m.current.pop(),C.current.pop());const Le=be.current.getObjectByName("dashedLine"),Ne=be.current.getObjectByName("sphereBig"),Ze=be.current.getObjectByName("sphereMiddelClick"),kt=be.current.getObjectByName("Line");Le&&Ne&&be.current.remove(Le,Ne),Ze&&be.current.remove(Ze),kt&&be.current.remove(kt),Ob()}else j.current="manual",R(!1),F.current=!1,K(3),Ob();d&&(d.current=!0)},VM=xe=>{if(xe>-1){let Le=JSON.parse(JSON.stringify(Ra.current)),Ne=Le[xe];Ne.startButtonLoading=!0,Ne.correspondingPlaneData={},$a(Le),Ra.current=Le;const Ze=new FormData;Ze.append("file",Ne.filename),Ze.append("typeName",Ne.radioValue.toString()),Ze.append("sec",Ne.sec.toString()),fetch("/app-api/up-api/calculate",{method:"post",body:Ze}).then(kt=>{if(kt.ok)return kt.json();{si.error({content:a("5000.7027")||"计算失败"});let Gt=JSON.parse(JSON.stringify(Ra.current));const Jt=Gt[xe];throw Jt.startButtonLoading=!1,Ra.current=Gt,$a(Gt),new Error(kt.statusText)}}).then(kt=>{const Gt=kt;let Jt=JSON.parse(JSON.stringify(Ra.current));const wn=Jt[xe];wn.correspondingPlaneData=Gt,wn.startButtonLoading=!1,Ra.current=Jt,$a(Jt)})}},S5=()=>{const xe=Na.findIndex(Le=>Le.key===Fr[0]);if(xe>-1){let Le=Na[xe];const Ne=document.createElement("a");Ne.href="/app-api/up-api/zip/"+Le.correspondingPlaneData.url,Ne.download=Le.correspondingPlaneData.url,Ne.click()}},$M=(xe,Le)=>{const Ne=Na.findIndex(Gt=>Gt.key===Fr[0]);let Ze=be.current.getObjectByName("Brain"),kt=null;if(Le){const Gt=be.current.getObjectByName(`png${Ne}`);Gt&&(kt=Gt.position,be.current.remove(Gt))}if(Ze&&Ne>-1){const Gt=be.current.getObjectByName(`png${Ne}`);if(Gt)We.current.dispose(),We.current.detach(),We.current.removeEventListener("dragging-changed",lp),We.current.removeEventListener("change",Ph),be.current.remove(Gt,We.current),document.removeEventListener("keypress",sg),Ra.current[Ne].registrationButton=a("5000.0004")||"显示结果",$a(JSON.parse(JSON.stringify(Ra.current)));else{let Jt=Na[Ne];const{correspondingPlaneData:wn,registrationRadioShowType:Vn,fileList:dr,fileList2:er}=Jt;let hr=new Qo(new Te(-5.102569427490234,-5.308416134996751,-6.995937196406743),new Te(5.113045654296875,2.006702558657828,6.9960598634766615)),ci=hr.max.y-hr.min.y,ma=hr.max.x-hr.min.x,lr=hr.max.z-hr.min.z,vi=1,Yr=1;if(Jt.sec===0)vi=ma,Yr=ci,Yr=Yr/Math.cos(wn.angles[0]*Math.PI/180),vi=vi/Math.cos(wn.angles[1]*Math.PI/180);else if(Jt.sec===1){vi=lr,Yr=ci;const so=Math.abs(wn.angles[1]),Ws=Math.abs(wn.angles[2]-90);so<60&&(vi=vi/Math.cos(so*Math.PI/180)),Ws<60&&(Yr=Yr/Math.cos(Ws*Math.PI/180))}else if(Jt.sec===2){vi=ma,Yr=lr;const so=Math.abs(wn.angles[0]-90),Ws=Math.abs(wn.angles[2]);so<60&&(Yr=Yr/Math.cos(so*Math.PI/180)),Ws<60&&(vi=vi/Math.cos(Ws*Math.PI/180))}let Mr=new Q2(ma*2,lr*2,1,1),Yi=new Ns({side:Bc,transparent:!0});xe=="2"&&(Mr=new Q2(vi,Yr,1,1));let fi=new Wn(Mr,Yi);fi.name=`png${Ne}`;let xa=Vn;xe&&(xa=xe),fi.userData.imgType=xa,fi.userData.name="registrationPng",fi.userData.yScale=lr/Yr*2;let Pi=new H1;Jt.sec===0?fi.position.set(hr.min.x+(hr.max.x-hr.min.x)/2,hr.min.y+(hr.max.y-hr.min.y)/2,(hr.max.z-hr.min.z)*wn.tx+hr.min.z):Jt.sec===1?fi.position.set(hr.min.x+(hr.max.x-hr.min.x)*wn.tx,hr.min.y+(hr.max.y-hr.min.y)/2,(hr.max.z-hr.min.z)/2+hr.min.z):Jt.sec===2&&fi.position.set(hr.min.x+(hr.max.x-hr.min.x)/2,hr.min.y+(hr.max.y-hr.min.y)*wn.tx,(hr.max.z-hr.min.z)/2+hr.min.z),kt&&fi.position.copy(kt),Pi.load(xa==="3"?er[0].url:xa==="1"?wn.base64_url:dr[0].url,function(so){Yi.map=so,Yi.needsUpdate=!0}),fi.rotateOnAxis(new Te(0,0,1),Math.PI),fi.rotateOnAxis(new Te(1,0,0),Math.PI/180*-wn.angles[0]),fi.rotateOnAxis(new Te(0,1,0),Math.PI/180*wn.angles[2]),fi.rotateOnAxis(new Te(0,0,1),Math.PI/180*wn.angles[1]),xe!="1"&&(k.current?fi.scale.x=-1:fi.scale.x=1),We.current.dispose(),We.current.removeEventListener("dragging-changed",lp),We.current.removeEventListener("change",Ph),be.current.remove(We.current),We.current=new i2(ui.current,f==null?void 0:f.domElement),We.current.setMode("translate"),We.current.enabled=!0,We.current.visible=!0,We.current.name="transformControls",We.current.attach(fi),We.current.space="local",be.current.add(fi,We.current),document.removeEventListener("keypress",sg),document.addEventListener("keypress",sg),We.current.addEventListener("dragging-changed",lp),We.current.addEventListener("change",Ph),Ra.current[Ne].registrationButton=a("5000.8215")||"隐藏结果",$a(JSON.parse(JSON.stringify(Ra.current)))}}},dy=()=>{const xe=new Ps(1,1,1),Le=new Ns({color:16777215,opacity:.1,transparent:!0,depthWrite:!1}),Ne=new Wn(xe,Le);be.current.remove(Tt.current,Hn.current,Er.current),Tt.current=Ne.clone(),Er.current=new Wn;const Ze=new yT(xe),kt=new Ll({color:16536881}),Gt=new R2(Ze,kt);Hn.current=Gt},fw=()=>{const xe=a("5000.0006")||"显示数据块";if(Jr===xe){ti(a("5000.0007")||"隐藏数据块"),We.current=new i2(ui.current,f==null?void 0:f.domElement),We.current.setMode("translate"),We.current.enabled=!0,We.current.visible=!0,We.current.name="transformControls",We.current.attach(Tt.current),be.current.add(Tt.current,We.current,Hn.current),GM(),document.addEventListener("keypress",pw);const Le=new Qo;Le.expandByObject(Tt.current);const Ne=M.current(Le.min.clone()),Ze=M.current(Le.max.clone());let kt=new zh(dm(650,620,`${Ne.x.toFixed(2)},${Ne.y.toFixed(2)},${Ne.z.toFixed(2)}`,"#ccc")),Gt=new hh(new Hf({map:kt}));Gt.name="startText";let Jt=new zh(dm(650,620,`${Ze.x.toFixed(2)},${Ze.y.toFixed(2)},${Ze.z.toFixed(2)}`,"#ccc")),wn=new hh(new Hf({map:Jt}));wn.name="endText",Gt.position.set(Le.min.x,Le.min.y+.2,Le.min.z),wn.position.set(Le.max.x,Le.max.y+.6,Le.max.z);const Vn=be.current.getObjectByName("startText"),dr=be.current.getObjectByName("endText");Vn&&dr&&be.current.remove(Vn,dr),be.current.add(Er.current,Gt,wn)}else{document.removeEventListener("keypress",pw),ti(a("5000.0006")||"显示数据块"),We.current.enabled=!1,We.current.visible=!1,We.current.detach();const Le=be.current.getObjectByName("startText"),Ne=be.current.getObjectByName("endText");Le&&Ne&&be.current.remove(Le,Ne),We.current.dispose(),be.current.remove(We.current),be.current.remove(Tt.current,Hn.current,Er.current)}},dm=(xe,Le,Ne,Ze)=>{var kt=document.createElement("canvas");kt.width=xe,kt.height=Le,kt.style.border="1px solid #000";let Gt=kt.getContext("2d");return Gt.font="80px Arial",Gt.fillStyle=Ze,Gt.fillText(Ne,40,80),kt},fy=(xe,Le,Ne)=>{const Ze=xe[0].width/Le.owidth,kt=xe[0].height/Le.oheight,Gt=Ne/Le.odepth,Jt=Math.ceil(Le.bwidth*Ze),wn=Math.ceil(Le.bheight*kt),Vn=Math.ceil(Le.bdepth*Gt),dr=Math.floor(Le.ewidth*Ze),er=Math.floor(Le.eheight*kt),hr=Math.floor(Le.edepth*Gt),ci=dr-Jt,ma=er-wn,lr=new wQ(null,ci,ma,hr-Vn);lr.format=yf,lr.minFilter=Vo,lr.magFilter=Vo,lr.unpackAlignment=1,lr.needsUpdate=!0;const vi=f.getContext();f.initTexture(lr);const Yr=f.properties.get(lr).__webglTexture;vi.bindBuffer(vi.PIXEL_UNPACK_BUFFER,null),vi.bindTexture(vi.TEXTURE_3D,Yr);for(let Yi=0;Yi<xe.length;Yi++){let fi=[];if(Yi>=Vn&&Yi<hr){for(let Pi=0;Pi<xe[Yi].data.length;Pi++){let so=Pi%xe[Yi].width,Ws=Pi/xe[Yi].width;Jt<=so&&so<dr&&Ws>=wn&&Ws<er&&fi.push(xe[Yi].data[Pi])}const xa=new Uint8Array(fi);vi.bindTexture(vi.TEXTURE_3D,Yr),vi.bindBuffer(vi.PIXEL_UNPACK_BUFFER,null),vi.bindBuffer(vi.ARRAY_BUFFER,null),vi.texSubImage3D(vi.TEXTURE_3D,0,0,0,Yi-Vn,ci,ma,1,vi.RED,vi.UNSIGNED_BYTE,xa)}}zt.current=lr,w.current=new Kf({glslVersion:Fd,uniforms:{map:{value:zt.current},cameraPos:{value:ui.current.position},volume_dims:{value:new Te(ci,ma,Ne)},canvas_dims:{value:new Tr(f.domElement.width,f.domElement.height)},isClicked:{value:0},steps:{value:Ne},brightness:{value:ic.current.brightness},darkness:{value:ic.current.darkness},opacity:{value:ic.current.opacity},opacity2:{value:ic.current.opacity2},lowcolor:{value:new Te(ic.current.color.r/255,ic.current.color.g/255,ic.current.color.b/255)},highcolor:{value:new Te(ic.current.color2.r/255,ic.current.color2.g/255,ic.current.color2.b/255)}},side:Bd,vertexShader:rQt,fragmentShader:iQt}),be.current.remove(Er.current);const Mr=new Ps(1,1,1);Er.current=new Wn(Mr,w.current),Er.current.applyMatrix4(Tt.current.matrixWorld),Er.current.scale.set(Tt.current.scale.x,Tt.current.scale.y,Tt.current.scale.z),Er.current.position.set(Tt.current.position.x,Tt.current.position.y,Tt.current.position.z),be.current.add(Er.current),Nt(Yi=>!Yi)},Ob=()=>{const xe=[];be.current.traverse(Le=>{(Le.name==="lineName"||Le.name==="sitetext")&&xe.push(Le)}),xe.forEach(Le=>{be.current.remove(Le)})},zF=()=>{const xe=new Qo;xe.expandByObject(Tt.current);const Le=be.current.getObjectByName("Brain");if(Le){Nt(Vn=>!Vn);var Ne=new fo;Ne.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const Ze=(Le==null?void 0:Le.children[0]).geometry.boundingBox.min,kt=(Le==null?void 0:Le.children[0]).geometry.boundingBox.max,Gt=xe.min.clone().applyMatrix4(Le.matrixWorld.clone().invert()).applyQuaternion(Ne),Jt=xe.max.clone().applyMatrix4(Le.matrixWorld.clone().invert()).applyQuaternion(Ne),wn={bwidth:Gt.x-Ze.x,bheight:Gt.y-Ze.y,bdepth:Gt.z-Ze.z,ewidth:Jt.x-Ze.x,eheight:Jt.y-Ze.y,edepth:Jt.z-Ze.z,owidth:kt.x-Ze.x,oheight:kt.y-Ze.y,odepth:kt.z-Ze.z};Yn.current.length===0?fetch(n+"/data/TIFF/1-0.5_0.tif").then(Vn=>Vn.arrayBuffer()).then(Vn=>{const dr=new Uint8Array(Vn);let er=QG(dr),hr=r2e(dr);Yn.current=er,fy(er,wn,hr)}):setTimeout(()=>{fy(Yn.current,wn,Yn.current.length)},200)}},HF=xe=>{fetch(xe).then(Le=>Le.text()).then(Le=>{const Ne=[0,0,0,0,0,0];let Ze=new FXt(Le,xe||"",Ne,void 0,void 0,3,Ne);const kt=new iU({color:65280,side:Bc});let Gt=new jo;for(let Jt=0;Jt<Ze.branches.length;Jt++){let wn=Ze.branches[Jt],Vn=[];for(let hr=wn.start;hr<wn.start+wn.count;hr++){let ci=Ze.indices[hr],ma=Ze.points[3*ci],lr=Ze.points[3*ci+1],vi=Ze.points[3*ci+2];Vn.push(new Te(ma,lr,vi))}const dr=new Mi().setFromPoints(Vn);let er=new fa(dr,kt);Gt.add(er)}Gt.scale.set(Sr.current,Sr.current,Sr.current),Gt.position.set(na.current,Ki.current,ra.current),Gt.name="swcUrlDataLine",be.current.add(Gt)})},zM=()=>{new Qo().expandByObject(Tt.current);const Le=be.current.getObjectByName("Brain");if(!ybe||!LR)return;const Ne=JSON.parse(ybe);if(Le){Nt(dr=>!dr);const Ze=Ne.min,kt=Ne.max,Gt=Ne.max_resample,Jt={bwidth:Ze.x,bheight:Ze.y,bdepth:Ze.z,ewidth:Gt.x,eheight:Gt.y,edepth:Gt.z,owidth:Gt.x-Ze.x,oheight:Gt.y-Ze.y,odepth:Gt.z-Ze.z},wn={x:(kt.x-Ze.x)*Sr.current,y:(kt.y-Ze.y)*Sr.current,z:(kt.z-Ze.z)*Sr.current},Vn={x:((kt.x-Ze.x)/2+Ze.x)*Sr.current+na.current,y:((kt.y-Ze.y)/2+Ze.y)*Sr.current+Ki.current,z:((kt.z-Ze.z)/2+Ze.z)*Sr.current+ra.current};Tt.current.scale.set(wn.x,wn.y,wn.z),Tt.current.position.set(Vn.x,Vn.y,Vn.z),Yn.current.length===0?fetch(LR).then(dr=>dr.arrayBuffer()).then(async dr=>{try{const er=await lD(dr),hr=await er.getImageCount(),ci=[];for(let lr=0;lr<hr;lr++){const vi=await er.getImage(lr),Yr=await vi.readRasters(),Mr=vi.getWidth(),Yi=vi.getHeight();ci.push({width:Mr,height:Yi,data:Yr[0]})}let ma=hr;Yn.current=ci,fy(Yn.current,Jt,ma)}catch(er){console.log("e",er)}}):setTimeout(()=>{fy(Yn.current,Jt,Yn.current.length)},200)}else setTimeout(()=>{zM()},1e3)};b.useEffect(()=>{Nl?Vs.current&&Vs.current.focus():yc.current&&yc.current.focus()},[Nl]);const hw=xe=>xe.map(Le=>({value:Le.name+" "+Le.fullname,title:b.createElement(Di,{placement:"right",title:Le.fullname},b.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},Le.name," ",Le.fullname)),children:Le.children?hw(Le.children):void 0})),_5=b.useMemo(()=>{const xe=new Qo;xe.expandByObject(Tt.current);const Le=be.current.getObjectByName("Brain");if(Le){var Ne=new fo;Ne.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const Ze=(Le==null?void 0:Le.children[0]).geometry.boundingBox.min,kt=xe.min.clone().applyMatrix4(Le.matrixWorld.clone().invert()).applyQuaternion(Ne),Gt=xe.max.clone().applyMatrix4(Le.matrixWorld.clone().invert()).applyQuaternion(Ne),Jt={bwidth:kt.x-Ze.x,bheight:kt.y-Ze.y,bdepth:kt.z-Ze.z,ewidth:Gt.x-Ze.x,eheight:Gt.y-Ze.y,edepth:Gt.z-Ze.z};Xa.current=Jt;const wn=(Jt.ewidth-Jt.bwidth)*11.1545988258317*(Jt.eheight-Jt.bheight)*12.31190150478796*(Jt.edepth-Jt.bdepth)*10;let Vn=0;switch(Rn){case 1:Vn=wn*.8;break;case 2:Vn=wn*.8/8;break;case 3:Vn=wn*.8/8/8;break;case 4:Vn=wn*.8/8/8/8;break;case 5:Vn=wn*.8/8/8/8/8;break;case 6:Vn=wn*.8/8/8/8/8/8;break}return Jr===(a("5000.0006")||"显示数据块")?"0KB":Vn>1024*1024*1024*1024?(Vn/(1024*1024*1024*1024)).toFixed(2)+"TB":Vn>1024*1024*1024?(Vn/(1024*1024*1024)).toFixed(2)+"GB":Vn>1024*1024&&Vn<1024*1024*1024?(Vn/(1024*1024)).toFixed(2)+"MB":Vn>1024&&Vn<1024*1024?(Vn/1024).toFixed(2)+"KB":Vn&&Vn<1024?Vn.toFixed(2)+"B":"0KB"}else return"0KB"},[vn,Jr]),HM=()=>{if(!Va.current){Ir(!0);return}const xe=new Qo;xe.expandByObject(Tt.current);const Le=be.current.getObjectByName("Brain");if(Le){var Ne=new fo;Ne.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const Ze=(Le==null?void 0:Le.children[0]).geometry.boundingBox.min,kt=(Le==null?void 0:Le.children[0]).geometry.boundingBox.max,Gt=xe.min.clone().applyMatrix4(Le.matrixWorld.clone().invert()).applyQuaternion(Ne),Jt=xe.max.clone().applyMatrix4(Le.matrixWorld.clone().invert()).applyQuaternion(Ne),wn={bwidth:Gt.x-Ze.x,bheight:Gt.y-Ze.y,bdepth:Gt.z-Ze.z,ewidth:Jt.x-Ze.x,eheight:Jt.y-Ze.y,edepth:Jt.z-Ze.z,owidth:kt.x-Ze.x,oheight:kt.y-Ze.y,odepth:kt.z-Ze.z,zoom:!1,level:Rn};Xa.current=wn;const Vn=(wn.ewidth-wn.bwidth)*11.1545988258317*(wn.eheight-wn.bheight)*12.31190150478796*(wn.edepth-wn.bdepth)*10;switch(Rn){case 1:if(Vn*.8>1024*1024*1024){ve(!0);return}break;case 2:if(Vn*.8/8>1024*1024*1024){ve(!0);return}break;case 3:if(Vn*.8/8/8>1024*1024*1024){ve(!0);return}break;case 4:if(Vn*.8/8/8/8>1024*1024*1024){ve(!0);return}break;case 5:if(Vn*.8/8/8/8/8>1024*1024*1024){ve(!0);return}break;case 6:if(Vn*.8/8/8/8/8/8>1024*1024*1024){ve(!0);return}break}Pa(!0),fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(wn)}).then(dr=>dr.json()).then(dr=>{Pb(dr)})}},Pb=xe=>{fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:xe})}).then(Le=>{const Ne=Le.headers.get("content-type");return Ne?Ne.includes("application/json")?Le.json():Ne.includes("application/octet-stream")?Le.arrayBuffer():(Ne.includes("text/html")||Ne.includes("text/plain")||Ne.includes("application/xml")||Ne.includes("text/xml"),Le.text()):Le.text()}).then(Le=>{if(typeof Le=="string")setTimeout(()=>{Pb(xe)},2e3);else{const Ne=document.createElement("a"),Ze=new Blob([Le]),kt=window.URL.createObjectURL(Ze);Ne.style.display="none",Ne.href=kt,Ne.download="temp.tiff",Ne.click(),window.URL.revokeObjectURL(kt),Pa(!1);let Gt=new URL(window.location.href),wn=new URLSearchParams(Gt.search).get("type");const Vn=window.location.origin+window.location.pathname+`?type=${wn}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Vn,time:0,key:_o.current})})}}).catch(Le=>{Pa(!1),si.error({title:a("5000.7026")||"请求超时,下载失败"})})},pw=b.useCallback(xe=>{xe.stopPropagation(),(xe.key==="a"||xe.key==="A")&&(We.current.getMode()==="translate"?We.current.setMode("scale"):We.current.setMode("translate"))},[]),sg=b.useCallback(xe=>{(xe.key==="r"||xe.key==="R")&&(We.current.getMode()==="translate"?We.current.setMode("rotate"):We.current.setMode("translate")),(xe.key==="z"||xe.key==="Z")&&(We.current.enabled=!We.current.enabled,We.current.visible=!We.current.visible)},[]),Ph=b.useCallback(()=>{let xe=be.current.getObjectByName("Brain"),Le=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),Ne=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(xe){const Gt=new Qo;Gt.expandByObject(xe.clone()),Le=Gt.min,Ne=Gt.max}const Ze=Na.findIndex(Gt=>Gt.key===La.current),kt=be.current.getObjectByName(`png${Ze}`);if(kt){const Gt=kt.position;Gt.x<Le.x&&kt.position.setX(Le.x),Gt.x>Ne.x&&kt.position.setX(Ne.x),Gt.y<Le.y&&kt.position.setY(Le.y),Gt.y>Ne.y&&kt.position.setY(Ne.y),Gt.z<Le.z&&kt.position.setZ(Le.z),Gt.z>Ne.z&&kt.position.setZ(Ne.z)}},[]),lp=b.useCallback(xe=>{if(xe.value)h.current.enableRotate=!1,h.current.enabled=!1,nc.current={target:h.current.target.clone(),position:h.current.object.position.clone(),up:h.current.object.up.clone(),enabled:h.current.enabled};else{h.current.enableRotate=!0,h.current.enabled=!0,h.current.reset(),h.current.target.copy(nc.current.target),h.current.object.position.copy(nc.current.position),h.current.object.up.copy(nc.current.up),h.current.update();const Le=Ra.current.findIndex(Ze=>Ze.key===Fr[0]),Ne=be.current.getObjectByName(`png${Le}`);if(Ne){const Ze=Ra.current.find(kt=>kt.key===Fr[0]);Ne.material.map=null,Ne.visible=!1,Oh(4,Ne,Ze==null?void 0:Ze.sec)}}},[Fr,Na]),GM=()=>{let Le=be.current.getObjectByName("Brain"),Ne=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),Ze=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(Le){const wn=new Qo;wn.expandByObject(Le.clone()),Ne=wn.min,Ze=wn.max}const kt=Ze.x-Ne.x,Gt=Ze.y-Ne.y,Jt=Ze.z-Ne.z;We.current.addEventListener("change",()=>{const wn=Tt.current.scale,Vn=Tt.current.position;wn.x<1&&Tt.current.scale.setX(1),wn.x>kt&&Tt.current.scale.setX(kt),wn.y<1&&Tt.current.scale.setY(1),wn.y>Gt&&Tt.current.scale.setY(Gt),wn.z<1&&Tt.current.scale.setZ(1),wn.z>Jt&&Tt.current.scale.setZ(Jt),Vn.x<Ne.x+Tt.current.scale.x/2&&Tt.current.position.setX(Ne.x+Tt.current.scale.x/2),Vn.x>Ze.x-Tt.current.scale.x/2&&Tt.current.position.setX(Ze.x-Tt.current.scale.x/2),Vn.y<Ne.y+Tt.current.scale.y/2&&Tt.current.position.setY(Ne.y+Tt.current.scale.y/2),Vn.y>Ze.y-Tt.current.scale.y/2&&Tt.current.position.setY(Ze.y-Tt.current.scale.y/2),Vn.z<Ne.z+Tt.current.scale.z/2&&Tt.current.position.setZ(Ne.z+Tt.current.scale.z/2),Vn.z>Ze.z-Tt.current.scale.z/2&&Tt.current.position.setZ(Ze.z-Tt.current.scale.z/2);const dr=Tt.current.geometry.clone();dr.scale(Tt.current.scale.x,Tt.current.scale.y,Tt.current.scale.z),dr.translate(Tt.current.position.x,Tt.current.position.y,Tt.current.position.z);const er=new yT(dr);Hn.current.geometry=er,on({})}),We.current.addEventListener("dragging-changed",function(wn){wn.value?(h.current.enableRotate=!1,h.current.enabled=!1,nc.current={target:h.current.target.clone(),position:h.current.object.position.clone(),up:h.current.object.up.clone(),enabled:h.current.enabled}):(h.current.enableRotate=!0,h.current.enabled=!0,h.current.reset(),h.current.target.copy(nc.current.target),h.current.object.position.copy(nc.current.position),h.current.object.up.copy(nc.current.up),h.current.update());const Vn=Tt.current.geometry.clone();Vn.scale(Tt.current.scale.x,Tt.current.scale.y,Tt.current.scale.z),Vn.translate(Tt.current.position.x,Tt.current.position.y,Tt.current.position.z);const dr=new yT(Vn);Hn.current.geometry=dr;const er=new Qo;er.expandByObject(Tt.current);const hr=M.current(er.min.clone()),ci=M.current(er.max.clone());let ma=new zh(dm(650,620,`${hr.x.toFixed(2)},${hr.y.toFixed(2)},${hr.z.toFixed(2)}`,"#ccc")),lr=new hh(new Hf({map:ma}));lr.name="startText";let vi=new zh(dm(650,620,`${ci.x.toFixed(2)},${ci.y.toFixed(2)},${ci.z.toFixed(2)}`,"#ccc")),Yr=new hh(new Hf({map:vi}));Yr.name="endText",lr.position.set(er.min.x,er.min.y+.2,er.min.z),Yr.position.set(er.max.x,er.max.y+.6,er.max.z);const Mr=be.current.getObjectByName("startText"),Yi=be.current.getObjectByName("endText");Mr&&Yi&&be.current.remove(Mr,Yi),be.current.add(Er.current,lr,Yr)})},hy=()=>{document.removeEventListener("keypress",pw),document.removeEventListener("keypress",sg),ti(a("5000.0006")||"显示数据块"),We.current.enabled=!1,We.current.visible=!1,We.current.detach(),We.current.dispose(),We.current.removeEventListener("dragging-changed",lp),We.current.removeEventListener("change",Ph),be.current.remove(We.current),be.current.remove(Tt.current,Hn.current,Er.current);const xe=be.current.getObjectByName("dashedLine");xe&&be.current.remove(xe);const Le=be.current.getObjectByName("startText"),Ne=be.current.getObjectByName("endText");Le&&Ne&&be.current.remove(Le,Ne)},E5=xe=>{aa(xe.target.value)},jM=b.useCallback(xe=>{ho.current=!0,As.current=[xe.x,xe.y],Ss.current=[xe.x,xe.y]},[]),T5=b.useCallback(xe=>{if(ho.current){const Le=[xe.x,xe.y],Ne=.005,Ze=Le[0]-As.current[0];Le[1]-As.current[1];const kt=Ze*Ne,Gt=new Te;Gt.copy(ui.current.position).sub(h.current.target);const Jt=new eCt().setFromVector3(Gt);Jt.theta+=kt,Jt.makeSafe(),Gt.setFromSpherical(Jt),ui.current.position.copy(h.current.target).add(Gt),ui.current.lookAt(h.current.target),As.current=[xe.x,xe.y]}},[]),WM=b.useCallback(xe=>{ho.current=!1;const Le=[xe.x,xe.y],Ne=Math.abs(Le[0]-Ss.current[0]),Ze=Math.abs(Le[1]-Ss.current[1]);Ne<2&&Ze<2?f.domElement.addEventListener("click",te.current):f.domElement.removeEventListener("click",te.current)},[]),XM=()=>{const xe="imgKey=",Le=document.cookie.split(";");let Ne="";for(let kt=0;kt<Le.length;kt++){let Gt=Le[kt];for(;Gt.charAt(0)===" ";)Gt=Gt.substring(1,Gt.length);Gt.indexOf(xe)===0&&(Ne=Gt.substring(xe.length,Gt.length))}if(!Ne){Js(!0);return}qt(!0),je(!1),Ei({});let Ze={taskType:Wa,moving_name:kn.current,key:Ne,swc_space:Ja,resolution:tg};fetch("/app-api/d-api/count",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ze)}).then(kt=>{if(kt.ok)return kt.json();{qt(!1);const Gt="imgKey=",Jt=document.cookie.split(";");let wn="";for(let Vn=0;Vn<Jt.length;Vn++){let dr=Jt[Vn];for(;dr.charAt(0)===" ";)dr=dr.substring(1,dr.length);dr.indexOf(Gt)===0&&(wn=dr.substring(Gt.length,dr.length))}return kt.json().then(Vn=>{throw je(!0),kt.status===401&&si.confirm({content:Vn.message,onOk(){fetch("/app-api/d-api/update_key",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:wn})}).then(dr=>dr.json())},onCancel(){}}),kt.status===429?si.error({content:a("5000.7029")||"请求过于频繁,请稍后再试"}):si.error({content:a("5000.7027")||"计算失败"}),new Error(Vn.message||kt.statusText)})}}).then(kt=>{kt.code===200&&Ei(kt),qt(!1)}).catch(kt=>{qt(!1),console.error(kt)}).finally(()=>{qt(!1)})},GF=()=>{const xe=document.createElement("a");Ma.file[0].split(".")[1]=="swc"?xe.href="/app-api/d-api/dowload/"+Ma.file[0].split(".")[0]+"_ori.swc":xe.href="/app-api/d-api/dowload/"+Ma.file[0],xe.download=Ma.file[0],xe.click()},jF=xe=>{U&&U(xe),Qe.datumMarkVisibility=xe},WF=xe=>{ef(xe),Qe.coordinateVisibility=xe,xe?B&&B.current.forEach(Le=>{Le.visible=!0}):B&&B.current.forEach(Le=>{Le.visible=!1})},XF=()=>{vu(!1)},ZF=()=>{vu(!1)},I5=xe=>{if(sa(xe),Qe.leftHemisphereVisibility=xe,xe){for(let Le in Ga.current)Ga.current[Le]&&T.includes(Le)&&be.current.add(Ga.current[Le]);V0.current=!0}else{for(let Le in Ga.current)Ga.current[Le]&&be.current.remove(Ga.current[Le]);V0.current=!1}},_d=xe=>{if(Qe.cranialVisibility=xe,Qc({}),xe)a2({filepath:n+"/data/FBX/ExtractedSurface.FBX",index:"ExtractedSurface",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Lr);else if(be.current){const Le=be.current.getObjectByName("ExtractedSurface");Le&&be.current.remove(Le)}},Ed=()=>{if(ga(!0),Nt(!0),D){const xe={flag:V0.current,point:[D.current.x,D.current.y,D.current.z],fbx:Q.current};fetch("/app-api/c-api/compute",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(xe)}).then(Le=>{if(Le.ok)return Le.json();throw ga(!1),Nt(!1),si.error({content:a("5000.7028")||"没有合适的路径"}),new Error(Le.statusText)}).then(Le=>{ga(!1),Nt(!1),Le.code===200&&N?N(new Te(Le.point[0],Le.point[1],Le.point[2])):si.error({content:a("5000.7027")||"计算失败"})})}},Nh=xe=>{xe!=null&&(Es(xe),(xe===""||xe.includes(" "))&&Ae(xe))},Nb=(xe,Le)=>{let Ne=0;for(const Ze of xe.toLowerCase())if(Ze===Le[Ne]&&(Ne++,Ne===Le.length))return!0;return!1},ZM=xe=>{if(xe){const Le=xe.toLowerCase(),Ne=de.current.defAllexpandedKeys.current.map(Ze=>{const kt=Ze.name&&Ze.name.toLowerCase()===Le,Gt=Ze.fullname&&Nb(Ze.fullname,Le);return{...Ze,matchPriority:kt?1:Gt?2:3}}).filter(Ze=>Ze.matchPriority<3).sort((Ze,kt)=>Ze.matchPriority-kt.matchPriority).map(Ze=>({value:`${Ze.name} ${Ze.fullname}`,label:`${Ze.name} ${Ze.fullname}`}));ca(Ne)}else ca([])},KM=xe=>{const Le=new URLSearchParams;for(const Ne in xe)Le.append(Ne,xe[Ne]);gt==3||gt==5?Le.append("aplType","2"):Le.append("aplType","1"),fetch("/app-api/java-api/brainsweb-service/apldetail/add",{method:"post",body:Le}).then(Ne=>{if(Ne.ok)return Ne.json();throw si.error({content:a("5000.5047")||"提交失败"}),new Error(Ne.statusText)}).then(Ne=>{Ne.code==1?Pr.error("Repeat Email"):Pr.success(a("5000.5048")||"提交成功"),Js(!1),Qs(0)})},A5=xe=>{console.log("Failed:",xe)},YM=async xe=>{let Le="";xe==="DAPI"?Le="/staticresource/data/TIFF/image_356_t.tif":xe==="PI"&&(Le="/staticresource/data/TIFF/image_570_t.tif");try{const Ne=Le.split("/").pop()||"",kt=await(await fetch(Le)).blob(),Gt=new File([kt],Ne,{type:"image/tiff"}),Jt=Na.findIndex(hr=>hr.key===Fr[0]);let Vn=await new Promise(hr=>{const ci=new FileReader;ci.readAsArrayBuffer(kt),ci.onload=function(ma){var lr,vi;if((lr=ma.target)!=null&&lr.result){const Yr=new Uint8Array((vi=ma.target)==null?void 0:vi.result);let Mr=QG(Yr);const{width:Yi,height:fi}=Mr[0];hr({width:Yi,height:fi})}},ci.onerror=function(ma){console.error("failed")}});const{width:dr,height:er}=Vn;if(Jt>-1){let hr=JSON.parse(JSON.stringify(Na)),ci=hr[Jt];ci.fileList=[Gt],ci.firstRegistrationImg={width:dr,height:er},$a(hr),Ra.current=hr}b5({file:Gt})}catch(Ne){console.error("Error fetching file:",Ne)}},M5=async xe=>{let Le="",Ne="";xe==="3D"?(Le="/staticresource/data/TIFF/test.tif",Ne="image/tiff"):xe==="swc"&&(Le="/staticresource/data/TIFF/fixed.swc",Ne="file/swc");try{const kt=await(await fetch(Le)).blob();let Gt=Le.split("/").pop();if(Gt){const Jt=new File([kt],Gt,{type:Ne});wi([Jt]),UM({file:Jt})}}catch(Ze){console.error("Error fetching file:",Ze)}};return b.createElement(b.Fragment,null,b.createElement("div",{className:"outBox",style:{right:`${ln?st?865:430:st?585:150}px`},onClick:()=>{const xe=document.querySelector(".tabsCompnent>.ant-tabs-content-holder");xe&&ln?(xe.style.padding="0px",xe.style.borderLeft="none"):(gt!=12&&(xe.style.padding="10px"),xe.style.borderLeft="1px solid rgb(225, 218, 218)"),Mn(Le=>!Le)}},b.createElement("div",{className:"contractrightbox"},b.createElement("div",{className:"smallTriangle",style:{transform:`${ln?"rotate(180deg)":"rotate(0)"}`}}))),b.createElement(Ng,{className:"tabsCompnent",onChange:Uc,activeKey:gt.toString(),style:{position:"absolute",right:0,bottom:0,width:`${ln?"430px":"150px"}`,marginRight:st?435:0,transition:"margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1)",height:_t.length!=12?"100%":"calc(100% - 42px)",userSelect:"none",borderTop:"1px solid rgb(225, 218, 218)",zIndex:100},tabPosition:"right",tabBarStyle:{width:150,background:"#fff",borderLeft:"1px solid #e1dada"}},_t.includes("label")&&b.createElement(Ff,{tab:a("4000.0202")||"组装",key:"1",disabled:G===2},ln?b.createElement(b.Fragment,null,b.createElement("div",{style:{width:"200px",height:"100px"}},b.createElement(Ha,{ref:St},b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:10},a("4000.0205")||"长度",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:1,max:10,onChange:f5}))))):null),_t.includes("virtual")&&b.createElement(Ff,{tab:a("4000.0203")||"病毒标记",key:"2",disabled:G===1||G===0},b.createElement("div",{style:{backgroundColor:"rgba(255,255,255,0.6)",borderRadius:"5px",marginTop:"5px",display:ln?"block":"none"}},b.createElement("div",null,b.createElement(vh,null,b.createElement(ri,{disabled:!(C.current.length>0),className:"ant-btn ant-btn-primary",onClick:h5},yt),b.createElement(ri,{disabled:!(C.current.length>0),color:"danger",variant:"outlined",onClick:xe=>{an(1),R(!1),F.current=!1,j.current="manual",bn(a("4000.0242")||"清除靶点"),H(!1),ac(),K(1),et(1),w0.current&&(w0.current.abort(),w0.current=null)}},a("4000.0126")||"重置")),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(vh,{style:{display:`${z?"block":"none"}`}},a("5000.7046")||"路径规划模式:",b.createElement("span",{style:{fontStyle:"italic"}},a("5000.7049")||"Default mode is manual; You can switch to Auto mode to perform intelligent planning"),b.createElement(ta.Group,{onChange:$F,value:Tn,ref:ct},b.createElement(ta,{value:1},a("5000.5035")||"手动"),b.createElement(ta,{value:2},a("5000.5034")||"自动"))),z?b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}):null,Tn===2&&C.current&&C.current.length!=0?b.createElement(ri,{className:"ant-btn ant-btn-primary",loading:_r,disabled:!(Q.current.length>0),onClick:Ed},a("5000.5017")||"计算"):null),a("5000.6039")||"平颅方位",":",b.createElement(ta.Group,{onChange:xe=>{if(Oe(xe.target.value),xe.target.value){if(be.current.rotation.set(-8.3/180*Math.PI,0,0),C.current[0]){const Le=be.current.getObjectByName("azimuth"),Ne=be.current.getObjectByName("azimuth_outline"),Ze=be.current.getObjectByName("azimuth_edge"),kt=new wl(-8.3/180*Math.PI,0,0),Gt=C.current[0].clone().applyEuler(kt);Ze&&be.current.remove(Ze),Le&&be.current.remove(Le),Ne&&(be.current.remove(Ne),Xe==2?Lf("cor",Gt.z):Xe==3&&Lf("sag",Gt.x))}}else{be.current.rotation.set(0,0,0);const Le=new wl(0,0,0);if(C.current[0]){const Ne=C.current[0].clone().applyEuler(Le),Ze=be.current.getObjectByName("azimuth"),kt=be.current.getObjectByName("azimuth_outline"),Gt=be.current.getObjectByName("azimuth_edge");Gt&&be.current.remove(Gt),Ze&&be.current.remove(Ze),kt&&(be.current.remove(kt),Xe==2?Lf("cor",Ne.z):Xe==3&&Lf("sag",Ne.x))}}},style:{marginLeft:6},value:Ue},b.createElement(ta,{value:0},a("5000.6042")||"关闭"),b.createElement(ta,{value:1},a("5000.6043")||"启用")),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),z&&b.createElement(b.Fragment,null,a("5000.7047")||"路径限制",": ",b.createElement(ta.Group,{value:Xe,onChange:xe=>{et(xe.target.value);const Le=new wl(be.current.rotation.x,be.current.rotation.y,be.current.rotation.z),Ne=C.current[0].clone().applyEuler(Le);if(xe.target.value==2)Lf("cor",Ne.z);else if(xe.target.value==3)Lf("sag",Ne.x);else{const Ze=be.current.getObjectByName("azimuth"),kt=be.current.getObjectByName("azimuth_outline"),Gt=be.current.getObjectByName("azimuth_edge");Gt&&be.current.remove(Gt),Ze&&be.current.remove(Ze),kt&&be.current.remove(kt)}}},b.createElement(ta,{value:1},a("5000.7048")||"任意角度"),b.createElement(ta,{value:2},a("4000.0103")||"冠状面"),b.createElement(ta,{value:3},a("4000.0104")||"矢状面")),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})),b.createElement("div",{dangerouslySetInnerHTML:{__html:u}}))),_t.includes("reslicing")&&b.createElement(Ff,{tab:a("4000.0204")||"图谱切面",key:"3",disabled:G===2||G===0},ln?b.createElement(b.Fragment,null,b.createElement("div",{style:{width:"276px"}},b.createElement(Ha,null,a("7000.7024")||"控制模式",":  ",b.createElement(ta.Group,{value:Hu,onChange:xe=>{xe.target.value==0?We.current.setMode("translate"):We.current.setMode("rotate"),Pc(xe.target.value)}},b.createElement(ta,{value:0},a("7000.7022")||"平移"),b.createElement(ta,{value:1,disabled:fl!=4},a("7000.7023")||"旋转")),b.createElement("span",{style:{fontStyle:"italic"}},a("5000.0019")||"提示:按R键进入旋转模式")),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,null,a("7000.7021")||"重切片模式",":",b.createElement("br",null),b.createElement(ta.Group,{value:fl.toString(),onChange:xe=>Rf(Number(xe.target.value))},b.createElement(ta.Button,{value:"1",style:{padding:"0 5px"}},"Coronal"),b.createElement(ta.Button,{value:"2",style:{padding:"0 5px"}},"Sagittal"),b.createElement(ta.Button,{value:"3",style:{padding:"0 5px"}},"Horizontal"),b.createElement(ta.Button,{value:"4",style:{padding:"0 5px"}},"Arbitrary"))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0210")||"平移-X",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:-5.17,max:5.17,onChange:OM,step:.01,value:xn,disabled:En}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0211")||"平移-Y",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:-5.33,max:2.04,onChange:Uv,step:.01,value:tn,disabled:pn}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0212")||"平移-Z",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:-7,max:7,onChange:p5,step:.01,value:yn,disabled:rr}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0213")||"角度-X",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:0,max:360,step:1,value:Cn,onChange:xe=>dd(xe,1),disabled:Dr}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0214")||"角度-Y",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:0,max:360,step:1,value:Qt,onChange:xe=>dd(xe,2),disabled:Dr}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0215")||"角度-Z",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:0,max:360,step:1,value:Bt,onChange:xe=>dd(xe,3),disabled:Dr})))),b.createElement(ri,{style:{marginTop:20,marginLeft:10},type:"primary",disabled:On,onClick:()=>Wp()},"Download current slice"),b.createElement(ri,{style:{marginTop:20},type:"primary",disabled:On,onClick:()=>nf()},a("7000.0107")||"查看更高分辨率的图像"),b.createElement(Ni,{style:{margin:"10px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement("div",null,b.createElement("i",null,a("5000.6008")||"点击下方按钮,申请下载各向同性10微米分辨率的STAM图谱3D标签图像")),b.createElement(ri,{style:{marginTop:20},type:"primary",onClick:()=>{sy()}},a("5000.6009")||"请求STAM标签"),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),_t.includes("registration")&&b.createElement(Ff,{tab:a("5000.0001")||"脑片配准",key:"4",disabled:G===2||G===0},ln?b.createElement("div",{style:{maxHeight:"calc(100vh - 60px)",overflowY:"auto",overflowX:"hidden"}},b.createElement("div",{style:{fontStyle:"italic"}},a("5000.8214")||"Tips: 按下 'R' 键切换平移和旋转模式,按 'Z' 键显示隐藏控制器"),Xn.map((xe,Le)=>b.createElement(b.Fragment,null,b.createElement(f6.CheckableTag,{key:xe,checked:Fr.includes(xe),onChange:()=>{Ji([xe]),La.current=xe;const Ne=Na.findIndex(Ze=>Ze.key===xe);if(Ne>-1){const Ze=be.current.getObjectByName(`png${Ne}`);Ze&&(We.current.dispose(),We.current.detach(),We.current.removeEventListener("dragging-changed",lp),We.current.removeEventListener("change",Ph),be.current.remove(We.current),We.current=new i2(ui.current,f==null?void 0:f.domElement),We.current.setMode("translate"),We.current.enabled=!0,We.current.visible=!0,We.current.name="transformControls",We.current.attach(Ze),be.current.add(We.current),We.current.addEventListener("dragging-changed",lp),We.current.addEventListener("change",Ph),document.removeEventListener("keypress",sg),document.addEventListener("keypress",sg))}}},xe))),Xn.length<10?b.createElement(f6,{icon:b.createElement(M_,null),onClick:()=>{wr(xe=>[...xe,`Task${Xn.length+1}`]),$a(xe=>[...xe,{key:`Task${Xn.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0,registrationButton:a("5000.0004")||"显示结果"}]),Ra.current=[...Ra.current,{key:`Task${Xn.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0,registrationButton:a("5000.0004")||"显示结果"}]}},"New task"):null,Na.map((xe,Le)=>{if(xe.key===Fr[0]){const{key:Ne,fileList:Ze,fileList2:kt,correspondingPlaneData:Gt,registrationRadioShowType:Jt,startButtonLoading:wn,sec:Vn}=xe;return b.createElement("div",{key:Ne},b.createElement(Ha,null,b.createElement(ta.Group,{value:Vn,onChange:dr=>{const er=Na.findIndex(hr=>hr.key===Fr[0]);if(er>-1){let hr=JSON.parse(JSON.stringify(Na)),ci=hr[er];ci.sec=dr.target.value,$a(hr),Ra.current=hr}}},b.createElement(ta,{value:0,style:{padding:"2px 2px 0 0"}},a("4000.0103")||"冠状面"),b.createElement(ta,{value:1,style:{padding:"2px 2px 0 0"}},a("4000.0104")||"矢状面"),b.createElement(ta,{value:2,style:{padding:"2px 2px 0 0"}},a("4000.0105")||"水平面"))),b.createElement(Ha,null,b.createElement(Qi,null,b.createElement("p",null,b.createElement("span",null,a("5000.6033")||"Upload slice, or use the test "),b.createElement("a",{onClick:()=>{YM("DAPI")}},"DAPI "),"&",b.createElement("a",{onClick:()=>{YM("PI")}}," PI "),a("5000.6034")||"slices:"))),b.createElement(Ha,null,b.createElement(Qi,null,b.createElement(xC,{accept:"image/tiff",listType:"picture-card",fileList:Ze,onPreview:Rb,customRequest:b5,beforeUpload:dr=>x5(dr),onRemove:()=>{const dr=Na.findIndex(er=>er.key===Fr[0]);if(dr>-1){let er=JSON.parse(JSON.stringify(Na)),hr=er[dr];hr.fileList=[],$a(er),Ra.current=er}}},b.createElement("button",{style:{border:0,background:"none"},type:"button"},b.createElement(M_,null),b.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,null,b.createElement("p",null,b.createElement("span",null,a("5000.7000")||"(可选) 上传第二张脑片图像,默认该图像已经配准到了第一张上传的脑片图像上")))),b.createElement(Ha,null,b.createElement(Qi,null,b.createElement(xC,{accept:"image/tiff",listType:"picture-card",fileList:kt,onPreview:Rb,customRequest:dr=>b5(dr,2),beforeUpload:dr=>x5(dr,2),onRemove:()=>{const dr=Na.findIndex(er=>er.key===Fr[0]);if(dr>-1){let er=JSON.parse(JSON.stringify(Na)),hr=er[dr];hr.fileList2=[],$a(er),Ra.current=er}}},b.createElement("button",{style:{border:0,background:"none"},type:"button"},b.createElement(M_,null),b.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,{style:{marginTop:5}},b.createElement(Qi,null,a("7000.0106")||"计算与上传图像对应的图谱切面",":")),b.createElement(Ha,{style:{marginTop:5}},b.createElement(Qi,null,b.createElement(ri,{loading:wn,disabled:Ze.length<1,onClick:()=>VM(Le)},a("7000.0108")||"开始计算"),b.createElement(ri,{onClick:S5,disabled:!Gt.url},a("7000.0109")||"下载保存"))),b.createElement(Ha,{style:{marginTop:5}},Gt.base64_url&&b.createElement(lT,{src:Gt.base64_url,width:100})),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,{style:{marginTop:5}},b.createElement(ri,{onClick:()=>$M(Jt),disabled:!Gt.url},xe.registrationButton),b.createElement(Qi,{style:{display:"flex",alignItems:"center",marginLeft:5}})),b.createElement(Ha,null,b.createElement(ta.Group,{onChange:BM,value:Jt},b.createElement(ta,{value:"1"},a("5000.7001")||"atlas"),b.createElement(Ha,null,"slice:   ",b.createElement(Pp,{onChange:dr=>{k.current=dr.target.checked;const er=dr.target.checked?-1:1;be.current.traverse(hr=>{hr.userData.name==="registrationPng"&&hr.userData.imgType!=1&&hr.scale.set(er,1,1)})},disabled:Jt!="2"},a("5000.7013")||"左右翻转"),b.createElement("div",{style:{wordWrap:"break-word",width:200}},b.createElement(ta,{value:"2"},a("5000.7002")||"first"),kt.length<1?null:b.createElement(ta,{value:"3"},a("5000.7003")||"second"))))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}))}else return null})):null),_t.includes("download")&&b.createElement(Ff,{tab:a("5000.0005")||"数据下载",key:"5",disabled:G===2||G===0},ln?b.createElement(b.Fragment,null,b.createElement(Ha,null,b.createElement(Qi,null,a("5000.0009")||"提示:按A键切换平移和缩放模式")),b.createElement(Ha,null,b.createElement(Qi,null,b.createElement(ri,{onClick:fw},Jr))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,{style:{marginTop:5}},b.createElement(Qi,null,b.createElement(ri,{disabled:Jr===(a("5000.0006")||"选取下载范围"),onClick:zF},a("5000.0008")||"预览图像"))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,{style:{alignItems:"center"}},b.createElement(Qi,null,a("5000.0010")||"设置采样倍数",":"),b.createElement(Qi,{span:12},b.createElement(eo,{min:1,max:6,step:1,defaultValue:2,value:Rn,onChange:xe=>{Pn(xe),on({})},tooltip:{formatter:xe=>xe?Math.pow(2,xe-1):null}}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,null,b.createElement(ri,{loading:Ri,disabled:Jr===(a("5000.0006")||"选取下载范围"),onClick:HM},a("5000.0005")||"数据下载"))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,null,b.createElement(Qi,null,a("5000.5031")||"数据块大小:"),b.createElement(Qi,null,_5)),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),_t.includes("mapping")&&b.createElement(Ff,{tab:a("5000.5014")||"图谱映射",key:"6",disabled:G===2||G===0},ln?b.createElement(b.Fragment,null,b.createElement(Ha,null,b.createElement(Qi,null,b.createElement("p",null,a("5000.6035")||"Upload 3D image or swc file already mapped to STAM or CCF, otherwise use the test ",b.createElement("a",{onClick:()=>{M5("3D")}},a("5000.6036")||"3D image")," or ",b.createElement("a",{onClick:()=>{M5("swc")}},a("5000.6037")||"swc file:"))),b.createElement(Qi,null,b.createElement(xC,{listType:"picture-card",fileList:Qr,onPreview:Rb,customRequest:UM,beforeUpload:xe=>x5(xe,1),onRemove:()=>{wi([])}},b.createElement("button",{style:{border:0,background:"none"},type:"button"},b.createElement(M_,null),b.createElement("div",{style:{marginTop:8}},"Upload"))))),b.createElement(Ha,{style:{marginTop:5}},b.createElement(Qi,{span:12},b.createElement(eo,{min:1,max:100,onChange:xe=>{iy(xe)},disabled:!nh,value:typeof tg=="number"?tg:0})),b.createElement(Qi,{span:3},b.createElement(Zm,{min:1,max:100,style:{margin:"0 16px"},value:tg,disabled:!nh,onChange:xe=>{xe&&iy(xe)}}))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,{style:{marginTop:5}},b.createElement(Qi,null,a("5000.5015")||"选择转换方向",":"),b.createElement(Qi,null,b.createElement(Qi,null,b.createElement("span",{style:{fontSize:"13px",fontStyle:"italic"}},a("5000.7040")||"CCF的垂直方向尺寸已扩展到9mm"),b.createElement(ta.Group,{onChange:xe=>{So(xe.target.value)},value:Ja},b.createElement(ta,{value:"900"},a("5000.7041")||"YES"),b.createElement(ta,{value:"800"},a("5000.7042")||"NO"))),b.createElement(ta.Group,{onChange:E5,value:Wa},b.createElement(ta,{value:"applySTAM2CCF"},"STAM-",">","CCF"),b.createElement(ta,{value:"applyCCF2STAM"},"CCF-",">","STAM")))),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement(Ha,{style:{marginTop:5}},b.createElement(Qi,null,b.createElement(ri,{loading:Kn,disabled:!Sn,onClick:XM},a("7000.0108")||"开始计算"),b.createElement(ri,{onClick:GF,disabled:!Ma.file},a("7000.0109")||"下载保存"))),b.createElement(Ha,{style:{marginTop:5}},Ma.base64_url&&b.createElement(lT,{src:Ma.base64_url,width:100})),b.createElement(Ha,{style:{marginTop:5}},b.createElement(ri,{onClick:VF,disabled:!(Ma.file&&Ma.file[1])},a("5000.0004")||"显示结果")),b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),b.createElement("p",null,a("7000.7014")||"您也可以在此下载",b.createElement("a",{href:`${n}/data/Fiji.zip`},"Fji")," / ",b.createElement("a",{href:n+"/data/ImageJ.zip"},"ImageJ"),b.createElement("span",null,a("7000.7015")||"的插件;您可能需要使用测试数据,请"),b.createElement("a",{href:`${n}/data/test.zip`},a("7000.7016")||"在此"),b.createElement("span",null,a("7000.7017")||"下载"))):null),_t.includes("neurons")&&b.createElement(Ff,{tab:a("5000.5052")||"神经环路",key:"7",disabled:G===2||G===0},ln?b.createElement(b.Fragment,null,b.createElement("p",null,b.createElement("span",null,a("5000.6029")||"Navigate the "),b.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{vu(!0)}},a("5000.6030")||"whole-brain connectivity diagram"),b.createElement("span",null,a("5000.6031")||"consisting of single neuronal projections,or:")),Nl?b.createElement(uP,{ref:Vs,style:{width:"100%"},options:Oi,placeholder:a("5000.5053")||"Input the inquired structure",onSearch:ZM,onChange:Nh,value:Nl}):b.createElement(M2,{showSearch:!0,ref:yc,style:{width:"100%"},value:Nl,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:Nh,onSearch:Nh,treeData:hw(Ce)}),b.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},b.createElement("span",null,a("5000.6001")||"Input an inquired structure to visualize the connectivity map, for example, "),b.createElement("a",{onClick:v5("CP"),style:{textDecoration:"underline"}},"CP"),", ",b.createElement("a",{onClick:v5("PIR1"),style:{textDecoration:"underline"}},"PIR1"),", or ",b.createElement("a",{onClick:v5("Primary motor area, Layer 6a"),style:{textDecoration:"underline"}}," Primary motor area, Layer 6a")),Nl?b.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},b.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{const xe=[];xe.push(Nl),["Upstream","Downstream"].forEach(dr=>{xe.push(dr),xe.push("name,neurons"),Mf[dr].forEach(er=>{xe.push(`${er.name},"${er.value}"`)})});let Le=xe.join(`
5254
- `);const Ne=new Blob([Le],{type:"text/csv;charset=utf-8;"}),Ze=URL.createObjectURL(Ne),kt=document.createElement("a");kt.href=Ze,kt.download="neuronal_data.csv",kt.click(),URL.revokeObjectURL(Ze);let Gt=new URL(window.location.href),wn=new URLSearchParams(Gt.search).get("type");const Vn=window.location.origin+window.location.pathname+`?type=${wn}&download=queriedResults`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Vn,time:0})})}},a("5000.7030")||"Click here to download the queried results")):null,b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:280},dashed:!0}),b.createElement("div",{style:{width:"100%",height:"calc(100vh - 330px)",overflow:"scroll",paddingTop:"10px"}},b.createElement("div",{style:Rc?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},Rc&&b.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5054")||"Upstream"),b.createElement("div",{ref:xo,style:{width:"100%"}})),b.createElement("br",null),b.createElement("div",{style:Rc?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},Rc&&b.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5055")||"Downstream"),b.createElement("div",{ref:al,style:{width:"100%"}})))):null),_t.includes("neuronAnalysis")&&b.createElement(Ff,{tab:a("5000.7032")||"形态分析",key:"10",disabled:G===2||G===0},ln?b.createElement(b.Fragment,null,b.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},b.createElement(xC,{accept:".swc",fileList:ha,beforeUpload:xe=>(hl?(ha.forEach(Le=>{const Ne=Le.name.slice(0,Le.name.length-4)+".js";Ne in zr.current&&(be.current.remove(zr.current[Ne]),delete zr.current[Ne])}),Uo([xe]),Cu([]),th(""),Eb([])):Uo(Le=>[...Le,xe]),!1),multiple:!0,onRemove:xe=>{const Le=ha.find(Ne=>Ne.uid===xe.uid);if(Le){const Ne=Le.name.slice(0,Le.name.length-4)+".js";Ne in zr.current&&(be.current.remove(zr.current[Ne]),delete zr.current[Ne]),Cu(Ze=>Ze.filter(kt=>kt!==Le.name)),Eb(Ze=>Ze.filter(kt=>kt.key!==Le.name))}Uo(Ne=>Ne.filter(Ze=>Ze.uid!==xe.uid))}},b.createElement(ri,{icon:b.createElement(Xk,null)},"Upload")),b.createElement("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:10}},b.createElement("label",null,a("5000.8208")||"Resolution"),b.createElement(eo,{min:1,max:100,step:1,value:xi,onChange:zn,style:{flex:1}}),b.createElement(Zm,{min:1,max:100,value:xi,onChange:xe=>zn(xe),style:{width:60}})),b.createElement(ri,{loading:Br,disabled:ha.length<1,onClick:()=>{Ar(!0),console.log("swcFileList",ha);const xe=new FormData;for(let Le=0;Le<ha.length;Le++)xe.append("swcFile",ha[Le]);xe.append("resolution",xi.toString()),fetch("/app-api/neuron-reg/countAll",{method:"POST",body:xe}).then(Le=>{if(!Le.ok)throw si.error({content:a("5000.7027")||"计算失败"}),Ar(!1),Nt(!1),new Error("Network response was not ok");return Le.json()}).then(Le=>{th(Le.path),Ar(!1),Nt(!1),si.success({content:a("4000.0226")||"成功"})})}},a("7000.0108")||"开始计算")),hl&&ha.length>0&&b.createElement(b.Fragment,null,b.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},b.createElement(ri,{style:{marginTop:2,width:"100%"},type:"primary",disabled:hl=="",onClick:async()=>{const xe=`/app-api/neuron-reg/downloadswc/${hl}/processed_js_files.zip`;try{const Le=await fetch(xe,{method:"GET"});if(!Le.ok)throw new Error("下载失败");const Ne=await Le.blob(),Ze=window.URL.createObjectURL(Ne),kt=document.createElement("a");kt.href=Ze,kt.download="processed_js_files.zip",document.body.appendChild(kt),kt.click(),kt.remove(),window.URL.revokeObjectURL(Ze)}catch(Le){console.error("下载出错:",Le)}}},a("7000.0109")||"下载结果")),b.createElement(q2,{rowSelection:{selectedRowKeys:Dc,onChange:xe=>{const Le=Dc,Ne=xe;Cu(Ne);const Ze=Ne.filter(Gt=>!Le.includes(Gt)),kt=Le.filter(Gt=>!Ne.includes(Gt));Ze.forEach(Gt=>{const Jt=ig.find(wn=>wn.key===Gt);if(Jt){const wn=jp(Jt.path||Gt);w5(`/app-api/neuron-reg/downloadswc/${hl}/${wn}`,()=>{Nt(!1)})}}),kt.forEach(Gt=>{const Jt=ig.find(wn=>wn.key===Gt);if(Jt){const wn=jp(Jt.path||Gt);wn in zr.current&&be.current.remove(zr.current[wn])}})}},dataSource:ig.length>0?ig:ha.map(xe=>({key:xe.name,name:xe.name,path:jp(String(xe.name||"").replace(/\.swc$/i,".js")),color:"#045404",show:!1,url:""})),columns:[{title:"Name",dataIndex:"name"},{title:"Color",dataIndex:"Picker",width:60,render:(xe,Le)=>b.createElement(pd,{disabled:!Le.show,format:"rgb",defaultValue:Le.color})},{title:"Ana.",dataIndex:"Ana",align:"center",width:60,render:(xe,Le)=>{const Ne=jp(Le.path||Le.key);return b.createElement(Di,{placement:"right",title:a("5000.7008")||"分析"},b.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",onClick:()=>{fetch(`/app-api/neuron-reg/downloadswc/${hl}/${Ne}`).then(Ze=>Ze.json()).then(Ze=>{Hp(Ze),w5(`/app-api/neuron-reg/downloadswc/${hl}/${Ne}`,()=>{Dc.includes(Le.key)||(Cu([...Dc,Le.key]),console.log("[Ana] 已勾选:",Le.key)),DF(lr=>lr+1),zp({name:Ne.replace(/\.js$/i,""),color:"#045404"}),bc(!0),Nt(!1);const kt=tu.current;aw(["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_"].some(lr=>kt[lr])),Tb(["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","DG_d","DG_i","DG_V","SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"].some(lr=>kt[lr])),oy(["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"].some(lr=>kt[lr])),SM(["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"].some(lr=>kt[lr])),Za(["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"].some(lr=>kt[lr])),eu(["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"].some(lr=>kt[lr])),EM(["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"].some(lr=>kt[lr])),IM(["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"].some(lr=>kt[lr])),qo(["LING_","CENT2_","CUL4/5_","DEC_","FOTU_","PYR_","UVU_","NOD_","SIM_","ANcr1_","ANcr2_","PRM_","COPY_","PFL_","FL_","IP","DN","FN","VeCB"].some(lr=>kt[lr]))})}).catch(Ze=>console.error("加载swc数据失败:",Ze))}},b.createElement("g",{id:"#515151ff"},b.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"}),b.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"}),b.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"}),b.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"}))))}}],pagination:!1,size:"small",scroll:{y:300}}))):null),_t.includes("volumeAnalysis")&&b.createElement(Ff,{tab:a("5000.8211")||"Volume Analysis",key:"13",disabled:G===2||G===0},b.createElement(KNe,{renderer:f,t:a,fbxCenters:FM})),_t.includes("terminalAnalysis")&&b.createElement(Ff,{tab:a("5000.8227")||"末梢分析",key:"14",disabled:G===2||G===0},ln?b.createElement("div",{style:{maxHeight:"calc(100vh - 60px)",overflowY:"auto",overflowX:"hidden",paddingRight:6}},b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8229")||"特征类型",":"),b.createElement(Qi,{span:14},b.createElement(W2,{style:{width:"100%"},value:pc,onChange:xe=>Gc(xe),options:[{value:"intensity",label:a("5000.8230")||"投射强度 (intensity)"},{value:"branch",label:a("5000.8231")||"分支点 (branch)"},{value:"merge",label:a("5000.8232")||"融合 (merge)"}]}))),b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8233")||"聚类数",":"),b.createElement(Qi,{span:14},b.createElement(Zm,{min:1,max:50,value:ec,onChange:xe=>gc(xe||3),style:{width:"100%"}}))),pc==="merge"&&b.createElement(b.Fragment,null,b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8234")||"权重 1",":"),b.createElement(Qi,{span:14},b.createElement(Zm,{min:0,max:1,step:.1,value:hu,onChange:xe=>$u(xe||0),style:{width:"100%"}}))),b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8235")||"权重 2",":"),b.createElement(Qi,{span:14},b.createElement(Zm,{min:0,max:1,step:.1,value:jc,onChange:xe=>pu(xe||0),style:{width:"100%"}})))),b.createElement("div",{style:{fontStyle:"italic",fontSize:12,color:"#888",marginBottom:6}},a("5000.8237")||"使用当前加载的 SWC 神经元进行聚类。"),b.createElement(ri,{type:"primary",loading:Kd,onClick:async()=>{const xe=yM();if(xe.length===0){Pr.warning(a("5000.8238")||"请先加载至少一个 SWC 神经元");return}Wc(!0);try{const Le={neurons:xe,feature_type:pc,n_clusters:ec};pc==="merge"&&(Le.weight1=hu,Le.weight2=jc);const Ne=await fetch("/app-api/swc-chart-api/api/clustering",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le)});if(!Ne.ok){const Jt=await Ne.json().catch(()=>({detail:Ne.statusText}));throw new Error(Jt.detail||"请求失败")}const Ze=await Ne.json(),kt=Array.isArray(Ze.cluster_colors)?Ze.cluster_colors.map(Jt=>{const wn=Number(Jt.cluster_id);return{cluster_id:wn,cluster_name:Jt.cluster_name||`Cluster_${wn}`,color:pj(Jt.color,RR(wn))}}).filter(Jt=>Number.isFinite(Jt.cluster_id)):[],Gt={...Ze,cluster_colors:kt,soma_points:Array.isArray(Ze.soma_points)?Ze.soma_points:[],assignments:Array.isArray(Ze.assignments)?Ze.assignments:[]};Af(Gt),qd(kt),mu(kt.map(Jt=>Jt.cluster_id)),Zc(null),Xc(null),Yc(!1),ud(),Pr.success(a("5000.8240")||"聚类成功")}catch(Le){Pr.error(Le.message||"聚类失败")}finally{Wc(!1)}}},a("5000.8241")||"聚类分析"),Lc.length>0&&b.createElement("div",{style:{marginTop:10,border:"1px solid #e6e6e6",borderRadius:5,padding:8,background:"#fafafa"}},b.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8}},b.createElement("span",{style:{fontWeight:600}},a("5000.8262")||"聚类类别"),b.createElement(f6,{style:{marginInlineEnd:0}},a("5000.8264")||"已显示胞体点",": ",u5,"/",((L5=Sa==null?void 0:Sa.soma_points)==null?void 0:L5.length)||0," · ",a("5000.8268")||"唯一坐标",": ",kF)),b.createElement(q2,{rowKey:"cluster_id",dataSource:bM,pagination:!1,size:"small",rowSelection:{selectedRowKeys:kl,onChange:xe=>{mu(xe.map(Le=>Number(Le)).filter(Le=>Number.isFinite(Le))),Zc(null),Xc(null),Yc(!1),ud()}},columns:[{title:"Name",dataIndex:"cluster_name",key:"cluster_name",ellipsis:!0},{title:a("5000.8267")||"胞体点",dataIndex:"soma_count",key:"soma_count",width:78,align:"center"},{title:a("5000.8226")||"颜色",dataIndex:"color",key:"color",width:64,align:"center",render:(xe,Le)=>b.createElement(pd,{value:Le.color,size:"small",onChange:(Ne,Ze)=>xM(Le.cluster_id,Ne,Ze)})}]})),b.createElement(Ni,{style:{margin:"8px 0"},dashed:!0}),b.createElement("p",{style:{marginBottom:4}},a("5000.8228")||"选择目标核团:"),b.createElement(M2,{showSearch:!0,style:{width:"100%",marginBottom:8},value:el,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:xe=>{Hs(xe),Zc(null),Xc(null),Yc(!1),ud()},treeData:hw(Ce)}),b.createElement(vh,{wrap:!0},b.createElement(ri,{type:"primary",disabled:!(Sa!=null&&Sa.job_id)||!el||kl.length===0,loading:Yd,onClick:async()=>{if(!(Sa!=null&&Sa.job_id)){Pr.warning(a("5000.8242")||"请先进行聚类分析");return}if(!el){Pr.warning(a("5000.8243")||"请选择目标核团");return}const xe=CM();if(xe.length===0){Pr.warning(a("5000.8265")||"请至少选择一个聚类类别");return}ld(!0),Zc(null),Xc(null),Yc(!1),ud();try{const Le=await fetch("/app-api/swc-chart-api/api/soma-distribution",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_region:String(el).split(/\s+/)[0],cluster_ids:xe,job_id:Sa.job_id})});if(!Le.ok){const Ze=await Le.json().catch(()=>({detail:Le.statusText}));throw new Error(Ze.detail||"请求失败")}const Ne=await Le.json();Zc(Ne),Pr.success(a("5000.8250")||"胞体分析成功")}catch(Le){Pr.error(Le.message||a("5000.8251")||"胞体分析失败")}finally{ld(!1)}}},a("5000.8252")||"胞体分析"),Gl&&b.createElement(ri,{loading:gu,onClick:async()=>{if(!Gl){Pr.warning(a("5000.8253")||"请先完成胞体分析");return}if(Kc){ud(),Pr.success(a("5000.8257")||"已清除胞体渲染");return}Dl(!0);try{BF(),await wM(Gl),Pr.success(a("5000.8254")||"胞体分析结果已加载到场景")}catch(xe){Pr.error(xe.message||a("5000.8255")||"胞体结果渲染失败")}finally{Dl(!1)}}},Kc?a("5000.8258")||"清除数据":a("5000.8256")||"展示数据"),b.createElement(ri,{disabled:!(Sa!=null&&Sa.job_id)||!el||kl.length===0||!Gl,loading:If,onClick:async()=>{if(!(Sa!=null&&Sa.job_id)){Pr.warning(a("5000.8242")||"请先进行聚类分析");return}if(!el){Pr.warning(a("5000.8243")||"请选择目标核团");return}if(!Gl){Pr.warning(a("5000.8253")||"请先完成胞体分析");return}const xe=CM();if(xe.length===0){Pr.warning(a("5000.8265")||"请至少选择一个聚类类别");return}const Le=yM();if(Le.length===0){Pr.warning(a("5000.8238")||"请先加载至少一个 SWC 神经元");return}sd(!0),Xc(null);try{const Ne=await fetch("/app-api/swc-chart-api/api/terminal-distribution",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_region:String(el).split(/\s+/)[0],neurons:Le,cluster_ids:xe,base_url:`${window.location.origin}/staticresource/data/SWC/swc_foler`,use_right_half:!0,job_id:Sa.job_id})});if(!Ne.ok){const kt=await Ne.json().catch(()=>({detail:Ne.statusText}));throw new Error(kt.detail||"请求失败")}const Ze=await Ne.json();Xc(Ze),Pr.success(a("5000.8270")||"末梢分析成功")}catch(Ne){Pr.error(Ne.message||"末梢分析失败")}finally{sd(!1)}}},a("5000.8244")||"末梢分析")),(mc==null?void 0:mc.terminal_bar_chart)&&b.createElement("div",{style:{marginTop:12,border:"1px solid #e6e6e6",borderRadius:5,padding:8}},b.createElement("div",{style:{fontWeight:600,marginBottom:6}},a("5000.8271")||"末梢统计图"),b.createElement(lT,{src:mc.terminal_bar_chart,style:{width:"100%"}})),Sa&&b.createElement("div",{style:{marginTop:12,border:"1px solid #e6e6e6",borderRadius:5,padding:8}},b.createElement("div",{style:{fontSize:12,marginBottom:6}},b.createElement("b",null,"job_id:")," ",b.createElement("span",{style:{wordBreak:"break-all"}},Sa.job_id)),b.createElement("div",{style:{fontSize:12,marginBottom:6}},a("5000.8245")||"神经元数",": ",Sa.n_neurons," · ",a("5000.8246")||"簇数",": ",Sa.n_clusters),Sa.dendrogram_heatmap&&b.createElement("div",{style:{marginBottom:8}},b.createElement("div",{style:{fontWeight:600,marginBottom:4}},a("5000.8247")||"树状图 + 热图"),b.createElement(lT,{src:Sa.dendrogram_heatmap,style:{width:"100%"}})))):null),_t.includes("functionalLoop")&&b.createElement(Ff,{tab:a("5000.7043")||"功能环路",key:"12",disabled:G===2||G===0},b.createElement(ZNe,{ref:Ot,t:a,loadFunctionLoopFBX:Xt,style:{display:`${ln?"block":"none"}`},setFunctionLoopSwcData:Je,fbxCheckItems:T,rightTabIndex:gt,setLeftMenuTabIndex:ee,onSwcUncheck:Si,regionColors:(()=>{const xe={};return T.forEach(Le=>{const Ne=ly(Ce,Le);Ne&&(xe[Le]=Ne.color)}),xe})(),onRegionRemove:xe=>{if(_.current){const Le=_.current.checkedKeys.current.findIndex(Ne=>Ne===xe);Le!==-1&&_.current.checkedKeys.current.splice(Le,1),_.current.setCheckItems(Ne=>Ne.filter(Ze=>Ze!==xe)),_.current.checkedKeys.current.length===0&&_.current.setExpandedKeys(_.current.defexpandedKeys.current)}},swcRef:de}))),b.createElement(si,{className:"Echart",open:In,onOk:()=>{bc(!1)},onCancel:()=>{bc(!1)},width:"auto",footer:null},b.createElement(Ng,{activeKey:lm,onChange:_b},b.createElement(Ff,{tab:a("5000.7009")||"神经元末梢分布",key:"1"},b.createElement(cs,{ref:rg,className:"Isocortex",Name:"Isocortex",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),ow&&b.createElement(Ni,null,"HPF"),b.createElement(cs,{ref:Dv[0],className:"HPF",Name:"HPF",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:Dv[1],className:"HPF",Name:"HPF",t:a,data_change:Ms,data_c:Yo.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:Dv[2],className:"HPF",Name:"HPF",t:a,data_change:Ms,data_c:Yo.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),ay&&b.createElement(Ni,null,"CNU"),b.createElement(cs,{ref:nw,className:"CNU",Name:"CNU",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),Sd&&b.createElement(Ni,null,"OLF"),b.createElement(cs,{ref:pl[0],className:"OLF",Name:"OLF",t:a,data_change:Ms,data_c:Yo.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:pl[1],className:"OLF",Name:"OLF",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),_M&&b.createElement(Ni,null,"TH"),b.createElement(cs,{ref:ap,className:"TH",Name:"TH",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),js&&b.createElement(Ni,null,"HY"),b.createElement(cs,{ref:cm,className:"HY",Name:"HY",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),sw&&b.createElement(Ni,null,"MB"),b.createElement(cs,{ref:cd,className:"MB",Name:"MB",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),TM&&b.createElement(Ni,null,"HB"),b.createElement(cs,{ref:po,className:"HB",Name:"HB",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),Bi&&b.createElement(Ni,null,"CB"),b.createElement(cs,{ref:Ls[0],className:"CB",Name:"CB",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:Ls[1],className:"CB",Name:"CB",t:a,data_change:Ms,data_c:Yo.current,col:["FN","IP","DN","VeCB"],row:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc})),b.createElement(Ff,{tab:a("5000.7011")||"神经元投射模式",key:"2"},Ce?b.createElement(dne,{data:Nc,fbxTreeDatas:Ce}):null),b.createElement(Ff,{tab:a("5000.7012")||"投射长度分布",key:"3"},b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["FN","IP","DN","VeCB"],row:["_"]})))),Zo&&b.createElement(lT,{wrapperStyle:{display:"none"},preview:{visible:fs,onVisibleChange:xe=>Ba(xe),afterOpenChange:xe=>!xe&&kr("")},src:Zo}),b.createElement(Cy,{open:It,onClose:()=>At(!1),steps:AM}),b.createElement(Cy,{open:Ct,onClose:()=>Me(!1),steps:MM,mask:!0}),b.createElement(Cy,{open:tt,onClose:()=>Yt(!1),steps:gs,mask:!0}),b.createElement(Cy,{open:pt,onClose:()=>Wt(!1),steps:RM,mask:!0}),b.createElement(Cy,{open:en,onClose:()=>sn(!1),steps:Ib,mask:!0}),b.createElement(Cy,{open:Be,onClose:()=>Rt(!1),steps:mo,mask:!0}),b.createElement(Cy,{open:Pt,onClose:()=>Mt(!1),steps:Tc,mask:!0}),b.createElement(Cy,{open:Ut,onClose:()=>hn(!1),steps:LM,mask:!0}),b.createElement(t6,{direction:2,percentage:.2,pointMax:rt.current,pointMin:mn.current,color:16777215,sliceImgNum:205,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,cube_helper:An,renderer:f,showMesh:cr,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,gray_value:ye,slicing_url:vc,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement(t6,{direction:3,percentage:.2,pointMax:rt.current,pointMin:mn.current,color:16777215,sliceImgNum:160,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,cube_helper:An,renderer:f,showMesh:br,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,gray_value:ye,slicing_url:vc,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement(t6,{direction:1,percentage:.2,pointMax:rt.current,pointMin:mn.current,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,cube_helper:An,renderer:f,showMesh:ur,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,gray_value:ye,slicing_url:vc,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement(t6,{direction:4,percentage:.5,pointMax:rt.current,pointMin:mn.current,slice_arbitrary:jt,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,normalVector:un,cube_helper:An,renderer:f,showMesh:pr,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,slicing_url:vc,settransformControlsType:Pc,gray_value:ye,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${ni?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},b.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},b.createElement(V1,{spinning:!0,size:"large"}),b.createElement("br",null),"Loading....wait...")),b.createElement(si,{open:ke,centered:!0,okText:a("5000.0011")||"发送邮件",cancelText:a("5000.0112")||"取消",onOk:()=>{const xe={imageRange:Xa.current,keyNum:_o.current,size:_5};fetch("/app-api/java-api/brainsweb-service/websharing/add",{method:"post",body:JSON.stringify(xe),headers:{"Content-Type":"application/json"}}).then(Le=>{if(!Le.ok)throw"error";return Le.json()}).then(Le=>{ve(!1),si.success({content:a("5000.7034")||"发送成功"}),Pa(!1)}).catch(Le=>{si.error({content:a("5000.7035")||"服务端异常"}),ve(!1),Pa(!1)})},onCancel:()=>ve(!1)},a("5000.0012")||"当前下载文件已超出服务器传输限制,您可以选择降低采样等级或者发送邮件,是否发送邮件?"),b.createElement(si,{open:Ol,centered:!0,footer:null,onCancel:()=>{Js(!1),Qs(0)}},hs===0?b.createElement(b.Fragment,null,b.createElement("div",{style:{marginTop:20}},a("5000.5044")||"当前key信息尚未验证,不可计算,请选择申请key或者填写Key"),b.createElement("div",{style:{textAlign:"right",marginTop:20}},b.createElement(ri,{style:{marginRight:10},onClick:()=>{hs===0?Qs(1):(Qs(0),Js(!1))}},a("5000.5042")||"申请Key"),b.createElement(ri,{type:"primary",onClick:()=>{hs===0?Qs(2):(Qs(0),Js(!1))}},a("5000.5043")||"填写key"))):hs===1?b.createElement(b.Fragment,null,b.createElement(wo,{name:"register",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:KM,onFinishFailed:A5,autoComplete:"off"},b.createElement(wo.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},b.createElement(obe,null)),b.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.5051")||"提示:key值将会发送到所填邮箱账号上,请提交完后关注邮箱是否收到信息。"),b.createElement(wo.Item,{wrapperCol:{offset:10,span:16}},b.createElement(ri,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):b.createElement(b.Fragment,null,a("5000.5049")||"key值",": ",b.createElement(qs,{style:{width:380},placeholder:"brains-wl2mwcUzjU",onChange:xe=>{let Le=new Date;Le.setTime(Le.getTime()+7*24*60*60*1e3);let Ne="; expires="+Le.toUTCString();document.cookie=`imgKey=${xe.target.value}; path=/;expires=${Ne}`}}),b.createElement("div",{style:{textAlign:"center",marginTop:20}},b.createElement(ri,{type:"primary",onClick:()=>{Js(!1);const xe="imgKey=",Le=document.cookie.split(";");let Ne="";for(let Ze=0;Ze<Le.length;Ze++){let kt=Le[Ze];for(;kt.charAt(0)===" ";)kt=kt.substring(1,kt.length);kt.indexOf(xe)===0&&(Ne=kt.substring(xe.length,kt.length))}if(!Ne){let Ze=new Date;Ze.setTime(Ze.getTime()+7*24*60*60*1e3);let kt="; expires="+Ze.toUTCString();document.cookie=`imgKey=brains-wl2mwcUzjU; path=/;expires=${kt}`}XM()}},a("5000.5050")||"保存")))),b.createElement(si,{open:Pl,centered:!0,footer:null,onCancel:()=>{Ir(!1),_s(0)}},il===0?b.createElement(b.Fragment,null,b.createElement("div",{style:{marginTop:20}},a("5000.6011")||"请注意,使用此功能需要提供下载许可号,如果您没有下载许可号,请点击下方按钮向我们申请"),b.createElement("div",{style:{textAlign:"right",marginTop:20}},b.createElement(ri,{style:{marginRight:10},onClick:()=>{il===0?_s(1):(_s(0),Ir(!1))}},a("5000.6012")||"申请下载许可号"),b.createElement(ri,{type:"primary",onClick:()=>{il===0?_s(2):(_s(0),Ir(!1))}},a("5000.6013")||"填写下载许可号"))):il===1?b.createElement(b.Fragment,null,b.createElement(wo,{name:"register2",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:KM,onFinishFailed:A5,autoComplete:"off"},b.createElement(wo.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},b.createElement(obe,null)),b.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.6010")||"提示:下载所用的许可号将会发送到您所填写的邮箱,请在提交结束后关注是否收到包含许可号的邮件。"),b.createElement(wo.Item,{wrapperCol:{offset:10,span:16}},b.createElement(ri,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):b.createElement(b.Fragment,null,a("5000.6014")||"许可号",": ",b.createElement(qs,{style:{width:380},onChange:xe=>{_o.current=xe.target.value}}),b.createElement("div",{style:{textAlign:"center",marginTop:20}},b.createElement(ri,{type:"primary",onClick:()=>{fetch("/app-api/d-api/check",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:_o.current,aplType:2})}).then(xe=>xe.ok?(Ir(!1),Va.current=!0,gt==3?sy():HM(),xe.json()):(Va.current=!1,xe.json())).then(xe=>{xe.message&&si.error({content:xe.message})})}},a("5000.5050")||"保存")))),b.createElement(si,{open:_e,centered:!0,footer:null,onCancel:()=>{ue(!1)}},b.createElement(Ng,{tabPosition:"left",onChange:Ab,style:{minHeight:250},key:X,activeKey:mi.toString(),defaultActiveKey:"1"},b.createElement(Ff,{tab:a("5000.7006")||"可见性",key:"1"},b.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},b.createElement("div",null,a("4000.0217")||"左半脑",": ",b.createElement(Nm,{onChange:I5,checked:Ul})),b.createElement("div",null,a("4000.0218")||"坐标",": ",b.createElement(Nm,{checked:rc,onChange:WF})),b.createElement("div",null,a("4000.0219")||"基准点",": ",b.createElement(Nm,{checked:Ye,onChange:jF})),b.createElement("div",null,a("5000.5016")||"颅骨",": ",b.createElement(Nm,{checked:Qe.cranialVisibility,onChange:_d})),b.createElement("div",null,a("5000.6044")||"网格",": ",b.createElement(Nm,{checked:Qe.gridVisibility,defaultChecked:!0,onChange:xe=>{xt(xe),Qe.gridVisibility=xe}})),b.createElement("div",null,a("5000.6050")||"High Resolution Model",": ",b.createElement(Nm,{checked:dn,onChange:xe=>{Bn(xe),FE.current=xe,_.current&&_.current.reloadFBXModels&&_.current.reloadFBXModels(xe)}})),_t.includes("neurons")?b.createElement("div",null,a("5000.7005")||"末梢点",": ",b.createElement(Nm,{defaultChecked:!0,checked:Qe.terminalVisibility,onChange:xe=>{Lt.current.end=xe,Qe.terminalVisibility=xe,Qc({}),be.current.traverse(Le=>{Le.myMeshType==="neuronSphere"&&Le.userData.type=="end"&&(Le.visible=xe)})}})):null,_t.includes("neurons")?b.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a("5000.7007")||"分支点",": ",b.createElement(Nm,{defaultChecked:!0,checked:Qe.branchingVisibility,onChange:xe=>{Lt.current.start=xe,Qe.branchingVisibility=xe,Qc({}),be.current.traverse(Le=>{Le.myMeshType==="neuronSphere"&&Le.userData.type=="start"&&(Le.visible=xe)})}}),b.createElement(pd,{style:{marginLeft:"15px"},format:"rgb",defaultValue:"#A7B5A1",value:Qe.branchingColor,onChange:(xe,Le)=>{Qe.branchingColor=Le,Qc({});let Ne;if(Le.includes("rgba")){const Ze=Le.lastIndexOf(",");Ne=parseFloat(Le.slice(Ze+1,-1))}be.current.traverse(Ze=>{Ze.myMeshType==="neuronSphere"&&Ze.userData.type=="start"&&(Lt.current.start_color=Le,Ze.material.uniforms.color.value=new xr(Lt==null?void 0:Lt.current.start_color),Ze.userData.color=Le,Ne&&(Ze.material.uniforms.opacity.value=Ne))})}})):null,b.createElement("div",{style:{display:"flex",gap:"10px",whiteSpace:"nowrap"}},a("5000.6045")||"外轮廓",": ",b.createElement(Nm,{checked:De,onChange:xe=>{if(Qe.brainContourVisibility=xe,xe){let Le=be.current.getObjectByName("Brain");Le&&(Le.visible=!0,wt(!0))}else{let Le=be.current.getObjectByName("Brain");Le&&(Le.visible=!1,wt(!1))}}}),b.createElement("div",{style:{marginLeft:"15px",display:"flex"}},a("5000.7004")||"阻光度",": ",b.createElement(eo,{style:{width:"100px",margin:"6px 5px"},min:0,max:1,step:.1,disabled:!De,onChange:xe=>{xu(xe),Qe.brainContourOpacity=xe;let Le=be.current.getObjectByName("Brain");Le&&(Le.children[0].material.opacity=xe)},value:typeof wd=="number"?wd:0}))))),b.createElement(Ff,{tab:a("5000.5024")||"其它图谱",key:"2"},b.createElement(ta.Group,{onChange:rf,value:Rr},b.createElement(vh,{direction:"vertical"},b.createElement(ta,{value:"None"},"None"),b.createElement(ta,{value:"CCF"},"CCF"),b.createElement(ta,{value:"WHS"},"WHS")))))),b.createElement(si,{className:"Echart",title:b.createElement(b.Fragment,null,b.createElement("span",null,"Connectivity diagram"),b.createElement(ri,{onClick:()=>{Jd(!yu)},style:{marginLeft:"15px"}},"Reset ",b.createElement(aIe,{style:{verticalAlign:"super"}}))),style:{position:"absolute",top:"0",bottom:"0",left:"323px",right:"440px",margin:"auto"},open:zu,onOk:XF,onCancel:ZF,width:"auto",footer:null},ie?b.createElement(UXt,{axon_check:ie,fbxTreeDatas:Ce,setLeftMenuTabIndex:ee,swcRef:de,setIsChartOpen:vu,setEchartValue:Ae,setChartValue:Es,reset:yu}):null),b.createElement("div",{ref:ar,className:"class",style:{width:0,height:0,overflow:"hidden",position:"fixed",top:"50%",left:"50%"}}))})),lQt=b.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:h,cube_helper:p,renderer:g,showMesh:y,slice_arbitrary:v,normalVector:m,canMouseMove:C=!0,setAngleX:x,setAngleY:w,setAngleZ:S,gray_value:_,setSectionsInfo:T,sectionsInfoRef:R,sectionPointRef:M,composer:N,menutagShowRef:D,tabIndex:F,settransformControlsType:B,slicing_url:U,urlRef:z,slicingId:H}=t,j=b.useRef([]),K=b.useRef(null),te=b.useRef(new H1),Q=b.useRef(new $o),Z=b.useRef(0),J=b.useRef(0),re=b.useRef(0),G=b.useRef(new Tr),W=b.useRef(new A1),ee=b.useRef(!1),X=b.useRef({target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled}),Y=b.useRef(null);b.useEffect(()=>(K.current=null,j.current=[new Sp(new Te(-1,0,0),-1*i.x),new Sp(new Te(0,1,0),-1*i.y),new Sp(new Te(0,0,1),-1*i.z),new Sp(new Te(1,0,0),r.x),new Sp(new Te(0,-1,0),r.y),new Sp(new Te(0,0,-1),r.z)],q(),()=>{v!=null&&v.current&&document.removeEventListener("keydown",le)}),[r,i]),b.useEffect(()=>{if(y){if(K.current)if(v!=null&&v.current){const ue=M.current.position;v.current=K.current,v.current.position.set(ue.x,ue.y,ue.z),be.current.add(v.current),he()}else{const ue=M.current.position;if(K.current){let _e=K.current.name;_e==="CoronalView"?K.current.position.z=ue.z:_e==="SagittalView"?K.current.position.x=ue.x:_e==="HorizontalView"&&(K.current.position.y=ue.y)}be.current.add(K.current),he()}if(C){if(g.domElement.addEventListener("mouseup",oe),ie(),l.current=new i2(ui.current,g==null?void 0:g.domElement),l.current.setMode("translate"),l.current.enabled=!0,l.current.visible=!0,K.current){let ue=K.current.name;ue==="CoronalView"?(l.current.showX=!1,l.current.showY=!1):ue==="SagittalView"?(l.current.showY=!1,l.current.showZ=!1):ue==="HorizontalView"&&(l.current.showX=!1,l.current.showZ=!1)}se()}}else g.domElement.removeEventListener("mouseup",oe);return()=>{g.domElement.removeEventListener("mouseup",oe),g.domElement.style.cursor="default",v!=null&&v.current&&document.removeEventListener("keydown",le)}},[y,ee]);const ie=()=>{v!=null&&v.current&&document.addEventListener("keydown",le)},se=()=>{if(K!=null&&K.current){l.current.remove(K.current),be.current.getObjectByName("transformControls")&&be.current.remove(l.current),l.current.name="transformControls",l.current.attach(K.current),l.current.space="local",be.current.add(l.current);let _e=be.current.getObjectByName("Brain"),Ce=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),Pe=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(_e){const Ae=new Qo;Ae.expandByObject(_e.clone()),Ce=Ae.min,Pe=Ae.max,l.current.addEventListener("change",()=>{if(K.current){K.current.updateMatrixWorld();const Se=K.current.position;Se.x<Ce.x&&K.current.position.setX(Ce.x),Se.x>Pe.x&&K.current.position.setX(Pe.x),Se.y<Ce.y&&K.current.position.setY(Ce.y),Se.y>Pe.y&&K.current.position.setY(Pe.y),Se.z<Ce.z&&K.current.position.setZ(Ce.z),Se.z>Pe.z&&K.current.position.setZ(Pe.z)}}),l.current.addEventListener("dragging-changed",function(Se){var Re,ge,pe;if(Se.value){if(u.current.enableRotate=!1,u.current.enabled=!1,X.current={target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled},Q.current){let ye=te.current.load(s+"2.png");Q.current.map=ye}}else u.current.enableRotate=!0,u.current.enabled=!0,u.current.reset(),u.current.target.copy(X.current.target),u.current.object.position.copy(X.current.position),u.current.object.up.copy(X.current.up),u.current.update(),he();if(l.current.mode==="rotate"){let ye=l.current.object;if(ye){let Oe=(((Re=ye==null?void 0:ye.rotation)==null?void 0:Re.x)+2*Math.PI)%(2*Math.PI),Ue=(((ge=ye==null?void 0:ye.rotation)==null?void 0:ge.y)+2*Math.PI)%(2*Math.PI),Ye=(((pe=ye==null?void 0:ye.rotation)==null?void 0:pe.z)+2*Math.PI)%(2*Math.PI),xt=(Oe*180/Math.PI).toFixed(0),Lt=(Ue*180/Math.PI).toFixed(0),Fe=(Ye*180/Math.PI).toFixed(0);if(x(parseInt(xt)),w(parseInt(Lt)),S(parseInt(Fe)),ye.matrixWorld.invert()){if(m!=null&&m.current){const _t=new Te(0,1,0);m.current=_t.applyEuler(ye==null?void 0:ye.rotation)}}else console.log("逆矩阵计算失败")}}if(l.current.mode==="translate"){let ye=l.current.object;if(ye){let Oe=ye.position;d&&d({positionx:Oe.x,positiony:Oe.y,positionz:Oe.z})}}})}else setTimeout(()=>{se()},50)}},le=ue=>{if(ue.key==="r"){let _e=!ee.current;ee.current=_e,_e?(l.current.setMode("rotate"),B&&B(1)):(l.current.setMode("translate"),B&&B(0))}},q=()=>{te.current=new H1;let ue=te.current.load(s+"1.png"),_e=new $o({specular:0,color:"#fff",shininess:20,transparent:!0,map:ue,clippingPlanes:j.current,clipShadows:!0,alphaTest:.1});Q.current=_e;let Ce=r.x-i.x,Pe=r.y-i.y,Ae=r.z-i.z,Se=(r.x+i.x)/2,Re=(r.y+i.y)/2,ge=(r.z+i.z)/2,pe=n,ye;e==1?(Ae=.01,ge=(1-pe)*i.z+pe*r.z,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.name="CoronalView"):e==2?(Ce=.01,Se=(1-pe)*i.x+pe*r.x,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.name="SagittalView"):e==3?(Pe=.01,Re=(1-pe)*i.y+pe*r.y,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.name="HorizontalView"):e==4&&(Pe=.01,Ce=Ce*2,Ae=Ae*2,Re=(1-pe)*i.y+pe*r.y,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.rotation.set(120/180*Math.PI,320/180*Math.PI,270/180*Math.PI),ye.material.needsUpdate=!0,m!=null&&m.current&&(m.current=new Te(0,1,0))),Z.current=Ce,J.current=Pe,re.current=Ae,ye&&(ye.userData.initposition=ye.position.clone(),ye.userData.initRotation=ye.rotation.clone(),K.current=ye,v!=null&&v.current&&(v.current=ye)),e==4&&(v!=null&&v.current)&&(v.current.name="arbitrarySlice")},de=(ue,_e,Ce)=>{const Pe=Math.cos(_e),Ae=Math.sin(_e),Se=ue.x-Ce.x,Re=ue.y-Ce.y,ge=Se*Pe-Re*Ae,pe=Se*Ae+Re*Pe;return new Tr(ge+Ce.x,pe+Ce.y)},oe=ue=>{ue.stopPropagation(),ue.preventDefault(),G.current.x=ue.offsetX/f.current*2-1,G.current.y=-(ue.offsetY/h.current)*2+1,W.current.setFromCamera(G.current,ui.current);let _e=W.current.intersectObjects(be.current.children,!0);if(clearTimeout(Y.current),_e.length>0)if(v!=null&&v.current){let Ce=_e.findIndex(Pe=>Pe.object==v.current);if(Ce==-1&&F==3)(R.current.gray||R.current.brains)&&(Y.current=setTimeout(()=>{T({}),R.current={}},50));else{const Pe=_e[Ce].uv,Ae=_e[Ce].point;if(ue.button===2){M.current.position.set(Ae.x,Ae.y,Ae.z);const ge=new URLSearchParams(z.current.search);let pe=JSON.stringify(Ae);ge.set("sectionPointPosition",pe),z.current.search=ge.toString();const ye=be.current.getObjectByName("sectionSphere");ye?ye.position.set(Ae.x,Ae.y,Ae.z):be.current.add(M.current)}const Re=_e[Ce].object.material.map;if(Re){const ge=Re.image,pe=Re.rotation,ye=Re.center,Oe=de(Pe,-pe,ye),Ue=document.createElement("canvas"),Ye=Ue.getContext("2d");ge&&(Ue.width=ge.width,Ue.height=ge.height),Ye.drawImage(ge,0,0);const xt=Ye.getImageData(0,0,Ue.width,Ue.height),Lt=Math.floor(Oe.x*Ue.width),Et=(Math.floor((1-Oe.y)*Ue.height)*Ue.width+Lt)*4,_t=xt.data[Et],ze=xt.data[Et+1],ot=xt.data[Et+2],Je=_.current[`${_t},${ze},${ot}`];Y.current=setTimeout(()=>{_t===0&&R.current.gray===0||(T({gray:`${_t},${ze},${ot}`,brains:Je,left:ue.clientX,top:ue.clientY}),R.current={gray:_t,brains:Je,left:ue.clientX,top:ue.clientY})},50)}}}else{let Ce=_e.findIndex(Pe=>Pe.object==K.current);if(Ce===-1&&F==3)R.current.gray&&(Y.current=setTimeout(()=>{T({}),R.current={}},50));else{const Pe=_e[Ce].uv,Ae=_e[Ce].point;if(ue.button===2){M.current.position.set(Ae.x,Ae.y,Ae.z);const ge=new URLSearchParams(z.current.search);let pe=JSON.stringify(Ae);ge.set("sectionPointPosition",pe),z.current.search=ge.toString();const ye=be.current.getObjectByName("sectionSphere");ye?ye.position.set(Ae.x,Ae.y,Ae.z):be.current.add(M.current)}const Re=_e[Ce].object.material.map;if(Re){const ge=Re.image,pe=Re.rotation,ye=Re.center,Oe=de(Pe,-pe,ye),Ue=document.createElement("canvas"),Ye=Ue.getContext("2d");Ue.width=ge.width,Ue.height=ge.height,Ye.drawImage(ge,0,0);const xt=Ye.getImageData(0,0,Ue.width,Ue.height),Lt=Math.floor(Oe.x*Ue.width),Et=(Math.floor((1-Oe.y)*Ue.height)*Ue.width+Lt)*4,_t=xt.data[Et],ze=xt.data[Et+1],ot=xt.data[Et+2],Je=_.current[`${_t},${ze},${ot}`];Y.current=setTimeout(()=>{_t===0&&R.current.gray===0||(T({gray:`${_t},${ze},${ot}`,brains:Je,left:ue.clientX,top:ue.clientY}),R.current={gray:_t,brains:Je,left:ue.clientX,top:ue.clientY})},50)}}}else R.current.gray&&F==3&&(Y.current=setTimeout(()=>{T({}),R.current={}},50))},he=()=>{var Pe,Ae,Se,Re,ge,pe;const ue=be.current.getObjectByName("Brain");let _e=new fo;_e.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let Ce=new Te;if(K.current){let ye=(((Ae=(Pe=K.current)==null?void 0:Pe.rotation)==null?void 0:Ae.x)+2*Math.PI)%(2*Math.PI),Oe=(((Re=(Se=K.current)==null?void 0:Se.rotation)==null?void 0:Re.y)+2*Math.PI)%(2*Math.PI),Ue=(((pe=(ge=K.current)==null?void 0:ge.rotation)==null?void 0:pe.z)+2*Math.PI)%(2*Math.PI),Ye=parseInt((ye*180/Math.PI).toFixed(0)),xt=parseInt((Oe*180/Math.PI).toFixed(0)),Lt=parseInt((Ue*180/Math.PI).toFixed(0));if(ue)Ce=K.current.position.clone().applyMatrix4(ue.matrixWorld.clone().invert()).applyQuaternion(_e);else{setTimeout(()=>{he()},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:Ce.z})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);_t.center.set(.5,.5),_t.rotation=Math.PI,Q.current&&(Q.current.map=_t)}):e==2?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Ce.x,y:0,z:0})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);if(K.current){const ot=K.current.geometry.attributes.uv.array,Je=et=>{ot[et+0]=1,ot[et+1]=0,ot[et+2]=1,ot[et+3]=1,ot[et+4]=0,ot[et+5]=0,ot[et+6]=0,ot[et+7]=1},Xe=et=>{ot[et+0]=1,ot[et+1]=1,ot[et+2]=1,ot[et+3]=0,ot[et+4]=0,ot[et+5]=1,ot[et+6]=0,ot[et+7]=0};Je(0),Xe(8),K.current.geometry.attributes.uv.needsUpdate=!0,Q.current&&(Q.current.map=_t)}}):e==3?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Ce.y,z:0})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);if(K.current){const ot=K.current.geometry.attributes.uv.array;(Xe=>{ot[Xe+0]=1,ot[Xe+1]=0,ot[Xe+2]=0,ot[Xe+3]=0,ot[Xe+4]=1,ot[Xe+5]=1,ot[Xe+6]=0,ot[Xe+7]=1})(24),K.current.geometry.attributes.uv.needsUpdate=!0,Q.current&&(Q.current.map=_t)}}):fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[Ye,xt,Lt],center:[Ce.x,Ce.y,Ce.z]})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);if(K.current){const ot=K.current.geometry.attributes.uv.array;(Xe=>{ot[Xe+0]=0,ot[Xe+1]=0,ot[Xe+2]=1,ot[Xe+3]=0,ot[Xe+4]=0,ot[Xe+5]=1,ot[Xe+6]=1,ot[Xe+7]=1})(24),K.current.geometry.attributes.uv.needsUpdate=!0,Q.current&&(Q.current.map=_t)}})}};return b.createElement(b.Fragment,null)}),t6=lQt,qNe=t=>{const{scene:e,percentage:n,layerxyz:r}=t,i=b.useRef(),a=b.useRef(new jo),o=.012,s=-7,l=-5.6,u=-8.3,d=b.useRef(0),f=b.useRef(0),h=b.useRef(0),p=b.useRef(0),g=b.useRef(0),y=b.useRef(0),v=b.useRef(0),m=b.useRef(0),C=b.useRef(0),x=b.useRef(0),w=b.useRef(0),S=b.useRef(0),_=b.useRef(),T=b.useRef(0),R=b.useRef();b.useEffect(()=>{M(n,r)},[n,r]);const M=(U,z)=>{var te;_.current&&(e.current.remove(_.current),_.current.geometry.dispose());var H=new Ns({color:1973790});H.transparent=!0,H.opacity=.9;const j=new Mi,K=new Float32Array([0,-6,0,0,6,0]);j.setAttribute("position",new Ys(K,3)),z=="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 fa(j,H),_.current.name="axis",(te=_.current)==null||te.rotation.set(Math.PI/2,0,0),_.current.scale.set(1,2,1),_.current.position.set((m.current+v.current)/2,C.current+(x.current-C.current)*U,(S.current+w.current)/2),T.current=2):z=="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 fa(j,H),_.current.name="axis",_.current.position.set((m.current+v.current)/2,(x.current+C.current)/2,v.current+(m.current-v.current)*(U/2+.5)),T.current=1):z=="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 fa(j,H),_.current.name="axis",_.current.position.set((m.current+v.current)/2,(x.current+C.current)/2,w.current+(S.current-w.current)*U),T.current=0),_.current&&e.current.add(_.current)},N=()=>{let U=new $o({specular:16775920,color:16775920,shininess:10,visible:!1});R.current=new Wn(new Ps(m.current-v.current,x.current-C.current,S.current-w.current),U),R.current.position.set((m.current+v.current)/2,(x.current+C.current)/2,(S.current+w.current)/2)},D=()=>{var U,z,H,j,K,te;i.current&&(i.current.computeBoundingBox(),d.current=((U=i.current.boundingBox)==null?void 0:U.max.x)||0,f.current=((z=i.current.boundingBox)==null?void 0:z.min.x)||0,h.current=((H=i.current.boundingBox)==null?void 0:H.max.y)||0,p.current=((j=i.current.boundingBox)==null?void 0:j.min.y)||0,g.current=((K=i.current.boundingBox)==null?void 0:K.max.z)||0,y.current=((te=i.current.boundingBox)==null?void 0:te.min.z)||0,v.current=f.current*o+s,m.current=d.current*o+s,C.current=p.current*o+l,x.current=h.current*o+l,w.current=y.current*o+u,S.current=g.current*o+u)},F=()=>{let U;return T.current==2?(_.current&&(U=((_.current.position.y-C.current)/(x.current-C.current)).toFixed(4)),parseFloat(U)):T.current==1?(_.current&&(U=((_.current.position.x-v.current)/(m.current-v.current)).toFixed(4)),parseFloat(U)):T.current==0?(_.current&&(U=((_.current.position.z-w.current)/(S.current-w.current)).toFixed(4)),parseFloat(U)):0},B=async(U,z)=>{if(z=="2"){var H=new CD;H.load(U,function(K){i.current=K;var te=new $o({transparent:!0,opacity:.5,depthTest:!1}),Q=new Wn(i.current,te);a.current.add(Q),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(),M(n,r),N()})}else{var H=new CD,j=new jo;H.load(U,function(te){var G,W,ee,X,Y,ie;var Q=te,Z=new $o({transparent:!0,opacity:.5,depthTest:!1}),J=new Wn(Q,Z);j.add(J),j.position.set(0,0,0),j.scale.set(o,o,o),j.castShadow=!0,j.receiveShadow=!0,j.translateX(s),j.translateY(l),j.translateZ(u),e.current.add(j),e.current.remove(a.current),i.current&&i.current.dispose(),Q.computeBoundingBox(),d.current=((G=Q.boundingBox)==null?void 0:G.max.x)||0,f.current=((W=Q.boundingBox)==null?void 0:W.min.x)||0,h.current=((ee=Q.boundingBox)==null?void 0:ee.max.y)||0,p.current=((X=Q.boundingBox)==null?void 0:X.min.y)||0,g.current=((Y=Q.boundingBox)==null?void 0:Y.max.z)||0,y.current=((ie=Q.boundingBox)==null?void 0:ie.min.z)||0,v.current=f.current*o+s,m.current=d.current*o+s,C.current=p.current*o+l,x.current=h.current*o+l,w.current=y.current*o+u,S.current=g.current*o+u;var re=F();M(re,T.current),R.current&&e.current.remove(R.current),R.current&&R.current.geometry.dispose(),N()})}};return b.useEffect(()=>{B("/staticresource/data/STL/Brain.stl","2")},[]),b.createElement("div",null)};const{Content:cQt}=kk;var $y=new IQ({antialias:!0,logarithmicDepthBuffer:!0});const JNe=b.memo(({currentLevel:t,totalLevel:e,layerxyz:n,is3DViewer:r,setcurrentLevel:i,is2DViewer:a})=>{const o=b.useRef(new OP),s=b.useRef(null),l=b.useRef(0),u=b.useRef(0),d=b.useRef(null),[f,h]=b.useState(!1),[p,g]=b.useState(0);b.useEffect(()=>{var D;o.current=new OP,camera.current=new Ud(45,235/163,.01,1e4),camera.current.position.set(20,0,0),camera.current.up.set(0,-1,0),camera.current.lookAt(new Te(0,0,0)),o.current.add(camera.current);let N=new UE(16777215,100,0);N.position.set(8,-1,0),o.current.add(N),$y.render(o.current,camera.current),o.current.background=new xr("#fff"),(D=s.current)==null||D.appendChild($y.domElement),$y.setSize(235,163),l.current=$y.domElement.clientWidth-1,u.current=$y.domElement.clientHeight-1,window.addEventListener("resize",y),v()},[]);const y=()=>{$y.setSize(235,163),camera.current.aspect=235/163,camera.current.updateProjectionMatrix(),$y.render(o.current,camera.current)},v=()=>{requestAnimationFrame(v),camera.current.updateMatrixWorld(),$y.render(o.current,camera.current)},[m,C]=b.useState(t),x=N=>{C(N)},w=N=>{i(N)};b.useEffect(()=>{C(t)},[t]);const S=N=>{N.preventDefault(),h(!0)},_=N=>{N.preventDefault(),console.log(N.clientX),f&&((N.clientX-50<130||N.clientX-51>45)&&(g(N.clientX-50),d.current.style.left=N.clientX-50+"px"),N.clientX-50<=45&&(g(45),d.current.style.left="45px"),N.clientX-50>=130&&(g(180),d.current.style.left="130px"))},T=N=>{const j=(Math.min(Math.max(N,45),130)-45)/(130-45)*(45-1)+1;return Math.round(j)},R=()=>{h(!1),i(T(p))},M=N=>{const j=(Math.min(Math.max(N,1),45)-1)/(45-1)*(130-45)+45;return Math.round(j)};return b.createElement("div",null,b.createElement("div",{id:"img",style:{display:a?"block":"none"},onMouseMove:_,onMouseUp:R},b.createElement("img",{id:"x",src:"./cor.png"}),b.createElement("div",{id:"draggable-line",style:{left:`${M(t)}px`},ref:d,onMouseDown:S})),b.createElement(kk,{className:"content",style:{display:r?"block":"none"}},b.createElement(cQt,{className:"Box3D"},b.createElement(qNe,{percentage:m/e,layerxyz:n,scene:o})),b.createElement("div",{style:{position:"absolute",zIndex:"10",top:"20px",left:"70px",border:"1px solid"},ref:s},b.createElement(eo,{max:e,min:1,value:m,onAfterChange:w,onChange:x}))))});/*!
5254
+ `);const Ne=new Blob([Le],{type:"text/csv;charset=utf-8;"}),Ze=URL.createObjectURL(Ne),kt=document.createElement("a");kt.href=Ze,kt.download="neuronal_data.csv",kt.click(),URL.revokeObjectURL(Ze);let Gt=new URL(window.location.href),wn=new URLSearchParams(Gt.search).get("type");const Vn=window.location.origin+window.location.pathname+`?type=${wn}&download=queriedResults`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Vn,time:0})})}},a("5000.7030")||"Click here to download the queried results")):null,b.createElement(Ni,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:280},dashed:!0}),b.createElement("div",{style:{width:"100%",height:"calc(100vh - 330px)",overflow:"scroll",paddingTop:"10px"}},b.createElement("div",{style:Rc?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},Rc&&b.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5054")||"Upstream"),b.createElement("div",{ref:xo,style:{width:"100%"}})),b.createElement("br",null),b.createElement("div",{style:Rc?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},Rc&&b.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5055")||"Downstream"),b.createElement("div",{ref:al,style:{width:"100%"}})))):null),_t.includes("neuronAnalysis")&&b.createElement(Ff,{tab:a("5000.7032")||"形态分析",key:"10",disabled:G===2||G===0},ln?b.createElement(b.Fragment,null,b.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},b.createElement(xC,{accept:".swc",fileList:ha,beforeUpload:xe=>(hl?(ha.forEach(Le=>{const Ne=Le.name.slice(0,Le.name.length-4)+".js";Ne in zr.current&&(be.current.remove(zr.current[Ne]),delete zr.current[Ne])}),Uo([xe]),Cu([]),th(""),Eb([])):Uo(Le=>[...Le,xe]),!1),multiple:!0,onRemove:xe=>{const Le=ha.find(Ne=>Ne.uid===xe.uid);if(Le){const Ne=Le.name.slice(0,Le.name.length-4)+".js";Ne in zr.current&&(be.current.remove(zr.current[Ne]),delete zr.current[Ne]),Cu(Ze=>Ze.filter(kt=>kt!==Le.name)),Eb(Ze=>Ze.filter(kt=>kt.key!==Le.name))}Uo(Ne=>Ne.filter(Ze=>Ze.uid!==xe.uid))}},b.createElement(ri,{icon:b.createElement(Xk,null)},"Upload")),b.createElement("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:10}},b.createElement("label",null,a("5000.8208")||"Resolution"),b.createElement(eo,{min:1,max:100,step:1,value:xi,onChange:zn,style:{flex:1}}),b.createElement(Zm,{min:1,max:100,value:xi,onChange:xe=>zn(xe),style:{width:60}})),b.createElement(ri,{loading:Br,disabled:ha.length<1,onClick:()=>{Ar(!0),console.log("swcFileList",ha);const xe=new FormData;for(let Le=0;Le<ha.length;Le++)xe.append("swcFile",ha[Le]);xe.append("resolution",xi.toString()),fetch("/app-api/neuron-reg/countAll",{method:"POST",body:xe}).then(Le=>{if(!Le.ok)throw si.error({content:a("5000.7027")||"计算失败"}),Ar(!1),Nt(!1),new Error("Network response was not ok");return Le.json()}).then(Le=>{th(Le.path),Ar(!1),Nt(!1),si.success({content:a("4000.0226")||"成功"})})}},a("7000.0108")||"开始计算")),hl&&ha.length>0&&b.createElement(b.Fragment,null,b.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},b.createElement(ri,{style:{marginTop:2,width:"100%"},type:"primary",disabled:hl=="",onClick:async()=>{const xe=`/app-api/neuron-reg/downloadswc/${hl}/processed_js_files.zip`;try{const Le=await fetch(xe,{method:"GET"});if(!Le.ok)throw new Error("下载失败");const Ne=await Le.blob(),Ze=window.URL.createObjectURL(Ne),kt=document.createElement("a");kt.href=Ze,kt.download="processed_js_files.zip",document.body.appendChild(kt),kt.click(),kt.remove(),window.URL.revokeObjectURL(Ze)}catch(Le){console.error("下载出错:",Le)}}},a("7000.0109")||"下载结果")),b.createElement(q2,{rowSelection:{selectedRowKeys:Dc,onChange:xe=>{const Le=Dc,Ne=xe;Cu(Ne);const Ze=Ne.filter(Gt=>!Le.includes(Gt)),kt=Le.filter(Gt=>!Ne.includes(Gt));Ze.forEach(Gt=>{const Jt=ig.find(wn=>wn.key===Gt);if(Jt){const wn=jp(Jt.path||Gt);w5(`/app-api/neuron-reg/downloadswc/${hl}/${wn}`,()=>{Nt(!1)})}}),kt.forEach(Gt=>{const Jt=ig.find(wn=>wn.key===Gt);if(Jt){const wn=jp(Jt.path||Gt);wn in zr.current&&be.current.remove(zr.current[wn])}})}},dataSource:ig.length>0?ig:ha.map(xe=>({key:xe.name,name:xe.name,path:jp(String(xe.name||"").replace(/\.swc$/i,".js")),color:"#045404",show:!1,url:""})),columns:[{title:"Name",dataIndex:"name"},{title:"Color",dataIndex:"Picker",width:60,render:(xe,Le)=>b.createElement(pd,{disabled:!Le.show,format:"rgb",defaultValue:Le.color})},{title:"Ana.",dataIndex:"Ana",align:"center",width:60,render:(xe,Le)=>{const Ne=jp(Le.path||Le.key);return b.createElement(Di,{placement:"right",title:a("5000.7008")||"分析"},b.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",onClick:()=>{fetch(`/app-api/neuron-reg/downloadswc/${hl}/${Ne}`).then(Ze=>Ze.json()).then(Ze=>{Hp(Ze),w5(`/app-api/neuron-reg/downloadswc/${hl}/${Ne}`,()=>{Dc.includes(Le.key)||(Cu([...Dc,Le.key]),console.log("[Ana] 已勾选:",Le.key)),DF(lr=>lr+1),zp({name:Ne.replace(/\.js$/i,""),color:"#045404"}),bc(!0),Nt(!1);const kt=tu.current;aw(["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_"].some(lr=>kt[lr])),Tb(["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","DG_d","DG_i","DG_V","SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"].some(lr=>kt[lr])),oy(["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"].some(lr=>kt[lr])),SM(["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"].some(lr=>kt[lr])),Za(["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"].some(lr=>kt[lr])),eu(["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"].some(lr=>kt[lr])),EM(["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"].some(lr=>kt[lr])),IM(["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"].some(lr=>kt[lr])),qo(["LING_","CENT2_","CUL4/5_","DEC_","FOTU_","PYR_","UVU_","NOD_","SIM_","ANcr1_","ANcr2_","PRM_","COPY_","PFL_","FL_","IP","DN","FN","VeCB"].some(lr=>kt[lr]))})}).catch(Ze=>console.error("加载swc数据失败:",Ze))}},b.createElement("g",{id:"#515151ff"},b.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"}),b.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"}),b.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"}),b.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"}))))}}],pagination:!1,size:"small",scroll:{y:300}}))):null),_t.includes("volumeAnalysis")&&b.createElement(Ff,{tab:a("5000.8211")||"Volume Analysis",key:"13",disabled:G===2||G===0},b.createElement(KNe,{renderer:f,t:a,fbxCenters:FM})),_t.includes("terminalAnalysis")&&b.createElement(Ff,{tab:a("5000.8227")||"末梢分析",key:"14",disabled:G===2||G===0},ln?b.createElement("div",{style:{maxHeight:"calc(100vh - 60px)",overflowY:"auto",overflowX:"hidden",paddingRight:6}},b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8229")||"特征类型",":"),b.createElement(Qi,{span:14},b.createElement(W2,{style:{width:"100%"},value:pc,onChange:xe=>Gc(xe),options:[{value:"intensity",label:a("5000.8230")||"投射强度 (intensity)"},{value:"branch",label:a("5000.8231")||"分支点 (branch)"},{value:"merge",label:a("5000.8232")||"融合 (merge)"}]}))),b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8233")||"聚类数",":"),b.createElement(Qi,{span:14},b.createElement(Zm,{min:1,max:50,value:ec,onChange:xe=>gc(xe||3),style:{width:"100%"}}))),pc==="merge"&&b.createElement(b.Fragment,null,b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8234")||"权重 1",":"),b.createElement(Qi,{span:14},b.createElement(Zm,{min:0,max:1,step:.1,value:hu,onChange:xe=>$u(xe||0),style:{width:"100%"}}))),b.createElement(Ha,{align:"middle",style:{marginBottom:6}},b.createElement(Qi,{span:10},a("5000.8235")||"权重 2",":"),b.createElement(Qi,{span:14},b.createElement(Zm,{min:0,max:1,step:.1,value:jc,onChange:xe=>pu(xe||0),style:{width:"100%"}})))),b.createElement("div",{style:{fontStyle:"italic",fontSize:12,color:"#888",marginBottom:6}},a("5000.8237")||"使用当前加载的 SWC 神经元进行聚类。"),b.createElement(ri,{type:"primary",loading:Kd,onClick:async()=>{const xe=yM();if(xe.length===0){Pr.warning(a("5000.8238")||"请先加载至少一个 SWC 神经元");return}Wc(!0);try{const Le={neurons:xe,feature_type:pc,n_clusters:ec,base_url:`${window.location.origin}/staticresource/data/SWC/swc_foler`};pc==="merge"&&(Le.weight1=hu,Le.weight2=jc);const Ne=await fetch("/app-api/swc-chart-api/api/clustering",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le)});if(!Ne.ok){const Jt=await Ne.json().catch(()=>({detail:Ne.statusText}));throw new Error(Jt.detail||"请求失败")}const Ze=await Ne.json(),kt=Array.isArray(Ze.cluster_colors)?Ze.cluster_colors.map(Jt=>{const wn=Number(Jt.cluster_id);return{cluster_id:wn,cluster_name:Jt.cluster_name||`Cluster_${wn}`,color:pj(Jt.color,RR(wn))}}).filter(Jt=>Number.isFinite(Jt.cluster_id)):[],Gt={...Ze,cluster_colors:kt,soma_points:Array.isArray(Ze.soma_points)?Ze.soma_points:[],assignments:Array.isArray(Ze.assignments)?Ze.assignments:[]};Af(Gt),qd(kt),mu(kt.map(Jt=>Jt.cluster_id)),Zc(null),Xc(null),Yc(!1),ud(),Pr.success(a("5000.8240")||"聚类成功")}catch(Le){Pr.error(Le.message||"聚类失败")}finally{Wc(!1)}}},a("5000.8241")||"聚类分析"),Lc.length>0&&b.createElement("div",{style:{marginTop:10,border:"1px solid #e6e6e6",borderRadius:5,padding:8,background:"#fafafa"}},b.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8}},b.createElement("span",{style:{fontWeight:600}},a("5000.8262")||"聚类类别"),b.createElement(f6,{style:{marginInlineEnd:0}},a("5000.8264")||"已显示胞体点",": ",u5,"/",((L5=Sa==null?void 0:Sa.soma_points)==null?void 0:L5.length)||0," · ",a("5000.8268")||"唯一坐标",": ",kF)),b.createElement(q2,{rowKey:"cluster_id",dataSource:bM,pagination:!1,size:"small",rowSelection:{selectedRowKeys:kl,onChange:xe=>{mu(xe.map(Le=>Number(Le)).filter(Le=>Number.isFinite(Le))),Zc(null),Xc(null),Yc(!1),ud()}},columns:[{title:"Name",dataIndex:"cluster_name",key:"cluster_name",ellipsis:!0},{title:a("5000.8267")||"胞体点",dataIndex:"soma_count",key:"soma_count",width:78,align:"center"},{title:a("5000.8226")||"颜色",dataIndex:"color",key:"color",width:64,align:"center",render:(xe,Le)=>b.createElement(pd,{value:Le.color,size:"small",onChange:(Ne,Ze)=>xM(Le.cluster_id,Ne,Ze)})}]})),b.createElement(Ni,{style:{margin:"8px 0"},dashed:!0}),b.createElement("p",{style:{marginBottom:4}},a("5000.8228")||"选择目标核团:"),b.createElement(M2,{showSearch:!0,style:{width:"100%",marginBottom:8},value:el,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:xe=>{Hs(xe),Zc(null),Xc(null),Yc(!1),ud()},treeData:hw(Ce)}),b.createElement(vh,{wrap:!0},b.createElement(ri,{type:"primary",disabled:!(Sa!=null&&Sa.job_id)||!el||kl.length===0,loading:Yd,onClick:async()=>{if(!(Sa!=null&&Sa.job_id)){Pr.warning(a("5000.8242")||"请先进行聚类分析");return}if(!el){Pr.warning(a("5000.8243")||"请选择目标核团");return}const xe=CM();if(xe.length===0){Pr.warning(a("5000.8265")||"请至少选择一个聚类类别");return}ld(!0),Zc(null),Xc(null),Yc(!1),ud();try{const Le=await fetch("/app-api/swc-chart-api/api/soma-distribution",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_region:String(el).split(/\s+/)[0],cluster_ids:xe,job_id:Sa.job_id})});if(!Le.ok){const Ze=await Le.json().catch(()=>({detail:Le.statusText}));throw new Error(Ze.detail||"请求失败")}const Ne=await Le.json();Zc(Ne),Pr.success(a("5000.8250")||"胞体分析成功")}catch(Le){Pr.error(Le.message||a("5000.8251")||"胞体分析失败")}finally{ld(!1)}}},a("5000.8252")||"胞体分析"),Gl&&b.createElement(ri,{loading:gu,onClick:async()=>{if(!Gl){Pr.warning(a("5000.8253")||"请先完成胞体分析");return}if(Kc){ud(),Pr.success(a("5000.8257")||"已清除胞体渲染");return}Dl(!0);try{BF(),await wM(Gl),Pr.success(a("5000.8254")||"胞体分析结果已加载到场景")}catch(xe){Pr.error(xe.message||a("5000.8255")||"胞体结果渲染失败")}finally{Dl(!1)}}},Kc?a("5000.8258")||"清除数据":a("5000.8256")||"展示数据"),b.createElement(ri,{disabled:!(Sa!=null&&Sa.job_id)||!el||kl.length===0||!Gl,loading:If,onClick:async()=>{if(!(Sa!=null&&Sa.job_id)){Pr.warning(a("5000.8242")||"请先进行聚类分析");return}if(!el){Pr.warning(a("5000.8243")||"请选择目标核团");return}if(!Gl){Pr.warning(a("5000.8253")||"请先完成胞体分析");return}const xe=CM();if(xe.length===0){Pr.warning(a("5000.8265")||"请至少选择一个聚类类别");return}const Le=yM();if(Le.length===0){Pr.warning(a("5000.8238")||"请先加载至少一个 SWC 神经元");return}sd(!0),Xc(null);try{const Ne=await fetch("/app-api/swc-chart-api/api/terminal-distribution",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_region:String(el).split(/\s+/)[0],neurons:Le,cluster_ids:xe,base_url:`${window.location.origin}/staticresource/data/SWC/swc_foler`,use_right_half:!0,job_id:Sa.job_id})});if(!Ne.ok){const kt=await Ne.json().catch(()=>({detail:Ne.statusText}));throw new Error(kt.detail||"请求失败")}const Ze=await Ne.json();Xc(Ze),Pr.success(a("5000.8270")||"末梢分析成功")}catch(Ne){Pr.error(Ne.message||"末梢分析失败")}finally{sd(!1)}}},a("5000.8244")||"末梢分析")),(mc==null?void 0:mc.terminal_bar_chart)&&b.createElement("div",{style:{marginTop:12,border:"1px solid #e6e6e6",borderRadius:5,padding:8}},b.createElement("div",{style:{fontWeight:600,marginBottom:6}},a("5000.8271")||"末梢统计图"),b.createElement(lT,{src:mc.terminal_bar_chart,style:{width:"100%"}})),Sa&&b.createElement("div",{style:{marginTop:12,border:"1px solid #e6e6e6",borderRadius:5,padding:8}},b.createElement("div",{style:{fontSize:12,marginBottom:6}},b.createElement("b",null,"job_id:")," ",b.createElement("span",{style:{wordBreak:"break-all"}},Sa.job_id)),b.createElement("div",{style:{fontSize:12,marginBottom:6}},a("5000.8245")||"神经元数",": ",Sa.n_neurons," · ",a("5000.8246")||"簇数",": ",Sa.n_clusters),Sa.dendrogram_heatmap&&b.createElement("div",{style:{marginBottom:8}},b.createElement("div",{style:{fontWeight:600,marginBottom:4}},a("5000.8247")||"树状图 + 热图"),b.createElement(lT,{src:Sa.dendrogram_heatmap,style:{width:"100%"}})))):null),_t.includes("functionalLoop")&&b.createElement(Ff,{tab:a("5000.7043")||"功能环路",key:"12",disabled:G===2||G===0},b.createElement(ZNe,{ref:Ot,t:a,loadFunctionLoopFBX:Xt,style:{display:`${ln?"block":"none"}`},setFunctionLoopSwcData:Je,fbxCheckItems:T,rightTabIndex:gt,setLeftMenuTabIndex:ee,onSwcUncheck:Si,regionColors:(()=>{const xe={};return T.forEach(Le=>{const Ne=ly(Ce,Le);Ne&&(xe[Le]=Ne.color)}),xe})(),onRegionRemove:xe=>{if(_.current){const Le=_.current.checkedKeys.current.findIndex(Ne=>Ne===xe);Le!==-1&&_.current.checkedKeys.current.splice(Le,1),_.current.setCheckItems(Ne=>Ne.filter(Ze=>Ze!==xe)),_.current.checkedKeys.current.length===0&&_.current.setExpandedKeys(_.current.defexpandedKeys.current)}},swcRef:de}))),b.createElement(si,{className:"Echart",open:In,onOk:()=>{bc(!1)},onCancel:()=>{bc(!1)},width:"auto",footer:null},b.createElement(Ng,{activeKey:lm,onChange:_b},b.createElement(Ff,{tab:a("5000.7009")||"神经元末梢分布",key:"1"},b.createElement(cs,{ref:rg,className:"Isocortex",Name:"Isocortex",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),ow&&b.createElement(Ni,null,"HPF"),b.createElement(cs,{ref:Dv[0],className:"HPF",Name:"HPF",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:Dv[1],className:"HPF",Name:"HPF",t:a,data_change:Ms,data_c:Yo.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:Dv[2],className:"HPF",Name:"HPF",t:a,data_change:Ms,data_c:Yo.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),ay&&b.createElement(Ni,null,"CNU"),b.createElement(cs,{ref:nw,className:"CNU",Name:"CNU",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),Sd&&b.createElement(Ni,null,"OLF"),b.createElement(cs,{ref:pl[0],className:"OLF",Name:"OLF",t:a,data_change:Ms,data_c:Yo.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:pl[1],className:"OLF",Name:"OLF",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),_M&&b.createElement(Ni,null,"TH"),b.createElement(cs,{ref:ap,className:"TH",Name:"TH",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),js&&b.createElement(Ni,null,"HY"),b.createElement(cs,{ref:cm,className:"HY",Name:"HY",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),sw&&b.createElement(Ni,null,"MB"),b.createElement(cs,{ref:cd,className:"MB",Name:"MB",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),TM&&b.createElement(Ni,null,"HB"),b.createElement(cs,{ref:po,className:"HB",Name:"HB",t:a,data_change:Ms,data_c:Yo.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:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),Bi&&b.createElement(Ni,null,"CB"),b.createElement(cs,{ref:Ls[0],className:"CB",Name:"CB",t:a,data_change:Ms,data_c:Yo.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"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc}),b.createElement(cs,{ref:Ls[1],className:"CB",Name:"CB",t:a,data_change:Ms,data_c:Yo.current,col:["FN","IP","DN","VeCB"],row:["_"],onRowClick:(xe,Le)=>{Cu(Ne=>Ne.includes(Le)?Ne.filter(Ze=>Ze!==Le):[...Ne,Le])},selectedSwcKeys:Dc})),b.createElement(Ff,{tab:a("5000.7011")||"神经元投射模式",key:"2"},Ce?b.createElement(dne,{data:Nc,fbxTreeDatas:Ce}):null),b.createElement(Ff,{tab:a("5000.7012")||"投射长度分布",key:"3"},b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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:["_"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,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"]}),b.createElement(us,{t:a,data_change:Ms,data_c:Nc,col:["FN","IP","DN","VeCB"],row:["_"]})))),Zo&&b.createElement(lT,{wrapperStyle:{display:"none"},preview:{visible:fs,onVisibleChange:xe=>Ba(xe),afterOpenChange:xe=>!xe&&kr("")},src:Zo}),b.createElement(Cy,{open:It,onClose:()=>At(!1),steps:AM}),b.createElement(Cy,{open:Ct,onClose:()=>Me(!1),steps:MM,mask:!0}),b.createElement(Cy,{open:tt,onClose:()=>Yt(!1),steps:gs,mask:!0}),b.createElement(Cy,{open:pt,onClose:()=>Wt(!1),steps:RM,mask:!0}),b.createElement(Cy,{open:en,onClose:()=>sn(!1),steps:Ib,mask:!0}),b.createElement(Cy,{open:Be,onClose:()=>Rt(!1),steps:mo,mask:!0}),b.createElement(Cy,{open:Pt,onClose:()=>Mt(!1),steps:Tc,mask:!0}),b.createElement(Cy,{open:Ut,onClose:()=>hn(!1),steps:LM,mask:!0}),b.createElement(t6,{direction:2,percentage:.2,pointMax:rt.current,pointMin:mn.current,color:16777215,sliceImgNum:205,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,cube_helper:An,renderer:f,showMesh:cr,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,gray_value:ye,slicing_url:vc,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement(t6,{direction:3,percentage:.2,pointMax:rt.current,pointMin:mn.current,color:16777215,sliceImgNum:160,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,cube_helper:An,renderer:f,showMesh:br,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,gray_value:ye,slicing_url:vc,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement(t6,{direction:1,percentage:.2,pointMax:rt.current,pointMin:mn.current,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,cube_helper:An,renderer:f,showMesh:ur,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,gray_value:ye,slicing_url:vc,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement(t6,{direction:4,percentage:.5,pointMax:rt.current,pointMin:mn.current,slice_arbitrary:jt,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:We,controls:h,canvas_width:mt,canvas_height:Ft,handleStateUpdate:og,normalVector:un,cube_helper:An,renderer:f,showMesh:pr,setAngleX:Zt,setAngleY:ht,setAngleZ:Kt,slicing_url:vc,settransformControlsType:Pc,gray_value:ye,setSectionsInfo:pe,sectionsInfoRef:Re,sectionPointRef:me,composer:Pe,menutagShowRef:Oc,tabIndex:gt,urlRef:Ve,slicingId:Zn}),b.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${ni?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},b.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},b.createElement(V1,{spinning:!0,size:"large"}),b.createElement("br",null),"Loading....wait...")),b.createElement(si,{open:ke,centered:!0,okText:a("5000.0011")||"发送邮件",cancelText:a("5000.0112")||"取消",onOk:()=>{const xe={imageRange:Xa.current,keyNum:_o.current,size:_5};fetch("/app-api/java-api/brainsweb-service/websharing/add",{method:"post",body:JSON.stringify(xe),headers:{"Content-Type":"application/json"}}).then(Le=>{if(!Le.ok)throw"error";return Le.json()}).then(Le=>{ve(!1),si.success({content:a("5000.7034")||"发送成功"}),Pa(!1)}).catch(Le=>{si.error({content:a("5000.7035")||"服务端异常"}),ve(!1),Pa(!1)})},onCancel:()=>ve(!1)},a("5000.0012")||"当前下载文件已超出服务器传输限制,您可以选择降低采样等级或者发送邮件,是否发送邮件?"),b.createElement(si,{open:Ol,centered:!0,footer:null,onCancel:()=>{Js(!1),Qs(0)}},hs===0?b.createElement(b.Fragment,null,b.createElement("div",{style:{marginTop:20}},a("5000.5044")||"当前key信息尚未验证,不可计算,请选择申请key或者填写Key"),b.createElement("div",{style:{textAlign:"right",marginTop:20}},b.createElement(ri,{style:{marginRight:10},onClick:()=>{hs===0?Qs(1):(Qs(0),Js(!1))}},a("5000.5042")||"申请Key"),b.createElement(ri,{type:"primary",onClick:()=>{hs===0?Qs(2):(Qs(0),Js(!1))}},a("5000.5043")||"填写key"))):hs===1?b.createElement(b.Fragment,null,b.createElement(wo,{name:"register",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:KM,onFinishFailed:A5,autoComplete:"off"},b.createElement(wo.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},b.createElement(obe,null)),b.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.5051")||"提示:key值将会发送到所填邮箱账号上,请提交完后关注邮箱是否收到信息。"),b.createElement(wo.Item,{wrapperCol:{offset:10,span:16}},b.createElement(ri,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):b.createElement(b.Fragment,null,a("5000.5049")||"key值",": ",b.createElement(qs,{style:{width:380},placeholder:"brains-wl2mwcUzjU",onChange:xe=>{let Le=new Date;Le.setTime(Le.getTime()+7*24*60*60*1e3);let Ne="; expires="+Le.toUTCString();document.cookie=`imgKey=${xe.target.value}; path=/;expires=${Ne}`}}),b.createElement("div",{style:{textAlign:"center",marginTop:20}},b.createElement(ri,{type:"primary",onClick:()=>{Js(!1);const xe="imgKey=",Le=document.cookie.split(";");let Ne="";for(let Ze=0;Ze<Le.length;Ze++){let kt=Le[Ze];for(;kt.charAt(0)===" ";)kt=kt.substring(1,kt.length);kt.indexOf(xe)===0&&(Ne=kt.substring(xe.length,kt.length))}if(!Ne){let Ze=new Date;Ze.setTime(Ze.getTime()+7*24*60*60*1e3);let kt="; expires="+Ze.toUTCString();document.cookie=`imgKey=brains-wl2mwcUzjU; path=/;expires=${kt}`}XM()}},a("5000.5050")||"保存")))),b.createElement(si,{open:Pl,centered:!0,footer:null,onCancel:()=>{Ir(!1),_s(0)}},il===0?b.createElement(b.Fragment,null,b.createElement("div",{style:{marginTop:20}},a("5000.6011")||"请注意,使用此功能需要提供下载许可号,如果您没有下载许可号,请点击下方按钮向我们申请"),b.createElement("div",{style:{textAlign:"right",marginTop:20}},b.createElement(ri,{style:{marginRight:10},onClick:()=>{il===0?_s(1):(_s(0),Ir(!1))}},a("5000.6012")||"申请下载许可号"),b.createElement(ri,{type:"primary",onClick:()=>{il===0?_s(2):(_s(0),Ir(!1))}},a("5000.6013")||"填写下载许可号"))):il===1?b.createElement(b.Fragment,null,b.createElement(wo,{name:"register2",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:KM,onFinishFailed:A5,autoComplete:"off"},b.createElement(wo.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},b.createElement(qs,null)),b.createElement(wo.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},b.createElement(obe,null)),b.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.6010")||"提示:下载所用的许可号将会发送到您所填写的邮箱,请在提交结束后关注是否收到包含许可号的邮件。"),b.createElement(wo.Item,{wrapperCol:{offset:10,span:16}},b.createElement(ri,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):b.createElement(b.Fragment,null,a("5000.6014")||"许可号",": ",b.createElement(qs,{style:{width:380},onChange:xe=>{_o.current=xe.target.value}}),b.createElement("div",{style:{textAlign:"center",marginTop:20}},b.createElement(ri,{type:"primary",onClick:()=>{fetch("/app-api/d-api/check",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:_o.current,aplType:2})}).then(xe=>xe.ok?(Ir(!1),Va.current=!0,gt==3?sy():HM(),xe.json()):(Va.current=!1,xe.json())).then(xe=>{xe.message&&si.error({content:xe.message})})}},a("5000.5050")||"保存")))),b.createElement(si,{open:_e,centered:!0,footer:null,onCancel:()=>{ue(!1)}},b.createElement(Ng,{tabPosition:"left",onChange:Ab,style:{minHeight:250},key:X,activeKey:mi.toString(),defaultActiveKey:"1"},b.createElement(Ff,{tab:a("5000.7006")||"可见性",key:"1"},b.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},b.createElement("div",null,a("4000.0217")||"左半脑",": ",b.createElement(Nm,{onChange:I5,checked:Ul})),b.createElement("div",null,a("4000.0218")||"坐标",": ",b.createElement(Nm,{checked:rc,onChange:WF})),b.createElement("div",null,a("4000.0219")||"基准点",": ",b.createElement(Nm,{checked:Ye,onChange:jF})),b.createElement("div",null,a("5000.5016")||"颅骨",": ",b.createElement(Nm,{checked:Qe.cranialVisibility,onChange:_d})),b.createElement("div",null,a("5000.6044")||"网格",": ",b.createElement(Nm,{checked:Qe.gridVisibility,defaultChecked:!0,onChange:xe=>{xt(xe),Qe.gridVisibility=xe}})),b.createElement("div",null,a("5000.6050")||"High Resolution Model",": ",b.createElement(Nm,{checked:dn,onChange:xe=>{Bn(xe),FE.current=xe,_.current&&_.current.reloadFBXModels&&_.current.reloadFBXModels(xe)}})),_t.includes("neurons")?b.createElement("div",null,a("5000.7005")||"末梢点",": ",b.createElement(Nm,{defaultChecked:!0,checked:Qe.terminalVisibility,onChange:xe=>{Lt.current.end=xe,Qe.terminalVisibility=xe,Qc({}),be.current.traverse(Le=>{Le.myMeshType==="neuronSphere"&&Le.userData.type=="end"&&(Le.visible=xe)})}})):null,_t.includes("neurons")?b.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a("5000.7007")||"分支点",": ",b.createElement(Nm,{defaultChecked:!0,checked:Qe.branchingVisibility,onChange:xe=>{Lt.current.start=xe,Qe.branchingVisibility=xe,Qc({}),be.current.traverse(Le=>{Le.myMeshType==="neuronSphere"&&Le.userData.type=="start"&&(Le.visible=xe)})}}),b.createElement(pd,{style:{marginLeft:"15px"},format:"rgb",defaultValue:"#A7B5A1",value:Qe.branchingColor,onChange:(xe,Le)=>{Qe.branchingColor=Le,Qc({});let Ne;if(Le.includes("rgba")){const Ze=Le.lastIndexOf(",");Ne=parseFloat(Le.slice(Ze+1,-1))}be.current.traverse(Ze=>{Ze.myMeshType==="neuronSphere"&&Ze.userData.type=="start"&&(Lt.current.start_color=Le,Ze.material.uniforms.color.value=new xr(Lt==null?void 0:Lt.current.start_color),Ze.userData.color=Le,Ne&&(Ze.material.uniforms.opacity.value=Ne))})}})):null,b.createElement("div",{style:{display:"flex",gap:"10px",whiteSpace:"nowrap"}},a("5000.6045")||"外轮廓",": ",b.createElement(Nm,{checked:De,onChange:xe=>{if(Qe.brainContourVisibility=xe,xe){let Le=be.current.getObjectByName("Brain");Le&&(Le.visible=!0,wt(!0))}else{let Le=be.current.getObjectByName("Brain");Le&&(Le.visible=!1,wt(!1))}}}),b.createElement("div",{style:{marginLeft:"15px",display:"flex"}},a("5000.7004")||"阻光度",": ",b.createElement(eo,{style:{width:"100px",margin:"6px 5px"},min:0,max:1,step:.1,disabled:!De,onChange:xe=>{xu(xe),Qe.brainContourOpacity=xe;let Le=be.current.getObjectByName("Brain");Le&&(Le.children[0].material.opacity=xe)},value:typeof wd=="number"?wd:0}))))),b.createElement(Ff,{tab:a("5000.5024")||"其它图谱",key:"2"},b.createElement(ta.Group,{onChange:rf,value:Rr},b.createElement(vh,{direction:"vertical"},b.createElement(ta,{value:"None"},"None"),b.createElement(ta,{value:"CCF"},"CCF"),b.createElement(ta,{value:"WHS"},"WHS")))))),b.createElement(si,{className:"Echart",title:b.createElement(b.Fragment,null,b.createElement("span",null,"Connectivity diagram"),b.createElement(ri,{onClick:()=>{Jd(!yu)},style:{marginLeft:"15px"}},"Reset ",b.createElement(aIe,{style:{verticalAlign:"super"}}))),style:{position:"absolute",top:"0",bottom:"0",left:"323px",right:"440px",margin:"auto"},open:zu,onOk:XF,onCancel:ZF,width:"auto",footer:null},ie?b.createElement(UXt,{axon_check:ie,fbxTreeDatas:Ce,setLeftMenuTabIndex:ee,swcRef:de,setIsChartOpen:vu,setEchartValue:Ae,setChartValue:Es,reset:yu}):null),b.createElement("div",{ref:ar,className:"class",style:{width:0,height:0,overflow:"hidden",position:"fixed",top:"50%",left:"50%"}}))})),lQt=b.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:h,cube_helper:p,renderer:g,showMesh:y,slice_arbitrary:v,normalVector:m,canMouseMove:C=!0,setAngleX:x,setAngleY:w,setAngleZ:S,gray_value:_,setSectionsInfo:T,sectionsInfoRef:R,sectionPointRef:M,composer:N,menutagShowRef:D,tabIndex:F,settransformControlsType:B,slicing_url:U,urlRef:z,slicingId:H}=t,j=b.useRef([]),K=b.useRef(null),te=b.useRef(new H1),Q=b.useRef(new $o),Z=b.useRef(0),J=b.useRef(0),re=b.useRef(0),G=b.useRef(new Tr),W=b.useRef(new A1),ee=b.useRef(!1),X=b.useRef({target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled}),Y=b.useRef(null);b.useEffect(()=>(K.current=null,j.current=[new Sp(new Te(-1,0,0),-1*i.x),new Sp(new Te(0,1,0),-1*i.y),new Sp(new Te(0,0,1),-1*i.z),new Sp(new Te(1,0,0),r.x),new Sp(new Te(0,-1,0),r.y),new Sp(new Te(0,0,-1),r.z)],q(),()=>{v!=null&&v.current&&document.removeEventListener("keydown",le)}),[r,i]),b.useEffect(()=>{if(y){if(K.current)if(v!=null&&v.current){const ue=M.current.position;v.current=K.current,v.current.position.set(ue.x,ue.y,ue.z),be.current.add(v.current),he()}else{const ue=M.current.position;if(K.current){let _e=K.current.name;_e==="CoronalView"?K.current.position.z=ue.z:_e==="SagittalView"?K.current.position.x=ue.x:_e==="HorizontalView"&&(K.current.position.y=ue.y)}be.current.add(K.current),he()}if(C){if(g.domElement.addEventListener("mouseup",oe),ie(),l.current=new i2(ui.current,g==null?void 0:g.domElement),l.current.setMode("translate"),l.current.enabled=!0,l.current.visible=!0,K.current){let ue=K.current.name;ue==="CoronalView"?(l.current.showX=!1,l.current.showY=!1):ue==="SagittalView"?(l.current.showY=!1,l.current.showZ=!1):ue==="HorizontalView"&&(l.current.showX=!1,l.current.showZ=!1)}se()}}else g.domElement.removeEventListener("mouseup",oe);return()=>{g.domElement.removeEventListener("mouseup",oe),g.domElement.style.cursor="default",v!=null&&v.current&&document.removeEventListener("keydown",le)}},[y,ee]);const ie=()=>{v!=null&&v.current&&document.addEventListener("keydown",le)},se=()=>{if(K!=null&&K.current){l.current.remove(K.current),be.current.getObjectByName("transformControls")&&be.current.remove(l.current),l.current.name="transformControls",l.current.attach(K.current),l.current.space="local",be.current.add(l.current);let _e=be.current.getObjectByName("Brain"),Ce=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),Pe=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(_e){const Ae=new Qo;Ae.expandByObject(_e.clone()),Ce=Ae.min,Pe=Ae.max,l.current.addEventListener("change",()=>{if(K.current){K.current.updateMatrixWorld();const Se=K.current.position;Se.x<Ce.x&&K.current.position.setX(Ce.x),Se.x>Pe.x&&K.current.position.setX(Pe.x),Se.y<Ce.y&&K.current.position.setY(Ce.y),Se.y>Pe.y&&K.current.position.setY(Pe.y),Se.z<Ce.z&&K.current.position.setZ(Ce.z),Se.z>Pe.z&&K.current.position.setZ(Pe.z)}}),l.current.addEventListener("dragging-changed",function(Se){var Re,ge,pe;if(Se.value){if(u.current.enableRotate=!1,u.current.enabled=!1,X.current={target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled},Q.current){let ye=te.current.load(s+"2.png");Q.current.map=ye}}else u.current.enableRotate=!0,u.current.enabled=!0,u.current.reset(),u.current.target.copy(X.current.target),u.current.object.position.copy(X.current.position),u.current.object.up.copy(X.current.up),u.current.update(),he();if(l.current.mode==="rotate"){let ye=l.current.object;if(ye){let Oe=(((Re=ye==null?void 0:ye.rotation)==null?void 0:Re.x)+2*Math.PI)%(2*Math.PI),Ue=(((ge=ye==null?void 0:ye.rotation)==null?void 0:ge.y)+2*Math.PI)%(2*Math.PI),Ye=(((pe=ye==null?void 0:ye.rotation)==null?void 0:pe.z)+2*Math.PI)%(2*Math.PI),xt=(Oe*180/Math.PI).toFixed(0),Lt=(Ue*180/Math.PI).toFixed(0),Fe=(Ye*180/Math.PI).toFixed(0);if(x(parseInt(xt)),w(parseInt(Lt)),S(parseInt(Fe)),ye.matrixWorld.invert()){if(m!=null&&m.current){const _t=new Te(0,1,0);m.current=_t.applyEuler(ye==null?void 0:ye.rotation)}}else console.log("逆矩阵计算失败")}}if(l.current.mode==="translate"){let ye=l.current.object;if(ye){let Oe=ye.position;d&&d({positionx:Oe.x,positiony:Oe.y,positionz:Oe.z})}}})}else setTimeout(()=>{se()},50)}},le=ue=>{if(ue.key==="r"){let _e=!ee.current;ee.current=_e,_e?(l.current.setMode("rotate"),B&&B(1)):(l.current.setMode("translate"),B&&B(0))}},q=()=>{te.current=new H1;let ue=te.current.load(s+"1.png"),_e=new $o({specular:0,color:"#fff",shininess:20,transparent:!0,map:ue,clippingPlanes:j.current,clipShadows:!0,alphaTest:.1});Q.current=_e;let Ce=r.x-i.x,Pe=r.y-i.y,Ae=r.z-i.z,Se=(r.x+i.x)/2,Re=(r.y+i.y)/2,ge=(r.z+i.z)/2,pe=n,ye;e==1?(Ae=.01,ge=(1-pe)*i.z+pe*r.z,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.name="CoronalView"):e==2?(Ce=.01,Se=(1-pe)*i.x+pe*r.x,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.name="SagittalView"):e==3?(Pe=.01,Re=(1-pe)*i.y+pe*r.y,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.name="HorizontalView"):e==4&&(Pe=.01,Ce=Ce*2,Ae=Ae*2,Re=(1-pe)*i.y+pe*r.y,ye=new Wn(new Ps(Ce,Pe,Ae),_e),ye.position.set(Se,Re,ge),ye.rotation.set(120/180*Math.PI,320/180*Math.PI,270/180*Math.PI),ye.material.needsUpdate=!0,m!=null&&m.current&&(m.current=new Te(0,1,0))),Z.current=Ce,J.current=Pe,re.current=Ae,ye&&(ye.userData.initposition=ye.position.clone(),ye.userData.initRotation=ye.rotation.clone(),K.current=ye,v!=null&&v.current&&(v.current=ye)),e==4&&(v!=null&&v.current)&&(v.current.name="arbitrarySlice")},de=(ue,_e,Ce)=>{const Pe=Math.cos(_e),Ae=Math.sin(_e),Se=ue.x-Ce.x,Re=ue.y-Ce.y,ge=Se*Pe-Re*Ae,pe=Se*Ae+Re*Pe;return new Tr(ge+Ce.x,pe+Ce.y)},oe=ue=>{ue.stopPropagation(),ue.preventDefault(),G.current.x=ue.offsetX/f.current*2-1,G.current.y=-(ue.offsetY/h.current)*2+1,W.current.setFromCamera(G.current,ui.current);let _e=W.current.intersectObjects(be.current.children,!0);if(clearTimeout(Y.current),_e.length>0)if(v!=null&&v.current){let Ce=_e.findIndex(Pe=>Pe.object==v.current);if(Ce==-1&&F==3)(R.current.gray||R.current.brains)&&(Y.current=setTimeout(()=>{T({}),R.current={}},50));else{const Pe=_e[Ce].uv,Ae=_e[Ce].point;if(ue.button===2){M.current.position.set(Ae.x,Ae.y,Ae.z);const ge=new URLSearchParams(z.current.search);let pe=JSON.stringify(Ae);ge.set("sectionPointPosition",pe),z.current.search=ge.toString();const ye=be.current.getObjectByName("sectionSphere");ye?ye.position.set(Ae.x,Ae.y,Ae.z):be.current.add(M.current)}const Re=_e[Ce].object.material.map;if(Re){const ge=Re.image,pe=Re.rotation,ye=Re.center,Oe=de(Pe,-pe,ye),Ue=document.createElement("canvas"),Ye=Ue.getContext("2d");ge&&(Ue.width=ge.width,Ue.height=ge.height),Ye.drawImage(ge,0,0);const xt=Ye.getImageData(0,0,Ue.width,Ue.height),Lt=Math.floor(Oe.x*Ue.width),Et=(Math.floor((1-Oe.y)*Ue.height)*Ue.width+Lt)*4,_t=xt.data[Et],ze=xt.data[Et+1],ot=xt.data[Et+2],Je=_.current[`${_t},${ze},${ot}`];Y.current=setTimeout(()=>{_t===0&&R.current.gray===0||(T({gray:`${_t},${ze},${ot}`,brains:Je,left:ue.clientX,top:ue.clientY}),R.current={gray:_t,brains:Je,left:ue.clientX,top:ue.clientY})},50)}}}else{let Ce=_e.findIndex(Pe=>Pe.object==K.current);if(Ce===-1&&F==3)R.current.gray&&(Y.current=setTimeout(()=>{T({}),R.current={}},50));else{const Pe=_e[Ce].uv,Ae=_e[Ce].point;if(ue.button===2){M.current.position.set(Ae.x,Ae.y,Ae.z);const ge=new URLSearchParams(z.current.search);let pe=JSON.stringify(Ae);ge.set("sectionPointPosition",pe),z.current.search=ge.toString();const ye=be.current.getObjectByName("sectionSphere");ye?ye.position.set(Ae.x,Ae.y,Ae.z):be.current.add(M.current)}const Re=_e[Ce].object.material.map;if(Re){const ge=Re.image,pe=Re.rotation,ye=Re.center,Oe=de(Pe,-pe,ye),Ue=document.createElement("canvas"),Ye=Ue.getContext("2d");Ue.width=ge.width,Ue.height=ge.height,Ye.drawImage(ge,0,0);const xt=Ye.getImageData(0,0,Ue.width,Ue.height),Lt=Math.floor(Oe.x*Ue.width),Et=(Math.floor((1-Oe.y)*Ue.height)*Ue.width+Lt)*4,_t=xt.data[Et],ze=xt.data[Et+1],ot=xt.data[Et+2],Je=_.current[`${_t},${ze},${ot}`];Y.current=setTimeout(()=>{_t===0&&R.current.gray===0||(T({gray:`${_t},${ze},${ot}`,brains:Je,left:ue.clientX,top:ue.clientY}),R.current={gray:_t,brains:Je,left:ue.clientX,top:ue.clientY})},50)}}}else R.current.gray&&F==3&&(Y.current=setTimeout(()=>{T({}),R.current={}},50))},he=()=>{var Pe,Ae,Se,Re,ge,pe;const ue=be.current.getObjectByName("Brain");let _e=new fo;_e.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let Ce=new Te;if(K.current){let ye=(((Ae=(Pe=K.current)==null?void 0:Pe.rotation)==null?void 0:Ae.x)+2*Math.PI)%(2*Math.PI),Oe=(((Re=(Se=K.current)==null?void 0:Se.rotation)==null?void 0:Re.y)+2*Math.PI)%(2*Math.PI),Ue=(((pe=(ge=K.current)==null?void 0:ge.rotation)==null?void 0:pe.z)+2*Math.PI)%(2*Math.PI),Ye=parseInt((ye*180/Math.PI).toFixed(0)),xt=parseInt((Oe*180/Math.PI).toFixed(0)),Lt=parseInt((Ue*180/Math.PI).toFixed(0));if(ue)Ce=K.current.position.clone().applyMatrix4(ue.matrixWorld.clone().invert()).applyQuaternion(_e);else{setTimeout(()=>{he()},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:Ce.z})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);_t.center.set(.5,.5),_t.rotation=Math.PI,Q.current&&(Q.current.map=_t)}):e==2?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Ce.x,y:0,z:0})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);if(K.current){const ot=K.current.geometry.attributes.uv.array,Je=et=>{ot[et+0]=1,ot[et+1]=0,ot[et+2]=1,ot[et+3]=1,ot[et+4]=0,ot[et+5]=0,ot[et+6]=0,ot[et+7]=1},Xe=et=>{ot[et+0]=1,ot[et+1]=1,ot[et+2]=1,ot[et+3]=0,ot[et+4]=0,ot[et+5]=1,ot[et+6]=0,ot[et+7]=0};Je(0),Xe(8),K.current.geometry.attributes.uv.needsUpdate=!0,Q.current&&(Q.current.map=_t)}}):e==3?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Ce.y,z:0})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);if(K.current){const ot=K.current.geometry.attributes.uv.array;(Xe=>{ot[Xe+0]=1,ot[Xe+1]=0,ot[Xe+2]=0,ot[Xe+3]=0,ot[Xe+4]=1,ot[Xe+5]=1,ot[Xe+6]=0,ot[Xe+7]=1})(24),K.current.geometry.attributes.uv.needsUpdate=!0,Q.current&&(Q.current.map=_t)}}):fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[Ye,xt,Lt],center:[Ce.x,Ce.y,Ce.z]})}).then(Fe=>Fe.ok?Fe.json():si.error({title:Fe.message})).then(Fe=>{const Et=Fe.base64;H.current=Fe.id,U.current=Et;let _t=te.current.load(Et);if(K.current){const ot=K.current.geometry.attributes.uv.array;(Xe=>{ot[Xe+0]=0,ot[Xe+1]=0,ot[Xe+2]=1,ot[Xe+3]=0,ot[Xe+4]=0,ot[Xe+5]=1,ot[Xe+6]=1,ot[Xe+7]=1})(24),K.current.geometry.attributes.uv.needsUpdate=!0,Q.current&&(Q.current.map=_t)}})}};return b.createElement(b.Fragment,null)}),t6=lQt,qNe=t=>{const{scene:e,percentage:n,layerxyz:r}=t,i=b.useRef(),a=b.useRef(new jo),o=.012,s=-7,l=-5.6,u=-8.3,d=b.useRef(0),f=b.useRef(0),h=b.useRef(0),p=b.useRef(0),g=b.useRef(0),y=b.useRef(0),v=b.useRef(0),m=b.useRef(0),C=b.useRef(0),x=b.useRef(0),w=b.useRef(0),S=b.useRef(0),_=b.useRef(),T=b.useRef(0),R=b.useRef();b.useEffect(()=>{M(n,r)},[n,r]);const M=(U,z)=>{var te;_.current&&(e.current.remove(_.current),_.current.geometry.dispose());var H=new Ns({color:1973790});H.transparent=!0,H.opacity=.9;const j=new Mi,K=new Float32Array([0,-6,0,0,6,0]);j.setAttribute("position",new Ys(K,3)),z=="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 fa(j,H),_.current.name="axis",(te=_.current)==null||te.rotation.set(Math.PI/2,0,0),_.current.scale.set(1,2,1),_.current.position.set((m.current+v.current)/2,C.current+(x.current-C.current)*U,(S.current+w.current)/2),T.current=2):z=="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 fa(j,H),_.current.name="axis",_.current.position.set((m.current+v.current)/2,(x.current+C.current)/2,v.current+(m.current-v.current)*(U/2+.5)),T.current=1):z=="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 fa(j,H),_.current.name="axis",_.current.position.set((m.current+v.current)/2,(x.current+C.current)/2,w.current+(S.current-w.current)*U),T.current=0),_.current&&e.current.add(_.current)},N=()=>{let U=new $o({specular:16775920,color:16775920,shininess:10,visible:!1});R.current=new Wn(new Ps(m.current-v.current,x.current-C.current,S.current-w.current),U),R.current.position.set((m.current+v.current)/2,(x.current+C.current)/2,(S.current+w.current)/2)},D=()=>{var U,z,H,j,K,te;i.current&&(i.current.computeBoundingBox(),d.current=((U=i.current.boundingBox)==null?void 0:U.max.x)||0,f.current=((z=i.current.boundingBox)==null?void 0:z.min.x)||0,h.current=((H=i.current.boundingBox)==null?void 0:H.max.y)||0,p.current=((j=i.current.boundingBox)==null?void 0:j.min.y)||0,g.current=((K=i.current.boundingBox)==null?void 0:K.max.z)||0,y.current=((te=i.current.boundingBox)==null?void 0:te.min.z)||0,v.current=f.current*o+s,m.current=d.current*o+s,C.current=p.current*o+l,x.current=h.current*o+l,w.current=y.current*o+u,S.current=g.current*o+u)},F=()=>{let U;return T.current==2?(_.current&&(U=((_.current.position.y-C.current)/(x.current-C.current)).toFixed(4)),parseFloat(U)):T.current==1?(_.current&&(U=((_.current.position.x-v.current)/(m.current-v.current)).toFixed(4)),parseFloat(U)):T.current==0?(_.current&&(U=((_.current.position.z-w.current)/(S.current-w.current)).toFixed(4)),parseFloat(U)):0},B=async(U,z)=>{if(z=="2"){var H=new CD;H.load(U,function(K){i.current=K;var te=new $o({transparent:!0,opacity:.5,depthTest:!1}),Q=new Wn(i.current,te);a.current.add(Q),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(),M(n,r),N()})}else{var H=new CD,j=new jo;H.load(U,function(te){var G,W,ee,X,Y,ie;var Q=te,Z=new $o({transparent:!0,opacity:.5,depthTest:!1}),J=new Wn(Q,Z);j.add(J),j.position.set(0,0,0),j.scale.set(o,o,o),j.castShadow=!0,j.receiveShadow=!0,j.translateX(s),j.translateY(l),j.translateZ(u),e.current.add(j),e.current.remove(a.current),i.current&&i.current.dispose(),Q.computeBoundingBox(),d.current=((G=Q.boundingBox)==null?void 0:G.max.x)||0,f.current=((W=Q.boundingBox)==null?void 0:W.min.x)||0,h.current=((ee=Q.boundingBox)==null?void 0:ee.max.y)||0,p.current=((X=Q.boundingBox)==null?void 0:X.min.y)||0,g.current=((Y=Q.boundingBox)==null?void 0:Y.max.z)||0,y.current=((ie=Q.boundingBox)==null?void 0:ie.min.z)||0,v.current=f.current*o+s,m.current=d.current*o+s,C.current=p.current*o+l,x.current=h.current*o+l,w.current=y.current*o+u,S.current=g.current*o+u;var re=F();M(re,T.current),R.current&&e.current.remove(R.current),R.current&&R.current.geometry.dispose(),N()})}};return b.useEffect(()=>{B("/staticresource/data/STL/Brain.stl","2")},[]),b.createElement("div",null)};const{Content:cQt}=kk;var $y=new IQ({antialias:!0,logarithmicDepthBuffer:!0});const JNe=b.memo(({currentLevel:t,totalLevel:e,layerxyz:n,is3DViewer:r,setcurrentLevel:i,is2DViewer:a})=>{const o=b.useRef(new OP),s=b.useRef(null),l=b.useRef(0),u=b.useRef(0),d=b.useRef(null),[f,h]=b.useState(!1),[p,g]=b.useState(0);b.useEffect(()=>{var D;o.current=new OP,camera.current=new Ud(45,235/163,.01,1e4),camera.current.position.set(20,0,0),camera.current.up.set(0,-1,0),camera.current.lookAt(new Te(0,0,0)),o.current.add(camera.current);let N=new UE(16777215,100,0);N.position.set(8,-1,0),o.current.add(N),$y.render(o.current,camera.current),o.current.background=new xr("#fff"),(D=s.current)==null||D.appendChild($y.domElement),$y.setSize(235,163),l.current=$y.domElement.clientWidth-1,u.current=$y.domElement.clientHeight-1,window.addEventListener("resize",y),v()},[]);const y=()=>{$y.setSize(235,163),camera.current.aspect=235/163,camera.current.updateProjectionMatrix(),$y.render(o.current,camera.current)},v=()=>{requestAnimationFrame(v),camera.current.updateMatrixWorld(),$y.render(o.current,camera.current)},[m,C]=b.useState(t),x=N=>{C(N)},w=N=>{i(N)};b.useEffect(()=>{C(t)},[t]);const S=N=>{N.preventDefault(),h(!0)},_=N=>{N.preventDefault(),console.log(N.clientX),f&&((N.clientX-50<130||N.clientX-51>45)&&(g(N.clientX-50),d.current.style.left=N.clientX-50+"px"),N.clientX-50<=45&&(g(45),d.current.style.left="45px"),N.clientX-50>=130&&(g(180),d.current.style.left="130px"))},T=N=>{const j=(Math.min(Math.max(N,45),130)-45)/(130-45)*(45-1)+1;return Math.round(j)},R=()=>{h(!1),i(T(p))},M=N=>{const j=(Math.min(Math.max(N,1),45)-1)/(45-1)*(130-45)+45;return Math.round(j)};return b.createElement("div",null,b.createElement("div",{id:"img",style:{display:a?"block":"none"},onMouseMove:_,onMouseUp:R},b.createElement("img",{id:"x",src:"./cor.png"}),b.createElement("div",{id:"draggable-line",style:{left:`${M(t)}px`},ref:d,onMouseDown:S})),b.createElement(kk,{className:"content",style:{display:r?"block":"none"}},b.createElement(cQt,{className:"Box3D"},b.createElement(qNe,{percentage:m/e,layerxyz:n,scene:o})),b.createElement("div",{style:{position:"absolute",zIndex:"10",top:"20px",left:"70px",border:"1px solid"},ref:s},b.createElement(eo,{max:e,min:1,value:m,onAfterChange:w,onChange:x}))))});/*!
5255
5255
  * sweetalert2 v11.26.17
5256
5256
  * Released under the MIT License.
5257
5257
  */function QNe(t,e,n){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function uQt(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function xbe(t,e){return t.get(QNe(t,e))}function dQt(t,e,n){uQt(t,e),e.set(t,n)}function fQt(t,e,n){return t.set(QNe(t,e),n),n}const hQt=100,Ea={},pQt=()=>{Ea.previousActiveElement instanceof HTMLElement?(Ea.previousActiveElement.focus(),Ea.previousActiveElement=null):document.body&&document.body.focus()},gQt=t=>new Promise(e=>{if(!t)return e();const n=window.scrollX,r=window.scrollY;Ea.restoreFocusTimeout=setTimeout(()=>{pQt(),e()},hQt),window.scrollTo(n,r)}),eDe="swal2-",mQt=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error","draggable","dragging"],yr=mQt.reduce((t,e)=>(t[e]=eDe+e,t),{}),vQt=["success","warning","info","question","error"],ED=vQt.reduce((t,e)=>(t[e]=eDe+e,t),{}),tDe="SweetAlert2:",fre=t=>t.charAt(0).toUpperCase()+t.slice(1),Ah=t=>{console.warn(`${tDe} ${typeof t=="object"?t.join(" "):t}`)},Q3=t=>{console.error(`${tDe} ${t}`)},Cbe=[],yQt=t=>{Cbe.includes(t)||(Cbe.push(t),Ah(t))},nDe=(t,e=null)=>{yQt(`"${t}" is deprecated and will be removed in the next major release.${e?` Use "${e}" instead.`:""}`)},TF=t=>typeof t=="function"?t():t,hre=t=>t&&typeof t.toPromise=="function",lM=t=>hre(t)?t.toPromise():Promise.resolve(t),pre=t=>t&&Promise.resolve(t)===t,Rh=()=>document.body.querySelector(`.${yr.container}`),cM=t=>{const e=Rh();return e?e.querySelector(t):null},Vp=t=>cM(`.${t}`),dl=()=>Vp(yr.popup),i5=()=>Vp(yr.icon),bQt=()=>Vp(yr["icon-content"]),rDe=()=>Vp(yr.title),gre=()=>Vp(yr["html-container"]),iDe=()=>Vp(yr.image),mre=()=>Vp(yr["progress-steps"]),IF=()=>Vp(yr["validation-message"]),Av=()=>cM(`.${yr.actions} .${yr.confirm}`),a5=()=>cM(`.${yr.actions} .${yr.cancel}`),ew=()=>cM(`.${yr.actions} .${yr.deny}`),xQt=()=>Vp(yr["input-label"]),o5=()=>cM(`.${yr.loader}`),uM=()=>Vp(yr.actions),aDe=()=>Vp(yr.footer),AF=()=>Vp(yr["timer-progress-bar"]),vre=()=>Vp(yr.close),CQt=`