";
html += me.htmlCls.buttonStr + "elecmapNo4'>Remove Map ";
@@ -15107,12 +15122,16 @@ var icn3d = (function (exports) {
html += "2fofc contour at default threshold or at: "
+ me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6sigmaurl2fofc' value='' size=8> σ ";
- html += "URL in the same host: " + me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6fileurl2fofc' size=20> " + me.htmlCls.buttonStr + "reload_dsn6fileurl2fofc' style='margin: 6px 20px 0 0;'>Load DSN6" + me.htmlCls.buttonStr + "reload_ccp4fileurl2fofc' style='margin: 6px 20px 0 0;'>Load CCP4" + me.htmlCls.buttonStr + "reload_mtzfileurl2fofc' style='margin: 6px 20px 0 0;'>Load MTZ" + me.htmlCls.buttonStr + "reload_rcsbmtzfileurl2fofc' style='margin-top: 6px;'>Load RCSB MTZ
";
+ //html += "URL in the same host: " + me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6fileurl2fofc' size=20> " + me.htmlCls.buttonStr + "reload_dsn6fileurl2fofc' style='margin: 6px 20px 0 0;'>Load DSN6" + me.htmlCls.buttonStr + "reload_ccp4fileurl2fofc' style='margin: 6px 20px 0 0;'>Load CCP4" + me.htmlCls.buttonStr + "reload_mtzfileurl2fofc' style='margin: 6px 20px 0 0;'>Load MTZ" + me.htmlCls.buttonStr + "reload_rcsbmtzfileurl2fofc' style='margin-top: 6px;'>Load RCSB MTZ
";
+
+ html += "URL in the same host: " + me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6fileurl2fofc' size=20> " + me.htmlCls.buttonStr + "reload_ccp4fileurl2fofc' style='margin: 6px 20px 0 0;'>Load CCP4" + me.htmlCls.buttonStr + "reload_mtzfileurl2fofc' style='margin: 6px 20px 0 0;'>Load MTZ" + me.htmlCls.buttonStr + "reload_rcsbmtzfileurl2fofc' style='margin-top: 6px;'>Load RCSB MTZ
";
html += "fofc contour at default threshold or at: "
+ me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6sigmaurlfofc' value='' size=8> σ ";
- html += "URL in the same host: " + me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6fileurlfofc' size=20> " + me.htmlCls.buttonStr + "reload_dsn6fileurlfofc' style='margin: 6px 20px 0 0;'>Load DSN6" + me.htmlCls.buttonStr + "reload_ccp4fileurlfofc' style='margin: 6px 20px 0 0;'>Load CCP4" + me.htmlCls.buttonStr + "reload_mtzfileurlfofc' style='margin: 6px 20px 0 0;'>Load MTZ" + me.htmlCls.buttonStr + "reload_rcsbmtzfileurlfofc' style='margin-top: 6px;'>Load RCSB MTZ
";
+ //html += "URL in the same host: " + me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6fileurlfofc' size=20> " + me.htmlCls.buttonStr + "reload_dsn6fileurlfofc' style='margin: 6px 20px 0 0;'>Load DSN6" + me.htmlCls.buttonStr + "reload_ccp4fileurlfofc' style='margin: 6px 20px 0 0;'>Load CCP4" + me.htmlCls.buttonStr + "reload_mtzfileurlfofc' style='margin: 6px 20px 0 0;'>Load MTZ" + me.htmlCls.buttonStr + "reload_rcsbmtzfileurlfofc' style='margin-top: 6px;'>Load RCSB MTZ
";
+
+ html += "URL in the same host: " + me.htmlCls.inputTextStr + "id='" + me.pre + "dsn6fileurlfofc' size=20> " + me.htmlCls.buttonStr + "reload_ccp4fileurlfofc' style='margin: 6px 20px 0 0;'>Load CCP4" + me.htmlCls.buttonStr + "reload_mtzfileurlfofc' style='margin: 6px 20px 0 0;'>Load MTZ" + me.htmlCls.buttonStr + "reload_rcsbmtzfileurlfofc' style='margin-top: 6px;'>Load RCSB MTZ
";
html += me.htmlCls.buttonStr + "elecmapNo5'>Remove Map ";
@@ -15661,8 +15680,9 @@ var icn3d = (function (exports) {
html += "";
- html += me.htmlCls.divStr + "dl_anglemanysets' class='" + dialogClass + "'>";
+ html += me.htmlCls.divStr + "dl_anglemanysets' class='" + dialogClass + "' style='max-width:500px'>";
html += this.addNotebookTitle('dl_anglemanysets', 'Measure angles among many sets');
+ html += me.htmlCls.spanNowrapStr + "Note: Each set is represented by a vector, which is the X-axis of the principle axes. The angles between the vectors are then calculated.
";
html += me.htmlCls.spanNowrapStr + "1. Select sets for pairwise angles ";
html += "
";
@@ -15984,8 +16004,8 @@ var icn3d = (function (exports) {
html += "Z: " + me.htmlCls.inputTextStr + "id='" + me.pre + "v2Z' value='' size=6> ";
html += " ";
- html += me.htmlCls.buttonStr + "measure_angle'>Measure Angle";
- html += "The angle is: " + me.htmlCls.inputTextStr + "id='" + me.pre + "angle_value' value='' size=6> degree.";
+ html += me.htmlCls.buttonStr + "measure_angle'>Measure Angle
";
+ html += "The angle is: " + me.htmlCls.inputTextStr + "id='" + me.pre + "angle_value' value='' size=6> degree.
",e+=s+this.setIcon(t,"tool_pdbfile","Input PDB Files (appendable)","file-alt")+"",e+=s+this.setIcon(t,"tool_sharelink","Get Share Link","link")+"",e+=s+this.setIcon(t,"saveimage","Save iCn3D PNG Image","camera")+"",e+=i+this.setIcon(t,"tool_definedsets","Defined Sets","object-group")+"",e+=s+this.setIcon(t,"tool_aroundsphere","Select by Distance","dot-circle")+"",e+=s+this.setIcon(t,"tool_saveselection","Save Selection as a Set","save")+"",e+=s+this.setIcon(t,"toggleHighlight","Toggle Highlight","highlighter")+"",e+=i+this.setIcon(t,"show_selected","View Selection","eye")+"",e+=s+this.setIcon(t,"tool_selectedcenter","Zoom in Selection","search-plus")+"",e+=s+this.setIcon(t,"alternate","Alternate the Structures by keying the letter 'a'","a",void 0,!0,!0)+"",e+=s+this.setIcon(t,"tool_resetOrientation","Reset Orientation","undo-alt")+"",e+=i+this.setIcon(t,"tool_proteinsRibbon","Style Ribbon for proteins","dna")+"",e+=s+this.setIcon(t,"tool_proteinsSphere","Style Sphere for proteins","volleyball-ball")+"",e+=s+this.setIcon(t,"tool_surfaceVDW","Show Van der Waals Surface","cloud")+"",e+=s+this.setIcon(t,"tool_bkgd","Toggle Background Color","adjust")+"",e+=i+this.setIcon(t,"tool_clrRainbowChain","Color Rainbow for Chains","rainbow")+"",e+=s+this.setIcon(t,"tool_clrSSGreen","Color by Secondary Structures","ring")+"",e+=s+this.setIcon(t,"tool_clrChain","Color by Chains","layer-group")+"",e+=s+this.setIcon(t,"tool_clrAtom","Color by Atoms","atom")+"",e+=i+this.setIcon(t,"tool_selectannotations","Sequences & Annotations","grip-lines")+"",e+=s+this.setIcon(t,"hbondsYes","Interactions","users")+"",e+=s+this.setIcon(t,"tool_delphi","Delphi Potentials","cloud-meatball")+"",e+=s+this.setIcon(t,"removeLabels","Remove Labels","remove-format")+"",e+=i+this.setIcon("link","tool-gallery","Gallery","image","https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#gallery")+"",e+=s+this.setIcon("link","tool-video","Videos","file-video","https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#videos")+"",e+=s+this.setIcon("link","tool-github","iCn3D GitHub","code","https://github.com/ncbi/icn3d")+"",e+=s+this.setIcon("link","tool-hints","Transform Hints","info-circle","https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#useicn3d")+"",e+="
",t+="",t+=this.getMenuText("mn1_retrievebyid","Retrieve by ID",void 0,1,1),t+="
",t+=this.getLink("mn1_mmdbafid","PDB/MMDB/AlphaFold IDs"+e.htmlCls.wifiStr,1,2),t+=this.getLink("mn1_mmdbid","NCBI MMDB ID (annotation) "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_mmtfid","RCSB BCIF/MMTF ID (fast) "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_pdbid","RCSB PDB ID "+e.htmlCls.wifiStr,void 0,2),t+=this.getMenuText("mn1_afwrap","AlphaFold Structures",void 0,void 0,2),t+="
",t+=this.getLink("mn1_afid","UniProt ID "+e.htmlCls.wifiStr,void 0,3),t+=this.getLink("mn1_refseqid","NCBI Protein Accession "+e.htmlCls.wifiStr,void 0,3),t+="
",t+=this.getLink("mn1_opmid","OPM PDB ID "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_mmcifid","RCSB mmCIF ID "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_cid","PubChem CID/Name/InchI "+e.htmlCls.wifiStr,1,2),t+="
",t+="",t+=this.getLink("mn1_sharelink","Share Link "+e.htmlCls.wifiStr,1,1),t+=this.getLink("mn1_replayon","Replay Each Step",void 0,1),t+=this.getMenuSep(),t+=this.getMenuText("mn1_menuwrap","Customize Menus",void 0,1,1),t+="
",t+=this.getRadio("mn5_surface","mn5_surfaceVDW","Van der Waals",void 0,1,2),t+=this.getRadio("mn5_surface","mn5_surfaceVDWContext","VDW with Context",void 0,void 0,2),t+=this.getRadio("mn5_surface","mn5_surfaceMolecular","Molecular Surface",void 0,1,2),t+=this.getRadio("mn5_surface","mn5_surfaceMolecularContext","MS with Context",void 0,void 0,2),t+=this.getRadio("mn5_surface","mn5_surfaceSAS","Solvent Accessible",void 0,1,2),t+=this.getRadio("mn5_surface","mn5_surfaceSASContext","SA with Context",void 0,void 0,2),t+="
",t+="",t+=this.getMenuSep(),t+=this.getLink("mn5_cartoonshape","Cartoon for a Set",void 0,1),t+=this.getLink("mn5_linebtwsets","Line btw. Two Sets",void 0,1),void 0===e.cfg.cid&&void 0===e.cfg.align&&void 0===e.cfg.chainalign&&void 0===e.cfg.mmdbaf&&(t+=this.getMenuSep(),t+=this.getLinkWrapper2("mn5_map","Electron Density","mapWrapper1",void 0,1),t+="
",t+=this.getRadio("mn4_clr","mn4_clrSSGreen","Sheet in Green",void 0,1,2),t+=this.getRadio("mn4_clr","mn4_clrSSYellow","Sheet in Yellow",void 0,1,2),t+=this.getRadio("mn4_clr","mn4_clrSSSpectrum","Spectrum",void 0,void 0,2),t+="
",t+=this.getRadio("mn6_distance","mn6_distanceYes","between Two Atoms",void 0,1,2),t+=this.getRadio("mn6_distance","mn6_distTwoSets","between Two Sets",void 0,void 0,2),t+=this.getRadio("mn6_distance","mn6_distManySets","among Many Sets",void 0,void 0,2),t+=this.getRadio("mn6_distance","mn6_distanceNo","Hide",!0,1,2),t+="
",t+=this.getRadio("mn6_angle","mn6_angleManySets","among Many Sets",void 0,1,2),t+=this.getRadio("mn6_angle","mn6_angleTwoSets","b/w Two Vectors",void 0,void 0,2),t+="
",t+="",t+=this.getMenuUrl("selhints",e.htmlCls.baseUrl+"icn3d/icn3d.html#selsubset","Selection Hints",void 0,1),t+=this.getMenuUrl("helpdesk","https://support.nlm.nih.gov/support/create-case/","Write to Help Desk",1,1),t+="
",t+="
",t}hideMenu(){let e=this.icn3dui;e.bNode||(void 0!==$("#"+e.pre+"mnlist")[0]&&($("#"+e.pre+"mnlist")[0].style.display="none"),void 0!==$("#"+e.pre+"mnLogSection")[0]&&($("#"+e.pre+"mnLogSection")[0].style.display="none"),void 0!==$("#"+e.pre+"cmdlog")[0]&&($("#"+e.pre+"cmdlog")[0].style.display="none"),$("#"+e.pre+"title")[0].style.margin="10px 0 0 10px")}showMenu(){let e=this.icn3dui;e.bNode||(void 0!==$("#"+e.pre+"mnlist")[0]&&($("#"+e.pre+"mnlist")[0].style.display="block"),void 0!==$("#"+e.pre+"mnLogSection")[0]&&($("#"+e.pre+"mnLogSection")[0].style.display="block"),void 0!==$("#"+e.pre+"cmdlog")[0]&&($("#"+e.pre+"cmdlog")[0].style.display="block"))}}class c{constructor(e){this.icn3dui=e}openDlg(e,t){let s=this.icn3dui;s.icn3d,s.bNode||(e=s.pre+e,s.cfg.notebook?this.openDlgNotebook(e,t):this.openDlgRegular(e,t),s.htmlCls.themecolor||(s.htmlCls.themecolor="blue"),s.htmlCls.setMenuCls.setTheme(s.htmlCls.themecolor))}addSaveButton(e){let t=this.icn3dui;t.icn3d,t.bNode||void 0!==this.dialogHashSave&&this.dialogHashSave.hasOwnProperty(e)||($("#"+e).parent().children(".ui-dialog-titlebar").append(""),void 0===this.dialogHashSave&&(this.dialogHashSave={}),this.dialogHashSave[e]=1)}addHideButton(e){let t=this.icn3dui;t.icn3d,t.bNode||void 0!==this.dialogHashHide&&this.dialogHashHide.hasOwnProperty(e)||($("#"+e).parent().children(".ui-dialog-titlebar").append(""),void 0===this.dialogHashHide&&(this.dialogHashHide={}),this.dialogHashHide[e]=1)}getDialogStatus(){let e=this.icn3dui;if(e.icn3d,e.bNode)return;let t={},s={},i=$("#"+e.pre+"dl_selectannotations").hasClass("ui-dialog-content"),n=$("#"+e.pre+"dl_graph").hasClass("ui-dialog-content"),l=$("#"+e.pre+"dl_linegraph").hasClass("ui-dialog-content"),r=$("#"+e.pre+"dl_scatterplot").hasClass("ui-dialog-content"),o=$("#"+e.pre+"dl_contactmap").hasClass("ui-dialog-content"),a=$("#"+e.pre+"dl_alignerrormap").hasClass("ui-dialog-content"),d=$("#"+e.pre+"dl_interactionsorted").hasClass("ui-dialog-content"),c=$("#"+e.pre+"dl_alignment").hasClass("ui-dialog-content"),h=$("#"+e.pre+"dl_2ddgm").hasClass("ui-dialog-content"),p=$("#"+e.pre+"dl_2dctn").hasClass("ui-dialog-content"),m=$("#"+e.pre+"dl_definedsets").hasClass("ui-dialog-content");return t.bSelectannotationsInit2=!1,t.bGraph2=!1,t.bLineGraph2=!1,t.bScatterplot2=!1,t.bTable2=!1,t.bAlignmentInit2=!1,t.bTwoddgmInit2=!1,t.bTwodctnInit2=!1,t.bSetsInit2=!1,s.dl_selectannotations="bSelectannotationsInit2",s.dl_graph="bGraph2",s.dl_linegraph="bLineGraph2",s.dl_scatterplot="bScatterplot2",s.dl_contactmap="bContactmap2",s.dl_alignerrormap="bAlignerrormap2",s.dl_interactionsorted="bTable2",s.dl_alignment="bAlignmentInit2",s.dl_2ddgm="bTwoddgmInit2",s.dl_2dctn="bTwodctnInit2",s.dl_definedsets="bSetsInit2",i&&(t.bSelectannotationsInit2=$("#"+e.pre+"dl_selectannotations").dialog("isOpen")),n&&(t.bGraph2=$("#"+e.pre+"dl_graph").dialog("isOpen")),l&&(t.bLineGraph2=$("#"+e.pre+"dl_linegraph").dialog("isOpen")),r&&(t.bScatterplot2=$("#"+e.pre+"dl_scatterplot").dialog("isOpen")),o&&(t.bContactmap2=$("#"+e.pre+"dl_contactmap").dialog("isOpen")),a&&(t.bAlignerror2=$("#"+e.pre+"dl_alignerrormap").dialog("isOpen")),d&&(t.bTable2=$("#"+e.pre+"dl_interactionsorted").dialog("isOpen")),c&&(t.bAlignmentInit2=$("#"+e.pre+"dl_alignment").dialog("isOpen")),h&&(t.bTwoddgmInit2=$("#"+e.pre+"dl_2ddgm").dialog("isOpen")),p&&(t.bTwodctnInit2=$("#"+e.pre+"dl_2dctn").dialog("isOpen")),m&&(t.bSetsInit2=$("#"+e.pre+"dl_definedsets").dialog("isOpen")),{status:t,id2flag:s}}openDlgHalfWindow(e,t,s,i){let n=this.icn3dui,l=n.icn3d;if(n.bNode)return;let r=this,o=n.htmlCls.width2d+20;l.resizeCanvasCls.resizeCanvas(n.htmlCls.WIDTH-s,n.htmlCls.HEIGHT,i);let a,d=n.htmlCls.HEIGHT,c=s;a=!n.cfg.showmenu||n.utilsCls.isMobile()||n.cfg.mobilemenu?{my:"left top",at:"right top",of:"#"+n.pre+"viewer",collision:"none"}:{my:"left top",at:"right top+40",of:"#"+n.pre+"viewer",collision:"none"},n.cfg.resize=!1,window.dialog=$("#"+e).dialog({autoOpen:!0,title:t,height:d,width:c,modal:!1,position:a,close:function(t){let s=r.getDialogStatus(),i=s.status,a=s.id2flag,d=!1;for(let t in a){let s=e===n.pre+t;for(let e in i)i.hasOwnProperty(e)||(s=s&&!i[e]);d=d||s}if(d)if(i.bTwoddgmInit2||i.bTwodctnInit2||i.bSetsInit2){let e=n.utilsCls.isMobile()?n.htmlCls.WIDTH:n.htmlCls.WIDTH-o;l.resizeCanvasCls.resizeCanvas(e,n.htmlCls.HEIGHT,!0),i.bTwoddgmInit2&&r.openDlg2Ddgm(n.pre+"dl_2ddgm",void 0,i.bSetsInit2),i.bTwodctnInit2&&r.openDlg2Ddgm(n.pre+"dl_2dctn",void 0,i.bSetsInit2),i.bSetsInit2&&r.openDlg2Ddgm(n.pre+"dl_definedsets")}else l.resizeCanvasCls.resizeCanvas(n.htmlCls.WIDTH,n.htmlCls.HEIGHT,!0)},resize:function(t){if(e==n.pre+"dl_selectannotations")l.annotationCls.hideFixedTitle();else if(e==n.pre+"dl_graph"){let t=$("#"+e).width(),s=$("#"+e).height();d3.select("#"+n.svgid).attr("width",t).attr("height",s)}else if(e==n.pre+"dl_linegraph"||e==n.pre+"dl_scatterplot"||e==n.pre+"dl_contactmap"||e==n.pre+"dl_alignerrormap"){let t=status.bTwoddgmInit2||status.bSetsInit2?(n.htmlCls.WIDTH-o)/2:n.htmlCls.WIDTH/2,s=$("#"+e).width()/t;if(e==n.pre+"dl_linegraph"){let e=l.linegraphWidth*s;$("#"+n.linegraphid).attr("width",e)}else if(e==n.pre+"dl_scatterplot"){let e=l.scatterplotWidth*s;$("#"+n.scatterplotid).attr("width",e)}else if(e==n.pre+"dl_contactmap"){let e=l.contactmapWidth*s;$("#"+n.contactmapid).attr("width",e)}else if(e==n.pre+"dl_alignerrormap"){let e=l.alignerrormapWidth*s;$("#"+n.alignerrormapid).attr("width",e)}}}}),this.addSaveButton(e),this.addHideButton(e)}openDlg2Ddgm(e,t,s){let i=this.icn3dui,n=i.icn3d;if(i.bNode)return;let l,r,o=this,a=i.htmlCls.width2d+20;e===i.pre+"dl_definedsets"?(l="right top",r="Select sets"):e!==i.pre+"dl_2ddgm"&&e!==i.pre+"dl_2dctn"||(l=s?"right top+240":"right top",r=e===i.pre+"dl_2ddgm"?"2D Diagram":"2D Cartoon");let d={my:"left top+"+i.htmlCls.MENU_HEIGHT,at:l,of:"#"+i.pre+"viewer",collision:"none"};window.dialog=$("#"+e).dialog({autoOpen:!0,title:r,height:"auto",width:a,modal:!1,position:d,close:function(e){let t=o.getDialogStatus().status;t.bSelectannotationsInit2||t.bGraph2||t.bLineGraph2||t.bScatterplot2||t.bTable2||t.bAlignmentInit2||n.resizeCanvasCls.resizeCanvas(i.htmlCls.WIDTH,i.htmlCls.HEIGHT,!0)},resize:function(t,s){e==i.pre+"dl_2dctn"&&(n.resizeRatioX=s.size.width/i.htmlCls.width2d,n.resizeRatioY=s.size.height/(i.htmlCls.width2d+70))},resizeStop:function(e,t){n.resizeRatioX=t.size.width/i.htmlCls.width2d,n.resizeRatioY=t.size.height/(i.htmlCls.width2d+70)}}),this.addSaveButton(e),this.addHideButton(e)}openDlgRegular(e,t){let s=this.icn3dui,i=s.icn3d;if(s.bNode)return;let n=400,l=150,r=s.htmlCls.width2d+20,o=this.getDialogStatus().status;if(e===s.pre+"dl_selectannotations"||e===s.pre+"dl_graph"||e===s.pre+"dl_linegraph"||e===s.pre+"dl_scatterplot"||e===s.pre+"dl_contactmap"||e===s.pre+"dl_alignerrormap"||e===s.pre+"dl_interactionsorted"||e===s.pre+"dl_alignment"){let a=.5*s.htmlCls.WIDTH-.5*r;if(s.htmlCls.WIDTH>=s.htmlCls.HEIGHT)this.openDlgHalfWindow(e,t,a,!0),(o.bTwoddgmInit2||o.bTwodctnInit2||o.bSetsInit2)&&(i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH-a-r,s.htmlCls.HEIGHT,!0),o.bTwoddgmInit2&&this.openDlg2Ddgm(s.pre+"dl_2ddgm",void 0,o.bSetsInit2),o.bTwodctnInit2&&this.openDlg2Ddgm(s.pre+"dl_2dctn",void 0,o.bSetsInit2),o.bSetsInit2&&this.openDlg2Ddgm(s.pre+"dl_definedsets"));else{i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH,.5*s.htmlCls.HEIGHT,!0),l=.5*s.htmlCls.HEIGHT,n=s.htmlCls.WIDTH;let a={my:"left top",at:"left bottom+32",of:"#"+s.pre+"canvas",collision:"none"};window.dialog=$("#"+e).dialog({autoOpen:!0,title:t,height:l,width:n,modal:!1,position:a,close:function(t){if(!((e!==s.pre+"dl_selectannotations"||o.bAlignmentInit2||o.bGraph2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_graph"||o.bSelectannotationsInit2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_alignment"||o.bSelectannotationsInit2||o.bGraph2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_interactionsorted"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_linegraph"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_scatterplot"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_contactmap"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bAlignerrormap2)&&(e!==s.pre+"dl_alignerrormap"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2)))if(o.bTwoddgmInit2||o.bTwodctnInit2||o.bSetsInit2){let e=s.utilsCls.isMobile()?s.htmlCls.WIDTH:s.htmlCls.WIDTH-r;i.resizeCanvasCls.resizeCanvas(e,s.htmlCls.HEIGHT,!0),o.bTwoddgmInit2&&thisClass.openDlg2Ddgm(s.pre+"dl_2ddgm",void 0,o.bSetsInit2),o.bTwodctnInit2&&thisClass.openDlg2Ddgm(s.pre+"dl_2dctn",void 0,o.bSetsInit2),o.bSetsInit2&&thisClass.openDlg2Ddgm(s.pre+"dl_definedsets")}else i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH,s.htmlCls.HEIGHT,!0)},resize:function(t){if(e==s.pre+"dl_selectannotations")i.annotationCls.hideFixedTitle();else if(e==s.pre+"dl_graph"){let t=$("#"+e).width(),i=$("#"+e).height();d3.select("#"+s.svgid).attr("width",t).attr("height",i)}else if(e==s.pre+"dl_linegraph"||e==s.pre+"dl_scatterplot"||e==s.pre+"dl_contactmap"||e==s.pre+"dl_alignerrormap"){let t=o.bTwoddgmInit2||o.bSetsInit2?(s.htmlCls.WIDTH-r)/2:s.htmlCls.WIDTH/2,n=$("#"+e).width()/t;if(e==s.pre+"dl_linegraph"){let e=i.linegraphWidth*n;$("#"+s.linegraphid).attr("width",e)}else if(e==s.pre+"dl_scatterplot"){let e=i.scatterplotWidth*n;$("#"+s.scatterplotid).attr("width",e)}else if(e==s.pre+"dl_contactmap"){let e=i.contactmapWidth*n;$("#"+s.contactmapid).attr("width",e)}else if(e==s.pre+"dl_alignerrormap"){let e=i.alignerrormapWidth*n;$("#"+s.alignerrormapid).attr("width",e)}}}}),this.addSaveButton(e),this.addHideButton(e)}}else if(e===s.pre+"dl_2ddgm"||e===s.pre+"dl_2dctn"){let t=0;if(s.htmlCls.WIDTH>=s.htmlCls.HEIGHT)(o.bSelectannotationsInit2||o.bGraph2||o.bLineGraph2||o.bScatterplot2||o.bTable2||o.bAlignmentInit2)&&(t=.5*s.htmlCls.WIDTH-.5*r),i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH-t-r,s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e,void 0,o.bSetsInit2);else{let t=s.utilsCls.isMobile()?s.htmlCls.WIDTH:s.htmlCls.WIDTH-r;i.resizeCanvasCls.resizeCanvas(t,.5*s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e,.5*s.htmlCls.HEIGHT),this.openDlg2Ddgm(e,.5*s.htmlCls.HEIGHT,o.bSetsInit2)}}else{let a;if(l="auto",n="auto",e===s.pre+"dl_addtrack"?n="50%":e===s.pre+"dl_menupref"&&(n=600,l=500),e===s.pre+"dl_definedsets"){let t=0;if(s.htmlCls.WIDTH>=s.htmlCls.HEIGHT)(o.bSelectannotationsInit2||o.bGraph2||o.bLineGraph2||o.bScatterplot2||o.bTable2||o.bAlignmentInit2)&&(t=.5*s.htmlCls.WIDTH-.5*r),i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH-t-r,s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e),o.bTwoddgmInit2&&this.openDlg2Ddgm(s.pre+"dl_2ddgm",void 0,!0),o.bTwodctnInit2&&this.openDlg2Ddgm(s.pre+"dl_2dctn",void 0,!0);else{let t=s.utilsCls.isMobile()?s.htmlCls.WIDTH:s.htmlCls.WIDTH-r;i.resizeCanvasCls.resizeCanvas(t,.5*s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e,.5*s.htmlCls.HEIGHT),o.bTwoddgmInit2&&this.openDlg2Ddgm(s.pre+"dl_2ddgm",.5*s.htmlCls.HEIGHT,!0),o.bTwodctnInit2&&this.openDlg2Ddgm(s.pre+"dl_2dctn",.5*s.htmlCls.HEIGHT,!0)}}else s.utilsCls.isMobile()?a={my:"left top",at:"left bottom-50",of:"#"+s.pre+"canvas",collision:"none"}:e===s.pre+"dl_allinteraction"||e===s.pre+"dl_buriedarea"?(a={my:"right top",at:"right top+50",of:"#"+i.divid,collision:"none"},n=700,l=500):a=e===s.pre+"dl_rmsd"||e===s.pre+"dl_legend"?{my:"left bottom",at:"left+20 bottom-20",of:"#"+s.pre+"canvas",collision:"none"}:e===s.pre+"dl_symd"?{my:"left top",at:"right-200 bottom-200",of:"#"+s.pre+"canvas",collision:"none"}:s.cfg.align?{my:"left top",at:"left top+90",of:"#"+s.pre+"canvas",collision:"none"}:e===s.pre+"dl_mmdbafid"?{my:"left top",at:"left top+130",of:"#"+s.pre+"canvas",collision:"none"}:{my:"left top",at:"left top+50",of:"#"+s.pre+"canvas",collision:"none"},window.dialog=$("#"+e).dialog({autoOpen:!0,title:t,height:l,width:n,modal:!1,position:a}),this.addSaveButton(e),this.addHideButton(e)}$(".ui-dialog .ui-button span").removeClass("ui-icon-closethick").addClass("ui-icon-close")}openDlgNotebook(e,t){let s=this.icn3dui,i=s.icn3d;if(s.bNode)return;let n=400,l=150,r=s.htmlCls.width2d+20;e===s.pre+"dl_selectannotations"||e===s.pre+"dl_graph"||e===s.pre+"dl_linegraph"||e===s.pre+"dl_scatterplot"||e===s.pre+"dl_contactmap"||e===s.pre+"dl_alignerrormap"||e===s.pre+"dl_interactionsorted"||e===s.pre+"dl_alignment"?($("#"+e).show(),$("#"+e+"_nb").show(),$("#"+e+"_title").html(t),l=.5*s.htmlCls.HEIGHT,n=s.htmlCls.WIDTH,$("#"+e).width(n),$("#"+e).height(l),$("#"+e).resize((function(t){let n=s.htmlCls.WIDTH/2,l=$("#"+e).width()/n;if(e==s.pre+"dl_selectannotations")i.annotationCls.hideFixedTitle();else if(e==s.pre+"dl_graph"){let t=$("#"+e).width(),i=$("#"+e).height();d3.select("#"+s.svgid).attr("width",t).attr("height",i)}else if(e==s.pre+"dl_linegraph"){let e=i.linegraphWidth*l;$("#"+s.linegraphid).attr("width",e)}else if(e==s.pre+"dl_scatterplot"){let e=i.scatterplotWidth*l;$("#"+s.scatterplotid).attr("width",e)}else if(e==s.pre+"dl_contactmap"){let e=i.contactmapWidth*l;$("#"+s.contactmapid).attr("width",e)}else if(e==s.pre+"dl_alignerrormap"){let e=i.alignerrormapWidth*l;$("#"+s.alignerrormapid).attr("width",e)}}))):(i.bRender&&($("#"+e).show(),$("#"+e+"_nb").show(),$("#"+e+"_title").html(t)),l="auto",n="auto",e===s.pre+"dl_addtrack"?n="50%":e===s.pre+"dl_2ddgm"||e===s.pre+"dl_2dctn"||e===s.pre+"dl_definedsets"?n=r:e!==s.pre+"dl_allinteraction"&&e!==s.pre+"dl_buriedarea"||(n=700,l=500),$("#"+e).width(n),$("#"+e).height(l))}}class h{constructor(e){this.icn3dui=e}setCustomDialogs(){let e=this.icn3dui;if(e.icn3d,e.bNode)return"";return""}getHtmlAlignResidueByResidue(e,t,s){let i=this.icn3dui;i.icn3d;let n="";return n+="All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).
',s+="",s+=e.htmlCls.divStr+"dl_command' style='display:none;'>",s+=e.htmlCls.divStr+"dl_setoperations'>",s+=" ",s+=" ",s+="",s+=" ",s+=e.htmlCls.setHtmlCls.setAdvanced(),s+="",s+="",s+=e.htmlCls.setHtmlCls.setAdvanced(2),s+=e.htmlCls.divStr+"dl_vastplus' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_vastplus","Please input PDB ID for VAST+"),s+="Note: VAST+ finds other macromolecular structures that have a similar biological unit. To do this, VAST+ takes into consideration the complete set of 3D domains that VAST identified within a query structure, throughout all of its component protein molecules, and finds other macromolecular structures that have a similar set of proteins/3D domains.
",s+="PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"vastpluspdbid' value='6VXX' size=8> ",s+=e.htmlCls.buttonStr+"reload_vastplus'>VAST+",s+="",s+=e.htmlCls.divStr+"dl_vast' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_vast","Pleaes input chain or PDB file for VAST"),s+="Note: VAST identifies 3D domains (substructures) within each protein structure in the Molecular Modeling Database (MMDB), and then finds other protein structures that have one or more similar 3D domains, using purely geometric criteria. You have two ways to do a VAST search.
",s+="Option 1, search with your selection (all residues are selected by default) in the loaded structures: ",s+=' ",s+="Option 2, search with PDB ID and chain name: ",s+="PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"vastpdbid' value='4N7N' size=8> ",s+="Chain Name: "+e.htmlCls.inputTextStr+"id='"+e.pre+"vastchainid' value='A' size=8> ",s+=e.htmlCls.buttonStr+"reload_vast'>VAST
",s+="Option 3, search with a PDB file: ",s+=' ",s+="",s+=e.htmlCls.divStr+"dl_foldseek' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_foldseek","Submit your selection to Foldseek"),s+='1. your selection (all residues are selected by default) in the loaded structures to Foldseek web server.
',s+='2 (Optional). Once you see the structure neighbors, you can view the alignment in iCn3D by inputing a list of PDB chain IDs or AlphaFold UniProt IDs below.
The PDB chain IDs are the same as the record names such as "1HHO_A". The UniProt ID is the text between "AF-" and "-F1". For example, the UniProt ID for the record name "AF-P69905-F1-model_v4" is "P69905".
',s+="Chain ID List: "+e.htmlCls.inputTextStr+"id='"+e.pre+"foldseekchainids' value='P69905,P01942,1HHO_A' size=30> ",s+=e.htmlCls.buttonStr+"reload_foldseek'>Align",s+="",s+=e.htmlCls.divStr+"dl_mmtfid' class='"+n+"'>",s+=this.addNotebookTitle("dl_mmtfid","Please input an BCIF/MMTF ID"),s+="BCIF/MMTF ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmtfid' value='1TUP' size=8> ",s+=e.htmlCls.buttonStr+"reload_mmtf'>Load",s+="",s+=e.htmlCls.divStr+"dl_pdbid' class='"+n+"'>",s+=this.addNotebookTitle("dl_pdbid","Please input a PDB ID"),s+="PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"pdbid' value='1TUP' size=8> ",s+=e.htmlCls.buttonStr+"reload_pdb'>Load",s+="",s+=e.htmlCls.divStr+"dl_afid' class='"+n+"'>",s+=this.addNotebookTitle("dl_afid","Please input an AlphaFold UniProt ID"),s+="Note: AlphaFold produces a per-residue confidence score (pLDDT) between 0 and 100: ",s+=e.htmlCls.clickMenuCls.setAlphaFoldLegend()+" ";let o=e.cfg.afid?e.cfg.afid:"A4D1S0";s+="AlphaFold Uniprot ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"afid' value='"+o+"' size=10>
",s+="PAE Map: "+e.htmlCls.buttonStr+"reload_afmap'>Load Half"+e.htmlCls.buttonStr+"reload_afmapfull' style='margin-left:30px'>Load Full (slow)",s+="",s+=e.htmlCls.divStr+"dl_refseqid' class='"+n+"'>",s+=this.addNotebookTitle("dl_refseqid","Please input an NCBI protein accession"),s+="NCBI Protein Accession: "+e.htmlCls.inputTextStr+"id='"+e.pre+"refseqid' value='NP_001743.1' size=8> ",s+=e.htmlCls.buttonStr+"reload_refseq'>Load",s+="",s+=e.htmlCls.divStr+"dl_opmid' class='"+n+"'>",s+=this.addNotebookTitle("dl_opmid","Please input an OPM PDB ID"),s+="Orientations of Proteins in Membranes(OPM) PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"opmid' value='6JXR' size=8> ",s+=e.htmlCls.buttonStr+"reload_opm'>Load",s+="",s+=e.htmlCls.divStr+"dl_pdbfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_pdbfile","Please input a PDB file"),s+='Note: Several PDB files could be concatenated into a single PDB file. Use the line "ENDMDL" to separate PDB files.
',s+="PDB File: "+e.htmlCls.inputFileStr+" id='"+e.pre+"pdbfile' size=8> ",s+=e.htmlCls.buttonStr+"reload_pdbfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_pdbfile_app' class='"+n+"'>",s+=this.addNotebookTitle("dl_pdbfile_app","Please append PDB files"),s+="Multiple PDB Files: ",s+=e.htmlCls.buttonStr+"reload_pdbfile_app'>Append",s+="",s+=e.htmlCls.divStr+"dl_rescolorfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_rescolorfile","Please input a residue color file"),s+='
The custom JSON file on residue colors has the following format for proteins("ALA" and "ARG") and nucleotides("G" and "A"): ',s+='{"ALA":"#C8C8C8", "ARG":"#145AFF", ..., "G":"#008000", "A":"#6080FF", ...}
',s+="Residue Color File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"rescolorfile' size=8> ",s+=e.htmlCls.buttonStr+"reload_rescolorfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_customcolor' class='"+n+"'>",s+=this.addNotebookTitle("dl_customcolor","Please input a custom color file"),s+=" ",s+='
The custom file for the structure has two columns separated by space or tab: ',s+='residue number, and score in the range of 0-100. If you click "Apply Custom Color" button, ',s+='the scores 0, 50 and 100 correspond to the three colors specified below. If you click "Apply Custom Tube", ',s+='the selected residues will be displayed in a style similar to "B-factor Tube".
",s+="2. "+e.htmlCls.buttonStr+"reload_customtubefile'>Apply Custom Tube",s+="",s+=e.htmlCls.divStr+"dl_customref' class='"+n+"'>",s+=this.addNotebookTitle("dl_customref","Please input a reference number file"),s+='
You can define your own reference numbers in a custom file using Excel, and then export it as a CSV file. An example file is shown below with cells separated by commas. ',s+="
",s+="1TUP_C,,,,,,,200,201,230",s+='The first row defines the reference residue numbers, which could be any strings. The 1st cell could be anything. The rest cells are reference residue numbers (e.g., 11, 21, 10C, etc.) or empty cells. Each chain has a separate row. The first cell of the second row is the chain ID "1TUP_A". The rest cells are the corresponding real residue numbers for reference residue numbers in the first row. For example, the reference numbers for residues 100, 101, and 132 in the chain 1TUP_A are 11, 12, and 22, respectively. The fourth row shows another set of reference numners for the chain "1TUP_C". It could be a chain from a different structure.
',s+='To select all residues corresponding to the reference numbers, you can simplay replace ":" with "%" in the Specification. For example, "%12" selects the residue 101 in 1TUP_A and the residue 111 in 1TUP_B. ".A%12" has the chain "A" filter and selects the residue 101 in 1TUP_A. ',s+="
",s+=e.htmlCls.buttonStr+"reload_customreffile'>Apply Custom Reference Numbers",s+="",s+=e.htmlCls.divStr+"dl_align' class='"+n+"'>",s+=this.addNotebookTitle("dl_align","Please select residues in aligned sequences"),s+="Enter the PDB IDs or MMDB IDs of the structures:
",s+="VAST+ based on VAST: "+e.htmlCls.buttonStr+"reload_align_ori'>All Matching Molecules Superposed"+e.htmlCls.space3+e.htmlCls.buttonStr+"reload_align_refined'>Invariant Substructure Superposed
",s+="VAST+ based on TM-align: "+e.htmlCls.buttonStr+"reload_align_tmalign'>All Matching Molecules Superposed
",s+="",s+=e.htmlCls.divStr+"dl_alignaf' class='"+n+"'>",s+=this.addNotebookTitle("dl_alignaf","Align AlphaFold structures"),s+="Enter two AlphaFold Uniprot IDs:
",s+=e.htmlCls.buttonStr+"reload_alignaf_tmalign'>Align with TM-align"+e.htmlCls.buttonStr+"reload_alignaf' style='margin-left:30px'>Align with VAST",s+="",s+=e.htmlCls.divStr+"dl_chainalign' class='"+n+"'>",s+=this.addNotebookTitle("dl_chainalign","Align chains"),s+="
",s+="All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).
",s+=e.htmlCls.buttonStr+"reload_chainalign_tmalign'>Align with TM-align"+e.htmlCls.buttonStr+"reload_chainalign_asym' style='margin-left:30px'>Align with VAST
",s+='(Note: To align chains in custom PDB files, you could load them in "File > Open File > PDB Files (appendable)" and click "Analysis > Defined Sets". Finally select multiple chains in Defined Sets and click "File > Realign Selection".)
",s+="All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).
",s+="The sequence alignment (followed by structure alignment) is based on residue numbers in the First/Master chain: "+e.htmlCls.inputTextStr+"id='"+e.pre+"resalignids' value='1,5,10-50' size=50> ",s+=e.htmlCls.buttonStr+"reload_chainalign_asym2' style='margin-top:3px;'>Align by Sequence Alignment
",s+='(Note: To align chains in custom PDB files, you could load them in "File > Open File > PDB Files (appendable)" and click "Analysis > Defined Sets". Finally select multiple chains in Defined Sets and click "File > Realign Selection".)
",s+='Please specify the mutations with a comma separated mutation list. Each mutation can be specified as "[uppercase PDB ID or AlphaFold UniProt ID]_[Chain Name]_[Residue Number]_[One Letter Mutant Residue]". E.g., the mutation of N501Y in the E chain of PDB 6M0J can be specified as "6M0J_E_501_Y". For AlphaFold structures, the "Chain ID" is "A". If you load a custom structure without PDB or UniProt ID, you can open "Seq. & Annotations" window and find the chain ID such as "stru_A". The part before the underscore is the structure ID, which can be used to specify the mutation such as "stru_A_...". Remember to choose "Show Mutation in: Current Page".
',s+=e.htmlCls.buttonStr+"reload_mutation_3d' title='Show the mutations in 3D using the scap program'>3D with scap",s+=e.htmlCls.buttonStr+"reload_mutation_inter' style='margin-left:20px' title='Show the mutations in 3D and the change of interactions'>Interactions",s+=e.htmlCls.buttonStr+"reload_mutation_pdb' style='margin-left:20px' title='Show the mutations in 3D and export the PDB of the mutant within 10 angstrom'>PDB",s+="
",s+=e.htmlCls.divStr+"dl_mol2file' class='"+n+"'>",s+=this.addNotebookTitle("dl_mol2file","Please input a Mol2 file"),s+="Mol2 File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"mol2file' size=8> ",s+=e.htmlCls.buttonStr+"reload_mol2file'>Load",s+="",s+=e.htmlCls.divStr+"dl_sdffile' class='"+n+"'>",s+=this.addNotebookTitle("dl_sdffile","Please input an SDF file"),s+="SDF File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"sdffile' size=8> ",s+=e.htmlCls.buttonStr+"reload_sdffile'>Load",s+="",s+=e.htmlCls.divStr+"dl_xyzfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_xyzfile","Please input an XYZ file"),s+="XYZ File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"xyzfile' size=8> ",s+=e.htmlCls.buttonStr+"reload_xyzfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_afmapfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_afmapfile","Please input an AlphaFold PAE file"),s+="AlphaFold PAE File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"afmapfile' size=8>
",s+=e.htmlCls.buttonStr+"reload_afmapfile'>Load Half PAE Map"+e.htmlCls.buttonStr+"reload_afmapfilefull' style='margin-left:30px'>Load Full PAE Map (slow)",s+="",s+=e.htmlCls.divStr+"dl_urlfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_urlfile","Please input a file via URL"),s+="File type: ",s+=" ",s+="URL in the same host: "+e.htmlCls.inputTextStr+"id='"+e.pre+"urlfile' size=20> ",s+=e.htmlCls.buttonStr+"reload_urlfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_mmciffile' class='"+n+"'>",s+=this.addNotebookTitle("dl_mmciffile","Please append mmCIF files"),s+="Multiple mmCIF Files: ",s+=e.htmlCls.buttonStr+"reload_mmciffile'>Load",s+="",s+=e.htmlCls.divStr+"dl_mmcifid' class='"+n+"'>",s+=this.addNotebookTitle("dl_mmcifid","Please input an mmCIF ID"),s+="mmCIF ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmcifid' value='1TUP' size=8> ",s+=e.htmlCls.buttonStr+"reload_mmcif'>Load",s+="",s+=e.htmlCls.divStr+"dl_mmdbid' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_mmdbid","Please input an MMDB ID"),s+="MMDB or PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmdbid' value='1TUP' size=8>
",s+=e.htmlCls.buttonStr+"reload_mmdb'>Load Biological Unit"+e.htmlCls.buttonStr+"reload_mmdb_asym' style='margin-left:30px'>Load Asymmetric Unit (All Chains)
",s+='Note: The "biological unit" is the biochemically active form of a biomolecule,
',s+=e.htmlCls.divStr+"asu_bu' style='display:none;'>",s+='which can range from a monomer (single protein molecule) to an oligomer of 100+ protein molecules.
The "asymmetric unit" is the raw 3D structure data resolved by X-ray crystallography, NMR, or Cryo-electron microscopy. The asymmetric unit is equivalent to the biological unit in approximately 60% of structure records. In the remaining 40% of the records, the asymmetric unit represents a portion of the biological unit that can be reconstructed using crystallographic symmetry, or it represents multiple copies of the biological unit.',s+="",s+=e.htmlCls.divStr+"dl_mmdbafid' class='"+n+"' style='max-width:600px'>",s+=this.addNotebookTitle("dl_mmdbafid","Please input a list of PDB/AlphaFold IDs"),s+="List of PDB, MMDB, or AlphaFold UniProt structures: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmdbafid' placeholder='e.g., 1HHO,4N7N,P69905,P01942' size=30>
",s+=""+e.htmlCls.buttonStr+"reload_mmdbaf' style='width:150px'>Load Biological Unit"+e.htmlCls.buttonStr+"reload_mmdbaf_asym' style='margin-left:30px; width:250px'>Load Asymmetric Unit (All Chains)
",s+="
or
"+e.htmlCls.buttonStr+"reload_mmdbaf_append' style='width:150px'>Append Biological Unit"+e.htmlCls.buttonStr+"reload_mmdbaf_asym_append' style='margin-left:30px; width:250px'>Append Asymmetric Unit (All Chains)
",s+='Note: The "biological unit" is the biochemically active form of a biomolecule,
',s+=e.htmlCls.divStr+"asu_bu2' style='display:none;'>",s+='which can range from a monomer (single protein molecule) to an oligomer of 100+ protein molecules.
The "asymmetric unit" is the raw 3D structure data resolved by X-ray crystallography, NMR, or Cryo-electron microscopy. The asymmetric unit is equivalent to the biological unit in approximately 60% of structure records. In the remaining 40% of the records, the asymmetric unit represents a portion of the biological unit that can be reconstructed using crystallographic symmetry, or it represents multiple copies of the biological unit.',s+="",s+=e.htmlCls.divStr+"dl_blast_rep_id' style='max-width:600px;' class='"+n+"'>",s+=this.addNotebookTitle("dl_blast_rep_id","Align sequence to structure"),s+="Enter a Sequence ID (or FASTA sequence) and the aligned protein accession, which can be found using the BLAST search with the Sequence ID or FASTA sequence as input. If the protein accession is not a PDB chain, the corresponding AlphaFold UniProt structure is used.
",s+="Sequence ID(NCBI protein accession of a sequence): "+e.htmlCls.inputTextStr+"id='"+e.pre+"query_id' value='NP_001108451.1' size=8> ",s+="or FASTA sequence:
",s+="NCBI protein accession (or a chain of a PDB): "+e.htmlCls.inputTextStr+"id='"+e.pre+"blast_rep_id' value='1TSR_A' size=8> ",s+=e.htmlCls.buttonStr+"reload_blast_rep_id'>Align with BLAST "+e.htmlCls.wifiStr+e.htmlCls.buttonStr+"reload_alignsw' style='margin-left:30px'>Align with Global Smith-Waterman"+e.htmlCls.buttonStr+"reload_alignswlocal' style='margin-left:30px'>Align with Local Smith-Waterman",s+="",s+=e.htmlCls.divStr+"dl_esmfold' style='max-width:600px;' class='"+n+"'>",s+=this.addNotebookTitle("dl_esmfold","Sequence to structure prediction with ESMFold"),s+="The sequence to structure prediction is done via ESM Metagenomic Atlas. The sequence should be less than 400 characters. For any sequence longer than 400, please see the discussion here.
",s+="FASTA sequence:
",s+=e.htmlCls.buttonStr+"run_esmfold'>ESMFold ",s+="",s+=e.htmlCls.divStr+"dl_yournote' class='"+n+"'>",s+=this.addNotebookTitle("dl_yournote","Your Note"),s+='Your note will be saved in the HTML file when you click "File > Save File > iCn3D PNG Image".
',s+=" ",s+=e.htmlCls.buttonStr+"applyyournote'>Save",s+="",s+=e.htmlCls.divStr+"dl_proteinname' class='"+n+"'>",s+=this.addNotebookTitle("dl_proteinname","Please input a protein/gene name"),s+="Protein/Gene name: "+e.htmlCls.inputTextStr+"id='"+e.pre+"proteinname' value='TP53' size=8> ",s+=e.htmlCls.buttonStr+"reload_proteinname'>Search",s+="",s+=e.htmlCls.divStr+"dl_cid' class='"+n+"'>",s+=this.addNotebookTitle("dl_cid","Please input a PubChem Compound"),s+="PubChem CID/Name/InchI: "+e.htmlCls.inputTextStr+"id='"+e.pre+"cid' value='2244' size=8> ",s+=e.htmlCls.buttonStr+"reload_cid'>Load",s+="",s+=e.htmlCls.divStr+"dl_pngimage' class='"+n+"'>",s+=this.addNotebookTitle("dl_pngimage","Please input an iCn3D PNG Image file"),s+="iCn3D PNG image: "+e.htmlCls.inputFileStr+"id='"+e.pre+"pngimage'> ",s+=e.htmlCls.buttonStr+"reload_pngimage' style='margin-top: 6px;'>Load",s+="",s+=e.htmlCls.divStr+"dl_state' class='"+n+"'>",s+=this.addNotebookTitle("dl_state","Please input a state file"),s+="State file: "+e.htmlCls.inputFileStr+"id='"+e.pre+"state'> ",s+=e.htmlCls.buttonStr+"reload_state' style='margin-top: 6px;'>Load",s+="",s+=e.htmlCls.divStr+"dl_fixedversion' style='max-width:500px' class='"+n+"'>",s+=this.addNotebookTitle("dl_fixedversion","Use fixed version of iCn3D"),s+='Since January 6, 2021, you can show the original view with the archived version of iCn3D by pasting your URL below and click "Show Originial View". Note the version in the parameter "v" was used to replace "full.html" with "full_[v].html" in the URL.
',s+="Share Link URL: "+e.htmlCls.inputTextStr+"id='"+e.pre+"sharelinkurl' size=60> ",s+=e.htmlCls.buttonStr+"reload_fixedversion'>Show Original View
',s+=e.htmlCls.divStr+"dl_collection_structures' style='display: none'>",s+="",s+="",s+="",s+=e.htmlCls.divStr+"dl_menuloadpref' class='"+n+"'>",s+=this.addNotebookTitle("dl_menuloadpref","Load a preference file"),s+="Preference file: "+e.htmlCls.inputFileStr+"id='"+e.pre+"menupreffile'> ",s+=e.htmlCls.buttonStr+"reload_menupreffile' style='margin-top: 6px;'>Load",s+="",s+=e.htmlCls.divStr+"dl_dsn6' class='"+n+"' style='max-width:600px'>",s+=this.addNotebookTitle("dl_dsn6","Load a map file"),s+="Note: Always load a PDB file before loading map files. If you don't specify the threshold below, a default one will be chosen.
",s+="2fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigma2fofc' value='' size=8> σ ",s+=e.htmlCls.inputFileStr+"id='"+e.pre+"dsn6file2fofc'> "+e.htmlCls.buttonStr+"reload_dsn6file2fofc' style='margin: 6px 20px 0 0;'>Load DSN6"+e.htmlCls.buttonStr+"reload_ccp4file2fofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfile2fofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfile2fofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+="fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigmafofc' value='' size=8> σ ",s+=e.htmlCls.inputFileStr+"id='"+e.pre+"dsn6filefofc'> "+e.htmlCls.buttonStr+"reload_dsn6filefofc' style='margin: 6px 20px 0 0;'>Load DSN6"+e.htmlCls.buttonStr+"reload_ccp4filefofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfilefofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfilefofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+=e.htmlCls.buttonStr+"elecmapNo4'>Remove Map ",s+="",s+=e.htmlCls.divStr+"dl_dsn6url' class='"+n+"' style='max-width:600px'>",s+=this.addNotebookTitle("dl_dsn6url","Load a selection file via a URL"),s+="Note: Always load a PDB file before loading map files. If you don't specify the threshold below, a default one will be chosen.
",s+="2fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigmaurl2fofc' value='' size=8> σ ",s+="URL in the same host: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6fileurl2fofc' size=20> "+e.htmlCls.buttonStr+"reload_dsn6fileurl2fofc' style='margin: 6px 20px 0 0;'>Load DSN6"+e.htmlCls.buttonStr+"reload_ccp4fileurl2fofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfileurl2fofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfileurl2fofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+="fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigmaurlfofc' value='' size=8> σ ",s+="URL in the same host: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6fileurlfofc' size=20> "+e.htmlCls.buttonStr+"reload_dsn6fileurlfofc' style='margin: 6px 20px 0 0;'>Load DSN6"+e.htmlCls.buttonStr+"reload_ccp4fileurlfofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfileurlfofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfileurlfofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+=e.htmlCls.buttonStr+"elecmapNo5'>Remove Map ",s+="",s+=e.htmlCls.divStr+"dl_clr' class='"+n+"'>",s+=this.addNotebookTitle("dl_clr","Pick a color"),s+="Click in the input box to use the color picker:
"+e.htmlCls.buttonStr+"hbondWindow'>Highlight Interactions in TableSort Interactions on: "+e.htmlCls.buttonStr+"sortSet1'> Set 1"+e.htmlCls.buttonStr+"sortSet2' style='margin-left:12px'>Set 2
",s+="
"+e.htmlCls.buttonStr+"hbondLineGraph'>2D Interaction Network "+e.htmlCls.buttonStr+"hbondLineGraph2' style='margin-left:12px'>2D Network with Reference Numbers to show two lines of residue nodes
",s+="
"+e.htmlCls.buttonStr+"hbondScatterplot'>2D Interaction Map "+e.htmlCls.buttonStr+"hbondScatterplot2' style='margin-left:12px'>2D Map with Reference Numbers to show map
",r=':
"+e.htmlCls.buttonStr+"hbondGraph'>2D Graph(Force-Directed) to show interactions with strength parameters in 0-200:",s+='
Helix or Sheet'+r+e.pre+'dist_ss" size="4" value="100">
',s+="
Coil or Nucleotide"+r+e.pre+'dist_coil" size="4" value="50">
(Note: you can also adjust thresholds at #1 to add/remove interactions.)
',s+="
"+e.htmlCls.buttonStr+"areaWindow'>Buried Surface Area
",s+="
5. "+e.htmlCls.buttonStr+"hbondReset'>Reset and select new sets
",s+="",s+=e.htmlCls.divStr+"dl_realign' class='"+n+"'>",s+=this.addNotebookTitle("dl_realign","Realign by sequence"),s+=e.htmlCls.divNowrapStr+"1. Select sets below or use your current selection: ",s+=" ",s+="
2. "+e.htmlCls.buttonStr+"applyRealign'>Realign by Sequence
",s+="",s+=e.htmlCls.divStr+"dl_realignbystruct' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_realignbystruct","Realign by structure"),s+="
1. Select sets below or use your current selection.
",s+=" ",s+="
2. "+e.htmlCls.buttonStr+"applyRealignByStruct_tmalign'>Realign with TM-align"+e.htmlCls.buttonStr+"applyRealignByStruct' style='margin-left:30px'>Realign with VAST
",s+="",s+=e.htmlCls.divStr+"dl_realigntwostru' class='"+n+"'>",s+=this.addNotebookTitle("dl_realigntwostru","Realign two structure complexes"),s+=e.htmlCls.divNowrapStr+"1. Select sets below or use your current selection: ",s+=" ",s+="2. Overall maximum RMSD: "+e.htmlCls.inputTextStr+"id='"+e.pre+"maxrmsd' value='30' size='2'> Å
",s+="
3. "+e.htmlCls.buttonStr+"applyRealignByStruct_vastplus'>VAST+ Alignment based on TM-align
",s+="",s+=e.htmlCls.divStr+"dl_colorspectrumacrosssets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorspectrumacrosssets","Set color spectrum across sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorSpectrumAcrossSets'>Spectrum Color for Sets
",s+="",s+=e.htmlCls.divStr+"dl_colorspectrumbysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorspectrumbysets","Set color spectrum for residues in sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorSpectrumBySets'>Spectrum Color for Residues in Sets
",s+="",s+=e.htmlCls.divStr+"dl_colorrainbowacrosssets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorrainbowacrosssets","Set color rainbow across sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorRainbowAcrossSets'>Rainbow Color for Sets
",s+="",s+=e.htmlCls.divStr+"dl_colorrainbowbysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorrainbowbysets","Set color rainbow for residues in sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorRainbowBySets'>Rainbow Color for Residues in Sets
",s+='',s+="",s+=e.htmlCls.divStr+"dl_elecmap2fofc' class='"+n+"'>",s+=this.addNotebookTitle("dl_elecmap2fofc","Electron Density 2F0-Fc Map"),s+="Contour at: σ"+e.htmlCls.buttonStr+"applymap2fofc'>Display"+e.htmlCls.buttonStr+"elecmapNo2'>Remove Map",s+="",s+=e.htmlCls.divStr+"dl_elecmapfofc' class='"+n+"'>",s+=this.addNotebookTitle("dl_elecmapfofc","Electron Density F0-Fc Map"),s+="Contour at: σ"+e.htmlCls.buttonStr+"applymapfofc'>Display"+e.htmlCls.buttonStr+"elecmapNo3'>Remove Map",s+="",s+=e.htmlCls.divStr+"dl_emmap' class='"+n+"'>",s+=this.addNotebookTitle("dl_emmap","EM Density Map"),s+="Contour at: % of maximum EM values "+e.htmlCls.buttonStr+"applyemmap'>Display"+e.htmlCls.buttonStr+"emmapNo2'>Remove EM Map",s+="",s+=e.htmlCls.divStr+"dl_aroundsphere' class='"+n+"'>",s+=this.addNotebookTitle("dl_aroundsphere","Select a sphere around a set of residues"),s+=e.htmlCls.divNowrapStr+"1. Select the first set:",s+=" ",s+=e.htmlCls.divNowrapStr+"2. Sphere with a radius: "+e.htmlCls.inputTextStr+"id='"+e.pre+"radius_aroundsphere' value='4' size='2'> Å ",s+=e.htmlCls.divNowrapStr+"3. Select the second set to apply the sphere:",s+=" ",s+=e.htmlCls.divNowrapStr+"4. "+e.htmlCls.buttonStr+"applypick_aroundsphere'>Display the sphere around the first set of atoms ",s+="
"+e.htmlCls.buttonStr+"sphereExport'>Save interacting/contacting residue pairs in a file
",s+="",s+=e.htmlCls.divStr+"dl_adjustmem' class='"+n+"'>",s+=this.addNotebookTitle("dl_adjustmem","Adjust membranes"),s+="Note: The membranes are parallel to the X-Y plane. The center of the membranes is at Z = 0.
",s+=e.htmlCls.divNowrapStr+"1. Extracellular membrane Z-axis position: "+e.htmlCls.inputTextStr+"id='"+e.pre+"extra_mem_z' value='' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"2. intracellular membrane Z-axis position: "+e.htmlCls.inputTextStr+"id='"+e.pre+"intra_mem_z' value='' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"3. "+e.htmlCls.buttonStr+"apply_adjustmem'>Display the adjusted membranes ",s+="",s+=e.htmlCls.divStr+"dl_selectplane' class='"+n+"'>",s+=this.addNotebookTitle("dl_selectplane","Select a plane"),s+="Note: The membranes are parallel to the X-Y plane. The center of the membranes is at Z = 0.
",s+=e.htmlCls.divNowrapStr+"1. Z-axis position of the first X-Y plane: "+e.htmlCls.inputTextStr+"id='"+e.pre+"selectplane_z1' value='15' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"2. Z-axis position of the second X-Y plane: "+e.htmlCls.inputTextStr+"id='"+e.pre+"selectplane_z2' value='-15' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"3. "+e.htmlCls.buttonStr+"apply_selectplane'>Save the region between the planes to Defined Sets ",s+="",s+=e.htmlCls.divStr+"dl_addlabel' class='"+n+"'>",s+=this.addNotebookTitle("dl_addlabel","Add labels between two atoms"),s+="1. Text: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labeltext' value='Text' size=4> ",s+="2. Size: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelsize' value='18' size=4 maxlength=2> ",s+="3. Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelcolor' value='"+"#ffff00' size=4> ",e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"4. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'4. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"5. "+e.htmlCls.buttonStr+"applypick_labels'>Display",s+="",s+=e.htmlCls.divStr+"dl_addlabelselection' class='"+n+"'>",s+=this.addNotebookTitle("dl_addlabelselection","Add labels for your selection"),s+="1. Text: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labeltext2' value='Text' size=4> ",s+="2. Size: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelsize2' value='18' size=4 maxlength=2> ",s+="3. Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelcolor2' value='"+"#ffff00' size=4> ",s+=e.htmlCls.spanNowrapStr+"4. "+e.htmlCls.buttonStr+"applyselection_labels'>Display",s+="",s+=e.htmlCls.divStr+"dl_labelColor' class='"+n+"'>",s+=this.addNotebookTitle("dl_labelColor","Change label color"),s+="Color for all labels: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelcolorall' value='"+"#ffff00' size=4>
",s+=e.htmlCls.spanNowrapStr+e.htmlCls.buttonStr+"applylabelcolor'>Display",s+="",s+=e.htmlCls.divStr+"dl_distance' class='"+n+"'>",s+=this.addNotebookTitle("dl_distance","Measure distance"),e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"1. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'1. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"2. Line Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"distancecolor' value='"+"#ffff00' size=4> ",s+=e.htmlCls.spanNowrapStr+"3. "+e.htmlCls.buttonStr+"applypick_measuredistance'>Display",s+="",s+=e.htmlCls.divStr+"dl_stabilizer' class='"+n+"'>",s+=this.addNotebookTitle("dl_stabilizer","Add a stabilizer"),e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"1. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'1. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"2. Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"stabilizercolor' value='ffffff' size=4> ",s+=e.htmlCls.spanNowrapStr+"3. "+e.htmlCls.buttonStr+"applypick_stabilizer'>Add",s+="",s+=e.htmlCls.divStr+"dl_disttwosets' class='"+n+"'>",s+=this.addNotebookTitle("dl_disttwosets","Measure the distance between two sets"),s+=e.htmlCls.spanNowrapStr+"1. Select two sets ",s+="
",s+=e.htmlCls.spanNowrapStr+"3. "+e.htmlCls.buttonStr+"applydist2'>Display",s+="",s+=e.htmlCls.divStr+"dl_linebtwsets' class='"+n+"'>",s+=this.addNotebookTitle("dl_linebtwsets","Add a line between two sets"),s+=e.htmlCls.spanNowrapStr+"1. Select two sets ",s+="
",s+=e.htmlCls.divNowrapStr+"5. Opacity: ",s+=e.htmlCls.spanNowrapStr+"6. "+e.htmlCls.buttonStr+"applycartoonshape'>Display",s+=e.htmlCls.space3+e.htmlCls.spanNowrapStr+e.htmlCls.buttonStr+"clearcartoonshape'>Clear",s+="",s+=e.htmlCls.divStr+"dl_distmanysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_distmanysets","Measure distances among many sets"),s+=e.htmlCls.spanNowrapStr+"1. Select sets for pairwise distances ",s+="
",s+=e.htmlCls.spanNowrapStr+"2. "+e.htmlCls.buttonStr+"applydisttable'>Distances in Table",s+="",s+=e.htmlCls.divStr+"dl_anglemanysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_anglemanysets","Measure angles among many sets"),s+=e.htmlCls.spanNowrapStr+"1. Select sets for pairwise angles ",s+="
",s+=e.htmlCls.spanNowrapStr+"2. "+e.htmlCls.buttonStr+"applyangletable'>Angles in Table",s+="",s+=e.htmlCls.divStr+"dl_stabilizer_rm' class='"+n+"'>",s+=this.addNotebookTitle("dl_stabilizer_rm","Remove a stabilizer"),e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"1. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'1. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"2. "+e.htmlCls.buttonStr+"applypick_stabilizer_rm'>Remove",s+="",s+=e.htmlCls.divStr+"dl_thickness' class='"+n+"'>",s+=this.addNotebookTitle("dl_thickness","Set thickness"),s+=e.htmlCls.setHtmlCls.setThicknessHtml("3dprint"),s+="",s+=e.htmlCls.divStr+"dl_thickness2' class='"+n+"'>",s+=this.addNotebookTitle("dl_thickness2","Set thickness"),s+=e.htmlCls.setHtmlCls.setThicknessHtml("style"),s+="",s+=e.htmlCls.divStr+"dl_menupref' class='"+n+"'>",s+=this.addNotebookTitle("dl_menupref","Preferences for menus"),s+="Note: The following parameters will be saved in cache. You just need to set them once.
",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"apply_menupref'>Apply",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref' style='margin-left:30px'>Reset to Simple Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref_all' style='margin-left:30px'>Reset to All Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"savepref' style='margin-left:30px'>Save Preferences
",s+="
",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"apply_menupref2'>Apply",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref2' style='margin-left:30px'>Reset to Simple Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref_all2' style='margin-left:30px'>Reset to All Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"savepref2' style='margin-left:30px'>Save Preferences",s+="",s+=e.htmlCls.divStr+"dl_addtrack' class='"+n+"'>",s+=this.addNotebookTitle("dl_addtrack","Add a track"),s+=" ",s+=e.htmlCls.divStr+"dl_addtrack_tabs' style='border:0px;'>",s+="
Note: The full protein sequences with gaps in MSA are listed one by one. The sequence of the structure is listed at the top. Each sequence has a title line starting with \">\".
",s+='Track Text (e.g., "2 G, 5-6 RR" defines a character "G" at the position 2 and two continuous characters "RR" at positions from 5 to 6. The starting position is 1): ',s+="
",s+="",s+=e.htmlCls.divStr+"dl_copyurl' style='width:520px;' class='"+n+"'>",s+=this.addNotebookTitle("dl_copyurl","Share Link"),s+=" ",s+="1. URLs Used in Browsers
",s+='Please copy one of the URLs below. They show the same result. (To add a title to share link, click "Windows > Your Note" and click "File > Share Link" again.)
',s+="Original URL with commands:
",e.cfg.notebook||(s+="Lifelong Short URL:(To replace this URL, send a pull request to update share.html at iCn3D GitHub) "+e.htmlCls.inputTextStr+"id='"+e.pre+"short_url' value='' style='width:100%'>
",s+='Lifelong Short URL + Window Title:(To update the window title, click "Analysis > Your Note/Window Title".) '+e.htmlCls.inputTextStr+"id='"+e.pre+"short_url_title' value='' style='width:100%'>
"),s+="2. Commands Used in Jupyter Noteboook
",s+="Please copy the following commands into a cell in Jupyter Notebook to show the same result. More details are at https://github.com/ncbi/icn3d/tree/master/jupyternotebook.
",s+="",s+='',s+="",s+=e.htmlCls.divStr+"dl_area' class='"+n+"'>",s+=this.addNotebookTitle("dl_area","Surface Area"),s+="Solvent Accessible Surface Area(SASA) calculated using the EDTSurf algorithm: ",s+='(0-20% out is considered "in". 50-100% out is considered "out".)
",s+="",s+="",s+=e.htmlCls.divStr+"dl_colorbyarea' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorbyarea","Color by surface area"),s+="
Color each residue based on the percentage of solvent accessilbe surface area. The color ranges from blue, to white, to red for a percentage of 0, 35(variable), and 100, respectively.
"+e.htmlCls.buttonStr+"mn6_igrefTpl_apply'>Show Ig Ref. Number",s+="",s+=e.htmlCls.divStr+"dl_alignrefTpl' class='"+n+"'>",s+=this.addNotebookTitle("dl_alignrefTpl","Align with an Ig template"),s+="Choose an Ig template to align with selected residues:
"+e.htmlCls.buttonStr+"mn6_alignrefTpl_apply'>Align Template with Selection",s+="",s+="",s+="\x3c!--/form--\x3e",s}setTemplateMenu(){let e=this.icn3dui;e.icn3d;let t={IgV:["CD28_1yjdC_human_V","CD2_1hnfA_human_V-n1","CD8a_1cd8A_human_V","FAB-HEAVY_5esv_V-n1","FAB-LIGHT_5esv_V-n1","ICOS_6x4gA_human_V","LAG3_7tzgD_human_V-n1","PD1_4zqkB_human_V","PDL1_4z18B_human_V-n1","TCRa_6jxrm_human_V-n1","VISTA_6oilA_human_V","VNAR_1t6vN_shark_V"],IgC1:["B2Microglobulin_7phrL_human_C1","CD3d_6jxrd_human_C1","CD3e_6jxrf_human_C1","FAB-LIGHT_5esv_C1-n2","FAB-HEAVY_5esv_C1-n2","GHR_1axiB_human_C1-n1","LAG3_7tzgD_human_C1-n2","MHCIa_7phrH_human_C1","Siglec3_5j0bB_human_C1-n2","TCRa_6jxrm_human_C1-n2","VTCN1_Q7Z7D3_human_C1-n2"],IgC2:["CD2_1hnfA_human_C2-n2","CD3g_6jxrg_human_C2"],IgI:["BTLA_2aw2A_human_Iset","Contactin1_3s97C_human_Iset-n2","JAM1_1nbqA_human_Iset-n2","Palladin_2dm3A_human_Iset-n1","Titin_4uowM_human_Iset-n152"],IgE:["CoAtomerGamma1_1r4xA_human","Endo-1,4-BetaXylanase10A_1i8aA_bacteria_n4","IsdA_2iteA_bacteria","NaKATPaseTransporterBeta_2zxeB_spurdogshark","TP34_2o6cA_bacteria","TP47_1o75A_bacteria"],IgFN3:["Contactin1_2ee2A_human_FN3-n9","IL6Rb_1bquB_human_FN3-n2","IL6Rb_1bquB_human_FN3-n3","InsulinR_8guyE_human_FN3-n1","InsulinR_8guyE_human_FN3-n2","Sidekick2_1wf5A_human_FN3-n7"],"IgFN3-like":["ASF1A_2iijA_human","BArrestin1_4jqiA_rat_n1","C3_2qkiD_human_n1","MPT63_1lmiA_bacteria","NaCaExchanger_2fwuA_dog_n2","RBPJ_6py8C_human_Unk-n1","RBPJ_6py8C_human_Unk-n2","TEAD1_3kysC_human"],"Other Ig":["CD19_6al5A_human-n1","CuZnSuperoxideDismutase_1hl5C_human","ECadherin_4zt1A_human_n2","LaminAC_1ifrA_human","ORF7a_1xakA_virus"]},s={ASF1A_2iijA_human:"A A' B C C' E F G G+",B2Microglobulin_7phrL_human_C1:"A B C C' D E F G",BArrestin1_4jqiA_rat_n1:"A- A A' B C C' E F G",BTLA_2aw2A_human_Iset:"A A' B C C' D E F G",C3_2qkiD_human_n1:"A A' B C C' E F G","CD19_6al5A_human-n1":"A' B C C' D E F G",CD28_1yjdC_human_V:"A A' B C C' C'' D E F G","CD2_1hnfA_human_C2-n2":"A B C C' E F G","CD2_1hnfA_human_V-n1":"A' B C C' C'' D E F G",CD3d_6jxrd_human_C1:"A B C D E F G",CD3e_6jxrf_human_C1:"A B C C' D E F G",CD3g_6jxrg_human_C2:"A B C C' E F G G+",CD8a_1cd8A_human_V:"A A' B C C' C'' D E F G",CoAtomerGamma1_1r4xA_human:"A- A B C D E F G","Contactin1_2ee2A_human_FN3-n9":"A A' B C C' E F G","Contactin1_3s97C_human_Iset-n2":"A A' B C D E F G",CuZnSuperoxideDismutase_1hl5C_human:"A- A B C C' E F G",ECadherin_4zt1A_human_n2:"A' B C D E F G","Endo-1,4-BetaXylanase10A_1i8aA_bacteria_n4":"A--- A-- A- A B C C' C'' D E F G","FAB-HEAVY_5esv_C1-n2":"A B C D E F G","FAB-HEAVY_5esv_V-n1":"A B C C' C'' D E F G","FAB-LIGHT_5esv_C1-n2":"A B C C' D E F G","FAB-LIGHT_5esv_V-n1":"A A' B C C' C'' D E F G","GHR_1axiB_human_C1-n1":"A B C C' D E F G",ICOS_6x4gA_human_V:"A B C C' C'' D E F G","IL6Rb_1bquB_human_FN3-n2":"A B C C' E F G","IL6Rb_1bquB_human_FN3-n3":"A B C C' E F G","InsulinR_8guyE_human_FN3-n1":"A B C C' E F G","InsulinR_8guyE_human_FN3-n2":"A B C C' E F G",IsdA_2iteA_bacteria:"A- A B C C' D E F G","JAM1_1nbqA_human_Iset-n2":"A A' B C C' D E F G","LAG3_7tzgD_human_C1-n2":"A A' B C C' D E F G","LAG3_7tzgD_human_V-n1":"A' B C C' D E F G",LaminAC_1ifrA_human:"A- A B C C' E E+ F G",MHCIa_7phrH_human_C1:"A B C C' D E F G",MPT63_1lmiA_bacteria:"A-- A- A BC C' E F G",NaCaExchanger_2fwuA_dog_n2:"A A' B C C' E F G",NaKATPaseTransporterBeta_2zxeB_spurdogshark:"A A' B C D E F G",ORF7a_1xakA_virus:"A' B C D E F G",PD1_4zqkB_human_V:"A A' B C C' D E F G","PDL1_4z18B_human_V-n1":"A A' B C C' C'' D E F G","Palladin_2dm3A_human_Iset-n1":"A A' B C C' D E F G","RBPJ_6py8C_human_Unk-n1":"A A' B C C' E F G","RBPJ_6py8C_human_Unk-n2":"A B C D E F G","Sidekick2_1wf5A_human_FN3-n7":"A B C C' E F G","Siglec3_5j0bB_human_C1-n2":"A A' B C D E F G","TCRa_6jxrm_human_C1-n2":"A B C D E F G","TCRa_6jxrm_human_V-n1":"A A' B C C' C'' D E F G",TEAD1_3kysC_human:"A A+ A' B C C' E F G G+",TP34_2o6cA_bacteria:"A- A B C C' D E F G",TP47_1o75A_bacteria:"A B C C' D E F G","Titin_4uowM_human_Iset-n152":"A A' B C C' D E F G",VISTA_6oilA_human_V:"A A' B C C' C'' D E F G G+",VNAR_1t6vN_shark_V:"A A' B C C' D E F G","VTCN1_Q7Z7D3_human_C1-n2":"A B C C' D E F G G+"},i="";for(let n in t){i+=""}return i}getAnnoHeader(){let e=this.icn3dui;e.icn3d;let t="";t+="
"+t.htmlCls.space3+t.htmlCls.buttonStr+"command_apply"+s+"'>Save Selection to Defined Sets
",n+="
",n+="
",n+="
",n+='Specification Tips:
',n+=t.htmlCls.divStr+"specguide"+s+"' style='display:none; width:500px' class='icn3d-box'>",n+='Specification: In the selection "$1HHO,4N7N.A,B,C:5-10,LV,3AlaVal,chemicals@CA,C,C*":',n+='
"$1HHO,4N7N" uses "$" to indicate structure selection. ',n+='
".A,B,C" uses "." to indicate chain selection. ',n+='
":5-10,LV,3LeuVal,chemicals" uses the colon ":" to indicate residue selection. Residue selection could be residue number(5-10), one-letter IUPAC residue name abbreviations(LV), three-letter residue names(AlaVal, "3" indicates each residue name has three letters), or predefined names: "proteins", "nucleotides", "chemicals", "ions", and "water". IUPAC abbreviations can be written either as a contiguous string(e.g., ":LV"), in order to find all instances of that sequence in the structure, or they can be separated by commas(e.g., ":L,V") to select all residues of a given type in the structure(in the latter case, select all Leucine and Valine in the structure). ',n+='
"@CA,C,C*" uses "@" to indicate atom name selection. "C*" selects any atom names starting with "C". ',n+='
Partial definition is allowed, e.g., ":1-10" selects all residue IDs 1-10 in all chains. ',n+='
Different selections can be unioned(with "or", default), intersected(with "and"), or negated(with "not"). For example, ":1-10 or :K" selects all residues 1-10 and all Lys residues. ":1-10 and :K" selects all Lys residues in the range of residue number 1-10. ":1-10 or not :K" selects all residues 1-10, which are not Lys residues. ',n+='
The wild card character "X" or "x" can be used to represent any character.',n+="
",n+="Set Operation:",n+='
Users can select multiple sets in the menu "Select > Defined Sets". ',n+='
Different sets can be unioned(with "or", default), intersected(with "and"), or negated(with "not"). For example, if the "Defined Sets" menu has four sets ":1-10", ":11-20", ":5-15", and ":7-8", the command "saved atoms :1-10 or :11-20 and :5-15 not :7-8" unions all residues 1-10 and 11-20 to get the residues 1-20, then intersects with the residues 5-15 to get the residues 5-15, then exclude the residues 7-8 to get the final residues 5-6 and 9-15.
',n+="Full commands in url or command window:",n+="
Select without saving the set: select $1HHO,4N7N.A,B,C:5-10,LV,chemicals@CA,C,C* ",n+="
Select and save: select $1HHO,4N7N.A,B,C:5-10,LV,chemicals@CA,C,C* | name my_name
",n+="",n+="
",n+="",n}getOptionHtml(e,t){let s=this.icn3dui;s.icn3d;let i="";for(let n=0,l=e.length;n"+l+"":s.htmlCls.optionStr+"'"+l+"'>"+l+""}return i}setColorHints(){let e=this.icn3dui;e.icn3d;let t="";return t+=e.htmlCls.divNowrapStr+'Green: H-Bonds; ',t+='Cyan: Salt Bridge/Ionic; ',t+='Grey: contacts',t+=e.htmlCls.divNowrapStr+'Magenta: Halogen Bonds; ',t+='Red: π-Cation; ',t+='Blue: π-Stacking',t}setThicknessHtml(e){let t=this.icn3dui,s=t.icn3d,i="",n="3dprint"==e?"1":"0.1",l="3dprint"==e?"1.2":"0.3",r="3dprint"==e?"0.8":"0.4",o="3dprint"==e?"0.8":"0.4",a="3dprint"==e?"1":"0.4",d="3dprint"==e?"0.6":"0.3",c="3dprint"==e?"1":"0.2",h="3dprint"==e?"2":"1.3",p="3dprint"==e?"1.4":"0.8",m=40,u=.8,g=.4,f=.2,C=0,b=1,y=0;if("style"==e){if(""!=this.getCookie("shininess")&&(m=parseFloat(this.getCookie("shininess"))),""!=this.getCookie("light1")&&(u=parseFloat(this.getCookie("light1")),g=parseFloat(this.getCookie("light2")),f=parseFloat(this.getCookie("light3"))),""!=this.getCookie("lineRadius")){n=parseFloat(this.getCookie("lineRadius")),l=parseFloat(this.getCookie("coilWidth")),r=parseFloat(this.getCookie("cylinderRadius"));let e=this.getCookie("crosslinkRadius");o=isNaN(e)?s.crosslinkRadius:parseFloat(e),a=parseFloat(this.getCookie("traceRadius")),d=parseFloat(this.getCookie("dotSphereScale")),c=parseFloat(this.getCookie("ribbonthickness")),h=parseFloat(this.getCookie("helixSheetWidth")),p=parseFloat(this.getCookie("nucleicAcidWidth"))}""!=this.getCookie("glycan")&&(C=parseFloat(this.getCookie("glycan"))),""!=this.getCookie("membrane")&&(b=parseFloat(this.getCookie("membrane"))),""!=this.getCookie("cmdwindow")&&(y=parseFloat(this.getCookie("cmdwindow"))),i+="Note: The following parameters will be saved in cache. You just need to set them once.
",i+="1. Shininess: "+t.htmlCls.inputTextStr+"id='"+t.pre+"shininess' value='"+m+"' size=4>"+t.htmlCls.space3+"(for the shininess of the 3D objects, default 40)
",i+="2. Three directional lights: ",i+="Key Light: "+t.htmlCls.inputTextStr+"id='"+t.pre+"light1' value='"+u+"' size=4>"+t.htmlCls.space3+"(for the light strength of the key light, default 0.8) ",i+="Fill Light: "+t.htmlCls.inputTextStr+"id='"+t.pre+"light2' value='"+g+"' size=4>"+t.htmlCls.space3+"(for the light strength of the fill light, default 0.4) ",i+="Back Light: "+t.htmlCls.inputTextStr+"id='"+t.pre+"light3' value='"+f+"' size=4>"+t.htmlCls.space3+"(for the light strength of the back light, default 0.2)
",n+=s.htmlCls.divStr+"seqguide"+e+"' style='display:none; white-space:normal;' class='icn3d-box'>"),n+=this.getSelectionHints();return n+="Residue labeling: standard residue with coordinates: UPPER case letter; nonstandard residue with coordinates: the first UPPER case letter plus a period except that water residue uses the letter 'O'; residue missing coordinates: lower case letter."+(s.utilsCls.isMac()&&!s.utilsCls.isMobile()?"
Turn on scroll bar: System preferences -> General -> show scroll bars -> check Always":"")+" ",n}setAlignSequenceGuide(e,t){let s=this.icn3dui,i=s.icn3d,n="";let l=i&&i.defNames2Atoms?Object.keys(i.defNames2Atoms).length:1;n+='
",n+=s.htmlCls.divStr+"alignseqguide' style='display:none; white-space:normal;' class='icn3d-box'>",n+=this.getSelectionHints();return n+="Residue labeling: aligned residue with coordinates: UPPER case letter; non-aligned residue with coordinates: lower case letter which can be highlighted; residue missing coordinates: lower case letter which can NOT be highlighted."+(s.utilsCls.isMac()&&!s.utilsCls.isMobile()?"
Turn on scroll bar: System preferences -> General -> show scroll bars -> check Always":"")+" ",n}getSelectionHints(){let e=this.icn3dui;e.icn3d;let t="";if(e.utilsCls.isMobile())t+='Select Aligned Sequences: touch to select, touch again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection. ';else{t+='Select on 1D sequences: drag to select, drag again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection.
',t+="Select on 2D interaction diagram: click on the nodes or lines. The nodes are chains and can be united with the Ctrl key. The lines are interactions and can NOT be united. Each click on the lines selects half of the lines, i.e., select the interacting residues in one of the two chains.
",t+="Select on 3D structures: "+(e.utilsCls.isMobile()?"use finger to pick":'hold "Alt" and use mouse to pick')+', click the second time to deselect, hold "Ctrl" to union selection, hold "Shift" to select a range, press the up/down arrow to switch among atom/residue/strand/chain/structure, click "Save Selection" to save the current selection.
',t+='Save the current selection(either on 3D structure, 2D interactions, or 1D sequence): open the menu "Select -> Save Selection", specify the name and description for the selection, and click "Save".
";return"delphi"==e?s.cfg.cid?i+="Note: Partial charges(MMFF94) are from PubChem Compound SDF files.
":(i+="Note: Only the selected residues are used for DelPhi potential calculation by solving linear Poisson-Boltzmann equation.",i+='
',i+=s.htmlCls.divStr+t+"' style='display:none;'>",i+=" The hydrogens and partial charges of proteins and nucleotides are added using DelPhiPKa with the Amber charge and size files. The hydrogens of ligands are added using Open Babel. The partial charges of ligands are calculated using Antechamber with the Gasteiger charge method. All partial charges are calculated at pH 7.
",i+='Lipids are treated as ligands. Please use "HETATM" instead of "ATOM " for each lipid atom in your PDB file. Each phosphate in lipids is assigned with a charge of -1. You can download PQR and modify it, or prepare your PQR file using other tools. Then load the PQR file at the menu "Analysis > Load PQR/Potential".
',i+="
"):(i+="Note: Always load a PDB file before loading a PQR or DelPhi potential file.",i+='
',i+=s.htmlCls.divStr+t+"' style='display:none;'>",i+='The PDB file can be loaded in the URL with "pdbid=" or at "File > Open File". The PQR file can be prepared at the menu "Analysis > Download PQR" with your modification or using other tools. The DelPhi potential file can be calculated at DelPhi Web Server and be exported as a Cube file. ',"url"==e&&(i+="The PQR or potential file can be accessed in a URL if it is located in the same host as iCn3D."),i+="
",i+=""),i+="",i}getPotentialHtml(e,t){let s=this.icn3dui;s.icn3d;let i,n,l,r,o,a="";r="Equipotential Map",o="Surface with Potential","delphi"==e?n="delphi":"local"==e?(i="pqr",n="phi",l="cube"):"url"==e&&(i="pqrurl",n="phiurl",l="cubeurl"),a+=s.htmlCls.divStr+"dl_"+n+"' class='"+t+"'>",a+=s.htmlCls.setDialogCls.addNotebookTitle("dl_"+n,"DelPhi Potential"),a+=s.htmlCls.divStr+"dl_"+n+"_tabs' style='border:0px;'>",a+="
",d=""+s.htmlCls.buttonStr+n+"mapNo'>Remove Map",a+=s.htmlCls.divStr+n+"tab1_"+i+"2'>",a+=this.addGsizeSalt(i)+" ",a+="PQR URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+i+"file'>
"+s.htmlCls.buttonStr+"reload_"+i+"file' style='margin-top: 6px;'>Equipotential Map"+d,a+=s.htmlCls.divStr+n+"tab1_"+n+"2'>",a+="Phi URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+n+"file'>
"+s.htmlCls.buttonStr+"reload_"+n+"file' style='margin-top: 6px;'>Equipotential Map"+d,a+=s.htmlCls.divStr+n+"tab1_"+l+"2'>",a+="Cube URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+l+"file'>
"+s.htmlCls.buttonStr+"reload_"+l+"file' style='margin-top: 6px;'>Equipotential Map"+d,a+=""),a+=" "+this.getFootHtml(e,n+"tab1_foot"),a+="",a+=s.htmlCls.divStr+n+"tab2'>","delphi"==e&&(a+=this.addGsizeSalt(n+"2")+" "),a+="Surface with max potential at: kT/e(25.6mV at 298K)
",d=""+s.htmlCls.buttonStr+n+"mapNo2'>Remove Surface",a+=s.htmlCls.divStr+n+"tab2_"+i+"2'>",a+=this.addGsizeSalt(i+"2")+" ",a+="PQR URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+i+"file2'>
"+s.htmlCls.buttonStr+"reload_"+i+"file2' style='margin-top: 6px;'>Surface with Potential"+d,a+=s.htmlCls.divStr+n+"tab2_"+n+"2'>",a+="Phi URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+n+"file2'>
"+s.htmlCls.buttonStr+"reload_"+n+"file2' style='margin-top: 6px;'>Surface with Potential"+d,a+=s.htmlCls.divStr+n+"tab2_"+l+"2'>",a+="Cube URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+l+"file2'>
"+s.htmlCls.buttonStr+"reload_"+l+"file2' style='margin-top: 6px;'>Surface with Potential"+d,a+=""),a+=" "+this.getFootHtml(e,n+"tab2_foot"),a+="",a+="",a+="",a}async exportPqr(e){let t=this.icn3dui,s=t.icn3d,i={},n={},l=t.hashUtilsCls.intHash(s.dAtoms,s.hAtoms);for(let e in l)s.atoms[e],s.ions.hasOwnProperty(e)?i[e]=1:n[e]=1;let r=e?"pdb":"pqr";if(t.cfg.cid){let l="",o=!e;l+=s.saveFileCls.getAtomPDB(n,o)+s.saveFileCls.getAtomPDB(i,o);let a=Object.keys(t.utilsCls.getHlStructures()).join(",");s.saveFileCls.saveFile(a+"_icn3d."+r,"text",[l])}else{if(t.utilsCls.isCalphaPhosOnly(t.hashUtilsCls.hash2Atoms(n,s.atoms)))return void alert("The potential will not be shown because the side chains are missing in the structure...");let l="",o=!0;l+=s.saveFileCls.getAtomPDB(n,void 0,void 0,void 0,void 0,void 0,o),l+=s.saveFileCls.getAtomPDB(i,!0,void 0,!0);let a=t.htmlCls.baseUrl+"delphi/delphi.cgi",d={pdb2pqr:l,pdbid:t.cfg.cid?t.cfg.cid:Object.keys(s.structures).toString()},c=await t.getAjaxPostPromise(a,d,!0,void 0,void 0,!0,"text");if(e){let e=c.split("\n"),s="";for(let i=0,n=e.length;i Save File > iCn3D PNG Image"...');else if(-1!=l){let t=e.substr(l+n.length);s.htmlCls.clickMenuCls.setLogCmd("load iCn3D PNG image "+$("#"+s.pre+"pngimage").val(),!1),window.open(t,"_self")}else if(-1!=o){let n="Start of data file======\n",l=e.indexOf(n);i.bInputfile=-1!=l,i.bInputPNGWithData=i.bInputfile;let a,d=t?t.replace(/;/g,"\n"):"";if(i.bInputfile){let t=e.indexOf("End of data file======\n"),s=e.substr(l+n.length,t-l-n.length);i.InputfileData=i.InputfileData?i.InputfileData+"\nENDMDL\n"+s:s;let c="Start of type file======\n",h=e.indexOf(c),p=e.indexOf("End of type file======\n"),m=e.substr(h+c.length,p-h-c.length-1);i.InputfileType=m;let u=e.indexOf("End of state file======\n");a=e.substr(o+r.length,u-o-r.length),a=decodeURIComponent(a+"\n"+d),"pdb"===m?(await i.pdbParserCls.loadPdbData(s),i.commands=[],i.optsHistory=[]):("mol2"===m?await i.mol2ParserCls.loadMol2Data(s):"sdf"===m?await i.sdfParserCls.loadSdfData(s):"xyz"===m?await i.xyzParserCls.loadXyzData(s):"mmcif"===m&&await i.mmcifParserCls.loadMmcifData(s),i.commands=[],i.optsHistory=[])}else{let t=e.indexOf("End of state file======\n");a=e.substr(o+r.length,t-o-r.length),a=decodeURIComponent(a+"\n"+d),i.commands=[],i.optsHistory=[]}await i.loadScriptCls.loadScript(a,!0),s.htmlCls.clickMenuCls.setLogCmd("load iCn3D PNG image "+$("#"+s.pre+"pngimage").val(),!1)}}fileSupport(){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.")}getLinkColor(){let e="";return e+=", linkmap: {\n",e+='3: {"type": "peptidebond", "c":""},\n',e+='4: {"type": "ssbond", "c":"FFA500"},\n',e+='5: {"type": "ionic", "c":"0FF"},\n',e+='6: {"type": "ionicInside", "c":"FFF"},\n',e+='11: {"type": "contact", "c":"888"},\n',e+='12: {"type": "contactInside", "c":"FFF"},\n',e+='13: {"type": "hbond", "c":"0F0"},\n',e+='14: {"type": "hbondInside", "c":"FFF"},\n',e+='15: {"type": "clbond", "c":"006400"},\n',e+='17: {"type": "halogen", "c":"F0F"},\n',e+='18: {"type": "halogenInside", "c":"FFF"},\n',e+='19: {"type": "pication", "c":"F00"},\n',e+='20: {"type": "picationInside", "c":"FFF"},\n',e+='21: {"type": "pistacking", "c":"00F"},\n',e+='22: {"type": "pistackingInside", "c":"FFF"}\n',e+="}}\n",', linkmap: {\n3: {"type": "peptidebond", "c":""},\n4: {"type": "ssbond", "c":"FFA500"},\n5: {"type": "ionic", "c":"0FF"},\n6: {"type": "ionicInside", "c":"FFF"},\n11: {"type": "contact", "c":"888"},\n12: {"type": "contactInside", "c":"FFF"},\n13: {"type": "hbond", "c":"0F0"},\n14: {"type": "hbondInside", "c":"FFF"},\n15: {"type": "clbond", "c":"006400"},\n17: {"type": "halogen", "c":"F0F"},\n18: {"type": "halogenInside", "c":"FFF"},\n19: {"type": "pication", "c":"F00"},\n20: {"type": "picationInside", "c":"FFF"},\n21: {"type": "pistacking", "c":"00F"},\n22: {"type": "pistackingInside", "c":"FFF"}\n}}\n'}setCookieForThickness(){let e=this.icn3dui,t=e.icn3d;if(!e.bNode){let e=3650;this.setCookie("lineRadius",t.lineRadius,e),this.setCookie("coilWidth",t.coilWidth,e),this.setCookie("cylinderRadius",t.cylinderRadius,e),this.setCookie("crosslinkRadius",t.crosslinkRadius,e),this.setCookie("traceRadius",t.traceRadius,e),this.setCookie("dotSphereScale",t.dotSphereScale,e),this.setCookie("ribbonthickness",t.ribbonthickness,e),this.setCookie("helixSheetWidth",t.helixSheetWidth,e),this.setCookie("nucleicAcidWidth",t.nucleicAcidWidth,e)}}setLineThickness(e,t){let s=this.icn3dui,i=s.icn3d;if(i.bSetThickness=!0,"style"==e&&(t&&($("#"+s.pre+"shininess").val("40"),$("#"+s.pre+"light1").val("0.8"),$("#"+s.pre+"light2").val("0.4"),$("#"+s.pre+"light3").val("0.2"),$("#"+s.pre+"glycan").val("0"),$("#"+s.pre+"membrane").val("1"),$("#"+s.pre+"cmdwindow").val("0")),i.shininess=parseFloat($("#"+s.pre+"shininess").val()),i.light1=parseFloat($("#"+s.pre+"light1").val()),i.light2=parseFloat($("#"+s.pre+"light2").val()),i.light3=parseFloat($("#"+s.pre+"light3").val()),i.bGlycansCartoon=parseInt($("#"+s.pre+"glycan").val()),i.bMembrane=parseInt($("#"+s.pre+"membrane").val()),i.bCmdWindow=parseInt($("#"+s.pre+"cmdwindow").val())),t&&($("#"+s.pre+"linerad_"+e).val(.1),$("#"+s.pre+"coilrad_"+e).val(.3),$("#"+s.pre+"stickrad_"+e).val(.4),$("#"+s.pre+"crosslinkrad_"+e).val(.4),$("#"+s.pre+"tracerad_"+e).val(.4),$("#"+s.pre+"ballscale_"+e).val(.3),$("#"+s.pre+"ribbonthick_"+e).val(.2),$("#"+s.pre+"prtribbonwidth_"+e).val(1.3),$("#"+s.pre+"nucleotideribbonwidth_"+e).val(.8)),i.lineRadius=parseFloat($("#"+s.pre+"linerad_"+e).val()),i.coilWidth=parseFloat($("#"+s.pre+"coilrad_"+e).val()),i.cylinderRadius=parseFloat($("#"+s.pre+"stickrad_"+e).val()),i.crosslinkRadius=parseFloat($("#"+s.pre+"crosslinkrad_"+e).val()),i.traceRadius=parseFloat($("#"+s.pre+"tracerad_"+e).val()),i.dotSphereScale=parseFloat($("#"+s.pre+"ballscale_"+e).val()),i.ribbonthickness=parseFloat($("#"+s.pre+"ribbonthick_"+e).val()),i.helixSheetWidth=parseFloat($("#"+s.pre+"prtribbonwidth_"+e).val()),i.nucleicAcidWidth=parseFloat($("#"+s.pre+"nucleotideribbonwidth_"+e).val()),!s.bNode){let e=3650;this.setCookie("shininess",i.shininess,e),this.setCookie("light1",i.light1,e),this.setCookie("light2",i.light2,e),this.setCookie("light3",i.light3,e),this.setCookie("glycan",i.bGlycansCartoon,e),this.setCookie("membrane",i.bMembrane,e),this.setCookie("cmdwindow",i.bCmdWindow,e)}if(this.setCookieForThickness(),e=t){let e="reset thickness";s.htmlCls.clickMenuCls.setLogCmd(e,!0),i.bSetThickness=!1,i.threeDPrintCls.resetAfter3Dprint()}else s.htmlCls.clickMenuCls.setLogCmd("set thickness | linerad "+i.lineRadius+" | coilrad "+i.coilWidth+" | stickrad "+i.cylinderRadius+" | crosslinkrad "+i.crosslinkRadius+" | tracerad "+i.traceRadius+" | ribbonthick "+i.ribbonthickness+" | proteinwidth "+i.helixSheetWidth+" | nucleotidewidth "+i.nucleicAcidWidth+" | ballscale "+i.dotSphereScale,!0),s.htmlCls.clickMenuCls.setLogCmd("set glycan "+i.bGlycansCartoon,!0),s.htmlCls.clickMenuCls.setLogCmd("set membrane "+i.bMembrane,!0),s.htmlCls.clickMenuCls.setLogCmd("set cmdwindow "+i.bCmdWindow,!0);i.drawCls.draw()}setCookie(e,t,s){let i=new Date;i.setTime(i.getTime()+24*s*60*60*1e3);let n="expires="+i.toUTCString();document.cookie=e+"="+t+";"+n+";path=/"}updateSurfPara(e){let t=this.icn3dui,s=t.icn3d;s.phisurftype=$("#"+t.pre+e+"surftype").val(),s.phisurfop=$("#"+t.pre+e+"surfop").val(),s.phisurfwf=$("#"+t.pre+e+"surfwf").val()}exportPdb(){let e=this.icn3dui,t=e.icn3d,s="",i=e.hashUtilsCls.intHash(t.dAtoms,t.hAtoms);if(s+=t.saveFileCls.getAtomPDB(i),!e.bNode){let i=Object.keys(e.utilsCls.getHlStructures()).join(",");t.saveFileCls.saveFile(i+"_icn3d.pdb","text",[s])}return s}exportSecondary(){let e=this.icn3dui,t=e.icn3d,s="",i=e.hashUtilsCls.intHash(t.dAtoms,t.hAtoms);if(s+=t.saveFileCls.getSecondary(i),!e.bNode){let i=Object.keys(e.utilsCls.getHlStructures()).join(",");t.saveFileCls.saveFile(i+"_icn3d_ss.txt","text",[s])}return s}}class g{constructor(e){let t=e;this.icn3dui=e,this.cfg=this.icn3dui.cfg,this.opts={},this.opts.background="black",this.allMenus={},this.allMenusSel={},this.simpleMenus={},this.shownMenus={},this.WIDTH=400,this.HEIGHT=400,this.RESIDUE_WIDTH=10,t.utilsCls.isMobile()||this.cfg.mobilemenu?this.MENU_HEIGHT=0:this.MENU_HEIGHT=40,this.LOG_HEIGHT=65,this.MENU_WIDTH=750,this.LESSWIDTH=20,this.LESSWIDTH_RESIZE=20,this.LESSHEIGHT=20,this.width2d=200,this.CMD_HEIGHT=.8*this.LOG_HEIGHT,this.EXTRAHEIGHT=this.MENU_HEIGHT+this.CMD_HEIGHT,null!=this.cfg.showmenu&&0==this.cfg.showmenu&&(this.EXTRAHEIGHT-=this.MENU_HEIGHT),null!=this.cfg.showcommand&&0==this.cfg.showcommand&&(this.EXTRAHEIGHT-=this.CMD_HEIGHT),this.GREY8="#AAAAAA",this.GREYB="#CCCCCC",this.GREYC="#DDDDDD",this.GREYD="#EEEEEE",this.ORANGE="#FFA500",this.themecolor="blue",this.defaultValue=1,this.ssValue=3,this.coilValue=3,this.contactValue=11,this.contactInsideValue=12,this.hbondValue=13,this.hbondInsideValue=14,this.ssbondValue=4,this.ionicValue=5,this.ionicInsideValue=6,this.clbondValue=15,this.halogenValue=17,this.halogenInsideValue=18,this.picationValue=19,this.picationInsideValue=20,this.pistackingValue=21,this.pistackingInsideValue=22,this.contactColor="888",this.contactInsideColor="FFF",this.hbondColor="0F0",this.hbondInsideColor="FFF",this.ssbondColor="FFA500",this.ionicColor="0FF",this.ionicInsideColor="FFF",this.clbondColor="006400",this.halogenColor="F0F",this.halogenInsideColor="FFF",this.picationColor="F00",this.picationInsideColor="FFF",this.pistackingColor="00F",this.pistackingInsideColor="FFF",this.hideedges=1,this.force=4,this.simulation=void 0,this.baseUrl=window&&window.location&&"structure.ncbi.nlm.nih.gov"==window.location.hostname?"https://structure.ncbi.nlm.nih.gov/Structure/":"https://www.ncbi.nlm.nih.gov/Structure/",this.tmalignUrl=this.baseUrl+"tmalign/tmalign.cgi",this.divStr="
",this.spanNowrapStr="",this.inputTextStr="=2.0 are supported.")));const a=new pe(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===r[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}a.setExtensions(l),a.setPlugins(r),a.parse(s,i)}parseAsync(e,t){const s=this;return new Promise((function(i,n){s.parse(e,t,i,n)}))}}function C(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const b={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class y{constructor(e){this.parser=e,this.name=b.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,i=t.length;s=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,l)}}class R{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,i=s.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const l=n.extensions[t],r=i.images[l.source];let o=s.textureLoader;if(r.uri){const e=s.options.manager.getHandler(r.uri);null!==e&&(o=e)}return this.detectSupport().then((function(n){if(n)return s.loadTextureImage(e,l.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class I{constructor(e){this.name=b.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,n.ready]).then((function(t){const s=e.byteOffset||0,i=e.byteLength||0,l=e.count,r=e.byteStride,o=new ArrayBuffer(l*r),a=new Uint8Array(t[0],s,i);return n.decodeGltfBuffer(new Uint8Array(o),l,r,a,e.mode,e.filter),o}))}return null}}const E="glTF",T=1313821514,D=5130562;class P{constructor(e){this.name=b.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:THREE.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==E)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,i=new DataView(e,12);let n=0;for(;n",t).replace("#include ",s).replace("#include ",i).replace("#include ",n).replace("#include ",l)},Object.defineProperties(this,{specular:{get:function(){return r.specular.value},set:function(e){r.specular.value=e}},specularMap:{get:function(){return r.specularMap.value},set:function(e){r.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return r.glossiness.value},set:function(e){r.glossiness.value=e}},glossinessMap:{get:function(){return r.glossinessMap.value},set:function(e){r.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class L{constructor(){this.name=b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return H}extendParams(e,t,s){const i=t.extensions[this.name];e.color=new Color(1,1,1),e.opacity=1;const n=[];if(Array.isArray(i.diffuseFactor)){const t=i.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(void 0!==i.diffuseTexture&&n.push(s.assignTexture(e,"map",i.diffuseTexture,sRGBEncoding)),e.emissive=new Color(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Color(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){const t=i.specularGlossinessTexture;n.push(s.assignTexture(e,"glossinessMap",t)),n.push(s.assignTexture(e,"specularMap",t,sRGBEncoding))}return Promise.all(n)}createMaterial(e){const t=new H(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t}}class N{constructor(){this.name=b.KHR_MESH_QUANTIZATION}}class q extends THREE.Interpolant{constructor(e,t,s,i){super(e,t,s,i)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let e=0;e!==i;e++)t[e]=s[n+e];return t}}q.prototype.beforeStart_=q.prototype.copySampleValue_,q.prototype.afterEnd_=q.prototype.copySampleValue_,q.prototype.interpolate_=function(e,t,s,i){const n=this.resultBuffer,l=this.sampleValues,r=this.valueSize,o=2*r,a=3*r,d=i-t,c=(s-t)/d,h=c*c,p=h*c,m=e*a,u=m-a,g=-2*p+3*h,f=p-h,C=1-g,b=f-h+c;for(let e=0;e!==r;e++){const t=l[u+e+r],s=l[u+e+o]*d,i=l[m+e+r],a=l[m+e]*d;n[e]=C*t+b*s+g*i+f*a}return n};const U=new THREE.Quaternion;class B extends q{interpolate_(e,t,s,i){const n=super.interpolate_(e,t,s,i);return U.fromArray(n).normalize().toArray(n),n}}const j=0,z=1,G=2,V=3,W=4,Y=5,X=6,K={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},J={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipmapNearestFilter,9985:THREE.LinearMipmapNearestFilter,9986:THREE.NearestMipmapLinearFilter,9987:THREE.LinearMipmapLinearFilter},Z={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},Q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ee={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},te={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},se={CUBICSPLINE:void 0,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},ie="OPAQUE",ne="MASK",le="BLEND";function re(e,t,s){for(const i in s.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=s.extensions[i])}function oe(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ae(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,i=t.weights.length;s{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,i]of e.children.entries())n(i,t.children[s])};return n(s,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s=2&&m.setY(t,c[e*l+1]),l>=3&&m.setZ(t,c[e*l+2]),l>=4&&m.setW(t,c[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m}))}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,n=t.images[i];let l=this.textureLoader;if(n.uri){const e=s.manager.getHandler(n.uri);null!==e&&(l=e)}return this.loadTextureImage(e,i,l)}loadTextureImage(e,t,s){const i=this,n=this.json,l=n.textures[e],r=n.images[t],o=(r.uri||r.bufferView)+":"+l.sampler;if(this.textureCache[o])return this.textureCache[o];const a=this.loadImageSource(t,s).then((function(t){t.flipY=!1,l.name&&(t.name=l.name);const s=(n.samplers||{})[l.sampler]||{};return t.magFilter=J[s.magFilter]||LinearFilter,t.minFilter=J[s.minFilter]||LinearMipmapLinearFilter,t.wrapS=Z[s.wrapS]||RepeatWrapping,t.wrapT=Z[s.wrapT]||RepeatWrapping,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[o]=a,a}loadImageSource(e,t){const s=this,i=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=i.images[e],r=self.URL||self.webkitURL;let o=l.uri||"",a=!1;if(void 0!==l.bufferView)o=s.getDependency("bufferView",l.bufferView).then((function(e){a=!0;const t=new Blob([e],{type:l.mimeType});return o=r.createObjectURL(t),o}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(o).then((function(e){return new Promise((function(s,i){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,s(t)}),t.load(THREE.LoaderUtils.resolveURL(e,n.path),l,void 0,i)}))})).then((function(e){var t;return!0===a&&r.revokeObjectURL(o),e.userData.mimeType=l.mimeType||((t=l.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=d,d}assignTexture(e,t,s,i){const n=this;return this.getDependency("texture",s.index).then((function(l){if(void 0===s.texCoord||0==s.texCoord||"aoMap"===t&&1==s.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+s.texCoord+" for texture "+t+" not yet supported."),n.extensions[b.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[b.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=n.associations.get(l);l=n.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),n.associations.set(l,t)}}return void 0!==i&&(l.encoding=i),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const i=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,s),t.color.copy(s.color),this.cache.add(e,t)),s=t}if(i||n||l){let e="ClonedMaterial:"+s.uuid+":";s.isGLTFSpecularGlossinessMaterial&&(e+="specular-glossiness:"),i&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),n&&(t.vertexColors=!0),l&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}s.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=s}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,i=this.extensions,n=s.materials[e];let l;const r={},o=n.extensions||{},a=[];if(o[b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const e=i[b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];l=e.getMaterialType(),a.push(e.extendParams(r,n,t))}else if(o[b.KHR_MATERIALS_UNLIT]){const e=i[b.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),a.push(e.extendParams(r,n,t))}else{const s=n.pbrMetallicRoughness||{};if(r.color=new Color(1,1,1),r.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;r.color.fromArray(e),r.opacity=e[3]}void 0!==s.baseColorTexture&&a.push(t.assignTexture(r,"map",s.baseColorTexture,sRGBEncoding)),r.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,r.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(a.push(t.assignTexture(r,"metalnessMap",s.metallicRoughnessTexture)),a.push(t.assignTexture(r,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),a.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,r)}))))}!0===n.doubleSided&&(r.side=DoubleSide);const d=n.alphaMode||ie;if(d===le?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,d===ne&&(r.alphaTest=void 0!==n.alphaCutoff?n.alphaCutoff:.5)),void 0!==n.normalTexture&&l!==MeshBasicMaterial&&(a.push(t.assignTexture(r,"normalMap",n.normalTexture)),r.normalScale=new Vector2(1,1),void 0!==n.normalTexture.scale)){const e=n.normalTexture.scale;r.normalScale.set(e,e)}return void 0!==n.occlusionTexture&&l!==MeshBasicMaterial&&(a.push(t.assignTexture(r,"aoMap",n.occlusionTexture)),void 0!==n.occlusionTexture.strength&&(r.aoMapIntensity=n.occlusionTexture.strength)),void 0!==n.emissiveFactor&&l!==MeshBasicMaterial&&(r.emissive=(new Color).fromArray(n.emissiveFactor)),void 0!==n.emissiveTexture&&l!==MeshBasicMaterial&&a.push(t.assignTexture(r,"emissiveMap",n.emissiveTexture,sRGBEncoding)),Promise.all(a).then((function(){let s;return s=l===H?i[b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(r):new l(r),n.name&&(s.name=n.name),oe(s,n),t.associations.set(s,{materials:e}),n.extensions&&re(i,s,n),s}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");let s=t;for(let e=1;this.nodeNamesUsed[s];++e)s=t+"_"+e;return this.nodeNamesUsed[s]=!0,s}loadGeometries(e){const t=this,s=this.extensions,i=this.primitiveCache;function n(e){return s[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(s){return ue(s,e,t)}))}const l=[];for(let s=0,r=e.length;s0&&ae(h,n),h.name=t.createUniqueName(n.name||"mesh_"+e),oe(h,n),c.extensions&&re(i,h,c),t.assignFinalMaterial(h),a.push(h)}for(let s=0,i=a.length;s1?new Group:1===t.length?t[0]:new Object3D,r!==t[0])for(let e=0,s=t.length;e{const t=new Map;for(const[e,s]of n.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,s);return e.traverse((e=>{const s=n.associations.get(e);null!=s&&t.set(e,s)})),t})(l),l}))}}function me(e,t,s,i){const n=s.nodes[e];return i.getDependency("node",e).then((function(e){if(void 0===n.skin)return e;let t;return i.getDependency("skin",n.skin).then((function(e){t=e;const s=[];for(let e=0,n=t.joints.length;e{const s=n[e];return s&&(l={profileId:e,profilePath:`${t}/${s.path}`,deprecated:!!s.deprecated}),!!l})),!l){if(!s)throw new Error("No matching profile name found");const e=n[s];if(!e)throw new Error(`No matching profile name found and default profile "${s}" missing.`);l={profileId:s,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}const r=await Ce(l.profilePath);let o;if(i){let t;if(t="any"===e.handedness?r.layouts[Object.keys(r.layouts)[0]]:r.layouts[e.handedness],!t)throw new Error(`No matching handedness, ${e.handedness}, in profile ${l.profileId}`);t.assetPath&&(o=l.profilePath.replace("profile.json",t.assetPath))}return{profile:r,assetPath:o}}const ye={xAxis:0,yAxis:0,button:0,state:fe.ComponentState.DEFAULT};class ve{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===fe.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(ye)}updateFromComponent({xAxis:e,yAxis:t,button:s,state:i}){const{normalizedXAxis:n,normalizedYAxis:l}=function(e=0,t=0){let s=e,i=t;if(Math.sqrt(e*e+t*t)>1){const n=Math.atan2(t,e);s=Math.cos(n),i=Math.sin(n)}return{normalizedXAxis:.5*s+.5,normalizedYAxis:.5*i+.5}}(e,t);switch(this.componentProperty){case fe.ComponentProperty.X_AXIS:this.value=this.states.includes(i)?n:.5;break;case fe.ComponentProperty.Y_AXIS:this.value=this.states.includes(i)?l:.5;break;case fe.ComponentProperty.BUTTON:this.value=this.states.includes(i)?s:0;break;case fe.ComponentProperty.STATE:this.valueNodeProperty===fe.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(i):this.value=this.states.includes(i)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class _e{constructor(e,t){if(!(e&&t&&t.visualResponses&&t.gamepadIndices&&0!==Object.keys(t.gamepadIndices).length))throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach((e=>{const s=new ve(t.visualResponses[e]);this.visualResponses[e]=s})),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:fe.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=fe.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||1===this.values.button?this.values.state=fe.ComponentState.PRESSED:(t.touched||this.values.button>fe.ButtonTouchThreshold)&&(this.values.state=fe.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===fe.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>fe.AxisTouchThreshold&&(this.values.state=fe.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===fe.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>fe.AxisTouchThreshold&&(this.values.state=fe.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((e=>{e.updateFromComponent(this.values)}))}}class we{constructor(e,t,s){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=s,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach((e=>{const t=this.layoutDescription.components[e];this.components[e]=new _e(e,t)})),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach((t=>{e.push(t.data)})),e}updateFromGamepad(){Object.values(this.components).forEach((e=>{e.updateFromGamepad(this.xrInputSource.gamepad)}))}}class Se extends THREE.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e||(this.envMap=e,this.traverse((e=>{e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}))),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach((e=>{Object.values(e.visualResponses).forEach((e=>{const{valueNode:t,minNode:s,maxNode:i,value:n,valueNodeProperty:l}=e;t&&(l===fe.VisualResponseProperty.VISIBILITY?t.visible=n:l===fe.VisualResponseProperty.TRANSFORM&&(t.quaternion.slerpQuaternions(s.quaternion,i.quaternion,n),t.position.lerpVectors(s.position,i.position,n)))}))})))}}function Ae(e,t){!function(e,t){Object.values(e.components).forEach((e=>{const{type:s,touchPointNodeName:i,visualResponses:n}=e;if(s===fe.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){const t=new SphereGeometry(.001),s=new MeshBasicMaterial({color:255}),i=new Mesh(t,s);e.touchPointNode.add(i)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(n).forEach((e=>{const{valueNodeName:s,minNodeName:i,maxNodeName:n,valueNodeProperty:l}=e;if(l===fe.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(i),e.maxNode=t.getObjectByName(n),!e.minNode)return void console.warn(`Could not find ${i} in the model`);if(!e.maxNode)return void console.warn(`Could not find ${n} in the model`)}e.valueNode=t.getObjectByName(s),e.valueNode||console.warn(`Could not find ${s} in the model`)}))}))}(e.motionController,t),e.envMap&&t.traverse((t=>{t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)})),e.add(t)}class xe{constructor(e=null){this.gltfLoader=e,this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",this._assetCache={},this.gltfLoader||(this.gltfLoader=new f)}createControllerModel(e){const t=new Se;let s=null;return e.addEventListener("connected",(e=>{const i=e.data;"tracked-pointer"===i.targetRayMode&&i.gamepad&&be(i,this.path,"generic-trigger").then((({profile:e,assetPath:n})=>{t.motionController=new we(i,e,n);const l=this._assetCache[t.motionController.assetUrl];if(l)s=l.scene.clone(),Ae(t,s);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,(e=>{this._assetCache[t.motionController.assetUrl]=e,s=e.scene.clone(),Ae(t,s)}),null,(()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)}))}})).catch((e=>{console.warn(e)}))})),e.addEventListener("disconnected",(()=>{t.motionController=null,t.remove(s),s=null})),t}}class ke extends THREE.EventDispatcher{constructor(e){if(super(),void 0===e)return void console.error("ControllerGestures must be passed a renderer");const t=new THREE.Clock;this.controller1=e.xr.getController(0),this.controller1.userData.gestures={index:0},this.controller1.userData.selectPressed=!1,this.controller1.addEventListener("selectstart",i),this.controller1.addEventListener("selectend",n),this.controller2=e.xr.getController(1),this.controller2.userData.gestures={index:1},this.controller2.userData.selectPressed=!1,this.controller2.addEventListener("selectstart",i),this.controller2.addEventListener("selectend",n),this.doubleClickLimit=.2,this.pressMinimum=.4,this.right=new THREE.Vector3(1,0,0),this.up=new THREE.Vector3(0,1,0),this.type="unknown",this.prevTap="none",this.clock=t;const s=this;function i(){const e=this.userData.gestures;e.startPosition=void 0,e.startTime=t.getElapsedTime(),-1==s.type.indexOf("tap")&&(e.taps=0),s.type="unknown",this.userData.selectPressed=!0}function n(){const e=this.userData.gestures;e.endTime=t.getElapsedTime();e.endTime-e.startTime.05&&(e.startPosition=this.controller1.position.clone())),this.controller2.userData.selectPressed&&void 0===t.startPosition&&(i=s-t.startTime,i>.05&&(t.startPosition=this.controller2.position.clone())),!this.controller1.userData.selectPressed&&"tap"===this.type&&(i=this.clock.getElapsedTime()-e.endTime,i>this.doubleClickLimit)){switch(e.taps){case 1:self.prevTap="tap";break;case 2:this.dispatchEvent({type:"doubletap",position:this.controller1.position,matrixWorld:this.controller1.matrixWorld}),self.prevTap="doubletap"}this.type="unknown",e.taps=0}if("unknown"===this.type&&this.touch)"doubletap"==self.prevTap?(this.type="pinch",this.startDistance=this.controller1.position.distanceTo(this.controller2.position),this.dispatchEvent({type:"pinch",delta:new THREE.Vector3(0,0,0),scale:1,initialise:!0})):(this.type="pan",this.startPosition=this.controller1.position.clone(),this.dispatchEvent({type:"pan",delta:new THREE.Vector3(0,0,0),initialise:!0}));else if(("pinch"===this.type||"pan"===this.type)&&"doubletap"==self.prevTap&&this.controller2.position){const e=this.controller1.position.distanceTo(this.controller2.position)/this.startDistance,t=this.controller1.position.clone().sub(this.startPosition);this.dispatchEvent({type:"pinch",delta:t,scale:e})}}}class Oe{constructor(e,t){this.config=void 0===t?{panelSize:{width:1,height:1},width:512,height:512,opacity:.7,body:{fontFamily:"Arial",fontSize:30,padding:2,backgroundColor:"#000",fontColor:"#fff",borderRadius:6}}:t,void 0===this.config.width&&(this.config.width=512),void 0===this.config.height&&(this.config.height=512),void 0===this.config.body&&(this.config.body={fontFamily:"Arial",size:30,padding:2,backgroundColor:"#000",fontColor:"#fff",borderRadius:6});const s=this.config.body;void 0===s.borderRadius&&(s.borderRadius=6),void 0===s.fontFamily&&(s.fontFamily="Arial"),void 0===s.padding&&(s.padding=2),void 0===s.fontSize&&(s.fontSize=30),void 0===s.backgroundColor&&(s.backgroundColor="#000"),void 0===s.fontColor&&(s.fontColor="#fff"),Object.entries(this.config).forEach((([e,t])=>{if(!("object"!=typeof t||"panelSize"===e||t instanceof THREE.WebGLRenderer||t instanceof THREE.Scene)){const e=void 0!==t.position?t.position:{x:0,y:0};void 0!==e.left&&void 0===e.x&&(e.x=e.left),void 0!==e.top&&void 0===e.y&&(e.y=e.top);const s=void 0!==t.width?t.width:this.config.width,i=void 0!==t.height?t.height:this.config.height;void 0!==e.right&&void 0===e.x&&(e.x=this.config.width-e.right-s),void 0!==e.bottom&&void 0===e.y&&(e.y=this.config.height-e.bottom-i),void 0===e.x&&(e.x=0),void 0===e.y&&(e.y=0),t.position=e,void 0===t.type&&(t.type="text")}}));const i=this.createOffscreenCanvas(this.config.width,this.config.height);this.context=i.getContext("2d"),this.context.save();const n=void 0!==this.config.opacity?this.config.opacity:.7,l=new THREE.MeshBasicMaterial({transparent:!0,opacity:n});this.panelSize=void 0!==this.config.panelSize?this.config.panelSize:{width:1,height:1};const r=new THREE.PlaneGeometry(this.panelSize.width,this.panelSize.height);this.mesh=new THREE.Mesh(r,l),this.texture=new THREE.CanvasTexture(i),this.mesh.material.map=this.texture,this.scene=this.config.scene;if(Object.values(this.config).filter((e=>"input-text"===e.type)).length>0){this.keyboard=new Re(this.panelSize.width,this.config.renderer);this.keyboard.mesh.position.set(0,-.3,.2),this.mesh.add(this.keyboard.mesh)}if(void 0===e)this.content={body:""},this.config.body.type="text";else{this.content=e;Object.values(t).filter((e=>"button"===e.type||"scroll"===e.overflow||"input-text"===e.type)).length>0&&(void 0===t||void 0===t.renderer?console.warn("CanvasUI: button, scroll or input-text in the config but no renderer"):(this.renderer=t.renderer,this.initControllers()))}this.selectedElements=[void 0,void 0],this.selectPressed=[!1,!1],this.scrollData=[void 0,void 0],this.intersects=[void 0,void 0],this.needsUpdate=!0,this.update()}getIntersectY(e){const t=this.config.height||512,s=this.intersects[e];return void 0===s||void 0===s.uv?0:(1-s.uv.y)*t}initControllers(){this.vec3=new THREE.Vector3,this.mat4=new THREE.Matrix4,this.raycaster=new THREE.Raycaster;const e=this;function t(t){const s=t.target===e.controller?0:1,i=e.selectedElements[s];if(void 0!==i)if("button"==i.type)e.select(s);else if("input-text"==i.type&&e.keyboard)if(e.keyboard.visible)e.keyboard.linkedUI=void 0,e.keyboard.linkedText=void 0,e.keyboard.linkedElement=void 0,e.keyboard.visible=!1;else{let t;e.keyboard.linkedUI=e,Object.entries(e.config).forEach((([e,s])=>{s==i&&(t=e)}));const s=(.5-(i.position.y+i.height+e.config.body.padding)/e.config.height)*e.panelSize.height,n=Math.max(e.panelSize.width,e.panelSize.height)/2;e.keyboard.position.set(0,-n/1.5-s,.1),e.keyboard.linkedText=e.content[t],e.keyboard.linkedName=t,e.keyboard.linkedElement=i,e.keyboard.visible=!0}}function s(t){const s=t.target===e.controller?0:1;if(e.selectPressed[s]=!0,void 0!==e.selectedElements[s]&&"scroll"==e.selectedElements[s].overflow){const t=e.selectedElements[s];e.scrollData[s]={scrollY:t.scrollY,rayY:e.getIntersectY(s)}}}function i(t){const s=t.target===e.controller?0:1;e.selectPressed[s]=!1,void 0!==e.selectedElements[s]&&"scroll"==e.selectedElements[s].overflow&&(e.scrollData[s]=void 0)}if(this.controller=this.renderer.xr.getController(0),this.controller.addEventListener("select",t),this.controller.addEventListener("selectstart",s),this.controller.addEventListener("selectend",i),this.controller1=this.renderer.xr.getController(1),this.controller1.addEventListener("select",t),this.controller1.addEventListener("selectstart",s),this.controller1.addEventListener("selectend",i),this.scene){const e=.015,t=new THREE.IcosahedronBufferGeometry(e),s=new THREE.MeshBasicMaterial({color:170}),i=new THREE.Mesh(t,s);i.visible=!1,this.scene.add(i);const n=new THREE.Mesh(t,s);n.visible=!1,this.scene.add(n),this.intersectMesh=[i,n]}}setClip(e){const t=this.context;if(t.restore(),t.save(),void 0!==e.clipPath){const s=new Path2D(e.clipPath);t.clip(s)}else{const s=void 0!==e.position?e.position:{x:0,y:0},i=e.borderRadius||0,n=e.width||this.config.width,l=e.height||this.config.height;if(t.beginPath(),0!==i){const e=Math.PI/2;t.moveTo(s.x+i,s.y),t.arc(s.x+i,s.y+i,i,e,2*e,!0),t.lineTo(s.x,s.y+l-i),t.arc(s.x+i,s.y+l-i,i,0,e,!0),t.lineTo(s.x+n-i,s.y+l),t.arc(s.x+n-i,s.y+l-i,i,3*e,4*e,!0),t.lineTo(s.x+n,s.y+i),t.arc(s.x+n-i,s.y+i,i,2*e,3*e,!0),t.closePath(),t.clip()}else t.rect(s.x,s.y,n,l),t.clip()}}setPosition(e,t,s){void 0!==this.mesh&&this.mesh.position.set(e,t,s)}setRotation(e,t,s){void 0!==this.mesh&&this.mesh.rotation.set(e,t,s)}updateElement(e,t){let s=this.content[e];void 0!==s?("object"==typeof s?s.content=t:s=t,this.content[e]=s,this.needsUpdate=!0):console.warn(`CanvasGUI.updateElement: No ${e} found`)}get panel(){return this.mesh}getElementAtLocation(e,t){const s=this,i=Object.entries(this.config).filter((([i,n])=>{if(!("object"!=typeof n||"panelSize"===i||"body"===i||n instanceof THREE.WebGLRenderer||n instanceof THREE.Scene)){const i=n.position,l=void 0!==n.width?n.width:s.config.width,r=void 0!==n.height?n.height:s.config.height;return e>=i.x&&e=i.y&&t0?(this.hover(t,s[0].uv),this.intersects[t]=s[0],this.scroll(t)):(this.hover(t),this.intersects[t]=void 0,this.scroll(t))}update(){if(void 0===this.mesh)return;if(this.controller&&this.handleController(this.controller,0),this.controller1&&this.handleController(this.controller1,1),this.keyboard&&this.keyboard.visible&&this.keyboard.update(),!this.needsUpdate)return;let e=this.context;e.clearRect(0,0,this.config.width,this.config.height);const t=this.config.body.backgroundColor?this.config.body.backgroundColor:"#000";!this.config.body.fontFamily||this.config.body.fontFamily;const s=this.config.body.fontColor?this.config.body.fontColor:"#fff";!this.config.body.fontSize||this.config.body.fontSize,this.setClip(this.config.body),e.fillStyle=t,e.fillRect(0,0,this.config.width,this.config.height);const i=this;Object.entries(this.content).forEach((([t,n])=>{const l=void 0!==i.config[t]?i.config[t]:i.config.body;if("none"!==(void 0!==l.display?l.display:"block")){const r=void 0!==l.position?l.position:{x:0,y:0},o=void 0!==l.width?l.width:i.config.width,a=void 0!==l.height?l.height:i.config.height;"button"!=l.type||n.toLowerCase().startsWith("")||(void 0===l.borderRadius&&(l.borderRadius=6),void 0===l.textAlign&&(l.textAlign="center")),i.setClip(l);const d=n.toLowerCase().startsWith(""),c=void 0!==i.selectedElements[0]&&this.selectedElements[0]===l||void 0!==i.selectedElements[1]&&this.selectedElements[1]===l;if(void 0!==l.backgroundColor&&(c&&"button"==l.type&&void 0!==l.hover?e.fillStyle=l.hover:e.fillStyle=l.backgroundColor,e.fillRect(r.x,r.y,o,a)),"text"==l.type||"button"==l.type||"input-text"==l.type){let h=!1;if(c?(d||"button"!=l.type?e.fillStyle=void 0!==l.hover?l.hover:void 0!==l.fontColor?l.fontColor:s:e.fillStyle=void 0!==l.fontColor?l.fontColor:s,h=void 0===l.hover):e.fillStyle=void 0!==l.fontColor?l.fontColor:s,d){const t=n.toUpperCase().substring(6,n.length-7);e.save(),e.translate(r.x,r.y);const s=new Path2D(t);e.fill(s),e.restore()}else i.wrapText(t,n);h&&(e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2,e.rect(r.x,r.y,o,a),e.stroke())}else if("img"==l.type)if(void 0===l.img)this.loadImage(n).then((e=>{console.log(`w: ${e.width} | h: ${e.height}`),l.img=e,i.needsUpdate=!0,i.update()})).catch((e=>console.error(e)));else{const t=o/(l.img.width/l.img.height);e.drawImage(l.img,r.x,r.y,o,t)}}})),this.needsUpdate=!1,this.texture.needsUpdate=!0}loadImage(e){return new Promise(((t,s)=>{const i=new THREE.Image;i.addEventListener("load",(()=>t(i))),i.addEventListener("error",(e=>s(e))),i.src=e}))}createOffscreenCanvas(e,t){const s=document.createElement("canvas");return s.width=e,s.height=t,s}fillRoundedRect(e,t,s,i,n){const l=this.context;l.beginPath(),l.moveTo(e+n,t),l.lineTo(e+s-n,t),l.quadraticCurveTo(e+s,t,e+s,t+n),l.lineTo(e+s,t+i-n),l.quadraticCurveTo(e+s,t+i,e+s-n,t+i),l.lineTo(e+n,t+i),l.quadraticCurveTo(e,t+i,e,t+i-n),l.lineTo(e,t+n),l.quadraticCurveTo(e,t,e+n,t),l.closePath(),l.fill()}lookAt(e){void 0!==this.mesh&&(e instanceof Vector3?this.mesh.lookAt(e):console.error("CanvasUI lookAt called parameter not a THREE.Vector3"))}get visible(){return void 0!==this.mesh&&this.mesh.visible}set visible(e){this.mesh&&(this.mesh.visible=e)}get position(){if(void 0!==this.mesh)return this.mesh.position}set position(e){void 0!==this.mesh&&(e instanceof Vector3?this.mesh.position.copy(e):console.error("CanvasUI trying to set the mesh position using a parameter that is not a THREE.Vector3"))}get quaternion(){if(void 0!==this.mesh)return this.mesh.quaternion}set quaternion(e){void 0!==this.mesh&&(e instanceof QUaternion?this.mesh.quaternion.copy(e):console.error("CanvasUI trying to set the mesh quaternion using a parameter that is not a THREE.Quaternion"))}wrapText(e,t){const s=t.split(" ");let i="";const n=[],l=void 0!==this.config[e]?this.config[e]:this.config.body,r=void 0!==l.width?l.width:this.config.width,o=void 0!==l.height?l.height:this.config.height,a=void 0!==l.position?l.position:{x:0,y:0},d=void 0!==l.padding?l.padding:void 0!==this.config.body.padding?this.config.body.padding:10,c=void 0!==l.paddingTop?l.paddingTop:d,h=void 0!==l.paddingLeft?l.paddingLeft:d,p=void 0!==l.paddingBottom?l.paddingBottom:d,m=void 0!==l.paddingRight?l.paddingRight:d,u={x:a.x+h,y:a.y+c,width:r-h-m,height:o-c-p},g=void 0!==l.textAlign?l.textAlign:void 0!==this.config.body.textAlign?this.config.body.textAlign:"left",f=void 0!==l.fontSize?l.fontSize:void 0!==this.config.body.fontSize?this.config.body.fontSize:30,C=void 0!==l.fontFamily?l.fontFamily:void 0!==this.config.body.fontFamily?this.config.body.fontFamily:"Arial",b=f+(void 0!==l.leading?l.leading:void 0!==this.config.body.leading?this.config.body.leading:8),y=this.context;y.textAlign=g,y.font=`${f}px '${C}'`,s.forEach((function(e){let t=s.length>1?`${i}${e} `:e,l=y.measureText(t);if(l.width>u.width&&e.length>1)if(0==i.length&&l.width>u.width){for(;l.width>u.width;){let s=0;do{s++,t=e.substr(0,s),l=y.measureText(t)}while(l.widthu.height&&"scroll"===l.overflow){void 0===l.scrollY&&(l.scrollY=0);const e=void 0!==l.fontColor?l.fontColor:this.config.body.fontColor;y.fillStyle="#aaa",this.fillRoundedRect(a.x+r-12,a.y,12,o,6),y.fillStyle="#666";const t=u.height/v,s=t*o,i=-l.scrollY*t;this.fillRoundedRect(a.x+r-12,a.y+i,12,s,6),y.fillStyle=e,_=l.scrollY,l.minScrollY=u.height-v}let w,S=_+u.y+f/2;switch(g){case"center":w=u.x+u.width/2;break;case"right":w=u.x+u.width;break;default:w=u.x}n.forEach((e=>{S+b>0&&y.fillText(e,w,S),S+=b}))}}class Re{constructor(e,t,s="EN"){const i=this.getConfig(s);i.panelSize={width:e,height:.5*e},i.height=256,i.body={backgroundColor:"#555"},i.renderer=t;const n=this.getContent(s);this.keyboard=new Oe(n,i),this.keyboard.mesh.visible=!1,this.shift=!1}get mesh(){return this.keyboard.mesh}getConfig(e){const t={};let s=10;const i=39.2,n=49,l="#333",r="#000";let o=s,a=s;for(let e=0;e<10;e++){const d={type:"button",position:{x:a,y:o},width:i,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e)};t[`btn${e}`]=d,a+=49.2}o+=59,a=s;for(let e=0;e<10;e++){const d={type:"button",position:{x:a,y:o},width:i,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e+10)};t[`btn${e+10}`]=d,a+=49.2}o+=59,a=s;for(let e=0;e<9;e++){const d=0==e||8==e?1.5*i+5:i,c={type:"button",position:{x:a,y:o},width:d,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e+20)};t[`btn${e+20}`]=c,a+=d+s}o+=59,a=s;for(let e=0;e<5;e++){const d=0==e||4==e?88.4:2==e?186.8:i,c={type:"button",position:{x:a,y:o},width:d,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e+30)};0==e&&(c.fontSize=20),t[`btn${e+30}`]=c,a+=d+s}return t}getContent(e,t=0){let s,i={};switch(this.language=e,this.keyboardIndex=t,t){case 0:s=["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","@","⇧","z","x","c","v","b","n","m","⇦","","?123",","," ",".","↲"];for(let e=0;e","_","`","~",":",";","⇦","","abc",","," ",".","↲"];for(let e=0;e=0;e--){let s=t.scene.children[e];t.scene.remove(s)}else t.scene=new THREE.Scene;if(void 0!==t.scene_ghost)for(let e=t.scene_ghost.children.length-1;e>=0;e--){let s=t.scene_ghost.children[e];t.scene_ghost.remove(s)}else t.scene_ghost=new THREE.Scene;if(""!=s.htmlCls.setHtmlCls.getCookie("shininess")){let e=parseFloat(s.htmlCls.setHtmlCls.getCookie("shininess"));t.shininess!=e&&s.htmlCls.clickMenuCls.setLogCmd("set shininess "+e,!0),t.shininess=e}if(!s.bNode&&""!=s.htmlCls.setHtmlCls.getCookie("light1")){let e=parseFloat(s.htmlCls.setHtmlCls.getCookie("light1")),i=parseFloat(s.htmlCls.setHtmlCls.getCookie("light2")),n=parseFloat(s.htmlCls.setHtmlCls.getCookie("light3"));t.light1==e&&t.light2==i&&t.light3==n||s.htmlCls.clickMenuCls.setLogCmd("set light | light1 "+e+" | light2 "+i+" | light3 "+n,!0),t.light1=e,t.light2=i,t.light3=n}t.directionalLight=new THREE.DirectionalLight(16777215,t.light1),t.directionalLight2=new THREE.DirectionalLight(16777215,t.light2),t.directionalLight3=new THREE.DirectionalLight(16777215,t.light3),t.cam_z>0?(t.directionalLight.position.set(-1,1,1),t.directionalLight2.position.set(1,1,1),t.directionalLight3.position.set(1,1,-1),t.lightPos=new THREE.Vector3(-1,1,1),t.lightPos2=new THREE.Vector3(1,1,1),t.lightPos3=new THREE.Vector3(1,1,-1)):(t.directionalLight.position.set(-1,1,-1),t.directionalLight2.position.set(1,1,-1),t.directionalLight3.position.set(1,1,1),t.lightPos=new THREE.Vector3(-1,1,-1),t.lightPos2=new THREE.Vector3(1,1,-1),t.lightPos3=new THREE.Vector3(1,1,1));let i=new THREE.AmbientLight(4210752);if(t.scene.add(t.directionalLight),t.scene.add(i),void 0!==t.mdl)for(let e=t.mdl.children.length-1;e>=0;e--){let s=t.mdl.children[e];s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose(),t.mdl.remove(s)}if(void 0!==t.mdlImpostor){for(let e=t.mdlImpostor.children.length-1;e>=0;e--){let s=t.mdlImpostor.children[e];s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose(),t.mdlImpostor.remove(s)}t.mdlImpostor.children.length=0}s.bNode||t.renderer.renderLists.dispose(),t.mdl=new THREE.Object3D,t.mdlImpostor=new THREE.Object3D,t.scene.add(t.mdl),t.scene.add(t.mdlImpostor),t.mdl_ghost=new THREE.Object3D,t.scene_ghost.add(t.mdl_ghost),t.objects=[],t.objects_ghost=[],t.raycaster=new THREE.Raycaster,t.projector=new THREE.Projector,t.mouse=new THREE.Vector2;let n=s.parasCls.backgroundColors[t.opts.background.toLowerCase()];s.bNode||("transparent"===t.opts.background.toLowerCase()?t.renderer.setClearColor(n,0):t.renderer.setClearColor(n,1)),t.perspectiveCamera=new THREE.PerspectiveCamera(20,t.container.whratio,.1,1e4),t.perspectiveCamera.position.set(0,0,t.cam_z),t.perspectiveCamera.lookAt(new THREE.Vector3(0,0,0)),t.orthographicCamera=new THREE.OrthographicCamera,t.orthographicCamera.position.set(0,0,t.cam_z),t.orthographicCamera.lookAt(new THREE.Vector3(0,0,0)),t.cams={perspective:t.perspectiveCamera,orthographic:t.orthographicCamera}}setVrAr(){let e=this.icn3d;e.icn3dui;let t=this;e.bSetVrAr=!0,e.bVr?(e.canvasUI=this.createUI(),e.raycasterVR=new THREE.Raycaster,e.workingMatrix=new THREE.Matrix4,e.workingVector=new THREE.Vector3,e.origin=new THREE.Vector3,e.dolly=new THREE.Object3D,e.dolly.position.z=5,e.dolly.add(e.cam),e.scene.add(e.dolly),e.dollyId=e.dolly.id,e.dummyCam=new THREE.Object3D,e.cam.add(e.dummyCam),e.clock=new THREE.Clock,e.controllers=this.getControllers(),e.controllers.forEach((s=>{s.addEventListener("connected",(function(e){try{const s={},i="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",n="generic-trigger";be(e.data,i,n).then((({profile:i,assetPath:n})=>{s.name=i.profileId,s.targetRayMode=e.data.targetRayMode,Object.entries(i.layouts).forEach((([e,t])=>{const i={};Object.values(t.components).forEach((e=>{i[e.rootNodeName]=e.gamepadIndices})),s[e]=i})),t.updateControllers(s)}))}catch(e){}})),s.addEventListener("disconnected",(function(){this.remove(this.children[0]),e.controllers.forEach((e=>{}))}))}))):e.bAr&&(e.gestures=new ke(e.renderer),e.scene.add(e.gestures.controller1),e.scene.add(e.gestures.controller2),e.gestures.addEventListener("doubletap",(e=>{t.positionCenter()})),e.gestures.addEventListener("pinch",(s=>{if(void 0!==s.initialise)t.startPosition=e.mdl.position.clone(),t.startScale=e.mdl.scale.clone();else{let i=1;const n=t.startScale.clone().multiplyScalar(s.scale*i);e.mdl.scale.copy(n)}})))}positionCenter(){let e=this.icn3d;e.icn3dui;const t=e.gestures.controller1;e.mdl.position.set(-.06,0,-.6).applyMatrix4(t.matrixWorld),e.mdl.scale.copy(new THREE.Vector3(.005,.005,.005))}setVrArButtons(){let e=this.icn3d,t=e.icn3dui;e.bSetVrArButtons=!0,t.bNode||($("#"+t.pre+"VRButton").remove(),$("#"+t.pre+"viewer").get(0).appendChild(e.VRButtonCls.createButton(e.renderer)),$("#"+t.pre+"ARButton").remove(),$("#"+t.pre+"viewer").get(0).appendChild(e.ARButtonCls.createButton(e.renderer)))}updateControllers(e){this.icn3d.icn3dui,this.addEventForController(e,"right"),this.addEventForController(e,"left")}addEventForController(e,t){let s=this.icn3d;s.icn3dui;const i="right"==t?s.renderer.xr.getController(0):s.renderer.xr.getController(1),n="right"==t?e.right:e.left;if(i&&void 0!==n){let e=!1,t=!1;Object.keys(n).forEach((i=>{-1!=i.indexOf("trigger")&&(e=!0),-1!=i.indexOf("squeeze")&&(t=!0),-1==i.indexOf("thumbstick")&&-1==i.indexOf("touchpad")||(s.xAxisIndex=n[i].xAxis,s.yAxisIndex=n[i].yAxis)})),e&&(i.addEventListener("selectstart",(function(){this.userData.selectPressed=!0})),i.addEventListener("selectend",(function(){this.userData.selectPressed=!1,this.userData.selected=void 0}))),t&&(i.addEventListener("squeezestart",(function(){this.userData.squeezePressed=!0,s.cam.add(s.canvasUI.mesh)})),i.addEventListener("squeezeend",(function(){this.userData.squeezePressed=!1,s.cam.remove(s.canvasUI.mesh)})))}}createUI(){let e=this.icn3d,t=e.icn3dui,s=94,i=50,n=94,l=34,r=12,o="#1c94c4",a="#ccc",d="#fbcb09",c=20;const h={panelSize:{width:2,height:1.6},height:400,select:{type:"button",paddingTop:c,position:{top:6,left:6},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},residue:{type:"button",paddingTop:c,position:{top:62,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=2,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},secondarySelect:{type:"button",paddingTop:12,position:{top:118,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=3,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},chainSelect:{type:"button",paddingTop:c,position:{top:174,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=5,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},atom:{type:"button",paddingTop:c,position:{top:230,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=1,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},reset:{type:"button",paddingTop:c,position:{top:286,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.viewInterPairsCls.resetInteractionPairs(),e.selectionCls.resetAll(),e.cam.remove(e.canvasUI.mesh)}},togglehl:{type:"button",paddingTop:12,position:{top:342,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.hlUpdateCls.toggleHighlight(),e.cam.remove(e.canvasUI.mesh)}},style:{type:"button",paddingTop:c,position:{top:6,left:106},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},ribbon:{type:"button",paddingTop:c,position:{top:62,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","ribbon"),e.setOptionCls.setStyle("nucleotides","nucleotide cartoon"),e.cam.remove(e.canvasUI.mesh)}},schematic:{type:"button",paddingTop:c,position:{top:118,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","schematic"),e.setOptionCls.setStyle("nucleotides","schematic"),e.cam.remove(e.canvasUI.mesh)}},stick:{type:"button",paddingTop:c,position:{top:174,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","stick"),e.setOptionCls.setStyle("nucleotides","stick"),e.cam.remove(e.canvasUI.mesh)}},sphere:{type:"button",paddingTop:c,position:{top:230,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","sphere"),e.setOptionCls.setStyle("nucleotides","sphere"),e.cam.remove(e.canvasUI.mesh)}},surface:{type:"button",paddingTop:c,position:{top:286,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.opts.surface="molecular surface",e.applyMapCls.applySurfaceOptions(),e.cam.remove(e.canvasUI.mesh)}},surfaceTrn:{type:"button",paddingTop:12,position:{top:342,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.opts.surface="molecular surface",e.opts.opacity="0.2",e.applyMapCls.applySurfaceOptions(),e.cam.remove(e.canvasUI.mesh)}},color:{type:"button",paddingTop:c,position:{top:6,left:206},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},rainbow:{type:"button",paddingTop:c,position:{top:62,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","rainbow for chains"),e.cam.remove(e.canvasUI.mesh)}},atomColor:{type:"button",paddingTop:c,position:{top:118,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","atom"),e.cam.remove(e.canvasUI.mesh)}},chainColor:{type:"button",paddingTop:c,position:{top:174,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","chain"),e.cam.remove(e.canvasUI.mesh)}},secondaryColor:{type:"button",paddingTop:12,position:{top:230,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","secondary structure green"),e.cam.remove(e.canvasUI.mesh)}},charge:{type:"button",paddingTop:c,position:{top:342,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","charge"),e.cam.remove(e.canvasUI.mesh)}},AlphaFold:{type:"button",paddingTop:c,position:{top:286,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","confidence"),e.cam.remove(e.canvasUI.mesh)}},unicolor:{type:"button",paddingTop:c,position:{top:6,left:306},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},red:{type:"button",position:{top:i,left:300},width:n,height:l,fontColor:"red",hover:d,onSelect:function(){e.setOptionCls.setOption("color","red"),e.cam.remove(e.canvasUI.mesh)}},green:{type:"button",position:{top:78,left:300},width:n,height:l,fontColor:"green",hover:d,onSelect:function(){e.setOptionCls.setOption("color","green"),e.cam.remove(e.canvasUI.mesh)}},blue:{type:"button",position:{top:106,left:300},width:n,height:l,fontColor:"blue",hover:d,onSelect:function(){e.setOptionCls.setOption("color","blue"),e.cam.remove(e.canvasUI.mesh)}},blueviolet:{type:"button",position:{top:134,left:300},width:n,height:l,fontColor:"#8A2BE2",hover:d,onSelect:function(){e.setOptionCls.setOption("color","8A2BE2"),e.cam.remove(e.canvasUI.mesh)}},magenta:{type:"button",position:{top:162,left:300},width:n,height:l,fontColor:"magenta",hover:d,onSelect:function(){e.setOptionCls.setOption("color","magenta"),e.cam.remove(e.canvasUI.mesh)}},yellow:{type:"button",position:{top:190,left:300},width:n,height:l,fontColor:"yellow",hover:d,onSelect:function(){e.setOptionCls.setOption("color","yellow"),e.cam.remove(e.canvasUI.mesh)}},orange:{type:"button",position:{top:218,left:300},width:n,height:l,fontColor:"orange",hover:d,onSelect:function(){e.setOptionCls.setOption("color","FFA500"),e.cam.remove(e.canvasUI.mesh)}},cyan:{type:"button",position:{top:246,left:300},width:n,height:l,fontColor:"cyan",hover:d,onSelect:function(){e.setOptionCls.setOption("color","cyan"),e.cam.remove(e.canvasUI.mesh)}},gray:{type:"button",position:{top:274,left:300},width:n,height:l,fontColor:"gray",hover:d,onSelect:function(){e.setOptionCls.setOption("color","888888"),e.cam.remove(e.canvasUI.mesh)}},white:{type:"button",position:{top:302,left:300},width:n,height:l,fontColor:"white",hover:d,onSelect:function(){e.setOptionCls.setOption("color","white"),e.cam.remove(e.canvasUI.mesh)}},analysis:{type:"button",paddingTop:c,position:{top:6,left:406},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},distance:{type:"button",paddingTop:c,position:{top:62,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){try{e.bMeasureDistance=!0;let s=e.pickingCls.getPickedAtomList(e.pk,e.pAtom),i=e.pickingCls.getPickedAtomList(e.pk,e.pAtom2),n=e.applyCenterCls.centerAtoms(t.hashUtilsCls.hash2Atoms(s,e.atoms)).center,l=e.applyCenterCls.centerAtoms(t.hashUtilsCls.hash2Atoms(i,e.atoms)).center,r=0,o=0,a="#FFFF00",d=(n.x+l.x)/2,c=(n.y+l.y)/2,h=(n.z+l.z)/2,p=!0;e.analysisCls.addLine(n.x,n.y,n.z,l.x,l.y,l.z,a,p,"distance");let m=(parseInt(10*n.distanceTo(l))/10).toString()+" A";e.analysisCls.addLabel(m,d,c,h,r,a,o,"distance"),e.drawCls.draw(),e.cam.remove(e.canvasUI.mesh)}catch(e){}}},interaction:{type:"button",paddingTop:c,position:{top:118,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){try{e.viewInterPairsCls.viewInteractionPairs(["selected"],["non-selected"],!1,"3d",1,1,1,1,1,1),e.cam.remove(e.canvasUI.mesh)}catch(e){}}},delphi:{type:"button",paddingTop:c,position:{top:174,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:async function(){e.phisurftype=22,e.phisurfop=1,e.phisurfwf="no",await e.delphiCls.CalcPhi(65,.15,2,!0),e.cam.remove(e.canvasUI.mesh)}},removeLabel:{type:"button",paddingTop:c,position:{top:230,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){for(let t in e.labels)e.labels[t]=[];e.drawCls.draw(),e.cam.remove(e.canvasUI.mesh)}},renderer:e.renderer},p=new Oe({select:"Select",residue:"Residue",secondarySelect:"Secondary Structure",chainSelect:"Chain",atom:"Atom",reset:"Reset",togglehl:"Toggle Highlight",style:"Style",ribbon:"Ribbon",schematic:"Schematic",stick:"Stick",sphere:"Sphere",surface:"Surface",surfaceTrn:"Transparent Surface",color:"Color",rainbow:"Rainbow",atomColor:"Atom",chainColor:"Chain",secondaryColor:"Secondary Structure",AlphaFold:"AlphaFold",charge:"Charge",unicolor:"UniColor",red:"M 100 15 L 15 15 L 15 100 L 100 100 Z",green:"M 100 15 L 15 15 L 15 100 L 100 100 Z",blue:"M 100 15 L 15 15 L 15 100 L 100 100 Z",blueviolet:"M 100 15 L 15 15 L 15 100 L 100 100 Z",magenta:"M 100 15 L 15 15 L 15 100 L 100 100 Z",yellow:"M 100 15 L 15 15 L 15 100 L 100 100 Z",orange:"M 100 15 L 15 15 L 15 100 L 100 100 Z",cyan:"M 100 15 L 15 15 L 15 100 L 100 100 Z",gray:"M 100 15 L 15 15 L 15 100 L 100 100 Z",white:"M 100 15 L 15 15 L 15 100 L 100 100 Z",analysis:"Analysis",distance:"Distance",interaction:"Interaction",delphi:"DelPhi Potential",removeLabel:"Remove Label"},h);return p.mesh.position.set(0,0,-3),p}createUILog(){let e=this.icn3d;e.icn3dui;const t={panelSize:{width:2,height:2},height:512,info:{type:"text",overflow:"scroll",position:{top:6,left:6},width:506,height:506,backgroundColor:"#aaa",fontColor:"#000"},renderer:e.renderer},s=new Oe({info:"Debug info"},t);return s.mesh.position.set(0,-1,-2),s}getControllers(){let e=this.icn3d;e.icn3dui;const t=new xe,s=(new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,-1)]),i=new THREE.Line(s);i.name="line",i.scale.z=50;const n=[];for(let s=0;s<=1;s++){const l=e.renderer.xr.getController(s);if(!l)continue;e.dolly.add(l),l.add(i.clone()),l.userData.selectPressed=!1,e.cam.add(l),n.push(l);const r=e.renderer.xr.getControllerGrip(s);r.add(t.createControllerModel(r)),e.scene.add(r)}return n}}class Ee{constructor(e){this.icn3d=e}setCamera(){let e=this.icn3d,t=e.icn3dui;if(e.bControlGl&&!t.bNode){window.cam=e.cams[e.opts.camera.toLowerCase()];let s=e.maxD;if(window.cam===e.perspectiveCamera){let i=void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>e.maxatomcnt;i?window.camMaxDFactor=1:void 0!==window.camMaxDFactorFog?window.camMaxDFactor=window.camMaxDFactorFog:window.camMaxDFactor=3,window.cam_z>0?window.cam.position.z=s*window.camMaxDFactor:window.cam.position.z=-s*window.camMaxDFactor,"yes"===e.opts.slab?i?window.cam.near=.1:void 0!==window.camMaxDFactorFog?window.cam.near=s*window.camMaxDFactorFog-10:window.cam.near=s*window.camMaxDFactor:window.cam.near=.1,window.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.TrackballControls(window.cam,void 0,e):t.bNode?e.controls=new THREE.TrackballControls(e.cam,document,e):e.controls=new THREE.TrackballControls(e.cam,document.getElementById(e.id),e)}else window.cam===e.orthographicCamera&&(void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>10*e.maxatomcnt?window.cam.right=e.maxD/2*1.5:window.cam.right=e.maxD/2*2.5,window.cam.left=-window.cam.right,window.cam.top=window.cam.right/e.container.whratio,window.cam.bottom=-window.cam.right/e.container.whratio,"yes"===e.opts.slab?window.cam.near=2*e.maxD:window.cam.near=0,window.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.OrthographicTrackballControls(window.cam,void 0,e):t.bNode?e.controls=new THREE.OrthographicTrackballControls(e.cam,document,e):e.controls=new THREE.OrthographicTrackballControls(e.cam,document.getElementById(e.id),e));window.cam.updateProjectionMatrix()}e.cam=e.cams[e.opts.camera.toLowerCase()];let s=e.maxD;if(e.cam===e.perspectiveCamera){let i=void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>e.maxatomcnt;i?e.camMaxDFactor=1:void 0!==e.camMaxDFactorFog?e.camMaxDFactor=e.camMaxDFactorFog:e.camMaxDFactor=3,e.cam_z>0?e.cam.position.z=s*e.camMaxDFactor:e.cam.position.z=-s*e.camMaxDFactor,"yes"===e.opts.slab?i?e.cam.near=.1:void 0!==e.camMaxDFactorFog?e.cam.near=s*e.camMaxDFactorFog-10:e.cam.near=s*e.camMaxDFactor:e.cam.near=.1,e.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.TrackballControls(e.cam,void 0,e):t.bNode?e.controls=new THREE.TrackballControls(e.cam,document,e):e.controls=new THREE.TrackballControls(e.cam,document.getElementById(e.id),e)}else e.cam===e.orthographicCamera&&(void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>10*e.maxatomcnt?e.cam.right=e.maxD/2*1.5:e.cam.right=e.maxD/2*2.5,e.cam.left=-e.cam.right,e.cam.top=e.cam.right/e.container.whratio,e.cam.bottom=-e.cam.right/e.container.whratio,"yes"===e.opts.slab?e.cam.near=2*e.maxD:e.cam.near=0,e.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.OrthographicTrackballControls(e.cam,void 0,e):t.bNode?e.controls=new THREE.OrthographicTrackballControls(e.cam,document,e):e.controls=new THREE.OrthographicTrackballControls(e.cam,document.getElementById(e.id),e));e.cam.updateProjectionMatrix()}}class Te{constructor(e){this.icn3d=e}setFog(e){let t=this.icn3d,s=t.icn3dui.parasCls.backgroundColors[t.opts.background.toLowerCase()];if(e){let e=t.applyCenterCls.centerAtoms(t.hAtoms);t.maxD=e.maxD,t.maxD<25&&(t.maxD=25)}let i=void 0!==t.biomtMatrices&&t.biomtMatrices.length*t.cnt>t.maxatomcnt;if("yes"===t.opts.fog)if("perspective"===t.opts.camera)if(i)t.scene.fog=void 0,t.bSetFog=!1;else{let e=t._zoomFactor>1?1*t._zoomFactor:t._zoomFactor;t.scene.fog=new THREE.Fog(s,2.5*t.maxD*e,4*t.maxD*e),t.bSetFog=!0,t.camMaxDFactorFog=3}else"orthographic"===t.opts.camera&&(t.scene.fog=void 0,t.bSetFog=!1);else t.scene.fog=void 0,t.bSetFog=!1}}class De{constructor(e){this.icn3d=e}createBox(e,t,s,i,n,l){let r=this.icn3d,o=r.icn3dui;if(o.bNode)return;void 0===t&&(t=.8),void 0===s&&(s=!1),void 0===i&&(i=.8),l?void 0===n&&(n=r.hColor):void 0===n&&(n=e.color);let a=s?t:(o.parasCls.vdwRadii[e.elem.toUpperCase()]||t)*(i||1);this.createBox_base(e.coord,a,n,l)}createBox_base(e,t,s,i,n,l,r){let o,a=this.icn3d;a.icn3dui.bNode||(void 0===r&&(r=l?.5:1),new THREE.BoxGeometry(1,1,1),o=new THREE.Mesh(a.boxGeometry,new THREE.MeshPhongMaterial({transparent:!0,opacity:r,specular:a.frac,shininess:a.shininess,emissive:a.emissive,color:s})),o.scale.x=o.scale.y=o.scale.z=t,o.position.copy(e),a.mdl.add(o),i?a.prevHighlightObjects.push(o):n?a.prevOtherMesh.push(o):a.objects.push(o))}createBoxRepresentation_P_CA(e,t,s){let i=this.icn3d;if(i.icn3dui.bNode)return;let n=this;i.reprSubCls.createRepresentationSub(e,(function(e){"CA"!==e.name&&"O3'"!==e.name&&"O3*"!==e.name||n.createBox(e,void 0,void 0,t,void 0,s)}))}}class Pe{constructor(e){this.icn3d=e}createBrick(e,t,s,i){let n=this.icn3d;if(n.icn3dui.bNode)return;let l=new THREE.CylinderGeometry(1,1,1,4,1),r=new THREE.Mesh(l,new THREE.MeshPhongMaterial({specular:n.frac,shininess:n.shininess,emissive:n.emissive,color:i}));r.position.copy(e).add(t).multiplyScalar(.5),r.matrixAutoUpdate=!1,r.lookAt(t.clone().sub(e)),r.updateMatrix(),r.matrix.multiply((new THREE.Matrix4).makeScale(s,s,e.distanceTo(t))).multiply((new THREE.Matrix4).makeRotationX(.5*Math.PI)),n.mdl.add(r)}}class Me{constructor(e){this.icn3d=e}createCurveSubArrow(e,t,s,i,n,l,r,o,a,d,c,h,p,m,u){if(this.icn3d.icn3dui.bNode)return;let g=[],f=[];g.push(e),f.push(o),this.prepareStrand(g,f,t,s,i,void 0,n,l,r,a,d,!1,c,h,p,m,u),g=[],f=[]}createStripArrow(e,t,s,i,n,l,r,o,a,d,c,h,p,m,u,g){if(this.icn3d.icn3dui.bNode)return;let f=[],C=[];f.push(e),f.push(t),C.push(o),C.push(a),this.prepareStrand(f,C,void 0,s,i,n,l,void 0,r,d,c,!0,h,p,m,u,g),f=[],C=[]}prepareStrand(e,t,s,i,n,l,r,o,a,d,c,h,p,m,u,g,f){let C=this.icn3d,b=C.icn3dui;if(1===d.length)return;let y=i,v=!u,_=[];_.push(i[i.length-2]),_.push(i[i.length-1]),n=n||C.axisDIV;let w,S,A,x,k=2/(a-1),O={};for(let e=0,s=t.length;e1)if(void 0!==d){let i,n,l=[];for(let r=0,o=p.length;r0&&i.tubeCls.createTube(a,"CA",i.coilWidth,s),Object.keys(d).length>0&&i.strandCls.createStrand(d,void 0,void 0,!0,0,i.helixSheetWidth,!1,2*i.ribbonthickness,s)):(Object.keys(a).length>0&&i.tubeCls.createTube(a,"CA",i.coilWidth),Object.keys(d).length>0&&i.strandCls.createStrand(d,void 0,void 0,!0,0,i.helixSheetWidth,!1,2*i.ribbonthickness))}createCylinderCurve(e,t,s,i,n){let l=this.icn3d;if(l.icn3dui.bNode)return;let r,o,a,d,c,h,p=null;for(a in e)if(d=e[a],!d.het&&(c=d.structure+"_"+d.chain,h=d.structure+"_"+r,-1!=t.indexOf(d.name))){if(null!==p&&r===d.chain&&l.ParserUtilsCls.getResiNCBI(h,o)+1===l.ParserUtilsCls.getResiNCBI(c,d.resi)&&Math.abs(p.coord.x-d.coord.x)<8&&Math.abs(p.coord.y-d.coord.y)<8&&Math.abs(p.coord.z-d.coord.z)<8){let e=p.coord.clone().add(d.coord).multiplyScalar(.5);if(n)1===n&&(this.createCylinder(p.coord,e,s,p.color,n),this.createCylinder(e,d.coord,s,d.color,n),l.sphereCls.createSphere(d,s,!0,1,n));else if(i){let t=l.lineCls.createSingleLine(p.coord,e,p.color,!1);l.mdl.add(t),l.objects.push(t),t=l.lineCls.createSingleLine(e,d.coord,d.color,!1),l.mdl.add(t),l.objects.push(t)}else this.createCylinder(p.coord,e,s,p.color),this.createCylinder(e,d.coord,s,d.color),l.sphereCls.createSphere(d,s,!0,1,n)}p=d,r=d.chain,o=d.resi,l.sphereCls.createSphere(d,s,!0,1,n),2===n&&l.boxCls.createBox(d,void 0,void 0,void 0,void 0,n)}if(null!==p&&r===d.chain&&l.ParserUtilsCls.getResiNCBI(h,o)+1===l.ParserUtilsCls.getResiNCBI(c,d.resi)&&Math.abs(p.coord.x-d.coord.x)<8&&Math.abs(p.coord.y-d.coord.y)<8&&Math.abs(p.coord.z-d.coord.z)<8){let e=p.coord.add(d.coord).multiplyScalar(.5);if(n)1===n&&(this.createCylinder(p.coord,e,s,p.color,n),this.createCylinder(e,d.coord,s,d.color,n),l.sphereCls.createSphere(d,s,!0,1,n));else if(i){let t=l.lineCls.createSingleLine(p.coord,e,p.color,!1);l.mdl.add(t),l.objects.push(t),t=l.lineCls.createSingleLine(e,d.coord,d.color,!1),l.mdl.add(t),l.objects.push(t)}else this.createCylinder(p.coord,e,s,p.color),this.createCylinder(e,d.coord,s,d.color)}}}class Le{constructor(e){this.icn3d=e}createLineRepresentation(e,t){let s=this.icn3d;if(s.icn3dui.bNode)return;let i=new THREE.BufferGeometry,n=[],l=[],r=0,o=0;s.reprSubCls.createRepresentationSub(e,void 0,(function(e,t){if(e.color===t.color)n[r++]=e.coord.x,n[r++]=e.coord.y,n[r++]=e.coord.z,n[r++]=t.coord.x,n[r++]=t.coord.y,n[r++]=t.coord.z,l[o++]=e.color.r,l[o++]=e.color.g,l[o++]=e.color.b,l[o++]=t.color.r,l[o++]=t.color.g,l[o++]=t.color.b;else{let s=e.coord.clone().add(t.coord).multiplyScalar(.5);n[r++]=e.coord.x,n[r++]=e.coord.y,n[r++]=e.coord.z,n[r++]=s.x,n[r++]=s.y,n[r++]=s.z,n[r++]=t.coord.x,n[r++]=t.coord.y,n[r++]=t.coord.z,n[r++]=s.x,n[r++]=s.y,n[r++]=s.z,l[o++]=e.color.r,l[o++]=e.color.g,l[o++]=e.color.b,l[o++]=e.color.r,l[o++]=e.color.g,l[o++]=e.color.b,l[o++]=t.color.r,l[o++]=t.color.g,l[o++]=t.color.b,l[o++]=t.color.r,l[o++]=t.color.g,l[o++]=t.color.b}}));if(i.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),i.setAttribute("color",new THREE.BufferAttribute(new Float32Array(l),3)),2!==t){let e;1===t||(e=new THREE.LineSegments(i,new THREE.LineBasicMaterial({linewidth:s.linewidth,vertexColors:!0})),s.mdl.add(e)),1===t?s.prevHighlightObjects.push(e):s.objects.push(e)}else 2===t&&s.boxCls.createBoxRepresentation_P_CA(e,.8,t)}createConnCalphSidechain(e,t){let s=this.icn3d;if(s.icn3dui.bNode)return;let i={};for(let s in e){let n=e[s];if(!n.het&&n.style2===t){i[n.structure+"_"+n.chain+"_"+n.resi]=1}}let n=[],l=[];for(let e in i){let t=s.firstAtomObjCls.getFirstAtomObjByName(s.residues[e],"CA");if(void 0!==t)for(let e=0,i=t.bonds.length;e=t.bonds.length&&e.bonds.length>1)s=e.serial,l=e.bonds[0],d=e.bonds[1];else{if(!(t.bonds.length>=e.bonds.length&&t.bonds.length>1))return void console.log("Double bond was not drawn due to the undefined cross plane");s=t.serial,l=t.bonds[0],d=t.bonds[1]}let i=r.atoms[s].coord.clone();i.sub(r.atoms[l].coord);let n=r.atoms[s].coord.clone();n.sub(r.atoms[d].coord),i.cross(n),0==parseInt(1e4*i.length())&&(i=new THREE.Vector3(.2,.3,.5)),c=t.coord.clone(),c.sub(e.coord),c.cross(i).normalize().multiplyScalar(.2*o),0==parseInt(1e4*c.length())&&(i=new THREE.Vector3(.5,.3,.2),c.cross(i).normalize().multiplyScalar(.2*o))}e.color===t.color?r.dAtoms.hasOwnProperty(e.serial)&&r.dAtoms.hasOwnProperty(t.serial)&&(r.cylinderCls.createCylinder(e.coord.clone().add(c),t.coord.clone().add(c),a,e.color,n),r.cylinderCls.createCylinder(e.coord.clone().sub(c),t.coord.clone().sub(c),a,e.color,n)):r.bImpo?r.dAtoms.hasOwnProperty(e.serial)&&r.dAtoms.hasOwnProperty(t.serial)&&(r.cylinderCls.createCylinder(e.coord.clone().add(c),t.coord.clone().add(c),a,e.color,n,t.color),r.cylinderCls.createCylinder(e.coord.clone().sub(c),t.coord.clone().sub(c),a,e.color,n,t.color)):r.dAtoms.hasOwnProperty(e.serial)&&r.dAtoms.hasOwnProperty(t.serial)&&(r.cylinderCls.createCylinder(e.coord.clone().add(c),i.clone().add(c),a,e.color,n),r.cylinderCls.createCylinder(t.coord.clone().add(c),i.clone().add(c),a,t.color,n),r.cylinderCls.createCylinder(e.coord.clone().sub(c),i.clone().sub(c),a,e.color,n),r.cylinderCls.createCylinder(t.coord.clone().sub(c),i.clone().sub(c),a,t.color,n))}else if(r.aromaticbonds.hasOwnProperty(l)){let s,l,d;if(e.bonds.length>t.bonds.length&&e.bonds.length>1)s=e.serial,l=e.bonds[0],d=e.bonds[1];else{if(!(t.bonds.length>1))return;s=t.serial,l=t.bonds[0],d=t.bonds[1]}let c=r.atoms[s].coord.clone();c.sub(r.atoms[l].coord);let h=r.atoms[s].coord.clone();h.sub(r.atoms[d].coord),c.cross(h);let p=t.coord.clone();p.sub(e.coord),p.cross(c).normalize().multiplyScalar(.2*o);let m=0;for(let s=0,i=e.bondOrder.length;so+1?(s=k.clone(),i=d.atoms[j[j.length-1-o-1]].coord.clone(),i.sub(s)):s=new THREE.Vector3(Math.random(),Math.random(),Math.random()))):U[m]&&"CA"===p.name&&(j.length>o+1?(s=k.clone(),i=d.atoms[j[j.length-1-o-1]].coord.clone(),i.sub(s)):s=new THREE.Vector3(Math.random(),Math.random(),Math.random())),s.normalize(),s.multiplyScalar(C),null!==I&&s.dot(I)<0&&s.negate(),I=s;for(let e=0,s=2/(t-1);e6||c&&Math.abs(S.y-c.y)>6||c&&Math.abs(S.z-c.z)>6;if((g!==p.chain||p.ssbegin||p.ssend||z||B==W&&"coil"!=p.ss)&&u[0].length>0){let c="CA",g=[],f=[];if(isNaN(d.atoms[P].resi))g=[];else{let e=d.atoms[P].structure+"_"+d.atoms[P].chain+"_"+(parseInt(d.atoms[P].resi)-1).toString(),t=d.firstAtomObjCls.getAtomCoordFromResi(e,c);g=void 0!==t?[t]:[]}if(!isNaN(d.atoms[P].resi)){let e=d.atoms[P].structure+"_"+d.atoms[P].chain+"_"+(parseInt(d.atoms[P].resi)+1).toString(),t=d.firstAtomObjCls.getAtomCoordFromResi(e,c);void 0!==t&&f.push(t);let s=d.atoms[P].structure+"_"+d.atoms[P].chain+"_"+(parseInt(d.atoms[P].resi)+2).toString(),i=d.firstAtomObjCls.getAtomCoordFromResi(s,c);void 0!==i&&f.push(i)}if(!z){1===a||2===a?w.push(d.hColor):w.push(R),C=p.ssend&&"sheet"===p.ss?0:"coil"===E&&p.ssbegin||T&&p.ssbegin||"coil"===p.ss?n:l;let s,i,o=4;"O"===p.name?(s=A.clone(),s.sub(S)):U[m]&&"CA"===p.name&&(j.length>o?(s=S.clone(),i=d.atoms[j[j.length-1-o]].coord.clone(),i.sub(s)):s=new THREE.Vector3(Math.random(),Math.random(),Math.random())),s.normalize(),s.multiplyScalar(C),null!==I&&s.dot(I)<0&&s.negate(),I=s;for(let e=0,s=2/(t-1);e0){let e="CA",n=[],l=[];if(isNaN(d.atoms[P].resi))n=[];else{let t=d.atoms[P].structure+"_"+d.atoms[P].chain+"_"+(parseInt(d.atoms[P].resi)-1).toString();d.firstAtomObjCls.getAtomCoordFromResi(t,e)}for(let e=0;!i&&e0&&(o!==c.chain||Math.abs(c.coord.x-h.coord.x)>6||Math.abs(c.coord.y-h.coord.y)>6||Math.abs(c.coord.z-h.coord.z)>6||r.ParserUtilsCls.getResiNCBI(c.structure+"_"+o,a)+13||Math.abs(c.coord.y-h.coord.y)>3||Math.abs(c.coord.z-h.coord.z)>3))){if(2!==i){if(!isNaN(d.resi)&&!isNaN(h.resi)){let e=d.structure+"_"+d.chain+"_"+(parseInt(d.resi)-1).toString(),i=r.firstAtomObjCls.getAtomCoordFromResi(e,t);g=void 0!==i?[i]:[];let l=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+1).toString(),o=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+2).toString(),a=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+3).toString();if(r.residues.hasOwnProperty(l)){let e=r.firstAtomObjCls.getAtomFromResi(l,t);void 0!==e&&e.ssbegin&&(l=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+2).toString(),o=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+3).toString(),p.push(e.coord),n?u.push(this.getCustomtubesize(l)):u.push(this.getRadius(s,e)),m.push(e.color))}if(1==p.length&&r.residues.hasOwnProperty(l)){let e=r.firstAtomObjCls.getAtomFromResi(l,t);if(e){p.push(e.coord),m.push(e.color);let t=this.getRadius(s,c);u.push(t),l=o,o=a}}let C=r.firstAtomObjCls.getAtomCoordFromResi(l,t);void 0!==C&&f.push(C);let b=r.firstAtomObjCls.getAtomCoordFromResi(o,t);void 0!==b&&f.push(b)}b.push({pnts:p,colors:m,radii:u,prevone:g,nexttwo:f})}p=[],m=[],u=[],g=[],f=[],d=c,C=0}if(0==p.length&&!isNaN(c.resi)){let e=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)-1).toString();r.residues.hasOwnProperty(e)&&(h=r.firstAtomObjCls.getAtomFromResi(e,t),void 0!==h&&h.ssend&&(p.push(h.coord),n?u.push(this.getCustomtubesize(e)):u.push(this.getRadius(s,h)),m.push(h.color)))}let e;p.push(c.coord),e=n?this.getCustomtubesize(c.structure+"_"+c.chain+"_"+c.resi):this.getRadius(s,c),l||"coil"==c.ss||c.ssbegin||c.ssend||(e=0),u.push(e),m.push(c.color),1===C&&(m[m.length-2]=c.color),o=c.chain,a=c.resi;let y=1.2;2!==i||c.ssbegin||r.boxCls.createBox(c,void 0,void 0,y,void 0,i),++C,h=c}if(2!==i){if(g=[],void 0!==d&&!isNaN(d.resi)){let e=d.structure+"_"+d.chain+"_"+(parseInt(d.resi)-1).toString(),s=r.firstAtomObjCls.getAtomCoordFromResi(e,t);g=void 0!==s?[s]:[]}if(f=[],void 0!==c&&!isNaN(c.resi)){let e=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)+1).toString(),i=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)+2).toString(),n=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)+3).toString();if(1==p.length&&r.residues.hasOwnProperty(e)){let l=r.firstAtomObjCls.getAtomFromResi(e,t);if(l){p.push(l.coord),m.push(l.color);let t=this.getRadius(s,c);u.push(t),e=i,i=n}}let l=r.firstAtomObjCls.getAtomCoordFromResi(e,t);void 0!==l&&f.push(l);let o=r.firstAtomObjCls.getAtomCoordFromResi(i,t);void 0!==o&&f.push(o)}b.push({pnts:p,colors:m,radii:u,prevone:g,nexttwo:f})}for(let e=0,t=b.length;e0&&(c=n);else if(g%1==0)n=s[g],n>0&&(c=n);else{let e=Math.floor(g),t=g-e;n=s[e]*(1-t)+s[e+1]*t,r||n<1*c&&(n=0)}e1?a.parasCls.thr(t[t.length-2]):a.parasCls.thr(t[e]),C[v++]=d.r,C[v++]=d.g,C[v++]=d.b}}let k,O=0;for(let e=0,t=S.length-1;er&&(l=r,e=1);for(let t=0;t0&&t.b<=100?.01*t.b:t.b>100?1:s.coilWidth),i}}class ze{constructor(e){this.icn3d=e}drawCartoonNucleicAcid(e,t,s,i){this.drawStrandNucleicAcid(e,2,t,!0,void 0,s,i)}drawStrandNucleicAcid(e,t,s,i,n,l,r){let o,a,d,c=this.icn3d;if(c.icn3dui.bNode)return;2===r&&(t=void 0,l=void 0),n=n||c.nucleicAcidWidth,s=s||c.axisDIV,t=t||c.nucleicAcidStrandDIV;let h=[];for(d=0;dy?y=b:b=y);let v=.8*C/y;if(g.width=b,g.height=y,f.clearRect(0,0,b,y),h)if(f.fillStyle="rgba("+n.r+","+n.g+","+n.b+","+n.a+")",f.strokeStyle="rgba("+l.r+","+l.g+","+l.b+","+l.a+")",f.lineWidth=r,p){let e=.4*b;this.circle(f,0,0,b,y,e)}else{let e=0;this.roundRect(f,0,0,b,y,e)}f.font="Bold "+a+"px "+o,f.textAlign="center",f.textBaseline="middle",f.fillStyle="rgba("+u.r+", "+u.g+", "+u.b+", 1.0)",f.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", 1.0)",f.fillText(e,.5*b,.5*y);let _=new THREE.Texture(g);_.needsUpdate=!0;let w=new THREE.SpriteMaterial({map:_,depthTest:!1,depthWrite:!1});w.map.minFilter=THREE.LinearFilter;let S=new THREE.Sprite(w);return p?S.scale.set(.3*d,.3*d,1):S.scale.set(v*d,d,1),S.renderOrder=1,S}roundRect(e,t,s,i,n,l){e.beginPath(),e.moveTo(t+l,s),e.lineTo(t+i-l,s),e.quadraticCurveTo(t+i,s,t+i,s+l),e.lineTo(t+i,s+n-l),e.quadraticCurveTo(t+i,s+n,t+i-l,s+n),e.lineTo(t+l,s+n),e.quadraticCurveTo(t,s+n,t,s+n-l),e.lineTo(t,s+l),e.quadraticCurveTo(t,s,t+l,s),e.closePath(),e.fill(),e.stroke()}circle(e,t,s,i,n,l){e.beginPath(),e.arc(t+i/2,.9*(s+n/2),l,0,2*Math.PI,!0),e.closePath(),e.fill(),e.stroke()}}class Ve{constructor(e){this.icn3d=e,this.textSpriteCls=new Ge(e)}createLabelRepresentation(e){let t=this.icn3d;t.icn3dui;let s=t.oriMaxD/100;s<.4&&(s=.4);let i=3*s*t.labelScale;for(let s in e){let n=void 0!==e[s]?e[s]:[],l="black"!=t.opts.background?t.colorWhitebkgd:t.colorBlackbkgd;for(let e=0,r=n.length;e.99999)h.set(0,0,0,1);else if(e.y<-.99999)h.set(1,0,0,0);else{let t=new THREE.Vector3;t.set(e.z,0,-e.x).normalize();let s=Math.acos(e.y);h.setFromAxisAngle(t,s)}return c.applyQuaternion(h),c.scale.set(l,n,l),c.position.copy(t),c}setPc1Axes(e){let t=this.icn3d,s=t.icn3dui;if(s.bNode)return;let i=s.hashUtilsCls.intHash(t.hAtoms,t.dAtoms),n=[],l=Object.keys(i).length<100;for(let e in i){let s=t.atoms[e],i=s.structure+"_"+s.chain+"_"+s.resi;(l||""!=i)&&n.push(s.coord.clone())}let r=s.rmsdSuprCls.getEigenForSelection(n,n.length),o=new THREE.Vector3(r.h1[0],r.h1[1],r.h1[2]);if(0==r.k&&t.bRender)return void alert("Can't determine the first principal component. Please select a subset and try it again.");let a=t.applyCenterCls.centerAtoms(i),d=a.maxD,c=a.center,h=c.clone().add(o.normalize().multiplyScalar(.4*d)),p=o.normalize();if(s.htmlCls.clickMenuCls.setLogCmd("Principle X-Axis: "+p.x.toFixed(3)+" "+p.y.toFixed(3)+" "+p.z.toFixed(3),!1),e)return p;let m=new THREE.Vector3(r.h2[0],r.h2[1],r.h2[2]),u=c.clone().add(m.normalize().multiplyScalar(.3*d)),g=new THREE.Vector3(r.h3[0],r.h3[1],r.h3[2]),f=c.clone().add(g.normalize().multiplyScalar(.3*d));this.buildAxes(void 0,c,h,u,f,!0);let C=[c,h,u,f];return t.axes.push(C),t.drawCls.draw(),C}}class Ye{constructor(e){this.icn3d=e}showGlycans(){let e=this.icn3d,t=e.icn3dui;if(t.bNode)return;let s={},i=e.dAtoms;for(let n in i){let i=e.atoms[n];i.het&&-1!=t.parasCls.glycanHash.hasOwnProperty(i.resn)&&(void 0===s[i.resn]&&(s[i.resn]={}),"Misc"!=i.chain&&(s[i.resn][i.structure+"_"+i.chain+"_"+i.resi]=1))}let n=Object.keys(s);for(let i=0,l=n.length;i>2))+i+((2&t)>>1))*c+n+(1&t)]&this.ISDONE)<=3&&(t.push(t[i]),i=t.length-1,t.push(t[n]),n=t.length-1,t.push(t[l]),l=t.length-1),s.push(i),s.push(n),s.push(l)}}},Xe.prototype.laplacianSmooth=function(e,t,s){let i,n,l,r,o,a=new Array(t.length);for(i=0,n=t.length;ithis.origextent[1][0])&&(!(tthis.origextent[1][1])&&!(sthis.origextent[1][2]))},Ke.prototype.getFacesAndVertices=function(){let e,t,s=this.verts;for(e=0,t=s.length;eh&&(h=this.pmaxy-this.pminy),this.pmaxz-this.pminz>h&&(h=this.pmaxz-this.pminz),this.scaleFactor=(c-1)/h,this.scaleFactor=this.defaultScaleFactor,this.defaultScaleFactor*h>this.threshbox&&(c=Math.floor(this.threshbox),this.scaleFactor=(this.threshbox-1)/h),this.bCalcArea&&(this.scaleFactor=this.defaultScaleFactor),this.pLength=Math.ceil(this.scaleFactor*(this.pmaxx-this.pminx))+1,this.pWidth=Math.ceil(this.scaleFactor*(this.pmaxy-this.pminy))+1,this.pHeight=Math.ceil(this.scaleFactor*(this.pmaxz-this.pminz))+1,this.boundingatom(t),this.cutRadius=this.probeRadius*this.scaleFactor,this.vpBits=new Uint8Array(this.pLength*this.pWidth*this.pHeight),this.vpDistance=new Float64Array(this.pLength*this.pWidth*this.pHeight),this.vpAtomID=new Int32Array(this.pLength*this.pWidth*this.pHeight),this.vpColor=[],this.vpPot=[]},Ke.prototype.boundingatom=function(e){let t,s,i,n,l=[];for(let r in this.vdwRadii){if(!this.vdwRadii.hasOwnProperty(r))continue;let o=this.vdwRadii[r];l[r]=e?(o+this.probeRadius)*this.scaleFactor+.5:o*this.scaleFactor+.5,i=l[r]*l[r],this.widxz[r]=Math.floor(l[r])+1,this.depty[r]=new Int32Array(this.widxz[r]*this.widxz[r]),n=0;for(let e=0;ei?this.depty[r][n]=-1:(s=Math.sqrt(i-t),this.depty[r][n]=Math.floor(s)),n++}},Ke.prototype.fillvoxels=function(e,t){let s,i,n,l;for(s=0,l=this.vpBits.length;sc&&(a=c),b>h&&(b=h),v>p&&(v=p);let _,w=g[o*m+d*u+y],S=g[a*m+d*u+y],A=g[o*m+b*u+y],x=g[o*m+d*u+v],k=g[a*m+b*u+y],O=g[o*m+b*u+v],R=g[a*m+d*u+v],I=g[a*m+b*u+v],E=r.x-o,T=r.y-d,D=r.z-y,P=((w*(1-E)+S*E)*(1-T)+(A*(1-E)+k*E)*T)*(1-D)+((x*(1-E)+R*E)*(1-T)+(O*(1-E)+I*E)*T)*D,M=s*f+i*C+n;this.vpPot[M]=P,P>this.isovalue&&(P=this.isovalue),P<-this.isovalue&&(P=-this.isovalue),P>0?(P/=1*this.isovalue,_=new THREE.Color(1-P,1-P,1)):(P/=-1*this.isovalue,_=new THREE.Color(1,1-P,1-P)),this.vpColor[M]=_}}for(s=0,l=this.vpBits.length;s=this.pLength||g>=this.pWidth||f>=this.pHeight)continue;let h=u*S+g*this.pHeight+f;if(this.vpBits[h]&this.INOUT){let p=t[this.vpAtomID[h]];p.serial!=e.serial&&(l=s+a-Math.floor(.5+this.scaleFactor*(p.x+this.ptranx)),r=i+d-Math.floor(.5+this.scaleFactor*(p.y+this.ptrany)),o=n+c-Math.floor(.5+this.scaleFactor*(p.z+this.ptranz)),a*a+d*d+c*c=this.pLength||p>=this.pWidth||m>=this.pHeight)continue;let u=h*S+p*this.pHeight+m;if(this.vpBits[u]&this.ISDONE){let h=t[this.vpAtomID[u]];h.serial!=e.serial&&(l=s+a-Math.floor(.5+this.scaleFactor*(h.x+this.ptranx)),r=i+d-Math.floor(.5+this.scaleFactor*(h.y+this.ptrany)),o=n+c-Math.floor(.5+this.scaleFactor*(h.z+this.ptranz)),a*a+d*d+c*c-1&&r-1&&a-1&&o=h)||(this.vpBits[n]|=this.ISBOUND))},Ke.prototype.fastoneshell=function(e,t){let s,i,n,l,r,o,a,d,c,h,p,m,u=[];if(0===e.length)return u;let g={ix:-1,iy:-1,iz:-1},f=this.pWidth*this.pHeight;for(a=0,c=e.length;a-1&&g.iy-1&&g.iz-1&&(m=g.ix*f+this.pHeight*g.iy+g.iz,this.vpBits[m]&this.INOUT&&!(this.vpBits[m]&this.ISDONE)?(t.set(g.ix,g.iy,n+this.nb[d][2],p),l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,this.vpDistance[m]=h,this.vpBits[m]|=this.ISDONE,this.vpBits[m]|=this.ISBOUND,u.push({ix:g.ix,iy:g.iy,iz:g.iz})):this.vpBits[m]&this.INOUT&&this.vpBits[m]&this.ISDONE&&(l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,h-1&&g.iy-1&&g.iz-1&&(m=g.ix*f+this.pHeight*g.iy+g.iz,this.vpBits[m]&this.INOUT&&!(this.vpBits[m]&this.ISDONE)?(t.set(g.ix,g.iy,n+this.nb[d][2],p),l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,this.vpDistance[m]=h,this.vpBits[m]|=this.ISDONE,this.vpBits[m]|=this.ISBOUND,u.push({ix:g.ix,iy:g.iy,iz:g.iz})):this.vpBits[m]&this.INOUT&&this.vpBits[m]&this.ISDONE&&(l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,h-1&&g.iy-1&&g.iz-1&&(m=g.ix*f+this.pHeight*g.iy+g.iz,this.vpBits[m]&this.INOUT&&!(this.vpBits[m]&this.ISDONE)?(t.set(g.ix,g.iy,n+this.nb[d][2],p),l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,this.vpDistance[m]=h,this.vpBits[m]|=this.ISDONE,this.vpBits[m]|=this.ISBOUND,u.push({ix:g.ix,iy:g.iy,iz:g.iz})):this.vpBits[m]&this.INOUT&&this.vpBits[m]&this.ISDONE&&(l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,hm&&(m=this.pmaxy-this.pminy),this.pmaxz-this.pminz>m&&(m=this.pmaxz-this.pminz),this.scaleFactor=1,this.pLength=Math.floor(.5+this.scaleFactor*(this.pmaxx-this.pminx))+1,this.pWidth=Math.floor(.5+this.scaleFactor*(this.pmaxy-this.pminy))+1,this.pHeight=Math.floor(.5+this.scaleFactor*(this.pmaxz-this.pminz))+1,this.cutRadius=this.probeRadius*this.scaleFactor,this.vpBits=new Uint8Array(this.pLength*this.pWidth*this.pHeight),this.ccp4&&(this.vpGridTrans=new Array(this.pLength*this.pWidth*this.pHeight)),this.vpAtomID=new Uint8Array(this.pLength*this.pWidth*this.pHeight)},Je.prototype.transformMemPro=function(e,t,s,i){let n=e.clone();n.sub(s);let l=n.x*t[0]+n.y*t[1]+n.z*t[2]+i.x,r=n.x*t[3]+n.y*t[4]+n.z*t[5]+i.y,o=n.x*t[6]+n.y*t[7]+n.z*t[8]+i.z;return n.x=l,n.y=r,n.z=o,n},Je.prototype.fillvoxels=function(e,t){let s,i,n,l,r,o;for(s=0,l=this.vpBits.length;sthis.pLength&&(o=this.pLength),p>this.pWidth&&(p=this.pWidth),C>this.pHeight&&(C=this.pHeight);let b,y=l[r*a+h*d+f],v=l[o*a+h*d+f],_=l[r*a+p*d+f],w=l[r*a+h*d+C],S=l[o*a+p*d+f],A=l[r*a+p*d+C],x=l[o*a+h*d+C],k=l[o*a+p*d+C],O=n.x-r,R=n.y-h,I=n.z-f,E=((y*(1-O)+v*O)*(1-R)+(_*(1-O)+S*O)*R)*(1-I)+((w*(1-O)+x*O)*(1-R)+(A*(1-O)+k*O)*R)*I;E>this.isovalue&&(E=this.isovalue),E<-this.isovalue&&(E=-this.isovalue),E>0?(E/=1*this.isovalue,b=new THREE.Color(1-E,1-E,1)):(E/=-1*this.isovalue,b=new THREE.Color(1,1-E,1-E)),this.icn3d.atoms[t[s]].color=b,this.icn3d.atomPrevColors[t[s]]=b}}else{for(let p in t){let f,C=e[t[p]];if("DUM"!==C.resn){if(void 0!==this.rmsd_supr&&void 0!==this.rmsd_supr.rot){f=this.transformMemPro(C.coord,g,u,m).applyMatrix4(c)}else f=C.coord.clone().applyMatrix4(c);for(s=Math.floor(f.x)-this.maxdist,l=Math.ceil(f.x)+this.maxdist;s<=l;++s)if(!(s<0||s>this.header.xExtent*this.scaleFactor-1))for(i=Math.floor(f.y)-this.maxdist,r=Math.ceil(f.y)+this.maxdist;i<=r;++i)if(!(i<0||i>this.header.yExtent*this.scaleFactor-1))for(n=Math.floor(f.z)-this.maxdist,o=Math.ceil(f.z)+this.maxdist;n<=o;++n){if(n<0||n>this.header.zExtent*this.scaleFactor-1)continue;let e=s*a+i*d+n;h.push(e)}}}for(s=0,l=h.length;s=this.isovalue?1:0:"fofc"==this.type?(this.vpBits[e]=this.dataArray[e]>=this.isovalue||this.dataArray[e]<=-this.isovalue?1:0,this.vpAtomID[e]=this.dataArray[e]>=0?1:0):"em"==this.type&&(this.vpBits[e]=this.dataArray[e]>=this.isovalue?1:0)}}}else for(s=0;s=this.isovalue||this.dataArray[e]<=-this.isovalue?1:0,this.vpAtomID[t]=this.dataArray[e]>=0?1:0)}for(s=0,l=this.vpBits.length;s-1&&r-1&&a-1&&o1?"
Structure
":"",a=Object.keys(i).length>1?"
Chain
":"";n+="
"+o+a+"
Residue
Number
SASA (Å2)
Percent Out
In/Out
";for(let e in l.resid2area){let d=e.lastIndexOf("_"),c=e.substr(d+1),h=r.utilsCls.getIdArray(e.substr(0,d));o=Object.keys(s).length>1?"
","normalized hydrophobic"==e?(n+="Dark green (W, F, L, I, Y, M, V, C): Hydrophobic ",n+="Light green (P, T, S, A, Q, N, G): Polar ",n+="Grey: Charged, not hydrophobic
"):(n+="Green (W, F, L, I, Y, M, V, C): Hydrophobic ",n+="Yellow (P, T, S, A, Q, N, G): Polar ",n+="Red: Negatively Charged ",n+="Blue: Positively Charged
");let a=0;for(let e of r)s.parasCls.residueAbbrev[e[0]]&&(n+="
",n+=" ",n+=s.parasCls.residueAbbrev[e[0]]+"
",a%4==3&&(n+=" "),++a);n+="
"}else"b factor"==e?(n+="
B factor quantitates the uncertainty for each atom. A high B factor reflects that the position is less certain.
",n+=s.htmlCls.clickMenuCls.setLegendHtml()):"confidence"==e?n+=s.htmlCls.clickMenuCls.setLegendHtml(!0):"exon"==e?(t.startColor="red",t.midColor="white",t.endColor="blue",t.startValue="Start",t.midValue="Middle",t.endValue="End",n+=s.htmlCls.clickMenuCls.setLegendHtml()):n="";n?($("#"+s.pre+"dl_legend_html").html(n),s.htmlCls.dialogCls.openDlg("dl_legend","Color Legend")):$("#"+s.pre+"dl_legend").hasClass("ui-dialog-content")&&$("#"+s.pre+"dl_legend").dialog("isOpen")&&$("#"+s.pre+"dl_legend").dialog("close")}getColorLegendForElem(e,t){let s=this.icn3d,i=s.icn3dui,n="",l={};for(let e in t){let t=s.atoms[e],i=void 0===t||void 0===t.color||"FFFFFF"===t.color.getHexString().toUpperCase()?"DDDDDD":t.color.getHexString();void 0===l[t.elem]&&(l[t.elem]={}),l[t.elem][i]=1}if(Object.keys(l).length>0){n+=""+e+" ";let t=Object.keys(l).sort();for(let e=0,s=t.length;e";for(let e in l[s])n+=" ";n+=i.parasCls.atomnames[s.toUpperCase()]+" "}n+=" "}return n}getRes2color(e,t){let s=this.icn3d,i=s.icn3dui,n={},l=s.firstAtomObjCls.getResiduesFromAtoms(e);for(let e in l){let l=s.residues[e],r=s.firstAtomObjCls.getFirstAtomObj(l),o=t?r.resn:i.parasCls.residueAbbrev[r.resn],a=void 0===r||void 0===r.color||"FFFFFF"===r.color.getHexString().toUpperCase()?"DDDDDD":r.color.getHexString();null!=o&&(void 0===n[o]&&(n[o]={}),n[o][a]=1)}return n}getColorLegendForResidue(e){this.icn3d.icn3dui;let t="",s=this.getRes2color(e);if(Object.keys(s).length>0){t+="
";let e=Object.keys(s).sort(),i="",n=0;for(let l=0,r=e.length;l";for(let e in s[o])r+=" ";r+=o+"
",n%4==3&&(r+=" "),-1!=o.indexOf("(")?(t+=r,++n):i+=r}i&&(t+=" "+i),t+=""}return t}getColorLegendForCharge(e){let t=this.icn3d;t.icn3dui;let s="",i=t.firstAtomObjCls.getResiduesFromAtoms(e),n={};for(let e in i){let s=t.residues[e],i=t.firstAtomObjCls.getFirstAtomObj(s);"ARG"==i.resn||"LYS"==i.resn?n.Positive=1:"HIS"==i.resn?n["Partial-Positive"]=1:"ASP"==i.resn||"GLU"==i.resn||t.nucleotides[i.serial]?n.Negative=1:n.Neutral=1}const l={Positive:"0000ff","Partial-Positive":"8080ff",Negative:"ff0000",Neutral:"888888"};let r=["Positive","Partial-Positive","Negative","Neutral"];s+="
";for(let e=0,t=r.length;e",s+=" ",s+=t,s+=" ")}return s+=" (Charges are at pH 7)",s+="
',C+=o,y+=v)}else h+="-";i.seqStartLen&&i.seqStartLen[c]&&(h+=i.showSeqCls.insertMulGap(i.seqEndLen[c],"-")),g=' '+t.toString()+" Residues",g+="",g+=" ",h+=g,p+=g}h+="",p+="",m+="",$("#"+i.pre+"dt_site_"+c).html(h),$("#"+i.pre+"ov_site_"+c).html(p),$("#"+i.pre+"tt_site_"+c).html(m)}}for(let e in i.protein_chainid)r.hasOwnProperty(e)||($("#"+i.pre+"dt_cdd_"+e).html(""),$("#"+i.pre+"ov_cdd_"+e).html(""),$("#"+i.pre+"tt_cdd_"+e).html(""),$("#"+i.pre+"dt_site_"+e).html(""),$("#"+i.pre+"ov_site_"+e).html(""),$("#"+i.pre+"tt_site_"+e).html(""));i.showAnnoCls.enableHlSeq(),i.bAjaxCddSite=!0}getNoCdd(e){let t=this.icn3d;t.icn3dui,console.log("No CDD data were found for the protein "+e+"...");for(let e in t.protein_chainid)$("#"+t.pre+"dt_cdd_"+e).html(""),$("#"+t.pre+"ov_cdd_"+e).html(""),$("#"+t.pre+"tt_cdd_"+e).html(""),$("#"+t.pre+"dt_site_"+e).html(""),$("#"+t.pre+"ov_site_"+e).html(""),$("#"+t.pre+"tt_site_"+e).html("");t.showAnnoCls.enableHlSeq(),t.bAjaxCddSite=!0}setDomainFeature(e,t,s,i,n,l,r,o,a){let d,c,h,p=this.icn3d,m=p.icn3dui,u="domain"!=s&&"feat"!=s;"domain"==s&&(r={},d={},c={},h={}),void 0===e&&(e=[]);let g=e.length,f="domain"==s?14:19,C="domain"==s?100:120;e.sort((function(e,t){let i=e.locs,n="domain"==s||"ig"==s?i[0].segs:[i[0]],l=Math.round(n[0].from);return i=t.locs,n="domain"==s||"ig"==s?i[0].segs:[i[0]],l-Math.round(n[0].from)}));for(let b=0;bf&&(w=w.substr(0,f)+"...");let S=u?a[b]:s+": "+v;"domain"==s&&(d[g]=v);let A=e[b].locs;if(A)for(let e=0,r=A.length;e'+w+" ",I=''+u.toString()+" Res";l+=R+I+" ";let E='';i+=R+I+E,"domain"==s&&(n+='
',a=o,d=o,c=0;for(let t in s.chainname2residues[e]){let n=s.chainname2residues[e][t];if(!n)continue;let l="Interact ."+t;l.length>17&&(l=l.substr(0,17)+"...");let r="Interact ."+t,h=[];for(let e=0,t=n.length;e'+l+"
",y=s[t].length,v=0,w=0;if(2==e&&(v=0,w=y),m){d=1;let r=0;for(let e=v;e0?w+="; ":0!==e&&1!==e||(O='disease="'+v[t]+'"'),w+=v[t]+"("+_[t]+")",++S;""!=w&&(r"+s[t][e],u+=": "+w,b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(m,"snpin3d","3D with scap","SNP in 3D with scap",70,g)+" ",u+=f.showAnnoCls.addSnpButton(m,"snpinter","Interactions","SNP Interactions in 3D",70,g)+" ",u+=f.showAnnoCls.addSnpButton(m,"snppdb","PDB","Download SNP PDB",35,g)),u+=" Links: ClinVar, dbSNP(rs"+i[t][e]+")",e "),++r)}r>d&&2==e&&(p+="..")}else{d=1;for(let e=v;e"+s[t][e],g)b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(r,"snpin3d","3D with scap","SNP in 3D with scap",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snpinter","Interactions","SNP Interactions in 3D",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snppdb","PDB","Download SNP PDB",35,m)),0!=i[t][e]&&(u+=" Link: dbSNP(rs"+i[t][e]+")"),e ");else{let s=l[t][e].split("; "),a=o[t][e].split("; "),d="",c=0;for(let t=0,i=s.length;t0?d+="; ":0!==e&&1!==e||(O='disease="'+s[t]+'"'),d+=s[t]+"("+a[t]+")",++c;""!=d?(u+=": "+d,b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(r,"snpin3d","3D with scap","SNP in 3D with scap",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snpinter","Interactions","SNP Interactions in 3D",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snppdb","PDB","Download SNP PDB",35,m)),u+=" Links: ClinVar, dbSNP(rs"+i[t][e]+")"):(b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(r,"snpin3d","3D with scap","SNP in 3D with scap",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snpinter","Interactions","SNP Interactions in 3D",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snppdb","PDB","Download SNP PDB",35,m)),u+=" Link: dbSNP(rs"+i[t][e]+")"),e ")}}y>d&&2==e&&(p+="..")}u+="
',k=''+g.toString()+" Pos";_+=A+k+" ",w+=x+k+" ";let O='';b+=A+k+O,y+=x+k+O,v+=A+k+O;let R=e.indexOf("_"),I="cst"+e.substr(R+1),E=0,T=0,D=(void 0===l||"seq"===l||"custom"===l)&&-1==s.indexOf("cannot-be-aligned")&&-1==s.indexOf("cannot be aligned"),P="identity"===l&&-1==s.indexOf("cannot-be-aligned")&&-1==s.indexOf("cannot be aligned"),M={},F=0;A="";let H={},L={},N={},q=0;if(h)for(let e=0,t=h.length;e"+d+"",h){let t='style="background-color:'+H[q]+'"';y+='";for(let t in p.residues[e+"_"+g]){let e=p.atoms[t];e.color=m.parasCls.thr(H[q]),p.atomPrevColors[t]=e.color}}A+=p.showSeqCls.insertGapOverview(e,t);let f=Math.round(p.seqAnnWidth*t/(p.maxAnnoLength+p.nTotalGap)-E-T);f<0&&(f=0),A+='
'}getExonColor(e,t,s){this.icn3d.icn3dui;let i=.5*(e+t);if(s1e-200&&(h=parseFloat(h).toExponential()),n.scores.bit_score;let p=t.targets[l].seqdata,m=i.seqdata,u=n.segs;for(let e=0,t=u.length;e0&&(l=n+"H"+d.toString().padStart(2,"0")+")","coil"==t&&(s.selectionCls.selectResidueList(r,l,l,o,a),o||(o=!0)),r={})),n=e+"_H"+d.toString().padStart(2,"0"),r[p]=1,i.ssend&&(h=e+"_C(H"+d.toString().padStart(2,"0"),"helix"==t&&(s.selectionCls.selectResidueList(r,n,n,o,a),o||(o=!0)),r={})):"E"==m?(i.ssbegin&&(++c,Object.keys(r).length>0&&(l=n+"S"+c.toString().padStart(2,"0")+")","coil"==t&&(s.selectionCls.selectResidueList(r,l,l,o,a),o||(o=!0)),r={})),n=e+"_S"+c.toString().padStart(2,"0"),r[p]=1,i.ssend&&(h=e+"_C(S"+c.toString().padStart(2,"0"),"sheet"==t&&(s.selectionCls.selectResidueList(r,n,n,o,a),o||(o=!0)),r={})):(n=h+"-",r[p]=1)}}Object.keys(r).length>0&&(l=n+"Cterm)","coil"==t&&s.selectionCls.selectResidueList(r,l,l,o,a))}defineIgstrand(e,t){let s=this.icn3d,i=s.icn3dui;$("#"+s.pre+"dl_definedsets").hasClass("ui-dialog-content")&&$("#"+s.pre+"dl_definedsets").dialog("isOpen")||(i.htmlCls.dialogCls.openDlg("dl_definedsets","Select sets"),$("#"+s.pre+"atomsCustom").resizable());let n={},l=!1,r=!0;if(s.hAtoms={},"igdomain"==t){let t=s.chain2igArray[e];if(t&&t.length>0)for(let i=0,o=t.length;i1e3&&"50"==C.substr(C.length-2,2)&&(n[y]=1):(d=s.residIgLoop.hasOwnProperty(y)?"igloop":"igstrand",u&&d!=c&&Object.keys(n).length>0&&("igstrand"==c?(++h,i="Strand-"+a+"-"+e+"-"+h.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igstrand"==t&&(s.selectionCls.selectResidueList(n,i,i,l,r),l||(l=!0)),m=a):"igloop"==c&&(++p,i="Loop-"+m+"_"+o+"-"+e+"-"+p.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igloop"==t&&(s.selectionCls.selectResidueList(n,i,i,l,r),l||(l=!0))),n={}),n[y]=1,a=o,c=d,u=!0)))}"iganchor"==t?(i="Anchor-"+e,s.selectionCls.selectResidueList(n,i,i,l,r)):"igstrand"==c?(++h,i="Strand-"+a+"-"+e+"-"+h.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igstrand"==t&&s.selectionCls.selectResidueList(n,i,i,l,r)):"igloop"==c&&(++p,o="CT",i="Loop-"+m+"_"+o+"-"+e+"-"+p.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igloop"==t&&s.selectionCls.selectResidueList(n,i,i,l,r))}}simplifyText(e){this.icn3d.icn3dui;let t,s,i="",n=!1,l=-1;for(t=0,s=(e=e.replace(/undefined/g," ")).length;t20)return!1;if(void 0!==o.giSeq&&void 0!==o.giSeq[e]){let r=this.getFullText(s);return s=r.text,this.showNewTrack(e,t,s,void 0,void 0,i,n,l),!1}setTimeout((function(){a.checkGiSeq(e,t,s,i,n,l,r+1)}),100)}getFullText(e){this.icn3d.icn3dui;let t="",s=[],i=[],n=e.split(","),l=-1;for(let e=0,r=n.length;ep?t+=c.substr(0,p):t+=c;for(let e=0;ed&&(d=t.length,c=h),++h}o=n.htmlCls.baseUrl+"pwaln/pwaln.fcgi?from=msa";let p=e.split(","),m={};m[t]=0;for(let e=0,t=p.length;e0&&(g+=","+p.join(","));let f={targets:u,queries:g},C=await n.getAjaxPostPromise(o,f);if(!C.data)return void console.log("The protein accessions "+u+","+g+" can not be aligned...");let b=[];i.qt_start_end={};let y=[],v=[],_=Object.keys(C.targets)[0],w=C.targets[_].seqdata;p.splice(0,0,t);for(let e=0,s=p.length;eA&&(A=e)}let x=S,k=w.length-(A+1),O=[],R=[];for(let e=0,t=p.length;ea&&(a=t.length,d=c),++c}s.qt_start_end={};let m="genomeRes",u={};for(let e=0,i=h.length;ef&&(f=e)}for(let e=0,t=h.length;e0&&(d=h,o.targetGapHash[a+o.startposGiSeq]={from:a+o.startposGiSeq,to:d+m-1+o.startposGiSeq}),c=t[s],h=p,"-"!=t[s]?(++p,f=s,o.seqEndLen[e]=C-1-f,u||(g=s,o.seqStartLen[e]=g,u=!0)):++m;o.maxAnnoLength0&&(b+=" "),b+=e+"_"+o.targetGapHash[e].from+"_"+o.targetGapHash[e].to,++y;let v={};for(let a=0,d=i.length;a5?(l.uniprot2acc&&l.uniprot2acc[y]&&(y=l.uniprot2acc[y]),f=y):f=e,y.length>5){let e="";for(let t=0,s=l.chainsSeq.length;t"),d=a[1].indexOf("\n");n=a[1].substr(d+1).replace(/\n/g,"");for(let e=2,t=a.length;e0&&($("#"+e.pre+"anno_cdd")[0].checked?(this.setAnnoTabCdd(),t.htmlCls.clickMenuCls.setLogCmd("set annotation cdd",!0)):(this.hideAnnoTabCdd(),t.htmlCls.clickMenuCls.setLogCmd("hide annotation cdd",!0)))}showAnnoSelectedChains(){let e=this.icn3d,t=e.icn3dui,s={};for(let t in e.hAtoms){let i=e.atoms[t];s[i.structure+"_"+i.chain]=1}$("#"+e.pre+"dl_annotations > .icn3d-annotation").hide();for(let i in s){$("#"+e.pre+"anno_"+i).length&&$("#"+e.pre+"anno_"+i).show();let s=e.firstAtomObjCls.getFirstCalphaAtomObj(e.chains[i]);if(void 0!==s.resn){let i=t.utilsCls.residueName2Abbr(s.resn.substr(0,3));$("#"+e.pre+"anno_"+i).show()}}}showAnnoAllChains(){let e=this.icn3d;e.icn3dui,$("#"+e.pre+"dl_annotations > .icn3d-annotation").show()}setAnnoView(e){let t=this.icn3d;t.icn3dui.bNode||("detailed view"===e?(t.view="detailed view",$("#"+t.pre+"dl_anno_view_tabs").tabs("option","active",1)):(t.view="overview",$("#"+t.pre+"dl_anno_view_tabs").tabs("option","active",0)))}setAnnoDisplay(e,t){let s=this.icn3d;s.icn3dui;let i=["giseq","custom","site","ptm","snp","clinvar","cdd","domain","interaction","ssbond","crosslink","transmem","ig"];for(let n in i){let l=i[n];$("[id^="+s.pre+t+"_"+l+"]").attr("style",e)}}showFixedTitle(){this.icn3d.icn3dui;this.setAnnoDisplay("display:block;","tt")}hideFixedTitle(){this.icn3d.icn3dui;this.setAnnoDisplay("display:none!important;","tt")}setAnnoViewAndDisplay(e){let t=this.icn3d;if(t.icn3dui,"detailed view"===e){this.setAnnoView("detailed view");let e="display:block;";this.setAnnoDisplay(e,"dt"),$("#"+t.pre+"seqguide_wrapper").attr("style",e),e="display:none;",this.setAnnoDisplay(e,"ov")}else{this.setAnnoView("overview"),this.hideFixedTitle();let e="display:none;";this.setAnnoDisplay(e,"dt"),$("#"+t.pre+"seqguide_wrapper").attr("style",e),e="display:block;",this.setAnnoDisplay(e,"ov")}}async updateClinvar(){let e=this.icn3d;if(e.icn3dui,void 0===e.bClinvarShown||!e.bClinvarShown)for(let t in e.protein_chainid){let s=e.protein_chainid[t];await e.annoSnpClinVarCls.showClinvar(t,s)}e.bClinvarShown=!0}async updateSnp(){let e=this.icn3d;if(e.icn3dui,void 0===e.bSnpShown||!e.bSnpShown)for(let t in e.protein_chainid){let s=e.protein_chainid[t];await e.annoSnpClinVarCls.showSnp(t,s)}e.bSnpShown=!0}updateDomain(){let e=this.icn3d;e.icn3dui,void 0!==e.bDomainShown&&e.bDomainShown||e.annoDomainCls.showDomainAll(),e.bDomainShown=!0}updateInteraction(){let e=this.icn3d;if(e.icn3dui,void 0===e.bInteractionShown||!e.bInteractionShown)for(let t in e.interactChainbase){let s=e.interactChainbase[t];e.annoContactCls.showInteraction(t,s)}e.bInteractionShown=!0}async updatePTM(){let e=this.icn3d;if(e.icn3dui,void 0===e.bPTMShown||!e.bPTMShown)for(let t in e.PTMChainbase){let s=e.PTMChainbase[t];await e.annoPTMCls.showPTM(t,s,"ptm")}e.bPTMShown=!0}updateSsbond(){let e=this.icn3d;if(e.icn3dui,void 0===e.bSSbondShown||!e.bSSbondShown)for(let t in e.ssbondChainbase){let s=e.ssbondChainbase[t];e.annoSsbondCls.showSsbond(t,s)}e.bSSbondShown=!0}updateCrosslink(){let e=this.icn3d;if(e.icn3dui,void 0===e.bCrosslinkShown||!e.bCrosslinkShown)for(let t in e.crosslinkChainbase){let s=e.crosslinkChainbase[t];e.annoCrossLinkCls.showCrosslink(t,s)}e.bCrosslinkShown=!0}async updateTransmem(){let e=this.icn3d,t=e.icn3dui;if(void 0===e.bTranememShown||!e.bTranememShown)for(let s in e.protein_chainid){let i=e.protein_chainid[s];if(void 0!==t.cfg.opmid)e.annoTransMemCls.showTransmem(s,i);else if(e.bAfMem&&e.afmem_start_end){let t=e.afmem_start_end[0],n=e.afmem_start_end[1];await e.annoPTMCls.showPTM(s,i,"afmem",t,n)}else await e.annoPTMCls.showPTM(s,i,"transmem")}e.bTranememShown=!0}async updateIg(e,t){let s=this.icn3d,i=s.icn3dui;if(s.opts.color="ig strand",!e){s.hAtoms={};for(let e in s.protein_chainid)s.hAtoms=i.hashUtilsCls.unionHash(s.hAtoms,s.chains[e])}let n=s.firstAtomObjCls.getResiduesFromAtoms(s.hAtoms);for(let e in n)s.resid2refnum&&delete s.resid2refnum[e],s.residIgLoop&&delete s.residIgLoop[e],s.resid2domainid&&delete s.resid2domainid[e];s.bRunRefnumAgain=!0;let l=e?s.firstAtomObjCls.getChainsFromAtoms(s.hAtoms):s.protein_chainid;for(let e in l)await s.annoIgCls.showIg(e,t),s.bRunRefnumAgain=!1;s.bShowRefnum&&(s.hlUpdateCls.updateHlAll(),s.drawCls.draw())}}class Dt{constructor(e){this.icn3d=e}showAnnotations_part1(e){let t=this.icn3d,s=t.icn3dui;if(s.htmlCls.dialogCls.openDlg("dl_selectannotations","Sequences and Annotations"),(void 0===t.bAssemblyNote||!t.bAssemblyNote)&&void 0!==t.asuCnt){let e="
Assembly Tips: Only the asymmetric unit is shown in the sequence window. Click \"Assembly\" in the menu \"View\" to switch between asymmetric unit and biological assembly("+t.asuCnt+" asymmetric unit).
"+o+"Annotations of "+c+": "+r+""+a+" "+this.addButton(s,"icn3d-addtrack","Add Track","Add a custom track",60,i)+" ";h+=this.addButton(s,"icn3d-customcolor","Custom Color/Tube","Use a custom file to define the colors or tubes in 3D structure",110,i)+" ",h+=this.addButton(s,"icn3d-helixsets","Helix Sets",'Define sets for each helix in this chain and add them to the menu of "Defined Sets"',60,i)+" "+this.addButton(s,"icn3d-sheetsets","Sheet Sets",'Define sets for each sheet in this chain and add them to the menu of "Defined Sets"',60,i)+" "+this.addButton(s,"icn3d-coilsets","Coil Sets",'Define sets for each coil in this chain and add them to the menu of "Defined Sets"',60,i),h+=" "+this.addButton(s,"icn3d-iganchorsets","Ig Anchor Set",'Define the set for all Ig anchors in this chain and add them to the menu of "Defined Sets"',80,i)+" "+this.addButton(s,"icn3d-igstrandsets","Ig Strand Sets",'Define sets for each Ig strand in this chain and add them to the menu of "Defined Sets"',80,i)+" "+this.addButton(s,"icn3d-igloopsets","Ig Loop Sets",'Define sets for each Ig loop in this chain and add them to the menu of "Defined Sets"',80,i)+" "+this.addButton(s,"icn3d-igdomainsets","Ig Domain Sets",'Define sets for each Ig domain in this chain and add them to the menu of "Defined Sets"',80,i),$("#"+e.pre+"dl_annotations").append(h);let p=["giseq","cdd","clinvar","snp","site","ptm","ssbond","crosslink","transmem","domain","custom","interaction","ig"];for(let t in p){let i=p[t];$("#"+e.pre+"anno_"+s).append(this.getAnDiv(s,i))}$("#"+e.pre+"anno_"+s).append(" "),++n}if(t.bNode||e.annoCddSiteCls.setToolTip(),void 0!==e.chainid_seq)await this.processSeqData(e.chainid_seq);else try{let n=[],l=[];for(let e=0,t=i.length;e=6?l.push(i[e]):n.push(i[e])}if(n.length>0){let s=t.htmlCls.baseUrl+"/vastdyn/vastdyn.cgi?chainlist="+n;e.chainid_seq=await t.getAjaxPromise(s,"jsonp")}else e.chainid_seq={};for(let t=0,s=l.length;t40&&(r=r.substr(0,40)+"...");let o="";0==i&&("protein"==s?o="Proteins:
",h+=c,p+=c,$("#"+n.pre+"dt_giseq_"+e).html(h),$("#"+n.pre+"ov_giseq_"+e).html(p)}async processSeqData(e){let t=this.icn3d,s=t.icn3dui;for(let i in t.protein_chainid){let n=t.protein_chainid[i];if(e.hasOwnProperty(n)){let s=e[n];t.giSeq[i]=s;let l="";for(let e=0;e<10&&e14?"Query: "+o.substr(0,6)+"...":isNaN(s.cfg.query_id)?"Query: "+o:"Query: gi "+o;let a="cannot be aligned";t.queryStart="",t.queryEnd="",t.bRender&&alert("The sequence can NOT be aligned to the structure"),t.showSeqCls.showSeq(i,n,void 0,e,l,a,r)}else if(s.cfg.blast_rep_id==i&&(void 0!==t.seqStructAlignData||void 0!==t.seqStructAlignDataSmithwm)){let e,l,r,o,a,d=s.cfg.oriQuery_id?s.cfg.oriQuery_id:s.cfg.query_id;if(e=d.length>14?"Query: "+d.substr(0,6)+"...":isNaN(s.cfg.query_id)?"Query: "+d:"Query: gi "+d,void 0!==t.seqStructAlignData){let e,s,i=t.seqStructAlignData;if(void 0!==i.data){e=i.data[0].query;let t=Object.keys(i.data[0].targets);s=i.data[0].targets[t[0]],s=void 0!==s&&s.hsps.length>0?s.hsps[0]:void 0}if(void 0!==e&&void 0!==s){l=s.scores.e_value.toPrecision(2),l>1e-200&&(l=parseFloat(l).toExponential()),s.scores.bit_score;let t=Object.keys(i.targets);r=i.targets[t[0]].seqdata,o=e.seqdata,a=s.segs}}else{let e=t.seqStructAlignDataSmithwm;l=e.score,r=e.target.replace(/-/g,""),o=e.query.replace(/-/g,""),a=[];let s=-1,i=-1,n=!1,d={};for(let t=0,l=e.target.length;t0)if(i.orifrom-ni.from-l)for(let t=n+1;t
":"2D integration graph for "+E.length+" structure(s) "+E+'. There are three sections: "Interactions", "Common interactions", and "Different interactions". Each section has '+E.length+" graphs.
",s+=""}else if(t){let e,t,l,c,h=p[0],m=o.length,u=a.length,g=1,f=3*g,C=7*g,b=30;t=(m+2)*(f+C)+2*10+b,e=(u+2)*(f+C)+2*10+b,i.scatterplotWidth=2*e,c=i.scatterplotWidth,l=n.scatterplotid,s=r.length>0?"":"No interactions found for these two sets
",s+=""}else{let e=p[0],t=o.length,l=a.length,c=1,h=3*c,m=7*c,u=110,g=10,f=t>l?t*(h+m)+2*g:l*(h+m)+2*g;i.linegraphWidth=2*f,s=r.length>0?"":"No interactions found for these two sets
",s+=""}return i.lineGraphStr+="}\n",i.scatterplotStr=i.lineGraphStr,t?$("#"+i.pre+"scatterplotDiv").html(s):$("#"+i.pre+"linegraphDiv").html(s),s}drawGraphPerType(e,t,s,i,n,l,r,o,a,d,c,h,p,m){let u=this.icn3d;u.icn3dui;let g,f,C="",b=2==t.length&&"2"==t[1].replace(t[0],"");0==e?(g="Interactions in ",f=""):1==e?(g="Common interactions in ",f="_common"):2==e&&(g="Different interactions in ",f="_diff");for(let y=0,v=t.length;y0&&(u.lineGraphStr+=", \n"):u.lineGraphStr+=", \n",u.lineGraphStr+=u.getGraphCls.updateGraphJson(t[y],y+f,i[y],n[y],l[y])}return{heightFinal:o,html:C}}getIdArrayFromNode(e){let t=this.icn3d.icn3dui,s=[];s.push(""),s.push("");let i=e.r.substr(4);return s=s.concat(t.utilsCls.getIdArray(i)),s}drawLineGraph_base(e,t,s,i,n,l,r){let o,a,d=this.icn3d,c=d.icn3dui,h="",p=e.length,m=t.length;p>m?(o=10,a=10*Math.abs(p-m)*.5+10):(a=10,o=10*Math.abs(p-m)*.5+10),l&&(h+=""+l+"");let u=30+n,g=80+n,f="",C={},b={};for(let t=0;t
",e+=s+this.setIcon(t,"tool_pdbfile","Input PDB Files (appendable)","file-alt")+"",e+=s+this.setIcon(t,"tool_sharelink","Get Share Link","link")+"",e+=s+this.setIcon(t,"saveimage","Save iCn3D PNG Image","camera")+"",e+=i+this.setIcon(t,"tool_definedsets","Defined Sets","object-group")+"",e+=s+this.setIcon(t,"tool_aroundsphere","Select by Distance","dot-circle")+"",e+=s+this.setIcon(t,"tool_saveselection","Save Selection as a Set","save")+"",e+=s+this.setIcon(t,"toggleHighlight","Toggle Highlight","highlighter")+"",e+=i+this.setIcon(t,"show_selected","View Selection","eye")+"",e+=s+this.setIcon(t,"tool_selectedcenter","Zoom in Selection","search-plus")+"",e+=s+this.setIcon(t,"alternate","Alternate the Structures by keying the letter 'a'","a",void 0,!0,!0)+"",e+=s+this.setIcon(t,"tool_resetOrientation","Reset Orientation","undo-alt")+"",e+=i+this.setIcon(t,"tool_proteinsRibbon","Style Ribbon for proteins","dna")+"",e+=s+this.setIcon(t,"tool_proteinsSphere","Style Sphere for proteins","volleyball-ball")+"",e+=s+this.setIcon(t,"tool_surfaceVDW","Show Van der Waals Surface","cloud")+"",e+=s+this.setIcon(t,"tool_bkgd","Toggle Background Color","adjust")+"",e+=i+this.setIcon(t,"tool_clrRainbowChain","Color Rainbow for Chains","rainbow")+"",e+=s+this.setIcon(t,"tool_clrSSGreen","Color by Secondary Structures","ring")+"",e+=s+this.setIcon(t,"tool_clrChain","Color by Chains","layer-group")+"",e+=s+this.setIcon(t,"tool_clrAtom","Color by Atoms","atom")+"",e+=i+this.setIcon(t,"tool_selectannotations","Sequences & Annotations","grip-lines")+"",e+=s+this.setIcon(t,"hbondsYes","Interactions","users")+"",e+=s+this.setIcon(t,"tool_delphi","Delphi Potentials","cloud-meatball")+"",e+=s+this.setIcon(t,"removeLabels","Remove Labels","remove-format")+"",e+=i+this.setIcon("link","tool-gallery","Gallery","image","https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#gallery")+"",e+=s+this.setIcon("link","tool-video","Videos","file-video","https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#videos")+"",e+=s+this.setIcon("link","tool-github","iCn3D GitHub","code","https://github.com/ncbi/icn3d")+"",e+=s+this.setIcon("link","tool-hints","Transform Hints","info-circle","https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#useicn3d")+"",e+="
",t+="",t+=this.getMenuText("mn1_retrievebyid","Retrieve by ID",void 0,1,1),t+="
",t+=this.getLink("mn1_mmdbafid","PDB/MMDB/AlphaFold IDs"+e.htmlCls.wifiStr,1,2),t+=this.getLink("mn1_mmdbid","NCBI MMDB ID (annotation) "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_mmtfid","RCSB BCIF/MMTF ID (fast) "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_pdbid","RCSB PDB ID "+e.htmlCls.wifiStr,void 0,2),t+=this.getMenuText("mn1_afwrap","AlphaFold Structures",void 0,void 0,2),t+="
",t+=this.getLink("mn1_afid","UniProt ID "+e.htmlCls.wifiStr,void 0,3),t+=this.getLink("mn1_refseqid","NCBI Protein Accession "+e.htmlCls.wifiStr,void 0,3),t+="
",t+=this.getLink("mn1_opmid","OPM PDB ID "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_mmcifid","RCSB mmCIF ID "+e.htmlCls.wifiStr,void 0,2),t+=this.getLink("mn1_cid","PubChem CID/Name/InchI "+e.htmlCls.wifiStr,1,2),t+="
",t+="",t+=this.getLink("mn1_sharelink","Share Link "+e.htmlCls.wifiStr,1,1),t+=this.getLink("mn1_replayon","Replay Each Step",void 0,1),t+=this.getMenuSep(),t+=this.getMenuText("mn1_menuwrap","Customize Menus",void 0,1,1),t+="
",t+=this.getRadio("mn5_surface","mn5_surfaceVDW","Van der Waals",void 0,1,2),t+=this.getRadio("mn5_surface","mn5_surfaceVDWContext","VDW with Context",void 0,void 0,2),t+=this.getRadio("mn5_surface","mn5_surfaceMolecular","Molecular Surface",void 0,1,2),t+=this.getRadio("mn5_surface","mn5_surfaceMolecularContext","MS with Context",void 0,void 0,2),t+=this.getRadio("mn5_surface","mn5_surfaceSAS","Solvent Accessible",void 0,1,2),t+=this.getRadio("mn5_surface","mn5_surfaceSASContext","SA with Context",void 0,void 0,2),t+="
",t+="",t+=this.getMenuSep(),t+=this.getLink("mn5_cartoonshape","Cartoon for a Set",void 0,1),t+=this.getLink("mn5_linebtwsets","Line btw. Two Sets",void 0,1),void 0===e.cfg.cid&&void 0===e.cfg.align&&void 0===e.cfg.chainalign&&void 0===e.cfg.mmdbaf&&(t+=this.getMenuSep(),t+=this.getLinkWrapper2("mn5_map","Electron Density","mapWrapper1",void 0,1),t+="
",t+=this.getRadio("mn4_clr","mn4_clrSSGreen","Sheet in Green",void 0,1,2),t+=this.getRadio("mn4_clr","mn4_clrSSYellow","Sheet in Yellow",void 0,1,2),t+=this.getRadio("mn4_clr","mn4_clrSSSpectrum","Spectrum",void 0,void 0,2),t+="
",t+=this.getRadio("mn6_distance","mn6_distanceYes","between Two Atoms",void 0,1,2),t+=this.getRadio("mn6_distance","mn6_distTwoSets","between Two Sets",void 0,void 0,2),t+=this.getRadio("mn6_distance","mn6_distManySets","among Many Sets",void 0,void 0,2),t+=this.getRadio("mn6_distance","mn6_distanceNo","Hide",!0,1,2),t+="
",t+=this.getRadio("mn6_angle","mn6_angleManySets","among Many Sets",void 0,1,2),t+=this.getRadio("mn6_angle","mn6_angleTwoSets","b/w Two Vectors",void 0,void 0,2),t+="
",t+="",t+=this.getMenuUrl("selhints",e.htmlCls.baseUrl+"icn3d/icn3d.html#selsubset","Selection Hints",void 0,1),t+=this.getMenuUrl("helpdesk","https://support.nlm.nih.gov/support/create-case/","Write to Help Desk",1,1),t+="
",t+="
",t}hideMenu(){let e=this.icn3dui;e.bNode||(void 0!==$("#"+e.pre+"mnlist")[0]&&($("#"+e.pre+"mnlist")[0].style.display="none"),void 0!==$("#"+e.pre+"mnLogSection")[0]&&($("#"+e.pre+"mnLogSection")[0].style.display="none"),void 0!==$("#"+e.pre+"cmdlog")[0]&&($("#"+e.pre+"cmdlog")[0].style.display="none"),$("#"+e.pre+"title")[0].style.margin="10px 0 0 10px")}showMenu(){let e=this.icn3dui;e.bNode||(void 0!==$("#"+e.pre+"mnlist")[0]&&($("#"+e.pre+"mnlist")[0].style.display="block"),void 0!==$("#"+e.pre+"mnLogSection")[0]&&($("#"+e.pre+"mnLogSection")[0].style.display="block"),void 0!==$("#"+e.pre+"cmdlog")[0]&&($("#"+e.pre+"cmdlog")[0].style.display="block"))}}class c{constructor(e){this.icn3dui=e}openDlg(e,t){let s=this.icn3dui;s.icn3d,s.bNode||(e=s.pre+e,s.cfg.notebook?this.openDlgNotebook(e,t):this.openDlgRegular(e,t),s.htmlCls.themecolor||(s.htmlCls.themecolor="blue"),s.htmlCls.setMenuCls.setTheme(s.htmlCls.themecolor))}addSaveButton(e){let t=this.icn3dui;t.icn3d,t.bNode||void 0!==this.dialogHashSave&&this.dialogHashSave.hasOwnProperty(e)||($("#"+e).parent().children(".ui-dialog-titlebar").append(""),void 0===this.dialogHashSave&&(this.dialogHashSave={}),this.dialogHashSave[e]=1)}addHideButton(e){let t=this.icn3dui;t.icn3d,t.bNode||void 0!==this.dialogHashHide&&this.dialogHashHide.hasOwnProperty(e)||($("#"+e).parent().children(".ui-dialog-titlebar").append(""),void 0===this.dialogHashHide&&(this.dialogHashHide={}),this.dialogHashHide[e]=1)}getDialogStatus(){let e=this.icn3dui;if(e.icn3d,e.bNode)return;let t={},s={},i=$("#"+e.pre+"dl_selectannotations").hasClass("ui-dialog-content"),n=$("#"+e.pre+"dl_graph").hasClass("ui-dialog-content"),l=$("#"+e.pre+"dl_linegraph").hasClass("ui-dialog-content"),r=$("#"+e.pre+"dl_scatterplot").hasClass("ui-dialog-content"),o=$("#"+e.pre+"dl_contactmap").hasClass("ui-dialog-content"),a=$("#"+e.pre+"dl_alignerrormap").hasClass("ui-dialog-content"),d=$("#"+e.pre+"dl_interactionsorted").hasClass("ui-dialog-content"),c=$("#"+e.pre+"dl_alignment").hasClass("ui-dialog-content"),h=$("#"+e.pre+"dl_2ddgm").hasClass("ui-dialog-content"),p=$("#"+e.pre+"dl_2dctn").hasClass("ui-dialog-content"),m=$("#"+e.pre+"dl_definedsets").hasClass("ui-dialog-content");return t.bSelectannotationsInit2=!1,t.bGraph2=!1,t.bLineGraph2=!1,t.bScatterplot2=!1,t.bTable2=!1,t.bAlignmentInit2=!1,t.bTwoddgmInit2=!1,t.bTwodctnInit2=!1,t.bSetsInit2=!1,s.dl_selectannotations="bSelectannotationsInit2",s.dl_graph="bGraph2",s.dl_linegraph="bLineGraph2",s.dl_scatterplot="bScatterplot2",s.dl_contactmap="bContactmap2",s.dl_alignerrormap="bAlignerrormap2",s.dl_interactionsorted="bTable2",s.dl_alignment="bAlignmentInit2",s.dl_2ddgm="bTwoddgmInit2",s.dl_2dctn="bTwodctnInit2",s.dl_definedsets="bSetsInit2",i&&(t.bSelectannotationsInit2=$("#"+e.pre+"dl_selectannotations").dialog("isOpen")),n&&(t.bGraph2=$("#"+e.pre+"dl_graph").dialog("isOpen")),l&&(t.bLineGraph2=$("#"+e.pre+"dl_linegraph").dialog("isOpen")),r&&(t.bScatterplot2=$("#"+e.pre+"dl_scatterplot").dialog("isOpen")),o&&(t.bContactmap2=$("#"+e.pre+"dl_contactmap").dialog("isOpen")),a&&(t.bAlignerror2=$("#"+e.pre+"dl_alignerrormap").dialog("isOpen")),d&&(t.bTable2=$("#"+e.pre+"dl_interactionsorted").dialog("isOpen")),c&&(t.bAlignmentInit2=$("#"+e.pre+"dl_alignment").dialog("isOpen")),h&&(t.bTwoddgmInit2=$("#"+e.pre+"dl_2ddgm").dialog("isOpen")),p&&(t.bTwodctnInit2=$("#"+e.pre+"dl_2dctn").dialog("isOpen")),m&&(t.bSetsInit2=$("#"+e.pre+"dl_definedsets").dialog("isOpen")),{status:t,id2flag:s}}openDlgHalfWindow(e,t,s,i){let n=this.icn3dui,l=n.icn3d;if(n.bNode)return;let r=this,o=n.htmlCls.width2d+20;l.resizeCanvasCls.resizeCanvas(n.htmlCls.WIDTH-s,n.htmlCls.HEIGHT,i);let a,d=n.htmlCls.HEIGHT,c=s;a=!n.cfg.showmenu||n.utilsCls.isMobile()||n.cfg.mobilemenu?{my:"left top",at:"right top",of:"#"+n.pre+"viewer",collision:"none"}:{my:"left top",at:"right top+40",of:"#"+n.pre+"viewer",collision:"none"},n.cfg.resize=!1,window.dialog=$("#"+e).dialog({autoOpen:!0,title:t,height:d,width:c,modal:!1,position:a,close:function(t){let s=r.getDialogStatus(),i=s.status,a=s.id2flag,d=!1;for(let t in a){let s=e===n.pre+t;for(let e in i)i.hasOwnProperty(e)||(s=s&&!i[e]);d=d||s}if(d)if(i.bTwoddgmInit2||i.bTwodctnInit2||i.bSetsInit2){let e=n.utilsCls.isMobile()?n.htmlCls.WIDTH:n.htmlCls.WIDTH-o;l.resizeCanvasCls.resizeCanvas(e,n.htmlCls.HEIGHT,!0),i.bTwoddgmInit2&&r.openDlg2Ddgm(n.pre+"dl_2ddgm",void 0,i.bSetsInit2),i.bTwodctnInit2&&r.openDlg2Ddgm(n.pre+"dl_2dctn",void 0,i.bSetsInit2),i.bSetsInit2&&r.openDlg2Ddgm(n.pre+"dl_definedsets")}else l.resizeCanvasCls.resizeCanvas(n.htmlCls.WIDTH,n.htmlCls.HEIGHT,!0)},resize:function(t){if(e==n.pre+"dl_selectannotations")l.annotationCls.hideFixedTitle();else if(e==n.pre+"dl_graph"){let t=$("#"+e).width(),s=$("#"+e).height();d3.select("#"+n.svgid).attr("width",t).attr("height",s)}else if(e==n.pre+"dl_linegraph"||e==n.pre+"dl_scatterplot"||e==n.pre+"dl_contactmap"||e==n.pre+"dl_alignerrormap"){let t=status.bTwoddgmInit2||status.bSetsInit2?(n.htmlCls.WIDTH-o)/2:n.htmlCls.WIDTH/2,s=$("#"+e).width()/t;if(e==n.pre+"dl_linegraph"){let e=l.linegraphWidth*s;$("#"+n.linegraphid).attr("width",e)}else if(e==n.pre+"dl_scatterplot"){let e=l.scatterplotWidth*s;$("#"+n.scatterplotid).attr("width",e)}else if(e==n.pre+"dl_contactmap"){let e=l.contactmapWidth*s;$("#"+n.contactmapid).attr("width",e)}else if(e==n.pre+"dl_alignerrormap"){let e=l.alignerrormapWidth*s;$("#"+n.alignerrormapid).attr("width",e)}}}}),this.addSaveButton(e),this.addHideButton(e)}openDlg2Ddgm(e,t,s){let i=this.icn3dui,n=i.icn3d;if(i.bNode)return;let l,r,o=this,a=i.htmlCls.width2d+20;e===i.pre+"dl_definedsets"?(l="right top",r="Select sets"):e!==i.pre+"dl_2ddgm"&&e!==i.pre+"dl_2dctn"||(l=s?"right top+240":"right top",r=e===i.pre+"dl_2ddgm"?"2D Diagram":"2D Cartoon");let d={my:"left top+"+i.htmlCls.MENU_HEIGHT,at:l,of:"#"+i.pre+"viewer",collision:"none"};window.dialog=$("#"+e).dialog({autoOpen:!0,title:r,height:"auto",width:a,modal:!1,position:d,close:function(e){let t=o.getDialogStatus().status;t.bSelectannotationsInit2||t.bGraph2||t.bLineGraph2||t.bScatterplot2||t.bTable2||t.bAlignmentInit2||n.resizeCanvasCls.resizeCanvas(i.htmlCls.WIDTH,i.htmlCls.HEIGHT,!0)},resize:function(t,s){e==i.pre+"dl_2dctn"&&(n.resizeRatioX=s.size.width/i.htmlCls.width2d,n.resizeRatioY=s.size.height/(i.htmlCls.width2d+70))},resizeStop:function(e,t){n.resizeRatioX=t.size.width/i.htmlCls.width2d,n.resizeRatioY=t.size.height/(i.htmlCls.width2d+70)}}),this.addSaveButton(e),this.addHideButton(e)}openDlgRegular(e,t){let s=this.icn3dui,i=s.icn3d;if(s.bNode)return;let n=400,l=150,r=s.htmlCls.width2d+20,o=this.getDialogStatus().status;if(e===s.pre+"dl_selectannotations"||e===s.pre+"dl_graph"||e===s.pre+"dl_linegraph"||e===s.pre+"dl_scatterplot"||e===s.pre+"dl_contactmap"||e===s.pre+"dl_alignerrormap"||e===s.pre+"dl_interactionsorted"||e===s.pre+"dl_alignment"){let a=.5*s.htmlCls.WIDTH-.5*r;if(s.htmlCls.WIDTH>=s.htmlCls.HEIGHT)this.openDlgHalfWindow(e,t,a,!0),(o.bTwoddgmInit2||o.bTwodctnInit2||o.bSetsInit2)&&(i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH-a-r,s.htmlCls.HEIGHT,!0),o.bTwoddgmInit2&&this.openDlg2Ddgm(s.pre+"dl_2ddgm",void 0,o.bSetsInit2),o.bTwodctnInit2&&this.openDlg2Ddgm(s.pre+"dl_2dctn",void 0,o.bSetsInit2),o.bSetsInit2&&this.openDlg2Ddgm(s.pre+"dl_definedsets"));else{i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH,.5*s.htmlCls.HEIGHT,!0),l=.5*s.htmlCls.HEIGHT,n=s.htmlCls.WIDTH;let a={my:"left top",at:"left bottom+32",of:"#"+s.pre+"canvas",collision:"none"};window.dialog=$("#"+e).dialog({autoOpen:!0,title:t,height:l,width:n,modal:!1,position:a,close:function(t){if(!((e!==s.pre+"dl_selectannotations"||o.bAlignmentInit2||o.bGraph2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_graph"||o.bSelectannotationsInit2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_alignment"||o.bSelectannotationsInit2||o.bGraph2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_interactionsorted"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_linegraph"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bScatterplot2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_scatterplot"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bContactmap2||o.bAlignerrormap2)&&(e!==s.pre+"dl_contactmap"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bAlignerrormap2)&&(e!==s.pre+"dl_alignerrormap"||o.bSelectannotationsInit2||o.bGraph2||o.bAlignmentInit2||o.bTable2||o.bLineGraph2||o.bScatterplot2||o.bContactmap2)))if(o.bTwoddgmInit2||o.bTwodctnInit2||o.bSetsInit2){let e=s.utilsCls.isMobile()?s.htmlCls.WIDTH:s.htmlCls.WIDTH-r;i.resizeCanvasCls.resizeCanvas(e,s.htmlCls.HEIGHT,!0),o.bTwoddgmInit2&&thisClass.openDlg2Ddgm(s.pre+"dl_2ddgm",void 0,o.bSetsInit2),o.bTwodctnInit2&&thisClass.openDlg2Ddgm(s.pre+"dl_2dctn",void 0,o.bSetsInit2),o.bSetsInit2&&thisClass.openDlg2Ddgm(s.pre+"dl_definedsets")}else i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH,s.htmlCls.HEIGHT,!0)},resize:function(t){if(e==s.pre+"dl_selectannotations")i.annotationCls.hideFixedTitle();else if(e==s.pre+"dl_graph"){let t=$("#"+e).width(),i=$("#"+e).height();d3.select("#"+s.svgid).attr("width",t).attr("height",i)}else if(e==s.pre+"dl_linegraph"||e==s.pre+"dl_scatterplot"||e==s.pre+"dl_contactmap"||e==s.pre+"dl_alignerrormap"){let t=o.bTwoddgmInit2||o.bSetsInit2?(s.htmlCls.WIDTH-r)/2:s.htmlCls.WIDTH/2,n=$("#"+e).width()/t;if(e==s.pre+"dl_linegraph"){let e=i.linegraphWidth*n;$("#"+s.linegraphid).attr("width",e)}else if(e==s.pre+"dl_scatterplot"){let e=i.scatterplotWidth*n;$("#"+s.scatterplotid).attr("width",e)}else if(e==s.pre+"dl_contactmap"){let e=i.contactmapWidth*n;$("#"+s.contactmapid).attr("width",e)}else if(e==s.pre+"dl_alignerrormap"){let e=i.alignerrormapWidth*n;$("#"+s.alignerrormapid).attr("width",e)}}}}),this.addSaveButton(e),this.addHideButton(e)}}else if(e===s.pre+"dl_2ddgm"||e===s.pre+"dl_2dctn"){let t=0;if(s.htmlCls.WIDTH>=s.htmlCls.HEIGHT)(o.bSelectannotationsInit2||o.bGraph2||o.bLineGraph2||o.bScatterplot2||o.bTable2||o.bAlignmentInit2)&&(t=.5*s.htmlCls.WIDTH-.5*r),i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH-t-r,s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e,void 0,o.bSetsInit2);else{let t=s.utilsCls.isMobile()?s.htmlCls.WIDTH:s.htmlCls.WIDTH-r;i.resizeCanvasCls.resizeCanvas(t,.5*s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e,.5*s.htmlCls.HEIGHT),this.openDlg2Ddgm(e,.5*s.htmlCls.HEIGHT,o.bSetsInit2)}}else{let a;if(l="auto",n="auto",e===s.pre+"dl_addtrack"?n="50%":e===s.pre+"dl_menupref"&&(n=600,l=500),e===s.pre+"dl_definedsets"){let t=0;if(s.htmlCls.WIDTH>=s.htmlCls.HEIGHT)(o.bSelectannotationsInit2||o.bGraph2||o.bLineGraph2||o.bScatterplot2||o.bTable2||o.bAlignmentInit2)&&(t=.5*s.htmlCls.WIDTH-.5*r),i.resizeCanvasCls.resizeCanvas(s.htmlCls.WIDTH-t-r,s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e),o.bTwoddgmInit2&&this.openDlg2Ddgm(s.pre+"dl_2ddgm",void 0,!0),o.bTwodctnInit2&&this.openDlg2Ddgm(s.pre+"dl_2dctn",void 0,!0);else{let t=s.utilsCls.isMobile()?s.htmlCls.WIDTH:s.htmlCls.WIDTH-r;i.resizeCanvasCls.resizeCanvas(t,.5*s.htmlCls.HEIGHT,!0),this.openDlg2Ddgm(e,.5*s.htmlCls.HEIGHT),o.bTwoddgmInit2&&this.openDlg2Ddgm(s.pre+"dl_2ddgm",.5*s.htmlCls.HEIGHT,!0),o.bTwodctnInit2&&this.openDlg2Ddgm(s.pre+"dl_2dctn",.5*s.htmlCls.HEIGHT,!0)}}else s.utilsCls.isMobile()?a={my:"left top",at:"left bottom-50",of:"#"+s.pre+"canvas",collision:"none"}:e===s.pre+"dl_allinteraction"||e===s.pre+"dl_buriedarea"?(a={my:"right top",at:"right top+50",of:"#"+i.divid,collision:"none"},n=700,l=500):a=e===s.pre+"dl_rmsd"||e===s.pre+"dl_legend"?{my:"left bottom",at:"left+20 bottom-20",of:"#"+s.pre+"canvas",collision:"none"}:e===s.pre+"dl_symd"?{my:"left top",at:"right-200 bottom-200",of:"#"+s.pre+"canvas",collision:"none"}:s.cfg.align?{my:"left top",at:"left top+90",of:"#"+s.pre+"canvas",collision:"none"}:e===s.pre+"dl_mmdbafid"?{my:"left top",at:"left top+130",of:"#"+s.pre+"canvas",collision:"none"}:{my:"left top",at:"left top+50",of:"#"+s.pre+"canvas",collision:"none"},window.dialog=$("#"+e).dialog({autoOpen:!0,title:t,height:l,width:n,modal:!1,position:a}),this.addSaveButton(e),this.addHideButton(e)}$(".ui-dialog .ui-button span").removeClass("ui-icon-closethick").addClass("ui-icon-close")}openDlgNotebook(e,t){let s=this.icn3dui,i=s.icn3d;if(s.bNode)return;let n=400,l=150,r=s.htmlCls.width2d+20;e===s.pre+"dl_selectannotations"||e===s.pre+"dl_graph"||e===s.pre+"dl_linegraph"||e===s.pre+"dl_scatterplot"||e===s.pre+"dl_contactmap"||e===s.pre+"dl_alignerrormap"||e===s.pre+"dl_interactionsorted"||e===s.pre+"dl_alignment"?($("#"+e).show(),$("#"+e+"_nb").show(),$("#"+e+"_title").html(t),l=.5*s.htmlCls.HEIGHT,n=s.htmlCls.WIDTH,$("#"+e).width(n),$("#"+e).height(l),$("#"+e).resize((function(t){let n=s.htmlCls.WIDTH/2,l=$("#"+e).width()/n;if(e==s.pre+"dl_selectannotations")i.annotationCls.hideFixedTitle();else if(e==s.pre+"dl_graph"){let t=$("#"+e).width(),i=$("#"+e).height();d3.select("#"+s.svgid).attr("width",t).attr("height",i)}else if(e==s.pre+"dl_linegraph"){let e=i.linegraphWidth*l;$("#"+s.linegraphid).attr("width",e)}else if(e==s.pre+"dl_scatterplot"){let e=i.scatterplotWidth*l;$("#"+s.scatterplotid).attr("width",e)}else if(e==s.pre+"dl_contactmap"){let e=i.contactmapWidth*l;$("#"+s.contactmapid).attr("width",e)}else if(e==s.pre+"dl_alignerrormap"){let e=i.alignerrormapWidth*l;$("#"+s.alignerrormapid).attr("width",e)}}))):(i.bRender&&($("#"+e).show(),$("#"+e+"_nb").show(),$("#"+e+"_title").html(t)),l="auto",n="auto",e===s.pre+"dl_addtrack"?n="50%":e===s.pre+"dl_2ddgm"||e===s.pre+"dl_2dctn"||e===s.pre+"dl_definedsets"?n=r:e!==s.pre+"dl_allinteraction"&&e!==s.pre+"dl_buriedarea"||(n=700,l=500),$("#"+e).width(n),$("#"+e).height(l))}}class h{constructor(e){this.icn3dui=e}setCustomDialogs(){let e=this.icn3dui;if(e.icn3d,e.bNode)return"";return""}getHtmlAlignResidueByResidue(e,t,s){let i=this.icn3dui;i.icn3d;let n="";return n+="All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).
',s+="",s+=e.htmlCls.divStr+"dl_command' style='display:none;'>",s+=e.htmlCls.divStr+"dl_setoperations'>",s+=" ",s+=" ",s+="",s+=" ",s+=e.htmlCls.setHtmlCls.setAdvanced(),s+="",s+="",s+=e.htmlCls.setHtmlCls.setAdvanced(2),s+=e.htmlCls.divStr+"dl_vastplus' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_vastplus","Please input PDB ID for VAST+"),s+="Note: VAST+ finds other macromolecular structures that have a similar biological unit. To do this, VAST+ takes into consideration the complete set of 3D domains that VAST identified within a query structure, throughout all of its component protein molecules, and finds other macromolecular structures that have a similar set of proteins/3D domains.
",s+="PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"vastpluspdbid' value='6VXX' size=8> ",s+=e.htmlCls.buttonStr+"reload_vastplus'>VAST+",s+="",s+=e.htmlCls.divStr+"dl_vast' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_vast","Pleaes input chain or PDB file for VAST"),s+="Note: VAST identifies 3D domains (substructures) within each protein structure in the Molecular Modeling Database (MMDB), and then finds other protein structures that have one or more similar 3D domains, using purely geometric criteria. You have two ways to do a VAST search.
",s+="Option 1, search with your selection (all residues are selected by default) in the loaded structures: ",s+=' ",s+="Option 2, search with PDB ID and chain name: ",s+="PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"vastpdbid' value='4N7N' size=8> ",s+="Chain Name: "+e.htmlCls.inputTextStr+"id='"+e.pre+"vastchainid' value='A' size=8> ",s+=e.htmlCls.buttonStr+"reload_vast'>VAST
",s+="Option 3, search with a PDB file: ",s+=' ",s+="",s+=e.htmlCls.divStr+"dl_foldseek' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_foldseek","Submit your selection to Foldseek"),s+='1. your selection (all residues are selected by default) in the loaded structures to Foldseek web server.
',s+='2 (Optional). Once you see the structure neighbors, you can view the alignment in iCn3D by inputing a list of PDB chain IDs or AlphaFold UniProt IDs below.
The PDB chain IDs are the same as the record names such as "1HHO_A". The UniProt ID is the text between "AF-" and "-F1". For example, the UniProt ID for the record name "AF-P69905-F1-model_v4" is "P69905".
',s+="Chain ID List: "+e.htmlCls.inputTextStr+"id='"+e.pre+"foldseekchainids' value='P69905,P01942,1HHO_A' size=30> ",s+=e.htmlCls.buttonStr+"reload_foldseek'>Align",s+="",s+=e.htmlCls.divStr+"dl_mmtfid' class='"+n+"'>",s+=this.addNotebookTitle("dl_mmtfid","Please input an BCIF/MMTF ID"),s+="BCIF/MMTF ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmtfid' value='1TUP' size=8> ",s+=e.htmlCls.buttonStr+"reload_mmtf'>Load",s+="",s+=e.htmlCls.divStr+"dl_pdbid' class='"+n+"'>",s+=this.addNotebookTitle("dl_pdbid","Please input a PDB ID"),s+="PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"pdbid' value='1TUP' size=8> ",s+=e.htmlCls.buttonStr+"reload_pdb'>Load",s+="",s+=e.htmlCls.divStr+"dl_afid' class='"+n+"'>",s+=this.addNotebookTitle("dl_afid","Please input an AlphaFold UniProt ID"),s+="Note: AlphaFold produces a per-residue confidence score (pLDDT) between 0 and 100: ",s+=e.htmlCls.clickMenuCls.setAlphaFoldLegend()+" ";let o=e.cfg.afid?e.cfg.afid:"A4D1S0";s+="AlphaFold Uniprot ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"afid' value='"+o+"' size=10>
",s+="PAE Map: "+e.htmlCls.buttonStr+"reload_afmap'>Load Half"+e.htmlCls.buttonStr+"reload_afmapfull' style='margin-left:30px'>Load Full (slow)",s+="",s+=e.htmlCls.divStr+"dl_refseqid' class='"+n+"'>",s+=this.addNotebookTitle("dl_refseqid","Please input an NCBI protein accession"),s+="NCBI Protein Accession: "+e.htmlCls.inputTextStr+"id='"+e.pre+"refseqid' value='NP_001743.1' size=8> ",s+=e.htmlCls.buttonStr+"reload_refseq'>Load",s+="",s+=e.htmlCls.divStr+"dl_opmid' class='"+n+"'>",s+=this.addNotebookTitle("dl_opmid","Please input an OPM PDB ID"),s+="Orientations of Proteins in Membranes(OPM) PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"opmid' value='6JXR' size=8> ",s+=e.htmlCls.buttonStr+"reload_opm'>Load",s+="",s+=e.htmlCls.divStr+"dl_pdbfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_pdbfile","Please input a PDB file"),s+='Note: Several PDB files could be concatenated into a single PDB file. Use the line "ENDMDL" to separate PDB files.
',s+="PDB File: "+e.htmlCls.inputFileStr+" id='"+e.pre+"pdbfile' size=8> ",s+=e.htmlCls.buttonStr+"reload_pdbfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_pdbfile_app' class='"+n+"'>",s+=this.addNotebookTitle("dl_pdbfile_app","Please append PDB files"),s+="Multiple PDB Files: ",s+=e.htmlCls.buttonStr+"reload_pdbfile_app'>Append",s+="",s+=e.htmlCls.divStr+"dl_rescolorfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_rescolorfile","Please input a residue color file"),s+='
The custom JSON file on residue colors has the following format for proteins("ALA" and "ARG") and nucleotides("G" and "A"): ',s+='{"ALA":"#C8C8C8", "ARG":"#145AFF", ..., "G":"#008000", "A":"#6080FF", ...}
',s+="Residue Color File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"rescolorfile' size=8> ",s+=e.htmlCls.buttonStr+"reload_rescolorfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_customcolor' class='"+n+"'>",s+=this.addNotebookTitle("dl_customcolor","Please input a custom color file"),s+=" ",s+='
The custom file for the structure has two columns separated by space or tab: ',s+='residue number, and score in the range of 0-100. If you click "Apply Custom Color" button, ',s+='the scores 0, 50 and 100 correspond to the three colors specified below. If you click "Apply Custom Tube", ',s+='the selected residues will be displayed in a style similar to "B-factor Tube".
",s+="2. "+e.htmlCls.buttonStr+"reload_customtubefile'>Apply Custom Tube",s+="",s+=e.htmlCls.divStr+"dl_customref' class='"+n+"'>",s+=this.addNotebookTitle("dl_customref","Please input a reference number file"),s+='
You can define your own reference numbers in a custom file using Excel, and then export it as a CSV file. An example file is shown below with cells separated by commas. ',s+="
",s+="1TUP_C,,,,,,,200,201,230",s+='The first row defines the reference residue numbers, which could be any strings. The 1st cell could be anything. The rest cells are reference residue numbers (e.g., 11, 21, 10C, etc.) or empty cells. Each chain has a separate row. The first cell of the second row is the chain ID "1TUP_A". The rest cells are the corresponding real residue numbers for reference residue numbers in the first row. For example, the reference numbers for residues 100, 101, and 132 in the chain 1TUP_A are 11, 12, and 22, respectively. The fourth row shows another set of reference numners for the chain "1TUP_C". It could be a chain from a different structure.
',s+='To select all residues corresponding to the reference numbers, you can simplay replace ":" with "%" in the Specification. For example, "%12" selects the residue 101 in 1TUP_A and the residue 111 in 1TUP_B. ".A%12" has the chain "A" filter and selects the residue 101 in 1TUP_A. ',s+="
",s+=e.htmlCls.buttonStr+"reload_customreffile'>Apply Custom Reference Numbers",s+="",s+=e.htmlCls.divStr+"dl_align' class='"+n+"'>",s+=this.addNotebookTitle("dl_align","Please select residues in aligned sequences"),s+="Enter the PDB IDs or MMDB IDs of the structures:
",s+="VAST+ based on VAST: "+e.htmlCls.buttonStr+"reload_align_ori'>All Matching Molecules Superposed"+e.htmlCls.space3+e.htmlCls.buttonStr+"reload_align_refined'>Invariant Substructure Superposed
",s+="VAST+ based on TM-align: "+e.htmlCls.buttonStr+"reload_align_tmalign'>All Matching Molecules Superposed
",s+="",s+=e.htmlCls.divStr+"dl_alignaf' class='"+n+"'>",s+=this.addNotebookTitle("dl_alignaf","Align AlphaFold structures"),s+="Enter two AlphaFold Uniprot IDs:
",s+=e.htmlCls.buttonStr+"reload_alignaf_tmalign'>Align with TM-align"+e.htmlCls.buttonStr+"reload_alignaf' style='margin-left:30px'>Align with VAST",s+="",s+=e.htmlCls.divStr+"dl_chainalign' class='"+n+"'>",s+=this.addNotebookTitle("dl_chainalign","Align chains"),s+="
",s+="All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).
",s+=e.htmlCls.buttonStr+"reload_chainalign_tmalign'>Align with TM-align"+e.htmlCls.buttonStr+"reload_chainalign_asym' style='margin-left:30px'>Align with VAST
",s+='(Note: To align chains in custom PDB files, you could load them in "File > Open File > PDB Files (appendable)" and click "Analysis > Defined Sets". Finally select multiple chains in Defined Sets and click "File > Realign Selection".)
",s+="All chains will be aligned to the first chain in the comma-separated chain IDs. Each chain ID has the form of PDBID_chain (e.g., 1HHO_A, case sensitive) or UniprotID (e.g., P69905 for AlphaFold structures).
",s+="The sequence alignment (followed by structure alignment) is based on residue numbers in the First/Master chain: "+e.htmlCls.inputTextStr+"id='"+e.pre+"resalignids' value='1,5,10-50' size=50> ",s+=e.htmlCls.buttonStr+"reload_chainalign_asym2' style='margin-top:3px;'>Align by Sequence Alignment
",s+='(Note: To align chains in custom PDB files, you could load them in "File > Open File > PDB Files (appendable)" and click "Analysis > Defined Sets". Finally select multiple chains in Defined Sets and click "File > Realign Selection".)
",s+='Please specify the mutations with a comma separated mutation list. Each mutation can be specified as "[uppercase PDB ID or AlphaFold UniProt ID]_[Chain Name]_[Residue Number]_[One Letter Mutant Residue]". E.g., the mutation of N501Y in the E chain of PDB 6M0J can be specified as "6M0J_E_501_Y". For AlphaFold structures, the "Chain ID" is "A". If you load a custom structure without PDB or UniProt ID, you can open "Seq. & Annotations" window and find the chain ID such as "stru_A". The part before the underscore is the structure ID, which can be used to specify the mutation such as "stru_A_...". Remember to choose "Show Mutation in: Current Page".
',s+=e.htmlCls.buttonStr+"reload_mutation_3d' title='Show the mutations in 3D using the scap program'>3D with scap",s+=e.htmlCls.buttonStr+"reload_mutation_inter' style='margin-left:20px' title='Show the mutations in 3D and the change of interactions'>Interactions",s+=e.htmlCls.buttonStr+"reload_mutation_pdb' style='margin-left:20px' title='Show the mutations in 3D and export the PDB of the mutant within 10 angstrom'>PDB",s+="
",s+=e.htmlCls.divStr+"dl_mol2file' class='"+n+"'>",s+=this.addNotebookTitle("dl_mol2file","Please input a Mol2 file"),s+="Mol2 File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"mol2file' size=8> ",s+=e.htmlCls.buttonStr+"reload_mol2file'>Load",s+="",s+=e.htmlCls.divStr+"dl_sdffile' class='"+n+"'>",s+=this.addNotebookTitle("dl_sdffile","Please input an SDF file"),s+="SDF File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"sdffile' size=8> ",s+=e.htmlCls.buttonStr+"reload_sdffile'>Load",s+="",s+=e.htmlCls.divStr+"dl_xyzfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_xyzfile","Please input an XYZ file"),s+="XYZ File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"xyzfile' size=8> ",s+=e.htmlCls.buttonStr+"reload_xyzfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_afmapfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_afmapfile","Please input an AlphaFold PAE file"),s+="AlphaFold PAE File: "+e.htmlCls.inputFileStr+"id='"+e.pre+"afmapfile' size=8>
",s+=e.htmlCls.buttonStr+"reload_afmapfile'>Load Half PAE Map"+e.htmlCls.buttonStr+"reload_afmapfilefull' style='margin-left:30px'>Load Full PAE Map (slow)",s+="",s+=e.htmlCls.divStr+"dl_urlfile' class='"+n+"'>",s+=this.addNotebookTitle("dl_urlfile","Please input a file via URL"),s+="File type: ",s+=" ",s+="URL in the same host: "+e.htmlCls.inputTextStr+"id='"+e.pre+"urlfile' size=20> ",s+=e.htmlCls.buttonStr+"reload_urlfile'>Load",s+="",s+=e.htmlCls.divStr+"dl_mmciffile' class='"+n+"'>",s+=this.addNotebookTitle("dl_mmciffile","Please append mmCIF files"),s+="Multiple mmCIF Files: ",s+=e.htmlCls.buttonStr+"reload_mmciffile'>Load",s+="",s+=e.htmlCls.divStr+"dl_mmcifid' class='"+n+"'>",s+=this.addNotebookTitle("dl_mmcifid","Please input an mmCIF ID"),s+="mmCIF ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmcifid' value='1TUP' size=8> ",s+=e.htmlCls.buttonStr+"reload_mmcif'>Load",s+="",s+=e.htmlCls.divStr+"dl_mmdbid' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_mmdbid","Please input an MMDB ID"),s+="MMDB or PDB ID: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmdbid' value='1TUP' size=8>
",s+=e.htmlCls.buttonStr+"reload_mmdb'>Load Biological Unit"+e.htmlCls.buttonStr+"reload_mmdb_asym' style='margin-left:30px'>Load Asymmetric Unit (All Chains)
",s+='Note: The "biological unit" is the biochemically active form of a biomolecule,
',s+=e.htmlCls.divStr+"asu_bu' style='display:none;'>",s+='which can range from a monomer (single protein molecule) to an oligomer of 100+ protein molecules.
The "asymmetric unit" is the raw 3D structure data resolved by X-ray crystallography, NMR, or Cryo-electron microscopy. The asymmetric unit is equivalent to the biological unit in approximately 60% of structure records. In the remaining 40% of the records, the asymmetric unit represents a portion of the biological unit that can be reconstructed using crystallographic symmetry, or it represents multiple copies of the biological unit.',s+="",s+=e.htmlCls.divStr+"dl_mmdbafid' class='"+n+"' style='max-width:600px'>",s+=this.addNotebookTitle("dl_mmdbafid","Please input a list of PDB/AlphaFold IDs"),s+="List of PDB, MMDB, or AlphaFold UniProt structures: "+e.htmlCls.inputTextStr+"id='"+e.pre+"mmdbafid' placeholder='e.g., 1HHO,4N7N,P69905,P01942' size=30>
",s+=""+e.htmlCls.buttonStr+"reload_mmdbaf' style='width:150px'>Load Biological Unit"+e.htmlCls.buttonStr+"reload_mmdbaf_asym' style='margin-left:30px; width:250px'>Load Asymmetric Unit (All Chains)
",s+="
or
"+e.htmlCls.buttonStr+"reload_mmdbaf_append' style='width:150px'>Append Biological Unit"+e.htmlCls.buttonStr+"reload_mmdbaf_asym_append' style='margin-left:30px; width:250px'>Append Asymmetric Unit (All Chains)
",s+='Note: The "biological unit" is the biochemically active form of a biomolecule,
',s+=e.htmlCls.divStr+"asu_bu2' style='display:none;'>",s+='which can range from a monomer (single protein molecule) to an oligomer of 100+ protein molecules.
The "asymmetric unit" is the raw 3D structure data resolved by X-ray crystallography, NMR, or Cryo-electron microscopy. The asymmetric unit is equivalent to the biological unit in approximately 60% of structure records. In the remaining 40% of the records, the asymmetric unit represents a portion of the biological unit that can be reconstructed using crystallographic symmetry, or it represents multiple copies of the biological unit.',s+="",s+=e.htmlCls.divStr+"dl_blast_rep_id' style='max-width:600px;' class='"+n+"'>",s+=this.addNotebookTitle("dl_blast_rep_id","Align sequence to structure"),s+="Enter a Sequence ID (or FASTA sequence) and the aligned protein accession, which can be found using the BLAST search with the Sequence ID or FASTA sequence as input. If the protein accession is not a PDB chain, the corresponding AlphaFold UniProt structure is used.
",s+="Sequence ID(NCBI protein accession of a sequence): "+e.htmlCls.inputTextStr+"id='"+e.pre+"query_id' value='NP_001108451.1' size=8> ",s+="or FASTA sequence:
",s+="NCBI protein accession (or a chain of a PDB): "+e.htmlCls.inputTextStr+"id='"+e.pre+"blast_rep_id' value='1TSR_A' size=8> ",s+=e.htmlCls.buttonStr+"reload_blast_rep_id'>Align with BLAST "+e.htmlCls.wifiStr+e.htmlCls.buttonStr+"reload_alignsw' style='margin-left:30px'>Align with Global Smith-Waterman"+e.htmlCls.buttonStr+"reload_alignswlocal' style='margin-left:30px'>Align with Local Smith-Waterman",s+="",s+=e.htmlCls.divStr+"dl_esmfold' style='max-width:600px;' class='"+n+"'>",s+=this.addNotebookTitle("dl_esmfold","Sequence to structure prediction with ESMFold"),s+="The sequence to structure prediction is done via ESM Metagenomic Atlas. The sequence should be less than 400 characters. For any sequence longer than 400, please see the discussion here.
",s+="FASTA sequence:
",s+=e.htmlCls.buttonStr+"run_esmfold'>ESMFold ",s+="",s+=e.htmlCls.divStr+"dl_yournote' class='"+n+"'>",s+=this.addNotebookTitle("dl_yournote","Your Note"),s+='Your note will be saved in the HTML file when you click "File > Save File > iCn3D PNG Image".
',s+=" ",s+=e.htmlCls.buttonStr+"applyyournote'>Save",s+="",s+=e.htmlCls.divStr+"dl_proteinname' class='"+n+"'>",s+=this.addNotebookTitle("dl_proteinname","Please input a protein/gene name"),s+="Protein/Gene name: "+e.htmlCls.inputTextStr+"id='"+e.pre+"proteinname' value='TP53' size=8> ",s+=e.htmlCls.buttonStr+"reload_proteinname'>Search",s+="",s+=e.htmlCls.divStr+"dl_cid' class='"+n+"'>",s+=this.addNotebookTitle("dl_cid","Please input a PubChem Compound"),s+="PubChem CID/Name/InchI: "+e.htmlCls.inputTextStr+"id='"+e.pre+"cid' value='2244' size=8> ",s+=e.htmlCls.buttonStr+"reload_cid'>Load",s+="",s+=e.htmlCls.divStr+"dl_pngimage' class='"+n+"'>",s+=this.addNotebookTitle("dl_pngimage","Please input an iCn3D PNG Image file"),s+="iCn3D PNG image: "+e.htmlCls.inputFileStr+"id='"+e.pre+"pngimage'> ",s+=e.htmlCls.buttonStr+"reload_pngimage' style='margin-top: 6px;'>Load",s+="",s+=e.htmlCls.divStr+"dl_state' class='"+n+"'>",s+=this.addNotebookTitle("dl_state","Please input a state file"),s+="State file: "+e.htmlCls.inputFileStr+"id='"+e.pre+"state'> ",s+=e.htmlCls.buttonStr+"reload_state' style='margin-top: 6px;'>Load",s+="",s+=e.htmlCls.divStr+"dl_fixedversion' style='max-width:500px' class='"+n+"'>",s+=this.addNotebookTitle("dl_fixedversion","Use fixed version of iCn3D"),s+='Since January 6, 2021, you can show the original view with the archived version of iCn3D by pasting your URL below and click "Show Originial View". Note the version in the parameter "v" was used to replace "full.html" with "full_[v].html" in the URL.
',s+="Share Link URL: "+e.htmlCls.inputTextStr+"id='"+e.pre+"sharelinkurl' size=60> ",s+=e.htmlCls.buttonStr+"reload_fixedversion'>Show Original View
',s+=e.htmlCls.divStr+"dl_collection_structures' style='display: none'>",s+="",s+="",s+="",s+=e.htmlCls.divStr+"dl_menuloadpref' class='"+n+"'>",s+=this.addNotebookTitle("dl_menuloadpref","Load a preference file"),s+="Preference file: "+e.htmlCls.inputFileStr+"id='"+e.pre+"menupreffile'> ",s+=e.htmlCls.buttonStr+"reload_menupreffile' style='margin-top: 6px;'>Load",s+="",s+=e.htmlCls.divStr+"dl_dsn6' class='"+n+"' style='max-width:600px'>",s+=this.addNotebookTitle("dl_dsn6","Load a map file"),s+="Note: Always load a PDB file before loading map files. If you don't specify the threshold below, a default one will be chosen.
",s+="2fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigma2fofc' value='' size=8> σ ",s+=e.htmlCls.inputFileStr+"id='"+e.pre+"dsn6file2fofc'> "+e.htmlCls.buttonStr+"reload_ccp4file2fofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfile2fofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfile2fofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+="fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigmafofc' value='' size=8> σ ",s+=e.htmlCls.inputFileStr+"id='"+e.pre+"dsn6filefofc'> "+e.htmlCls.buttonStr+"reload_ccp4filefofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfilefofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfilefofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+=e.htmlCls.buttonStr+"elecmapNo4'>Remove Map ",s+="",s+=e.htmlCls.divStr+"dl_dsn6url' class='"+n+"' style='max-width:600px'>",s+=this.addNotebookTitle("dl_dsn6url","Load a selection file via a URL"),s+="Note: Always load a PDB file before loading map files. If you don't specify the threshold below, a default one will be chosen.
",s+="2fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigmaurl2fofc' value='' size=8> σ ",s+="URL in the same host: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6fileurl2fofc' size=20> "+e.htmlCls.buttonStr+"reload_ccp4fileurl2fofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfileurl2fofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfileurl2fofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+="fofc contour at default threshold or at: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6sigmaurlfofc' value='' size=8> σ ",s+="URL in the same host: "+e.htmlCls.inputTextStr+"id='"+e.pre+"dsn6fileurlfofc' size=20> "+e.htmlCls.buttonStr+"reload_ccp4fileurlfofc' style='margin: 6px 20px 0 0;'>Load CCP4"+e.htmlCls.buttonStr+"reload_mtzfileurlfofc' style='margin: 6px 20px 0 0;'>Load MTZ"+e.htmlCls.buttonStr+"reload_rcsbmtzfileurlfofc' style='margin-top: 6px;'>Load RCSB MTZ
",s+=e.htmlCls.buttonStr+"elecmapNo5'>Remove Map ",s+="",s+=e.htmlCls.divStr+"dl_clr' class='"+n+"'>",s+=this.addNotebookTitle("dl_clr","Pick a color"),s+="Click in the input box to use the color picker:
"+e.htmlCls.buttonStr+"hbondWindow'>Highlight Interactions in TableSort Interactions on: "+e.htmlCls.buttonStr+"sortSet1'> Set 1"+e.htmlCls.buttonStr+"sortSet2' style='margin-left:12px'>Set 2
",s+="
"+e.htmlCls.buttonStr+"hbondLineGraph'>2D Interaction Network "+e.htmlCls.buttonStr+"hbondLineGraph2' style='margin-left:12px'>2D Network with Reference Numbers to show two lines of residue nodes
",s+="
"+e.htmlCls.buttonStr+"hbondScatterplot'>2D Interaction Map "+e.htmlCls.buttonStr+"hbondScatterplot2' style='margin-left:12px'>2D Map with Reference Numbers to show map
",r=':
"+e.htmlCls.buttonStr+"hbondGraph'>2D Graph(Force-Directed) to show interactions with strength parameters in 0-200:",s+='
Helix or Sheet'+r+e.pre+'dist_ss" size="4" value="100">
',s+="
Coil or Nucleotide"+r+e.pre+'dist_coil" size="4" value="50">
(Note: you can also adjust thresholds at #1 to add/remove interactions.)
',s+="
"+e.htmlCls.buttonStr+"areaWindow'>Buried Surface Area
",s+="
5. "+e.htmlCls.buttonStr+"hbondReset'>Reset and select new sets
",s+="",s+=e.htmlCls.divStr+"dl_realign' class='"+n+"'>",s+=this.addNotebookTitle("dl_realign","Realign by sequence"),s+=e.htmlCls.divNowrapStr+"1. Select sets below or use your current selection: ",s+=" ",s+="
2. "+e.htmlCls.buttonStr+"applyRealign'>Realign by Sequence
",s+="",s+=e.htmlCls.divStr+"dl_realignbystruct' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_realignbystruct","Realign by structure"),s+="
1. Select sets below or use your current selection.
",s+=" ",s+="
2. "+e.htmlCls.buttonStr+"applyRealignByStruct_tmalign'>Realign with TM-align"+e.htmlCls.buttonStr+"applyRealignByStruct' style='margin-left:30px'>Realign with VAST
",s+="",s+=e.htmlCls.divStr+"dl_realigntwostru' class='"+n+"'>",s+=this.addNotebookTitle("dl_realigntwostru","Realign two structure complexes"),s+=e.htmlCls.divNowrapStr+"1. Select sets below or use your current selection: ",s+=" ",s+="2. Overall maximum RMSD: "+e.htmlCls.inputTextStr+"id='"+e.pre+"maxrmsd' value='30' size='2'> Å
",s+="
3. "+e.htmlCls.buttonStr+"applyRealignByStruct_vastplus'>VAST+ Alignment based on TM-align
",s+="",s+=e.htmlCls.divStr+"dl_colorspectrumacrosssets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorspectrumacrosssets","Set color spectrum across sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorSpectrumAcrossSets'>Spectrum Color for Sets
",s+="",s+=e.htmlCls.divStr+"dl_colorspectrumbysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorspectrumbysets","Set color spectrum for residues in sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorSpectrumBySets'>Spectrum Color for Residues in Sets
",s+="",s+=e.htmlCls.divStr+"dl_colorrainbowacrosssets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorrainbowacrosssets","Set color rainbow across sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorRainbowAcrossSets'>Rainbow Color for Sets
",s+="",s+=e.htmlCls.divStr+"dl_colorrainbowbysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorrainbowbysets","Set color rainbow for residues in sets"),s+=e.htmlCls.divNowrapStr+"1. Select sets below: ",s+="",s+="
2. "+e.htmlCls.buttonStr+"applyColorRainbowBySets'>Rainbow Color for Residues in Sets
",s+='',s+="",s+=e.htmlCls.divStr+"dl_elecmap2fofc' class='"+n+"'>",s+=this.addNotebookTitle("dl_elecmap2fofc","Electron Density 2F0-Fc Map"),s+="Contour at: σ"+e.htmlCls.buttonStr+"applymap2fofc'>Display"+e.htmlCls.buttonStr+"elecmapNo2'>Remove Map",s+="",s+=e.htmlCls.divStr+"dl_elecmapfofc' class='"+n+"'>",s+=this.addNotebookTitle("dl_elecmapfofc","Electron Density F0-Fc Map"),s+="Contour at: σ"+e.htmlCls.buttonStr+"applymapfofc'>Display"+e.htmlCls.buttonStr+"elecmapNo3'>Remove Map",s+="",s+=e.htmlCls.divStr+"dl_emmap' class='"+n+"'>",s+=this.addNotebookTitle("dl_emmap","EM Density Map"),s+="Contour at: % of maximum EM values "+e.htmlCls.buttonStr+"applyemmap'>Display"+e.htmlCls.buttonStr+"emmapNo2'>Remove EM Map",s+="",s+=e.htmlCls.divStr+"dl_aroundsphere' class='"+n+"'>",s+=this.addNotebookTitle("dl_aroundsphere","Select a sphere around a set of residues"),s+=e.htmlCls.divNowrapStr+"1. Select the first set:",s+=" ",s+=e.htmlCls.divNowrapStr+"2. Sphere with a radius: "+e.htmlCls.inputTextStr+"id='"+e.pre+"radius_aroundsphere' value='4' size='2'> Å ",s+=e.htmlCls.divNowrapStr+"3. Select the second set to apply the sphere:",s+=" ",s+=e.htmlCls.divNowrapStr+"4. "+e.htmlCls.buttonStr+"applypick_aroundsphere'>Display the sphere around the first set of atoms ",s+="
"+e.htmlCls.buttonStr+"sphereExport'>Save interacting/contacting residue pairs in a file
",s+="",s+=e.htmlCls.divStr+"dl_adjustmem' class='"+n+"'>",s+=this.addNotebookTitle("dl_adjustmem","Adjust membranes"),s+="Note: The membranes are parallel to the X-Y plane. The center of the membranes is at Z = 0.
",s+=e.htmlCls.divNowrapStr+"1. Extracellular membrane Z-axis position: "+e.htmlCls.inputTextStr+"id='"+e.pre+"extra_mem_z' value='' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"2. intracellular membrane Z-axis position: "+e.htmlCls.inputTextStr+"id='"+e.pre+"intra_mem_z' value='' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"3. "+e.htmlCls.buttonStr+"apply_adjustmem'>Display the adjusted membranes ",s+="",s+=e.htmlCls.divStr+"dl_selectplane' class='"+n+"'>",s+=this.addNotebookTitle("dl_selectplane","Select a plane"),s+="Note: The membranes are parallel to the X-Y plane. The center of the membranes is at Z = 0.
",s+=e.htmlCls.divNowrapStr+"1. Z-axis position of the first X-Y plane: "+e.htmlCls.inputTextStr+"id='"+e.pre+"selectplane_z1' value='15' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"2. Z-axis position of the second X-Y plane: "+e.htmlCls.inputTextStr+"id='"+e.pre+"selectplane_z2' value='-15' size='3'> Å ",s+=e.htmlCls.divNowrapStr+"3. "+e.htmlCls.buttonStr+"apply_selectplane'>Save the region between the planes to Defined Sets ",s+="",s+=e.htmlCls.divStr+"dl_addlabel' class='"+n+"'>",s+=this.addNotebookTitle("dl_addlabel","Add labels between two atoms"),s+="1. Text: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labeltext' value='Text' size=4> ",s+="2. Size: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelsize' value='18' size=4 maxlength=2> ",s+="3. Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelcolor' value='"+"#ffff00' size=4> ",e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"4. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'4. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"5. "+e.htmlCls.buttonStr+"applypick_labels'>Display",s+="",s+=e.htmlCls.divStr+"dl_addlabelselection' class='"+n+"'>",s+=this.addNotebookTitle("dl_addlabelselection","Add labels for your selection"),s+="1. Text: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labeltext2' value='Text' size=4> ",s+="2. Size: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelsize2' value='18' size=4 maxlength=2> ",s+="3. Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelcolor2' value='"+"#ffff00' size=4> ",s+=e.htmlCls.spanNowrapStr+"4. "+e.htmlCls.buttonStr+"applyselection_labels'>Display",s+="",s+=e.htmlCls.divStr+"dl_labelColor' class='"+n+"'>",s+=this.addNotebookTitle("dl_labelColor","Change label color"),s+="Color for all labels: "+e.htmlCls.inputTextStr+"id='"+e.pre+"labelcolorall' value='"+"#ffff00' size=4>
",s+=e.htmlCls.spanNowrapStr+e.htmlCls.buttonStr+"applylabelcolor'>Display",s+="",s+=e.htmlCls.divStr+"dl_distance' class='"+n+"'>",s+=this.addNotebookTitle("dl_distance","Measure distance"),e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"1. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'1. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"2. Line Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"distancecolor' value='"+"#ffff00' size=4> ",s+=e.htmlCls.spanNowrapStr+"3. "+e.htmlCls.buttonStr+"applypick_measuredistance'>Display",s+="",s+=e.htmlCls.divStr+"dl_stabilizer' class='"+n+"'>",s+=this.addNotebookTitle("dl_stabilizer","Add a stabilizer"),e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"1. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'1. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"2. Color: "+e.htmlCls.inputTextStr+"id='"+e.pre+"stabilizercolor' value='ffffff' size=4> ",s+=e.htmlCls.spanNowrapStr+"3. "+e.htmlCls.buttonStr+"applypick_stabilizer'>Add",s+="",s+=e.htmlCls.divStr+"dl_disttwosets' class='"+n+"'>",s+=this.addNotebookTitle("dl_disttwosets","Measure the distance between two sets"),s+=e.htmlCls.spanNowrapStr+"1. Select two sets ",s+="
",s+=e.htmlCls.spanNowrapStr+"3. "+e.htmlCls.buttonStr+"applydist2'>Display",s+="",s+=e.htmlCls.divStr+"dl_linebtwsets' class='"+n+"'>",s+=this.addNotebookTitle("dl_linebtwsets","Add a line between two sets"),s+=e.htmlCls.spanNowrapStr+"1. Select two sets ",s+="
",s+=e.htmlCls.divNowrapStr+"5. Opacity: ",s+=e.htmlCls.spanNowrapStr+"6. "+e.htmlCls.buttonStr+"applycartoonshape'>Display",s+=e.htmlCls.space3+e.htmlCls.spanNowrapStr+e.htmlCls.buttonStr+"clearcartoonshape'>Clear",s+="",s+=e.htmlCls.divStr+"dl_distmanysets' class='"+n+"'>",s+=this.addNotebookTitle("dl_distmanysets","Measure distances among many sets"),s+=e.htmlCls.spanNowrapStr+"1. Select sets for pairwise distances ",s+="
",s+=e.htmlCls.spanNowrapStr+"2. "+e.htmlCls.buttonStr+"applydisttable'>Distances in Table",s+="",s+=e.htmlCls.divStr+"dl_anglemanysets' class='"+n+"' style='max-width:500px'>",s+=this.addNotebookTitle("dl_anglemanysets","Measure angles among many sets"),s+=e.htmlCls.spanNowrapStr+"Note: Each set is represented by a vector, which is the X-axis of the principle axes. The angles between the vectors are then calculated.
",s+=e.htmlCls.spanNowrapStr+"1. Select sets for pairwise angles ",s+="
",s+=e.htmlCls.spanNowrapStr+"2. "+e.htmlCls.buttonStr+"applyangletable'>Angles in Table",s+="",s+=e.htmlCls.divStr+"dl_stabilizer_rm' class='"+n+"'>",s+=this.addNotebookTitle("dl_stabilizer_rm","Remove a stabilizer"),e.utilsCls.isMobile()?s+=e.htmlCls.spanNowrapStr+"1. Touch TWO atoms ":s+=e.htmlCls.spanNowrapStr+'1. Pick TWO atoms while holding "Alt" key ',s+=e.htmlCls.spanNowrapStr+"2. "+e.htmlCls.buttonStr+"applypick_stabilizer_rm'>Remove",s+="",s+=e.htmlCls.divStr+"dl_thickness' class='"+n+"'>",s+=this.addNotebookTitle("dl_thickness","Set thickness"),s+=e.htmlCls.setHtmlCls.setThicknessHtml("3dprint"),s+="",s+=e.htmlCls.divStr+"dl_thickness2' class='"+n+"'>",s+=this.addNotebookTitle("dl_thickness2","Set thickness"),s+=e.htmlCls.setHtmlCls.setThicknessHtml("style"),s+="",s+=e.htmlCls.divStr+"dl_menupref' class='"+n+"'>",s+=this.addNotebookTitle("dl_menupref","Preferences for menus"),s+="Note: The following parameters will be saved in cache. You just need to set them once.
",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"apply_menupref'>Apply",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref' style='margin-left:30px'>Reset to Simple Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref_all' style='margin-left:30px'>Reset to All Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"savepref' style='margin-left:30px'>Save Preferences
",s+="
",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"apply_menupref2'>Apply",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref2' style='margin-left:30px'>Reset to Simple Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"reset_menupref_all2' style='margin-left:30px'>Reset to All Menus",s+=e.htmlCls.spanNowrapStr+""+e.htmlCls.buttonStr+"savepref2' style='margin-left:30px'>Save Preferences",s+="",s+=e.htmlCls.divStr+"dl_addtrack' class='"+n+"'>",s+=this.addNotebookTitle("dl_addtrack","Add a track"),s+=" ",s+=e.htmlCls.divStr+"dl_addtrack_tabs' style='border:0px;'>",s+="
Note: The full protein sequences with gaps in MSA are listed one by one. The sequence of the structure is listed at the top. Each sequence has a title line starting with \">\".
",s+='Track Text (e.g., "2 G, 5-6 RR" defines a character "G" at the position 2 and two continuous characters "RR" at positions from 5 to 6. The starting position is 1): ',s+="
",s+="",s+=e.htmlCls.divStr+"dl_copyurl' style='width:520px;' class='"+n+"'>",s+=this.addNotebookTitle("dl_copyurl","Share Link"),s+=" ",s+="1. URLs Used in Browsers
",s+='Please copy one of the URLs below. They show the same result. (To add a title to share link, click "Windows > Your Note" and click "File > Share Link" again.)
',s+="Original URL with commands:
",e.cfg.notebook||(s+="Lifelong Short URL:(To replace this URL, send a pull request to update share.html at iCn3D GitHub) "+e.htmlCls.inputTextStr+"id='"+e.pre+"short_url' value='' style='width:100%'>
",s+='Lifelong Short URL + Window Title:(To update the window title, click "Analysis > Your Note/Window Title".) '+e.htmlCls.inputTextStr+"id='"+e.pre+"short_url_title' value='' style='width:100%'>
"),s+="2. Commands Used in Jupyter Noteboook
",s+="Please copy the following commands into a cell in Jupyter Notebook to show the same result. More details are at https://github.com/ncbi/icn3d/tree/master/jupyternotebook.
",s+="",s+='',s+="",s+=e.htmlCls.divStr+"dl_area' class='"+n+"'>",s+=this.addNotebookTitle("dl_area","Surface Area"),s+="Solvent Accessible Surface Area(SASA) calculated using the EDTSurf algorithm: ",s+='(0-20% out is considered "in". 50-100% out is considered "out".)
",s+="",s+="",s+=e.htmlCls.divStr+"dl_colorbyarea' class='"+n+"'>",s+=this.addNotebookTitle("dl_colorbyarea","Color by surface area"),s+="
Color each residue based on the percentage of solvent accessilbe surface area. The color ranges from blue, to white, to red for a percentage of 0, 35(variable), and 100, respectively.
"+e.htmlCls.buttonStr+"mn6_igrefTpl_apply'>Show Ig Ref. Number",s+="",s+=e.htmlCls.divStr+"dl_alignrefTpl' class='"+n+"'>",s+=this.addNotebookTitle("dl_alignrefTpl","Align with an Ig template"),s+="Choose an Ig template to align with selected residues:
"+e.htmlCls.buttonStr+"mn6_alignrefTpl_apply'>Align Template with Selection",s+="",s+="",s+="\x3c!--/form--\x3e",s}setTemplateMenu(){let e=this.icn3dui;e.icn3d;let t={IgV:["CD28_1yjdC_human_V","CD2_1hnfA_human_V-n1","CD8a_1cd8A_human_V","FAB-HEAVY_5esv_V-n1","FAB-LIGHT_5esv_V-n1","ICOS_6x4gA_human_V","LAG3_7tzgD_human_V-n1","PD1_4zqkB_human_V","PDL1_4z18B_human_V-n1","TCRa_6jxrm_human_V-n1","VISTA_6oilA_human_V","VNAR_1t6vN_shark_V"],IgC1:["B2Microglobulin_7phrL_human_C1","CD3d_6jxrd_human_C1","CD3e_6jxrf_human_C1","FAB-LIGHT_5esv_C1-n2","FAB-HEAVY_5esv_C1-n2","GHR_1axiB_human_C1-n1","LAG3_7tzgD_human_C1-n2","MHCIa_7phrH_human_C1","Siglec3_5j0bB_human_C1-n2","TCRa_6jxrm_human_C1-n2","VTCN1_Q7Z7D3_human_C1-n2"],IgC2:["CD2_1hnfA_human_C2-n2","CD3g_6jxrg_human_C2"],IgI:["BTLA_2aw2A_human_Iset","Contactin1_3s97C_human_Iset-n2","JAM1_1nbqA_human_Iset-n2","Palladin_2dm3A_human_Iset-n1","Titin_4uowM_human_Iset-n152"],IgE:["CoAtomerGamma1_1r4xA_human","Endo-1,4-BetaXylanase10A_1i8aA_bacteria_n4","IsdA_2iteA_bacteria","NaKATPaseTransporterBeta_2zxeB_spurdogshark","TP34_2o6cA_bacteria","TP47_1o75A_bacteria"],IgFN3:["Contactin1_2ee2A_human_FN3-n9","IL6Rb_1bquB_human_FN3-n2","IL6Rb_1bquB_human_FN3-n3","InsulinR_8guyE_human_FN3-n1","InsulinR_8guyE_human_FN3-n2","Sidekick2_1wf5A_human_FN3-n7"],"IgFN3-like":["ASF1A_2iijA_human","BArrestin1_4jqiA_rat_n1","C3_2qkiD_human_n1","MPT63_1lmiA_bacteria","NaCaExchanger_2fwuA_dog_n2","RBPJ_6py8C_human_Unk-n1","RBPJ_6py8C_human_Unk-n2","TEAD1_3kysC_human"],"Other Ig":["CD19_6al5A_human-n1","CuZnSuperoxideDismutase_1hl5C_human","ECadherin_4zt1A_human_n2","LaminAC_1ifrA_human","ORF7a_1xakA_virus"]},s={ASF1A_2iijA_human:"A A' B C C' E F G G+",B2Microglobulin_7phrL_human_C1:"A B C C' D E F G",BArrestin1_4jqiA_rat_n1:"A- A A' B C C' E F G",BTLA_2aw2A_human_Iset:"A A' B C C' D E F G",C3_2qkiD_human_n1:"A A' B C C' E F G","CD19_6al5A_human-n1":"A' B C C' D E F G",CD28_1yjdC_human_V:"A A' B C C' C'' D E F G","CD2_1hnfA_human_C2-n2":"A B C C' E F G","CD2_1hnfA_human_V-n1":"A' B C C' C'' D E F G",CD3d_6jxrd_human_C1:"A B C D E F G",CD3e_6jxrf_human_C1:"A B C C' D E F G",CD3g_6jxrg_human_C2:"A B C C' E F G G+",CD8a_1cd8A_human_V:"A A' B C C' C'' D E F G",CoAtomerGamma1_1r4xA_human:"A- A B C D E F G","Contactin1_2ee2A_human_FN3-n9":"A A' B C C' E F G","Contactin1_3s97C_human_Iset-n2":"A A' B C D E F G",CuZnSuperoxideDismutase_1hl5C_human:"A- A B C C' E F G",ECadherin_4zt1A_human_n2:"A' B C D E F G","Endo-1,4-BetaXylanase10A_1i8aA_bacteria_n4":"A--- A-- A- A B C C' C'' D E F G","FAB-HEAVY_5esv_C1-n2":"A B C D E F G","FAB-HEAVY_5esv_V-n1":"A B C C' C'' D E F G","FAB-LIGHT_5esv_C1-n2":"A B C C' D E F G","FAB-LIGHT_5esv_V-n1":"A A' B C C' C'' D E F G","GHR_1axiB_human_C1-n1":"A B C C' D E F G",ICOS_6x4gA_human_V:"A B C C' C'' D E F G","IL6Rb_1bquB_human_FN3-n2":"A B C C' E F G","IL6Rb_1bquB_human_FN3-n3":"A B C C' E F G","InsulinR_8guyE_human_FN3-n1":"A B C C' E F G","InsulinR_8guyE_human_FN3-n2":"A B C C' E F G",IsdA_2iteA_bacteria:"A- A B C C' D E F G","JAM1_1nbqA_human_Iset-n2":"A A' B C C' D E F G","LAG3_7tzgD_human_C1-n2":"A A' B C C' D E F G","LAG3_7tzgD_human_V-n1":"A' B C C' D E F G",LaminAC_1ifrA_human:"A- A B C C' E E+ F G",MHCIa_7phrH_human_C1:"A B C C' D E F G",MPT63_1lmiA_bacteria:"A-- A- A BC C' E F G",NaCaExchanger_2fwuA_dog_n2:"A A' B C C' E F G",NaKATPaseTransporterBeta_2zxeB_spurdogshark:"A A' B C D E F G",ORF7a_1xakA_virus:"A' B C D E F G",PD1_4zqkB_human_V:"A A' B C C' D E F G","PDL1_4z18B_human_V-n1":"A A' B C C' C'' D E F G","Palladin_2dm3A_human_Iset-n1":"A A' B C C' D E F G","RBPJ_6py8C_human_Unk-n1":"A A' B C C' E F G","RBPJ_6py8C_human_Unk-n2":"A B C D E F G","Sidekick2_1wf5A_human_FN3-n7":"A B C C' E F G","Siglec3_5j0bB_human_C1-n2":"A A' B C D E F G","TCRa_6jxrm_human_C1-n2":"A B C D E F G","TCRa_6jxrm_human_V-n1":"A A' B C C' C'' D E F G",TEAD1_3kysC_human:"A A+ A' B C C' E F G G+",TP34_2o6cA_bacteria:"A- A B C C' D E F G",TP47_1o75A_bacteria:"A B C C' D E F G","Titin_4uowM_human_Iset-n152":"A A' B C C' D E F G",VISTA_6oilA_human_V:"A A' B C C' C'' D E F G G+",VNAR_1t6vN_shark_V:"A A' B C C' D E F G","VTCN1_Q7Z7D3_human_C1-n2":"A B C C' D E F G G+"},i="";for(let n in t){i+=""}return i}getAnnoHeader(){let e=this.icn3dui;e.icn3d;let t="";t+="
"+t.htmlCls.space3+t.htmlCls.buttonStr+"command_apply"+s+"'>Save Selection to Defined Sets
",n+="
",n+="
",n+="
",n+='Specification Tips:
',n+=t.htmlCls.divStr+"specguide"+s+"' style='display:none; width:500px' class='icn3d-box'>",n+='Specification: In the selection "$1HHO,4N7N.A,B,C:5-10,LV,3AlaVal,chemicals@CA,C,C*":',n+='
"$1HHO,4N7N" uses "$" to indicate structure selection. ',n+='
".A,B,C" uses "." to indicate chain selection. ',n+='
":5-10,LV,3LeuVal,chemicals" uses the colon ":" to indicate residue selection. Residue selection could be residue number(5-10), one-letter IUPAC residue name abbreviations(LV), three-letter residue names(AlaVal, "3" indicates each residue name has three letters), or predefined names: "proteins", "nucleotides", "chemicals", "ions", and "water". IUPAC abbreviations can be written either as a contiguous string(e.g., ":LV"), in order to find all instances of that sequence in the structure, or they can be separated by commas(e.g., ":L,V") to select all residues of a given type in the structure(in the latter case, select all Leucine and Valine in the structure). ',n+='
"@CA,C,C*" uses "@" to indicate atom name selection. "C*" selects any atom names starting with "C". ',n+='
Partial definition is allowed, e.g., ":1-10" selects all residue IDs 1-10 in all chains. ',n+='
Different selections can be unioned(with "or", default), intersected(with "and"), or negated(with "not"). For example, ":1-10 or :K" selects all residues 1-10 and all Lys residues. ":1-10 and :K" selects all Lys residues in the range of residue number 1-10. ":1-10 or not :K" selects all residues 1-10, which are not Lys residues. ',n+='
The wild card character "X" or "x" can be used to represent any character.',n+="
",n+="Set Operation:",n+='
Users can select multiple sets in the menu "Select > Defined Sets". ',n+='
Different sets can be unioned(with "or", default), intersected(with "and"), or negated(with "not"). For example, if the "Defined Sets" menu has four sets ":1-10", ":11-20", ":5-15", and ":7-8", the command "saved atoms :1-10 or :11-20 and :5-15 not :7-8" unions all residues 1-10 and 11-20 to get the residues 1-20, then intersects with the residues 5-15 to get the residues 5-15, then exclude the residues 7-8 to get the final residues 5-6 and 9-15.
',n+="Full commands in url or command window:",n+="
Select without saving the set: select $1HHO,4N7N.A,B,C:5-10,LV,chemicals@CA,C,C* ",n+="
Select and save: select $1HHO,4N7N.A,B,C:5-10,LV,chemicals@CA,C,C* | name my_name
",n+="",n+="
",n+="",n}getOptionHtml(e,t){let s=this.icn3dui;s.icn3d;let i="";for(let n=0,l=e.length;n"+l+"":s.htmlCls.optionStr+"'"+l+"'>"+l+""}return i}setColorHints(){let e=this.icn3dui;e.icn3d;let t="";return t+=e.htmlCls.divNowrapStr+'Green: H-Bonds; ',t+='Cyan: Salt Bridge/Ionic; ',t+='Grey: contacts',t+=e.htmlCls.divNowrapStr+'Magenta: Halogen Bonds; ',t+='Red: π-Cation; ',t+='Blue: π-Stacking',t}setThicknessHtml(e){let t=this.icn3dui,s=t.icn3d,i="",n="3dprint"==e?"1":"0.1",l="3dprint"==e?"1.2":"0.3",r="3dprint"==e?"0.8":"0.4",o="3dprint"==e?"0.8":"0.4",a="3dprint"==e?"1":"0.4",d="3dprint"==e?"0.6":"0.3",c="3dprint"==e?"1":"0.2",h="3dprint"==e?"2":"1.3",p="3dprint"==e?"1.4":"0.8",m=40,u=.8,g=.4,f=.2,C=0,b=1,y=0;if("style"==e){if(""!=this.getCookie("shininess")&&(m=parseFloat(this.getCookie("shininess"))),""!=this.getCookie("light1")&&(u=parseFloat(this.getCookie("light1")),g=parseFloat(this.getCookie("light2")),f=parseFloat(this.getCookie("light3"))),""!=this.getCookie("lineRadius")){n=parseFloat(this.getCookie("lineRadius")),l=parseFloat(this.getCookie("coilWidth")),r=parseFloat(this.getCookie("cylinderRadius"));let e=this.getCookie("crosslinkRadius");o=isNaN(e)?s.crosslinkRadius:parseFloat(e),a=parseFloat(this.getCookie("traceRadius")),d=parseFloat(this.getCookie("dotSphereScale")),c=parseFloat(this.getCookie("ribbonthickness")),h=parseFloat(this.getCookie("helixSheetWidth")),p=parseFloat(this.getCookie("nucleicAcidWidth"))}""!=this.getCookie("glycan")&&(C=parseFloat(this.getCookie("glycan"))),""!=this.getCookie("membrane")&&(b=parseFloat(this.getCookie("membrane"))),""!=this.getCookie("cmdwindow")&&(y=parseFloat(this.getCookie("cmdwindow"))),i+="Note: The following parameters will be saved in cache. You just need to set them once.
",i+="1. Shininess: "+t.htmlCls.inputTextStr+"id='"+t.pre+"shininess' value='"+m+"' size=4>"+t.htmlCls.space3+"(for the shininess of the 3D objects, default 40)
",i+="2. Three directional lights: ",i+="Key Light: "+t.htmlCls.inputTextStr+"id='"+t.pre+"light1' value='"+u+"' size=4>"+t.htmlCls.space3+"(for the light strength of the key light, default 0.8) ",i+="Fill Light: "+t.htmlCls.inputTextStr+"id='"+t.pre+"light2' value='"+g+"' size=4>"+t.htmlCls.space3+"(for the light strength of the fill light, default 0.4) ",i+="Back Light: "+t.htmlCls.inputTextStr+"id='"+t.pre+"light3' value='"+f+"' size=4>"+t.htmlCls.space3+"(for the light strength of the back light, default 0.2)
",n+=s.htmlCls.divStr+"seqguide"+e+"' style='display:none; white-space:normal;' class='icn3d-box'>"),n+=this.getSelectionHints();return n+="Residue labeling: standard residue with coordinates: UPPER case letter; nonstandard residue with coordinates: the first UPPER case letter plus a period except that water residue uses the letter 'O'; residue missing coordinates: lower case letter."+(s.utilsCls.isMac()&&!s.utilsCls.isMobile()?"
Turn on scroll bar: System preferences -> General -> show scroll bars -> check Always":"")+" ",n}setAlignSequenceGuide(e,t){let s=this.icn3dui,i=s.icn3d,n="";let l=i&&i.defNames2Atoms?Object.keys(i.defNames2Atoms).length:1;n+='
",n+=s.htmlCls.divStr+"alignseqguide' style='display:none; white-space:normal;' class='icn3d-box'>",n+=this.getSelectionHints();return n+="Residue labeling: aligned residue with coordinates: UPPER case letter; non-aligned residue with coordinates: lower case letter which can be highlighted; residue missing coordinates: lower case letter which can NOT be highlighted."+(s.utilsCls.isMac()&&!s.utilsCls.isMobile()?"
Turn on scroll bar: System preferences -> General -> show scroll bars -> check Always":"")+" ",n}getSelectionHints(){let e=this.icn3dui;e.icn3d;let t="";if(e.utilsCls.isMobile())t+='Select Aligned Sequences: touch to select, touch again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection. ';else{t+='Select on 1D sequences: drag to select, drag again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection.
',t+="Select on 2D interaction diagram: click on the nodes or lines. The nodes are chains and can be united with the Ctrl key. The lines are interactions and can NOT be united. Each click on the lines selects half of the lines, i.e., select the interacting residues in one of the two chains.
",t+="Select on 3D structures: "+(e.utilsCls.isMobile()?"use finger to pick":'hold "Alt" and use mouse to pick')+', click the second time to deselect, hold "Ctrl" to union selection, hold "Shift" to select a range, press the up/down arrow to switch among atom/residue/strand/chain/structure, click "Save Selection" to save the current selection.
',t+='Save the current selection(either on 3D structure, 2D interactions, or 1D sequence): open the menu "Select -> Save Selection", specify the name and description for the selection, and click "Save".
";return"delphi"==e?s.cfg.cid?i+="Note: Partial charges(MMFF94) are from PubChem Compound SDF files.
":(i+="Note: Only the selected residues are used for DelPhi potential calculation by solving linear Poisson-Boltzmann equation.",i+='
',i+=s.htmlCls.divStr+t+"' style='display:none;'>",i+=" The hydrogens and partial charges of proteins and nucleotides are added using DelPhiPKa with the Amber charge and size files. The hydrogens of ligands are added using Open Babel. The partial charges of ligands are calculated using Antechamber with the Gasteiger charge method. All partial charges are calculated at pH 7.
",i+='Lipids are treated as ligands. Please use "HETATM" instead of "ATOM " for each lipid atom in your PDB file. Each phosphate in lipids is assigned with a charge of -1. You can download PQR and modify it, or prepare your PQR file using other tools. Then load the PQR file at the menu "Analysis > Load PQR/Potential".
',i+="
"):(i+="Note: Always load a PDB file before loading a PQR or DelPhi potential file.",i+='
',i+=s.htmlCls.divStr+t+"' style='display:none;'>",i+='The PDB file can be loaded in the URL with "pdbid=" or at "File > Open File". The PQR file can be prepared at the menu "Analysis > Download PQR" with your modification or using other tools. The DelPhi potential file can be calculated at DelPhi Web Server and be exported as a Cube file. ',"url"==e&&(i+="The PQR or potential file can be accessed in a URL if it is located in the same host as iCn3D."),i+="
",i+=""),i+="",i}getPotentialHtml(e,t){let s=this.icn3dui;s.icn3d;let i,n,l,r,o,a="";r="Equipotential Map",o="Surface with Potential","delphi"==e?n="delphi":"local"==e?(i="pqr",n="phi",l="cube"):"url"==e&&(i="pqrurl",n="phiurl",l="cubeurl"),a+=s.htmlCls.divStr+"dl_"+n+"' class='"+t+"'>",a+=s.htmlCls.setDialogCls.addNotebookTitle("dl_"+n,"DelPhi Potential"),a+=s.htmlCls.divStr+"dl_"+n+"_tabs' style='border:0px;'>",a+="
",d=""+s.htmlCls.buttonStr+n+"mapNo'>Remove Map",a+=s.htmlCls.divStr+n+"tab1_"+i+"2'>",a+=this.addGsizeSalt(i)+" ",a+="PQR URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+i+"file'>
"+s.htmlCls.buttonStr+"reload_"+i+"file' style='margin-top: 6px;'>Equipotential Map"+d,a+=s.htmlCls.divStr+n+"tab1_"+n+"2'>",a+="Phi URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+n+"file'>
"+s.htmlCls.buttonStr+"reload_"+n+"file' style='margin-top: 6px;'>Equipotential Map"+d,a+=s.htmlCls.divStr+n+"tab1_"+l+"2'>",a+="Cube URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+l+"file'>
"+s.htmlCls.buttonStr+"reload_"+l+"file' style='margin-top: 6px;'>Equipotential Map"+d,a+=""),a+=" "+this.getFootHtml(e,n+"tab1_foot"),a+="",a+=s.htmlCls.divStr+n+"tab2'>","delphi"==e&&(a+=this.addGsizeSalt(n+"2")+" "),a+="Surface with max potential at: kT/e(25.6mV at 298K)
",d=""+s.htmlCls.buttonStr+n+"mapNo2'>Remove Surface",a+=s.htmlCls.divStr+n+"tab2_"+i+"2'>",a+=this.addGsizeSalt(i+"2")+" ",a+="PQR URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+i+"file2'>
"+s.htmlCls.buttonStr+"reload_"+i+"file2' style='margin-top: 6px;'>Surface with Potential"+d,a+=s.htmlCls.divStr+n+"tab2_"+n+"2'>",a+="Phi URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+n+"file2'>
"+s.htmlCls.buttonStr+"reload_"+n+"file2' style='margin-top: 6px;'>Surface with Potential"+d,a+=s.htmlCls.divStr+n+"tab2_"+l+"2'>",a+="Cube URL in the same host: "+s.htmlCls.inputTextStr+"id='"+s.pre+l+"file2'>
"+s.htmlCls.buttonStr+"reload_"+l+"file2' style='margin-top: 6px;'>Surface with Potential"+d,a+=""),a+=" "+this.getFootHtml(e,n+"tab2_foot"),a+="",a+="",a+="",a}async exportPqr(e){let t=this.icn3dui,s=t.icn3d,i={},n={},l=t.hashUtilsCls.intHash(s.dAtoms,s.hAtoms);for(let e in l)s.atoms[e],s.ions.hasOwnProperty(e)?i[e]=1:n[e]=1;let r=e?"pdb":"pqr";if(t.cfg.cid){let l="",o=!e;l+=s.saveFileCls.getAtomPDB(n,o)+s.saveFileCls.getAtomPDB(i,o);let a=Object.keys(t.utilsCls.getHlStructures()).join(",");s.saveFileCls.saveFile(a+"_icn3d."+r,"text",[l])}else{if(t.utilsCls.isCalphaPhosOnly(t.hashUtilsCls.hash2Atoms(n,s.atoms)))return void alert("The potential will not be shown because the side chains are missing in the structure...");let l="",o=!0;l+=s.saveFileCls.getAtomPDB(n,void 0,void 0,void 0,void 0,void 0,o),l+=s.saveFileCls.getAtomPDB(i,!0,void 0,!0);let a=t.htmlCls.baseUrl+"delphi/delphi.cgi",d={pdb2pqr:l,pdbid:t.cfg.cid?t.cfg.cid:Object.keys(s.structures).toString()},c=await t.getAjaxPostPromise(a,d,!0,void 0,void 0,!0,"text");if(e){let e=c.split("\n"),s="";for(let i=0,n=e.length;i Save File > iCn3D PNG Image"...');else if(-1!=l){let t=e.substr(l+n.length);s.htmlCls.clickMenuCls.setLogCmd("load iCn3D PNG image "+$("#"+s.pre+"pngimage").val(),!1),window.open(t,"_self")}else if(-1!=o){let n="Start of data file======\n",l=e.indexOf(n);i.bInputfile=-1!=l,i.bInputPNGWithData=i.bInputfile;let a,d=t?t.replace(/;/g,"\n"):"";if(i.bInputfile){let t=e.indexOf("End of data file======\n"),s=e.substr(l+n.length,t-l-n.length);i.InputfileData=i.InputfileData?i.InputfileData+"\nENDMDL\n"+s:s;let c="Start of type file======\n",h=e.indexOf(c),p=e.indexOf("End of type file======\n"),m=e.substr(h+c.length,p-h-c.length-1);i.InputfileType=m;let u=e.indexOf("End of state file======\n");a=e.substr(o+r.length,u-o-r.length),a=decodeURIComponent(a+"\n"+d),"pdb"===m?(await i.pdbParserCls.loadPdbData(s),i.commands=[],i.optsHistory=[]):("mol2"===m?await i.mol2ParserCls.loadMol2Data(s):"sdf"===m?await i.sdfParserCls.loadSdfData(s):"xyz"===m?await i.xyzParserCls.loadXyzData(s):"mmcif"===m&&await i.mmcifParserCls.loadMmcifData(s),i.commands=[],i.optsHistory=[])}else{let t=e.indexOf("End of state file======\n");a=e.substr(o+r.length,t-o-r.length),a=decodeURIComponent(a+"\n"+d),i.commands=[],i.optsHistory=[]}await i.loadScriptCls.loadScript(a,!0),s.htmlCls.clickMenuCls.setLogCmd("load iCn3D PNG image "+$("#"+s.pre+"pngimage").val(),!1)}}fileSupport(){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.")}getLinkColor(){let e="";return e+=", linkmap: {\n",e+='3: {"type": "peptidebond", "c":""},\n',e+='4: {"type": "ssbond", "c":"FFA500"},\n',e+='5: {"type": "ionic", "c":"0FF"},\n',e+='6: {"type": "ionicInside", "c":"FFF"},\n',e+='11: {"type": "contact", "c":"888"},\n',e+='12: {"type": "contactInside", "c":"FFF"},\n',e+='13: {"type": "hbond", "c":"0F0"},\n',e+='14: {"type": "hbondInside", "c":"FFF"},\n',e+='15: {"type": "clbond", "c":"006400"},\n',e+='17: {"type": "halogen", "c":"F0F"},\n',e+='18: {"type": "halogenInside", "c":"FFF"},\n',e+='19: {"type": "pication", "c":"F00"},\n',e+='20: {"type": "picationInside", "c":"FFF"},\n',e+='21: {"type": "pistacking", "c":"00F"},\n',e+='22: {"type": "pistackingInside", "c":"FFF"}\n',e+="}}\n",', linkmap: {\n3: {"type": "peptidebond", "c":""},\n4: {"type": "ssbond", "c":"FFA500"},\n5: {"type": "ionic", "c":"0FF"},\n6: {"type": "ionicInside", "c":"FFF"},\n11: {"type": "contact", "c":"888"},\n12: {"type": "contactInside", "c":"FFF"},\n13: {"type": "hbond", "c":"0F0"},\n14: {"type": "hbondInside", "c":"FFF"},\n15: {"type": "clbond", "c":"006400"},\n17: {"type": "halogen", "c":"F0F"},\n18: {"type": "halogenInside", "c":"FFF"},\n19: {"type": "pication", "c":"F00"},\n20: {"type": "picationInside", "c":"FFF"},\n21: {"type": "pistacking", "c":"00F"},\n22: {"type": "pistackingInside", "c":"FFF"}\n}}\n'}setCookieForThickness(){let e=this.icn3dui,t=e.icn3d;if(!e.bNode){let e=3650;this.setCookie("lineRadius",t.lineRadius,e),this.setCookie("coilWidth",t.coilWidth,e),this.setCookie("cylinderRadius",t.cylinderRadius,e),this.setCookie("crosslinkRadius",t.crosslinkRadius,e),this.setCookie("traceRadius",t.traceRadius,e),this.setCookie("dotSphereScale",t.dotSphereScale,e),this.setCookie("ribbonthickness",t.ribbonthickness,e),this.setCookie("helixSheetWidth",t.helixSheetWidth,e),this.setCookie("nucleicAcidWidth",t.nucleicAcidWidth,e)}}setLineThickness(e,t){let s=this.icn3dui,i=s.icn3d;if(i.bSetThickness=!0,"style"==e&&(t&&($("#"+s.pre+"shininess").val("40"),$("#"+s.pre+"light1").val("0.8"),$("#"+s.pre+"light2").val("0.4"),$("#"+s.pre+"light3").val("0.2"),$("#"+s.pre+"glycan").val("0"),$("#"+s.pre+"membrane").val("1"),$("#"+s.pre+"cmdwindow").val("0")),i.shininess=parseFloat($("#"+s.pre+"shininess").val()),i.light1=parseFloat($("#"+s.pre+"light1").val()),i.light2=parseFloat($("#"+s.pre+"light2").val()),i.light3=parseFloat($("#"+s.pre+"light3").val()),i.bGlycansCartoon=parseInt($("#"+s.pre+"glycan").val()),i.bMembrane=parseInt($("#"+s.pre+"membrane").val()),i.bCmdWindow=parseInt($("#"+s.pre+"cmdwindow").val())),t&&($("#"+s.pre+"linerad_"+e).val(.1),$("#"+s.pre+"coilrad_"+e).val(.3),$("#"+s.pre+"stickrad_"+e).val(.4),$("#"+s.pre+"crosslinkrad_"+e).val(.4),$("#"+s.pre+"tracerad_"+e).val(.4),$("#"+s.pre+"ballscale_"+e).val(.3),$("#"+s.pre+"ribbonthick_"+e).val(.2),$("#"+s.pre+"prtribbonwidth_"+e).val(1.3),$("#"+s.pre+"nucleotideribbonwidth_"+e).val(.8)),i.lineRadius=parseFloat($("#"+s.pre+"linerad_"+e).val()),i.coilWidth=parseFloat($("#"+s.pre+"coilrad_"+e).val()),i.cylinderRadius=parseFloat($("#"+s.pre+"stickrad_"+e).val()),i.crosslinkRadius=parseFloat($("#"+s.pre+"crosslinkrad_"+e).val()),i.traceRadius=parseFloat($("#"+s.pre+"tracerad_"+e).val()),i.dotSphereScale=parseFloat($("#"+s.pre+"ballscale_"+e).val()),i.ribbonthickness=parseFloat($("#"+s.pre+"ribbonthick_"+e).val()),i.helixSheetWidth=parseFloat($("#"+s.pre+"prtribbonwidth_"+e).val()),i.nucleicAcidWidth=parseFloat($("#"+s.pre+"nucleotideribbonwidth_"+e).val()),!s.bNode){let e=3650;this.setCookie("shininess",i.shininess,e),this.setCookie("light1",i.light1,e),this.setCookie("light2",i.light2,e),this.setCookie("light3",i.light3,e),this.setCookie("glycan",i.bGlycansCartoon,e),this.setCookie("membrane",i.bMembrane,e),this.setCookie("cmdwindow",i.bCmdWindow,e)}if(this.setCookieForThickness(),e=t){let e="reset thickness";s.htmlCls.clickMenuCls.setLogCmd(e,!0),i.bSetThickness=!1,i.threeDPrintCls.resetAfter3Dprint()}else s.htmlCls.clickMenuCls.setLogCmd("set thickness | linerad "+i.lineRadius+" | coilrad "+i.coilWidth+" | stickrad "+i.cylinderRadius+" | crosslinkrad "+i.crosslinkRadius+" | tracerad "+i.traceRadius+" | ribbonthick "+i.ribbonthickness+" | proteinwidth "+i.helixSheetWidth+" | nucleotidewidth "+i.nucleicAcidWidth+" | ballscale "+i.dotSphereScale,!0),s.htmlCls.clickMenuCls.setLogCmd("set glycan "+i.bGlycansCartoon,!0),s.htmlCls.clickMenuCls.setLogCmd("set membrane "+i.bMembrane,!0),s.htmlCls.clickMenuCls.setLogCmd("set cmdwindow "+i.bCmdWindow,!0);i.drawCls.draw()}setCookie(e,t,s){let i=new Date;i.setTime(i.getTime()+24*s*60*60*1e3);let n="expires="+i.toUTCString();document.cookie=e+"="+t+";"+n+";path=/"}updateSurfPara(e){let t=this.icn3dui,s=t.icn3d;s.phisurftype=$("#"+t.pre+e+"surftype").val(),s.phisurfop=$("#"+t.pre+e+"surfop").val(),s.phisurfwf=$("#"+t.pre+e+"surfwf").val()}exportPdb(){let e=this.icn3dui,t=e.icn3d,s="",i=e.hashUtilsCls.intHash(t.dAtoms,t.hAtoms);if(s+=t.saveFileCls.getAtomPDB(i),!e.bNode){let i=Object.keys(e.utilsCls.getHlStructures()).join(",");t.saveFileCls.saveFile(i+"_icn3d.pdb","text",[s])}return s}exportSecondary(){let e=this.icn3dui,t=e.icn3d,s="",i=e.hashUtilsCls.intHash(t.dAtoms,t.hAtoms);if(s+=t.saveFileCls.getSecondary(i),!e.bNode){let i=Object.keys(e.utilsCls.getHlStructures()).join(",");t.saveFileCls.saveFile(i+"_icn3d_ss.txt","text",[s])}return s}}class g{constructor(e){let t=e;this.icn3dui=e,this.cfg=this.icn3dui.cfg,this.opts={},this.opts.background="black",this.allMenus={},this.allMenusSel={},this.simpleMenus={},this.shownMenus={},this.WIDTH=400,this.HEIGHT=400,this.RESIDUE_WIDTH=10,t.utilsCls.isMobile()||this.cfg.mobilemenu?this.MENU_HEIGHT=0:this.MENU_HEIGHT=40,this.LOG_HEIGHT=65,this.MENU_WIDTH=750,this.LESSWIDTH=20,this.LESSWIDTH_RESIZE=20,this.LESSHEIGHT=20,this.width2d=200,this.CMD_HEIGHT=.8*this.LOG_HEIGHT,this.EXTRAHEIGHT=this.MENU_HEIGHT+this.CMD_HEIGHT,null!=this.cfg.showmenu&&0==this.cfg.showmenu&&(this.EXTRAHEIGHT-=this.MENU_HEIGHT),null!=this.cfg.showcommand&&0==this.cfg.showcommand&&(this.EXTRAHEIGHT-=this.CMD_HEIGHT),this.GREY8="#AAAAAA",this.GREYB="#CCCCCC",this.GREYC="#DDDDDD",this.GREYD="#EEEEEE",this.ORANGE="#FFA500",this.themecolor="blue",this.defaultValue=1,this.ssValue=3,this.coilValue=3,this.contactValue=11,this.contactInsideValue=12,this.hbondValue=13,this.hbondInsideValue=14,this.ssbondValue=4,this.ionicValue=5,this.ionicInsideValue=6,this.clbondValue=15,this.halogenValue=17,this.halogenInsideValue=18,this.picationValue=19,this.picationInsideValue=20,this.pistackingValue=21,this.pistackingInsideValue=22,this.contactColor="888",this.contactInsideColor="FFF",this.hbondColor="0F0",this.hbondInsideColor="FFF",this.ssbondColor="FFA500",this.ionicColor="0FF",this.ionicInsideColor="FFF",this.clbondColor="006400",this.halogenColor="F0F",this.halogenInsideColor="FFF",this.picationColor="F00",this.picationInsideColor="FFF",this.pistackingColor="00F",this.pistackingInsideColor="FFF",this.hideedges=1,this.force=4,this.simulation=void 0,this.baseUrl=window&&window.location&&"structure.ncbi.nlm.nih.gov"==window.location.hostname?"https://structure.ncbi.nlm.nih.gov/Structure/":"https://www.ncbi.nlm.nih.gov/Structure/",this.tmalignUrl=this.baseUrl+"tmalign/tmalign.cgi",this.divStr="
",this.spanNowrapStr="",this.inputTextStr="=2.0 are supported.")));const a=new pe(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===r[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}a.setExtensions(l),a.setPlugins(r),a.parse(s,i)}parseAsync(e,t){const s=this;return new Promise((function(i,n){s.parse(e,t,i,n)}))}}function C(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const b={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class y{constructor(e){this.parser=e,this.name=b.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,i=t.length;s=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,l)}}class R{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,i=s.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const l=n.extensions[t],r=i.images[l.source];let o=s.textureLoader;if(r.uri){const e=s.options.manager.getHandler(r.uri);null!==e&&(o=e)}return this.detectSupport().then((function(n){if(n)return s.loadTextureImage(e,l.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class I{constructor(e){this.name=b.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,n.ready]).then((function(t){const s=e.byteOffset||0,i=e.byteLength||0,l=e.count,r=e.byteStride,o=new ArrayBuffer(l*r),a=new Uint8Array(t[0],s,i);return n.decodeGltfBuffer(new Uint8Array(o),l,r,a,e.mode,e.filter),o}))}return null}}const E="glTF",T=1313821514,P=5130562;class D{constructor(e){this.name=b.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:THREE.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==E)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,i=new DataView(e,12);let n=0;for(;n",t).replace("#include ",s).replace("#include ",i).replace("#include ",n).replace("#include ",l)},Object.defineProperties(this,{specular:{get:function(){return r.specular.value},set:function(e){r.specular.value=e}},specularMap:{get:function(){return r.specularMap.value},set:function(e){r.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return r.glossiness.value},set:function(e){r.glossiness.value=e}},glossinessMap:{get:function(){return r.glossinessMap.value},set:function(e){r.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class L{constructor(){this.name=b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return H}extendParams(e,t,s){const i=t.extensions[this.name];e.color=new Color(1,1,1),e.opacity=1;const n=[];if(Array.isArray(i.diffuseFactor)){const t=i.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(void 0!==i.diffuseTexture&&n.push(s.assignTexture(e,"map",i.diffuseTexture,sRGBEncoding)),e.emissive=new Color(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Color(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){const t=i.specularGlossinessTexture;n.push(s.assignTexture(e,"glossinessMap",t)),n.push(s.assignTexture(e,"specularMap",t,sRGBEncoding))}return Promise.all(n)}createMaterial(e){const t=new H(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t}}class N{constructor(){this.name=b.KHR_MESH_QUANTIZATION}}class q extends THREE.Interpolant{constructor(e,t,s,i){super(e,t,s,i)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let e=0;e!==i;e++)t[e]=s[n+e];return t}}q.prototype.beforeStart_=q.prototype.copySampleValue_,q.prototype.afterEnd_=q.prototype.copySampleValue_,q.prototype.interpolate_=function(e,t,s,i){const n=this.resultBuffer,l=this.sampleValues,r=this.valueSize,o=2*r,a=3*r,d=i-t,c=(s-t)/d,h=c*c,p=h*c,m=e*a,u=m-a,g=-2*p+3*h,f=p-h,C=1-g,b=f-h+c;for(let e=0;e!==r;e++){const t=l[u+e+r],s=l[u+e+o]*d,i=l[m+e+r],a=l[m+e]*d;n[e]=C*t+b*s+g*i+f*a}return n};const U=new THREE.Quaternion;class B extends q{interpolate_(e,t,s,i){const n=super.interpolate_(e,t,s,i);return U.fromArray(n).normalize().toArray(n),n}}const j=0,z=1,G=2,V=3,W=4,Y=5,X=6,K={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},J={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipmapNearestFilter,9985:THREE.LinearMipmapNearestFilter,9986:THREE.NearestMipmapLinearFilter,9987:THREE.LinearMipmapLinearFilter},Z={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},Q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ee={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},te={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},se={CUBICSPLINE:void 0,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},ie="OPAQUE",ne="MASK",le="BLEND";function re(e,t,s){for(const i in s.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=s.extensions[i])}function oe(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ae(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,i=t.weights.length;s{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,i]of e.children.entries())n(i,t.children[s])};return n(s,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s=2&&m.setY(t,c[e*l+1]),l>=3&&m.setZ(t,c[e*l+2]),l>=4&&m.setW(t,c[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m}))}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,n=t.images[i];let l=this.textureLoader;if(n.uri){const e=s.manager.getHandler(n.uri);null!==e&&(l=e)}return this.loadTextureImage(e,i,l)}loadTextureImage(e,t,s){const i=this,n=this.json,l=n.textures[e],r=n.images[t],o=(r.uri||r.bufferView)+":"+l.sampler;if(this.textureCache[o])return this.textureCache[o];const a=this.loadImageSource(t,s).then((function(t){t.flipY=!1,l.name&&(t.name=l.name);const s=(n.samplers||{})[l.sampler]||{};return t.magFilter=J[s.magFilter]||LinearFilter,t.minFilter=J[s.minFilter]||LinearMipmapLinearFilter,t.wrapS=Z[s.wrapS]||RepeatWrapping,t.wrapT=Z[s.wrapT]||RepeatWrapping,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[o]=a,a}loadImageSource(e,t){const s=this,i=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=i.images[e],r=self.URL||self.webkitURL;let o=l.uri||"",a=!1;if(void 0!==l.bufferView)o=s.getDependency("bufferView",l.bufferView).then((function(e){a=!0;const t=new Blob([e],{type:l.mimeType});return o=r.createObjectURL(t),o}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(o).then((function(e){return new Promise((function(s,i){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,s(t)}),t.load(THREE.LoaderUtils.resolveURL(e,n.path),l,void 0,i)}))})).then((function(e){var t;return!0===a&&r.revokeObjectURL(o),e.userData.mimeType=l.mimeType||((t=l.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=d,d}assignTexture(e,t,s,i){const n=this;return this.getDependency("texture",s.index).then((function(l){if(void 0===s.texCoord||0==s.texCoord||"aoMap"===t&&1==s.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+s.texCoord+" for texture "+t+" not yet supported."),n.extensions[b.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[b.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=n.associations.get(l);l=n.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),n.associations.set(l,t)}}return void 0!==i&&(l.encoding=i),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const i=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,s),t.color.copy(s.color),this.cache.add(e,t)),s=t}if(i||n||l){let e="ClonedMaterial:"+s.uuid+":";s.isGLTFSpecularGlossinessMaterial&&(e+="specular-glossiness:"),i&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),n&&(t.vertexColors=!0),l&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}s.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=s}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,i=this.extensions,n=s.materials[e];let l;const r={},o=n.extensions||{},a=[];if(o[b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const e=i[b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];l=e.getMaterialType(),a.push(e.extendParams(r,n,t))}else if(o[b.KHR_MATERIALS_UNLIT]){const e=i[b.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),a.push(e.extendParams(r,n,t))}else{const s=n.pbrMetallicRoughness||{};if(r.color=new Color(1,1,1),r.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;r.color.fromArray(e),r.opacity=e[3]}void 0!==s.baseColorTexture&&a.push(t.assignTexture(r,"map",s.baseColorTexture,sRGBEncoding)),r.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,r.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(a.push(t.assignTexture(r,"metalnessMap",s.metallicRoughnessTexture)),a.push(t.assignTexture(r,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),a.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,r)}))))}!0===n.doubleSided&&(r.side=DoubleSide);const d=n.alphaMode||ie;if(d===le?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,d===ne&&(r.alphaTest=void 0!==n.alphaCutoff?n.alphaCutoff:.5)),void 0!==n.normalTexture&&l!==MeshBasicMaterial&&(a.push(t.assignTexture(r,"normalMap",n.normalTexture)),r.normalScale=new Vector2(1,1),void 0!==n.normalTexture.scale)){const e=n.normalTexture.scale;r.normalScale.set(e,e)}return void 0!==n.occlusionTexture&&l!==MeshBasicMaterial&&(a.push(t.assignTexture(r,"aoMap",n.occlusionTexture)),void 0!==n.occlusionTexture.strength&&(r.aoMapIntensity=n.occlusionTexture.strength)),void 0!==n.emissiveFactor&&l!==MeshBasicMaterial&&(r.emissive=(new Color).fromArray(n.emissiveFactor)),void 0!==n.emissiveTexture&&l!==MeshBasicMaterial&&a.push(t.assignTexture(r,"emissiveMap",n.emissiveTexture,sRGBEncoding)),Promise.all(a).then((function(){let s;return s=l===H?i[b.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(r):new l(r),n.name&&(s.name=n.name),oe(s,n),t.associations.set(s,{materials:e}),n.extensions&&re(i,s,n),s}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");let s=t;for(let e=1;this.nodeNamesUsed[s];++e)s=t+"_"+e;return this.nodeNamesUsed[s]=!0,s}loadGeometries(e){const t=this,s=this.extensions,i=this.primitiveCache;function n(e){return s[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(s){return ue(s,e,t)}))}const l=[];for(let s=0,r=e.length;s0&&ae(h,n),h.name=t.createUniqueName(n.name||"mesh_"+e),oe(h,n),c.extensions&&re(i,h,c),t.assignFinalMaterial(h),a.push(h)}for(let s=0,i=a.length;s1?new Group:1===t.length?t[0]:new Object3D,r!==t[0])for(let e=0,s=t.length;e{const t=new Map;for(const[e,s]of n.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,s);return e.traverse((e=>{const s=n.associations.get(e);null!=s&&t.set(e,s)})),t})(l),l}))}}function me(e,t,s,i){const n=s.nodes[e];return i.getDependency("node",e).then((function(e){if(void 0===n.skin)return e;let t;return i.getDependency("skin",n.skin).then((function(e){t=e;const s=[];for(let e=0,n=t.joints.length;e{const s=n[e];return s&&(l={profileId:e,profilePath:`${t}/${s.path}`,deprecated:!!s.deprecated}),!!l})),!l){if(!s)throw new Error("No matching profile name found");const e=n[s];if(!e)throw new Error(`No matching profile name found and default profile "${s}" missing.`);l={profileId:s,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}const r=await Ce(l.profilePath);let o;if(i){let t;if(t="any"===e.handedness?r.layouts[Object.keys(r.layouts)[0]]:r.layouts[e.handedness],!t)throw new Error(`No matching handedness, ${e.handedness}, in profile ${l.profileId}`);t.assetPath&&(o=l.profilePath.replace("profile.json",t.assetPath))}return{profile:r,assetPath:o}}const ye={xAxis:0,yAxis:0,button:0,state:fe.ComponentState.DEFAULT};class ve{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===fe.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(ye)}updateFromComponent({xAxis:e,yAxis:t,button:s,state:i}){const{normalizedXAxis:n,normalizedYAxis:l}=function(e=0,t=0){let s=e,i=t;if(Math.sqrt(e*e+t*t)>1){const n=Math.atan2(t,e);s=Math.cos(n),i=Math.sin(n)}return{normalizedXAxis:.5*s+.5,normalizedYAxis:.5*i+.5}}(e,t);switch(this.componentProperty){case fe.ComponentProperty.X_AXIS:this.value=this.states.includes(i)?n:.5;break;case fe.ComponentProperty.Y_AXIS:this.value=this.states.includes(i)?l:.5;break;case fe.ComponentProperty.BUTTON:this.value=this.states.includes(i)?s:0;break;case fe.ComponentProperty.STATE:this.valueNodeProperty===fe.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(i):this.value=this.states.includes(i)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class _e{constructor(e,t){if(!(e&&t&&t.visualResponses&&t.gamepadIndices&&0!==Object.keys(t.gamepadIndices).length))throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach((e=>{const s=new ve(t.visualResponses[e]);this.visualResponses[e]=s})),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:fe.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=fe.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||1===this.values.button?this.values.state=fe.ComponentState.PRESSED:(t.touched||this.values.button>fe.ButtonTouchThreshold)&&(this.values.state=fe.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===fe.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>fe.AxisTouchThreshold&&(this.values.state=fe.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===fe.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>fe.AxisTouchThreshold&&(this.values.state=fe.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((e=>{e.updateFromComponent(this.values)}))}}class we{constructor(e,t,s){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=s,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach((e=>{const t=this.layoutDescription.components[e];this.components[e]=new _e(e,t)})),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach((t=>{e.push(t.data)})),e}updateFromGamepad(){Object.values(this.components).forEach((e=>{e.updateFromGamepad(this.xrInputSource.gamepad)}))}}class Se extends THREE.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e||(this.envMap=e,this.traverse((e=>{e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}))),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach((e=>{Object.values(e.visualResponses).forEach((e=>{const{valueNode:t,minNode:s,maxNode:i,value:n,valueNodeProperty:l}=e;t&&(l===fe.VisualResponseProperty.VISIBILITY?t.visible=n:l===fe.VisualResponseProperty.TRANSFORM&&(t.quaternion.slerpQuaternions(s.quaternion,i.quaternion,n),t.position.lerpVectors(s.position,i.position,n)))}))})))}}function Ae(e,t){!function(e,t){Object.values(e.components).forEach((e=>{const{type:s,touchPointNodeName:i,visualResponses:n}=e;if(s===fe.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(i),e.touchPointNode){const t=new SphereGeometry(.001),s=new MeshBasicMaterial({color:255}),i=new Mesh(t,s);e.touchPointNode.add(i)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(n).forEach((e=>{const{valueNodeName:s,minNodeName:i,maxNodeName:n,valueNodeProperty:l}=e;if(l===fe.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(i),e.maxNode=t.getObjectByName(n),!e.minNode)return void console.warn(`Could not find ${i} in the model`);if(!e.maxNode)return void console.warn(`Could not find ${n} in the model`)}e.valueNode=t.getObjectByName(s),e.valueNode||console.warn(`Could not find ${s} in the model`)}))}))}(e.motionController,t),e.envMap&&t.traverse((t=>{t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)})),e.add(t)}class xe{constructor(e=null){this.gltfLoader=e,this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",this._assetCache={},this.gltfLoader||(this.gltfLoader=new f)}createControllerModel(e){const t=new Se;let s=null;return e.addEventListener("connected",(e=>{const i=e.data;"tracked-pointer"===i.targetRayMode&&i.gamepad&&be(i,this.path,"generic-trigger").then((({profile:e,assetPath:n})=>{t.motionController=new we(i,e,n);const l=this._assetCache[t.motionController.assetUrl];if(l)s=l.scene.clone(),Ae(t,s);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,(e=>{this._assetCache[t.motionController.assetUrl]=e,s=e.scene.clone(),Ae(t,s)}),null,(()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)}))}})).catch((e=>{console.warn(e)}))})),e.addEventListener("disconnected",(()=>{t.motionController=null,t.remove(s),s=null})),t}}class ke extends THREE.EventDispatcher{constructor(e){if(super(),void 0===e)return void console.error("ControllerGestures must be passed a renderer");const t=new THREE.Clock;this.controller1=e.xr.getController(0),this.controller1.userData.gestures={index:0},this.controller1.userData.selectPressed=!1,this.controller1.addEventListener("selectstart",i),this.controller1.addEventListener("selectend",n),this.controller2=e.xr.getController(1),this.controller2.userData.gestures={index:1},this.controller2.userData.selectPressed=!1,this.controller2.addEventListener("selectstart",i),this.controller2.addEventListener("selectend",n),this.doubleClickLimit=.2,this.pressMinimum=.4,this.right=new THREE.Vector3(1,0,0),this.up=new THREE.Vector3(0,1,0),this.type="unknown",this.prevTap="none",this.clock=t;const s=this;function i(){const e=this.userData.gestures;e.startPosition=void 0,e.startTime=t.getElapsedTime(),-1==s.type.indexOf("tap")&&(e.taps=0),s.type="unknown",this.userData.selectPressed=!0}function n(){const e=this.userData.gestures;e.endTime=t.getElapsedTime();e.endTime-e.startTime.05&&(e.startPosition=this.controller1.position.clone())),this.controller2.userData.selectPressed&&void 0===t.startPosition&&(i=s-t.startTime,i>.05&&(t.startPosition=this.controller2.position.clone())),!this.controller1.userData.selectPressed&&"tap"===this.type&&(i=this.clock.getElapsedTime()-e.endTime,i>this.doubleClickLimit)){switch(e.taps){case 1:self.prevTap="tap";break;case 2:this.dispatchEvent({type:"doubletap",position:this.controller1.position,matrixWorld:this.controller1.matrixWorld}),self.prevTap="doubletap"}this.type="unknown",e.taps=0}if("unknown"===this.type&&this.touch)"doubletap"==self.prevTap?(this.type="pinch",this.startDistance=this.controller1.position.distanceTo(this.controller2.position),this.dispatchEvent({type:"pinch",delta:new THREE.Vector3(0,0,0),scale:1,initialise:!0})):(this.type="pan",this.startPosition=this.controller1.position.clone(),this.dispatchEvent({type:"pan",delta:new THREE.Vector3(0,0,0),initialise:!0}));else if(("pinch"===this.type||"pan"===this.type)&&"doubletap"==self.prevTap&&this.controller2.position){const e=this.controller1.position.distanceTo(this.controller2.position)/this.startDistance,t=this.controller1.position.clone().sub(this.startPosition);this.dispatchEvent({type:"pinch",delta:t,scale:e})}}}class Oe{constructor(e,t){this.config=void 0===t?{panelSize:{width:1,height:1},width:512,height:512,opacity:.7,body:{fontFamily:"Arial",fontSize:30,padding:2,backgroundColor:"#000",fontColor:"#fff",borderRadius:6}}:t,void 0===this.config.width&&(this.config.width=512),void 0===this.config.height&&(this.config.height=512),void 0===this.config.body&&(this.config.body={fontFamily:"Arial",size:30,padding:2,backgroundColor:"#000",fontColor:"#fff",borderRadius:6});const s=this.config.body;void 0===s.borderRadius&&(s.borderRadius=6),void 0===s.fontFamily&&(s.fontFamily="Arial"),void 0===s.padding&&(s.padding=2),void 0===s.fontSize&&(s.fontSize=30),void 0===s.backgroundColor&&(s.backgroundColor="#000"),void 0===s.fontColor&&(s.fontColor="#fff"),Object.entries(this.config).forEach((([e,t])=>{if(!("object"!=typeof t||"panelSize"===e||t instanceof THREE.WebGLRenderer||t instanceof THREE.Scene)){const e=void 0!==t.position?t.position:{x:0,y:0};void 0!==e.left&&void 0===e.x&&(e.x=e.left),void 0!==e.top&&void 0===e.y&&(e.y=e.top);const s=void 0!==t.width?t.width:this.config.width,i=void 0!==t.height?t.height:this.config.height;void 0!==e.right&&void 0===e.x&&(e.x=this.config.width-e.right-s),void 0!==e.bottom&&void 0===e.y&&(e.y=this.config.height-e.bottom-i),void 0===e.x&&(e.x=0),void 0===e.y&&(e.y=0),t.position=e,void 0===t.type&&(t.type="text")}}));const i=this.createOffscreenCanvas(this.config.width,this.config.height);this.context=i.getContext("2d"),this.context.save();const n=void 0!==this.config.opacity?this.config.opacity:.7,l=new THREE.MeshBasicMaterial({transparent:!0,opacity:n});this.panelSize=void 0!==this.config.panelSize?this.config.panelSize:{width:1,height:1};const r=new THREE.PlaneGeometry(this.panelSize.width,this.panelSize.height);this.mesh=new THREE.Mesh(r,l),this.texture=new THREE.CanvasTexture(i),this.mesh.material.map=this.texture,this.scene=this.config.scene;if(Object.values(this.config).filter((e=>"input-text"===e.type)).length>0){this.keyboard=new Re(this.panelSize.width,this.config.renderer);this.keyboard.mesh.position.set(0,-.3,.2),this.mesh.add(this.keyboard.mesh)}if(void 0===e)this.content={body:""},this.config.body.type="text";else{this.content=e;Object.values(t).filter((e=>"button"===e.type||"scroll"===e.overflow||"input-text"===e.type)).length>0&&(void 0===t||void 0===t.renderer?console.warn("CanvasUI: button, scroll or input-text in the config but no renderer"):(this.renderer=t.renderer,this.initControllers()))}this.selectedElements=[void 0,void 0],this.selectPressed=[!1,!1],this.scrollData=[void 0,void 0],this.intersects=[void 0,void 0],this.needsUpdate=!0,this.update()}getIntersectY(e){const t=this.config.height||512,s=this.intersects[e];return void 0===s||void 0===s.uv?0:(1-s.uv.y)*t}initControllers(){this.vec3=new THREE.Vector3,this.mat4=new THREE.Matrix4,this.raycaster=new THREE.Raycaster;const e=this;function t(t){const s=t.target===e.controller?0:1,i=e.selectedElements[s];if(void 0!==i)if("button"==i.type)e.select(s);else if("input-text"==i.type&&e.keyboard)if(e.keyboard.visible)e.keyboard.linkedUI=void 0,e.keyboard.linkedText=void 0,e.keyboard.linkedElement=void 0,e.keyboard.visible=!1;else{let t;e.keyboard.linkedUI=e,Object.entries(e.config).forEach((([e,s])=>{s==i&&(t=e)}));const s=(.5-(i.position.y+i.height+e.config.body.padding)/e.config.height)*e.panelSize.height,n=Math.max(e.panelSize.width,e.panelSize.height)/2;e.keyboard.position.set(0,-n/1.5-s,.1),e.keyboard.linkedText=e.content[t],e.keyboard.linkedName=t,e.keyboard.linkedElement=i,e.keyboard.visible=!0}}function s(t){const s=t.target===e.controller?0:1;if(e.selectPressed[s]=!0,void 0!==e.selectedElements[s]&&"scroll"==e.selectedElements[s].overflow){const t=e.selectedElements[s];e.scrollData[s]={scrollY:t.scrollY,rayY:e.getIntersectY(s)}}}function i(t){const s=t.target===e.controller?0:1;e.selectPressed[s]=!1,void 0!==e.selectedElements[s]&&"scroll"==e.selectedElements[s].overflow&&(e.scrollData[s]=void 0)}if(this.controller=this.renderer.xr.getController(0),this.controller.addEventListener("select",t),this.controller.addEventListener("selectstart",s),this.controller.addEventListener("selectend",i),this.controller1=this.renderer.xr.getController(1),this.controller1.addEventListener("select",t),this.controller1.addEventListener("selectstart",s),this.controller1.addEventListener("selectend",i),this.scene){const e=.015,t=new THREE.IcosahedronBufferGeometry(e),s=new THREE.MeshBasicMaterial({color:170}),i=new THREE.Mesh(t,s);i.visible=!1,this.scene.add(i);const n=new THREE.Mesh(t,s);n.visible=!1,this.scene.add(n),this.intersectMesh=[i,n]}}setClip(e){const t=this.context;if(t.restore(),t.save(),void 0!==e.clipPath){const s=new Path2D(e.clipPath);t.clip(s)}else{const s=void 0!==e.position?e.position:{x:0,y:0},i=e.borderRadius||0,n=e.width||this.config.width,l=e.height||this.config.height;if(t.beginPath(),0!==i){const e=Math.PI/2;t.moveTo(s.x+i,s.y),t.arc(s.x+i,s.y+i,i,e,2*e,!0),t.lineTo(s.x,s.y+l-i),t.arc(s.x+i,s.y+l-i,i,0,e,!0),t.lineTo(s.x+n-i,s.y+l),t.arc(s.x+n-i,s.y+l-i,i,3*e,4*e,!0),t.lineTo(s.x+n,s.y+i),t.arc(s.x+n-i,s.y+i,i,2*e,3*e,!0),t.closePath(),t.clip()}else t.rect(s.x,s.y,n,l),t.clip()}}setPosition(e,t,s){void 0!==this.mesh&&this.mesh.position.set(e,t,s)}setRotation(e,t,s){void 0!==this.mesh&&this.mesh.rotation.set(e,t,s)}updateElement(e,t){let s=this.content[e];void 0!==s?("object"==typeof s?s.content=t:s=t,this.content[e]=s,this.needsUpdate=!0):console.warn(`CanvasGUI.updateElement: No ${e} found`)}get panel(){return this.mesh}getElementAtLocation(e,t){const s=this,i=Object.entries(this.config).filter((([i,n])=>{if(!("object"!=typeof n||"panelSize"===i||"body"===i||n instanceof THREE.WebGLRenderer||n instanceof THREE.Scene)){const i=n.position,l=void 0!==n.width?n.width:s.config.width,r=void 0!==n.height?n.height:s.config.height;return e>=i.x&&e=i.y&&t0?(this.hover(t,s[0].uv),this.intersects[t]=s[0],this.scroll(t)):(this.hover(t),this.intersects[t]=void 0,this.scroll(t))}update(){if(void 0===this.mesh)return;if(this.controller&&this.handleController(this.controller,0),this.controller1&&this.handleController(this.controller1,1),this.keyboard&&this.keyboard.visible&&this.keyboard.update(),!this.needsUpdate)return;let e=this.context;e.clearRect(0,0,this.config.width,this.config.height);const t=this.config.body.backgroundColor?this.config.body.backgroundColor:"#000";!this.config.body.fontFamily||this.config.body.fontFamily;const s=this.config.body.fontColor?this.config.body.fontColor:"#fff";!this.config.body.fontSize||this.config.body.fontSize,this.setClip(this.config.body),e.fillStyle=t,e.fillRect(0,0,this.config.width,this.config.height);const i=this;Object.entries(this.content).forEach((([t,n])=>{const l=void 0!==i.config[t]?i.config[t]:i.config.body;if("none"!==(void 0!==l.display?l.display:"block")){const r=void 0!==l.position?l.position:{x:0,y:0},o=void 0!==l.width?l.width:i.config.width,a=void 0!==l.height?l.height:i.config.height;"button"!=l.type||n.toLowerCase().startsWith("")||(void 0===l.borderRadius&&(l.borderRadius=6),void 0===l.textAlign&&(l.textAlign="center")),i.setClip(l);const d=n.toLowerCase().startsWith(""),c=void 0!==i.selectedElements[0]&&this.selectedElements[0]===l||void 0!==i.selectedElements[1]&&this.selectedElements[1]===l;if(void 0!==l.backgroundColor&&(c&&"button"==l.type&&void 0!==l.hover?e.fillStyle=l.hover:e.fillStyle=l.backgroundColor,e.fillRect(r.x,r.y,o,a)),"text"==l.type||"button"==l.type||"input-text"==l.type){let h=!1;if(c?(d||"button"!=l.type?e.fillStyle=void 0!==l.hover?l.hover:void 0!==l.fontColor?l.fontColor:s:e.fillStyle=void 0!==l.fontColor?l.fontColor:s,h=void 0===l.hover):e.fillStyle=void 0!==l.fontColor?l.fontColor:s,d){const t=n.toUpperCase().substring(6,n.length-7);e.save(),e.translate(r.x,r.y);const s=new Path2D(t);e.fill(s),e.restore()}else i.wrapText(t,n);h&&(e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2,e.rect(r.x,r.y,o,a),e.stroke())}else if("img"==l.type)if(void 0===l.img)this.loadImage(n).then((e=>{console.log(`w: ${e.width} | h: ${e.height}`),l.img=e,i.needsUpdate=!0,i.update()})).catch((e=>console.error(e)));else{const t=o/(l.img.width/l.img.height);e.drawImage(l.img,r.x,r.y,o,t)}}})),this.needsUpdate=!1,this.texture.needsUpdate=!0}loadImage(e){return new Promise(((t,s)=>{const i=new THREE.Image;i.addEventListener("load",(()=>t(i))),i.addEventListener("error",(e=>s(e))),i.src=e}))}createOffscreenCanvas(e,t){const s=document.createElement("canvas");return s.width=e,s.height=t,s}fillRoundedRect(e,t,s,i,n){const l=this.context;l.beginPath(),l.moveTo(e+n,t),l.lineTo(e+s-n,t),l.quadraticCurveTo(e+s,t,e+s,t+n),l.lineTo(e+s,t+i-n),l.quadraticCurveTo(e+s,t+i,e+s-n,t+i),l.lineTo(e+n,t+i),l.quadraticCurveTo(e,t+i,e,t+i-n),l.lineTo(e,t+n),l.quadraticCurveTo(e,t,e+n,t),l.closePath(),l.fill()}lookAt(e){void 0!==this.mesh&&(e instanceof Vector3?this.mesh.lookAt(e):console.error("CanvasUI lookAt called parameter not a THREE.Vector3"))}get visible(){return void 0!==this.mesh&&this.mesh.visible}set visible(e){this.mesh&&(this.mesh.visible=e)}get position(){if(void 0!==this.mesh)return this.mesh.position}set position(e){void 0!==this.mesh&&(e instanceof Vector3?this.mesh.position.copy(e):console.error("CanvasUI trying to set the mesh position using a parameter that is not a THREE.Vector3"))}get quaternion(){if(void 0!==this.mesh)return this.mesh.quaternion}set quaternion(e){void 0!==this.mesh&&(e instanceof QUaternion?this.mesh.quaternion.copy(e):console.error("CanvasUI trying to set the mesh quaternion using a parameter that is not a THREE.Quaternion"))}wrapText(e,t){const s=t.split(" ");let i="";const n=[],l=void 0!==this.config[e]?this.config[e]:this.config.body,r=void 0!==l.width?l.width:this.config.width,o=void 0!==l.height?l.height:this.config.height,a=void 0!==l.position?l.position:{x:0,y:0},d=void 0!==l.padding?l.padding:void 0!==this.config.body.padding?this.config.body.padding:10,c=void 0!==l.paddingTop?l.paddingTop:d,h=void 0!==l.paddingLeft?l.paddingLeft:d,p=void 0!==l.paddingBottom?l.paddingBottom:d,m=void 0!==l.paddingRight?l.paddingRight:d,u={x:a.x+h,y:a.y+c,width:r-h-m,height:o-c-p},g=void 0!==l.textAlign?l.textAlign:void 0!==this.config.body.textAlign?this.config.body.textAlign:"left",f=void 0!==l.fontSize?l.fontSize:void 0!==this.config.body.fontSize?this.config.body.fontSize:30,C=void 0!==l.fontFamily?l.fontFamily:void 0!==this.config.body.fontFamily?this.config.body.fontFamily:"Arial",b=f+(void 0!==l.leading?l.leading:void 0!==this.config.body.leading?this.config.body.leading:8),y=this.context;y.textAlign=g,y.font=`${f}px '${C}'`,s.forEach((function(e){let t=s.length>1?`${i}${e} `:e,l=y.measureText(t);if(l.width>u.width&&e.length>1)if(0==i.length&&l.width>u.width){for(;l.width>u.width;){let s=0;do{s++,t=e.substr(0,s),l=y.measureText(t)}while(l.widthu.height&&"scroll"===l.overflow){void 0===l.scrollY&&(l.scrollY=0);const e=void 0!==l.fontColor?l.fontColor:this.config.body.fontColor;y.fillStyle="#aaa",this.fillRoundedRect(a.x+r-12,a.y,12,o,6),y.fillStyle="#666";const t=u.height/v,s=t*o,i=-l.scrollY*t;this.fillRoundedRect(a.x+r-12,a.y+i,12,s,6),y.fillStyle=e,_=l.scrollY,l.minScrollY=u.height-v}let w,S=_+u.y+f/2;switch(g){case"center":w=u.x+u.width/2;break;case"right":w=u.x+u.width;break;default:w=u.x}n.forEach((e=>{S+b>0&&y.fillText(e,w,S),S+=b}))}}class Re{constructor(e,t,s="EN"){const i=this.getConfig(s);i.panelSize={width:e,height:.5*e},i.height=256,i.body={backgroundColor:"#555"},i.renderer=t;const n=this.getContent(s);this.keyboard=new Oe(n,i),this.keyboard.mesh.visible=!1,this.shift=!1}get mesh(){return this.keyboard.mesh}getConfig(e){const t={};let s=10;const i=39.2,n=49,l="#333",r="#000";let o=s,a=s;for(let e=0;e<10;e++){const d={type:"button",position:{x:a,y:o},width:i,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e)};t[`btn${e}`]=d,a+=49.2}o+=59,a=s;for(let e=0;e<10;e++){const d={type:"button",position:{x:a,y:o},width:i,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e+10)};t[`btn${e+10}`]=d,a+=49.2}o+=59,a=s;for(let e=0;e<9;e++){const d=0==e||8==e?1.5*i+5:i,c={type:"button",position:{x:a,y:o},width:d,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e+20)};t[`btn${e+20}`]=c,a+=d+s}o+=59,a=s;for(let e=0;e<5;e++){const d=0==e||4==e?88.4:2==e?186.8:i,c={type:"button",position:{x:a,y:o},width:d,height:n,padding:s,paddingTop:20,backgroundColor:r,borderRadius:6,hover:l,onSelect:this.onSelect.bind(this,e+30)};0==e&&(c.fontSize=20),t[`btn${e+30}`]=c,a+=d+s}return t}getContent(e,t=0){let s,i={};switch(this.language=e,this.keyboardIndex=t,t){case 0:s=["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","@","⇧","z","x","c","v","b","n","m","⇦","","?123",","," ",".","↲"];for(let e=0;e","_","`","~",":",";","⇦","","abc",","," ",".","↲"];for(let e=0;e=0;e--){let s=t.scene.children[e];t.scene.remove(s)}else t.scene=new THREE.Scene;if(void 0!==t.scene_ghost)for(let e=t.scene_ghost.children.length-1;e>=0;e--){let s=t.scene_ghost.children[e];t.scene_ghost.remove(s)}else t.scene_ghost=new THREE.Scene;if(""!=s.htmlCls.setHtmlCls.getCookie("shininess")){let e=parseFloat(s.htmlCls.setHtmlCls.getCookie("shininess"));t.shininess!=e&&s.htmlCls.clickMenuCls.setLogCmd("set shininess "+e,!0),t.shininess=e}if(!s.bNode&&""!=s.htmlCls.setHtmlCls.getCookie("light1")){let e=parseFloat(s.htmlCls.setHtmlCls.getCookie("light1")),i=parseFloat(s.htmlCls.setHtmlCls.getCookie("light2")),n=parseFloat(s.htmlCls.setHtmlCls.getCookie("light3"));t.light1==e&&t.light2==i&&t.light3==n||s.htmlCls.clickMenuCls.setLogCmd("set light | light1 "+e+" | light2 "+i+" | light3 "+n,!0),t.light1=e,t.light2=i,t.light3=n}t.directionalLight=new THREE.DirectionalLight(16777215,t.light1),t.directionalLight2=new THREE.DirectionalLight(16777215,t.light2),t.directionalLight3=new THREE.DirectionalLight(16777215,t.light3),t.cam_z>0?(t.directionalLight.position.set(-1,1,1),t.directionalLight2.position.set(1,1,1),t.directionalLight3.position.set(1,1,-1),t.lightPos=new THREE.Vector3(-1,1,1),t.lightPos2=new THREE.Vector3(1,1,1),t.lightPos3=new THREE.Vector3(1,1,-1)):(t.directionalLight.position.set(-1,1,-1),t.directionalLight2.position.set(1,1,-1),t.directionalLight3.position.set(1,1,1),t.lightPos=new THREE.Vector3(-1,1,-1),t.lightPos2=new THREE.Vector3(1,1,-1),t.lightPos3=new THREE.Vector3(1,1,1));let i=new THREE.AmbientLight(4210752);if(t.scene.add(t.directionalLight),t.scene.add(i),void 0!==t.mdl)for(let e=t.mdl.children.length-1;e>=0;e--){let s=t.mdl.children[e];s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose(),t.mdl.remove(s)}if(void 0!==t.mdlImpostor){for(let e=t.mdlImpostor.children.length-1;e>=0;e--){let s=t.mdlImpostor.children[e];s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose(),t.mdlImpostor.remove(s)}t.mdlImpostor.children.length=0}s.bNode||t.renderer.renderLists.dispose(),t.mdl=new THREE.Object3D,t.mdlImpostor=new THREE.Object3D,t.scene.add(t.mdl),t.scene.add(t.mdlImpostor),t.mdl_ghost=new THREE.Object3D,t.scene_ghost.add(t.mdl_ghost),t.objects=[],t.objects_ghost=[],t.raycaster=new THREE.Raycaster,t.projector=new THREE.Projector,t.mouse=new THREE.Vector2;let n=s.parasCls.backgroundColors[t.opts.background.toLowerCase()];s.bNode||("transparent"===t.opts.background.toLowerCase()?t.renderer.setClearColor(n,0):t.renderer.setClearColor(n,1)),t.perspectiveCamera=new THREE.PerspectiveCamera(20,t.container.whratio,.1,1e4),t.perspectiveCamera.position.set(0,0,t.cam_z),t.perspectiveCamera.lookAt(new THREE.Vector3(0,0,0)),t.orthographicCamera=new THREE.OrthographicCamera,t.orthographicCamera.position.set(0,0,t.cam_z),t.orthographicCamera.lookAt(new THREE.Vector3(0,0,0)),t.cams={perspective:t.perspectiveCamera,orthographic:t.orthographicCamera}}setVrAr(){let e=this.icn3d;e.icn3dui;let t=this;e.bSetVrAr=!0,e.bVr?(e.canvasUI=this.createUI(),e.raycasterVR=new THREE.Raycaster,e.workingMatrix=new THREE.Matrix4,e.workingVector=new THREE.Vector3,e.origin=new THREE.Vector3,e.dolly=new THREE.Object3D,e.dolly.position.z=5,e.dolly.add(e.cam),e.scene.add(e.dolly),e.dollyId=e.dolly.id,e.dummyCam=new THREE.Object3D,e.cam.add(e.dummyCam),e.clock=new THREE.Clock,e.controllers=this.getControllers(),e.controllers.forEach((s=>{s.addEventListener("connected",(function(e){try{const s={},i="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",n="generic-trigger";be(e.data,i,n).then((({profile:i,assetPath:n})=>{s.name=i.profileId,s.targetRayMode=e.data.targetRayMode,Object.entries(i.layouts).forEach((([e,t])=>{const i={};Object.values(t.components).forEach((e=>{i[e.rootNodeName]=e.gamepadIndices})),s[e]=i})),t.updateControllers(s)}))}catch(e){}})),s.addEventListener("disconnected",(function(){this.remove(this.children[0]),e.controllers.forEach((e=>{}))}))}))):e.bAr&&(e.gestures=new ke(e.renderer),e.scene.add(e.gestures.controller1),e.scene.add(e.gestures.controller2),e.gestures.addEventListener("doubletap",(e=>{t.positionCenter()})),e.gestures.addEventListener("pinch",(s=>{if(void 0!==s.initialise)t.startPosition=e.mdl.position.clone(),t.startScale=e.mdl.scale.clone();else{let i=1;const n=t.startScale.clone().multiplyScalar(s.scale*i);e.mdl.scale.copy(n)}})))}positionCenter(){let e=this.icn3d;e.icn3dui;const t=e.gestures.controller1;e.mdl.position.set(-.06,0,-.6).applyMatrix4(t.matrixWorld),e.mdl.scale.copy(new THREE.Vector3(.005,.005,.005))}setVrArButtons(){let e=this.icn3d,t=e.icn3dui;e.bSetVrArButtons=!0,t.bNode||($("#"+t.pre+"VRButton").remove(),$("#"+t.pre+"viewer").get(0).appendChild(e.VRButtonCls.createButton(e.renderer)),$("#"+t.pre+"ARButton").remove(),$("#"+t.pre+"viewer").get(0).appendChild(e.ARButtonCls.createButton(e.renderer)))}updateControllers(e){this.icn3d.icn3dui,this.addEventForController(e,"right"),this.addEventForController(e,"left")}addEventForController(e,t){let s=this.icn3d;s.icn3dui;const i="right"==t?s.renderer.xr.getController(0):s.renderer.xr.getController(1),n="right"==t?e.right:e.left;if(i&&void 0!==n){let e=!1,t=!1;Object.keys(n).forEach((i=>{-1!=i.indexOf("trigger")&&(e=!0),-1!=i.indexOf("squeeze")&&(t=!0),-1==i.indexOf("thumbstick")&&-1==i.indexOf("touchpad")||(s.xAxisIndex=n[i].xAxis,s.yAxisIndex=n[i].yAxis)})),e&&(i.addEventListener("selectstart",(function(){this.userData.selectPressed=!0})),i.addEventListener("selectend",(function(){this.userData.selectPressed=!1,this.userData.selected=void 0}))),t&&(i.addEventListener("squeezestart",(function(){this.userData.squeezePressed=!0,s.cam.add(s.canvasUI.mesh)})),i.addEventListener("squeezeend",(function(){this.userData.squeezePressed=!1,s.cam.remove(s.canvasUI.mesh)})))}}createUI(){let e=this.icn3d,t=e.icn3dui,s=94,i=50,n=94,l=34,r=12,o="#1c94c4",a="#ccc",d="#fbcb09",c=20;const h={panelSize:{width:2,height:1.6},height:400,select:{type:"button",paddingTop:c,position:{top:6,left:6},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},residue:{type:"button",paddingTop:c,position:{top:62,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=2,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},secondarySelect:{type:"button",paddingTop:12,position:{top:118,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=3,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},chainSelect:{type:"button",paddingTop:c,position:{top:174,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=5,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},atom:{type:"button",paddingTop:c,position:{top:230,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.pk=1,e.pAtomNum||(e.pAtomNum=0),e.cam.remove(e.canvasUI.mesh)}},reset:{type:"button",paddingTop:c,position:{top:286,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.viewInterPairsCls.resetInteractionPairs(),e.selectionCls.resetAll(),e.cam.remove(e.canvasUI.mesh)}},togglehl:{type:"button",paddingTop:12,position:{top:342,left:6},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.hlUpdateCls.toggleHighlight(),e.cam.remove(e.canvasUI.mesh)}},style:{type:"button",paddingTop:c,position:{top:6,left:106},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},ribbon:{type:"button",paddingTop:c,position:{top:62,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","ribbon"),e.setOptionCls.setStyle("nucleotides","nucleotide cartoon"),e.cam.remove(e.canvasUI.mesh)}},schematic:{type:"button",paddingTop:c,position:{top:118,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","schematic"),e.setOptionCls.setStyle("nucleotides","schematic"),e.cam.remove(e.canvasUI.mesh)}},stick:{type:"button",paddingTop:c,position:{top:174,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","stick"),e.setOptionCls.setStyle("nucleotides","stick"),e.cam.remove(e.canvasUI.mesh)}},sphere:{type:"button",paddingTop:c,position:{top:230,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setStyle("proteins","sphere"),e.setOptionCls.setStyle("nucleotides","sphere"),e.cam.remove(e.canvasUI.mesh)}},surface:{type:"button",paddingTop:c,position:{top:286,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.opts.surface="molecular surface",e.applyMapCls.applySurfaceOptions(),e.cam.remove(e.canvasUI.mesh)}},surfaceTrn:{type:"button",paddingTop:12,position:{top:342,left:106},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.opts.surface="molecular surface",e.opts.opacity="0.2",e.applyMapCls.applySurfaceOptions(),e.cam.remove(e.canvasUI.mesh)}},color:{type:"button",paddingTop:c,position:{top:6,left:206},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},rainbow:{type:"button",paddingTop:c,position:{top:62,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","rainbow for chains"),e.cam.remove(e.canvasUI.mesh)}},atomColor:{type:"button",paddingTop:c,position:{top:118,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","atom"),e.cam.remove(e.canvasUI.mesh)}},chainColor:{type:"button",paddingTop:c,position:{top:174,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","chain"),e.cam.remove(e.canvasUI.mesh)}},secondaryColor:{type:"button",paddingTop:12,position:{top:230,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","secondary structure green"),e.cam.remove(e.canvasUI.mesh)}},charge:{type:"button",paddingTop:c,position:{top:342,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","charge"),e.cam.remove(e.canvasUI.mesh)}},AlphaFold:{type:"button",paddingTop:c,position:{top:286,left:206},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){e.setOptionCls.setOption("color","confidence"),e.cam.remove(e.canvasUI.mesh)}},unicolor:{type:"button",paddingTop:c,position:{top:6,left:306},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},red:{type:"button",position:{top:i,left:300},width:n,height:l,fontColor:"red",hover:d,onSelect:function(){e.setOptionCls.setOption("color","red"),e.cam.remove(e.canvasUI.mesh)}},green:{type:"button",position:{top:78,left:300},width:n,height:l,fontColor:"green",hover:d,onSelect:function(){e.setOptionCls.setOption("color","green"),e.cam.remove(e.canvasUI.mesh)}},blue:{type:"button",position:{top:106,left:300},width:n,height:l,fontColor:"blue",hover:d,onSelect:function(){e.setOptionCls.setOption("color","blue"),e.cam.remove(e.canvasUI.mesh)}},blueviolet:{type:"button",position:{top:134,left:300},width:n,height:l,fontColor:"#8A2BE2",hover:d,onSelect:function(){e.setOptionCls.setOption("color","8A2BE2"),e.cam.remove(e.canvasUI.mesh)}},magenta:{type:"button",position:{top:162,left:300},width:n,height:l,fontColor:"magenta",hover:d,onSelect:function(){e.setOptionCls.setOption("color","magenta"),e.cam.remove(e.canvasUI.mesh)}},yellow:{type:"button",position:{top:190,left:300},width:n,height:l,fontColor:"yellow",hover:d,onSelect:function(){e.setOptionCls.setOption("color","yellow"),e.cam.remove(e.canvasUI.mesh)}},orange:{type:"button",position:{top:218,left:300},width:n,height:l,fontColor:"orange",hover:d,onSelect:function(){e.setOptionCls.setOption("color","FFA500"),e.cam.remove(e.canvasUI.mesh)}},cyan:{type:"button",position:{top:246,left:300},width:n,height:l,fontColor:"cyan",hover:d,onSelect:function(){e.setOptionCls.setOption("color","cyan"),e.cam.remove(e.canvasUI.mesh)}},gray:{type:"button",position:{top:274,left:300},width:n,height:l,fontColor:"gray",hover:d,onSelect:function(){e.setOptionCls.setOption("color","888888"),e.cam.remove(e.canvasUI.mesh)}},white:{type:"button",position:{top:302,left:300},width:n,height:l,fontColor:"white",hover:d,onSelect:function(){e.setOptionCls.setOption("color","white"),e.cam.remove(e.canvasUI.mesh)}},analysis:{type:"button",paddingTop:c,position:{top:6,left:406},width:s,height:i,fontColor:"#000",fontSize:14,backgroundColor:a},distance:{type:"button",paddingTop:c,position:{top:62,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){try{e.bMeasureDistance=!0;let s=e.pickingCls.getPickedAtomList(e.pk,e.pAtom),i=e.pickingCls.getPickedAtomList(e.pk,e.pAtom2),n=e.applyCenterCls.centerAtoms(t.hashUtilsCls.hash2Atoms(s,e.atoms)).center,l=e.applyCenterCls.centerAtoms(t.hashUtilsCls.hash2Atoms(i,e.atoms)).center,r=0,o=0,a="#FFFF00",d=(n.x+l.x)/2,c=(n.y+l.y)/2,h=(n.z+l.z)/2,p=!0;e.analysisCls.addLine(n.x,n.y,n.z,l.x,l.y,l.z,a,p,"distance");let m=(parseInt(10*n.distanceTo(l))/10).toString()+" A";e.analysisCls.addLabel(m,d,c,h,r,a,o,"distance"),e.drawCls.draw(),e.cam.remove(e.canvasUI.mesh)}catch(e){}}},interaction:{type:"button",paddingTop:c,position:{top:118,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){try{e.viewInterPairsCls.viewInteractionPairs(["selected"],["non-selected"],!1,"3d",1,1,1,1,1,1),e.cam.remove(e.canvasUI.mesh)}catch(e){}}},delphi:{type:"button",paddingTop:c,position:{top:174,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:async function(){e.phisurftype=22,e.phisurfop=1,e.phisurfwf="no",await e.delphiCls.CalcPhi(65,.15,2,!0),e.cam.remove(e.canvasUI.mesh)}},removeLabel:{type:"button",paddingTop:c,position:{top:230,left:406},width:s,height:i,fontColor:o,fontSize:r,backgroundColor:a,hover:d,onSelect:function(){for(let t in e.labels)e.labels[t]=[];e.drawCls.draw(),e.cam.remove(e.canvasUI.mesh)}},renderer:e.renderer},p=new Oe({select:"Select",residue:"Residue",secondarySelect:"Secondary Structure",chainSelect:"Chain",atom:"Atom",reset:"Reset",togglehl:"Toggle Highlight",style:"Style",ribbon:"Ribbon",schematic:"Schematic",stick:"Stick",sphere:"Sphere",surface:"Surface",surfaceTrn:"Transparent Surface",color:"Color",rainbow:"Rainbow",atomColor:"Atom",chainColor:"Chain",secondaryColor:"Secondary Structure",AlphaFold:"AlphaFold",charge:"Charge",unicolor:"UniColor",red:"M 100 15 L 15 15 L 15 100 L 100 100 Z",green:"M 100 15 L 15 15 L 15 100 L 100 100 Z",blue:"M 100 15 L 15 15 L 15 100 L 100 100 Z",blueviolet:"M 100 15 L 15 15 L 15 100 L 100 100 Z",magenta:"M 100 15 L 15 15 L 15 100 L 100 100 Z",yellow:"M 100 15 L 15 15 L 15 100 L 100 100 Z",orange:"M 100 15 L 15 15 L 15 100 L 100 100 Z",cyan:"M 100 15 L 15 15 L 15 100 L 100 100 Z",gray:"M 100 15 L 15 15 L 15 100 L 100 100 Z",white:"M 100 15 L 15 15 L 15 100 L 100 100 Z",analysis:"Analysis",distance:"Distance",interaction:"Interaction",delphi:"DelPhi Potential",removeLabel:"Remove Label"},h);return p.mesh.position.set(0,0,-3),p}createUILog(){let e=this.icn3d;e.icn3dui;const t={panelSize:{width:2,height:2},height:512,info:{type:"text",overflow:"scroll",position:{top:6,left:6},width:506,height:506,backgroundColor:"#aaa",fontColor:"#000"},renderer:e.renderer},s=new Oe({info:"Debug info"},t);return s.mesh.position.set(0,-1,-2),s}getControllers(){let e=this.icn3d;e.icn3dui;const t=new xe,s=(new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,-1)]),i=new THREE.Line(s);i.name="line",i.scale.z=50;const n=[];for(let s=0;s<=1;s++){const l=e.renderer.xr.getController(s);if(!l)continue;e.dolly.add(l),l.add(i.clone()),l.userData.selectPressed=!1,e.cam.add(l),n.push(l);const r=e.renderer.xr.getControllerGrip(s);r.add(t.createControllerModel(r)),e.scene.add(r)}return n}}class Ee{constructor(e){this.icn3d=e}setCamera(){let e=this.icn3d,t=e.icn3dui;if(e.bControlGl&&!t.bNode){window.cam=e.cams[e.opts.camera.toLowerCase()];let s=e.maxD;if(window.cam===e.perspectiveCamera){let i=void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>e.maxatomcnt;i?window.camMaxDFactor=1:void 0!==window.camMaxDFactorFog?window.camMaxDFactor=window.camMaxDFactorFog:window.camMaxDFactor=3,window.cam_z>0?window.cam.position.z=s*window.camMaxDFactor:window.cam.position.z=-s*window.camMaxDFactor,"yes"===e.opts.slab?i?window.cam.near=.1:void 0!==window.camMaxDFactorFog?window.cam.near=s*window.camMaxDFactorFog-10:window.cam.near=s*window.camMaxDFactor:window.cam.near=.1,window.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.TrackballControls(window.cam,void 0,e):t.bNode?e.controls=new THREE.TrackballControls(e.cam,document,e):e.controls=new THREE.TrackballControls(e.cam,document.getElementById(e.id),e)}else window.cam===e.orthographicCamera&&(void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>10*e.maxatomcnt?window.cam.right=e.maxD/2*1.5:window.cam.right=e.maxD/2*2.5,window.cam.left=-window.cam.right,window.cam.top=window.cam.right/e.container.whratio,window.cam.bottom=-window.cam.right/e.container.whratio,"yes"===e.opts.slab?window.cam.near=2*e.maxD:window.cam.near=0,window.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.OrthographicTrackballControls(window.cam,void 0,e):t.bNode?e.controls=new THREE.OrthographicTrackballControls(e.cam,document,e):e.controls=new THREE.OrthographicTrackballControls(e.cam,document.getElementById(e.id),e));window.cam.updateProjectionMatrix()}e.cam=e.cams[e.opts.camera.toLowerCase()];let s=e.maxD;if(e.cam===e.perspectiveCamera){let i=void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>e.maxatomcnt;i?e.camMaxDFactor=1:void 0!==e.camMaxDFactorFog?e.camMaxDFactor=e.camMaxDFactorFog:e.camMaxDFactor=3,e.cam_z>0?e.cam.position.z=s*e.camMaxDFactor:e.cam.position.z=-s*e.camMaxDFactor,"yes"===e.opts.slab?i?e.cam.near=.1:void 0!==e.camMaxDFactorFog?e.cam.near=s*e.camMaxDFactorFog-10:e.cam.near=s*e.camMaxDFactor:e.cam.near=.1,e.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.TrackballControls(e.cam,void 0,e):t.bNode?e.controls=new THREE.TrackballControls(e.cam,document,e):e.controls=new THREE.TrackballControls(e.cam,document.getElementById(e.id),e)}else e.cam===e.orthographicCamera&&(void 0!==e.biomtMatrices&&e.biomtMatrices.length*e.cnt>10*e.maxatomcnt?e.cam.right=e.maxD/2*1.5:e.cam.right=e.maxD/2*2.5,e.cam.left=-e.cam.right,e.cam.top=e.cam.right/e.container.whratio,e.cam.bottom=-e.cam.right/e.container.whratio,"yes"===e.opts.slab?e.cam.near=2*e.maxD:e.cam.near=0,e.cam.far=1e4,e.bControlGl&&!t.bNode?window.controls=new THREE.OrthographicTrackballControls(e.cam,void 0,e):t.bNode?e.controls=new THREE.OrthographicTrackballControls(e.cam,document,e):e.controls=new THREE.OrthographicTrackballControls(e.cam,document.getElementById(e.id),e));e.cam.updateProjectionMatrix()}}class Te{constructor(e){this.icn3d=e}setFog(e){let t=this.icn3d,s=t.icn3dui.parasCls.backgroundColors[t.opts.background.toLowerCase()];if(e){let e=t.applyCenterCls.centerAtoms(t.hAtoms);t.maxD=e.maxD,t.maxD<25&&(t.maxD=25)}let i=void 0!==t.biomtMatrices&&t.biomtMatrices.length*t.cnt>t.maxatomcnt;if("yes"===t.opts.fog)if("perspective"===t.opts.camera)if(i)t.scene.fog=void 0,t.bSetFog=!1;else{let e=t._zoomFactor>1?1*t._zoomFactor:t._zoomFactor;t.scene.fog=new THREE.Fog(s,2.5*t.maxD*e,4*t.maxD*e),t.bSetFog=!0,t.camMaxDFactorFog=3}else"orthographic"===t.opts.camera&&(t.scene.fog=void 0,t.bSetFog=!1);else t.scene.fog=void 0,t.bSetFog=!1}}class Pe{constructor(e){this.icn3d=e}createBox(e,t,s,i,n,l){let r=this.icn3d,o=r.icn3dui;if(o.bNode)return;void 0===t&&(t=.8),void 0===s&&(s=!1),void 0===i&&(i=.8),l?void 0===n&&(n=r.hColor):void 0===n&&(n=e.color);let a=s?t:(o.parasCls.vdwRadii[e.elem.toUpperCase()]||t)*(i||1);this.createBox_base(e.coord,a,n,l)}createBox_base(e,t,s,i,n,l,r){let o,a=this.icn3d;a.icn3dui.bNode||(void 0===r&&(r=l?.5:1),new THREE.BoxGeometry(1,1,1),o=new THREE.Mesh(a.boxGeometry,new THREE.MeshPhongMaterial({transparent:!0,opacity:r,specular:a.frac,shininess:a.shininess,emissive:a.emissive,color:s})),o.scale.x=o.scale.y=o.scale.z=t,o.position.copy(e),a.mdl.add(o),i?a.prevHighlightObjects.push(o):n?a.prevOtherMesh.push(o):a.objects.push(o))}createBoxRepresentation_P_CA(e,t,s){let i=this.icn3d;if(i.icn3dui.bNode)return;let n=this;i.reprSubCls.createRepresentationSub(e,(function(e){"CA"!==e.name&&"O3'"!==e.name&&"O3*"!==e.name||n.createBox(e,void 0,void 0,t,void 0,s)}))}}class De{constructor(e){this.icn3d=e}createBrick(e,t,s,i){let n=this.icn3d;if(n.icn3dui.bNode)return;let l=new THREE.CylinderGeometry(1,1,1,4,1),r=new THREE.Mesh(l,new THREE.MeshPhongMaterial({specular:n.frac,shininess:n.shininess,emissive:n.emissive,color:i}));r.position.copy(e).add(t).multiplyScalar(.5),r.matrixAutoUpdate=!1,r.lookAt(t.clone().sub(e)),r.updateMatrix(),r.matrix.multiply((new THREE.Matrix4).makeScale(s,s,e.distanceTo(t))).multiply((new THREE.Matrix4).makeRotationX(.5*Math.PI)),n.mdl.add(r)}}class Me{constructor(e){this.icn3d=e}createCurveSubArrow(e,t,s,i,n,l,r,o,a,d,c,h,p,m,u){if(this.icn3d.icn3dui.bNode)return;let g=[],f=[];g.push(e),f.push(o),this.prepareStrand(g,f,t,s,i,void 0,n,l,r,a,d,!1,c,h,p,m,u),g=[],f=[]}createStripArrow(e,t,s,i,n,l,r,o,a,d,c,h,p,m,u,g){if(this.icn3d.icn3dui.bNode)return;let f=[],C=[];f.push(e),f.push(t),C.push(o),C.push(a),this.prepareStrand(f,C,void 0,s,i,n,l,void 0,r,d,c,!0,h,p,m,u,g),f=[],C=[]}prepareStrand(e,t,s,i,n,l,r,o,a,d,c,h,p,m,u,g,f){let C=this.icn3d,b=C.icn3dui;if(1===d.length)return;let y=i,v=!u,_=[];_.push(i[i.length-2]),_.push(i[i.length-1]),n=n||C.axisDIV;let w,S,A,x,k=2/(a-1),O={};for(let e=0,s=t.length;e1)if(void 0!==d){let i,n,l=[];for(let r=0,o=p.length;r0&&i.tubeCls.createTube(a,"CA",i.coilWidth,s),Object.keys(d).length>0&&i.strandCls.createStrand(d,void 0,void 0,!0,0,i.helixSheetWidth,!1,2*i.ribbonthickness,s)):(Object.keys(a).length>0&&i.tubeCls.createTube(a,"CA",i.coilWidth),Object.keys(d).length>0&&i.strandCls.createStrand(d,void 0,void 0,!0,0,i.helixSheetWidth,!1,2*i.ribbonthickness))}createCylinderCurve(e,t,s,i,n){let l=this.icn3d;if(l.icn3dui.bNode)return;let r,o,a,d,c,h,p=null;for(a in e)if(d=e[a],!d.het&&(c=d.structure+"_"+d.chain,h=d.structure+"_"+r,-1!=t.indexOf(d.name))){if(null!==p&&r===d.chain&&l.ParserUtilsCls.getResiNCBI(h,o)+1===l.ParserUtilsCls.getResiNCBI(c,d.resi)&&Math.abs(p.coord.x-d.coord.x)<8&&Math.abs(p.coord.y-d.coord.y)<8&&Math.abs(p.coord.z-d.coord.z)<8){let e=p.coord.clone().add(d.coord).multiplyScalar(.5);if(n)1===n&&(this.createCylinder(p.coord,e,s,p.color,n),this.createCylinder(e,d.coord,s,d.color,n),l.sphereCls.createSphere(d,s,!0,1,n));else if(i){let t=l.lineCls.createSingleLine(p.coord,e,p.color,!1);l.mdl.add(t),l.objects.push(t),t=l.lineCls.createSingleLine(e,d.coord,d.color,!1),l.mdl.add(t),l.objects.push(t)}else this.createCylinder(p.coord,e,s,p.color),this.createCylinder(e,d.coord,s,d.color),l.sphereCls.createSphere(d,s,!0,1,n)}p=d,r=d.chain,o=d.resi,l.sphereCls.createSphere(d,s,!0,1,n),2===n&&l.boxCls.createBox(d,void 0,void 0,void 0,void 0,n)}if(null!==p&&r===d.chain&&l.ParserUtilsCls.getResiNCBI(h,o)+1===l.ParserUtilsCls.getResiNCBI(c,d.resi)&&Math.abs(p.coord.x-d.coord.x)<8&&Math.abs(p.coord.y-d.coord.y)<8&&Math.abs(p.coord.z-d.coord.z)<8){let e=p.coord.add(d.coord).multiplyScalar(.5);if(n)1===n&&(this.createCylinder(p.coord,e,s,p.color,n),this.createCylinder(e,d.coord,s,d.color,n),l.sphereCls.createSphere(d,s,!0,1,n));else if(i){let t=l.lineCls.createSingleLine(p.coord,e,p.color,!1);l.mdl.add(t),l.objects.push(t),t=l.lineCls.createSingleLine(e,d.coord,d.color,!1),l.mdl.add(t),l.objects.push(t)}else this.createCylinder(p.coord,e,s,p.color),this.createCylinder(e,d.coord,s,d.color)}}}class Le{constructor(e){this.icn3d=e}createLineRepresentation(e,t){let s=this.icn3d;if(s.icn3dui.bNode)return;let i=new THREE.BufferGeometry,n=[],l=[],r=0,o=0;s.reprSubCls.createRepresentationSub(e,void 0,(function(e,t){if(e.color===t.color)n[r++]=e.coord.x,n[r++]=e.coord.y,n[r++]=e.coord.z,n[r++]=t.coord.x,n[r++]=t.coord.y,n[r++]=t.coord.z,l[o++]=e.color.r,l[o++]=e.color.g,l[o++]=e.color.b,l[o++]=t.color.r,l[o++]=t.color.g,l[o++]=t.color.b;else{let s=e.coord.clone().add(t.coord).multiplyScalar(.5);n[r++]=e.coord.x,n[r++]=e.coord.y,n[r++]=e.coord.z,n[r++]=s.x,n[r++]=s.y,n[r++]=s.z,n[r++]=t.coord.x,n[r++]=t.coord.y,n[r++]=t.coord.z,n[r++]=s.x,n[r++]=s.y,n[r++]=s.z,l[o++]=e.color.r,l[o++]=e.color.g,l[o++]=e.color.b,l[o++]=e.color.r,l[o++]=e.color.g,l[o++]=e.color.b,l[o++]=t.color.r,l[o++]=t.color.g,l[o++]=t.color.b,l[o++]=t.color.r,l[o++]=t.color.g,l[o++]=t.color.b}}));if(i.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),i.setAttribute("color",new THREE.BufferAttribute(new Float32Array(l),3)),2!==t){let e;1===t||(e=new THREE.LineSegments(i,new THREE.LineBasicMaterial({linewidth:s.linewidth,vertexColors:!0})),s.mdl.add(e)),1===t?s.prevHighlightObjects.push(e):s.objects.push(e)}else 2===t&&s.boxCls.createBoxRepresentation_P_CA(e,.8,t)}createConnCalphSidechain(e,t){let s=this.icn3d;if(s.icn3dui.bNode)return;let i={};for(let s in e){let n=e[s];if(!n.het&&n.style2===t){i[n.structure+"_"+n.chain+"_"+n.resi]=1}}let n=[],l=[];for(let e in i){let t=s.firstAtomObjCls.getFirstAtomObjByName(s.residues[e],"CA");if(void 0!==t)for(let e=0,i=t.bonds.length;e=t.bonds.length&&e.bonds.length>1)s=e.serial,l=e.bonds[0],d=e.bonds[1];else{if(!(t.bonds.length>=e.bonds.length&&t.bonds.length>1))return void console.log("Double bond was not drawn due to the undefined cross plane");s=t.serial,l=t.bonds[0],d=t.bonds[1]}let i=r.atoms[s].coord.clone();i.sub(r.atoms[l].coord);let n=r.atoms[s].coord.clone();n.sub(r.atoms[d].coord),i.cross(n),0==parseInt(1e4*i.length())&&(i=new THREE.Vector3(.2,.3,.5)),c=t.coord.clone(),c.sub(e.coord),c.cross(i).normalize().multiplyScalar(.2*o),0==parseInt(1e4*c.length())&&(i=new THREE.Vector3(.5,.3,.2),c.cross(i).normalize().multiplyScalar(.2*o))}e.color===t.color?r.dAtoms.hasOwnProperty(e.serial)&&r.dAtoms.hasOwnProperty(t.serial)&&(r.cylinderCls.createCylinder(e.coord.clone().add(c),t.coord.clone().add(c),a,e.color,n),r.cylinderCls.createCylinder(e.coord.clone().sub(c),t.coord.clone().sub(c),a,e.color,n)):r.bImpo?r.dAtoms.hasOwnProperty(e.serial)&&r.dAtoms.hasOwnProperty(t.serial)&&(r.cylinderCls.createCylinder(e.coord.clone().add(c),t.coord.clone().add(c),a,e.color,n,t.color),r.cylinderCls.createCylinder(e.coord.clone().sub(c),t.coord.clone().sub(c),a,e.color,n,t.color)):r.dAtoms.hasOwnProperty(e.serial)&&r.dAtoms.hasOwnProperty(t.serial)&&(r.cylinderCls.createCylinder(e.coord.clone().add(c),i.clone().add(c),a,e.color,n),r.cylinderCls.createCylinder(t.coord.clone().add(c),i.clone().add(c),a,t.color,n),r.cylinderCls.createCylinder(e.coord.clone().sub(c),i.clone().sub(c),a,e.color,n),r.cylinderCls.createCylinder(t.coord.clone().sub(c),i.clone().sub(c),a,t.color,n))}else if(r.aromaticbonds.hasOwnProperty(l)){let s,l,d;if(e.bonds.length>t.bonds.length&&e.bonds.length>1)s=e.serial,l=e.bonds[0],d=e.bonds[1];else{if(!(t.bonds.length>1))return;s=t.serial,l=t.bonds[0],d=t.bonds[1]}let c=r.atoms[s].coord.clone();c.sub(r.atoms[l].coord);let h=r.atoms[s].coord.clone();h.sub(r.atoms[d].coord),c.cross(h);let p=t.coord.clone();p.sub(e.coord),p.cross(c).normalize().multiplyScalar(.2*o);let m=0;for(let s=0,i=e.bondOrder.length;so+1?(s=k.clone(),i=d.atoms[j[j.length-1-o-1]].coord.clone(),i.sub(s)):s=new THREE.Vector3(Math.random(),Math.random(),Math.random()))):U[m]&&"CA"===p.name&&(j.length>o+1?(s=k.clone(),i=d.atoms[j[j.length-1-o-1]].coord.clone(),i.sub(s)):s=new THREE.Vector3(Math.random(),Math.random(),Math.random())),s.normalize(),s.multiplyScalar(C),null!==I&&s.dot(I)<0&&s.negate(),I=s;for(let e=0,s=2/(t-1);e6||c&&Math.abs(S.y-c.y)>6||c&&Math.abs(S.z-c.z)>6;if((g!==p.chain||p.ssbegin||p.ssend||z||B==W&&"coil"!=p.ss)&&u[0].length>0){let c="CA",g=[],f=[];if(isNaN(d.atoms[D].resi))g=[];else{let e=d.atoms[D].structure+"_"+d.atoms[D].chain+"_"+(parseInt(d.atoms[D].resi)-1).toString(),t=d.firstAtomObjCls.getAtomCoordFromResi(e,c);g=void 0!==t?[t]:[]}if(!isNaN(d.atoms[D].resi)){let e=d.atoms[D].structure+"_"+d.atoms[D].chain+"_"+(parseInt(d.atoms[D].resi)+1).toString(),t=d.firstAtomObjCls.getAtomCoordFromResi(e,c);void 0!==t&&f.push(t);let s=d.atoms[D].structure+"_"+d.atoms[D].chain+"_"+(parseInt(d.atoms[D].resi)+2).toString(),i=d.firstAtomObjCls.getAtomCoordFromResi(s,c);void 0!==i&&f.push(i)}if(!z){1===a||2===a?w.push(d.hColor):w.push(R),C=p.ssend&&"sheet"===p.ss?0:"coil"===E&&p.ssbegin||T&&p.ssbegin||"coil"===p.ss?n:l;let s,i,o=4;"O"===p.name?(s=A.clone(),s.sub(S)):U[m]&&"CA"===p.name&&(j.length>o?(s=S.clone(),i=d.atoms[j[j.length-1-o]].coord.clone(),i.sub(s)):s=new THREE.Vector3(Math.random(),Math.random(),Math.random())),s.normalize(),s.multiplyScalar(C),null!==I&&s.dot(I)<0&&s.negate(),I=s;for(let e=0,s=2/(t-1);e0){let e="CA",n=[],l=[];if(isNaN(d.atoms[D].resi))n=[];else{let t=d.atoms[D].structure+"_"+d.atoms[D].chain+"_"+(parseInt(d.atoms[D].resi)-1).toString();d.firstAtomObjCls.getAtomCoordFromResi(t,e)}for(let e=0;!i&&e0&&(o!==c.chain||Math.abs(c.coord.x-h.coord.x)>6||Math.abs(c.coord.y-h.coord.y)>6||Math.abs(c.coord.z-h.coord.z)>6||r.ParserUtilsCls.getResiNCBI(c.structure+"_"+o,a)+13||Math.abs(c.coord.y-h.coord.y)>3||Math.abs(c.coord.z-h.coord.z)>3))){if(2!==i){if(!isNaN(d.resi)&&!isNaN(h.resi)){let e=d.structure+"_"+d.chain+"_"+(parseInt(d.resi)-1).toString(),i=r.firstAtomObjCls.getAtomCoordFromResi(e,t);g=void 0!==i?[i]:[];let l=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+1).toString(),o=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+2).toString(),a=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+3).toString();if(r.residues.hasOwnProperty(l)){let e=r.firstAtomObjCls.getAtomFromResi(l,t);void 0!==e&&e.ssbegin&&(l=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+2).toString(),o=h.structure+"_"+h.chain+"_"+(parseInt(h.resi)+3).toString(),p.push(e.coord),n?u.push(this.getCustomtubesize(l)):u.push(this.getRadius(s,e)),m.push(e.color))}if(1==p.length&&r.residues.hasOwnProperty(l)){let e=r.firstAtomObjCls.getAtomFromResi(l,t);if(e){p.push(e.coord),m.push(e.color);let t=this.getRadius(s,c);u.push(t),l=o,o=a}}let C=r.firstAtomObjCls.getAtomCoordFromResi(l,t);void 0!==C&&f.push(C);let b=r.firstAtomObjCls.getAtomCoordFromResi(o,t);void 0!==b&&f.push(b)}b.push({pnts:p,colors:m,radii:u,prevone:g,nexttwo:f})}p=[],m=[],u=[],g=[],f=[],d=c,C=0}if(0==p.length&&!isNaN(c.resi)){let e=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)-1).toString();r.residues.hasOwnProperty(e)&&(h=r.firstAtomObjCls.getAtomFromResi(e,t),void 0!==h&&h.ssend&&(p.push(h.coord),n?u.push(this.getCustomtubesize(e)):u.push(this.getRadius(s,h)),m.push(h.color)))}let e;p.push(c.coord),e=n?this.getCustomtubesize(c.structure+"_"+c.chain+"_"+c.resi):this.getRadius(s,c),l||"coil"==c.ss||c.ssbegin||c.ssend||(e=0),u.push(e),m.push(c.color),1===C&&(m[m.length-2]=c.color),o=c.chain,a=c.resi;let y=1.2;2!==i||c.ssbegin||r.boxCls.createBox(c,void 0,void 0,y,void 0,i),++C,h=c}if(2!==i){if(g=[],void 0!==d&&!isNaN(d.resi)){let e=d.structure+"_"+d.chain+"_"+(parseInt(d.resi)-1).toString(),s=r.firstAtomObjCls.getAtomCoordFromResi(e,t);g=void 0!==s?[s]:[]}if(f=[],void 0!==c&&!isNaN(c.resi)){let e=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)+1).toString(),i=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)+2).toString(),n=c.structure+"_"+c.chain+"_"+(parseInt(c.resi)+3).toString();if(1==p.length&&r.residues.hasOwnProperty(e)){let l=r.firstAtomObjCls.getAtomFromResi(e,t);if(l){p.push(l.coord),m.push(l.color);let t=this.getRadius(s,c);u.push(t),e=i,i=n}}let l=r.firstAtomObjCls.getAtomCoordFromResi(e,t);void 0!==l&&f.push(l);let o=r.firstAtomObjCls.getAtomCoordFromResi(i,t);void 0!==o&&f.push(o)}b.push({pnts:p,colors:m,radii:u,prevone:g,nexttwo:f})}for(let e=0,t=b.length;e0&&(c=n);else if(g%1==0)n=s[g],n>0&&(c=n);else{let e=Math.floor(g),t=g-e;n=s[e]*(1-t)+s[e+1]*t,r||n<1*c&&(n=0)}e1?a.parasCls.thr(t[t.length-2]):a.parasCls.thr(t[e]),C[v++]=d.r,C[v++]=d.g,C[v++]=d.b}}let k,O=0;for(let e=0,t=S.length-1;er&&(l=r,e=1);for(let t=0;t0&&t.b<=100?.01*t.b:t.b>100?1:s.coilWidth),i}}class ze{constructor(e){this.icn3d=e}drawCartoonNucleicAcid(e,t,s,i){this.drawStrandNucleicAcid(e,2,t,!0,void 0,s,i)}drawStrandNucleicAcid(e,t,s,i,n,l,r){let o,a,d,c=this.icn3d;if(c.icn3dui.bNode)return;2===r&&(t=void 0,l=void 0),n=n||c.nucleicAcidWidth,s=s||c.axisDIV,t=t||c.nucleicAcidStrandDIV;let h=[];for(d=0;dy?y=b:b=y);let v=.8*C/y;if(g.width=b,g.height=y,f.clearRect(0,0,b,y),h)if(f.fillStyle="rgba("+n.r+","+n.g+","+n.b+","+n.a+")",f.strokeStyle="rgba("+l.r+","+l.g+","+l.b+","+l.a+")",f.lineWidth=r,p){let e=.4*b;this.circle(f,0,0,b,y,e)}else{let e=0;this.roundRect(f,0,0,b,y,e)}f.font="Bold "+a+"px "+o,f.textAlign="center",f.textBaseline="middle",f.fillStyle="rgba("+u.r+", "+u.g+", "+u.b+", 1.0)",f.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", 1.0)",f.fillText(e,.5*b,.5*y);let _=new THREE.Texture(g);_.needsUpdate=!0;let w=new THREE.SpriteMaterial({map:_,depthTest:!1,depthWrite:!1});w.map.minFilter=THREE.LinearFilter;let S=new THREE.Sprite(w);return p?S.scale.set(.3*d,.3*d,1):S.scale.set(v*d,d,1),S.renderOrder=1,S}roundRect(e,t,s,i,n,l){e.beginPath(),e.moveTo(t+l,s),e.lineTo(t+i-l,s),e.quadraticCurveTo(t+i,s,t+i,s+l),e.lineTo(t+i,s+n-l),e.quadraticCurveTo(t+i,s+n,t+i-l,s+n),e.lineTo(t+l,s+n),e.quadraticCurveTo(t,s+n,t,s+n-l),e.lineTo(t,s+l),e.quadraticCurveTo(t,s,t+l,s),e.closePath(),e.fill(),e.stroke()}circle(e,t,s,i,n,l){e.beginPath(),e.arc(t+i/2,.9*(s+n/2),l,0,2*Math.PI,!0),e.closePath(),e.fill(),e.stroke()}}class Ve{constructor(e){this.icn3d=e,this.textSpriteCls=new Ge(e)}createLabelRepresentation(e){let t=this.icn3d;t.icn3dui;let s=t.oriMaxD/100;s<.4&&(s=.4);let i=3*s*t.labelScale;for(let s in e){let n=void 0!==e[s]?e[s]:[],l="black"!=t.opts.background?t.colorWhitebkgd:t.colorBlackbkgd;for(let e=0,r=n.length;e.99999)h.set(0,0,0,1);else if(e.y<-.99999)h.set(1,0,0,0);else{let t=new THREE.Vector3;t.set(e.z,0,-e.x).normalize();let s=Math.acos(e.y);h.setFromAxisAngle(t,s)}return c.applyQuaternion(h),c.scale.set(l,n,l),c.position.copy(t),c}setPc1Axes(e){let t=this.icn3d,s=t.icn3dui;if(s.bNode)return;let i=s.hashUtilsCls.intHash(t.hAtoms,t.dAtoms),n=[],l=Object.keys(i).length<100;for(let e in i){let s=t.atoms[e],i=s.structure+"_"+s.chain+"_"+s.resi;(l||""!=i)&&n.push(s.coord.clone())}let r=s.rmsdSuprCls.getEigenForSelection(n,n.length),o=new THREE.Vector3(r.h1[0],r.h1[1],r.h1[2]);if(0==r.k&&t.bRender)return void alert("Can't determine the first principal component. Please select a subset and try it again.");let a=t.applyCenterCls.centerAtoms(i),d=a.maxD,c=a.center,h=c.clone().add(o.normalize().multiplyScalar(.4*d)),p=o.normalize();if(s.htmlCls.clickMenuCls.setLogCmd("Principle X-Axis: "+p.x.toFixed(3)+" "+p.y.toFixed(3)+" "+p.z.toFixed(3),!1),e)return p;let m=new THREE.Vector3(r.h2[0],r.h2[1],r.h2[2]),u=c.clone().add(m.normalize().multiplyScalar(.3*d)),g=new THREE.Vector3(r.h3[0],r.h3[1],r.h3[2]),f=c.clone().add(g.normalize().multiplyScalar(.3*d));this.buildAxes(void 0,c,h,u,f,!0);let C=[c,h,u,f];return t.axes.push(C),t.drawCls.draw(),C}}class Ye{constructor(e){this.icn3d=e}showGlycans(){let e=this.icn3d,t=e.icn3dui;if(t.bNode)return;let s={},i=e.dAtoms;for(let n in i){let i=e.atoms[n];i.het&&-1!=t.parasCls.glycanHash.hasOwnProperty(i.resn)&&(void 0===s[i.resn]&&(s[i.resn]={}),"Misc"!=i.chain&&(s[i.resn][i.structure+"_"+i.chain+"_"+i.resi]=1))}let n=Object.keys(s);for(let i=0,l=n.length;i>2))+i+((2&t)>>1))*c+n+(1&t)]&this.ISDONE)<=3&&(t.push(t[i]),i=t.length-1,t.push(t[n]),n=t.length-1,t.push(t[l]),l=t.length-1),s.push(i),s.push(n),s.push(l)}}},Xe.prototype.laplacianSmooth=function(e,t,s){let i,n,l,r,o,a=new Array(t.length);for(i=0,n=t.length;ithis.origextent[1][0])&&(!(tthis.origextent[1][1])&&!(sthis.origextent[1][2]))},Ke.prototype.getFacesAndVertices=function(){let e,t,s=this.verts;for(e=0,t=s.length;eh&&(h=this.pmaxy-this.pminy),this.pmaxz-this.pminz>h&&(h=this.pmaxz-this.pminz),this.scaleFactor=(c-1)/h,this.scaleFactor=this.defaultScaleFactor,this.defaultScaleFactor*h>this.threshbox&&(c=Math.floor(this.threshbox),this.scaleFactor=(this.threshbox-1)/h),this.bCalcArea&&(this.scaleFactor=this.defaultScaleFactor),this.pLength=Math.ceil(this.scaleFactor*(this.pmaxx-this.pminx))+1,this.pWidth=Math.ceil(this.scaleFactor*(this.pmaxy-this.pminy))+1,this.pHeight=Math.ceil(this.scaleFactor*(this.pmaxz-this.pminz))+1,this.boundingatom(t),this.cutRadius=this.probeRadius*this.scaleFactor,this.vpBits=new Uint8Array(this.pLength*this.pWidth*this.pHeight),this.vpDistance=new Float64Array(this.pLength*this.pWidth*this.pHeight),this.vpAtomID=new Int32Array(this.pLength*this.pWidth*this.pHeight),this.vpColor=[],this.vpPot=[]},Ke.prototype.boundingatom=function(e){let t,s,i,n,l=[];for(let r in this.vdwRadii){if(!this.vdwRadii.hasOwnProperty(r))continue;let o=this.vdwRadii[r];l[r]=e?(o+this.probeRadius)*this.scaleFactor+.5:o*this.scaleFactor+.5,i=l[r]*l[r],this.widxz[r]=Math.floor(l[r])+1,this.depty[r]=new Int32Array(this.widxz[r]*this.widxz[r]),n=0;for(let e=0;ei?this.depty[r][n]=-1:(s=Math.sqrt(i-t),this.depty[r][n]=Math.floor(s)),n++}},Ke.prototype.fillvoxels=function(e,t){let s,i,n,l;for(s=0,l=this.vpBits.length;sc&&(a=c),b>h&&(b=h),v>p&&(v=p);let _,w=g[o*m+d*u+y],S=g[a*m+d*u+y],A=g[o*m+b*u+y],x=g[o*m+d*u+v],k=g[a*m+b*u+y],O=g[o*m+b*u+v],R=g[a*m+d*u+v],I=g[a*m+b*u+v],E=r.x-o,T=r.y-d,P=r.z-y,D=((w*(1-E)+S*E)*(1-T)+(A*(1-E)+k*E)*T)*(1-P)+((x*(1-E)+R*E)*(1-T)+(O*(1-E)+I*E)*T)*P,M=s*f+i*C+n;this.vpPot[M]=D,D>this.isovalue&&(D=this.isovalue),D<-this.isovalue&&(D=-this.isovalue),D>0?(D/=1*this.isovalue,_=new THREE.Color(1-D,1-D,1)):(D/=-1*this.isovalue,_=new THREE.Color(1,1-D,1-D)),this.vpColor[M]=_}}for(s=0,l=this.vpBits.length;s=this.pLength||g>=this.pWidth||f>=this.pHeight)continue;let h=u*S+g*this.pHeight+f;if(this.vpBits[h]&this.INOUT){let p=t[this.vpAtomID[h]];p.serial!=e.serial&&(l=s+a-Math.floor(.5+this.scaleFactor*(p.x+this.ptranx)),r=i+d-Math.floor(.5+this.scaleFactor*(p.y+this.ptrany)),o=n+c-Math.floor(.5+this.scaleFactor*(p.z+this.ptranz)),a*a+d*d+c*c=this.pLength||p>=this.pWidth||m>=this.pHeight)continue;let u=h*S+p*this.pHeight+m;if(this.vpBits[u]&this.ISDONE){let h=t[this.vpAtomID[u]];h.serial!=e.serial&&(l=s+a-Math.floor(.5+this.scaleFactor*(h.x+this.ptranx)),r=i+d-Math.floor(.5+this.scaleFactor*(h.y+this.ptrany)),o=n+c-Math.floor(.5+this.scaleFactor*(h.z+this.ptranz)),a*a+d*d+c*c-1&&r-1&&a-1&&o=h)||(this.vpBits[n]|=this.ISBOUND))},Ke.prototype.fastoneshell=function(e,t){let s,i,n,l,r,o,a,d,c,h,p,m,u=[];if(0===e.length)return u;let g={ix:-1,iy:-1,iz:-1},f=this.pWidth*this.pHeight;for(a=0,c=e.length;a-1&&g.iy-1&&g.iz-1&&(m=g.ix*f+this.pHeight*g.iy+g.iz,this.vpBits[m]&this.INOUT&&!(this.vpBits[m]&this.ISDONE)?(t.set(g.ix,g.iy,n+this.nb[d][2],p),l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,this.vpDistance[m]=h,this.vpBits[m]|=this.ISDONE,this.vpBits[m]|=this.ISBOUND,u.push({ix:g.ix,iy:g.iy,iz:g.iz})):this.vpBits[m]&this.INOUT&&this.vpBits[m]&this.ISDONE&&(l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,h-1&&g.iy-1&&g.iz-1&&(m=g.ix*f+this.pHeight*g.iy+g.iz,this.vpBits[m]&this.INOUT&&!(this.vpBits[m]&this.ISDONE)?(t.set(g.ix,g.iy,n+this.nb[d][2],p),l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,this.vpDistance[m]=h,this.vpBits[m]|=this.ISDONE,this.vpBits[m]|=this.ISBOUND,u.push({ix:g.ix,iy:g.iy,iz:g.iz})):this.vpBits[m]&this.INOUT&&this.vpBits[m]&this.ISDONE&&(l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,h-1&&g.iy-1&&g.iz-1&&(m=g.ix*f+this.pHeight*g.iy+g.iz,this.vpBits[m]&this.INOUT&&!(this.vpBits[m]&this.ISDONE)?(t.set(g.ix,g.iy,n+this.nb[d][2],p),l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,this.vpDistance[m]=h,this.vpBits[m]|=this.ISDONE,this.vpBits[m]|=this.ISBOUND,u.push({ix:g.ix,iy:g.iy,iz:g.iz})):this.vpBits[m]&this.INOUT&&this.vpBits[m]&this.ISDONE&&(l=g.ix-p.ix,r=g.iy-p.iy,o=g.iz-p.iz,h=l*l+r*r+o*o,hm&&(m=this.pmaxy-this.pminy),this.pmaxz-this.pminz>m&&(m=this.pmaxz-this.pminz),this.scaleFactor=1,this.pLength=Math.floor(.5+this.scaleFactor*(this.pmaxx-this.pminx))+1,this.pWidth=Math.floor(.5+this.scaleFactor*(this.pmaxy-this.pminy))+1,this.pHeight=Math.floor(.5+this.scaleFactor*(this.pmaxz-this.pminz))+1,this.cutRadius=this.probeRadius*this.scaleFactor,this.vpBits=new Uint8Array(this.pLength*this.pWidth*this.pHeight),this.ccp4&&(this.vpGridTrans=new Array(this.pLength*this.pWidth*this.pHeight)),this.vpAtomID=new Uint8Array(this.pLength*this.pWidth*this.pHeight)},Je.prototype.transformMemPro=function(e,t,s,i){let n=e.clone();n.sub(s);let l=n.x*t[0]+n.y*t[1]+n.z*t[2]+i.x,r=n.x*t[3]+n.y*t[4]+n.z*t[5]+i.y,o=n.x*t[6]+n.y*t[7]+n.z*t[8]+i.z;return n.x=l,n.y=r,n.z=o,n},Je.prototype.fillvoxels=function(e,t){let s,i,n,l,r,o;for(s=0,l=this.vpBits.length;sthis.pLength&&(o=this.pLength),p>this.pWidth&&(p=this.pWidth),C>this.pHeight&&(C=this.pHeight);let b,y=l[r*a+h*d+f],v=l[o*a+h*d+f],_=l[r*a+p*d+f],w=l[r*a+h*d+C],S=l[o*a+p*d+f],A=l[r*a+p*d+C],x=l[o*a+h*d+C],k=l[o*a+p*d+C],O=n.x-r,R=n.y-h,I=n.z-f,E=((y*(1-O)+v*O)*(1-R)+(_*(1-O)+S*O)*R)*(1-I)+((w*(1-O)+x*O)*(1-R)+(A*(1-O)+k*O)*R)*I;E>this.isovalue&&(E=this.isovalue),E<-this.isovalue&&(E=-this.isovalue),E>0?(E/=1*this.isovalue,b=new THREE.Color(1-E,1-E,1)):(E/=-1*this.isovalue,b=new THREE.Color(1,1-E,1-E)),this.icn3d.atoms[t[s]].color=b,this.icn3d.atomPrevColors[t[s]]=b}}else{for(let p in t){let f,C=e[t[p]];if("DUM"!==C.resn){if(void 0!==this.rmsd_supr&&void 0!==this.rmsd_supr.rot){f=this.transformMemPro(C.coord,g,u,m).applyMatrix4(c)}else f=C.coord.clone().applyMatrix4(c);for(s=Math.floor(f.x)-this.maxdist,l=Math.ceil(f.x)+this.maxdist;s<=l;++s)if(!(s<0||s>this.header.xExtent*this.scaleFactor-1))for(i=Math.floor(f.y)-this.maxdist,r=Math.ceil(f.y)+this.maxdist;i<=r;++i)if(!(i<0||i>this.header.yExtent*this.scaleFactor-1))for(n=Math.floor(f.z)-this.maxdist,o=Math.ceil(f.z)+this.maxdist;n<=o;++n){if(n<0||n>this.header.zExtent*this.scaleFactor-1)continue;let e=s*a+i*d+n;h.push(e)}}}for(s=0,l=h.length;s=this.isovalue?1:0:"fofc"==this.type?(this.vpBits[e]=this.dataArray[e]>=this.isovalue||this.dataArray[e]<=-this.isovalue?1:0,this.vpAtomID[e]=this.dataArray[e]>=0?1:0):"em"==this.type&&(this.vpBits[e]=this.dataArray[e]>=this.isovalue?1:0)}}}else for(s=0;s=this.isovalue||this.dataArray[e]<=-this.isovalue?1:0,this.vpAtomID[t]=this.dataArray[e]>=0?1:0)}for(s=0,l=this.vpBits.length;s-1&&r-1&&a-1&&o1?"
Structure
":"",a=Object.keys(i).length>1?"
Chain
":"";n+="
"+o+a+"
Residue
Number
SASA (Å2)
Percent Out
In/Out
";for(let e in l.resid2area){let d=e.lastIndexOf("_"),c=e.substr(d+1),h=r.utilsCls.getIdArray(e.substr(0,d));o=Object.keys(s).length>1?"
","normalized hydrophobic"==e?(n+="Dark green (W, F, L, I, Y, M, V, C): Hydrophobic ",n+="Light green (P, T, S, A, Q, N, G): Polar ",n+="Grey: Charged, not hydrophobic
"):(n+="Green (W, F, L, I, Y, M, V, C): Hydrophobic ",n+="Yellow (P, T, S, A, Q, N, G): Polar ",n+="Red: Negatively Charged ",n+="Blue: Positively Charged
");let a=0;for(let e of r)s.parasCls.residueAbbrev[e[0]]&&(n+="
",n+=" ",n+=s.parasCls.residueAbbrev[e[0]]+"
",a%4==3&&(n+=" "),++a);n+="
"}else"b factor"==e?(n+="
B factor quantitates the uncertainty for each atom. A high B factor reflects that the position is less certain.
",n+=s.htmlCls.clickMenuCls.setLegendHtml()):"confidence"==e?n+=s.htmlCls.clickMenuCls.setLegendHtml(!0):"exon"==e?(t.startColor="red",t.midColor="white",t.endColor="blue",t.startValue="Start",t.midValue="Middle",t.endValue="End",n+=s.htmlCls.clickMenuCls.setLegendHtml()):n="";n?($("#"+s.pre+"dl_legend_html").html(n),s.htmlCls.dialogCls.openDlg("dl_legend","Color Legend")):$("#"+s.pre+"dl_legend").hasClass("ui-dialog-content")&&$("#"+s.pre+"dl_legend").dialog("isOpen")&&$("#"+s.pre+"dl_legend").dialog("close")}getColorLegendForElem(e,t){let s=this.icn3d,i=s.icn3dui,n="",l={};for(let e in t){let t=s.atoms[e],i=void 0===t||void 0===t.color||"FFFFFF"===t.color.getHexString().toUpperCase()?"DDDDDD":t.color.getHexString();void 0===l[t.elem]&&(l[t.elem]={}),l[t.elem][i]=1}if(Object.keys(l).length>0){n+=""+e+" ";let t=Object.keys(l).sort();for(let e=0,s=t.length;e";for(let e in l[s])n+=" ";n+=i.parasCls.atomnames[s.toUpperCase()]+" "}n+=" "}return n}getRes2color(e,t){let s=this.icn3d,i=s.icn3dui,n={},l=s.firstAtomObjCls.getResiduesFromAtoms(e);for(let e in l){let l=s.residues[e],r=s.firstAtomObjCls.getFirstAtomObj(l),o=t?r.resn:i.parasCls.residueAbbrev[r.resn],a=void 0===r||void 0===r.color||"FFFFFF"===r.color.getHexString().toUpperCase()?"DDDDDD":r.color.getHexString();null!=o&&(void 0===n[o]&&(n[o]={}),n[o][a]=1)}return n}getColorLegendForResidue(e){this.icn3d.icn3dui;let t="",s=this.getRes2color(e);if(Object.keys(s).length>0){t+="
";let e=Object.keys(s).sort(),i="",n=0;for(let l=0,r=e.length;l";for(let e in s[o])r+=" ";r+=o+"
"}return t}getColorLegendForCharge(e){let t=this.icn3d;t.icn3dui;let s="",i=t.firstAtomObjCls.getResiduesFromAtoms(e),n={};for(let e in i){let s=t.residues[e],i=t.firstAtomObjCls.getFirstAtomObj(s);"ARG"==i.resn||"LYS"==i.resn?n.Positive=1:"HIS"==i.resn?n["Partial-Positive"]=1:"ASP"==i.resn||"GLU"==i.resn||t.nucleotides[i.serial]?n.Negative=1:n.Neutral=1}const l={Positive:"0000ff","Partial-Positive":"8080ff",Negative:"ff0000",Neutral:"888888"};let r=["Positive","Partial-Positive","Negative","Neutral"];s+="
";for(let e=0,t=r.length;e",s+=" ",s+=t,s+=" ")}return s+=" (Charges are at pH 7)",s+="
',C+=o,y+=v)}else h+="-";i.seqStartLen&&i.seqStartLen[c]&&(h+=i.showSeqCls.insertMulGap(i.seqEndLen[c],"-")),g=' '+t.toString()+" Residues",g+="",g+=" ",h+=g,p+=g}h+="",p+="",m+="",$("#"+i.pre+"dt_site_"+c).html(h),$("#"+i.pre+"ov_site_"+c).html(p),$("#"+i.pre+"tt_site_"+c).html(m)}}for(let e in i.protein_chainid)r.hasOwnProperty(e)||($("#"+i.pre+"dt_cdd_"+e).html(""),$("#"+i.pre+"ov_cdd_"+e).html(""),$("#"+i.pre+"tt_cdd_"+e).html(""),$("#"+i.pre+"dt_site_"+e).html(""),$("#"+i.pre+"ov_site_"+e).html(""),$("#"+i.pre+"tt_site_"+e).html(""));i.showAnnoCls.enableHlSeq(),i.bAjaxCddSite=!0}getNoCdd(e){let t=this.icn3d;t.icn3dui,console.log("No CDD data were found for the protein "+e+"...");for(let e in t.protein_chainid)$("#"+t.pre+"dt_cdd_"+e).html(""),$("#"+t.pre+"ov_cdd_"+e).html(""),$("#"+t.pre+"tt_cdd_"+e).html(""),$("#"+t.pre+"dt_site_"+e).html(""),$("#"+t.pre+"ov_site_"+e).html(""),$("#"+t.pre+"tt_site_"+e).html("");t.showAnnoCls.enableHlSeq(),t.bAjaxCddSite=!0}setDomainFeature(e,t,s,i,n,l,r,o,a){let d,c,h,p=this.icn3d,m=p.icn3dui,u="domain"!=s&&"feat"!=s;"domain"==s&&(r={},d={},c={},h={}),void 0===e&&(e=[]);let g=e.length,f="domain"==s?14:19,C="domain"==s?100:120;e.sort((function(e,t){let i=e.locs,n="domain"==s||"ig"==s?i[0].segs:[i[0]],l=Math.round(n[0].from);return i=t.locs,n="domain"==s||"ig"==s?i[0].segs:[i[0]],l-Math.round(n[0].from)}));for(let b=0;bf&&(w=w.substr(0,f)+"...");let S=u?a[b]:s+": "+v;"domain"==s&&(d[g]=v);let A=e[b].locs;if(A)for(let e=0,r=A.length;e'+w+" ",I=''+u.toString()+" Res";l+=R+I+" ";let E='';i+=R+I+E,"domain"==s&&(n+='
',a=o,d=o,c=0;for(let t in s.chainname2residues[e]){let n=s.chainname2residues[e][t];if(!n)continue;let l="Interact ."+t;l.length>17&&(l=l.substr(0,17)+"...");let r="Interact ."+t,h=[];for(let e=0,t=n.length;e'+l+"
",y=s[t].length,v=0,w=0;if(2==e&&(v=0,w=y),m){d=1;let r=0;for(let e=v;e0?w+="; ":0!==e&&1!==e||(O='disease="'+v[t]+'"'),w+=v[t]+"("+_[t]+")",++S;""!=w&&(r"+s[t][e],u+=": "+w,b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(m,"snpin3d","3D with scap","SNP in 3D with scap",70,g)+" ",u+=f.showAnnoCls.addSnpButton(m,"snpinter","Interactions","SNP Interactions in 3D",70,g)+" ",u+=f.showAnnoCls.addSnpButton(m,"snppdb","PDB","Download SNP PDB",35,g)),u+=" Links: ClinVar, dbSNP(rs"+i[t][e]+")",e "),++r)}r>d&&2==e&&(p+="..")}else{d=1;for(let e=v;e"+s[t][e],g)b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(r,"snpin3d","3D with scap","SNP in 3D with scap",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snpinter","Interactions","SNP Interactions in 3D",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snppdb","PDB","Download SNP PDB",35,m)),0!=i[t][e]&&(u+=" Link: dbSNP(rs"+i[t][e]+")"),e ");else{let s=l[t][e].split("; "),a=o[t][e].split("; "),d="",c=0;for(let t=0,i=s.length;t0?d+="; ":0!==e&&1!==e||(O='disease="'+s[t]+'"'),d+=s[t]+"("+a[t]+")",++c;""!=d?(u+=": "+d,b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(r,"snpin3d","3D with scap","SNP in 3D with scap",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snpinter","Interactions","SNP Interactions in 3D",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snppdb","PDB","Download SNP PDB",35,m)),u+=" Links: ClinVar, dbSNP(rs"+i[t][e]+")"):(b&&!C.cfg.hidelicense&&(u+=" "+f.showAnnoCls.addSnpButton(r,"snpin3d","3D with scap","SNP in 3D with scap",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snpinter","Interactions","SNP Interactions in 3D",70,m)+" ",u+=f.showAnnoCls.addSnpButton(r,"snppdb","PDB","Download SNP PDB",35,m)),u+=" Link: dbSNP(rs"+i[t][e]+")"),e ")}}y>d&&2==e&&(p+="..")}u+="
',O=''+f.toString()+" Pos";w+=x+O+" ",S+=k+O+" ";let R='';y+=x+O+R,v+=k+O+R,_+=x+O+R;let I=e.indexOf("_"),E="cst"+e.substr(I+1),T=0,P=0,D=(void 0===l||"seq"===l||"custom"===l)&&-1==s.indexOf("cannot-be-aligned")&&-1==s.indexOf("cannot be aligned"),M="identity"===l&&-1==s.indexOf("cannot-be-aligned")&&-1==s.indexOf("cannot be aligned"),F={},H=0;x="";let L={},N={},q={},U=0;if(h)for(let e=0,t=h.length;e"+d+"",h){let t='style="background-color:'+L[U]+'"';v+='";for(let t in m.residues[e+"_"+g]){let e=m.atoms[t];e.color=u.parasCls.thr(L[U]),m.atomPrevColors[t]=e.color}}x+=m.showSeqCls.insertGapOverview(e,t);let f=Math.round(m.seqAnnWidth*t/(m.maxAnnoLength+m.nTotalGap)-T-P);f<0&&(f=0),x+='
'}getExonColor(e,t,s){this.icn3d.icn3dui;let i=.5*(e+t);if(s1e-200&&(h=parseFloat(h).toExponential()),n.scores.bit_score;let p=t.targets[l].seqdata,m=i.seqdata,u=n.segs;for(let e=0,t=u.length;e0&&(l=n+"H"+d.toString().padStart(2,"0")+")","coil"==t&&(s.selectionCls.selectResidueList(r,l,l,o,a),o||(o=!0)),r={})),n=e+"_H"+d.toString().padStart(2,"0"),r[p]=1,i.ssend&&(h=e+"_C(H"+d.toString().padStart(2,"0"),"helix"==t&&(s.selectionCls.selectResidueList(r,n,n,o,a),o||(o=!0)),r={})):"E"==m?(i.ssbegin&&(++c,Object.keys(r).length>0&&(l=n+"S"+c.toString().padStart(2,"0")+")","coil"==t&&(s.selectionCls.selectResidueList(r,l,l,o,a),o||(o=!0)),r={})),n=e+"_S"+c.toString().padStart(2,"0"),r[p]=1,i.ssend&&(h=e+"_C(S"+c.toString().padStart(2,"0"),"sheet"==t&&(s.selectionCls.selectResidueList(r,n,n,o,a),o||(o=!0)),r={})):(n=h+"-",r[p]=1)}}Object.keys(r).length>0&&(l=n+"Cterm)","coil"==t&&s.selectionCls.selectResidueList(r,l,l,o,a))}defineIgstrand(e,t){let s=this.icn3d,i=s.icn3dui;$("#"+s.pre+"dl_definedsets").hasClass("ui-dialog-content")&&$("#"+s.pre+"dl_definedsets").dialog("isOpen")||(i.htmlCls.dialogCls.openDlg("dl_definedsets","Select sets"),$("#"+s.pre+"atomsCustom").resizable());let n={},l=!1,r=!0;if(s.hAtoms={},"igdomain"==t){let t=s.chain2igArray[e];if(t&&t.length>0)for(let i=0,o=t.length;i1e3&&"50"==C.substr(C.length-2,2)&&(n[y]=1):(d=s.residIgLoop.hasOwnProperty(y)?"igloop":"igstrand",u&&d!=c&&Object.keys(n).length>0&&("igstrand"==c?(++h,i="Strand-"+a+"-"+e+"-"+h.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igstrand"==t&&(s.selectionCls.selectResidueList(n,i,i,l,r),l||(l=!0)),m=a):"igloop"==c&&(++p,i="Loop-"+m+"_"+o+"-"+e+"-"+p.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igloop"==t&&(s.selectionCls.selectResidueList(n,i,i,l,r),l||(l=!0))),n={}),n[y]=1,a=o,c=d,u=!0)))}"iganchor"==t?(i="Anchor-"+e,s.selectionCls.selectResidueList(n,i,i,l,r)):"igstrand"==c?(++h,i="Strand-"+a+"-"+e+"-"+h.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igstrand"==t&&s.selectionCls.selectResidueList(n,i,i,l,r)):"igloop"==c&&(++p,o="CT",i="Loop-"+m+"_"+o+"-"+e+"-"+p.toString().padStart(3,"0"),i=i.replace(/'/g,"`"),"igloop"==t&&s.selectionCls.selectResidueList(n,i,i,l,r))}}simplifyText(e){this.icn3d.icn3dui;let t,s,i="",n=!1,l=-1;for(t=0,s=(e=e.replace(/undefined/g," ")).length;t20)return!1;if(void 0!==o.giSeq&&void 0!==o.giSeq[e]){let r=this.getFullText(s);return s=r.text,this.showNewTrack(e,t,s,void 0,void 0,i,n,l),!1}setTimeout((function(){a.checkGiSeq(e,t,s,i,n,l,r+1)}),100)}getFullText(e){this.icn3d.icn3dui;let t="",s=[],i=[],n=e.split(","),l=-1;for(let e=0,r=n.length;ep?t+=c.substr(0,p):t+=c;for(let e=0;ed&&(d=t.length,c=h),++h}o=n.htmlCls.baseUrl+"pwaln/pwaln.fcgi?from=msa";let p=e.split(","),m={};m[t]=0;for(let e=0,t=p.length;e0&&(g+=","+p.join(","));let f={targets:u,queries:g},C=await n.getAjaxPostPromise(o,f);if(!C.data)return void console.log("The protein accessions "+u+","+g+" can not be aligned...");let b=[];i.qt_start_end={};let y=[],v=[],_=Object.keys(C.targets)[0],w=C.targets[_].seqdata;p.splice(0,0,t);for(let e=0,s=p.length;eA&&(A=e)}let x=S,k=w.length-(A+1),O=[],R=[];for(let e=0,t=p.length;ea&&(a=t.length,d=c),++c}s.qt_start_end={};let m="genomeRes",u={};for(let e=0,i=h.length;ef&&(f=e)}for(let e=0,t=h.length;e0&&(d=h,o.targetGapHash[a+o.startposGiSeq]={from:a+o.startposGiSeq,to:d+m-1+o.startposGiSeq}),c=t[s],h=p,"-"!=t[s]?(++p,f=s,o.seqEndLen[e]=C-1-f,u||(g=s,o.seqStartLen[e]=g,u=!0)):++m;o.maxAnnoLength0&&(b+=" "),b+=e+"_"+o.targetGapHash[e].from+"_"+o.targetGapHash[e].to,++y;let v={};for(let a=0,d=i.length;a=o.seqStartLen[e]&&("-"==t[s]&&b--,"-"==h&&b++),c+=h,"-"!=t[s]&&(t[s]==i[a][s]&&++v[d],++d),p=h;"-"!=p&&u.push(C-1);let _=s[a].length<20?s[a]:s[a].substr(0,20)+"...",w=!0,S=r?r[s[a]]:void 0;this.showNewTrack(e,_,c,void 0,void 0,l,void 0,w,m,u,f,S,y)}o.opts.color="exon",o.legendTableCls.showColorLegend(o.opts.color),o.hlUpdateCls.updateHlAll(),o.drawCls.draw()}processAccList(e){this.icn3d.icn3dui;let t=e.split(","),s={},i="";for(let e=0,n=t.length;e5?(l.uniprot2acc&&l.uniprot2acc[y]&&(y=l.uniprot2acc[y]),f=y):f=e,y.length>5){let e="";for(let t=0,s=l.chainsSeq.length;t"),d=a[1].indexOf("\n");n=a[1].substr(d+1).replace(/\n/g,"");for(let e=2,t=a.length;e0&&($("#"+e.pre+"anno_cdd")[0].checked?(this.setAnnoTabCdd(),t.htmlCls.clickMenuCls.setLogCmd("set annotation cdd",!0)):(this.hideAnnoTabCdd(),t.htmlCls.clickMenuCls.setLogCmd("hide annotation cdd",!0)))}showAnnoSelectedChains(){let e=this.icn3d,t=e.icn3dui,s={};for(let t in e.hAtoms){let i=e.atoms[t];s[i.structure+"_"+i.chain]=1}$("#"+e.pre+"dl_annotations > .icn3d-annotation").hide();for(let i in s){$("#"+e.pre+"anno_"+i).length&&$("#"+e.pre+"anno_"+i).show();let s=e.firstAtomObjCls.getFirstCalphaAtomObj(e.chains[i]);if(void 0!==s.resn){let i=t.utilsCls.residueName2Abbr(s.resn.substr(0,3));$("#"+e.pre+"anno_"+i).show()}}}showAnnoAllChains(){let e=this.icn3d;e.icn3dui,$("#"+e.pre+"dl_annotations > .icn3d-annotation").show()}setAnnoView(e){let t=this.icn3d;t.icn3dui.bNode||("detailed view"===e?(t.view="detailed view",$("#"+t.pre+"dl_anno_view_tabs").tabs("option","active",1)):(t.view="overview",$("#"+t.pre+"dl_anno_view_tabs").tabs("option","active",0)))}setAnnoDisplay(e,t){let s=this.icn3d;s.icn3dui;let i=["giseq","custom","site","ptm","snp","clinvar","cdd","domain","interaction","ssbond","crosslink","transmem","ig"];for(let n in i){let l=i[n];$("[id^="+s.pre+t+"_"+l+"]").attr("style",e)}}showFixedTitle(){this.icn3d.icn3dui;this.setAnnoDisplay("display:block;","tt")}hideFixedTitle(){this.icn3d.icn3dui;this.setAnnoDisplay("display:none!important;","tt")}setAnnoViewAndDisplay(e){let t=this.icn3d;if(t.icn3dui,"detailed view"===e){this.setAnnoView("detailed view");let e="display:block;";this.setAnnoDisplay(e,"dt"),$("#"+t.pre+"seqguide_wrapper").attr("style",e),e="display:none;",this.setAnnoDisplay(e,"ov")}else{this.setAnnoView("overview"),this.hideFixedTitle();let e="display:none;";this.setAnnoDisplay(e,"dt"),$("#"+t.pre+"seqguide_wrapper").attr("style",e),e="display:block;",this.setAnnoDisplay(e,"ov")}}async updateClinvar(){let e=this.icn3d;if(e.icn3dui,void 0===e.bClinvarShown||!e.bClinvarShown)for(let t in e.protein_chainid){let s=e.protein_chainid[t];await e.annoSnpClinVarCls.showClinvar(t,s)}e.bClinvarShown=!0}async updateSnp(){let e=this.icn3d;if(e.icn3dui,void 0===e.bSnpShown||!e.bSnpShown)for(let t in e.protein_chainid){let s=e.protein_chainid[t];await e.annoSnpClinVarCls.showSnp(t,s)}e.bSnpShown=!0}updateDomain(){let e=this.icn3d;e.icn3dui,void 0!==e.bDomainShown&&e.bDomainShown||e.annoDomainCls.showDomainAll(),e.bDomainShown=!0}updateInteraction(){let e=this.icn3d;if(e.icn3dui,void 0===e.bInteractionShown||!e.bInteractionShown)for(let t in e.interactChainbase){let s=e.interactChainbase[t];e.annoContactCls.showInteraction(t,s)}e.bInteractionShown=!0}async updatePTM(){let e=this.icn3d;if(e.icn3dui,void 0===e.bPTMShown||!e.bPTMShown)for(let t in e.PTMChainbase){let s=e.PTMChainbase[t];await e.annoPTMCls.showPTM(t,s,"ptm")}e.bPTMShown=!0}updateSsbond(){let e=this.icn3d;if(e.icn3dui,void 0===e.bSSbondShown||!e.bSSbondShown)for(let t in e.ssbondChainbase){let s=e.ssbondChainbase[t];e.annoSsbondCls.showSsbond(t,s)}e.bSSbondShown=!0}updateCrosslink(){let e=this.icn3d;if(e.icn3dui,void 0===e.bCrosslinkShown||!e.bCrosslinkShown)for(let t in e.crosslinkChainbase){let s=e.crosslinkChainbase[t];e.annoCrossLinkCls.showCrosslink(t,s)}e.bCrosslinkShown=!0}async updateTransmem(){let e=this.icn3d,t=e.icn3dui;if(void 0===e.bTranememShown||!e.bTranememShown)for(let s in e.protein_chainid){let i=e.protein_chainid[s];if(void 0!==t.cfg.opmid)e.annoTransMemCls.showTransmem(s,i);else if(e.bAfMem&&e.afmem_start_end){let t=e.afmem_start_end[0],n=e.afmem_start_end[1];await e.annoPTMCls.showPTM(s,i,"afmem",t,n)}else await e.annoPTMCls.showPTM(s,i,"transmem")}e.bTranememShown=!0}async updateIg(e,t){let s=this.icn3d,i=s.icn3dui;if(s.opts.color="ig strand",!e){s.hAtoms={};for(let e in s.protein_chainid)s.hAtoms=i.hashUtilsCls.unionHash(s.hAtoms,s.chains[e])}let n=s.firstAtomObjCls.getResiduesFromAtoms(s.hAtoms);for(let e in n)s.resid2refnum&&delete s.resid2refnum[e],s.residIgLoop&&delete s.residIgLoop[e],s.resid2domainid&&delete s.resid2domainid[e];s.bRunRefnumAgain=!0;let l=e?s.firstAtomObjCls.getChainsFromAtoms(s.hAtoms):s.protein_chainid;for(let e in l)await s.annoIgCls.showIg(e,t),s.bRunRefnumAgain=!1;s.bShowRefnum&&(s.hlUpdateCls.updateHlAll(),s.drawCls.draw())}}class Pt{constructor(e){this.icn3d=e}showAnnotations_part1(e){let t=this.icn3d,s=t.icn3dui;if(s.htmlCls.dialogCls.openDlg("dl_selectannotations","Sequences and Annotations"),(void 0===t.bAssemblyNote||!t.bAssemblyNote)&&void 0!==t.asuCnt){let e="
Assembly Tips: Only the asymmetric unit is shown in the sequence window. Click \"Assembly\" in the menu \"View\" to switch between asymmetric unit and biological assembly("+t.asuCnt+" asymmetric unit).
"+o+"Annotations of "+c+": "+r+""+a+" "+this.addButton(s,"icn3d-addtrack","Add Track","Add a custom track",60,i)+" ";h+=this.addButton(s,"icn3d-customcolor","Custom Color/Tube","Use a custom file to define the colors or tubes in 3D structure",110,i)+" ",h+=this.addButton(s,"icn3d-helixsets","Helix Sets",'Define sets for each helix in this chain and add them to the menu of "Defined Sets"',60,i)+" "+this.addButton(s,"icn3d-sheetsets","Sheet Sets",'Define sets for each sheet in this chain and add them to the menu of "Defined Sets"',60,i)+" "+this.addButton(s,"icn3d-coilsets","Coil Sets",'Define sets for each coil in this chain and add them to the menu of "Defined Sets"',60,i),h+=" "+this.addButton(s,"icn3d-iganchorsets","Ig Anchor Set",'Define the set for all Ig anchors in this chain and add them to the menu of "Defined Sets"',80,i)+" "+this.addButton(s,"icn3d-igstrandsets","Ig Strand Sets",'Define sets for each Ig strand in this chain and add them to the menu of "Defined Sets"',80,i)+" "+this.addButton(s,"icn3d-igloopsets","Ig Loop Sets",'Define sets for each Ig loop in this chain and add them to the menu of "Defined Sets"',80,i)+" "+this.addButton(s,"icn3d-igdomainsets","Ig Domain Sets",'Define sets for each Ig domain in this chain and add them to the menu of "Defined Sets"',80,i),$("#"+e.pre+"dl_annotations").append(h);let p=["giseq","cdd","clinvar","snp","site","ptm","ssbond","crosslink","transmem","domain","custom","interaction","ig"];for(let t in p){let i=p[t];$("#"+e.pre+"anno_"+s).append(this.getAnDiv(s,i))}$("#"+e.pre+"anno_"+s).append(" "),++n}if(t.bNode||e.annoCddSiteCls.setToolTip(),void 0!==e.chainid_seq)await this.processSeqData(e.chainid_seq);else try{let n=[],l=[];for(let e=0,t=i.length;e=6?l.push(i[e]):n.push(i[e])}if(n.length>0){let s=t.htmlCls.baseUrl+"/vastdyn/vastdyn.cgi?chainlist="+n;e.chainid_seq=await t.getAjaxPromise(s,"jsonp")}else e.chainid_seq={};for(let t=0,s=l.length;t40&&(r=r.substr(0,40)+"...");let o="";0==i&&("protein"==s?o="Proteins:
",h+=c,p+=c,$("#"+n.pre+"dt_giseq_"+e).html(h),$("#"+n.pre+"ov_giseq_"+e).html(p)}async processSeqData(e){let t=this.icn3d,s=t.icn3dui;for(let i in t.protein_chainid){let n=t.protein_chainid[i];if(e.hasOwnProperty(n)){let s=e[n];t.giSeq[i]=s;let l="";for(let e=0;e<10&&e14?"Query: "+o.substr(0,6)+"...":isNaN(s.cfg.query_id)?"Query: "+o:"Query: gi "+o;let a="cannot be aligned";t.queryStart="",t.queryEnd="",t.bRender&&alert("The sequence can NOT be aligned to the structure"),t.showSeqCls.showSeq(i,n,void 0,e,l,a,r)}else if(s.cfg.blast_rep_id==i&&(void 0!==t.seqStructAlignData||void 0!==t.seqStructAlignDataSmithwm)){let e,l,r,o,a,d=s.cfg.oriQuery_id?s.cfg.oriQuery_id:s.cfg.query_id;if(e=d.length>14?"Query: "+d.substr(0,6)+"...":isNaN(s.cfg.query_id)?"Query: "+d:"Query: gi "+d,void 0!==t.seqStructAlignData){let e,s,i=t.seqStructAlignData;if(void 0!==i.data){e=i.data[0].query;let t=Object.keys(i.data[0].targets);s=i.data[0].targets[t[0]],s=void 0!==s&&s.hsps.length>0?s.hsps[0]:void 0}if(void 0!==e&&void 0!==s){l=s.scores.e_value.toPrecision(2),l>1e-200&&(l=parseFloat(l).toExponential()),s.scores.bit_score;let t=Object.keys(i.targets);r=i.targets[t[0]].seqdata,o=e.seqdata,a=s.segs}}else{let e=t.seqStructAlignDataSmithwm;l=e.score,r=e.target.replace(/-/g,""),o=e.query.replace(/-/g,""),a=[];let s=-1,i=-1,n=!1,d={};for(let t=0,l=e.target.length;t0)if(i.orifrom-ni.from-l)for(let t=n+1;t
":"2D integration graph for "+E.length+" structure(s) "+E+'. There are three sections: "Interactions", "Common interactions", and "Different interactions". Each section has '+E.length+" graphs.
",s+=""}else if(t){let e,t,l,c,h=p[0],m=o.length,u=a.length,g=1,f=3*g,C=7*g,b=30;t=(m+2)*(f+C)+2*10+b,e=(u+2)*(f+C)+2*10+b,i.scatterplotWidth=2*e,c=i.scatterplotWidth,l=n.scatterplotid,s=r.length>0?"":"No interactions found for these two sets
",s+=""}else{let e=p[0],t=o.length,l=a.length,c=1,h=3*c,m=7*c,u=110,g=10,f=t>l?t*(h+m)+2*g:l*(h+m)+2*g;i.linegraphWidth=2*f,s=r.length>0?"":"No interactions found for these two sets
",s+=""}return i.lineGraphStr+="}\n",i.scatterplotStr=i.lineGraphStr,t?$("#"+i.pre+"scatterplotDiv").html(s):$("#"+i.pre+"linegraphDiv").html(s),s}drawGraphPerType(e,t,s,i,n,l,r,o,a,d,c,h,p,m){let u=this.icn3d;u.icn3dui;let g,f,C="",b=2==t.length&&"2"==t[1].replace(t[0],"");0==e?(g="Interactions in ",f=""):1==e?(g="Common interactions in ",f="_common"):2==e&&(g="Different interactions in ",f="_diff");for(let y=0,v=t.length;y0&&(u.lineGraphStr+=", \n"):u.lineGraphStr+=", \n",u.lineGraphStr+=u.getGraphCls.updateGraphJson(t[y],y+f,i[y],n[y],l[y])}return{heightFinal:o,html:C}}getIdArrayFromNode(e){let t=this.icn3d.icn3dui,s=[];s.push(""),s.push("");let i=e.r.substr(4);return s=s.concat(t.utilsCls.getIdArray(i)),s}drawLineGraph_base(e,t,s,i,n,l,r){let o,a,d=this.icn3d,c=d.icn3dui,h="",p=e.length,m=t.length;p>m?(o=10,a=10*Math.abs(p-m)*.5+10):(a=10,o=10*Math.abs(p-m)*.5+10),l&&(h+=""+l+"");let u=30+n,g=80+n,f="",C={},b={};for(let t=0;t
The following sequence alignment shows the residue mapping of the best aligned sets: "symOri" and "symPerm", which are also available in the menu "Analysis > Defined Sets". ',$("#"+e.pre+"symd_info").html(A),s.setSeqAlignForSymmetry(_,w,S);let x=!1,k=t.htmlCls.alignSeqCls.getAlignSequencesAnnotations(Object.keys(e.alnChains),void 0,void 0,x,S);A=$("#"+e.pre+"dl_sequence2").html()+k.sequencesHtml,$("#"+e.pre+"dl_sequence2").html(A),$("#"+e.pre+"dl_sequence2").width(t.htmlCls.RESIDUE_WIDTH*k.maxSeqCnt+200),t.htmlCls.dialogCls.openDlg("dl_alignment","Select residues in aligned sequences from SymD");let O=Object.keys(e.defNames2Residues).length+Object.keys(e.defNames2Atoms).length,R="symOri"+O;e.selectionCls.selectResidueList(y,R,R),e.selectionCls.updateSelectionNameDesc(),t.htmlCls.clickMenuCls.setLogCmd("select "+e.resid2specCls.residueids2spec(Object.keys(y))+" | name "+R,!1),R="symPerm"+O,e.selectionCls.selectResidueList(v,R,R),e.selectionCls.updateSelectionNameDesc(),t.htmlCls.clickMenuCls.setLogCmd("select "+e.resid2specCls.residueids2spec(Object.keys(v))+" | name "+R,!1),R="symBoth"+O,y=t.hashUtilsCls.unionHash(y,v),e.selectionCls.selectResidueList(y,R,R),e.selectionCls.updateSelectionNameDesc(),t.htmlCls.clickMenuCls.setLogCmd("select "+e.resid2specCls.residueids2spec(Object.keys(y))+" | name "+R,!1)}}else $("#"+e.pre+"dl_symd").html(" The selected residues have no detected symmetry with a Z score of "+a.zscore+" from the program SymD."),t.htmlCls.dialogCls.openDlg("dl_symd","Dynamically Calculated Symmetry Using SymD");e.symdtitle="none"===h?void 0:h,e.drawCls.draw()}catch(s){return $("#"+e.pre+"dl_symd").html(" The web service can not determine the symmetry of the input set."),t.htmlCls.dialogCls.openDlg("dl_symd","Dynamically Calculated Symmetry Using SymD"),void e.ParserUtilsCls.hideLoading()}}getResObj(e){this.icn3d.icn3dui;let t=e.substr(0,e.indexOf(" ")),s=e.indexOf("$"),i=e.indexOf("."),n=e.indexOf(":"),l=e.substr(s+1,i-s-1),r=e.substr(i+1,n-i-1),o=e.substr(n+1);return{resn:t,resid:l+"_"+r+"_"+o,resi:o,aligned:!0}}setSeqAlignForSymmetry(e,t,s){let i=this.icn3d,n=i.icn3dui;i.conservedName1="symOri_cons",i.conservedName2="symPerm_cons",i.consHash1={},i.consHash2={},i.alnChainsAnTtl={},i.alnChainsAnno={},i.alnChainsSeq={},i.alnChains={},i.alnChainsSeq={};let l={};for(let r=0,o=e.length;rThis structure has no symmetry."),void i.htmlCls.dialogCls.openDlg("dl_symmetry","Symmetry")}let r,o,a,d=t.rcsb_struct_symmetry;if(void 0!==d){void 0!==s.rmsd_supr&&void 0!==s.rmsd_supr.rot&&(r=s.rmsd_supr.rot,o=s.rmsd_supr.trans1,a=s.rmsd_supr.trans2),s.symmetryHash={};for(let e=0,t=d.length;eThis structure has no symmetry.");else{let e="",t=0;for(let i in s.symmetryHash){e+="",++t}$("#"+s.pre+"selectSymmetry").html(e)}}else $("#"+s.pre+"dl_symmetry").html(" This structure has no symmetry.");i.htmlCls.dialogCls.openDlg("dl_symmetry","Symmetry")}getPolygonColor(e){let t=this.icn3d.icn3dui,s=e.substr(0,1);return"C"==s?t.parasCls.thr(16747520):"D"==s?t.parasCls.thr(65535):"T"==s?t.parasCls.thr(15631086):"O"==s?t.parasCls.thr(16753920):"I"==s?t.parasCls.thr(65280):t.parasCls.thr(11119017)}getAxisColor(e,t){let s=this.icn3d.icn3dui,i=e.substr(0,1);return"C"==i?s.parasCls.thr(16711680):"D"==i?2==t?s.parasCls.thr(65535):s.parasCls.thr(16711680):"T"==i?2==t?s.parasCls.thr(65535):s.parasCls.thr(65280):"O"==i||"I"==i?2==t?s.parasCls.thr(65535):3==t?s.parasCls.thr(65280):s.parasCls.thr(16711680):s.parasCls.thr(16711680)}}class xs{constructor(e){this.icn3d=e}alignSW(e,t,s,i,n,l,r){this.icn3d.icn3dui;let o=this.bsa_align(r,e,t,[s,i],[n,l]),a="score: "+o[0]+"\n";a+="start: "+o[1]+"\n",a+="cigar: "+this.bsa_cigar2str(o[2])+"\n\n",a+="alignment:\n\n";let d=this.bsa_cigar2gaps(e,t,o[1],o[2]),c={};return c.score=o[0],c.start=o[1],c.cigar=this.bsa_cigar2str(o[2]),c.target=d[0],c.query=d[1],c}bsg_enc_seq(e,t){if(this.icn3d.icn3dui,null==t)return null;let s=[];s.length=e.length;for(let i=0;i0&&(s=-s),i=0;i=2&&"number"==typeof t[0]&&"number"==typeof t[1]){if(null==s)return null;let e="number"==typeof s?s:s[s.length-1]+1;i=this.bsa_gen_score_matrix(e,t[0],t[1])}else i=t;for(let e=0;eo.length?d:o.length;l=null==l||l<0?c:l;let h,p,m=o.target>d?o.target-d:d-o.target;l=l>m?l:m,"number"==typeof n?(h=0,p=n>0?n:-n):(h=n[0]>0?n[0]:-n[0],p=n[1]>0?n[1]:-n[1]);let u,g=h+p,f=-1073741824,C=[],b=[],y=[],v=0,_=-1,w=-1;if(e)for(let e=0;e<=d;++e)C[e]=b[e]=0;else{C[0]=0,b[0]=-g-g;for(let e=1;e<=d;++e)e>=l?C[e]=b[e]=f:(C[e]=-(g+p*(e-1)),b[e]=-(g+g+p*e))}for(let t=0;tl?t-l:0,u=t+l+10?f:-(g+p*t),n=m>0?f:-(g+g+p*t));for(let t=m;t=o?0:1,a=a>=o?a:o,l=a>=n?l:2,a=a>=n?a:n,l=!e||a>0?l:64,i=a,c=r>a?c:t,r=r>a?r:a,a-=g,a=!e||a>0?a:0,o-=p,l|=o>a?4:0,o=o>a?o:a,b[t]=o,n-=p,l|=n>a?32:0,n=n>a?n:a,s[t]=l}C[u]=i,b[u]=e?0:f,r>v&&(v=r,_=t,w=c)}if(e&&0==v)return null;u=e?v:C[d];let S,A,x,k=[],O=0,R=0;for(e?(A=_,x=w,w!=d-1&&this.push_cigar(k,4,d-1-w)):(A=o.length-1,x=(A+l+1=0&&x>=0&&(S=y[A][x-(A>l?A-l:0)],O=S>>(O<<1)&3,!(0==O&&S>>6));)0==O&&(O=3&S),0==O?(this.push_cigar(k,0,1),--A,--x):1==O?(this.push_cigar(k,2,1),--A):(this.push_cigar(k,1,1),--x);e?(x>=0&&this.push_cigar(k,4,x+1),R=A+1):(A>=0&&this.push_cigar(k,2,A+1),x>=0&&this.push_cigar(k,1,x+1));for(let e=0;e>1;++e)S=k[e],k[e]=k[k.length-1-e],k[k.length-1-e]=S;return[u,R,k]}push_cigar(e,t,s){this.icn3d.icn3dui,0==e.length||t!=(15&e[e.length-1])?e.push(s<<4|t):e[e.length-1]+=s<<4}bsa_cigar2gaps(e,t,s,i){this.icn3d.icn3dui;let n="",l="",r="",o=0,a=s;for(let s=0;s>4;0==r?(n+=t.substr(o,d),l+=e.substr(a,d),o+=d,a+=d):1==r?(n+=t.substr(o,d),l+=Array(d+1).join("-"),o+=d):2==r?(n+=Array(d+1).join("-"),l+=e.substr(a,d),a+=d):4==r&&(o+=d)}let d=l.toUpperCase(),c=n.toUpperCase();for(let e=0;e>4).toString()+"MIDNSHP=XB".charAt(15&e[s]));return t.join("")}}class ks{constructor(e){this.icn3d=e}calculateArea(){var e=this.icn3d,t=e.icn3dui;e.bCalcArea=!0,e.opts.surface="solvent accessible surface",e.applyMapCls.applySurfaceOptions(),$("#"+e.pre+"areavalue").val(e.areavalue),$("#"+e.pre+"areatable").html(e.areahtml),t.htmlCls.dialogCls.openDlg("dl_area","Surface area calculation"),e.bCalcArea=!1}calcBuriedSurface(e,t){var s=this.icn3d,i=s.icn3dui;if(0==e.length)alert("Please select the first set");else{let n=i.hashUtilsCls.cloneHash(s.hAtoms),l=s.definedSetsCls.getAtomsFromNameArray(e),r=s.definedSetsCls.getAtomsFromNameArray(t);s.bCalcArea=!0,s.opts.surface="solvent accessible surface",s.hAtoms=i.hashUtilsCls.cloneHash(l),s.applyMapCls.applySurfaceOptions();let o=s.areavalue,a=i.hashUtilsCls.cloneHash(s.resid2area);s.hAtoms=i.hashUtilsCls.cloneHash(r),s.applyMapCls.applySurfaceOptions();let d=s.areavalue,c=i.hashUtilsCls.cloneHash(s.resid2area);s.hAtoms=i.hashUtilsCls.unionHash(s.hAtoms,l),s.applyMapCls.applySurfaceOptions();let h=s.areavalue,p=i.hashUtilsCls.cloneHash(s.resid2area),m=0,u=0,g=0,f=0;for(let e in a)p.hasOwnProperty(e)&&(f+=parseFloat(p[e]));u=(o-f).toFixed(2);for(let e in c)p.hasOwnProperty(e)&&(g+=parseFloat(p[e]));m=(d-g).toFixed(2),s.bCalcArea=!1,s.hAtoms=i.hashUtilsCls.cloneHash(n);let C=(parseFloat(d)+parseFloat(o)-parseFloat(h)).toFixed(2),b=" Calculate solvent accessible surface area in the interface:
";b+="Set 1: "+e+", Surface: "+o+" Å2 ",b+="Set 2: "+t+", Surface: "+d+" Å2 ",b+="Total Surface: "+h+" Å2 ",b+="Buried Surface for Set 1: "+u+" Å2 ",b+="Buried Surface for Set 2: "+m+" Å2
",$("#"+s.pre+"dl_buriedarea_html").html(b),i.htmlCls.dialogCls.openDlg("dl_buriedarea","Buried solvent accessible surface area in the interface"),i.htmlCls.clickMenuCls.setLogCmd("buried surface "+C,!1)}}measureDistTwoSets(e,t){var s=this.icn3d,i=s.icn3dui;if(0==e.length||0==t.length)alert("Please select two sets");else{let n=i.hashUtilsCls.cloneHash(s.hAtoms),l=s.definedSetsCls.getAtomsFromNameArray(e),r=s.definedSetsCls.getAtomsFromNameArray(t),o=s.contactCls.getExtent(l),a=s.contactCls.getExtent(r),d=new THREE.Vector3(o[2][0],o[2][1],o[2][2]),c=new THREE.Vector3(a[2][0],a[2][1],a[2][2]);s.hAtoms=i.hashUtilsCls.cloneHash(n),void 0===s.distPnts&&(s.distPnts=[]),s.distPnts.push(d),s.distPnts.push(c);let h=$("#"+s.pre+"distancecolor2").val();this.addLine(d.x,d.y,d.z,c.x,c.y,c.z,h,!0,"distance");let p=0,m=0,u=d.clone().add(c).multiplyScalar(.5),g=(parseInt(10*d.distanceTo(c))/10).toString()+" A";this.addLabel(g,u.x,u.y,u.z,p,h,m,"distance"),s.drawCls.draw()}}measureDistManySets(e,t){var s=this.icn3d,i=s.icn3dui;if(0==e.length||0==t.length)alert("Please select sets for distance calculation...");else{let n=i.hashUtilsCls.cloneHash(s.hAtoms),l={};for(let i=0,n=e.length;i
";for(let e=0,s=t.length;e"+t[e]+" (Å)"}r+="
";for(let s=0,i=e.length;s
"+i+" (Å)
";for(let e=0,s=t.length;e'+l[i][s]+"":r+="
0
"}r+=""}r+="
",$("#"+i.pre+"dl_disttable_html").html(r)}}measureAngleManySets(e,t){var s=this.icn3d,i=s.icn3dui;if(0==e.length||0==t.length)alert("Please select sets for angleance calculation...");else{let n={};for(let i=0,l=e.length;i180&&(d-=180),d>90&&(d=180-d),n[l][i]=d}}let l="
";for(let e=0,s=t.length;e"+t[e]+" (°)"}l+="
";for(let s=0,i=e.length;s
"+i+" (°)
";for(let e=0,s=t.length;e"+n[i][s]+"":l+="
0
"}l+=""}l+="
",$("#"+i.pre+"dl_angletable_html").html(l)}}addLine(e,t,s,i,n,l,r,o,a,d,c){var h=this.icn3d;h.icn3dui;let p={};p.position1=new THREE.Vector3(e,t,s),p.position2=new THREE.Vector3(i,n,l),p.color=r,p.dashed=o,p.radius=d,p.opacity=c,void 0===h.lines[a]&&(h.lines[a]=[]),void 0!==a?h.lines[a].push(p):(void 0===h.lines.custom&&(h.lines.custom=[]),h.lines.custom.push(p)),h.hlObjectsCls.removeHlObjects()}addLineFromPicking(e){var t=this.icn3d,s=t.icn3dui;let i=$("#"+t.pre+e+"color").val();t.pAtom.coord.x,t.pAtom2.coord.x,t.pAtom.coord.y,t.pAtom2.coord.y,t.pAtom.coord.z,t.pAtom2.coord.z;let n="stabilizer"!=e;s.htmlCls.clickMenuCls.setLogCmd("add line | x1 "+t.pAtom.coord.x.toPrecision(4)+" y1 "+t.pAtom.coord.y.toPrecision(4)+" z1 "+t.pAtom.coord.z.toPrecision(4)+" | x2 "+t.pAtom2.coord.x.toPrecision(4)+" y2 "+t.pAtom2.coord.y.toPrecision(4)+" z2 "+t.pAtom2.coord.z.toPrecision(4)+" | color "+i+" | dashed "+n+" | type "+e,!0),this.addLine(t.pAtom.coord.x,t.pAtom.coord.y,t.pAtom.coord.z,t.pAtom2.coord.x,t.pAtom2.coord.y,t.pAtom2.coord.z,i,n,e),t.pickpair=!1}addLabel(e,t,s,i,n,l,r,o){var a=this.icn3d;a.icn3dui;let d={};"0"!==n&&""!==n&&"undefined"!==n||(n=void 0),"0"!==l&&""!==l&&"undefined"!==l||(l=void 0),"0"!==r&&""!==r&&"undefined"!==r||(r=void 0);let c=new THREE.Vector3;c.x=t,c.y=s,c.z=i,d.position=c,d.text=e,d.size=n,d.color=l,d.background=r,void 0===a.labels[o]&&(a.labels[o]=[]),void 0!==o?a.labels[o].push(d):(void 0===a.labels.custom&&(a.labels.custom=[]),a.labels.custom.push(d)),a.hlObjectsCls.removeHlObjects()}addChainLabels(e){var t=this.icn3d;let s=t.icn3dui.hashUtilsCls.intHash(t.hAtoms,e);void 0===t.labels.chain&&(t.labels.chain=[]);let i=t.firstAtomObjCls.getChainsFromAtoms(s);for(let e in i){let s={};s.position=t.applyCenterCls.centerAtoms(t.chains[e]).center;let i=e.indexOf("_"),n=e.substr(i+1),l=t.showSeqCls.getProteinName(e);l.length>20&&(l=l.substr(0,20)+"..."),s.text="Chain "+n+": "+l,s.size=18,t.firstAtomObjCls.getFirstCalphaAtomObj(t.chains[e]).color.getHexString().toUpperCase(),s.color="black"!=t.opts.background?t.colorWhitebkgd:t.colorBlackbkgd,s.background="#FFFFFF",t.labels.chain.push(s)}t.hlObjectsCls.removeHlObjects()}addTerminiLabels(e){var t=this.icn3d,s=t.icn3dui;let i,n="#FFFFFF";i=s.hashUtilsCls.unionHash(i,t.proteins),i=s.hashUtilsCls.unionHash(i,t.nucleotides);let l=s.hashUtilsCls.intHash(t.dAtoms,i),r=s.hashUtilsCls.intHash(l,e);void 0===t.labels.chain&&(t.labels.chain=[]);let o=t.firstAtomObjCls.getChainsFromAtoms(r);for(let e in o){let i=s.hashUtilsCls.intHash(l,t.chains[e]),r=Object.keys(i),o=t.atoms[r[0]],a=t.atoms[r[r.length-1]],d={},c={};d.position=o.coord,c.position=a.coord,d.text="N-",c.text="C-",t.nucleotides.hasOwnProperty(o.serial)&&(d.text="5'",c.text="3'"),d.size=18,c.size=18,o.color.getHexString().toUpperCase(),a.color.getHexString().toUpperCase(),d.color="black"!=t.opts.background?t.colorWhitebkgd:t.colorBlackbkgd,c.color="black"!=t.opts.background?t.colorWhitebkgd:t.colorBlackbkgd,d.background=n,c.background=n,t.labels.chain.push(d),t.labels.chain.push(c)}t.hlObjectsCls.removeHlObjects()}}class Os{constructor(e){this.icn3d=e}draw2Ddgm(e,t,s,i){let n=this.icn3d,l=n.icn3dui,r=.667,o={},a={},d={},c={},h={};if(void 0===e)return"";for(let s in e.moleculeInfor){let i="#"+("000000"+e.moleculeInfor[s].color.toString(16)).slice(-6),l=e.moleculeInfor[s].chain.trim();void 0===h[l]?h[l]=1:++h[l];let r=t+"_"+(1===h[l]?l:l+h[l].toString());void 0!==n.mmdbid_q&&(n.mmdbid_q,n.mmdbid_t),o[s]=r,a[s]=i,d[s]=e.moleculeInfor[s].name,c[r]=s}if(void 0===i||!i)for(let s=0,i=e.intracResidues.length;s";p+=""+t.toUpperCase()+" ",p+="",p+="",n.html2ddgm+=p,$("#"+n.pre+"dl_2ddgm_html").html(n.html2ddgm),p}set2DdgmNote(e){let t="
Nodes: ";return this.icn3d.icn3dui.utilsCls.isMac()?(t+="◯Protein ",t+="▢Nucleotide ",t+="♢Chemical ",t+="▢Biopolymer "):(t+="OProtein ",t+="▢Nucleotide ",t+="◇Chemical ",t+="▢Biopolymer "),t+=" Lines: Interactions at 4 Å ",e&&(t+="Numbers in red: Aligned chains"),t+="
\n\n",s.saveFileCls.saveFile(r+"-"+t+".html","html",i)}e&&void 0===t.shortLink&&s.saveFileCls.saveFile(r+"_icn3d_loadable.png","png");let i=o.split("page.link/");2==i.length&&(o="https://structure.ncbi.nlm.nih.gov/icn3d/share.html?"+i[1]),$("#"+s.pre+"short_url").val(o),$("#"+s.pre+"short_url_title").val(o+"&t="+s.yournote)}let a=this.shareLinkUrl(void 0,!0),d="view = icn3dpy.view(q='"+(i.cfg.url?"url="+i.cfg.url:i.cfg.idname+"="+i.cfg.idvalue)+"',command='"+a+"')\nview";(i.cfg.url||i.cfg.idname)&&$("#"+s.pre+"jn_commands").val(d),$("#"+s.pre+"ori_url").val(n),e||i.htmlCls.dialogCls.openDlg("dl_copyurl","Copy a Share Link URL or Jupyter Notebook Commands")}getShareLinkPrms(e,t){let s=this.icn3d,i=s.icn3dui;return new Promise((function(n,l){$.ajax({url:"https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=AIzaSyBxl9CgM0dY5lagHL4UOhEpLWE1fuwdnvc",type:"POST",data:{longDynamicLink:"https://icn3d.page.link/?link="+encodeURIComponent(e)},dataType:"json",success:function(e){n(e)},error:function(n,l,r){let o="Problem in getting shortened URL";$("#"+s.pre+"ori_url").val(e),$("#"+s.pre+"short_url").val(o),$("#"+s.pre+"short_url_title").val(o+"&t="+s.yournote),t||i.htmlCls.dialogCls.openDlg("dl_copyurl","Copy a Share Link URL")}})}))}shareLinkUrl(e,t){let s=this.icn3d,i=s.icn3dui,n=i.htmlCls.baseUrl+"icn3d/?",l="";if(i.cfg.bSidebyside&&(n=i.htmlCls.baseUrl+"icn3d/full2.html?"),s.bInputUrlfile){n=window.location.href.split("?")[0]+"?"+s.inputurl+"&"}let r,o={};for(let e in s.cfg){let t=s.cfg[e];"inpara"!==e&&"command"!==e&&"usepdbnum"!==e&&"date"!==e&&"v"!==e&&void 0!==t&&("width"===e&&"100%"===t||"height"===e&&"100%"===t||"resize"===e&&!0===t||"showmenu"===e&&!0===t||"showtitle"===e&&!0===t||"showcommand"===e&&!0===t||"mobilemenu"===e&&!1===t||"showanno"===e&&!1===t||"showseq"===e&&!1===t||"showalignseq"===e&&!1===t||"show2d"===e&&!1===t||"showsets"===e&&!1===t||"rotate"===e&&"right"===t||"command"!==e&&("options"===e?Object.keys(t).length>0&&(o[e]=JSON.stringify(t)):!0===t?o[e]=1:!1===t?o[e]=0:""!==t&&(o[e]=t)))}s.bAfMem?o.afmem="on":(i.cfg.afid||1==Object.keys(s.structures).length&&Object.keys(s.structures)[0].length>5)&&(o.afmem="off");let a=-1;void 0!==i.cfg.inpara&&(a=i.cfg.inpara.indexOf("&command=")),r=-1!==a?i.cfg.inpara.substr(0,a):i.cfg.inpara;let d=!1;if(!s.bInputUrlfile){let e=r&&r.substr(1)?r.substr(1).split("&"):[];for(let t=0,s=e.length;tc){u=s.commands[c].split("|||")[0].split("&command=")[0].trim(),-1!==u.indexOf(g)&&++f}let C,b=c+1,y="";for(let e=s.commands.length;b0&&f%2==0&&u!==g&&(y+=g+"; "),y+=u+"|||"+s.transformCls.getTransformationStr(p),m+=u+"|||"+s.transformCls.getTransformationStr(p)+"\n"),n+=y,l=y,m=m.replace(/!/g,Object.keys(s.structures)[0]+"_"),(s.bEsmfold||s.bInputfile&&!s.bInputUrlfile||s.bInputUrlfile&&s.bAppend||n.length>4e3)&&(n=m),void 0!==s.structures&&1==Object.keys(s.structures).length&&void 0!==s.inputid&&(C=Object.keys(s.structures)[0],n=n.replace(new RegExp(C+"_","g"),"!"),l=l.replace(new RegExp(C+"_","g"),"!")),void 0!==i.cfg.blast_rep_id&&(n=n.replace(new RegExp("blast_rep_id=!","g"),"blast_rep_id="+C+"_")),t?l:n}getPngText(){let e,t=this.icn3d;t.icn3dui;let s="";if(t.bInputfile)e=this.shareLinkUrl(true),"http"==e.substr(0,4)?s+="\nShare Link: "+e:(s+="\nStart of type file======\n",s+="pdb\n",s+="End of type file======\n",s+="Start of data file======\n",s+=t.saveFileCls.getAtomPDB(t.atoms),s+="End of data file======\n",s+="Start of state file======\n",s+=e+"\n",s+="End of state file======\n");else{e=this.shareLinkUrl(),e.length>4e3||0!==e.indexOf("http")?(e=this.shareLinkUrl(true),s+="\nStart of state file======\n",s+=e+"\n",s+="End of state file======\n"):s+="\nShare Link: "+e}return s=s.replace(/!/g,Object.keys(t.structures)[0]+"_"),s}}class Ps{constructor(e){this.icn3d=e}setThichknessFor3Dprint(){let e=this.icn3d,t=e.icn3dui;e.lineRadius=1,e.coilWidth=1.2,e.cylinderRadius=.8,e.crosslinkRadius=.8,e.traceRadius=1,e.dotSphereScale=.6,e.sphereRadius=1.5,e.ribbonthickness=1,e.helixSheetWidth=2,e.nucleicAcidWidth=1.4,t.htmlCls.setHtmlCls.setCookieForThickness()}prepareFor3Dprint(){let e=this.icn3d,t=e.icn3dui;if(e.bShowHighlight=!1,e.hlObjectsCls.removeHlObjects(),e.bDashedLines=!1,e.bSetThickness||void 0!==t.cfg.cid||this.setThichknessFor3Dprint(),void 0!==e.lines.hbond)for(let t=0,s=e.lines.hbond.length;tt.substr(0,s))return 1;if(e.substr(0,s)==t.substr(0,s)){if(parseInt(e.substr(s+1))parseInt(t.substr(i+1)))return 1;if(parseInt(e.substr(s+1))==parseInt(t.substr(i+1)))return 0}}})),n="
The following sequence alignment shows the residue mapping of the best aligned sets: "symOri" and "symPerm", which are also available in the menu "Analysis > Defined Sets". ',$("#"+e.pre+"symd_info").html(A),s.setSeqAlignForSymmetry(_,w,S);let x=!1,k=t.htmlCls.alignSeqCls.getAlignSequencesAnnotations(Object.keys(e.alnChains),void 0,void 0,x,S);A=$("#"+e.pre+"dl_sequence2").html()+k.sequencesHtml,$("#"+e.pre+"dl_sequence2").html(A),$("#"+e.pre+"dl_sequence2").width(t.htmlCls.RESIDUE_WIDTH*k.maxSeqCnt+200),t.htmlCls.dialogCls.openDlg("dl_alignment","Select residues in aligned sequences from SymD");let O=Object.keys(e.defNames2Residues).length+Object.keys(e.defNames2Atoms).length,R="symOri"+O;e.selectionCls.selectResidueList(y,R,R),e.selectionCls.updateSelectionNameDesc(),t.htmlCls.clickMenuCls.setLogCmd("select "+e.resid2specCls.residueids2spec(Object.keys(y))+" | name "+R,!1),R="symPerm"+O,e.selectionCls.selectResidueList(v,R,R),e.selectionCls.updateSelectionNameDesc(),t.htmlCls.clickMenuCls.setLogCmd("select "+e.resid2specCls.residueids2spec(Object.keys(v))+" | name "+R,!1),R="symBoth"+O,y=t.hashUtilsCls.unionHash(y,v),e.selectionCls.selectResidueList(y,R,R),e.selectionCls.updateSelectionNameDesc(),t.htmlCls.clickMenuCls.setLogCmd("select "+e.resid2specCls.residueids2spec(Object.keys(y))+" | name "+R,!1)}}else $("#"+e.pre+"dl_symd").html(" The selected residues have no detected symmetry with a Z score of "+a.zscore+" from the program SymD."),t.htmlCls.dialogCls.openDlg("dl_symd","Dynamically Calculated Symmetry Using SymD");e.symdtitle="none"===h?void 0:h,e.drawCls.draw()}catch(s){return $("#"+e.pre+"dl_symd").html(" The web service can not determine the symmetry of the input set."),t.htmlCls.dialogCls.openDlg("dl_symd","Dynamically Calculated Symmetry Using SymD"),void e.ParserUtilsCls.hideLoading()}}getResObj(e){this.icn3d.icn3dui;let t=e.substr(0,e.indexOf(" ")),s=e.indexOf("$"),i=e.indexOf("."),n=e.indexOf(":"),l=e.substr(s+1,i-s-1),r=e.substr(i+1,n-i-1),o=e.substr(n+1);return{resn:t,resid:l+"_"+r+"_"+o,resi:o,aligned:!0}}setSeqAlignForSymmetry(e,t,s){let i=this.icn3d,n=i.icn3dui;i.conservedName1="symOri_cons",i.conservedName2="symPerm_cons",i.consHash1={},i.consHash2={},i.alnChainsAnTtl={},i.alnChainsAnno={},i.alnChainsSeq={},i.alnChains={},i.alnChainsSeq={};let l={};for(let r=0,o=e.length;rThis structure has no symmetry."),void i.htmlCls.dialogCls.openDlg("dl_symmetry","Symmetry")}let r,o,a,d=t.rcsb_struct_symmetry;if(void 0!==d){void 0!==s.rmsd_supr&&void 0!==s.rmsd_supr.rot&&(r=s.rmsd_supr.rot,o=s.rmsd_supr.trans1,a=s.rmsd_supr.trans2),s.symmetryHash={};for(let e=0,t=d.length;eThis structure has no symmetry.");else{let e="",t=0;for(let i in s.symmetryHash){e+="",++t}$("#"+s.pre+"selectSymmetry").html(e)}}else $("#"+s.pre+"dl_symmetry").html(" This structure has no symmetry.");i.htmlCls.dialogCls.openDlg("dl_symmetry","Symmetry")}getPolygonColor(e){let t=this.icn3d.icn3dui,s=e.substr(0,1);return"C"==s?t.parasCls.thr(16747520):"D"==s?t.parasCls.thr(65535):"T"==s?t.parasCls.thr(15631086):"O"==s?t.parasCls.thr(16753920):"I"==s?t.parasCls.thr(65280):t.parasCls.thr(11119017)}getAxisColor(e,t){let s=this.icn3d.icn3dui,i=e.substr(0,1);return"C"==i?s.parasCls.thr(16711680):"D"==i?2==t?s.parasCls.thr(65535):s.parasCls.thr(16711680):"T"==i?2==t?s.parasCls.thr(65535):s.parasCls.thr(65280):"O"==i||"I"==i?2==t?s.parasCls.thr(65535):3==t?s.parasCls.thr(65280):s.parasCls.thr(16711680):s.parasCls.thr(16711680)}}class xs{constructor(e){this.icn3d=e}alignSW(e,t,s,i,n,l,r){this.icn3d.icn3dui;let o=this.bsa_align(r,e,t,[s,i],[n,l]),a="score: "+o[0]+"\n";a+="start: "+o[1]+"\n",a+="cigar: "+this.bsa_cigar2str(o[2])+"\n\n",a+="alignment:\n\n";let d=this.bsa_cigar2gaps(e,t,o[1],o[2]),c={};return c.score=o[0],c.start=o[1],c.cigar=this.bsa_cigar2str(o[2]),c.target=d[0],c.query=d[1],c}bsg_enc_seq(e,t){if(this.icn3d.icn3dui,null==t)return null;let s=[];s.length=e.length;for(let i=0;i0&&(s=-s),i=0;i=2&&"number"==typeof t[0]&&"number"==typeof t[1]){if(null==s)return null;let e="number"==typeof s?s:s[s.length-1]+1;i=this.bsa_gen_score_matrix(e,t[0],t[1])}else i=t;for(let e=0;eo.length?d:o.length;l=null==l||l<0?c:l;let h,p,m=o.target>d?o.target-d:d-o.target;l=l>m?l:m,"number"==typeof n?(h=0,p=n>0?n:-n):(h=n[0]>0?n[0]:-n[0],p=n[1]>0?n[1]:-n[1]);let u,g=h+p,f=-1073741824,C=[],b=[],y=[],v=0,_=-1,w=-1;if(e)for(let e=0;e<=d;++e)C[e]=b[e]=0;else{C[0]=0,b[0]=-g-g;for(let e=1;e<=d;++e)e>=l?C[e]=b[e]=f:(C[e]=-(g+p*(e-1)),b[e]=-(g+g+p*e))}for(let t=0;tl?t-l:0,u=t+l+1