diff --git a/CHANGELOG.md b/CHANGELOG.md index ab43592..bc6c9b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file, following t +## [v0.3] - 2016-01-11 +### Added +- --script arguments +- versioneer +- DOC: installation & deployment, usage, scripting + +### Changed +- major ngl update to version 0.10.0-dev5 ## [v0.2] - 2016-02-12 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 143f913..fb45151 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -7,6 +7,23 @@ Follow semantic versioning and make sure the changelog is up-to-date. For non prerelease level also update [README.md](README.md) and [CHANGELOG.md](CHANGELOG.md) and make a release on github including copying the relevant info from the changelog file there. +We use [Versioneer](https://github.com/warner/python-versioneer) to automatically update the version string (of a release but also in development). This means for a release a new git tag should be created. The tag should be of the form vX.Y or vX.Y.Z and generally follow [pep440](https://www.python.org/dev/peps/pep-0440/) with a prefixed "v". + +```bash +git tag -a vX.Y -m "version X.Y" +git push +git push origin --tags +python setup.py sdist upload -r pypi # better use twine for uploading, see below +``` + +To ensure a secure upload use `twine`: +```bash +# Create some distributions in the normal way: +python setup.py sdist +# Upload with twine: +twine upload dist/* +``` + Development =========== diff --git a/LICENSE b/LICENSE index 85a2423..b3b8b7a 100644 --- a/LICENSE +++ b/LICENSE @@ -5,7 +5,7 @@ For license texts see at the end of this document. ////////// // MDsrv - The MIT License, Copyright © 2013-2016 Alexander S. Rose + The MIT License, Copyright © 2013-2017 Alexander S. Rose applies to all files unless otherwise noted @@ -13,7 +13,7 @@ For license texts see at the end of this document. ////////// // NGL - The MIT License, Copyright © 2013-2016 Alexander S. Rose + The MIT License, Copyright © 2013-2017 Alexander S. Rose applies to all files unless otherwise noted (excluding files in tmp/*). diff --git a/MANIFEST.in b/MANIFEST.in index dc5d50a..f2a805a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ graft mdsrv/webapp -include LICENSE README.md +include LICENSE README.md DEVELOPMENT.md CHANGELOG.md include setup.py -global-exclude *.pyc \ No newline at end of file +include mdsrv/_version.py versioneer.py +global-exclude *.pyc diff --git a/README.md b/README.md index d8bf3e5..8932c04 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ MDsrv is a simple server that enables remote access to coordinate trajectories from molecular dynamics simulations. It can be used together with the NGL Viewer (http://github.com/arose/ngl) to interactively view trajectories of molecular complexes in a web-browser, either within a local network or from anywhere over the internet. See it in action: -* [Web application](http://proteinformatics.charite.de/ngl/html/mdsrv.dev.html?load=file://MDsrv/example.ngl) +* [Web application](http://proteinformatics.charite.de/MDsrv-example) * [Documentation](http://arose.github.io/mdsrv/) @@ -34,7 +34,7 @@ Table of contents Documentation ============ -Detailed information concerning the installation, deployment and usage can be found at the [documentation](http://arose.github.io/mdsrv/). +Detailed information concerning the installation, deployment, usage and scripting examples can be found at the [documentation](http://arose.github.io/mdsrv/). Installation @@ -71,7 +71,7 @@ Deployment The Apache Webserver can used to run the server via `mod_wsgi`. First make sure you have everything required installed: - sudo apt-get install git apache2 libapache2-mod-wsgi + sudo apt-get install apache2 libapache2-mod-wsgi Then you need to create a wsgi configuration file to be referenced in the Apache configuration. There is an example named [mdsrv.wsgi.sample](mdsrv.wsgi.sample) in the root directory of this package. Also, a snippet showing how the configuration for Apache should look like can be found in the [apache.config.sample](apache.config.sample) file. @@ -80,104 +80,16 @@ Finally, to restart apache issue sudo /etc/init.d/apache2 restart - +More information can be found at the [documentation](http://arose.github.io/mdsrv/). RESTful API =========== The RESTful API is the interface through which the web application gets all data but it may be also used to access the served trajectory data from other applications. +You can retrieve information about directory content (e.g. name of sub-directory, file name, file size), number of frames and frame coordinates. -File content ------------- - -To retrieve a file from `data_dir` `` with file path `` call: - - /file// - - -Directory content description ------------------------------ - -To get a JSON description of available `data_dir` directories call: - - /dir/ - - -To get a JSON description of the directory content in `data_dir` `` call: - - /dir// - - -To get a JSON description of the directory content in `data_dir` `` at path `` call: - - /dir// - - -The JSON description is a list of file or sub-directory entries: - -```JSON -[ - { - "name": "name of sub-directory", - "path": "path relative to ``", - "dir": "`true` if entry is a directory", - "restricted": "`true` if access is restricted" - }, - { - "name": "name of the file", - "path": "path relative to ``", - "size": "file size in bytes" - }, - { - ... - } -] -``` - - -Frame count ------------ - -To get the number of frames the trajectory in `data_dir` `` with file path `` has call: - - /traj/numframes// - - -Frame coordinates ------------------ - -To get the coordinates of frame number `` of the trajectory in `data_dir` `` with file path `` call: - - /traj/frame/// - - -The set of atoms for which coordinates should be returned can be restricted by `POST`ing an `atomIndices` parameter with the following format. A list of index ranges is defined by pairs of integers separated by semi-colons (`;`) where the two integers within a pair are separated by a comma (`,`). To select atoms with indices (starting at zero) 5 to 10 and 22 to 30 send: - - 5,10;22,30 - - -The coordinate frame is returned in binary format and also contains the frame number, the simulation time (when available) and the box vectors. - -| Offset | Size | Type | Description | -| -----: | ---: | ----: | :--------------------------- | -| 0 | 4 | int | frame number | -| 4 | 4 | float | simulation time | -| 8 | 4 | float | X coordinate of box vector A | -| 12 | 4 | float | Y | -| 16 | 4 | float | Z | -| 20 | 4 | float | X coordinate of box vector B | -| 24 | 4 | float | Y | -| 28 | 4 | float | Z | -| 32 | 4 | float | X coordinate of box vector C | -| 36 | 4 | float | Y | -| 40 | 4 | float | Z | -| 44 | 4 | float | X coordinate of first atom | -| 48 | 4 | float | Y | -| 52 | 4 | float | Z | -| ... | ... | ... | ... | - - +For more information, please visit the [documentation](http://arose.github.io/mdsrv/). NGL browser support =============== @@ -207,7 +119,8 @@ Thanks to code from MDAnalysis (http://www.mdanalysis.org/) there is random acce Funding sources: * NCI/NIH award number U01 CA198942 -* DFG Projekt HI 1502 +* DFG project HI 1502 +* HLRN project bec00085 Cite @@ -216,4 +129,5 @@ Cite When using MGsrv please cite: * A. S. Rose, and MDsrv Contributors. MDsrv v0.2 Zenodo (2016), doi:10.5281/zenodo.45961. [doi:10.5281/zenodo.45961](http://dx.doi.org/10.5281/zenodo.45961) +* AS Rose, AR Bradley, Y Valasatava, JM Duarte, A Prlić and PW Rose. _Web-based molecular graphics for large complexes._ ACM Proceedings of the 21st International Conference on Web3D Technology (Web3D '16): 185-186, 2016. [doi:10.1145/2945292.2945324](http://dx.doi.org/10.1145/2945292.2945324) * AS Rose and PW Hildebrand. _NGL Viewer: a web application for molecular visualization._ Nucl Acids Res (1 July 2015) 43 (W1): W576-W579 first published online April 29, 2015. [doi:10.1093/nar/gkv402](https://doi.org/10.1093/nar/gkv402) diff --git a/data/DPDP.nc b/data/DPDP.nc deleted file mode 100755 index 505c746..0000000 Binary files a/data/DPDP.nc and /dev/null differ diff --git a/data/DPDP.parm7 b/data/DPDP.parm7 deleted file mode 100755 index 91d0485..0000000 --- a/data/DPDP.parm7 +++ /dev/null @@ -1,1774 +0,0 @@ -%VERSION VERSION_STAMP = V0001.000 DATE = 04/23/04 15:43:32 -%FLAG TITLE -%FORMAT(20a4) - -%FLAG POINTERS -%FORMAT(10I8) - 332 11 173 162 395 219 726 498 0 0 - 1850 22 162 219 498 19 40 31 14 0 - 0 0 0 0 0 0 0 0 22 0 - 0 -%FLAG ATOM_NAME -%FORMAT(20a4) -HH31CH3 HH32HH33C O N H CA HA CB HB CG1 HG11HG12HG13CG2 HG21HG22HG23 -C O N H CA HA CB HB2 HB3 CG CD1 HD1 CE1 HE1 CZ HZ CE2 HE2 CD2 HD2 -C O N H CA HA CB HB CG2 HG21HG22HG23CG1 HG12HG13CD1 HD11HD12HD13C -O N H CA HA CB HB CG2 HG21HG22HG23OG1 HG1 C O N H CA HA CB -HB2 HB3 OG HG C O N CD HD2 HD3 CG HG2 HG3 CB HB2 HB3 CA HA C O -N H CA HA2 HA3 C O N H CA HA CB HB2 HB3 CG HG2 HG3 CD HD2 HD3 -CE HE2 HE3 NZ HZ1 HZ2 HZ3 C O N H CA HA CB HB CG2 HG21HG22HG23OG1 -HG1 C O N H CA HA CB HB2 HB3 CG CD1 HD1 CE1 HE1 CZ OH HH CE2 HE2 -CD2 HD2 C O N H CA HA CB HB CG2 HG21HG22HG23OG1 HG1 C O N H -CA HA CB HB2 HB3 CG HG2 HG3 CD OE1 OE2 C O N H CA HA CB HB CG1 -HG11HG12HG13CG2 HG21HG22HG23C O N CD HD2 HD3 CG HG2 HG3 CB HB2 HB3 CA -HA C O N H CA HA2 HA3 C O N H CA HA CB HB2 HB3 CG HG2 HG3 -CD HD2 HD3 CE HE2 HE3 NZ HZ1 HZ2 HZ3 C O N H CA HA CB HB2 HB3 CG -HG2 HG3 CD HD2 HD3 CE HE2 HE3 NZ HZ1 HZ2 HZ3 C O N H CA HA CB HB -CG2 HG21HG22HG23CG1 HG12HG13CD1 HD11HD12HD13C O N H CA HA CB HB2 HB3 -CG HG CD1 HD11HD12HD13CD2 HD21HD22HD23C O N H CA HA CB HB2 HB3 CG -HG2 HG3 CD OE1 NE2 HE21HE22C O N HN1 HN2 -%FLAG CHARGE -%FORMAT(5E16.8) - 2.04636429E+00 -6.67300626E+00 2.04636429E+00 2.04636429E+00 1.08823576E+01 - -1.03484442E+01 -7.57501011E+00 4.95464337E+00 -1.59445125E+00 1.76574087E+00 - 5.43935655E+00 -5.41202310E-01 -5.81655816E+00 1.44138393E+00 1.44138393E+00 - 1.44138393E+00 -5.81655816E+00 1.44138393E+00 1.44138393E+00 1.44138393E+00 - 1.08841798E+01 -1.03484442E+01 -7.57501011E+00 4.95464337E+00 -4.37335200E-02 - 1.78214094E+00 -6.25024890E-01 5.37557850E-01 5.37557850E-01 2.15023140E-01 - -2.28872088E+00 2.42356590E+00 -3.10507992E+00 2.60578890E+00 -1.95343056E+00 - 2.36343231E+00 -3.10507992E+00 2.60578890E+00 -2.28872088E+00 2.42356590E+00 - 1.08841798E+01 -1.03484442E+01 -7.57501011E+00 4.95464337E+00 -1.08787131E+00 - 1.58351787E+00 2.37436569E+00 3.40757010E-01 -5.83842492E+00 1.60720686E+00 - 1.60720686E+00 1.60720686E+00 -7.83558900E-01 4.30046280E-01 4.30046280E-01 - -1.20267180E+00 3.38934780E-01 3.38934780E-01 3.38934780E-01 1.08841798E+01 - -1.03484442E+01 -7.57501011E+00 4.95464337E+00 -7.08847470E-01 1.83498561E+00 - 6.65842842E+00 7.83558900E-02 -4.44259674E+00 1.16987166E+00 1.16987166E+00 - 1.16987166E+00 -1.23200970E+01 7.47478746E+00 1.08841798E+01 -1.03484442E+01 - -7.57501011E+00 4.95464337E+00 -4.53735270E-01 1.53613989E+00 3.85766091E+00 - 6.41424960E-01 6.41424960E-01 -1.19283176E+01 7.79003325E+00 1.08841798E+01 - -1.03484442E+01 -4.64304204E+00 3.49868160E-01 7.12491930E-01 7.12491930E-01 - 3.44401470E-01 3.88134990E-01 3.88134990E-01 -1.27556100E-01 4.61024190E-01 - 4.61024190E-01 -4.84713180E-01 1.16804943E+00 1.07438681E+01 -1.04741780E+01 - -7.57501011E+00 4.95464337E+00 -4.59201960E-01 1.27191654E+00 1.27191654E+00 - 1.08841798E+01 -1.03484442E+01 -6.33953817E+00 5.00566581E+00 -4.37335200E+00 - 2.59849998E+00 -1.71289620E-01 6.59647260E-01 6.59647260E-01 3.40757010E-01 - 1.87689690E-01 1.87689690E-01 -8.72848170E-01 1.13160483E+00 1.13160483E+00 - -2.60578890E-01 2.06823105E+00 2.06823105E+00 -7.02287442E+00 6.19558200E+00 - 6.19558200E+00 6.19558200E+00 1.33769904E+01 -1.07402236E+01 -7.57501011E+00 - 4.95464337E+00 -7.08847470E-01 1.83498561E+00 6.65842842E+00 7.83558900E-02 - -4.44259674E+00 1.16987166E+00 1.16987166E+00 1.16987166E+00 -1.23200970E+01 - 7.47478746E+00 1.08841798E+01 -1.03484442E+01 -7.57501011E+00 4.95464337E+00 - -2.55112200E-02 1.59627348E+00 -2.76978960E-01 5.37557850E-01 5.37557850E-01 - -2.00445300E-02 -3.47317038E+00 3.09596877E+00 -4.26584043E+00 3.01761288E+00 - 5.87851398E+00 -1.01662212E+01 7.27434216E+00 -4.26584043E+00 3.01761288E+00 - -3.47317038E+00 3.09596877E+00 1.08841798E+01 -1.03484442E+01 -7.57501011E+00 - 4.95464337E+00 -7.08847470E-01 1.83498561E+00 6.65842842E+00 7.83558900E-02 - -4.44259674E+00 1.16987166E+00 1.16987166E+00 1.16987166E+00 -1.23200970E+01 - 7.47478746E+00 1.08841798E+01 -1.03484442E+01 -9.40817349E+00 5.35006728E+00 - 7.23425310E-01 2.01356415E+00 1.02044880E+00 -3.15245790E-01 -3.15245790E-01 - 2.47823280E-01 -7.74447750E-01 -7.74447750E-01 1.46762404E+01 -1.49204192E+01 - -1.49204192E+01 9.77808618E+00 -1.06035564E+01 -7.57501011E+00 4.95464337E+00 - -1.59445125E+00 1.76574087E+00 5.43935655E+00 -5.41202310E-01 -5.81655816E+00 - 1.44138393E+00 1.44138393E+00 1.44138393E+00 -5.81655816E+00 1.44138393E+00 - 1.44138393E+00 1.44138393E+00 1.08841798E+01 -1.03484442E+01 -4.64304204E+00 - 3.49868160E-01 7.12491930E-01 7.12491930E-01 3.44401470E-01 3.88134990E-01 - 3.88134990E-01 -1.27556100E-01 4.61024190E-01 4.61024190E-01 -4.84713180E-01 - 1.16804943E+00 1.07438681E+01 -1.04741780E+01 -7.57501011E+00 4.95464337E+00 - -4.59201960E-01 1.27191654E+00 1.27191654E+00 1.08841798E+01 -1.03484442E+01 - -6.33953817E+00 5.00566581E+00 -4.37335200E+00 2.59849998E+00 -1.71289620E-01 - 6.59647260E-01 6.59647260E-01 3.40757010E-01 1.87689690E-01 1.87689690E-01 - -8.72848170E-01 1.13160483E+00 1.13160483E+00 -2.60578890E-01 2.06823105E+00 - 2.06823105E+00 -7.02287442E+00 6.19558200E+00 6.19558200E+00 6.19558200E+00 - 1.33769904E+01 -1.07402236E+01 -6.33953817E+00 5.00566581E+00 -4.37335200E+00 - 2.59849998E+00 -1.71289620E-01 6.59647260E-01 6.59647260E-01 3.40757010E-01 - 1.87689690E-01 1.87689690E-01 -8.72848170E-01 1.13160483E+00 1.13160483E+00 - -2.60578890E-01 2.06823105E+00 2.06823105E+00 -7.02287442E+00 6.19558200E+00 - 6.19558200E+00 6.19558200E+00 1.33769904E+01 -1.07402236E+01 -7.57501011E+00 - 4.95464337E+00 -1.08787131E+00 1.58351787E+00 2.37436569E+00 3.40757010E-01 - -5.83842492E+00 1.60720686E+00 1.60720686E+00 1.60720686E+00 -7.83558900E-01 - 4.30046280E-01 4.30046280E-01 -1.20267180E+00 3.38934780E-01 3.38934780E-01 - 3.38934780E-01 1.08841798E+01 -1.03484442E+01 -7.57501011E+00 4.95464337E+00 - -9.43915140E-01 1.68009606E+00 -2.00809746E+00 8.32759110E-01 8.32759110E-01 - 6.43429413E+00 -6.57825030E-01 -7.50940983E+00 1.82223000E+00 1.82223000E+00 - 1.82223000E+00 -7.50940983E+00 1.82223000E+00 1.82223000E+00 1.82223000E+00 - 1.08841798E+01 -1.03484442E+01 -7.57501011E+00 4.95464337E+00 -5.64891300E-02 - 1.54889550E+00 -6.56002800E-02 3.11601330E-01 3.11601330E-01 -1.17533835E+00 - 6.41424960E-01 6.41424960E-01 1.26663207E+01 -1.10900918E+01 -1.71417176E+01 - 7.74629973E+00 7.74629973E+00 1.08841798E+01 -1.03484442E+01 -8.43692490E+00 - 4.21846245E+00 4.21846245E+00 -%FLAG MASS -%FORMAT(5E16.8) - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.00800000E+00 1.60000000E+01 1.00800000E+00 1.20100000E+01 1.60000000E+01 - 1.40100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.60000000E+01 1.00800000E+00 1.20100000E+01 - 1.60000000E+01 1.40100000E+01 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.60000000E+01 - 1.40100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.40100000E+01 1.00800000E+00 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 1.60000000E+01 - 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.60000000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 1.60000000E+01 - 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 - 1.60000000E+01 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 - 1.40100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.00800000E+00 1.40100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.40100000E+01 1.00800000E+00 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.00800000E+00 - 1.20100000E+01 1.60000000E+01 1.40100000E+01 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.20100000E+01 1.00800000E+00 1.00800000E+00 1.20100000E+01 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 - 1.00800000E+00 1.00800000E+00 1.20100000E+01 1.60000000E+01 1.40100000E+01 - 1.00800000E+00 1.00800000E+00 -%FLAG ATOM_TYPE_INDEX -%FORMAT(10I8) - 1 2 1 1 3 4 5 6 2 7 - 2 1 2 1 1 1 2 1 1 1 - 3 4 5 6 2 7 2 1 1 3 - 3 8 3 8 3 8 3 8 3 8 - 3 4 5 6 2 7 2 1 2 1 - 1 1 2 1 1 2 1 1 1 3 - 4 5 6 2 7 2 7 2 1 1 - 1 9 10 3 4 5 6 2 7 2 - 7 7 9 10 3 4 5 2 7 7 - 2 1 1 2 1 1 2 7 3 4 - 5 6 2 7 7 3 4 5 6 2 - 7 2 1 1 2 1 1 2 1 1 - 2 11 11 5 6 6 6 3 4 5 - 6 2 7 2 7 2 1 1 1 9 - 10 3 4 5 6 2 7 2 1 1 - 3 3 8 3 8 3 9 10 3 8 - 3 8 3 4 5 6 2 7 2 7 - 2 1 1 1 9 10 3 4 5 6 - 2 7 2 1 1 2 1 1 3 4 - 4 3 4 5 6 2 7 2 1 2 - 1 1 1 2 1 1 1 3 4 5 - 2 7 7 2 1 1 2 1 1 2 - 7 3 4 5 6 2 7 7 3 4 - 5 6 2 7 2 1 1 2 1 1 - 2 1 1 2 11 11 5 6 6 6 - 3 4 5 6 2 7 2 1 1 2 - 1 1 2 1 1 2 11 11 5 6 - 6 6 3 4 5 6 2 7 2 1 - 2 1 1 1 2 1 1 2 1 1 - 1 3 4 5 6 2 7 2 1 1 - 2 1 2 1 1 1 2 1 1 1 - 3 4 5 6 2 7 2 1 1 2 - 1 1 3 4 5 6 6 3 4 5 - 6 6 -%FLAG NUMBER_EXCLUDED_ATOMS -%FORMAT(10I8) - 6 7 4 3 7 3 10 4 16 7 - 12 9 8 3 2 1 4 2 1 1 - 7 3 10 4 12 7 12 5 4 10 - 8 4 6 3 5 3 3 2 1 1 - 7 3 10 4 16 7 15 9 8 3 - 2 1 7 5 4 3 2 1 1 7 - 3 10 4 14 7 10 7 6 3 2 - 1 2 1 7 3 10 4 11 7 7 - 4 3 2 1 10 3 14 11 6 5 - 8 5 4 7 4 3 6 3 7 3 - 7 4 7 4 3 7 3 10 4 13 - 7 12 6 5 10 5 4 9 5 4 - 6 5 4 3 2 1 1 7 3 10 - 4 14 7 10 7 6 3 2 1 2 - 1 7 3 10 4 12 7 12 5 4 - 10 8 4 7 3 6 4 1 3 2 - 1 1 7 3 10 4 14 7 10 7 - 6 3 2 1 2 1 7 3 10 4 - 13 7 11 6 5 6 4 3 2 1 - 1 7 3 10 4 16 7 12 9 8 - 3 2 1 4 2 1 1 10 3 14 - 11 6 5 8 5 4 7 4 3 6 - 3 7 3 7 4 7 4 3 7 3 - 10 4 13 7 12 6 5 10 5 4 - 9 5 4 6 5 4 3 2 1 1 - 7 3 10 4 13 7 12 6 5 10 - 5 4 9 5 4 6 5 4 3 2 - 1 1 7 3 10 4 16 7 15 9 - 8 3 2 1 7 5 4 3 2 1 - 1 7 3 10 4 13 7 15 6 5 - 10 8 7 3 2 1 3 2 1 1 - 7 3 10 4 13 7 11 6 5 8 - 4 3 4 3 2 1 1 4 3 2 - 1 1 -%FLAG NONBONDED_PARM_INDEX -%FORMAT(10I8) - 1 2 4 7 11 16 22 29 37 46 - 56 2 3 5 8 12 17 23 30 38 - 47 57 4 5 6 9 13 18 24 31 - 39 48 58 7 8 9 10 14 19 25 - 32 40 49 59 11 12 13 14 15 20 - 26 33 41 50 60 16 17 18 19 20 - 21 27 34 42 51 61 22 23 24 25 - 26 27 28 35 43 52 62 29 30 31 - 32 33 34 35 36 44 53 63 37 38 - 39 40 41 42 43 44 45 54 64 46 - 47 48 49 50 51 52 53 54 55 65 - 56 57 58 59 60 61 62 63 64 65 - 66 -%FLAG RESIDUE_LABEL -%FORMAT(20a4) -ACE VAL PHE ILE THR SER PRO GLY LYS THR TYR THR GLU VAL PRO GLY LYS LYS ILE LEU -GLN NHE -%FLAG RESIDUE_POINTER -%FORMAT(10I8) - 1 7 23 43 62 76 87 101 108 130 - 144 165 179 194 210 224 231 253 275 294 - 313 330 -%FLAG BOND_FORCE_CONSTANT -%FORMAT(5E16.8) - 5.70000000E+02 4.90000000E+02 3.40000000E+02 3.17000000E+02 3.10000000E+02 - 3.40000000E+02 4.34000000E+02 3.37000000E+02 3.67000000E+02 4.69000000E+02 - 3.17000000E+02 5.53000000E+02 3.20000000E+02 4.34000000E+02 3.40000000E+02 - 3.67000000E+02 4.50000000E+02 4.69000000E+02 6.56000000E+02 -%FLAG BOND_EQUIL_VALUE -%FORMAT(5E16.8) - 1.22900000E+00 1.33500000E+00 1.09000000E+00 1.52200000E+00 1.52600000E+00 - 1.09000000E+00 1.01000000E+00 1.44900000E+00 1.08000000E+00 1.40000000E+00 - 1.51000000E+00 9.60000000E-01 1.41000000E+00 1.01000000E+00 1.09000000E+00 - 1.47100000E+00 1.36400000E+00 1.40900000E+00 1.25000000E+00 -%FLAG ANGLE_FORCE_CONSTANT -%FORMAT(5E16.8) - 8.00000000E+01 5.00000000E+01 5.00000000E+01 5.00000000E+01 3.50000000E+01 - 8.00000000E+01 7.00000000E+01 4.00000000E+01 5.00000000E+01 6.30000000E+01 - 5.00000000E+01 5.00000000E+01 5.00000000E+01 5.00000000E+01 8.00000000E+01 - 6.30000000E+01 5.00000000E+01 6.30000000E+01 5.00000000E+01 7.00000000E+01 - 6.30000000E+01 5.00000000E+01 5.00000000E+01 5.50000000E+01 3.50000000E+01 - 5.00000000E+01 3.50000000E+01 5.00000000E+01 3.50000000E+01 5.00000000E+01 - 5.00000000E+01 8.00000000E+01 7.00000000E+01 5.00000000E+01 5.00000000E+01 - 6.30000000E+01 6.30000000E+01 8.00000000E+01 7.00000000E+01 3.50000000E+01 -%FLAG ANGLE_EQUIL_VALUE -%FORMAT(5E16.8) - 2.14501057E+00 2.09439600E+00 2.12755727E+00 1.91113635E+00 1.91113635E+00 - 2.10137732E+00 2.03505478E+00 1.91113635E+00 1.91113635E+00 1.93906163E+00 - 1.91113635E+00 1.91113635E+00 2.06018753E+00 1.91113635E+00 1.91462701E+00 - 1.92160833E+00 2.09439600E+00 2.09439600E+00 1.91113635E+00 2.09439600E+00 - 1.98967620E+00 1.91113635E+00 1.91113635E+00 1.89368305E+00 1.91113635E+00 - 2.05948940E+00 1.91113635E+00 1.91113635E+00 1.91113635E+00 1.91113635E+00 - 1.91113635E+00 1.94080696E+00 2.09439600E+00 1.97222290E+00 2.09439600E+00 - 2.09439600E+00 2.09439600E+00 2.19911580E+00 2.04203610E+00 2.09439600E+00 -%FLAG DIHEDRAL_FORCE_CONSTANT -%FORMAT(5E16.8) - 2.00000000E+00 2.50000000E+00 0.00000000E+00 5.30000000E-01 1.50000000E-01 - 5.00000000E-01 4.00000000E-01 4.10000000E-01 2.00000000E-02 2.00000000E-02 - 8.00000000E-01 8.00000000E-02 1.55555556E-01 1.60000000E-01 1.50000000E-01 - 7.00000000E-02 1.00000000E-01 4.80000000E-01 4.50000000E-01 1.20000000E-01 - 4.50000000E-01 3.62500000E+00 2.00000000E-01 2.50000000E-01 1.80000000E-01 - 2.50000000E-01 1.66666667E-01 2.30000000E+00 1.05000000E+01 1.10000000E+00 - 1.00000000E+00 -%FLAG DIHEDRAL_PERIODICITY -%FORMAT(5E16.8) - 1.00000000E+00 2.00000000E+00 2.00000000E+00 1.00000000E+00 3.00000000E+00 - 4.00000000E+00 1.00000000E+00 2.00000000E+00 3.00000000E+00 4.00000000E+00 - 1.00000000E+00 3.00000000E+00 3.00000000E+00 3.00000000E+00 3.00000000E+00 - 2.00000000E+00 4.00000000E+00 1.00000000E+00 2.00000000E+00 3.00000000E+00 - 4.00000000E+00 2.00000000E+00 1.00000000E+00 2.00000000E+00 3.00000000E+00 - 1.00000000E+00 3.00000000E+00 2.00000000E+00 2.00000000E+00 2.00000000E+00 - 2.00000000E+00 -%FLAG DIHEDRAL_PHASE -%FORMAT(5E16.8) - 0.00000000E+00 3.14159400E+00 0.00000000E+00 0.00000000E+00 3.14159400E+00 - 3.14159400E+00 4.58000772E+00 5.29000796E+00 5.02000541E+00 5.81001158E+00 - 0.00000000E+00 3.14159400E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 0.00000000E+00 0.00000000E+00 4.78000508E+00 5.38999792E+00 5.76000788E+00 - 5.52000755E+00 3.14159400E+00 3.14159400E+00 3.14159400E+00 0.00000000E+00 - 0.00000000E+00 0.00000000E+00 3.14159400E+00 3.14159400E+00 3.14159400E+00 - 3.14159400E+00 -%FLAG SOLTY -%FORMAT(5E16.8) - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 -%FLAG LENNARD_JONES_ACOEF -%FORMAT(5E16.8) - 7.51607703E+03 9.71708117E+04 1.04308023E+06 8.61541883E+04 9.24822270E+05 - 8.19971662E+05 5.44261042E+04 6.47841731E+05 5.74393458E+05 3.79876399E+05 - 8.96776989E+04 9.95480466E+05 8.82619071E+05 6.06829342E+05 9.44293233E+05 - 1.07193646E+02 2.56678134E+03 2.27577561E+03 1.02595236E+03 2.12601181E+03 - 1.39982777E-01 4.98586848E+03 6.78771368E+04 6.01816484E+04 3.69471530E+04 - 6.20665997E+04 5.94667300E+01 3.25969625E+03 6.55825601E+03 8.59947003E+04 - 7.62451550E+04 4.77908183E+04 7.91627154E+04 8.90987508E+01 4.33325458E+03 - 5.71629601E+03 6.82786631E+04 7.91544157E+05 7.01803794E+05 4.71003287E+05 - 7.44975864E+05 1.40467023E+03 4.66922514E+04 6.00750218E+04 5.81803229E+05 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 1.41077189E+03 2.27401052E+04 2.01619733E+04 1.12780457E+04 2.01791425E+04 - 9.14716912E+00 8.79040886E+02 1.21014911E+03 1.45985502E+04 0.00000000E+00 - 2.01823541E+02 -%FLAG LENNARD_JONES_BCOEF -%FORMAT(5E16.8) - 2.17257828E+01 1.26919150E+02 6.75612247E+02 1.12529845E+02 5.99015525E+02 - 5.31102864E+02 1.11805549E+02 6.26720080E+02 5.55666448E+02 5.64885984E+02 - 1.36131731E+02 7.36907417E+02 6.53361429E+02 6.77220874E+02 8.01323529E+02 - 2.59456373E+00 2.06278363E+01 1.82891803E+01 1.53505284E+01 2.09604198E+01 - 9.37598976E-02 1.76949863E+01 1.06076943E+02 9.40505980E+01 9.21192136E+01 - 1.13252061E+02 1.93248820E+00 1.43076527E+01 2.00642027E+01 1.18043746E+02 - 1.04660679E+02 1.03580945E+02 1.26451907E+02 2.33864085E+00 1.63092814E+01 - 1.85196588E+01 1.25287818E+02 6.93079947E+02 6.14502845E+02 6.29300710E+02 - 7.50714425E+02 1.79702257E+01 1.03606917E+02 1.16187983E+02 6.99746810E+02 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 - 9.41257003E+00 6.13981767E+01 5.44372326E+01 5.08951803E+01 6.45756063E+01 - 7.57919667E-01 7.42992380E+00 8.61880722E+00 5.79323581E+01 0.00000000E+00 - 3.56012899E+00 -%FLAG BONDS_INC_HYDROGEN -%FORMAT(10I8) - 3 6 3 3 9 3 0 3 3 48 - 51 3 48 54 3 48 57 3 36 39 - 3 36 42 3 36 45 3 30 33 3 - 24 27 6 18 21 7 114 117 9 108 - 111 9 102 105 9 96 99 9 90 93 - 9 78 81 3 78 84 3 72 75 6 - 66 69 7 165 168 3 165 171 3 165 - 174 3 156 159 3 156 162 3 144 147 - 3 144 150 3 144 153 3 138 141 3 - 132 135 6 126 129 7 213 216 12 201 - 204 3 201 207 3 201 210 3 195 198 - 6 189 192 6 183 186 7 246 249 12 - 237 240 6 237 243 6 231 234 6 225 - 228 7 288 291 6 279 282 3 279 285 - 3 270 273 3 270 276 3 261 264 6 - 261 267 6 306 309 6 306 312 6 300 - 303 7 369 372 14 369 375 14 369 378 - 14 360 363 15 360 366 15 351 354 3 - 351 357 3 342 345 3 342 348 3 333 - 336 3 333 339 3 327 330 6 321 324 - 7 417 420 12 405 408 3 405 411 3 - 405 414 3 399 402 6 393 396 6 387 - 390 7 480 483 9 474 477 9 468 471 - 12 459 462 9 453 456 9 441 444 3 - 441 447 3 435 438 6 429 432 7 522 - 525 12 510 513 3 510 516 3 510 519 - 3 504 507 6 498 501 6 492 495 7 - 555 558 3 555 561 3 546 549 3 546 - 552 3 540 543 6 534 537 7 609 612 - 3 609 615 3 609 618 3 597 600 3 - 597 603 3 597 606 3 591 594 3 585 - 588 6 579 582 7 657 660 6 648 651 - 3 648 654 3 639 642 3 639 645 3 - 630 633 6 630 636 6 675 678 6 675 - 681 6 669 672 7 738 741 14 738 744 - 14 738 747 14 729 732 15 729 735 15 - 720 723 3 720 726 3 711 714 3 711 - 717 3 702 705 3 702 708 3 696 699 - 6 690 693 7 804 807 14 804 810 14 - 804 813 14 795 798 15 795 801 15 786 - 789 3 786 792 3 777 780 3 777 783 - 3 768 771 3 768 774 3 762 765 6 - 756 759 7 861 864 3 861 867 3 861 - 870 3 852 855 3 852 858 3 840 843 - 3 840 846 3 840 849 3 834 837 3 - 828 831 6 822 825 7 918 921 3 918 - 924 3 918 927 3 906 909 3 906 912 - 3 906 915 3 900 903 3 891 894 3 - 891 897 3 885 888 6 879 882 7 972 - 975 7 972 978 7 957 960 3 957 963 - 3 948 951 3 948 954 3 942 945 6 - 936 939 7 987 990 7 987 993 7 -%FLAG BONDS_WITHOUT_HYDROGEN -%FORMAT(10I8) - 12 15 1 12 18 2 3 12 4 60 - 63 1 60 66 2 30 36 5 30 48 - 5 24 30 5 24 60 4 18 24 8 - 120 123 1 120 126 2 108 114 10 102 - 108 10 96 102 10 90 96 10 87 90 - 10 87 114 10 78 87 11 72 78 5 - 72 120 4 66 72 8 177 180 1 177 - 183 2 156 165 5 138 144 5 138 156 - 5 132 138 5 132 177 4 126 132 8 - 219 222 1 219 225 2 195 201 5 195 - 213 13 189 195 5 189 219 4 183 189 - 8 252 255 1 252 258 2 237 246 13 - 231 237 5 231 252 4 225 231 8 294 - 297 1 294 300 2 288 294 4 279 288 - 5 270 279 5 261 270 5 258 261 8 - 258 288 8 315 318 1 315 321 2 306 - 315 4 300 306 8 381 384 1 381 387 - 2 360 369 16 351 360 5 342 351 5 - 333 342 5 327 333 5 327 381 4 321 - 327 8 423 426 1 423 429 2 399 405 - 5 399 417 13 393 399 5 393 423 4 - 387 393 8 486 489 1 486 492 2 474 - 480 10 465 468 17 465 474 18 459 465 - 18 453 459 10 450 453 10 450 480 10 - 441 450 11 435 441 5 435 486 4 429 - 435 8 528 531 1 528 534 2 504 510 - 5 504 522 13 498 504 5 498 528 4 - 492 498 8 573 576 1 573 579 2 564 - 567 19 564 570 19 555 564 4 546 555 - 5 540 546 5 540 573 4 534 540 8 - 621 624 1 621 627 2 591 597 5 591 - 609 5 585 591 5 585 621 4 579 585 - 8 663 666 1 663 669 2 657 663 4 - 648 657 5 639 648 5 630 639 5 627 - 630 8 627 657 8 684 687 1 684 690 - 2 675 684 4 669 675 8 750 753 1 - 750 756 2 729 738 16 720 729 5 711 - 720 5 702 711 5 696 702 5 696 750 - 4 690 696 8 816 819 1 816 822 2 - 795 804 16 786 795 5 777 786 5 768 - 777 5 762 768 5 762 816 4 756 762 - 8 873 876 1 873 879 2 852 861 5 - 834 840 5 834 852 5 828 834 5 828 - 873 4 822 828 8 930 933 1 930 936 - 2 900 906 5 900 918 5 891 900 5 - 885 891 5 885 930 4 879 885 8 981 - 984 1 981 987 2 966 969 1 966 972 - 2 957 966 4 948 957 5 942 948 5 - 942 981 4 936 942 8 -%FLAG ANGLES_INC_HYDROGEN -%FORMAT(10I8) - 12 18 21 2 9 3 12 4 6 3 - 9 5 6 3 12 4 0 3 6 5 - 0 3 9 5 0 3 12 4 60 66 - 69 2 54 48 57 5 51 48 54 5 - 51 48 57 5 42 36 45 5 39 36 - 42 5 39 36 45 5 33 30 36 9 - 33 30 48 9 30 36 39 9 30 36 - 42 9 30 36 45 9 30 48 51 9 - 30 48 54 9 30 48 57 9 27 24 - 30 11 27 24 60 12 24 30 33 9 - 21 18 24 13 18 24 27 14 120 126 - 129 2 111 108 114 17 108 114 117 17 - 105 102 108 17 102 108 111 17 99 96 - 102 17 96 102 105 17 93 90 96 17 - 90 96 99 17 87 90 93 17 87 114 - 117 17 84 78 87 19 81 78 84 5 - 81 78 87 19 75 72 78 11 75 72 - 120 12 72 78 81 9 72 78 84 9 - 69 66 72 13 66 72 75 14 177 183 - 186 2 171 165 174 5 168 165 171 5 - 168 165 174 5 162 156 165 9 159 156 - 162 5 159 156 165 9 156 165 168 9 - 156 165 171 9 156 165 174 9 150 144 - 153 5 147 144 150 5 147 144 153 5 - 141 138 144 9 141 138 156 9 138 144 - 147 9 138 144 150 9 138 144 153 9 - 138 156 159 9 138 156 162 9 135 132 - 138 11 135 132 177 12 132 138 141 9 - 129 126 132 13 126 132 135 14 219 225 - 228 2 207 201 210 5 204 201 207 5 - 204 201 210 5 198 195 201 11 198 195 - 213 23 195 201 204 9 195 201 207 9 - 195 201 210 9 195 213 216 24 192 189 - 195 11 192 189 219 12 189 195 198 11 - 186 183 189 13 183 189 192 14 243 237 - 246 23 240 237 243 25 240 237 246 23 - 237 246 249 24 234 231 237 11 234 231 - 252 12 231 237 240 11 231 237 243 11 - 228 225 231 13 225 231 234 14 294 300 - 303 2 291 288 294 12 285 279 288 9 - 282 279 285 5 282 279 288 9 279 288 - 291 11 276 270 279 9 273 270 276 5 - 273 270 279 9 270 279 282 9 270 279 - 285 9 267 261 270 11 264 261 267 25 - 264 261 270 11 261 270 273 9 261 270 - 276 9 258 261 264 14 258 261 267 14 - 258 288 291 14 315 321 324 2 312 306 - 315 12 309 306 312 25 309 306 315 12 - 303 300 306 13 300 306 309 14 300 306 - 312 14 381 387 390 2 375 369 378 27 - 372 369 375 27 372 369 378 27 366 360 - 369 28 363 360 366 29 363 360 369 28 - 360 369 372 30 360 369 375 30 360 369 - 378 30 357 351 360 9 354 351 357 5 - 354 351 360 9 351 360 363 31 351 360 - 366 31 348 342 351 9 345 342 348 5 - 345 342 351 9 342 351 354 9 342 351 - 357 9 339 333 342 9 336 333 339 5 - 336 333 342 9 333 342 345 9 333 342 - 348 9 330 327 333 11 330 327 381 12 - 327 333 336 9 327 333 339 9 324 321 - 327 13 321 327 330 14 423 429 432 2 - 411 405 414 5 408 405 411 5 408 405 - 414 5 402 399 405 11 402 399 417 23 - 399 405 408 9 399 405 411 9 399 405 - 414 9 399 417 420 24 396 393 399 11 - 396 393 423 12 393 399 402 11 390 387 - 393 13 387 393 396 14 486 492 495 2 - 477 474 480 17 474 480 483 17 465 468 - 471 34 465 474 477 35 462 459 465 35 - 456 453 459 17 453 459 462 17 450 453 - 456 17 450 480 483 17 447 441 450 19 - 444 441 447 5 444 441 450 19 438 435 - 441 11 438 435 486 12 435 441 444 9 - 435 441 447 9 432 429 435 13 429 435 - 438 14 528 534 537 2 516 510 519 5 - 513 510 516 5 513 510 519 5 507 504 - 510 11 507 504 522 23 504 510 513 9 - 504 510 516 9 504 510 519 9 504 522 - 525 24 501 498 504 11 501 498 528 12 - 498 504 507 11 495 492 498 13 492 498 - 501 14 573 579 582 2 561 555 564 4 - 558 555 561 5 558 555 564 4 552 546 - 555 9 549 546 552 5 549 546 555 9 - 546 555 558 9 546 555 561 9 543 540 - 546 11 543 540 573 12 540 546 549 9 - 540 546 552 9 537 534 540 13 534 540 - 543 14 615 609 618 5 612 609 615 5 - 612 609 618 5 603 597 606 5 600 597 - 603 5 600 597 606 5 594 591 597 9 - 594 591 609 9 591 597 600 9 591 597 - 603 9 591 597 606 9 591 609 612 9 - 591 609 615 9 591 609 618 9 588 585 - 591 11 588 585 621 12 585 591 594 9 - 582 579 585 13 579 585 588 14 663 669 - 672 2 660 657 663 12 654 648 657 9 - 651 648 654 5 651 648 657 9 648 657 - 660 11 645 639 648 9 642 639 645 5 - 642 639 648 9 639 648 651 9 639 648 - 654 9 636 630 639 11 633 630 636 25 - 633 630 639 11 630 639 642 9 630 639 - 645 9 627 630 633 14 627 630 636 14 - 627 657 660 14 684 690 693 2 681 675 - 684 12 678 675 681 25 678 675 684 12 - 672 669 675 13 669 675 678 14 669 675 - 681 14 750 756 759 2 744 738 747 27 - 741 738 744 27 741 738 747 27 735 729 - 738 28 732 729 735 29 732 729 738 28 - 729 738 741 30 729 738 744 30 729 738 - 747 30 726 720 729 9 723 720 726 5 - 723 720 729 9 720 729 732 31 720 729 - 735 31 717 711 720 9 714 711 717 5 - 714 711 720 9 711 720 723 9 711 720 - 726 9 708 702 711 9 705 702 708 5 - 705 702 711 9 702 711 714 9 702 711 - 717 9 699 696 702 11 699 696 750 12 - 696 702 705 9 696 702 708 9 693 690 - 696 13 690 696 699 14 816 822 825 2 - 810 804 813 27 807 804 810 27 807 804 - 813 27 801 795 804 28 798 795 801 29 - 798 795 804 28 795 804 807 30 795 804 - 810 30 795 804 813 30 792 786 795 9 - 789 786 792 5 789 786 795 9 786 795 - 798 31 786 795 801 31 783 777 786 9 - 780 777 783 5 780 777 786 9 777 786 - 789 9 777 786 792 9 774 768 777 9 - 771 768 774 5 771 768 777 9 768 777 - 780 9 768 777 783 9 765 762 768 11 - 765 762 816 12 762 768 771 9 762 768 - 774 9 759 756 762 13 756 762 765 14 - 873 879 882 2 867 861 870 5 864 861 - 867 5 864 861 870 5 858 852 861 9 - 855 852 858 5 855 852 861 9 852 861 - 864 9 852 861 867 9 852 861 870 9 - 846 840 849 5 843 840 846 5 843 840 - 849 5 837 834 840 9 837 834 852 9 - 834 840 843 9 834 840 846 9 834 840 - 849 9 834 852 855 9 834 852 858 9 - 831 828 834 11 831 828 873 12 828 834 - 837 9 825 822 828 13 822 828 831 14 - 930 936 939 2 924 918 927 5 921 918 - 924 5 921 918 927 5 912 906 915 5 - 909 906 912 5 909 906 915 5 903 900 - 906 9 903 900 918 9 900 906 909 9 - 900 906 912 9 900 906 915 9 900 918 - 921 9 900 918 924 9 900 918 927 9 - 897 891 900 9 894 891 897 5 894 891 - 900 9 891 900 903 9 888 885 891 11 - 888 885 930 12 885 891 894 9 885 891 - 897 9 882 879 885 13 879 885 888 14 - 981 987 990 2 981 987 993 2 975 972 - 978 40 966 972 975 2 966 972 978 2 - 963 957 966 4 960 957 963 5 960 957 - 966 4 954 948 957 9 951 948 954 5 - 951 948 957 9 948 957 960 9 948 957 - 963 9 945 942 948 11 945 942 981 12 - 942 948 951 9 942 948 954 9 939 936 - 942 13 936 942 945 14 990 987 993 40 -%FLAG ANGLES_WITHOUT_HYDROGEN -%FORMAT(10I8) - 15 12 18 1 12 18 24 3 3 12 - 15 6 3 12 18 7 63 60 66 1 - 60 66 72 3 36 30 48 8 30 24 - 60 10 24 30 36 8 24 30 48 8 - 24 60 63 6 24 60 66 7 18 24 - 30 15 18 24 60 16 123 120 126 1 - 120 126 132 3 102 108 114 18 96 102 - 108 18 90 87 114 18 90 96 102 18 - 87 90 96 18 87 114 108 18 78 72 - 120 10 78 87 90 20 78 87 114 20 - 72 78 87 21 72 120 123 6 72 120 - 126 7 66 72 78 15 66 72 120 16 - 180 177 183 1 177 183 189 3 144 138 - 156 8 138 132 177 10 138 156 165 8 - 132 138 144 8 132 138 156 8 132 177 - 180 6 132 177 183 7 126 132 138 15 - 126 132 177 16 222 219 225 1 219 225 - 231 3 201 195 213 22 195 189 219 10 - 189 195 201 8 189 195 213 22 189 219 - 222 6 189 219 225 7 183 189 195 15 - 183 189 219 16 255 252 258 1 252 258 - 261 3 252 258 288 3 237 231 252 10 - 231 237 246 22 231 252 255 6 231 252 - 258 7 225 231 237 15 225 231 252 16 - 297 294 300 1 294 300 306 3 288 294 - 297 6 288 294 300 7 279 288 294 10 - 270 279 288 8 261 258 288 26 261 270 - 279 8 258 261 270 15 258 288 279 15 - 258 288 294 16 318 315 321 1 315 321 - 327 3 306 315 318 6 306 315 321 7 - 300 306 315 16 384 381 387 1 381 387 - 393 3 351 360 369 32 342 351 360 8 - 333 327 381 10 333 342 351 8 327 333 - 342 8 327 381 384 6 327 381 387 7 - 321 327 333 15 321 327 381 16 426 423 - 429 1 423 429 435 3 405 399 417 22 - 399 393 423 10 393 399 405 8 393 399 - 417 22 393 423 426 6 393 423 429 7 - 387 393 399 15 387 393 423 16 489 486 - 492 1 486 492 498 3 468 465 474 33 - 465 474 480 36 459 465 468 33 459 465 - 474 37 453 450 480 18 453 459 465 36 - 450 453 459 18 450 480 474 18 441 435 - 486 10 441 450 453 20 441 450 480 20 - 435 441 450 21 435 486 489 6 435 486 - 492 7 429 435 441 15 429 435 486 16 - 531 528 534 1 528 534 540 3 510 504 - 522 22 504 498 528 10 498 504 510 8 - 498 504 522 22 498 528 531 6 498 528 - 534 7 492 498 504 15 492 498 528 16 - 576 573 579 1 573 579 585 3 567 564 - 570 38 555 564 567 39 555 564 570 39 - 546 540 573 10 546 555 564 10 540 546 - 555 8 540 573 576 6 540 573 579 7 - 534 540 546 15 534 540 573 16 624 621 - 627 1 621 627 630 3 621 627 657 3 - 597 591 609 8 591 585 621 10 585 591 - 597 8 585 591 609 8 585 621 624 6 - 585 621 627 7 579 585 591 15 579 585 - 621 16 666 663 669 1 663 669 675 3 - 657 663 666 6 657 663 669 7 648 657 - 663 10 639 648 657 8 630 627 657 26 - 630 639 648 8 627 630 639 15 627 657 - 648 15 627 657 663 16 687 684 690 1 - 684 690 696 3 675 684 687 6 675 684 - 690 7 669 675 684 16 753 750 756 1 - 750 756 762 3 720 729 738 32 711 720 - 729 8 702 696 750 10 702 711 720 8 - 696 702 711 8 696 750 753 6 696 750 - 756 7 690 696 702 15 690 696 750 16 - 819 816 822 1 816 822 828 3 786 795 - 804 32 777 786 795 8 768 762 816 10 - 768 777 786 8 762 768 777 8 762 816 - 819 6 762 816 822 7 756 762 768 15 - 756 762 816 16 876 873 879 1 873 879 - 885 3 840 834 852 8 834 828 873 10 - 834 852 861 8 828 834 840 8 828 834 - 852 8 828 873 876 6 828 873 879 7 - 822 828 834 15 822 828 873 16 933 930 - 936 1 930 936 942 3 906 900 918 8 - 891 885 930 10 891 900 906 8 891 900 - 918 8 885 891 900 8 885 930 933 6 - 885 930 936 7 879 885 891 15 879 885 - 930 16 984 981 987 1 969 966 972 1 - 957 966 969 6 957 966 972 7 948 942 - 981 10 948 957 966 10 942 948 957 8 - 942 981 984 6 942 981 987 7 936 942 - 948 15 936 942 981 16 -%FLAG DIHEDRALS_INC_HYDROGEN -%FORMAT(10I8) - 15 12 18 21 1 15 12 -18 21 2 - 12 18 24 27 3 9 3 12 15 11 - 9 3 -12 15 12 9 3 12 18 3 - 6 3 12 15 11 6 3 -12 15 3 - 6 3 -12 15 12 6 3 12 18 3 - 3 12 18 21 2 0 3 12 15 11 - 0 3 -12 15 3 0 3 -12 15 12 - 0 3 12 18 3 63 60 66 69 1 - 63 60 -66 69 2 60 66 72 75 3 - 45 36 30 48 14 42 36 30 48 14 - 39 36 30 48 14 36 30 48 51 14 - 36 30 48 54 14 36 30 48 57 14 - 33 30 24 60 13 33 30 36 39 15 - 33 30 36 42 15 33 30 36 45 15 - 33 30 48 51 15 33 30 48 54 15 - 33 30 48 57 15 27 24 30 33 13 - 27 24 30 36 13 27 24 30 48 13 - 27 24 60 63 11 27 24 -60 63 12 - 27 24 60 66 3 24 30 36 39 14 - 24 30 36 42 14 24 30 36 45 14 - 24 30 48 51 14 24 30 48 54 14 - 24 30 48 57 14 24 60 66 69 2 - 21 18 24 27 3 21 18 24 30 3 - 21 18 24 60 3 18 24 30 33 13 - 123 120 126 129 1 123 120 -126 129 2 - 120 126 132 135 3 111 108 114 117 22 - 105 102 108 111 22 105 102 108 114 22 - 102 108 114 117 22 99 96 102 105 22 - 99 96 102 108 22 96 102 108 111 22 - 93 90 87 114 22 93 90 96 99 22 - 93 90 96 102 22 90 87 114 117 22 - 90 96 102 105 22 87 90 96 99 22 - 87 114 108 111 22 84 78 72 120 13 - 84 78 87 90 3 84 78 87 114 3 - 81 78 72 120 13 81 78 87 90 3 - 81 78 87 114 3 78 87 90 93 22 - 78 87 114 117 22 75 72 78 81 13 - 75 72 78 84 13 75 72 78 87 13 - 75 72 120 123 11 75 72 -120 123 12 - 75 72 120 126 3 72 120 126 129 2 - 69 66 72 75 3 69 66 72 78 3 - 69 66 72 120 3 66 72 78 81 13 - 66 72 78 84 13 180 177 183 186 1 - 180 177 -183 186 2 177 183 189 192 3 - 162 156 165 168 15 162 156 165 171 15 - 162 156 165 174 15 159 156 165 168 15 - 159 156 165 171 15 159 156 165 174 15 - 153 144 138 156 14 150 144 138 156 14 - 147 144 138 156 14 144 138 156 159 14 - 144 138 156 162 14 141 138 132 177 13 - 141 138 144 147 15 141 138 144 150 15 - 141 138 144 153 15 141 138 156 159 15 - 141 138 156 162 15 141 138 156 165 14 - 138 156 165 168 14 138 156 165 171 14 - 138 156 165 174 14 135 132 138 141 13 - 135 132 138 144 13 135 132 138 156 13 - 135 132 177 180 11 135 132 -177 180 12 - 135 132 177 183 3 132 138 144 147 14 - 132 138 144 150 14 132 138 144 153 14 - 132 138 156 159 14 132 138 156 162 14 - 132 177 183 186 2 129 126 132 135 3 - 129 126 132 138 3 129 126 132 177 3 - 126 132 138 141 13 222 219 225 228 1 - 222 219 -225 228 2 219 225 231 234 3 - 210 201 195 213 26 207 201 195 213 26 - 204 201 195 213 26 201 195 213 216 26 - 201 195 -213 216 14 198 195 189 219 13 - 198 195 201 204 13 198 195 201 207 13 - 198 195 201 210 13 198 195 213 216 27 - 192 189 195 198 13 192 189 195 201 13 - 192 189 195 213 26 192 189 219 222 11 - 192 189 -219 222 12 192 189 219 225 3 - 189 195 201 204 14 189 195 201 207 14 - 189 195 201 210 14 189 195 213 216 26 - 189 195 -213 216 14 189 219 225 228 2 - 186 183 189 192 3 186 183 189 195 3 - 186 183 189 219 3 183 189 195 198 13 - 252 258 261 264 3 252 258 261 267 3 - 252 258 288 291 3 243 237 231 252 13 - 243 237 246 249 27 240 237 231 252 13 - 240 237 246 249 27 234 231 237 240 13 - 234 231 237 243 13 234 231 237 246 26 - 234 231 252 255 11 234 231 -252 255 12 - 234 231 252 258 3 231 237 246 249 26 - 231 237 -246 249 14 228 225 231 234 3 - 228 225 231 237 3 228 225 231 252 3 - 225 231 237 240 13 225 231 237 243 13 - 297 294 300 303 1 297 294 -300 303 2 - 294 300 306 309 3 294 300 306 312 3 - 291 288 294 297 11 291 288 -294 297 12 - 291 288 294 300 3 288 294 300 303 2 - 285 279 288 291 13 285 279 288 294 13 - 282 279 288 291 13 282 279 288 294 13 - 276 270 279 282 15 276 270 279 285 15 - 276 270 279 288 14 273 270 279 282 15 - 273 270 279 285 15 273 270 279 288 14 - 270 279 288 291 13 267 261 258 288 3 - 267 261 270 273 13 267 261 270 276 13 - 267 261 270 279 13 264 261 258 288 3 - 264 261 270 273 13 264 261 270 276 13 - 264 261 270 279 13 261 258 288 291 3 - 261 270 279 282 14 261 270 279 285 14 - 258 261 270 273 13 258 261 270 276 13 - 258 288 279 282 13 258 288 279 285 13 - 318 315 321 324 1 318 315 -321 324 2 - 315 321 327 330 3 312 306 315 318 11 - 312 306 -315 318 12 312 306 315 321 3 - 309 306 315 318 11 309 306 -315 318 12 - 309 306 315 321 3 306 315 321 324 2 - 303 300 306 309 3 303 300 306 312 3 - 303 300 306 315 3 384 381 387 390 1 - 384 381 -387 390 2 381 387 393 396 3 - 366 360 369 372 13 366 360 369 375 13 - 366 360 369 378 13 363 360 369 372 13 - 363 360 369 375 13 363 360 369 378 13 - 357 351 360 363 13 357 351 360 366 13 - 357 351 360 369 13 354 351 360 363 13 - 354 351 360 366 13 354 351 360 369 13 - 351 360 369 372 13 351 360 369 375 13 - 351 360 369 378 13 348 342 351 354 15 - 348 342 351 357 15 348 342 351 360 14 - 345 342 351 354 15 345 342 351 357 15 - 345 342 351 360 14 342 351 360 363 13 - 342 351 360 366 13 339 333 327 381 13 - 339 333 342 345 15 339 333 342 348 15 - 339 333 342 351 14 336 333 327 381 13 - 336 333 342 345 15 336 333 342 348 15 - 336 333 342 351 14 333 342 351 354 14 - 333 342 351 357 14 330 327 333 336 13 - 330 327 333 339 13 330 327 333 342 13 - 330 327 381 384 11 330 327 -381 384 12 - 330 327 381 387 3 327 333 342 345 14 - 327 333 342 348 14 327 381 387 390 2 - 324 321 327 330 3 324 321 327 333 3 - 324 321 327 381 3 321 327 333 336 13 - 321 327 333 339 13 426 423 429 432 1 - 426 423 -429 432 2 423 429 435 438 3 - 414 405 399 417 26 411 405 399 417 26 - 408 405 399 417 26 405 399 417 420 26 - 405 399 -417 420 14 402 399 393 423 13 - 402 399 405 408 13 402 399 405 411 13 - 402 399 405 414 13 402 399 417 420 27 - 396 393 399 402 13 396 393 399 405 13 - 396 393 399 417 26 396 393 423 426 11 - 396 393 -423 426 12 396 393 423 429 3 - 393 399 405 408 14 393 399 405 411 14 - 393 399 405 414 14 393 399 417 420 26 - 393 399 -417 420 14 393 423 429 432 2 - 390 387 393 396 3 390 387 393 399 3 - 390 387 393 423 3 387 393 399 402 13 - 489 486 492 495 1 489 486 -492 495 2 - 486 492 498 501 3 477 474 480 483 22 - 471 468 465 474 28 468 465 474 477 22 - 465 474 480 483 22 462 459 465 468 22 - 462 459 465 474 22 459 465 468 471 28 - 459 465 474 477 22 456 453 450 480 22 - 456 453 459 462 22 456 453 459 465 22 - 453 450 480 483 22 450 453 459 462 22 - 450 480 474 477 22 447 441 435 486 13 - 447 441 450 453 3 447 441 450 480 3 - 444 441 435 486 13 444 441 450 453 3 - 444 441 450 480 3 441 450 453 456 22 - 441 450 480 483 22 438 435 441 444 13 - 438 435 441 447 13 438 435 441 450 13 - 438 435 486 489 11 438 435 -486 489 12 - 438 435 486 492 3 435 486 492 495 2 - 432 429 435 438 3 432 429 435 441 3 - 432 429 435 486 3 429 435 441 444 13 - 429 435 441 447 13 531 528 534 537 1 - 531 528 -534 537 2 528 534 540 543 3 - 519 510 504 522 26 516 510 504 522 26 - 513 510 504 522 26 510 504 522 525 26 - 510 504 -522 525 14 507 504 498 528 13 - 507 504 510 513 13 507 504 510 516 13 - 507 504 510 519 13 507 504 522 525 27 - 501 498 504 507 13 501 498 504 510 13 - 501 498 504 522 26 501 498 528 531 11 - 501 498 -528 531 12 501 498 528 534 3 - 498 504 510 513 14 498 504 510 516 14 - 498 504 510 519 14 498 504 522 525 26 - 498 504 -522 525 14 498 528 534 537 2 - 495 492 498 501 3 495 492 498 504 3 - 495 492 498 528 3 492 498 504 507 13 - 576 573 579 582 1 576 573 -579 582 2 - 573 579 585 588 3 561 555 564 567 3 - 561 555 564 570 3 558 555 564 567 3 - 558 555 564 570 3 552 546 540 573 13 - 552 546 555 558 15 552 546 555 561 15 - 552 546 555 564 13 549 546 540 573 13 - 549 546 555 558 15 549 546 555 561 15 - 549 546 555 564 13 543 540 546 549 13 - 543 540 546 552 13 543 540 546 555 13 - 543 540 573 576 11 543 540 -573 576 12 - 543 540 573 579 3 540 546 555 558 14 - 540 546 555 561 14 540 573 579 582 2 - 537 534 540 543 3 537 534 540 546 3 - 537 534 540 573 3 534 540 546 549 13 - 534 540 546 552 13 621 627 630 633 3 - 621 627 630 636 3 621 627 657 660 3 - 606 597 591 609 14 603 597 591 609 14 - 600 597 591 609 14 597 591 609 612 14 - 597 591 609 615 14 597 591 609 618 14 - 594 591 585 621 13 594 591 597 600 15 - 594 591 597 603 15 594 591 597 606 15 - 594 591 609 612 15 594 591 609 615 15 - 594 591 609 618 15 588 585 591 594 13 - 588 585 591 597 13 588 585 591 609 13 - 588 585 621 624 11 588 585 -621 624 12 - 588 585 621 627 3 585 591 597 600 14 - 585 591 597 603 14 585 591 597 606 14 - 585 591 609 612 14 585 591 609 615 14 - 585 591 609 618 14 582 579 585 588 3 - 582 579 585 591 3 582 579 585 621 3 - 579 585 591 594 13 666 663 669 672 1 - 666 663 -669 672 2 663 669 675 678 3 - 663 669 675 681 3 660 657 663 666 11 - 660 657 -663 666 12 660 657 663 669 3 - 657 663 669 672 2 654 648 657 660 13 - 654 648 657 663 13 651 648 657 660 13 - 651 648 657 663 13 645 639 648 651 15 - 645 639 648 654 15 645 639 648 657 14 - 642 639 648 651 15 642 639 648 654 15 - 642 639 648 657 14 639 648 657 660 13 - 636 630 627 657 3 636 630 639 642 13 - 636 630 639 645 13 636 630 639 648 13 - 633 630 627 657 3 633 630 639 642 13 - 633 630 639 645 13 633 630 639 648 13 - 630 627 657 660 3 630 639 648 651 14 - 630 639 648 654 14 627 630 639 642 13 - 627 630 639 645 13 627 657 648 651 13 - 627 657 648 654 13 687 684 690 693 1 - 687 684 -690 693 2 684 690 696 699 3 - 681 675 684 687 11 681 675 -684 687 12 - 681 675 684 690 3 678 675 684 687 11 - 678 675 -684 687 12 678 675 684 690 3 - 675 684 690 693 2 672 669 675 678 3 - 672 669 675 681 3 672 669 675 684 3 - 753 750 756 759 1 753 750 -756 759 2 - 750 756 762 765 3 735 729 738 741 13 - 735 729 738 744 13 735 729 738 747 13 - 732 729 738 741 13 732 729 738 744 13 - 732 729 738 747 13 726 720 729 732 13 - 726 720 729 735 13 726 720 729 738 13 - 723 720 729 732 13 723 720 729 735 13 - 723 720 729 738 13 720 729 738 741 13 - 720 729 738 744 13 720 729 738 747 13 - 717 711 720 723 15 717 711 720 726 15 - 717 711 720 729 14 714 711 720 723 15 - 714 711 720 726 15 714 711 720 729 14 - 711 720 729 732 13 711 720 729 735 13 - 708 702 696 750 13 708 702 711 714 15 - 708 702 711 717 15 708 702 711 720 14 - 705 702 696 750 13 705 702 711 714 15 - 705 702 711 717 15 705 702 711 720 14 - 702 711 720 723 14 702 711 720 726 14 - 699 696 702 705 13 699 696 702 708 13 - 699 696 702 711 13 699 696 750 753 11 - 699 696 -750 753 12 699 696 750 756 3 - 696 702 711 714 14 696 702 711 717 14 - 696 750 756 759 2 693 690 696 699 3 - 693 690 696 702 3 693 690 696 750 3 - 690 696 702 705 13 690 696 702 708 13 - 819 816 822 825 1 819 816 -822 825 2 - 816 822 828 831 3 801 795 804 807 13 - 801 795 804 810 13 801 795 804 813 13 - 798 795 804 807 13 798 795 804 810 13 - 798 795 804 813 13 792 786 795 798 13 - 792 786 795 801 13 792 786 795 804 13 - 789 786 795 798 13 789 786 795 801 13 - 789 786 795 804 13 786 795 804 807 13 - 786 795 804 810 13 786 795 804 813 13 - 783 777 786 789 15 783 777 786 792 15 - 783 777 786 795 14 780 777 786 789 15 - 780 777 786 792 15 780 777 786 795 14 - 777 786 795 798 13 777 786 795 801 13 - 774 768 762 816 13 774 768 777 780 15 - 774 768 777 783 15 774 768 777 786 14 - 771 768 762 816 13 771 768 777 780 15 - 771 768 777 783 15 771 768 777 786 14 - 768 777 786 789 14 768 777 786 792 14 - 765 762 768 771 13 765 762 768 774 13 - 765 762 768 777 13 765 762 816 819 11 - 765 762 -816 819 12 765 762 816 822 3 - 762 768 777 780 14 762 768 777 783 14 - 762 816 822 825 2 759 756 762 765 3 - 759 756 762 768 3 759 756 762 816 3 - 756 762 768 771 13 756 762 768 774 13 - 876 873 879 882 1 876 873 -879 882 2 - 873 879 885 888 3 858 852 861 864 15 - 858 852 861 867 15 858 852 861 870 15 - 855 852 861 864 15 855 852 861 867 15 - 855 852 861 870 15 849 840 834 852 14 - 846 840 834 852 14 843 840 834 852 14 - 840 834 852 855 14 840 834 852 858 14 - 837 834 828 873 13 837 834 840 843 15 - 837 834 840 846 15 837 834 840 849 15 - 837 834 852 855 15 837 834 852 858 15 - 837 834 852 861 14 834 852 861 864 14 - 834 852 861 867 14 834 852 861 870 14 - 831 828 834 837 13 831 828 834 840 13 - 831 828 834 852 13 831 828 873 876 11 - 831 828 -873 876 12 831 828 873 879 3 - 828 834 840 843 14 828 834 840 846 14 - 828 834 840 849 14 828 834 852 855 14 - 828 834 852 858 14 828 873 879 882 2 - 825 822 828 831 3 825 822 828 834 3 - 825 822 828 873 3 822 828 834 837 13 - 933 930 936 939 1 933 930 -936 939 2 - 930 936 942 945 3 915 906 900 918 14 - 912 906 900 918 14 909 906 900 918 14 - 906 900 918 921 14 906 900 918 924 14 - 906 900 918 927 14 903 900 906 909 15 - 903 900 906 912 15 903 900 906 915 15 - 903 900 918 921 15 903 900 918 924 15 - 903 900 918 927 15 897 891 885 930 13 - 897 891 900 903 15 897 891 900 906 14 - 897 891 900 918 14 894 891 885 930 13 - 894 891 900 903 15 894 891 900 906 14 - 894 891 900 918 14 891 900 906 909 14 - 891 900 906 912 14 891 900 906 915 14 - 891 900 918 921 14 891 900 918 924 14 - 891 900 918 927 14 888 885 891 894 13 - 888 885 891 897 13 888 885 891 900 13 - 888 885 930 933 11 888 885 -930 933 12 - 888 885 930 936 3 885 891 900 903 14 - 885 930 936 939 2 882 879 885 888 3 - 882 879 885 891 3 882 879 885 930 3 - 879 885 891 894 13 879 885 891 897 13 - 984 981 987 990 1 984 981 -987 990 2 - 984 981 987 993 1 984 981 -987 993 2 - 969 966 972 975 1 969 966 -972 975 2 - 969 966 972 978 1 969 966 -972 978 2 - 963 957 966 969 11 963 957 -966 969 3 - 963 957 -966 969 12 963 957 966 972 3 - 960 957 966 969 11 960 957 -966 969 3 - 960 957 -966 969 12 960 957 966 972 3 - 957 966 972 975 2 957 966 972 978 2 - 954 948 942 981 13 954 948 957 960 15 - 954 948 957 963 15 954 948 957 966 13 - 951 948 942 981 13 951 948 957 960 15 - 951 948 957 963 15 951 948 957 966 13 - 945 942 948 951 13 945 942 948 954 13 - 945 942 948 957 13 945 942 981 984 11 - 945 942 -981 984 12 945 942 981 987 3 - 942 948 957 960 14 942 948 957 963 14 - 942 981 987 990 2 942 981 987 993 2 - 939 936 942 945 3 939 936 942 948 3 - 939 936 942 981 3 936 942 948 951 13 - 936 942 948 954 13 12 24 -18 -21 30 - 87 108 -114 -117 30 102 114 -108 -111 30 - 96 108 -102 -105 30 90 102 -96 -99 30 - 87 96 -90 -93 30 60 72 -66 -69 30 - 120 132 -126 -129 30 177 189 -183 -186 30 - 219 231 -225 -228 30 294 306 -300 -303 30 - 315 327 -321 -324 30 381 393 -387 -390 30 - 450 474 -480 -483 30 465 480 -474 -477 30 - 453 465 -459 -462 30 450 459 -453 -456 30 - 423 435 -429 -432 30 486 498 -492 -495 30 - 528 540 -534 -537 30 573 585 -579 -582 30 - 663 675 -669 -672 30 684 696 -690 -693 30 - 750 762 -756 -759 30 816 828 -822 -825 30 - 873 885 -879 -882 30 966 975 -972 -978 31 - 930 942 -936 -939 30 981 990 -987 -993 31 -%FLAG DIHEDRALS_WITHOUT_HYDROGEN -%FORMAT(10I8) - 15 12 18 24 2 12 18 24 30 4 - 12 18 -24 30 5 12 18 -24 30 6 - 12 18 24 60 7 12 18 -24 60 8 - 12 18 -24 60 9 12 18 -24 60 10 - 3 12 18 24 2 63 60 66 72 2 - 60 66 72 78 4 60 66 -72 78 5 - 60 66 -72 78 6 60 66 72 120 7 - 60 66 -72 120 8 60 66 -72 120 9 - 60 66 -72 120 10 48 30 24 60 13 - 36 30 24 60 13 30 24 60 63 3 - 30 24 60 66 16 30 24 -60 66 17 - 24 60 66 72 2 18 24 30 36 13 - 18 24 30 48 13 18 24 60 63 3 - 18 24 60 66 18 18 24 -60 66 19 - 18 24 -60 66 20 18 24 -60 66 21 - 123 120 126 132 2 120 126 132 138 4 - 120 126 -132 138 5 120 126 -132 138 6 - 120 126 132 177 7 120 126 -132 177 8 - 120 126 -132 177 9 120 126 -132 177 10 - 96 90 87 114 22 96 102 -108 114 22 - 90 87 114 108 22 90 96 -102 108 22 - 87 78 72 120 13 87 90 96 102 22 - 87 114 -108 102 22 78 72 120 123 3 - 78 72 120 126 16 78 72 -120 126 17 - 78 87 90 96 22 78 87 114 108 22 - 72 78 87 90 3 72 78 87 114 3 - 72 120 126 132 2 66 72 78 87 13 - 66 72 120 123 3 66 72 120 126 18 - 66 72 -120 126 19 66 72 -120 126 20 - 66 72 -120 126 21 180 177 183 189 2 - 177 183 189 195 4 177 183 -189 195 5 - 177 183 -189 195 6 177 183 189 219 7 - 177 183 -189 219 8 177 183 -189 219 9 - 177 183 -189 219 10 156 138 132 177 13 - 144 138 132 177 13 144 138 156 165 23 - 144 138 -156 165 24 144 138 -156 165 25 - 138 132 177 180 3 138 132 177 183 16 - 138 132 -177 183 17 132 138 156 165 23 - 132 138 -156 165 24 132 138 -156 165 25 - 132 177 183 189 2 126 132 138 144 13 - 126 132 138 156 13 126 132 177 180 3 - 126 132 177 183 18 126 132 -177 183 19 - 126 132 -177 183 20 126 132 -177 183 21 - 222 219 225 231 2 219 225 231 237 4 - 219 225 -231 237 5 219 225 -231 237 6 - 219 225 231 252 7 219 225 -231 252 8 - 219 225 -231 252 9 219 225 -231 252 10 - 213 195 189 219 13 201 195 189 219 13 - 195 189 219 222 3 195 189 219 225 16 - 195 189 -219 225 17 189 219 225 231 2 - 183 189 195 201 13 183 189 195 213 13 - 183 189 219 222 3 183 189 219 225 18 - 183 189 -219 225 19 183 189 -219 225 20 - 183 189 -219 225 21 255 252 258 261 2 - 255 252 258 288 2 252 258 261 270 4 - 252 258 -261 270 5 252 258 -261 270 6 - 252 258 288 279 4 252 258 -288 279 5 - 252 258 -288 279 6 252 258 288 294 7 - 252 258 -288 294 8 252 258 -288 294 9 - 252 258 -288 294 10 246 237 231 252 13 - 237 231 252 255 3 237 231 252 258 16 - 237 231 -252 258 17 231 252 258 261 2 - 231 252 258 288 2 225 231 237 246 13 - 225 231 252 255 3 225 231 252 258 18 - 225 231 -252 258 19 225 231 -252 258 20 - 225 231 -252 258 21 297 294 300 306 2 - 294 300 306 315 7 294 300 -306 315 8 - 294 300 -306 315 9 294 300 -306 315 10 - 288 294 300 306 2 279 288 294 297 3 - 279 288 294 300 16 279 288 -294 300 17 - 270 261 -258 288 3 270 279 288 294 13 - 261 258 -288 279 3 261 258 288 294 3 - 261 270 -279 288 23 261 270 -279 288 24 - 261 270 -279 288 25 258 261 -270 279 13 - 258 288 -279 270 13 258 288 294 297 3 - 258 288 294 300 18 258 288 -294 300 19 - 258 288 -294 300 20 258 288 -294 300 21 - 318 315 321 327 2 315 321 327 333 4 - 315 321 -327 333 5 315 321 -327 333 6 - 315 321 327 381 7 315 321 -327 381 8 - 315 321 -327 381 9 315 321 -327 381 10 - 306 315 321 327 2 300 306 315 318 3 - 300 306 315 321 18 300 306 -315 321 19 - 300 306 -315 321 20 300 306 -315 321 21 - 384 381 387 393 2 381 387 393 399 4 - 381 387 -393 399 5 381 387 -393 399 6 - 381 387 393 423 7 381 387 -393 423 8 - 381 387 -393 423 9 381 387 -393 423 10 - 342 333 327 381 13 342 351 360 369 13 - 333 327 381 384 3 333 327 381 387 16 - 333 327 -381 387 17 333 342 351 360 23 - 333 342 -351 360 24 333 342 -351 360 25 - 327 333 342 351 23 327 333 -342 351 24 - 327 333 -342 351 25 327 381 387 393 2 - 321 327 333 342 13 321 327 381 384 3 - 321 327 381 387 18 321 327 -381 387 19 - 321 327 -381 387 20 321 327 -381 387 21 - 426 423 429 435 2 423 429 435 441 4 - 423 429 -435 441 5 423 429 -435 441 6 - 423 429 435 486 7 423 429 -435 486 8 - 423 429 -435 486 9 423 429 -435 486 10 - 417 399 393 423 13 405 399 393 423 13 - 399 393 423 426 3 399 393 423 429 16 - 399 393 -423 429 17 393 423 429 435 2 - 387 393 399 405 13 387 393 399 417 13 - 387 393 423 426 3 387 393 423 429 18 - 387 393 -423 429 19 387 393 -423 429 20 - 387 393 -423 429 21 489 486 492 498 2 - 486 492 498 504 4 486 492 -498 504 5 - 486 492 -498 504 6 486 492 498 528 7 - 486 492 -498 528 8 486 492 -498 528 9 - 486 492 -498 528 10 468 465 474 480 22 - 459 453 450 480 22 459 465 -474 480 22 - 453 450 480 474 22 453 459 465 468 22 - 453 459 -465 474 22 450 441 435 486 13 - 450 453 459 465 22 450 480 -474 465 22 - 441 435 486 489 3 441 435 486 492 16 - 441 435 -486 492 17 441 450 453 459 22 - 441 450 480 474 22 435 441 450 453 3 - 435 441 450 480 3 435 486 492 498 2 - 429 435 441 450 13 429 435 486 489 3 - 429 435 486 492 18 429 435 -486 492 19 - 429 435 -486 492 20 429 435 -486 492 21 - 531 528 534 540 2 528 534 540 546 4 - 528 534 -540 546 5 528 534 -540 546 6 - 528 534 540 573 7 528 534 -540 573 8 - 528 534 -540 573 9 528 534 -540 573 10 - 522 504 498 528 13 510 504 498 528 13 - 504 498 528 531 3 504 498 528 534 16 - 504 498 -528 534 17 498 528 534 540 2 - 492 498 504 510 13 492 498 504 522 13 - 492 498 528 531 3 492 498 528 534 18 - 492 498 -528 534 19 492 498 -528 534 20 - 492 498 -528 534 21 576 573 579 585 2 - 573 579 585 591 4 573 579 -585 591 5 - 573 579 -585 591 6 573 579 585 621 7 - 573 579 -585 621 8 573 579 -585 621 9 - 573 579 -585 621 10 555 546 540 573 13 - 546 540 573 576 3 546 540 573 579 16 - 546 540 -573 579 17 546 555 564 567 3 - 546 555 564 570 3 540 546 555 564 13 - 540 573 579 585 2 534 540 546 555 13 - 534 540 573 576 3 534 540 573 579 18 - 534 540 -573 579 19 534 540 -573 579 20 - 534 540 -573 579 21 624 621 627 630 2 - 624 621 627 657 2 621 627 630 639 4 - 621 627 -630 639 5 621 627 -630 639 6 - 621 627 657 648 4 621 627 -657 648 5 - 621 627 -657 648 6 621 627 657 663 7 - 621 627 -657 663 8 621 627 -657 663 9 - 621 627 -657 663 10 609 591 585 621 13 - 597 591 585 621 13 591 585 621 624 3 - 591 585 621 627 16 591 585 -621 627 17 - 585 621 627 630 2 585 621 627 657 2 - 579 585 591 597 13 579 585 591 609 13 - 579 585 621 624 3 579 585 621 627 18 - 579 585 -621 627 19 579 585 -621 627 20 - 579 585 -621 627 21 666 663 669 675 2 - 663 669 675 684 7 663 669 -675 684 8 - 663 669 -675 684 9 663 669 -675 684 10 - 657 663 669 675 2 648 657 663 666 3 - 648 657 663 669 16 648 657 -663 669 17 - 639 630 -627 657 3 639 648 657 663 13 - 630 627 -657 648 3 630 627 657 663 3 - 630 639 -648 657 23 630 639 -648 657 24 - 630 639 -648 657 25 627 630 -639 648 13 - 627 657 -648 639 13 627 657 663 666 3 - 627 657 663 669 18 627 657 -663 669 19 - 627 657 -663 669 20 627 657 -663 669 21 - 687 684 690 696 2 684 690 696 702 4 - 684 690 -696 702 5 684 690 -696 702 6 - 684 690 696 750 7 684 690 -696 750 8 - 684 690 -696 750 9 684 690 -696 750 10 - 675 684 690 696 2 669 675 684 687 3 - 669 675 684 690 18 669 675 -684 690 19 - 669 675 -684 690 20 669 675 -684 690 21 - 753 750 756 762 2 750 756 762 768 4 - 750 756 -762 768 5 750 756 -762 768 6 - 750 756 762 816 7 750 756 -762 816 8 - 750 756 -762 816 9 750 756 -762 816 10 - 711 702 696 750 13 711 720 729 738 13 - 702 696 750 753 3 702 696 750 756 16 - 702 696 -750 756 17 702 711 720 729 23 - 702 711 -720 729 24 702 711 -720 729 25 - 696 702 711 720 23 696 702 -711 720 24 - 696 702 -711 720 25 696 750 756 762 2 - 690 696 702 711 13 690 696 750 753 3 - 690 696 750 756 18 690 696 -750 756 19 - 690 696 -750 756 20 690 696 -750 756 21 - 819 816 822 828 2 816 822 828 834 4 - 816 822 -828 834 5 816 822 -828 834 6 - 816 822 828 873 7 816 822 -828 873 8 - 816 822 -828 873 9 816 822 -828 873 10 - 777 768 762 816 13 777 786 795 804 13 - 768 762 816 819 3 768 762 816 822 16 - 768 762 -816 822 17 768 777 786 795 23 - 768 777 -786 795 24 768 777 -786 795 25 - 762 768 777 786 23 762 768 -777 786 24 - 762 768 -777 786 25 762 816 822 828 2 - 756 762 768 777 13 756 762 816 819 3 - 756 762 816 822 18 756 762 -816 822 19 - 756 762 -816 822 20 756 762 -816 822 21 - 876 873 879 885 2 873 879 885 891 4 - 873 879 -885 891 5 873 879 -885 891 6 - 873 879 885 930 7 873 879 -885 930 8 - 873 879 -885 930 9 873 879 -885 930 10 - 852 834 828 873 13 840 834 828 873 13 - 840 834 852 861 23 840 834 -852 861 24 - 840 834 -852 861 25 834 828 873 876 3 - 834 828 873 879 16 834 828 -873 879 17 - 828 834 852 861 23 828 834 -852 861 24 - 828 834 -852 861 25 828 873 879 885 2 - 822 828 834 840 13 822 828 834 852 13 - 822 828 873 876 3 822 828 873 879 18 - 822 828 -873 879 19 822 828 -873 879 20 - 822 828 -873 879 21 933 930 936 942 2 - 930 936 942 948 4 930 936 -942 948 5 - 930 936 -942 948 6 930 936 942 981 7 - 930 936 -942 981 8 930 936 -942 981 9 - 930 936 -942 981 10 900 891 885 930 13 - 891 885 930 933 3 891 885 930 936 16 - 891 885 -930 936 17 885 891 900 906 23 - 885 891 -900 906 24 885 891 -900 906 25 - 885 891 900 918 23 885 891 -900 918 24 - 885 891 -900 918 25 885 930 936 942 2 - 879 885 891 900 13 879 885 930 933 3 - 879 885 930 936 18 879 885 -930 936 19 - 879 885 -930 936 20 879 885 -930 936 21 - 957 948 942 981 13 948 942 981 984 3 - 948 942 981 987 16 948 942 -981 987 17 - 948 957 966 969 3 948 957 966 972 16 - 948 957 -966 972 17 942 948 957 966 13 - 936 942 948 957 13 936 942 981 984 3 - 936 942 981 987 18 936 942 -981 987 19 - 936 942 -981 987 20 936 942 -981 987 21 - 3 18 -12 -15 29 24 66 -60 -63 29 - 72 126 -120 -123 29 90 114 -87 -78 30 - 132 183 -177 -180 29 189 225 -219 -222 29 - 231 258 -252 -255 29 288 300 -294 -297 29 - 252 261 -258 -288 31 306 321 -315 -318 29 - 327 387 -381 -384 29 393 429 -423 -426 29 - 435 492 -486 -489 29 459 474 -465 -468 30 - 453 480 -450 -441 30 498 534 -528 -531 29 - 540 579 -573 -576 29 555 567 -564 -570 29 - 585 627 -621 -624 29 657 669 -663 -666 29 - 621 630 -627 -657 31 675 690 -684 -687 29 - 696 756 -750 -753 29 762 822 -816 -819 29 - 828 879 -873 -876 29 885 936 -930 -933 29 - 942 987 -981 -984 29 957 972 -966 -969 29 -%FLAG EXCLUDED_ATOMS_LIST -%FORMAT(10I8) - 2 3 4 5 6 7 3 4 5 6 - 7 8 9 4 5 6 7 5 6 7 - 6 7 8 9 10 11 21 7 8 9 - 8 9 10 11 12 13 17 21 22 23 - 9 10 11 21 10 11 12 13 14 15 - 16 17 18 19 20 21 22 23 24 25 - 11 12 13 17 21 22 23 12 13 14 - 15 16 17 18 19 20 21 22 23 13 - 14 15 16 17 18 19 20 21 14 15 - 16 17 18 19 20 21 15 16 17 16 - 17 17 18 19 20 21 19 20 20 0 - 22 23 24 25 26 27 41 23 24 25 - 24 25 26 27 28 29 30 41 42 43 - 25 26 27 41 26 27 28 29 30 31 - 39 41 42 43 44 45 27 28 29 30 - 41 42 43 28 29 30 31 32 33 37 - 39 40 41 42 43 29 30 31 39 41 - 30 31 39 41 31 32 33 34 35 37 - 38 39 40 41 32 33 34 35 36 37 - 39 40 33 34 35 39 34 35 36 37 - 38 39 35 36 37 36 37 38 39 40 - 37 38 39 38 39 40 39 40 40 0 - 42 43 44 45 46 47 60 43 44 45 - 44 45 46 47 48 49 53 60 61 62 - 45 46 47 60 46 47 48 49 50 51 - 52 53 54 55 56 60 61 62 63 64 - 47 48 49 53 60 61 62 48 49 50 - 51 52 53 54 55 56 57 58 59 60 - 61 62 49 50 51 52 53 54 55 56 - 60 50 51 52 53 54 55 56 60 51 - 52 53 52 53 53 54 55 56 57 58 - 59 60 55 56 57 58 59 56 57 58 - 59 57 58 59 58 59 59 0 61 62 - 63 64 65 66 74 62 63 64 63 64 - 65 66 67 68 72 74 75 76 64 65 - 66 74 65 66 67 68 69 70 71 72 - 73 74 75 76 77 78 66 67 68 72 - 74 75 76 67 68 69 70 71 72 73 - 74 75 76 68 69 70 71 72 73 74 - 69 70 71 72 73 74 70 71 72 71 - 72 72 73 74 0 75 76 77 78 79 - 80 85 76 77 78 77 78 79 80 81 - 82 83 85 86 87 78 79 80 85 79 - 80 81 82 83 84 85 86 87 88 97 - 80 81 82 83 85 86 87 81 82 83 - 84 85 86 87 82 83 84 85 83 84 - 85 84 85 0 86 87 88 89 90 91 - 94 97 98 99 87 88 97 88 89 90 - 91 92 93 94 95 96 97 98 99 100 - 101 89 90 91 92 93 94 95 96 97 - 98 99 90 91 92 93 94 97 91 92 - 93 94 97 92 93 94 95 96 97 98 - 99 93 94 95 96 97 94 95 96 97 - 95 96 97 98 99 100 101 96 97 98 - 99 97 98 99 98 99 100 101 102 103 - 99 100 101 100 101 102 103 104 105 106 - 101 102 103 102 103 104 105 106 107 108 - 103 104 105 106 104 105 106 107 108 109 - 110 105 106 107 108 106 107 108 107 108 - 109 110 111 112 128 108 109 110 109 110 - 111 112 113 114 115 128 129 130 110 111 - 112 128 111 112 113 114 115 116 117 118 - 128 129 130 131 132 112 113 114 115 128 - 129 130 113 114 115 116 117 118 119 120 - 121 128 129 130 114 115 116 117 118 128 - 115 116 117 118 128 116 117 118 119 120 - 121 122 123 124 128 117 118 119 120 121 - 118 119 120 121 119 120 121 122 123 124 - 125 126 127 120 121 122 123 124 121 122 - 123 124 122 123 124 125 126 127 123 124 - 125 126 127 124 125 126 127 125 126 127 - 126 127 127 0 129 130 131 132 133 134 - 142 130 131 132 131 132 133 134 135 136 - 140 142 143 144 132 133 134 142 133 134 - 135 136 137 138 139 140 141 142 143 144 - 145 146 134 135 136 140 142 143 144 135 - 136 137 138 139 140 141 142 143 144 136 - 137 138 139 140 141 142 137 138 139 140 - 141 142 138 139 140 139 140 140 141 142 - 0 143 144 145 146 147 148 163 144 145 - 146 145 146 147 148 149 150 151 163 164 - 165 146 147 148 163 147 148 149 150 151 - 152 161 163 164 165 166 167 148 149 150 - 151 163 164 165 149 150 151 152 153 154 - 159 161 162 163 164 165 150 151 152 161 - 163 151 152 161 163 152 153 154 155 156 - 159 160 161 162 163 153 154 155 156 157 - 159 161 162 154 155 156 161 155 156 157 - 158 159 160 161 156 157 159 157 158 159 - 160 161 162 158 159 160 161 159 160 161 - 162 161 162 162 0 164 165 166 167 168 - 169 177 165 166 167 166 167 168 169 170 - 171 175 177 178 179 167 168 169 177 168 - 169 170 171 172 173 174 175 176 177 178 - 179 180 181 169 170 171 175 177 178 179 - 170 171 172 173 174 175 176 177 178 179 - 171 172 173 174 175 176 177 172 173 174 - 175 176 177 173 174 175 174 175 175 176 - 177 0 178 179 180 181 182 183 192 179 - 180 181 180 181 182 183 184 185 186 192 - 193 194 181 182 183 192 182 183 184 185 - 186 187 188 189 192 193 194 195 196 183 - 184 185 186 192 193 194 184 185 186 187 - 188 189 190 191 192 193 194 185 186 187 - 188 189 192 186 187 188 189 192 187 188 - 189 190 191 192 188 189 190 191 189 190 - 191 190 191 191 0 193 194 195 196 197 - 198 208 194 195 196 195 196 197 198 199 - 200 204 208 209 210 196 197 198 208 197 - 198 199 200 201 202 203 204 205 206 207 - 208 209 210 211 220 198 199 200 204 208 - 209 210 199 200 201 202 203 204 205 206 - 207 208 209 210 200 201 202 203 204 205 - 206 207 208 201 202 203 204 205 206 207 - 208 202 203 204 203 204 204 205 206 207 - 208 206 207 207 0 209 210 211 212 213 - 214 217 220 221 222 210 211 220 211 212 - 213 214 215 216 217 218 219 220 221 222 - 223 224 212 213 214 215 216 217 218 219 - 220 221 222 213 214 215 216 217 220 214 - 215 216 217 220 215 216 217 218 219 220 - 221 222 216 217 218 219 220 217 218 219 - 220 218 219 220 221 222 223 224 219 220 - 221 222 220 221 222 221 222 223 224 225 - 226 222 223 224 223 224 225 226 227 228 - 229 224 225 226 225 226 227 228 229 230 - 231 226 227 228 229 227 228 229 230 231 - 232 233 228 229 230 231 229 230 231 230 - 231 232 233 234 235 251 231 232 233 232 - 233 234 235 236 237 238 251 252 253 233 - 234 235 251 234 235 236 237 238 239 240 - 241 251 252 253 254 255 235 236 237 238 - 251 252 253 236 237 238 239 240 241 242 - 243 244 251 252 253 237 238 239 240 241 - 251 238 239 240 241 251 239 240 241 242 - 243 244 245 246 247 251 240 241 242 243 - 244 241 242 243 244 242 243 244 245 246 - 247 248 249 250 243 244 245 246 247 244 - 245 246 247 245 246 247 248 249 250 246 - 247 248 249 250 247 248 249 250 248 249 - 250 249 250 250 0 252 253 254 255 256 - 257 273 253 254 255 254 255 256 257 258 - 259 260 273 274 275 255 256 257 273 256 - 257 258 259 260 261 262 263 273 274 275 - 276 277 257 258 259 260 273 274 275 258 - 259 260 261 262 263 264 265 266 273 274 - 275 259 260 261 262 263 273 260 261 262 - 263 273 261 262 263 264 265 266 267 268 - 269 273 262 263 264 265 266 263 264 265 - 266 264 265 266 267 268 269 270 271 272 - 265 266 267 268 269 266 267 268 269 267 - 268 269 270 271 272 268 269 270 271 272 - 269 270 271 272 270 271 272 271 272 272 - 0 274 275 276 277 278 279 292 275 276 - 277 276 277 278 279 280 281 285 292 293 - 294 277 278 279 292 278 279 280 281 282 - 283 284 285 286 287 288 292 293 294 295 - 296 279 280 281 285 292 293 294 280 281 - 282 283 284 285 286 287 288 289 290 291 - 292 293 294 281 282 283 284 285 286 287 - 288 292 282 283 284 285 286 287 288 292 - 283 284 285 284 285 285 286 287 288 289 - 290 291 292 287 288 289 290 291 288 289 - 290 291 289 290 291 290 291 291 0 293 - 294 295 296 297 298 311 294 295 296 295 - 296 297 298 299 300 301 311 312 313 296 - 297 298 311 297 298 299 300 301 302 303 - 307 311 312 313 314 315 298 299 300 301 - 311 312 313 299 300 301 302 303 304 305 - 306 307 308 309 310 311 312 313 300 301 - 302 303 307 311 301 302 303 307 311 302 - 303 304 305 306 307 308 309 310 311 303 - 304 305 306 307 308 309 310 304 305 306 - 307 308 309 310 305 306 307 306 307 307 - 308 309 310 309 310 310 0 312 313 314 - 315 316 317 328 313 314 315 314 315 316 - 317 318 319 320 328 329 330 315 316 317 - 328 316 317 318 319 320 321 322 323 328 - 329 330 331 332 317 318 319 320 328 329 - 330 318 319 320 321 322 323 324 325 328 - 329 330 319 320 321 322 323 328 320 321 - 322 323 328 321 322 323 324 325 326 327 - 328 322 323 324 325 323 324 325 324 325 - 326 327 325 326 327 326 327 327 0 329 - 330 331 332 330 331 332 331 332 332 0 -%FLAG HBOND_ACOEF -%FORMAT(5E16.8) - -%FLAG HBOND_BCOEF -%FORMAT(5E16.8) - -%FLAG HBCUT -%FORMAT(5E16.8) - -%FLAG AMBER_ATOM_TYPE -%FORMAT(20a4) -HC CT HC HC C O N H CT H1 CT HC CT HC HC HC CT HC HC HC -C O N H CT H1 CT HC HC CA CA HA CA HA CA HA CA HA CA HA -C O N H CT H1 CT HC CT HC HC HC CT HC HC CT HC HC HC C -O N H CT H1 CT H1 CT HC HC HC OH HO C O N H CT H1 CT -H1 H1 OH HO C O N CT H1 H1 CT HC HC CT HC HC CT H1 C O -N H CT H1 H1 C O N H CT H1 CT HC HC CT HC HC CT HC HC -CT HP HP N3 H H H C O N H CT H1 CT H1 CT HC HC HC OH -HO C O N H CT H1 CT HC HC CA CA HA CA HA C OH HO CA HA -CA HA C O N H CT H1 CT H1 CT HC HC HC OH HO C O N H -CT H1 CT HC HC CT HC HC C O2 O2 C O N H CT H1 CT HC CT -HC HC HC CT HC HC HC C O N CT H1 H1 CT HC HC CT HC HC CT -H1 C O N H CT H1 H1 C O N H CT H1 CT HC HC CT HC HC -CT HC HC CT HP HP N3 H H H C O N H CT H1 CT HC HC CT -HC HC CT HC HC CT HP HP N3 H H H C O N H CT H1 CT HC -CT HC HC HC CT HC HC CT HC HC HC C O N H CT H1 CT HC HC -CT HC CT HC HC HC CT HC HC HC C O N H CT H1 CT HC HC CT -HC HC C O N H H C O N H H -%FLAG TREE_CHAIN_CLASSIFICATION -%FORMAT(20a4) -M M E E M E M E M E 3 E 3 E E E 3 E E E -M E M E M E 3 E E B B E B E B E S E S E -M E M E M E 3 E 3 E E E 3 E E 3 E E E M -E M E M E 3 E 3 E E E S E M E M E M E 3 -E E S E M E M 3 E E 3 E E B E E M E M E -M E M E E M E M E M E 3 E E 3 E E 3 E E -3 E E 3 E E E M E M E M E 3 E 3 E E E S -E M E M E M E 3 E E B B E B E B S E S E -S E M E M E M E 3 E 3 E E E S E M E M E -M E 3 E E 3 E E B E E M E M E M E 3 E 3 -E E E 3 E E E M E M 3 E E 3 E E B E E M -E M E M E M E E M E M E M E 3 E E 3 E E -3 E E 3 E E 3 E E E M E M E M E 3 E E 3 -E E 3 E E 3 E E 3 E E E M E M E M E 3 E -3 E E E 3 E E 3 E E E M E M E M E 3 E E -3 E 3 E E E 3 E E E M E M E M E 3 E E 3 -E E B E B E E M E M E E -%FLAG JOIN_ARRAY -%FORMAT(10I8) - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 -%FLAG IROTAT -%FORMAT(10I8) - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 - 0 0 -%FLAG RADII -%FORMAT(5E16.8) - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.30000000E+00 1.50000000E+00 8.00000000E-01 1.70000000E+00 1.50000000E+00 - 1.55000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.50000000E+00 8.00000000E-01 1.70000000E+00 - 1.50000000E+00 1.55000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 - 1.55000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.55000000E+00 1.30000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 1.50000000E+00 - 8.00000000E-01 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.50000000E+00 8.00000000E-01 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 1.50000000E+00 - 8.00000000E-01 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 - 1.50000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 - 1.55000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.30000000E+00 1.55000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.55000000E+00 1.30000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.30000000E+00 - 1.70000000E+00 1.50000000E+00 1.55000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.70000000E+00 1.30000000E+00 1.30000000E+00 1.70000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 - 1.30000000E+00 1.30000000E+00 1.70000000E+00 1.50000000E+00 1.55000000E+00 - 1.30000000E+00 1.30000000E+00 -%FLAG SCREEN -%FORMAT(5E16.8) - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 8.50000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.90000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.90000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.90000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.90000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 8.50000000E-01 7.90000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 8.50000000E-01 - 7.20000000E-01 8.50000000E-01 7.90000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 7.20000000E-01 8.50000000E-01 8.50000000E-01 7.20000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 - 8.50000000E-01 8.50000000E-01 7.20000000E-01 8.50000000E-01 7.90000000E-01 - 8.50000000E-01 8.50000000E-01 diff --git a/data/DPDP.pdb b/data/DPDP.pdb deleted file mode 100755 index 9707757..0000000 --- a/data/DPDP.pdb +++ /dev/null @@ -1,334 +0,0 @@ -CRYST1 0.000 0.000 0.000 90.00 90.00 90.00 P 1 1 -ATOM 1 HH31 ACE X 1 6.816 3.776 -4.643 0.00 0.00 -ATOM 2 CH3 ACE X 1 6.508 2.749 -4.838 0.00 0.00 -ATOM 3 HH32 ACE X 1 6.938 2.528 -5.815 0.00 0.00 -ATOM 4 HH33 ACE X 1 5.423 2.647 -4.868 0.00 0.00 -ATOM 5 C ACE X 1 7.264 1.864 -3.867 0.00 0.00 -ATOM 6 O ACE X 1 8.306 1.300 -4.194 0.00 0.00 -ATOM 7 N VAL X 2 6.584 1.704 -2.737 0.00 0.00 -ATOM 8 H VAL X 2 5.820 2.364 -2.696 0.00 0.00 -ATOM 9 CA VAL X 2 6.730 0.659 -1.742 0.00 0.00 -ATOM 10 HA VAL X 2 7.501 -0.038 -2.071 0.00 0.00 -ATOM 11 CB VAL X 2 7.143 1.223 -0.295 0.00 0.00 -ATOM 12 HB VAL X 2 6.286 1.802 0.050 0.00 0.00 -ATOM 13 CG1 VAL X 2 7.225 0.096 0.696 0.00 0.00 -ATOM 14 HG11 VAL X 2 6.236 -0.332 0.859 0.00 0.00 -ATOM 15 HG12 VAL X 2 7.822 -0.738 0.329 0.00 0.00 -ATOM 16 HG13 VAL X 2 7.643 0.367 1.666 0.00 0.00 -ATOM 17 CG2 VAL X 2 8.311 2.121 -0.318 0.00 0.00 -ATOM 18 HG21 VAL X 2 9.189 1.608 -0.711 0.00 0.00 -ATOM 19 HG22 VAL X 2 8.058 2.946 -0.983 0.00 0.00 -ATOM 20 HG23 VAL X 2 8.534 2.535 0.666 0.00 0.00 -ATOM 21 C VAL X 2 5.419 -0.081 -1.638 0.00 0.00 -ATOM 22 O VAL X 2 4.429 0.463 -1.098 0.00 0.00 -ATOM 23 N PHE X 3 5.274 -1.307 -2.198 0.00 0.00 -ATOM 24 H PHE X 3 6.142 -1.770 -2.425 0.00 0.00 -ATOM 25 CA PHE X 3 3.986 -2.059 -2.108 0.00 0.00 -ATOM 26 HA PHE X 3 3.147 -1.365 -2.060 0.00 0.00 -ATOM 27 CB PHE X 3 3.818 -2.828 -3.490 0.00 0.00 -ATOM 28 HB2 PHE X 3 4.460 -3.709 -3.477 0.00 0.00 -ATOM 29 HB3 PHE X 3 2.892 -3.399 -3.421 0.00 0.00 -ATOM 30 CG PHE X 3 3.731 -2.099 -4.833 0.00 0.00 -ATOM 31 CD1 PHE X 3 4.853 -1.456 -5.378 0.00 0.00 -ATOM 32 HD1 PHE X 3 5.836 -1.477 -4.933 0.00 0.00 -ATOM 33 CE1 PHE X 3 4.747 -0.817 -6.664 0.00 0.00 -ATOM 34 HE1 PHE X 3 5.615 -0.346 -7.101 0.00 0.00 -ATOM 35 CZ PHE X 3 3.545 -0.847 -7.332 0.00 0.00 -ATOM 36 HZ PHE X 3 3.558 -0.349 -8.290 0.00 0.00 -ATOM 37 CE2 PHE X 3 2.433 -1.482 -6.822 0.00 0.00 -ATOM 38 HE2 PHE X 3 1.534 -1.414 -7.417 0.00 0.00 -ATOM 39 CD2 PHE X 3 2.512 -2.079 -5.538 0.00 0.00 -ATOM 40 HD2 PHE X 3 1.616 -2.542 -5.153 0.00 0.00 -ATOM 41 C PHE X 3 3.956 -3.118 -0.941 0.00 0.00 -ATOM 42 O PHE X 3 4.746 -4.022 -0.969 0.00 0.00 -ATOM 43 N ILE X 4 3.068 -2.983 0.078 0.00 0.00 -ATOM 44 H ILE X 4 2.429 -2.205 -0.001 0.00 0.00 -ATOM 45 CA ILE X 4 3.037 -3.920 1.241 0.00 0.00 -ATOM 46 HA ILE X 4 3.524 -4.853 0.960 0.00 0.00 -ATOM 47 CB ILE X 4 3.846 -3.398 2.439 0.00 0.00 -ATOM 48 HB ILE X 4 4.889 -3.376 2.122 0.00 0.00 -ATOM 49 CG2 ILE X 4 3.449 -2.041 3.011 0.00 0.00 -ATOM 50 HG21 ILE X 4 2.609 -2.228 3.680 0.00 0.00 -ATOM 51 HG22 ILE X 4 4.228 -1.476 3.521 0.00 0.00 -ATOM 52 HG23 ILE X 4 3.139 -1.339 2.236 0.00 0.00 -ATOM 53 CG1 ILE X 4 3.917 -4.398 3.644 0.00 0.00 -ATOM 54 HG12 ILE X 4 4.301 -3.753 4.434 0.00 0.00 -ATOM 55 HG13 ILE X 4 2.975 -4.812 4.003 0.00 0.00 -ATOM 56 CD1 ILE X 4 4.803 -5.597 3.360 0.00 0.00 -ATOM 57 HD11 ILE X 4 4.757 -6.219 4.254 0.00 0.00 -ATOM 58 HD12 ILE X 4 4.453 -6.068 2.441 0.00 0.00 -ATOM 59 HD13 ILE X 4 5.831 -5.235 3.332 0.00 0.00 -ATOM 60 C ILE X 4 1.728 -4.241 1.674 0.00 0.00 -ATOM 61 O ILE X 4 0.977 -3.426 2.212 0.00 0.00 -ATOM 62 N THR X 5 1.306 -5.405 1.312 0.00 0.00 -ATOM 63 H THR X 5 1.988 -6.120 1.102 0.00 0.00 -ATOM 64 CA THR X 5 -0.121 -5.802 1.573 0.00 0.00 -ATOM 65 HA THR X 5 -0.729 -4.932 1.323 0.00 0.00 -ATOM 66 CB THR X 5 -0.597 -7.024 0.732 0.00 0.00 -ATOM 67 HB THR X 5 -0.532 -6.634 -0.284 0.00 0.00 -ATOM 68 CG2 THR X 5 0.105 -8.365 0.933 0.00 0.00 -ATOM 69 HG21 THR X 5 1.187 -8.290 0.829 0.00 0.00 -ATOM 70 HG22 THR X 5 -0.118 -8.717 1.940 0.00 0.00 -ATOM 71 HG23 THR X 5 -0.295 -9.089 0.222 0.00 0.00 -ATOM 72 OG1 THR X 5 -1.932 -7.336 0.873 0.00 0.00 -ATOM 73 HG1 THR X 5 -2.064 -8.211 0.502 0.00 0.00 -ATOM 74 C THR X 5 -0.318 -6.113 3.046 0.00 0.00 -ATOM 75 O THR X 5 0.663 -6.412 3.759 0.00 0.00 -ATOM 76 N SER X 6 -1.549 -5.943 3.632 0.00 0.00 -ATOM 77 H SER X 6 -2.333 -5.624 3.082 0.00 0.00 -ATOM 78 CA SER X 6 -1.853 -6.097 5.065 0.00 0.00 -ATOM 79 HA SER X 6 -1.039 -6.650 5.533 0.00 0.00 -ATOM 80 CB SER X 6 -1.882 -4.738 5.784 0.00 0.00 -ATOM 81 HB2 SER X 6 -2.791 -4.242 5.445 0.00 0.00 -ATOM 82 HB3 SER X 6 -1.999 -4.998 6.836 0.00 0.00 -ATOM 83 OG SER X 6 -0.706 -3.914 5.674 0.00 0.00 -ATOM 84 HG SER X 6 -0.406 -3.939 4.762 0.00 0.00 -ATOM 85 C SER X 6 -3.158 -6.915 5.269 0.00 0.00 -ATOM 86 O SER X 6 -4.026 -6.430 5.907 0.00 0.00 -ATOM 87 N PRO X 7 -3.221 -8.248 4.860 0.00 0.00 -ATOM 88 CD PRO X 7 -2.026 -8.975 4.392 0.00 0.00 -ATOM 89 HD2 PRO X 7 -1.286 -9.134 5.177 0.00 0.00 -ATOM 90 HD3 PRO X 7 -1.578 -8.448 3.550 0.00 0.00 -ATOM 91 CG PRO X 7 -2.501 -10.375 3.963 0.00 0.00 -ATOM 92 HG2 PRO X 7 -1.868 -11.170 4.356 0.00 0.00 -ATOM 93 HG3 PRO X 7 -2.468 -10.527 2.884 0.00 0.00 -ATOM 94 CB PRO X 7 -3.844 -10.558 4.572 0.00 0.00 -ATOM 95 HB2 PRO X 7 -3.691 -11.052 5.532 0.00 0.00 -ATOM 96 HB3 PRO X 7 -4.473 -11.159 3.916 0.00 0.00 -ATOM 97 CA PRO X 7 -4.392 -9.117 4.833 0.00 0.00 -ATOM 98 HA PRO X 7 -4.780 -9.156 5.852 0.00 0.00 -ATOM 99 C PRO X 7 -5.491 -8.770 3.841 0.00 0.00 -ATOM 100 O PRO X 7 -6.589 -8.382 4.232 0.00 0.00 -ATOM 101 N GLY X 8 -5.193 -8.968 2.565 0.00 0.00 -ATOM 102 H GLY X 8 -4.257 -9.323 2.433 0.00 0.00 -ATOM 103 CA GLY X 8 -5.921 -8.694 1.327 0.00 0.00 -ATOM 104 HA2 GLY X 8 -5.349 -9.093 0.489 0.00 0.00 -ATOM 105 HA3 GLY X 8 -6.846 -9.255 1.462 0.00 0.00 -ATOM 106 C GLY X 8 -6.230 -7.222 0.977 0.00 0.00 -ATOM 107 O GLY X 8 -7.333 -6.869 0.609 0.00 0.00 -ATOM 108 N LYS X 9 -5.287 -6.327 1.188 0.00 0.00 -ATOM 109 H LYS X 9 -4.350 -6.632 1.409 0.00 0.00 -ATOM 110 CA LYS X 9 -5.378 -4.854 1.094 0.00 0.00 -ATOM 111 HA LYS X 9 -6.104 -4.608 0.319 0.00 0.00 -ATOM 112 CB LYS X 9 -5.825 -4.241 2.493 0.00 0.00 -ATOM 113 HB2 LYS X 9 -5.131 -4.662 3.220 0.00 0.00 -ATOM 114 HB3 LYS X 9 -5.613 -3.174 2.441 0.00 0.00 -ATOM 115 CG LYS X 9 -7.281 -4.451 2.873 0.00 0.00 -ATOM 116 HG2 LYS X 9 -7.857 -3.983 2.075 0.00 0.00 -ATOM 117 HG3 LYS X 9 -7.554 -5.502 2.786 0.00 0.00 -ATOM 118 CD LYS X 9 -7.772 -3.842 4.143 0.00 0.00 -ATOM 119 HD2 LYS X 9 -7.502 -2.789 4.071 0.00 0.00 -ATOM 120 HD3 LYS X 9 -8.862 -3.840 4.132 0.00 0.00 -ATOM 121 CE LYS X 9 -7.134 -4.358 5.495 0.00 0.00 -ATOM 122 HE2 LYS X 9 -6.076 -4.102 5.448 0.00 0.00 -ATOM 123 HE3 LYS X 9 -7.629 -3.804 6.292 0.00 0.00 -ATOM 124 NZ LYS X 9 -7.447 -5.805 5.705 0.00 0.00 -ATOM 125 HZ1 LYS X 9 -7.222 -6.143 6.630 0.00 0.00 -ATOM 126 HZ2 LYS X 9 -8.406 -6.077 5.542 0.00 0.00 -ATOM 127 HZ3 LYS X 9 -6.780 -6.276 5.111 0.00 0.00 -ATOM 128 C LYS X 9 -4.029 -4.293 0.536 0.00 0.00 -ATOM 129 O LYS X 9 -3.211 -3.951 1.310 0.00 0.00 -ATOM 130 N THR X 10 -3.894 -4.258 -0.789 0.00 0.00 -ATOM 131 H THR X 10 -4.588 -4.785 -1.299 0.00 0.00 -ATOM 132 CA THR X 10 -2.669 -3.837 -1.518 0.00 0.00 -ATOM 133 HA THR X 10 -1.802 -4.422 -1.210 0.00 0.00 -ATOM 134 CB THR X 10 -2.862 -4.209 -3.000 0.00 0.00 -ATOM 135 HB THR X 10 -3.822 -3.767 -3.267 0.00 0.00 -ATOM 136 CG2 THR X 10 -1.741 -3.739 -3.897 0.00 0.00 -ATOM 137 HG21 THR X 10 -0.773 -4.028 -3.490 0.00 0.00 -ATOM 138 HG22 THR X 10 -1.930 -4.233 -4.850 0.00 0.00 -ATOM 139 HG23 THR X 10 -1.717 -2.663 -4.074 0.00 0.00 -ATOM 140 OG1 THR X 10 -2.889 -5.632 -3.011 0.00 0.00 -ATOM 141 HG1 THR X 10 -3.611 -5.932 -3.568 0.00 0.00 -ATOM 142 C THR X 10 -2.449 -2.360 -1.212 0.00 0.00 -ATOM 143 O THR X 10 -2.902 -1.493 -1.998 0.00 0.00 -ATOM 144 N TYR X 11 -1.657 -2.080 -0.204 0.00 0.00 -ATOM 145 H TYR X 11 -1.511 -2.797 0.493 0.00 0.00 -ATOM 146 CA TYR X 11 -1.169 -0.739 0.101 0.00 0.00 -ATOM 147 HA TYR X 11 -1.922 -0.021 -0.226 0.00 0.00 -ATOM 148 CB TYR X 11 -0.921 -0.510 1.580 0.00 0.00 -ATOM 149 HB2 TYR X 11 -0.406 -1.413 1.905 0.00 0.00 -ATOM 150 HB3 TYR X 11 -0.262 0.346 1.727 0.00 0.00 -ATOM 151 CG TYR X 11 -2.259 -0.448 2.390 0.00 0.00 -ATOM 152 CD1 TYR X 11 -3.001 0.733 2.355 0.00 0.00 -ATOM 153 HD1 TYR X 11 -2.692 1.529 1.694 0.00 0.00 -ATOM 154 CE1 TYR X 11 -4.162 0.844 3.138 0.00 0.00 -ATOM 155 HE1 TYR X 11 -4.781 1.724 3.228 0.00 0.00 -ATOM 156 CZ TYR X 11 -4.512 -0.173 4.009 0.00 0.00 -ATOM 157 OH TYR X 11 -5.528 0.067 4.842 0.00 0.00 -ATOM 158 HH TYR X 11 -5.637 -0.565 5.556 0.00 0.00 -ATOM 159 CE2 TYR X 11 -3.768 -1.384 4.101 0.00 0.00 -ATOM 160 HE2 TYR X 11 -3.972 -2.065 4.913 0.00 0.00 -ATOM 161 CD2 TYR X 11 -2.649 -1.541 3.217 0.00 0.00 -ATOM 162 HD2 TYR X 11 -1.986 -2.389 3.310 0.00 0.00 -ATOM 163 C TYR X 11 0.029 -0.413 -0.704 0.00 0.00 -ATOM 164 O TYR X 11 1.077 -1.060 -0.667 0.00 0.00 -ATOM 165 N THR X 12 -0.057 0.614 -1.570 0.00 0.00 -ATOM 166 H THR X 12 -0.935 1.113 -1.569 0.00 0.00 -ATOM 167 CA THR X 12 1.216 1.215 -2.122 0.00 0.00 -ATOM 168 HA THR X 12 2.016 0.503 -1.919 0.00 0.00 -ATOM 169 CB THR X 12 1.179 1.553 -3.667 0.00 0.00 -ATOM 170 HB THR X 12 0.753 2.539 -3.852 0.00 0.00 -ATOM 171 CG2 THR X 12 2.531 1.490 -4.379 0.00 0.00 -ATOM 172 HG21 THR X 12 3.029 0.548 -4.153 0.00 0.00 -ATOM 173 HG22 THR X 12 2.431 1.501 -5.465 0.00 0.00 -ATOM 174 HG23 THR X 12 3.132 2.336 -4.044 0.00 0.00 -ATOM 175 OG1 THR X 12 0.507 0.523 -4.322 0.00 0.00 -ATOM 176 HG1 THR X 12 0.957 -0.279 -4.046 0.00 0.00 -ATOM 177 C THR X 12 1.441 2.498 -1.316 0.00 0.00 -ATOM 178 O THR X 12 0.821 3.550 -1.558 0.00 0.00 -ATOM 179 N GLU X 13 2.460 2.473 -0.503 0.00 0.00 -ATOM 180 H GLU X 13 3.025 1.636 -0.487 0.00 0.00 -ATOM 181 CA GLU X 13 3.073 3.672 0.091 0.00 0.00 -ATOM 182 HA GLU X 13 2.229 4.323 0.317 0.00 0.00 -ATOM 183 CB GLU X 13 3.781 3.217 1.417 0.00 0.00 -ATOM 184 HB2 GLU X 13 3.191 2.473 1.951 0.00 0.00 -ATOM 185 HB3 GLU X 13 4.757 2.800 1.168 0.00 0.00 -ATOM 186 CG GLU X 13 4.126 4.422 2.277 0.00 0.00 -ATOM 187 HG2 GLU X 13 4.886 5.020 1.773 0.00 0.00 -ATOM 188 HG3 GLU X 13 3.315 5.134 2.436 0.00 0.00 -ATOM 189 CD GLU X 13 4.598 3.956 3.632 0.00 0.00 -ATOM 190 OE1 GLU X 13 5.727 4.243 4.003 0.00 0.00 -ATOM 191 OE2 GLU X 13 3.800 3.306 4.429 0.00 0.00 -ATOM 192 C GLU X 13 4.005 4.394 -0.864 0.00 0.00 -ATOM 193 O GLU X 13 4.794 3.768 -1.569 0.00 0.00 -ATOM 194 N VAL X 14 3.722 5.665 -1.092 0.00 0.00 -ATOM 195 H VAL X 14 2.936 6.107 -0.636 0.00 0.00 -ATOM 196 CA VAL X 14 4.579 6.628 -1.858 0.00 0.00 -ATOM 197 HA VAL X 14 5.504 6.093 -2.072 0.00 0.00 -ATOM 198 CB VAL X 14 3.935 7.083 -3.182 0.00 0.00 -ATOM 199 HB VAL X 14 4.636 7.770 -3.655 0.00 0.00 -ATOM 200 CG1 VAL X 14 3.742 5.882 -4.003 0.00 0.00 -ATOM 201 HG11 VAL X 14 3.400 6.250 -4.971 0.00 0.00 -ATOM 202 HG12 VAL X 14 4.621 5.257 -4.160 0.00 0.00 -ATOM 203 HG13 VAL X 14 2.992 5.271 -3.501 0.00 0.00 -ATOM 204 CG2 VAL X 14 2.630 7.847 -3.096 0.00 0.00 -ATOM 205 HG21 VAL X 14 2.243 7.966 -4.108 0.00 0.00 -ATOM 206 HG22 VAL X 14 1.914 7.359 -2.435 0.00 0.00 -ATOM 207 HG23 VAL X 14 2.846 8.830 -2.678 0.00 0.00 -ATOM 208 C VAL X 14 4.990 7.759 -0.968 0.00 0.00 -ATOM 209 O VAL X 14 4.096 8.433 -0.478 0.00 0.00 -ATOM 210 N PRO X 15 6.235 8.007 -0.525 0.00 0.00 -ATOM 211 CD PRO X 15 7.463 7.305 -1.010 0.00 0.00 -ATOM 212 HD2 PRO X 15 7.360 7.202 -2.090 0.00 0.00 -ATOM 213 HD3 PRO X 15 7.582 6.299 -0.606 0.00 0.00 -ATOM 214 CG PRO X 15 8.705 8.121 -0.694 0.00 0.00 -ATOM 215 HG2 PRO X 15 9.063 8.740 -1.517 0.00 0.00 -ATOM 216 HG3 PRO X 15 9.548 7.548 -0.309 0.00 0.00 -ATOM 217 CB PRO X 15 8.178 9.074 0.432 0.00 0.00 -ATOM 218 HB2 PRO X 15 8.449 8.679 1.410 0.00 0.00 -ATOM 219 HB3 PRO X 15 8.535 10.094 0.290 0.00 0.00 -ATOM 220 CA PRO X 15 6.666 9.167 0.189 0.00 0.00 -ATOM 221 HA PRO X 15 6.533 10.082 -0.389 0.00 0.00 -ATOM 222 C PRO X 15 5.878 9.348 1.566 0.00 0.00 -ATOM 223 O PRO X 15 5.487 10.469 1.872 0.00 0.00 -ATOM 224 N GLY X 16 5.528 8.302 2.331 0.00 0.00 -ATOM 225 H GLY X 16 5.767 7.373 2.016 0.00 0.00 -ATOM 226 CA GLY X 16 4.842 8.478 3.648 0.00 0.00 -ATOM 227 HA2 GLY X 16 5.381 7.968 4.446 0.00 0.00 -ATOM 228 HA3 GLY X 16 4.875 9.542 3.881 0.00 0.00 -ATOM 229 C GLY X 16 3.378 8.010 3.576 0.00 0.00 -ATOM 230 O GLY X 16 2.863 7.420 4.570 0.00 0.00 -ATOM 231 N LYS X 17 2.632 8.369 2.578 0.00 0.00 -ATOM 232 H LYS X 17 3.141 8.789 1.814 0.00 0.00 -ATOM 233 CA LYS X 17 1.197 8.162 2.415 0.00 0.00 -ATOM 234 HA LYS X 17 0.787 8.244 3.422 0.00 0.00 -ATOM 235 CB LYS X 17 0.502 9.290 1.612 0.00 0.00 -ATOM 236 HB2 LYS X 17 0.653 10.239 2.127 0.00 0.00 -ATOM 237 HB3 LYS X 17 0.997 9.336 0.641 0.00 0.00 -ATOM 238 CG LYS X 17 -1.057 9.106 1.429 0.00 0.00 -ATOM 239 HG2 LYS X 17 -1.250 8.225 0.816 0.00 0.00 -ATOM 240 HG3 LYS X 17 -1.528 8.961 2.401 0.00 0.00 -ATOM 241 CD LYS X 17 -1.751 10.346 0.777 0.00 0.00 -ATOM 242 HD2 LYS X 17 -1.660 11.209 1.436 0.00 0.00 -ATOM 243 HD3 LYS X 17 -1.369 10.500 -0.232 0.00 0.00 -ATOM 244 CE LYS X 17 -3.180 10.001 0.599 0.00 0.00 -ATOM 245 HE2 LYS X 17 -3.313 9.112 -0.017 0.00 0.00 -ATOM 246 HE3 LYS X 17 -3.673 9.750 1.538 0.00 0.00 -ATOM 247 NZ LYS X 17 -4.054 11.040 -0.023 0.00 0.00 -ATOM 248 HZ1 LYS X 17 -5.024 10.820 0.153 0.00 0.00 -ATOM 249 HZ2 LYS X 17 -3.881 11.957 0.362 0.00 0.00 -ATOM 250 HZ3 LYS X 17 -3.847 10.963 -1.009 0.00 0.00 -ATOM 251 C LYS X 17 0.964 6.760 1.742 0.00 0.00 -ATOM 252 O LYS X 17 1.467 6.474 0.658 0.00 0.00 -ATOM 253 N LYS X 18 0.074 5.907 2.358 0.00 0.00 -ATOM 254 H LYS X 18 -0.243 6.223 3.263 0.00 0.00 -ATOM 255 CA LYS X 18 -0.444 4.657 1.824 0.00 0.00 -ATOM 256 HA LYS X 18 0.369 4.110 1.346 0.00 0.00 -ATOM 257 CB LYS X 18 -0.859 3.801 3.031 0.00 0.00 -ATOM 258 HB2 LYS X 18 -1.489 4.452 3.636 0.00 0.00 -ATOM 259 HB3 LYS X 18 -1.539 3.090 2.560 0.00 0.00 -ATOM 260 CG LYS X 18 0.196 3.135 3.843 0.00 0.00 -ATOM 261 HG2 LYS X 18 0.552 2.317 3.217 0.00 0.00 -ATOM 262 HG3 LYS X 18 1.006 3.847 3.999 0.00 0.00 -ATOM 263 CD LYS X 18 -0.315 2.594 5.238 0.00 0.00 -ATOM 264 HD2 LYS X 18 -0.743 3.429 5.793 0.00 0.00 -ATOM 265 HD3 LYS X 18 -1.079 1.835 5.070 0.00 0.00 -ATOM 266 CE LYS X 18 0.883 1.932 5.875 0.00 0.00 -ATOM 267 HE2 LYS X 18 0.537 1.278 6.676 0.00 0.00 -ATOM 268 HE3 LYS X 18 1.343 1.283 5.129 0.00 0.00 -ATOM 269 NZ LYS X 18 1.851 2.895 6.373 0.00 0.00 -ATOM 270 HZ1 LYS X 18 2.398 3.328 5.643 0.00 0.00 -ATOM 271 HZ2 LYS X 18 1.427 3.559 7.005 0.00 0.00 -ATOM 272 HZ3 LYS X 18 2.536 2.330 6.853 0.00 0.00 -ATOM 273 C LYS X 18 -1.663 4.844 0.937 0.00 0.00 -ATOM 274 O LYS X 18 -2.672 5.424 1.353 0.00 0.00 -ATOM 275 N ILE X 19 -1.537 4.360 -0.271 0.00 0.00 -ATOM 276 H ILE X 19 -0.641 4.049 -0.621 0.00 0.00 -ATOM 277 CA ILE X 19 -2.637 4.254 -1.208 0.00 0.00 -ATOM 278 HA ILE X 19 -3.440 4.893 -0.841 0.00 0.00 -ATOM 279 CB ILE X 19 -2.309 4.845 -2.682 0.00 0.00 -ATOM 280 HB ILE X 19 -1.989 3.995 -3.285 0.00 0.00 -ATOM 281 CG2 ILE X 19 -3.524 5.323 -3.409 0.00 0.00 -ATOM 282 HG21 ILE X 19 -3.327 5.440 -4.475 0.00 0.00 -ATOM 283 HG22 ILE X 19 -4.309 4.567 -3.417 0.00 0.00 -ATOM 284 HG23 ILE X 19 -3.975 6.229 -3.003 0.00 0.00 -ATOM 285 CG1 ILE X 19 -1.193 5.965 -2.822 0.00 0.00 -ATOM 286 HG12 ILE X 19 -0.213 5.639 -2.475 0.00 0.00 -ATOM 287 HG13 ILE X 19 -1.121 6.398 -3.820 0.00 0.00 -ATOM 288 CD1 ILE X 19 -1.534 7.235 -2.004 0.00 0.00 -ATOM 289 HD11 ILE X 19 -0.751 7.975 -2.169 0.00 0.00 -ATOM 290 HD12 ILE X 19 -2.494 7.629 -2.338 0.00 0.00 -ATOM 291 HD13 ILE X 19 -1.648 7.002 -0.945 0.00 0.00 -ATOM 292 C ILE X 19 -3.181 2.829 -1.181 0.00 0.00 -ATOM 293 O ILE X 19 -2.497 1.881 -1.632 0.00 0.00 -ATOM 294 N LEU X 20 -4.413 2.669 -0.703 0.00 0.00 -ATOM 295 H LEU X 20 -4.925 3.442 -0.302 0.00 0.00 -ATOM 296 CA LEU X 20 -5.124 1.432 -0.763 0.00 0.00 -ATOM 297 HA LEU X 20 -4.405 0.633 -0.584 0.00 0.00 -ATOM 298 CB LEU X 20 -6.274 1.409 0.228 0.00 0.00 -ATOM 299 HB2 LEU X 20 -5.888 1.666 1.215 0.00 0.00 -ATOM 300 HB3 LEU X 20 -7.058 2.134 0.012 0.00 0.00 -ATOM 301 CG LEU X 20 -6.861 0.000 0.207 0.00 0.00 -ATOM 302 HG LEU X 20 -7.561 -0.093 -0.623 0.00 0.00 -ATOM 303 CD1 LEU X 20 -5.897 -1.204 0.260 0.00 0.00 -ATOM 304 HD11 LEU X 20 -5.127 -1.124 1.026 0.00 0.00 -ATOM 305 HD12 LEU X 20 -6.520 -2.087 0.400 0.00 0.00 -ATOM 306 HD13 LEU X 20 -5.357 -1.329 -0.679 0.00 0.00 -ATOM 307 CD2 LEU X 20 -7.792 -0.272 1.471 0.00 0.00 -ATOM 308 HD21 LEU X 20 -7.140 -0.428 2.331 0.00 0.00 -ATOM 309 HD22 LEU X 20 -8.390 0.631 1.594 0.00 0.00 -ATOM 310 HD23 LEU X 20 -8.484 -1.112 1.412 0.00 0.00 -ATOM 311 C LEU X 20 -5.715 1.227 -2.179 0.00 0.00 -ATOM 312 O LEU X 20 -6.740 1.782 -2.512 0.00 0.00 -ATOM 313 N GLN X 21 -5.170 0.436 -3.115 0.00 0.00 -ATOM 314 H GLN X 21 -4.300 -0.034 -2.912 0.00 0.00 -ATOM 315 CA GLN X 21 -5.707 0.105 -4.407 0.00 0.00 -ATOM 316 HA GLN X 21 -5.807 0.998 -5.025 0.00 0.00 -ATOM 317 CB GLN X 21 -4.775 -0.881 -5.182 0.00 0.00 -ATOM 318 HB2 GLN X 21 -4.502 -1.706 -4.525 0.00 0.00 -ATOM 319 HB3 GLN X 21 -5.336 -1.194 -6.062 0.00 0.00 -ATOM 320 CG GLN X 21 -3.479 -0.270 -5.727 0.00 0.00 -ATOM 321 HG2 GLN X 21 -3.705 0.459 -6.505 0.00 0.00 -ATOM 322 HG3 GLN X 21 -3.004 0.162 -4.846 0.00 0.00 -ATOM 323 CD GLN X 21 -2.484 -1.272 -6.416 0.00 0.00 -ATOM 324 OE1 GLN X 21 -2.896 -2.109 -7.221 0.00 0.00 -ATOM 325 NE2 GLN X 21 -1.185 -1.228 -6.135 0.00 0.00 -ATOM 326 HE21 GLN X 21 -0.604 -1.764 -6.765 0.00 0.00 -ATOM 327 HE22 GLN X 21 -0.806 -0.492 -5.556 0.00 0.00 -ATOM 328 C GLN X 21 -7.098 -0.701 -4.167 0.00 0.00 -ATOM 329 O GLN X 21 -7.075 -1.763 -3.485 0.00 0.00 -ATOM 330 N NHE X 22 -8.303 -0.239 -4.558 0.00 0.00 -ATOM 331 HN1 NHE X 22 -8.346 0.400 -5.339 0.00 0.00 -ATOM 332 HN2 NHE X 22 -9.128 -0.766 -4.311 0.00 0.00 -END diff --git a/data/ala3.psf b/data/ala3.psf deleted file mode 100755 index b1e3ae8..0000000 --- a/data/ala3.psf +++ /dev/null @@ -1,179 +0,0 @@ -PSF CMAP CHEQ - - 2 !NTITLE -* BETA HARPIN IN IMPLICIT SOLVENT -* DATE: 11/22/10 16:54: 9 CREATED BY USER: aokur - - 42 !NATOM - 1 ALA3 1 ALA CAY 24 -0.270000 12.0110 0 0.00000 -0.301140E-02 - 2 ALA3 1 ALA HY1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 3 ALA3 1 ALA HY2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 4 ALA3 1 ALA HY3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 5 ALA3 1 ALA CY 20 0.510000 12.0110 0 0.00000 -0.301140E-02 - 6 ALA3 1 ALA OY 70 -0.510000 15.9990 0 0.00000 -0.301140E-02 - 7 ALA3 1 ALA N 54 -0.470000 14.0070 0 0.00000 -0.301140E-02 - 8 ALA3 1 ALA HN 1 0.310000 1.00800 0 0.00000 -0.301140E-02 - 9 ALA3 1 ALA CA 22 0.700000E-01 12.0110 0 0.00000 -0.301140E-02 - 10 ALA3 1 ALA HA 6 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 11 ALA3 1 ALA CB 24 -0.270000 12.0110 0 0.00000 -0.301140E-02 - 12 ALA3 1 ALA HB1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 13 ALA3 1 ALA HB2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 14 ALA3 1 ALA HB3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 15 ALA3 1 ALA C 20 0.510000 12.0110 0 0.00000 -0.301140E-02 - 16 ALA3 1 ALA O 70 -0.510000 15.9990 0 0.00000 -0.301140E-02 - 17 ALA3 2 ALA N 54 -0.470000 14.0070 0 0.00000 -0.301140E-02 - 18 ALA3 2 ALA HN 1 0.310000 1.00800 0 0.00000 -0.301140E-02 - 19 ALA3 2 ALA CA 22 0.700000E-01 12.0110 0 0.00000 -0.301140E-02 - 20 ALA3 2 ALA HA 6 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 21 ALA3 2 ALA CB 24 -0.270000 12.0110 0 0.00000 -0.301140E-02 - 22 ALA3 2 ALA HB1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 23 ALA3 2 ALA HB2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 24 ALA3 2 ALA HB3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 25 ALA3 2 ALA C 20 0.510000 12.0110 0 0.00000 -0.301140E-02 - 26 ALA3 2 ALA O 70 -0.510000 15.9990 0 0.00000 -0.301140E-02 - 27 ALA3 3 ALA N 54 -0.470000 14.0070 0 0.00000 -0.301140E-02 - 28 ALA3 3 ALA HN 1 0.310000 1.00800 0 0.00000 -0.301140E-02 - 29 ALA3 3 ALA CA 22 0.700000E-01 12.0110 0 0.00000 -0.301140E-02 - 30 ALA3 3 ALA HA 6 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 31 ALA3 3 ALA CB 24 -0.270000 12.0110 0 0.00000 -0.301140E-02 - 32 ALA3 3 ALA HB1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 33 ALA3 3 ALA HB2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 34 ALA3 3 ALA HB3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 35 ALA3 3 ALA C 20 0.510000 12.0110 0 0.00000 -0.301140E-02 - 36 ALA3 3 ALA O 70 -0.510000 15.9990 0 0.00000 -0.301140E-02 - 37 ALA3 3 ALA NT 54 -0.470000 14.0070 0 0.00000 -0.301140E-02 - 38 ALA3 3 ALA HNT 1 0.310000 1.00800 0 0.00000 -0.301140E-02 - 39 ALA3 3 ALA CAT 24 -0.110000 12.0110 0 0.00000 -0.301140E-02 - 40 ALA3 3 ALA HT1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 41 ALA3 3 ALA HT2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - 42 ALA3 3 ALA HT3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02 - - 41 !NBOND: bonds - 5 1 5 7 1 2 1 3 - 1 4 6 5 11 9 7 8 - 7 9 15 9 15 17 9 10 - 11 12 11 13 11 14 16 15 - 21 19 17 18 17 19 25 19 - 25 27 19 20 21 22 21 23 - 21 24 26 25 31 29 27 28 - 27 29 35 29 29 30 31 32 - 31 33 31 34 36 35 35 37 - 37 38 37 39 39 40 39 41 - 39 42 - - 72 !NTHETA: angles - 2 1 3 2 1 4 2 1 5 - 3 1 4 3 1 5 4 1 5 - 1 5 6 1 5 7 6 5 7 - 5 7 8 5 7 9 8 7 9 - 7 9 10 7 9 11 7 9 15 - 10 9 11 10 9 15 11 9 15 - 9 11 12 9 11 13 9 11 14 - 12 11 13 12 11 14 13 11 14 - 9 15 16 9 15 17 16 15 17 - 15 17 18 15 17 19 18 17 19 - 17 19 20 17 19 21 17 19 25 - 20 19 21 20 19 25 21 19 25 - 19 21 22 19 21 23 19 21 24 - 22 21 23 22 21 24 23 21 24 - 19 25 26 19 25 27 26 25 27 - 25 27 28 25 27 29 28 27 29 - 27 29 30 27 29 31 27 29 35 - 30 29 31 30 29 35 31 29 35 - 29 31 32 29 31 33 29 31 34 - 32 31 33 32 31 34 33 31 34 - 29 35 36 29 35 37 36 35 37 - 35 37 38 35 37 39 38 37 39 - 37 39 40 37 39 41 37 39 42 - 40 39 41 40 39 42 41 39 42 - - 91 !NPHI: dihedrals - 1 5 7 8 1 5 7 9 - 2 1 5 6 2 1 5 7 - 3 1 5 6 3 1 5 7 - 4 1 5 6 4 1 5 7 - 5 7 9 10 5 7 9 11 - 5 7 9 15 6 5 7 8 - 6 5 7 9 7 9 11 12 - 7 9 11 13 7 9 11 14 - 7 9 15 16 7 9 15 17 - 8 7 9 10 8 7 9 11 - 8 7 9 15 9 15 17 18 - 9 15 17 19 10 9 11 12 - 10 9 11 13 10 9 11 14 - 10 9 15 16 10 9 15 17 - 11 9 15 16 11 9 15 17 - 12 11 9 15 13 11 9 15 - 14 11 9 15 15 17 19 20 - 15 17 19 21 15 17 19 25 - 16 15 17 18 16 15 17 19 - 17 19 21 22 17 19 21 23 - 17 19 21 24 17 19 25 26 - 17 19 25 27 18 17 19 20 - 18 17 19 21 18 17 19 25 - 19 25 27 28 19 25 27 29 - 20 19 21 22 20 19 21 23 - 20 19 21 24 20 19 25 26 - 20 19 25 27 21 19 25 26 - 21 19 25 27 22 21 19 25 - 23 21 19 25 24 21 19 25 - 25 27 29 30 25 27 29 31 - 25 27 29 35 26 25 27 28 - 26 25 27 29 27 29 31 32 - 27 29 31 33 27 29 31 34 - 27 29 35 36 27 29 35 37 - 28 27 29 30 28 27 29 31 - 28 27 29 35 29 35 37 38 - 29 35 37 39 30 29 31 32 - 30 29 31 33 30 29 31 34 - 30 29 35 36 30 29 35 37 - 31 29 35 36 31 29 35 37 - 32 31 29 35 33 31 29 35 - 34 31 29 35 35 37 39 40 - 35 37 39 41 35 37 39 42 - 36 35 37 38 36 35 37 39 - 38 37 39 40 38 37 39 41 - 38 37 39 42 - - 11 !NIMPHI: impropers - 5 1 7 6 7 5 9 8 - 15 9 17 16 9 7 15 11 - 17 15 19 18 25 19 27 26 - 19 17 25 21 27 25 29 28 - 29 27 35 31 37 35 39 38 - 35 29 37 36 - - 4 !NDON: donors - 7 8 17 18 27 28 37 38 - - 4 !NACC: acceptors - 6 5 16 15 26 25 36 35 - - 0 !NNB - - 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 - 0 0 - - 12 0 !NGRP NST2 - 0 1 0 4 1 0 6 1 0 - 10 1 0 14 1 0 16 1 0 - 20 1 0 24 1 0 26 1 0 - 30 1 0 34 1 0 36 1 0 - - 1 !MOLNT - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 - - 0 0 !NUMLP NUMLPH - - 2 !NCRTERM: cross-terms - 15 17 19 25 17 19 25 27 - 25 27 29 35 27 29 35 37 diff --git a/data/md.trr b/data/md.trr deleted file mode 100755 index 937523a..0000000 Binary files a/data/md.trr and /dev/null differ diff --git a/data/md_1u19.part0003.xtc b/data/md_1u19.part0003.xtc deleted file mode 100755 index 01f1265..0000000 Binary files a/data/md_1u19.part0003.xtc and /dev/null differ diff --git a/data/script.ngl b/data/script.ngl new file mode 100644 index 0000000..bc7cfc2 --- /dev/null +++ b/data/script.ngl @@ -0,0 +1,96 @@ +panel.setName( "Controls" ); +stage.setParameters( { theme: "light" } ); + +var h = scriptHelperFunctions(stage, panel) + +h.uiButton( + "show/hide all", + function(){ + var hidden; + var compX = h.components("md_1u19").list[0]; + if (compX.visible === false){ + hidden = true + }else{ + hidden = false + } + stage.eachComponent( function( comp ){ + if (hidden === true){ + h.visible(true, comp); + }else{ + h.visible(false, comp); + } + } ); + } +); + +h.uiButton( + "reverse view", + function(){ + stage.eachComponent( function( comp ){ + if (comp.visible === true){ + h.visible( false, comp ); + }else{ + h.visible( true, comp ); + } + } ); + } +); + +h.uiButton( + "sidechains on/off", + function(){ + h.representations( "licorice" ).list.forEach( function( repre ){ + h.visible(!repre.visible, repre); + } ); + } +); + +var files = [ "md" ]; +var promiseList = []; + + +files.forEach( function( name ){ + promiseList.push( stage.loadFile( "file://cwd/data/" + name + ".gro", {name: name} ) ); +} ); + +Promise.all( promiseList ).then( function( objectList ){ + + var compX; + + objectList.forEach( function( comp, i ){ + + if( i === 0 ){ + compX = comp; + }else{ + comp.superpose( compX, true ); + + }; + + comp.addRepresentation( "cartoon" ); + comp.addRepresentation( "licorice", { visible: false } ); + comp.centerView(); + comp.addTrajectory( "cwd/data/" + comp.name + ".xtc" ); + + } ); + +} ); + + + +var trajSele = "backbone and not #h"; + +var basePath = "cwd/data/"; +var name = "md_1u19"; +var sysPath = "file://" + basePath + name + ".gro"; +stage.loadFile( sysPath ).then( function( comp ){ + + comp.setName( name ); + comp.setSelection( "protein and not #h" ); + + comp.addRepresentation( "cartoon", { color: "#55eb86", sele: "*" } ); + comp.addRepresentation( "licorice", { colorScheme: "element", colorValue: "#55eb86", visible: false, sele: "protein" } ); + comp.addTrajectory( basePath + name + ".xtc", { sele: trajSele } ); + comp.addTrajectory( basePath + "/@md_1u19.xtc", { sele: trajSele } ); + comp.centerView(); +} ); + diff --git a/mdsrv/__init__.py b/mdsrv/__init__.py index e9fbc9c..4f4e37e 100644 --- a/mdsrv/__init__.py +++ b/mdsrv/__init__.py @@ -1,3 +1,11 @@ from __future__ import absolute_import +from ._version import get_versions +__version__ = get_versions()['version'] +del get_versions + + + +from .mdsrv import * + + -from .mdsrv import * \ No newline at end of file diff --git a/mdsrv/_version.py b/mdsrv/_version.py new file mode 100644 index 0000000..86ecd29 --- /dev/null +++ b/mdsrv/_version.py @@ -0,0 +1,520 @@ + +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.18 (https://github.com/warner/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "$Format:%d$" + git_full = "$Format:%H$" + git_date = "$Format:%ci$" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "pep440" + cfg.tag_prefix = "v" + cfg.parentdir_prefix = "None" + cfg.versionfile_source = "mdsrv/_version.py" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, p.returncode + return stdout, p.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%d" % pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for i in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff --git a/mdsrv/mdsrv.py b/mdsrv/mdsrv.py index a0c94fd..a2d938e 100755 --- a/mdsrv/mdsrv.py +++ b/mdsrv/mdsrv.py @@ -307,14 +307,16 @@ def traj_path( index, root, filename ): # main ############################ -def open_browser( app, host, port, struc=None, traj=None ): +def open_browser( app, host, port, structure=None, trajectory=None, script=None ): if not app.config.get( "BROWSER_OPENED", False ): import webbrowser url = "http://" + host + ":" + str(port) + "/webapp" - if struc: - url += "?struc=file://cwd/" + struc - if traj: - url += "&traj=file://cwd/" + traj + if structure: + url += "?struc=file://cwd/" + structure + if trajectory: + url += "&traj=file://cwd/" + trajectory + if script: + url += "?load=file://cwd/" + script webbrowser.open( url, new=2, autoraise=True ) app.config.BROWSER_OPENED = True @@ -340,11 +342,32 @@ def socket_bind_wrapper(self): def parse_args(): from argparse import ArgumentParser parser = ArgumentParser( description="" ) - parser.add_argument( 'struc', type=str, nargs='?', default="", help="Path to a structure/topology file. Supported are pdb, gro and cif files. The file must be included within the current working directory (cwd) or a sub directory." ) - parser.add_argument( 'traj', type=str, nargs='?', default="", help="Path to a trajectory file. Supported are xtc/trr, nc and dcd files. The file must be included within the current working directory (cwd) or a sub directory." ) - parser.add_argument( '--cfg', type=str, help="Path to a config file. See https://github.com/arose/mdsrv/blob/master/app.cfg.sample for an example." ) - parser.add_argument( '--host', type=str, default="127.0.0.1", help="Host for the server. The default is 127.0.0.1/localhost. To make the server available to other clients set to your IP address or to 0.0.0.0 for automatic host determination. Is overwritten by the PORT in a config file." ) - parser.add_argument( '--port', type=int, default=0, help="Port to bind the server to. The default is 0 for automatic choosing of a free port. Fails when the given port is already in use on your machine. Is overwritten by the PORT in a config file." ) + parser.add_argument( 'structure', type=str, nargs='?', default="", + help="Path to a structure/topology file. Supported are pdb, gro and "+\ + "cif files. The file must be included within the current working "+\ + "directory (cwd) or a sub directory." ) + parser.add_argument( 'trajectory', type=str, nargs='?', default="", + help="Path to a trajectory file. Supported are xtc/trr, nc and dcd "+\ + "files. The file must be included within the current working "+\ + "directory (cwd) or a sub directory." ) + parser.add_argument( '--script', type=str, default="", + help="Path to an ngl script file. The file must be included within "+\ + "the current working directory (cwd) or a sub directory. See "+\ + "https://github.com/arose/mdsrv/blob/master/script.ngl or the "+\ + "documentation for an example." ) + parser.add_argument( '--cfg', '--configure', type=str, help="Path to a "+\ + "configuration file. "+\ + "See https://github.com/arose/mdsrv/blob/master/app.cfg.sample "+\ + "or the documentation for an example." ) + parser.add_argument( '--host', type=str, default="127.0.0.1", + help="Host for the server. The default is 127.0.0.1 or localhost. "+\ + "To make the server available to other clients set to your IP "+\ + "address or to 0.0.0.0 for automatic host determination. This is "+\ + "overwritten by the PORT in a configuration file." ) + parser.add_argument( '--port', type=int, default=0, help="Port to bind "+\ + "the server to. The default is 0 for an automatic choose of a "+\ + "free port. Fails when the given port is already in use on "+\ + "your machine. This is overwritten by the PORT in a configuration file." ) args = parser.parse_args() return args @@ -369,7 +392,7 @@ def main(): } ) app.config[ "DATA_DIRS" ] = DATA_DIRS def on_bind( host, port ): - open_browser( app, host, port, args.struc, args.traj ) + open_browser( app, host, port, args.structure, args.trajectory, args.script ) patch_socket_bind( on_bind ) app.run( debug=app.config.get( 'DEBUG', False ), diff --git a/mdsrv/webapp/index.html b/mdsrv/webapp/index.html index 9a5c86a..6d2c09c 100644 --- a/mdsrv/webapp/index.html +++ b/mdsrv/webapp/index.html @@ -23,6 +23,7 @@ + @@ -38,7 +39,6 @@ ); NGL.DatasourceRegistry.listing = NGL.DatasourceRegistry.get( "file" ); NGL.DatasourceRegistry.trajectory = NGL.DatasourceRegistry.get( "file" ); - document.addEventListener( "DOMContentLoaded", function(){ stage = new NGL.Stage(); NGL.StageWidget( stage ); diff --git a/mdsrv/webapp/js/gui.js b/mdsrv/webapp/js/gui.js index 952e22e..5e0c58c 100644 --- a/mdsrv/webapp/js/gui.js +++ b/mdsrv/webapp/js/gui.js @@ -369,6 +369,27 @@ NGL.StageWidget = function( stage ){ }; +NGL.getPickingMessage = function( d, prefix ){ + var msg; + if( d.atom ){ + msg = "atom: " + + d.atom.qualifiedName() + + " (" + d.atom.structure.name + ")"; + }else if( d.bond ){ + msg = "bond: " + + d.bond.atom1.qualifiedName() + " - " + d.bond.atom2.qualifiedName() + + " (" + d.bond.structure.name + ")"; + }else if( d.volume ){ + msg = "volume: " + + d.volume.value.toPrecision( 3 ) + + " (" + d.volume.volume.name + ")"; + }else{ + msg = "nothing"; + } + return prefix ? prefix + " " + msg : msg; +}; + + // Viewport NGL.ViewportWidget = function( stage ){ @@ -404,6 +425,33 @@ NGL.ViewportWidget = function( stage ){ }, false ); + // tooltip + + var tooltipText = new UI.Text(); + + var tooltipPanel = new UI.OverlayPanel() + .setPosition( "absolute" ) + .setDisplay( "none" ) + .setOpacity( "0.9" ) + .add( tooltipText ); + + stage.signals.hovered.add( function( d ){ + var text = NGL.getPickingMessage( d, "" ); + if( text !== "nothing" ){ + d.canvasPosition.addScalar( 5 ); + tooltipText.setValue( text ); + tooltipPanel + .setBottom( d.canvasPosition.y + "px" ) + .setLeft( d.canvasPosition.x + "px" ) + .setDisplay( "block" ); + }else{ + tooltipPanel.setDisplay( "none" ); + } + + } ); + + container.add( tooltipPanel ); + return container; }; @@ -414,55 +462,35 @@ NGL.ViewportWidget = function( stage ){ NGL.ToolbarWidget = function( stage ){ var container = new UI.Panel(); - var messagePanel1 = new UI.Panel().setDisplay( "inline" ).setFloat( "left" ); - var messagePanel2 = new UI.Panel().setDisplay( "inline" ).setFloat( "left" ); - var statsPanel = new UI.Panel().setDisplay( "inline" ).setFloat( "right" ); - - function getPickingMessage( d, prefix ){ - var msg; - if( d.atom ){ - msg = "atom: " + - d.atom.qualifiedName() + - " (" + d.atom.structure.name + ")"; - }else if( d.bond ){ - msg = "bond: " + - d.bond.atom1.qualifiedName() + " - " + d.bond.atom2.qualifiedName() + - " (" + d.bond.structure.name + ")"; - }else if( d.volume ){ - msg = "volume: " + - d.volume.value.toPrecision( 3 ) + - " (" + d.volume.volume.name + ")"; - }else{ - msg = "nothing"; - } - return prefix + " " + msg; - } - stage.signals.clicked.add( function( d ){ - messagePanel1 - .clear() - .add( new UI.Text( getPickingMessage( d, "Clicked" ) ) ); - } ); + var messageText = new UI.Text(); + var messagePanel = new UI.Panel() + .setDisplay( "inline" ) + .setFloat( "left" ) + .add( messageText ); - stage.signals.hovered.add( function( d ){ - messagePanel2 - .clear() - .add( new UI.Text( getPickingMessage( d, "Hovered" ) ) ); + var statsText = new UI.Text(); + var statsPanel = new UI.Panel() + .setDisplay( "inline" ) + .setFloat( "right" ) + .add( statsText ); + + stage.signals.clicked.add( function( d ){ + messageText.setValue( NGL.getPickingMessage( d, "Clicked" ) ); } ); stage.viewer.stats.signals.updated.add( function(){ - statsPanel.clear(); if( NGL.Debug ){ - statsPanel.add( - new UI.Text( - stage.viewer.stats.lastDuration.toFixed( 2 ) + " ms | " + - stage.viewer.stats.lastFps + " fps" - ) + statsText.setValue( + stage.viewer.stats.lastDuration.toFixed( 2 ) + " ms | " + + stage.viewer.stats.lastFps + " fps" ); + }else{ + statsText.setValue( "" ); } } ); - container.add( messagePanel1, messagePanel2, statsPanel ); + container.add( messagePanel, statsPanel ); return container; @@ -499,13 +527,20 @@ NGL.MenubarWidget = function( stage, preferences ){ NGL.MenubarFileWidget = function( stage ){ var fileTypesOpen = NGL.ParserRegistry.names.concat( [ "ngl", "gz" ] ); + var dcdIndex = fileTypesOpen.indexOf( "dcd" ); + if( dcdIndex !== -1 ) fileTypesOpen.splice( dcdIndex, 1 ); // disallow dcd files var fileTypesImport = fileTypesOpen; function fileInputOnChange( e ){ var fn = function( file, callback ){ - stage.loadFile( file, { - defaultRepresentation: true - } ).then( function(){ callback(); } ); + var ext = file.name.split('.').pop().toLowerCase(); + if( fileTypesImport.includes( ext ) ){ + stage.loadFile( file, { + defaultRepresentation: true + } ).then( function(){ callback(); } ); + }else{ + console.error( "unknown filetype: " + ext ); + } } var queue = new NGL.Queue( fn, e.target.files ); } @@ -535,13 +570,13 @@ NGL.MenubarFileWidget = function( stage ){ var dirWidget; function onListingClick( info ){ var ext = info.path.split('.').pop().toLowerCase(); - if( fileTypesImport.indexOf( ext ) !== -1 ){ + if( fileTypesImport.includes( ext ) ){ stage.loadFile( datasource.getUrl( info.path ), { defaultRepresentation: true } ); dirWidget.dispose(); }else{ - NGL.log( "unknown filetype: " + ext ); + console.error( "unknown filetype: " + ext ); } } @@ -963,12 +998,6 @@ NGL.OverviewWidget = function( stage, preferences ){ ).setMarginLeft( "5px" ) ) ); - // addIcon( "file", "In front of atom-selection input fields." ); - - // addIcon( "bookmark", "In front of atom-selection input fields." ); - - // addIcon( "database", "In front of atom-selection input fields." ); - return container; }; @@ -1168,30 +1197,35 @@ NGL.SidebarWidget = function( stage ){ var widget; - if( component.type === "structure" ){ - - widget = new NGL.StructureComponentWidget( component, stage ); + switch( component.type ){ - }else if( component.type === "surface" ){ + case "structure": + widget = new NGL.StructureComponentWidget( component, stage ); + break; - widget = new NGL.SurfaceComponentWidget( component, stage ); + case "surface": + widget = new NGL.SurfaceComponentWidget( component, stage ); + break; - }else if( component.type === "shape" ){ + case "volume": + widget = new NGL.VolumeComponentWidget( component, stage ); + break; - widget = new NGL.ShapeComponentWidget( component, stage ); + case "shape": + widget = new NGL.ShapeComponentWidget( component, stage ); + break; - }else if( component.type === "script" ){ + case "script": + widget = new NGL.ScriptComponentWidget( component, stage ); + break; - widget = new NGL.ScriptComponentWidget( component, stage ); + case "component": + widget = new NGL.ComponentWidget( component, stage ); + break; - }else if( component.type === "component" ){ - - widget = new NGL.ComponentWidget( component, stage ); - - }else{ - - console.warn( "NGL.SidebarWidget: component type unknown", component ); - return; + default: + console.warn( "NGL.SidebarWidget: component type unknown", component ); + return; } @@ -1499,17 +1533,15 @@ NGL.StructureComponentWidget = function( component, stage ){ function fileInputOnChange( e ){ var fn = function( file, callback ){ - var framesPromise = NGL.autoLoad( file ) - .then( function( frames ){ - callback(); - return frames; // pass through - } ); - component.addTrajectory( framesPromise ); + NGL.autoLoad( file ).then( function( frames ){ + component.addTrajectory( frames ); + callback(); + } ); } var queue = new NGL.Queue( fn, e.target.files ); } - var fileInput = document.createElement("input"); + var fileInput = document.createElement( "input" ); fileInput.type = "file"; fileInput.multiple = true; fileInput.style.display = "none"; @@ -1679,6 +1711,66 @@ NGL.SurfaceComponentWidget = function( component, stage ){ }; +NGL.VolumeComponentWidget = function( component, stage ){ + + var signals = component.signals; + var container = new UI.CollapsibleIconPanel( "minus-square", "plus-square" ); + + var reprContainer = new UI.Panel(); + + signals.representationAdded.add( function( repr ){ + + reprContainer.add( + new NGL.RepresentationComponentWidget( repr, stage ) + ); + + } ); + + // Add representation + + var repr = new UI.Select() + .setColor( '#444' ) + .setOptions( (function(){ + + var reprOptions = { + "": "[ add ]", + "surface": "surface", + "dot": "dot", + "slice": "slice" + }; + return reprOptions; + + })() ) + .onChange( function(){ + + component.addRepresentation( repr.getValue() ); + repr.setValue( "" ); + componentPanel.setMenuDisplay( "none" ); + + } ); + + // Component panel + + var componentPanel = new UI.ComponentPanel( component ) + .setDisplay( "inline-block" ) + .setMargin( "0px" ) + .addMenuEntry( "Representation", repr ) + .addMenuEntry( + "File", new UI.Text( component.volume.path ) + .setMaxWidth( "100px" ) + .setWordWrap( "break-word" ) ); + + // Fill container + + container + .addStatic( componentPanel ) + .add( reprContainer ); + + return container; + +}; + + NGL.ShapeComponentWidget = function( component, stage ){ var signals = component.signals; @@ -1948,18 +2040,14 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ // } ); signals.representationAdded.add( function( repr ){ - reprContainer.add( new NGL.RepresentationComponentWidget( repr, stage ) ); - } ); signals.disposed.add( function(){ - menu.dispose(); container.dispose(); - } ); var numframes = new UI.Panel() @@ -1976,8 +2064,15 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ frame.setRange( -1, value - 1 ); frameRange.setRange( -1, value - 1 ); - // 1000 = n / step - step.setValue( Math.ceil( ( value + 1 ) / 100 ) ); + frame.setValue( traj.currentFrame ); + frameRange.setValue( traj.currentFrame ); + + if( component.defaultStep !== undefined ){ + step.setValue( component.defaultStep ); + }else{ + // 1000 = n / step + step.setValue( Math.ceil( ( value + 1 ) / 100 ) ); + } player.step = step.getValue(); player.end = value; @@ -1987,19 +2082,20 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ signals.gotNumframes.add( init ); signals.frameChanged.add( function( value ){ - frame.setValue( value ); frameRange.setValue( value ); - numframes.clear().add( frame.setWidth( "70px" ) ); - } ); // Name - var name = new UI.EllipsisText( traj.name ) + var name = new UI.EllipsisText( component.name ) .setWidth( "108px" ); + signals.nameChanged.add( function( value ){ + name.setValue( value ); + } ); + container.addStatic( name ); container.addStatic( numframes ); @@ -2010,10 +2106,8 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ .setWidth( "70px" ) .setRange( -1, -1 ) .onChange( function( e ){ - traj.setFrame( frame.getValue() ); menu.setMenuDisplay( "none" ); - } ); var step = new UI.Integer( 1 ) @@ -2039,14 +2133,10 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ } if( traj.player && traj.player._running ){ - traj.setPlayer(); traj.setFrame( value ); - }else if( !traj.inProgress ){ - traj.setFrame( value ); - } } ); @@ -2058,31 +2148,60 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ "linear": "linear", "spline": "spline", } ) + .setValue( component.defaultInterpolateType ) .onChange( function(){ - player.interpolateType = interpolateType.getValue(); - } ); - var interpolateStep = new UI.Integer( 5 ) + var interpolateStep = new UI.Integer( component.defaultInterpolateStep ) .setWidth( "30px" ) .setRange( 1, 50 ) .onChange( function(){ player.interpolateStep = interpolateStep.getValue(); } ); + var playDirection = new UI.Select() + .setColor( '#444' ) + .setOptions( { + "forward": "forward", + "backward": "backward", + } ) + .setValue( component.defaultDirection ) + .onChange( function(){ + player.direction = playDirection.getValue(); + } ); + + var playMode = new UI.Select() + .setColor( '#444' ) + .setOptions( { + "loop": "loop", + "once": "once", + } ) + .setValue( component.defaultMode ) + .onChange( function(){ + player.mode = playMode.getValue(); + } ); + // player - var timeout = new UI.Integer( 50 ) + var timeout = new UI.Integer( component.defaultTimeout ) .setWidth( "30px" ) .setRange( 10, 1000 ) .onChange( function(){ player.timeout = timeout.getValue(); } ); - var player = new NGL.TrajectoryPlayer( - traj, step.getValue(), timeout.getValue(), 0, traj.numframes - ); + var player = new NGL.TrajectoryPlayer( traj, { + step: step.getValue(), + timeout: timeout.getValue(), + start: 0, + end: traj.numframes, + interpolateType: interpolateType.getValue(), + interpolateStep: interpolateStep.getValue(), + direction: playDirection.getValue(), + mode: playMode.getValue() + } ); + traj.setPlayer( player ); var playerButton = new UI.ToggleIcon( true, "play", "pause" ) .setMarginRight( "10px" ) @@ -2109,30 +2228,6 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ frameRow.add( playerButton ); frameRow.add( frameRange ); - var playDirection = new UI.Select() - .setColor( '#444' ) - .setOptions( { - "forward": "forward", - "backward": "backward", - } ) - .onChange( function(){ - - player.direction = playDirection.getValue(); - - } ); - - var playMode = new UI.Select() - .setColor( '#444' ) - .setOptions( { - "loop": "loop", - "once": "once", - } ) - .onChange( function(){ - - player.mode = playMode.getValue(); - - } ); - // Selection container.add( @@ -2143,21 +2238,21 @@ NGL.TrajectoryComponentWidget = function( component, stage ){ // Options - var setCenterPbc = new UI.Checkbox( traj.params.centerPbc ) + var setCenterPbc = new UI.Checkbox( traj.centerPbc ) .onChange( function(){ component.setParameters( { "centerPbc": setCenterPbc.getValue() } ); } ); - var setRemovePbc = new UI.Checkbox( traj.params.removePbc ) + var setRemovePbc = new UI.Checkbox( traj.removePbc ) .onChange( function(){ component.setParameters( { "removePbc": setRemovePbc.getValue() } ); } ); - var setSuperpose = new UI.Checkbox( traj.params.superpose ) + var setSuperpose = new UI.Checkbox( traj.superpose ) .onChange( function(){ component.setParameters( { "superpose": setSuperpose.getValue() diff --git a/mdsrv/webapp/js/ngl.js b/mdsrv/webapp/js/ngl.js index 8bbb14c..1cca9a2 100644 --- a/mdsrv/webapp/js/ngl.js +++ b/mdsrv/webapp/js/ngl.js @@ -1,28 +1,29 @@ -!function(t){"use strict";t.console=t.console||{};for(var e,i,n=t.console,r={},o=function(){},a="memory".split(","),s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=a.pop();)n[e]||(n[e]=r);for(;i=s.pop();)n[i]||(n[i]=o)}("undefined"==typeof window?self:window),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,i){for(var n=window.atob(this.toDataURL(e,i).split(",")[1]),r=n.length,o=r>>2,a=new Uint8Array(r),s=new Uint32Array(a.buffer,0,o),c=0,u=0;c-9007199254740992&&t<9007199254740992&&Math.floor(t)===t}),Number.isNaN||(Number.isNaN=function(t){return t!==t}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){"use strict";if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e,i=Object(t),n=!1,r=1;r1?arguments[1]:void 0,s=a?Number(a):0;s!=s&&(s=0);var c=Math.min(Math.max(s,0),n);if(o+c>n)return!1;for(var u=-1;++ui.length)&&(e=i.length),e-=t.length;var n=i.indexOf(t,e);return n!==-1&&n===e}),String.prototype.includes||(String.prototype.includes=function(t,e){"use strict";return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&this.indexOf(t,e)!==-1}),Array.prototype.includes||(Array.prototype.includes=function(t){"use strict";if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),i=parseInt(e.length,10)||0;if(0===i)return!1;var n,r=parseInt(arguments[1],10)||0;r>=0?n=r:(n=i+r,n<0&&(n=0));for(var o;n0?1:-1)*Math.floor(Math.abs(e)):e},n=Math.pow(2,53)-1,r=function(t){var e=i(t);return Math.min(Math.max(e,0),n)};return function(t){var i=this,n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,a=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var s,c=r(n.length),u=e(i)?Object(new i(c)):new Array(c),h=0;h1?c.pop().toLowerCase():"",h=e.match(/^(.+):\/\/(.+)$/);h&&(n=h[1].toLowerCase(),e=h[2]);var l=e.substring(0,e.lastIndexOf("/")+1);if(r.includes(u)){i=u;var d=e.length-u.length-1;u=e.substr(0,d).split(".").pop().toLowerCase();var f=s.length-u.length-1;s=s.substr(0,f)}else i=!1;return{path:e,name:a,ext:u,base:s,dir:l,compressed:i,protocol:n,src:t}}function h(t,e,i){var n,r,o,a=null,s=0;i||(i={});var c=function(){s=i.leading===!1?0:Date.now(),a=null,o=t.apply(n,r),a||(n=r=null)};return function(){var u=Date.now();s||i.leading!==!1||(s=u);var h=e-(u-s);return n=this,r=arguments,h<=0||h>e?(a&&(clearTimeout(a),a=null),s=u,o=t.apply(n,r),a||(n=r=null)):a||i.trailing===!1||(a=setTimeout(c,h)),o}}function l(t){return t.sort().filter(function(t,e,i){return 0===e||t!==i[e-1]})}function d(t){var e=28672;if(t.length>e){for(var i=[],n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function M(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function P(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function C(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,o),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,e,l.STATIC_DRAW),s=n(),c={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},u={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var r=i.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),h=new w(i),h.needsUpdate=!0}function n(){var e=l.createProgram(),i=l.createShader(l.VERTEX_SHADER),n=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(i),l.compileShader(n),l.attachShader(e,i),l.attachShader(e,n),l.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,a,s,c,u,h,l=t.context,d=t.state,f=new P,p=new M,m=new P;this.render=function(n,g){if(0!==e.length){void 0===s&&i(),l.useProgram(s),d.initAttributes(),d.enableAttribute(c.position),d.enableAttribute(c.uv),d.disableUnusedAttributes(),d.disable(l.CULL_FACE),d.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,o),l.vertexAttribPointer(c.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(c.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(u.projectionMatrix,!1,g.projectionMatrix.elements),d.activeTexture(l.TEXTURE0),l.uniform1i(u.map,0);var v=0,y=0,b=n.fog;b?(l.uniform3f(u.fogColor,b.color.r,b.color.g,b.color.b),b&&b.isFog?(l.uniform1f(u.fogNear,b.near),l.uniform1f(u.fogFar,b.far),l.uniform1i(u.fogType,1),v=1,y=1):b&&b.isFogExp2&&(l.uniform1f(u.fogDensity,b.density),l.uniform1i(u.fogType,2),v=2,y=2)):(l.uniform1i(u.fogType,0),v=0,y=0);for(var x=0,_=e.length;x<_;x++){var w=e[x];w.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(r);for(var S=[],x=0,_=e.length;x<_;x++){var w=e[x],A=w.material;if(A.visible!==!1){l.uniform1f(u.alphaTest,A.alphaTest),l.uniformMatrix4fv(u.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(f,p,m),S[0]=m.x,S[1]=m.y;var M=0;n.fog&&A.fog&&(M=y),v!==M&&(l.uniform1i(u.fogType,M),v=M),null!==A.map?(l.uniform2f(u.uvOffset,A.map.offset.x,A.map.offset.y),l.uniform2f(u.uvScale,A.map.repeat.x,A.map.repeat.y)):(l.uniform2f(u.uvOffset,0,0),l.uniform2f(u.uvScale,1,1)),l.uniform1f(u.opacity,A.opacity),l.uniform3f(u.color,A.color.r,A.color.g,A.color.b),l.uniform1f(u.rotation,A.rotation),l.uniform2fv(u.scale,S),d.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),d.setDepthTest(A.depthTest),d.setDepthWrite(A.depthWrite),A.map?t.setTexture2D(A.map,0):t.setTexture2D(h,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}}d.enable(l.CULL_FACE),t.resetGLState()}}}function T(t,e){this.min=void 0!==t?t:new _(+(1/0),+(1/0)),this.max=void 0!==e?e:new _(-(1/0),-(1/0))}function E(t,e){function i(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);r=d.createBuffer(),o=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,r),d.bufferData(d.ARRAY_BUFFER,t,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),d.bufferData(d.ELEMENT_ARRAY_BUFFER,e,d.STATIC_DRAW),h=d.createTexture(),l=d.createTexture(),f.bindTexture(d.TEXTURE_2D,h),d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),f.bindTexture(d.TEXTURE_2D,l),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,16,16,0,d.RGBA,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),a={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},s=n(a),c={vertex:d.getAttribLocation(s,"position"),uv:d.getAttribLocation(s,"uv")},u={renderType:d.getUniformLocation(s,"renderType"),map:d.getUniformLocation(s,"map"),occlusionMap:d.getUniformLocation(s,"occlusionMap"),opacity:d.getUniformLocation(s,"opacity"),color:d.getUniformLocation(s,"color"),scale:d.getUniformLocation(s,"scale"),rotation:d.getUniformLocation(s,"rotation"),screenPosition:d.getUniformLocation(s,"screenPosition")}}function n(e){var i=d.createProgram(),n=d.createShader(d.FRAGMENT_SHADER),r=d.createShader(d.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return d.shaderSource(n,o+e.fragmentShader),d.shaderSource(r,o+e.vertexShader),d.compileShader(n),d.compileShader(r),d.attachShader(i,n),d.attachShader(i,r),d.linkProgram(i),i}var r,o,a,s,c,u,h,l,d=t.context,f=t.state;this.render=function(n,a,p){if(0!==e.length){var m=new P,g=p.w/p.z,v=.5*p.z,y=.5*p.w,b=16/p.w,x=new _(b*g,b),w=new P(1,1,0),S=new _(1,1),A=new T;A.min.set(0,0),A.max.set(p.z-16,p.w-16),void 0===s&&i(),d.useProgram(s),f.initAttributes(),f.enableAttribute(c.vertex),f.enableAttribute(c.uv),f.disableUnusedAttributes(),d.uniform1i(u.occlusionMap,0),d.uniform1i(u.map,1),d.bindBuffer(d.ARRAY_BUFFER,r),d.vertexAttribPointer(c.vertex,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),f.disable(d.CULL_FACE),f.setDepthWrite(!1);for(var M=0,C=e.length;M.001&&R.scale>.001&&(w.x=R.x,w.y=R.y,w.z=R.z,b=R.size*R.scale/p.w,x.x=b*g,x.y=b,d.uniform3f(u.screenPosition,w.x,w.y,w.z),d.uniform2f(u.scale,x.x,x.y),d.uniform1f(u.rotation,R.rotation),d.uniform1f(u.opacity,R.opacity),d.uniform3f(u.color,R.color.r,R.color.g,R.color.b),f.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),t.setTexture2D(R.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}f.enable(d.CULL_FACE),f.enable(d.DEPTH_TEST),f.setDepthWrite(!0),t.resetGLState()}}}function I(t,e,i,n,r,o,a,s,c,u){t=void 0!==t?t:[],e=void 0!==e?e:Fh,w.call(this,t,e,i,n,r,o,a,s,c,u),this.flipY=!1}function L(){this.seq=[],this.map={}}function R(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,o=Ql[r];if(void 0===o&&(o=new Float32Array(r),Ql[r]=o),0!==e){n.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=i,t[a].toArray(o,s)}return o}function O(t,e){var i=Jl[e];void 0===i&&(i=new Int32Array(e),Jl[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function D(t,e){t.uniform1f(this.addr,e)}function N(t,e){t.uniform1i(this.addr,e)}function k(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function F(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function z(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function B(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function U(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function j(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function $(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||Zl,n)}function V(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||Kl,n)}function G(t,e){t.uniform2iv(this.addr,e)}function H(t,e){t.uniform3iv(this.addr,e)}function W(t,e){t.uniform4iv(this.addr,e)}function X(t){switch(t){case 5126:return D;case 35664:return k;case 35665:return F;case 35666:return z;case 35674:return B;case 35675:return U;case 35676:return j;case 35678:return $;case 35680:return V;case 5124:case 35670:return N;case 35667:case 35671:return G;case 35668:case 35672:return H;case 35669:case 35673:return W}}function q(t,e){t.uniform1fv(this.addr,e)}function Y(t,e){t.uniform1iv(this.addr,e)}function Z(t,e){t.uniform2fv(this.addr,R(e,this.size,2))}function K(t,e){t.uniform3fv(this.addr,R(e,this.size,3))}function Q(t,e){t.uniform4fv(this.addr,R(e,this.size,4))}function J(t,e){t.uniformMatrix2fv(this.addr,!1,R(e,this.size,4))}function tt(t,e){t.uniformMatrix3fv(this.addr,!1,R(e,this.size,9))}function et(t,e){t.uniformMatrix4fv(this.addr,!1,R(e,this.size,16))}function it(t,e,i){var n=e.length,r=O(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTexture2D(e[o]||Zl,r[o])}function nt(t,e,i){var n=e.length,r=O(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTextureCube(e[o]||Kl,r[o])}function rt(t){switch(t){case 5126:return q;case 35664:return Z;case 35665:return K;case 35666:return Q;case 35674:return J;case 35675:return tt;case 35676:return et;case 35678:return it;case 35680:return nt;case 5124:case 35670:return Y;case 35667:case 35671:return G;case 35668:case 35672:return H;case 35669:case 35673:return W}}function ot(t,e,i){this.id=t,this.addr=i,this.setValue=X(e.type)}function at(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=rt(e.type)}function st(t){this.id=t,L.call(this)}function ct(t,e){t.seq.push(e),t.map[e.id]=e}function ut(t,e,i){var n=t.name,r=n.length;for(td.lastIndex=0;;){var o=td.exec(n),a=td.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s=0|s),void 0===u||"["===u&&a+2===r){ct(i,void 0===u?new ot(s,t,e):new at(s,t,e));break}var h=i.map,l=h[s];void 0===l&&(l=new st(s),ct(i,l)),i=l}}function ht(t,e,i){L.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==n;++r){var o=t.getActiveUniform(e,r),a=o.name,s=t.getUniformLocation(e,a);ut(o,s,this)}}function lt(t,e,i,n,r,o,a){function s(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);var r=n.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return ql.isPowerOfTwo(t.width)&&ql.isPowerOfTwo(t.height)}function u(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=ql.nearestPowerOfTwo(t.width),e.height=ql.nearestPowerOfTwo(t.height);var i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function h(t){return t.wrapS!==Hh||t.wrapT!==Hh||t.minFilter!==Xh&&t.minFilter!==Zh}function l(e){return e===Xh||e===qh||e===Yh?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),p(e),C.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),m(e),C.textures--}function p(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n.delete(e)}function m(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.delete(e.texture),n.delete(e)}}function g(e,r){var o=n.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(a.complete!==!1)return void x(o,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,a){var u=n.get(e);if(6===e.image.length)if(e.version>0&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",d),u.__image__webglTextureCube=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,l=e.image[0]&&e.image[0].isDataTexture,f=[],p=0;p<6;p++)h||l?f[p]=l?e.image[p].image:e.image[p]:f[p]=s(e.image[p],r.maxCubemapSize);var m=f[0],g=c(m),v=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,g);for(var p=0;p<6;p++)if(h)for(var x,_=f[p].mipmaps,w=0,S=_.length;w-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,v,y,x.data);else l?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)}function y(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function b(i,a,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===Hh&&a.wrapT===Hh||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(i,t.TEXTURE_MAG_FILTER,l(a.magFilter)), -t.texParameteri(i,t.TEXTURE_MIN_FILTER,l(a.minFilter)),a.minFilter!==Xh&&a.minFilter!==Zh&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===ol&&null===e.get("OES_texture_float_linear"))return;if(a.type===al&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,n,a){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var l=s(n.image,r.maxTextureSize);h(n)&&c(l)===!1&&(l=u(l));var f=c(l),p=o(n.format),m=o(n.type);b(t.TEXTURE_2D,n,f);var g,v=n.mipmaps;if(n&&n.isDepthTexture){var y=t.DEPTH_COMPONENT;if(n.type===ol){if(!T)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else T&&(y=t.DEPTH_COMPONENT16);n.format===vl&&(y=t.DEPTH_STENCIL),i.texImage2D(t.TEXTURE_2D,0,y,l.width,l.height,0,p,m,null)}else if(n&&n.isDataTexture)if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],i.texImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,p,l.width,l.height,0,p,m,l.data);else if(n&&n.isCompressedTexture)for(var x=0,_=v.length;x<_;x++)g=v[x],n.format!==fl&&n.format!==dl?i.getCompressedTextureFormats().indexOf(p)>-1?i.compressedTexImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],i.texImage2D(t.TEXTURE_2D,x,p,p,m,g);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,p,p,m,l);n.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function _(e,r,a,s){var c=o(r.texture.format),u=o(r.texture.type);i.texImage2D(s,0,c,r.width,r.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,i){t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):i.depthBuffer&&i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,i.width,i.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function S(e,i){var r=i&&i.isWebGLRenderTargetCube;if(r)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),g(i.depthTexture,0);var o=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===gl)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(i.depthTexture.format!==vl)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function A(e){var i=n.get(e),r=e&&e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");S(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),w(i.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),w(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function M(e){var r=n.get(e),o=n.get(e.texture);e.addEventListener("dispose",f),o.__webglTexture=t.createTexture(),C.textures++;var a=e&&e.isWebGLRenderTargetCube,s=c(e);if(a){r.__webglFramebuffer=[];for(var u=0;u<6;u++)r.__webglFramebuffer[u]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(a){i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,s);for(var u=0;u<6;u++)_(r.__webglFramebuffer[u],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+u);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,o.__webglTexture),b(t.TEXTURE_2D,e.texture,s),_(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),i.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&A(e)}function P(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==Xh&&r.minFilter!==Zh){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=n.get(r).__webglTexture;i.bindTexture(o,a),t.generateMipmap(o),i.bindTexture(o,null)}}var C=a.memory,T="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=M,this.updateRenderTargetMipmap=P}function dt(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function ft(t,e,i){function n(){var e=!1,i=new dt,n=null,r=new dt;return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,o,a){i.set(e,n,o,a),r.equals(i)===!1&&(t.clearColor(e,n,o,a),r.copy(i))},reset:function(){e=!1,n=null,r.set(0,0,0,1)}}}function r(){var e=!1,i=null,n=null,r=null;return{setTest:function(e){e?d(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case xh:t.depthFunc(t.NEVER);break;case _h:t.depthFunc(t.ALWAYS);break;case wh:t.depthFunc(t.LESS);break;case Sh:t.depthFunc(t.LEQUAL);break;case Ah:t.depthFunc(t.EQUAL);break;case Mh:t.depthFunc(t.GEQUAL);break;case Ph:t.depthFunc(t.GREATER);break;case Ch:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}}function o(){var e=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,u=null;return{setTest:function(e){e?d(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&r===i&&o===a||(t.stencilFunc(e,i,a),n=e,r=i,o=a)},setOp:function(e,i,n){a===e&&s===i&&c===n||(t.stencilOp(e,i,n),a=e,s=i,c=n)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,u=null}}}function a(e,i,n){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function St(t,e){this.normal=void 0!==t?t:new P(1,0,0),this.constant=void 0!==e?e:0}function At(t,e,i,n,r,o){this.planes=[void 0!==t?t:new St,void 0!==e?e:new St,void 0!==i?i:new St,void 0!==n?n:new St,void 0!==r?r:new St,void 0!==o?o:new St]}function Mt(t,e,i,n){function r(e,i,n,r){var o=e.geometry,a=null,s=b,c=e.customDepthMaterial;if(n&&(s=x,c=e.customDistanceMaterial),c)a=c;else{var u=!1;i.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var h=e.isSkinnedMesh&&i.skinning,l=0;u&&(l|=g),h&&(l|=v),a=s[l]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var d=a.uuid,f=i.uuid,p=w[d];void 0===p&&(p={},w[d]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=i.visible,a.wireframe=i.wireframe;var y=i.side;return k.renderSingleSided&&y==Wu&&(y=Gu),k.renderReverseSided&&(y===Gu?y=Hu:y===Hu&&(y=Gu)),a.side=y,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,n&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function o(t,e,i){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||c.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),m.push(t))}for(var a=t.children,s=0,u=a.length;s");return zt(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function Bt(t){function e(t,e,i,n){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,g=Ot(o,n,t.extensions),v=Dt(a),y=r.createProgram();i.isRawShaderMaterial?(f=[v,"\n"].filter(kt).join("\n"),p=[g,v,"\n"].filter(kt).join("\n")):(f=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(kt).join("\n"),p=[g,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+l:"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==Lh?"#define TONE_MAPPING":"",n.toneMapping!==Lh?ep.tonemapping_pars_fragment:"",n.toneMapping!==Lh?Rt("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?ep.encodings_pars_fragment:"",n.mapEncoding?It("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?It("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?It("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Lt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(kt).join("\n")),s=zt(s,n),s=Ft(s,n),c=zt(c,n),c=Ft(c,n),i.isShaderMaterial||(s=Bt(s),c=Bt(c));var b=f+s,x=p+c,_=Ct(r,r.VERTEX_SHADER,b),w=Ct(r,r.FRAGMENT_SHADER,x);r.attachShader(y,_),r.attachShader(y,w),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var S=r.getProgramInfoLog(y),A=r.getShaderInfoLog(_),M=r.getShaderInfoLog(w),P=!0,C=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(P=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",S,A,M)):""!==S?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",S):""!==A&&""!==M||(C=!1),C&&(this.diagnostics={runnable:P,material:i,programLog:S,vertexShader:{log:A,prefix:f},fragmentShader:{log:M,prefix:p}}),r.deleteShader(_),r.deleteShader(w);var T;this.getUniforms=function(){return void 0===T&&(T=new ht(r,y,t)),T};var E;return this.getAttributes=function(){return void 0===E&&(E=Nt(r,y)),E},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=op++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function jt(t,e){function i(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r0,shadowMapType:t.shadowMap.type, -toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===Wu,flipSided:r.side===Hu,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return p},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r65535?Uint32Array:Uint16Array,y=new $t(new v(o),1);return r(y,t.ELEMENT_ARRAY_BUFFER),n.wireframe=y,y}function u(t,e,i){if(e>i){var n=e;e=i,i=n}var r=t[e];return void 0===r?(t[e]=[i],!0):r.indexOf(i)===-1&&(r.push(i),!0)}var h=new ee(t,e,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function ne(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new P,color:new yt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new _};break;case"SpotLight":i={position:new P,direction:new P,color:new yt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new _};break;case"PointLight":i={position:new P,color:new yt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new _};break;case"HemisphereLight":i={direction:new P,skyColor:new yt,groundColor:new yt}}return t[e.id]=i,i}}}function re(t,e,i){function n(){if(void 0!==o)return o;var i=e.get("EXT_texture_filter_anisotropic");return o=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=i.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,y=!!e.get("OES_texture_float"),b=v&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b}}function oe(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function ae(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,u=4):(c=t.UNSIGNED_SHORT,u=2)}function o(e,n){t.drawElements(s,n,c,e*u),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function a(n,r,o){var a=e.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,c,r*u,n.maxInstancedCount),i.calls++,i.vertices+=o*n.maxInstancedCount,void(s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*o/3)))}var s,c,u;return{setMode:n,setIndex:r,render:o,renderInstances:a}}function se(){function t(){u.value!==n&&(u.value=n,u.needsUpdate=r>0),i.numPlanes=r}function e(t,e,n,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=u.value,r!==!0||null===a){var h=n+4*o,l=e.matrixWorldInverse;c.getNormalMatrix(l),(null===a||a.length0?1:-1,p[g]=L.x,p[g+1]=L.y,p[g+2]=L.z,m[v]=D/c,m[v+1]=1-R/h,g+=3,v+=2,E+=1}for(R=0;R65535?Uint32Array:Uint16Array)(l),f=new Float32Array(3*h),p=new Float32Array(3*h),m=new Float32Array(2*h),g=0,v=0,y=0,b=0,x=0;c("z","y","x",-1,-1,i,e,t,o,r,0),c("z","y","x",1,-1,i,e,-t,o,r,1),c("x","z","y",1,1,t,i,e,n,o,2),c("x","z","y",1,-1,t,i,-e,n,o,3),c("x","y","z",1,-1,t,e,i,n,r,4),c("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new $t(d,1)),this.addAttribute("position",new $t(f,3)),this.addAttribute("normal",new $t(p,3)),this.addAttribute("uv",new $t(m,2))}function he(t,e){this.origin=void 0!==t?t:new P,this.direction=void 0!==e?e:new P}function le(t,e){this.start=void 0!==t?t:new P,this.end=void 0!==e?e:new P}function de(t,e,i){this.a=void 0!==t?t:new P,this.b=void 0!==e?e:new P,this.c=void 0!==i?i:new P}function fe(t){mt.call(this),this.type="MeshBasicMaterial",this.color=new yt(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Th,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function pe(t,e){Yt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new te,this.material=void 0!==e?e:new fe({color:16777215*Math.random()}),this.drawMode=kl,this.updateMorphTargets()}function me(t,e,i,n){te.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,o=e/2,a=Math.floor(i)||1,s=Math.floor(n)||1,c=a+1,u=s+1,h=t/a,l=e/s,d=new Float32Array(c*u*3),f=new Float32Array(c*u*3),p=new Float32Array(c*u*2),m=0,g=0,v=0;v65535?Uint32Array:Uint16Array)(a*s*6),v=0;v=0){var h=o[c];if(void 0!==h){var l=Ut.FLOAT,d=h.array,f=h.normalized;d instanceof Float32Array?l=Ut.FLOAT:d instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):d instanceof Uint16Array?l=Ut.UNSIGNED_SHORT:d instanceof Int16Array?l=Ut.SHORT:d instanceof Uint32Array?l=Ut.UNSIGNED_INT:d instanceof Int32Array?l=Ut.INT:d instanceof Int8Array?l=Ut.BYTE:d instanceof Uint8Array&&(l=Ut.UNSIGNED_BYTE);var p=h.itemSize,m=qt.getAttributeBuffer(h);if(h&&h.isInterleavedBufferAttribute){var g=h.data,v=g.stride,y=h.offset;g&&g.isInstancedInterleavedBuffer?(Ht.enableAttributeAndDivisor(u,g.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=g.meshPerAttribute*g.count)):Ht.enableAttribute(u),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(u,p,l,f,v*g.array.BYTES_PER_ELEMENT,(n*v+y)*g.array.BYTES_PER_ELEMENT)}else h&&h.isInstancedBufferAttribute?(Ht.enableAttributeAndDivisor(u,h.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):Ht.enableAttribute(u),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(u,p,l,f,0,n*p*h.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:Ut.vertexAttrib2fv(u,b);break;case 3:Ut.vertexAttrib3fv(u,b);break;case 4:Ut.vertexAttrib4fv(u,b);break;default:Ut.vertexAttrib1fv(u,b)}}}}Ht.disableUnusedAttributes()}function h(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function f(t,e,i,n,r){var o,a;i.transparent?(o=K,a=++Q):(o=Y,a=++Z);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=Ft.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:Ft.z,group:r},o.push(s))}function p(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Nt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),g(Nt)}function m(t){return Nt.center.set(0,0,0),Nt.radius=.7071067811865476,Nt.applyMatrix4(t.matrixWorld),g(Nt)}function g(t){if(!Lt.intersectsSphere(t))return!1;var e=Rt.numPlanes;if(0===e)return!0;var i=it.clippingPlanes,n=t.center,r=-t.radius,o=0;do if(i[o].distanceToPoint(n)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d=0&&t.numSupportedMorphNormals++}var f=n.__webglShader.uniforms;!t.isShaderMaterial&&!t.isRawShaderMaterial|t.clipping===!0&&(n.numClippingPlanes=Rt.numPlanes,f.clippingPlanes=Rt.uniform),n.fog=e,n.lightsHash=zt.hash,t.lights&&(f.ambientLightColor.value=zt.ambient,f.directionalLights.value=zt.directional,f.spotLights.value=zt.spot,f.pointLights.value=zt.point,f.hemisphereLights.value=zt.hemi,f.directionalShadowMap.value=zt.directionalShadowMap,f.directionalShadowMatrix.value=zt.directionalShadowMatrix,f.spotShadowMap.value=zt.spotShadowMap,f.spotShadowMatrix.value=zt.spotShadowMatrix,f.pointShadowMap.value=zt.pointShadowMap,f.pointShadowMatrix.value=zt.pointShadowMatrix);var p=n.program.getUniforms(),m=ht.seqWithValue(p.seq,f);n.uniformsList=m,n.dynamicUniforms=ht.splitDynamic(m,f)}function x(t){t.side===Wu?Ht.disable(Ut.CULL_FACE):Ht.enable(Ut.CULL_FACE),Ht.setFlipSided(t.side===Hu),t.transparent===!0?Ht.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Ht.setBlending(Qu),Ht.setDepthFunc(t.depthFunc),Ht.setDepthTest(t.depthTest),Ht.setDepthWrite(t.depthWrite),Ht.setColorWrite(t.colorWrite),Ht.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function _(t,e,i,n){gt=0;var r=Wt.get(i);if(Ot&&(Dt||t!==ct)){var o=t===ct&&i.id===at;Rt.setState(i.clippingPlanes,i.clipShadows,t,r,o)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==zt.hash?i.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==Rt.numPlanes&&(i.needsUpdate=!0)),i.needsUpdate&&(b(i,e,n),i.needsUpdate=!1);var a=!1,s=!1,c=!1,u=r.program,h=u.getUniforms(),l=r.__webglShader.uniforms;if(u.id!==nt&&(Ut.useProgram(u.program),nt=u.id,a=!0,s=!0,c=!0),i.id!==at&&(at=i.id,s=!0),a||t!==ct){if(h.set(Ut,t,"projectionMatrix"),Gt.logarithmicDepthBuffer&&h.setValue(Ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var d=h.map.cameraPosition;void 0!==d&&d.setValue(Ut,Ft.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&h.setValue(Ut,"viewMatrix",t.matrixWorldInverse),h.set(Ut,it,"toneMappingExposure"),h.set(Ut,it,"toneMappingWhitePoint")}if(i.skinning){h.setOptional(Ut,n,"bindMatrix"),h.setOptional(Ut,n,"bindMatrixInverse");var f=n.skeleton;f&&(Gt.floatVertexTextures&&f.useVertexTexture?(h.set(Ut,f,"boneTexture"),h.set(Ut,f,"boneTextureWidth"),h.set(Ut,f,"boneTextureHeight")):h.setOptional(Ut,f,"boneMatrices"))}s&&(i.lights&&N(l,c),e&&i.fog&&I(l,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&w(l,i),i.isLineBasicMaterial?S(l,i):i.isLineDashedMaterial?(S(l,i),M(l,i)):i.isPointsMaterial?T(l,i):i.isMeshLambertMaterial?L(l,i):i.isMeshPhongMaterial?R(l,i):i.isMeshPhysicalMaterial?D(l,i):i.isMeshStandardMaterial?O(l,i):i.isMeshDepthMaterial?i.displacementMap&&(l.displacementMap.value=i.displacementMap,l.displacementScale.value=i.displacementScale,l.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(l.opacity.value=i.opacity),ht.upload(Ut,r.uniformsList,l,it)),h.set(Ut,n,"modelViewMatrix"),h.set(Ut,n,"normalMatrix"),h.setValue(Ut,"modelMatrix",n.matrixWorld);var p=r.dynamicUniforms;return null!==p&&(ht.evalDynamic(p,l,n,t),ht.upload(Ut,p,l,it)),u}function w(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function M(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function T(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*Pt,t.scale.value=.5*U.clientHeight,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function I(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function L(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function R(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function O(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function D(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,O(t,e)}function N(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function k(t){for(var e=0,i=0,n=t.length;i=Gt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Gt.maxTextures),gt+=1,t}function B(t){var e;if(t===Gh)return Ut.REPEAT;if(t===Hh)return Ut.CLAMP_TO_EDGE;if(t===Wh)return Ut.MIRRORED_REPEAT;if(t===Xh)return Ut.NEAREST;if(t===qh)return Ut.NEAREST_MIPMAP_NEAREST;if(t===Yh)return Ut.NEAREST_MIPMAP_LINEAR;if(t===Zh)return Ut.LINEAR;if(t===Kh)return Ut.LINEAR_MIPMAP_NEAREST;if(t===Qh)return Ut.LINEAR_MIPMAP_LINEAR;if(t===Jh)return Ut.UNSIGNED_BYTE;if(t===sl)return Ut.UNSIGNED_SHORT_4_4_4_4;if(t===cl)return Ut.UNSIGNED_SHORT_5_5_5_1;if(t===ul)return Ut.UNSIGNED_SHORT_5_6_5;if(t===tl)return Ut.BYTE;if(t===el)return Ut.SHORT;if(t===il)return Ut.UNSIGNED_SHORT;if(t===nl)return Ut.INT;if(t===rl)return Ut.UNSIGNED_INT;if(t===ol)return Ut.FLOAT;if(e=Vt.get("OES_texture_half_float"),null!==e&&t===al)return e.HALF_FLOAT_OES;if(t===ll)return Ut.ALPHA;if(t===dl)return Ut.RGB;if(t===fl)return Ut.RGBA;if(t===pl)return Ut.LUMINANCE;if(t===ml)return Ut.LUMINANCE_ALPHA;if(t===gl)return Ut.DEPTH_COMPONENT;if(t===vl)return Ut.DEPTH_STENCIL;if(t===rh)return Ut.FUNC_ADD;if(t===oh)return Ut.FUNC_SUBTRACT;if(t===ah)return Ut.FUNC_REVERSE_SUBTRACT;if(t===uh)return Ut.ZERO;if(t===hh)return Ut.ONE;if(t===lh)return Ut.SRC_COLOR;if(t===dh)return Ut.ONE_MINUS_SRC_COLOR;if(t===fh)return Ut.SRC_ALPHA;if(t===ph)return Ut.ONE_MINUS_SRC_ALPHA;if(t===mh)return Ut.DST_ALPHA;if(t===gh)return Ut.ONE_MINUS_DST_ALPHA;if(t===vh)return Ut.DST_COLOR;if(t===yh)return Ut.ONE_MINUS_DST_COLOR;if(t===bh)return Ut.SRC_ALPHA_SATURATE;if(e=Vt.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===yl)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===bl)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===xl)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT; -if(t===_l)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=Vt.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===wl)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Sl)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Al)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Ml)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=Vt.get("WEBGL_compressed_texture_etc1"),null!==e&&t===Pl)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=Vt.get("EXT_blend_minmax"),null!==e){if(t===sh)return e.MIN_EXT;if(t===ch)return e.MAX_EXT}return e=Vt.get("WEBGL_depth_texture"),null!==e&&t===hl?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Fu),t=t||{};var U=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==t.context?t.context:null,$=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,H=void 0!==t.antialias&&t.antialias,W=void 0===t.premultipliedAlpha||t.premultipliedAlpha,X=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,q=[],Y=[],Z=-1,K=[],Q=-1,J=new Float32Array(8),tt=[],et=[];this.domElement=U,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Rh,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var it=this,nt=null,rt=null,ot=null,at=-1,st="",ct=null,ut=new dt,pt=null,mt=new dt,gt=0,bt=new yt(0),xt=0,wt=U.width,St=U.height,Pt=1,Ct=new dt(0,0,wt,St),Et=!1,It=new dt(0,0,wt,St),Lt=new At,Rt=new se,Ot=!1,Dt=!1,Nt=new _t,kt=new A,Ft=new P,zt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Bt={calls:0,vertices:0,faces:0,points:0};this.info={render:Bt,memory:{geometries:0,textures:0},programs:null};var Ut;try{var $t={alpha:$,depth:V,stencil:G,antialias:H,premultipliedAlpha:W,preserveDrawingBuffer:X};if(Ut=j||U.getContext("webgl",$t)||U.getContext("experimental-webgl",$t),null===Ut)throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Ut.getShaderPrecisionFormat&&(Ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",o,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Vt=new oe(Ut);Vt.get("WEBGL_depth_texture"),Vt.get("OES_texture_float"),Vt.get("OES_texture_float_linear"),Vt.get("OES_texture_half_float"),Vt.get("OES_texture_half_float_linear"),Vt.get("OES_standard_derivatives"),Vt.get("ANGLE_instanced_arrays"),Vt.get("OES_element_index_uint")&&(te.MaxIndex=4294967296);var Gt=new re(Ut,Vt,t),Ht=new ft(Ut,Vt,B),Wt=new Tt,Xt=new lt(Ut,Vt,Ht,Wt,Gt,B,this.info),qt=new ie(Ut,Wt,this.info),Yt=new jt(this,Gt),Zt=new ne;this.info.programs=Yt.programs;var Kt=new ce(Ut,Vt,Bt),Qt=new ae(Ut,Vt,Bt),Jt=new ye(-1,1,1,-1,0,1),ee=new ve,he=new pe(new me(2,2),new fe({depthTest:!1,depthWrite:!1,fog:!1})),le=rp.cube,de=new pe(new ue(5,5,5),new vt({uniforms:le.uniforms,vertexShader:le.vertexShader,fragmentShader:le.fragmentShader,side:Hu,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=Ut,this.capabilities=Gt,this.extensions=Vt,this.properties=Wt,this.state=Ht;var ge=new Mt(this,zt,qt,Gt);this.shadowMap=ge;var be=new C(this,tt),xe=new E(this,et);this.getContext=function(){return Ut},this.getContextAttributes=function(){return Ut.getContextAttributes()},this.forceContextLoss=function(){Vt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Gt.getMaxAnisotropy()},this.getPrecision=function(){return Gt.precision},this.getPixelRatio=function(){return Pt},this.setPixelRatio=function(t){void 0!==t&&(Pt=t,this.setSize(It.z,It.w,!1))},this.getSize=function(){return{width:wt,height:St}},this.setSize=function(t,e,i){wt=t,St=e,U.width=t*Pt,U.height=e*Pt,i!==!1&&(U.style.width=t+"px",U.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Ht.viewport(It.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Ht.scissor(Ct.set(t,e,i,n))},this.setScissorTest=function(t){Ht.setScissorTest(Et=t)},this.getClearColor=function(){return bt},this.setClearColor=function(t,e){bt.set(t),xt=void 0!==e?e:1,i(bt.r,bt.g,bt.b,xt)},this.getClearAlpha=function(){return xt},this.setClearAlpha=function(t){xt=t,i(bt.r,bt.g,bt.b,xt)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=Ut.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Ut.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Ut.STENCIL_BUFFER_BIT),Ut.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=r,this.dispose=function(){K=[],Q=-1,Y=[],Z=-1,U.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,i){Ht.initAttributes();var n=Wt.get(t);t.hasPositions&&!n.position&&(n.position=Ut.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Ut.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Ut.createBuffer()),t.hasColors&&!n.color&&(n.color=Ut.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.position),Ut.bufferData(Ut.ARRAY_BUFFER,t.positionArray,Ut.DYNAMIC_DRAW),Ht.enableAttribute(r.position),Ut.vertexAttribPointer(r.position,3,Ut.FLOAT,!1,0,0)),t.hasNormals){if(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===Xu)for(var o=0,a=3*t.count;o8&&(f.length=8);for(var v=n.morphAttributes,p=0,m=f.length;p0&&w.renderInstances(n,E,L):w.render(E,L)},this.render=function(t,e,n,r){if((e&&e.isCamera)===!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;st="",at=-1,ct=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),kt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Lt.setFromMatrix(kt),q.length=0,Z=-1,Q=-1,tt.length=0,et.length=0,Dt=this.localClippingEnabled,Ot=Rt.init(this.clippingPlanes,Dt,e),v(t,e),Y.length=Z+1,K.length=Q+1,it.sortObjects===!0&&(Y.sort(l),K.sort(d)),Ot&&Rt.beginShadows(),k(q),ge.render(t,e),F(q,e),Ot&&Rt.endShadows(),Bt.calls=0,Bt.vertices=0,Bt.faces=0,Bt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var a=t.background;if(null===a?i(bt.r,bt.g,bt.b,xt):a&&a.isColor&&(i(a.r,a.g,a.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),a&&a.isCubeTexture?(ee.projectionMatrix.copy(e.projectionMatrix),ee.matrixWorld.extractRotation(e.matrixWorld),ee.matrixWorldInverse.getInverse(ee.matrixWorld),de.material.uniforms.tCube.value=a,de.modelViewMatrix.multiplyMatrices(ee.matrixWorldInverse,de.matrixWorld),qt.update(de),it.renderBufferDirect(ee,null,de.geometry,de.material,de,null)):a&&a.isTexture&&(he.material.map=a,qt.update(he),it.renderBufferDirect(Jt,null,he.geometry,he.material,he,null)),t.overrideMaterial){var s=t.overrideMaterial;y(Y,e,o,s),y(K,e,o,s)}else Ht.setBlending(Qu),y(Y,e,o),y(K,e,o);be.render(t,e),xe.render(t,e,mt),n&&Xt.updateRenderTargetMipmap(n),Ht.setDepthTest(!0),Ht.setDepthWrite(!0),Ht.setColorWrite(!0)},this.setFaceCulling=function(t,e){Ht.setCullFace(t),Ht.setFlipSided(e===ju)},this.allocTextureUnit=z,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Xt.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Xt.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Xt.setTextureCube(e,i):Xt.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){return rt},this.setRenderTarget=function(t){rt=t,t&&void 0===Wt.get(t).__webglFramebuffer&&Xt.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=Wt.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ut.copy(t.scissor),pt=t.scissorTest,mt.copy(t.viewport)}else e=null,ut.copy(Ct).multiplyScalar(Pt),pt=Et,mt.copy(It).multiplyScalar(Pt);if(ot!==e&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,e),ot=e),Ht.scissor(ut),Ht.setScissorTest(pt),Ht.viewport(mt),i){var r=Wt.get(t.texture);Ut.framebufferTexture2D(Ut.FRAMEBUFFER,Ut.COLOR_ATTACHMENT0,Ut.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=Wt.get(t).__webglFramebuffer;if(a){var s=!1;a!==ot&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==fl&&B(u)!==Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Jh||B(h)===Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_TYPE)||h===ol&&(Vt.get("OES_texture_float")||Vt.get("WEBGL_color_buffer_float"))||h===al&&Vt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ut.checkFramebufferStatus(Ut.FRAMEBUFFER)===Ut.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Ut.readPixels(e,i,n,r,B(u),B(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Ut.bindFramebuffer(Ut.FRAMEBUFFER,ot)}}}}function xe(t,e){this.name="",this.color=new yt(t),this.density=void 0!==e?e:25e-5}function _e(t,e,i){this.name="",this.color=new yt(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function we(){Yt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Se(t,e,i,n,r){Yt.call(this),this.lensFlares=[],this.positionScreen=new P,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function Ae(t){mt.call(this),this.type="SpriteMaterial",this.color=new yt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Me(t){Yt.call(this),this.type="Sprite",this.material=void 0!==t?t:new Ae}function Pe(){Yt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ce(t,e,i,n,r,o,a,s,c,u,h,l){w.call(this,null,o,a,s,c,u,n,r,h,l),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:Xh,this.minFilter=void 0!==u?u:Xh,this.flipY=!1,this.generateMipmaps=!1}function Te(t,e,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new A,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=ql.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Ce(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,fl,ol)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r0)&&S.push(A,M,T),(m!==i-1||s65535?Gt:Vt)(S,1)),this.addAttribute("position",u),this.addAttribute("normal",h),this.addAttribute("uv",l),this.boundingSphere=new _t(new P,t)}function Zi(t,e,i,n,r,o,a){Kt.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Yi(t,e,i,n,r,o,a))}function Ki(t,e){Yt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new yt,new yt];var i=new Zi(e,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;n0&&f++,e>0&&f++);var p=c(),m=u(),g=new $t(new(m>65535?Uint32Array:Uint16Array)(m),1),v=new $t(new Float32Array(3*p),3),y=new $t(new Float32Array(3*p),3),b=new $t(new Float32Array(2*p),2),x=0,w=0,S=[],A=i/2,M=0;h(),o===!1&&(t>0&&l(!0),e>0&&l(!1)),this.setIndex(g),this.addAttribute("position",v),this.addAttribute("normal",y),this.addAttribute("uv",b)}function rn(t,e,i,n,r,o){Yt.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===o&&(o=.2*r),this.position.copy(e),this.line=new Re(gp,new Le({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new pe(vp,new fe({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,o)}function on(t,e,i,n){function r(t){var e=t.normalize().clone();e.index=h.vertices.push(e)-1;var i=s(t)/2/Math.PI+.5,n=c(t)/Math.PI+.5;return e.uv=new _(i,1-n),e}function o(t,e,i){var n=new Wt(t.index,e.index,i.index,[t.clone(),e.clone(),i.clone()]);h.faces.push(n),b.copy(t).add(e).add(i).divideScalar(3);var r=s(b);h.faceVertexUvs[0].push([u(t.uv,t,r),u(e.uv,e,r),u(i.uv,i,r)])}function a(t,e){for(var i=Math.pow(2,e),n=r(h.vertices[t.a]),a=r(h.vertices[t.b]),s=r(h.vertices[t.c]),c=[],u=0;u<=i;u++){c[u]=[];for(var l=r(n.clone().lerp(s,u/i)),d=r(a.clone().lerp(s,u/i)),f=i-u,p=0;p<=f;p++)0===p&&u===i?c[u][p]=l:c[u][p]=r(l.clone().lerp(d,p/f)); -}for(var u=0;u.9&&C<.1&&(w<.2&&(x[0].x+=1),S<.2&&(x[1].x+=1),A<.2&&(x[2].x+=1))}for(var l=0,d=this.vertices.length;l=0&&e<=7&&ev[t]?ev[t][e]:Array(e+1).join(t)}function Jn(t,e){function i(){p=[],r(),o(),a()}function n(t,e){return void 0!==t?t:e}function r(){p.push(Zn("TITEL %-74s",t.name))}function o(){f.forEach(function(t){p.push(Zn("REMARK %-73s",t))}),t.trajectory&&(p.push(Zn("REMARK %-73s","Trajectory '"+t.trajectory.name+"'")),p.push(Zn("REMARK %-73s","Frame "+t.trajectory.frame)))}function a(){var e=1,i=1;t.eachModel(function(t){p.push(Zn("MODEL %-74d",i++)),t.eachAtom(function(t){var i=t.hetero?g:m,r=d?e:t.serial,o=t.atomname;1===o.length&&(o=" "+o),p.push(Zn(i,r,o,t.resname,n(t.chainname," "),t.resno,t.x,t.y,t.z,n(t.occurence,1),n(t.bfactor,0),n(t.segid,""),n(t.element,""))),e+=1}),p.push(Zn("%-80s","ENDMDL")),i+=1}),p.push(Zn("%-80s","END"))}function s(){return i(),p.join("\n")}function u(){return new Blob([s()],{type:"text/plain"})}function h(t,e){t=t||"structure",e=e||"pdb";var i=t+"."+e,n=u();c(n,i)}var l=Object.assign({},e),d=void 0===l.renumberSerial||l.renumberSerial,f=l.remarks||[];Array.isArray(f)||(f=[f]);var p,m="ATOM %5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s",g="HETATM%5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s";this.getString=s,this.getBlob=u,this.download=h}function tr(){this.count=0,this.signals={countChanged:new ln}}function er(t){this.name=t||"",this.nextGid=1,this.objectList=[],this.rangeList=[]}function ir(){this.signals={updated:new ln},this.begin(),this.maxDuration=-(1/0),this.minDuration=1/0,this.avgDuration=14,this.lastDuration=1/0,this.prevFpsTime=0,this.lastFps=1/0,this.lastFrames=1,this.frames=0,this.count=0}function nr(t,e){function i(t){d.enabled!==!1&&(v=g,g===f.NONE&&(t.keyCode!==d.keys[f.ROTATE]||d.noRotate?t.keyCode!==d.keys[f.ZOOM]||d.noZoom?t.keyCode!==d.keys[f.PAN]||d.noPan||(g=f.PAN):g=f.ZOOM:g=f.ROTATE))}function n(){d.enabled!==!1&&(g=v)}function r(t){d.enabled!==!1&&(g===f.NONE&&(g=t.button),g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||(I.copy(N(t.pageX,t.pageY)),L.copy(I)):(A.copy(N(t.pageX,t.pageY)),C.copy(A)):(x.copy(k(t.pageX,t.pageY)),b.copy(x)),document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",a,!1),d.dispatchEvent(O))}function o(t){d.enabled!==!1&&(g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||L.copy(N(t.pageX,t.pageY)):C.copy(N(t.pageX,t.pageY)):(b.copy(x),x.copy(k(t.pageX,t.pageY))))}function a(){d.enabled!==!1&&(g=f.NONE,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),d.dispatchEvent(D))}function s(t){if(d.enabled!==!1){var e=0;e=t.wheelDelta?t.wheelDelta/40:t.detail?-t.detail/3:3*-t.deltaY,A.y+=.01*e,d.dispatchEvent(O),d.dispatchEvent(D)}}function c(t){if(d.enabled!==!1){switch(t.touches.length){case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x);break;default:g=f.TOUCH_ZOOM_PAN;var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;E=T=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;I.copy(N(n,r)),L.copy(I)}d.dispatchEvent(O)}}function u(t){if(d.enabled!==!1)switch(t.touches.length){case 1:b.copy(x),x.copy(k(t.touches[0].pageX,t.touches[0].pageY));break;default:var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;E=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;L.copy(N(n,r))}}function h(t){if(d.enabled!==!1){switch(t.touches.length){case 0:g=f.NONE;break;case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x)}d.dispatchEvent(D)}}function l(t){t.preventDefault()}var d=this,f={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new P;var p=1e-6,m=new P,g=f.NONE,v=f.NONE,y=new P,b=new _,x=new _,w=new P,S=0,A=new _,C=new _,T=0,E=0,I=new _,L=new _;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var R={type:"change"},O={type:"start"},D={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var t=this.domElement.getBoundingClientRect(),e=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-e.clientLeft,this.screen.top=t.top+window.pageYOffset-e.clientTop,this.screen.width=t.width,this.screen.height=t.height}},this.handleEvent=function(t){"function"==typeof this[t.type]&&this[t.type](t)};var N=function(){var t=new _;return function(e,i){return t.set((e-d.screen.left)/d.screen.width,(i-d.screen.top)/d.screen.height),t}}(),k=function(){var t=new _;return function(e,i){return t.set((e-.5*d.screen.width-d.screen.left)/(.5*d.screen.width),(d.screen.height+2*(d.screen.top-i))/d.screen.width),t}}();this.rotateCamera=function(){var t,e=new P,i=new M,n=new P,r=new P,o=new P,a=new P;return function(){a.set(x.x-b.x,x.y-b.y,0),t=a.length(),t?(y.copy(d.object.position).sub(d.target),n.copy(y).normalize(),r.copy(d.object.up).normalize(),o.crossVectors(r,n).normalize(),r.setLength(x.y-b.y),o.setLength(x.x-b.x),a.copy(r.add(o)),e.crossVectors(a,y).normalize(),t*=d.rotateSpeed,i.setFromAxisAngle(e,t),y.applyQuaternion(i),d.object.up.applyQuaternion(i),w.copy(e),S=t):!d.staticMoving&&S&&(S*=Math.sqrt(1-d.dynamicDampingFactor),y.copy(d.object.position).sub(d.target),i.setFromAxisAngle(w,S),y.applyQuaternion(i),d.object.up.applyQuaternion(i)),b.copy(x)}}(),this.zoomCamera=function(){var t;g===f.TOUCH_ZOOM_PAN?(t=T/E,T=E,y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom*=t)):(t=1+(C.y-A.y)*d.zoomSpeed,1!==t&&t>0&&(y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom/=t),d.staticMoving?A.copy(C):A.y+=(C.y-A.y)*this.dynamicDampingFactor))},this.panCamera=function(){var t=new _,e=new P,i=new P;return function(){if(t.copy(L).sub(I),t.lengthSq()){if(void 0===d.object.fov){var n=(d.object.right-d.object.left)/d.object.zoom,r=(d.object.top-d.object.bottom)/d.object.zoom;t.x*=n,t.y*=r}else t.multiplyScalar(y.length()*d.panSpeed);i.copy(y).cross(d.object.up).setLength(t.x),i.add(e.copy(d.object.up).setLength(t.y)),d.object.position.add(i),d.target.add(i),d.staticMoving?I.copy(L):I.add(t.subVectors(L,I).multiplyScalar(d.dynamicDampingFactor))}}}(),this.checkDistances=function(){d.noZoom&&d.noPan||(y.lengthSq()>d.maxDistance*d.maxDistance&&(d.object.position.addVectors(d.target,y.setLength(d.maxDistance)),A.copy(C)),y.lengthSq()p&&(d.dispatchEvent(R),m.copy(d.object.position))},this.reset=function(){g=f.NONE,v=f.NONE,d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.up.copy(d.up0),y.subVectors(d.object.position,d.target),d.object.lookAt(d.target),d.dispatchEvent(R),m.copy(d.object.position)},this.dispose=function(){this.domElement.removeEventListener("contextmenu",l,!1),this.domElement.removeEventListener("mousedown",r,!1),this.domElement.removeEventListener("mousewheel",s,!1),this.domElement.removeEventListener("wheel",s,!1),this.domElement.removeEventListener("MozMousePixelScroll",s,!1),this.domElement.removeEventListener("touchstart",c,!1),this.domElement.removeEventListener("touchend",h,!1),this.domElement.removeEventListener("touchmove",u,!1),document.removeEventListener("mousemove",o,!1),document.removeEventListener("mouseup",a,!1),window.removeEventListener("keydown",i,!1),window.removeEventListener("keyup",n,!1)},this.domElement.addEventListener("contextmenu",l,!1),this.domElement.addEventListener("mousedown",r,!1),this.domElement.addEventListener("mousewheel",s,!1),this.domElement.addEventListener("wheel",s,!1),this.domElement.addEventListener("MozMousePixelScroll",s,!1),this.domElement.addEventListener("touchstart",c,!1),this.domElement.addEventListener("touchend",h,!1),this.domElement.addEventListener("touchmove",u,!1),window.addEventListener("keydown",i,!1),window.addEventListener("keyup",n,!1),this.handleResize(),this.update()}function rr(t){if(void 0===t)return"";var e=[];for(var i in t){var n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join("\n")+"\n"}function or(t,e){e=e||{};var i=t+"|";for(var n in e)i+=n+":"+e[n];if(!nv[i]){var r=rr(e),o=Qg.get("shader/"+t);if(!o)throw"empty shader, '"+t+"'";o=o.replace(iv,function(t,e){var i="shader/chunk/"+e+".glsl",n=Qg.get(i)||ep[e];return n?n:""}),nv[i]=r+o}return nv[i]}function ar(t,e,i,n){function r(e){var n=e%u,r=Math.floor(e/u),o=n*m,a=r*g;i.camera.setViewOffset(m*u,g*u,o,a,m,g),i.render(),h?v.drawImage(t.domElement,Math.floor(o/2),Math.floor(a/2),Math.ceil(m/2),Math.ceil(g/2)):v.drawImage(t.domElement,Math.floor(o),Math.floor(a),Math.ceil(m),Math.ceil(g)),"function"==typeof l&&l(e+1,f,!1)}function o(){i.setSampling(y),i.camera.view=null,"function"==typeof d&&d(f+1,f,!1)}function a(){for(var t=0;t<=f;++t)t===f?o():r(t)}function s(){function t(){e===f?o():r(e),e+=1}for(var e=0,i=0;i<=f;++i)setTimeout(t,0,i)}var c=n||{},u=void 0!==c.factor?c.factor:2,h=void 0!==c.antialias&&c.antialias,l=c.onProgress,d=c.onFinish;h&&(u*=2);var f=u*u,p=document.createElement("canvas"),m=i.width,g=i.height;h?(p.width=m*u/2,p.height=g*u/2):(p.width=m*u,p.height=g*u);var v=p.getContext("2d"),y=i.sampleLevel;i.setSampling(-1),this.render=a,this.renderAsync=s,this.canvas=p}function sr(t,e,i,n,r){i=i||1,n=n||0;var o,a,s,c=r?r.length:t.length/i,u=0,h=0;if(r)for(a=0;ae?1:t=u&&e(t[o],l)>0;)t[o+1]=t[o],--o;t[o+1]=l}if(c===-1)break;h=s[c--],u=s[c--]}else{var f=u+h>>1;for(o=u+1,a=h,r(f,o),e(t[u],t[h])>0&&r(u,h),e(t[o],t[h])>0&&r(o,h),e(t[u],t[o])>0&&r(u,o),l=t[o];;){do o++;while(e(t[o],l)<0);do a--;while(e(t[a],l)>0);if(a=a-u?(s[++c]=o,s[++c]=h,h=a-1):(s[++c]=u,s[++c]=a-1,u=o)}return t}function mr(t,e,i,n,r){var o,a,s,c,u=t.height,h=t.width,l=t.getContext("2d"),d=l.getImageData(0,0,h,u).data;for(s=!1,a=0;a=0;a--){for(o=h-1;o>=0;o--)if(c=4*(a*h+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var m=a;for(s=!1,o=h-1;o>=0;o--){for(a=u-1;a>=0;a--)if(c=4*(a*h+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var g=o,v=document.createElement("canvas");v.width=g-p,v.height=m-f;var y=v.getContext("2d");return y.drawImage(t,p,f,v.width,v.height,0,0,v.width,v.height),v}function gr(t,e){function i(e){var i=s;c&&(i*=2),e&&(i=1/i),t.scene.traverse(function(t){var e=t.material;e&&e.linewidth&&(e.linewidth*=i),e&&e.uniforms&&e.uniforms.size&&void 0===e.uniforms.size.__seen&&(e.uniforms.size.value*=i,e.uniforms.size.__seen=!0)}),t.scene.traverse(function(t){var e=t.material;e&&e.uniforms&&e.uniforms.size&&delete e.uniforms.size.__seen})}function n(t){if(a){var e=f,i=0|(u?0:255*e.r),n=0|(u?0:255*e.g),r=0|(u?0:255*e.b),o=0|(u?0:255);return mr(t,i,n,r,o)}return t}function r(t,e,i){"function"==typeof o.onProgress&&o.onProgress(t,e,i)}var o=e||{},a=void 0!==o.trim&&o.trim,s=void 0!==o.factor?o.factor:1,c=void 0!==o.antialias&&o.antialias,u=void 0!==o.transparent&&o.transparent,h=t.renderer,l=t.camera,d=h.getClearAlpha(),f=h.getClearColor();return new Promise(function(e){function o(o,s){var c=n(a.canvas);c.toBlob(function(n){h.setClearAlpha(d),i(!0),t.requestRender(),r(s,s,!0),e(n)},"image/png")}var a=new ar(h,l,t,{factor:s,antialias:c,onProgress:r,onFinish:o});h.setClearAlpha(u?0:1),i(),a.renderAsync()})}function vr(t,e){var i;t.traverseVisible(function(t){if(t instanceof Ne&&t.sortParticles){var n=t.geometry.attributes,r=n.position.count;if(0!==r){av.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),sv.multiplyMatrices(e.projectionMatrix,av);var o,a,s,c;for(t.userData.sortData?(o=t.userData.sortData,s=o.__zArray,a=o.__sortArray,c=o.__cmpFn):(s=new Float32Array(r),a=new Uint32Array(r),c=function(t,e){var i=s[t],n=s[e];return i>n?1:i500&&!Q&&K<3&&K!==-1){var i=K;K=3,Z=!0,B(),Q=!0,K=i,t.Debug&&Hg.log("rendered still frame")}var n=et;n.spinAxis&&n.spinAngle&&(Dt(n.spinAxis,n.spinAngle*it.lastDuration/16),I()),requestAnimationFrame(E)}function I(){Z||(performance.now()-it.startTime>22&&(it.begin(),Q=!1),Z=!0,requestAnimationFrame(function(){B(),it.update()}))}function L(){var t=et;J=Rt.copy(ot.position).sub(Ct.target).length(),J||(ot.position.set(0,0,t.cameraZ),J=Math.abs(t.cameraZ)),tt=Math.max(10,.5*Lt),tt+=Et.center(Rt).length(),(tt===1/0||tt===-(1/0)||isNaN(tt))&&(tt=50);var e=(50-t.clipNear)/50,i=-(50-t.clipFar)/50;ot.near=Math.max(.1,t.clipDist,J-tt*e), -ot.far=Math.max(1,J+tt*i);var n=(50-t.fogNear)/50,r=-(50-t.fogFar)/50,o=at.fog;o.color.set(t.fogColor),o.near=Math.max(.1,J-tt*n),o.far=Math.max(1,J+tt*r)}function R(){L();var t=fn(nt.fov),e=(ot.near+ot.far)/2,i=2*Math.tan(t/2)*e;rt.zoom=X/i}function O(){ot.updateMatrix(),ot.updateMatrixWorld(!0),ot.matrixWorldInverse.getInverse(ot.matrixWorld),ot.updateProjectionMatrix(),yr(at,ot,mt,J,tt),vr(at,ot)}function D(t,e,i,n){ht.visible=t,lt.visible=e,dt.visible=i,ft.visible=n}function N(){Rt.copy(ot.position).sub(Ct.target).setLength(10*Lt),st.position.copy(ot.position).add(Rt),st.color.set(et.lightColor),st.intensity=et.lightIntensity,ct.color.set(et.ambientColor),ct.intensity=et.ambientIntensity}function k(){mt.clearTarget(bt),D(!1,!0,!1,!1),mt.render(at,ot,bt),C(),mt.setRenderTarget(null)}function F(e){e?mt.clearTarget(e):mt.clear(),D(!1,!1,!0,!1),mt.render(at,ot,e),e?mt.clearTarget(e,!1,!0,!1):mt.clearDepth(),C(),D(!0,!1,!1,t.Debug),mt.render(at,ot,e),C()}function z(){var t=hv[Math.max(0,Math.min(K,5))],e=1/t.length,i=1/32;St.tForeground.value=_t.texture;for(var n=_t.width,r=_t.height,o=0;o0?z():F(),Y=!1,void(Z=!1))}function U(){Hg.log("scene cleared"),at.remove(ut),o(),mt.clear()}function j(t,e){if(void 0===e?Et.isEmpty()||kt(Et.center()):kt(e),t){var i;if(t===!0){var n=It,r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);i=r+Math.sqrt(o)}else i=t;var a=fn(nt.fov),s=W/X,c=Xr&&(r=u),h>o&&(o=h),l>a&&(a=l)}return[Tr([e,i,n]),Tr([r,o,a])]}function Mr(t,e){for(var i=0,n=e.length;ie?(e/=t,t*Math.sqrt(1+e*e)):e>0?(t/=e,e*Math.sqrt(1+t*t)):0}function Qr(t,e,i,n,r,o,a,s){for(var c=2*mv,u=gv,h=0,l=0,d=0,f=0,p=Math.max(o,30),m=0,g=0,v=0,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,P=0,C=0,T=0,E=0,I=0,L=0,R=4660,O=0,D=0,N=0,k=new Float64Array(a<<3);h>16&32767&256)?D:-D,t[h*e+d]=O;for(f=0;f<2;f++)for(l=0;l>o),f=Math.max(0,e-n-c>>o),p=Math.max(0,i-n-u>>o),y=Math.min(h,t+n-s>>o),x=Math.min(l,e+n-c>>o),_=Math.min(d,i+n-u>>o),w=[],S=a;S<=y;++S)for(var A=f;A<=x;++A)for(var P=p;P<=_;++P){var T=(S*l+A)*d+P,I=b[T];if(I>0)for(var L=I-1,R=C[L],O=M[L],D=R+O,N=R;N>o)+1,l=(a.max.y-c>>o)+1,d=(a.max.z-u>>o)+1,f=h*l*d,p=t.count,m=t.x,g=t.y,v=t.z,y=0,b=new Uint32Array(f),x=new Int32Array(p);for(n=0;n>o,w=g[n]-c>>o,S=v[n]-u>>o,A=(_*l+w)*d+S;1===(b[A]+=1)&&(y+=1),x[n]=A}var M=new Uint16Array(y);for(n=0,r=0;n0&&(b[n]=r+1,M[r]=P,r+=1)}var C=new Uint32Array(y);for(n=1;n0){var L=I-1;E[C[L]+T[L]]=n,T[L]+=1}}this.within=i}function ho(e,i){t.Debug&&Hg.time("BondHash init");var n,r=e.count,o=e.atomIndex1,a=e.atomIndex2,s=new Uint8Array(i),c=new Int32Array(i);for(n=0;ns&&(s=e);var a=o-r;if(0===a)return-1;var u=4*l;if(l+=1,1===a)return h[u]=r,h[u+1]=-1,h[u+2]=-1,h[u+3]=n,u;var f=r+Math.floor(a/2);d=e%3;for(var p,m,g,v,y,b=r,x=o-1;x>b;){for(g=b+x>>1,v=t[3*c[g]+d],m=c[g],c[g]=c[x],c[x]=m,y=b,p=b;pr&&s.pop()}var d,f,p=n(u)%3,m=3*c[h[u]],g=[t[m+0],t[m+1],t[m+2]],v=e(i,g),y=h[u+1],b=h[u+2];if(b===-1&&y===-1)return void((s.size()t[3*c[h[e]]+r])throw"left child is > parent!";n+=o(a,i+1)}if(s!==-1){if(t[3*c[h[s]]+r]0&&(e=":"+l(t).join(" OR :")),new dn(e)}function Mo(t){this.name=t||"",this.partList=[]}function Po(t,e){this.matrixList=t||[],this.chainList=e||[]}function Co(e,i){if(i){t.Debug&&Hg.time("assignSecondaryStructure");var n=[];e.eachModel(function(t){t.eachChain(function(t){n.push(t.chainname)})});var r=n.slice().sort(),o=[];r.forEach(function(t){o.push(n.indexOf(t))});var a=i.helices;a=a.filter(function(t){return ku(r,t[0])>=0}),a.sort(function(t,e){var i=t[0],n=e[0],a=t[1],s=e[1];if(i===n)return a===s?0:a=0}),c.sort(function(t,e){var i=t[0],n=e[0];if(i===n)return 0;var a=ku(r,i),s=ku(r,n);return o[a]=r;)e=Math.floor(e/r),o+=n[e%r],i+=1;return i>=5&&Hg.warn("chainname overflow"),o},h=e.getAtomProxy(),l=e.getAtomProxy(),d=0,f=0,p=0,m=0,g=[];1===s.count?g.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):e.eachResidueN(2,function(t,e){var i=!1,n=t.backboneType,r=e.backboneType,o=Rp;m=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:n!==o&&n===r&&(h.index=t.backboneEndAtomIndex,l.index=e.backboneStartAtomIndex,h.connectedTo(l)||(i=!0)),i||e.index!==s.count-1||(i=!0,m=e.index),i&&(g.push({mIndex:f,chainname:u(d),rStart:p,rCount:m-p+1}),d+=1,t.modelIndex!==e.modelIndex&&(d=0,f+=1),e.index===s.count-1&&g.push({mIndex:f,chainname:u(d),rStart:s.count-1,rCount:1}),p=e.index,m=e.index)}),a.count=0,g.forEach(function(t){c(t.mIndex,t.chainname,t.rStart,t.rCount)});var v=0;e.eachModel(function(t){o.chainOffset[t.index]=v,o.chainCount[t.index]-=1,v+=o.chainCount[t.index]})}t.Debug&&Hg.timeEnd("calculateChainnames")}function Eo(e){t.Debug&&Hg.time("calculateBonds"),Ro(e),Oo(e),t.Debug&&Hg.timeEnd("calculateBonds")}function Io(e){var i=e.structure,n=i.getAtomProxy(),r=i.getAtomProxy(),o=e.atomCount,a=e.atomOffset,s=a+o,c=s-1;if(o>500)return void(t.Debug&&Hg.warn("more than 500 atoms, skip residue for auto-bonding",e.qualifiedName()));var u,h,l=[],d=[],f=[];if(o>50){var p=new wo(e,!0),m=e.isCg()?1.2:2.3;for(u=a;u500)return void Hg.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),d=l.atomIndices1,f=l.atomIndices2,p=l.bondOrders,m=d.length,g=0;g1&&(c.x-=1),s.x<0&&(c.x+=1),s.y>1&&(c.y-=1),s.y<0&&(c.y+=1),s.z>1&&(c.z-=1),s.z<0&&(c.z+=1),t&&c.add(t),u.setPosition(c),u.multiplyMatrices(n.fracToCart,u),u.multiply(n.cartToFrac),e.push(u)}),e}if(e.unitcell){t.Debug&&Hg.time("buildUnitcellAssembly");var n=e.unitcell,r=e.center.clone().applyMatrix4(n.cartToFrac),o=So(n.spacegroup),a=new P,s=new P,c=new P;r.x>1&&(a.x-=1),r.x<0&&(a.x+=1),r.y>1&&(a.y-=1),r.y<0&&(a.y+=1),r.z>1&&(a.z-=1),r.z<0&&(a.z+=1);var u,h=new Mo("UNITCELL"),l=i();if(e.biomolDict.NCS){u=[new A].concat(e.biomolDict.NCS.partList[0].matrixList);var d=[];l.forEach(function(t){u.forEach(function(e){d.push(t.clone().multiply(e))})}),h.addPart(d)}else h.addPart(l);var f=new P,p=new Mo("SUPERCELL"),m=Array.prototype.concat.call(i(),i(f.set(1,1,1)),i(f.set(-1,-1,-1)),i(f.set(1,0,0)),i(f.set(1,1,0)),i(f.set(1,0,1)),i(f.set(0,1,0)),i(f.set(0,1,1)),i(f.set(0,0,1)),i(f.set(-1,0,0)),i(f.set(-1,-1,0)),i(f.set(-1,0,-1)),i(f.set(0,-1,0)),i(f.set(0,-1,-1)),i(f.set(0,0,-1)),i(f.set(1,-1,-1)),i(f.set(1,1,-1)),i(f.set(1,-1,1)),i(f.set(-1,1,1)),i(f.set(-1,-1,1)),i(f.set(-1,1,-1)),i(f.set(0,1,-1)),i(f.set(0,-1,1)),i(f.set(1,0,-1)),i(f.set(-1,0,1)),i(f.set(1,-1,0)),i(f.set(-1,1,0)));if(e.biomolDict.NCS){var g=[];m.forEach(function(t){u.forEach(function(e){g.push(t.clone().multiply(e))})}),p.addPart(g)}else p.addPart(m);e.biomolDict.UNITCELL=h,e.biomolDict.SUPERCELL=p,t.Debug&&Hg.timeEnd("buildUnitcellAssembly")}}function No(t){var e=t.bondHash,i=e.countArray,n=e.offsetArray,r=e.indexArray,o=t.getBondProxy();t.eachResidue(function(t){var e=t.residueType;if(void 0===e.bonds){var a=t.atomOffset,s=[],c=[],u=[],h={};t.eachAtom(function(t){for(var e=t.index,l=n[e],d=i[e],f=0,p=d;fg){var v=g;g=m,m=v}var y=m+"|"+g;void 0===h[y]&&(h[y]=!0,s.push(m-a),c.push(g-a),u.push(o.bondOrder))}}),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}})}function ko(t,e,i){this.structure=t,i=i||xv(e),this.atomname=e,this.element=i,this.vdw=Wp[i],this.covalent=qp[i]}function Fo(t){function e(t,e){return t+"|"+e}function i(i,n){n=n||xv(i);var a=e(i,n),s=r[a];if(void 0===s){var c=new ko(t,i,n);s=o.length,r[a]=s,o.push(c)}return s}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r,this.toJSON=function(){var t={metadata:{version:.1,type:"AtomMap",generator:"AtomMapExporter"},idDict:r,typeList:o.map(function(t){return t.toJSON()})};return t},this.fromJSON=function(e){r=e.idDict,o=e.typeList.map(function(e){return new ko(t,e.atomname,e.element)}),this.list=o,this.dict=r}}function zo(t,e,i,n,r,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=n?1:0,this.chemCompType=r,this.bonds=o,this.rings=void 0,this.atomCount=i.length,this.moleculeType=this.getMoleculeType(),this.backboneType=this.getBackboneType(0),this.backboneEndType=this.getBackboneType(-1),this.backboneStartType=this.getBackboneType(1),this.backboneIndexList=this.getBackboneIndexList();var a=cm[this.backboneType],s=cm[this.backboneStartType],c=cm[this.backboneEndType],u=this.getAtomIndexByName(a.trace);this.traceAtomIndex=void 0!==u?u:-1;var h=this.getAtomIndexByName(a.direction1);this.direction1AtomIndex=void 0!==h?h:-1;var l=this.getAtomIndexByName(a.direction2);this.direction2AtomIndex=void 0!==l?l:-1;var d=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==d?d:-1;var f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1;var p;p=im.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==p?p:-1,this.bondReferenceAtomIndices=[]}function Bo(t){function e(t,e,i,n){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(n?n:"")}function i(i,n,a,s,c){i=i.toUpperCase();var u=e(i,n,a,s),h=r[u];if(void 0===h){var l=new zo(t,i,n,a,s,c);h=o.length,r[u]=h,o.push(l)}return h}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r}function Uo(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new P,this._v13=new P,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()}function jo(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.bondHash=t.bondHash,this.index=e}function $o(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e}function Vo(t,e,i){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueIndexStart=e,this.residueIndexEnd=i,this.residueCount=i-e+1;var n=this.structure.getResidueProxy(this.residueIndexStart),r=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==n.getPreviousConnectedResidue();var o=r.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=r.connectedTo(n),this.__residueProxy=this.structure.getResidueProxy()}function Go(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function Ho(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function Wo(t,e){this.signals={refreshed:new ln},this.name=t,this.path=e,this.title="",this.id="",this.header={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.bondStore=new fo(0),this.backboneBondStore=new fo(0),this.rungBondStore=new fo(0),this.atomStore=new po(0),this.residueStore=new mo(0),this.chainStore=new go(0),this.modelStore=new vo(0),this.atomMap=new Fo(this),this.residueMap=new Bo(this),this.bondHash=void 0,this.spatialHash=void 0,this.atomSet=void 0,this.bondSet=void 0,this.center=void 0,this.boundingBox=void 0,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy()}function Xo(t,e,i){this.name=t,this.path=e,this.info={},this.center=new P,this.boundingBox=new xt,i instanceof Kt||i instanceof te||i instanceof ke?this.fromGeometry(i):i&&this.set(i.position,i.index,i.normal,i.color,i.atomindex)}function qo(e){var i=0,n=0,r={},o={},a=URL.createObjectURL(Xg.get(e)),s=new window.Worker(a);Xg.activeWorkerCount+=1,s.onmessage=function(n){i-=1;var a=n.data.__postId;t.Debug&&Hg.timeEnd("Worker.postMessage "+e+" #"+a),r[a]&&r[a].call(s,n),delete r[a],delete o[a]},s.onerror=function(t){if(i-=1,t.data){var n=t.data.__postId;o[n]?o[n].call(s,t):Hg.error("Worker.onerror",n,e,t),delete r[n],delete o[n]}else Hg.error("Worker.onerror",e,t)},this.name=e,this.post=function(a,c,u,h){r[n]=u,o[n]=h,a=a||{},a.__name=e,a.__postId=n,a.__debug=t.Debug,t.Debug&&Hg.time("Worker.postMessage "+e+" #"+n);try{s.postMessage(a,c)}catch(t){Hg.error("worker.post:",t),s.postMessage(a)}return i+=1,n+=1,this},this.terminate=function(){s?(s.terminate(),URL.revokeObjectURL(a),Xg.activeWorkerCount-=1):Hg.log("no worker to terminate")},Object.defineProperties(this,{postCount:{get:function(){return n}},pending:{get:function(){return i}}})}function Yo(t,e){e=Math.min(8,e||2);var i=[],n=0;this.name=t,this.maxCount=e,this.post=function(t,e,i,n){var r=this.getNextWorker();return r.post(t,e,i,n),this},this.terminate=function(){i.forEach(function(t){t.terminate()})},this.getNextWorker=function(){for(var r,o=1/0,a=0;a=n){r=new qo(t),i.push(r),n+=1;break}var s=i[a];if(0===s.pending){o=s.pending,r=s;break}s.pending=g){L=m,T=!0;break}if(T)break}if(T)break}for(T=!1,p=o;p=g){I=p,T=!0;break}if(T)break}if(T)break}for(T=!1,d=r;d=g){E=d,T=!0;break}if(T)break}if(T)break}for(T=!1,m=u;m>=a;--m){for(p=c;p>=o;--p){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){D=m,T=!0;break}if(T)break}if(T)break}for(T=!1,p=c;p>=o;--p){for(m=D;m>=a;--m){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){O=p,T=!0;break}if(T)break}if(T)break}for(T=!1,d=s;d>=r;--d){for(p=O;p>=o;--p){for(m=D;m>=a;--m)if(l=e*i*m+e*p+d,t[l]>=g){R=d,T=!0;break}if(T)break}if(T)break}for(v?(r=Math.max(0,E-1),o=Math.max(0,I-1),a=Math.max(0,L-1),s=Math.min(e-1,R+1),c=Math.min(i-1,O+1),u=Math.min(n-1,D+1)):(r=Math.max(1,E-1),o=Math.max(1,I-1),a=Math.max(1,L-1),s=Math.min(e-2,R+1),c=Math.min(i-2,O+1),u=Math.min(n-2,D+1)),m=a;m65535?Uint32Array:Uint16Array;return{position:new Float32Array(w),normal:v?void 0:new Float32Array(S),index:new a(A),atomindex:r?new Int32Array(M):void 0}}}function Jo(t,e,i,n){i=i||1,n=n||!0;var r,o=t.length/3,a=e.length/3;n&&(r=new Float32Array(3*o));var s,c=new Float32Array(3*o),u=20,h=new Array(u);for(s=0;s65535?Uint32Array:Uint16Array,a=new o(3*r),s=0;s65535?Uint32Array:Uint16Array;this.meshIndex=new u(c*o*3),this.makeIndex(),ha.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,a),this.initNormals=!0,this.setAttributes({position:t,color:e,pickingColor:i}),this.initNormals=!1}function ma(t,e,i,r,o){var a=o||{},s=n(a.sphereDetail,1);this.geo=new an(1,s),this._radius=i,pa.call(this,t,e,r,a)}function ga(t){this.size=this.count,this.attributeSize=this.count*this.mappingSize;var e=this.count*this.mappingIndicesSize,i=this.attributeSize>65535?Uint32Array:Uint16Array;this.index=new i(e),this.makeIndex(),ua.call(this,null,null,this.index,null,t),this.addAttributes({mapping:{type:this.mappingType,value:null}})}function va(t){this.mapping=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.mappingIndices=new Uint16Array([0,1,2,1,3,2]),this.mappingIndicesSize=6,this.mappingType="v2",this.mappingSize=4,this.mappingItemSize=2,ga.call(this,t)}function ya(t,e,i,n,r){this.impostor=!0,this.count=t.length/3,this.vertexShader="SphereImpostor.vert",this.fragmentShader="SphereImpostor.frag",va.call(this,r),this.addUniforms({projectionMatrixInverse:{value:new A},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes({position:t,color:e,radius:i}),n&&(this.addAttributes({pickingColor:{type:"c",value:null}}),this.setAttributes({pickingColor:n}),this.pickable=!0),this.makeMapping()}function ba(t,e,i,n,r){var o=r||{};return!Gg||o.disableImpostor?new ma(t,e,i,n,r):new ya(t,e,i,n,r)}function xa(t,e,i,r,o,a,s){var c=s||{},u=n(c.sphereDetail,2);this.updateNormals=!0,this.geo=new an(1,u),this._radius=i,this._majorAxis=r,this._minorAxis=o,pa.call(this,t,e,a,c)}function _a(t,e,i,n,r,o,a){return new xa(t,e,i,n,r,o,a)}function wa(t,e,i,r,o,a,s,c){var u=c||{},h=n(u.radialSegments,10),l=n(u.openEnded,!0);this.updateNormals=!0;var d=(new A).makeRotationX(Math.PI/2);this.geo=new nn(1,1,1,h,1,l),this.geo.applyMatrix(d);var f=t.length,p=o.length;this._position=new Float32Array(2*f),this._color=new Float32Array(2*f),this._pickingColor=new Float32Array(2*f),this._from=new Float32Array(2*f),this._to=new Float32Array(2*f),this._radius=new Float32Array(2*p),this.__center=new Float32Array(f),pa.call(this,this._position,this._color,this._pickingColor,u),this.setAttributes({position1:t,position2:e,color:i,color2:r,radius:o,pickingColor:a,pickingColor2:s})}function Sa(t){this.mapping=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),this.mappingIndices=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),this.mappingIndicesSize=12,this.mappingType="v3",this.mappingSize=6,this.mappingItemSize=3,ga.call(this,t)}function Aa(t,e,i,r,o,a,s,c){var u=c||{};this.openEnded=n(u.openEnded,!1),this.impostor=!0,this.count=t.length/3,this.vertexShader="CylinderImpostor.vert",this.fragmentShader="CylinderImpostor.frag",Sa.call(this,u);var h=new Wi(new A).onUpdate(function(t){this.value.getInverse(t.modelViewMatrix)});this.addUniforms({modelViewMatrixInverse:h,ortho:{value:0}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null}}),this.setAttributes({position1:t,position2:e,color:i,color2:r,radius:o}),a&&(this.addAttributes({pickingColor:{type:"c",value:null},pickingColor2:{type:"c",value:null}}),this.setAttributes({pickingColor:a,pickingColor2:s}),this.pickable=!0),this.makeMapping()}function Ma(t,e,i,n,r,o,a,s){var c=s||{};return!Gg||c.disableImpostor?new wa(t,e,i,n,r,o,a,s):new Aa(t,e,i,n,r,o,a,s)}function Pa(t,e,i,r,o,a){var s=a||{},c=n(s.radialSegments,60),u=n(s.openEnded,!1);this.updateNormals=!0;var h=(new A).makeRotationX(-Math.PI/2);this.geo=new cn(1,1,c,1,u),this.geo.applyMatrix(h);var l=t.length,d=r.length;this._position=new Float32Array(l),this._from=new Float32Array(l),this._to=new Float32Array(l),this._radius=new Float32Array(d),pa.call(this,this._position,i,o,s),this.setAttributes({position1:t,position2:e,color:i,radius:r,pickingColor:o})}function Ca(t,e,i,n,r,o){return new Pa(t,e,i,n,r,o)}function Ta(t,e,i,r,o,a){function s(t){var e,i,n={};if(t.radius){for(e=0,i=p.length;e65535?Uint32Array:Uint16Array;i=new r(i)}Array.isArray(n)&&(n=new Float32Array(n));var o=new ha(t,e,i,n);b.push(o)}function a(t,e,n){i(t,x),i(e,_),w.push(n)}function s(t,e,n,r,o){i(t,S),i(e,A),M.push(n),i(r,P),i(o,C)}function c(t,e,n,r){i(t,T),i(e,E),i(n,I),L.push(r)}function u(t,e,n,r){i(t,R),i(e,O),i(n,D),N.push(r)}function h(t,e,n,r){i(t,k),i(e,F),i(n,z),B.push(r)}function l(){var t=[];if(x.length){var e=new ba(new Float32Array(x),new Float32Array(_),new Float32Array(w),void 0,{sphereDetail:m,disableImpostor:v});t.push(e)}if(S.length){var i=new _a(new Float32Array(S),new Float32Array(A),new Float32Array(M),new Float32Array(P),new Float32Array(C),void 0,{sphereDetail:m,disableImpostor:v});t.push(i)}if(T.length){var n=new Ma(new Float32Array(T),new Float32Array(E),new Float32Array(I),new Float32Array(I),new Float32Array(L),void 0,void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(n)}if(R.length){var r=new Ca(new Float32Array(R),new Float32Array(O),new Float32Array(D),new Float32Array(N),void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(r)}if(k.length){var o=new Ta(new Float32Array(k),new Float32Array(F),new Float32Array(z),new Float32Array(B),void 0,{aspectRatio:p,radialSegments:g,disableImpostor:v,openEnded:y});t.push(o)}return b.concat(t)}function d(){b.forEach(function(t){t.dispose()}),b.length=0,x.length=0,_.length=0,w.length=0,S.length=0,A.length=0,M.length=0,P.length=0,C.length=0,T.length=0,E.length=0,I.length=0,L.length=0,R.length=0,O.length=0,D.length=0,N.length=0,k.length=0,F.length=0,z.length=0,B.length=0}this.name=n(t,"shape");var f=e||{},p=n(f.aspectRatio,1.5),m=n(f.sphereDetail,2),g=n(f.radialSegments,50),v=n(f.disableImpostor,!1),y=n(f.openEnded,!1),b=[],x=[],_=[],w=[],S=[],A=[],M=[],P=[],C=[],T=[],E=[],I=[],L=[],R=[],O=[],D=[],N=[],k=[],F=[],z=[],B=[];this.addBuffer=r,this.addMesh=o,this.addSphere=a,this.addEllipsoid=s,this.addCylinder=c,this.addCone=u,this.addArrow=h,this.getBufferList=l,this.dispose=d}function Ia(t,e,i){this.viewer=e,this.gidPool=i?i.gidPool:void 0,this.tasks=new tr,this.queue=new oa(function(t,e){this.make(t,e)}.bind(this)),this.bufferList=[],this.init(i)}function La(t,e,i){Array.isArray(t)||(t=[t]),Ia.call(this,t,e,i),this.buffer=t,this.build()}function Ra(){ha.apply(this,arguments)}function Oa(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.pickable=t.pickable,this.background=t.background,this.group=new ke,this.wireframeGroup=new ke,this.pickingGroup=new ke;var e=[],i=[],n=t,r=new t.constructor;n.makeMaterial(),r.makeMaterial(),r.geometry=t.geometry,r.wireframeGeometry=t.wireframeGeometry,r.size=t.size,r.attributeSize=t.attributeSize,r.pickable=t.pickable,r.setParameters(t.getParameters()),r.updateShader(),n.setParameters({side:"front"}),r.setParameters({side:"back",opacity:r.opacity}),this.getMesh=function(t){var o,a;return t?(a=r.getPickingMesh(),o=n.getPickingMesh()):(a=r.getMesh(),o=n.getMesh()),e.push(o),i.push(a),this.setParameters({side:this.side}),(new ke).add(a,o)},this.getWireframeMesh=function(){return t.getWireframeMesh()},this.getPickingMesh=function(){return this.getMesh(!0)},this.setAttributes=function(e){t.setAttributes(e)},this.setParameters=function(t){t=Object.assign({},t),"front"===t.side?(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!1})):"back"===t.side?(e.forEach(function(t){t.visible=!1}),i.forEach(function(t){t.visible=!0})):"double"===t.side&&(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){ -t.visible=!0})),void 0!==t.side&&(this.side=t.side),delete t.side,n.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,r.setParameters(t)},this.setVisibility=ua.prototype.setVisibility,this.dispose=function(){n.dispose(),r.dispose()}}function Da(t,e,i){Ia.call(this,t,e,i),t instanceof ra?(this.surface=void 0,this.volume=t):(this.surface=t,this.volume=void 0),this.boxCenter=new P,this.__boxCenter=new P,this.box=new xt,this.__box=new xt,this.setBox=function(){var t=new P;return function(){var i=e.controls.target,n=e.rotationGroup.position;t.copy(n).negate().add(i),t.equals(this.boxCenter)||this.setParameters({boxCenter:t})}.bind(this)}.bind(this)(),this.viewer.signals.orientationChanged.add(this.setBox),this.build()}function Na(t){function e(t,e,i){return Math.min(Math.max(t,e),i)}function i(t,e,i,n){var r=i-t,o=n-e;return Math.sqrt(r*r+o*o)}function r(t,i,n){return n=e((n-t)/(i-t),0,1),n*n*(3-2*n)}for(var o=Object.assign({},t),a=n(o.width,256),s=n(o.height,256),c=[a/2,s/2],u=Math.min(a/2,s/2),h=n(o.delta,1/(u+1))*u,l=0,d=0,f=new Uint8Array(a*s*4),p=0,m=f.length;p1&&(l=1),r(e,i,n,o,h,p),r(e,i,n,o,l,m),m.sub(p).normalize(),m.toArray(a,g)}}function s(e,i,n,r,o){for(var a,s=i.next(),c=i.next(),u=i.next(),h=i.size,l=h-1,d=r||0,f=0;f65535?Uint32Array:Uint16Array;this.meshIndex=new p(f),this.makeIndex(),ha.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,u),this.setAttributes({position:t,normal:e,binormal:i,tangent:r,color:o,size:a,pickingColor:s})}function ms(t,e,i){za.call(this,t,e,i)}function gs(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new wo(e)}function vs(t,e,i){e=e||3.5,i=i||40;for(var n=new dn("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),r=new dn("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new gs(o,a),c=s.within(e),u=c.bondStore,h=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new P,v=new P,y=function(t,e,n,r){var o,a;t.atomname===n?(o=t,a=e):(o=e,a=t),p.index=o.residueIndex;var s=p.getAtomIndexByName(r);return g.subVectors(s,o),v.subVectors(s,a),pn(g.angleTo(v))i&&c.bondSet.flip_unsafe(b)}else("OH"===h.atomname&&"TYR"===h.resname||"OH"===l.atomname&&"TYR"===l.resname)&&(y(h,l,"OH","CZ")||c.bondSet.flip_unsafe(b));return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function ys(t,e,i){e=e||3.5,i=i||40;for(var n=new dn("( PROTEIN and .N )"),r=new dn("( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new gs(o,a),c=s.within(e),u=c.bondStore,h=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new P,v=new P,y=0,b=u.count;yi&&c.bondSet.flip_unsafe(y)))}}return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function bs(t,e,i){za.call(this,t,e,i)}function xs(t){var e=Object.assign({},t);if(this.font=n(e.font,["sans-serif"]),this.size=n(e.size,36),this.style=n(e.style,"normal"),this.variant=n(e.variant,"normal"),this.weight=n(e.weight,"normal"),this.outline=n(e.outline,0),this.width=n(e.width,1024),this.height=n(e.height,1024),this.gamma=1,"undefined"!=typeof navigator){var i=navigator.userAgent;i.match(/Chrome/)&&i.match(/OS X/)&&(this.gamma=.5)}this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.build(),this.populate(),this.texture=new ze(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0}function _s(t,e,i,r,o){var a=o||{};a.forceTransparent=!0,this.fontFamily=n(a.fontFamily,"sans-serif"),this.fontStyle=n(a.fontStyle,"normal"),this.fontWeight=n(a.fontWeight,"bold"),this.fontSize=n(a.fontSize,48),this.sdf=n(a.sdf,"Chrome"===jg),this.xOffset=n(a.xOffset,0),this.yOffset=n(a.yOffset,0),this.zOffset=n(a.zOffset,.5),this.attachment=n(a.attachment,"bottom-left"),this.showBorder=n(a.showBorder,!1),this.borderColor=n(a.borderColor,"lightgrey"),this.borderWidth=n(a.borderWidth,.15),this.showBackground=n(a.showBackground,!1),this.backgroundColor=n(a.backgroundColor,"lightgrey"),this.backgroundMargin=n(a.backgroundMargin,.5),this.backgroundOpacity=n(a.backgroundOpacity,1);for(var s=t.length/3,c=0,u=0;ua?u[h]=-1:(o=Math.sqrt(a-r),u[h]=Math.floor(o)),++h;w[l]=c,_[l]=u}}function o(i){var n,r,o,a,s,c,u,h,l,d,f,m,b,S,P,T,E,I,L=3*i,O=i;n=Math.floor(.5+p*(t[L]+x[0])),r=Math.floor(.5+p*(t[L+1]+x[1])),o=Math.floor(.5+p*(t[L+2]+x[2]));var D,N=e[O],k=_[N],F=0,z=v*y,B=w[N];for(d=0;d=g||S>=v||P>=y)){var U=b*z+S*y+P;if(A)if(M[U]&R){if(M[U]&R){var j=C[U];j!==L&&(a=n+u-Math.floor(.5+p*(t[j]+x[0])),s=r+h-Math.floor(.5+p*(t[j+1]+x[1])),c=o+l-Math.floor(.5+p*(t[j+2]+x[2])),u*u+h*h+l*l=g||f>=v||m>=y)){var z=d*F+f*y+m;if(M[z]&O){if(A){var B=C[z];a=Math.floor(.5+p*(t[B]+x[0])),s=Math.floor(.5+p*(t[B+1]+x[1])),c=Math.floor(.5+p*(t[B+2]+x[2])),u*u+h*h+l*l-1&&a-1&&c-1&&s0);var p,b=m*m,x=new Uint16Array(3);for(t=0;t=b)||(M[r]|=D,A&&M[r]&O&&(o.toArray(t,e,i,x),p=x[0]*a+x[1]*y+x[2],C[r]=C[p])));console.timeEnd("EDTSurface fastdistancemap")}function l(t,e,i,n){var r,o,a,s,c,u,h,l,d,f,p,m,b=new Uint16Array(3),x=0;if(0===i)return x;var _=-1,w=-1,S=-1,A=v*y;for(h=0,d=i;h-1&&w-1&&S-1&&(p=_*A+y*w+S,M[p]&R&&!(M[p]&O)?(e.fromArray(_,w,S,b),s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,P[p]=f,M[p]|=O,M[p]|=D,n[x]=_,n[x+1]=w,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,f-1&&w-1&&S-1&&(p=_*A+y*w+S,M[p]&R&&!(M[p]&O)?(e.fromArray(_,w,S,b),s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,P[p]=f,M[p]|=O,M[p]|=D,n[x]=_,n[x+1]=w,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,f-1&&w-1&&S-1&&(p=_*A+y*w+S,M[p]&R&&!(M[p]&O)?(e.fromArray(_,w,S,b),s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,P[p]=f,M[p]|=O,M[p]|=D,n[x]=_,n[x+1]=w,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,fT&&(T=R)}this.neighbourListLength=27*T+1,this.withinRadii=function(r,o,a,c,d){for(var f=0,p=s(r,u),y=s(o,h),x=s(a,l),_=Math.max(0,p-1),w=Math.max(0,y-1),S=Math.max(0,x-1),C=Math.min(m,p+1),T=Math.min(g,y+1),E=Math.min(v,x+1),I=_;I<=C;++I)for(var L=I*b,R=w;R<=T;++R)for(var O=R*g,D=S;D<=E;++D)for(var N=L+O+D,k=A[N],F=k+M[N],z=k;zP&&(P=A[l]);a(),s(),c(),W=-1}function o(t,e,i){for(var n=0;n=0;){if(o!==n&&o!==r&&h(o,t,e,i))return W=o,o;o=j[++a]}return W=-1,-1}function h(e,i,n,r){var o=3*e,a=M[e],s=t[o]-i,c=t[o+1]-n,u=t[o+2]-r,h=s*s+c*c+u*u;return h=0;)t0&&s65535?Uint32Array:Uint16Array;this.meshIndex=new l(h),this.makeIndex(),ha.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,s),this.vertexShader="Ribbon.vert",this.fragmentShader="Mesh.frag",this.geometry.addAttribute("dir",new $t(new Float32Array(h),3)),this.geometry.addAttribute("size",new $t(new Float32Array(u),1)),this.setAttributes({position:t,normal:e,dir:i,color:n,size:r,pickingColor:o})}function $s(t,e,i){za.call(this,t,e,i),this.defaultScale.sstruc*=3}function Vs(t,e,i){this.helixbundleList=[],za.call(this,t,e,i)}function Gs(t,e,i){ms.call(this,t,e,i)}function Hs(t,e,i){za.call(this,t,e,i)}function Ws(t,e,i){var n=i||{};this.size=t.length/3,this.vertexShader="Line.vert",this.fragmentShader="Line.frag",this.line=!0;var r=this.size,o=r-1;this.attributeSize=2*o,this.linePosition=new Float32Array(3*o*2),this.lineColor=new Float32Array(3*o*2),ua.call(this,this.linePosition,this.lineColor,void 0,void 0,n),this.setAttributes({position:t,color:e})}function Xs(t,e,i){za.call(this,t,e,i)}function qs(t,e,i){ms.call(this,t,e,i)}function Ys(t,e,i){za.call(this,t,e,i)}function Zs(t,e){var i=e||{};this.streamer=t,this.name=n(i.name,""),this.path=n(i.path,"")}function Ks(t){function e(t){for(var e=l.atomCount[t],r=l.atomOffset[t],o=new Array(e),a=0;a0&&e(g-1),l.growIfFull(),l.resno[g]=_,void 0!==S&&(l.sstruc[g]=S.charCodeAt(0)),void 0!==A&&(l.inscode[g]=A.charCodeAt(0)),l.atomOffset[g]=m,l.atomCount[g]=0,l.count+=1,l.chainIndex[g]=v,d.residueCount[v]+=1),h.count+=1,h.residueIndex[m]=g,l.atomCount[g]+=1,r=t,o=b,a=x,s=_,c=A,u=w},this.finalize=function(){i=a,n=u,g>-1&&e(g)}}function Qs(t,e){var i=e||{};this.firstModelOnly=n(i.firstModelOnly,!1),this.asTrajectory=n(i.asTrajectory,!1),this.cAlphaOnly=n(i.cAlphaOnly,!1),Zs.call(this,t,i),this.structure=new Wo(this.name,this.path),this.structureBuilder=new Ks(this.structure)}function Js(t,e,i,n,r,o,a,s){this.a=t||1,this.b=e||1,this.c=i||1,this.alpha=n||90,this.beta=r||90,this.gamma=o||90,this.spacegroup=a||"P 1";var c=fn(this.alpha),u=fn(this.beta),h=fn(this.gamma),l=Math.cos(c),d=Math.cos(u),f=Math.cos(h),p=Math.sin(u),m=Math.sin(h);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-l*l-d*d-f*f+2*l*d*f),void 0===s){var g=this.a*this.b*m/this.volume,v=(d*f-l)/(p*m);this.fracToCart=(new A).set(this.a,0,0,0,this.b*f,this.b*m,0,0,this.c*d,-this.c*p*v,1/g,0,0,0,0,1).transpose(),this.cartToFrac=(new A).getInverse(this.fracToCart)}else this.cartToFrac=s,this.fracToCart=(new A).getInverse(this.cartToFrac)}function tc(t,e){Qs.call(this,t,e)}function ec(t,e){Qs.call(this,t,e)}function ic(t,e){Qs.call(this,t,e)}function nc(t){switch(t=t.toLowerCase()){case"polymer":return _p;case"non-polymer":return wp;case"macrolide":return Sp;case"water":return Ap;default:return xp}}function rc(t,e,i,n,r){this.structure=t,this.index=e,this.description=i||"",this.entityType=nc(n||""),this.chainIndexList=r||[],r.forEach(function(i){t.chainStore.entityIndex[i]=e})}function oc(t,e){Array.isArray(t[e])||Object.keys(t).forEach(function(e){t[e]=[t[e]]})}function ac(t){return"?"!==t}function sc(t,e,i){var n,r,o=e.atomStore,a=e.atomMap,s=t.chem_comp,c=t.chem_comp_atom,u=t.chem_comp_bond;s&&(s.name&&(e.title=s.name.trim().replace(Ev,"")),s.id&&(e.id=s.id.trim().replace(Ev,"")));var h={};if(c){var l,d,f,p;for(r=c.comp_id.length,n=0;n0){o=o.split("(");var c=s(o[0]),u=s(o[1]);Object.keys(c).forEach(function(t){Object.keys(u).forEach(function(e){var i=new A;i.multiplyMatrices(c[t],u[e]),n[t+"x"+e]=i})})}else n=s(o);var h=[];for(var l in n)h.push(n[l]);var d=t;/^(0|[1-9][0-9]*)$/.test(d)&&(d="BU"+d);for(var f=a.asym_id_list[e].split(","),p=0,m=f.length;pw){var S=_;_=w,w=S;var A=p;p=b,b=A}if(0!==_&&0!==w)for(var M=0;Mo&&++s;e=new Int32Array(s)}for(i=0,n=0;in){for(var r=[],o=0;o>>16&65535|0,a=0;0!==i;){a=i>2e3?2e3:i,i-=a;do r=r+e[n++]|0,o=o+r|0;while(--a);r%=65521,o%=65521}return r|o<<16|0}function au(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}function su(t,e,i,n){var r=kv,o=n+i;t^=-1;for(var a=n;a>>8^r[255&(t^e[a])];return t^-1}function cu(t,e){var i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v,y,b,x,_,w,S,A,M,P;i=t.state,n=t.next_in,M=t.input,r=n+(t.avail_in-5),o=t.next_out,P=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),c=i.dmax,u=i.wsize,h=i.whave,l=i.wnext,d=i.window,f=i.hold,p=i.bits,m=i.lencode,g=i.distcode,v=(1<>>24,f>>>=x,p-=x,x=b>>>16&255,0===x)P[o++]=65535&b;else{if(!(16&x)){if(0===(64&x)){b=m[(65535&b)+(f&(1<>>=x,p-=x),p<15&&(f+=M[n++]<>>24,f>>>=x,p-=x,x=b>>>16&255,!(16&x)){if(0===(64&x)){b=g[(65535&b)+(f&(1<c){t.msg="invalid distance too far back",i.mode=Fv;break t}if(f>>>=x,p-=x,x=o-a,w>x){if(x=w-x,x>h&&i.sane){t.msg="invalid distance too far back",i.mode=Fv;break t}if(S=0,A=d,0===l){if(S+=u-x,x<_){_-=x;do P[o++]=d[S++];while(--x);S=o-w,A=P}}else if(l2;)P[o++]=A[S++],P[o++]=A[S++],P[o++]=A[S++],_-=3;_&&(P[o++]=A[S++],_>1&&(P[o++]=A[S++]))}else{S=o-w;do P[o++]=P[S++],P[o++]=P[S++],P[o++]=P[S++],_-=3;while(_>2);_&&(P[o++]=P[S++],_>1&&(P[o++]=P[S++]))}break}}break}}while(n>3,n-=_,p-=_<<3,f&=(1<=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return r[o++]=20971520,r[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w0&&(t===$v||1!==_))return-1;for(L[1]=0,y=1;yUv||t===Gv&&P>jv)return 1;for(var D=0;;){D++,p=y-A,a[b]f?(m=R[O+a[b]],g=T[E+a[b]]):(m=96,g=0),c=1<>A)+u]=p<<24|m<<16|g|0;while(0!==u);for(c=1<>=1;if(0!==c?(C&=c-1,C+=c):C=0,b++,0===--I[y]){if(y===_)break;y=e[i+a[b]]}if(y>w&&(C&l)!==h){for(0===A&&(A=w),d+=x,S=y-A,M=1<Uv||t===Gv&&P>jv)return 1;h=C&l,r[h]=w<<24|S<<16|d-o|0}}return 0!==C&&(r[d+C]=y-A<<24|64<<16|0),s.bits=w,0}function hu(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function lu(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function du(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=uy,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(jy),e.distcode=e.distdyn=new Int32Array($y),e.sane=1,e.back=-1,ey):ry}function fu(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,du(t)):ry}function pu(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?ry:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,fu(t))):ry}function mu(t,e){var i,n;return t?(n=new lu,t.state=n,n.window=null,i=pu(t,e),i!==ey&&(t.state=null),i):ry}function gu(t){if(Vy){var e;for(Dv=new Int32Array(512),Nv=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(uu(Zv,t.lens,0,288,Dv,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;uu(Kv,t.lens,0,32,Nv,0,t.work,{bits:5}),Vy=!1}t.lencode=Dv,t.lenbits=9,t.distcode=Nv,t.distbits=5}function vu(t,e,i,n){var r,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(nu(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>n&&(r=n),nu(o.window,e,i-n,r,o.wnext),n-=r,n?(nu(o.window,e,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=su(i.check,C,2,0),u=0,h=0,i.mode=hy;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",i.mode=zy;break}if((15&u)!==cy){t.msg="unknown compression method",i.mode=zy;break}if(u>>>=4,h-=4,w=(15&u)+8,0===i.wbits)i.wbits=w;else if(w>i.wbits){t.msg="invalid window size",i.mode=zy;break}i.dmax=1<>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=su(i.check,C,2,0)),u=0,h=0,i.mode=ly;case ly:for(;h<32;){if(0===s)break t;s--,u+=n[o++]<>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=su(i.check,C,4,0)),u=0,h=0,i.mode=dy;case dy:for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=su(i.check,C,2,0)),u=0,h=0,i.mode=fy;case fy:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>>8&255,i.check=su(i.check,C,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=py;case py:if(1024&i.flags&&(f=i.length,f>s&&(f=s),f&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),nu(i.head.extra,n,o,f,w)),512&i.flags&&(i.check=su(i.check,n,f,o)),s-=f,o+=f,i.length-=f),i.length))break t;i.length=0,i.mode=my;case my:if(2048&i.flags){if(0===s)break t;f=0;do w=n[o+f++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w));while(w&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=xy;break;case yy:for(;h<32;){if(0===s)break t;s--,u+=n[o++]<>>=7&h,h-=7&h,i.mode=Ny;break}for(;h<3;){if(0===s)break t;s--,u+=n[o++]<>>=1,h-=1,3&u){case 0:i.mode=wy;break;case 1:if(gu(i),i.mode=Ty,e===ty){u>>>=2,h-=2;break t}break;case 2:i.mode=My;break;case 3:t.msg="invalid block type",i.mode=zy}u>>>=2,h-=2;break;case wy:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=n[o++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=zy;break}if(i.length=65535&u,u=0,h=0,i.mode=Sy,e===ty)break t;case Sy:i.mode=Ay;case Ay:if(f=i.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break t;nu(r,n,o,f,a),s-=f,o+=f,c-=f,a+=f,i.length-=f;break}i.mode=xy;break;case My:for(;h<14;){if(0===s)break t;s--,u+=n[o++]<>>=5,h-=5,i.ndist=(31&u)+1,u>>>=5,h-=5,i.ncode=(15&u)+4,u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=zy;break}i.have=0,i.mode=Py;case Py:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=uu(Yv,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=zy;break}i.have=0,i.mode=Cy;case Cy:for(;i.have>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=zy;break}w=i.lens[i.have-1],f=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h>>=g,h-=g,w=0,f=3+(7&u),u>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,w=0,f=11+(127&u),u>>>=7,h-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=zy;break}for(;f--;)i.lens[i.have++]=w}}if(i.mode===zy)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=zy;break}if(i.lenbits=9,A={bits:i.lenbits},S=uu(Zv,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=zy;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=uu(Kv,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=zy;break}if(i.mode=Ty,e===ty)break t;case Ty:i.mode=Ey;case Ey:if(s>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,cu(t,d),a=t.next_out,r=t.output,c=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,u=i.hold,h=i.bits,i.mode===xy&&(i.back=-1);break}for(i.back=0;P=i.lencode[u&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=Dy;break}if(32&v){i.back=-1,i.mode=xy;break}if(64&v){t.msg="invalid literal/length code",i.mode=zy;break}i.extra=15&v,i.mode=Iy;case Iy:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=Ly;case Ly:for(;P=i.distcode[u&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=zy;break}i.offset=y,i.extra=15&v,i.mode=Ry;case Ry:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=zy;break}i.mode=Oy;case Oy:if(0===c)break t;if(f=d-c,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=zy;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),m=i.window}else m=r,p=a-i.offset,f=i.length;f>c&&(f=c),c-=f,i.length-=f;do r[a++]=m[p++];while(--f);0===i.length&&(i.mode=Ey);break;case Dy:if(0===c)break t;r[a++]=i.length,c--,i.mode=Ey;break;case Ny:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=n[o++]<>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}function Su(t,e){if(e<65537&&(t.subarray&&Hy||!t.subarray&&Gy))return String.fromCharCode.apply(null,iu(t,e));for(var i="",n=0;n4)s[n++]=65533,i+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&i1?s[n++]=65533:r<65536?s[n++]=r:(r-=65536,s[n++]=55296|r>>10&1023,s[n++]=56320|1023&r)}return Su(s,n)}function Pu(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128===(192&t[i]);)i--;return i<0?e:0===i?e:i+Wy[t[i]]>e?i:e}function Cu(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Tu(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function Eu(t){if(!(this instanceof Eu))return new Eu(t);this.options=eu({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Cu,this.strm.avail_out=0;var i=mu(this.strm,e.windowBits);if(i!==Ky)throw new Error(eb[i]);this.header=new Tu,xu(this.strm,this.header)}function Iu(t,e){var i=new Eu(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}function Lu(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=Iu(t)}catch(i){e=t}return e}function Ru(){this.getUrl=function(t){var e,i=u(t),n=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||i.compressed!==!1&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?ab+n:ob+n:i.ext?(Hg.warn("unsupported ext",i.ext),e=ob+n):e=ob+n:e=nb+i.path,r()+e},this.getExt=function(t){var e=u(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}}function Ou(){this.getUrl=function(t){var e,i=u(t),n=i.name;return i.ext&&"sdf"!==i.ext?(Hg.warn("unsupported ext",i.ext),e=sb+n+cb):e=sb+n+cb,r()+e},this.getExt=function(t){var e=u(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}function Du(){this.getUrl=function(t){return t}}function Nu(t){t=t||"",this.getUrl=function(e){var i=u(e);return a(t+i.path)}}var ku=function(){function t(t,e){return te?1:0}return function(e,i,n){var r=0,o=e.length-1;for(n||(n=t);r<=o;){var a=r+o>>1,s=n(i,e[a]);if(s>0)r=a+1;else{if(!(s<0))return a;o=a-1}}return-r-1}}();void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*ql.DEG2RAD},radToDeg:function(t){return t*ql.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}};_.prototype={constructor:_,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new _,e=new _),t.set(i,i),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}},w.DEFAULT_IMAGE=void 0,w.DEFAULT_MAPPING=kh,w.prototype={constructor:w,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=ql.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:e(n)}),i.image=n.uuid}return t.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===kh){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case Gh:t.x=t.x-Math.floor(t.x);break;case Hh:t.x=t.x<0?0:1;break;case Wh:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Gh:t.y=t.y-Math.floor(t.y);break;case Hh:t.y=t.y<0?0:1;break;case Wh:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(w.prototype,x.prototype);var Yl=0;A.prototype={constructor:A,isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,c,u,h,l,d,f,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=h,g[14]=l,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new A).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new P);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*a,i[9]=n[9]*a,i[10]=n[10]*a,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),c=Math.sin(n),u=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){var l=o*u,d=o*h,f=a*u,p=a*h;e[0]=s*u,e[4]=-s*h,e[8]=c,e[1]=d+f*c,e[5]=l-p*c,e[9]=-a*s,e[2]=p-l*c,e[6]=f+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var l=o*u,d=o*h,f=a*u,p=a*h;e[0]=s*u,e[4]=f*c-d,e[8]=l*c+p,e[1]=s*h,e[5]=p*c+l,e[9]=d*c-f,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=w-b*h,e[8]=_*h+x,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=x*h+_,e[10]=b-w*h}else if("XZY"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=-h,e[8]=c*u,e[1]=b*h+w,e[5]=o*u,e[9]=x*h-_,e[2]=_*h-x,e[6]=a*u,e[10]=w*h+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z,o=t.w,a=i+i,s=n+n,c=r+r,u=i*a,h=i*s,l=i*c,d=n*s,f=n*c,p=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+p),e[4]=h-v,e[8]=l+g,e[1]=h+v,e[5]=1-(u+p),e[9]=f-m,e[2]=l-g,e[6]=f+m,e[10]=1-(u+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,i;return function(n,r,o){void 0===t&&(t=new P,e=new P,i=new P);var a=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(o,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(o,i).normalize()),e.crossVectors(i,t),a[0]=t.x,a[4]=e.x,a[8]=i.x,a[1]=t.y,a[5]=e.y,a[9]=i.y,a[2]=t.z,a[6]=e.z,a[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],u=i[1],h=i[5],l=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],b=i[11],x=i[15],_=n[0],w=n[4],S=n[8],A=n[12],M=n[1],P=n[5],C=n[9],T=n[13],E=n[2],I=n[6],L=n[10],R=n[14],O=n[3],D=n[7],N=n[11],k=n[15];return r[0]=o*_+a*M+s*E+c*O,r[4]=o*w+a*P+s*I+c*D,r[8]=o*S+a*C+s*L+c*N,r[12]=o*A+a*T+s*R+c*k,r[1]=u*_+h*M+l*E+d*O,r[5]=u*w+h*P+l*I+d*D,r[9]=u*S+h*C+l*L+d*N,r[13]=u*A+h*T+l*R+d*k,r[2]=f*_+p*M+m*E+g*O,r[6]=f*w+p*P+m*I+g*D,r[10]=f*S+p*C+m*L+g*N,r[14]=f*A+p*T+m*R+g*k,r[3]=v*_+y*M+b*E+x*O,r[7]=v*w+y*P+b*I+x*D,r[11]=v*S+y*C+b*L+x*N,r[15]=v*A+y*T+b*R+x*k,this},multiplyToArray:function(t,e,i){var n=this.elements;return this.multiplyMatrices(t,e),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new P),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-u)*e,this._z=(a-r)*e):n>s&&n>l?(e=2*Math.sqrt(1+n-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+u)/e):s>l?(e=2*Math.sqrt(1+s-n-l),this._w=(o-u)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-n-s),this._w=(a-r)/e,this._x=(o+u)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,i=1e-6;return function(n,r){return void 0===t&&(t=new P),e=n.dot(r)+1,eMath.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=i*u+o*a+n*c-r*s,this._y=n*u+o*s+r*a-i*c,this._z=r*u+o*c+i*s-n*a,this._w=o*u-i*a-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=o*u+this._w*h,this._x=i*u+this._x*h,this._y=n*u+this._y*h,this._z=r*u+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(M,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,o,a){var s=i[n+0],c=i[n+1],u=i[n+2],h=i[n+3],l=r[o+0],d=r[o+1],f=r[o+2],p=r[o+3];if(h!==p||s!==l||c!==d||u!==f){var m=1-a,g=s*l+c*d+u*f+h*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*v;if(s=s*m+l*_,c=c*m+d*_,u=u*m+f*_,h=h*m+p*_,m===1-a){var w=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=w,c*=w,u*=w,h*=w}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),P.prototype={constructor:P,isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new M),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new M),this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*n-a*i,u=s*i+a*e-r*n,h=s*n+r*i-o*e,l=-r*e-o*i-a*n;return this.x=c*s+l*-r+u*-a-h*-o,this.y=u*s+l*-o+h*-r-c*-a,this.z=h*s+l*-a+c*-o-u*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new A),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new A),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}, -divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new P,e=new P),t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new P),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new P),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(ql.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=t;t=e,e=i}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},T.prototype={constructor:T,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var i=e||new _;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){var i=e||new _;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new _;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},I.prototype=Object.create(w.prototype),I.prototype.constructor=I,I.prototype.isCubeTexture=!0,Object.defineProperty(I.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Zl=new w,Kl=new I,Ql=[],Jl=[];st.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var o=i[n];o.setValue(t,e[o.id])}};var td=/([\w\d_]+)(\])?(\[|\.)?/g;ht.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},ht.prototype.set=function(t,e,i){var n=this.map[i];void 0!==n&&n.setValue(t,e[i],this.renderer)},ht.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},ht.upload=function(t,e,i,n){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=i[a.id];s.needsUpdate!==!1&&a.setValue(t,s.value,n)}},ht.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var o=t[n];o.id in e&&i.push(o)}return i},ht.splitDynamic=function(t,e){for(var i=null,n=t.length,r=0,o=0;o!==n;++o){var a=t[o],s=e[a.id];s&&s.dynamic===!0?(null===i&&(i=[]),i.push(a)):(ry&&v>b?vb?y0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=e(t.textures),o=e(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(mt.prototype,x.prototype);var ed=0,id={merge:function(t){for(var e={},i=0;i>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=ql.euclideanModulo(e,1),i=ql.clamp(i,0,1),n=ql.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,o=2*n-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=i[1],h=u.length;if(3===h)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=ip[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),u=(c+s)/2;if(c===s)e=0,i=0;else{var h=s-c;switch(i=u<=.5?h/(s+c):h/(2-s-c),s){case r:e=(o-a)/h+(or&&(r=u),h>o&&(o=h),l>a&&(a=l)}this.min.set(e,i,n),this.max.set(r,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var i=e||new P;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new P),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){var i=e||new P;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new P;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new P;return function(e){var i=e||new _t;return i.center=this.center(),i.radius=.5*this.size(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new P,new P,new P,new P,new P,new P,new P,new P];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},_t.prototype={constructor:_t,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new xt;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).center(n);for(var r=0,o=0,a=e.length;othis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new xt;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},wt.prototype={constructor:wt,isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=r,u[5]=s,u[6]=i,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new P),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r1))return n.copy(r).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new P;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new P,e=new wt;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),o=n||e.getNormalMatrix(i),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},At.prototype={constructor:At,set:function(t,e,i,n,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],c=i[5],u=i[6],h=i[7],l=i[8],d=i[9],f=i[10],p=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(a-n,h-s,p-l,y-m).normalize(),e[1].setComponents(a+n,h+s,p+l,y+m).normalize(),e[2].setComponents(a+r,h+c,p+d,y+g).normalize(),e[3].setComponents(a-r,h-c,p-d,y-g).normalize(),e[4].setComponents(a-o,h-u,p-f,y-v).normalize(),e[5].setComponents(a+o,h+u,p+f,y+v).normalize(),this},intersectsObject:function(){var t=new _t;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new _t;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var o=e[r].distanceToPoint(i);if(o0?i.min.x:i.max.x,e.x=o.normal.x>0?i.max.x:i.min.x,t.y=o.normal.y>0?i.min.y:i.max.y,e.y=o.normal.y>0?i.max.y:i.min.y,t.z=o.normal.z>0?i.min.z:i.max.z,e.z=o.normal.z>0?i.max.z:i.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}};var op=0;$t.prototype={constructor:$t,isBufferAttribute:!0,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var o=0;o0&&(n.geometries=a),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),u.length>0&&(n.images=u)}return n.object=r,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var i=0;i0)for(var f=0;f0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new xt),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new _t),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0];void 0===i&&(i=0),void 0!==e&&(n=(new wt).getNormalMatrix(e));for(var l=0,d=a.length;l=0;i--){var g=f[i];for(this.faces.splice(g,1),a=0,s=this.faceVertexUvs.length;a0,w=v.vertexNormals.length>0,S=1!==v.color.r||1!==v.color.g||1!==v.color.b,A=v.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,y),M=t(M,2,b),M=t(M,3,x),M=t(M,4,_),M=t(M,5,w),M=t(M,6,S),M=t(M,7,A),h.push(M),h.push(v.a,v.b,v.c),h.push(v.materialIndex),x){var P=this.faceVertexUvs[0][c];h.push(n(P[0]),n(P[1]),n(P[2]))}if(_&&h.push(e(v.normal)),w){var C=v.vertexNormals;h.push(e(C[0]),e(C[1]),e(C[2]))}if(S&&h.push(i(v.color)),A){var T=v.vertexColors;h.push(i(T[0]),i(T[1]),i(T[2]))}}return r.data={},r.data.vertices=s,r.data.normals=l,f.length>0&&(r.data.colors=f),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new Kt).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,i=0,n=e.length;i0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var u=0;u0){h=[];for(var u=0;u0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new $t(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new $t(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new $t(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new $t(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=t.vertices.length>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new $t(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],l=0,d=h.length;l0){var m=new Ht(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new Ht(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new xt);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new xt,e=new P;return function(){null===this.boundingSphere&&(this.boundingSphere=new _t);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.center(r);for(var o=0,a=0,s=n.length;a0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new te).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var o=t.groups,a=0,s=o.length;a0)if(s=d*p-f,c=d*f-p,h=l*g,s>=0)if(c>=-h)if(c<=h){var v=1/g;s*=v,c*=v,u=s*(s+d*c+2*f)+c*(d*s+c+2*p)+m}else c=l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;else c=-l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;else c<=-h?(s=Math.max(0,-(-d*l+f)),c=s>0?-l:Math.min(Math.max(-l,-p),l),u=-s*s+c*(c+2*p)+m):c<=h?(s=0,c=Math.min(Math.max(-l,-p),l),u=c*(c+2*p)+m):(s=Math.max(0,-(d*l+f)),c=s>0?l:Math.min(Math.max(-l,-p),l),u=-s*s+c*(c+2*p)+m);else c=d>0?-l:l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new P;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=n-a,c=n+a;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var i=t.normal.dot(this.direction);return i*e<0},intersectBox:function(t,e){var i,n,r,o,a,s,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,l=this.origin;return c>=0?(i=(t.min.x-l.x)*c,n=(t.max.x-l.x)*c):(i=(t.max.x-l.x)*c,n=(t.min.x-l.x)*c),u>=0?(r=(t.min.y-l.y)*u,o=(t.max.y-l.y)*u):(r=(t.max.y-l.y)*u,o=(t.min.y-l.y)*u),i>o||r>n?null:((r>i||i!==i)&&(i=r),(o=0?(a=(t.min.z-l.z)*h,s=(t.max.z-l.z)*h):(a=(t.max.z-l.z)*h,s=(t.min.z-l.z)*h),i>s||a>n?null:((a>i||i!==i)&&(i=a),(s=0?i:n,e)))},intersectsBox:function(){var t=new P;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new P,e=new P,i=new P,n=new P;return function(r,o,a,s,c){e.subVectors(o,r),i.subVectors(a,r),n.crossVectors(e,i);var u,h=this.direction.dot(n);if(h>0){if(s)return null;u=1}else{if(!(h<0))return null;u=-1,h=-h}t.subVectors(this.origin,r);var l=u*this.direction.dot(i.crossVectors(t,i));if(l<0)return null; -var d=u*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>h)return null;var f=-u*t.dot(n);return f<0?null:this.at(f/h,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},le.prototype={constructor:le,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new P;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new P;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new P;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new P,e=new P;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),a=o/r;return n&&(a=ql.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new P;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},de.normal=function(){var t=new P;return function(e,i,n,r){var o=r||new P;o.subVectors(n,i),t.subVectors(e,i),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),de.barycoordFromPoint=function(){var t=new P,e=new P,i=new P;return function(n,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),i.subVectors(n,r);var c=t.dot(t),u=t.dot(e),h=t.dot(i),l=e.dot(e),d=e.dot(i),f=c*l-u*u,p=s||new P;if(0===f)return p.set(-2,-1,-1);var m=1/f,g=(l*h-u*d)*m,v=(c*d-u*h)*m;return p.set(1-g-v,v,g)}}(),de.containsPoint=function(){var t=new P;return function(e,i,n,r){var o=de.barycoordFromPoint(e,i,n,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),de.prototype={constructor:de,set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new P,e=new P;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new P;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return de.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new St;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return de.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return de.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,o){void 0===t&&(t=new St,e=[new le,new le,new le],i=new P,n=new P);var a=o||new P,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)a.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;te.far?null:{distance:u,point:v.clone(),object:t}}function i(i,n,r,o,u,h,l,m){a.fromArray(o,3*h),s.fromArray(o,3*l),c.fromArray(o,3*m);var v=e(i,n,r,a,s,c,g);return v&&(u&&(d.fromArray(u,2*h),f.fromArray(u,2*l),p.fromArray(u,2*m),v.uv=t(g,a,s,c,d,f,p)),v.face=new Wt(h,l,m,de.normal(a,s,c)),v.faceIndex=h),v}var n=new A,r=new he,o=new _t,a=new P,s=new P,c=new P,u=new P,h=new P,l=new P,d=new _,f=new _,p=new _,m=new P,g=new P,v=new P;return function(m,v){var y=this.geometry,b=this.material,x=this.matrixWorld;if(void 0!==b&&(null===y.boundingSphere&&y.computeBoundingSphere(),o.copy(y.boundingSphere),o.applyMatrix4(x),m.ray.intersectsSphere(o)!==!1&&(n.getInverse(x),r.copy(m.ray).applyMatrix4(n),null===y.boundingBox||r.intersectsBox(y.boundingBox)!==!1))){var _,w;if(y&&y.isBufferGeometry){var S,A,M,P=y.index,C=y.attributes,T=C.position.array;if(void 0!==C.uv&&(_=C.uv.array),null!==P)for(var E=P.array,I=0,L=E.length;I0&&(_=B);for(var U=0,j=z.length;Ur||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),Pe.prototype=Object.assign(Object.create(Yt.prototype),{constructor:Pe,copy:function(t){Yt.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var o=1,a=n.length;o=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;oa)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,b=g.length/3-1;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var A=s.vertices,M=A.length,y=0;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Oe.prototype=Object.assign(Object.create(Re.prototype),{constructor:Oe,isLineSegments:!0}),De.prototype=Object.create(mt.prototype),De.prototype.constructor=De,De.prototype.isPointsMaterial=!0,De.prototype.copy=function(t){return mt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ne.prototype=Object.assign(Object.create(Yt.prototype),{constructor:Ne,isPoints:!0,raycast:function(){var t=new A,e=new he,i=new _t;return function(n,r){function o(t,i){var o=e.distanceSqToPoint(t);if(on.far)return;r.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:i,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,u=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,d=new P;if(s&&s.isBufferGeometry){var f=s.index,p=s.attributes,m=p.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length;v0||0===t.search(/^data\:image\/jpeg/);r.format=n?dl:fl,r.image=i,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),We.prototype=Object.assign(Object.create(Yt.prototype),{constructor:We,isLight:!0,copy:function(t){return Yt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=Yt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Xe.prototype=Object.assign(Object.create(We.prototype),{constructor:Xe,isHemisphereLight:!0,copy:function(t){return We.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(qe.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Ye.prototype=Object.assign(Object.create(qe.prototype),{constructor:Ye,isSpotLightShadow:!0,update:function(t){var e=2*ql.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||500,r=this.camera;e===r.fov&&i===r.aspect&&n===r.far||(r.fov=e,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),Ze.prototype=Object.assign(Object.create(We.prototype),{constructor:Ze,isSpotLight:!0,copy:function(t){return We.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Ke.prototype=Object.assign(Object.create(We.prototype),{constructor:Ke,isPointLight:!0,copy:function(t){return We.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Qe.prototype=Object.assign(Object.create(qe.prototype),{constructor:Qe}),Je.prototype=Object.assign(Object.create(We.prototype),{constructor:Je,isDirectionalLight:!0,copy:function(t){return We.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ti.prototype=Object.assign(Object.create(We.prototype),{constructor:ti,isAmbientLight:!0});var hp={arraySlice:function(t,e,i){return hp.isTypedArray(t)?new t.constructor(t.subarray(e,i)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a)){do a=o[n],void 0!==a&&(e.push(o.time),i.push.apply(i,a)),o=t[r++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[n],void 0!==a&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++];while(void 0!==o)}else do a=o[n],void 0!==a&&(e.push(o.time),i.push(a)),o=t[r++];while(void 0!==o)}}};ei.prototype={constructor:ei,evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var o;i:{n:if(!(t=r)break t;var s=e[1];t=r)break e}o=i,i=0}}for(;i>>1;te;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=hp.arraySlice(i,r,o),this.values=hp.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==n&&hp.isTypedArray(n))for(var a=0,c=n.length;a!==c;++a){var u=n[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=1,r=1,o=t.length-1;r<=o;++r){var a=!1,s=t[r],c=t[r+1];if(s!==c&&(1!==r||s!==s[0]))for(var u=r*i,h=u-i,l=u+i,d=0;d!==i;++d){var f=e[u+d];if(f!==e[h+d]||f!==e[l+d]){a=!0;break}}if(a){if(r!==n){t[n]=t[r];for(var p=r*i,m=n*i,d=0;d!==i;++d)e[m+d]=e[p+d]}++n}}return n!==t.length&&(this.times=hp.arraySlice(t,0,n),this.values=hp.arraySlice(e,0,n*i)),this}},ai.prototype=Object.assign(Object.create(lp),{constructor:ai,ValueTypeName:"vector"}),si.prototype=Object.assign(Object.create(ei.prototype),{constructor:si,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(i-e)/(n-e),u=s+a;s!==u;s+=4)M.slerpFlat(r,0,o,s-a,o,s,c);return r}}),ci.prototype=Object.assign(Object.create(lp),{constructor:ci,ValueTypeName:"quaternion",DefaultInterpolation:Ll,InterpolantFactoryMethodLinear:function(t){return new si(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),ui.prototype=Object.assign(Object.create(lp),{constructor:ui,ValueTypeName:"number"}),hi.prototype=Object.assign(Object.create(lp),{constructor:hi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Il,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),li.prototype=Object.assign(Object.create(lp),{constructor:li,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Il,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),di.prototype=Object.assign(Object.create(lp),{constructor:di,ValueTypeName:"color"}),fi.prototype=lp,lp.constructor=fi,Object.assign(fi,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=fi._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];hp.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:hp.convertArray(t.times,Array),values:hp.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ui;case"vector":case"vector2":case"vector3":case"vector4":return ai;case"color":return di;case"quaternion":return ci;case"bool":case"boolean":return li;case"string":return hi}throw new Error("Unsupported typeName: "+t)}}),pi.prototype={constructor:pi,resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t1){var u=c[1],h=n[u];h||(n[u]=h=[]),h.push(s)}}var l=[];for(var u in n)l.push(pi.CreateFromMorphTargetSequence(u,n[u],e,i));return l},parseAnimation:function(t,e,i){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,i,n,r){if(0!==i.length){var o=[],a=[];hp.flattenJSON(i,o,a,n),0!==o.length&&r.push(new t(e,o,a))}},r=[],o=t.name||"default",a=t.length||-1,s=t.fps||30,c=t.hierarchy||[],u=0;u1?t.skinWeights[i+1]:0,s=e>2?t.skinWeights[i+2]:0,c=e>3?t.skinWeights[i+3]:0;a.skinWeights.push(new dt(r,o,s,c))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i1?t.skinIndices[i+1]:0,l=e>2?t.skinIndices[i+2]:0,d=e>3?t.skinIndices[i+3]:0;a.skinIndices.push(new dt(u,h,l,d))}a.bones=t.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&console.warn("When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match.")}function r(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=a.faces,l=t.morphColors[0].colors,i=0,n=h.length;i0&&(a.animations=e)}var a=new Kt,s=void 0!==t.scale?1/t.scale:1;if(i(s),n(),r(s),o(),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:a};var c=vi.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:a,materials:c}}}),Object.assign(bi.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,o=new Ue(r.manager);o.load(t,function(t){r.parse(JSON.parse(t),e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,n),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,i,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new yi,n=new gi,r=0,o=t.length;r0){var o=new Be(e),a=new Ve(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s0?new Ie(s,c):new pe(s,c);break;case"LOD":a=new Pe;break;case"Line":a=new Re(r(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new Oe(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new Ne(r(e.geometry),o(e.material));break;case"Sprite":a=new Me(o(e.material));break;case"Group":a=new ke;break;default:a=new Yt}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var u in e.children)a.add(this.parseObject(e.children[u],i,n));if("LOD"===e.type)for(var h=e.levels,l=0;l(u-s)*(d-c)-(h-c)*(l-s))return!1;var m,g,v,y,b,x,_,w,S,A,M,P,C,T,E;for(m=l-u,g=d-h,v=s-l,y=c-d,b=u-s,x=h-c,a=0;a=-Number.EPSILON&&T>=-Number.EPSILON&&C>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,o,a,s=[],c=[],u=[];if(dp.area(e)>0)for(o=0;o2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?u:s;if(r=o,h<=r&&(r=0),o=r+1,h<=o&&(o=0),a=o+1,h<=a&&(a=0),t(e,r,o,a,h,c)){var d,f,p,m,g;for(d=c[r],f=c[o],p=c[a],s.push([e[d],e[f],e[p]]),u.push([c[r],c[o],c[a]]),m=o,g=o+1;g2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.xNumber.EPSILON){var p;if(d>0){if(f<0||f>d)return[];if(p=u*h-c*l,p<0||p>d)return[]}else{if(f>0||f0||pM?[]:x===M?o?[]:[y]:_<=M?[y,b]:[y,S]}function o(t,e,i,n){var r=e.x-t.x,o=e.y-t.y,a=i.x-t.x,s=i.y-t.y,c=n.x-t.x,u=n.y-t.y,h=r*s-o*a,l=r*u-o*c;if(Math.abs(h)>Number.EPSILON){var d=c*s-u*a;return h>0?l>=0&&d>=0:l>=0||d>=0}return l>0}function a(t,e){function i(t,e){var i=y.length-1,n=t-1;n<0&&(n=i);var r=t+1;r>i&&(r=0);var a=o(y[t],y[n],y[r],s[e]);if(!a)return!1;var c=s.length-1,u=e-1;u<0&&(u=c);var h=e+1;return h>c&&(h=0),a=o(s[e],s[u],s[h],y[t]),!!a}function n(t,e){var i,n,o;for(i=0;i0)return!0;return!1}function a(t,i){var n,o,a,s,c;for(n=0;n0)return!0;return!1}for(var s,c,u,h,l,d,f,p,m,g,v,y=t.concat(),b=[],x=[],_=0,w=e.length;_0;){if(A--,A<0){console.log("Infinite Loop! Holes left:"+b.length+", Probably Hole outside Shape!");break}for(u=S;u=0)break;x[f]=!0}if(c>=0)break}}return y}i(t),e.forEach(i);for(var s,c,u,h,l,d,f={},p=t.concat(),m=0,g=e.length;m0)){c=r;break}c=r-1}if(r=c,n[r]===i){var u=r/(o-1);return u}var h=n[r],l=n[r+1],d=l-h,f=(i-h)/d,u=(r+f)/(o-1);return u},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i),o=this.getPoint(n),a=o.clone().sub(r);return a.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)}},xi.create=function(t,e){return t.prototype=Object.create(xi.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},_i.prototype=Object.create(xi.prototype),_i.prototype.constructor=_i,_i.prototype.isLineCurve=!0,_i.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},_i.prototype.getPointAt=function(t){return this.getPoint(t)},_i.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new _i(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n=e){var r=i[n]-e,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new Kt,i=0,n=t.length;ie;)i-=e;ie.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],u=fp.interpolate;return new _(u(o.x,a.x,s.x,c.x,r),u(o.y,a.y,s.y,c.y,r))},Mi.prototype=Object.create(xi.prototype),Mi.prototype.constructor=Mi,Mi.prototype.getPoint=function(t){var e=dp.b3;return new _(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},Mi.prototype.getTangent=function(t){var e=fp.tangentCubicBezier;return new _(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},Pi.prototype=Object.create(xi.prototype),Pi.prototype.constructor=Pi,Pi.prototype.getPoint=function(t){var e=dp.b2;return new _(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},Pi.prototype.getTangent=function(t){var e=fp.tangentQuadraticBezier;return new _(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var pp=Object.assign(Object.create(wi.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});Ci.prototype=Object.create(Kt.prototype),Ci.prototype.constructor=Ci,Ci.NoTaper=function(t){return 1},Ci.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},Ci.FrenetFrames=function(t,e,i){function n(){f[0]=new P,p[0]=new P,o=Number.MAX_VALUE,a=Math.abs(d[0].x),s=Math.abs(d[0].y),c=Math.abs(d[0].z),a<=o&&(o=a,l.set(1,0,0)),s<=o&&(o=s,l.set(0,1,0)),c<=o&&l.set(0,0,1),m.crossVectors(d[0],l).normalize(),f[0].crossVectors(d[0],m),p[0].crossVectors(d[0],f[0])}var r,o,a,s,c,u,h,l=new P,d=[],f=[],p=[],m=new P,g=new A,v=e+1;for(this.tangents=d,this.normals=f,this.binormals=p,u=0;uNumber.EPSILON&&(m.normalize(),r=Math.acos(ql.clamp(d[u-1].dot(d[u]),-1,1)),f[u].applyMatrix4(g.makeRotationAxis(m,r))),p[u].crossVectors(d[u],f[u]);if(i)for(r=Math.acos(ql.clamp(f[0].dot(f[v-1]),-1,1)),r/=v-1,d[0].dot(m.crossVectors(f[0],f[v-1]))>0&&(r=-r),u=1;uNumber.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(c*c+u*u),p=e.x-s/d,m=e.y+a/d,g=i.x-u/f,v=i.y+c/f,y=((g-p)*u-(v-m)*c)/(a*u-s*c);n=p+a*y-t.x,r=m+s*y-t.y;var b=n*n+r*r;if(b<=2)return new _(n,r);o=Math.sqrt(b/2)}else{var x=!1;a>Number.EPSILON?c>Number.EPSILON&&(x=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(u)&&(x=!0),x?(n=-s,r=a,o=Math.sqrt(h)):(n=a,r=s,o=Math.sqrt(h/2))}return new _(n/o,r/o)}function r(){if(b){var t=0,e=G*t;for(X=0;X=0;){i=X,n=X-1,n<0&&(n=t.length-1);var r=0,o=w+2*y;for(r=0;r=0;z--){for(U=z/y,j=g*Math.cos(U*Math.PI/2),B=v*Math.sin(U*Math.PI/2),X=0,q=F.length;XNumber.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[r],u=-u),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var h=u*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;n=!n}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return n}var r=dp.isClockWise,o=this.subPaths;if(0===o.length)return[];if(e===!0)return i(o);var a,s,c,u=[];if(1===o.length)return s=o[0],c=new Ii,c.curves=s.curves,u.push(c),u;var h=!r(o[0].getPoints());h=t?!h:h;var l,d=[],f=[],p=[],m=0;f[m]=void 0,p[m]=[];for(var g=0,v=o.length;g1){for(var y=!1,b=[],x=0,_=f.length;x<_;x++)d[x]=[];for(var x=0,_=f.length;x<_;x++)for(var w=p[x],S=0;S0&&(y||(p=d))}for(var C,g=0,T=f.length;g0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[i+o]},_slerp:function(t,e,i,n,r){M.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}}},Vi.prototype={constructor:Vi,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Vi.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var o=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a0)for(var c=this._interpolants,u=this._propertyBindings,h=0,l=c.length;h!==l;++h)c[h].evaluate(a),u[h].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopWarping(), -0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===Cl){r===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=n===El;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var a=Math.floor(e/i);e-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=Dl,n.endingEnd=Dl):(t?n.endingStart=this.zeroSlopeAtStart?Dl:Ol:n.endingStart=Nl,e?n.endingEnd=this.zeroSlopeAtEnd?Dl:Ol:n.endingEnd=Nl)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=i,this}},Object.assign(Hi.prototype,x.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?pi.findByName(i,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[n];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var u=new Gi(this,r,e);return this._bindAction(u,s),this._addInactiveAction(u,o,n),u},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?pi.findByName(i,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==i;++a){var s=e[a];s.enabled&&s._update(n,t,r,o)}for(var c=this._bindings,u=this._nActiveBindings,a=0;a!==u;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var u=c._cacheIndex,h=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,e[u]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,o=r[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var c in s){var u=s[c];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(Hi.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,a=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var h=0;h!==r;++h){var l=n[h],d=l.name,f=u[d];if(void 0!==f)o[h]=f;else{if(f=o[h],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=e&&e._propertyBindings[h].binding.parsedPath;f=new $i(Vi.create(i,d,p),l.ValueTypeName,l.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,d),o[h]=f}a[h].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),rn.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},rn.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},on.prototype=Object.create(Kt.prototype),on.prototype.constructor=on,an.prototype=Object.create(on.prototype),an.prototype.constructor=an,sn.prototype=Object.create(Kt.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(te.prototype),cn.prototype.constructor=cn;(function(){function t(){}var e=new P,i=new t,n=new t,r=new t;return t.prototype.init=function(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n},t.prototype.initNonuniformCatmullRom=function(t,e,i,n,r,o,a){var s=(e-t)/r-(i-t)/(r+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+a)+(n-i)/a;s*=o,c*=o,this.init(e,i,s,c)},t.prototype.initCatmullRom=function(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))},t.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},xi.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s,c,u=this.points;c=u.length,c<2&&console.log("duh, you need at least 2 points"),o=(c-(this.closed?0:1))*t,a=Math.floor(o),s=o-a,this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/u.length)+1)*u.length:0===s&&a===c-1&&(a=c-2,s=1);var h,l,d,f;if(this.closed||a>0?h=u[(a-1)%c]:(e.subVectors(u[0],u[1]).add(u[0]),h=e),l=u[a%c],d=u[(a+1)%c],this.closed||a+2e.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],u=fp.interpolate;return new P(u(o.x,a.x,s.x,c.x,r),u(o.y,a.y,s.y,c.y,r),u(o.z,a.z,s.z,c.z,r))}),xi.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(t){var e=dp.b3;return new P(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),xi.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(t){var e=dp.b2;return new P(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),xi.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new P;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e});Object.defineProperty(t,"AudioContext",{get:function(){return t.getAudioContext()}}),un.prototype={active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,i),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},ln.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(t,e,i,n){var r,o=this._indexOfListener(t,i);if(o!==-1){if(r=this._bindings[o],r.isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else r=new un(this,t,e,i,n),this._addBinding(r);return this.memorize&&this._prevParams&&r.execute(this._prevParams),r},_addBinding:function(t){var e=this._bindings.length;do--e;while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){for(var i,n=this._bindings.length;n--;)if(i=this._bindings[n],i._listener===t&&i.context===e)return n;return-1},has:function(t,e){return this._indexOfListener(t,e)!==-1},add:function(t,e,i){return hn(t,"add"),this._registerListener(t,!1,e,i)},addOnce:function(t,e,i){return hn(t,"addOnce"),this._registerListener(t,!0,e,i)},remove:function(t,e){hn(t,"remove");var i=this._indexOfListener(t,e);return i!==-1&&(this._bindings[i]._destroy(),this._bindings.splice(i,1)),t},removeAll:function(){for(var t=this._bindings.length;t--;)this._bindings[t]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(t){if(this.active){var e,i=Array.prototype.slice.call(arguments),n=this._bindings.length;if(this.memorize&&(this._prevParams=i),n){e=this._bindings.slice(),this._shouldPropagate=!0;do n--;while(e[n]&&this._shouldPropagate&&e[n].execute(i)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var yp={PROTEIN:1,NUCLEIC:2,RNA:3,DNA:4,POLYMER:5,WATER:6,HELIX:7,SHEET:8,BACKBONE:9,SIDECHAIN:10,ALL:11,HETERO:12,ION:13,SACCHARIDE:14};dn.prototype={constructor:dn,type:"selection",setString:function(t,e){if(void 0===t&&(t=this.string||""),t!==this.string){try{this.parse(t)}catch(t){this.selection={error:t.message}}this.string=t,this.test=this.makeAtomTest(),this.residueTest=this.makeResidueTest(),this.chainTest=this.makeChainTest(),this.modelTest=this.makeModelTest(),this.atomOnlyTest=this.makeAtomTest(!0),this.residueOnlyTest=this.makeResidueTest(!0),this.chainOnlyTest=this.makeChainTest(!0),this.modelOnlyTest=this.makeModelTest(!0),e||this.signals.stringChanged.dispatch(this.string)}},parse:function(t){if(this.selection={operator:void 0,rules:[]},t){var e,i,n=this,r=this.selection,o=[];t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").trim(),"("===t.charAt(0)&&")"===t.substr(-1)&&(t=t.slice(1,-1).trim());var a,s,c,u,h,l,d,f,p,m,g=t.split(/\s+/),v=["*","","ALL"],y=function(t){e={operator:t,rules:[]},void 0===r?(r=e,n.selection=e):(r.rules.push(e),o.push(r),r=e)},b=function(t){i=r,r=o.pop(),void 0===r&&(y(t),x(i))},x=function(t){r.rules.push(t)};for(c=0;c0)if("NOT"===a.toUpperCase())u=1;else if(1===u)u=2;else{if(2!==u)throw new Error("something went wrong with 'not'");u=!1,b()}if("AND"!==a.toUpperCase())if("OR"!==a.toUpperCase())if("NOT"!==a.toUpperCase())if(s={},"HETERO"!==a.toUpperCase())if("WATER"!==a.toUpperCase())if("PROTEIN"!==a.toUpperCase())if("NUCLEIC"!==a.toUpperCase())if("RNA"!==a.toUpperCase())if("DNA"!==a.toUpperCase())if("POLYMER"!==a.toUpperCase())if("ION"!==a.toUpperCase())if("SACCHARIDE"!==a.toUpperCase()&&"SUGAR"!==a.toUpperCase())if("HYDROGEN"!==a.toUpperCase())if("SMALL"!==a.toUpperCase())if("NUCLEOPHILIC"!==a.toUpperCase())if("HYDROPHOBIC"!==a.toUpperCase())if("AROMATIC"!==a.toUpperCase())if("AMIDE"!==a.toUpperCase())if("ACIDIC"!==a.toUpperCase())if("BASIC"!==a.toUpperCase())if("CHARGED"!==a.toUpperCase())if("POLAR"!==a.toUpperCase())if("NONPOLAR"!==a.toUpperCase())if("HELIX"!==a.toUpperCase())if("SHEET"!==a.toUpperCase())if("TURN"!==a.toUpperCase())if("BACKBONE"!==a.toUpperCase())if("SIDECHAIN"!==a.toUpperCase())if("SIDECHAINATTACHED"!==a.toUpperCase())if(v.indexOf(a.toUpperCase())===-1)if("@"!==a.charAt(0))if("#"!==a.charAt(0))if("["!==a[0]||"]"!==a[a.length-1])if(a.length>=1&&a.length<=4&&"^"!==a[0]&&":"!==a[0]&&"."!==a[0]&&"%"!==a[0]&&"/"!==a[0]&&isNaN(parseInt(a)))s.resname=a.toUpperCase(),x(s);else{if(s={operator:"AND",rules:[]},d=a.split("/"),d.length>1&&d[1]){if(isNaN(parseInt(d[1])))throw new Error("model must be an integer");s.rules.push({model:parseInt(d[1])})}if(p=d[0].split("%"),p.length>1&&s.rules.push({altloc:p[1]}),h=p[0].split("."),h.length>1&&h[1]){if(h[1].length>4)throw new Error("atomname must be one to four characters");s.rules.push({atomname:h[1].substring(0,4).toUpperCase()})}if(l=h[0].split(":"),l.length>1&&l[1]&&s.rules.push({chainname:l[1]}),m=l[0].split("^"),m.length>1&&s.rules.push({inscode:m[1]}),m[0]){var _,w;if("-"===m[0][0]&&(m[0]=m[0].substr(1),_=!0),m[0].includes("--")&&(m[0]=m[0].replace("--","-"),w=!0),f=m[0].split("-"),1===f.length){if(f=parseInt(f[0]),isNaN(f))throw new Error("resi must be an integer");_&&(f*=-1),s.rules.push({resno:f})}else{if(2!==f.length)throw new Error("resi range must contain one '-'");_&&(f[0]*=-1),w&&(f[1]*=-1),s.rules.push({resno:[parseInt(f[0]),parseInt(f[1])]})}}if(1===s.rules.length)x(s.rules[0]);else{if(!(s.rules.length>1))throw new Error("empty selection chunk");x(s)}}else s.resname=a.substr(1,a.length-2).toUpperCase(),x(s);else s.element=a.substr(1).toUpperCase(),x(s);else{for(var S=a.substr(1).split(","),A=0,M=S.length;A0?e:null},makeAtomTest:function(t){var e,i=["h","g","i"],n=["e","b"];e=t?this._filter(function(t){return void 0!==t.keyword&&t.keyword!==yp.BACKBONE&&t.keyword!==yp.SIDECHAIN||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||void 0!==t.sstruc))))}):this.selection;var r=function(t,e){if(void 0===e.atomname&&void 0===e.element&&void 0===e.altloc&&void 0===e.atomindex&&void 0===e.keyword&&void 0===e.inscode&&void 0===e.resname&&void 0===e.sstruc&&void 0===e.resno&&void 0===e.chainname&&void 0===e.model)return-1;if(void 0!==e.keyword){if(e.keyword===yp.BACKBONE&&!t.isBackbone())return!1;if(e.keyword===yp.SIDECHAIN&&!t.isSidechain())return!1;if(e.keyword===yp.HETERO&&!t.isHetero())return!1;if(e.keyword===yp.PROTEIN&&!t.isProtein())return!1;if(e.keyword===yp.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===yp.RNA&&!t.isRna())return!1;if(e.keyword===yp.DNA&&!t.isDna())return!1;if(e.keyword===yp.POLYMER&&!t.isPolymer())return!1;if(e.keyword===yp.WATER&&!t.isWater())return!1;if(e.keyword===yp.HELIX&&i.indexOf(t.sstruc)===-1)return!1;if(e.keyword===yp.SHEET&&n.indexOf(t.sstruc)===-1)return!1;if(e.keyword===yp.ION&&!t.isIon())return!1;if(e.keyword===yp.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomname&&e.atomname!==t.atomname)return!1;if(void 0!==e.element&&e.element!==t.element)return!1;if(void 0!==e.altloc&&e.altloc!==t.altloc)return!1;if(void 0!==e.atomindex&&ku(e.atomindex,t.index)<0)return!1;if(void 0!==e.resname&&e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]e.atomindexLast||t.atomEndt.resno||e.resno[1]e.atomindexLast||t.atomEnde.atomindexLast||t.atomEnd>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),xp=0,_p=1,wp=2,Sp=3,Ap=4,Mp=0,Pp=1,Cp=2,Tp=3,Ep=4,Ip=5,Lp=6,Rp=0,Op=1,Dp=2,Np=3,kp=4,Fp=5,zp=6,Bp=["D-BETA-PEPTIDE, C-GAMMA LINKING","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-PEPTIDE COOH CARBOXY TERMINUS","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE LINKING","PEPTIDE LINKING","PEPTIDE-LIKE"],Up=["RNA OH 3 PRIME TERMINUS","RNA OH 5 PRIME TERMINUS","RNA LINKING"],jp=["DNA OH 3 PRIME TERMINUS","DNA OH 5 PRIME TERMINUS","DNA LINKING","L-DNA LINKING","L-RNA LINKING"],$p=["D-SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE","L-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING","SACCHARIDE"],Vp=["OTHER"],Gp=["NON-POLYMER"],Hp=Gp.concat(Vp,$p),Wp={H:1.1,HE:1.4,LI:1.81,BE:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,NE:1.54,NA:2.27,MG:1.73, -AL:1.84,SI:2.1,P:1.8,S:1.8,CL:1.75,AR:1.88,K:2.75,CA:2.31,SC:2.3,TI:2.15,V:2.05,CR:2.05,MN:2.05,FE:2.05,CO:2,NI:2,CU:2,ZN:2.1,GA:1.87,GE:2.11,AS:1.85,SE:1.9,BR:1.83,KR:2.02,RB:3.03,SR:2.49,Y:2.4,ZR:2.3,NB:2.15,MO:2.1,TC:2.05,RU:2.05,RH:2,PD:2.05,AG:2.1,CD:2.2,IN:2.2,SN:1.93,SB:2.17,TE:2.06,I:1.98,XE:2.16,CS:3.43,BA:2.68,LA:2.5,CE:2.48,PR:2.47,ND:2.45,PM:2.43,SM:2.42,EU:2.4,GD:2.38,TB:2.37,DY:2.35,HO:2.33,ER:2.32,TM:2.3,YB:2.28,LU:2.27,HF:2.25,TA:2.2,W:2.1,RE:2.05,OS:2,IR:2,PT:2.05,AU:2.1,HG:2.05,TL:1.96,PB:2.02,BI:2.07,PO:1.97,AT:2.02,RN:2.2,FR:3.48,RA:2.83,AC:2,TH:2.4,PA:2,U:2.3,NP:2,PU:2,AM:2,CM:2,BK:2,CF:2,ES:2,FM:2,MD:2,NO:2,LR:2,RF:2,DB:2,SG:2,BH:2,HS:2,MT:2,DS:2,RG:2,CN:2,UUT:2,FL:2,UUP:2,LV:2,UUH:2},Xp=2,qp={H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69,BK:1.6,CF:1.6,ES:1.6,FM:1.6,MD:1.6,NO:1.6,LR:1.6,RF:1.6,DB:1.6,SG:1.6,BH:1.6,HS:1.6,MT:1.6,DS:1.6,RG:1.6,CN:1.6,UUT:1.6,FL:1.6,UUP:1.6,LV:1.6,UUH:1.6},Yp=1.6,Zp={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},Kp=[0,0,0],Qp={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",ASH:"D",GLH:"E",UNK:""},Jp=Object.keys(Qp),tm=["A","C","T","G","U"],em=["DA","DC","DT","DG","DU","TCY","MCY","5CM"],im=["A","G","DA","DG"],nm=["SOL","WAT","HOH","H2O","W","DOD","D3O"],rm=["118","119","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","543","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MLT","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NCO","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3"],om=["045","0AT","0BD","0MK","0NZ","0TS","0V4","0XY","0YT","10M","147","149","14T","15L","16G","18T","18Y","1AR","1BW","1GL","1GN","1JB","1LL","1NA","1S3","26M","26Q","26R","26V","26W","26Y","27C","289","291","293","2DG","2F8","2FG","2FL","2FP","2GL","2M4","2M5","32O","34V","3CM","3DO","3DY","3FM","3LR","3MF","3MG","3SA","3ZW","46D","46M","46Z","48Z","4CQ","4GC","4NN","50A","5DI","5GF","5MM","5RP","5SA","5SP","64K","6PG","6SA","7JZ","7SA","A1Q","A2G","AAB","AAL","AAO","ABC","ABD","ABE","ABF","ABL","ACG","ACI","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AHR","AIG","ALL","ALX","AMU","AOG","AOS","ARA","ARB","ARE","ARI","ASG","ASO","AXP","AXR","B0D","B16","B2G","B4G","B6D","B8D","B9D","BBK","BCD","BDG","BDP","BDR","BEM","BFP","BGC","BGL","BGP","BGS","BHG","BMA","BMX","BNG","BNX","BOG","BRI","BXF","BXP","BXX","BXY","C3X","C4X","C5X","CAP","CBI","CBK","CBS","CDR","CEG","CGF","CHO","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D6G","DAF","DAG","DDA","DDB","DDL","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGS","DIG","DLF","DLG","DMU","DNO","DOM","DP5","DQQ","DQR","DR2","DR3","DR4","DRI","DSR","DT6","DVC","E4P","E5G","EAG","EBG","EBQ","EGA","EJT","EPG","ERE","ERI","F1P","F1X","F6P","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FIX","FMO","FRU","FSI","FU4","FUB","FUC","FUD","FUL","FXP","G16","G1P","G2F","G3I","G4D","G4S","G6D","G6P","G6S","GAC","GAD","GAL","GC1","GC4","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GCX","GE1","GFG","GFP","GIV","GL0","GL2","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GMH","GN1","GNX","GP1","GP4","GPH","GPM","GQ1","GQ2","GQ4","GS1","GS4","GSA","GSD","GTE","GTH","GTK","GTR","GTZ","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUP","GUZ","GYP","GYV","H2P","HDL","HMS","HS2","HSD","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","IAB","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IMK","IN1","IPT","ISL","KBG","KD2","KDA","KDM","KDO","KFN","KO1","KO2","KTU","L6S","LAG","LAI","LAK","LAO","LAT","LB2","LBT","LCN","LDY","LGC","LGU","LM2","LMT","LMU","LOG","LOX","LPK","LSM","LTM","LVZ","LXB","LXZ","M1F","M3M","M6P","M8C","MA1","MA2","MA3","MAB","MAG","MAL","MAN","MAT","MAV","MAW","MBG","MCU","MDA","MDM","MDP","MFA","MFB","MFU","MG5","MGA","MGL","MLB","MMA","MMN","MN0","MRP","MTT","MUG","MVP","MXY","N1L","N9S","NAA","NAG","NBG","NDG","NED","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGL","NGS","NGY","NHF","NM6","NM9","NTF","NTO","NTP","NXD","NYT","OPG","OPM","ORP","OX2","P3M","P53","P6P","PA5","PNA","PNG","PNW","PRP","PSJ","PSV","PTQ","QDK","QPS","QV4","R1P","R1X","R2B","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RIB","RIP","RNS","RNT","ROB","ROR","RPA","RST","RUB","RUU","RZM","S6P","S7P","SA0","SCR","SDD","SF6","SF9","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHG","SI3","SIO","SOE","SOL","SSG","SUC","SUP","SUS","T6P","T6T","TAG","TCB","TDG","TGK","TGY","TH1","TIA","TM5","TM6","TM9","TMR","TMX","TOA","TOC","TRE","TYV","UCD","UDC","VG1","X0X","X1X","X2F","X4S","X5S","X6X","XBP","XDN","XDP","XIF","XIM","XLF","XLS","XMM","XUL","XXR","XYP","XYS","YO5","Z3Q","Z6J","Z9M","ZDC","ZDM"],am=["CA","C","N","O","O1","O2","OC1","OC2","OX1","OXT","H","H1","H2","H3","HA","BB"],sm=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],cm={};cm[Op]={trace:"CA",direction1:"C",direction2:["O","OC1","O1","OX1","OXT"],backboneStart:"N",backboneEnd:"C"},cm[Dp]={trace:["C4'","C4*"],direction1:["C1'","C1*"],direction2:["C3'","C3*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},cm[Np]={trace:["C3'","C3*"],direction1:["C2'","C2*"],direction2:["O4'","O4*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},cm[kp]={trace:["CA","BB"],backboneStart:["CA","BB"],backboneEnd:["CA","BB"]},cm[Fp]={trace:["C4'","C4*","P"],backboneStart:["C4'","C4*","P"],backboneEnd:["C4'","C4*","P"]},cm[zp]={trace:["C3'","C3*","C2'","P"],backboneStart:["C3'","C3*","C2'","P"],backboneEnd:["C3'","C3*","C2'","P"]},cm[Rp]={};var um,hm,lm,dm,fm,pm,mm,gm,vm,ym,bm,xm,_m,wm,Sm,Am,Mm,Pm,Cm,Tm,Em,Im,Lm,Rm,Om,Dm,Nm,km,Fm,zm,Bm,Um,jm,$m,Vm,Gm,Hm,Wm,Xm,qm,Ym,Zm,Km,Qm,Jm,tg,eg,ig,ng,rg,og,ag,sg,cg,ug,hg,lg,dg,fg,pg,mg,gg,vg,yg,bg,xg,_g,wg,Sg,Ag,Mg,Pg,Cg,Tg,Eg,Ig,Lg,Rg,Og=[].slice;Tg=function(){var t,e,i,n,r;for(t={},r="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,e=r.length;ni&&(t=i),t},Eg=function(t){return t.length>=3?[].slice.call(t):t[0]},Tm=function(t){var e;for(e in t)e<3?(t[e]<0&&(t[e]=0),t[e]>255&&(t[e]=255)):3===e&&(t[e]<0&&(t[e]=0),t[e]>1&&(t[e]=1));return t},dm=Math.PI,Sg=Math.round,Lm=Math.cos,km=Math.floor,cg=Math.pow,tg=Math.log,Mg=Math.sin,Pg=Math.sqrt,_m=Math.atan2,ng=Math.max,xm=Math.abs,mm=2*dm,fm=dm/3,hm=dm/180,pm=180/dm,Cm=function(){return arguments[0]instanceof um?arguments[0]:function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,arguments,function(){})},bm=[],Cm.version="1.1.1",ym={},gm=[],vm=!1,um=function(){function t(){var t,e,i,n,r,o,a,s,c;for(o=this,e=[],s=0,n=arguments.length;s3?e[3]:1]},Rg=function(t){return Sg(255*(t<=.00304?12.92*t:1.055*cg(t,1/2.4)-.055))},Ym=function(t){return t>lm.t1?t*t*t:lm.t2*(t-lm.t0)},lm={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},mg=function(){var t,e,i,n,r,o,a,s;return n=Eg(arguments),i=n[0],e=n[1],t=n[2],r=xg(i,e,t),o=r[0],a=r[1],s=r[2],[116*a-16,500*(o-a),200*(a-s)]},_g=function(t){return(t/=255)<=.04045?t/12.92:cg((t+.055)/1.055,2.4)},Lg=function(t){return t>lm.t3?cg(t,1/3):t/lm.t2+lm.t0},xg=function(){var t,e,i,n,r,o,a;return n=Eg(arguments),i=n[0],e=n[1],t=n[2],i=_g(i),e=_g(e),t=_g(t),r=Lg((.4124564*i+.3575761*e+.1804375*t)/lm.Xn),o=Lg((.2126729*i+.7151522*e+.072175*t)/lm.Yn),a=Lg((.0193339*i+.119192*e+.9503041*t)/lm.Zn),[r,o,a]},Cm.lab=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["lab"]),function(){})},ym.lab=qm,um.prototype.lab=function(){return mg(this._rgb)},wm=function(t){var e,i,n,r,o,a,s,c,u,h,l;return t=function(){var e,i,n;for(n=[],i=0,e=t.length;i=0&&e[3]<=1?"rgb":void 0}}),Fm=function(t){var e,i,n,r,o,a;if(t.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return 4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),a=parseInt(t,16),r=a>>16,n=a>>8&255,i=255&a,[r,n,i,1];if(t.match(/^#?([A-Fa-f0-9]{8})$/))return 9===t.length&&(t=t.substr(1)),a=parseInt(t,16),r=a>>24&255,n=a>>16&255,i=a>>8&255,e=Sg((255&a)/255*100)/100,[r,n,i,e];if(null!=ym.css&&(o=ym.css(t)))return o;throw"unknown color: "+t},lg=function(t,e){var i,n,r,o,a,s,c;return null==e&&(e="rgb"),a=t[0],r=t[1],n=t[2],i=t[3],c=a<<16|r<<8|n,s="000000"+c.toString(16),s=s.substr(s.length-6),o="0"+Sg(255*i).toString(16),o=o.substr(o.length-2),"#"+function(){switch(e.toLowerCase()){case"rgba":return s+o;case"argb":return o+s;default:return s}}()},ym.hex=function(t){return Fm(t)},Cm.hex=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["hex"]),function(){})},um.prototype.hex=function(t){return null==t&&(t="rgb"),lg(this._rgb,t)},gm.push({p:10,test:function(t){if(1===arguments.length&&"string"===Tg(t))return"hex"}}),Um=function(){var t,e,i,n,r,o,a,s,c,u,h,l,d,f;if(t=Eg(arguments),r=t[0],h=t[1],a=t[2],0===h)c=n=e=255*a;else{for(f=[0,0,0],i=[0,0,0],d=a<.5?a*(1+h):a+h-a*h,l=2*a-d,r/=360,f[0]=r+1/3,f[1]=r,f[2]=r-1/3,o=s=0;s<=2;o=++s)f[o]<0&&(f[o]+=1),f[o]>1&&(f[o]-=1),6*f[o]<1?i[o]=l+6*(d-l)*f[o]:2*f[o]<1?i[o]=d:3*f[o]<2?i[o]=l+(d-l)*(2/3-f[o])*6:i[o]=l;u=[Sg(255*i[0]),Sg(255*i[1]),Sg(255*i[2])],c=u[0],n=u[1],e=u[2]}return t.length>3?[c,n,e,t[3]]:[c,n,e]},fg=function(t,e,i){var n,r,o,a,s;return void 0!==t&&t.length>=3&&(a=t,t=a[0],e=a[1],i=a[2]),t/=255,e/=255,i/=255,o=Math.min(t,e,i),ng=Math.max(t,e,i),r=(ng+o)/2,ng===o?(s=0,n=Number.NaN):s=r<.5?(ng-o)/(ng+o):(ng-o)/(2-ng-o),t===ng?n=(e-i)/(ng-o):e===ng?n=2+(i-t)/(ng-o):i===ng&&(n=4+(t-e)/(ng-o)),n*=60,n<0&&(n+=360),[n,s,r]},Cm.hsl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["hsl"]),function(){})},ym.hsl=Um,um.prototype.hsl=function(){return fg(this._rgb)},jm=function(){var t,e,i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v;if(t=Eg(arguments),r=t[0],m=t[1],v=t[2],v*=255,0===m)c=n=e=v;else switch(360===r&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60,o=km(r),i=r-o,a=v*(1-m),s=v*(1-m*i),g=v*(1-m*(1-i)),o){case 0:u=[v,g,a],c=u[0],n=u[1],e=u[2];break;case 1:h=[s,v,a],c=h[0],n=h[1],e=h[2];break;case 2:l=[a,v,g],c=l[0],n=l[1],e=l[2];break;case 3:d=[a,s,v],c=d[0],n=d[1],e=d[2];break;case 4:f=[g,a,v],c=f[0],n=f[1],e=f[2];break;case 5:p=[v,a,s],c=p[0],n=p[1],e=p[2]}return c=Sg(c),n=Sg(n),e=Sg(e),[c,n,e,t.length>3?t[3]:1]},pg=function(){var t,e,i,n,r,o,a,s,c;return a=Eg(arguments),o=a[0],i=a[1],t=a[2],r=Math.min(o,i,t),ng=Math.max(o,i,t),e=ng-r,c=ng/255,0===ng?(n=Number.NaN,s=0):(s=e/ng,o===ng&&(n=(i-t)/e),i===ng&&(n=2+(t-o)/e),t===ng&&(n=4+(o-i)/e),n*=60,n<0&&(n+=360)),[n,s,c]},Cm.hsv=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["hsv"]),function(){})},ym.hsv=jm,um.prototype.hsv=function(){return pg(this._rgb)},ag=function(t){var e,i,n;return"number"===Tg(t)&&t>=0&&t<=16777215?(n=t>>16,i=t>>8&255,e=255&t,[n,i,e,1]):(console.warn("unknown num color: "+t),[0,0,0,1])},yg=function(){var t,e,i,n;return n=Eg(arguments),i=n[0],e=n[1],t=n[2],(i<<16)+(e<<8)+t},Cm.num=function(t){return new um(t,"num")},um.prototype.num=function(t){return null==t&&(t="rgb"),yg(this._rgb,t)},ym.num=ag,gm.push({p:10,test:function(t){if(1===arguments.length&&"number"===Tg(t)&&t>=0&&t<=16777215)return"num"}}),Rm=function(t){var e,i,n,r,o,a,s,c;if(t=t.toLowerCase(),null!=Cm.colors&&Cm.colors[t])return Fm(Cm.colors[t]);if(o=t.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(s=o.slice(1,4),r=a=0;a<=2;r=++a)s[r]=+s[r];s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(s=o.slice(1,5),r=c=0;c<=3;r=++c)s[r]=+s[r];else if(o=t.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(s=o.slice(1,4),r=e=0;e<=2;r=++e)s[r]=Sg(2.55*s[r]);s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(s=o.slice(1,5),r=i=0;i<=2;r=++i)s[r]=Sg(2.55*s[r]);s[3]=+s[3]}else(o=t.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=Um(n),s[3]=1):(o=t.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=Um(n),s[3]=+o[4]);return s},hg=function(t){var e;return e=t[3]<1?"rgba":"rgb","rgb"===e?e+"("+t.slice(0,3).map(Sg).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Sg).join(",")+","+t[3]+")":void 0},wg=function(t){return Sg(100*t)/100},Bm=function(t,e){var i;return i=e<1?"hsla":"hsl",t[0]=wg(t[0]||0),t[1]=wg(100*t[1])+"%",t[2]=wg(100*t[2])+"%","hsla"===i&&(t[3]=e),i+"("+t.join(",")+")"},ym.css=function(t){return Rm(t)},Cm.css=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["css"]),function(){})},um.prototype.css=function(t){return null==t&&(t="rgb"),"rgb"===t.slice(0,3)?hg(this._rgb):"hsl"===t.slice(0,3)?Bm(this.hsl(),this.alpha()):void 0},ym.named=function(t){return Fm(Ig[t])},gm.push({p:20,test:function(t){if(1===arguments.length&&null!=Ig[t])return"named"}}),um.prototype.name=function(t){var e,i;arguments.length&&(Ig[t]&&(this._rgb=Fm(Ig[t])),this._rgb[3]=1),e=this.hex();for(i in Ig)if(e===Ig[i])return i;return e},Zm=function(){var t,e,i,n;return n=Eg(arguments),i=n[0],t=n[1],e=n[2],e*=hm,[i,Lm(e)*t,Mg(e)*t]},Km=function(){var t,e,i,n,r,o,a,s,c,u,h;return i=Eg(arguments),s=i[0],r=i[1],a=i[2],u=Zm(s,r,a),t=u[0],e=u[1],n=u[2],h=qm(t,e,n),c=h[0],o=h[1],n=h[2],[Jm(c,0,255),Jm(o,0,255),Jm(n,0,255),i.length>3?i[3]:1]},Xm=function(){var t,e,i,n,r,o;return o=Eg(arguments),r=o[0],t=o[1],e=o[2],i=Pg(t*t+e*e),n=(_m(e,t)*pm+360)%360,0===Sg(1e4*i)&&(n=Number.NaN),[r,i,n]},gg=function(){var t,e,i,n,r,o,a;return o=Eg(arguments),r=o[0],i=o[1],e=o[2],a=mg(r,i,e),n=a[0],t=a[1],e=a[2],Xm(n,t,e)},Cm.lch=function(){var t;return t=Eg(arguments),new um(t,"lch")},Cm.hcl=function(){var t;return t=Eg(arguments),new um(t,"hcl")},ym.lch=Km,ym.hcl=function(){var t,e,i,n;return n=Eg(arguments),e=n[0],t=n[1],i=n[2],Km([i,t,e])},um.prototype.lch=function(){return gg(this._rgb)},um.prototype.hcl=function(){return gg(this._rgb).reverse()},ug=function(t){var e,i,n,r,o,a,s,c,u;return null==t&&(t="rgb"),c=Eg(arguments),s=c[0],r=c[1],e=c[2],s/=255,r/=255,e/=255,o=1-Math.max(s,Math.max(r,e)),n=o<1?1/(1-o):0,i=(1-s-o)*n,a=(1-r-o)*n,u=(1-e-o)*n,[i,a,u,o]},Em=function(){var t,e,i,n,r,o,a,s,c;return e=Eg(arguments),n=e[0],a=e[1],c=e[2],o=e[3],t=e.length>4?e[4]:1,1===o?[0,0,0,t]:(s=n>=1?0:Sg(255*(1-n)*(1-o)),r=a>=1?0:Sg(255*(1-a)*(1-o)),i=c>=1?0:Sg(255*(1-c)*(1-o)),[s,r,i,t])},ym.cmyk=function(){return Em(Eg(arguments))},Cm.cmyk=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["cmyk"]),function(){})},um.prototype.cmyk=function(){return ug(this._rgb)},ym.gl=function(){var t,e,i,n,r;for(n=function(){var t,i;t=Eg(arguments),i=[];for(e in t)r=t[e],i.push(r);return i}.apply(this,arguments),t=i=0;i<=2;t=++i)n[t]*=255;return n},Cm.gl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["gl"]),function(){})},um.prototype.gl=function(){var t;return t=this._rgb,[t[0]/255,t[1]/255,t[2]/255,t[3]]},vg=function(t,e,i){var n;return n=Eg(arguments),t=n[0],e=n[1],i=n[2],t=eg(t),e=eg(e),i=eg(i),.2126*t+.7152*e+.0722*i},eg=function(t){return t/=255,t<=.03928?t/12.92:cg((t+.055)/1.055,2.4)},bm=[],$m=function(t,e,i,n){var r,o,a,s;for(null==i&&(i=.5),null==n&&(n="rgb"),"object"!==Tg(t)&&(t=Cm(t)),"object"!==Tg(e)&&(e=Cm(e)),a=0,o=bm.length;at?o(i,c):o(c,a)},i=vg(this._rgb),this._rgb=(i>t?o(Cm("black"),this):o(this,Cm("white"))).rgba()),this):vg(this._rgb)},Cg=function(t){var e,i,n,r;return r=t/100,r<66?(n=255,i=-155.25485562709179-.44596950469579133*(i=r-2)+104.49216199393888*tg(i),e=r<20?0:-254.76935184120902+.8274096064007395*(e=r-10)+115.67994401066147*tg(e)):(n=351.97690566805693+.114206453784165*(n=r-55)-40.25366309332127*tg(n),i=325.4494125711974+.07943456536662342*(i=r-50)-28.0852963507957*tg(i),e=255),Tm([n,i,e])},bg=function(){var t,e,i,n,r,o,a,s,c;for(a=Eg(arguments),o=a[0],i=a[1],t=a[2],r=1e3,n=4e4,e=.4;n-r>e;)c=.5*(n+r),s=Cg(c),s[2]/s[0]>=t/o?n=c:r=c;return Sg(c)},Cm.temperature=Cm.kelvin=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["temperature"]),function(){})},ym.temperature=ym.kelvin=ym.K=Cg,um.prototype.temperature=function(){return bg(this._rgb)},um.prototype.kelvin=um.prototype.temperature,Cm.contrast=function(t,e){var i,n,r,o;return"string"!==(r=Tg(t))&&"number"!==r||(t=new um(t)),"string"!==(o=Tg(e))&&"number"!==o||(e=new um(e)),i=t.luminance(),n=e.luminance(),i>n?(i+.05)/(n+.05):(n+.05)/(i+.05)},um.prototype.get=function(t){var e,i,n,r,o,a;return n=this,o=t.split("."),r=o[0],e=o[1],a=n[r](),e?(i=r.indexOf(e),i>-1?a[i]:console.warn("unknown channel "+e+" in mode "+r)):a},um.prototype.set=function(t,e){var i,n,r,o,a,s;if(r=this,a=t.split("."),o=a[0],i=a[1],i)if(s=r[o](),n=o.indexOf(i),n>-1)if("string"===Tg(e))switch(e.charAt(0)){case"+":s[n]+=+e;break;case"-":s[n]+=+e;break;case"*":s[n]*=+e.substr(1);break;case"/":s[n]/=+e.substr(1);break;default:s[n]=+e}else s[n]=e;else console.warn("unknown channel "+i+" in mode "+o);else s=e;return r._rgb=Cm(s,o).alpha(r.alpha())._rgb,r},um.prototype.darken=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lab(),e[0]-=lm.Kn*t,Cm.lab(e).alpha(i.alpha())},um.prototype.brighten=function(t){return null==t&&(t=1),this.darken(-t)},um.prototype.darker=um.prototype.darken,um.prototype.brighter=um.prototype.brighten,um.prototype.saturate=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lch(),e[1]+=t*lm.Kn,e[1]<0&&(e[1]=0),Cm.lch(e).alpha(i.alpha())},um.prototype.desaturate=function(t){return null==t&&(t=1),this.saturate(-t)},um.prototype.premultiply=function(){var t,e;return e=this.rgb(),t=this.alpha(),Cm(e[0]*t,e[1]*t,e[2]*t,t)},Sm=function(t,e,i){if(!Sm[i])throw"unknown blend mode "+i;return Sm[i](t,e)},Am=function(t){return function(e,i){var n,r;return n=Cm(i).rgb(),r=Cm(e).rgb(),Cm(t(n,r),"rgb")}},Nm=function(t){return function(e,i){var n,r,o;for(o=[],n=r=0;r<=3;n=++r)o[n]=t(e[n],i[n]);return o}},og=function(t,e){return t},rg=function(t,e){return t*e/255},Om=function(t,e){return t>e?e:t},Qm=function(t,e){return t>e?t:e},Ag=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},sg=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},Pm=function(t,e){return 255*(1-(1-e/255)/(t/255))},Dm=function(t,e){return 255===t?255:(t=255*(e/255)/(1-t/255),t>255?255:t)},Sm.normal=Am(Nm(og)),Sm.multiply=Am(Nm(rg)),Sm.screen=Am(Nm(Ag)),Sm.overlay=Am(Nm(sg)),Sm.darken=Am(Nm(Om)),Sm.lighten=Am(Nm(Qm)),Sm.dodge=Am(Nm(Dm)),Sm.burn=Am(Nm(Pm)), -Cm.blend=Sm,Cm.analyze=function(t){var e,i,n,r;for(n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},i=0,e=t.length;in.max&&(n.max=r),n.count+=1);return n.domain=[n.min,n.max],n.limits=function(t,e){return Cm.limits(n,t,e)},n},Cm.scale=function(t,e){var i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v,y,b,x,_,w;return h="rgb",l=Cm("#ccc"),m=0,s=!1,a=[0,1],p=[],f=[0,0],i=!1,r=[],d=!1,u=0,c=1,o=!1,n={},_=function(t){var e,i,n,o,a,s,c;if(null==t&&(t=["#fff","#000"]),null!=t&&"string"===Tg(t)&&null!=(null!=(o=Cm.brewer)?o[t]:void 0)&&(t=Cm.brewer[t]),"array"===Tg(t)){for(t=t.slice(0),e=n=0,a=t.length-1;0<=a?n<=a:n>=a;e=0<=a?++n:--n)i=t[e],"string"===Tg(i)&&(t[e]=Cm(i));for(p.length=0,e=c=0,s=t.length-1;0<=s?c<=s:c>=s;e=0<=s?++c:--c)p.push(e/(t.length-1))}return x(),r=t},y=function(t){var e,n;if(null!=i){for(n=i.length-1,e=0;e=i[e];)e++;return e-1}return 0},w=function(t){return t},g=function(t){var e,n,r,o,a;return a=t,i.length>2&&(o=i.length-1,e=y(t),r=i[0]+(i[1]-i[0])*(0+.5*m),n=i[o-1]+(i[o]-i[o-1])*(1-.5*m),a=u+(i[e]+.5*(i[e+1]-i[e])-r)/(n-r)*(c-u)),a},b=function(t,e){var o,a,s,d,m,g,v,b;if(null==e&&(e=!1),isNaN(t))return l;if(e?b=t:i&&i.length>2?(o=y(t),b=o/(i.length-2),b=f[0]+b*(1-f[0]-f[1])):c!==u?(b=(t-u)/(c-u),b=f[0]+b*(1-f[0]-f[1]),b=Math.min(1,Math.max(0,b))):b=1,e||(b=w(b)),d=Math.floor(1e4*b),n[d])a=n[d];else{if("array"===Tg(r))for(s=m=0,v=p.length-1;0<=v?m<=v:m>=v;s=0<=v?++m:--m){if(g=p[s],b<=g){a=r[s];break}if(b>=g&&s===p.length-1){a=r[s];break}if(b>g&&b=h;e=0<=h?++l:--l)p.push(e/(n-1));return a=[u,c],v},v.mode=function(t){return arguments.length?(h=t,x(),v):h},v.range=function(t,e){return _(t,e),v},v.out=function(t){return d=t,v},v.spread=function(t){return arguments.length?(m=t,v):m},v.correctLightness=function(t){return null==t&&(t=!0),o=t,x(),w=o?function(t){var e,i,n,r,o,a,s,c,u;for(e=b(0,!0).lab()[0],i=b(1,!0).lab()[0],s=e>i,n=b(t,!0).lab()[0],o=e+(i-e)*t,r=n-o,c=0,u=1,a=20;Math.abs(r)>.01&&a-- >0;)!function(){return s&&(r*=-1),r<0?(c=t,t+=.5*(u-t)):(u=t,t+=.5*(c-t)),n=b(t,!0).lab()[0],r=n-o}();return t}:function(t){return t},v},v.padding=function(t){return null!=t?("number"===Tg(t)&&(t=[t,t]),f=t,v):f},v.colors=function(){var e,n,r,o,s,c,u,h,l;if(o=0,s="hex",1===arguments.length&&("string"===Tg(arguments[0])?s=arguments[0]:o=arguments[0]),2===arguments.length&&(o=arguments[0],s=arguments[1]),o)return n=a[0],e=a[1]-n,function(){u=[];for(var t=0;0<=o?to;0<=o?t++:t--)u.push(t);return u}.apply(this).map(function(t){return v(n+t/(o-1)*e)[s]()});if(t=[],h=[],i&&i.length>2)for(r=l=1,c=i.length;1<=c?lc;r=1<=c?++l:--l)h.push(.5*(i[r-1]+i[r]));else h=a;return h.map(function(t){return v(t)[s]()})},v},null==Cm.scales&&(Cm.scales={}),Cm.scales.cool=function(){return Cm.scale([Cm.hsl(180,1,.9),Cm.hsl(250,.7,.4)])},Cm.scales.hot=function(){return Cm.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},Cm.analyze=function(t,e,i){var n,r,o,a,s,c,u;if(s={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},null==i&&(i=function(){return!0}),n=function(t){null==t||isNaN(t)||(s.values.push(t),s.sum+=t,ts.max&&(s.max=t),s.count+=1)},u=function(t,r){if(i(t,r))return n(null!=e&&"function"===Tg(e)?e(t):null!=e&&"string"===Tg(e)||"number"===Tg(e)?t[e]:t)},"array"===Tg(t))for(a=0,o=t.length;a=F;w=1<=F?++O:--O)M.push(C+w/i*(ng-C));M.push(ng)}else if("l"===e.substr(0,1)){if(C<=0)throw"Logarithmic scales are only possible for values > 0";for(T=Math.LOG10E*tg(C),P=Math.LOG10E*tg(ng),M.push(C),w=nt=1,z=i-1;1<=z?nt<=z:nt>=z;w=1<=z?++nt:--nt)M.push(cg(10,T+w/i*(P-T)));M.push(ng)}else if("q"===e.substr(0,1)){for(M.push(C),w=n=1,G=i-1;1<=G?n<=G:n>=G;w=1<=G?++n:--n)D=it.length*w/i,N=km(D),N===D?M.push(it[N]):(k=D-N,M.push(it[N]*k+it[N+1]*(1-k)));M.push(ng)}else if("k"===e.substr(0,1)){for(I=it.length,g=new Array(I),x=new Array(i),Q=!0,L=0,y=null,y=[],y.push(C),w=r=1,H=i-1;1<=H?r<=H:r>=H;w=1<=H?++r:--r)y.push(C+w/i*(ng-C));for(y.push(ng);Q;){for(S=o=0,W=i-1;0<=W?o<=W:o>=W;S=0<=W?++o:--o)x[S]=0;for(w=a=0,X=I-1;0<=X?a<=X:a>=X;w=0<=X?++a:--a){for(et=it[w],E=Number.MAX_VALUE,S=s=0,q=i-1;0<=q?s<=q:s>=q;S=0<=q?++s:--s)_=xm(y[S]-et),_=Y;S=0<=Y?++c:--c)R[S]=null;for(w=u=0,Z=I-1;0<=Z?u<=Z:u>=Z;w=0<=Z?++u:--u)b=g[w],null===R[b]?R[b]=it[w]:R[b]+=it[w];for(S=h=0,K=i-1;0<=K?h<=K:h>=K;S=0<=K?++h:--h)R[S]*=1/x[S];for(Q=!1,S=l=0,B=i-1;0<=B?l<=B:l>=B;S=0<=B?++l:--l)if(R[S]!==y[w]){Q=!0;break}y=R,L++,L>200&&(Q=!1)}for(A={},S=d=0,U=i-1;0<=U?d<=U:d>=U;S=0<=U?++d:--d)A[S]=[];for(w=f=0,j=I-1;0<=j?f<=j:f>=j;w=0<=j?++f:--f)b=g[w],A[b].push(it[w]);for(tt=[],S=p=0,$=i-1;0<=$?p<=$:p>=$;S=0<=$?++p:--p)tt.push(A[S][0]),tt.push(A[S][A[S].length-1]);for(tt=tt.sort(function(t,e){return t-e}),M.push(tt[0]),w=m=1,V=tt.length-1;m<=V;w=m+=2)isNaN(tt[w])||M.push(tt[w])}return M},zm=function(t,e,i){var n,r,o,a;return n=Eg(arguments),t=n[0],e=n[1],i=n[2],t/=360,t<1/3?(r=(1-e)/3,a=(1+e*Lm(mm*t)/Lm(fm-mm*t))/3,o=1-(r+a)):t<2/3?(t-=1/3,a=(1-e)/3,o=(1+e*Lm(mm*t)/Lm(fm-mm*t))/3,r=1-(a+o)):(t-=2/3,o=(1-e)/3,r=(1+e*Lm(mm*t)/Lm(fm-mm*t))/3,a=1-(o+r)),a=Jm(i*a*3),o=Jm(i*o*3),r=Jm(i*r*3),[255*a,255*o,255*r,n.length>3?n[3]:1]},dg=function(){var t,e,i,n,r,o,a,s;return a=Eg(arguments),o=a[0],e=a[1],t=a[2],mm=2*Math.PI,o/=255,e/=255,t/=255,r=Math.min(o,e,t),n=(o+e+t)/3,s=1-r/n,0===s?i=0:(i=(o-e+(o-t))/2,i/=Math.sqrt((o-e)*(o-e)+(o-t)*(e-t)),i=Math.acos(i),t>e&&(i=mm-i),i/=mm),[360*i,s,n]},Cm.hsi=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(um,Og.call(arguments).concat(["hsi"]),function(){})},ym.hsi=zm,um.prototype.hsi=function(){return dg(this._rgb)},Vm=function(t,e,i,n){var r,o,a,s,c,u,h,l,d,f,p,m,g;return"hsl"===n?(m=t.hsl(),g=e.hsl()):"hsv"===n?(m=t.hsv(),g=e.hsv()):"hsi"===n?(m=t.hsi(),g=e.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",m=t.hcl(),g=e.hcl()),"h"===n.substr(0,1)&&(a=m[0],f=m[1],u=m[2],s=g[0],p=g[1],h=g[2]),isNaN(a)||isNaN(s)?isNaN(a)?isNaN(s)?o=Number.NaN:(o=s,1!==u&&0!==u||"hsv"===n||(d=p)):(o=a,1!==h&&0!==h||"hsv"===n||(d=f)):(r=s>a&&s-a>180?s-(a+360):s180?s+360-a:s-a,o=a+i*r),null==d&&(d=f+i*(p-f)),c=u+i*(h-u),l=Cm[n](o,d,c)},bm=bm.concat(function(){var t,e,i,n;for(i=["hsv","hsl","hsi","hcl","lch"],n=[],e=0,t=i.length;e>16&255)/255,e[i+1]=(t>>8&255)/255,e[i+2]=(255&t)/255,e},atomColor:function(){return 16777215},atomColorToArray:function(t,e,i){return this.colorToArray(this.atomColor(t),e,i)},bondColor:function(t,e){return this.atomProxy.index=e?t.atomIndex1:t.atomIndex2,this.atomColor(this.atomProxy)},bondColorToArray:function(t,e,i,n){return this.colorToArray(this.bondColor(t,e),i,n)},volumeColor:function(){return 16777215},volumeColorToArray:function(t,e,i){return this.colorToArray(this.volumeColor(t),e,i)},positionColor:function(){return 16777215},positionColorToArray:function(t,e,i){return this.colorToArray(this.positionColor(t),e,i)}},vn.prototype=gn.prototype,vn.prototype.constructor=vn,yn.prototype=gn.prototype,yn.prototype.constructor=yn,bn.prototype=gn.prototype,bn.prototype.constructor=bn,xn.prototype=gn.prototype,xn.prototype.constructor=xn,_n.prototype=gn.prototype,_n.prototype.constructor=_n,wn.prototype=gn.prototype,wn.prototype.constructor=wn,Sn.prototype=gn.prototype,Sn.prototype.constructor=Sn,An.prototype=gn.prototype,An.prototype.constructor=An,Mn.prototype=gn.prototype,Mn.prototype.constructor=Mn,Pn.prototype=gn.prototype,Pn.prototype.constructor=Pn,Cn.prototype=gn.prototype,Cn.prototype.constructor=Cn,Tn.prototype=gn.prototype,Tn.prototype.constructor=Tn,En.prototype=gn.prototype,En.prototype.constructor=En,In.prototype=gn.prototype,In.prototype.constructor=In,Ln.prototype=gn.prototype,Ln.prototype.constructor=Ln,Rn.prototype=gn.prototype,Rn.prototype.constructor=Rn,On.prototype=gn.prototype,On.prototype.constructor=On,Dn.prototype=gn.prototype,Dn.prototype.constructor=Dn,Nn.prototype=gn.prototype,Nn.prototype.constructor=Nn,kn.prototype=gn.prototype,kn.prototype.constructor=kn,mn.types={"":gn,picking:bn,random:xn,uniform:_n,atomindex:wn,residueindex:Sn,chainindex:An,chainname:Mn,chainid:Pn,polymer:Cn,modelindex:Tn,entitytype:En,moleculetype:In,sstruc:Ln,element:Rn,resname:On,bfactor:Dn,hydrophobicity:kn,value:yn,volume:vn,occupancy:Nn};var jg=o(),$g="undefined"!=typeof window&&"undefined"!=typeof window.orientation,Vg=!1,Gg=!1,Hg={log:Function.prototype.bind.call(console.log,console),info:Function.prototype.bind.call(console.info,console),warn:Function.prototype.bind.call(console.warn,console),error:Function.prototype.bind.call(console.error,console),time:Function.prototype.bind.call(console.time,console),timeEnd:Function.prototype.bind.call(console.timeEnd,console)};t.Debug=i(e("debug"));var Wg='

Your browser/graphics card does not seem to support WebGL.

Find out how to get it here.

',Xg=new b,qg=new mn,Yg=new p("datasource"),Zg=new p("representatation"),Kg=new p("parser"),Qg=new p("shader"),Jg=new p("decompressor");Un.prototype={constructor:Un,type:"",__srcName:void 0,isBinary:function(){return this.binary||this.compressed},onload:function(){},onprogress:function(){},onerror:function(){},read:function(t){this._read(function(e){var i=Jg.get(this.compressed);this.compressed&&i?this.data=i(e):((this.binary||this.compressed)&&e instanceof ArrayBuffer&&(e=new Uint8Array(e)),this.data=e),"function"==typeof this.onload&&this.onload(this.data),t()}.bind(this))},_read:function(t){t(this.src)},_chunk:function(t,e){return e=Math.min(this.data.length,e),0===t&&this.data.length===e?this.data:this.isBinary()?this.data.subarray(t,e):this.data.substring(t,e)},chunk:function(t){var e=t+this.chunkSize;return this._chunk(t,e)},peekLines:function(t){var e,i=this.data,n=i.length,r=this.isBinary()?this.newline.charCodeAt(0):this.newline,o=0;for(e=0;en);return s.lines},lineCount:function(){console.warn("lineCount - deprecated");for(var t=this.data,e=t.length,i=this.isBinary()?this.newline.charCodeAt(0):this.newline,n=0,r=0;rthis.data.length))return this.__pointer+=this.chunkSize,this.chunk(t)},nextChunkOfLines:function(){var t=this.nextChunk();if(void 0!==t){var e=this.__pointer>this.data.length,i=this.chunkToLines(t,this.__partialLine,e);return this.__partialLine=i.partialLine,i.lines}},eachChunk:function(t){for(var e=this.chunkSize,i=this.data.length,n=this.chunkCount(),r=0;r=0),o[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o[6]?parseInt(o[6]):0);break;case"e":i=o[7]?parseFloat(i).toExponential(o[7]):parseFloat(i).toExponential();break;case"f":i=o[7]?parseFloat(i).toFixed(o[7]):parseFloat(i);break;case"g":i=o[7]?parseFloat(i).toPrecision(o[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=String(i),i=o[7]?i.substring(0,o[7]):i;break;case"t":i=String(!!i),i=o[7]?i.substring(0,o[7]):i;break;case"T":i=Kn(i),i=o[7]?i.substring(0,o[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o[7]?i.substring(0,o[7]):i;break;case"x":i=parseInt(i,10).toString(16);break;case"X":i=parseInt(i,10).toString(16).toUpperCase()}tv.json.test(o[8])?d[d.length]=i:(!tv.number.test(o[8])||f&&!o[3]?p="":(p=f?"+":"-",i=i.toString().replace(tv.sign,"")),s=o[4]?"0"===o[4]?"0":o[4].charAt(1):" ",c=o[6]-(p+i).length,a=o[6]&&c>0?Qn(s,c):"",d[d.length]=o[5]?p+i+a:"0"===s?p+a+i:a+p+i)}return d.join("")},Zn.cache={},Zn.parse=function(t){for(var e=t,i=[],n=[],r=0;e;){if(null!==(i=tv.text.exec(e)))n[n.length]=i[0];else if(null!==(i=tv.modulo.exec(e)))n[n.length]="%";else{if(null===(i=tv.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(i[2]){r|=1;var o=[],a=i[2],s=[];if(null===(s=tv.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=s[1];""!==(a=a.substring(s[0].length));)if(null!==(s=tv.key_access.exec(a)))o[o.length]=s[1];else{if(null===(s=tv.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=s[1]}i[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=i}e=e.substring(i[0].length)}return n};var ev={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};tr.prototype={clear:function(){this.change(-this.count)},change:function(t){this.count+=t,this.signals.countChanged.dispatch(t,this.count),this.count<0&&Hg.warn("Counter.count below zero",this.count)},increment:function(){this.change(1)},decrement:function(){this.change(-1)},listen:function(t){this.change(t.count),t.signals.countChanged.add(this.change,this)},unlisten:function(t){var e=t.signals.countChanged;e.has(this.change,this)&&e.remove(this.change,this)},onZeroOnce:function(t,e){if(0===this.count)t.call(e,0,0);else{var i=function(){0===this.count&&(this.signals.countChanged.remove(i,this),t.apply(e,arguments))};this.signals.countChanged.add(i,this)}},dispose:function(){this.clear(),this.signals.countChanged.dispose()}},er.prototype={constructor:er,getBaseObject:function(t){return"StructureView"===t.type&&(t=t.getStructure()),t},addObject:function(t){t=this.getBaseObject(t);var e=this.allocateGidRange(t);return e&&(this.objectList.push(t),this.rangeList.push(e)),this},removeObject:function(t){t=this.getBaseObject(t);var e=this.objectList.indexOf(t);return e!==-1&&(this.objectList.splice(e,1),this.rangeList.splice(e,1),0===this.objectList.length&&(this.nextGid=1)),this},updateObject:function(t,e){t=this.getBaseObject(t);var i=this.objectList.indexOf(t);if(i!==-1){var n=this.rangeList[i];if(n[1]===this.nextGid){var r=this.getGidCount(t);this.nextGid+=r-(n[1]-n[0]),n[1]=this.nextGid}else this.rangeList[i]=this.allocateGidRange(t)}else e||Hg.warn("GidPool.updateObject: object not found.");return this},getGidCount:function(t){t=this.getBaseObject(t);var e=0;return"Structure"===t.type?e=t.atomStore.count+t.bondStore.count+t.backboneBondStore.count+t.rungBondStore.count:"Volume"===t.type?e=t.__data.length:Hg.warn("GidPool.getGidCount: unknown object type"),e},allocateGidRange:function(t){t=this.getBaseObject(t);var e=this.getGidCount(t);if(e>Math.pow(10,7))return Hg.warn("GidPool.allocateGidRange: gidCount too large"),null;var i=this.nextGid;return this.nextGid+=e,this.nextGid>Math.pow(2,24)&&Hg.error("GidPool.allocateGidRange: GidPool overflown"),[i,this.nextGid]},getNextGid:function(){return this.nextGid++},getGid:function(t,e){t=this.getBaseObject(t),e=e||0;var i=0,n=this.objectList.indexOf(t);if(n!==-1){var r=this.rangeList[n],o=r[0];i=o+e}else Hg.warn("GidPool.getGid: object not found.");return i},getByGid:function(t){var e;return this.objectList.forEach(function(i,n){var r=this.rangeList[n];if(!(t=r[1])){var o=t-r[0];"Structure"===i.type?othis.prevFpsTime+1e3&&(this.lastFps=this.frames,this.prevFpsTime=t,this.frames=0),t}},nr.prototype=Object.create(x.prototype),nr.prototype.constructor=nr,Qg.add("shader/chunk/dull_interior_fragment.glsl","#ifdef DULL_INTERIOR\nif( gl_FrontFacing == false ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#endif"),Qg.add("shader/chunk/fog_fragment.glsl","#ifdef USE_FOG\nfloat depth = length( vViewPosition );\n#ifdef FOG_EXP2\nfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"),Qg.add("shader/chunk/nearclip_vertex.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip - 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),Qg.add("shader/chunk/nearclip_fragment.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip )\ndiscard;\n#endif"),Qg.add("shader/chunk/radiusclip_vertex.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius + 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),Qg.add("shader/chunk/radiusclip_fragment.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius )\ndiscard;\n#endif"),Qg.add("shader/chunk/opaque_back_fragment.glsl","#ifdef OPAQUE_BACK\n#ifdef FLIP_SIDED\nif( gl_FrontFacing == true ){\ngl_FragColor.a = 1.0;\n}\n#else\nif( gl_FrontFacing == false ){\ngl_FragColor.a = 1.0;\n}\n#endif\n#endif");var iv=/^(?!\/\/)\s*#include\s+(\S+)/gim,nv={};ar.prototype.constructor=ar;var rv=2*Math.PI,ov=new P,av=new A,sv=new A,cv=new A,uv=new A;WebGLRenderingContext&&(WebGLRenderingContext.prototype.getShaderParameter=function(){var e=WebGLRenderingContext.prototype.getShaderParameter;return function(){return!t.Debug||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getShaderInfoLog=function(){var e=WebGLRenderingContext.prototype.getShaderInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}(),WebGLRenderingContext.prototype.getProgramParameter=function(){var e=WebGLRenderingContext.prototype.getProgramParameter;return function(i,n){return!t.Debug&&n===WebGLRenderingContext.prototype.LINK_STATUS||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getProgramInfoLog=function(){var e=WebGLRenderingContext.prototype.getProgramInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}());var hv=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];hv.forEach(function(t){t.forEach(function(t){t[0]*=.0625,t[1]*=.0625})}),br.prototype.constructor=br;var lv=2,dv=3,fv=function(e,i){function r(t){var e=Object.assign({},t);u=n(e.hoverTimeout,u)}function o(t,e){var i,n,r,o=s.pick(t.canvasPosition.x,t.canvasPosition.y),a=o.instance,u=c.getByGid(o.gid);return u&&"AtomProxy"===u.type?i=u:u&&"BondProxy"===u.type?n=u:u&&"Volume"===u.volume.type&&(r=u),(i||n||r)&&t.which===lv&&e&&(i?l.copy(i):n?l.copy(n.atom1).add(n.atom2).multiplyScalar(.5):r&&l.copy(r),a&&l.applyProjection(a.matrix),s.centerView(!1,l)),{atom:i,bond:n,volume:r,instance:a}}function a(){if(performance.now()-d.lastMoved>u&&(d.moving=!1),!d.moving&&!d.hovering){d.hovering=!0;var t=o(d);h.hovered.dispatch(t)}requestAnimationFrame(a)}var s=e.viewer,c=e.gidPool,u=50;r(i);var h={clicked:new ln,hovered:new ln},l=new P,d={position:new _,down:new _,canvasPosition:new _,moving:!1,hovering:!0,lastMoved:1/0,which:void 0,distance:function(){return d.position.distanceTo(d.down)},setCanvasPosition:function(t){var e=s.renderer.domElement.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top;d.canvasPosition.set(i,e.height-n)}};a(),s.renderer.domElement.addEventListener("mousemove",function(t){ -t.preventDefault(),d.moving=!0,d.hovering=!1,d.lastMoved=performance.now(),d.position.set(t.layerX,t.layerY),d.setCanvasPosition(t)}),s.renderer.domElement.addEventListener("mousedown",function(t){t.preventDefault(),d.moving=!1,d.hovering=!1,d.down.set(t.layerX,t.layerY),d.which=t.which,d.setCanvasPosition(t)}),s.renderer.domElement.addEventListener("mouseup",function(e){if(e.preventDefault(),!(d.distance()>3||e.which===dv)){var i=o(d,!0);d.which=void 0,h.clicked.dispatch(i),t.Debug&&Hg.log("clicked",i)}}),this.signals=h,this.setParameters=r};xr.prototype.add=function(t){this.count<<5<=t&&this.resize(t),this.words[t>>>5]|=1<>>5]|=1<>>5]^=1<>>5]^=1<>>5)+1,r=(e>>>5)-1,o=0|n;o+7>>5]|=1<>>5]|=1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&1<0;)0===this.words[this.count-1]&&this.count--;this.words=this.words.slice(0,this.count)},xr.prototype.resize=function(t){if(this.length=t,!(this.count<<5>t)&&(this.count=t+32>>>5,this.words.length<<5<=t)){var e=new Uint32Array(this.count<<1);e.set(this.words),this.words=e}},xr.prototype.hammingWeight=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},xr.prototype.size=function(){for(var t=0,e=this.count,i=0;i=t&&eo?a.set(this[n].subarray(0,o)):a.set(this[n]),this[n]=a}},growIfFull:function(){if(this.count>=this.length){var t=Math.round(1.5*this.length);this.resize(Math.max(256,t))}},copyFrom:function(t,e,i,n){for(var r=0,o=this.__fields.length;r0;)s-=1;a<=s&&(a===o?o=s:s===o&&(o=a),e(a,s),a+=1,s-=1)}while(a<=s);i(n,s),i(a,r)}}Hg.time("Store.sort");var n=this,r=new this.constructor(1);i(0,this.count-1),Hg.timeEnd("Store.sort")},clear:function(){this.count=0},dispose:function(){delete this.length,delete this.count;for(var t=0,e=this.__fields.length;t0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),p[i]=180/Math.PI*Math.acos(t),n=b.length(),r=x.length(),d[i]=Math.sqrt(r*n)/Math.max(2,2*(1-t)),f[i]=Math.abs(v.dot(A)),_.copy(b).multiplyScalar(d[i]/n),w.copy(x).multiplyScalar(d[i]/r),_.subVectors(L,_),w.subVectors(R,w),_.toArray(u,e+3),w.toArray(u,e+6),C.subVectors(I,T),C.toArray(m,e),M.copy(A),T.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),A.subVectors(_,w).normalize(),I.index=o.getAtomIndexByType(0,E),T.copy(I),S.copy(I),Sr(S,A,_),S.toArray(u,0),C.subVectors(T,_),C.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),A.subVectors(_,w).normalize(),I.index=o.getAtomIndexByType(s-1,E),T.copy(I),S.copy(I),Sr(S,A,_),S.toArray(u,3*s-3),i=s-3;ie?z=!0:h.bending[B]>t&&(z=!0)),z){if(B-v<4){v=B,z=!1;continue}N.index=O.traceAtomIndex,E=h.axis.subarray(3*v+3,3*B),I=h.center.subarray(3*v,3*B+3),d=wr(E).normalize(),f=wr(I),L.fromArray(I),Sr(L,d,f),R.fromArray(I,I.length-3),Sr(R,d,f),d.subVectors(R,L),d.toArray(b,y),f.toArray(x,y),L.toArray(_,y),R.toArray(w,y),p.atomColorToArray(N,S,y),m.atomColorToArray(N,A,y),M.push(g.atomRadius(N)),C.push(u+v),T.push(u+B+1-v),y+=3,v=B,z=!1}return{axis:new Float32Array(b),center:new Float32Array(x),begin:new Float32Array(_),end:new Float32Array(w),color:new Float32Array(S),pickingColor:new Float32Array(A),size:new Float32Array(M),residueOffset:C,residueCount:T}}},xo.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},peek:function(){return this.content[0]},remove:function(t){for(var e=this.content.length,i=0;i0;){var i=Math.floor((t+1)/2)-1,n=this.content[i];if(!(this.scoreFunction(e)":"3/4-Z","?":"X-Y","@":"Y-X",A:"Z+1/3",B:"Z+2/3",C:"X+2/3",D:"Y+1/3",E:"-Y+2/3",F:"X-Y+1/3",G:"Y-X+2/3",H:"-X+1/3",I:"X+1/3",J:"Y+2/3",K:"-Y+1/3",L:"X-Y+2/3",M:"Y-X+1/3",N:"-X+2/3",O:"2/3+X",P:"1/3+Y",Q:"1/3+Z",R:"2/3-Y",S:"1/3+X-Y",T:"2/3+Y-X",U:"1/3-X",V:"2/3-X",W:"1/3-Y",X:"1/3-Z",Y:"2/3+Y",Z:"1/3+Y-X","[":"2/3+X-Y","]":"1/3+X","^":"2/3+Z",_:"2/3-Z","`":"5/6+Z",a:"1/6+Z",b:"5/6-Z",c:"1/6-Z",d:"Z+5/6",e:"Z+1/6",f:"Z+1/4",g:"+Y"},yv={"P 1":" !#","P -1":" !#$%&","P 1 2 1":" !#$!&","P 1 21 1":" !#$'&","C 1 2 1":" !#$!&()#*)&","P 1 m 1":" !# %#","P 1 c 1":" !# %+","C 1 m 1":" !# %#()#(,#","C 1 c 1":" !# %+()#(,+","P 1 2/m 1":" !# %#$!&$%&","P 1 21/m 1":" !#$)&$%& ,#","C 1 2/m 1":" !# %#$!&$%&()#(,#*)&*,&","P 1 2/c 1":" !#$!-$%& %+","P 1 21/c 1":" !#$%&$)- ,+","C 1 2/c 1":" !#$!-$%& %+()#*)-*,&(,+","P 2 2 2":" !#$%#$!& %&","P 2 2 21":" !#$%+$!- %&","P 21 21 2":" !#$%#*)&(,&","P 21 21 21":" !#*%+$)-(,&","C 2 2 21":" !#$%+$!- %&()#*,+*)-(,&","C 2 2 2":" !#$%#$!& %&()#*,#*)&(,&","F 2 2 2":" !#$%#$!& %& )+$,+$)- ,-(!+*%+*!-(%-()#*,#*)&(,&","I 2 2 2":" !#$%# %&$!&.'/01/.120'2","I 21 21 21":" !#*%+$)-(,&()+$,#*!& %-","P m m 2":" !#$%# %#$!#","P m c 21":" !#$%+ %+$!#","P c c 2":" !#$%# %+$!+","P m a 2":" !#$%#(%#*!#","P c a 21":" !#$%+(%#*!+","P n c 2":" !#$%# ,+$)+","P m n 21":" !#*%+(%+$!#","P b a 2":" !#$%#(,#*)#","P n a 21":" !#$%+(,#*)+","P n n 2":" !#$%#(,+*)+","C m m 2":" !#$%# %#$!#()#*,#(,#*)#","C m c 21":" !#$%+ %+$!#()#*,+(,+*)#","C c c 2":" !#$%# %+$!+()#*,#(,+*)+","A m m 2":" !#$%# %#$!# )+$,+ ,+$)+","A b m 2":" !#$%# ,#$)# )+$,+ %+$!+","A m a 2":" !#$%#(%#*!# )+$,+(,+*)+","A b a 2":" !#$%#(,#*)# )+$,+(%+*!+","F m m 2":" !#$%# %#$!# )+$,+ ,+$)+(!+*%+(%+*!+()#*,#(,#*)#","F d d 2":" !#$%#345675 )+$,+3896:9(!+*%+;49<79()#*,#;85<:5","I m m 2":" !#$%# %#$!#()+*,+(,+*)+","I b a 2":" !#$%#(,#*)#()+*,+ %+$!+","I m a 2":" !#$%#(%#*!#()+*,+ ,+$)+","P 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#","P 2/n 2/n 2/n":" !#$%#$!& %&*,-()-(,+*)+","P 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+","P 2/b 2/a 2/n":" !#$%#$!& %&*,&()&(,#*)#","P 21/m 2/m 2/a":" !#*%#$!&(%&$%&(!& %#*!#","P 2/n 21/n 2/a":" !#*%#*)- ,-$%&(!&(,+$)+","P 2/m 2/n 21/a":" !#*%+*!- %&$%&(!-(%+$!#","P 21/c 2/c 2/a":" !#*%#$!-(%-$%&(!& %+*!+","P 21/b 21/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#","P 21/c 21/c 2/n":" !#*,#$)-(%-$%&()& ,+*!+","P 2/b 21/c 21/m":" !#$%+$)- ,&$%& !- ,+$)#","P 21/n 21/n 2/m":" !#$%#*)-(,-$%& !&(,+*)+","P 21/m 21/m 2/n":" !#$%#*'&.,&*,&.'& %#$!#","P 21/b 2/c 21/n":" !#*,+$!-(,&$%&()- %+*)#","P 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#","P 21/n 21/m 21/a":" !#0%/$'&.12$%&.!2 1#0'/","C 2/m 2/c 21/m":" !#$%+$!- %&$%& !- %+$!#()#*,+*)-(,&*,&()-(,+*)#","C 2/m 2/c 21/a":" !#$,+$)- %&$%& )- ,+$!#()#*%+*!-(,&*,&(!-(%+*)#","C 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()#*,#*)&(,&*,&()&(,#*)#","C 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+()#*,#*)-(,-*,&()&(,+*)+","C 2/m 2/m 2/a":" !#$,#$)& %&$%& )& ,#$!#()#*%#*!&(,&*,&(!&(%#*)#","C 2/c 2/c 2/a":" !#*,#$!&(,&$,-(!- ,+*!+()#$%#*)& %&*%- )-(%+$)+","F 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!# )+$,+$)- ,-$,- )- ,+$)+(!+*%+*!-(%-*%-(!-(%+*!+()#*,#*)&(,&*,&()&(,#*)#","F 2/d 2/d 2/d":" !#$%#$!& %&64=37=345675 )+$,+$)- ,-68>3:>3896:9(!+*%+*!-(%-<4>;7>;49<79()#*,#*)&(,&<8=;:=;85<:5","I 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()+*,+*)-(,-*,-()-(,+*)+","I 2/b 2/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#()+*,+$!- %-*,-()- %+$!+","I 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#()+$,#*!& %-*,- )&(%#$!+","I 21/m 21/m 21/a":" !#$,#$)& %&$%& )& ,#$!#()+*%+*!-(,-*,-(!-(%+*)+","P 4":" !#$%#% #!$#","P 41":" !#$%+% 5!$9","P 42":" !#$%#% +!$+","P 43":" !#$%+% 9!$5","I 4":" !#$%#% #!$#()+*,+,(+)*+","I 41":" !#*,+%(5)$9()+$%#, 9!*5","P -4":" !#$%#!$&% &","I -4":" !#$%#!$&% &()+*,+)*-,(-","P 4/m":" !#$%#% #!$#$%& !&!$&% &","P 42/m":" !#$%#% +!$+$%& !&!$-% -","P 4/n":" !#$%#,(#)*#*,&()&!$&% &","P 42/n":" !#$%#,(+)*+*,-()-!$&% &","I 4/m":" !#$%#% #!$#$%& !&!$&% &()+*,+,(+)*+*,-()-)*-,(-","I 41/a":" !#*,+%(5)$9$,=(!>!$&,(-()+$%#, 9!*5*%> )=)*-% &","P 4 2 2":" !#$%#% #!$#$!& %&! &%$&","P 4 21 2":" !#$%#,(#)*#*)&(,&! &%$&","P 41 2 2":" !#$%+% 5!$9$!& %-! >%$=","P 41 21 2":" !#$%+,(5)*9*)=(,>! &%$-","P 42 2 2":" !#$%#% +!$+$!& %&! -%$-","P 42 21 2":" !#$%#,(+)*+*)-(,-! &%$&","P 43 2 2":" !#$%+% 9!$5$!& %-! =%$>","P 43 21 2":" !#$%+,(9)*5*)>(,=! &%$-","I 4 2 2":" !#$%#% #!$#$!& %&! &%$&()+*,+,(+)*+*)-(,-)(-,*-","I 41 2 2":" !#*,+%(5)$9*!> ,=)(-%$&()+$%#, 9!*5$)=(%>! &,*-","P 4 m m":" !#$%#% #!$# %#$!#%$#! #","P 4 b m":" !#$%#% #!$#(,#*)#,*#)(#","P 42 c m":" !#$%#% +!$+ %+$!+%$#! #","P 42 n m":" !#$%#,(+)*+(,+*)+%$#! #","P 4 c c":" !#$%#% #!$# %+$!+%$+! +","P 4 n c":" !#$%#% #!$#(,+*)+,*+)(+","P 42 m c":" !#$%#% +!$+ %#$!#%$+! +","P 42 b c":" !#$%#% +!$+(,#*)#,*+)(+","I 4 m m":" !#$%#% #!$# %#$!#%$#! #()+*,+,(+)*+(,+*)+,*+)(+","I 4 c m":" !#$%#% #!$# %+$!+%$+! +()+*,+,(+)*+(,#*)#,*#)(#","I 41 m d":" !#*,+%(5)$9 %#*)+%*5) 9()+$%#, 9!*5(,+$!#,$9!(5","I 41 c d":" !#*,+%(5)$9 %+*)#%*9) 5()+$%#, 9!*5(,#$!+,$5!(9","P -4 2 m":" !#$%#% &!$&$!& %&%$#! #","P -4 2 c":" !#$%#% &!$&$!- %-%$+! +","P -4 21 m":" !#$%#% &!$&*)&(,&,*#)(#","P -4 21 c":" !#$%#% &!$&*)-(,-,*+)(+","P -4 m 2":" !#$%#!$&% & %#$!#! &%$&","P -4 c 2":" !#$%#% &!$& %+$!+! -%$-","P -4 b 2":" !#$%#% &!$&(,#*)#)(&,*&","P -4 n 2":" !#$%#% &!$&(,+*)+)(-,*-","I -4 m 2":" !#$%#% &!$& %#$!#! &%$&()+*,+,(-)*-(,+*)+)(-,*-","I -4 c 2":" !#$%#% &!$& %+$!+! -%$-()+*,+,(-)*-(,#*)#)(&,*&","I -4 2 m":" !#$%#% &!$&$!& %&%$#! #()+*,+,(-)*-*)-(,-,*+)(+","I -4 2 d":" !#$%#% &!$&*!>(%>,$9) 9()+*,+,(-)*-$)= ,=%*5!(5","P 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #","P 4/m 2/c 2/c":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +","P 4/n 2/b 2/m":" !#$%#% #!$#$!& %&! &%$&*,&()&)*&,(&(,#*)#,*#)(#","P 4/n 2/n 2/c":" !#$%#% #!$#$!& %&! &%$&*,-()-)*-,(-(,+*)+,*+)(+","P 4/m 21/b 2/m":" !#$%#% #!$#*)&(,&)(&,*&$%& !&!$&% &(,#*)#,*#)(#","P 4/m 21/n 2/c":" !#$%#% #!$#*)-(,-)(-,*-$%& !&!$&% &(,+*)+,*+)(+","P 4/n 21/m 2/m":" !#$%#,(#)*#*)&(,&! &%$&*,&()&!$&% & %#$!#,*#)(#","P 4/n 2/c 2/c":" !#$%#,(#)*#*)-(,-! -%$-*,&()&!$&% & %+$!+,*+)(+","P 42/m 2/m 2/c":" !#$%#% +!$+$!& %&! -%$-$%& !&!$-% - %#$!#%$+! +","P 42/m 2/c 2/m":" !#$%#% +!$+$!- %-! &%$&$%& !&!$-% - %+$!+%$#! #","P 42/n 2/b 2/c":" !#$%#,(+)*+$!- %-)(&,*&*,-()-!$&% &(,#*)#%$+! +","P 42/n 2/n 2/m":" !#$%#,(+)*+$!& %&)(-,*-*,-()-!$&% &(,+*)+%$#! #","P 42/m 21/b 2/c":" !#$%#% +!$+*)&(,&)(-,*-$%& !&!$-% -(,#*)#,*+)(+","P 42/m 21/n 2/m":" !#$%#,./'*/*'-.,-! &%$&$%& !&'*-,.-.,/*'/%$#! #","P 42/n 21/m 2/c":" !#$%#,(+)*+*)-(,-! &%$&*,-()-!$&% & %#$!#,*+)(+","P 42/n 21/c 2/m":" !#$%#,(+)*+*)&(,&! -%$-*,-()-!$&% & %+$!+,*#)(#","I 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #()+*,+,(+)*+*)-(,-)(-,*-*,-()-)*-,(-(,+*)+,*+)(+","I 4/m 2/c 2/m":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +()+*,+,(+)*+*)&(,&)(&,*&*,-()-)*-,(-(,#*)#,*#)(#","I 41/a 2/m 2/d":" !#*,+%(5)$9*!> ,=)(-%$&$,=(!>!$&,(-(,+$!#,$9!(5()+$%#, 9!*5$)=(%>! &,*-*%> )=)*-% & %#*)+%*5) 9","I 41/a 2/c 2/d":" !#*,+%(5)$9*!= ,>)(&%$-$,=(!>!$&,(-(,#$!+,$5!(9()+$%#, 9!*5$)>(%=! -,*&*%> )=)*-% & %+*)#%*9) 5","P 3":" !#%?#@$#","P 31":" !#%?A@$B","P 32":" !#%?B@$A","H 3":" !#%?#@$#CDAEFAGHAIJBKLBMNB","R 3":" !## !!# ","P -3":" !#%?#@$#$%&!@&? &","H -3":" !#%?#@$#$%&!@&? &OPQRSQTUQVWXYZX[]X]Y^W[^ZV^UR_PT_SO_","R -3":" !## !!# $%&&$%%&$","P 3 1 2":" !#%?#@$#%$&@!& ?&","P 3 2 1":" !#%?#@$#! &?%&$@&","P 31 1 2":" !#%?Q@$^%$_@!X ?&","P 31 2 1":" !#%?A@$B! &?%_$@X","P 32 1 2":" !#%?^@$Q%$X@!_ ?&","P 32 2 1":" !#%?B@$A! &?%X$@_","H 3 2":" !#%?#@$#! &?%&$@&OPQRSQTUQY]X[WXVZX]Y^W[^ZV^PO_SR_UT_","R 3 2":" !## !!# %$&$&%&%$","P 3 m 1":" !#%?#@$#%$#@!# ?#","P 3 1 m":" !#%?#@$#! #?%#$@#","P 3 c 1":" !#%?#@$#%$+@!+ ?+","P 3 1 c":" !#%?#@$#! +?%+$@+","H 3 m":" !#%?#@$#%$#@!# ?#OPQRSQTUQRUQTPQOSQ]Y^W[^ZV^WV^ZY^][^","R 3 m":" !## !!# ! # #!#! ","H 3 c":" !#%?#@$#%$+@!+ ?+OPQRSQTUQRU`TP`OS`]Y^W[^ZV^WVaZYa][a","R 3 c":" !## !!# '././'/'.","P -3 1 2/m":" !#%?#@$#%$&@!& ?&$%&!@&? &! #?%#$@#","P -3 1 2/c":" !#%?#@$#%$-@!- ?-$%&!@&? &! +?%+$@+","P -3 2/m 1":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#","P -3 2/c 1":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+","H -3 2/m":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#OPQRSQTUQY]X[WXVZXVWXYZX[]XRUQTPQOSQ]Y^W[^ZV^PO_SR_UT_UR_PT_SO_WV^ZY^][^","R -3 2/m":" !## !!# %$&$&%&%$$%&&$%%&$! # #!#! ","H -3 2/c":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+OPQRSQTUQY]b[WbVZbVWXYZX[]XRU`TP`OS`]Y^W[^ZV^POcSRcUTcUR_PT_SO_WVaZYa][a","R -3 2/c":" !## !!# 102021210$%&&$%%&$'././'/'.","P 6":" !#%?#@$#$%#!@#? #","P 61":" !#%?A@$B$%/!@d? e","P 65":" !#%?B@$A$%/!@e? d","P 62":" !#%?^@$Q$%#!@^? Q","P 64":" !#%?Q@$^$%#!@Q? ^","P 63":" !#%?#@$#$%+!@+? +","P -6":" !#%?#@$# !&%?&@$&","P 6/m":" !#%?#@$#$%#!@#? #$%&!@&? & !&%?&@$&","P 63/m":" !#%?#@$#$%+!@+? +$%&!@&? & !-%?-@$-","P 6 2 2":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&","P 61 2 2":" !#%?Q@$^$%+!@`? a! X?%&$@_%$b@!- ?c","P 65 2 2":" !#%?^@$Q$%+!@a? `! _?%&$@X%$c@!- ?b","P 62 2 2":" !#%?^@$Q$%#!@^? Q! _?%&$@X%$_@!& ?X","P 64 2 2":" !#%?Q@$^$%#!@Q? ^! X?%&$@_%$X@!& ?_","P 63 2 2":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-","P 6 m m":" !#%?#@$#$%#!@#? #%$#@!# ?#! #?%#$@#","P 6 c c":" !#%?#@$#$%#!@#? #%$+@!+ ?+! +?%+$@+","P 63 c m":" !#%?#@$#$%+!@+? +%$+@!+ ?+! #?%#$@#","P 63 m c":" !#%?#@$#$%+!@+? +%$#@!# ?#! +?%+$@+","P -6 m 2":" !#%?#@$# !&%?&@$&%$#@!# ?#%$&@!& ?&","P -6 c 2":" !#%?#@$# !-%?-@$-%$+@!+ ?+%$&@!& ?&","P -6 2 m":" !#%?#@$# !&%?&@$&! &?%&$@&! #?%#$@#","P -6 2 c":" !#%?#@$# !-%?-@$-! &?%&$@&! +?%+$@+","P 6/m 2/m 2/m":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&$%&!@&? & !&@$&%?&%$#@!# ?#! #?%#$@#","P 6/m 2/c 2/c":" !#%?#@$#$%#!@#? #! -?%-$@-%$-@!- ?-$%&!@&? & !&@$&%?&%$+@!+ ?+! +?%+$@+","P 63/m 2/c 2/m":" !#%?#@$#$%+!@+? +! -?%-$@-%$&@!& ?&$%&!@&? & !-@$-%?-%$+@!+ ?+! #?%#$@#","P 63/m 2/m 2/c":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-$%&!@&? & !-@$-%?-%$#@!# ?#! +?%+$@+","P 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ","F 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ","I 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(","P 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(","I 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- ","P 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$","P 2/n -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& *,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","F 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-($,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- *,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$","F 2/d -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& 64=37=345675=64=375345674=67=3453756 )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(68>3:>3896:9=<8=;:5;85<:4><7>;49;79<(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(<4>;7>;49<79>68>3:93896:8=<:=;85;:5<()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- <8=;:=;8f<:f><4>;79;49<78>6:>3893:96","I 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","P 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*","I 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*()+$,#*g& %-+()#$,&*!- %)+(,#$!&*%- *,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$","P 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$","P 42 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","F 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$","F 41 3 2":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46 )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<(!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86","I 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","P 43 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7;>46=:<5839398<5:6=4;>75:<983>7;=46","P 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<","I 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46","P -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ","F -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(+%*+!*-%(- +)$+,$-) -,#)(#,*&)*&,((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() +,$+)$-, -(#)*#,*&)(&,+!(+%*-!*-%(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(#,*#)*&,(&(+!*+%*-!(-%+) +,$-)$-, ","I -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(", -"P -4 3 n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","F -4 3 c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() #,$#)$&, &(#!*#%*&!(&%+! +%$-!$-% (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(#%*#!*&%(& +!$+%$-! -%#) #,$&)$&, ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! +%$+!$-% - #)$#,$&) &,#!(#%*&!*&%(","I -4 3 d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7354<9:6>8;=357<946>:;=857394<>:6=8;()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- :;98657<=43>;9:658<=73>49:;586=7<>43","P 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","P 4/n -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/m -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/n -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","F 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*%*+!(+%(-!*-$-) -, +)$+,&,(&)*#,*#)((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%**%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*,$+) +, -)$-*&)(&,(#)*#,-%(-!*+%*+!(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$*,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$,*#)(#,(&)*&*-!(-%(+!*+%-, -)$+,$+) ","F 4/m -3 2/c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() &,$&)$#, #(#%*#!*&%(&!+!$+% -! -%$$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*,$#) #, &)$&*&!(&%(#!*#%-% -!$+%$+! (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(&%*&!*#%(# +%$+!$-% -!#)$#, &) &,$*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*%*#!(#%(&!*&$-! -% +!$+%&, &)$#,$#) ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! -%$-!$+% + #,$#)$&, &)#!*#%(&!(&%**,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$%$+! +% -!$-$&) &, #)$#,&%(&!*#%*#!(","F 41/d -3 2/m":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=4664=3:>;85<79=64>3:5;89<74=6:>385;79<,$+! #%(-)*&*&)(-% #!$+,-%(&)*+,$#! )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<68>37=;49<:5=<8>;753496:4><:=;893756,*#!(+% &)$-*-!(&, +)$#%-, &!$+%*#)((!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<<4>;:=389675>68=379;45<:8=<7>;453:96%$#) +,(&!*-$&! -,(#)*+%&% -)$#,*+!(()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86<8=;7>3456:9><4=;:9385678>67=349;:5<%*+)(#, -!$&$-) &%(+!*#,&,(-!*#%$+) ","F 41/d -3 2/c":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46<8>;7=3496:5><8=;793456:8><7=;493:56%*#)(+, &!$-$-! &,(+)*#%&, -!$#%*+)( )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<<4=;:>385679>64=3:9;85<78=67>345;:9<%$+) #,(-!*&$&) -%(#!*+,&%(-)*#,$+! (!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<68=37>;45<:9=<4>;:5389674>6:=389;75<,*+!(#% -)$&*-)(&% +!$#,-,(&!*+%$#) ()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>8664>3:=;89<75=68>375;49<:4=<:>;853796,$#! +%(&)*-*&!(-, #)$+%-% &)$+,*#!(","I 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","I 41/a -3 2/d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<$%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*4<97358;=:6>6>:;=8357<94=8;>:694<573()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46*,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$865:;943>7<=<=73>4;9:658>43=7<5869:;","P 1 1 2":" !#$%#","P 1 1 21":" !#$%+","B 1 1 2":" !#$%#(g+*%+","A 1 2 1":" !#$!& )+$)-","C 1 21 1":" !#$)&()#*!&","I 1 2 1":" !#$!&.'/0'2","I 1 21 1":" !#$)&.'/0!-","P 1 1 m":" !# !&","P 1 1 b":" !# )&","B 1 1 m":" !# !&(!+(!-","B 1 1 b":" !# )&(!+()-","P 1 1 2/m":" !# !&$%#$%&","P 1 1 21/m":" !#$%+$%& !-","B 1 1 2/m":" !# !&$%#$%&(!+(!-*%+*%-","P 1 1 2/b":" !#$,#$%& )&","P 1 1 21/b":" !#$%&$,+ )-","B 1 1 2/b":" !#$,#$%& )&(!+*,+*%-()-","P 21 2 2":" !#$!&(%&*%#","P 2 21 2":" !# ,&$)&$%#","P 21 21 2 (a)":" !#*,#.%&$'&","P 21 2 21":" !#$!&(%-*%+","P 2 21 21":" !# %&$)-$,+","C 2 2 21a)":" !#*%+(,&$)-()#$,+ %&*!-","C 2 2 2a":" !#*,#.%&$'&()#$%# ,&*!&","F 2 2 2a":" !#*,#.%&$'& '/*%/.12$!2.!/$,/ %20'2.'#$%# 1&0!&","I 2 2 2a":" !#*,#.%&$'&()+$%+*!- ,-","P 21/m 21/m 2/n a":" !#*,#$)&(%&$%&.'& ,#*!#","P 42 21 2a":" !#*,#%.+'$+$'&.%&! -,*-","I 2 3a":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};Mo.prototype={constructor:Mo,type:"Assembly",addPart:function(t,e){var i=new Po(t,e);return this.partList.push(i),i},getAtomCount:function(t){var e=0;return this.partList.forEach(function(i){e+=i.getAtomCount(t)}),e},getInstanceCount:function(){var t=0;return this.partList.forEach(function(e){t+=e.matrixList.length}),t},isIdentity:function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;var i=new A;if(!i.equals(e.matrixList[0]))return!1;var n=[];return t.eachChain(function(t){n.push(t.chainname)}),n=l(n),e.chainList.length===n.length},getBoundingBox:function(t){var e=new xt;return this.partList.forEach(function(i){var n=i.getBoundingBox(t);e.expandByPoint(n.min),e.expandByPoint(n.max)}),e},getSelection:function(){var t=[];return this.partList.forEach(function(e){t=t.concat(e.chainList)}),Ao(t)}},Po.prototype={constructor:Po,type:"AssemblyPart",getAtomCount:function(t){var e=0,i=this.chainList;return t.eachChain(function(t){(0===i.length||i.includes(t.chainname))&&(e+=t.atomCount)}),this.matrixList.length*e},getBoundingBox:function(t){var e=new xt,i=new xt,n=this.getSelection(),r=t.getBoundingBox(n);return this.matrixList.forEach(function(t){i.copy(r).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)}),e},getSelection:function(){return Ao(this.chainList)},getView:function(t){var e=this.getSelection();return e?t.getView(e):t},getInstanceList:function(){for(var t=[],e=0,i=this.matrixList.length;e=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var d=c.distanceTo(u);if(Math.abs(d-i[l-2])>n)return!1}return!0},i=function(t,i){var n=[5.45,5.18,6.37],r=2.1;return e(t,i,n,r)},n=function(t,i){var n=[6.1,10.4,13],r=1.42;return e(t,i,n,r)},r=function(t){for(var e=t.residueStore,r=t.residueIndexStart,o=0,a=t.residueCount;o1&&a.bending[u]=3&&t.indexOf(n[0])!==-1?n[0]:""}}();ko.prototype={constructor:ko,type:"AtomType",atomname:void 0,element:void 0,vdw:void 0,covalent:void 0},zo.prototype={constructor:zo,type:"ResidueType",resname:void 0,atomTypeIdList:void 0,atomCount:void 0,getBackboneIndexList:function(){var t,e=[];switch(this.moleculeType){case Tp:t=am;break;case Ep:case Ip:t=sm;break;default:return e}for(var i=this.structure.atomMap,n=this.atomTypeIdList,r=0,o=this.atomCount;r=2?t(l,e[l],a):i[l]=2;else if(1===i[l]&&c&&c!=l){var d=[l];n[l]=1,r.push(d);for(var f=o.length-1;f>=0;--f){var p=o[f];if(p===l)break;d.push(p),n[p]=1}}}i[a]=2,o.pop()}for(var e=this.getBondGraph(),i=new Int8Array(this.atomCount),n=new Int8Array(this.atomCount),r=[],o=[],a=0;a1){for(e=0;e1){for(e=0;e0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},isPolymer:function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===Tp||t===Ep||t===Ip},isSidechain:function(){return this.isPolymer()&&!this.isBackbone()},isCg:function(){var t=this.residueType.backboneType;return t===kp||t===Fp||t===zp},isHetero:function(){return 1===this.residueType.hetero},isProtein:function(){return this.residueType.moleculeType===Tp},isNucleic:function(){var t=this.residueType.moleculeType;return t===Ep||t===Ip},isRna:function(){return this.residueType.moleculeType===Ep},isDna:function(){return this.residueType.moleculeType===Ip},isWater:function(){return this.residueType.moleculeType===Pp},isIon:function(){return this.residueType.moleculeType===Cp},isSaccharide:function(){return this.residueType.moleculeType===Lp},isRing:function(){var t=this.residueType.getRings().flags;return 1===t[this.index-this.residueAtomOffset]},distanceTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index,o=e.x[n]-i.x[r],a=e.y[n]-i.y[r],s=e.z[n]-i.z[r],c=o*o+a*a+s*s;return Math.sqrt(c)},connectedTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index;if(e.altloc&&i.altloc){var o=e.altloc[n],a=i.altloc[r];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[n]-i.x[r],c=e.y[n]-i.y[r],u=e.z[n]-i.z[r],h=s*s+c*c+u*u;if(h<64&&this.isCg())return!0;if(isNaN(h))return!1;var l=this.covalent+t.covalent,d=l+.3,f=l-.5;return hf*f},positionFromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e+0],this.y=t[e+1],this.z=t[e+2],this},positionToArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,n=this.atomStore;return t[e+0]=n.x[i],t[e+1]=n.y[i],t[e+2]=n.z[i],t},positionToVector3:function(t){return void 0===t&&(t=new P),t.x=this.x,t.y=this.y,t.z=this.z,t},positionFromVector3:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},getResidueBonds:function(t){var e,i,n,r,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(r=[]),e=c.indexOf(a);e!==-1;){if(n=u[e]+o,t)return n;r.push(n),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);i!==-1;){if(n=c[i]+o,t)return n;r.push(n),i=u.indexOf(a,i+1)}return r},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chainname&&(e+=":"+this.chainname),this.atomname&&(e+="."+this.atomname),this.altloc&&(e+="%"+this.altloc),this.structure.modelStore.count>1&&(e+="/"+this.modelIndex),e},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueIndex:this.residueIndex,atomno:this.atomno,resname:this.resname,x:this.x,y:this.y,z:this.z,element:this.element,chainname:this.chainname,resno:this.resno,serial:this.serial,vdw:this.vdw,covalent:this.covalent,hetero:this.hetero,bfactor:this.bfactor,altloc:this.altloc,atomname:this.atomname,modelindex:this.modelindex}}},$o.prototype={constructor:$o,type:"ResidueProxy",structure:void 0,chainStore:void 0,residueStore:void 0,atomStore:void 0,index:void 0,get entity(){return this.structure.entityList[this.entityIndex]},get entityIndex(){return this.chainStore.entityIndex[this.chainIndex]},get chain(){return this.structure.getChainProxy(this.chainIndex)},get chainIndex(){return this.residueStore.chainIndex[this.index]},set chainIndex(t){this.residueStore.chainIndex[this.index]=t},get atomOffset(){return this.residueStore.atomOffset[this.index]},set atomOffset(t){this.residueStore.atomOffset[this.index]=t},get atomCount(){return this.residueStore.atomCount[this.index]},set atomCount(t){this.residueStore.atomCount[this.index]=t},get atomEnd(){return this.atomOffset+this.atomCount-1},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},get chainid(){return this.chainStore.getChainid(this.chainIndex)},get resno(){return this.residueStore.resno[this.index]},set resno(t){this.residueStore.resno[this.index]=t},get sstruc(){return this.residueStore.getSstruc(this.index)},set sstruc(t){this.residueStore.setSstruc(this.index,t)},get inscode(){return this.residueStore.getInscode(this.index)},set inscode(t){this.residueStore.getInscode(this.index,t)},get residueType(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},get resname(){return this.residueType.resname},get hetero(){return this.residueType.hetero},get moleculeType(){return this.residueType.moleculeType},get backboneType(){return this.residueType.backboneType},get backboneStartType(){return this.residueType.backboneStartType},get backboneEndType(){return this.residueType.backboneEndType},get traceAtomIndex(){return this.residueType.traceAtomIndex+this.atomOffset},get direction1AtomIndex(){return this.residueType.direction1AtomIndex+this.atomOffset},get direction2AtomIndex(){return this.residueType.direction2AtomIndex+this.atomOffset},get backboneStartAtomIndex(){return this.residueType.backboneStartAtomIndex+this.atomOffset},get backboneEndAtomIndex(){return this.residueType.backboneEndAtomIndex+this.atomOffset},get rungEndAtomIndex(){return this.residueType.rungEndAtomIndex+this.atomOffset},eachAtom:function(t,e){var i,n=this.atomCount,r=this.atomOffset,o=this.structure._ap,a=r+n;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=r;i0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===Tp||t===Ep||t===Ip},isHetero:function(){return 1===this.residueType.hetero},isWater:function(){return this.residueType.moleculeType===Pp},isIon:function(){return this.residueType.moleculeType===Cp},isSaccharide:function(){return this.residueType.moleculeType===Lp},getAtomType:function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},getResname1:function(){return Qp[this.resname.toUpperCase()]||"X"},getBackboneType:function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},getAtomIndexByName:function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},getAtomByName:function(t){return this.residueType.getAtomByName(t)},hasAtomWithName:function(t){return this.residueType.hasAtomWithName(t)},getAtomnameList:function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),n=0;n=e){if(void 0===t&&(t=this.structure.getResidueProxy()),t.index=i,t.connectedTo(this))return t}else if(i===e-1){void 0===t&&(t=this.structure.getResidueProxy());var n=this.chainStore.residueCount[this.chainIndex];if(t.index=e+n-1,t.connectedTo(this))return t}},getBonds:function(){return this.residueType.getBonds(this)},getRings:function(){return this.residueType.getRings()},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chain&&(e+=":"+this.chainname),e+="/"+this.modelIndex},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}}},Vo.prototype={constructor:Vo,type:"Polymer",structure:void 0,residueStore:void 0,atomStore:void 0,residueIndexStart:void 0,residueIndexEnd:void 0,residueCount:void 0,get chainIndex(){return this.residueStore.chainIndex[this.residueIndexStart]},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},isProtein:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},isCg:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},isNucleic:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},getMoleculeType:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},getBackboneType:function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},getAtomIndexByType:function(t,e){this.isCyclic?t===-1?t=this.residueCount-1:t===this.residueCount&&(t=0):(t!==-1||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i=this.__residueProxy;i.index=this.residueIndexStart+t;var n;switch(e){case"trace":n=i.traceAtomIndex;break;case"direction1":n=i.direction1AtomIndex;break;case"direction2":n=i.direction2AtomIndex;break;default:var r=i.getAtomByName(e);n=r?r.index:void 0}return n},eachAtom:function(t,e){this.eachResidue(function(i){i.eachAtom(t,e)},e)},eachAtomN:function(t,e,i){var n,r=this.residueCount,o=new Array(t);for(n=0;n=n&&i=t&&e.apply(this,a)}})}},eachDirectionAtomsN:function(t,e){var i=2*t,n=this.atomOffset,r=this.atomCount,o=n+r;if(!(r=n&&i=n&&r=t&&e.apply(this,a)}},c,u)}},eachResidue:function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,n=this.residueIndexStart,r=0;r1&&t(new Vo(o,i,u.index)),i=n)):(m!==Rp&&u.index-i>1&&t(new Vo(o,i,u.index)),i=n)}n-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new Vo(o,i,n))},qualifiedName:function(){var t=":"+this.chainname+"/"+this.modelIndex;return t},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}}},Ho.prototype={constructor:Ho,type:"ModelProxy",structure:void 0,modelStore:void 0,index:void 0,get chainOffset(){return this.modelStore.chainOffset[this.index]},set chainOffset(t){this.modelStore.chainOffset[this.index]=t},get chainCount(){return this.modelStore.chainCount[this.index]},set chainCount(t){this.modelStore.chainCount[this.index]=t},get residueOffset(){return this.chainStore.residueOffset[this.chainOffset]},get atomOffset(){return this.residueStore.atomOffset[this.residueOffset]},get chainEnd(){return this.chainOffset+this.chainCount-1},get residueEnd(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},get atomEnd(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},get residueCount(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},get atomCount(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},eachAtom:function(t,e){this.eachChain(function(i){i.eachAtom(t,e)},e)},eachResidue:function(t,e){this.eachChain(function(i){i.eachResidue(t,e)},e)},eachPolymer:function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain(function(n){i(n)&&n.eachPolymer(t,e)})}else this.eachChain(function(i){i.eachPolymer(t,e)})},eachChain:function(t,e){var i,n=this.chainCount,r=this.chainOffset,o=this.structure._cp,a=r+n;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=r;i1?(O=i.atomRadius(A),D=O*b/(.5*R),w.calculateShiftDir(B),y?(N=2*x*O,B.multiplyScalar(N),B.negate(),z.subVectors(M,A).multiplyScalar(Math.max(.1,N/1.88)),A.positionToArray(a,I),M.positionToArray(s,I),R>=2&&(F.addVectors(A,B).add(z).toArray(a,I+3),F.addVectors(M,B).sub(z).toArray(s,I+3),R>=3&&(F.subVectors(A,B).add(z).toArray(a,I+6),F.subVectors(M,B).sub(z).toArray(s,I+6)))):(N=(x-b)*O,B.multiplyScalar(N),2===R?(F.addVectors(A,B).toArray(a,I),F.subVectors(A,B).toArray(a,I+3),F.addVectors(M,B).toArray(s,I),F.subVectors(M,B).toArray(s,I+3)):3===R?(A.positionToArray(a,I),F.addVectors(A,B).toArray(a,I+3),F.subVectors(A,B).toArray(a,I+6),M.positionToArray(s,I),F.addVectors(M,B).toArray(s,I+3),F.subVectors(M,B).toArray(s,I+6)):(A.positionToArray(a,I),M.positionToArray(s,I)))):(A.positionToArray(a,I),M.positionToArray(s,I))),c&&(r.bondColorToArray(w,1,c,I),r.bondColorToArray(w,0,u,I),v&&R>1))for(E=1;E1))for(E=1;E1))for(D=d[k]*b/(y?1:.5*R),E=y?1:0;E1))for(D=f[k]*b/(y?1:.5*R),E=y?1:0;Ea&&(a=e),i>s&&(s=i),u>c&&(c=u)},e),i.min.set(n,r,o),i.max.set(a,s,c),t.Debug&&Hg.timeEnd("getBoundingBox"),i},getPrincipalAxes:function(e){t.Debug&&Hg.time("getPrincipalAxes");var i=0,n=new jr(3,this.atomCount),r=n.data;return this.eachAtom(function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3},e),t.Debug&&Hg.timeEnd("getPrincipalAxes"),to(n)},atomCenter:function(t){return t?this.getBoundingBox(t).center():this.center.clone()},getSequence:function(t){var e=[],i=this.getResidueProxy();return this.eachAtom(function(t){i.index=t.residueIndex,t.index===i.traceAtomIndex&&e.push(i.getResname1())},t),e},getAtomIndices:function(t){var e;if(t&&t.string)e=[],this.eachAtom(function(t){e.push(t.index)},t);else{var i={what:{index:!0}};e=this.getAtomData(i).index}return e},getChainnameCount:function(t){var e=new Set;return this.eachChain(function(t){t.residueCount&&e.add(t.chainname)},t),e.size},updatePosition:function(t){var e=0;this.eachAtom(function(i){i.positionFromArray(t,e),e+=3})},refreshPosition:function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.center(this.center),this.spatialHash=new uo(this.atomStore,this.boundingBox)},dispose:function(){this.frames&&(this.frames.length=0),this.boxes&&(this.boxes.length=0),this.bondStore.dispose(),this.backboneBondStore.dispose(),this.rungBondStore.dispose(),this.atomStore.dispose(),this.residueStore.dispose(),this.chainStore.dispose(),this.modelStore.dispose(),delete this.bondStore,delete this.atomStore,delete this.residueStore,delete this.chainStore,delete this.modelStore,delete this.frames,delete this.boxes,delete this.cif,delete this.bondSet,delete this.atomSet}},Xo.prototype={constructor:Xo,type:"Surface",set:function(t,e,i,n,r){this.position=t,this.index=e,this.normal=i,this.color=n,this.atomindex=r,this.size=t.length/3},fromGeometry:function(e){t.Debug&&Hg.time("GeometrySurface.fromGeometry");var i;e instanceof Kt?(e.computeVertexNormals(!0),i=(new te).fromGeometry(e)):i=e instanceof te?e:e[0],i.boundingBox||i.computeBoundingBox(),this.center.copy(i.boundingBox.center()),this.boundingBox.copy(i.boundingBox);var n,r,o,a;if(i instanceof te){var s=i.attributes,c=!!s.normal&&s.normal.array;(!c||0===c[0]&&0===c[1]&&0===c[2])&&i.computeVertexNormals(),n=s.position.array,o=s.index?s.index.array:null,a=s.normal.array}this.set(n,o,a,r,void 0),t.Debug&&Hg.timeEnd("GeometrySurface.setGeometry")},getPosition:function(){return this.position},getColor:function(t){var e,i,n,r=t||{},o=this.size;if("volume"===r.scheme){var a=new P,s=this.position;for(n=qg.getScheme(r),i=new Float32Array(3*o),e=0;e65535?Uint32Array:Uint16Array;return new g(r)}return this.index},getAtomindex:function(){return this.atomindex},dispose:function(){}},qo.prototype.constructor=qo,Yo.prototype.constructor=Yo,Qo.__deps=[Zo,Ko],Jo.__deps=[ta],ta.__deps=[Ir,Er,Lr,Cr],ia.__deps=[fn,kr,Fr,Or,Dr,zr,Br,Ir,Ur,eo,no,oo,ro,ao],na.__deps=[Jo,ta,Qo,Mr,Pr,so,co],Xg.add("surf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&(self.volsurf=new na(i[0],i[1],i[2],i[3],i[4])),n){var r=self.volsurf.getSurface(n.isolevel,n.smooth,n.box,n.matrix),o=[r.position.buffer,r.index.buffer];r.normal&&o.push(r.normal.buffer),r.atomindex&&o.push(r.atomindex.buffer),e({sd:r,p:n},o)}},[na]),ra.prototype={constructor:ra,type:"Volume",setData:function(t,e,i,n,r){this.nx=e||1,this.ny=i||1,this.nz=n||1,this.data=t||new Float32Array(1),this.__data=this.data,this.setDataAtomindex(r),delete this.mc,delete this.__isolevel,delete this.__smooth,delete this.__minValue,delete this.__maxValue,delete this.__dataPositionBuffer,delete this.__dataPosition,delete this.__dataBuffer,delete this.__dataMin,delete this.__dataMax,delete this.__dataMean,delete this.__dataRms,this.worker&&this.worker.terminate()},setMatrix:function(t){this.matrix.copy(t);var e=this.boundingBox,i=this.center,n=this.nx-1,r=this.ny-1,o=this.nz-1;e.makeEmpty(),e.expandByPoint(i.set(n,r,o)),e.expandByPoint(i.set(n,r,0)),e.expandByPoint(i.set(n,0,o)),e.expandByPoint(i.set(n,0,0)),e.expandByPoint(i.set(0,r,o)),e.expandByPoint(i.set(0,0,o)),e.expandByPoint(i.set(0,r,0)),e.expandByPoint(i.set(0,0,0)),e.applyMatrix4(this.matrix),e.center(this.center);var a=this.matrix.elements,s=new P(a[0],a[1],a[2]),c=new P(a[4],a[5],a[6]),u=new P(a[8],a[9],a[10]),h=new P,l=this.normalMatrix.elements;h.crossVectors(c,u),l[0]=h.x,l[1]=h.y,l[2]=h.z,h.crossVectors(u,s),l[3]=h.x,l[4]=h.y,l[5]=h.z,h.crossVectors(s,c),l[6]=h.x,l[7]=h.y,l[8]=h.z,this.inverseMatrix.getInverse(this.matrix)},setDataAtomindex:function(t){this.dataAtomindex=t,this.__dataAtomindex=this.dataAtomindex,delete this.__dataAtomindexBuffer},getBox:function(t,e,i){return i||(i=new xt),i.set(t,t),i.expandByScalar(e),i.applyMatrix4(this.inverseMatrix),i.min.round(),i.max.round(),i},__getBox:function(t,e){if(t&&e){this.__box||(this.__box=new xt);var i=this.getBox(t,e,this.__box);return[i.min.toArray(),i.max.toArray()]}},makeSurface:function(t,e,i){var n=new Xo("","",t);return n.info.isolevel=e,n.info.smooth=i,n},getSurface:function(t,e,i,n){t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,void 0===this.volsurf&&(this.volsurf=new na(this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex));var r=this.__getBox(i,n),o=this.volsurf.getSurface(t,e,r,this.matrix.elements);return this.makeSurface(o,t,e)},getSurfaceWorker:function(t,e,i,n,r){if(t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,window.Worker){void 0===this.workerPool&&(this.workerPool=new Yo("surf",2));var o={},a=this.workerPool.getNextWorker();0===a.postCount&&(o.args=[this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex]),o.params={isolevel:t,smooth:e,box:this.__getBox(i,n),matrix:this.matrix.elements},a.post(o,void 0,function(t){var e=t.data.sd,i=t.data.p;r(this.makeSurface(e,i.isolevel,i.smooth))}.bind(this),function(o){console.warn("Volume.getSurfaceWorker error - trying without worker",o);var a=this.getSurface(t,e,i,n);r(a)}.bind(this))}else{var s=this.getSurface(t,e,i,n);r(s)}},getValueForSigma:function(t){return t=void 0!==t?t:2,this.getDataMean()+t*this.getDataRms()},getSigmaForValue:function(t){return t=void 0!==t?t:0,(t-this.getDataMean())/this.getDataRms()},filterData:function(t,e,i){isNaN(t)&&this.header&&(t=this.header.DMEAN+2*this.header.ARMS),t=void 0===t||isNaN(t)?-(1/0):t,e=void 0!==e?e:1/0,i=i||!1,this.dataPosition||this.makeDataPosition();var n=this.__dataPosition,r=this.__data;if(t!==this.__minValue||e!=this.__maxValue||i!==this.__outside){if(t===-(1/0)&&e===1/0)this.dataPosition=n,this.data=r;else{var o=r.length;this.__dataBuffer||(this.__dataPositionBuffer=new ArrayBuffer(3*o*4),this.__dataBuffer=new ArrayBuffer(4*o));for(var a=new Float32Array(this.__dataPositionBuffer),s=new Float32Array(this.__dataBuffer),c=0,u=0;u=t&&l<=e||i&&(le)){var d=3*c;a[d+0]=n[h+0],a[d+1]=n[h+1],a[d+2]=n[h+2],s[c]=l,c+=1}}this.dataPosition=new Float32Array(this.__dataPositionBuffer,0,3*c),this.data=new Float32Array(this.__dataBuffer,0,c)}this.__minValue=t,this.__maxValue=e,this.__outside=i}},makeDataPosition:function(){for(var t=this.nz,e=this.ny,i=this.nx,n=new Float32Array(i*e*t*3),r=0,o=0;o.9*e[3*n+n])if(o>0)for(r=0;r<3;++r)t[i+r]-=e[3*n+r];else for(r=0;r<3;++r)t[i+r]+=e[3*n+r];return t}},superpose:function(t){var e,i,n=3*this.indices.length,r=this.coords1,o=this.coords2;for(e=0;e0&&this.params.centerPbc){var r=[e[0],e[4],e[8]],o=this.getCircularMean(this.backboneIndices,i,r);this.centerPbc(i,o,r)}this.params.removePbc&&this.removePbc(i,e)}this.indices.length>0&&this.params.superpose&&this.superpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},setNumframes:function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},dispose:function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},setPlayer:function(t){this.player=t,this.signals.playerChanged.dispatch(t)},getPath:function(t,e){Hg.error("Trajectory.getPath not implemented",t,e)}},Qg.add("shader/Mesh.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = pickingColor;\n#elif defined( NOLIGHT )\nvColor = color;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),Qg.add("shader/Mesh.frag","#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#elif defined( NOLIGHT )\ngl_FragColor = vec4( vColor, opacity );\n#else\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\n#include dull_interior_fragment\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#include opaque_back_fragment\n#endif\n}"),ua.prototype={constructor:ua,parameters:{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},clipNear:{updateShader:!0,property:!0},clipRadius:{updateShader:!0,property:!0,uniform:!0},clipCenter:{uniform:!0},flatShaded:{updateShader:!0},background:{updateShader:!0},linewidth:{property:!0},wireframe:{updateVisibility:!0},roughness:{uniform:!0},metalness:{uniform:!0},diffuse:{uniform:!0}},get transparent(){return this.opacity<1||this.forceTransparent},makeMaterial:function(){var t=ca(this.side);this.material=new vt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!0,fog:!0,side:t,linewidth:this.linewidth}),this.material.vertexColors=Ku,this.material.extensions.derivatives=this.flatShaded,this.material.extensions.fragDepth=this.impostor,this.material.clipNear=this.clipNear,this.wireframeMaterial=new vt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!1,fog:!0,side:t,linewidth:this.linewidth}),this.wireframeMaterial.vertexColors=Ku,this.wireframeMaterial.clipNear=this.clipNear,this.pickingMaterial=new vt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:!0,lights:!1,fog:!1,side:t,linewidth:this.linewidth}),this.pickingMaterial.vertexColors=Ku,this.pickingMaterial.extensions.fragDepth=this.impostor,this.pickingMaterial.clipNear=this.clipNear,this.updateShader()},makeWireframeGeometry:function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new te;i.attributes=t.attributes,e&&(i.setIndex(new $t(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},makeWireframeIndex:function(){function t(t,i){if(t>i){var n=t; -t=i,i=n}var r=e[t];return void 0===r?(e[t]=[i],!0):!r.includes(i)&&(r.push(i),!0)}var e=[];return function(){var i=this.geometry.index;if(this.wireframe){if(i){var n=i.array,r=n.length;this.geometry.drawRange.count!==1/0&&(r=this.geometry.drawRange.count);var o;if(this.wireframeIndex&&this.wireframeIndex.length>2*r)o=this.wireframeIndex;else{var a=this.geometry.attributes.position.count,s=a>65535?Uint32Array:Uint16Array;o=new s(2*r)}var c=0;e.length=0;for(var u=0;uthis.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new $t(this.wireframeIndex,1).setDynamic(this.dynamic));else{var t=this.wireframeGeometry.getIndex();t.set(this.wireframeIndex),t.needsUpdate=this.wireframeIndexCount>0,t.updateRange.count=this.wireframeIndexCount}this.wireframeGeometry.setDrawRange(0,this.wireframeIndexCount)},getRenderOrder:function(){var t=0;return"text"===this.type?t=1:this.transparent&&(t="surface"===this.type?3:2),t},getMesh:function(){var t;return this.material||this.makeMaterial(),this.line?t=new Oe(this.geometry,this.material):this.point?(t=new Ne(this.geometry,this.material),this.sortParticles&&(t.sortParticles=!0)):t=new pe(this.geometry,this.material),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getWireframeMesh:function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),t=new Oe(this.wireframeGeometry,this.wireframeMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getPickingMesh:function(){var t;return this.material||this.makeMaterial(),t=new pe(this.geometry,this.pickingMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getShader:function(t,e){return or(t,this.getDefines(e))},getVertexShader:function(t){return this.getShader(this.vertexShader,t)},getFragmentShader:function(t){return this.getShader(this.fragmentShader,t)},getDefines:function(t){var e={};return this.clipNear&&(e.NEAR_CLIP=1),this.clipRadius&&(e.RADIUS_CLIP=1),"picking"===t?e.PICKING=1:(("background"===t||this.background)&&(e.NOLIGHT=1),this.flatShaded&&(e.FLAT_SHADED=1),this.opaqueBack&&(e.OPAQUE_BACK=1),this.dullInterior&&(e.DULL_INTERIOR=1)),e},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},addUniforms:function(t){this.uniforms=id.merge([this.uniforms,t]),this.pickingUniforms=id.merge([this.pickingUniforms,t])},addAttributes:function(t){var e={f:1,v2:2,v3:3,c:3};for(var i in t){var n,r=t[i];r.value?(this.attributeSize*e[r.type]!==r.value.length&&Hg.error("attribute value has wrong length",i),n=r.value):n=new Float32Array(this.attributeSize*e[r.type]),this.geometry.addAttribute(i,new $t(n,e[r.type]).setDynamic(this.dynamic))}},updateRenderOrder:function(){function t(t){t.renderOrder=e}var e=this.getRenderOrder();this.group.children.forEach(t),this.pickingGroup&&this.pickingGroup.children.forEach(t)},updateShader:function(){var t=this.material,e=this.wireframeMaterial,i=this.pickingMaterial;t.vertexShader=this.getVertexShader(),t.fragmentShader=this.getFragmentShader(),t.needsUpdate=!0,e.vertexShader=this.getShader("Line.vert"),e.fragmentShader=this.getShader("Line.frag"),e.needsUpdate=!0,i.vertexShader=this.getVertexShader("picking"),i.fragmentShader=this.getFragmentShader("picking"),i.needsUpdate=!0},setParameters:function(t){if(t){var e=t,i=this.parameters,n={},r={},o=!1,a=!1;for(var s in e)void 0!==e[s]&&void 0!==i[s]&&(this[s]=e[s],i[s].property&&(i[s].property!==!0?n[i[s].property]=e[s]:n[s]=e[s]),i[s].uniform&&(i[s].uniform!==!0?r[i[s].uniform]=e[s]:r[s]=e[s]),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&e[s]===!0&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(n.transparent=this.transparent));this.setProperties(n),this.setUniforms(r),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},setAttributes:function(t){var e=this.geometry,i=e.attributes;for(var n in t){var r=t[n],o=r.length;if("index"===n){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new $t(r,1).setDynamic(this.dynamic)):(a.set(r),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[n];o>s.array.length?e.addAttribute(n,new $t(r,s.itemSize).setDynamic(this.dynamic)):(i[n].set(r),i[n].needsUpdate=o>0,i[n].updateRange.count=o)}}},setUniforms:function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,n=this.pickingMaterial.uniforms;for(var r in t)"opacity"===r&&this.setProperties({transparent:this.transparent}),void 0!==e[r]&&(e[r].value.isVector3?e[r].value.copy(t[r]):e[r].value.set?e[r].value.set(t[r]):e[r].value=t[r]),void 0!==i[r]&&(i[r].value.isVector3?i[r].value.copy(t[r]):i[r].value.set?i[r].value.set(t[r]):i[r].value=t[r]),void 0!==n[r]&&(n[r].value.isVector3?n[r].value.copy(t[r]):n[r].value.set?n[r].value.set(t[r]):n[r].value=t[r])}},setProperties:function(t){if(t){var e=this.material,i=this.wireframeMaterial,n=this.pickingMaterial;for(var r in t){var o=t[r];"transparent"===r?this.updateRenderOrder():"side"===r&&(o=ca(o)),void 0!==e[r]&&(e[r]=o),void 0!==i[r]&&(i[r]=o),void 0!==n[r]&&(n[r]=o)}e.needsUpdate=!0,i.needsUpdate=!0,n.needsUpdate=!0}},setVisibility:function(t){this.visible=t,this.wireframe?(this.group.visible=!1,this.wireframeGroup.visible=t,this.pickable&&(this.pickingGroup.visible=!1)):(this.group.visible=t,this.wireframeGroup.visible=!1,this.pickable&&(this.pickingGroup.visible=t))},dispose:function(){this.material&&this.material.dispose(),this.wireframeMaterial&&this.wireframeMaterial.dispose(),this.pickingMaterial&&this.pickingMaterial.dispose(),this.geometry.dispose(),this.wireframeGeometry&&this.wireframeGeometry.dispose()}},ha.prototype=Object.assign(Object.create(ua.prototype),{constructor:ha}),pa.prototype=Object.assign(Object.create(ha.prototype),{constructor:pa,applyPositionTransform:function(){},setAttributes:function(){var t=new A,e=new wt;return function(i){var n,r,o,a,s,c,u,h,l,d,f,p=this.geometry.attributes;i.position&&(n=i.position,a=this.geoPosition,h=this.meshPosition,c=this.transformedGeoPosition,p.position.needsUpdate=!0),i.color&&(r=i.color,l=this.meshColor,p.color.needsUpdate=!0),i.pickingColor&&(o=i.pickingColor,d=this.meshPickingColor,p.pickingColor.needsUpdate=!0);var m=!(!this.updateNormals||!n),g=!(!this.initNormals||!n);(m||g)&&(s=this.geoNormal,f=this.meshNormal,u=this.transformedGeoNormal,p.normal.needsUpdate=!0);for(var v=this.positionCount,y=this.geoPositionCount,b=0;b 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nflag2 = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#else\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#endif\nreturn true;\n}\nreturn false;\n}\nvoid main(void){\nbool flag = Impostor( cameraPos, cameraNormal );\n#ifdef NEAR_CLIP\nif( calcClip( cameraPos ) > 0.0 )\ndiscard;\n#endif\ngl_FragDepthEXT = calcDepth( cameraPos );\nif( !flag ){\n#ifdef NEAR_CLIP\nif( flag2 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}else if( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#else\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#endif\n}\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vNormal = cameraNormal;\nvec3 vViewPosition = -cameraPos;\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),ga.prototype=Object.assign(Object.create(ua.prototype),{constructor:ga,setAttributes:function(t){var e,i,n,r,o,a,s,c=this.count,u=this.mappingSize,h=this.geometry.attributes;for(var l in t){i=t[l],e=h[l],n=e.itemSize,r=e.array;for(var d=0;d radius2)\ndiscard;\n#ifdef CAP\nnew_point = front_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(axis, end_cyl) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - end_cyl, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\nif( end_cap_test > 0.0 )\n{\nfloat dNV = dot(axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(axis, end_cyl) / dNV;\nvec3 end_point = ray_direction * near + ray_origin;\nif( dot(end_point - end_cyl, end_point-base) > radius2 )\ndiscard;\n#ifdef CAP\nnew_point = end_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(-axis, (base)) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - base, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\ngl_FragDepthEXT = calcDepth( new_point );\n#ifdef NEAR_CLIP\nif( calcClip( new_point ) > 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\nif( calcClip( new_point ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#endif\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}else{\nif( b > 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}\n#else\nvec3 vViewPosition = -new_point;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}else{\nif( b > 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Sa.prototype=Object.assign(Object.create(ga.prototype),{constructor:Sa}),Aa.prototype=Object.assign(Object.create(Sa.prototype),{constructor:Aa,parameters:Object.assign({openEnded:{updateShader:!0}},Sa.prototype.parameters),getDefines:function(t){var e=Sa.prototype.getDefines.call(this,t);return this.openEnded||(e.CAP=1),e},setAttributes:function(t){t&&t.position1&&t.position2&&(t.position=cr(t.position1,t.position2)),Sa.prototype.setAttributes.call(this,t)}}),Pa.prototype=Object.assign(Object.create(pa.prototype),{constructor:Pa,applyPositionTransform:function(){var t,e=new P,i=new P,n=new P,r=new P(0,1,0);return function(o,a,s){i.fromArray(this._from,s),n.fromArray(this._to,s),o.lookAt(i,n,r),t=this._radius[a],e.set(t,t,i.distanceTo(n)),o.scale(e)}}(),setAttributes:function(t){var e={};t.position1&&t.position2&&(cr(t.position1,t.position2,this._position),this._from.set(t.position1),this._to.set(t.position2),e.position=this._position),t.color&&(e.color=t.color),t.pickingColor&&(e.pickingColor=t.pickingColor),t.radius&&this._radius.set(t.radius),pa.prototype.setAttributes.call(this,e)}}),Ea.prototype.constructor=Ea,Ea.prototype.type="Shape",Ia.prototype={constructor:Ia,type:"",parameters:{lazy:{type:"boolean"},clipNear:{type:"range",step:1,max:100,min:0,buffer:!0},clipRadius:{type:"number",precision:1,max:1e3,min:0,buffer:!0},clipCenter:{type:"vector3",precision:1,buffer:!0},flatShaded:{type:"boolean",buffer:!0},opacity:{type:"range",step:.01,max:1,min:0,buffer:!0},side:{type:"select",buffer:!0,options:{front:"front",back:"back",double:"double"}},wireframe:{type:"boolean",buffer:!0},linewidth:{type:"integer",max:50,min:1,buffer:!0},colorScheme:{type:"select",update:"color",options:qg.getTypes()},colorScale:{type:"select",update:"color",options:qg.getScales()},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:qg.getModes()},roughness:{type:"range",step:.01,max:1,min:0,buffer:!0},metalness:{type:"range",step:.01,max:1,min:0,buffer:!0},diffuse:{type:"color",buffer:!0}},init:function(t){var e=t||{};this.clipNear=n(e.clipNear,0),this.clipRadius=n(e.clipRadius,0),this.clipCenter=n(e.clipCenter,new P),this.flatShaded=n(e.flatShaded,!1),this.side=n(e.side,"double"),this.opacity=n(e.opacity,1),this.wireframe=n(e.wireframe,!1),this.linewidth=n(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=n(e.colorScheme,"uniform"),this.colorScale=n(e.colorScale,""),this.colorValue=n(e.colorValue,9474192),this.colorDomain=n(e.colorDomain,""),this.colorMode=n(e.colorMode,"hcl"),this.visible=n(e.visible,!0),this.quality=n(e.quality,void 0),this.roughness=n(e.roughness,.4),this.metalness=n(e.metalness,0),this.diffuse=n(e.diffuse,16777215),this.lazy=n(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}};var i=this.parameters;i.sphereDetail===!0&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),i.radialSegments===!0&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),i.openEnded===!0&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),i.disableImpostor===!0&&(i.disableImpostor={type:"boolean",rebuild:!0}),"low"===e.quality?(i.sphereDetail&&(this.sphereDetail=0),i.radialSegments&&(this.radialSegments=5)):"medium"===e.quality?(i.sphereDetail&&(this.sphereDetail=1),i.radialSegments&&(this.radialSegments=10)):"high"===e.quality?(i.sphereDetail&&(this.sphereDetail=2),i.radialSegments&&(this.radialSegments=20)):(i.sphereDetail&&(this.sphereDetail=n(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=n(e.radialSegments,10))),i.openEnded&&(this.openEnded=n(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=n(e.disableImpostor,!1))},getColorParams:function(){return{gidPool:this.gidPool,scheme:this.colorScheme,scale:this.colorScale,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode}},getBufferParams:function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse},t)},setColor:function(t,e){var i=Object.keys(qg.getTypes());return i.includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new yt(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},prepare:!1,create:function(){},update:function(){this.build()},build:function(t){return this.lazy&&!this.visible?void(this.lazyProps.build=!0):this.prepare?(this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),void this.queue.push(t||!1)):(this.tasks.increment(),void this.make())},make:function(e,i){t.Debug&&Hg.time("Representation.make "+this.type);var n=function(){e?(this.update(e),this.viewer.requestRender(),this.tasks.decrement(),i&&i()):(this.clear(),this.create(),this.manualAttach||this.disposed||(t.Debug&&Hg.time("Representation.attach "+this.type),this.attach(function(){t.Debug&&Hg.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),i&&i()}.bind(this)))),t.Debug&&Hg.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(n):n()},attach:function(t){this.setVisibility(this.visible),t()},setVisibility:function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps;if(i.build)return i.build=!1,void this.build();(i.bufferParams||i.what)&&this.updateParameters(i.bufferParams,i.what)}return this.bufferList.forEach(function(e){e.setVisibility(t)}),e||this.viewer.requestRender(),this},setParameters:function(t,e,i){var n=t||{},r=this.parameters;e=e||{},i=i||!1;var o={};for(var a in n)void 0!==n[a]&&void 0!==r[a]&&(r[a].int&&(n[a]=parseInt(n[a])),r[a].float&&(n[a]=parseFloat(n[a])),n[a]!==this[a]&&(this[a]=n[a],r[a].buffer&&(r[a].buffer===!0?o[a]=n[a]:o[r[a].buffer]=n[a]),r[a].update&&(e[r[a].update]=!0),!r[a].rebuild||"impostor"===r[a].rebuild&&Gg&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},updateParameters:function(t,e){return this.lazy&&!this.visible?(Object.assign(this.lazyProps.bufferParams,t),void Object.assign(this.lazyProps.what,e)):(this.bufferList.forEach(function(e){e.setParameters(t)}),Object.keys(e).length&&this.update(e),void this.viewer.requestRender())},getParameters:function(){var t={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach(function(e){"button"===this.parameters.type?t[e]=this[e].bind(this):t[e]=this[e]},this),t},clear:function(){this.bufferList.forEach(function(t){this.viewer.remove(t),t.dispose()},this),this.bufferList.length=0,this.viewer.requestRender()},dispose:function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()}},La.prototype=Object.assign(Object.create(Ia.prototype),{constructor:La,type:"buffer",parameters:Object.assign({},Ia.prototype.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),create:function(){this.bufferList.push.apply(this.bufferList,this.buffer)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t),t.setParameters(this.getBufferParams())},this),this.setVisibility(this.visible),t()}}),Ra.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ra,type:"surface"}),Oa.prototype.constructor=Oa,Da.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Da,type:"surface",parameters:Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},smooth:{type:"integer",precision:1,max:10,min:0},background:{type:"boolean",rebuild:!0 -},opaqueBack:{type:"boolean",buffer:!0},boxSize:{type:"integer",precision:1,max:100,min:0},useWorker:{type:"boolean",rebuild:!0}},Ia.prototype.parameters),init:function(t){var e=t||{};e.colorScheme=n(e.colorScheme,"uniform"),e.colorValue=n(e.colorValue,14540253),this.isolevelType=n(e.isolevelType,"sigma"),this.isolevel=n(e.isolevel,2),this.smooth=n(e.smooth,0),this.background=n(e.background,!1),this.opaqueBack=n(e.opaqueBack,!0),this.boxSize=n(e.boxSize,0),this.useWorker=n(e.useWorker,!0),Ia.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},prepare:function(t){if(this.volume){var e;if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var i=function(e){this.surface=e,t()}.bind(this);this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,i):i(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize))}else t()}else t()},create:function(){var t=new Ra(this.surface.getPosition(),this.surface.getColor(this.getColorParams()),this.surface.getIndex(),this.surface.getNormal(),void 0,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),e=new Oa(t);this.bufferList.push(e)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.position&&(e.position=this.surface.getPosition()),t.color&&(e.color=this.surface.getColor(this.getColorParams())),t.index&&(e.index=this.surface.getIndex()),t.normal&&(e.normal=this.surface.getNormal()),this.bufferList.forEach(function(t){t.setAttributes(e)})}},setParameters:function(t,e,i){return t&&void 0!==t.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===t.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===t.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=t.isolevelType),t&&t.boxCenter&&(this.boxCenter.copy(t.boxCenter),delete t.boxCenter),Ia.prototype.setParameters.call(this,t,e,i),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),this.surface&&(void 0!==t.isolevel||void 0!==t.smooth||void 0!==t.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!0}),this},dispose:function(){this.viewer.signals.orientationChanged.remove(this.setBox),Ia.prototype.dispose.call(this)}}),Qg.add("shader/Point.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float size;\nuniform float canvasHeight;\nuniform float pixelRatio;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\n#include common\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * pixelRatio * ( ( canvasHeight / 2.0 ) / -mvPosition.z );\n#else\ngl_PointSize = size * pixelRatio;\n#endif\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),Qg.add("shader/Point.frag","uniform vec3 diffuse;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nvec3 outgoingLight = vec3( 0.0 );\nvec4 diffuseColor = vec4( diffuse, 1.0 );\n#ifdef USE_MAP\ndiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif\n#include color_fragment\n#include alphatest_fragment\noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a * opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),ka.prototype=Object.assign(Object.create(ua.prototype),{constructor:ka,parameters:Object.assign({pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},ua.prototype.parameters),makeMaterial:function(){ua.prototype.makeMaterial.call(this),this.makeTexture(),this.material.uniforms.map.value=this.tex,this.material.blending=Ju,this.material.needsUpdate=!0,this.wireframeMaterial.uniforms.map.value=this.tex,this.wireframeMaterial.blending=Ju,this.wireframeMaterial.needsUpdate=!0,this.pickingMaterial.uniforms.map.value=this.tex,this.pickingMaterial.blending=Ju,this.pickingMaterial.needsUpdate=!0},makeTexture:function(){this.tex&&this.tex.dispose(),this.tex=Na({delta:this.edgeBleach})},getDefines:function(t){var e=ua.prototype.getDefines.call(this,t);return this.sizeAttenuation&&(e.USE_SIZEATTENUATION=1),this.useTexture&&(e.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(e.ALPHATEST=this.alphaTest.toPrecision(2)),e},setUniforms:function(t){t&&void 0!==t.edgeBleach&&(this.makeTexture(),t.map=this.tex),ua.prototype.setUniforms.call(this,t)},dispose:function(){ua.prototype.dispose.call(this),this.tex&&this.tex.dispose()}}),Fa.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Fa,type:"dot",parameters:Object.assign({thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdOut:{type:"boolean",rebuild:!0},dotType:{type:"select",rebuild:!0,options:{"":"",sphere:"sphere",point:"point"}},radiusType:{type:"select",options:{"":"",value:"value","abs-value":"abs-value","value-min":"value-min",deviation:"deviation",size:"size"}},radius:{type:"number",precision:3,max:10,min:.001,property:"size"},scale:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,disableImpostor:!0,pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},Ia.prototype.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform"}}}),defaultSize:.1,init:function(t){var e=t||{};e.colorScheme=n(e.colorScheme,"uniform"),e.colorValue=n(e.colorValue,14540253),this.thresholdType=n(e.thresholdType,"sigma"),this.thresholdMin=n(e.thresholdMin,2),this.thresholdMax=n(e.thresholdMax,1/0),this.thresholdOut=n(e.thresholdOut,!1),this.dotType=n(e.dotType,"point"),this.radius=n(e.radius,.1),this.scale=n(e.scale,1),this.pointSize=n(e.pointSize,1),this.sizeAttenuation=n(e.sizeAttenuation,!0),this.sortParticles=n(e.sortParticles,!1),this.useTexture=n(e.useTexture,!1),this.alphaTest=n(e.alphaTest,.5),this.forceTransparent=n(e.forceTransparent,!1),this.edgeBleach=n(e.edgeBleach,0),Ia.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},create:function(){var t,e,i,n;if(this.volume){var r,o,a=this.volume;"sigma"===this.thresholdType?(r=a.getValueForSigma(this.thresholdMin),o=a.getValueForSigma(this.thresholdMax)):(r=this.thresholdMin,o=this.thresholdMax),a.filterData(r,o,this.thresholdOut),t=a.getDataPosition(),e=a.getDataColor(this.getColorParams()),i=a.getDataSize(this.radius,this.scale),n=a.getPickingDataColor(this.getColorParams())}else{var s=this.surface;t=s.getPosition(),e=s.getColor(this.getColorParams()),i=s.getSize(this.radius,this.scale),n=s.getPickingColor(this.getColorParams())}"sphere"===this.dotType?this.dotBuffer=new ba(t,e,i,n,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new ka(t,e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach})),this.bufferList.push(this.dotBuffer)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.color&&(this.volume?e.color=this.volume.getDataColor(this.getColorParams()):e.color=this.surface.getColor(this.getColorParams())),"sphere"===this.dotType&&(t.radius||t.scale)&&(this.volume?e.radius=this.volume.getDataSize(this.radius,this.scale):e.radius=this.surface.getSize(this.radius,this.scale)),this.dotBuffer.setAttributes(e)}},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.thresholdType&&this.volume instanceof ra&&("value"===this.thresholdType&&"sigma"===t.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===t.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=t.thresholdType),t&&void 0!==t.radiusType&&("radius"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,"sphere"!==this.dotType||Gg&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,"sphere"!==this.dotType||Gg&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.scale=!0,"sphere"!==this.dotType||Gg&&!this.disableImpostor||(i=!0)),Ia.prototype.setParameters.call(this,t,e,i),this}}),za.prototype=Object.assign(Object.create(Ia.prototype),{constructor:za,type:"structure",parameters:Object.assign({radiusType:{type:"select",options:_r.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},Ia.prototype.parameters),defaultScale:{vdw:1,covalent:1,bfactor:.01,sstruc:1},defaultSize:1,init:function(t){var e=t||{};if(e.colorScheme=n(e.colorScheme,"element"),this.radius=n(e.radius,"vdw"),this.scale=n(e.scale,1),this.assembly=n(e.assembly,"default"),this.defaultAssembly=n(e.defaultAssembly,""),"auto"===e.quality){var i,r=this.structureView,o=this.getAssembly();i=o?o.getAtomCount(r):r.atomCount,$g&&(i*=4);var a=r.atomStore.count/r.residueStore.count<2;a&&(i*=10),i<15e3?e.quality="high":i<8e4?e.quality="medium":e.quality="low"}Ia.prototype.init.call(this,e)},getAssembly:function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},create:function(){if(0!==this.structureView.atomCount){var t=this.getAssembly();if(t)t.partList.forEach(function(t,e){var i=t.getView(this.structureView);if(0!==i.atomCount){var n=this.createData(i,e);n&&(n.sview=i,n.instanceList=t.getInstanceList(),this.dataList.push(n))}},this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},createData:function(){console.error("createData not implemented")},update:function(t){return this.lazy&&!this.visible?void Object.assign(this.lazyProps.what,t):void this.dataList.forEach(function(e){e.bufferList.length>0&&this.updateData(t,e)},this)},updateData:function(){console.error("updateData not implemented")},getColorParams:function(){var t=Ia.prototype.getColorParams.call(this);return t.structure=this.structure,t},getAtomParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},getBondParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},setSelection:function(t,e){return this.selection.setString(t,e),this},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.radiusType&&("size"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,Gg&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,Gg&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.radius=!0,Gg&&!this.disableImpostor||(i=!0)),t&&void 0!==t.defaultAssembly&&(i=!0),Ia.prototype.setParameters.call(this,t,e,i),this},getParameters:function(){var t=Object.assign(Ia.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly});return t},attach:function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach(function(t){t.bufferList.forEach(function(n){i.push(n),e.add(n,t.instanceList)})}),this.setVisibility(this.visible),t()},clear:function(){this.dataList.length=0,Ia.prototype.clear.call(this)},dispose:function(){this.structureView.dispose(),delete this.structure,delete this.structureView,Ia.prototype.dispose.call(this)}}),Qg.add("shader/Line.vert","uniform float nearClip;\nuniform vec3 clipCenter;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),Qg.add("shader/Line.frag","uniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\ngl_FragColor = vec4( vColor, opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),Ba.prototype=Object.assign(Object.create(ua.prototype),{constructor:Ba,setAttributes:function(t){var e,i,n,r,o,a,s=this.geometry.attributes;t.from&&t.to&&(e=t.from,i=t.to,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(n=t.color,r=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,d,f,p,m,g,v,y,b,x=this.size,_=6*x,w=0;w0&&(n="( "+e.join(" ) AND ( ")+" )"),new dn(n)},getStructure:function(){return this.structure.getStructure()},eachBond:function(t,e){this.structure.eachBond(t,this.getSelection(e))},eachAtom:function(t,e){var i=this.getAtomProxy(),n=this.getAtomSet(e),r=this.atomStore.count;if(n&&n.size()=this.V[i][n]&&this.S[i][n]>=this.V[i][n]?(r="S",this.score=this.S[i][n]):this.V[i][n]>=this.H[i][n]?(r="V",this.score=this.V[i][n]):(r="H",this.score=this.H[i][n]),t.Debug&&Hg.log("Alignment: SCORE",this.score),t.Debug&&Hg.log("Alignment: S, V, H",this.S[i][n],this.V[i][n],this.H[i][n]);i>0&&n>0;)"S"===r?this.S[i][n]===this.S[i-1][n-1]+e(i-1,n-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--i,--n,r="S"):this.S[i][n]===this.V[i][n]?r="V":this.S[i][n]===this.H[i][n]?r="H":(--i,--n):"V"===r?this.V[i][n]===this.V[i-1][n]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="V"):this.V[i][n]===this.S[i-1][n]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="S"):--i:"H"===r?this.H[i][n]===this.H[i][n-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="H"):this.H[i][n]===this.S[i][n-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="S"):--n:Hg.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;n>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n;t.Debug&&Hg.timeEnd("Alignment.trace"),t.Debug&&Hg.log([this.ali1,this.ali2])}},es.prototype=Object.assign(Object.create($a.prototype),{constructor:es,type:"structure",signals:Object.assign({trajectoryAdded:null,trajectoryRemoved:null,defaultAssemblyChanged:null},$a.prototype.signals),initSelection:function(t){this.selection=new dn(t),this.structureView=new Qa(this.structure,this.selection),this.selection.signals.stringChanged.add(function(){this.structureView.setSelection(this.selection),this.rebuildRepresentations(),this.rebuildTrajectories()},this)},setSelection:function(t){return this.selection.setString(t),this},setDefaultAssembly:function(t){this.defaultAssembly=t,this.reprList.forEach(function(t){t.setParameters({defaultAssembly:this.defaultAssembly})},this),this.signals.defaultAssemblyChanged.dispatch(t)},rebuildRepresentations:function(){this.reprList.forEach(function(t){t.build()})},rebuildTrajectories:function(){this.trajList.slice().forEach(function(t){t.trajectory.setStructure(this.structureView)},this)},addRepresentation:function(t,e){var i=e||{};return i.defaultAssembly=this.defaultAssembly,$a.prototype.addRepresentation.call(this,t,this.structureView,i)},addTrajectory:function(t,e,i){var n={i:i},r=Ka(t,this.structureView,e);r.signals.frameChanged.add(function(){this.updateRepresentations({position:!0})},this);var o=new Xa(this.stage,r,n,this);return this.trajList.push(o),this.signals.trajectoryAdded.dispatch(o),o},removeTrajectory:function(t){var e=this.trajList.indexOf(t);e!==-1&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},dispose:function(){this.stage.gidPool.removeObject(this.structure),this.trajList.slice().forEach(function(t){t.dispose()}),this.trajList.length=0,this.structure.dispose(),$a.prototype.dispose.call(this)},centerView:function(t,e){t=void 0===t||t;var i=this.getCenter(e);if(t){var n;n=e?this.structureView.getBoundingBox(new dn(e)):this.structureView.boundingBox;var r=n.size(),o=Math.max(r.x,r.y,r.z),a=Math.min(r.x,r.y,r.z);t=Math.max(1,o+a/2)}return this.viewer.centerView(t,i),this},getCenter:function(t){return t?this.structure.atomCenter(new dn(t)):this.structure.center},superpose:function(t,e,i,n){return ts(this.structureView,t.structureView,e,i,n),this.updateRepresentations({position:!0}),this},setVisibility:function(t){return $a.prototype.setVisibility.call(this,t),this.trajList.forEach(function(e){e.setVisibility(t)}),this}}),is.prototype=Object.assign(Object.create($a.prototype),{constructor:is,type:"surface",addRepresentation:function(t,e){return $a.prototype.addRepresentation.call(this,t,this.surface,e)},dispose:function(){"Volume"===this.surface.type&&this.stage.gidPool.addObject(this.surface),this.surface.dispose(),$a.prototype.dispose.call(this)},centerView:function(t){var e=this.surface.center;t&&(t=this.surface.boundingBox.size().length()),this.viewer.centerView(t,e)}}),ns.prototype=Object.assign(Object.create($a.prototype),{constructor:ns,type:"shape",addRepresentation:function(t,e){return $a.prototype.addRepresentation.call(this,t,this.shape,e)},dispose:function(){this.shape.dispose(),$a.prototype.dispose.call(this)}}),rs.prototype=Object.assign(Object.create($a.prototype),{constructor:rs,type:"script",addRepresentation:function(){},removeRepresentation:function(){},run:function(){var t=this;this.setStatus("running"),this.script.call(this.stage,function(){t.setStatus("finished")}),this.setStatus("called")},dispose:function(){this.signals.disposed.dispatch()},setVisibility:function(){},getCenter:function(){}}),as.prototype={constructor:as,parameters:{backgroundColor:{type:"color"},quality:{type:"select",options:{auto:"auto",low:"low",medium:"medium",high:"high"}},sampleLevel:{type:"range",step:1,max:5,min:-1},impostor:{type:"boolean"},rotateSpeed:{type:"number",precision:1,max:10,min:0},zoomSpeed:{type:"number",precision:1,max:10,min:0},panSpeed:{type:"number",precision:1,max:10,min:0},clipNear:{type:"range",step:1,max:100,min:0},clipFar:{type:"range",step:1,max:100,min:0},clipDist:{type:"integer",max:200,min:0},fogNear:{type:"range",step:1,max:100,min:0},fogFar:{type:"range",step:1,max:100,min:0},cameraType:{type:"select",options:{perspective:"perspective",orthographic:"orthographic"}},cameraFov:{type:"range",step:1,max:120,min:15},lightColor:{type:"color"},lightIntensity:{type:"number",precision:2,max:10,min:0},ambientColor:{type:"color"},ambientIntensity:{type:"number",precision:2,max:10,min:0},hoverTimeout:{type:"integer",max:1e4,min:10}},setParameters:function(t){var e=Object.assign({},t),i=this.parameters,n=this.viewer,r=n.controls,o=this.pickingControls;for(var a in e)void 0!==e[a]&&i[a]&&(i[a].int&&(e[a]=parseInt(e[a])),i[a].float&&(e[a]=parseFloat(e[a])),i[a].value=e[a]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(r.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(r.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(r.panSpeed=e.panSpeed),o.setParameters({hoverTimeout:e.hoverTimeout}),n.setClip(e.clipNear,e.clipFar,e.clipDist),n.setFog(void 0,e.fogNear,e.fogFar),n.setCamera(e.cameraType,e.cameraFov),n.setSampling(e.sampleLevel),n.setBackground(e.backgroundColor),n.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},defaultFileRepresentation:function(e){if("structure"===e.type){e.setSelection("/0");var i,n,r=e.structure;if(r.biomolDict.BU1){var o=r.biomolDict.BU1;i=o.getAtomCount(r),n=o.getInstanceCount(),e.setDefaultAssembly("BU1")}else i=r.getModelProxy(0).atomCount,n=1;$g&&(i*=4);var a=r.atomStore.count/r.residueStore.count<2;a&&(i*=10);var s="chainname";if(1===r.getChainnameCount("polymer and /0")&&(s="residueindex"),t.Debug&&console.log(i,n,a),n>5&&i>15e3||i>7e5){var c=Math.min(1.5,Math.max(.1,2e3/(i/n)));a&&(c=Math.min(c,.15)),e.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:c,colorScheme:s,colorScale:"RdYlBu",useWorker:!1})}else i>25e4?e.addRepresentation("backbone",{lineOnly:!0,colorScheme:s,colorScale:"RdYlBu"}):i>1e5?e.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:s,colorScale:"RdYlBu",scale:2}):i>8e4?e.addRepresentation("backbone",{colorScheme:s,colorScale:"RdYlBu",scale:2}):(e.addRepresentation("cartoon",{color:s,colorScale:"RdYlBu",scale:.7,aspectRatio:5,quality:"auto"}),i<5e4&&e.addRepresentation("base",{color:s,colorScale:"RdYlBu",quality:"auto"}),e.addRepresentation("ball+stick",{sele:"hetero and not ( water or ion )",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));this.centerView(),e.structure.frames.length&&e.addTrajectory()}else"surface"!==e.type&&"volume"!==e.type||(e.addRepresentation("surface"),this.centerView())},loadFile:function(t,e){var i=Object.assign({},this.defaultFileParams,e),n=new $a(this,i);n.name=u(t).name,this.addComponent(n);var r=this.tasks;r.increment();var o=function(t){return this.removeComponent(n),n=this.addComponentFromObject(t,i),"script"===n.type&&n.run(),i.defaultRepresentation&&this.defaultFileRepresentation(n),r.decrement(),n}.bind(this),a=function(t){throw n.setStatus(t),r.decrement(),t};return Yn(t,i).then(o,a)},addComponent:function(t){return t?(this.compList.push(t),void this.signals.componentAdded.dispatch(t)):void Hg.warn("Stage.addComponent: no component given")},addComponentFromObject:function(t,e){var i=os(this,t,e);return this.addComponent(i),i},removeComponent:function(t){var e=this.compList.indexOf(t);e!==-1&&this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t)},removeAllComponents:function(t){this.compList.slice().forEach(function(e){t&&e.type!==t||this.removeComponent(e)},this)},handleResize:function(){this.viewer.handleResize()},toggleFullscreen:function(t){function e(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function i(){if(!e()&&n.lastFullscreenElement){var t=n.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",i),document.removeEventListener("mozfullscreenchange",i),document.removeEventListener("webkitfullscreenchange",i),document.removeEventListener("MSFullscreenChange",i),n.handleResize(),n.signals.fullscreenChanged.dispatch(!1)}}if(!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled))return void Hg.log("fullscreen mode (currently) not possible");var n=this;t=t||this.viewer.container,this.lastFullscreenElement=t,e()?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t.dataset.normalWidth=t.style.width,t.dataset.normalHeight=t.style.height,t.style.width=screen.width+"px",t.style.height=screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",i),document.addEventListener("mozfullscreenchange",i),document.addEventListener("webkitfullscreenchange",i),document.addEventListener("MSFullscreenChange",i),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout(function(){n.handleResize()},100))},centerView:function(){if(this.tasks.count>0){var t=function(e,i){0===i&&this.tasks.signals.countChanged.remove(t,this),this.viewer.centerView(!0)};this.tasks.signals.countChanged.add(t,this)}this.viewer.centerView(!0)},setSpin:function(t,e){Array.isArray(t)&&(t=(new P).fromArray(t)),this.viewer.setSpin(t,e)},setOrientation:function(t){this.tasks.onZeroOnce(function(){this.viewer.setOrientation(t)},this)},getOrientation:function(){return this.viewer.getOrientation()},makeImage:function(t){var e=this.viewer,i=this.tasks;return new Promise(function(n,r){function o(){i.increment(),e.makeImage(t).then(function(t){i.decrement(),n(t)}).catch(function(t){i.decrement(),r(t)})}i.onZeroOnce(o)})},setImpostor:function(t){this.parameters.impostor.value=t;var e=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(i){if("script"!==i.type&&e.includes(i.getType())){var n=i.getParameters();n.disableImpostor=!t,i.build(n)}})},setQuality:function(t){this.parameters.quality.value=t;var e=["tube","cartoon","ribbon","trace","rope"],i=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(n){if("script"!==n.type){var r=n.getParameters();if(!e.includes(n.getType())){if(!i.includes(n.getType()))return;if(!r.disableImpostor)return void(n.repr.quality=t)}r.quality=t,n.build(r)}})},eachComponent:function(t,e){this.compList.forEach(function(i,n){e&&i.type!==e||t(i,n)})},eachRepresentation:function(t,e){this.eachComponent(function(e){e.reprList.forEach(function(i){t(i,e)})},e)},getComponentsByName:function(t,e){var i=[];return this.eachComponent(function(e){void 0!==t&&null===e.name.match(t)||i.push(e)},e),new Ha(i)},getRepresentationsByName:function(t,e){var i,n;"object"!=typeof t?(i=void 0,n=t):(i=t.comp,n=t.repr);var r=[];return this.eachRepresentation(function(t,e){void 0!==i&&null===e.name.match(i)||void 0!==n&&null===t.name.match(n)||r.push(t)},e),new Wa(r)},getAnythingByName:function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new Ga(e.concat(i))},dispose:function(){this.tasks.dispose()}},ss.prototype={constructor:ss,_animate:function(){var t;if(this._running=!0,this.traj.inProgress||this._stopFlag||(t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step,(t>=this.end||t=this.end?e=this.start:"backward"===this.direction&&t<=this.start&&(e=this.end),this.traj.setFrame(e),this._stopFlag=!1,this._animate(),this.signals.startedRunning.dispatch()}},pause:function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},stop:function(){this.traj.setFrame(this.start),this.pause()}},cs.prototype=Object.assign(Object.create(za.prototype),{constructor:cs,type:"axes",parameters:Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,align:{type:"button"},showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},Ia.prototype.parameters,{assembly:null}),init:function(t){var e=t||{};e.radius=n(e.radius,.5),e.colorValue=n(e.colorValue,"lightgreen"),za.prototype.init.call(this,e),this.showAxes=n(e.showAxes,!0),this.showBox=n(e.showBox,!1)},getPrincipalAxes:function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getView(t).getPrincipalAxes()},align:function(){var t=this.getPrincipalAxes(this.structureView),e=(new P).copy(t[0][1]).sub(t[0][0]).normalize(),i=(new P).copy(t[2][1]).sub(t[2][0]).normalize();this.viewer.alignView(i,e,t[3],!0)},getAxesData:function(t){var e=this.getPrincipalAxes(t),i=new yt(this.colorValue),n=0,r=0;this.showAxes&&(n+=6,r+=3),this.showBox&&(n+=8,r+=12);var o=new Float32Array(3*n),a=hr(n,i.r,i.g,i.b),s=ur(n,this.radius),c=new Float32Array(3*r),u=new Float32Array(3*r),h=hr(r,i.r,i.g,i.b),l=ur(r,this.radius),d=0;if(this.showAxes){var f=function(t,e){t.toArray(o,2*d),e.toArray(o,2*d+3),t.toArray(c,d),e.toArray(u,d),d+=3};f(e[0][0],e[0][1]),f(e[1][0],e[1][1]),f(e[2][0],e[2][1])}if(this.showBox){var p=2*d,m=function(t){t.toArray(o,p),p+=3},g=(new P).subVectors(e[0][0],e[0][1]).normalize(),v=(new P).subVectors(e[1][0],e[1][1]).normalize(),y=(new P).subVectors(e[2][0],e[2][1]).normalize(),b=new P,x=new P,_=new P,w=new P,S=new P,A=-(1/0),M=-(1/0),C=-(1/0),T=-(1/0),E=-(1/0),I=-(1/0);t.eachAtom(function(t){Sr(b.copy(t),g,e[3]);var i=w.subVectors(b,e[3]).normalize().dot(g),n=b.distanceTo(e[3]);i>0?n>A&&(A=n):n>M&&(M=n),Sr(x.copy(t),v,e[3]);var r=w.subVectors(x,e[3]).normalize().dot(v),o=x.distanceTo(e[3]);r>0?o>C&&(C=o):o>T&&(T=o),Sr(_.copy(t),y,e[3]);var a=w.subVectors(_,e[3]).normalize().dot(y),s=_.distanceTo(e[3]);a>0?s>E&&(E=s):s>I&&(I=s)}),S.copy(e[3]).addScaledVector(g,A).addScaledVector(v,C).addScaledVector(y,E),m(S),S.copy(e[3]).addScaledVector(g,A).addScaledVector(v,C).addScaledVector(y,-I),m(S),S.copy(e[3]).addScaledVector(g,A).addScaledVector(v,-T).addScaledVector(y,-I),m(S),S.copy(e[3]).addScaledVector(g,A).addScaledVector(v,-T).addScaledVector(y,E),m(S),S.copy(e[3]).addScaledVector(g,-M).addScaledVector(v,-T).addScaledVector(y,-I),m(S),S.copy(e[3]).addScaledVector(g,-M).addScaledVector(v,-T).addScaledVector(y,E),m(S),S.copy(e[3]).addScaledVector(g,-M).addScaledVector(v,C).addScaledVector(y,E),m(S),S.copy(e[3]).addScaledVector(g,-M).addScaledVector(v,C).addScaledVector(y,-I),m(S);var L=d,R=function(t,e){S.fromArray(o,2*d+3*t).toArray(c,L),S.fromArray(o,2*d+3*e).toArray(u,L),L+=3};R(0,1),R(0,3),R(0,6),R(1,2),R(1,7),R(2,3),R(2,4),R(3,5),R(4,5),R(4,7),R(5,6),R(6,7)}return{vertexPosition:o,vertexColor:a,vertexRadius:s,edgePosition1:c,edgePosition2:u,edgeColor:h,edgeRadius:l}},create:function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new ba(t.vertexPosition,t.vertexColor,t.vertexRadius,void 0,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new Ma(t.edgePosition1,t.edgePosition2,t.edgeColor,t.edgeColor,t.edgeRadius,void 0,void 0,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},updateData:function(t,e){var i=this.getAxesData(e.sview),n={},r={};t&&!t.position||(n.position=i.vertexPosition,r.position1=i.edgePosition1,r.position2=i.edgePosition2),t&&!t.color||(n.color=i.vertexColor,r.color=i.edgeColor,r.color2=i.edgeColor),t&&!t.radius||(n.radius=i.vertexRadius,r.radius=i.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(r)}}),Zg.add("axes",cs),us.prototype=Object.assign(Object.create(za.prototype),{constructor:us,type:"ball+stick",defaultSize:.15,parameters:Object.assign({sphereDetail:!0,radialSegments:!0,openEnded:!0,disableImpostor:!0,aspectRatio:{type:"number",precision:1,max:10,min:1},lineOnly:{type:"boolean",rebuild:!0},cylinderOnly:{type:"boolean",rebuild:!0},multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondScale:{type:"number",precision:2,max:1,min:.01},bondSpacing:{type:"number",precision:2,max:2,min:.5}},za.prototype.parameters),init:function(t){var e=t||{};e.radius=n(e.radius,this.defaultSize),this.aspectRatio=n(e.aspectRatio,2),this.lineOnly=n(e.lineOnly,!1),this.cylinderOnly=n(e.cylinderOnly,!1),this.multipleBond=n(e.multipleBond,"off"),this.bondSpacing=n(e.bondSpacing,1),this.bondScale=n(e.bondScale,.4),za.prototype.init.call(this,e)},getAtomParams:function(t,e){return e=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},e),za.prototype.getAtomParams.call(this,t,e)},getAtomData:function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},e),za.prototype.getBondParams.call(this,t,e)},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new Ba(e.position1,e.position2,e.color1,e.color2,this.getBufferParams()),i.push(this.lineBuffer);else{var n=new Ma(e.position1,e.position2,e.color1,e.color2,e.radius,e.pickingColor1,e.pickingColor2,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(n),!this.cylinderOnly){var r=this.getAtomData(t),o=new ba(r.position,r.color,r.radius,r.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(o)}}return{bufferList:i}},updateData:function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)}else{var r={};if(t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color1,r.color2=i.color2),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r),!this.cylinderOnly){var o=this.getAtomData(e.sview,t),a={};t&&!t.position||(a.position=o.position),t&&!t.color||(a.color=o.color),t&&!t.radius||(a.radius=o.radius),e.bufferList[1].setAttributes(a)}}},setParameters:function(t){var e=!1,i={};return t&&(t.aspectRatio||t.bondSpacing||t.bondScale)&&(i.radius=!0,Gg&&!this.disableImpostor||(e=!0)),za.prototype.setParameters.call(this,t,i,e),this}}),Zg.add("ball+stick",us),hs.prototype=Object.assign(Object.create(us.prototype),{constructor:hs,type:"backbone",defaultSize:.25,parameters:Object.assign({},us.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=n(e.aspectRatio,1),us.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.backbone=!0,t.getBackboneBondData(n)}}),Zg.add("backbone",hs),ls.prototype=Object.assign(Object.create(us.prototype),{constructor:ls,type:"base",defaultSize:.3,parameters:Object.assign({},us.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=n(e.aspectRatio,1),us.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.rung=!0,t.getRungBondData(n)}}),Zg.add("base",ls),fs.prototype={constructor:fs,getAtomIterator:function(t,e){function i(){var t=this.get(u);return u+=1,t}function n(i){var n=h[c%4];if(n.index=o.getAtomIndexByType(i,t),e&&i>0&&ie)&&(s=!0,r.add_unsafe(n.index),o.addBond(a,n,1))}s&&r.add_unsafe(a.index)});var a=new pv(o.count);return a.set_all(!0),Hg.timeEnd("Contact within"),{atomSet:r,bondSet:a,bondStore:o}}},bs.prototype=Object.assign(Object.create(za.prototype),{constructor:bs,type:"contact",defaultSize:.25,parameters:Object.assign({contactType:{type:"select",rebuild:!0,options:{polar:"polar",polarBackbone:"polar backbone"}},maxDistance:{type:"number",precision:1, -max:10,min:.1,rebuild:!0},maxAngle:{type:"integer",max:180,min:0,rebuild:!0},radialSegments:!0,disableImpostor:!0},za.prototype.parameters),init:function(t){var e=t||{};e.radius=n(e.radius,this.defaultSize),this.contactType=n(e.contactType,"polarBackbone"),this.maxDistance=n(e.maxDistance,3.5),this.maxAngle=n(e.maxAngle,40),za.prototype.init.call(this,e)},getContactData:function(t){var e={polar:vs,polarBackbone:ys},i=e[this.contactType](t,this.maxDistance,this.maxAngle);return i},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getContactData(t),i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(t,void 0,i),r=new Ma(n.position1,n.position2,n.color1,n.color2,n.radius,n.pickingColor1,n.pickingColor2,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));return{bufferList:[r],bondSet:e.bondSet,bondStore:e.bondStore}},updateData:function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,n),o={};t&&!t.position||(o.position=cr(r.position1,r.position2),o.position1=r.position1,o.position2=r.position2),t&&!t.color||(o.color=r.color1,o.color2=r.color2),t&&!t.radius||(o.radius=r.radius),e.bufferList[0].setAttributes(o)}}),Zg.add("contact",bs),Qg.add("shader/SDFFont.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform bool ortho;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include color_pars_vertex\n#include common\nvoid main(void){\n#include color_vertex\ntexCoord = inputTexCoord;\nfloat _zOffset = zOffset;\nif( texCoord.x == 10.0 ){\n_zOffset -= 0.001;\n}\nvec3 pos = position;\nif( ortho ){\npos += normalize( cameraPosition ) * _zOffset;\n}\nvec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\nvec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\ncameraCornerPos.xy += mapping * inputSize * 0.01;\ncameraCornerPos.x += xOffset;\ncameraCornerPos.y += yOffset;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\nvViewPosition = -cameraCornerPos.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),Qg.add("shader/SDFFont.frag","uniform sampler2D fontTexture;\nuniform float opacity;\nuniform bool showBorder;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#ifdef SDF\nconst float smoothness = 16.0;\n#else\nconst float smoothness = 256.0;\n#endif\nconst float gamma = 2.2;\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nif( texCoord.x > 1.0 ){\ngl_FragColor = vec4( backgroundColor, backgroundOpacity );\n}else{\nfloat sdf = texture2D( fontTexture, texCoord ).a;\nif( showBorder ) sdf += borderWidth;\nfloat w = clamp(\nsmoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n0.0,\n0.5\n);\nfloat a = smoothstep( 0.5 - w, 0.5 + w, sdf );\na = pow( a, 1.0 / gamma );\nif( a < 0.2 ) discard;\na *= opacity;\nvec3 outgoingLight = vColor;\nif( showBorder && sdf < ( 0.5 + borderWidth ) ){\noutgoingLight = borderColor;\n}\ngl_FragColor = vec4( outgoingLight, a );\n}\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}");var Sv=function(){var t={};return function(e){var i=JSON.stringify(e);return void 0===t[i]&&(t[i]=new xs(e)),t[i]}}();xs.prototype={constructor:xs,build:function(){var t=this.size+2*this.outline+Math.round(this.size/4),e=this.width/4,i=document.createElement("canvas");i.width=e,i.height=t;var n=i.getContext("2d");n.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,n.fillStyle="#FF0000",n.textAlign="left",n.textBaseline="bottom",n.lineJoin="round";for(var r=[],o=3*this.outline,a=0;athis.width&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>this.height&&console.warn("canvas to small"),this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH},this.context2.drawImage(this.canvas,0,0,this.scratchW,this.scratchH,this.currentX,this.currentY,this.scratchW,this.scratchH),this.currentX+=this.scratchW),this.mapped[t]},draw:function(t){var e=this.lineHeight,i=this.outline,n=this.context,r=this.scratch,o=this.maxWidth,a=this.colors,s=i,c=e-this.outline,u=n.measureText(t),h=Math.min(o,Math.ceil(u.width+2*s+1));n.clearRect(0,0,h,e);var l,d,f,p,m;if(0===this.outline)for(n.fillText(t,s,c),p=n.getImageData(0,0,h,e),m=p.data,f=3,l=0,d=m.length/4;l0;--l)f=l>1?2*l-2:l,n.strokeStyle=a[f-1],n.lineWidth=f,n.strokeText(t,s,c);n.globalCompositeOperation="multiply",n.fillStyle="#FF00FF",n.fillText(t,s,c),p=n.getImageData(0,0,h,e),m=p.data,f=0;var g=this.gamma;for(l=0,d=m.length/4;l0&&(i-=h,r=r.subarray(0,3*i));var l=new pv(s.count);return l.set_all(!0),{text:n,position:r,bondSet:l,bondStore:s}},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},create:function(){if(0!==this.structureView.atomCount){var t=this.atomPair.length;if(0!==t){var e=this.getDistanceData(this.structureView,this.atomPair),i=new yt(this.labelColor);this.textBuffer=new _s(e.position,ur(t,this.labelSize),hr(t,i.r,i.g,i.b),e.text,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,zOffset:this.labelZOffset,opacity:1,visible:this.labelVisible}));var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(this.structureView,void 0,n);this.cylinderBuffer=new Ma(r.position1,r.position2,r.color1,r.color2,r.radius,void 0,void 0,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bondSet:e.bondSet,bondStore:e.bondStore,position:e.position,bufferList:[this.textBuffer,this.cylinderBuffer]})}}},update:function(t){t.position?this.build():za.prototype.update.call(this,t)},updateData:function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,i),r={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=ur(a,this.labelSize)),t.labelColor){var s=new yt(this.labelColor);o.color=hr(a,s.r,s.g,s.b)}t.color&&(r.color=n.color1,r.color2=n.color2),(t.radius||t.scale)&&(r.radius=n.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(r)},setVisibility:function(t,e){return za.prototype.setVisibility.call(this,t,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),e||this.viewer.requestRender(),this},setParameters:function(t){var e=!1,i={};return t&&t.labelSize&&(i.labelSize=!0),t&&t.labelColor&&(i.labelColor=!0),za.prototype.setParameters.call(this,t,i,e),t&&void 0!==t.labelVisible&&this.setVisibility(this.visible),this}}),Zg.add("distance",ws),Ss.prototype=Object.assign(Object.create(ua.prototype),{constructor:Ss,setAttributes:function(t){var e,i,n,r=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,n=r.position.array,r.position.needsUpdate=!0);var o,a,s=this.size,c=this.scale;if(t.position&&t.vector)for(var u=0;u radius2) {\nspaceposition.y = mapping.y * 1.5 * radius1;\nspaceposition.x = mapping.x * 1.5 * radius1;\n} else {\nspaceposition.y = mapping.y * 1.5 * radius2;\nspaceposition.x = mapping.x * 1.5 * radius2;\n}\nspaceposition.w = 1.0;\nvec4 e3 = vec4( 1.0 );\nvec3 e1, e1_temp, e2, e2_temp;\ne3.xyz = normalize(position_atom1-position_atom2);\nif (e3.z == 0.0) { e3.z = 0.0000000000001;}\nif ( (position_atom1.x - position_atom2.x) == 0.0) { position_atom1.x += 0.001;}\nif ( (position_atom1.y - position_atom2.y) == 0.0) { position_atom1.y += 0.001;}\nif ( (position_atom1.z - position_atom2.z) == 0.0) { position_atom1.z += 0.001;}\nvec4 focus = vec4( 1.0 );\nfocus.x = ( position_atom1.x*position_atom1.x - position_atom2.x*position_atom2.x +\n( radius2*radius2 - radius1*radius1 )*e3.x*e3.x/shrink )/(2.0*(position_atom1.x - position_atom2.x));\nfocus.y = ( position_atom1.y*position_atom1.y - position_atom2.y*position_atom2.y +\n( radius2*radius2 - radius1*radius1 )*e3.y*e3.y/shrink )/(2.0*(position_atom1.y - position_atom2.y));\nfocus.z = ( position_atom1.z*position_atom1.z - position_atom2.z*position_atom2.z +\n( radius2*radius2 - radius1*radius1 )*e3.z*e3.z/shrink )/(2.0*(position_atom1.z - position_atom2.z));\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2_temp = e1.yzx * e3.zxy - e1.zxy * e3.yzx;\ne2 = normalize(e2_temp);\nmat3 R= mat3( e1.xyz, e2.xyz, e3.xyz );\nvertex_position.xyz = R * spaceposition.xyz;\nvertex_position.w = 1.0;\nvertex_position.x += (position_atom1.x+position_atom2.x) / 2.0;\nvertex_position.y += (position_atom1.y+position_atom2.y) / 2.0;\nvertex_position.z += (position_atom1.z+position_atom2.z) / 2.0;\ngl_Position = modelViewProjectionMatrix * vertex_position;\nvec4 i_near, i_far;\nvec4 near = gl_Position;\nnear.z = 0.0 ;\nnear = modelViewProjectionMatrixInverse * near;\ni_near = near;\nvec4 far = gl_Position;\nfar.z = far.w ;\ni_far = modelViewProjectionMatrixInverse * far;\nprime1 = vec4( position_atom1 - (position_atom1 - focus.xyz)*shrink, 1.0 );\nprime2 = vec4( position_atom2 - (position_atom2 - focus.xyz)*shrink, 1.0 );\nfloat Rsquare = (radius1*radius1/shrink) - (\n(position_atom1.x - focus.x)*(position_atom1.x - focus.x) +\n(position_atom1.y - focus.y)*(position_atom1.y - focus.y) +\n(position_atom1.z - focus.z)*(position_atom1.z - focus.z)\n);\nfocus.w = Rsquare;\nmatrix_near = mat4( i_near, i_far, focus, e3 );\ngl_Position.z = 1.0;\n}"),Qg.add("shader/HyperballStickImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float shrink;\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewMatrixInverseTranspose;\nuniform mat4 projectionMatrix;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\nvarying vec3 vPickingColor2;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat calcClip( vec4 cameraPos ){\nreturn dot( cameraPos, vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nfloat calcClip( vec3 cameraPos ){\nreturn calcClip( vec4( cameraPos, 1.0 ) );\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nstruct Ray {\nvec3 origin ;\nvec3 direction ;\n};\nbool cutoff_plane (vec3 M, vec3 cutoff, vec3 x3){\nfloat a = x3.x;\nfloat b = x3.y;\nfloat c = x3.z;\nfloat d = -x3.x*cutoff.x-x3.y*cutoff.y-x3.z*cutoff.z;\nfloat l = a*M.x+b*M.y+c*M.z+d;\nif (l<0.0) {return true;}\nelse{return false;}\n}\nvec3 isect_surf(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t1 =(-b-sqrt(delta))/a;\nreturn r.origin+t1*r.direction;\n}\nvec3 isect_surf2(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t2 =(-b+sqrt(delta))/a;\nreturn r.origin+t2*r.direction;\n}\nRay primary_ray(vec4 near1, vec4 far1){\nvec3 near=near1.xyz/near1.w;\nvec3 far=far1.xyz/far1.w;\nreturn Ray(near,far-near);\n}\nfloat update_z_buffer(vec3 M, mat4 ModelViewP){\nfloat depth1;\nvec4 Ms=(ModelViewP*vec4(M,1.0));\nreturn depth1=(1.0+Ms.z/Ms.w)/2.0;\n}\nvoid main(){\nfloat radius = max( vRadius, vRadius2 );\nvec4 i_near, i_far, focus;\nvec3 e3, e1, e1_temp, e2;\ni_near = vec4(matrix_near[0][0],matrix_near[0][1],matrix_near[0][2],matrix_near[0][3]);\ni_far = vec4(matrix_near[1][0],matrix_near[1][1],matrix_near[1][2],matrix_near[1][3]);\nfocus = vec4(matrix_near[2][0],matrix_near[2][1],matrix_near[2][2],matrix_near[2][3]);\ne3 = vec3(matrix_near[3][0],matrix_near[3][1],matrix_near[3][2]);\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2 = normalize(cross(e1,e3));\nvec4 equation = focus;\nfloat shrinkfactor = shrink;\nfloat t1 = -1.0/(1.0-shrinkfactor);\nfloat t2 = 1.0/(shrinkfactor);\nvec4 colonne1, colonne2, colonne3, colonne4;\nmat4 mat;\nvec3 equation1 = vec3(t2,t2,t1);\nfloat A1 = - e1.x*equation.x - e1.y*equation.y - e1.z*equation.z;\nfloat A2 = - e2.x*equation.x - e2.y*equation.y - e2.z*equation.z;\nfloat A3 = - e3.x*equation.x - e3.y*equation.y - e3.z*equation.z;\nfloat A11 = equation1.x*e1.x*e1.x + equation1.y*e2.x*e2.x + equation1.z*e3.x*e3.x;\nfloat A21 = equation1.x*e1.x*e1.y + equation1.y*e2.x*e2.y + equation1.z*e3.x*e3.y;\nfloat A31 = equation1.x*e1.x*e1.z + equation1.y*e2.x*e2.z + equation1.z*e3.x*e3.z;\nfloat A41 = equation1.x*e1.x*A1 + equation1.y*e2.x*A2 + equation1.z*e3.x*A3;\nfloat A22 = equation1.x*e1.y*e1.y + equation1.y*e2.y*e2.y + equation1.z*e3.y*e3.y;\nfloat A32 = equation1.x*e1.y*e1.z + equation1.y*e2.y*e2.z + equation1.z*e3.y*e3.z;\nfloat A42 = equation1.x*e1.y*A1 + equation1.y*e2.y*A2 + equation1.z*e3.y*A3;\nfloat A33 = equation1.x*e1.z*e1.z + equation1.y*e2.z*e2.z + equation1.z*e3.z*e3.z;\nfloat A43 = equation1.x*e1.z*A1 + equation1.y*e2.z*A2 + equation1.z*e3.z*A3;\nfloat A44 = equation1.x*A1*A1 + equation1.y*A2*A2 + equation1.z*A3*A3 - equation.w;\ncolonne1 = vec4(A11,A21,A31,A41);\ncolonne2 = vec4(A21,A22,A32,A42);\ncolonne3 = vec4(A31,A32,A33,A43);\ncolonne4 = vec4(A41,A42,A43,A44);\nmat = mat4(colonne1,colonne2,colonne3,colonne4);\nRay ray = primary_ray(i_near,i_far) ;\nvec3 M;\nM = isect_surf(ray, mat);\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nvec4 M1 = vec4(M,1.0);\nvec4 M2 = mat*M1;\nvec3 _normal = ( modelViewMatrixInverseTranspose * M2 ).xyz;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\n#ifdef NEAR_CLIP\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 ){\nM = isect_surf2(ray, mat);\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / radius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix);\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#endif\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\nfloat distance_ratio = ((M.x-prime2.x)*e3.x + (M.y-prime2.y)*e3.y +(M.z-prime2.z)*e3.z) /\ndistance(prime2.xyz,prime1.xyz);\n#ifdef PICKING\nif( distance_ratio > 0.5 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n#else\nvec3 vViewPosition = -( modelViewMatrix * vec4( M, 1.0 ) ).xyz;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distance_ratio>0.5 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Ps.prototype=Object.assign(Object.create(ga.prototype),{constructo:Ps});var Av=new A;Ts.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Ts,parameters:Object.assign({shrink:{uniform:!0}},Ps.prototype.parameters)}),Is.prototype=Object.assign(Object.create(Ms.prototype),{constructor:Is,type:"hyperball",defaultSize:1,parameters:Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},Ms.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.scale=n(e.scale,.2),e.radius=n(e.radius,"vdw"),this.shrink=n(e.shrink,.12),Ms.prototype.init.call(this,e)},getBondParams:function(t,e){return t&&!t.radius||(e=Object.assign({radius2:!0},e)),Ms.prototype.getBondParams.call(this,t,e)},createData:function(t){var e=t.getAtomData(this.getAtomParams()),i=t.getBondData(this.getBondParams()),n=new ba(e.position,e.color,e.radius,e.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));this.__center=new Float32Array(3*t.bondCount);var r=new Es(i.position1,i.position2,i.color1,i.color2,i.radius1,i.radius2,i.pickingColor1,i.pickingColor2,this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}),this.disableImpostor);return{bufferList:[n,r]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),n=e.sview.getBondData(this.getBondParams()),r={},o={};if(!t||t.position){r.position=i.position;var a=n.position1,s=n.position2;o.position=cr(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(r.color=i.color,o.color=n.color1,o.color2=n.color2),t&&!t.radius||(r.radius=i.radius,o.radius=n.radius1,o.radius2=n.radius2),e.bufferList[0].setAttributes(r),e.bufferList[1].setAttributes(o)}}),Zg.add("hyperball",Is),Ls.prototype={constructor:Ls,atomLabel:function(t){var e,i=this.type;switch(i){case"atomname":e=t.atomname;break;case"atomindex":e=""+t.index;break;case"occupancy":e=t.occupancy.toFixed(2);break;case"bfactor":e=t.bfactor.toFixed(2);break;case"serial":e=""+t.serial;break;case"element":e=t.element;break;case"atom":e=t.atomname+"|"+t.index;break;case"resname":e=t.resname;break;case"resno":e=""+t.resno;break;case"res":var n=t.resname.toUpperCase();e=(Qp[n]||n)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},Ls.types={"":"",atomname:"atom name",atomindex:"atom index",occupancy:"occupancy",bfactor:"b-factor",serial:"serial",element:"element",atom:"atom name + index",resname:"residue name",resno:"residue no",res:"residue name + no",text:"text",qualified:"qualified name"},Rs.prototype=Object.assign(Object.create(za.prototype),{constructor:Rs,type:"label",parameters:Object.assign({labelType:{type:"select",options:Ls.types,rebuild:!0},labelText:{type:"hidden",rebuild:!0},fontFamily:{type:"select",options:{"sans-serif":"sans-serif",monospace:"monospace",serif:"serif"},buffer:!0},fontStyle:{type:"select",options:{normal:"normal",italic:"italic"},buffer:!0},fontWeight:{type:"select",options:{normal:"normal",bold:"bold"},buffer:!0},sdf:{type:"boolean",buffer:!0},xOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},yOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},zOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},attachment:{type:"select",options:{"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right","middle-left":"middle-left","middle-center":"middle-center","middle-right":"middle-right","top-left":"top-left","top-center":"top-center","top-right":"top-right"},rebuild:!0},showBorder:{type:"boolean",buffer:!0},borderColor:{type:"color",buffer:!0},borderWidth:{type:"number",precision:2,max:.3,min:0,buffer:!0},showBackground:{type:"boolean",rebuild:!0},backgroundColor:{type:"color",buffer:!0},backgroundMargin:{type:"number",precision:2,max:2,min:0,rebuild:!0},backgroundOpacity:{type:"range",step:.01,max:1,min:0,buffer:!0}},za.prototype.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.labelType=n(e.labelType,"res"),this.labelText=n(e.labelText,{}),this.fontFamily=n(e.fontFamily,"sans-serif"),this.fontStyle=n(e.fontStyle,"normal"),this.fontWeight=n(e.fontWeight,"bold"),this.sdf=n(e.sdf,"Chrome"===jg),this.xOffset=n(e.xOffset,0),this.yOffset=n(e.yOffset,0),this.zOffset=n(e.zOffset,.5),this.attachment=n(e.attachment,"bottom-left"),this.showBorder=n(e.showBorder,!1),this.borderColor=n(e.borderColor,"lightgrey"),this.borderWidth=n(e.borderWidth,.15),this.showBackground=n(e.showBackground,!1),this.backgroundColor=n(e.backgroundColor,"lightgrey"),this.backgroundMargin=n(e.backgroundMargin,.5),this.backgroundOpacity=n(e.backgroundOpacity,1),za.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0,radius:!0},i=t.getAtomData(this.getAtomParams(e)),n=[],r=new Ls(this.labelType,this.labelText);t.eachAtom(function(t){n.push(r.atomLabel(t))});var o=new _s(i.position,i.radius,i.color,n,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,xOffset:this.xOffset,yOffset:this.yOffset,zOffset:this.zOffset,attachment:this.attachment,showBorder:this.showBorder,borderColor:this.borderColor,borderWidth:this.borderWidth,showBackground:this.showBackground,backgroundColor:this.backgroundColor,backgroundMargin:this.backgroundMargin,backgroundOpacity:this.backgroundOpacity}));return{bufferList:[o]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.radius||(n.size=i.radius),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),Zg.add("label",Rs),Os.prototype=Object.assign(Object.create(za.prototype),{constructor:Os,type:"line",parameters:Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},Ia.prototype.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null, -diffuse:null}),init:function(t){var e=t||{};this.multipleBond=n(e.multipleBond,"off"),this.bondSpacing=n(e.bondSpacing,1),za.prototype.init.call(this,e)},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},e),za.prototype.getBondParams.call(this,t,e)},createData:function(t){var e={position:!0,color:!0},i=t.getBondData(this.getBondParams(e)),n=new Ba(i.position1,i.position2,i.color1,i.color2,this.getBufferParams());return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)},setParameters:function(t){var e=!1,i={};return t&&t.bondSpacing&&(i.position=!0),za.prototype.setParameters.call(this,t,i,e),this}}),Zg.add("line",Os),Ns.__deps=[ia,ea,na,Ar,Ds],Fs.__deps=[ia,na,ur,Ar,Dr,Er,Nr,ks,n],Xg.add("molsurf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&n){var r="av"===n.type?Fs:Ns,o=new r(i.coordList,i.radiusList,i.indexList),a=o.getSurface(n.type,n.probeRadius,n.scaleFactor,n.cutoff,!0,n.smooth),s=[a.position.buffer,a.index.buffer];a.normal&&s.push(a.normal.buffer),a.atomindex&&s.push(a.atomindex.buffer),e({sd:a,p:n},s)}},[Ns,Fs]),zs.prototype={getAtomData:function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},makeSurface:function(t,e){var i=new Xo("","",t);return i.info.type=e.type,i.info.probeRadius=e.probeRadius,i.info.scaleFactor=e.scaleFactor,i.info.smooth=e.smooth,i.info.cutoff=e.cutoff,i},getSurface:function(t){var e=t||{},i=this.getAtomData(),n=i.position,r=i.radius,o=i.index,a="av"===e.type?Fs:Ns,s=new a(n,r,o),c=s.getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth);return this.makeSurface(c,e)},getSurfaceWorker:function(t,e){var i=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new qo("molsurf"));var n=this.getAtomData(),r=n.position,o=n.radius,a=n.index,s={args:{coordList:r,radiusList:o,indexList:a},params:i},c=[r.buffer,o.buffer,a.buffer];this.worker.post(s,c,function(t){var n=t.data.sd;e(this.makeSurface(n,i))}.bind(this),function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),this.worker.terminate(),this.worker=void 0;var n=this.getSurface(i);e(n)}.bind(this))}else{var u=this.getSurface(i);e(u)}},dispose:function(){this.worker&&this.worker.terminate()}},Bs.prototype=Object.assign(Object.create(za.prototype),{constructor:Bs,type:"surface",parameters:Object.assign({surfaceType:{type:"select",rebuild:!0,options:{vws:"vws",sas:"sas",ms:"ms",ses:"ses",av:"av"}},probeRadius:{type:"number",precision:1,max:20,min:0,rebuild:!0},smooth:{type:"integer",precision:1,max:10,min:0,rebuild:!0},scaleFactor:{type:"number",precision:1,max:5,min:0,rebuild:!0},cutoff:{type:"number",precision:2,max:50,min:0,rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text"},volume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},za.prototype.parameters,{radiusType:null,radius:null,scale:null}),init:function(t){var e=t||{};e.colorScheme=n(e.colorScheme,"uniform"),e.colorValue=n(e.colorValue,14540253),this.surfaceType=n(e.surfaceType,"ms"),this.probeRadius=n(e.probeRadius,1.4),this.smooth=n(e.smooth,2),this.scaleFactor=n(e.scaleFactor,2),this.cutoff=n(e.cutoff,0),this.background=n(e.background,!1),this.opaqueBack=n(e.opaqueBack,!0),this.filterSele=n(e.filterSele,""),this.volume=n(e.volume,void 0),this.useWorker=n(e.useWorker,!0),za.prototype.init.call(this,t)},prepareData:function(t,e,i){var n=this.__infoList[e];if(n||(n={},this.__infoList[e]=n),n.molsurf&&n.sele===t.selection.string)i(e);else{n.sele=t.selection.string,n.molsurf=new zs(t);var r=this.getSurfaceParams(),o=function(t){n.surface=t,i(e)};this.useWorker?n.molsurf.getSurfaceWorker(r,o):o(n.molsurf.getSurface(r))}},prepare:function(t){if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0),0===this.structureView.atomCount)return void t();var e=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),i="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[i];n?n.partList.forEach(function(t,i){var r=t.getView(this.structureView);this.prepareData(r,i,function(t){t===n.partList.length-1&&e()}.bind(this))},this):this.prepareData(this.structureView,0,e)},createData:function(t,e){var i=this.__infoList[e],n=new Ra(i.surface.getPosition(),i.surface.getColor(this.getColorParams()),i.surface.getFilteredIndex(this.filterSele,t),i.surface.getNormal(),i.surface.getPickingColor(this.getColorParams()),this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),r=new Oa(n);return{bufferList:[r],info:i}},updateData:function(t,e){var i={};return t.position?(this.__forceNewMolsurf=!0,void this.build()):(t.color&&(i.color=e.info.surface.getColor(this.getColorParams())),t.index&&(i.index=e.info.surface.getFilteredIndex(this.filterSele,e.sview)),void e.bufferList[0].setAttributes(i))},setParameters:function(t,e,i){return e=e||{},t&&t.filterSele&&(e.index=!0),t&&void 0!==t.volume&&(e.color=!0),za.prototype.setParameters.call(this,t,e,i),this},getSurfaceParams:function(t){var e=Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth,cutoff:this.cutoff,useWorker:this.useWorker},t);return e},getColorParams:function(){var t=za.prototype.getColorParams.call(this);return t.volume=this.volume,t},clear:function(){za.prototype.clear.call(this)},dispose:function(){this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0,za.prototype.dispose.call(this)}}),Zg.add("surface",Bs),Us.prototype=Object.assign(Object.create(za.prototype),{constructor:Us,type:"point",parameters:Object.assign({pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},Ia.prototype.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),init:function(t){var e=t||{};this.pointSize=n(e.pointSize,1),this.sizeAttenuation=n(e.sizeAttenuation,!0),this.sortParticles=n(e.sortParticles,!1),this.useTexture=n(e.useTexture,!1),this.alphaTest=n(e.alphaTest,.5),this.forceTransparent=n(e.forceTransparent,!1),this.edgeBleach=n(e.edgeBleach,0),za.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0},i=t.getAtomData(this.getAtomParams(e)),n=new ka(i.position,i.color,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}));return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),Zg.add("point",Us),Qg.add("shader/Ribbon.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec3 dir;\nattribute float size;\n#ifdef PICKING\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(void){\n#ifdef PICKING\nvPickingColor = pickingColor;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\ntransformed += normalize( dir ) * size;\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),js.prototype=Object.assign(Object.create(ua.prototype),{constructor:js,setAttributes:function(t){var e,i,n,r,o,a,s,c,u,h,l,d,f=this.size,p=f/4,m=this.geometry.attributes;t.position&&(e=t.position,s=m.position.array,m.position.needsUpdate=!0),t.normal&&(i=t.normal,c=m.normal.array,m.normal.needsUpdate=!0),t.size&&(n=t.size,u=m.size.array,m.size.needsUpdate=!0),t.dir&&(r=t.dir,h=m.dir.array,m.dir.needsUpdate=!0),t.color&&(o=t.color,l=m.color.array,m.color.needsUpdate=!0),t.pickingColor&&(a=t.pickingColor,d=m.pickingColor.array,m.pickingColor.needsUpdate=!0);var g,v,y,b,x,_,w,S=n?n[0]:null;for(g=0;gw)continue}f=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),m=parseInt(T.substr(15,5)),A.growIfFull(),A.atomTypeId[M]=S.add(d),A.x[M]=L,A.y[M]=R,A.z[M]=O,A.serial[M]=m,o.addAtom(P,"","",f,p,0,"l"),M+=1}}}t.Debug&&Hg.time("GroParser._parse "+this.name);var i,n,r=this.structure,o=this.structureBuilder,a=this.firstModelOnly,s=this.asTrajectory,c=this.cAlphaOnly,u=r.frames,h=r.boxes,l=this.streamer.peekLines(3);r.title=l[0].trim();var d,f,p,m,g=l[2].length-l[2].lastIndexOf(".")-1,v=5+g,y=20,b=20+v,x=20+2*v,_=parseInt(l[1]),w=_+3,S=r.atomMap,A=r.atomStore;A.resize(_);var M=0,P=0,C=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.unitcell=new Js(h[0][0],h[0][4],h[0][8],90,90,90,"P 1"),o.finalize(),r.finalizeAtoms(),To(r),Eo(r),r.finalizeBonds(),Co(r,bv(r)),Do(r),t.Debug&&Hg.timeEnd("GroParser._parse "+this.name)}}),Kg.add("gro",tc);var Mv={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"};ec.prototype=Object.assign(Object.create(Qs.prototype),{constructor:ec,type:"pdb",_parse:function(){function e(t,e,U){for(var Z,K,Q=t;Q0)continue;var J,tt,et,it,nt;if(P){if(it=s.split(C),nt=10===it.length?1:0,m=it[2],R&&"CA"!==m)continue;J=parseFloat(it[6-nt]),tt=parseFloat(it[7-nt]),et=parseFloat(it[8-nt])}else{if(m=s.substr(12,4).trim(),R&&"CA"!==m)continue;J=parseFloat(s.substr(30,8)),tt=parseFloat(s.substr(38,8)),et=parseFloat(s.substr(46,8))}if(L&&(Z=3*n,i[Z+0]=J,i[Z+1]=tt,i[Z+2]=et,n+=1,N))continue;var rt;P?(u=parseInt(it[1]),rt="",g="H"===s[0]?1:0,h=nt?"":it[4],l=parseInt(it[5-nt]),p="",d=it[3],v=parseFloat(it[9-nt]),y="",f=0):(u=parseInt(s.substr(6,5)),rt=s.substr(76,2).trim(),g="H"===s[0]?1:0,h=s[21].trim(),l=parseInt(s.substr(22,4)),p=s[26].trim(),d=s.substr(17,4).trim(),v=parseFloat(s.substr(60,6)),y=s[16].trim(),f=parseFloat(s.substr(54,6))),G.growIfFull(),G.atomTypeId[X]=V.add(m,rt),G.x[X]=J,G.y[X]=tt,G.z[X]=et,G.serial[X]=u,G.bfactor[X]=isNaN(v)?0:v,G.altloc[X]=y.charCodeAt(0),G.occupancy[X]=isNaN(f)?0:f,E.addAtom(q,h,h,d,l,g,void 0,p),F[u]=X,X+=1}else if("CONECT"===c){var ot=F[parseInt(s.substr(6,5))],at=[11,16,21,26],st={};if(void 0===ot)continue;for(Z=0;Z<4;++Z){var ct=parseInt(s.substr(at[Z],5));if(!Number.isNaN(ct)&&(ct=F[ct],void 0!==ct))if(ot0)continue;var ot=nt[c].replace(Tv,"");if(C&&"CA"!==ot)continue;var at=parseFloat(nt[y]),st=parseFloat(nt[b]),ct=parseFloat(nt[x]);if(P){var ut=3*n;if(i[ut+0]=at,i[ut+1]=st,i[ut+2]=ct,n+=1,W>0)continue}var ht=nt[u],lt=parseInt(nt[s]),dt=nt[v];dt="?"===dt?"":dt;var ft=nt[a],pt=nt[h],mt="H"===nt[f][0]?1:0,gt=nt[m],vt=parseFloat(nt[_]),yt=parseFloat(nt[w]),bt=nt[d];if(bt="."===bt?"":bt,V.growIfFull(),V.atomTypeId[H]=$.add(ot,gt),V.x[H]=at,V.y[H]=st,V.z[H]=ct,V.serial[H]=parseInt(nt[p]),V.bfactor[H]=isNaN(vt)?0:vt,V.occupancy[H]=isNaN(yt)?0:yt,V.altloc[H]=bt.charCodeAt(0),A.addAtom(W,ft,pt,ht,lt,mt,void 0,dt),t.Debug){var xt=I[pt];void 0!==xt&&xt!==ft&&Hg.warn(xt,ft)}I[pt]=ft;var _t=nt[l];L[_t]||(L[_t]=new Set),L[_t].add(S.chainStore.count-1),H+=1}else{nt=o.match(Cv),it=nt.length,F===k.length&&(F=0);for(var wt=0;wt0&&(h=!0))),w>=m&&w0)continue;var C=parseFloat(P.substr(0,10)),T=parseFloat(P.substr(10,10)),E=parseFloat(P.substr(20,10));if(o){var I=3*c;if(s[I+0]=C,s[I+1]=T,s[I+2]=E,c+=1,h)continue}var L=P.substr(31,3).trim(),R=L+(_+1);d.growIfFull(),d.atomTypeId[_]=l.add(R,L),d.x[_]=C,d.y[_]=T,d.z[_]=E,d.serial[_]=_,n.addAtom(S,"","","HET",1,1),_+=1}if(w>=v&&w0)continue;if(o&&S>0)continue;b.index=parseInt(P.substr(0,3))-1+A,x.index=parseInt(P.substr(3,3))-1+A;var O=parseInt(P.substr(6,3));i.bondStore.addBond(b,x,O)}++w}}t.Debug&&Hg.time("SdfParser._parse "+this.name);var i=this.structure,n=this.structureBuilder,r=this.firstModelOnly,o=this.asTrajectory,a=this.streamer.peekLines(2);i.id=a[0].trim(),i.title=a[1].trim();var s,c,u=i.frames,h=!1,l=i.atomMap,d=i.atomStore;d.resize(Math.round(this.streamer.data.length/50));var f,p,m,g,v,y,b=i.getAtomProxy(),x=i.getAtomProxy(),_=0,w=0,S=0,A=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),n.finalize(),i.finalizeAtoms(),i.finalizeBonds(),No(i),t.Debug&&Hg.timeEnd("SdfParser._parse "+this.name)},_postProcess:function(){No(this.structure)}}),Kg.add("sdf",fc),pc.prototype=Object.assign(Object.create(Qs.prototype),{constructor:pc,type:"mol2",_parse:function(){function e(t,e,M){for(var P,C=t;CMOLECULE"===T?(y=b,p=0,++g):"@ATOM"===T?(y=x,m=d.count,c&&(n=0,i=new Float32Array(3*v),u.push(i),g>0&&(h=!0))):y="@BOND"===T?_:0;else if(y===b)0===p?(o.title=T,o.id=T):1===p&&(P=T.split(r),v=parseInt(P[0])),++p;else if(y===x){if(P=T.split(r),s&&g>0)continue;var E=parseFloat(P[2]),I=parseFloat(P[3]),L=parseFloat(P[4]);if(c){var R=3*n;if(i[R+0]=E,i[R+1]=I,i[R+2]=L,n+=1,h)continue}var O=P[0],D=P[1],N=P[5].split(".")[0],k=P[6]?parseInt(P[6]):1,F=P[7]?P[7]:"",z=P[8]?parseFloat(P[8]):0;d.growIfFull(),d.atomTypeId[f]=l.add(D,N),d.x[f]=E,d.y[f]=I,d.z[f]=L,d.serial[f]=O,d.bfactor[f]=z,a.addAtom(g,"","",F,k,1),f+=1}else if(y===_){if(s&&g>0)continue;if(c&&g>0)continue;P=T.split(r),w.index=parseInt(P[1])-1+m,S.index=parseInt(P[2])-1+m;var B=A[P[3]];o.bondStore.addBond(w,S,B)}}}t.Debug&&Hg.time("Mol2Parser._parse "+this.name);var i,n,r=/\s+/,o=this.structure,a=this.structureBuilder,s=this.firstModelOnly,c=this.asTrajectory,u=o.frames,h=!1,l=o.atomMap,d=o.atomStore;d.resize(Math.round(this.streamer.data.length/60));var f=0,p=0,m=0,g=-1,v=0,y=0,b=1,x=2,_=3,w=o.getAtomProxy(),S=o.getAtomProxy(),A={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),a.finalize(),o.finalizeAtoms(),To(o),Ro(o,!0),Oo(o,!0),o.finalizeBonds(),No(o),Co(o,bv(o)),t.Debug&&Hg.timeEnd("Mol2Parser._parse "+this.name)}}),Kg.add("mol2",pc);var Iv=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],Lv=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],Rv=Iv.concat(Lv),Ov={0:"i".charCodeAt(0),1:"s".charCodeAt(0),2:"h".charCodeAt(0),3:"e".charCodeAt(0),4:"g".charCodeAt(0),5:"b".charCodeAt(0),6:"t".charCodeAt(0),7:"l".charCodeAt(0),"-1":"".charCodeAt(0)};Fc.prototype=Object.assign(Object.create(Qs.prototype),{constructor:Fc,type:"mmtf",_parse:function(){t.Debug&&Hg.time("MmtfParser._parse "+this.name);var e,i,n,r,o,a=this.structure,s=kc(Dc(this.streamer.data)),c=["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"];c.forEach(function(t){void 0!==s[t]&&(a.header[t]=s[t])});var u,h,l,d,f,p;if(a.id=s.structureId,a.title=s.title,this.firstModelOnly||this.asTrajectory){for(f=1,d=s.chainsPerModel[0],l=0,e=0,i=d;e0&&(a.biomolDict[st]=ct)}s.unitCell&&Array.isArray(s.unitCell)&&s.unitCell[0]?a.unitcell=new Js(s.unitCell[0],s.unitCell[1],s.unitCell[2],s.unitCell[3],s.unitCell[4],s.unitCell[5],s.spaceGroup):a.unitcell=void 0,t.Debug&&Hg.timeEnd("MmtfParser._parse "+this.name),Oo(a,!0),Ro(a,!0),a.finalizeAtoms(),a.finalizeBonds(),Do(a)}}),Kg.add("mmtf",Fc),zc.prototype={constructor:zc},Bc.prototype=Object.assign(Object.create(Zs.prototype),{constructor:Bc,type:"trajectory",__objName:"frames"}),Uc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:Uc,type:"dcd",_parse:function(){t.Debug&&Hg.time("DcdParser._parse "+this.name);var e=this.streamer.data;e instanceof Uint8Array&&(e=e.buffer);var i,n,r=new DataView(e),o=this.frames,a=o.coordinates,s=o.boxes,c={},u=0,h=new Int32Array(e,0,23),l=h[0]!==r.getInt32(0);if(84!==h[0])for(n=e.byteLength,i=0;i0)return void Hg.error("dcd format with fixed atoms unsupported, aborting");var b=c.NATOM,x=4*b;for(i=0,n=c.NSET;i=o.atomCount+6){r=r.split(a);for(var s=0,l=r.length;sa){var r=i[n].trim();if(""!==r)for(var o=r.split(s),d=0,f=o.length;d=n.elements[s].count&&(s++,c=0);var l=this.parseASCIIElement(n.elements[s].properties,h);this.handleElement(i,n.elements[s].name,l),c++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e=0?i-1:i+e/3)},parseNormalIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=0?i-1:i+e/3)},addVertex:function(t,e,i){var n=this.vertices,r=this.object.geometry.vertices;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addVertexLine:function(t){var e=this.vertices,i=this.object.geometry.vertices;i.push(e[t+0]),i.push(e[t+1]),i.push(e[t+2])},addNormal:function(t,e,i){var n=this.normals,r=this.object.geometry.normals;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addFace:function(t,e,i,n,r,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),d=this.parseVertexIndex(i,u);if(void 0===n?this.addVertex(h,l,d):(c=this.parseVertexIndex(n,u),this.addVertex(h,l,c),this.addVertex(l,d,c)),void 0!==r){var f=this.normals.length;h=this.parseNormalIndex(r,f),l=r===o?h:this.parseNormalIndex(o,f),d=r===a?h:this.parseNormalIndex(a,f),void 0===n?this.addNormal(h,l,d):(c=this.parseNormalIndex(s,f),this.addNormal(h,l,c),this.addNormal(l,d,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,n=t.length;i0?_.addAttribute("normal",new $t(new Float32Array(x.normals),3)):_.computeVertexNormals(),y.push(_)}}return y}},Zc.prototype=Object.assign(Object.create(Wc.prototype),{constructor:Zc,type:"obj"}),Kg.add("obj",Zc),Kc.prototype=Object.assign(Object.create(Zs.prototype),{constructor:Kc,type:"text",__objName:"text",_parse:function(){this.text.data=this.streamer.asText()}}),Kg.add("txt",Kc),Kg.add("text",Kc),Qc.prototype=Object.assign(Object.create(Zs.prototype),{constructor:Qc,type:"csv",__objName:"table",_parse:function(){var t=this.table.data,e=/\s*,\s*/;this.streamer.eachChunkOfLines(function(i,n){for(var r=i.length,o=0;o");){var i=o();if(!i)return e;e.attributes[i.name]=i.value}return s(/\?>\s*/),e}}function n(){var t=s(/^<([\w-:.]+)\s*/);if(t){for(var e={name:t[1],attributes:{},children:[]};!(c()||u(">")||u("?>")||u("/>"));){var i=o();if(!i)return e;e.attributes[i.name]=i.value}if(s(/^\s*\/>\s*/))return e;s(/\??>\s*/),e.content=r();for(var a;a=n();)e.children.push(a);return s(/^<\/[\w-:.]+>\s*/),e}}function r(){var t=s(/^([^<]*)/);return t?t[1]:""}function o(){var t=s(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(t)return{name:t[1],value:a(t[2])}}function a(t){return t.replace(/^['"]|['"]$/g,"")}function s(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function c(){return 0===t.length}function u(e){return 0===t.indexOf(e)}return t=t.trim(),t=t.replace(//g,""),e()},__domParser:function(t){var e=new window.DOMParser;return e.parseFromString(t,"text/xml")},_parse:function(){t.Debug&&Hg.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.isBinary()||this.string?this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.streamer.data:this.xml.data=this.__xmlParser(this.streamer.asText()),t.Debug&&Hg.timeEnd("XmlParser._parse "+this.name)}}),Kg.add("xml",tu);var Dv,Nv,kv=au(),Fv=30,zv=12,Bv=15,Uv=852,jv=592,$v=0,Vv=1,Gv=2,Hv=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Wv=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Xv=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],qv=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],Yv=0,Zv=1,Kv=2,Qv=4,Jv=5,ty=6,ey=0,iy=1,ny=2,ry=-2,oy=-3,ay=-4,sy=-5,cy=8,uy=1,hy=2,ly=3,dy=4,fy=5,py=6,my=7,gy=8,vy=9,yy=10,by=11,xy=12,_y=13,wy=14,Sy=15,Ay=16,My=17,Py=18,Cy=19,Ty=20,Ey=21,Iy=22,Ly=23,Ry=24,Oy=25,Dy=26,Ny=27,ky=28,Fy=29,zy=30,By=31,Uy=32,jy=852,$y=592,Vy=!0,Gy=!0,Hy=!0;try{String.fromCharCode.apply(null,[0])}catch(t){Gy=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Hy=!1}for(var Wy=new Uint8Array(256),Xy=0;Xy<256;Xy++)Wy[Xy]=Xy>=252?6:Xy>=248?5:Xy>=240?4:Xy>=224?3:Xy>=192?2:1;Wy[254]=Wy[254]=1;var qy=0,Yy=2,Zy=4,Ky=0,Qy=1,Jy=2,tb=-5,eb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ib=Object.prototype.toString;Eu.prototype.push=function(t,e){var i,n,r,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;n=e===~~e?e:e===!0?Zy:qy,"string"==typeof t?c.input=Au(t):"[object ArrayBuffer]"===ib.call(t)?c.input=new Uint8Array(t):c.input=t,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new Uint8Array(u),c.next_out=0,c.avail_out=u),i=yu(c,qy),i===Jy&&h&&(s="string"==typeof h?wu(h):"[object ArrayBuffer]"===ib.call(h)?new Uint8Array(h):h,i=_u(this.strm,s)),i===tb&&l===!0&&(i=Ky,l=!1),i!==Qy&&i!==Ky)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&i!==Qy&&(0!==c.avail_in||n!==Zy&&n!==Yy)||("string"===this.options.to?(r=Pu(c.output,c.next_out),o=c.next_out-r,a=Mu(c.output,r),c.next_out=o,c.avail_out=u-o,o&&nu(c.output,c.output,r,o,0),this.onData(a)):this.onData(iu(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&i!==Qy);return i===Qy&&(n=Zy),n===Zy?(i=bu(this.strm),this.onEnd(i),this.ended=!0,i===Ky):n!==Yy||(this.onEnd(Ky),c.avail_out=0,!0)},Eu.prototype.onData=function(t){this.chunks.push(t)},Eu.prototype.onEnd=function(t){t===Ky&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ru(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Jg.add("gz",Lu);var nb="//files.rcsb.org/download/",rb="//mmtf.rcsb.org/v1.0/",ob=rb+"full/",ab=rb+"reduced/";Yg.add("rcsb",new Ru);var sb="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",cb="/SDF?record_type=3d";Yg.add("pubchem",new Ou),Yg.add("ftp",new Du),Yg.add("http",new Du),Yg.add("https",new Du);var ub="0.9.0-dev.5";t.Version=ub,t.setDebug=Bn,t.DatasourceRegistry=Yg,t.StaticDatasource=Nu,t.ParserRegistry=Kg,t.autoLoad=Yn,t.RepresentationRegistry=Zg,t.ColorMakerRegistry=qg,t.ColorMaker=gn,t.Selection=dn,t.PdbWriter=Jn,t.Stage=as,t.Collection=Ga,t.ComponentCollection=Ha,t.RepresentationCollection=Wa,t.Assembly=Mo,t.TrajectoryPlayer=ss,t.superpose=ts,t.guessElement=xv,t.Queue=oa,t.Counter=tr,t.throttle=h,t.download=c,t.getQuery=e,t.getDataInfo=qn,t.getFileInfo=u,t.uniqueArray=l,t.BufferRepresentation=La,t.SphereBuffer=ba,t.EllipsoidBuffer=_a,t.CylinderBuffer=Ma,t.ConeBuffer=Ca,t.ArrowBuffer=Ta,t.Shape=Ea,t.Kdtree=wo,t.SpatialHash=uo,t.Signal=ln,t.Matrix3=wt,t.Matrix4=A,t.Vector3=P,t.Quaternion=M,t.Plane=St,t.Color=yt,Object.defineProperty(t,"__esModule",{value:!0})}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.NGL=t.NGL||{})}(this,function(t){"use strict";function e(){}function i(t,e){return function(){t.apply(e,arguments)}}function n(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function r(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void mh(function(){var i=1===t._state?e.onFulfilled:e.onRejected;if(null===i)return void(1===t._state?o:a)(e.promise,t._value);var n;try{n=i(t._value)}catch(t){return void a(e.promise,t)}o(e.promise,n)}))}function o(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof n)return t._state=3,t._value=e,void s(t);if("function"==typeof r)return void u(i(r,e),t)}t._state=1,t._value=e,s(t)}catch(e){a(t,e)}}function a(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&mh(function(){t._handled||gh(t._value)});for(var e=0,i=t._deferreds.length;e1?c.pop().toLowerCase():"",h=e.match(/^(.+):\/\/(.+)$/);h&&(n=h[1].toLowerCase(),e=h[2]);var l=e.substring(0,e.lastIndexOf("/")+1);if(r.includes(u)){i=u;var d=e.length-u.length-1;u=e.substr(0,d).split(".").pop().toLowerCase();var f=s.length-u.length-1;s=s.substr(0,f)}else i=!1;return{path:e,name:a,ext:u,base:s,dir:l,compressed:i,protocol:n,src:t}}function b(t,e,i){var n,r,o,a=null,s=0;i||(i={});var c=function(){s=i.leading===!1?0:Date.now(),a=null,o=t.apply(n,r),a||(n=r=null)};return function(){var u=Date.now();s||i.leading!==!1||(s=u);var h=e-(u-s);return n=this,r=arguments,h<=0||h>e?(a&&(clearTimeout(a),a=null),s=u,o=t.apply(n,r),a||(n=r=null)):a||i.trailing===!1||(a=setTimeout(c,h)),o}}function x(t){return t.sort().filter(function(t,e,i){return 0===e||t!==i[e-1]})}function w(t){var e=28672;if(t.length>e){for(var i=[],n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function D(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function N(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function k(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,o),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,e,l.STATIC_DRAW),s=n(),c={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},u={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var r=i.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),h=new L(i),h.needsUpdate=!0}function n(){var e=l.createProgram(),i=l.createShader(l.VERTEX_SHADER),n=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(i),l.compileShader(n),l.attachShader(e,i),l.attachShader(e,n),l.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,a,s,c,u,h,l=t.context,d=t.state,f=new N,p=new D,m=new N;this.render=function(n,g){if(0!==e.length){void 0===s&&i(),l.useProgram(s),d.initAttributes(),d.enableAttribute(c.position),d.enableAttribute(c.uv),d.disableUnusedAttributes(),d.disable(l.CULL_FACE),d.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,o),l.vertexAttribPointer(c.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(c.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(u.projectionMatrix,!1,g.projectionMatrix.elements),d.activeTexture(l.TEXTURE0),l.uniform1i(u.map,0);var v=0,y=0,b=n.fog;b?(l.uniform3f(u.fogColor,b.color.r,b.color.g,b.color.b),b&&b.isFog?(l.uniform1f(u.fogNear,b.near),l.uniform1f(u.fogFar,b.far),l.uniform1i(u.fogType,1),v=1,y=1):b&&b.isFogExp2&&(l.uniform1f(u.fogDensity,b.density),l.uniform1i(u.fogType,2),v=2,y=2)):(l.uniform1i(u.fogType,0),v=0,y=0);for(var x=0,w=e.length;x.001&&E.scale>.001&&(w.x=E.x,w.y=E.y,w.z=E.z,b=E.size*E.scale/p.w,x.x=b*g,x.y=b,d.uniform3f(u.screenPosition,w.x,w.y,w.z),d.uniform2f(u.scale,x.x,x.y),d.uniform1f(u.rotation,E.rotation),d.uniform1f(u.opacity,E.opacity),d.uniform3f(u.color,E.color.r,E.color.g,E.color.b),f.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),t.setTexture2D(E.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}f.enable(d.CULL_FACE),f.enable(d.DEPTH_TEST),f.setDepthWrite(!0),t.resetGLState()}}}function B(t,e,i,n,r,o,a,s,c,u){t=void 0!==t?t:[],e=void 0!==e?e:yl,L.call(this,t,e,i,n,r,o,a,s,c,u),this.flipY=!1}function U(){this.seq=[],this.map={}}function j(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,o=Od[r];if(void 0===o&&(o=new Float32Array(r),Od[r]=o),0!==e){n.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=i,t[a].toArray(o,s)}return o}function $(t,e){var i=Dd[e];void 0===i&&(i=new Int32Array(e),Dd[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function V(t,e){t.uniform1f(this.addr,e)}function G(t,e){t.uniform1i(this.addr,e)}function H(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function W(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function X(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function q(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function Y(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function Z(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function K(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||Ld,n)}function Q(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||Rd,n)}function J(t,e){t.uniform2iv(this.addr,e)}function tt(t,e){t.uniform3iv(this.addr,e)}function et(t,e){t.uniform4iv(this.addr,e)}function it(t){switch(t){case 5126:return V;case 35664:return H;case 35665:return W;case 35666:return X;case 35674:return q;case 35675:return Y;case 35676:return Z;case 35678:return K;case 35680:return Q;case 5124:case 35670:return G;case 35667:case 35671:return J;case 35668:case 35672:return tt;case 35669:case 35673:return et}}function nt(t,e){t.uniform1fv(this.addr,e)}function rt(t,e){t.uniform1iv(this.addr,e)}function ot(t,e){t.uniform2fv(this.addr,j(e,this.size,2))}function at(t,e){t.uniform3fv(this.addr,j(e,this.size,3))}function st(t,e){t.uniform4fv(this.addr,j(e,this.size,4))}function ct(t,e){t.uniformMatrix2fv(this.addr,!1,j(e,this.size,4))}function ut(t,e){t.uniformMatrix3fv(this.addr,!1,j(e,this.size,9))}function ht(t,e){t.uniformMatrix4fv(this.addr,!1,j(e,this.size,16))}function lt(t,e,i){var n=e.length,r=$(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTexture2D(e[o]||Ld,r[o])}function dt(t,e,i){var n=e.length,r=$(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTextureCube(e[o]||Rd,r[o])}function ft(t){switch(t){case 5126:return nt;case 35664:return ot;case 35665:return at;case 35666:return st;case 35674:return ct;case 35675:return ut;case 35676:return ht;case 35678:return lt;case 35680:return dt;case 5124:case 35670:return rt;case 35667:case 35671:return J;case 35668:case 35672:return tt;case 35669:case 35673:return et}}function pt(t,e,i){this.id=t,this.addr=i,this.setValue=it(e.type)}function mt(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=ft(e.type)}function gt(t){this.id=t,U.call(this)}function vt(t,e){t.seq.push(e),t.map[e.id]=e}function yt(t,e,i){var n=t.name,r=n.length;for(Nd.lastIndex=0;;){var o=Nd.exec(n),a=Nd.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s|=0),void 0===u||"["===u&&a+2===r){vt(i,void 0===u?new pt(s,t,e):new mt(s,t,e));break}var h=i.map,l=h[s];void 0===l&&(l=new gt(s),vt(i,l)),i=l}}function bt(t,e,i){U.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==n;++r){var o=t.getActiveUniform(e,r),a=o.name,s=t.getUniformLocation(e,a);yt(o,s,this)}}function xt(t,e,i,n,r,o,a){function s(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);var r=n.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return Ed.isPowerOfTwo(t.width)&&Ed.isPowerOfTwo(t.height)}function u(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=Ed.nearestPowerOfTwo(t.width),e.height=Ed.nearestPowerOfTwo(t.height);var i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function h(t){return t.wrapS!==Pl||t.wrapT!==Pl||t.minFilter!==Tl&&t.minFilter!==Ll}function l(e){return e===Tl||e===El||e===Il?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),p(e),C.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),m(e),C.textures--}function p(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n.delete(e)}function m(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.delete(e.texture),n.delete(e)}}function g(e,r){var o=n.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(a.complete!==!1)return void x(o,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,a){var u=n.get(e);if(6===e.image.length)if(e.version>0&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",d),u.__image__webglTextureCube=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,l=e.image[0]&&e.image[0].isDataTexture,f=[],p=0;p<6;p++)h||l?f[p]=l?e.image[p].image:e.image[p]:f[p]=s(e.image[p],r.maxCubemapSize);var m=f[0],g=c(m),v=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,g);for(var p=0;p<6;p++)if(h)for(var x,w=f[p].mipmaps,_=0,S=w.length;_-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,_,v,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,_,v,x.width,x.height,0,v,y,x.data);else l?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)}function y(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function b(i,a,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===Pl&&a.wrapT===Pl||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(i,t.TEXTURE_MAG_FILTER,l(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,l(a.minFilter)),a.minFilter!==Tl&&a.minFilter!==Ll&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Ul&&null===e.get("OES_texture_float_linear"))return;if(a.type===jl&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,n,a){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var l=s(n.image,r.maxTextureSize);h(n)&&c(l)===!1&&(l=u(l));var f=c(l),p=o(n.format),m=o(n.type);b(t.TEXTURE_2D,n,f);var g,v=n.mipmaps;if(n&&n.isDepthTexture){var y=t.DEPTH_COMPONENT;if(n.type===Ul){if(!T)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else T&&(y=t.DEPTH_COMPONENT16);n.format===Ql&&(y=t.DEPTH_STENCIL),i.texImage2D(t.TEXTURE_2D,0,y,l.width,l.height,0,p,m,null)}else if(n&&n.isDataTexture)if(v.length>0&&f){for(var x=0,w=v.length;x-1?i.compressedTexImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&f){for(var x=0,w=v.length;x0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function Rt(t,e){this.normal=void 0!==t?t:new N(1,0,0),this.constant=void 0!==e?e:0}function Ot(t,e,i,n,r,o){this.planes=[void 0!==t?t:new Rt,void 0!==e?e:new Rt,void 0!==i?i:new Rt,void 0!==n?n:new Rt,void 0!==r?r:new Rt,void 0!==o?o:new Rt]}function Dt(t,e,i,n){function r(e,i,n,r){var o=e.geometry,a=null,s=b,c=e.customDepthMaterial;if(n&&(s=x,c=e.customDistanceMaterial),c)a=c;else{var u=!1;i.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var h=e.isSkinnedMesh&&i.skinning,l=0;u&&(l|=g),h&&(l|=v),a=s[l]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var d=a.uuid,f=i.uuid,p=w[d];void 0===p&&(p={},w[d]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=i.visible,a.wireframe=i.wireframe;var y=i.side;return k.renderSingleSided&&y==Ch&&(y=Mh),k.renderReverseSided&&(y===Mh?y=Ph:y===Ph&&(y=Mh)),a.side=y,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,n&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function o(t,e,i){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||c.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),m.push(t))}for(var a=t.children,s=0,u=a.length;s");return Xt(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function qt(t){function e(t,e,i,n){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,g=$t(o,n,t.extensions),v=Vt(a),y=r.createProgram();i.isRawShaderMaterial?(f=[v,"\n"].filter(Ht).join("\n"),p=[g,v,"\n"].filter(Ht).join("\n")):(f=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Ht).join("\n"),p=[g,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+l:"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==dl?"#define TONE_MAPPING":"",n.toneMapping!==dl?kp.tonemapping_pars_fragment:"",n.toneMapping!==dl?jt("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?kp.encodings_pars_fragment:"",n.mapEncoding?Bt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Bt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Bt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Ut("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ht).join("\n")),s=Xt(s,n),s=Wt(s,n),c=Xt(c,n),c=Wt(c,n),i.isShaderMaterial||(s=qt(s),c=qt(c));var b=f+s,x=p+c,w=kt(r,r.VERTEX_SHADER,b),_=kt(r,r.FRAGMENT_SHADER,x);r.attachShader(y,w),r.attachShader(y,_),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var S=r.getProgramInfoLog(y),A=r.getShaderInfoLog(w),M=r.getShaderInfoLog(_),P=!0,C=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(P=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",S,A,M)):""!==S?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",S):""!==A&&""!==M||(C=!1),C&&(this.diagnostics={runnable:P,material:i,programLog:S,vertexShader:{log:A,prefix:f},fragmentShader:{log:M,prefix:p}}),r.deleteShader(w),r.deleteShader(_);var T;this.getUniforms=function(){return void 0===T&&(T=new bt(r,y,t)),T};var E;return this.getAttributes=function(){return void 0===E&&(E=Gt(r,y)),E},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Up++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=_,this}function Zt(t,e){function i(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===Ch,flipSided:r.side===Ph,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return p},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r65535?Uint32Array:Uint16Array,y=new Kt(new v(o),1);return r(y,t.ELEMENT_ARRAY_BUFFER),n.wireframe=y,y}function u(t,e,i){if(e>i){var n=e;e=i,i=n}var r=t[e];return void 0===r?(t[e]=[i],!0):r.indexOf(i)===-1&&(r.push(i),!0)}var h=new he(t,e,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function de(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new N,color:new Ct,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"SpotLight":i={position:new N,direction:new N,color:new Ct,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"PointLight":i={position:new N,color:new Ct,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"HemisphereLight":i={direction:new N,skyColor:new Ct,groundColor:new Ct}}return t[e.id]=i,i}}}function fe(t,e,i){function n(){if(void 0!==o)return o;var i=e.get("EXT_texture_filter_anisotropic");return o=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=i.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,y=!!e.get("OES_texture_float"),b=v&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b}}function pe(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function me(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,u=4):(c=t.UNSIGNED_SHORT,u=2)}function o(e,n){t.drawElements(s,n,c,e*u),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function a(n,r,o){var a=e.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,c,r*u,n.maxInstancedCount),i.calls++,i.vertices+=o*n.maxInstancedCount,void(s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*o/3)))}var s,c,u;return{setMode:n,setIndex:r,render:o,renderInstances:a}}function ge(){function t(){u.value!==n&&(u.value=n,u.needsUpdate=r>0),i.numPlanes=r}function e(t,e,n,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=u.value,r!==!0||null===a){var h=n+4*o,l=e.matrixWorldInverse;c.getNormalMatrix(l),(null===a||a.length0?1:-1,p[g]=I.x,p[g+1]=I.y,p[g+2]=I.z,m[v]=O/c,m[v+1]=1-L/h,g+=3,v+=2,T+=1}for(L=0;L65535?Uint32Array:Uint16Array)(l),f=new Float32Array(3*h),p=new Float32Array(3*h),m=new Float32Array(2*h),g=0,v=0,y=0,b=0,x=0;c("z","y","x",-1,-1,i,e,t,o,r,0),c("z","y","x",1,-1,i,e,-t,o,r,1),c("x","z","y",1,1,t,i,e,n,o,2),c("x","z","y",1,-1,t,i,-e,n,o,3),c("x","y","z",1,-1,t,e,i,n,r,4),c("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new Kt(d,1)),this.addAttribute("position",new Kt(f,3)),this.addAttribute("normal",new Kt(p,3)),this.addAttribute("uv",new Kt(m,2))}function xe(t,e){this.origin=void 0!==t?t:new N,this.direction=void 0!==e?e:new N}function we(t,e){this.start=void 0!==t?t:new N,this.end=void 0!==e?e:new N}function _e(t,e,i){this.a=void 0!==t?t:new N,this.b=void 0!==e?e:new N,this.c=void 0!==i?i:new N}function Se(t){At.call(this),this.type="MeshBasicMaterial",this.color=new Ct(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Ae(t,e){re.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new ue,this.material=void 0!==e?e:new Se({color:16777215*Math.random()}),this.drawMode=vd,this.updateMorphTargets()}function Me(t,e,i,n){ue.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,o=e/2,a=Math.floor(i)||1,s=Math.floor(n)||1,c=a+1,u=s+1,h=t/a,l=e/s,d=new Float32Array(c*u*3),f=new Float32Array(c*u*3),p=new Float32Array(c*u*2),m=0,g=0,v=0;v65535?Uint32Array:Uint16Array)(a*s*6),v=0;v=0){var h=o[c];if(void 0!==h){var l=Ut.FLOAT,d=h.array,f=h.normalized;d instanceof Float32Array?l=Ut.FLOAT:d instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):d instanceof Uint16Array?l=Ut.UNSIGNED_SHORT:d instanceof Int16Array?l=Ut.SHORT:d instanceof Uint32Array?l=Ut.UNSIGNED_INT:d instanceof Int32Array?l=Ut.INT:d instanceof Int8Array?l=Ut.BYTE:d instanceof Uint8Array&&(l=Ut.UNSIGNED_BYTE);var p=h.itemSize,m=Xt.getAttributeBuffer(h);if(h&&h.isInterleavedBufferAttribute){var g=h.data,v=g.stride,y=h.offset;g&&g.isInstancedInterleavedBuffer?(Gt.enableAttributeAndDivisor(u,g.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=g.meshPerAttribute*g.count)):Gt.enableAttribute(u),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(u,p,l,f,v*g.array.BYTES_PER_ELEMENT,(n*v+y)*g.array.BYTES_PER_ELEMENT)}else h&&h.isInstancedBufferAttribute?(Gt.enableAttributeAndDivisor(u,h.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):Gt.enableAttribute(u),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(u,p,l,f,0,n*p*h.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:Ut.vertexAttrib2fv(u,b);break;case 3:Ut.vertexAttrib3fv(u,b);break;case 4:Ut.vertexAttrib4fv(u,b);break;default:Ut.vertexAttrib1fv(u,b)}}}}Gt.disableUnusedAttributes()}function h(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function f(t,e,i,n,r){var o,a;i.transparent?(o=K,a=++Q):(o=Y,a=++Z);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=kt.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:kt.z,group:r},o.push(s))}function p(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Rt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),g(Rt)}function m(t){return Rt.center.set(0,0,0),Rt.radius=.7071067811865476,Rt.applyMatrix4(t.matrixWorld),g(Rt)}function g(t){if(!Mt.intersectsSphere(t))return!1;var e=Tt.numPlanes;if(0===e)return!0;var i=it.clippingPlanes,n=t.center,r=-t.radius,o=0;do if(i[o].distanceToPoint(n)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d=0&&t.numSupportedMorphNormals++}var f=n.__webglShader.uniforms;!t.isShaderMaterial&&!t.isRawShaderMaterial|t.clipping===!0&&(n.numClippingPlanes=Tt.numPlanes,f.clippingPlanes=Tt.uniform),n.fog=e,n.lightsHash=zt.hash,t.lights&&(f.ambientLightColor.value=zt.ambient,f.directionalLights.value=zt.directional,f.spotLights.value=zt.spot,f.pointLights.value=zt.point,f.hemisphereLights.value=zt.hemi,f.directionalShadowMap.value=zt.directionalShadowMap,f.directionalShadowMatrix.value=zt.directionalShadowMatrix,f.spotShadowMap.value=zt.spotShadowMap,f.spotShadowMatrix.value=zt.spotShadowMatrix,f.pointShadowMap.value=zt.pointShadowMap,f.pointShadowMatrix.value=zt.pointShadowMatrix);var p=n.program.getUniforms(),m=bt.seqWithValue(p.seq,f);n.uniformsList=m,n.dynamicUniforms=bt.splitDynamic(m,f)}function x(t){t.side===Ch?Gt.disable(Ut.CULL_FACE):Gt.enable(Ut.CULL_FACE),Gt.setFlipSided(t.side===Ph),t.transparent===!0?Gt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Gt.setBlending(Oh),Gt.setDepthFunc(t.depthFunc),Gt.setDepthTest(t.depthTest),Gt.setDepthWrite(t.depthWrite),Gt.setColorWrite(t.colorWrite),Gt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function w(t,e,i,n){dt=0;var r=Ht.get(i);if(Et&&(Lt||t!==ct)){var o=t===ct&&i.id===at;Tt.setState(i.clippingPlanes,i.clipShadows,t,r,o)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==zt.hash?i.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==Tt.numPlanes&&(i.needsUpdate=!0)),i.needsUpdate&&(b(i,e,n),i.needsUpdate=!1);var a=!1,s=!1,c=!1,u=r.program,h=u.getUniforms(),l=r.__webglShader.uniforms;if(u.id!==nt&&(Ut.useProgram(u.program),nt=u.id,a=!0,s=!0,c=!0),i.id!==at&&(at=i.id,s=!0),a||t!==ct){if(h.set(Ut,t,"projectionMatrix"),Vt.logarithmicDepthBuffer&&h.setValue(Ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var d=h.map.cameraPosition;void 0!==d&&d.setValue(Ut,kt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&h.setValue(Ut,"viewMatrix",t.matrixWorldInverse),h.set(Ut,it,"toneMappingExposure"),h.set(Ut,it,"toneMappingWhitePoint")}if(i.skinning){h.setOptional(Ut,n,"bindMatrix"),h.setOptional(Ut,n,"bindMatrixInverse");var f=n.skeleton;f&&(Vt.floatVertexTextures&&f.useVertexTexture?(h.set(Ut,f,"boneTexture"),h.set(Ut,f,"boneTextureWidth"),h.set(Ut,f,"boneTextureHeight")):h.setOptional(Ut,f,"boneMatrices"))}s&&(i.lights&&L(l,c),e&&i.fog&&P(l,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&_(l,i),i.isLineBasicMaterial?S(l,i):i.isLineDashedMaterial?(S(l,i),A(l,i)):i.isPointsMaterial?M(l,i):i.isMeshLambertMaterial?C(l,i):i.isMeshPhongMaterial?T(l,i):i.isMeshPhysicalMaterial?I(l,i):i.isMeshStandardMaterial?E(l,i):i.isMeshDepthMaterial?i.displacementMap&&(l.displacementMap.value=i.displacementMap,l.displacementScale.value=i.displacementScale,l.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(l.opacity.value=i.opacity),bt.upload(Ut,r.uniformsList,l,it)),h.set(Ut,n,"modelViewMatrix"),h.set(Ut,n,"normalMatrix"),h.setValue(Ut,"modelMatrix",n.matrixWorld);var p=r.dynamicUniforms;return null!==p&&(bt.evalDynamic(p,l,n,t),bt.upload(Ut,p,l,it)),u}function _(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function A(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*vt,t.scale.value=.5*U.clientHeight,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function P(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function C(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function T(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function E(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,E(t,e)}function L(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function R(t){for(var e=0,i=0,n=t.length;i=Vt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Vt.maxTextures),dt+=1,t}function B(t){var e;if(t===Ml)return Ut.REPEAT;if(t===Pl)return Ut.CLAMP_TO_EDGE;if(t===Cl)return Ut.MIRRORED_REPEAT;if(t===Tl)return Ut.NEAREST;if(t===El)return Ut.NEAREST_MIPMAP_NEAREST;if(t===Il)return Ut.NEAREST_MIPMAP_LINEAR;if(t===Ll)return Ut.LINEAR;if(t===Rl)return Ut.LINEAR_MIPMAP_NEAREST;if(t===Ol)return Ut.LINEAR_MIPMAP_LINEAR;if(t===Dl)return Ut.UNSIGNED_BYTE;if(t===$l)return Ut.UNSIGNED_SHORT_4_4_4_4;if(t===Vl)return Ut.UNSIGNED_SHORT_5_5_5_1;if(t===Gl)return Ut.UNSIGNED_SHORT_5_6_5;if(t===Nl)return Ut.BYTE;if(t===kl)return Ut.SHORT;if(t===Fl)return Ut.UNSIGNED_SHORT;if(t===zl)return Ut.INT;if(t===Bl)return Ut.UNSIGNED_INT;if(t===Ul)return Ut.FLOAT;if(e=$t.get("OES_texture_half_float"),null!==e&&t===jl)return e.HALF_FLOAT_OES;if(t===Wl)return Ut.ALPHA;if(t===Xl)return Ut.RGB;if(t===ql)return Ut.RGBA;if(t===Yl)return Ut.LUMINANCE;if(t===Zl)return Ut.LUMINANCE_ALPHA;if(t===Kl)return Ut.DEPTH_COMPONENT;if(t===Ql)return Ut.DEPTH_STENCIL;if(t===Bh)return Ut.FUNC_ADD;if(t===Uh)return Ut.FUNC_SUBTRACT;if(t===jh)return Ut.FUNC_REVERSE_SUBTRACT;if(t===Gh)return Ut.ZERO;if(t===Hh)return Ut.ONE;if(t===Wh)return Ut.SRC_COLOR;if(t===Xh)return Ut.ONE_MINUS_SRC_COLOR;if(t===qh)return Ut.SRC_ALPHA;if(t===Yh)return Ut.ONE_MINUS_SRC_ALPHA;if(t===Zh)return Ut.DST_ALPHA;if(t===Kh)return Ut.ONE_MINUS_DST_ALPHA;if(t===Qh)return Ut.DST_COLOR;if(t===Jh)return Ut.ONE_MINUS_DST_COLOR;if(t===tl)return Ut.SRC_ALPHA_SATURATE;if(e=$t.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===Jl)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===td)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===ed)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===id)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=$t.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===nd)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===rd)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===od)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ad)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=$t.get("WEBGL_compressed_texture_etc1"),null!==e&&t===sd)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=$t.get("EXT_blend_minmax"),null!==e){if(t===$h)return e.MIN_EXT;if(t===Vh)return e.MAX_EXT}return e=$t.get("WEBGL_depth_texture"),null!==e&&t===Hl?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",yh),t=t||{};var U=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==t.context?t.context:null,$=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,H=void 0!==t.antialias&&t.antialias,W=void 0===t.premultipliedAlpha||t.premultipliedAlpha,X=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,q=[],Y=[],Z=-1,K=[],Q=-1,J=new Float32Array(8),tt=[],et=[];this.domElement=U,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=fl,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var it=this,nt=null,rt=null,ot=null,at=-1,st="",ct=null,ut=new wt,ht=null,lt=new wt,dt=0,ft=new Ct(0),pt=0,mt=U.width,gt=U.height,vt=1,yt=new wt(0,0,mt,gt),St=!1,At=new wt(0,0,mt,gt),Mt=new Ot,Tt=new ge,Et=!1,Lt=!1,Rt=new It,Nt=new O,kt=new N,zt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Bt={calls:0,vertices:0,faces:0,points:0};this.info={render:Bt,memory:{geometries:0,textures:0},programs:null};var Ut;try{var jt={alpha:$,depth:V,stencil:G,antialias:H,premultipliedAlpha:W,preserveDrawingBuffer:X};if(Ut=j||U.getContext("webgl",jt)||U.getContext("experimental-webgl",jt),null===Ut)throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Ut.getShaderPrecisionFormat&&(Ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",o,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var $t=new pe(Ut);$t.get("WEBGL_depth_texture"),$t.get("OES_texture_float"),$t.get("OES_texture_float_linear"),$t.get("OES_texture_half_float"),$t.get("OES_texture_half_float_linear"),$t.get("OES_standard_derivatives"),$t.get("ANGLE_instanced_arrays"),$t.get("OES_element_index_uint")&&(ue.MaxIndex=4294967296);var Vt=new fe(Ut,$t,t),Gt=new _t(Ut,$t,B),Ht=new Ft,Wt=new xt(Ut,$t,Gt,Ht,Vt,B,this.info),Xt=new le(Ut,Ht,this.info),qt=new Zt(this,Vt),Yt=new de;this.info.programs=qt.programs;var Kt=new ve(Ut,$t,Bt),Qt=new me(Ut,$t,Bt),Jt=new Te(-1,1,1,-1,0,1),te=new Ce,ee=new Ae(new Me(2,2),new Se({depthTest:!1,depthWrite:!1,fog:!1})),ie=Bp.cube,ne=new Ae(new be(5,5,5),new Pt({uniforms:ie.uniforms,vertexShader:ie.vertexShader,fragmentShader:ie.fragmentShader,side:Ph,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=Ut,this.capabilities=Vt,this.extensions=$t,this.properties=Ht,this.state=Gt;var re=new Dt(this,zt,Xt,Vt);this.shadowMap=re;var oe=new k(this,tt),ae=new z(this,et);this.getContext=function(){return Ut},this.getContextAttributes=function(){return Ut.getContextAttributes()},this.forceContextLoss=function(){$t.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Vt.getMaxAnisotropy()},this.getPrecision=function(){return Vt.precision},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(t){void 0!==t&&(vt=t,this.setSize(At.z,At.w,!1))},this.getSize=function(){return{width:mt,height:gt}},this.setSize=function(t,e,i){mt=t,gt=e,U.width=t*vt,U.height=e*vt,i!==!1&&(U.style.width=t+"px",U.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Gt.viewport(At.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Gt.scissor(yt.set(t,e,i,n))},this.setScissorTest=function(t){Gt.setScissorTest(St=t)},this.getClearColor=function(){return ft},this.setClearColor=function(t,e){ft.set(t),pt=void 0!==e?e:1,i(ft.r,ft.g,ft.b,pt)},this.getClearAlpha=function(){return pt},this.setClearAlpha=function(t){pt=t,i(ft.r,ft.g,ft.b,pt)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=Ut.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Ut.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Ut.STENCIL_BUFFER_BIT),Ut.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=r,this.dispose=function(){K=[],Q=-1,Y=[],Z=-1,U.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,i){Gt.initAttributes();var n=Ht.get(t);t.hasPositions&&!n.position&&(n.position=Ut.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Ut.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Ut.createBuffer()),t.hasColors&&!n.color&&(n.color=Ut.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.position),Ut.bufferData(Ut.ARRAY_BUFFER,t.positionArray,Ut.DYNAMIC_DRAW),Gt.enableAttribute(r.position),Ut.vertexAttribPointer(r.position,3,Ut.FLOAT,!1,0,0)),t.hasNormals){if(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===Th)for(var o=0,a=3*t.count;o8&&(f.length=8);for(var v=n.morphAttributes,p=0,m=f.length;p0&&_.renderInstances(n,E,L):_.render(E,L)},this.render=function(t,e,n,r){if((e&&e.isCamera)===!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;st="",at=-1,ct=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Mt.setFromMatrix(Nt),q.length=0,Z=-1,Q=-1,tt.length=0,et.length=0,Lt=this.localClippingEnabled,Et=Tt.init(this.clippingPlanes,Lt,e),v(t,e),Y.length=Z+1,K.length=Q+1,it.sortObjects===!0&&(Y.sort(l),K.sort(d)),Et&&Tt.beginShadows(),R(q),re.render(t,e),D(q,e),Et&&Tt.endShadows(),Bt.calls=0,Bt.vertices=0,Bt.faces=0,Bt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var a=t.background;if(null===a?i(ft.r,ft.g,ft.b,pt):a&&a.isColor&&(i(a.r,a.g,a.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),a&&a.isCubeTexture?(te.projectionMatrix.copy(e.projectionMatrix),te.matrixWorld.extractRotation(e.matrixWorld),te.matrixWorldInverse.getInverse(te.matrixWorld),ne.material.uniforms.tCube.value=a,ne.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,ne.matrixWorld),Xt.update(ne),it.renderBufferDirect(te,null,ne.geometry,ne.material,ne,null)):a&&a.isTexture&&(ee.material.map=a,Xt.update(ee),it.renderBufferDirect(Jt,null,ee.geometry,ee.material,ee,null)),t.overrideMaterial){var s=t.overrideMaterial;y(Y,e,o,s),y(K,e,o,s)}else Gt.setBlending(Oh),y(Y,e,o),y(K,e,o);oe.render(t,e),ae.render(t,e,lt),n&&Wt.updateRenderTargetMipmap(n),Gt.setDepthTest(!0),Gt.setDepthWrite(!0),Gt.setColorWrite(!0)},this.setFaceCulling=function(t,e){Gt.setCullFace(t),Gt.setFlipSided(e===_h)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Wt.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Wt.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Wt.setTextureCube(e,i):Wt.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){return rt},this.setRenderTarget=function(t){rt=t,t&&void 0===Ht.get(t).__webglFramebuffer&&Wt.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=Ht.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ut.copy(t.scissor),ht=t.scissorTest,lt.copy(t.viewport)}else e=null,ut.copy(yt).multiplyScalar(vt),ht=St,lt.copy(At).multiplyScalar(vt);if(ot!==e&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,e),ot=e),Gt.scissor(ut),Gt.setScissorTest(ht),Gt.viewport(lt),i){var r=Ht.get(t.texture);Ut.framebufferTexture2D(Ut.FRAMEBUFFER,Ut.COLOR_ATTACHMENT0,Ut.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=Ht.get(t).__webglFramebuffer;if(a){var s=!1;a!==ot&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==ql&&B(u)!==Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Dl||B(h)===Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_TYPE)||h===Ul&&($t.get("OES_texture_float")||$t.get("WEBGL_color_buffer_float"))||h===jl&&$t.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ut.checkFramebufferStatus(Ut.FRAMEBUFFER)===Ut.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Ut.readPixels(e,i,n,r,B(u),B(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Ut.bindFramebuffer(Ut.FRAMEBUFFER,ot)}}}}function Ie(t,e){this.name="",this.color=new Ct(t),this.density=void 0!==e?e:25e-5}function Le(t,e,i){this.name="",this.color=new Ct(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Re(){re.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Oe(t,e,i,n,r){re.call(this),this.lensFlares=[],this.positionScreen=new N,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function De(t){At.call(this),this.type="SpriteMaterial",this.color=new Ct(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ne(t){re.call(this),this.type="Sprite",this.material=void 0!==t?t:new De}function ke(){re.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Fe(t,e,i,n,r,o,a,s,c,u,h,l){L.call(this,null,o,a,s,c,u,n,r,h,l),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:Tl,this.minFilter=void 0!==u?u:Tl,this.flipY=!1,this.generateMipmaps=!1}function ze(t,e,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new O,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=Ed.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Fe(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,ql,Ul)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r0)&&S.push(A,M,C),(m!==i-1||s65535?Jt:Qt)(S,1)),this.addAttribute("position",u),this.addAttribute("normal",h),this.addAttribute("uv",l),this.boundingSphere=new It(new N,t)}function hn(t,e,i,n,r,o,a){ae.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new un(t,e,i,n,r,o,a))}function ln(t,e){re.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new Ct,new Ct];var i=new hn(e,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;n0&&f++,e>0&&f++);var p=c(),m=u(),g=new Kt(new(m>65535?Uint32Array:Uint16Array)(m),1),v=new Kt(new Float32Array(3*p),3),y=new Kt(new Float32Array(3*p),3),b=new Kt(new Float32Array(2*p),2),x=0,w=0,_=[],S=i/2,A=0;h(),o===!1&&(t>0&&l(!0),e>0&&l(!1)),this.setIndex(g),this.addAttribute("position",v),this.addAttribute("normal",y),this.addAttribute("uv",b)}function bn(t,e,i,n,r,o){re.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===o&&(o=.2*r),this.position.copy(e),this.line=new $e(Kp,new je({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ae(Qp,new Se({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,o)}function xn(t,e,i,n){function r(t){var e=t.normalize().clone();e.index=h.vertices.push(e)-1;var i=s(t)/2/Math.PI+.5,n=c(t)/Math.PI+.5;return e.uv=new I(i,1-n),e}function o(t,e,i){var n=new ee(t.index,e.index,i.index,[t.clone(),e.clone(),i.clone()]);h.faces.push(n),b.copy(t).add(e).add(i).divideScalar(3);var r=s(b);h.faceVertexUvs[0].push([u(t.uv,t,r),u(e.uv,e,r),u(i.uv,i,r)])}function a(t,e){for(var i=Math.pow(2,e),n=r(h.vertices[t.a]),a=r(h.vertices[t.b]),s=r(h.vertices[t.c]),c=[],u=0;u<=i;u++){c[u]=[];for(var l=r(n.clone().lerp(s,u/i)),d=r(a.clone().lerp(s,u/i)),f=i-u,p=0;p<=f;p++)0===p&&u===i?c[u][p]=l:c[u][p]=r(l.clone().lerp(d,p/f))}for(var u=0;u.9&&M<.1&&(w<.2&&(x[0].x+=1),_<.2&&(x[1].x+=1),S<.2&&(x[2].x+=1))}for(var l=0,d=this.vertices.length;l65535?Uint32Array:Uint16Array)(h),1),d=new Kt(new Float32Array(3*u),3),f=new Kt(new Float32Array(3*u),3),p=new Kt(new Float32Array(2*u),2),m=0,g=0,v=new N,y=new N,b=new I,x=new N,w=new N,_=new N,S=new N,A=new N;for(s=0;s<=i;++s){var M=s/i*r*Math.PI*2;for(a(M,r,o,t,x),a(M+.01,r,o,t,w),S.subVectors(w,x),A.addVectors(w,x),_.crossVectors(S,A),A.crossVectors(_,S),_.normalize(),A.normalize(),c=0;c<=n;++c){var P=c/n*Math.PI*2,C=-e*Math.cos(P),T=e*Math.sin(P);v.x=x.x+(C*A.x+T*_.x),v.y=x.y+(C*A.y+T*_.y),v.z=x.z+(C*A.z+T*_.z),d.setXYZ(m,v.x,v.y,v.z),y.subVectors(v,x).normalize(),f.setXYZ(m,y.x,y.y,y.z), +b.x=s/i,b.y=c/n,p.setXY(m,b.x,b.y),m++}}for(c=1;c<=i;c++)for(s=1;s<=n;s++){var E=(n+1)*(c-1)+(s-1),L=(n+1)*c+(s-1),R=(n+1)*c+s,O=(n+1)*(c-1)+s;l.setX(g,E),g++,l.setX(g,L),g++,l.setX(g,O),g++,l.setX(g,L),g++,l.setX(g,R),g++,l.setX(g,O),g++}this.setIndex(l),this.addAttribute("position",d),this.addAttribute("normal",f),this.addAttribute("uv",p)}function Sn(t,e,i,n,r){ue.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||100,e=e||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var o,a,s=(i+1)*(n+1),c=i*n*2*3,u=new(c>65535?Uint32Array:Uint16Array)(c),h=new Float32Array(3*s),l=new Float32Array(3*s),d=new Float32Array(2*s),f=0,p=0,m=0,g=new N,v=new N,y=new N;for(o=0;o<=i;o++)for(a=0;a<=n;a++){var b=a/n*r,x=o/i*Math.PI*2;v.x=(t+e*Math.cos(x))*Math.cos(b),v.y=(t+e*Math.cos(x))*Math.sin(b),v.z=e*Math.sin(x),h[f]=v.x,h[f+1]=v.y,h[f+2]=v.z,g.x=t*Math.cos(b),g.y=t*Math.sin(b),y.subVectors(v,g).normalize(),l[f]=y.x,l[f+1]=y.y,l[f+2]=y.z,d[p]=a/n,d[p+1]=o/i,f+=3,p+=2}for(o=1;o<=i;o++)for(a=1;a<=n;a++){var w=(n+1)*o+a-1,_=(n+1)*(o-1)+a-1,S=(n+1)*(o-1)+a,A=(n+1)*o+a;u[m]=w,u[m+1]=_,u[m+2]=A,u[m+3]=_,u[m+4]=S,u[m+5]=A,m+=6}this.setIndex(new Kt(u,1)),this.addAttribute("position",new Kt(h,3)),this.addAttribute("normal",new Kt(l,3)),this.addAttribute("uv",new Kt(d,2))}function An(t,e,i,n,r,o){ue.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},t=t||20,e=e||50,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,i=void 0!==i?Math.max(3,i):8,n=void 0!==n?Math.max(1,n):1;var a,s,c,u=(i+1)*(n+1),h=i*n*2*3,l=new Kt(new(h>65535?Uint32Array:Uint16Array)(h),1),d=new Kt(new Float32Array(3*u),3),f=new Kt(new Float32Array(3*u),3),p=new Kt(new Float32Array(2*u),2),m=0,g=0,v=t,y=(e-t)/n,b=new N,x=new I;for(s=0;s<=n;s++){for(c=0;c<=i;c++)a=r+c/i*o,b.x=v*Math.cos(a),b.y=v*Math.sin(a),d.setXYZ(m,b.x,b.y,b.z),f.setXYZ(m,0,0,1),x.x=(b.x/e+1)/2,x.y=(b.y/e+1)/2,p.setXY(m,x.x,x.y),m++;v+=y}for(s=0;s65535?Uint32Array:Uint16Array)(c),1),h=new Kt(new Float32Array(3*s),3),l=new Kt(new Float32Array(2*s),2),d=0,f=0,p=1/e,m=new N,g=new I;for(o=0;o<=e;o++){var v=i+o*p*n,y=Math.sin(v),b=Math.cos(v);for(a=0;a<=t.length-1;a++)m.x=t[a].x*y,m.y=t[a].y,m.z=t[a].x*b,h.setXYZ(d,m.x,m.y,m.z),g.x=o/e,g.y=a/(t.length-1),l.setXY(d,g.x,g.y),d++}for(o=0;o=0&&e<=7&&Fv[t]?Fv[t][e]:Array(e+1).join(t)}function xr(t,e){function i(){f=[],r(),o(),a()}function n(t,e){return void 0!==t?t:e}function r(){f.push(vr("TITEL %-74s",t.name))}function o(){d.forEach(function(t){f.push(vr("REMARK %-73s",t))}),t.trajectory&&(f.push(vr("REMARK %-73s","Trajectory '"+t.trajectory.name+"'")),f.push(vr("REMARK %-73s","Frame "+t.trajectory.frame)))}function a(){var e=1,i=1;t.eachModel(function(t){f.push(vr("MODEL %-74d",i++)),t.eachAtom(function(t){var i=t.hetero?m:p,r=l?e:t.serial,o=t.atomname;1===o.length&&(o=" "+o),f.push(vr(i,r,o,t.resname,n(t.chainname," "),t.resno,t.x,t.y,t.z,n(t.occurence,1),n(t.bfactor,0),n(t.segid,""),n(t.element,""))),e+=1}),f.push(vr("%-80s","ENDMDL")),i+=1}),f.push(vr("%-80s","END"))}function s(){return i(),f.join("\n")}function c(){return new Blob([s()],{type:"text/plain"})}function u(t,e){t=t||"structure",e=e||"pdb";var i=t+"."+e,n=c();v(n,i)}var h=Object.assign({},e),l=void 0===h.renumberSerial||h.renumberSerial,d=h.remarks||[];Array.isArray(d)||(d=[d]);var f,p="ATOM %5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s",m="HETATM%5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s";this.getString=s,this.getBlob=c,this.download=u}function wr(){this.count=0,this.signals={countChanged:new Rn}}function _r(t){this.name=t||"",this.nextGid=1,this.objectList=[],this.rangeList=[]}function Sr(){this.signals={updated:new Rn},this.begin(),this.maxDuration=-(1/0),this.minDuration=1/0,this.avgDuration=14,this.lastDuration=1/0,this.prevFpsTime=0,this.lastFps=1/0,this.lastFrames=1,this.frames=0,this.count=0}function Ar(t,e){function i(t){d.enabled!==!1&&(v=g,g===f.NONE&&(t.keyCode!==d.keys[f.ROTATE]||d.noRotate?t.keyCode!==d.keys[f.ZOOM]||d.noZoom?t.keyCode!==d.keys[f.PAN]||d.noPan||(g=f.PAN):g=f.ZOOM:g=f.ROTATE))}function n(){d.enabled!==!1&&(g=v)}function r(t){d.enabled!==!1&&(g===f.NONE&&(g=t.button),g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||(C.copy(O(t.pageX,t.pageY)),T.copy(C)):(S.copy(O(t.pageX,t.pageY)),A.copy(S)):(x.copy(k(t.pageX,t.pageY)),b.copy(x)),document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",a,!1),d.dispatchEvent(L))}function o(t){d.enabled!==!1&&(g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||T.copy(O(t.pageX,t.pageY)):A.copy(O(t.pageX,t.pageY)):(b.copy(x),x.copy(k(t.pageX,t.pageY))))}function a(){d.enabled!==!1&&(g=f.NONE,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),d.dispatchEvent(R))}function s(t){if(d.enabled!==!1){var e=0;e=t.wheelDelta?t.wheelDelta/40:t.detail?-t.detail/3:-t.deltaY/(t.deltaMode?.33:30),S.y+=.01*e,d.dispatchEvent(L),d.dispatchEvent(R)}}function c(t){if(d.enabled!==!1){switch(t.touches.length){case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x);break;default:g=f.TOUCH_ZOOM_PAN;var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;P=M=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;C.copy(O(n,r)),T.copy(C)}d.dispatchEvent(L)}}function u(t){if(d.enabled!==!1)switch(t.touches.length){case 1:b.copy(x),x.copy(k(t.touches[0].pageX,t.touches[0].pageY));break;default:var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;P=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;T.copy(O(n,r))}}function h(t){if(d.enabled!==!1){switch(t.touches.length){case 0:g=f.NONE;break;case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x)}d.dispatchEvent(R)}}function l(t){t.preventDefault()}var d=this,f={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new N;var p=1e-6,m=new N,g=f.NONE,v=f.NONE,y=new N,b=new I,x=new I,w=new N,_=0,S=new I,A=new I,M=0,P=0,C=new I,T=new I;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var E={type:"change"},L={type:"start"},R={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var t=this.domElement.getBoundingClientRect(),e=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-e.clientLeft,this.screen.top=t.top+window.pageYOffset-e.clientTop,this.screen.width=t.width,this.screen.height=t.height}},this.handleEvent=function(t){"function"==typeof this[t.type]&&this[t.type](t)};var O=function(){var t=new I;return function(e,i){return t.set((e-d.screen.left)/d.screen.width,(i-d.screen.top)/d.screen.height),t}}(),k=function(){var t=new I;return function(e,i){return t.set((e-.5*d.screen.width-d.screen.left)/(.5*d.screen.width),(d.screen.height+2*(d.screen.top-i))/d.screen.width),t}}();this.rotateCamera=function(){var t,e=new N,i=new D,n=new N,r=new N,o=new N,a=new N;return function(){a.set(x.x-b.x,x.y-b.y,0),t=a.length(),t?(y.copy(d.object.position).sub(d.target),n.copy(y).normalize(),r.copy(d.object.up).normalize(),o.crossVectors(r,n).normalize(),r.setLength(x.y-b.y),o.setLength(x.x-b.x),a.copy(r.add(o)),e.crossVectors(a,y).normalize(),t*=d.rotateSpeed,i.setFromAxisAngle(e,t),y.applyQuaternion(i),d.object.up.applyQuaternion(i),w.copy(e),_=t):!d.staticMoving&&_&&(_*=Math.sqrt(1-d.dynamicDampingFactor),y.copy(d.object.position).sub(d.target),i.setFromAxisAngle(w,_),y.applyQuaternion(i),d.object.up.applyQuaternion(i)),b.copy(x)}}(),this.zoomCamera=function(){var t;g===f.TOUCH_ZOOM_PAN?(t=M/P,M=P,y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom*=t)):(t=1+(A.y-S.y)*d.zoomSpeed,1!==t&&t>0&&(y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom/=t),d.staticMoving?S.copy(A):S.y+=(A.y-S.y)*this.dynamicDampingFactor))},this.panCamera=function(){var t=new I,e=new N,i=new N;return function(){if(t.copy(T).sub(C),t.lengthSq()){if(void 0===d.object.fov){var n=(d.object.right-d.object.left)/d.object.zoom,r=(d.object.top-d.object.bottom)/d.object.zoom;t.x*=n,t.y*=r}else t.multiplyScalar(y.length()*d.panSpeed);i.copy(y).cross(d.object.up).setLength(t.x),i.add(e.copy(d.object.up).setLength(t.y)),d.object.position.add(i),d.target.add(i),d.staticMoving?C.copy(T):C.add(t.subVectors(T,C).multiplyScalar(d.dynamicDampingFactor))}}}(),this.checkDistances=function(){d.noZoom&&d.noPan||(y.lengthSq()>d.maxDistance*d.maxDistance&&(d.object.position.addVectors(d.target,y.setLength(d.maxDistance)),S.copy(A)),y.lengthSq()p&&(d.dispatchEvent(E),m.copy(d.object.position))},this.reset=function(){g=f.NONE,v=f.NONE,d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.up.copy(d.up0),y.subVectors(d.object.position,d.target),d.object.lookAt(d.target),d.dispatchEvent(E),m.copy(d.object.position)},this.dispose=function(){this.domElement.removeEventListener("contextmenu",l,!1),this.domElement.removeEventListener("mousedown",r,!1),this.domElement.removeEventListener("mousewheel",s,!1),this.domElement.removeEventListener("wheel",s,!1),this.domElement.removeEventListener("MozMousePixelScroll",s,!1),this.domElement.removeEventListener("touchstart",c,!1),this.domElement.removeEventListener("touchend",h,!1),this.domElement.removeEventListener("touchmove",u,!1),document.removeEventListener("mousemove",o,!1),document.removeEventListener("mouseup",a,!1),window.removeEventListener("keydown",i,!1),window.removeEventListener("keyup",n,!1)},this.domElement.addEventListener("contextmenu",l,!1),this.domElement.addEventListener("mousedown",r,!1),this.domElement.addEventListener("mousewheel",s,!1),this.domElement.addEventListener("wheel",s,!1),this.domElement.addEventListener("MozMousePixelScroll",s,!1),this.domElement.addEventListener("touchstart",c,!1),this.domElement.addEventListener("touchend",h,!1),this.domElement.addEventListener("touchmove",u,!1),window.addEventListener("keydown",i,!1),window.addEventListener("keyup",n,!1),this.handleResize(),this.update()}function Mr(t){if(void 0===t)return"";var e=[];for(var i in t){var n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join("\n")+"\n"}function Pr(t,e){e=e||{};var i=t+"|";for(var n in e)i+=n+":"+e[n];if(!Bv[i]){var r=Mr(e),o=Ov.get("shader/"+t);if(!o)throw"empty shader, '"+t+"'";o=o.replace(zv,function(t,e){var i="shader/chunk/"+e+".glsl",n=Ov.get(i)||kp[e];return n?n:""}),Bv[i]=r+o}return Bv[i]}function Cr(t,e,i,n){function r(e){var n=e%u,r=Math.floor(e/u),o=n*m,a=r*g;i.camera.setViewOffset(m*u,g*u,o,a,m,g),i.render(),h?v.drawImage(t.domElement,Math.floor(o/2),Math.floor(a/2),Math.ceil(m/2),Math.ceil(g/2)):v.drawImage(t.domElement,Math.floor(o),Math.floor(a),Math.ceil(m),Math.ceil(g)),"function"==typeof l&&l(e+1,f,!1)}function o(){i.setSampling(y),i.camera.view=null,"function"==typeof d&&d(f+1,f,!1)}function a(){for(var t=0;t<=f;++t)t===f?o():r(t)}function s(){function t(){e===f?o():r(e),e+=1}for(var e=0,i=0;i<=f;++i)setTimeout(t,0,i)}var c=n||{},u=void 0!==c.factor?c.factor:2,h=void 0!==c.antialias&&c.antialias,l=c.onProgress,d=c.onFinish;h&&(u*=2);var f=u*u,p=document.createElement("canvas"),m=i.width,g=i.height;h?(p.width=m*u/2,p.height=g*u/2):(p.width=m*u,p.height=g*u);var v=p.getContext("2d"),y=i.sampleLevel;i.setSampling(-1),this.render=a,this.renderAsync=s,this.canvas=p}function Tr(t,e,i,n,r){i=i||1,n=n||0;var o,a,s,c=r?r.length:t.length/i,u=0,h=0;if(r)for(a=0;ae?1:t=u&&e(t[o],l)>0;)t[o+1]=t[o],--o;t[o+1]=l}if(c===-1)break;h=s[c--],u=s[c--]}else{var f=u+h>>1;for(o=u+1,a=h,r(f,o),e(t[u],t[h])>0&&r(u,h),e(t[o],t[h])>0&&r(o,h),e(t[u],t[o])>0&&r(u,o),l=t[o];;){do o++;while(e(t[o],l)<0);do a--;while(e(t[a],l)>0);if(a=a-u?(s[++c]=o,s[++c]=h,h=a-1):(s[++c]=u,s[++c]=a-1,u=o)}return t}function kr(t,e,i,n,r){var o,a,s,c,u=t.height,h=t.width,l=t.getContext("2d"),d=l.getImageData(0,0,h,u).data;for(s=!1,a=0;a=0;a--){for(o=h-1;o>=0;o--)if(c=4*(a*h+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var m=a;for(s=!1,o=h-1;o>=0;o--){for(a=u-1;a>=0;a--)if(c=4*(a*h+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var g=o,v=document.createElement("canvas");v.width=g-p,v.height=m-f;var y=v.getContext("2d");return y.drawImage(t,p,f,v.width,v.height,0,0,v.width,v.height),v}function Fr(t,e){function i(e){var i=s;c&&(i*=2),e&&(i=1/i),t.scene.traverse(function(t){var e=t.material;e&&e.linewidth&&(e.linewidth*=i),e&&e.uniforms&&e.uniforms.size&&void 0===e.uniforms.size.__seen&&(e.uniforms.size.value*=i,e.uniforms.size.__seen=!0)}),t.scene.traverse(function(t){var e=t.material;e&&e.uniforms&&e.uniforms.size&&delete e.uniforms.size.__seen})}function n(t){if(a){var e=f,i=0|(u?0:255*e.r),n=0|(u?0:255*e.g),r=0|(u?0:255*e.b),o=0|(u?0:255);return kr(t,i,n,r,o)}return t}function r(t,e,i){"function"==typeof o.onProgress&&o.onProgress(t,e,i)}var o=e||{},a=void 0!==o.trim&&o.trim,s=void 0!==o.factor?o.factor:1,c=void 0!==o.antialias&&o.antialias,u=void 0!==o.transparent&&o.transparent,h=t.renderer,l=t.camera,d=h.getClearAlpha(),f=h.getClearColor();return new Promise(function(e){function o(o,s){var c=n(a.canvas);c.toBlob(function(n){h.setClearAlpha(d),i(!0),t.requestRender(),r(s,s,!0),e(n)},"image/png")}var a=new Cr(h,l,t,{factor:s,antialias:c,onProgress:r,onFinish:o});h.setClearAlpha(u?0:1),i(),a.renderAsync()})}function zr(t,e){var i;t.traverseVisible(function(t){if(t instanceof He&&t.sortParticles){var n=t.geometry.attributes,r=n.position.count;if(0!==r){$v.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),Vv.multiplyMatrices(e.projectionMatrix,$v);var o,a,s,c;for(t.userData.sortData?(o=t.userData.sortData,s=o.__zArray,a=o.__sortArray,c=o.__cmpFn):(s=new Float32Array(r),a=new Uint32Array(r),c=function(t,e){var i=s[t],n=s[e];return i>n?1:i500&&!Q&&K<3&&K!==-1){var i=K;K=3,Z=!0,B(),Q=!0,K=i,t.Debug&&Pv.log("rendered still frame")}var n=et;n.spinAxis&&n.spinAngle&&(Dt(n.spinAxis,n.spinAngle*it.lastDuration/16),T()),requestAnimationFrame(C)}function T(){Z||(performance.now()-it.startTime>22&&(it.begin(),Q=!1),Z=!0,requestAnimationFrame(function(){B(),it.update()}))}function E(){var t=et;J=Rt.copy(ot.position).sub(At.target).length(),J||(ot.position.set(0,0,t.cameraZ),J=Math.abs(t.cameraZ)),tt=Math.max(10,.5*Lt),tt+=Tt.center(Rt).length(),(tt===1/0||tt===-(1/0)||isNaN(tt))&&(tt=50);var e=(50-t.clipNear)/50,i=-(50-t.clipFar)/50;ot.near=J-tt*e,ot.far=J+tt*i;var n=(50-t.fogNear)/50,r=-(50-t.fogFar)/50,o=at.fog;o.color.set(t.fogColor),o.near=J-tt*n,o.far=J+tt*r,"PerspectiveCamera"===ot.type?(ot.near=Math.max(.1,t.clipDist,ot.near),ot.far=Math.max(1,ot.far),o.near=Math.max(.1,o.near),o.far=Math.max(1,o.far)):"OrthographicCamera"===ot.type&&0===t.clipNear&&t.clipDist>0&&J+ot.zoom>2*-t.clipDist&&(ot.near+=ot.zoom+t.clipDist)}function I(){E();var t=Dn(nt.fov),e=(ot.near+ot.far)/2,i=2*Math.tan(t/2)*e;rt.zoom=X/i}function L(){ot.updateMatrix(),ot.updateMatrixWorld(!0),ot.matrixWorldInverse.getInverse(ot.matrixWorld),ot.updateProjectionMatrix(),Br(at,ot,pt,J,tt),zr(at,ot)}function R(t,e,i,n){ht.visible=t,lt.visible=e,dt.visible=i,ft.visible=n}function O(){Rt.copy(ot.position).sub(At.target).setLength(100*Lt),st.position.copy(ot.position).add(Rt),st.color.set(et.lightColor),st.intensity=et.lightIntensity,ct.color.set(et.ambientColor),ct.intensity=et.ambientIntensity}function k(){pt.clearTarget(gt),R(!1,!0,!1,!1),pt.render(at,ot,gt),M(),pt.setRenderTarget(null)}function F(e){e?pt.clearTarget(e):pt.clear(),R(!1,!1,!0,!1),pt.render(at,ot,e),e?pt.clearTarget(e,!1,!0,!1):pt.clearDepth(),M(),R(!0,!1,!1,t.Debug),pt.render(at,ot,e),M()}function z(){var t=Wv[Math.max(0,Math.min(K,5))],e=1/t.length,i=1/32;bt.tForeground.value=vt.texture;for(var n=vt.width,r=vt.height,o=0;o0?z():F(),Y=!1,void(Z=!1))}function U(){Pv.log("scene cleared"),at.remove(ut),o(),pt.clear()}function j(t,e){if(void 0===e?Tt.isEmpty()||kt(Tt.center()):kt(e),t){var i;if(t===!0){var n=It,r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);i=r+Math.sqrt(o)}else i=t;var a=Dn(nt.fov),s=W/X,c=Xr&&(r=u),h>o&&(o=h),l>a&&(a=l)}return[Yr([e,i,n]),Yr([r,o,a])]}function Wr(t,e){for(var i=0,n=e.length;ie?(e/=t,t*Math.sqrt(1+e*e)):e>0?(t/=e,e*Math.sqrt(1+t*t)):0}function xo(t,e,i,n,r,o,a,s){for(var c=2*Kv,u=Qv,h=0,l=0,d=0,f=0,p=Math.max(o,30),m=0,g=0,v=0,y=0,b=0,x=0,w=0,_=0,S=0,A=0,M=0,P=0,C=0,T=0,E=0,I=0,L=0,R=4660,O=0,D=0,N=0,k=new Float64Array(a<<3);h>16&32767&256)?D:-D,t[h*e+d]=O;for(f=0;f<2;f++)for(l=0;l>o),f=Math.max(0,e-n-c>>o),p=Math.max(0,i-n-u>>o),y=Math.min(h,t+n-s>>o),x=Math.min(l,e+n-c>>o),w=Math.min(d,i+n-u>>o),_=[],S=a;S<=y;++S)for(var A=f;A<=x;++A)for(var P=p;P<=w;++P){var T=(S*l+A)*d+P,I=b[T];if(I>0)for(var L=I-1,R=C[L],O=M[L],D=R+O,N=R;N>o)+1,l=(a.max.y-c>>o)+1,d=(a.max.z-u>>o)+1,f=h*l*d,p=t.count,m=t.x,g=t.y,v=t.z,y=0,b=new Uint32Array(f),x=new Int32Array(p);for(n=0;n>o,_=g[n]-c>>o,S=v[n]-u>>o,A=(w*l+_)*d+S;1===(b[A]+=1)&&(y+=1),x[n]=A}var M=new Uint16Array(y);for(n=0,r=0;n0&&(b[n]=r+1,M[r]=P,r+=1)}var C=new Uint32Array(y);for(n=1;n0){var L=I-1;E[C[L]+T[L]]=n,T[L]+=1}}this.within=i}function Ro(e,i){t.Debug&&Pv.time("BondHash init");var n,r=e.count,o=e.atomIndex1,a=e.atomIndex2,s=new Uint8Array(i),c=new Int32Array(i);for(n=0;ns&&(s=e);var a=o-r;if(0===a)return-1;var u=4*l;if(l+=1,1===a)return h[u]=r,h[u+1]=-1,h[u+2]=-1,h[u+3]=n,u;var f=r+Math.floor(a/2);d=e%3;for(var p,m,g,v,y,b=r,x=o-1;x>b;){for(g=b+x>>1,v=t[3*c[g]+d],m=c[g],c[g]=c[x],c[x]=m,y=b,p=b;pr&&s.pop()}var d,f,p=n(u)%3,m=3*c[h[u]],g=[t[m+0],t[m+1],t[m+2]],v=e(i,g),y=h[u+1],b=h[u+2];if(b===-1&&y===-1)return void((s.size()t[3*c[h[e]]+r])throw"left child is > parent!";n+=o(a,i+1)}if(s!==-1){if(t[3*c[h[s]]+r]0&&(e=":"+x(t).join(" OR :")),new On(e)}function Wo(t){this.name=t||"",this.partList=[]}function Xo(t,e){this.matrixList=t||[],this.chainList=e||[]}function qo(e,i){if(i){t.Debug&&Pv.time("assignSecondaryStructure");var n=[];e.eachModel(function(t){t.eachChain(function(t){n.push(t.chainname)})});var r=n.slice().sort(),o=[];r.forEach(function(t){o.push(n.indexOf(t))});var a=i.helices;a=a.filter(function(t){return vh(r,t[0])>=0}),a.sort(function(t,e){var i=t[0],n=e[0],a=t[1],s=e[1];if(i===n)return a===s?0:a=0}),c.sort(function(t,e){var i=t[0],n=e[0];if(i===n)return 0;var a=vh(r,i),s=vh(r,n);return o[a]=r;)e=Math.floor(e/r),o+=n[e%r],i+=1;return i>=5&&Pv.warn("chainname overflow"),o},h=e.getAtomProxy(),l=e.getAtomProxy(),d=0,f=0,p=0,m=0,g=[];1===s.count?g.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):e.eachResidueN(2,function(t,e){var i=!1,n=t.backboneType,r=e.backboneType,o=fm;m=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:n!==o&&n===r&&(h.index=t.backboneEndAtomIndex,l.index=e.backboneStartAtomIndex,h.connectedTo(l)||(i=!0)),i||e.index!==s.count-1||(i=!0,m=e.index),i&&(g.push({mIndex:f,chainname:u(d),rStart:p,rCount:m-p+1}),d+=1,t.modelIndex!==e.modelIndex&&(d=0,f+=1),e.index===s.count-1&&m!==e.index&&g.push({mIndex:f,chainname:u(d),rStart:s.count-1,rCount:1}),p=e.index,m=e.index)}),a.count=0,g.forEach(function(t){c(t.mIndex,t.chainname,t.rStart,t.rCount)});var v=0;e.eachModel(function(t){o.chainOffset[t.index]=v,o.chainCount[t.index]-=1,v+=o.chainCount[t.index]})}t.Debug&&Pv.timeEnd("calculateChainnames")}function Zo(e){t.Debug&&Pv.time("calculateBonds"),Jo(e),ta(e),t.Debug&&Pv.timeEnd("calculateBonds")}function Ko(e){var i=e.structure,n=i.getAtomProxy(),r=i.getAtomProxy(),o=e.atomCount,a=e.atomOffset,s=a+o,c=s-1;if(o>500)return void(t.Debug&&Pv.warn("more than 500 atoms, skip residue for auto-bonding",e.qualifiedName()));var u,h,l=[],d=[],f=[];if(o>50){var p=new Vo(e,!0),m=e.isCg()?1.2:2.3;for(u=a;u500)return void Pv.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),d=l.atomIndices1,f=l.atomIndices2,p=l.bondOrders,m=d.length,g=0;g1&&(c.x-=1),s.x<0&&(c.x+=1),s.y>1&&(c.y-=1),s.y<0&&(c.y+=1),s.z>1&&(c.z-=1),s.z<0&&(c.z+=1),t&&c.add(t),u.setPosition(c),u.multiplyMatrices(n.fracToCart,u),u.multiply(n.cartToFrac),e.push(u)}),e}if(e.unitcell){t.Debug&&Pv.time("buildUnitcellAssembly");var n=e.unitcell,r=e.center.clone().applyMatrix4(n.cartToFrac),o=Go(n.spacegroup),a=new N,s=new N,c=new N;r.x>1&&(a.x-=1),r.x<0&&(a.x+=1),r.y>1&&(a.y-=1),r.y<0&&(a.y+=1),r.z>1&&(a.z-=1),r.z<0&&(a.z+=1);var u,h=new Wo("UNITCELL"),l=i();if(e.biomolDict.NCS){u=[new O].concat(e.biomolDict.NCS.partList[0].matrixList);var d=[];l.forEach(function(t){u.forEach(function(e){d.push(t.clone().multiply(e))})}),h.addPart(d)}else h.addPart(l);var f=new N,p=new Wo("SUPERCELL"),m=Array.prototype.concat.call(i(),i(f.set(1,1,1)),i(f.set(-1,-1,-1)),i(f.set(1,0,0)),i(f.set(1,1,0)),i(f.set(1,0,1)),i(f.set(0,1,0)),i(f.set(0,1,1)),i(f.set(0,0,1)),i(f.set(-1,0,0)),i(f.set(-1,-1,0)),i(f.set(-1,0,-1)),i(f.set(0,-1,0)),i(f.set(0,-1,-1)),i(f.set(0,0,-1)),i(f.set(1,-1,-1)),i(f.set(1,1,-1)),i(f.set(1,-1,1)),i(f.set(-1,1,1)),i(f.set(-1,-1,1)),i(f.set(-1,1,-1)),i(f.set(0,1,-1)),i(f.set(0,-1,1)),i(f.set(1,0,-1)),i(f.set(-1,0,1)),i(f.set(1,-1,0)),i(f.set(-1,1,0)));if(e.biomolDict.NCS){var g=[];m.forEach(function(t){u.forEach(function(e){g.push(t.clone().multiply(e))})}),p.addPart(g)}else p.addPart(m);e.biomolDict.UNITCELL=h,e.biomolDict.SUPERCELL=p,t.Debug&&Pv.timeEnd("buildUnitcellAssembly")}}function ia(t){var e=t.bondHash,i=e.countArray,n=e.offsetArray,r=e.indexArray,o=t.getBondProxy();t.eachResidue(function(t){var e=t.residueType;if(void 0===e.bonds){var a=t.atomOffset,s=[],c=[],u=[],h={};t.eachAtom(function(t){for(var e=t.index,l=n[e],d=i[e],f=0,p=d;fg){var v=g;g=m,m=v}var y=m+"|"+g;void 0===h[y]&&(h[y]=!0,s.push(m-a),c.push(g-a),u.push(o.bondOrder))}}),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}})}function na(t,e,i){this.structure=t,i=i||iy(e),this.atomname=e,this.element=i,this.vdw=Cm[i],this.covalent=Em[i]}function ra(t){function e(t,e){return t+"|"+e}function i(i,n){n=n||iy(i);var a=e(i,n),s=r[a];if(void 0===s){var c=new na(t,i,n);s=o.length,r[a]=s,o.push(c)}return s}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r,this.toJSON=function(){var t={metadata:{version:.1,type:"AtomMap",generator:"AtomMapExporter"},idDict:r,typeList:o.map(function(t){return t.toJSON()})};return t},this.fromJSON=function(e){r=e.idDict,o=e.typeList.map(function(e){return new na(t,e.atomname,e.element)}),this.list=o,this.dict=r}}function oa(t,e,i,n,r,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=n?1:0,this.chemCompType=r,this.bonds=o,this.rings=void 0,this.atomCount=i.length,this.moleculeType=this.getMoleculeType(),this.backboneType=this.getBackboneType(0),this.backboneEndType=this.getBackboneType(-1),this.backboneStartType=this.getBackboneType(1),this.backboneIndexList=this.getBackboneIndexList();var a=Vm[this.backboneType],s=Vm[this.backboneStartType],c=Vm[this.backboneEndType],u=this.getAtomIndexByName(a.trace);this.traceAtomIndex=void 0!==u?u:-1;var h=this.getAtomIndexByName(a.direction1);this.direction1AtomIndex=void 0!==h?h:-1;var l=this.getAtomIndexByName(a.direction2);this.direction2AtomIndex=void 0!==l?l:-1;var d=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==d?d:-1;var f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1;var p;p=Fm.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==p?p:-1,this.bondReferenceAtomIndices=[]}function aa(t){function e(t,e,i,n){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(n?n:"")}function i(i,n,a,s,c){i=i.toUpperCase();var u=e(i,n,a,s),h=r[u];if(void 0===h){var l=new oa(t,i,n,a,s,c);h=o.length,r[u]=h,o.push(l)}return h}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r}function sa(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new N,this._v13=new N,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()}function ca(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.bondHash=t.bondHash,this.index=e}function ua(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e}function ha(t,e,i){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueIndexStart=e,this.residueIndexEnd=i,this.residueCount=i-e+1;var n=this.structure.getResidueProxy(this.residueIndexStart),r=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==n.getPreviousConnectedResidue();var o=r.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=r.connectedTo(n),this.__residueProxy=this.structure.getResidueProxy()}function la(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e,this.__residueProxy=this.structure.getResidueProxy()}function da(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function fa(t,e){this.signals={refreshed:new Rn},this.name=t,this.path=e,this.title="",this.id="",this.header={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.bondStore=new Do(0),this.backboneBondStore=new Do(0),this.rungBondStore=new Do(0),this.atomStore=new No(0),this.residueStore=new ko(0),this.chainStore=new Fo(0), +this.modelStore=new zo(0),this.atomMap=new ra(this),this.residueMap=new aa(this),this.bondHash=void 0,this.spatialHash=void 0,this.atomSet=void 0,this.bondSet=void 0,this.center=void 0,this.boundingBox=void 0,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy()}function pa(t,e,i){this.name=t,this.path=e,this.info={},this.center=new N,this.boundingBox=new Et,i instanceof ae||i instanceof ue||i instanceof We?this.fromGeometry(i):i&&this.set(i.position,i.index,i.normal,i.color,i.atomindex,i.contour)}function ma(e){var i=0,n=0,r={},o={},a=URL.createObjectURL(Tv.get(e)),s=new window.Worker(a);Tv.activeWorkerCount+=1,s.onmessage=function(n){i-=1;var a=n.data.__postId;t.Debug&&Pv.timeEnd("Worker.postMessage "+e+" #"+a),r[a]&&r[a].call(s,n),delete r[a],delete o[a]},s.onerror=function(t){if(i-=1,t.data){var n=t.data.__postId;o[n]?o[n].call(s,t):Pv.error("Worker.onerror",n,e,t),delete r[n],delete o[n]}else Pv.error("Worker.onerror",e,t)},this.name=e,this.post=function(a,c,u,h){r[n]=u,o[n]=h,a=a||{},a.__name=e,a.__postId=n,a.__debug=t.Debug,t.Debug&&Pv.time("Worker.postMessage "+e+" #"+n);try{s.postMessage(a,c)}catch(t){Pv.error("worker.post:",t),s.postMessage(a)}return i+=1,n+=1,this},this.terminate=function(){s?(s.terminate(),URL.revokeObjectURL(a),Tv.activeWorkerCount-=1):Pv.log("no worker to terminate")},Object.defineProperties(this,{postCount:{get:function(){return n}},pending:{get:function(){return i}}})}function ga(t,e){e=Math.min(8,e||2);var i=[],n=0;this.name=t,this.maxCount=e,this.post=function(t,e,i,n){var r=this.getNextWorker();return r.post(t,e,i,n),this},this.terminate=function(){i.forEach(function(t){t.terminate()})},this.getNextWorker=function(){for(var r,o=1/0,a=0;a=n){r=new ma(t),i.push(r),n+=1;break}var s=i[a];if(0===s.pending){o=s.pending,r=s;break}s.pending=g){R=m,E=!0;break}if(E)break}if(E)break}for(E=!1,p=o;p=g){L=p,E=!0;break}if(E)break}if(E)break}for(E=!1,d=r;d=g){I=d,E=!0;break}if(E)break}if(E)break}for(E=!1,m=u;m>=a;--m){for(p=c;p>=o;--p){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){N=m,E=!0;break}if(E)break}if(E)break}for(E=!1,p=c;p>=o;--p){for(m=N;m>=a;--m){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){D=p,E=!0;break}if(E)break}if(E)break}for(E=!1,d=s;d>=r;--d){for(p=D;p>=o;--p){for(m=N;m>=a;--m)if(l=e*i*m+e*p+d,t[l]>=g){O=d,E=!0;break}if(E)break}if(E)break}v?(r=Math.max(0,I-1),o=Math.max(0,L-1),a=Math.max(0,R-1),s=Math.min(e-1,O+1),c=Math.min(i-1,D+1),u=Math.min(n-1,N+1)):(r=Math.max(1,I-1),o=Math.max(1,L-1),a=Math.max(1,R-1),s=Math.min(e-2,O+1),c=Math.min(i-2,D+1),u=Math.min(n-2,N+1));var k=15;for(m=a;m65535?Uint32Array:Uint16Array;return{position:new Float32Array(S),normal:v?void 0:new Float32Array(A),index:new s(M),atomindex:r?new Int32Array(P):void 0,contour:y}}}function wa(t,e,i,n){i=i||1,n=n||!0;var r,o=t.length/3,a=e.length/3;n&&(r=new Float32Array(3*o));var s,c=new Float32Array(3*o),u=20,h=new Array(u);for(s=0;s.9*e[3*n+n])if(o>0)for(r=0;r<3;++r)t[i+r]-=e[3*n+r];else for(r=0;r<3;++r)t[i+r]+=e[3*n+r];return t}}function La(t,e,i){this.signals={gotNumframes:new Rn,frameChanged:new Rn,selectionChanged:new Rn,playerChanged:new Rn};var n=i||{};n.centerPbc=d(n.centerPbc,!0),n.removePbc=d(n.removePbc,!0),n.superpose=d(n.superpose,!0),this.setParameters(n),this.name=t.replace(/^.*[\\\/]/,""),this.selection=new On(d(n.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add(function(){this.makeIndices(),this.resetCache()},this),this.setStructure(e),this.trajPath=t,this.numframes=void 0,this.getNumframes()}function Ra(t){return"front"===t?Mh:"back"===t?Ph:"double"===t?Ch:Ch}function Oa(t,e,i,n,r){var o=r||{};this.pickable=!1,this.dynamic=!0,this.opaqueBack=d(o.opaqueBack,!1),this.dullInterior=d(o.dullInterior,!1),this.side=d(o.side,"double"),this.opacity=d(o.opacity,1),this.clipNear=d(o.clipNear,0),this.clipRadius=d(o.clipRadius,0),this.clipCenter=d(o.clipCenter,new N),this.flatShaded=d(o.flatShaded,!1),this.background=d(o.background,!1),this.linewidth=d(o.linewidth,1),this.wireframe=d(o.wireframe,!1),this.wireframeLinewidth=d(o.wireframeLinewidth,1),this.roughness=d(o.roughness,.4),this.metalness=d(o.metalness,0),this.diffuse=d(o.diffuse,16777215),this.forceTransparent=d(o.forceTransparent,!1),this.geometry=new ue,this.addAttributes({position:{type:"v3",value:t},color:{type:"c",value:e}}),this.indexVersion=0,this.wireframeIndexVersion=-1,i&&(this.geometry.setIndex(new Kt(i,1)),this.geometry.getIndex().setDynamic(this.dynamic)),n&&(this.addAttributes({pickingColor:{type:"c",value:n}}),this.pickable=!0),this.uniforms=Fd.merge([zp.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new Ct(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},zp.ambient,zp.lights]),this.uniforms.diffuse.value.set(this.diffuse);var a=new rn(0).onUpdate(function(t){this.value=Av?t.id:t.id/255});this.pickingUniforms={nearClip:{value:0},objectId:a},this.group=new We,this.wireframeGroup=new We,this.pickingGroup=new We,this.makeWireframeGeometry()}function Da(t,e,i,n,r,o){var a=o||{};this.size=t?t.length/3:0,this.attributeSize=this.size,this.vertexShader="Mesh.vert",this.fragmentShader="Mesh.frag",Oa.call(this,t,e,i,r,a),this.addAttributes({normal:{type:"v3",value:n}}),void 0===n&&this.geometry.computeVertexNormals()}function Na(t){for(var e,i,n=t.vertices,r=n.length,o=new Float32Array(3*r),a=0;a65535?Uint32Array:Uint16Array,a=new o(3*r),s=0;s65535?Uint32Array:Uint16Array;this.meshIndex=new u(c*o*3),this.makeIndex(),Da.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,a),this.initNormals=!0,this.setAttributes({position:t,color:e,pickingColor:i}),this.initNormals=!1}function Ba(t,e,i,n,r){var o=r||{},a=d(o.sphereDetail,1);this.geo=new wn(1,a),this._radius=i,za.call(this,t,e,n,o)}function Ua(t){this.size=this.count,this.attributeSize=this.count*this.mappingSize;var e=this.count*this.mappingIndicesSize,i=this.attributeSize>65535?Uint32Array:Uint16Array;this.index=new i(e),this.makeIndex(),Oa.call(this,null,null,this.index,null,t),this.addAttributes({mapping:{type:this.mappingType,value:null}})}function ja(t){this.mapping=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.mappingIndices=new Uint16Array([0,1,2,1,3,2]),this.mappingIndicesSize=6,this.mappingType="v2",this.mappingSize=4,this.mappingItemSize=2,Ua.call(this,t)}function $a(t,e,i,n,r){this.impostor=!0,this.count=t.length/3,this.vertexShader="SphereImpostor.vert",this.fragmentShader="SphereImpostor.frag",ja.call(this,r),this.addUniforms({projectionMatrixInverse:{value:new O},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes({position:t,color:e,radius:i}),n&&(this.addAttributes({pickingColor:{type:"c",value:null}}),this.setAttributes({pickingColor:n}),this.pickable=!0),this.makeMapping()}function Va(t,e,i,n,r){var o=r||{};return!Mv||o.disableImpostor?new Ba(t,e,i,n,r):new $a(t,e,i,n,r)}function Ga(t,e,i,n,r,o,a){var s=a||{},c=d(s.sphereDetail,2);this.updateNormals=!0,this.geo=new wn(1,c),this._radius=i,this._majorAxis=n,this._minorAxis=r,za.call(this,t,e,o,s)}function Ha(t,e,i,n,r,o,a){return new Ga(t,e,i,n,r,o,a)}function Wa(t,e,i,n,r,o,a,s){var c=s||{},u=d(c.radialSegments,10),h=d(c.openEnded,!0);this.updateNormals=!0;var l=(new O).makeRotationX(Math.PI/2);this.geo=new yn(1,1,1,u,1,h),this.geo.applyMatrix(l);var f=t.length,p=r.length;this._position=new Float32Array(2*f),this._color=new Float32Array(2*f),this._pickingColor=new Float32Array(2*f),this._from=new Float32Array(2*f),this._to=new Float32Array(2*f),this._radius=new Float32Array(2*p),this.__center=new Float32Array(f),za.call(this,this._position,this._color,this._pickingColor,c),this.setAttributes({position1:t,position2:e,color:i,color2:n,radius:r,pickingColor:o,pickingColor2:a})}function Xa(t){this.mapping=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),this.mappingIndices=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),this.mappingIndicesSize=12,this.mappingType="v3",this.mappingSize=6,this.mappingItemSize=3,Ua.call(this,t)}function qa(t,e,i,n,r,o,a,s){var c=s||{};this.openEnded=d(c.openEnded,!1),this.impostor=!0,this.count=t.length/3,this.vertexShader="CylinderImpostor.vert",this.fragmentShader="CylinderImpostor.frag",Xa.call(this,c);var u=new rn(new O).onUpdate(function(t){this.value.getInverse(t.modelViewMatrix)});this.addUniforms({modelViewMatrixInverse:u,ortho:{value:0}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null}}),this.setAttributes({position1:t,position2:e,color:i,color2:n,radius:r}),o&&(this.addAttributes({pickingColor:{type:"c",value:null},pickingColor2:{type:"c",value:null}}),this.setAttributes({pickingColor:o,pickingColor2:a}),this.pickable=!0),this.makeMapping()}function Ya(t,e,i,n,r,o,a,s){var c=s||{};return!Mv||c.disableImpostor?new Wa(t,e,i,n,r,o,a,s):new qa(t,e,i,n,r,o,a,s)}function Za(t,e,i,n,r,o){var a=o||{},s=d(a.radialSegments,60),c=d(a.openEnded,!1);this.updateNormals=!0;var u=(new O).makeRotationX(-Math.PI/2);this.geo=new Tn(1,1,s,1,c),this.geo.applyMatrix(u);var h=t.length,l=n.length;this._position=new Float32Array(h),this._from=new Float32Array(h),this._to=new Float32Array(h),this._radius=new Float32Array(l),za.call(this,this._position,i,r,a),this.setAttributes({position1:t,position2:e,color:i,radius:n,pickingColor:r})}function Ka(t,e,i,n,r,o){return new Za(t,e,i,n,r,o)}function Qa(t,e,i,n,r,o){function a(t){var e,i,n={};if(t.radius){for(e=0,i=p.length;e65535?Uint32Array:Uint16Array;i=new r(i)}Array.isArray(n)&&(n=new Float32Array(n));var o=new Da(t,e,i,n);S.push(o),_.setFromArray(t),x.union(_)}function o(t,e,n){i(t,A),i(e,M),P.push(n),x.expandByPoint(w.fromArray(t))}function a(t,e,n,r,o){i(t,C),i(e,T),E.push(n),i(r,I),i(o,L),x.expandByPoint(w.fromArray(t))}function s(t,e,n,r){i(t,R),i(e,O),i(n,D),k.push(r),x.expandByPoint(w.fromArray(t)),x.expandByPoint(w.fromArray(e))}function c(t,e,n,r){i(t,F),i(e,z),i(n,B),U.push(r),x.expandByPoint(w.fromArray(t)),x.expandByPoint(w.fromArray(e))}function u(t,e,n,r){i(t,j),i(e,$),i(n,V),G.push(r),x.expandByPoint(w.fromArray(t)),x.expandByPoint(w.fromArray(e))}function h(){var t=[];if(A.length){var e=new Va(new Float32Array(A),new Float32Array(M),new Float32Array(P),void 0,{sphereDetail:m,disableImpostor:v});t.push(e)}if(C.length){var i=new Ha(new Float32Array(C),new Float32Array(T),new Float32Array(E),new Float32Array(I),new Float32Array(L),void 0,{sphereDetail:m,disableImpostor:v});t.push(i)}if(R.length){var n=new Ya(new Float32Array(R),new Float32Array(O),new Float32Array(D),new Float32Array(D),new Float32Array(k),void 0,void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(n)}if(F.length){var r=new Ka(new Float32Array(F),new Float32Array(z),new Float32Array(B),new Float32Array(U),void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(r)}if(j.length){var o=new Qa(new Float32Array(j),new Float32Array($),new Float32Array(V),new Float32Array(G),void 0,{aspectRatio:p,radialSegments:g,disableImpostor:v,openEnded:y});t.push(o)}return S.concat(t)}function l(){S.forEach(function(t){t.dispose()}),S.length=0,A.length=0,M.length=0,P.length=0,C.length=0,T.length=0,E.length=0,I.length=0,L.length=0,R.length=0,O.length=0,D.length=0,k.length=0,F.length=0,z.length=0,B.length=0,U.length=0,j.length=0,$.length=0,V.length=0,G.length=0}this.name=d(t,"shape");var f=e||{},p=d(f.aspectRatio,1.5),m=d(f.sphereDetail,2),g=d(f.radialSegments,50),v=d(f.disableImpostor,!1),y=d(f.openEnded,!1),b=new N,x=new Et,w=new N,_=new Et,S=[],A=[],M=[],P=[],C=[],T=[],E=[],I=[],L=[],R=[],O=[],D=[],k=[],F=[],z=[],B=[],U=[],j=[],$=[],V=[],G=[];Object.defineProperties(this,{center:{get:function(){return x.center(b)}}}),this.boundingBox=x,this.addBuffer=n,this.addMesh=r,this.addSphere=o,this.addEllipsoid=a,this.addCylinder=s,this.addCone=c,this.addArrow=u,this.getBufferList=h,this.dispose=l}function ts(t,e,i){this.viewer=e,this.gidPool=i?i.gidPool:void 0,this.tasks=new wr,this.queue=new Ca(this.make.bind(this)),this.bufferList=[],this.init(i)}function es(t,e,i){Array.isArray(t)||(t=[t]),ts.call(this,t,e,i),this.buffer=t,this.build()}function is(){Da.apply(this,arguments)}function ns(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.pickable=t.pickable,this.background=t.background,this.group=new We,this.wireframeGroup=new We,this.pickingGroup=new We;var e=[],i=[],n=t,r=new t.constructor;n.makeMaterial(),r.makeMaterial(),r.geometry=t.geometry,r.wireframeGeometry=t.wireframeGeometry,r.size=t.size,r.attributeSize=t.attributeSize,r.pickable=t.pickable,r.setParameters(t.getParameters()),r.updateShader(),n.setParameters({side:"front"}),r.setParameters({side:"back",opacity:r.opacity}),this.getMesh=function(t){var o,a;return t?(a=r.getPickingMesh(),o=n.getPickingMesh()):(a=r.getMesh(),o=n.getMesh()),e.push(o),i.push(a),this.setParameters({side:this.side}),(new We).add(a,o)},this.getWireframeMesh=function(){return t.getWireframeMesh()},this.getPickingMesh=function(){return this.getMesh(!0)},this.setAttributes=function(e){t.setAttributes(e)},this.setParameters=function(t){t=Object.assign({},t),"front"===t.side?(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!1})):"back"===t.side?(e.forEach(function(t){t.visible=!1}),i.forEach(function(t){t.visible=!0})):"double"===t.side&&(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!0})),void 0!==t.side&&(this.side=t.side),delete t.side,n.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,r.setParameters(t)},this.setVisibility=Oa.prototype.setVisibility,this.dispose=function(){n.dispose(),r.dispose()}}function rs(t,e,i){ts.call(this,t,e,i),t instanceof Pa?(this.surface=void 0,this.volume=t):(this.surface=t,this.volume=void 0),this.boxCenter=new N,this.__boxCenter=new N,this.box=new Et,this.__box=new Et,this.setBox=function(){var t=new N;return function(){var i=e.controls.target,n=e.rotationGroup.position;t.copy(n).negate().add(i),t.equals(this.boxCenter)||this.setParameters({boxCenter:t})}.bind(this)}.bind(this)(),this.viewer.signals.orientationChanged.add(this.setBox),this.build()}function os(t){function e(t,e,i){return Math.min(Math.max(t,e),i)}function i(t,e,i,n){var r=i-t,o=n-e;return Math.sqrt(r*r+o*o)}function n(t,i,n){return n=e((n-t)/(i-t),0,1),n*n*(3-2*n)}for(var r=Object.assign({},t),o=d(r.width,256),a=d(r.height,256),s=[o/2,a/2],c=Math.min(o/2,a/2),u=d(r.delta,1/(c+1))*c,h=0,l=0,f=new Uint8Array(o*a*4),p=0,m=f.length;p1&&(l=1),r(e,i,n,o,h,p),r(e,i,n,o,l,m),m.sub(p).normalize(),m.toArray(a,g)}}function s(e,i,n,r,o){for(var a,s=i.next(),c=i.next(),u=i.next(),h=i.size,l=h-1,d=r||0,f=0;f65535?Uint32Array:Uint16Array;this.meshIndex=new p(f),this.makeIndex(),Da.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,c),this.setAttributes({position:t,normal:e,binormal:i,tangent:n,color:r,size:o,pickingColor:a})}function Vs(t,e,i){hs.call(this,t,e,i)}function Gs(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Vo(e)}function Hs(t,e,i){e=e||3.5,i=i||40;for(var n=new On("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),r=new On("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new Gs(o,a),c=s.within(e),u=c.bondStore,h=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new N,v=new N,y=function(t,e,n,r){var o,a;t.atomname===n?(o=t,a=e):(o=e,a=t),p.index=o.residueIndex;var s=p.getAtomIndexByName(r);return g.subVectors(s,o),v.subVectors(s,a),Nn(g.angleTo(v))i&&c.bondSet.flip_unsafe(b)}else("OH"===h.atomname&&"TYR"===h.resname||"OH"===l.atomname&&"TYR"===l.resname)&&(y(h,l,"OH","CZ")||c.bondSet.flip_unsafe(b));return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function Ws(t,e,i){e=e||3.5,i=i||40;for(var n=new On("( PROTEIN and .N )"),r=new On("( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new Gs(o,a),c=s.within(e),u=c.bondStore,h=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new N,v=new N,y=0,b=u.count;yi&&c.bondSet.flip_unsafe(y)))}}return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function Xs(t,e,i){hs.call(this,t,e,i)}function qs(t){var e=Object.assign({},t);if(this.font=d(e.font,["sans-serif"]),this.size=d(e.size,36),this.style=d(e.style,"normal"),this.variant=d(e.variant,"normal"),this.weight=d(e.weight,"normal"),this.outline=d(e.outline,0),this.width=d(e.width,1024),this.height=d(e.height,1024),this.gamma=1,"undefined"!=typeof navigator){var i=navigator.userAgent;i.match(/Chrome/)&&i.match(/OS X/)&&(this.gamma=.5)}this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.build(),this.populate(),this.texture=new qe(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0}function Ys(t,e,i,n,r){var o=r||{};o.forceTransparent=!0,this.fontFamily=d(o.fontFamily,"sans-serif"),this.fontStyle=d(o.fontStyle,"normal"),this.fontWeight=d(o.fontWeight,"bold"),this.fontSize=d(o.fontSize,48),this.sdf=d(o.sdf,"Chrome"===_v),this.xOffset=d(o.xOffset,0),this.yOffset=d(o.yOffset,0),this.zOffset=d(o.zOffset,.5),this.attachment=d(o.attachment,"bottom-left"),this.showBorder=d(o.showBorder,!1),this.borderColor=d(o.borderColor,"lightgrey"),this.borderWidth=d(o.borderWidth,.15),this.showBackground=d(o.showBackground,!1),this.backgroundColor=d(o.backgroundColor,"lightgrey"),this.backgroundMargin=d(o.backgroundMargin,.5),this.backgroundOpacity=d(o.backgroundOpacity,1);for(var a=t.length/3,s=0,c=0;ca?u[h]=-1:(o=Math.sqrt(a-r),u[h]=Math.floor(o)),++h;A[l]=c,S[l]=u}}function o(i){var n,r,o,a,s,c,u,h,l,d,f,p,m,v,w,M,T,I,L=3*i,O=i;n=Math.floor(.5+g*(t[L]+_[0])),r=Math.floor(.5+g*(t[L+1]+_[1])),o=Math.floor(.5+g*(t[L+2]+_[2]));var D,N=e[O],k=S[N],F=0,z=b*x,B=A[N];for(d=0;d=y||v>=b||w>=x)){var U=m*z+v*x+w;if(P)if(C[U]&R){if(C[U]&R){var j=E[U];j!==L&&(a=n+u-Math.floor(.5+g*(t[j]+_[0])),s=r+h-Math.floor(.5+g*(t[j+1]+_[1])),c=o+l-Math.floor(.5+g*(t[j+2]+_[2])),u*u+h*h+l*l=y||f>=b||p>=x)){var z=d*F+f*x+p;if(C[z]&O){if(P){var B=E[z];a=Math.floor(.5+g*(t[B]+_[0])),s=Math.floor(.5+g*(t[B+1]+_[1])),c=Math.floor(.5+g*(t[B+2]+_[2])),u*u+h*h+l*l-1&&a-1&&c-1&&s0);var p,m=v*v,g=new Uint16Array(3);for(t=0;t=m)||(C[r]|=D,P&&C[r]&O&&(o.toArray(t,e,i,g),p=g[0]*a+g[1]*x+g[2],E[r]=E[p])));console.timeEnd("EDTSurface fastdistancemap")}function l(t,e,i,n){var r,o,a,s,c,u,h,l,d,f,p,m,g=new Uint16Array(3),v=0;if(0===i)return v;var w=-1,_=-1,S=-1,A=b*x;for(h=0,d=i;h-1&&_-1&&S-1&&(p=w*A+x*_+S,C[p]&R&&!(C[p]&O)?(e.fromArray(w,_,S,g),s=w-g[0],c=_-g[1],u=S-g[2],f=s*s+c*c+u*u,T[p]=f,C[p]|=O,C[p]|=D,n[v]=w,n[v+1]=_,n[v+2]=S,v+=3):C[p]&R&&C[p]&O&&(s=w-g[0],c=_-g[1],u=S-g[2],f=s*s+c*c+u*u,f-1&&_-1&&S-1&&(p=w*A+x*_+S,C[p]&R&&!(C[p]&O)?(e.fromArray(w,_,S,g),s=w-g[0],c=_-g[1],u=S-g[2],f=s*s+c*c+u*u,T[p]=f,C[p]|=O,C[p]|=D,n[v]=w,n[v+1]=_,n[v+2]=S,v+=3):C[p]&R&&C[p]&O&&(s=w-g[0],c=_-g[1],u=S-g[2],f=s*s+c*c+u*u,f-1&&_-1&&S-1&&(p=w*A+x*_+S,C[p]&R&&!(C[p]&O)?(e.fromArray(w,_,S,g),s=w-g[0],c=_-g[1],u=S-g[2],f=s*s+c*c+u*u,T[p]=f,C[p]|=O,C[p]|=D,n[v]=w,n[v+1]=_,n[v+2]=S,v+=3):C[p]&R&&C[p]&O&&(s=w-g[0],c=_-g[1],u=S-g[2],f=s*s+c*c+u*u,fT&&(T=R)}this.neighbourListLength=27*T+1,this.withinRadii=function(r,o,a,c,d){for(var f=0,p=s(r,u),y=s(o,h),x=s(a,l),w=Math.max(0,p-1),_=Math.max(0,y-1),S=Math.max(0,x-1),C=Math.min(m,p+1),T=Math.min(g,y+1),E=Math.min(v,x+1),I=w;I<=C;++I)for(var L=I*b,R=_;R<=T;++R)for(var O=R*v,D=S;D<=E;++D)for(var N=L+O+D,k=A[N],F=k+M[N],z=k;zC&&(C=M[h]);o(),a(),s(),W=-1}function r(t,e,i){for(var n=0;n=0;){if(o!==n&&o!==r&&u(o,t,e,i))return W=o,o;o=$[++a]}return W=-1,-1}function u(e,i,n,r){var o=3*e,a=P[e],s=t[o]-i,c=t[o+1]-n,u=t[o+2]-r,h=s*s+c*c+u*u;return h=0;)t0&&s65535?Uint32Array:Uint16Array;this.meshIndex=new l(h),this.makeIndex(),Da.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,s),this.vertexShader="Ribbon.vert",this.fragmentShader="Mesh.frag",this.geometry.addAttribute("dir",new Kt(new Float32Array(h),3)),this.geometry.addAttribute("size",new Kt(new Float32Array(u),1)),this.setAttributes({position:t,normal:e,dir:i,color:n,size:r,pickingColor:o})}function vc(t,e,i){hs.call(this,t,e,i),this.defaultScale.sstruc*=3}function yc(t,e,i){this.helixbundleList=[],hs.call(this,t,e,i)}function bc(t,e,i){Vs.call(this,t,e,i)}function xc(t,e,i){hs.call(this,t,e,i)}function wc(t,e,i){var n=i||{};this.size=t.length/3,this.vertexShader="Line.vert",this.fragmentShader="Line.frag",this.line=!0;var r=this.size,o=r-1;this.attributeSize=2*o,this.linePosition=new Float32Array(3*o*2),this.lineColor=new Float32Array(3*o*2),Oa.call(this,this.linePosition,this.lineColor,void 0,void 0,n),this.setAttributes({position:t,color:e})}function _c(t,e,i){hs.call(this,t,e,i)}function Sc(t,e,i){Vs.call(this,t,e,i)}function Ac(t,e,i){hs.call(this,t,e,i)}function Mc(t,e){var i=e||{};this.streamer=t,this.name=d(i.name,""),this.path=d(i.path,"")}function Pc(t){function e(t){for(var e=l.atomCount[t],r=l.atomOffset[t],o=new Array(e),a=0;a0&&e(g-1),l.growIfFull(),l.resno[g]=w,void 0!==S&&(l.sstruc[g]=S.charCodeAt(0)),void 0!==A&&(l.inscode[g]=A.charCodeAt(0)),l.atomOffset[g]=m,l.atomCount[g]=0,l.count+=1,l.chainIndex[g]=v,d.residueCount[v]+=1),h.count+=1,h.residueIndex[m]=g,l.atomCount[g]+=1,r=t,o=b,a=x,s=w,c=A,u=_},this.finalize=function(){i=a,n=u,g>-1&&e(g)}}function Cc(t,e){var i=e||{};this.firstModelOnly=d(i.firstModelOnly,!1),this.asTrajectory=d(i.asTrajectory,!1),this.cAlphaOnly=d(i.cAlphaOnly,!1),Mc.call(this,t,i),this.structure=new fa(this.name,this.path),this.structureBuilder=new Pc(this.structure)}function Tc(t,e,i,n,r,o,a,s){this.a=t||1,this.b=e||1,this.c=i||1,this.alpha=n||90,this.beta=r||90,this.gamma=o||90,this.spacegroup=a||"P 1";var c=Dn(this.alpha),u=Dn(this.beta),h=Dn(this.gamma),l=Math.cos(c),d=Math.cos(u),f=Math.cos(h),p=Math.sin(u),m=Math.sin(h);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-l*l-d*d-f*f+2*l*d*f),void 0===s){var g=this.a*this.b*m/this.volume,v=(d*f-l)/(p*m);this.fracToCart=(new O).set(this.a,0,0,0,this.b*f,this.b*m,0,0,this.c*d,-this.c*p*v,1/g,0,0,0,0,1).transpose(),this.cartToFrac=(new O).getInverse(this.fracToCart)}else this.cartToFrac=s,this.fracToCart=(new O).getInverse(this.cartToFrac)}function Ec(t,e){Cc.call(this,t,e)}function Ic(t){switch(t=t.toLowerCase()){case"polymer":return im;case"non-polymer":return nm;case"macrolide":return rm;case"water":return om;default:return em}}function Lc(t,e,i,n,r){this.structure=t,this.index=e,this.description=i||"",this.entityType=Ic(n||""),this.chainIndexList=r||[],r.forEach(function(i){t.chainStore.entityIndex[i]=e})}function Rc(t,e){Cc.call(this,t,e)}function Oc(t,e){Cc.call(this,t,e)}function Dc(t,e){Array.isArray(t[e])||Object.keys(t).forEach(function(e){t[e]=[t[e]]})}function Nc(t){return"?"!==t}function kc(t,e){return Nc(t)?t:e}function Fc(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}function zc(t,e,i){var n,r,o=e.atomStore,a=e.atomMap,s=t.chem_comp,c=t.chem_comp_atom,u=t.chem_comp_bond;s&&(s.name&&(e.title=s.name.trim().replace(fy,"")),s.id&&(e.id=s.id.trim().replace(fy,"")));var h={};if(c){var l,d,f,p;for(r=c.comp_id.length,n=0;n0){o=o.split("(");var c=s(o[0]),u=s(o[1]);Object.keys(c).forEach(function(t){Object.keys(u).forEach(function(e){var i=new O;i.multiplyMatrices(c[t],u[e]),n[t+"x"+e]=i})})}else n=s(o);var h=[];for(var l in n)h.push(n[l]);var d=t;/^(0|[1-9][0-9]*)$/.test(d)&&(d="BU"+d);for(var f=a.asym_id_list[e].split(","),p=0,m=f.length;p_){var S=w;w=_,_=S;var A=p;p=b,b=A}if(0!==w&&0!==_)for(var M=0;M<_;++M)o.index=p[M%w],a.index=b[M],o&&a?e.bondStore.addBond(o,a,Fc(n.pdbx_value_order[c])):Pv.log("atoms for connection not found");else Pv.warn("no atoms found for",f,y)}}}}function $c(t,e,i){if(t.entity){Dc(t.entity,"id");for(var n=t.entity,r=n.id.length,o=0;oo&&++s;e=new Int32Array(s)}for(i=0,n=0;in){for(var r=[],o=0;o>>16&65535|0,a=0;0!==i;){a=i>2e3?2e3:i,i-=a;do r=r+e[n++]|0,o=o+r|0;while(--a);r%=65521,o%=65521}return r|o<<16|0}function zu(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}function Bu(t,e,i,n){var r=xy,o=n+i;t^=-1;for(var a=n;a>>8^r[255&(t^e[a])];return t^-1}function Uu(t,e){var i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v,y,b,x,w,_,S,A,M,P;i=t.state,n=t.next_in,M=t.input,r=n+(t.avail_in-5),o=t.next_out,P=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),c=i.dmax,u=i.wsize,h=i.whave,l=i.wnext,d=i.window,f=i.hold,p=i.bits,m=i.lencode,g=i.distcode,v=(1<>>24,f>>>=x,p-=x,x=b>>>16&255,0===x)P[o++]=65535&b;else{if(!(16&x)){if(0===(64&x)){b=m[(65535&b)+(f&(1<>>=x,p-=x),p<15&&(f+=M[n++]<>>24,f>>>=x,p-=x,x=b>>>16&255,!(16&x)){if(0===(64&x)){b=g[(65535&b)+(f&(1<c){t.msg="invalid distance too far back",i.mode=wy;break t}if(f>>>=x,p-=x,x=o-a,_>x){if(x=_-x,x>h&&i.sane){t.msg="invalid distance too far back",i.mode=wy;break t}if(S=0,A=d,0===l){if(S+=u-x,x2;)P[o++]=A[S++],P[o++]=A[S++],P[o++]=A[S++],w-=3;w&&(P[o++]=A[S++],w>1&&(P[o++]=A[S++]))}else{S=o-_;do P[o++]=P[S++],P[o++]=P[S++],P[o++]=P[S++],w-=3;while(w>2);w&&(P[o++]=P[S++],w>1&&(P[o++]=P[S++]))}break}}break}}while(n>3,n-=w,p-=w<<3,f&=(1<=1&&0===I[w];w--);if(_>w&&(_=w),0===w)return r[o++]=20971520,r[o++]=20971520,s.bits=1,0;for(x=1;x0&&(t===Py||1!==w))return-1;for(L[1]=0,y=1;yAy||t===Ty&&P>My)return 1;for(var D=0;;){D++,p=y-A,a[b]f?(m=R[O+a[b]],g=T[E+a[b]]):(m=96,g=0),c=1<>A)+u]=p<<24|m<<16|g|0;while(0!==u);for(c=1<>=1;if(0!==c?(C&=c-1,C+=c):C=0,b++,0===--I[y]){if(y===w)break;y=e[i+a[b]]}if(y>_&&(C&l)!==h){for(0===A&&(A=_),d+=x,S=y-A,M=1<Ay||t===Ty&&P>My)return 1;h=C&l,r[h]=_<<24|S<<16|d-o|0}}return 0!==C&&(r[d+C]=y-A<<24|64<<16|0),s.bits=_,0}function $u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function Vu(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Gu(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Xy,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Mb),e.distcode=e.distdyn=new Int32Array(Pb),e.sane=1,e.back=-1,By):$y}function Hu(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,Gu(t)):$y}function Wu(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?$y:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,Hu(t))):$y}function Xu(t,e){var i,n;return t?(n=new Vu,t.state=n,n.window=null,i=Wu(t,e),i!==By&&(t.state=null),i):$y}function qu(t){if(Cb){var e;for(yy=new Int32Array(512),by=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ju(Dy,t.lens,0,288,yy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ju(Ny,t.lens,0,32,by,0,t.work,{bits:5}),Cb=!1}t.lencode=yy,t.lenbits=9,t.distcode=by,t.distbits=5}function Yu(t,e,i,n){var r,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(Nu(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>n&&(r=n),Nu(o.window,e,i-n,r,o.wnext),n-=r,n?(Nu(o.window,e,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=Bu(i.check,C,2,0),u=0,h=0,i.mode=qy;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",i.mode=_b;break}if((15&u)!==Wy){t.msg="unknown compression method",i.mode=_b;break}if(u>>>=4,h-=4,_=(15&u)+8,0===i.wbits)i.wbits=_;else if(_>i.wbits){t.msg="invalid window size",i.mode=_b;break}i.dmax=1<<_,t.adler=i.check=1,i.mode=512&u?ib:rb,u=0,h=0;break;case qy:for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=Bu(i.check,C,2,0)),u=0,h=0,i.mode=Yy;case Yy:for(;h<32;){if(0===s)break t;s--,u+=n[o++]<>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=Bu(i.check,C,4,0)),u=0,h=0,i.mode=Zy;case Zy:for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=Bu(i.check,C,2,0)),u=0,h=0,i.mode=Ky;case Ky:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>>8&255,i.check=Bu(i.check,C,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=Qy;case Qy:if(1024&i.flags&&(f=i.length,f>s&&(f=s),f&&(i.head&&(_=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),Nu(i.head.extra,n,o,f,_)),512&i.flags&&(i.check=Bu(i.check,n,f,o)),s-=f,o+=f,i.length-=f),i.length))break t;i.length=0,i.mode=Jy;case Jy:if(2048&i.flags){if(0===s)break t;f=0;do _=n[o+f++],i.head&&_&&i.length<65536&&(i.head.name+=String.fromCharCode(_));while(_&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=rb;break;case ib:for(;h<32;){if(0===s)break t;s--,u+=n[o++]<>>=7&h,h-=7&h,i.mode=bb;break}for(;h<3;){if(0===s)break t;s--,u+=n[o++]<>>=1,h-=1,3&u){case 0:i.mode=ab;break;case 1:if(qu(i),i.mode=db,e===zy){u>>>=2,h-=2;break t}break;case 2:i.mode=ub;break;case 3:t.msg="invalid block type",i.mode=_b}u>>>=2,h-=2;break;case ab:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=n[o++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=_b;break}if(i.length=65535&u,u=0,h=0,i.mode=sb,e===zy)break t;case sb:i.mode=cb;case cb:if(f=i.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break t;Nu(r,n,o,f,a),s-=f,o+=f,c-=f,a+=f,i.length-=f;break}i.mode=rb;break;case ub:for(;h<14;){if(0===s)break t;s--,u+=n[o++]<>>=5,h-=5,i.ndist=(31&u)+1,u>>>=5,h-=5,i.ncode=(15&u)+4,u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=_b;break}i.have=0,i.mode=hb;case hb:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=ju(Oy,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=_b;break}i.have=0,i.mode=lb;case lb:for(;i.have>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=_b;break}_=i.lens[i.have-1],f=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h>>=g,h-=g,_=0,f=3+(7&u),u>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,_=0,f=11+(127&u),u>>>=7,h-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=_b;break}for(;f--;)i.lens[i.have++]=_}}if(i.mode===_b)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=_b;break}if(i.lenbits=9,A={bits:i.lenbits},S=ju(Dy,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=_b;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=ju(Ny,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=_b;break}if(i.mode=db,e===zy)break t;case db:i.mode=fb;case fb:if(s>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,Uu(t,d),a=t.next_out,r=t.output,c=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,u=i.hold,h=i.bits,i.mode===rb&&(i.back=-1);break}for(i.back=0;P=i.lencode[u&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=yb;break}if(32&v){i.back=-1,i.mode=rb;break}if(64&v){t.msg="invalid literal/length code",i.mode=_b;break}i.extra=15&v,i.mode=pb;case pb:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=mb;case mb:for(;P=i.distcode[u&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=_b;break}i.offset=y,i.extra=15&v,i.mode=gb;case gb:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=_b;break}i.mode=vb;case vb:if(0===c)break t;if(f=d-c,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=_b;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),m=i.window}else m=r,p=a-i.offset,f=i.length;f>c&&(f=c),c-=f,i.length-=f;do r[a++]=m[p++];while(--f);0===i.length&&(i.mode=fb);break;case yb:if(0===c)break t;r[a++]=i.length,c--,i.mode=fb;break;case bb:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=n[o++]<>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}function eh(t,e){if(e<65537&&(t.subarray&&Eb||!t.subarray&&Tb))return String.fromCharCode.apply(null,Du(t,e));for(var i="",n=0;n4)s[n++]=65533,i+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&i1?s[n++]=65533:r<65536?s[n++]=r:(r-=65536,s[n++]=55296|r>>10&1023,s[n++]=56320|1023&r)}return eh(s,n)}function rh(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128===(192&t[i]);)i--;return i<0?e:0===i?e:i+Ib[t[i]]>e?i:e}function oh(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function ah(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function sh(t){if(!(this instanceof sh))return new sh(t);this.options=Ou({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new oh,this.strm.avail_out=0;var i=Xu(this.strm,e.windowBits);if(i!==Nb)throw new Error(Bb[i]);this.header=new ah,Qu(this.strm,this.header)}function ch(t,e){var i=new sh(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}function uh(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=ch(t)}catch(i){e=t}return e}function hh(){this.getUrl=function(t){var e,i=y(t),n=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||i.compressed!==!1&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?Gb+n:Vb+n:i.ext?(Pv.warn("unsupported ext",i.ext),e=Vb+n):e=Vb+n:e=jb+i.path,f()+e},this.getExt=function(t){var e=y(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}}function lh(){this.getUrl=function(t){var e,i=y(t),n=i.name;return i.ext&&"sdf"!==i.ext?(Pv.warn("unsupported ext",i.ext),e=Hb+n+Wb):e=Hb+n+Wb,f()+e},this.getExt=function(t){var e=y(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}function dh(){this.getUrl=function(t){return t}}function fh(t){t=t||"",this.getUrl=function(e){var i=y(e);return m(t+i.path)}}"undefined"!=typeof window&&!function(){window.console=window.console||{};for(var t,e,i=window.console,n={},r=function(){},o="memory".split(","),a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=o.pop();)i[t]||(i[t]=n);for(;e=a.pop();)i[e]||(i[e]=r)}(),"undefined"==typeof HTMLCanvasElement||HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,i){for(var n=window.atob(this.toDataURL(e,i).split(",")[1]),r=n.length,o=r>>2,a=new Uint8Array(r),s=new Uint32Array(a.buffer,0,o),c=0,u=0;c-9007199254740992&&t<9007199254740992&&Math.floor(t)===t}),Number.isNaN||(Number.isNaN=function(t){return t!==t}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e,i=Object(t),n=!1,r=1;r1?arguments[1]:void 0,s=a?Number(a):0;s!=s&&(s=0);var c=Math.min(Math.max(s,0),n);if(o+c>n)return!1;for(var u=-1;++ui.length)&&(e=i.length),e-=t.length;var n=i.indexOf(t,e);return n!==-1&&n===e}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&this.indexOf(t,e)!==-1}),Array.prototype.includes||(Array.prototype.includes=function(t){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),i=parseInt(e.length,10)||0;if(0===i)return!1;var n,r=parseInt(arguments[1],10)||0;r>=0?n=r:(n=i+r,n<0&&(n=0));for(var o;n0?1:-1)*Math.floor(Math.abs(e)):e},n=Math.pow(2,53)-1,r=function(t){var e=i(t);return Math.min(Math.max(e,0),n)};return function(t){var i=this,n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,a=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var s,c=r(n.length),u=e(i)?Object(new i(c)):new Array(c),h=0;he?1:0}return function(e,i,n){var r=0,o=e.length-1;for(n||(n=t);r<=o;){var a=r+o>>1,s=n(i,e[a]);if(s>0)r=a+1;else{if(!(s<0))return a;o=a-1}}return-r-1}}();void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ed.DEG2RAD},radToDeg:function(t){return t*Ed.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}};I.prototype={constructor:I,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new I,e=new I),t.set(i,i),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}},L.DEFAULT_IMAGE=void 0,L.DEFAULT_MAPPING=vl,L.prototype={constructor:L,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Ed.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:e(n)}),i.image=n.uuid}return t.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===vl){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case Ml:t.x=t.x-Math.floor(t.x);break;case Pl:t.x=t.x<0?0:1;break;case Cl:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Ml:t.y=t.y-Math.floor(t.y);break;case Pl:t.y=t.y<0?0:1;break;case Cl:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(L.prototype,E.prototype);var Id=0;O.prototype={constructor:O,isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,c,u,h,l,d,f,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=h,g[14]=l,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new O).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new N);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*a,i[9]=n[9]*a,i[10]=n[10]*a,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),c=Math.sin(n),u=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){var l=o*u,d=o*h,f=a*u,p=a*h;e[0]=s*u,e[4]=-s*h,e[8]=c,e[1]=d+f*c,e[5]=l-p*c,e[9]=-a*s,e[2]=p-l*c,e[6]=f+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var l=o*u,d=o*h,f=a*u,p=a*h;e[0]=s*u,e[4]=f*c-d,e[8]=l*c+p,e[1]=s*h,e[5]=p*c+l,e[9]=d*c-f,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*c,w=a*s,_=a*c;e[0]=s*u,e[4]=_-b*h,e[8]=w*h+x,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=x*h+w,e[10]=b-_*h}else if("XZY"===t.order){var b=o*s,x=o*c,w=a*s,_=a*c;e[0]=s*u,e[4]=-h,e[8]=c*u,e[1]=b*h+_,e[5]=o*u,e[9]=x*h-w,e[2]=w*h-x,e[6]=a*u,e[10]=_*h+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z,o=t.w,a=i+i,s=n+n,c=r+r,u=i*a,h=i*s,l=i*c,d=n*s,f=n*c,p=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+p),e[4]=h-v,e[8]=l+g,e[1]=h+v,e[5]=1-(u+p),e[9]=f-m,e[2]=l-g,e[6]=f+m,e[10]=1-(u+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,i;return function(n,r,o){void 0===t&&(t=new N,e=new N,i=new N);var a=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(o,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(o,i).normalize()),e.crossVectors(i,t),a[0]=t.x,a[4]=e.x,a[8]=i.x,a[1]=t.y,a[5]=e.y,a[9]=i.y,a[2]=t.z,a[6]=e.z,a[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],u=i[1],h=i[5],l=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],b=i[11],x=i[15],w=n[0],_=n[4],S=n[8],A=n[12],M=n[1],P=n[5],C=n[9],T=n[13],E=n[2],I=n[6],L=n[10],R=n[14],O=n[3],D=n[7],N=n[11],k=n[15];return r[0]=o*w+a*M+s*E+c*O,r[4]=o*_+a*P+s*I+c*D,r[8]=o*S+a*C+s*L+c*N,r[12]=o*A+a*T+s*R+c*k,r[1]=u*w+h*M+l*E+d*O,r[5]=u*_+h*P+l*I+d*D,r[9]=u*S+h*C+l*L+d*N,r[13]=u*A+h*T+l*R+d*k,r[2]=f*w+p*M+m*E+g*O,r[6]=f*_+p*P+m*I+g*D,r[10]=f*S+p*C+m*L+g*N,r[14]=f*A+p*T+m*R+g*k,r[3]=v*w+y*M+b*E+x*O,r[7]=v*_+y*P+b*I+x*D,r[11]=v*S+y*C+b*L+x*N,r[15]=v*A+y*T+b*R+x*k,this},multiplyToArray:function(t,e,i){var n=this.elements;return this.multiplyMatrices(t,e),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new N),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-u)*e,this._z=(a-r)*e):n>s&&n>l?(e=2*Math.sqrt(1+n-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+u)/e):s>l?(e=2*Math.sqrt(1+s-n-l),this._w=(o-u)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-n-s),this._w=(a-r)/e,this._x=(o+u)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,i=1e-6;return function(n,r){return void 0===t&&(t=new N),e=n.dot(r)+1,eMath.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=i*u+o*a+n*c-r*s,this._y=n*u+o*s+r*a-i*c,this._z=r*u+o*c+i*s-n*a,this._w=o*u-i*a-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=o*u+this._w*h,this._x=i*u+this._x*h,this._y=n*u+this._y*h,this._z=r*u+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(D,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,o,a){var s=i[n+0],c=i[n+1],u=i[n+2],h=i[n+3],l=r[o+0],d=r[o+1],f=r[o+2],p=r[o+3];if(h!==p||s!==l||c!==d||u!==f){var m=1-a,g=s*l+c*d+u*f+h*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var w=a*v;if(s=s*m+l*w,c=c*m+d*w,u=u*m+f*w,h=h*m+p*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=_,c*=_,u*=_,h*=_}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),N.prototype={constructor:N,isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new D),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new D),this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*n-a*i,u=s*i+a*e-r*n,h=s*n+r*i-o*e,l=-r*e-o*i-a*n;return this.x=c*s+l*-r+u*-a-h*-o,this.y=u*s+l*-o+h*-r-c*-a,this.z=h*s+l*-a+c*-o-u*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new O),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new O),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new N,e=new N),t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new N),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new N),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ed.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=t;t=e,e=i}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},F.prototype={constructor:F,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var i=e||new I;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){var i=e||new I;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new I;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},B.prototype=Object.create(L.prototype),B.prototype.constructor=B,B.prototype.isCubeTexture=!0,Object.defineProperty(B.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Ld=new L,Rd=new B,Od=[],Dd=[];gt.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var o=i[n];o.setValue(t,e[o.id])}};var Nd=/([\w\d_]+)(\])?(\[|\.)?/g;bt.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},bt.prototype.set=function(t,e,i){var n=this.map[i];void 0!==n&&n.setValue(t,e[i],this.renderer)},bt.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},bt.upload=function(t,e,i,n){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=i[a.id];s.needsUpdate!==!1&&a.setValue(t,s.value,n)}},bt.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var o=t[n];o.id in e&&i.push(o)}return i},bt.splitDynamic=function(t,e){for(var i=null,n=t.length,r=0,o=0;o!==n;++o){var a=t[o],s=e[a.id];s&&s.dynamic===!0?(null===i&&(i=[]),i.push(a)):(ry&&v>b?vb?y0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=e(t.textures),o=e(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(At.prototype,E.prototype);var kd=0,Fd={merge:function(t){for(var e={},i=0;i>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=Ed.euclideanModulo(e,1),i=Ed.clamp(i,0,1),n=Ed.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,o=2*n-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=i[1],h=u.length;if(3===h)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=Fp[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),u=(c+s)/2;if(c===s)e=0,i=0;else{var h=s-c;switch(i=u<=.5?h/(s+c):h/(2-s-c),s){case r:e=(o-a)/h+(or&&(r=u),h>o&&(o=h),l>a&&(a=l)}this.min.set(e,i,n),this.max.set(r,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var i=e||new N;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new N),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){var i=e||new N;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new N;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new N;return function(e){var i=e||new It;return i.center=this.center(),i.radius=.5*this.size(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new N,new N,new N,new N,new N,new N,new N,new N];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},It.prototype={constructor:It,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new Et;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).center(n);for(var r=0,o=0,a=e.length;othis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new Et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},Lt.prototype={constructor:Lt,isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=r,u[5]=s,u[6]=i,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new N),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r1))return n.copy(r).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new N;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new N,e=new Lt;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),o=n||e.getNormalMatrix(i),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},Ot.prototype={constructor:Ot,set:function(t,e,i,n,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],c=i[5],u=i[6],h=i[7],l=i[8],d=i[9],f=i[10],p=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(a-n,h-s,p-l,y-m).normalize(),e[1].setComponents(a+n,h+s,p+l,y+m).normalize(),e[2].setComponents(a+r,h+c,p+d,y+g).normalize(),e[3].setComponents(a-r,h-c,p-d,y-g).normalize(),e[4].setComponents(a-o,h-u,p-f,y-v).normalize(),e[5].setComponents(a+o,h+u,p+f,y+v).normalize(),this},intersectsObject:function(){var t=new It;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new It;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var o=e[r].distanceToPoint(i);if(o0?i.min.x:i.max.x,e.x=o.normal.x>0?i.max.x:i.min.x,t.y=o.normal.y>0?i.min.y:i.max.y,e.y=o.normal.y>0?i.max.y:i.min.y,t.z=o.normal.z>0?i.min.z:i.max.z,e.z=o.normal.z>0?i.max.z:i.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}};var Up=0;Kt.prototype={constructor:Kt,isBufferAttribute:!0,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var o=0;o0&&(n.geometries=a),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),u.length>0&&(n.images=u)}return n.object=r,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var i=0;i0)for(var f=0;f0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new It),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0];void 0===i&&(i=0),void 0!==e&&(n=(new Lt).getNormalMatrix(e));for(var l=0,d=a.length;l=0;i--){var g=f[i];for(this.faces.splice(g,1),a=0,s=this.faceVertexUvs.length;a0,_=v.vertexNormals.length>0,S=1!==v.color.r||1!==v.color.g||1!==v.color.b,A=v.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,y),M=t(M,2,b),M=t(M,3,x),M=t(M,4,w),M=t(M,5,_),M=t(M,6,S),M=t(M,7,A),h.push(M),h.push(v.a,v.b,v.c),h.push(v.materialIndex),x){var P=this.faceVertexUvs[0][c];h.push(n(P[0]),n(P[1]),n(P[2]))}if(w&&h.push(e(v.normal)),_){var C=v.vertexNormals;h.push(e(C[0]),e(C[1]),e(C[2]))}if(S&&h.push(i(v.color)),A){var T=v.vertexColors;h.push(i(T[0]),i(T[1]),i(T[2]))}}return r.data={},r.data.vertices=s,r.data.normals=l,f.length>0&&(r.data.colors=f),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new ae).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,i=0,n=e.length;i0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var u=0;u0){h=[];for(var u=0;u0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Kt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new Kt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Kt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Kt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=t.vertices.length>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new Kt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],l=0,d=h.length;l0){var m=new te(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new te(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Et);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new Et,e=new N;return function(){null===this.boundingSphere&&(this.boundingSphere=new It);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.center(r);for(var o=0,a=0,s=n.length;a0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new ue).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var o=t.groups,a=0,s=o.length;a0)if(s=d*p-f,c=d*f-p,h=l*g,s>=0)if(c>=-h)if(c<=h){var v=1/g;s*=v,c*=v,u=s*(s+d*c+2*f)+c*(d*s+c+2*p)+m}else c=l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;else c=-l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;else c<=-h?(s=Math.max(0,-(-d*l+f)),c=s>0?-l:Math.min(Math.max(-l,-p),l),u=-s*s+c*(c+2*p)+m):c<=h?(s=0,c=Math.min(Math.max(-l,-p),l),u=c*(c+2*p)+m):(s=Math.max(0,-(d*l+f)),c=s>0?l:Math.min(Math.max(-l,-p),l),u=-s*s+c*(c+2*p)+m);else c=d>0?-l:l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new N;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=n-a,c=n+a;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var i=t.normal.dot(this.direction);return i*e<0},intersectBox:function(t,e){var i,n,r,o,a,s,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,l=this.origin;return c>=0?(i=(t.min.x-l.x)*c,n=(t.max.x-l.x)*c):(i=(t.max.x-l.x)*c,n=(t.min.x-l.x)*c),u>=0?(r=(t.min.y-l.y)*u,o=(t.max.y-l.y)*u):(r=(t.max.y-l.y)*u,o=(t.min.y-l.y)*u),i>o||r>n?null:((r>i||i!==i)&&(i=r),(o=0?(a=(t.min.z-l.z)*h,s=(t.max.z-l.z)*h):(a=(t.max.z-l.z)*h,s=(t.min.z-l.z)*h),i>s||a>n?null:((a>i||i!==i)&&(i=a),(s=0?i:n,e)))},intersectsBox:function(){var t=new N;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new N,e=new N,i=new N,n=new N;return function(r,o,a,s,c){e.subVectors(o,r),i.subVectors(a,r),n.crossVectors(e,i);var u,h=this.direction.dot(n);if(h>0){if(s)return null;u=1}else{if(!(h<0))return null; +u=-1,h=-h}t.subVectors(this.origin,r);var l=u*this.direction.dot(i.crossVectors(t,i));if(l<0)return null;var d=u*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>h)return null;var f=-u*t.dot(n);return f<0?null:this.at(f/h,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},we.prototype={constructor:we,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new N;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new N;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new N;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new N,e=new N;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),a=o/r;return n&&(a=Ed.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new N;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},_e.normal=function(){var t=new N;return function(e,i,n,r){var o=r||new N;o.subVectors(n,i),t.subVectors(e,i),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),_e.barycoordFromPoint=function(){var t=new N,e=new N,i=new N;return function(n,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),i.subVectors(n,r);var c=t.dot(t),u=t.dot(e),h=t.dot(i),l=e.dot(e),d=e.dot(i),f=c*l-u*u,p=s||new N;if(0===f)return p.set(-2,-1,-1);var m=1/f,g=(l*h-u*d)*m,v=(c*d-u*h)*m;return p.set(1-g-v,v,g)}}(),_e.containsPoint=function(){var t=new N;return function(e,i,n,r){var o=_e.barycoordFromPoint(e,i,n,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),_e.prototype={constructor:_e,set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new N,e=new N;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new N;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return _e.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new Rt;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return _e.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return _e.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,o){void 0===t&&(t=new Rt,e=[new we,new we,new we],i=new N,n=new N);var a=o||new N,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)a.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;te.far?null:{distance:u,point:v.clone(),object:t}}function i(i,n,r,o,u,h,l,m){a.fromArray(o,3*h),s.fromArray(o,3*l),c.fromArray(o,3*m);var v=e(i,n,r,a,s,c,g);return v&&(u&&(d.fromArray(u,2*h),f.fromArray(u,2*l),p.fromArray(u,2*m),v.uv=t(g,a,s,c,d,f,p)),v.face=new ee(h,l,m,_e.normal(a,s,c)),v.faceIndex=h),v}var n=new O,r=new xe,o=new It,a=new N,s=new N,c=new N,u=new N,h=new N,l=new N,d=new I,f=new I,p=new I,m=new N,g=new N,v=new N;return function(m,v){var y=this.geometry,b=this.material,x=this.matrixWorld;if(void 0!==b&&(null===y.boundingSphere&&y.computeBoundingSphere(),o.copy(y.boundingSphere),o.applyMatrix4(x),m.ray.intersectsSphere(o)!==!1&&(n.getInverse(x),r.copy(m.ray).applyMatrix4(n),null===y.boundingBox||r.intersectsBox(y.boundingBox)!==!1))){var w,_;if(y&&y.isBufferGeometry){var S,A,M,P=y.index,C=y.attributes,T=C.position.array;if(void 0!==C.uv&&(w=C.uv.array),null!==P)for(var E=P.array,I=0,L=E.length;I0&&(w=B);for(var U=0,j=z.length;Ur||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ke.prototype=Object.assign(Object.create(re.prototype),{constructor:ke,copy:function(t){re.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var o=1,a=n.length;o=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;oa)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,b=g.length/3-1;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var A=s.vertices,M=A.length,y=0;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ve.prototype=Object.assign(Object.create($e.prototype),{constructor:Ve,isLineSegments:!0}),Ge.prototype=Object.create(At.prototype),Ge.prototype.constructor=Ge,Ge.prototype.isPointsMaterial=!0,Ge.prototype.copy=function(t){return At.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},He.prototype=Object.assign(Object.create(re.prototype),{constructor:He,isPoints:!0,raycast:function(){var t=new O,e=new xe,i=new It;return function(n,r){function o(t,i){var o=e.distanceSqToPoint(t);if(on.far)return;r.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:i,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,u=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,d=new N;if(s&&s.isBufferGeometry){var f=s.index,p=s.attributes,m=p.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length;v0||0===t.search(/^data\:image\/jpeg/);r.format=n?Xl:ql,r.image=i,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),ni.prototype=Object.assign(Object.create(re.prototype),{constructor:ni,isLight:!0,copy:function(t){return re.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=re.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),ri.prototype=Object.assign(Object.create(ni.prototype),{constructor:ri,isHemisphereLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(oi.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),ai.prototype=Object.assign(Object.create(oi.prototype),{constructor:ai,isSpotLightShadow:!0,update:function(t){var e=2*Ed.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||500,r=this.camera;e===r.fov&&i===r.aspect&&n===r.far||(r.fov=e,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),si.prototype=Object.assign(Object.create(ni.prototype),{constructor:si,isSpotLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ci.prototype=Object.assign(Object.create(ni.prototype),{constructor:ci,isPointLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),ui.prototype=Object.assign(Object.create(oi.prototype),{constructor:ui}),hi.prototype=Object.assign(Object.create(ni.prototype),{constructor:hi,isDirectionalLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),li.prototype=Object.assign(Object.create(ni.prototype),{constructor:li,isAmbientLight:!0});var Hp={arraySlice:function(t,e,i){return Hp.isTypedArray(t)?new t.constructor(t.subarray(e,i)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a)){do a=o[n],void 0!==a&&(e.push(o.time),i.push.apply(i,a)),o=t[r++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[n],void 0!==a&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++];while(void 0!==o)}else do a=o[n],void 0!==a&&(e.push(o.time),i.push(a)),o=t[r++];while(void 0!==o)}}};di.prototype={constructor:di,evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var o;i:{n:if(!(t=r)break t;var s=e[1];t=r)break e}o=i,i=0}}for(;i>>1;te;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=Hp.arraySlice(i,r,o),this.values=Hp.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==n&&Hp.isTypedArray(n))for(var a=0,c=n.length;a!==c;++a){var u=n[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=1,r=1,o=t.length-1;r<=o;++r){var a=!1,s=t[r],c=t[r+1];if(s!==c&&(1!==r||s!==s[0]))for(var u=r*i,h=u-i,l=u+i,d=0;d!==i;++d){var f=e[u+d];if(f!==e[h+d]||f!==e[l+d]){a=!0;break}}if(a){if(r!==n){t[n]=t[r];for(var p=r*i,m=n*i,d=0;d!==i;++d)e[m+d]=e[p+d]}++n}}return n!==t.length&&(this.times=Hp.arraySlice(t,0,n),this.values=Hp.arraySlice(e,0,n*i)),this}},vi.prototype=Object.assign(Object.create(Wp),{constructor:vi,ValueTypeName:"vector"}),yi.prototype=Object.assign(Object.create(di.prototype),{constructor:yi,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(i-e)/(n-e),u=s+a;s!==u;s+=4)D.slerpFlat(r,0,o,s-a,o,s,c);return r}}),bi.prototype=Object.assign(Object.create(Wp),{constructor:bi,ValueTypeName:"quaternion",DefaultInterpolation:dd,InterpolantFactoryMethodLinear:function(t){return new yi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),xi.prototype=Object.assign(Object.create(Wp),{constructor:xi,ValueTypeName:"number"}),wi.prototype=Object.assign(Object.create(Wp),{constructor:wi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ld,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),_i.prototype=Object.assign(Object.create(Wp),{constructor:_i,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ld,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Si.prototype=Object.assign(Object.create(Wp),{constructor:Si,ValueTypeName:"color"}),Ai.prototype=Wp,Wp.constructor=Ai,Object.assign(Ai,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Ai._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];Hp.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:Hp.convertArray(t.times,Array),values:Hp.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xi;case"vector":case"vector2":case"vector3":case"vector4":return vi;case"color":return Si;case"quaternion":return bi;case"bool":case"boolean":return _i;case"string":return wi}throw new Error("Unsupported typeName: "+t)}}),Mi.prototype={constructor:Mi,resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t1){var u=c[1],h=n[u];h||(n[u]=h=[]),h.push(s)}}var l=[];for(var u in n)l.push(Mi.CreateFromMorphTargetSequence(u,n[u],e,i));return l},parseAnimation:function(t,e,i){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,i,n,r){if(0!==i.length){var o=[],a=[];Hp.flattenJSON(i,o,a,n),0!==o.length&&r.push(new t(e,o,a))}},r=[],o=t.name||"default",a=t.length||-1,s=t.fps||30,c=t.hierarchy||[],u=0;u1?t.skinWeights[i+1]:0,s=e>2?t.skinWeights[i+2]:0,c=e>3?t.skinWeights[i+3]:0;a.skinWeights.push(new wt(r,o,s,c))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i1?t.skinIndices[i+1]:0,l=e>2?t.skinIndices[i+2]:0,d=e>3?t.skinIndices[i+3]:0;a.skinIndices.push(new wt(u,h,l,d))}a.bones=t.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&console.warn("When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match.")}function r(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=a.faces,l=t.morphColors[0].colors,i=0,n=h.length;i0&&(a.animations=e)}var a=new ae,s=void 0!==t.scale?1/t.scale:1;if(i(s),n(),r(s),o(),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:a};var c=Ti.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:a,materials:c}}}),Object.assign(Ii.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,o=new Ke(r.manager);o.load(t,function(t){r.parse(JSON.parse(t),e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,n),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,i,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new Ei,n=new Ci,r=0,o=t.length;r0){var o=new Ze(e),a=new ti(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s0?new Ue(s,c):new Ae(s,c);break;case"LOD":a=new ke;break;case"Line":a=new $e(r(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new Ve(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new He(r(e.geometry),o(e.material));break;case"Sprite":a=new Ne(o(e.material));break;case"Group":a=new We;break;default:a=new re}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var u in e.children)a.add(this.parseObject(e.children[u],i,n));if("LOD"===e.type)for(var h=e.levels,l=0;l(u-s)*(d-c)-(h-c)*(l-s))return!1;var m,g,v,y,b,x,w,_,S,A,M,P,C,T,E;for(m=l-u,g=d-h,v=s-l,y=c-d,b=u-s,x=h-c,a=0;a=-Number.EPSILON&&T>=-Number.EPSILON&&C>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,o,a,s=[],c=[],u=[];if(Xp.area(e)>0)for(o=0;o2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?u:s;if(r=o,h<=r&&(r=0),o=r+1,h<=o&&(o=0),a=o+1,h<=a&&(a=0),t(e,r,o,a,h,c)){var d,f,p,m,g;for(d=c[r],f=c[o],p=c[a],s.push([e[d],e[f],e[p]]),u.push([c[r],c[o],c[a]]),m=o,g=o+1;g2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.xNumber.EPSILON){var p;if(d>0){if(f<0||f>d)return[];if(p=u*h-c*l,p<0||p>d)return[]}else{if(f>0||f0||pM?[]:x===M?o?[]:[y]:w<=M?[y,b]:[y,S]}function o(t,e,i,n){var r=e.x-t.x,o=e.y-t.y,a=i.x-t.x,s=i.y-t.y,c=n.x-t.x,u=n.y-t.y,h=r*s-o*a,l=r*u-o*c;if(Math.abs(h)>Number.EPSILON){var d=c*s-u*a;return h>0?l>=0&&d>=0:l>=0||d>=0}return l>0}function a(t,e){function i(t,e){var i=y.length-1,n=t-1;n<0&&(n=i);var r=t+1;r>i&&(r=0);var a=o(y[t],y[n],y[r],s[e]);if(!a)return!1;var c=s.length-1,u=e-1;u<0&&(u=c);var h=e+1;return h>c&&(h=0),a=o(s[e],s[u],s[h],y[t]),!!a}function n(t,e){var i,n,o;for(i=0;i0)return!0;return!1}function a(t,i){var n,o,a,s,c;for(n=0;n0)return!0;return!1}for(var s,c,u,h,l,d,f,p,m,g,v,y=t.concat(),b=[],x=[],w=0,_=e.length;w<_;w++)b.push(w);for(var S=0,A=2*b.length;b.length>0;){if(A--,A<0){console.log("Infinite Loop! Holes left:"+b.length+", Probably Hole outside Shape!");break}for(u=S;u=0)break;x[f]=!0}if(c>=0)break}}return y}i(t),e.forEach(i);for(var s,c,u,h,l,d,f={},p=t.concat(),m=0,g=e.length;m0)){c=r;break}c=r-1}if(r=c,n[r]===i){var u=r/(o-1);return u}var h=n[r],l=n[r+1],d=l-h,f=(i-h)/d,u=(r+f)/(o-1);return u},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i),o=this.getPoint(n),a=o.clone().sub(r);return a.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)}},Li.create=function(t,e){return t.prototype=Object.create(Li.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Ri.prototype=Object.create(Li.prototype),Ri.prototype.constructor=Ri,Ri.prototype.isLineCurve=!0,Ri.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},Ri.prototype.getPointAt=function(t){return this.getPoint(t)},Ri.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},Oi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Oi,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ri(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n=e){var r=i[n]-e,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new ae,i=0,n=t.length;ie;)i-=e;ie.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],u=qp.interpolate;return new I(u(o.x,a.x,s.x,c.x,r),u(o.y,a.y,s.y,c.y,r))},ki.prototype=Object.create(Li.prototype),ki.prototype.constructor=ki,ki.prototype.getPoint=function(t){var e=Xp.b3;return new I(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},ki.prototype.getTangent=function(t){var e=qp.tangentCubicBezier;return new I(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},Fi.prototype=Object.create(Li.prototype),Fi.prototype.constructor=Fi,Fi.prototype.getPoint=function(t){var e=Xp.b2;return new I(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},Fi.prototype.getTangent=function(t){var e=qp.tangentQuadraticBezier;return new I(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var Yp=Object.assign(Object.create(Oi.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});zi.prototype=Object.create(ae.prototype),zi.prototype.constructor=zi,zi.NoTaper=function(t){return 1},zi.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},zi.FrenetFrames=function(t,e,i){function n(){f[0]=new N,p[0]=new N,o=Number.MAX_VALUE,a=Math.abs(d[0].x),s=Math.abs(d[0].y),c=Math.abs(d[0].z),a<=o&&(o=a,l.set(1,0,0)),s<=o&&(o=s,l.set(0,1,0)),c<=o&&l.set(0,0,1),m.crossVectors(d[0],l).normalize(),f[0].crossVectors(d[0],m),p[0].crossVectors(d[0],f[0])}var r,o,a,s,c,u,h,l=new N,d=[],f=[],p=[],m=new N,g=new O,v=e+1;for(this.tangents=d,this.normals=f,this.binormals=p,u=0;uNumber.EPSILON&&(m.normalize(),r=Math.acos(Ed.clamp(d[u-1].dot(d[u]),-1,1)),f[u].applyMatrix4(g.makeRotationAxis(m,r))),p[u].crossVectors(d[u],f[u]);if(i)for(r=Math.acos(Ed.clamp(f[0].dot(f[v-1]),-1,1)),r/=v-1,d[0].dot(m.crossVectors(f[0],f[v-1]))>0&&(r=-r),u=1;uNumber.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(c*c+u*u),p=e.x-s/d,m=e.y+a/d,g=i.x-u/f,v=i.y+c/f,y=((g-p)*u-(v-m)*c)/(a*u-s*c);n=p+a*y-t.x,r=m+s*y-t.y;var b=n*n+r*r;if(b<=2)return new I(n,r);o=Math.sqrt(b/2)}else{var x=!1;a>Number.EPSILON?c>Number.EPSILON&&(x=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(u)&&(x=!0),x?(n=-s,r=a,o=Math.sqrt(h)):(n=a,r=s,o=Math.sqrt(h/2))}return new I(n/o,r/o)}function r(){if(b){var t=0,e=G*t;for(X=0;X=0;){i=X,n=X-1,n<0&&(n=t.length-1);var r=0,o=w+2*y;for(r=0;r=0;z--){for(U=z/y,j=g*Math.cos(U*Math.PI/2),B=v*Math.sin(U*Math.PI/2),X=0,q=F.length;XNumber.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[r],u=-u),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var h=u*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;n=!n}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return n}var r=Xp.isClockWise,o=this.subPaths;if(0===o.length)return[];if(e===!0)return i(o);var a,s,c,u=[];if(1===o.length)return s=o[0],c=new ji,c.curves=s.curves,u.push(c),u;var h=!r(o[0].getPoints());h=t?!h:h;var l,d=[],f=[],p=[],m=0;f[m]=void 0,p[m]=[];for(var g=0,v=o.length;g1){for(var y=!1,b=[],x=0,w=f.length;x0&&(y||(p=d))}for(var C,g=0,T=f.length;g0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[i+o]},_slerp:function(t,e,i,n,r){D.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}}},tn.prototype={constructor:tn,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=tn.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var o=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a0)for(var c=this._interpolants,u=this._propertyBindings,h=0,l=c.length;h!==l;++h)c[h].evaluate(a),u[h].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===cd){r===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=n===hd;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var a=Math.floor(e/i);e-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=md,n.endingEnd=md):(t?n.endingStart=this.zeroSlopeAtStart?md:pd:n.endingStart=gd,e?n.endingEnd=this.zeroSlopeAtEnd?md:pd:n.endingEnd=gd)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=i,this}},Object.assign(nn.prototype,E.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Mi.findByName(i,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[n];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var u=new en(this,r,e);return this._bindAction(u,s),this._addInactiveAction(u,o,n),u},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Mi.findByName(i,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==i;++a){var s=e[a];s.enabled&&s._update(n,t,r,o)}for(var c=this._bindings,u=this._nActiveBindings,a=0;a!==u;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var u=c._cacheIndex,h=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,e[u]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,o=r[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var c in s){var u=s[c];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(nn.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,a=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var h=0;h!==r;++h){var l=n[h],d=l.name,f=u[d];if(void 0!==f)o[h]=f;else{if(f=o[h],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=e&&e._propertyBindings[h].binding.parsedPath;f=new Ji(tn.create(i,d,p),l.ValueTypeName,l.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,d),o[h]=f}a[h].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),bn.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},bn.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},xn.prototype=Object.create(ae.prototype),xn.prototype.constructor=xn,wn.prototype=Object.create(xn.prototype),wn.prototype.constructor=wn,_n.prototype=Object.create(ue.prototype),_n.prototype.constructor=_n,Sn.prototype=Object.create(ue.prototype),Sn.prototype.constructor=Sn,An.prototype=Object.create(ue.prototype),An.prototype.constructor=An,Mn.prototype=Object.create(ae.prototype),Mn.prototype.constructor=Mn,Pn.prototype=Object.create(ue.prototype),Pn.prototype.constructor=Pn,Cn.prototype=Object.create(ae.prototype),Cn.prototype.constructor=Cn,Tn.prototype=Object.create(ue.prototype),Tn.prototype.constructor=Tn,En.prototype=Object.create(ue.prototype),En.prototype.constructor=En;(function(){function t(){}var e=new N,i=new t,n=new t,r=new t;return t.prototype.init=function(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n},t.prototype.initNonuniformCatmullRom=function(t,e,i,n,r,o,a){var s=(e-t)/r-(i-t)/(r+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+a)+(n-i)/a;s*=o,c*=o,this.init(e,i,s,c)},t.prototype.initCatmullRom=function(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))},t.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},Li.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s,c,u=this.points;c=u.length,c<2&&console.log("duh, you need at least 2 points"),o=(c-(this.closed?0:1))*t,a=Math.floor(o),s=o-a,this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/u.length)+1)*u.length:0===s&&a===c-1&&(a=c-2,s=1);var h,l,d,f;if(this.closed||a>0?h=u[(a-1)%c]:(e.subVectors(u[0],u[1]).add(u[0]),h=e),l=u[a%c],d=u[(a+1)%c],this.closed||a+2e.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],u=qp.interpolate;return new N(u(o.x,a.x,s.x,c.x,r),u(o.y,a.y,s.y,c.y,r),u(o.z,a.z,s.z,c.z,r))}),Li.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(t){var e=Xp.b3;return new N(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),Li.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(t){var e=Xp.b2;return new N(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),Li.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new N;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e});Object.defineProperty(t,"AudioContext",{get:function(){return t.getAudioContext()}}),In.prototype={active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,i),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},Rn.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(t,e,i,n){var r,o=this._indexOfListener(t,i);if(o!==-1){if(r=this._bindings[o],r.isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else r=new In(this,t,e,i,n),this._addBinding(r);return this.memorize&&this._prevParams&&r.execute(this._prevParams),r},_addBinding:function(t){var e=this._bindings.length;do--e;while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){for(var i,n=this._bindings.length;n--;)if(i=this._bindings[n],i._listener===t&&i.context===e)return n;return-1},has:function(t,e){return this._indexOfListener(t,e)!==-1},add:function(t,e,i){return Ln(t,"add"),this._registerListener(t,!1,e,i)},addOnce:function(t,e,i){return Ln(t,"addOnce"),this._registerListener(t,!0,e,i)},remove:function(t,e){Ln(t,"remove");var i=this._indexOfListener(t,e);return i!==-1&&(this._bindings[i]._destroy(),this._bindings.splice(i,1)),t},removeAll:function(){for(var t=this._bindings.length;t--;)this._bindings[t]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(t){if(this.active){var e,i=Array.prototype.slice.call(arguments),n=this._bindings.length;if(this.memorize&&(this._prevParams=i),n){e=this._bindings.slice(),this._shouldPropagate=!0;do n--;while(e[n]&&this._shouldPropagate&&e[n].execute(i)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var Jp={PROTEIN:1,NUCLEIC:2,RNA:3,DNA:4,POLYMER:5,WATER:6,HELIX:7,SHEET:8,BACKBONE:9,SIDECHAIN:10,ALL:11,HETERO:12,ION:13,SACCHARIDE:14};On.prototype={constructor:On,type:"selection",setString:function(t,e){if(void 0===t&&(t=this.string||""),t!==this.string){try{this.parse(t)}catch(t){this.selection={error:t.message}}this.string=t,this.test=this.makeAtomTest(),this.residueTest=this.makeResidueTest(),this.chainTest=this.makeChainTest(),this.modelTest=this.makeModelTest(),this.atomOnlyTest=this.makeAtomTest(!0),this.residueOnlyTest=this.makeResidueTest(!0),this.chainOnlyTest=this.makeChainTest(!0),this.modelOnlyTest=this.makeModelTest(!0),e||this.signals.stringChanged.dispatch(this.string)}},parse:function(t){if(this.selection={operator:void 0,rules:[]},t){var e,i,n=this,r=this.selection,o=[];t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").trim(),"("===t.charAt(0)&&")"===t.substr(-1)&&(t=t.slice(1,-1).trim());var a,s,c,u,h,l,d,f,p,m,g=t.split(/\s+/),v=["*","","ALL"],y=function(t){e={operator:t,rules:[]},void 0===r?(r=e,n.selection=e):(r.rules.push(e),o.push(r),r=e)},b=function(t){i=r,r=o.pop(),void 0===r&&(y(t),x(i))},x=function(t){r.rules.push(t)};for(c=0;c0)if("NOT"===a.toUpperCase())u=1;else if(1===u)u=2;else{if(2!==u)throw new Error("something went wrong with 'not'");u=!1,b()}if("AND"!==a.toUpperCase())if("OR"!==a.toUpperCase())if("NOT"!==a.toUpperCase())if(s={},"HETERO"!==a.toUpperCase())if("WATER"!==a.toUpperCase())if("PROTEIN"!==a.toUpperCase())if("NUCLEIC"!==a.toUpperCase())if("RNA"!==a.toUpperCase())if("DNA"!==a.toUpperCase())if("POLYMER"!==a.toUpperCase())if("ION"!==a.toUpperCase())if("SACCHARIDE"!==a.toUpperCase()&&"SUGAR"!==a.toUpperCase())if("HYDROGEN"!==a.toUpperCase())if("SMALL"!==a.toUpperCase())if("NUCLEOPHILIC"!==a.toUpperCase())if("HYDROPHOBIC"!==a.toUpperCase())if("AROMATIC"!==a.toUpperCase())if("AMIDE"!==a.toUpperCase())if("ACIDIC"!==a.toUpperCase())if("BASIC"!==a.toUpperCase())if("CHARGED"!==a.toUpperCase())if("POLAR"!==a.toUpperCase())if("NONPOLAR"!==a.toUpperCase())if("HELIX"!==a.toUpperCase())if("SHEET"!==a.toUpperCase())if("TURN"!==a.toUpperCase())if("BACKBONE"!==a.toUpperCase())if("SIDECHAIN"!==a.toUpperCase())if("SIDECHAINATTACHED"!==a.toUpperCase())if(v.indexOf(a.toUpperCase())===-1)if("@"!==a.charAt(0))if("#"!==a.charAt(0))if("["!==a[0]||"]"!==a[a.length-1])if(a.length>=1&&a.length<=4&&"^"!==a[0]&&":"!==a[0]&&"."!==a[0]&&"%"!==a[0]&&"/"!==a[0]&&isNaN(parseInt(a)))s.resname=a.toUpperCase(),x(s);else{if(s={operator:"AND",rules:[]},d=a.split("/"),d.length>1&&d[1]){if(isNaN(parseInt(d[1])))throw new Error("model must be an integer");s.rules.push({model:parseInt(d[1])})}if(p=d[0].split("%"),p.length>1&&s.rules.push({altloc:p[1]}),h=p[0].split("."),h.length>1&&h[1]){if(h[1].length>4)throw new Error("atomname must be one to four characters");s.rules.push({atomname:h[1].substring(0,4).toUpperCase()})}if(l=h[0].split(":"),l.length>1&&l[1]&&s.rules.push({chainname:l[1]}),m=l[0].split("^"),m.length>1&&s.rules.push({inscode:m[1]}),m[0]){var w,_;if("-"===m[0][0]&&(m[0]=m[0].substr(1),w=!0),m[0].includes("--")&&(m[0]=m[0].replace("--","-"),_=!0),f=m[0].split("-"),1===f.length){if(f=parseInt(f[0]),isNaN(f))throw new Error("resi must be an integer");w&&(f*=-1),s.rules.push({resno:f})}else{if(2!==f.length)throw new Error("resi range must contain one '-'");w&&(f[0]*=-1),_&&(f[1]*=-1),s.rules.push({resno:[parseInt(f[0]),parseInt(f[1])]})}}if(1===s.rules.length)x(s.rules[0]);else{if(!(s.rules.length>1))throw new Error("empty selection chunk");x(s)}}else s.resname=a.substr(1,a.length-2).toUpperCase(),x(s);else s.element=a.substr(1).toUpperCase(),x(s);else{for(var S=a.substr(1).split(","),A=0,M=S.length;A0?e:null},makeAtomTest:function(t){var e,i=["h","g","i"],n=["e","b"];e=t?this._filter(function(t){return void 0!==t.keyword&&t.keyword!==Jp.BACKBONE&&t.keyword!==Jp.SIDECHAIN||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||void 0!==t.sstruc))))}):this.selection;var r=function(t,e){if(void 0===e.atomname&&void 0===e.element&&void 0===e.altloc&&void 0===e.atomindex&&void 0===e.keyword&&void 0===e.inscode&&void 0===e.resname&&void 0===e.sstruc&&void 0===e.resno&&void 0===e.chainname&&void 0===e.model)return-1;if(void 0!==e.keyword){if(e.keyword===Jp.BACKBONE&&!t.isBackbone())return!1;if(e.keyword===Jp.SIDECHAIN&&!t.isSidechain())return!1;if(e.keyword===Jp.HETERO&&!t.isHetero())return!1;if(e.keyword===Jp.PROTEIN&&!t.isProtein())return!1;if(e.keyword===Jp.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===Jp.RNA&&!t.isRna())return!1;if(e.keyword===Jp.DNA&&!t.isDna())return!1;if(e.keyword===Jp.POLYMER&&!t.isPolymer())return!1;if(e.keyword===Jp.WATER&&!t.isWater())return!1;if(e.keyword===Jp.HELIX&&i.indexOf(t.sstruc)===-1)return!1;if(e.keyword===Jp.SHEET&&n.indexOf(t.sstruc)===-1)return!1;if(e.keyword===Jp.ION&&!t.isIon())return!1;if(e.keyword===Jp.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomname&&e.atomname!==t.atomname)return!1;if(void 0!==e.element&&e.element!==t.element)return!1;if(void 0!==e.altloc&&e.altloc!==t.altloc)return!1;if(void 0!==e.atomindex&&vh(e.atomindex,t.index)<0)return!1;if(void 0!==e.resname&&e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]e.atomindexLast||t.atomEndt.resno||e.resno[1]e.atomindexLast||t.atomEnde.atomindexLast||t.atomEnd>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),em=0,im=1,nm=2,rm=3,om=4,am=0,sm=1,cm=2,um=3,hm=4,lm=5,dm=6,fm=0,pm=1,mm=2,gm=3,vm=4,ym=5,bm=6,xm=["D-BETA-PEPTIDE, C-GAMMA LINKING","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-PEPTIDE COOH CARBOXY TERMINUS","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE LINKING","PEPTIDE LINKING","PEPTIDE-LIKE"],wm=["RNA OH 3 PRIME TERMINUS","RNA OH 5 PRIME TERMINUS","RNA LINKING"],_m=["DNA OH 3 PRIME TERMINUS","DNA OH 5 PRIME TERMINUS","DNA LINKING","L-DNA LINKING","L-RNA LINKING"],Sm=["D-SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE","L-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING","SACCHARIDE"],Am=["OTHER"],Mm=["NON-POLYMER"],Pm=Mm.concat(Am,Sm),Cm={H:1.1,HE:1.4,LI:1.81,BE:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,NE:1.54,NA:2.27,MG:1.73,AL:1.84,SI:2.1,P:1.8,S:1.8,CL:1.75,AR:1.88,K:2.75,CA:2.31,SC:2.3,TI:2.15,V:2.05,CR:2.05,MN:2.05,FE:2.05,CO:2,NI:2,CU:2,ZN:2.1,GA:1.87,GE:2.11,AS:1.85,SE:1.9,BR:1.83,KR:2.02,RB:3.03,SR:2.49,Y:2.4,ZR:2.3,NB:2.15,MO:2.1,TC:2.05,RU:2.05,RH:2,PD:2.05,AG:2.1,CD:2.2,IN:2.2,SN:1.93,SB:2.17,TE:2.06,I:1.98,XE:2.16,CS:3.43,BA:2.68,LA:2.5,CE:2.48,PR:2.47,ND:2.45,PM:2.43,SM:2.42,EU:2.4,GD:2.38,TB:2.37,DY:2.35,HO:2.33,ER:2.32,TM:2.3,YB:2.28,LU:2.27,HF:2.25,TA:2.2,W:2.1,RE:2.05,OS:2,IR:2,PT:2.05,AU:2.1,HG:2.05,TL:1.96,PB:2.02,BI:2.07,PO:1.97,AT:2.02,RN:2.2,FR:3.48,RA:2.83,AC:2,TH:2.4,PA:2,U:2.3,NP:2,PU:2,AM:2,CM:2,BK:2,CF:2,ES:2,FM:2,MD:2,NO:2,LR:2,RF:2,DB:2,SG:2,BH:2,HS:2,MT:2,DS:2,RG:2,CN:2,UUT:2,FL:2,UUP:2,LV:2,UUH:2},Tm=2,Em={H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69,BK:1.6,CF:1.6,ES:1.6,FM:1.6,MD:1.6,NO:1.6,LR:1.6,RF:1.6,DB:1.6,SG:1.6,BH:1.6,HS:1.6,MT:1.6,DS:1.6,RG:1.6,CN:1.6,UUT:1.6,FL:1.6,UUP:1.6,LV:1.6,UUH:1.6},Im=1.6,Lm={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},Rm=[0,0,0],Om={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",ASH:"D",GLH:"E",UNK:""},Dm=Object.keys(Om),Nm=["A","C","T","G","U"],km=["DA","DC","DT","DG","DU","TCY","MCY","5CM"],Fm=["A","G","DA","DG"],zm=["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP3","TIP4"],Bm=["118","119","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","543","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MLT","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NCO","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3","OHX"],Um=["045","0AT","0BD","0MK","0NZ","0TS","0V4","0XY","0YT","10M","147","149","14T","15L","16G","18T","18Y","1AR","1BW","1GL","1GN","1JB","1LL","1NA","1S3","26M","26Q","26R","26V","26W","26Y","27C","289","291","293","2DG","2F8","2FG","2FL","2FP","2GL","2M4","2M5","32O","34V","3CM","3DO","3DY","3FM","3LR","3MF","3MG","3SA","3ZW","46D","46M","46Z","48Z","4CQ","4GC","4NN","50A","5DI","5GF","5MM","5RP","5SA","5SP","64K","6PG","6SA","7JZ","7SA","A1Q","A2G","AAB","AAL","AAO","ABC","ABD","ABE","ABF","ABL","ACG","ACI","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AHR","AIG","ALL","ALX","AMU","AOG","AOS","ARA","ARB","ARE","ARI","ASG","ASO","AXP","AXR","B0D","B16","B2G","B4G","B6D","B8D","B9D","BBK","BCD","BDG","BDP","BDR","BEM","BFP","BGC","BGL","BGP","BGS","BHG","BMA","BMX","BNG","BNX","BOG","BRI","BXF","BXP","BXX","BXY","C3X","C4X","C5X","CAP","CBI","CBK","CBS","CDR","CEG","CGF","CHO","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D6G","DAF","DAG","DDA","DDB","DDL","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGS","DIG","DLF","DLG","DMU","DNO","DOM","DP5","DQQ","DQR","DR2","DR3","DR4","DRI","DSR","DT6","DVC","E4P","E5G","EAG","EBG","EBQ","EGA","EJT","EPG","ERE","ERI","F1P","F1X","F6P","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FIX","FMO","FRU","FSI","FU4","FUB","FUC","FUD","FUL","FXP","G16","G1P","G2F","G3I","G4D","G4S","G6D","G6P","G6S","GAC","GAD","GAL","GC1","GC4","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GCX","GE1","GFG","GFP","GIV","GL0","GL2","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GMH","GN1","GNX","GP1","GP4","GPH","GPM","GQ1","GQ2","GQ4","GS1","GS4","GSA","GSD","GTE","GTH","GTK","GTR","GTZ","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUP","GUZ","GYP","GYV","H2P","HDL","HMS","HS2","HSD","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","IAB","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IMK","IN1","IPT","ISL","KBG","KD2","KDA","KDM","KDO","KFN","KO1","KO2","KTU","L6S","LAG","LAI","LAK","LAO","LAT","LB2","LBT","LCN","LDY","LGC","LGU","LM2","LMT","LMU","LOG","LOX","LPK","LSM","LTM","LVZ","LXB","LXZ","M1F","M3M","M6P","M8C","MA1","MA2","MA3","MAB","MAG","MAL","MAN","MAT","MAV","MAW","MBG","MCU","MDA","MDM","MDP","MFA","MFB","MFU","MG5","MGA","MGL","MLB","MMA","MMN","MN0","MRP","MTT","MUG","MVP","MXY","N1L","N9S","NAA","NAG","NBG","NDG","NED","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGL","NGS","NGY","NHF","NM6","NM9","NTF","NTO","NTP","NXD","NYT","OPG","OPM","ORP","OX2","P3M","P53","P6P","PA5","PNA","PNG","PNW","PRP","PSJ","PSV","PTQ","QDK","QPS","QV4","R1P","R1X","R2B","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RIB","RIP","RNS","RNT","ROB","ROR","RPA","RST","RUB","RUU","RZM","S6P","S7P","SA0","SCR","SDD","SF6","SF9","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHG","SI3","SIO","SOE","SOL","SSG","SUC","SUP","SUS","T6P","T6T","TAG","TCB","TDG","TGK","TGY","TH1","TIA","TM5","TM6","TM9","TMR","TMX","TOA","TOC","TRE","TYV","UCD","UDC","VG1","X0X","X1X","X2F","X4S","X5S","X6X","XBP","XDN","XDP","XIF","XIM","XLF","XLS","XMM","XUL","XXR","XYP","XYS","YO5","Z3Q","Z6J","Z9M","ZDC","ZDM"],jm=["CA","C","N","O","O1","O2","OC1","OC2","OX1","OXT","H","H1","H2","H3","HA","BB"],$m=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],Vm={};Vm[pm]={trace:"CA",direction1:"C",direction2:["O","OC1","O1","OX1","OXT"],backboneStart:"N",backboneEnd:"C"},Vm[mm]={trace:["C4'","C4*"],direction1:["C1'","C1*"],direction2:["C3'","C3*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},Vm[gm]={trace:["C3'","C3*"],direction1:["C2'","C2*"],direction2:["O4'","O4*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},Vm[vm]={trace:["CA","BB"],backboneStart:["CA","BB"],backboneEnd:["CA","BB"]},Vm[ym]={trace:["C4'","C4*","P"],backboneStart:["C4'","C4*","P"],backboneEnd:["C4'","C4*","P"]},Vm[bm]={trace:["C3'","C3*","C2'","P"],backboneStart:["C3'","C3*","C2'","P"],backboneEnd:["C3'","C3*","C2'","P"]},Vm[fm]={};var Gm,Hm,Wm,Xm,qm,Ym,Zm,Km,Qm,Jm,tg,eg,ig,ng,rg,og,ag,sg,cg,ug,hg,lg,dg,fg,pg,mg,gg,vg,yg,bg,xg,wg,_g,Sg,Ag,Mg,Pg,Cg,Tg,Eg,Ig,Lg,Rg,Og,Dg,Ng,kg,Fg,zg,Bg,Ug,jg,$g,Vg,Gg,Hg,Wg,Xg,qg,Yg,Zg,Kg,Qg,Jg,tv,ev,iv,nv,rv,ov,av,sv,cv,uv,hv,lv,dv,fv,pv=[].slice;uv=function(){var t,e,i,n,r;for(t={},r="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,e=r.length;ni&&(t=i),t},hv=function(t){return t.length>=3?[].slice.call(t):t[0]},ug=function(t){var e;for(e in t)e<3?(t[e]<0&&(t[e]=0),t[e]>255&&(t[e]=255)):3===e&&(t[e]<0&&(t[e]=0),t[e]>1&&(t[e]=1));return t},Xm=Math.PI,rv=Math.round,dg=Math.cos,vg=Math.floor,Vg=Math.pow,Ng=Math.log,av=Math.sin,sv=Math.sqrt,ig=Math.atan2,zg=Math.max,eg=Math.abs,Zm=2*Xm,qm=Xm/3,Hm=Xm/180,Ym=180/Xm,cg=function(){return arguments[0]instanceof Gm?arguments[0]:function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,arguments,function(){})},tg=[],cg.version="1.1.1",Jm={},Km=[],Qm=!1,Gm=function(){function t(){var t,e,i,n,r,o,a,s,c;for(o=this,e=[],s=0,n=arguments.length;s3?e[3]:1]},fv=function(t){return rv(255*(t<=.00304?12.92*t:1.055*Vg(t,1/2.4)-.055))},Ig=function(t){return t>Wm.t1?t*t*t:Wm.t2*(t-Wm.t0)},Wm={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Zg=function(){var t,e,i,n,r,o,a,s;return n=hv(arguments),i=n[0],e=n[1],t=n[2],r=ev(i,e,t),o=r[0],a=r[1],s=r[2],[116*a-16,500*(o-a),200*(a-s)]},iv=function(t){return(t/=255)<=.04045?t/12.92:Vg((t+.055)/1.055,2.4)},dv=function(t){return t>Wm.t3?Vg(t,1/3):t/Wm.t2+Wm.t0},ev=function(){var t,e,i,n,r,o,a;return n=hv(arguments),i=n[0],e=n[1],t=n[2],i=iv(i),e=iv(e),t=iv(t),r=dv((.4124564*i+.3575761*e+.1804375*t)/Wm.Xn),o=dv((.2126729*i+.7151522*e+.072175*t)/Wm.Yn),a=dv((.0193339*i+.119192*e+.9503041*t)/Wm.Zn),[r,o,a]},cg.lab=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["lab"]),function(){})},Jm.lab=Eg,Gm.prototype.lab=function(){return Zg(this._rgb)},ng=function(t){var e,i,n,r,o,a,s,c,u,h,l;return t=function(){var e,i,n;for(n=[],i=0,e=t.length;i=0&&e[3]<=1?"rgb":void 0}}),yg=function(t){var e,i,n,r,o,a;if(t.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return 4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),a=parseInt(t,16),r=a>>16,n=a>>8&255,i=255&a,[r,n,i,1];if(t.match(/^#?([A-Fa-f0-9]{8})$/))return 9===t.length&&(t=t.substr(1)),a=parseInt(t,16),r=a>>24&255,n=a>>16&255,i=a>>8&255,e=rv((255&a)/255*100)/100,[r,n,i,e];if(null!=Jm.css&&(o=Jm.css(t)))return o;throw"unknown color: "+t},Wg=function(t,e){var i,n,r,o,a,s,c;return null==e&&(e="rgb"),a=t[0],r=t[1],n=t[2],i=t[3],c=a<<16|r<<8|n,s="000000"+c.toString(16),s=s.substr(s.length-6),o="0"+rv(255*i).toString(16),o=o.substr(o.length-2),"#"+function(){switch(e.toLowerCase()){case"rgba":return s+o;case"argb":return o+s;default:return s}}()},Jm.hex=function(t){return yg(t)},cg.hex=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["hex"]),function(){})},Gm.prototype.hex=function(t){return null==t&&(t="rgb"),Wg(this._rgb,t)},Km.push({p:10,test:function(t){if(1===arguments.length&&"string"===uv(t))return"hex"}}),wg=function(){var t,e,i,n,r,o,a,s,c,u,h,l,d,f;if(t=hv(arguments),r=t[0],h=t[1],a=t[2],0===h)c=n=e=255*a;else{for(f=[0,0,0],i=[0,0,0],d=a<.5?a*(1+h):a+h-a*h,l=2*a-d,r/=360,f[0]=r+1/3,f[1]=r,f[2]=r-1/3,o=s=0;s<=2;o=++s)f[o]<0&&(f[o]+=1),f[o]>1&&(f[o]-=1),6*f[o]<1?i[o]=l+6*(d-l)*f[o]:2*f[o]<1?i[o]=d:3*f[o]<2?i[o]=l+(d-l)*(2/3-f[o])*6:i[o]=l;u=[rv(255*i[0]),rv(255*i[1]),rv(255*i[2])],c=u[0],n=u[1],e=u[2]}return t.length>3?[c,n,e,t[3]]:[c,n,e]},qg=function(t,e,i){var n,r,o,a,s;return void 0!==t&&t.length>=3&&(a=t,t=a[0],e=a[1],i=a[2]),t/=255,e/=255,i/=255,o=Math.min(t,e,i),zg=Math.max(t,e,i),r=(zg+o)/2,zg===o?(s=0,n=Number.NaN):s=r<.5?(zg-o)/(zg+o):(zg-o)/(2-zg-o),t===zg?n=(e-i)/(zg-o):e===zg?n=2+(i-t)/(zg-o):i===zg&&(n=4+(t-e)/(zg-o)),n*=60,n<0&&(n+=360),[n,s,r]},cg.hsl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["hsl"]),function(){})},Jm.hsl=wg,Gm.prototype.hsl=function(){return qg(this._rgb)},_g=function(){var t,e,i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v;if(t=hv(arguments),r=t[0],m=t[1],v=t[2],v*=255,0===m)c=n=e=v;else switch(360===r&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60,o=vg(r),i=r-o,a=v*(1-m),s=v*(1-m*i),g=v*(1-m*(1-i)),o){case 0:u=[v,g,a],c=u[0],n=u[1],e=u[2];break;case 1:h=[s,v,a],c=h[0],n=h[1],e=h[2];break;case 2:l=[a,v,g],c=l[0],n=l[1],e=l[2];break;case 3:d=[a,s,v],c=d[0],n=d[1],e=d[2];break;case 4:f=[g,a,v],c=f[0],n=f[1],e=f[2];break;case 5:p=[v,a,s],c=p[0],n=p[1],e=p[2]}return c=rv(c),n=rv(n),e=rv(e),[c,n,e,t.length>3?t[3]:1]},Yg=function(){var t,e,i,n,r,o,a,s,c;return a=hv(arguments),o=a[0],i=a[1],t=a[2],r=Math.min(o,i,t),zg=Math.max(o,i,t),e=zg-r,c=zg/255,0===zg?(n=Number.NaN,s=0):(s=e/zg,o===zg&&(n=(i-t)/e),i===zg&&(n=2+(t-o)/e),t===zg&&(n=4+(o-i)/e),n*=60,n<0&&(n+=360)),[n,s,c]},cg.hsv=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["hsv"]),function(){})},Jm.hsv=_g,Gm.prototype.hsv=function(){return Yg(this._rgb)},jg=function(t){var e,i,n;return"number"===uv(t)&&t>=0&&t<=16777215?(n=t>>16,i=t>>8&255,e=255&t,[n,i,e,1]):(console.warn("unknown num color: "+t),[0,0,0,1])},Jg=function(){var t,e,i,n;return n=hv(arguments),i=n[0],e=n[1],t=n[2],(i<<16)+(e<<8)+t},cg.num=function(t){return new Gm(t,"num")},Gm.prototype.num=function(t){return null==t&&(t="rgb"),Jg(this._rgb,t)},Jm.num=jg,Km.push({p:10,test:function(t){if(1===arguments.length&&"number"===uv(t)&&t>=0&&t<=16777215)return"num"}}),fg=function(t){var e,i,n,r,o,a,s,c;if(t=t.toLowerCase(),null!=cg.colors&&cg.colors[t])return yg(cg.colors[t]);if(o=t.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(s=o.slice(1,4),r=a=0;a<=2;r=++a)s[r]=+s[r];s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(s=o.slice(1,5),r=c=0;c<=3;r=++c)s[r]=+s[r];else if(o=t.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(s=o.slice(1,4),r=e=0;e<=2;r=++e)s[r]=rv(2.55*s[r]);s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(s=o.slice(1,5),r=i=0;i<=2;r=++i)s[r]=rv(2.55*s[r]);s[3]=+s[3]}else(o=t.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=wg(n),s[3]=1):(o=t.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=wg(n),s[3]=+o[4]);return s},Hg=function(t){var e;return e=t[3]<1?"rgba":"rgb","rgb"===e?e+"("+t.slice(0,3).map(rv).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(rv).join(",")+","+t[3]+")":void 0},nv=function(t){return rv(100*t)/100},xg=function(t,e){var i;return i=e<1?"hsla":"hsl",t[0]=nv(t[0]||0),t[1]=nv(100*t[1])+"%",t[2]=nv(100*t[2])+"%","hsla"===i&&(t[3]=e),i+"("+t.join(",")+")"},Jm.css=function(t){return fg(t)},cg.css=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["css"]),function(){})},Gm.prototype.css=function(t){return null==t&&(t="rgb"),"rgb"===t.slice(0,3)?Hg(this._rgb):"hsl"===t.slice(0,3)?xg(this.hsl(),this.alpha()):void 0},Jm.named=function(t){return yg(lv[t])},Km.push({p:20,test:function(t){if(1===arguments.length&&null!=lv[t])return"named"}}),Gm.prototype.name=function(t){var e,i;arguments.length&&(lv[t]&&(this._rgb=yg(lv[t])),this._rgb[3]=1),e=this.hex();for(i in lv)if(e===lv[i])return i;return e},Lg=function(){var t,e,i,n;return n=hv(arguments),i=n[0],t=n[1],e=n[2],e*=Hm,[i,dg(e)*t,av(e)*t]},Rg=function(){var t,e,i,n,r,o,a,s,c,u,h;return i=hv(arguments),s=i[0],r=i[1],a=i[2],u=Lg(s,r,a),t=u[0],e=u[1],n=u[2],h=Eg(t,e,n),c=h[0],o=h[1],n=h[2],[Dg(c,0,255),Dg(o,0,255),Dg(n,0,255),i.length>3?i[3]:1]},Tg=function(){var t,e,i,n,r,o;return o=hv(arguments),r=o[0],t=o[1],e=o[2],i=sv(t*t+e*e),n=(ig(e,t)*Ym+360)%360,0===rv(1e4*i)&&(n=Number.NaN),[r,i,n]},Kg=function(){var t,e,i,n,r,o,a;return o=hv(arguments),r=o[0],i=o[1],e=o[2],a=Zg(r,i,e),n=a[0],t=a[1],e=a[2],Tg(n,t,e)},cg.lch=function(){var t;return t=hv(arguments),new Gm(t,"lch")},cg.hcl=function(){var t;return t=hv(arguments),new Gm(t,"hcl")},Jm.lch=Rg,Jm.hcl=function(){var t,e,i,n;return n=hv(arguments),e=n[0],t=n[1],i=n[2],Rg([i,t,e])},Gm.prototype.lch=function(){return Kg(this._rgb)},Gm.prototype.hcl=function(){return Kg(this._rgb).reverse()},Gg=function(t){var e,i,n,r,o,a,s,c,u;return null==t&&(t="rgb"),c=hv(arguments),s=c[0],r=c[1],e=c[2],s/=255,r/=255,e/=255,o=1-Math.max(s,Math.max(r,e)),n=o<1?1/(1-o):0,i=(1-s-o)*n,a=(1-r-o)*n,u=(1-e-o)*n,[i,a,u,o]},hg=function(){var t,e,i,n,r,o,a,s,c;return e=hv(arguments),n=e[0],a=e[1],c=e[2],o=e[3],t=e.length>4?e[4]:1,1===o?[0,0,0,t]:(s=n>=1?0:rv(255*(1-n)*(1-o)),r=a>=1?0:rv(255*(1-a)*(1-o)),i=c>=1?0:rv(255*(1-c)*(1-o)),[s,r,i,t])},Jm.cmyk=function(){return hg(hv(arguments))},cg.cmyk=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["cmyk"]),function(){})},Gm.prototype.cmyk=function(){return Gg(this._rgb)},Jm.gl=function(){var t,e,i,n,r;for(n=function(){var t,i;t=hv(arguments),i=[];for(e in t)r=t[e],i.push(r);return i}.apply(this,arguments),t=i=0;i<=2;t=++i)n[t]*=255;return n},cg.gl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["gl"]),function(){})},Gm.prototype.gl=function(){var t;return t=this._rgb,[t[0]/255,t[1]/255,t[2]/255,t[3]]},Qg=function(t,e,i){var n;return n=hv(arguments),t=n[0],e=n[1],i=n[2],t=kg(t),e=kg(e),i=kg(i),.2126*t+.7152*e+.0722*i},kg=function(t){return t/=255,t<=.03928?t/12.92:Vg((t+.055)/1.055,2.4)},tg=[],Sg=function(t,e,i,n){var r,o,a,s;for(null==i&&(i=.5),null==n&&(n="rgb"),"object"!==uv(t)&&(t=cg(t)),"object"!==uv(e)&&(e=cg(e)),a=0,o=tg.length;at?o(i,c):o(c,a); +},i=Qg(this._rgb),this._rgb=(i>t?o(cg("black"),this):o(this,cg("white"))).rgba()),this):Qg(this._rgb)},cv=function(t){var e,i,n,r;return r=t/100,r<66?(n=255,i=-155.25485562709179-.44596950469579133*(i=r-2)+104.49216199393888*Ng(i),e=r<20?0:-254.76935184120902+.8274096064007395*(e=r-10)+115.67994401066147*Ng(e)):(n=351.97690566805693+.114206453784165*(n=r-55)-40.25366309332127*Ng(n),i=325.4494125711974+.07943456536662342*(i=r-50)-28.0852963507957*Ng(i),e=255),ug([n,i,e])},tv=function(){var t,e,i,n,r,o,a,s,c;for(a=hv(arguments),o=a[0],i=a[1],t=a[2],r=1e3,n=4e4,e=.4;n-r>e;)c=.5*(n+r),s=cv(c),s[2]/s[0]>=t/o?n=c:r=c;return rv(c)},cg.temperature=cg.kelvin=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["temperature"]),function(){})},Jm.temperature=Jm.kelvin=Jm.K=cv,Gm.prototype.temperature=function(){return tv(this._rgb)},Gm.prototype.kelvin=Gm.prototype.temperature,cg.contrast=function(t,e){var i,n,r,o;return"string"!==(r=uv(t))&&"number"!==r||(t=new Gm(t)),"string"!==(o=uv(e))&&"number"!==o||(e=new Gm(e)),i=t.luminance(),n=e.luminance(),i>n?(i+.05)/(n+.05):(n+.05)/(i+.05)},Gm.prototype.get=function(t){var e,i,n,r,o,a;return n=this,o=t.split("."),r=o[0],e=o[1],a=n[r](),e?(i=r.indexOf(e),i>-1?a[i]:console.warn("unknown channel "+e+" in mode "+r)):a},Gm.prototype.set=function(t,e){var i,n,r,o,a,s;if(r=this,a=t.split("."),o=a[0],i=a[1],i)if(s=r[o](),n=o.indexOf(i),n>-1)if("string"===uv(e))switch(e.charAt(0)){case"+":s[n]+=+e;break;case"-":s[n]+=+e;break;case"*":s[n]*=+e.substr(1);break;case"/":s[n]/=+e.substr(1);break;default:s[n]=+e}else s[n]=e;else console.warn("unknown channel "+i+" in mode "+o);else s=e;return r._rgb=cg(s,o).alpha(r.alpha())._rgb,r},Gm.prototype.darken=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lab(),e[0]-=Wm.Kn*t,cg.lab(e).alpha(i.alpha())},Gm.prototype.brighten=function(t){return null==t&&(t=1),this.darken(-t)},Gm.prototype.darker=Gm.prototype.darken,Gm.prototype.brighter=Gm.prototype.brighten,Gm.prototype.saturate=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lch(),e[1]+=t*Wm.Kn,e[1]<0&&(e[1]=0),cg.lch(e).alpha(i.alpha())},Gm.prototype.desaturate=function(t){return null==t&&(t=1),this.saturate(-t)},Gm.prototype.premultiply=function(){var t,e;return e=this.rgb(),t=this.alpha(),cg(e[0]*t,e[1]*t,e[2]*t,t)},rg=function(t,e,i){if(!rg[i])throw"unknown blend mode "+i;return rg[i](t,e)},og=function(t){return function(e,i){var n,r;return n=cg(i).rgb(),r=cg(e).rgb(),cg(t(n,r),"rgb")}},gg=function(t){return function(e,i){var n,r,o;for(o=[],n=r=0;r<=3;n=++r)o[n]=t(e[n],i[n]);return o}},Ug=function(t,e){return t},Bg=function(t,e){return t*e/255},pg=function(t,e){return t>e?e:t},Og=function(t,e){return t>e?t:e},ov=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},$g=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},sg=function(t,e){return 255*(1-(1-e/255)/(t/255))},mg=function(t,e){return 255===t?255:(t=255*(e/255)/(1-t/255),t>255?255:t)},rg.normal=og(gg(Ug)),rg.multiply=og(gg(Bg)),rg.screen=og(gg(ov)),rg.overlay=og(gg($g)),rg.darken=og(gg(pg)),rg.lighten=og(gg(Og)),rg.dodge=og(gg(mg)),rg.burn=og(gg(sg)),cg.blend=rg,cg.analyze=function(t){var e,i,n,r;for(n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},i=0,e=t.length;in.max&&(n.max=r),n.count+=1);return n.domain=[n.min,n.max],n.limits=function(t,e){return cg.limits(n,t,e)},n},cg.scale=function(t,e){var i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v,y,b,x,w,_;return h="rgb",l=cg("#ccc"),m=0,s=!1,a=[0,1],p=[],f=[0,0],i=!1,r=[],d=!1,u=0,c=1,o=!1,n={},w=function(t){var e,i,n,o,a,s,c;if(null==t&&(t=["#fff","#000"]),null!=t&&"string"===uv(t)&&null!=(null!=(o=cg.brewer)?o[t]:void 0)&&(t=cg.brewer[t]),"array"===uv(t)){for(t=t.slice(0),e=n=0,a=t.length-1;0<=a?n<=a:n>=a;e=0<=a?++n:--n)i=t[e],"string"===uv(i)&&(t[e]=cg(i));for(p.length=0,e=c=0,s=t.length-1;0<=s?c<=s:c>=s;e=0<=s?++c:--c)p.push(e/(t.length-1))}return x(),r=t},y=function(t){var e,n;if(null!=i){for(n=i.length-1,e=0;e=i[e];)e++;return e-1}return 0},_=function(t){return t},g=function(t){var e,n,r,o,a;return a=t,i.length>2&&(o=i.length-1,e=y(t),r=i[0]+(i[1]-i[0])*(0+.5*m),n=i[o-1]+(i[o]-i[o-1])*(1-.5*m),a=u+(i[e]+.5*(i[e+1]-i[e])-r)/(n-r)*(c-u)),a},b=function(t,e){var o,a,s,d,m,g,v,b;if(null==e&&(e=!1),isNaN(t))return l;if(e?b=t:i&&i.length>2?(o=y(t),b=o/(i.length-2),b=f[0]+b*(1-f[0]-f[1])):c!==u?(b=(t-u)/(c-u),b=f[0]+b*(1-f[0]-f[1]),b=Math.min(1,Math.max(0,b))):b=1,e||(b=_(b)),d=Math.floor(1e4*b),n[d])a=n[d];else{if("array"===uv(r))for(s=m=0,v=p.length-1;0<=v?m<=v:m>=v;s=0<=v?++m:--m){if(g=p[s],b<=g){a=r[s];break}if(b>=g&&s===p.length-1){a=r[s];break}if(b>g&&b=h;e=0<=h?++l:--l)p.push(e/(n-1));return a=[u,c],v},v.mode=function(t){return arguments.length?(h=t,x(),v):h},v.range=function(t,e){return w(t,e),v},v.out=function(t){return d=t,v},v.spread=function(t){return arguments.length?(m=t,v):m},v.correctLightness=function(t){return null==t&&(t=!0),o=t,x(),_=o?function(t){var e,i,n,r,o,a,s,c,u;for(e=b(0,!0).lab()[0],i=b(1,!0).lab()[0],s=e>i,n=b(t,!0).lab()[0],o=e+(i-e)*t,r=n-o,c=0,u=1,a=20;Math.abs(r)>.01&&a-- >0;)!function(){return s&&(r*=-1),r<0?(c=t,t+=.5*(u-t)):(u=t,t+=.5*(c-t)),n=b(t,!0).lab()[0],r=n-o}();return t}:function(t){return t},v},v.padding=function(t){return null!=t?("number"===uv(t)&&(t=[t,t]),f=t,v):f},v.colors=function(){var e,n,r,o,s,c,u,h,l;if(o=0,s="hex",1===arguments.length&&("string"===uv(arguments[0])?s=arguments[0]:o=arguments[0]),2===arguments.length&&(o=arguments[0],s=arguments[1]),o)return n=a[0],e=a[1]-n,function(){u=[];for(var t=0;0<=o?to;0<=o?t++:t--)u.push(t);return u}.apply(this).map(function(t){return v(n+t/(o-1)*e)[s]()});if(t=[],h=[],i&&i.length>2)for(r=l=1,c=i.length;1<=c?lc;r=1<=c?++l:--l)h.push(.5*(i[r-1]+i[r]));else h=a;return h.map(function(t){return v(t)[s]()})},v},null==cg.scales&&(cg.scales={}),cg.scales.cool=function(){return cg.scale([cg.hsl(180,1,.9),cg.hsl(250,.7,.4)])},cg.scales.hot=function(){return cg.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},cg.analyze=function(t,e,i){var n,r,o,a,s,c,u;if(s={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},null==i&&(i=function(){return!0}),n=function(t){null==t||isNaN(t)||(s.values.push(t),s.sum+=t,ts.max&&(s.max=t),s.count+=1)},u=function(t,r){if(i(t,r))return n(null!=e&&"function"===uv(e)?e(t):null!=e&&"string"===uv(e)||"number"===uv(e)?t[e]:t)},"array"===uv(t))for(a=0,o=t.length;a=F;_=1<=F?++O:--O)M.push(C+_/i*(zg-C));M.push(zg)}else if("l"===e.substr(0,1)){if(C<=0)throw"Logarithmic scales are only possible for values > 0";for(T=Math.LOG10E*Ng(C),P=Math.LOG10E*Ng(zg),M.push(C),_=nt=1,z=i-1;1<=z?nt<=z:nt>=z;_=1<=z?++nt:--nt)M.push(Vg(10,T+_/i*(P-T)));M.push(zg)}else if("q"===e.substr(0,1)){for(M.push(C),_=n=1,G=i-1;1<=G?n<=G:n>=G;_=1<=G?++n:--n)D=it.length*_/i,N=vg(D),N===D?M.push(it[N]):(k=D-N,M.push(it[N]*k+it[N+1]*(1-k)));M.push(zg)}else if("k"===e.substr(0,1)){for(I=it.length,g=new Array(I),x=new Array(i),Q=!0,L=0,y=null,y=[],y.push(C),_=r=1,H=i-1;1<=H?r<=H:r>=H;_=1<=H?++r:--r)y.push(C+_/i*(zg-C));for(y.push(zg);Q;){for(S=o=0,W=i-1;0<=W?o<=W:o>=W;S=0<=W?++o:--o)x[S]=0;for(_=a=0,X=I-1;0<=X?a<=X:a>=X;_=0<=X?++a:--a){for(et=it[_],E=Number.MAX_VALUE,S=s=0,q=i-1;0<=q?s<=q:s>=q;S=0<=q?++s:--s)w=eg(y[S]-et),w=Y;S=0<=Y?++c:--c)R[S]=null;for(_=u=0,Z=I-1;0<=Z?u<=Z:u>=Z;_=0<=Z?++u:--u)b=g[_],null===R[b]?R[b]=it[_]:R[b]+=it[_];for(S=h=0,K=i-1;0<=K?h<=K:h>=K;S=0<=K?++h:--h)R[S]*=1/x[S];for(Q=!1,S=l=0,B=i-1;0<=B?l<=B:l>=B;S=0<=B?++l:--l)if(R[S]!==y[_]){Q=!0;break}y=R,L++,L>200&&(Q=!1)}for(A={},S=d=0,U=i-1;0<=U?d<=U:d>=U;S=0<=U?++d:--d)A[S]=[];for(_=f=0,j=I-1;0<=j?f<=j:f>=j;_=0<=j?++f:--f)b=g[_],A[b].push(it[_]);for(tt=[],S=p=0,$=i-1;0<=$?p<=$:p>=$;S=0<=$?++p:--p)tt.push(A[S][0]),tt.push(A[S][A[S].length-1]);for(tt=tt.sort(function(t,e){return t-e}),M.push(tt[0]),_=m=1,V=tt.length-1;m<=V;_=m+=2)isNaN(tt[_])||M.push(tt[_])}return M},bg=function(t,e,i){var n,r,o,a;return n=hv(arguments),t=n[0],e=n[1],i=n[2],t/=360,t<1/3?(r=(1-e)/3,a=(1+e*dg(Zm*t)/dg(qm-Zm*t))/3,o=1-(r+a)):t<2/3?(t-=1/3,a=(1-e)/3,o=(1+e*dg(Zm*t)/dg(qm-Zm*t))/3,r=1-(a+o)):(t-=2/3,o=(1-e)/3,r=(1+e*dg(Zm*t)/dg(qm-Zm*t))/3,a=1-(o+r)),a=Dg(i*a*3),o=Dg(i*o*3),r=Dg(i*r*3),[255*a,255*o,255*r,n.length>3?n[3]:1]},Xg=function(){var t,e,i,n,r,o,a,s;return a=hv(arguments),o=a[0],e=a[1],t=a[2],Zm=2*Math.PI,o/=255,e/=255,t/=255,r=Math.min(o,e,t),n=(o+e+t)/3,s=1-r/n,0===s?i=0:(i=(o-e+(o-t))/2,i/=Math.sqrt((o-e)*(o-e)+(o-t)*(e-t)),i=Math.acos(i),t>e&&(i=Zm-i),i/=Zm),[360*i,s,n]},cg.hsi=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Gm,pv.call(arguments).concat(["hsi"]),function(){})},Jm.hsi=bg,Gm.prototype.hsi=function(){return Xg(this._rgb)},Ag=function(t,e,i,n){var r,o,a,s,c,u,h,l,d,f,p,m,g;return"hsl"===n?(m=t.hsl(),g=e.hsl()):"hsv"===n?(m=t.hsv(),g=e.hsv()):"hsi"===n?(m=t.hsi(),g=e.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",m=t.hcl(),g=e.hcl()),"h"===n.substr(0,1)&&(a=m[0],f=m[1],u=m[2],s=g[0],p=g[1],h=g[2]),isNaN(a)||isNaN(s)?isNaN(a)?isNaN(s)?o=Number.NaN:(o=s,1!==u&&0!==u||"hsv"===n||(d=p)):(o=a,1!==h&&0!==h||"hsv"===n||(d=f)):(r=s>a&&s-a>180?s-(a+360):s180?s+360-a:s-a,o=a+i*r),null==d&&(d=f+i*(p-f)),c=u+i*(h-u),l=cg[n](o,d,c)},tg=tg.concat(function(){var t,e,i,n;for(i=["hsv","hsl","hsi","hcl","lch"],n=[],e=0,t=i.length;e>16&255)/255,e[i+1]=(t>>8&255)/255,e[i+2]=(255&t)/255,e},atomColor:function(){return 16777215},atomColorToArray:function(t,e,i){return this.colorToArray(this.atomColor(t),e,i)},bondColor:function(t,e){return this.atomProxy.index=e?t.atomIndex1:t.atomIndex2,this.atomColor(this.atomProxy)},bondColorToArray:function(t,e,i,n){return this.colorToArray(this.bondColor(t,e),i,n)},volumeColor:function(){return 16777215},volumeColorToArray:function(t,e,i){return this.colorToArray(this.volumeColor(t),e,i)},positionColor:function(){return 16777215},positionColorToArray:function(t,e,i){return this.colorToArray(this.positionColor(t),e,i)}},zn.prototype=Fn.prototype,zn.prototype.constructor=zn,Bn.prototype=Fn.prototype,Bn.prototype.constructor=Bn,Un.prototype=Fn.prototype,Un.prototype.constructor=Un,jn.prototype=Fn.prototype,jn.prototype.constructor=jn,$n.prototype=Fn.prototype,$n.prototype.constructor=$n,Vn.prototype=Fn.prototype,Vn.prototype.constructor=Vn,Gn.prototype=Fn.prototype,Gn.prototype.constructor=Gn,Hn.prototype=Fn.prototype,Hn.prototype.constructor=Hn,Wn.prototype=Fn.prototype,Wn.prototype.constructor=Wn,Xn.prototype=Fn.prototype,Xn.prototype.constructor=Xn,qn.prototype=Fn.prototype,qn.prototype.constructor=qn,Yn.prototype=Fn.prototype,Yn.prototype.constructor=Yn,Zn.prototype=Fn.prototype,Zn.prototype.constructor=Zn,Kn.prototype=Fn.prototype,Kn.prototype.constructor=Kn,Qn.prototype=Fn.prototype,Qn.prototype.constructor=Qn,Jn.prototype=Fn.prototype,Jn.prototype.constructor=Jn,tr.prototype=Fn.prototype,tr.prototype.constructor=tr,er.prototype=Fn.prototype,er.prototype.constructor=er,ir.prototype=Fn.prototype,ir.prototype.constructor=ir,nr.prototype=Fn.prototype,nr.prototype.constructor=nr,kn.types={"":Fn,picking:Un,random:jn,uniform:$n,atomindex:Vn,residueindex:Gn,chainindex:Hn,chainname:Wn,chainid:Xn,entityindex:qn,modelindex:Yn,entitytype:Zn,moleculetype:Kn,sstruc:Qn,element:Jn,resname:tr,bfactor:er,hydrophobicity:nr,value:Bn,volume:zn,occupancy:ir};var _v=p(),Sv="undefined"!=typeof window&&"undefined"!=typeof window.orientation,Av=!1,Mv=!1,Pv={log:Function.prototype.bind.call(console.log,console),info:Function.prototype.bind.call(console.info,console),warn:Function.prototype.bind.call(console.warn,console),error:Function.prototype.bind.call(console.error,console),time:Function.prototype.bind.call(console.time,console),timeEnd:Function.prototype.bind.call(console.timeEnd,console)};t.Debug=l(h("debug"));var Cv='

Your browser/graphics card does not seem to support WebGL.

Find out how to get it here.

',Tv=new T,Ev=new kn,Iv=new S("datasource"),Lv=new S("representatation"),Rv=new S("parser"),Ov=new S("shader"),Dv=new S("decompressor"),Nv=new S("component");sr.prototype={constructor:sr,type:"",__srcName:void 0,isBinary:function(){return this.binary||this.compressed},onload:function(){},onprogress:function(){},onerror:function(){},read:function(t){this._read(function(e){var i=Dv.get(this.compressed);this.compressed&&i?this.data=i(e):((this.binary||this.compressed)&&e instanceof ArrayBuffer&&(e=new Uint8Array(e)),this.data=e),"function"==typeof this.onload&&this.onload(this.data),t()}.bind(this))},_read:function(t){t(this.src)},_chunk:function(t,e){return e=Math.min(this.data.length,e),0===t&&this.data.length===e?this.data:this.isBinary()?this.data.subarray(t,e):this.data.substring(t,e)},chunk:function(t){var e=t+this.chunkSize;return this._chunk(t,e)},peekLines:function(t){var e,i=this.data,n=i.length,r=this.isBinary()?this.newline.charCodeAt(0):this.newline,o=0;for(e=0;en);return s.lines},lineCount:function(){console.warn("lineCount - deprecated");for(var t=this.data,e=t.length,i=this.isBinary()?this.newline.charCodeAt(0):this.newline,n=0,r=0;rthis.data.length))return this.__pointer+=this.chunkSize,this.chunk(t)},nextChunkOfLines:function(){var t=this.nextChunk();if(void 0!==t){var e=this.__pointer>this.data.length,i=this.chunkToLines(t,this.__partialLine,e);return this.__partialLine=i.partialLine,i.lines}},eachChunk:function(t){for(var e=this.chunkSize,i=this.data.length,n=this.chunkCount(),r=0;r=0),o[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o[6]?parseInt(o[6]):0);break;case"e":i=o[7]?parseFloat(i).toExponential(o[7]):parseFloat(i).toExponential();break;case"f":i=o[7]?parseFloat(i).toFixed(o[7]):parseFloat(i);break;case"g":i=o[7]?parseFloat(i).toPrecision(o[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=String(i),i=o[7]?i.substring(0,o[7]):i;break;case"t":i=String(!!i),i=o[7]?i.substring(0,o[7]):i;break;case"T":i=yr(i),i=o[7]?i.substring(0,o[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o[7]?i.substring(0,o[7]):i;break;case"x":i=parseInt(i,10).toString(16);break;case"X":i=parseInt(i,10).toString(16).toUpperCase()}kv.json.test(o[8])?d[d.length]=i:(!kv.number.test(o[8])||f&&!o[3]?p="":(p=f?"+":"-",i=i.toString().replace(kv.sign,"")),s=o[4]?"0"===o[4]?"0":o[4].charAt(1):" ",c=o[6]-(p+i).length,a=o[6]&&c>0?br(s,c):"",d[d.length]=o[5]?p+i+a:"0"===s?p+a+i:a+p+i)}return d.join("")},vr.cache={},vr.parse=function(t){for(var e=t,i=[],n=[],r=0;e;){if(null!==(i=kv.text.exec(e)))n[n.length]=i[0];else if(null!==(i=kv.modulo.exec(e)))n[n.length]="%";else{if(null===(i=kv.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(i[2]){r|=1;var o=[],a=i[2],s=[];if(null===(s=kv.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=s[1];""!==(a=a.substring(s[0].length));)if(null!==(s=kv.key_access.exec(a)))o[o.length]=s[1];else{if(null===(s=kv.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=s[1]}i[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=i}e=e.substring(i[0].length)}return n};var Fv={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};wr.prototype={clear:function(){this.change(-this.count)},change:function(t){this.count+=t,this.signals.countChanged.dispatch(t,this.count),this.count<0&&Pv.warn("Counter.count below zero",this.count)},increment:function(){this.change(1)},decrement:function(){this.change(-1)},listen:function(t){this.change(t.count),t.signals.countChanged.add(this.change,this)},unlisten:function(t){var e=t.signals.countChanged;e.has(this.change,this)&&e.remove(this.change,this)},onZeroOnce:function(t,e){if(0===this.count)t.call(e,0,0);else{var i=function(){0===this.count&&(this.signals.countChanged.remove(i,this),t.apply(e,arguments))};this.signals.countChanged.add(i,this)}},dispose:function(){this.clear(),this.signals.countChanged.dispose()}},_r.prototype={constructor:_r,getBaseObject:function(t){return"StructureView"===t.type&&(t=t.getStructure()),t},addObject:function(t){t=this.getBaseObject(t);var e=this.allocateGidRange(t);return e&&(this.objectList.push(t),this.rangeList.push(e)),this},removeObject:function(t){t=this.getBaseObject(t);var e=this.objectList.indexOf(t);return e!==-1&&(this.objectList.splice(e,1),this.rangeList.splice(e,1),0===this.objectList.length&&(this.nextGid=1)),this},updateObject:function(t,e){t=this.getBaseObject(t);var i=this.objectList.indexOf(t);if(i!==-1){var n=this.rangeList[i];if(n[1]===this.nextGid){var r=this.getGidCount(t);this.nextGid+=r-(n[1]-n[0]),n[1]=this.nextGid}else this.rangeList[i]=this.allocateGidRange(t)}else e||Pv.warn("GidPool.updateObject: object not found.");return this},getGidCount:function(t){t=this.getBaseObject(t);var e=0;return"Structure"===t.type?e=t.atomStore.count+t.bondStore.count+t.backboneBondStore.count+t.rungBondStore.count:"Volume"===t.type?e=t.__data.length:Pv.warn("GidPool.getGidCount: unknown object type"),e},allocateGidRange:function(t){t=this.getBaseObject(t);var e=this.getGidCount(t);if(e>Math.pow(10,7))return Pv.warn("GidPool.allocateGidRange: gidCount too large"),null;var i=this.nextGid;return this.nextGid+=e,this.nextGid>Math.pow(2,24)&&Pv.error("GidPool.allocateGidRange: GidPool overflown"),[i,this.nextGid]},getNextGid:function(){return this.nextGid++},getGid:function(t,e){t=this.getBaseObject(t),e=e||0;var i=0,n=this.objectList.indexOf(t);if(n!==-1){var r=this.rangeList[n],o=r[0];i=o+e}else Pv.warn("GidPool.getGid: object not found.");return i},getByGid:function(t){var e;return this.objectList.forEach(function(i,n){var r=this.rangeList[n];if(!(t=r[1])){var o=t-r[0];"Structure"===i.type?othis.prevFpsTime+1e3&&(this.lastFps=this.frames,this.prevFpsTime=t,this.frames=0),t}},Ar.prototype=Object.create(E.prototype),Ar.prototype.constructor=Ar,Ov.add("shader/chunk/dull_interior_fragment.glsl","#ifdef DULL_INTERIOR\nif( gl_FrontFacing == false ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#endif"),Ov.add("shader/chunk/fog_fragment.glsl","#ifdef USE_FOG\nfloat depth = length( vViewPosition );\n#ifdef FOG_EXP2\nfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"),Ov.add("shader/chunk/nearclip_vertex.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip - 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),Ov.add("shader/chunk/nearclip_fragment.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip )\ndiscard;\n#endif"), +Ov.add("shader/chunk/radiusclip_vertex.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius + 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),Ov.add("shader/chunk/radiusclip_fragment.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius )\ndiscard;\n#endif"),Ov.add("shader/chunk/opaque_back_fragment.glsl","#ifdef OPAQUE_BACK\n#ifdef FLIP_SIDED\nif( gl_FrontFacing == true ){\ngl_FragColor.a = 1.0;\n}\n#else\nif( gl_FrontFacing == false ){\ngl_FragColor.a = 1.0;\n}\n#endif\n#endif");var zv=/^(?!\/\/)\s*#include\s+(\S+)/gim,Bv={};Cr.prototype.constructor=Cr;var Uv=2*Math.PI,jv=(new Float32Array(4),new Float32Array(4),new N),$v=new O,Vv=new O,Gv=new O,Hv=new O;"undefined"!=typeof WebGLRenderingContext&&WebGLRenderingContext&&(WebGLRenderingContext.prototype.getShaderParameter=function(){var e=WebGLRenderingContext.prototype.getShaderParameter;return function(){return!t.Debug||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getShaderInfoLog=function(){var e=WebGLRenderingContext.prototype.getShaderInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}(),WebGLRenderingContext.prototype.getProgramParameter=function(){var e=WebGLRenderingContext.prototype.getProgramParameter;return function(i,n){return!t.Debug&&n===WebGLRenderingContext.prototype.LINK_STATUS||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getProgramInfoLog=function(){var e=WebGLRenderingContext.prototype.getProgramInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}());var Wv=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];Wv.forEach(function(t){t.forEach(function(t){t[0]*=.0625,t[1]*=.0625})}),Ur.prototype.constructor=Ur;var Xv=2,qv=3,Yv=function(e,i){function n(t){var e=Object.assign({},t);u=d(e.hoverTimeout,u)}function r(t,e){var i,n,r,o=s.pick(t.canvasPosition.x,t.canvasPosition.y),a=o.instance,u=c.getByGid(o.gid);return u&&"AtomProxy"===u.type?i=u:u&&"BondProxy"===u.type?n=u:u&&"Volume"===u.volume.type&&(r=u),(i||n||r)&&t.which===Xv&&e&&(i?l.copy(i):n?l.copy(n.atom1).add(n.atom2).multiplyScalar(.5):r&&l.copy(r),a&&l.applyProjection(a.matrix),s.centerView(!1,l)),{atom:i,bond:n,volume:r,instance:a,canvasPosition:t.canvasPosition.clone()}}function o(){performance.now()-f.lastMoved>u&&(f.moving=!1),(f.scrolled||!f.moving&&!f.hovering)&&(f.scrolled=!1,u!==-1&&(f.hovering=!0,h.hovered.dispatch(r(f)))),requestAnimationFrame(o)}function a(){setTimeout(function(){f.scrolled=!0},u)}var s=e.viewer,c=e.gidPool,u=50;n(i);var h={clicked:new Rn,hovered:new Rn},l=new N,f={position:new I,down:new I,canvasPosition:new I,moving:!1,hovering:!0,scrolled:!1,lastMoved:1/0,which:void 0,distance:function(){return f.position.distanceTo(f.down)},setCanvasPosition:function(t){var e=s.renderer.domElement.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top;f.canvasPosition.set(i,e.height-n)}};o(),s.renderer.domElement.addEventListener("mousemove",function(t){t.preventDefault(),f.moving=!0,f.hovering=!1,f.lastMoved=performance.now(),f.position.set(t.layerX,t.layerY),f.setCanvasPosition(t)}),s.renderer.domElement.addEventListener("mousedown",function(t){t.preventDefault(),f.moving=!1,f.hovering=!1,f.down.set(t.layerX,t.layerY),f.which=t.which,f.setCanvasPosition(t)}),s.renderer.domElement.addEventListener("mouseup",function(e){if(e.preventDefault(),!(f.distance()>3||e.which===qv)){var i=r(f,!0);f.which=void 0,h.clicked.dispatch(i),t.Debug&&Pv.log("clicked",i)}}),s.renderer.domElement.addEventListener("mousewheel",a),s.renderer.domElement.addEventListener("wheel",a),s.renderer.domElement.addEventListener("MozMousePixelScroll",a),this.signals=h,this.setParameters=n};jr.prototype.add=function(t){this.count<<5<=t&&this.resize(t),this.words[t>>>5]|=1<>>5]|=1<>>5]^=1<>>5]^=1<>>5)+1,r=(e>>>5)-1,o=0|n;o+7>>5]|=1<>>5]|=1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&1<0;)0===this.words[this.count-1]&&this.count--;this.words=this.words.slice(0,this.count)},jr.prototype.resize=function(t){if(this.length=t,!(this.count<<5>t)&&(this.count=t+32>>>5,this.words.length<<5<=t)){var e=new Uint32Array(this.count<<1);e.set(this.words),this.words=e}},jr.prototype.hammingWeight=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},jr.prototype.size=function(){for(var t=0,e=this.count,i=0;i=t&&eo?a.set(this[n].subarray(0,o)):a.set(this[n]),this[n]=a}},growIfFull:function(){if(this.count>=this.length){var t=Math.round(1.5*this.length);this.resize(Math.max(256,t))}},copyFrom:function(t,e,i,n){for(var r=0,o=this.__fields.length;r0;)s-=1;a<=s&&(a===o?o=s:s===o&&(o=a),e(a,s),a+=1,s-=1)}while(a<=s);i(n,s),i(a,r)}}Pv.time("Store.sort");var n=this,r=new this.constructor(1);i(0,this.count-1),Pv.timeEnd("Store.sort")},clear:function(){this.count=0},dispose:function(){delete this.length,delete this.count;for(var t=0,e=this.__fields.length;t0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),p[i]=180/Math.PI*Math.acos(t),n=b.length(),r=x.length(),d[i]=Math.sqrt(r*n)/Math.max(2,2*(1-t)),f[i]=Math.abs(v.dot(A)),w.copy(b).multiplyScalar(d[i]/n),_.copy(x).multiplyScalar(d[i]/r),w.subVectors(I,w),_.subVectors(L,_),w.toArray(u,e+3),_.toArray(u,e+6),P.subVectors(E,C),P.toArray(m,e),M.copy(A),C.copy(w);for(w.fromArray(u,3),_.fromArray(u,6),A.subVectors(w,_).normalize(),E.index=o.getAtomIndexByType(0,T),C.copy(E),S.copy(E),Gr(S,A,w),S.toArray(u,0),P.subVectors(C,w),P.toArray(m,0),w.fromArray(u,3*s-6),_.fromArray(u,3*s-9),A.subVectors(w,_).normalize(),E.index=o.getAtomIndexByType(s-1,T),C.copy(E),S.copy(E),Gr(S,A,w),S.toArray(u,3*s-3),i=s-3;ie?z=!0:h.bending[B]>t&&(z=!0)),z){if(B-v<4){v=B,z=!1;continue}D.index=R.traceAtomIndex,T=h.axis.subarray(3*v+3,3*B),E=h.center.subarray(3*v,3*B+3),d=Vr(T).normalize(),f=Vr(E),I.fromArray(E),Gr(I,d,f),L.fromArray(E,E.length-3),Gr(L,d,f),d.subVectors(L,I),d.toArray(b,y),f.toArray(x,y),I.toArray(w,y),L.toArray(_,y),p.atomColorToArray(D,S,y),m.atomColorToArray(D,A,y),M.push(g.atomRadius(D)),P.push(u+v),C.push(u+B+1-v),y+=3,v=B,z=!1}return{axis:new Float32Array(b),center:new Float32Array(x),begin:new Float32Array(w),end:new Float32Array(_),color:new Float32Array(S),pickingColor:new Float32Array(A),size:new Float32Array(M),residueOffset:P,residueCount:C}}},jo.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},peek:function(){return this.content[0]},remove:function(t){for(var e=this.content.length,i=0;i0;){var i=Math.floor((t+1)/2)-1,n=this.content[i];if(!(this.scoreFunction(e)":"3/4-Z","?":"X-Y","@":"Y-X",A:"Z+1/3",B:"Z+2/3",C:"X+2/3",D:"Y+1/3",E:"-Y+2/3",F:"X-Y+1/3",G:"Y-X+2/3",H:"-X+1/3",I:"X+1/3",J:"Y+2/3",K:"-Y+1/3",L:"X-Y+2/3",M:"Y-X+1/3",N:"-X+2/3",O:"2/3+X",P:"1/3+Y",Q:"1/3+Z",R:"2/3-Y",S:"1/3+X-Y",T:"2/3+Y-X",U:"1/3-X",V:"2/3-X",W:"1/3-Y",X:"1/3-Z",Y:"2/3+Y",Z:"1/3+Y-X","[":"2/3+X-Y","]":"1/3+X","^":"2/3+Z",_:"2/3-Z","`":"5/6+Z",a:"1/6+Z",b:"5/6-Z",c:"1/6-Z",d:"Z+5/6",e:"Z+1/6",f:"Z+1/4",g:"+Y"},ty={"P 1":" !#","P -1":" !#$%&","P 1 2 1":" !#$!&","P 1 21 1":" !#$'&","C 1 2 1":" !#$!&()#*)&","P 1 m 1":" !# %#","P 1 c 1":" !# %+","C 1 m 1":" !# %#()#(,#","C 1 c 1":" !# %+()#(,+","P 1 2/m 1":" !# %#$!&$%&","P 1 21/m 1":" !#$)&$%& ,#","C 1 2/m 1":" !# %#$!&$%&()#(,#*)&*,&","P 1 2/c 1":" !#$!-$%& %+","P 1 21/c 1":" !#$%&$)- ,+","C 1 2/c 1":" !#$!-$%& %+()#*)-*,&(,+","P 2 2 2":" !#$%#$!& %&","P 2 2 21":" !#$%+$!- %&","P 21 21 2":" !#$%#*)&(,&","P 21 21 21":" !#*%+$)-(,&","C 2 2 21":" !#$%+$!- %&()#*,+*)-(,&","C 2 2 2":" !#$%#$!& %&()#*,#*)&(,&","F 2 2 2":" !#$%#$!& %& )+$,+$)- ,-(!+*%+*!-(%-()#*,#*)&(,&","I 2 2 2":" !#$%# %&$!&.'/01/.120'2","I 21 21 21":" !#*%+$)-(,&()+$,#*!& %-","P m m 2":" !#$%# %#$!#","P m c 21":" !#$%+ %+$!#","P c c 2":" !#$%# %+$!+","P m a 2":" !#$%#(%#*!#","P c a 21":" !#$%+(%#*!+","P n c 2":" !#$%# ,+$)+","P m n 21":" !#*%+(%+$!#","P b a 2":" !#$%#(,#*)#","P n a 21":" !#$%+(,#*)+","P n n 2":" !#$%#(,+*)+","C m m 2":" !#$%# %#$!#()#*,#(,#*)#","C m c 21":" !#$%+ %+$!#()#*,+(,+*)#","C c c 2":" !#$%# %+$!+()#*,#(,+*)+","A m m 2":" !#$%# %#$!# )+$,+ ,+$)+","A b m 2":" !#$%# ,#$)# )+$,+ %+$!+","A m a 2":" !#$%#(%#*!# )+$,+(,+*)+","A b a 2":" !#$%#(,#*)# )+$,+(%+*!+","F m m 2":" !#$%# %#$!# )+$,+ ,+$)+(!+*%+(%+*!+()#*,#(,#*)#","F d d 2":" !#$%#345675 )+$,+3896:9(!+*%+;49<79()#*,#;85<:5","I m m 2":" !#$%# %#$!#()+*,+(,+*)+","I b a 2":" !#$%#(,#*)#()+*,+ %+$!+","I m a 2":" !#$%#(%#*!#()+*,+ ,+$)+","P 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#","P 2/n 2/n 2/n":" !#$%#$!& %&*,-()-(,+*)+","P 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+","P 2/b 2/a 2/n":" !#$%#$!& %&*,&()&(,#*)#","P 21/m 2/m 2/a":" !#*%#$!&(%&$%&(!& %#*!#","P 2/n 21/n 2/a":" !#*%#*)- ,-$%&(!&(,+$)+","P 2/m 2/n 21/a":" !#*%+*!- %&$%&(!-(%+$!#","P 21/c 2/c 2/a":" !#*%#$!-(%-$%&(!& %+*!+","P 21/b 21/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#","P 21/c 21/c 2/n":" !#*,#$)-(%-$%&()& ,+*!+","P 2/b 21/c 21/m":" !#$%+$)- ,&$%& !- ,+$)#","P 21/n 21/n 2/m":" !#$%#*)-(,-$%& !&(,+*)+","P 21/m 21/m 2/n":" !#$%#*'&.,&*,&.'& %#$!#","P 21/b 2/c 21/n":" !#*,+$!-(,&$%&()- %+*)#","P 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#","P 21/n 21/m 21/a":" !#0%/$'&.12$%&.!2 1#0'/","C 2/m 2/c 21/m":" !#$%+$!- %&$%& !- %+$!#()#*,+*)-(,&*,&()-(,+*)#","C 2/m 2/c 21/a":" !#$,+$)- %&$%& )- ,+$!#()#*%+*!-(,&*,&(!-(%+*)#","C 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()#*,#*)&(,&*,&()&(,#*)#","C 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+()#*,#*)-(,-*,&()&(,+*)+","C 2/m 2/m 2/a":" !#$,#$)& %&$%& )& ,#$!#()#*%#*!&(,&*,&(!&(%#*)#","C 2/c 2/c 2/a":" !#*,#$!&(,&$,-(!- ,+*!+()#$%#*)& %&*%- )-(%+$)+","F 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!# )+$,+$)- ,-$,- )- ,+$)+(!+*%+*!-(%-*%-(!-(%+*!+()#*,#*)&(,&*,&()&(,#*)#","F 2/d 2/d 2/d":" !#$%#$!& %&64=37=345675 )+$,+$)- ,-68>3:>3896:9(!+*%+*!-(%-<4>;7>;49<79()#*,#*)&(,&<8=;:=;85<:5","I 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()+*,+*)-(,-*,-()-(,+*)+","I 2/b 2/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#()+*,+$!- %-*,-()- %+$!+","I 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#()+$,#*!& %-*,- )&(%#$!+","I 21/m 21/m 21/a":" !#$,#$)& %&$%& )& ,#$!#()+*%+*!-(,-*,-(!-(%+*)+","P 4":" !#$%#% #!$#","P 41":" !#$%+% 5!$9","P 42":" !#$%#% +!$+","P 43":" !#$%+% 9!$5","I 4":" !#$%#% #!$#()+*,+,(+)*+","I 41":" !#*,+%(5)$9()+$%#, 9!*5","P -4":" !#$%#!$&% &","I -4":" !#$%#!$&% &()+*,+)*-,(-","P 4/m":" !#$%#% #!$#$%& !&!$&% &","P 42/m":" !#$%#% +!$+$%& !&!$-% -","P 4/n":" !#$%#,(#)*#*,&()&!$&% &","P 42/n":" !#$%#,(+)*+*,-()-!$&% &","I 4/m":" !#$%#% #!$#$%& !&!$&% &()+*,+,(+)*+*,-()-)*-,(-","I 41/a":" !#*,+%(5)$9$,=(!>!$&,(-()+$%#, 9!*5*%> )=)*-% &","P 4 2 2":" !#$%#% #!$#$!& %&! &%$&","P 4 21 2":" !#$%#,(#)*#*)&(,&! &%$&","P 41 2 2":" !#$%+% 5!$9$!& %-! >%$=","P 41 21 2":" !#$%+,(5)*9*)=(,>! &%$-","P 42 2 2":" !#$%#% +!$+$!& %&! -%$-","P 42 21 2":" !#$%#,(+)*+*)-(,-! &%$&","P 43 2 2":" !#$%+% 9!$5$!& %-! =%$>","P 43 21 2":" !#$%+,(9)*5*)>(,=! &%$-","I 4 2 2":" !#$%#% #!$#$!& %&! &%$&()+*,+,(+)*+*)-(,-)(-,*-","I 41 2 2":" !#*,+%(5)$9*!> ,=)(-%$&()+$%#, 9!*5$)=(%>! &,*-","P 4 m m":" !#$%#% #!$# %#$!#%$#! #","P 4 b m":" !#$%#% #!$#(,#*)#,*#)(#","P 42 c m":" !#$%#% +!$+ %+$!+%$#! #","P 42 n m":" !#$%#,(+)*+(,+*)+%$#! #","P 4 c c":" !#$%#% #!$# %+$!+%$+! +","P 4 n c":" !#$%#% #!$#(,+*)+,*+)(+","P 42 m c":" !#$%#% +!$+ %#$!#%$+! +","P 42 b c":" !#$%#% +!$+(,#*)#,*+)(+","I 4 m m":" !#$%#% #!$# %#$!#%$#! #()+*,+,(+)*+(,+*)+,*+)(+","I 4 c m":" !#$%#% #!$# %+$!+%$+! +()+*,+,(+)*+(,#*)#,*#)(#","I 41 m d":" !#*,+%(5)$9 %#*)+%*5) 9()+$%#, 9!*5(,+$!#,$9!(5","I 41 c d":" !#*,+%(5)$9 %+*)#%*9) 5()+$%#, 9!*5(,#$!+,$5!(9","P -4 2 m":" !#$%#% &!$&$!& %&%$#! #","P -4 2 c":" !#$%#% &!$&$!- %-%$+! +","P -4 21 m":" !#$%#% &!$&*)&(,&,*#)(#","P -4 21 c":" !#$%#% &!$&*)-(,-,*+)(+","P -4 m 2":" !#$%#!$&% & %#$!#! &%$&","P -4 c 2":" !#$%#% &!$& %+$!+! -%$-","P -4 b 2":" !#$%#% &!$&(,#*)#)(&,*&","P -4 n 2":" !#$%#% &!$&(,+*)+)(-,*-","I -4 m 2":" !#$%#% &!$& %#$!#! &%$&()+*,+,(-)*-(,+*)+)(-,*-","I -4 c 2":" !#$%#% &!$& %+$!+! -%$-()+*,+,(-)*-(,#*)#)(&,*&","I -4 2 m":" !#$%#% &!$&$!& %&%$#! #()+*,+,(-)*-*)-(,-,*+)(+","I -4 2 d":" !#$%#% &!$&*!>(%>,$9) 9()+*,+,(-)*-$)= ,=%*5!(5","P 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #","P 4/m 2/c 2/c":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +","P 4/n 2/b 2/m":" !#$%#% #!$#$!& %&! &%$&*,&()&)*&,(&(,#*)#,*#)(#","P 4/n 2/n 2/c":" !#$%#% #!$#$!& %&! &%$&*,-()-)*-,(-(,+*)+,*+)(+","P 4/m 21/b 2/m":" !#$%#% #!$#*)&(,&)(&,*&$%& !&!$&% &(,#*)#,*#)(#","P 4/m 21/n 2/c":" !#$%#% #!$#*)-(,-)(-,*-$%& !&!$&% &(,+*)+,*+)(+","P 4/n 21/m 2/m":" !#$%#,(#)*#*)&(,&! &%$&*,&()&!$&% & %#$!#,*#)(#","P 4/n 2/c 2/c":" !#$%#,(#)*#*)-(,-! -%$-*,&()&!$&% & %+$!+,*+)(+","P 42/m 2/m 2/c":" !#$%#% +!$+$!& %&! -%$-$%& !&!$-% - %#$!#%$+! +","P 42/m 2/c 2/m":" !#$%#% +!$+$!- %-! &%$&$%& !&!$-% - %+$!+%$#! #","P 42/n 2/b 2/c":" !#$%#,(+)*+$!- %-)(&,*&*,-()-!$&% &(,#*)#%$+! +","P 42/n 2/n 2/m":" !#$%#,(+)*+$!& %&)(-,*-*,-()-!$&% &(,+*)+%$#! #","P 42/m 21/b 2/c":" !#$%#% +!$+*)&(,&)(-,*-$%& !&!$-% -(,#*)#,*+)(+","P 42/m 21/n 2/m":" !#$%#,./'*/*'-.,-! &%$&$%& !&'*-,.-.,/*'/%$#! #","P 42/n 21/m 2/c":" !#$%#,(+)*+*)-(,-! &%$&*,-()-!$&% & %#$!#,*+)(+","P 42/n 21/c 2/m":" !#$%#,(+)*+*)&(,&! -%$-*,-()-!$&% & %+$!+,*#)(#","I 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #()+*,+,(+)*+*)-(,-)(-,*-*,-()-)*-,(-(,+*)+,*+)(+","I 4/m 2/c 2/m":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +()+*,+,(+)*+*)&(,&)(&,*&*,-()-)*-,(-(,#*)#,*#)(#","I 41/a 2/m 2/d":" !#*,+%(5)$9*!> ,=)(-%$&$,=(!>!$&,(-(,+$!#,$9!(5()+$%#, 9!*5$)=(%>! &,*-*%> )=)*-% & %#*)+%*5) 9","I 41/a 2/c 2/d":" !#*,+%(5)$9*!= ,>)(&%$-$,=(!>!$&,(-(,#$!+,$5!(9()+$%#, 9!*5$)>(%=! -,*&*%> )=)*-% & %+*)#%*9) 5","P 3":" !#%?#@$#","P 31":" !#%?A@$B","P 32":" !#%?B@$A","H 3":" !#%?#@$#CDAEFAGHAIJBKLBMNB","R 3":" !## !!# ","P -3":" !#%?#@$#$%&!@&? &","H -3":" !#%?#@$#$%&!@&? &OPQRSQTUQVWXYZX[]X]Y^W[^ZV^UR_PT_SO_","R -3":" !## !!# $%&&$%%&$","P 3 1 2":" !#%?#@$#%$&@!& ?&","P 3 2 1":" !#%?#@$#! &?%&$@&","P 31 1 2":" !#%?Q@$^%$_@!X ?&","P 31 2 1":" !#%?A@$B! &?%_$@X","P 32 1 2":" !#%?^@$Q%$X@!_ ?&","P 32 2 1":" !#%?B@$A! &?%X$@_","H 3 2":" !#%?#@$#! &?%&$@&OPQRSQTUQY]X[WXVZX]Y^W[^ZV^PO_SR_UT_","R 3 2":" !## !!# %$&$&%&%$","P 3 m 1":" !#%?#@$#%$#@!# ?#","P 3 1 m":" !#%?#@$#! #?%#$@#","P 3 c 1":" !#%?#@$#%$+@!+ ?+","P 3 1 c":" !#%?#@$#! +?%+$@+","H 3 m":" !#%?#@$#%$#@!# ?#OPQRSQTUQRUQTPQOSQ]Y^W[^ZV^WV^ZY^][^","R 3 m":" !## !!# ! # #!#! ","H 3 c":" !#%?#@$#%$+@!+ ?+OPQRSQTUQRU`TP`OS`]Y^W[^ZV^WVaZYa][a","R 3 c":" !## !!# '././'/'.","P -3 1 2/m":" !#%?#@$#%$&@!& ?&$%&!@&? &! #?%#$@#","P -3 1 2/c":" !#%?#@$#%$-@!- ?-$%&!@&? &! +?%+$@+","P -3 2/m 1":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#","P -3 2/c 1":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+","H -3 2/m":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#OPQRSQTUQY]X[WXVZXVWXYZX[]XRUQTPQOSQ]Y^W[^ZV^PO_SR_UT_UR_PT_SO_WV^ZY^][^","R -3 2/m":" !## !!# %$&$&%&%$$%&&$%%&$! # #!#! ","H -3 2/c":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+OPQRSQTUQY]b[WbVZbVWXYZX[]XRU`TP`OS`]Y^W[^ZV^POcSRcUTcUR_PT_SO_WVaZYa][a","R -3 2/c":" !## !!# 102021210$%&&$%%&$'././'/'.","P 6":" !#%?#@$#$%#!@#? #","P 61":" !#%?A@$B$%/!@d? e","P 65":" !#%?B@$A$%/!@e? d","P 62":" !#%?^@$Q$%#!@^? Q","P 64":" !#%?Q@$^$%#!@Q? ^","P 63":" !#%?#@$#$%+!@+? +","P -6":" !#%?#@$# !&%?&@$&","P 6/m":" !#%?#@$#$%#!@#? #$%&!@&? & !&%?&@$&","P 63/m":" !#%?#@$#$%+!@+? +$%&!@&? & !-%?-@$-","P 6 2 2":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&","P 61 2 2":" !#%?Q@$^$%+!@`? a! X?%&$@_%$b@!- ?c","P 65 2 2":" !#%?^@$Q$%+!@a? `! _?%&$@X%$c@!- ?b","P 62 2 2":" !#%?^@$Q$%#!@^? Q! _?%&$@X%$_@!& ?X","P 64 2 2":" !#%?Q@$^$%#!@Q? ^! X?%&$@_%$X@!& ?_","P 63 2 2":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-","P 6 m m":" !#%?#@$#$%#!@#? #%$#@!# ?#! #?%#$@#","P 6 c c":" !#%?#@$#$%#!@#? #%$+@!+ ?+! +?%+$@+","P 63 c m":" !#%?#@$#$%+!@+? +%$+@!+ ?+! #?%#$@#","P 63 m c":" !#%?#@$#$%+!@+? +%$#@!# ?#! +?%+$@+","P -6 m 2":" !#%?#@$# !&%?&@$&%$#@!# ?#%$&@!& ?&","P -6 c 2":" !#%?#@$# !-%?-@$-%$+@!+ ?+%$&@!& ?&","P -6 2 m":" !#%?#@$# !&%?&@$&! &?%&$@&! #?%#$@#","P -6 2 c":" !#%?#@$# !-%?-@$-! &?%&$@&! +?%+$@+","P 6/m 2/m 2/m":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&$%&!@&? & !&@$&%?&%$#@!# ?#! #?%#$@#","P 6/m 2/c 2/c":" !#%?#@$#$%#!@#? #! -?%-$@-%$-@!- ?-$%&!@&? & !&@$&%?&%$+@!+ ?+! +?%+$@+", +"P 63/m 2/c 2/m":" !#%?#@$#$%+!@+? +! -?%-$@-%$&@!& ?&$%&!@&? & !-@$-%?-%$+@!+ ?+! #?%#$@#","P 63/m 2/m 2/c":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-$%&!@&? & !-@$-%?-%$#@!# ?#! +?%+$@+","P 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ","F 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ","I 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(","P 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(","I 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- ","P 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$","P 2/n -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& *,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","F 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-($,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- *,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$","F 2/d -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& 64=37=345675=64=375345674=67=3453756 )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(68>3:>3896:9=<8=;:5;85<:4><7>;49;79<(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(<4>;7>;49<79>68>3:93896:8=<:=;85;:5<()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- <8=;:=;8f<:f><4>;79;49<78>6:>3893:96","I 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","P 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*","I 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*()+$,#*g& %-+()#$,&*!- %)+(,#$!&*%- *,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$","P 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$","P 42 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","F 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$","F 41 3 2":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46 )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<(!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86","I 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","P 43 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7;>46=:<5839398<5:6=4;>75:<983>7;=46","P 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<","I 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46","P -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ","F -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(+%*+!*-%(- +)$+,$-) -,#)(#,*&)*&,((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() +,$+)$-, -(#)*#,*&)(&,+!(+%*-!*-%(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(#,*#)*&,(&(+!*+%*-!(-%+) +,$-)$-, ","I -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","P -4 3 n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","F -4 3 c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() #,$#)$&, &(#!*#%*&!(&%+! +%$-!$-% (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(#%*#!*&%(& +!$+%$-! -%#) #,$&)$&, ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! +%$+!$-% - #)$#,$&) &,#!(#%*&!*&%(","I -4 3 d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7354<9:6>8;=357<946>:;=857394<>:6=8;()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- :;98657<=43>;9:658<=73>49:;586=7<>43","P 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","P 4/n -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/m -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/n -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","F 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*%*+!(+%(-!*-$-) -, +)$+,&,(&)*#,*#)((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%**%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*,$+) +, -)$-*&)(&,(#)*#,-%(-!*+%*+!(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$*,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$,*#)(#,(&)*&*-!(-%(+!*+%-, -)$+,$+) ","F 4/m -3 2/c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() &,$&)$#, #(#%*#!*&%(&!+!$+% -! -%$$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*,$#) #, &)$&*&!(&%(#!*#%-% -!$+%$+! (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(&%*&!*#%(# +%$+!$-% -!#)$#, &) &,$*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*%*#!(#%(&!*&$-! -% +!$+%&, &)$#,$#) ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! -%$-!$+% + #,$#)$&, &)#!*#%(&!(&%**,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$%$+! +% -!$-$&) &, #)$#,&%(&!*#%*#!(","F 41/d -3 2/m":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=4664=3:>;85<79=64>3:5;89<74=6:>385;79<,$+! #%(-)*&*&)(-% #!$+,-%(&)*+,$#! )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<68>37=;49<:5=<8>;753496:4><:=;893756,*#!(+% &)$-*-!(&, +)$#%-, &!$+%*#)((!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<<4>;:=389675>68=379;45<:8=<7>;453:96%$#) +,(&!*-$&! -,(#)*+%&% -)$#,*+!(()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86<8=;7>3456:9><4=;:9385678>67=349;:5<%*+)(#, -!$&$-) &%(+!*#,&,(-!*#%$+) ","F 41/d -3 2/c":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46<8>;7=3496:5><8=;793456:8><7=;493:56%*#)(+, &!$-$-! &,(+)*#%&, -!$#%*+)( )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<<4=;:>385679>64=3:9;85<78=67>345;:9<%$+) #,(-!*&$&) -%(#!*+,&%(-)*#,$+! (!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<68=37>;45<:9=<4>;:5389674>6:=389;75<,*+!(#% -)$&*-)(&% +!$#,-,(&!*+%$#) ()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>8664>3:=;89<75=68>375;49<:4=<:>;853796,$#! +%(&)*-*&!(-, #)$+%-% &)$+,*#!(","I 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","I 41/a -3 2/d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<$%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*4<97358;=:6>6>:;=8357<94=8;>:694<573()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46*,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$865:;943>7<=<=73>4;9:658>43=7<5869:;","P 1 1 2":" !#$%#","P 1 1 21":" !#$%+","B 1 1 2":" !#$%#(g+*%+","A 1 2 1":" !#$!& )+$)-","C 1 21 1":" !#$)&()#*!&","I 1 2 1":" !#$!&.'/0'2","I 1 21 1":" !#$)&.'/0!-","P 1 1 m":" !# !&","P 1 1 b":" !# )&","B 1 1 m":" !# !&(!+(!-","B 1 1 b":" !# )&(!+()-","P 1 1 2/m":" !# !&$%#$%&","P 1 1 21/m":" !#$%+$%& !-","B 1 1 2/m":" !# !&$%#$%&(!+(!-*%+*%-","P 1 1 2/b":" !#$,#$%& )&","P 1 1 21/b":" !#$%&$,+ )-","B 1 1 2/b":" !#$,#$%& )&(!+*,+*%-()-","P 21 2 2":" !#$!&(%&*%#","P 2 21 2":" !# ,&$)&$%#","P 21 21 2 (a)":" !#*,#.%&$'&","P 21 2 21":" !#$!&(%-*%+","P 2 21 21":" !# %&$)-$,+","C 2 2 21a)":" !#*%+(,&$)-()#$,+ %&*!-","C 2 2 2a":" !#*,#.%&$'&()#$%# ,&*!&","F 2 2 2a":" !#*,#.%&$'& '/*%/.12$!2.!/$,/ %20'2.'#$%# 1&0!&","I 2 2 2a":" !#*,#.%&$'&()+$%+*!- ,-","P 21/m 21/m 2/n a":" !#*,#$)&(%&$%&.'& ,#*!#","P 42 21 2a":" !#*,#%.+'$+$'&.%&! -,*-","I 2 3a":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};Wo.prototype={constructor:Wo,type:"Assembly",addPart:function(t,e){var i=new Xo(t,e);return this.partList.push(i),i},getAtomCount:function(t){var e=0;return this.partList.forEach(function(i){e+=i.getAtomCount(t)}),e},getInstanceCount:function(){var t=0;return this.partList.forEach(function(e){t+=e.matrixList.length}),t},isIdentity:function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;var i=new O;if(!i.equals(e.matrixList[0]))return!1;var n=[];return t.eachChain(function(t){n.push(t.chainname)}),n=x(n),e.chainList.length===n.length},getBoundingBox:function(t){var e=new Et;return this.partList.forEach(function(i){var n=i.getBoundingBox(t);e.expandByPoint(n.min),e.expandByPoint(n.max)}),e},getSelection:function(){var t=[];return this.partList.forEach(function(e){t=t.concat(e.chainList)}),Ho(t)}},Xo.prototype={constructor:Xo,type:"AssemblyPart",getAtomCount:function(t){var e=0,i=this.chainList;return t.eachChain(function(t){(0===i.length||i.includes(t.chainname))&&(e+=t.atomCount)}),this.matrixList.length*e},getBoundingBox:function(t){var e=new Et,i=new Et,n=this.getSelection(),r=t.getBoundingBox(n);return this.matrixList.forEach(function(t){i.copy(r).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)}),e},getSelection:function(){return Ho(this.chainList)},getView:function(t){var e=this.getSelection();return e?t.getView(e):t},getInstanceList:function(){for(var t=[],e=0,i=this.matrixList.length;e=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var d=c.distanceTo(u);if(Math.abs(d-i[l-2])>n)return!1}return!0},i=function(t,i){var n=[5.45,5.18,6.37],r=2.1;return e(t,i,n,r)},n=function(t,i){var n=[6.1,10.4,13],r=1.42;return e(t,i,n,r)},r=function(t){for(var e=t.residueStore,r=t.residueIndexStart,o=0,a=t.residueCount;o1&&a.bending[u]=3&&t.indexOf(n[0])!==-1?n[0]:""}}();na.prototype={constructor:na,type:"AtomType",atomname:void 0,element:void 0,vdw:void 0,covalent:void 0},oa.prototype={constructor:oa,type:"ResidueType",resname:void 0,atomTypeIdList:void 0,atomCount:void 0,getBackboneIndexList:function(){var t,e=[];switch(this.moleculeType){case um:t=jm;break;case hm:case lm:t=$m;break;default:return e}for(var i=this.structure.atomMap,n=this.atomTypeIdList,r=0,o=this.atomCount;r=2?t(l,e[l],a):i[l]=2;else if(1===i[l]&&c&&c!=l){var d=[l];n[l]=1,r.push(d);for(var f=o.length-1;f>=0;--f){var p=o[f];if(p===l)break;d.push(p),n[p]=1}}}i[a]=2,o.pop()}for(var e=this.getBondGraph(),i=new Int8Array(this.atomCount),n=new Int8Array(this.atomCount),r=[],o=[],a=0;a1){for(e=0;e1){for(e=0;e0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},isPolymer:function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===um||t===hm||t===lm},isSidechain:function(){return this.isPolymer()&&!this.isBackbone()},isCg:function(){var t=this.residueType.backboneType;return t===vm||t===ym||t===bm},isHetero:function(){return 1===this.residueType.hetero},isProtein:function(){return this.residueType.moleculeType===um},isNucleic:function(){var t=this.residueType.moleculeType;return t===hm||t===lm},isRna:function(){return this.residueType.moleculeType===hm},isDna:function(){return this.residueType.moleculeType===lm},isWater:function(){return this.residueType.moleculeType===sm},isIon:function(){return this.residueType.moleculeType===cm},isSaccharide:function(){return this.residueType.moleculeType===dm},isRing:function(){var t=this.residueType.getRings().flags;return 1===t[this.index-this.residueAtomOffset]},distanceTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index,o=e.x[n]-i.x[r],a=e.y[n]-i.y[r],s=e.z[n]-i.z[r],c=o*o+a*a+s*s;return Math.sqrt(c)},connectedTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index;if(e.altloc&&i.altloc){var o=e.altloc[n],a=i.altloc[r];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[n]-i.x[r],c=e.y[n]-i.y[r],u=e.z[n]-i.z[r],h=s*s+c*c+u*u;if(h<64&&this.isCg())return!0;if(isNaN(h))return!1;var l=this.covalent+t.covalent,d=l+.3,f=l-.5;return hf*f},positionFromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e+0],this.y=t[e+1],this.z=t[e+2],this},positionToArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,n=this.atomStore;return t[e+0]=n.x[i],t[e+1]=n.y[i],t[e+2]=n.z[i],t},positionToVector3:function(t){return void 0===t&&(t=new N),t.x=this.x,t.y=this.y,t.z=this.z,t},positionFromVector3:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},getResidueBonds:function(t){var e,i,n,r,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(r=[]),e=c.indexOf(a);e!==-1;){if(n=u[e]+o,t)return n;r.push(n),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);i!==-1;){if(n=c[i]+o,t)return n;r.push(n),i=u.indexOf(a,i+1)}return r},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chainname&&(e+=":"+this.chainname),this.atomname&&(e+="."+this.atomname),this.altloc&&(e+="%"+this.altloc),this.structure.modelStore.count>1&&(e+="/"+this.modelIndex),e},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueIndex:this.residueIndex,atomno:this.atomno,resname:this.resname,x:this.x,y:this.y,z:this.z,element:this.element,chainname:this.chainname,resno:this.resno,serial:this.serial,vdw:this.vdw,covalent:this.covalent,hetero:this.hetero,bfactor:this.bfactor,altloc:this.altloc,atomname:this.atomname,modelindex:this.modelindex}}},ua.prototype={constructor:ua,type:"ResidueProxy",structure:void 0,chainStore:void 0,residueStore:void 0,atomStore:void 0,index:void 0,get entity(){return this.structure.entityList[this.entityIndex]},get entityIndex(){return this.chainStore.entityIndex[this.chainIndex]},get chain(){return this.structure.getChainProxy(this.chainIndex)},get chainIndex(){return this.residueStore.chainIndex[this.index]},set chainIndex(t){this.residueStore.chainIndex[this.index]=t},get atomOffset(){return this.residueStore.atomOffset[this.index]},set atomOffset(t){this.residueStore.atomOffset[this.index]=t},get atomCount(){return this.residueStore.atomCount[this.index]},set atomCount(t){this.residueStore.atomCount[this.index]=t},get atomEnd(){return this.atomOffset+this.atomCount-1},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},get chainid(){return this.chainStore.getChainid(this.chainIndex)},get resno(){return this.residueStore.resno[this.index]},set resno(t){this.residueStore.resno[this.index]=t},get sstruc(){return this.residueStore.getSstruc(this.index)},set sstruc(t){this.residueStore.setSstruc(this.index,t)},get inscode(){return this.residueStore.getInscode(this.index)},set inscode(t){this.residueStore.getInscode(this.index,t)},get residueType(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},get resname(){return this.residueType.resname},get hetero(){return this.residueType.hetero},get moleculeType(){return this.residueType.moleculeType},get backboneType(){return this.residueType.backboneType},get backboneStartType(){return this.residueType.backboneStartType},get backboneEndType(){return this.residueType.backboneEndType},get traceAtomIndex(){return this.residueType.traceAtomIndex+this.atomOffset},get direction1AtomIndex(){return this.residueType.direction1AtomIndex+this.atomOffset},get direction2AtomIndex(){return this.residueType.direction2AtomIndex+this.atomOffset},get backboneStartAtomIndex(){return this.residueType.backboneStartAtomIndex+this.atomOffset},get backboneEndAtomIndex(){return this.residueType.backboneEndAtomIndex+this.atomOffset},get rungEndAtomIndex(){return this.residueType.rungEndAtomIndex+this.atomOffset},eachAtom:function(t,e){var i,n=this.atomCount,r=this.atomOffset,o=this.structure._ap,a=r+n;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=r;i0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===um||t===hm||t===lm},isHetero:function(){return 1===this.residueType.hetero},isWater:function(){return this.residueType.moleculeType===sm},isIon:function(){return this.residueType.moleculeType===cm},isSaccharide:function(){return this.residueType.moleculeType===dm},getAtomType:function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},getResname1:function(){return Om[this.resname.toUpperCase()]||"X"},getBackboneType:function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},getAtomIndexByName:function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},getAtomByName:function(t){return this.residueType.getAtomByName(t)},hasAtomWithName:function(t){return this.residueType.hasAtomWithName(t)},getAtomnameList:function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),n=0;n=e){if(void 0===t&&(t=this.structure.getResidueProxy()),t.index=i,t.connectedTo(this))return t}else if(i===e-1){void 0===t&&(t=this.structure.getResidueProxy());var n=this.chainStore.residueCount[this.chainIndex];if(t.index=e+n-1,t.connectedTo(this))return t}},getBonds:function(){return this.residueType.getBonds(this)},getRings:function(){return this.residueType.getRings()},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chain&&(e+=":"+this.chainname),e+="/"+this.modelIndex},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}}},ha.prototype={constructor:ha,type:"Polymer",structure:void 0,residueStore:void 0,atomStore:void 0,residueIndexStart:void 0,residueIndexEnd:void 0,residueCount:void 0,get chainIndex(){return this.residueStore.chainIndex[this.residueIndexStart]},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},isProtein:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},isCg:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},isNucleic:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},getMoleculeType:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},getBackboneType:function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},getAtomIndexByType:function(t,e){this.isCyclic?t===-1?t=this.residueCount-1:t===this.residueCount&&(t=0):(t!==-1||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i=this.__residueProxy;i.index=this.residueIndexStart+t;var n;switch(e){case"trace":n=i.traceAtomIndex;break;case"direction1":n=i.direction1AtomIndex;break;case"direction2":n=i.direction2AtomIndex;break;default:var r=i.getAtomByName(e);n=r?r.index:void 0}return n},eachAtom:function(t,e){this.eachResidue(function(i){i.eachAtom(t,e)},e)},eachAtomN:function(t,e,i){var n,r=this.residueCount,o=new Array(t);for(n=0;n=n&&i=t&&e.apply(this,a)}})}},eachDirectionAtomsN:function(t,e){var i=2*t,n=this.atomOffset,r=this.atomCount,o=n+r;if(!(r=n&&i=n&&r=t&&e.apply(this,a)}},c,u)}},eachResidue:function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,n=this.residueIndexStart,r=0;r1&&t(new ha(o,i,u.index)),i=n)):(m!==fm&&u.index-i>1&&t(new ha(o,i,u.index)),i=n)}n-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new ha(o,i,n))},qualifiedName:function(){var t=":"+this.chainname+"/"+this.modelIndex;return t},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}}},da.prototype={constructor:da,type:"ModelProxy",structure:void 0,modelStore:void 0,index:void 0,get chainOffset(){return this.modelStore.chainOffset[this.index]},set chainOffset(t){this.modelStore.chainOffset[this.index]=t},get chainCount(){return this.modelStore.chainCount[this.index]},set chainCount(t){this.modelStore.chainCount[this.index]=t},get residueOffset(){return this.chainStore.residueOffset[this.chainOffset]},get atomOffset(){return this.residueStore.atomOffset[this.residueOffset]},get chainEnd(){return this.chainOffset+this.chainCount-1},get residueEnd(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},get atomEnd(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},get residueCount(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},get atomCount(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},eachAtom:function(t,e){this.eachChain(function(i){i.eachAtom(t,e)},e)},eachResidue:function(t,e){this.eachChain(function(i){i.eachResidue(t,e)},e)},eachPolymer:function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain(function(n){i(n)&&n.eachPolymer(t,e)})}else this.eachChain(function(i){i.eachPolymer(t,e)})},eachChain:function(t,e){var i,n=this.chainCount,r=this.chainOffset,o=this.structure._cp,a=r+n;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=r;i1?(R=i.atomRadius(A),O=R*b/(.5*L),_.calculateShiftDir(B),y?(D=2*x*R,B.multiplyScalar(D),B.negate(),z.subVectors(M,A).multiplyScalar(Math.max(.1,D/1.88)),A.positionToArray(o,E),M.positionToArray(a,E),L>=2&&(F.addVectors(A,B).add(z).toArray(o,E+3),F.addVectors(M,B).sub(z).toArray(a,E+3),L>=3&&(F.subVectors(A,B).add(z).toArray(o,E+6),F.subVectors(M,B).sub(z).toArray(a,E+6)))):(D=(x-b)*R,B.multiplyScalar(D),2===L?(F.addVectors(A,B).toArray(o,E),F.subVectors(A,B).toArray(o,E+3),F.addVectors(M,B).toArray(a,E),F.subVectors(M,B).toArray(a,E+3)):3===L?(A.positionToArray(o,E),F.addVectors(A,B).toArray(o,E+3),F.subVectors(A,B).toArray(o,E+6),M.positionToArray(a,E),F.addVectors(M,B).toArray(a,E+3),F.subVectors(M,B).toArray(a,E+6)):(A.positionToArray(o,E),M.positionToArray(a,E)))):(A.positionToArray(o,E),M.positionToArray(a,E))),s&&(n.bondColorToArray(_,1,s,E),n.bondColorToArray(_,0,c,E),v&&L>1))for(T=1;T1))for(T=1;T1))for(O=l[k]*b/(y?1:.5*L),T=y?1:0;T1))for(O=f[k]*b/(y?1:.5*L),T=y?1:0;Ta&&(a=e),i>s&&(s=i),u>c&&(c=u)},e),i.min.set(n,r,o),i.max.set(a,s,c),t.Debug&&Pv.timeEnd("getBoundingBox"),i},getPrincipalAxes:function(e){t.Debug&&Pv.time("getPrincipalAxes");var i=0,n=new co(3,this.atomCount),r=n.data;return this.eachAtom(function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3},e),t.Debug&&Pv.timeEnd("getPrincipalAxes"),_o(n)},atomCenter:function(t){return t?this.getBoundingBox(t).center():this.center.clone()},getSequence:function(t){var e=[],i=this.getResidueProxy();return this.eachAtom(function(t){i.index=t.residueIndex,t.index===i.traceAtomIndex&&e.push(i.getResname1())},t),e},getAtomIndices:function(t){var e;if(t&&t.string)e=[],this.eachAtom(function(t){e.push(t.index)},t);else{var i={what:{index:!0}};e=this.getAtomData(i).index}return e},getChainnameCount:function(t){var e=new Set;return this.eachChain(function(t){t.residueCount&&e.add(t.chainname)},t),e.size},updatePosition:function(t){var e=0;this.eachAtom(function(i){i.positionFromArray(t,e),e+=3})},refreshPosition:function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.center(this.center),this.spatialHash=new Lo(this.atomStore,this.boundingBox)},dispose:function(){this.frames&&(this.frames.length=0),this.boxes&&(this.boxes.length=0),this.bondStore.dispose(),this.backboneBondStore.dispose(),this.rungBondStore.dispose(),this.atomStore.dispose(),this.residueStore.dispose(),this.chainStore.dispose(),this.modelStore.dispose(),delete this.bondStore,delete this.atomStore,delete this.residueStore,delete this.chainStore,delete this.modelStore,delete this.frames,delete this.boxes,delete this.cif,delete this.bondSet,delete this.atomSet}},pa.prototype={constructor:pa,type:"Surface",set:function(t,e,i,n,r,o){this.position=t,this.index=e,this.normal=i,this.color=n,this.atomindex=r,this.size=t.length/3,this.contour=o},fromGeometry:function(e){t.Debug&&Pv.time("GeometrySurface.fromGeometry");var i;e instanceof ae?(e.computeVertexNormals(!0),i=(new ue).fromGeometry(e)):i=e instanceof ue?e:e[0],i.boundingBox||i.computeBoundingBox(),this.center.copy(i.boundingBox.center()),this.boundingBox.copy(i.boundingBox);var n,r,o,a;if(i instanceof ue){var s=i.attributes,c=!!s.normal&&s.normal.array;(!c||0===c[0]&&0===c[1]&&0===c[2])&&i.computeVertexNormals(),n=s.position.array,o=s.index?s.index.array:null,a=s.normal.array}this.set(n,o,a,r,void 0),t.Debug&&Pv.timeEnd("GeometrySurface.setGeometry")},getPosition:function(){return this.position},getColor:function(t){var e,i,n,r=t||{},o=this.size;if("volume"===r.scheme){var a=new N,s=this.position;for(n=Ev.getScheme(r),i=new Float32Array(3*o),e=0;e65535?Uint32Array:Uint16Array;return new m(o)}return this.index},getAtomindex:function(){return this.atomindex},dispose:function(){}},ma.prototype.constructor=ma,ga.prototype.constructor=ga,xa.__deps=[va,ya,ba],wa.__deps=[_a],_a.__deps=[Kr,Zr,Qr,qr],Aa.__deps=[Dn,no,ro,to,eo,oo,ao,Kr,so,So,Mo,Co,Po,To],Ma.__deps=[wa,_a,xa,Wr,Xr,Eo,Io],Tv.add("surf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&(self.volsurf=new Ma(i[0],i[1],i[2],i[3],i[4])),n){var r=self.volsurf.getSurface(n.isolevel,n.smooth,n.box,n.matrix,n.contour),o=[r.position.buffer,r.index.buffer];r.normal&&o.push(r.normal.buffer),r.atomindex&&o.push(r.atomindex.buffer),e({sd:r,p:n},o)}},[Ma]),Pa.prototype={constructor:Pa,type:"Volume",setData:function(t,e,i,n,r){this.nx=e||1,this.ny=i||1,this.nz=n||1,this.data=t||new Float32Array(1),this.__data=this.data,this.setDataAtomindex(r),delete this.mc,delete this.__isolevel,delete this.__smooth,delete this.__minValue,delete this.__maxValue,delete this.__dataPositionBuffer,delete this.__dataPosition,delete this.__dataBuffer,delete this.__dataMin,delete this.__dataMax,delete this.__dataMean,delete this.__dataRms,this.worker&&this.worker.terminate()},setMatrix:function(t){this.matrix.copy(t);var e=this.boundingBox,i=this.center,n=this.nx-1,r=this.ny-1,o=this.nz-1;e.makeEmpty(),e.expandByPoint(i.set(n,r,o)),e.expandByPoint(i.set(n,r,0)),e.expandByPoint(i.set(n,0,o)),e.expandByPoint(i.set(n,0,0)),e.expandByPoint(i.set(0,r,o)),e.expandByPoint(i.set(0,0,o)),e.expandByPoint(i.set(0,r,0)),e.expandByPoint(i.set(0,0,0)),e.applyMatrix4(this.matrix),e.center(this.center);var a=this.matrix.elements,s=new N(a[0],a[1],a[2]),c=new N(a[4],a[5],a[6]),u=new N(a[8],a[9],a[10]),h=new N,l=this.normalMatrix.elements;h.crossVectors(c,u),l[0]=h.x,l[1]=h.y,l[2]=h.z,h.crossVectors(u,s),l[3]=h.x,l[4]=h.y,l[5]=h.z,h.crossVectors(s,c),l[6]=h.x,l[7]=h.y,l[8]=h.z,this.inverseMatrix.getInverse(this.matrix)},setDataAtomindex:function(t){this.dataAtomindex=t,this.__dataAtomindex=this.dataAtomindex,delete this.__dataAtomindexBuffer},getBox:function(t,e,i){return i||(i=new Et),i.set(t,t),i.expandByScalar(e),i.applyMatrix4(this.inverseMatrix),i.min.round(),i.max.round(),i},__getBox:function(t,e){if(t&&e){this.__box||(this.__box=new Et);var i=this.getBox(t,e,this.__box);return[i.min.toArray(),i.max.toArray()]}},makeSurface:function(t,e,i){var n=new pa("","",t);return n.info.isolevel=e,n.info.smooth=i,n},getSurface:function(t,e,i,n){t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,void 0===this.volsurf&&(this.volsurf=new Ma(this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex));var r=this.__getBox(i,n),o=this.volsurf.getSurface(t,e,r,this.matrix.elements);return this.makeSurface(o,t,e)},getSurfaceWorker:function(t,e,i,n,r){if(t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,window.Worker){void 0===this.workerPool&&(this.workerPool=new ga("surf",2));var o={},a=this.workerPool.getNextWorker();0===a.postCount&&(o.args=[this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex]),o.params={isolevel:t,smooth:e,box:this.__getBox(i,n),matrix:this.matrix.elements},a.post(o,void 0,function(t){var e=t.data.sd,i=t.data.p;r(this.makeSurface(e,i.isolevel,i.smooth))}.bind(this),function(o){console.warn("Volume.getSurfaceWorker error - trying without worker",o);var a=this.getSurface(t,e,i,n);r(a)}.bind(this))}else{var s=this.getSurface(t,e,i,n);r(s)}},getValueForSigma:function(t){return t=void 0!==t?t:2,this.getDataMean()+t*this.getDataRms()},getSigmaForValue:function(t){return t=void 0!==t?t:0,(t-this.getDataMean())/this.getDataRms()},filterData:function(t,e,i){isNaN(t)&&this.header&&(t=this.header.DMEAN+2*this.header.ARMS),t=void 0===t||isNaN(t)?-(1/0):t,e=void 0!==e?e:1/0,i=i||!1,this.dataPosition||this.makeDataPosition();var n=this.__dataPosition,r=this.__data;if(t!==this.__minValue||e!=this.__maxValue||i!==this.__outside){if(t===-(1/0)&&e===1/0)this.dataPosition=n,this.data=r;else{var o=r.length;this.__dataBuffer||(this.__dataPositionBuffer=new ArrayBuffer(3*o*4),this.__dataBuffer=new ArrayBuffer(4*o));for(var a=new Float32Array(this.__dataPositionBuffer),s=new Float32Array(this.__dataBuffer),c=0,u=0;u=t&&l<=e||i&&(le)){var d=3*c;a[d+0]=n[h+0],a[d+1]=n[h+1],a[d+2]=n[h+2],s[c]=l,c+=1}}this.dataPosition=new Float32Array(this.__dataPositionBuffer,0,3*c),this.data=new Float32Array(this.__dataBuffer,0,c)}this.__minValue=t,this.__maxValue=e,this.__outside=i}},makeDataPosition:function(){for(var t=this.nz,e=this.ny,i=this.nx,n=new Float32Array(i*e*t*3),r=0,o=0;o0&&this.centerPbc){var r=[e[0],e[4],e[8]],o=this.getCircularMean(this.backboneIndices,i,r);Ea(i,o,r)}this.removePbc&&Ia(i,e)}this.indices.length>0&&this.superpose&&this.doSuperpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},setNumframes:function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},dispose:function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},setPlayer:function(t){this.player=t,this.signals.playerChanged.dispatch(t)},getPath:function(t,e){Pv.error("Trajectory.getPath not implemented",t,e)}},Ov.add("shader/Mesh.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = pickingColor;\n#elif defined( NOLIGHT )\nvColor = color;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"), +Ov.add("shader/Mesh.frag","#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#elif defined( NOLIGHT )\ngl_FragColor = vec4( vColor, opacity );\n#else\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\n#include dull_interior_fragment\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#include opaque_back_fragment\n#endif\n}"),Oa.prototype={constructor:Oa,parameters:{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},clipNear:{updateShader:!0,property:!0},clipRadius:{updateShader:!0,property:!0,uniform:!0},clipCenter:{uniform:!0},flatShaded:{updateShader:!0},background:{updateShader:!0},linewidth:{property:!0},wireframe:{updateVisibility:!0},roughness:{uniform:!0},metalness:{uniform:!0},diffuse:{uniform:!0}},get transparent(){return this.opacity<1||this.forceTransparent},makeMaterial:function(){var t=Ra(this.side);this.material=new Pt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!0,fog:!0,side:t,linewidth:this.linewidth}),this.material.vertexColors=Rh,this.material.extensions.derivatives=this.flatShaded,this.material.extensions.fragDepth=this.impostor,this.material.clipNear=this.clipNear,this.wireframeMaterial=new Pt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!1,fog:!0,side:t,linewidth:this.linewidth}),this.wireframeMaterial.vertexColors=Rh,this.wireframeMaterial.clipNear=this.clipNear,this.pickingMaterial=new Pt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:!0,lights:!1,fog:!1,side:t,linewidth:this.linewidth}),this.pickingMaterial.vertexColors=Rh,this.pickingMaterial.extensions.fragDepth=this.impostor,this.pickingMaterial.clipNear=this.clipNear,this.updateShader()},makeWireframeGeometry:function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new ue;i.attributes=t.attributes,e&&(i.setIndex(new Kt(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},makeWireframeIndex:function(){function t(t,i){if(t>i){var n=t;t=i,i=n}var r=e[t];return void 0===r?(e[t]=[i],!0):!r.includes(i)&&(r.push(i),!0)}var e=[];return function(){var i=this.geometry.index;if(this.wireframe){if(i){var n=i.array,r=n.length;this.geometry.drawRange.count!==1/0&&(r=this.geometry.drawRange.count);var o;if(this.wireframeIndex&&this.wireframeIndex.length>2*r)o=this.wireframeIndex;else{var a=this.geometry.attributes.position.count,s=a>65535?Uint32Array:Uint16Array;o=new s(2*r)}var c=0;e.length=0;for(var u=0;uthis.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new Kt(this.wireframeIndex,1).setDynamic(this.dynamic));else{var t=this.wireframeGeometry.getIndex();t.set(this.wireframeIndex),t.needsUpdate=this.wireframeIndexCount>0,t.updateRange.count=this.wireframeIndexCount}this.wireframeGeometry.setDrawRange(0,this.wireframeIndexCount)},getRenderOrder:function(){var t=0;return"text"===this.type?t=1:this.transparent&&(t="surface"===this.type?3:2),t},getMesh:function(){var t;return this.material||this.makeMaterial(),this.line?t=new Ve(this.geometry,this.material):this.point?(t=new He(this.geometry,this.material),this.sortParticles&&(t.sortParticles=!0)):t=new Ae(this.geometry,this.material),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getWireframeMesh:function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),t=new Ve(this.wireframeGeometry,this.wireframeMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getPickingMesh:function(){var t;return this.material||this.makeMaterial(),t=new Ae(this.geometry,this.pickingMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getShader:function(t,e){return Pr(t,this.getDefines(e))},getVertexShader:function(t){return this.getShader(this.vertexShader,t)},getFragmentShader:function(t){return this.getShader(this.fragmentShader,t)},getDefines:function(t){var e={};return this.clipNear&&(e.NEAR_CLIP=1),this.clipRadius&&(e.RADIUS_CLIP=1),"picking"===t?e.PICKING=1:(("background"===t||this.background)&&(e.NOLIGHT=1),this.flatShaded&&(e.FLAT_SHADED=1),this.opaqueBack&&(e.OPAQUE_BACK=1),this.dullInterior&&(e.DULL_INTERIOR=1)),e},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},addUniforms:function(t){this.uniforms=Fd.merge([this.uniforms,t]),this.pickingUniforms=Fd.merge([this.pickingUniforms,t])},addAttributes:function(t){var e={f:1,v2:2,v3:3,c:3};for(var i in t){var n,r=t[i];r.value?(this.attributeSize*e[r.type]!==r.value.length&&Pv.error("attribute value has wrong length",i),n=r.value):n=new Float32Array(this.attributeSize*e[r.type]),this.geometry.addAttribute(i,new Kt(n,e[r.type]).setDynamic(this.dynamic))}},updateRenderOrder:function(){function t(t){t.renderOrder=e}var e=this.getRenderOrder();this.group.children.forEach(t),this.pickingGroup&&this.pickingGroup.children.forEach(t)},updateShader:function(){var t=this.material,e=this.wireframeMaterial,i=this.pickingMaterial;t.vertexShader=this.getVertexShader(),t.fragmentShader=this.getFragmentShader(),t.needsUpdate=!0,e.vertexShader=this.getShader("Line.vert"),e.fragmentShader=this.getShader("Line.frag"),e.needsUpdate=!0,i.vertexShader=this.getVertexShader("picking"),i.fragmentShader=this.getFragmentShader("picking"),i.needsUpdate=!0},setParameters:function(t){if(t){var e=t,i=this.parameters,n={},r={},o=!1,a=!1;for(var s in e)void 0!==e[s]&&void 0!==i[s]&&(this[s]=e[s],i[s].property&&(i[s].property!==!0?n[i[s].property]=e[s]:n[s]=e[s]),i[s].uniform&&(i[s].uniform!==!0?r[i[s].uniform]=e[s]:r[s]=e[s]),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&e[s]===!0&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(n.transparent=this.transparent));this.setProperties(n),this.setUniforms(r),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},setAttributes:function(t){var e=this.geometry,i=e.attributes;for(var n in t){var r=t[n],o=r.length;if("index"===n){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new Kt(r,1).setDynamic(this.dynamic)):(a.set(r),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[n];o>s.array.length?e.addAttribute(n,new Kt(r,s.itemSize).setDynamic(this.dynamic)):(i[n].set(r),i[n].needsUpdate=o>0,i[n].updateRange.count=o)}}},setUniforms:function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,n=this.pickingMaterial.uniforms;for(var r in t)"opacity"===r&&this.setProperties({transparent:this.transparent}),void 0!==e[r]&&(e[r].value.isVector3?e[r].value.copy(t[r]):e[r].value.set?e[r].value.set(t[r]):e[r].value=t[r]),void 0!==i[r]&&(i[r].value.isVector3?i[r].value.copy(t[r]):i[r].value.set?i[r].value.set(t[r]):i[r].value=t[r]),void 0!==n[r]&&(n[r].value.isVector3?n[r].value.copy(t[r]):n[r].value.set?n[r].value.set(t[r]):n[r].value=t[r])}},setProperties:function(t){if(t){var e=this.material,i=this.wireframeMaterial,n=this.pickingMaterial;for(var r in t){var o=t[r];"transparent"===r?this.updateRenderOrder():"side"===r&&(o=Ra(o)),void 0!==e[r]&&(e[r]=o),void 0!==i[r]&&(i[r]=o),void 0!==n[r]&&(n[r]=o)}e.needsUpdate=!0,i.needsUpdate=!0,n.needsUpdate=!0}},setVisibility:function(t){this.visible=t,this.wireframe?(this.group.visible=!1,this.wireframeGroup.visible=t,this.pickable&&(this.pickingGroup.visible=!1)):(this.group.visible=t,this.wireframeGroup.visible=!1,this.pickable&&(this.pickingGroup.visible=t))},dispose:function(){this.material&&this.material.dispose(),this.wireframeMaterial&&this.wireframeMaterial.dispose(),this.pickingMaterial&&this.pickingMaterial.dispose(),this.geometry.dispose(),this.wireframeGeometry&&this.wireframeGeometry.dispose()}},Da.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Da}),za.prototype=Object.assign(Object.create(Da.prototype),{constructor:za,applyPositionTransform:function(){},setAttributes:function(){var t=new O,e=new Lt;return function(i){var n,r,o,a,s,c,u,h,l,d,f,p=this.geometry.attributes;i.position&&(n=i.position,a=this.geoPosition,h=this.meshPosition,c=this.transformedGeoPosition,p.position.needsUpdate=!0),i.color&&(r=i.color,l=this.meshColor,p.color.needsUpdate=!0),i.pickingColor&&(o=i.pickingColor,d=this.meshPickingColor,p.pickingColor.needsUpdate=!0);var m=!(!this.updateNormals||!n),g=!(!this.initNormals||!n);(m||g)&&(s=this.geoNormal,f=this.meshNormal,u=this.transformedGeoNormal,p.normal.needsUpdate=!0);for(var v=this.positionCount,y=this.geoPositionCount,b=0;b 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nflag2 = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#else\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#endif\nreturn true;\n}\nreturn false;\n}\nvoid main(void){\nbool flag = Impostor( cameraPos, cameraNormal );\n#ifdef NEAR_CLIP\nif( calcClip( cameraPos ) > 0.0 )\ndiscard;\n#endif\ngl_FragDepthEXT = calcDepth( cameraPos );\nif( !flag ){\n#ifdef NEAR_CLIP\nif( flag2 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}else if( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#else\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#endif\n}\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vNormal = cameraNormal;\nvec3 vViewPosition = -cameraPos;\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Ua.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Ua,setAttributes:function(t){var e,i,n,r,o,a,s,c=this.count,u=this.mappingSize,h=this.geometry.attributes;for(var l in t){i=t[l],e=h[l],n=e.itemSize,r=e.array;for(var d=0;d radius2)\ndiscard;\n#ifdef CAP\nnew_point = front_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(axis, end_cyl) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - end_cyl, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\nif( end_cap_test > 0.0 )\n{\nfloat dNV = dot(axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(axis, end_cyl) / dNV;\nvec3 end_point = ray_direction * near + ray_origin;\nif( dot(end_point - end_cyl, end_point-base) > radius2 )\ndiscard;\n#ifdef CAP\nnew_point = end_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(-axis, (base)) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - base, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\ngl_FragDepthEXT = calcDepth( new_point );\n#ifdef NEAR_CLIP\nif( calcClip( new_point ) > 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\nif( calcClip( new_point ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#endif\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}else{\nif( b > 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}\n#else\nvec3 vViewPosition = -new_point;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}else{\nif( b > 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Xa.prototype=Object.assign(Object.create(Ua.prototype),{constructor:Xa}),qa.prototype=Object.assign(Object.create(Xa.prototype),{constructor:qa,parameters:Object.assign({openEnded:{updateShader:!0}},Xa.prototype.parameters),getDefines:function(t){var e=Xa.prototype.getDefines.call(this,t);return this.openEnded||(e.CAP=1),e},setAttributes:function(t){t&&t.position1&&t.position2&&(t.position=Er(t.position1,t.position2)),Xa.prototype.setAttributes.call(this,t)}}),Za.prototype=Object.assign(Object.create(za.prototype),{constructor:Za,applyPositionTransform:function(){var t,e=new N,i=new N,n=new N,r=new N(0,1,0);return function(o,a,s){i.fromArray(this._from,s),n.fromArray(this._to,s),o.lookAt(i,n,r),t=this._radius[a],e.set(t,t,i.distanceTo(n)),o.scale(e)}}(),setAttributes:function(t){var e={};t.position1&&t.position2&&(Er(t.position1,t.position2,this._position),this._from.set(t.position1),this._to.set(t.position2),e.position=this._position),t.color&&(e.color=t.color),t.pickingColor&&(e.pickingColor=t.pickingColor),t.radius&&this._radius.set(t.radius),za.prototype.setAttributes.call(this,e)}}),Ja.prototype.constructor=Ja,Ja.prototype.type="Shape",ts.prototype={constructor:ts,type:"",parameters:{lazy:{type:"boolean"},clipNear:{type:"range",step:1,max:100,min:0,buffer:!0},clipRadius:{type:"number",precision:1,max:1e3,min:0,buffer:!0},clipCenter:{type:"vector3",precision:1,buffer:!0},flatShaded:{type:"boolean",buffer:!0},opacity:{type:"range",step:.01,max:1,min:0,buffer:!0},side:{type:"select",buffer:!0,options:{front:"front",back:"back",double:"double"}},wireframe:{type:"boolean",buffer:!0},linewidth:{type:"integer",max:50,min:1,buffer:!0},colorScheme:{type:"select",update:"color",options:Ev.getTypes()},colorScale:{type:"select",update:"color",options:Ev.getScales()},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:Ev.getModes()},roughness:{type:"range",step:.01,max:1,min:0,buffer:!0},metalness:{type:"range",step:.01,max:1,min:0,buffer:!0},diffuse:{type:"color",buffer:!0}},init:function(t){var e=t||{};this.clipNear=d(e.clipNear,0),this.clipRadius=d(e.clipRadius,0),this.clipCenter=d(e.clipCenter,new N),this.flatShaded=d(e.flatShaded,!1),this.side=d(e.side,"double"),this.opacity=d(e.opacity,1),this.wireframe=d(e.wireframe,!1),this.linewidth=d(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=d(e.colorScheme,"uniform"),this.colorScale=d(e.colorScale,""),this.colorValue=d(e.colorValue,9474192),this.colorDomain=d(e.colorDomain,""),this.colorMode=d(e.colorMode,"hcl"),this.visible=d(e.visible,!0),this.quality=d(e.quality,void 0),this.roughness=d(e.roughness,.4),this.metalness=d(e.metalness,0),this.diffuse=d(e.diffuse,16777215),this.lazy=d(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}};var i=this.parameters;i.sphereDetail===!0&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),i.radialSegments===!0&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),i.openEnded===!0&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),i.disableImpostor===!0&&(i.disableImpostor={type:"boolean",rebuild:!0}),"low"===e.quality?(i.sphereDetail&&(this.sphereDetail=0),i.radialSegments&&(this.radialSegments=5)):"medium"===e.quality?(i.sphereDetail&&(this.sphereDetail=1),i.radialSegments&&(this.radialSegments=10)):"high"===e.quality?(i.sphereDetail&&(this.sphereDetail=2),i.radialSegments&&(this.radialSegments=20)):(i.sphereDetail&&(this.sphereDetail=d(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=d(e.radialSegments,10))),i.openEnded&&(this.openEnded=d(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=d(e.disableImpostor,!1))},getColorParams:function(t){return Object.assign({gidPool:this.gidPool,scheme:this.colorScheme,scale:this.colorScale,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},getBufferParams:function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,side:this.side,wireframe:this.wireframe, +linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse},t)},setColor:function(t,e){var i=Object.keys(Ev.getTypes());return i.includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new Ct(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},prepare:!1,create:function(){},update:function(){this.build()},build:function(t){return this.lazy&&!this.visible?void(this.lazyProps.build=!0):this.prepare?(this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),void this.queue.push(t||!1)):(this.tasks.increment(),void this.make())},make:function(e,i){t.Debug&&Pv.time("Representation.make "+this.type);var n=function(){e?(this.update(e),this.viewer.requestRender(),this.tasks.decrement(),i&&i()):(this.clear(),this.create(),this.manualAttach||this.disposed||(t.Debug&&Pv.time("Representation.attach "+this.type),this.attach(function(){t.Debug&&Pv.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),i&&i()}.bind(this)))),t.Debug&&Pv.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(n):n()},attach:function(t){this.setVisibility(this.visible),t()},setVisibility:function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps,n=i.bufferParams,r=i.what;if(i.build)return i.build=!1,void this.build();(Object.keys(n).length||Object.keys(r).length)&&(i.bufferParams={},i.what={},this.updateParameters(n,r))}return this.bufferList.forEach(function(e){e.setVisibility(t)}),e||this.viewer.requestRender(),this},setParameters:function(t,e,i){var n=t||{},r=this.parameters;e=e||{},i=i||!1;var o={};for(var a in n)void 0!==n[a]&&void 0!==r[a]&&(r[a].int&&(n[a]=parseInt(n[a])),r[a].float&&(n[a]=parseFloat(n[a])),n[a]!==this[a]&&(this[a]=n[a],r[a].buffer&&(r[a].buffer===!0?o[a]=n[a]:o[r[a].buffer]=n[a]),r[a].update&&(e[r[a].update]=!0),!r[a].rebuild||"impostor"===r[a].rebuild&&Mv&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},updateParameters:function(t,e){return this.lazy&&!this.visible?(Object.assign(this.lazyProps.bufferParams,t),void Object.assign(this.lazyProps.what,e)):(this.bufferList.forEach(function(e){e.setParameters(t)}),Object.keys(e).length&&this.update(e),void this.viewer.requestRender())},getParameters:function(){var t={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach(function(e){null!==this.parameters[e]&&(t[e]=this[e])},this),t},clear:function(){this.bufferList.forEach(function(t){this.viewer.remove(t),t.dispose()},this),this.bufferList.length=0,this.viewer.requestRender()},dispose:function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()}},es.prototype=Object.assign(Object.create(ts.prototype),{constructor:es,type:"buffer",parameters:Object.assign({},ts.prototype.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),create:function(){this.bufferList.push.apply(this.bufferList,this.buffer)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t),t.setParameters(this.getBufferParams())},this),this.setVisibility(this.visible),t()}}),is.prototype=Object.assign(Object.create(Da.prototype),{constructor:is,type:"surface"}),ns.prototype.constructor=ns,rs.prototype=Object.assign(Object.create(ts.prototype),{constructor:rs,type:"surface",parameters:Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},smooth:{type:"integer",precision:1,max:10,min:0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},boxSize:{type:"integer",precision:1,max:100,min:0},useWorker:{type:"boolean",rebuild:!0}},ts.prototype.parameters),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.isolevelType=d(e.isolevelType,"sigma"),this.isolevel=d(e.isolevel,2),this.smooth=d(e.smooth,0),this.background=d(e.background,!1),this.opaqueBack=d(e.opaqueBack,!0),this.boxSize=d(e.boxSize,0),this.useWorker=d(e.useWorker,!0),ts.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},prepare:function(t){if(this.volume){var e;if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var i=function(e){this.surface=e,t()}.bind(this);this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,i):i(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize))}else t()}else t()},create:function(){var t=new is(this.surface.getPosition(),this.surface.getColor(this.getColorParams()),this.surface.getIndex(),this.surface.getNormal(),void 0,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),e=new ns(t);this.bufferList.push(e)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.position&&(e.position=this.surface.getPosition()),t.color&&(e.color=this.surface.getColor(this.getColorParams())),t.index&&(e.index=this.surface.getIndex()),t.normal&&(e.normal=this.surface.getNormal()),this.bufferList.forEach(function(t){t.setAttributes(e)})}},setParameters:function(t,e,i){return t&&void 0!==t.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===t.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===t.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=t.isolevelType),t&&t.boxCenter&&(this.boxCenter.copy(t.boxCenter),delete t.boxCenter),ts.prototype.setParameters.call(this,t,e,i),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),this.surface&&(void 0!==t.isolevel||void 0!==t.smooth||void 0!==t.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!0}),this},dispose:function(){this.viewer.signals.orientationChanged.remove(this.setBox),ts.prototype.dispose.call(this)}}),Ov.add("shader/Point.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float size;\nuniform float canvasHeight;\nuniform float pixelRatio;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\n#include common\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * pixelRatio * ( ( canvasHeight / 2.0 ) / -mvPosition.z );\n#else\ngl_PointSize = size * pixelRatio;\n#endif\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),Ov.add("shader/Point.frag","uniform vec3 diffuse;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nvec3 outgoingLight = vec3( 0.0 );\nvec4 diffuseColor = vec4( diffuse, 1.0 );\n#ifdef USE_MAP\ndiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif\n#include color_fragment\n#include alphatest_fragment\noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a * opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),as.prototype=Object.assign(Object.create(Oa.prototype),{constructor:as,parameters:Object.assign({pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},Oa.prototype.parameters),makeMaterial:function(){Oa.prototype.makeMaterial.call(this),this.makeTexture(),this.material.uniforms.map.value=this.tex,this.material.blending=Dh,this.material.needsUpdate=!0,this.wireframeMaterial.uniforms.map.value=this.tex,this.wireframeMaterial.blending=Dh,this.wireframeMaterial.needsUpdate=!0,this.pickingMaterial.uniforms.map.value=this.tex,this.pickingMaterial.blending=Dh,this.pickingMaterial.needsUpdate=!0},makeTexture:function(){this.tex&&this.tex.dispose(),this.tex=os({delta:this.edgeBleach})},getDefines:function(t){var e=Oa.prototype.getDefines.call(this,t);return this.sizeAttenuation&&(e.USE_SIZEATTENUATION=1),this.useTexture&&(e.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(e.ALPHATEST=this.alphaTest.toPrecision(2)),e},setUniforms:function(t){t&&void 0!==t.edgeBleach&&(this.makeTexture(),t.map=this.tex),Oa.prototype.setUniforms.call(this,t)},dispose:function(){Oa.prototype.dispose.call(this),this.tex&&this.tex.dispose()}}),ss.prototype=Object.assign(Object.create(ts.prototype),{constructor:ss,type:"dot",parameters:Object.assign({thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdOut:{type:"boolean",rebuild:!0},dotType:{type:"select",rebuild:!0,options:{"":"",sphere:"sphere",point:"point"}},radiusType:{type:"select",options:{"":"",value:"value","abs-value":"abs-value","value-min":"value-min",deviation:"deviation",size:"size"}},radius:{type:"number",precision:3,max:10,min:.001,property:"size"},scale:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,disableImpostor:!0,pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},ts.prototype.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform"}}}),defaultSize:.1,init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.thresholdType=d(e.thresholdType,"sigma"),this.thresholdMin=d(e.thresholdMin,2),this.thresholdMax=d(e.thresholdMax,1/0),this.thresholdOut=d(e.thresholdOut,!1),this.dotType=d(e.dotType,"point"),this.radius=d(e.radius,.1),this.scale=d(e.scale,1),this.pointSize=d(e.pointSize,1),this.sizeAttenuation=d(e.sizeAttenuation,!0),this.sortParticles=d(e.sortParticles,!1),this.useTexture=d(e.useTexture,!1),this.alphaTest=d(e.alphaTest,.5),this.forceTransparent=d(e.forceTransparent,!1),this.edgeBleach=d(e.edgeBleach,0),ts.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},create:function(){var t,e,i,n;if(this.volume){var r,o,a=this.volume;"sigma"===this.thresholdType?(r=a.getValueForSigma(this.thresholdMin),o=a.getValueForSigma(this.thresholdMax)):(r=this.thresholdMin,o=this.thresholdMax),a.filterData(r,o,this.thresholdOut),t=a.getDataPosition(),e=a.getDataColor(this.getColorParams()),i=a.getDataSize(this.radius,this.scale),n=a.getPickingDataColor(this.getColorParams())}else{var s=this.surface;t=s.getPosition(),e=s.getColor(this.getColorParams()),i=s.getSize(this.radius,this.scale),n=s.getPickingColor(this.getColorParams())}"sphere"===this.dotType?this.dotBuffer=new Va(t,e,i,n,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new as(t,e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach})),this.bufferList.push(this.dotBuffer)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.color&&(this.volume?e.color=this.volume.getDataColor(this.getColorParams()):e.color=this.surface.getColor(this.getColorParams())),"sphere"===this.dotType&&(t.radius||t.scale)&&(this.volume?e.radius=this.volume.getDataSize(this.radius,this.scale):e.radius=this.surface.getSize(this.radius,this.scale)),this.dotBuffer.setAttributes(e)}},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.thresholdType&&this.volume instanceof Pa&&("value"===this.thresholdType&&"sigma"===t.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===t.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=t.thresholdType),t&&void 0!==t.radiusType&&("radius"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,"sphere"!==this.dotType||Mv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,"sphere"!==this.dotType||Mv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.scale=!0,"sphere"!==this.dotType||Mv&&!this.disableImpostor||(i=!0)),ts.prototype.setParameters.call(this,t,e,i),this}}),Ov.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n}"),Ov.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include fog_pars_fragment\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 )\n{\nf = -f;\n}\nif( f < 1.0 )\n{\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}\nelse if( f >= 1.0 && f < 2.0 )\n{\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C)/ 6.0;\n}\nelse\n{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f*f*f ) - ( f*f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\ngl_FragColor.a *= opacity;\nif( gl_FragColor.a < 0.01 )\ndiscard;\n#include fog_fragment\n}");var ny=new Uint16Array([0,1,2,1,3,2]),ry=new Float32Array([0,1,0,0,1,1,1,0]);cs.prototype=Object.assign(Object.create(Oa.prototype),{constructor:cs,parameters:Object.assign({filter:{updateShader:!0,uniform:!0}},Oa.prototype.parameters),getDefines:function(t){var e=Oa.prototype.getDefines.call(this,t);return this.filter.startsWith("cubic")&&(e.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?e.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?e.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(e.MITCHELL_FILTER=1)),e},updateTexture:function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=Tl,t.magFilter=Tl):"linear"===this.filter?(t.minFilter=Ll,t.magFilter=Ll):(t.minFilter=Tl,t.magFilter=Tl),t.needsUpdate=!0},makeMaterial:function(){Oa.prototype.makeMaterial.call(this),this.updateTexture();var t=this.material;t.uniforms.map.value=this.tex,t.blending=Dh,t.needsUpdate=!0;var e=this.wireframeMaterial;e.uniforms.map.value=this.tex,e.blending=Dh,e.needsUpdate=!0;var i=this.pickingMaterial;i.uniforms.map.value=this.tex,i.blending=Dh,i.needsUpdate=!0},setUniforms:function(t){t&&void 0!==t.filter&&(this.updateTexture(),t.map=this.tex),Oa.prototype.setUniforms.call(this,t)}}),us.prototype=Object.assign(Object.create(ts.prototype),{constructor:us,type:"slice",parameters:Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0}},ts.prototype.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"value"),e.colorScale=d(e.colorScale,"Spectral"),ts.prototype.init.call(this,e),this.colorScheme="value",this.dimension=d(e.dimension,"x"),this.filter=d(e.filter,"cubic-bspline"),this.position=d(e.position,30),this.thresholdType=d(e.thresholdType,"sigma"),this.thresholdMin=d(e.thresholdMin,-(1/0)),this.thresholdMax=d(e.thresholdMax,1/0)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},create:function(){function t(t){return Math.round(t/100*(i-1))}function e(t,e,i,r){return 3*(i*n.ny*n.nx+e*n.nx+t)+r}var i=this.position,n=this.volume;n.filterData(-(1/0),1/0,!1);var r,o,a,s,c,u=n.data,h=n.matrix,l=new Float32Array(12),d=0,f=0,p=0,m=n.nx,g=n.ny,v=n.nz,y=new N;"x"===this.dimension?(a=t(n.nx),s=n.ny-1,c=n.nz-1,r=n.nz,o=n.ny,d=a,m=d+1,y.set(a,0,0).applyMatrix4(h).toArray(l,0),y.set(a,s,0).applyMatrix4(h).toArray(l,3),y.set(a,0,c).applyMatrix4(h).toArray(l,6),y.set(a,s,c).applyMatrix4(h).toArray(l,9)):"y"===this.dimension?(a=n.nx-1,s=t(n.ny),c=n.nz-1,r=n.nz,o=n.nx,f=s,g=f+1,y.set(0,s,0).applyMatrix4(h).toArray(l,0),y.set(a,s,0).applyMatrix4(h).toArray(l,3),y.set(0,s,c).applyMatrix4(h).toArray(l,6),y.set(a,s,c).applyMatrix4(h).toArray(l,9)):"z"===this.dimension&&(a=n.nx-1,s=n.ny-1,c=t(n.nz),r=n.nx,o=n.ny,p=c,v=p+1,y.set(0,0,c).applyMatrix4(h).toArray(l,0),y.set(0,s,c).applyMatrix4(h).toArray(l,3),y.set(a,0,c).applyMatrix4(h).toArray(l,6),y.set(a,s,c).applyMatrix4(h).toArray(l,9));var b,x,w=0,_=new Uint8Array(r*o*4);"sigma"===this.thresholdType?(b=n.getValueForSigma(this.thresholdMin),x=n.getValueForSigma(this.thresholdMax)):(b=this.thresholdMin,x=this.thresholdMax);var S=this.getColorParams({volume:n});S.domain=[n.getDataMin(),n.getDataMax()];for(var A=Ev.getScheme(S),M=new Float32Array(3),P=f;Pb&&I0&&this.updateData(t,e)},this)},updateData:function(){console.error("updateData not implemented")},getColorParams:function(){var t=ts.prototype.getColorParams.call(this);return t.structure=this.structure,t},getAtomParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},getBondParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},setSelection:function(t,e){return this.selection.setString(t,e),this},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.radiusType&&("size"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,Mv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,Mv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.radius=!0,Mv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.defaultAssembly&&(i=!0),ts.prototype.setParameters.call(this,t,e,i),this},getParameters:function(){var t=Object.assign(ts.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly});return t},attach:function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach(function(t){t.bufferList.forEach(function(n){i.push(n),e.add(n,t.instanceList)})}),this.setVisibility(this.visible),t()},clear:function(){this.dataList.length=0,ts.prototype.clear.call(this)},dispose:function(){this.structureView.dispose(),delete this.structure,delete this.structureView,ts.prototype.dispose.call(this)}}),Ov.add("shader/Line.vert","uniform float nearClip;\nuniform vec3 clipCenter;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),Ov.add("shader/Line.frag","uniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\ngl_FragColor = vec4( vColor, opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),ls.prototype=Object.assign(Object.create(Oa.prototype),{constructor:ls,setAttributes:function(t){var e,i,n,r,o,a,s=this.geometry.attributes;t.from&&t.to&&(e=t.from,i=t.to,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(n=t.color,r=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,d,f,p,m,g,v,y,b,x=this.size,w=6*x,_=0;_5&&i>15e3||i>7e5){var c=Math.min(1.5,Math.max(.1,2e3/(i/n)));a&&(c=Math.min(c,.15)),e.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:c,colorScheme:s,colorScale:"RdYlBu",useWorker:!1})}else i>25e4?e.addRepresentation("backbone",{lineOnly:!0,colorScheme:s,colorScale:"RdYlBu"}):i>1e5?e.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:s,colorScale:"RdYlBu",scale:2}):i>8e4?e.addRepresentation("backbone",{colorScheme:s,colorScale:"RdYlBu",scale:2}):(e.addRepresentation("cartoon",{color:s,colorScale:"RdYlBu",scale:.7,aspectRatio:5,quality:"auto"}),i<5e4&&e.addRepresentation("base",{color:s,colorScale:"RdYlBu",quality:"auto"}),e.addRepresentation("ball+stick",{sele:"hetero and not ( water or ion )",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));this.centerView(),e.structure.frames.length&&e.addTrajectory()}else"surface"!==e.type&&"volume"!==e.type||(e.addRepresentation("surface"),this.centerView())},loadFile:function(t,e){var i=Object.assign({},this.defaultFileParams,e),n=new ms(this,i);n.name=y(t).name,this.addComponent(n);var r=this.tasks;r.increment();var o,a=function(t){return this.removeComponent(n),n=this.addComponentFromObject(t,i),"script"===n.type&&n.run(),i.defaultRepresentation&&this.defaultFileRepresentation(n),r.decrement(),n}.bind(this),s=function(t){throw n.setStatus(t),r.decrement(),t},c=d(i.ext,y(t).ext);return o="dcd"===c?Promise.reject("loadFile: ext 'dcd' must be loaded into a structure component"):gr(t,i),o.then(a,s)},addComponent:function(t){return t?(this.compList.push(t),void this.signals.componentAdded.dispatch(t)):void Pv.warn("Stage.addComponent: no component given")},addComponentFromObject:function(t,e){var i=Nv.get(t.type);if(i){var n=new i(this,t,e);return this.addComponent(n),n}Pv.warn("no component for object type",t.type)},removeComponent:function(t){var e=this.compList.indexOf(t);e!==-1&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},removeAllComponents:function(t){this.compList.slice().forEach(function(e){t&&e.type!==t||this.removeComponent(e)},this)},handleResize:function(){this.viewer.handleResize()},toggleFullscreen:function(t){function e(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function i(){if(!e()&&n.lastFullscreenElement){var t=n.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",i),document.removeEventListener("mozfullscreenchange",i),document.removeEventListener("webkitfullscreenchange",i),document.removeEventListener("MSFullscreenChange",i),n.handleResize(),n.signals.fullscreenChanged.dispatch(!1)}}if(!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled))return void Pv.log("fullscreen mode (currently) not possible");var n=this;t=t||this.viewer.container,this.lastFullscreenElement=t,e()?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t.dataset.normalWidth=t.style.width,t.dataset.normalHeight=t.style.height,t.style.width=screen.width+"px",t.style.height=screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",i),document.addEventListener("mozfullscreenchange",i),document.addEventListener("webkitfullscreenchange",i),document.addEventListener("MSFullscreenChange",i),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout(function(){n.handleResize()},100))},centerView:function(){if(this.tasks.count>0){var t=function(e,i){0===i&&this.tasks.signals.countChanged.remove(t,this),this.viewer.centerView(!0)};this.tasks.signals.countChanged.add(t,this)}this.viewer.centerView(!0)},setSpin:function(t,e){Array.isArray(t)&&(t=(new N).fromArray(t)),this.viewer.setSpin(t,e)},setOrientation:function(t){this.tasks.onZeroOnce(function(){this.viewer.setOrientation(t)},this)},getOrientation:function(){return this.viewer.getOrientation()},makeImage:function(t){var e=this.viewer,i=this.tasks;return new Promise(function(n,r){function o(){i.increment(),e.makeImage(t).then(function(t){i.decrement(),n(t)}).catch(function(t){i.decrement(),r(t)})}i.onZeroOnce(o)})},setImpostor:function(t){this.parameters.impostor.value=t;var e=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(i){if("script"!==i.type&&e.includes(i.getType())){var n=i.getParameters();n.disableImpostor=!t,i.build(n)}})},setQuality:function(t){this.parameters.quality.value=t;var e=["tube","cartoon","ribbon","trace","rope"],i=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(n){if("script"!==n.type){var r=n.getParameters();if(!e.includes(n.getType())){if(!i.includes(n.getType()))return;if(!r.disableImpostor)return void(n.repr.quality=t)}r.quality=t,n.build(r)}})},eachComponent:function(t,e){this.compList.forEach(function(i,n){e&&i.type!==e||t(i,n)})},eachRepresentation:function(t,e){this.eachComponent(function(e){e.reprList.forEach(function(i){t(i,e)})},e)},getComponentsByName:function(t,e){var i=[];return this.eachComponent(function(e){(void 0===t||xs(t,e))&&i.push(e)},e),new ys(i)},getRepresentationsByName:function(t,e){var i,n;"object"!=typeof t?(i=void 0,n=t):(i=t.comp,n=t.repr);var r=[];return this.eachRepresentation(function(t,e){(void 0===i||xs(i,e))&&(void 0===n||xs(n,t))&&r.push(t)},e),new bs(r)},getAnythingByName:function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new vs(e.concat(i))},dispose:function(){this.tasks.dispose()}},_s.prototype={constructor:_s,_animate:function(){var t;if(this._running=!0,this.traj.inProgress||this._stopFlag||(t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step,(t>=this.end||t=this.end?e=this.start:"backward"===this.direction&&t<=this.start&&(e=this.end),this.traj.setFrame(e),this._stopFlag=!1,this._animate(),this.signals.startedRunning.dispatch()}},pause:function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},stop:function(){this.traj.setFrame(this.start),this.pause()}};var ay=function(){function t(t,e){var i,n=0,r={};return e.forEach(function(e){i=0;var o={};e.forEach(function(e){o[t[i++]]=e}),r[t[n++]]=o}),r}var e=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]],i=[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]],n="ACDEFGHIKLMNPQRSTVWY",r="ARNDCQEGHILKMFPSTWYVBZ?";return{blosum62:t(r,i),blosum62x:t(n,e)}}();Ss.prototype={constructor:Ss,initMatrices:function(){this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[];var t,e;for(t=0;t<=this.n;++t)for(this.S[t]=[],this.V[t]=[],this.H[t]=[],e=0;e<=this.m;++e)this.S[t][e]=0,this.V[t][e]=0,this.H[t][e]=0;for(t=0;t<=this.n;++t)this.S[t][0]=this.gap(0),this.H[t][0]=-(1/0);for(e=0;e<=this.m;++e)this.S[0][e]=this.gap(0),this.V[0][e]=-(1/0);this.S[0][0]=0},gap:function(t){return this.gapPenalty+t*this.gapExtensionPenalty},makeScoreFn:function(){var t,e,i=this.seq1,n=this.seq2,r=this.substMatrix;return r?function(o,a){t=i[o],e=n[a];try{return r[t][e]}catch(t){return-4}}:(Pv.warn("Alignment: no subst matrix"),function(r,o){return t=i[r],e=n[o],t===e?5:-3})},calc:function(){t.Debug&&Pv.time("Alignment.calc"),this.initMatrices();var e,i,n,r,o,a,s,c=this.gap(0),u=this.makeScoreFn(),h=this.gapExtensionPenalty,l=this.V,d=this.H,f=this.S,p=this.n,m=this.m;for(a=1;a<=p;++a)for(i=f[a-1],e=l[a-1],n=l[a],r=d[a],o=f[a],s=1;s<=m;++s)n[s]=Math.max(i[s]+c,e[s]+h),r[s]=Math.max(o[s-1]+c,r[s-1]+h),o[s]=Math.max(i[s-1]+u(a-1,s-1),n[s],r[s]);t.Debug&&Pv.timeEnd("Alignment.calc"),t.Debug&&Pv.log(this.S,this.V,this.H)},trace:function(){t.Debug&&Pv.time("Alignment.trace"),this.ali1="",this.ali2="";var e=this.makeScoreFn(),i=this.n,n=this.m,r="S";for(this.S[i][n]>=this.V[i][n]&&this.S[i][n]>=this.V[i][n]?(r="S",this.score=this.S[i][n]):this.V[i][n]>=this.H[i][n]?(r="V",this.score=this.V[i][n]):(r="H",this.score=this.H[i][n]),t.Debug&&Pv.log("Alignment: SCORE",this.score),t.Debug&&Pv.log("Alignment: S, V, H",this.S[i][n],this.V[i][n],this.H[i][n]);i>0&&n>0;)"S"===r?this.S[i][n]===this.S[i-1][n-1]+e(i-1,n-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--i,--n,r="S"):this.S[i][n]===this.V[i][n]?r="V":this.S[i][n]===this.H[i][n]?r="H":(--i,--n):"V"===r?this.V[i][n]===this.V[i-1][n]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="V"):this.V[i][n]===this.S[i-1][n]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="S"):--i:"H"===r?this.H[i][n]===this.H[i][n-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="H"):this.H[i][n]===this.S[i][n-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="S"):--n:Pv.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;n>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n;t.Debug&&Pv.timeEnd("Alignment.trace"),t.Debug&&Pv.log([this.ali1,this.ali2])}},Ms.prototype=Object.assign(Object.create(ms.prototype),{constructor:Ms,type:"script",addRepresentation:function(){},removeRepresentation:function(){},run:function(){var t=this;this.setStatus("running"),this.script.call(this.stage,function(){t.setStatus("finished")}),this.setStatus("called")},dispose:function(){this.signals.disposed.dispatch()},setVisibility:function(){},getCenter:function(){}}),Nv.add("script",Ms),Ps.prototype=Object.assign(Object.create(ms.prototype),{constructor:Ps,type:"shape",addRepresentation:function(t,e){return ms.prototype.addRepresentation.call(this,t,this.shape,e)},centerView:function(t){t=d(t,!0);var e=this.getCenter();if(t){var i=this.shape.boundingBox,n=i.size(),r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);t=Math.max(1,r+o/2)}return this.viewer.centerView(t,e),this},getCenter:function(){return this.shape.center},dispose:function(){this.shape.dispose(),ms.prototype.dispose.call(this)}}),Nv.add("shape",Ps),Cs.prototype=Object.assign(Object.create(ms.prototype),{constructor:Cs,type:"trajectory",signals:Object.assign({frameChanged:null,playerChanged:null,gotNumframes:null,parametersChanged:null},ms.prototype.signals),addRepresentation:function(t,e){return ms.prototype.addRepresentation.call(this,t,this.trajectory,e)},setFrame:function(t){this.trajectory.setFrame(t)},setParameters:function(t){return this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t),this},dispose:function(){this.trajectory.dispose(),ms.prototype.dispose.call(this)},getCenter:function(){}}),Ts.prototype=Object.assign(Object.create(La.prototype),{constructor:Ts,type:"frames",makeAtomIndices:function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},_loadFrame:function(t,e){var i,n=this.frames[t];if(this.atomIndices){var r=this.atomIndices,o=r.length;i=new Float32Array(3*o);for(var a=0;a0&&(n="( "+e.join(" ) AND ( ")+" )"),new On(n)},getStructure:function(){return this.structure.getStructure()},eachBond:function(t,e){this.structure.eachBond(t,this.getSelection(e))},eachAtom:function(t,e){var i=this.getAtomProxy(),n=this.getAtomSet(e),r=this.atomStore.count;if(n&&n.size()0?n>_&&(_=n):n>S&&(S=n),Gr(y.copy(t),m,e[3]);var r=x.subVectors(y,e[3]).normalize().dot(m),o=y.distanceTo(e[3]);r>0?o>A&&(A=o):o>M&&(M=o),Gr(b.copy(t),g,e[3]);var a=x.subVectors(b,e[3]).normalize().dot(g),s=b.distanceTo(e[3]);a>0?s>P&&(P=s):s>C&&(C=s)});var T=2*d,E=function(t,i,n){w.copy(e[3]).addScaledVector(p,t).addScaledVector(m,i).addScaledVector(g,n),w.toArray(o,T),T+=3};E(_,A,P),E(_,A,-C),E(_,-M,-C),E(_,-M,P),E(-S,-M,-C),E(-S,-M,P),E(-S,A,P),E(-S,A,-C);var I=d,L=function(t,e){w.fromArray(o,2*d+3*t).toArray(c,I),w.fromArray(o,2*d+3*e).toArray(u,I),I+=3};L(0,1),L(0,3),L(0,6),L(1,2),L(1,7),L(2,3),L(2,4),L(3,5),L(4,5),L(4,7),L(5,6),L(6,7)}return{vertexPosition:o,vertexColor:a,vertexRadius:s,edgePosition1:c,edgePosition2:u,edgeColor:h,edgeRadius:l}},create:function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Va(t.vertexPosition,t.vertexColor,t.vertexRadius,void 0,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new Ya(t.edgePosition1,t.edgePosition2,t.edgeColor,t.edgeColor,t.edgeRadius,void 0,void 0,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},updateData:function(t,e){var i=this.getAxesData(e.sview),n={},r={};t&&!t.position||(n.position=i.vertexPosition,r.position1=i.edgePosition1,r.position2=i.edgePosition2),t&&!t.color||(n.color=i.vertexColor,r.color=i.edgeColor,r.color2=i.edgeColor),t&&!t.radius||(n.radius=i.vertexRadius,r.radius=i.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(r)}}),Lv.add("axes",ks),Fs.prototype=Object.assign(Object.create(hs.prototype),{constructor:Fs,type:"ball+stick",defaultSize:.15,parameters:Object.assign({sphereDetail:!0,radialSegments:!0,openEnded:!0,disableImpostor:!0,aspectRatio:{type:"number",precision:1,max:10,min:1},lineOnly:{type:"boolean",rebuild:!0},cylinderOnly:{type:"boolean",rebuild:!0},multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondScale:{type:"number",precision:2,max:1,min:.01},bondSpacing:{type:"number",precision:2,max:2,min:.5}},hs.prototype.parameters),init:function(t){var e=t||{};e.radius=d(e.radius,this.defaultSize),this.aspectRatio=d(e.aspectRatio,2),this.lineOnly=d(e.lineOnly,!1),this.cylinderOnly=d(e.cylinderOnly,!1),this.multipleBond=d(e.multipleBond,"off"),this.bondSpacing=d(e.bondSpacing,1),this.bondScale=d(e.bondScale,.4),hs.prototype.init.call(this,e)},getAtomParams:function(t,e){return e=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},e),hs.prototype.getAtomParams.call(this,t,e)},getAtomData:function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},getBondParams:function(t,e){ +return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},e),hs.prototype.getBondParams.call(this,t,e)},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new ls(e.position1,e.position2,e.color1,e.color2,this.getBufferParams()),i.push(this.lineBuffer);else{var n=new Ya(e.position1,e.position2,e.color1,e.color2,e.radius,e.pickingColor1,e.pickingColor2,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(n),!this.cylinderOnly){var r=this.getAtomData(t),o=new Va(r.position,r.color,r.radius,r.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(o)}}return{bufferList:i}},updateData:function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)}else{var r={};if(t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color1,r.color2=i.color2),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r),!this.cylinderOnly){var o=this.getAtomData(e.sview,t),a={};t&&!t.position||(a.position=o.position),t&&!t.color||(a.color=o.color),t&&!t.radius||(a.radius=o.radius),e.bufferList[1].setAttributes(a)}}},setParameters:function(t){var e=!1,i={};return t&&(t.aspectRatio||t.bondSpacing||t.bondScale)&&(i.radius=!0,Mv&&!this.disableImpostor||(e=!0)),hs.prototype.setParameters.call(this,t,i,e),this}}),Lv.add("ball+stick",Fs),zs.prototype=Object.assign(Object.create(Fs.prototype),{constructor:zs,type:"backbone",defaultSize:.25,parameters:Object.assign({},Fs.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=d(e.aspectRatio,1),Fs.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.backbone=!0,t.getBackboneBondData(n)}}),Lv.add("backbone",zs),Bs.prototype=Object.assign(Object.create(Fs.prototype),{constructor:Bs,type:"base",defaultSize:.3,parameters:Object.assign({},Fs.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=d(e.aspectRatio,1),Fs.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.rung=!0,t.getRungBondData(n)}}),Lv.add("base",Bs),js.prototype={constructor:js,getAtomIterator:function(t,e){function i(){var t=this.get(u);return u+=1,t}function n(i){var n=h[c%4];if(n.index=o.getAtomIndexByType(i,t),e&&i>0&&ie)&&(s=!0,r.add_unsafe(n.index),o.addBond(a,n,1))}s&&r.add_unsafe(a.index)});var a=new Zv(o.count);return a.set_all(!0),Pv.timeEnd("Contact within"),{atomSet:r,bondSet:a,bondStore:o}}},Xs.prototype=Object.assign(Object.create(hs.prototype),{constructor:Xs,type:"contact",defaultSize:.25,parameters:Object.assign({contactType:{type:"select",rebuild:!0,options:{polar:"polar",polarBackbone:"polar backbone"}},maxDistance:{type:"number",precision:1,max:10,min:.1,rebuild:!0},maxAngle:{type:"integer",max:180,min:0,rebuild:!0},radialSegments:!0,disableImpostor:!0},hs.prototype.parameters),init:function(t){var e=t||{};e.radius=d(e.radius,this.defaultSize),this.contactType=d(e.contactType,"polarBackbone"),this.maxDistance=d(e.maxDistance,3.5),this.maxAngle=d(e.maxAngle,40),hs.prototype.init.call(this,e)},getContactData:function(t){var e={polar:Hs,polarBackbone:Ws},i=e[this.contactType](t,this.maxDistance,this.maxAngle);return i},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getContactData(t),i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(t,void 0,i),r=new Ya(n.position1,n.position2,n.color1,n.color2,n.radius,n.pickingColor1,n.pickingColor2,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));return{bufferList:[r],bondSet:e.bondSet,bondStore:e.bondStore}},updateData:function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,n),o={};t&&!t.position||(o.position=Er(r.position1,r.position2),o.position1=r.position1,o.position2=r.position2),t&&!t.color||(o.color=r.color1,o.color2=r.color2),t&&!t.radius||(o.radius=r.radius),e.bufferList[0].setAttributes(o)}}),Lv.add("contact",Xs),Ov.add("shader/SDFFont.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform bool ortho;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include color_pars_vertex\n#include common\nvoid main(void){\n#include color_vertex\ntexCoord = inputTexCoord;\nfloat _zOffset = zOffset;\nif( texCoord.x == 10.0 ){\n_zOffset -= 0.001;\n}\nvec3 pos = position;\nif( ortho ){\npos += normalize( cameraPosition ) * _zOffset;\n}\nvec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\nvec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\ncameraCornerPos.xy += mapping * inputSize * 0.01;\ncameraCornerPos.x += xOffset;\ncameraCornerPos.y += yOffset;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\nvViewPosition = -cameraCornerPos.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),Ov.add("shader/SDFFont.frag","uniform sampler2D fontTexture;\nuniform float opacity;\nuniform bool showBorder;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#ifdef SDF\nconst float smoothness = 16.0;\n#else\nconst float smoothness = 256.0;\n#endif\nconst float gamma = 2.2;\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nif( texCoord.x > 1.0 ){\ngl_FragColor = vec4( backgroundColor, backgroundOpacity );\n}else{\nfloat sdf = texture2D( fontTexture, texCoord ).a;\nif( showBorder ) sdf += borderWidth;\nfloat w = clamp(\nsmoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n0.0,\n0.5\n);\nfloat a = smoothstep( 0.5 - w, 0.5 + w, sdf );\na = pow( a, 1.0 / gamma );\nif( a < 0.2 ) discard;\na *= opacity;\nvec3 outgoingLight = vColor;\nif( showBorder && sdf < ( 0.5 + borderWidth ) ){\noutgoingLight = borderColor;\n}\ngl_FragColor = vec4( outgoingLight, a );\n}\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}");var sy=function(){var t={};return function(e){var i=JSON.stringify(e);return void 0===t[i]&&(t[i]=new qs(e)),t[i]}}();qs.prototype={constructor:qs,build:function(){var t=this.size+2*this.outline+Math.round(this.size/4),e=this.width/4,i=document.createElement("canvas");i.width=e,i.height=t;var n=i.getContext("2d");n.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,n.fillStyle="#FF0000",n.textAlign="left",n.textBaseline="bottom",n.lineJoin="round";for(var r=[],o=3*this.outline,a=0;athis.width&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>this.height&&console.warn("canvas to small"),this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH},this.context2.drawImage(this.canvas,0,0,this.scratchW,this.scratchH,this.currentX,this.currentY,this.scratchW,this.scratchH),this.currentX+=this.scratchW),this.mapped[t]},draw:function(t){var e=this.lineHeight,i=this.outline,n=this.context,r=this.scratch,o=this.maxWidth,a=this.colors,s=i,c=e-this.outline,u=n.measureText(t),h=Math.min(o,Math.ceil(u.width+2*s+1));n.clearRect(0,0,h,e);var l,d,f,p,m;if(0===this.outline)for(n.fillText(t,s,c),p=n.getImageData(0,0,h,e),m=p.data,f=3,l=0,d=m.length/4;l0;--l)f=l>1?2*l-2:l,n.strokeStyle=a[f-1],n.lineWidth=f,n.strokeText(t,s,c);n.globalCompositeOperation="multiply",n.fillStyle="#FF00FF",n.fillText(t,s,c),p=n.getImageData(0,0,h,e),m=p.data,f=0;var g=this.gamma;for(l=0,d=m.length/4;l0&&(i-=h,r=r.subarray(0,3*i));var l=new Zv(s.count);return l.set_all(!0),{text:n,position:r,bondSet:l,bondStore:s}},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},create:function(){if(0!==this.structureView.atomCount){var t=this.atomPair.length;if(0!==t){var e=this.getDistanceData(this.structureView,this.atomPair),i=new Ct(this.labelColor);this.textBuffer=new Ys(e.position,Ir(t,this.labelSize),Lr(t,i.r,i.g,i.b),e.text,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,zOffset:this.labelZOffset,opacity:1,visible:this.labelVisible}));var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(this.structureView,void 0,n);this.cylinderBuffer=new Ya(r.position1,r.position2,r.color1,r.color2,r.radius,void 0,void 0,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bondSet:e.bondSet,bondStore:e.bondStore,position:e.position,bufferList:[this.textBuffer,this.cylinderBuffer]})}}},update:function(t){t.position?this.build():hs.prototype.update.call(this,t)},updateData:function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,i),r={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=Ir(a,this.labelSize)),t.labelColor){var s=new Ct(this.labelColor);o.color=Lr(a,s.r,s.g,s.b)}t.color&&(r.color=n.color1,r.color2=n.color2),(t.radius||t.scale)&&(r.radius=n.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(r)},setVisibility:function(t,e){return hs.prototype.setVisibility.call(this,t,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),e||this.viewer.requestRender(),this},setParameters:function(t){var e=!1,i={};return t&&t.labelSize&&(i.labelSize=!0),t&&t.labelColor&&(i.labelColor=!0),hs.prototype.setParameters.call(this,t,i,e),t&&void 0!==t.labelVisible&&this.setVisibility(this.visible),this}}),Lv.add("distance",Zs),Ks.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Ks,setAttributes:function(t){var e,i,n,r=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,n=r.position.array,r.position.needsUpdate=!0);var o,a,s=this.size,c=this.scale;if(t.position&&t.vector)for(var u=0;u radius2) {\nspaceposition.y = mapping.y * 1.5 * radius1;\nspaceposition.x = mapping.x * 1.5 * radius1;\n} else {\nspaceposition.y = mapping.y * 1.5 * radius2;\nspaceposition.x = mapping.x * 1.5 * radius2;\n}\nspaceposition.w = 1.0;\nvec4 e3 = vec4( 1.0 );\nvec3 e1, e1_temp, e2, e2_temp;\ne3.xyz = normalize(position_atom1-position_atom2);\nif (e3.z == 0.0) { e3.z = 0.0000000000001;}\nif ( (position_atom1.x - position_atom2.x) == 0.0) { position_atom1.x += 0.001;}\nif ( (position_atom1.y - position_atom2.y) == 0.0) { position_atom1.y += 0.001;}\nif ( (position_atom1.z - position_atom2.z) == 0.0) { position_atom1.z += 0.001;}\nvec4 focus = vec4( 1.0 );\nfocus.x = ( position_atom1.x*position_atom1.x - position_atom2.x*position_atom2.x +\n( radius2*radius2 - radius1*radius1 )*e3.x*e3.x/shrink )/(2.0*(position_atom1.x - position_atom2.x));\nfocus.y = ( position_atom1.y*position_atom1.y - position_atom2.y*position_atom2.y +\n( radius2*radius2 - radius1*radius1 )*e3.y*e3.y/shrink )/(2.0*(position_atom1.y - position_atom2.y));\nfocus.z = ( position_atom1.z*position_atom1.z - position_atom2.z*position_atom2.z +\n( radius2*radius2 - radius1*radius1 )*e3.z*e3.z/shrink )/(2.0*(position_atom1.z - position_atom2.z));\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2_temp = e1.yzx * e3.zxy - e1.zxy * e3.yzx;\ne2 = normalize(e2_temp);\nmat3 R= mat3( e1.xyz, e2.xyz, e3.xyz );\nvertex_position.xyz = R * spaceposition.xyz;\nvertex_position.w = 1.0;\nvertex_position.x += (position_atom1.x+position_atom2.x) / 2.0;\nvertex_position.y += (position_atom1.y+position_atom2.y) / 2.0;\nvertex_position.z += (position_atom1.z+position_atom2.z) / 2.0;\ngl_Position = modelViewProjectionMatrix * vertex_position;\nvec4 i_near, i_far;\nvec4 near = gl_Position;\nnear.z = 0.0 ;\nnear = modelViewProjectionMatrixInverse * near;\ni_near = near;\nvec4 far = gl_Position;\nfar.z = far.w ;\ni_far = modelViewProjectionMatrixInverse * far;\nprime1 = vec4( position_atom1 - (position_atom1 - focus.xyz)*shrink, 1.0 );\nprime2 = vec4( position_atom2 - (position_atom2 - focus.xyz)*shrink, 1.0 );\nfloat Rsquare = (radius1*radius1/shrink) - (\n(position_atom1.x - focus.x)*(position_atom1.x - focus.x) +\n(position_atom1.y - focus.y)*(position_atom1.y - focus.y) +\n(position_atom1.z - focus.z)*(position_atom1.z - focus.z)\n);\nfocus.w = Rsquare;\nmatrix_near = mat4( i_near, i_far, focus, e3 );\ngl_Position.z = 1.0;\n}"),Ov.add("shader/HyperballStickImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float shrink;\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewMatrixInverseTranspose;\nuniform mat4 projectionMatrix;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\nvarying vec3 vPickingColor2;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat calcClip( vec4 cameraPos ){\nreturn dot( cameraPos, vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nfloat calcClip( vec3 cameraPos ){\nreturn calcClip( vec4( cameraPos, 1.0 ) );\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nstruct Ray {\nvec3 origin ;\nvec3 direction ;\n};\nbool cutoff_plane (vec3 M, vec3 cutoff, vec3 x3){\nfloat a = x3.x;\nfloat b = x3.y;\nfloat c = x3.z;\nfloat d = -x3.x*cutoff.x-x3.y*cutoff.y-x3.z*cutoff.z;\nfloat l = a*M.x+b*M.y+c*M.z+d;\nif (l<0.0) {return true;}\nelse{return false;}\n}\nvec3 isect_surf(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t1 =(-b-sqrt(delta))/a;\nreturn r.origin+t1*r.direction;\n}\nvec3 isect_surf2(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t2 =(-b+sqrt(delta))/a;\nreturn r.origin+t2*r.direction;\n}\nRay primary_ray(vec4 near1, vec4 far1){\nvec3 near=near1.xyz/near1.w;\nvec3 far=far1.xyz/far1.w;\nreturn Ray(near,far-near);\n}\nfloat update_z_buffer(vec3 M, mat4 ModelViewP){\nfloat depth1;\nvec4 Ms=(ModelViewP*vec4(M,1.0));\nreturn depth1=(1.0+Ms.z/Ms.w)/2.0;\n}\nvoid main(){\nfloat radius = max( vRadius, vRadius2 );\nvec4 i_near, i_far, focus;\nvec3 e3, e1, e1_temp, e2;\ni_near = vec4(matrix_near[0][0],matrix_near[0][1],matrix_near[0][2],matrix_near[0][3]);\ni_far = vec4(matrix_near[1][0],matrix_near[1][1],matrix_near[1][2],matrix_near[1][3]);\nfocus = vec4(matrix_near[2][0],matrix_near[2][1],matrix_near[2][2],matrix_near[2][3]);\ne3 = vec3(matrix_near[3][0],matrix_near[3][1],matrix_near[3][2]);\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2 = normalize(cross(e1,e3));\nvec4 equation = focus;\nfloat shrinkfactor = shrink;\nfloat t1 = -1.0/(1.0-shrinkfactor);\nfloat t2 = 1.0/(shrinkfactor);\nvec4 colonne1, colonne2, colonne3, colonne4;\nmat4 mat;\nvec3 equation1 = vec3(t2,t2,t1);\nfloat A1 = - e1.x*equation.x - e1.y*equation.y - e1.z*equation.z;\nfloat A2 = - e2.x*equation.x - e2.y*equation.y - e2.z*equation.z;\nfloat A3 = - e3.x*equation.x - e3.y*equation.y - e3.z*equation.z;\nfloat A11 = equation1.x*e1.x*e1.x + equation1.y*e2.x*e2.x + equation1.z*e3.x*e3.x;\nfloat A21 = equation1.x*e1.x*e1.y + equation1.y*e2.x*e2.y + equation1.z*e3.x*e3.y;\nfloat A31 = equation1.x*e1.x*e1.z + equation1.y*e2.x*e2.z + equation1.z*e3.x*e3.z;\nfloat A41 = equation1.x*e1.x*A1 + equation1.y*e2.x*A2 + equation1.z*e3.x*A3;\nfloat A22 = equation1.x*e1.y*e1.y + equation1.y*e2.y*e2.y + equation1.z*e3.y*e3.y;\nfloat A32 = equation1.x*e1.y*e1.z + equation1.y*e2.y*e2.z + equation1.z*e3.y*e3.z;\nfloat A42 = equation1.x*e1.y*A1 + equation1.y*e2.y*A2 + equation1.z*e3.y*A3;\nfloat A33 = equation1.x*e1.z*e1.z + equation1.y*e2.z*e2.z + equation1.z*e3.z*e3.z;\nfloat A43 = equation1.x*e1.z*A1 + equation1.y*e2.z*A2 + equation1.z*e3.z*A3;\nfloat A44 = equation1.x*A1*A1 + equation1.y*A2*A2 + equation1.z*A3*A3 - equation.w;\ncolonne1 = vec4(A11,A21,A31,A41);\ncolonne2 = vec4(A21,A22,A32,A42);\ncolonne3 = vec4(A31,A32,A33,A43);\ncolonne4 = vec4(A41,A42,A43,A44);\nmat = mat4(colonne1,colonne2,colonne3,colonne4);\nRay ray = primary_ray(i_near,i_far) ;\nvec3 M;\nM = isect_surf(ray, mat);\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nvec4 M1 = vec4(M,1.0);\nvec4 M2 = mat*M1;\nvec3 _normal = ( modelViewMatrixInverseTranspose * M2 ).xyz;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\n#ifdef NEAR_CLIP\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 ){\nM = isect_surf2(ray, mat);\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / radius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix);\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#endif\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\nfloat distance_ratio = ((M.x-prime2.x)*e3.x + (M.y-prime2.y)*e3.y +(M.z-prime2.z)*e3.z) /\ndistance(prime2.xyz,prime1.xyz);\n#ifdef PICKING\nif( distance_ratio > 0.5 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n#else\nvec3 vViewPosition = -( modelViewMatrix * vec4( M, 1.0 ) ).xyz;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distance_ratio>0.5 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"), +tc.prototype=Object.assign(Object.create(Ua.prototype),{constructo:tc});var cy=new O;ic.prototype=Object.assign(Object.create(tc.prototype),{constructor:ic,parameters:Object.assign({shrink:{uniform:!0}},tc.prototype.parameters)}),rc.prototype=Object.assign(Object.create(Js.prototype),{constructor:rc,type:"hyperball",defaultSize:1,parameters:Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},Js.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.scale=d(e.scale,.2),e.radius=d(e.radius,"vdw"),this.shrink=d(e.shrink,.12),Js.prototype.init.call(this,e)},getBondParams:function(t,e){return t&&!t.radius||(e=Object.assign({radius2:!0},e)),Js.prototype.getBondParams.call(this,t,e)},createData:function(t){var e=t.getAtomData(this.getAtomParams()),i=t.getBondData(this.getBondParams()),n=new Va(e.position,e.color,e.radius,e.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));this.__center=new Float32Array(3*t.bondCount);var r=new nc(i.position1,i.position2,i.color1,i.color2,i.radius1,i.radius2,i.pickingColor1,i.pickingColor2,this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}),this.disableImpostor);return{bufferList:[n,r]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),n=e.sview.getBondData(this.getBondParams()),r={},o={};if(!t||t.position){r.position=i.position;var a=n.position1,s=n.position2;o.position=Er(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(r.color=i.color,o.color=n.color1,o.color2=n.color2),t&&!t.radius||(r.radius=i.radius,o.radius=n.radius1,o.radius2=n.radius2),e.bufferList[0].setAttributes(r),e.bufferList[1].setAttributes(o)}}),Lv.add("hyperball",rc),oc.prototype={constructor:oc,atomLabel:function(t){var e,i=this.type;switch(i){case"atomname":e=t.atomname;break;case"atomindex":e=""+t.index;break;case"occupancy":e=t.occupancy.toFixed(2);break;case"bfactor":e=t.bfactor.toFixed(2);break;case"serial":e=""+t.serial;break;case"element":e=t.element;break;case"atom":e=t.atomname+"|"+t.index;break;case"resname":e=t.resname;break;case"resno":e=""+t.resno;break;case"res":var n=t.resname.toUpperCase();e=(Om[n]||n)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},oc.types={"":"",atomname:"atom name",atomindex:"atom index",occupancy:"occupancy",bfactor:"b-factor",serial:"serial",element:"element",atom:"atom name + index",resname:"residue name",resno:"residue no",res:"residue name + no",text:"text",qualified:"qualified name"},ac.prototype=Object.assign(Object.create(hs.prototype),{constructor:ac,type:"label",parameters:Object.assign({labelType:{type:"select",options:oc.types,rebuild:!0},labelText:{type:"hidden",rebuild:!0},fontFamily:{type:"select",options:{"sans-serif":"sans-serif",monospace:"monospace",serif:"serif"},buffer:!0},fontStyle:{type:"select",options:{normal:"normal",italic:"italic"},buffer:!0},fontWeight:{type:"select",options:{normal:"normal",bold:"bold"},buffer:!0},sdf:{type:"boolean",buffer:!0},xOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},yOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},zOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},attachment:{type:"select",options:{"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right","middle-left":"middle-left","middle-center":"middle-center","middle-right":"middle-right","top-left":"top-left","top-center":"top-center","top-right":"top-right"},rebuild:!0},showBorder:{type:"boolean",buffer:!0},borderColor:{type:"color",buffer:!0},borderWidth:{type:"number",precision:2,max:.3,min:0,buffer:!0},showBackground:{type:"boolean",rebuild:!0},backgroundColor:{type:"color",buffer:!0},backgroundMargin:{type:"number",precision:2,max:2,min:0,rebuild:!0},backgroundOpacity:{type:"range",step:.01,max:1,min:0,buffer:!0}},hs.prototype.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.labelType=d(e.labelType,"res"),this.labelText=d(e.labelText,{}),this.fontFamily=d(e.fontFamily,"sans-serif"),this.fontStyle=d(e.fontStyle,"normal"),this.fontWeight=d(e.fontWeight,"bold"),this.sdf=d(e.sdf,"Chrome"===_v),this.xOffset=d(e.xOffset,0),this.yOffset=d(e.yOffset,0),this.zOffset=d(e.zOffset,.5),this.attachment=d(e.attachment,"bottom-left"),this.showBorder=d(e.showBorder,!1),this.borderColor=d(e.borderColor,"lightgrey"),this.borderWidth=d(e.borderWidth,.15),this.showBackground=d(e.showBackground,!1),this.backgroundColor=d(e.backgroundColor,"lightgrey"),this.backgroundMargin=d(e.backgroundMargin,.5),this.backgroundOpacity=d(e.backgroundOpacity,1),hs.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0,radius:!0},i=t.getAtomData(this.getAtomParams(e)),n=[],r=new oc(this.labelType,this.labelText);t.eachAtom(function(t){n.push(r.atomLabel(t))});var o=new Ys(i.position,i.radius,i.color,n,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,xOffset:this.xOffset,yOffset:this.yOffset,zOffset:this.zOffset,attachment:this.attachment,showBorder:this.showBorder,borderColor:this.borderColor,borderWidth:this.borderWidth,showBackground:this.showBackground,backgroundColor:this.backgroundColor,backgroundMargin:this.backgroundMargin,backgroundOpacity:this.backgroundOpacity}));return{bufferList:[o]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.radius||(n.size=i.radius),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),Lv.add("label",ac),sc.prototype=Object.assign(Object.create(hs.prototype),{constructor:sc,type:"line",parameters:Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},ts.prototype.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.multipleBond=d(e.multipleBond,"off"),this.bondSpacing=d(e.bondSpacing,1),hs.prototype.init.call(this,e)},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},e),hs.prototype.getBondParams.call(this,t,e)},createData:function(t){var e={position:!0,color:!0},i=t.getBondData(this.getBondParams(e)),n=new ls(i.position1,i.position2,i.color1,i.color2,this.getBufferParams());return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)},setParameters:function(t){var e=!1,i={};return t&&t.bondSpacing&&(i.position=!0),hs.prototype.setParameters.call(this,t,i,e),this}}),Lv.add("line",sc),uc.__deps=[Aa,Sa,Ma,Hr,cc],lc.__deps=[Aa,Ma,Ir,Hr,eo,Zr,io,hc,d],Tv.add("molsurf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&n){var r="av"===n.type?lc:uc,o=new r(i.coordList,i.radiusList,i.indexList),a=o.getSurface(n.type,n.probeRadius,n.scaleFactor,n.cutoff,!0,n.smooth,n.contour),s=[a.position.buffer,a.index.buffer];a.normal&&s.push(a.normal.buffer),a.atomindex&&s.push(a.atomindex.buffer),e({sd:a,p:n},s)}},[uc,lc]),dc.prototype={getAtomData:function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},makeSurface:function(t,e){var i=new pa("","",t);return i.info.type=e.type,i.info.probeRadius=e.probeRadius,i.info.scaleFactor=e.scaleFactor,i.info.smooth=e.smooth,i.info.cutoff=e.cutoff,i},getSurface:function(t){var e=t||{},i=this.getAtomData(),n=i.position,r=i.radius,o=i.index,a="av"===e.type?lc:uc,s=new a(n,r,o),c=s.getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this.makeSurface(c,e)},getSurfaceWorker:function(t,e){var i=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new ma("molsurf"));var n=this.getAtomData(),r=n.position,o=n.radius,a=n.index,s={args:{coordList:r,radiusList:o,indexList:a},params:i},c=[r.buffer,o.buffer,a.buffer];this.worker.post(s,c,function(t){var n=t.data.sd;e(this.makeSurface(n,i))}.bind(this),function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),this.worker.terminate(),this.worker=void 0;var n=this.getSurface(i);e(n)}.bind(this))}else{var u=this.getSurface(i);e(u)}},dispose:function(){this.worker&&this.worker.terminate()}},fc.prototype=Object.assign(Object.create(Oa.prototype),{constructor:fc,setAttributes:function(t){var e=this.geometry.attributes;t.color&&(e.color.array.set(t.color),e.color.needsUpdate=!0),t.index&&(e.index.array.set(t.index),e.index.needsUpdate=!0)}}),pc.prototype=Object.assign(Object.create(hs.prototype),{constructor:pc,type:"surface",parameters:Object.assign({surfaceType:{type:"select",rebuild:!0,options:{vws:"vws",sas:"sas",ms:"ms",ses:"ses",av:"av"}},probeRadius:{type:"number",precision:1,max:20,min:0,rebuild:!0},smooth:{type:"integer",precision:1,max:10,min:0,rebuild:!0},scaleFactor:{type:"number",precision:1,max:5,min:0,rebuild:!0},cutoff:{type:"number",precision:2,max:50,min:0,rebuild:!0},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},volume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},hs.prototype.parameters,{radiusType:null,radius:null,scale:null}),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.surfaceType=d(e.surfaceType,"ms"),this.probeRadius=d(e.probeRadius,1.4),this.smooth=d(e.smooth,2),this.scaleFactor=d(e.scaleFactor,2),this.cutoff=d(e.cutoff,0),this.contour=d(e.contour,!1),this.background=d(e.background,!1),this.opaqueBack=d(e.opaqueBack,!0),this.filterSele=d(e.filterSele,""),this.volume=d(e.volume,void 0),this.useWorker=d(e.useWorker,!0),hs.prototype.init.call(this,t)},prepareData:function(t,e,i){var n=this.__infoList[e];if(n||(n={},this.__infoList[e]=n),n.molsurf&&n.sele===t.selection.string)i(e);else{if(this.filterSele){var r=t.structure.getView(new On(this.filterSele)),o=r.boundingBox.size(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(r.center,a/2);t=t.getView(new On(t.getAtomSetWithinSelection(s,3).toSeleString()))}n.sele=t.selection.string,n.molsurf=new dc(t);var c=this.getSurfaceParams(),u=function(t){n.surface=t,i(e)};this.useWorker?n.molsurf.getSurfaceWorker(c,u):u(n.molsurf.getSurface(c))}},prepare:function(t){if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0),0===this.structureView.atomCount)return void t();var e=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),i="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[i];n?n.partList.forEach(function(t,i){var r=t.getView(this.structureView);this.prepareData(r,i,function(t){t===n.partList.length-1&&e()}.bind(this))},this):this.prepareData(this.structureView,0,e)},createData:function(t,e){var i=this.__infoList[e],n=i.surface.getPosition(),r=i.surface.getColor(this.getColorParams()),o=i.surface.getFilteredIndex(this.filterSele,t);if(i.surface.contour){var a=new fc(n,r,o,this.getBufferParams({wireframe:!1}));return{bufferList:[a],info:i}}var s=new is(n,r,o,i.surface.getNormal(),i.surface.getPickingColor(this.getColorParams()),this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new ns(s);return{bufferList:[c],info:i}},updateData:function(t,e){var i={};return t.position?(this.__forceNewMolsurf=!0,void this.build()):(t.color&&(i.color=e.info.surface.getColor(this.getColorParams())),t.index&&(i.index=e.info.surface.getFilteredIndex(this.filterSele,e.sview)),void e.bufferList[0].setAttributes(i))},setParameters:function(t,e,i){return e=e||{},t&&t.filterSele&&(e.index=!0),t&&void 0!==t.volume&&(e.color=!0),t&&t.wireframe&&(t.contour||void 0===t.contour&&this.contour)&&(t.wireframe=!1),hs.prototype.setParameters.call(this,t,e,i),this},getSurfaceParams:function(t){var e=Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t);return e},getColorParams:function(){var t=hs.prototype.getColorParams.call(this);return t.volume=this.volume,t},clear:function(){hs.prototype.clear.call(this)},dispose:function(){this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0,hs.prototype.dispose.call(this)}}),Lv.add("surface",pc),mc.prototype=Object.assign(Object.create(hs.prototype),{constructor:mc,type:"point",parameters:Object.assign({pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},ts.prototype.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),init:function(t){var e=t||{};this.pointSize=d(e.pointSize,1),this.sizeAttenuation=d(e.sizeAttenuation,!0),this.sortParticles=d(e.sortParticles,!1),this.useTexture=d(e.useTexture,!1),this.alphaTest=d(e.alphaTest,.5),this.forceTransparent=d(e.forceTransparent,!1),this.edgeBleach=d(e.edgeBleach,0),hs.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0},i=t.getAtomData(this.getAtomParams(e)),n=new as(i.position,i.color,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}));return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),Lv.add("point",mc),Ov.add("shader/Ribbon.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec3 dir;\nattribute float size;\n#ifdef PICKING\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(void){\n#ifdef PICKING\nvPickingColor = pickingColor;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\ntransformed += normalize( dir ) * size;\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),gc.prototype=Object.assign(Object.create(Oa.prototype),{constructor:gc,setAttributes:function(t){var e,i,n,r,o,a,s,c,u,h,l,d,f=this.size,p=f/4,m=this.geometry.attributes;t.position&&(e=t.position,s=m.position.array,m.position.needsUpdate=!0),t.normal&&(i=t.normal,c=m.normal.array,m.normal.needsUpdate=!0),t.size&&(n=t.size,u=m.size.array,m.size.needsUpdate=!0),t.dir&&(r=t.dir,h=m.dir.array,m.dir.needsUpdate=!0),t.color&&(o=t.color,l=m.color.array,m.color.needsUpdate=!0),t.pickingColor&&(a=t.pickingColor,d=m.pickingColor.array,m.pickingColor.needsUpdate=!0);var g,v,y,b,x,w,_,S=n?n[0]:null;for(g=0;g_)continue}f=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),m=parseInt(T.substr(15,5)),A.growIfFull(),A.atomTypeId[M]=S.add(d),A.x[M]=L,A.y[M]=R,A.z[M]=O,A.serial[M]=m,o.addAtom(P,"","",f,p,0,"l"),M+=1}}}t.Debug&&Pv.time("GroParser._parse "+this.name);var i,n,r=this.structure,o=this.structureBuilder,a=this.firstModelOnly,s=this.asTrajectory,c=this.cAlphaOnly,u=r.frames,h=r.boxes,l=this.streamer.peekLines(3);r.title=l[0].trim();var d,f,p,m,g=l[2].length-l[2].lastIndexOf(".")-1,v=5+g,y=20,b=20+v,x=20+2*v,w=parseInt(l[1]),_=w+3,S=r.atomMap,A=r.atomStore;A.resize(w);var M=0,P=0,C=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.unitcell=new Tc(h[0][0],h[0][4],h[0][8],90,90,90,"P 1"),o.finalize(),r.finalizeAtoms(),Yo(r),Zo(r),r.finalizeBonds(),ey(r),ea(r),t.Debug&&Pv.timeEnd("GroParser._parse "+this.name)}}),Rv.add("gro",Ec),Lc.prototype={constructor:Lc,type:"Entity",getEntityType:function(){return this.entityType},isPolymer:function(){return this.entityType===im},isNonPolymer:function(){return this.entityType===nm},isMacrolide:function(){return this.entityType===rm},isWater:function(){return this.entityType===om},eachChain:function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach(function(i){e.index=i,t(e)})}};var uy={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"};Rc.prototype=Object.assign(Object.create(Cc.prototype),{constructor:Rc,type:"pdb",_parse:function(){function e(t,e,J){for(var ut,ht,lt=t;lt0)continue;var dt,ft,pt,mt,gt;if(N){if(mt=s.split(k),gt=10===mt.length?1:0,m=mt[2],j&&"CA"!==m)continue;dt=parseFloat(mt[6-gt]),ft=parseFloat(mt[7-gt]),pt=parseFloat(mt[8-gt])}else{if(m=s.substr(12,4).trim(),j&&"CA"!==m)continue;dt=parseFloat(s.substr(30,8)),ft=parseFloat(s.substr(38,8)),pt=parseFloat(s.substr(46,8))}if(U&&(ut=3*n,i[ut+0]=dt,i[ut+1]=ft,i[ut+2]=pt,n+=1,G))continue;var vt;N?(u=parseInt(mt[1]),vt="",g="H"===s[0]?1:0,h=gt?"":mt[4],l=parseInt(mt[5-gt]),p="",d=mt[3],v=parseFloat(mt[9-gt]),y="",f=0):(u=parseInt(s.substr(6,5)),vt=s.substr(76,2).trim(),g="H"===s[0]?1:0,h=s[21].trim()||s.substr(72,4).trim(),l=parseInt(s.substr(22,4)),p=s[26].trim(),d=s.substr(17,4).trim(),v=parseFloat(s.substr(60,6)),y=s[16].trim(),f=parseFloat(s.substr(54,6))),nt.growIfFull(),nt.atomTypeId[at]=it.add(m,vt),nt.x[at]=dt,nt.y[at]=ft,nt.z[at]=pt,nt.serial[at]=u,nt.bfactor[at]=isNaN(v)?0:v,nt.altloc[at]=y.charCodeAt(0),nt.occupancy[at]=isNaN(f)?0:f,g?I===h&&R===d&&(zm.includes(d)||L===l&&D===p)||(C+=1,T=C.toString(),L=l,R=d,D=p):E||I===h||(C+=1,T=C.toString()),z.addAtom(st,h,T,d,l,g,void 0,p),W[u]=at,at+=1,E=!1,I=h}else if("CONECT"===c){var yt=W[parseInt(s.substr(6,5))],bt=[11,16,21,26],xt={};if(void 0===yt)continue;for(ut=0;ut<4;++ut){var wt=parseInt(s.substr(bt[ut],5));if(!Number.isNaN(wt)&&(wt=W[wt],void 0!==wt))if(yt0)continue;var at=rt[c].replace(dy,"");if(C&&"CA"!==at)continue;var st=parseFloat(rt[y]),ct=parseFloat(rt[b]),ut=parseFloat(rt[x]);if(P){var ht=3*n;if(i[ht+0]=st,i[ht+1]=ct,i[ht+2]=ut,n+=1,X>0)continue}var lt=rt[u],dt=parseInt(rt[s]),ft=rt[v];ft="?"===ft?"":ft;var pt=rt[a],mt=rt[h],gt="H"===rt[f][0]?1:0,vt=rt[m],yt=parseFloat(rt[w]),bt=parseFloat(rt[_]),xt=rt[d];if(xt="."===xt?"":xt,G.growIfFull(),G.atomTypeId[W]=V.add(at,vt),G.x[W]=st,G.y[W]=ct,G.z[W]=ut,G.serial[W]=parseInt(rt[p]),G.bfactor[W]=isNaN(yt)?0:yt,G.occupancy[W]=isNaN(bt)?0:bt,G.altloc[W]=xt.charCodeAt(0),A.addAtom(X,pt,mt,lt,dt,gt,void 0,ft),t.Debug){var wt=I[mt];void 0!==wt&&wt!==pt&&Pv.warn(wt,pt)}I[mt]=pt;var _t=rt[l];L[_t]||(L[_t]=new Set),L[_t].add(S.chainStore.count-1),W+=1}else{rt=o.match(ly),nt=rt.length,z===F.length&&(z=0);for(var St=0;St0&&(h=!0))),_>=m&&_0)continue;var C=parseFloat(P.substr(0,10)),T=parseFloat(P.substr(10,10)),E=parseFloat(P.substr(20,10));if(o){var I=3*c;if(s[I+0]=C,s[I+1]=T,s[I+2]=E,c+=1,h)continue}var L=P.substr(31,3).trim(),R=L+(w+1);d.growIfFull(),d.atomTypeId[w]=l.add(R,L),d.x[w]=C,d.y[w]=T,d.z[w]=E,d.serial[w]=w,n.addAtom(S,"","","HET",1,1),w+=1}if(_>=v&&_0)continue;if(o&&S>0)continue;b.index=parseInt(P.substr(0,3))-1+A,x.index=parseInt(P.substr(3,3))-1+A;var O=parseInt(P.substr(6,3));i.bondStore.addBond(b,x,O)}++_}}t.Debug&&Pv.time("SdfParser._parse "+this.name);var i=this.structure,n=this.structureBuilder,r=this.firstModelOnly,o=this.asTrajectory,a=this.streamer.peekLines(2);i.id=a[0].trim(),i.title=a[1].trim();var s,c,u=i.frames,h=!1,l=i.atomMap,d=i.atomStore;d.resize(Math.round(this.streamer.data.length/50));var f,p,m,g,v,y,b=i.getAtomProxy(),x=i.getAtomProxy(),w=0,_=0,S=0,A=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),n.finalize(),i.finalizeAtoms(),i.finalizeBonds(),ia(i),t.Debug&&Pv.timeEnd("SdfParser._parse "+this.name)},_postProcess:function(){ia(this.structure)}}),Rv.add("sdf",Gc),Hc.prototype=Object.assign(Object.create(Cc.prototype),{constructor:Hc,type:"mol2",_parse:function(){function e(t,e,M){for(var P,C=t;CMOLECULE"===T?(y=b,p=0,++g):"@ATOM"===T?(y=x,m=d.count,c&&(n=0,i=new Float32Array(3*v),u.push(i),g>0&&(h=!0))):y="@BOND"===T?w:0;else if(y===b)0===p?(o.title=T,o.id=T):1===p&&(P=T.split(r),v=parseInt(P[0])),++p;else if(y===x){if(P=T.split(r),s&&g>0)continue;var E=parseFloat(P[2]),I=parseFloat(P[3]),L=parseFloat(P[4]);if(c){var R=3*n;if(i[R+0]=E,i[R+1]=I,i[R+2]=L,n+=1,h)continue}var O=P[0],D=P[1],N=P[5].split(".")[0],k=P[6]?parseInt(P[6]):1,F=P[7]?P[7]:"",z=P[8]?parseFloat(P[8]):0;d.growIfFull(),d.atomTypeId[f]=l.add(D,N),d.x[f]=E,d.y[f]=I,d.z[f]=L,d.serial[f]=O,d.bfactor[f]=z,a.addAtom(g,"","",F,k,1),f+=1}else if(y===w){if(s&&g>0)continue;if(c&&g>0)continue;P=T.split(r),_.index=parseInt(P[1])-1+m,S.index=parseInt(P[2])-1+m;var B=A[P[3]];o.bondStore.addBond(_,S,B)}}}t.Debug&&Pv.time("Mol2Parser._parse "+this.name);var i,n,r=/\s+/,o=this.structure,a=this.structureBuilder,s=this.firstModelOnly,c=this.asTrajectory,u=o.frames,h=!1,l=o.atomMap,d=o.atomStore;d.resize(Math.round(this.streamer.data.length/60));var f=0,p=0,m=0,g=-1,v=0,y=0,b=1,x=2,w=3,_=o.getAtomProxy(),S=o.getAtomProxy(),A={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),a.finalize(),o.finalizeAtoms(),Yo(o),Jo(o,!0),ta(o,!0),o.finalizeBonds(),ia(o),ey(o),t.Debug&&Pv.timeEnd("Mol2Parser._parse "+this.name)}}),Rv.add("mol2",Hc);var py=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],my=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],gy=py.concat(my),vy={0:"i".charCodeAt(0),1:"s".charCodeAt(0),2:"h".charCodeAt(0),3:"e".charCodeAt(0),4:"g".charCodeAt(0),5:"b".charCodeAt(0),6:"t".charCodeAt(0),7:"l".charCodeAt(0),"-1":"".charCodeAt(0)};pu.prototype=Object.assign(Object.create(Cc.prototype),{constructor:pu,type:"mmtf",_parse:function(){t.Debug&&Pv.time("MmtfParser._parse "+this.name);var e,i,n,r,o,a=this.structure,s=fu(lu(this.streamer.data)),c=["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"];c.forEach(function(t){void 0!==s[t]&&(a.header[t]=s[t])});var u,h,l,d,f,p;if(a.id=s.structureId,a.title=s.title,this.firstModelOnly||this.asTrajectory){for(f=1,d=s.chainsPerModel[0],l=0,e=0,i=d;e0&&(a.biomolDict[st]=ct)}s.unitCell&&Array.isArray(s.unitCell)&&s.unitCell[0]?a.unitcell=new Tc(s.unitCell[0],s.unitCell[1],s.unitCell[2],s.unitCell[3],s.unitCell[4],s.unitCell[5],s.spaceGroup):a.unitcell=void 0,t.Debug&&Pv.timeEnd("MmtfParser._parse "+this.name),ta(a,!0),Jo(a,!0),a.finalizeAtoms(),a.finalizeBonds(),ea(a)}}),Rv.add("mmtf",pu),mu.prototype={constructor:mu,type:"Frames"},gu.prototype=Object.assign(Object.create(Mc.prototype),{constructor:gu,type:"trajectory",__objName:"frames"}),vu.prototype=Object.assign(Object.create(gu.prototype),{constructor:vu,type:"dcd",_parse:function(){t.Debug&&Pv.time("DcdParser._parse "+this.name);var e=this.streamer.data;e instanceof Uint8Array&&(e=e.buffer);var i,n,r=new DataView(e),o=this.frames,a=o.coordinates,s=o.boxes,c={},u=0,h=new Int32Array(e,0,23),l=h[0]!==r.getInt32(0);if(84!==h[0])for(n=e.byteLength,i=0;i0)return void Pv.error("dcd format with fixed atoms unsupported, aborting");var y=c.NATOM,b=4*y;for(i=0,n=c.NSET;i=o.atomCount+6+l){r=r.split(a);for(var s=0,d=r.length;s0?0:1;this.streamer.eachChunkOfLines(function(t){i(0,t.length,t)}),n.header=o,n.setData(c,o.NVZ,o.NVY,o.NVX),t.Debug&&Pv.timeEnd("CubeParser._parse "+this.name)},getMatrix:function(){var t=this.volume.header,e=new O;return e.multiply((new O).makeRotationY(Dn(90))),e.multiply((new O).makeTranslation(-t.originZ,t.originY,t.originX)),e.multiply((new O).makeScale(-t.AVZ,t.AVY,t.AVX)),e}}),Rv.add("cub",xu),Rv.add("cube",xu),wu.prototype=Object.assign(Object.create(yu.prototype),{constructor:wu,type:"dx",_parse:function(){function e(t,e,i){for(var n=t;na){var r=i[n].trim();if(""!==r)for(var o=r.split(s),d=0,f=o.length;d=c&&(v-c)%y!==0&&g=n.elements[s].count&&(s++,c=0);var l=this.parseASCIIElement(n.elements[s].properties,h);this.handleElement(i,n.elements[s].name,l),c++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e=0?i-1:i+e/3)},parseNormalIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=0?i-1:i+e/3)},addVertex:function(t,e,i){var n=this.vertices,r=this.object.geometry.vertices;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addVertexLine:function(t){var e=this.vertices,i=this.object.geometry.vertices;i.push(e[t+0]),i.push(e[t+1]),i.push(e[t+2])},addNormal:function(t,e,i){var n=this.normals,r=this.object.geometry.normals; +r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addFace:function(t,e,i,n,r,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),d=this.parseVertexIndex(i,u);if(void 0===n?this.addVertex(h,l,d):(c=this.parseVertexIndex(n,u),this.addVertex(h,l,c),this.addVertex(l,d,c)),void 0!==r){var f=this.normals.length;h=this.parseNormalIndex(r,f),l=r===o?h:this.parseNormalIndex(o,f),d=r===a?h:this.parseNormalIndex(a,f),void 0===n?this.addNormal(h,l,d):(c=this.parseNormalIndex(s,f),this.addNormal(h,l,c),this.addNormal(l,d,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,n=t.length;i0?w.addAttribute("normal",new Kt(new Float32Array(x.normals),3)):w.computeVertexNormals(),y.push(w)}}return y}},Tu.prototype=Object.assign(Object.create(Au.prototype),{constructor:Tu,type:"obj"}),Rv.add("obj",Tu),Eu.prototype=Object.assign(Object.create(Mc.prototype),{constructor:Eu,type:"text",__objName:"text",_parse:function(){this.text.data=this.streamer.asText()}}),Rv.add("txt",Eu),Rv.add("text",Eu),Iu.prototype=Object.assign(Object.create(Mc.prototype),{constructor:Iu,type:"csv",__objName:"table",_parse:function(){var t=this.table.data,e=/\s*,\s*/;this.streamer.eachChunkOfLines(function(i,n){for(var r=i.length,o=0;o");){var i=o();if(!i)return e;e.attributes[i.name]=i.value}return s(/\?>\s*/),e}}function n(){var t=s(/^<([\w-:.]+)\s*/);if(t){for(var e={name:t[1],attributes:{},children:[]};!(c()||u(">")||u("?>")||u("/>"));){var i=o();if(!i)return e;e.attributes[i.name]=i.value}if(s(/^\s*\/>\s*/))return e;s(/\??>\s*/),e.content=r();for(var a;a=n();)e.children.push(a);return s(/^<\/[\w-:.]+>\s*/),e}}function r(){var t=s(/^([^<]*)/);return t?t[1]:""}function o(){var t=s(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(t)return{name:t[1],value:a(t[2])}}function a(t){return t.replace(/^['"]|['"]$/g,"")}function s(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function c(){return 0===t.length}function u(e){return 0===t.indexOf(e)}return t=t.trim(),t=t.replace(//g,""),e()},__domParser:function(t){var e=new window.DOMParser;return e.parseFromString(t,"text/xml")},_parse:function(){t.Debug&&Pv.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.isBinary()||this.string?this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.streamer.data:this.xml.data=this.__xmlParser(this.streamer.asText()),t.Debug&&Pv.timeEnd("XmlParser._parse "+this.name)}}),Rv.add("xml",Ru);var yy,by,xy=zu(),wy=30,_y=12,Sy=15,Ay=852,My=592,Py=0,Cy=1,Ty=2,Ey=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Iy=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Ly=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Ry=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],Oy=0,Dy=1,Ny=2,ky=4,Fy=5,zy=6,By=0,Uy=1,jy=2,$y=-2,Vy=-3,Gy=-4,Hy=-5,Wy=8,Xy=1,qy=2,Yy=3,Zy=4,Ky=5,Qy=6,Jy=7,tb=8,eb=9,ib=10,nb=11,rb=12,ob=13,ab=14,sb=15,cb=16,ub=17,hb=18,lb=19,db=20,fb=21,pb=22,mb=23,gb=24,vb=25,yb=26,bb=27,xb=28,wb=29,_b=30,Sb=31,Ab=32,Mb=852,Pb=592,Cb=!0,Tb=!0,Eb=!0;try{String.fromCharCode.apply(null,[0])}catch(t){Tb=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Eb=!1}for(var Ib=new Uint8Array(256),Lb=0;Lb<256;Lb++)Ib[Lb]=Lb>=252?6:Lb>=248?5:Lb>=240?4:Lb>=224?3:Lb>=192?2:1;Ib[254]=Ib[254]=1;var Rb=0,Ob=2,Db=4,Nb=0,kb=1,Fb=2,zb=-5,Bb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ub=Object.prototype.toString;sh.prototype.push=function(t,e){var i,n,r,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;n=e===~~e?e:e===!0?Db:Rb,"string"==typeof t?c.input=ih(t):"[object ArrayBuffer]"===Ub.call(t)?c.input=new Uint8Array(t):c.input=t,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new Uint8Array(u),c.next_out=0,c.avail_out=u),i=Zu(c,Rb),i===Fb&&h&&(s="string"==typeof h?th(h):"[object ArrayBuffer]"===Ub.call(h)?new Uint8Array(h):h,i=Ju(this.strm,s)),i===zb&&l===!0&&(i=Nb,l=!1),i!==kb&&i!==Nb)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&i!==kb&&(0!==c.avail_in||n!==Db&&n!==Ob)||("string"===this.options.to?(r=rh(c.output,c.next_out),o=c.next_out-r,a=nh(c.output,r),c.next_out=o,c.avail_out=u-o,o&&Nu(c.output,c.output,r,o,0),this.onData(a)):this.onData(Du(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&i!==kb);return i===kb&&(n=Db),n===Db?(i=Ku(this.strm),this.onEnd(i),this.ended=!0,i===Nb):n!==Ob||(this.onEnd(Nb),c.avail_out=0,!0)},sh.prototype.onData=function(t){this.chunks.push(t)},sh.prototype.onEnd=function(t){t===Nb&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ku(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Dv.add("gz",uh);var jb="//files.rcsb.org/download/",$b="//mmtf.rcsb.org/v1.0/",Vb=$b+"full/",Gb=$b+"reduced/";Iv.add("rcsb",new hh);var Hb="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",Wb="/SDF?record_type=3d";Iv.add("pubchem",new lh),Iv.add("ftp",new dh),Iv.add("http",new dh),Iv.add("https",new dh);var Xb="0.10.0-dev.5";"undefined"==typeof window||window.Promise||(window.Promise=n),t.Version=Xb,t.setDebug=ar,t.DatasourceRegistry=Iv,t.StaticDatasource=fh,t.ParserRegistry=Rv,t.autoLoad=gr,t.RepresentationRegistry=Lv,t.ColorMakerRegistry=Ev,t.ColorMaker=Fn,t.Selection=On,t.PdbWriter=xr,t.Stage=ws,t.Collection=vs,t.ComponentCollection=ys,t.RepresentationCollection=bs,t.Assembly=Wo,t.TrajectoryPlayer=_s,t.superpose=As,t.guessElement=iy,t.Queue=Ca,t.Counter=wr,t.throttle=b,t.download=v,t.getQuery=h,t.getDataInfo=mr,t.getFileInfo=y,t.uniqueArray=x,t.BufferRepresentation=es,t.SphereBuffer=Va,t.EllipsoidBuffer=Ha,t.CylinderBuffer=Ya,t.ConeBuffer=Ka,t.ArrowBuffer=Qa,t.Shape=Ja,t.Kdtree=Vo,t.SpatialHash=Lo,t.Signal=Rn,t.Matrix3=Lt,t.Matrix4=O,t.Vector2=I,t.Vector3=N,t.Box3=Et,t.Quaternion=D,t.Plane=Rt,t.Color=Ct,Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/mdsrv/webapp/js/ui/ui.helper.js b/mdsrv/webapp/js/ui/ui.helper.js new file mode 100644 index 0000000..d8e36e1 --- /dev/null +++ b/mdsrv/webapp/js/ui/ui.helper.js @@ -0,0 +1,364 @@ +/** + * @file UI HELPER + * @author Alexander Rose + */ + +var unicodeHelper = function(){ + + var replace_map = { + "{alpha}": "\u03B1", + "{beta}": "\u03B2", + "{gamma}": "\u03B3", + "{dot}": "\u00B7", + "{bullet}": "\u2022", + } + + var keys = Object.keys( replace_map ).join('|'); + + var rg = new RegExp( '(' + keys + ')', 'gi' ); + + return function( str ){ + + return str.replace( + rg, function( s, p1, p2, offset, sx ){ + return replace_map[ String( s ) ]; + } + ); + + }; + +}(); + + +function scriptHelperFunctions( stage, panel ){ + + var U = unicodeHelper; + + // + + function components( name ){ + + return stage.getComponentsByName( name ); + + } + + function representations( name ){ + + return stage.getRepresentationsByName( name ); + + } + + function structures( name ){ + + return stage.getComponentsByName( name, NGL.StructureComponent ); + + } + + // + + function color( value, collection ){ + + collection.setColor( value ); + + } + + function visibility( value, collection ){ + + collection.setVisibility( value ); + + } + + function hide( collection ){ + + visibility( false, collection ); + + } + + function show( collection, only ){ + + if( only ) hide(); + + visibility( true, collection ); + + } + + function superpose( comp1, comp2, align, sele1, sele2, xsele1, xsele2 ){ + + comp1.superpose( comp2, align, sele1, sele2, xsele1, xsele2 ); + + } + + // + + function uiText( text, newline ){ + + var elm = new UI.Text( U( text ) ); + + panel.add( elm ); + + if( newline ) uiBreak( 1 ); + + return elm; + + } + + function uiHtml( html, newline ){ + + var elm = new UI.Html( U( html ) ); + + panel.add( elm ); + + if( newline ) uiBreak( 1 ); + + return elm; + + } + + function uiBreak( n ){ + + n = n === undefined ? 1 : n; + + for( var i = 0; i < n; ++i ){ + + panel.add( new UI.Break() ); + + } + + } + + function uiButton( label, callback ){ + + var btn = new UI.Button( U( label ) ).onClick( function(){ + callback( btn ); + } ); + + panel.add( btn ); + + return btn; + + } + + function uiSelect( options, callback ){ + + if( Array.isArray( options ) ){ + var newOptions = {}; + options.forEach( function( name ){ + newOptions[ name ] = name; + } ); + options = newOptions; + } + + var select = new UI.Select() + .setOptions( options ) + .onChange( function(){ + callback( select ); + } ); + + panel.add( select ); + + return select; + + } + +/* + function uiOpenButton( label, callback, extensionList ){ + + var btn = new UI.Button( U( label ) ).onClick( function(){ + + NGL.open( callback, extensionList ); + + } ); + + panel.add( btn ); + + return btn; + + } +*/ + + function uiDownloadButton( label, callback, downloadName ){ + + var btn = new UI.Button( U( label ) ).onClick( function(){ + + NGL.download( callback, downloadName ); + + } ); + + panel.add( btn ); + + return btn; + + } + + function uiVisibilitySelect( collection ){ + + var list = collection.list; + + function getVisible(){ + + var nameList = []; + + list.forEach( function( o ){ + + if( o.visible ) nameList.push( o.name ); + + } ); + + return nameList; + + } + + var options = { "": "[show]" }; + + list.forEach( function( o ){ + + options[ o.name ] = o.name; + + o.signals.visibilityChanged.add( function(){ + + var nameList = getVisible(); + + if( nameList.length === list.length ){ + select.setValue( "" ); + }else if( o.visible ){ + select.setValue( o.name ); + }else{ + select.setValue( nameList[ 0 ] ); + } + + } ); + + } ); + + var select = new UI.Select() + .setOptions( options ) + .onChange( function(){ + + var name = select.getValue(); + + if( name === "" ){ + show( collection ); + }else{ + hide( collection ); + show( stage.getAnythingByName( name ) ); + } + + } ); + + panel.add( select ); + + return select; + + } + + function uiVisibilityButton( label, collection ){ + + label = U( label ? label : "all" ); + collection = collection || new NGL.Collection(); + + if( !( collection instanceof NGL.Collection ) && + !( collection instanceof NGL.ComponentCollection ) && + !( collection instanceof NGL.RepresentationCollection ) + ){ + collection = new NGL.Collection( [ collection ] ); + } + + var list = collection.list; + + function isVisible(){ + + var visible = false; + + list.forEach( function( o ){ + + if( o.visible ) visible = true; + + } ); + + return visible; + + } + + function getLabel( value ){ + + return ( isVisible() ? "hide " : "show " ) + label; + + } + + list.forEach( function( o ){ + + o.signals.visibilityChanged.add( function(){ + + btn.setLabel( getLabel() ); + + } ); + + } ); + + var btn = new UI.Button( getLabel() ).onClick( function(){ + + visibility( !isVisible(), collection ); + + } ); + + // panel.add( btn ); + + return btn; + + } + + function uiPlayButton( label, trajComp, step, timeout, start, end ){ + + var traj = trajComp.trajectory; + label = U( label ); + + var player = new NGL.TrajectoryPlayer( traj, step, timeout, start, end ); + player.mode = "once"; + + var btn = new UI.Button( "play " + label ) + .onClick( function(){ + player.toggle(); + } ); + + player.signals.startedRunning.add( function(){ + btn.setLabel( "pause " + label ); + } ); + + player.signals.haltedRunning.add( function(){ + btn.setLabel( "play " + label ); + } ); + + panel.add( btn ); + + return btn; + + } + + // + + return { + + 'components': components, + 'representations': representations, + 'structures': structures, + + 'color': color, + 'visible': visibility, + 'hide': hide, + 'show': show, + 'superpose': superpose, + + 'uiText': uiText, + 'uiHtml': uiHtml, + 'uiBreak': uiBreak, + 'uiSelect': uiSelect, + 'uiButton': uiButton, + //'uiOpenButton': uiOpenButton, + 'uiDownloadButton': uiDownloadButton, + 'uiVisibilitySelect': uiVisibilitySelect, + 'uiVisibilityButton': uiVisibilityButton, + 'uiPlayButton': uiPlayButton, + + }; + +}; diff --git a/setup.cfg b/setup.cfg index 224a779..53b6578 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,13 @@ [metadata] -description-file = README.md \ No newline at end of file +description-file = README.md +# See the docstring in versioneer.py for instructions. Note that you must +# re-run 'versioneer.py setup' after changing this section, and commit the +# resulting files. + +[versioneer] +VCS = git +style = pep440 +versionfile_source = mdsrv/_version.py +versionfile_build = mdsrv/_version.py +tag_prefix = v +#parentdir_prefix = diff --git a/setup.py b/setup.py index 5d9d7e2..45347f8 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,21 @@ #!/usr/bin/env python -from setuptools import setup +from setuptools import setup, find_packages + +import os + +import versioneer +from versioneer import get_cmdclass +sdist = get_cmdclass()['sdist'] +build_py = get_cmdclass()['build_py'] + +here = os.path.dirname(os.path.abspath(__file__)) +node_root = os.path.join(here, 'js') +is_repo = os.path.exists(os.path.join(here, '.git')) + + -VERSION = "0.2" CLASSIFIERS = [ "Development Status :: 3 - Alpha", "Intended Audience :: Science/Research", @@ -23,23 +35,35 @@ ] -if __name__ == '__main__': - setup( - name="MDsrv", - author="Alexander S. Rose", - author_email="alexander.rose@weirdbyte.de", - description="Server for coordinate trajectories from molecular dynamics simulations", - version=VERSION, - classifiers=CLASSIFIERS, - license="MIT", - url="https://github.com/arose/mdsrv", - zip_safe=False, - include_package_data=True, # use MANIFEST.in during install - packages=["mdsrv"], - install_requires=["flask", "simpletraj"], - entry_points={ - "console_scripts": [ - 'mdsrv = mdsrv:entry_point' - ] - } - ) + +setup_args = { + 'name': 'MDsrv', + 'version': versioneer.get_version(), + 'description': 'Server for coordinate trajectories from molecular dynamics simulations.', + 'include_package_data': True, + 'package_data': { + "mdsrv.data": ["*"] + }, + 'license': "MIT", + 'entry_points': {'console_scripts': + ['mdsrv = mdsrv:entry_point',] + }, + 'install_requires': { + "flask": ["flask"], + "simpletraj": ["simpletraj"], + }, + 'packages': set(find_packages() + + ['mdsrv']), + 'zip_safe': False, + 'cmdclass': versioneer.get_cmdclass(), + 'author': 'Alexander S. Rose', + 'author_email': 'alexander.rose@weirdbyte.de', + 'url': 'https://github.com/arose/mdsrv', + 'keywords': [ + 'Molecular Dynamics simulation', + ], + 'classifiers': CLASSIFIERS, +} + + +setup(**setup_args) diff --git a/versioneer.py b/versioneer.py new file mode 100644 index 0000000..64fea1c --- /dev/null +++ b/versioneer.py @@ -0,0 +1,1822 @@ + +# Version: 0.18 + +"""The Versioneer - like a rocketeer, but for versions. + +The Versioneer +============== + +* like a rocketeer, but for versions! +* https://github.com/warner/python-versioneer +* Brian Warner +* License: Public Domain +* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy +* [![Latest Version] +(https://pypip.in/version/versioneer/badge.svg?style=flat) +](https://pypi.python.org/pypi/versioneer/) +* [![Build Status] +(https://travis-ci.org/warner/python-versioneer.png?branch=master) +](https://travis-ci.org/warner/python-versioneer) + +This is a tool for managing a recorded version number in distutils-based +python projects. The goal is to remove the tedious and error-prone "update +the embedded version string" step from your release process. Making a new +release should be as easy as recording a new tag in your version-control +system, and maybe making new tarballs. + + +## Quick Install + +* `pip install versioneer` to somewhere to your $PATH +* add a `[versioneer]` section to your setup.cfg (see below) +* run `versioneer install` in your source tree, commit the results + +## Version Identifiers + +Source trees come from a variety of places: + +* a version-control system checkout (mostly used by developers) +* a nightly tarball, produced by build automation +* a snapshot tarball, produced by a web-based VCS browser, like github's + "tarball from tag" feature +* a release tarball, produced by "setup.py sdist", distributed through PyPI + +Within each source tree, the version identifier (either a string or a number, +this tool is format-agnostic) can come from a variety of places: + +* ask the VCS tool itself, e.g. "git describe" (for checkouts), which knows + about recent "tags" and an absolute revision-id +* the name of the directory into which the tarball was unpacked +* an expanded VCS keyword ($Id$, etc) +* a `_version.py` created by some earlier build step + +For released software, the version identifier is closely related to a VCS +tag. Some projects use tag names that include more than just the version +string (e.g. "myproject-1.2" instead of just "1.2"), in which case the tool +needs to strip the tag prefix to extract the version identifier. For +unreleased software (between tags), the version identifier should provide +enough information to help developers recreate the same tree, while also +giving them an idea of roughly how old the tree is (after version 1.2, before +version 1.3). Many VCS systems can report a description that captures this, +for example `git describe --tags --dirty --always` reports things like +"0.7-1-g574ab98-dirty" to indicate that the checkout is one revision past the +0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has +uncommitted changes. + +The version identifier is used for multiple purposes: + +* to allow the module to self-identify its version: `myproject.__version__` +* to choose a name and prefix for a 'setup.py sdist' tarball + +## Theory of Operation + +Versioneer works by adding a special `_version.py` file into your source +tree, where your `__init__.py` can import it. This `_version.py` knows how to +dynamically ask the VCS tool for version information at import time. + +`_version.py` also contains `$Revision$` markers, and the installation +process marks `_version.py` to have this marker rewritten with a tag name +during the `git archive` command. As a result, generated tarballs will +contain enough information to get the proper version. + +To allow `setup.py` to compute a version too, a `versioneer.py` is added to +the top level of your source tree, next to `setup.py` and the `setup.cfg` +that configures it. This overrides several distutils/setuptools commands to +compute the version when invoked, and changes `setup.py build` and `setup.py +sdist` to replace `_version.py` with a small static file that contains just +the generated version data. + +## Installation + +See [INSTALL.md](./INSTALL.md) for detailed installation instructions. + +## Version-String Flavors + +Code which uses Versioneer can learn about its version string at runtime by +importing `_version` from your main `__init__.py` file and running the +`get_versions()` function. From the "outside" (e.g. in `setup.py`), you can +import the top-level `versioneer.py` and run `get_versions()`. + +Both functions return a dictionary with different flavors of version +information: + +* `['version']`: A condensed version string, rendered using the selected + style. This is the most commonly used value for the project's version + string. The default "pep440" style yields strings like `0.11`, + `0.11+2.g1076c97`, or `0.11+2.g1076c97.dirty`. See the "Styles" section + below for alternative styles. + +* `['full-revisionid']`: detailed revision identifier. For Git, this is the + full SHA1 commit id, e.g. "1076c978a8d3cfc70f408fe5974aa6c092c949ac". + +* `['date']`: Date and time of the latest `HEAD` commit. For Git, it is the + commit date in ISO 8601 format. This will be None if the date is not + available. + +* `['dirty']`: a boolean, True if the tree has uncommitted changes. Note that + this is only accurate if run in a VCS checkout, otherwise it is likely to + be False or None + +* `['error']`: if the version string could not be computed, this will be set + to a string describing the problem, otherwise it will be None. It may be + useful to throw an exception in setup.py if this is set, to avoid e.g. + creating tarballs with a version string of "unknown". + +Some variants are more useful than others. Including `full-revisionid` in a +bug report should allow developers to reconstruct the exact code being tested +(or indicate the presence of local changes that should be shared with the +developers). `version` is suitable for display in an "about" box or a CLI +`--version` output: it can be easily compared against release notes and lists +of bugs fixed in various releases. + +The installer adds the following text to your `__init__.py` to place a basic +version in `YOURPROJECT.__version__`: + + from ._version import get_versions + __version__ = get_versions()['version'] + del get_versions + +## Styles + +The setup.cfg `style=` configuration controls how the VCS information is +rendered into a version string. + +The default style, "pep440", produces a PEP440-compliant string, equal to the +un-prefixed tag name for actual releases, and containing an additional "local +version" section with more detail for in-between builds. For Git, this is +TAG[+DISTANCE.gHEX[.dirty]] , using information from `git describe --tags +--dirty --always`. For example "0.11+2.g1076c97.dirty" indicates that the +tree is like the "1076c97" commit but has uncommitted changes (".dirty"), and +that this commit is two revisions ("+2") beyond the "0.11" tag. For released +software (exactly equal to a known tag), the identifier will only contain the +stripped tag, e.g. "0.11". + +Other styles are available. See [details.md](details.md) in the Versioneer +source tree for descriptions. + +## Debugging + +Versioneer tries to avoid fatal errors: if something goes wrong, it will tend +to return a version of "0+unknown". To investigate the problem, run `setup.py +version`, which will run the version-lookup code in a verbose mode, and will +display the full contents of `get_versions()` (including the `error` string, +which may help identify what went wrong). + +## Known Limitations + +Some situations are known to cause problems for Versioneer. This details the +most significant ones. More can be found on Github +[issues page](https://github.com/warner/python-versioneer/issues). + +### Subprojects + +Versioneer has limited support for source trees in which `setup.py` is not in +the root directory (e.g. `setup.py` and `.git/` are *not* siblings). The are +two common reasons why `setup.py` might not be in the root: + +* Source trees which contain multiple subprojects, such as + [Buildbot](https://github.com/buildbot/buildbot), which contains both + "master" and "slave" subprojects, each with their own `setup.py`, + `setup.cfg`, and `tox.ini`. Projects like these produce multiple PyPI + distributions (and upload multiple independently-installable tarballs). +* Source trees whose main purpose is to contain a C library, but which also + provide bindings to Python (and perhaps other langauges) in subdirectories. + +Versioneer will look for `.git` in parent directories, and most operations +should get the right version string. However `pip` and `setuptools` have bugs +and implementation details which frequently cause `pip install .` from a +subproject directory to fail to find a correct version string (so it usually +defaults to `0+unknown`). + +`pip install --editable .` should work correctly. `setup.py install` might +work too. + +Pip-8.1.1 is known to have this problem, but hopefully it will get fixed in +some later version. + +[Bug #38](https://github.com/warner/python-versioneer/issues/38) is tracking +this issue. The discussion in +[PR #61](https://github.com/warner/python-versioneer/pull/61) describes the +issue from the Versioneer side in more detail. +[pip PR#3176](https://github.com/pypa/pip/pull/3176) and +[pip PR#3615](https://github.com/pypa/pip/pull/3615) contain work to improve +pip to let Versioneer work correctly. + +Versioneer-0.16 and earlier only looked for a `.git` directory next to the +`setup.cfg`, so subprojects were completely unsupported with those releases. + +### Editable installs with setuptools <= 18.5 + +`setup.py develop` and `pip install --editable .` allow you to install a +project into a virtualenv once, then continue editing the source code (and +test) without re-installing after every change. + +"Entry-point scripts" (`setup(entry_points={"console_scripts": ..})`) are a +convenient way to specify executable scripts that should be installed along +with the python package. + +These both work as expected when using modern setuptools. When using +setuptools-18.5 or earlier, however, certain operations will cause +`pkg_resources.DistributionNotFound` errors when running the entrypoint +script, which must be resolved by re-installing the package. This happens +when the install happens with one version, then the egg_info data is +regenerated while a different version is checked out. Many setup.py commands +cause egg_info to be rebuilt (including `sdist`, `wheel`, and installing into +a different virtualenv), so this can be surprising. + +[Bug #83](https://github.com/warner/python-versioneer/issues/83) describes +this one, but upgrading to a newer version of setuptools should probably +resolve it. + +### Unicode version strings + +While Versioneer works (and is continually tested) with both Python 2 and +Python 3, it is not entirely consistent with bytes-vs-unicode distinctions. +Newer releases probably generate unicode version strings on py2. It's not +clear that this is wrong, but it may be surprising for applications when then +write these strings to a network connection or include them in bytes-oriented +APIs like cryptographic checksums. + +[Bug #71](https://github.com/warner/python-versioneer/issues/71) investigates +this question. + + +## Updating Versioneer + +To upgrade your project to a new release of Versioneer, do the following: + +* install the new Versioneer (`pip install -U versioneer` or equivalent) +* edit `setup.cfg`, if necessary, to include any new configuration settings + indicated by the release notes. See [UPGRADING](./UPGRADING.md) for details. +* re-run `versioneer install` in your source tree, to replace + `SRC/_version.py` +* commit any changed files + +## Future Directions + +This tool is designed to make it easily extended to other version-control +systems: all VCS-specific components are in separate directories like +src/git/ . The top-level `versioneer.py` script is assembled from these +components by running make-versioneer.py . In the future, make-versioneer.py +will take a VCS name as an argument, and will construct a version of +`versioneer.py` that is specific to the given VCS. It might also take the +configuration arguments that are currently provided manually during +installation by editing setup.py . Alternatively, it might go the other +direction and include code from all supported VCS systems, reducing the +number of intermediate scripts. + + +## License + +To make Versioneer easier to embed, all its code is dedicated to the public +domain. The `_version.py` that it creates is also in the public domain. +Specifically, both are released under the Creative Commons "Public Domain +Dedication" license (CC0-1.0), as described in +https://creativecommons.org/publicdomain/zero/1.0/ . + +""" + +from __future__ import print_function +try: + import configparser +except ImportError: + import ConfigParser as configparser +import errno +import json +import os +import re +import subprocess +import sys + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_root(): + """Get the project root directory. + + We require that all commands are run from the project root, i.e. the + directory that contains setup.py, setup.cfg, and versioneer.py . + """ + root = os.path.realpath(os.path.abspath(os.getcwd())) + setup_py = os.path.join(root, "setup.py") + versioneer_py = os.path.join(root, "versioneer.py") + if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): + # allow 'python path/to/setup.py COMMAND' + root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) + setup_py = os.path.join(root, "setup.py") + versioneer_py = os.path.join(root, "versioneer.py") + if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): + err = ("Versioneer was unable to run the project root directory. " + "Versioneer requires setup.py to be executed from " + "its immediate directory (like 'python setup.py COMMAND'), " + "or in a way that lets it use sys.argv[0] to find the root " + "(like 'python path/to/setup.py COMMAND').") + raise VersioneerBadRootError(err) + try: + # Certain runtime workflows (setup.py install/develop in a setuptools + # tree) execute all dependencies in a single python process, so + # "versioneer" may be imported multiple times, and python's shared + # module-import table will cache the first one. So we can't use + # os.path.dirname(__file__), as that will find whichever + # versioneer.py was first imported, even in later projects. + me = os.path.realpath(os.path.abspath(__file__)) + me_dir = os.path.normcase(os.path.splitext(me)[0]) + vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) + if me_dir != vsr_dir: + print("Warning: build in %s is using versioneer.py from %s" + % (os.path.dirname(me), versioneer_py)) + except NameError: + pass + return root + + +def get_config_from_root(root): + """Read the project setup.cfg file to determine Versioneer config.""" + # This might raise EnvironmentError (if setup.cfg is missing), or + # configparser.NoSectionError (if it lacks a [versioneer] section), or + # configparser.NoOptionError (if it lacks "VCS="). See the docstring at + # the top of versioneer.py for instructions on writing your setup.cfg . + setup_cfg = os.path.join(root, "setup.cfg") + parser = configparser.SafeConfigParser() + with open(setup_cfg, "r") as f: + parser.readfp(f) + VCS = parser.get("versioneer", "VCS") # mandatory + + def get(parser, name): + if parser.has_option("versioneer", name): + return parser.get("versioneer", name) + return None + cfg = VersioneerConfig() + cfg.VCS = VCS + cfg.style = get(parser, "style") or "" + cfg.versionfile_source = get(parser, "versionfile_source") + cfg.versionfile_build = get(parser, "versionfile_build") + cfg.tag_prefix = get(parser, "tag_prefix") + if cfg.tag_prefix in ("''", '""'): + cfg.tag_prefix = "" + cfg.parentdir_prefix = get(parser, "parentdir_prefix") + cfg.verbose = get(parser, "verbose") + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +# these dictionaries contain VCS-specific tools +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, p.returncode + return stdout, p.returncode + + +LONG_VERSION_PY['git'] = ''' +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.18 (https://github.com/warner/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "%(DOLLAR)sFormat:%%d%(DOLLAR)s" + git_full = "%(DOLLAR)sFormat:%%H%(DOLLAR)s" + git_date = "%(DOLLAR)sFormat:%%ci%(DOLLAR)s" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "%(STYLE)s" + cfg.tag_prefix = "%(TAG_PREFIX)s" + cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s" + cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %%s" %% dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %%s" %% (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %%s (error)" %% dispcmd) + print("stdout was %%s" %% stdout) + return None, p.returncode + return stdout, p.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %%s but none started with prefix %%s" %% + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %%d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%%s', no digits" %% ",".join(refs - tags)) + if verbose: + print("likely tags: %%s" %% ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %%s" %% r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %%s not under git control" %% root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%%s*" %% tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%%s'" + %% describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%%s' doesn't start with prefix '%%s'" + print(fmt %% (full_tag, tag_prefix)) + pieces["error"] = ("tag '%%s' doesn't start with prefix '%%s'" + %% (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%%d.g%%s" %% (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%%d" %% pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%%d" %% pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%%s" %% pieces["short"] + else: + # exception #1 + rendered = "0.post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%%s" %% pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%%s'" %% style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for i in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} +''' + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def do_vcs_install(manifest_in, versionfile_source, ipy): + """Git-specific installation logic for Versioneer. + + For Git, this means creating/changing .gitattributes to mark _version.py + for export-subst keyword substitution. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + files = [manifest_in, versionfile_source] + if ipy: + files.append(ipy) + try: + me = __file__ + if me.endswith(".pyc") or me.endswith(".pyo"): + me = os.path.splitext(me)[0] + ".py" + versioneer_file = os.path.relpath(me) + except NameError: + versioneer_file = "versioneer.py" + files.append(versioneer_file) + present = False + try: + f = open(".gitattributes", "r") + for line in f.readlines(): + if line.strip().startswith(versionfile_source): + if "export-subst" in line.strip().split()[1:]: + present = True + f.close() + except EnvironmentError: + pass + if not present: + f = open(".gitattributes", "a+") + f.write("%s export-subst\n" % versionfile_source) + f.close() + files.append(".gitattributes") + run_command(GITS, ["add", "--"] + files) + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +SHORT_VERSION_PY = """ +# This file was generated by 'versioneer.py' (0.18) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. + +import json + +version_json = ''' +%s +''' # END VERSION_JSON + + +def get_versions(): + return json.loads(version_json) +""" + + +def versions_from_file(filename): + """Try to determine the version from _version.py if present.""" + try: + with open(filename) as f: + contents = f.read() + except EnvironmentError: + raise NotThisMethod("unable to read _version.py") + mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", + contents, re.M | re.S) + if not mo: + mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", + contents, re.M | re.S) + if not mo: + raise NotThisMethod("no version_json in _version.py") + return json.loads(mo.group(1)) + + +def write_to_version_file(filename, versions): + """Write the given version number to the given _version.py file.""" + os.unlink(filename) + contents = json.dumps(versions, sort_keys=True, + indent=1, separators=(",", ": ")) + with open(filename, "w") as f: + f.write(SHORT_VERSION_PY % contents) + + print("set %s to '%s'" % (filename, versions["version"])) + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%d" % pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +class VersioneerBadRootError(Exception): + """The project root directory is unknown or missing key files.""" + + +def get_versions(verbose=False): + """Get the project version from whatever source is available. + + Returns dict with two keys: 'version' and 'full'. + """ + if "versioneer" in sys.modules: + # see the discussion in cmdclass.py:get_cmdclass() + del sys.modules["versioneer"] + + root = get_root() + cfg = get_config_from_root(root) + + assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg" + handlers = HANDLERS.get(cfg.VCS) + assert handlers, "unrecognized VCS '%s'" % cfg.VCS + verbose = verbose or cfg.verbose + assert cfg.versionfile_source is not None, \ + "please set versioneer.versionfile_source" + assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" + + versionfile_abs = os.path.join(root, cfg.versionfile_source) + + # extract version from first of: _version.py, VCS command (e.g. 'git + # describe'), parentdir. This is meant to work for developers using a + # source checkout, for users of a tarball created by 'setup.py sdist', + # and for users of a tarball/zipball created by 'git archive' or github's + # download-from-tag feature or the equivalent in other VCSes. + + get_keywords_f = handlers.get("get_keywords") + from_keywords_f = handlers.get("keywords") + if get_keywords_f and from_keywords_f: + try: + keywords = get_keywords_f(versionfile_abs) + ver = from_keywords_f(keywords, cfg.tag_prefix, verbose) + if verbose: + print("got version from expanded keyword %s" % ver) + return ver + except NotThisMethod: + pass + + try: + ver = versions_from_file(versionfile_abs) + if verbose: + print("got version from file %s %s" % (versionfile_abs, ver)) + return ver + except NotThisMethod: + pass + + from_vcs_f = handlers.get("pieces_from_vcs") + if from_vcs_f: + try: + pieces = from_vcs_f(cfg.tag_prefix, root, verbose) + ver = render(pieces, cfg.style) + if verbose: + print("got version from VCS %s" % ver) + return ver + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + if verbose: + print("got version from parentdir %s" % ver) + return ver + except NotThisMethod: + pass + + if verbose: + print("unable to compute version") + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, "error": "unable to compute version", + "date": None} + + +def get_version(): + """Get the short version string for this project.""" + return get_versions()["version"] + + +def get_cmdclass(): + """Get the custom setuptools/distutils subclasses used by Versioneer.""" + if "versioneer" in sys.modules: + del sys.modules["versioneer"] + # this fixes the "python setup.py develop" case (also 'install' and + # 'easy_install .'), in which subdependencies of the main project are + # built (using setup.py bdist_egg) in the same python process. Assume + # a main project A and a dependency B, which use different versions + # of Versioneer. A's setup.py imports A's Versioneer, leaving it in + # sys.modules by the time B's setup.py is executed, causing B to run + # with the wrong versioneer. Setuptools wraps the sub-dep builds in a + # sandbox that restores sys.modules to it's pre-build state, so the + # parent is protected against the child's "import versioneer". By + # removing ourselves from sys.modules here, before the child build + # happens, we protect the child from the parent's versioneer too. + # Also see https://github.com/warner/python-versioneer/issues/52 + + cmds = {} + + # we add "version" to both distutils and setuptools + from distutils.core import Command + + class cmd_version(Command): + description = "report generated version string" + user_options = [] + boolean_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + vers = get_versions(verbose=True) + print("Version: %s" % vers["version"]) + print(" full-revisionid: %s" % vers.get("full-revisionid")) + print(" dirty: %s" % vers.get("dirty")) + print(" date: %s" % vers.get("date")) + if vers["error"]: + print(" error: %s" % vers["error"]) + cmds["version"] = cmd_version + + # we override "build_py" in both distutils and setuptools + # + # most invocation pathways end up running build_py: + # distutils/build -> build_py + # distutils/install -> distutils/build ->.. + # setuptools/bdist_wheel -> distutils/install ->.. + # setuptools/bdist_egg -> distutils/install_lib -> build_py + # setuptools/install -> bdist_egg ->.. + # setuptools/develop -> ? + # pip install: + # copies source tree to a tempdir before running egg_info/etc + # if .git isn't copied too, 'git describe' will fail + # then does setup.py bdist_wheel, or sometimes setup.py install + # setup.py egg_info -> ? + + # we override different "build_py" commands for both environments + if "setuptools" in sys.modules: + from setuptools.command.build_py import build_py as _build_py + else: + from distutils.command.build_py import build_py as _build_py + + class cmd_build_py(_build_py): + def run(self): + root = get_root() + cfg = get_config_from_root(root) + versions = get_versions() + _build_py.run(self) + # now locate _version.py in the new build/ directory and replace + # it with an updated value + if cfg.versionfile_build: + target_versionfile = os.path.join(self.build_lib, + cfg.versionfile_build) + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, versions) + cmds["build_py"] = cmd_build_py + + if "cx_Freeze" in sys.modules: # cx_freeze enabled? + from cx_Freeze.dist import build_exe as _build_exe + # nczeczulin reports that py2exe won't like the pep440-style string + # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. + # setup(console=[{ + # "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION + # "product_version": versioneer.get_version(), + # ... + + class cmd_build_exe(_build_exe): + def run(self): + root = get_root() + cfg = get_config_from_root(root) + versions = get_versions() + target_versionfile = cfg.versionfile_source + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, versions) + + _build_exe.run(self) + os.unlink(target_versionfile) + with open(cfg.versionfile_source, "w") as f: + LONG = LONG_VERSION_PY[cfg.VCS] + f.write(LONG % + {"DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["build_exe"] = cmd_build_exe + del cmds["build_py"] + + if 'py2exe' in sys.modules: # py2exe enabled? + try: + from py2exe.distutils_buildexe import py2exe as _py2exe # py3 + except ImportError: + from py2exe.build_exe import py2exe as _py2exe # py2 + + class cmd_py2exe(_py2exe): + def run(self): + root = get_root() + cfg = get_config_from_root(root) + versions = get_versions() + target_versionfile = cfg.versionfile_source + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, versions) + + _py2exe.run(self) + os.unlink(target_versionfile) + with open(cfg.versionfile_source, "w") as f: + LONG = LONG_VERSION_PY[cfg.VCS] + f.write(LONG % + {"DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["py2exe"] = cmd_py2exe + + # we override different "sdist" commands for both environments + if "setuptools" in sys.modules: + from setuptools.command.sdist import sdist as _sdist + else: + from distutils.command.sdist import sdist as _sdist + + class cmd_sdist(_sdist): + def run(self): + versions = get_versions() + self._versioneer_generated_versions = versions + # unless we update this, the command will keep using the old + # version + self.distribution.metadata.version = versions["version"] + return _sdist.run(self) + + def make_release_tree(self, base_dir, files): + root = get_root() + cfg = get_config_from_root(root) + _sdist.make_release_tree(self, base_dir, files) + # now locate _version.py in the new base_dir directory + # (remembering that it may be a hardlink) and replace it with an + # updated value + target_versionfile = os.path.join(base_dir, cfg.versionfile_source) + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, + self._versioneer_generated_versions) + cmds["sdist"] = cmd_sdist + + return cmds + + +CONFIG_ERROR = """ +setup.cfg is missing the necessary Versioneer configuration. You need +a section like: + + [versioneer] + VCS = git + style = pep440 + versionfile_source = src/myproject/_version.py + versionfile_build = myproject/_version.py + tag_prefix = + parentdir_prefix = myproject- + +You will also need to edit your setup.py to use the results: + + import versioneer + setup(version=versioneer.get_version(), + cmdclass=versioneer.get_cmdclass(), ...) + +Please read the docstring in ./versioneer.py for configuration instructions, +edit setup.cfg, and re-run the installer or 'python versioneer.py setup'. +""" + +SAMPLE_CONFIG = """ +# See the docstring in versioneer.py for instructions. Note that you must +# re-run 'versioneer.py setup' after changing this section, and commit the +# resulting files. + +[versioneer] +#VCS = git +#style = pep440 +#versionfile_source = +#versionfile_build = +#tag_prefix = +#parentdir_prefix = + +""" + +INIT_PY_SNIPPET = """ +from ._version import get_versions +__version__ = get_versions()['version'] +del get_versions +""" + + +def do_setup(): + """Main VCS-independent setup function for installing Versioneer.""" + root = get_root() + try: + cfg = get_config_from_root(root) + except (EnvironmentError, configparser.NoSectionError, + configparser.NoOptionError) as e: + if isinstance(e, (EnvironmentError, configparser.NoSectionError)): + print("Adding sample versioneer config to setup.cfg", + file=sys.stderr) + with open(os.path.join(root, "setup.cfg"), "a") as f: + f.write(SAMPLE_CONFIG) + print(CONFIG_ERROR, file=sys.stderr) + return 1 + + print(" creating %s" % cfg.versionfile_source) + with open(cfg.versionfile_source, "w") as f: + LONG = LONG_VERSION_PY[cfg.VCS] + f.write(LONG % {"DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + + ipy = os.path.join(os.path.dirname(cfg.versionfile_source), + "__init__.py") + if os.path.exists(ipy): + try: + with open(ipy, "r") as f: + old = f.read() + except EnvironmentError: + old = "" + if INIT_PY_SNIPPET not in old: + print(" appending to %s" % ipy) + with open(ipy, "a") as f: + f.write(INIT_PY_SNIPPET) + else: + print(" %s unmodified" % ipy) + else: + print(" %s doesn't exist, ok" % ipy) + ipy = None + + # Make sure both the top-level "versioneer.py" and versionfile_source + # (PKG/_version.py, used by runtime code) are in MANIFEST.in, so + # they'll be copied into source distributions. Pip won't be able to + # install the package without this. + manifest_in = os.path.join(root, "MANIFEST.in") + simple_includes = set() + try: + with open(manifest_in, "r") as f: + for line in f: + if line.startswith("include "): + for include in line.split()[1:]: + simple_includes.add(include) + except EnvironmentError: + pass + # That doesn't cover everything MANIFEST.in can do + # (http://docs.python.org/2/distutils/sourcedist.html#commands), so + # it might give some false negatives. Appending redundant 'include' + # lines is safe, though. + if "versioneer.py" not in simple_includes: + print(" appending 'versioneer.py' to MANIFEST.in") + with open(manifest_in, "a") as f: + f.write("include versioneer.py\n") + else: + print(" 'versioneer.py' already in MANIFEST.in") + if cfg.versionfile_source not in simple_includes: + print(" appending versionfile_source ('%s') to MANIFEST.in" % + cfg.versionfile_source) + with open(manifest_in, "a") as f: + f.write("include %s\n" % cfg.versionfile_source) + else: + print(" versionfile_source already in MANIFEST.in") + + # Make VCS-specific changes. For git, this means creating/changing + # .gitattributes to mark _version.py for export-subst keyword + # substitution. + do_vcs_install(manifest_in, cfg.versionfile_source, ipy) + return 0 + + +def scan_setup_py(): + """Validate the contents of setup.py against Versioneer's expectations.""" + found = set() + setters = False + errors = 0 + with open("setup.py", "r") as f: + for line in f.readlines(): + if "import versioneer" in line: + found.add("import") + if "versioneer.get_cmdclass()" in line: + found.add("cmdclass") + if "versioneer.get_version()" in line: + found.add("get_version") + if "versioneer.VCS" in line: + setters = True + if "versioneer.versionfile_source" in line: + setters = True + if len(found) != 3: + print("") + print("Your setup.py appears to be missing some important items") + print("(but I might be wrong). Please make sure it has something") + print("roughly like the following:") + print("") + print(" import versioneer") + print(" setup( version=versioneer.get_version(),") + print(" cmdclass=versioneer.get_cmdclass(), ...)") + print("") + errors += 1 + if setters: + print("You should remove lines like 'versioneer.VCS = ' and") + print("'versioneer.versionfile_source = ' . This configuration") + print("now lives in setup.cfg, and should be removed from setup.py") + print("") + errors += 1 + return errors + + +if __name__ == "__main__": + cmd = sys.argv[1] + if cmd == "setup": + errors = do_setup() + errors += scan_setup_py() + if errors: + sys.exit(1)