PageSourceSearch

https://www.uniprot.org/legacy.nightingale.3db5cf.js

js uniprot.org collected 2026-09-24 08:36:00 UTC 3,754,745 bytes, 1,091 lines download raw bytes

1"use strict";(self.webpackChunkuniprot_website=self.webpackChunkuniprot_website||[]).push([[4607],{5007(e,t,r){var n=r(58261);const i=(e,t=0)=>{const r=(e||"").match(/(\d+\.?\d*)px/);return r?+r[1]:t};class a extends n.WF{static get properties(){return{title:{type:String,reflect:!0},x:{type:Number,reflect:!0},y:{type:Number,reflect:!0},visible:{type:Boolean,reflect:!0},container:{type:String,reflect:!0}}}constructor(){super(),this.title="",this.x=0,this.y=0,this.visible=!1,this.container="html",this._changeHandler=()=>this.requestUpdate(),this._observer=new MutationObserver(this._changeHandler)}connectedCallback(){super.connectedCallback(),this._observer.observe(this,{subtree:!0,characterData:!0,childList:!0}),window.addEventListener("resize",this._changeHandler)}disconnectedCallback(){super.disconnectedCallback(),this._observer.disconnect(),window.removeEventListener("resize",this._changeHandler)}static get styles(){return n.AH`
2      :host {
3        --z-index: 50000;
4        --title-color: black;
5        --text-color: white;
6        --body-color: #616161;
7        --triangle-width: ${16}px;
8        --triangle-height: ${10}px;
9        --triangle-margin: ${10}px;
10        --vertical-distance: ${5}px;
11      }
12
13      h1,
14      h2,
15      h3,
16      h4,
17      h5,
18      h6 {
19        margin: 0;
20      }
21
22      h1 {
23        background-color: var(--title-color);
24        line-height: 2em;
25        padding: 0 1ch;
26      }
27
28      .tooltip {
29        font-family: Roboto, Arial, sans-serif;
30        font-size: 0.9rem;
31        top: 0;
32        left: 0;
33        display: block;
34        position: absolute;
35        min-width: 220px;
36        max-width: 50vw;
37
38        /* user overridable through custom properties */
39        z-index: var(--z-index);
40        color: var(--text-color);
41
42        /* will change those */
43        opacity: 0;
44        pointer-events: none;
45        transform: translate(0, 0);
46      }
47
48      .tooltip.visible {
49        opacity: 0.9;
50        pointer-events: auto;
51      }
52
53      .tooltip::before {
54        content: "";
55        position: absolute;
56        pointer-events: none;
57        border-style: solid;
58        border-color: transparent;
59        border-width: 0 calc(var(--triangle-width) / 2);
60      }
61
62      .tooltip.arrow-left::before {
63        left: var(--triangle-margin);
64      }
65
66      .tooltip.arrow-right::before {
67        right: var(--triangle-margin);
68      }
69
70      .tooltip.arrow-up::before {
71        top: calc(-1 * var(--triangle-height));
72        border-bottom-color: var(--title-color);
73        border-bottom-width: var(--triangle-height);
74      }
75
76      .tooltip.arrow-down::before {
77        bottom: calc(-1 * var(--triangle-height));
78        border-top-color: var(--body-color);
79        border-top-width: var(--triangle-height);
80      }
81
82      :host a,
83      :host a:link,
84      :host a:active,
85      :host a:hover,
86      ::slotted(a),
87      ::slotted(a:link),
88      ::slotted(a:active),
89      ::slotted(a:hover) {
90        color: #fff;
91      }
92
93      .tooltip-body {
94        padding: 1em;
95        background: var(--body-color);
96        font-weight: normal;
97        overflow-y: auto;
98        max-height: 40vh;
99      }
100
101      ::slotted(h4) {
102        font-size: 1.2rem !important;
103        margin: 0 0 0.5rem 0 !important;
104        font-weight: 600 !important;
105        color: #fff !important;
106      }
107
108      ::slotted(h5) {
109        font-size: 1rem !important;
110        margin: 0 !important;
111        font-weight: 500 !important;
112        color: #fff !important;
113      }
114
115      ::slotted(h6) {
116        font-size: 1rem !important;
117        margin: 0 !important;
118        font-weight: 300 !important;
119        color: #fff !important;
120      }
121
122      ::slotted(p) {
123        margin: 0.25rem 0 1rem 0 !important;
124      }
125
126      ::slotted(ul) {
127        list-style: none !important;
128        margin: 0.25rem 0 1rem 0 !important;
129        padding: 0 !important;
130      }
131    `}_getPosition(){if(!this.shadowRoot.firstElementChild)return{};const e=document.querySelector(this.container||"html").getBoundingClientRect(),t=this.shadowRoot.firstElementChild.getBoundingClientRect(),r=getComputedStyle(this),n=i(r.getPropertyValue("--triangle-width"),16),a=i(r.getPropertyValue("--triangle-height"),10),o=i(r.getPropertyValue("--triangle-margin"),10),s=i(r.getPropertyValue("--vert
131ical-distance"),5);let u=this.x-n/2-o,c="left";u+t.width<=e.right||(c="right",u=this.x-t.width+n/2+o);let l=this.y+a+s,d="up";return l+t.height<=e.height||(d="down",l=this.y-t.height-a-s),{x:u,y:l,horizontal:c,vertical:d}}firstUpdated(){this.requestUpdate()}render(){let e=this.title&&this.visible;const t=e?this._getPosition():{};e=t.x&&e;const r=e&&`transform: translate(${t.x}px, ${t.y}px);`;return n.qy`
132      <section
133        class="tooltip arrow-${t.horizontal||"left"} arrow-${t.vertical||"up"} ${e?"visible":""}"
134        style="${r}"
135      >
136        <h1>${this.title}</h1>
137        <div class="tooltip-body"><slot></slot></div>
138      </section>
139    `}}const o=a;r.d(t,["A",0,o])},74226(e,t,r){r.r(t),r.d(t,{ProtvistaUniprotStructure:()=>Sbe,colorConfig:()=>h,default:()=>Gwt,filterConfig:()=>d,getFeatureTooltip:()=>N,getStructureTooltip:()=>F,getVariationTooltip:()=>nr});var n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),i="#990000",a="#99cc00",o="#4c8acd",s="#009e73",u=[/uncertain/i,/conflicting/i,/unclassified/i,/risk factor/i],c=(e,t)=>e.map(e=>{let r=e.variants.filter(e=>t(e));return{...e,variants:[...r]}}),l={disease:e=>e.association?.some(e=>e.disease),predicted:e=>e.hasPredictions,nonDisease:e=>e.association?.some(e=>!1===e.disease),uncertain:e=>void 0===e.clinicalSignificances&&!e.hasPredictions||e.clinicalSignificances&&((e,t)=>e.some(({type:e})=>t.some(t=>t.test(e))))(e.clinicalSignificances,u),UniProt:e=>e.xrefNames&&(e.xrefNames.includes("uniprot")||e.xrefNames.includes("UniProt")),ClinVar:e=>e.xrefNames&&(e.xrefNames.includes("ClinVar")||e.xrefNames.includes("clinvar")),LSS:e=>"large_scale_study"===e.sourceType||"mixed"===e.sourceType},d=[{name:"disease",type:{name:"consequence",text:"Filter Consequence"},options:{label:"Likely pathogenic or pathogenic",color:i},filterPredicate:l.disease,filterData:e=>c(e,l.disease)},{name:"predicted",type:{name:"consequence",text:"Filter Consequence"},options:{label:"Predicted consequence",color:o},filterPredicate:l.predicted,filterData:e=>c(e,l.predicted)},{name:"nonDisease",type:{name:"consequence",text:"Filter Consequence"},options:{label:"Likely benign or benign",color:a},filterPredicate:l.nonDisease,filterData:e=>c(e,l.nonDisease)},{name:"uncertain",type:{name:"consequence",text:"Filter Consequence"},options:{label:"Uncertain significance",color:s},filterPredicate:l.uncertain,filterData:e=>c(e,l.uncertain)},{name:"UniProt",type:{name:"provenance",text:"Filter Provenance"},options:{label:"UniProt reviewed",color:"#9f9f9f"},filterPredicate:l.UniProt,filterData:e=>c(e,l.UniProt)},{name:"ClinVar",type:{name:"provenance",text:"Filter Provenance"},options:{label:"ClinVar",color:"#9f9f9f"},filterPredicate:l.ClinVar,filterData:e=>c(e,l.ClinVar)},{name:"LSS",type:{name:"provenance",text:"Filter Provenance"},options:{label:"Large scale studies",color:"#9f9f9f"},filterPredicate:l.LSS,filterData:e=>c(e,l.LSS)}],f=(e,t)=>{let r=[{variants:[t]}],n=d.find(t=>t.name===e);return!!n&&n.filterData(r)[0].variants.length>0},h=e=>f("disease",e)?i:f("nonDisease",e)?a:f("uncertain",e)?s:f("predicted",e)?o:s,p=[{name:"ECO:0000269",description:"Manual assertion based on experiment",shortDescription:"Publication",acronym:"EXP",isManual:!0},{name:"ECO:0000303",description:"Manual assertion based on opinion",shortDescription:"Publication",acronym:"NAS",isManual:!0},{name:"ECO:0000305",description:"Manual assertion inferred by curator",shortDescription:"Curated",acronym:"IC",isManual:!0},{name:"ECO:0000250",description:"Manual assertion inferred from sequence similarity",shortDescription:"By similarity",acronym:"ISS",isManual:!0},{name:"ECO:0000255",description:"Manual assertion according to rules",shortDescription:"Sequence Analysis",acronym:"ISM",isManual:!0},{name:"ECO:0007744",description:"Manual assertion inferred from combination of experimental and computational evidence",shortDescription:"Combined sources",acronym:"MIXM",isManual:!0},{name:"ECO:0000312",description:"Manual assertion inferred from database entries",shortDescription:"Imported",acronym:"MI",isManual:!0},{name:"ECO:0000256",description:"Automatic assertion according to rules",shortDe
139scription:"Automatic annotation",acronym:"AA"},{name:"ECO:0000259",description:"Automatic assertion inferred from signature match",shortDescription:"Automatic annotation",acronym:"AA"},{name:"ECO:0007829",description:"Automatic assertion inferred from combination of experimental and computational evidence",shortDescription:"Combined sources",acronym:"MIXA"},{name:"ECO:0000213",description:"Automatic assertion inferred from combination of experimental and computational evidence",shortDescription:"Combined sources",acronym:"MIXA"},{name:"ECO:0000244",description:"Manual assertion inferred from combination of experimental and computational evidence",shortDescription:"Combined sources",acronym:"MIXM",isManual:!0},{name:"ECO:0000313",description:"Automatic assertion inferred from database entries",shortDescription:"Imported",acronym:"AI"},{name:"ECO:0000260",description:"Manual assertion inferred from signature match",shortDescription:"InterPro annotation",acronym:"SGNM",isManual:!0}],m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=/[&<>"']/g,v=e=>null==e?"":String(e).replace(g,e=>m[e]),y=new Set(["http:","https:","mailto:"]),b=e=>{if(null==e)return"";let t=String(e).trim();if(""===t)return"";if(t.startsWith("/")||t.startsWith("#")||t.startsWith("?"))return v(t);try{let e=new URL(t);if(y.has(e.protocol))return v(t)}catch{}return""},_={R:"Phosphoarginine",C:"Phosphocysteine",H:"Phosphohistidine",S:"Phosphoserine",T:"Phosphothreonine",Y:"Phosphotyrosine"},x={K:"Sumoylated lysine"},S={K:"Ubiquitinated lysine",S:"Ubiquitinated serine",T:"Ubiquitinated threonine",C:"Ubiquitinated cysteine"},w={S:"Acetylserine",A:"Acetylalanine",G:"Acetylglycine",T:"Acetylthreonine",V:"Acetylvaline",C:"Acetylcysteine",E:"Acetylglutamin acid",D:"Acetylaspartic acid",N:"Acetylasparagine",Q:"Acetylglutamine",L:"Acetyllucine",I:"Acetlyisolucine",W:"Acetyltryptophan",F:"Acetylphenylalanine",K:"Acetyllysine"},A={C:"Methylcysteine",H:"Methylhistidine",K:"Methyllysine",N:"Methyl-asparagine",Q:"Methylglutamine",R:"Methylarginine",I:"Methyl-isoleucine",L:"Methylleucine",D:"Methyl-aspartic acid",E:"Methyl-glutamic acid",S:"Methylserine",T:"Methyl-threonine"},C=e=>{let t=e.toUpperCase();return t in _?_[t]:(console.error(`${t} not a valid amino acid for phosphorylation`),"")},T=e=>{let t=e.toUpperCase();return t in x?x[t]:(console.error(`${t} not a valid amino acid for SUMOylation`),"")},P=e=>{let t=e.toUpperCase();return t in S?S[t]:(console.error(`${t} not a valid amino acid for Ubiquitinylation`),"")},E=e=>{let t=e.toUpperCase();return t in w?w[t]:(console.error(`${t} not a valid amino acid for Acetylation`),"")},M=e=>{let t=e.toUpperCase();return t in A?A[t]:(console.error(`${t} not a valid amino acid for Methylation`),"")},k=(e,t,r,n)=>{let i,a=[...t.flatMap(({dbReferences:e})=>e?.flatMap(({id:e})=>[e]))],o=new Set(t.flatMap(({name:e})=>e));return o.size&&(o.size>1?console.error(`The ptms are grouped by modification, but more than one type detected: ${Array.from(o)}`):[i]=o),`\n  ${e?`<h4>${v(e)}</h4><hr />`:""}\n  ${i?`<h5>Description</h5><p>${v(((e,t)=>{switch(e){case"Phosphorylation":return C(t);case"SUMOylation":return T(t);case"Ubiquitinylation":return P(t);case"Acetylation":return E(t);case"Methylation":return M(t);default:return""}})(i,r))}</p>`:""}\n  ${n?`<h5 data-article-id="mod_res_large_scale#confidence-score">Confidence Score</h5><p>${v(n)}</p>`:""}\n  ${a?`<h5>Evidence</h5><ul class="no-bullet">${a.map(e=>{let t="Glue project"===e?"PXD012174":e,r=v(t);return`<li title='${r}'>${r}&nbsp;\n              (<a href="https://proteomecentral.proteomexchange.org/dataset/${encodeURIComponent(t)}" target="_blank">ProteomeXchange</a>)\n              </li>\n              ${"Glue project"===e?'<li title="publication">Publication:&nbsp;31819260&nbsp;(<a href="https://pubmed.ncbi.nlm.nih.gov/31819260" target="_blank">PubMed</a>)</li>':""}\n              `}).join("")}</ul>`:""}`},I={"36329_phosphorylation":{build:"542",organism:"Plasmodium"},"39947_phosphorylation":{build:"539",organism:"Rice"},"10090_phosphorylation":{build:"577",organism:"Mouse"},"9606_phosphorylation":{build:"606",organism:"Human"},"559292_phosphorylation":{build:"586",organism:"Yeast"},"4577_phosphorylation":{build:"591",organism:"Maize"},"185431_phosphorylation":{build:"590",organism:"T Brucei"},"508771_phosphorylation":{build:"601",organism:"T Gondii"},"9606_sumoylation":{build:"596",organism:"Human"},"9606_ubiquitinylation":{build:"604",organism:"Human"},"9606_acetylation":{build:"0",organism:"Human"},"9606_methylation":{build:"612",organism:"Human"}},D={"glu-&gt;pyro-glu":27,"ammonia-loss":385,nqtgg:2084,formyl:122,carbamidomethyl:4,ubiquitination:121,tmt6plex:737,phospho:21,itraq8plex:730,deamidated:7,"pyro-qqtgg":2083,qqtgg:2082,glygly:121,oxidation:35,"gln-&gt;pyro-glu":28,dehydrated:23,dvfqqqtgg:2085,acetyl:1,itraq4plex:214,tmtpro:2016,"label: 13c(6)15n(4)":267},O=e=>e?`\n        <ul class="no-bullet">${e.map(e=>{let t=p.find(t=>t.name===e.code);return t?`<li title='${v(t.description)}'>
139${v(t.shortDescription)}:&nbsp;${e.source?(e=>{if("pubmed"===e.name?.toLowerCase())return`${v(e.id)}&nbsp;(<a href='${b(e.url)}' target='_blank'>${v(e.name)}</a>&nbsp;<a href='${b(e.alternativeUrl)}' target='_blank'>EuropePMC</a>)`;let t=`&nbsp;<a href='${b(e.url)}' target='_blank'>${v(e.id)}</a>`;return e.name?e.name.startsWith("Hpp")?`${t}&nbsp;(${v(e.name.slice(3))})`:`${t}&nbsp;(${v(e.name)})`:t})(e.source):""}</li>`:""}).join("")}</ul>\n      `:"",R=e=>`<ul class="no-bullet">${e.map(e=>`<li>${v(e.name)} ${e.url?`<a href="${b(e.url)}" target="_blank">${v(e.id)}</a>`:`${v(e.name)} ${v(e.id)}`}</li>`).join("")}</ul>`,B=(e,t)=>{let{peptide:r,start:n}=e,i=Number(n)+t.position-1,a=(r??"").charAt(t.position-1);switch(t.name){case"Phosphorylation":return`${i} ${C(a)}`;case"SUMOylation":return`${i} ${T(a)}`;case"Ubiquitinylation":return`${i} ${P(a)}`;case"Acetylation":return`${i} ${E(a)}`;case"Methylation":return`${i} ${M(a)}`;default:return""}},N=(e,t)=>{let r="PROTEOMICS_PTM"===e.type?((e,t)=>{if(!e)return"";let r=e.flatMap(({dbReferences:e})=>e.map(e=>e.id)),n=new Map(e.flatMap(({dbReferences:e})=>e.map(e=>[e.id,e.properties["PeptideAtlas URL"]]))),i=new Map(e.flatMap(({name:e,dbReferences:t})=>t.map(t=>[t.id,e])));return`\n    <ul class="no-bullet">${[...new Set(r.flat())].map(e=>{let r=v(e);return`<li title='${r}'>${r}&nbsp;(<a href="${b(`https://proteomecentral.proteomexchange.org/dataset/${e}`)}" target="_blank">ProteomeXchange</a>${"PXD012174"===e?`&nbsp;<a href="https://www.ebi.ac.uk/pride/archive/projects/${encodeURIComponent(e)}" target="_blank">PRIDE</a>)</li><li title="publication">Publication:&nbsp;31819260&nbsp;(<a href="https://pubmed.ncbi.nlm.nih.gov/31819260" target="_blank">PubMed</a>)</li>`:""}${(()=>{let r=n.get(e);if(r)return`&nbsp;<a href="${b(r)}" target="_blank">PeptideAtlas</a>`;let a=i.get(e),o=`${t}_${a?.toLowerCase()}`;return t&&a&&I[o]?`&nbsp;<a href="https://db.systemsbiology.net/sbeams/cgi/PeptideAtlas/buildDetails?atlas_build_id=${encodeURIComponent(I[o].build)}" target="_blank">PeptideAtlas</a>`:""})()})</li>`}).join("")}</ul>\n  `})(e.residuesToHighlight,t):O(e.evidences),n="PROTEOMICS_PTM"===e.type&&e.residuesToHighlight?.map(t=>B(e,t)),i="PROTEOMICS_PTM"===e.type&&e.residuesToHighlight?.flatMap(({dbReferences:e})=>e.map(e=>e.id)),{description:a}=e;if("BINDING"===e.type||"Binding site"===e.type){let t="";e.ligandPart&&(t+=`${e.ligandPart.name} of `),e.ligand&&(t+=e.ligand.name),e.description&&(t+=`; ${e.description}`),a=t}try{return`\n        ${e.type&&e.start&&e.end?`<h4>${v(e.type)} ${v(e.start)}-${v(e.end)}</h4><hr />`:""}\n        ${a?`<h5>Description</h5><p>${v(a)}</p>`:""}\n        ${e.ftId?`<h5>Feature ID</h5><p>${v(e.ftId)}</p>`:""}\n        ${e.alternativeSequence?`<h5>Alternative sequence</h5><p>${v(e.alternativeSequence)}</p>`:""}\n        ${n?`<h5 data-article-id="ptm_processing_section">PTMs</h5><ul class="no-bullet">${n.map(e=>`<li>${v(e)}</li>`).join("")}</ul>\n              `:""}\n        ${e.peptide&&"PROTEOMICS_PTM"===e.type?`<h5 data-article-id="mod_res_large_scale#what-is-the-goldsilverbronze-criterion">Peptidoform</h5><p>${v(((e,t)=>{if(!t)return"";let r=t.map(e=>({name:e.name,position:e.position})),n="",i=0;return r.forEach(t=>{n=`${n}${e.slice(i,t.position)}[${t.name}]`,i=t.position}),n=`${n}${e.slice(i)}`,n})(e.peptide,e.residuesToHighlight??[]))}</p>`:""}\n        ${e.peptide&&"PROTEOMICS_PTM"!==e.type?`<h5>Peptide</h5><p>${v(e.peptide)}</p>`:""}\n        ${e.unique?`<h5>Unique</h5><p>${e.unique?"Yes":"No"}</p>`:""}\n        ${e.xrefs?`<h5>Cross-references</h5>${R(e.xrefs)}`:""}\n        ${r?`<h5>Evidence</h5>${r}`:""}\n        ${e.residuesToHighlight&&i&&!i.includes("PXD012174")?`<hr /><h5 class="margin-bottom" data-article-id="mod_res_large_scale#what-is-the-goldsilverbronze-criterion">PTM statistical attributes</h5><ul class="no-bullet">${(e.residuesToHighlight??[]).map(t=>t.dbReferences.map(r=>`<li><b>${v(r.id)}</b></li>\n                        <li class="text-indent-1"><b>${v(B(e,t))}</b></li>\n                        ${r.properties["Pubmed ID"]?`<li class="text-indent-2">PubMed ID: <a href="https://europepmc.org/article/MED/${encodeURIComponent(r.properties["Pubmed ID"])}" target="_blank">${v(r.properties["Pubmed ID"])}</a></li>`:""}\n                        ${r.properties["Confidence score"]?`<li class="text-indent-2"><span data-article-id="mod_res_large_scale#confidence-score">Confidence score</span>: ${v(r.properties["Confidence score"])}</li>`:""}\n                        ${r.properties["Sumo isoforms"]?`<li class="text-indent-2">SUMO family member: ${v(r.properties["Sumo isoforms"])}</li>`:""}\n                        ${r.properties["Organism part"]?`<li class="text-indent-2">Organism part: ${v(r.properties["Organism part"])}</li>`:""}\n                        ${r.properties["PSM Count (0.05 gFLR)"]?`<li class="text-indent-2">PSM Count (0.05 gFLR): ${v(r.properties["PSM Count (0.05 gFLR)"])}</li>`:""}\n                        ${r.properties["Final site probability"]?`<li class="text-indent-2">Final site probability: ${v(r.properties["Final site probability"])}</li>`:""}\n                        ${r.properties["Universal Spectrum Id"]?`<li class="text-indent-2 nowrap">Universal Spectrum Id:\n                                <a href="http://proteomecentral.proteomexchange.org/usi/?usi=${encodeURIComponent(r.properties["Universal Spectrum Id"])}" target="_blank">View on ProteomeXchange</a>\n                              </li>`:""}\n                        ${r.properties.Proforma?`<li class="nowrap margin-bottom"><div class="text-indent-2">Experimental Peptidoform:</div><div class="proforma">\n                                  ${((e="")=>e.replace(/\[([^\]]+)\]/g,(e,t)=>{let r=D[t.toLowerCase()];return r?`<span class="mod-link">[<a href="https://www.unimod.org/modifications_view.php?editid1=${r}" target="_blank">${t}</a>]</span>`:(console.error("Unimod ID not found for modification:",t),`[${t}]`)}))(r.properties.Proforma)}</div></li>`:""}`).join("")).join("")}</ul>`:""}\n      `}catch(e){return console.error(e),""}},F=e=>{let t=(e=>`<ul>\n              ${e.map(e=>`<li><a href='${b(e.source.url)}' target='_blank'>\n              ${v(e.source.id)}\n          </a> (${v(e.start)}-${v(e.end)})</li>`).join("")}\n          </ul>`)(e.structures);return t?`\n    ${e.type&&e.start&&e.end?`<h4>${v(e.type)} ${v(e.start)}-${v(e.end)}</h4><hr />`:""}\n    <h5>Structures</h5>${t}`:""},L="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,$="object"==typeof self&&self&&self.Object===Object&&self,U=L||$||Function("return this")(),j=U.Symbol,z=Object.prototype,G=z.hasOwnProperty,V=z.toString,H=j?j.toStringTag:void 0,q=Object.prototype.toString,W=j?j.toStringTag:void 0;
139function X(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":W&&W in Object(e)?function(e){var t=G.call(e,H),r=e[H];try{e[H]=void 0;var n=!0}catch{}var i=V.call(e);return n&&(t?e[H]=r:delete e[H]),i}(e):function(e){return q.call(e)}(e)}function Y(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function K(e){if(!Y(e))return!1;var t=X(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Z=U["__core-js_shared__"],Q=function(){var e=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),J=Function.prototype.toString;function ee(e){if(null!=e){try{return J.call(e)}catch{}try{return e+""}catch{}}return""}var te=/^\[object .+?Constructor\]$/,re=Function.prototype,ne=Object.prototype,ie=re.toString,ae=ne.hasOwnProperty,oe=RegExp("^"+ie.call(ae).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function se(e,t){var r=function(e,t){return e?.[t]}(e,t);return function(e){return!(!Y(e)||function(e){return!!Q&&Q in e}(e))&&(K(e)?oe:te).test(ee(e))}(r)?r:void 0}var ue=function(){try{var e=se(Object,"defineProperty");return e({},"",{}),e}catch{}}();function ce(e,t,r,n){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),e)}return n}var le=function(e,t,r){for(var n=-1,i=Object(e),a=r(e),o=a.length;o--;){var s=a[++n];if(!1===t(i[s],s,i))break}return e};function de(e){return"object"==typeof e&&!!e}function fe(e){return de(e)&&"[object Arguments]"==X(e)}var he=Object.prototype,pe=he.hasOwnProperty,me=he.propertyIsEnumerable,ge=fe(function(){return arguments}())?fe:function(e){return de(e)&&pe.call(e,"callee")&&!me.call(e,"callee")},ve=Array.isArray,ye="object"==typeof exports&&exports&&!exports.nodeType&&exports,be=ye&&"object"==typeof module&&module&&!module.nodeType&&module,_e=be&&be.exports===ye?U.Buffer:void 0,xe=(_e?_e.isBuffer:void 0)||function(){return!1},Se=/^(?:0|[1-9]\d*)$/;function we(e,t){var r=typeof e;return t??=9007199254740991,!!t&&("number"==r||"symbol"!=r&&Se.test(e))&&e>-1&&e%1==0&&e<t}function Ae(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var Ce={};Ce["[object Float32Array]"]=Ce["[object Float64Array]"]=Ce["[object Int8Array]"]=Ce["[object Int16Array]"]=Ce["[object Int32Array]"]=Ce["[object Uint8Array]"]=Ce["[object Uint8ClampedArray]"]=Ce["[object Uint16Array]"]=Ce["[object Uint32Array]"]=!0,Ce["[object Arguments]"]=Ce["[object Array]"]=Ce["[object ArrayBuffer]"]=Ce["[object Boolean]"]=Ce["[object DataView]"]=Ce["[object Date]"]=Ce["[object Error]"]=Ce["[object Function]"]=Ce["[object Map]"]=Ce["[object Number]"]=Ce["[object Object]"]=Ce["[object RegExp]"]=Ce["[object Set]"]=Ce["[object String]"]=Ce["[object WeakMap]"]=!1;var Te="object"==typeof exports&&exports&&!exports.nodeType&&exports,Pe=Te&&"object"==typeof module&&module&&!module.nodeType&&module,Ee=Pe&&Pe.exports===Te&&L.process,Me=function(){try{return Pe&&Pe.require&&Pe.require("util").types||Ee&&Ee.binding&&Ee.binding("util")}catch{}}(),ke=Me&&Me.isTypedArray,Ie=ke?function(e){return function(t){return e(t)}}(ke):function(e){return de(e)&&Ae(e.length)&&!!Ce[X(e)]},De=Object.prototype.hasOwnProperty;var Oe=Object.prototype,Re=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Be=Object.prototype.hasOwnProperty;function Ne(e){return null!=e&&Ae(e.length)&&!K(e)}function Fe(e){return Ne(e)?function(e,t){var r=ve(e),n=!r&&ge(e),i=!r&&!n&&xe(e),a=!r&&!n&&!i&&Ie(e),o=r||n||i||a,s=o?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],u=s.length;for(var c in e)(t||De.call(e,c))&&(!o||!("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||we(c,u)))&&s.push(c);return s}(e):function(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Oe)}(e))return Re(e);var t=[];for(var r in Object(e))Be.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Le=function(e,t){if(null==e)return e;if(!Ne(e))return function(e,t){return e&&le(e,t,Fe)}(e,t);for(var r=e.length,n=-1,i=Object(e);++n<r&&!1!==t(i[n],n,i););return e};function $e(e,t,r,n){return Le(e,function(e,i,a){t(n,e,r(e),a)}),n}function Ue(e,t){return e===t||e!=e&&t!=t}function je(e,t){for(var r=e.length;r--;)if(Ue(e[r][0],t))return r;return-1}var ze=Array.prototype.splice;function Ge(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ge.prototype.clear=function(){this.__data__=[],this.size=0},Ge.prototype.delete=function(e){var t=this.__data__,r=je(t,e);return!(r<0||(r==t.length-1?t.pop():ze.call(t,r,1),--this.size,0))},Ge.prototype.get=function(e){var t=this.__data__,r=je(t,e);return r<0?void 0:t[r][1]},Ge.prototype.has=function(e){return je(this.__data__,e)>-1},Ge.prototype.set=function(e,t){var r=this.__data__,n=je(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var Ve=se(U,"Map"),He=se(Object,"create"),qe=Object.prototype.hasOwnProperty,We=Object.prototype.hasOwnProperty;function Xe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ye(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ze(e){var t=this.__data__=new Ge(e);this.size=t.size}function Qe(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ke;++t<r;)this.add(e[t])}function Je(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function et(e,t){return e.has(t)}function tt(e,t,r,n,i,a){var o=1&r,s=e.length,u=t.length;if(s!=u&&!(o&&u>s))return!1;var c=a.get(e),l=a.get(t);if(c&&l)return c==t&&l==e;var d=-1,f=!0,h=2&r?new Qe:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var p=e[d],m=t[d];if(n)var g=o?n(m,p,d,t,e,a):n(p,m,d,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}
139if(h){if(!Je(t,function(e,t){if(!et(h,t)&&(p===e||i(p,e,r,n,a)))return h.push(t)})){f=!1;break}}else if(p!==m&&!i(p,m,r,n,a)){f=!1;break}}return a.delete(e),a.delete(t),f}Xe.prototype.clear=function(){this.__data__=He?He(null):{},this.size=0},Xe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},Xe.prototype.get=function(e){var t=this.__data__;if(He){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return qe.call(t,e)?t[e]:void 0},Xe.prototype.has=function(e){var t=this.__data__;return He?void 0!==t[e]:We.call(t,e)},Xe.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=He&&void 0===t?"__lodash_hash_undefined__":t,this},Ke.prototype.clear=function(){this.size=0,this.__data__={hash:new Xe,map:new(Ve||Ge),string:new Xe}},Ke.prototype.delete=function(e){var t=Ye(this,e).delete(e);return this.size-=+!!t,t},Ke.prototype.get=function(e){return Ye(this,e).get(e)},Ke.prototype.has=function(e){return Ye(this,e).has(e)},Ke.prototype.set=function(e,t){var r=Ye(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Ze.prototype.clear=function(){this.__data__=new Ge,this.size=0},Ze.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Ze.prototype.get=function(e){return this.__data__.get(e)},Ze.prototype.has=function(e){return this.__data__.has(e)},Ze.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ge){var n=r.__data__;if(!Ve||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ke(n)}return r.set(e,t),this.size=r.size,this},Qe.prototype.add=Qe.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Qe.prototype.has=function(e){return this.__data__.has(e)};var rt=U.Uint8Array;function nt(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function it(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var at=j?j.prototype:void 0,ot=at?at.valueOf:void 0,st=Object.prototype.propertyIsEnumerable,ut=Object.getOwnPropertySymbols,ct=ut?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o)&&(a[i++]=o)}return a}(ut(e),function(t){return st.call(e,t)}))}:function(){return[]};function lt(e){return function(e,t,r){var n=t(e);return ve(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,Fe,ct)}var dt=Object.prototype.hasOwnProperty,ft=se(U,"DataView"),ht=se(U,"Promise"),pt=se(U,"Set"),mt=se(U,"WeakMap"),gt="[object Map]",vt="[object Promise]",yt="[object Set]",bt="[object WeakMap]",_t="[object DataView]",xt=ee(ft),St=ee(Ve),wt=ee(ht),At=ee(pt),Ct=ee(mt),Tt=X;(ft&&Tt(new ft(new ArrayBuffer(1)))!=_t||Ve&&Tt(new Ve)!=gt||ht&&Tt(ht.resolve())!=vt||pt&&Tt(new pt)!=yt||mt&&Tt(new mt)!=bt)&&(Tt=function(e){var t=X(e),r="[object Object]"==t?e.constructor:void 0,n=r?ee(r):"";if(n)switch(n){case xt:return _t;case St:return gt;case wt:return vt;case At:return yt;case Ct:return bt}return t});var Pt=Tt,Et="[object Arguments]",Mt="[object Array]",kt="[object Object]",It=Object.prototype.hasOwnProperty;function Dt(e,t,r,n,i){return e===t||(null==e||null==t||!de(e)&&!de(t)?e!=e&&t!=t:function(e,t,r,n,i,a){var o=ve(e),s=ve(t),u=o?Mt:Pt(e),c=s?Mt:Pt(t),l=(u=u==Et?kt:u)==kt,d=(c=c==Et?kt:c)==kt,f=u==c;if(f&&xe(e)){if(!xe(t))return!1;o=!0,l=!1}if(f&&!l)return a||=new Ze,o||Ie(e)?tt(e,t,r,n,i,a):function(e,t,r,n,i,a,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new rt(e),new rt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ue(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=nt;case"[object Set]":var u=1&n;if(s||=it,e.size!=t.size&&!u)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var l=tt(s(e),s(t),n,i,a,o);return o.delete(e),l;case"[object Symbol]":if(ot)return ot.call(e)==ot.call(t)}return!1}(e,t,u,r,n,i,a);if(!(1&r)){var h=l&&It.call(e,"__wrapped__"),p=d&&It.call(t,"__wrapped__");
139if(h||p){var m=h?e.value():e,g=p?t.value():t;return a||=new Ze,i(m,g,r,n,a)}}return!!f&&(a||=new Ze,function(e,t,r,n,i,a){var o=1&r,s=lt(e),u=s.length;if(u!=lt(t).length&&!o)return!1;for(var c=u;c--;){var l=s[c];if(!(o?l in t:dt.call(t,l)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var h=!0;a.set(e,t),a.set(t,e);for(var p=o;++c<u;){var m=e[l=s[c]],g=t[l];if(n)var v=o?n(g,m,l,t,e,a):n(m,g,l,e,t,a);if(!(void 0===v?m===g||i(m,g,r,n,a):v)){h=!1;break}p||="constructor"==l}if(h&&!p){var y=e.constructor,b=t.constructor;y!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b)&&(h=!1)}return a.delete(e),a.delete(t),h}(e,t,r,n,i,a))}(e,t,r,n,Dt,i))}function Ot(e){return e==e&&!Y(e)}function Rt(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}function Bt(e){return"symbol"==typeof e||de(e)&&"[object Symbol]"==X(e)}var Nt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ft=/^\w*$/;function Lt(e,t){if(ve(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Bt(e))||Ft.test(e)||!Nt.test(e)||null!=t&&e in Object(t)}function $t(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new($t.Cache||Ke),r}$t.Cache=Ke;var Ut,jt,zt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gt=/\\(\\)?/g,Vt=(Ut=$t(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(zt,function(e,r,n,i){t.push(n?i.replace(Gt,"$1"):r||e)}),t},function(e){return 500===jt.size&&jt.clear(),e}),jt=Ut.cache,Ut),Ht=1/0,qt=j?j.prototype:void 0,Wt=qt?qt.toString:void 0;function Xt(e){if("string"==typeof e)return e;if(ve(e))return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(e,Xt)+"";if(Bt(e))return Wt?Wt.call(e):"";var t=e+"";return"0"==t&&1/e==-Ht?"-0":t}function Yt(e,t){return ve(e)?e:Lt(e,t)?[e]:Vt(function(e){return null==e?"":Xt(e)}(e))}function Kt(e){if("string"==typeof e||Bt(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zt(e,t){for(var r=0,n=(t=Yt(t,e)).length;null!=e&&r<n;)e=e[Kt(t[r++])];return r&&r==n?e:void 0}function Qt(e,t){return null!=e&&t in Object(e)}function Jt(e,t){return Lt(e)&&Ot(t)?Rt(Kt(e),t):function(r){var n=function(e,t){var r=null==e?void 0:Zt(e,t);return void 0===r?void 0:r}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n=-1,i=(t=Yt(t,e)).length,a=!1;++n<i;){var o=Kt(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&Ae(i)&&we(o,i)&&(ve(e)||ge(e))}(e,t,Qt)}(r,e):Dt(t,n,3)}}function er(e){return e}var tr=Object.prototype.hasOwnProperty,rr=function(e){return function(t,r){var n={};return(ve(t)?ce:$e)(t,e,function(e){return"function"==typeof e?e:null==e?er:"object"==typeof e?ve(e)?Jt(e[0],e[1]):function(e){var t=function(e){for(var t=Fe(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ot(i)]}return t}(e);return 1==t.length&&t[0][2]?Rt(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r,n){var i=r.length,a=i;if(null==e)return!a;for(e=Object(e);i--;){var o=r[i];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++i<a;){var s=(o=r[i])[0],u=e[s],c=o[1];if(o[2]){if(void 0===u&&!(s in e))return!1}else{var l,d=new Ze;if(!(void 0===l?Dt(c,u,3,n,d):l))return!1}}return!0}(r,0,t)}}(e):function(e){return Lt(e)?function(e){return function(t){return t?.[e]}}(Kt(e)):function(e){return function(t){return Zt(t,e)}}(e)}(e)}(r),n)}}(function(e,t,r){tr.call(e,r)?e[r].push(t):function(e,t,r){"__proto__"==t&&ue?ue(e,t,{c
139onfigurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}(e,r,[t])}),nr=e=>`\n  ${e.type&&e.start&&e.end?`<h4>${v(e.type)} ${v(e.start)}-${v(e.end)}</h4><hr />`:""}\n  <h5>Variant</h5><p>${v(e.wildType)} > ${v(e.alternativeSequence)||""}</p>\n  ${e.populationFrequencies?(e=>`<hr/><h5>Population frequencies</h5>${e.map(e=>`<p>${v(e.frequency)} - ${v(e.populationName)} (${v(e.source)})</p>`).join("")}`)(e.populationFrequencies):""}\n  ${e.consequenceType?`<h5>Consequence</h5><p>${v(e.consequenceType)}</p>`:""}\n  ${e.somaticStatus?`<h5>Somatic</h5><p>${0===e.somaticStatus?"No":"Yes"}</p>`:""}\n  ${e.genomicLocation?.length?`<h5>Location</h5><p>${e.genomicLocation.map(v).join(", ")}</p>`:""}\n  ${e.ftId?`<h5>Feature ID</h5><p>${v(e.ftId)}</p>`:""}\n  ${e.descriptions?(e=>`<hr/><h5>Description</h5>${e.map(e=>`<p>${v(e.value)}</p>`).join("")}\n  `)(e.descriptions):""}\n  ${e.association?(e=>e?.map(e=>`\n              <h4>Disease association</h4><p>${v(e.name)}</p>\n              ${e.description?`<p>${v(e.description)}</p>`:""}\n              ${e.dbReferences?`<h5>Cross-references</h5>${R(e.dbReferences)}`:""}\n              ${O(e.evidences)}\n          `).join(""))(e.association):""}\n  ${e.predictions?(e=>{let t=rr(e,"predAlgorithmNameType");return Object.keys(t).map(e=>{let r=rr(t[e],"predictionValType");return{algorithm:e,values:Object.keys(r).map(e=>({name:e,count:r[e].length}))}}).map(e=>`<h6>${v(e.algorithm)}</h6><ul class="no-bullet">${e.values.map(e=>`<li>${v(e.name)}</li>`).join("")}</ul>`).join("")})(e.predictions):""}\n  ${(e=>{if(e.locations.some(e=>"EnsemblViruses"===e.source)){let t=e.xrefs.find(e=>"ENA"===e.name);return t?.id?`<h5>Ensembl COVID-19</h5>\n          <p>\n          <a href="https://covid-19.ensembl.org/Sars_cov_2/Variation/Explore?v=${encodeURIComponent(t.id)}" target="_blank" rel="noopener noreferrer">${v(t.id)}</a>\n        </p>`:""}return""})(e)}\n`,ir=globalThis,ar=ir.ShadowRoot&&(void 0===ir.ShadyCSS||ir.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,or=Symbol(),sr=new WeakMap,ur=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==or)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ar&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=sr.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&sr.set(t,e))}return e}toString(){return this.cssText}},cr=(e,...t)=>new ur(1===e.length?e[0]:t.reduce((t,r,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[n+1],e[0]),e,or),lr=ar?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new ur("string"==typeof e?e:e+"",void 0,or))(t)})(e):e,{is:dr,defineProperty:fr,getOwnPropertyDescriptor:hr,getOwnPropertyNames:pr,getOwnPropertySymbols:mr,getPrototypeOf:gr}=Object,vr=globalThis,yr=vr.trustedTypes,br=yr?yr.emptyScript:"",_r=vr.reactiveElementPolyfillSupport,xr=(e,t)=>e,Sr={toAttribute(e,t){switch(t){case Boolean:e=e?br:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},wr=(e,t)=>!dr(e,t),Ar={attribute:!0,type:String,converter:Sr,reflect:!1,useDefault:!1,hasChanged:wr};Symbol.metadata??=Symbol("metadata"),vr.litPropertyMetadata??=new WeakMap;var Cr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ar){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&fr(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=hr(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:n,set(t){let a=n?.call(this);i?.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ar}static _$Ei(){if(this.hasOwnProperty(xr("elementProperties")))return;let e=gr(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(xr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xr("properties"))){let e=this.properties,t=[...pr(e),...mr(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(lr(e))}else void 0!==e&&t.push(lr(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
139=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(ar)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=ir.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Sr:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Sr:e.converter;this._$Em=n;let a=i.fromAttribute(t,e.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(e,t,r,n=!1,i){if(void 0!==e){let a=this.constructor;if(!1===n&&(i=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??wr)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:n,wrapped:i},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e){let{wrapped:e}=r,n=this[t];!0!==e||this._$AL.has(t)||void 0===n||this.C(t,void 0,r,n)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};Cr.elementStyles=[],Cr.shadowRootOptions={mode:"open"},Cr[xr("elementProperties")]=new Map,Cr[xr("finalized")]=new Map,_r?.({ReactiveElement:Cr}),(vr.reactiveElementVersions??=[]).push("2.1.2");var Tr=globalThis,Pr=e=>e,Er=Tr.trustedTypes,Mr=Er?Er.createPolicy("lit-html",{createHTML:e=>e}):void 0,kr="$lit$",Ir=`lit$${Math.random().toFixed(9).slice(2)}$`,Dr="?"+Ir,Or=`<${Dr}>`,Rr=document,Br=()=>Rr.createComment(""),Nr=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Fr=Array.isArray,Lr=e=>Fr(e)||"function"==typeof e?.[Symbol.iterator],$r="[ \t\n\f\r]",Ur=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jr=/-->/g,zr=/>/g,Gr=RegExp(`>|${$r}(?:([^\\s"'>=/]+)(${$r}*=${$r}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Vr=/'/g,Hr=/"/g,qr=/^(?:script|style|textarea|title)$/i,Wr=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}
139),Xr=Wr(1),Yr=Wr(2),Kr=Symbol.for("lit-noChange"),Zr=Symbol.for("lit-nothing"),Qr=new WeakMap,Jr=Rr.createTreeWalker(Rr,129);function en(e,t){if(!Fr(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===Mr?t:Mr.createHTML(t)}var tn=(e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=Ur;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===Ur?"!--"===s[1]?o=jr:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=Gr):(qr.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=Gr):o=zr:o===Gr?">"===s[0]?(o=r??Ur,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?Gr:'"'===s[3]?Hr:Vr):o===Hr||o===Vr?o=Gr:o===jr||o===zr?o=Ur:(o=Gr,r=void 0);let d=o===Gr&&e[t+1].startsWith("/>")?" ":"";a+=o===Ur?u+Or:c>=0?(i.push(n),u.slice(0,c)+kr+u.slice(c)+Ir+d):u+Ir+(-2===c?t:d)}return[en(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]},rn=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=tn(t,r);if(this.el=e.createElement(c,n),Jr.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Jr.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(kr)){let t=l[o++],r=i.getAttribute(e).split(Ir),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?un:"?"===n[1]?cn:"@"===n[1]?ln:sn}),i.removeAttribute(e)}else e.startsWith(Ir)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(qr.test(i.tagName)){let e=i.textContent.split(Ir),t=e.length-1;if(t>0){i.textContent=Er?Er.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],Br()),Jr.nextNode(),u.push({type:2,index:++a});i.append(e[t],Br())}}}else if(8===i.nodeType)if(i.data===Dr)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(Ir,e+1));)u.push({type:7,index:a}),e+=Ir.length-1}a++}}static createElement(e,t){let r=Rr.createElement("template");return r.innerHTML=e,r}};function nn(e,t,r=e,n){if(t===Kr)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=Nr(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=nn(e,i._$AS(e,t.values),i,n)),t}var an=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??Rr).importNode(t,!0);Jr.currentNode=n;let i=Jr.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new on(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new dn(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=Jr.nextNode(),a++)}return Jr.currentNode=Rr,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},on=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=Zr,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=nn(this,e,t),Nr(e)?e===Zr||null==e||""===e?(this._$AH!==Zr&&this._$AR(),this._$AH=Zr):e!==this._$AH&&e!==Kr&&this._(e):void 0===e._$litType$?void 0===e.nodeType?Lr(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Zr&&Nr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Rr.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=rn.createElement(en(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new an(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=Qr.get(e.strings);return void 0===t&&Qr.set(e.strings,t=new rn(e)),t}k(t){Fr(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(Br()),this.O(Br()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=Pr(e).nextSibling;Pr(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},sn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=Zr,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Zr}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=nn(this,e,t,0),a=!Nr(e)||e!==this._$AH&&e!==Kr,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=nn(this,s[r+n],t,n),o===Kr&&(o=this._$AH[n]),a||=!Nr(o)||o!==this._$AH[n],o===Zr?e=Zr:e!==Zr&&(e+=(o??"")+i[n+1]
139),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===Zr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},un=class extends sn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Zr?void 0:e}},cn=class extends sn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Zr)}},ln=class extends sn{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=nn(this,e,t,0)??Zr)===Kr)return;let r=this._$AH,n=e===Zr&&r!==Zr||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==Zr&&(r===Zr||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},dn=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){nn(this,e)}},fn={M:kr,P:Ir,A:Dr,C:1,L:tn,R:an,D:Lr,V:nn,I:on,H:sn,N:cn,U:ln,B:un,F:dn},hn=Tr.litHtmlPolyfillSupport;hn?.(rn,on),(Tr.litHtmlVersions??=[]).push("3.3.3");var pn=globalThis,mn=class extends Cr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new on(t.insertBefore(Br(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Kr}};mn._$litElement$=!0,mn.finalized=!0,pn.litElementHydrateSupport?.({LitElement:mn});var gn=pn.litElementPolyfillSupport;gn?.({LitElement:mn}),(pn.litElementVersions??=[]).push("4.2.2");var vn=e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})},yn={attribute:!0,type:String,converter:Sr,reflect:!1,hasChanged:wr},bn=(e=yn,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),"setter"===n&&((e=Object.create(e)).wrapped=!0),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e,!0,r)},init(t){return void 0!==t&&this.C(n,void 0,e,t),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e,!0,r)}}throw Error("Unsupported decorator location: "+n)};function _n(e){return(t,r)=>"object"==typeof r?bn(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function xn(e){return _n({...e,state:!0,attribute:!1})}var Sn=e=>(...t)=>({_$litDirective$:e,values:t}),wn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},An=class extends wn{constructor(e){if(super(e),this.it=Zr,2!==e.type)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Zr||null==e)return this._t=void 0,this.it=e;if(e===Kr)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};An.directiveName="unsafeHTML",An.resultType=1;var Cn=Sn(An);function Tn(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function Pn(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function En(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var Mn=e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})},kn=globalThis,In=kn.ShadowRoot&&(void 0===kn.ShadyCSS||kn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Dn=Symbol(),On=new WeakMap,Rn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Dn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(In&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=On.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&On.set(t,e))}return e}toString(){return this.cssText}},Bn=In?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new Rn("string"==typeof e?e:e+"",void 0,Dn))(t)})(e):e,{is:Nn,defineProperty:Fn,getOwnPropertyDescriptor:Ln,getOwnPropertyNames:$n,getOwnPropertySymbols:Un,getPrototypeOf:jn}=Object,zn=globalThis,Gn=zn.trustedTypes,Vn=Gn?Gn.emptyScript:"",Hn=zn.reactiveElementPolyfillSupport,qn=(e,t)=>e,Wn={toAttribute(e,t){switch(t){case Boolean:e=e?Vn:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Xn=(e,t)=>!Nn(e,t),Yn={attribute:!0,type:String,converter:Wn,reflect:!1,hasChanged:Xn};Symbol.metadata??=Symbol("metadata"),zn.litPropertyMetadata??=new WeakMap;var Kn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Yn){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&Fn(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=Ln(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Yn}static _$Ei(){if(this.hasOwnProperty(qn("elementProperties")))return;let e=jn(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(qn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qn("properties"))){let e=this.properties,t=[...$n(e),...Un(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(Bn(e))}else void 0!==e&&t.push(Bn(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
139=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(In)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=kn.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Wn:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Wn:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??Xn)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};Kn.elementStyles=[],Kn.shadowRootOptions={mode:"open"},Kn[qn("elementProperties")]=new Map,Kn[qn("finalized")]=new Map,Hn?.({ReactiveElement:Kn}),(zn.reactiveElementVersions??=[]).push("2.0.4");var Zn={attribute:!0,type:String,converter:Wn,reflect:!1,hasChanged:Xn},Qn=(e=Zn,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function Jn(e){return(t,r)=>"object"==typeof r?Qn(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}var ei=(e,t)=>{class r extends e{constructor(){super(...arguments),this.width=t?.width,this.height=t?.height}}return Tn([Jn({type:Number})],r.prototype,"width",void 0),Tn([Jn({type:Number,reflect:!0})],r.prototype,"height",void 0),r};function ti(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ri(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ni(e){let t,r,n;
vendor: 12,988 bytes, line 139
139function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===ti||e===ri?e:ii,r=e,n=e):(t=ti,r=(t,r)=>ti(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function ii(){return 0}var ai=ni(ti).right;ni(function(e){return null===e?NaN:+e}).center;var oi=Math.sqrt(50),si=Math.sqrt(10),ui=Math.sqrt(2);function ci(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=oi?10:u>=si?5:u>=ui?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?ci(e,t,2*r):[n,i,a]}function li(e,t,r){return ci(e=+e,t=+t,r=+r)[2]}var di={value:()=>{}};function fi(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new hi(n)}function hi(e){this._=e}function pi(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function mi(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=di,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}hi.prototype=fi.prototype={constructor:hi,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=mi(i[r],e.name,t);else if(null==t)for(r in i)i[r]=mi(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=pi(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new hi(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var gi="http://www.w3.org/1999/xhtml",vi={svg:"http://www.w3.org/2000/svg",xhtml:gi,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yi(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),vi.hasOwnProperty(t)?{space:vi[t],local:e}:e}function bi(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===gi&&t.documentElement.namespaceURI===gi?t.createElement(e):t.createElementNS(r,e)}}function _i(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xi(e){var t=yi(e);return(t.local?_i:bi)(t)}function Si(){}function wi(e){return null==e?Si:function(){return this.querySelector(e)}}function Ai(){return[]}function Ci(e){return null==e?Ai:function(){return this.querySelectorAll(e)}}function Ti(e){return function(){return this.matches(e)}}function Pi(e){return function(t){return t.matches(e)}}var Ei=Array.prototype.find;function Mi(){return this.firstElementChild}var ki=Array.prototype.filter;function Ii(){return Array.from(this.children)}function Di(e){return Array(e.length)}function Oi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Ri(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new Oi(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function Bi(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new Oi(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function Ni(e){return e.__data__}function Fi(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Li(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $i(e){return function(){this.removeAttribute(e)}}function Ui(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ji(e,t){return function(){this.setAttribute(e,t)}}function zi(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Gi(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function Vi(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function Hi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function qi(e){return function(){this.style.removeProperty(e)}}function Wi(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Xi(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function Yi(e,t){return e.style.getPropertyValue(t)||Hi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ki(e){return function(){delete this[e]}}function Zi(e,t){return function(){this[e]=t}}function Qi(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function Ji(e){return e.trim().split(/^|\s+/)}function ea(e){return e.classList||new ta(e)}function ta(e){this._node=e,this._names=Ji(e.getAttribute("class")||"")}function ra(e,t){for(var r=ea(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function na(e,t){for(var r=ea(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function ia(e){return function(){ra(this,e)}}function aa(e){return function(){na(this,e)}}function oa(e,t){return function(){(t.apply(this,arguments)?ra:na)(this,e)}}function sa(){this.textContent=""}function ua(e){return function(){this.textContent=e}}function ca(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function la(){this.innerHTML=""}function da(e){return function(){this.innerHTML=e}}function fa(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ha(){this.nextSibling&&this.parentNode.appendChild(this)}function pa(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ma(){return null}function ga(){var e=this.parentNode;e&&e.removeChild(this)}function va(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ya(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ba(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function _a(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function xa(e,t,r){var n=Hi(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Sa(e,t){return function(){return xa(this,e,t)}}function wa(e,t){return function(){return xa(this,e,t.apply(this,arguments))}}Oi.prototype={constructor:Oi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},ta.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Aa=[null];function Ca(e,t){this._groups=e,this._parents=t}function Ta(){return new Ca([[document.documentElement]],Aa)}function Pa(e){return"string"==typeof e?new Ca([[document.querySelector(e)]],[document.documentElement]):new Ca([[e]],Aa)}function Ea(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}Ca.prototype=Ta.prototype={constructor:Ca,select:function(e){"function"!=typeof e&&(e=wi(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new Ca(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}(e):Ci(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new Ca(n,i)},selectChild:function(e){return this.select(null==e?Mi:function(e){return function(){return Ei.call(this.children,e)}}("function"==typeof e?e:Pi(e)))},selectChildren:function(e){return this.selectAll(null==e?Ii:function(e){return function(){return ki.call(this.children,e)}}("function"==typeof e?e:Pi(e)))},filter:function(e){"function"!=typeof e&&(e=Ti(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new Ca(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,Ni);var r,n=t?Bi:Ri,i=this._parents,a=this._groups;"function"!=typeof e&&(r=e,e=function(){return r});for(var o=a.length,s=Array(o),u=Array(o),c=Array(o),l=0;l<o;++l){var d=i[l],f=a[l],h=f.length,p=Fi(e.call(d,d&&d.__data__,l,i)),m=p.length,g=u[l]=Array(m),v=s[l]=Array(m);n(d,f,g,v,c[l]=Array(h),p,t);for(var y,b,_=0,x=0;_<m;++_)if(y=g[_]){for(_>=x&&(x=_+1);!(b=v[x])&&++x<m;);y._next=b||null}}return(s=new Ca(s,i))._enter=u,s._exit=c,s},enter:function(){return new Ca(this._enter||this._groups.map(Di),this._parents)},exit:function(){return new Ca(this._exit||this._groups.map(Di),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new Ca(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=Li;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new Ca(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=yi(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?Ui:$i:"function"==typeof t?r.local?Vi:Gi:r.local?zi:ji)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?qi:"function"==typeof t?Xi:Wi)(e,t,r??"")):Yi(this.node(),e)},property:function(e,t){return arguments.length>
vendor: 10,575 bytes, line 139
1391?this.each((null==t?Ki:"function"==typeof t?Qi:Zi)(e,t)):this.node()[e]},classed:function(e,t){var r=Ji(e+"");if(arguments.length<2){for(var n=ea(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?oa:t?ia:aa)(r,t))},text:function(e){return arguments.length?this.each(null==e?sa:("function"==typeof e?ca:ua)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?la:("function"==typeof e?fa:da)(e)):this.node().innerHTML},raise:function(){return this.each(ha)},lower:function(){return this.each(pa)},append:function(e){var t="function"==typeof e?e:xi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:xi(e),n=null==t?ma:"function"==typeof t?t:wi(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(ga)},clone:function(e){return this.select(e?ya:va)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?_a:ba,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?wa:Sa)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var Ma={capture:!0,passive:!1};function ka(e){e.preventDefault(),e.stopImmediatePropagation()}function Ia(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Da(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Oa(){}var Ra=.7,Ba=1/Ra,Na="\\s*([+-]?\\d+)\\s*",Fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",La="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$a=/^#([0-9a-f]{3,8})$/,Ua=RegExp(`^rgb\\(${Na},${Na},${Na}\\)$`),ja=RegExp(`^rgb\\(${La},${La},${La}\\)$`),za=RegExp(`^rgba\\(${Na},${Na},${Na},${Fa}\\)$`),Ga=RegExp(`^rgba\\(${La},${La},${La},${Fa}\\)$`),Va=RegExp(`^hsl\\(${Fa},${La},${La}\\)$`),Ha=RegExp(`^hsla\\(${Fa},${La},${La},${Fa}\\)$`),qa={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Wa(){return this.rgb().formatHex()}function Xa(){return this.rgb().formatRgb()}function Ya(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=$a.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?Ka(t):3===r?new Ja(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?Za(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?Za(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Ua.exec(e))?new Ja(t[1],t[2],t[3],1):(t=ja.exec(e))?new Ja(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=za.exec(e))?Za(t[1],t[2],t[3],t[4]):(t=Ga.exec(e))?Za(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Va.exec(e))?ao(t[1],t[2]/100,t[3]/100,1):(t=Ha.exec(e))?ao(t[1],t[2]/100,t[3]/100,t[4]):qa.hasOwnProperty(e)?Ka(qa[e]):"transparent"===e?new Ja(NaN,NaN,NaN,0):null}function Ka(e){return new Ja(e>>16&255,e>>8&255,255&e,1)}function Za(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ja(e,t,r,n)}function Qa(e,t,r,n){return 1===arguments.length?function(e){return e instanceof Oa||(e=Ya(e)),e?new Ja((e=e.rgb()).r,e.g,e.b,e.opacity):new Ja}(e):new Ja(e,t,r,n??1)}function Ja(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function eo(){return`#${io(this.r)}${io(this.g)}${io(this.b)}`}function to(){let e=ro(this.opacity);return`${1===e?"rgb(":"rgba("}${no(this.r)}, ${no(this.g)}, ${no(this.b)}${1===e?")":`, ${e})`}`}function ro(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function no(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function io(e){return((e=no(e))<16?"0":"")+e.toString(16)}function ao(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new so(e,t,r,n)}function oo(e){if(e instanceof so)return new so(e.h,e.s,e.l,e.opacity);if(e instanceof Oa||(e=Ya(e)),!e)return new so;if(e instanceof so)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new so(o,s,u,e.opacity)}function so(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function uo(e){return(e=(e||0)%360)<0?e+360:e}function co(e){return Math.max(0,Math.min(1,e||0))}function lo(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}Ia(Oa,Ya,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wa,formatHex:Wa,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return oo(this).formatHsl()},formatRgb:Xa,toString:Xa}),Ia(Ja,Qa,Da(Oa,{brighter(e){return e=null==e?Ba:Ba**+e,new Ja(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Ra:Ra**+e,new Ja(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ja(no(this.r),no(this.g),no(this.b),ro(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:eo,formatHex:eo,formatHex8:function(){return`#${io(this.r)}${io(this.g)}${io(this.b)}${io(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:to,toString:to})),Ia(so,function(e,t,r,n){return 1===arguments.length?oo(e):new so(e,t,r,n??1)},Da(Oa,{brighter(e){return e=null==e?Ba:Ba**+e,new so(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Ra:Ra**+e,new so(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ja(lo(e>=240?e-240:e+120,i,n),lo(e,i,n),lo(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new so(uo(this.h),co(this.s),co(this.l),ro(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=ro(this.opacity);return`${1===e?"hsl(":"hsla("}${uo(this.h)}, ${100*co(this.s)}%, ${100*co(this.l)}%${1===e?")":`, ${e})`}`}}));var fo=e=>()=>e;function ho(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):fo(isNaN(e)?t:e)}var po=function e(t){var r=function(e){return 1==(e=+e)?ho:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):fo(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=Qa(e)).r,(t=Qa(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=ho(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function mo(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function go(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=wo(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function vo(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function yo(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function bo(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=wo(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}var _o=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xo=new RegExp(_o.source,"g");function So(e,t){var r,n,i,a=_o.lastIndex=xo.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=_o.exec(e))&&(n=xo.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:yo(r,n)}
139)),a=xo.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function wo(e,t){var r,n,i=typeof t;return null==t||"boolean"===i?fo(t):("number"===i?yo:"string"===i?(r=Ya(t))?(t=r,po):So:t instanceof Ya?po:t instanceof Date?vo:(n=t,!ArrayBuffer.isView(n)||n instanceof DataView?Array.isArray(t)?go:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?bo:yo:mo))(e,t)}function Ao(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var Co,To=180/Math.PI,Po={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Eo(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*To,skewX:Math.atan(u)*To,scaleX:o,scaleY:s}}function Mo(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:yo(e,i)},{i:u-2,x:yo(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:yo(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",
139null,n)-2,x:yo(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:yo(e,r)},{i:s-2,x:yo(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var ko=Mo(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Po:Eo(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Io=Mo(function(e){return null==e?Po:(Co||=document.createElementNS("http://www.w3.org/2000/svg","g"),Co.setAttribute("transform",e),(e=Co.transform.baseVal.consolidate())?Eo((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Po)},", ",")",")");function Do(e){return((e=Math.exp(e))+1/e)/2}var Oo,Ro,Bo=function e(t,r,n){function i(e,i){var a,o,s=e[0],u=e[1],c=e[2],l=i[0],d=i[1],f=i[2],h=l-s,p=d-u,m=h*h+p*p;if(m<1e-12)o=Math.log(f/c)/t,a=function(e){return[s+e*h,u+e*p,c*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),v=(f*f-c*c+n*m)/(2*c*r*g),y=(f*f-c*c-n*m)/(2*f*r*g),b=Math.log(Math.sqrt(v*v+1)-v);o=(Math.log(Math.sqrt(y*y+1)-y)-b)/t,a=function(e){var n,i=e*o,a=Do(b),l=c/(r*g)*(a*(n=t*i+b,((n=Math.exp(2*n))-1)/(n+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+l*h,u+l*p,c*a/Do(t*i+b)]}}return a.duration=1e3*o*t/Math.SQRT2,a}return i.rho=function(t){var r=Math.max(.001,+t),n=r*r;return e(r,n,n*n)},i}(Math.SQRT2,2,4),No=0,Fo=0,Lo=0,$o=0,Uo=0,jo=0,zo="object"==typeof performance&&performance.now?performance:Date,Go="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vo(){return Uo||=(Go(Ho),zo.now()+jo)}function Ho(){Uo=0}function qo(){this._call=this._time=this._next=null}function Wo(e,t,r){var n=new qo;return n.restart(e,t,r),n}function Xo(){Uo=($o=zo.now())+jo,No=Fo=0;try{!function(){Vo(),++No;for(var e,t=Oo;t;)(e=Uo-t._time)>=0&&t._call.call(void 0,e),t=t._next;--No}()}finally{No=0,function(){for(var e,t,r=Oo,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:Oo=t);Ro=e,Ko(n)}(),Uo=0}}function Yo(){var e=zo.now(),t=e-$o;t>1e3&&(jo-=t,$o=e)}function Ko(e){No||(Fo&&=clearTimeout(Fo),e-Uo>24?(e<1/0&&(Fo=setTimeout(Xo,e-zo.now()-jo)),Lo&&=clearInterval(Lo)):(Lo||=($o=zo.now(),setInterval(Yo,1e3)),No=1,Go(Xo)))}function Zo(e,t,r){var n=new qo;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}qo.prototype=Wo.prototype={constructor:qo,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?Vo():+r)+(null==t?0:+t),this._next||Ro===this||(Ro?Ro._next=this:Oo=this,Ro=this),this._call=e,this._time=r,Ko()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ko())}};var Qo=fi("start","end","cancel","interrupt"),Jo=[];function es(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return Zo(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(Zo(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
139),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=Wo(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:Qo,tween:Jo,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ts(e,t){var r=ns(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function rs(e,t){var r=ns(e,t);if(r.state>3)throw Error("too late; already running");return r}function ns(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function is(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}function as(e,t){var r,n;return function(){var i=rs(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function os(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=rs(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function ss(e,t,r){var n=e._id;return e.each(function(){var e=rs(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return ns(e,n).value[t]}}function us(e,t){var r;return("number"==typeof t?yo:t instanceof Ya?po:(r=Ya(t))?(t=r,po):So)(e,t)}function cs(e){return function(){this.removeAttribute(e)}}function ls(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ds(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function fs(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function hs(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function ps(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function ms(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function gs(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function vs(e,t){return function(){ts(this,e).delay=+t.apply(this,arguments)}}function ys(e,t){return t=+t,function(){ts(this,e).delay=t}}function bs(e,t){return function(){rs(this,e).duration=+t.apply(this,arguments)}}function _s(e,t){return t=+t,function(){rs(this,e).duration=t}}var xs=Ta.prototype.constructor;function Ss(e){return function(){this.style.removeProperty(e)}}var ws=0;function As(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function Cs(){return++ws}var Ts=Ta.prototype;As.prototype={constructor:As,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=wi(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,es(d[f],t,r,f,d,ns(s,r)));return new As(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=Ci(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=ns(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&es(f,t,r,m,h,p);a.push(h),o.push(u)}return new As(a,o,t,r)},selectChild:Ts.selectChild,selectChildren:Ts.selectChildren,filter:function(e){"function"!=typeof e&&(e=Ti(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new As(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new As(o,this._parents,this._name,this._id)},selection:function(){return new xs(this._groups,this._parents)}
vendor: 8,413 bytes, line 139
139,transition:function(){for(var e=this._name,t=this._id,r=Cs(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=ns(o,t);es(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new As(n,this._parents,e,r)},call:Ts.call,nodes:Ts.nodes,node:Ts.node,size:Ts.size,empty:Ts.empty,each:Ts.each,on:function(e,t){var r=this._id;return arguments.length<2?ns(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?ts:rs;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=yi(e),n="transform"===r?Io:us;return this.attrTween(e,"function"==typeof t?(r.local?ps:hs)(r,n,ss(this,"attr."+e,t)):null==t?(r.local?ls:cs)(r):(r.local?fs:ds)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=yi(e);return this.tween(r,(n.local?ms:gs)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?ko:us;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=Yi(this,e),o=(this.style.removeProperty(e),Yi(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,Ss(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=Yi(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=Yi(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,ss(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=rs(this,e),c=u.on,l=null==u.value[o]?a||=Ss(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=Yi(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(ss(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=ns(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?as:os)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?vs:ys)(t,e)):ns(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?bs:_s)(t,e)):ns(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){rs(this,e).ease=t}}(t,e)):ns(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();rs(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=rs(this,n),i=r.on;i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:Ts[Symbol.iterator]};var Ps={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Es(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}function Ms(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ks(e){return(e=Ms(Math.abs(e)))?e[1]:NaN}Ta.prototype.interrupt=function(e){return this.each(function(){is(this,e)})},Ta.prototype.transition=function(e){var t,r;e instanceof As?(t=e._id,e=e._name):(t=Cs(),(r=Ps).time=Vo(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&es(o,e,t,c,s,r||Es(o,t));return new As(n,this._parents,e,t)};var Is,Ds=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Os(e){if(!(t=Ds.exec(e)))throw Error("invalid format: "+e);var t;return new Rs({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Rs(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Bs(e,t){var r=Ms(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}Os.prototype=Rs.prototype,Rs.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ns={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Bs(100*e,t),r:Bs,s:function(e,t){var r=Ms(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(Is=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+Ms(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Fs(e){return e}var Ls,$s,Us,js=Array.prototype.map,zs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Gs(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Vs(e){return+e}Ls=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?Fs:(t=js.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?Fs:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(js.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=Os(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):Ns[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=Ns[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;
139if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?zs[8+Is/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=Os(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(ks(t)/3))),i=10**-n,a=zs[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),$s=Ls.format,Us=Ls.formatPrefix;var Hs=[0,1];function qs(e){return e}function Ws(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function Xs(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=Ws(i,n),a=r(o,a)):(n=Ws(n,i),a=r(a,o)),function(e){return a(n(e))}}function Ys(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=Ws(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=ai(e,t,1,n)-1;return a[r](i[r](t))}}function Ks(){var e=function(){var e,t,r,n,i,a,o=Hs,s=Hs,u=wo,c=qs;function l(){var e=Math.min(o.length,s.length);return c!==qs&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?Ys:Xs,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),yo))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,Vs),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=Ao,l()},d.clamp=function(e){return arguments.length?(c=!!e||qs,l()):c!==qs},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}()(qs,qs);return e.copy=function(){return t=e,Ks().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},Gs.apply(e,arguments),function(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?ci(t,e,r):ci(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return function(e,t,r,n){var i,a=function(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?li(t,e,r):li(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}(e,t,r);switch((n=Os(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ks(t)/3)))-ks(Math.abs(e)))}(a,o))||(n.precision=i),Us(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ks(t)-ks(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-ks(Math.abs(e)))}(a))||(n.precision=i-2*("%"===n.type))}return $s(n)}(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=li(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}(e)}var Zs=e=>()=>e;function Qs(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function Js(e,t,r){this.k=e,this.x=t,this.y=r}Js.prototype={constructor:Js,scale:function(e){return 1===e?this:new Js(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Js(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var eu=new Js(1,0,0);function tu(e){e.stopImmediatePropagation()}function ru(e){e.preventDefault(),e.stopImmediatePropagation()}function nu(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function iu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function au(){return this.__zoom||eu}function ou(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?
1391:.002)*(e.ctrlKey?10:1)}function su(){return navigator.maxTouchPoints||"ontouchstart"in this}function uu(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}Js.prototype;var cu=e=>class extends e{constructor(){super(...arguments),this.canvasScale=1}connectedCallback(){super.connectedCallback(),Pa(window).on(`resize.WithCanvas-${this.id}`,()=>this.updateCanvasScale())}disconnectedCallback(){Pa(window).on(`resize.WithCanvas-${this.id}`,null),super.disconnectedCallback()}firstUpdated(e){super.firstUpdated(e),this.canvas=Pa(this).selectAll("canvas"),this.canvas.empty()&&console.error("Failed to initialize canvas context. This element contains no <canvas> node.",this),this.canvasCtx=this.canvas.node()?.getContext("2d")??void 0,this.onDimensionsChange()}onDimensionsChange(){super.onDimensionsChange(),this.canvas&&!this.canvas.empty()&&(this.canvas.style("width",`${this.width}px`),this.canvas.style("height",`${this.height}px`),this.updateCanvasScale())}onCanvasScaleChange(){}adjustCanvasCtxLogicalSize(){if(!this.canvasCtx)return;let e=Math.floor(this.width*this.canvasScale),t=Math.floor(this.height*this.canvasScale);this.canvasCtx.canvas.width!==e&&(this.canvasCtx.canvas.width=e),this.canvasCtx.canvas.height!==t&&(this.canvasCtx.canvas.height=t)}updateCanvasScale(){let e=(null==window?void 0:window.devicePixelRatio)??1;e!==this.canvasScale&&(this.canvasScale=e,this.onCanvasScaleChange())}},lu={"display-start":1,"display-end":-1,length:0},du=(e,t={})=>{var r,n;class i extends e{constructor(){super(...arguments),r.set(this,{...lu,...t}),n.set(this,Pn(this,r,"f").length),this["display-start"]=Pn(this,r,"f")["display-start"],this["display-end"]=Pn(this,r,"f")["display-end"]}get length(){return Pn(this,n,"f")}set length(e){En(this,n,e,"f"),(this["display-end"]||0)>Pn(this,n,"f")&&(this["display-end"]=this.length)}}return r=new WeakMap,n=new WeakMap,Tn([Jn({type:Number,reflect:!0})],i.prototype,"length",null),Tn([Jn({type:Number,reflect:!0})],i.prototype,"display-start",void 0),Tn([Jn({type:Number,reflect:!0})],i.prototype,"display-end",void 0),i},fu="#FFFFFFDD",hu={"margin-top":0,"margin-bottom":0,"margin-left":10,"margin-right":10,"margin-color":fu},pu=(e,t={})=>{var r;class n extends(ei(e)){constructor(){super(...arguments),r.set(this,{...hu,...t}),this["margin-top"]=Pn(this,r,"f")["margin-top"],this["margin-bottom"]=Pn(this,r,"f")["margin-bottom"],this["margin-left"]=Pn(this,r,"f")["margin-left"],this["margin-right"]=Pn(this,r,"f")["margin-right"],this["margin-color"]=Pn(this,r,"f")["margin-color"]??fu}getWidthWithMargins(){return this.width?this.width-this["margin-left"]-this["margin-right"]:0}getHeightWithMargins(){return this.height?this.height-this["margin-top"]-this["margin-bottom"]:0}renderMarginOnGroup(e){e&&(e.select("rect").empty()&&(e.append("rect").style("pointer-events","none").attr("class","margin-left"),e.append("rect").style("pointer-events","none").attr("class","margin-right"),e.append("rect").style("pointer-events","none").attr("class","margin-top"),e.append("rect").style("pointer-events","none").attr("class","margin-bottom")),e.select("rect.margin-left").attr("fill",this["margin-color"]).attr("x",0).attr("y",0).attr("width",this["margin-left"]).attr("height",this.height),e.select("rect.margin-right").attr("fill",this["margin-color"]).attr("x",this.width-this["margin-right"]).attr("y",0).attr("width",this["margin-right"]).attr("height",this.height),e.select("rect.margin-top").attr("fill",this["margin-color"]).attr("x",this["margin-left"]).attr("y",0).attr("width",this.width-this["margin-left"]-this["margin-right"]).attr("height",this["margin-top"]),e.select("rect.margin-bottom").attr("fill",this["margin-color"]).attr("x",this["margin-left"]).attr("y",this.height-this["margin-bottom"]).attr("width",this.width-this["margin-left"]-this["margin-right"]).attr("height",this["margin-bottom"]))}}return r=new WeakMap,Tn([Jn({type:Number})],n.prototype,"margin-top",void 0),Tn([Jn({type:Number})],n.prototype,"margin-bottom",void 0),Tn([Jn({type:Number})],n.prototype,"margin-left",void 0),Tn([Jn({type:Number})],n.prototype,"margin-right",void 0),Tn([Jn({type:String})],n.prototype,"margin-color",void 0),n},mu={"min-width":10,"min-height":10},gu=(e,t={})=>{var r;class n extends(ei(e)){constructor(){super(...arguments),r.set(this,{...mu,...t}),this["min-width"]=Pn(this,r,"f")["min-width"],this["min-height"]=Pn(this,r,"f")["min-height"]}onDimensionsChange(){}connectedCallback(){super.connectedCallback(),this.width??=this["min-width"],this.height??=this["min-height"],null===this.getAttribute("width")&&(this.style.width="100%"),null===this.getAttribute("height")&&(this.style.height="100%"),vu.observe(this)}disconnectedCallback(){vu.unobserve(this),super.disconnectedCallback()}}return r=new WeakMap,Tn([Jn({type:Number,reflect:!0})],n.prototype,"min-width",void 0),Tn([Jn({type:Number,reflect:!0})],n.prototype,"min-height",void 0),n},vu=new ResizeObserver(e=>{window.requestAnimationFrame(()=>{for(let t of e){let e=t.contentBoxSize?.[0].inlineSize,r=t.contentBoxSize?.[0].blockSize;void 0!==e&&void 0!==r&&yu(t.target,e,r)}})});function yu(e,t,r){t=Math.max(t,e["min-width"]),r=Math.max(r,e["min-height"]);let n=!1;t!==e.width&&null===e.getAttribute("width")&&(e.width=t,n=!0),r!==e.height&&null===e.getAttribute("height")&&(e.height=r,n=!0),n&&e.onDimensionsChange()}var bu=e=>class extends e{connectedCallback(){this.closest("nightingale-manager")&&customElements.whenDefined("nightingale-manager").then(()=>{this.manager=this.closest("nightingale-manager"),this.manager&&this.manager.register(this)}),super.connectedCallback()}disconnectedCallback(){this.manager&&this.manager.unregister(this),super.disconnectedCallback()}},_u=class{constructor({min:e=-1/0,max:t=1/0}={}){this.segments=[],this.max=t,this.min=e,this.regionString=null}encode(e=!1){return this.segments.map(({start:t,end:r})=>e?`${t}:${r}`:`${t===this.min?"":t}:${r===this.max?"":r}`).join(",")}decode(e){void 0!==e&&(this.regionString=e),this.regionString?this.segments=this.regionString.split(",").map(e=>{let[t,r,n]=e.split(":");if(void 0!==n)throw Error(`there should be at most 1 ':' per region. Region: ${e}`);let i=t?Number(t):this.min,a=r?Number(r):this.max;if(i>a&&([i,a]=[a,i]),i<this.min&&(i=this.min),a>this.max&&(a=this.max),Number.isNaN(i))throw Error(`The parsed value of ${t}
139 is NaN. Region: ${e}`);if(Number.isNaN(a))throw Error(`The parsed value of ${r} is NaN. Region: ${e}`);return{start:i,end:a}}):this.segments=[]}},xu=(e,t)=>e?t?`${e},${t}`:e:t,Su={highlight:null,"highlight-color":"#FFEB3B66"},wu=(e,t={})=>{var r,n;class i extends e{constructor(...e){super(...e),r.set(this,{...Su,...t}),this.highlight=Pn(this,r,"f").highlight,this["highlight-color"]=Pn(this,r,"f")["highlight-color"],n.set(this,void 0),this.highlightedRegion=new _u({min:1}),En(this,n,null,"f")}set fixedHighlight(e){En(this,n,e,"f"),this.highlightedRegion.decode(xu(this.highlight||"",Pn(this,n,"f")||"")),this.updateHighlight()}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),"null"===r&&(r=null),t!==r&&("length"===e&&(this.highlightedRegion.max=Number(r)),"highlight"===e&&this.highlightedRegion.decode(xu(r||"",Pn(this,n,"f")||"")))}updateHighlight(){}}return r=new WeakMap,n=new WeakMap,Tn([Jn({type:String,reflect:!0})],i.prototype,"highlight",void 0),Tn([Jn({type:String,reflect:!0})],i.prototype,"highlight-color",void 0),i},Au=class{constructor(e){this.target=e,this.scrollRequiresCtrl=!1,this.currentWheelGesture={lastTimestamp:0,lastAbsDelta:0,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1},this.target.on("wheel.WheelHelper",e=>this.handleWheel(e))}dispose(){this.target.on("wheel.WheelHelper",null)}wheelAction(e){let t=e.ctrlKey&&0===e.deltaMode&&0===e.deltaX&&e.deltaY!==Math.floor(e.deltaY),r=Math.abs(e.deltaX)>Math.abs(e.deltaY),n=Math.abs(e.deltaX)<Math.abs(e.deltaY),i=1===e.deltaMode?25:e.deltaMode?500:1,a=t||!this.scrollRequiresCtrl&&(this.currentWheelGesture.ctrlKey||this.currentWheelGesture.metaKey)?10:1;return t?{kind:"zoom",delta:.002*-e.deltaY*i*a}:r?{kind:"pan",deltaX:-e.deltaX*i*a,deltaY:0}:n?this.currentWheelGesture.shiftKey?{kind:"pan",deltaX:-e.deltaY*i*a,deltaY:0}:!this.scrollRequiresCtrl||this.currentWheelGesture.ctrlKey||this.currentWheelGesture.metaKey?{kind:"zoom",delta:.002*-e.deltaY*i*a}:{kind:"ignore"}:{kind:"pan",deltaX:0,deltaY:0}}handleWheel(e){var t;this.updateCurrentWheelGesture(e);let r=this.wheelAction(e);"ignore"!==r.kind&&e.preventDefault(),"pan"===r.kind&&(null==(t=this.handlePan)||t.call(this,r.deltaX))}updateCurrentWheelGesture(e){let t=Date.now(),r=Math.max(Math.abs(e.deltaX),Math.abs(e.deltaY));(0!==e.deltaMode||t>this.currentWheelGesture.lastTimestamp+150||r>=120||r>this.currentWheelGesture.lastAbsDelta+5)&&(this.currentWheelGesture.ctrlKey=e.ctrlKey,this.currentWheelGesture.shiftKey=e.shiftKey,this.currentWheelGesture.altKey=e.altKey,this.currentWheelGesture.metaKey=e.metaKey),this.currentWheelGesture.lastTimestamp=t,this.currentWheelGesture.lastAbsDelta=r}},Cu=["length","width","height"],Tu=e=>{class t extends(pu(du(gu(ei(e))))){constructor(){super(...arguments),this.dontDispatch=!1,this["use-ctrl-to-zoom"]=!1,this.requestZoomRefreshed=()=>{this._zoomRefreshedRequested||(this._zoomRefreshedRequested=!0,requestAnimationFrame(()=>{this._zoomRefreshedRequested=!1,this.zoomRefreshed()}))},this._zoomRefreshedRequested=!1}get svg(){return this._svg}set svg(e){this._svg=e,this.addZoomBehavior()}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),t!==("null"===r?null:r)&&(Cu.includes(e)&&(this.adjustZoomConstraints(),this.adjustZoom()),"display-start"!==e&&"display-end"!==e||this.adjustZoom(),"use-ctrl-to-zoom"==e&&this.wheelHelper&&(this.wheelHelper.scrollRequiresCtrl=this["use-ctrl-to-zoom"]),this.requestZoomRefreshed())}onDimensionsChange(){var e,t;super.onDimensionsChange(),null==(e=this.svg)||e.attr("width",this.width),null==(t=this.svg)||t.attr("height",this.height),this.adjustZoomConstraints(),this.adjustZoom(),this.requestZoomRefreshed()}addZoomBehavior(){var e,t;this.svg&&(null==(e=this.zoomBehavior)||e.on("zoom",null),null==(t=this.wheelHelper)||t.dispose(),this.wheelHelper=new Au(this.svg),this.wheelHelper.scrollRequiresCtrl=this["use-ctrl-to-zoom"],this.wheelHelper.handlePan=e=>{var t;this.svg&&(null==(t=this.zoomBehavior)||t.translateBy(this.svg,.6*e/this.getSingleBaseWidth(),0))},this.zoomBehavior=function(){var e,t,r,n=nu,i=iu,a=uu,o=ou,s=su,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,d=Bo,f=fi("start","zoom","end"),h=0,p=10;function m(e){e.property("__zoom",au).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",C).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(u[0],Math.min(u[1],t)))===e.k?e:new Js(t,e.x,e.y)}function v(e,t,r){var n=t[0]-r[0]*e.k,i=t[1]-r[1]*e.k;return n===e.x&&i===e.y?e:new Js(e.k,n,i)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,r,n){e.on("start.zoom",function(){_(this,arguments).event(n).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(n).end()}).tween("zoom",function(){var e=this,a=arguments,o=_(e,a).event(n),s=i.apply(e,a),u=null==r?y(s):"function"==typeof r?r.apply(e,a):r,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=e.__zoom,f="function"==typeof t?t.apply(e,a):t,h=d(l.invert(u).concat(c/l.k),f.invert(u).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),r=c/t[2];e=new Js(r,u[0]-t[0]*r,u[1]-t[1]*r)}o.zoom(null,e)}})}function _(e,t,r){return!r&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function S(e,...t){if(n.apply(this,arguments)){var r=_(this,t).event(e),i=this.__zoom,s=Math.max(u[0],Math.min(u[1],i.k*2**o.apply(this,arguments))),l=Ea(e);if(r.wheel)r.mouse[0][0]===l[0]&&r.mouse[0][1]===l[1]||(r.mouse[1]=i.invert(r.mouse[0]=l)),clearTimeout(r.wheel);else{if(i.k===s)return;r.mouse=[l,i.invert(l)],is(this),r.start()}ru(e),r.wheel=setTimeout(function(){r.wheel=null,r.end()}
vendor: 4,192 bytes, line 139
139,150),r.zoom("mouse",a(v(g(i,s),r.mouse[0],r.mouse[1]),r.extent,c))}}function w(e,...t){if(!r&&n.apply(this,arguments)){var i=e.currentTarget,o=_(this,t,!0).event(e),s=Pa(e.view).on("mousemove.zoom",function(e){if(ru(e),!o.moved){var t=e.clientX-l,r=e.clientY-d;o.moved=t*t+r*r>h}o.event(e).zoom("mouse",a(v(o.that.__zoom,o.mouse[0]=Ea(e,i),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),function(e,t){var r=e.document.documentElement,n=Pa(e).on("dragstart.drag",null);t&&(n.on("click.drag",ka,Ma),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}(e.view,o.moved),ru(e),o.event(e).end()},!0),u=Ea(e,i),l=e.clientX,d=e.clientY;(function(e){var t=e.document.documentElement,r=Pa(e).on("dragstart.drag",ka,Ma);"onselectstart"in t?r.on("selectstart.drag",ka,Ma):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")})(e.view),tu(e),o.mouse=[u,this.__zoom.invert(u)],is(this),o.start()}}function A(e,...t){if(n.apply(this,arguments)){var r=this.__zoom,o=Ea(e.changedTouches?e.changedTouches[0]:e,this),s=r.invert(o),u=r.k*(e.shiftKey?.5:2),d=a(v(g(r,u),o,s),i.apply(this,t),c);ru(e),l>0?Pa(this).transition().duration(l).call(b,d,o,e):Pa(this).call(m.transform,d,o,e)}}function C(r,...i){if(n.apply(this,arguments)){var a,o,s,u,c=r.touches,l=c.length,d=_(this,i,r.changedTouches.length===l).event(r);for(tu(r),o=0;o<l;++o)u=[u=Ea(s=c[o],this),this.__zoom.invert(u),s.identifier],d.touch0?d.touch1||d.touch0[2]===u[2]||(d.touch1=u,d.taps=0):(d.touch0=u,a=!0,d.taps=1+!!e);e&&=clearTimeout(e),a&&(d.taps<2&&(t=u[0],e=setTimeout(function(){e=null},500)),is(this),d.start())}}function T(e,...t){if(this.__zooming){var r,n,i,o,s=_(this,t).event(e),u=e.changedTouches,l=u.length;for(ru(e),r=0;r<l;++r)i=Ea(n=u[r],this),s.touch0&&s.touch0[2]===n.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===n.identifier&&(s.touch1[0]=i);if(n=s.that.__zoom,s.touch1){var d=s.touch0[0],f=s.touch0[1],h=s.touch1[0],p=s.touch1[1],m=(m=h[0]-d[0])*m+(m=h[1]-d[1])*m,y=(y=p[0]-f[0])*y+(y=p[1]-f[1])*y;n=g(n,Math.sqrt(m/y)),i=[(d[0]+h[0])/2,(d[1]+h[1])/2],o=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],o=s.touch0[1]}s.zoom("touch",a(v(n,i,o),s.extent,c))}}function P(e,...n){if(this.__zooming){var i,a,o=_(this,n).event(e),s=e.changedTouches,u=s.length;for(tu(e),r&&clearTimeout(r),r=setTimeout(function(){r=null},500),i=0;i<u;++i)a=s[i],o.touch0&&o.touch0[2]===a.identifier?delete o.touch0:o.touch1&&o.touch1[2]===a.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(a=Ea(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<p)){var c=Pa(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,r,n){var i=e.selection?e.selection():e;i.property("__zoom",au),e===i?i.interrupt().each(function(){_(this,arguments).event(n).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}):b(e,t,r,n)},m.scaleBy=function(e,t,r,n){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},r,n)},m.scaleTo=function(e,t,r,n){m.transform(e,function(){var e=i.apply(this,arguments),n=this.__zoom,o=null==r?y(e):"function"==typeof r?r.apply(this,arguments):r,s=n.invert(o),u="function"==typeof t?t.apply(this,arguments):t;return a(v(g(n,u),o,s),e,c)},r,n)},m.translateBy=function(e,t,r,n){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof r?r.apply(this,arguments):r),i.apply(this,arguments),c)},null,n)},m.translateTo=function(e,t,r,n,o){m.transform(e,function(){var e=i.apply(this,arguments),o=this.__zoom,s=null==n?y(e):"function"==typeof n?n.apply(this,arguments):n;return a(eu.translate(s[0],s[1]).scale(o.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof r?-r.apply(this,arguments):-r),e,c)},n,o)},x.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit
139("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Pa(this.that).datum();f.call(e,this.that,new Qs(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(o="function"==typeof e?e:Zs(+e),m):o},m.filter=function(e){return arguments.length?(n="function"==typeof e?e:Zs(!!e),m):n},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Zs(!!e),m):s},m.extent=function(e){return arguments.length?(i="function"==typeof e?e:Zs([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):i},m.scaleExtent=function(e){return arguments.length?(u[0]=+e[0],u[1]=+e[1],m):[u[0],u[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(l=+e,m):l},m.interpolate=function(e){return arguments.length?(d=e,m):d},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,m):Math.sqrt(h)},m.tapDistance=function(e){return arguments.length?(p=+e,m):p},m}(),this.zoomBehavior.filter(e=>!(e instanceof WheelEvent)||"zoom"===this.wheelHelper?.wheelAction(e).kind),this.zoomBehavior.wheelDelta(e=>{let t=this.wheelHelper?.wheelAction(e);return"zoom"===t?.kind?1*t.delta:0}),this.zoomBehavior.on("zoom",e=>this.handleZoom(e)),this.svg.call(this.zoomBehavior),this.adjustZoomConstraints(),this.adjustZoom(),this.requestZoomRefreshed())}handleZoom(e){if(!this.dontDispatch){let[t,r]=this.viewport();this.dispatchDisplayRange(e.transform.invertX(t),e.transform.invertX(r)-1)}}dispatchDisplayRange(e,t){e=Math.max(e,1),t=Math.min(t,this.length??1),e===this["display-start"]&&t===this["display-end"]||this.dispatchEvent(new CustomEvent("change",{detail:{"display-start":e,"display-end":t},bubbles:!0,cancelable:!0}))}adjustZoomConstraints(){if(!this.zoomBehavior)return;let e=this.length??1,[t,r]=this.viewport(),n=r-t,i=n/e,a=Math.max(n/2,i);this.zoomBehavior.translateExtent([[1,0],[e+1,0]]),this.zoomBehavior.scaleExtent([i,a]),this.zoomBehavior.extent([[t,0],[r,0]])}adjustZoom(){if(!this.svg||!this.zoomBehavior)return;let e=this.displayRange(),t=this.viewport();this.xScale=Ks(e,t),this.dontDispatch=!0,this.zoomBehavior.transform(this.svg,function(e,t){let r=(t[1]-t[0])/(e[1]-e[0]);return new Js(r,t[0]-r*e[0],0)}(e,t)),this.dontDispatch=!1}viewport(){return[this["margin-left"],this.width-this["margin-right"]]}displayRange(){return[this["display-start"]??1,(void 0===this["display-end"]||-1===this["display-end"]?this.length??1:this["display-end"])+1]}updateScaleDomain(){this.adjustZoomConstraints()}applyZoomTranslation(){this.adjustZoom(),this.requestZoomRefreshed()}zoomRefreshed(){}getXFromSeqPosition(e){return this.xScale?this.xScale(e):-1}getSeqPositionFromX(e){return this.xScale?.invert(e)}getSingleBaseWidth(){return this.xScale?this.xScale(2)-this.xScale(1):-1}}return Tn([Jn({type:Boolean})],t.prototype,"use-ctrl-to-zoom",void 0),t},Pu=e=>{class t extends(Tu(wu(e))){createHighlightGroup(){let e=Pa(this).selectAll("svg");this.highlighted=e.append("g").attr("class","highlighted")}updateHighlight(){if(!this.highlighted)return;let e=this.highlighted.selectAll("rect").data(this.highlightedRegion.segments);e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",this["highlight-color"]).attr("height",this.height).attr("x",e=>this.getXFromSeqPosition(e.start)).attr("width",e=>Math.max(0,this.getSingleBaseWidth()*(e.end-e.start+1))),e.exit().remove()}}return t},Eu="highlight-event";function Mu(e,t=null,r=!1,n=!1,i,a,o,s,u){t&&=t?.feature||t;let c={eventType:e,feature:t,target:o,parentEvent:s,coords:s&&"pageX"in s&&"pageY"in s?[s.pageX,s.pageY]:null};return r&&(c.highlight=t?.fragments?(t?.fragments||[]).map(e=>`${e.start}:${e.end}`).join(","):s?.shiftKey&&u?.highlight?`${u.highlight},${i}:${a}`:i&&a?`${i}:${a}`:void 0),n&&(c.selectedId=t?.accession),new CustomEvent("change",{detail:c,bubbles:!0,cancelable:!0})}function ku(e,t){e.on("mouseover",function(e,r){t.dispatchEvent(Mu("mouseover",r,"onmouseover"===t.getAttribute(Eu),!1,r.start??r.position,r.end??r.position,this,e))}).on("mouseout",()=>{t.dispatchEvent(Mu("mouseout",null,"onmouseover"===t.getAttribute(Eu)))}).on("click",function(e,r){t.dispatchEvent(Mu("click",r,"onclick"===t.getAttribute(Eu),!0,r.start??r.position,r.end??r.position,this,e,t))})}function Iu(e,t,r){return function(e,t,r,n,i){if(r===n)return r;for(;n-r>4;){let a=r+n>>1;i(e[a])>=t?n=a:r=a+1}for(let a=r;a<n;a++)if(i(e[a])>=t)return a;return n}(e,t,0,e.length,r)}var Du=Object.freeze({__proto__:null,firstEqIndex:function(e,t,r){let n=Iu(e,t,r);return n<e.length&&r(e[n])===t?n:void 0},firstGteqIndex:Iu});function Ou(e){let t=!1,r=!1;return{requestRefresh:function(){t=!0,r||async function(){for(;t;){t=!1,r=!0,await Ru(0);try{e()}catch(e){console.error(e)}r=!1}}()}}}function Ru(e){return new Promise(t=>setTimeout(()=>{t()},e))}var Bu=class{constructor(e){this.stampFunction=e,this.currentStampValue={}}update(){let e=this.currentStampValue;return this.currentStampValue=this.stampFunction(),{oldValue:e,newValue:this.currentStampValue,changed:!Nu(e,this.currentStampValue)}}};function Nu(e,t){for(let r in e)if(e[r]!==t[r])return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0}var Fu=e=>(t,r)=>{window.customElements.get(e)||(r?Mn(e)(t,r):Mn(e)(t))},Lu=globalThis,$u=Lu.trustedTypes,Uu=$u?$u.createPolicy("lit-html",{createHTML:e=>e}):void 0,ju="$lit$",zu=`lit$${Math.random().toFixed(9).slice(2)}$`,Gu="?"+zu,Vu=`<${Gu}>`,Hu=document,qu=()=>Hu.createComment(""),Wu=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Xu=Array.isArray,Yu="[ \t\n\f\r]",Ku=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zu=/-->/g,Qu=/>/g,Ju=RegExp(`>|${Yu}(?:([^\\s"'>=/]+)(${Yu}*=${Yu}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ec=/'/g,tc=/"/g,rc=/^(?:script|style|textarea|title)$/i,nc=Symbol.for("lit-noC
139hange"),ic=Symbol.for("lit-nothing"),ac=new WeakMap,oc=Hu.createTreeWalker(Hu,129);function sc(e,t){if(!Xu(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===Uu?t:Uu.createHTML(t)}var uc=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=Ku;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===Ku?"!--"===s[1]?o=Zu:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=Ju):(rc.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=Ju):o=Qu:o===Ju?">"===s[0]?(o=r??Ku,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?Ju:'"'===s[3]?tc:ec):o===tc||o===ec?o=Ju:o===Zu||o===Qu?o=Ku:(o=Ju,r=void 0);let d=o===Ju&&e[t+1].startsWith("/>")?" ":"";a+=o===Ku?u+Vu:c>=0?(i.push(n),u.slice(0,c)+ju+u.slice(c)+zu+d):u+zu+(-2===c?t:d)}return[sc(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),oc.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=oc.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ju)){let t=l[o++],r=i.getAttribute(e).split(zu),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?hc:"?"===n[1]?pc:"@"===n[1]?mc:fc}),i.removeAttribute(e)}else e.startsWith(zu)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(rc.test(i.tagName)){let e=i.textContent.split(zu),t=e.length-1;if(t>0){i.textContent=$u?$u.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],qu()),oc.nextNode(),u.push({type:2,index:++a});i.append(e[t],qu())}}}else if(8===i.nodeType)if(i.data===Gu)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(zu,e+1));)u.push({type:7,index:a}),e+=zu.length-1}a++}}static createElement(e,t){let r=Hu.createElement("template");return r.innerHTML=e,r}};function cc(e,t,r=e,n){if(t===nc)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=Wu(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=cc(e,i._$AS(e,t.values),i,n)),t}var lc=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??Hu).importNode(t,!0);oc.currentNode=n;let i=oc.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new dc(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new gc(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=oc.nextNode(),a++)}return oc.currentNode=Hu,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},dc=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=ic,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=cc(this,e,t),Wu(e)?e===ic||null==e||""===e?(this._$AH!==ic&&this._$AR(),this._$AH=ic):e!==this._$AH&&e!==nc&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>Xu(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ic&&Wu(this._$AH)?this._$AA.nextSibling.data=e:this.T(Hu.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=uc.createElement(sc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new lc(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=ac.get(e.strings);return void 0===t&&ac.set(e.strings,t=new uc(e)),t}k(t){Xu(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(qu()),this.O(qu()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},fc=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=ic,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ic}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=cc(this,e,t,0),a=!Wu(e)||e!==this._$AH&&e!==nc,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=cc(this,s[r+n],t,n),o===nc&&(o=this._$AH[n]),a||=!Wu(o)||o!==this._$AH[n],o===ic?e=ic:e!==ic&&(e+=(o??"")+i[n+1]
139),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===ic?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},hc=class extends fc{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ic?void 0:e}},pc=class extends fc{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ic)}},mc=class extends fc{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=cc(this,e,t,0)??ic)===nc)return;let r=this._$AH,n=e===ic&&r!==ic||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==ic&&(r===ic||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},gc=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){cc(this,e)}},vc=Lu.litHtmlPolyfillSupport;vc?.(uc,dc),(Lu.litHtmlVersions??=[]).push("3.2.1");var yc=class extends Kn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new dc(t.insertBefore(qu(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return nc}};yc._$litElement$=!0,yc.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:yc});var bc=globalThis.litElementPolyfillSupport;bc?.({LitElement:yc}),(globalThis.litElementVersions??=[]).push("4.1.1");var _c=class extends yc{connectedCallback(){super.connectedCallback(),this.style.display="inline-block",this.style.lineHeight="0"}createRenderRoot(){return this}},xc=n((e,t)=>{t.exports=XMLHttpRequest}),Sc=function(e,t){return Sc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Sc(e,t)};function wc(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Sc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Ac=function(){return Ac=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ac.apply(this,arguments)};function Cc(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function Tc(e,t,r,n){return new(r||=Promise)(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})}function Pc(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function Ec(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
139if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Mc(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function kc(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||=Array.prototype.slice.call(t,0,i),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function Ic(e){return this instanceof Ic?(this.v=e,this):new Ic(e)}function Dc(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var Oc=globalThis,Rc=Oc.ShadowRoot&&(void 0===Oc.ShadyCSS||Oc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Bc=Symbol(),Nc=new WeakMap,Fc=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Bc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Rc&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=Nc.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Nc.set(t,e))}return e}toString(){return this.cssText}},Lc=Rc?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new Fc("string"==typeof e?e:e+"",void 0,Bc))(t)})(e):e,{is:$c,defineProperty:Uc,getOwnPropertyDescriptor:jc,getOwnPropertyNames:zc,getOwnPropertySymbols:Gc,getPrototypeOf:Vc}=Object,Hc=globalThis,qc=Hc.trustedTypes,Wc=qc?qc.emptyScript:"",Xc=Hc.reactiveElementPolyfillSupport,Yc=(e,t)=>e,Kc={toAttribute(e,t){switch(t){case Boolean:e=e?Wc:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Zc=(e,t)=>!$c(e,t),Qc={attribute:!0,type:String,converter:Kc,reflect:!1,hasChanged:Zc};Symbol.metadata??=Symbol("metadata"),Hc.litPropertyMetadata??=new WeakMap;var Jc=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Qc){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&Uc(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=jc(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Qc}static _$Ei(){if(this.hasOwnProperty(Yc("elementProperties")))return;let e=Vc(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Yc("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Yc("properties"))){let e=this.properties,t=[...zc(e),...Gc(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(Lc(e))}else void 0!==e&&t.push(Lc(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
139=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Rc)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=Oc.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Kc:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Kc:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??Zc)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};Jc.elementStyles=[],Jc.shadowRootOptions={mode:"open"},Jc[Yc("elementProperties")]=new Map,Jc[Yc("finalized")]=new Map,Xc?.({ReactiveElement:Jc}),(Hc.reactiveElementVersions??=[]).push("2.0.4");var el=globalThis,tl=el.trustedTypes,rl=tl?tl.createPolicy("lit-html",{createHTML:e=>e}):void 0,nl="$lit$",il=`lit$${Math.random().toFixed(9).slice(2)}$`,al="?"+il,ol=`<${al}>`,sl=document,ul=()=>sl.createComment(""),cl=e=>null===e||"object"!=typeof e&&"function"!=typeof e,ll=Array.isArray,dl="[ \t\n\f\r]",fl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hl=/-->/g,pl=/>/g,ml=RegExp(`>|${dl}(?:([^\\s"'>=/]+)(${dl}*=${dl}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),gl=/'/g,vl=/"/g,yl=/^(?:script|style|textarea|title)$/i,bl=(e,...t)=>({_$litType$:1,strings:e,values:t}),_l=Symbol.for("lit-noChange"),xl=Symbol.for("lit-nothing"),Sl=new WeakMap,wl=sl.createTreeWalker(sl,129);function Al(e,t){if(!ll(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===rl?t:rl.createHTML(t)}var Cl=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=fl;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===fl?"!--"===s[1]?o=hl:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=ml):(yl.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=ml):o=pl:o===ml?">"===s[0]?(o=r??fl,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?ml:'"'===s[3]?vl:gl):o===vl||o===gl?o=ml:o===hl||o===pl?o=fl:(o=ml,r=void 0);let d=o===ml&&e[t+1].startsWith("/>")?" ":"";a+=o===fl?u+ol:c>
139=0?(i.push(n),u.slice(0,c)+nl+u.slice(c)+il+d):u+il+(-2===c?t:d)}return[Al(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),wl.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=wl.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(nl)){let t=l[o++],r=i.getAttribute(e).split(il),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?kl:"?"===n[1]?Il:"@"===n[1]?Dl:Ml}),i.removeAttribute(e)}else e.startsWith(il)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(yl.test(i.tagName)){let e=i.textContent.split(il),t=e.length-1;if(t>0){i.textContent=tl?tl.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],ul()),wl.nextNode(),u.push({type:2,index:++a});i.append(e[t],ul())}}}else if(8===i.nodeType)if(i.data===al)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(il,e+1));)u.push({type:7,index:a}),e+=il.length-1}a++}}static createElement(e,t){let r=sl.createElement("template");return r.innerHTML=e,r}};function Tl(e,t,r=e,n){if(t===_l)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=cl(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=Tl(e,i._$AS(e,t.values),i,n)),t}var Pl=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??sl).importNode(t,!0);wl.currentNode=n;let i=wl.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new El(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new Ol(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=wl.nextNode(),a++)}return wl.currentNode=sl,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},El=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=xl,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Tl(this,e,t),cl(e)?e===xl||null==e||""===e?(this._$AH!==xl&&this._$AR(),this._$AH=xl):e!==this._$AH&&e!==_l&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>ll(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==xl&&cl(this._$AH)?this._$AA.nextSibling.data=e:this.T(sl.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Cl.createElement(Al(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new Pl(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=Sl.get(e.strings);return void 0===t&&Sl.set(e.strings,t=new Cl(e)),t}k(t){ll(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(ul()),this.O(ul()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},Ml=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=xl,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=xl}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=Tl(this,e,t,0),a=!cl(e)||e!==this._$AH&&e!==_l,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;
139n++)o=Tl(this,s[r+n],t,n),o===_l&&(o=this._$AH[n]),a||=!cl(o)||o!==this._$AH[n],o===xl?e=xl:e!==xl&&(e+=(o??"")+i[n+1]),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===xl?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},kl=class extends Ml{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xl?void 0:e}},Il=class extends Ml{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==xl)}},Dl=class extends Ml{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=Tl(this,e,t,0)??xl)===_l)return;let r=this._$AH,n=e===xl&&r!==xl||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==xl&&(r===xl||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ol=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Tl(this,e)}},Rl=el.litHtmlPolyfillSupport;Rl?.(Cl,El),(el.litHtmlVersions??=[]).push("3.2.1");var Bl=class extends Jc{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new El(t.insertBefore(ul(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return _l}};Bl._$litElement$=!0,Bl.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:Bl});var Nl=globalThis.litElementPolyfillSupport;Nl?.({LitElement:Bl}),(globalThis.litElementVersions??=[]).push("4.1.1");var Fl={attribute:!0,type:String,converter:Kc,reflect:!1,hasChanged:Zc},Ll=(e=Fl,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function $l(e){return(t,r)=>"object"==typeof r?Ll(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function Ul(e){return $l({...e,state:!0,attribute:!1})}var{entries:jl,setPrototypeOf:zl,isFrozen:Gl,getPrototypeOf:Vl,getOwnPropertyDescriptor:Hl}=Object,{freeze:ql,seal:Wl,create:Xl}=Object,{apply:Yl,construct:Kl}=typeof Reflect<"u"&&Reflect;ql||=function(e){return e},Wl||=function(e){return e},Yl||=function(e,t){var r=[...arguments].slice(2);return e.apply(t,r)},Kl||=function(e){return new e(...[...arguments].slice(1))};var Zl,Ql=fd(Array.prototype.forEach),Jl=fd(Array.prototype.lastIndexOf),ed=fd(Array.prototype.pop),td=fd(Array.prototype.push),rd=fd(Array.prototype.splice),nd=fd(String.prototype.toLowerCase),id=fd(String.prototype.toString),ad=fd(String.prototype.match),od=fd(String.prototype.replace),sd=fd(String.prototype.indexOf),ud=fd(String.prototype.trim),cd=fd(Object.prototype.hasOwnProperty),ld=fd(RegExp.prototype.test),dd=(Zl=TypeError,function(){return Kl(Zl,[...arguments])});function fd(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var r=[...arguments].slice(1);return Yl(e,t,r)}}function hd(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nd;zl&&zl(e,null);let n=t.length;for(;n--;){let i=t[n];if("string"==typeof i){let e=r(i);e!==i&&(Gl(t)||(t[n]=e),i=e)}e[i]=!0}return e}function pd(e){for(let t=0;t<e.length;t++)cd(e,t)||(e[t]=null);return e}function md(e){let t=Xl(null);for(let[r,n]of jl(e))cd(e,r)&&(Array.isArray(n)?t[r]=pd(n):n&&"object"==typeof n&&n.constructor===Object?t[r]=md(n):t[r]=n);return t}function gd(e,t){for(;null!==e;){let r=Hl(e,t);if(r){if(r.get)return fd(r.get);if("function"==typeof r.value)return fd(r.value)}e=Vl(e)}return function(){return null}}var vd,yd,bd,_d,xd,Sd,wd,Ad=ql("a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.f
139igcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")),Cd=ql("svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")),Td=ql(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Pd=ql(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ed=ql("math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")),Md=ql(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),kd=ql(["#text"]),Id=ql("accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot".split(".")),Dd=ql("accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")),Od=ql("accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")),Rd=ql(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Bd=Wl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Nd=Wl(/<%[\w\W]*|[\w\W]*%>/gm),Fd=Wl(/\$\{[\w\W]*/gm),Ld=Wl(/^data-[\-\w.\u00B7-\uFFFF]+$/),$d=Wl(/^aria-[\-\w]+$/),Ud=Wl(/^(?:(?:(?
139:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jd=Wl(/^(?:\w+script|data):/i),zd=Wl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gd=Wl(/^html$/i),Vd=Wl(/^[a-z][.\w]*(-[.\w]+)+$/i),Hd=Object.freeze({__proto__:null,ARIA_ATTR:$d,ATTR_WHITESPACE:zd,CUSTOM_ELEMENT:Vd,DATA_ATTR:Ld,DOCTYPE_NAME:Gd,ERB_EXPR:Nd,IS_ALLOWED_URI:Ud,IS_SCRIPT_OR_DATA:jd,MUSTACHE_EXPR:Bd,TMPLIT_EXPR:Fd}),qd=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:typeof window>"u"?null:window,r=t=>e(t);if(r.version="3.3.3",r.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return r.isSupported=!1,r;let{document:n}=t,i=n,a=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:u,Element:c,NodeFilter:l,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:p}=t,m=c.prototype,g=gd(m,"cloneNode"),v=gd(m,"remove"),y=gd(m,"nextSibling"),b=gd(m,"childNodes"),_=gd(m,"parentNode");if("function"==typeof s){let e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S="",{implementation:w,createNodeIterator:A,createDocumentFragment:C,getElementsByTagName:T}=n,{importNode:P}=i,E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};r.isSupported="function"==typeof jl&&"function"==typeof _&&w&&void 0!==w.createHTMLDocument;let{MUSTACHE_EXPR:M,ERB_EXPR:k,TMPLIT_EXPR:I,DATA_ATTR:D,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:B,CUSTOM_ELEMENT:N}=Hd,{IS_ALLOWED_URI:F}=Hd,L=null,$=hd({},[...Ad,...Cd,...Td,...Ed,...kd]),U=null,j=hd({},[...Id,...Dd,...Od,...Rd]),z=Object.seal(Xl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,V=null,H=Object.seal(Xl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),q=!0,W=!0,X=!1,Y=!0,K=!1,Z=!0,Q=!1,J=!1,ee=!1,te=!1,re=!1,ne=!1,ie=!0,ae=!1,oe=!0,se=!1,ue={},ce=null,le=hd({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),de=null,fe=hd({},["audio","video","img","source","image","track"]),he=null,pe=hd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),me="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml",ye=ve,be=!1,_e=null,xe=hd({},[me,ge,ve],id),Se=hd({},["mi","mo","mn","ms","mtext"]),we=hd({},["annotation-xml"]),Ae=hd({},["title","style","font","a","script"]),Ce=null,Te=["application/xhtml+xml","text/html"],Pe=null,Ee=null,Me=n.createElement("form"),ke=function(e){return e instanceof RegExp||e instanceof Function},Ie=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=md(e),Ce=-1===Te.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Pe="application/xhtml+xml"===Ce?id:nd,L=cd(e,"ALLOWED_TAGS")?hd({},e.ALLOWED_TAGS,Pe):$,U=cd(e,"ALLOWED_ATTR")?hd({},e.ALLOWED_ATTR,Pe):j,_e=cd(e,"ALLOWED_NAMESPACES")?hd({},e.ALLOWED_NAMESPACES,id):xe,he=cd(e,"ADD_URI_SAFE_ATTR")?hd(md(pe),e.ADD_URI_SAFE_ATTR,Pe):pe,de=cd(e,"ADD_DATA_URI_TAGS")?hd(md(fe),e.ADD_DATA_URI_TAGS,Pe):fe,ce=cd(e,"FORBID_CONTENTS")?hd({},e.FORBID_CONTENTS,Pe):le,G=cd(e,"FORBID_TAGS")?hd({},e.FORBID_TAGS,Pe):md({}),V=cd(e,"FORBID_ATTR")?hd({},e.FORBID_ATTR,Pe):md({}),ue=!!cd(e,"USE_PROFILES")&&e.USE_PROFILES,q=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,X=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,K=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,Q=e.WHOLE_DOCUMENT||!1,te=e.RETURN_DOM||!1,re=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,ae=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||Ud,ye=e.NAMESPACE||ve,Se=e.MATHML_TEXT_INTEGRATION_POINTS||Se,we=e.HTML_INTEGRATION_POINTS||we,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(W=!1),re&&(te=!0),ue&&(L=hd({},kd),U=Xl(null),!0===ue.html&&(hd(L,Ad),hd(U,Id)),!0===ue.svg&&(hd(L,Cd),hd(U,Dd),hd(U,Rd)),!0===ue.svgFilters&&
139(hd(L,Td),hd(U,Dd),hd(U,Rd)),!0===ue.mathMl&&(hd(L,Ed),hd(U,Od),hd(U,Rd))),cd(e,"ADD_TAGS")||(H.tagCheck=null),cd(e,"ADD_ATTR")||(H.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?H.tagCheck=e.ADD_TAGS:(L===$&&(L=md(L)),hd(L,e.ADD_TAGS,Pe))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?H.attributeCheck=e.ADD_ATTR:(U===j&&(U=md(U)),hd(U,e.ADD_ATTR,Pe))),e.ADD_URI_SAFE_ATTR&&hd(he,e.ADD_URI_SAFE_ATTR,Pe),e.FORBID_CONTENTS&&(ce===le&&(ce=md(ce)),hd(ce,e.FORBID_CONTENTS,Pe)),e.ADD_FORBID_CONTENTS&&(ce===le&&(ce=md(ce)),hd(ce,e.ADD_FORBID_CONTENTS,Pe)),oe&&(L["#text"]=!0),Q&&hd(L,["html","head","body"]),L.table&&(hd(L,["tbody"]),delete G.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw dd('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw dd('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,S=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let r=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(r=t.getAttribute(n));let i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(p,a)),null!==x&&"string"==typeof S&&(S=x.createHTML(""));ql&&ql(e),Ee=e}},De=hd({},[...Cd,...Td,...Pd]),Oe=hd({},[...Ed,...Md]),Re=function(e){td(r.removed,{element:e});try{_(e).removeChild(e)}catch{v(e)}},Be=function(e,t){try{td(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch{td(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(te||re)try{Re(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Ne=function(e){let t=null,r=null;if(ee)e="<remove></remove>"+e;else{let t=ad(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===Ce&&ye===ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let i=x?x.createHTML(e):e;if(ye===ve)try{t=(new h).parseFromString(i,Ce)}catch{}if(!t||!t.documentElement){t=w.createDocument(ye,"template",null);try{t.documentElement.innerHTML=be?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),ye===ve?T.call(t,Q?"html":"body")[0]:Q?t.documentElement:a},Fe=function(e){return A.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},$e=function(e){return"function"==typeof u&&e instanceof u};function Ue(e,t,n){Ql(e,e=>{e.call(r,t,n,Ee)})}let je=function(e){let t=null;if(Ue(E.beforeSanitizeElements,e,null),Le(e))return Re(e),!0;let n=Pe(e.nodeName);if(Ue(E.uponSanitizeElement,e,{tagName:n,allowedTags:L}),Z&&e.hasChildNodes()&&!$e(e.firstElementChild)&&ld(/<[/\w!]/g,e.innerHTML)&&ld(/<[/\w!]/g,e.textContent)||7===e.nodeType||Z&&8===e.nodeType&&ld(/<[/\w]/g,e.data))return Re(e),!0;if(!(H.tagCheck instanceof Function&&H.tagCheck(n))&&(!L[n]||G[n])){if(!G[n]&&Ge(n)&&(z.tagNameCheck instanceof RegExp&&ld(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n)))return!1;if(oe&&!ce[n]){let t=_(e)||e.parentNode,r=b(e)||e.childNodes;if(r&&t)for(let n=r.length-1;n>=0;--n){let i=g(r[n],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,y(e))}}return Re(e),!0}return e instanceof c&&!function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});let r=nd(e.tagName),n=nd(t.tagName);return!!_e[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===ve?"svg"===r:t.namespaceURI===me?"svg"===r&&("annotation-xml"===n||Se[n]):!!De[r]:e.namespaceURI===me?t.namespaceURI===ve?"math"===r:t.namespaceURI===ge?"math"===r&&we[n]:!!Oe[r]:e.namespaceURI===ve?!(t.namespaceURI===ge&&!we[n])&&!(t.namespaceURI===me&&!Se[n])&&!Oe[r]&&(Ae[r]||!De[r]):!("application/xhtml+xml"!==Ce||!_e[e.namespaceURI]))}(e)?(Re(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!ld(/<\/no(script|embed|frames)/i,e.innerHTML)?(K&&3===e.n
139odeType&&(t=e.textContent,Ql([M,k,I],e=>{t=od(t,e," ")}),e.textContent!==t&&(td(r.removed,{element:e.cloneNode()}),e.textContent=t)),Ue(E.afterSanitizeElements,e,null),!1):(Re(e),!0)},ze=function(e,t,r){if(V[t]||ie&&("id"===t||"name"===t)&&(r in n||r in Me))return!1;if((!W||V[t]||!ld(D,t))&&(!q||!ld(O,t))&&!(H.attributeCheck instanceof Function&&H.attributeCheck(t,e)))if(!U[t]||V[t]){if(!(Ge(e)&&(z.tagNameCheck instanceof RegExp&&ld(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&ld(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t,e))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&ld(z.tagNameCheck,r)||z.tagNameCheck instanceof Function&&z.tagNameCheck(r))))return!1}else if(!he[t]&&!ld(F,od(r,B,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==sd(r,"data:")||!de[e])&&(!X||ld(R,od(r,B,"")))&&r)return!1;return!0},Ge=function(e){return"annotation-xml"!==e&&ad(e,N)},Ve=function(e){Ue(E.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||Le(e))return;let n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],u=Pe(a),c=s,l="value"===a?c:ud(c);if(n.attrName=u,n.attrValue=l,n.keepAttr=!0,n.forceKeepAttr=void 0,Ue(E.uponSanitizeAttribute,e,n),l=n.attrValue,!ae||"id"!==u&&"name"!==u||(Be(a,e),l="user-content-"+l),Z&&ld(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,l)){Be(a,e);continue}if("attributename"===u&&ad(l,"href")){Be(a,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){Be(a,e);continue}if(!Y&&ld(/\/>/i,l)){Be(a,e);continue}K&&Ql([M,k,I],e=>{l=od(l,e," ")});let d=Pe(e.nodeName);if(ze(d,u,l)){if(x&&"object"==typeof p&&"function"==typeof p.getAttributeType&&!o)switch(p.getAttributeType(d,u)){case"TrustedHTML":l=x.createHTML(l);break;case"TrustedScriptURL":l=x.createScriptURL(l)}if(l!==c)try{o?e.setAttributeNS(o,a,l):e.setAttribute(a,l),Le(e)?Re(e):ed(r.removed)}catch{Be(a,e)}}else Be(a,e)}Ue(E.afterSanitizeAttributes,e,null)},He=function e(t){let r=null,n=Fe(t);for(Ue(E.beforeSanitizeShadowDOM,t,null);r=n.nextNode();)Ue(E.uponSanitizeShadowNode,r,null),je(r),Ve(r),r.content instanceof o&&e(r.content);Ue(E.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,a=null,s=null,c=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!$e(e)){if("function"!=typeof e.toString)throw dd("toString is not a function");if("string"!=typeof(e=e.toString()))throw dd("dirty is not a string, aborting")}if(!r.isSupported)return e;if(J||Ie(t),r.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){let t=Pe(e.nodeName);if(!L[t]||G[t])throw dd("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof u)n=Ne("\x3c!----\x3e"),a=n.ownerDocument.importNode(e,!0),1===a.nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?n=a:n.appendChild(a);else{if(!te&&!K&&!Q&&-1===e.indexOf("<"))return x&&ne?x.createHTML(e):e;if(n=Ne(e),!n)return te?null:ne?S:""}n&&ee&&Re(n.firstChild);let l=Fe(se?e:n);for(;s=l.nextNode();)je(s),Ve(s),s.content instanceof o&&He(s.content);if(se)return e;if(te){if(re)for(c=C.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(U.shadowroot||U.shadowrootmode)&&(c=P.call(i,c,!0)),c}let d=Q?n.outerHTML:n.innerHTML;return Q&&L["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&ld(Gd,n.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+d),K&&Ql([M,k,I],e=>{d=od(d,e," ")}),x&&ne?x.createHTML(d):d},r.setConfig=function(){Ie(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},r.clearConfig=function(){Ee=null,J=!1},r.isValidAttribute=function(e,t,r){return Ee||Ie({}),ze(Pe(e),Pe(t),r)},r.addHook=function(e,t){"function"==typeof t&&td(E[e],t)},r.removeHook=function(e,t){if(void 0!==t){let r=Jl(E[e],t);return-1===r?void 0:rd(E[e],r,1)[0]}return ed(E[e])},r.removeHooks=function(e){E[e]=[]},r.removeAllHooks=function(){E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},r}();typeof window<"u"&&function(){window.console=window.console||{};for(var e,t,r=window.console,n={},i=function(){},a="memory".split(","),o="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();)r[e]||(r[e]=n);for(;t=o.pop();)r[t]||(r[t]=i)}(),void 0===window.HTMLCanvasElement||window.HTMLCanvasElement.prototype.toBlob||Object.defineProperty(window.HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,r){for(var n=window.atob(this.toDataURL(t,r).split(",")[1]),i=n.length,a=i>>2,o=new Uint8Array(i),s=new Uint32Array(o.buffer,0,a),u=0,c=0;c<a;
139c++)s[c]=n.charCodeAt(u++)|n.charCodeAt(u++)<<8|n.charCodeAt(u++)<<16|n.charCodeAt(u++)<<24;for(var l=3&i;l--;)o[u]=n.charCodeAt(u++);e(new window.Blob([o],{type:t||"image/png"}))}}),Math.cbrt=Math.cbrt||function(e){var t=Math.abs(e)**(1/3);return e<0?-t:t},Math.sign||(Math.sign=function(e){return 0==(e=+e)||isNaN(e)?Number(e):e>0?1:-1}),Number.isInteger||(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&e>-9007199254740992&&e<9007199254740992&&Math.floor(e)===e}),Number.isNaN||(Number.isNaN=function(e){return e!=e}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw TypeError("Cannot convert first argument to object");for(var t,r=Object(e),n=!1,i=1;i<arguments.length;i++){var a=arguments[i];if(null!=a){for(var o=Object.keys(Object(a)),s=0,u=o.length;s<u;s++){var c=o[s];try{var l=Object.getOwnPropertyDescriptor(a,c);void 0!==l&&l.enumerable&&(r[c]=a[c])}catch(e){n||(n=!0,t=e)}}if(n)throw t}}return r}}),String.prototype.startsWith||function(){var e=function(){var e;try{var t={},r=Object.defineProperty;e=r(t,t,t)&&r}catch{}return e}(),t={}.toString,r=function(e){if(null===this)throw TypeError();var r=String(this);if(e&&"[object RegExp]"===t.call(e))throw TypeError();var n=r.length,i=String(e),a=i.length,o=arguments.length>1?arguments[1]:void 0,s=o?Number(o):0;Number.isNaN(s)&&(s=0);var u=Math.min(Math.max(s,0),n);if(a+u>n)return!1;for(var c=-1;++c<a;)if(r.charCodeAt(u+c)!==i.charCodeAt(c))return!1;return!0};e?e(String.prototype,"startsWith",{value:r,configurable:!0,writable:!0}):String.prototype.startsWith=r}(),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var r=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return-1!==n&&n===t}),String.prototype.repeat||(String.prototype.repeat=function(e){if(null===this)throw TypeError("can't convert "+this+" to object");var t=""+this;if(e=+e,Number.isNaN(e)&&(e=0),e<0)throw RangeError("repeat count must be non-negative");if(e===1/0)throw RangeError("repeat count must be less than infinity");if(e=Math.floor(e),0===t.length||0===e)return"";if(t.length*e>=1<<28)throw RangeError("repeat count must not overflow maximum string size");for(var r="";1&~e||(r+=t),0!=(e>>>=1);)t+=t;return r}),String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),Array.prototype.includes||(Array.prototype.includes=function(e){if(null==this)throw TypeError("Array.prototype.includes called on null or undefined");var t=Object(this),r=parseInt(t.length,10)||0;if(0===r)return!1;var n,i,a=parseInt(arguments[1],10)||0;for(a>=0?n=a:(n=r+a)<0&&(n=0);n<r;){if(e===(i=t[n])||Number.isNaN(e)&&Number.isNaN(i))return!0;n++}return!1}),Array.from||(Array.from=(vd=Object.prototype.toString,yd=function(e){return"function"==typeof e||"[object Function]"===vd.call(e)},bd=2**53-1,_d=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),bd)},function(e){var t=Object(e);if(null==e)throw TypeError("Array.from requires an array-like object - not null or undefined");var r,n=arguments.length>1?arguments[1]:void 0;if(void 0!==n){if(!yd(n))throw TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}for(var i,a=_d(t.length),o=yd(this)?Object(new this(a)):Array(a),s=0;s<a;)i=t[s],o[s]=n?void 0===r?n(i,s):n.call(r,i,s):i,s+=1;return o.length=a,o})),typeof window<"u"&&function(){for(var e=0,t=["ms","moz","webkit","o"],r=0;r<t.length&&!window.requestAnimationFrame;++r)window.requestAnimationFrame=window[t[r]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[r]+"CancelAnimationFrame"]||window[t[r]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t){var r=(new Date).getTime(),n=Math.max(0,16-(r-e)),i=window.setTimeout(function(){t(r+n)},n);return e=r+n,i}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),typeof window<"u"&&(void 0===window.performance&&(window.performance={}),void 0===window.performance.now&&function(){var e=Date.now();window.performance.now=function(){return Date.now()-e}}()),Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=Array(r);r--;)n[r]=[t[r],e[t[r]]];return n}),Object.hasOwn||(Object.hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw TypeError('"this" is null or not defined');var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw TypeError("predicate must be a function");for(var n=arguments[1],i=0;i<r;){var a=t[i];if(e.call(n,a,i,t))return a;i++}},configurable:!0,writable:!0}),Array.prototype.fill||Object.defineProperty(Array.prototype,"fill",{value:function(e){if(null==this)throw TypeError("this is null or not defined");for(var t=Object(this),r=t.length>>>0,n=0|arguments[1],i=n<0?Math.max(r+n,0):Math.min(n,r),a=arguments[2],o=void 0===a?r:0|a,s=o<0?Math.max(r+o,0):Math.min(o,r);i<s;)t[i]=e,i++;return t}}),Array.prototype.copyWithin||Object.defineProperty(Array.prototype,"copyWithin",{value:function(e,t){if(null==this)throw TypeError("this is null or not defined");var r=Object(this),n=r.length>>>0,i=0|e,a=i<0?Math.max(n+i,0):Math.min(i,n),o=0|t,s=o<0?Math.max(n+o,0):Math.min(o,n),u=arguments[2],c=void 0===u?n:0|u,l=c<0?Math.max(n+c,0):Math.min(c,n),d=Math.min(l-s,n-a),f=1;for(s<a&&a<s+d&&(f=-1,s+=d-1,a+=d-1);d>0;)s in r?r[a]=r[s]:delete r[a],s+=f,a+=f,d--;return r},configurable:!0,writable:!0}),Int8Array.prototype.copyWithin||Object.defineProperty(Int8Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Int16Array.prototype.copyWithin||Object.defineProperty(Int16Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Int32Array.prototype.copyWithin||Object.defineProperty(Int32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint8Array.prototype.copyWithin||Object.defineProperty(Uint8Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint16Array.prototype.copyWithin||Object.defineProperty(Uint16Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint32Array.prototype.copyWithin||Object.defineProperty(Uint32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Float32Array.prototype.copyWithin||Object.defineProperty(Float32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Float64Array.prototype.copyWithin||Object.defineProperty(Float64Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),function(e){e.create=function(e){return e},e.getDuration=function(e,t){var r;if(t.customDurationMs)return t.customDurationMs;var n=(r=t.definition).getDuration?.call(r,t.params,e);return"fixed"===n?.kind?n.durationMs:void 0}}(xd||={}),function(e){e.create=function(e){return e},e.has=function(e,t){return!!(e&t)},e.hasAll=function(e,t){return!!t&&(e&t)===t}}(Sd||={}),function(e){e.create=function(e){return void 0===e&&(e=512),{current:[],offset:0,capacity:e,chunks:[]}},e.getString=function(e){return e.chunks.length?(e.offset>0&&(e.chunks[e.chunks.length]=e.current.length===e.offset?e.current.join(""):e.current.slice(0,e.offset).join("")),e.chunks.join("")):e.current.length===e.offset?e.current.join(""):e.current.splice(0,e.offset).join("")},e.getSize=function(e){for(var t=0,r=0,n=e.chunks;r<n.length;r++)t+=n[r].length;for(var i=0;i<e.offset;i++)t+=e.current[i].length;return t},e.getChunks=function(e){return e.offset>0&&(e.current.length===e.offset?e.chunks[e.chunks.length]=e.current.join(""):e.chunks[e.chunks.length]=e.current.slice(0,e.offset).join(""),e.offset=0),e.chunks};var t=[];function r(e,r){r>0&&n(e,t[r])}function n(e,t){e.offset===e.capacity&&(e.chunks[e.chunks.length]=e.current.join(""),e.offset=0),e.current[e.offset++]=t}(function(){for(var e="",r=0;r<512;r++)t[r]=e,e+=" "})(),e.newline=function(e){n(e,"\n")},e.whitespace=r,e.whitespace1=function(e){n(e," ")},e.write=function(e,t){t&&(e.offset===e.capacity&&(e.chunks[e.chunks.length]=e.current.join(""),e.offset=0),e.current[e.offset++]=t)},e.writeSafe=n,e.writePadLeft=function(e,t,i){t?(r(e,i-t.length),n(e,t)):r(e,i)},e.writePadRight=function(e,t,i){if(t){var a=i-t.length;n(e,t),r(e,a)}
139else r(e,i)},e.writeInteger=function(e,t){n(e,""+t)},e.writeIntegerAndSpace=function(e,t){n(e,t+" ")},e.writeIntegerPadLeft=function(e,t,i){var a=""+t;r(e,i-a.length),n(e,a)},e.writeIntegerPadRight=function(e,t,i){var a=""+t,o=i-a.length;n(e,a),r(e,o)},e.writeFloat=function(e,t,r){n(e,""+Math.round(r*t)/r)},e.writeFloatPadLeft=function(e,t,i,a){var o=""+Math.round(i*t)/i;r(e,a-o.length),n(e,o)},e.writeFloatPadRight=function(e,t,i,a){var o=""+Math.round(i*t)/i,s=a-o.length;n(e,o),r(e,s)}}(wd||={});var Wd,Xd,Yd,Kd=function(){if(typeof window<"u"&&window.performance){var e=window.performance;return function(){return e.now()}}return typeof process<"u"&&"undefined"!==process.hrtime&&"function"==typeof process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:Date.now?function(){return Date.now()}:function(){return+new Date}}();function Zd(e,t){if(void 0===t&&(t=!0),isNaN(e))return"n/a";for(var r=Math.floor(e/36e5),n=Math.floor(e/6e4%60),i=Math.floor(e/1e3%60),a=Math.floor(e%1e3).toString();a.length<3;)a="0"+a;for(;!t&&a.length>1&&"0"===a[a.length-1];)a=a.substr(0,a.length-1);return r>0?`${r}h${n}m${i}.${a}s`:n>0?`${n}m${i}.${a}s`:i>0?`${i}.${a}s`:`${e.toFixed(0)}ms`}function Qd(e,t){return e-t}function Jd(e,t){void 0===e&&(e=0),void 0===t&&(t=2**53-1);var r=e;return function(){var e=r;return r=(r+1)%t,e}}(function(e){var t=typeof btoa<"u"?btoa:function(e){return Buffer.from(e).toString("base64")},r=[];e.create22=function(){for(var e=+new Date+Kd(),n=0;n<16;n++)r[n]=String.fromCharCode((e+255*Math.random())%255|0),e=Math.floor(e/255);return t(r.join("")).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22)},e.createv4=function(){var e=+new Date+Kd();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)})},e.is=function(e){return"string"==typeof e}})(Wd||={}),function(e){var t=function(){function e(){this.size=0}return e.prototype.has=function(e){return!1},e.prototype.forEach=function(e,t){return t},e}(),r=function(){function e(e){this.idx=e,this.size=1}return e.prototype.has=function(e){return e===this.idx},e.prototype.forEach=function(e,t){return e(this.idx,t),t},e}(),n=function(){function e(e,t){this.mask=e,this.size=t,this.length=e.length}return e.prototype.has=function(e){return e<this.length&&!!this.mask[e]},e.prototype._forEach=function(e,t){for(var r=0;r<this.length;r++)this.mask[r]&&e(r,t)},e.prototype.forEach=function(e,t){return this._forEach(e,t),t},e}(),i=function(){function e(e){this.size=e}return e.prototype.has=function(e){return!0},e.prototype._forEach=function(e,t){for(var r=0;r<this.size;r++)e(r,t)},e.prototype.forEach=function(e,t){return this._forEach(e,t),t},e}(),a=function(){function e(e){this.set=e,this._flat=void 0,this.size=e.size}return e.prototype.has=function(e){return this.set.has(e)},e.prototype._forEach=function(e,t){for(var r=0,n=this.flatten();r<n.length;r++)e(n[r],t)},e.prototype.flatten=function(){if(this._flat)return this._flat;var e=new Int32Array(this.size),t=0;return this.set.forEach(function(r){return e[t++]=r}),function(e){Array.prototype.sort.call(e,Qd)}(e),this._flat=e,this._flat},e.prototype.forEach=function(e,t){return this._forEach(e,t),t},e}();function o(e){return new a(e)}function s(e,t){return new n(e,t)}e.always=function(e){return new i(e)},e.never=new t,e.ofSet=o,e.singleton=function(e){return new r(e)},e.ofUniqueIndices=function(e){var o=e.length;if(0===o)return new t;if(1===o)return new r(e[0]);for(var s=0,u=0,c=e;u<c.length;u++)(h=c[u])>s&&(s=h);if(o===s)return new i(o);if(o/s<1/12){for(var l=new Set,d=0,f=e;d<f.length;d++){var h=f[d];l.add(h)}return new a(l)}for(var p=new Int8Array(s+1),m=0,g=e;m<g.length;m++)p[h=g[m]]=1;return new n(p,e.length)},e.ofMask=s,e.hasAny=function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];if(e.has(i))return!0}return!1},e.complement=function(e,t){var r=0,n=0;if(t.forEach(function(t){e.has(t)||(r++,t>n&&(n=t))}),r/n<1/12){var i=new Set;return t.forEach(function(t){e.has(t)||i.add(t)}),o(i)}var a=new Uint8Array(n+1);return t.forEach(function(t){e.has(t)||(a[t]=1)}),s(a,r)}}(Xd||={}),function(e){e.create=function(e){return{ref:e}},e.set=function(e,t){return e.ref=t,e}}(Yd||={});var ef,tf,rf=Jd(0,2147483647);(function(e){e.create=function(e,t){return{id:rf(),version:0,value:e,metadata:t}},e.withValue=function(e,t){return{id:e.id,version:e.version+1,value:t,metadata:e.metadata}}})(ef||={}),function(e){function t(e,t){return Yd.set(e,ef.withValue(e.ref,t))}e.create=function(e,t){return Yd.create(ef.create(e,t))},e.update=t,e.set=function(e,t){return Yd.set(e,t)}
139,e.updateIfChanged=function(e,r){return e.ref.value===r?e:t(e,r)}}(tf||={});var nf=function(){};function af(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}var of,sf,uf=Object.prototype.hasOwnProperty;function cf(e,t){if(e===t)return!0;var r=Array.isArray(e),n=Array.isArray(t);if(r&&n){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!cf(e[i],t[i]))return!1;return!0}if(r!==n)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){var a=Object.keys(e);if(a.length!==Object.keys(t).length)return!1;var o=e instanceof Date,s=t instanceof Date;if(o&&s)return e.getTime()===t.getTime();if(o!==s)return!1;var u=e instanceof RegExp,c=t instanceof RegExp;if(u&&c)return e.toString()===t.toString();if(u!==c)return!1;for(i=0;i<a.length;i++)if(!uf.call(t,a[i]))return!1;for(i=0;i<a.length;i++)if(!cf(e[a[i]],t[a[i]]))return!1;return!0}return!1}function lf(e,t){if(e===t)return!0;var r=Array.isArray(e),n=Array.isArray(t);return r&&n?function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;++r)if(e[r]!==t[r])return!1;return!0}(e,t):r===n&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&df(e,t)}function df(e,t){if(e===t)return!0;if(!e||!t)return!1;var r=Object.keys(e);if(Object.keys(t).length!==r.length)return!1;for(var n=0,i=r;n<i.length;n++){var a=i[n];if(!uf.call(e,a)||e[a]!==t[a])return!1}return!0}function ff(e,t){return void 0===e?t:e}(function(e){function t(e){var t;return t=function(){function t(t,r){this.data=t,this.id=Wd.create22(),this.type=e,this.label=r&&r.label||e.name,this.description=r&&r.description}return t.is=function(t){return!!t&&e===t.type},t}(),t.type=e,t}e.factory=function(){return function(e){return t(e)}},e.create=t,e.hasTag=function(e,t){if(!e.tags)return!1;for(var r=0,n=e.tags;r<n.length;r++)if(n[r]===t)return!0;return!1},e.Null={id:Wd.create22(),type:{name:"Null",typeClass:"Null"},data:void 0,label:"Null"}})(of||={}),function(e){e.is=function(e){var t=e;return!!(t&&t.transform&&t.parent&&t.status)},e.resolve=function(t,r){var n="string"==typeof r?r:e.is(r)?r.transform.ref:r.ref;return t.cells.get(n)}}(sf||={});var hf,pf=function(){function e(e,t){this.ref=e,this.state=t}return Object.defineProperty(e.prototype,"cell",{get:function(){return this.state?.cells.get(this.ref)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"obj",{get:function(){return this.state?.cells.get(this.ref)?.obj},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.obj?.data},enumerable:!1,configurable:!0}),e.prototype.update=function(e,t){if(!this.state)throw Error("To use update() from StateObjectSelector, 'state' must be defined.");return t||=this.state.build(),(t||this.state.build()).to(this).update(e),t},e.prototype.checkValid=function(){if(!this.state)throw Error("Unassigned State.");var e=this.cell;if(!e)throw Error("Not created at all. Did you await/then the corresponding state update?");if("ok"===e.status)return!0;throw"error"===e.status?Error(e.errorText):e.obj===of.Null?Error("The object is Null."):Error("Unresolved. Did you await/then the corresponding state update?")},Object.defineProperty(e.prototype,"isOk",{get:function(){var e=this.cell;return e&&"ok"===e.status&&e.obj!==of.Null},enumerable:!1,configurable:!0}),e}();!function(e){function t(e,t){if(t)return sf.is(t)?t:"string"==typeof t?e.cells.get(t):t.cell}e.resolveRef=function(e){if(e)return"string"==typeof e?e:sf.is(e)?e.transform.ref:e.cell?.transform.ref},e.resolve=t,e.resolveAndCheck=function(e,r){var n=t(e,r);if(n&&n.obj&&"ok"===n.status)return n}}(hf||={});var mf="delete",gf=32,vf=31,yf={};function bf(e){e&&(e.value=!0)}function _f(){}function xf(e){return void 0===e.size&&(e.size=e.__iterate(wf)),e.size}function Sf(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?xf(e)+t:t}function wf(){return!0}function Af(e,t,r){return(0===e&&!Ef(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function Cf(e,t){return Pf(e,t,0)}function Tf(e,t){return Pf(e,t,t)}function Pf(e,t,r){return void 0===e?r:Ef(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function Ef(e){return e<0||0===e&&1/e==-1/0}
139var Mf="@@__IMMUTABLE_ITERABLE__@@";function kf(e){return!(!e||!e[Mf])}var If="@@__IMMUTABLE_KEYED__@@";function Df(e){return!(!e||!e[If])}var Of="@@__IMMUTABLE_INDEXED__@@";function Rf(e){return!(!e||!e[Of])}function Bf(e){return Df(e)||Rf(e)}var Nf=function(e){return kf(e)?e:ah(e)},Ff=function(e){function t(e){return Df(e)?e:oh(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Nf),Lf=function(e){function t(e){return Rf(e)?e:sh(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Nf),$f=function(e){function t(e){return kf(e)&&!Bf(e)?e:uh(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Nf);Nf.Keyed=Ff,Nf.Indexed=Lf,Nf.Set=$f;var Uf="@@__IMMUTABLE_SEQ__@@";function jf(e){return!(!e||!e[Uf])}var zf="@@__IMMUTABLE_RECORD__@@";function Gf(e){return!(!e||!e[zf])}function Vf(e){return kf(e)||Gf(e)}var Hf="@@__IMMUTABLE_ORDERED__@@";function qf(e){return!(!e||!e[Hf])}var Wf="function"==typeof Symbol&&Symbol.iterator,Xf="@@iterator",Yf=Wf||Xf,Kf=function(e){this.next=e};function Zf(e,t,r,n){var i=0===e?t:1===e?r:[t,r];return n?n.value=i:n={value:i,done:!1},n}function Qf(){return{value:void 0,done:!0}}function Jf(e){return!!Array.isArray(e)||!!rh(e)}function eh(e){return e&&"function"==typeof e.next}function th(e){var t=rh(e);return t&&t.call(e)}function rh(e){var t=e&&(Wf&&e[Wf]||e[Xf]);if("function"==typeof t)return t}Kf.prototype.toString=function(){return"[Iterator]"},Kf.KEYS=0,Kf.VALUES=1,Kf.ENTRIES=2,Kf.prototype.inspect=Kf.prototype.toSource=function(){return this.toString()},Kf.prototype[Yf]=function(){return this};var nh=Object.prototype.hasOwnProperty;function ih(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var ah=function(e){function t(e){return null==e?hh():Vf(e)?e.toSeq():function(e){var t,r,n=gh(e);if(n)return(r=rh(t=e))&&r===t.entries?n.fromEntrySeq():function(e){var t=rh(e);return t&&t===e.keys}(e)?n.toSetSeq():n;if("object"==typeof e)return new lh(e);throw TypeError("Expected Array or collection object of values, or keyed object: "+e)}(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(e,t){var r=this._cache;if(r){for(var n=r.length,i=0;i!==n;){var a=r[t?n-++i:i++];if(!1===e(a[1],a[0],this))break}return i}return this.__iterateUncached(e,t)},t.prototype.__iterator=function(e,t){var r=this._cache;if(r){var n=r.length,i=0;return new Kf(function(){if(i===n)return{value:void 0,done:!0};var a=r[t?n-++i:i++];return Zf(e,a[0],a[1])})}return this.__iteratorUncached(e,t)},t}(Nf),oh=function(e){function t(e){return null==e?hh().toKeyedSeq():kf(e)?Df(e)?e.toSeq():e.fromEntrySeq():Gf(e)?e.toSeq():ph(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(ah),sh=function(e){function t(e){return null==e?hh():kf(e)?Df(e)?e.entrySeq():e.toIndexedSeq():Gf(e)?e.toSeq().entrySeq():mh(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(ah),uh=function(e){function t(e){return(kf(e)&&!Bf(e)?e:sh(e)).toSetSeq()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(ah);ah.isSeq=jf,ah.Keyed=oh,ah.Set=uh,ah.Indexed=sh,ah.prototype[Uf]=!0;var ch=function(e){function t(e){this._array=e,this.size=e.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this.has(e)?this._array[Sf(this,e)]:t},t.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length,i=0;i!==n;){var a=t?n-++i:i++;if(!1===e(r[a],a,this))break}return i},t.prototype.__iterator=function(e,t){var r=this._array,n=r.length,i=0;return new Kf(function(){if(i===n)return{value:void 0,done:!0};var a=t?n-++i:i++;return Zf(e,a,r[a])})},t}(sh),lh=function(e){function t(e){var t=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=t,this.size=t.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},t.prototype.has=function(e){return nh.call(this._object,e)},t.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,i=n.length,a=0;a!==i;){var o=n[t?i-++a:a++];
139if(!1===e(r[o],o,this))break}return a},t.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,i=n.length,a=0;return new Kf(function(){if(a===i)return{value:void 0,done:!0};var o=n[t?i-++a:a++];return Zf(e,o,r[o])})},t}(oh);lh.prototype[Hf]=!0;var dh,fh=function(e){function t(e){this._collection=e,this.size=e.length||e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var r=th(this._collection),n=0;if(eh(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,n++,this););return n},t.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=th(this._collection);if(!eh(r))return new Kf(Qf);var n=0;return new Kf(function(){var t=r.next();return t.done?t:Zf(e,n++,t.value)})},t}(sh);function hh(){return dh||=new ch([])}function ph(e){var t=gh(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new lh(e);throw TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function mh(e){var t=gh(e);if(t)return t;throw TypeError("Expected Array or collection object of values: "+e)}function gh(e){return ih(e)?new ch(e):Jf(e)?new fh(e):void 0}var vh="@@__IMMUTABLE_MAP__@@";function yh(e){return!(!e||!e[vh])}function bh(e){return yh(e)&&qf(e)}function _h(e){return!(!e||"function"!=typeof e.equals||"function"!=typeof e.hashCode)}function xh(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(_h(e)&&_h(t)&&e.equals(t))}var Sh="function"==typeof Math.imul?Math.imul:function(e,t){var r=65535&(e|=0),n=65535&(t|=0);return r*n+((e>>>16)*n+r*(t>>>16)<<16>>>0)|0};function wh(e){return e>>>1&1073741824|3221225471&e}var Ah=Object.prototype.valueOf;function Ch(e){if(null==e)return Th(e);if("function"==typeof e.hashCode)return wh(e.hashCode(e));var t,r=(t=e).valueOf!==Ah&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==r)return Th(r);switch(typeof r){case"boolean":return r?1108378657:1108378656;case"number":return function(e){if(e!=e||e===1/0)return 0;var t=0|e;for(t!==e&&(t^=4294967295*e);e>4294967295;)t^=e/=4294967295;return wh(t)}(r);case"string":return r.length>Nh?function(e){var t=$h[e];return void 0===t&&(t=Ph(e),Lh===Fh&&(Lh=0,$h={}),Lh++,$h[e]=t),t}(r):Ph(r);case"object":case"function":return function(e){var t;if(Dh&&void 0!==(t=Ih.get(e))||void 0!==(t=e[Bh])||!Mh&&(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Bh])||void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e))))return t;if(t=kh(),Dh)Ih.set(e,t);else{if(void 0!==Eh&&!1===Eh(e))throw Error("Non-extensible objects are not allowed as keys.");
139if(Mh)Object.defineProperty(e,Bh,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Bh]=t;else{if(void 0===e.nodeType)throw Error("Unable to set a non-enumerable property on object.");e[Bh]=t}}return t}(r);case"symbol":return function(e){var t=Oh[e];return void 0===t?(t=kh(),Oh[e]=t,t):t}(r);default:if("function"==typeof r.toString)return Ph(r.toString());throw Error("Value type "+typeof r+" cannot be hashed.")}}function Th(e){return null===e?1108378658:1108378659}function Ph(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return wh(t)}var Eh=Object.isExtensible,Mh=function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}}();function kh(){var e=++Rh;return 1073741824&Rh&&(Rh=0),e}var Ih,Dh="function"==typeof WeakMap;Dh&&(Ih=new WeakMap);var Oh=Object.create(null),Rh=0,Bh="__immutablehash__";"function"==typeof Symbol&&(Bh=Symbol(Bh));var Nh=16,Fh=255,Lh=0,$h={},Uh=function(e){function t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this._iter.get(e,t)},t.prototype.has=function(e){return this._iter.has(e)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var e=this,t=qh(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=Hh(this,e,t);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(e,t)}),n},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate(function(t,n){return e(t,n,r)},t)},t.prototype.__iterator=function(e,t){return this._iter.__iterator(e,t)},t}(oh);Uh.prototype[Hf]=!0;var jh=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.includes=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this,n=0;return t&&xf(this),this._iter.__iterate(function(i){return e(i,t?r.size-++n:n++,r)},t)},t.prototype.__iterator=function(e,t){var r=this,n=this._iter.__iterator(1,t),i=0;return t&&xf(this),new Kf(function(){var a=n.next();return a.done?a:Zf(e,t?r.size-++i:i++,a.value,a)})},t}(sh),zh=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.has=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate(function(t){return e(t,t,r)},t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new Kf(function(){var t=r.next();return t.done?t:Zf(e,t.value,t.value,t)})},t}(uh),Gh=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate(function(t){if(t){rp(t);var n=kf(t);return e(n?t.get(1):t[1],n?t.get(0):t[0],r)}},t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new Kf(function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){rp(n);var i=kf(n);return Zf(e,i?n.get(0):n[0],i?n.get(1):n[1],t)}}})},t}(oh);function Vh(e){var t=ip(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=ap,t.__iterateUncached=function(t,r){var n=this;return e.__iterate(function(e,r){return!1!==t(r,e,n)},r)},t.__iteratorUncached=function(t,r){if(2===t){var n=e.__iterator(t,r);return new Kf(function(){var e=n.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(1===t?0:1,r)},t}function Hh(e,t,r){var n=ip(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,i){var a=e.get(n,yf);return a===yf?i:t.call(r,a,n,e)},n.__iterateUncached=function(n,i){var a=this;return e.__iterate(function(e,i,o){return!1!==n(t.call(r,e,i,o),i,a)},i)},n.__iteratorUncached=function(n,i){var a=e.__iterator(2,i);return new Kf(function(){var i=a.next();if(i.done)return i;var o=i.value,s=o[0];return Zf(n,s,t.call(r,o[1],s,e),i)})},n}function qh(e,t){var r=this,n=ip(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Vh(e);return t.reverse=function(){return e.flip()},t}),n.get=function(r,n){return e.get(t?r:-1-r,n)},n.has=function(r){return e.has(t?r:-1-r)},n.includes=function(t){return e.includes(t)},n.cacheResult=ap,n.__iterate=function(r,n){var i=this,a=0;return n&&xf(e),e.__iterate(function(e,o){return r(e,t?o:n?i.size-++a:a++,i)},!n)},n.__iterator=function(n,i){var a=0;i&&xf(e);var o=e.__iterator(2,!i);return new Kf(function(){var e=o.next();if(e.done)return e;var s=e.value;return Zf(n,t?s[0]:i?r.size-++a:a++,s[1],e)})},n}function Wh(e,t,r,n){var i=ip(e);return n&&(i.has=function(n){var i=e.get(n,yf);return i!==yf&&!!t.call(r,i,n,e)},i.get=function(n,i){var a=e.get(n,yf);return a!==yf&&t.call(r,a,n,e)?a:i}),i.__iterateUncached=function(i,a){var o=this,s=0;return e.__iterate(function(e,a,u){if(t.call(r,e,a,u))return s++,i(e,n?a:s-1,o)},a),s},i.__iteratorUncached=function(i,a){var o=e.__iterator(2,a),s=0;return new Kf(function(){for(;;){var a=o.next();if(a.done)return a;var u=a.value,c=u[0],l=u[1];if(t.call(r,l,c,e))return Zf(i,n?c:s++,l,a)}})},i}function Xh(e,t,r,n){var i=e.size;if(Af(t,r,i))return e;if(void 0===i&&(t<0||r<0))return Xh(e.toSeq().cacheResult(),t,r,n);var a,o=Cf(t,i),s=Tf(r,i)-o;s==s&&(a=s<0?0:s);var u=ip(e);return u.size=0===a?a:e.size&&a||void 0,!n&&jf(e)&&a>=0&&(u.get=function(t,r){return(t=Sf(this,t))>=0&&t<a?e.get(t+o,r):r}),u.__iterateUncached=function(t,r){var i=this;if(0===a)return 0;if(r)return this.cacheResult().__iterate(t,r);var s=0,u=!0,c=0;return e.__iterate(function(e,r){if(!u||!(u=s++<o))return c++,!1!==t(e,n?r:c-1,i)&&c!==a}),c},u.__iteratorUncached=function(t,r){if(0!==a&&r)return this.cacheResult().__iterator(t,r);
139if(0===a)return new Kf(Qf);var i=e.__iterator(t,r),s=0,u=0;return new Kf(function(){for(;s++<o;)i.next();if(++u>a)return{value:void 0,done:!0};var e=i.next();return n||1===t||e.done?e:Zf(t,u-1,0===t?void 0:e.value[1],e)})},u}function Yh(e,t,r,n){var i=ip(e);return i.__iterateUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterate(i,a);var s=!0,u=0;return e.__iterate(function(e,a,c){if(!s||!(s=t.call(r,e,a,c)))return u++,i(e,n?a:u-1,o)}),u},i.__iteratorUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterator(i,a);var s=e.__iterator(2,a),u=!0,c=0;return new Kf(function(){var e,a,l;do{if((e=s.next()).done)return n||1===i?e:Zf(i,c++,0===i?void 0:e.value[1],e);var d=e.value;a=d[0],l=d[1],u&&=t.call(r,l,a,o)}while(u);return 2===i?e:Zf(i,a,l,e)})},i}function Kh(e,t,r){var n=ip(e);return n.__iterateUncached=function(i,a){if(a)return this.cacheResult().__iterate(i,a);var o=0,s=!1;return function e(u,c){u.__iterate(function(a,u){return(!t||c<t)&&kf(a)?e(a,c+1):(o++,!1===i(a,r?u:o-1,n)&&(s=!0)),!s},a)}(e,0),o},n.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var a=e.__iterator(n,i),o=[],s=0;return new Kf(function(){for(;a;){var e=a.next();if(!1===e.done){var u=e.value;if(2===n&&(u=u[1]),t&&!(o.length<t)||!kf(u))return r?e:Zf(n,s++,u,e);o.push(a),a=u.__iterator(n,i)}else a=o.pop()}return{value:void 0,done:!0}})},n}function Zh(e,t,r){t||=op;var n=Df(e),i=0,a=e.toSeq().map(function(t,n){return[n,t,i++,r?r(t,n,e):t]}).valueSeq().toArray();return a.sort(function(e,r){return t(e[3],r[3])||e[2]-r[2]}).forEach(n?function(e,t){a[t].length=2}:function(e,t){a[t]=e[1]}),n?oh(a):Rf(e)?sh(a):uh(a)}function Qh(e,t,r){if(t||=op,r){var n=e.toSeq().map(function(t,n){return[t,r(t,n,e)]}).reduce(function(e,r){return Jh(t,e[1],r[1])?r:e});return n&&n[0]}return e.reduce(function(e,r){return Jh(t,e,r)?r:e})}function Jh(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function ep(e,t,r,n){var i=ip(e),a=new ch(r).map(function(e){return e.size});return i.size=n?a.max():a.min(),i.__iterate=function(e,t){for(var r,n=this.__iterator(1,t),i=0;!(r=n.next()).done&&!1!==e(r.value,i++,this););return i},i.__iteratorUncached=function(e,i){var a=r.map(function(e){return e=Nf(e),th(i?e.reverse():e)}),o=0,s=!1;return new Kf(function(){var r;return s||=(r=a.map(function(e){return e.next()}),n?r.every(function(e){return e.done}):r.some(function(e){return e.done})),s?{value:void 0,done:!0}:Zf(e,o++,t.apply(null,r.map(function(e){return e.value})))})},i}function tp(e,t){return e===t?e:jf(e)?t:e.constructor(t)}function rp(e){if(e!==Object(e))throw TypeError("Expected [K, V] tuple: "+e)}function np(e){return Df(e)?Ff:Rf(e)?Lf:$f}function ip(e){return Object.create((Df(e)?oh:Rf(e)?sh:uh).prototype)}function ap(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):ah.prototype.cacheResult.call(this)}function op(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e<t?-1:0}function sp(e,t){t||=0;for(var r=Math.max(0,e.length-t),n=Array(r),i=0;i<r;i++)n[i]=e[i+t];return n}function up(e,t){if(!e)throw Error(t)}function cp(e){up(e!==1/0,"Cannot perform this action with an infinite size.")}function lp(e){if(ih(e)&&"string"!=typeof e)return e;if(qf(e))return e.toArray();throw TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}jh.prototype.cacheResult=Uh.prototype.cacheResult=zh.prototype.cacheResult=Gh.prototype.cacheResult=ap;var dp=Object.prototype.toString;function fp(e){return"object"==typeof e&&(Vf(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==dp.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var r=t,n=Object.getPrototypeOf(t);null!==n;)r=n,n=Object.getPrototypeOf(r);return r===t}(e))}function hp(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch{return JSON.stringify(e)}}function pp(e,t,r){return Vf(e)?e.get(t,r):function(e,t){return Vf(e)?e.has(t):fp(e)&&nh.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function mp(e){if(Array.isArray(e))return sp(e);var t={};
139for(var r in e)nh.call(e,r)&&(t[r]=e[r]);return t}function gp(e,t,r,n){n||(n=r,r=void 0);var i=vp(Vf(e),e,lp(t),0,r,n);return i===yf?r:i}function vp(e,t,r,n,i,a){var o=t===yf;if(n===r.length){var s=o?i:t,u=a(s);return u===s?t:u}if(!o&&!fp(t))throw TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(hp)+"]: "+t);var c=r[n],l=o?yf:pp(t,c,yf),d=vp(l===yf?e:Vf(l),l,r,n+1,i,a);return d===l?t:d===yf?function(e,t){if(!fp(e))throw TypeError("Cannot update non-data-structure value: "+e);if(Vf(e)){if(!e.remove)throw TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!nh.call(e,t))return e;var r=mp(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,c):function(e,t,r){if(!fp(e))throw TypeError("Cannot update non-data-structure value: "+e);if(Vf(e)){if(!e.set)throw TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(nh.call(e,t)&&r===e[t])return e;var n=mp(e);return n[t]=r,n}(o?e?Xp():{}:t,c,d)}function yp(e,t){return function(e,t,r){return gp(e,t,yf,function(){return r})}(this,e,t)}function bp(e){return function(e,t){return gp(e,t,function(){return yf})}(this,e)}function _p(e,t,r,n){return gp(e,[t],r,n)}function xp(e,t,r){return 1===arguments.length?e(this):_p(this,e,t,r)}function Sp(e,t,r){return gp(this,e,t,r)}function wp(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Cp(this,e)}function Ap(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if("function"!=typeof e)throw TypeError("Invalid merger function: "+e);return Cp(this,t,e)}function Cp(e,t,r){for(var n=[],i=0;i<t.length;i++){var a=Ff(t[i]);0!==a.size&&n.push(a)}return 0===n.length?e:0!==e.toSeq().size||e.__ownerID||1!==n.length?e.withMutations(function(e){for(var t=r?function(t,n){_p(e,n,yf,function(e){return e===yf?t:r(e,t,n)})}:function(t,r){e.set(r,t)},i=0;i<n.length;i++)n[i].forEach(t)}):e.constructor(n[0])}function Tp(e,t,r){return Pp(e,t,function(e){return function t(r,n,i){return fp(r)&&fp(n)&&(a=n,o=ah(r),s=ah(a),Rf(o)===Rf(s)&&Df(o)===Df(s))?Pp(r,[n],t):e?e(r,n,i):n;var a,o,s}}(r))}function Pp(e,t,r){if(!fp(e))throw TypeError("Cannot merge into non-data-structure value: "+e);if(Vf(e))return"function"==typeof r&&e.mergeWith?e.mergeWith.apply(e,[r].concat(t)):e.merge?e.merge.apply(e,t):e.concat.apply(e,t);for(var n=Array.isArray(e),i=e,a=n?Lf:Ff,o=n?function(t){i===e&&(i=mp(i)),i.push(t)}:function(t,n){var a=nh.call(i,n),o=a&&r?r(i[n],t,n):t;a&&o===i[n]||(i===e&&(i=mp(i)),i[n]=o)},s=0;s<t.length;s++)a(t[s]).forEach(o);return i}function Ep(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Tp(this,e)}function Mp(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return Tp(this,t,e)}function kp(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return gp(this,e,Xp(),function(e){return Pp(e,t)})}function Ip(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return gp(this,e,Xp(),function(e){return Tp(e,t)})}function Dp(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function Op(){return this.__ownerID?this:this.__ensureOwner(new _f)}function Rp(){return this.__ensureOwner()}function Bp(){return this.__altered}var Np=function(e){function t(t){return null==t?Xp():yh(t)&&!qf(t)?t:Xp().withMutations(function(r){var n=e(t);cp(n.size),n.forEach(function(e,t){return r.set(t,e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Xp().withMutations(function(t){for(var r=0;r<e.length;r+=2){if(r+1>=e.length)throw Error("Missing value for key: "+e[r]);t.set(e[r],e[r+1])}})},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},t.prototype.set=function(e,t){return Yp(this,e,t)},t.prototype.remove=function(e){return Yp(this,e,yf)},t.prototype.deleteAll=function(e){var t=Nf(e);return 0===t.size?this:this.withMutations(function(e){t.forEach(function(t){return e.remove(t)})})},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Xp()},t.prototype.sort=function(e){return _m(Zh(this,e))},t.prototype.sortBy=function(e,t){return _m(Zh(this,t,e))},t.prototype.map=function(e,t){var r=this;
vendor: 6,584 bytes, line 139
139return this.withMutations(function(n){n.forEach(function(i,a){n.set(a,e.call(t,i,a,r))})})},t.prototype.__iterator=function(e,t){return new Vp(this,e,t)},t.prototype.__iterate=function(e,t){var r=this,n=0;return this._root&&this._root.iterate(function(t){return n++,e(t[1],t[0],r)},t),n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Wp(this.size,this._root,e,this.__hash):0===this.size?Xp():(this.__ownerID=e,this.__altered=!1,this)},t}(Ff);Np.isMap=yh;var Fp=Np.prototype;Fp[vh]=!0,Fp[mf]=Fp.remove,Fp.removeAll=Fp.deleteAll,Fp.setIn=yp,Fp.removeIn=Fp.deleteIn=bp,Fp.update=xp,Fp.updateIn=Sp,Fp.merge=Fp.concat=wp,Fp.mergeWith=Ap,Fp.mergeDeep=Ep,Fp.mergeDeepWith=Mp,Fp.mergeIn=kp,Fp.mergeDeepIn=Ip,Fp.withMutations=Dp,Fp.wasAltered=Bp,Fp.asImmutable=Rp,Fp["@@transducer/init"]=Fp.asMutable=Op,Fp["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},Fp["@@transducer/result"]=function(e){return e.asImmutable()};var Lp=function(e,t){this.ownerID=e,this.entries=t};Lp.prototype.get=function(e,t,r,n){for(var i=this.entries,a=0,o=i.length;a<o;a++)if(xh(r,i[a][0]))return i[a][1];return n},Lp.prototype.update=function(e,t,r,n,i,a,o){for(var s=i===yf,u=this.entries,c=0,l=u.length;c<l&&!xh(n,u[c][0]);c++);var d=c<l;if(d?u[c][1]===i:s)return this;if(bf(o),(s||!d)&&bf(a),!s||1!==u.length){if(!d&&!s&&u.length>=tm)return function(e,t,r,n){e||=new _f;for(var i=new zp(e,Ch(r),[r,n]),a=0;a<t.length;a++){var o=t[a];i=i.update(e,0,void 0,o[0],o[1])}return i}(e,u,n,i);var f=e&&e===this.ownerID,h=f?u:sp(u);return d?s?c===l-1?h.pop():h[c]=h.pop():h[c]=[n,i]:h.push([n,i]),f?(this.entries=h,this):new Lp(e,h)}};var $p=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};$p.prototype.get=function(e,t,r,n){void 0===t&&(t=Ch(r));var i=1<<((0===e?t:t>>>e)&vf),a=this.bitmap;return a&i?this.nodes[Jp(a&i-1)].get(e+5,t,r,n):n},$p.prototype.update=function(e,t,r,n,i,a,o){void 0===r&&(r=Ch(n));var s=(0===t?r:r>>>t)&vf,u=1<<s,c=this.bitmap,l=!!(c&u);if(!l&&i===yf)return this;var d=Jp(c&u-1),f=this.nodes,h=l?f[d]:void 0,p=Kp(h,e,t+5,r,n,i,a,o);if(p===h)return this;if(!l&&p&&f.length>=rm)return function(e,t,r,n,i){for(var a=0,o=Array(gf),s=0;0!==r;s++,r>>>=1)o[s]=1&r?t[a++]:void 0;return o[n]=i,new Up(e,a+1,o)}(e,f,c,s,p);if(l&&!p&&2===f.length&&Zp(f[1^d]))return f[1^d];if(l&&p&&1===f.length&&Zp(p))return p;var m=e&&e===this.ownerID,g=l?p?c:c^u:c|u,v=l?p?em(f,d,p,m):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var i=Array(n),a=0,o=0;o<n;o++)o===t&&(a=1),i[o]=e[o+a];return i}(f,d,m):function(e,t,r,n){var i=e.length+1;if(n&&t+1===i)return e[t]=r,e;for(var a=Array(i),o=0,s=0;s<i;s++)s===t?(a[s]=r,o=-1):a[s]=e[s+o];return a}(f,d,p,m);return m?(this.bitmap=g,this.nodes=v,this):new $p(e,g,v)};var Up=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};Up.prototype.get=function(e,t,r,n){void 0===t&&(t=Ch(r));var i=(0===e?t:t>>>e)&vf,a=this.nodes[i];return a?a.get(e+5,t,r,n):n},Up.prototype.update=function(e,t,r,n,i,a,o){void 0===r&&(r=Ch(n));var s=(0===t?r:r>>>t)&vf,u=i===yf,c=this.nodes,l=c[s];if(u&&!l)return this;var d=Kp(l,e,t+5,r,n,i,a,o);if(d===l)return this;var f=this.count;if(l){if(!d&&--f<nm)return function(e,t,r,n){for(var i=0,a=0,o=Array(r),s=0,u=1,c=t.length;s<c;s++,u<<=1){var l=t[s];void 0!==l&&s!==n&&(i|=u,o[a++]=l)}return new $p(e,i,o)}(e,c,f,s)}else f++;var h=e&&e===this.ownerID,p=em(c,s,d,h);return h?(this.count=f,this.nodes=p,this):new Up(e,f,p)};var jp=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};jp.prototype.get=function(e,t,r,n){for(var i=this.entries,a=0,o=i.length;a<o;a++)if(xh(r,i[a][0]))return i[a][1];return n},jp.prototype.update=function(e,t,r,n,i,a,o){void 0===r&&(r=Ch(n));var s=i===yf;if(r!==this.keyHash)return s?this:(bf(o),bf(a),Qp(this,e,t,r,[n,i]));for(var u=this.entries,c=0,l=u.length;c<l&&!xh(n,u[c][0]);c++);var d=c<l;if(d?u[c][1]===i:s)return this;if(bf(o),(s||!d)&&bf(a),s&&2===l)return new zp(e,this.keyHash,u[1^c]);var f=e&&e===this.ownerID,h=f?u:sp(u);return d?s?c===l-1?h.pop():h[c]=h.pop():h[c]=[n,i]:h.push([n,i]),f?(this.entries=h,this):new jp(e,this.keyHash,h)};var zp=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};zp.prototype.get=function(e,t,r,n){return xh(r,this.entry[0])?this.entry[1]:n},zp.prototype.update=function(e,t,r,n,i,a,o){var s=i===yf,u=xh(n,this.entry[0]);return(u?i===this.entry[1]:s)?this:(bf(o),s?void bf(a):u?e&&e===this.ownerID?(this.entry[1]=i,this):new zp(e,this.keyHash,[n,i]):(bf(a),Qp(this,e,t,Ch(n),[n,i])))},Lp.prototype.iterate=jp.prototype.iterate=function(e,t){for(var r=this.entries,n=0,i=r.length-1;n<=i;n++)if(!1===e(r[t?i-n:n]))return!1},$p.prototype.iterate=Up.prototype.iterate=function(e,t){for(var r=this.nodes,n=0,i=r.length-1;n<=i;n++){var a=r[t?i-n:n];if(a&&!1===a.iterate(e,t))return!1}},zp.prototype.iterate=function(e,t){return e(this.entry)};var Gp,Vp=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&qp(e._root)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var r=t.node,n=t.index++,i=void 0;if(r.entry){if(0===n)return Hp(e,r.entry)}else if(r.entries){if(n<=(i=r.entries.length-1))return Hp(e,r.entries[this._reverse?i-n:n])}else if(n<=(i=r.nodes.length-1)){var a=r.nodes[this._reverse?i-n:n];if(a){if(a.entry)return Hp(e,a.entry);t=this._stack=qp(a,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(Kf);function Hp(e,t){return Zf(e,t[0],t[1])}function qp(e,t){return{node:e,index:0,__prev:t}}function Wp(e,t,r,n){var i=Object.create(Fp);return i.size=e,i._root=t,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Xp(){return Gp||=Wp(0)}function Yp(e,t,r){var n,i;if(e._root){var a={value:!1},o={value:!1};if(n=Kp(e._root,e.__ownerID,0,void 0,t,r,a,o),!o.value)return e;i=e.size+(a.value?r===yf?-1:1:0)}else{if(r===yf)return e;i=1,n=new Lp(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=i,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?Wp(i,n):Xp()}function Kp(e,t,r,n,i,a,o,s){return e?e.update(t,r,n,i,a,o,s):a===yf?e:(bf(s),bf(o),new zp(t,n,[i,a]))}function Zp(e){return e.constructor===zp||e.constructor===jp}function Qp(e,t,r,n,i){if(e.keyHash===n)return new jp(t,n,[e.entry,i]);var a,o=(0===r?e.keyHash:e.keyHash>>>r)&vf,s=(0===r?n:n>>>r)&vf,u=o===s?[Qp(e,t,r+5,n,i)]:(a=new zp(t,n,i),o<s?[e,a]:[a,e]);return new $p(t,1<<o|1<<s,u)}function Jp(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,127&(e+=e>>8)+(e>>16)}function em(e,t,r,n){var i=n?e:sp(e);return i[t]=r,i}
139var tm=8,rm=16,nm=8,im="@@__IMMUTABLE_LIST__@@";function am(e){return!(!e||!e[im])}var om=function(e){function t(t){var r=hm();if(null==t)return r;if(am(t))return t;var n=e(t),i=n.size;return 0===i?r:(cp(i),i>0&&i<gf?fm(0,i,5,null,new um(n.toArray())):r.withMutations(function(e){e.setSize(i),n.forEach(function(t,r){return e.set(r,t)})}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(e,t){if((e=Sf(this,e))>=0&&e<this.size){var r=gm(this,e+=this._origin);return r&&r.array[e&vf]}return t},t.prototype.set=function(e,t){return function(e,t,r){if((t=Sf(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations(function(e){t<0?vm(e,t).set(0,r):vm(e,0,t+1).set(t,r)});t+=e._origin;var n=e._tail,i=e._root,a={value:!1};return t>=ym(e._capacity)?n=pm(n,e.__ownerID,0,t,r,a):i=pm(i,e.__ownerID,e._level,t,r,a),a.value?e.__ownerID?(e._root=i,e._tail=n,e.__hash=void 0,e.__altered=!0,e):fm(e._origin,e._capacity,e._level,i,n):e}(this,e,t)},t.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},t.prototype.insert=function(e,t){return this.splice(e,0,t)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):hm()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(r){vm(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])})},t.prototype.pop=function(){return vm(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations(function(t){vm(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])})},t.prototype.shift=function(){return vm(this,1)},t.prototype.concat=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++){var i=t[n],a=e("string"!=typeof i&&Jf(i)?i:[i]);0!==a.size&&r.push(a)}return 0===r.length?this:0!==this.size||this.__ownerID||1!==r.length?this.withMutations(function(e){r.forEach(function(t){return t.forEach(function(t){return e.push(t)})})}):this.constructor(r[0])},t.prototype.setSize=function(e){return vm(this,0,e)},t.prototype.map=function(e,t){var r=this;return this.withMutations(function(n){for(var i=0;i<r.size;i++)n.set(i,e.call(t,n.get(i),i,r))})},t.prototype.slice=function(e,t){var r=this.size;return Af(e,t,r)?this:vm(this,Cf(e,r),Tf(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=dm(this,t);return new Kf(function(){var i=n();return i===lm?{value:void 0,done:!0}:Zf(e,t?--r:r++,i)})},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,i=dm(this,t);(r=i())!==lm&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?fm(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?hm():(this.__ownerID=e,this.__altered=!1,this)},t}(Lf);om.isList=am;var sm=om.prototype;sm[im]=!0,sm[mf]=sm.remove,sm.merge=sm.concat,sm.setIn=yp,sm.deleteIn=sm.removeIn=bp,sm.update=xp,sm.updateIn=Sp,sm.mergeIn=kp,sm.mergeDeepIn=Ip,sm.withMutations=Dp,sm.wasAltered=Bp,sm.asImmutable=Rp,sm["@@transducer/init"]=sm.asMutable=Op,sm["@@transducer/step"]=function(e,t){return e.push(t)},sm["@@transducer/result"]=function(e){return e.asImmutable()};var um=function(e,t){this.array=e,this.ownerID=t};um.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0===this.array.length)return this;var n=r>>>t&vf;if(n>=this.array.length)return new um([],e);var i,a=0===n;if(t>0){var o=this.array[n];if((i=o&&o.removeBefore(e,t-5,r))===o&&a)return this}if(a&&!i)return this;var s=mm(this,e);if(!a)for(var u=0;u<n;u++)s.array[u]=void 0;return i&&(s.array[n]=i),s},um.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||0===this.array.length)return this;var n,i=r-1>>>t&vf;if(i>=this.array.length)return this;if(t>0){var a=this.array[i];if((n=a&&a.removeAfter(e,t-5,r))===a&&i===this.array.length-1)return this}var o=mm(this,e);return o.array.splice(i+1),n&&(o.array[i]=n),o};var cm,lm={};function dm(e,t){var r=e._origin,n=e._capacity,i=ym(n),a=e._tail;return function e(o,s,u){return 0===s?function(e,o){var s=o===i?a&&a.array:e&&e.array,u=o>r?0:r-o,c=n-o;return c>gf&&(c=gf),function(){if(u===c)return lm;var e=t?--c:u++;return s&&s[e]}}(o,u):function(i,a,o){var s,u=i&&i.array,c=o>r?0:r-o>>a,l=1+(n-o>>a);return l>gf&&(l=gf),function(){for(;;){if(s){var r=s();if(r!==lm)return r;s=null}if(c===l)return lm;var n=t?--l:c++;s=e(u&&u[n],a-5,o+(n<<a))}}}(o,s,u)}(e._root,e._level,0)}function fm(e,t,r,n,i,a,o){var s=Object.create(sm);return s.size=t-e,s._origin=e,s._capacity=t,s._level=r,s._root=n,s._tail=i,s.__ownerID=a,s.__hash=o,s.__altered=!1,s}function hm(){return cm||=fm(0,0,5)}function pm(e,t,r,n,i,a){var o,s=n>>>r&vf,u=e&&s<e.array.length;if(!u&&void 0===i)return e;if(r>0){var c=e&&e.array[s],l=pm(c,t,r-5,n,i,a);return l===c?e:((o=mm(e,t)).array[s]=l,o)}return u&&e.array[s]===i?e:(a&&bf(a),o=mm(e,t),void 0===i&&s===o.array.length-1?o.array.pop():o.array[s]=i,o)}function mm(e,t){return t&&e&&t===e.ownerID?e:new um(e?e.array.slice():[],t)}function gm(e,t){if(t>=ym(e._capacity))return e._tail;if(t<1<<e._level+5){for(var r=e._root,n=e._level;r&&n>0;)r=r.array[t>>>n&vf],n-=5;return r}}function vm(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new _f,i=e._origin,a=e._capacity,o=i+t,s=void 0===r?a:r<0?a+r:i+r;if(o===i&&s===a)return e;if(o>=s)return e.clear();for(var u=e._level,c=e._root,l=0;o+l<0;)c=new um(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(o+=l,i+=l,s+=l,a+=l);for(var d=ym(a),f=ym(s);f>=1<<u+5;)c=new um(c&&c.array.length?[c]:[],n),u+=5;var h=e._tail,p=f<d?gm(e,s-1):f>d?new um([],n):h;if(h&&f>d&&o<a&&h.array.length){for(var m=c=mm(c,n),g=u;g>5;g-=5){var v=d>>>g&vf;m=m.array[v]=mm(m.array[v],n)}m.array[d>>>5&vf]=h}if(s<a&&(p&&=p.removeAfter(n,0,s)),o>=f)o-=f,s-=f,u=5,c=null,p&&=p.removeBefore(n,0,o);else if(o>i||f<d){for(l=0;c;){var y=o>>>u&vf;if(y!==f>>>u&vf)break;y&&(l+=(1<<u)*y),u-=5,c=c.array[y]}c&&o>i&&(c=c.removeBefore(n,u,o-l)),c&&f<d&&(c=c.removeAfter(n,u,f-l)),l&&(o-=l,s-=l)}return e.__ownerID?(e.size=s-o,e._origin=o,e._capacity=s,e._level=u,e._root=c,e._tail=p,e.__hash=void 0,e.__altered=!0,e):fm(o,s,u,c,p)}function ym(e){return e<gf?0:e-1>>>5<<5}var bm,_m=function(e){function t(e){return null==e?Sm():bh(e)?e:Sm().withMutations(function(t){var r=Ff(e);cp(r.size),r.forEach(function(e,r){return t.set(r,e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(e,t){var r=this._map.get(e);return void 0===r?t:this._list.get(r)[1]},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):Sm()},t.prototype.set=function(e,t){return wm(this,e,t)},t.prototype.remove=function(e){return wm(this,e,yf)},t.prototype.__iterate=function(e,t){var r=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],r)},t)},t.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),r=this._list.__ensureOwner(e);return e?xm(t,r,e,this.__hash):0===this.size?Sm():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(Np);function xm(e,t,r,n){var i=Object.create(_m.prototype);return i.size=e?e.size:0,i._map=e,i._list=t,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Sm(){return bm||=xm(Xp(),hm())}function wm(e,t,r){var n,i,a=e._map,o=e._list,s=a.get(t),u=void 0!==s;if(r===yf){if(!u)return e;o.size>=gf&&o.size>=2*a.size?(n=(i=o.filter(function(e,t){return void 0!==e&&s!==t})).toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(n.__ownerID=i.__ownerID=e.__ownerID)):(n=a.remove(t),i=s===o.size-1?o.pop():o.set(s,void 0))}else if(u){if(r===o.get(s)[1])return e;n=a,i=o.set(s,[t,r])}else n=a.set(t,o.size),i=o.set(o.size,[t,r]);return e.__ownerID?(e.size=n.size,e._map=n,e._list=i,e.__hash=void 0,e.__altered=!0,e):xm(n,i)}_m.isOrderedMap=bh,_m.prototype[Hf]=!0,_m.prototype[mf]=_m.prototype.remove;
139var Am="@@__IMMUTABLE_STACK__@@";function Cm(e){return!(!e||!e[Am])}var Tm=function(e){function t(e){return null==e?km():Cm(e)?e:km().pushAll(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(e,t){var r=this._head;for(e=Sf(this,e);r&&e--;)r=r.next;return r?r.value:t},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var e=arguments;if(0===arguments.length)return this;for(var t=this.size+arguments.length,r=this._head,n=arguments.length-1;n>=0;n--)r={value:e[n],next:r};return this.__ownerID?(this.size=t,this._head=r,this.__hash=void 0,this.__altered=!0,this):Mm(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&Cm(t))return t;cp(t.size);var r=this.size,n=this._head;return t.__iterate(function(e){r++,n={value:e,next:n}},!0),this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):Mm(r,n)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):km()},t.prototype.slice=function(t,r){if(Af(t,r,this.size))return this;var n=Cf(t,this.size);if(Tf(r,this.size)!==this.size)return e.prototype.slice.call(this,t,r);for(var i=this.size-n,a=this._head;n--;)a=a.next;return this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):Mm(i,a)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Mm(this.size,this._head,e,this.__hash):0===this.size?km():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new ch(this.toArray()).__iterate(function(t,n){return e(t,n,r)},t);for(var n=0,i=this._head;i&&!1!==e(i.value,n++,this);)i=i.next;return n},t.prototype.__iterator=function(e,t){if(t)return new ch(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new Kf(function(){if(n){var t=n.value;return n=n.next,Zf(e,r++,t)}return{value:void 0,done:!0}})},t}(Lf);Tm.isStack=Cm;var Pm,Em=Tm.prototype;function Mm(e,t,r,n){var i=Object.create(Em);return i.size=e,i._head=t,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function km(){return Pm||=Mm(0)}Em[Am]=!0,Em.shift=Em.pop,Em.unshift=Em.push,Em.unshiftAll=Em.pushAll,Em.withMutations=Dp,Em.wasAltered=Bp,Em.asImmutable=Rp,Em["@@transducer/init"]=Em.asMutable=Op,Em["@@transducer/step"]=function(e,t){return e.unshift(t)},Em["@@transducer/result"]=function(e){return e.asImmutable()};var Im="@@__IMMUTABLE_SET__@@";function Dm(e){return!(!e||!e[Im])}function Om(e){return Dm(e)&&qf(e)}function Rm(e,t){if(e===t)return!0;if(!kf(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||Df(e)!==Df(t)||Rf(e)!==Rf(t)||qf(e)!==qf(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!Bf(e);if(qf(e)){var n=e.entries();return t.every(function(e,t){var i=n.next().value;return i&&xh(i[1],e)&&(r||xh(i[0],t))})&&n.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var a=e;e=t,t=a}var o=!0,s=t.__iterate(function(t,n){if(r?!e.has(t):i?!xh(t,e.get(n,yf)):!xh(e.get(n,yf),t))return o=!1,!1});return o&&e.size===s}function Bm(e,t){var r=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r),e}function Nm(e){if(!e||"object"!=typeof e)return e;if(!kf(e)){if(!fp(e))return e;e=ah(e)}if(Df(e)){var t={};return e.__iterate(function(e,r){t[r]=Nm(e)}),t}var r=[];return e.__iterate(function(e){r.push(Nm(e))}),r}var Fm=function(e){function t(t){return null==t?zm():Dm(t)&&!qf(t)?t:zm().withMutations(function(r){var n=e(t);cp(n.size),n.forEach(function(e){return r.add(e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(Ff(e).keySeq())},t.intersect=function(e){return(e=Nf(e).toArray()).length?$m.intersect.apply(t(e.pop()),e):zm()},t.union=function(e){return(e=Nf(e).toArray()).length?$m.union.apply(t(e.pop()),e):zm()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return Um(this,this._map.set(e,e))},t.prototype.remove=function(e){return Um(this,this._map.remove(e))},t.prototype.clear=function(){return Um(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,i=Um(this,this._map.mapEntries(function(i){var a=i[1],o=e.call(t,a,a,r);return o!==a&&(n=!0),[o,o]},t));return n?i:this},t.prototype.union=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return t=t.filter(function(e){return 0!==e.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(r){for(var n=0;n<t.length;
139n++)"string"==typeof t[n]?r.add(t[n]):e(t[n]).forEach(function(e){return r.add(e)})}):this.constructor(t[0])},t.prototype.intersect=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map(function(t){return e(t)});var n=[];return this.forEach(function(e){t.every(function(t){return t.includes(e)})||n.push(e)}),this.withMutations(function(e){n.forEach(function(t){e.remove(t)})})},t.prototype.subtract=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map(function(t){return e(t)});var n=[];return this.forEach(function(e){t.some(function(t){return t.includes(e)})&&n.push(e)}),this.withMutations(function(e){n.forEach(function(t){e.remove(t)})})},t.prototype.sort=function(e){return og(Zh(this,e))},t.prototype.sortBy=function(e,t){return og(Zh(this,t,e))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(e,t){var r=this;return this._map.__iterate(function(t){return e(t,t,r)},t)},t.prototype.__iterator=function(e,t){return this._map.__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):0===this.size?this.__empty():(this.__ownerID=e,this._map=t,this)},t}($f);Fm.isSet=Dm;var Lm,$m=Fm.prototype;function Um(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function jm(e,t){var r=Object.create($m);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function zm(){return Lm||=jm(Xp())}$m[Im]=!0,$m[mf]=$m.remove,$m.merge=$m.concat=$m.union,$m.withMutations=Dp,$m.asImmutable=Rp,$m["@@transducer/init"]=$m.asMutable=Op,$m["@@transducer/step"]=function(e,t){return e.add(t)},$m["@@transducer/result"]=function(e){return e.asImmutable()},$m.__empty=zm,$m.__make=jm;var Gm,Vm=function(e){function t(e,r,n){if(!(this instanceof t))return new t(e,r,n);if(up(0!==n,"Cannot step a Range by 0"),e||=0,void 0===r&&(r=1/0),n=void 0===n?1:Math.abs(n),r<e&&(n=-n),this._start=e,this._end=r,this._step=n,this.size=Math.max(0,Math.ceil((r-e)/n-1)+1),0===this.size){if(Gm)return Gm;Gm=this}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1===this._step?"":" by "+this._step)+" ]"},t.prototype.get=function(e,t){return this.has(e)?this._start+Sf(this,e)*this._step:t},t.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},t.prototype.slice=function(e,r){return Af(e,r,this.size)?this:(e=Cf(e,this.size),(r=Tf(r,this.size))<=e?new t(0,0):new t(this.get(e,this._end),this.get(r,this._end),this._step))},t.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step==0){var r=t/this._step;if(r>=0&&r<this.size)return r}return-1},t.prototype.lastIndexOf=function(e){return this.indexOf(e)},t.prototype.__iterate=function(e,t){for(var r=this.size,n=this._step,i=t?this._start+(r-1)*n:this._start,a=0;a!==r&&!1!==e(i,t?r-++a:a++,this);)i+=t?-n:n;return a},t.prototype.__iterator=function(e,t){var r=this.size,n=this._step,i=t?this._start+(r-1)*n:this._start,a=0;return new Kf(function(){if(a===r)return{value:void 0,done:!0};var o=i;return i+=t?-n:n,Zf(e,t?r-++a:a++,o)})},t.prototype.equals=function(e){return e instanceof t?this._start===e._start&&this._end===e._end&&this._step===e._step:Rm(this,e)},t}(sh);function Hm(e,t,r){for(var n=lp(t),i=0;i!==n.length;)if((e=pp(e,n[i++],yf))===yf)return r;return e}function qm(e,t){return Hm(this,e,t)}function Wm(){cp(this.size);var e={};return this.__iterate(function(t,r){e[r]=t}),e}Nf.isIterable=kf,Nf.isKeyed=Df,Nf.isIndexed=Rf,Nf.isAssociative=Bf,Nf.isOrdered=qf,Nf.Iterator=Kf,Bm(Nf,{toArray:function(){cp(this.size);var e=Array(this.size||0),t=Df(this),r=0;return this.__iterate(function(n,i){e[r++]=t?[i,n]:n}),e},toIndexedSeq:function(){return new jh(this)},toJS:function(){return Nm(this)},toKeyedSeq:function(){return new Uh(this,!0)},toMap:function(){return Np(this.toKeyedSeq())},toObject:Wm,toOrderedMap:function(){return _m(this.toKeyedSeq())},toOrderedSet:function(){return og(Df(this)?this.valueSeq():this)},toSet:function(){return Fm(Df(this)?this.valueSeq():this)},toSetSeq:function(){return new zh(this)},toSeq:function(){return Rf(this)?this.toIndexedSeq():Df(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Tm(Df(this)?this.valueSeq():this)},toList:function(){return om(Df(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return tp(this,function(e,t){var r=Df(e),n=[e].concat(t).map(function(e){return kf(e)?r&&(e=Ff(e)):e=r?ph(e):mh(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===n.length)return e;if(1===n.length){var i=n[0];if(i===e||r&&Df(i)||Rf(e)&&Rf(i))return i}var a=new ch(n);return r?a=a.toKeyedSeq():Rf(e)||(a=a.toSetSeq()),(a=a.flatten(!0)).size=n.reduce(function(e,t){if(void 0!==e){var r=t.size;if(void 0!==r)return e+r}},0),a}(this,e))},includes:function(e){return this.some(function(t){return xh(t,e)})},entries:function(){return this.__iterator(2)},every:function(e,t){cp(this.size);var r=!0;return this.__iterate(function(n,i,a){if(!e.call(t,n,i,a))return r=!1,!1}),r},filter:function(e,t){return tp(this,Wh(this,e,t,!0))},partition:function(e,t){return function(e,t,r){var n=Df(e),i=[[],[]];e.__iterate(function(a,o){i[+!!t.call(r,a,o,e)].push(n?[o,a]:a)});var a=np(e);return i.map(function(t){return tp(e,a(t))})}(this,e,t)},find:function(e,t,r){var n=this.findEntry(e,t);
139return n?n[1]:r},forEach:function(e,t){return cp(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){cp(this.size),e=void 0===e?",":""+e;var t="",r=!0;return this.__iterate(function(n){r?r=!1:t+=e,t+=null==n?"":n.toString()}),t},keys:function(){return this.__iterator(0)},map:function(e,t){return tp(this,Hh(this,e,t))},reduce:function(e,t,r){return Qm(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return Qm(this,e,t,r,arguments.length<2,!0)},reverse:function(){return tp(this,qh(this,!0))},slice:function(e,t){return tp(this,Xh(this,e,t,!0))},some:function(e,t){cp(this.size);var r=!1;return this.__iterate(function(n,i,a){if(e.call(t,n,i,a))return r=!0,!1}),r},sort:function(e){return tp(this,Zh(this,e))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0===this.size?!this.some(function(){return!0}):0===this.size},count:function(e,t){return xf(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=Np().asMutable();return e.__iterate(function(i,a){n.update(t.call(r,i,a,e),0,function(e){return e+1})}),n.asImmutable()}(this,e,t)},equals:function(e){return Rm(this,e)},entrySeq:function(){var e=this;if(e._cache)return new ch(e._cache);var t=e.toSeq().map(eg).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(tg(e),t)},findEntry:function(e,t,r){var n=r;return this.__iterate(function(r,i,a){if(e.call(t,r,i,a))return n=[i,r],!1}),n},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(e){return this.find(wf,null,e)},flatMap:function(e,t){return tp(this,function(e,t,r){var n=np(e);return e.toSeq().map(function(i,a){return n(t.call(r,i,a,e))}).flatten(!0)}(this,e,t))},flatten:function(e){return tp(this,Kh(this,e,!0))},fromEntrySeq:function(){return new Gh(this)},get:function(e,t){return this.find(function(t,r){return xh(r,e)},void 0,t)},getIn:qm,groupBy:function(e,t){return function(e,t,r){var n=Df(e),i=(qf(e)?_m():Np()).asMutable();e.__iterate(function(a,o){i.update(t.call(r,a,o,e),function(e){return(e||=[]).push(n?[o,a]:a),e})});var a=np(e);return i.map(function(t){return tp(e,a(t))}).asImmutable()}(this,e,t)},has:function(e){return this.get(e,yf)!==yf},hasIn:function(e){return Hm(this,e,yf)!==yf},isSubset:function(e){return e="function"==typeof e.includes?e:Nf(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:Nf(e)).isSubset(this)},keyOf:function(e){return this.findKey(function(t){return xh(t,e)})},keySeq:function(){return this.toSeq().map(Jm).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Qh(this,e)},maxBy:function(e,t){return Qh(this,t,e)},min:function(e){return Qh(this,e?rg(e):ig)},minBy:function(e,t){return Qh(this,t?rg(t):ig,e)},rest:function(){return this.slice(1)},skip:function(e){return 0===e?this:this.slice(Math.max(0,e))},skipLast:function(e){return 0===e?this:this.slice(0,-Math.max(0,e))},skipWhile:function(e,t){return tp(this,Yh(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(tg(e),t)},sortBy:function(e,t){return tp(this,Zh(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return this.slice(-Math.max(0,e))},takeWhile:function(e,t){return tp(this,function(e,t,r){var n=ip(e);return n.__iterateUncached=function(n,i){var a=this;if(i)return this.cacheResult().__iterate(n,i);var o=0;return e.__iterate(function(e,i,s){return t.call(r,e,i,s)&&++o&&n(e,i,a)}),o},n.__iteratorUncached=function(n,i){var a=this;if(i)return this.cacheResult().__iterator(n,i);var o=e.__iterator(2,i),s=!0;return new Kf(function(){if(!s)return{value:void 0,done:!0};var e=o.next();if(e.done)return e;var i=e.value,u=i[0],c=i[1];return t.call(r,c,u,a)?2===n?e:Zf(n,u,c,e):(s=!1,{value:void 0,done:!0})})},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(tg(e),t)},update:function(e){return e(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||=function(e){if(e.size===1/0)return 0;var t=qf(e),r=Df(e),n=+!!t;return function(e,t){return t=Sh(t,3432918353),t=Sh(t<<15|t>>>-15,461845907),t=Sh(t<<13|t>>>-13,5),t=Sh((t=t+3864292196^e)^t>>>16,2246822507),wh((t=Sh(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+ag(Ch(e),Ch(t))|0}:function(e,t){n=n+ag(Ch(e),Ch(t))|0}:t?function(e){n=31*n+Ch(e)|0}:function(e){n=n+Ch(e)|0}),n)}(this)}});var Xm=Nf.prototype;Xm[Mf]=!0,Xm[Yf]=Xm.values,Xm.toJSON=Xm.toArray,Xm.__toStringMapper=hp,Xm.inspect=Xm.toSource=function(){return this.toString()},Xm.chain=Xm.flatMap,Xm.contains=Xm.includes,Bm(Ff,{flip:function(){return tp(this,Vh(this))},mapEntries:function(e,t){var r=this,n=0;return tp(this,this.toSeq().map(function(i,a){return e.call(t,[a,i],n++,r)}).fromEntrySeq())},mapKeys:function(e,t){var r=this;return tp(this,this.toSeq().flip().map(function(n,i){return e.call(t,n,i,r)}).flip())}});var Ym=Ff.prototype;Ym[If]=!0,Ym[Yf]=Xm.entries,Ym.toJSON=Wm,Ym.__toStringMapper=function(e,t){return hp(t)+": "+hp(e)},Bm(Lf,{toKeyedSeq:function(){return new Uh(this,!1)},filter:function(e,t){return tp(this,Wh(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return tp(this,qh(this,!1))},slice:function(e,t){return tp(this,Xh(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),0===r||2===r&&!t)return this;e=Cf(e,e<0?this.count():this.size);var n=this.slice(0,e);return tp(this,1===r?n:n.concat(sp(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return tp(this,Kh(this,e,!1))},get:function(e,t){return(e=Sf(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,r){return r===e},void 0,t)},has:function(e){return(e=Sf(this,e))>=0&&(void 0===this.size?-1!==this.indexOf(e):this.size===1/0||e<this.size)},interpose:function(e){return tp(this,function(e,t){var r=ip(e);return r.size=e.size&&2*e.size-1,r.__iterateUncached=function(r,n){var i=this,a=0;return e.__iterate(function(e){return(!a||!1!==r(t,a++,i))&&!1!==r(e,a++,i)},n),a},r.__iteratorUncached=function(r,n){var i,a=e.__iterator(1,n),o=0;return new Kf(function(){return(!i||o%2)&&(i=a.next()).done?i:o%2?Zf(r,o++,t):Zf(r,o++,i.value,i)})},r}(this,e))},interleave:function(){var e=[this].concat(sp(arguments)),t=ep(this.toSeq(),sh.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),tp(this,r)},keySeq:function(){return Vm(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return tp(this,Yh(this,e,t,!1))},zip:function(){return tp(this,ep(this,ng,[this].concat(sp(arguments))))},zipAll:function(){return tp(this,ep(this,ng,[this].concat(sp(arguments)),!0))},zipWith:function(e){var t=sp(arguments);return t[0]=this,tp(this,ep(this,e,t))}});var Km=Lf.prototype;Km[Of]=!0,Km[Hf]=!0,Bm($f,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var Zm=$f.prototype;function Qm(e,t,r,n,i,a){return cp(e.size),e.__iterate(function(e,a,o){i?(i=!1,r=e):r=t.call(n,r,e,a,o)},a),r}function Jm(e,t){return t}function eg(e,t){return[t,e]}function tg(e){return function(){return!e.apply(this,arguments)}}function rg(e){return function(){return-e.apply(this,arguments)}}function ng(){return sp(arguments)}function ig(e,t){return e<t?1:e>t?-1:0}function ag(e,t){return e^t+2654435769+(e<<6)+(e>>2)}Zm.has=Xm.includes,Zm.contains=Zm.includes,Zm.keys=Zm.values,Bm(oh,Ym),Bm(sh,Km),Bm(uh,Zm);var og=function(e){function t(e){return null==e?lg():Om(e)?e:lg().withMutations(function(t){var r=$f(e);cp(r.size),r.forEach(function(e){return t.add(e)})})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(Ff(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(Fm);og.isOrderedSet=Om;var sg,ug=og.prototype;function cg(e,t){var r=Object.create(ug);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function lg(){return sg||=cg(Sm())}ug[Hf]=!0,ug.zip=Km.zip,ug.zipWith=Km.zipWith,ug.zipAll=Km.zipAll,ug.__empty=lg,ug.__make=cg;var dg=function(e,t){var r;!function(e){if(Gf(e))throw Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(Vf(e))throw Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if("object"!=typeof e||!e)throw Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(e);var n=function(a){var o=this;if(a instanceof n)return a;
139if(!(this instanceof n))return new n(a);if(!r){r=!0;var s=Object.keys(e),u=i._indices={};i._name=t,i._keys=s,i._defaultValues=e;for(var c=0;c<s.length;c++){var l=s[c];u[l]=c,i[l]?"object"==typeof console&&console.warn&&console.warn("Cannot define "+pg(this)+' with property "'+l+'" since that property name is part of the Record API.'):gg(i,l)}}return this.__ownerID=void 0,this._values=om().withMutations(function(e){e.setSize(o._keys.length),Ff(a).forEach(function(t,r){e.set(o._indices[r],t===o._defaultValues[r]?void 0:t)})}),this},i=n.prototype=Object.create(fg);return i.constructor=n,t&&(n.displayName=t),n};dg.prototype.toString=function(){for(var e,t=pg(this)+" { ",r=this._keys,n=0,i=r.length;n!==i;n++)t+=(n?", ":"")+(e=r[n])+": "+hp(this.get(e));return t+" }"},dg.prototype.equals=function(e){return this===e||Gf(e)&&mg(this).equals(mg(e))},dg.prototype.hashCode=function(){return mg(this).hashCode()},dg.prototype.has=function(e){return this._indices.hasOwnProperty(e)},dg.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._indices[e],n=this._values.get(r);return void 0===n?this._defaultValues[e]:n},dg.prototype.set=function(e,t){if(this.has(e)){var r=this._values.set(this._indices[e],t===this._defaultValues[e]?void 0:t);if(r!==this._values&&!this.__ownerID)return hg(this,r)}return this},dg.prototype.remove=function(e){return this.set(e)},dg.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:hg(this,e)},dg.prototype.wasAltered=function(){return this._values.wasAltered()},dg.prototype.toSeq=function(){return mg(this)},dg.prototype.toJS=function(){return Nm(this)},dg.prototype.entries=function(){return this.__iterator(2)},dg.prototype.__iterator=function(e,t){return mg(this).__iterator(e,t)},dg.prototype.__iterate=function(e,t){return mg(this).__iterate(e,t)},dg.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?hg(this,t,e):(this.__ownerID=e,this._values=t,this)},dg.isRecord=Gf,dg.getDescriptiveName=pg;var fg=dg.prototype;function hg(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._values=t,n.__ownerID=r,n}function pg(e){return e.constructor.displayName||e.constructor.name||"Record"}function mg(e){return ph(e._keys.map(function(t){return[t,e.get(t)]}))}function gg(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){up(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}fg[zf]=!0,fg[mf]=fg.remove,fg.deleteIn=fg.removeIn=bp,fg.getIn=qm,fg.hasIn=Xm.hasIn,fg.merge=wp,fg.mergeWith=Ap,fg.mergeIn=kp,fg.mergeDeep=Ep,fg.mergeDeepWith=Mp,fg.mergeDeepIn=Ip,fg.setIn=yp,fg.update=xp,fg.updateIn=Sp,fg.withMutations=Dp,fg.asMutable=Op,fg.asImmutable=Rp,fg[Yf]=fg.entries,fg.toJSON=fg.toObject=Xm.toObject,fg.inspect=fg.toSource=function(){return this.toString()};var vg=1e-6;function yg(e,t,r){return Math.abs(e-t)<=r}function bg(e,t,r){return Math.max(t,Math.min(r,e))}function _g(e,t,r){return e+(t-e)*r}function xg(e,t,r,n,i,a){var o=(r-e)*a,s=(n-t)*a,u=i*i;return(2*t-2*r+o+s)*(i*u)+(-3*t+3*r-2*o-s)*u+o*i+t}function Sg(e,t,r,n){var i=1-n;return i*i*e+2*i*n*t+n*n*r}function wg(e,t,r){var n;return n=function(e,t,r){return(e-t)/(r-t)}(r,e,t),(r=bg(n,0,1))*r*(3-2*r)}var Ag=isFinite;function Cg(){return Cg.zero()}!function(e){function t(){var e=[.1,0,0];return e[0]=0,e}function r(e,r,n){var i=t();return i[0]=e,i[1]=r,i[2]=n,i}function n(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function i(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function a(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function o(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function s(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function u(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function c(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function l(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function d(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function f(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}e.zero=t,e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},e.isFinite=function(e){return Ag(e[0])&&Ag(e[1])&&Ag(e[2])},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])},e.setNaN=function(e){return e[0]=NaN,e[1]=NaN,e[2]=NaN,e},e.fromObj=function(e){return r(e.x,e.y,e.z)},e.toObj=function(e){return{x:e[0],y:e[1],z:e[2]}},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t},e.create=r,e.ofArray=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},e.set=function(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e},e.copy=n,e.add=i,e.sub=a,e.mul=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e},e.div=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e},e.scale=o,e.scaleAndAdd=s,e.scaleAndSub=function(e,t,r,n){return e[0]=t[0]-r[0]*n,e[1]=t[1]-r[1]*n,e[2]=t[2]-r[2]*n,e},e.addScalar=function(e,t,r){return e[0]=t[0]+r,e[1]=t[1]+r,e[2]=t[2]+r,e},e.subScalar=function(e,t,r){return e[0]=t[0]-r,e[1]=t[1]-r,e[2]=t[2]-r,e},e.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},e.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},e.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},e.trunc=function(e,t){return e[0]=Math.trunc(t[0]),e[1]=Math.trunc(t[1]),e[2]=Math.trunc(t[2]),e},e.abs=function(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e},e.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},e.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},e.clamp=function(e,t,r,n){return e[0]=Math.max(r[0],Math.min(n[0],t[0])),e[1]=Math.max(r[1],Math.min(n[1],t[1])),e[2]=Math.max(r[2],Math.min(n[2],t[2])),e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)},e.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i},e.magnitude=function(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)},e.squaredMagnitude=u,e.setMagnitude=function(e,t,r){return o(e,l(e,t),r)},e.negate=c,e.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},e.normalize=l,e.dot=d,e.cross=f,e.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e};var h=t();function p(e,t){var r=Math.sqrt(u(e)*u(t));if(0===r)return Math.PI/2;var n=d(e,t)/r;return Math.acos(bg(n,-1,1))}e.slerp=function(e,t,r,n){var a=bg(d(t,r),-1,1),u=Math.acos(a)*n;return s(h,r,t,-a),l(h,h),i(e,o(e,t,Math.cos(u)),o(h,h,Math.sin(u)))},e.hermite=function(e,t,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e}
139,e.bezier=function(e,t,r,n,i,a){var o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,d=3*u*o,f=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*d+i[0]*f,e[1]=t[1]*c+r[1]*l+n[1]*d+i[1]*f,e[2]=t[2]*c+r[2]*l+n[2]*d+i[2]*f,e},e.quadraticBezier=function(e,t,r,n,i){return e[0]=Sg(t[0],r[0],n[0],i),e[1]=Sg(t[1],r[1],n[1],i),e[2]=Sg(t[2],r[2],n[2],i),e},e.spline=function(e,t,r,n,i,a,o){return e[0]=xg(t[0],r[0],n[0],i[0],a,o),e[1]=xg(t[1],r[1],n[1],i[1],a,o),e[2]=xg(t[2],r[2],n[2],i[2],a,o),e},e.random=function(e,t){var r=2*Math.random()*Math.PI,n=2*Math.random()-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e},e.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=1/(r[3]*n+r[7]*i+r[11]*a+r[15]||1);return e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])*o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])*o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])*o,e},e.transformDirection=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[4]*i+r[8]*a,e[1]=r[1]*n+r[5]*i+r[9]*a,e[2]=r[2]*n+r[6]*i+r[10]*a,l(e,e)},e.transformMat4Offset=function(e,t,r,n,i,a){var o=t[0+i],s=t[1+i],u=t[2+i],c=1/(r[3+a]*o+r[7+a]*s+r[11+a]*u+r[15+a]||1);return e[0+n]=(r[0+a]*o+r[4+a]*s+r[8+a]*u+r[12+a])*c,e[1+n]=(r[1+a]*o+r[5+a]*s+r[9
139+a]*u+r[13+a])*c,e[2+n]=(r[2+a]*o+r[6+a]*s+r[10+a]*u+r[14+a])*c,e},e.transformMat3=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e},e.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,d=c*i+u*n-o*a,f=c*a+o*i-s*n,h=-o*n-s*i-u*a;return e[0]=l*c+h*-o+d*-u-f*-s,e[1]=d*c+h*-s+f*-o-l*-u,e[2]=f*c+h*-u+l*-s-d*-o,e},e.angle=p;var m=t(),g=t(),v=t(),y=t(),b=t(),_=t(),x=t();e.dihedralAngle=function(e,t,r,n){a(m,e,t),a(g,r,t),a(v,t,r),a(y,n,r),f(b,m,g),f(_,v,y);var i=p(b,_);return f(x,b,_),d(g,x)>0?i:-i},e.directionFromSpherical=function(t,r,n,i){return e.set(t,i*Math.cos(n)*Math.sin(r),i*Math.sin(n)*Math.sin(r),i*Math.cos(r))},e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},e.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=vg*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=vg*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=vg*Math.max(1,Math.abs(i),Math.abs(s))};var S=t();e.makeRotation=function(t,r,n){var i=p(r,n);if(Math.abs(i)<1e-4)return Og.setIdentity(t);if(Math.abs(i-Math.PI)<vg)return Og.fromScaling(t,e.negUnit);var a=f(S,r,n);return Og.fromRotation(t,i,a)},e.isZero=function(e){return 0===e[0]&&0===e[1]&&0===e[2]},e.projectPointOnVector=function(e,t,r,n){return a(e,t,n),i(e,o(e,r,d(r,e)/u(r)),n)};var w=t();function A(e,t,r){return o(e,r,d(r,t)/u(r))}e.projectPointOnPlane=function(e,t,r,n){return l(w,r),a(e,t,n),a(e,t,o(w,w,d(e,w)))},e.projectOnVector=A;var C=t();e.projectOnPlane=function(e,t,r){return A(C,t,r),a(e,t,C)},e.orthogonalize=function(e,t,r){return l(e,f(e,f(e,t,r),t))},e.matchDirection=function(e,t,r){return d(t,r)>0?n(e,t):c(e,n(e,t)),e};var T=t(),P=t();e.triangleNormal=function(e,t,r,n){return a(T,r,t),a(P,n,t),l(e,f(e,T,P))},e.toString=function(e,t){return`[${e[0].toPrecision(t)} ${e[1].toPrecision(t)} ${e[2].toPrecision(t)}]`},e.origin=r(0,0,0),e.unit=r(1,1,1),e.negUnit=r(-1,-1,-1),e.unitX=r(1,0,0),e.unitY=r(0,1,0),e.unitZ=r(0,0,1),e.negUnitX=r(-1,0,0),e.negUnitY=r(0,-1,0),e.negUnitZ=r(0,0,-1)}(Cg||={});var Tg,Pg=Math.PI/2,Eg=Math.PI/180;function Mg(e){return e*Eg}function kg(e){return e/Eg}function Ig(e){return 0!==e&&!(e&e-1)}function Dg(e,t){return e*t}function Og(){return Og.zero()}function Rg(){return Rg.zero()}function Bg(){return Bg.zero()}function Ng(){return Ng.zero()}function Fg(e){return Object.keys(e)}function Lg(e){throw Error("unreachable")}function $g(e){return"function"==typeof e?.then}function Ug(){return Ug.zero()}(function(e){function t(){var e=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];return e[0]=0,e}function r(){var e=t();return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function i(e){for(var t=0;t<16;t++)e[t]=0;return e}e.zero=t,e.identity=r,e.setIdentity=n,e.setZero=i,e.ofRows=function(e){for(var r=t(),n=0;n<4;n++)for(var i=e[n],a=0;a<4;a++)r[4*a+n]=i[a];return r};var a=r();function o(e,t,r){for(var n=0;n<16;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}function s(e,t,r,n){e[4*r+t]=n}function u(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function c(e,t){var r=t[0]+t[5]+t[10],n=0;return r>0?(n=2*Math.sqrt(r+1),e[3]=.25*n,e[0]=(t[6]-t[9])/n,e[1]=(t[8]-t[2])/n,e[2]=(t[1]-t[4])/n):t[0]>t[5]&&t[0]>t[10]?(n=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/n,e[0]=.25*n,e[1]=(t[1]+t[4])/n,e[2]=(t[8]+t[2])/n):t[5]>t[10]?(n=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/n,e[0]=(t[1]+t[4])/n,e[1]=.25*n,e[2]=(t[6]+t[9])/n):(n=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/n,e[0]=(t[8]+t[2])/n,e[1]=(t[6]+t[9])/n,e[2]=.25*n),e}function l(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],d=t[9],f=t[10],h=t[11],p=t[12],m=t[13],g=t[14],v=t[15],y=r*s-n*o,b=r*u-i*o,_=r*c-a*o,x=n*u-i*s,S=n*c-a*s,w=i*c-a*u,A=l*m-d*p,C=l*g-f*p,T=l*v-h*p,P=d*g-f*m,E=d*v-h*m,M=f*v-h*g,k=y*M-b*E+_*P+x*T-S*C+w*A;return!!k&&(k=1/k,e[0]=(s*M-u*E+c*P)*k,e[1]=(i*E-n*M-a*P)*k,e[2]=(m*w-g*S+v*x)*k,e[3]=(f*S-d*w-h*x)*k,e[4]=(u*T-o*M-c*C)*k,e[5]=(r*M-i*T+a*C)*k,e[6]=(g*_-p*w-v*b)*k,e[7]=(l*w-f*_+h*b)*k,e[8]=(o*E-s*T+c*A)*k,e[9]=(n*T-r*E-a*A)*k,e[10]=(p*S-m*_+v*y)*k,e[11]=(d*_-l*S-h*y)*k,e[12]=(s*C-o*P-u*A)*k,e[13]=(r*P-n*C+i*A)*k,e[14]=(m*b-p*x-g*y)*k,e[15]=(l*x-d*b+f*y)*k,!0)}function d(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=t[8],f=t[9],h=t[10],p=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=r[0],_=r[1],x=r[2],S=r[3];return e[0]=b*n+_*s+x*d+S*m,e[1]=b*i+_*u+x*f+S*g,e[2]=b*a+_*c+x*h+S*v,e[3]=b*o+_*l+x*p+S*y,b=r[4],_=r[5],x=r[6],S=r[7],e[4]=b*n+_*s+x*d+S*m,e[5]=b*i+_*u+x*f+S*g,e[6]=b*a+_*c+x*h+S*v,e[7]=b*o+_*l+x*p+S*y,b=r[8],_=r[9],x=r[10],S=r[11],e[8]=b*n+_*s+x*d+S*m,e[9]=b*i+_*u+x*f+S*g,e[10]=b*a+_*c+x*h+S*v,e[11]=b*o+_*l+x*p+S*y,b=r[12],_=r[13],x=r[14],S=r[15],e[12]=b*n+_*s+x*d+S*m,e[13]=b*i+_*u+x*f+S*g,e[14]=b*a+_*c+x*h+S*v,e[15]=b*o+_*l+x*p+S*y,e}function f(e,t,r){var i=r[0],a=r[1],o=r[2],s=Math.sqrt(i*i+a*a+o*o);if(Math.abs(s)<vg)return n(e);i*=s=1/s,a*=s,o*=s;var u=Math.sin(t),c=Math.cos(t),l=1-c;return e[0]=i*i*l+c,e[1]=a*i*l+o*u,e[2]=o*i*l-a*u,e[3]=0,e[4]=i*a*l-o*u,e[5]=a*a*l+c,e[6]=o*a*l+i*u,e[7]=0,e[8]=i*o*l+a*u,e[9]=a*o*l
139-i*u,e[10]=o*o*l+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}e.isIdentity=function(e,t){return o(e,a,void 0===t?vg:t)},e.hasNaN=function(e){for(var t=0;t<16;t++)if(isNaN(e[t]))return!0;return!1},e.areEqual=o,e.setValue=s,e.getValue=function(e,t,r){return e[4*r+t]},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t[r+4]=e[4],t[r+5]=e[5],t[r+6]=e[6],t[r+7]=e[7],t[r+8]=e[8],t[r+9]=e[9],t[r+10]=e[10],t[r+11]=e[11],t[r+12]=e[12],t[r+13]=e[13],t[r+14]=e[14],t[r+15]=e[15],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e[4]=t[r+4],e[5]=t[r+5],e[6]=t[r+6],e[7]=t[r+7],e[8]=t[r+8],e[9]=t[r+9],e[10]=t[r+10],e[11]=t[r+11],e[12]=t[r+12],e[13]=t[r+13],e[14]=t[r+14],e[15]=t[r+15],e},e.fromBasis=function(e,t,r,n){return i(e),s(e,0,0,t[0]),s(e,1,0,t[1]),s(e,2,0,t[2]),s(e,0,1,r[0]),s(e,1,1,r[1]),s(e,2,1,r[2]),s(e,0,2,n[0]),s(e,1,2,n[1]),s(e,2,2,n[2]),s(e,3,3,1),e},e.copy=u,e.clone=function(e){return u(t(),e)},e.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},e.getScaling=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e},e.getRotation=c,e.extractRotation=function(e,t){var r=1/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),n=1/Math.sqrt(t[4]*t[4]+t[5]*t[5]+t[6]*t[6]),i=1/Math.sqrt(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]);return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=0,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=0,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.transpose=function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},e.tryInvert=l,e.invert=function(e,t){return l(e,t)||console.warn("non-invertible matrix.",t),e},e.mul=d,e.mulOffset=function(e,t,r,n,i,a){var o=t[0+i],s=t[1+i],u=t[2+i],c=t[3+i],l=t[4+i],d=t[5+i],f=t[6+i],h=t[7+i],p=t[8+i],m=t[9+i],g=t[10+i],v=t[11+i],y=t[12+i],b=t[13+i],_=t[14+i],x=t[15+i],S=r[0+a],w=r[1+a],A=r[2+a],C=r[3+a];return e[0+n]=S*o+w*l+A*p+C*y,e[1+n]=S*s+w*d+A*m+C*b,e[2+n]=S*u+w*f+A*g+C*_,e[3+n]=S*c+w*h+A*v+C*x,S=r[4+a],w=r[5+a],A=r[6+a],C=r[7+a],e[4+n]=S*o+w*l+A*p+C*y,e[5+n]=S*s+w*d+A*m+C*b,e[6+n]=S*u+w*f+A*g+C*_,e[7+n]=S*c+w*h+A*v+C*x,S=r[8+a],w=r[9+a],A=r[10+a],C=r[11+a],e[8+n]=S*o+w*l+A*p+C*y,e[9+n]=S*s+w*d+A*m+C*b,e[10+n]=S*u+w*f+A*g+C*_,e[11+n]=S*c+w*h+A*v+C*x,S=r[12+a],w=r[13+a],A=r[14+a],C=r[15+a],e[12+n]=S*o+w*l+A*p+C*y,e[13+n]=S*s+w*d+A*m+C*b,e[14+n]=S*u+w*f+A*g+C*_,e[15+n]=S*c+w*h+A*v+C*x,e},e.mul3=function(e,t,r,n){return d(e,d(e,t,r),n)},e.translate=function(e,t,r){var n,i,a,o,s,u,c,l,d,f,h,p,m=r[0],g=r[1],v=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=t[8],f=t[9],h=t[10],p=t[11],e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=c,e[7]=l,e[8]=d,e[9]=f,e[10]=h,e[11]=p,e[12]=n*m+s*g+d*v+t[12],e[13]=i*m+u*g+f*v+t[13],e[14]=a*m+c*g+h*v+t[14],e[15]=o*m+l*g+p*v+t[15]),e},e.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},e.setTranslation=function(e,t){return e[12]=t[0],e[13]=t[1],e[14]=t[2],e},e.setAxes=function(e,t,r,n){return e[0]=r[0],e[4]=r[1],e[8]=r[2],e[1]=n[0],e[5]=n[1],e[9]=n[2],e[2]=t[0],e[6]=t[1],e[10]=t[2],e},e.rotate=function(e,t,n,i){var a=i[0],o=i[1],s=i[2],u=Math.sqrt(a*a+o*o+s*s);if(Math.abs(u)<vg)return r();a*=u=1/u,o*=u,s*=u;var c=Math.sin(n),l=Math.cos(n),d=1-l,f=t[0],h=t[1],p=t[2],m=t[3],g=t[4],v=t[5],y=t[6],b=t[7],_=t[8],x=t[9],S=t[10],w=t[11],A=a*a*d+l,C=o*a*d+s*c,T=s*a*d-o*c,P=a*o*d-s*c,E=o*o*d+l,M=s*o*d+a*c,k=a*s*d+o*c,I=o*s*d-a*c,D=s*s*d+l;return e[0]=f*A+g*C+_*T,e[1]=h*A+v*C+x*T,e[2]=p*A+y*C+S*T,e[3]=m*A+b*C+w*T,e[4]=f*P+g*E+_*M,e[5]=h*P+v*E+x*M,e[6]=p*P+y*E+S*M,e[7]=m*P+b*E+w*M,e[8]=f*k+g*I+_*D,e[9]=
139h*k+v*I+x*D,e[10]=p*k+y*I+S*D,e[11]=m*k+b*I+w*D,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e},e.fromRotation=f,e.scale=function(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.scaleUniformly=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromUniformScaling=function(e,t){return e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromMat3=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[4]=t[3],e[5]=t[4],e[6]=t[5],e[8]=t[6],e[9]=t[7],e[10]=t[8],e},e.compose=function(e,t,r,n){var i=r[0],a=r[1],o=r[2],s=r[3],u=i+i,c=a+a,l=o+o,d=i*u,f=i*c,h=i*l,p=a*c,m=a*l,g=o*l,v=s*u,y=s*c,b=s*l,_=n[0],x=n[1],S=n[2];return e[0]=(1-(p+g))*_,e[1]=(f+b)*_,e[2]=(h-y)*_,e[3]=0,e[4]=(f-b)*x,e[5]=(1-(d+g))*x,e[6]=(m+v)*x,e[7]=0,e[8]=(h+y)*S,e[9]=(m-v)*S,e[10]=(1-(d+p))*S,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e};var h=[0,0,0],p=t();function m(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],d=e[10],f=e[11],h=e[12],p=e[13],m=e[14],g=e[15];return(t*o-r*a)*(d*g-f*m)-(t*s-n*a)*(l*g-f*p)+(t*u-i*a)*(l*m-d*p)+(r*s-n*o)*(c*g-f*h)-(r*u-i*o)*(c*m-d*h)+(n*u-i*s)*(c*p-l*h)}e.decompose=function(e,t,r,n){var i=Cg.magnitude(Cg.set(h,e[0],e[1],e[2])),a=Cg.magnitude(Cg.set(h,e[4],e[5],e[6])),o=Cg.magnitude(Cg.set(h,e[8],e[9],e[10]));m(e)<0&&(i=-i),t[0]=e[12],t[1]=e[13],t[2]=e[14],u(p,e);var s=1/i,l=1/a,d=1/o;return p[0]*=s,p[1]*=s,p[2]*=s,p[4]*=l,p[5]*=l,p[6]*=l,p[8]*=d,p[9]*=d,p[10]*=d,c(r,p),n[0]=i,n[1]=a,n[2]=o,e},e.makeTable=function(e){for(var t="",r=0;r<4;r++){for(var n=0;n<4;n++)t+=e[4*n+r].toString(),n<3&&(t+=" ");r<3&&(t+="\n")}return t},e.determinant=m,e.isRotationAndTranslation=function(e,t){return function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],c=e[7],l=e[8],d=e[9],f=e[10],h=e[11];return!!(yg(e[15],1,t)&&yg(a,0,t)&&yg(c,0,t)&&yg(h,0,t)&&yg(Math.abs(r*(s*f-u*d)-n*(o*f-u*l)+i*(o*d-s*l)),1,t))}(e,void 0===t?vg:t)},e.isTranslationAndUniformScaling=function(e,t){return function(e,t){var r=e[0];return yg(e[1],0,t)&&yg(e[2],0,t)&&yg(e[3],0,t)&&yg(e[4],0,t)&&yg(e[5],r,t)&&yg(e[6],0,t)&&yg(e[7],0,t)&&yg(e[8],0,t)&&yg(e[9],0,t)&&yg(e[10],r,t)&&yg(e[11],0,t)&&yg(e[15],1,t)}(e,void 0===t?vg:t)},e.fromQuat=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,d=n*s,f=i*o,h=i*s,p=i*u,m=a*o,g=a*s,v=a*u;return e[0]=1-d-p,e[1]=l+v,e[2]=f-g,e[3]=0,e[4]=l-v,e[5]=1-c-p,e[6]=h+m,e[7]=0,e[8]=f+g,e[9]=h-m,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromEuler=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=Math.cos(n),s=Math.sin(n),u=Math.cos(i),c=Math.sin(i),l=Math.cos(a),d=Math.sin(a);if("XYZ"===r){var f=o*l,h=o*d,p=s*l,m=s*d;e[0]=u*l,e[4]=-u*d,e[8]=c,e[1]=h+p*c,e[5]=f-m*c,e[9]=-s*u,e[2]=m-f*c,e[6]=p+h*c,e[10]=o*u}else if("YXZ"===r){var g=u*l,v=u*d,y=c*l,b=c*d;e[0]=g+b*s,e[4]=y*s-v,e[8]=o*c,e[1]=o*d,e[5]=o*l,e[9]=-s,e[2]=v*s-y,e[6]=b+g*s,e[10]=o*u}else if("ZXY"===r)g=u*l,v=u*d,y=c*l,b=c*d,e[0]=g-b*s,e[4]=-o*d,e[8]=y+v*s,e[1]=v+y*s,e[5]=o*l,e[9]=b-g*s,e[2]=-o*c,e[6]=s,e[10]=o*u;else if("ZYX"===r)f=o*l,h=o*d,p=s*l,m=s*d,e[0]=u*l,e[4]=p*c-h,e[8]=f*c+m,e[1]=u*d,e[5]=m*c+f,e[9]=h*c-p,e[2]=-c,e[6]=s*u,e[10]=o*u;else if("YZX"===r){var _=o*u,x=o*c,S=s*u,w=s*c;e[0]=u*l,e[4]=w-_*d,e[8]=S*d+x,e[1]=d,e[5]=o*l,e[9]=-s*l,e[2]=-c*l,e[6]=x*d+S,e[10]=_-w*d}else"XZY"===r&&(_=o*u,x=o*c,S=s*u,w=s*c,e[0]=u*l,e[4]=-d,e[8]=c*l,e[1]=_*d+w,e[5]=o*l,e[9]=x*d-S,e[2]=S*d-x,e[6]=s*l,e[10]=w*d+_);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.perspective=function(e,t,r,n,i,a,o){var s=2*a/(r-t),u=2*a/(n-i),c=(r+t)/(r-t),l=(n+i)/(n-i),d=-(o+a)/(o-a),f=-2*o*a/(o-a);return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=d,e[11]=-1,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e},e.ortho=function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(n-i),c=1/(o-a),l=(r+t)*s,d=(n+i)*u,f=(o+a)*c;return e[0]=2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
139]=-2*c,e[11]=0,e[12]=-l,e[13]=-d,e[14]=-f,e[15]=1,e},e.lookAt=function(e,t,r,i){var a,o,s,u,c,l,d,f,h,p,m=t[0],g=t[1],v=t[2],y=i[0],b=i[1],_=i[2],x=r[0],S=r[1],w=r[2];return Math.abs(m-x)<vg&&Math.abs(g-S)<vg&&Math.abs(v-w)<vg?n(e):(d=m-x,f=g-S,h=v-w,a=b*(h*=p=1/Math.sqrt(d*d+f*f+h*h))-_*(f*=p),o=_*(d*=p)-y*h,s=y*f-b*d,(p=Math.sqrt(a*a+o*o+s*s))?(a*=p=1/p,o*=p,s*=p):(a=0,o=0,s=0),u=f*s-h*o,c=h*a-d*s,l=d*o-f*a,(p=Math.sqrt(u*u+c*c+l*l))?(u*=p=1/p,c*=p,l*=p):(u=0,c=0,l=0),e[0]=a,e[1]=u,e[2]=d,e[3]=0,e[4]=o,e[5]=c,e[6]=f,e[7]=0,e[8]=s,e[9]=l,e[10]=h,e[11]=0,e[12]=-(a*m+o*g+s*v),e[13]=-(u*m+c*g+l*v),e[14]=-(d*m+f*g+h*v),e[15]=1,e)},e.targetTo=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],d=a-r[1],f=o-r[2],h=l*l+d*d+f*f;h>0&&(l*=h=1/Math.sqrt(h),d*=h,f*=h);var p=u*f-c*d,m=c*l-s*f,g=s*d-u*l;return(h=p*p+m*m+g*g)>0&&(p*=h=1/Math.sqrt(h),m*=h,g*=h),e[0]=p,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-f*m,e[5]=f*p-l*g,e[6]=l*m-d*p,e[7]=0,e[8]=l,e[9]=d,e[10]=f,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e},e.fromPermutation=function(e,t){i(e);for(var r=0;r<4;r++)s(e,r,t[r],1);return e},e.getMaxScaleOnAxis=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))};var g=[1,0,0],v=[0,1,0],y=[0,0,1];e.rotX90=f(t(),Mg(90),g),e.rotX180=f(t(),Mg(180),g),e.rotY90=f(t(),Mg(90),v),e.rotY180=f(t(),Mg(180),v),e.rotY270=f(t(),Mg(270),v),e.rotZ90=f(t(),Mg(90),y),e.rotZ180=f(t(),Mg(180),y),e.rotXY90=d(t(),e.rotX90,e.rotY90),e.rotZY90=d(t(),e.rotZ90,e.rotY90),e.rotZYZ90=d(t(),e.rotZY90,e.rotZ90),e.rotZ90X180=d(t(),e.rotZ90,e.rotX180),e.rotY90Z180=d(t(),e.rotY90,e.rotZ180),e.id=r()})(Og||={}),function(e){function t(){var e=[.1,0,0,0,0,0,0,0,0];return e[0]=0,e}function r(){var e=t();return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function n(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}e.zero=t,e.identity=r,e.setIdentity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t[r+4]=e[4],t[r+5]=e[5],t[r+6]=e[6],t[r+7]=e[7],t[r+8]=e[8],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e[4]=t[r+4],e[5]=t[r+5],e[6]=t[r+6],e[7]=t[r+7],e[8]=t[r+8],e},e.fromColumns=function(e,t,r,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=r[0],e[4]=r[1],e[5]=r[2],e[6]=n[0],e[7]=n[1],e[8]=n[2],e},e.fromMat4=n,e.create=function(e,r,n,i,a,o,s,u,c){var l=t();return l[0]=e,l[1]=r,l[2]=n,l[3]=i,l[4]=a,l[5]=o,l[6]=s,l[7]=u,l[8]=c,l};var i=r();function a(e,t,r){for(var n=0;n<9;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function u(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],d=l*o-s*c,f=-l*a+s*u,h=c*a-o*u,p=r*d+n*f+i*h;return p?(p=1/p,e[0]=d*p,e[1]=(-l*n+i*c)*p,e[2]=(s*n-i*o)*p,e[3]=f*p,e[4]=(l*r-i*u)*p,e[5]=(-s*r+i*a)*p,e[6]=h*p,e[7]=(-c*r+n*u)*p,e[8]=(o*r-n*a)*p,e):(console.warn("non-invertible matrix.",t),e)}function c(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function l(e){return e[0]+e[4]+e[8]}function d(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function f(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}e.isIdentity=function(e,t){return a(e,i,void 0===t?vg:t)},e.hasNaN=function(e){for(var t=0;t<9;t++)if(isNaN(e[t]))return!0;return!1},e.clone=function(e){return o(t(),e)},e.areEqual=a,e.setValue=function(e,t,r,n){e[3*r+t]=n},e.getValue=function(e,t,r){return e[3*r+t]},e.copy=o,e.transpose=s,e.invert=u,e.symmtricFromUpper=function(e,t){return e===t?(e[3]=t[1],e[6]=t[2],e[7]=t[5]):(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[1],e[4]=t[4],e[5]=t[5],e[6]=t[2],e[7]=t[5],e[8]=t[8]),e},e.symmtricFromLower=function(e,t){return e===t?(e[1]=t[3],e[2]=t[6],e[5]=t[7]
139):(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[3],e[4]=t[4],e[5]=t[7],e[6]=t[6],e[7]=t[7],e[8]=t[8]),e},e.determinant=c,e.trace=l,e.sub=d,e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},e.mul=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=t[8],f=r[0],h=r[1],p=r[2],m=r[3],g=r[4],v=r[5],y=r[6],b=r[7],_=r[8];return e[0]=f*n+h*o+p*c,e[1]=f*i+h*s+p*l,e[2]=f*a+h*u+p*d,e[3]=m*n+g*o+v*c,e[4]=m*i+g*s+v*l,e[5]=m*a+g*u+v*d,e[6]=y*n+b*o+_*c,e[7]=y*i+b*s+_*l,e[8]=y*a+b*u+_*d,e},e.subScalar=function(e,t,r){return e[0]=t[0]-r,e[1]=t[1]-r,e[2]=t[2]-r,e[3]=t[3]-r,e[4]=t[4]-r,e[5]=t[5]-r,e[6]=t[6]-r,e[7]=t[7]-r,e[8]=t[8]-r,e},e.addScalar=function(e,t,r){return e[0]=t[0]+r,e[1]=t[1]+r,e[2]=t[2]+r,e[3]=t[3]+r,e[4]=t[4]+r,e[5]=t[5]+r,e[6]=t[6]+r,e[7]=t[7]+r,e[8]=t[8]+r,e},e.mulScalar=f;var h=Math.PI/3,p=t();e.symmetricEigenvalues=function(t,r){var n=r[1]*r[1]+r[2]*r[2]+r[5]*r[5];if(0===n)t[0]=r[0],t[1]=r[4],t[2]=r[8];else{var i=l(r)/3,a=r[0]-i,o=r[4]-i,s=r[8]-i,u=a*a+o*o+s*s+2*n,m=Math.sqrt(u/6);f(p,e.Identity,i),d(p,r,p),f(p,p,1/m);var g=c(p)/2,v=g<=-1?h:g>=1?0:Math.acos(g)/3;t[0]=i+2*m*Math.cos(v),t[2]=i+2*m*Math.cos(v+2*h),t[1]=3*i-t[0]-t[2]}return t};var m=[.1,0,0],g=[.1,0,0],v=[.1,0,0],y=[.1,0,0],b=[.1,0,0],_=[.1,0,0];e.eigenvector=function(e,t,r){Cg.set(m,t[0]-r,t[1],t[2]),Cg.set(g,t[1],t[4]-r,t[5]),Cg.set(v,t[2],t[5],t[8]-r),Cg.cross(y,m,g),Cg.cross(b,m,v),Cg.cross(_,g,v);var n=Cg.dot(y,y),i=Cg.dot(b,b),a=Cg.dot(_,_),o=n,s=0;return i>o&&(o=i,s=1),a>
139o&&(s=2),0===s?Cg.scale(e,y,1/Math.sqrt(n)):1===s?Cg.scale(e,b,1/Math.sqrt(i)):Cg.scale(e,_,1/Math.sqrt(a)),e},e.directionTransform=function(e,t){return n(e,t),u(e,e),s(e,e),e},e.Identity=r(),e.innerProduct=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]+e[4]*t[4]+e[5]*t[5]+e[6]*t[6]+e[7]*t[7]+e[8]*t[8]}}(Rg||={}),function(e){function t(){var e=[.1,0];return e[0]=0,e}e.zero=t,e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r},e.create=function(e,r){var n=t();return n[0]=e,n[1]=r,n},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},e.set=function(e,t,r){return e[0]=t,e[1]=r,e},e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},e.sub=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},e.mul=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e},e.div=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e},e.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},e.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},e.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},e.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},e.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n},e.magnitude=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},e.squaredMagnitude=function(e){var t=e[0],r=e[1];return t*t+r*r},e.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},e.areEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e.toString=function(e,t){return`[${e[0].toPrecision(t)} ${e[1].toPrecision(t)}}]`}}(Bg||={}),function(e){function t(){var e=[.1,0,0,0];return e[0]=0,e}function r(e,t){return e[0]=t.center[0],e[1]=t.center[1],e[2]=t.center[2],e[3]=t.radius,e}e.zero=t,e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},e.create=function(e,r,n,i){var a=t();return a[0]=e,a[1]=r,a[2]=n,a[3]=i,a},e.fromSphere=r,e.ofSphere=function(e){return r(t(),e)},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])||isNaN(e[3])},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e},e.toVec3Array=function(e,t,r){t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2]},e.fromVec3Array=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=0,e},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+a*a)},e.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[4]=t[4]*r,e},e.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},e.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},e.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},e.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return r*r+n*n+i*i+a*a},e.norm=function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)},e.squaredNorm=function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i},e.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e},e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=t[0],s=t[1],u=t[2],c=t[3];return Math.abs(r-o)<=vg*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=vg*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=vg*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=vg*Math.max(1,Math.abs(a),Math.abs(c))},e.toString=function(e,t){return`[${e[0].toPrecision(t)} ${e[1].toPrecision(t)} ${e[2].toPrecision(t)}  ${e[3].toPrecision(t)}]`}}(Ng||={}),function(e){function t(){var e=[.1,0,0,0];return e[0]=0,e}function r(){var e=t();return e[3]=1,e}function n(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function i(e,t,r,n){var i,a,o,s,u,c=t[0],l=t[1],d=t[2],f=t[3],h=r[0],p=r[1],m=r[2],g=r[3];return(a=c*h+l*p+d*m+f*g)<0&&(a=-a,h=-h,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*c+u*h,e[1]=s*l+u*p,e[2]=s*d+u*m,e[3]=s*f+u*g,e}function a(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>
139t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e}e.zero=t,e.identity=r,e.setIdentity=function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])||isNaN(e[3])},e.create=function(e,t,n,i){var a=r();return a[0]=e,a[1]=t,a[2]=n,a[3]=i,a},e.setAxisAngle=n,e.getAxisAngle=function(e,t){var r=2*Math.acos(t[3]),n=Math.sin(r/2);return 0===n?(e[0]=1,e[1]=0,e[2]=0):(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n),r},e.multiply=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e},e.rotateX=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e},e.rotateY=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e},e.rotateZ=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e},e.calculateW=function(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e},e.slerp=i,e.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e},e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.fromMat3=a,e.fromEuler=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=Math.cos(n/2),s=Math.cos(i/2),u=Math.cos(a/2),c=Math.sin(n/2),l=Math.sin(i/2),d=Math.sin(a/2);switch(r){case"XYZ":e[0]=c*s*u+o*l*d,e[1]=o*l*u-c*s*d,e[2]=o*s*d+c*l*u,e[3]=o*s*u-c*l*d;break;case"YXZ":e[0]=c*s*u+o*l*d,e[1]=o*l*u-c*s*d,e[2]=o*s*d-c*l*u,e[3]=o*s*u+c*l*d;break;case"ZXY":e[0]=c*s*u-o*l*d,e[1]=o*l*u+c*s*d,e[2]=o*s*d+c*l*u,e[3]=o*s*u-c*l*d;break;case"ZYX":e[0]=c*s*u-o*l*d,e[1]=o*l*u+c*s*d,e[2]=o*s*d-c*l*u,e[3]=o*s*u+c*l*d;break;case"YZX":e[0]=c*s*u+o*l*d,e[1]=o*l*u+c*s*d,e[2]=o*s*d-c*l*u,e[3]=o*s*u-c*l*d;break;case"XZY":e[0]=c*s*u-o*l*d,e[1]=o*l*u-c*s*d,e[2]=o*s*d+c*l*u,e[3]=o*s*u+c*l*d;break;default:Lg()}return e};var o=[0,0,0];function s(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o),e}e.fromUnitVec3=function(e,t,r){var n=Cg.dot(t,r)+1;return n<vg?(n=0,Math.abs(t[0])>Math.abs(t[2])?Cg.set(o,-t[1],t[0],0):Cg.set(o,0,-t[2],t[1])):Cg.cross(o,t,r),e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=n,s(e,e),e},e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=t[0],s=t[1],u=t[2],c=t[3];return Math.abs(r-o)<=vg*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=vg*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=vg*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=vg*Math.max(1,Math.abs(a),Math.abs(c))},e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},e.normalize=s;var u=[0,0,0],c=[1,0,0],l=[0,1,0];e.rotationTo=function(e,t,r){var i=Cg.dot(t,r);return i<-.999999?(Cg.cross(u,c,t),Cg.magnitude(u)<1e-6&&Cg.cross(u,l,t),Cg.normalize(u,u),n(e,u,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Cg.cross(u,t,r),e[0]=u[0],e[1]=u[1],e[2]=u[2],e[3]=1+i,s(e,e))};var d=t(),f=t();e.sqlerp=function(e,t,r,n,a,o){return i(d,t,a,o),i(f,r,n,o),i(e,d,f,2*o*(1-o)),e};var h=[0,0,0,0,0,0,0,0,0];e.setAxes=function(e,t,r,n){return h[0]=r[0],h[3]=r[1],h[6]=r[2],h[1]=n[0],h[4]=n[1],h[7]=n[2],h[2]=-t[0],h[5]=-t[1],h[8]=-t[2],s(e,a(e,h))},e.toString=function(e,t){return`[${e[0].toPrecision(t)} ${e[1].toPrecision(t)} ${e[2].toPrecision(t)}  ${e[3].toPrecision(t)}]`},e.Identity=r()}(Ug||={}),function(e){function t(e,t,i){var a=function(e,t,r){for(var n=[],i=0;i<t.length;i++)n[i]=t[t.length-i-1];var a=[1];for(i=1;i<e.length;i++)a[i]=e[n[i-1]];return{dimensions:e,axisOrderFastToSlow:n,axisOrderSlowToFast:t,accessDimensions:a,defaultCtor:r||Float64Array}}(e,t,i),o=r(a),s=o.get,u=o.set,c=o.add,l=o.dataOffset,d=o.getCoords;return{rank:e.length,dimensions:e,axisOrderSlowToFast:t,create:n(a),get:s,set:u,add:c,dataOffset:l,getCoords:d}}function r(e){var t=e.dimensions,r=e.axisOrderFastToSlow;switch(t.length){case 1:return{get:function(e,t){return e[t]},set:function(e,t,r){return e[t]=r},add:function(e,t,r){return e[t]+=r},dataOffset:function(e){return e},getCoords:function(e,t){return t[0]=e,t}};case 2:if(0===r[0]&&1===r[1]){var n=t[0];return{get:function(e,t,r){return e[r*n+t]},set:function(e,t,r,i){return e[r*n+t]=i},add:function(e,t,r,i){return e[r*n+t]+=i},dataOffset:function(e,t){return t*n+e},getCoords:function(e,t){return t[0]=e%n,t[1]=Math.floor(e/n),t}}}if(1===r[0]&&0===r[1]){var a=t[1];return{get:function(e,t,r){return e[t*a+r]}
139,set:function(e,t,r,n){return e[t*a+r]=n},add:function(e,t,r,n){return e[t*a+r]+=n},dataOffset:function(e,t){return e*a+t},getCoords:function(e,t){return t[0]=Math.floor(e/a),t[1]=e%a,t}}}throw Error("bad axis order");case 3:if(0===r[0]&&1===r[1]&&2===r[2]){var o=t[0],s=t[1],u=o*s;return{get:function(e,t,r,n){return e[t+r*o+n*u]},set:function(e,t,r,n,i){return e[t+r*o+n*u]=i},add:function(e,t,r,n,i){return e[t+r*o+n*u]+=i},dataOffset:function(e,t,r){return e+t*o+r*u},getCoords:function(e,t){var r=Math.floor(e/o);return t[0]=e%o,t[1]=r%s,t[2]=Math.floor(r/s),t}}}if(0===r[0]&&2===r[1]&&1===r[2]){var c=t[0],l=t[2],d=c*l;return{get:function(e,t,r,n){return e[t+n*c+r*d]},set:function(e,t,r,n,i){return e[t+n*c+r*d]=i},add:function(e,t,r,n,i){return e[t+n*c+r*d]+=i},dataOffset:function(e,t,r){return e+r*c+t*d},getCoords:function(e,t){var r=Math.floor(e/c);return t[0]=e%c,t[1]=Math.floor(r/l),t[2]=r%l,t}}}if(1===r[0]&&0===r[1]&&2===r[2]){var f=t[1],h=t[0],p=f*h;return{get:function(e,t,r,n){return e[r+t*f+n*p]},set:function(e,t,r,n,i){return e[r+t*f+n*p]=i},add:function(e,t,r,n,i){return e[r+t*f+n*p]+=i},dataOffset:function(e,t,r){return t+e*f+r*p},getCoords:function(e,t){var r=Math.floor(e/f);return t[0]=r%h,t[1]=e%f,t[2]=Math.floor(r/h),t}}}if(1===r[0]&&2===r[1]&&0===r[2]){var m=t[1],g=t[2],v=m*g;return{get:function(e,t,r,n){return e[r+n*m+t*v]},set:function(e,t,r,n,i){return e[r+n*m+t*v]=i},add:function(e,t,r,n,i){return e[r+n*m+t*v]+=i},dataOffset:function(e,t,r){return t+r*m+e*v},getCoords:function(e,t){var r=Math.floor(e/m);return t[0]=Math.floor(r/g),t[1]=e%m,t[2]=r%g,t}}}if(2===r[0]&&0===r[1]&&1===r[2]){var y=t[2],b=t[0],_=y*b;return{get:function(e,t,r,n){return e[n+t*y+r*_]},set:function(e,t,r,n,i){return e[n+t*y+r*_]=i},add:function(e,t,r,n,i){return e[n+t*y+r*_]+=i},dataOffset:function(e,t,r){return r+e*y+t*_},getCoords:function(e,t){var r=Math.floor(e/y);return t[0]=r%b,t[1]=Math.floor(r/b),t[2]=e%y,t}}}if(2===r[0]&&1===r[1]&&0===r[2]){var x=t[2],S=t[1],w=x*S;return{get:function(e,t,r,n){return e[n+r*x+t*w]},set:function(e,t,r,n,i){return e[n+r*x+t*w]=i},add:function(e,t,r,n,i){return e[n+r*x+t*w]+=i},dataOffset:function(e,t,r){return r+t*x+e*w},getCoords:function(e,t){var r=Math.floor(e/x);return t[0]=Math.floor(r/S),t[1]=r%S,t[2]=e%x,t}}}throw Error("bad axis order");default:return{get:function(t){return t[i(e,[...arguments].slice(1))]},set:function(t){var r=[...arguments].slice(1);return t[i(e,r)]=r[r.length-1]},add:function(t){var r=[...arguments].slice(1);return t[i(e,r)]+=r[r.length-1]},dataOffset:function(){return i(e,[...arguments])},getCoords:function(t,r){return function(e,t,r){for(var n=e.dimensions,i=e.axisOrderFastToSlow,a=n.length,o=t,s=0;s<a;s++){var u=n[i[s]];r[i[s]]=o%u,o=Math.floor(o/u)}return r[i[a+1]]=o,r}(e,t,r)}}}}function n(e){for(var t=e.dimensions,r=1,n=0,i=t.length;n<i;n++)r*=t[n];return function(t){return new(t||e.defaultCtor)(r)}}function i(e,t){for(var r=e.accessDimensions,n=e.axisOrderFastToSlow,i=r.length-1,a=r[i]*t[n[i]],o=i-1;o>=0;o--)a=(a+t[n[o]])*r[o];return a}function a(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=e[t[n]];return r}e.create=function(e,t){return{space:e,data:t}},e.Space=t,e.Data1=function(e){return e},e.Vector=function(e,r){return t([e],[0],r)},e.ColumnMajorMatrix=function(e,r,n){return t([e,r],[1,0],n)},e.RowMajorMatrix=function(e,r,n){return t([e,r],[0,1],n)},e.toMat4=function(e,t,r){if(2!==t.rank)throw Error("Invalid tensor rank");for(var n=Math.min(4,t.dimensions[0]),i=Math.min(4,t.dimensions[1]),a=0;a<n;a++)for(var o=0;o<i;o++)Og.setValue(e,a,o,t.get(r,a,o));return e},e.toMat3=function(e,t,r){if(2!==t.rank)throw Error("Invalid tensor rank");for(var n=Math.min(3,t.dimensions[0]),i=Math.min(3,t.dimensions[1]),a=0;a<n;a++)for(var o=0;o<i;o++)Rg.setValue(e,a,o,t.get(r,a,o));return e},e.toVec3=function(e,t,r){if(1!==t.rank)throw Error("Invalid tensor rank");for(var n=Math.min(3,t.dimensions[0]),i=0;i<n;i++)e[i]=r[i];return e},e.toVec4=function(e,t,r){if(1!==t.rank)throw Error("Invalid tensor rank");for(var n=Math.min(4,t.dimensions[0]),i=0;i<n;i++)e[i]=r[i];return e},e.areEqualExact=function(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0},e.invertAxisOrder=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[e.length-r-1];return t},e.convertToCanonicalAxisIndicesFastToSlow=function(e){for(var t=new Int32Array(e.length),r=0;r<e.length;r++)t[e[r]]=r;return function(e){return a(e,t)}},e.convertToCanonicalAxisIndicesSlowToFast=function(e){for(var t=new Int32Array(e.length),r=0;r<e.length;r++)t[e[e.length-r-1]]=r;return function(e){return a(e,t)}}}(Tg||={});var jg=Object.prototype.hasOwnProperty;function zg(e,t){for(var r=!1,n=0,i=Object.keys(t);n<i.length;n++){var a=i[n];if(jg.call(t,a)&&t[a]!==e[a]){r=!0;break}}return r?Object.assign({},e,t):e}function Gg(e,t){if(!e)return!t;if(!t)return!1;var r=Object.keys(e);if(Object.keys(t).length!==r.length)return!1;for(var n=0,i=r;n<i.length;n++){var a=i[n];
139if(!jg.call(e,a)||e[a]!==t[a])return!1}return!0}function Vg(e){if("object"!=typeof e||!e)return e;if(e instanceof Array){for(var t=[],r=0,n=e.length;r<n;r++)t[r]=Vg(e[r]);return t}if("object"==typeof e&&!("prototype"in e)){for(var i in t={},e)jg.call(e,i)&&(t[i]=Vg(e[i]));return t}throw Error(`Can't clone, type "${typeof e}" unsupported`)}function Hg(e,t){if(e)for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t(e[i],i)}}function qg(e,t){return void 0===t&&(t=" "),e.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g,`$1${t}$2`)}var Wg=function(e){return e.toUpperCase()};function Xg(e){return e.toLowerCase().replace(/^\w|\s\w/g,Wg)}function Yg(e){return Xg(qg(function(e){return e.replace(/_/g," ")}(function(e){return e.replace(/-/g," ")}(e))))}function Kg(e,t,r,n){var i=n.length;if(i>r-t)return!1;for(var a=0;a<i;a++)if(e.charCodeAt(t+a)!==n.charCodeAt(a))return!1;return!0}function Zg(e){return e.replace(/<\/?[^>]+>/g,"")}function Qg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jg(){return Jg.zero()}function ev(){return ev.zero()}function tv(e){return e}function rv(e,t,r,n){return{label:e,description:r,list:n,type:t}}function nv(e,t,r){var n={};for(var i in e){var a=e[i];a=tv.saturate(a,t),a=tv.darken(a,-r),n[i]=a}return n}(function(e){function t(){var e=[.1,0,0];return e[0]=0,e}function r(e,t){var r=t[0],n=t[1],i=t[2],a=Math.sqrt(n*n+i*i),o=(kg(Math.atan2(i,n))+360)%360;return 0===Math.round(1e4*a)&&(o=NaN),e[0]=o,e[1]=a,e[2]=r,e}function n(e,t,r){return e[0]=t[0]-o*r,e[1]=t[1],e[2]=t[2],e}e.zero=t,e.create=function(e,r,n){var i=t();return i[0]=e,i[1]=r,i[2]=n,i},e.set=function(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)},e.fromColor=function(e,t){var r=tv.toRgb(t),n=function(e,t,r){return[v((.4124564*(e=g(e))+.3575761*(t=g(t))+.1804375*(r=g(r)))/s),v((.2126729*e+.7151522*t+.072175*r)/u),v((.0193339*e+.119192*t+.9503041*r)/c)]}(r[0],r[1],r[2]),i=n[0],a=n[1],o=n[2],l=116*a-16;return e[0]=l<0?0:l,e[1]=500*(i-a),e[2]=200*(a-o),e},e.fromHcl=function(e,t){return ev.toLab(e,t)},e.toColor=function(e){var t=(e[0]+16)/116,r=isNaN(e[1])?t:t+e[1]/500,n=isNaN(e[2])?t:t-e[2]/200;t=u*m(t);var i=p(3.2404542*(r=s*m(r))-1.5371385*t-.4985314*(n=c*m(n))),a=p(-.969266*r+1.8760108*t+.041556*n),o=p(.0556434*r-.2040259*t+1.0572252*n);return tv.fromRgb(Math.round(bg(i,0,255)),Math.round(bg(a,0,255)),Math.round(bg(o,0,255)))},e.toHcl=r,e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.darken=n,e.lighten=function(e,t,r){return n(e,t,-r)};var i=[0,0,0];function a(e,t,n){return r(i,t),ev.toLab(e,ev.saturate(i,i,n))}e.saturate=a,e.desaturate=function(e,t,r){return a(e,t,-r)};var o=18,s=.95047,u=1,c=1.08883,l=.137931034,d=.206896552,f=.12841855,h=.008856452;function p(e){return 255*(e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)}function m(e){return e>d?e*e*e:f*(e-l)}function g(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function v(e){return e>h?e**(1/3):e/f+l}})(Jg||={}),function(e){function t(){var e=[.1,0,0];return e[0]=0,e}e.zero=t,e.create=function(e,r,n){var i=t();return i[0]=e,i[1]=r,i[2]=n,i},e.set=function(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e},e.hasHue=function(e){return!isNaN(e[0])};var r=[0,0,0];e.fromColor=function(e,t){return Jg.toHcl(e,Jg.fromColor(r,t))},e.fromLab=function(e,t){return Jg.toHcl(e,t)};var n=[0,0,0];function i(e,t){var r=t[0],n=t[1],i=t[2];return isNaN(r)&&(r=0),r=Mg(r),e[0]=i,e[1]=Math.cos(r)*n,e[2]=Math.sin(r)*n,e}function a(e,t,r){return e[0]=t[0],e[1]=Math.max(0,t[1]+u*r),e[2]=t[2],e}e.toColor=function(e){return Jg.toColor(i(n,e))},e.toLab=i,e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.saturate=a,e.desaturate=function(e,t,r){return a(e,t,-r)};var o=[0,0,0];function s(e,t,r){return i(o,t),Jg.toHcl(e,Jg.darken(o,o,r))}e.darken=s,e.lighten=function(e,t,r){return s(e,t,-r)};var u=18}(ev||={}),function(e){function t(e,t,r){return e<<16|t<<8|r}function r(e,t,r){return 255*e<<16|255*t<<8|255*r}function n(e){var t=e>>16&255;return t!==(e>>8&255)||t!==(255&e)}e.toStyle=function(e){return`rgb(${e>>16&255}, ${e>>8&255}, ${255&e})`},e.toHexStyle=function(e){return"#"+("000000"+e.toString(16)).slice(-6)},e.toHexString=function(e){return"0x"+("000000"+e.toString(16)).slice(-6)},e.toRgbString=function(t){return`RGB: ${e.toRgb(t).join(", ")}`},e.toRgb=function(e){return[e>>16&255,e>>8&255,255&e]},e.toRgbNormalized=function(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]},e.fromHexStyle=function(e){return parseInt(e.replace("#","0x"))},e.fromHexString=function(e){return parseInt(e)},e.fromRgb=t,e.fromNormalizedRgb=r,e.fromArray=function(e,r){return t(e[r],e[r+1],e[r+2])},e.fromNormalizedArray=function(e,t){return r(e[t],e[t+1],e[t+2])},e.toArray=function(e,t,r){return t[r]=e>>16&255,t[r+1]=e>>8&255,t[r+2]=255&e,t},e.toArrayNormalized=function(e,t,r){return t[r]=(e>>16&255)/255,t[r+1]=(e>>8&255)/255,t[r+2]=(255&e)/255,t},e.toVec3=function(e,t){return e[0]=t>>16&255,e[1]=t>>8&255,e[2]=255&t,e},e.toVec3Normalized=function(e,t){return e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e},e.interpolate=function(e,t,r){var n=e>>16&255,i=e>>8&255,a=255&e;return n+((t>>
13916&255)-n)*r<<16|i+((t>>8&255)-i)*r<<8|a+((255&t)-a)*r},e.hasHue=n;var i=[0,0,0];function a(e,t){return n(e)?(ev.fromColor(i,e),ev.toColor(ev.saturate(i,i,t))):e}e.saturate=a,e.desaturate=function(e,t){return a(e,-t)};var o=[0,0,0];function s(e,t){return Jg.fromColor(o,e),Jg.toColor(Jg.darken(o,o,t))}function u(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function c(e){return.2126*u((e>>16&255)/255)+.7152*u((e>>8&255)/255)+.0722*u((255&e)/255)}function l(e){return e<.04045?.0773993808*e:(.9478672986*e+.0521327014)**2.4}function d(e){return e<.0031308?12.92*e:1.055*e**.41666-.055}e.darken=s,e.lighten=function(e,t){return s(e,-t)},e.luminance=c,e.contrast=function(e,t){var r=c(e),n=c(t);return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},e.sRGBToLinear=function(e){return r(l((e>>16&255)/255),l((e>>8&255)/255),l((255&e)/255))},e.linearToSRGB=function(e){return r(d((e>>16&255)/255),d((e>>8&255)/255),d((255&e)/255))}}(tv||={});var iv,av={"orange-red":rv("Orange-Red","sequential","Orange-Red, sequential color scheme from ColorBrewer 2.0",[16775148,16705736,16635038,16628612,16551257,15689032,14102559,11730944,8323072]),"purple-blue":rv("Purple-Blue","sequential","Purple-Blue, sequential color scheme from ColorBrewer 2.0",[16775163,15525874,13685222,10927579,7645647,3576e3,356528,285325,145496]),"blue-purple":rv("Blue-Purple","sequential","Blue-Purple, sequential color scheme from ColorBrewer 2.0",[16252157,14740724,12571622,10403034,9213638,9202609,8929693,8458108,5046347]),oranges:rv("Oranges","sequential","",[16774635,16705230,16634018,16625259,16616764,15821075,14239745,10892803,8333060]),"blue-green":rv("Blue-Green","sequential","",[16252157,15070713,13429990,10082505,6734500,4304502,2329413,27948,17435]),"yellow-orange-brown":rv("Yellow-Orange-Brown","sequential","",[16777189,16775100,16704401,16696399,16685353,15495188,13388802,10040324,6694150]),"yellow-green":rv("Yellow-Green","sequential","",[16777189,16252089,14282915,11394446,7915129,4303709,2327619,26679,17705]),reds:rv("Reds","sequential","",[16774640,16703698,16563105,16552562,16476746,15678252,13309981,10817301,6750221]),"red-purple":rv("Red-Purple","sequential","",[16775155,16638173,16565696,16424885,16214177,14496919,11403646,7995767,4784234]),greens:rv("Greens","sequential","",[16252149,15070688,13101504,10607003,7652470,4303709,2329413,27948,17435]),"yellow-green-blue":rv("Yellow-Green-Blue","sequential","",[16777177,15595697,13101492,8375739,4306628,1937856,2252456,2438292,531800]),purples:rv("Purples","sequential","",[16579581,15724021,14342891,12369372,10394312,8420794,6967715,5515151,4128893]),"green-blue":rv("Green-Blue","sequential","",[16252144,14742491,13429701,11066805,8113348,5157843,2854078,551084,540801]),greys:rv("Greys","sequential","",[16777215,15790320,14277081,12434877,9868950,7566195,5395026,2434341,0]),"yellow-orange-red":rv("Yellow-Orange-Red","sequential","",[16777164,16772512,16701814,16691788,16616764,16535082,14883356,12386342,8388646]),"purple-red":rv("Purple-Red","sequential","",[16250105,15196655,13941210,13210823,14640560,15149450,13505110,9961539,6750239]),blues:rv("Blues","sequential","",[16251903,14609399,13032431,10406625,7057110,4362950,2191797,545180,536683]),"purple-blue-green":rv("Purple-Blue-Green","sequential","",[16775163,15524592,13685222,10927579,6793679,3576e3,164234,93273,83510]),spectral:rv("Spectral","diverging","",[10355010,13975119,16018755,16625249,16703627,16777151,15136152,11263396,6734501,3311805,6180770]),"red-yellow-green":rv("Red-Yellow-Green","diverging","",[10813478,14102567,16018755,16625249,16703627,16777151,14282635,10934634,6733155,1742928,26679]),"red-blue":rv("Red-Blue","diverging","",[6750239,11671595,14049357,16033154,16636871,16250871,13755888,9618910,4428739,2188972,340065]),"pink-yellow-green":rv("Pink-Yellow-Green","diverging","",[9306450,12917629,14579630,15840986,16638191,16250871,15136208,12116358,8371265,5083681,2581529]),"purple-green":rv("Purple-Green","diverging","",[4194379,7744131,10055851,12756431,15193320,16250871,14282963,10935200,5942881,1800247,17435]),"red-yellow-blue":rv("Red-Yellow-Blue","diverging","Red-Yellow-Blue, diverging color scheme from ColorBrewer 2.0",[10813478,14102567,16018755,16625249,16703632,16777151,14742520,11262441,7646673,4552116,3225237]),"brown-white-green":rv("Brown-White-Green","diverging","",[5517317,9195786,12550445,
13914664317,16181443,16119285,13101797,8441281,3512207,91742,15408]),"red-grey":rv("Red-Grey","diverging","",[6750239,11671595,14049357,16033154,16636871,16777215,14737632,12237498,8882055,5066061,1710618]),"orange-purple":rv("Orange-Purple","diverging","",[8338184,11753478,14713364,16627811,16703670,16250871,14211819,11709394,8418220,5515144,2949195]),"set-2":rv("Set-2","qualitative","",[6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),accent:rv("Accent","qualitative","",[8374655,12496596,16629894,16777113,3697840,15729279,12540695,6710886]),"set-1":rv("Set-1","qualitative","",[14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329]),"set-3":rv("Set-3","qualitative","",[9294791,16777139,12499674,16482418,8434131,16626786,11787881,16567781,14277081,12353725,13429701,16772463]),"dark-2":rv("Dark-2","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886]),paired:rv("Paired","qualitative","",[10931939,2062516,11722634,3383340,16489113,14883356,16629615,16744192,13284054,6962586,16777113,11622696]),"pastel-2":rv("Pastel-2","qualitative","",[11789005,16633260,13358568,16042724,15136201,16773806,15852236,13421772]),"pastel-1":rv("Pastel-1","qualitative","",[16495790,11783651,13429701,14601188,16701862,16777164,15063229,16636652,15921906]),"many-distinct":rv("Many-Distinct","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886,14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329,6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),magma:rv("Magma","sequential","Perceptually uniform shades of black-red-white",[4329332,4853881,5378684,5903742,6363263,6888576,7413633,7938689,8463745,8988801,9513600,10038655,10563454,11088508,11613562,12138360,12728949,13254258,13714030,14239338,14699366,15094114,15489119,15753309,16017499,16216411,16350045,16483424,16551523,16619368,16621934,16689780,16692091,16694402,16696969,16633746,16636058,16638371,16575148,16577461,16514239]),inferno:rv("Inferno","sequential","Perceptually uniform shades of black-red-yellow",[4721514,5246316,5771373,6296430,6821486,7346542,7871597,8396651,8921450,9446504,9971557,10496610,10956127,11481435,12006486,12466258,12926285,13386056,13780802,14241085,14570295,14965297,15229227,15558693,15757342,15956248,16154897,16288267,16421638,16489734,16492043,16494612,16496926,16368426,16305463,16111429,15982678,15853928,15856253,16119953,16580260]),plasma:rv("Plasma","sequential","Perceptually uniform shades of blue-red-yellow",[1771148,2426257,3081365,3671193,4195228,4784799,5308834,5833124,6357158,6815911,7340200,7864744,8324007,8783782,9309348,9769377,10164126,10624154,11018902,11413393,11808141,12137352,12466307,12795519,13124730,13453685,13717361,14046573,14309992,14573668,14837344,15035483,15299159,15497299,15695438,15893834,16091974,16224833,16357693,16425017,16557877,16625457,16627245,16629289,16631334,16567845,16438820,16310052,16115494,15921190,15726625]),viridis:rv("Viridis","sequential","Perceptually uniform shades of blue-green-yellow",[4524123,4656994,4658793,4726127,4727668,4663929,4599933,4535937,4406404,4276870,4081800,3952010,3822475,3627148,3497356,3302029,3172237,3042446,2912654,2782862,2652814,2523022,2393229,2328973,2198924,2069132,2004874,2005897,2007175,2139525,2337154,2666111,3060348,3520376,4045684,4570991,5227369,5883748,6605661,7392854,8180303,8967495,9819967,10672695,11525166,12443174,13295646,14148121,15000344,15852828,16639780]),cividis:rv("Cividis","sequential","Perceptually uniform shades of blue-green-yellow, should look effectively identical to colorblind and non-colorblind users",[11367,12400,537456,1455727,2046574,2571629,3031404,3425388,3754092,4148075,4476779,4805227,5133932,5396844,5725549,5988462,6317166,6580079,6843249,7171698,7434867,7697781,7960951,8289656,8618104,8881272,9209976,9538679,9867127,10195830,10524533,10853235,11181938,11510640,11839343,12168045,12497002,12891240,13219941,13548642,13943134,14271834,14666326,14995025,15389516,15718470,16112703,16507190,16639799]),twilight:rv("Twilight","sequential","Perceptually uniform shades of white-blue-black-red-white, cyclic",[14670305,14211037,13554648,12766675,11847630,10993866,10139847,9351365,8628419,8036290,7509952,7048895,6718653,6519739,6386105,6252470,6184114,6181293,6112935,6044831,5976470,5777291,5447293,5052270,4592479,4067665,3674181,3281211,3150646,3543352,4067644,4657728,5379141,6166345,6953549,7741007,8463184,9120336,9777743,10304079,10830671,11291984,11687762,12083541,12348505,12613471,12878439,13077872,13211771,13411209,13545111,13809830,14074293,14338756,14537169,14735067,14801121]),turbo:rv("Turbo","sequential","Improved (smooth) rainbow colormap for visualization",[4866485,4872413,4354034,3770361,3120629,2667241,2475736,2611140,3073454,3928216,5109892,6487408,8126047,9829201,11531332,13167162,14605618,15780908,16693543,16753699,16748063,16741916,16146200,15026195,13644558,12198408,10818563,9833728]),rainbow:rv("Rainbow","sequential","",[3367393,3516485,16383744,15501073,12526114]),"red-white-blue":rv("Red-White-Blue","diverging","",[12526114,16777215,3367393])},ov=Object.keys(av).map(function(e){return[e,av[e].label,Xg(av[e].type)]});function sv(e){return e in av?av[e]:(console.warn(`unknown color list named '${e}'`),av["red-yellow-blue"])}function uv(e,t,r){return e[t]-e[r]}function cv(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function lv(e,t,r,n){var i=r+n>>1;return t(e,r,n)>0?t(e,r,i)>0?t(e,i,n)>0?i:n:r:t(e,n,i)>0?t(e,i,r)>0?i:r:n}function dv(e,t,r){var n=e.cmp,i=e.swap,a=e.data,o=e.parts,s=t+1,u=r;
139for(i(a,t,lv(a,n,t,r));n(a,u,t)>0;)--u;for(var c=t+1;c<=u;c++){var l=n(a,c,t);if(l>0){for(i(a,c,u),--u;n(a,u,t)>0;)--u;c--}else 0===l&&(i(a,c,s),s++)}for(c=t;c<s;c++)i(a,c,t+u-c);o[0]=u-s+t+1,o[1]=u}function fv(e,t,r){for(var n=e.data,i=e.cmp,a=e.swap,o=t+1;o<=r;o++)for(var s=o-1;s>=t&&i(n,s,s+1)>0;)a(n,s,s+1),--s}function hv(e,t,r){for(var n=e.parts;t<r;){if(r-t<16)return void fv(e,t,r);dv(e,t,r);var i=n[0],a=n[1];i-t<r-a?(hv(e,t,i-1),t=a+1):(hv(e,a+1,r),r=i-1)}}function pv(e,t,r,n){var i=r+1,a=n;cv(e,r,lv(e,uv,r,n));for(var o=e[r];e[a]>o;)--a;for(var s=r+1;s<=a;s++){var u=e[s];if(u>o){for(cv(e,s,a),--a;e[a]>o;)--a;s--}else u===o&&(cv(e,s,i),++i)}for(s=r;s<i;s++)cv(e,s,r+a-s);t[0]=a-i+r+1,t[1]=a}function mv(e,t,r){for(var n=t+1;n<=r;n++){for(var i=e[n],a=n-1;a>=t&&e[a]>i;)e[a+1]=e[a],--a;e[a+1]=i}}function gv(e,t,r,n){for(;r<n;){if(n-r<16)return void mv(e,r,n);pv(e,t,r,n);var i=t[0],a=t[1];i-r<n-a?(gv(e,t,r,i-1),r=a+1):(gv(e,t,a+1,n),n=i-1)}}function vv(e,t){return void 0===t&&(t=uv),function(e,t,r,n){return void 0===n&&(n=uv),n===uv?gv(e,[0,0],0,r-1):hv({data:e,cmp:n,swap:cv,parts:[0,0]},0,r-1),e}(e,0,e.length,t)}function yv(e,t,r,n,i){return hv({data:e,cmp:n,swap:i,parts:[0,0]},t,r-1),e}function bv(e,t,r){return e[t].key<e[r].key?-1:1}function _v(e,t,r){var n=r&&r.start||0,i=r&&r.end||e.length;if(i-n<=0)throw Error("Can only bucket non-empty collections.");return function(e,t,r,n,i){for(var a=new Map,o=[],s=t(e[0]),u=!0,c=n;c<i;c++){var l=t(e[c]);if(a.has(l))a.get(l).count++,s!==l&&(u=!1);else{var d={key:l,count:1,offset:c};a.set(l,d),o[o.length]=d}s=l}var f=new Int32Array(o.length+1);f[o.length]=i;var h=!0;if(r){c=1;for(var p=o.length;c<p;c++)if(o[c-1].key>o[c].key){h=!1;break}}if(u&&h){for(c=0;c<o.length;c++)f[c]=o[c].offset;return f}r&&!h&&yv(o,0,o.length,bv,cv);var m=0;for(c=0;c<o.length;c++){var g=o[c];g.offset=m,m+=g.count}var v=new Int32Array(i-n);for(c=n;c<i;c++)l=t(e[c]),v[(d=a.get(l)).offset++]=e[c];for(c=0,p=v.length;c<p;c++)e[c+n]=v[c];for(f[0]=n,c=1;c<o.length;c++)f[c]=o[c-1].offset+n;return f}(e,t,!(!r||!r.sort),n,i)}ov.filter(function(e){return"diverging"===av[e[0]].type||"sequential"===av[e[0]].type}),ov.filter(function(e){return"qualitative"===av[e[0]].type}),function(e){function t(e){var t=e.growBy*e.elementSize;e.currentSize=t,e.currentIndex=0,e.currentChunk=new e.ctor(t),e.allocatedSize+=t,e.chunks[e.chunks.length]=e.currentChunk}function r(e,t){var r=e.ctor,n=e.chunks,i=e.currentIndex;if(!n.length)return new r(0);if(1===n.length&&(t||i===e.allocatedSize))return n[0];for(var a=0,o=0,s=n.length-1;o<s;o++)a+=n[o].length;var u=new r(a+=e.currentIndex),c=0;if(u.buffer)for(o=0,s=n.length-1;o<s;o++)u.set(n[o],c),c+=n[o].length;else for(o=0,s=n.length-1;o<s;o++){for(var l=n[o],d=0,f=l.length;d<f;d++)u[c+d]=l[d];c+=l.length}var h=n[n.length-1];if(u.buffer&&i>=e.currentSize)u.set(h,c);else for(d=0,f=h.length;d<f;d++)u[c+d]=h[d];return u}e.is=function(e){return e.creator&&e.chunkSize},e.add4=function(e,r,n,i,a){e.currentIndex>=e.currentSize&&t(e);var o=e.currentChunk,s=e.currentIndex;return o[s]=r,o[s+1]=n,o[s+2]=i,o[s+3]=a,e.currentIndex+=4,e.elementCount++},e.add3=function(e,r,n,i){e.currentIndex>=e.currentSize&&t(e);var a=e.currentChunk,o=e.currentIndex;return a[o]=r,a[o+1]=n,a[o+2]=i,e.currentIndex+=3,e.elementCount++},e.add2=function(e,r,n){e.currentIndex>=e.currentSize&&t(e);var i=e.currentChunk,a=e.currentIndex;return i[a]=r,i[a+1]=n,e.currentIndex+=2,e.elementCount++},e.add=function(e,r){return e.currentIndex>=e.currentSize&&t(e),e.currentChunk[e.currentIndex]=r,e.currentIndex+=1,e.elementCount++},e.addRepeat=function(e,r,n){for(var i=0;i<r;i++)e.currentIndex>=e.currentSize&&t(e),e.currentChunk[e.currentIndex++]=n,e.elementCount++;return e.elementCount},e.addMany=function(e,r){for(var n=e.elementSize,i=0,a=r.length;i<a;i+=n){e.currentIndex>=e.currentSize&&t(e);for(var o=e.currentChunk,s=0;s<n;s++)o[e.currentIndex++]=r[i+s];e.elementCount++}return e.elementCount},e.compact=function(e,t){return void 0===t&&(t=!1),r(e,t)},e._compact=r,e.create=function(e,t,r,n){var i={ctor:e,elementSize:t,growBy:Math.max(1,Math.ceil(r)),allocatedSize:0,elementCount:0,currentSize:0,currentChunk:void 0,currentIndex:0,chunks:[]};if(void 0===n)return i;if("number"==typeof n)return i.currentChunk=new e(n*t),i.allocatedSize=n*t,
139i.currentSize=i.currentChunk.length,i.chunks[0]=i.currentChunk,i;var a=n;if(a.length%t!=0)throw Error("initialChunk length must be a multiple of the element size.");return i.currentChunk=a,i.allocatedSize=a.length,i.currentSize=a.length,i.chunks[0]=a,i}}(iv||={});var xv,Sv,wv,Av=function(){function e(e,t){this.getHash=e,this.areEqual=t,this.id=0,this.byHash=new Map,this.groups=[]}return e.prototype.createGroup=function(e,t){var r=this.id++,n=[e];return this.groups[r]=n,{id:r,keys:n,value:t}},e.prototype.add=function(e,t){var r=this.getHash(t);if(this.byHash.has(r)){for(var n=this.byHash.get(r),i=0,a=n.length;i<a;i++){var o=n[i];if(this.areEqual(t,o.value))return o.keys[o.keys.length]=e,o.value}var s=this.createGroup(e,t);return n[n.length]=s,s.value}return s=this.createGroup(e,t),this.byHash.set(r,[s]),s.value},e}();function Cv(e){var t=e^e>>4;return(t=(3735928559^t)+(t<<5))^t>>11}function Tv(e,t){var r=23;return r=31*(r=31*r+e|0)+t|0,(r=(3735928559^(r^=r>>4))+(r<<5))^r>>11}function Pv(e){for(var t=0,r=0,n=e.length;r<n;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return t}function Ev(e,t){return(e+t)*(e+t+1)/2+t}function Mv(e,t){return e<t?Ev(e,t):Ev(t,e)}function kv(e,t){var r=Math.floor((Math.sqrt(8*t+1)-1)/2),n=t-(r*r+r)/2;return e[0]=r-n,e[1]=n,e}function Iv(e){for(var t=2166136261,r=0,n=e.length;r<n;++r)t^=e[r],t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function Dv(e,t){return{start:t&&void 0!==t.start?Math.max(Math.min(t.start,e-1),0):0,end:t&&void 0!==t.end?Math.min(t.end,e):e}}function Ov(e,t){var r=t&&void 0!==t.array?t.array:Array,n=Dv(e,t),i=n.start,a=n.end;return{array:new r(a-i),start:i,end:a}}function Rv(e,t,r){var n=Ov(e,r);return function(e,t,r){for(var n=0,i=t.length;n<i;n++)t[n]=e(r+n);return t}(t,n.array,n.start)}function Bv(e){return!!e.buffer&&"number"==typeof e.byteLength&&"number"==typeof e.BYTES_PER_ELEMENT}function Nv(e,t){var r=e.constructor,n=e.buffer,i=e.length,a=e.byteOffset,o=e.BYTES_PER_ELEMENT,s=Dv(i,t),u=s.start,c=s.end;return 0===u&&c===i?e:new r(n,a+o*u,Math.min(i,c-u))}function Fv(e,t,r){for(;t<r&&32===e.charCodeAt(t);)t++;return Lv(e,t,r)}function Lv(e,t,r){var n=t,i=0,a=1;for(45===e.charCodeAt(n)?(a=-1,++n):43===e.charCodeAt(n)&&++n;n<r;n++){var o=e.charCodeAt(n)-48;if(o>9||o<0)return a*i|0;i=10*i+o|0}return a*i}function $v(e,t,r,n){return 43===t.charCodeAt(r)&&r++,e*10**Lv(t,r,n)}function Uv(e,t,r){var n=t,i=1,a=0,o=0,s=1;for(45===e.charCodeAt(n)?(i=-1,++n):43===e.charCodeAt(n)&&++n;n<r;){var u=e.charCodeAt(n)-48;if(!(u>=0&&u<10)){if(-2===u){for(++n;n<r;){if(!((u=e.charCodeAt(n)-48)>=0&&u<10))return 53===u||21===u?$v(i*(a+o/s),e,n+1,r):i*(a+o/s);o=10*o+u,s*=10,++n}return i*(a+o/s)}if(53===u||21===u)return $v(i*a,e,n+1,r);break}a=10*a+u,++n}return i*a}function jv(e,t,r,n){return{schema:r,__array:void 0,isDefined:0===n,rowCount:t,value:function(t){return e},valueKind:function(e){return n},toArray:function(r){for(var n=Ov(t,r).array,i=0,a=n.length;i<a;i++)n[i]=e;return n},areValuesEqual:function(e,t){return!0}}}function zv(e){var t=e.value,r=e.valueKind,n=e.areValuesEqual,i=e.rowCount;return{schema:e.schema,__array:void 0,isDefined:!0,rowCount:i,value:t,valueKind:r||function(e){return 0},toArray:function(e){for(var r=Ov(i,e),n=r.array,a=r.start,o=0,s=n.length;o<s;o++)n[o]=t(o+a);return n},areValuesEqual:n||function(e,r){return t(e)===t(r)}}}function Gv(e){var t=e.array,r=e.schema,n=e.valueKind,i=t.length,a=r.T,o="str"===r.valueType?"lowercase"===r.transform?function(e){var r=t[e];return"string"==typeof r?r.toLowerCase():`${r??a}`.toLowerCase()}:"uppercase"===r.transform?function(e){var r=t[e];return"string"==typeof r?r.toUpperCase():`${r??a}`.toUpperCase()}:function(e){var r=t[e];return"string"==typeof r?r:`${r??a}`}:function(e){return t[e]},s=Bv(t);return{schema:r,__array:t,isDefined:!0,rowCount:i,value:o,valueKind:n||function(e){return 0},toArray:"str"===r.valueType?"lowercase"===r.transform?function(e){for(var r=Dv(i,e),n=r.start,o=r.end,s=new(e&&void 0!==e.array?e.array:t.constructor)(o-n),u=0,c=o-n;u<c;u++){var l=t[n+u];s[u]="string"==typeof l?l.toLowerCase():`${l??a}`.toLowerCase()}return s}:"uppercase"===r.transform?function(e){for(var r=Dv(i,e),n=r.start,o=r.end,s=new(e&&void 0!==e.array?e.array:t.constructor)(o-n),u=0,c=o-n;u<c;u++){var l=t[n+u];s[u]="string"==typeof l?l.toUpperCase():`${l??a}`.toUpperCase()}return s}:function(e){for(var r=Dv(i,e),n=r.start,o=r.end,s=new(e&&void 0!==e.array?e.array:t.constructor)(o-n),u=0,c=o-n;u<c;u++){var l=t[n+u];s[u]="string"==typeof l?l:`${l??a}`}return s}:s?function(e){return Nv(t,e)}:function(e){var r=Dv(i,e),n=r.start,a=r.end;if(0===n&&a===t.length)return t;for(var o=new(e&&void 0!==e.array?e.array:t.constructor)(a-n),s=0,u=a-n;s<u;s++)o[s]=t[n+s];return o},areValuesEqual:function(e,r){return t[e]===t[r]}}}function Vv(e,t){for(var r=0,n=e.length;r<n;r++)if(t(e[r]))return e[r]}function Hv(e){if(Array.from)return Array.from(e);for(var t=[];;){var r=e.next(),n=r.done,i=r.value;if(n)break;t[t.length]=i}return t}function qv(e,t,r){for(var n=t-e+1,i=r?new r(n):new Int32Array(n),a=0;a<n;a++)i[a]=a+e;return i}function Wv(e,t){for(var r=new(function(e){var t=e.constructor;if(!t)throw Error("data does not define a constructor and it should");return t}(e))(t.length),n=0,i=t.length;n<i;n++)r[n]=e[t[n]];return r}function Xv(e,t,r){for(var n=0,i=r.length;n<i;n++){var a=r.charCodeAt(n);if(a<128)e[t++]=a>>>0&127;else if(a<2048)e[t++]=a>>>6&31|192,e[t++]=a>>>0&63|128;
139else if(a<65536)e[t++]=a>>>12&15|224,e[t++]=a>>>6&63|128,e[t++]=a>>>0&63|128;else{if(!(a<1114112))throw Error("bad codepoint "+a);e[t++]=a>>>18&7|240,e[t++]=a>>>12&63|128,e[t++]=a>>>6&63|128,e[t++]=a>>>0&63|128}}}(function(e){var t;function r(e,t){return jv(t.T,e,t,1)}function n(e){return zv(e)}(function(e){function t(t,r){return void 0===r&&(r=e.float),{"@type":"tensor",T:t.create(),space:t,valueType:"tensor",baseType:r}}e.str={"@type":"str",T:"",valueType:"str"},e.ustr={"@type":"str",T:"",valueType:"str",transform:"uppercase"},e.lstr={"@type":"str",T:"",valueType:"str",transform:"lowercase"},e.int={"@type":"int",T:0,valueType:"int"},e.coord={"@type":"coord",T:0,valueType:"float"},e.float={"@type":"float",T:0,valueType:"float"},e.Str=function(e){return{"@type":"str",T:e?.defaultValue??"",transform:e?.transform,valueType:"str"}},e.Int=function(e){return void 0===e&&(e=0),{"@type":"int",T:e,valueType:"int"}},e.Float=function(e){return void 0===e&&(e=0),{"@type":"float",T:e,valueType:"float"}},e.Tensor=t,e.Vector=function(r,n){return void 0===n&&(n=e.float),t(Tg.Vector(r,"int"===n["@type"]?Int32Array:Float64Array),n)},e.Matrix=function(r,n,i){return void 0===i&&(i=e.float),t(Tg.ColumnMajorMatrix(r,n,"int"===i["@type"]?Int32Array:Float64Array),i)},e.Aliased=function(e){return e},e.List=function(e,t,r){return void 0===r&&(r=[]),{"@type":"list",T:r,separator:e,itemParse:t,valueType:"list"}}})(t=e.Schema||={}),e.is=function(e){return!!e&&!!e.schema&&!!e.value},e.ValueKind={Present:0,NotPresent:1,Unknown:2},e.Undefined=r,e.ofConst=function(e,t,r){return jv(e,t,r,0)},e.ofLambda=n,e.range=function(e,r){return n({value:function(t){return t+e},rowCount:Math.max(r-e+1,0),schema:t.int})},e.ofArray=function(e){return Gv(e)},e.ofIntArray=function(e){return Gv({array:e,schema:t.int})},e.ofFloatArray=function(e){return Gv({array:e,schema:t.float})},e.ofStringArray=function(e){return Gv({array:e,schema:t.str})},e.ofStringAliasArray=function(e){return Gv({array:e,schema:t.Aliased(t.str)})},e.ofStringListArray=function(e,r){return void 0===r&&(r=","),Gv({array:e,schema:t.List(r,function(e){return e})})},e.ofIntTokens=function(e){var r=e.count,n=e.data,i=e.indices;return zv({value:function(e){return Lv(n,i[2*e],i[2*e+1])||0},rowCount:r,schema:t.int})},e.ofFloatTokens=function(e){var r=e.count,n=e.data,i=e.indices;return zv({value:function(e){return Uv(n,i[2*e],i[2*e+1])||0},rowCount:r,schema:t.float})},e.ofStringTokens=function(e){var r=e.count,n=e.data,i=e.indices;return zv({value:function(e){var t=n.substring(i[2*e],i[2*e+1]);return"."===t||"?"===t?"":t},rowCount:r,schema:t.str})},e.window=function(e,t,r){return function(e,t,r){return e.isDefined?0===t&&r===e.rowCount?e:e.__array&&Bv(e.__array)?function(e,t,r){var n=Nv(e.__array,{start:t,end:r}),i=e.valueKind;return Gv({array:n,schema:e.schema,valueKind:function(e){return i(t+e)}})}(e,t,r):function(e,t,r){var n=e.value,i=e.valueKind,a=e.areValuesEqual,o=0===t?n:function(e){return n(e+t)},s=r-t;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:s,value:o,valueKind:0===t?i:function(e){return i(e+t)},toArray:function(e){for(var r=Ov(s,e).array,i=0,a=r.length;i<a;i++)r[i]=n(i+t);return r},areValuesEqual:0===t?a:function(e,r){return a(e+t,r+t)}}}(e,t,r):xv.Undefined(r-t,e.schema)}(e,t,r)},e.view=function(e,t,r){return void 0===r&&(r=!0),function(e,t,r){return 0===e.rowCount||r&&function(e,t){if(e.length!==t)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r]!==r)return!1;return!0}(t,e.rowCount)?e:e.__array&&typeof e.value(0)==typeof e.__array[0]?function(e,t){for(var r=e.__array,n=new r.constructor(t.length),i=0,a=t.length;i<a;i++)n[i]=r[t[i]];var o=e.valueKind;return Gv({array:n,schema:e.schema,valueKind:function(e){return o(t[e])}})}(e,t):function(e,t){var r=e.value,n=e.valueKind,i=e.areValuesEqual,a=t.length;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:a,value:function(e){return r(t[e])},valueKind:function(e){return n(t[e])},toArray:function(e){for(var n=Ov(a,e).array,i=0,o=n.length;i<o;i++)n[i]=r(t[i]);return n},areValuesEqual:function(e,r){return i(t[e],t[r])}}}(e,t)}(e,t,r)},e.createFirstIndexMap=function(e){return function(e){for(var t=new Map,r=0,n=e.rowCount;r<n;r++){var i=e.value(r);t.has(i)||t.set(e.value(r),r)}return t}(e)},e.createIndexer=function(e){return function(e){for(var t=new Map,r=0,n=e.rowCount;r<n;r++){var i=e.value(r);t.has(i)||t.set(e.value(r),r)}return function(e){return t.has(e)?t.get(e):-1}}(e)},e.mapToArray=function(e,t,r){return function(e,t,r){for(var n=new r(e.rowCount),i=0,a=e.rowCount;i<a;i++)n[i]=t(e.value(i));return n}(e,t,r||Array)},e.areEqual=function(e,t){return function(e,t){return e===t||e.rowCount===t.rowCount&&e.isDefined===t.isDefined&&e.schema.valueType===t.schema.valueType&&(e.__array&&t.__array?function(e,t){for(var r=e.__array,n=t.__array,i=0,a=e.rowCount;i<a;i++)if(r[i]!==n[i])return!1;return!0}(e,t):function(e,t){for(var r=e.value,n=t.value,i=0,a=e.rowCount;i<a;i++)if(r(i)!==n(i))return!1;return!0}(e,t))}(e,t)},e.indicesOf=function(e,t){return function(e,t){for(var r=[],n=e.value,i=0,a=e.rowCount;i<a;i++)t(n(i))&&(r[r.length]=i);return r}(e,t)},e.asArrayColumn=function(e,t){return e.__array?e:e.isDefined?Gv({array:e.toArray({array:t}),schema:e.schema,valueKind:e.valueKind}):r(e.rowCount,e.schema)},e.copyToArray=function(e,t,r){if(void 0===r&&(r=0),e.isDefined){var n=e.__array;if(n)for(var i=0,a=n.length;i<a;i++)t[r+i]=n[i];else for(i=0,a=e.rowCount;i<a;i++)t[r+i]=e.value(i)}},e.isIdentity=function(e){for(var t=0,r=e.rowCount;t<r;t++)if(t!==e.value(t))return!1;return!0}})(xv||={}),function(e){function t(e,t,r){var n=Object.create(null),i=Object.keys(t);n._rowCount=r.length,n._columns=i,n._schema=t;for(var a=0,o=i;a<o.length;a++){var s=o[a];n[s]=xv.view(e[s],r)}return n}function r(e,t){for(var r=Object.create(null),n=e._columns,i=0;i<n.length;i++){var a=n[i];r[a]=e[a].value(t)}return r}e.is=function(e){return e&&"number"==typeof e._rowCount&&!!e._columns&&!!e._schema},e.pickColumns=function(e,t,r){void 0===r&&(r={});var n=Object.create(null),i=Object.keys(e);n._rowCount=t._rowCount,n._columns=i,n._schema=e;for(var a=0,o=i;a<o.length;a++){var s=o[a];if(t[s])n[s]=t[s];else{if(!r[s])throw Error(`Cannot find column '${s}'.`);n[s]=r[s]}}return n},e.ofColumns=function(e,t){var r=Object.keys(t),n=t[r[0]].rowCount;return Ac({_rowCount:n,_columns:r,_schema:e},t)}
139,e.ofPartialColumns=function(e,t,r){var n=Object.create(null),i=Object.keys(e);n._rowCount=r,n._columns=i,n._schema=e;for(var a=0,o=i;a<o.length;a++){var s=o[a];n[s]=s in t?t[s]:xv.Undefined(r,e[s])}return n},e.ofUndefinedColumns=function(e,t){var r=Object.create(null),n=Object.keys(e);r._rowCount=t,r._columns=n,r._schema=e;for(var i=0,a=n;i<a.length;i++){var o=a[i];r[o]=xv.Undefined(t,e[o])}return r},e.ofRows=function(e,t){var r=Object.create(null),n=t.length,i=Object.keys(e);r._rowCount=n,r._columns=i,r._schema=e;for(var a=function(i){r[i]=xv.ofLambda({rowCount:n,schema:e[i],value:function(e){return t[e][i]},valueKind:function(e){return+(void 0===t[e][i])}})},o=0,s=i;o<s.length;o++)a(s[o]);return r},e.ofArrays=function(e,t){var r=Object.create(null),n=Object.keys(e);r._rowCount=0,r._columns=n,r._schema=e;for(var i=0,a=n;i<a.length;i++){var o=a[i];void 0===t[o]?r[o]=xv.Undefined(r._rowCount,e[o]):(r[o]=xv.ofArray({array:t[o],schema:e[o]}),r._rowCount=t[o]?.length)}return r},e.view=t,e.pick=function(e,r,n){for(var i=[],a=0,o=e._rowCount;a<o;++a)n(a)&&i.push(a);return t(e,r,i)},e.window=function(e,t,r,n){if(0===r&&n===e._rowCount)return e;var i=Object.create(null),a=Object.keys(t);i._rowCount=n-r,i._columns=a,i._schema=t;for(var o=0,s=a;o<s.length;o++){var u=s[o];i[u]=xv.window(e[u],r,n)}return i},e.concat=function(e,t){var r=Object.create(null),n=Object.keys(t);r._rowCount=0;for(var i=0,a=e;i<a.length;i++){var o=a[i];r._rowCount+=o._rowCount}for(var s={},u=0,c=n;u<c.length;u++)s[c[u]]=Array(r._rowCount);r._columns=n,r._schema=t;for(var l=0,d=0,f=e;d<f.length;d++){o=f[d];for(var h=0,p=n;h<p.length;h++){var m=p[h];xv.copyToArray(o[m],s[m],l)}l+=o._rowCount}for(var g=0,v=n;g<v.length;g++)r[m=v[g]]=xv.ofArray({array:s[m],schema:t[m]});return r},e.columnToArray=function(e,t,r){e[t]=xv.asArrayColumn(e[t],r)},e.sort=function(e,t){for(var r=new Int32Array(e._rowCount),n=0,i=r.length;n<i;n++)r[n]=n;vv(r,function(e,r,n){return t(r,n)});var a=!0;for(n=0,i=r.length;n<i;n++)if(r[n]!==n){a=!1;break}if(a)return e;var o=Object.create(null);o._rowCount=e._rowCount,o._columns=e._columns,o._schema=e._schema;for(var s=0,u=e._columns;s<u.length;s++){var c=u[s];o[c]=xv.view(e[c],r,!1)}return o},e.areEqual=function(e,t){if(e._rowCount!==t._rowCount||e._columns.length!==t._columns.length)return!1;for(var r=0,n=e._columns;r<n.length;r++)if(!t[o=n[r]])return!1;for(var i=0,a=e._columns;i<a.length;i++){var o=a[i];if(!xv.areEqual(e[o],t[o]))return!1}return!0},e.getRow=r,e.pickRow=function(e,t){for(var n=0,i=e._rowCount;n<i;++n)if(t(n))return r(e,n)},e.getRows=function(e){for(var t=[],n=e._rowCount,i=0;i<n;i++)t[i]=r(e,i);return t},e.toArrays=function(e){for(var t={},r=e._columns,n=0;n<r.length;n++){var i=r[n];t[i]=e[i].toArray()}return t},e.formatToString=function(e){var t=wd.create(),r=e._columns,n=e._rowCount,i=1;wd.write(t,"|");for(var a=0;a<r.length;a++)wd.write(t,r[a]),wd.write(t,"|"),i+=r[a].length+1;wd.newline(t),wd.write(t,Array(i+1).join("-")),wd.newline(t);for(var o=0;o<n;o++){for(wd.write(t,"|"),a=0;a<r.length;a++){var s=e[r[a]];0===s.valueKind(o)?(wd.write(t,s.value(o)),wd.write(t,"|")):wd.write(t,".|")}wd.newline(t)}return wd.getString(t)}}(Sv||={}),function(e){e.ofTables=function(e,t,r){var n=Object.keys(r),i=Object.create(null),a=[];i._name=e,i._tableNames=a,i._schema=t;for(var o=0,s=n;o<s.length;o++){var u=s[o];Sv.is(r[u])&&(i[u]=r[u],a[a.length]=u)}return i},e.getTablesAsRows=function(e){for(var t={},r=0,n=e._tableNames;r<n.length;r++){var i=n[r];t[i]=Sv.getRows(e[i])}return t}}(wv||={});var Yv=function(){for(var e=[],t=0;t<1024;t++)e[t]=String.fromCharCode(t);return e}();function Kv(e){throw Error(e)}var Zv=typeof TextDecoder<"u"?new TextDecoder:void 0;function Qv(e,t,r){if(Zv){var n=t||r!==e.length?e.subarray(t,t+r):e;return Zv.decode(n)}return function(e,t,r){for(var n=Yv,i=void 0,a=0,o=[],s=t,u=t+r;s<u;s++){var c=e[s];128&c?192==(224&c)?o[a++]=n[(15&c)<<6|63&e[++s]]:224==(240&c)?o[a++]=String.fromCharCode((15&c)<<12|(63&e[++s])<<6|63&e[++s]):240==(248&c)?o[a++]=String.fromCharCode((7&c)<<18|(63&e[++s])<<12|(63&e[++s])<<6|63&e[++s]):Kv("Invalid byte "+c.toString(16)):o[a++]=n[c],512===a&&((i||=[])[i.length]=o.join(""),a=0)}return i?(a>0&&(i[i.length]=o.slice(0,a).join("")),i.join("")):o.slice(0,a).join("")}(e,t,r)}function Jv(e){for(var t=0,r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);i<128?t+=1:i<2048?t+=2:i<65536?t+=3:i<1114112?t+=4:Kv("bad codepoint "+i)}return t}var ey=typeof setImmediate<"u"?typeof window<"u"?{setImmediate:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(t=window).setImmediate.apply(t,kc([e],r,!1))},clearImmediate:function(e){return window.clearImmediate(e)}}:{setImmediate,clearImmediate}:function(){var e,t,n,i,a,o,s,u=(e=typeof window<"u"&&window,t=typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&self,n=typeof r.g<"u"&&r.g,e||n||t),c={},l=typeof document<"u"?document:void 0,d=1;function f(e){delete c[e]}function h(e){var t=c[e];f(e),function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}return typeof process<"u"&&"[object process]"==={}.toString.call(process)?i=function(e){process.nextTick(function(){h(e)})}:function(){if(u&&u.postMessage&&!u.importScripts){var e=!0,t=u.onmessage;return u.onmessage=function(){e=!1},u.postMessage("","*"),u.onmessage=t,e}}()?(o="setImmediate$"+Math.random()+"$",s=function(e){e.source===u&&"string"==typeof e.data&&0===e.data.indexOf(o)&&h(+e.data.slice(o.length))},window.addEventListener?window.addEventListener("message",s,!1):window.attachEvent("onmessage",s),i=function(e){window.postMessage(o+e,"*")}):typeof MessageChannel<"u"?((a=new MessageChannel).port1.onmessage=function(e){h(e.data)},i=function(e){a.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?function(){var e=l.documentElement;i=function(t){var r=l.createElement("script");r.onreadystatechange=function(){h(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():i=function(e){setTimeout(h,0,e)},{setImmediate:function(e){var t=[...arguments].slice(1);return"function"!=typeof e&&(e=Function(""+e)),c[d]={callback:e,args:t},i(d),d++},clearImmediate:f}}();function ty(e){ey.setImmediate(e)}var ry,ny={setImmediate:ey.setImmediate,clearImmediate:ey.clearImmediate,immediatePromise:function(){return new Promise(ty)},delay:function(e,t){return void 0===t&&(t=void 0),new Promise(function(r){return setTimeout(r,e,t)})}},iy=function(){try{return!0}catch{return!1}}(),ay=function(){try{var e=process.env.DEBUG;return"*"===e||"molstar"===e}catch{return!1}}(),oy=typeof performance<"u"&&!!performance.mark&&performance.measure&&!1;function sy(e,t,r){var n=ly(e,t,r);return new _y(n,n.root)}function uy(e,t){return hy(t,e)}
139function cy(e){return{taskId:e.id,taskName:e.name,message:"",startedTime:0,canAbort:!0,isIndeterminate:!0,current:0,max:0}}function ly(e,t,r){var n,i={abortRequested:!1,treeAborted:!1,reason:""};return{updateRateMs:r,lastNotified:Kd(),observer:t,abortToken:i,taskId:e.id,root:{progress:cy(e),children:[]},tryAbort:(n=i,function(e){n.abortRequested=!0,n.reason=e||n.reason})}}function dy(e){return{progress:Ac({},e.progress),children:e.children.map(dy)}}function fy(e){return e.progress.canAbort&&e.children.every(fy)}function hy(e,t){return Tc(this,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:ry.markStart(e),t.node.progress.startedTime=Kd(),i.label=1;case 1:return i.trys.push([1,3,,7]),[4,e.f(t)];case 2:return r=i.sent(),ry.markEnd(e),ry.measure(e),t.info.abortToken.abortRequested&&py(t.info),[2,r];case 3:return n=i.sent(),vy.isAbort(n)?(t.isAborted=!0,t.node.children.length>0?[4,new Promise(function(e){t.onChildrenFinished=e})]:[3,5]):[3,6];case 4:i.sent(),i.label=5;case 5:e.onAbort&&e.onAbort(),i.label=6;case 6:throw n;case 7:return[2]}})})}function py(e){throw e.abortToken.treeAborted||(e.abortToken.treeAborted=!0,my(e.root),gy(e,Kd())),vy.Aborted(e.abortToken.reason)}function my(e){var t=e.progress;t.isIndeterminate=!0,t.canAbort=!1,t.message="Aborting...";for(var r=0,n=e.children;r<n.length;r++)my(n[r])}function gy(e,t){e.lastNotified=t;var r=function(e){return{root:dy(e.root),canAbort:fy(e.root),requestAbort:e.tryAbort}}(e);e.observer(r)}!function(e){function t(e){return`startTask${e.id}`}function r(e){return`endTask${e.id}`}e.markStart=function(e){oy&&performance.mark(t(e))},e.markEnd=function(e){oy&&performance.mark(r(e))},e.measure=function(e){oy&&performance.measure(`✳️ ${e.name}`,t(e),r(e))}}(ry||={});var vy,yy,by,_y=function(){function e(e,t){this.isSynchronous=!1,this.isExecuting=!0,this.lastUpdatedTime=0,this.onChildrenFinished=void 0,this.node=t,this.info=e}return e.prototype.checkAborted=function(){this.info.abortToken.abortRequested&&(this.isAborted=!0,py(this.info))},Object.defineProperty(e.prototype,"shouldUpdate",{get:function(){return this.checkAborted(),Kd()-this.lastUpdatedTime>this.info.updateRateMs},enumerable:!1,configurable:!0}),e.prototype.updateProgress=function(e){if(this.checkAborted(),e){var t=this.node.progress;"string"==typeof e?(t.message=e,t.isIndeterminate=!0):(void 0!==e.canAbort&&(t.canAbort=e.canAbort),void 0!==e.message&&(t.message=e.message),void 0!==e.current&&(t.current=e.current),void 0!==e.max&&(t.max=e.max),t.isIndeterminate=void 0===t.current||void 0===t.max,void 0!==e.isIndeterminate&&(t.isIndeterminate=e.isIndeterminate))}},e.prototype.update=function(e,t){if(this.lastUpdatedTime=Kd(),this.updateProgress(e),!t)return gy(this.info,this.lastUpdatedTime),this.checkAborted(),ny.immediatePromise()},e.prototype.runChild=function(t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:this.updateProgress(r),n={progress:cy(t),children:[]},(i=this.node.children).push(n),a=new e(this.info,n),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,hy(t,a)];case 2:return[2,l.sent()];case 3:if(o=l.sent(),vy.isAbort(o)&&this.isAborted)return[2,void 0];throw o;case 4:if((s=i.indexOf(n))>=0){for(u=s,c=i.length-1;u<c;u++)i[u]=i[u+1];i.pop()}return 0===i.length&&this.onChildrenFinished&&this.onChildrenFinished(),[7];case 5:return[2]}})})},e}(),xy=new(function(){function e(){this.shouldUpdate=!1,this.isSynchronous=!0}return e.prototype.update=function(e,t){},e}());function Sy(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:if(a=Math.max(t,0),o=0,s=0,e.isSynchronous)return n(2**53-1,r),[2,r];u=Kd(),c=0,l=0,f.label=1;case 1:return(c=n(a,r))>0?(o+=c,d=Kd()-u,l+=d,s+=d,e.shouldUpdate?[4,i(e,r,o)]:[3,3]):[3,4];case 2:f.sent(),a=Math.round(l*o/s)+1,u=Kd(),l=0,f.label=3;case 3:return[3,1];case 4:return e.shouldUpdate?[4,i(e,r,o)]:[3,6];case 5:f.sent(),f.label=6;case 6:return[2,r]}})})}(function(e){var t=function(){function e(e,t,r){this.name=e,this.f=t,this.onAbort=r,this.id=i()}return e.prototype.run=function(e,t){return void 0===t&&(t=250),e?function(e,t,r){void 0===r&&(r=250);var n=ly(e,t,r);return hy(e,new _y(n,n.root))}(this,e,t):this.f(xy)},e.prototype.runAsChild=function(e,t){return e.isSynchronous?this.f(xy):function(e,t,r){return e.runChild(t,r)}(e,this,t)},e.prototype.runInContext=function(e){return e.isSynchronous?this.f(xy):uy(e,this)},e}();function r(e){var t=e;return!!e&&"number"==typeof t.id&&"string"==typeof t.name&&!!t.run}function n(e,r,n){return new t(e,r,n)}e.is=r,e.isAbort=function(e){return!!e&&!!e.isAborted},e.Aborted=function(e){return{isAborted:!0,reason:e,toString:function(){return"Aborted"+(e?": "+e:"")}}},e.create=n,e.constant=function(e,t){var r=this;return n(e,function(e){return Tc(r,void 0,void 0,function(){return Pc(this,function(e){return[2,t]})})})},e.empty=function(){var e=this;return n("",function(t){return Tc(e,void 0,void 0,function(){return Pc(this,function(e){return[2]})})})},e.fail=function(e,t){var r=this;return n(e,function(e){return Tc(r,void 0,void 0,function(){return Pc(this,function(e){throw Error(t)})})})},e.resolveInContext=function(e,t){return r(e)?t?e.runInContext(t):e.run():e};var i=Jd(0,1073741823)})(vy||={}),function(e){e.Synchronous=xy}(yy||={}),function(e){function t(e,r){void 0===r&&(r="");var n=e.progress;if(!e.children.length)return n.isIndeterminate?`${r}${n.taskName}: ${n.message}`:`${r}${n.taskName}: [${n.current}/${n.max}] ${n.message}`;var i=r+"  |_ ",a=e.children.map(function(e){return t(e,i)});return n.isIndeterminate?`${r}${n.taskName}: ${n.message}\n${a.join("\n")}`:`${r}${n.taskName}: [${n.current}/${n.max}] ${n.message}\n${a.join("\n")}`}e.format=function(e){return t(e.root)}}(by||={});var wy=typeof process<"u"&&null!=process.versions&&null!=process.versions.node,Ay=typeof XMLHttpRequest>"u"||wy?xc():XMLHttpRequest,Cy=typeof File>"u"||wy?function(){function e(e,t,r){this.blob=new Blob(e,r),this.size=this.blob.size,this.type=this.blob.type,this.name=t,this.lastModified=r?.lastModified??0,this.webkitRelativePath=""}return e.prototype.arrayBuffer=function(){return this.blob.arrayBuffer()},e.prototype.slice=function(e,t,r){return this.blob.slice(e,t,r)},e.prototype.stream=function(){return this.blob.stream()},e.prototype.text=function(){return this.blob.text()},e}():File;function Ty(e,t){return e[t]|e[t+1]<<8}function Py(e,t,r){e[t]=255&r,e[t+1]=r>>8&255}function Ey(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])}function My(e,t,r){e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255}function ky(e){return e.length<2?"0"+e:e}function Iy(e){for(var t=e.length,r=0,n=0;n<t;n++){var i=e.charCodeAt(n);if(4294967168&i)if(4294965248&i)if(4294901760&i){if(4292870144&i)throw Error("e");r+=4}else r+=3;else r+=2;else r++}return r}var Dy=function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}return e}();function Oy(e,t,r){return 4294967295^function(e,t,r,n){for(var i=0;i<n;i++)e=Dy[255&(e^t[r+i])]^e>>>8;return e}(4294967295,e,t,r)}var Ry,By,Ny=(Ry=Uint16Array,By=Uint32Array,{next_code:new Ry(16),bl_count:new Ry(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[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,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new Ry(32),df0:[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,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new By(32),flmap:new Ry(512),fltree:[],fdmap:new Ry(32),fdtree:[],lmap:new Ry(32768),ltree:[],ttree:[],dmap:new Ry(32768),dtree:[],imap:new Ry(512),itree:[],rev15:new Ry(32768),lhst:new By(286),dhst:new By(30),ihst:new By(19),lits:new By(15e3),strt:new Ry(65536),prev:new Ry(32768)});function Fy(e,t,r){for(var n=e.length,i=Ny.rev15,a=0;a<n;a+=2)if(0!==e[a+1])for(var o=a>>1,s=e[a+1],u=o<<4|s,c=t-s,l=e[a]<<c,d=l+(1<<c);l!==d;)r[i[l]>>>15-t]=u,l++}function Ly(e,t){for(var r=e.length,n=Ny.bl_count,i=0;i<=t;i++)n[i]=0;for(i=1;i<r;i+=2)n[e[i]]++;var a=Ny.next_code,o=0;n[0]=0;for(var s=1;s<=t;s++)o=o+n[s-1]<<1,a[s]=o;for(var u=0;u<r;u+=2){var c=e[u+1];0!==c&&(e[u]=a[c],a[c]++)}}function $y(e,t){for(var r=Ny.rev15,n=15-t,i=0;i<e.length;i+=2)e[i]=r[e[i]<<t-e[i+1]]>>>n}function Uy(e,t,r){return Tc(this,void 0,void 0,function(){var n;return Pc(this,function(i){switch(i.label){case 0:if(3===t[0]&&0===t[1])return[2,r||new Uint8Array];n=function(e,t){var r=void 0===t;return void 0===t&&(t=new Uint8Array(e.length>>>2<<3)),{data:e,buf:t,noBuf:r,BFINAL:0,off:0,pos:0}}(t,r),i.label=1;
139case 1:return 0===n.BFINAL?e.shouldUpdate?[4,e.update({message:"Inflating blocks...",current:n.pos,max:t.length})]:[3,3]:[3,4];case 2:i.sent(),i.label=3;case 3:return function(e){for(var t=e.data,r=e.noBuf,n=e.buf,i=e.BFINAL,a=e.off,o=e.pos,s=0;0===i&&s<100;){var u=void 0,c=void 0,l=0,d=0;i=Hy(t,o,1),s+=1;var f=Hy(t,o+1,2);if(o+=3,0!==f){if(r&&(n=jy(n,a+(1<<17))),1===f)u=Ny.flmap,c=Ny.fdmap,l=511,d=31;else{if(2!==f)throw Error(`unknown BTYPE ${f}`);var h=Vy(t,o,5)+257,p=Vy(t,o+5,5)+1,m=Vy(t,o+10,4)+4;o+=14;for(var g=0;g<38;g+=2)Ny.itree[g]=0,Ny.itree[g+1]=0;var v=1;for(g=0;g<m;g++){var y=Vy(t,o+3*g,3);Ny.itree[1+(Ny.ordr[g]<<1)]=y,y>v&&(v=y)}o+=3*m,Ly(Ny.itree,v),Fy(Ny.itree,v,Ny.imap),u=Ny.lmap,c=Ny.dmap,o=zy(Ny.imap,(1<<v)-1,h+p,t,o,Ny.ttree);var b=Gy(Ny.ttree,0,h,Ny.ltree);l=(1<<b)-1;var _=Gy(Ny.ttree,h,p,Ny.dtree);d=(1<<_)-1,Ly(Ny.ltree,b),Fy(Ny.ltree,b,u),Ly(Ny.dtree,_),Fy(Ny.dtree,_,c)}for(;;){var x=u[qy(t,o)&l];o+=15&x;var S=x>>>4;if(S>>>8){if(256===S)break;var w=a+S-254;if(S>264){var A=Ny.ldef[S-257];w=a+(A>>>3)+Vy(t,o,7&A),o+=7&A}var C=c[qy(t,o)&d];o+=15&C;var T=C>>>4,P=Ny.ddef[T],E=(P>>>4)+Hy(t,o,15&P);for(o+=15&P,r&&(n=jy(n,a+(1<<17)));a<w;)n[a]=n[a++-E],n[a]=n[a++-E],n[a]=n[a++-E],n[a]=n[a++-E];a=w}else n[a++]=S}}else{7&o&&(o+=8-(7&o));var M=4+(o>>>3),k=t[M-4]|t[M-3]<<8;r&&(n=jy(n,a+k)),n.set(new Uint8Array(t.buffer,t.byteOffset+M,k),a),o=M+k<<3,a+=k}}e.buf=n,e.BFINAL=i,e.off=a,e.pos=o}(n),[3,1];case 4:return[2,n.buf.length===n.off?n.buf:n.buf.slice(0,n.off)]}})})}function jy(e,t){var r=e.length;if(t<=r)return e;var n=new Uint8Array(Math.max(r<<1,t));return n.set(e,0),n}function zy(e,t,r,n,i,a){for(var o=0;o<r;){var s=e[qy(n,i)&t];i+=15&s;var u=s>>>4;if(u<=15)a[o]=u,o++;else{var c=0,l=0;16===u?(l=3+Vy(n,i,2),i+=2,c=a[o-1]):17===u?(l=3+Vy(n,i,3),i+=3):18===u&&(l=11+Vy(n,i,7),i+=7);for(var d=o+l;o<d;)a[o]=c,o++}}return i}function Gy(e,t,r,n){for(var i=0,a=0,o=n.length>>>1;a<r;){var s=e[a+t];n[a<<1]=0,n[1+(a<<1)]=s,s>i&&(i=s),a++}for(;a<o;)n[a<<1]=0,n[1+(a<<1)]=0,a++;return i}function Vy(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1}function Hy(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1}function qy(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)}function Wy(e,t,r){for(var n=[],i=e.length,a=t.length,o=0;o<a;o+=2)t[o]=0,t[o+1]=0;for(o=0;o<i;o++)0!==e[o]&&n.push({lit:o,f:e[o],d:void 0});var s=n.length,u=n.slice(0);if(0===s)return 0;if(1===s){var c=n[0].lit,l=+(0===c);return t[1+(c<<1)]=1,t[1+(l<<1)]=1,1}n.sort(function(e,t){return e.f-t.f});var d=n[0],f=n[1],h=0,p=1,m=2;for(n[0]={lit:-1,f:d.f+f.f,l:d,r:f,d:0};p!==s-1;)d=h!==p&&(m===s||n[h].f<n[m].f)?n[h++]:n[m++],f=h!==p&&(m===s||n[h].f<n[m].f)?n[h++]:n[m++],n[p++]={lit:-1,f:d.f+f.f,l:d,r:f,d:void 0};var g=Xy(n[p-1],0);for(g>r&&(function(e,t,r){var n=0,i=0,a=1<<r-t;for(e.sort(function(e,t){return t.d===e.d?e.f-t.f:t.d-e.d}),n=0;n<e.length&&e[n].d>t;n++){var o=e[n].d;e[n].d=t,i+=a-(1<<r-o)}for(i>>>=r-t;i>0;)(o=e[n].d)<t?(e[n].d++,i-=1<<t-o-1):n++;for(;n>=0;n--)e[n].d===t&&i<0&&(e[n].d--,i++);0!==i&&console.log("debt left")}(u,r,g),g=r),o=0;o<s;o++)t[1+(u[o].lit<<1)]=u[o].d;return g}function Xy(e,t){return-1===e.lit?Math.max(Xy(e.l,t+1),Xy(e.r,t+1)):(e.d=t,t)}!function(){for(var e=0;e<32768;e++){var t=e;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,Ny.rev15[e]=(t>>>16|t<<16)>>>17}function r(e,t,r){for(;0!=t--;)e.push(0,r)}for(e=0;e<32;e++)Ny.ldef[e]=Ny.of0[e]<<3|Ny.exb[e],Ny.ddef[e]=Ny.df0[e]<<4|Ny.dxb[e];r(Ny.fltree,144,8),r(Ny.fltree,112,9),r(Ny.fltree,24,7),r(Ny.fltree,8,8),Ly(Ny.fltree,9),Fy(Ny.fltree,9,Ny.flmap),$y(Ny.fltree,9),r(Ny.fdtree,32,5),Ly(Ny.fdtree,5),Fy(Ny.fdtree,5,Ny.fdmap),$y(Ny.fdtree,5),r(Ny.itree,19,0),r(Ny.ltree,286,0),r(Ny.dtree,30,0),r(Ny.ttree,320,0)}();var Yy,Ky=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]];function Zy(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p,m,g;return Pc(this,function(v){switch(v.label){case 0:if(a=function(e,t,r,n){var i=Ny.lits,a=Ny.strt,o=Ny.prev;return{data:e,out:t,opt:Ky[n],i:0,pos:r<<3,cvrd:0,dlen:e.length,li:0,lc:0,bs:0,ebits:0,c:0,nc:0,lits:i,strt:a,prev:o}}(t,r,n,i),o=a.dlen,0===i){for(s=a.i,u=a.pos;s<o;)c=Math.min(65535,o-s),ub(r,u,+(s+c===o)),u=rb(t,s,c,r,u+8),s+=c;return[2,u>>>3]}o>2&&(a.nc=eb(t,0),a.strt[a.nc]=0),v.label=1;case 1:return a.i<o?e.shouldUpdate?[4,e.update({message:"Deflating...",current:a.i,max:o})]:[3,3]:[3,4];case 2:v.sent(),v.label=3;case 3:return function(e){for(var t=e.data,r=e.dlen,n=e.out,i=e.opt,a=e.i,o=e.pos,s=e.cvrd,u=e.li,c=e.lc,l=e.bs,d=e.ebits,f=e.c,h=e.nc,p=Ny.lits,m=Ny.strt,g=Ny.prev,v=Math.min(a+1048576,r);a<v;a++){if(f=h,a+1<r-2){h=eb(t,a+1);var y=a+1&32767;g[y]=m[h],m[h]=y}if(s<=a){(u>14e3||c>26697)&&r-a>100&&(s<a&&(p[u]=a-s,u+=2,s=a),o=tb(+(a===r-1||s===r),p,u,d,t,l,a-l,n,o),u=c=d=0,l=a);var b=0;if(a<r-2&&(b=Qy(t,a,g,f,Math.min(i[2],r-a),i[3])),0!==b){var _=b>>>16,x=65535&b,S=ob(_,Ny.of0);Ny.lhst[257+S]++;var w=ob(x,Ny.df0);Ny.dhst[w]++,d+=Ny.exb[S]+Ny.dxb[w],p[u]=_<<23|a-s,p[u+1]=x<<16|S<<8|w,u+=2,s=a+_}else Ny.lhst[t[a]]++;c++}}e.i=a,e.pos=o,e.cvrd=s,e.li=u,e.lc=c,e.bs=l,e.ebits=d,e.c=f,e.nc=h}(a),[3,1];case 4:for(l=a.li,d=a.cvrd,f=a.pos,h=a.i,p=a.lits,m=a.bs,g=a.ebits,m===h&&0!==t.length||(d<h&&(p[l]=h-d,l+=2,d=h),f=tb(1,p,l,g,t,m,h-m,r,f));7&f;)f++;return[2,f>>>3]}})})}function Qy(e,t,r,n,i,a){var o=32767&t,s=r[o],u=o-s+32768&32767;if(s===o||n!==eb(e,t-u))return 0;for(var c=0,l=0,d=Math.min(32767,t);u<=d&&0!=--a&&s!==o;){if(0===c||e[t+c]===e[t+c-u]){var f=Jy(e,t,u);if(f>c){if(l=u,(c=f)>=i)break;u+2<f&&(f=u+2);for(var h=0,p=0;p<f-2;p++){var m=t-u+p+32768&32767,g=m-r[m]+32768&32767;g>h&&(h=g,s=m)}}}u+=(o=s)-(s=r[o])+32768&32767}return c<<16|l}function Jy(e,t,r){if(e[t]!==e[t-r]||e[t+1]!==e[t+1-r]||e[t+2]!==e[t+2-r])return 0;var n=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]===e[t-r];)t++;return t-n}function eb(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535}function tb(e,t,r,n,i,a,o,s,u){Ny.lhst[256]++;var c=function(){for(var e=Wy(Ny.lhst,Ny.ltree,15),t=Wy(Ny.dhst,Ny.dtree,15),r=[],n=ab(Ny.ltree,r),i=[],a=ab(Ny.dtree,i),o=0;o<r.length;o+=2)Ny.ihst[r[o]]++;for(o=0;o<i.length;o+=2)Ny.ihst[i[o]]++;for(var s=Wy(Ny.ihst,Ny.itree,7),u=19;u>4&&0===Ny.itree[1+(Ny.ordr[u-1]<<1)];)u--;return[e,t,s,n,a,u,r,i]}(),l=c[0],d=c[1],f=c[2],h=c[3],p=c[4],m=c[5],g=c[6],v=c[7],y=32+(u+3&7?8-(u+3&7):0)+(o<<3),b=n+nb(Ny.fltree,Ny.lhst)+nb(Ny.fdtree,Ny.dhst),_=n+nb(Ny.ltree,Ny.lhst)+nb(Ny.dtree,Ny.dhst);_+=14+3*m+nb(Ny.itree,Ny.ihst)+(2*Ny.ihst[16]+3*Ny.ihst[17]+7*Ny.ihst[18]);for(var x=0;x<286;x++)Ny.lhst[x]=0;for(x=0;x<30;x++)Ny.dhst[x]=0;for(x=0;x<19;x++)Ny.ihst[x]=0;var S=y<b&&y<_?0:b<_?1:2;if(cb(s,u,e),cb(s,u+1,S),u+=3,0===S){for(;7&u;)u++;u=rb(i,a,o,s,u)}else{var w=void 0,A=void 0;if(1===S)w=Ny.fltree,A=Ny.fdtree;
139else if(2===S){Ly(Ny.ltree,l),$y(Ny.ltree,l),Ly(Ny.dtree,d),$y(Ny.dtree,d),Ly(Ny.itree,f),$y(Ny.itree,f),w=Ny.ltree,A=Ny.dtree,ub(s,u,h-257),ub(s,u+=5,p-1),ub(s,u+=5,m-4),u+=4;for(var C=0;C<m;C++)ub(s,u+3*C,Ny.itree[1+(Ny.ordr[C]<<1)]);u+=3*m,u=ib(g,Ny.itree,s,u),u=ib(v,Ny.itree,s,u)}else Lg();for(var T=a,P=0;P<r;P+=2){for(var E=t[P],M=E>>>23,k=T+(8388607&E);T<k;)u=sb(i[T++],w,s,u);if(0!==M){var I=t[P+1],D=I>>16,O=I>>8&255,R=255&I;ub(s,u=sb(257+O,w,s,u),M-Ny.of0[O]),cb(s,u=sb(R,A,s,u+=Ny.exb[O]),D-Ny.df0[R]),u+=Ny.dxb[R],T+=M}}u=sb(256,w,s,u)}return u}function rb(e,t,r,n,i){var a=i>>>3;return n[a]=r,n[a+1]=r>>>8,n[a+2]=255-n[a],n[a+3]=255-n[a+1],a+=4,n.set(new Uint8Array(e.buffer,t,r),a),i+(r+4<<3)}function nb(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n]*e[1+(n<<1)];return r}function ib(e,t,r,n){for(var i=0;i<e.length;i+=2){var a=e[i],o=e[i+1];n=sb(a,t,r,n);var s=16===a?2:17===a?3:7;a>15&&(ub(r,n,o),n+=s)}return n}function ab(e,t){for(var r=e.length;2!==r&&0===e[r-1];)r-=2;for(var n=0;n<r;n+=2){var i=e[n+1],a=n+3<r?e[n+3]:-1,o=n+5<r?e[n+5]:-1,s=0===n?-1:e[n-1];if(0===i&&a===i&&o===i){for(var u=n+5;u+2<r&&e[u+2]===i;)u+=2;(c=Math.min(u+1-n>>>1,138))<11?t.push(17,c-3):t.push(18,c-11),n+=2*c-2}else if(i===s&&a===i&&o===i){for(u=n+5;u+2<r&&e[u+2]===i;)u+=2;var c=Math.min(u+1-n>>>1,6);t.push(16,c-3),n+=2*c-2}else t.push(i,0)}return r>>>1}function ob(e,t){var r=0;return t[16|r]<=e&&(r|=16),t[8|r]<=e&&(r|=8),t[4|r]<=e&&(r|=4),t[2|r]<=e&&(r|=2),t[1|r]<=e&&(r|=1),r}function sb(e,t,r,n){return cb(r,n,t[e<<1]),n+t[1+(e<<1)]}function ub(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8}function cb(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16}function lb(e,t,r){return void 0===r&&(r=!1),Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:for(n=Object.create(null),i=new Uint8Array(t),a=i.length-4;101010256!==Ey(i,a);)a--;o=a,o+=4,s=Ty(i,o+=4),o+=2,o+=2,u=Ey(i,o+=4),o+=4,o=u,c=0,g.label=1;case 1:return c<s?(o+=4,o+=4,o+=4,o+=4,l=Ey(i,o+=4),d=Ey(i,o+=4),f=Ty(i,o+=4),h=Ty(i,o+2),p=Ty(i,o+4),o+=6,m=Ey(i,o+=8),o+=4,o+=f+h+p,[4,db(e,i,m,n,l,d,r)]):[3,4];case 2:g.sent(),g.label=3;case 3:return c++,[3,1];case 4:return[2,n]}})})}function db(e,t,r,n,i,a,o){return Tc(this,void 0,void 0,function(){var s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:return r+=4,r+=2,s=Ty(t,r+=2),r+=2,r+=4,r+=4,u=Ty(t,r+=8),c=Ty(t,r+=2),l=function(e,t,r){for(var n,i="",a=0;a<r;a++)i+="%"+ky(e[t+a].toString(16));try{n=decodeURIComponent(i)}catch{return function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n}(e,t,r)}return n}(t,r+=2,u),r+=u,r+=c,o?(n[l]={size:a,csize:i},[2]):(d=new Uint8Array(t.buffer,r),0===s?(n[l]=new Uint8Array(d.buffer.slice(r,r+i)),[3,4]):[3,1]);case 1:return 8===s?(f=new Uint8Array(a),[4,fb(e,d,f)]):[3,3];case 2:return h.sent(),n[l]=f,[3,4];case 3:throw Error(`unknown compression method: ${s}`);case 4:return[2]}})})}function fb(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(n){return[2,Uy(e,t,r)]})})}function hb(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:if(n=t[3],i=10,4&n&&(a=Ty(t,i),i+=a),8&n){for(o=i;0!==t[o];)++o;i=o+1}if(16&n){for(o=i;0!==t[o];)++o;i=o+1}return 1&n&&(i+=2),s=function(e){return 0|e}(Ey(t,t.length-8)),u=Ey(t,t.length-4),void 0===r&&(r=new Uint8Array(u)),c=new Uint8Array(t.buffer,t.byteOffset+i,t.length-i-8),[4,fb(e,c,r)];case 1:return l=f.sent(),d=Oy(l,0,l.length),s!==d&&console.error("ungzip: checksums don't match"),[2,l]}})})}function pb(e,t,r){return Tc(this,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return void 0===r&&(r={level:6}),n=new Uint8Array(50+Math.floor(1.1*t.length)),[4,Zy(e,t,n,0,r.level)];case 1:return i=a.sent(),[2,new Uint8Array(n.buffer,0,i)]}})})}function mb(e,t){return void 0===t&&(t=!1),vy.create("Zip",function(r){return function(e,t,r){return void 0===r&&(r=!1),Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w;return Pc(this,function(A){switch(A.label){case 0:for(s in n=0,i={},o=[],a=t)o.push(s);u=0,A.label=1;case 1:return u<o.length?(s=o[u])in a?(c=!function(e){var t=e.split(".").pop().toLowerCase();return-1!=="png,jpg,jpeg,zip".indexOf(t)}(_=s)&&!r,l=t[_],d=Oy(l,0,l.length),f=i,h=_,w={cpr:c,usize:l.length,crc:d},c?[4,pb(e,l)]:[3,3]):[3,5]:[3,6];case 2:return p=A.sent(),[3,4];case 3:p=l,A.label=4;case 4:f[h]=(w.file=p,w),A.label=5;case 5:return u++,[3,1];case 6:for(_ in i)n+=i[_].file.length+30+46+2*Iy(_);for(_ in n+=22,m=new Uint8Array(n),g=0,v=[],i)x=i[_],v.push(g),g=gb(m,g,_,x,0);for(_ in y=0,b=g,i)x=i[_],v.push(g),g=gb(m,g,_,x,1,v[y++]);return S=g-b,My(m,g,101010256),g+=4,Py(m,g+=4,y),Py(m,g+=2,y),My(m,g+=2,S
139),My(m,g+=4,b),g+=4,g+=2,[2,m.buffer]}})})}(r,e,t)})}function gb(e,t,r,n,i,a){void 0===a&&(a=0);var o=n.file;My(e,t,0===i?67324752:33639248),t+=4,1===i&&(t+=2),Py(e,t,20),Py(e,t+=2,0),Py(e,t+=2,n.cpr?8:0),My(e,t+=2,0),My(e,t+=4,n.crc),My(e,t+=4,o.length),My(e,t+=4,n.usize),Py(e,t+=4,Iy(r)),Py(e,t+=2,0),t+=2,1===i&&(t+=2,t+=2,My(e,t+=6,a),t+=4);var s=function(e,t,r){for(var n=r.length,i=0,a=0;a<n;a++){var o=r.charCodeAt(a);if(4294967168&o)if(4294965248&o)if(4294901760&o){if(4292870144&o)throw Error("e");e[t+i]=240|o>>18,e[t+i+1]=128|o>>12&63,e[t+i+2]=128|o>>6&63,e[t+i+3]=128|63&o,i+=4}else e[t+i]=224|o>>12,e[t+i+1]=128|o>>6&63,e[t+i+2]=128|63&o,i+=3;else e[t+i]=192|o>>6,e[t+i+1]=128|63&o,i+=2;else e[t+i]=o,i++}return i}(e,t,r);return t+=s,0===i&&(e.set(o,t),t+=o.length),t}function vb(e,t){return function(e,t){var r=this;if(wy)return function(e,t){var r=this;return vy.create("Read File",function(n){return Tc(r,void 0,void 0,function(){var r,i;return Pc(this,function(a){switch(a.label){case 0:return r="zip"===t?Yy.None:xb(e.name),[4,n.update({message:"Opening file...",canAbort:!1})];case 1:return a.sent(),"binary"!==t&&"zip"!==t&&r===Yy.None?[3,3]:[4,e.arrayBuffer()];case 2:return i=a.sent(),[3,5];case 3:return[4,e.text()];case 4:i=a.sent(),a.label=5;case 5:return[4,n.update({message:"Processing file...",canAbort:!1})];case 6:return a.sent(),[4,Ab(n,i,t,r)];case 7:return[2,a.sent()]}})})})}(e,t);var n=void 0;return vy.create("Read File",function(i){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return o.trys.push([0,,5,6]),n=new FileReader,r="zip"===t?Yy.None:xb(e.name),"binary"===t||"zip"===t||r!==Yy.None?n.readAsArrayBuffer(e):n.readAsText(e),[4,i.update({message:"Opening file...",canAbort:!0})];case 1:return o.sent(),[4,_b(i,"Reading...",n)];case 2:return a=o.sent(),[4,i.update({message:"Processing file...",canAbort:!1})];case 3:return o.sent(),[4,Ab(i,a.result,t,r)];case 4:return[2,o.sent()];case 5:return n=void 0,[7];case 6:return[2]}})})},function(){n&&n.abort()})}(e,t)}function yb(e){return"string"==typeof e?Pb(e,e,"string"):Pb(e.title,e.url,e.type||"string",e.body,e.headers)}function bb(e){return e?"Failed to download data. Possible reasons: Resource is not available, or CORS is not allowed on the server.":"Failed to open file."}function _b(e,t,r){return new Promise(function(n,i){if(function(e){if(!wy&&e instanceof FileReader)return e.readyState===FileReader.DONE;if(e instanceof Ay)return e.readyState===Ay.DONE;throw Error("unknown data type")}(r)){var a=r.error;null==a?n(r):i(a??bb(r instanceof Ay))}else{var o=!1;r.onerror=function(e){if(!o){var t=e.target.error;i(t??bb(r instanceof Ay))}},r.onprogress=function(r){if(e.shouldUpdate&&!o)try{r.lengthComputable?e.update({message:t,isIndeterminate:!1,current:r.loaded,max:r.total}):e.update({message:`${t} ${(r.loaded/1024/1024).toFixed(2)} MB`,isIndeterminate:!0})}catch(e){o=!0,i(e)}},r.onload=function(e){n(r)}}})}function xb(e){return/\.gz$/i.test(e)?Yy.Gzip:/\.zip$/i.test(e)?Yy.Zip:Yy.None}!function(e){e[e.None=0]="None",e[e.Gzip=1]="Gzip",e[e.Zip=2]="Zip"}(Yy||={});var Sb=/^(__MACOSX|.DS_Store)/;function wb(e,t,r){return Tc(this,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:switch(r){case Yy.None:return[3,1];case Yy.Gzip:return[3,2];case Yy.Zip:return[3,3]}return[3,5];case 1:return[2,t];case 2:return[2,hb(e,t)];case 3:return[4,lb(e,t.buffer)];case 4:if(n=a.sent(),i=Object.keys(n).filter(function(e){return!Sb.test(e)}),1!==i.length)throw Error("can only decompress zip files with a single entry");return[2,n[i[0]]];case 5:return[2]}})})}function Ab(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a;return Pc(this,function(o){switch(o.label){case 0:if(null===(i=t instanceof ArrayBuffer?new Uint8Array(t):t))throw Error("no data given");if(n===Yy.None)return[3,4];if(!(i instanceof Uint8Array))throw Error("need Uint8Array for decompression");return[4,wb(e,i,n)];case 1:return a=o.sent(),"string"===r?[4,e.update({message:"Decoding text..."})]:[3,3];case 2:return o.sent(),i=Qv(a,0,a.length),[3,4];case 3:i=a,o.label=4;case 4:return"binary"===r&&i instanceof Uint8Array?[2,i]:[3,5];case 5:return"zip"===r&&i instanceof Uint8Array?[4,lb(e,i.buffer)]:[3,7];case 6:return[2,o.sent()];case 7:if("string"===r&&"string"==typeof i)return[2,i];if("xml"===r&&"string"==typeof i)return[2,(new DOMParser).parseFromString(i,"application/xml")];if("json"===r&&"string"==typeof i)return[2,JSON.parse(i)];o.label=8;case 8:throw Error(`could not get requested response data '${r}'`)}})})}var Cb,Tb=function(){function e(){}return e.get=function(){return this.pool.length?this.pool.pop():new Ay},e.emptyFunc=function(){},e.deposit=function(t){this.pool.length<this.poolSize&&(t.onabort=e.emptyFunc,t.onerror=e.emptyFunc,t.onload=e.emptyFunc,t.onprogress=e.emptyFunc,this.pool.push(t))},e.pool=[],e.poolSize=15,e}();function Pb(e,t,r,n,i){var a=this;if(wy&&t.startsWith("file://"))return function(e,t,r){if(!wy)throw Error("This function should only be used when running in Node.js");if(!t.startsWith("file://"))throw Error("This function is only for URLs with protocol file://");var n=t.substring(7);
139return vb(new Cy([function(){throw Error("When running in Node.js and reading from files, call mol-util/data-source's setFSModule function first.")}().readFileSync(n)],"raw-data"),r)}(0,t,r);var o=void 0;return vy.create(e||"Download",function(e){return Tc(a,void 0,void 0,function(){var a,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:if((o=Tb.get()).open(n?"post":"get",t,!0),i)for(a=0,s=i;a<s.length;a++)u=s[a],c=u[0],l=u[1],o.setRequestHeader(c,l);return o.responseType=function(e){switch(e){case"json":return"json";case"xml":return"document";case"string":return"text";case"binary":case"zip":return"arraybuffer"}}(r),o.send(n),[4,e.update({message:"Waiting for server...",canAbort:!0})];case 1:return h.sent(),[4,_b(e,"Downloading...",o)];case 2:return d=h.sent(),o=void 0,[4,e.update({message:"Parsing response...",canAbort:!1})];case 3:return h.sent(),f=function(e,t){if(e.status>=200&&e.status<400){var r=e.response;if(Tb.deposit(e),("binary"===t||"zip"===t)&&r instanceof ArrayBuffer)return new Uint8Array(r);if("string"===t&&"string"==typeof r||"xml"===t&&r instanceof XMLDocument||"json"===t&&"object"==typeof r)return r;throw Error(`could not get requested response data '${t}'`)}throw Tb.deposit(e),Error(`Download failed with status code ${e.status}`)}(d,r),[2,f]}})})},function(){o&&=void o.abort()})}function Eb(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:return i=r.length,a=Array(r.length),[4,e.update({message:"Downloading...",current:0,max:i})];case 1:for(g.sent(),o=[],s=[],u=0,c=Math.min(i,n);u<c;u++)p=r[u],o.push(kb(u,p.id,t.resolve(Cb.getUrlAsset(t,p.url),p.isBinary?"binary":"string").runAsChild(e))),s.push(u);l=0,g.label=2;case 2:return o.length>0?[4,Promise.race(o)]:[3,6];case 3:if(d=g.sent(),f=r[d.index],h=s.indexOf(d.index),l++,"error"===d.kind&&!f.canFail)throw Error(`${f.url}: ${d.error}`);return e.shouldUpdate?[4,e.update({message:"Downloading...",current:l,max:i})]:[3,5];case 4:g.sent(),g.label=5;case 5:return a[d.index]=d,o=o.filter(Mb,h),s=s.filter(Mb,h),u<i&&(p=r[u],m=t.resolve(Cb.getUrlAsset(t,p.url),p.isBinary?"binary":"string").runAsChild(e),o.push(kb(u,p.id,m)),s.push(u),u++),[3,2];case 6:return[2,a]}})})}function Mb(e,t){return this!==t}function kb(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r];case 1:return[2,{kind:"ok",result:n.sent(),index:e,id:t}];case 2:return[2,{kind:"error",error:n.sent(),index:e,id:t}];case 3:return[2]}})})}!function(e){function t(e,t){return Ac({kind:"url",id:Wd.create22(),url:e},t)}e.Url=t,e.File=function(e){return{kind:"file",id:Wd.create22(),name:e.name,file:e}},e.isUrl=function(e){return"url"===e?.kind},e.isFile=function(e){return"file"===e?.kind},e.Wrapper=function(e,t,r){return{data:e,dispose:function(){r.release(t)}}},e.getUrl=function(e){return"string"==typeof e?e:e.url},e.getUrlAsset=function(e,r,n){return"string"==typeof r?e.tryFindUrl(r,n)||t(r,{body:n}):r}}(Cb||={});var Ib,Db,Ob,Rb,Bb=function(){function e(){this._assets=new Map}return Object.defineProperty(e.prototype,"assets",{get:function(){return Hv(this._assets.values())},enumerable:!1,configurable:!0}),e.prototype.tryFindUrl=function(e,t){for(var r=this.assets.values();;){var n=r.next();if(n.done)return;var i=n.value.asset;if(Cb.isUrl(i)&&i.url===e&&(i.body||"")===(t||""))return i}},e.prototype.set=function(e,t){this._assets.set(e.id,{asset:e,file:t,refCount:0})},e.prototype.get=function(e){return this._assets.get(e.id)},e.prototype.delete=function(e){return this._assets.delete(e.id)},e.prototype.has=function(e){return this._assets.has(e.id)},e.prototype.resolve=function(e,t,r){var n=this;return void 0===r&&(r=!0),Cb.isUrl(e)?vy.create(`Download ${e.title||e.url}`,function(i){return Tc(n,void 0,void 0,function(){var n,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:return this._assets.has(e.id)?((n=this._assets.get(e.id)).refCount++,o=(a=Cb).Wrapper,[4,vb(n.file,t).runInContext(i)]):[3,2];case 1:return[2,o.apply(a,[h.sent(),e,this])];case 2:return r?[3,4]:(u=(s=Cb).Wrapper,[4,yb(Ac(Ac({},e),{type:t})).runInContext(i)]);case 3:return[2,u.apply(s,[h.sent(),e,this])];case 4:return[4,yb(Ac(Ac({},e),{type:"binary"})).runInContext(i)];case 5:return c=h.sent(),l=new Cy([c],"raw-data"),this._assets.set(e.id,{asset:e,file:l,refCount:1}),f=(d=Cb).Wrapper,[4,vb(l,t).runInContext(i)];case 6:return[2,f.apply(d,[h.sent(),e,this])]}})})}):vy.create(`Read ${e.name}`,function(i){return Tc(n,void 0,void 0,function(){var n,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return this._assets.has(e.id)?((n=this._assets.get(e.id)).refCount++,o=(a=Cb).Wrapper,[4,vb(n.file,t).runInContext(i)]):[3,2];case 1:return[2,o.apply(a,[c.sent(),e,this])];case 2:if(!(e.file instanceof Cy))throw Error(`Cannot resolve file asset '${e.name}' (${e.id})`);return r&&this._assets.set(e.id,{asset:e,file:e.file,refCount:1}),u=(s=Cb).Wrapper,[4,vb(e.file,t).runInContext(i)];case 3:return[2,u.apply(s,[c.sent(),e,this])]}})})})},e.prototype.release=function(e){var t=this._assets.get(e.id);t&&(t.refCount--,t.refCount<=0&&this._assets.delete(e.id))},e.prototype.clear=function(){this._assets.clear()},e.prototype.dispose=function(){this.clear()},e}();function Nb(e){for(var t=-1/0,r=0,n=e.length;r<n;++r)e[r]>t&&(t=e[r]);return t}function Fb(e){for(var t=1/0,r=0,n=e.length;r<n;++r)e[r]<t&&(t=e[r]);return t}
139function Lb(e){for(var t=1/0,r=-1/0,n=0,i=e.length;n<i;++n)e[n]<t&&(t=e[n]),e[n]>r&&(r=e[n]);return[t,r]}function $b(e,t,r){void 0===t&&(t=1),void 0===r&&(r=0);for(var n=e.length,i=0,a=r;a<n;a+=t)i+=e[a];return i}function Ub(e,t,r){return void 0===t&&(t=1),void 0===r&&(r=0),$b(e,t,r)/(e.length/t)}function jb(e){for(var t=e.length,r=0,n=0;n<t;++n){var i=e[n];r+=i*i}return Math.sqrt(r/t)}function zb(e,t){for(var r=0,n=t?Math.min(t,e.length):e.length;r<n;++r)e[r]=r;return e}function Gb(e,t){for(var r=0,n=!1,i=e.length;r<i;r++)if(e[r]===t){n=!0;break}return!!n&&(Vb(e,r),!0)}function Vb(e,t){for(var r=t,n=e.length-1;r<n;r++)e[r]=e[r+1];e.pop()}function Hb(e,t){return!(e.indexOf(t)>=0||(e.push(t),0))}function qb(e,t){var r=e.indexOf(t);if(r<0)return!1;for(var n=r,i=e.length-1;n<i;n++)e[n]=e[n+1];return e.pop(),!0}function Wb(e,t){for(var r=0,n=0,i=e.length;n<i;++n)t.includes(e[n])&&(r+=1);return r}function Xb(e,t){if(!e||0===e.length)return!t||0===t.length;if(!t)return!1;var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Yb(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n][0]===t)return void(e[n][1]=r);e.push([t,r])}(function(e){function t(e,t){return t?(t.label&&(e.label=t.label),t.description&&(e.description=t.description),t.legend&&(e.legend=t.legend),t.fieldLabels&&(e.fieldLabels=t.fieldLabels),t.isHidden&&(e.isHidden=t.isHidden),t.shortLabel&&(e.shortLabel=t.shortLabel),t.twoColumns&&(e.twoColumns=t.twoColumns),t.isEssential&&(e.isEssential=t.isEssential),t.category&&(e.category=t.category),t.hideIf&&(e.hideIf=t.hideIf),t.help&&(e.help=t.help),e):e}function r(e,r,n){return t({type:"select",defaultValue:_(e,r),options:r,cycle:n?.cycle},n)}function n(e,t){return t?(void 0!==t.min&&(e.min=t.min),void 0!==t.max&&(e.max=t.max),void 0!==t.step&&(e.step=t.step),e):e}function i(e,r){var n=t({type:"group",defaultValue:r?.customDefault||s(e),params:e},r);return null!=r&&r.presets&&(n.presets=r.presets),null!=r&&r.isExpanded&&(n.isExpanded=r.isExpanded),null!=r&&r.isFlat&&(n.isFlat=r.isFlat),null!=r&&r.pivot&&(n.pivot=r.pivot),n}function a(){return s(this.element)}function o(){throw Error("getValue not set. Fix runtime.")}function s(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];e[i].isOptional||(t[i]=e[i].defaultValue)}return t}function u(e,t,r){return function(){return e(t,r)}}function c(e,t,r){if(t)if("value-ref"===e.type)(n=t).ref?n.getValue=u(e.resolveRef,n.ref,r):n.getValue=function(){throw Error("Unset ref in ValueRef value.")};else if("data-ref"===e.type)(n=t).ref?n.getValue=u(r,n.ref,r):n.getValue=function(){throw Error("Unset ref in ValueRef value.")};else if("group"===e.type)f(e.params,t,r);else if("mapped"===e.type){var n=t;c(e.map(n.name),n.params,r)}else if("object-list"===e.type){if(!d(e.element))return;for(var i=0,a=t;i<a.length;i++){var o=a[i];f(e.element,o,r)}}}function l(e){if("value-ref"===e.type||"data-ref"===e.type)return!0;if("group"===e.type){if(d(e.params))return!0}else if("mapped"===e.type)for(var t=0,r=e.select.options;t<r.length;t++){var n=r[t][0];if(l(e.map(n)))return!0}else if("object-list"===e.type)return d(e.element);return!1}function d(e){for(var t=0,r=Object.keys(e);t<r.length;t++)if(l(e[r[t]]))return!0;return!1}function f(e,t,r){for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];c(e[a],t?.[a],r)}}function h(e,t,r){if(t===r)return!0;if("object"!=typeof t||"object"!=typeof r)return!1;for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];if(!p(e[a],t[a],r[a]))return!1}return!0}function p(e,t,r){if(t===r)return!0;if("group"===e.type)return h(e.params,t,r);if("mapped"===e.type){var n=r;return(s=t).name===n.name&&p(e.map(s.name),s.params,n.params)}if("multi-select"===e.type){if(n=r,(s=t).length!==n.length)return!1;if(s.length<10){for(var i=0,a=s.length;i<a;i++)if(s[i]!==n[i]&&n.indexOf(s[i])<0)return!1}else{var o=new Set(n);for(i=0,a=s.length;i<a;i++)if(s[i]!==n[i]&&!o.has(s[i]))return!1}return!0}if("interval"===e.type)return t[0]===r[0]&&t[1]===r[1];if("line-graph"===e.type){if(n=r,(s=t).length!==n.length)return!1;for(i=0,a=s.length;i<a;i++)if(!Bg.areEqual(s[i],n[i]))return!1;return!0}if("vec3"===e.type)return Cg.equals(t,r);if("mat4"===e.type)return Og.areEqual(t,r,vg);if("script"===e.type)return n=r,(s=t).language===n.language&&s.expression===n.expression;if("object-list"===e.type){n=r;var s,u=(s=t).length;if(u!==n.length)return!1;for(i=0;i<u;i++)if(!h(e.element,s[i],n[i]))return!1;return!0}return"object"==typeof t&&"object"==typeof r&&df(t,r)}function m(e,t,r){if(void 0===t)return Ac({},r);if(void 0===r)return Ac({},t);for(var n=Object.create(null),i=0,a=Object.keys(e);i<a.length;i++){var o=a[i];n[o]=g(e[o],t[o],r[o])}return n}function g(e,t,r){if(void 0===t)return"object"!=typeof r||Array.isArray(r)?r:Ac({},r);if(void 0===r)return"object"!=typeof t||Array.isArray(t)?t:Ac({},t);if("group"===e.type)return m(e.params,t,r);if("mapped"===e.type){var n=t,i=r;if(n.name!==i.name)return Ac({},i);var a=e.map(i.name);return{name:i.name,params:g(a,n.params,i.params)}}return"value"===e.type?r:"object"==typeof t&&"object"==typeof r?Array.isArray(r)?r:Ac(Ac({},t),r):r}function v(e,t){for(var r=0,n=e.options;r<n.length;r++)if(n[r][0]===t)return!0;return!1}function y(e,t,r){if(null==t)return r?e.defaultValue:void 0;if("value"===e.type)return t;if("group"===e.type){for(var n=Object.create(null),i=0,a=Object.keys(e.params);i<a.length;i++){var o=a[i],s=e.params[o];void 0===t[o]?r&&(n[o]=s.defaultValue):n[o]=y(s,t[o],r)}return n}if("mapped"===e.type){var u=t;return"string"==typeof u.name?void 0===u.params?r?e.defaultValue:void 0:v(e.select,u.name)?(s=e.map(u.name),{name:u.name,params:y(s,u.params,r)}):e.defaultValue:e.defaultValue}return"select"===e.type?v(e,t)?t:e.defaultValue:"multi-select"===e.type?Array.isArray(t)?(n=t.filter(function(e){return v(this,e)},e),t.length>0&&0===n.length?e.defaultValue:n):e.defaultValue:"object-list"===e.type?Array.isArray(t)?t.map(function(t){return b(e.element,t,r?"all":"skip")}):e.defaultValue:t}function b(e,t,r){if("object"!=typeof t||!t)return r?s(e):t;for(var n=Object.create(null),i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];void 0===t[o]?"all"===r&&(n[o]=u.defaultValue):n[o]=y(u,t[o],"ski
139p"!==r)}return n}function _(e,t){for(var r=0,n=t;r<n.length;r++)if(n[r][0]===e)return e;return t.length>0?t[0][0]:void 0}e.Essential={isEssential:!0},e.Optional=function(e){var t=Ac({},e);return t.isOptional=!0,t},e.Value=function(e,r){return t({type:"value",defaultValue:e},r)},e.Select=r,e.MultiSelect=function(e,r,n){var i=t({type:"multi-select",defaultValue:e,options:r},n);return null!=n&&n.emptyValue&&(i.emptyValue=n.emptyValue),i},e.Boolean=function(e,r){return t({type:"boolean",defaultValue:e},r)},e.Text=function(e,r){return void 0===e&&(e=""),t({type:"text",defaultValue:e},r)},e.Color=function(e,r){var n=t({type:"color",defaultValue:e},r);return null!=r&&r.isExpanded&&(n.isExpanded=r.isExpanded),n},e.ColorList=function(e,r){var n;if("string"==typeof e){var i=sv(e);n={kind:"qualitative"===i.type?"set":"interpolate",colors:i.list}}else n=e;return t({type:"color-list",presetKind:r?.presetKind||"all",defaultValue:n,offsets:!!r?.offsets},r)},e.Vec3=function(e,r,i){return t(n({type:"vec3",defaultValue:e},r),i)},e.Mat4=function(e,r){return t({type:"mat4",defaultValue:e},r)},e.Url=function(e,r){return t({type:"url",defaultValue:"string"==typeof e?Cb.Url(e):Cb.Url(e.url,{body:e.body})},r)},e.File=function(e){var r=t({type:"file",defaultValue:null},e);return null!=e&&e.accept&&(r.accept=e.accept),r},e.FileList=function(e){var r=t({type:"file-list",defaultValue:null},e);return null!=e&&e.accept&&(r.accept=e.accept),r},e.Numeric=function(e,r,i){var a=t(n({type:"number",defaultValue:e},r),i);return null!=i&&i.immediateUpdate&&(a.immediateUpdate=!0),a},e.Interval=function(e,r,i){return t(n({type:"interval",defaultValue:e},r),i)},e.LineGraph=function(e,r){var n=t({type:"line-graph",defaultValue:e},r);return null!=r&&r.getVolume&&(n.getVolume=r.getVolume),n},e.Group=i,e.EmptyGroup=function(e){return i({},e)},e.Mapped=function(e,n,i,a){var o=_(e,n);return t({type:"mapped",defaultValue:{name:o,params:i(o).defaultValue},select:r(o,n,a),map:i},a)},e.MappedStatic=function(e,n,i){var a=i?.options?i.options:Object.keys(n).map(function(e){return[e,n[e].label||Yg(e)]}),o=_(e,a);return t({type:"mapped",defaultValue:{name:o,params:n[o].defaultValue},select:r(o,a,i),map:function(e){return n[e]}},i)},e.ObjectList=function(e,r,n){return t({type:"object-list",element:e,getLabel:r,ctor:a,defaultValue:n?.defaultValue||[]},n)},e.ValueRef=function(e,r,n){return t({type:"value-ref",defaultValue:{ref:n?.defaultRef??"",getValue:o},getOptions:e,resolveRef:r},n)},e.DataRef=function(e){return t({type:"data-ref",defaultValue:{ref:e?.defaultRef??"",getValue:o}},e)},e.Converted=function(e,r,n){return t({type:"converted",defaultValue:r(n.defaultValue),converted:n,fromValue:e,toValue:r},n)},e.Conditioned=function(e,n,i,a,o){var s=Object.keys(n).map(function(e){return[e,e]});return t({type:"conditioned",select:r(i(e),s,o),defaultValue:e,conditionParams:n,conditionForValue:i,conditionedValue:a},o)},e.Script=function(e,r){return t({type:"script",defaultValue:e},r)},e.For=function(e){return 0},e.getDefaultValues=s,e.resolveRefs=f,e.setDefaultValues=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];e[i].isOptional||(e[i].defaultValue=t[i])}},e.clone=function(e){return Vg(e)},e.validate=function(e,t){},e.areEqual=h,e.isParamEqual=p,e.merge=m,e.mergeParam=g,e.normalizeParams=b,e.objectToOptions=function(e,t){for(var r=[],n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];if(t){var o=t(a,e[a]);r.push("string"==typeof o?[a,o]:[a,o[0],o[1]])}else"string"==typeof e[a]?r.push([a,e[a]]):r.push([a,null===t?a:Yg(a)])}return r},e.arrayToOptions=function(e,t){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n];t?r.push([a,t(a)]):r.push([a,null===t?a:Yg(a)])}return r},e.optionLabel=function(e,t){for(var r=0,n=e.options;r<n.length;r++){var i=n[r];if(i[0]===t)return i[1]}return""}})(Ib||={}),function(e){function t(e){var t={create:function(e){return{action:t,params:e}},id:Wd.create22(),definition:e,createDefaultParams:function(t,r){return e.params?Ib.getDefaultValues(e.params(t,r)):{}}};return t}var r;e.create=t,e.fromTransformer=function(e){var r=e.definition;
139return t({from:r.from,display:r.display,params:r.params,isApplicable:e.definition.isApplicable?function(t,r,n){return e.definition.isApplicable(t,n)}:void 0,run:function(t){var r=t.cell,n=t.state,i=t.params,a=n.build().to(r.transform.ref).apply(e,i);return n.updateTree(a)}})},function(e){e.build=function(e){return function(e){return function(r){return t(Ac({from:e.from instanceof Array?e.from:e.from?[e.from]:[],display:"string"==typeof e.display?{name:e.display}:e.display?e.display:{name:"Unnamed State Action"},params:"object"==typeof e.params?function(){return e.params}:e.params?e.params:void 0,isApplicable:e.isApplicable},"function"==typeof r?{run:r}:r))}}(e)}}(r=e.Builder||={}),e.build=r.build}(Db||={}),function(e){var t;e.getParamDefinition=function(e,t,r){return e.definition.params?e.definition.params(t,r):{}},e.is=function(e){return!!e&&"function"==typeof e.toAction&&"function"==typeof e.apply},function(e){e[e.Unchanged=0]="Unchanged",e[e.Updated=1]="Updated",e[e.Recreate=2]="Recreate",e[e.Null=3]="Null"}(t=e.UpdateResult||={});var r,n=new Map,i=new Map;function a(e,t){var r=t.name,a=`${e}.${r}`;if(n.has(a))throw Error(`A transform with id '${r}' is already registered. Please pick a unique identifier for your transforms and/or register them only once. This is to ensure that transforms can be serialized and replayed.`);var o={apply:function(e,t,r){return Rb.create(e,o,t,r)},toAction:function(){return Db.fromTransformer(o)},namespace:e,id:a,definition:t,createDefaultParams:function(e,r){return t.params?Ib.getDefaultValues(t.params(e,r)):{}}};return n.set(a,o),function(e){for(var t=0,r=e.definition.from;t<r.length;t++){var n=r[t];i.has(n.type)?i.get(n.type).push(e):i.set(n.type,[e])}}(o),o}e.getAll=function(){return Array.from(n.values())},e.get=function(e){var t=n.get(e);if(!t)throw Error(`A transformer with signature '${e}' is not registered.`);return t},e.fromType=function(e){return i.get(e)||[]},e.create=a,e.factory=function(e){return function(t){return a(e,t)}},e.builderFactory=function(e){return r.build(e)},function(e){e.build=function(e){return function(t){return function(e,t){return function(r){return a(e,Ac({name:t.name,from:t.from instanceof Array?t.from:[t.from],to:t.to instanceof Array?t.to:[t.to],display:"string"==typeof t.display?{name:t.display}:t.display?t.display:{name:Xg(t.name.replace(/[-]/g," "))},params:"object"==typeof t.params?function(){return t.params}:t.params?t.params:void 0,isDecorator:t.isDecorator},r))}}(e,t)}}}(r=e.Builder||={}),e.build=function(e){return r.build(e)},e.ROOT=a("build-in",{name:"root",from:[],to:[],display:{name:"Root",description:"For internal use."},apply:function(){throw Error("should never be applied")},update:function(){return t.Unchanged}})}(Ob||={}),function(e){function t(e,t,r,n){var i=n&&n.ref?n.ref:Wd.create22(),a=void 0;return n&&n.tags&&(0===(a="string"==typeof n.tags?[n.tags]:n.tags).length?a=void 0:a.sort()),{parent:e,transformer:t,state:n?.state||{},tags:a,ref:i,dependsOn:n&&n.dependsOn,params:r,version:Wd.create22()}}function r(e,t){return!!e.tags&&e.tags.indexOf(t)>=0}function n(e){return e}e.RootRef="-=root=-",e.areStatesEqual=function(e,t){return!!e.isHidden!=!!t.isHidden||!!e.isCollapsed!=!!t.isCollapsed||!!e.isGhost!=!!t.isGhost||!!e.isLocked!=!!t.isLocked},e.isStateChange=function(e,t){return!!t&&(void 0!==t.isCollapsed&&e.isCollapsed!==t.isCollapsed||void 0!==t.isHidden&&e.isHidden!==t.isHidden||void 0!==t.isGhost&&e.isGhost!==t.isGhost||void 0!==t.isLocked&&e.isLocked!==t.isLocked)},e.assignState=function(e,t){if(!t)return!1;for(var r=!1,n=0,i=Object.keys(t);n<i.length;n++){var a=i[n],o=t[a];!!o!=!!e[a]&&(r=!0,e[a]=o)}return r},e.syncState=function(e,t){if(!t)return!1;for(var r=!1,n=0,i=Object.keys(t);n<i.length;n++)!!(u=t[s=i[n]])!=!!e[s]&&(r=!0,void 0===u?delete e[s]:e[s]=u);for(var a=0,o=Object.keys(e);a<o.length;a++){var s,u;!!(u=t[s=o[a]])!=!!e[s]&&(r=!0,void 0===u?delete e[s]:e[s]=u)}return r},e.create=t,e.withParams=function(e,t){return Ac(Ac({},e),{params:t,version:Wd.create22()})},e.withState=function(e,t){return t?Ac(Ac({},e),{state:Ac(Ac({},e.state),t)}):e},e.withTags=function(e,t){var r=void 0;return t&&(0===(r="string"==typeof t?[t]:t).length?r=void 0:r.sort()),Ac(Ac({},e),{tags:r,version:Wd.create22()})},e.withParent=function(e,t){return Ac(Ac({}
139,e),{parent:t,version:Wd.create22()})},e.createRoot=function(r){return t(e.RootRef,Ob.ROOT,{},{ref:e.RootRef,state:r})},e.hasTag=r,e.hasTags=function(e,t){if(!e.tags)return"string"!=typeof t&&0===t.length;if("string"==typeof t)return r(e,t);for(var n=0,i=t;n<i.length;n++){var a=i[n];if(e.tags.indexOf(a)<0)return!1}return!0},e.toJSON=function(e){for(var t=e.transformer.definition.customSerialization?e.transformer.definition.customSerialization.toJSON:n,r=void 0,i=0,a=Object.keys(e.state);i<a.length;i++){var o=a[i];e.state[o]&&(r||={},r[o]=!0)}return{parent:e.parent,transformer:e.transformer.id,params:e.params?t(e.params):void 0,state:r,tags:e.tags,ref:e.ref,dependsOn:e.dependsOn,version:e.version}},e.fromJSON=function(e){var t=Ob.get(e.transformer),r=t.definition.customSerialization?t.definition.customSerialization.fromJSON:n;return{parent:e.parent,transformer:t,params:e.params?r(e.params):void 0,state:e.state||{},tags:e.tags,ref:e.ref,dependsOn:e.dependsOn,version:e.version}}}(Rb||={});var Kb,Zb,Qb=function(){function e(e){this.tree=e,this.transforms=this.tree.transforms,this.children=this.tree.children,this.dependencies=this.tree.dependencies,this.changedNodes=!1,this.changedChildren=!1,this.changedDependencies=!1,this._childMutations=void 0,this._dependencyMutations=void 0,this._stateUpdates=void 0}return Object.defineProperty(e.prototype,"childMutations",{get:function(){return this._childMutations||=new Map,this._childMutations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dependencyMutations",{get:function(){return this._dependencyMutations||=new Map,this._dependencyMutations},enumerable:!1,configurable:!0}),e.prototype.changeNodes=function(){this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable())},e.prototype.changeChildren=function(){this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable())},e.prototype.changeDependencies=function(){this.changedDependencies||(this.changedDependencies=!0,this.dependencies=this.dependencies.asMutable())},Object.defineProperty(e.prototype,"root",{get:function(){return this.transforms.get(Rb.RootRef)},enumerable:!1,configurable:!0}),e.prototype.asTransient=function(){return this.asImmutable().asTransient()},e.prototype.addChild=function(e,t){if(this.changeChildren(),this.childMutations.has(e))this.childMutations.get(e).add(t);else{var r=this.children.get(e).asMutable();r.add(t),this.children.set(e,r),this.childMutations.set(e,r)}},e.prototype.removeChild=function(e,t){if(this.changeChildren(),this.childMutations.has(e))this.childMutations.get(e).remove(t);else{var r=this.children.get(e).asMutable();r.remove(t),this.children.set(e,r),this.childMutations.set(e,r)}},e.prototype.clearRoot=function(){var e=Rb.RootRef;if(0!==this.children.get(e).size){this.changeChildren();var t=og();this.children.set(e,t),this.childMutations.set(e,t)}},e.prototype.mutateDependency=function(e,t,r){var n=this.dependencyMutations.get(e);if(!n){var i=this.dependencies.get(e);if(!i&&"remove"===r)return;this.changeDependencies(),n=i?i.asMutable():og().asMutable(),this.dependencyMutations.set(e,n),this.dependencies.set(e,n)}"add"===r?n.add(t):n.remove(t)},e.prototype.changeParent=function(e,t){t_(this.transforms,e);var r=this.transforms.get(e);this.removeChild(r.parent,e),this.addChild(t,e),this.changeNodes(),this.transforms.set(e,Rb.withParent(r,t))},e.prototype.add=function(e){var t=e.ref;this.transforms.has(e.ref)&&this.transforms.get(e.ref).parent!==e.parent&&function(e){throw Error(`Transform '${e}' is already present in the tree.`)}(e.ref);var r=this.children.get(e.parent);if(r||function(e){throw Error(`Parent '${e}' must be present in the tree.`)}(e.parent),r.has(e.ref)||this.addChild(e.parent,e.ref),this.children.has(e.ref)||(this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable()),this.children.set(e.ref,og())),this.changeNodes(),this.transforms.set(t,e),e.dependsOn)for(var n=0,i=e.dependsOn;n<i.length;n++){var a=i[n];this.mutateDependency(a,t,"add")}return this},e.prototype.setParams=function(e,t){t_(this.transforms,e);var r=this.transforms.get(e);return!Gg(r.params,t)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,Rb.withParams(r,t)),!0)},e.prototype.setTags=function(e,t){t_(this.transforms,e);var r=this.transforms.get(e),n=Rb.withParams(r,t);return!Xb(r.tags,n.tags)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,n),!0)},e.prototype.assignState=function(e,t){t_(this.transforms,e);var r=this.transforms.get(e);if(this._stateUpdates&&this._stateUpdates.has(e))return Rb.assignState(r.state,t),r;this._stateUpdates||=new Set,this._stateUpdates.add(r.ref),this.changeNodes();var n=Rb.withState(r,t);return this.transforms.set(e,n),n},e.prototype.remove=function(e){var t=this.transforms.get(e);if(!t)return[];var r=Kb.subtreePostOrder(this,t);if(e===Rb.RootRef){if(r.pop(),0===r.length)return r;this.clearRoot()}else{if(0===r.length)return r;this.removeChild(t.parent,t.ref)}this.changeNodes(),this.changeChildren();for(var n=0,i=r;n<i.length;n++){var a=i[n];this.transforms.delete(a.ref),this.children.delete(a.ref),this._childMutations&&this._childMutations.delete(a.ref)}for(var o=[],s=0,u=r;s<u.length;s++){if((a=u[s]).dependsOn)for(var c=0,l=a.dependsOn;c<l.length;c++){var d=l[c];this.transforms.has(d)&&this.mutateDependency(d,a.ref,"remove")}if(this.dependencies.has(a.ref)){var f=this.dependencies.get(a.ref).toArray();this.changeDependencies(),this.dependencies.delete(a.ref),this._dependencyMutations&&this._dependencyMutations.delete(a.ref);for(var h=0,p=f;h<p.length;h++){var m=p[h];if(this.transforms.has(m))for(var g=0,v=this.remove(m);g<v.length;g++){var y=v[g];o[o.length]=y}}}}for(var b=0,_=o;b<_.length;b++)m=_[b],r[r.length]=m;return r},e.prototype.asImmutable=function(){return this.changedNodes||this.changedChildren||this._childMutations?(this._childMutations&&this._childMutations.forEach(Jb,this.children),this._dependencyMutations&&this._dependencyMutations.forEach(e_,this.dependencies),Kb.create(this.changedNodes?this.transforms.asImmutable():this.transforms,this.changedChildren?this.children.asImmutable():this.children,this.changedDependencies?this.dependencies.asImmutable():this.dependencies)):this.tree},e}();function Jb(e,t){this.set(t,e.asImmutable())}function e_(e,t){0===e.size?this.delete(t):this.set(t,e.asImmutable())}function t_(e,t){if(!e.has(t))throw Error(`Node '${t}' is not present in the tree.`)}function r_(e){return"function"==typeof e}function n_(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}(function(e){var t=function(){function e(e,t,r){this.transforms=e,this.children=t,this.dependencies=r}return Object.defineProperty(e.prototype,"root",{get:function(){return this.transforms.get(Rb.RootRef)}
139,enumerable:!1,configurable:!0}),e.prototype.asTransient=function(){return new Qb(this)},e}();function r(e,r,n){return new t(e,r,n)}function n(e){i(this,this.tree.transforms.get(e))}function i(e,t){var r=e.tree.children.get(t.ref);r&&r.size&&r.forEach(n,e),e.f(t,e.tree,e.state)}function a(e,t,r,n){var a={tree:e,state:r,f:n};return i(a,t),a.state}function o(e){s(this,this.tree.transforms.get(e))}function s(e,t){var r=e.f(t,e.tree,e.state);if("boolean"!=typeof r||r){var n=e.tree.children.get(t.ref);n&&n.size&&n.forEach(o,e)}}function u(e,t,r,n){var i={tree:e,state:r,f:n};return s(i,t),i.state}function c(e,t,r){r.push(e)}function l(e,t,r){r.push(Rb.toJSON(e))}function d(e,t,r){if(t===r)return!0;for(var n=e.children.get(t).values();;){var i=n.next();if(i.done)return!1;if(d(e,i.value,r))return!0}}e.createEmpty=function(e){var t=e||Rb.createRoot();return r(Np([[t.ref,t]]),Np([[t.ref,og()]]),Np())},e.create=r,e.doPostOrder=a,e.doPreOrder=u,e.subtreePostOrder=function(e,t){return a(e,t,[],c)},e.toJSON=function(e){var t=[];return u(e,e.root,t,l),{transforms:t}},e.fromJSON=function(e){for(var t=Np().asMutable(),n=Np().asMutable(),i=Np().asMutable(),a=0,o=e.transforms;a<o.length;a++){var s=o[a],u=Rb.fromJSON(s);t.set(u.ref,u),n.has(u.ref)||n.set(u.ref,og().asMutable()),u.ref!==u.parent&&n.get(u.parent).add(u.ref)}for(var c=new Set,l=0,d=e.transforms;l<d.length;l++){var f=(s=d[l]).ref;if(n.set(f,n.get(f).asImmutable()),s.dependsOn)for(var h=0,p=s.dependsOn;h<p.length;h++){var m=p[h];c.add(m),i.has(m)?i.get(m).add(f):i.set(m,og([f]).asMutable())}}return c.forEach(function(e){i.set(e,i.get(e).asImmutable())}),r(t.asImmutable(),n.asImmutable(),i.asImmutable())},e.dump=function(e){console.log({tr:e.transforms.keySeq().toArray(),tr1:e.transforms.valueSeq().toArray().map(function(e){return e.ref}),ch:e.children.keySeq().toArray()})},e.subtreeHasRef=function(e,t,r){return!(!e.transforms.has(t)||!e.transforms.has(r))&&d(e,t,r)},e.getDecoratorRoot=function e(t,r){var n=t.children.get(r);if(1!==n.size)return r;var i=t.transforms.get(n.first());return i.transformer.definition.isDecorator?e(t,i.ref):r}})(Kb||={}),function(e){function t(e,t){return r(e)(t)}function r(e){var t=e||n.root;return void 0===t.compile?function(e){return void 0!==e.transform&&void 0!==e.status}(t)?n.byValue(t).compile():function(e){return"function"==typeof e}(t)?t:n.byRef(t).compile():t.compile()}e.select=t,e.compile=r;var n,i={select:function(e){return t(this,e||this.state)}};function a(e,t){i[e]=function(){var e=[...arguments];return t.call.apply(t,kc([void 0,this],e,!1))}}function o(e){return Object.create(i,{compile:{writable:!1,configurable:!1,value:e}})}function s(e,t){var n=r(e);return o(function(){return function(e){for(var r=[],i=0,a=n(e);i<a.length;i++)for(var o=a[i],s=0,u=t(o,e);s<u.length;s++){var c=u[s];r.push(c)}return r}})}function u(e,t){var n=r(e);return o(function(){return function(e){for(var r=[],i=0,a=n(e);i<a.length;i++){var o=a[i],s=t(o,e);s&&r.push(s)}return r}})}function c(e){var t=r(e);return o(function(){return function(e){for(var r=new Set,n=[],i=0,a=t(e);i<a.length;i++){var o=a[i];o&&(r.has(o.transform.ref)||(r.add(o.transform.ref),n.push(o)))}return n}})}function l(e){var t=r(e);return o(function(){return function(e){var r=t(e);return r.length?[r[0]]:[]}})}function d(e,t){return s(e,function(e){return t(e)?[e]:[]})}function f(e,t){return d(e,function(e){return e.status===t})}function h(e,t){return d(e,function(e){return!!e.transform.tags&&e.transform.tags.indexOf(t)>=0})}function p(e){return s(e,function(e,t){var r=[];return Kb.doPreOrder(t.tree,t.tree.transforms.get(e.transform.ref),r,function(e,t,r){r.push(e.ref)}),r.map(function(e){return t.cells.get(e)})})}function m(e){return s(e,function(e,t){var r=[];return t.tree.children.get(e.transform.ref).forEach(function(e){return r.push(t.cells.get(e))}),r})}function g(e,t){return d(e,function(e){return!!e.obj&&e.obj.type===t.type})}function v(e,t){return c(u(e,function(e,r){return C(r.tree,r.cells,e.transform.ref,t)}))}function y(e,t){return c(u(e,function(e,r){return E(r.tree,r.cells,e.transform.ref,t)}))}function b(e,t){return c(u(e,function(e,r){return P(r.tree,r.cells,e.transform.ref,t)}))}function _(e,t){return d(e,function(e){return e.transform.transformer===t})}function x(e,t){return c(u(e,function(e,r){return T(r.tree,r.cells,e.transform.ref,t)}))}function S(e,t){return c(u(e,function(e,r){return M(r.tree,r.cells,e.transform.ref,t)}))}function w(e){return c(u(e,function(e,t){return t.cells.get(t.tree.transforms.get(e.transform.ref).parent)}))}function A(e,t,r,n,i){for(var a=e.transforms.get(r),o=void 0;;){a=e.transforms.get(a.parent);var s=t.get(a.ref);
139if(s.obj&&n(s)&&(o=s,i)||a.ref===Rb.RootRef)return o}}function C(e,t,r,n){return A(e,t,r,n,!0)}function T(e,t,r,n){return A(e,t,r,n,!1)}function P(e,t,r,n){return C(e,t,r,Array.isArray(n)?function(e){return n.indexOf(e.transform.transformer)>=0}:function(e){return e.transform.transformer===n})}function E(e,t,r,n){return C(e,t,r,k(n))}function M(e,t,r,n){return T(e,t,r,k(n))}function k(e){return Array.isArray(e)?function(t){for(var r=0,n=e;r<n.length;r++)if(n[r].type===t.obj.type)return!0}:function(t){return t.obj.type===e.type}}function I(e,t,r){if(e.tags)for(var n=0,i=e.tags;n<i.length;n++){var a=i[n];if(r.tags.has(a)){r.refs[a]=e.ref;break}}return!0}function D(e,t,r){return!(e.tags&&e.tags.indexOf(r.tag)>=0&&(r.ref=e.ref,1))}function O(e,t,r){if(e.tags)for(var n=r.tags.size,i=0,a=0,o=e.tags;a<o.length;a++){var s=o[a];if(r.tags.has(s)&&++i===n){r.refs.push(e);break}}else 0===r.tags.size&&r.refs.push(e)}(function(e){function t(e,t,r){var n=r.cells.get(e.ref);return!n||!n.obj||n.obj.type!==r.type||(r.roots.push(n),!1)}function r(e,t,r){var n=r.cells.get(e.ref);return n&&n.obj&&n.obj.type===r.type&&r.ret.push(n),!0}function n(e,t,r){var n=r.cells.get(e.ref);return n&&n.obj&&n.transform.transformer===r.t&&r.ret.push(n),!0}function i(e,t,r){var n=r.cells.get(e.ref);return n&&"error"===n.status&&n.transform.transformer===r.t&&r.ret.push(n),!0}e.root=o(function(){return function(e){return[e.cells.get(e.tree.root.ref)]}}),e.byRef=function(){var e=[...arguments];return o(function(){return function(t){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n],o=t.cells.get(a);o&&r.push(o)}return r}})},e.byValue=function(){var e=[...arguments];return o(function(){return function(t){return e}})},e.rootsOfType=function(e,r){return void 0===r&&(r=Rb.RootRef),o(function(){return function(n){var i={roots:[],cells:n.cells,type:e.type};return Kb.doPreOrder(n.tree,n.tree.transforms.get(r),i,t),i.roots}})},e.ofType=function(e,t){return void 0===t&&(t=Rb.RootRef),o(function(){return function(n){var i={ret:[],cells:n.cells,type:e.type};return Kb.doPreOrder(n.tree,n.tree.transforms.get(t),i,r),i.ret}})},e.ofTransformer=function(e,t){return void 0===t&&(t=Rb.RootRef),o(function(){return function(r){var i={ret:[],cells:r.cells,t:e};return Kb.doPreOrder(r.tree,r.tree.transforms.get(t),i,n),i.ret}})},e.ofTransformerWithError=function(e,t){return void 0===t&&(t=Rb.RootRef),o(function(){return function(r){var n={ret:[],cells:r.cells,t:e};return Kb.doPreOrder(r.tree,r.tree.transforms.get(t),n,i),n.ret}})}})(n=e.Generators||={}),a("flatMap",s),e.flatMap=s,a("mapObject",u),e.mapObject=u,a("unique",c),e.unique=c,a("first",l),e.first=l,a("filter",d),e.filter=d,a("withStatus",f),e.withStatus=f,a("withTag",h),e.withTag=h,a("subtree",p),e.subtree=p,a("children",m),e.children=m,a("ofType",g),e.ofType=g,a("ancestor",v),e.ancestor=v,a("ancestorOfType",y),e.ancestorOfType=y,a("ancestorWithTransformer",b),e.ancestorWithTransformer=b,a("withTransformer",_),e.withTransformer=_,a("root",x),e.root=x,a("rootOfType",S),e.rootOfType=S,a("parent",w),e.parent=w,e.findAncestor=C,e.findRoot=T,e.findAncestorWithTransformer=P,e.findAncestorOfType=E,e.findRootOfType=M,e.findUniqueTagsInSubtree=function(e,t,r){return Kb.doPreOrder(e,e.transforms.get(t),{refs:{},tags:r},I).refs},e.findTagInSubtree=function(e,t,r){return Kb.doPreOrder(e,e.transforms.get(t),{ref:void 0,tag:r},D).ref},e.findWithAllTags=function(e,t,r){return Kb.doPreOrder(e,e.transforms.get(t),{refs:[],tags:r},O).refs},e.tryFindDecorator=function e(t,r,n){if(t.transforms.get(r).transformer===n)return t.cells.get(r);var i=t.tree.children.get(r);if(1===i.size){var a=i.first();return t.transforms.get(a).transformer.definition.isDecorator?e(t,a,n):void 0}}}(Zb||={});var i_=n_(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t}});function a_(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var o_=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=Ec(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var u=this.initialTeardown;
vendor: 1,085 bytes, line 139
139if(r_(u))try{u()}catch(e){i=e instanceof i_?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=Ec(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{c_(f)}catch(e){i??=[],e instanceof i_?i=kc(kc([],Mc(i)),Mc(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(i)throw new i_(i)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)c_(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&a_(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&a_(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),s_=o_.EMPTY;
139function u_(e){return e instanceof o_||e&&"closed"in e&&r_(e.remove)&&r_(e.add)&&r_(e.unsubscribe)}function c_(e){r_(e)?e():e.unsubscribe()}var l_={setTimeout:function(e,t){var r=[...arguments].slice(2);return setTimeout.apply(void 0,kc([e,t],Mc(r)))},clearTimeout:function(e){return(l_.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function d_(e){l_.setTimeout(function(){throw e})}function f_(){}function h_(e){e()}var p_=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,u_(t)&&t.add(r)):r.destination=y_,r}return wc(t,e),t.create=function(e,t,r){return new g_(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(o_);Function.prototype.bind;var m_=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){v_(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){v_(e)}else v_(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){v_(e)}},e}(),g_=function(e){function t(t,r,n){var i,a=e.call(this)||this;return i=r_(t)||!t?{next:t??void 0,error:r??void 0,complete:n??void 0}:t,a.destination=new m_(i),a}return wc(t,e),t}(p_);function v_(e){d_(e)}var y_={closed:!0,next:f_,error:function(e){throw e},complete:f_},b_="function"==typeof Symbol&&Symbol.observable||"@@observable";function __(e){return e}var x_=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,i=this,a=(n=e)&&n instanceof p_||function(e){return e&&r_(e.next)&&r_(e.error)&&r_(e.complete)}(n)&&u_(n)?e:new g_(e,t,r);return h_(function(){var e=i,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?i._subscribe(a):i._trySubscribe(a))}),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=S_(t))(function(t,n){var i=new g_({next:function(t){try{e(t)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t});r.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[b_]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?__:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=S_(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function S_(e){return e??void 0??Promise}function w_(e){return function(t){if(function(e){return r_(e?.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}function A_(e,t,r,n,i){return new C_(e,t,r,n,i)}var C_=function(e){function t(t,r,n,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return wc(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null==(t=this.onFinalize)||t.call(this))}},t}(p_),T_=n_(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),P_=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return wc(t,e),t.prototype.lift=function(e){var t=new E_(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new T_},t.prototype.next=function(e){var t=this;h_(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=Ec(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;h_(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;h_(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){return this.observers?.length>0}
139,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,a=r.observers;return n||i?s_:(this.currentObservers=null,a.push(e),new o_(function(){t.currentObservers=null,a_(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new x_;return e.source=this,e},t.create=function(e,t){return new E_(e,t)},t}(x_),E_=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return wc(t,e),t.prototype.next=function(e){var t,r;null==(r=(t=this.destination)?.next)||r.call(t,e)},t.prototype.error=function(e){var t,r;null==(r=(t=this.destination)?.error)||r.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=(e=this.destination)?.complete)||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??s_},t}(P_),M_=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return wc(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(P_),k_=function(){return Date.now()},I_=function(e){function t(t,r){return e.call(this)||this}return wc(t,e),t.prototype.schedule=function(e,t){return this},t}(o_),D_={setInterval:function(e,t){var r=[...arguments].slice(2);return setInterval.apply(void 0,kc([e,t],Mc(r)))},clearInterval:function(e){return(D_.delegate?.clearInterval||clearInterval)(e)},delegate:void 0},O_=function(e){function t(t,r){var n=e.call(this,t,r)||this;
139return n.scheduler=t,n.work=r,n.pending=!1,n}return wc(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),D_.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&D_.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,a_(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(I_),R_=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=k_,e}(),B_=new(function(e){function t(t,r){void 0===r&&(r=R_.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return wc(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(R_))(O_),N_=B_,F_=new x_(function(e){return e.complete()});function L_(e){return e&&r_(e.schedule)}function $_(e){return e[e.length-1]}var U_=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function j_(e){return r_(e?.then)}function z_(e){return r_(e[b_])}function G_(e){return Symbol.asyncIterator&&r_(e?.[Symbol.asyncIterator])}function V_(e){return TypeError("You provided "+("object"==typeof e&&e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var H_,q_="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function W_(e){return r_(e?.[q_])}function X_(e){return function(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),a=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(e){i[e]&&(n[e]=function(t){return new Promise(function(r,n){a.push([e,t,r,n])>1||s(e,t)})})}function s(e,t){try{!function(e){e.value instanceof Ic?Promise.resolve(e.value.v).then(u,c):l(a[0][2],e)}(i[e](t))}catch(e){l(a[0][3],e)}}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}(this,arguments,function(){var t,r,n;return Pc(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Ic(t.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,Ic(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ic(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Y_(e){return r_(e?.getReader)}function K_(e){if(e instanceof x_)return e;if(null!=e){if(z_(e))return n=e,new x_(function(e){var t=n[b_]();if(r_(t.subscribe))return t.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")});if(U_(e))return function(e){return new x_(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}(e);if(j_(e))return r=e,new x_(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,d_)});if(G_(e))return Z_(e);if(W_(e))return t=e,new x_(function(e){var r,n;try{for(var i=Ec(t),a=i.next();!a.done;a=i.next()){var o=a.value;if(e.next(o),e.closed)return}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.complete()});if(Y_(e))return Z_(X_(e))}var t,r,n;throw V_(e)}function Z_(e){return new x_(function(t){(function(e,t){var r,n,i,a;return Tc(this,void 0,void 0,function(){var o,s;return Pc(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Ec(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}}(e),u.label=1;case 1:return[4,r.next()];case 2:if((n=u.sent()).done)return[3,4];if(o=n.value,t.next(o),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=u.sent(),i={error:s},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];
139case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function Q_(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var a=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!i)return a}function J_(e,t){return void 0===t&&(t=0),w_(function(r,n){r.subscribe(A_(n,function(r){return Q_(n,e,function(){return n.next(r)},t)},function(){return Q_(n,e,function(){return n.complete()},t)},function(r){return Q_(n,e,function(){return n.error(r)},t)}))})}function ex(e,t){return void 0===t&&(t=0),w_(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function tx(e,t){if(!e)throw Error("Iterable cannot be null");return new x_(function(r){Q_(r,t,function(){var n=e[Symbol.asyncIterator]();Q_(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function rx(e,t){return w_(function(r,n){var i=0;r.subscribe(A_(n,function(r){n.next(e.call(t,r,i++))}))})}function nx(e,t,r){return void 0===r&&(r=1/0),r_(t)?nx(function(r,n){return rx(function(e,i){return t(r,e,n,i)})(K_(e(r,n)))},r):("number"==typeof t&&(r=t),w_(function(t,n){return function(e,t,r,n){var i=[],a=0,o=0,s=!1,u=function(){!s||i.length||a||t.complete()},c=function(e){a++;var s=!1;K_(r(e,o++)).subscribe(A_(t,function(e){t.next(e)},function(){s=!0},void 0,function(){if(s)try{for(a--;i.length&&a<n;)e=i.shift(),c(e);u()}catch(e){t.error(e)}var e}))};return e.subscribe(A_(t,function(e){return a<n?c(e):i.push(e)},function(){s=!0,u()})),function(){}}(t,n,e,r)}))}function ix(){var e=[...arguments],t=function(e){return L_($_(e))?e.pop():void 0}(e),r=function(e){return"number"==typeof $_(e)?e.pop():1/0}(e),n=e;return n.length?1===n.length?K_(n[0]):function(e){return void 0===e&&(e=1/0),nx(__,e)}(r)(function(e,t){return t?function(e,t){if(null!=e){if(z_(e))return function(e,t){return K_(e).pipe(ex(t),J_(t))}(e,t);if(U_(e))return function(e,t){return new x_(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(j_(e))return function(e,t){return K_(e).pipe(ex(t),J_(t))}(e,t);if(G_(e))return tx(e,t);if(W_(e))return function(e,t){return new x_(function(r){var n;return Q_(r,t,function(){n=e[q_](),Q_(r,t,function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){return void r.error(e)}i?r.complete():r.next(t)},0,!0)}),function(){return r_(n?.return)&&n.return()}})}(e,t);if(Y_(e))return function(e,t){return tx(X_(e),t)}(e,t)}throw V_(e)}(e,t):K_(e)}(n,t)):F_}function ax(e,t){return w_(function(r,n){var i=0;r.subscribe(A_(n,function(r){return e.call(t,r,i++)&&n.next(r)}))})}function ox(e){return e<=0?function(){return F_}:w_(function(t,r){var n=0;t.subscribe(A_(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function sx(e,t){return e===t}function ux(e,t,r){void 0===t&&(t=B_);var n=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r=N_);var n=-1;return null!=t&&(L_(t)?r=t:n=t),new x_(function(t){var i,a=(i=e)instanceof Date&&!isNaN(i)?+e-r.now():e;a<0&&(a=0);var o=0;return r.schedule(function(){t.closed||(t.next(o++),0<=n?this.schedule(void 0,n):t.complete())},a)})}(e,t);return function(e,t){return w_(function(r,n){var i=t??{},a=i.leading,o=void 0===a||a,s=i.trailing,u=void 0!==s&&s,c=!1,l=null,d=null,f=!1,h=function(){d?.unsubscribe(),d=null,u&&(g(),f&&n.complete())},p=function(){d=null,f&&n.complete()},m=function(t){return d=K_(e()).subscribe(A_(n,h,p))},g=function(){if(c){c=!1;var e=l;l=null,n.next(e),!f&&m()}};r.subscribe(A_(n,function(e){c=!0,l=e,(!d||d.closed)&&(o?g():m())},function(){f=!0,(!(u&&c&&d)||d.closed)&&n.complete()}))})}(function(){return n},r)}!function(e){e.create=function(){var e=new cx,t=function(){return e.create()};return t.dispose=function(){return e.dispose()},t.behavior=function(t){return e.behavior(t)},t}}(H_||={});var cx=function(){function e(){this._eventList=[],this._disposed=!1}return e.prototype.create=function(){var e=new P_;return this._eventList.push(e),e},e.prototype.behavior=function(e){var t=new M_(e);return this._eventList.push(t),t},e.prototype.dispose=function(){if(!this._disposed){for(var e=0,t=this._eventList;e<t.length;e++)t[e].complete();this._disposed=!0}},e}();function lx(e){var t=[...arguments].slice(1);throw Error("[Immer] minified error nr: "+e+(t.length?" "+t.map(function(e){return"'"+e+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function dx(e){return!!e&&!!e[Yx]}function fx(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===Kx}(e)||Array.isArray(e)||!!e[Xx]||!!e.constructor?.[Xx]||vx(e)||yx(e))}function hx(e,t,r){void 0===r&&(r=!1),0===px(e)?(r?Object.keys:Zx)(e).forEach(function(n){r&&"symbol"==typeof n||t(n,e[n],e)}):e.forEach(function(r,n){return t(n,r,e)})}function px(e){var t=e[Yx];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:vx(e)?2:yx(e)?3:0}function mx(e,t){return 2===px(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function gx(e,t,r){var n=px(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function vx(e){return Vx&&e instanceof Map}function yx(e){return Hx&&e instanceof Set}function bx(e){return e.o||e.t}function _x(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Qx(e);delete t[Yx];for(var r=Zx(t),n=0;n<r.length;n++){var i=r[n],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function xx(e,t){return void 0===t&&(t=!1),wx(e)||dx(e)||!fx(e)||(px(e)>1&&(e.set=e.add=e.clear=e.delete=Sx),Object.freeze(e),t&&hx(e,function(e,t){return xx(t,!0)},!0)),e}function Sx(){lx(2)}function wx(e){return"object"!=typeof e||!e||Object.isFrozen(e)}function Ax(e){var t=Jx[e];return t||lx(18,e),t}function Cx(){return zx}function Tx(e,t){t&&(Ax("Patches"),e.u=[],e.s=[],e.v=t)}function Px(e){Ex(e),e.p.forEach(kx),e.p=null}function Ex(e){e===zx&&(zx=e.l)}function Mx(e){return zx={p:[],l:zx,h:e,m:!0,_:0}}function kx(e){var t=e[Yx];0===t.i||1===t.i?t.j():t.g=!0}function Ix(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||Ax("ES5").S(t,e,n),n?(r[Yx].P&&(Px(t),lx(4)),fx(e)&&(e=Dx(t,e),t.l||Rx(t,e)),t.u&&Ax("Patches").M(r[Yx].t,e,t.u,t.s)):e=Dx(t,r,[]),Px(t),t.u&&t.v(t.u,t.s),e===Wx?void 0:e}function Dx(e,t,r){if(wx(t))return t;var n=t[Yx];if(!n)return hx(t,function(i,a){return Ox(e,n,t,i,a,r)},!0),t;if(n.A!==e)return t;if(!n.P)return Rx(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=_x(n.k):n.o,a=i,o=!1;3===n.i&&(a=new Set(i),i.clear(),o=!0),hx(a,function(t,a){return Ox(e,n,i,t,a,r,o)}),Rx(e,i,!1),r&&e.u&&Ax("Patches").N(n,r,e.u,e.s)}return n.o}function Ox(e,t,r,n,i,a,o){if(dx(i)){var s=Dx(e,i,a&&t&&3!==t.i&&!mx(t.R,n)?a.concat(n):void 0);if(gx(r,n,s),!dx(s))return;e.m=!1}else o&&r.add(i);if(fx(i)&&!wx(i)){if(!e.h.D&&e._<1)return;Dx(e,i),t&&t.A.l||Rx(e,i)}}function Rx(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&xx(t,r)}function Bx(e,t){var r=e[Yx];return(r?bx(r):e)[t]}function Nx(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function Fx(e){e.P||(e.P=!0,e.l&&Fx(e.l))}function Lx(e){e.o||=_x(e.t)}function $x(e,t,r){var n=vx(t)?Ax("MapSet").F(t,r):yx(t)?Ax("MapSet").T(t,r):e.O?function(e,t){var r=Array.isArray(e),n={i:+!!r,A:t?t.A:Cx(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=n,a=eS;r&&(i=[n],a=tS);var o=Proxy.revocable(i,a),s=o.revoke,u=o.proxy;return n.k=u,n.j=s,u}(t,r):Ax("ES5").J(t,r);return(r?r.A:Cx()).p.push(n),n}function Ux(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return _x(e)}var jx,zx,Gx=typeof Symbol<"u"&&"symbol"==typeof Symbol("x"),Vx=typeof Map<"u",Hx=typeof Set<"u",qx=typeof Proxy<"u"&&void 0!==Proxy.revocable&&typeof Reflect<"u",Wx=Gx?Symbol.for("immer-nothing"):((jx={})["immer-nothing"]=!0,jx),Xx=Gx?Symbol.for("immer-draftable"):"__$immer_draftable",Yx=Gx?Symbol.for("immer-state"):"__$immer_state",Kx=""+Object.prototype.constructor,Zx=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:void 0===Object.getOwnPropertySymbols?Object.getOwnPropertyNames:function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))},Qx=Object.getOwnPropertyDescriptors||function(e){var t={};return Zx(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},Jx={},eS={get:function(e,t){if(t===Yx)return e;var r=bx(e);if(!mx(r,t))return function(e,t,r){var n=Nx(t,r);return n?"value"in n?n.value:n.get?.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!fx(n)?n:n===Bx(e.t,t)?(Lx(e),e.o[t]=$x(e.A.h,n,e)):n},has:function(e,t){return t in bx(e)},ownKeys:function(e){return Reflect.ownKeys(bx(e))},set:function(e,t,r){var n=Nx(bx(e),t);if(n?.set)return n.set.call(e.k,r),!0;if(!e.P){var i=Bx(bx(e),t),a=i?.[Yx];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,i)&&(void 0!==r||mx(e.t,t)))return!0;Lx(e),Fx(e)}return e.o[t]===r&&(void 0!==r||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==Bx(e.t,t)||t in e.t?(e.R[t]=!1,Lx(e),Fx(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=bx(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty:function(){lx(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){lx(12)}},tS={};hx(eS,function(e,t){tS[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),tS.deleteProperty=function(e,t){return tS.set.call(this,e,t,void 0)},tS.set=function(e,t,r){return eS.set.call(this,e[0],t,r,e[0])};var rS=new(function(){function e(e){var t=this;this.O=qx,this.D=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var i=r;r=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);var n=[...arguments].slice(1);return a.produce(e,function(e){var i;return(i=r).call.apply(i,[t,e].concat(n))})}}var o;if("function"!=typeof r&&lx(6),void 0!==n&&"function"!=typeof n&&lx(7),fx(e)){var s=Mx(t),u=$x(t,e,void 0),c=!0;try{o=r(u),c=!1}finally{c?Px(s):Ex(s)}return typeof Promise<"u"&&o instanceof Promise?o.then(function(e){return Tx(s,n),Ix(e,s)},function(e){throw Px(s),e}
139):(Tx(s,n),Ix(o,s))}if(!e||"object"!=typeof e){if(void 0===(o=r(e))&&(o=e),o===Wx&&(o=void 0),t.D&&xx(o,!0),n){var l=[],d=[];Ax("Patches").M(e,o,l,d),n(l,d)}return o}lx(21,e)},this.produceWithPatches=function(e,r){if("function"==typeof e)return function(r){var n=[...arguments].slice(1);return t.produceWithPatches(r,function(t){return e.apply(void 0,[t].concat(n))})};var n,i,a=t.produce(e,r,function(e,t){n=e,i=t});return typeof Promise<"u"&&a instanceof Promise?a.then(function(e){return[e,n,i]}):[a,n,i]},"boolean"==typeof e?.useProxies&&this.setUseProxies(e.useProxies),"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){fx(e)||lx(8),dx(e)&&(e=function(e){return dx(e)||lx(22,e),function e(t){if(!fx(t))return t;var r,n=t[Yx],i=px(t);if(n){if(!n.P&&(n.i<4||!Ax("ES5").K(n)))return n.t;n.I=!0,r=Ux(t,i),n.I=!1}else r=Ux(t,i);return hx(r,function(t,i){n&&function(e,t){return 2===px(e)?e.get(t):e[t]}(n.t,t)===i||gx(r,t,e(i))}),3===i?new Set(r):r}(e)}(e));var t=Mx(this),r=$x(this,e,void 0);return r[Yx].C=!0,Ex(t),r},t.finishDraft=function(e,t){var r=(e&&e[Yx]).A;return Tx(r,t),Ix(void 0,r)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!qx&&lx(20),this.O=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var i=Ax("Patches").$;return dx(e)?i(e,t):this.produce(e,function(e){return i(e,t)})},e}()),nS=rS.produce;rS.produceWithPatches.bind(rS);var iS=rS.setAutoFreeze.bind(rS);rS.setUseProxies.bind(rS),rS.applyPatches.bind(rS),rS.createDraft.bind(rS),rS.finishDraft.bind(rS);var aS,oS=nS;function sS(){for(var e=void 0,t=[],r=0,n=[...arguments];r<n.length;r++){var i=n[r];if(i)if(e||=new Set,"string"==typeof i){if(e.has(i))continue;e.add(i),t.push(i)}else for(var a=0,o=i;a<o.length;a++){var s=o[a];e.has(s)||(e.add(s),t.push(s))}}return t}!function(e){function t(e){if(!e.state||e.state.tree===e.editInfo.sourceTree)return e.tree.asImmutable();for(var t=e.state.tree.asTransient(),r=0,n=e.actions;r<n.length;r++){var i=n[r];switch(i.kind){case"add":t.add(i.transform);break;case"update":t.setParams(i.ref,i.params);break;case"delete":t.remove(i.ref);break;case"insert":var a=t.children.get(i.ref).toArray();t.add(i.transform);for(var o=0,s=a;o<s.length;o++){var u=s[o];t.changeParent(u,i.transform.ref)}}}return e.editInfo.sourceTree=e.tree,t.asImmutable()}e.is=function(e){return!!e&&"function"==typeof e.getTree},e.isTo=function(e){return!!e&&"function"==typeof e.getTree&&"string"==typeof e.ref},e.Root=function(){function e(e,t){this.state={state:t,tree:e.asTransient(),actions:[],editInfo:{applied:!1,sourceTree:e,count:0,lastUpdate:void 0}}}return Object.defineProperty(e.prototype,"editInfo",{get:function(){return this.state.editInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTree",{get:function(){return this.state.tree},enumerable:!1,configurable:!0}),e.prototype.to=function(e){var t="string"==typeof e?e:sf.is(e)?e.transform.ref:e.ref;return new r(this.state,t,this)},e.prototype.toRoot=function(){return new r(this.state,this.state.tree.root.ref,this)},e.prototype.delete=function(e){var t=hf.resolveRef(e);return t&&this.state.tree.transforms.has(t)?(this.editInfo.count++,this.state.tree.remove(t),this.state.actions.push({kind:"delete",ref:t}),this):this},e.prototype.getTree=function(){return t(this.state)},e.prototype.commit=function(e){if(!this.state.state)throw Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,e))},e}();var r=function(){function e(e,t,r){if(this.state=e,this.root=r,this.ref=t,!this.state.tree.transforms.has(t))throw Error(`Could not find node '${t}'.`)}return Object.defineProperty(e.prototype,"editInfo",{get:function(){return this.state.editInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selector",{get:function(){return new pf(this.ref,this.state.state)},enumerable:!1,configurable:!0}),e.prototype.getApplyRoot=function(){return Kb.getDecoratorRoot(this.state.tree,this.ref)},e.prototype.apply=function(t,r,n){if(t.definition.isDecorator)return this.insert(t,r,n);
139var i=this.getApplyRoot(),a=t.apply(i,r,n);return this.state.tree.add(a),this.editInfo.count++,this.editInfo.lastUpdate=a.ref,this.state.actions.push({kind:"add",transform:a}),new e(this.state,a.ref,this.root)},e.prototype.applyOrUpdate=function(e,t,r,n){if(this.state.tree.transforms.has(e)){var i=this.to(e);return r&&i.update(r),i}return this.apply(t,r,Ac(Ac({},n),{ref:e}))},e.prototype.applyOrUpdateTagged=function(t,r,n,i){if(r.definition.isDecorator)throw Error("Can't use applyOrUpdateTagged on decorator transformers.");for(var a=this.getApplyRoot(),o=this.state.tree.children.get(a).values();;){var s=o.next();if(s.done)break;var u=this.state.tree.transforms.get(s.value);if(u&&Rb.hasTags(u,t)){var c=this.to(s.value);return c.updateTagged(n,sS(u.tags,t,i&&i.tags)),c}}var l=r.apply(a,n,Ac(Ac({},i),{tags:sS(t,i&&i.tags)}));return this.state.tree.add(l),this.editInfo.count++,this.editInfo.lastUpdate=l.ref,this.state.actions.push({kind:"add",transform:l}),new e(this.state,l.ref,this.root)},e.prototype.group=function(e,t,r){return this.apply(e,t,r)},e.prototype.insert=function(t,r,n){var i=this.state.tree.children.get(this.ref).toArray(),a=t.apply(this.ref,r,n);this.state.tree.add(a);for(var o=0,s=i;o<s.length;o++){var u=s[o];this.state.tree.changeParent(u,a.ref)}return this.editInfo.count++,this.editInfo.lastUpdate=a.ref,this.state.actions.push({kind:"insert",ref:this.ref,transform:a}),new e(this.state,a.ref,this.root)},e.prototype.updateTagged=function(e,t){(this.state.tree.setParams(this.ref,e)||this.state.tree.setTags(this.ref,t))&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:e}))},e.prototype.update=function(e,t){var r=t?nS(this.state.tree.transforms.get(this.ref).params,t):"function"==typeof e?nS(this.state.tree.transforms.get(this.ref).params,e):e;return this.state.tree.setParams(this.ref,r)&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:r})),this.root},e.prototype.to=function(e){return this.root.to(e)},e.prototype.toRoot=function(){return this.root.toRoot()},e.prototype.delete=function(e){return this.root.delete(e)},e.prototype.getTree=function(){return t(this.state)},e.prototype.commit=function(e){if(!this.state.state)throw Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,e))},e}();e.To=r}(aS||={});var uS,cS,lS=function(){function e(){this.ev=H_.create(),this.actions=new Map,this.fromTypeIndex=new Map,this.events={added:this.ev(),removed:this.ev()}}return e.prototype.add=function(e){var t=Ob.is(e)?e.toAction():e;if(this.actions.has(t.id))return this;this.actions.set(t.id,t);for(var r=0,n=t.definition.from;r<n.length;r++){var i=n[r];this.fromTypeIndex.has(i.type)?this.fromTypeIndex.get(i.type).push(t):this.fromTypeIndex.set(i.type,[t])}return this.events.added.next(void 0),this},e.prototype.remove=function(e){var t=Ob.is(e)?e.toAction().id:Wd.is(e)?e:e.id,r=this.actions.get(t);if(!r)return this;this.actions.delete(t);for(var n=0,i=r.definition.from;n<i.length;n++){var a=i[n],o=this.fromTypeIndex.get(a.type);o&&(qb(o,r),0===o.length&&this.fromTypeIndex.delete(a.type))}return this.events.removed.next(void 0),this},e.prototype.fromCell=function(e,t){var r=e.obj;if(!r)return[];var n=this.fromTypeIndex.get(r.type);if(!n)return[];for(var i=!1,a=0,o=n;a<o.length;a++)if((l=o[a]).definition.isApplicable){i=!0;break}if(!i)return n;for(var s=[],u=0,c=n;u<c.length;u++){var l;(l=c[u]).definition.isApplicable?l.definition.isApplicable(r,e.transform,t)&&s.push(l):s.push(l)}return s},e.prototype.dispose=function(){this.ev.dispose()},e}();(function(e){e.message=function(e){return{type:"message",timestamp:new Date,message:e}},e.error=function(e){return{type:"error",timestamp:new Date,message:e}},e.warning=function(e){return{type:"warning",timestamp:new Date,message:e}},e.info=function(e){return{type:"info",timestamp:new Date,message:e}}})(uS||={}),function(e){e.Impl=function(){function e(e){this.cells=e,this._current=void 0}return Object.defineProperty(e.prototype,"current",{get:function(){return this._current},set:function(e){this._current=e}
139,enumerable:!1,configurable:!0}),e.prototype.getAncestorOfType=function(e){if(this._current)for(var t=this._current;;){if(!(t=this.cells.get(t.transform.parent)).obj)return;if(t.obj.type===e.type)return t.obj;if(t.transform.ref===Rb.RootRef)return}},e.prototype.getRootOfType=function(e){if(this._current)for(var t=this._current,r=void 0;;){if(!t.obj)return;if(t.obj.type===e.type&&(r=t),t.transform.ref===Rb.RootRef)return r?r.obj:void 0;t=this.cells.get(t.transform.parent)}},e}(),e.getDecoratorChain=function(e,t){for(var r=e.cells,n=r.get(t),i=[n];n?.transform.transformer.definition.isDecorator;)n=r.get(n.transform.parent),i.push(n);return i},e.getRootOfType=function(e,t,r){var n=void 0,i=e.cells.get(r);if(i)for(;;){if(!i.obj)return;if(i.obj.type===t.type&&(n=i),i.transform.ref===Rb.RootRef)return n?n.obj:void 0;i=e.cells.get(i.transform.parent)}}}(cS||={});var dS=function(){function e(){this.queue=[],this.signal=new P_}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e){return this.queue.push(e),1===this.queue.length||this.waitFor(e)},e.prototype.handled=function(e){Gb(this.queue,e),this.queue.length>0&&this.signal.next({v:this.queue[0],stillPresent:!0})},e.prototype.remove=function(e){var t=Gb(this.queue,e);return t&&this.signal.next({v:e,stillPresent:!1}),t},e.prototype.waitFor=function(e){var t=this;return new Promise(function(r){var n=t.signal.subscribe(function(t){var i=t.v,a=t.stillPresent;i===e&&(n.unsubscribe(),r(a))})})},e}(),fS=function(){function e(e,t){this.getHash=e,this.areEqual=t,this.size=0,this.byHash=new Map}return e.prototype.add=function(e){var t=this.getHash(e);if(this.byHash.has(t)){for(var r=this.byHash.get(t),n=0,i=r.length;n<i;n++)if(this.areEqual(e,r[n]))return!1;return r[r.length]=e,this.size++,!0}return this.byHash.set(t,[e]),this.size++,!0},e.prototype.has=function(e){var t=this.getHash(e);if(!this.byHash.has(t))return!1;for(var r=this.byHash.get(t),n=0,i=r.length;n<i;n++)if(this.areEqual(e,r[n]))return!0;return!1},e}();function hS(e,t){return new fS(e,t)}function pS(){return new vS}function mS(e){return{previous:null,next:null,inList:!0,value:e}}var gS,vS=function(){function e(){this.count=0,this.first=null,this.last=null}return e.prototype.addFirst=function(e){var t=mS(e);return t.inList=!0,this.first&&(this.first.previous=t),t.next=this.first,this.first=t,this.count++,this.last||=t,t},e.prototype.addLast=function(e){var t=mS(e);return null!==this.last&&(this.last.next=t),t.previous=this.last,this.last=t,null===this.first&&(this.first=t),t.inList=!0,this.count++,t},e.prototype.removeFirst=function(){var e=this.first;if(e)return this.remove(e),e.value},e.prototype.removeLast=function(){var e=this.last;if(e)return this.remove(e),e.value},e.prototype.remove=function(e){e.inList&&(e.inList=!1,null===e.previous?null===e.previous&&(this.first=e.next):e.previous.next=e.next,null===e.next?null===e.next&&(this.last=e.previous):e.next.previous=e.previous,e.next=null,e.previous=null,this.count--)},e.prototype.find=function(e){for(var t=this.first;null!==t;){if(t.value===e)return t;t=t.next}},e}();!function(e){e.create=function(){return{keys:new Set,array:[]}},e.add=function(e,t,r){var n=e.keys,i=e.array;return!n.has(t)&&(n.add(t),i[i.length]=r,!0)},e.has=function(e,t){return e.keys.has(t)}}(gS||={});var yS=function(){function e(e,t){var r=this;this.errorFree=!0,this.ev=H_.create(),this.globalContext=void 0,this.events={cell:{stateUpdated:this.ev(),created:this.ev(),removed:this.ev()},object:{updated:this.ev(),created:this.ev(),removed:this.ev()},log:this.ev(),changed:this.ev(),historyUpdated:this.ev()},this.behaviors={currentObject:this.ev.behavior({state:this,ref:Rb.RootRef}),isUpdating:this.ev.behavior(!1)},this.actions=new lS,this.cells=new Map,this.spine=new cS.Impl(this.cells),this.tryGetCellData=function(e){var t=r.cells.get(e)?.obj?.data;if(void 0===t)throw Error(`Cell '${e}' data undefined.`);return t},this.historyCapacity=5,this.history=[],this.undoingHistory=!1,this.inTransaction=!1,this.inTransactionError=!1,this._inUpdate=!1,this.reverted=!1,this.updateQueue=new dS,this._tree=Kb.createEmpty(Rb.createRoot(t&&t.rootState)).asTransient();var n=this._tree.root;this.runTask=t.runTask,void 0!==t?.historyCapacity&&(this.historyCapacity=t.historyCapacity),this.cells.set(n.ref,{parent:this,transform:n,sourceRef:void 0,obj:e,status:"ok",state:Ac({},n.state),errorText:void 0,params:{definition:{},values:{}}
139,paramsNormalizedVersion:n.version,dependencies:{dependentBy:[],dependsOn:[]},cache:{}}),this.globalContext=t&&t.globalContext}return Object.defineProperty(e.prototype,"tree",{get:function(){return this._tree},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transforms",{get:function(){return this._tree.transforms},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this.behaviors.currentObject.value.ref},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this.cells.get(this._tree.root.ref)},enumerable:!1,configurable:!0}),e.prototype.build=function(){return new aS.Root(this.tree,this)},e.prototype.addHistory=function(e,t){0!==this.historyCapacity&&(this.history.unshift([e,t||"Update"]),this.history.length>this.historyCapacity&&this.history.pop(),this.events.historyUpdated.next({state:this}))},e.prototype.clearHistory=function(){0!==this.history.length&&(this.history=[],this.events.historyUpdated.next({state:this}))},Object.defineProperty(e.prototype,"latestUndoLabel",{get:function(){return this.history.length>0?this.history[0][1]:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canUndo",{get:function(){return this.history.length>0},enumerable:!1,configurable:!0}),e.prototype.undo=function(){var e=this;return vy.create("Undo",function(t){return Tc(e,void 0,void 0,function(){var e;return Pc(this,function(r){switch(r.label){case 0:if(!(e=this.history.shift()))return[2];this.events.historyUpdated.next({state:this}),this.undoingHistory=!0,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.updateTree(e[0],{canUndo:!1}).runInContext(t)];case 2:return r.sent(),[3,4];case 3:return this.undoingHistory=!1,[7];case 4:return[2]}})})})},e.prototype.getSnapshot=function(){return{tree:Kb.toJSON(this._tree)}},e.prototype.setSnapshot=function(e){var t=Kb.fromJSON(e.tree);return this.updateTree(t)},e.prototype.setCurrent=function(e){this.behaviors.currentObject.next({state:this,ref:e})},e.prototype.updateCellState=function(e,t){var r=this.cells.get(e);if(r){var n="function"==typeof t?t(r.state):t;Rb.assignState(r.state,n)&&(r.transform=this._tree.assignState(r.transform.ref,n),this.events.cell.stateUpdated.next({state:this,ref:e,cell:r}))}},e.prototype.dispose=function(){this.ev.dispose(),this.actions.dispose()},e.prototype.select=function(e){return Zb.select(e,this)},e.prototype.selectQ=function(e){return"string"==typeof e?Zb.select(e,this):Zb.select(e(Zb.Generators),this)},e.prototype.applyAction=function(e,t,r){var n=this;return void 0===r&&(r=Rb.RootRef),vy.create("Apply Action",function(i){var a=n.cells.get(r);if(!a)throw Error(`'${r}' does not exist.`);if("ok"!==a.status)throw Error(`Action cannot be applied to a cell with status '${a.status}'`);return qS(e.definition.run({ref:r,cell:a,a:a.obj,params:t,state:n},n.globalContext),i)})},e.prototype.transaction=function(e,t){var r=this;return vy.create("State Transaction",function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o;return Pc(this,function(s){switch(s.label){case 0:r=this.inTransaction,i=this._tree.asImmutable(),a=!1,s.label=1;case 1:return s.trys.push([1,5,8,9]),r||this.behaviors.isUpdating.next(!0),this.inTransaction=!0,this.inTransactionError=!1,[4,e(n)];case 2:return s.sent(),this.inTransactionError?(a=!0,[4,this.updateTree(i).runInContext(n)]):[3,4];case 3:s.sent(),s.label=4;case 4:return[3,9];case 5:return o=s.sent(),a?[3,7]:(a=!0,[4,this.updateTree(i).runInContext(n)]);case 6:s.sent(),this.events.log.next(uS.error("Error during state transaction, reverting")),s.label=7;case 7:if(r)throw this.inTransactionError=!0,o;if(t?.rethrowErrors)throw o;return console.error(o),[3,9];case 8:return r||(this.inTransaction=!1,this.events.changed.next({state:this,inTransaction:!1}),this.behaviors.isUpdating.next(!1),a||(t?.canUndo?this.addHistory(i,"string"==typeof t.canUndo?t.canUndo:void 0):this.clearHistory())),[7];case 9:return[2]}})})})},Object.defineProperty(e.prototype,"inUpdate",{get:function(){return this._inUpdate},enumerable:!1,configurable:!0}),e.prototype.updateTree=function(e,t){var r=this,n={tree:e,options:t};return vy.create("Update Tree",function(i){return Tc(r,void 0,void 0,function(){var r,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return[4,this.updateQueue.enqueue(n)];case 1:if(!u.sent())return[2];this._inUpdate=!0,r=t?.canUndo?this._tree.asImmutable():void 0,a=!1,this.inTransaction||this.behaviors.isUpdating.next(!0),u.label=2;
139case 2:if(u.trys.push([2,,7,8]),aS.is(e)){if(e.editInfo.applied)throw Error("This builder has already been applied. Create a new builder for further state updates");e.editInfo.applied=!0}return this.reverted=!1,t&&(t.revertIfAborted||t.revertOnError)?[4,this._revertibleTreeUpdate(i,n,t)]:[3,4];case 3:return s=u.sent(),[3,6];case 4:return[4,this._updateTree(i,n)];case 5:s=u.sent(),u.label=6;case 6:return o=s,a=this.reverted,o.ctx.hadError&&(this.inTransactionError=!0),o.cell?[2,new pf(o.cell.transform.ref,this)]:[2];case 7:return this._inUpdate=!1,this.updateQueue.handled(n),this.inTransaction||(this.behaviors.isUpdating.next(!1),t?.canUndo?a||this.addHistory(r,"string"==typeof t.canUndo?t.canUndo:void 0):this.undoingHistory||this.clearHistory()),[7];case 8:return[2]}})})},function(){r.updateQueue.remove(n)})},e.prototype._revertibleTreeUpdate=function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=this.tree,[4,this._updateTree(e,t)];case 1:return((i=a.sent()).ctx.hadError||i.ctx.wasAborted)&&r.revertOnError||i.ctx.wasAborted&&r.revertIfAborted?(this.reverted=!0,[4,this._updateTree(e,{tree:n,options:t.options})]):[3,3];case 2:return[2,a.sent()];case 3:return[2,i]}})})},e.prototype._updateTree=function(e,t){return Tc(this,void 0,void 0,function(){var r,n,i;return Pc(this,function(a){switch(a.label){case 0:r=!1,n=this.updateTreeAndCreateCtx(t.tree,e,t.options),a.label=1;case 1:return a.trys.push([1,,3,4]),[4,_S(n)];case 2:return r=a.sent(),aS.isTo(t.tree)?(i=this.select(t.tree.ref)[0],[2,{ctx:n,cell:i}]):[2,{ctx:n}];case 3:return this.spine.current=void 0,r&&this.events.changed.next({state:this,inTransaction:this.inTransaction}),[7];case 4:return[2]}})})},e.prototype.updateTreeAndCreateCtx=function(e,t,r){var n=(aS.is(e)?e.getTree():e).asTransient(),i=this._tree;this._tree=n;var a=this.cells,o={parent:this,editInfo:aS.is(e)?e.editInfo:void 0,errorFree:this.errorFree,taskCtx:t,oldTree:i,tree:n,cells:this.cells,spine:this.spine,results:[],options:Ac(Ac({},bS),r),changed:!1,hadError:!1,wasAborted:!1,newCurrent:void 0,getCellData:function(e){return a.get(e).obj?.data}};return this.errorFree=!0,o},e}();!function(e){e.create=function(t,r){return new e(t,r)},(e.ObjectEvent||={}).isCell=function(e,t){return!!t&&e.ref===t.transform.ref&&e.state===t.parent}}(yS||={});var bS={doNotLogTiming:!1,doNotUpdateCurrent:!0,revertIfAborted:!1,revertOnError:!1,canUndo:!1};function _S(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M;return Pc(this,function(k){switch(k.label){case 0:if(t=!(!e.editInfo||1!==e.editInfo.count||!e.editInfo.lastUpdate||e.editInfo.sourceTree!==e.oldTree),n=[],t)r=[],i=[e.editInfo.lastUpdate];else{for(r=function(e){var t={newTree:e.tree,cells:e.cells,deletes:[]};return Kb.doPostOrder(e.oldTree,e.oldTree.root,t,SS),t.deletes}(e),E=e.parent.current,a=!1,o=0,s=r;o<s.length;o++)if((g=s[o])===E){a=!0;break}for(a&&(u=MS(e.oldTree,E,r,e.cells),e.parent.setCurrent(u)),m=r.length-1;m>=0;m--)(_=e.cells.get(r[m]))&&VS(_.transform,_.obj,_?.transform.params,_.cache,e.parent.globalContext);for(c=0,l=r;c<l.length;c++)g=l[c],(_=e.cells.get(g))&&(_.parent=void 0,TS(_)),d=_&&_.obj,e.cells.delete(g),n.push(d);I=e.cells,D=e.tree,O={roots:[],cells:I},Kb.doPreOrder(D,D.root,O,xS),i=O.roots}for(f=function(e,t){for(var r,n={ctx:e,visited:new Set,added:[]},i=0,a=t;i<a.length;i++){var o=a[i];Kb.doPreOrder(e.tree,e.tree.transforms.get(o),n,PS)}for(var s=0,u=n.added;s<u.length;s++)ES(u[s],e);return n.visited.forEach(function(t){for(var i=0,a=e.cells.get(t).dependencies.dependentBy;i<a.length;i++){var o=a[i];n.visited.has(o.transform.ref)||(r||=gS.create(),gS.add(r,o.transform.ref,o))}}),{added:n.added,dependent:r?r.array:void 0}}(e,i),h=0,p=f.added;h<p.length;h++)_=p[h],e.parent.events.cell.created.next({state:e.parent,ref:_.transform.ref,cell:_});for(m=0;m<r.length;m++)g=r[m],v=e.oldTree.transforms.get(g).parent,e.parent.events.object.removed.next({state:e.parent,ref:g,obj:n[m]}),e.parent.events.cell.removed.next({state:e.parent,ref:g,parent:v});
139if(n.length&&(n=[]),f.dependent)for(y=0,b=f.dependent;y<b.length;y++)_=b[y],i.push(_.transform.ref);(function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];Kb.doPreOrder(e.tree,e.tree.transforms.get(i),e,CS)}})(e,i),x=0,S=i,k.label=1;case 1:return x<S.length?(w=S[x],[4,zS(e,w)]):[3,4];case 2:k.sent(),k.label=3;case 3:return x++,[3,1];case 4:for(e.editInfo||function(e){Kb.doPreOrder(e.tree,e.tree.root,e,wS)}(e),A=e.newCurrent,C=0,T=e.results;C<T.length;C++)"created"===(P=T[C]).action?(e.parent.events.object.created.next({state:e.parent,ref:P.ref,obj:P.obj}),e.newCurrent||e.tree.transforms.get(P.ref).state.isGhost||P.obj===of.Null||(A=P.ref)):"updated"===P.action?e.parent.events.object.updated.next({state:e.parent,ref:P.ref,action:"in-place",obj:P.obj,oldData:P.oldData}):"replaced"===P.action&&e.parent.events.object.updated.next({state:e.parent,ref:P.ref,action:"recreate",obj:P.obj,oldObj:P.oldObj});return A?e.options.doNotUpdateCurrent||e.parent.setCurrent(A):(E=e.parent.current,(M=e.cells.get(E))&&(M.obj===of.Null||"error"===M.status&&M.errorText===jS)&&(A=MS(e.oldTree,E,[],e.cells),e.parent.setCurrent(A))),[2,r.length>0||i.length>0||e.changed]}var I,D,O})})}function xS(e,t,r){var n=r.cells.get(e.ref);return n&&n.transform.version===e.version?"error"!==n.status&&(!n||n.obj!==of.Null):(r.roots.push(e.ref),!1)}function SS(e,t,r){!r.newTree.transforms.has(e.ref)&&r.cells.has(e.ref)&&r.deletes.push(e.ref)}function wS(e,t,r){var n=r.cells.get(e.ref);n&&Rb.syncState(n.state,e.state)&&r.parent.events.cell.stateUpdated.next({state:r.parent,ref:e.ref,cell:n})}function AS(e,t,r,n){var i=e.cells.get(t),a=i.status!==r;i.status=r,i.errorText=n,a&&e.parent.events.cell.stateUpdated.next({state:e.parent,ref:t,cell:i})}function CS(e,t,r){r.cells.get(e.ref).transform=e,AS(r,e.ref,"pending")}function TS(e){for(var t=0,r=e.dependencies.dependsOn;t<r.length;t++)qb(r[t].dependencies.dependentBy,e)}function PS(e,t,r){var n=r.ctx,i=r.added;if(r.visited.add(e.ref),!n.cells.has(e.ref)){var a={parent:n.parent,transform:e,sourceRef:void 0,status:"pending",state:Ac({},e.state),errorText:void 0,params:void 0,paramsNormalizedVersion:"",dependencies:{dependentBy:[],dependsOn:[]},cache:void 0};n.cells.set(e.ref,a),i.push(a)}}function ES(e,t){if(e.transform.dependsOn)for(var r=0,n=e.transform.dependsOn;r<n.length;r++){var i=n[r];if(!t.tree.transforms.get(i))throw Error("Cannot depend on a non-existent transform.");var a=t.cells.get(i);Hb(e.dependencies.dependsOn,a),Hb(a.dependencies.dependentBy,e)}}function MS(e,t,r,n){return kS(e,t,new Set(r),n)}function kS(e,t,r,n){if(t===Rb.RootRef)return t;for(var i=e.transforms.get(t),a=e.children.get(i.parent).values(),o=void 0,s=!1;;){var u=a.next();if(u.done)break;if(!r.has(u.value)){var c=n.get(u.value);if(c&&"error"!==c.status&&c.obj!==of.Null){var l=e.transforms.get(u.value);if(!l.state.isGhost)if(u.value!==t){if(s)return l.ref;o=l.ref}else s=!0,r.has(t)||(o=t)}}}return o||kS(e,i.parent,r,n)}function IS(e,t,r,n){n||(e.hadError=!0,e.parent.errorFree=!1);var i=e.cells.get(t);if(r){e.wasAborted=e.wasAborted||vy.isAbort(r);var a=""+r;AS(e,t,"error",a),n||e.parent.events.log.next({type:"error",timestamp:new Date,message:a})}else i.params=void 0;if(i.obj){var o=i.obj;i.obj=void 0,i.cache=void 0,e.parent.events.object.removed.next({state:e.parent,ref:t,obj:o})}for(var s=e.tree.children.get(t).values();;){var u=s.next();if(u.done)return;IS(e,u.value,void 0,n)}}var DS,OS,RS,BS,NS,FS,LS,$S,US,jS="Parent is null";function zS(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:AS(e,t,"processing"),r=!1,c.label=1;case 1:return c.trys.push([1,3,,4]),n=Kd(),[4,GS(e,t)];case 2:return i=c.sent(),a=Kd()-n,"none"!==i.action&&(e.changed=!0),AS(e,t,"ok"),e.results.push(i),"created"===i.action?(r=i.obj===of.Null)||e.options.doNotLogTiming||e.parent.events.log.next(uS.info(`Created ${i.obj.label} in ${Zd(a)}.`)):("updated"===i.action||"replaced"===i.action)&&((r=i.obj===of.Null)||e.options.doNotLogTiming||e.parent.events.log.next(uS.info(`Updated ${i.obj.label} in ${Zd(a)}.`))),[3,4];case 3:return o=c.sent(),e.changed=!0,e.hadError||(e.newCurrent=t),IS(e,t,o,!1),console.error(o),[2];case 4:s=e.tree.children.get(t).values(),c.label=5;case 5:return(u=s.next()).done?[2]:r?(IS(e,u.value,void 0,!0),[3,8]):[3,6];case 6:return[4,zS(e,u.value)];case 7:c.sent(),c.label=8;case 8:return[3,5];case 9:return[2]}})})}function GS(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v;return Pc(this,function(y){switch(y.label){case 0:if(r=e.oldTree,n=e.tree,i=e.cells.get(t),a=i.transform,i.transform.ref===Rb.RootRef)return[2,{action:"none"}];if(o=e.cells.get(i.transform.parent),o?.obj===of.Null)return i.sourceRef=o.transform.ref,r.transforms.has(t)&&i.params?(d=i.params.values,f=i.cache,VS(a,i.obj,d,f,e.parent.globalContext),i.params=void 0,i.obj=of.Null,[2,{ref:t,action:"updated",obj:i.obj}]):(i.params=void 0,[2,{ref:t,action:"created",obj:of.Null}]);
139if(!(s=0===a.transformer.definition.from.length?o:Zb.findAncestorOfType(n,e.cells,t,a.transformer.definition.from)))throw Error(`No suitable parent found for '${t}'`);return e.spine.current=i,u=s.obj,i.sourceRef=s.transform.ref,c=function(e,t,r,n){var i=t.transformer.definition.params,a=i?i(r,e.parent.globalContext):{};if(n.paramsNormalizedVersion!==t.version)t.params=Ib.normalizeParams(a,t.params,"all"),n.paramsNormalizedVersion=t.version;else{var o=Ib.getDefaultValues(a);t.params=t.params?function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];jg.call(t,i)&&void 0===e[i]&&(e[i]=t[i])}return e}(t.params,o):o}return Ib.resolveRefs(a,t.params,e.getCellData),{definition:a,values:t.params}}(e,a,u,i),r.transforms.has(t)&&i.params?[3,2]:(i.params=c,[4,XS(e,i,a.transformer,u,c.values)]);case 1:return HS(l=y.sent(),a),i.obj=l,[2,{ref:t,action:"created",obj:l}];case 2:return d=i.params.values,f=i.cache,h=i.obj?.data,p=c.values,i.params=c,i.obj&&i.obj!==of.Null?[4,YS(e,i,a.transformer,u,i.obj,d,p)]:[3,4];case 3:return m=y.sent(),[3,5];case 4:m=Ob.UpdateResult.Recreate,y.label=5;case 5:switch(m){case Ob.UpdateResult.Recreate:return[3,6];case Ob.UpdateResult.Updated:return[3,8];case Ob.UpdateResult.Null:return[3,9]}return[3,10];case 6:return g=i.obj,VS(a,g,d,f,e.parent.globalContext),[4,XS(e,i,a.transformer,u,p)];case 7:return HS(v=y.sent(),a),i.obj=v,[2,{ref:t,action:"replaced",oldObj:g,obj:v}];case 8:return HS(i.obj,a),[2,{ref:t,action:"updated",oldData:h,obj:i.obj}];case 9:return VS(a,i.obj,d,f,e.parent.globalContext),i.obj=of.Null,[2,{ref:t,action:"updated",obj:i.obj}];case 10:return[2,{action:"none"}]}})})}function VS(e,t,r,n,i){var a,o;null==(o=(a=e.transformer.definition).dispose)||o.call(a,{b:t===of.Null?void 0:t,params:r,cache:n},i)}function HS(e,t){e&&e!==of.Null&&(e.tags=t.tags)}function qS(e,t){return"function"==typeof e.runInContext?e.runInContext(t):e}function WS(e){if(0!==e.dependencies.dependsOn.length){for(var t=Object.create(null),r=0,n=e.dependencies.dependsOn;r<n.length;r++){var i=n[r];if(!i.obj)throw Error("Unresolved dependency.");t[i.transform.ref]=i.obj}return t}}function XS(e,t,r,n,i){return t.cache||=Object.create(null),qS(r.definition.apply({a:n,params:i,cache:t.cache,spine:e.spine,dependencies:WS(t)},e.parent.globalContext),e.taskCtx)}function YS(e,t,r,n,i,a,o){return Tc(this,void 0,void 0,function(){return Pc(this,function(s){return r.definition.update?(t.cache||=Object.create(null),[2,qS(r.definition.update({a:n,oldParams:a,b:i,newParams:o,cache:t.cache,spine:e.spine,dependencies:WS(t)},e.parent.globalContext),e.taskCtx)]):[2,Ob.UpdateResult.Recreate]})})}function KS(e){return e===FS.Float32?4:e===FS.Int16||e===FS.Uint16?2:1}function ZS(e,t,r,n){return void 0===r&&(r=0),e===FS.Float32?new Float32Array(t,r,n):e===FS.Int16?new Int16Array(t,r,n):e===FS.Uint16?new Uint16Array(t,r,n):new Int8Array(t,r,n)}function QS(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){return Pc(this,function(o){switch(o.label){case 0:return[4,t.readBuffer(r,e.readBuffer,n,i)];case 1:return o.sent(),e.elementByteSize>1&&(void 0!==a&&a!==BS.IsNativeEndianLittle||!BS.IsNativeEndianLittle)&&BS.flipByteOrder(e.readBuffer,e.valuesBuffer,n,e.elementByteSize,i),[2,e.values]}})})}function JS(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return[4,e.readBuffer(0,1024)];case 1:if(t=s.sent().buffer,"MAP "!==(r=String.fromCharCode(t.readUInt8(208),t.readUInt8(209),t.readUInt8(210),t.readUInt8(211))))throw Error('ccp4 format error, missing "MAP " string');return n=[t.readUInt8(212),t.readUInt8(213)],i=!1,68===n[0]&&65===n[1]?i=!0:17===n[0]&&17===n[1]?i=!1:t.readInt32LE(12)<=16&&(i=!0),a=i?function(e){return t.readInt32LE(4*e)}:function(e){return t.readInt32BE(4*e)},o=i?function(e){return t.readFloatLE(4*e)}:function(e){return t.readFloatBE(4*e)},[2,{header:{NC:a(0),NR:a(1),NS:a(2),MODE:a(3),NCSTART:a(4),NRSTART:a(5),NSSTART:a(6),NX:a(7),NY:a(8),NZ:a(9),xLength:o(10),yLength:o(11),zLength:o(12),alpha:o(13),beta:o(14),gamma:o(15),MAPC:a(16),MAPR:a(17),MAPS:a(18),AMIN:o(19),AMAX:o(20),AMEAN:o(21),ISPG:a(22),NSYMBT:a(23),LSKFLG:a(24),SKWMAT:[],SKWTRN:[],userFlag1:a(39),userFlag2:
139a(40),originX:o(49),originY:o(50),originZ:o(51),MAP:r,MACHST:n,ARMS:o(54)},littleEndian:i}]}})})}function ew(e){switch(e){case 0:return FS.Int8;case 1:return FS.Int16;case 2:return FS.Float32;case 3:throw Error("mode 3 unsupported, complex 16-bit integers");case 4:throw Error("mode 4 unsupported, complex 32-bit reals");case 6:FS.Uint16;case 16:throw Error("mode 16 unsupported, unsigned char * 3 (for rgb data, non-standard)")}throw Error(`unknown mode '${e}'`)}function tw(e){return-128===e.userFlag1&&127===e.userFlag2}function rw(e){return tw(e)?FS.Float32:ew(e.MODE)}function nw(e,t,r){return Tc(this,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return[4,r.update({message:"Parsing CCP4/MRC/MAP file..."})];case 1:return f.sent(),[4,JS(e)];case 2:return t=f.sent(),n=t.header,i=t.littleEndian,a=function(e){return 1024+e.NSYMBT}(n),o=ew(n.MODE),s=rw(n),u=n.NC*n.NR*n.NS,c=KS(o),l=u*c,d=function(e,t){var r=KS(t),n=new ArrayBuffer(r*e),i=BS.fromArrayBuffer(n),a=BS.IsNativeEndianLittle?n:new ArrayBuffer(r*e);return{type:t,elementByteSize:r,readBuffer:i,valuesBuffer:new Uint8Array(a),values:ZS(t,a)}}(u,s),function(e,t,r,n,i,a){Tc(this,void 0,void 0,function(){var o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return tw(e)?(o=3*i,[4,r.readBuffer(n,t.readBuffer,i,o)]):[3,2];case 1:for(f.sent(),s=new Int8Array(t.valuesBuffer.buffer,o),u=(e.AMAX-e.AMIN)/255,c=.5*(e.AMIN+e.AMAX+u),l=0,d=i;l<d;++l)t.values[l]=u*s[l]+c;return[3,4];case 2:return[4,QS(t,r,n,i,0,a)];case 3:f.sent(),f.label=4;case 4:return[2]}})})}(n,d,e,a,l,i),[2,{header:n,values:d.values,name:e.name}]}})})}function iw(e,t){return function(e){var t=this;return vy.create("Parse CCP4/MRC/MAP",function(r){return Tc(t,void 0,void 0,function(){var t,n,i;return Pc(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),n=(t=RS).success,[4,nw(e,0,r)];case 1:return[2,n.apply(t,[a.sent()])];case 2:return i=a.sent(),[2,RS.error(i)];case 3:return[2]}})})})}(NS.fromBuffer(BS.fromUint8Array(e),t),e.length)}function aw(e){return function(t){return ow(e,t)}}function ow(e,t){var r=e.data,n=e.indices,i=e.count,a=t.valueType,o="str"===a?function(e){return r.substring(n[2*e],n[2*e+1])}:"int"===a?function(e){return Lv(r,n[2*e],n[2*e+1])||0}:function(e){return Uv(r,n[2*e],n[2*e+1])||0};return{schema:t,__array:void 0,isDefined:!0,rowCount:i,value:o,valueKind:function(e){return 0},toArray:function(e){return Rv(i,o,e)},areValuesEqual:sw(e)}}function sw(e){var t=e.data,r=e.indices;return function(e,n){var i=r[2*e],a=r[2*n],o=r[2*e+1]-i;if(o!==r[2*n+1]-a)return!1;for(var s=0;s<o;s++)if(t.charCodeAt(s+i)!==t.charCodeAt(s+a))return!1;return!0}}function uw(e){for(var t=e.count,r=e.indices,n=0;n<t;++n)if(r[2*n]!==r[2*n+1])return!1;return!0}function cw(e,t){return{name:t,blocks:e}}function lw(e,t,r,n){return void 0===n&&(n=[]),{categoryNames:e,header:r,categories:t,saveFrames:n,getField:function(e){var r=e.split("."),n=r[0],i=r[1];return t[n].getField(i||"")}}}function dw(e,t,r,n){return{rowCount:t,name:e,fieldNames:kc([],r,!0),getField:function(e){return n[e]}}}function fw(e){return{data:e,position:0,length:e.length,lineNumber:1,tokenStart:0,tokenEnd:0}}function hw(e){for(;e.position<e.length;)switch(e.data.charCodeAt(e.position)){case 9:case 10:case 13:case 32:return void(e.tokenEnd=e.position);default:++e.position}e.tokenEnd=e.position}function pw(e){return!(e.length-e.position<2)&&39===e.data.charCodeAt(e.position+1)&&39===e.data.charCodeAt(e.position+2)}function mw(e,t,r){var n,i=r-t,a=e.tokenStart-t,o=e.tokenEnd-e.tokenStart;if(o<i)return!1;for(n=t;n<r;++n)if(e.data.charCodeAt(n)!==e.data.charCodeAt(n+a))return!1;return i===o||46===e.data.charCodeAt(n+a)}function gw(e){var t;for(t=e.tokenStart;t<e.tokenEnd;++t)if(46===e.data.charCodeAt(t))return t;return t}function vw(e,t){return e.data.substring(e.tokenStart,t)}function yw(e){return e.data.substring(e.tokenStart,e.tokenEnd)}function bw(e){var t=function(e){for(var t=10;e.position<e.length;){var r=e.data.charCodeAt(e.position);switch(r){case 9:case 32:t=r,++e.position;break;case 10:13!==t&&++e.lineNumber,t=r,++e.position;break;case 13:t=r,++e.position,++e.lineNumber;break;default:return t}}return t}(e);if(e.position>=e.length)e.tokenType=6;else{e.tokenStart=e.position,e.tokenEnd=e.position,e.isEscaped=!1;var r=e.data.charCodeAt(e.position);switch(r){case 35:(function(e){for(;e.position<e.length;){var t=e.data.charCodeAt(e.position);if(10===t||13===t)return;++e.position}})(e),e.tokenType=5;break;case 39:if(pw(e)){(function(e){for(e.position+=3;e.position<e.length;){if(39===e.data.charCodeAt(e.position)&&pw(e))return e.tokenStart+=3,e.tokenEnd=e.position,e.isEscaped=!0,void(e.position+=3);++e.position}e.tokenEnd=e.position})(e),e.tokenType=3;break}case 34:(function(e,t){var r,n;for(++e.position;e.position<e.length;)if((n=e.data.charCodeAt(e.position))===t)switch(r=e.data.charCodeAt(e.position+1)){case 9:case 10:case 13:case 32:return e.tokenStart++,e.tokenEnd=e.position,e.isEscaped=!0,void++e.position;default:if(void 0===r)return e.tokenStart++,e.tokenEnd=e.position,e.isEscaped=!0,void++e.position;++e.position}else{if(10===n||13===n)return void(e.tokenEnd=e.position);++e.position}e.tokenEnd=e.position})(e,r),e.tokenType=3;break;case 59:10===t||13===t?function(e){for(var t,r=59,n=e.position+1;n<e.length;){if(59===(t=e.data.charCodeAt(n))&&(10===r||13===r)){for(e.position=n+1,e.tokenStart++,n--,t=e.data.charCodeAt(n);10===t||13===t;)n--,t=e.data.charCodeAt(n);return e.tokenEnd=n+1,void(e.isEscaped=!0)}(13===t||10===t&&13!==r)&&e.lineNumber++,r=t,++n}e.position=n}(e):hw(e),e.tokenType=3;break;default:e.isImportGet?function(e){for(;e.position<e.length;){if(93===e.data.charCodeAt(e.position))return++e.position,e.tokenEnd=e.position,void(e.isImportGet=!1);++e.position}}(e):hw(e),e.isEscaped?e.tokenType=3:95===e.data.charCodeAt(e.tokenStart)?(e.inSaveFrame&&function(e){return e.tokenEnd-e.tokenStart==11&&105===e.data.charCodeAt(e.tokenStart+1)&&109===e.data.charCodeAt(e.tokenStart+2)&&112===e.data.charCodeAt(e.tokenStart+3)&&111===e.data.charCodeAt(e.tokenStart+4)&&114===e.data.charCodeAt(e.tokenStart+5)&&116===e.data.charCodeAt(e.tokenStart+6)&&46===e.data.charCodeAt(e.tokenStart+7)&&103===e.data.charCodeAt(e.tokenStart+8)&&101===e.data.charCodeAt(e.tokenStart+9)&&116===e.data.charCodeAt(e.tokenStart+10)}(e)&&(e.isImportGet=!0),e.tokenType=4):e.tokenEnd-e.tokenStart>=5&&95===e.data.charCodeAt(e.tokenStart+4)?function(e){var t=e.data.charCodeAt(e.tokenStart);return!(68!==t&&100!==t||65!==(t=e.data.charCodeAt(e.tokenStart+1))&&97!==t||84!==(t=e.data.charCodeAt(e.tokenStart+2))&&116!==t||65!==(t=e.data.charCodeAt(e.tokenStart+3))&&97!==t)}(e)?e.tokenType=0:function(e){var t=e.data.charCodeAt(e.tokenStart);return!(83!==t&&115!==t||65!==(t=e.data.charCodeAt(e.tokenStart+1))&&97!==t||86!==(t=e.data.charCodeAt(e.tokenStart+2))&&118!==t||69!==(t=e.data.charCodeAt(e.tokenStart+3))&&101!==t)}(e)?e.tokenType=1:function(e){if(e.tokenEnd-e.tokenStart!=5)return!1;var t=e.data.charCodeAt(e.tokenStart);return!(76!==t&&108!==t||79!==(t=e.data.charCodeAt(e.tokenStart+1))&&111!==t||79!==(t=e.data.charCodeAt(e.tokenStart+2))&&111!==t||80!==(t=e.data.charCodeAt(e.tokenStart+3))&&112!==t)}(e)?e.tokenType=2:e.tokenType=3:e.tokenType=3}}}function _w(e){for(bw(e);5===e.tokenType;)bw(e)}function xw(){return{categoryNames:[],categoryData:Object.create(null)}}function Sw(e,t){for(var r=Object.create(null),n=0,i=e;n<i.length;n++){var a=i[n],o=t[a];r[a]=dw(o.name,o.rowCount,o.fieldNames,o.fields)}return r}function ww(e,t,r){return lw(e.categoryNames,Sw(e.categoryNames,e.categoryData),t,r)}function Aw(e,t,r,n,i){var a;if(t in e.categoryData){var o=e.categoryData[t];(a=o.fieldNames).push.apply(a,n),Object.assign(o.fields,i)}else e.categoryData[t]={name:t,rowCount:r,fieldNames:n,fields:i},e.categoryNames.push(t)}function Cw(e,t){for(var r=t.tokenizer,n=t.tokens,i=t.fieldCount,a=t.tokenCount,o=0;3===r.tokenType&&o<e;)$S.add(n[a++%i],r.tokenStart,r.tokenEnd),_w(r),o++;return t.tokenCount=a,o}function Tw(e,t){return e.update({message:"Parsing...",current:t.tokenizer.position,max:t.tokenizer.data.length})}function Pw(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:for(r=e.lineNumber,_w(e),n=vw(e,gw(e)),i=function(e){var t;for(t=e.tokenStart;t<e.tokenEnd;++t)if(46===e.data.charCodeAt(t))return!1;return!0}(e),a=[];4===e.tokenType;)a[a.length]=i?yw(e):yw(e).substring(n.length+1),_w(e);for(o="_atom_site"===n?e.data.length/100|0:32,s=[],u=a.length,f=0;f<u;f++)s[f]=$S.create(e.data,o);return c={fieldCount:u,tokenCount:0,tokenizer:e,tokens:s}
139,[4,Sy(e.runtimeCtx,1e6,c,Cw,Tw)];case 1:if(h.sent(),c.tokenCount%u!=0)return[2,{hasError:!0,errorLine:e.lineNumber,errorMessage:`The number of values for loop starting at line ${r} is not a multiple of the number of columns.`}];if(l=c.tokenCount/u|0,i)for(f=0;f<u;f++)d={"":LS.ofTokens(s[f])},Aw(t,a[f].substr(1),l,[""],d);else{for(d=Object.create(null),f=0;f<u;f++)d[a[f]]=LS.ofTokens(s[f]);Aw(t,n.substr(1),l,a,d)}return[2,{hasError:!1,errorLine:0,errorMessage:""}]}})})}function Ew(e,t){return RS.error(t,e)}function Mw(e){return RS.success(e)}function kw(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:r=[],n=function(e,t){return{data:e,length:e.length,position:0,tokenStart:0,tokenEnd:0,tokenType:6,lineNumber:1,isEscaped:!1,isImportGet:!1,inSaveFrame:!1,runtimeCtx:t}}(e,t),i="",a=xw(),o=[],s=xw(),u=function(e,t){return{categoryNames:e,header:"",categories:t}}(s.categoryNames,Sw(s.categoryNames,s.categoryData)),c="",t.update({message:"Parsing...",current:0,max:e.length}),_w(n),f.label=1;case 1:return 6===n.tokenType?[3,7]:0===(l=n.tokenType)?n.inSaveFrame?[2,Ew(n.lineNumber,"Unexpected data block inside a save frame.")]:(a.categoryNames.length>0&&r.push(ww(a,i,o)),i=e.substring(n.tokenStart+5,n.tokenEnd),a=xw(),o=[],_w(n),[3,6]):[3,2];case 2:if(1!==l)return[3,3];if(n.tokenEnd-n.tokenStart==5)s.categoryNames.length>0&&(o[o.length]=function(e,t){return lw(e.categoryNames,Sw(e.categoryNames,e.categoryData),t)}(s,c)),n.inSaveFrame=!1;else{if(n.inSaveFrame)return[2,Ew(n.lineNumber,"Save frames cannot be nested.")];n.inSaveFrame=!0,c=e.substring(n.tokenStart+5,n.tokenEnd),s=xw()}return _w(n),[3,6];case 3:return 2===l?[4,Pw(n,n.inSaveFrame?s:a)]:[3,5];case 4:return(d=f.sent()).hasError?[2,Ew(d.errorLine,d.errorMessage)]:[3,6];case 5:if(4!==l)return console.log(n.tokenType,fw.getTokenString(n)),[2,Ew(n.lineNumber,"Unexpected token. Expected data_, loop_, or data name.")];if(d=function(e,t){for(var r=e.tokenStart,n=gw(e),i=vw(e,n),a=Object.create(null),o=[],s=!0;s;){if(4!==e.tokenType||!mw(e,r,n)){s=!1;break}var u=yw(e).substring(i.length+1);if(_w(e),3!==e.tokenType)return{hasError:!0,errorLine:e.lineNumber,errorMessage:"Expected value."};a[u]=LS.ofTokens({data:e.data,indices:[e.tokenStart,e.tokenEnd],count:1}),o[o.length]=u,_w(e)}return Aw(t,i.substr(1),1,o,a),{hasError:!1,errorLine:0,errorMessage:""}}(n,n.inSaveFrame?s:a),d.hasError)return[2,Ew(d.errorLine,d.errorMessage)];f.label=6;case 6:return[3,1];case 7:return n.inSaveFrame?[2,Ew(n.lineNumber,`Unfinished save frame (${u.header}).`)]:((a.categoryNames.length>0||o.length>0)&&r.push(ww(a,i,o)),[2,Mw(cw(r))])}})})}function Iw(e){var t=this;return vy.create("Parse CIF",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,kw(e,r)];case 1:return[2,t.sent()]}})})})}(function(e){function t(t){return e.Create(Ac(Ac({},t),{typeClass:"Representation3D"}))}e.Create=of.factory(),e.isRepresentation3D=function(e){return!!e&&"Representation3D"===e.type.typeClass},e.isBehavior=function(e){return!!e&&"Behavior"===e.type.typeClass},e.CreateRepresentation3D=t,e.CreateBehavior=function(t){return e.Create(Ac(Ac({},t),{typeClass:"Behavior"}))},e.Root=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Root",typeClass:"Root"})),e.Group=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Group",typeClass:"Group"})),function(t){t.String=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"String Data",typeClass:"Data"})),t.Binary=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Binary Data",typeClass:"Data"})),t.Blob=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Data Blob",typeClass:"Data"}))}(e.Data||={}),function(t){t.Json=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"JSON Data",typeClass:"Data"})),t.Cif=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"CIF File",typeClass:"Data"})),t.Cube=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Cube File",typeClass:"Data"})),t.Psf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"PSF File",typeClass:"Data"})),t.Prmtop=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"PRMTOP File",typeClass:"Data"})),t.Top=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"TOP File",typeClass:"Data"})),t.Ply=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"PLY File",typeClass:"Data"})),t.Ccp4=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"CCP4/MRC/MAP File",typeClass:"Data"})),t.Dsn6=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"DSN6/BRIX File",typeClass:"Data"})),t.Dx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"DX File",typeClass:"Data"})),t.Blob=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Format Blob",typeClass:"Data"}))}(e.Format||={}),function(r){r.Coordinates=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Coordinates",typeClass:"Object"})),r.Topology=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Topology",typeClass:"Object"})),r.Model=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Model",typeClass:"Object"})),r.Trajectory=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Trajectory",typeClass:"Object"}));var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Structure",typeClass:"Object"}));r.Structure=n,function(r){r.Representation3D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(t({name:"Structure 3D"})),r.Representation3DState=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Structure 3D State",typeClass:"Object"})),r.Selections=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Selections",typeClass:"Object"}))}(n=r.Structure||={})}(e.Molecule||={}),function(r){r.Data=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Volume",typeClass:"Object"})),r.Lazy=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Lazy Volume",typeClass:"Object"})),r.Representation3D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(t({name:"Volume 3D"}))}(e.Volume||={}),function(r){r.Provider=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(e.Create({name:"Shape Provider",typeClass:"Object"})),r.Representation3D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(t({name:"Shape 3D"}))}(e.Shape||={})})(DS||={}),function(e){e.CreateBuiltIn=Ob.factory("ms-plugin"),e.BuiltIn=Ob.builderFactory("ms-plugin")}(OS||={}),function(e){e.error=function(e,r){return void 0===r&&(r=-1),new t(e,r)},e.success=function(e,t){return void 0===t&&(t=[]),new r(e,t)};var t=function(){function e(e,t){this.message=e,this.line=t,this.isError=!0}return e.prototype.toString=function(){return this.line>=0?`[Line ${this.line}] ${this.message}`:this.message},e}();e.Error=t;var r=function(e,t){this.result=e,this.warnings=t,this.isError=!1};e.Success=r}(RS||={}),function(e){function t(e){var t=new DataView(e.buffer);return Object.assign(e.subarray(0),{readInt8:function(e){return t.getInt8(e)},readUInt8:function(e){return t.getUint8(e)},writeInt8:function(e,r){return t.setInt8(r,e)},writeUInt8:function(e,r){return t.setUint8(r,e)},readInt16LE:function(e){return t.getInt16(e,!0)},readInt32LE:function(e){return t.getInt32(e,!0)},readUInt16LE:function(e){return t.getUint16(e,!0)},readUInt32LE:function(e){return t.getUint32(e,!0)},readFloatLE:function(e){return t.getFloat32(e,!0)},readDoubleLE:function(e){return t.getFloat64(e,!0)},writeInt16LE:function(e,r){return t.setInt16(r,e,!0)},writeInt32LE:function(e,r){return t.setInt32(r,e,!0)},writeUInt16LE:function(e,r){return t.setUint16(r,e,!0)},writeUInt32LE:function(e,r){return t.setUint32(r,e,!0)},writeFloatLE:function(e,r){return t.setFloat32(r,e,!0)},writeDoubleLE:function(e,r){return t.setFloat64(r,e,!0)},readInt16BE:function(e){return t.getInt16(e,!1)},readInt32BE:function(e){return t.getInt32(e,!1)},readUInt16BE:function(e){return t.getUint16(e,!1)},readUInt32BE:function(e){return t.getUint32(e,!1)},readFloatBE:function(e){return t.getFloat32(e,!1)},readDoubleBE:function(e){return t.getFloat64(e,!1)},writeInt16BE:function(e,r){return t.setInt16(r,e,!1)},writeInt32BE:function(e,r){return t.setInt32(r,e,!1)},writeUInt16BE:function(e,r){return t.setUint16(r,e,!1)},writeUInt32BE:function(e,r){return t.setUint32(r,e,!1)},writeFloatBE:function(e,r){return t.setFloat32(r,e,!1)},writeDoubleBE:function(e,r){return t.setFloat64(r,e,!1)},copy:function(t,r,n,i){return r=ff(r,0),n=ff(n,0),i=ff(i,e.length),t.set(e.subarray(n,i),r),i-n}})}function r(e,t,r,n,i){for(var a=0,o=r;a<o;a+=n)for(var s=0;s<n;s++)t[i+a+n-s-1]=e[i+a+s]}e.fromUint8Array=t,e.fromArrayBuffer=function(e){return t(new Uint8Array(e))},e.fromBuffer=function(e){return e},e.IsNativeEndianLittle=13330===new Uint16Array(new Uint8Array([18,52]).buffer)[0],e.flipByteOrder=r,e.flipByteOrderInPlace2=function(e,t,r){void 0===t&&(t=0);for(var n=new Int16Array(e,t,r),i=0,a=n.length;i<a;++i){var o=n[i];n[i]=(255&o)<<8|o>>8&255}},e.ensureLittleEndian=function(t,n,i,a,o){e.IsNativeEndianLittle||!i||a<=1||r(t,n,i,a,o)}}(BS||={}),function(e){e.fromBuffer=function(e,t){return{name:t,readBuffer:function(t,r,n,i){var a,o;if("number"==typeof r){n=ff(n,r);var s=t;a=(u=Math.min(e.length,s+n))-s,o=BS.fromUint8Array(new Uint8Array(e.buffer,s,u-s))}else{n=ff(n,r.length),s=t;var u=Math.min(e.length,s+n);r.set(e.subarray(s,u),i),a=u-s,o=r}return n!==a&&console.warn(`byteCount ${n} and bytesRead ${a} differ`),Promise.resolve({bytesRead:a,buffer:o})},writeBuffer:function(e,t,r){return r=ff(r,t.length),console.error(".writeBuffer not implemented for FileHandle.fromBuffer"),Promise.resolve(0)},writeBufferSync:function(e,t,r){return r=ff(r,t.length),console.error(".writeSync not implemented for FileHandle.fromBuffer"),0},close:nf}}}(NS||={}),function(e){e.Float32="float32",e.Int8="int8",e.Int16="int16",e.Uint16="uint16"}(FS||={}),function(e){function t(e,t){var r=Object.keys(t);return{rowCount:r.length>0?t[r[0]].rowCount:0,name:e,fieldNames:r,getField:function(e){return t[e]}}}e.empty=function(e){return{rowCount:0,name:e,fieldNames:[],getField:function(e){}}},e.ofFields=t,e.ofTable=function(e,r){for(var n={},i=0,a=r._columns;i<a.length;i++){var o=a[i];n[o]=LS.ofColumn(r[o])}return t(e,n)}}(dw||={}),function(e){function t(e){var t=e.length,r=function(t){var r=e[t];return r&&"."!==r&&"?"!==r?r:""},n=function(t){var r=e[t];return Lv(r,0,r.length)||0},i=function(t){var r=e[t];return Uv(r,0,r.length)||0};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:t,str:r,int:n,float:i,valueKind:function(t){var r=e[t],n=r.length;if(n>1)return 0;if(0===n)return 1;var i=r.charCodeAt(0);return 46===i?1:63===i?2:0},areValuesEqual:function(t,r){return e[t]===e[r]},toStringArray:function(n){return n?Rv(t,r,n):e},toIntArray:function(e){return Rv(t,n,e)},toFloatArray:function(e){return Rv(t,i,e)}}}function r(e){var t,r,n,i=e.rowCount,a=e.valueKind,o=e.areValuesEqual,s=e.isDefined;switch(e.schema.valueType){case"float":case"int":t=function(t){return""+e.value(t)},r=e.value,n=e.value;break;case"str":t=e.value,r=function(t){var r=e.value(t);return Lv(r,0,r.length)||0},n=function(t){var r=e.value(t);return Uv(r,0,r.length)||0};break;case"list":var u=e.schema.separator;t=function(t){return e.value(t).join(u)},r=function(e){return NaN},n=function(e){return NaN};break;default:throw Error(`unsupported valueType '${e.schema.valueType}'`)}return{__array:void 0,binaryEncoding:void 0,isDefined:s,rowCount:i,str:t,int:r,float:n,valueKind:a,areValuesEqual:o,toStringArray:function(e){return Rv(i,t,e)},toIntArray:function(e){return Rv(i,r,e)},toFloatArray:function(e){return Rv(i,n,e)}}}e.ofString=function(e){return t([e])},e.ofStrings=t,e.ofNumbers=function(e){var t=e.length,r=function(t){return""+e[t]},n=function(t){return e[t]},i=function(r){return!r||r.array&&e instanceof r.array?e:Rv(t,n,r)};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:t,str:r,int:n,float:n,valueKind:function(e){return 0},areValuesEqual:function(t,r){return e[t]===e[r]},toStringArray:function(e){return Rv(t,r,e)},toIntArray:i,toFloatArray:i}},e.ofTokens=function(e){var t=e.data,r=e.indices,n=e.count,i=function(e){var n=t.substring(r[2*e],r[2*e+1]);return"."===n||"?"===n?"":n},a=function(e){return Lv(t,r[2*e],r[2*e+1])||0},o=function(e){return Uv(t,r[2*e],r[2*e+1])||0};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:n,str:i,int:a,float:o,valueKind:function(e){var n=r[2*e],i=r[2*e+1]-n;
139if(i>1)return 0;if(0===i)return 1;var a=t.charCodeAt(n);return 46===a?1:63===a?2:0},areValuesEqual:sw(e),toStringArray:function(e){return Rv(n,i,e)},toIntArray:function(e){return Rv(n,a,e)},toFloatArray:function(e){return Rv(n,o,e)}}},e.ofColumn=r,e.ofUndefined=function(e,t){return r(xv.Undefined(e,t))}}(LS||={}),function(e){function t(e){return e.data.substring(e.tokenStart,e.tokenEnd)}function r(e){for(var t=e.data;e.position<e.length;)switch(t.charCodeAt(e.position)){case 10:return e.tokenEnd=e.position,++e.position,++e.lineNumber,!0;case 13:return e.tokenEnd=e.position,++e.position,++e.lineNumber,10===t.charCodeAt(e.position)&&++e.position,!0;default:++e.position}return e.tokenEnd=e.position,e.tokenStart!==e.tokenEnd}function n(e){return e.tokenStart=e.position,r(e)}function i(e,t,r){for(var i=0,a=0;a<t;a++){if(!n(e))return i;$S.addUnchecked(r,e.tokenStart,e.tokenEnd),i++}return i}function a(e,t,r){for(var n=e.data,i=t,a=r-1,o=n.charCodeAt(i);(9===o||32===o)&&i<=a;)o=n.charCodeAt(++i);for(o=n.charCodeAt(a);(9===o||32===o)&&a>=i;)o=n.charCodeAt(--a);return e.tokenStart=i,e.tokenEnd=a+1,e.position=r,e}e.getTokenString=t,e.reset=function(e){e.position=0,e.lineNumber=1,e.tokenStart=0,e.tokenEnd=0},e.eatLine=r,e.markStart=function(e){e.tokenStart=e.position},e.markLine=n,e.readLine=function(e){return n(e),t(e)},e.readLineTrim=function(e){n(e);var r=e.position;return a(e,e.tokenStart,e.tokenEnd),e.position=r,t(e)},e.markLines=function(e,t){var r=$S.create(e.data,2*t);return i(e,t,r),r},e.readLines=function(t,r){for(var n=[],i=0;i<r;i++)n.push(e.readLine(t));return n},e.readLinesAsync=function(e,t,r,n){return void 0===n&&(n=1e5),Tc(this,void 0,void 0,function(){var a,o;return Pc(this,function(s){switch(s.label){case 0:return a=$S.create(e.data,2*t),o=0,[4,Sy(r,n,e,function(e,r){var n=Math.min(t-o,e);return i(r,n,a),o+=n,n},function(e,t){return e.update({message:"Parsing...",current:t.position,max:t.length})})];case 1:return s.sent(),[2,a]}})})},e.readAllLines=function(t){for(var r=e(t),i=$S.create(r.data,Math.max(t.length/80,2));n(r);)$S.add(i,r.tokenStart,r.tokenEnd);return i},e.readAllLinesAsync=function(t,r,i){return void 0===i&&(i=1e5),Tc(this,void 0,void 0,function(){var a,o;return Pc(this,function(s){switch(s.label){case 0:return a=e(t),o=$S.create(a.data,Math.max(t.length/80,2)),[4,Sy(r,i,a,function(e,t){return function(e,t,r){for(var i=0,a=0;a<t;a++){if(!n(e))return i;$S.add(r,e.tokenStart,e.tokenEnd),i++}}(t,e,o),t.position<t.length?e:0},function(e,t){return e.update({message:"Parsing...",current:t.position,max:t.length})})];case 1:return s.sent(),[2,o]}})})},e.eatValue=function(e){for(;e.position<e.length;)switch(e.data.charCodeAt(e.position)){case 9:case 10:case 13:case 32:return void(e.tokenEnd=e.position);default:++e.position}e.tokenEnd=e.position},e.skipWhitespace=function(e){for(var t=-1;e.position<e.length;){var r=e.data.charCodeAt(e.position);switch(r){case 9:case 32:t=r,++e.position;break;case 10:13!==t&&++e.lineNumber,t=r,++e.position;break;case 13:t=r,++e.position,++e.lineNumber;break;default:return t}}return t},e.trim=a}(fw||={}),function(e){function t(e,t,r){var n=e;n.offset>n.indicesLenMinus2&&function(e){var t=new Uint32Array(1.61*e.indices.length|0);t.set(e.indices),e.indices=t,e.indicesLenMinus2=t.length-2|0}(n),n.indices[n.offset++]=t,n.indices[n.offset++]=r,e.count++}e.add=t,e.addToken=function(e,r){t(e,r.tokenStart,r.tokenEnd)},e.addUnchecked=function(e,t,r){e.indices[e.offset++]=t,e.indices[e.offset++]=r,e.count++},e.create=function(e,t){return{data:e,indicesLenMinus2:(t=Math.max(10,t))-2|0,count:0,offset:0,indices:new Uint32Array(t)}}}($S||={}),function(e){var t,r;(t=e.IntDataType||={})[t.Int8=1]="Int8",t[t.Int16=2]="Int16",t[t.Int32=3]="Int32",t[t.Uint8=4]="Uint8",t[t.Uint16=5]="Uint16",t[t.Uint32=6]="Uint32",(r=e.FloatDataType||={})[r.Float32=32]="Float32",r[r.Float64=33]="Float64",e.getDataType=function(t){return t instanceof Int8Array?e.IntDataType.Int8:t instanceof Int16Array?e.IntDataType.Int16:t instanceof Int32Array?e.IntDataType.Int32:t instanceof Uint8Array?e.IntDataType.Uint8:t instanceof Uint16Array?e.IntDataType.Uint16:t instanceof Uint32Array?e.IntDataType.Uint32:t instanceof Float32Array?e.FloatDataType.Float32:t instanceof Float64Array?e.FloatDataType.Float64:e.IntDataType.Int32},e.isSignedIntegerDataType=function(e){if(e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array)return!0;for(var t=0,r=e.length;t<r;t++)if(t<0)return!1;return!0}}(US||={});var Dw,Ow,Rw=13330===new Uint16Array(new Uint8Array([18,52]).buffer)[0],Bw=28672;function Nw(e){for(var t=e.data,r=e.encoding.length-1;r>=0;r--)t=Fw(t,e.encoding[r]);return t}function Fw(e,t){switch(t.kind){case"ByteArray":switch(t.type){case US.IntDataType.Uint8:return e;case US.IntDataType.Int8:return function(e){return new Int8Array(e.buffer,e.byteOffset)}(e);case US.IntDataType.Int16:return function(e){return Uw(e,2,Int16Array)}(e);case US.IntDataType.Uint16:return function(e){return Uw(e,2,Uint16Array)}(e);case US.IntDataType.Int32:return function(e){return Uw(e,4,Int32Array)}(e);case US.IntDataType.Uint32:return function(e){return Uw(e,4,Uint32Array)}(e);case US.FloatDataType.Float32:return function(e){return Uw(e,4,Float32Array)}(e);case US.FloatDataType.Float64:return function(e){return Uw(e,8,Float64Array)}(e);default:Lg(t.type)}case"FixedPoint":return function(e,t){for(var r=e.length,n=$w(t.srcType,r),i=1/t.factor,a=0;a<r;a++)n[a]=i*e[a];return n}(e,t);case"IntervalQuantization":return function(e,t){for(var r=e.length,n=$w(t.srcType,r),i=(t.max-t.min)/(t.numSteps-1),a=t.min,o=0;o<r;o++)n[o]=a+i*e[o];return n}(e,t);case"RunLength":return function(e,t){for(var r=Lw(t.srcType,t.srcSize),n=0,i=0,a=e.length;i<a;i+=2)for(var o=e[i],s=e[i+1],u=0;u<s;++u)r[n++]=o;return r}(e,t);case"Delta":return function(e,t){var r=e.length,n=Lw(t.srcType,r);if(!r)return e;n[0]=e[0]+(0|t.origin);for(var i=1;i<r;++i)n[i]=e[i]+n[i-1];return n}(e,t);case"IntegerPacking":return function(e,t){return e.length===t.srcSize?e:t.isUnsigned?function(e,t){for(var r=1===t.byteCount?255:65535,n=e.length,i=new Int32Array(t.srcSize),a=0,o=0;a<n;){for(var s=0,u=e[a];u===r;)s+=u,u=e[++a];s+=u,i[o]=s,a++,o++}return i}(e,t):function(e,t){for(var r=1===t.byteCount?127:32767,n=-r-1,i=e.length,a=new Int32Array(t.srcSize),o=0,s=0;o<i;){for(var u=0,c=e[o];c===r||c===n;)u+=c,c=e[++o];u+=c,a[s]=u,o++,s++}return a}(e,t)}(e,t);case"StringArray":return function(e,t){var r=Nw({encoding:t.offsetEncoding,data:t.offsets}),n=Nw({encoding:t.dataEncoding,data:e}),i=t.stringData,a=Array(r.length);a[0]="";for(var o=1,s=r.length;o<s;o++)a[o]=i.substring(r[o-1],r[o]);var u=0,c=Array(n.length);for(o=0,s=n.length;o<s;o++)c[u++]=a[n[o]+1];return c}(e,t)}}function Lw(e,t){switch(e){case US.IntDataType.Int8:return new Int8Array(t);case US.IntDataType.Int16:return new Int16Array(t);case US.IntDataType.Int32:return new Int32Array(t);case US.IntDataType.Uint8:return new Uint8Array(t);case US.IntDataType.Uint16:return new Uint16Array(t);case US.IntDataType.Uint32:return new Uint32Array(t);default:Lg()}}function $w(e,t){switch(e){case US.FloatDataType.Float32:return new Float32Array(t);case US.FloatDataType.Float64:return new Float64Array(t);default:Lg()}}function Uw(e,t,r){return new r(Rw?e.buffer:function(e,t){for(var r=new ArrayBuffer(e.length),n=new Uint8Array(r),i=0,a=e.length;i<a;i+=t)for(var o=0;o<t;o++)n[i+t-o-1]=e[i+o];return r}(e,t))}function jw(e,t,r){var n,i=1;for(n=0;n<t;n++){var a=i*e;if(Math.abs(Math.round(a)-a)<=r)return n;i*=10}return-1}function zw(e,t){return parseFloat(e.toPrecision(t))}function Gw(e){return Dw.classify(e)}(function(e){function t(e,t){return Math.ceil(e>=0?(e+1)/t:(e+1)/(-t-1))}function r(e,r,n){var i=e.limit8,a=e.limit16;r.pack8+=t(n,i),r.pack16+=t(n,a),r.count+=1}function n(e,r){e.pack8+=t(r,127),e.pack16+=t(r,32767),e.count+=1}function i(e){return 4*e.count<2*e.pack16?{length:4*e.count,elem:4}:2*e.pack16<e.pack8?{length:2*e.pack16,elem:2}:{length:e.pack8,elem:1}}function a(e,t){for(var n={pack8:0,pack16:0,count:0},a=0,o=e.length;a<o;a++)r(t,n,e[a]);return Ac(Ac({},i(n)),{kind:"pack"})}function o(e,t){for(var r={pack8:0,pack16:0,count:0},a=e[0],o=1,s=e.length;o<s;o++)n(r,e[o]-a),a=e[o];return Ac(Ac({},i(r)),{kind:"delta"})}function s(e,t){for(var n={pack8:0,pack16:0,count:0},a=1,o=1,s=e.length;o<s;o++)e[o-1]===e[o]?a++:(r(t,n,e[o-1]),r(t,n,a),a=1);return r(t,n,e[e.length-1]),r(t,n,a),Ac(Ac({},i(n)),{kind:"rle"})}function u(e,t){for(var r={pack8:0,pack16:0,count:0},a=1,o=0,s=0,u=1,c=e.length;u<c;u++){var l=e[u]-o;s===l?a++:(n(r,s),n(r,a),a=1),s=l,o=e[u]}return n(r,s),n(r,a),Ac(Ac({},i(r)),{kind:"delta-rle"})}function c(e){var t=function(e){for(var t=!1,r=0,n=e.length;r<n;r++)if(e[r]<0){t=!0;break}return t?{signed:t,limit8:127,limit16:32767}:{signed:t,limit8:255,limit16:65535}}(e),r=[a(e,t),s(e,t),o(e),u(e)];return r.sort(function(e,t){return e.length-t.length}),r}e.getSize=c,e.classify=function(e){if(e.length<2)return Hw.by(Hw.byteArray);switch(c(e)[0].kind){case"pack":return Hw.by(Hw.integerPacking);case"rle":return Hw.by(Hw.runLength).and(Hw.integerPacking);case"delta":return Hw.by(Hw.delta).and(Hw.integerPacking);case"delta-rle":return Hw.by(Hw.delta).and(Hw.runLength).and(Hw.integerPacking);default:Lg()}}})(Dw||={}),function(e){e.classify=function(e){var t=function(e,t,r){for(var n=1,i=0,a=0,o=e.length;a<o;a++){if(n>=0){var s=jw(e[a],4,r);s<0?n=-1:s>n&&(n=s)}var u=Math.abs(e[a]);if(u>r){var c=Math.floor(Math.log10(Math.abs(u)))+1;c>i&&(i=c)}}return{mantissaDigits:n,integerDigits:i}}(e,0,1e-6),r=t.mantissaDigits,n=t.integerDigits;if(r<0||r+n>10)return Hw.by(Hw.byteArray);if(0===r)return Dw.classify(e);for(var i=function(e){for(var t=1,r=0;r<e;r++)t*=10;return t}(r),a=new Int32Array(e.length),o=0,s=e.length;o<s;o++)a[o]=Math.round(i*e[o]);var u=Dw.getSize(a)[0],c=Hw.by(Hw.fixedPoint(i));switch(u.kind){case"pack":return c.and(Hw.integerPacking);case"rle":return c.and(Hw.runLength).and(Hw.integerPacking);case"delta":return c.and(Hw.delta).and(Hw.integerPacking);case"delta-rle":return c.and(Hw.delta).and(Hw.runLength).and(Hw.integerPacking);default:Lg()}}}(Ow||={});var Vw,Hw,qw,Ww=function(){function e(e){this.providers=e}return e.prototype.and=function(t){return new e(this.providers.concat([t]))},e.prototype.encode=function(e){for(var t=[],r=0,n=this.providers;r<n.length;r++){var i=(0,n[r])(e);if(!i.encodings.length)throw Error("Encodings must be non-empty.");e=i.data;for(var a=0,o=i.encodings;a<o.length;a++){var s=o[a];t.push(s)}}if(!(e instanceof Uint8Array))throw Error("The encoding must result in a Uint8Array. Fix your encoding chain.");return{encoding:t,data:e}},e}();function Xw(e){return Jw({buffer:e,offset:0,dataView:new DataView(e.buffer)})}function Yw(e,t){for(var r={},n=0;n<t;n++)r[Jw(e)]=Jw(e);return r}
139function Kw(e,t){for(var r=new Uint8Array(t),n=e.offset,i=0;i<t;i++)r[i]=e.buffer[i+n];return e.offset+=t,r}function Zw(e,t){var r=Qv(e.buffer,e.offset,t);return e.offset+=t,r}function Qw(e,t){for(var r=Array(t),n=0;n<t;n++)r[n]=Jw(e);return r}function Jw(e){var t,r,n=e.buffer[e.offset];if(!(128&n))return e.offset++,n;if(128==(240&n))return r=15&n,e.offset++,Yw(e,r);if(144==(240&n))return r=15&n,e.offset++,Qw(e,r);if(160==(224&n))return r=31&n,e.offset++,Zw(e,r);if(!(224&~n))return t=e.dataView.getInt8(e.offset),e.offset++,t;switch(n){case 192:return e.offset++,null;case 194:return e.offset++,!1;case 195:return e.offset++,!0;case 196:return r=e.dataView.getUint8(e.offset+1),e.offset+=2,Kw(e,r);case 197:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,Kw(e,r);case 198:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,Kw(e,r);case 202:return t=e.dataView.getFloat32(e.offset+1),e.offset+=5,t;case 203:return t=e.dataView.getFloat64(e.offset+1),e.offset+=9,t;case 204:return t=e.buffer[e.offset+1],e.offset+=2,t;case 205:return t=e.dataView.getUint16(e.offset+1),e.offset+=3,t;case 206:return t=e.dataView.getUint32(e.offset+1),e.offset+=5,t;case 208:return t=e.dataView.getInt8(e.offset+1),e.offset+=2,t;case 209:return t=e.dataView.getInt16(e.offset+1),e.offset+=3,t;case 210:return t=e.dataView.getInt32(e.offset+1),e.offset+=5,t;case 217:return r=e.dataView.getUint8(e.offset+1),e.offset+=2,Zw(e,r);case 218:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,Zw(e,r);case 219:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,Zw(e,r);case 220:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,Qw(e,r);case 221:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,Qw(e,r);case 222:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,Yw(e,r);case 223:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,Yw(e,r)}throw Error("Unknown type 0x"+n.toString(16))}function eA(e){for(var t=Object.create(null),r=Object.create(null),n=0,i=e.columns;n<i.length;n++){var a=i[n];t[a.name]=a}return{rowCount:e.rowCount,name:e.name.substr(1),fieldNames:e.columns.map(function(e){return e.name}),getField:function(e){var n=t[e];if(n)return r[e]||(r[e]=function(e){var t=e.mask?Nw(e.mask):void 0,r=Nw(e.data),n=Bv(r),i=n?t?function(e){return 0===t[e]?""+r[e]:""}:function(e){return""+r[e]}:t?function(e){return 0===t[e]?r[e]:""}:function(e){return r[e]},a=n?function(e){return r[e]}:function(e){var t=r[e];return Lv(t,0,t.length)},o=n?function(e){return r[e]}:function(e){var t=r[e];return Uv(t,0,t.length)},s=t?function(e){return t[e]}:function(e){return 0},u=r.length;return{__array:r,binaryEncoding:e.data.encoding,isDefined:!0,rowCount:u,str:i,int:a,float:o,valueKind:s,areValuesEqual:function(e,t){return r[e]===r[t]},toStringArray:function(e){return Rv(u,i,e)},toIntArray:n?function(e){return Nv(r,e)}:function(e){return Rv(u,a,e)},toFloatArray:n?function(e){return Nv(r,e)}:function(e){return Rv(u,o,e)}}}(n)),r[e]}}}function tA(e){var t=this;return vy.create("Parse BinaryCIF",function(r){return Tc(t,void 0,void 0,function(){var t,r,n;return Pc(this,function(i){t=[0,3];try{return r=Xw(e),function(e,t){for(var r=0;r<2;r++)if(e[r]>t[r])return!1;return!0}(t,r.version.match(/(\d)\.(\d)\.\d/).slice(1).map(function(e){return+e}))?(n=cw(r.dataBlocks.map(function(e){for(var t=Object.create(null),r=0,n=e.categories;r<n.length;r++){var i=n[r];t[i.name.substr(1)]=eA(i)}return lw(e.categories.map(function(e){return e.name.substr(1)}),t,e.header)})),[2,RS.success(n)]):[2,RS.error(`Unsupported format version. Current ${r.version}, required ${t.join(".")}.`)]}catch(e){return[2,RS.error(""+e)]}})})})}function rA(e,t,r){return function(e,t,r){for(var n=Object.create(null),i=0,a=Object.keys(e);i<a.length;i++){var o=a[i];n[o]=sA(o,e[o],t,r)}return wv.ofTables(t.header,e,n)}(e,t,r)}function nA(e,t){return new aA(t,e,!0)}function iA(e,t,r,n){return{schema:e,__array:t.__array,isDefined:t.isDefined,rowCount:t.rowCount,value:r,valueKind:t.valueKind,areValuesEqual:t.areValuesEqual,toArray:n}}(function(e){function t(e){return new Ww([e])}function r(e){switch(e.kind){case"ByteArray":return Hw.byteArray;case"FixedPoint":return Hw.fixedPoint(e.factor);case"IntervalQuantization":return Hw.intervalQuantizaiton(e.min,e.max,e.numSteps);case"RunLength":return Hw.runLength;case"Delta":return Hw.delta;case"IntegerPacking":return Hw.integerPacking;case"StringArray":return Hw.stringArray}}e.by=t,e.fromEncoding=function(e){for(var n=t(r(e[0])),i=1;i<e.length;i++)n=n.and(r(e[i]));return n}})(Vw||={}),function(e){var t,r;e.by=function(e){return new Ww([e])};var n=((t={})[US.IntDataType.Int16]=function(e,t,r){e.setInt16(2*t,r,!0)},t[US.IntDataType.Uint16]=function(e,t,r){e.setUint16(2*t,r,!0)},t[US.IntDataType.Int32]=function(e,t,r){e.setInt32(4*t,r,!0)},t[US.IntDataType.Uint32]=function(e,t,r){e.setUint32(4*t,r,!0)},t[US.FloatDataType.Float32]=function(e,t,r){e.setFloat32(4*t,r,!0)},t[US.FloatDataType.Float64]=function(e,t,r){e.setFloat64(8*t,r,!0)},t),i=((r={})[US.IntDataType.Int16]=2,r[US.IntDataType.Uint16]=2,r[US.IntDataType.Int32]=4,r[US.IntDataType.Uint32]=4,r[US.FloatDataType.Float32]=4,r[US.FloatDataType.Float64]=8,r);function a(e){var t=US.getDataType(e);if(t===US.IntDataType.Int8)return function(e){return{encodings:[{kind:"ByteArray",type:US.IntDataType.Int8}],data:new Uint8Array(e.buffer,e.byteOffset)}}(e);if(t===US.IntDataType.Uint8)return function(e){return{encodings:[{kind:"ByteArray",type:US.IntDataType.Uint8}],data:e}}(e);
139for(var r=new Uint8Array(e.length*i[t]),a=n[t],o=new DataView(r.buffer),s=0,u=e.length;s<u;s++)a(o,s,e[s]);return{encodings:[{kind:"ByteArray",type:t}],data:r}}function o(e,t){for(var r=0,n=0,i=e.length;n<i;n++)r+=e[n]/t|0;return r+e.length}function s(e,t){for(var r=-t-1,n=0,i=0,a=e.length;i<a;i++){var o=e[i];n+=o>=0?o/t|0:o/r|0}return n+e.length}e.byteArray=a,e.fixedPoint=function(e){return function(t){return function(e,t){for(var r=US.getDataType(e),n=new Int32Array(e.length),i=0,a=e.length;i<a;i++)n[i]=Math.round(e[i]*t);return{encodings:[{kind:"FixedPoint",factor:t,srcType:r}],data:n}}(t,e)}},e.intervalQuantizaiton=function(e,t,r,n){return void 0===n&&(n=Int32Array),function(i){return function(e,t,r,n,i){var a=US.getDataType(e);if(!e.length)return{encodings:[{kind:"IntervalQuantization",min:t,max:r,numSteps:n,srcType:a}],data:new Int32Array};if(r<t){var o=t;t=r,r=o}for(var s=(r-t)/(n-1),u=new i(e.length),c=0,l=e.length;c<l;c++){var d=e[c];u[c]=d<=t?0:d>=r?n-1:0|Math.round((d-t)/s)}return{encodings:[{kind:"IntervalQuantization",min:t,max:r,numSteps:n,srcType:a}],data:u}}(i,e,t,r,n)}},e.runLength=function(e){var t=US.getDataType(e);if(void 0===t&&(e=new Int32Array(e),t=US.IntDataType.Int32),!e.length)return{encodings:[{kind:"RunLength",srcType:t,srcSize:0}],data:new Int32Array};for(var r=2,n=1,i=e.length;n<i;n++)e[n-1]!==e[n]&&(r+=2);var a=new Int32Array(r),o=0,s=1;for(n=1,i=e.length;n<i;n++)e[n-1]===e[n]?++s:(a[o]=e[n-1],a[o+1]=s,s=1,o+=2);return a[o]=e[e.length-1],a[o+1]=s,{encodings:[{kind:"RunLength",srcType:t,srcSize:e.length}],data:a}},e.delta=function(e){if(!US.isSignedIntegerDataType(e))throw Error("Only signed integer types can be encoded using delta encoding.");var t=US.getDataType(e);if(void 0===t&&(e=new Int32Array(e),t=US.IntDataType.Int32),!e.length)return{encodings:[{kind:"Delta",origin:0,srcType:t}],data:new e.constructor(0)};var r=new e.constructor(e.length),n=e[0];r[0]=e[0];for(var i=1,a=e.length;i<a;i++)r[i]=e[i]-e[i-1];return r[0]=0,{encodings:[{kind:"Delta",origin:n,srcType:t}],data:r}},e.integerPacking=function(e){var t=function(e){var t=function(e){for(var t=0,r=e.length;t<r;t++)if(e[t]<0)return!0;return!1}(e),r=t?s(e,127):o(e,255),n=t?s(e,32767):o(e,65535);return 4*e.length<2*n?{isSigned:t,size:e.length,bytesPerElement:4}:2*n<r?{isSigned:t,size:n,bytesPerElement:2}:{isSigned:t,size:r,bytesPerElement:1}}(e);return 4===t.bytesPerElement?a(e):function(e,t){for(var r=t.isSigned?1===t.bytesPerElement?127:32767:1===t.bytesPerElement?255:65535,n=-r-1,i=e.length,o=t.isSigned?1===t.bytesPerElement?new Int8Array(t.size):new Int16Array(t.size):1===t.bytesPerElement?new Uint8Array(t.size):new Uint16Array(t.size),s=0,u=0;u<i;u++){var c=e[u];if(c>=0)for(;c>=r;)o[s]=r,++s,c-=r;else for(;c<=n;)o[s]=n,++s,c-=n;o[s]=c,++s}var l=a(o);return{encodings:[{kind:"IntegerPacking",byteCount:t.bytesPerElement,isUnsigned:!t.isSigned,srcSize:i},l.encodings[0]],data:l.data}}(e,t)},e.stringArray=function(e){var t=Object.create(null),r=[],n=new Int32Array(e.length),i=iv.create(Int32Array,1,Math.min(1024,e.length<32?e.length+1:Math.round(e.length/8)+1));iv.add(i,0);for(var a=0,o=0,s=0,u=e;s<u.length;s++){var c=u[s];if(null!=c){var l=t[c];void 0===l&&(a+=c.length,r[l=r.length]=c,t[c]=l,iv.add(i,a)),n[o++]=l}else n[o++]=-1}var d=iv.compact(i),f=Gw(d).encode(d),h=Gw(n).encode(n);return{encodings:[{kind:"StringArray",dataEncoding:h.encoding,stringData:r.join(""),offsetEncoding:f.encoding,offsets:f.data}],data:h.data}}}(Hw||={}),function(e){function t(e){return e.replace(".","_").replace(/\[/,"_").replace(/(\[|\])/g,"")}e.canonical=t,e.equal=function(e,r){return t(e)===t(r)},e.create=function(e,r,n){void 0===n&&(n=!1);var i=`${e}${r?`.${r}`:""}`;return n?t(i):i}}(qw||={});var aA=function(e,t,r){this._isDefined=r;var n=Object.keys(t);this._rowCount=e.rowCount,this._columns=n,this._schema=t;for(var i=Object.create(null),a=function(r){Object.defineProperty(o,r,{get:function(){if(i[r])return i[r];var n=t[r];if("list"===n.valueType)i[r]=function(e,t,r){var n=e.separator,i=e.itemParse,a=t.getField(r),o=a?function(e){return a.str(e).split(n).map(function(e){return i(e.trim())}).filter(function(e){return!!e})}:function(e){return[]};return{schema:e,__array:void 0,isDefined:!!a,rowCount:t.rowCount,value:o,valueKind:a?a.valueKind:function(){return 1},areValuesEqual:function(e,t){return af(o(e),o(t))},toArray:function(e){return Rv(t.rowCount,o,e)}}}(n,e,r);else if("tensor"===n.valueType)i[r]=function(e,t,r){var n=e.space,i=t.fieldNames.includes(`${r}[0]`)||t.fieldNames.includes(`${r}[0][0]`)||t.fieldNames.includes(`${r}[0][0][0]`),a=+!i,o=t.fieldNames.includes(`${r}_1`)||t.fieldNames.includes(`${r}_11`)||t.fieldNames.includes(`${r}_111`)?"underscore":"brackets",s=function(e,t,r,n){var i=+!r;switch(t){case 1:return"brackets"===n?function(t){return`${e}[${t+i}]`}:function(t){return`${e}_${t+i}`};case 2:return"brackets"===n?function(t,r){return`${e}[${t+i}][${r+i}]`}:function(t,r){return`${e}_${t+i}${r+i}`};case 3:return"brackets"===n?function(t,r,n){return`${e}[${t+i}][${r+i}][${n+i}]`}:function(t,r,n){return`${e}_${t+i}${r+i}${n+i}`};default:throw Error("Tensors with rank > 3 or rank 0 are currently not supported.")}}(r,n.rank,i,o),u=t.getField(s(a,a,a))||xv.Undefined(t.rowCount,e),c=function(e){return function(e,t,r,n){var i=t.create();if(1===t.rank)for(var a=t.dimensions[0],o=0;o<a;o++){var s=e.getField(n(o));t.set(i,o,s?s.float(r):0)}else if(2===t.rank){a=t.dimensions[0];var u=t.dimensions[1];for(o=0;o<a;o++)for(var c=0;c<u;c++)s=e.getField(n(o,c)),t.set(i,o,c,s?s.float(r):0)}else{if(3!==t.rank)throw Error("Tensors with rank > 3 or rank 0 are currently not supported.");var l=t.dimensions[0],d=t.dimensions[1],f=t.dimensions[2];for(o=0;o<l;o++)for(c=0;c<d;c++)for(var h=0;h<f;h++)s=e.getField(n(o,c,h)),t.set(i,o,c,h,s?s.float(r):0)}return i}
139(t,n,e,s)};return{schema:e,__array:void 0,isDefined:u.isDefined,rowCount:t.rowCount,value:c,valueKind:u.valueKind,areValuesEqual:function(e,t){return Tg.areEqualExact(c(e),c(t))},toArray:function(e){return Rv(t.rowCount,c,e)}}}(n,e,r);else{var a=function(e){switch(e.valueType){case"str":return function(t,r,n){return i=e,a=t,o=t.str,s=t.toStringArray,{schema:i,__array:a.__array,isDefined:a.isDefined,rowCount:a.rowCount,value:"lowercase"===i.transform?function(e){return o(e).toLowerCase()}:"uppercase"===i.transform?function(e){return o(e).toUpperCase()}:o,valueKind:a.valueKind,areValuesEqual:a.areValuesEqual,toArray:"lowercase"===i.transform?function(e){return Array.from(s(e)).map(function(e){return e.toLowerCase()})}:"uppercase"===i.transform?function(e){return Array.from(s(e)).map(function(e){return e.toUpperCase()})}:s};var i,a,o,s};case"int":return function(t,r,n){return iA(e,t,t.int,t.toIntArray)};case"float":return function(t,r,n){return iA(e,t,t.float,t.toFloatArray)};case"list":throw Error("Use createListColumn instead.");case"tensor":throw Error("Use createTensorColumn instead.")}}(n),o=e.getField(r);i[r]=o?a(o,e,r):xv.Undefined(e.rowCount,n)}return i[r]},enumerable:!0,configurable:!1})},o=this,s=0,u=n;s<u.length;s++)a(u[s])};function oA(e,t,r,n){var i=qw.create(t,e),a=qw.canonical(i);if(a in r)return r[a];if(n&&i in n)for(var o=0,s=n[i];o<s.length;o++){var u=s[o],c=qw.canonical(u);if(c in r)return r[c]}}function sA(e,t,r,n){var i=r.categories[e];if(n){for(var a=function(e){for(var t=Object.create(null),r=0,n=Object.keys(e.categories);r<n.length;r++)for(var i=n[r],a=0,o=e.categories[i].fieldNames;a<o.length;a++){var s=o[a];t[qw.create(i,s,!0)]=e.categories[i].getField(s)}return t}(r),o=Object.create(null),s=[],u=0,c=0,l=Object.keys(t);c<l.length;c++){var d=l[c],f=oA(d,e,a,n);f&&(o[d]=f,s.push(d),u=f.rowCount)}i={rowCount:u,name:e,fieldNames:kc([],s,!0),getField:function(e){return o[e]}}}return new aA(i||dw.empty(e),t,!!i)}var uA=xv.Schema,cA=uA.str,lA=uA.int,dA=uA.float,fA=uA.coord,hA=uA.Aliased,pA=uA.Matrix,mA=uA.Vector,gA=uA.lstr,vA=uA.List,yA={atom_site:{auth_asym_id:cA,auth_atom_id:cA,auth_comp_id:cA,auth_seq_id:lA,B_iso_or_equiv:dA,Cartn_x:fA,Cartn_y:fA,Cartn_z:fA,group_PDB:hA(cA),id:lA,label_alt_id:cA,label_asym_id:cA,label_atom_id:cA,label_comp_id:cA,label_entity_id:cA,label_seq_id:lA,occupancy:dA,type_symbol:cA,pdbx_PDB_ins_code:cA,pdbx_PDB_model_num:lA,pdbx_formal_charge:lA,pdbx_label_index:lA,pdbx_sifts_xref_db_name:cA,pdbx_sifts_xref_db_acc:cA,pdbx_sifts_xref_db_num:cA,pdbx_sifts_xref_db_res:cA,ihm_model_id:lA},atom_site_anisotrop:{id:lA,type_symbol:cA,U:pA(3,3),U_esd:pA(3,3),pdbx_auth_seq_id:cA,pdbx_auth_asym_id:cA,pdbx_auth_atom_id:cA,pdbx_auth_comp_id:cA,pdbx_label_seq_id:lA,pdbx_label_alt_id:cA,pdbx_label_asym_id:cA,pdbx_label_atom_id:cA,pdbx_label_comp_id:cA,pdbx_PDB_ins_code:cA},atom_sites:{entry_id:cA,fract_transf_matrix:pA(3,3),fract_transf_vector:mA(3)},audit_author:{name:cA,pdbx_ordinal:lA,identifier_ORCID:cA},audit_conform:{dict_location:cA,dict_name:cA,dict_version:cA},cell:{angle_alpha:dA,angle_beta:dA,angle_gamma:dA,entry_id:cA,length_a:dA,length_b:dA,length_c:dA,Z_PDB:lA,pdbx_unique_axis:cA},chem_comp:{formula:cA,formula_weight:dA,id:cA,mon_nstd_flag:hA(gA),name:cA,type:hA(gA),pdbx_synonyms:vA(";",function(e){return e})},chem_comp_bond:{atom_id_1:cA,atom_id_2:cA,comp_id:cA,value_order:hA(gA),pdbx_ordinal:lA,pdbx_stereo_config:hA(gA),pdbx_aromatic_flag:hA(gA)},citation:{book_publisher:cA,country:cA,id:cA,journal_abbrev:cA,journal_id_ASTM:cA,journal_id_CSD:cA,journal_id_ISSN:cA,journal_volume:cA,page_first:cA,page_last:cA,title:cA,year:lA,pdbx_database_id_DOI:cA,pdbx_database_id_PubMed:lA},citation_author:{citation_id:cA,name:cA,ordinal:lA},database_2:{database_id:hA(gA),database_code:cA},entity:{details:cA,formula_weight:dA,id:cA,src_method:hA(gA),type:hA(gA),pdbx_description:vA(",",function(e){return e}),pdbx_number_of_molecules:lA,pdbx_mutation:cA,pdbx_fragment:cA,pdbx_ec:vA(",",function(e){return e})},entity_poly:{entity_id:cA,nstd_linkage:hA(gA),nstd_monomer:hA(gA),type:hA(cA),pdbx_strand_id:vA(",",function(e){return e}),pdbx_seq_one_letter_code:cA,pdbx_seq_one_letter_code_can:cA,pdbx_target_identifier:cA},entity_poly_seq:{entity_id:cA,hetero:hA(gA),mon_id:cA,num:lA},entry:{id:cA},exptl:{entry_id:cA,method:hA(cA)},software:{classification:cA,date:cA,description:cA,name:cA,type:hA(gA),version:cA,pdbx_ordinal:lA},struct:{entry_id:cA,title:cA,pdbx_descriptor:cA},struct_asym:{details:cA,entity_id:cA,id:cA,pdbx_modified:cA,pdbx_blank_PDB_chainid_flag:hA(cA)},struct_conf:{beg_label_asym_id:cA,beg_label_comp_id:cA,beg_label_seq_id:lA,beg_auth_asym_id:cA,beg_auth_comp_id:cA,beg_auth_seq_id:lA,conf_type_id:hA(gA),details:cA,end_label_asym_id:cA,end_label_comp_id:cA,end_label_seq_id:lA,end_auth_asym_id:cA,end_auth_comp_id:cA,end_auth_seq_id:lA,id:cA,pdbx_beg_PDB_ins_code:cA,pdbx_end_PDB_ins_code:cA,pdbx_PDB_helix_class:cA,pdbx_PDB_helix_length:lA,pdbx_PDB_helix_id:cA},struct_conn:{conn_type_id:hA(gA),details:cA,id:cA,ptnr1_label_asym_id:cA,ptnr1_label_atom_id:cA,ptnr1_label_comp_id:cA,ptnr1_label_seq_id:lA,ptnr1_auth_asym_id:cA,ptnr1_auth_comp_id:cA,ptnr1_auth_seq_id:lA,ptnr1_symmetry:cA,ptnr2_label_asym_id:cA,ptnr2_label_atom_id:cA,ptnr2_label_comp_id:cA,ptnr2_label_seq_id:lA,ptnr2_auth_asym_id:cA,ptnr2_auth_comp_id:cA,ptnr2_auth_seq_id:lA,ptnr2_symmetry:cA,pdbx_ptnr1_PDB_ins_code:cA,pdbx_ptnr1_label_alt_id:cA,pdbx_ptnr1_standard_comp_id:cA,pdbx_ptnr2_PDB_ins_code:cA,pdbx_ptnr2_label_alt_id:cA,pdbx_ptnr3_PDB_ins_code:cA,pdbx_ptnr3_label_alt_id:cA,pdbx_ptnr3_label_asym_id:cA,pdbx_ptnr3_label_atom_id:cA,pdbx_ptnr3_label_comp_id:cA,pdbx_ptnr3_label_seq_id:lA,pdbx_PDB_id:cA,pdbx_dist_value:dA,pdbx_value_order:hA(gA)},struct_conn_type:{criteria:cA,id:hA(gA),reference:cA},struct_keywords:{entry_id:cA,text:vA(",",function(e){return e}),pdbx_keywords:cA},struct_ncs_oper:{code:hA(cA),details:cA,id:lA,matrix:pA(3,3),vector:mA(3)},struct_sheet_range:{beg_label_asym_id:cA,beg_label_comp_id:cA,beg_label_seq_id:lA,end_label_asym_id:cA,end_label_comp_id:cA,end_label_seq_id:lA,beg_auth_asym_id:cA,beg_auth_comp_id:cA,beg_auth_seq_id:lA,end_auth_asym_id:cA,end_auth_comp_id:cA,end_auth_seq_id:lA,id:cA,sheet_id:cA,pdbx_beg_PDB_ins_code:cA,pdbx_end_PDB_ins_code:cA},struct_site:{details:cA,id:cA,pdbx_num_residues:lA,pdbx_evidence_code:cA,pdbx_auth_asym_id:cA,pdbx_auth_comp_id:cA,pdbx_auth_seq_id:cA,pdbx_auth_ins_code:cA},struct_site_gen:{details:cA,id:cA,label_alt_id:cA,label_asym_id:cA,label_atom_id:cA,label_comp_id:cA,label_seq_id:lA,auth_asym_id:cA,auth_comp_id:cA,auth_seq_id:cA,site_id:cA,symmetry:cA,pdbx_auth_ins_code:cA,pdbx_num_res:lA},symmetry:{entry_id:cA,cell_setting:hA(gA),Int_Tables_number:lA,space_group_name_Hall:cA,"space_group_name_H-M":cA},pdbx_database_status:{status_code:hA(cA),status_code_sf:hA(cA),status_code_mr:hA(cA),entry_id:cA,recvd_initial_deposition_date:cA,SG_entry:hA(gA),deposit_site:hA(cA),process_site:hA(cA),status_code_cs:hA(cA),methods_development_category:hA(cA),pdb_format_compatible:hA(gA)},pdbx_nonpoly_scheme:{asym_id:cA,entity_id:cA,mon_id:cA,pdb_strand_id:cA,ndb_seq_num:cA,pdb_seq_num:cA,auth_seq_num:cA,pdb_mon_id:cA,auth_mon_id:cA,pdb_ins_code:cA},pdbx_database_related:{db_name:cA,details:cA,db_id:cA,content_type:hA(cA)},pdbx_entity_nonpoly:{entity_id:cA,comp_id:cA,name:cA},pdbx_chem_comp_synonyms:{name:cA,comp_id:cA,provenance:hA(cA)},pdbx_chem_comp_identifier:{comp_id:cA,identifier:cA,type:hA(cA),program:cA,program_version:cA},pdbx_unobs_or_zero_occ_residues:{id:lA,polymer_flag:hA(gA),occupancy_flag:hA(lA),PDB_model_num:lA,auth_asym_id:cA,auth_comp_id:cA,auth_seq_id:cA,PDB_ins_code:cA,label_asym_id:cA,label_comp_id:cA,label_seq_id:lA},pdbx_struct_mod_residue:{id:lA,auth_asym_id:cA,auth_comp_id:cA,auth_seq_id:lA,PDB_ins_code:cA,label_asym_id:cA,label_comp_id:cA,label_seq_id:lA,parent_comp_id:cA,details:cA},pdbx_struct_oper_list:{id:cA,type:hA(cA),name:cA,symmetry_operation:cA,matrix:pA(3,3),vector:mA(3)}
139,pdbx_struct_assembly:{method_details:cA,oligomeric_details:cA,oligomeric_count:lA,details:cA,id:cA},pdbx_struct_assembly_gen:{asym_id_list:vA(",",function(e){return e}),assembly_id:cA,oper_expression:cA},pdbx_reference_entity_list:{prd_id:cA,ref_entity_id:cA,type:hA(gA),details:cA,component_id:lA},pdbx_reference_entity_link:{link_id:lA,prd_id:cA,details:cA,ref_entity_id_1:cA,ref_entity_id_2:cA,entity_seq_num_1:lA,entity_seq_num_2:lA,comp_id_1:cA,comp_id_2:cA,atom_id_1:cA,atom_id_2:cA,value_order:hA(gA),component_1:lA,component_2:lA,link_class:hA(cA)},pdbx_reference_entity_poly_link:{link_id:lA,prd_id:cA,ref_entity_id:cA,component_id:lA,entity_seq_num_1:lA,entity_seq_num_2:lA,comp_id_1:cA,comp_id_2:cA,atom_id_1:cA,atom_id_2:cA,value_order:hA(gA)},pdbx_molecule:{prd_id:cA,instance_id:lA,asym_id:cA},pdbx_molecule_features:{prd_id:cA,class:hA(gA),type:hA(gA),name:cA,details:cA},entity_src_nat:{entity_id:cA,pdbx_organism_scientific:cA,pdbx_plasmid_name:cA,pdbx_src_id:lA,pdbx_beg_seq_num:lA,pdbx_end_seq_num:lA},entity_src_gen:{entity_id:cA,pdbx_gene_src_gene:vA(",",function(e){return e}),pdbx_gene_src_scientific_name:cA,plasmid_name:cA,pdbx_src_id:lA,pdbx_beg_seq_num:lA,pdbx_end_seq_num:lA},pdbx_entity_src_syn:{organism_scientific:cA,entity_id:cA,pdbx_src_id:lA,pdbx_beg_seq_num:lA,pdbx_end_seq_num:lA},pdbx_entity_branch_descriptor:{entity_id:cA,descriptor:cA,type:hA(gA),program:cA,program_version:cA,ordinal:lA},pdbx_entity_instance_feature:{details:cA,feature_type:hA(cA),auth_asym_id:cA,asym_id:cA,auth_seq_num:cA,seq_num:lA,comp_id:cA,auth_comp_id:cA,ordinal:lA},pdbx_entity_branch_list:{entity_id:cA,hetero:hA(gA),comp_id:cA,num:lA},pdbx_entity_branch_link:{link_id:lA,details:cA,entity_id:cA,entity_branch_list_num_1:lA,entity_branch_list_num_2:lA,comp_id_1:cA,comp_id_2:cA,atom_id_1:cA,leaving_atom_id_1:cA,atom_stereo_config_1:hA(gA),atom_id_2:cA,leaving_atom_id_2:cA,atom_stereo_config_2:hA(gA),value_order:hA(gA)},pdbx_entity_branch:{entity_id:cA,type:hA(cA)},pdbx_branch_scheme:{entity_id:cA,hetero:hA(gA),asym_id:cA,mon_id:cA,num:lA,pdb_asym_id:cA,pdb_seq_num:cA,pdb_mon_id:cA,auth_asym_id:cA,auth_seq_num:cA,auth_mon_id:cA},pdbx_chem_comp_related:{comp_id:cA,related_comp_id:cA,relationship_type:hA(cA),details:cA},ihm_starting_model_details:{starting_model_id:cA,entity_id:cA,entity_description:cA,asym_id:cA,entity_poly_segment_id:lA,starting_model_source:hA(cA),starting_model_auth_asym_id:cA,starting_model_sequence_offset:lA,dataset_list_id:lA},ihm_starting_comparative_models:{id:lA,starting_model_id:cA,starting_model_auth_asym_id:cA,starting_model_seq_id_begin:lA,starting_model_seq_id_end:lA,template_auth_asym_id:cA,template_seq_id_begin:lA,template_seq_id_end:lA,template_sequence_identity:dA,template_sequence_identity_denominator:hA(lA),template_dataset_list_id:lA,alignment_file_id:lA},ihm_starting_model_seq_dif:{id:lA,entity_id:cA,asym_id:cA,seq_id:lA,comp_id:cA,starting_model_id:cA,db_asym_id:cA,db_seq_id:lA,db_comp_id:cA,details:cA},ihm_model_representation:{id:lA,name:cA,details:cA},ihm_model_representation_details:{id:lA,representation_id:lA,entity_poly_segment_id:lA,entity_id:cA,entity_description:cA,entity_asym_id:cA,model_object_primitive:hA(cA),starting_model_id:cA,model_mode:hA(cA),model_granularity:hA(cA),model_object_count:lA},ihm_struct_assembly_details:{id:lA,assembly_id:lA,parent_assembly_id:lA,entity_description:cA,entity_id:cA,asym_id:cA,entity_poly_segment_id:lA},ihm_struct_assembly:{id:lA,name:cA,description:cA},ihm_modeling_protocol:{id:lA,num_steps:lA,protocol_name:cA},ihm_modeling_protocol_details:{id:lA,protocol_id:lA,step_id:lA,struct_assembly_id:lA,dataset_group_id:lA,struct_assembly_description:cA,step_name:cA,step_method:cA,num_models_begin:lA,num_models_end:lA,multi_scale_flag:hA(gA),multi_state_flag:hA(gA),ordered_flag:hA(gA),script_file_id:lA,software_id:lA},ihm_multi_state_modeling:{state_id:lA,state_group_id:lA,population_fraction:dA,population_fraction_sd:dA,state_type:cA,state_name:cA,experiment_type:hA(cA),details:cA},ihm_modeling_post_process:{id:lA,protocol_id:lA,analysis_id:lA,step_id:lA,type:hA(cA),feature:hA(cA),num_models_begin:lA,num_models_end:lA},ihm_ensemble_info:{ensemble_id:lA,ensemble_name:cA,post_process_id:lA,model_group_id:lA,ensemble_clustering_method:hA(cA),ensemble_clustering_feature:hA(cA),num_ensemble_models:lA,num_ensemble_models_deposited:lA,ensemble_precision_value:dA,ensemble_file_id:lA},ihm_model_list:{model_id:lA,model_name:cA,assembly_id:lA,protocol_id:lA,representation_id:lA},ihm_model_group:{id:lA,name:cA,details:cA},ihm_model_group_link:{model_id:lA,group_id:lA},ihm_model_representative:{id:lA,model_group_id:lA,model_id:lA,selection_criteria:hA(cA)},ihm_dataset_list:{id:lA,data_type:hA(cA),database_hosted:hA(gA)},ihm_dataset_group:{id:lA,name:cA,application:hA(cA),details:cA},ihm_dataset_group_link:{dataset_list_id:lA,group_id:lA},ihm_related_datasets:{dataset_list_id_derived:lA,dataset_list_id_primary:lA}
139,ihm_dataset_related_db_reference:{id:lA,dataset_list_id:lA,db_name:hA(cA),accession_code:cA,version:cA,details:cA},ihm_external_reference_info:{reference_id:lA,reference_provider:cA,reference_type:hA(cA),reference:cA,refers_to:hA(cA),associated_url:cA},ihm_external_files:{id:lA,reference_id:lA,file_path:cA,content_type:hA(cA),file_size_bytes:dA,details:cA},ihm_dataset_external_reference:{id:lA,dataset_list_id:lA,file_id:lA},ihm_localization_density_files:{id:lA,file_id:lA,ensemble_id:lA,entity_id:cA,entity_poly_segment_id:lA,asym_id:cA},ihm_predicted_contact_restraint:{id:lA,group_id:lA,entity_id_1:cA,entity_id_2:cA,asym_id_1:cA,asym_id_2:cA,comp_id_1:cA,comp_id_2:cA,seq_id_1:lA,seq_id_2:lA,rep_atom_1:hA(cA),rep_atom_2:hA(cA),distance_lower_limit:dA,distance_upper_limit:dA,probability:dA,restraint_type:hA(cA),model_granularity:hA(cA),dataset_list_id:lA,software_id:lA},ihm_cross_link_list:{id:lA,group_id:lA,entity_description_1:cA,entity_description_2:cA,entity_id_1:cA,entity_id_2:cA,comp_id_1:cA,comp_id_2:cA,seq_id_1:lA,seq_id_2:lA,linker_type:hA(cA),dataset_list_id:lA},ihm_cross_link_restraint:{id:lA,group_id:lA,entity_id_1:cA,entity_id_2:cA,asym_id_1:cA,asym_id_2:cA,comp_id_1:cA,comp_id_2:cA,seq_id_1:lA,seq_id_2:lA,atom_id_1:cA,atom_id_2:cA,restraint_type:hA(cA),conditional_crosslink_flag:hA(cA),model_granularity:hA(cA),distance_threshold:dA,psi:dA,sigma_1:dA,sigma_2:dA},ihm_cross_link_result_parameters:{id:lA,restraint_id:lA,model_id:lA,psi:dA,sigma_1:dA,sigma_2:dA},ihm_2dem_class_average_restraint:{id:lA,dataset_list_id:lA,number_raw_micrographs:lA,pixel_size_width:dA,pixel_size_height:dA,image_resolution:dA,image_segment_flag:hA(gA),number_of_projections:lA,struct_assembly_id:lA,details:cA},ihm_2dem_class_average_fitting:{id:lA,restraint_id:lA,model_id:lA,cross_correlation_coefficient:dA,rot_matrix:pA(3,3),tr_vector:mA(3)},ihm_3dem_restraint:{id:lA,dataset_list_id:lA,model_id:lA,struct_assembly_id:lA,fitting_method:cA,number_of_gaussians:lA,cross_correlation_coefficient:dA},ihm_sas_restraint:{id:lA,dataset_list_id:lA,model_id:lA,struct_assembly_id:lA,profile_segment_flag:hA(gA),fitting_atom_type:cA,fitting_method:cA,fitting_state:hA(cA),radius_of_gyration:dA,chi_value:dA,details:cA},ihm_starting_model_coord:{ordinal_id:lA,starting_model_id:cA,group_PDB:hA(cA),id:lA,type_symbol:cA,entity_id:cA,atom_id:cA,comp_id:cA,seq_id:lA,asym_id:cA,Cartn_x:dA,Cartn_y:dA,Cartn_z:dA,B_iso_or_equiv:dA},ihm_sphere_obj_site:{id:lA,entity_id:cA,seq_id_begin:lA,seq_id_end:lA,asym_id:cA,Cartn_x:dA,Cartn_y:dA,Cartn_z:dA,object_radius:dA,rmsf:dA,model_id:lA},ihm_gaussian_obj_site:{id:lA,entity_id:cA,seq_id_begin:lA,seq_id_end:lA,asym_id:cA,mean_Cartn_x:dA,mean_Cartn_y:dA,mean_Cartn_z:dA,weight:dA,covariance_matrix:pA(3,3),model_id:lA},ihm_gaussian_obj_ensemble:{id:lA,entity_id:cA,seq_id_begin:lA,seq_id_end:lA,asym_id:cA,mean_Cartn_x:dA,mean_Cartn_y:dA,mean_Cartn_z:dA,weight:dA,covariance_matrix:pA(3,3),ensemble_id:lA},ihm_feature_list:{feature_id:lA,feature_type:hA(cA),entity_type:hA(cA)},ihm_poly_residue_feature:{ordinal_id:lA,feature_id:lA,entity_id:cA,asym_id:cA,comp_id_begin:cA,comp_id_end:cA,seq_id_begin:lA,seq_id_end:lA},ihm_derived_distance_restraint:{id:lA,group_id:lA,feature_id_1:lA,feature_id_2:lA,group_conditionality:hA(cA),random_exclusion_fraction:dA,distance_upper_limit:dA,restraint_type:hA(cA),dataset_list_id:lA},ma_model_list:{ordinal_id:lA,model_id:lA,model_group_id:lA,model_name:cA,model_group_name:cA,model_type:hA(cA),data_id:lA},ma_target_entity:{entity_id:cA,data_id:lA,origin:hA(cA)},ma_target_entity_instance:{asym_id:cA,entity_id:cA,details:cA},ma_target_ref_db_details:{target_entity_id:cA,db_name:hA(cA),db_code:cA,db_accession:cA,seq_db_isoform:cA,seq_db_align_begin:cA,seq_db_align_end:cA,ncbi_taxonomy_id:cA,organism_scientific:cA},ma_data:{id:lA,content_type:hA(cA),content_type_other_details:cA,name:cA},ma_software_group:{ordinal_id:lA,group_id:lA,software_id:lA},ma_qa_metric:{id:lA,name:cA,type:hA(cA),mode:hA(cA),software_group_id:lA},ma_qa_metric_global:{ordinal_id:lA,model_id:lA,metric_id:lA,metric_value:dA},ma_qa_metric_local:{ordinal_id:lA,model_id:lA,label_asym_id:cA,label_seq_id:lA,label_comp_id:cA,metric_id:lA,metric_value:dA}},bA=xv.Schema,_A=bA.str,xA=bA.float,SA=bA.List,wA=bA.lstr,AA=bA.Aliased,CA=bA.int,TA=bA.coord,PA={chem_comp:{formula:_A,formula_weight:xA,id:_A,mon_nstd_parent_comp_id:SA(",",function(e){return e}),name:_A,one_letter_code:_A,three_letter_code:_A,type:AA(wA),pdbx_synonyms:SA(";",function(e){return e}),pdbx_type:_A,pdbx_ambiguous_flag:_A,pdbx_replaced_by:_A,pdbx_replaces:_A,pdbx_formal_charge:CA,pdbx_model_coordinates_details:_A,pdbx_model_coordinates_db_code:_A,pdbx_ideal_coordinates_details:_A,pdbx_ideal_coordinates_missing_flag:AA(wA),pdbx_model_coordinates_missing_flag:AA(wA),pdbx_initial_date:_A,pdbx_modified_date:_A,pdbx_release_status:AA(_A),pdbx_processing_site:AA(_A)},chem_comp_atom:{alt_atom_id:_A,atom_id:_A,charge:CA,model_Cartn_x:TA,model_Cartn_y:TA,model_Cartn_z:TA,comp_id:_A,type_symbol:_A,pdbx_align:CA,pdbx_ordinal:CA,pdbx_model_Cartn_x_i
139deal:TA,pdbx_model_Cartn_y_ideal:TA,pdbx_model_Cartn_z_ideal:TA,pdbx_stereo_config:AA(wA),pdbx_aromatic_flag:AA(wA),pdbx_leaving_atom_flag:AA(wA)},chem_comp_bond:{atom_id_1:_A,atom_id_2:_A,comp_id:_A,value_order:AA(wA),pdbx_ordinal:CA,pdbx_stereo_config:AA(wA),pdbx_aromatic_flag:AA(wA)},pdbx_chem_comp_descriptor:{comp_id:_A,descriptor:_A,type:AA(wA),program:_A,program_version:_A},pdbx_chem_comp_identifier:{comp_id:_A,identifier:_A,type:AA(_A),program:_A,program_version:_A}},EA=xv.Schema,MA=EA.str,kA=EA.float,IA=EA.lstr,DA=EA.Aliased,OA=EA.int,RA={pdbx_reference_molecule:{prd_id:MA,formula_weight:kA,formula:MA,type:DA(IA),type_evidence_code:MA,class:DA(IA),class_evidence_code:MA,name:MA,represent_as:DA(IA),chem_comp_id:MA,compound_details:MA,description:MA,representative_PDB_id_code:MA,release_status:DA(IA),replaces:MA,replaced_by:MA},pdbx_reference_entity_list:{prd_id:MA,ref_entity_id:MA,type:DA(IA),details:MA,component_id:OA},pdbx_reference_entity_nonpoly:{prd_id:MA,ref_entity_id:MA,name:MA,chem_comp_id:MA},pdbx_reference_entity_link:{link_id:OA,prd_id:MA,details:MA,ref_entity_id_1:MA,ref_entity_id_2:MA,entity_seq_num_1:OA,entity_seq_num_2:OA,comp_id_1:MA,comp_id_2:MA,atom_id_1:MA,atom_id_2:MA,value_order:DA(IA),component_1:OA,component_2:OA,link_class:DA(MA)},pdbx_reference_entity_poly_link:{link_id:OA,prd_id:MA,ref_entity_id:MA,component_id:OA,entity_seq_num_1:OA,entity_seq_num_2:OA,comp_id_1:MA,comp_id_2:MA,atom_id_1:MA,atom_id_2:MA,value_order:DA(IA)},pdbx_reference_entity_poly:{prd_id:MA,ref_entity_id:MA,type:DA(MA),db_code:MA,db_name:MA},pdbx_reference_entity_poly_seq:{prd_id:MA,ref_entity_id:MA,mon_id:MA,parent_mon_id:MA,num:OA,observed:DA(IA),hetero:DA(IA)},pdbx_reference_entity_sequence:{prd_id:MA,ref_entity_id:MA,type:DA(MA),NRP_flag:DA(MA),one_letter_codes:MA},pdbx_reference_entity_src_nat:{prd_id:MA,ref_entity_id:MA,ordinal:OA,organism_scientific:MA,taxid:MA,db_code:MA,db_name:MA},pdbx_prd_audit:{prd_id:MA,date:MA,processing_site:DA(MA),action_type:DA(MA)}},BA=xv.Schema,NA=BA.str,FA={datablock:{id:NA,description:NA},dictionary:{title:NA,datablock_id:NA,version:NA},dictionary_history:{version:NA,update:NA,revision:NA},sub_category:{id:NA,description:NA},category_group_list:{id:NA,parent_id:NA,description:NA},item_type_list:{code:NA,primitive_code:NA,construct:NA,detail:NA},item_units_list:{code:NA,detail:NA},item_units_conversion:{from_code:NA,to_code:NA,operator:NA,factor:BA.float}},LA=xv.Schema,$A=LA.str,UA=LA.int,jA=LA.float,zA=LA.Aliased,GA=LA.Vector;zA($A),zA($A),zA($A),zA($A),GA(3),GA(3);var VA={volume_data_3d_info:{name:$A,axis_order:GA(3,UA),origin:GA(3),dimensions:GA(3),sample_rate:UA,sample_count:GA(3,UA),spacegroup_number:UA,spacegroup_cell_size:GA(3),spacegroup_cell_angles:GA(3),mean_source:jA,mean_sampled:jA,sigma_source:jA,sigma_sampled:jA,min_source:jA,min_sampled:jA,max_source:jA,max_sampled:jA},volume_data_3d:{values:jA}},HA=xv.Schema,qA=HA.float,WA=HA.int,XA=HA.str,YA={cell:{angle_alpha:qA,angle_beta:qA,angle_gamma:qA,formula_units_z:WA,length_a:qA,length_b:qA,length_c:qA,volume:qA},chemical:{melting_point:qA,name_common:XA,name_systematic:XA},chemical_formula:{moiety:XA,sum:XA,weight:qA},space_group:{crystal_system:XA,it_number:WA,"name_h-m_full":XA},space_group_symop:{operation_xyz:XA},geom_bond:{atom_site_label_1:XA,atom_site_label_2:XA,distance:qA,publ_flag:XA,site_symmetry_1:XA,site_symmetry_2:XA,valence:qA},audit:{block_doi:XA},database_code:{cod:XA,csd:XA,depnum_ccdc_archive:XA,depnum_ccdc_fiz:XA,icsd:XA,mdf:XA,nbs:XA},atom_site:{adp_type:XA,calc_flag:XA,disorder_assembly:XA,disorder_group:XA,fract_x:qA,fract_y:qA,fract_z:qA,label:XA,occupancy:qA,refinement_flags:XA,site_symmetry_multiplicity:WA,type_symbol:XA,u_iso_or_equiv:qA},atom_site_aniso:{label:XA,u_11:qA,u:(0,HA.Matrix)(3,3),u_12:qA,u_13:qA,u_22:qA,u_23:qA,u_33:qA},atom_type:{description:XA,symbol:XA},atom_type_scat:{dispersion_imag:qA,dispersion_real:qA,source:XA}},KA={"cell.formula_units_z":["cell_formula_units_Z"],"space_group.it_number":["space_group_IT_number","symmetry_Int_Tables_number"],"space_group.name_h-m_full":["symmetry_space_group_name_H-M"],"space_group_symop.operation_xyz":["symmetry_equiv_pos_as_xyz"],"geom_bond.atom_site_label_1":["geom_bond_atom_site_id_1"],"geom_bond.atom_site_label_2":["geom_bond_atom_site_id_2"],"geom_bond.distance":["geom_bond_dist"],"audit.block_doi":["audit_block_DOI"],"database_code.cod":["database_code_COD"],"database_code.csd":["database_code_CSD"],"database_code.depnum_ccdc_archive":["database_code_depnum_CCDC_archive"],"database_code.depnum_ccdc_fiz":["database_code_depnum_CCDC_fiz"],"database_code.icsd":["database_code_ICSD"],"database_code.mdf":["database_code_MDF"],"database_code.nbs":["database_code_NBS"],"atom_site.adp_type":["atom_site_ADP_type","atom_site_thermal_displace_type"],"atom_site.label":["atom_site_id"],"atom_site.site_symmetry_multiplicity":["atom_site_symmetry_multiplicity"],"atom_site.u_iso_or_equiv":["atom_site_U_iso_or_equiv"],"atom_site_aniso.label":["atom_site_anisotrop_id"],"atom_site_aniso.u_11":["atom_site_aniso_U_11","atom_site_anisotrop_U_11"],"atom_site_aniso.u_12":["atom_site_aniso_U_12","atom_site_anisotrop_U_12"],"atom_site_aniso.u_13":["atom_site_aniso_U_13","atom_site_anisotrop_U_13"],"atom_site_aniso.u_22":["atom_site_aniso_U_22","atom_site_anisotrop_U_22"],"atom_site_aniso.u_23":["atom_site_aniso_U_23","atom_site_anisotrop_U_23"],"atom_site_aniso.u_33":["atom_site_aniso_U_33","atom_site_anisotrop_U_33"]},ZA=xv.Schema.int,QA={volume_data_3d_info:VA.volume_data_3d_info,segmentation_data_table:{set_id:ZA,segment_id:ZA},segmentation_data_3d:{values:ZA}},JA={parse:function(e){return"string"==typeof e?Iw(e):tA(e)},parseText:Iw,parseBinary:tA,toDatabaseCollection:function(e,t,r){for(var n={},i=0,a=t.blocks;i<a.length;i++){var o=a[i];n[o.header]=rA(e,o,r)}return n},toDatabase:rA,schema:{mmCIF:function(e){return rA(yA,e)},CCD:function(e){return rA(PA,e)},BIRD:function(e){return rA(RA,e)},dic:function(e){return rA(FA,e)},cifCore:function(e){return rA(YA,e,KA)},densityServer:function(e){return rA(VA,e)},segmentation:function(e){return rA(QA,e)}}};function eC(e){var t=e.xExtent,r=e.yExtent,n=e.zExtent;return{xBlocks:Math.ceil(t/8),yBlocks:Math.ceil(r/8),zBlocks:Math.ceil(n/8)}}function tC(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a;return Pc(this,function(o){switch(o.label){case 0:return[4,e.readBuffer(0,512)];case 1:return t=o.sent().buffer,r=String.fromCharCode.apply(null,t),n=r.startsWith(":-)"),i=n||100===t.readInt16LE(36),a=n?function(e){return{xStart:parseInt(e.substr(10,5)),yStart:parseInt(e.substr(15,5)),zStart:parseInt(e.substr(20,5)),xExtent:parseInt(e.substr(32,5)),yExtent:parseInt(e.substr(38,5)),zExtent:parseInt(e.substr(42,5)),xRate:parseInt(e.substr(52,5)),yRate:parseInt(e.substr(58,5)),zRate:parseInt(e.substr(62,5)),xlen:parseFloat(e.substr(73,10)),ylen:parseFloat(e.substr(83,10)),zlen:parseFloat(e.substr(93,10)),alpha:parseFloat(e.substr(103,10)),beta:parseFloat(e.substr(113,10)),gamma:parseFloat(e.substr(123,10)),divisor:parseFloat(e.substr(138,12)),summand:parseInt(e.substr(155,8)),sigma:parseFloat(e.substr(170,12))}}(r):function(e,t){var r=t?function(t){return e.readInt16LE(2*t)}:function(t){return e.readInt16BE(2*t)},n=1/r(17);return{xStart:r(0),yStart:r(1),zStart:r(2),xExtent:r(3),yExtent:r(4),zExtent:r(5),xRate:r(6),yRate:r(7),zRate:r(8),xlen:r(9)*n,ylen:r(10)*n,zlen:r(11)*n,alpha:r(12)*n,beta:r(13)*n,gamma:r(14)*n,divisor:r(15)
139/100,summand:r(16),sigma:void 0}}(t,i),[2,{header:a,littleEndian:i}]}})})}function rC(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S;return Pc(this,function(w){for(n||BS.flipByteOrderInPlace2(t.buffer),i=e.divisor,a=e.summand,o=e.xExtent,s=e.yExtent,u=e.zExtent,c=eC(e),l=c.xBlocks,d=c.yBlocks,f=c.zBlocks,h=0,p=0;p<f;++p)for(m=0;m<d;++m)for(g=0;g<l;++g)for(v=0;v<8;++v)for(y=8*p+v,b=0;b<8;++b)for(_=8*m+b,x=0;x<8;++x){if(!((S=8*g+x)<o&&_<s&&y<u)){h+=8-x;break}r[(S*s+_)*u+y]=(t[h]-a)/i,++h}return[2]})})}function nC(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return[4,r.update({message:"Parsing DSN6/BRIX file..."})];case 1:return c.sent(),[4,tC(e)];case 2:return n=c.sent(),i=n.header,a=n.littleEndian,[4,e.readBuffer(512,t-512)];case 3:return o=c.sent().buffer,s=function(e){var t=e.xExtent,r=e.yExtent,n=e.zExtent,i=eC(e),a=8*i.xBlocks*i.yBlocks*8*i.zBlocks*8;return{count:a,byteCount:1*a,valueCount:t*r*n}}(i).valueCount,u=new Float32Array(s),[4,rC(i,o,u,a)];case 4:return c.sent(),[2,{header:i,values:u,name:e.name}]}})})}function iC(e,t){return function(e,t){var r=this;return vy.create("Parse DSN6/BRIX",function(n){return Tc(r,void 0,void 0,function(){var r,i,a;return Pc(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),i=(r=RS).success,[4,nC(e,t,n)];case 1:return[2,i.apply(r,[o.sent()])];case 2:return a=o.sent(),[2,RS.error(a)];case 3:return[2]}})})})}(NS.fromBuffer(BS.fromUint8Array(e),t),e.length)}var aC=new Set(Object.keys({char:1,uchar:1,short:2,ushort:2,int:4,uint:4,float:4,double:8,int8:1,uint8:1,int16:2,uint16:2,int32:4,uint32:4,float32:4,float64:8}));function oC(e){if(!aC.has(e))throw Error(`unknown ply type '${e}'`);return e}function sC(e){switch(e){case"char":case"uchar":case"int8":case"uint8":case"short":case"ushort":case"int16":case"uint16":case"int":case"uint":case"int32":case"uint32":return xv.Schema.int;case"float":case"double":case"float32":case"float64":return xv.Schema.float}}function uC(e,t){for(var r=e.elements,n=e.tokenizer,i=t.count,a=t.properties,o=a.length,s=[],u=[],c=[],l=new Map,d=0,f=o;d<f;++d){var h=$S.create(n.data,2*i);c.push(h)}for(d=0,f=i;d<f;++d)for(var p=0,m=o;p<m;++p)fw.skipWhitespace(n),fw.markStart(n),fw.eatValue(n),$S.addUnchecked(c[p],n.tokenStart,n.tokenEnd);for(d=0,f=o;d<f;++d){var g=a[d],v=g.type,y=g.name,b=ow(c[d],sC(v));s.push(y),u.push(v),l.set(y,b)}r.push({kind:"table",rowCount:i,propertyNames:s,propertyTypes:u,getProperty:function(e){return l.get(e)}})}function cC(e,t){for(var r=e.elements,n=e.tokenizer,i=t.count,a=t.property,o=$S.create(n.data,2*i*3),s=new Uint32Array(i+1),u=0,c=0,l=i;c<l;++c){for(fw.skipWhitespace(n),fw.markStart(n);10!==fw.skipWhitespace(n);)++u,fw.markStart(n),fw.eatValue(n),$S.addToken(o,n);s[c+1]=u}var d={entries:[],count:0},f=ow(o,sC(a.dataType));r.push({kind:"list",rowCount:i,name:a.name,type:a.dataType,value:function(e){for(var t=s[e]+1,r=f.value(t-1),n=t,i=t+r;n<i;++n)d.entries[n-t]=f.value(n);return d.count=r,d}})}function lC(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s;return Pc(this,function(u){return r=function(e,t){return{data:e,tokenizer:fw(e),runtimeCtx:t,comments:[],elementSpecs:[],elements:[]}}(e,t),t.update({message:"Parsing...",current:0,max:e.length}),function(e){var t=e.tokenizer,r=e.comments,n=e.elementSpecs;!function(e){var t=e.data.indexOf("end_header",e.position);if(-1===t)throw Error("no 'end_header' record found");e.tokenStart=e.position,e.tokenEnd=t,e.position=t,fw.eatLine(e)}(t);var i,a,o,s=fw.getTokenString(t).split(/\r?\n/);if("ply"!==s[0])throw Error("data not starting with 'ply'");if("format ascii 1.0"!==s[1])throw Error("format not 'ascii 1.0'");function u(){if(void 0!==i&&void 0!==a&&void 0!==o){for(var e=!1,t=0,r=o.length;t<r;++t)if("list"===o[t].kind){e=!0;break}e&&o.length,e?n.push({kind:"list",name:i,count:a,property:o[0]}):n.push({kind:"table",name:i,count:a,properties:o})}}for(var c=2,l=s.length;c<l;++c){var d=s[c],f=d.split(" ");if(d.startsWith("comment"))r.push(d.substr(8));else if(d.startsWith("element"))u(),o=[],i=f[1],a=parseInt(f[2]);else if(d.startsWith("property")){if(void 0===o)throw Error("properties outside of element");"list"===f[1]?o.push({kind:"list",countType:oC(f[2]),dataType:oC(f[3]),name:f[4]}):o.push({kind:"column",type:oC(f[1]),name:f[2]})}else d.startsWith("end_header")?u():console.warn("unknown header line")}}(r),function(e){for(var t=e.elementSpecs,r=0,n=t.length;r<n;++r){var i=t[r];"table"===i.kind?uC(e,i):"list"===i.kind&&cC(e,i)}}(r),n=r.elements,i=r.elementSpecs,a=r.comments,o=i.map(function(e){return e.name}),s=function(e,t,r){for(var n=new Map,i=0,a=t.length;i<a;++i)n.set(t[i],e[i]);return{comments:r,elementNames:t,getElement:function(e){return n.get(e)}}}(n,o,a),[2,RS.success(s)]})})}function dC(e){var t=this;return vy.create("Parse PLY",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,lC(e,r)];case 1:return[2,t.sent()]}})})})}var fC=fw.readLine,hC=fw.skipWhitespace,pC=fw.eatValue,mC=fw.eatLine,gC=fw.markStart,vC=/\s+/,yC=/(^\*|REMARK)*/;function bC(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g;return Pc(this,function(v){switch(v.label){case 0:return r=e.tokenizer,n=$S.create(r.data,2*t),i=$S.create(r.data,2*t),a=$S.create(r.data,2*t),o=$S.create(r.data,2*t),s=$S.create(r.data,2*t),u=$S.create(r.data,2*t),c=$S.create(r.data,2*t),l=$S.create(r.data,2*t),d=r.position,f=fC(r).trim(),r.position=d,h=
1397===f.split(vC).length,p=h?6:8,m=r.length,g=0,[4,Sy(e.runtimeCtx,1e5,void 0,function(e){for(var d=Math.min(t-g,e),f=0;f<d;++f){for(var m=0;m<p;++m)if(hC(r),gC(r),pC(r),h)switch(m){case 0:$S.addUnchecked(n,r.tokenStart,r.tokenEnd);break;case 1:$S.addUnchecked(a,r.tokenStart,r.tokenEnd);break;case 2:$S.addUnchecked(s,r.tokenStart,r.tokenEnd);break;case 3:$S.addUnchecked(u,r.tokenStart,r.tokenEnd);break;case 4:$S.addUnchecked(c,r.tokenStart,r.tokenEnd);break;case 5:$S.addUnchecked(l,r.tokenStart,r.tokenEnd)}else switch(m){case 0:$S.addUnchecked(n,r.tokenStart,r.tokenEnd);break;case 1:$S.addUnchecked(i,r.tokenStart,r.tokenEnd);break;case 2:$S.addUnchecked(a,r.tokenStart,r.tokenEnd);break;case 3:$S.addUnchecked(o,r.tokenStart,r.tokenEnd);break;case 4:$S.addUnchecked(s,r.tokenStart,r.tokenEnd);break;case 5:$S.addUnchecked(u,r.tokenStart,r.tokenEnd);break;case 6:$S.addUnchecked(c,r.tokenStart,r.tokenEnd);break;case 7:$S.addUnchecked(l,r.tokenStart,r.tokenEnd)}mC(r),gC(r)}return g+=d,d},function(e){return e.update({message:"Parsing...",current:r.position,max:m})})];case 1:return v.sent(),[2,{count:t,atomId:aw(n)(xv.Schema.int),segmentName:h?aw(a)(xv.Schema.str):aw(i)(xv.Schema.str),residueId:aw(a)(xv.Schema.int),residueName:h?aw(a)(xv.Schema.str):aw(o)(xv.Schema.str),atomName:aw(s)(xv.Schema.str),atomType:aw(u)(xv.Schema.str),charge:aw(c)(xv.Schema.float),mass:aw(l)(xv.Schema.float)}]}})})}function _C(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return r=e.tokenizer,n=$S.create(r.data,2*t),i=$S.create(r.data,2*t),a=r.length,o=0,[4,Sy(e.runtimeCtx,10,void 0,function(e){for(var a=Math.min(t-o,e),s=0;s<a;++s)for(var u=0;u<2;++u)switch(hC(r),gC(r),pC(r),u){case 0:$S.addUnchecked(n,r.tokenStart,r.tokenEnd);break;case 1:$S.addUnchecked(i,r.tokenStart,r.tokenEnd)}return o+=a,a},function(e){return e.update({message:"Parsing...",current:r.position,max:a})})];case 1:return s.sent(),[2,{count:t,atomIdA:aw(n)(xv.Schema.int),atomIdB:aw(i)(xv.Schema.int)}]}})})}function xC(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:r=fw(e),n=function(e,t){return{tokenizer:e,runtimeCtx:t}}(r,t),i=void 0,a=void 0,o=void 0,s=fC(n.tokenizer).trim(),h.label=1;case 1:return r.tokenEnd<r.length?(u=fC(n.tokenizer).trim()).includes("!NTITLE")?(c=parseInt(u.split(vC)[0]),i=function(e,t){for(var r=[],n=0;n<t;++n){var i=fC(e.tokenizer);r.push(i.replace(yC,"").trim())}return r}(n,c),[3,7]):[3,2]:[3,8];case 2:return u.includes("!NATOM")?(l=parseInt(u.split(vC)[0]),[4,bC(n,l)]):[3,4];case 3:return a=h.sent(),[3,7];case 4:return u.includes("!NBOND")?(d=parseInt(u.split(vC)[0]),[4,_C(n,d)]):[3,6];case 5:return o=h.sent(),[3,8];case 6:u.includes("!NTHETA")||u.includes("!NPHI")||u.includes("!NIMPHI")||u.includes("!NDON")||u.includes("!NACC")||u.includes("!NNB")||u.includes("!NGRP NST2")||u.includes("!MOLNT")||u.includes("!NUMLP NUMLPH")||u.includes("!NCRTERM"),h.label=7;case 7:return[3,1];case 8:return void 0===i&&(i=[]),void 0===a?[2,RS.error("no atoms data")]:void 0===o?[2,RS.error("no bonds data")]:(f={id:s,title:i,atoms:a,bonds:o},[2,RS.success(f)])}})})}function SC(e){var t=this;return vy.create("Parse PSF",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,xC(e,r)];case 1:return[2,t.sent()]}})})})}var wC=.529177210859;function AC(e,t,r){var n=r.dim[0]*r.dim[1]*r.dim[2]*r.dataSetIds.length,i=1e6,a=new Float64Array(n),o=0;return Sy(e,i,a,function(e,r){for(var a=Math.min(n,o+e),s=o;s<a;s++)fw.skipWhitespace(t),t.tokenStart=t.position,fw.eatValue(t),r[s]=Uv(t.data,t.tokenStart,t.tokenEnd);return o=a,a===n?0:i},function(e,t,r){return e.update({current:Math.min(r,n),max:n})})}function CC(e,t){var r=this;return vy.create("Parse Cube",function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return[4,n.update("Reading header...")];case 1:return u.sent(),r=fw(e),i=function(e){var t=fw.readLines(e,6),r=function(e,r){var n=+t[e].trim().split(/\s+/g)[r];return Number.isNaN(n)?0:n},n=function(e){var t=r(e+2,0),n=wC;return[Math.abs(t),Cg.create(r(e+2,1)*n,r(e+2,2)*n,r(e+2,3)*n),t]},i=t[0].trim(),a=t[1].trim(),o=n(0),s=o[0],u=o[1],c=o[2],l=n(1),d=l[0],f=l[1],h=n(2),p=h[0],m=h[1],g=n(3),v=g[0],y=g[1],b=function(e,t,r){for(var n=new Int32Array(t),i=new Float64Array(t),a=new Float32Array(t),o=new Float32Array(t),s=new Float32Array(t),u=0;u<t;u++){var c=fw.readLine(e).trim().split(/\s+/g);n[u]=+c[0],i[u]=+c[1],a[u]=+c[2]*r,o[u]=+c[3]*r,s[u]=+c[4]*r}return{count:t,number:xv.ofArray({array:n,schema:xv.Schema.int}),nuclearCharge:xv.ofArray({array:i,schema:xv.Schema.float}),x:xv.ofArray({array:a,schema:xv.Schema.float}),y:xv.ofArray({array:o,schema:xv.Schema.float}),z:xv.ofArray({array:s,schema:xv.Schema.float})}}(e,s,wC),_=[];
139if(c>=0){var x=r(2,4);0===x&&(x=1);for(var S=0;S<x;S++)_.push(S)}else for(var w=fw.readLine(e).trim().split(/\s+/g),A=(S=0,+w[0]);S<A;S++)_.push(+w[S+1]);return{header:{orbitals:c<0,comment1:i,comment2:a,atomCount:s,origin:u,dim:Cg.create(d,p,v),basisX:f,basisY:m,basisZ:y,dataSetIds:_},atoms:b}}(r),a=i.header,o=i.atoms,[4,AC(n,r,a)];case 2:return s=u.sent(),[2,RS.success({header:a,atoms:o,values:s,name:t})]}})})})}function TC(e){for(var t={h:Cg()},r=0,n=0,i=/\s+/g;;){var a=fw.readLine(e),o=void 0;if(a.startsWith("object 1"))o=a.split(i),t.dim=Cg.create(parseInt(o[5]),parseInt(o[6]),parseInt(o[7]));else if(a.startsWith("origin"))o=a.split(i),t.min=Cg.create(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));else if(a.startsWith("delta"))o=a.split(i),0===n?t.h[0]=parseFloat(o[1]):1===n?t.h[1]=parseFloat(o[2]):2===n&&(t.h[2]=parseFloat(o[3])),n+=1;else if(a.startsWith("object 3")){r+=a.length+1;break}r+=a.length+1}return{header:t,headerByteCount:r}}function PC(e,t,r){var n=r.dim[0]*r.dim[1]*r.dim[2],i=1e6,a=new Float64Array(n),o=0;return Sy(e,i,a,function(e,r){for(var a=Math.min(n,o+e),s=o;s<a;s++)fw.skipWhitespace(t),t.tokenStart=t.position,fw.eatValue(t),r[s]=Uv(t.data,t.tokenStart,t.tokenEnd);return o=a,a===n?0:i},function(e,t,r){return e.update({current:Math.min(r,n),max:n})})}function EC(e,t){return vy.create("Parse DX",function(r){return"string"==typeof e?function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a;return Pc(this,function(o){switch(o.label){case 0:return[4,e.update("Reading header...")];case 1:return o.sent(),n=fw(t),i=TC(n).header,[4,e.update("Reading values...")];case 2:return o.sent(),[4,PC(e,n,i)];case 3:return a=o.sent(),[2,RS.success({header:i,values:a,name:r})]}})})}(r,e,t):function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return[4,e.update("Reading header...")];case 1:return f.sent(),n=Qv(t,0,1e3),i=fw(n),a=TC(i),o=a.header,s=a.headerByteCount,[4,e.update("Reading values...")];case 2:for(f.sent(),u=o.dim[0]*o.dim[1]*o.dim[2],c=new DataView(t.buffer,t.byteOffset+s),l=new Float64Array(u),d=0;d<u;d++)l[d]=c.getFloat64(8*d,!0);return[2,RS.success({header:o,values:l,name:r})]}})})}(r,e,t)})}var MC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflower:6591981,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,laserlemon:16777044,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrod:16448210,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,maroon2:8323072,maroon3:11546720,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,purple2:8323199,purple3:10494192,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};!function(){var e=new Map;
139Object.keys(MC).forEach(function(t){e.set(MC[t],t)})}();var kC=Object.keys({NATOM:"",NTYPES:"",NBONH:"",MBONA:"",NTHETH:"",MTHETA:"",NPHIH:"",MPHIA:"",NHPARM:"",NPARM:"",NNB:"",NRES:"",NBONA:"",NTHETA:"",NPHIA:"",NUMBND:"",NUMANG:"",NPTRA:"",NATYP:"",NPHB:"",IFPERT:"",NBPER:"",NGPER:"",NDPER:"",MBPER:"",MGPER:"",MDPER:"",IFBOX:"",NMXRS:"",IFCAP:"",NUMEXTRA:"",NCOPY:""}),IC=fw.readLine,DC=fw.markLine,OC=fw.trim;function RC(e,t,r,n){for(var i=e.tokenizer,a=$S.create(i.data,2*t),o=0;i.tokenEnd<i.length&&"%"!==i.data[i.position];){i.tokenStart=i.position;for(var s=Math.min(o+r,t);o<s;++o){var u=i.position;OC(i,i.position,i.position+n),$S.addUnchecked(a,i.tokenStart,i.tokenEnd),i.position=u+n}DC(i)}return a}function BC(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:r=fw(e),n={tokenizer:r,runtimeCtx:t},i=Object.create(null),a=0,c.label=1;case 1:return r.tokenEnd<r.length?r.position-a>1e5&&t.shouldUpdate?(a=r.position,[4,t.update({current:r.position,max:r.length})]):[3,3]:[3,4];case 2:c.sent(),c.label=3;case 3:if((o=IC(n.tokenizer).trim()).startsWith("%VERSION"))i.version=o.substring(8).trim();else if(o.startsWith("%FLAG")){if(s=o.substring(5).trim(),!IC(n.tokenizer).trim().startsWith("%FORMAT"))throw Error("expected %FORMAT");if("TITLE"===s)i.title=function(e){for(var t=e.tokenizer,r=[];t.tokenEnd<t.length&&"%"!==t.data[t.position];){var n=IC(t).trim();n&&r.push(n)}return r}(n);else if("POINTERS"===s)i.pointers=function(e){var t=e.tokenizer,r=Object.create(null);kC.forEach(function(e){r[e]=0});for(var n=0;t.tokenEnd<t.length&&"%"!==t.data[t.position];)for(var i=IC(t),a=Math.min(n+10,32),o=0;n<a;++o,++n)r[kC[n]]=parseInt(i.substring(8*o,8*o+8).trim());return r}(n);else if("ATOM_NAME"===s)u=RC(n,i.pointers.NATOM,20,4),i.atomName=aw(u)(xv.Schema.str);else if("CHARGE"===s)u=RC(n,i.pointers.NATOM,5,16),i.charge=aw(u)(xv.Schema.float);else if("MASS"===s)u=RC(n,i.pointers.NATOM,5,16),i.mass=aw(u)(xv.Schema.float);else if("RESIDUE_LABEL"===s)u=RC(n,i.pointers.NRES,20,4),i.residueLabel=aw(u)(xv.Schema.str);else if("RESIDUE_POINTER"===s)u=RC(n,i.pointers.NRES,10,8),i.residuePointer=aw(u)(xv.Schema.int);else if("BONDS_INC_HYDROGEN"===s)u=RC(n,3*i.pointers.NBONH,10,8),i.bondsIncHydrogen=aw(u)(xv.Schema.int);else if("BONDS_WITHOUT_HYDROGEN"===s)u=RC(n,3*i.pointers.NBONA,10,8),i.bondsWithoutHydrogen=aw(u)(xv.Schema.int);else if("RADII"===s)u=RC(n,i.pointers.NATOM,5,16),i.radii=aw(u)(xv.Schema.float);else for(;r.tokenEnd<r.length&&"%"!==r.data[r.position];)DC(r)}return[3,1];case 4:return[2,RS.success(i)]}})})}function NC(e){var t=this;return vy.create("Parse PRMTOP",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,BC(e,r)];case 1:return[2,t.sent()]}})})})}var FC={nr:xv.Schema.Int(),type:xv.Schema.Str(),resnr:xv.Schema.Int(),residu:xv.Schema.Str(),atom:xv.Schema.Str(),cgnr:xv.Schema.Int(),charge:xv.Schema.Float(),mass:xv.Schema.Float()},LC={ai:xv.Schema.Int(),aj:xv.Schema.Int()},$C={compound:xv.Schema.Str(),molCount:xv.Schema.Int()},UC=fw.readLine,jC=fw.markLine,zC=fw.skipWhitespace,GC=fw.markStart,VC=fw.eatValue,HC=fw.eatLine,qC=/\[ (.+) \]/,WC=/\s+/;function XC(e,t){return Tc(this,void 0,void 0,function(){function r(){u&&s.atoms&&(a.compounds[u]=s,s={},u="")}var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:n=fw(e),i={tokenizer:n,runtimeCtx:t},a=Object.create(null),o=0,a.compounds={},s={},u="",f.label=1;case 1:return n.tokenEnd<n.length?n.position-o>1e5&&t.shouldUpdate?(o=n.position,[4,t.update({current:n.position,max:n.length})]):[3,3]:[3,4];case 2:f.sent(),f.label=3;case 3:if(!(c=UC(i.tokenizer).trim())||"*"===c[0]||";"===c[0])return[3,1];if(c.startsWith("#include"))throw Error("#include statements not allowed");if(c.startsWith("[")){if(null===(l=c.match(qC)))throw Error("expected field name");if("moleculetype"===(d=l[1]))r(),u=function(e){for(var t=e.tokenizer,r=void 0;t.tokenEnd<t.length;){zC(t);var n=t.data[t.position];if("["===n)break;if(";"!==n&&"*"!==n){if(void 0!==r)throw Error("more than one molName");r=UC(t).split(WC)[0]}else jC(t)}if(void 0===r)throw Error("missing molName");return r}(i);else if("atoms"===d)s.atoms=function(e){for(var t=e.tokenizer,r=$S.create(t.data,64),n=$S.create(t.data,64),i=$S.create(t.data,64),a=$S.create(t.data,64),o=$S.create(t.data,64),s=$S.create(t.data,64),u=$S.create(t.data,64),c=$S.create(t.data,64);t.tokenEnd<t.length;){zC(t);var l=t.data[t.position];if("["===l)break;if(";"!==l&&"*"!==l){for(var d=0;d<8;++d)switch(zC(t),GC(t),VC(t),d){case 0:$S.add(r,t.tokenStart,t.tokenEnd);break;case 1:$S.add(n,t.tokenStart,t.tokenEnd);break;case 2:$S.add(i,t.tokenStart,t.tokenEnd);break;case 3:$S.add(a,t.tokenStart,t.tokenEnd);break;case 4:$S.add(o,t.tokenStart,t.tokenEnd);break;case 5:$S.add(s,t.tokenStart,t.tokenEnd);break;case 6:$S.add(u,t.tokenStart,t.tokenEnd);break;case 7:$S.add(c,t.tokenStart,t.tokenEnd)}jC(t)}else jC(t)}return Sv.ofColumns(FC,{nr:aw(r)(xv.Schema.int),type:aw(n)(xv.Schema.str),resnr:aw(i)(xv.Schema.int),residu:
139aw(a)(xv.Schema.str),atom:aw(o)(xv.Schema.str),cgnr:aw(s)(xv.Schema.int),charge:aw(u)(xv.Schema.float),mass:aw(c)(xv.Schema.float)})}(i);else if("bonds"===d)s.bonds=function(e){for(var t=e.tokenizer,r=$S.create(t.data,64),n=$S.create(t.data,64);t.tokenEnd<t.length;){zC(t);var i=t.data[t.position];if("["===i)break;if(";"!==i&&"*"!==i){for(var a=0;a<2;++a)switch(zC(t),GC(t),VC(t),a){case 0:$S.add(r,t.tokenStart,t.tokenEnd);break;case 1:$S.add(n,t.tokenStart,t.tokenEnd)}jC(t)}else jC(t)}return Sv.ofColumns(LC,{ai:aw(r)(xv.Schema.int),aj:aw(n)(xv.Schema.int)})}(i);else if("system"===d)a.system=function(e){for(var t=e.tokenizer,r=void 0;t.tokenEnd<t.length;){zC(t);var n=t.data[t.position];if("["===n)break;if(";"!==n&&"*"!==n){if(void 0!==r)throw Error("more than one system");r=UC(t).trim()}else jC(t)}if(void 0===r)throw Error("missing system");return r}(i);else if("molecules"===d)r(),a.molecules=function(e){for(var t=e.tokenizer,r=$S.create(t.data,64),n=$S.create(t.data,64);t.tokenEnd<t.length&&(zC(t),!(t.position>=t.length));){var i=t.data[t.position];if("["===i)break;if(";"!==i&&"*"!==i){for(var a=0;a<2;++a)switch(zC(t),GC(t),VC(t),a){case 0:$S.add(r,t.tokenStart,t.tokenEnd);break;case 1:$S.add(n,t.tokenStart,t.tokenEnd)}HC(t),GC(t)}else jC(t)}return Sv.ofColumns($C,{compound:aw(r)(xv.Schema.str),molCount:aw(n)(xv.Schema.int)})}(i);else for(;n.tokenEnd<n.length&&"["!==n.data[n.position];)jC(n)}return[3,1];case 4:return[2,RS.success(a)]}})})}function YC(e){var t=this;return vy.create("Parse TOP",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,XC(e,r)];case 1:return[2,t.sent()]}})})})}var KC,ZC=OS.BuiltIn({name:"download",display:{name:"Download",description:"Download string or binary data from the specified URL"},from:[DS.Root],to:[DS.Data.String,DS.Data.Binary],params:{url:Ib.Url("https://www.ebi.ac.uk/pdbe/static/entry/1cbs_updated.cif",{description:"Resource URL. Must be the same domain or support CORS."}),label:Ib.Optional(Ib.Text("")),isBinary:Ib.Optional(Ib.Boolean(!1,{description:"If true, download data as binary (string otherwise)"}))}})({apply:function(e,t){var r=this,n=e.params,i=e.cache;return vy.create("Download",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=Cb.getUrlAsset(t.managers.asset,n.url),[4,t.managers.asset.resolve(r,n.isBinary?"binary":"string").runInContext(e)];case 1:return a=o.sent(),i.asset=a,[2,n.isBinary?new DS.Data.Binary(a.data,{label:n.label?n.label:r.url}):new DS.Data.String(a.data,{label:n.label?n.label:r.url})]}})})})},dispose:function(e){var t;null==(t=e.cache?.asset)||t.dispose()},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.url!==r.url||t.isBinary!==r.isBinary?Ob.UpdateResult.Recreate:t.label===r.label?Ob.UpdateResult.Unchanged:(n.label=r.label||("string"==typeof r.url?r.url:r.url.url),Ob.UpdateResult.Updated)}}),QC=OS.BuiltIn({name:"download-blob",display:{name:"Download Blob",description:"Download multiple string or binary data from the specified URLs."},from:DS.Root,to:DS.Data.Blob,params:{sources:Ib.ObjectList({id:Ib.Text("",{label:"Unique ID"}),url:Ib.Url("https://www.ebi.ac.uk/pdbe/static/entry/1cbs_updated.cif",{description:"Resource URL. Must be the same domain or support CORS."}),isBinary:Ib.Optional(Ib.Boolean(!1,{description:"If true, download data as binary (string otherwise)"})),canFail:Ib.Optional(Ib.Boolean(!1,{description:"Indicate whether the download can fail and not be included in the blob as a result."}))},function(e){return`${e.id}: ${e.url}`}),maxConcurrency:Ib.Optional(Ib.Numeric(4,{min:1,max:12,step:1},{description:"The maximum number of concurrent downloads."}))}})({apply:function(e,t){var r=this,n=e.params,i=e.cache;return vy.create("Download Blob",function(e){return Tc(r,void 0,void 0,function(){var r,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return r=[],[4,Eb(e,t.managers.asset,n.sources,n.maxConcurrency||4)];case 1:for(a=l.sent(),o=[],s=0;s<a.length;s++)u=a[s],c=n.sources[s],"error"===u.kind?t.log.warn(`Download ${u.id} (${c.url}) failed: ${u.error}`):(o.push(u.result),r.push(c.isBinary?{id:u.id,kind:"binary",data:u.result.data}:{id:u.id,kind:"string",data:u.result.data}));return i.assets=o,[2,new DS.Data.Blob(r,{label:"Data Blob",description:`${r.length} ${1===r.length?"entry":"entries"}`})]}})})})}
139,dispose:function(e,t){var r=e.cache?.assets;if(r)for(var n=0,i=r;n<i.length;n++)i[n].dispose()}}),JC=OS.BuiltIn({name:"raw-data",display:{name:"Raw Data",description:"Raw data supplied by value."},from:[DS.Root],to:[DS.Data.String,DS.Data.Binary],params:{data:Ib.Value("",{isHidden:!0}),label:Ib.Optional(Ib.Text(""))}})({apply:function(e){var t=this,r=e.params;return vy.create("Raw Data",function(){return Tc(t,void 0,void 0,function(){return Pc(this,function(e){return"string"==typeof r.data?[2,new DS.Data.String(r.data,{label:r.label?r.label:"String"})]:Array.isArray(r.data)||r.data instanceof ArrayBuffer?[2,new DS.Data.Binary(new Uint8Array(r.data),{label:r.label?r.label:"Binary"})]:r.data instanceof Uint8Array?[2,new DS.Data.Binary(r.data,{label:r.label?r.label:"Binary"})]:(Lg(r.data),[2])})})})},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.data===r.data?t.label===r.label?Ob.UpdateResult.Unchanged:(n.label=r.label||n.label,Ob.UpdateResult.Updated):Ob.UpdateResult.Recreate},customSerialization:{toJSON:function(e){if("string"==typeof e.data||Array.isArray(e.data))return e;if(e.data instanceof ArrayBuffer){for(var t=new Uint8Array(e.data),r=Array(t.length),n=0,i=t.length;n<i;n++)r[n]=t[n];return{data:r,label:e.label}}if(e.data instanceof Uint8Array){for(r=Array(e.data.length),n=0,i=e.data.length;n<i;n++)r[n]=e.data[n];return{data:r,label:e.label}}},fromJSON:function(e){return e}}}),eT=OS.BuiltIn({name:"read-file",display:{name:"Read File",description:"Read string or binary data from the specified file"},from:DS.Root,to:[DS.Data.String,DS.Data.Binary],params:{file:Ib.File(),label:Ib.Optional(Ib.Text("")),isBinary:Ib.Optional(Ib.Boolean(!1,{description:"If true, open file as as binary (string otherwise)"}))}})({apply:function(e,t){var r=this,n=e.params,i=e.cache;return vy.create("Open File",function(e){return Tc(r,void 0,void 0,function(){var r;return Pc(this,function(a){switch(a.label){case 0:return null===n.file?(t.log.error("No file(s) selected"),[2,of.Null]):[4,t.managers.asset.resolve(n.file,n.isBinary?"binary":"string").runInContext(e)];case 1:return r=a.sent(),i.asset=r,[2,n.isBinary?new DS.Data.Binary(r.data,{label:n.label?n.label:n.file.name}):new DS.Data.String(r.data,{label:n.label?n.label:n.file.name})]}})})})},dispose:function(e){var t;null==(t=e.cache?.asset)||t.dispose()},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.label===r.label?Ob.UpdateResult.Unchanged:(n.label=r.label||t.file?.name||"",Ob.UpdateResult.Updated)},isSerializable:function(){return{isSerializable:!1,reason:"Cannot serialize user loaded files."}}}),tT=OS.BuiltIn({name:"parse-blob",display:{name:"Parse Blob",description:"Parse multiple data enties"},from:DS.Data.Blob,to:DS.Format.Blob,params:{formats:Ib.ObjectList({id:Ib.Text("",{label:"Unique ID"}),format:Ib.Select("cif",[["cif","cif"]])},function(e){return`${e.id}: ${e.format}`})}})({apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Parse Blob",function(e){return Tc(r,void 0,void 0,function(){var t,r,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:for(t=new Map,r=0,a=i.formats;r<a.length;r++)o=a[r],t.set(o.id,o.format);s=[],u=0,c=n.data,f.label=1;case 1:return u<c.length?(l=c[u],t.has(l.id)?[4,("string"===l.kind?JA.parse(l.data):JA.parseBinary(l.data)).runInContext(e)]:[3,3]):[3,4];case 2:if((d=f.sent()).isError)throw Error(`${l.id}: ${d.message}`);s.push({id:l.id,kind:"cif",data:d.result}),f.label=3;case 3:return u++,[3,1];case 4:return[2,new DS.Format.Blob(s,{label:"Format Blob",description:`${s.length} ${1===s.length?"entry":"entries"}`})]}})})})}}),rT=OS.BuiltIn({name:"parse-cif",display:{name:"Parse CIF",description:"Parse CIF from String or Binary data"},from:[DS.Data.String,DS.Data.Binary],to:DS.Format.Cif})({apply:function(e){var t=this,r=e.a;return vy.create("Parse CIF",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,("string"==typeof r.data?JA.parse(r.data):JA.parseBinary(r.data)).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return 0===t.result.blocks.length?[2,of.Null]:[2,new DS.Format.Cif(t.result)]}})})})}}),nT=OS.BuiltIn({name:"parse-cube",display:{name:"Parse Cube",description:"Parse Cube from String data"},from:DS.Data.String,to:DS.Format.Cube})({apply:function(e){var t=this,r=e.a;return vy.create("Parse Cube",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,CC(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Cube(t.result)]}})})})}}),iT=OS.BuiltIn({name:"parse-psf",display:{name:"Parse PSF",description:"Parse PSF from String data"},from:[DS.Data.String],to:DS.Format.Psf})({apply:function(e){var t=this,r=e.a;return vy.create("Parse PSF",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,SC(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Psf(t.result)]}})})})}}),aT=OS.BuiltIn({name:"parse-prmtop",display:{name:"Parse PRMTOP",description:"Parse PRMTOP from String data"},from:[DS.Data.String],to:DS.Format.Prmtop})({apply:function(e){var t=this,r=e.a;return vy.create("Parse PRMTOP",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,NC(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Prmtop(t.result)]}})})})}}),oT=OS.BuiltIn({name:"parse-top",display:{name:"Parse TOP",description:"Parse TOP from String data"},from:[DS.Data.String],to:DS.Format.Top})({apply:function(e){var t=this,r=e.a;return vy.create("Parse TOP",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,YC(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Top(t.result)]}})})})}}),sT=OS.BuiltIn({name:"parse-ply",display:{name:"Parse PLY",description:"Parse PLY from String data"},from:[DS.Data.String],to:DS.Format.Ply})({apply:function(e){var t=this,r=e.a;return vy.create("Parse PLY",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,dC(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Ply(t.result,{label:t.result.comments[0]||"PLY Data"})]}})})})}}),uT=OS.BuiltIn({name:"parse-ccp4",display:{name:"Parse CCP4/MRC/MAP",description:"Parse CCP4/MRC/MAP from Binary data"},from:[DS.Data.Binary],to:DS.Format.Ccp4})({apply:function(e){var t=this,r=e.a;return vy.create("Parse CCP4/MRC/MAP",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,iw(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Ccp4(t.result)]}})})})}}),cT=OS.BuiltIn({name:"parse-dsn6",display:{name:"Parse DSN6/BRIX",description:"Parse CCP4/BRIX from Binary data"},from:[DS.Data.Binary],to:DS.Format.Dsn6})({apply:function(e){var t=this,r=e.a;return vy.create("Parse DSN6/BRIX",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,iC(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Dsn6(t.result)]}})})})}}),lT=OS.BuiltIn({name:"parse-dx",display:{name:"Parse DX",description:"Parse DX from Binary/String data"},from:[DS.Data.Binary,DS.Data.String],to:DS.Format.Dx})({apply:function(e){var t=this,r=e.a;return vy.create("Parse DX",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,EC(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw Error(t.message);return[2,new DS.Format.Dx(t.result)]}})})})}}
139),dT=OS.BuiltIn({name:"import-string",display:{name:"Import String",description:"Import given data as a string"},from:DS.Root,to:DS.Data.String,params:{data:Ib.Value(""),label:Ib.Optional(Ib.Text(""))}})({apply:function(e){var t=e.params,r=t.data,n=t.label;return new DS.Data.String(r,{label:n||""})},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.data===r.data?t.label===r.label?Ob.UpdateResult.Unchanged:(n.label=r.label||"",Ob.UpdateResult.Updated):Ob.UpdateResult.Recreate},isSerializable:function(){return{isSerializable:!1,reason:"Cannot serialize user imported strings."}}}),fT=OS.BuiltIn({name:"import-json",display:{name:"Import JSON",description:"Import given data as a JSON"},from:DS.Root,to:DS.Format.Json,params:{data:Ib.Value({}),label:Ib.Optional(Ib.Text(""))}})({apply:function(e){var t=e.params,r=t.data,n=t.label;return new DS.Format.Json(r,{label:n||""})},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.data===r.data?t.label===r.label?Ob.UpdateResult.Unchanged:(n.label=r.label||"",Ob.UpdateResult.Updated):Ob.UpdateResult.Recreate},isSerializable:function(){return{isSerializable:!1,reason:"Cannot serialize user imported JSON."}}}),hT=OS.BuiltIn({name:"parse-json",display:{name:"Parse JSON",description:"Parse JSON from String data"},from:[DS.Data.String],to:DS.Format.Json})({apply:function(e){var t=this,r=e.a;return vy.create("Parse JSON",function(e){return Tc(t,void 0,void 0,function(){var e;return Pc(this,function(t){switch(t.label){case 0:return[4,new Response(r.data).json()];case 1:return e=t.sent(),[2,new DS.Format.Json(e)]}})})})}}),pT=OS.BuiltIn({name:"lazy-volume",display:{name:"Lazy Volume",description:"A placeholder for lazy loaded volume representation"},from:DS.Root,to:DS.Volume.Lazy,params:{url:Ib.Url(""),isBinary:Ib.Boolean(!1),format:Ib.Text("ccp4"),entryId:Ib.Value("",{isHidden:!0}),isovalues:Ib.ObjectList({type:Ib.Text("relative"),value:Ib.Numeric(0),color:Ib.Color(MC.black),alpha:Ib.Numeric(1,{min:0,max:1,step:.01}),volumeIndex:Ib.Numeric(0)},function(e){return`${e.type} ${e.value}`})}})({apply:function(e){var t=this;e.a;var r=e.params;return vy.create("Lazy Volume",function(e){return Tc(t,void 0,void 0,function(){var e;return Pc(this,function(t){return e=Array.isArray(r.entryId)?r.entryId.join(", "):r.entryId,[2,new DS.Volume.Lazy(r,{label:`${e||r.url}`,description:"Lazy Volume"})]})})})}}),mT=Object.freeze({__proto__:null,Download:ZC,DownloadBlob:QC,ImportJson:fT,ImportString:dT,LazyVolume:pT,ParseBlob:tT,ParseCcp4:uT,ParseCif:rT,ParseCube:nT,ParseDsn6:cT,ParseDx:lT,ParseJson:hT,ParsePly:sT,ParsePrmtop:aT,ParsePsf:iT,ParseTop:oT,RawData:JC,ReadFile:eT}),gT=OS.BuiltIn({name:"create-group",display:{name:"Group"},from:[],to:DS.Group,params:{label:Ib.Text("Group"),description:Ib.Optional(Ib.Text(""))}})({apply:function(e){var t=e.params;return new DS.Group({},t)},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return df(t,r)?Ob.UpdateResult.Unchanged:(n.label=r.label,n.description=r.description,Ob.UpdateResult.Updated)}}),vT=Object.freeze({__proto__:null,CreateGroup:gT});function yT(e){var t=this;return vy.create("Parse DCD",function(r){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(r){try{return t=function(e){var t=new DataView(e.buffer),r=Object.create(null),n=[],i=0,a=new Int32Array(e.buffer,0,23),o=a[0]!==t.getInt32(0);if(84!==a[0])for(var s=e.byteLength,u=0;u<s;u+=4)t.setFloat32(u,t.getFloat32(u),!0);if(84!==a[0])throw Error("dcd bad format, header block start");if("CORD"!==String.fromCharCode(t.getUint8(4),t.getUint8(5),t.getUint8(6),t.getUint8(7)))throw Error("dcd bad format, format string");var c=!1,l=!1,d=!1;if(0!==a[22]&&(c=!0,0!==a[12]&&(l=!0),1===a[13]&&(d=!0)),r.NSET=a[2],r.ISTART=a[3],r.NSAVC=a[4],r.NAMNF=a[10],r.DELTA=c?t.getFloat32(44,o):t.getFloat64(44,o),84!==a[22])throw Error("dcd bad format, header block end");i=i+84+8;var f=t.getInt32(i,o),h=i+1;if((f-4)%80!=0)throw Error("dcd bad format, title block start");if(r.TITLE=function(e){if(e.length>Bw){for(var t=[],r=0;r<e.length;r+=Bw)t.push(String.fromCharCode.apply(null,e.subarray(r,r+Bw)));return t.join("")}return String.fromCharCode.apply(null,e)}(e.subarray(h,f)),t.getInt32(h+f+4-1,o)!==f)throw Error("dcd bad format, title block end");if(i=i+f+8,4!==t.getInt32(i,o))throw Error("dcd bad format, natom block start");if(r.NATOM=t.getInt32(i+4,o),4!==t.getInt32(i+8,o))throw Error("dcd bad format, natom block end");if(i=i+4+8,r.NAMNF>0)throw Error("dcd format with fixed atoms unsupported, aborting");var p=r.NATOM,m=4*p;for(u=0,s=r.NSET;u<s;++u){var g=Object.create(null);g.elementCount=p,l&&(i+=4,g.cell=[t.getFloat64(i,o),t.getFloat64(i+1,o),t.getFloat64(i+16,o),t.getFloat64(i+24,o),t.getFloat64(i+32,o),t.getFloat64(i+40,o)],i+=48,i+=4);for(var v=0;v<3;++v){if(t.getInt32(i,o)!==m)throw Error(`dcd bad format, coord block start: ${u}, ${v}`);i+=4;var y=new Float32Array(e.buffer,i,p);if(0===v?g.x=y:1===v?g.y=y:g.z=y,i+=m,t.getInt32(i,o)!==m)throw Error(`dcd bad format, coord block end: ${u}, ${v}`);i+=4}d&&(i+=4+t.getInt32(i,o)+4),n.push(g)}return{header:r,frames:n}}(e),[2,RS.success(t)]}catch(e){return[2,RS.error(e)]}})})})}function bT(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return t=e.tokenizer,r=e.numberOfAtoms,[4,fw.readLinesAsync(t,r,e.runtimeCtx,1e5)];
139case 1:return n=f.sent(),i=t.data.substring(n.indices[0],n.indices[1]).substring(20),a=i.match(/\.\d+/g),o=6===a.length,e.header.hasVelocities=o,e.header.precision.position=a[0].length-1,e.header.precision.velocity=o?a[3].length-1:0,s=e.header.precision.position+5,u=20+3*s,c=e.header.precision.velocity+4,l=function(e){return function(t,r,n){return function(e,t,r,n){var i=e.data,a=e.indices,o=e.count,s=n.valueType,u="str"===s?function(e){var n=a[2*e]+t,o=a[2*e+1];if(n>=o)return"";var s=n+r;return s>o&&(s=o),function(e,t,r){for(var n=t,i=r-1,a=e.charCodeAt(n);(9===a||32===a)&&n<=i;)a=e.charCodeAt(++n);for(a=e.charCodeAt(i);(9===a||32===a)&&i>=n;)a=e.charCodeAt(--i);return e.substring(n,i+1)}(i,n,s)}:"int"===s?function(e){var n=a[2*e]+t;return n>a[2*e+1]?0:Fv(i,n,n+r)}:function(e){var n=a[2*e]+t;return n>a[2*e+1]?0:function(e,t,r){for(;t<r&&32===e.charCodeAt(t);)t++;return Uv(e,t,r)}(i,n,n+r)};return{schema:n,__array:void 0,isDefined:!0,rowCount:o,value:u,valueKind:function(e){return 0},toArray:function(e){return Rv(o,u,e)},areValuesEqual:function(e,t){return u(e)===u(t)}}}(e,t,r,n)}}(n),d=xv.Undefined(e.numberOfAtoms,xv.Schema.float),[2,{count:e.numberOfAtoms,residueNumber:l(0,5,xv.Schema.int),residueName:l(5,5,xv.Schema.str),atomName:l(10,5,xv.Schema.str),atomNumber:l(15,5,xv.Schema.int),x:l(20,s,xv.Schema.float),y:l(20+s,s,xv.Schema.float),z:l(20+2*s,s,xv.Schema.float),vx:o?l(u,c,xv.Schema.float):d,vy:o?l(u+c,c,xv.Schema.float):d,vz:o?l(u+2*c,c,xv.Schema.float):d}]}})})}function _T(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return r=fw(e),[4,t.update({message:"Parsing...",current:0,max:e.length})];case 1:s.sent(),n=[],s.label=2;case 2:return r.position<e.length?(i=function(e,t){return{tokenizer:e,header:{title:"",timeInPs:0,hasVelocities:!1,precision:{position:0,velocity:0},box:[0,0,0]},numberOfAtoms:0,runtimeCtx:t}}(r,t),function(e){var t=e.tokenizer,r=e.header,n=fw.readLine(t);0===n.trim().length&&(n=fw.readLine(t));var i=n.lastIndexOf("t=");i>=0?(r.timeInPs=parseFloat(n.substring(i+2)),r.title=n.substring(0,i).trim(),r.title&&","===r.title[r.title.length-1]&&(r.title=r.title.substring(0,r.title.length-1))):r.title=n}(i),function(e){var t=e.tokenizer;fw.markLine(t);var r=fw.getTokenString(t);e.numberOfAtoms=parseInt(r)}(i),[4,bT(i)]):[3,4];case 3:return a=s.sent(),function(e){var t=e.tokenizer,r=fw.readLine(t).trim().split(/\s+/g);e.header.box=[+r[0],+r[1],+r[2]]}(i),n.push({header:i.header,atoms:a}),[3,2];case 4:return o={structures:n},[2,RS.success(o)]}})})}function xT(e){var t=this;return vy.create("Parse GRO",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,_T(e,r)];case 1:return[2,t.sent()]}})})})}function ST(e,t,r){var n=this;return void 0===r&&(r=!1),vy.create("Parse PDB",function(i){return Tc(n,void 0,void 0,function(){var n,a,o;return Pc(this,function(s){switch(s.label){case 0:return a=(n=RS).success,o={},[4,fw.readAllLinesAsync(e,i)];case 1:return[2,a.apply(n,[(o.lines=s.sent(),o.id=t,o.isPdbqt=r,o)])]}})})})}function wT(e){return{kind:"table-legend",table:e}}!function(e){e.Zero=0;var t,r,n=(t=new ArrayBuffer(8),r=new ArrayBuffer(8),{_int32:new Int32Array(t),_float64:new Float64Array(t),_int32_1:new Int32Array(r),_float64_1:new Float64Array(r)}),i=n._int32,a=n._float64,o=n._int32_1,s=n._float64_1;e.is=function(e){return"number"==typeof e},e.create=function(e,t){return i[0]=e,i[1]=t,a[0]},e.diff=function(e){return a[0]=e,i[1]-i[0]},e.fst=function(e){return a[0]=e,i[0]},e.snd=function(e){return a[0]=e,i[1]},e.areEqual=function(e,t){return a[0]=e,s[0]=t,i[0]===o[0]&&i[1]===o[1]},e.compare=function(e,t){a[0]=e,s[0]=t;var r=i[0]-o[0];return 0===r?i[1]-o[1]:r},e.compareInArray=function(e,t,r){a[0]=e[t],s[0]=e[r];var n=i[0]-o[0];return 0===n?i[1]-o[1]:n},e.hashCode=function(e){return a[0]=e,Tv(i[0],i[1])},e.toString=function(e){return a[0]=e,`(${i[0]}, ${i[1]})`}}(KC||={});var AT=KC.Zero;function CT(e,t){return t<e?KC.create(e,e):KC.create(e,t+1)}function TT(e,t){return t<=e?KC.create(e,e):KC.create(e,t)}function PT(e){return e<0?KC.create(0,0):KC.create(0,e)}var ET=KC.is,MT=KC.fst,kT=KC.snd,IT=KC.fst;function DT(e){return KC.snd(e)-1}var OT=KC.diff,RT=KC.hashCode,BT=KC.toString;function NT(e,t){return KC.fst(e)<=t&&t<KC.snd(e)}function FT(e,t){var r=MT(e);return t>=r&&t<kT(e)?t-r:-1}function LT(e,t){return KC.fst(e)+t}var $T,UT=KC.areEqual;function jT(e,t){var r=OT(e),n=OT(t);return 0===r&&0===n||r>0&&n>0&&DT(e)>=IT(t)&&IT(e)<=DT(t)}
139function zT(e,t){return OT(e)?!OT(t)||MT(e)<=MT(t)&&kT(e)>=kT(t):0===OT(t)}function GT(e,t){var r=MT(e);if(t<=r)return 0;var n=kT(e);return t>=n?n-r:t-r}function VT(e,t,r){var n=MT(r),i=MT(e);if(t<=n+i)return n;var a=kT(r);return t>=a+i?a:t-i}function HT(e,t,r){return TT(GT(e,t),GT(e,r+1))}function qT(e,t){return jT(e,t)?TT(Math.max(MT(e),MT(t)),Math.min(kT(e),kT(t))):AT}function WT(e,t){return OT(HT(e,IT(t),DT(t)))}!function(e){e.Empty=AT,e.ofSingleton=function(e){return CT(e,e)},e.ofRange=CT,e.ofBounds=TT,e.ofLength=PT,e.is=ET,e.has=NT,e.indexOf=FT,e.getAt=LT,e.start=MT,e.end=kT,e.min=IT,e.max=DT,e.size=OT,e.hashCode=RT,e.toString=BT,e.areEqual=UT,e.areIntersecting=jT,e.isSubInterval=zT,e.findPredecessorIndex=GT,e.findPredecessorIndexInInterval=VT,e.findRange=HT,e.intersectionSize=WT,e.intersect=qT}($T||={});var XT=[];function YT(e){return[e]}function KT(e){return e}function ZT(e){return vv(e),e}function QT(e,t){if(t<e)return[];for(var r=new Int32Array(t-e+1),n=e;n<=t;n++)r[n-e]=n;return r}function JT(e){return e&&(Array.isArray(e)||!!e.buffer)}function eP(e){return e[e.length-1]-e[0]+1===e.length}function tP(e){return e[0]}function rP(e){return e[e.length-1]+1}function nP(e){return e[0]}function iP(e){return e[e.length-1]}function aP(e){return e.length}function oP(e){var t=e.length;return t?t>2?function(e,t,r,n){var i=23;return i=31*(i=31*(i=31*(i=31*i+e|0)+t|0)+r|0)+n|0,(i=(3735928559^(i^=i>>4))+(i<<5))^i>>11}(t,e[0],e[t-1],e[t>>1]):function(e,t,r){var n=23;return n=31*(n=31*(n=31*n+e|0)+t|0)+r|0,(n=(3735928559^(n^=n>>4))+(n<<5))^n>>11}(t,e[0],e[t-1]):0}function sP(e){var t=e.length;return t>5?`[${e[0]}, ${e[1]}, ..., ${e[t-1]}], length ${t}`:`[${e.join(", ")}]`}function uP(e,t){var r=e.length;return 0===r?-1:e[0]<=t&&t<=e[r-1]?gP(e,t,0,r):-1}function cP(e,t,r){return lP(e,t,$T.start(r),$T.end(r))}function lP(e,t,r,n){return 0===e.length||n<=r?-1:e[r]<=t&&t<=e[n-1]?gP(e,t,r,n):-1}function dP(e,t){return uP(e,t)>=0}function fP(e,t){if(e===t)return!0;var r=e.length;if(r!==t.length||e[0]!==t[0]||e[r-1]!==t[r-1])return!1;if(eP(e))return!0;r--;for(var n=1;n<r;n++)if(e[n]!==t[n])return!1;return!0}function hP(e,t){var r=e.length;return t<=e[0]?0:t>e[r-1]?r:vP(e,t,0,r)}function pP(e,t,r){var n=$T.start(r),i=$T.end(r),a=e[n];return t<=a?n:i>n&&t>e[i-1]?i:t-a<=11?function(e,t,r,n){for(var i=r;i<n;i++)if(t<=e[i])return i;return n}(e,t,n+1,i):vP(e,t,n,i)}function mP(e,t,r){return $T.ofBounds(hP(e,t),hP(e,r+1))}function gP(e,t,r,n){for(var i=r,a=n-1;i<=a;){if(i+11>a){for(var o=i;o<=a;o++)if(t===e[o])return o;return-1}var s=i+a>>1,u=e[s];if(t<u)a=s-1;else{if(!(t>u))return s;i=s+1}}return-1}function vP(e,t,r,n){for(var i=r,a=n-1;i<a;){if(i+11>a){for(var o=i;o<=a;o++)if(t<=e[o])return o;return a+1}var s=i+a>>1,u=e[s];if(t<u)a=s-1;else{if(!(t>u))return s;i=s+1}}return i>a?a+1:e[i]>=t?i:i+1}function yP(e,t){if(e===t)return!0;for(var r=MP(e,t),n=r.startI,i=r.startJ,a=r.endI,o=r.endJ;n<a&&i<o;){var s=e[n],u=t[i];if(s<u)n++;else{if(!(s>u))return!0;i++}}return!1}function bP(e,t){if(e===t)return!0;var r=t.length,n=MP(e,t),i=n.startI,a=n.startJ,o=n.endI,s=n.endJ;if(s-a<r||o-i<r)return!1;for(var u=0;i<o&&a<s;){var c=e[i],l=t[a];c<l?i++:c>l?a++:(i++,a++,u++)}return u===r}function _P(e,t){if(e===t)return e;var r=e.length,n=t.length;if(0===r)return t;if(0===n)return e;if(e[0]>t[0])return _P(t,e);var i=MP(e,t),a=i.startI,o=i.startJ,s=i.endI,u=i.endJ,c=SP(e,t,a,o,s,u);if(c===r&&c===n||c===n)return e;if(c===r)return t;var l=new Int32Array(r+n-c),d=0,f=0,h=0;for(d=0;d<a;d++)l[h++]=e[d];for(;f<u&&e[a]>t[f];)l[h++]=t[f++];for(;d<s&&f<u;){var p=e[d],m=t[f];p<m?(l[h++]=p,d++):p>m?(l[h++]=m,f++):(l[h++]=p,d++,f++)}for(;d<s;d++)l[h++]=e[d];for(;f<u;f++)l[h++]=t[f];for(;d<r;d++)l[h++]=e[d];for(;f<n;f++)l[h++]=t[f];return l}function xP(e,t){if(e===t)return aP(e);var r=MP(e,t);return SP(e,t,r.startI,r.startJ,r.endI,r.endJ)}function SP(e,t,r,n,i,a){for(var o=r,s=n,u=0;o<i&&s<a;){var c=e[o],l=t[s];c<l?o++:c>l?s++:(o++,s++,u++)}return u}function wP(e,t){if(e===t)return e;var r=MP(e,t),n=r.startI,i=r.startJ,a=r.endI,o=r.endJ,s=SP(e,t,n,i,a,o),u=e.length,c=t.length;if(!s)return XT;if(s===u&&s===c||s===c)return t;if(s===u)return e;for(var l=new Int32Array(s),d=0,f=n,h=i;f<a&&h<o;){var p=e[f],m=t[h];p<m?f++:(p>m||(l[d++]=p,f++),h++)}return l}function AP(e,t){if(e===t)return XT;for(var r=e.length,n=MP(e,t),i=n.startI,a=n.startJ,o=n.endI,s=n.endJ,u=i,
139c=a,l=0;u<o&&c<s;)(p=e[u])<(m=t[c])?u++:p>m?c++:(u++,c++,l++);if(!l)return e;if(l>=r)return XT;for(var d=new Int32Array(r-l),f=0,h=0;h<i;h++)d[f++]=e[h];for(u=i,c=a;u<o&&c<s;){var p,m;(p=e[u])<(m=t[c])?(d[f++]=p,u++):(p>m||u++,c++)}for(;u<r;u++)d[f++]=e[u];return d}function CP(e){if(e.length<2)return e;for(var t=1,r=0,n=e.length-1;r<n;r++)e[r]!==e[r+1]&&t++;if(t===e.length)return e;var i=new Int32Array(t),a=0;for(r=0,n=e.length-1;r<n;r++)e[r]!==e[r+1]&&(i[a++]=e[r]);return i[a]=e[e.length-1],i}function TP(e,t){if(fP(e,t))return qv(0,e.length-1);for(var r=MP(e,t),n=r.startI,i=r.startJ,a=r.endI,o=r.endJ,s=n,u=i,c=0;s<a&&u<o;)(h=e[s])<(p=t[u])?s++:h>p?u++:(s++,u++,c++);var l=e.length;if(!c)return XT;if(c===l)return qv(0,e.length-1);var d=new Int32Array(c),f=0;for(s=n,u=i;s<a&&u<o;){var h,p;(h=e[s])<(p=t[u])?s++:(h>p||(d[f++]=s,s++),u++)}return d}var PP,EP={startI:0,startJ:0,endI:0,endJ:0};function MP(e,t){var r=e.length,n=t.length,i=r/n;return r>=128||n>=128||i<=.34||i>=2.99?(EP.startI=hP(e,tP(t)),EP.startJ=hP(t,tP(e)),EP.endI=hP(e,rP(t)),EP.endJ=hP(t,rP(e))):(EP.startI=0,EP.startJ=0,EP.endI=r,EP.endJ=n),EP}!function(e){e.Empty=XT,e.ofUnsortedArray=ZT,e.ofSingleton=YT,e.ofSortedArray=KT,e.ofRange=QT,e.ofBounds=function(e,t){return QT(e,t-1)},e.is=JT,e.isRange=eP,e.has=dP,e.indexOf=uP,e.indexOfInInterval=cP,e.indexOfInRange=lP,e.start=tP,e.end=rP,e.min=nP,e.max=iP,e.size=aP,e.hashCode=oP,e.toString=sP,e.areEqual=fP,e.areIntersecting=yP,e.isSubset=bP,e.union=_P,e.intersect=wP,e.subtract=AP,e.findPredecessorIndex=hP,e.findPredecessorIndexInInterval=pP,e.findRange=mP,e.intersectionSize=xP,e.deduplicate=CP,e.indicesOf=TP}(PP||={});var kP,IP=$T.Empty,DP=$T.ofSingleton,OP=$T.ofRange,RP=$T.ofBounds;function BP(e){return e.length?PP.isRange(e)?$T.ofRange(e[0],e[e.length-1]):e:IP}function NP(e){return $T.is(e)?$T.size(e):PP.size(e)}function FP(e,t){return $T.is(e)?$T.has(e,t):PP.has(e,t)}function LP(e,t){return $T.is(e)?$T.indexOf(e,t):PP.indexOf(e,t)}function $P(e,t){return $T.is(e)?$T.getAt(e,t):e[t]}function UP(e){return $T.is(e)?$T.min(e):PP.min(e)}function jP(e){return $T.is(e)?$T.max(e):PP.max(e)}function zP(e){return $T.is(e)?$T.start(e):PP.start(e)}function GP(e){return $T.is(e)?$T.end(e):PP.end(e)}function VP(e){return $T.is(e)?$T.hashCode(e):PP.hashCode(e)}function HP(e,t){return $T.is(e)?$T.is(t)?$T.areEqual(e,t):tE(e,t):$T.is(t)?tE(t,e):PP.areEqual(e,t)}function qP(e,t){return $T.is(e)?$T.is(t)?$T.areIntersecting(e,t):rE(t,e):$T.is(t)?rE(e,t):PP.areIntersecting(e,t)}function WP(e,t){return $T.is(e)?$T.is(t)?$T.isSubInterval(e,t):function(e,t){var r=$T.min(e),n=$T.max(e);if(n-r+1==0)return!1;var i=PP.min(t),a=PP.max(t);return i>=r&&a<=n}(e,t):$T.is(t)?function(e,t){var r=$T.min(t),n=$T.max(t);if(n-r+1==0)return!0;var i=PP.min(e),a=PP.max(e);if(r<i||n>a)return!1;var o=PP.findRange(e,r,n);return $T.size(o)===$T.size(t)}(e,t):PP.isSubset(e,t)}function XP(e,t){return $T.is(e)?$T.findPredecessorIndex(e,t):PP.findPredecessorIndex(e,t)}function YP(e,t,r){return $T.is(e)?$T.findPredecessorIndexInInterval(e,t,r):PP.findPredecessorIndexInInterval(e,t,r)}function KP(e,t,r){return $T.is(e)?$T.findRange(e,t,r):PP.findRange(e,t,r)}function ZP(e,t){return $T.is(e)?$T.is(t)?$T.intersectionSize(e,t):iE(t,e):$T.is(t)?iE(e,t):PP.intersectionSize(e,t)}function QP(e,t){return $T.is(e)?$T.is(t)?function(e,t){if($T.areEqual(e,t))return e;var r=$T.size(e),n=$T.size(t);if(!n)return e;if(!r)return t;var i,a,o,s,u=$T.min(e),c=$T.min(t);if(function(e,t){var r=NP(e),n=NP(t);return 0===r&&0===n||r>0&&n>0&&jP(e)>=UP(t)&&UP(e)<=jP(t)}(e,t))return $T.ofRange(Math.min(u,c),Math.max($T.max(e),$T.max(t)));u<c?(i=r,a=u,o=n,s=c):(i=n,a=c,o=r,s=u);for(var l=new Int32Array(r+n),d=0;d<i;d++)l[d]=d+a;for(d=0;d<o;d++)l[d+i]=d+s;return BP(l)}(e,t):nE(t,e):$T.is(t)?nE(e,t):BP(PP.union(e,t))}function JP(e,t){return $T.is(e)?$T.is(t)?$T.intersect(e,t):aE(t,e):$T.is(t)?aE(e,t):BP(PP.intersect(e,t))}function eE(e,t){return $T.is(e)?$T.is(t)?function(e,t){if($T.areEqual(e,t))return IP;if(!$T.areIntersecting(e,t))return e;var r=$T.min(e),n=$T.max(e),i=$T.min(t),a=$T.max(t);if(n<r||a<i)return e;if($T.isSubInterval(t,e))return IP;if($T.isSubInterval(e,t)){var o=i-r,s=n-a;if(o<=0)return $T.ofRange(a+1,a+s);if(s<=0)return $T.ofRange(r,r+o-1);for(var u=new Int32Array(o+s),c=0,l=0;l<o;l++)u[c++]=r+l;for(l=1;l<=s;l++)u[c++]=a+l;return BP(u)}return r<i?$T.ofRange(r,i-1):$T.ofRange(a+1,n)}(e,t):function(e,t){var r=$T.min(e),n=$T.max(e);if(n<r)return e;var i=n-r+1,a=PP.findRange(t,r,n),o=$T.start(a),s=$T.end(a),u=s-o;if(0===u)return e;var c=i-u;if(c<=0)return IP;for(var l=new Int32Array(c),d=t.length-1,f=t[Math.min(o,d)],h=t[Math.min(s,d)],p=0,m=r;m<f;m++)l[p++]=m;for(m=f;m<=h;m++)PP.indexOfInInterval(t,m,a)<0&&(l[p++]=m);for(m=h+1;m<=n;m++)l[p++]=m;return BP(l)}(e,t):$T.is(t)?function(e,t){var r=$T.min(t),n=$T.max(t);if(n<r)return e;var i=PP.findRange(e,r,n),a=$T.start(i),o=$T.end(i),s=e.length-(o-a);if(s<=0)return IP;if(s===e.length)return e;for(var u=new Int32Array(s),c=0,l=0;l<a;l++)u[c++]=e[l];l=o;for(var d=e.length;l<d;l++)u[c++]=e[l];return BP(u)}(e,t):BP(PP.subtract(e,t))}function tE(e,t){return $T.size(e)===PP.size(t)&&$T.start(e)===PP.start(t)&&$T.end(e)===PP.end(t)}function rE(e,t){return 0!==e.length&&0!==$T.size(PP.findRange(e,$T.min(t),$T.max(t)))}function nE(e,t){var r=$T.size(t);if(!r)return e;if(function(e,t){return NP(e)?!NP(t)||UP(e)<=UP(t)&&jP(e)>=jP(t):0===NP(t)}(t,e))return t;for(var n=$T.min(t),i=$T.max(t),a=PP.findRange(e,n,i),o=$T.start(a),s=$T.end(a),u=new Int32Array(o+(e.length-s)+r),c=0,l=0;l<o;l++)u[c++]=e[l];for(l=n;l<=i;l++)u[c++]=l;l=s;for(var d=e.length;l<d;l++)u[c++]=e[l];return BP(u)}function iE(e,t){if(!$T.size(t))return 0;var r=PP.findRange(e,$T.min(t),$T.max(t));return $T.end(r)-$T.start(r)}function aE(e,t){if(!$T.size(t))return IP;var r=PP.findRange(e,$T.min(t),$T.max(t)),n=$T.start(r),i=$T.end(r),a=i-n;if(!a)return IP;if(a===e.length)return e;for(var o=new Int32Array(a),s=0,u=n;u<i;u++)o[s++]=e[u];return BP(o)}function oE(e,t,r){if(t===r)return e;var n=NP(e),i=t.length,a=r.length;if(0===n||0===i||0===a)return IP;for(var o=PP.findPredecessorIndex(r,t[UP(e)]),s=PP.findPredecessorIndex(r,t[jP(e)]+1),u=0,c=0,l=0,d=o;l<n&&d<s;)(h=t[$P(e,l)])<(p=r[d])?l++:(h>p||(u++,l++),d++);if(0===u)return IP;if(u===i&&u===a)return e;var f=new Int32Array(u);for(c=0,l=0,d=o;l<n&&d<s;){var h,p;(h=t[$P(e,l)])<(p=r[d])?l++:(h>p||(f[c++]=d,l++),d++)}return BP(f)}function sE(e){for(var t=PP.ofSortedArray(e),r=PP.max(t),n=new Int32Array(r),i=0,a=e.length-1;i<a;i++)for(var o=e[i],s=e[i+1];o<s;o++)n[o]=i;return{offsets:t,index:n,count:e.length-1}}function uE(e,t){for(var r=$T.start(t),n=new Int32Array(e.length+1),i=0,a=e.length;i<a;i++)n[i]=e[i]-r;return n[e.length]=$T.end(t)-r,sE(n)}function cE(e){return e.count}function lE(e,t){return e.index[t]}function dE(e,t,r){var n=e.offsets,i=r>=kP.max(n)?-1:kP.findPredecessorIndex(n,r-1);
139return kP.findRange(t,kP.getAt(n,i),kP.getAt(n,i+1)-1)}!function(e){e.Empty=IP,e.ofSingleton=DP,e.ofRange=OP,e.ofBounds=RP,e.ofSortedArray=BP,e.has=FP,e.indexOf=LP,e.getAt=$P,e.min=UP,e.max=jP,e.start=zP,e.end=GP,e.size=NP,e.hashCode=VP,e.areEqual=HP,e.areIntersecting=qP,e.isSubset=WP,e.union=QP,e.intersect=JP,e.indexedIntersect=oE,e.subtract=eE,e.findPredecessorIndex=XP,e.findPredecessorIndexInInterval=YP,e.findRange=KP,e.intersectionSize=ZP,e.forEach=function(e,t,r){return function(e,t,r){if($T.is(e))for(var n=$T.min(e),i=n,a=$T.max(e);i<=a;i++)t(i,i-n,r);else for(i=0,a=e.length;i<a;i++)t(e[i],i,r);return r}(e,t,r)},e.forEachSegment=function(e,t,r,n){return function(e,t,r,n){if($T.is(e))for(var i=0,a=$T.min(e),o=$T.max(e);a<=o;a++){for(var s=t(a),u=a+1;u<o&&t(u)===s;)u++;a=u-1,r(s,i,n),i++}else for(i=0,a=0,o=e.length;a<o;a++){for(s=t(e[a]),u=a+1;u<o&&t(e[u])===s;)u++;a=u-1,r(s,i,n),i++}return n}(e,t,r,n)},e.isInterval=function(e){return $T.is(e)},e.isSortedArray=function(e){return!$T.is(e)},e.toArray=function(t){var r=[];return e.forEach(t,function(e){return r.push(e)}),r},e.toString=function(e){return function(e){return $T.is(e)?$T.toString(e):PP.toString(e)}(e)}}(kP||={});var fE,hE=function(){function e(e,t,r,n){this.segments=e,this.segmentMap=t,this.set=r,this.segmentMin=0,this.segmentMax=0,this.setRange=$T.Empty,this.value={index:0,start:0,end:0},this.hasNext=!1,this.setRange=n,this.updateSegmentRange()}return e.prototype.move=function(){for(;this.hasNext;){if(this.updateValue()){this.value.index=this.segmentMin++,this.hasNext=this.segmentMax>=this.segmentMin&&$T.size(this.setRange)>0;break}this.updateSegmentRange()}return this.value},e.prototype.updateValue=function(){var e=this.segments[this.segmentMin+1],t=kP.findPredecessorIndexInInterval(this.set,e,this.setRange);return this.value.start=$T.start(this.setRange),this.value.end=t,this.setRange=$T.ofBounds(t,$T.end(this.setRange)),t>this.value.start},e.prototype.updateSegmentRange=function(){var e=$T.min(this.setRange),t=$T.max(this.setRange);t<e?this.hasNext=!1:(this.segmentMin=this.segmentMap[kP.getAt(this.set,e)],this.segmentMax=this.segmentMap[kP.getAt(this.set,t)],this.hasNext=this.segmentMax>=this.segmentMin)},e.prototype.setSegment=function(e){this.setRange=$T.ofBounds(e.start,e.end),this.updateSegmentRange()},e}();function pE(e,t,r){var n=void 0===r?$T.ofBounds(0,kP.size(t)):$T.ofBounds(r.start,r.end);return new hE(e.offsets,e.index,t,n)}!function(e){e.create=sE,e.ofOffsets=uE,e.count=cE,e.getSegment=lE,e.projectValue=dE,e.transientSegments=pE}(fE||={});var mE,gE=function(){function e(e){this.head=e>0?0:-1,this.prev=new Int32Array(e),this.next=new Int32Array(e);for(var t=0;t<e;t++)this.next[t]=t+1,this.prev[t]=t-1;this.prev[0]=-1,this.next[e-1]=-1}return e.prototype.remove=function(e){var t=this.prev,r=this.next,n=t[e],i=r[e];n>=0&&(r[n]=i,t[e]=-1),i>=0&&(t[i]=n,r[e]=-1),e===this.head&&(this.head=n<0?i:n)},e.prototype.has=function(e){return this.prev[e]>=0||this.next[e]>=0||this.head===e},e}();!function(e){function t(){return new Map}e.Empty=new Map,e.keyArray=function(e){return Hv(e.keys())},e.Mutable=t,e.asImmutable=function(e){return e},e.copy=function(e){for(var r=t(),n=e.keys();;){var i=n.next(),a=i.done,o=i.value;if(a)break;r.set(o,e.get(o))}return r},e.addFrom=function(e,t){for(var r=t.keys();;){var n=r.next(),i=n.done,a=n.value;if(i)break;e.set(a,t.get(a))}return e}}(mE||={});var vE,yE=function(){function e(e){this.xs=[],this.index=-1,this.length=0,this.hasNext=!1,this.length=e.length,this.hasNext=e.length>0,this.xs=e,this.index=-1,this.lastValue=e.length>0?e[0]:void 0}return e.prototype.move=function(){return++this.index,this.lastValue=this.xs[this.index],this.hasNext=this.index<this.length-1,this.lastValue},e}(),bE=function(){function e(e,t){this.max=t,this.value=0,this.hasNext=!1,this.value=e-1,this.hasNext=t>=e}return e.prototype.move=function(){return++this.value,this.hasNext=this.value<this.max,this.value},e}(),_E=function(){function e(e){this.value=e,this.hasNext=!0}return e.prototype.move=function(){return this.hasNext=!1,this.value},e}(),xE=function(){function e(e,t){this.base=e,this.f=t,this.hasNext=!1,this.hasNext=e.hasNext}return e.prototype.move=function(){var e=this.f(this.base.move());return this.hasNext=this.base.hasNext,e},e}(),SE=function(){function e(e,t){this.base=e,this.p=t,this.hasNext=this.findNext(
139)}return e.prototype.move=function(){var e=this.next;return this.hasNext=this.findNext(),e},e.prototype.findNext=function(){for(;this.base.hasNext;)if(this.next=this.base.move(),this.p(this.next))return!0;return!1},e}();!function(e){e.Empty=new bE(0,-1),e.Array=function(e){return new yE(e)},e.Value=function(e){return new _E(e)},e.Range=function(e,t){return new bE(e,t)},e.map=function(e,t){return new xE(e,t)},e.filter=function(e,t){return new SE(e,t)},e.forEach=function(e,t,r){for(;e.hasNext;)if(t(e.move(),r))return r;return r}}(vE||={});var wE,AE,CE={domain:[0,1],reverse:!1,listOrName:"red-yellow-blue",minLabel:"",maxLabel:""};function TE(e,t,r){for(var n=new Float32Array(e),i=0;i<n.length;i++)n[i]=t+r*i;return n}function PE(e){return 0}function EE(e){return function(t){return e[t]}}function ME(e){return 0===e[3]&&0===e[7]&&0===e[11]&&1===e[15]}function kE(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z,o=r[0],s=r[4],u=r[8],c=r[12];return ME(r)?function(e){return o*n[e]+s*i[e]+u*a[e]+c}:function(e){var t=n[e],l=i[e],d=a[e],f=r[3]*t+r[7]*l+r[11]*d+r[15]||1;return(o*t+s*l+u*d+c)/f}}function IE(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z,o=r[1],s=r[5],u=r[9],c=r[13];return ME(r)?function(e){return o*n[e]+s*i[e]+u*a[e]+c}:function(e){var t=n[e],l=i[e],d=a[e],f=r[3]*t+r[7]*l+r[11]*d+r[15]||1;return(o*t+s*l+u*d+c)/f}}function DE(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z,o=r[2],s=r[6],u=r[10],c=r[14];return ME(r)?function(e){return o*n[e]+s*i[e]+u*a[e]+c}:function(e){var t=n[e],l=i[e],d=a[e],f=r[3]*t+r[7]*l+r[11]*d+r[15]||1;return(o*t+s*l+u*d+c)/f}}(function(e){e.create=function(e){var t=Ac(Ac({},CE),e),r=t.domain,n=t.reverse,i=t.listOrName,a="string"==typeof i?sv(i).list:i,o=n?a.slice().reverse():a,s=o.length-1,u=0,c=0,l=0;function d(e,t){u=(l=t)-(c=e)||1}d(r[0],r[1]);var f,h=ff(e.minLabel,c.toString()),p=ff(e.maxLabel,l.toString());if(o.every(function(e){return Array.isArray(e)})){var m=kc([],o,!0);m.sort(function(e,t){return e[1]-t[1]});var g=m.map(function(e){return e[0]}),v=PP.ofSortedArray(m.map(function(e){return e[1]})),y=g.length-1;f=function(e){var t=bg((e-c)/u,0,1),r=PP.findPredecessorIndex(v,t);if(0===r)return g[c];if(r>y)return g[y];var n=v[r-1],i=bg((t-n)/(v[r]-n),0,1);return tv.interpolate(g[r-1],g[r],i)}}else f=function(e){var t=Math.min(o.length-1,Math.max(0,(e-c)/u*s)),r=Math.floor(t),n=o[r],i=o[Math.ceil(t)];return tv.interpolate(n,i,t-r)};return{color:f,colorToArray:function(e,t,r){tv.toArray(f(e),t,r)},normalizedColorToArray:function(e,t,r){tv.toArrayNormalized(f(e),t,r)},setDomain:d,get legend(){return function(e,t,r){return{kind:"scale-legend",minLabel:e,maxLabel:t,colors:r}}(h,p,o)}}}})(wE||={}),function(e){function t(t,r,n){var i=n||{},a=i.assembly,o=i.ncsId,s=i.hkl,u=i.spgrOp,c=i.key,l=s?Cg.clone(s):Cg();u??=-1,c??=-1,o||=-1;var d=Og.isIdentity(r),f=function(e,t){if(!e)return"";if(e.assembly)return function(e){return!!e&&!!e.matrix&&!!e.inverse&&"string"==typeof e.name}(e)?e.suffix:t?"":`_${e.assembly.operId}`;if(void 0!==e.spgrOp&&void 0!==e.hkl&&-1!==e.spgrOp){var r=e.hkl,n=r[0],i=r[1],a=r[2];return`-${e.spgrOp+1}_${5+n}${5+i}${5+a}`}return-1===e.ncsId?"":`_${e.ncsId}`}(n,d);return d?{name:t,assembly:a,matrix:r,inverse:Og.identity(),isIdentity:!0,hkl:l,spgrOp:u,ncsId:o,suffix:f,key:c}:(Og.isRotationAndTranslation(r,e.RotationTranslationEpsilon)||console.warn(`Symmetry operator (${t}) should be a composition of rotation and translation.`),{name:t,assembly:a,matrix:r,inverse:Og.invert(Og(),r),isIdentity:!1,hkl:l,spgrOp:u,key:c,ncsId:o,suffix:f})}e.DefaultName="1_555",e.Default=t(e.DefaultName,Og.identity()),e.RotationTranslationEpsilon=.005,e.create=t,e.checkIfRotationAndTranslation=function(t,r){for(var n=Og.identity(),i=0;i<3;i++)for(var a=0;a<3;a++)Og.setValue(n,i,a,Rg.getValue(t,i,a));return Og.setTranslation(n,r),Og.isRotationAndTranslation(n,e.RotationTranslationEpsilon)},e.ofRotationAndOffset=function(e,r,n,i){for(var a=Og.identity(),o=0;o<3;o++)for(var s=0;s<3;s++)Og.setValue(a,o,s,Rg.getValue(r,o,s));return Og.setTranslation(a,n),t(e,a,{ncsId:i})};var r=Ug.identity(),n=Ug(),i=Ug(),a=Cg();function o(t,r,n){var i=s(e.Default,r),a=t.isIdentity?i:s(t,r),o=function(e,t){return e.isIdentity?{x:EE(t.x),y:EE(t.y),z:EE(t.z)}:{x:kE(e,t),y:IE(e,t),z:DE(e,t)}}(t,r);return{operator:t,coordinates:r,invariantPosition:i,position:a,x:o.x,y:o.y,z:o.z,r:n}}function s(e,t){return e.isIdentity?function(e){var t=e.x,r=e.y,n=e.z;return function(e,i){return i[0]=t[e],i[1]=r[e],i[2]=n[e],i}}(t):function(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z;return ME(r)?function(e,t){var o=n[e],s=i[e],u=a[e];return t[0]=r[0]*o+r[4]*s+r[8]*u+r[12],t[1]=r[1]*o+r[5]*s+r[9]*u+r[13],t[2]=r[2]*o+r[6]*s+r[10]*u+r[14],t}:function(e,t){return t[0]=n[e],t[1]=i[e],t[2]=a[e],Cg.transformMat4(t,t,r),t}}(e,t)}e.lerpFromIdentity=function(e,t,i){var o=t.inverse;if(t.isIdentity)return Og.copy(e,o);var s=1-i;Og.getRotation(n,o),Ug.slerp(n,r,n,s);var u=Ug.getAxisAngle(a,n);return Og.fromRotation(e,u,a),Og.setValue(e,0,3,s*Og.getValue(o,0,3)),Og.setValue(e,1,3,s*Og.getValue(o,1,3)),Og.setValue(e,2,3,s*Og.getValue(o,2,3)),e},e.slerp=function(e,t,r,o){if(Math.abs(o)<=1e-5)return Og.copy(e,t);if(Math.abs(o-1)<=1e-5)return Og.copy(e,r);Og.getRotation(n,t),Og.getRotation(i,r),Ug.slerp(i,n,i,o);var s=Ug.getAxisAngle(a,i);return Og.fromRotation(e,s,a),Og.setValue(e,0,3,_g(Og.getValue(t,0,3),Og.getValue(r,0,3),o)),Og.setValue(e,1,3,_g(Og.getValue(t,1,3),Og.getValue(r,1,3),o)),Og.setValue(e,2,3,_g(Og.getValue(t,2,3),Og.getValue(r,2,3),o)),e},e.compose=function(e,r){var n=Og.mul(Og(),r.matrix,e.matrix);return t(r.name,n,r)},e.createMapping=function(e,t,r){return void 0===r&&(r=PE),o(e,t,r)},e.createCoordinateMapper=s}(AE||={});var OE=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[-1,0,0,0],[0,-1,0,0],[0,0,-1,0],[0,1,0,.5],[1,0,0,.5],[-1,0,0,.5],[0,0,1,.5],[0,-1,0,.5],[0,0,-1,.5],[1,0,0,.25],[0,-1,0,.25],[0,0,1,.25],[-1,0,0,.25],[0,1,0,.25],[0,-1,0,.75],[0,0,1,.75],[0,1,0,.75],[1,0,0,.75],[-1,0,0,.75],[0,0,-1,.25],[0,0,-1,.75],[1,-1,0,0],[-1,1,0,0],[0,0,1,1/3],[0,0,1,2/3],[1,0,0,2/3],[0,1,0,1/3],[0,-1,0,2/3],[1,-1,0,1/3],[-1,1,0,2/3],[-1,0,0,1/3],[1,0,0,1/3],[0,1,0,2/3],[0,-1,0,1/3],[1,-1,0,2/3],[-1,1,0,1/3],[-1,0,0,2/3],[0,0,-1,1/3],[0,0,-1,2/3],[0,0,1,5/6],[0,0,1,1/6],[0,0,-1,5/6],[0,0,-1,1/6]],RE=[[0,1,2],[3,4,5],[3,1,5],[3,6,5],[7,6,2],[8,6,5],[0,4,2],[0,4,9],[7,10,2],[7,10,9],[0,10,2],[8,10,5],[3,1,11],[3,6,11],[0,10,9],[8,6,11],[3,4,2],[0,4,5],[3,4,9],[7,10,5],[8,4,9],[8,10,9],[8,10,2],[0,6,9],[3,10,9],[0,10,11],[7,1,9],[8,1,11],[7,4,11],[7,6,9],[7,10,11],[3,10,2],[8,1,5],[0,4,11],[3,1,2],[3,1,9],[7,4,2],[8,1,2],[8,1,9],[3,6,9],[7,4,9],[8,6,2],[8,6,9],[3,6,2],[12,13,14],[15,16,14],[12,17,18],[15,19,18],[20,13,18],[21,16,18],[20,17,14],[21,19,14],[0,1,5],[8,10,11],[7,6,11],[7,6,5],[8,4,2],[7,4,5],[7,1,5],[7,1,11],[0,10,5],[0,1,11],[0,6,11],[0,6,5],[3,10,11],[8,4,11],[15,13,22],[12,16,22],[15,17,23],[12,19,23],[21,13,23],[20,16,23],[21,17,22],[20,19,22],[4,0,2],[1,3,2],[4,0,14],[1,3,18],[4,0,9],[1,3,9],[4,0,18],[1,3,14],[10,7,9],[6,8,9],[4,7,14],[6,3,18],[10,0,18],[1,8,14],[1,3,5],[4,0,5],[6,8,11],[10,7,11],[1,3,11],[4,0,11],[10,7,2],[6,8,2],[3,10,22],[7,1,23],[8,4,23],[0,6,22],[1,0,5],[4,3,5],[1,0,23],[4,3,22],[10,7,14],[6,8,18],[8,6,22],[7,10,23],[4,3,11],[1,0,11],[1,0,22],[4,3,23],[10,7,18],[6,8,14],[8,6,23],[7,10,22],[6,7,11],[10,8,11],[8,1,23],[0,10,22],[3,6,22],[7,4,23],[4,3,2],[1,0,2],[10,8,2],[6,7,2],[4,3,9],[1,0,9],[10,8,9],[6,7,9],[4,8,14],[6,0,18],[10,3,18],[1,7,14],[4,8,18],[6,0,14],[10,3,14],[1,7,18],[6,7,5],[10,8,5],[6,8,5],[10,7,5],[8,1,22],[0,10,23],[3,6,23],[7,4,22],[4,24,2],[25,3,2],[4,24,26],[25,3,27],[4,24,27],[25,3,26],[28,29,26],[30,31,26],[32,33,26],[34,35,27],[36,37,27],[38,39,27],[2,0,1],[1,2,0],[1,25,5],[24,0,5],[39,36,40],[35,38,40],[37,34,40],[33,30,41],[29,32,41],[31,28,41],[5,3,4],[4,5,3],[25,1,5],[0,24,5],[24,4,5],[3,25,5],[4,3,41],[25,
1391,40],[24,4,41],[3,25,40],[4,3,40],[25,1,41],[24,4,40],[3,25,41],[35,34,40],[37,36,40],[39,38,40],[29,28,41],[31,30,41],[33,32,41],[3,5,4],[5,4,3],[25,1,2],[0,24,2],[24,4,2],[3,25,2],[25,1,9],[0,24,9],[24,4,9],[3,25,9],[30,33,26],[32,29,26],[28,31,26],[36,39,27],[38,35,27],[34,37,27],[0,2,1],[2,1,0],[30,33,42],[32,29,42],[28,31,42],[36,39,43],[38,35,43],[34,37,43],[7,9,6],[9,6,7],[25,1,11],[0,24,11],[24,4,11],[3,25,11],[35,34,44],[37,36,44],[39,38,44],[29,28,45],[31,30,45],[33,32,45],[8,11,10],[11,10,8],[1,25,2],[24,0,2],[1,25,42],[24,0,43],[1,25,43],[24,0,42],[1,25,27],[24,0,26],[1,25,26],[24,0,27],[1,25,9],[24,0,9],[4,24,5],[25,3,5],[4,24,11],[25,3,11],[1,0,40],[4,3,44],[0,24,45],[1,0,41],[4,3,45],[0,24,44],[0,24,40],[0,24,41],[2,3,4],[5,3,1],[5,0,4],[4,2,3],[1,5,3],[4,5,0],[2,7,6],[2,8,10],[5,8,6],[5,7,10],[1,9,7],[4,9,8],[1,11,8],[4,11,7],[9,0,6],[9,3,10],[11,3,6],[11,0,10],[6,2,7],[10,2,8],[6,5,8],[10,5,7],[9,7,1],[9,8,4],[11,8,1],[11,7,4],[6,9,0],[10,9,3],[6,11,3],[10,11,0],[9,7,6],[9,8,10],[11,8,6],[11,7,10],[6,9,7],[10,9,8],[6,11,8],[10,11,7],[2,3,10],[5,8,1],[11,0,4],[10,2,3],[1,5,8],[4,11,0],[5,0,1],[2,0,4],[2,3,1],[1,5,0],[4,2,0],[1,2,3],[11,8,10],[11,7,6],[9,7,10],[9,8,6],[10,11,8],[6,11,7],[10,9,7],[6,9,8],[5,8,10],[5,7,6],[2,7,10],[2,8,6],[4,11,8],[1,11,7],[4,9,7],[1,9,8],[11,3,10],[11,0,6],[9,0,10],[9,3,6],[10,5,8],[6,5,7],[10,2,7],[6,2,8],[11,8,4],[11,7,1],[9,7,4],[9,8,1],[10,11,3],[6,11,0],[10,9,0],[6,9,3],[22,15,13],[22,12,16],[14,12,13],[14,15,16],[13,22,15],[16,22,12],[13,14,12],[16,14,15],[22,21,17],[22,20,19],[14,20,17],[14,21,19],[13,23,21],[16,23,20],[13,18,20],[16,18,21],[23,15,17],[23,12,19],[18,12,17],[18,15,19],[17,22,21],[19,22,20],[17,14,20],[19,14,21],[23,21,13],[23,20,16],[18,20,13],[18,21,16],[17,23,15],[19,23,12],[17,18,12],[19,18,15],[5,0,6],[2,7,4],[9,3,1],[6,5,0],[4,2,7],[1,9,3],[0,2,4],[3,2,1],[0,5,1],[2,1,3],[2,4,0],[5,1,0],[7,9,10],[8,9,6],[7,11,6],[9,6,8],[9,10,7],[11,6,7],[1,7,11],[4,8,11],[1,8,9],[4,7,9],[0,9,10],[3,9,6],[3,11,10],[0,11,6],[2,6,8],[2,10,7],[5,6,7],[5,10,8],[6,0,11],[10,3,11],[6,3,9],[10,0,9],[7,2,10],[8,2,6],[8,5,10],[7,5,6],[9,1,8],[9,4,7],[11,1,7],[11,4,8],[7,9,4],[8,9,1],[8,11,4],[7,11,1],[9,6,3],[9,10,0],[11,6,0],[11,10,3],[19,12,23],[13,15,22],[16,21,18],[17,20,14],[20,14,17],[21,18,16],[15,22,13],[12,23,19],[18,16,21],[14,17,20],[23,19,12],[22,13,15],[19,20,22],[13,21,23],[16,15,14],[17,12,18],[20,18,13],[21,14,19],[15,23,17],[12,22,16],[18,19,15],[14,13,12],[23,16,20],[22,17,21],[16,12,22],[17,15,23],[19,21,14],[13,20,18],[12,14,13],[15,18,19],[21,22,17],[20,23,16],[14,16,15],[18,17,12],[22,19,20],[23,13,21],[16,20,23],[17,21,22],[19,15,18],[13,12,14],[12,18,17],[15,14,16],[21,23,13],[20,22,19],[14,19,21],[18,13,20],[22,16,12],[23,17,15],[19,12,22],[17,21,23],[16,15,18],[13,20,14],[20,14,13],[15,18,16],[21,23,17],[12,22,19],[18,16,15],[14,13,20],[22,19,12],[23,17,21],[3,2,4],[3,5,1],[0,5,4],[2,4,3],[5,1,3],[5,4,0],[1,7,9],[4,8,9],[1,8,11],[4,7,11],[0,9,6],[3,9,10],[3,11,6],[0,11,10],[2,6,7],[2,10,8],[5,6,8],[5,10,7],[6,0,9],[10,3,9],[6,3,11],[10,0,11],[7,2,6],[8,2,10],[8,5,6],[7,5,10],[9,1,7],[9,4,8],[11,1,8],[11,4,7],[7,9,1],[8,9,4],[8,11,1],[7,11,4],[9,6,0],[9,10,3],[11,6,3],[11,10,0],[8,9,10],[8,11,6],[7,11,10],[9,10,8],[11,6,8],[11,10,7],[6,0,2],[10,3,2],[6,3,5],[10,0,5],[7,2,1],[8,2,4],[8,5,1],[7,5,4],[9,1,0],[9,4,3],[11,1,3],[11,4,0],[1,7,2],[4,8,2],[1,8,5],[4,7,5],[0,9,1],[3,9,4],[3,11,1],[0,11,4],[2,6,0],[2,10,3],[5,6,3],[5,10,0],[0,2,6],[3,2,10],[3,5,6],[0,5,10],[2,1,7],[2,4,8],[5,1,8],[5,4,7],[16,12,14],[13,21,18],[19,15,23],[17,20,22],[12,14,16],[21,18,13],[15,23,19],[20,22,17],[14,16,12],[18,13,21],[23,19,15],[22,17,20],[19,20,18],[17,15,14],[16,21,22],[13,12,23],[20,18,19],[15,14,17],[21,22,16],[12,23,13],[18,19,20],[14,17,15],[22,16,21],[23,13,12],[6,0,5],[10,3,5],[6,3,2],[10,0,2],[7,2,4],[8,2,1],[8,5,4],[7,5,1],[9,1,3],[9,4,0],[11,1,0],[11,4,3],[1,7,5],[4,8,5],[1,8,2],[4,7,2],[0,9,4],[3,9,1],[3,11,4],[0,11,1],[2,6,3],[2,10,0],[5,6,0],[5,10,3],[0,2,10],[3,2,6],[3,5,10],[0,5,6],[2,1,8],[2,4,7],[5,1,7],[5,4,8],[21,17,23],[20,16,22],[12,13,18],[15,19,14],[23,21,17],[22,20,16],[18,12,13],[14,15,19],[17,23,21],[16,22,20],[13,18,12],[19,14,15],[21,13,22],[20,19,23],[12,17,14],[15,16,18],[23,15,13],[22,12,19],[18,20,17],[14,21,16],[17,22,15],[16,23,12],[13,14,20],[19,18,21],[15,17,22],[12,16,23],[20,13,14],[21,19,18],[22,21,13],[23,20,19],[14,12,17],[18,15,16],[13,23,15],[19,22,12],[17,18,20],[16,14,21],[15,13,23],[12,19,22],[20,17,18],[21,16,14],[22,15,17],[23,12,16],[14,20,13],[18,21,19],[13,22,21],[19,23,20],[17,14,12],[16,18,15],[6,5,3],[4,9,3],[9,3,4],[5,7,4],[4,5,7],[5,3,6]],BE=[[0],[0,1],[0,2],[0,3],[0,2,4,5],[0,6],[0,7],[0,6,4,8],[0,7,4,9],[0,6,2,1],[0,3,1,10],[0,6,2,1,4,8,5,11],[0,12,1,7],[0,1,13,14],[0,12,1,7,4,15,11,9],[0,16,2,17],[0,18,12,17],[0,16,5,19],[0,20,13,19],[0,18,12,17,4,21,15,19],[0,16,2,17,4,22,5,19],[0,16,2,17,23,24,13,25,26,20,27,28,4,22,5,19],[0,16,17,2,29,21,30,15],[0,20,13,19,29,31,32,33],[0,16,6,34],[0,18,7,34],[0,16,7,35],[0,16,36,37],[0,18,36,38],[0,16,14,39],[0,20,40,34],[0,16,8,41],[0,18,8,42],[0,16,9,42],[0,16,6,34,4,22,8,41],[0,18,7,34,4,21,9,41],[0,16,7,35,4,22,9,42],[0,16,6,34,23,24,14,39],[0,16,10,43,23,24,7,35
139],[0,16,36,37,23,24,9,42],[0,16,8,41,23,24,40,38],[0,16,6,34,23,24,14,39,26,20,40,38,4,22,8,41],[0,16,44,45,23,24,46,47,26,20,48,49,4,22,50,51],[0,16,6,34,29,21,9,42],[0,16,8,41,29,21,7,35],[0,16,36,37,29,21,14,39],[0,16,2,17,1,52,6,34],[0,16,2,17,53,54,9,42],[0,16,12,33,1,52,7,35],[0,16,2,17,11,55,8,41],[0,56,2,57,1,58,6,37],[0,56,15,25,1,58,9,39],[0,20,27,17,1,59,40,34],[0,56,12,28,1,58,7,38],[0,16,5,19,1,52,8,41],[0,22,13,28,1,55,14,38],[0,18,13,60,1,61,14,43],[0,16,15,30,1,52,9,42],[0,16,5,19,11,55,6,34],[0,21,12,19,1,54,7,41],[0,20,13,19,1,59,14,41],[0,20,3,30,1,59,10,42],[0,18,12,17,1,61,7,34,4,21,15,19,11,54,9,41],[0,24,13,17,1,62,14,34,4,20,27,19,11,59,40,41],[0,16,2,17,1,52,6,34,4,22,5,19,11,55,8,41],[0,16,12,33,1,52,7,35,4,22,15,30,11,55,9,42],[0,31,3,17,1,63,10,34,4,56,32,19,11,58,36,41],[0,22,2,19,64,59,14,38,4,16,5,17,65,62,40,39],[0,16,2,17,1,52,6,34,23,24,13,25,64,62,14,39,26,20,27,28,65,59,40,38,4,22,5,19,11,55,8,41],[0,16,2,17,66,67,44,45,23,24,13,25,68,69,46,47,26,20,27,28,70,71,48,49,4,22,5,19,72,73,50,51],[0,16,2,17,1,52,6,34,29,21,15,30,53,54,9,42],[0,16,5,19,1,52,8,41,29,21,12,33,53,54,7,35],[0,20,13,19,1,59,14,41,29,31,32,33,53,63,36,35],[0,31,3,17,1,63,10,34,29,20,27,30,53,59,40,42],[0,16,74,75],[0,18,76,77],[0,16,78,79],[0,18,80,81],[0,16,74,75,29,21,82,83],[0,21,84,85,29,16,86,87],[0,16,88,89],[0,16,88,89,29,21,90,91],[0,16,74,75,1,52,88,89],[0,16,78,79,1,52,92,93],[0,16,94,95,11,55,88,89],[0,16,82,83,53,54,88,89],[0,16,74,75,1,52,88,89,29,21,82,83,53,54,90,91],[0,21,84,85,96,97,88,91,29,16,86,87,98,99,90,89],[0,16,74,75,2,17,100,101],[0,16,94,95,5,19,100,101],[0,18,76,77,2,33,102,103],[0,18,104,105,106,107,100,108],[0,16,78,79,2,17,109,108],[0,16,82,83,15,30,100,101],[0,18,80,81,2,33,110,111],[0,18,112,113,114,115,100,108],[0,16,74,75,2,17,100,101,29,21,82,83,15,30,116,117],[0,21,84,85,118,119,116,101,29,16,86,87,120,121,100,117],[0,16,74,75,6,34,122,123],[0,16,74,75,8,41,124,125],[0,16,78,79,7,35,122,123],[0,16,82,83,9,42,122,123],[0,16,74,75,7,35,126,127],[0,16,74,75,9,42,128,129],[0,16,78,79,6,34,126,127],[0,16,78,79,8,41,128,129],[0,16,74,75,6,34,122,123,29,21,82,83,9,42,128,129],[0,16,74,75,7,35,126,127,29,21,82,83,8,41,124,125],[0,21,84,85,6,42,130,131,29,16,86,87,9,34,132,133],[0,21,84,85,7,41,134,135,29,16,86,87,8,35,136,137],[0,16,89,88,2,17,122,123],[0,16,89,88,12,33,126,127],[0,16,89,88,5,19,124,125],[0,16,89,88,15,30,128,129],[0,16,88,89,6,34,100,101],[0,16,89,88,7,35,109,108],[0,16,89,88,8,41,138,139],[0,16,89,88,9,42,116,117],[0,16,89,88,6,34,100,101,29,21,91,90,9,42,116,117],[0,16,89,88,7,35,109,108,29,21,91,90,8,41,138,139],[0,16,89,88,2,17,122,123,29,21,91,90,15,30,128,129],[0,16,89,88,118,121,132,131,29,21,91,90,120,119,130,133],[0,16,74,75,2,17,100,101,1,52,88,89,6,34,122,123],[0,16,74,75,12,33,109,108,1,52,88,89,7,35,126,127],[0,16,74,75,2,17,100,101,11,55,140,141,8,41,124,125],[0,16,74,75,2,17,100,101,53,54,90,91,9,42,128,129],[0,16,74,75,5,19,138,139,1,52,88,89,8,41,124,125],[0,16,74,75,15,30,116,117,1,52,88,89,9,42,128,129],[0,16,94,95,5,19,100,101,11,55,88,89,6,34,124,125],[0,16,94,95,15,30,109,108,11,55,88,89,7,35,128,129],[0,16,78,79,2,17,109,108,1,52,92,93,6,34,126,127],[0,16,78,79,12,33,100,101,1,52,92,93,7,35,122,123],[0,16,82,83,12,33,138,139,53,54,88,89,8,41,126,127],[0,16,82,83,2,17,116,117,53,54,88,89,9,42,122,123],[0,16,78,79,5,19,116,117,1,52,92,93,8,41,128,129],[0,16,82,83,15,30,100,101,1,52,90,91,9,42,122,123],[0,16,82,83,15,30,100,101,53,54,88,89,6,34,128,129],[0,16,82,83,5,19,109,108,53,54,88,89,7,35,124,125],[0,16,74,75,2,17,100,101,1,52,88,89,6,34,122,123,29,21,82,83,15,30,116,117,53,54,90,91,9,42,128,129],[0,16,74,75,12,33,109,108,1,52,88,89,7,35,126,127,29,21,82,83,5,19,138,139,53,54,90,91,8,41,124,125],[0,21,84,85,118,119,116,101,96,97,88,91,9,34,132,133,29,16,86,87,120,121,100,117,98,99,90,89,6,42,130,131],[0,21,84,85,142,143,138,108,96,97,88,91,8,35,136,137,29,16,86,87,144,145,109,139,98,99,90,89,7,41,134,135],[0,146,147],[0,148,149],[0,150,151],[0,146,147,152,153,154,155,156,157],[0,158,159],[0,146,147,1,160,161],[0,146,147,1,160,161,152,153,154,162,163,164,155,156,157,165,166,167],[0,158,159,1,168,169],[0,146,147,101,170,171],[0,146,147,100,172,173],[0,148,149,174,175,171],[0,148,149,100,176,177],[0,150,151,178,179,171],[0,150,151,100,180,181],[0,146,147,100,172,173,152,153,154,182,183,184,155,156,157,185,186,187],[0,158,159,101,188,189],[0,146,147,122,190,191],[0,146,147,123,192,193],[0,146,147,126,194,195],[0,146,147,127,196,197],[0,146,147,122,190,191,152,153,154,198,199,200,155,156,157,201,202,203],[0,158,159,123,204,205],[0,146,147,126,194,195,152,153,154,206,207,208,155,156,157,209,210,211],[0,158,159,129,212,213],[0,146,147,101,170,171,1,160,161,123,192,193],[0,146,147,108,214,215,1,160,161,127,196,197],[0,146,147,100,172,173,1,160,161,122,190,191],[0,146,147,109,216,217,1,160,161,126,194,195],[0,146,147,100,172,173,1,160,161,122,190,191,152,153,154,182,183,184,162,163,164,198,199,200,155,156,157,185,186,187,165,166,167,201,202,203],[0,158,159,101,188,189,1,168,169,123,204,205],[0,146,147,109,216,217,1,160,161,126,194,195,152,153,154,218,219,220,162,163,164,206,207,208,155,156,157,221,222,223,165,166,167,209,210,211],[0,158,159,117,224,225,1,168,169,129,212,213],[0,146,147,16,226,227],[0,148,149,18,228,229],[0,150,151,18,230,23
1391],[0,150,151,16,232,233],[0,148,149,16,234,235],[0,146,147,18,236,237],[0,146,147,52,238,239],[0,146,147,16,226,227,1,160,161,52,238,239],[0,146,147,18,236,237,1,160,161,61,240,241],[0,146,147,16,226,227,100,172,173,101,170,171],[0,148,149,18,228,229,242,172,181,243,214,244],[0,150,151,18,230,231,245,172,177,246,214,247],[0,150,151,16,232,233,245,172,177,174,170,248],[0,148,149,16,234,235,242,172,181,178,170,249],[0,146,147,18,236,237,100,172,173,108,214,215],[0,146,147,16,226,227,122,190,191,123,192,193],[0,146,147,16,226,227,126,194,195,127,196,197],[0,146,147,18,236,237,126,194,195,123,192,193],[0,146,147,18,236,237,122,190,191,127,196,197],[0,146,147,52,238,239,122,190,191,101,170,171],[0,146,147,61,240,241,126,194,195,101,170,171],[0,146,147,52,238,239,100,172,173,123,192,193],[0,146,147,61,240,241,100,172,173,127,196,197],[0,146,147,16,226,227,100,172,173,101,170,171,1,160,161,52,239,238,122,190,191,123,192,193],[0,146,147,16,226,227,109,216,217,108,214,215,1,160,161,52,239,238,126,194,195,127,196,197],[0,146,147,18,236,237,109,216,217,101,170,171,1,160,161,61,241,240,126,194,195,123,192,193],[0,146,147,18,236,237,100,172,173,108,214,215,1,160,161,61,241,240,122,190,191,127,196,197],[0,16,2,17,158,250,251,252,159,253,254,255],[0,16,2,17,158,250,251,252,159,253,254,255,23,24,13,25,256,257,258,259,260,261,262,263,26,20,27,28,264,265,266,267,268,269,270,271,4,22,5,19,272,273,274,275,276,277,278,279],[0,16,2,17,158,250,251,252,159,253,254,255,29,21,15,30,280,281,282,283,284,285,286,287],[0,20,13,19,158,273,266,259,159,261,278,271],[0,20,13,19,158,273,266,259,159,261,278,271,29,31,32,33,280,288,289,290,284,291,292,293],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299],[0,16,2,17,158,250,251,252,159,253,254,255,53,54,9,42,300,301,302,303,304,305,306,307],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299,23,24,13,25,256,257,258,259,260,261,262,263,64,62,14,39,308,309,310,311,312,313,314,315,26,20,27,28,264,265,266,267,268,269,270,271,65,59,40,38,316,317,318,319,320,321,322,323,4,22,5,19,272,273,274,275,276,277,278,279,11,55,8,41,324,325,326,327,328,329,330,331],[0,16,2,17,158,250,251,252,159,253,254,255,66,67,44,45,332,333,334,335,336,337,338,339,23,24,13,25,256,257,258,259,260,261,262,263,68,69,46,47,340,341,342,343,344,345,346,347,26,20,27,28,264,265,266,267,268,269,270,271,70,71,48,49,348,349,350,351,352,353,354,355,4,22,5,19,272,273,274,275,276,277,278,279,72,73,50,51,356,357,358,359,360,361,362,363],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299,29,21,15,30,280,281,282,283,284,285,286,287,53,54,9,42,300,301,302,303,304,305,306,307],[0,20,13,19,158,273,266,259,159,261,278,271,1,59,14,41,168,325,318,311,169,313,330,323],[0,20,13,19,158,273,266,259,159,261,278,271,1,59,14,41,168,325,318,311,169,313,330,323,29,31,32,33,280,288,289,290,284,291,292,293,53,63,36,35,300,364,365,366,304,367,368,369],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,23,24,13,25,256,257,258,259,260,261,262,263,382,383,384,385,386,387,388,389,390,391,392,393,26,20,27,28,264,265,266,267,268,269,270,271,394,395,396,397,398,399,400,401,402,403,404,405,4,22,5,19,272,273,274,275,276,277,278,279,138,139,95,94,406,407,408,409,410,411,412,413],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,29,21,15,30,280,281,282,283,284,285,286,287,116,117,83,82,376,377,224,378,379,380,381,225],[0,20,13,19,158,273,266,259,159,261,278,271,450,415,440,429,454,431,420,445,458,447,436,425],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473,29,31,32,33,280,288,289,290,284,291,292,293,450,415,440,429,454,431,420,445,458,447,436,425],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479,23,24,13,25,256,257,258,259,260,261,262,263,480,481,482,483,484,485,486,487,488,489,490,491,26,20,27,28,264,265,266,267,268,269,270,271,492,493,494,495,496,497,498,499,500,501,502,503,4,22,5,19,272,273,274,275,276,277,278,279,125,124,140,141,504,505,506,507,508,509,510,511],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479,29,21,15,30,280,281,282,283,284,285,286,287,129,128,90,91,212,512,513,514,213,515,516,517],[0,16,2,17,158,250,251,252,159,253,254,255,129,128,90,91,212,512,513,514,213,515,516,517],[0,16,2,17,158,250,251,252,159,253,254,255,129,128,90,91,212,512,513,514,213,515,516,517,23,24,13,25,256,257,258,259,260,261,262,263,518,519,520,521,522,523,524,525,526,527,528,529,26,20,27,28,264,265,266,267,268,269,270,271,530,531,532,533,534,535,536,537,538,539,540,541,4,22,5,19,272,273,274,275,276,277,278,279,127,126,92,93,542,543,544,545,546,547,548,549],[0,20,13,19,158,273,266,259,159,261,278,271,550,551,552,553,554,555,556,557,558,559,560,561,29,31,32,33,280,288,289,290,284,291,292,293,562,563,564,565,566,567,568,569,570,571,572,573],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,53,54,9,42,300,301,302,303,304,305,306,307,128,129,91,90,513,514,212,512,517,516,515,213],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,1,52,6,34,168,294,295,296,169,297,298,299,128,129,91,90,513,514,212,512,517,516,515,213],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,53,54,9,42,300,301,302,303,304,305,306,307,122,123,89,88,475,476,204,474,479,478,477,205],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205,23,24,13,25,256,257,258,259,260,261,262,263,382,383,384,385,386,387,388,389,390,391,392,393,64,62,14,39,308,309,3
13910,311,312,313,314,315,481,480,483,482,486,487,484,485,491,490,489,488,26,20,27,28,264,265,266,267,268,269,270,271,394,395,396,397,398,399,400,401,402,403,404,405,65,59,40,38,316,317,318,319,320,321,322,323,493,492,495,494,498,499,496,497,503,502,501,500,4,22,5,19,272,273,274,275,276,277,278,279,138,139,95,94,406,407,408,409,410,411,412,413,11,55,8,41,324,325,326,327,328,329,330,331,124,125,141,140,506,507,504,505,511,510,509,508],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,1,52,6,34,168,294,295,296,169,297,298,299,128,129,91,90,513,514,212,512,517,516,515,213,23,24,13,25,256,257,258,259,260,261,262,263,574,575,576,577,578,579,580,581,582,583,584,585,64,62,14,39,308,309,310,311,312,313,314,315,519,518,521,520,524,525,522,523,529,528,527,526,26,20,27,28,264,265,266,267,268,269,270,271,586,587,588,589,590,591,592,593,594,595,596,597,65,59,40,38,316,317,318,319,320,321,322,323,531,530,533,532,536,537,534,535,541,540,539,538,4,22,5,19,272,273,274,275,276,277,278,279,109,108,79,78,598,599,600,601,602,603,604,605,11,55,8,41,324,325,326,327,328,329,330,331,126,127,93,92,544,545,542,543,549,548,547,546],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,66,69,50,49,332,349,342,359,336,361,354,347,493,123,483,140,498,507,204,485,503,490,509,205,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,68,67,48,51,340,357,334,351,344,353,362,339,124,480,89,494,506,499,484,474,511,478,501,488,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,70,73,46,45,348,333,358,343,352,345,338,363,122,492,141,482,475,487,496,505,479,510,489,500,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461,72,71,44,47,356,341,350,335,360,337,346,355,481,125,495,88,486,476,504,497,491,502,477,508],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,606,607,608,609,610,611,612,613,614,615,616,617,531,129,521,92,536,545,212,523,541,528,547,213,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,618,619,620,621,622,623,624,625,626,627,628,629,126,518,91,532,544,537,522,512,549,516,539,526,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,630,631,632,633,634,635,636,637,638,639,640,641,128,530,93,520,513,525,534,543,517,548,527,538,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461,642,643,644,645,646,647,648,649,650,651,652,653,519,127,533,90,524,514,542,535,529,540,515,546],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205,29,21,15,30,280,281,282,283,284,285,286,287,116,117,83,82,376,377,224,378,379,380,381,225,53,54,9,42,300,301,302,303,304,305,306,307,128,129,91,90,513,514,212,512,517,516,515,213],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473,1,59,14,41,168,325,318,311,169,313,330,323,551,550,553,552,556,557,554,555,561,560,559,558,29,31,32,33,280,288,289,290,284,291,292,293,450,415,440,429,454,431,420,445,458,447,436,425,53,63,36,35,300,364,365,366,304,367,368,369,563,562,565,564,568,569,566,567,573,572,571,570],[0,16],[0,18],[0,16,26,20],[0,2,23,13],[0,3,4,32],[0,2,29,15],[0,3,29,27],[0,52],[0,63],[0,52,26,59],[0,63,26,54],[0,52,16,1],[0,18,1,61],[0,52,16,1,26,59,20,65],[0,31,1,63],[0,1,24,62],[0,15,1,9],[0,5,1,8],[0,31,1,63,26,21,65,54],[0,2,57,56],[0,60,3,16],[0,22,57,3],[0,2,28,20],[0,17,13,24],[0,20,19,13,4,24,17,27],[0,22,57,3,4,16,60,32],[0,22,57,3,23,20,30,12,26,24,33,15,4,16,60,32],[0,22,57,3,29,18,27,25],[0,22,3,57,1,55,10,37],[0,22,385,396,3,57,109,117],[0,22,57,3,159,279,654,655,158,274,656,657,29,18,25,27,284,658,262,269,280,659,257,267]],NE={"P 1":0,"P -1":1,"P 1 2 1":2,"P 1 21 1":3,"C 1 2 1":4,"P 1 m 1":5,"P 1 c 1":6,"C 1 m 1":7,"C 1 c 1":8,"P 1 2/m 1":9,"P 1 21/m 1":10,"C 1 2/m 1":11,"P 1 2/c 1":12,"P 1 21/c 1":13,"C 1 2/c 1":14,"P 2 2 2":15,"P 2 2 21":16,"P 21 21 2":17,"P 21 21 21":18,"C 2 2 21":19,"C 2 2 2":20,"F 2 2 2":21,"I 2 2 2":22,"I 21 21 21":23,"P m m 2":24,"P m c 21":25,"P c c 2":26,"P m a 2":27,"P c a 21":28,"P n c 2":29,"P m n 21":30,"P b a 2":31,"P n a 21":32,"P n n 2":33,"C m m 2":34,"C m c 21":35,"C c c 2":36,"A m m 2":37,"A b m 2":38,"A m a 2":39,"A b a 2":40,"F m m 2":41,"F d d 2":42,"I m m 2":43,"I b a 2":44,"I m a 2":45,"P 2/m 2/m 2/m":46,"P m m m":46,"P 2/n 2/n 2/n":47,"P n n n":47,"P 2/c 2/c 2/m":48,"P c c m":48,"P 2/b 2/a 2/n":49,"P b a n":49,"P 21/m 2/m 2/a":50,"P m m a":50,"P 2/n 21/n 2/a":51,"P n n a":51,"P 2/m 2/n 21/a":52,"P m n a":52,"P 21/c 2/c 2/a":53,"P c c a":53,"P 21/b 21/a 2/m":54,"P b a m":54,"P 21/c 21/c 2/n":55,"P c c n":55,"P 2/b 21/c 21/m":56,"P b c m":56,"P 21/n 21/n 2/m":57,"P n n m":57,"P 21/m 21/m 2/n":58,"P m m n":58,"P 21/b 2/c 21/n":59,"P b 
139c n":59,"P 21/b 21/c 21/a":60,"P b c a":60,"P 21/n 21/m 21/a":61,"P n m a":61,"C 2/m 2/c 21/m":62,"C m c m":62,"C 2/m 2/c 21/a":63,"C m c a":63,"C 2/m 2/m 2/m":64,"C m m m":64,"C 2/c 2/c 2/m":65,"C c c m":65,"C 2/m 2/m 2/a":66,"C m m a":66,"C 2/c 2/c 2/a":67,"C c c a":67,"F 2/m 2/m 2/m":68,"F m m m":68,"F 2/d 2/d 2/d":69,"F d d d":69,"I 2/m 2/m 2/m":70,"I m m m":70,"I 2/b 2/a 2/m":71,"I b a m":71,"I 21/b 21/c 21/a":72,"I b c a":72,"I 21/m 21/m 21/a":73,"I m m a":73,"P 4":74,"P 41":75,"P 42":76,"P 43":77,"I 4":78,"I 41":79,"P -4":80,"I -4":81,"P 4/m":82,"P 42/m":83,"P 4/n":84,"P 42/n":85,"I 4/m":86,"I 41/a":87,"P 4 2 2":88,"P 4 21 2":89,"P 41 2 2":90,"P 41 21 2":91,"P 42 2 2":92,"P 42 21 2":93,"P 43 2 2":94,"P 43 21 2":95,"I 4 2 2":96,"I 41 2 2":97,"P 4 m m":98,"P 4 b m":99,"P 42 c m":100,"P 42 n m":101,"P 4 c c":102,"P 4 n c":103,"P 42 m c":104,"P 42 b c":105,"I 4 m m":106,"I 4 c m":107,"I 41 m d":108,"I 41 c d":109,"P -4 2 m":110,"P -4 2 c":111,"P -4 21 m":112,"P -4 21 c":113,"P -4 m 2":114,"P -4 c 2":115,"P -4 b 2":116,"P -4 n 2":117,"I -4 m 2":118,"I -4 c 2":119,"I -4 2 m":120,"I -4 2 d":121,"P 4/m 2/m 2/m":122,"P4/m m m":122,"P 4/m 2/c 2/c":123,"P4/m c c":123,"P 4/n 2/b 2/m":124,"P4/n b m":124,"P 4/n 2/n 2/c":125,"P4/n n c":125,"P 4/m 21/b 2/m":126,"P4/m b m":126,"P 4/m 21/n 2/c":127,"P4/m n c":127,"P 4/n 21/m 2/m":128,"P4/n m m":128,"P 4/n 2/c 2/c":129,"P4/n c c":129,"P 42/m 2/m 2/c":130,"P42/m m c":130,"P 42/m 2/c 2/m":131,"P42/m c m":131,"P 42/n 2/b 2/c":132,"P42/n b c":132,"P 42/n 2/n 2/m":133,"P42/n n m":133,"P 42/m 21/b 2/c":134,"P42/m b c":134,"P 42/m 21/n 2/m":135,"P42/m n m":135,"P 42/n 21/m 2/c":136,"P42/n m c":136,"P 42/n 21/c 2/m":137,"P42/n c m":137,"I 4/m 2/m 2/m":138,"I4/m m m":138,"I 4/m 2/c 2/m":139,"I4/m c m":139,"I 41/a 2/m 2/d":140,"I41/a m d":140,"I 41/a 2/c 2/d":141,"I41/a c d":141,"P 3":142,"P 31":143,"P 32":144,"H 3":145,"R 3":146,"P -3":147,"H -3":148,"R -3":149,"P 3 1 2":150,"P 3 2 1":151,"P 31 1 2":152,"P 31 2 1":153,"P 32 1 2":154,"P 32 2 1":155,"H 3 2":156,"R 3 2":157,"P 3 m 1":158,"P 3 1 m":159,"P 3 c 1":160,"P 3 1 c":161,"H 3 m":162,"R 3 m":163,"H 3 c":164,"R 3 c":165,"P -3 1 2/m":166,"P -3 1 m":166,"P -3 1 2/c":167,"P -3 1 c":167,"P -3 2/m 1":168,"P -3 m 1":168,"P -3 2/c 1":169,"P -3 c 1":169,"H -3 2/m":170,"H -3 m":170,"R -3 2/m":171,"R -3 m":171,"H -3 2/c":172,"H -3 c":172,"R -3 2/c":173,"R -3 c":173,"P 6":174,"P 61":175,"P 65":176,"P 62":177,"P 64":178,"P 63":179,"P -6":180,"P 6/m":181,"P 63/m":182,"P 6 2 2":183,"P 61 2 2":184,"P 65 2 2":185,"P 62 2 2":186,"P 64 2 2":187,"P 63 2 2":188,"P 6 m m":189,"P 6 c c":190,"P 63 c m":191,"P 63 m c":192,"P -6 m 2":193,"P -6 c 2":194,"P -6 2 m":195,"P -6 2 c":196,"P 6/m 2/m 2/m":197,"P 6/m m m":197,"P 6/m 2/c 2/c":198,"P 6/m c c":198,"P 63/m 2/c 2/m":199,"P 63/m c m":199,"P 63/m 2/m 2/c":200,"P 63/m m c":200,"P 2 3":201,"F 2 3":202,"I 2 3":203,"P 21 3":204,"I 21 3":205,"P 2/m -3":206,"P m -3":206,"P 2/n -3":207,"P n -3":207,"F 2/m -3":208,"F m -3":208,"F 2/d -3":209,"F d -3":209,"I 2/m -3":210,"I m -3":210,"P 21/a -3":211,"P a -3":211,"I 21/a -3":212,"I a -3":212,"P 4 3 2":213,"P 42 3 2":214,"F 4 3 2":215,"F 41 3 2":216,"I 4 3 2":217,"P 43 3 2":218,"P 41 3 2":219,"I 41 3 2":220,"P -4 3 m":221,"F -4 3 m":222,"I -4 3 m":223,"P -4 3 n":224,"F -4 3 c":225,"I -4 3 d":226,"P 4/m -3 2/m":227,"P m -3 m":227,"P 4/n -3 2/n":228,"P n -3 n":228,"P 42/m -3 2/n":229,"P m -3 n":229,"P 42/n -3 2/m":230,"P n -3 m":230,"F 4/m -3 2/m":231,"F m -3 m":231,"F 4/m -3 2/c":232,"F m -3 c":232,"F 41/d -3 2/m":233,"F d -3 m":233,"F 41/d -3 2/c":234,"F d -3 c":234,"I 4/m -3 2/m":235,"I m -3 m":235,"I 41/a -3 2/d":236,"I a -3 d":236,"P 1 1 2":237,"P 1 1 21":238,"B 1 1 2":239,"B 2":239,"A 1 2 1":240,"C 1 21 1":241,"I 1 2 1":242,"I 2":242,"I 1 21 1":243,"P 1 1 m":244,"P 1 1 b":245,"B 1 1 m":246,"B 1 1 b":247,"P 1 1 2/m":248,"P 1 1 21/m":249,"B 1 1 2/m":250,"P 1 1 2/b":251,"P 1 1 21/b":252,"P 1 21/n 1":253,"P 1 21/a 1":254,"B 1 1 2/b":255,"P 21 2 2":256,"P 2 21 2":257,"P 21 21 2 
139(a)":258,"P 21 2 21":259,"P 2 21 21":260,"C 2 2 21a)":261,"C 2 2 2a":262,"F 2 2 2a":263,"I 2 2 2a":264,"P 21/m 21/m 2/n a":265,"P 42 21 2a":266,"I 2 3a":267};function FE(e){if(e<146)return e+1;if(146===e)return 1146;if(e<149)return e+1-1;if(149===e)return 1148;if(e<157)return e+1-2;if(157===e)return 1155;if(e<163)return e+1-3;if(163===e)return 1160;if(e<165)return e+1-4;if(165===e)return 1161;if(e<171)return e+1-5;if(171===e)return 1166;if(e<173)return e+1-6;if(173===e)return 1167;if(e<237)return e+1-7;if(237===e)return 1003;if(238===e)return 1004;if(239===e)return 1005;if(240===e)return 2005;if(241===e)return 3005;if(242===e)return 4005;if(243===e)return 5005;if(244===e)return 1006;if(245===e)return 1007;if(246===e)return 1008;if(247===e)return 1009;if(248===e)return 1010;if(249===e)return 1011;if(250===e)return 1012;if(251===e)return 1013;if(252===e)return 1014;if(253===e)return 2014;if(254===e)return 3014;if(255===e)return 1015;if(256===e)return 1017;if(257===e)return 2017;if(258===e)return 1018;if(259===e)return 2018;if(260===e)return 3018;if(261===e)return 1020;if(262===e)return 1021;if(263===e)return 1022;if(264===e)return 1023;if(265===e)return 1059;if(266===e)return 1094;if(267===e)return 1197;throw Error(`unknown spacegroup index '${e}'`)}var LE,$E,UE,jE,zE,GE=function(){for(var e=Object.create(null),t=0,r=Object.keys(NE);t<r.length;t++){var n=r[t];e[NE[n]]=n}return e}(),VE=function(){for(var e=Object.create(null),t=0,r=Object.keys(NE);t<r.length;t++){var n=NE[r[t]];e[n]=FE(n)}return e}();function HE(){return HE.empty()}function qE(e,t,r,n){n=e[t],e[t]=e[r],e[r]=n}function WE(e,t){return(e=Math.abs(e))>(t=Math.abs(t))?(t/=e,e*Math.sqrt(1+t*t)):t>0?(e/=t,t*Math.sqrt(1+e*e)):0}function XE(){return XE.zero()}function YE(){return YE.zero()}(function(e){function t(t,r,n){var i=function(e){var t="number"==typeof e?function(e){switch(e){case 1146:return 146;case 1148:return 149;case 1155:return 157;case 1160:return 163;case 1161:return 165;case 1166:return 171;case 1167:return 173;case 1003:return 237;case 1004:return 238;case 1005:return 239;case 2005:return 240;case 3005:return 241;case 4005:return 242;case 5005:return 243;case 1006:return 244;case 1007:return 245;case 1008:return 246;case 1009:return 247;case 1010:return 248;case 1011:return 249;case 1012:return 250;case 1013:return 251;case 1014:return 252;case 2014:return 253;case 3014:return 254;case 1015:return 255;case 1017:return 256;case 2017:return 257;case 1018:return 258;case 2018:return 259;case 3018:return 260;case 1020:return 261;case 1021:return 262;case 1022:return 263;case 1023:return 264;case 1059:return 265;case 1094:return 266;case 1197:return 267}var t=0;return e>146&&++t,e>148&&++t,e>155&&++t,e>160&&++t,e>161&&++t,e>166&&++t,e>167&&++t,e-1+t}(e):NE[e];return void 0===t||void 0===GE[t]?-1:t}(t);if(i<0)return console.warn(`Unknown spacegroup '${t}', returning a 'P 1' with cellsize [1, 1, 1]`),e.Zero;var a=r[0]*r[1]*r[2],o=n[0],s=n[1],u=n[2],c=r[0],l=r[1],d=r[2],f=Math.cos(s),h=(Math.cos(o)-Math.cos(s)*Math.cos(u))/Math.sin(u),p=Math.sqrt(1-f*f-h*h),m=[c,0,0],g=[Math.cos(u)*l,Math.sin(u)*l,0],v=[f*d,h*d,p*d],y=Og.ofRows([[m[0],g[0],v[0],0],[0,g[1],v[1],0],[0,0,v[2],0],[0,0,0,1]]);return{index:i,size:r,volume:a,anglesInRadians:n,toFractional:Og.invert(Og.zero(),y),fromFractional:y}}e.Zero=t("P 1",Cg.create(1,1,1),Cg.create(Math.PI/2,Math.PI/2,Math.PI/2)),e.isZero=function(e){return!e||0===e.index&&1===e.size[0]&&1===e.size[1]&&1===e.size[1]},e.create=t})(LE||={}),function(e){function t(e){var t=BE[e.index].map(function(e){return r=OE[(t=RE[e])[0]],n=OE[t[1]],i=OE[t[2]],Og.ofRows([r,n,i,[0,0,0,1]]);var t,r,n,i});return{name:GE[e.index],num:VE[e.index],cell:e,operators:t}}e.ZeroP1=t(LE.Zero),e.create=t;var r=Cg(),n=Og();function i(e,t,i,a,o,s){return Cg.set(r,i,a,o),Og.fromTranslation(n,r),Og.mul(s,Og.mul(s,Og.mul(s,e.cell.fromFractional,n),e.operators[t]),e.cell.toFractional)}e.setOperatorMatrix=i,e.getSymmetryOperator=function(e,t,r,n,a){var o=i(e,t,r,n,a,Og.zero());return AE.create(`${t+1}_${5+r}${5+n}${5+a}`,o,{hkl:Cg.create(r,n,a),spgrOp:t})};var a=Cg(),o=Cg(),s=Cg(),u=Cg();function c(e,t,r){var n=[];if(e>0?n.push("+X"):e<0&&n.push("-X"),t>0?n.push("+Y"):t<0&&n.push("-Y"),r>0?n.push("+Z"):r<0&&n.push("-Z"),1===n.length)return"+"===n[0].charAt(0)?n[0].substr(1):n[0];if(2===n.length){var i=n[0].charAt(0),a=n[1].charAt(0);if("+"===i)return`${n[0].substr(1)}${n[1]}`;if("+"===a)return`${n[1].substr(1)}${n[0]}`}throw Error(`unknown rotation '${n}', ${e} ${t} ${r}`)}function l(e){switch(e){case.5:return"1/2";case 1/4:return"1/4";case 3/4:return"3/4";case 1/3:return"1/3";case 2/3:return"2/3";case 1/6:return"1/6";case 5/6:return"5/6"}return""}function d(e,t){return""===t?e:e.length>2?`${e}+${t}`:"-"===e.charAt(0)?`${t}${e}
139`:`${t}+${e}`}e.getSymmetryOperatorRef=function(e,t,n,i,c,l){var d=Og.zero();Cg.set(r,n,i,c),Cg.floor(a,l),Og.copy(d,e.operators[t]),Cg.floor(o,Cg.transformMat4(o,l,d)),Og.getTranslation(u,d),Cg.sub(u,u,o),Cg.add(u,u,a),Cg.add(u,u,r),Og.setTranslation(d,u),Og.mul(d,e.cell.fromFractional,d),Og.mul(d,d,e.cell.toFractional),Cg.sub(s,o,a);var f=n-s[0],h=i-s[1],p=c-s[2];return AE.create(`${t+1}_${5+f}${5+h}${5+p}`,d,{hkl:Cg.create(f,h,p),spgrOp:t})},e.getOperatorXyz=function(e){return[d(c(e[0],e[4],e[8]),l(e[12])),d(c(e[1],e[5],e[9]),l(e[13])),d(c(e[2],e[6],e[10]),l(e[14]))].join(",")}}($E||={}),function(e){e.add=function(e,t,r){e.squaredDistances[e.count]=r,e.indices[e.count++]=t},e.reset=function(e){e.count=0},e.create=function(){return{count:0,indices:[],squaredDistances:[]}},e.copy=function(e,t){for(var r=0;r<t.count;++r)e.indices[r]=t.indices[r],e.squaredDistances[r]=t.squaredDistances[r];return e.count=t.count,e}}(UE||={}),function(e){function t(){return{origin:Cg(),dirA:Cg(),dirB:Cg(),dirC:Cg()}}function r(e,t){return Cg.copy(e.origin,t.origin),Cg.copy(e.dirA,t.dirA),Cg.copy(e.dirB,t.dirB),Cg.copy(e.dirC,t.dirC),e}function n(e,t){return Cg.set(e,2*Cg.magnitude(t.dirA),2*Cg.magnitude(t.dirB),2*Cg.magnitude(t.dirC))}e.create=function(e,t,r,n){return{origin:e,dirA:t,dirB:r,dirC:n}},e.empty=t,e.copy=r,e.clone=function(e){return r(t(),e)},e.size=n;var i=Cg();e.volume=function(e){return n(i,e),i[0]*i[1]*i[2]},e.normalize=function(e,t){return Cg.copy(e.origin,t.origin),Cg.normalize(e.dirA,t.dirA),Cg.normalize(e.dirB,t.dirB),Cg.normalize(e.dirC,t.dirC),e};var a=Rg();e.transform=function(e,t,r){Cg.transformMat4(e.origin,t.origin,r);var n=Rg.directionTransform(a,r);return Cg.transformMat3(e.dirA,t.dirA,n),Cg.transformMat3(e.dirB,t.dirB,n),Cg.transformMat3(e.dirC,t.dirC,n),e},e.scale=function(e,t,r){return Cg.scale(e.dirA,t.dirA,r),Cg.scale(e.dirB,t.dirB,r),Cg.scale(e.dirC,t.dirC,r),e}}(HE||={}),function(e){e.create=function(e,t,r){void 0===r&&(r=Float32Array);var n=e*t;return{data:new r(n),size:n,cols:e,rows:t}},e.get=function(e,t,r){return e.data[e.rows*r+t]},e.set=function(e,t,r,n){return e.data[e.rows*r+t]=n,e},e.add=function(e,t,r,n){return e.data[e.rows*r+t]+=n,e},e.makeZero=function(e){return e.data.fill(0),e},e.clone=function(e){return{data:e.data.slice(),size:e.size,cols:e.cols,rows:e.rows}},e.fromArray=function(e,t,r){return{data:e,size:t*r,cols:t,rows:r}},e.transpose=function(e,t){if(e.cols!==t.rows||e.rows!==t.cols)throw Error("transpose: matrix dimensions incompatible");if(e.data===t.data)throw Error("transpose: matrices share memory");for(var r=t.rows,n=t.cols,i=t.data,a=e.data,o=0,s=0,u=0;o<r;u+=1,s+=n,++o)for(var c=u,l=0;l<n;c+=r,l++)a[c]=i[s+l];return e},e.multiplyABt=function(e,t,r){for(var n=t.cols,i=t.rows,a=r.rows,o=t.data,s=r.data,u=e.data,c=0,l=0,d=0;c<i;l+=n,c++)for(var f=0,h=0;h<a;d++,h++){for(var p=0,m=l,g=0;g<n;m++,f++,g++)p+=o[m]*s[f];u[d]=p}return e},e.meanRows=function(e){for(var t=e.rows,r=e.cols,n=e.data,i=Array(r),a=0;a<r;++a)i[a]=0;for(var o=0,s=0;o<t;++o)for(a=0;a<r;++a,++s)i[a]+=n[s];for(a=0;a<r;++a)i[a]/=t;return i},e.subRows=function(e,t){for(var r=e.rows,n=e.cols,i=e.data,a=0,o=0;a<r;++a)for(var s=0;s<n;++s,++o)i[o]-=t[s];return e}}(jE||={}),function(e){function t(e){if(3===e.length)return HE.create(Cg.fromArray(Cg(),e,0),Cg.create(1,0,0),Cg.create(0,1,0),Cg.create(0,0,1));var t=jE.fromArray(e,3,e.length/3),r=t.rows,n=r/3,i=jE.create(3,3),a=jE.create(1,3),o=jE.create(3,3),s=jE.create(3,3),u=jE.meanRows(t),c=jE.subRows(jE.clone(t),u),l=jE.transpose(jE.create(r,3),c);jE.multiplyABt(i,l,l),function(e,t,r,n){var i=0,a=0,o=e.rows,s=e.cols,u=o,c=s;u<c&&(i=1,a=u,u=c,c=a);var l=jE.create(u,u),d=jE.create(1,c),f=jE.create(c,c);if(0===i)jE.transpose(l,e);else{for(a=0;a<s*o;a++)l.data[a]=e.data[a];for(;a<c*u;a++)l.data[a]=0}if(function(e,t,r,n,i,a,o,s){for(var u=0,c=0,l=0,d=0,f=Math.max(a,30),h=0,p=0,m=0,g=0,v=0,y=0,b=0,_=0,x=0,S=0,w=0,A=0,C=0,T=0,P=0,E=0,M=0,k=4660,I=0,D=0,O=0,R=new Float64Array(o<<3);u<o;u++){for(l=0,w=0;l<a;l++)w+=(_=e[u*t+l])*_;if(R[u]=w,n){for(l=0;l<o;l++)n[u*i+l]=0;n[u*i+u]=1}}for(;d<f;d++){for(v=0,u=0;u<o-1;u++)for(c=u+1;c<o;c++){for(h=u*t|0,p=c*t|0,P=R[u],E=0,M=R[c],l=2,E+=e[h]*e[p],E+=e[h+1]*e[p+1];l<a;l++)E+=e[h+l]*e[p+l];
139if(!(Math.abs(E)<=2.384185792e-7*Math.sqrt(P*M))){for(C=WE(E*=2,A=P-M),A<0?(T=.5*(C-A),y=E/(C*(b=Math.sqrt(T/C))*2)):b=E/(C*(y=Math.sqrt((C+A)/(2*C)))*2),P=0,M=0,l=2,x=y*e[h]+b*e[p],S=-b*e[h]+y*e[p],e[h]=x,e[p]=S,P+=x*x,M+=S*S,x=y*e[h+1]+b*e[p+1],S=-b*e[h+1]+y*e[p+1],e[h+1]=x,e[p+1]=S,P+=x*x,M+=S*S;l<a;l++)x=y*e[h+l]+b*e[p+l],S=-b*e[h+l]+y*e[p+l],e[h+l]=x,e[p+l]=S,P+=x*x,M+=S*S;if(R[u]=P,R[c]=M,v=1,n)for(g=c*i|0,l=2,x=y*n[m=u*i|0]+b*n[g],S=-b*n[m]+y*n[g],n[m]=x,n[g]=S,x=y*n[m+1]+b*n[g+1],S=-b*n[m+1]+y*n[g+1],n[m+1]=x,n[g+1]=S;l<o;l++)x=y*n[m+l]+b*n[g+l],S=-b*n[m+l]+y*n[g+l],n[m+l]=x,n[g+l]=S}}if(0===v)break}for(u=0;u<o;u++){for(l=0,w=0;l<a;l++)w+=(_=e[u*t+l])*_;R[u]=Math.sqrt(w)}for(u=0;u<o-1;u++){for(c=u,l=u+1;l<o;l++)R[c]<R[l]&&(c=l);if(u!==c&&(qE(R,u,c,w),n)){for(l=0;l<a;l++)qE(e,u*t+l,c*t+l,_);for(l=0;l<o;l++)qE(n,u*i+l,c*i+l,_)}}for(u=0;u<o;u++)r[u]=R[u];if(n)for(u=0;u<s;u++){for(w=u<o?R[u]:0;w<=1e-37;){for(D=1/a,l=0;l<a;l++)I=256&(k=214013*k+2531011)>>16?D:-D,e[u*t+l]=I;for(d=0;d<2;d++)for(c=0;c<u;c++){for(w=0,l=0;l<a;l++)w+=e[u*t+l]*e[c*t+l];for(O=0,l=0;l<a;l++)_=e[u*t+l]-w*e[c*t+l],e[u*t+l]=_,O+=Math.abs(_);for(O=O?1/O:0,l=0;l<a;l++)e[u*t+l]*=O}for(w=0,l=0;l<a;l++)w+=(_=e[u*t+l])*_;w=Math.sqrt(w)}for(b=1/w,l=0;l<a;l++)e[u*t+l]*=b}}(l.data,u,d.data,f.data,c,u,c,u),t){for(a=0;a<c;a++)t.data[a]=d.data[a];for(;a<s;a++)t.data[a]=0}0===i?(r&&jE.transpose(r,l),n&&jE.transpose(n,f)):(r&&jE.transpose(r,f),n&&jE.transpose(n,l))}(i,a,o,s);var d=Cg.create(u[0],u[1],u[2]),f=Cg.create(o.data[0],o.data[3],o.data[6]),h=Cg.create(o.data[1],o.data[4],o.data[7]),p=Cg.create(o.data[2],o.data[5],o.data[8]);return Cg.scale(f,f,Math.sqrt(a.data[0]/n)),Cg.scale(h,h,Math.sqrt(a.data[1]/n)),Cg.scale(p,p,Math.sqrt(a.data[2]/n)),HE.create(d,f,h,p)}function r(e){var t=HE.clone(e);return Cg.magnitude(t.dirC)<vg&&Cg.cross(t.dirC,t.dirA,t.dirB),HE.normalize(t,t)}e.ofPositions=function(e){var r=t(e);return{momentsAxes:r,boxAxes:i(e,r)}},e.calculateMomentsAxes=t,e.calculateNormalizedAxes=r;var n=Cg();function i(e,t){if(3===e.length)return HE.clone(t);for(var i=-1/0,a=-1/0,o=-1/0,s=-1/0,u=-1/0,c=-1/0,l=Cg(),d=Cg(),f=t.origin,h=r(t),p=0,m=e.length;p<m;p+=3){Cg.projectPointOnVector(l,Cg.fromArray(l,e,p),h.dirA,f);var g=Cg.dot(h.dirA,Cg.normalize(d,Cg.sub(d,l,f))),v=Cg.distance(l,f);g>0?v>i&&(i=v):v>a&&(a=v),Cg.projectPointOnVector(l,Cg.fromArray(l,e,p),h.dirB,f);var y=Cg.dot(h.dirB,Cg.normalize(d,Cg.sub(d,l,f))),b=Cg.distance(l,f);y>0?b>o&&(o=b):b>s&&(s=b),Cg.projectPointOnVector(l,Cg.fromArray(l,e,p),h.dirC,f);var _=Cg.dot(h.dirC,Cg.normalize(d,Cg.sub(d,l,f))),x=Cg.distance(l,f);_>0?x>u&&(u=x):x>c&&(c=x)}var S=Cg.setMagnitude(Cg(),h.dirA,(i+a)/2),w=Cg.setMagnitude(Cg(),h.dirB,(o+s)/2),A=Cg.setMagnitude(Cg(),h.dirC,(u+c)/2),C=Cg.isFinite(S),T=Cg.isFinite(w),P=Cg.isFinite(A),E=Cg(),M=function(e,t,r){Cg.copy(n,f),C&&Cg.scaleAndAdd(n,n,h.dirA,e),T&&Cg.scaleAndAdd(n,n,h.dirB,t),P&&Cg.scaleAndAdd(n,n,h.dirC,r),Cg.add(E,E,n)};return M(i,o,u),M(i,o,-c),M(i,-s,-c),M(i,-s,u),M(-a,-s,-c),M(-a,-s,u),M(-a,o,u),M(-a,o,-c),Cg.scale(E,E,1/8),HE.create(E,S,w,A)}e.calculateBoxAxes=i}(zE||={}),function(e){function t(e){return void 0!==e.extrema}function r(e,t){return{center:e,radius:t}}function n(e,t){var r;return void 0===e.extrema?e.extrema=t:(e.extrema.length=0,(r=e.extrema).push.apply(r,t)),e}e.hasExtrema=t,e.create=r,e.zero=function(){return{center:Cg(),radius:0}},e.clone=function(e){var n=r(Cg.clone(e.center),e.radius);return t(e)&&(n.extrema=e.extrema.map(function(e){return Cg.clone(e)})),n},e.set=function(e,t,r){return Cg.copy(e.center,t),e.radius=r,e},e.copy=function(e,r){return Cg.copy(e.center,r.center),e.radius=r.radius,t(r)&&n(e,r.extrema.map(function(e){return Cg.clone(e)})),e},e.setExtrema=n,e.computeBounding=function(e){for(var t=e.x,r=e.y,n=e.z,i=e.indices,a=0,o=0,s=0,u=0,c=kP.size(i),l=0;l<c;l++)a+=t[d=kP.getAt(i,l)],o+=r[d],s+=n[d];for(c>0&&(a/=c,o/=c,s/=c),l=0;l<c;l++){var d,f=t[d=kP.getAt(i,l)]-a,h=r[d]-o,p=n[d]-s,m=f*f+h*h+p*p;m>u&&(u=m)}return{center:Cg.create(a,o,s),radius:Math.sqrt(u)}},e.transform=function(e,r,i){return Cg.transformMat4(e.center,r.center,i),e.radius=r.radius*Og.getMaxScaleOnAxis(i),t(r)&&n(e,r.extrema.map(function(e){return Cg.transformMat4(Cg(),e,i)}
139)),e},e.translate=function(e,r,i){return Cg.add(e.center,r.center,i),t(r)&&n(e,r.extrema.map(function(e){return Cg.add(Cg(),e,i)})),e},e.toArray=function(e,t,r){return Cg.toArray(e.center,t,r),t[r+3]=e.radius,t},e.fromArray=function(e,t,r){return Cg.fromArray(e.center,t,r),e.radius=t[r+3],e},e.fromBox3D=function(t,r){return Cg.scale(t.center,Cg.add(t.center,r.max,r.min),.5),t.radius=Cg.distance(t.center,r.max),e.setExtrema(t,[Cg.create(r.min[0],r.min[1],r.min[2]),Cg.create(r.max[0],r.max[1],r.max[2]),Cg.create(r.max[0],r.min[1],r.min[2]),Cg.create(r.min[0],r.max[1],r.max[2]),Cg.create(r.min[0],r.min[1],r.max[2]),Cg.create(r.max[0],r.min[1],r.max[2]),Cg.create(r.max[0],r.max[1],r.min[2]),Cg.create(r.min[0],r.max[1],r.min[2])]),t},e.fromAxes3D=function(e,t){return Cg.copy(e.center,t.origin),e.radius=Math.max(Cg.magnitude(t.dirA),Cg.magnitude(t.dirB),Cg.magnitude(t.dirC)),e};var i=Cg();e.fromDimensionsAndTransform=function(t,r,n){var a=r[0],o=r[1],s=r[2],u=Cg.create(0,0,0);Cg.transformMat4(u,u,n);var c=Cg.create(a,o,s);Cg.transformMat4(c,c,n);var l=Cg.create(a,0,0);Cg.transformMat4(l,l,n);var d=Cg.create(0,o,s);Cg.transformMat4(d,d,n);var f=Cg.create(0,0,s);Cg.transformMat4(f,f,n);var h=Cg.create(a,0,s);Cg.transformMat4(h,h,n);var p=Cg.create(a,o,0);Cg.transformMat4(p,p,n);var m=Cg.create(0,o,0);Cg.transformMat4(m,m,n),Cg.add(i,u,c),Cg.scale(i,i,.5);var g=Math.max(Cg.distance(u,c),Cg.distance(l,d));return e.set(t,i,g/2),e.setExtrema(t,[u,c,l,d,f,h,p,m]),t};var a=Cg();e.addVec3=function(t,r,n){return Cg.distance(r.center,n)<r.radius?e.copy(t,r):(Cg.sub(a,r.center,n),Cg.sub(a,r.center,a),Cg.setMagnitude(a,a,r.radius),Cg.scale(t.center,Cg.add(a,a,n),.5),t.radius=Cg.distance(t.center,n),t)},e.expandBySphere=function(e,r,i){return Cg.copy(e.center,r.center),e.radius=Math.max(r.radius,Cg.distance(r.center,i.center)+i.radius),t(r)&&t(i)&&n(e,kc(kc([],r.extrema.map(function(e){return Cg.clone(e)}),!0),i.extrema.map(function(e){return Cg.clone(e)}),!0)),e};var o=Cg();e.expand=function(e,r,i){if(Cg.copy(e.center,r.center),e.radius=r.radius+i,r.radius<1e-12||(r.extrema?.length??0)<=1)return e.extrema=void 0,e;if(t(r)){for(var a=new Float32Array(3*r.extrema.length),s=0;s<r.extrema.length;s++)Cg.toArray(r.extrema[s],a,3*s);var u=zE.calculateMomentsAxes(a);HE.scale(u,HE.normalize(u,u),i),n(e,r.extrema.map(function(t){Cg.normalize(o,Cg.sub(o,t,r.center));var n=Cg.clone(t),i=Cg.dot(o,u.dirA)<0?-1:1;Cg.scaleAndAdd(n,n,u.dirA,i);var a=Cg.dot(o,u.dirB)<0?-1:1;Cg.scaleAndAdd(n,n,u.dirB,a);var s=Cg.dot(o,u.dirC)<0?-1:1;return Cg.scaleAndAdd(n,n,u.dirC,s),Cg.distance(e.center,n)>e.radius&&(r.extrema.length>=14&&Cg.normalize(o,Cg.sub(o,n,r.center)),Cg.scaleAndAdd(n,e.center,o,e.radius)),n}))}return e},e.exactEquals=function(e,t){return e.radius===t.radius&&Cg.exactEquals(e.center,t.center)},e.equals=function(e,t){var r=e.radius,n=t.radius;return Math.abs(r-n)<=vg*Math.max(1,Math.abs(r),Math.abs(n))&&Cg.equals(e.center,t.center)},e.includes=function(e,r){if(t(r)){for(var n=0,i=r.extrema;n<i.length;n++){var a=i[n];if(Cg.distance(e.center,a)>e.radius)return!1}return!0}return Cg.distance(e.center,r.center)+r.radius<=e.radius},e.overlaps=function(e,t){return Cg.distance(e.center,t.center)<=e.radius+t.radius},e.distance=function(e,t){return Cg.distance(e.center,t.center)-e.radius+t.radius},e.distanceToVec=function(e,t){var r=e.center,n=e.radius;return Cg.distance(t,r)-n}}(XE||={}),function(e){function t(){return{min:Cg(),max:Cg()}}function r(e,t){return Cg.copy(e.min,t.min),Cg.copy(e.max,t.max),e}e.create=function(e,t){return{min:e,max:t}},e.zero=t,e.copy=r,e.clone=function(e){return r(t(),e)};var n=Cg();function i(e,t){for(var r=0,n=t.length;r<n;r++)c(e,t[r]);return e}function a(e,t){return u(e),i(e,t),e}function o(e,t){return Cg.sub(e,t.max,t.min)}e.fromSphere3D=function(e,t){return XE.hasExtrema(t)&&t.extrema.length>=14?a(e,t.extrema):(Cg.set(n,t.radius,t.radius,t.radius),Cg.sub(e.min,t.center,n),Cg.add(e.max,t.center,n),e)},e.addVec3Array=i,e.fromVec3Array=a,e.addSphere3D=function(e,t){return XE.hasExtrema(t)&&t.extrema.length>=14?i(e,t.extrema):(c(e,Cg.subScalar(n,t.center,t.radius)),c(e,Cg.addScalar(n,t.center,t.radius)),e)},e.intersectsSphere3D=function(e,t){return Cg.clamp(n,t.center,e.min,e.max),Cg.squaredDistance(n,t.center)<=t.radius*t.radius},e.computeBounding=function(e){for(var t=Cg.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=Cg.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),n=e.x,i=e.y,a=e.z,o=e.indices,s=0,u=kP.size(o);s<u;s++){var c=kP.getAt(o,s);t[0]=Math.min(n[c],t[0]),t[1]=Math.min(i[c],t[1]),t[2]=Math.min(a[c],t[2]),r[0]=Math.max(n[c],r[0]),r[1]=Math.max(i[c],r[1]),r[2]=Math.max(a[c],r[2])}return{min:t,max:r}},e.size=o;var s=Cg();function u(e){return Cg.set(e.min,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),Cg.set(e.max,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),e}function c(e,t){return Cg.min(e.min,e.min,t),Cg.max(e.max,e.max,t),e}e.volume=function(e){return o(s,e),s[0]*s[1]*s[2]},e.setEmpty=u,e.add=c,e.expand=function(e,t,r){return Cg.sub(e.min,t.min,r),Cg.add(e.max,t.max,r),e},e.scale=function(e,t,r){return Cg.scale(e.min,t.min,r),Cg.scale(e.max,t.max,r),e};var l=Cg();e.transform=function(e,t,r){var n=t.min,i=n[0],a=n[1],o=n[2],s=t.max,d=s[0],f=s[1],h=s[2];return u(e),c(e,Cg.transformMat4(l,Cg.set(l,i,a,o),r)),c(e,Cg.transformMat4(l,Cg.set(l,i,a,h),r)),c(e,Cg.transformMat4(l,Cg.set(l,i,f,o),r)),c(e,Cg.transformMat4(l,Cg.set(l,i,f,h),r)),c(e,Cg.transformMat4(l,Cg.set(l,d,a,o),r)),c(e,Cg.transformMat4(l,Cg.set(l,d,a,h),r)),c(e,Cg.transformMat4(l,Cg.set(l,d,f,o),r)),c(e,Cg.transformMat4(l,Cg.set(l,d,f,h),r)),e},e.containsVec3=function(e,t){return!(t[0]<e.min[0]||t[0]>e.max[0]||t[1]<e.min[1]||t[1]>e.max[1]||t[2]<e.min[2]||t[2]>e.max[2])},e.overlaps=function(e,t){return!(e.max[0]<t.min[0]||e.min[0]>t.max[0]||e.max[1]<t.min[1]||e.min[1]>t.max[1]||e.max[2]<t.min[2]||e.min[2]>t.max[2])},e.containsSphere3D=function(e,t){var r=t.center,n=t.radius;return!(r[0]-n<e.min[0]||r[0]+n>e.max[0]||r[1]-n<e.min[1]||r[1]+n>e.max[1]||r[2]-n<e.min[2]||r[2]+n>e.max[2])},e.nearestIntersectionWithRay=function(e,t,r,n){var i,a,o,s=t.min,u=s[0],c=s[1],l=s[2],d=t.max,f=d[0],h=d[1],p=d[2],m=r[0],g=r[1],v=r[2],y=1/n[0],b=1/n[1],_=1/n[2];return(a=b>=0?(c-g)*b:(h-g)*b)>(i=y>=0?(u-m)*y:(f-m)*y)&&(i=a),(o=_>=0?(l-v)*_:(p-v)*_)>i&&(i=o),Cg.scale(e,n,i),Cg.set(e,e[0]+m,e[1]+g,e[2]+v)}}(YE||={});var KE=function(e,t){this.parent=null,this.child=null,this.degree=0,this.isMarked=!1,this.key=e,this.value=t,this.prev=this,this.next=this},ZE=new(function(){function e(e){if(this._index=-1,this._items=[],this._len=0,e){var t=e,r=0;do{this._items[r++]=t,t=t.next}
139while(e!==t);this._len=r}}return e.prototype.hasNext=function(){return this._index<this._len-1},e.prototype.next=function(){return this._items[++this._index]},e.prototype.reset=function(e){this._index=-1,this._len=0;var t=e,r=0;do{this._items[r++]=t,t=t.next}while(e!==t);this._len=r},e}()),QE=function(){function e(e){this._minNode=null,this._nodeCount=0,this._compare=e||this._defaultCompare}return e.prototype.clear=function(){this._minNode=null,this._nodeCount=0},e.prototype.decreaseKey=function(e,t){if(!e)throw Error("Cannot decrease key of non-existent node");if(this._compare({key:t},{key:e.key})>0)throw Error("New key is larger than old key");e.key=t;var r=e.parent;r&&this._compare(e,r)<0&&(this._cut(e,r,this._minNode),this._cascadingCut(r,this._minNode)),this._compare(e,this._minNode)<0&&(this._minNode=e)},e.prototype.delete=function(e){var t=e.parent;t&&(this._cut(e,t,this._minNode),this._cascadingCut(t,this._minNode)),this._minNode=e,this.extractMinimum()},e.prototype.extractMinimum=function(){var e=this._minNode;if(e){if(e.child){var t=e.child;do{t.parent=null,t=t.next}while(t!==e.child)}var r=null;e.next!==e&&(r=e.next),this._removeNodeFromList(e),this._nodeCount--,this._minNode=this._mergeLists(r,e.child),this._minNode&&=this._consolidate(this._minNode)}return e},e.prototype.findMinimum=function(){return this._minNode},e.prototype.insert=function(e,t){var r=new KE(e,t);return this._minNode=this._mergeLists(this._minNode,r),this._nodeCount++,r},e.prototype.isEmpty=function(){return null===this._minNode},e.prototype.size=function(){return null===this._minNode?0:this._getNodeListSize(this._minNode)},e.prototype.union=function(e){this._minNode=this._mergeLists(this._minNode,e._minNode),this._nodeCount+=e._nodeCount},e.prototype._defaultCompare=function(e,t){return e.key>t.key?1:e.key<t.key?-1:0},e.prototype._cut=function(e,t,r){e.parent=null,t.degree--,e.next===e?t.child=null:t.child=e.next,this._removeNodeFromList(e);var n=this._mergeLists(r,e);return e.isMarked=!1,n},e.prototype._cascadingCut=function(e,t){var r=e.parent;return r&&(e.isMarked?(t=this._cut(e,r,t),t=this._cascadingCut(r,t)):e.isMarked=!0),t},e.prototype._consolidate=function(e){var t=[];for(ZE.reset(e);ZE.hasNext();){for(var r=ZE.next(),n=t[r.degree];n;){if(this._compare(r,n)>0){var i=r;r=n,n=i}this._linkHeaps(n,r),t[r.degree]=null,r.degree++,n=t[r.degree]}t[r.degree]=r}for(var a=null,o=0;o<t.length;o++){var s=t[o];s&&(s.next=s,s.prev=s,a=this._mergeLists(a,s))}return a},e.prototype._removeNodeFromList=function(e){var t=e.prev,r=e.next;t.next=r,r.prev=t,e.next=e,e.prev=e},e.prototype._linkHeaps=function(e,t){this._removeNodeFromList(e),t.child=this._mergeLists(e,t.child),e.parent=t,e.isMarked=!1},e.prototype._mergeLists=function(e,t){if(!e)return t||null;if(!t)return e;var r=e.next;return e.next=t.next,e.next.prev=e,t.next=r,t.next.prev=t,this._compare(e,t)<0?e:t},e.prototype._getNodeListSize=function(e){var t=0,r=e;do{t++,r.child&&(t+=this._getNodeListSize(r.child)),r=r.next}while(r!==e);return t},e}();function JE(e,t,r){return new eM(e,t,r)}var eM=function(){function e(e,t,r){var n=function(e,t,r){var n,i,a=YE.expand(YE(),t.box,Cg.create(.5,.5,.5)),o=e.indices,s=YE.size(Cg(),a),u=kP.size(o),c="number"==typeof r?r:32,l=Array.isArray(r)&&r;if(l&&!Cg.isZero(l))i=[Math.ceil(s[0]/l[0]),Math.ceil(s[1]/l[1]),Math.ceil(s[2]/l[2])],n=l;else if(u>0){var d=(Math.ceil(u/c)/(s[0]*s[1]*s[2]))**(1/3);i=[Math.ceil(s[0]*d),Math.ceil(s[1]*d),Math.ceil(s[2]*d)],n=[s[0]/i[0],s[1]/i[1],s[2]/i[2]]}else n=s,i=[1,1,1];return function(e){for(var t=e.expandedBox,r=e.size,n=r[0],i=r[1],a=r[2],o=e.data,s=o.x,u=o.y,c=o.z,l=o.radius,d=o.indices,f=e.elementCount,h=e.delta,p=n*i*a,m=t.min,g=m[0],v=m[1],y=m[2],b=0,_=0,x=new Uint32Array(p),S=new Int32Array(f),w=0;w<f;w++){var A=kP.getAt(d,w),C=(Math.floor((s[A]-g)/h[0])*i+Math.floor((u[A]-v)/h[1]))*a+Math.floor((c[A]-y)/h[2]);1===(x[C]+=1)&&(_+=1),S[w]=C}if(l)for(w=0;w<f;w++)l[A=kP.getAt(d,w)]>b&&(b=l[A]);for(var T=new Int32Array(_),P=(A=0,0);A<p;A++){var E=x[A];E>0&&(x[A]=P+1,T[P]=E,P+=1)}var M=new Uint32Array(_);for(A=1;A<_;++A)M[A]+=M[A-1]+T[A-1];var k=new Int32Array(_),I=new Int32Array(f);for(A=0;A<f;A++){var D=x[S[A]];if(D>0){var O=D-1;I[M[O]+k[O]]=A,k[O]+=1}}
139return{size:e.size,bucketArray:I,bucketCounts:T,bucketOffset:M,grid:x,delta:h,min:e.expandedBox.min,data:e.data,maxRadius:b,expandedBox:e.expandedBox,boundingBox:e.boundingBox,boundingSphere:e.boundingSphere}}({size:i,data:{x:e.x,y:e.y,z:e.z,indices:o,radius:e.radius},expandedBox:a,boundingBox:t.box,boundingSphere:t.sphere,elementCount:u,delta:n})}(e,t,r);this.ctx={grid:n,x:.1,y:.1,z:.1,k:1,stopIf:void 0,radius:.1,isCheck:!1},this.boundary={box:n.boundingBox,sphere:n.boundingSphere},this.buckets={offset:n.bucketOffset,count:n.bucketCounts,array:n.bucketArray},this.result=UE.create()}return e.prototype.find=function(e,t,r,n,i){this.ctx.x=e,this.ctx.y=t,this.ctx.z=r,this.ctx.radius=n,this.ctx.isCheck=!1;var a=i??this.result;return tM(this.ctx,a),a},e.prototype.nearest=function(e,t,r,n,i,a){void 0===n&&(n=1),this.ctx.x=e,this.ctx.y=t,this.ctx.z=r,this.ctx.k=n,this.ctx.stopIf=i;var o=a??this.result;return function(e,t){var r=e.grid,n=r.min,i=r.expandedBox,a=r.boundingSphere.center,o=r.size,s=o[0],u=o[1],c=o[2],l=r.bucketOffset,d=r.bucketCounts,f=r.bucketArray,h=r.grid,p=r.data,m=p.x,g=p.y,v=p.z,y=p.indices,b=p.radius,_=r.delta,x=r.maxRadius,S=e.x,w=e.y,A=e.z,C=e.k,T=e.stopIf,P=kP.size(y);if(UE.reset(t),0===P||C<=0)return!1;var E,M,k,I,D=!1,O=1,R=!0,B=0,N=oM,F=sM,L=0,$=!0,U=!1,j=uM,z=x*x;
139N.length=0,j.length=0,iM.clear(),cM.clear(),Cg.set(nM,S,w,A),YE.containsVec3(i,nM)?(E=Math.floor((S-n[0])/_[0]),M=Math.floor((w-n[1])/_[1]),k=Math.floor((A-n[2])/_[2])):(YE.nearestIntersectionWithRay(nM,i,nM,Cg.normalize(rM,Cg.sub(rM,a,nM))),E=Math.max(0,Math.min(s-1,Math.floor((nM[0]-n[0])/_[0]))),M=Math.max(0,Math.min(u-1,Math.floor((nM[1]-n[1])/_[1]))),k=Math.max(0,Math.min(c-1,Math.floor((nM[2]-n[2])/_[2]))));var G=0===x?1:Math.max(1,Math.min(s-1,Math.ceil(x/_[0]))),V=0===x?1:Math.max(1,Math.min(u-1,Math.ceil(x/_[1]))),H=0===x?1:Math.max(1,Math.min(c-1,Math.ceil(x/_[2])));for(N.push(E,M,k,(E*u+M)*c+k);t.count<P;){for(var q=4*O,W=0;W<q;W+=4)if(I=N[W+3],!iM.has(I)){iM.add(I),U=iM.size>=h.length;var X=h[I];if(0!==X){for(var Y=L,K=X-1,Z=l[K],Q=Z+d[K],J=Z;J<Q;J++){var ee=f[J],te=kP.getAt(y,ee),re=m[te]-S,ne=g[te]-w,ie=v[te]-A,ae=re*re+ne*ne+ie*ie;if(0!==x){var oe=b[te];ae-=oe*oe}$&&ae>L&&(L=ae),cM.insert(ae,ee)}Y<L&&($=!1)}}for(F.length=0,B=0,aM.clear(),W=0;W<q;W+=4){E=N[W],M=N[W+1],k=N[W+2];for(var se=-G;se<=G;se++){var ue=E+se;if(!(ue<0||ue>=s))for(var ce=-V;ce<=V;ce++){var le=M+ce;if(!(le<0||le>=u))for(var de=-H;de<=H;de++){var fe=k+de;if(!(fe<0||fe>=c||(I=(ue*u+le)*c+fe,aM.has(I)||(aM.add(I),iM.has(I))))){if(!R){var he=n[0]+ue*_[0]-S,pe=n[1]+le*_[1]-w,me=n[2]+fe*_[2]-A;if(he*he+pe*pe+me*me-z>L){j.push(ue,le,fe,I);continue}}F.push(ue,le,fe,I),B++}}}}}if(R=!1,0===B){if(1===C){if(be=cM.findMinimum()){var ge=be,ve=ge.key,ye=ge.value;return UE.add(t,ye,ve),!0}}else for(;!cM.isEmpty()&&(U||cM.findMinimum().key<=L)&&t.count<C;){var be;ve=(be=cM.extractMinimum()).key,ye=be.value,UE.add(t,ye,ve),T&&!D&&(D=T(ye,ve))}if(t.count>=C||D||t.count>=P)return t.count>0;if(R=!0,$=!0,j.length>0){J=0;for(var _e=j.length;J<_e;J++)N.push(j[J]);j.length=0,O=N.length}}else{var xe=N;N=F,F=xe,O=B}}t.count}(this.ctx,o),o},e.prototype.check=function(e,t,r,n){return this.ctx.x=e,this.ctx.y=t,this.ctx.z=r,this.ctx.radius=n,this.ctx.isCheck=!0,tM(this.ctx,this.result)},e}();function tM(e,t){var r=e.grid,n=r.min,i=r.size,a=i[0],o=i[1],s=i[2],u=r.bucketOffset,c=r.bucketCounts,l=r.bucketArray,d=r.grid,f=r.data,h=f.x,p=f.y,m=f.z,g=f.indices,v=f.radius,y=r.delta,b=r.maxRadius,_=e.radius,x=e.isCheck,S=e.x,w=e.y,A=e.z,C=_+b,T=C*C;UE.reset(t);var P=Math.max(0,Math.floor((S-C-n[0])/y[0])),E=Math.max(0,Math.floor((w-C-n[1])/y[1])),M=Math.max(0,Math.floor((A-C-n[2])/y[2])),k=Math.min(a-1,Math.floor((S+C-n[0])/y[0])),I=Math.min(o-1,Math.floor((w+C-n[1])/y[1])),D=Math.min(s-1,Math.floor((A+C-n[2])/y[2]));if(P>k||E>I||M>D)return!1;for(var O=P;O<=k;O++)for(var R=E;R<=I;R++)for(var B=M;B<=D;B++){var N=d[(O*o+R)*s+B];if(0!==N)for(var F=N-1,L=u[F],$=L+c[F],U=L;U<$;U++){var j=kP.getAt(g,l[U]),z=h[j]-S,G=p[j]-w,V=m[j]-A,H=z*z+G*G+V*V;if(H<=T){if(b>0&&Math.sqrt(H)-v[j]>_)continue;if(x)return!0;UE.add(t,l[U],H)}}}return t.count>0}var rM=Cg(),nM=Cg(),iM=new Set,aM=new Set,oM=[.1],sM=[.1],uM=[.1],cM=new QE,lM=Cg();function dM(e,t,r,n){for(var i=0,a=3*n;i<a;i+=3)Cg.fromArray(lM,t,r+i),Cg.transformMat4(lM,lM,e),Cg.toArray(lM,t,r+i)}var fM=Cg(),hM=Cg(),pM=Cg(),mM=Cg(),gM=Cg();function vM(e,t,r,n,i){for(var a=0,o=3*i;a<o;a+=3){var s=3*t[a],u=3*t[a+1],c=3*t[a+2];Cg.fromArray(fM,e,s),Cg.fromArray(hM,e,u),Cg.fromArray(pM,e,c),Cg.sub(mM,pM,hM),Cg.sub(gM,fM,hM),Cg.cross(mM,mM,gM),r[s]+=mM[0],r[s+1]+=mM[1],r[s+2]+=mM[2],r[u]+=mM[0],r[u+1]+=mM[1],r[u+2]+=mM[2],r[c]+=mM[0],r[c+1]+=mM[1],r[c+2]+=mM[2]}return function(e,t){for(var r=0,n=3*t;r<n;r+=3){var i=e[r],a=e[r+1],o=e[r+2],s=1/Math.sqrt(i*i+a*a+o*o);e[r]=i*s,e[r+1]=a*s,e[r+2]=o*s}return e}(r,n)}function yM(e,t,r){void 0===r&&(r=1);for(var n=Nb(e),i=new Int32Array(n+2),a=new Int32Array(t),o=new Int32Array(t),s=0,u=t*r;s<u;s+=r)++o[e[s]];var c=0;for(s=0;s<t;s++)i[s]=c,c+=o[s];i[t]=c;var l=new Int32Array(c);for(s=0,u=t*r;s<u;s+=r){var d=e[s];l[i[d]+a[d]]=s,++a[d]}return{indices:l,offsets:i}}var bM=Cg.add,_M=Cg.squaredDistance,xM=Cg.distance,SM=function(){function e(){this.count=0,this.center=Cg(),this.radiusSq=0}return e.prototype.reset=function(){Cg.set(this.center,0,0,0),this.radiusSq=0,this.count=0},e.prototype.includeStep=function(e){bM(this.center,this.center,e),this.count++},e.prototype.finishedIncludeStep=function(){0!==this.count&&Cg.scale(this.center,this.center,1/this.count)}
139,e.prototype.radiusStep=function(e){var t=_M(e,this.center);t>this.radiusSq&&(this.radiusSq=t)},e.prototype.radiusSphereStep=function(e,t){var r=xM(e,this.center)+t,n=r*r;n>this.radiusSq&&(this.radiusSq=n)},e.prototype.getSphere=function(e){return e||=XE(),Cg.copy(e.center,this.center),e.radius=Math.sqrt(this.radiusSq),e},e.prototype.getCount=function(){return this.count},e}();!function(e){var t=new e,r=Cg(),n=Cg();e.fromArrays=function(e,n){var i=e.x,a=e.y,o=e.z;t.reset();for(var s=i.length,u=0;u<s;u++)Cg.set(r,i[u],a[u],o[u]),t.includeStep(r);for(t.finishedIncludeStep(),u=0;u<s;u++)Cg.set(r,i[u],a[u],o[u]),t.radiusStep(r);return Cg.copy(n.center,t.center),n.radius=Math.sqrt(t.radiusSq),n},e.fromProvider=function(e,n,i){t.reset();for(var a=0;a<e;a++)n(a,r),t.includeStep(r);for(t.finishedIncludeStep(),a=0;a<e;a++)n(a,r),t.radiusStep(r);return Cg.copy(i.center,t.center),i.radius=Math.sqrt(t.radiusSq),i},e.fromPairProvider=function(e,i,a){t.reset();for(var o=0;o<e;o++)i(o,r,n),t.includeStep(r),t.includeStep(n);for(t.finishedIncludeStep(),o=0;o<e;o++)i(o,r,n),t.radiusStep(r),t.radiusStep(n);return Cg.copy(a.center,t.center),a.radius=Math.sqrt(t.radiusSq),a}}(SM||={});var wM=Cg.dot,AM=Cg.copy,CM=Cg.scaleAndSub,TM=Cg.scaleAndAdd,PM=function(){function e(e){this.minDist=[],this.maxDist=[],this.extrema=[],this.centroidHelper=new SM,this.dir=function(e){var t;switch(e){case"6":t=kc([],EM,!0);break;case"14":t=kc(kc([],EM,!0),MM,!0);break;case"26":t=kc(kc(kc([],EM,!0),MM,!0),kM,!0);break;case"98":t=kc(kc(kc(kc(kc(kc([],EM,!0),MM,!0),kM,!0),IM,!0),DM,!0),OM,!0)}return t.map(function(e){var t=Cg.create(e[0],e[1],e[2]);return Cg.normalize(t,t)})}(e),this.dirLength=this.dir.length,this.reset()}return e.prototype.computeExtrema=function(e,t){var r=wM(this.dir[e],t);r<this.minDist[e]&&(this.minDist[e]=r,AM(this.extrema[2*e],t)),r>this.maxDist[e]&&(this.maxDist[e]=r,AM(this.extrema[2*e+1],t))},e.prototype.computeSphereExtrema=function(e,t,r){var n=this.dir[e],i=wM(n,t);i-r<this.minDist[e]&&(this.minDist[e]=i-r,CM(this.extrema[2*e],t,n,r)),i+r>this.maxDist[e]&&(this.maxDist[e]=i+r,TM(this.extrema[2*e+1],t,n,r))},e.prototype.includeSphere=function(e){if(XE.hasExtrema(e)&&e.extrema.length>1)for(var t=0,r=e.extrema;t<r.length;t++){var n=r[t];this.includePosition(n)}else this.includePositionRadius(e.center,e.radius)},e.prototype.includePosition=function(e){for(var t=0;t<this.dirLength;++t)this.computeExtrema(t,e)},e.prototype.includePositionRadius=function(e,t){for(var r=0;r<this.dirLength;++r)this.computeSphereExtrema(r,e,t)},e.prototype.finishedIncludeStep=function(){for(var e=0;e<this.extrema.length;e++)this.centroidHelper.includeStep(this.extrema[e]);this.centroidHelper.finishedIncludeStep()},e.prototype.radiusSphere=function(e){if(XE.hasExtrema(e)&&e.extrema.length>1)for(var t=0,r=e.extrema;t<r.length;t++){var n=r[t];this.radiusPosition(n)}else this.radiusPositionRadius(e.center,e.radius)},e.prototype.radiusPosition=function(e){this.centroidHelper.radiu
139sStep(e)},e.prototype.radiusPositionRadius=function(e,t){this.centroidHelper.radiusSphereStep(e,t)},e.prototype.getSphere=function(e){return XE.setExtrema(this.centroidHelper.getSphere(e),this.extrema.slice())},e.prototype.getBox=function(e){return YE.fromVec3Array(e||YE(),this.extrema)},e.prototype.reset=function(){for(var e=0;e<this.dirLength;++e)this.minDist[e]=1/0,this.maxDist[e]=-1/0,this.extrema[2*e]=Cg(),this.extrema[2*e+1]=Cg();this.centroidHelper.reset()},e}(),EM=[[1,0,0],[0,1,0],[0,0,1]],MM=[[1,1,1],[-1,1,1],[-1,-1,1],[1,-1,1]],kM=[[1,1,0],[1,-1,0],[1,0,1],[1,0,-1],[0,1,1],[0,1,-1]],IM=[[0,1,2],[0,2,1],[1,0,2],[2,0,1],[1,2,0],[2,1,0],[0,1,-2],[0,2,-1],[1,0,-2],[2,0,-1],[1,-2,0],[2,-1,0]],DM=[[1,1,2],[2,1,1],[1,2,1],[1,-1,2],[1,1,-2],[1,-1,-2],[2,-1,1],[2,1,-1],[2,-1,-1],[1,-2,1],[1,2,-1],[1,-2,-1]],OM=[[2,2,1],[1,2,2],[2,1,2],[2,-2,1],[2,2,-1],[2,-2,-1],[1,-2,2],[1,2,-2],[1,-2,-2],[2,-1,2],[2,1,-2],[2,-1,-2]],RM=Cg.fromArray,BM=Cg.transformMat4Offset;function NM(e,t,r,n){var i=function(e,t){e=Math.max(e,2);var r=Math.ceil(Math.sqrt(e)),n=(r+=(t-r%t)%t)>0?Math.ceil(e/r):0;return{width:r,height:n,length:r*n*t}}(e,t),a=i.length,o=i.width,s=i.height;return{array:n=n&&n.length>=a?n:new r(a),width:o,height:s}}var FM=Cg(),LM=new PM("14"),$M=new PM("98");function UM(e){return e>1e5?LM:$M}function jM(e,t,r){var n=3*r,i=UM(t);i.reset();for(var a=0,o=3*t;a<o;a+=n)RM(FM,e,a),i.includePosition(FM);for(i.finishedIncludeStep(),a=0,o=3*t;a<o;a+=n)RM(FM,e,a),i.radiusPosition(FM);var s=i.getSphere();if(t<=14){var u=[];for(a=0,o=3*t;a<o;a+=n)u.push(RM(Cg(),e,a));XE.setExtrema(s,u)}return s}var zM=Og();function GM(e,t,r,n){if(1===r){Og.fromArray(zM,t,n);var i=XE.clone(e);return Og.isIdentity(zM)?i:XE.transform(i,i,zM)}var a=UM(r);a.reset();var o=e.center,s=e.radius,u=e.extrema;if(u&&r<=14){for(var c=0,l=r;c<l;++c)for(var d=0,f=u;d<f.length;d++){var h=f[d];BM(FM,h,t,0,0,16*c+n),a.includePosition(FM)}for(a.finishedIncludeStep(),c=0,l=r;c<l;++c)for(var p=0,m=u;p<m.length;p++)h=m[p],BM(FM,h,t,0,0,16*c+n),a.radiusPosition(FM)}else{for(c=0,l=r;c<l;++c)BM(FM,o,t,0,0,16*c+n),a.includePositionRadius(FM,s);for(a.finishedIncludeStep(),c=0,l=r;c<l;++c)BM(FM,o,t,0,0,16*c+n),a.radiusPositionRadius(FM,s)}return a.getSphere()}var VM=new Uint8Array(772);function HM(e,t){if(0===t)return 0;var r=new Uint32Array(e.buffer,0,e.buffer.byteLength>>2),n=t-4>>2,i=4*n,a=0;if(n<0)for(var o=0;o<t;++o)a+=e[o]&&1;else{for(o=0;o<n;++o){var s=r[o];a+=VM[65535&s]+VM[s>>16]}for(o=i;o<t;++o)a+=e[o]&&1}return a/t}function qM(e,t,r){var n=NM(Math.max(1,e),1,Uint8Array,r&&r.tMarker.ref.value.array),i=HM(n.array,e),a=0===i?0:-1;return r?(tf.updateIfChanged(r.uMarker,0),tf.update(r.tMarker,n),tf.update(r.uMarkerTexDim,Bg.create(n.width,n.height)),tf.updateIfChanged(r.markerAverage,i),tf.updateIfChanged(r.markerStatus,a),tf.updateIfChanged(r.dMarkerType,t),r):{uMarker:tf.create(0),tMarker:tf.create(n),uMarkerTexDim:tf.create(Bg.create(n.width,n.height)),markerAverage:tf.create(i),markerStatus:tf.create(a),dMarkerType:tf.create(t)}}VM[1]=1,VM[2]=1,VM[3]=1,VM[256]=1,VM[512]=1,VM[768]=1,VM[257]=2,VM[513]=2,VM[769]=2,VM[258]=2,VM[514]=2,VM[770]=2,VM[259]=2,VM[515]=2,VM[771]=2;var WM={kind:"null-location"};function XM(e,t,r){return{kind:"data-location",tag:e,data:t,element:r}}function YM(e,t,r,n,i,a){if(void 0===i&&(i=!1),void 0===a&&(a=function(){return!1}),e%r!=0)throw Error("incompatible groupCount and stride");var o={location:WM,index:0,groupIndex:0,instanceIndex:0,isSecondary:!1},s=o.groupIndex<e,u=!1,c=0,l=0,d=!1;return{get hasNext(){return s},get isNextNewInstance(){return u},groupCount:e,instanceCount:t,count:e*t,stride:r,nonInstanceable:i,move:function(){return s&&=(o.groupIndex=c,o.instanceIndex=l,o.index=l*e+c,o.location=n(c,d?-1:l),o.isSecondary=a(c,d?-1:l),(c+=r)===e?(++l,u=!0,l<t&&(c=0)):u=!1,c<e),o},reset:function(){o.location=WM,o.index=0,o.groupIndex=0,o.instanceIndex=0,o.isSecondary=!1,s=o.groupIndex<e,u=!1,c=0,l=0,d=!1},skipInstance:function(){s&&o.instanceIndex===l&&(++l,c=0,s=l<t)},voidInstances:function(){d=!0}}}function KM(e){return{kind:"position-location",position:Cg()}}var ZM,QM=Jd();function JM(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE){var r=function(e,t){switch(t){case e.FRAMEBUFFER_COMPLETE:return"complete";case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"incomplete attachment";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"incomplete missing attachment";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"incomplete dimensions";case e.FRAMEBUFFER_UNSUPPORTED:return"unsupported"}if(dI(e))switch(t){case e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:return"incomplete multisample";case e.RENDERBUFFER_SAMPLES:return"renderbuffer samples"}return"unknown error"}(e,t);throw Error(`Framebuffer status: ${r}`)}}function ek(e){var t=e.createFramebuffer();if(null===t)throw Error("Could not create WebGL framebuffer");return t}function tk(e){var t=function(e){if(dI(e))return{drawArraysInstanced:e.drawArraysInstanced.bind(e),drawElementsInstanced:e.drawElementsInstanced.bind(e),vertexAttribDivisor:e.vertexAttribDivisor.bind(e),VERTEX_ATTRIB_ARRAY_DIVISOR:e.VERTEX_ATTRIB_ARRAY_DIVISOR};var t=e.getExtension("ANGLE_instanced_arrays");return null===t?null:{drawArraysInstanced:t.drawArraysInstancedANGLE.bind(t),drawElementsInstanced:t.drawElementsInstancedANGLE.bind(t),vertexAttribDivisor:t.vertexAttribDivisorANGLE.bind(t),VERTEX_ATTRIB_ARRAY_DIVISOR:t.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE}}(e);if(null===t)throw Error('Could not find support for "instanced_arrays"');var r=function(e){return dI(e)?{}:e.getExtension("OES_element_index_uint")}(e);if(null===r)throw Error('Could not find support for "element_index_uint"');var n=function(e){if(dI(e))return{FRAGMENT_SHADER_DERIVATIVE_HINT:e.FRAGMENT_SHADER_DERIVATIVE_HINT};var t=e.getExtension("OES_standard_derivatives");return null===t?null:{FRAGMENT_SHADER_DERIVATIVE_HINT:t.FRAGMENT_SHADER_DERIVATIVE_HINT_OES}}(e);if(null===n)throw Error('Could not find support for "standard_derivatives"');var i=function(e){return dI(e)?{}:e.getExtension("OES_texture_float")}(e);ay&&null===i&&console.log('Could not find support for "texture_float"');var a=function(e){return e.getExtension("OES_texture_float_linear")}(e);ay&&null===a&&console.log('Could not find support for "texture_float_linear"');var o=function(e){if(dI(e))return{HALF_FLOAT:e.HALF_FLOAT};var t=e.getExtension("OES_texture_half_float");return null===t?null:{HALF_FLOAT:t.HALF_FLOAT_OES}}(e);ay&&null===o&&console.log('Could not find support for "texture_half_float"');var s=function(e){return e.getExtension("OES_texture_half_float_linear")}(e);ay&&null===s&&console.log('Could not find support for "texture_half_float_linear"');var u=function(e){if(dI(e))return{UNSIGNED_INT_24_8:e.UNSIGNED_INT_24_8};var t=e.getExtension("WEBGL_depth_texture");return null===t?null:{UNSIGNED_INT_24_8:t.UNSIGNED_INT_24_8_WEBGL}}(e);ay&&null===u&&console.log('Could not find support for "depth_texture"');var c=function(e){if(dI(e))return{MIN:e.MIN,MAX:e.MAX};var t=e.getExtension("EXT_blend_minmax");return null===t?null:{MIN:t.MIN_EXT,MAX:t.MAX_EXT}}(e);ay&&null===c&&console.log('Could not find support for "blend_minmax"');var l=function(e){if(dI(e))return{VERTEX_ARRAY_BINDING:e.VERTEX_ARRAY_BINDING,bindVertexArray:e.bindVertexArray.bind(e),createVertexArray:e.createVertexArray.bind(e),deleteVertexArray:e.deleteVertexArray.bind(e),isVertexArray:e.isVertexArray.bind(e)};var t=e.getExtension("OES_vertex_array_object");return null===t?null:{VERTEX_ARRAY_BINDING:t.VERTEX_ARRAY_BINDING_OES,bindVertexArray:t.bindVertexArrayOES.bind(t),createVertexArray:t.createVertexArrayOES.bind(t),deleteVertexArray:t.deleteVertexArrayOES.bind(t),isVertexArray:t.isVertexArrayOES.bind(t)}}(e);ay&&null===l&&console.log('Could not find support for "vertex_array_object"');var d=function(e){return dI(e)?{}:e.getExtension("EXT_frag_depth")}(e);ay&&null===d&&console.log('Could not find support for "frag_depth"');var f=function(e){if(dI(e))return null===e.getExtension("EXT_color_buffer_float")?null:(e.getExtension("EXT_float_blend"),{RGBA32F:e.RGBA32F});var t=e.getExtension("WEBGL_color_buffer_float");return null===t?(e.getExtension("OES_texture_float"),hI(e,e.FLOAT)?{RGBA32F:34836}:null):(e.getExtension("EXT_float_blend"),{RGBA32F:t.RGBA32F_EXT})}(e);ay&&null===f&&console.log('Could not find support for "color_buffer_float"');var h=function(e){if(dI(e))return null===e.getExtension("EXT_color_buffer_half_float")?null:(e.getExtension("EXT_float_blend"),{RGBA16F:e.RGBA16F});var t=e.getExtension("EXT_color_buffer_half_float");return null===t?(e.getExtension("OES_texture_half_float"),hI(e,36193)?{RGBA16F:34842}:null):(e.getExtension("EXT_float_blend"),{RGBA16F:t.RGBA16F_EXT})}(e);ay&&null===h&&console.log('Could not find support for "color_buffer_half_float"');var p=function(e){if(dI(e))return{drawBuffers:e.drawBuffers.bind(e),COLOR_ATTACHMENT0:e.COLOR_ATTACHMENT0,COLOR_ATTACHMENT1:e.COLOR_ATTACHMENT1,COLOR_ATTACHMENT2:e.COLOR_ATTACHMENT2,COLOR_ATTACHMENT3:e.COLOR_ATTACHMENT3,COLOR_ATTACHMENT4:e.COLOR_ATTACHMENT4,COLOR_ATTACHMENT5:e.COLOR_ATTACHMENT5,COLOR_ATTACHMENT6:e.COLOR_ATTACHMENT6,COLOR_ATTACHMENT7:e.COLOR_ATTACHMENT7,DRAW_BUFFER0:e.DRAW_BUFFER0,DRAW_BUFFER1:e.DRAW_BUFFER1,DRAW_BUFFER2:e.DRAW_BUFFER2,DRAW_BUFFER3:e.DRAW_BUFFER3,DRAW_BUFFER4:e.DRAW_BUFFER4,DRAW_BUFFER5:e.DRAW_BUFFER5,DRAW_BUFFER6:e.DRAW_BUFFER6,DRAW_BUFFER7:e.DRAW_BUFFER7,MAX_COLOR_ATTACHMENTS:e.MAX_COLOR_ATTACHMENTS,MAX_DRAW_BUFFERS:e.MAX_DRAW_BUFFERS};var t=e.getExtension("WEBGL_draw_buffers");return null===t?null:{drawBuffers:t.drawBuffersWEBGL.bind(t),COLOR_ATTACHMENT0:t.COLOR_ATTACHMENT0_WEBGL,COLOR_ATTACHMENT1:t.COLOR_ATTACHMENT1_WEBGL,COLOR_ATTACHMENT2:t.COLOR_ATTACHMENT2_WEBGL,COLOR_ATTACHMENT3:t.COLOR_ATTACHMENT3_WEBGL,COLOR_ATTACHMENT4:t.COLOR_ATTACHMENT4_WEBGL,COLOR_ATTACHMENT5:t.COLOR_ATTACHMENT5_WEBGL,COLOR_ATTACHMENT6:t.COLOR_ATTACHMENT6_WEBGL,COLOR_ATTACHMENT7:t.COLOR_ATTACHMENT7_WEBGL,DRAW_BUFFER0:t.DRAW_BUFFER0_WEBGL,DRAW_BUFFER1:t.DRAW_BUFFER1_WEBGL,DRAW_BUFFER2:t.DRAW_BUFFER2_WEBGL,DRAW_BUFFER3:t.DRAW_BUFFER3_WEBGL,DRAW_BUFFER4:t.DRAW_BUFFER4_WEBGL,DRAW_BUFFER5:t.DRAW_BUFFER5_WEBGL,DRAW_BUFFER6:t.DRAW_BUFFER6_WEBGL,DRAW_BUFFER7:t.DRAW_BUFFER7_WEBGL,MAX_COLOR_ATTACHMENTS:t.MAX_COLOR_ATTACHMENTS_WEBGL,MAX_DRAW_BUFFERS:t.MAX_DRAW_BUFFERS_WEBGL}}(e);ay&&null===p&&console.log('Could not find support for "draw_buffers"');var m=function(e){var t=e.getExtension("OES_draw_buffers_indexed");return null===t?null:{enablei:t.enableiOES.bind(t),disablei:t.disableiOES.bind(t),blendEquationi:t.blendEquationiOES.bind(t),blendEquationSeparatei:t.blendEquationSeparateiOES.bind(t),blendFunci:t.blendFunciOES.bind(t),blendFuncSeparatei:t.blendFuncSeparateiOES.bind(t),colorMaski:t.colorMaskiOES.bind(t)}}(e);ay&&null===m&&console.log('Could not find support for "draw_buffers_indexed"');var g=function(e){return dI(e)?{}:e.getExtension("EXT_shader_texture_lod")}(e);ay&&null===g&&console.log('Could not find support for "shader_texture_lod"');var v=function(e){if(dI(e))return{FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,SRGB8_ALPHA8:e.SRGB8_ALPHA8,SRGB8:e.SRGB8,SRGB:e.SRGB};var t=e.getExtension("EXT_sRGB");return null===t?null:{FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT,S
139RGB8_ALPHA8:t.SRGB8_ALPHA8_EXT,SRGB8:t.SRGB_ALPHA_EXT,SRGB:t.SRGB_EXT}}(e);ay&&null===v&&console.log('Could not find support for "sRGB"');var y=function(e){var t;return dI(e)?null===(t=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"))?null:{QUERY_COUNTER_BITS:t.QUERY_COUNTER_BITS_EXT,CURRENT_QUERY:e.CURRENT_QUERY,QUERY_RESULT:e.QUERY_RESULT,QUERY_RESULT_AVAILABLE:e.QUERY_RESULT_AVAILABLE,TIME_ELAPSED:t.TIME_ELAPSED_EXT,TIMESTAMP:t.TIMESTAMP_EXT,GPU_DISJOINT:t.GPU_DISJOINT_EXT,createQuery:e.createQuery.bind(e),deleteQuery:e.deleteQuery.bind(e),isQuery:e.isQuery.bind(e),beginQuery:e.beginQuery.bind(e),endQuery:e.endQuery.bind(e),queryCounter:t.queryCounterEXT.bind(t),getQuery:e.getQuery.bind(e),getQueryParameter:e.getQueryParameter.bind(e)}:null===(t=e.getExtension("EXT_disjoint_timer_query"))?null:{QUERY_COUNTER_BITS:t.QUERY_COUNTER_BITS_EXT,CURRENT_QUERY:t.CURRENT_QUERY_EXT,QUERY_RESULT:t.QUERY_RESULT_EXT,QUERY_RESULT_AVAILABLE:t.QUERY_RESULT_AVAILABLE_EXT,TIME_ELAPSED:t.TIME_ELAPSED_EXT,TIMESTAMP:t.TIMESTAMP_EXT,GPU_DISJOINT:t.GPU_DISJOINT_EXT,createQuery:t.createQueryEXT.bind(t),deleteQuery:t.deleteQueryEXT.bind(t),isQuery:t.isQueryEXT.bind(t),beginQuery:t.beginQueryEXT.bind(t),endQuery:t.endQueryEXT.bind(t),queryCounter:t.queryCounterEXT.bind(t),getQuery:t.getQueryEXT.bind(t),getQueryParameter:t.getQueryObjectEXT.bind(t)}}(e);ay&&null===y&&console.log('Could not find support for "disjoint_timer_query"');var b=function(e){var t=e.getExtension("KHR_parallel_shader_compile");return null===t?null:{COMPLETION_STATUS:t.COMPLETION_STATUS_KHR}}(e);ay&&null===b&&console.log('Could not find support for "parallel_shader_compile"');var _=function(e){return dI(e)?{}:e.getExtension("OES_fbo_render_mipmap")}(e);ay&&null===_&&console.log('Could not find support for "fbo_render_mipmap"');var x=function(e){if(dI(e)){var t=e.getExtension("WEBGL_provoking_vertex");if(t)return{FIRST_VERTEX_CONVENTION:t.FIRST_VERTEX_CONVENTION_WEBGL,LAST_VERTEX_CONVENTION:t.LAST_VERTEX_CONVENTION_WEBGL,PROVOKING_VERTEX:t.PROVOKING_VERTEX_WEBGL,provokingVertex:t.provokingVertexWEBGL.bind(t)}}return null}(e);ay&&null===x&&console.log('Could not find support for "provoking_vertex"');var S=function(e){if(dI(e)){var t=e.getExtension("WEBGL_clip_cull_distance");if(t)return{MAX_CLIP_DISTANCES:t.MAX_CLIP_DISTANCES_WEBGL,MAX_CULL_DISTANCES:t.MAX_CULL_DISTANCES_WEBGL,MAX_COMBINED_CLIP_AND_CULL_DISTANCES:t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL,CLIP_DISTANCE0:t.CLIP_DISTANCE0_WEBGL,CLIP_DISTANCE1:t.CLIP_DISTANCE1_WEBGL,CLIP_DISTANCE2:t.CLIP_DISTANCE2_WEBGL,CLIP_DISTANCE3:t.CLIP_DISTANCE3_WEBGL,CLIP_DISTANCE4:t.CLIP_DISTANCE4_WEBGL,CLIP_DISTANCE5:t.CLIP_DISTANCE5_WEBGL,CLIP_DISTANCE6:t.CLIP_DISTANCE6_WEBGL,CLIP_DISTANCE7:t.CLIP_DISTANCE7_WEBGL}}return null}(e);ay&&null===S&&console.log('Could not find support for "clip_cull_distance"');var w=function(e){return dI(e)&&e.getExtension("EXT_conservative_depth")?{}:null}(e);ay&&null===w&&console.log('Could not find support for "conservative_depth"');var A=function(e){if(dI(e)){var t=e.getExtension("WEBGL_stencil_texturing");if(t)return{DEPTH_STENCIL_TEXTURE_MODE:t.DEPTH_STENCIL_TEXTURE_MODE_WEBGL,STENCIL_INDEX:t.STENCIL_INDEX_WEBGL}}return null}(e);ay&&null===A&&console.log('Could not find support for "stencil_texturing"');var C=function(e){var t=e.getExtension("EXT_clip_control");return t?{LOWER_LEFT:t.LOWER_LEFT_EXT,UPPER_LEFT:t.UPPER_LEFT_EXT,NEGATIVE_ONE_TO_ONE:t.NEGATIVE_ONE_TO_ONE_EXT,ZERO_TO_ONE:t.ZERO_TO_ONE_EXT,CLIP_ORIGIN:t.CLIP_ORIGIN_EXT,CLIP_DEPTH_MODE:t.CLIP_DEPTH_MODE_EXT,clipControl:t.clipControlEXT.bind(t)}:null}(e);return ay&&null===C&&console.log('Could not find support for "clip_control"'),{instancedArrays:t,standardDerivatives:n,elementIndexUint:r,textureFloat:i,textureFloatLinear:a,textureHalfFloat:o,textureHalfFloatLinear:s,depthTexture:u,blendMinMax:c,vertexArrayObject:l,fragDepth:d,colorBufferFloat:f,colorBufferHalfFloat:h,drawBuffers:p,drawBuffersIndexed:m,shaderTextureLod:g,sRGB:v,disjointTimerQuery:y,parallelShaderCompile:b,fboRenderMipmap:_,provokingVertex:x,clipCullDistance:S,conservativeDepth:w,stencilTexturing:A,clipControl:C,noNonInstancedActiveAttribs:function(e){if(!dI(e))return!1;if(typeof navigator<"u"){var t=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./);return!t||parseInt(t[1])>=85}return!1}(e)}}!function(e){e.create=function(e,t,r){return{array:e,width:t,height:r}}
139,e.flipY=function(e){for(var t=e.array,r=e.width,n=e.height,i=r*(t.length/(r*n)),a=0,o=n/2;a<o;++a)for(var s=0,u=i;s<u;++s){var c=a*i+s,l=(n-a-1)*i+s,d=t[c];t[c]=t[l],t[l]=d}return e},e.divideByAlpha=function(e){for(var t=e.array,r=t instanceof Uint8Array?255:1,n=0,i=t.length;n<i;n+=4){var a=t[n+3]/r;t[n]/=a,t[n+1]/=a,t[n+2]/=a}return e}}(ZM||={});var rk=Jd(),nk={apply_fog:"\nfloat preFogAlpha = gl_FragColor.a;\nif (uFog) {\n    float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\n    float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\n    float fogAlpha = (1.0 - fogFactor) * gl_FragColor.a;\n    if (!uTransparentBackground) {\n        if (gl_FragColor.a < 1.0) {\n            // transparent objects are blended with background color\n            gl_FragColor.a = fogAlpha;\n        } else {\n            // mix opaque objects with background color\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor);\n        }\n    } else {\n        #if defined(dRenderVariant_colorDpoit)\n            if (gl_FragColor.a < 1.0) {\n                // transparent objects are blended with background color\n                gl_FragColor.a = fogAlpha;\n            } else {\n                // opaque objects need to be pre-multiplied alpha\n                gl_FragColor.rgb *= fogAlpha;\n                gl_FragColor.a = fogAlpha;\n            }\n        #else\n            // pre-multiplied alpha expected for transparent background\n            gl_FragColor.rgb *= fogAlpha;\n            gl_FragColor.a = fogAlpha;\n        #endif\n    }\n}\n",apply_interior_color:"\nif (interior) {\n    if (uInteriorColorFlag) {\n        gl_FragColor.rgb = uInteriorColor;\n    } else {\n        gl_FragColor.rgb *= 1.0 - uInteriorDarkening;\n    }\n\n    #ifdef dTransparentBackfaces_opaque\n        gl_FragColor.a = 1.0;\n    #endif\n}\n",apply_light_color:"\n#ifdef dIgnoreLight\n    #ifdef bumpEnabled\n        if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {\n            material.rgb += fbm(vModelPosition * uBumpFrequency) * uBumpAmplitude * bumpiness;\n            material.rgb -= 0.5 * uBumpAmplitude * bumpiness;\n        }\n    #endif\n\n    gl_FragColor = material;\n#else\n    #ifdef bumpEnabled\n        if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {\n            normal = perturbNormal(-vViewPosition, normal, fbm(vModelPosition * uBumpFrequency), (uBumpAmplitude * bumpiness) / uBumpFrequency);\n        }\n    #endif\n\n    vec4 color = material;\n\n    ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n\n    PhysicalMaterial physicalMaterial;\n    physicalMaterial.diffuseColor = color.rgb * (1.0 - metalness);\n    #ifdef enabledFragDepth\n        physicalMaterial.roughness = min(max(roughness, 0.0525), 1.0);\n    #else\n        vec3 dxy = max(abs(dFdx(normal)), abs(dFdy(normal)));\n        float geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\n        physicalMaterial.roughness = min(max(roughness, 0.0525) + geometryRoughness, 1.0);\n    #endif\n    physicalMaterial.specularColor = mix(vec3(0.04), color.rgb, metalness);\n    physicalMaterial.specularF90 = 1.0;\n\n    GeometricContext geometry;\n    geometry.position = -vViewPosition;\n    geometry.normal = normal;\n    geometry.viewDir = normalize(vViewPosition);\n\n    IncidentLight directLight;\n    #pragma unroll_loop_start\n    for (int i = 0; i < dLightCount; ++i) {\n        directLight.direction = uLightDirection[i];\n        directLight.color = uLightColor[i] * PI; // * PI for punctual light\n        RE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight);\n    }\n    #pragma unroll_loop_end\n\n    vec3 irradiance = uAmbientColor * PI; // * PI for punctual light\n    RE_IndirectDiffuse_Physical(irradiance, geometry, physicalMaterial, reflectedLight);\n\n    // indirect specular only metals\n    vec3 radiance = uAmbientColor * metalness;\n    vec3 iblIrradiance = uAmbientColor * metalness;\n    vec3 clearcoatRadiance = vec3(0.0);\n    RE_IndirectSpecular_Physical(radiance, iblIrradiance, clearcoatRadiance, geometry, physicalMaterial, reflectedLight);\n\n    vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n    outgoingLight = clamp(outgoingLight, 0.01, 0.99); // prevents black artifacts on specular highlight with transparent background\n\n    gl_FragColor = vec4(
139outgoingLight, color.a);\n#endif\n\n#if defined(dXrayShaded_on)\n    gl_FragColor.a *= 1.0 - pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);\n#elif defined(dXrayShaded_inverted)\n    gl_FragColor.a *= pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);\n#endif\n\ngl_FragColor.rgb *= uExposure;\n",apply_marker_color:"\n\n#if defined(dColorMarker)\n    if (marker > 0.0) {\n        if ((uMarkerPriority == 1 && marker != 2.0) || (uMarkerPriority != 1 && marker == 1.0)) {\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, uHighlightColor, uHighlightStrength);\n            gl_FragColor.a = max(gl_FragColor.a, uHighlightStrength * 0.002); // for direct-volume rendering\n        } else {\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, uSelectColor, uSelectStrength);\n            gl_FragColor.a = max(gl_FragColor.a, uSelectStrength * 0.002); // for direct-volume rendering\n        }\n    } else if (uMarkerAverage > 0.0) {\n        gl_FragColor.rgb = mix(gl_FragColor.rgb, uDimColor, uDimStrength);\n        gl_FragColor.a = max(gl_FragColor.a, uDimStrength * 0.002); // for direct-volume rendering\n    }\n#endif\n",assign_clipping_varying:"\n#if dClipObjectCount != 0 && defined(dClipping)\n    #if defined(dClippingType_instance)\n        vClipping = readFromTexture(tClipping, aInstance, uClippingTexDim).a;\n    #elif defined(dMarkerType_groupInstance)\n        vClipping = readFromTexture(tClipping, aInstance * float(uGroupCount) + group, uClippingTexDim).a;\n    #endif\n#endif\n",assign_color_varying:"\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_attribute)\n        vColor.rgb = aColor;\n    #elif defined(dColorType_instance)\n        vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n    #elif defined(dColorType_group)\n        vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n    #elif defined(dColorType_groupInstance)\n        vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n    #elif defined(dColorType_vertex)\n        vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n    #elif defined(dColorType_vertexInstance)\n        vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n    #elif defined(dColorType_volume)\n        vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n        vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n    #elif defined(dColorType_volumeInstance)\n        vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n        vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n    #endif\n\n    #ifdef dUsePalette\n        vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n    #endif\n\n    #ifdef dOverpaint\n        #if defined(dOverpaintType_instance)\n            vOverpaint = readFromTexture(tOverpaint, aInstance, uOverpaintTexDim);\n        #elif defined(dOverpaintType_groupInstance)\n            vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n        #elif defined(dOverpaintType_vertexInstance)\n            vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n        #elif defined(dOverpaintType_volumeInstance)\n            vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n            vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n        #endif\n\n        // pre-mix to avoid darkening due to empty overpaint\
139n        #ifdef dColorType_uniform\n            vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n        #else\n            vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n        #endif\n        vOverpaint *= uOverpaintStrength;\n    #endif\n\n    #ifdef dSubstance\n        #if defined(dSubstanceType_instance)\n            vSubstance = readFromTexture(tSubstance, aInstance, uSubstanceTexDim);\n        #elif defined(dSubstanceType_groupInstance)\n            vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n        #elif defined(dSubstanceType_vertexInstance)\n            vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n        #elif defined(dSubstanceType_volumeInstance)\n            vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n            vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n        #endif\n\n        // pre-mix to avoid artifacts due to empty substance\n        vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n        vSubstance *= uSubstanceStrength;\n    #endif\n#elif defined(dRenderVariant_pick)\n    #ifdef requiredDrawBuffers\n        vObject = vec4(packIntToRGB(float(uObjectId)), 1.0);\n        vInstance = vec4(packIntToRGB(aInstance), 1.0);\n        vGroup = vec4(packIntToRGB(group), 1.0);\n    #else\n        if (uPickType == 1) {\n            vColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n        } else if (uPickType == 2) {\n            vColor = vec4(packIntToRGB(aInstance), 1.0);\n        } else {\n            vColor = vec4(packIntToRGB(group), 1.0);\n        }\n    #endif\n#endif\n\n#ifdef dTransparency\n    #if defined(dTransparencyType_instance)\n        vTransparency = readFromTexture(tTransparency, aInstance, uTransparencyTexDim).a;\n    #elif defined(dTransparencyType_groupInstance)\n        vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n    #elif defined(dTransparencyType_vertexInstance)\n        vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n    #elif defined(dTransparencyType_volumeInstance)\n        vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n        vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n    #endif\n    vTransparency *= uTransparencyStrength;\n#endif\n",assign_group:"\n#ifdef dGeometryType_textureMesh\n    float group = unpackRGBToInt(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n    float group = aGroup;\n#endif\n",assign_marker_varying:"\n#if defined(dNeedsMarker)\n    #if defined(dMarkerType_instance)\n        vMarker = readFromTexture(tMarker, aInstance, uMarkerTexDim).a;\n    #elif defined(dMarkerType_groupInstance)\n        vMarker = readFromTexture(tMarker, aInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n    #endif\n#endif\n",assign_material_color:"\n#if defined(dNeedsMarker)\n    float marker = uMarker;\n    if (uMarker == -1.0) {\n        marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win\n    }\n#endif\n\n#if defined(dRenderVariant_color)\n    #if defined(dUsePalette)\n        vec4 material = vec4(texture2D(tPalette, vec2(vPaletteV, 0.5)).rgb, uAlpha);\n    #elif defined(dColorType_uniform)\n        vec4 material = vec4(uColor, uAlpha);\n    #elif defined(dColorType_varying)\n        vec4 material = vec4(vColor.rgb, uAlpha);\n    #endif\n\n    // mix material with overpaint\n    #if defined(dOverpaint)\n        material.rgb = mix(material.rgb, vOverpaint.rgb, vOverpaint.a);\n    #endif\n\n    float metalness = uMetalness;\n    float roughness = uRoughness;\n    float bumpiness = uBumpiness;\n    #ifdef dSubstance\n        metalness = mix(metalness, vSubstance.r, vSubstance.a);\n        roughness = mix(roughness, vSubstance.g, vSubstance.a);\n        bumpiness = mix(bumpiness, vSubstance.b, vSubstance.a);\n    #endif\n#elif defined(dRenderVariant_depth)\n    if (fragmentDepth > getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {\n        discard;\n    }\n\n    #ifndef dXrayShaded\n        #if defined(dTransparency)\n            float dta = 1.0 - vTrans
139parency;\n            if (vTransparency < 0.2) dta = 1.0; // hard cutoff looks better\n\n            if (uRenderMask == MaskTransparent && uAlpha * dta == 1.0) {\n                discard;\n            } else if (uRenderMask == MaskOpaque && uAlpha * dta < 1.0) {\n                discard;\n            }\n        #else\n            if (uRenderMask == MaskTransparent && uAlpha == 1.0) {\n                discard;\n            } else if (uRenderMask == MaskOpaque && uAlpha < 1.0) {\n                discard;\n            }\n        #endif\n    #else\n        if (uRenderMask == MaskOpaque) {\n            discard;\n        }\n    #endif\n\n    vec4 material = packDepthToRGBA(fragmentDepth);\n#elif defined(dRenderVariant_marking)\n    vec4 material;\n    if(uMarkingType == 1) {\n        if (marker > 0.0)\n            discard;\n        #ifdef enabledFragDepth\n            material = packDepthToRGBA(gl_FragDepthEXT);\n        #else\n            material = packDepthToRGBA(gl_FragCoord.z);\n        #endif\n    } else {\n        if (marker == 0.0)\n            discard;\n        float depthTest = 1.0;\n        if (uMarkingDepthTest) {\n            depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n        }\n        bool isHighlight = intMod(marker, 2.0) > 0.1;\n        float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\n        float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\n        if (fogFactor == 1.0)\n            discard;\n        material = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0 - fogFactor);\n    }\n#endif\n\n// apply per-group transparency\n#if defined(dTransparency) && (defined(dRenderVariant_pick) || defined(dRenderVariant_color))\n    float ta = 1.0 - vTransparency;\n    if (vTransparency < 0.09) ta = 1.0; // hard cutoff looks better\n\n    #if defined(dRenderVariant_pick)\n        if (ta < uPickingAlphaThreshold)\n            discard; // ignore so the element below can be picked\n    #elif defined(dRenderVariant_color)\n        material.a *= ta;\n\n        #if defined(dRenderVariant_colorBlended)\n            #if defined(dTransparentBackfaces_off)\n                if ((uRenderMask == MaskOpaque && material.a < 1.0) ||\n                    (uRenderMask == MaskTransparent && material.a == 1.0) ||\n                    (interior && material.a < 1.0)\n                ) {\n                    discard;\n                }\n            #elif defined(dTransparentBackfaces_on)\n                if ((uRenderMask == MaskOpaque && material.a < 1.0) ||\n                    (uRenderMask == MaskTransparent && material.a == 1.0)\n                ) {\n                    discard;\n                }\n            #elif defined(dTransparentBackfaces_opaque)\n                if (interior) {\n                    material.a = 1.0;\n                } else if (\n                    (uRenderMask == MaskOpaque && material.a < 1.0) ||\n                    (uRenderMask == MaskTransparent && material.a == 1.0)\n                ) {\n                    discard;\n                }\n            #endif\n        #endif\n    #endif\n#endif\n",assign_position:"\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeometryType_textureMesh\n    vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n    vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n",assign_size:"\n#if defined(dSizeType_uniform)\n    float size = uSize;\n#elif defined(dSizeType_attribute)\n    float size = aSize;\n#elif defined(dSizeType_instance)\n    float size = unpackRGBToInt(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n    float size = unpackRGBToInt(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n    float size = unpackRGBToInt(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n    size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;
139\n",check_picking_alpha:"\nfloat viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\nfloat fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\nfloat alpha = (1.0 - fogFactor) * uAlpha;\n// if not opaque enough ignore so the element below can be picked\nif (uAlpha < uPickingAlphaThreshold || alpha < 0.1) {\n    #ifdef dTransparentBackfaces_opaque\n        if (!interior) discard;\n    #else\n        discard;\n    #endif\n}\n",clip_instance:"\n#if defined(dClipVariant_instance) && dClipObjectCount != 0\n    vec4 mCenter = uModel * aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0);\n    if (clipTest(vec4(mCenter.xyz, uInvariantBoundingSphere.w)))\n        // move out of [ -w, +w ] to 'discard' in vert shader\n        gl_Position.z = 2.0 * gl_Position.w;\n#endif\n",clip_pixel:"\n#if defined(dClipVariant_pixel) && dClipObjectCount != 0\n    if (clipTest(vec4(vModelPosition, 0.0)))\n        discard;\n#endif\n",color_frag_params:"\nuniform float uMetalness;\nuniform float uRoughness;\nuniform float uBumpiness;\n#ifdef bumpEnabled\n    uniform float uBumpFrequency;\n    uniform float uBumpAmplitude;\n#endif\n\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_uniform)\n        uniform vec3 uColor;\n    #elif defined(dColorType_varying)\n        varying vec4 vColor;\n    #endif\n\n    #ifdef dUsePalette\n        uniform sampler2D tPalette;\n        varying float vPaletteV;\n    #endif\n\n    #ifdef dOverpaint\n        varying vec4 vOverpaint;\n    #endif\n\n    #ifdef dSubstance\n        varying vec4 vSubstance;\n    #endif\n#elif defined(dRenderVariant_pick)\n    #if __VERSION__ == 100 || !defined(dVaryingGroup)\n        #ifdef requiredDrawBuffers\n            varying vec4 vObject;\n            varying vec4 vInstance;\n            varying vec4 vGroup;\n        #else\n            varying vec4 vColor;\n        #endif\n    #else\n        #ifdef requiredDrawBuffers\n            flat in vec4 vObject;\n            flat in vec4 vInstance;\n            flat in vec4 vGroup;\n        #else\n            flat in vec4 vColor;\n        #endif\n    #endif\n#endif\n\n#ifdef dTransparency\n    varying float vTransparency;\n#endif\n",color_vert_params:"\nuniform float uMetalness;\nuniform float uRoughness;\nuniform float uBumpiness;\n\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_uniform)\n        uniform vec3 uColor;\n    #elif defined(dColorType_attribute)\n        varying vec4 vColor;\n        attribute vec3 aColor;\n    #elif defined(dColorType_texture)\n        varying vec4 vColor;\n        uniform vec2 uColorTexDim;\n        uniform sampler2D tColor;\n    #elif defined(dColorType_grid)\n        varying vec4 vColor;\n        uniform vec2 uColorTexDim;\n        uniform vec3 uColorGridDim;\n        uniform vec4 uColorGridTransform;\n        uniform sampler2D tColorGrid;\n    #elif defined(dColorType_direct)\n        varying vec4 vColor;\n    #endif\n\n    #ifdef dUsePalette\n        varying float vPaletteV;\n    #endif\n\n    #ifdef dOverpaint\n        #if defined(dOverpaintType_instance) || defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n            varying vec4 vOverpaint;\n            uniform vec2 uOverpaintTexDim;\n            uniform sampler2D tOverpaint;\n        #elif defined(dOverpaintType_volumeInstance)\n            varying vec4 vOverpaint;\n            uniform vec2 uOverpaintTexDim;\n            uniform vec3 uOverpaintGridDim;\n            uniform vec4 uOverpaintGridTransform;\n            uniform sampler2D tOverpaintGrid;\n        #endif\n        uniform float uOverpaintStrength;\n    #endif\n\n    #ifdef dSubstance\n        #if defined(dSubstanceType_instance) || defined(dSubstanceType_groupInstance) || defined(dSubstanceType_vertexInstance)\n            varying vec4 vSubstance;\n            uniform vec2 uSubstanceTexDim;\n            uniform sampler2D tSubstance;\n        #elif defined(dSubstanceType_volumeInstance)\n            varying vec4 vSubstance;\n            uniform vec2 uSubstanceTexDim;\n            uniform vec3 uSubstanceGridDim;\n            uniform vec4 uSubstanceGridTransform;\n            uniform sampler2D tSubstanceGrid;\n        #endif\n        uniform float uSubstanceStrength;\n    #endif\n#elif defined(dRenderVariant_pick)\n    #if __VERSION__ == 100 || !defined(dVaryingGroup)\n        #ifdef requiredDrawBuffers\n            varying vec4 vObject;\n            varying vec4 vInstance;\n            varying vec4 vGroup;\n        #else\n            varying vec4 vColor;\n        #endif\n    #else\n        #ifdef requiredDrawBuffers\n            flat out vec4 vObject;\n            flat out vec4 vInstance;\n            flat out vec4 vGroup;\n        #else\n            flat out vec4 vColor;\n        #endif\n    #endif\n#endif\n\n#ifdef dTransparency\n    #if defined(dTransparencyType_instance) || defined(dTransparencyType_groupInstance) || defined(dTransparencyType_vertexInstance)\n        varying float vTransparency;\n        uniform vec2 uTransparencyTexDim;\n        uniform sampler2D tTransparency;\n    #elif defined(dTransparencyType_volumeInstance)\n        varying float vTransparency;\n        uniform vec2 uTransparencyTexDim;
139\n        uniform vec3 uTransparencyGridDim;\n        uniform vec4 uTransparencyGridTransform;\n        uniform sampler2D tTransparencyGrid;\n    #endif\n    uniform float uTransparencyStrength;\n#endif\n",common_clip:"\n#if dClipObjectCount != 0\n    vec3 quaternionTransform(const in vec4 q, const in vec3 v) {\n        vec3 t = 2.0 * cross(q.xyz, v);\n        return v + q.w * t + cross(q.xyz, t);\n    }\n\n    vec4 computePlane(const in vec3 normal, const in vec3 inPoint) {\n        return vec4(normalize(normal), -dot(normal, inPoint));\n    }\n\n    float planeSD(const in vec4 plane, const in vec3 center) {\n        return -dot(plane.xyz, center - plane.xyz * -plane.w);\n    }\n\n    float sphereSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n        return (\n            length(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position) / size) - 1.0\n        ) * min(min(size.x, size.y), size.z);\n    }\n\n    float cubeSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n        vec3 d = abs(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position)) - size;\n        return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0));\n    }\n\n    float cylinderSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n        vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n        vec2 d = abs(vec2(length(t.xz), t.y)) - size.xy;\n        return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));\n    }\n\n    float infiniteConeSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n        vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n        float q = length(t.xy);\n        return dot(size.xy, vec2(q, t.z));\n    }\n\n    float getSignedDistance(const in vec3 center, const in int type, const in vec3 position, const in vec4 rotation, const in vec3 scale) {\n        if (type == 1) {\n            vec3 normal = quaternionTransform(rotation, vec3(0.0, 1.0, 0.0));\n            vec4 plane = computePlane(normal, position);\n            return planeSD(plane, center);\n        } else if (type == 2) {\n            return sphereSD(position, rotation, scale * 0.5, center);\n        } else if (type == 3) {\n            return cubeSD(position, rotation, scale * 0.5, center);\n        } else if (type == 4) {\n            return cylinderSD(position, rotation, scale * 0.5, center);\n        } else if (type == 5) {\n            return infiniteConeSD(position, rotation, scale * 0.5, center);\n        } else {\n            return 0.1;\n        }\n    }\n\n    #if __VERSION__ == 100\n        // 8-bit\n        int bitwiseAnd(in int a, in int b) {\n            int d = 128;\n            int result = 0;\n            for (int i = 0; i < 8; ++i) {\n                if (d <= 0) break;\n                if (a >= d && b >= d) result += d;\n                if (a >= d) a -= d;\n                if (b >= d) b -= d;\n                d /= 2;\n            }\n            return result;\n        }\n\n        bool hasBit(const in int mask, const in int bit) {\n            return bitwiseAnd(mask, bit) == 0;\n        }\n    #else\n        bool hasBit(const in int mask, const in int bit) {\n            return (mask & bit) == 0;\n        }\n    #endif\n\n    bool clipTest(const in vec4 sphere) {\n        // flag is a bit-flag for clip-objects to ignore (note, object ids start at 1 not 0)\n        #if defined(dClipping)\n            int flag = int(floor(vClipping * 255.0 + 0.5));\n        #else\n            int flag = 0;\n        #endif\n\n        #pragma unroll_loop_start\n        for (int i = 0; i < dClipObjectCount; ++i) {\n            if (flag == 0 || hasBit(flag, UNROLLED_LOOP_INDEX + 1)) {\n                // TODO take sphere radius into account?\n                bool test = getSignedDistance(sphere.xyz, uClipObjectType[i], uClipObjectPosition[i], uClipObjectRotation[i], uClipObjectScale[i]) <= 0.0;\n                if ((!uClipObjectInvert[i] && test) || (uClipObjectInvert[i] && !test)) {\n                    return true;\n                }\n            }\n        }\n        #pragma unroll_loop_end\n        return false;\n    }\n#endif\n",common_frag_params:'\nuniform int uObjectId;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform int uPickType;\nuniform int uMarkingType;
139\n\n#if dClipObjectCount != 0\n    uniform int uClipObjectType[dClipObjectCount];\n    uniform bool uClipObjectInvert[dClipObjectCount];\n    uniform vec3 uClipObjectPosition[dClipObjectCount];\n    uniform vec4 uClipObjectRotation[dClipObjectCount];\n    uniform vec3 uClipObjectScale[dClipObjectCount];\n\n    #if defined(dClipping)\n        #if __VERSION__ == 100 || defined(dClippingType_instance) || !defined(dVaryingGroup)\n            varying float vClipping;\n        #else\n            flat in float vClipping;\n        #endif\n    #endif\n#endif\n\n#if defined(dColorMarker)\n    uniform vec3 uHighlightColor;\n    uniform vec3 uSelectColor;\n    uniform vec3 uDimColor;\n    uniform float uHighlightStrength;\n    uniform float uSelectStrength;\n    uniform float uDimStrength;\n    uniform int uMarkerPriority;\n    uniform float uMarkerAverage;\n#endif\n\n#if defined(dNeedsMarker)\n    uniform float uMarker;\n    #if __VERSION__ == 100 || defined(dMarkerType_instance) || !defined(dVaryingGroup)\n        varying float vMarker;\n    #else\n        flat in float vMarker;\n    #endif\n#endif\n\n#if defined(dRenderVariant_colorDpoit)\n    #define MAX_DPOIT_DEPTH 99999.0 // NOTE constant also set in TypeScript\n    uniform sampler2D tDpoitDepth;\n    uniform sampler2D tDpoitFrontColor;\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\nuniform vec2 uViewOffset;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform bool uFog;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\n\nuniform bool uDoubleSided;\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\nbool interior;\n\nuniform float uXrayEdgeFalloff;\nuniform float uExposure;\n\nuniform mat4 uProjection;\n\nuniform int uRenderMask;\nuniform bool uMarkingDepthTest;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nfloat getDepthPacked(const in vec2 coords) {\n    return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nfloat getDepth(const in vec2 coords) {\n    #ifdef depthTextureSupport\n        return texture2D(tDepth, coords).r;\n    #else\n        return unpackRGBAToDepth(texture2D(tDepth, coords));\n    #endif\n}\n\nfloat calcDepth(const in vec3 pos) {\n    vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n    return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\n// "Bump Mapping Unparametrized Surfaces on the GPU" Morten S. Mikkelsen\n// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\nvec3 perturbNormal(in vec3 position, in vec3 normal, in float height, in float scale) {\n    vec3 sigmaS = dFdx(position);\n    vec3 sigmaT = dFdy(position);\n\n    vec3 r1 = cross(sigmaT, normal);\n    vec3 r2 = cross(normal, sigmaS);\n    float det = dot(sigmaS, r1);\n\n    float bs = dFdx(height);\n    float bt = dFdy(height);\n\n    vec3 surfGrad = sign(det) * (bs * r1 + bt * r2);\n    return normalize(abs(det) * normal - scale * surfGrad);\n}\n\nfloat hash(in float h) {\n    return fract(sin(h) * 43758.5453123);\n}\n\nfloat noise(in vec3 x) {\n    vec3 p = floor(x);\n    vec3 f = fract(x);\n    f = f * f * (3.0 - 2.0 * f);\n\n    float n = p.x + p.y * 157.0 + 113.0 * p.z;\n    return mix(\n        mix(mix(hash(n + 0.0), hash(n + 1.0), f.x),\n            mix(hash(n + 157.0), hash(n + 158.0), f.x), f.y),\n        mix(mix(hash(n + 113.0), hash(n + 114.0), f.x),\n            mix(hash(n + 270.0), hash(n + 271.0), f.x), f.y), f.z);\n}\n\nfloat fbm(in vec3 p) {\n    float f = 0.0;\n    f += 0.5 * noise(p);\n    p *= 2.01;\n    f += 0.25 * noise(p);\n    p *= 2.02;\n    f += 0.125 * noise(p);\n\n    return f;\n}\n',common_vert_params:"\nuniform mat4 uProjection, uModel, uView;\nuniform vec3 uCameraPosition;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\nuniform vec4 uInvariantBoundingSphere;\n\nuniform bool uDoubleSided;\nuniform int uPickType;\n\n#if dClipObjectCount != 0\n    uniform int uClipObjectType[dClipObjectC
139ount];\n    uniform bool uClipObjectInvert[dClipObjectCount];\n    uniform vec3 uClipObjectPosition[dClipObjectCount];\n    uniform vec4 uClipObjectRotation[dClipObjectCount];\n    uniform vec3 uClipObjectScale[dClipObjectCount];\n\n    #if defined(dClipping)\n        uniform vec2 uClippingTexDim;\n        uniform sampler2D tClipping;\n        #if __VERSION__ == 100 || defined(dClippingType_instance) || !defined(dVaryingGroup)\n            varying float vClipping;\n        #else\n            flat out float vClipping;\n        #endif\n    #endif\n#endif\n\n#if defined(dNeedsMarker)\n    uniform float uMarker;\n    uniform vec2 uMarkerTexDim;\n    uniform sampler2D tMarker;\n    #if __VERSION__ == 100 || defined(dMarkerType_instance) || !defined(dVaryingGroup)\n        varying float vMarker;\n    #else\n        flat out float vMarker;\n    #endif\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\n#if defined(noNonInstancedActiveAttribs)\n    // int() is needed for some Safari versions\n    // see https://bugs.webkit.org/show_bug.cgi?id=244152\n    #define VertexID int(gl_VertexID)\n#else\n    attribute float aVertex;\n    #define VertexID int(aVertex)\n#endif\n",common:"\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit) || defined(dRenderVariant_colorDpoit)\n    #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n    #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n    #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n    #define dColorType_varying\n#endif\n\n#if (defined(dRenderVariant_color) && defined(dColorMarker)) || defined(dRenderVariant_marking)\n    #define dNeedsMarker\n#endif\n\n#if defined(dXrayShaded_on) || defined(dXrayShaded_inverted)\n    #define dXrayShaded\n#endif\n\n#define MaskAll 0\n#define MaskOpaque 1\n#define MaskTransparent 2\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\n#if __VERSION__ == 100\n    #define round(x) floor((x) + 0.5)\n#endif\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nvec3 packIntToRGB(in float value) {\n    value = clamp(round(value), 0.0, 16777216.0 - 1.0) + 1.0;\n    vec3 c = vec3(0.0);\n    c.b = mod(value, 256.0);\n    value = floor(value / 256.0);\n    c.g = mod(value, 256.0);\n    value = floor(value / 256.0);\n    c.r = mod(value, 256.0);\n    return c / 255.0;\n}\nfloat unpackRGBToInt(const in vec3 rgb) {\n    return (floor(rgb.r * 255.0 + 0.5) * 256.0 * 256.0 + floor(rgb.g * 255.0 + 0.5) * 256.0 + floor(rgb.b * 255.0 + 0.5)) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n    vec2 enc;\n    enc.xy = vec2(fract(v * 256.0), v);\n    enc.y -= enc.x * (1.0 / 256.0);\n    enc.xy *=  256.0 / 255.0;\n\n    return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n    return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n    vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n    p = invProjection * p;\n    return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0,  256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n    vec4 r = vec4(fract(v * PackFactors), v);\n    r.yzw -= r.xyz * ShiftRight8;
139 // tidy overflow\n    return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n    return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n    return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n    return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n    return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n    return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n    return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n    return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n    // transpose\n\n    float transpose(const in float m) {\n        return m;\n    }\n\n    mat2 transpose2(const in mat2 m) {\n        return mat2(\n            m[0][0], m[1][0],\n            m[0][1], m[1][1]\n        );\n    }\n\n    mat3 transpose3(const in mat3 m) {\n        return mat3(\n            m[0][0], m[1][0], m[2][0],\n            m[0][1], m[1][1], m[2][1],\n            m[0][2], m[1][2], m[2][2]\n        );\n    }\n\n    mat4 transpose4(const in mat4 m) {\n        return mat4(\n            m[0][0], m[1][0], m[2][0], m[3][0],\n            m[0][1], m[1][1], m[2][1], m[3][1],\n            m[0][2], m[1][2], m[2][2], m[3][2],\n            m[0][3], m[1][3], m[2][3], m[3][3]\n        );\n    }\n\n    // inverse\n\n    float inverse(const in float m) {\n        return 1.0 / m;\n    }\n\n    mat2 inverse2(const in mat2 m) {\n        return mat2(m[1][1],-m[0][1],\n                -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n    }\n\n    mat3 inverse3(const in mat3 m) {\n        float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n        float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n        float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n        float b01 = a22 * a11 - a12 * a21;\n        float b11 = -a22 * a10 + a12 * a20;\n        float b21 = a21 * a10 - a11 * a20;\n\n        float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n        return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n                    b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n                    b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n    }\n\n    mat4 inverse4(const in mat4 m) {\n        float\n            a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n            a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n            a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n            a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n            b00 = a00 * a11 - a01 * a10,\n            b01 = a00 * a12 - a02 * a10,\n            b02 = a00 * a13 - a03 * a10,\n            b03 = a01 * a12 - a02 * a11,\n            b04 = a01 * a13 - a03 * a11,\n            b05 = a02 * a13 - a03 * a12,\n            b06 = a20 * a31 - a21 * a30,\n            b07 = a20 * a32 - a22 * a30,\n            b08 = a20 * a33 - a23 * a30,\n            b09 = a21 * a32 - a22 * a31,\n            b10 = a21 * a33 - a23 * a31,\n            b11 = a22 * a33 - a23 * a32,\n\n            det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n        return mat4(\n            a11 * b11 - a12 * b10 + a13 * b09,\n            a02 * b10 - a01 * b11 - a03 * b09,\n            a31 * b05 - a32 * b04 + a33 * b03,\n            a22 * b04 - a21 * b05 - a23 * b03,\n            a12 * b08 - a10 * b11 - a13 * b07,\n            a00 * b11 - a02 * b08 + a03 * b07,\n            a32 * b02 - a30 * b05 - a33 * b01,\n            a20 * b05 - a22 * b02 + a23 * b01,\n            a10 * b10 - a11 * b08 + a13 * b06,\n            a01 * b08 - a00 * b10 - a03 * b06,\n            a30 * b04 - a31 * b02 + a33 * b00,\n            a21 * b02 - a20 * b04 - a23 * b00,\n            a11 * b07 - a10 * b09 - a12 * b06,\n            a00 * b09 - a01 * b07 + a02 * b06,\n            a31 * b01 - a30 * b03 - a32 * b00,\n            a20 * b03 - a21 * b01 + a22 * b00) / det;\n    }\n\n    #define isNaN(x) ((x) != (x))\n    #define isInf(x) ((x) == (x) + 1.0)\n#else\n    #define transpose2(m) transpose(m)\n    #define transpose3(m) transpose(m)\n    #define transpose4(m) transpose(m)\n\n    #define inverse2(m) inverse(m)\n    #define inverse3(m) inverse(m)\n    #define inverse4(m) inverse(m)\n\n    #define isNaN isnan\n    #define isInf isinf\n#endif\n",float_to_rgba:"\n    // floatToRgba adapted from https://github.com/equinor/glsl-float-to-rgba\n    // MIT License, Copyright (c) 2020 Equinor\n\n    float shiftRight (float v, float amt) {\n    v = floor(v) + 0.5;\n    return floor(v / exp2(amt));\n    }\n    float shiftLeft (float v, float amt) {\n        return floor(v * exp2(amt) + 0.5);\n    }\n    float maskLast (float v, float bits) {\n        return mod(v, shiftLeft(1.0, bits));\n    }\n    float extractBits (float num, float from, float to) {\n        from = floor(from + 0.5); to = floor(to + 0.5);\n        return maskLast(shiftRight(num, from), to - from);\n    }\n\n    vec4 floatToRgba(float texelFloat, bool littleEndian) {\n        if (texelFloat == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);\n        float sign = texelFloat > 0.0 ? 0.0 : 1.0;\n        texelFloat = abs(texelFloat);\n        float exponent = floor(log2(texelFloat));\n        float biased_exponent = exponent + 127.0;\n        float fraction = ((texelFloat / exp2(exponent)) - 1.0) * 8388608.0;
139\n        float t = biased_exponent / 2.0;\n        float last_bit_of_biased_exponent = fract(t) * 2.0;\n        float remaining_bits_of_biased_exponent = floor(t);\n        float byte4 = extractBits(fraction, 0.0, 8.0) / 255.0;\n        float byte3 = extractBits(fraction, 8.0, 16.0) / 255.0;\n        float byte2 = (last_bit_of_biased_exponent * 128.0 + extractBits(fraction, 16.0, 23.0)) / 255.0;\n        float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\n        return (\n            littleEndian\n                ? vec4(byte4, byte3, byte2, byte1)\n                : vec4(byte1, byte2, byte3, byte4)\n        );\n    }\n",light_frag_params:"\n#if dLightCount != 0\n    uniform vec3 uLightDirection[dLightCount];\n    uniform vec3 uLightColor[dLightCount];\n#endif\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n    vec3 diffuseColor;\n    float roughness;\n    vec3 specularColor;\n    float specularF90;\n};\n\nstruct IncidentLight {\n    vec3 color;\n    vec3 direction;\n};\n\nstruct ReflectedLight {\n    vec3 directDiffuse;\n    vec3 directSpecular;\n    vec3 indirectDiffuse;\n    vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n    vec3 position;\n    vec3 normal;\n    vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n    return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n    // Original approximation by Christophe Schlick '94\n    // float fresnel = pow( 1.0 - dotVH, 5.0 );\n    // Optimized variant (presented by Epic at SIGGRAPH '13)\n    // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n    float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n    return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n    float a2 = pow2(alpha);\n    float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n    float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n    return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney’s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n    float a2 = pow2(alpha);\n    float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n    return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\
139n    float alpha = pow2(roughness); // UE4's roughness\n    vec3 halfDir = normalize( lightDir + viewDir);\n    float dotNL = saturate(dot(normal, lightDir));\n    float dotNV = saturate(dot(normal, viewDir));\n    float dotNH = saturate(dot(normal, halfDir));\n    float dotVH = saturate(dot(viewDir, halfDir));\n    vec3 F = F_Schlick(f0, f90, dotVH);\n    float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n    float D = D_GGX(alpha, dotNH);\n    return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n    float dotNV = saturate(dot(normal, viewDir));\n    const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n    const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n    vec4 r = roughness * c0 + c1;\n    float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n    vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n    return fab;\n}\n\n// Fdez-Agüera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n    vec2 fab = DFGApprox(normal, viewDir, roughness);\n    vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n    float Ess = fab.x + fab.y;\n    float Ems = 1.0 - Ess;\n    vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n    vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n    singleScatter += FssEss;\n    multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n    float dotNL = saturate(dot(geometry.normal, directLight.direction));\n    vec3 irradiance = dotNL * directLight.color;\n    reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n    reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n    reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n    // Both indirect specular and indirect diffuse light accumulate here\n    vec3 singleScattering = vec3(0.0);\n    vec3 multiScattering = vec3(0.0);\n    vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n    computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n    vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n    reflectedLight.indirectSpecular += radiance * singleScattering;\n    reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n    reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n",matrix_scale:"\nfloat matrixScale(in mat4 m){\n    vec4 r = m[0];\n    return sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);\n}\n",normal_frag_params:"\nvarying vec3 vNormal;\n",read_from_texture:"\nvec4 readFromTexture(const in sampler2D tex, const in float i, const in vec2 dim) {\n    float x = intMod(i, dim.x);\n    float y = floor(intDiv(i, dim.x));\n    vec2 uv = (vec2(x, y) + 0.5) / dim;\n    return texture2D(tex, uv);\n}\n\nvec4 readFromTexture(const in sampler2D tex, const in int i, const in vec2 dim) {\n    int x = imod(i, int(dim.x));\n    int y = i / int(dim.x);\n    vec2 uv = (vec2(x, y) + 0.5) / dim;\n    return texture2D(tex, uv);\n}\n",rgba_to_float:'\n    // rgbaToFloat adapted from https://github.com/ihmeuw/glsl-rgba-to-float\n    // BSD 3-Clause License\n    //\n    // Copyright (c) 2019, Institute for Health Metrics and Evaluation All rights reserved.\n    // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n    //  - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n    //  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n    //  - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n    //\n    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n    // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n    // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n    // OR CONSEQUENTIAL DAMAGES (
139INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n    // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n    // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n    // OF THE POSSIBILITY OF SUCH DAMAGE.\n\n    ivec4 floatsToBytes(vec4 inputFloats, bool littleEndian) {\n        ivec4 bytes = ivec4(inputFloats * 255.0);\n        return (\n            littleEndian\n                ? bytes.abgr\n                : bytes\n        );\n    }\n\n    // Break the four bytes down into an array of 32 bits.\n    void bytesToBits(const in ivec4 bytes, out bool bits[32]) {\n        for (int channelIndex = 0; channelIndex < 4; ++channelIndex) {\n            float acc = float(bytes[channelIndex]);\n            for (int indexInByte = 7; indexInByte >= 0; --indexInByte) {\n                float powerOfTwo = exp2(float(indexInByte));\n                bool bit = acc >= powerOfTwo;\n                bits[channelIndex * 8 + (7 - indexInByte)] = bit;\n                acc = mod(acc, powerOfTwo);\n            }\n        }\n    }\n\n    // Compute the exponent of the 32-bit float.\n    float getExponent(bool bits[32]) {\n        const int startIndex = 1;\n        const int bitStringLength = 8;\n        const int endBeforeIndex = startIndex + bitStringLength;\n        float acc = 0.0;\n        int pow2 = bitStringLength - 1;\n        for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n            acc += float(bits[bitIndex]) * exp2(float(pow2--));\n        }\n        return acc;\n    }\n\n    // Compute the mantissa of the 32-bit float.\n    float getMantissa(bool bits[32], bool subnormal) {\n        const int startIndex = 9;\n        const int bitStringLength = 23;\n        const int endBeforeIndex = startIndex + bitStringLength;\n        // Leading/implicit/hidden bit convention:\n        // If the number is not subnormal (with exponent 0), we add a leading 1 digit.\n        float acc = float(!subnormal) * exp2(float(bitStringLength));\n        int pow2 = bitStringLength - 1;\n        for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n            acc += float(bits[bitIndex]) * exp2(float(pow2--));\n        }\n        return acc;\n    }\n\n    // Parse the float from its 32 bits.\n    float bitsToFloat(bool bits[32]) {\n        float signBit = float(bits[0]) * -2.0 + 1.0;\n        float exponent = getExponent(bits);\n        bool subnormal = abs(exponent - 0.0) < 0.01;\n        float mantissa = getMantissa(bits, subnormal);\n        float exponentBias = 127.0;\n        return signBit * mantissa * exp2(exponent - exponentBias - 23.0);\n    }\n\n    float rgbaToFloat(vec4 texelRGBA, bool littleEndian) {\n        ivec4 rgbaBytes = floatsToBytes(texelRGBA, littleEndian);\n        bool bits[32];\n        bytesToBits(rgbaBytes, bits);\n        return bitsToFloat(bits);\n    }\n',size_vert_params:"\n#if defined(dSizeType_uniform)\n    uniform float uSize;\n#elif defined(dSizeType_attribute)\n    attribute float aSize;\n#elif defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n    uniform vec2 uSizeTexDim;\n    uniform sampler2D tSize;\n#endif\n\nuniform float uSizeFactor;\n",texture3d_from_1d_trilinear:"\nvec4 texture3dFrom1dTrilinear(const in sampler2D tex, const in vec3 pos, const in vec3 gridDim, const in vec2 texDim, const in float offset) {\n    float gdYZ = gridDim.z * gridDim.y;\n    float gdZ = gridDim.z;\n    vec3 p0 = floor(pos * gridDim);\n    vec3 p1 = ceil(pos * gridDim);\n    vec3 pd = (pos * gridDim - p0) / (p1 - p0);\n    vec4 s000 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s100 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s001 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s101 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s010 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s110 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s011 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s111 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s00 = mix(s000, s100, pd.x);\n    vec4 s01 = mix(s001, s101, pd.x);\n    vec4 s10 = mix(s010, s110, pd.x);\n    vec4 s11 = mix(s011, s111, pd.x);\n    vec4 s0 = mix(s00, s10, pd.y);\n    vec4 s1 = mix(s01, s11, pd.y);\n    return mix(s0, s1, pd.z);\n}\n",texture3d_from_2d_linear:"\nvec4 texture3dFrom2dLinear(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice0 = floor(pos.z * gridDim.z);\n    float column0 = intMod(zSlice0 * gridDim.x, texDim.x) / gridDim.x;\n    float row0 = floor(intDiv(zSlice0 * gridDim.x, texDim.x));\n    vec2 coord0 = (vec2(column0 * gridDim.x, row0 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n    vec4 color0 = texture2D(tex, coord0);\n\n    float zSlice1 = zSlice0 + 1.0;\n    float column1 = intMod(zSlice1 * gridDim.x, texDim.x) / gridDim.x;\n    float row1 = floor(intDiv(zSlice1 * gridDim.x, texDim.x));\n    vec2 coord1 = (vec2(column1 * gridDim.x, row1 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n    vec4 color1 = texture2D(tex, coord1);\n\n    float delta0 = abs((pos.z * gridDim.z) - zSlice0);\n    return mix(color0, color1, delta0);\n}\n",texture3d_from_2d_nearest:"\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n    float column = intMod(zSlice * gridDim.x, texDim.x) / gridDim.x;\n    float row = floor(intDiv(zSlice * gridDim.x, texDim.x));\n    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n    return texture2D(tex, coord);\n}\n",wboit_write:"\n#if defined(dRenderVariant_colorWboit)\n    if (uRenderMask == MaskOpaque) {\n        if (preFogAlpha < 1.0) {\n            discard;\n        }\n    } else if (uRenderMask == MaskTransparent) {\n        if (preFogAlpha != 1.0 && fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {\n            #ifdef dTransparentBackfaces_off\n                if (interior) discard;\n            #endif\n            float alpha = gl_FragColor.a;\n            float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n            gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n            // extra alpha is to handle pre-multiplied alpha\n            #ifndef dGeometryType_directVolume\n                gl_FragData[1] = vec4((uTransparentBackgroun
139d ? alpha : 1.0) * alpha * wboitWeight);\n            #else\n                gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n            #endif\n        } else {\n            discard;\n        }\n    }\n#endif\n",dpoit_write:"\n#if defined(dRenderVariant_colorDpoit)\n    if (uRenderMask == MaskOpaque) {\n        if (preFogAlpha < 1.0) {\n            discard;\n        }\n    } else if (uRenderMask == MaskTransparent) {\n        vec2 coords = gl_FragCoord.xy / uDrawingBufferSize;\n        if (preFogAlpha != 1.0 && fragmentDepth < getDepth(coords)) {\n            #ifdef dTransparentBackfaces_off\n                if (interior) discard;\n            #endif\n\n            // adapted from https://github.com/tsherif/webgl2examples\n            // The MIT License, Copyright 2017 Tarek Sherif, Shuai Shao\n\n            vec2 lastDepth = texture2D(tDpoitDepth, coords).rg;\n            vec4 lastFrontColor = texture2D(tDpoitFrontColor, coords);\n\n            vec4 fragColor = gl_FragColor;\n\n            // depth value always increases\n            // so we can use MAX blend equation\n            gl_FragData[2].rg = vec2(-MAX_DPOIT_DEPTH);\n\n            // front color always increases\n            // so we can use MAX blend equation\n            gl_FragColor = lastFrontColor;\n\n            // back color is separately blend afterwards each pass\n            gl_FragData[1] = vec4(0.0);\n\n            float nearestDepth = -lastDepth.x;\n            float furthestDepth = lastDepth.y;\n            float alphaMultiplier = 1.0 - lastFrontColor.a;\n\n            if (fragmentDepth < nearestDepth || fragmentDepth > furthestDepth) {\n                // Skip this depth since it's been peeled.\n                return;\n            }\n\n            if (fragmentDepth > nearestDepth && fragmentDepth < furthestDepth) {\n                // This needs to be peeled.\n                // The ones remaining after MAX blended for\n                // all need-to-peel will be peeled next pass.\n                gl_FragData[2].rg = vec2(-fragmentDepth, fragmentDepth);\n                return;\n            }\n\n            // write to back and front color buffer\n            if (fragmentDepth == nearestDepth) {\n                gl_FragColor.rgb += fragColor.rgb * fragColor.a * alphaMultiplier;\n                gl_FragColor.a = 1.0 - alphaMultiplier * (1.0 - fragColor.a);\n            } else {\n                gl_FragData[1] += fragColor;\n            }\n\n        } else {\n            discard;\n        }\n    }\n#endif\n"},ik=/^(?!\/\/)\s*#include\s+(\S+)/gm,ak=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*\+\+i\s*\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g,ok=/[ \t]*\/\/.*\n/g,sk=/[ \t]*\/\*[\s\S]*?\*\//g,uk=/\n{2,}/g;function ck(e){return e.replace(ik,function(e,t){var r=nk[t];if(!r)throw Error(`empty chunk, '${t}'`);return r}).trim().replace(ok,"\n").replace(sk,"\n").replace(uk,"\n")}function lk(e,t,r,n){for(var i="",a=parseInt(t);a<parseInt(r);++a)i+=n.replace(/\[\s*i\s*\]/g,`[${a}]`).replace(/UNROLLED_LOOP_INDEX/g,`${a}`);return i}function dk(e,t){return function(e){return e.replace(ak,lk)}(function(e,t){return t.dLightCount&&(e=e.replace(/dLightCount/g,`${t.dLightCount.ref.value}`)),t.dClipObjectCount&&(e=e.replace(/dClipObjectCount/g,`${t.dClipObjectCount.ref.value}`)),e}(e,t))}function fk(e,t,r,n,i,a){return void 0===n&&(n={}),void 0===i&&(i={}),{id:rk(),name:e,vert:ck(t),frag:ck(r),extensions:n,outTypes:i,ignoreDefine:a}}function hk(e,t,r){return t.startsWith("color")?"dLightCount"===e&&!!r.dIgnoreLight?.ref.value:["dColorType","dUsePalette","dLightCount","dXrayShaded","dOverpaintType","dOverpaint","dSubstanceType","dSubstance","dColorMarker"].includes(e)}function pk(e,t,r){return"dLightCount"===e||hk(e,t,r)}var mk=fk("points","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nattribute vec3 aPosition;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nvoid main(){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_position\n    #include assign_size\n\n    #ifdef dPointSizeAttenuation\n        gl_PointSize = size * uPixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 5.0;\n    #else\n        gl_PointSize = size * uPixelRatio;\n    #endif\n    gl_PointSize = max(1.0, gl_PointSize);\n\n    gl_Position = uProjection * mvPosition;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nconst vec2 center = vec2(0.5);\nconst float radius = 0.5;\n\nvoid main(){\n    #include clip_pixel\n\n    float fragmentDepth = gl_FragCoord.z;\n    #include assign_material_color\n\n    #if defined(dPointStyle_circle)\n        float dist = distance(gl_PointCoord, center);\n        if (dist > radius) discard;\n    #elif defined(dPointStyle_fuzzy)\n        float dist = distance(gl_PointCoord, center);\n        float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n        if (fuzzyAlpha < 0.0001) discard;\n    #endif\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vObject;\n            gl_FragData[1] = vInstance;\n            gl_FragData[2] = vGroup;\n            gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n        #else\n            gl_FragColor = vColor;\n        #endif\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_marking)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        gl_FragColor = material;\n\n        #if defined(dPointStyle_fuzzy)\n            gl_FragColor.a *= fuzzyAlpha;\n        #endif\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{drawBuffers:"optional"},{},pk),gk=fk("spheres","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\nuniform mat4 uInvProjection;\nuniform float uIsOrtho;\n\nuniform vec2 uTexDim;\nuniform sampler2D tPositionGroup;\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying float vRadius;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#include matrix_scale\n\n/**\n * Bounding rectangle of a clipped, perspective-projected 3D Sphere.\n * Michael Mara, Morgan McGuire. 2013\n *\n * Specialization by Arseny Kapoulkine, MIT License C
139opyright (c) 2018\n * https://github.com/zeux/niagara\n */\nvoid sphereProjection(const in vec3 p, const in float r, const in vec2 mapping) {\n    vec3 pr = p * r;\n    float pzr2 = p.z * p.z - r * r;\n\n    float vx = sqrt(p.x * p.x + pzr2);\n    float minx = ((vx * p.x - pr.z) / (vx * p.z + pr.x)) * uProjection[0][0];\n    float maxx = ((vx * p.x + pr.z) / (vx * p.z - pr.x)) * uProjection[0][0];\n\n    float vy = sqrt(p.y * p.y + pzr2);\n    float miny = ((vy * p.y - pr.z) / (vy * p.z + pr.y)) * uProjection[1][1];\n    float maxy = ((vy * p.y + pr.z) / (vy * p.z - pr.y)) * uProjection[1][1];\n\n    gl_Position.xy = vec2(maxx + minx, maxy + miny) * -0.5;\n    gl_Position.xy -= mapping * vec2(maxx - minx, maxy - miny) * 0.5;\n    gl_Position.xy *= gl_Position.w;\n}\n\nvoid main(void){\n    vec2 mapping = vec2(1.0, 1.0); // vertices 2 and 5\n    #if __VERSION__ == 100\n        int m = imod(VertexID, 6);\n    #else\n        int m = VertexID % 6;\n    #endif\n    if (m == 0) {\n        mapping = vec2(-1.0, 1.0);\n    } else if (m == 1 || m == 3) {\n        mapping = vec2(-1.0, -1.0);\n    } else if (m == 4) {\n        mapping = vec2(1.0, -1.0);\n    }\n\n    vec4 positionGroup = readFromTexture(tPositionGroup, VertexID / 6, uTexDim);\n    vec3 position = positionGroup.rgb;\n    float group = positionGroup.a;\n\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    vRadius = size * matrixScale(uModelView);\n\n    vec4 position4 = vec4(position, 1.0);\n    vec4 mvPosition = uModelView * aTransform * position4;\n\n    #ifdef dApproximate\n        vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n        mvCorner.xy += mapping * vRadius;\n        gl_Position = uProjection * mvCorner;\n    #else\n        if (uIsOrtho == 1.0) {\n            vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n            mvCorner.xy += mapping * vRadius;\n            gl_Position = uProjection * mvCorner;\n        } else {\n            gl_Position = uProjection * vec4(mvPosition.xyz, 1.0);\n            sphereProjection(mvPosition.xyz, vRadius, mapping);\n        }\n    #endif\n\n    vec4 vPoint4 = uInvProjection * gl_Position;\n    vPoint = vPoint4.xyz / vPoint4.w;\n    vPointViewPosition = -mvPosition.xyz / mvPosition.w;\n\n    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n    if (gl_Position.z < -gl_Position.w) {\n        mvPosition.z -= 2.0 * vRadius; // avoid clipping\n        gl_Position.z = (uProjection * vec4(mvPosition.xyz, 1.0)).z;\n    }\n\n    #if defined(dClipPrimitive) && !defined(dClipVariant_instance) && dClipObjectCount != 0\n        if (clipTest(vec4(vModelPosition.xyz, 0.0))) {\n            // move out of [ -w, +w ] to 'discard' in vert shader\n            gl_Position.z = 2.0 * gl_Position.w;\n        }\n    #else\n        #include clip_instance\n    #endif\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\nuniform float uAlphaThickness;\n\nvarying float vRadius;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#ifdef dSolidInterior\n    const bool solidInterior = true;\n#else\n    const bool solidInterior = false;\n#endif\n\nbool SphereImpostor(out vec3 modelPos, out vec3 cameraPos, out vec3 cameraNormal, out bool interior, out float fragmentDepth){\n    vec3 cameraSpherePos = -vPointViewPosition;\n\n    vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n    vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n    vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n    float B = dot(rayDirection, cameraSphereDir);\n    float det = B * B + vRadius * vRadius - dot(cameraSphereDir, cameraSphereDir);\n\n    if (det < 0.0) return false;\n\n    float sqrtDet = sqrt(det);\n    float posT = mix(B + sqrtDet, B - sqrtDet, uIsOrtho);\n    float negT = mix(B - sqrtDet, B + sqrtDet, uIsOrtho);\n\n    cameraPos = rayDirection * negT + rayOrigin;\n    modelPos = (uInvView * vec4(cameraPos, 1.0)).xyz;\n    fragmentDepth = calcDepth(cameraPos);\n\n    bool objectClipped = false;\n\n    #if !defined(dClipPrimitive) && defined(dClipVariant_pixel) && dClipObjectC
139ount != 0\n        if (clipTest(vec4(modelPos, 0.0))) {\n            objectClipped = true;\n            fragmentDepth = -1.0;\n        }\n    #endif\n\n    if (fragmentDepth > 0.0) {\n        cameraNormal = normalize(cameraPos - cameraSpherePos);\n        interior = false;\n        return true;\n    } else if (uDoubleSided || solidInterior) {\n        cameraPos = rayDirection * posT + rayOrigin;\n        modelPos = (uInvView * vec4(cameraPos, 1.0)).xyz;\n        fragmentDepth = calcDepth(cameraPos);\n        cameraNormal = -normalize(cameraPos - cameraSpherePos);\n        interior = true;\n        if (fragmentDepth > 0.0) {\n            #ifdef dSolidInterior\n                if (!objectClipped) {\n                    fragmentDepth = 0.0 + (0.0000001 / vRadius);\n                    cameraNormal = -mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n                }\n            #endif\n            return true;\n        }\n    }\n\n    return false;\n}\n\nvoid main(void){\n    vec3 cameraNormal;\n    float fragmentDepth;\n\n    #ifdef dApproximate\n        vec3 pointDir = -vPointViewPosition - vPoint;\n        if (dot(pointDir, pointDir) > vRadius * vRadius) discard;\n        vec3 vViewPosition = -vPointViewPosition;\n        fragmentDepth = gl_FragCoord.z;\n        #if !defined(dIgnoreLight) || defined(dXrayShaded)\n            pointDir.z -= cos(length(pointDir) / vRadius);\n            cameraNormal = -normalize(pointDir / vRadius);\n        #endif\n        interior = false;\n    #else\n        vec3 modelPos;\n        vec3 cameraPos;\n        bool hit = SphereImpostor(modelPos, cameraPos, cameraNormal, interior, fragmentDepth);\n        if (!hit) discard;\n\n        if (fragmentDepth < 0.0) discard;\n        if (fragmentDepth > 1.0) discard;\n\n        gl_FragDepthEXT = fragmentDepth;\n\n        vec3 vModelPosition = modelPos;\n        vec3 vViewPosition = cameraPos;\n    #endif\n\n    #if !defined(dClipPrimitive) && defined(dClipVariant_pixel) && dClipObjectCount != 0\n        #include clip_pixel\n    #endif\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vObject;\n            gl_FragData[1] = vInstance;\n            gl_FragData[2] = vGroup;\n            gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n        #else\n            gl_FragColor = vColor;\n        #endif\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_marking)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        vec3 normal = -cameraNormal;\n        #include apply_light_color\n\n        if (uRenderMask == MaskTransparent && uAlphaThickness > 0.0) {\n            gl_FragColor.a *= min(1.0, vRadius / uAlphaThickness);\n        }\n\n        #include apply_interior_color\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"},{},hk),vk=fk("cylinders","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec3 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\nattribute float aScale;\nattribute float aCap;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform float uIsOrtho;\nuniform vec3 uCameraDir;\n\nvoid main() {\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    mat4 modelTransform = uModel * aTransform;\n\n    vTransform = aTransform;\n    vStart = (modelTransform * vec4(aStart, 1.0)).xyz;\n    vEnd = (modelTransform * vec4(aEnd, 1.0)).xyz;\n    vSize = size * aScale;\n    vCap = aCap;\n\n    vModelPosition = (vStart + vEnd) * 0.5;\n    vec3 camDir = -mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n    vec3 dir = vEnd - vStart;\n    // ensure cylinder 'dir' is pointing towards the camera\n    if(dot(camDir, dir) < 0.0) {\n        dir = -dir;\n    }\n\n    vec3 left = cross(camDir, dir);\n    vec3 up = cross(left, dir);\n    left = vSize * normalize(left);\n    up = vSize * normalize(up);\n\n    // move vertex in object-space from center to corner\n    vModelPosition += aMapping.x * dir + aMapping.y * left + aMapping.z * up;
139\n\n    vec4 mvPosition = uView * vec4(vModelPosition, 1.0);\n    vViewPosition = mvPosition.xyz;\n    gl_Position = uProjection * mvPosition;\n\n    if (gl_Position.z < -gl_Position.w) {\n        mvPosition.z -= 2.0 * (length(vEnd - vStart) + vSize); // avoid clipping\n        gl_Position.z = (uProjection * mvPosition).z;\n    }\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\nuniform mat4 uInvView;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n#ifdef dSolidInterior\n    const bool solidInterior = true;\n#else\n    const bool solidInterior = false;\n#endif\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n    in vec3 rayOrigin, in vec3 rayDir,\n    in vec3 start, in vec3 end, in float radius,\n    out vec3 cameraNormal, out bool interior,\n    out vec3 modelPosition, out vec3 viewPosition, out float fragmentDepth\n){\n    vec3 ba = end - start;\n    vec3 oc = rayOrigin - start;\n\n    float baba = dot(ba, ba);\n    float bard = dot(ba, rayDir);\n    float baoc = dot(ba, oc);\n\n    float k2 = baba - bard * bard;\n    float k1 = baba * dot(oc, rayDir) - baoc * bard;
139\n    float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n    float h = k1 * k1 - k2 * k0;\n    if (h < 0.0) return false;\n\n    bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n    bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n    #ifdef dSolidInterior\n        bool topInterior = !topCap;\n        bool bottomInterior = !bottomCap;\n        topCap = true;\n        bottomCap = true;\n    #else\n        bool topInterior = false;\n        bool bottomInterior = false;\n    #endif\n\n    bool clipped = false;\n    bool objectClipped = false;\n\n    // body outside\n    h = sqrt(h);\n    float t = (-k1 - h) / k2;\n    float y = baoc + t * bard;\n    if (y > 0.0 && y < baba) {\n        interior = false;\n        cameraNormal = (oc + t * rayDir - ba * y / baba) / radius;\n        modelPosition = rayOrigin + t * rayDir;\n        viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n        fragmentDepth = calcDepth(viewPosition);\n        #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n            if (clipTest(vec4(modelPosition, 0.0))) {\n                objectClipped = true;\n                fragmentDepth = -1.0;\n                #ifdef dSolidInterior\n                    topCap = !topInterior;\n                    bottomCap = !bottomInterior;\n                #endif\n            }\n        #endif\n        if (fragmentDepth > 0.0) return true;\n        clipped = true;\n    }\n\n    if (!clipped) {\n        if (topCap && y < 0.0) {\n            // top cap\n            t = -baoc / bard;\n            if (abs(k1 + k2 * t) < h) {\n                interior = topInterior;\n                cameraNormal = -ba / baba;\n                modelPosition = rayOrigin + t * rayDir;\n                viewPosition = (uView * vec4(modelPosition, 1.0
139)).xyz;\n                fragmentDepth = calcDepth(viewPosition);\n                #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n                    if (clipTest(vec4(modelPosition, 0.0))) {\n                        objectClipped = true;\n                        fragmentDepth = -1.0;\n                        #ifdef dSolidInterior\n                            topCap = !topInterior;\n                            bottomCap = !bottomInterior;\n                        #endif\n                    }\n                #endif\n                if (fragmentDepth > 0.0) {\n                    #ifdef dSolidInterior\n                        if (interior) cameraNormal = -rayDir;\n                    #endif\n                    return true;\n                }\n            }\n        } else if (bottomCap && y >= 0.0) {\n            // bottom cap\n            t = (baba - baoc) / bard;\n            if (abs(k1 + k2 * t) < h) {\n                interior = bottomInterior;\n                cameraNormal = ba / baba;\n                modelPosition = rayOrigin + t * rayDir;\n                viewPosition = (uView * vec4(modelPosition, 1.0
139)).xyz;\n                fragmentDepth = calcDepth(viewPosition);\n                #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n                    if (clipTest(vec4(modelPosition, 0.0))) {\n                        objectClipped = true;\n                        fragmentDepth = -1.0;\n                        #ifdef dSolidInterior\n                            topCap = !topInterior;\n                            bottomCap = !bottomInterior;\n                        #endif\n                    }\n                #endif\n                if (fragmentDepth > 0.0) {\n                    #ifdef dSolidInterior\n                        if (interior) cameraNormal = -rayDir;\n                    #endif\n                    return true;\n                }\n            }\n        }\n    }\n\n    if (uDoubleSided || solidInterior) {\n        // body inside\n        h = -h;\n        t = (-k1 - h) / k2;\n        y = baoc + t * bard;\n        if (y > 0.0 && y < baba) {\n            interior = true;\n            cameraNormal = -(oc + t * rayDir - ba * y / baba) / radius;\n            modelPosition = rayOrigin + t * rayDir;
139\n            viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n            fragmentDepth = calcDepth(viewPosition);\n            if (fragmentDepth > 0.0) {\n                #ifdef dSolidInterior\n                    if (!objectClipped) {\n                        fragmentDepth = 0.0 + (0.0000002 / vSize);\n                        cameraNormal = -rayDir;\n                    }\n                #endif\n                return true;\n            }\n        }\n\n        if (topCap && y < 0.0) {\n            // top cap\n            t = -baoc / bard;\n            if (abs(k1 + k2 * t) < -h) {\n                interior = true;\n                cameraNormal = ba / baba;\n                modelPosition = rayOrigin + t * rayDir;\n                viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n                fragmentDepth = calcDepth(viewPosition);\n                if (fragmentDepth > 0.0) {\n                    #ifdef dSolidInterior\n                        if (!objectClipped) {\n                            fragmentDepth = 0.0 + (0.0000002 / vSize);\n                            cameraNormal = -rayDir;\n                        }\n                    #endif\n                    return true;\n                }\n            }\n        } else if (bottomCap && y >= 0.0) {\n            // bottom cap\n            t = (baba - baoc) / bard;\n            if (abs(k1 + k2 * t) < -h) {\n                interior = true;\n                cameraNormal = -ba / baba;\n                modelPosition = rayOrigin + t * rayDir;\n                viewPosition = (uView * vec4(modelPosition, 1.0
139)).xyz;\n                fragmentDepth = calcDepth(viewPosition);\n                if (fragmentDepth > 0.0) {\n                    #ifdef dSolidInterior\n                        if (!objectClipped) {\n                            fragmentDepth = 0.0 + (0.0000002 / vSize);\n                            cameraNormal = -rayDir;\n                        }\n                    #endif\n                    return true;\n                }\n            }\n        }\n    }\n\n    return false;\n}\n\nvoid main() {\n    vec3 rayOrigin = vModelPosition;\n    vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n    vec3 cameraNormal;\n    vec3 modelPosition;\n    vec3 viewPosition;\n    float fragmentDepth;\n    bool hit = CylinderImpostor(rayOrigin, rayDir, vStart, vEnd, vSize, cameraNormal, interior, modelPosition, viewPosition, fragmentDepth);\n    if (!hit) discard;\n\n    if (fragmentDepth < 0.0) discard;\n    if (fragmentDepth > 1.0) discard;\n\n    gl_FragDepthEXT = fragmentDepth;\n\n    vec3 vViewPosition = viewPosition;\n    vec3 vModelPosition = modelPosition;\n\n    #include clip_pixel\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vObject;\n            gl_FragData[1] = vInstance;\n            gl_FragData[2] = vGroup;\n            gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n        #else\n            gl_FragColor = vColor;\n        #endif\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_marking)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n        vec3 normal = normalize(normalMatrix * -normalize(cameraNormal));\n        #include apply_light_color\n\n        #include apply_interior_color\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"},{},hk),yk=fk("text","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute vec3 aPosition;\nattribute vec2 aMapping;\nattribute float aDepth;\nattribute vec2 aTexCoord;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nuniform float uOffsetX;\nuniform float uOffsetY;\nuniform float uOffsetZ;\n\nuniform float uIsOrtho;\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nvarying vec2 vTexCoord;\n\n#include matrix_scale\n\nvoid main(void){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    vTexCoord = aTexCoord;\n\n    float scale = matrixScale(uModelView);\n\n    float offsetX = uOffsetX * scale;\n    float offsetY = uOffsetY * scale;\n    float offsetZ = (uOffsetZ + aDepth * 0.95) * scale;
139\n\n    vec4 position4 = vec4(aPosition, 1.0);\n    vec4 mvPosition = uModelView * aTransform * position4;\n\n    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n    // TODO\n    // #ifdef FIXED_SIZE\n    //     if (ortho) {\n    //         scale /= pixelRatio * ((uViewport.w / 2.0) / -uCameraPosition.z) * 0.1;\n    //     } else {\n    //         scale /= pixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 0.1;\n    //     }\n    // #endif\n\n    vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n\n    if (vTexCoord.x == 10.0) { // indicates background plane\n        // move a bit to the back, taking distance to camera into account to avoid z-fighting\n        offsetZ -= 0.001 * distance(uCameraPosition, (uProjection * mvCorner).xyz);\n    }\n\n    mvCorner.xy += aMapping * size * scale;\n    mvCorner.x += offsetX;\n    mvCorner.y += offsetY;\n\n    if (uIsOrtho == 1.0) {\n        mvCorner.z += offsetZ;\n    } else {\n        mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;\n    }\n\n    gl_Position = uProjection * mvCorner;\n\n    vViewPosition = -mvCorner.xyz;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;
139\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n    #include clip_pixel\n\n    float fragmentDepth = gl_FragCoord.z;\n    #include assign_material_color\n\n    if (vTexCoord.x > 1.0) {\n        #if defined(dRenderVariant_color)\n            material = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n        #endif\n    } else {\n        // retrieve signed distance\n        float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n        // perform adaptive anti-aliasing of the edges\n        float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n        float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n        // gamma correction for linear attenuation\n        a = pow(a, 1.0 / gamma);\n\n        if (a < 0.5) discard;\n\n        #if defined(dRenderVariant_color)\n            material.a *= a;\n\n            // add border\n            float t = 0.5 + uBorderWidth;\n            if (uBorderWidth > 0.0 && sdf < t) {\n                material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n            }\n        #endif\n    }\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vObject;\n            gl_FragData[1] = vInstance;\n            gl_FragData[2] = vGroup;\n            gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n        #else\n            gl_FragColor = vColor;\n        #endif\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_marking)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        gl_FragColor = material;\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{drawBuffers:"optional"},{},pk),bk=fk("lines","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec2 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\n\nvoid trimSegment(const in vec4 start, inout vec4 end) {\n    // trim end segment so it terminates between the camera plane and the near plane\n    // conservative estimate of the near plane\n    float a = uProjection[2][2];  // 3rd entry in 3rd column\n    float b = uProjection[3][2];  // 3rd entry in 4th column\n    float nearEstimate = -0.5 * b / a;\n    float alpha = (nearEstimate - start.z) / (end.z - start.z);\n    end.xyz = mix(start.xyz, end.xyz, alpha);\n}\n\nvoid main(){\n    float aspect = uViewport.z / uViewport.w;\n\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    mat4 modelView = uView * uModel * aTransform;\n\n    // camera space\n    vec4 start = modelView * vec4(aStart, 1.0);\n    vec4 end = modelView * vec4(aEnd, 1.0);\n\n    // assign position\n    vec4 position4 = vec4((aMapping.y < 0.5) ? aStart : aEnd, 1.0);\n    vec4 mvPosition = modelView * position4;\n    vViewPosition = mvPosition.xyz;\n\n    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n    // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n    // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n    // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n    // perhaps there is a more elegant solution -- WestLangley\n    bool perspective = (uProjection[2][3] == -1.0); // 4th entry in the 3rd column\n    if (perspective) {\n        if (start.z < 0.0 && end.z >= 0.0) {\n            trimSegment(start, end);\n        } else if (end.z < 0.0 && start.z >= 0.0) {\n            trimSegment(end, start);\n        }\n    }\n\n    // clip space\n    vec4 clipStart = uProjection * start;\n    vec4 clipEnd = uProjection * end;\n\n    // ndc space\n    vec2 ndcStart = clipStart.xy / clipStart.w;\n    vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n    // direction\n    vec2 dir = ndcEnd - ndcStart;\n\n    // account for clip-space aspect ratio\n    dir.x *= aspect;\n    dir = normalize(dir);\n\n    // perpendicular to dir\n    vec2 offset = vec2(dir.y, - dir.x);\n\n    // undo aspect ratio adjustment\n    dir.x /= aspect;\n    offset.x /= aspect;\n\n    // sign flip\n    if (aMapping.x < 0.0) offset *= -1.0;\n\n    // calculate linewidth\n    float linewidth;\n    #ifdef dLineSizeAttenuation\n        linewidth = size * uPixelRatio * ((uViewport.w / 2.0) / -start.z) * 5.0;\n    #else\n        linewidth = size * uPixelRatio;\n    #endif\n    linewidth = max(1.0, linewidth);\n\n    // adjust for linewidth\n    offset *= linewidth;\n\n    // adjust for clip-space to screen-space conversion\n    offset /= uViewport.w;\n\n    // select end\n    vec4 clip = (aMapping.y < 0.5) ? clipStart : clipEnd;\n\n    // back to clip space\n    offset *= clip.w;\n    clip.xy += offset;\n    gl_Position = clip;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n    #include clip_pixel\n\n    float fragmentDepth = gl_FragCoord.z;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vObject;\n            gl_FragData[1] = vInstance;\n            gl_FragData[2] = vGroup;\n            gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n        #else\n            gl_FragColor = vColor;\n        #endif\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_marking)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        gl_FragColor = material;\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{drawBuffers:"optional"},{},pk),_k=fk("mesh","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef dGeometryType_textureMesh\n    uniform vec2 uGeoTexDim;\n    uniform sampler2D tPosition;\n    uniform sampler2D tGroup;\n    uniform sampler2D tNormal;\n#else\n    attribute vec3 aPosition;\n    attribute float aGroup;\n    attribute vec3 aNormal;\n#endif\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec3 vNormal;\n\nvoid main(){\n    #include assign_group\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_position\n    #include assign_color_varying\n    #include clip_instance\n\n    #ifdef dGeometryType_textureMesh\n        vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;\n    #else\n        vec3 normal = aNormal;\n    #endif\n    mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));\n    vec3 transformedNormal = normalize(normalMatrix * normalize(normal));\n    #if defined(dFlipSided)\n        if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR\n            transformedNormal = -transformedNormal;\n        }\n    #endif\n    vNormal = transformedNormal;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n    #include clip_pixel\n\n    // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n    vec3 fdx = dFdx(vVie
139wPosition);\n    vec3 fdy = dFdy(vViewPosition);\n    vec3 faceNormal = normalize(cross(fdx,fdy));\n    bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n    #if defined(dFlipSided)\n        interior = frontFacing;\n    #else\n        interior = !frontFacing;\n    #endif\n\n    float fragmentDepth = gl_FragCoord.z;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vObject;\n            gl_FragData[1] = vInstance;\n            gl_FragData[2] = vGroup;\n            gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n        #else\n            gl_FragColor = vColor;\n        #endif\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_marking)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        #if defined(dFlatShaded)\n            vec3 normal = -faceNormal;\n        #else\n            vec3 normal = -normalize(vNormal);\n            if (uDoubleSided) normal *= float(frontFacing) * 2.0 - 1.0;\n        #endif\n        #include apply_light_color\n\n        #include apply_interior_color\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{drawBuffers:"optional"},{},hk),xk=fk("direct-volume","\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform mat4 uModelView;\nuniform mat4 uProjection;\nuniform vec4 uInvariantBoundingSphere;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform vec3 uBboxMax;\nuniform vec3 uGridDim;\nuniform mat4 uTransform;\n\nuniform mat4 uUnitToCartn;\n\nvoid main() {\n    vec4 unitCoord = vec4(aPosition + vec3(0.5), 1.0);\n    vec4 mvPosition = uModelView * aTransform * uUnitToCartn * unitCoord;\n\n    vOrigPos = (aTransform * uUnitToCartn * unitCoord).xyz;\n    vInstance = aInstance;\n    vBoundingSphere = vec4(\n        (aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0)).xyz,\n        uInvariantBoundingSphere.w\n    );\n    vTransform = aTransform;\n\n    gl_Position = uProjection * mvPosition;\n\n    // move z position to near clip plane (but not too close to get precision issues)\n    gl_Position.z = gl_Position.w - 0.01;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n    uniform int uClipObjectType[dClipObjectCount];\n    uniform bool uClipObjectInvert[dClipObjectCount];\n    uniform vec3 uClipObjectPosition[dClipObjectCount];\n    uniform vec4 uClipObjectRotation[dClipObjectCount];\n    uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\n#if defined(dColorMarker)\n    uniform vec3 uHighlightColor;\n    uniform vec3 uSelectColor;\n    uniform vec3 uDimColor;\n    uniform float uHighlightStrength;\n    uniform float uSelectStrength;\n    uniform float uDimStrength;\n    uniform int uMarkerPriority;\n    uniform float uMarkerAverage;\n\n    uniform float uMarker;\n    uniform vec2 uMarkerTexDim;\n    uniform sampler2D tMarker;\n#endif\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform bool uFog;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;
139\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\nuniform float uExposure;\n\nuniform int uRenderMask;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n    // for webgl1 this is given as a 'define'\n    uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n    precision highp sampler2D;\n    uniform sampler2D tGridTex;\n    uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n    precision highp sampler3D;\n    uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n    uniform vec3 uColor;\n#elif defined(dColorType_texture)\n    uniform vec2 uColorTexDim;\n    uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n    #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n        uniform vec2 uOverpaintTexDim;\n        uniform sampler2D tOverpaint;\n    #endif\n#endif\n\n#ifdef dUsePalette\n    uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n    vec4 textureVal(vec3 pos) {\n        return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0
139) / uGridDim), uGridDim, uGridTexDim.xy);\n    }\n    vec4 textureGroup(vec3 pos) {\n        return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n    }\n#elif defined(dGridTexType_3d)\n    vec4 textureVal(vec3 pos) {\n        return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n    }\n    vec4 textureGroup(vec3 pos) {\n        return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n    }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n    vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n    return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n    return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n    #ifdef depthTextureSupport\n        return texture2D(tDepth, coords).r;\n    #else\n        return unpackRGBAToDepth(texture2D(tDepth, coords));\n    #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n    return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n    mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n    mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n    #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n        mat4 modelTransform = uModel * vTransform * uTransform;\n    #endif\n    mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n    vec3 scaleVol = vec3(1.0) / uGridDim;\n    vec3 pos = startLoc;\n    vec4 cell;\n    float prevValue = -1.0;\n    float value = 0.0;\n    vec4 src = vec4(0.0);\n    vec4 dst = vec4(0.0);\n    float fragmentDepth;\n\n    vec3 posMin = vec3(0.0);\n    vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n    vec3 unitPos;\n\n    vec3 nextPos;\n    float nextValue;\n\n    vec4 material;\n    vec4 overpaint;\n    float metalness = uMetalness;\n    float roughness = uRoughness;\n\n    vec3 gradient = vec3(1.0);\n    vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n    vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n    vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n    float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n    float maxDistSq = maxDist * maxDist;\n\n    for (int i = 0; i < uMaxSteps; ++i) {\n        // break when beyond bounding-sphere or far-plane\n        vec3 distVec = startLoc - pos;\n        if (dot(distVec, distVec) > maxDistSq) break;\n\n        unitPos = v3m4(pos, cartnToUnit);\n\n        // continue when outside of grid\n        if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n            unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n        ) {\n            prevValue = value;\n            pos += step;\n            continue;\n        }\n\n        cell = textureVal(unitPos);\n        value = cell.a; // current voxel value\n\n        if (uJumpLength > 0.0 && value < 0.01) {\n            nextPos = pos + rayDir * uJumpLength;\n            nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;
139\n            if (nextValue < 0.01) {\n                prevValue = nextValue;\n                pos = nextPos;\n                continue;\n            }\n        }\n\n        vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n        if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n            break;\n\n        #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n            vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n            if (clipTest(vec4(vModelPosition, 0.0))) {\n                prevValue = value;\n                pos += step;\n                continue;\n            }\n        #endif\n\n        vec3 vViewPosition = mvPosition.xyz;\n        material.a = transferFunction(value);\n\n        #ifdef dPackedGroup\n            float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n        #else\n            vec3 g = floor(unitPos * uGridDim + 0.5);\n            // note that we swap x and z because the texture is flipped around y\n            #if defined(dAxisOrder_012)\n                float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n            #elif defined(dAxisOrder_021)\n                float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n            #elif defined(dAxisOrder_102)\n                float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n            #elif defined(dAxisOrder_120)\n                float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n            #elif defined(dAxisOrder_201)\n                float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n            #elif defined(dAxisOrder_210)\n                float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n            #endif\n        #endif\n\n        #if defined(dColorType_direct) && defined(dUsePalette)\n            material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n        #elif defined(dColorType_uniform)\n            material.rgb = uColor;\n        #elif defined(dColorType_instance)\n            material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n        #elif defined(dColorType_group)\n            material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n        #elif defined(dColorType_groupInstance)\n            material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n        #elif defined(dColorType_vertex)\n            material.rgb = texture3dFrom1dTrilinear(tColor, unitPos, uGridDim, uColorTexDim, 0.0).rgb;\n        #elif defined(dColorType_vertexInstance)\n            material.rgb = texture3dFrom1dTrilinear(tColor, unitPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n        #endif\n\n        #ifdef dOverpaint\n            #if defined(dOverpaintType_groupInstance)\n                overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n            #elif defined(dOverpaintType_vertexInstance)\n                overpaint = texture3dFrom1dTrilinear(tOverpaint, unitPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n            #endif\n\n            material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n        #endif\n\n        #ifdef dIgnoreLight\n            gl_FragColor.rgb = material.rgb;\n        #else\n            if (material.a >= 0.01) {\n                #ifdef dPackedGroup\n                    // compute gradient by central differences\n                    gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n                    gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n                    gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n                #else\n                    gradient = cell.xyz * 2.0 - 1.0;\n                #endif\n                vec3 normal = -normalize(normalMatrix * normalize(gradient));\n                #include apply_light_color\n            } else {\n                gl_FragColor.rgb = material.rgb;\n            }\n        #endif\n\n        gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n        #if defined(dColorMarker)\n            float marker = uMarker;\n            if (uMarker == -1.0) {\n                marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n                marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n            }\n        #endif\n        #include apply_marker_color\n\n        preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n        fragmentDepth = calcDepth(mvPosition.xyz);\n        #include apply_fog\n\n        src = gl_FragColor;
139\n\n        if (!uTransparentBackground) {\n            // done in 'apply_fog' otherwise\n            src.rgb *= src.a;\n        }\n        dst = (1.0 - dst.a) * src + dst; // standard blending\n\n        // break if the color is opaque enough\n        if (dst.a > 0.95)\n            break;\n\n        pos += step;\n    }\n\n    return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n    if (gl_FrontFacing)\n        discard;\n\n    vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n    vec3 step = rayDir * uStepScale;\n\n    float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n    float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n    vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n    gl_FragColor = raymarch(start, step, rayDir);\n\n    float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n    float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n    #include wboit_write\n}\n",{fragDepth:"optional",drawBuffers:"optional"},{},hk),Sk=fk("image","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_vert_params\n\nattribute vec3 aPosition;\nattribute vec2 aUv;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\nvoid main() {\n    #include assign_position\n\n    vUv = aUv;\n    vInstance = aInstance;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n    #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n    #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n        #if defined(dInterpolation_catmulrom)\n            const float B = 0.0;\n            const float C = 0.5;\n        #elif defined(dInterpolation_mitchell)\n            const float B = 0.333;\n            const float C = 0.333;\n        #endif\n\n        float cubicFilter(float x){\n            float f = x;\n            if (f < 0.0) {\n                f = -f;\n            }\n            if (f < 1.0) {\n                return ((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            }else if (f >= 1.0 && f < 2.0){\n                return ((-B - 6.0 * C) * ( f * f * f)\n                    + (6.0 * B + 30.0 * C) * (f * f) +\n                    (-(12.0 * B) - 48.0 * C) * f +\n                    8.0 * B + 24.0 * C) / 6.0;\n            }
139else{\n                return 0.0;\n            }\n        }\n    #elif defined(dInterpolation_bspline)\n        float cubicFilter(float x) {\n            float f = x;\n            if (f < 0.0) {\n                f = -f;\n            }\n            if (f >= 0.0 && f <= 1.0){\n                return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n            } else if (f > 1.0 && f <= 2.0) {\n                return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n            }\n            return 1.0;\n        }\n    #endif\n\n    vec4 biCubic(sampler2D tex, vec2 texCoord) {\n        vec2 texelSize = 1.0 / uImageTexDim;\n        texCoord -= texelSize / 2.0;\n        vec4 nSum = vec4(0.0);\n        float nDenom = 0.0;\n        vec2 cell = fract(texCoord * uImageTexDim);\n        for (float m = -1.0; m <= 2.0; ++m) {\n            for (float n = -1.0; n <= 2.0; ++n) {\n                vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n                float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n                nSum += vecData * c;\n                nDenom += c;\n            }\n        }\n        return nSum / nDenom;\n    }\n#endif\n\nvoid main() {\n    #include clip_pixel\n\n    #if defined(dInterpolation_cubic)\n        vec4 imageData = biCubic(tImageTex, vUv);\n    #else\n        vec4 imageData = texture2D(tImageTex, vUv);\n    #endif\n    imageData.a = clamp(imageData.a, 0.0, 1.0);\n    if (imageData.a > 0.9) imageData.a = 1.0;\n\n    float fragmentDepth = gl_FragCoord.z;\n\n    #if defined(dRenderVariant_pick)\n        if (imageData.a < 0.3)\n            discard;\n        #ifdef requiredDrawBuffers\n            gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n            gl_FragData[1] = vec4(packIntToRGB(vInstance), 1.0);\n            gl_FragData[2] = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n            gl_FragData[3] = packDepthToRGBA(gl_FragCoord.z);\n        #else\n            gl_FragColor = vColor;\n            if (uPickType == 1) {\n                gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n            } else if (uPickType == 2) {\n                gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n            } else {\n                gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n            }\n        #endif\n    #elif defined(dRenderVariant_depth)\n        if (imageData.a < 0.05)\n            discard;\n        gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n    #elif defined(dRenderVariant_marking)\n        float marker = uMarker;\n        if (uMarker == -1.0) {\n            float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n            marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n            marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n        }\n        if (uMarkingType == 1) {\n            if (marker > 0.0 || imageData.a < 0.05)\n                discard;\n            gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n        } else {\n            if (marker == 0.0 || imageData.a < 0.05)\n                discard;\n            float depthTest = 1.0;\n            if (uMarkingDepthTest) {\n                depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n            }\n            bool isHighlight = intMod(marker, 2.0) > 0.1;\n            gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n        }\n    #elif defined(dRenderVariant_color)\n        if (imageData.a < 0.05)\n            discard;\n        gl_FragColor = imageData;\n        gl_FragColor.a *= uAlpha;\n\n        float marker = uMarker;\n        if (uMarker == -1.0) {\n            float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n            marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n            marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n        }\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n        #include dpoit_write\n    #endif\n}\n",{drawBuffers:"optional"},{},pk);function wk(e,t){if(void 0===e)return"";var r=e.dRenderVariant?.ref.value||"",n=[];for(var i in e)if(!t?.(i,r,e)){var a=e[i].ref.value;void 0!==a&&("string"==typeof a?n.push(`#define ${i}_${a}`):"number"==typeof a?n.push(`#define ${i} ${a}`):"boolean"==typeof a?a&&n.push(`#define ${i}`):Lg())}return n.join("\n")+"\n"}function Ak(e,t){switch(t){case"b":case"b[]":return e.BOOL;case"f":case"f[]":return e.FLOAT;case"i":case"i[]":return e.INT;case"v2":case"v2[]":return e.FLOAT_VEC2;case"v3":case"v3[]":return e.FLOAT_VEC3;case"v4":case"v4[]":return e.FLOAT_VEC4;case"iv2":case"iv2[]":return e.INT_VEC2;
139case"iv3":case"iv3[]":return e.INT_VEC3;case"iv4":case"iv4[]":return e.INT_VEC4;case"m3":case"m3[]":return e.FLOAT_MAT3;case"m4":case"m4[]":return e.FLOAT_MAT4;default:console.error(`unknown uniform kind '${t}'`)}}function Ck(e,t,r){e.uniform1f(t,r)}function Tk(e,t,r){e.uniform1fv(t,r)}function Pk(e,t,r){e.uniform1i(t,r)}function Ek(e,t,r){e.uniform1iv(t,r)}function Mk(e,t,r){e.uniform2fv(t,r)}function kk(e,t,r){e.uniform3fv(t,r)}function Ik(e,t,r){e.uniform4fv(t,r)}function Dk(e,t,r){e.uniform2iv(t,r)}function Ok(e,t,r){e.uniform3iv(t,r)}function Rk(e,t,r){e.uniform4iv(t,r)}function Bk(e,t,r){e.uniformMatrix3fv(t,!1,r)}function Nk(e,t,r){e.uniformMatrix4fv(t,!1,r)}function Fk(e){switch(e){case"f":return Ck;case"f[]":return Tk;case"i":case"t":case"b":return Pk;case"i[]":case"t[]":case"b[]":return Ek;case"v2":case"v2[]":return Mk;case"v3":case"v3[]":return kk;case"v4":case"v4[]":return Ik;case"iv2":case"iv2[]":return Dk;case"iv3":case"iv3[]":return Ok;case"iv4":case"iv4[]":return Rk;case"m3":case"m3[]":return Bk;case"m4":case"m4[]":return Nk}}var Lk=Jd();function $k(e){var t=e.createBuffer();if(null===t)throw Error("Could not create WebGL buffer");return t}function Uk(e,t,r,n){var i=$k(e),a=function(e,t){switch(t){case"static":return e.STATIC_DRAW;case"dynamic":return e.DYNAMIC_DRAW;case"stream":return e.STREAM_DRAW}}(e,r),o=function(e,t){switch(t){case"attribute":return e.ARRAY_BUFFER;case"elements":return e.ELEMENT_ARRAY_BUFFER;case"uniform":if(dI(e))return e.UNIFORM_BUFFER;throw Error("WebGL2 is required for uniform buffers")}}(e,n),s=function(e,t){return t instanceof Uint8Array?e.UNSIGNED_BYTE:t instanceof Int8Array?e.BYTE:t instanceof Uint16Array?e.UNSIGNED_SHORT:t instanceof Int16Array?e.SHORT:t instanceof Uint32Array?e.UNSIGNED_INT:t instanceof Int32Array?e.INT:t instanceof Float32Array?e.FLOAT:void Lg()}(e,t),u=t.BYTES_PER_ELEMENT,c=t.length;function l(t){e.bindBuffer(o,i),e.bufferData(o,t,a)}l(t);var d=!1;return{id:Lk(),_usageHint:a,_bufferType:o,_dataType:s,_bpe:u,length:c,getBuffer:function(){return i},updateData:l,updateSubData:function(t,r,n){e.bindBuffer(o,i),n-r===t.length?e.bufferSubData(o,0,t):e.bufferSubData(o,r*u,t.subarray(r,r+n))},reset:function(){i=$k(e),l(t)},destroy:function(){d||=(e.deleteBuffer(i),!0)}}}function jk(e,t,r){if("float32"===t)switch(r){case 1:return e.FLOAT;case 2:return e.FLOAT_VEC2;case 3:return e.FLOAT_VEC3;case 4:return e.FLOAT_VEC4;case 16:return e.FLOAT_MAT4}Lg()}var zk=Jd();function Gk(e){var t=e.createProgram();if(null===t)throw Error("Could not create WebGL program");return t}var Vk=Jd();function Hk(e,t){var r=t.type,n=t.source,i=e.createShader("vert"===r?e.VERTEX_SHADER:e.FRAGMENT_SHADER);if(null===i)throw Error(`Error creating ${r} shader`);if(e.shaderSource(i,n),e.compileShader(i),ay&&!1===e.getShaderParameter(i,e.COMPILE_STATUS))throw console.warn(`'${r}' shader info log '${e.getShaderInfoLog(i)}'\n${function(e){for(var t=e.split("\n"),r=0;r<t.length;++r)t[r]=r+1+": "+t[r];return t.join("\n")}(n)}`),Error(`Error compiling ${r} shader`);return i}function qk(e,t,r){var n=new Map;return{get:function(r){var i,a=e(r),o=n.get(a);return o||(void 0===i&&(i=0),o={value:t(r),usageCount:i},n.set(a,o)),o.usageCount+=1,function(e){return{free:function(){--e.usageCount},value:e.value}}(o)},clear:function(){n.forEach(function(e,t){e.usageCount<=0&&(e.usageCount<0&&console.warn("Reference usageCount below zero."),r(e.value),n.delete(t))})},get count(){return n.size},dispose:function(){n.forEach(function(e){return r(e.value)}),n.clear()}}}var Wk=Jd();function Xk(e){var t=e.createRenderbuffer();if(null===t)throw Error("Could not create WebGL renderbuffer");return t}var Yk=Jd();function Kk(e){var t=e.vertexArrayObject;if(!t)throw Error("VertexArrayObject not supported");var r=t.createVertexArray();if(!r)throw Error("Could not create WebGL vertex array");return r}function Zk(e){var t=e.vertexArrayObject;if(null===t)throw Error("VertexArrayObject not supported");return t}function Qk(e){return Ac(Ac({},e.value),{destroy:function(){e.free()}})}function Jk(e,t,r,n){var i={attribute:new Set,elements:new Set,framebuffer:new Set,program:new Set,renderbuffer:new Set,shader:new Set,texture:new Set,cubeTexture:new Set,vertexArray:new Set};function a(e,t){return i[e].add(t),r.resourceCounts[e]+=1,Ac(Ac({},t),{destroy:function(){t.destroy(),i[e].delete(t),--r.resourceCounts[e]}})}var o=qk(function(e){return JSON.stringify(e)},function(t){return a("shader",function(e,t){var r=Hk(e,t);return{id:Vk(),attach:function(t){e.attachShader(t,r)},reset:function(){r=Hk(e,t)},destroy:function(){e.deleteShader(r)}}}(e,t))},function(e){e.destroy()});function s(e,t){return Qk(o.get({type:e,source:t}))}var u=qk(function(e){var t=[e.shaderCode.id],r=e.defineValues.dRenderVariant?.ref.value||"";
139return Object.keys(e.defineValues).forEach(function(n){var i,a;null!=(a=(i=e.shaderCode).ignoreDefine)&&a.call(i,n,r,e.defineValues)||t.push(Pv(n),function(e){return"boolean"==typeof e?+!!e:"number"==typeof e?1e4*e:Pv(e)}(e.defineValues[n].ref.value))}),Iv(t).toString()},function(r){return a("program",function(e,t,r,n,i){var a,o,s=i.defineValues,u=i.shaderCode,c=i.schema,l=Gk(e),d=zk(),f=function(e,t,r,n){var i=wk(r,n.ignoreDefine),a=wk(r,n.ignoreDefine),o=dI(e)?function(e,t){var r=["#version 300 es"];if(t.drawBuffers&&e.drawBuffers&&r.push("#define requiredDrawBuffers"),t.clipCullDistance)if(e.clipCullDistance)r.push("#extension GL_ANGLE_clip_cull_distance : enable"),r.push("#define enabledClipCullDistance");else if("required"===t.clipCullDistance)throw Error("required 'GL_ANGLE_clip_cull_distance' extension not available");if(t.conservativeDepth)if(e.conservativeDepth)r.push("#extension GL_EXT_conservative_depth : enable"),r.push("#define enabledConservativeDepth");else if("required"===t.conservativeDepth)throw Error("required 'GL_EXT_conservative_depth' extension not available");return e.noNonInstancedActiveAttribs&&r.push("#define noNonInstancedActiveAttribs"),r.push("\n#define attribute in\n#define varying out\n#define texture2D texture\n"),r.join("\n")+"\n"}(t,n.extensions):function(e,t){var r=[];if(t.drawBuffers)if(e.drawBuffers)r.push("#define requiredDrawBuffers");else if("required"===t.drawBuffers)throw Error("required 'GL_EXT_draw_buffers' extension not available");return r.join("\n")+"\n"}(t,n.extensions),s=dI(e)?function(e,t,r,n){var i=["#version 300 es",`layout(location = 0) out highp ${n[0]||"vec4"} out_FragData0;`];if(r.fragDepth&&t.fragDepth&&i.push("#define enabledFragDepth"),r.drawBuffers&&t.drawBuffers){i.push("#define requiredDrawBuffers");for(var a=1,o=e.getParameter(e.MAX_DRAW_BUFFERS);a<o;++a)i.push(`layout(location = ${a}) out highp ${n[a]||"vec4"} out_FragData${a};`)}return r.shaderTextureLod&&t.shaderTextureLod&&i.push("#define enabledShaderTextureLod"),i.push("\n#define varying in\n#define texture2D texture\n#define textureCube texture\n#define texture2DLodEXT textureLod\n#define textureCubeLodEXT textureLod\n\n#define gl_FragColor out_FragData0\n#define gl_FragDepthEXT gl_FragDepth\n\n#define depthTextureSupport\n"),i.join("\n")+"\n"}(e,t,n.extensions,n.outTypes):function(e,t){var r=["#extension GL_OES_standard_derivatives : enable"];if(t.fragDepth)if(e.fragDepth)r.push("#extension GL_EXT_frag_depth : enable"),r.push("#define enabledFragDepth");else if("required"===t.fragDepth)throw Error("required 'GL_EXT_frag_depth' extension not available");if(t.drawBuffers)if(e.drawBuffers)r.push("#extension GL_EXT_draw_buffers : require"),r.push("#define requiredDrawBuffers"),r.push("#define gl_FragColor gl_FragData[0]");else if("required"===t.drawBuffers)throw Error("required 'GL_EXT_draw_buffers' extension not available");if(t.shaderTextureLod)if(e.shaderTextureLod)r.push("#extension GL_EXT_shader_texture_lod : enable"),r.push("#define enabledShaderTextureLod");else if("required"===t.shaderTextureLod)throw Error("required 'GL_EXT_shader_texture_lod' extension not available");return e.depthTexture&&r.push("#define depthTextureSupport"),r.join("\n")+"\n"}(t,n.extensions),u=dI(e)?function(e){return e.replace(/gl_FragData\[([0-9]+)\]/g,"out_FragData$1")}(n.frag):n.frag;return{id:rk(),name:n.name,vert:`${o}${i}${dk(n.vert,r)}`,frag:`${s}${a}${dk(u,r)}`,extensions:n.extensions,outTypes:n.outTypes}}(e,r,s,u),h=n("vert",f.vert),p=n("frag",f.frag);function m(){h.attach(l),p.attach(l),e.linkProgram(l),ay&&function(e,t){if(!e.getProgramParameter(t,e.LINK_STATUS))throw Error(`Could not compile WebGL program. \n\n${e.getProgramInfoLog(t)}`)}(e,l),a=function(e,t,r){var n={};return Object.keys(r).forEach(function(i){var a=r[i];if("attribute"===a.type){var o=e.getAttribLocation(t,i);n[i]=o}else"uniform"===a.type?(null===(o=e.getUniformLocation(t,i))&&a.kind.endsWith("[]")&&(o=e.getUniformLocation(t,i+"[0]")),n[i]=o):"texture"===a.type&&(o=e.getUniformLocation(t,i),n[i]=o)}),n}(e,l,c),o=function(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];"uniform"===n.type?t[r]=Fk(n.kind):"texture"===n.type&&(t[r]=Fk("t"))}),t}(c),ay&&(function(e,t,r){for(var n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i<n;++i){var a=e.getActiveAttrib(t,i);if(a){var o=a.name,s=a.type;if(o.startsWith("__activeAttribute")||"gl_InstanceID"===o||"gl_VertexID"===o)continue;var u=r[o];if(void 0===u)throw Error(`missing 'uniform' or 'texture' with name '${o}' in schema`);if("attribute"!==u.type)throw Error(`'${o}' must be of type 'attribute' but is '${u.type}'`);var c=jk(e,u.kind,u.itemSize);if(c!==s)throw Error(`unexpected attribute type '${c}' for ${o}, expected '${s}'`)}}}(e,l,c),function(e,t,r){for(var n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i=0;i<n;++i){var a=e.getActiveUniform(t,i);if(a){var o=a.name,s=a.type;if(o.startsWith("__activeUniform"))continue;var u=r[o.replace(/[[0-9]+\]$/,"")];if(void 0===u)throw Error(`missing 'uniform' or 'texture' with name '${o}' in schema`);if("uniform"===u.type){if(Ak(e,u.kind)!==s)throw Error(`unexpected uniform type for ${o}`)}else{if("texture"!==u.type)throw Error(`'${o}' must be of type 'uniform' or 'texture' but is '${u.type}'`);
139if("image-float32"===u.kind||"image-uint8"===u.kind){if(s!==e.SAMPLER_2D)throw Error(`unexpected sampler type for '${o}'`)}else if("volume-float32"===u.kind||"volume-uint8"===u.kind){if(!dI(e))throw Error("WebGL2 is required to use SAMPLER_3D");if(s!==e.SAMPLER_3D)throw Error(`unexpected sampler type for '${o}'`)}}}}}(e,l,c))}m();var g=!1;return{id:d,use:function(){t.currentProgramId=d,e.useProgram(l)},setUniforms:function(t){for(var r=0,n=t.length;r<n;++r){var i=t[r],s=i[0],u=i[1];if(u){var c=a[s];null!==c&&o[s](e,c,u.ref.value)}}},bindAttributes:function(e){t.clearVertexAttribsState();for(var r=0,n=e.length;r<n;++r){var i=e[r],o=i[0],s=i[1],u=a[o];-1!==u&&s.bind(u)}t.disableUnusedVertexAttribs()},bindTextures:function(t,r){for(var n=0,i=t.length;n<i;++n){var s=t[n],u=s[0],c=s[1],l=a[u];null!=l&&(c.bind(n+r),o[u](e,l,n+r))}},reset:function(){l=Gk(e),m()},destroy:function(){g||=(h.destroy(),p.destroy(),e.deleteProgram(l),!0)}}}(e,t,n,s,r))},function(e){e.destroy()});return{attribute:function(r,i,o,s){return a("attribute",function(e,t,r,n,i,a,o){void 0===o&&(o="dynamic");var s=r.instancedArrays,u=Uk(e,n,o,"attribute"),c=u._bufferType,l=u._dataType,d=u._bpe;return Ac(Ac({},u),{bind:function(r){if(e.bindBuffer(c,u.getBuffer()),16===i)for(var n=0;n<4;++n)t.enableVertexAttrib(r+n),e.vertexAttribPointer(r+n,4,l,!1,16*d,4*n*d),s.vertexAttribDivisor(r+n,a);else t.enableVertexAttrib(r),e.vertexAttribPointer(r,i,l,!1,0,0),s.vertexAttribDivisor(r,a)}})}(e,t,n,r,i,o,s))},elements:function(t,r){return a("elements",function(e,t,r){void 0===r&&(r="static");var n=Uk(e,t,r,"elements");return Ac(Ac({},n),{bind:function(){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.getBuffer())}})}(e,t,r))},framebuffer:function(){return a("framebuffer",function(e){var t=ek(e),r=!1;return{id:QM(),bind:function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)},reset:function(){t=ek(e)},destroy:function(){r||=(e.deleteFramebuffer(t),!0)}}}(e))},program:function(e,t,r){return Qk(u.get({defineValues:e,shaderCode:t,schema:r}))},renderbuffer:function(t,r,n,i){return a("renderbuffer",function(e,t,r,n,i){var a=Xk(e),o=function(){return e.bindRenderbuffer(e.RENDERBUFFER,a)},s=function(e,t){switch(t){case"depth16":return e.DEPTH_COMPONENT16;case"stencil8":return e.STENCIL_INDEX8;case"rgba4":return e.RGBA4;case"depth-stencil":return e.DEPTH_STENCIL;case"depth24":if(dI(e))return e.DEPTH_COMPONENT24;throw Error("WebGL2 needed for `depth24` renderbuffer format");case"depth32f":if(dI(e))return e.DEPTH_COMPONENT32F;throw Error("WebGL2 needed for `depth32f` renderbuffer format");case"depth24-stencil8":if(dI(e))return e.DEPTH24_STENCIL8;throw Error("WebGL2 needed for `depth24-stencil8` renderbuffer format");case"depth32f-stencil8":if(dI(e))return e.DEPTH32F_STENCIL8;throw Error("WebGL2 needed for `depth32f-stencil8` renderbuffer format")}}(e,t),u=function(e,t){switch(t){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"depth-stencil":return e.DEPTH_STENCIL_ATTACHMENT;case"color0":return e.COLOR_ATTACHMENT0}}(e,r);function c(){o(),e.renderbufferStorage(e.RENDERBUFFER,s,n,i)}c();var l=!1;return{id:Wk(),bind:o,attachFramebuffer:function(t){t.bind(),o(),e.framebufferRenderbuffer(e.FRAMEBUFFER,u,e.RENDERBUFFER,a),ay&&JM(e)},detachFramebuffer:function(t){t.bind(),o(),e.framebufferRenderbuffer(e.FRAMEBUFFER,u,e.RENDERBUFFER,null),ay&&JM(e)},setSize:function(e,t){n=e,i=t,c()},reset:function(){a=Xk(e),c()},destroy:function(){l||=(e.deleteRenderbuffer(a),!0)}}}(e,t,r,n,i))},shader:s,texture:function(t,r,i,o){return a("texture",function(e,t,r,n,i,a){var o=pI(),s=xI(e);if(r.endsWith("float32")&&"float"!==i||r.endsWith("float16")&&"fp16"!==i||r.endsWith("uint8")&&"ubyte"!==i||r.endsWith("int32")&&"int"!==i||r.endsWith("depth")&&"ushort"!==i&&"float"!==i)throw Error(`texture kind '${r}' and type '${i}' are incompatible`);
139if(!t.depthTexture&&"depth"===n)throw Error("extension 'WEBGL_depth_texture' needed for 'depth' texture format");var u=function(e,t){switch(t){case"image-uint8":case"image-float32":case"image-float16":case"image-depth":return e.TEXTURE_2D}if(dI(e))switch(t){case"image-int32":return e.TEXTURE_2D;case"volume-uint8":case"volume-float32":case"volume-float16":return e.TEXTURE_3D}throw Error(`unknown texture kind '${t}'`)}(e,r),c=vI(e,a),l=mI(e,n,i),d=function(e,t,r){if(dI(e))switch(t){case"alpha":switch(r){case"ubyte":return e.ALPHA;case"float":return e.R32F;case"fp16":return e.R16F;case"int":return e.R32I}case"rg":switch(r){case"ubyte":return e.RG;case"float":return e.RG32F;case"fp16":return e.RG16F;case"int":return e.RG32I}case"rgb":switch(r){case"ubyte":return e.RGB;case"float":return e.RGB32F;case"fp16":return e.RGB16F;case"int":return e.RGB32I}case"rgba":switch(r){case"ubyte":return e.RGBA;case"float":return e.RGBA32F;case"fp16":return e.RGBA16F;case"int":return e.RGBA32I}case"depth":switch(r){case"ushort":return e.DEPTH_COMPONENT16;case"float":return e.DEPTH_COMPONENT32F}}return mI(e,t,r)}(e,n,i),f=function(e,t,r){switch(r){case"ubyte":return e.UNSIGNED_BYTE;case"ushort":return e.UNSIGNED_SHORT;case"float":return e.FLOAT;case"fp16":if(t.textureHalfFloat)return t.textureHalfFloat.HALF_FLOAT;throw Error('extension "texture_half_float" unavailable');case"int":if(dI(e))return e.INT;throw Error('texture type "int" requires webgl2')}}(e,t,i);function h(){e.bindTexture(u,s),e.texParameteri(u,e.TEXTURE_MAG_FILTER,c),e.texParameteri(u,e.TEXTURE_MIN_FILTER,c),e.texParameteri(u,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(u,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(u,null)}h();var p,m=0,g=0,v=0,y=!1,b=!1;function _(t,r,n){if(0===t||0===r||dI(e)&&u===e.TEXTURE_3D&&0===n)throw Error("empty textures are not allowed");if(m!==t||g!==r||v!==(n||0))if(m=t,g=r,v=n||0,e.bindTexture(u,s),u===e.TEXTURE_2D)e.texImage2D(u,0,d,m,g,0,l,f,null);else{if(!dI(e)||u!==e.TEXTURE_3D||void 0===v)throw Error("unknown texture target");e.texImage3D(u,0,d,m,g,v,0,l,f,null)}}function x(t,r){if(void 0===r&&(r=!1),0===t.width||0===t.height||!bI(t)&&dI(e)&&_I(0,u,e)&&0===t.depth)throw Error("empty textures are not allowed");if(e.bindTexture(u,s),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),bI(t))m=t.width,g=t.height,e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(e.TEXTURE_2D,s),e.texImage2D(e.TEXTURE_2D,0,d,l,f,t);else if(function(e,t,r){return t===r.TEXTURE_2D}(0,u,e)){var n=t.filter?vI(e,t.filter):c;e.texParameteri(u,e.TEXTURE_MAG_FILTER,n),e.texParameteri(u,e.TEXTURE_MIN_FILTER,n),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!t.flipY),r?e.texSubImage2D(u,0,0,0,t.width,t.height,l,f,t.array):(m=t.width,g=t.height,e.texImage2D(u,0,d,m,g,0,l,f,t.array))}else{if(!dI(e)||!_I(0,u,e))throw Error("unknown texture target");e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),r?e.texSubImage3D(u,0,0,0,0,t.width,t.height,t.depth,l,f,t.array):(m=t.width,g=t.height,v=t.depth,e.texImage3D(u,0,d,m,g,v,0,l,f,t.array))}e.bindTexture(u,null),p=t}function S(){if(u!==e.TEXTURE_2D)throw Error("mipmap only supported for 2d textures");if(!(dI(e)||Ig(m)&&Ig(g)))throw Error("mipmap unsupported for non-power-of-two textures and webgl1");e.bindTexture(u,s),e.texParameteri(u,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(u),e.bindTexture(u,null),y=!0}return _(1,1,dI(e)&&u===e.TEXTURE_3D?1:0),{id:o,target:u,format:l,internalFormat:d,type:f,filter:c,getWidth:function(){return m},getHeight:function(){return g},getDepth:function(){return v},getByteCount:function(){return gI(n,i,m,g,v)},define:_,load:x,mipmap:S,bind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(u,s)},unbind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(u,null)},attachFramebuffer:function(r,n,i){if(r.bind(),u===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,yI(e,t,n),e.TEXTURE_2D,s,0);else{if(!dI(e)||u!==e.TEXTURE_3D)throw Error("unknown/unsupported texture target");if(void 0===i)throw Error("need `layer` to attach 3D texture");e.framebufferTextureLayer(e.FRAMEBUFFER,yI(e,t,n),s,0,i)}},detachFramebuffer:function(r,n){if(r.bind(),u===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,yI(e,t,n),e.TEXTURE_2D,null,0);else{if(!dI(e)||u!==e.TEXTURE_3D)throw Error("unknown texture target");e.framebufferTextureLayer(e.FRAMEBUFFER,yI(e,t,n),null,0,0)}},reset:function(){s=xI(e),h();var t=[m,g,v];m=0,g=0,v=0,_(t[0],t[1],t[2]),p&&x(p),y&&S()},destroy:function(){b||=(e.deleteTexture(s),!0)}}}(e,n,t,r,i,o))},cubeTexture:function(t,r,n){return a("cubeTexture",function(e,t,r,n){var i=e.TEXTURE_CUBE_MAP,a=e.LINEAR,o=e.RGBA,s=e.RGBA,u=e.UNSIGNED_BYTE,c=0,l=e.createTexture();e.bindTexture(i,l);var d=0;Hg(t,function(t,h){if(t){var p=function(e,t){switch(t){case"nx":return e.TEXTURE_CUBE_MAP_NEGATIVE_X;case"ny":return e.TEXTURE_CUBE_MAP_NEGATIVE_Y;case"nz":return e.TEXTURE_CUBE_MAP_NEGATIVE_Z;case"px":return e.TEXTURE_CUBE_MAP_POSITIVE_X;case"py":return e.TEXTURE_CUBE_MAP_POSITIVE_Y;case"pz":return e.TEXTURE_CUBE_MAP_POSITIVE_Z}}(e,h),m=new Image;t instanceof File?m.src=URL.createObjectURL(t):$g(t)?t.then(function(e){m.src=URL.createObjectURL(e)}):m.src=t,m.addEventListener("load",function(){0===c&&(c=m.width),e.texImage2D(p,0,o,c,c,0,s,u,null),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(i,l),e.texImage2D(p,0,o,s,u,m),6===(d+=1)&&(f||(r?(e.texParameteri(i,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(i)):e.texParameteri(i,e.TEXTURE_MIN_FILTER,a),e.texParameteri(i,e.TEXTURE_MAG_FILTER,a)),n?.(f))}),m.addEventListener("error",function(){n?.(!0)})}});var f=!1;return{id:pI(),target:i,format:s,internalFormat:o,type:u,filter:a,getWidth:function(){return c},getHeight:function(){return c},getDepth:function(){return 0},getByteCount:function(){return 6*gI("rgba","ubyte",c,c,0)*(r?2:1)},define:function(){},load:function(){},mipmap:function(){},bind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(i,l)},unbind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(i,null)},attachFramebuffer:function(){},detachFramebuffer:function(){},reset:function(){},destroy:function(){f||=(e.deleteTexture(l),!0)}}}(e,t,r,n))},vertexArray:function(t,r,i){return a("vertexArray",function(e,t,r,n,i){var a=Yk(),o=Kk(t),s=Zk(t);function u(){s.bindVertexArray(o),i&&i.bind(),r.bindAttributes(n),s.bindVertexArray(null)}u();var c=!1;return{id:a,bind:function(){s.bindVertexArray(o)},update:u,reset:function(){o=Kk(t),s=Zk(t),u()},destroy:function(){c||=(i&&(s.bindVertexArray(o),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),s.deleteVertexArray(o),!0)}}}(e,n,t,r,i))},getByteCounts:function(){var e=0;i.texture.forEach(function(t){e+=t.getByteCount()}),i.cubeTexture.forEach(function(t){e+=t.getByteCount()});var t=0;i.attribute.forEach(function(e){t+=4*e.length});var r=0;
139return i.elements.forEach(function(e){r+=4*e.length}),{texture:e,attribute:t,elements:r}},reset:function(){i.attribute.forEach(function(e){return e.reset()}),i.elements.forEach(function(e){return e.reset()}),i.framebuffer.forEach(function(e){return e.reset()}),i.renderbuffer.forEach(function(e){return e.reset()}),i.shader.forEach(function(e){return e.reset()}),i.program.forEach(function(e){return e.reset()}),i.vertexArray.forEach(function(e){return e.reset()}),i.texture.forEach(function(e){return e.reset()})},destroy:function(){i.attribute.forEach(function(e){return e.destroy()}),i.elements.forEach(function(e){return e.destroy()}),i.framebuffer.forEach(function(e){return e.destroy()}),i.renderbuffer.forEach(function(e){return e.destroy()}),i.shader.forEach(function(e){return e.destroy()}),i.program.forEach(function(e){return e.destroy()}),i.vertexArray.forEach(function(e){return e.destroy()}),i.texture.forEach(function(e){return e.destroy()}),o.clear(),u.clear()}}}var eI=Jd(),tI=function(){function e(e){this.count=e,this.avgs=new Map}return e.prototype.add=function(e,t){var r=this.avgs.get(e)||t;return r=function(e,t,r){return(e-=e/r)+t/r}(r,t,this.count),this.avgs.set(e,r),r},e.prototype.get=function(e){return this.avgs.get(e)},e.prototype.stats=function(){return Object.fromEntries(this.avgs.entries())},e}();function rI(e,t){switch(t){case e.NO_ERROR:return"no error";case e.INVALID_ENUM:return"invalid enum";case e.INVALID_VALUE:return"invalid value";case e.INVALID_OPERATION:return"invalid operation";case e.INVALID_FRAMEBUFFER_OPERATION:return"invalid framebuffer operation";case e.OUT_OF_MEMORY:return"out of memory";case e.CONTEXT_LOST_WEBGL:return"context lost"}return"unknown error"}function nI(e){var t=e.getError();if(t!==e.NO_ERROR)throw Error(`WebGL error: '${rI(e,t)}'`)}function iI(e){e.bindFramebuffer(e.FRAMEBUFFER,null)}var aI=new Uint8Array(4);function oI(e,t,r){e.getSyncParameter(t,e.SYNC_STATUS)===e.SIGNALED?(e.deleteSync(t),r()):ny.setImmediate(oI,e,t,r)}function sI(e,t){var r=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);r?ny.setImmediate(oI,e,r,t):(console.warn("Could not create a WebGLSync object"),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,aI),t())}var uI=!1;function cI(e){e.bindFramebuffer(e.FRAMEBUFFER,null),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,aI)}function lI(e,t,r,n,i,a){if(ay&&JM(e),a instanceof Uint8Array)e.readPixels(t,r,n,i,e.RGBA,e.UNSIGNED_BYTE,a);else if(a instanceof Float32Array)e.readPixels(t,r,n,i,e.RGBA,e.FLOAT,a);else{if(!(a instanceof Int32Array&&dI(e)))throw Error("unsupported readPixels buffer type");e.readPixels(t,r,n,i,e.RGBA_INTEGER,e.INT,a)}ay&&nI(e)}function dI(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext}var fI=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function hI(e,t){var r=Hk(e,{type:"vert",source:"\nattribute vec4 aPosition;\n\nvoid main() {\n    gl_Position = aPosition;\n}"}),n=Hk(e,{type:"frag",source:"\nprecision mediump float;\nuniform vec4 uColor;\nuniform sampler2D uTexture;\n\nvoid main() {\n    gl_FragColor = texture2D(uTexture, vec2(0.5, 0.5)) * uColor;\n}"});if(!r||!n)return!1;var i=Gk(e);e.attachShader(i,r),e.attachShader(i,n),e.linkProgram(i),e.useProgram(i);var a=e.getAttribLocation(i,"aPosition"),o=e.getUniformLocation(i,"uColor");if(!o)return ay&&console.log("error getting 'uColor' uniform location"),!1;var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,fI,e.STATIC_DRAW),e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0);var u=e.createTexture(),c=new Uint8Array([255,255,255,255]);e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,c);var l=e.createTexture();e.bindTexture(e.TEXTURE_2D,l),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,t,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);var d=e.createFramebuffer();if(e.bindFramebuffer(e.FRAMEBUFFER,d),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l,0),e.checkFramebufferStatus(e.FRAMEBUFFER)!==e.FRAMEBUFFER_COMPLETE)return ay&&console.log(`error creating framebuffer for '${t}'`),!1;e.bindTexture(e.TEXTURE_2D,u),e.uniform4fv(o,[0,10,20,1]),e.drawArrays(e.TRIANGLES,0,6),e.bindTexture(e.TEXTURE_2D,l),e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(1,0,0,1),e.clear(e.COLOR_BUFFER_BIT),e.uniform4fv(o,[0,.1,.05,1]),e.drawArrays(e.TRIANGLES,0,6);var f=new Uint8Array(4);if(e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,f),0!==f[0]||f[1]<248||f[2]<248||f[3]<254)return ay&&console.log(`not able to actually render to '${t}' texture`),!1;if(t===e.FLOAT){e.bindFramebuffer(e.FRAMEBUFFER,d);var h=new Float32Array(4);e.readPixels(0,0,1,1,e.RGBA,e.FLOAT,h);var p=e.getError();if(p)return ay&&console.log(`error reading float pixels: '${rI(e,p)}'`),!1}return!0}var pI=Jd();function mI(e,t,r){switch(t){case"alpha":return dI(e)&&"float"===r?e.RED:dI(e)&&"int"===r?e.RED_INTEGER:e.ALPHA;case"rgb":return dI(e)&&"int"===r?e.RGB_INTEGER:e.RGB;case"rg":if(dI(e)&&"float"===r)return e.RG;if(dI(e)&&"int"===r)return e.RG_INTEGER;throw Error('texture format "rg" requires webgl2 and type "float" or int"');case"rgba":return dI(e)&&"int"===r?e.RGBA_INTEGER:e.RGBA;case"depth":return e.DEPTH_COMPONENT}}function gI(e,t,r,n,i){return function(e){switch(e){case"alpha":return 1;case"rg":return 2;case"rgb":return 3;case"rgba":case"depth":return 4}}(e)*function(e){switch(e){case"ubyte":return 1;case"ushort":case"fp16":return 2;case"float":case"int":return 4}}(t)*r*n*(i||1)}function vI(e,t){switch(t){case"nearest":return e.NEAREST;case"linear":return e.LINEAR}}function yI(e,t,r){switch(r){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"color0":case 0:return e.COLOR_ATTACHMENT0}if(t.drawBuffers)switch(r){case"color1":case 1:return t.drawBuffers.COLOR_ATTACHMENT1;case"color2":case 2:return t.drawBuffers.COLOR_ATTACHMENT2;case"color3":case 3:return t.drawBuffers.COLOR_ATTACHMENT3;case"color4":case 4:return t.drawBuffers.COLOR_ATTACHMENT4;case"color5":case 5:return t.drawBuffers.COLOR_ATTACHMENT5;case"color6":case 6:return t.drawBuffers.COLOR_ATTACHMENT6;case"color7":case 7:return t.drawBuffers.COLOR_ATTACHMENT7}throw Error("unknown texture attachment")}function bI(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement}function _I(e,t,r){return t===r.TEXTURE_3D}function xI(e){var t=e.createTexture();if(null===t)throw Error("Could not create WebGL texture");return t}function SI(e,t,r){var n=e.resources,i=[];return Object.keys(t).forEach(function(e){var a=t[e];if("texture"===a.type){var o=r[e];if(o)if("texture"===a.kind)i[i.length]=[e,o.ref.value];else{var s=n.texture(a.kind,a.format,a.dataType,a.filter);s.load(o.ref.value),i[i.length]=[e,s]}}}),i}function wI(e,t,r){var n=new Image;n.onload=function(){r.load(n),tf.update(t,r)},n.src=e}function AI(e){var t=e?.TEXTURE_2D??3553;return{id:pI(),target:t,format:-1,internalFormat:0,type:0,filter:0,getWidth:function(){return 0},getHeight:function(){return 0},getDepth:function(){return 0},getByteCount:function(){return 0},define:function(){},load:function(){},mipmap:function(){},bind:function(r){e&&(e.activeTexture(e.TEXTURE0+r),e.bindTexture(t,null))},unbind:function(r){e&&(e.activeTexture(e.TEXTURE0+r),e.bindTexture(t,null))},attachFramebuffer:function(){throw Error("cannot attach null-texture to a framebuffer")},detachFramebuffer:function(){throw Error("cannot detach null-texture from a framebuffer")},reset:function(){},destroy:function(){}}}function CI(e,t,r,n){var i=function(e,t,r,n){switch(r.granularity){case"uniform":return function(e,t,r){return function(e,t){return t?(tf.update(t.uColor,tv.toVec3Normalized(t.uColor.ref.value,e)),tf.updateIfChanged(t.dColorType,"uniform"),t):{uColor:tf.create(tv.toVec3Normalized(Cg(),e)),tColor:tf.create({array:new Uint8Array(3),width:1,height:1}),tColorGrid:tf.create(AI()),tPalette:tf.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:tf.create(Bg.create(1,1)),uColorGridDim:tf.create(Cg.create(1,1,1)),uColorGridTransform:tf.create(Ng.create(0,0,0,1)),dColorType:tf.create("uniform"),dUsePalette:tf.create(!1)}}(t(WM,!1),r)}(0,r.color,n);case"instance":return e.nonInstanceable?PI(e,r.color,n):function(e,t,r){var n=e.instanceCount,i=NM(Math.max(1,n),3,Uint8Array,r&&r.tColor.ref.value.array);for(e.reset();e.hasNext;){var a=e.move(),o=a.location,s=a.isSecondary,u=a.instanceIndex;tv.toArray(t(o,s),i.array,3*u),e.skipInstance()}return TI(i,"instance",r)}(e,r.color,n);case"group":return PI(e,r.color,n);case"groupInstance":return function(e,t,r){var n=e.groupCount,i=e.instanceCount*n,a=NM(Math.max(1,i),3,Uint8Array,r&&r.tColor.ref.value.array);for(e.reset();e.hasNext;){var o=e.move(),s=o.location,u=o.isSecondary,c=o.index;tv.toArray(t(s,u),a.array,3*c)}return TI(a,"groupInstance",r)}(e,r.color,n);case"vertex":return function(e,t,r){var n=e.groupCount,i=e.stride,a=NM(Math.max(1,n),3,Uint8Array,r&&r.tColor.ref.value.array);for(e.reset(),e.voidInstances();e.hasNext&&!e.isNextNewInstance;)for(var o=e.move(),s=o.location,u=o.isSecondary,c=o.groupIndex,l=t(s,u),d=0;d<i;++d)tv.toArray(l,a.array,3*(c+d));return TI(a,"vertex",r)}(t,r.color,n);case"vertexInstance":return function(e,t,r){var n=e.groupCount,i=e.instanceCount,a=e.stride,o=i*n,s=NM(Math.max(1,o),3,Uint8Array,r&&r.tColor.ref.value.array);for(e.reset();e.hasNext;)for(var u=e.move(),c=u.location,l=u.isSecondary,d=u.index,f=t(c,l),h=0;h<a;++h)tv.toArray(f,s.array,3*(d+h));return TI(s,"vertexInstance",r)}(t,r.color,n);case"volume":return EI(r.grid,"volume",n);case"volumeInstance":return EI(r.grid,"volumeInstance",n);case"direct":return function(e){return e?(tf.updateIfChanged(e.dColorType,"direct"),e):{uColor:tf.create(Cg()),tColor:tf.create({array:new Uint8Array(3),width:1,height:1}),tColorGrid:tf.create(AI()),tPalette:tf.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:tf.create(Bg.create(1,1)),uColorGridDim:tf.create(Cg.create(1,1,1)),uColorGridTransform:tf.create(Ng.create(0,0,0,1)),dColorType:tf.create("direct"),dUsePalette:tf.create(!1)}}(n)}}(e,t,r,n);return r.palette?(tf.updateIfChanged(i.dUsePalette,!0),function(e,t){var r=!0,n=t.ref.value;if(e.colors.length!==n.width||n.filter!==e.filter)r=!1;else for(var i=n.array,a=0,o=0,s=e.colors;o<s.length;o++){var u=s[o],c=tv.toRgb(u),l=c[0],d=c[1],f=c[2];if(i[a++]!==l||i[a++]!==d||i[a++]!==f){r=!1;break}}if(!r){for(var h=new Uint8Array(3*e.colors.length),p=0,m=0,g=e.colors;m<g.length;m++){u=g[m];var v=tv.toRgb(u);l=v[0],d=v[1],f=v[2],h[p++]=l,h[p++]=d,h[p++]=f}tf.update(t,{array:h,height:1,width:e.colors.length,filter:e.filter})}}(r.palette,i.tPalette)):tf.updateIfChanged(i.dUsePalette,!1),i}function TI(e,t,r){return r?(tf.update(r.tColor,e),tf.update(r.uColorTexDim,Bg.create(e.width,e.height)),tf.updateIfChanged(r.dColorType,t),r):{uColor:tf.create(Cg()),tColor:tf.create(e),tColorGrid:tf.create(AI()),tPalette:tf.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:tf.create(Bg.create(e.width,e.height)),uColorGridDim:tf.create(Cg.create(1,1,1)),uColorGridTransform:tf.create(Ng.create(0,0,0,1)),dColorType:tf.create(t),dUsePalette:tf.create(!1)}}function PI(e,t,r){var n=e.groupCount,i=NM(Math.max(1,n),3,Uint8Array,r&&r.tColor.ref.value.array);for(e.reset();e.hasNext&&!e.isNextNewInstance;){var a=e.move(),o=a.location,s=a.isSecondary,u=a.groupIndex;tv.toArray(t(o,s),i.array,3*u)}return TI(i,"group",r)}function EI(e,t,r){var n=e.colors,i=e.dimension,a=e.transform,o=n.getWidth(),s=n.getHeight();return r?(tf.update(r.tColorGrid,n),tf.update(r.uColorTexDim,Bg.create(o,s)),tf.update(r.uColorGridDim,Cg.clone(i)),tf.update(r.uColorGridTransform,Ng.clone(a)),tf.updateIfChanged(r.dColorType,t),r):{uColor:tf.create(Cg()),tColor:tf.create({array:new Uint8Array(3),width:1,height:1}),tColorGrid:tf.create(n),tPalette:tf.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:tf.create(Bg.create(o,s)),uColorGridDim:tf.create(Cg.clone(i)),uColorGridTransform:tf.create(Ng.clone(a)),dColorType:tf.create(t),dUsePalette:tf.create(!1)}}var MI=Rg(),kI=Og();function II(e,t,r){var n=function(e,t){for(var r=0;r<t;r++)if(Rg.fromMat4(MI,Og.fromArray(kI,e,16*r)),Rg.determinant(MI)<0)return!0;return!1}(e,t);if(r){tf.update(r.matrix,r.matrix.ref.value);var i=r.transform.ref.value.length>=16*t?r.transform.ref.value:new Float32Array(16*t);i.set(e),tf.update(r.transform,i),tf.updateIfChanged(r.uInstanceCount,t),tf.updateIfChanged(r.instanceCount,t);var a=r.aTransform.ref.value.length>=16*t?r.aTransform.ref.value:new Float32Array(16*t);tf.update(r.aTransform,a);var o=r.extraTransform.ref.value.length>=16*t?r.extraTransform.ref.value:new Float32Array(16*t);tf.update(r.extraTransform,RI(o,t));var s=r.aInstance.ref.value.length>=t?r.aInstance.ref.value:new Float32Array(t);tf.update(r.aInstance,zb(s,t)),tf.update(r.hasReflection,n)}else r={aTransform:tf.create(new Float32Array(16*t)),matrix:tf.create(Og.identity()),transform:tf.create(new Float32Array(e)),extraTransform:tf.create(RI(new Float32Array(16*t),t)),uInstanceCount:tf.create(t),instanceCount:tf.create(t),aInstance:tf.create(zb(new Float32Array(t))),hasReflection:tf.create(n)};return BI(r),r}var DI=new Float32Array(16);function OI(e){return II(new Float32Array(DI),1,e)}function RI(e,t){for(var r=0;r<t;r++)e.set(DI,16*r);return e}function BI(e){for(var t=e.aTransform.ref.value,r=e.instanceCount.ref.value,n=e.matrix.ref.value,i=e.transform.ref.value,a=e.extraTransform.ref.value,o=0;o<r;o++){var s=16*o;Og.mulOffset(t,a,i,s,s,s),Og.mulOffset(t,n,t,s,0,s)}tf.update(e.aTransform,t)}Og.toArray(Og.identity(),DI,0);var NI={Atom:"Atom Property",Chain:"Chain Property",Residue:"Residue Property",Symmetry:"Symmetry",Validation:"Validation",Misc:"Miscellaneous"},FI=tv(13421772),LI={value:Ib.Color(FI),saturation:Ib.Numeric(0,{min:-6,max:6,step:.1}),lightness:Ib.Numeric(0,{min:-6,max:6,step:.1})};function $I(e,t){var r=ff(t.value,FI);return r=tv.saturate(r,t.saturation),{factory:$I,granularity:"uniform",color:function(){return r},props:t,description:"Gives everything the same, uniform color.",legend:wT([["uniform",r=tv.lighten(r,t.lightness)]])}}var UI={name:"uniform",label:"Uniform",category:NI.Misc,factory:$I,getParams:function(e){return LI},defaultValues:Ib.getDefaultValues(LI),isApplicable:function(e){return!0}},jI={value:Ib.Numeric(1,{min:0,max:20,step:.1})};function zI(e,t){var r=t.value;return{factory:zI,granularity:"uniform",size:function(){return r},props:t,description:"Gives everything the same, uniform size."}}var GI={name:"uniform",label:"Uniform",category:"",factory:zI,getParams:function(e){return jI},defaultValues:Ib.getDefaultValues(jI),isApplicable:function(e){return!0}};function VI(e){return Ac(Ac({},VI.Zero),e)}function HI(){}(function(e){e.Zero={metalness:0,roughness:0,bumpiness:0},e.toArray=function(e,t,r){return t[r]=255*e.metalness,t[r+1]=255*e.roughness,t[r+2]=255*e.bumpiness,t},e.toString=function(e){var t=e.metalness,r=e.roughness,n=e.bumpiness;return`M ${t.toFixed(2)} | R ${r.toFixed(2)} | B ${n.toFixed(2)}`},e.getParam=function(e){return Ib.Group({metalness:Ib.Numeric(0,{min:0,max:1,step:.
13901}),roughness:Ib.Numeric(1,{min:0,max:1,step:.01}),bumpiness:Ib.Numeric(0,{min:0,max:1,step:.01})},Ac(Ac({},e),{presets:[[{metalness:0,roughness:1,bumpiness:0},"Matte"],[{metalness:0,roughness:.2,bumpiness:0},"Plastic"],[{metalness:0,roughness:.6,bumpiness:0},"Glossy"],[{metalness:1,roughness:.6,bumpiness:0},"Metallic"]]}))}})(VI||={}),function(e){e.Type={none:0,plane:1,sphere:2,cube:3,cylinder:4,infiniteCone:5},e.Params={variant:Ib.Select("pixel",Ib.arrayToOptions(["instance","pixel"])),objects:Ib.ObjectList({type:Ib.Select("plane",Ib.objectToOptions(e.Type,function(e){return Yg(e)})),invert:Ib.Boolean(!1),position:Ib.Vec3(Cg()),rotation:Ib.Group({axis:Ib.Vec3(Cg.create(1,0,0)),angle:Ib.Numeric(0,{min:-180,max:180,step:1},{description:"Angle in Degrees"})},{isExpanded:!0}),scale:Ib.Vec3(Cg.create(1,1,1))},function(e){return Yg(e.type)})};var t=Ug(),r=Ug(),n=Cg(),i=Cg();e.getClip=function(r,n){for(var i=r.objects.length,a=n?.objects||function(e){return{count:0,type:Array(e).fill(1),invert:Array(e).fill(!1),position:Array(3*e).fill(0),rotation:Array(4*e).fill(0),scale:Array(3*e).fill(1)}}(i),o=a.type,s=a.invert,u=a.position,c=a.rotation,l=a.scale,d=0;d<i;++d){var f=r.objects[d];o[d]=e.Type[f.type],s[d]=f.invert,Cg.toArray(f.position,u,3*d),Ug.toArray(Ug.setAxisAngle(t,f.rotation.axis,Mg(f.rotation.angle)),c,4*d),Cg.toArray(f.scale,l,3*d)}return{variant:r.variant,objects:{count:i,type:o,invert:s,position:u,rotation:c,scale:l}}},e.areEqual=function(e,a){if(e.variant!==a.variant||e.objects.count!==a.objects.count)return!1;for(var o=e.objects,s=a.objects,u=0,c=o.count;u<c;++u)if(o.invert[u]!==s.invert[u]||o.type[u]!==s.type[u]||(Cg.fromArray(n,o.position,3*u),Cg.fromArray(i,s.position,3*u),!Cg.equals(n,i))||(Cg.fromArray(n,o.scale,3*u),Cg.fromArray(i,s.scale,3*u),!Cg.equals(n,i))||(Ug.fromArray(t,o.rotation,4*u),Ug.fromArray(r,s.rotation,4*u),!Ug.equals(t,r)))return!1;return!0}}(HI||={});var qI,WI=Object.keys({custom:{},auto:{},highest:{},higher:{},high:{},medium:{},low:{},lower:{},lowest:{}}),XI=Ib.arrayToOptions(WI),YI={smoothColors:Ib.MappedStatic("auto",{auto:Ib.Group({}),on:Ib.Group({resolutionFactor:Ib.Numeric(2,{min:.5,max:6,step:.1}),sampleStride:Ib.Numeric(3,{min:1,max:12,step:1})}),off:Ib.Group({})})};function KI(e){return!!e.smoothColors}function ZI(e,t,r){if(("on"===e.name||"auto"===e.name&&t)&&r&&r<3){var n=3;return"on"===e.name?(r*=e.params.resolutionFactor,n=e.params.sampleStride):(r*=2-wg(0,1.1,r),(r=Math.max(.5,r))>1.2&&(n=2)),{resolution:r,stride:n}}}function QI(e,t,r){return e.fill(0,4*t,4*r),!0}!function(e){e.MaterialCategory={category:"Material"},e.ShadingCategory={category:"Shading"},e.CustomQualityParamInfo={category:"Custom Quality",hideIf:function(e){return void 0!==e.quality&&"custom"!==e.quality}},e.Params={alpha:Ib.Numeric(1,{min:0,max:1,step:.01},{label:"Opacity",isEssential:!0,description:"How opaque/transparent the representation is rendered."}),quality:Ib.Select("auto",XI,{isEssential:!0,description:"Visual/rendering quality of the representation."}),material:VI.getParam(),clip:Ib.Group(HI.Params),instanceGranularity:Ib.Boolean(!1,{description:"Use instance granularity for marker, transparency, clipping, overpaint, substance data to save memory."})},e.createSimple=function(e,t,r){return void 0===e&&(e=MC.grey),void 0===t&&(t=1),r||=OI(),{transform:r,locationIterator:YM(1,r.instanceCount.ref.value,1,function(){return WM},!1,function(){return!1}),theme:{color:$I(0,{value:e,lightness:0,saturation:0}),size:zI(0,{value:t})}}},e.createValues=function(e,t){var r=HI.getClip(e.clip);return{alpha:tf.create(e.alpha),uAlpha:tf.create(e.alpha),uVertexCount:tf.create(t.vertexCount),uGroupCount:tf.create(t.groupCount),drawCount:tf.create(t.drawCount),uMetalness:tf.create(e.material.metalness),uRoughness:tf.create(e.material.roughness),uBumpiness:tf.create(e.material.bumpiness),dLightCount:tf.create(1),dColorMarker:tf.create(!0),dClipObjectCount:tf.create(r.objects.count),dClipVariant:tf.create(r.variant),uClipObjectType:tf.create(r.objects.type),uClipObjectInvert:tf.create(r.objects.invert),uClipObjectPosition:tf.create(r.objects.position),uClipObjectRotation:tf.create(r.objects.rotation),uClipObjectScale:tf.create(r.objects.scale),instanceGranularity:tf.create(e.instanceGranularity)}},e.updateValues=function(e,t){tf.updateIfChanged(e.alpha,t.alpha),tf.updateIfChanged(e.uMetalness,t.material.metalness),tf.updateIfChanged(e.uRoughness,t.material.roughness),tf.updateIfChanged(e.uBumpiness,t.material.bumpiness);var r=HI.getClip(t.clip);
139tf.updateIfChanged(e.dClipObjectCount,r.objects.count),tf.updateIfChanged(e.dClipVariant,r.variant),tf.update(e.uClipObjectType,r.objects.type),tf.update(e.uClipObjectInvert,r.objects.invert),tf.update(e.uClipObjectPosition,r.objects.position),tf.update(e.uClipObjectRotation,r.objects.rotation),tf.update(e.uClipObjectScale,r.objects.scale),tf.updateIfChanged(e.instanceGranularity,t.instanceGranularity)},e.createRenderableState=function(e){void 0===e&&(e={});var t=void 0===e.alpha||1===e.alpha;return{disposed:!1,visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,opaque:t,writeDepth:t}},e.updateRenderableState=function(e,t){e.opaque=t.alpha*e.alphaFactor>=1,e.writeDepth=e.opaque}}(qI||={});var JI={array:new Uint8Array(4),width:1,height:1};function eD(e){return{tOverpaint:tf.create(JI),uOverpaintTexDim:tf.create(Bg.create(1,1)),dOverpaint:tf.create(!1),tOverpaintGrid:tf.create(AI()),uOverpaintGridDim:tf.create(Cg.create(1,1,1)),uOverpaintGridTransform:tf.create(Ng.create(0,0,0,1)),dOverpaintType:tf.create("groupInstance"),uOverpaintStrength:tf.create(1)}}function tD(e,t){if(0===t||e.length<t)return 0;for(var r=0,n=0;n<t;++n)r+=e[n];return r/(255*t)}var rD={array:new Uint8Array(1),width:1,height:1};function nD(e){return{tTransparency:tf.create(rD),uTransparencyTexDim:tf.create(Bg.create(1,1)),dTransparency:tf.create(!1),transparencyAverage:tf.create(0),tTransparencyGrid:tf.create(AI()),uTransparencyGridDim:tf.create(Cg.create(1,1,1)),uTransparencyGridTransform:tf.create(Ng.create(0,0,0,1)),dTransparencyType:tf.create("groupInstance"),uTransparencyStrength:tf.create(1)}}var iD={array:new Uint8Array(1),width:1,height:1};function aD(e){return{tClipping:tf.create(iD),uClippingTexDim:tf.create(Bg.create(1,1)),dClipping:tf.create(!1),dClippingType:tf.create("groupInstance")}}function oD(e,t,r){return e.fill(0,4*t,4*r),!0}var sD,uD={array:new Uint8Array(4),width:1,height:1};function cD(e){return{tSubstance:tf.create(uD),uSubstanceTexDim:tf.create(Bg.create(1,1)),dSubstance:tf.create(!1),tSubstanceGrid:tf.create(AI()),uSubstanceGridDim:tf.create(Cg.create(1,1,1)),uSubstanceGridTransform:tf.create(Ng.create(0,0,0,1)),dSubstanceType:tf.create("groupInstance"),uSubstanceStrength:tf.create(1)}}!function(e){function t(e,t,r,i,a,o,s){return s?function(e,t,r,n,i,a,o){return o.vertexCount=i,o.triangleCount=a,tf.update(o.vertexBuffer,e),tf.update(o.indexBuffer,t),tf.update(o.normalBuffer,r),tf.update(o.groupBuffer,n),o}(e,t,r,i,a,o,s):function(e,t,r,i,a,o){var s,u=XE(),c=-1,l=-1,d={kind:"mesh",vertexCount:a,triangleCount:o,vertexBuffer:tf.create(e),indexBuffer:tf.create(t),normalBuffer:tf.create(r),groupBuffer:tf.create(i),varyingGroup:tf.create(!1),get boundingSphere(){var e=n(d);if(e!==c){var t=jM(d.vertexBuffer.ref.value,d.vertexCount,1);XE.copy(u,t),c=e}return u},get groupMapping(){return d.groupBuffer.ref.version!==l&&(s=yM(d.groupBuffer.ref.value,d.vertexCount),l=d.groupBuffer.ref.version),s},setBoundingSphere:function(e){XE.copy(u,e),c=n(d)},meta:{}};return d}(e,t,r,i,a,o)}function r(e){return t(e?e.vertexBuffer.ref.value:new Float32Array,e?e.indexBuffer.ref.value:new Uint32Array,e?e.normalBuffer.ref.value:new Float32Array,e?e.groupBuffer.ref.value:new Float32Array,0,0,e)}function n(e){return Iv([e.vertexCount,e.triangleCount,e.vertexBuffer.ref.version,e.indexBuffer.ref.version,e.normalBuffer.ref.version,e.groupBuffer.ref.version])}e.create=t,e.createEmpty=r,e.computeNormals=function(e){var t=e.vertexCount,r=e.triangleCount,n=e.vertexBuffer.ref.value,i=e.indexBuffer.ref.value,a=e.normalBuffer.ref.value.length>=3*t?e.normalBuffer.ref.value:new Float32Array(3*t);a===e.normalBuffer.ref.value&&a.fill(0,0,3*t),vM(n,i,a,t,r),tf.update(e.normalBuffer,a)},e.checkForDuplicateVertices=function(e,t){void 0===t&&(t=3);for(var r=e.vertexBuffer.ref.value,n=new Map,i=function(e,t){return`${e[0].toFixed(t)}|${e[1].toFixed(t)}|${e[2].toFixed(t)}`},a=0,o=Cg(),s=0,u=e.vertexCount;s<u;++s){Cg.fromArray(o,r,3*s);var c=i(o,t),l=n.get(c);void 0===l?n.set(c,1):(a+=1,n.set(c,l+1))}return a};var i=Rg();function a(e){for(var t=e.vertexCount,r=e.triangleCount,n=e.indexBuffer.ref.value,i=[],a=0;a<t;
139++a)i[a]=[];for(a=0;a<r;++a){var o=n[3*a],s=n[3*a+1],u=n[3*a+2];Hb(i[o],s),Hb(i[o],u),Hb(i[s],o),Hb(i[s],u),Hb(i[u],o),Hb(i[u],s)}return i}function o(e){for(var t=e.triangleCount,r=e.indexBuffer.ref.value,n=new Map,i=function(e,t){var r=Mv(e,t),i=n.get(r)||0;n.set(r,i+1)},a=0;a<t;++a){var o=r[3*a],s=r[3*a+1],u=r[3*a+2];i(o,s),i(o,u),i(s,u)}return n}function s(e){var t=new Set,r=[0,0];return e.forEach(function(e,n){1===e&&(kv(r,n),t.add(r[0]),t.add(r[1]))}),t}function u(e,t,r){var n=new Map,i=function(e,t){n.has(e)?Hb(n.get(e),t):n.set(e,[t])};return t.forEach(function(n){for(var a=0,o=e[n];a<o.length;a++){var s=o[a];t.has(s)&&1===r.get(Mv(n,s))&&i(n,s)}}),n}function c(e,t,r,n){for(var i=e.vertexBuffer,a=e.indexBuffer,o=e.normalBuffer,s=e.triangleCount,u=i.ref.value,c=a.ref.value,l=o.ref.value,d=iv.create(Uint32Array,3,1024,s),f=0,h=0;h<s;++h)iv.add3(d,c[3*h],c[3*h+1],c[3*h+2]),f+=1;var p=Cg(),m=Cg(),g=Cg(),v=Cg(),y=Cg(),b=Cg(),_=Cg(),x=Cg(),S=Cg(),w=Cg(),A=Mg(120),C=new Set,T=Array.from(r.keys()).filter(function(e){return r.get(e).length<2}).map(function(e){var t=r.get(e);return Cg.fromArray(p,u,3*e),Cg.fromArray(m,u,3*t[0]),Cg.fromArray(g,u,3*t[1]),Cg.sub(y,m,p),Cg.sub(b,g,p),[e,Cg.angle(y,b)]});T.sort(function(e,t){return e[1]-t[1]});for(var P=0,E=T;P<E.length;P++){var M=E[P],k=M[0],I=M[1];if(!(C.has(k)||I>A)){var D=r.get(k);if((!t[D[0]].includes(D[1])||r.get(D[0])?.includes(D[1]))&&(Cg.fromArray(p,u,3*k),Cg.fromArray(m,u,3*D[0]),Cg.fromArray(g,u,3*D[1]),Cg.sub(y,m,p),Cg.sub(b,g,p),Cg.add(x,y,b),!(Cg.squaredDistance(p,m)>=n))){for(var O=!1,R=0,B=t[k];R<B.length;R++){var N=B[R];if(!D.includes(N)&&(Cg.fromArray(v,u,3*N),Cg.sub(_,v,p),Cg.dot(x,_)<0)){O=!0;break}}O&&(Cg.fromArray(S,l,3*k),Cg.triangleNormal(w,p,m,g),Cg.dot(w,S)>0?iv.add3(d,k,D[0],D[1]):iv.add3(d,D[1],D[0],k),C.add(k),C.add(D[0]),C.add(D[1]),f+=1)}}}var F=iv.compact(d);return e.triangleCount=f,tf.update(a,F),e}function l(e,t){var r=e.vertexCount,n=t.instanceCount.ref.value,i=KM(),a=i.position,o=e.vertexBuffer.ref.value,s=t.aTransform.ref.value;return YM(r,n,1,function(e,t){return t<0?Cg.fromArray(a,o,3*e):Cg.transformMat4Offset(a,o,s,0,3*e,16*t),i})}function d(e,t,r,n,i){var a=r.instanceCount,o=r.groupCount,s=CI(r,l(e,t),n.color),u=i.instanceGranularity?qM(a,"instance"):qM(a*o,"groupInstance"),c=eD(),d=nD(),f=cD(),h=aD(),p={drawCount:3*e.triangleCount,vertexCount:e.vertexCount,groupCount:o,instanceCount:a},m=XE.clone(e.boundingSphere),g=GM(m,t.aTransform.ref.value,a,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("mesh"),aPosition:e.vertexBuffer,aNormal:e.normalBuffer,aGroup:e.groupBuffer,elements:e.indexBuffer,dVaryingGroup:e.varyingGroup,boundingSphere:tf.create(g),invariantBoundingSphere:tf.create(m),uInvariantBoundingSphere:tf.create(Ng.ofSphere(m))},s),u),c),d),f),h),t),qI.createValues(i,p)),{uDoubleSided:tf.create(i.doubleSided),dFlatShaded:tf.create(i.flatShaded),dFlipSided:tf.create(i.flipSided),dIgnoreLight:tf.create(i.ignoreLight),dXrayShaded:tf.create("inverted"===i.xrayShaded?"inverted":!0===i.xrayShaded?"on":"off"),dTransparentBackfaces:tf.create(i.transparentBackfaces),uBumpFrequency:tf.create(i.bumpFrequency),uBumpAmplitude:tf.create(i.bumpAmplitude),meta:tf.create(e.meta)})}function f(e,t){qI.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xrayShaded,e.writeDepth=e.opaque}e.transform=function(e,t){var r=e.vertexBuffer.ref.value;dM(t,r,0,e.vertexCount),Og.isTranslationAndUniformScaling(t)||function(e,t,r,n){for(var i=0,a=3*n;i<a;i+=3)Cg.fromArray(lM,t,0+i),Cg.transformMat3(lM,lM,e),Cg.toArray(lM,t,0+i)}(Rg.directionTransform(i,t),e.normalBuffer.ref.value,0,e.vertexCount),tf.update(e.vertexBuffer,r)},e.getOriginalData=function(e){return("kind"in e?e.meta:e.meta.ref.value).originalData},e.uniformTriangleGroup=function(e,t){void 0===t&&(t=!0);var r=e.indexBuffer,n=e.vertexBuffer,i=e.groupBuffer,a=e.normalBuffer,o=e.triangleCount,s=e.vertexCount,u=r.ref.value,c=n.ref.value,l=i.ref.value,d=a.ref.value,f=iv.create(Uint32Array,3,1024,o),h=iv.create(Float32Array,3,1024,c);h.currentIndex=3*s,h.elementCount=s;var p=iv.create(Float32Array,3,1024,d);p.currentIndex=3*s,p.elementCount=s;var m=iv.create(Float32Array,1,1024,l);m.currentIndex=s,m.elementCount=s;var g=Cg(),v=Cg(),y=Cg(),b=Cg(),_=Cg(),x=Cg();function S(e){Cg.fromArray(g,c,3*e),Cg.fromArray(b,d,3*e),iv.add3(h,g[0],g[1],g[2]),iv.add3(p,b[0],b[1],b[2])}function w(e,t){Cg.fromArray(g,c,3*e),Cg.fromArray(v,c,3*t),Cg.scale(g,Cg.add(g,g,v),.5),Cg.fromArray(b,d,3*e),Cg.fromArray(_,d,3*t),Cg.scale(b,Cg.add(b,b,_),.5),iv.add3(h,g[0],g[1],g[2]),iv.add3(p,b[0],b[1],b[2])}function A(e,t,r){Cg.fromArray(g,c,3*e),Cg.fromArray(v,c,3*t),Cg.fromArray(y,c,3*r),Cg.scale(g,Cg.add(g,Cg.add(g,g,v),y),1/3),Cg.fromArray(b,d,3*e),Cg.fromArray(_,d,3*t),Cg.fromArray(x,d,3*r),Cg.scale(b,Cg.add(b,Cg.add(b,b,_),x),1/3),iv.add3(h,g[0],g[1],g[2]),iv.add3(p,b[0],b[1],b[2])}function C(e,t,r,n,i){++P,S(e),w(e,t),w(e,r),iv.add3(f,T,T+1,T+2);for(var a=0;a<3;++a)iv.add(m,n);for(T+=3,P+=2,S(t),S(r),w(e,t),w(e,r),iv.add3(f,T,T+1,T+3),iv.add3(f,T,T+3,T+2),a=0;a<4;++a)iv.add(m,i);T+=4}var T=s,P=0;if(t)for(var E=0,M=o;E<M;++E){var k=u[3*E],I=u[3*E+1],D=u[3*E+2],O=l[k],R=l[I],B=l[D];if(O===R&&O===B)++P,iv.add3(f,k,I,D);else if(O===R)C(D,k,I,B,O);else if(O===B)C(I,D,k,R,B);else if(R===B)C(k,I,D,O,R);else{P+=2,S(k),w(k,I),w(k,D),A(k,I,D),iv.add3(f,T,T+1,T+3),iv.add3(f,T,T+3,T+2);for(var N=0;N<4;++N)iv.add(m,O);for(T+=4,P+=2,S(I),w(I,D),w(I,k),A(k,I,D),iv.add3(f,T,T+1,T+3),iv.add3(f,T,T+3,T+2),N=0;N<4;++N)iv.add(m,R);for(T+=4,P+=2,S(D),w(D,I),w(D,k),A(k,I,D),iv.add3(f,T+3,T+1,T),iv.add3(f,T+2,T+3,T),N=0;N<4;++N)iv.add(m,B);T+=4}}else for(E=0,M=o;E<M;++E)if(k=u[3*E],I=u[3*E+1],D=u[3*E+2],O=l[k],R=l[I],B=l[D],O!==R||O!==B){++P,S(k),S(I),S(D),iv.add3(f,T,T+1,T+2);var F=R===B?R:O;for(N=0;N<3;++N)iv.add(m,F);T+=3}else++P,iv.add3(f,k,I,D);var L=iv.compact(f),$=iv.compact(h),U=iv.compact(p),j=iv.compact(m);return e.vertexCount=T,e.triangleCount=P,tf.update(n,$),tf.update(i,j),tf.update(r,
139L),tf.update(a,U),e.meta.originalData={indexBuffer:u,vertexCount:s,triangleCount:o},e},e.smoothEdges=function(e,t){!function(e,t){for(var r=e.indexBuffer,n=e.triangleCount,i=r.ref.value,a=iv.create(Uint32Array,3,1024,n),o=0,s=0;s<n;++s){var u=i[3*s],c=i[3*s+1],l=i[3*s+2];2!==t[u].length&&2!==t[c].length&&2!==t[l].length&&(iv.add3(a,u,c,l),o+=1)}var d=iv.compact(a);e.triangleCount=o,tf.update(r,d)}(e,a(e));for(var r=0;r<10;++r){var n=e.triangleCount,i=o(e),l=a(e);if(c(e,l,u(l,s(i),i),t.maxNewEdgeLength*t.maxNewEdgeLength),e.triangleCount===n)break}var d=o(e);return function(e,t,r){for(var n=r.iterations,i=r.lambda,a=Cg(),o=Cg(),s=Cg(),u=Cg(),c=-i,l=new Float32Array(e.vertexBuffer.ref.value.length),d=function(r){var n=e.vertexBuffer.ref.value;l.set(n),t.forEach(function(e,t){if(2===e.length){Cg.fromArray(a,n,3*t),Cg.fromArray(o,n,3*e[0]),Cg.fromArray(s,n,3*e[1]);var i=1/Cg.distance(a,o),c=1/Cg.distance(a,s);Cg.scale(o,o,i),Cg.scale(s,s,c),Cg.add(u,o,s),Cg.scale(u,u,1/(i+c)),Cg.sub(u,u,a),Cg.scale(u,u,r),Cg.add(u,a,u),Cg.toArray(u,l,3*t)}});var i=e.vertexBuffer.ref.value;tf.update(e.vertexBuffer,l),l=i},f=0;f<n;++f)d(i),d(c)}(e,u(a(e),s(d),d),{iterations:t.iterations,lambda:.5}),e},e.Params=Ac(Ac({},qI.Params),{doubleSided:Ib.Boolean(!1,qI.CustomQualityParamInfo),flipSided:Ib.Boolean(!1,qI.ShadingCategory),flatShaded:Ib.Boolean(!1,qI.ShadingCategory),ignoreLight:Ib.Boolean(!1,qI.ShadingCategory),xrayShaded:Ib.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],qI.ShadingCategory),transparentBackfaces:Ib.Select("off",Ib.arrayToOptions(["off","on","opaque"]),qI.ShadingCategory),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory),bumpAmplitude:Ib.Numeric(1,{min:0,max:5,step:.1},qI.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:r,createValues:d,createValuesSimple:function(t,r,n,i,a){var o=qI.createSimple(n,i,a),s=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return d(t,o.transform,o.locationIterator,o.theme,s)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uDoubleSided,t.doubleSided),tf.updateIfChanged(e.dFlatShaded,t.flatShaded),tf.updateIfChanged(e.dFlipSided,t.flipSided),tf.updateIfChanged(e.dIgnoreLight,t.ignoreLight),tf.updateIfChanged(e.dXrayShaded,"inverted"===t.xrayShaded?"inverted":!0===t.xrayShaded?"on":"off"),tf.updateIfChanged(e.dTransparentBackfaces,t.transparentBackfaces),tf.updateIfChanged(e.uBumpFrequency,t.bumpFrequency),tf.updateIfChanged(e.uBumpAmplitude,t.bumpAmplitude)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=qI.createRenderableState(e);return f(t,e),t},updateRenderableState:f,createPositionIterator:l}}(sD||={});var lD={radius:1,detail:0},dD=Cg(),fD=Cg(),hD=Cg();function pD(e,t){for(var r=t.length,n=gD(r/3),i=0;i<r;i+=3)Cg.fromArray(dD,e,3*t[i]),Cg.fromArray(fD,e,3*t[i+1]),Cg.fromArray(hD,e,3*t[i+2]),n.add(dD,fD,hD);return n.getPrimitive()}var mD=Cg();function gD(e,t){void 0===t&&(t=3*e);var r=new Float32Array(3*t),n=new Float32Array(3*t),i=new Uint32Array(3*e),a=0,o=0;return{add:function(e,t,s){Cg.toArray(e,r,a),Cg.toArray(t,r,a+3),Cg.toArray(s,r,a+6),Cg.triangleNormal(mD,e,t,s);for(var u=0;u<3;++u)Cg.toArray(mD,n,a+3*u),i[o+u]=a/3+u;a+=9,o+=3},addQuad:function(e,t,s,u){Cg.toArray(e,r,a),Cg.toArray(t,r,a+3),Cg.toArray(s,r,a+6),Cg.toArray(u,r,a+9),Cg.triangleNormal(mD,e,t,s);for(var c=0;c<4;++c)Cg.toArray(mD,n,a+3*c);var l=a/3;i[o]=l,i[o+1]=l+1,i[o+2]=l+2,i[o+3]=l+2,i[o+4]=l+3,i[o+5]=l,a+=12,o+=6},getPrimitive:function(){return{vertices:r,normals:n,indices:i}}}}var vD=Cg(),yD=Rg();function bD(e,t){for(var r=e.vertices,n=e.normals,i=Rg.directionTransform(yD,t),a=0,o=r.length;a<o;a+=3)Cg.transformMat4(vD,Cg.fromArray(vD,r,a),t),Cg.toArray(vD,r,a),Cg.transformMat3(vD,Cg.fromArray(vD,n,a),i),Cg.toArray(vD,n,a);return e}function _D(e,t){return{vertices:e,edges:t}}function xD(e){return{vertices:new Float32Array(e.vertices),edges:new Uint32Array(e.edges)}}var SD=Cg.zero();function wD(e,t){for(var r=e.vertices,n=0,i=r.length;n<i;n+=3)Cg.transformMat4(SD,Cg.fromArray(SD,r,n),t),Cg.toArray(SD,r,n);return e}var AD,CD=(1+Math.sqrt(5))/2,TD=(AD||=pD([-1,CD,0,1,CD,0,-1,-CD,0,1,-CD,0,0,-1,CD,0,1,CD,0,-1,-CD,0,1,-CD,CD,0,-1,CD,0,1,-CD,0,-1,-CD,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]),AD),PD=TD.vertices,ED=TD.indices;function MD(e){return 10*(2**e)**2+2}var kD=new Map,ID=Og.identity();function DD(e){var t=kD.get(e);return void 0===t&&(t=function(e){return function(e,t,r){var n=Ac(Ac({},lD),r),i=n.radius,a=n.detail,o=function(){var e=[],t=[],r=new Map;function n(t){var n=`${t[0].toFixed(5)}|${t[1].toFixed(5)}|${t[2].toFixed(5)}`,i=r.get(n);return void 0===i&&(i=e.length/3,r.set(n,i),e.push.apply(e,t)),i}return{vertices:e,indices:t,add:function(e,r,i){t.push(n(e),n(r),n(i))}}}(),s=o.vertices,u=o.indices;(function(r){for(var n=Cg(),i=Cg(),a=Cg(),o=0;o<t.length;o+=3)Cg.fromArray(n,e,3*t[o+0]),Cg.fromArray(i,e,3*t[o+1]),Cg.fromArray(a,e,3*t[o+2]),l(n,i,a,r)})(a),function(e,t){for(var r=0,n=e.length;r<n;r+=3)Cg.fromArray(lM,e,r),Cg.normalize(lM,lM),Cg.scale(lM,lM,t),Cg.toArray(lM,e,r)}(s,i);var c=new Float32Array(s.length);return vM(s,u,c,s.length/3,u.length/3),{vertices:new Float32Array(s),normals:new Float32Array(c),indices:new Uint32Array(u)};function l(e,t,r,n){for(var i=2**n,a=[],s=0;s<=i;++s){a[s]=[];var u=Cg();Cg.lerp(u,e,r,s/i);
139var c=Cg();Cg.lerp(c,t,r,s/i);for(var l=i-s,d=0;d<=l;++d)if(0===d&&s===i)a[s][d]=u;else{var f=Cg();Cg.lerp(f,u,c,d/l),a[s][d]=f}}for(s=0;s<i;++s)for(d=0;d<2*(i-s)-1;++d){var h=Math.floor(d/2);d%2==0?o.add(a[s][h+1],a[s+1][h],a[s][h]):o.add(a[s][h+1],a[s+1][h+1],a[s+1][h])}}}(PD,ED,{detail:e,radius:1})}(e),kD.set(e,t)),t}function OD(e,t,r,n){dO.addPrimitive(e,function(e,t,r){return Og.scaleUniformly(e,Og.fromTranslation(e,t),r)}(ID,t,r),DD(n))}var RD={radiusTop:1,radiusBottom:1,height:1,radialSegments:8,heightSegments:1,topCap:!1,bottomCap:!1,thetaStart:0,thetaLength:2*Math.PI};function BD(e,t,r){void 0===r&&(r=-1);for(var n=new Float32Array(3*e),i=-1===r?e<=4?Math.sqrt(2)/2:.6:r,a=+!!t,o=0,s=e;o<s;++o){var u=(2*o+a)/e*Math.PI;n[3*o]=Math.cos(u)*i,n[3*o+1]=Math.sin(u)*i,n[3*o+2]=0}return n}var ND,FD,LD,$D,UD,jD=Cg(),zD=Cg(),GD=Cg(),VD=Cg(),HD=Cg(),qD=Cg(),WD={height:1,topCap:!0,bottomCap:!0};function XD(e,t){var r=e.length/3;if(r<3)throw Error("need at least 3 points to build a prism");var n=Ac(Ac({},WD),t),i=n.height,a=n.topCap,o=n.bottomCap,s=2*r,u=4*r,c=+!!a+ +!!o;3===r?(s+=c,u+=3*c):4===r?(s+=2*c,u+=4*c):(s+=c*r,u+=c*r*3);var l=gD(s,u),d=.5*i;Cg.set(jD,0,0,-d),Cg.set(zD,0,0,d);for(var f=0;f<r;++f){var h=(f+1)%r;Cg.set(GD,e[3*f],e[3*f+1],-d),Cg.set(VD,e[3*h],e[3*h+1],-d),Cg.set(HD,e[3*h],e[3*h+1],d),Cg.set(qD,e[3*f],e[3*f+1],d),l.addQuad(GD,VD,HD,qD)}if(3===r)a&&(Cg.set(GD,e[0],e[1],-d),Cg.set(VD,e[3],e[4],-d),Cg.set(HD,e[6],e[7],-d),l.add(HD,VD,GD)),o&&(Cg.set(GD,e[0],e[1],d),Cg.set(VD,e[3],e[4],d),Cg.set(HD,e[6],e[7],d),l.add(GD,VD,HD));else if(4===r)a&&(Cg.set(GD,e[0],e[1],-d),Cg.set(VD,e[3],e[4],-d),Cg.set(HD,e[6],e[7],-d),Cg.set(qD,e[9],e[10],-d),l.addQuad(qD,HD,VD,GD)),o&&(Cg.set(GD,e[0],e[1],d),Cg.set(VD,e[3],e[4],d),Cg.set(HD,e[6],e[7],d),Cg.set(qD,e[9],e[10],d),l.addQuad(GD,VD,HD,qD));else for(f=0;f<r;++f)h=(f+1)%r,a&&(Cg.set(GD,e[3*f],e[3*f+1],-d),Cg.set(VD,e[3*h],e[3*h+1],-d),l.add(jD,VD,GD)),o&&(Cg.set(GD,e[3*f],e[3*f+1],d),Cg.set(VD,e[3*h],e[3*h+1],d),l.add(GD,VD,zD));return l.getPrimitive()}var YD=new Map,KD=Cg.create(0,1,0),ZD=Cg(),QD=Cg(),JD=Cg(),eO=Og(),tO=Og(),rO=Cg(),nO=Cg(),iO=Cg();function aO(e,t,r,n,i){return Cg.setMagnitude(QD,r,n/2),Cg.add(JD,t,QD),i?Cg.matchDirection(iO,KD,QD):Cg.copy(iO,KD),Cg.set(rO,1,n,1),Cg.makeRotation(tO,iO,QD),Og.scale(e,tO,rO),Og.setTranslation(e,JD)}var oO=new Int32Array(9);function sO(e){var t=function(e){return oO[0]=Math.round(1e3*(e.radiusTop??RD.radiusTop)),oO[1]=Math.round(1e3*(e.radiusBottom??RD.radiusBottom)),oO[2]=Math.round(1e3*(e.height??RD.height)),oO[3]=e.radialSegments??RD.radialSegments,oO[4]=e.heightSegments??RD.heightSegments,oO[5]=e.topCap??RD.topCap?1:0,oO[6]=e.bottomCap??RD.bottomCap?1:0,oO[7]=Math.round(1e3*(e.thetaStart??RD.thetaStart)),oO[8]=Math.round(1e3*(e.thetaLength??RD.thetaLength)),Iv(oO)}(e),r=YD.get(t);return void 0===r&&(r=e.radialSegments&&e.radialSegments<=4?bD(XD(BD(Math.max(3,e.radialSegments),!0,e.radiusTop),e),Og.rotX90):function(e){var t=Ac(Ac({},RD),e),r=t.radiusTop,n=t.radiusBottom,i=t.height,a=t.radialSegments,o=t.heightSegments,s=t.topCap,u=t.bottomCap,c=t.thetaStart,l=t.thetaLength,d=[],f=[],h=[],p=0,m=[],g=i/2;return function(){for(var e=Cg.zero(),t=(n-r)/i,s=0;s<=o;++s){for(var u=[],v=s/o,y=v*(n-r)+r,b=0;b<=a;++b){var _=b/a*l+c,x=Math.sin(_),S=Math.cos(_);f.push(y*x,-v*i+g,y*S),Cg.normalize(e,Cg.set(e,x,t,S)),h.push.apply(h,e),u.push(p++)}m.push(u)}for(b=0;b<a;++b)for(s=0;s<o;++s){var w=m[s][b],A=m[s+1][b],C=m[s+1][b+1],T=m[s][b+1];d.push(w,A,T),d.push(A,C,T)}}(),s&&r>0&&v(!0),u&&n>0&&v(!1),{vertices:new Float32Array(f),normals:new Float32Array(h),indices:new Uint32Array(d)};function v(e){for(var t=!0===e?r:n,i=!0===e?1:-1,o=p,s=1;s<=a;++s)f.push(0,g*i,0),h.push(0,i,0),++p;var u=p;for(s=0;s<=a;++s){var m=s/a*l+c,v=Math.cos(m),y=Math.sin(m);f.push(t*y,g*i,t*v),h.push(0,i,0),++p}for(s=0;s<a;++s){var b=o+s,_=u+s;!0===e?d.push(_,_+1,b):d.push(_+1,_,b)}}}(e),YD.set(t,r)),r}function uO(e,t,r,n,i){var a=Cg.distance(t,r)*n;Cg.sub(ZD,r,t),aO(eO,t,ZD,a,!0),dO.addPrimitive(e,eO,sO(i))}function cO(e,t,r,n,i,a){var o=Cg.distance(t,r)*n,s=sO(a);Cg.sub(ZD,r,t),Cg.add(nO,t,i),aO(eO,nO,ZD,o,!0),dO.addPrimitive(e,eO,s),Cg.sub(nO,t,i),aO(eO,nO,ZD,o,!0),dO.addPrimitive(e,eO,s)}function lO(e,t,r,n,i,a,o){var s=Cg.distance(t,r)*n,u=i%2!=0,c=Math.floor((i+1)/2),l=s/(i+.5),d=sO(o);Cg.setMagnitude(ZD,Cg.sub(ZD,r,t),l),Cg.copy(nO,t);for(var f=0;f<c;++f)Cg.add(nO,nO,ZD),u&&f===c-1&&(!a&&o.topCap&&(o.topCap=!1,d=sO(o)),l/=2),aO(eO,nO,ZD,l,!1),dO.addPrimitive(e,eO,d),Cg.add(nO,nO,ZD)}var dO,fO=Cg(),hO=Rg(),pO=Cg(),mO=Cg(),gO=Cg(),vO=Cg(),yO=Cg.fromArray,bO=Cg.triangleNormal,_O=Cg.copy,xO=Cg.transformMat4,SO=Cg.transformMat3,wO=Rg.directionTransform,AO=iv.add3,CO=iv.add;function TO(e,t,r){return e=bg(Math.round(e),0,16777215)+1,t[r+2]=e%256,e=Math.floor(e/256),t[r+1]=e%256,e=Math.floor(e/256),t[r]=e%256,t}function PO(e,t,r){return 256*Math.floor(e)*256+256*Math.floor(t)+Math.floor(r)-1}
139!function(e){function t(e,t,r,n){var i=e.vertices,a=e.normals,o=e.indices,s=e.groups,u=e.currentGroup,c=i.elementCount;AO(i,t[0],t[1],t[2]),AO(i,r[0],r[1],r[2]),AO(i,n[0],n[1],n[2]),bO(fO,t,r,n);for(var l=0;l<3;++l)AO(a,fO[0],fO[1],fO[2]),CO(s,u);AO(o,c,c+1,c+2)}function r(e,t,r,n,i){var a=e.vertices,o=e.normals,s=e.indices,u=e.groups,c=e.currentGroup,l=a.elementCount;AO(a,t[0],t[1],t[2]),AO(a,r[0],r[1],r[2]),AO(a,n[0],n[1],n[2]);for(var d=0;d<3;++d)AO(o,i[0],i[1],i[2]),CO(u,c);AO(s,l,l+1,l+2)}function n(e,t,r){for(var n=r.vertices,i=r.normals,a=r.indices,o=e.vertices,s=e.normals,u=e.indices,c=e.groups,l=e.currentGroup,d=o.elementCount,f=wO(hO,t),h=0,p=n.length;h<p;h+=3)xO(fO,yO(fO,n,h),t),AO(o,fO[0],fO[1],fO[2]),SO(fO,yO(fO,i,h),f),AO(s,fO[0],fO[1],fO[2]),CO(c,l);for(h=0,p=a.length;h<p;h+=3)AO(u,a[h]+d,a[h+1]+d,a[h+2]+d)}e.createState=function(e,t,r){return void 0===e&&(e=2048),void 0===t&&(t=1024),{currentGroup:-1,vertices:iv.create(Float32Array,3,t,r?r.vertexBuffer.ref.value:e),normals:iv.create(Float32Array,3,t,r?r.normalBuffer.ref.value:e),indices:iv.create(Uint32Array,3,3*t,r?r.indexBuffer.ref.value:3*e),groups:iv.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e),mesh:r}},e.addTriangle=t,e.addTriangleWithNormal=r,e.addTriangleStrip=function(e,r,n){yO(gO,r,3*n[0]),yO(vO,r,3*n[1]);for(var i=2,a=n.length;i<a;i+=2)_O(pO,gO),_O(mO,vO),yO(gO,r,3*n[i]),yO(vO,r,3*n[i+1]),t(e,pO,mO,gO),t(e,mO,vO,gO)},e.addTriangleFan=function(e,r,n){yO(pO,r,3*n[0]);for(var i=2,a=n.length;i<a;++i)yO(mO,r,3*n[i-1]),yO(gO,r,3*n[i]),t(e,pO,gO,mO)},e.addTriangleFanWithNormal=function(e,t,n,i){yO(pO,t,3*n[0]);for(var a=2,o=n.length;a<o;++a)yO(mO,t,3*n[a-1]),yO(gO,t,3*n[a]),r(e,pO,gO,mO,i)},e.addPrimitive=n,e.addPrimitiveFlipped=function(e,t,r){for(var n=r.vertices,i=r.normals,a=r.indices,o=e.vertices,s=e.normals,u=e.indices,c=e.groups,l=e.currentGroup,d=o.elementCount,f=wO(hO,t),h=0,p=n.length;h<p;h+=3)xO(fO,yO(fO,n,h),t),AO(o,fO[0],fO[1],fO[2]),SO(fO,yO(fO,i,h),f),AO(s,-fO[0],-fO[1],-fO[2]),CO(c,l);for(h=0,p=a.length;h<p;h+=3)AO(u,a[h+2]+d,a[h+1]+d,a[h]+d)},e.addCage=function(e,t,r,n,i,a){for(var o=r.vertices,s=r.edges,u={radiusTop:n,radiusBottom:n,radialSegments:a},c=0,l=s.length;c<l;c+=2)yO(pO,o,3*s[c]),yO(mO,o,3*s[c+1]),xO(pO,pO,t),xO(mO,mO,t),OD(e,pO,n,i),OD(e,mO,n,i),uO(e,pO,mO,1,u)},e.addMesh=function(e,t,r){n(e,t,{vertices:r.vertexBuffer.ref.value.subarray(0,3*r.vertexCount),normals:r.normalBuffer.ref.value.subarray(0,3*r.vertexCount),indices:r.indexBuffer.ref.value.subarray(0,3*r.triangleCount)})},e.getMesh=function(e){var t=e.vertices,r=e.normals,n=e.indices,i=e.groups,a=e.mesh,o=iv.compact(t,!0),s=iv.compact(n,!0),u=iv.compact(r,!0),c=iv.compact(i,!0);return sD.create(o,s,u,c,e.vertices.elementCount,e.indices.elementCount,a)}}(dO||={});var EO=255/256,MO=Cg.create(16777216,65536,256),kO=Ng.create(EO/MO[0],EO/MO[1],EO/MO[2],.99609375),IO=Ng();function DO(e,t,r){switch(cB.getGranularity(e,t.granularity)){case"uniform":return function(e,t,r){return function(e,t){return t?(tf.update(t.uSize,e),tf.updateIfChanged(t.dSizeType,"uniform"),t):Ac(Ac({uSize:tf.create(e)},{tSize:tf.create(NO),uSizeTexDim:tf.create(Bg.create(1,1))}),{dSizeType:tf.create("uniform")})}(t(WM),r)}(0,t.size,r);case"group":return function(e,t,r){var n=e.groupCount,i=NM(Math.max(1,n),3,Uint8Array,r&&r.tSize.ref.value.array);for(e.reset();e.hasNext&&!e.isNextNewInstance;){var a=e.move();TO(t(a.location)*OO,i.array,3*a.groupIndex)}return FO(i,"group",r)}(e,t.size,r);case"groupInstance":return function(e,t,r){var n=e.groupCount,i=e.instanceCount*n,a=NM(Math.max(1,i),3,Uint8Array,r&&r.tSize.ref.value.array);for(e.reset();e.hasNext;){var o=e.move();TO(t(o.location)*OO,a.array,3*o.index)}return FO(a,"groupInstance",r)}(e,t.size,r);case"instance":return function(e,t,r){var n=e.instanceCount,i=NM(Math.max(1,n),3,Uint8Array,r&&r.tSize.ref.value.array);for(e.reset();e.hasNext&&!e.isNextNewInstance;){var a=e.move();TO(t(a.location)*OO,i.array,3*a.instanceIndex),e.skipInstance()}return FO(i,"instance",r)}(e,t.size,r)}}var OO=100;function RO(e){switch(e.dSizeType.ref.value){case"uniform":return e.uSize.ref.value;case"instance":case"group":case"groupInstance":for(var t=0,r=e.tSize.ref.value.array,n=0,i=r.length;n<i;n+=3){var a=PO(r[n],r[n+1],r[n+2]);t<a&&(t=a)}return t/OO}}var BO,NO={array:new Uint8Array(3),width:1,height:1};function FO(e,t,r){return r?(tf.update(r.tSize,e),tf.update(r.uSizeTexDim,Bg.create(e.width,e.height)),tf.updateIfChanged(r.dSizeType,t),r):{uSize:tf.create(0),tSize:tf.create(e),uSizeTexDim:tf.create(Bg.create(e.width,e.height)),dSizeType:tf.create(t)}}function LO(e,t,r,n,i,a,o){for(var s=0;s<t;s++){for(var u=0;u<r;u++)n[u]=e[u*t+s];for($O(n,i,a,o,r),u=0;u<r;u++)e[u*t+s]=i[u]}for(u=0;
139u<r;u++){for(s=0;s<t;s++)n[s]=e[u*t+s];for($O(n,i,a,o,t),s=0;s<t;s++)e[u*t+s]=Math.sqrt(i[s])}}function $O(e,t,r,n,i){r[0]=0,n[0]=-(2**53-1),n[1]=2**53-1;for(var a=1,o=0;a<i;a++){for(var s=(e[a]+a*a-(e[r[o]]+r[o]*r[o]))/(2*a-2*r[o]);s<=n[o];)o--,s=(e[a]+a*a-(e[r[o]]+r[o]*r[o]))/(2*a-2*r[o]);r[++o]=a,n[o]=s,n[o+1]=2**53-1}for(a=0,o=0;a<i;a++){for(;n[o+1]<a;)o++;t[a]=(a-r[o])*(a-r[o])+e[r[o]]}}!function(e){function t(e,t,r,i){return i?function(e,t,r,n){return n.pointCount=r,tf.update(n.centerBuffer,e),tf.update(n.groupBuffer,t),n}(e,t,r,i):function(e,t,r){var i,a=XE(),o=-1,s=-1,u={kind:"points",pointCount:r,centerBuffer:tf.create(e),groupBuffer:tf.create(t),get boundingSphere(){var e=n(u);if(e!==o){var t=jM(u.centerBuffer.ref.value,u.pointCount,1);XE.copy(a,t),o=e}return a},get groupMapping(){return u.groupBuffer.ref.version!==s&&(i=yM(u.groupBuffer.ref.value,u.pointCount),s=u.groupBuffer.ref.version),i},setBoundingSphere:function(e){XE.copy(a,e),o=n(u)}};return u}(e,t,r)}function r(e){return t(e?e.centerBuffer.ref.value:new Float32Array,e?e.groupBuffer.ref.value:new Float32Array,0,e)}function n(e){return Iv([e.pointCount,e.centerBuffer.ref.version,e.groupBuffer.ref.version])}function i(e,t){var r=e.pointCount,n=t.instanceCount.ref.value,i=KM(),a=i.position,o=e.centerBuffer.ref.value,s=t.aTransform.ref.value;return YM(r,n,1,function(e,t){return t<0?Cg.fromArray(a,o,3*e):Cg.transformMat4Offset(a,o,s,0,3*e,16*t),i})}function a(e,t,r,n,a){var o=r.instanceCount,s=r.groupCount,u=CI(r,i(e,t),n.color),c=DO(r,n.size),l=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),d=eD(),f=nD(),h=cD(),p=aD(),m={drawCount:e.pointCount,vertexCount:e.pointCount,groupCount:s,instanceCount:o},g=XE.clone(e.boundingSphere),v=GM(g,t.aTransform.ref.value,o,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("points"),aPosition:e.centerBuffer,aGroup:e.groupBuffer,boundingSphere:tf.create(v),invariantBoundingSphere:tf.create(g),uInvariantBoundingSphere:tf.create(Ng.ofSphere(g))},u),c),l),d),f),h),p),t),qI.createValues(a,m)),{uSizeFactor:tf.create(a.sizeFactor),dPointSizeAttenuation:tf.create(a.pointSizeAttenuation),dPointStyle:tf.create(a.pointStyle)})}function o(e,t){qI.updateRenderableState(e,t),e.opaque=e.opaque&&"fuzzy"!==t.pointStyle,e.writeDepth=e.opaque}e.create=t,e.createEmpty=r,e.transform=function(e,t){var r=e.centerBuffer.ref.value;dM(t,r,0,e.pointCount),tf.update(e.centerBuffer,r)},e.StyleTypes={square:"Square",circle:"Circle",fuzzy:"Fuzzy"},e.StyleTypeNames=Object.keys(e.StyleTypes),e.Params=Ac(Ac({},qI.Params),{sizeFactor:Ib.Numeric(3,{min:0,max:10,step:.1}),pointSizeAttenuation:Ib.Boolean(!1),pointStyle:Ib.Select("square",Ib.objectToOptions(e.StyleTypes))}),e.Utils={Params:e.Params,createEmpty:r,createValues:a,createValuesSimple:function(t,r,n,i,o){var s=qI.createSimple(n,i,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return a(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uSizeFactor,t.sizeFactor),tf.updateIfChanged(e.dPointSizeAttenuation,t.pointSizeAttenuation),tf.updateIfChanged(e.dPointStyle,t.pointStyle)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=qI.createRenderableState(e);return o(t,e),t},updateRenderableState:o,createPositionIterator:i}}(BO||={});var UO,jO={},zO={fontFamily:Ib.Select("sans-serif",[["sans-serif","Sans Serif"],["monospace","Monospace"],["serif","Serif"],["cursive","Cursive"]]),fontQuality:Ib.Select(3,[[0,"lower"],[1,"low"],[2,"medium"],[3,"high"],[4,"higher"]]),fontStyle:Ib.Select("normal",[["normal","Normal"],["italic","Italic"],["oblique","Oblique"]]),fontVariant:Ib.Select("normal",[["normal","Normal"],["small-caps","Small Caps"]]),fontWeight:Ib.Select("normal",[["normal","Normal"],["bold","Bold"]])},GO=function(){function e(e){void 0===e&&(e={}),this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.cutoff=.5;var t=Ac(Ac({},Ib.getDefaultValues(zO)),e);this.props=t;var r,n,i,a,o=32*(t.fontQuality+1);this.buffer=o/8,this.radius=o/3,this.lineHeight=Math.round(o+2*this.buffer+this.radius),this.maxWidth=Math.round(.75*this.lineHeight),this.texture=NM(350*this.lineHeight*this.maxWidth,1,Uint8Array),this.scratchContext=(r=this.maxWidth,n=this.lineHeight,i={willReadFrequently:!0},wy?(a=function(){throw Error("When running in Node.js and wanting to use Canvas API, call mol-util/data-source's setCanvasModule function first and pass imported `canvas` module to it.")}().createCanvas(r,n)).getContext("2d",i):((a=document.createElement("canvas")).width=r,a.height=n,a.getContext("2d",i))),this.scratchContext.font=`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${o}px ${t.fontFamily}`,this.scratchContext.fillStyle="black",this.scratchContext.textBaseline="middle",this.scratchData=new Uint8Array(this.lineHeight*this.maxWidth),this.gridOuter=new Float64Array(this.lineHeight*this.maxWidth),this.gridInner=new Float64Array(this.lineHeight*this.maxWidth),this.f=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.d=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.z=new Float64Array(Math.max(this.lineHeight,this.maxWidth)+1),this.v=new Int16Array(Math.max(this.lineHeight,this.maxWidth)),this.middle=Math.ceil(this.lineHeight/2),this.placeholder=this.get("�")}return e.prototype.get=function(e){if(void 0===this.mapped[e]){this.draw(e);var t=this.texture,r=t.array,n=t.width,i=t.height,a=this.scratchData;if(this.currentX+this.scratchW>n&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>i)return console.warn("canvas to small"),this.placeholder;this.mapped[e]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH,nw:this.scratchW/this.lineHeight,nh:this.scratchH/this.lineHeight};for(var o=0;o<this.scratchH;++o)for(var s=0;s<this.scratchW;++s)r[n*(this.currentY+o)+this.currentX+s]=a[o*this.scratchW+s];this.currentX+=this.scratchW}return this.mapped[e]},e.prototype.draw=function(e){var t=this.lineHeight,r=this.scratchContext,n=this.scratchData,i=r.measureText(e),a=Math.min(this.maxWidth,Math.ceil(i.width+2*this.buffer)),o=a*t;r.clearRect(0,0,a,t),r.fillText(e,this.buffer,this.middle);for(var s=r.getImageData(0,0,a,t),u=0;u<o;u++){var c=s.data[4*u+3]/255;this.gridOuter[u]=1===c?0:0===c?2**53-1:Math.max(0,.5-c)**2,this.gridInner[u]=1===c?2**53-1:0===c?0:Math.max(0,c-.5)**2}for(LO(this.gridOuter,a,t,this.f,this.d,this.v,this.z),LO(this.gridInner,a,t,this.f,this.d,this.v,this.z),u=0;u<o;u++){var l=this.gridOuter[u]-this.gridInner[u];n[u]=Math.max(0,Math.min(255,Math.round(255-255*(l/this.radius+this.cutoff))))}this.scratchW=a,this.scratchH=t},e}();function VO(e,t,r,n){for(var i=0,a=0,o=0,s=4*r;o<s;++o){var u=2*o,c=Math.abs(e[u]);c>i&&(i=c);var l=Math.abs(e[u+1]);l>i&&(i=l);var d=Math.abs(t[o]);d>a&&(a=d)}return Math.max(a,n+n*i)}!function(e){function t(e,t,r,i,a,o,s,u,c){return c?function(e,t,r,n,i,a,o,s,u){return u.charCount=s,tf.update(u.fontTexture,e),tf.update(u.centerBuffer,t),tf.update(u.mappingBuffer,r),tf.update(u.depthBuffer,n),tf.update(u.indexBuffer,i),tf.update(u.groupBuffer,a),tf.update(u.tcoordBuffer,o),u}(e,t,r,i,a,o,s,u,c):function(e,t,r,i,a,o,s,u){var c,l=XE(),d=-1,f=-1,h={kind:"text",charCount:u,fontTexture:tf.create(e),centerBuffer:tf.create(t),mappingBuffer:tf.create(r),depthBuffer:tf.create(i),indexBuffer:tf.create(a),groupBuffer:tf.create(o),tcoordBuffer:tf.create(s),get boundingSphere(){var e=n(h);if(e!==d){var t=jM(h.centerBuffer.ref.value,4*h.charCount,4);XE.copy(l,t),d=e}return l},get groupMapping(){return h.groupBuffer.ref.version!==f&&(c=yM(h.groupBuffer.ref.value,h.charCount,4),f=h.groupBuffer.ref.version),c},setBoundingSphere:function(e){XE.copy(l,e),d=n(h)}};return h}(e,t,r,i,a,o,s,u)}function r(e){return t(e?e.fontTexture.ref.value:NM(0,1,Uint8Array),e?e.centerBuffer.ref.value:new Float32Array,e?e.mappingBuffer.ref.value:new Float32Array,e?e.depthBuffer.ref.value:new Float32Array,e?e.indexBuffer.ref.value:new Uint32Array,e?e.groupBuffer.ref.value:new Float32Array,e?e.tcoordBuffer.ref.value:new Float32Array,0,e)}function n(e){return Iv([e.charCount,e.fontTexture.ref.version,e.centerBuffer.ref.version,e.mappingBuffer.ref.version,e.depthBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version,e.tcoordBuffer.ref.version]
139)}function i(e,t){var r=4*e.charCount,n=t.instanceCount.ref.value,i=KM(),a=i.position,o=e.centerBuffer.ref.value,s=t.aTransform.ref.value;return YM(r,n,4,function(e,t){return t<0?Cg.fromArray(a,o,3*e):Cg.transformMat4Offset(a,o,s,0,3*e,16*t),i})}function a(e,t,r,n,a){var o=r.instanceCount,s=r.groupCount,u=CI(r,i(e,t),n.color),c=DO(r,n.size),l=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),d=eD(),f=nD(),h=cD(),p=aD(),m={drawCount:2*e.charCount*3,vertexCount:4*e.charCount,groupCount:s,instanceCount:o},g=VO(e.mappingBuffer.ref.value,e.depthBuffer.ref.value,e.charCount,RO(c)),v=XE.expand(XE(),e.boundingSphere,g),y=GM(v,t.aTransform.ref.value,o,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("text"),aPosition:e.centerBuffer,aMapping:e.mappingBuffer,aDepth:e.depthBuffer,aGroup:e.groupBuffer,elements:e.indexBuffer,boundingSphere:tf.create(y),invariantBoundingSphere:tf.create(v),uInvariantBoundingSphere:tf.create(Ng.ofSphere(v))},u),c),l),d),f),h),p),t),{aTexCoord:e.tcoordBuffer,tFont:e.fontTexture,padding:tf.create(g)}),qI.createValues(a,m)),{uSizeFactor:tf.create(a.sizeFactor),uBorderWidth:tf.create(bg(a.borderWidth,0,.5)),uBorderColor:tf.create(tv.toArrayNormalized(a.borderColor,Cg.zero(),0)),uOffsetX:tf.create(a.offsetX),uOffsetY:tf.create(a.offsetY),uOffsetZ:tf.create(a.offsetZ),uBackgroun
139dColor:tf.create(tv.toArrayNormalized(a.backgroundColor,Cg.zero(),0)),uBackgroundOpacity:tf.create(a.backgroundOpacity)})}function o(e,t){qI.updateRenderableState(e,t),e.pickable=!1,e.opaque=!1,e.writeDepth=!0}e.create=t,e.createEmpty=r,e.Params=Ac(Ac(Ac({},qI.Params),zO),{sizeFactor:Ib.Numeric(1,{min:0,max:10,step:.1}),borderWidth:Ib.Numeric(0,{min:0,max:.5,step:.01}),borderColor:Ib.Color(MC.grey),offsetX:Ib.Numeric(0,{min:0,max:10,step:.1}),offsetY:Ib.Numeric(0,{min:0,max:10,step:.1}),offsetZ:Ib.Numeric(0,{min:0,max:10,step:.1}),background:Ib.Boolean(!1),backgroundMargin:Ib.Numeric(.2,{min:0,max:1,step:.01}),backgroundColor:Ib.Color(MC.grey),backgroundOpacity:Ib.Numeric(1,{min:0,max:1,step:.01}),tether:Ib.Boolean(!1),tetherLength:Ib.Numeric(1,{min:0,max:5,step:.1}),tetherBaseWidth:Ib.Numeric(.3,{min:0,max:1,step:.01}),attachment:Ib.Select("middle-center",[["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"]])}),e.Utils={Params:e.Params,createEmpty:r,createValues:a,createValuesSimple:function(t,r,n,i,o){var s=qI.createSimple(n,i,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return a(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uSizeFactor,t.sizeFactor),tf.updateIfChanged(e.uBorderWidth,t.borderWidth),tv.fromNormalizedArray(e.uBorderColor.ref.value,0)!==t.borderColor&&(tv.toArrayNormalized(t.borderColor,e.uBorderColor.ref.value,0),tf.update(e.uBorderColor,e.uBorderColor.ref.value)),tf.updateIfChanged(e.uOffsetX,t.offsetX),tf.updateIfChanged(e.uOffsetY,t.offsetY),tf.updateIfChanged(e.uOffsetZ,t.offsetZ),tv.fromNormalizedArray(e.uBackgroundColor.ref.value,0)!==t.backgroundColor&&(tv.toArrayNormalized(t.backgroundColor,e.uBackgroundColor.ref.value,0),tf.update(e.uBackgroundColor,e.uBackgroundColor.ref.value)),tf.updateIfChanged(e.uBackgroundOpacity,t.backgroundOpacity)},updateBoundingSphere:function(e,t){var r=VO(e.aMapping.ref.value,e.aDepth.ref.value,t.charCount,RO(e)),n=XE.expand(XE(),t.boundingSphere,r),i=GM(n,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(i,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,i),XE.equals(n,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,n),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,n))),tf.update(e.padding,r)},createRenderableState:function(e){var t=qI.createRenderableState(e);return o(t,e),t},updateRenderableState:o,createPositionIterator:i}}(UO||={});var HO,qO,WO=Cg(),XO=Cg(),YO=Cg(),KO=iv.add,ZO=iv.add3;(function(e){e.create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=iv.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e),i=iv.create(Float32Array,3,t,r?r.startBuffer.ref.value:e),a=iv.create(Float32Array,3,t,r?r.endBuffer.ref.value:e),o=function(e,t,r,o,s,u,c){for(var l=0;l<4;++l)ZO(i,e,t,r),ZO(a,o,s,u),KO(n,c)},s=function(e,t,r,n){var i=Cg.distance(e,t),a=r%2!=0,s=Math.floor((r+1)/2),u=i/(r+.5);Cg.setMagnitude(YO,Cg.sub(YO,t,e),u),Cg.copy(WO,e);for(var c=0;c<s;++c)Cg.add(WO,WO,YO),a&&c===s-1?Cg.copy(XO,t):Cg.add(XO,WO,YO),o(WO[0],WO[1],WO[2],XO[0],XO[1],XO[2],n),Cg.add(WO,WO,YO)};return{add:o,addVec:function(e,t,r){for(var o=0;o<4;++o)ZO(i,e[0],e[1],e[2]),ZO(a,t[0],t[1],t[2]),KO(n,r)},addFixedCountDashes:s,addFixedLengthDashes:function(e,t,r,n){s(e,t,Cg.distance(e,t)/r,n)},addCage:function(e,t,r){for(var n=t.vertices,i=t.edges,a=0,s=i.length;a<s;a+=2)Cg.fromArray(WO,n,3*i[a]),Cg.fromArray(XO,n,3*i[a+1]),Cg.transformMat4(WO,WO,e),Cg.transformMat4(XO,XO,e),o(WO[0],WO[1],WO[2],XO[0],XO[1],XO[2],r)},getLines:function(){var e=n.elementCount/4,t=iv.compact(n,!0),o=iv.compact(i,!0),s=iv.compact(a,!0),u=r&&e<=r.lineCount?r.mappingBuffer.ref.value:new Float32Array(8*e),c=r&&e<=r.lineCount?r.indexBuffer.ref.value:new Uint32Array(6*e);return(!r||e>r.lineCount)&&function(e,t,r){for(var n=0;n<e;++n){var i=8*n;t[i]=-1,t[i+1]=-1,t[i+2]=1,t[i+3]=-1,t[i+4]=-1,t[i+5]=1,t[i+6]=1,t[i+7]=1}for(n=0;n<e;++n){var a=4*n,o=6*n;r[o]=a,r[o+1]=a+1,r[o+2]=a+2,r[o+3]=a+1,r[o+4]=a+3,r[o+5]=a+2}}(e,u,c),qO.create(u,c,t,o,s,e,r)}}}})(HO||={}),function(e){function t(e,t,r,i,a,o,s){return s?function(e,t,r,n,i,a,o){return a>o.lineCount&&(tf.update(o.mappingBuffer,e),tf.update(o.indexBuffer,t)),o.lineCount=a,tf.update(o.groupBuffer,r),tf.update(o.startBuffer,n),tf.update(o.endBuffer,i),o}(e,t,r,i,a,o,s):function(e,t,r,i,a,o){var s,u=XE(),c=-1,l=-1,d={kind:"lines",lineCount:o,mappingBuffer:tf.create(e),indexBuffer:tf.create(t),groupBuffer:tf.create(r),startBuffer:tf.create(i),endBuffer:tf.create(a),get boundingSphere(){var e=n(d);if(e!==c){var t=jM(d.startBuffer.ref.value,4*d.lineCount,4),r=jM(d.endBuffer.ref.value,4*d.lineCount,4);
139XE.expandBySphere(u,t,r),c=e}return u},get groupMapping(){return d.groupBuffer.ref.version!==l&&(s=yM(d.groupBuffer.ref.value,d.lineCount,4),l=d.groupBuffer.ref.version),s},setBoundingSphere:function(e){XE.copy(u,e),c=n(d)}};return d}(e,t,r,i,a,o)}function r(e){return t(e?e.mappingBuffer.ref.value:new Float32Array,e?e.indexBuffer.ref.value:new Uint32Array,e?e.groupBuffer.ref.value:new Float32Array,e?e.startBuffer.ref.value:new Float32Array,e?e.endBuffer.ref.value:new Float32Array,0,e)}function n(e){return Iv([e.lineCount,e.mappingBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version,e.startBuffer.ref.version,e.endBuffer.ref.version])}function i(e,t){var r=4*e.lineCount,n=t.instanceCount.ref.value,i=KM(),a=i.position,o=e.startBuffer.ref.value,s=e.endBuffer.ref.value,u=t.aTransform.ref.value;return YM(r,n,2,function(e,t){var r=e%4==0?o:s;return t<0?Cg.fromArray(a,r,3*e):Cg.transformMat4Offset(a,r,u,0,3*e,16*t),i})}function a(e,t,r,n,a){var o=r.instanceCount,s=r.groupCount,u=CI(r,i(e,t),n.color),c=DO(r,n.size),l=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),d=eD(),f=nD(),h=cD(),p=aD(),m={drawCount:2*e.lineCount*3,vertexCount:4*e.lineCount,groupCount:s,instanceCount:o},g=XE.clone(e.boundingSphere),v=GM(g,t.aTransform.ref.value,o,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("lines"),aMapping:e.mappingBuffer,aGroup:e.groupBuffer,aStart:e.startBuffer,aEnd:e.endBuffer,elements:e.indexBuffer,boundingSphere:tf.create(v),invariantBoundingSphere:tf.create(g),uInvariantBoundingSphere:tf.create(Ng.ofSphere(g))},u),c),l),d),f),h),p),t),qI.createValues(a,m)),{uSizeFactor:tf.create(a.sizeFactor),dLineSizeAttenuation:tf.create(a.lineSizeAttenuation),uDoubleSided:tf.create(!0),dFlipSided:tf.create(!1)})}e.create=t,e.createEmpty=r,e.fromMesh=function(e,t){for(var r=e.vertexBuffer.ref.value,n=e.indexBuffer.ref.value,i=e.groupBuffer.ref.value,a=HO.create(3*e.triangleCount,e.triangleCount/10,t),o=0,s=3*e.triangleCount;o<s;o+=3){var u=n[o],c=n[o+1],l=n[o+2],d=r[3*u],f=r[3*u+1],h=r[3*u+2],p=r[3*c],m=r[3*c+1],g=r[3*c+2],v=r[3*l],y=r[3*l+1],b=r[3*l+2];a.add(d,f,h,p,m,g,i[u]),a.add(d,f,h,v,y,b,i[u]),a.add(p,m,g,v,y,b,i[c])}return a.getLines()},e.transform=function(e,t){var r=e.startBuffer.ref.value;dM(t,r,0,4*e.lineCount),tf.update(e.startBuffer,r);var n=e.endBuffer.ref.value;dM(t,n,0,4*e.lineCount),tf.update(e.endBuffer,n)},e.Params=Ac(Ac({},qI.Params),{sizeFactor:Ib.Numeric(2,{min:0,max:10,step:.1}),lineSizeAttenuation:Ib.Boolean(!1)}),e.Utils={Params:e.Params,createEmpty:r,createValues:a,createValuesSimple:function(t,r,n,i,o){var s=qI.createSimple(n,i,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return a(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uSizeFactor,t.sizeFactor),tf.updateIfChanged(e.dLineSizeAttenuation,t.lineSizeAttenuation)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:qI.createRenderableState,updateRenderableState:qI.updateRenderableState,createPositionIterator:i}}(qO||={});
139var QO,JO,eR,tR,rR=Cg(),nR=Cg(),iR=Cg(),aR=Cg(),oR=BD(4,!0);function sR(e){for(var t=gD(12,e?36:24),r=0;r<4;++r){var n=(r+1)%4;Cg.set(rR,oR[3*r],oR[3*r+1],-.5),Cg.set(nR,oR[3*n],oR[3*n+1],-.5),Cg.set(iR,oR[3*n],oR[3*n+1],.5),Cg.set(aR,oR[3*r],oR[3*r+1],.5),e?t.add(rR,nR,iR):t.addQuad(rR,nR,iR,aR)}return Cg.set(rR,oR[0],oR[1],-.5),Cg.set(nR,oR[3],oR[4],-.5),Cg.set(iR,oR[6],oR[7],-.5),Cg.set(aR,oR[9],oR[10],-.5),e?t.add(iR,nR,rR):t.addQuad(aR,iR,nR,rR),Cg.set(rR,oR[0],oR[1],.5),Cg.set(nR,oR[3],oR[4],.5),Cg.set(iR,oR[6],oR[7],.5),Cg.set(aR,oR[9],oR[10],.5),e?t.add(rR,nR,iR):t.addQuad(rR,nR,iR,aR),t.getPrimitive()}function uR(){return QO||=sR(!1),QO}function cR(){return eR||=_D([.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5],[0,4,1,5,2,6,3,7,0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4]),eR}function lR(e){return e.map(function(e){return{x:e[0],alpha:e[1]}})}function dR(e,t){for(var r,n,i,a,o,s,u=kc(kc([{x:0,alpha:0},{x:0,alpha:0}],e,!0),[{x:1,alpha:0},{x:1,alpha:0}],!1),c=t?t.ref.value.array:new Uint8Array(256),l=0,d=e.length+1,f=0;f<d;++f){r=u[f+1].x,n=u[f+2].x,i=u[f].alpha,a=u[f+1].alpha,o=u[f+2].alpha,s=u[f+3].alpha;for(var h=Math.round(256*(n-r)),p=0;p<h;++p){var m=p/h;c[l]=Math.max(0,255*xg(i,a,o,s,m,.5)),++l}}var g={array:c,width:256,height:1};return t?(tf.update(t,g),t):tf.create(g)}function fR(e,t,r,n){var i=(n-r)/t;0===i&&(i=1);for(var a=new Int32Array(t),o=0,s=e.length;o<s;o++){var u=Math.floor((e[o]-r)/i);u>=t?u=t-1:u<0&&(u=0),a[u]++}return{min:r,max:n,binWidth:i,counts:a}}function hR(e){return e}(function(e){e.One={transform:{kind:"matrix",matrix:Og.identity()},cells:Tg.create(Tg.Space([1,1,1],[0,1,2]),Tg.Data1([0])),stats:{min:0,max:0,mean:0,sigma:0}};var t=Og.zero(),r=Og.zero();e.getGridToCartesianTransform=function(e){if("matrix"===e.transform.kind)return Og.copy(Og(),e.transform.matrix);if("spacegroup"===e.transform.kind){var n=e.cells.space,i=Og.fromScaling(t,Cg.div(Cg.zero(),YE.size(Cg.zero(),e.transform.fractionalBox),Cg.ofArray(n.dimensions))),a=Og.fromTranslation(r,e.transform.fractionalBox.min);return Og.mul3(Og.zero(),e.transform.cell.fromFractional,a,i)}return Og.identity()},e.areEquivalent=function(e,t){return e===t},e.isEmpty=function(e){return 0===e.cells.data.length},e.getBoundingSphere=function(t,r){r||=XE();var n=t.cells.space.dimensions,i=e.getGridToCartesianTransform(t);return XE.fromDimensionsAndTransform(r,n,i)},e.getHistogram=function(e,t){var r=e._historams;return r||=e._historams={},r[t]||(r[t]=function(e,t,r){if(r)return fR(e,t,r.min,r.max);var n=Lb(e);return fR(e,t,n[0],n[1])}(e.cells.data,t,{min:e.stats.min,max:e.stats.max})),r[t]}})(tR||={}),function(e){e.getUUID=function(e){return e.__key||=Wd.create22(),e.__key}}(hR||={});var pR,mR,gR,vR=function(){function e(){this._list=[],this._set=new Set,this._refs=new Map,this._assets=new Map}return Object.defineProperty(e.prototype,"all",{get:function(){return this._list},enumerable:!1,configurable:!0}),e.prototype.add=function(e){this._set.has(e)||(this._list.push(e),this._set.add(e))},e.prototype.reference=function(e,t){var r=this._refs.get(e)||0;r+=t?1:-1,this._refs.set(e,Math.max(r,0))},e.prototype.hasReference=function(e){return(this._refs.get(e)||0)>0},e.prototype.has=function(e){return this._set.has(e)},e.prototype.assets=function(e,t){var r=this._assets.get(e);if(r)for(var n=0,i=r;n<i.length;n++)i[n].dispose();t?this._assets.set(e,t):this._assets.delete(e)},e.prototype.dispose=function(){this._assets.forEach(function(e){for(var t=0,r=e;t<r.length;t++)r[t].dispose()})},e}();function yR(e,t){var r=this;return vy.create("Create Volume",function(){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y;return Pc(this,function(b){if(r=e.header,n=e.values,i=Tg.Space(r.dim,[0,1,2],Float64Array),0===r.dataSetIds.length)a=n;else for(o=r.dim,s=o[0],u=o[1],c=o[2],l=(t?.dataIndex||0)+1,d=0,f=0,a=new Float64Array(s*u*c),h=0;h<s;h++)for(p=0;p<u;p++)for(m=0;m<c;m++)a[d++]=n[f],f+=l;return g=Tg.create(i,Tg.Data1(a)),v=Og.fromTranslation(Og(),r.origin),y=Og.fromBasis(Og(),r.basisX,r.basisY,r.basisZ),Og.mul(v,v,y),[2,{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"matrix",matrix:v},cells:g,stats:{min:Fb(a),max:Nb(a),mean:Ub(a),sigma:jb(a)}},sourceData:pR.create(e),customProperties:new vR,_propertyData:Object.create(null)}]})})})}function bR(e,t){var r=this;return vy.create("Create Volume",function(n){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d;return Pc(this,function(f){return r=e.volume_data_3d_info,n=e.volume_data_3d,i=LE.create(r.spacegroup_number.value(0),Cg.ofArray(r.spacegroup_cell_size.value(0)),Cg.scale(Cg.zero(),Cg.ofArray(r.spacegroup_cell_angles.value(0)),Math.PI/180)
139),a=r.axis_order.value(0),o=Tg.convertToCanonicalAxisIndicesFastToSlow(a),s=o(r.sample_count.value(0)),u=Tg.Space(s,Tg.invertAxisOrder(a),Float32Array),c=Tg.create(u,Tg.Data1(n.values.toArray({array:Float32Array}))),l=Cg.ofArray(o(r.origin.value(0))),d=Cg.ofArray(o(r.dimensions.value(0))),[2,{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:i,fractionalBox:YE.create(l,Cg.add(Cg.zero(),l,d))},cells:c,stats:{min:r.min_sampled.value(0),max:r.max_sampled.value(0),mean:r.mean_sampled.value(0),sigma:r.sigma_sampled.value(0)}},sourceData:mR.create(e),customProperties:new vR,_propertyData:Object.create(null)}]})})})}(function(e){e.is=function(e){return"cube"===e?.kind},e.create=function(e){return{kind:"cube",name:e.name,data:e}}})(pR||={}),function(e){e.is=function(e){return"dscif"===e?.kind},e.create=function(e){return{kind:"dscif",name:e._name,data:e}}}(mR||={}),function(e){var t;e.is=function(e){return e?.grid?.cells?.space?.dimensions?.length&&e?.sourceData&&e?.customProperties&&e?._propertyData},function(e){function t(t,r){return"absolute"===t.kind?t:{kind:"absolute",absoluteValue:e.calcAbsolute(r,t.relativeValue)}}e.areSame=function(e,r,n){return yg(t(e,n).absoluteValue,t(r,n).absoluteValue,n.sigma/100)},e.absolute=function(e){return{kind:"absolute",absoluteValue:e}},e.relative=function(e){return{kind:"relative",relativeValue:e}},e.calcAbsolute=function(e,t){return t*e.sigma+e.mean},e.calcRelative=function(e,t){return 0===e.sigma?0:(t-e.mean)/e.sigma},e.toAbsolute=t,e.toRelative=function(t,r){return"relative"===t.kind?t:{kind:"relative",relativeValue:e.calcRelative(r,t.absoluteValue)}},e.toString=function(e){return"relative"===e.kind?`${e.relativeValue.toFixed(2)} σ`:`${e.absoluteValue.toPrecision(4)}`}}(t=e.IsoValue||={}),e.adjustedIsoValue=function(r,n,i){if("relative"===i)return t.relative(n);var a=t.absolute(n);if(mR.is(r.sourceData)){var o={min:r.sourceData.data.volume_data_3d_info.min_source.value(0),max:r.sourceData.data.volume_data_3d_info.max_source.value(0),mean:r.sourceData.data.volume_data_3d_info.mean_source.value(0),sigma:r.sourceData.data.volume_data_3d_info.sigma_source.value(0)};return e.IsoValue.toRelative(a,o)}return a};var r={min:-1,max:1,mean:0,sigma:.1};function n(t,n){var i=n||r,a=i.min,o=i.max,s=i.mean,u=i.sigma,c=(a-s)/u,l=(o-s)/u,d=t;return"absolute"===t.kind?t.absoluteValue<a?d=e.IsoValue.absolute(a):t.absoluteValue>o&&(d=e.IsoValue.absolute(o)):t.relativeValue<c?d=e.IsoValue.relative(c):t.relativeValue>l&&(d=e.IsoValue.relative(l)),Ib.Conditioned(d,{absolute:Ib.Converted(function(t){return e.IsoValue.toAbsolute(t,tR.One.stats).absoluteValue},function(t){return e.IsoValue.absolute(t)},Ib.Numeric(s,{min:a,max:o,step:zw(u/100,2)},{immediateUpdate:!0})),relative:Ib.Converted(function(t){return e.IsoValue.toRelative(t,tR.One.stats).relativeValue},function(t){return e.IsoValue.relative(t)},Ib.Numeric(Math.min(1,l),{min:c,max:l,step:zw(Math.round((o-a)/u)/100,2)},{immediateUpdate:!0}))},function(e){return"absolute"===e.kind?"absolute":"relative"},function(t,r){return"absolute"===r?e.IsoValue.toAbsolute(t,i):e.IsoValue.toRelative(t,i)},{isEssential:!0})}e.createIsoValueParam=n,e.IsoValueParam=n(e.IsoValue.relative(2)),e.One={label:"",grid:tR.One,sourceData:{kind:"",name:"",data:{}},customProperties:new vR,_propertyData:Object.create(null)},e.areEquivalent=function(e,t){return tR.areEquivalent(e.grid,t.grid)},e.isEmpty=function(e){return tR.isEmpty(e.grid)},e.isOrbitals=function(e){return!!pR.is(e.sourceData)&&e.sourceData.data.header.orbitals},e.Loci=function(e){return{kind:"volume-loci",volume:e}},e.isLoci=function(e){return!!e&&"volume-loci"===e.kind},e.areLociEqual=function(e,t){return e.volume===t.volume},e.isLociEmpty=function(e){return tR.isEmpty(e.volume.grid)},e.getBoundingSphere=function(e,t){return tR.getBoundingSphere(e.grid,t)},function(t){t.Loci=function(e,t){return{kind:"isosurface-loci",volume:e,isoValue:t}},t.isLoci=function(e){return!!e&&"isosurface-loci"===e.kind},t.areLociEqual=function(t,r){return t.volume===r.volume&&e.IsoValue.areSame(t.isoValue,r.isoValue,t.volume.grid.stats)},t.isLociEmpty=function(e){return 0===e.volume.grid.cells.data.length};var r=YE();t.getBoundingSphere=function(t,n,i){for(var a=e.IsoValue.toAbsolute(n,t.grid.stats).absoluteValue,o=a<0,s=[0,0,0],u=t.grid.cells.space.getCoords,c=t.grid.cells.data,l=t.grid.cells.space.dimensions,d=l[0]-1,f=l[1]-1,h=l[2]-1,p=0,m=0,g=0,v=0,y=c.length;v<y;
139++v)(o&&c[v]<=a||!o&&c[v]>=a)&&(u(v,s),s[0]<d&&(d=s[0]),s[1]<f&&(f=s[1]),s[2]<h&&(h=s[2]),s[0]>p&&(p=s[0]),s[1]>m&&(m=s[1]),s[2]>g&&(g=s[2]));Cg.set(r.min,d-1,f-1,h-1),Cg.set(r.max,p+1,m+1,g+1);var b=tR.getGridToCartesianTransform(t.grid);return YE.transform(r,r,b),XE.fromBox3D(i||XE(),r)}}(e.Isosurface||={}),function(e){e.Loci=function(e,t){return{kind:"cell-loci",volume:e,indices:t}},e.isLoci=function(e){return!!e&&"cell-loci"===e.kind},e.areLociEqual=function(e,t){return e.volume===t.volume&&kP.areEqual(e.indices,t.indices)},e.isLociEmpty=function(e){return 0===kP.size(e.indices)};var t=new PM("98"),r=Cg();e.getBoundingSphere=function(e,n,i){t.reset();for(var a=tR.getGridToCartesianTransform(e.grid),o=e.grid.cells.space.getCoords,s=0,u=kP.size(n);s<u;s++)o(kP.getAt(n,s),r),Cg.transformMat4(r,r,a),t.includePosition(r);for(t.finishedIncludeStep(),s=0,u=kP.size(n);s<u;s++)o(kP.getAt(n,s),r),Cg.transformMat4(r,r,a),t.radiusPosition(r);var c=t.getSphere(i);return XE.expand(c,c,10*Og.getMaxScaleOnAxis(a))}}(e.Cell||={}),function(t){t.Loci=function(e,t){return{kind:"segment-loci",volume:e,segments:PP.ofUnsortedArray(t)}},t.isLoci=function(e){return!!e&&"segment-loci"===e.kind},t.areLociEqual=function(e,t){return e.volume===t.volume&&PP.areEqual(e.segments,t.segments)},t.isLociEmpty=function(e){return 0===e.volume.grid.cells.data.length||0===e.segments.length};var r=YE();t.getBoundingSphere=function(t,n,i){var a=e.Segmentation.get(t);if(a){YE.setEmpty(r);for(var o=0,s=n.length;o<s;++o){var u=a.bounds[n[o]];YE.add(r,u.min),YE.add(r,u.max)}var c=tR.getGridToCartesianTransform(t.grid);return YE.transform(r,r,c),XE.fromBox3D(i||XE(),r)}return e.getBoundingSphere(t,i)},t.Location=function(e,t){return{kind:"segment-location",volume:e,segment:t}},t.isLocation=function(e){return!!e&&"segment-location"===e.kind}}(e.Segment||={}),e.PickingGranularity={set:function(e,t){e._propertyData.__picking_granularity__=t},get:function(e){return e._propertyData.__picking_granularity__??"voxel"}},e.Segmentation={set:function(e,t){e._propertyData.__segmentation__=t},get:function(e){return e._propertyData.__segmentation__}}}(gR||={});var _R,xR,SR,wR=uR();function AR(e,t,r){return{type:"attribute",kind:e,itemSize:t,divisor:r}}function CR(e,t){return{type:"uniform",kind:e,variant:t}}function TR(e,t,r,n,i){return{type:"texture",kind:e,format:t,dataType:r,filter:n,variant:i}}function PR(e){return{type:"elements",kind:e}}function ER(e,t){return{type:"define",kind:e,options:t}}function MR(e){return{type:"value",kind:e}}(function(e){function t(e,t,n,i,a,o,s,u,c,l){return l?function(e,t,r,n,i,a,o,s,u,c){var l=a.getWidth(),d=a.getHeight(),f=a.getDepth();return tf.update(c.gridDimension,t),tf.update(c.gridTexture,a),tf.update(c.gridTextureDim,Cg.set(c.gridTextureDim.ref.value,l,d,f)),tf.update(c.gridStats,Ng.set(c.gridStats.ref.value,o.min,o.max,o.mean,o.sigma)),tf.update(c.bboxMin,e.min),tf.update(c.bboxMax,e.max),tf.update(c.bboxSize,Cg.sub(c.bboxSize.ref.value,e.max,e.min)),tf.update(c.transform,r),tf.update(c.cellDim,i),tf.update(c.unitToCartn,n),tf.update(c.cartnToUnit,Og.invert(Og(),n)),tf.updateIfChanged(c.packedGroup,s),tf.updateIfChanged(c.axisOrder,Cg.fromArray(c.axisOrder.ref.value,u,0)),c}(e,t,n,i,a,o,s,u,c,l):function(e,t,n,i,a,o,s,u,c){var l=XE(),d=-1,f=o.getWidth(),h=o.getHeight(),p=o.getDepth(),m={kind:"direct-volume",gridDimension:tf.create(t),gridTexture:tf.create(o),gridTextureDim:tf.create(Cg.create(f,h,p)),gridStats:tf.create(Ng.create(s.min,s.max,s.mean,s.sigma)),bboxMin:tf.create(e.min),bboxMax:tf.create(e.max),bboxSize:tf.create(Cg.sub(Cg(),e.max,e.min)),transform:tf.create(n),cellDim:tf.create(a),unitToCartn:tf.create(i),cartnToUnit:tf.create(Og.invert(Og(),i)),get boundingSphere(){var e=r(m);if(e!==d){var t=function(e,t){return XE.fromDimensionsAndTransform(XE(),e,t)}(m.gridDimension.ref.value,m.transform.ref.value);XE.copy(l,t),d=e}return l},packedGroup:tf.create(u),axisOrder:tf.create(c),setBoundingSphere:function(e){XE.copy(l,e),d=r(m)}};return m}(e,t,n,i,a,o,s,u,c)}function r(e){return Iv([e.bboxSize.ref.version,e.gridDimension.ref.version,e.gridTexture.ref.version,e.transform.ref.version,e.gridStats.ref.version]
139)}function n(e){return t(YE(),Cg(),Og.identity(),Og.identity(),Cg(),AI(),tR.One.stats,!1,Cg.create(0,1,2),e)}function i(e,t){return Math.ceil(Cg.magnitude(e)*t)}function a(e,t){return Math.min.apply(Math,e)*(1/t)}function o(e){return 1/e}function s(t,r,n,s,u){var c=t.gridTexture,l=t.gridTextureDim,d=t.gridStats,f=t.bboxSize,h=t.bboxMin,p=t.bboxMax,m=t.gridDimension,g=t.transform,v=n.instanceCount,y=n.groupCount,b=CI(n,e.Utils.createPositionIterator(t,r),s.color),_=u.instanceGranularity?qM(v,"instance"):qM(v*y,"groupInstance"),x=eD(),S=nD(),w=cD(),A=aD(),C=m.ref.value,T=C[0],P=C[1],E=C[2],M={drawCount:wR.indices.length,vertexCount:T*P*E,groupCount:y,instanceCount:v},k=XE.clone(t.boundingSphere),I=GM(k,r.aTransform.ref.value,v,0),D=dR(lR(u.controlPoints));return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("directVolume")},b),_),x),S),w),A),r),qI.createValues(u,M)),{aPosition:tf.create(wR.vertices),elements:tf.create(wR.indices),boundingSphere:tf.create(I),invariantBoundingSphere:tf.create(k),uInvariantBoundingSphere:tf.create(Ng.ofSphere(k)),uBboxMin:h,uBboxMax:p,uBboxSize:f,uMaxSteps:tf.create(i(m.ref.value,u.stepsPerCell)),uStepScale:tf.create(a(t.cellDim.ref.value,u.stepsPerCell)),uJumpLength:tf.create(u.jumpLength),uTransform:g,uGridDim:m,tTransferTex:D,uTransferScale:tf.create(o(u.stepsPerCell)),dGridTexType:tf.create(c.ref.value.getDepth()>0?"3d":"2d"),uGridTexDim:l,tGridTex:c,uGridStats:d,uCellDim:t.cellDim,uCartnToUnit:t.cartnToUnit,uUnitToCartn:t.unitToCartn,dPackedGroup:t.packedGroup,dAxisOrder:tf.create(t.axisOrder.ref.value.join("")),dIgnoreLight:tf.create(u.ignoreLight),dXrayShaded:tf.create("inverted"===u.xrayShaded?"inverted":!0===u.xrayShaded?"on":"off")})}e.create=t,e.createEmpty=n,e.Params=Ac(Ac({},qI.Params),{ignoreLight:Ib.Boolean(!1,qI.ShadingCategory),xrayShaded:Ib.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],qI.ShadingCategory),controlPoints:Ib.LineGraph([Bg.create(.19,0),Bg.create(.2,.05),Bg.create(.25,.05),Bg.create(.26,0),Bg.create(.79,0),Bg.create(.8,.05),Bg.create(.85,.05),Bg.create(.86,0)],{isEssential:!0}),stepsPerCell:Ib.Numeric(3,{min:1,max:10,step:1}),jumpLength:Ib.Numeric(0,{min:0,max:20,step:.1})}),e.Utils={Params:e.Params,createEmpty:n,createValues:s,createValuesSimple:function(t,r,n,i,a){var o=qI.createSimple(n,i,a),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return s(t,o.transform,o.locationIterator,o.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.dIgnoreLight,t.ignoreLight),tf.updateIfChanged(e.dXrayShaded,"inverted"===t.xrayShaded?"inverted":!0===t.xrayShaded?"on":"off"),dR(lR(t.controlPoints),e.tTransferTex),tf.updateIfChanged(e.uMaxSteps,i(e.uGridDim.ref.value,t.stepsPerCell)),tf.updateIfChanged(e.uStepScale,a(e.uCellDim.ref.value,t.stepsPerCell)),tf.updateIfChanged(e.uTransferScale,o(t.stepsPerCell)),tf.updateIfChanged(e.uJumpLength,t.jumpLength)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=qI.createRenderableState(e);return t.opaque=!1,t.writeDepth=!1,t},updateRenderableState:function(e,t){qI.updateRenderableState(e,t),e.opaque=!1,e.writeDepth=!1},createPositionIterator:function(e,t){var r=e.transform.ref.value,n=e.gridDimension.ref.value,i=n[0],a=n[1],o=n[2],s=i*a*o,u=t.instanceCount.ref.value,c=KM(),l=c.position,d=t.aTransform.ref.value;return YM(s,u,1,function(e,t){var n=Math.floor(e/o);return l[0]=Math.floor(n/a),l[1]=n%a,l[2]=e%o,Cg.transformMat4(l,l,r),t>=0&&Cg.transformMat4Offset(l,l,d,0,0,16*t),c})}}})(_R||={}),function(e){function t(e,t,r,i){return i?function(e,t,r,n){return n.sphereCount=r,tf.update(n.centerBuffer,e),tf.update(n.groupBuffer,t),n.shaderData.update(),n}(e,t,r,i):function(e,t,r){var i,a=XE(),o=-1,s=-1,u=tf.create(NM(1,4,Float32Array)),c=tf.create(Bg.create(0,0)),l={kind:"spheres",sphereCount:r,centerBuffer:tf.create(e),groupBuffer:tf.create(t),get boundingSphere(){var e=n(l);if(e!==o){var t=jM(l.centerBuffer.ref.value,4*l.sphereCount,4);XE.copy(a,t),o=e}return a},get groupMapping(){return l.groupBuffer.ref.version!==s&&(i=yM(l.groupBuffer.ref.value,l.sphereCount,4),s=l.groupBuffer.ref.version),i},setBoundingSphere:function(e){XE.copy(a,e),o=n(l)},shaderData:{positionGroup:u,texDim:c,update:function(){var e=NM(l.sphereCount,4,Float32Array,u.ref.value.array);(function(e,t,r,n){for(var i=e.array,a=0;a<n;++a)i[4*a+0]=t[3*a+0],i[4*a+1]=t[3*a+1],i[4*a+2]=t[3*a+2],i[4*a+3]=r[a]})(e,l.centerBuffer.ref.value,l.groupBuffer.ref.value,l.sphereCount),tf.update(u,e),tf.update(c,Bg.set(c.ref.value,e.width,e.height))}}};return l}(e,t,r)}function r(e){return t(e?e.centerBuffer.ref.value:new Float32Array,e?e.groupBuffer.ref.value:new Float32Array,0,e)}function n(e){return Iv([e.sphereCount,e.centerBuffer.ref.version,e.groupBuffer.ref.version]
139)}function i(e,t){var r=e.sphereCount,n=t.instanceCount.ref.value,i=KM(),a=i.position,o=e.centerBuffer.ref.value,s=t.aTransform.ref.value;return YM(r,n,1,function(e,t){return t<0?Cg.fromArray(a,o,3*e):Cg.transformMat4Offset(a,o,s,0,3*e,16*t),i})}function a(e,t,r,n,a){var o=r.instanceCount,s=r.groupCount,u=CI(r,i(e,t),n.color),c=DO(r,n.size),l=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),d=eD(),f=nD(),h=cD(),p=aD(),m={drawCount:2*e.sphereCount*3,vertexCount:6*e.sphereCount,groupCount:s,instanceCount:o},g=e.boundingSphere.radius?RO(c)*a.sizeFactor:0,v=XE.expand(XE(),e.boundingSphere,g),y=GM(v,t.aTransform.ref.value,o,0);return e.shaderData.update(),Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("spheres"),uTexDim:e.shaderData.texDim,tPositionGroup:e.shaderData.positionGroup,boundingSphere:tf.create(y),invariantBoundingSphere:tf.create(v),uInvariantBoundingSphere:tf.create(Ng.ofSphere(v))},u),c),l),d),f),h),p),t),{padding:tf.create(g)}),qI.createValues(a,m)),{uSizeFactor:tf.create(a.sizeFactor),uDoubleSided:tf.create(a.doubleSided),dIgnoreLight:tf.create(a.ignoreLight),dXrayShaded:tf.create("inverted"===a.xrayShaded?"inverted":!0===a.xrayShaded?"on":"off"),dTransparentBackfaces:tf.create(a.transparentBackfaces),dSolidInterior:tf.create(a.solidInterior),dClipPrimitive:tf.create(a.clipPrimitive),dApproximate:tf.create(a.approximate),uAlphaThickness:tf.create(a.alphaThickness),uBumpFrequency:tf.create(a.bumpFrequency),uBumpAmplitude:tf.create(a.bumpAmplitude),centerBuffer:e.centerBuffer,groupBuffer:e.groupBuffer})}function o(e,t){qI.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xrayShaded,e.writeDepth=e.opaque}e.create=t,e.createEmpty=r,e.Params=Ac(Ac({},qI.Params),{sizeFactor:Ib.Numeric(1,{min:0,max:10,step:.1}),doubleSided:Ib.Boolean(!1,qI.CustomQualityParamInfo),ignoreLight:Ib.Boolean(!1,qI.ShadingCategory),xrayShaded:Ib.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],qI.ShadingCategory),transparentBackfaces:Ib.Select("off",Ib.arrayToOptions(["off","on","opaque"]),qI.ShadingCategory),solidInterior:Ib.Boolean(!0,qI.ShadingCategory),clipPrimitive:Ib.Boolean(!1,Ac(Ac({},qI.ShadingCategory),{description:"Clip whole sphere instead of cutting it."})),approximate:Ib.Boolean(!1,Ac(Ac({},qI.ShadingCategory),{description:"Faster rendering, but has artifacts."})),alphaThickness:Ib.Numeric(0,{min:0,max:20,step:1},Ac(Ac({}
139,qI.ShadingCategory),{description:"If not zero, adjusts alpha for radius."})),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory),bumpAmplitude:Ib.Numeric(1,{min:0,max:5,step:.1},qI.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:r,createValues:a,createValuesSimple:function(t,r,n,i,o){var s=qI.createSimple(n,i,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return a(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uSizeFactor,t.sizeFactor),tf.updateIfChanged(e.uDoubleSided,t.doubleSided),tf.updateIfChanged(e.dIgnoreLight,t.ignoreLight),tf.updateIfChanged(e.dXrayShaded,"inverted"===t.xrayShaded?"inverted":!0===t.xrayShaded?"on":"off"),tf.updateIfChanged(e.dTransparentBackfaces,t.transparentBackfaces),tf.updateIfChanged(e.dSolidInterior,t.solidInterior),tf.updateIfChanged(e.dClipPrimitive,t.clipPrimitive),tf.updateIfChanged(e.dApproximate,t.approximate),tf.updateIfChanged(e.uAlphaThickness,t.alphaThickness),tf.updateIfChanged(e.uBumpFrequency,t.bumpFrequency),tf.updateIfChanged(e.uBumpAmplitude,t.bumpAmplitude)},updateBoundingSphere:function(e,t){var r=t.boundingSphere.radius?RO(e)*e.uSizeFactor.ref.value:0,n=XE.expand(XE(),t.boundingSphere,r),i=GM(n,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(i,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,i),XE.equals(n,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,n),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,n))),tf.update(e.padding,r)},createRenderableState:function(e){var t=qI.createRenderableState(e);return o(t,e),t},updateRenderableState:o,createPositionIterator:i}}(xR||={}),function(e){var t=function(){function e(){this.index=0,this.textures=[]}return e.prototype.get=function(){return this.textures[this.index]},e.prototype.set=function(e,t,r){this.textures[this.index]=Object.assign(this.textures[this.index]||{},{vertex:e,group:t,normal:r}),this.index=(this.index+1)%2},e.prototype.destroy=function(){for(var e=0,t=this.textures;e<t.length;e++){var r=t[e];r.vertex.destroy(),r.group.destroy(),r.normal.destroy()}},e}();function r(e,r,n,i,a,o,s){var u=n.getWidth(),c=n.getHeight();return s?(s.vertexCount=e,s.groupCount=r,tf.update(s.geoTextureDim,Bg.set(s.geoTextureDim.ref.value,u,c)),tf.update(s.vertexTexture,n),tf.update(s.groupTexture,i),tf.update(s.normalTexture,a),s.doubleBuffer.set(n,i,a),XE.copy(s.boundingSphere,o),s):{kind:"texture-mesh",vertexCount:e,groupCount:r,geoTextureDim:tf.create(Bg.create(u,c)),vertexTexture:tf.create(n),groupTexture:tf.create(i),normalTexture:tf.create(a),varyingGroup:tf.create(!1),doubleBuffer:new t,boundingSphere:XE.clone(o),meta:{}}}function n(e){return r(0,0,e?e.vertexTexture.ref.value:AI(),e?e.groupTexture.ref.value:AI(),e?e.normalTexture.ref.value:AI(),e?e.boundingSphere:XE(),e)}e.DoubleBuffer=t,e.create=r,e.createEmpty=n,e.Params=Ac(Ac({},qI.Params),{doubleSided:Ib.Boolean(!1,qI.CustomQualityParamInfo),flipSided:Ib.Boolean(!1,qI.ShadingCategory),flatShaded:Ib.Boolean(!1,qI.ShadingCategory),ignoreLight:Ib.Boolean(!1,qI.ShadingCategory),xrayShaded:Ib.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],qI.ShadingCategory),transparentBackfaces:Ib.Select("off",Ib.arrayToOptions(["off","on","opaque"]),qI.ShadingCategory),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory),bumpAmplitude:Ib.Numeric(1,{min:0,max:5,step:.1},qI.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:n,createValues:a,createValuesSimple:function(t,r,n,i,o){var s=qI.createSimple(n,i,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return a(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uDoubleSided,t.doubleSided),tf.updateIfChanged(e.dFlatShaded,t.flatShaded),tf.updateIfChanged(e.dFlipSided,t.flipSided),tf.updateIfChanged(e.dIgnoreLight,t.ignoreLight),tf.updateIfChanged(e.dXrayShaded,"inverted"===t.xrayShaded?"inverted":!0===t.xrayShaded?"on":"off"),tf.updateIfChanged(e.dTransparentBackfaces,t.transparentBackfaces),tf.updateIfChanged(e.uBumpFrequency,t.bumpFrequency),tf.updateIfChanged(e.uBumpAmplitude,t.bumpAmplitude)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=qI.createRenderableState(e);return o(t,e),t},updateRenderableState:o,createPositionIterator:function(e,t){var r=e.meta.webgl;if(!r)return YM(1,1,1,function(){return WM});r.namedFramebuffers[i]||(r.namedFramebuffers[i]=r.resources.framebuffer());var n=r.namedFramebuffers[i],a=e.geoTextureDim.ref.value,o=a[0],s=a[1],u=new Float32Array(o*s*4);n.bind(),e.vertexTexture.ref.value.attachFramebuffer(n,0),r.readPixels(0,0,o,s,u);var c=e.vertexCount,l=t.instanceCount.ref.value,d=KM(),f=d.position,h=u,p=t.aTransform.ref.value;return YM(c,l,1,function(e,t){return t<0?Cg.fromArray(f,h,4*e):Cg.transformMat4Offset(f,h,p,0,4*e,16*t),d})}};var i="texture-mesh";function a(t,r,n,i,a){var o=n.instanceCount,s=n.groupCount,u=CI(n,e.Utils.createPositionIterator(t,r),i.c
139olor),c=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),l=eD(),d=nD(),f=cD(),h=aD(),p={drawCount:t.vertexCount,vertexCount:t.vertexCount,groupCount:s,instanceCount:o},m=XE.clone(t.boundingSphere),g=GM(m,r.aTransform.ref.value,o,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("textureMesh"),uGeoTexDim:t.geoTextureDim,tPosition:t.vertexTexture,tGroup:t.groupTexture,tNormal:t.normalTexture,dVaryingGroup:t.varyingGroup,boundingSphere:tf.create(g),invariantBoundingSphere:tf.create(m),uInvariantBoundingSphere:tf.create(Ng.ofSphere(m))},u),c),l),d),f),h),r),qI.createValues(a,p)),{uDoubleSided:tf.create(a.doubleSided),dFlatShaded:tf.create(a.flatShaded),dFlipSided:tf.create(a.flipSided),dIgnoreLight:tf.create(a.ignoreLight),dXrayShaded:tf.create("inverted"===a.xrayShaded?"inverted":!0===a.xrayShaded?"on":"off"),dTransparentBackfaces:tf.create(a.transparentBackfaces),uBumpFrequency:tf.create(a.bumpFrequency),uBumpAmplitude:tf.create(a.bumpAmplitude),meta:tf.create(t.meta)})}function o(e,t){qI.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xrayShaded,e.writeDepth=e.opaque}}(SR||={});var kR={uModel:CR("m4"),uView:CR("m4"),uInvView:CR("m4"),uModelView:CR("m4"),uInvModelView:CR("m4"),uProjection:CR("m4"),uInvProjection:CR("m4"),uModelViewProjection:CR("m4"),uInvModelViewProjection:CR("m4"),uIsOrtho:CR("f"),uPixelRatio:CR("f"),uViewport:CR("v4"),uViewOffset:CR("v2"),uDrawingBufferSize:CR("v2"),uCameraPosition:CR("v3"),uCameraDir:CR("v3"),uNear:CR("f"),uFar:CR("f"),uFog:CR("b"),uFogNear:CR("f"),uFogFar:CR("f"),uFogColor:CR("v3"),uTransparentBackground:CR("b"),uLightDirection:CR("v3[]"),uLightColor:CR("v3[]"),uAmbientColor:CR("v3"),uPickingAlphaThreshold:CR("f"),uInteriorDarkening:CR("f"),uInteriorColorFlag:CR("b"),uInteriorColor:CR("v3"),uHighlightColor:CR("v3"),uSelectColor:CR("v3"),uDimColor:CR("v3"),uHighlightStrength:CR("f"),uSelectStrength:CR("f"),uDimStrength:CR("f"),uMarkerPriority:CR("i"),uMarkerAverage:CR("f"),uXrayEdgeFalloff:CR("f"),uExposure:CR("f"),uRenderMask:CR("i"),uMarkingDepthTest:CR("b"),uMarkingType:CR("i"),uPickType:CR("i")},IR={tDepth:TR("texture","depth","ushort","nearest"),tDpoitDepth:TR("texture","rg","float","nearest"),tDpoitFrontColor:TR("texture","rgba","float","nearest"),tDpoitBackColor:TR("texture","rgba","float","nearest")},DR={uObjectId:CR("i")},OR={uColor:CR("v3","material"),uColorTexDim:CR("v2"),uColorGridDim:CR("v3"),uColorGridTransform:CR("v4"),tColor:TR("image-uint8","rgb","ubyte","nearest"),tPalette:TR("image-uint8","rgb","ubyte","nearest"),tColorGrid:TR("texture","rgb","ubyte","linear"),dColorType:ER("string",["uniform","attribute","instance","group","groupInstance","vertex","vertexInstance","volume","volumeInstance","direct"]),dUsePalette:ER("boolean")},RR={uSize:CR("f","material"),uSizeTexDim:CR("v2"),tSize:TR("image-uint8","rgb","ubyte","nearest"),dSizeType:ER("string",["uniform","attribute","instance","group","groupInstance"]),uSizeFactor:CR("f","material")},BR={uMarker:CR("f"),uMarkerTexDim:CR("v2"),tMarker:TR("image-uint8","alpha","ubyte","nearest"),markerAverage:MR("number"),markerStatus:MR("number"),dMarkerType:ER("string",["instance","groupInstance"])},NR={uOverpaintTexDim:CR("v2"),tOverpaint:TR("image-uint8","rgba","ubyte","nearest"),dOverpaint:ER("boolean"),uOverpaintGridDim:CR("v3"),uOverpaintGridTransform:CR("v4"),tOverpaintGrid:TR("texture","rgba","ubyte","linear"),dOverpaintType:ER("string",["instance","groupInstance","volumeInstance"]),uOverpaintStrength:CR("f","material")},FR={uTransparencyTexDim:CR("v2"),tTransparency:TR("image-uint8","alpha","ubyte","nearest"),dTransparency:ER("boolean"),transparencyAverage:MR("number"),uTransparencyGridDim:CR("v3"),uTransparencyGridTransform:CR("v4"),tTransparencyGrid:TR("texture","alpha","ubyte","linear"),dTransparencyType:ER("string",["instance","groupInstance","volumeInstance"]),uTransparencyStrength:CR("f","material")},LR={uSubstanceTexDim:CR("v2"),tSubstance:TR("image-uint8","rgba","ubyte","nearest"),dSubstance:ER("boolean"),uSubstanceGridDim:CR("v3"),uSubstanceGridTransform:CR("v4"),tSubstanceGrid:TR("texture","rgba","ubyte","linear"),dSubstanceType:ER("string",["instance","groupInstance","volumeInstance"]),uSubstanceStrength:CR("f","material")},$R={uClippingTexDim:CR("v2"),tClipping:TR("image-uint8","alpha","ubyte","nearest"),dClipping:ER("boolean"),dClippingType:ER("string",["instance","groupInstance"])},UR=Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:ER("string",["cylinders","directVolume","image","lines","mesh","points","spheres","text","textureMesh"])},OR),BR),NR),FR),LR),$R),{dLightCount:ER("number"),dColorMarker:ER("boolean"),dClipObjectC
139ount:ER("number"),dClipVariant:ER("string",["instance","pixel"]),uClipObjectType:CR("i[]","material"),uClipObjectInvert:CR("b[]","material"),uClipObjectPosition:CR("v3[]","material"),uClipObjectRotation:CR("v4[]","material"),uClipObjectScale:CR("v3[]","material"),aInstance:AR("float32",1,1),aTransform:AR("float32",16,1),uAlpha:CR("f","material"),uMetalness:CR("f","material"),uRoughness:CR("f","material"),uBumpiness:CR("f","material"),uVertexCount:CR("i"),uInstanceCount:CR("i"),uGroupCount:CR("i"),uInvariantBoundingSphere:CR("v4"),drawCount:MR("number"),instanceCount:MR("number"),alpha:MR("number"),matrix:MR("m4"),transform:MR("float32"),extraTransform:MR("float32"),hasReflection:MR("boolean"),instanceGranularity:MR("boolean"),boundingSphere:MR("sphere"),invariantBoundingSphere:MR("sphere")}),jR="\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nvoid main(void) {\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n",zR=Jd(),GR=Object.keys({colorBlended:"",colorWboit:"",colorDpoit:"",pick:"",depth:"",marking:""}),VR=GR.filter(function(e){return!["colorWboit","colorDpoit"].includes(e)}),HR=GR.filter(function(e){return!["colorBlended","colorDpoit"].includes(e)}),qR=GR.filter(function(e){return!["colorWboit","colorBlended"].includes(e)}),WR=Object.keys({compute:""});function XR(e,t,r,n,i){return r=Ac(Ac({},r),{dRenderVariant:tf.create(t)}),void 0===i.dRenderVariant&&Object.defineProperty(i,"dRenderVariant",{value:ER("string")}),e.resources.program(r,n,i)}function YR(e,t,r,n,i,a,o){return ZR(e,t,r,n,i,a,o)}function KR(e,t,r,n,i,a){return void 0===a&&(a=-1),ZR(e,t,r,n,i,a,WR)}function ZR(e,t,r,n,i,a,o){var s=zR(),u=e.stats,c=e.state,l=e.resources,d=e.extensions,f=d.instancedArrays,h=d.vertexArrayObject;if(i.uVertexCount&&!e.extensions.noNonInstancedActiveAttribs){var p=i.uVertexCount.ref.value;i.aVertex=tf.create(zb(new Float32Array(p))),n.aVertex=AR("float32",1,0)}for(var m=function(e,t){var r={},n={},i={},a={},o={},s={},u={};return Object.keys(e).forEach(function(c){var l=e[c];"attribute"===l.type&&(r[c]=t[c]),"define"===l.type&&(n[c]=t[c]),"texture"===l.type&&void 0!==t[c]&&("material"===l.variant?a[c]=t[c]:i[c]=t[c]),"uniform"===l.type&&void 0!==t[c]&&("material"===l.variant?s[c]=t[c]:"buffered"===l.variant?u[c]=t[c]:o[c]=t[c])}),{attributeValues:r,defineValues:n,textureValues:i,materialTextureValues:a,uniformValues:o,materialUniformValues:s,bufferedUniformValues:u}}(n,i),g=m.attributeValues,v=m.defineValues,y=m.textureValues,b=m.materialTextureValues,_=m.uniformValues,x=m.materialUniformValues,S=m.bufferedUniformValues,w=Object.entries(_),A=Object.entries(x),C=Object.entries(S),T=Object.entries(function(e){var t={};return Object.keys(e).forEach(function(r){t[r]=tf.create(Vg(e[r].ref.value))}),t}(S)),P=Object.entries(v),E=function(e){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r].ref.version}),t}(i),M=function(e,t){var r=e.gl;switch(t){case"points":return r.POINTS;case"lines":return r.LINES;case"line-strip":return r.LINE_STRIP;case"line-loop":return r.LINE_LOOP;case"triangles":return r.TRIANGLES;case"triangle-strip":return r.TRIANGLE_STRIP;case"triangle-fan":return r.TRIANGLE_FAN}}(e,t),k={},I=0,D=o;I<D.length;I++){var O=D[I];k[O]=XR(e,O,v,r,n)}var R,B=SI(e,n,y),N=SI(e,n,b),F=function(e,t,r){var n=[];return Object.keys(t).forEach(function(i){var a=t[i];"attribute"===a.type&&(n[n.length]=[i,e.resources.attribute(r[i].ref.value,a.itemSize,a.divisor)])}),n}(e,n,g),L=i.elements;L&&L.ref.value&&(R=l.elements(L.ref.value));for(var $={},U=0,j=o;U<j.length;U++)O=j[U],$[O]=h?l.vertexArray(k[O],F,R):null;var z=i.drawCount.ref.value,G=i.instanceCount.ref.value;u.drawCount+=z,u.instanceCount+=G,u.instancedDrawCount+=G*z;var V={attributes:!1,defines:!1,elements:!1,textures:!1},H=!1,q=-1;return{id:s,materialId:a,getProgram:function(e){return k[e]},render:function(t,r){if(0!==z&&0!==G){var n=k[t];if(n.id===q&&c.currentRenderItemId===s)n.setUniforms(w),n.bindTextures(B,r);else{var i=$[t];n.id===c.currentProgramId&&n.id===q&&-1!==a&&a===c.currentMaterialId||(n.id!==c.currentProgramId&&n.use(),n.setUniforms(A),n.bindTextures(N,r+B.length),c.currentMaterialId=a,q=n.id),n.setUniforms(w),n.setUniforms(T),n.bindTextures(B,r),i?(i.bind(),R&&R.bind()):(R&&R.bind(),n.bindAttributes(F)),c.currentRenderItemId=s}if(ay)try{JM(e.gl)}catch(e){throw Error(`Framebuffer error rendering item id ${s}: '${e}'`)}if(R?f.drawElementsInstanced(M,z,R._dataType,0,G):f.drawArraysInstanced(M,0,z,G),ay)try{nI(e.gl)}catch(e){throw Error(`Draw error rendering item id ${s}: '${e}'`)}}},update:function(){if(function(e){e.attributes=!1,e.defines=!1,e.elements=!1,e.textures=!1}(V),i.aVertex){var t=i.uVertexCount.ref.value;i.aVertex.ref.value.length<t&&tf.update(i.aVertex,zb(new Float32Array(t)))}for(var a=0,s=P.length;a<s;++a){var c=P[a],d=c[0];(L=c[1]).ref.version!==E[d]&&(V.defines=!0,E[d]=L.ref.version)}if(V.defines)for(var f=0,p=o;f<p.length;f++)d=p[f],k[d].destroy(),k[d]=XR(e,d,v,r,n);for(i.drawCount.ref.version!==E.drawCount&&(u.drawCount+=i.drawCount.ref.value-z,u.instancedDrawCount+=G*i.drawCount.ref.value-G*z,z=i.drawCount.ref.value,E.drawCount=i.drawCount.ref.version),i.instanceCount.ref.version!==E.instanceCount&&(u.instanceCount+=i.instanceCount.ref.value-G,u.instancedDrawCount+=i.instanceCount.ref.value*z-G*z,G=i.instanceCount.ref.value,E.instanceCount=i.instanceCount.ref.version),a=0,s=F.length;a<s;++a){var m=F[a],_=(d=m[0],m[1]);if((L=g[d]).ref.version!==E[d]){if(_.length>=L.ref.value.length)_.updateSubData(L.ref.value,0,_.length);else{_.destroy();var x=n[d],S=x.itemSize,w=x.divisor;F[a][1]=l.attribute(L.ref.value,S,w),V.attributes=!0}E[d]=L.ref.version}}if(R&&i.elements.ref.version!==E.elements&&(R.length>=i.elements.ref.value.length?R.updateSubData(i.elements.ref.value,0,R.length):(R.destroy(),R=l.elements(i.elements.ref.value),V.elements=!0),E.elements=i.elements.ref.version),V.attributes||V.defines||V.elements)for(var A=0,M=o;A<M.length;A++){d=M[A];var I=$[d];I&&I.destroy(),$[d]=h?l.vertexArray(k[d],F,R):null}for(a=0,s=B.length;a<s;++a){var D=B[a],O=(d=D[0],D[1]);
139(L=y[d]).ref.version!==E[d]&&("texture"===n[d].kind?B[a][1]=L.ref.value:(O.load(L.ref.value),V.textures=!0),E[d]=L.ref.version)}for(a=0,s=N.length;a<s;++a){var L,U=N[a];d=U[0],O=U[1],(L=b[d]).ref.version!==E[d]&&("texture"===n[d].kind?N[a][1]=L.ref.value:(O.load(L.ref.value),V.textures=!0),E[d]=L.ref.version)}for(a=0,s=C.length;a<s;++a){var j=C[a],H=(d=j[0],j[1]);H.ref.version!==E[d]&&(tf.update(T[a][1],Vg(H.ref.value)),E[d]=H.ref.version)}},destroy:function(){if(!H){for(var e=0,t=o;e<t.length;e++){var r=t[e];k[r].destroy();var i=$[r];i&&i.destroy()}B.forEach(function(e){var t=e[0],r=e[1];"texture"!==n[t].kind&&r.destroy()}),N.forEach(function(e){var t=e[0],r=e[1];"texture"!==n[t].kind&&r.destroy()}),F.forEach(function(e){return e[0],e[1].destroy()}),R&&R.destroy(),u.drawCount-=z,u.instanceCount-=G,u.instancedDrawCount-=G*z,H=!0}}}}var QR=Jd();function JR(e,t,r){return{id:QR(),materialId:e.materialId,values:t,state:r,render:function(n,i){t.uAlpha&&t.alpha&&tf.updateIfChanged(t.uAlpha,bg(t.alpha.ref.value*r.alphaFactor,0,1)),e.render(n,i)},getProgram:function(t){return e.getProgram(t)},update:function(){return e.update()},dispose:function(){return e.destroy()}}}function eB(e,t){return{id:QR(),values:t,render:function(){return e.render("compute",0)},update:function(){return e.update()},dispose:function(){return e.destroy()}}}var tB=new Float32Array([1,1,-1,1,-1,-1,-1,-1,1,-1,1,1]),rB={drawCount:MR("number"),instanceCount:MR("number"),aPosition:AR("float32",2,0),uQuadScale:CR("v2")},nB={drawCount:tf.create(6),instanceCount:tf.create(1),aPosition:tf.create(tB),uQuadScale:tf.create(Bg.create(1,1))},iB=Ac(Ac({},rB),{tColor:TR("texture","rgba","ubyte","nearest"),uTexSize:CR("v2")}),aB=fk("copy",jR,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    gl_FragColor = texture2D(tColor, coords);\n}\n");function oB(e,t){var r=Ac(Ac({},nB),{tColor:tf.create(t),uTexSize:tf.create(Bg.create(t.getWidth(),t.getHeight()))});return eB(KR(e,"triangles",aB,Ac({},iB),r),r)}var sB,uB,cB,lB=new Uint32Array([0,1,2,1,3,2]),dB=new Float32Array([0,1,0,0,1,1,1,0]),fB={nearest:"Nearest",catmulrom:"Catmulrom (Cubic)",mitchell:"Mitchell (Cubic)",bspline:"B-Spline (Cubic)"},hB=Object.keys(fB);(function(e){function t(e,t,r,n){return n?function(e,t,r,n){var i=e.width,a=e.height;return tf.update(n.imageTexture,e),tf.update(n.imageTextureDim,Bg.set(n.imageTextureDim.ref.value,i,a)),tf.update(n.cornerBuffer,t),tf.update(n.groupTexture,r),n}(e,t,r,n):function(e,t,r){var n=XE(),i=-1,a=e.width,o=e.height,s={kind:"image",imageTexture:tf.create(e),imageTextureDim:tf.create(Bg.create(a,o)),cornerBuffer:tf.create(t),groupTexture:tf.create(r),get boundingSphere(){var e=function(e){return Iv([e.cornerBuffer.ref.version])}(s);if(e!==i){var t=function(e){for(var t=Cg(),r=[],n=0,i=e.length;n<i;n+=3){var a=Cg.fromArray(Cg(),e,n);r.push(a),Cg.add(t,t,a)}Cg.scale(t,t,1/(e.length/3));for(var o=0,s=0,u=r;s<u.length;s++){a=u[s];var c=Cg.distance(t,a);c>o&&(o=c)}var l=XE.create(t,o);return XE.setExtrema(l,r),l}(s.cornerBuffer.ref.value);XE.copy(n,t),i=e}return n}};return s}(e,t,r)}function r(e){return t(NM(0,4,Uint8Array),e?e.cornerBuffer.ref.value:new Float32Array(24),NM(0,4,Uint8Array),e)}function n(t,r,n,i,a){var o=n.instanceCount,s=n.groupCount,u=CI(n,e.Utils.createPositionIterator(t,r),i.color),c=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),l=eD(),d=nD(),f=cD(),h=aD(),p={drawCount:lB.length,vertexCount:tB.length/3,groupCount:s,instanceCount:o},m=XE.clone(t.boundingSphere),g=GM(m,r.aTransform.ref.value,o,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("image")},u),c),l),d),f),h),r),qI.createValues(a,p)),{aPosition:t.cornerBuffer,aUv:tf.create(dB),elements:tf.create(lB),aGroup:tf.create(zb(new Float32Array(4))),boundingSphere:tf.create(g),invariantBoundingSphere:tf.create(m),uInvariantBoundingSphere:tf.create(Ng.ofSphere(m)),dInterpolation:tf.create(a.interpolation),uImageTexDim:t.imageTextureDim,tImageTex:t.imageTexture,tGroupTex:t.groupTexture})}e.create=t,e.createEmpty=r,e.Params=Ac(Ac({}
139,qI.Params),{interpolation:Ib.Select("bspline",Ib.objectToOptions(fB))}),e.Utils={Params:e.Params,createEmpty:r,createValues:n,createValuesSimple:function(t,r,i,a,o){var s=qI.createSimple(i,a,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return n(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.dInterpolation,t.interpolation)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=qI.createRenderableState(e);return t.opaque=!1,t},updateRenderableState:function(e,t){qI.updateRenderableState(e,t),e.opaque=!1},createPositionIterator:function(){return YM(1,1,1,function(){return WM})}}})(sB||={}),function(e){function t(e,t,r,i,a,o,s,u,c){return c?function(e,t,r,n,i,a,o,s,u){return s>u.cylinderCount&&(tf.update(u.mappingBuffer,e),tf.update(u.indexBuffer,t)),u.cylinderCount=s,tf.update(u.groupBuffer,r),tf.update(u.startBuffer,n),tf.update(u.endBuffer,i),tf.update(u.scaleBuffer,a),tf.update(u.capBuffer,o),u}(e,t,r,i,a,o,s,u,c):function(e,t,r,i,a,o,s,u){var c,l=XE(),d=-1,f=-1,h={kind:"cylinders",cylinderCount:u,mappingBuffer:tf.create(e),indexBuffer:tf.create(t),groupBuffer:tf.create(r),startBuffer:tf.create(i),endBuffer:tf.create(a),scaleBuffer:tf.create(o),capBuffer:tf.create(s),get boundingSphere(){var e=n(h);if(e!==d){var t=jM(h.startBuffer.ref.value,6*h.cylinderCount,6),r=jM(h.endBuffer.ref.value,6*h.cylinderCount,6);XE.expandBySphere(l,t,r),d=e}return l},get groupMapping(){return h.groupBuffer.ref.version!==f&&(c=yM(h.groupBuffer.ref.value,h.cylinderCount,6),f=h.groupBuffer.ref.version),c},setBoundingSphere:function(e){XE.copy(l,e),d=n(h)}};return h}(e,t,r,i,a,o,s,u)}function r(e){return t(e?e.mappingBuffer.ref.value:new Float32Array,e?e.indexBuffer.ref.value:new Uint32Array,e?e.groupBuffer.ref.value:new Float32Array,e?e.startBuffer.ref.value:new Float32Array,e?e.endBuffer.ref.value:new Float32Array,e?e.scaleBuffer.ref.value:new Float32Array,e?e.capBuffer.ref.value:new Float32Array,0,e)}function n(e){return Iv([e.cylinderCount,e.mappingBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version,e.startBuffer.ref.version,e.endBuffer.ref.version,e.scaleBuffer.ref.version,e.capBuffer.ref.version])}function i(e,t){var r=6*e.cylinderCount,n=t.instanceCount.ref.value,i=KM(),a=i.position,o=e.startBuffer.ref.value,s=e.endBuffer.ref.value,u=t.aTransform.ref.value;return YM(r,n,2,function(e,t){var r=e%6==0?o:s;return t<0?Cg.fromArray(a,r,3*e):Cg.transformMat4Offset(a,r,u,0,3*e,16*t),i})}function a(e,t,r,n,a){var o=r.instanceCount,s=r.groupCount,u=CI(r,i(e,t),n.color),c=DO(r,n.size),l=a.instanceGranularity?qM(o,"instance"):qM(o*s,"groupInstance"),d=eD(),f=nD(),h=cD(),p=aD(),m={drawCount:4*e.cylinderCount*3,vertexCount:6*e.cylinderCount,groupCount:s,instanceCount:o},g=RO(c)*a.sizeFactor,v=XE.clone(e.boundingSphere),y=GM(v,t.aTransform.ref.value,o,0);return Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({dGeometryType:tf.create("cylinders"),aMapping:e.mappingBuffer,aGroup:e.groupBuffer,aStart:e.startBuffer,aEnd:e.endBuffer,aScale:e.scaleBuffer,aCap:e.capBuffer,elements:e.indexBuffer,boundingSphere:tf.create(y),invariantBoundingSphere:tf.create(v),uInvariantBoundingSphere:tf.create(Ng.ofSphere(v))},u),c),l),d),f),h),p),t),{padding:tf.create(g)}),qI.createValues(a,m)),{uSizeFactor:tf.create(a.sizeFactor*a.sizeAspectRatio),uDoubleSided:tf.create(a.doubleSided),dIgnoreLight:tf.create(a.ignoreLight),dXrayShaded:tf.create("inverted"===a.xrayShaded?"inverted":!0===a.xrayShaded?"on":"off"),dTransparentBackfaces:tf.create(a.transparentBackfaces),dSolidInterior:tf.create(a.solidInterior),uBumpFrequency:tf.create(a.bumpFrequency),uBumpAmplitude:tf.create(a.bumpAmplitude)})}function o(e,t){qI.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xraySha
139ded,e.writeDepth=e.opaque}e.create=t,e.createEmpty=r,e.transform=function(e,t){var r=e.startBuffer.ref.value;dM(t,r,0,6*e.cylinderCount),tf.update(e.startBuffer,r);var n=e.endBuffer.ref.value;dM(t,n,0,6*e.cylinderCount),tf.update(e.endBuffer,n)},e.Params=Ac(Ac({},qI.Params),{sizeFactor:Ib.Numeric(1,{min:0,max:10,step:.1}),sizeAspectRatio:Ib.Numeric(1,{min:0,max:3,step:.01}),doubleSided:Ib.Boolean(!1,qI.CustomQualityParamInfo),ignoreLight:Ib.Boolean(!1,qI.ShadingCategory),xrayShaded:Ib.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],qI.ShadingCategory),transparentBackfaces:Ib.Select("off",Ib.arrayToOptions(["off","on","opaque"]),qI.ShadingCategory),solidInterior:Ib.Boolean(!0,qI.ShadingCategory),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory),bumpAmplitude:Ib.Numeric(1,{min:0,max:5,step:.1},qI.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:r,createValues:a,createValuesSimple:function(t,r,n,i,o){var s=qI.createSimple(n,i,o),u=Ac(Ac({},Ib.getDefaultValues(e.Params)),r);return a(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){qI.updateValues(e,t),tf.updateIfChanged(e.uSizeFactor,t.sizeFactor*t.sizeAspectRatio),tf.updateIfChanged(e.uDoubleSided,t.doubleSided),tf.updateIfChanged(e.dIgnoreLight,t.ignoreLight),tf.updateIfChanged(e.dXrayShaded,"inverted"===t.xrayShaded?"inverted":!0===t.xrayShaded?"on":"off"),tf.updateIfChanged(e.dTransparentBackfaces,t.transparentBackfaces),tf.updateIfChanged(e.dSolidInterior,t.solidInterior),tf.updateIfChanged(e.uBumpFrequency,t.bumpFrequency),tf.updateIfChanged(e.uBumpAmplitude,t.bumpAmplitude)},updateBoundingSphere:function(e,t){var r=XE.clone(t.boundingSphere),n=GM(r,e.aTransform.ref.value,e.instanceCount.ref.value,0);XE.equals(n,e.boundingSphere.ref.value)||tf.update(e.boundingSphere,n),XE.equals(r,e.invariantBoundingSphere.ref.value)||(tf.update(e.invariantBoundingSphere,r),tf.update(e.uInvariantBoundingSphere,Ng.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=qI.createRenderableState(e);return o(t,e),t},updateRenderableState:o,createPositionIterator:i}}(uB||={}),function(e){function t(e){switch(e.kind){case"mesh":return 3*e.triangleCount;case"points":return e.pointCount;case"spheres":return 2*e.sphereCount*3;case"cylinders":return 4*e.cylinderCount*3;case"text":return 2*e.charCount*3;case"lines":return 2*e.lineCount*3;case"direct-volume":return 36;case"image":return 6;case"texture-mesh":return e.vertexCount}}e.getDrawCount=t,e.getVertexCount=function(e){switch(e.kind){case"mesh":case"texture-mesh":return e.vertexCount;case"points":return e.pointCount;case"spheres":return 6*e.sphereCount;case"cylinders":return 6*e.cylinderCount;case"text":return 4*e.charCount;case"lines":return 4*e.lineCount;case"direct-volume":var t=e.gridDimension.ref.value;return t[0]*t[1]*t[2];case"image":return 4}},e.getGroupCount=function(e){switch(e.kind){case"mesh":case"points":case"spheres":case"cylinders":case"text":case"lines":return 0===t(e)?0:Nb(e.groupBuffer.ref.value)+1;case"direct-volume":return 1;case"image":return Nb(e.groupTexture.ref.value.array)+1;case"texture-mesh":return e.groupCount}},e.getUtils=function(e){switch(e.kind){case"mesh":return sD.Utils;case"points":return BO.Utils;case"spheres":return xR.Utils;case"cylinders":return uB.Utils;case"text":return UO.Utils;case"lines":return qO.Utils;case"direct-volume":return _R.Utils;case"image":return sB.Utils;case"texture-mesh":return SR.Utils}},e.getGranularity=function(e,t){return"instance"===t&&e.nonInstanceable?"group":t}}(cB||={});var pB={};function mB(e,t){return{factory:mB,granularity:"groupInstance",size:function(e){return xB.isLocation(e)?e.shape.getSize(e.group,e.instance):1},props:t,description:"Assigns sizes as defined by the shape object."}}var gB={name:"shape-group",label:"Shape Group",category:"",factory:mB,getParams:function(e){return pB},defaultValues:Ib.getDefaultValues(pB),isApplicable:function(e){return!!e.shape}},vB=tv(13421772),yB={};function bB(e,t){return{factory:bB,granularity:"groupInstance",color:function(e){return xB.isLocation(e)?e.shape.getColor(e.group,e.instance):vB},props:t,description:"Assigns colors as defined by the shape object."}}var _B,xB,SB={name:"shape-group",label:"Shape Group",category:NI.Misc,factory:bB,getParams:function(e){return yB},defaultValues:Ib.getDefaultValues(yB),isApplicable:function(e){return!!e.shape}},wB=Ac(Ac({},UR),{aPosition:AR("float32",3,0),elements:PR("uint32"),uBboxMin:CR("v3"),uBboxMax:CR("v3"),uBboxSize:CR("v3"),uMaxSteps:CR("i"),uStepScale:CR("f"),uJumpLength:CR("f"),uTransform:CR("m4"),uGridDim:CR("v3"),tTransferTex:TR("image-uint8","alpha","ubyte","linear"),uTransferScale:CR("f","material"),dGridTexType:ER("string",["2d","3d"]),uGridTexDim:CR("v3"),tGridTex:TR("texture","rgba","ubyte","linear"),uGridStats:CR("v4"),uCellDim:CR("v3"),uCartnToUnit:CR("m4"),uUnitToCartn:CR("m4"),dPackedGroup:ER("boolean"),dAxisOrder:ER("string",["012","021","102","120","201","210"]),dIgnoreLight:ER("boolean"),dXrayShaded:ER("string",["off","on","inverted"])}),AB=Ac(Ac({},UR),{aGroup:AR("float32",1,0),aPosition:AR("float32",3,0),aNormal:AR("float32",3,0),elements:PR("uint32"),dVaryingGroup:ER("boolean"),dFlatShaded:ER("boolean"),uDoubleSided:CR("b","material"),dFlipSided:ER("boolean"),dIgnoreLight:ER("boolean"),dXrayShaded:ER("string",["off","on","inverted"]),dTransparentBackfaces:ER("string",["off","on","opaque"]),uBumpFrequency:CR("f","material"),uBumpAmplitude:CR("f","material"),meta:MR("unknown")}),CB=Ac(Ac(Ac({},UR),RR),{aGroup:AR("float32",1,0),aPosition:AR("float32",3,0),dPointSizeAttenuation:ER("boolean"),dPointStyle:ER("string",["square","circle","fuzzy"])}),TB=Ac(Ac(Ac({},UR),RR),{aGroup:AR("float32",1,0),aMapping:AR("float32",2,0),aStart:AR("float32",3,0),aEnd:AR("float32",3,0),elements:PR("uint32"),dLineSizeAttenuation:ER("boolean"),uDoubleSided:CR("b","material"),dFlipSided:ER("boolean")}),PB=Ac(Ac(Ac({},UR),RR),{uTexDim:CR("v2"),tPositionGroup:TR("image-float32","rgba","float","nearest"),padding:MR("number"),uDoubleSided:CR("b","material"),dIgnoreLight:ER("boolean"),dXrayShaded:ER("string",["off","on","inverted"]),dTransparentBackfaces:ER("string",["off","on","opaque"]),dSolidInterior:ER("boolean"),dClipPrimitive:ER("boolean"),dApproximate:ER("boolean"),uAlphaThickness:CR("f"),uBumpFrequency:CR("f","material"),uBumpAmplitude:CR("f","material"),centerBuffer:MR("float32"),groupBuffer:MR("float32")}),EB=Ac(Ac(Ac({},UR),RR),{aGroup:AR("float32",1,0),aPosition:AR("float32",3,0),aMapping:AR("float32",2,0),aDepth:AR("float32",1,0),elements:PR("uint32"),aTexCoord:AR("float32",2,0),tFont:TR("image-uint8","alpha","ubyte","linear"),padding:MR("number"),uBorderWidth:CR("f","material"),uBorderColor:CR("v3","material"),uOffsetX:CR("f","material"),uOffsetY:CR("f","material"),uOffsetZ:CR("f","material"),uBackgroun
139dColor:CR("v3","material"),uBackgroundOpacity:CR("f","material")}),MB=Ac(Ac({},UR),{uGeoTexDim:CR("v2","buffered"),tPosition:TR("texture","rgb","float","nearest"),tGroup:TR("texture","alpha","float","nearest"),tNormal:TR("texture","rgb","float","nearest"),dVaryingGroup:ER("boolean"),dFlatShaded:ER("boolean"),uDoubleSided:CR("b","material"),dFlipSided:ER("boolean"),dIgnoreLight:ER("boolean"),dXrayShaded:ER("string",["off","on","inverted"]),dTransparentBackfaces:ER("string",["off","on","opaque"]),uBumpFrequency:CR("f","material"),uBumpAmplitude:CR("f","material"),meta:MR("unknown")}),kB=Ac(Ac({},UR),{aGroup:AR("float32",1,0),aPosition:AR("float32",3,0),aUv:AR("float32",2,0),elements:PR("uint32"),uImageTexDim:CR("v2"),tImageTex:TR("image-uint8","rgba","ubyte","nearest"),tGroupTex:TR("image-uint8","rgba","ubyte","nearest"),dInterpolation:ER("string",hB)}),IB=Ac(Ac(Ac({},UR),RR),{aGroup:AR("float32",1,0),aStart:AR("float32",3,0),aEnd:AR("float32",3,0),aMapping:AR("float32",3,0),aScale:AR("float32",1,0),aCap:AR("float32",1,0),elements:PR("uint32"),padding:MR("number"),uDoubleSided:CR("b","material"),dIgnoreLight:ER("boolean"),dXrayShaded:ER("string",["off","on","inverted"]),dTransparentBackfaces:ER("string",["off","on","opaque"]),dSolidInterior:ER("boolean"),uBumpFrequency:CR("f","material"),uBumpAmplitude:CR("f","material")}),DB=Jd(0,2147483647),OB=Jd(0,2147483647);function RB(e,t,r,n){return{id:DB(),type:e,values:t,state:r,materialId:n}}function BB(e){var t=e&&e.getElement("vertex"),r=e&&e.getElement("material"),n={group:"",vRed:"",vGreen:"",vBlue:"",mRed:"",mGreen:"",mBlue:""},i=[["",""]],a=[["",""]];if(t){for(var o=0,s=t.propertyNames.length;o<s;++o){var u=t.propertyNames[o];"uchar"!==(l=t.propertyTypes[o])&&"uint8"!==l&&"ushort"!==l&&"uint16"!==l&&"uint"!==l&&"uint32"!==l&&"int"!==l||i.push([u,u]),"uchar"!==l&&"uint8"!==l||a.push([u,u])}t.propertyNames.includes("atomid")?n.group="atomid":t.propertyNames.includes("material_index")&&(n.group="material_index"),t.propertyNames.includes("red")&&(n.vRed="red"),t.propertyNames.includes("green")&&(n.vGreen="green"),t.propertyNames.includes("blue")&&(n.vBlue="blue")}var c=[["",""]];if(r){for(o=0,s=r.propertyNames.length;o<s;++o){var l,d=r.propertyNames[o];"uchar"!==(l=r.propertyTypes[o])&&"uint8"!==l||c.push([d,d])}r.propertyNames.includes("red")&&(n.mRed="red"),r.propertyNames.includes("green")&&(n.mGreen="green"),r.propertyNames.includes("blue")&&(n.mBlue="blue")}var f=n.vRed&&n.vGreen&&n.vBlue?"vertex":n.mRed&&n.mGreen&&n.mBlue?"material":"uniform";return Ac(Ac({},sD.Params),{coloring:Ib.MappedStatic(f,{vertex:Ib.Group({red:Ib.Select(n.vRed,a,{label:"Red Property"}),green:Ib.Select(n.vGreen,a,{label:"Green Property"}),blue:Ib.Select(n.vBlue,a,{label:"Blue Property"})},{isFlat:!0}),material:Ib.Group({red:Ib.Select(n.mRed,c,{label:"Red Property"}),green:Ib.Select(n.mGreen,c,{label:"Green Property"}),blue:Ib.Select(n.mBlue,c,{label:"Blue Property"})},{isFlat:!0}),uniform:Ib.Group({color:Ib.Color(MC.grey),saturation:Ib.Numeric(0,{min:-6,max:6,step:.1}),lightness:Ib.Numeric(0,{min:-6,max:6,step:.1})},{isFlat:!0})}),grouping:Ib.MappedStatic(n.group?"vertex":"none",{vertex:Ib.Group({group:Ib.Select(n.group,i,{label:"Group Property"})},{isFlat:!0}),none:Ib.Group({})})})}(function(e){function t(e){var t=e.transforms.length,r=xB.Location(e);return YM(e.groupCount,t,1,function(e,t){return r.group=e,r.instance=t,r})}e.create=function(e,t,r,n,i,a,o){return{id:Wd.create22(),name:e,sourceData:t,geometry:r,transforms:o||[Og.identity()],get groupCount(){return cB.getGroupCount(r)},getColor:n,getSize:i,getLabel:a}},e.getTheme=function(e){return{color:bB(0,{}),size:mB(0,{})}},e.groupIterator=t,e.createTransform=function(e,t){for(var r=t&&t.aTransform.ref.value.length>=16*e.length?t.aTransform.ref.value:new Float32Array(16*e.length),n=0,i=e.length;n<i;++n)Og.toArray(e[n],r,16*n);return II(r,e.length,t)},e.createRenderObject=function(r,n){var i=e.getTheme(r),a=cB.getUtils(r.geometry),o=OB(),s=t(r),u=e.createTransform(r.transforms),c=a.createValues(r.geometry,u,s,i,n),l=a.createRenderableState(n);return RB(r.geometry.kind,c,l,o)},e.Loci=function(e){return{kind:"shape-loci",shape:e}},e.isLoci=function(e){return!!e&&"shape-loci"===e.kind},e.areLociEqual=function(e,t){return e.shape===t.shape},e.isLociEmpty=function(e){return 0===e.shape.groupCount}})(_B||={}),function(e){function t(e){for(var t=0,r=0,n=e.groups;r<n.length;r++){var i=n[r];t+=kP.size(i.ids)}return t}e.Location=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=0),{kind:"group-location",shape:e,group:t,instance:r}},e.isLocation=function(e){return!!e&&"group-location"===e.kind},e.Loci=function(e,t){return{kind:"group-loci",shape:e,groups:t}},e.isLoci=function(e){return!!e&&"group-loci"===e.kind},e.areLociEqual=function(e,t){if(e.shape!==t.shape||e.groups.length!==t.groups.length)return!1;for(var r=0,n=e.groups.length;r<n;++r){var i=e.groups[r],a=i.ids,o=i.instance,s=t.groups[r],u=s.ids;if(o!==s.instance||!kP.areEqual(a,u))return!1}return!0},e.isLociEmpty=function(e){return 0===t(e)},e.size=t;var r=new SM,n=Cg.zero();function i(e,t,i,a){for(var o=t.indices,s=t.offsets,u=function(e,t){kP.forEach(e,function(e){for(var u=s[e],c=s[e+1];u<c;++u)Cg.fromArray(n,i,3*o[u]),Cg.transformMat4(n,n,a[t]),r.includeStep(n)})},c=0,l=e;c<l.length;c++){var d=l[c];u(d.ids,d.instance)}}function a(e,t,i,a){for(var o=t.indices,s=t.offsets,u=function(e,t){kP.forEach(e,function(e){for(var u=s[e],c=s[e+1];u<c;++u)Cg.fromArray(n,i,3*o[u]),Cg.transformMat4(n,n,a[t]),r.radiusStep(n)})},c=0,l=e;c<l.length;c++){var d=l[c];u(d.ids,d.instance)}}e.getBoundingSphere=function(e,t){t||=XE(),r.reset();var n=0,o=e.shape,s=o.geometry,u=o.transforms;if("mesh"===s.kind||"points"===s.kind){var c="mesh"===s.kind?s.vertexBuffer.ref.value:s.centerBuffer.ref.value;i(e.groups,s.groupMapping,c,u),r.finishedIncludeStep(),a(e.groups,s.groupMapping,c,u)}else if("lines"===s.kind){var l=s.startBuffer.ref.value,d=s.endBuffer.ref.value;i(e.groups,s.groupMapping,l,u),i(e.groups,s.groupMapping,d,u),r.finishedIncludeStep(),a(e.groups,s.groupMapping,l,u),a(e.groups,s.groupMapping,d,u)}else{if("spheres"!==s.kind&&"text"!==s.kind)return XE.copy(t,s.boundingSphere);c=s.centerBuffer.ref.value,i(e.groups,s.groupMapping,c,u),r.finishedIncludeStep(),a(e.groups,s.groupMapping,c,u);for(var f=function(t,r){kP.forEach(t,function(t){var i=e.shape.getSize(t,r);n<i&&(n=i)})},h=0,p=e.groups;h<p.length;h++){var m=p[h];f(m.ids,m.instance)}}
139return Cg.copy(t.center,r.center),t.radius=Math.sqrt(r.radiusSq),XE.expand(t,t,n),t}}(xB||={});var NB=BB();function FB(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p,m,g;return Pc(this,function(v){switch(v.label){case 0:if(a=dO.createState(t.rowCount,t.rowCount/4,i),o=t.getProperty("x"),s=t.getProperty("y"),u=t.getProperty("z"),!o||!s||!u)throw Error("missing coordinate properties");c=t.getProperty("nx"),l=t.getProperty("ny"),d=t.getProperty("nz"),f=!!c&&!!l&&!!d,h=1e5,p=0,m=t.rowCount,v.label=1;case 1:return p<m?(function(e,t,r,n,i){var a=r.vertices,o=r.normals,s=r.groups,u=n.getProperty("x"),c=n.getProperty("y"),l=n.getProperty("z");if(!u||!c||!l)throw Error("missing coordinate properties");for(var d=n.getProperty("nx"),f=n.getProperty("ny"),h=n.getProperty("nz"),p=!!d&&!!f&&!!h,m=e;m<t;++m)iv.add3(a,u.value(m),c.value(m),l.value(m)),p&&iv.add3(o,d.value(m),f.value(m),h.value(m)),iv.add(s,i[m])}(p,Math.min(p+h,m),a,t,n),e.shouldUpdate?[4,e.update({message:"adding ply mesh vertices",current:p,max:m})]:[3,3]):[3,4];case 2:v.sent(),v.label=3;case 3:return p+=h,[3,1];case 4:p=0,m=r.rowCount,v.label=5;case 5:return p<m?(function(e,t,r,n){for(var i=r.indices,a=e;a<t;++a){var o=n.value(a),s=o.entries,u=o.count;3===u?iv.add3(i,s[0],s[1],s[2]):4===u&&(iv.add3(i,s[2],s[1],s[0]),iv.add3(i,s[2],s[0],s[3]))}}(p,Math.min(p+h,m),a,r),e.shouldUpdate?[4,e.update({message:"adding ply mesh faces",current:p,max:m})]:[3,7]):[3,8];case 6:v.sent(),v.label=7;case 7:return p+=h,[3,5];case 8:return g=dO.getMesh(a),f||sD.computeNormals(g),tf.updateIfChanged(g.varyingGroup,!0),[2,g]}})})}var LB,$B=xv.Schema.int;function UB(e,t,r){var n,i,a,o=r.coloring,s=e.rowCount;if("vertex"===o.name)n=e.getProperty(o.params.red)||xv.ofConst(127,s,$B),i=e.getProperty(o.params.green)||xv.ofConst(127,s,$B),a=e.getProperty(o.params.blue)||xv.ofConst(127,s,$B);else if("material"===o.name)n=t&&t.getProperty(o.params.red)||xv.ofConst(127,s,$B),i=t&&t.getProperty(o.params.green)||xv.ofConst(127,s,$B),a=t&&t.getProperty(o.params.blue)||xv.ofConst(127,s,$B);else{var u=o.params.color;u=tv.saturate(u,o.params.saturation),u=tv.lighten(u,o.params.lightness);var c=tv.toRgb(u),l=c[0],d=c[1],f=c[2];n=xv.ofConst(l,s,$B),i=xv.ofConst(d,s,$B),a=xv.ofConst(f,s,$B)}return{kind:o.name,red:n,green:i,blue:a}}function jB(e,t,r,n){var i=r.kind,a=r.red,o=r.green,s=r.blue,u=n.ids,c=n.map,l=n.label,d=e.source,f=e.transforms;return _B.create("ply-mesh",d,t,function(e){var t="material"===i?e:c[e];return tv.fromRgb(a.value(t),o.value(t),s.value(t))},function(){return 1},function(e){return`${l} ${u[e]}`},f)}function zB(){var e,t,r,n,i,a,o=this;return function(s,u,c,l){return Tc(o,void 0,void 0,function(){var o,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:if(!(o=u.source.getElement("vertex")))throw Error("missing vertex element");if(!(d=u.source.getElement("face")))throw Error("missing face element");return f=u.source.getElement("material"),h=!1,p=!1,e&&e==e||(h=!0),t&&Ib.isParamEqual(NB.grouping,t.grouping,c.grouping)||(h=!0),t&&Ib.isParamEqual(NB.coloring,t.coloring,c.coloring)||(p=!0),h?(i=UB(o,f,c),a=function(e,t){for(var r=t.grouping,n=e.rowCount,i="vertex"===r.name?e.getProperty(r.params.group):void 0,a="vertex"===r.name?Yg(r.params.group):"Vertex",o=i?i.toArray({array:Uint32Array}):zb(new Uint32Array(n)),s=i?Nb(o):n-1,u=new Uint32Array(s+1),c=0,l=o.length;c<l;++c)u[o[c]]=c;return{ids:o,map:u,label:a}}(o,c),[4,FB(s,o,d,a.ids,l&&l.geometry)]):[3,2];case 1:return n=m.sent(),r=jB(u,n,i,a),[3,3];case 2:p&&(i=UB(o,f,c),r=jB(u,n,i,a)),m.label=3;case 3:return e=u,t=Vg(c),[2,r]}})})}}function GB(e,t){var r=this;return vy.create("Shape Provider",function(n){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){return[2,{label:"Mesh",data:{source:e,transforms:t?.transforms},params:BB(e),getShape:zB(),geometryUtils:sD.Utils}]})})})}function VB(e,t){return{value:e,unit:t}}function HB(){return HB.empty()}function qB(e){var t=this;return vy.create("Parse DCD",function(r){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return[4,r.update("Converting to coordinates")];case 1:for(d.sent(),t=e.header,n=t.DELTA?VB(20.45482949774598*t.DELTA,"ps"):VB(1,"step"),i=t.ISTART>
139=1?VB((t.ISTART-1)*n.value,n.unit):VB(0,n.unit),a=[],o=0,s=e.frames.length;o<s;++o)u=e.frames[o],c={elementCount:u.elementCount,time:VB(i.value+n.value*o,n.unit),x:u.x,y:u.y,z:u.z,xyzOrdering:{isIdentity:!0}},u.cell&&((l=u.cell)[1]>=-1&&l[1]<=1&&l[3]>=-1&&l[3]<=1&&l[4]>=-1&&l[4]<=1?c.cell=HB.create(Cg.create(l[0],l[2],l[5]),Cg.create(Mg(90-90*Math.asin(l[1])/Pg),Mg(90-90*Math.asin(l[3])/Pg),Mg(90-90*Math.asin(l[4])/Pg))):l[0]<0||l[1]<0||l[2]<0||l[3]<0||l[4]<0||l[5]<0||l[3]>180||l[4]>180||l[5]>180?c.cell=HB.fromBasis(Cg.create(l[0],l[1],l[3]),Cg.create(l[1],l[2],l[4]),Cg.create(l[3],l[4],l[5])):c.cell=HB.create(Cg.create(l[0],l[2],l[5]),Cg.create(Mg(yg(l[1],0,vg)?90:l[1]),Mg(yg(l[3],0,vg)?90:l[3]),Mg(yg(l[4],0,vg)?90:l[4])))),a.push(c);return[2,LB.create(a,n,i)]}})})})}function WB(e,t,r,n){for(var i=r,a=n-1,o=t.charCodeAt(i);(32===o||o>=48&&o<=57)&&i<=a;)o=t.charCodeAt(++i);for(o=t.charCodeAt(a);(32===o||o>=48&&o<=57)&&a>=i;)o=t.charCodeAt(--a);if(i===++a||i+1===a)return $S.add(e,i,a);if(o=t.charCodeAt(i),i+2===a){var s=t.charCodeAt(i+1);if(!((78!==o&&110!==o||65!==s&&97!==s)&&(67!==o&&99!==o||76!==s&&108!==s)&&(70!==o&&102!==o||69!==s&&101!==s)&&(83!==o&&115!==o||73!==s&&105!==s)&&(66!==o&&98!==o||82!==s&&114!==s)&&(65!==o&&97!==o||83!==s&&115!==s)))return $S.add(e,i,i+2)}if(67===o||99===o||72===o||104===o||78===o||110===o||79===o||111===o||80===o||112===o||83===o||115===o)return $S.add(e,i,i+1);$S.add(e,i,i)}(function(e){e.create=function(e,t,r){var n=!!e[0].cell,i=!!e[0].velocities,a=!!e[0].forces;return{id:Wd.create22(),frames:e,hasCell:n,hasVelocities:i,hasForces:a,deltaTime:t,timeOffset:r}},e.getAtomicConformation=function(e,t,o){var s=e.x,u=e.y,c=e.z;return e.xyzOrdering.frozen?o?e.xyzOrdering.isIdentity?(s=i(s,o),u=i(u,o),c=i(c,o)):af(e.xyzOrdering.index,o)||(s=n(s,e.xyzOrdering.index,o),u=n(u,e.xyzOrdering.index,o),c=n(c,e.xyzOrdering.index,o)):e.xyzOrdering.isIdentity||(s=a(s,e.xyzOrdering.index),u=a(u,e.xyzOrdering.index),c=a(c,e.xyzOrdering.index)):o&&(e.xyzOrdering.isIdentity?(e.xyzOrdering.isIdentity=!1,e.xyzOrdering.index=o,r(s,o),r(u,o),r(c,o)):af(e.xyzOrdering.index,o)||(s=n(s,e.xyzOrdering.index,o),u=n(u,e.xyzOrdering.index,o),c=n(c,e.xyzOrdering.index,o))),e.xyzOrdering.frozen=!0,{id:Wd.create22(),atomId:t.atomId,occupancy:t.occupancy??xv.ofConst(1,e.elementCount,xv.Schema.int),B_iso_or_equiv:t.B_iso_or_equiv??xv.ofConst(0,e.elementCount,xv.Schema.float),xyzDefined:!0,x:s,y:u,z:c}};var t=[.123];function r(e,r){for(var n=t,i=0,a=e.length;i<a;i++)n[i]=e[r[i]];for(i=0,a=e.length;i<a;i++)e[i]=n[i]}function n(e,t,r){for(var n=new Float32Array(e.length),i=0,a=e.length;i<a;i++)n[i]=e[t[r[i]]];return n}function i(e,t){for(var r=new Float32Array(e.length),n=0,i=e.length;n<i;n++)r[n]=e[t[n]];return r}function a(e,t){for(var r=new Float32Array(e.length),n=0,i=e.length;n<i;n++)r[t[n]]=e[n];return r}})(LB||={}),function(e){function t(e,t){return{size:e,anglesInRadians:t}}function r(){return t(Cg(),Cg())}e.create=t,e.empty=r,e.fromBasis=function(e,n,i){var a=Cg.magnitude(e),o=Cg.magnitude(n),s=Cg.magnitude(i),u=Math.acos(Cg.dot(n,i)/(o*s)),c=Math.acos(Cg.dot(e,i)/(a*s)),l=Math.acos(Cg.dot(e,n)/(a*o));return a<=0||o<=0||s<=0||u>=Math.PI||c>=Math.PI||l>=Math.PI?r():t(Cg.create(a,o,s),Cg.create(u,c,l))}}(HB||={});var XB=new Set(["NA","CL","FE","SI","BR","AS","LI"]),YB=new Set(["C","H","N","O","P","S","F","B"]),KB=/^[\s\d]+|[\s\d]+$/g;function ZB(e,t){var r=(e=e.replace(KB,"").toUpperCase()).length;if(0===r||1===r||XB.has(e))return e;if(3===r&&t===e){if("SOD"===e)return"NA";if("POT"===e)return"K";if("CES"===e)return"CS";if("CAL"===e)return"CA";if("CLA"===e)return"CL"}return YB.has(e[0])?e[0]:""}var QB,JB,eN,tN=new Set("145.147.149.289.291.293.445.475.491.510.604.045.05L.07E.07Y.08U.09X.0AT.0BD.0H0.0HX.0LP.0MK.0NZ.0TS.0UB.0V4.0WK.0XY.0YT.10M.12E.14T.15L.16F.16G.16O.17T.18D.18O.18T.1AR.1BW.1CF.1FT.1GL.1GN.1JB.1LL.1NA.1S3.1S4.1SD.1X4.20S.20X.22O.22S.23V.24S.25E.26M.26O.26Q.26R.26V.26W.26Y.27C.2DG.2DR.2F8.2FG.2FL.2FP.2GL.2GS.2H5.2HA.2M4.2M5.2M8.2OS.2SI.2WP.2WS.32O.34V.38J.3BU.3CM.3DO.3DY.3FM.3GR.3HD.3J3.3J4.3LJ.3LR.3MF.3MG.3MK.3R3.3S6.3SA.3YW.40J.42D.44S.46D.46M.46Z.48Z.49A.49S.49T.49V.4AM.4CQ.4GC.4GL.4GP.4JA.4N2.4NN.4QY.4R1.4RS.4SG.4U0.4U1.4U2.4UZ.4V5.50A.51N.56N.57S.5DI.5GF.5GO.5II.5KQ.5KS.5KT.5KV.5L2.5L3.5LS.5LT.5MM.5N6.5QP.5RP.5SA.5SP.5TH.5TJ.5TK.5TM.61J.62I.64K.66O.6BG.6C2.6DM.6GB.
1396GP.6GR.6K3.6KH.6KL.6KS.6KU.6KW.6LA.6LS.6LW.6MJ.6MN.6PG.6PY.6PZ.6S2.6SA.6UD.6Y6.6YR.6ZC.73E.79J.7CV.7D1.7GP.7JZ.7K2.7K3.7NU.7SA.83Y.89Y.8B7.8B9.8EX.8GA.8GG.8GP.8I4.8LM.8LR.8OQ.8PK.8S0.8YV.95Z.96O.98U.9AM.9C1.9CD.9GP.9KJ.9MR.9OK.9PG.9QG.9QZ.9S7.9SG.9SJ.9SM.9SP.9T1.9T7.9VP.9WJ.9WN.9WZ.9YW.A0K.A1Q.A2G.A5C.A6P.AAL.AAO.ABC.ABD.ABE.ABF.ABL.AC1.ACG.ACR.ACX.ADA.ADG.ADR.AF1.AFD.AFL.AFO.AFP.AFR.AGC.AGH.AGL.AGR.AH2.AH8.AHG.AHM.AHR.AIG.ALL.ALX.AMG.AMN.AMU.AMV.ANA.AOG.AOS.AQA.ARA.ARB.ARE.ARI.ARW.ASC.ASG.ASO.AXP.AXR.AY9.AZC.B0D.B16.B1H.B1N.B2G.B4G.B6D.B7G.B8D.B9D.BBK.BBV.BCD.BCW.BDF.BDG.BDP.BDR.BDZ.BEM.BFN.BFP.BG6.BG8.BGC.BGL.BGN.BGP.BGS.BHG.BM3.BM7.BMA.BMX.BND.BNG.BNX.BO1.BOG.BQY.BRI.BS7.BTG.BTU.BW3.BWG.BXF.BXP.BXX.BXY.BZD.C3B.C3G.C3X.C4B.C4W.C4X.C5X.CAP.CBF.CBI.CBK.CDR.CE5.CE6.CE8.CEG.CEX.CEY.CEZ.CGF.CJB.CKB.CKP.CNP.CR1.CR6.CRA.CT3.CTO.CTR.CTT.D0N.D1M.D5E.D6G.DAF.DAG.DAN.DDA.DDB.DDL.DEG.DEL.DFR.DFX.DG0.DGC.DGD.DGM.DGO.DGS.DGU.DIG.DJB.DJE.DK4.DKX.DKZ.DL6.DLD.DLF.DLG.DMU.DNO.DO8.DOM.DP5.DPC.DQQ.DQR.DR2.DR3.DR4.DR5.DRI.DSR.DT6.DVC.DYM.E3M.E4P.E5G.EAG.EBG.EBQ.EEN.EEQ.EGA.EJT.EMP.EMZ.EPG.EQP.EQV.ERE.ERI.ETT.EUS.F1P.F1X.F55.F58.F6P.F8X.FBP.FCA.FCB.FCT.FDP.FDQ.FFC.FFX.FIF.FIX.FK9.FKD.FMF.FMO.FNG.FNY.FRU.FSA.FSI.FSM.FSR.FSW.FU4.FUB.FUC.FUD.FUF.FUL.FUY.FVQ.FX1.FYJ.G0S.G16.G1P.G20.G28.G2F.G3F.G3I.G4D.G4S.G6D.G6P.G6S.G7P.G8Z.GAA.GAC.GAD.GAF.GAL.GAT.GBH.GC1.GC4.GC9.GCB.GCD.GCN.GCO.GCS.GCT.GCU.GCV.GCW.GDA.GDL.GE1.GE3.GFP.GIV.GL0.GL1.GL2.GL4.GL5.GL6.GL7.GL9.GLA.GLB.GLC.GLD.GLF.GLG.GLO.GLP.GLS.GLT.GLW.GM0.GMB.GMH.GMT.GMZ.GN1.GN4.GNS.GNX.GP0.GP1.GP4.GPH.GPK.GPM.GPO.GPQ.GPU.GPV.GPW.GQ1.GRF.GRX.GS1.GS4.GS9.GSA.GSD.GTE.GTH.GTK.GTM.GTR.GU0.GU1.GU2.GU3.GU4.GU5.GU6.GU8.GU9.GUF.GUL.GUP.GUZ.GXL.GXV.GYE.GYG.GYP.GYU.GYV.GZL.H1M.H1S.H2P.H3S.H53.H6Q.H6Z.HBZ.HD4.HDL.HMS.HNV.HNW.HSG.HSH.HSJ.HSQ.HSR.HSU.HSX.HSY.HSZ.HTG.HTM.HVC.I57.IAB.IDC.IDF.IDG.IDR.IDS.IDT.IDU.IDX.IDY.IEM.IN1.IPT.ISD.ISL.ISX.IVG.IXD.J5B.JFZ.JHM.JLT.JRV.JS2.JSV.JV4.JVA.JVS.JZR.K5B.K99.KBA.KBG.KD5.KDA.KDB.KDD.KDE.KDF.KDM.KDN.KDO.KDR.KFN.KG1.KGM.KHP.KME.KO1.KO2.KOT.KQC.KTU.L1L.L6N.L6S.L6T.LAG.LAH.LAI.LAK.LAO.LAT.LB2.LBS.LBT.LCN.LDY.LEC.LER.LFC.LFR.LGC.LGU.LKA.LKS.LM2.LMO.LMT.LMU.LNV.LOG.LOX.LPK.LRH.LSM.LTG.LTM.LVO.LVZ.LXB.LXC.LXZ.LZ0.M1F.M1P.M2F.M3M.M3N.M55.M6D.M6P.M7B.M7P.M8C.MA1.MA2.MA3.MA8.MAB.MAF.MAG.MAL.MAN.MAT.MAV.MAW.MBE.MBF.MBG.MCU.MDA.MDP.MFA.MFB.MFU.MG5.MGA.MGC.MGL.MGS.MJJ.MLB.MLR.MMA.MMN.MN0.MNA.MQG.MQT.MRH.MRP.MSX.MTT.MUB.MUG.MUR.MVP.MXY.MXZ.MYG.N1L.N3U.N9S.NA1.NAA.NAG.NBG.NBX.NBY.NDG.NED.NFG.NG1.NG6.NGA.NGB.NGC.NGE.NGF.NGK.NGL.NGR.NGS.NGY.NGZ.NHF.NLC.NM6.NM9.NNG.NPF.NSQ.NT1.NTF.NTO.NTP.NXD.NYT.O1G.OAK.OEL.OI7.OPM.ORP.OSU.OTG.OTN.OTU.OX2.P53.P6P.P8E.PA1.PA5.PAV.PDX.PH5.PKM.PNA.PNG.PNJ.PNW.PPC.PRP.PSG.PSJ.PSV.PTQ.PUF.PZU.QDK.QIF.QKH.QPS.QV4.R1P.R1X.R2B.R2G.R5P.RAA.RAE.RAF.RAM.RAO.RAT.RB5.RBL.RCD.RDP.REL.RER.RF5.RG1.RGG.RHA.RHC.RI2.RIB.RIP.RM4.RNS.RNT.ROB.ROR.RP3.RP5.RP6.RPA.RR7.RRJ.RRY.RST.RTG.RTV.RUB.RUG.RUU.RV7.RVG.RVM.RWI.RY7.RZM.S6P.S7P.S81.SA0.SCG.SCR.SDD.SDY.SEJ.SF6.SF9.SFJ.SFU.SG4.SG5.SG6.SG7.SGA.SGC.SGD.SGN.SGS.SHB.SHD.SHG.SI3.SIA.SID.SIO.SIZ.SLB.SLM.SLT.SMD.SN5.SNG.SOE.SOG.SOL.SOR.SR1.SSG.SSH.STW.STZ.SUC.SUP.SUS.SWE.SZZ.T68.T6D.T6P.T6T.TA6.TAG.TCB.TCG.TDG.TEU.TF0.TFU.TGA.TGK.TGR.TGY.TH1.TM5.TM6.TM9.TMR.TMX.TNX.TOA.TOC.TQY.TRE.TRV.TS8.TT7.TTV.TTZ.TU4.TUG.TUJ.TUP.TUR.TVD.TVG.TVM.TVS.TVV.TVY.TW7.TWA.TWD.TWG.TWJ.TWY.TXB.TY6.TYV.U1Y.U2A.U2D.U63.U8V.U97.U9A.U9D.U9G.U9J.U9M.UAP.UBH.UBO.UCD.UDC.UEA.V3M.V3P.V71.VG1.VJ1.VJ4.VKN.VTB.W9T.WIA.WOO.WUN.WZ1.WZ2.WZ4.X0X.X1P.X1X.X2F.X2Y.X34.X4S.X5S.X6X.X6Y.XBP.XDP.XDX.XGP.XIL.XKJ.XLF.XLS.XMM.XS2.XUL.XXM.XXR.XXX.XY6.XY9.XYB.XYF.XYL.XYP.XYS.XYT.XYZ.YDR.YIO.YJM.YKR.YO5.YX0.YX1.YYB.YYD.YYH.YYJ.YYK.YYM.YYQ.YYR.YZ0.YZT.Z0F.Z15.Z16.Z2D.Z2T.Z3K.Z3L.Z3Q.Z3U.Z4K.Z4R.Z4S.Z4U.Z4V.Z4W.Z4Y.Z57.Z5J.Z5L.Z61.Z6G.Z6H.Z6J.Z6W.Z8H.Z8T.Z9D.Z9E.Z9H.Z9K.Z9L.Z9M.Z9N.Z9W.ZB0.ZB1.ZB2.ZB3.ZCD.ZCZ.ZD0.ZDC.ZDM.ZDO.ZEE.ZEL.ZGE.ZMR.UMQ.SQD".split("."));!function(e){e[e.FilledSphere=0]="FilledSphere",e[e.FilledCube=1]="FilledCube",e[e.CrossedCube=2]="CrossedCube",e[e.DividedDiamond=3]="DividedDiamond",e[e.FilledCone=4]="FilledCone",e[e.DevidedCone=5]="DevidedCone",e[e.FlatBox=6]="FlatBox",e[e.FilledStar=7]="FilledStar",e[e.FilledDiamond=8]="FilledDiamond",e[e.FlatDiamond=9]="FlatDiamond",e[e.FlatHexagon=10]="FlatHexagon",e[e.Pentagon=11]="Pentagon",e[e.DiamondPrism=12]="DiamondPrism",e[e.PentagonalPrism=13]="PentagonalPrism",e[e.HexagonalPrism=14]="HexagonalPrism",e[e.HeptagonalPrism=15]="HeptagonalPrism"}(eN||={});var rN,nN=37052,iN=42577,aN=16765952,oN=16021792,sN=16162465,uN=10830745,cN=9424105,lN=10582605,dN=15539236,fN=15854817;(function(e){e[e.Hexose=0]="Hexose",e[e.HexNAc=1]="HexNAc",e[e.Hexosamine=2]="Hexosamine",e[e.Hexuronate=3]="Hexuronate",e[e.Deoxyhexose=4]="Deoxyhexose",e[e.DeoxyhexNAc=5]="DeoxyhexNAc",e[e.DiDeoxyhexose=6]="DiDeoxyhexose",e[e.Pentose=7]="Pentose",e[e.Deoxynonulosonate=8]="Deoxynonulosonate",e[e.DiDeoxynonulosonate=9]="DiDeoxynonulosonate",e[e.Unknown=10]="Unknown",e[e.Assigned=11]="Assigned"})(rN||={}),(QB={})[rN.Hexose]="Hexose",QB[rN.HexNAc]="HexNAc",QB[rN.Hexosamine]="Hexosamine",QB[rN.Hexuronate]="Hexuronate",QB[rN.Deoxyhexose]="Deoxyhexose",QB[rN.DeoxyhexNAc]="DeoxyhexNAc",QB[rN.DiDeoxyhexose]="Di-deoxyhexose",QB[rN.Pentose]="Pentose",QB[rN.Deoxynonulosonate]="Deoxynonulosonate",QB[rN.DiDeoxynonulosonate]="Di-deoxynonulosonate",QB[rN.Unknown]="Unknown",QB[rN.Assigned]="Assigned";var hN=((JB={})[rN.Hexose]=eN.FilledSphere,JB[rN.HexNAc]=eN.FilledCube,JB[rN.Hexosamine]=eN.CrossedCube,JB[rN.Hexuronate]=eN.DividedDiamond,JB[rN.Deoxyhexose]=eN.FilledCone,JB[rN.DeoxyhexNAc]=eN.DevidedCone,JB[rN.DiDeoxyhexose]=eN.FlatBox,JB[rN.Pentose]=eN.FilledStar,JB[rN.Deoxynonulosonate]=eN.FilledDiamond,JB[rN.DiDeoxynonulosonate]=eN.FlatDiamond,JB[rN.Unknown]=eN.FlatHexagon,JB[rN.Assigned]=eN.Pentagon,JB);function pN(e,t){return e===rN.Unknown?4===t?eN.DiamondPrism:5===t?eN.PentagonalPrism:6===t?eN.HexagonalPrism:7===t?eN.HeptagonalPrism:eN.FlatHexagon:hN[e]}
139var mN,gN={abbr:"Unk",name:"Unknown",color:fN,type:rN.Unknown},vN=[{abbr:"Glc",name:"Glucose",color:nN,type:rN.Hexose},{abbr:"Man",name:"Mannose",color:iN,type:rN.Hexose},{abbr:"Gal",name:"Galactose",color:aN,type:rN.Hexose},{abbr:"Gul",name:"Gulose",color:oN,type:rN.Hexose},{abbr:"Alt",name:"Altrose",color:sN,type:rN.Hexose},{abbr:"All",name:"Allose",color:uN,type:rN.Hexose},{abbr:"Tal",name:"Talose",color:cN,type:rN.Hexose},{abbr:"Ido",name:"Idose",color:lN,type:rN.Hexose},{abbr:"GlcNAc",name:"N-Acetyl Glucosamine",color:nN,type:rN.HexNAc},{abbr:"ManNAc",name:"N-Acetyl Mannosamine",color:iN,type:rN.HexNAc},{abbr:"GalNAc",name:"N-Acetyl Galactosamine",color:aN,type:rN.HexNAc},{abbr:"GulNAc",name:"N-Acetyl Gulosamine",color:oN,type:rN.HexNAc},{abbr:"AltNAc",name:"N-Acetyl Altrosamine",color:sN,type:rN.HexNAc},{abbr:"AllNAc",name:"N-Acetyl Allosamine",color:uN,type:rN.HexNAc},{abbr:"TalNAc",name:"N-Acetyl Talosamine",color:cN,type:rN.HexNAc},{abbr:"IdoNAc",name:"N-Acetyl Idosamine",color:lN,type:rN.HexNAc},{abbr:"GlcN",name:"Glucosamine",color:nN,type:rN.Hexosamine},{abbr:"ManN",name:"Mannosamine",color:iN,type:rN.Hexosamine},{abbr:"GalN",name:"Galactosamine",color:aN,type:rN.Hexosamine},{abbr:"GulN",name:"Gulosamine",color:oN,type:rN.Hexosamine},{abbr:"AltN",name:"Altrosamine",color:sN,type:rN.Hexosamine},{abbr:"AllN",name:"Allosamine",color:uN,type:rN.Hexosamine},{abbr:"TalN",name:"Talosamine",color:cN,type:rN.Hexosamine},{abbr:"IdoN",name:"Idosamine",color:lN,type:rN.Hexosamine},{abbr:"GlcA",name:"Glucuronic Acid",color:nN,type:rN.Hexuronate},{abbr:"ManA",name:"Mannuronic Acid",color:iN,type:rN.Hexuronate},{abbr:"GalA",name:"Galacturonic Acid",color:aN,type:rN.Hexuronate},{abbr:"GulA",name:"Guluronic Acid",color:oN,type:rN.Hexuronate},{abbr:"AltA",name:"Altruronic Acid",color:sN,type:rN.Hexuronate},{abbr:"AllA",name:"Alluronic Acid",color:uN,type:rN.Hexuronate},{abbr:"TalA",name:"Taluronic Acid",color:cN,type:rN.Hexuronate},{abbr:"IdoA",name:"Iduronic Acid",color:lN,type:rN.Hexuronate},{abbr:"Qui",name:"Quinovose",color:nN,type:rN.Deoxyhexose},{abbr:"Rha",name:"Rhamnose",color:iN,type:rN.Deoxyhexose},{abbr:"6dGul",name:"6-Deoxy Gulose",color:oN,type:rN.Deoxyhexose},{abbr:"6dAlt",name:"6-Deoxy Altrose",color:sN,type:rN.Deoxyhexose},{abbr:"6dTal",name:"6-Deoxy Talose",color:cN,type:rN.Deoxyhexose},{abbr:"Fuc",name:"Fucose",color:dN,type:rN.Deoxyhexose},{abbr:"QuiNAc",name:"N-Acetyl Quinovosamine",color:nN,type:rN.DeoxyhexNAc},{abbr:"RhaNAc",name:"N-Acetyl Rhamnosamine",color:iN,type:rN.DeoxyhexNAc},{abbr:"6dAltNAc",name:"N-Acetyl 6-Deoxy Altrosamine",color:sN,type:rN.DeoxyhexNAc},{abbr:"6dTalNAc",name:"N-Acetyl 6-Deoxy Talosamine",color:cN,type:rN.DeoxyhexNAc},{abbr:"FucNAc",name:"N-Acetyl Fucosamine",color:dN,type:rN.DeoxyhexNAc},{abbr:"Oli",name:"Olivose",color:nN,type:rN.DiDeoxyhexose},{abbr:"Tyv",name:"Tyvelose",color:iN,type:rN.DiDeoxyhexose},{abbr:"Abe",name:"Abequose",color:oN,type:rN.DiDeoxyhexose},{abbr:"Par",name:"Paratose",color:sN,type:rN.DiDeoxyhexose},{abbr:"Dig",name:"Digitoxose",color:uN,type:rN.DiDeoxyhexose},{abbr:"Col",name:"Colitose",color:cN,type:rN.DiDeoxyhexose},{abbr:"Ara",name:"Arabinose",color:iN,type:rN.Pentose},{abbr:"Lyx",name:"Lyxose",color:aN,type:rN.Pentose},{abbr:"Xyl",name:"Xylose",color:oN,type:rN.Pentose},{abbr:"Rib",name:"Ribose",color:sN,type:rN.Pentose},{abbr:"Kdn",name:"Keto-Deoxy Nonulonic Acid",color:iN,type:rN.Deoxynonulosonate},{abbr:"Neu5Ac",name:"N-Acetyl Neuraminic Acid",color:uN,type:rN.Deoxynonulosonate},{abbr:"Neu5Gc",name:"N-Glycolyl Neuraminic Acid",color:cN,type:rN.Deoxynonulosonate},{abbr:"Neu",name:"Neuraminic Acid",color:lN,type:rN.Deoxynonulosonate},{abbr:"Sia",name:"Sialic acid",color:dN,type:rN.Deoxynonulosonate},{abbr:"Pse",name:"Pseudaminic Acid",color:iN,type:rN.DiDeoxynonulosonate},{abbr:"Leg",name:"Legionaminic Acid",color:aN,type:rN.DiDeoxynonulosonate},{abbr:"Aci",name:"Acinetaminic Acid",color:sN,type:rN.DiDeoxynonulosonate},{abbr:"4eLeg",name:"4-Epilegionaminic Acid",color:cN,type:rN.DiDeoxynonulosonate},{abbr:"Bac",name:"Bacillosamine",color:nN,type:rN.Unknown},{abbr:"LDmanHep",name:"L-Glycero-D-Manno Heptose",color:iN,type:rN.Unknown},{abbr:"Kdo",name:"Keto-Deoxy Octulonic Acid",color:aN,type:rN.Unknown},{abbr:"Dha",name:"3-Deoxy Lyxo-Heptulosaric Acid",color:oN,type:rN.Unknown},{abbr:"DDmanHep",name:"D-Glycero-D-Manno-Heptose",color:sN,type:rN.Unknown},{abbr:"MurNAc",name:"N-Acetyl Muramic Acid",color:uN,type:rN.Unknown},{abbr:"MurNGc",name:"N-Glycolyl Muramic Acid",color:cN,type:rN.Unknown},{abbr:"Mur",name:"Muramic Acid",color:lN,type:rN.Unknown},{abbr:"Api",name:"Apicose",color:iN,type:rN.Assigned},{abbr:"Fru",name:"Fructose",color:iN,type:rN.Assigned},{abbr:"Tag",name:"Tagatose",color:aN,type:rN.Assigned},{abbr:"Sor",name:"Sorbose",color:oN,type:rN.Assigned},{abbr:"Psi",name:"Psicose",color:sN,type:rN.Assigned}],yN=function(){for(var e=new Map,t=0,r=vN.length;t<r;++t){var n=vN[t];e.set(n.abbr,n)}return e}
139(),bN=[["Glc-family",nN],["Man-family",iN],["Gal-family",aN],["Gul-family",oN],["Alt-family",sN],["All-family",uN],["Tal-family",cN],["Ido-family",lN],["Fuc-family",dN],["Generic/Unknown/Secondary",fN]],_N={Glc:["GLC","BGC","Z8T","TRE","MLR"],Man:["MAN","BMA"],Gal:["GLA","GAL","GZL","GXL","GIV"],Gul:["4GL","GL0","GUP","Z8H"],Alt:["Z6H","3MK","SHD"],All:["AFD","ALL","WOO","Z2D"],Tal:["ZEE","A5C","SDY"],Ido:["ZCD","Z0F","4N2"],GlcNAc:["NDG","NAG","NGZ"],ManNAc:["BM3","BM7"],GalNAc:["A2G","NGA","YYQ"],GulNAc:["LXB"],AltNAc:[],AllNAc:["NAA"],TalNAc:[],IdoNAc:["LXZ","HSQ"],GlcN:["PA1","GCS"],ManN:["95Z"],GalN:["X6X","1GN"],GulN:[],AltN:[],AllN:[],TalN:[],IdoN:[],GlcA:["GCU","BDP"],ManA:["MAV","BEM"],GalA:["ADA","GTR","GTK"],GulA:["LGU"],AltA:[],AllA:[],TalA:["X1X","X0X"],IdoA:["IDR"],Qui:["G6D","YYK"],Rha:["RAM","RM4","XXR"],"6dGul":["66O"],"6dAlt":[],"6dTal":[],Fuc:["FUC","FUL","FCA","FCB","GYE"],QuiNAc:["Z9W"],RhaNAc:[],"6dAltNAc":[],"6dTalNAc":[],FucNAc:["49T"],Oli:["DDA","RAE","Z5J"],Tyv:["TYV"],Abe:["ABE"],Par:["PZU"],Dig:["Z3U"],Col:[],Ara:["64K","ARA","ARB","AHR","FUB","BXY","BXX","SEJ"],Lyx:["LDY","Z4W"],Xyl:["XYS","XYP","XYZ","HSY","LXC"],Rib:["YYM","RIP","RIB","BDR","0MK","Z6J","32O"],Kdn:["KDM","KDN"],Neu5Ac:["SIA","SLB"],Neu5Gc:["NGC","NGE"],Neu:[],Sia:[],Pse:[],Leg:[],Aci:[],"4eLeg":[],Bac:[],LDmanHep:["GMH"],Kdo:["KDO"],Dha:[],DDmanHep:["289"],MurNAc:["MUB","AMU"],MurNGc:[],Mur:["1S4","MUR"],Api:["XXM"],Fru:["BDF","Z9N","FRU","LFR"],Tag:["T6T"],Sor:["SOE","UEA"],Psi:["PSV","SF6","SF9","TTV"]},xN={Glc:["AGLC","BGLC"],GlcNAc:["AGLCNA","BGLCNA","BGLCN0"],GlcA:["AGLCA","BGLCA","BGLCA0"],Man:["AMAN","BMAN"],Rha:["ARHM","BRHM"],Ara:["AARB","BARB"],Gal:["AGAL","BGAL"],GalNAc:["AGALNA","BGALNA"],Gul:["AGUL","BGUL"],Alt:["AALT","BALT"],All:["AALL","BALL"],Tal:["ATAL","BTAL"],Ido:["AIDO","BIDO"],IdoA:["AIDOA","BIDOA"],Fuc:["AFUC","BFUC"],Lyx:["ALYF","BLYF"],Xyl:["AXYL","BXYL","AXYF","BXYF"],Rib:["ARIB","BRIB"],Fru:["AFRU","BFRU"],Neu5Ac:["ANE5AC","BNE5AC"]},SN={Glc:"0GA.0GB.1GA.1GB.2GA.2GB.3GA.3GB.4GA.4GB.6GA.6GB.ZGA.ZGB.YGA.YGB.XGA.XGB.WGA.WGB.VGA.VGB.UGA.UGB.TGA.TGB.SGA.SGB.RGA.RGB.QGA.QGB.PGA.PGB.0gA.0gB.1gA.1gB.2gA.2gB.3gA.3gB.4gA.4gB.6gA.6gB.ZgA.ZgB.YgA.YgB.XgA.XgB.WgA.WgB.VgA.VgB.UgA.UgB.TgA.TgB.SgA.SgB.RgA.RgB.QgA.QgB.PgA.PgB".split("."),GlcNAc:"0YA.0YB.1YA.1YB.3YA.3YB.4YA.4YB.6YA.6YB.WYA.WYB.VYA.VYB.UYA.UYB.QYA.QYB.0yA.0yB.1yA.1yB.3yA.3yB.4yA.4yB.6yA.6yB.WyA.WyB.VyA.VyB.UyA.UyB.QyA.QyB.0YS.0Ys.3YS.3Ys.4YS.4Ys.6YS.6Ys.QYS.QYs.UYS.UYs.VYS.VYs.WYS.WYs.0yS.0ys.3yS.3ys.4yS.4ys".split("."),GlcA:"0ZA.0ZB.1ZA.1ZB.2ZA.2ZB.3ZA.3ZB.4ZA.4ZB.ZZA.ZZB.YZA.YZB.WZA.WZB.TZA.TZB.0zA.0zB.1zA.1zB.2zA.2zB.3zA.3zB.4zA.4zB.ZzA.ZzB.YzA.YzB.WzA.WzB.TzA.TzB.0ZBP".split("."),GlcN:["0YN","3YN","4YN","6YN","WYN","VYN","UYN","QYN","3Yn","4Yn","WYn","0Yn","0YP","3YP","4YP","6YP","WYP","VYP","UYP","QYP","0Yp","3Yp","4Yp","WYp"],Man:"0MA.0MB.1MA.1MB.2MA.2MB.3MA.3MB.4MA.4MB.6MA.6MB.ZMA.ZMB.YMA.YMB.XMA.XMB.WMA.WMB.VMA.VMB.UMA.UMB.TMA.TMB.SMA.SMB.RMA.RMB.QMA.QMB.PMA.PMB.0mA.0mB.1mA.1mB.2mA.2mB.3mA.3mB.4mA.4mB.6mA.6mB.ZmA.ZmB.YmA.YmB.XmA.XmB.WmA.WmB.VmA.VmB.UmA.UmB.TmA.TmB.SmA.SmB.RmA.RmB.QmA.QmB.PmA.PmB".split("."),ManNAc:"0WA.0WB.1WA.1WB.3WA.3WB.4WA.4WB.6WA.6WB.WWA.WWB.VWA.VWB.UWA.UWB.QWA.QWB.0wA.0wB.1wA.1wB.3wA.3wB.4wA.4wB.6wA.6wB.WwA.WwB.VwA.VwB.UwA.UwB.QwA.QwB".split("."),Ara:"0AA.0AB.1AA.1AB.2AA.2AB.3AA.3AB.4AA.4AB.ZAA.ZAB.YAA.YAB.WAA.WAB.TAA.TAB.0AD.0AU.1AD.1AU.2AD.2AU.3AD.3AU.5AD.5AU.ZAD.ZAU.0aA.0aB.1aA.1aB.2aA.2aB.3aA.3aB.4aA.4aB.ZaA.ZaB.YaA.YaB.WaA.WaB.TaA.TaB.0aD.0aU.1aD.1aU.2aD.2aU.3aD.3aU.5aD.5aU.ZaD.ZaU".split("."),Gal:"0LA.0LB.1LA.1LB.2LA.2LB.3LA.3LB.4LA.4LB.6LA.6LB.ZLA.ZLB.YLA.YLB.XLA.XLB.WLA.WLB.VLA.VLB.ULA.ULB.TLA.TLB.SLA.SLB.RLA.RLB.QLA.QLB.PLA.PLB.0lA.0lB.1lA.1lB.2lA.2lB.3lA.3lB.4lA.4lB.6lA.6lB.ZlA.ZlB.YlA.YlB.XlA.XlB.WlA.WlB.VlA.VlB.UlA.UlB.TlA.TlB.SlA.SlB.RlA.RlB.QlA.QlB.PlA.PlB".split("."),GalNAc:"0VA.0VB.1VA.1VB.3VA.3VB.4VA.4VB.6VA.6VB.WVA.WVB.VVA.VVB.UVA.UVB.QVA.QVB.0vA.0vB.1vA.1vB.3vA.3vB.4vA.4vB.6vA.6vB.WvA.WvB.VvA.VvB.UvA.UvB.QvA.QvB".split("."),GalA:"0OA.0OB.1OA.1OB.2OA.2OB.3OA.3OB.4OA.4OB.ZOA.ZOB.YOA.YOB.WOA.WOB.TOA.TOB.0oA.0oB.1oA.1oB.2oA.2oB.3oA.3oB.4oA.4oB.ZoA.ZoB.YoA.YoB.WoA.WoB.ToA.ToB".split("."),Gul:"0KA.0KB.1KA.1KB.2KA.2KB.3KA.3KB.4KA.4KB.6KA.6KB.ZKA.ZKB.YKA.YKB.XKA.XKB.WKA.WKB.VKA.VKB.UKA.UKB.TKA.TKB.SKA.SKB.RKA.RKB.QKA.QKB.PKA.PKB.0kA.0kB.1kA.1kB.2kA.2kB.3kA.3kB.4kA.4kB.6kA.6kB.ZkA.ZkB.YkA.YkB.XkA.XkB.WkA.WkB.VkA.VkB.UkA.UkB.TkA.TkB.SkA.SkB.RkA.RkB.QkA.QkB.PkA.PkB".split("."),Alt:"0EA.0EB.1EA.1EB.2EA.2EB.3EA.3EB.4EA.4EB.6EA.6EB.ZEA.ZEB.YEA.YE
139B.XEA.XEB.WEA.WEB.VEA.VEB.UEA.UEB.TEA.TEB.SEA.SEB.REA.REB.QEA.QEB.PEA.PEB.0eA.0eB.1eA.1eB.2eA.2eB.3eA.3eB.4eA.4eB.6eA.6eB.ZeA.ZeB.YeA.YeB.XeA.XeB.WeA.WeB.VeA.VeB.UeA.UeB.TeA.TeB.SeA.SeB.ReA.ReB.QeA.QeB.PeA.PeB".split("."),All:"0NA.0NB.1NA.1NB.2NA.2NB.3NA.3NB.4NA.4NB.6NA.6NB.ZNA.ZNB.YNA.YNB.XNA.XNB.WNA.WNB.VNA.VNB.UNA.UNB.TNA.TNB.SNA.SNB.RNA.RNB.QNA.QNB.PNA.PNB.0nA.0nB.1nA.1nB.2nA.2nB.3nA.3nB.4nA.4nB.6nA.6nB.ZnA.ZnB.YnA.YnB.XnA.XnB.WnA.WnB.VnA.VnB.UnA.UnB.TnA.TnB.SnA.SnB.RnA.RnB.QnA.QnB.PnA.PnB".split("."),Tal:"0TA.0TB.1TA.1TB.2TA.2TB.3TA.3TB.4TA.4TB.6TA.6TB.ZTA.ZTB.YTA.YTB.XTA.XTB.WTA.WTB.VTA.VTB.UTA.UTB.TTA.TTB.STA.STB.RTA.RTB.QTA.QTB.PTA.PTB.0tA.0tB.1tA.1tB.2tA.2tB.3tA.3tB.4tA.4tB.6tA.6tB.ZtA.ZtB.YtA.YtB.XtA.XtB.WtA.WtB.VtA.VtB.UtA.UtB.TtA.TtB.StA.StB.RtA.RtB.QtA.QtB.PtA.PtB".split("."),Ido:"0IA.0IB.1IA.1IB.2IA.2IB.3IA.3IB.4IA.4IB.6IA.6IB.ZIA.ZIB.YIA.YIB.XIA.XIB.WIA.WIB.VIA.VIB.UIA.UIB.TIA.TIB.SIA.SIB.RIA.RIB.QIA.QIB.PIA.PIB.0iA.0iB.1iA.1iB.2iA.2iB.3iA.3iB.4iA.4iB.6iA.6iB.ZiA.ZiB.YiA.YiB.XiA.XiB.WiA.WiB.ViA.ViB.UiA.UiB.TiA.TiB.SiA.SiB.RiA.RiB.QiA.QiB.PiA.PiB".split("."),IdoA:"0UA.0UB.1UA.1UB.2UA.2UB.3UA.3UB.4UA.4UB.ZUA.ZUB.YUA.YUB.WUA.WUB.TUA.TUB.0uA.0uB.1uA.1uB.2uA.2uB.3uA.3uB.4uA.4uB.ZuA.ZuB.YuA.YuB.WuA.WuB.TuA.TuB.YuAP".split("."),Fuc:"0FA.0FB.1FA.1FB.2FA.2FB.3FA.3FB.4FA.4FB.ZFA.ZFB.YFA.YFB.WFA.WFB.TFA.TFB.0fA.0fB.1fA.1fB.2fA.2fB.3fA.3fB.4fA.4fB.ZfA.ZfB.YfA.YfB.WfA.WfB.TfA.TfB".split("."),Rha:"0HA.0HB.1HA.1HB.2HA.2HB.3HA.3HB.4HA.4HB.ZHA.ZHB.YHA.YHB.WHA.WHB.THA.THB.0hA.0hB.1hA.1hB.2hA.2hB.3hA.3hB.4hA.4hB.ZhA.ZhB.YhA.YhB.WhA.WhB.ThA.ThB".split("."),Qui:"0QA.0QB.1QA.1QB.2QA.2QB.3QA.3QB.4QA.4QB.ZQA.ZQB.YQA.YQB.WQA.WQB.TQA.TQB.0qA.0qB.1qA.1qB.2qA.2qB.3qA.3qB.4qA.4qB.ZqA.ZqB.YqA.YqB.WqA.WqB.TqA.TqB".split("."),Lyx:"0DA.0DB.1DA.1DB.2DA.2DB.3DA.3DB.4DA.4DB.ZDA.ZDB.YDA.YDB.WDA.WDB.TDA.TDB.0DD.0DU.1DD.1DU.2DD.2DU.3DD.3DU.5DD.5DU.ZDD.ZDU.0dA.0dB.1dA.1dB.2dA.2dB.3dA.3dB.4dA.4dB.ZdA.ZdB.YdA.YdB.WdA.WdB.TdA.TdB.0dD.0dU.1dD.1dU.2dD.2dU.3dD.3dU.5dD.5dU.ZdD.ZdU".split("."),Xyl:"0XA.0XB.1XA.1XB.2XA.2XB.3XA.3XB.4XA.4XB.ZXA.ZXB.YXA.YXB.WXA.WXB.TXA.TXB.0XD.0XU.1XD.1XU.2XD.2XU.3XD.3XU.5XD.5XU.ZXD.ZXU.0xA.0xB.1xA.1xB.2xA.2xB.3xA.3xB.4xA.4xB.ZxA.ZxB.YxA.YxB.WxA.WxB.TxA.TxB.0xD.0xU.1xD.1xU.2xD.2xU.3xD.3xU.5xD.5xU.ZxD.ZxU".split("."),Rib:"0RA.0RB.1RA.1RB.2RA.2RB.3RA.3RB.4RA.4RB.ZRA.ZRB.YRA.YRB.WRA.WRB.TRA.TRB.0RD.0RU.1RD.1RU.2RD.2RU.3RD.3RU.5RD.5RU.ZRD.ZRU.0rA.0rB.1rA.1rB.2rA.2rB.3rA.3rB.4rA.4rB.ZrA.ZrB.YrA.YrB.WrA.WrB.TrA.TrB.0rD.0rU.1rD.1rU.2rD.2rU.3rD.3rU.5rD.5rU.ZrD.ZrU".split("."),Fru:"0CA.0CB.1CA.1CB.2CA.2CB.3CA.3CB.4CA.4CB.5CA.5CB.WCA.WCB.0CD.0CU.1CD.1CU.2CD.2CU.3CD.3CU.4CD.4CU.6CD.6CU.WCD.WCU.VCD.VCU.UCD.UCU.QCD.QCU.0cA.0cB.1cA.1cB.2cA.2cB.3cA.3cB.4cA.4cB.5cA.5cB.WcA.WcB.0cD.0cU.1cD.1cU.2cD.2cU.3cD.3cU.4cD.4cU.6cD.6cU.WcD.WcU.
139VcD.VcU.UcD.UcU.QcD.QcU".split("."),Tag:"0JA.0JB.1JA.1JB.2JA.2JB.3JA.3JB.4JA.4JB.5JA.5JB.WJA.WJB.0JD.0JU.1JD.1JU.2JD.2JU.3JD.3JU.4JD.4JU.6JD.6JU.WJD.WJU.VJD.VJU.UJD.UJU.QJD.QJU.0jA.0jB.1jA.1jB.2jA.2jB.3jA.3jB.4jA.4jB.5jA.5jB.WjA.WjB.0jD.0jU.1jD.1jU.2jD.2jU.3jD.3jU.4jD.4jU.6jD.6jU.WjD.WjU.VjD.VjU.UjD.UjU.QjD.QjU".split("."),Sor:"0BA.0BB.1BA.1BB.2BA.2BB.3BA.3BB.4BA.4BB.5BA.5BB.WBA.WBB.0BD.0BU.1BD.1BU.2BD.2BU.3BD.3BU.4BD.4BU.6BD.6BU.WBD.WBU.VBD.VBU.UBD.UBU.QBD.QBU.0bA.0bB.1bA.1bB.2bA.2bB.3bA.3bB.4bA.4bB.5bA.5bB.WbA.WbB.0bD.0bU.1bD.1bU.2bD.2bU.3bD.3bU.4bD.4bU.6bD.6bU.WbD.WbU.VbD.VbU.UbD.UbU.QbD.QbU".split("."),Psi:"0PA.0PB.1PA.1PB.2PA.2PB.3PA.3PB.4PA.4PB.5PA.5PB.WPA.WPB.0PD.0PU.1PD.1PU.2PD.2PU.3PD.3PU.4PD.4PU.6PD.6PU.WPD.WPU.VPD.VPU.UPD.UPU.QPD.QPU.0pA.0pB.1pA.1pB.2pA.2pB.3pA.3pB.4pA.4pB.5pA.5pB.WpA.WpB.0pD.0pU.1pD.1pU.2pD.2pU.3pD.3pU.4pD.4pU.6pD.6pU.WpD.WpU.VpD.VpU.UpD.UpU.QpD.QpU".split("."),Neu5Ac:"0SA.0SB.4SA.4SB.7SA.7SB.8SA.8SB.9SA.9SB.ASA.ASB.BSA.BSB.CSA.CSB.DSA.DSB.ESA.ESB.FSA.FSB.GSA.GSB.HSA.HSB.ISA.ISB.JSA.JSB.KSA.KSB.0sA.0sB.4sA.4sB.7sA.7sB.8sA.8sB.9sA.9sB.AsA.AsB.BsA.BsB.CsA.CsB.DsA.DsB.EsA.EsB.FsA.FsB.GsA.GsB.HsA.HsB.IsA.IsB.JsA.JsB.KsA.KsB".split("."),Neu5Gc:"0GL.4GL.7GL.8GL.9GL.CGL.DGL.EGL.FGL.GGL.HGL.IGL.JGL.KGL.0gL.4gL.7gL.8gL.9gL.AgL.BgL.CgL.DgL.EgL.FgL.GgL.HgL.IgL.JgL.KgL".split("."),Tyv:["0TV","0Tv","1TV","1Tv","2TV","2Tv","4TV","4Tv","YTV","YTv","0tV","0tv","1tV","1tv","2tV","2tv","4tV","4tv","YtV","Ytv"],Abe:["0AE","2AE","4AE","YGa","0AF","2AF","4AF","YAF"],Bac:["0BC","3BC","0bC","3bC"],Kdn:"0KN.4KN.5KN.7KN.8KN.9KN.AKN.BKN.CKN.DKN.EKN.FKN.GKN.HKN.IKN.JKN.KKN.LKN.MKN.NKN.OKN.PKN.QKN.RKN.SKN.TKN.UKN.VKN.WKN.XKN.YKN.0Kn.4Kn.5Kn.7Kn.8Kn.9Kn.AKn.BKn.CKn.DKn.EKn.FKn.GKn.HKn.IKn.JKn.KKn.LKn.MKn.NKn.OKn.PKn.QKn.RKn.SKn.TKn.UKn.VKn.WKn.XKn.YKn".split("."),Kdo:"0KO.4KO.5KO.7KO.8KO.AKO.BKO.CKO.DKO.EKO.FKO.GKO.HKO.IKO.JKO.KKO.0Ko.4Ko.5Ko.7Ko.8Ko.AKo.BKo.CKo.DKo.EKo.FKo.GKo.HKo.IKo.JKo.KKo".split(".")},wN=function(){for(var e=new Map,t=0,r=vN.length;t<r;++t){var n=vN[t],i=_N[n.abbr];if(i)for(var a=0,o=i.length;a<o;++a)e.set(i[a],n);var s=xN[n.abbr];if(s)for(a=0,o=s.length;a<o;++a)e.set(s[a],n)}return tN.forEach(function(t){e.has(t)||e.set(t,gN)}),e}(),AN=function(){for(var e=new Map,t=0,r=vN.length;t<r;++t){var n=vN[t],i=_N[n.abbr];if(i)for(var a=0,o=i.length;a<o;++a)e.set(i[a],n);var s=xN[n.abbr];if(s)for(a=0,o=s.length;a<o;++a)e.set(s[a],n);var u=SN[n.abbr];if(u)for(a=0,o=u.length;a<o;++a)e.has(u[a])||e.set(u[a],n)}return tN.forEach(function(t){e.has(t)||e.set(t,gN)}),e}(),CN=wN;!function(e){e.toArray=function(e){return Hv(e.values())},e.isSuperset=function(e,t){if(e.size<t.size)return!1;var r=!0;return t.forEach(function(t){r&&!e.has(t)&&(r=!1)}),r},e.add=function(e){for(var t=[...arguments].slice(1),r=0;r<t.length;r++)t[r].forEach(function(t){return e.add(t)});return e},e.union=function(e,t){var r=new Set(e);return t.forEach(function(e){return r.add(e)}),r},e.unionMany=function(){var e=[...arguments];if(0===e.length)return new Set;for(var t=new Set(e[0]),r=1,n=e.length;r<n;r++)e[r].forEach(function(e){return t.add(e)});return t},e.unionManyArrays=function(e){if(0===e.length)return new Set;for(var t=new Set(e[0]),r=1;r<e.length;r++)for(var n=0,i=e[r];n<i.length;n++){var a=i[n];t.add(a)}return t},e.intersection=function(e,t){var r=new Set;return t.forEach(function(t){e.has(t)&&r.add(t)}),r},e.areIntersecting=function(e,t){var r;e.size<t.size&&(e=(r=[t,e])[0],t=r[1]);var n=!1;return t.forEach(function(t){!n&&e.has(t)&&(n=!0)}),n},e.intersectionSize=function(e,t){var r;e.size<t.size&&(e=(r=[t,e])[0],t=r[1]);var n=0;return t.forEach(function(t){e.has(t)&&(n+=1)}),n},e.difference=function(e,t){var r=new Set(e);return t.forEach(function(e){return r.delete(e)}),r},e.differenceSize=function(e,t){var r=e.size;return e.forEach(function(e){t.has(e)&&--r}),r},e.areEqual=function(e,t){if(e.size!==t.size)return!1;var r=!0;return t.forEach(function(t){r&&!e.has(t)&&(r=!1)}),r}}(mN||={});var TN,PN=new Set("DAPC.DBPC.DFPC.DGPC.DIPC.DLPC.DNPC.DOPC.DPPC.DRPC.DTPC.DVPC.DXPC.DYPC.LPPC.PAPC.PEPC.PGPC.PIPC.POPC.PRPC.PUPC.DAPE.DBPE.DFPE.DGPE.DIPE.DLPE.DNPE.DOPE.DPPE.DRPE.DTPE.DUPE.DVPE.DXPE.DYPE.LPPE.PAPE.PGPE.PIPE.POPE.PQPE.PRPE.PUPE.DAPS.DBPS.DFPS.DGPS.DIPS.DLPS.DNPS.DOPS.DPPS.DRPS.DTPS.DUPS.DVPS.DXPS.DYPS.LPPS.PAPS.PGPS.PIPS.POPS.PQPS.PRPS.PUPS.DAPG.DBPG.DFPG.DGPG.DIPG.DLPG.DNPG.DOPG.DPPG.DRPG.DTPG.DVPG.DXPG.DYPG.LPPG.PAPG.PGPG.PIPG.POPG.PRPG.DAPA.DBPA.DFPA.DGPA.DIPA.DLPA.DNPA.DOPA.DPPA.DRPA.DTPA.DVPA.DXPA.DYPA.LPPA.PAPA.PGPA.PIPA.POPA.PRPA.PUPA.DPP.DPPI.PAPI.PIPI.POP.POPI.PUPI.PVP.PVPI.PADG.PIDG.PODG.PUDG.PVDG.APC.CPC.IPC.LPC.OPC.PPC.TPC.UPC.VPC.BNSM.DBSM.DPSM.DXSM.PGSM.PNSM.POSM.PVSM.XNSM.DPCE.DXCE.PNCE.XNCE.DMPC".split(".")),EN=new Set("118.119.543.1AL.1CU.2FK.2HP.2OF.3CO.3MT.3NI.3OF.3P8.4MO.4PU.4TI.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.CF.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.MMC.MN.MN3.MN5.MN6.MO1.MO2.MO3.MO4.MO5.MO6.MOO.MOS.MOW.MW1.MW2.MW3.NA.
139NA2.NA5.NA6.NAO.NAW.ND.NET.NH4.NI.NI1.NI2.NI3.NO2.NO3.NRU.NT3.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.RHF.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.ZR.NCO.OHX".split(".")),MN=function(){for(var e=Object.create(null),t=[],r=65;r<=90;r++)t[t.length]=String.fromCharCode(r);for(r=97;r<=122;r++)t[t.length]=String.fromCharCode(r);for(r=48;r<=57;r++)t[t.length]=String.fromCharCode(r);for(var n=0,i=t;n<i.length;n++){var a=i[n];e[a]=a.toUpperCase();for(var o=0,s=t;o<s.length;o++){var u=s[o];e[a+u]=(a+u).toUpperCase();for(var c=0,l=t;c<l.length;c++){var d=l[c];e[a+u+d]=(a+u+d).toUpperCase()}}}return e}();function kN(e){return MN[e]||e.toUpperCase()}var IN,DN=new Map([[1,"H"],[2,"He"],[3,"Li"],[4,"Be"],[5,"B"],[6,"C"],[7,"N"],[8,"O"],[9,"F"],[10,"Ne"],[11,"Na"],[12,"Mg"],[13,"Al"],[14,"Si"],[15,"P"],[16,"S"],[17,"Cl"],[18,"Ar"],[19,"K"],[20,"Ca"],[21,"Sc"],[22,"Ti"],[23,"V"],[24,"Cr"],[25,"Mn"],[26,"Fe"],[27,"Co"],[28,"Ni"],[29,"Cu"],[30,"Zn"],[31,"Ga"],[32,"Ge"],[33,"As"],[34,"Se"],[35,"Br"],[36,"Kr"],[37,"Rb"],[38,"Sr"],[39,"Y"],[40,"Zr"],[41,"Nb"],[42,"Mo"],[43,"Tc"],[44,"Ru"],[45,"Rh"],[46,"Pd"],[47,"Ag"],[48,"Cd"],[49,"In"],[50,"Sn"],[51,"Sb"],[52,"Te"],[53,"I"],[54,"Xe"],[55,"Cs"],[56,"Ba"],[57,"La"],[58,"Ce"],[59,"Pr"],[60,"Nd"],[61,"Pm"],[62,"Sm"],[63,"Eu"],[64,"Gd"],[65,"Tb"],[66,"Dy"],[67,"Ho"],[68,"Er"],[69,"Tm"],[70,"Yb"],[71,"Lu"],[72,"Hf"],[73,"Ta"],[74,"W"],[75,"Re"],[76,"Os"],[77,"Ir"],[78,"Pt"],[79,"Au"],[80,"Hg"],[81,"Tl"],[82,"Pb"],[83,"Bi"],[84,"Po"],[85,"At"],[86,"Rn"],[87,"Fr"],[88,"Ra"],[89,"Ac"],[90,"Th"],[91,"Pa"],[92,"U"],[93,"Np"],[94,"Pu"],[95,"Am"],[96,"Cm"],[97,"Bk"],[98,"Cf"],[99,"Es"],[100,"Fm"],[101,"Md"],[102,"No"],[103,"Lr"],[104,"Rf"],[105,"Db"],[106,"Sg"],[107,"Bh"],[108,"Hs"],[109,"Mt"],[110,"Ds"],[111,"Rg"],[112,"Cn"],[113,"Uut"],[114,"Fl"],[115,"Uup"],[116,"Lv"],[117,"Uus"],[118,"Uuo"]].map(function(e){return[e[0],kN(e[1])]}));!function(e){e[e.unknown=0]="unknown",e[e.polymer=1]="polymer",e[e["non-polymer"]=2]="non-polymer",e[e.macrolide=3]="macrolide",e[e.water=4]="water",e[e.branched=5]="branched"}(IN||={});var ON,RN,BN=((TN={})[0]={trace:new Set,directionFrom:new Set,directionTo:new Set,backboneStart:new Set,backboneEnd:new Set,coarseBackbone:new Set},TN[1]={trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O","OC1","O1","OX1","OXT","OT1"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["C"]),coarseBackbone:new Set(["CA","BB","CA1"])},TN[2]={trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CD"]),coarseBackbone:new Set(["CA"])},TN[3]={trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CG"]),coarseBackbone:new Set(["CA"])},TN[4]={trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C4'","C4*"]),directionTo:new Set(["C3'","C3*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},TN[5]={trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C3'","C3*"]),directionTo:new Set(["C1'","C1*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},TN[6]={trace:new Set(["N4'","N4*"]),directionFrom:new Set(["N4'","N4*"]),directionTo:new Set(["C7'","C7*"]),backboneStart:new Set(["N1'","N1*"]),backboneEnd:new Set(["C'","C*"]),coarseBackbone:new Set(["P"])},TN),NN=new Set(["CA","C","N","O","O1","O2","OC1","OC2","OT1","OT2","OX1","OXT","H","H1","H2","H3","HA","HN","HXT","BB"]),FN=new Set("P.OP1.OP2.HOP2.HOP3.O2'.O3'.O4'.O5'.C1'.C2'.C3'.C4'.C5'.H1'.H2'.H2''.HO2'.H3'.H4'.H5'.H5''.HO3'.HO5'.O2*.O3*.O4*.O5*.C1*.C2*.C3*.C4*.C5*".split(".")),LN=new Set(["d-peptide linking","d-peptide nh3 amino terminus","d-peptide cooh carboxy terminus","d-gamma-peptide, c-delta linking","d-beta-peptide, c-gamma linking"]),$N=new Set(["l-peptide linking","l-peptide nh3 amino terminus","l-peptide cooh carboxy terminus","l-gamma-peptide, c-delta linking","l-beta-peptide, c-gamma linking"]),UN=new Set(["d-gamma-peptide, c-delta linking","l-gamma-peptide, c-delta linking"]),jN=new Set(["d-beta-peptide, c-gamma linking","l-beta-peptide, c-gamma linking"]),zN=new Set(["d-peptide nh3 amino terminus","d-peptide cooh carboxy terminus","l-peptide nh3 amino terminus","l-peptide cooh carboxy terminus"]),GN=new Set(["peptide linking","peptide-like"]),VN=mN.unionMany(LN,$N,GN),HN=new Set(["dna linking","l-dna linking","dna oh 5 prime terminus","dna oh 3 prime terminus"]),qN=new Set(["rna linking","l-rna linking","rna oh 5 prime terminus","rna oh 3 prime terminus"]),WN=mN.unionMany(new Set(["d-saccharide, beta linking","l-saccharide, beta linking","d-saccharide, alpha linking","l-saccharide, alpha linking","l-saccharide","d-saccharide","saccharide"]),new Set(["d-saccharide 1,4 and 1,4 linking","l-saccharide 1,4 and 1,4 linking","d-saccharide 1,4 and 1,6 linking","l-saccharide 1,4 and 1,6 linking"])),XN=new Set(["non-polymer","other"]),YN=new Set(["ion"]),KN=new Set(["lipid"]),ZN=new Set(["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP","TIP3","TIP4","SPC"]),QN=new Set("HIS.ARG.LYS.ILE.PHE.LEU.TRP.ALA.MET.PRO.CYS.ASN.VAL.GLY.SER.GLN.TYR.ASP.GLU.THR.SEC.PYL.UNK.MSE.SEP.TPO.PTR.PCA.HYP.HSD.HSE.HSP.LSN.ASPP.GLUP.HID.HIE.HIP.LYN.ASH.GLH".split(".")),JN=new Set(["DAL","DAR","DSG","DAS","DCY","DGL","DGN","DHI","DIL","DLE","DLY","MED","DPN","DPR","DSN","DTH","DTR","DTY","DVA","DNE"]),eF=mN.unionMany(QN,JN),tF=new Set(["NME","ACE","NH2","FOR","FMT"]),rF=new Set(["A","C","T","G","I","U","N"]),nF=new Set(["DA","DC","DT","DG","DI","DU","DN"]),iF=new Set(["APN","CPN","TPN","GPN"]),aF=new Set(["A","G","I","DA","DG","DI","APN","GPN"]),oF=new Set(["C","T","U","DC","DT","DU","CPN","TPN"]),sF=mN.unionMany(rF,nF,iF),uF=mN.unionMany(eF,sF);function cF(e,t){return t=t.toUpperCase(),iF.has(t)?8:VN.has(e)?5:qN.has(e)?6:HN.has(e)?7:WN.has(e)?9:ZN.has(t)?2:EN.has(t)?3:PN.has(t)?4:XN.has(e)?CN.has(t)?9:eF.has(t)?5:rF.has(t)?6:nF.has(t)?7:1:0}function lF(e,t){return 5===t?UN.has(e)?2:jN.has(e)?3:+!zN.has(e):6===t?4:7===t?5:8===t?6:0}function dF(e){return e=e.toUpperCase(),eF.has(e)?"peptide linking":rF.has(e)?"rna linking":nF.has(e)?"dna linking":CN.has(e)?"saccharide":"other"}function fF(e){return e=e.toUpperCase(),ZN.has(e)?"water":uF.has(e)?"polymer":CN.has(e)?"branched":"non-polymer"}function hF(e,t){return e=e.toUpperCase(),$N.has(t)?"polypeptide(L)":LN.has(t)?"polypeptide(D)":qN.has(t)?"polyribonucleotide":HN.has(t)?"polydeoxyribonucleotide":WN.has(t)||CN.has(e)?"oligosaccharide":iF.has(e)?"peptide nucleic acid":QN.has(e)?"polypeptide(L)":JN.has(e)?"polypeptide(D)":rF.has(e)?"polyribonucleotide":nF.has(e)?"polydeoxyribonucleotide":YN.has(t)||EN.has(e)?"ion":KN.has(t)||PN.has(e)?"lipid":GN.has(t)?"peptide-like":"other"}function pF(e){return mF(e)||gF(e)}function mF(e){return 7===e||6===e||8===e}function gF(e){return 5===e}(function(e){e.is=Sd.has,e.create=Sd.create,e.SecondaryStructureMmcif={helx_lh_27_p:1058,helx_lh_3t_p:2082,helx_lh_al_p:4130,helx_lh_a_n:524321,helx_lh_b_n:1048609,helx_lh_ga_p:8226,helx_lh_n:33,helx_lh_om_p:16418,helx_lh_ot_n:131105,helx_lh_ot_p:546,helx_lh_p:34,helx_lh_pi_p:32802,helx_lh_pp_p:65570,helx_lh_z_n:262177,helx_n:1,helx_ot_n:1,helx_ot_p:2,helx_p:2,helx_rh_27_p:1090,helx_rh_3t_p:2114,helx_rh_al_p:4162,helx_rh_a_n:524353,helx_rh_b_n:1048641,helx_rh_ga_p:8258,helx_rh_n:65,helx_rh_om_p:16450,helx_rh_ot_n:131137,helx_rh_ot_p:578,helx_rh_p:66,helx_rh_pi_p:32834,helx_rh_pp_p:65602,helx_rh_z_n:262209,strn:4194308,turn_ot_p:33554448,turn_p:16,turn_ty1p_p:67109136,turn_ty1_p:67109008,turn_ty2p_p:134218e3,turn_ty2_p:134217872,turn_ty3p_p:268435728,turn_ty3_p:268435600,bend:8,other:0},e.SecondaryStructurePdb={1:4162,2:16450,3:32834,4:8258,5:2114,6:4130,7:16418,8:8226,9:1026,10:65538},e.SecondaryStructureStride={H:4098,G:2050,I:32770,E:8388612,B:4194308,T:16,C:536870912},e.SecondaryStructureDssp={H:4098,B:4194308,E:8388612,G:2050,I:32770,T:16,S:8}})(ON||={}),function(e){function t(e){switch(e){case"covalent":return 1;case"metal-coordination":return 2;case"hydrogen-bond":return 4;case"disulfide":return 8;case"aromatic":return 16;case"computed":return 32}}e.is=Sd.has,e.create=function(e){return Sd.create(e)}
139,e.isCovalent=function(e){return!!(1&e)},e.isAll=function(e){return 63===e},e.Names={covalent:1,"metal-coordination":2,"hydrogen-bond":4,disulfide:8,aromatic:16,computed:32},e.isName=function(t){return t in e.Names},e.fromName=t,e.fromNames=function(e){for(var r=0,n=0,i=e.length;n<i;++n)r|=t(e[n]);return r}}(RN||={});var vF={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],HSD:[.17,.11,-.06],HSE:[.17,.11,-.06],HSP:[.96,2.33,1.37],HID:[.17,.11,-.06],HIE:[.17,.11,-.06],HIP:[.96,2.33,1.37]};yA.atom_site.label_comp_id,yA.atom_site.label_seq_id,yA.atom_site.pdbx_PDB_ins_code,yA.atom_site.label_asym_id,yA.atom_site.label_entity_id,yA.atom_site.auth_atom_id,yA.atom_site.auth_seq_id,yA.atom_site.auth_asym_id,Ac(Ac({},yA.chem_comp_bond),{molstar_protonation_variant:xv.Schema.Str()});var yF=Ac(Ac({},yA.chem_comp),{type:xv.Schema.Aliased(xv.Schema.str)});function bF(e,t){var r=t.ihm_model_group,n=t.ihm_model_group_link,i=Sv.pickRow(n,function(t){return n.model_id.value(t)===e});if(i){var a=Sv.pickRow(r,function(e){return r.id.value(e)===i.group_id});if(a)return a.name}return""}function _F(e){for(var t=0,r=e.rowCount;t<r;t++)if(0===e.valueKind(t))return!0;return!1}function xF(e,t,r){e[t].isDefined&&_F(e[t])||(e[t]=e[r]),e[r].isDefined&&_F(e[r])||(e[r]=e[t])}var SF={entry:yA.entry,struct:yA.struct,struct_asym:yA.struct_asym,ihm_model_list:yA.ihm_model_list,ihm_model_group:yA.ihm_model_group,ihm_model_group_link:yA.ihm_model_group_link,entity:yA.entity,entity_poly:yA.entity_poly,entity_poly_seq:yA.entity_poly_seq,pdbx_entity_branch:yA.pdbx_entity_branch,chem_comp:yF,pdbx_chem_comp_identifier:yA.pdbx_chem_comp_identifier,atom_site:yA.atom_site,ihm_sphere_obj_site:yA.ihm_sphere_obj_site,ihm_gaussian_obj_site:yA.ihm_gaussian_obj_site,pdbx_unobs_or_zero_occ_residues:yA.pdbx_unobs_or_zero_occ_residues,pdbx_molecule:yA.pdbx_molecule};function wF(e,t){void 0===t&&(t=!1);for(var r=Object.create(null),n=0,i=Object.keys(SF);n<i.length;n++){var a=i[n];r[a]=a in e?e[a]:Sv.ofUndefinedColumns(SF[a],0)}return t&&(r.atom_site=function(e){var t=Sv.ofColumns(e._schema,e);return xF(t,"label_atom_id","auth_atom_id"),xF(t,"label_comp_id","auth_comp_id"),xF(t,"label_seq_id","auth_seq_id"),xF(t,"label_asym_id","auth_asym_id"),t}(r.atom_site)),r}var AF=[new Set(["CA"]),new Set(["C"]),new Set(["N"])],CF=[new Set(["P","O3'","O3*"]),new Set(["C4'","C4*"]),new Set(["O2'","O2*","F2'","F2*"])],TF=[new Set(["P","O3'","O3*"]),new Set(["C3'","C3*"]),new Set(["O2'","O2*","F2'","F2*"])],PF=new Set(["FMN","NCN","FNS","FMA","ATP","ADP","AMP","GTP","GDP","GMP","LIG"]),EF=function(){var e=new Map;return[{id:"HIS",name:"HISTIDINE",type:"l-peptide linking"},{id:"ARG",name:"ARGININE",type:"l-peptide linking"},{id:"LYS",name:"LYSINE",type:"l-peptide linking"},{id:"ILE",name:"ISOLEUCINE",type:"l-peptide linking"},{id:"PHE",name:"PHENYLALANINE",type:"l-peptide linking"},{id:"LEU",name:"LEUCINE",type:"l-peptide linking"},{id:"TRP",name:"TRYPTOPHAN",type:"l-peptide linking"},{id:"ALA",name:"ALANINE",type:"l-peptide linking"},{id:"MET",name:"METHIONINE",type:"l-peptide linking"},{id:"CYS",name:"CYSTEINE",type:"l-peptide linking"},{id:"ASN",name:"ASPARAGINE",type:"l-peptide linking"},{id:"VAL",name:"VALINE",type:"l-peptide linking"},{id:"GLY",name:"GLYCINE",type:"peptide linking"},{id:"SER",name:"SERINE",type:"l-peptide linking"},{id:"GLN",name:"GLUTAMINE",type:"l-peptide linking"},{id:"TYR",name:"TYROSINE",type:"l-peptide linking"},{id:"ASP",name:"ASPARTIC ACID",type:"l-peptide linking"},{id:"GLU",name:"GLUTAMIC ACID",type:"l-peptide linking"},{id:"THR",name:"THREONINE",type:"l-peptide linking"},{id:"PRO",name:"PROLINE",type:"l-peptide linking"},{id:"SEC",name:"SELENOCYSTEINE",type:"l-peptide linking"},{id:"PYL",name:"PYRROLYSINE",type:"l-peptide linking"},{id:"MSE",name:"SELENOMETHIONINE",type:"l-peptide linking"},{id:"SEP",name:"PHOSPHOSERINE",type:"l-peptide linking"},{id:"TPO",name:"PHOSPHOTHREONINE",type:"l-peptide linking"},{id:"PTR",name:"O-PHOSPHOTYROSINE",type:"l-peptide linking"},{id:"PCA",name:"PYROGLUTAMIC ACID",type:"l-peptide linking"},{id:"A",name:"ADENOSINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"C",name:"CYTIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"T",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"G",name:"GUANOSINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"I",name:"INOSINIC ACID",type:"rna linking"},{id:"U",name:"URIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"DA",name:"2'-DEOXYADENOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DC",name:"2'-DEOXYCYTIDINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DT",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DG",name:"2'-DEOXYGUANOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DI",name:"2'-DEOXYINOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DU",name:"2'-DEOXYURIDINE-5'-MONOPHOSPHATE",type:"dna linking"}
139].forEach(function(t){return e.set(t.id,t)}),e}(),MF=function(){var e=new Map;return[{id:"ZN2",name:"ZINC ION",type:"ion"},{id:"SOD",name:"SODIUM ION",type:"ion"},{id:"CES",name:"CESIUM ION",type:"ion"},{id:"CLA",name:"CHLORIDE ION",type:"ion"},{id:"CAL",name:"CALCIUM ION",type:"ion"},{id:"POT",name:"POTASSIUM ION",type:"ion"}].forEach(function(t){return e.set(t.id,t)}),e}(),kF=function(){function e(e,t){this.seqId=e,this.atomId=t,this.namesMap=new Map,this.comps=new Map,this.ids=[],this.names=[],this.types=[],this.mon_nstd_flags=[]}return e.prototype.set=function(e){this.comps.set(e.id,e),this.ids.push(e.id),this.names.push(e.name),this.types.push(e.type),this.mon_nstd_flags.push(uF.has(e.id)?"y":"n")},e.prototype.getAtomIds=function(e){for(var t=new Set,r=this.seqId.value(e);e<this.seqId.rowCount&&this.seqId.value(e)===r;)t.add(this.atomId.value(e)),e+=1;return t},e.prototype.hasAtomIds=function(e,t){for(var r=0,n=t.length;r<n;++r)if(!mN.areIntersecting(e,t[r]))return!1;return!0},e.prototype.getType=function(e){return this.hasAtomIds(e,AF)?"peptide linking":this.hasAtomIds(e,CF)?"rna linking":this.hasAtomIds(e,TF)?"dna linking":"other"},e.prototype.has=function(e){return this.comps.has(e)},e.prototype.get=function(e){return this.comps.get(e)},e.prototype.add=function(e,t){if(!this.has(e))if(EF.has(e))this.set(EF.get(e));else if(ZN.has(e))this.set({id:e,name:"WATER",type:"non-polymer"});else if(PF.has(e.toUpperCase()))this.set({id:e,name:this.namesMap.get(e)||e,type:"non-polymer"});else if(CN.has(e.toUpperCase()))this.set({id:e,name:this.namesMap.get(e)||e,type:"saccharide"});else{var r=this.getAtomIds(t);if(1===r.size&&MF.has(e))this.set(MF.get(e));else{var n=this.getType(r);this.set({id:e,name:this.namesMap.get(e)||e,type:n})}}return this.get(e)},e.prototype.getChemCompTable=function(){return Sv.ofPartialColumns(SF.chem_comp,{id:xv.ofStringArray(this.ids),name:xv.ofStringArray(this.names),type:xv.ofStringAliasArray(this.types),mon_nstd_flag:xv.ofStringAliasArray(this.mon_nstd_flags)},this.ids.length)},e.prototype.setNames=function(e){var t=this;e.forEach(function(e){return t.namesMap.set(e[0],e[1])})},e}();function IF(e){var t=new Map;return function(r){if(t.has(r))return t.get(r);var n=e(r);return t.set(r,n),n}}var DF,OF="ABCDEFGHIJKLMNOPQRSTUVWXYZ",RF=IF(function(e){for(var t=e,r=0,n=OF[t%26];t>=26;)t=Math.floor(t/26),n+=OF[t%26],r+=1;return r>=5&&console.warn("getChainId overflow"),n}),BF=function(){function e(){this.count=0,this.ids=[],this.types=[],this.descriptions=[],this.compoundsMap=new Map,this.namesMap=new Map,this.heteroMap=new Map,this.chainMap=new Map}return e.prototype.set=function(e,t){this.count+=1,this.ids.push(`${this.count}`),this.types.push(e),this.descriptions.push([t])},e.prototype.getEntityId=function(e,t,r,n){return 2===t?(void 0===this.waterId&&(this.set("water",n?.customName||"Water"),this.waterId=`${this.count}`),this.waterId):pF(t)?this.compoundsMap.has(r)?this.compoundsMap.get(r):(this.chainMap.has(r)||(this.set("polymer",n?.customName||`Polymer ${this.chainMap.size+1}`),this.chainMap.set(r,`${this.count}`)),this.chainMap.get(r)):(this.heteroMap.has(e)||(this.set("non-polymer",n?.customName||this.namesMap.get(e)||e),this.heteroMap.set(e,`${this.count}`)),this.heteroMap.get(e))},e.prototype.getEntityTable=function(){return Sv.ofPartialColumns(SF.entity,{id:xv.ofStringArray(this.ids),type:xv.ofStringAliasArray(this.types),pdbx_description:xv.ofStringListArray(this.descriptions)},this.count)},e.prototype.setCompounds=function(e){for(var t=0,r=e.length;t<r;++t){var n=e[t],i=n.chains,a=n.description;this.set("polymer",a);for(var o=0,s=i.length;o<s;++o)this.compoundsMap.set(i[o],`${this.count}`)}},e.prototype.setNames=function(e){var t=this;e.forEach(function(e){return t.namesMap.set(e[0],e[1])})},e}();function NF(e,t,r,n,i){for(var a=e.b,o=e.offset,s=[],u=0,c=t.length;u<c;++u)for(var l=t[u],d=o[l],f=o[l+1];d<f;++d){var h=a[d];if(!i.has(h)){if(PP.has(r,h))return!0;i.add(h),s[s.length]=h}}return n>1&&NF(e,s,r,n-1,i)}!function(e){e.areEqual=function(e,t){if(e===t)return!0;if(e.vertexCount!==t.vertexCount||e.edgeCount!==t.edgeCount)return!1;for(var r=e.a,n=e.b,i=e.offset,a=t.a,o=t.b,s=t.offset,u=0,c=e.a.length;u<c;u++)if(r[u]!==a[u])return!1;for(u=0,c=e.b.length;u<c;u++)if(n[u]!==o[u])return!1;for(u=0,c=e.offset.length;u<c;u++)if(i[u]!==s[u])return!1;for(var l=0,d=Object.keys(e.edgeProps);l<d.length;l++){var f=d[l],h=e.edgeProps[f],p=t.edgeProps[f];if(!p)return!1;for(u=0,c=h.length;u<c;u++)if(h[u]!==p[u])return!1}return!0};var t=function(){function e(e,t,r,n,i,a){this.offset=e,this.a=t,this.b=r,this.edgeCount=n,this.props=a,this.vertexCount=e.length-1,this.edgeProps=i||{}}return e.prototype.getEdgeIndex=function(e,t){var r,n;e<t?(r=e,n=t):(r=t,n=e);for(var i=this.offset[r],a=this.offset[r+1];i<a;i++)if(this.b[i]===n)return i;return-1},e.prototype.getDirectedEdgeIndex=function(e,t){for(var r=this.offset[e],n=this.offset[e+1];r<n;r++)if(this.b[r]===t)return r;return-1},e.prototype.getVertexEdgeCount=function(e){return this.offset[e+1]-this.offset[e]},e}();function r(e,r,n,i,a,o){return new t(e,r,n,i,a,o)}e.create=r;var n=function(){function e(e,t,r){this.vertexCount=e,this.xs=t,this.ys=r,this.current=0,this.curA=0,this.curB=0,this.edgeCount=t.length,this.offsets=new Int32Array(this.vertexCount+1),this.bucketFill=new Int32Array(this.vertexCount);for(var n=new Int32Array(this.vertexCount),i=0,a=this.xs.length;i<a;i++)n[this.xs[i]]++;for(i=0,a=this.ys.length;i<a;i++)n[this.ys[i]]++;var o=0;for(i=0;i<this.vertexCount;i++)this.offsets[i]=o,o+=n[i];this.offsets[this.vertexCount]=o,this.slotCount=o,this.a=new Int32Array(o),this.b=new Int32Array(o)}return e.prototype.createGraph=function(e,t){return r(this.offsets,this.a,this.b,this.edgeCount,e,t)},e.prototype.addNextEdge=function(){var e=this.xs[this.current],t=this.ys[this.current],r=this.offsets[e]+this.bucketFill[e];this.a[r]=e,this.b[r]=t,this.bucketFill[e]++;var n=this.offsets[t]+this.bucketFill[t];this.a[n]=t,this.b[n]=e,this.bucketFill[t]++,this.current++,this.curA=r,this.curB=n},e.prototype.addAllEdges=function(){for(var e=0;e<this.edgeCount;e++)this.addNextEdge()},e.prototype.assignProperty=function(e,t){e[this.curA]=t,e[this.curB]=t},e.prototype.assignDirectedProperty=function(e,t,r,n){e[this.curA]=t,e[this.curB]=n,r[this.curB]=t,r[this.curA]=n},e}();e.EdgeBuilder=n,e.DirectedEdgeBuilder=function(){function e(e,t,r){this.vertexCount=e,this.xs=t,this.ys=r,this.current=0,this.curA=0,this.edgeCount=t.length,this.offsets=new Int32Array(this.vertexCount+1),this.bucketFill=new Int32Array(this.vertexCount);for(var n=new Int32Array(this.vertexCount),i=0,a=this.xs.length;i<a;i++)n[this.xs[i]]++;var o=0;for(i=0;i<this.vertexCount;i++)this.offsets[i]=o,o+=n[i];this.offsets[this.vertexCount]=o,this.slotCount=o,this.a=new Int32Array(o),this.b=new Int32Array(o)}return e.prototype.createGraph=function(e,t){return r(this.offsets,this.a,this.b,this.edgeCount,e,t)},e.prototype.addNextEdge=function(){var e=this.xs[this.current],t=this.ys[this.current],r=this.offsets[e]+this.bucketFill[e];this.a[r]=e,this.b[r]=t,this.bucketFill[e]++,this.current++,this.curA=r},e.prototype.addAllEdges=function(){for(var e=0;e<this.edgeCount;e++)this.addNextEdge()},e.prototype.assignProperty=function(e,t){e[this.curA]=t},e}();var i=function(){function e(e){this.vertexCount=e,this.xs=[],this.ys=[],this.included=new Set}return e.prototype.addEdge=function(e,t){var r=e,n=t;e>t&&(r=t,n=e);var i=Ev(r,n);return!this.included.has(i)&&(this.included.add(i),this.xs[this.xs.length]=r,this.ys[this.ys.length]=n,!0)},e.prototype.getGraph=function(){return a(this.vertexCount,this.xs,this.ys)},e.prototype.getEdgeBuiler=function(){return new n(this.vertexCount,this.xs,this.ys)},e}();function a(t,r,n){var i=new e.EdgeBuilder(t,r,n);return i.addAllEdges(),i.createGraph({})}e.UniqueEdgeBuilder=i,e.fromVertexPairs=a,e.induceByVertices=function(e,t,n){for(var i=e.b,a=e.offset,o=e.vertexCount,s=e.edgeProps,u=new Int32Array(o),c=0,l=t.length;c<l;c++)u[t[c]]=c+1;var d=0;for(c=0;c<o;c++)if(0!==u[c])for(var f=a[c],h=a[c+1];f<h;f++)i[f]>c&&0!==u[i[f]]&&d++;var p=new Int32Array(t.length+1),m=new Int32Array(2*d),g=new Int32Array(2*d),v=new Int32Array(2*d),y=0,b=0;for(c=0;c<o;c++)if(0!==u[c]){var _=u[c]-1;for(f=a[c],h=a[c+1];f<h;f++){var x=u[i[f]];0!==x&&(g[y]=_,v[y]=x-1,m[y]=f,y++)}p[++b]=y}for(var S={},w=0,A=Object.keys(s);w<A.length;w++){var C=A[w];S[C]=Wv(s[C],m)}return r(p,g,v,d,S,n)},e.connectedComponents=function(e){var t=e.vertexCount;if(0===t)return{componentCount:0,componentIndex:new Int32Array};if(0===e.edgeCount){for(var r=new Int32Array(t),n=0,i=t;n<i;n++)r[n]=n;return{componentCount:t,componentIndex:r}}var a=new Int32Array(t);for(n=0,i=t;n<i;n++)a[n]=-1;var o=0;a[0]=o;var s=e.offset,u=e.b,c=[0],l=function(e){return new gE(e)}(t);for(l.remove(0);c.length>0;){for(var d=c.pop(),f=a[d],h=s[d],p=s[d+1];h<p;h++){var m=u[h];l.has(m)&&(l.remove(m),c.push(m),a[m]=f)}0===c.length&&l.head>=0&&(c.push(l.head),a[l.head]=++o,l.remove(l.head))}return{componentCount:t,componentIndex:a}},e.areVertexSetsConnected=function(e,t,r,n){if(PP.areIntersecting(t,r))return!0;
139if(n<1)return!1;for(var i=new Set,a=0,o=t.length;a<o;++a)i.add(t[a]);return NF(e,t,r,n,i)}}(DF||={});var FF,LF,$F=function(){function e(){this.map=new Map,this.applicable=new Map}return e.prototype.add=function(e,t,r){this.map.set(e,t),r&&this.applicable.set(e,r)},e.prototype.remove=function(e){this.map.delete(e),this.applicable.delete(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.isApplicable=function(e){if(!this.map.has(e.sourceData.kind))return!1;var t=this.applicable.get(e.sourceData.kind);return!t||t(e)},e}();function UF(e,t,r,n){for(var i=new DF.EdgeBuilder(n,e,t),a=new Int32Array(i.slotCount),o=Array(i.slotCount),s=Array(i.slotCount),u=new Int8Array(i.slotCount),c=Array(i.slotCount),l=Array(i.slotCount),d=0,f=i.edgeCount;d<f;d++)i.addNextEdge(),i.assignProperty(a,r.key?r.key[d]:-1),i.assignDirectedProperty(o,r.operatorA?r.operatorA[d]:-1,s,r.operatorB?r.operatorB[d]:-1),i.assignProperty(u,r.order?r.order[d]:1),i.assignProperty(c,r.distance?r.distance[d]:-1),i.assignProperty(l,r.flag?r.flag[d]:1);return i.createGraph({key:a,operatorA:o,operatorB:s,order:u,distance:c,flag:l})}(function(e){e.create=function(e,t){var r=e.name,n=new $F;return{descriptor:e,formatRegistry:n,isApplicable:function(e){return n.isApplicable(e)},get:function(i){var a=t?.asDynamic?i._dynamicPropertyData:i._staticPropertyData;if(a[r])return a[r];if(!i.customProperties.has(e)){var o=n.get(i.sourceData.kind);if(o)return a[r]=o(i),i.customProperties.add(e),a[r]}},set:function(e,n){t?.asDynamic?e._dynamicPropertyData[r]=n:e._staticPropertyData[r]=n},delete:function(e){t?.asDynamic?delete e._dynamicPropertyData[r]:delete e._staticPropertyData[r]}}}})(FF||={}),function(e){e.Descriptor={name:"index_pair_bonds"},e.Provider=FF.create(e.Descriptor,{asDynamic:!0}),e.DefaultProps={maxDistance:-1},e.fromData=function(t,r){void 0===r&&(r={});var n=Ac(Ac({},e.DefaultProps),r),i=t.pairs,a=t.count;return{bonds:UF(i.indexA.toArray(),i.indexB.toArray(),{key:i.key&&i.key.toArray(),operatorA:i.operatorA&&i.operatorA.toArray(),operatorB:i.operatorB&&i.operatorB.toArray(),order:i.order&&i.order.toArray(),distance:i.distance&&i.distance.toArray(),flag:i.flag&&i.flag.toArray()},a),maxDistance:n.maxDistance}},e.getEdgeIndexForOperators=function(e,t,r,n,i){var a,o,s,u;t<r?(a=t,o=r,s=n,u=i):(a=r,o=t,s=i,u=n);for(var c=e.offset[a],l=e.offset[a+1];c<l;c++)if(e.b[c]===o&&e.edgeProps.operatorA[c]===s&&e.edgeProps.operatorB[c]===u)return c;return-1}}(LF||={});var jF,zF,GF=function(){function e(e,t,r){this.operatorsProvider=r,this.id=e,this.details=t}return Object.defineProperty(e.prototype,"operatorGroups",{get:function(){return this._operators||=this.operatorsProvider(),this._operators},enumerable:!1,configurable:!0}),e}();(function(e){e.create=function(t,r,n){return new e(t,r,n)}})(GF||={}),function(e){e.Default={assemblies:[],spacegroup:$E.ZeroP1,isNonStandardCrystalFrame:!1},e.findAssembly=function(e,t){var r=t.toLocaleLowerCase(),n=Dz.Provider.get(e);return n?Vv(n.assemblies,function(e){return e.id.toLowerCase()===r}):void 0},e.getUnitcellLabel=function(e){var t=e.spacegroup,r=t.cell,n=t.name,i=t.num,a=r.size,o=r.anglesInRadians,s=a[0].toFixed(2),u=a[1].toFixed(2),c=a[2].toFixed(2),l=kg(o[0]).toFixed(2),d=kg(o[1]).toFixed(2),f=kg(o[2]).toFixed(2),h=[];return h.push(`Unit Cell <b>${n}</b> #${i}`),h.push(`${s}×${u}×${c} Å`),h.push(`α=${l}° β=${d}° γ=${f}°`),h.join(" | ")}}(jF||={}),function(e){e.create=function(e,t,r,n){return{id:Wd.create22(),label:e,basic:t,sourceData:n,bonds:r}}}(zF||={});var VF,HF,qF,WF,XF,YF,KF,ZF={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",SEC:"U",PYL:"O",HSD:"H",HSE:"H",HSP:"H",LSN:"K",ASPP:"D",GLUP:"E",HID:"H",HIE:"H",HIP:"H",LYN:"K",ASH:"D",GLH:"E"},QF={DA:"A",DC:"C",DG:"G",DT:"T",DU:"U"},JF={A:"A",C:"C",G:"G",T:"T",U:"U"};function eL(e){return ZF[e]||"X"}function tL(e){return JF[e]||"X"}function rL(e){return QF[e]||"X"}function nL(e,t){var r=t||{},n=r.description,i=void 0===n?void 0:n,a=r.isOptional,o=void 0!==a&&a,s=r.isRest,u=void 0!==s&&s,c=r.defaultValue;return{type:e,isOptional:o,isRest:u,defaultValue:void 0===c?void 0:c,description:i}}function iL(e,t,r,n){var i=function(e){return XF.Apply(XF.Symbol(i.id),e)};return i.info={namespace:"",name:e,description:n},i.id="",i.args=t,i.type=r,i}function aL(e,t,r,n){var i=function(e){return XF.Apply(XF.Symbol(i.id),e)};return i.info={namespace:e,name:t,description:n},i.id=`${e}.${t}`,i.args=YF.None,i.type=r,i}function oL(e){var t=e;return"function"==typeof t&&!!t.info&&!!t.args&&"string"==typeof t.info.namespace&&!!t.type}function sL(e,t,r){return iL("",e,t,r)}function uL(e){dL("","",e)}function cL(e){var t=[];return fL(e,t),t}function lL(e){var t=/([a-z])([A-Z])([a-z]|$)/g;return e.replace(t,function(e,t,r,n){return`${t}-${r.toLocaleLowerCase()}${n}`}).replace(t,function(e,t,r,n){return`${t}-${r.toLocaleLowerCase()}${n}`})}function dL(e,t,r){if(oL(r))return r.info.namespace=e,r.info.name=r.info.name||lL(t),void(r.id=`${r.info.namespace}.${r.info.name}`);for(var n=`${r["@namespace"]||lL(t)}`,i=e?`${e}.${n}`:n,a=0,o=Object.keys(r);a<o.length;a++){var s=o[a];("object"==typeof r[s]||oL(r[s]))&&dL(i,s,r[s])}}function fL(e,t){if(oL(e))t.push(e);else for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];("object"==typeof e[i]||oL(e[i]))&&fL(e[i],t)}}function hL(e,t){return sL(YF.Dictionary({0:nL(e)}),e,t)}function pL(e,t){return sL(YF.List(e,{nonEmpty:!0}),e,t)}function mL(e,t,r){return sL(YF.Dictionary({0:nL(e),1:nL(e)}),t,r)}(function(e){var t;(function(e){e.Protein="protein",e.RNA="RNA",e.DNA="DNA",e.Generic="generic"})(t=e.Kind||={}),e.getSequenceString=function(e){var t=e.code.toArray();return(t instanceof Array?t:Array.from(t)).join("")},e.ofResidueNames=function(e,n){if(0===n.rowCount)throw Error("cannot be empty");return new r(function(e){for(var r=0,n=Math.min(e.rowCount,10);r<n;r++){var i=e.value(r)||"";if("X"!==eL(i))return t.Protein;if("X"!==tL(i))return t.RNA;if("X"!==rL(i))return t.DNA}return t.Generic}(e),e,n)};var r=function(){function e(e,r,n){this.kind=e,this.microHet=new Map;for(var i=function(e){var r;switch(e){case t.Protein:r=eL;break;case t.DNA:r=rL;break;case t.RNA:r=tL;break;case t.Generic:r=function(){return"X"};break;default:Lg()}return r}(e),a=[],o=[],s=[],u=new Map,c=0,l=new Map,d=0,f=n.rowCount;d<f;++d){var h=n.value(d);if(l.has(h))u.has(h)?u.get(h).push(r.value(d)):u.set(h,[o[l.get(h)],r.value(d)]);else{l.set(h,c);var p=r.value(d);o[c]=p,s[c]=h,a[c]=i(p),c+=1}}var m=[];for(d=0,f=c;d<f;++d){var g=u.get(s[d]);m[d]=g?`(${g.map(function(e){var t=i(e);return"X"===t?e:t}).join("|")})`:"X"===a[d]?o[d]:a[d]}this.length=c,this.code=xv.ofStringArray(a),this.compId=xv.ofStringArray(o),this.seqId=xv.ofIntArray(s),this.label=xv.ofStringArray(m),this.microHet=u,this.indexMap=l}return e.prototype.index=function(e){return this.indexMap.get(e)},e}();e.ofSequenceRanges=function(e,r){var i=t.Generic;return new n(i,e,r)};var n=function(){function e(e,t,r){this.kind=e,this.seqIdStart=t,this.seqIdEnd=r,this.microHet=new Map;for(var n=0,i=2**53-1,a=0,o=this.seqIdStart.rowCount;a<o;a++){var s=this.seqIdStart.value(a),u=this.seqIdEnd.value(a);s<i&&(i=s),n<u&&(n=u)}var c=n-i+1;
139this.code=xv.ofConst("X",c,xv.Schema.str),this.label=xv.ofConst("",c,xv.Schema.str),this.seqId=xv.ofLambda({value:function(e){return e+i+1},rowCount:c,schema:xv.Schema.int}),this.compId=xv.ofConst("",c,xv.Schema.str),this.length=c,this.minSeqId=i}return e.prototype.index=function(e){return e-this.minSeqId},e}()})(VF||={}),function(e){var t={byEntityKey:{},sequences:[]};function r(){for(var e=[...arguments],t=[],r={},n=0,i=e.length;n<i;++n)t.push.apply(t,e[n].sequences),Object.assign(r,e[n].byEntityKey);return{sequences:t,byEntityKey:r}}function n(e,t){var r=t.atoms.label_comp_id,n=t.residues.label_seq_id,i=t.chainAtomSegments,a=t.residueAtomSegments,o=i.count,s=i.offsets,u={},c=[];if(1===o&&0===s[0]&&0===s[1])return{byEntityKey:u,sequences:c};for(var l=0,d=t.chains._rowCount;l<d;l++){var f=t.index.getEntityFromChain(l);if(void 0===u[f]&&"polymer"===e.data.type.value(f)){var h=l;for(l++;l<d&&f===t.index.getEntityFromChain(l)&&"polymer"!==e.data.type.value(f);)l++;l--;for(var p=a.index[s[h]],m=a.index[s[l+1]-1]+1,g=xv.window(n,p,m),v=[],y=p;y<m;++y)v.push(r.value(a.offsets[y]));var b=xv.ofStringArray(v);u[f]={entityId:e.data.id.value(f),sequence:VF.ofResidueNames(b,g)},c.push(u[f])}}return{byEntityKey:u,sequences:c}}function i(e,t){return r(a(e,t.spheres),a(e,t.gaussians))}function a(e,t){var r=t.chainElementSegments,n=t.seq_id_begin,i=t.seq_id_end,a=r.count,o=r.offsets,s={},u=[];if(1===a&&0===o[0]&&0===o[1])return{byEntityKey:s,sequences:u};for(var c=0,l=a;c<l;c++){var d=t.getEntityFromChain(c);if(void 0===s[d]){var f=c;for(c++;c<l&&d===t.getEntityFromChain(c);)c++;c--;var h=o[f],p=o[c+1]-1,m=xv.window(n,h,p),g=xv.window(i,h,p);s[d]={entityId:e.data.id.value(d),sequence:VF.ofSequenceRanges(m,g)},u.push(s[d])}}return{byEntityKey:s,sequences:u}}e.fromHierarchy=function(e,a,o){return r(n(e,a),o.isDefined?i(e,o):t)},e.fromAtomicHierarchy=n,e.fromCoarseHierarchy=i,e.fromCoarseElements=a}(HF||={}),function(e){function t(e,t,r){return{kind:"element-location",structure:e,unit:t,element:r||0}}e.create=t,e.clone=function(e){return t(e.structure,e.unit,e.element)},e.set=function(e,t,r,n){return t&&(e.structure=t),r&&(e.unit=r),void 0!==n&&(e.element=n),e},e.copy=function(e,t){return e.unit=t.unit,e.element=t.element,e},e.is=function(e){return!!e&&"element-location"===e.kind},e.areEqual=function(e,t){return e.unit===t.unit&&e.element===t.element};var r=Cg(),n=Cg();e.distance=function(e,t){return e.unit.conformation.position(e.element,r),t.unit.conformation.position(t.element,n),Cg.distance(r,n)},e.position=function(e,t){return t.unit.conformation.position(t.element,e)},e.residueIndex=function(e){return e.unit.model.atomicHierarchy.residueAtomSegments.index[e.element]},e.chainIndex=function(e){return e.unit.model.atomicHierarchy.chainAtomSegments.index[e.element]}}(qF||={}),function(e){function t(e,t,r){return{kind:"value",namespace:e,name:t,parent:r}}function r(e,t,r,n){for(var i=Object.create(null),a=0,o=n;a<o.length;a++)i[o[a]]=!0;return{kind:"oneof",namespace:e,name:t,type:r,values:i}}e.Variable=function(e,t,r){return{kind:"variable",name:e,type:t,isConstraint:r}},e.Value=t,e.Container=function(e,t,r,n){return{kind:"container",namespace:e,name:t,child:r,alias:n}},e.Union=function(e){return{kind:"union",types:e}},e.OneOf=r,e.Any={kind:"any"},e.AnyValue={kind:"any-value"},e.Num=t("","Number"),e.Str=t("","String"),e.Bool=r("","Bool",e.Str,["true","false"]),e.oneOfValues=function(e){var t=e.values;return Object.keys(t).sort()}}(WF||={}),function(e){function t(e){return!!e&&!!e.head&&"object"==typeof e}function r(e){return!!e&&"string"==typeof e.name}e.Symbol=function(e){return{name:e}},e.Apply=function(e,t){return t?{head:e,args:t}:{head:e}},e.isArgumentsArray=function(e){return!!e&&Array.isArray(e)},e.isArgumentsMap=function(e){return!!e&&!Array.isArray(e)},e.isLiteral=function(e){return!t(e)&&!r(e)},e.isApply=t,e.isSymbol=r}(XF||={}),function(e){function t(e){return{kind:"dictionary",map:e,"@type":0}}e.None=t({}),e.Dictionary=t,e.List=function(e,t){var r=(t||{}).nonEmpty;return{kind:"list",type:e,nonEmpty:void 0!==r&&r,"@type":0}}}(YF||={}),function(e){e.AnyVar=WF.Variable("a",WF.Any),e.AnyValueVar=WF.Variable("a",WF.Any),e.ConstrainedVar=WF.Variable("a",WF.Any,!0),e.Regex=WF.Value("Core","Regex"),e.Set=function(t){return WF.Container("Core","Set",t||e.AnyValueVar)},e.List=function(t){return WF.Container("Core","List",t||e.AnyVar)},e.Fn=function(t,r){return WF.Container("Core","Fn",t||e.AnyVar,r)},e.Flags=function(e,t){return WF.Container("Core","Flags",e,t)},e.BitFlags=e.Flags(WF.Num,"BitFlags")}(KF||={}),YF.Dictionary({0:nL(WF.Num),1:nL(WF.Num)});var gL={"@header":"Language Primitives",type:{"@header":"Types",bool:sL(YF.Dictionary({0:nL(WF.AnyValue)}),WF.Bool,"Convert a value to boolean."),num:sL(YF.Dictionary({0:nL(WF.AnyValue)}),WF.Num,"Convert a value to number."),str:sL(YF.Dictionary({0:nL(WF.AnyValue)}),WF.Str,"Convert a value to string."),regex:sL(YF.Dictionary({0:nL(WF.Str,{description:"Expression"}),1:nL(WF.Str,{isOptional:!0,description:"Flags, e.g. 'i' for ignore case"})}),KF.Regex,"Creates a regular expression from a string using the ECMAscript syntax."),list:sL(YF.List(KF.AnyVar),KF.List()),set:sL(YF.List(KF.AnyValueVar),KF.Set()),bitflags:sL(YF.Dictionary({0:nL(WF.Num)}),KF.BitFlags,"Interpret a number as bitflags."),compositeKey:sL(YF.List(WF.AnyValue),WF.AnyValue)},logic:{"@header":"Logic",not:hL(WF.Bool),and:pL(WF.Bool),or:pL(WF.Bool)},ctrl:{"@header":"Control",eval:sL(YF.Dictionary({0:nL(KF.Fn(KF.AnyVar))}),KF.AnyVar,"Evaluate a function."),fn:sL(YF.Dictionary({0:nL(KF.AnyVar)}),KF.Fn(KF.AnyVar),'Wrap an expression to a "lazy" function.'),if:sL(YF.Dictionary({0:nL(WF.Bool,{description:"Condition"}),1:nL(WF.Variable("a",WF.Any),{description:"If true"}),2:nL(WF.Variable("b",WF.Any),{description:"If false"})}),WF.Union([WF.Variable("a",WF.Any),WF.Variable("b",WF.Any)])),assoc:sL(YF.Dictionary({0:nL(WF.Str,{description:"Name"}),1:nL(WF.Variable("a",WF.Any),{description:"Value to assign"})}),WF.Variable("a",WF.Any))},rel:{"@header":"Relational",eq:mL(WF.Variable("a",WF.AnyValue,!0),WF.Bool),neq:mL(WF.Variable("a",WF.AnyValue,!0),WF.Bool),lt:mL(WF.Num,WF.Bool),lte:mL(WF.Num,WF.Bool),gr:mL(WF.Num,WF.Bool),gre:mL(WF.Num,WF.Bool),inRange:sL(YF.Dictionary({0:nL(WF.Num,{description:"Value to test"}),1:nL(WF.Num,{description:"Minimum value"}),2:nL(WF.Num,{description:"Maximum value"})}),WF.Bool,"Check if the value of the 1st argument is >= 2nd and <= 3rd.")},math:{"@header":"Math",add:pL(WF.Num),sub:pL(WF.Num),mult:pL(WF.Num),div:mL(WF.Num,WF.Num),pow:mL(WF.Num,WF.Num),mod:mL(WF.Num,WF.Num),min:pL(WF.Num),max:pL(WF.Num),cantorPairing:mL(WF.Num,WF.Num),sortedCantorPairing:mL(WF.Num,WF.Num),invertCantorPairing:sL(YF.Dictionary({0:nL(WF.Num)}),KF.List(WF.Num)),floor:hL(WF.Num),ceil:hL(WF.Num),roundInt:hL(WF.Num),trunc:hL(WF.Num),abs:hL(WF.Num),sign:hL(WF.Num),sqrt:hL(WF.Num),cbrt:hL(WF.Num),sin:hL(WF.Num),cos:hL(WF.Num),tan:hL(WF.Num),asin:hL(WF.Num),acos:hL(WF.Num),atan:hL(WF.Num),sinh:hL(WF.Num),cosh:hL(WF.Num),tanh:hL(WF.Num),exp:hL(WF.Num),log:hL(WF.Num),log10:hL(WF.Num),atan2:mL(WF.Num,WF.Num)},str:{"@header":"Strings",concat:pL(WF.Str),match:sL(YF.Dictionary({0:nL(KF.Regex),1:nL(WF.Str)}),WF.Bool)}
139,list:{"@header":"Lists",getAt:sL(YF.Dictionary({0:nL(KF.List()),1:nL(WF.Num)}),KF.AnyVar),equal:sL(YF.Dictionary({0:nL(KF.List()),1:nL(KF.List())}),WF.Bool)},set:{"@header":"Sets",has:sL(YF.Dictionary({0:nL(KF.Set(KF.ConstrainedVar)),1:nL(KF.ConstrainedVar)}),WF.Bool,"Check if the the 1st argument includes the value of the 2nd."),isSubset:sL(YF.Dictionary({0:nL(KF.Set(KF.ConstrainedVar)),1:nL(KF.Set(KF.ConstrainedVar))}),WF.Bool,"Check if the the 1st argument is a subset of the 2nd.")},flags:{"@header":"Flags",hasAny:sL(YF.Dictionary({0:nL(KF.Flags(KF.ConstrainedVar)),1:nL(KF.Flags(KF.ConstrainedVar))}),WF.Bool,"Check if the the 1st argument has at least one of the 2nd one's flags."),hasAll:sL(YF.Dictionary({0:nL(KF.Flags(KF.ConstrainedVar)),1:nL(KF.Flags(KF.ConstrainedVar))}),WF.Bool,"Check if the the 1st argument has all 2nd one's flags.")}};uL(gL);var vL,yL=cL(gL);function bL(e,t){return sL(YF.Dictionary({0:nL(vL.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"})}),e,t)}function _L(e,t){return sL(YF.None,e,t)}(function(){for(var e=Object.create(null),t=0,r=yL;t<r.length;t++){var n=r[t];e[n.id]=n}})(),function(e){e.ElementSymbol=WF.Value("Structure","ElementSymbol"),e.AtomName=WF.Value("Structure","AtomName"),e.BondFlag=WF.OneOf("Structure","BondFlag",WF.Str,["covalent","metallic","ion","hydrogen","sulfide","computed","aromatic"]),e.BondFlags=KF.Flags(e.BondFlag,"BondFlags"),e.SecondaryStructureFlag=WF.OneOf("Structure","SecondaryStructureFlag",WF.Str,["alpha","beta","3-10","pi","sheet","strand","helix","turn","none"]),e.SecondaryStructureFlags=KF.Flags(e.SecondaryStructureFlag,"SecondaryStructureFlag"),e.RingFingerprint=WF.Value("Structure","RingFingerprint"),e.EntityType=WF.OneOf("Structure","EntityType",WF.Str,["polymer","non-polymer","water","branched"]),e.EntitySubtype=WF.OneOf("Structure","EntitySubtype",WF.Str,["other","polypeptide(D)","polypeptide(L)","polydeoxyribonucleotide","polyribonucleotide","polydeoxyribonucleotide/polyribonucleotide hybrid","cyclic-pseudo-peptide","peptide nucleic acid","oligosaccharide"]),e.ObjectPrimitive=WF.OneOf("Structure","ObjectPrimitive",WF.Str,["atomistic","sphere","gaussian","other"]),e.ResidueId=WF.Value("Structure","ResidueId"),e.ElementSet=WF.Value("Structure","ElementSet"),e.ElementSelection=WF.Value("Structure","ElementSelection"),e.ElementReference=WF.Value("Structure","ElementReference"),e.ElementSelectionQuery=KF.Fn(e.ElementSelection,"ElementSelectionQuery")}(vL||={});var xL={core:gL,structureQuery:{"@header":"Structure Queries",type:{"@header":"Types",elementSymbol:sL(YF.Dictionary({0:nL(WF.Str)}),vL.ElementSymbol,"Create element symbol representation from a string value."),atomName:sL(YF.Dictionary({0:nL(WF.AnyValue)}),vL.AtomName,"Convert a value to an atom name."),entityType:sL(YF.Dictionary({0:nL(vL.EntityType)}),vL.EntityType,`Create normalized representation of entity type: ${WF.oneOfValues(vL.EntityType).join(", ")}.`),bondFlags:sL(YF.List(vL.BondFlag),vL.BondFlags,`Create bond flags representation from a list of strings. Allowed flags: ${WF.oneOfValues(vL.BondFlag).join(", ")}.`),ringFingerprint:sL(YF.List(vL.ElementSymbol,{nonEmpty:!0}),vL.RingFingerprint,"Create ring fingerprint from the supplied atom element list."),secondaryStructureFlags:sL(YF.List(vL.SecondaryStructureFlag),vL.SecondaryStructureFlags,`Create secondary structure flags representation from a list of strings. Allowed flags: ${WF.oneOfValues(vL.SecondaryStructureFlag).join(", ")}.`),authResidueId:sL(YF.Dictionary({0:nL(WF.Str,{description:"auth_asym_id"}),1:nL(WF.Num,{description:"auth_seq_id"}),2:nL(WF.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),vL.ResidueId,'Residue identifier based on "auth_" annotation.'),labelResidueId:sL(YF.Dictionary({0:nL(WF.Str,{description:"label_entity_id"}),1:nL(WF.Str,{description:"label_asym_id"}),2:nL(WF.Num,{description:"label_seq_id"}),3:nL(WF.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),vL.ResidueId,'Residue identifier based on mmCIF\'s "label_" annotation.')},slot:{"@header":"Iteration Slots",element:sL(YF.None,vL.ElementReference,"A reference to the current element."),elementSetReduce:sL(YF.None,WF.Variable("a",WF.AnyValue,!0),"Current value of the element set reducer.")},generator:{"@header":"Generators",all:sL(YF.None,vL.ElementSelectionQuery,"The entire structure."),atomGroups:sL(YF.Dictionary({"entity-test":nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every entity"}),"chain-test":nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every chain"}),"residue-test":nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom every residue"}),"atom-test":nL(WF.Bool,{isOptional:!0,defaultValue:!0}),"group-by":nL(WF.Any,{isOptional:!0,defaultValue:"atom-key",description:"Group atoms to sets based on this property. Default: each atom has its own set"})}),vL.ElementSelectionQuery,"Return all atoms for which the tests are satisfied, grouped into sets."),bondedAtomicPairs:sL(YF.Dictionary({0:nL(WF.Bool,{isOptional:!0,defaultValue:"true for covalent bonds",description:"Test each bond with this predicate. Each bond is visited twice with swapped atom order."})}),vL.ElementSelectionQuery,"Return all pairs of atoms for which the test is satisfied."),rings:sL(YF.Dictionary({fingerprint:nL(vL.RingFingerprint,{isOptional:!0}),"only-aromatic":nL(WF.Bool,{isOptional:!0,defaultValue:!1})}),vL.ElementSelectionQuery,"Return all rings or those with the specified fingerprint and/or only aromatic rings."),queryInSelection:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),query:nL(vL.ElementSelectionQuery),"in-complement":nL(WF.Bool,{isOptional:!0,defaultValue:!1})}),vL.ElementSelectionQuery,"Executes query only on atoms that are in the source selection."),empty:sL(YF.None,vL.ElementSelectionQuery,"Nada.")},modifier:{"@header":"Selection Modifications",queryEach:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),query:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Query every atom set in the input selection separately."),intersectBy:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),by:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Intersect each atom set from the first sequence from atoms in the second one."),exceptBy:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),by:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Remove all atoms from 'selection' that occur in 'by'."),unionBy:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),by:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"For each atom set A in the orginal sequence, combine all atoms sets in the target selection that intersect with A."),union:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Collects all atom sets in the sequence into a single atom set."),cluster:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),"min-distance":nL(WF.Num,{isOptional:!0,defaultValue:0}),"max-distance":nL(WF.Num),"min-size":nL(WF.Num,{description:"Minimal number of sets to merge, must be at least 2",isOptional:!0,defaultValue:2}),"max-size":nL(WF.Num,{description:"Maximal number of sets to merge, if not set, no limit",isOptional:!0})}),vL.ElementSelectionQuery,"Combines atom sets that have mutual distance in the interval [min-radius, max-radius]. Minimum/maximum size determines how many atom sets can be combined."),includeSurroundings:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),radius:nL(WF.Num),"atom-radius":nL(WF.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),"as-whole-residues":nL(WF.Bool,{isOptional:!0})}),vL.ElementSelectionQuery,"For each atom set in the selection, include all surrouding atoms/residues that are within the specified radius."),surroundingLigands:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),radius:nL(WF.Num),"include-water":nL(WF.Bool,{isOptional:!0,defaultValue:!0})}),vL.ElementSelectionQuery,"Find all ligands components around the source query."),includeConnected:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),"bond-test":nL(WF.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),"layer-count":nL(WF.Num,{isOptional:!0,defaultValue:1,description:"Number of bonded layers to include."}),"fixed-point":nL(WF.Bool,{isOptional:!0,defaultValue:!1,description:"Continue adding layers as long as new connections exist."}),"as-whole-residues":nL(WF.Bool,{isOptional:!0})}),vL.ElementSelectionQuery,"Pick all atom sets that are connected to the target."),wholeResidues:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Expand the selection to whole residues."),expandProperty:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),property:nL(WF.AnyValue)}),vL.ElementSelectionQuery,"To each atom set in the selection, add all atoms that have the same property value that was already present in the set.")},filter:{"@header":"Selection Filters",pick:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),test:nL(WF.Bool)}),vL.ElementSelectionQuery,"Pick all atom sets that satisfy the test."),first:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Take the 1st atom set in the sequence."),withSameAtomProperties:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),source:nL(vL.ElementSelectionQuery),property:nL(WF.Any)}),vL.ElementSelectionQuery,"Pick all atom sets for which the set of given atom properties is a subset of the source properties."),intersectedBy:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),by:nL(vL.ElementSelectionQuery)}),vL.ElementSelectionQuery,"Pick all atom sets that have non-zero intersection with the target."),within:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),target:nL(vL.ElementSelectionQuery),"min-radius":nL(WF.Num,{isOptional:!0,defaultValue:0}),"max-radius":nL(WF.Num),"atom-radius":nL(WF.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),invert:nL(WF.Bool,{isOptional:!0,defaultValue:!1,description:"If true, pick only atom sets that are further than the specified radius."})}),vL.ElementSelectionQuery,"Pick all atom sets from selection that have any atom within the radius of any atom from target."),isConnectedTo:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery),target:nL(vL.ElementSelectionQuery),"bond-test":nL(WF.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),disjunct:nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"If true, there must exist a bond to an atom that lies outside the given atom set to pass test."}),invert:nL(WF.Bool,{isOptional:!0,defaultValue:!1,description:"If true, return atom sets that are not connected."})}),vL.ElementSelectionQuery,"Pick all atom sets that are connected to the target.")},combinator:{"@header":"Selection Combinators",intersect:sL(YF.List(vL.ElementSelectionQuery),vL.ElementSelectionQuery,"Return all unique atom sets that appear in all of the source selections."),merge:sL(YF.List(vL.ElementSelectionQuery),vL.ElementSelectionQuery,"Merges multiple selections into a single one. Only unique atom sets are kept."),distanceCluster:sL(YF.Dictionary({matrix:nL(KF.List(KF.List(WF.Num)),{description:"Distance matrix, represented as list of rows (num[][])). Lower triangle is min distance, upper triangle is max distance."}),selections:nL(KF.List(vL.ElementSelectionQuery),{description:"A list of held selections."})}),vL.ElementSelectionQuery,"Pick combinations of atom sets from the source sequences that are mutually within distances specified by a matrix.")},atomSet:{"@header":"Atom Sets",atomCount:sL(YF.None,WF.Num),countQuery:sL(YF.Dictionary({0:nL(vL.ElementSelectionQuery)}),WF.Num,"Counts the number of occurences of a specific query inside the current atom set."),reduce:sL(YF.Dictionary({initial:nL(WF.Variable("a",WF.AnyValue,!0),{description:"Initial value assigned to slot.atom-set-reduce. Current atom is set to the 1st atom of the current set for this."}),value:nL(WF.Variable("a",WF.AnyValue,!0),{description:"Expression executed for each atom in the set"})}),WF.Variable("a",WF.AnyValue,!0),"Execute the value expression for each atom in the current atom set and return the result. Works the same way as Array.reduce in JavaScript (``result = value(value(...value(initial)))``)"),propertySet:sL(YF.Dictionary({0:nL(KF.ConstrainedVar)}),KF.Set(KF.ConstrainedVar),"Returns a set with all values of the given property in the current atom set.")},atomProperty:{"@header":"Atom Properties",core:{"@header":"Core Properties",elementSymbol:bL(vL.ElementSymbol),vdw:bL(WF.Num,"Van der Waals radiu
139s"),mass:bL(WF.Num,"Atomic weight"),atomicNumber:bL(WF.Num,"Atomic number"),x:bL(WF.Num,"Cartesian X coordinate"),y:bL(WF.Num,"Cartesian Y coordinate"),z:bL(WF.Num,"Cartesian Z coordinate"),atomKey:bL(WF.AnyValue,"Unique value for each atom. Main use case is grouping of atoms."),bondCount:sL(YF.Dictionary({0:nL(vL.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"}),flags:nL(vL.BondFlags,{isOptional:!0,defaultValue:"covalent"})}),WF.Num,"Number of bonds (by default only covalent bonds are counted)."),sourceIndex:bL(WF.Num,"Index of the atom/element in the input file."),operatorName:bL(WF.Str,"Name of the symmetry operator applied to this element."),operatorKey:bL(WF.Num,"Key of the symmetry operator applied to this element."),modelIndex:bL(WF.Num,"Index of the model in the input file."),modelLabel:bL(WF.Str,"Label/header of the model in the input file.")},topology:{connectedComponentKey:bL(WF.AnyValue,"Unique value for each connected component.")},macromolecular:{"@header":"Macromolecular Properties (derived from the mmCIF format)",authResidueId:bL(vL.ResidueId,"type.auth-residue-id symbol executed on current atom's residue"),labelResidueId:bL(vL.ResidueId,"type.label-residue-id symbol executed on current atom's residue"),residueKey:bL(WF.AnyValue,"Unique value for each tuple ``(label_entity_id,auth_asym_id, auth_seq_id, pdbx_PDB_ins_code)``, main use case is grouping of atoms"),chainKey:bL(WF.AnyValue,"Unique value for each tuple ``(label_entity_id, auth_asym_id)``, main use case is grouping of atoms"),entityKey:bL(WF.AnyValue,"Unique value for each tuple ``label_entity_id``, main use case is grouping of atoms"),isHet:bL(WF.Bool,"Equivalent to atom_site.group_PDB !== ATOM"),id:bL(WF.Num,"_atom_site.id"),label_atom_id:bL(vL.AtomName),label_alt_id:bL(WF.Str),label_comp_id:bL(WF.Str),label_asym_id:bL(WF.Str),label_entity_id:bL(WF.Str),label_seq_id:bL(WF.Num),auth_atom_id:bL(vL.AtomName),auth_comp_id:bL(WF.Str),auth_asym_id:bL(WF.Str),auth_seq_id:bL(WF.Num),pdbx_PDB_ins_code:bL(WF.Str),pdbx_formal_charge:bL(WF.Num),occupancy:bL(WF.Num),B_iso_or_equiv:bL(WF.Num),entityType:bL(vL.EntityType,"Type of the entity as defined in mmCIF (polymer, non-polymer, branched, water)"),entitySubtype:bL(vL.EntitySubtype,"Subtype of the entity as defined in mmCIF _entity_poly.type and _pdbx_entity_branch.type (other, polypeptide(D), polypeptide(L), polydeoxyribonucleotide, polyribonucleotide, polydeoxyribonucleotide/polyribonucleotide hybrid, cyclic-pseudo-peptide, peptide nucleic acid, oligosaccharide)"),entityPrdId:bL(WF.Str,"The PRD ID of the entity."),entityDescription:bL(KF.List(WF.Str)),objectPrimitive:bL(vL.ObjectPrimitive,"Type of the primitive object used to model this segment as defined in mmCIF/IHM (atomistic, sphere, gaussian, other)"),secondaryStructureKey:bL(WF.AnyValue,"Unique value for each secondary structure element."),secondaryStructureFlags:bL(vL.SecondaryStructureFlags),isModified:bL(WF.Bool,"True if the atom belongs to modification of a standard residue."),modifiedParentName:bL(WF.Str,"'3-letter' code of the modifed parent residue."),isNonStandard:bL(WF.Bool,"True if this is a non-standard residue."),chemCompType:bL(WF.Str,"Type of the chemical component as defined in mmCIF.")}},bondProperty:{"@header":"Bond Properties",flags:_L(vL.BondFlags),order:_L(WF.Num),key:_L(WF.Num),length:_L(WF.Num),atomA:_L(vL.ElementReference),atomB:_L(vL.ElementReference)}},internal:{"@header":"Internal Queries",generator:{"@header":"Generators",bundleElement:sL(YF.Dictionary({groupedUnits:nL(WF.Any),set:nL(WF.Any),ranges:nL(WF.Any)}),WF.Any),bundle:sL(YF.Dictionary({elements:nL(WF.Any)}),vL.ElementSelectionQuery,"A selection with single structure containing represented by the bundle."),current:sL(YF.None,vL.ElementSelectionQuery,"Current selection provided by the query context. Avoid using this in State Transforms.")}}};uL(xL);var SL,wL=cL(xL);(function(){for(var e=Object.create(null),t=0,r=wL;t<r.length;t++){var n=r[t];e[n.id]=n}})(),function(e){e.core=xL.core,e.struct=xL.structureQuery,e.internal=xL.internal,e.atomName=function(t){return e.struct.type.atomName([t])},e.es=function(t){return e.struct.type.elementSymbol([t])},e.list=function(){var t=[...arguments];return e.core.type.list(t)},e.set=function(){var t=[...arguments];return e.core.type.set(t)},e.re=function(t,r){return e.core.type.regex([t,r])},e.fn=function(t){return e.core.ctrl.fn([t])},e.evaluate=function(t){return e.core.ctrl.eval([t])};var t=e.struct.atomProperty.core,r=e.struct.atomProperty.macromolecular,n=e.struct.atomProperty.topology;function i(e){return t[e]()}function a(e){return n[e]()}function o(e){return r[e]()}e.acp=i,e.atp=a,e.ammp=o;var s=e.struct.atomSet.propertySet;e.acpSet=function(e){return s([i(e)])},e.atpSet=function(e){return s([a(e)])},e.ammpSet=function(e){return s([o(e)])}}(SL||={});var AL=function(){function e(t){this.map=t;var r=0,n=[],i=new Map,a=new Map;
139this.map.forEach(function(t){t.forEach(function(t){r+=t.edgeCount,t.connectedIndices.forEach(function(r){t.getEdges(r).forEach(function(o){var s=t.unitA,u=t.unitB,c=e.getEdgeKey(r,s,o.indexB,u);i.set(c,n.length);var l=e.getVertexKey(r,s),d=a.get(l);void 0===d?a.set(l,[n.length]):d.push(n.length),n.push(Ac(Ac({},o),{indexA:r,unitA:s,unitB:u}))})})})}),this.edgeCount=r,this.edges=n,this.edgeKeyIndex=i,this.vertexKeyIndex=a}return e.prototype.getConnectedUnits=function(e){return this.map.has(e)?this.map.get(e):TL},e.prototype.getEdgeIndex=function(t,r,n,i){var a=e.getEdgeKey(t,r,n,i),o=this.edgeKeyIndex.get(a);return void 0===o?-1:o},e.prototype.hasEdge=function(e,t,r,n){return-1!==this.getEdgeIndex(e,t,r,n)},e.prototype.getEdge=function(e,t,r,n){var i=this.getEdgeIndex(e,t,r,n);return-1===i?void 0:this.edges[i]},e.prototype.getEdgeIndices=function(t,r){return this.vertexKeyIndex.get(e.getVertexKey(t,r))||[]},e}();!function(e){var t=function(){function e(e,t,r,n,i){this.unitA=e,this.unitB=t,this.edgeCount=r,this.connectedIndices=n,this.edgeMap=i}return e.prototype.hasEdges=function(e){return this.edgeMap.has(e)},e.prototype.getEdges=function(e){return this.edgeMap.has(e)?this.edgeMap.get(e):TL},Object.defineProperty(e.prototype,"areUnitsOrdered",{get:function(){return this.unitA<this.unitB},enumerable:!1,configurable:!0}),e}();function r(e,t,r){e.has(t)?e.get(t).push(r):e.set(t,[r])}e.UnitPairEdges=t,e.getEdgeKey=function(e,t,r,n){return`${e}|${t}|${r}|${n}`},e.getVertexKey=function(e,t){return`${e}|${t}`},e.Builder=function(){function e(){this.map=new Map}return e.prototype.startUnitPair=function(e,t){this.uA=e,this.uB=t,this.mapAB=new Map,this.mapBA=new Map,this.linkedA=gS.create(),this.linkedB=gS.create(),this.linkCount=0},e.prototype.finishUnitPair=function(){0!==this.linkCount&&(r(this.map,this.uA,new t(this.uA,this.uB,this.linkCount,this.linkedA.array,this.mapAB)),r(this.map,this.uB,new t(this.uB,this.uA,this.linkCount,this.linkedB.array,this.mapBA)))},e.prototype.add=function(e,t,n){r(this.mapAB,e,{indexB:t,props:n}),r(this.mapBA,t,{indexB:e,props:n}),gS.add(this.linkedA,e,e),gS.add(this.linkedB,t,t),this.linkCount+=1},e.prototype.getMap=function(){return this.map},e}()}(AL||={});var CL,TL=[];!function(e){e.Empty=DF.create([],[],[],0,{flags:[],order:[],key:[]})}(CL||={});var PL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t.prototype.getBondFromLocation=function(e){return tU.isAtomic(e.aUnit)&&tU.isAtomic(e.bUnit)?this.getEdge(e.aIndex,e.aUnit.id,e.bIndex,e.bUnit.id):void 0},t.prototype.getBondIndexFromLocation=function(e){return tU.isAtomic(e.aUnit)&&tU.isAtomic(e.bUnit)?this.getEdgeIndex(e.aIndex,e.aUnit.id,e.bIndex,e.bUnit.id):-1},t}(AL);!function(e){e.UnitPairBonds=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(AL.UnitPairEdges)}(PL||={});var EL={forceCompute:!1,noCompute:!1,maxRadius:4},ML={H:0,h:0,D:0,d:0,T:0,t:0,He:2,HE:2,he:2,Li:3,LI:3,li:3,Be:4,BE:4,be:4,B:5,b:5,C:6,c:6,N:7,n:7,O:8,o:8,F:9,f:9,Ne:10,NE:10,ne:10,Na:11,NA:11,na:11,Mg:12,MG:12,mg:12,Al:13,AL:13,al:13,Si:14,SI:14,si:14,P:15,p:15,S:16,s:16,Cl:17,CL:17,cl:17,Ar:18,AR:18,ar:18,K:19,k:19,Ca:20,CA:20,ca:20,Sc:21,SC:21,sc:21,Ti:22,TI:22,ti:22,V:23,v:23,Cr:24,CR:24,cr:24,Mn:25,MN:25,mn:25,Fe:26,FE:26,fe:26,Co:27,CO:27,co:27,Ni:28,NI:28,ni:28,Cu:29,CU:29,cu:29,Zn:30,ZN:30,zn:30,Ga:31,GA:31,ga:31,Ge:32,GE:32,ge:32,As:33,AS:33,as:33,Se:34,SE:34,se:34,Br:35,BR:35,br:35,Kr:36,KR:36,kr:36,Rb:37,RB:37,rb:37,Sr:38,SR:38,sr:38,Y:39,y:39,Zr:40,ZR:40,zr:40,Nb:41,NB:41,nb:41,Mo:42,MO:42,mo:42,Tc:43,TC:43,tc:43,Ru:44,RU:44,ru:44,Rh:45,RH:45,rh:45,Pd:46,PD:46,pd:46,Ag:47,AG:47,ag:47,Cd:48,CD:48,cd:48,In:49,IN:49,in:49,Sn:50,SN:50,sn:50,Sb:51,SB:51,sb:51,Te:52,TE:52,te:52,I:53,i:53,Xe:54,XE:54,xe:54,Cs:55,CS:55,cs:55,Ba:56,BA:56,ba:56,La:57,LA:57,la:57,Ce:58,CE:58,ce:58,Pr:59,PR:59,pr:59,Nd:60,ND:60,nd:60,Pm:61,PM:61,pm:61,Sm:62,SM:62,sm:62,Eu:63,EU:63,eu:63,Gd:64,GD:64,gd:64,Tb:65,TB:65,tb:65,Dy:66,DY:66,dy:66,Ho:67,HO:67,ho:67,Er:68,ER:68,er:68,Tm:69,TM:69,tm:69,Yb:70,YB:70,yb:70,Lu:71,LU:71,lu:71,Hf:72,HF:72,hf:72,Ta:73,TA:73,ta:73,W:74,w:74,Re:75,RE:75,re:75,Os:76,OS:76,os:76,Ir:77,IR:77,ir:77,Pt:78,PT:78,pt:78,Au:79,AU:79,au:79,Hg:80,HG:80,hg:80,Tl:81,TL:81,tl:81,Pb:82,PB:82,pb:82,Bi:83,BI:83,bi:83,Po:84,PO:84,po:84,At:85,AT:85,at:85,Rn:86,RN:86,rn:86,Fr:87,FR:87,fr:87,Ra:88,RA:88,ra:88,Ac:89,AC:89,ac:89,Th:90,TH:90,th:90,Pa:91,PA:91,pa:91,U:92,u:92,Np:93,NP:93,np:93,Pu:94,PU:94,pu:94,Am:95,AM:95,am:95,Cm:96,CM:96,cm:96,Bk:97,BK:97,bk:97,Cf:98,CF:98,cf:98,Es:99,ES:99,es:99,Fm:100,FM:100,fm:100,Md:101,MD:101,md:101,No:102,NO:102,no:102,Lr:103,LR:103,lr:103,Rf:104,RF:104,rf:104,Db:105,DB:105,db:105,Sg:106,SG:106,sg:106,Bh:107,BH:107,bh:107,Hs:108,HS:108,hs:108,Mt:109,MT:109,mt:109},kL={0:1.42,1:1.42,3:2.7,4:2.7,6:1.75,7:1.6,8:1.52,11:2.7,12:2.7,13:2.7,14:1.9,15:2,16:1.9,17:1.8,19:2.7,20:2.7,21:2.7,22:2.7,23:2.7,24:2.7,25:2.7,26:2.7,27:2.7,28:2.7,29:2.7,30:2.7,31:2.7,33:2.68,37:2.7,38:2.7,39:2.7,40:2.7,41:2.7,42:2.7,43:2.7,44:2.7,45:2.7,46:2.7,47:2.7,48:2.7,49:2.7,50:2.7,55:2.7,56:2.7,57:2.7,58:2.7,59:2.7,60:2.7,61:2.7,62:2.7,63:2.7,64:2.7,65:2.7,66:2.7,67:2.7,68:2.7,69:2.7,70:2.7,71:2.7,72:2.7,73:2.7,74:2.7,75:2.7,76:2.7,77:2.7,78:2.7,79:2.7,80:2.7,81:2.7,82:2.7,83:2.7,87:2.7,88:2.7,89:2.7,90:2.7,91:2.7,92:2.7,93:2.7,94:2.7,95:2.7,96:2.7,97:2.7,98:2.7,99:2.7,100:2.7,101:2.7,102:2.7,103:2.7,104:2.7,105:2.7,106:2.7,107:2.7,108:2.7,109:2.88},IL={0:.8,20:1.31,27:1.2,35:1.15,44:1.1,54:1,60:1.84,72:1.88,84:1.75,85:1.56,86:1.76,98:1.6,99:1.68,100:1.63,112:1.6,113:1.59,114:1.36,129:1.45,135:1.47,144:1.6,152:1.45,170:1.4,180:1.55,202:2.4,222:2.24,224:1.91,225:1.98,243:2.02,269:2,293:1.9,316:1.8,420:2.37,480:2.3,512:2.3,544:2.3,612:2.1,629:1.54,665:1,813:2.6,854:2.27,894:1.93,896:2.1,937:2.05,938:2.06,981:1.62,1258:2.68,1309:2.33,1484:1,1763:2.14,1823:2.48,1882:2.1,1944:1.72,2380:2.34,3367:2.44,3733:2.11,3819:2.6,3821:2.36,4736:2.75,5724:2.73,5959:2.63,6519:2.84,6750:2.87,8991:2.81},DL=function(){for(var e=new Set,t=0,r="LI.NA.K.RB.CS.FR.BE.MG.CA.SR.BA.RA.AL.GA.IN.SN.TL.PB.BI.SC.TI.V.CR.MN.FE.CO.NI.CU.ZN.Y.ZR.NB.MO.TC.RU.RH.PD.AG.CD.LA.HF.TA.W.RE.OS.IR.PT.AU.HG.AC.RF.DB.SG.BH.HS.MT.CE.PR.ND.PM.SM.EU.GD.TB.DY.HO.E
139R.TM.YB.LU.TH.PA.U.NP.PU.AM.CM.BK.CF.ES.FM.MD.NO.LR".split(".");t<r.length;t++){var n=r[t];e.add(ML[n])}return e}();function OL(e){var t=ML[e];return void 0===t?-1:t}function RL(e){if(e<0)return 2.001;var t=kL[e];return void 0===t?2.001:t}function BL(e,t,r,n){var i=function(e,t){if(e<0||t<0)return-1;var r=IL[function(e,t){return e<t?(e+t)*(e+t+1)/2+t:(e+t)*(e+t+1)/2+e}(e,t)];return void 0===r?-1:r}(e,t);return i>0?i:t<0?r:(r+n)/1.95}var NL=ML.H;function FL(e){return e===NL}var LL=new Map([["HIS|CD2|CG",2],["HIS|CE1|ND1",2],["ARG|CZ|NH2",2],["PHE|CE1|CZ",2],["PHE|CD2|CE2",2],["PHE|CD1|CG",2],["TRP|CD1|CG",2],["TRP|CD2|CE2",2],["TRP|CE3|CZ3",2],["TRP|CH2|CZ2",2],["ASN|CG|OD1",2],["GLN|CD|OE1",2],["TYR|CD1|CG",2],["TYR|CD2|CE2",2],["TYR|CE1|CZ",2],["ASP|CG|OD1",2],["GLU|CD|OE1",2],["G|C8|N7",2],["G|C4|C5",2],["G|C2|N3",2],["G|C6|O6",2],["C|C4|N3",2],["C|C5|C6",2],["C|C2|O2",2],["A|C2|N3",2],["A|C6|N1",2],["A|C4|C5",2],["A|C8|N7",2],["U|C5|C6",2],["U|C2|O2",2],["U|C4|O4",2],["DG|C8|N7",2],["DG|C4|C5",2],["DG|C2|N3",2],["DG|C6|O6",2],["DC|C4|N3",2],["DC|C5|C6",2],["DC|C2|O2",2],["DA|C2|N3",2],["DA|C6|N1",2],["DA|C4|C5",2],["DA|C8|N7",2],["DT|C5|C6",2],["DT|C2|O2",2],["DT|C4|O4",2]]);function $L(e,t,r){var n;return t=(n=t<r?[t,r]:[r,t])[0],r=n[1],eF.has(e)&&"C"===t&&"O"===r||sF.has(e)&&"OP1"===t&&"P"===r?2:LL.get(`${e}|${t}|${r}`)||1}var UL,jL,zL,GL=new Map([["LYS|NZ|RET|C15",2]]);function VL(e,t,r,n){var i,a;return e>r&&(e=(i=[r,e])[0],r=i[1],t=(a=[n,t])[0],n=a[1]),GL.get(`${e}|${t}|${r}|${n}`)||1}function HL(e){return function(t,r){return r[e].value(t)}}function qL(e){return function(t,r){return r[e].value(t).join(r[e].schema.separator)}}function WL(e){var t=[...arguments].slice(1);return function(r,n){var i;return(i=n[e].schema.space).get.apply(i,kc([n[e].value(r)],t,!1))}}function XL(e){return function(t,r){return r[e].valueKind(t)}}function YL(e,t){var r=[],n=XL(e);if(1===t.rank)for(var i=t.dimensions[0],a=0;a<i;a++){var o=`${e}[${a+1}]`;r.push({name:o,type:2,value:WL(e,a),valueKind:n})}else if(2===t.rank){i=t.dimensions[0];var s=t.dimensions[1];for(a=0;a<i;a++)for(var u=0;u<s;u++){var c=`${e}[${a+1}][${u+1}]`;r.push({name:c,type:2,value:WL(e,a,u),valueKind:n})}}else{if(3!==t.rank)throw Error("Tensors with rank > 3 or rank 0 are currently not supported.");var l=t.dimensions[0],d=t.dimensions[1],f=t.dimensions[2];for(a=0;a<l;a++)for(u=0;u<d;u++)for(var h=0;h<f;h++){var p=`${e}[${a+1}][${u+1}][${h+1}]`;r.push({name:p,type:2,value:WL(e,a,u,h),valueKind:n})}}return r}function KL(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var i=n[r],a=e[i];"int"===a.valueType?t.push({name:i,type:1,value:HL(i),valueKind:XL(i)}):"float"===a.valueType?t.push({name:i,type:2,value:HL(i),valueKind:XL(i)}):"str"===a.valueType?t.push({name:i,type:0,value:HL(i),valueKind:XL(i)}):"list"===a.valueType?t.push({name:i,type:0,value:qL(i),valueKind:XL(i)}):"tensor"===a.valueType?t.push.apply(t,YL(i,a.space)):Lg(a.valueType)}return t}function ZL(e){return e.fields.some(function(e){return!!e.shouldInclude})?e.fields.filter(function(t){return!t.shouldInclude||e.source.some(function(e){return t.shouldInclude(e.data)})}):e.fields}function QL(e,t){var r=e.instance(t),n=r.source.filter(function(e){return e.rowCount>0});return n.length?{instance:r,rowCount:n.reduce(function(e,t){return e+t.rowCount},0),source:n.map(function(e){return{data:e.data,keys:function(){return e.keys?e.keys():vE.Range(0,e.rowCount-1)},rowCount:e.rowCount}})}:{instance:r,rowCount:0,source:[]}}(function(e){function t(e,t,r){return{name:e,type:1,value:t,valueKind:r&&r.valueKind,defaultFormat:r?{encoder:r.encoder,typedArray:r.typedArray}:void 0,shouldInclude:r&&r.shouldInclude}}e.str=function(e,t,r){return{name:e,type:0,value:t,valueKind:r&&r.valueKind,defaultFormat:r&&r.encoder?{encoder:r.encoder}:void 0,shouldInclude:r&&r.shouldInclude}},e.int=t,e.float=function(e,t,r){return{name:e,type:2,value:t,valueKind:r&&r.valueKind,defaultFormat:r?{encoder:r.encoder,typedArray:r.typedArray,digitCount:void 0===r.digitCount?void 0:r.digitCount}:void 0,shouldInclude:r&&r.shouldInclude}},e.index=function(e){return t(e,function(e,t,r){return r+1},{typedArray:Int32Array,encoder:Hw.by(Hw.delta).and(Hw.runLength).and(Hw.integerPacking)})};var r=function(){function t(){this.fields=[]}return t.prototype.index=function(t){return this.fields.push(e.index(t)),this},t.prototype.str=function(t,r,n){return this.fields.push(e.str(t,r,n)),this},t.prototype.int=function(t,r,n){return this.fields.push(e.int(t,r,n)),this},t.prototype.vec=function(t,r,n){for(var i=0;i<r.length;i++)this.fields.push(e.int(`${t}[${i+1}]`,r[i],n));return this},t.prototype.float=function(t,r,n){return this.fields.push(e.float(t,r,n)),this},t.prototype.many=function(e){for(var t=0;t<e.length;t++)this.fields.push(e[t]);return this},t.prototype.add=function(e){return this.fields.push(e),this},t.prototype.getFields=function(){return this.fields},t}();
139e.Builder=r,e.build=function(){return new r}})(UL||={}),function(e){e.Empty={fields:[],source:[]},e.filterOf=function(e){for(var t=[],r=[],n=[],i=[],a=0,o=e.split(/[\r\n]+/);a<o.length;a++){var s=o[a];if(0!==(s=s.trim()).length){var u=/^!/.test(s);u&&(s=s.substr(1));var c=s.split(/\./),l=c[1],d=u?l?i:r:l?n:t;d[d.length]=s,l&&!t.includes(c[0])&&(t[t.length]=c[0])}}var f=n.map(function(e){return e.split(".")[0]});return{includeCategory:function(e){return!r.includes(e)&&(t.length<=0||-1!==t.indexOf(e))},includeField:function(e,t){var r=e+"."+t;return!i.includes(r)&&(!f.includes(e)||n.includes(r))}}},e.DefaultFilter={includeCategory:function(e){return!0},includeField:function(e,t){return!0}},e.DefaultFormatter={getFormat:function(e,t){}},e.ofTable=function(e,t){return t?{fields:KL(e._schema),source:[{data:e,rowCount:t.length,keys:function(){return vE.Array(t)}}]}:{fields:KL(e._schema),source:[{data:e,rowCount:e._rowCount}]}}}(jL||={}),function(e){function t(e,t,r){e.startDataBlock(t);for(var n=function(t){e.writeCategory({name:t,instance:function(){return jL.ofTable(r[t])}})},i=0,a=r._tableNames;i<a.length;i++)n(a[i])}e.writeDatabase=t,e.writeDatabaseCollection=function(e,r){for(var n=0,i=Object.keys(r);n<i.length;n++){var a=i[n];t(e,a,r[a])}}}(zL||={});var JL=function(){function e(){this.builder=wd.create(),this.encoded=!1,this.dataBlockCreated=!1,this.filter=jL.DefaultFilter,this.formatter=jL.DefaultFormatter,this.isBinary=!1,this.binaryEncodingProvider=void 0}return e.prototype.setFilter=function(e){this.filter=e||jL.DefaultFilter},e.prototype.isCategoryIncluded=function(e){return this.filter.includeCategory(e)},e.prototype.setFormatter=function(e){this.formatter=e||jL.DefaultFormatter},e.prototype.startDataBlock=function(e){this.dataBlockCreated=!0,wd.write(this.builder,`data_${(e||"").replace(/[ \n\t]/g,"").toUpperCase()}\n#\n`)},e.prototype.writeCategory=function(e,t,r){if(this.encoded)throw Error("The writer contents have already been encoded, no more writing.");if(!this.dataBlockCreated)throw Error("No data block created.");if(r?.ignoreFilter||this.filter.includeCategory(e.name)){var n=QL(e,t),i=n.instance,a=n.rowCount,o=n.source;a&&(1===a?function(e,t,r,n,i,a){var o=ZL(t),s=r[0],u=s.data,c=o.reduce(function(t,r){return i.includeField(e.name,r.name)?Math.max(t,r.name.length):0},0);if(0!==c){c+=e.name.length+6;for(var l=s.keys().move(),d=t$(e.name,t.fields,a),f=0;f<o.length;f++){var h=o[f];i.includeField(e.name,h.name)&&(wd.writePadRight(n,`_${e.name}.${h.name}`,c),e$(n,u,l,h,d[f],0)||wd.newline(n))}wd.write(n,"#\n")}}(e,i,o,this.builder,this.filter,this.formatter):function(e,t,r,n,i,a){var o=ZL(t),s=i===jL.DefaultFilter?o:o.filter(function(t){return i.includeField(e.name,t.name)}),u=s.length;if(0!==u){var c=t$(e.name,s,a);r$(n,"loop_");for(var l=0;l<u;l++)r$(n,`_${e.name}.${s[l].name}`);for(var d=0,f=0;f<r.length;f++){var h=r[f],p=h.data;if(0!==h.rowCount)for(var m=h.keys();m.hasNext;){for(var g=m.move(),v=!1,y=0;y<u;y++)v=e$(n,p,g,s[y],c[y],d);v||wd.newline(n),d++}}wd.write(n,"#\n")}}(e,i,o,this.builder,this.filter,this.formatter))}},e.prototype.encode=function(){this.encoded=!0},e.prototype.writeTo=function(e){for(var t=wd.getChunks(this.builder),r=0,n=t.length;r<n;r++)e.writeString(t[r])},e.prototype.getSize=function(){return wd.getSize(this.builder)},e.prototype.getData=function(){return wd.getString(this.builder)},e}();function e$(e,t,r,n,i,a){var o,s=n.valueKind,u=s?s(r,t):0;if(0!==u)1===u?function(e){wd.writeSafe(e,". ")}(e):function(e){wd.writeSafe(e,"? ")}(e);else{var c=n.value(r,t,a),l=n.type;if(0===l)return"string"==typeof(o=c)&&o.indexOf("\n")>=0?(n$(e,c),!0):function(e,t){if(!t)return wd.writeSafe(e,". "),!1;for(var r=t.charCodeAt(0),n=!1,i=0,a=!1,o=!1,s=0,u=t.length-1;s<=u;s++)switch(t.charCodeAt(s)){case 9:case 32:n=!0;break;case 10:return n$(e,t),!0;case 34:if(s&&s===u)break;if(a)return n$(e,t),!0;o=!0,n=!0,i=0;break;case 39:if(s&&s===u)break;if(o)return n$(e,t),!0;a=!0,n=!0,i=1}return n||35!==r&&36!==r&&59!==r&&91!==r&&93!==r&&95!==r||(n=!0),n?(wd.writeSafe(e,i?'"':"'"),wd.writeSafe(e,t),wd.writeSafe(e,i?'" ':"' ")):(wd.writeSafe(e,t),wd.writeSafe(e," ")),!1}(e,c);1===l?function(e,t){wd.writeInteger(e,t),wd.whitespace1(e)}(e,c):function(e,t,r){wd.writeFloat(e,t,r),wd.whitespace1(e)}(e,c,i)}return!1}function t$(e,t,r){for(var n,i=[],a=0,o=t;a<o.length;a++){var s=o[a],u=r.getFormat(e,s.name);u&&void 0!==u.digitCount?i[i.length]=2===s.type?10**Math.max(0,Math.min(u.digitCount,15)):0:i[i.length]=2===s.type?10**((n=s).defaultFormat&&void 0!==n.defaultFormat.digitCount?Math.max(0,Math.min(n.defaultFormat.digitCount,16)):6):0}return i}function r$(e,t){wd.write(e,t),wd.newline(e)}function n$(e,t){wd.writeSafe(e,"\n;"+t),wd.writeSafe(e,"\n;\n")}function i$(e){var t=new ArrayBuffer(a$(e)),r=new DataView(t),n=new Uint8Array(t);return o$(e,r,n,0),n}function a$(e){var t=typeof e;if("string"===t){var r=Jv(e);
139if(r<32)return 1+r;if(r<256)return 2+r;if(r<65536)return 3+r;if(r<4294967296)return 5+r}if(e instanceof Uint8Array){var n=e.byteLength;if(n<256)return 2+n;if(n<65536)return 3+n;if(n<4294967296)return 5+n}if("number"===t){if(Math.floor(e)!==e)return 9;if(e>=0){if(e<128)return 1;if(e<256)return 2;if(e<65536)return 3;if(e<4294967296)return 5;throw Error("Number too big 0x"+e.toString(16))}if(e>=-32)return 1;if(e>=-128)return 2;if(e>=-32768)return 3;if(e>=-2147483648)return 5;throw Error("Number too small -0x"+e.toString(16).substr(1))}if("boolean"===t||null==e)return 1;if("object"===t){var i,a=0;if(Array.isArray(e)){i=e.length;for(var o=0;o<i;o++)a+=a$(e[o])}else{var s=Object.keys(e);for(i=s.length,o=0;o<i;o++){var u=s[o];a+=a$(u)+a$(e[u])}}if(i<16)return 1+a;if(i<65536)return 3+a;if(i<4294967296)return 5+a;throw Error("Array or object too long 0x"+i.toString(16))}throw Error("Unknown type "+t)}function o$(e,t,r,n){var i=typeof e;if("string"===i){var a=Jv(e);if(a<32)return t.setUint8(n,160|a),Xv(r,n+1,e),1+a;if(a<256)return t.setUint8(n,217),t.setUint8(n+1,a),Xv(r,n+2,e),2+a;if(a<65536)return t.setUint8(n,218),t.setUint16(n+1,a),Xv(r,n+3,e),3+a;if(a<4294967296)return t.setUint8(n,219),t.setUint32(n+1,a),Xv(r,n+5,e),5+a}if(e instanceof Uint8Array){var o=e.byteLength,s=new Uint8Array(t.buffer);if(o<256)return t.setUint8(n,196),t.setUint8(n+1,o),s.set(e,n+2),2+o;if(o<65536)return t.setUint8(n,197),t.setUint16(n+1,o),s.set(e,n+3),3+o;if(o<4294967296)return t.setUint8(n,198),t.setUint32(n+1,o),s.set(e,n+5),5+o}if("number"===i){if(!isFinite(e))throw Error("Number not finite: "+e);if(Math.floor(e)!==e)return t.setUint8(n,203),t.setFloat64(n+1,e),9;if(e>=0){if(e<128)return t.setUint8(n,e),1;if(e<256)return t.setUint8(n,204),t.setUint8(n+1,e),2;if(e<65536)return t.setUint8(n,205),t.setUint16(n+1,e),3;if(e<4294967296)return t.setUint8(n,206),t.setUint32(n+1,e),5;throw Error("Number too big 0x"+e.toString(16))}if(e>=-32)return t.setInt8(n,e),1;if(e>=-128)return t.setUint8(n,208),t.setInt8(n+1,e),2;if(e>=-32768)return t.setUint8(n,209),t.setInt16(n+1,e),3;if(e>=-2147483648)return t.setUint8(n,210),t.setInt32(n+1,e),5;throw Error("Number too small -0x"+(-e).toString(16).substr(1))}if(null==e)return t.setUint8(n,192),1;if("boolean"===i)return t.setUint8(n,e?195:194),1;if("object"===i){var u,c=0,l=Array.isArray(e),d=void 0;if((u=l?e.length:(d=Object.keys(e)).length)<16?(t.setUint8(n,u|(l?144:128)),c=1):u<65536?(t.setUint8(n,l?220:222),t.setUint16(n+1,u),c=3):u<4294967296&&(t.setUint8(n,l?221:223),t.setUint32(n+1,u),c=5),l)for(var f=0;f<u;f++)c+=o$(e[f],t,r,n+c);else{f=0;for(var h=d.length;f<h;f++){var p=d[f];c+=o$(p,t,r,n+c),c+=o$(e[p],t,r,n+c)}}return c}throw Error("Unknown type "+i)}var s$,u$,c$,l$=function(){function e(e,t,r){this.autoClassify=r,this.dataBlocks=[],this.filter=jL.DefaultFilter,this.formatter=jL.DefaultFormatter,this.isBinary=!0,this.binaryEncodingProvider=void 0,this.binaryEncodingProvider=t,this.data={encoder:e,version:"0.3.0",dataBlocks:this.dataBlocks}}return e.prototype.setFilter=function(e){this.filter=e||jL.DefaultFilter},e.prototype.isCategoryIncluded=function(e){return this.filter.includeCategory(e)},e.prototype.setFormatter=function(e){this.formatter=e||jL.DefaultFormatter},e.prototype.startDataBlock=function(e){this.dataBlocks.push({header:(e||"").replace(/[ \n\t]/g,"").toUpperCase(),categories:[]})},e.prototype.writeCategory=function(e,t,r){if(!this.data)throw Error("The writer contents have already been encoded, no more writing.");if(!this.dataBlocks.length)throw Error("No data block created.");if(r?.ignoreFilter||this.filter.includeCategory(e.name)){var n=QL(e,t),i=n.instance,a=n.rowCount,o=n.source;if(a){for(var s={name:"_"+e.name,columns:[],rowCount:a},u=0,c=ZL(i);u<c.length;u++){var l=c[u];if(this.filter.includeField(e.name,l.name)){var d=this.formatter.getFormat(e.name,l.name);s.columns.push(d$(e.name,l,o,a,d,this.binaryEncodingProvider,this.autoClassify))}}s.columns.length&&this.dataBlocks[this.dataBlocks.length-1].categories.push(s)}}},e.prototype.encode=function(){this.encodedData||(this.encodedData=i$(this.data),this.data=null,this.dataBlocks=null)},e.prototype.writeTo=function(e){e.writeBinary(this.encodedData)},e.prototype.getData=function(){return this.encode(),this.encodedData},e.prototype.getSize=function(){return this.encodedData.length},e}();function d$(e,t,r,n,i,a,o){var s=function(e,t,r,n){for(var i=0===e.type,a=new t(r),o=new Uint8Array(r),s=e.valueKind,u=e.value,c=!0,l=0,d=0;d<n.length;d++)for(var f=n[d].data,h=n[d].keys();h.hasNext;){var p=h.move(),m=s?s(p,f):0;if(0!==m)o[l]=m,i&&(a[l]=""),c=!1;else{var g=u(p,f,l);"string"!=typeof g||g?o[l]=0:(o[l]=1,c=!1),a[l]=g}l++}return{array:a,allPresent:c,mask:o}}(t,function(e,t){return t&&t.typedArray?t.typedArray:e.defaultFormat&&e.defaultFormat.typedArray?e.defaultFormat.typedArray:0===e.type?Array:1===e.type?Int32Array:Float64Array}(t,i),n,r),u=s.array,c=s.allPresent,l=s.mask,d=function(e,t,r,n){return r&&r.encoder?r.encoder:t.defaultFormat&&t.defaultFormat.encoder?t.defaultFormat.encoder:n?n.get(e,t.name):void 0}(e,t,i,a);d||=o?function(e,t){return 0===e?Vw.by(Hw.stringArray):1===e?Gw(t):(r=t,Ow.classify(r));var r}(t.type,u):function(e){return 0===e?Vw.by(Hw.stringArray):Vw.by(Hw.byteArray)}(t.type);var f=d.encode(u),h=void 0;if(!c){var p=Vw.by(Hw.runLength).and(Hw.byteArray).encode(l);h=p.data.length<l.length?p:Vw.by(Hw.byteArray).encode(l)}return{name:t.name,data:f,mask:h}}(function(e){e.Encoder=zL,e.Category=jL,e.Field=UL,e.Encoding=Hw,e.createEncoder=function(e){var t=e||{},r=t.binary,n=void 0!==r&&r,i=t.encoderName;return n?new l$(void 0===i?"mol*":i,e?e.binaryEncodingPovider:void 0,!!e&&!!e.binaryAutoClassifyEncoding):new JL},e.fields=function(){return e.Field.build()};var t=e.Encoding;function r(e){var r=e.precision;if(void 0!==r){var n=10**r,i=t.by(t.fixedPoint(n));switch(e.encoding){case"pack":return i.and(t.integerPacking);case"rle":return i.and(t.runLength).and(t.integerPacking);case"delta":return i.and(t.delta).and(t.integerPacking);case"delta-rle":return i.and(t.delta).and(t.runLength).and(t.integerPacking)}}else switch(e.encoding){case"pack":return t.by(t.integerPacking);case"rle":return t.by(t.runLength).and(t.integerPacking);case"delta":return t.by(t.delta).and(t.integerPacking);case"delta-rle":return t.by(t.delta).and(t.runLength).and(t.integerPacking)}throw Error("cannot be reached")}e.Encodings={deltaRLE:t.by(t.delta).and(t.runLength).and(t.integerPacking),fixedPoint2:t.by(t.fixedPoint(100)).and(t.delta).and(t.integerPacking),fixedPoint3:t.by(t.fixedPoint(1e3)).and(t.delta).and(t.integerPacking)},e.categoryInstance=function(e,t){return{fields:e,source:[t]}},e.createEncodingProviderFromCifFrame=function(e){return{get:function(t,r){var n=e.categories[t];if(n){var i=n.getField(r);return i&&i.binaryEncoding?Vw.fromEncoding(i.binaryEncoding):void 0}}}},e.createEncodingProviderFromJsonConfig=function(e){return{get:function(t,n){for(var i=0;i<e.length;i++){var a=e[i];if(a.categoryName===t&&a.columnName===n)return r(a)}}}}})(s$||={}),function(e){e.Descriptor={name:"chem_comp_bond",cifExport:{prefix:"",categories:[{name:"chem_comp_bond",instance:function(t){var r=e.Provider.get(t.firstModel);if(!r)return s$.Category.Empty;var n=r.data;if(!n)return s$.Category.Empty;for(var i=t.structures[0].uniqueResidueNames,a=n.comp_id,o=n._rowCount,s=[],u=0;u<o;u++)i.has(a.value(u))&&(s[s.length]=u);return s$.Category.ofTable(n,s)}}]}},e.Provider=FF.create(e.Descriptor),e.chemCompBondFromTable=function(e,t){return Sv.pick(t,yA.chem_comp_bond,function(r){return e.properties.chemicalComponentMap.has(t.comp_id.value(r))})},e.getEntriesFromChemCompBond=function(e){var r=new Map;function n(e){if(r.has(e))return r.get(e);var n=new t(e);return r.set(e,n),n}for(var i=e.comp_id,a=e.atom_id_1,o=e.atom_id_2,s=e.value_order,u=e.pdbx_aromatic_flag,c=e._rowCount,l=e.pdbx_ordinal,d=n(i.value(0)),f=0;f<c;f++){var h=i.value(f),p=a.value(f),m=o.value(f),g=s.value(f),v="y"===u.value(f),y=l.value(f);d.id!==h&&(d=n(h));var b=1,_=1;switch(v&&(b|=16),g.toLowerCase()){case"delo":b|=16;break;case"doub":_=2;break;case"trip":_=3;break;case"quad":_=4}d.add(p,m,_,b,y)}return r};var t=function(){function e(e){this.id=e,this.map=new Map}return e.prototype.add=function(e,t,r,n,i,a){void 0===a&&(a=!0);var o=this.map.get(e);if(void 0!==o)void 0===o.get(t)&&o.set(t,{order:r,flags:n,key:i});else{var s=new Map;s.set(t,{order:r,flags:n,key:i}),this.map.set(e,s)}a&&this.add(t,e,r,n,i,!1)},e}();e.Entry=t}(u$||={}),function(e){function t(e,t){for(var r=e.units,n=0,i=r.length;n<i;n++)if(PP.indexOf(r[n].elements,t)>=0)return!0;return!1}e.Descriptor={name:"struct_conn",cifExport:{prefix:"",categories:[{name:"struct_conn",instance:function(r){var n=e.Provider.get(r.firstModel);
139if(!n||0===n.entries.length)return s$.Category.Empty;for(var i=r.structures[0],a=[],o=0,s=n.entries;o<s.length;o++){var u=s[o];t(i,u.partnerA.atomIndex)&&t(i,u.partnerB.atomIndex)&&(a[a.length]=u.rowIndex)}return s$.Category.ofTable(n.data,a)}}]}},e.Provider=FF.create(e.Descriptor),e.isExhaustive=function(t){var r=e.Provider.get(t);return!!r&&r.data.id.rowCount/t.atomicConformation.atomId.rowCount>.95},e.getAtomIndexFromEntries=function(e){for(var t=new Map,r=0,n=e;r<n.length;r++){var i=n[r],a=i.partnerA.atomIndex,o=i.partnerB.atomIndex;t.has(a)?t.get(a).push(i):t.set(a,[i]),t.has(o)?t.get(o).push(i):t.set(o,[i])}return t},e.getEntriesFromStructConn=function(e,t){for(var r=e.conn_type_id,n=e.pdbx_dist_value,i=e.pdbx_value_order,a={label_asym_id:e.ptnr1_label_asym_id,label_seq_id:e.ptnr1_label_seq_id,auth_seq_id:e.ptnr1_auth_seq_id,label_atom_id:e.ptnr1_label_atom_id,label_alt_id:e.pdbx_ptnr1_label_alt_id,ins_code:e.pdbx_ptnr1_PDB_ins_code,symmetry:e.ptnr1_symmetry},o={label_asym_id:e.ptnr2_label_asym_id,label_seq_id:e.ptnr2_label_seq_id,auth_seq_id:e.ptnr2_auth_seq_id,label_atom_id:e.ptnr2_label_atom_id,label_alt_id:e.pdbx_ptnr2_label_alt_id,ins_code:e.pdbx_ptnr2_PDB_ins_code,symmetry:e.ptnr2_symmetry},s=Array.from(t.entities.data.id.toArray()),u=function(e,r){if(0===r.label_asym_id.valueKind(e)){var n=r.label_asym_id.value(e),i=r.label_atom_id.value(e);if(i)for(var a=r.auth_seq_id.valueKind(e)===xv.ValueKind.Present?r.auth_seq_id.value(e):r.label_seq_id.value(e),o=r.ins_code.value(e),u=r.label_alt_id.value(e),c=0,l=s;c<l.length;c++){var d=l[c],f=t.atomicHierarchy.index.findResidue(d,n,a,o);if(!(f<0)){var h=t.atomicHierarchy.index.findAtomOnResidue(f,i,u);if(!(h<0))return{residueIndex:f,atomIndex:h,symmetry:r.symmetry.value(e)}}}}},c=[],l=0;l<e._rowCount;l++){var d=u(l,a),f=u(l,o);if(void 0!==d&&void 0!==f){var h=r.value(l),p=0,m=1;switch(i.value(l)||""){case"sing":m=1;break;case"doub":m=2;break;case"trip":m=3;break;case"quad":m=4;break;default:m=VL(e.ptnr1_label_comp_id.value(l),e.ptnr1_label_atom_id.value(l),e.ptnr2_label_comp_id.value(l),e.ptnr2_label_atom_id.value(l))}switch(h){case"covale":p=1;break;case"disulf":p=9;break;case"hydrog":p=4;break;case"metalc":p=2}c.push({rowIndex:l,flags:p,order:m,distance:n.value(l),partnerA:d,partnerB:f})}}return c}}(c$||={});var f$=Cg.distance;function h$(e,t,r,n,i,a,o){for(var s=new DF.EdgeBuilder(a,e,t),u=new Uint16Array(s.slotCount),c=new Int8Array(s.slotCount),l=new Uint32Array(s.slotCount),d=0,f=s.edgeCount;d<f;d++)s.addNextEdge(),s.assignProperty(u,n[d]),s.assignProperty(c,r[d]),s.assignProperty(l,i[d]);return s.createGraph({flags:u,order:c,key:l},{canRemap:o})}var p$=Cg(),m$=Cg();function g$(e,t,r){return e.conformation.position(t,p$),e.conformation.position(r,m$),f$(p$,m$)}var v$=new Set,y$=Cg.distance,b$=Cg.set,_$=Cg.squaredDistance,x$=Cg.transformMat4,S$=Cg(),w$=Cg();function A$(e,t,r,n){return e.conformation.position(t,S$),r.conformation.position(n,w$),y$(S$,w$)}var C$,T$=Og(),P$=Cg(),E$=Ac(Ac({},EL),{ignoreWater:!0,ignoreIon:!0});function M$(e){e.count=e.endVertex-e.startVertex;for(var t=e.isRingAtom,r=e.pred,n=e.color,i=e.depth,a=e.marked,o=0;o<e.count;o++)t[o]=0,r[o]=-1,a[o]=-1,n[o]=0,i[o]=0;e.currentColor=0,e.currentAltLoc="",e.hasAltLoc=!1}function k$(e){for(var t=e.depth,r=0;r<e.count;r++)t[r]=e.count+1}function I$(e,t){var r=e.bonds.offset,n=e.startVertex+t,i=r[n],a=r[n+1]-i;return!(a<=1||e.isRingAtom[t]&&2===a)}function D$(e,t,r){if(e.startVertex=t,e.endVertex=r,!(e.endVertex-e.startVertex<3)){e.currentRings=[];for(var n=e.unit.elements,i=[],a=e.startVertex;a<e.endVertex;a++)Hb(i,u=e.altLoc.value(n[a]));qb(i,"");var o=1;if(0===i.length)for(M$(e),a=0;a<e.count;a++)I$(e,a)&&(k$(e),o=R$(e,a,o));else for(var s=0;s<i.length;s++)for(M$(e),e.hasAltLoc=!0,e.currentAltLoc=i[s],a=0;a<e.count;a++){var u;I$(e,a)&&((u=e.altLoc.value(n[e.startVertex+a]))&&u!==e.currentAltLoc||(k$(e),o=R$(e,a,o)))}a=0;for(var c=e.currentRings.length;a<c;a++)e.rings.push(e.currentRings[a])}}function O$(e,t,r,n){if(r<t)return!1;for(var i=e.pred,a=e.color,o=e.left,s=e.right,u=++e.currentColor,c=t,l=0;l<5&&(a[c]=u,!((c=i[c])<0));l++);var d=0,f=0,h=!1,p=0;for(c=r,l=0;l<5;l++){if(a[c]===u){p=c,h=!0;break}if(s[f++]=c,(c=i[c])<0)break}if(!h)return!1;for(c=t,l=0;l<5&&(o[d++]=c,p!==c)&&!((c=i[c])<0);l++);var m=d+f;if(m<3)return!1;var g=new Int32Array(m),v=0;for(l=0;l<d;l++)g[v++]=e.startVertex+o[l],n[o[l]]=1;for(l=f-1;l>=0;
139l--)g[v++]=e.startVertex+s[l],n[s[l]]=1;vv(g);for(var y=0,b=e.currentRings.length;y<b;y++){var _=e.currentRings[y];if(g.length===_.length){if(PP.areEqual(g,_))return!1}else if(g.length>_.length&&PP.isSubset(g,_))return!1}return e.currentRings.push(PP.ofSortedArray(g)),!0}function R$(e,t,r){var n=e.bonds,i=e.startVertex,a=e.endVertex,o=e.isRingAtom,s=e.marked,u=e.queue,c=e.pred,l=e.depth,d=e.unit.elements,f=n.b,h=n.edgeProps.flags,p=n.offset;s[t]=r,l[t]=0,u[0]=t;for(var m=0,g=1;m<g;)for(var v=u[m++],y=l[v],b=i+v,_=p[b],x=p[b+1],S=_;S<x;S++){var w=f[S];if(!(w<i||w>=a)&&RN.isCovalent(h[S])){if(e.hasAltLoc){var A=e.altLoc.value(d[w]);if(A&&e.currentAltLoc!==A)continue}var C=w-i;if(s[C]!==r){var T=Math.min(l[C],y+1);T>5||(l[C]=T,s[C]=r,u[g++]=C,c[C]=v)}else if(c[C]!==v&&c[v]!==C&&O$(e,v,C,o))return r+1}}return r+1}function B$(e){for(var t=e.length,r=new Int32Array(2*t),n=0;n<r.length;n++)r[n]=-1;for(var i="",a="",o=0,s=1;s<r.length;s++){for(n=r[s-o-1];-1!==n&&(i=e[s%t])!==(a=e[(o+n+1)%t]);)i<a&&(o=s-n-1),n=r[n];-1===n&&(i=e[s%t])!==(a=e[(o+n+1)%t])?(i<a&&(o=s),r[s-o]=-1):r[s-o]=n+1}return o}function N$(e,t){var r,n=e.length,i=[];for(r=0;r<n-1;r++)i.push(e[(r+t)%n]),i.push("-");return i.push(e[(r+t)%n]),i.join("")}function F$(e,t){switch(e.kind){case 0:return e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[t]];case 1:case 2:var r=function(e,t){var r=e.coarseElements.entityKey[t],n=e.model.sequence.byEntityKey[r].sequence,i=e.coarseElements.seq_id_begin.value(t);return n.compId.value(i-1)}(e,t),n=e.model.properties.chemicalComponentMap.get(r);if(n)return cF(n.type,r)}return 0}!function(e){function t(e,t,r,n,i,a){return{kind:"bond-location",aStructure:e,aUnit:t,aIndex:r,bStructure:n,bUnit:i,bIndex:a}}function r(e,t){return e.aStructure.label===t.aStructure.label&&e.bStructure.label===t.bStructure.label&&e.aIndex===t.aIndex&&e.bIndex===t.bIndex&&e.aUnit.id===t.aUnit.id&&e.bUnit.id===t.bUnit.id}function n(e,t){return{kind:"bond-loci",structure:e,bonds:t}}e.Location=t,e.isLocation=function(e){return!!e&&"bond-location"===e.kind},e.areLocationsEqual=r,e.Loci=n,e.isLoci=function(e){return!!e&&"bond-loci"===e.kind},e.areLociEqual=function(e,t){if(e.structure!==t.structure||e.bonds.length!==t.bonds.length)return!1;for(var n=0,i=e.bonds.length;n<i;++n)if(!r(e.bonds[n],t.bonds[n]))return!1;return!0},e.isLociEmpty=function(e){return 0===e.bonds.length},e.remapLoci=function(e,r){if(r===e.structure)return e;var i=[];return e.bonds.forEach(function(n){var a=r.unitMap.get(n.aUnit.id);if(a){var o=r.unitMap.get(n.bUnit.id);if(o){var s=n.aUnit.elements[n.aIndex],u=PP.indexOf(a.elements,s);if(-1!==u){var c=n.bUnit.elements[n.bIndex],l=PP.indexOf(o.elements,c);-1!==l&&i.push(t(e.structure,a,u,e.structure,o,l))}}}}),n(r,i)},e.toStructureElementLoci=function(e){for(var t=[],r=new Map,n=0,i=e.bonds;n<i.length;n++){var a=i[n],o=a.aIndex,s=a.aUnit,u=a.bIndex,c=a.bUnit;s===c?r.has(s.id)?r.get(s.id).push(o,u):r.set(s.id,[o,u]):(r.has(s.id)?r.get(s.id).push(o):r.set(s.id,[o]),r.has(c.id)?r.get(c.id).push(u):r.set(c.id,[u]))}return r.forEach(function(r,n){t.push({unit:e.structure.unitMap.get(n),indices:PP.deduplicate(PP.ofUnsortedArray(r))})}),Az(e.structure,t)},e.toFirstStructureElementLoci=function(e){var t=e.bonds[0],r=t.aUnit,n=t.aIndex;return Az(e.structure,[{unit:r,indices:kP.ofSingleton(n)}])},e.getType=function(e,t){if(t.aUnit===t.bUnit){var r=t.aUnit.bonds,n=r.getEdgeIndex(t.aIndex,t.bIndex);return n<0?RN.create(0):RN.create(r.edgeProps.flags[n])}var i=e.interUnitBonds.getBondFromLocation(t);return i?RN.create(i.props.flag):RN.create(0)},e.getOrder=function(e,t){if(t.aUnit===t.bUnit){var r=t.aUnit.bonds,n=r.getEdgeIndex(t.aIndex,t.bIndex);return n<0?0:r.edgeProps.order[n]}var i=e.interUnitBonds.getBondFromLocation(t);return i?i.props.order:0},e.getIntraUnitBondCount=function(e){for(var t=0,r=0,n=e.units.length;r<n;++r){var i=e.units[r];tU.isAtomic(i)&&(t+=i.bonds.edgeCount)}return t},e.ElementBondIterator=function(){function e(){this.current={},this.hasNext=!1}return e.prototype.move=function(){return this.advance(),this.current},e.prototype.setElement=function(e,t,r){this.structure=e,this.unit=t,this.index=r,this.interBondIndices=e.interUnitBonds.getEdgeIndices(r,t.id),this.interBondCount=this.interBondIndices.length,this.interBondIndex=0,this.intraBondEnd=t.bonds.offset[r+1],this.intraBondIndex=t.bonds.offset[r],this.hasNext=this.interBondIndex<this.interBondCount||this.intraBondIndex<this.intraBondEnd},e.prototype.advance=function(){if(this.intraBondIndex<this.intraBondEnd)this.current.otherUnit=this.unit,this.current.otherIndex=this.unit.bonds.b[this.intraBondIndex],this.current.type=this.unit.bonds.edgeProps.flags[this.intraBondIndex],this.current.order=this.unit.bonds.edgeProps.order[this.intraBondIndex],this.intraBondIndex+=1;else{if(!(this.interBondIndex<this.interBondCount))return void(this.hasNext=!1);var e=this.structure.interUnitBonds.edges[this.interBondIndex];this.current.otherUnit=this.structure.unitMap.get(e.unitA===this.unit.id?e.unitB:e.unitA),this.current.otherIndex=e.indexA===this.index?e.indexB:e.indexA,this.current.type=e.props.flag,this.current.order=e.props.order,this.interBondIndex+=1}this.hasNext=this.interBondIndex<this.interBondCount||this.intraBondIndex<this.intraBondEnd},e}(),e.getBoundingSphere=function(e,t){return SM.fromPairProvider(e.bonds.length,function(t,r,n){var i=e.bonds[t],a=i.aUnit,o=i.aIndex,s=i.bUnit,u=i.bIndex;a.conformation.position(a.elements[o],r),s.conformation.position(s.elements[u],n)},t)}}(C$||={});var L$=new Set;function $$(e,t){var r=BN[e];if(void 0!==r){var n=r[t];if(void 0!==n)return n}return L$}var U$=Cg.zero();function j$(e,t){for(var r=e.conformation.position,n=new Float32Array(3*t.length),i=e.elements,a=0,o=t.length;a<o;++a)r(i[t[a]],U$),Cg.toArray(U$,n,3*a);return n}var z$,G$,V$=function(){function e(e,t){this.unit=t,this.all=e}return Object.defineProperty(e.prototype,"index",{get:function(){return this._index||=function(e,t){for(var r=new Map,n=new Map,i=0,a=e.length;i<a;i++)for(var o=0,s=(f=e[i]).length;o<s;o++){var u=f[o];r.has(u)?r.get(u).push(i):r.set(u,[i])}for(var c=0,l=t.length;c<l;c++)for(o=0,s=(f=e[i=t[c]]).length;o<s;
139o++)u=f[o],n.has(u)?n.get(u).push(i):n.set(u,[i]);var d=new DF.UniqueEdgeBuilder(e.length);for(i=0,a=e.length;i<a;i++){var f;for(o=0,s=(f=e[i]).length;o<s;o++){u=f[o];var h=r.get(u);if(1!==h.length)for(var p=0,m=h.length;p<m;p++){var g=h[p];i>=g||d.addEdge(i,g)}}}var v=DF.connectedComponents(d.getGraph()),y=v.componentIndex,b=[];for(o=0;o<v.componentCount;o++)b[o]=[];for(i=0,a=e.length;i<a;i++)b[y[i]].push(i);return{elementRingIndices:r,elementAromaticRingIndices:n,ringComponentIndex:y,ringComponents:b}}(this.all,this.aromaticRings),this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"byFingerprint",{get:function(){return this._byFingerprint||=function(e,t){for(var r=new Map,n=0,i=0,a=t.length;i<a;i++){var o=t[i],s=z$.fingerprint(e,o);r.has(s)?r.get(s).push(n):r.set(s,[n]),n++}return r}(this.unit,this.all),this._byFingerprint},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elementRingIndices",{get:function(){return this.index.elementRingIndices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elementAromaticRingIndices",{get:function(){return this.index.elementAromaticRingIndices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ringComponentIndex",{get:function(){return this.index.ringComponentIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ringComponents",{get:function(){return this.index.ringComponents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aromaticRings",{get:function(){return this._aromaticRings||=function(e,t){for(var r=[],n=0,i=t.length;n<i;++n)z$.isAromatic(e,t[n])&&r.push(n);return r}(this.unit,this.all),this._aromaticRings},enumerable:!1,configurable:!0}),e}();function H$(e,t){for(var r=e.elements,n=e.model.atomicHierarchy.residueAtomSegments.index,i=n[r[t[0]]],a=1,o=t.length;a<o;a++)if(i!==n[r[t[a]]])return-1;return i}function q$(e,t,r){var n=e.byFingerprint.get(t);if(n)for(var i=0,a=n.length;i<a;i++){var o=n[i],s=H$(e.unit,e.all[o]);s>=0&&(r.has(s)?r.get(s).push(o):r.set(s,[o]))}}(function(e){function t(e){return function(e){for(var t=e.length,r=Array(t),n=0;n<t;n++)r[n]=e[t-n-1];var i=B$(e),a=B$(r),o=!1;for(n=0;n<t;n++){var s=e[(n+i)%t],u=r[(n+a)%t];if(s!==u){o=s<u;break}}return o?N$(e,i):N$(r,a)}(e)}e.fingerprint=function(e,r){for(var n=e.elements,i=e.model.atomicHierarchy.atoms.type_symbol,a=[],o=0,s=r.length;o<s;o++)a[a.length]=i.value(n[r[o]]);return t(a)},e.elementFingerprint=t;var r=new Set(["B","C","N","O","SI","P","S","GE","AS","SN","SB","BI"]);e.isAromatic=function(e,t){var n=e.elements,i=e.bonds,a=i.b,o=i.offset,s=i.edgeProps.flags,u=e.model.atomicHierarchy.atoms,c=u.type_symbol;if("PRO"===u.label_comp_id.value(e.elements[t[0]]))return!1;for(var l=0,d=!1,f=0,h=t.length;f<h;++f){var p=t[f];!d&&r.has(c.value(n[p]))&&(d=!0);for(var m=o[p],g=o[p+1];m<g;++m)RN.is(16,s[m])&&PP.has(t,a[m])&&(l+=1)}if(l===2*t.length)return!0;if(!d||t.length<5||l>0)return!1;var v=zE.calculateMomentsAxes(j$(e,t));return Cg.magnitude(v.dirC)<.05},e.getAltId=function(e,t){for(var r=e.model.atomicHierarchy.atoms.label_alt_id,n=e.elements,i=0,a=t.length;i<a;++i){var o=n[t[i]],s=r.value(o);if(s)return s}return""}})(z$||={}),function(e){e.create=function(t){return new e(function(e){for(var t=function(e,t){return{startVertex:0,endVertex:0,count:0,isRingAtom:new Int32Array(t),marked:new Int32Array(t),queue:new Int32Array(t),pred:new Int32Array(t),depth:new Int32Array(t),left:new Int32Array(5),right:new Int32Array(5),color:new Int32Array(t),currentColor:0,currentAltLoc:"",hasAltLoc:!1,rings:[],currentRings:[],unit:e,bonds:e.bonds,altLoc:e.model.atomicHierarchy.atoms.label_alt_id}}(e,function(e){for(var t=fE.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),r=0;t.hasNext;){var n=t.move();r=Math.max(r,n.end-n.start)}return r}(e)),r=fE.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements);r.hasNext;){var n=r.move();D$(t,n.start,n.end)}return t.rings}(t),t)},e.byFingerprintAndResidue=function(e,t){for(var r=new Map,n=0,i=t.length;n<i;n++)q$(e,t[n],r);return r}}(V$||={}),function(e){function t(e){return e[e.length-1]}function r(e){return e.length/2}function n(e,t){return e[2*t]}function i(e,t){return e[2*t+1]+1}function a(e,t){return e[2*t]}function o(e,t){return e[2*t+1]}function s(e,t){return u(e,t,0)}function u(e,n,i){if(a(e,i)>kP.max(n)||t(e)<kP.min(n))return-1;for(var s=i,u=r(e);s<u;++s){var c=$T.ofRange(a(e,s),o(e,s));if(kP.areIntersecting(c,n))return s}return-1}e.ofSortedRanges=function(e){return PP.ofSortedArray(e)},e.start=function(e){return e[0]},e.end=function(e){return e[e.length-1]+1},e.min=function(e){return e[0]},e.max=t,e.size=function(e){for(var t=0,r=0,n=e.length;r<n;r+=2)t+=e[r+1]-e[r]+1;return t},e.count=r,e.startAt=n,e.endAt=i,e.minAt=a,e.maxAt=o,e.areEqual=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;++r)if(e[r]!==t[r])return!1;return!0},e.forEach=function(e,t){for(var r=0,n=0,i=e.length;n<i;n+=2)for(var a=e[n],o=e[n+1];a<=o;++a)t(a,r),++r},e.has=function(e,t){return-1!==s(e,t)},e.hasFrom=function(e,t,r){return-1!==u(e,t,r)},e.firstIntersectionIndex=s,e.firstIntersectionIndexFrom=u,e.transientSegments=function(e,t){return new c(e,t)};var c=function(){function e(e,t){this.ranges=e,this.set=t,this.value={index:0,start:0,end:0},this.curIndex=0,this.hasNext=!1,this.curIndex=s(e,t),this.hasNext=-1!==this.curIndex}return e.prototype.updateValue=function(){this.value.index=this.curIndex,this.value.start=kP.findPredecessorIndex(this.set,n(this.ranges,this.curIndex)),this.value.end=kP.findPredecessorIndex(this.set,i(this.ranges,this.curIndex))},e.prototype.move=function(){return this.hasNext&&=(this.updateV
139alue(),this.curIndex=u(this.ranges,this.set,this.curIndex+1),-1!==this.curIndex),this.value},e}();e.Iterator=c}(G$||={});var W$=Cg.zero();function X$(e){var t=function(e){for(var t=e.conformation.invariantPosition,r=e.elements,n=new Float32Array(3*r.length),i=0,a=r.length;i<a;i++)t(r[i],W$),Cg.toArray(W$,n,3*i);return n}(e);return zE.ofPositions(t)}var Y$=Cg.set,K$=new PM("14"),Z$=new PM("98");function Q$(e){var t=YE.computeBounding(e);return{box:t,sphere:XE.fromBox3D(XE(),t)}}var J$=Cg();function eU(e){var t=e.x,r=e.y,n=e.z,i=e.radius,a=e.indices,o=kP.size(a);if(o>25e4)return Q$(e);var s=function(e){return e>1e4?K$:Z$}(o);s.reset();for(var u=0;u<o;u++){var c=kP.getAt(a,u);Y$(J$,t[c],r[c],n[c]),s.includePositionRadius(J$,i&&i[c]||0)}for(s.finishedIncludeStep(),u=0;u<o;u++)c=kP.getAt(a,u),Y$(J$,t[c],r[c],n[c]),s.radiusPositionRadius(J$,i&&i[c]||0);var l=s.getSphere();if(!i&&XE.hasExtrema(l)&&o<=l.extrema.length){var d=[];for(u=0;u<o;u++)c=kP.getAt(a,u),d.push(Cg.create(t[c],r[c],n[c]));XE.setExtrema(l,d)}return{box:s.getBox(),sphere:l}}var tU,rU,nU=function(){function e(){this.data=new Map}return e.prototype.get=function(e){var t=PP.hashCode(e);if(this.data.has(t))for(var r=0,n=this.data.get(t);r<n.length;r++){var i=n[r],a=i[0],o=i[1];if(PP.areEqual(e,a))return o}},e.prototype.set=function(e,t){var r=PP.hashCode(e);if(this.data.has(r)){for(var n=this.data.get(r),i=0,a=n;i<a.length;i++){var o=a[i];if(PP.areEqual(e,o[0]))return void(o[1]=t)}n.push([e,t])}else this.data.set(r,[[e,t]])},e.get=function(t){return t._dynamicPropertyData.ElementSetIntraBondCache||(t._dynamicPropertyData.ElementSetIntraBondCache=new e),t._dynamicPropertyData.ElementSetIntraBondCache},e}();function iU(e){var t=e.bonds,r=t.b,n=t.edgeProps,i=t.offset;n.order;for(var a=n.flags,o=e.rings.elementAromaticRingIndices,s=[],u=new Map,c=new Map,l=function(e,t,r){var n=s.length;s.push(PP.ofUnsortedArray([e,t,r])),u.set(Mv(e,t),r),c.has(e)?c.get(e).push(n):c.set(e,[n])},d=0;d<e.elements.length;d++)if(!(o.has(d)||i[d+1]-i[d]+1<2)){for(var f=[],h=i[d],p=i[d+1];h<p;h++){var m=a[h];RN.is(m,16)&&f.push(r[h])}if(f.length>=2){l(d,f[0],f[1]);for(var g=1,v=f.length;g<v;g++)l(d,f[g],f[0])}}return{getThirdElement:function(e,t){return u.get(Mv(e,t))},getTripletIndices:function(e){return c.get(e)},triplets:s}}function aU(){return{result:rU.create(),closeUnitsResult:UE.create(),unitGroupResult:UE.create()}}(function(e){var t,r,n;function i(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(e[r].id);return Iv(t)}function a(e){var t={};return{elements:e[0].elements,units:e,get unitIndexMap(){return t.unitIndexMap||=function(e){for(var t=mE.Mutable(),r=0,n=e.length;r<n;r++)t.set(e[r].id,r);return t}(e),t.unitIndexMap},hashCode:o(e[0]),transformHash:i(e)}}function o(e){return Tv(e.invariantId,PP.hashCode(e.elements))}(t=e.Kinds||={})[t.Atomic=0]="Atomic",t[t.Spheres=1]="Spheres",t[t.Gaussians=2]="Gaussians",e.isAtomic=function(e){return 0===e.kind},e.isCoarse=function(e){return 1===e.kind||2===e.kind},e.isSpheres=function(e){return 1===e.kind},e.isGaussians=function(e){return 2===e.kind},e.create=function(e,t,r,n,i,a,o,u,c){switch(i){case 0:return new s(e,t,r,n,a,u,AE.createMapping(o,a.atomicConformation),c??{});case 1:return d(e,t,r,n,a,1,u,AE.createMapping(o,a.coarseConformation.spheres,function(e){var t=e.coarseConformation.spheres.radius;return function(e){return t[e]}}(a)),c??{});case 2:return d(e,t,r,n,a,2,u,AE.createMapping(o,a.coarseConformation.gaussians,function(e){return 0}),c??{})}},e.SymmetryGroup=a,function(e){e.areInvariantElementsEqual=function(e,t){return e.hashCode===t.hashCode&&PP.areEqual(e.elements,t.elements)},e.getUnitSymmetryGroupsIndexMap=function(e){for(var t=mE.Mutable(),r=0,n=e.length;r<n;++r)for(var i=e[r],a=0,o=i.units.length;a<o;++a)t.set(i.units[a].id,r);return t}}(a=e.SymmetryGroup||={}),e.conformationId=function(t){return e.isAtomic(t)?t.model.atomicConformation.id:t.model.coarseConformation.id},e.hashUnit=o,function(e){e[e.None=0]="None",e[e.MultiChain=1]="MultiChain",e[e.Partitioned=2]="Partitioned",e[e.FastBoundary=4]="FastBoundary"}(r=e.Trait||={}),function(e){e.is=Sd.has,e.create=Sd.create}(n=e.Traits||={});var s=function(){function t(e,t,r,n,i,a,o,s){this.kind=0,this.objectPrimitive="atomistic",this.id=e,this.invariantId=t,this.chainGroupId=r,this.traits=n,this.model=i,this.elements=a,this.conformation=o,this.residueIndex=i.atomicHierarchy.residueAtomSegments.index,this.chainIndex=i.atomicHierarchy.chainAtomSegments.index,this.props=s}return t.prototype.getChild=function(e){return e.length===this.elements.length?this:new t(this.id,this.invariantId,this.chainGroupId,this.traits,this.model,e,this.conformation,{})},t.prototype.applyOperator=function(e,r,n){void 0===n&&(n=!1);var i=n?r:AE.compose(this.conformation.operator,r);return new t(e,this.invariantId,this.chainGroupId,this.traits,this.model,this.elements,AE.createMapping(i,this.model.atomicConformation,this.conformation.r),this.props)},t.prototype.remapModel=function(r,n,i){i||(i=Ac(Ac({},this.props),{bonds:n&&!this.props.bonds?.props?.canRemap?void 0:f(this,this.props.bonds,r,n)}
139),e.isSameConformation(this,r)||(i.boundary=void 0,i.lookup3d=void 0,i.principalAxes=void 0));var a=this.conformation.operator,o=Dz.Provider.get(r);if(-1!==a.spgrOp&&o&&o!==Dz.Provider.get(this.model)){var s=a.hkl,u=s[0],c=s[1],l=s[2],d=o.spacegroup.cell.toFractional,h=Cg.transformMat4(Cg(),Xz.getCenter(r),d);a=$E.getSymmetryOperatorRef(o.spacegroup,a.spgrOp,u,c,l,h)}var p=this.model.atomicConformation!==r.atomicConformation||a!==this.conformation.operator?AE.createMapping(a,r.atomicConformation):this.conformation;return new t(this.id,this.invariantId,this.chainGroupId,this.traits,r,this.elements,p,i)},Object.defineProperty(t.prototype,"boundary",{get:function(){if(this.props.boundary)return this.props.boundary;var e=this.model.atomicConformation,t=e.x,i=e.y,a=e.z;return this.props.boundary=n.is(this.traits,r.FastBoundary)?Q$({x:t,y:i,z:a,indices:this.elements}):eU({x:t,y:i,z:a,indices:this.elements}),this.props.boundary},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lookup3d",{get:function(){if(this.props.lookup3d)return this.props.lookup3d;var e=this.model.atomicConformation,t=e.x,r=e.y,n=e.z;return this.props.lookup3d=JE({x:t,y:r,z:n,indices:this.elements},this.boundary),this.props.lookup3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"principalAxes",{get:function(){return this.props.principalAxes||(this.props.principalAxes=X$(this)),this.props.principalAxes},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bonds",{get:function(){if(this.props.bonds)return this.props.bonds;var e=nU.get(this.model),t=e.get(this.elements);return t||(t=function(e){var t=Ac(Ac({},EL),void 0);return t.noCompute||Xz.isCoarseGrained(e.model)&&!LF.Provider.get(e.model)&&!c$.isExhaustive(e.model)?CL.Empty:!t.forceCompute&&LF.Provider.get(e.model)?function(e){for(var t=LF.Provider.get(e.model),r=e.elements,n=e.model.atomicHierarchy.atoms.type_symbol,i=e.elements.length,a=t.maxDistance,o=t.bonds,s=o.offset,u=o.b,c=o.edgeProps,l=c.order,d=c.distance,f=c.flag,h=c.key,p=c.operatorA,m=c.operatorB,g=e.model.atomicHierarchy.atomSourceIndex,v=Xz.getInvertedAtomSourceIndex(e.model).invertedIndex,y=[],b=[],_=[],x=[],S=[],w=e.conformation.operator.key,A=0;A<i;A++)for(var C=r[A],T=OL(n.value(C)),P=FL(T),E=g.value(C),M=s[E],k=s[E+1];M<k;++M){var I=v[u[M]];if(!(C>=I)){var D=PP.indexOf(e.elements,I);if(!(D<0)){var O=p[M],R=m[M];if(!(O>=0&&O!==w||R>=0&&R!==w)){var B=OL(n.value(I)),N=d[M],F=g$(e,C,I),L=!1;N>=0?L=yg(F,N,.3):a>=0?L=F<a:(L=F<BL(T,B,RL(T),RL(B)),P&&FL(B)&&(L=!1)),L&&(y[y.length]=A,b[b.length]=D,x[x.length]=l[M],_[_.length]=f[M],S[S.length]=h[M])}}}}return h$(y,b,x,_,S,i,!1)}(e):function(e,t){for(var r=t.maxRadius,n=e.model.atomicConformation,i=n.x,a=n.y,o=n.z,s=e.elements.length,u=e.elements,c=e.residueIndex,l=e.chainIndex,d=e.model.atomicHierarchy.atoms,f=d.type_symbol,h=d.label_atom_id,p=d.label_alt_id,m=d.label_comp_id,g=e.model.atomicHierarchy.residues.label_seq_id,v=e.model.atomicHierarchy.index,y=e.model.sequence.byEntityKey,b=e.lookup3d,_=c$.Provider.get(e.model),x=u$.Provider.get(e.model),S=c$.isExhaustive(e.model),w=[],A=[],C=[],T=[],P=[],E=-1,M=void 0,k=!0,I=!0,D=!0,O=v$,R=0;R<s;R++){var B=u[R],N=f.value(B);k&&"H"!==N&&"O"!==N&&(k=!1);var F=t.forceCompute?void 0:_&&_.byAtomIndex.get(B),L=!1;if(F)for(var $=0,U=F;$<U.length;$++){var j=U[$],z=j.partnerA,G=j.partnerB;if(z.symmetry===G.symmetry){var V=z.atomIndex===B?G:z;(se=PP.indexOf(e.elements,V.atomIndex))<0||u[se]<B||(w[w.length]=R,A[A.length]=se,C[C.length]=j.flags,T[T.length]=j.order,P[P.length]=j.rowIndex,L||O.clear(),L=!0,O.add(se))}}if(!S){var H=c[B],q=g.value(H),W=m.value(B);if(!t.forceCompute&&H!==E)if(x&&x.entries.has(W)){var X=y[v.getEntityFromChain(l[B])];M=X&&X.sequence.microHet.has(q)?void 0:x.entries.get(W).map}else M=void 0;E=H;for(var Y=OL(N),K=h.value(B),Z=M?M.get(K):void 0,Q=b.find(i[B],a[B],o[B],r),J=Q.indices,ee=Q.count,te=Q.squaredDistances,re=FL(Y),ne=RL(Y),ie=p.value(B),ae=DL.has(Y),oe=0;oe<ee;oe++){var se=J[oe];if(!L||!O.has(se)){var ue=u[se];if(!(ue<=B)){var ce=p.value(ue);if(!ie||!ce||ie===ce){var le=OL(f.value(ue)),de=FL(le);if(!re||!de){var fe=(ae||DL.has(le))&&!(re||de),he=c[ue];if(H===he&&Z){var pe=Z.get(h.value(ue));if(pe){w[w.length]=R,A[A.length]=se,T[T.length]=pe.order;var me=pe.flags;fe&&(1|me&&(me^=1),me|=2),C[C.length]=me,P[P.length]=pe.key}}else{var ge=Math.sqrt(te[oe]);if(0!==ge&&ge<=BL(Y,le,ne,RL(le))){w[w.length]=R,A[A.length]=se,T[T.length]=$L(W,K,h.value(ue)),C[C.length]=32|(fe?2:1),P[P.length]=-1;var ve=g.value(he);q===ve&&(I=!1),Math.abs(q-ve)>1&&(D=!1)}}}}}}}}}return h$(w,A,T,C,P,s,k||I&&D)}(e,t)}(this),e.set(this.elements,t)),this.props.bonds=t,this.props.bonds}
139,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rings",{get:function(){return this.props.rings||(this.props.rings=V$.create(this)),this.props.rings},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resonance",{get:function(){return this.props.resonance||(this.props.resonance=function(e){return{delocalizedTriplets:iU(e)}}(this)),this.props.resonance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polymerElements",{get:function(){return this.props.polymerElements||(this.props.polymerElements=function(e){for(var t=[],r=e.elements,n=e.model,i=e.model.atomicHierarchy.residueAtomSegments,a=n.atomicHierarchy.derived.residue.traceElementIndex,o=G$.transientSegments(e.model.atomicRanges.polymerRanges,r),s=fE.transientSegments(i,r);o.hasNext;){var u=o.move();for(s.setSegment(u);s.hasNext;){var c=s.move(),l=c.start,d=c.end,f=c.index;if(kP.areIntersecting($T.ofRange(r[l],r[d-1]),r)){var h=a[f];t.push(-1===h?i.offsets[f]:h)}}}return PP.ofSortedArray(t)}(this)),this.props.polymerElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gapElements",{get:function(){return this.props.gapElements||(this.props.gapElements=function(e){for(var t=[],r=e.elements,n=e.model,i=e.residueIndex,a=e.model.atomicHierarchy.residueAtomSegments,o=n.atomicHierarchy.derived.residue.traceElementIndex,s=G$.transientSegments(e.model.atomicRanges.gapRanges,e.elements);s.hasNext;){var u=s.move(),c=i[r[u.start]],l=i[r[u.end-1]],d=o[c],f=o[l];t.push(-1===d?a.offsets[c]:d),t.push(-1===f?a.offsets[l]:f)}return PP.ofSortedArray(t)}(this)),this.props.gapElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nucleotideElements",{get:function(){return this.props.nucleotideElements||(this.props.nucleotideElements=function(e){for(var t=[],r=e.elements,n=e.model,i=n.atomicHierarchy,a=i.chainAtomSegments,o=i.residueAtomSegments,s=n.atomicHierarchy.derived.residue,u=s.moleculeType,c=s.traceElementIndex,l=fE.transientSegments(a,r),d=fE.transientSegments(o,r);l.hasNext;
139)for(d.setSegment(l.move());d.hasNext;){var f=d.move().index;if(mF(u[f])){var h=c[f];t.push(-1===h?o.offsets[f]:h)}}return PP.ofSortedArray(t)}(this)),this.props.nucleotideElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"proteinElements",{get:function(){return this.props.proteinElements||(this.props.proteinElements=function(e){for(var t=[],r=e.elements,n=e.model,i=n.atomicHierarchy,a=i.chainAtomSegments,o=i.residueAtomSegments,s=n.atomicHierarchy.derived.residue,u=s.moleculeType,c=s.traceElementIndex,l=fE.transientSegments(a,r),d=fE.transientSegments(o,r);l.hasNext;)for(d.setSegment(l.move());d.hasNext;){var f=d.move().index;if(gF(u[f])){var h=c[f];t.push(-1===h?o.offsets[f]:h)}}return PP.ofSortedArray(t)}(this)),this.props.proteinElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"residueCount",{get:function(){if(void 0!==this.props.residueCount)return this.props.residueCount;for(var e=0,t=fE.transientSegments(this.model.atomicHierarchy.residueAtomSegments,this.elements);t.hasNext;)t.move(),e+=1;return this.props.residueCount=e,this.props.residueCount},enumerable:!1,configurable:!0}),t.prototype.getResidueIndex=function(e){return this.residueIndex[this.elements[e]]},t}();e.Atomic=s;var u=function(){function t(e,t,r,n,i,a,o,s,u){this.kind=a,this.objectPrimitive=1===a?"sphere":"gaussian",this.id=e,this.invariantId=t,this.chainGroupId=r,this.traits=n,this.model=i,this.elements=o,this.conformation=s,this.coarseElements=1===a?i.coarseHierarchy.spheres:i.coarseHierarchy.gaussians,this.coarseConformation=1===a?i.coarseConformation.spheres:i.coarseConformation.gaussians,this.props=u}return t.prototype.getChild=function(e){return e.length===this.elements.length?this:d(this.id,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,e,this.conformation,{})},t.prototype.applyOperator=function(e,t,r){void 0===r&&(r=!1);var n=r?t:AE.compose(this.conformation.operator,t);return d(e,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,this.elements,AE.createMapping(n,this.getCoarseConformation(),this.conformation.r),this.props)},t.prototype.remapModel=function(r,n,i){var a=this.getCoarseConformation(),o=c(this.kind,r);i||(i=Ac({},this.props),e.isSameConformation(this,r)||(i.boundary=void 0,i.lookup3d=void 0,i.principalAxes=void 0));var s=a===o?this.conformation:AE.createMapping(this.conformation.operator,o);return new t(this.id,this.invariantId,this.chainGroupId,this.traits,r,this.kind,this.elements,s,i)},Object.defineProperty(t.prototype,"boundary",{get:function(){if(this.props.boundary)return this.props.boundary;var e=this.getCoarseConformation(),t=e.x,i=e.y,a=e.z;return this.props.boundary=n.is(this.traits,r.FastBoundary)?Q$({x:t,y:i,z:a,indices:this.elements}):eU({x:t,y:i,z:a,indices:this.elements}),this.props.boundary},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lookup3d",{get:function(){if(this.props.lookup3d)return this.props.lookup3d;var e=this.getCoarseConformation(),t=e.x,r=e.y,n=e.z;return this.props.lookup3d=JE({x:t,y:r,z:n,indices:this.elements},this.boundary),this.props.lookup3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"principalAxes",{get:function(){return this.props.principalAxes||(this.props.principalAxes=X$(this)),this.props.principalAxes},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polymerElements",{get:function(){return this.props.polymerElements||(this.props.polymerElements=function(e){for(var t=[],r=e.elements,n=e.model.coarseHierarchy,i=n.spheres,a=n.gaussians,o=tU.isSpheres(e)?i.polymerRanges:a.polymerRanges,s=G$.transientSegments(o,r);s.hasNext;)for(var u=s.move(),c=u.start,l=u.end,d=c;d<l;++d)t.push(r[d]);return PP.ofSortedArray(t)}(this)),this.props.polymerElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gapElements",{get:function(){return this.props.gapElements||(this.props.gapElements=function(e){for(var t=[],r=e.elements,n=e.model.coarseHierarchy,i=n.spheres,a=n.gaussians,o=tU.isSpheres(e)?i.gapRanges:a.gapRanges,s=G$.transientSegments(o,r);s.hasNext;){var u=s.move(),c=u.start,l=u.end;t.push(r[c],r[l-1])}return PP.ofSortedArray(t)}(this)),this.props.gapElements}
139,enumerable:!1,configurable:!0}),t.prototype.getCoarseConformation=function(){return c(this.kind,this.model)},t}();function c(e,t){return 1===e?t.coarseConformation.spheres:t.coarseConformation.gaussians}e.Spheres=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(u);var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(u);function d(e,t,r,n,i,a,o,s,c){return new u(e,t,r,n,i,a,o,s,c)}function f(e,t,r,n){if(t){if(e.model.atomicConformation.id===r.atomicConformation.id)return t;var i=LF.Provider.get(e.model);if(i){var a=LF.Provider.get(r);return a&&i!==a?void 0:t}return t.props?.canRemap||!n||h(e,r)?t:void 0}}function h(e,t){var r=Xz.CoordinatesHistory.get(Xz.getRoot(t));if(r)return r.areEqual(e.elements,e.kind,t);for(var n=e.elements,i=e.conformation.coordinates,a=i.x,o=i.y,s=i.z,u=p(e.kind,t),c=u.x,l=u.y,d=u.z,f=0,h=n.length;f<h;f++){var m=n[f];if(a[m]!==c[m]||o[m]!==l[m]||s[m]!==d[m])return!1}return!0}function p(e,t){return 0===e?t.atomicConformation:1===e?t.coarseConformation.spheres:t.coarseConformation.gaussians}function m(e,t){return 0===e?t.atomicHierarchy:1===e?t.coarseHierarchy.spheres:t.coarseHierarchy.gaussians}e.Gaussians=l,e.areSameChainOperatorGroup=function(e,t){return e.chainGroupId===t.chainGroupId&&e.conformation.operator.name===t.conformation.operator.name},e.areOperatorsEqual=function(e,t){return Og.areEqual(e.conformation.operator.matrix,t.conformation.operator.matrix,1e-6)},e.areConformationsEqual=function(e,t){return e===t||!!PP.areEqual(e.elements,t.elements)&&h(e,t.model)},e.isSameConformation=h,e.getModelConformationOfKind=p,e.getConformation=function(e){return p(e.kind,e.model)},e.getModelHierarchyOfKind=m,e.getHierarchy=function(e){return m(e.kind,e.model)}})(tU||={}),function(e){e.add=function(e,t,r,n){e.indices[e.count]=r,e.units[e.count]=t,e.squaredDistances[e.count]=n,e.count++},e.create=function(){return{count:0,indices:[],units:[],squaredDistances:[]}},e.copy=function(e,t){for(var r=0;r<t.count;++r)e.indices[r]=t.indices[r],e.units[r]=t.units[r],e.squaredDistances[r]=t.squaredDistances[r];return e.count=t.count,e}}(rU||={});var oU,sU,uU=function(){function e(e){this.structure=e,this.pivot=Cg(),this.heap=new QE,this.findContext=aU();for(var t=e.units,r=e.boundary,n=t.length,i=new Float32Array(n),a=new Float32Array(n),o=new Float32Array(n),s=new Float32Array(n),u=Cg(),c=0;c<n;c++){var l=t[c],d=l.boundary.sphere;Cg.transformMat4(u,d.center,l.conformation.operator.matrix),i[c]=u[0],a[c]=u[1],o[c]=u[2],s[c]=d.radius}var f={x:i,y:a,z:o,radius:s,indices:kP.ofBounds(0,n)};this.unitLookup=JE(f,r)}return e.prototype.findUnitIndices=function(e,t,r,n){return this.unitLookup.find(e,t,r,n)},e.prototype.find=function(e,t,r,n,i){return this._find(e,t,r,n,i??this.findContext)},e.prototype._find=function(e,t,r,n,i){UE.reset(i.result);var a=this.structure.units,o=this.unitLookup.find(e,t,r,n,i.closeUnitsResult);if(0===o.count)return i.result;for(var s=0,u=o.count;s<u;s++){var c=a[o.indices[s]];Cg.set(this.pivot,e,t,r),c.conformation.operator.isIdentity||Cg.transformMat4(this.pivot,this.pivot,c.conformation.operator.inverse);for(var l=c.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],n,i.unitGroupResult),d=0,f=l.count;d<f;d++)rU.add(i.result,c,l.indices[d],l.squaredDistances[d])}return i.result},e.prototype.nearest=function(e,t,r,n,i){return void 0===n&&(n=1),this._nearest(e,t,r,n,i??this.findContext)},e.prototype._nearest=function(e,t,r,n,i){var a=i.result,o=this.heap;UE.reset(a),o.clear();var s=this.structure.units,u=0,c=this.unitLookup.nearest(e,t,r,s.length,function(e){return(u+=s[e].elements.length)>=n},i.closeUnitsResult);if(0===c.count)return a;for(var l=0,d=-Number.MAX_VALUE,f=0,h=c.count;f<h;f++){var p=c.squaredDistances[f];if(l>=n&&d<p)break;Cg.set(this.pivot,e,t,r),(_=s[c.indices[f]]).conformation.operator.isIdentity||Cg.transformMat4(this.pivot,this.pivot,_.conformation.operator.inverse);var m=_.lookup3d.nearest(this.pivot[0],this.pivot[1],this.pivot[2],n,void 0,i.unitGroupResult);if(0!==m.count){l+=m.count,d=Math.max(d,m.squaredDistances[m.count-1]);for(var g=0,v=m.count;g<v;g++)o.insert(m.squaredDistances[g],{index:m.indices[g],unit:_})}}if(1===n){if(S=o.findMinimum()){var y=S.key,b=S.value,_=b.unit,x=b.index;rU.add(a,_,x,y)}}else for(;!o.isEmpty()&&a.count<n;){y=(S=o.extractMinimum()).key;var S,w=S.value;_=w.unit,x=w.index,rU.add(a,_,x,y)}return a},e.prototype.findIntoBuilder=function(e,t,r,n,i){var a=this.structure.units,o=this.unitLookup.find(e,t,r,n);if(0!==o.count)for(var s=0,u=o.count;s<u;s++){var c=a[o.indices[s]];Cg.set(this.pivot,e,t,r),c.conformation.operator.isIdentity||Cg.transformMat4(this.pivot,this.pivot,c.conformation.operator.inverse);var l=c.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],n);if(0!==l.count){var d=c.elements;
139i.beginUnit(c.id);for(var f=0,h=l.count;f<h;f++)i.addElement(d[l.indices[f]]);i.commitUnit()}}},e.prototype.findIntoBuilderIf=function(e,t,r,n,i,a){var o=this.structure.units,s=this.unitLookup.find(e,t,r,n);if(0!==s.count)for(var u=qF.create(this.structure),c=0,l=s.count;c<l;c++){var d=o[s.indices[c]];Cg.set(this.pivot,e,t,r),d.conformation.operator.isIdentity||Cg.transformMat4(this.pivot,this.pivot,d.conformation.operator.inverse);var f=d.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],n);if(0!==f.count){var h=d.elements;u.unit=d,i.beginUnit(d.id);for(var p=0,m=f.count;p<m;p++)u.element=h[f.indices[p]],a(u)&&i.addElement(u.element);i.commitUnit()}}},e.prototype.findIntoBuilderWithRadius=function(e,t,r,n,i,a,o,s){var u=this.structure.units,c=this.unitLookup.find(e,t,r,a);if(0!==c.count)for(var l=qF.create(this.structure),d=n+i+a,f=0,h=c.count;f<h;f++){var p=u[c.indices[f]];Cg.set(this.pivot,e,t,r),p.conformation.operator.isIdentity||Cg.transformMat4(this.pivot,this.pivot,p.conformation.operator.inverse);var m=p.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],d);if(0!==m.count){var g=p.elements;l.unit=p,s.beginUnit(p.id);for(var v=0,y=m.count;v<y;v++){l.element=g[m.indices[v]];var b=o(l);Math.sqrt(m.squaredDistances[v])-n-b>a||s.addElement(g[m.indices[v]])}s.commitUnit()}}},e.prototype.check=function(e,t,r,n){var i=this.structure.units,a=this.unitLookup.find(e,t,r,n);if(0===a.count)return!1;for(var o=0,s=a.count;o<s;o++){var u=i[a.indices[o]];if(Cg.set(this.pivot,e,t,r),u.conformation.operator.isIdentity||Cg.transformMat4(this.pivot,this.pivot,u.conformation.operator.inverse),u.lookup3d.check(this.pivot[0],this.pivot[1],this.pivot[2],n))return!0}return!1},Object.defineProperty(e.prototype,"boundary",{get:function(){return this.structure.boundary},enumerable:!1,configurable:!0}),e}();function cU(e,t){if(0===t.length)return yz.Empty;if(1===t.length)return t[0];for(var r=new Map,n=new Set,i=0,a=t;i<a.length;i++)for(var o=a[i].units,s=0,u=o.length;s<u;s++){var c=o[s];if(r.has(c.id)){if(n.has(c.id))continue;var l=PP.union(r.get(c.id),c.elements);r.set(c.id,l),l.length===e.unitMap.get(c.id).elements.length&&n.add(c.id)}else r.set(c.id,c.elements),c.elements.length===e.unitMap.get(c.id).elements.length&&n.add(c.id)}var d=e.subsetBuilder(!0);return r.forEach(lU,d),d.getStructure()}function lU(e,t){this.setUnit(t,e)}function dU(e,t){if(e===t)return!0;if(e.units.length!==t.units.length)return!1;for(var r=e.units,n=t.unitMap,i=0,a=r.length;i<a;i++){var o=r[i];if(!n.has(o.id))return!1;var s=n.get(o.id);if(!PP.areEqual(o.elements,s.elements))return!1}return!0}function fU(e,t){if(e===t)return!0;var r,n;e.units.length<t.units.length?(r=e,n=t):(r=t,n=e);for(var i=r.units,a=n.unitMap,o=0,s=i.length;o<s;o++){var u=i[o];if(a.has(u.id)){var c=a.get(u.id);if(PP.areIntersecting(u.elements,c.elements))return!0}}return!1}function hU(e,t){if(e===t)return e;if(!fU(e,t))return yz.Empty;var r,n;e.units.length<t.units.length?(r=e,n=t):(r=t,n=e);for(var i=r.units,a=n.unitMap,o=[],s=0,u=i.length;s<u;s++){var c=i[s];if(a.has(c.id)){var l=a.get(c.id);if(PP.areIntersecting(c.elements,l.elements)){var d=PP.intersect(c.elements,l.elements);o[o.length]=c.getChild(d)}}}return yz.create(o,{parent:e.parent||t.parent})}function pU(e,t){if(e===t)return yz.Empty;if(!fU(e,t))return e;for(var r=e.units,n=t.unitMap,i=[],a=0,o=r.length;a<o;a++){var s=r[a];if(n.has(s.id)){var u=n.get(s.id),c=PP.subtract(s.elements,u.elements);c.length>0&&(i[i.length]=s.getChild(c))}else i[i.length]=s}return yz.create(i,{parent:e.parent||t.parent})}function mU(e){return RN.isCovalent(e.atomicBond.type)}function gU(e,t,r){return{groupedUnits:e,ranges:t,set:r}}function vU(e){return function(t){var r={hash:t.inputStructure.hashCode,elements:e};return oU.Sequence(t.inputStructure,[sU.toStructure(r,t.inputStructure)])}}(function(e){function t(e,t){return{kind:"singletons",source:e,structure:t}}function r(e,t){return{kind:"sequence",source:e,structures:t}}function n(e){return t(e,yz.Empty)}function i(e){return"singletons"===e.kind}function a(e){return i(e)?0===e.structure.units.length:0===e.structures.length}function o(e){return a(e)?yz.Empty:i(e)?e.structure:cU(e.source,e.structures)}function s(e,i,a){return 0===i.length?n(e):a?t(e,cU(e,i)):r(e,i)}e.Singletons=t,e.Sequence=r,e.Empty=n,e.isSingleton=i,e.isEmpty=a,e.structureCount=function(e){return i(e)?e.structure.elementCount:e.structures.length}
139,e.unionStructure=o,e.toLociWithCurrentUnits=function(e){for(var t=[],r=e.source.unitMap,n=0,i=o(e).units;n<i.length;n++){var a=i[n];a===r.get(a.id)?t[t.length]={unit:a,indices:kP.ofBounds(0,a.elements.length)}:t[t.length]={unit:a,indices:kP.ofSortedArray(PP.indicesOf(r.get(a.id).elements,a.elements))}}return Az(e.source,t)},e.toLociWithSourceUnits=function(e){for(var t=[],r=e.source.unitMap,n=0,i=o(e).units;n<i.length;n++){var a=i[n],s=r.get(a.id);t[t.length]=s===a?{unit:s,indices:kP.ofBounds(0,s.elements.length)}:{unit:s,indices:kP.ofSortedArray(PP.indicesOf(s.elements,a.elements))}}return Az(e.source,t)};var u=function(){function e(e){this.source=e,this.structures=[],this.allSingletons=!0}return e.prototype.add=function(e){var t=e.elementCount;0!==t&&(this.structures[this.structures.length]=e,1!==t&&(this.allSingletons=!1))},e.prototype.getSelection=function(){return s(this.source,this.structures,this.allSingletons)},e}(),c=function(){function e(e){this.structure=e,this.structures=[],this.allSingletons=!0,this.uniqueSets=hS(yz.hashCode,yz.areUnitIdsAndIndicesEqual)}return e.prototype.add=function(e){var t=e.elementCount;0!==t&&this.uniqueSets.add(e)&&(this.structures[this.structures.length]=e,1!==t&&(this.allSingletons=!1))},e.prototype.getSelection=function(){return s(this.structure,this.structures,this.allSingletons)},e}();e.LinearBuilder=function(e){return new u(e)},e.UniqueBuilder=function(e){return new c(e)},e.forEach=function(t,r){var n=0;if(e.isSingleton(t))for(var i=0,a=t.structure.units;i<a.length;i++)for(var o=a[i],s=o.elements,u=0,c=s.length;u<c;u++)r(yz.create([o.getChild(PP.ofSingleton(s[u]))],{parent:t.source}),n++);else for(var l=0,d=t.structures;l<d.length;l++)r(d[l],n++)},e.withInputStructure=function(e,n){return i(e)?t(n,e.structure):r(n,e.structures)}})(oU||={}),function(e){function t(e){for(var t=[],r=0,n=e.elements;r<n.length;r++){var i=(m=n[r]).unit,a=m.indices;if(0!==kP.size(a)){var o=[],s=[];if(kP.isInterval(a))1===kP.size(a)?s.push($T.min(a)):o.push($T.min(a),$T.max(a));else for(var u=0,c=a.length;u<c;){var l=u;for(u++;u<c&&a[u-1]+1===a[u];)u++;var d=u;if(d-l>2)o.push(a[l],a[d-1]);else for(var f=l;f<d;f++)s[s.length]=a[f]}t.push({unit:i,set:PP.ofSortedArray(s),ranges:G$.ofSortedRanges(o)})}}for(var h=new Map,p=(u=0,t.length);u<p;++u){var m,g,v=Tv(Iv((m=t[u]).ranges),Iv(m.set));h.has(v)?(g=h.get(v).groupedUnits).has(m.unit.invariantId)?g.get(m.unit.invariantId).push(m.unit.id):g.set(m.unit.invariantId,[m.unit.id]):((g=new Map).set(m.unit.invariantId,[m.unit.id]),h.set(v,{groupedUnits:g,set:m.set,ranges:m.ranges}))}var y=[];return h.forEach(function(e){var t=[];e.groupedUnits.forEach(function(e){return t.push(PP.ofUnsortedArray(e))}),t.sort(function(e,t){return e[0]-t[0]}),y.push({groupedUnits:t,set:e.set,ranges:e.ranges})}),{hash:e.structure.hashCode,elements:y}}function r(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n];t.unitMap.has(a)&&r.push(t.unitMap.get(a))}return r}function n(e){return SL.internal.generator.bundleElement({groupedUnits:SL.core.type.list(e.groupedUnits.map(function(e){return SL.core.type.list(e)})),ranges:SL.core.type.list(e.ranges),set:SL.core.type.list(e.set)})}e.Empty={hash:-1,elements:[]},e.fromSubStructure=function(e,r){return t(oU.toLociWithSourceUnits(oU.Singletons(e,r)))},e.fromSelection=function(e){return t(oU.toLociWithSourceUnits(e))},e.fromLoci=t,e.toLoci=function(e,t){-1!==e.hash&&(e.hash,t.hashCode);for(var n=[],i=0,a=e.elements;i<a.length;i++)for(var o=a[i],s=function(e){var i=r(e,t);if(0===i.length)return"continue";var a=void 0;if(0===o.ranges.length)a=o.set;else if(0===o.set.length)if(2===o.ranges.length)a=$T.ofRange(o.ranges[0],o.ranges[1]);else{var s=new Int32Array(G$.size(o.ranges));G$.forEach(o.ranges,function(e,t){return s[t]=e}),a=PP.ofSortedArray(s)}else{var u=G$.size(o.ranges),c=new Int32Array(o.set.length+u);G$.forEach(o.ranges,function(e,t){return c[t]=e}),c.set(o.set,u),a=PP.ofUnsortedArray(c)}for(var l=0,d=i;l<d.length;l++){var f=d[l];n.push({unit:f,indices:a})}},u=0,c=o.groupedUnits;u<c.length;u++)s(c[u]);return Az(t,n)},e.toStructure=function(e,t){-1!==e.hash&&(e.hash,t.hashCode);for(var n=[],i=0,a=e.elements;i<a.length;i++)for(var o=a[i],s=function(e){var i=r(e,t);if(0===i.length)return"continue";var a=i[0].elements,s=G$.size(o.ranges),u=o.set.length,c=new Int32Array(u+s),l=void 0;if(0===s){for(var d=0,f=u;d<f;++d)c[d]=a[o.set[d]];l=PP.ofSortedArray(c)}else if(0===u)G$.forEach(o.ranges,function(e,t){return c[t]=a[e]}),l=PP.ofSortedArray(c);else if(PP.min(o.set)>G$.max(o.ranges)){for(G$.forEach(o.ranges,function(e,t){return c[t]=a[e]}),d=0,f=u;d<f;
139++d)c[d+s]=a[o.set[d]];l=PP.ofSortedArray(c)}else if(G$.min(o.ranges)>PP.max(o.set)){for(d=0,f=u;d<f;++d)c[d]=a[o.set[d]];G$.forEach(o.ranges,function(e,t){return c[t+u]=a[e]}),l=PP.ofSortedArray(c)}else{for(G$.forEach(o.ranges,function(e,t){return c[t]=a[e]}),d=0,f=u;d<f;++d)c[d+s]=a[o.set[d]];l=PP.ofUnsortedArray(c)}for(var h=0,p=i;h<p.length;h++){var m=p[h];n.push(m.getChild(l))}},u=0,c=o.groupedUnits;u<c.length;u++)s(c[u]);return yz.create(n,{parent:t})},e.toExpression=function(e){return SL.internal.generator.bundle({elements:SL.core.type.list(e.elements.map(n))})},e.areEqual=function(e,t){if(e.elements.length!==t.elements.length)return!1;for(var r=0,n=e.elements.length;r<n;++r){var i=e.elements[r],a=t.elements[r];if(i.groupedUnits.length!==a.groupedUnits.length)return!1;for(var o=0,s=a.groupedUnits.length;o<s;++o)if(!PP.areEqual(i.groupedUnits[o],a.groupedUnits[o]))return!1;if(!PP.areEqual(i.set,a.set)||!G$.areEqual(i.ranges,a.ranges))return!1}return!0}}(sU||={});var yU,bU=Object.freeze({__proto__:null,atomicHet:function(){return function(e){for(var t=e.inputStructure,r=qF.create(t),n=[],i=0,a=t.units;i<a.length;i++){var o=a[i];if(0===o.kind){r.unit=o;var s=o.elements;if(r.element=s[0],"water"!==Cj.entity.type(r)){if("polymer"===Cj.entity.type(r)){for(var u=fE.transientSegments(o.model.atomicHierarchy.residueAtomSegments,s),c=0;u.hasNext;)c++,u.move();if(c>=8)continue}n.push(o)}}}return oU.Singletons(t,yz.create(n,{parent:t}))}},atomicSequence:function(){return function(e){for(var t=e.inputStructure,r=qF.create(t),n=[],i=0,a=t.units;i<a.length;i++){var o=a[i];if(0===o.kind){r.unit=o;var s=o.elements;if(r.element=s[0],"polymer"===Cj.entity.type(r)){for(var u=fE.transientSegments(o.model.atomicHierarchy.residueAtomSegments,s),c=0;u.hasNext;)c++,u.move();c<8||n.push(o)}}}return oU.Singletons(t,yz.create(n,{parent:t}))}},bundleElementImpl:gU,bundleGenerator:vU,defaultBondTest:mU,spheres:function(){return function(e){for(var t=e.inputStructure,r=[],n=0,i=t.units;n<i.length;n++){var a=i[n];1===a.kind&&r.push(a)}return oU.Singletons(t,yz.create(r,{parent:t}))}},water:function(){return function(e){for(var t=e.inputStructure,r=qF.create(t),n=[],i=0,a=t.units;i<a.length;i++){var o=a[i];0===o.kind&&(r.unit=o,r.element=o.elements[0],"water"===Cj.entity.type(r)&&n.push(o))}return oU.Singletons(t,yz.create(n,{parent:t}))}}}),_U=function(){function e(e,t){this.currentElementStack=[],this.currentAtomicBondStack=[],this.currentStructureStack=[],this.inputStructureStack=[],this.timeCreated=Kd(),this.element=qF.create(void 0),this.currentStructure=void 0,this.atomicBond=new xU,this.currentSelection=void 0,this.inputStructure=e,this.timeoutMs=t&&t.timeoutMs||0,this.currentSelection=t&&t.currentSelection}return e.prototype.pushCurrentElement=function(){return this.currentElementStack[this.currentElementStack.length]=this.element,this.element=qF.create(void 0),this.element},e.prototype.popCurrentElement=function(){this.element=this.currentElementStack.pop()},e.prototype.pushCurrentBond=function(){return this.atomicBond&&this.currentAtomicBondStack.push(this.atomicBond),this.atomicBond=new xU,this.atomicBond},e.prototype.popCurrentBond=function(){this.currentAtomicBondStack.length>0?this.atomicBond=this.currentAtomicBondStack.pop():this.atomicBond=void 0},e.prototype.pushCurrentStructure=function(){this.currentStructure&&this.currentStructureStack.push(this.currentStructure)},e.prototype.popCurrentStructure=function(){this.currentStructureStack.length?this.currentStructure=this.currentStructureStack.pop():this.currentStructure=void 0},e.prototype.pushInputStructure=function(e){this.inputStructureStack.push(this.inputStructure),this.inputStructure=e},e.prototype.popInputStructure=function(){if(0===this.inputStructureStack.length)throw Error("Must push before pop.");this.inputStructure=this.inputStructureStack.pop()},e.prototype.throwIfTimedOut=function(){if(0!==this.timeoutMs&&Kd()-this.timeCreated>this.timeoutMs)throw Error(`The query took too long to execute (> ${this.timeoutMs/1e3}s).`)},e.prototype.tryGetCurrentSelection=function(){if(!this.currentSelection)throw Error("The current selection is not assigned.");return this.currentSelection},e}(),xU=function(){function e(){this.a=qF.create(void 0),this.aIndex=0,this.b=qF.create(void 0),this.bIndex=0,this.type=0,this.order=0,this.key=-1,this.testFn=mU}return e.prototype.setStructure=function(e){this.a.structure=e,this.b.structure=e},e.prototype.setTestFn=function(e){this.testFn=e||mU},e.prototype.test=function(e,t){return!!this.testFn(e)||!!t&&(this.swap(),this.testFn(e))},e.prototype.swap=function(){var e=this.aIndex;this.aIndex=this.bIndex,this.bIndex=e;var t=this.a.unit;this.a.unit=this.b.unit,this.b.unit=t;var r=this.a.element;this.a.element=this.b.element,this.b.element=r},Object.defineProperty(e.prototype,"length",{get:function(){return qF.distance(this.a,this.b)}
139,enumerable:!1,configurable:!0}),e}();!function(e){e.run=function(e,t,r){return e(new _U(t,r))}}(yU||={});var SU=function(){function e(e){this.source=e,this.set=hS(yz.hashCode,yz.areUnitIdsAndIndicesEqual),this.structures=[],this.allSingletons=!0}return e.prototype.add=function(e){e.elementCount&&(1!==e.elementCount&&(this.allSingletons=!1),this.set.add(e)&&(this.structures[this.structures.length]=e))},e.prototype.getSelection=function(){return this.allSingletons?oU.Singletons(this.source,cU(this.source,this.structures)):oU.Sequence(this.source,this.structures)},e}(),wU=function(){function e(e){this.source=e,this.builders=[],this.builderMap=new Map}return e.prototype.add=function(e,t,r){var n=this.builderMap.get(e);n||(n=this.source.subsetBuilder(!0),this.builders[this.builders.length]=n,this.builderMap.set(e,n)),n.addToUnit(t,r)},e.prototype.allSingletons=function(){for(var e=0,t=this.builders.length;e<t;e++)if(this.builders[e].elementCount>1)return!1;return!0},e.prototype.singletonSelection=function(){for(var e=this.source.subsetBuilder(!0),t=qF.create(this.source),r=0,n=this.builders.length;r<n;r++)this.builders[r].setSingletonLocation(t),e.addToUnit(t.unit.id,t.element);return oU.Singletons(this.source,e.getStructure())},e.prototype.fullSelection=function(){for(var e=Array(this.builders.length),t=0,r=this.builders.length;t<r;t++)e[t]=this.builders[t].getStructure();return oU.Sequence(this.source,e)},e.prototype.getSelection=function(){return 0===this.builders.length?oU.Empty(this.source):this.allSingletons()?this.singletonSelection():this.fullSelection()},e}(),AU=function(e){return oU.Sequence(e.inputStructure,[])},CU=function(e){return oU.Singletons(e.inputStructure,e.inputStructure)};function TU(e){return!0}function PU(e){return 0}function EU(e){if(!e||!(e.atomTest||e.residueTest||e.chainTest||e.entityTest||e.unitTest||e.groupBy))return CU;if(e.atomTest&&!e.residueTest&&!e.chainTest&&!e.entityTest&&!e.unitTest&&!e.groupBy)return t=e.atomTest,function(e){var r=e.inputStructure,n=r.units,i=e.pushCurrentElement(),a=r.subsetBuilder(!0);i.structure=r;for(var o=0,s=n;o<s.length;o++){var u=s[o];i.unit=u;var c=u.elements;a.beginUnit(u.id);for(var l=0,d=c.length;l<d;l++)i.element=c[l],t(e)&&a.addElement(i.element);a.commitUnit(),e.throwIfTimedOut()}return e.popCurrentElement(),oU.Singletons(r,a.getStructure())};var t,r={unitTest:e.unitTest||TU,entityTest:e.entityTest||TU,chainTest:e.chainTest||TU,residueTest:e.residueTest||TU,atomTest:e.atomTest||TU,groupBy:e.groupBy||PU};return e.groupBy?function(e){var t=e.unitTest,r=e.entityTest,n=e.chainTest,i=e.residueTest,a=e.atomTest,o=e.groupBy;return function(e){var s=e.inputStructure,u=s.units,c=e.pushCurrentElement(),l=new wU(s);c.structure=s;for(var d=0,f=u;d<f.length;d++){var h=f[d];if(c.unit=h,t(e)){var p=h.elements,m=h.model;if(0===h.kind)for(var g=fE.transientSegments(m.atomicHierarchy.chainAtomSegments,p),v=fE.transientSegments(m.atomicHierarchy.residueAtomSegments,p);g.hasNext;){var y=g.move();if(c.element=p[y.start],r(e)&&n(e))for(v.setSegment(y);v.hasNext;){var b=v.move();if(c.element=p[b.start],i(e))for(var _=b.start,x=b.end;_<x;_++)c.element=p[_],a(e)&&l.add(o(e),h.id,c.element)}}else{var S=m.coarseHierarchy.spheres.chainElementSegments;for(g=fE.transientSegments(S,p);g.hasNext;)if(y=g.move(),c.element=p[y.start],r(e)&&n(e))for(_=y.start,x=y.end;_<x;_++)c.element=p[_],i(e)&&l.add(o(e),h.id,c.element)}e.throwIfTimedOut()}}return e.popCurrentElement(),l.getSelection()}}(r):function(e){var t=e.unitTest,r=e.entityTest,n=e.chainTest,i=e.residueTest,a=e.atomTest;return function(e){var o=e.inputStructure,s=o.units,u=e.pushCurrentElement(),c=o.subsetBuilder(!0),l=i===TU&&a===TU,d=a===TU;u.structure=o;for(var f=0,h=s;f<h.length;f++){var p=h[f];if(u.unit=p,t(e)){var m=p.elements,g=p.model;if(c.beginUnit(p.id),0===p.kind)for(var v=fE.transientSegments(p.model.atomicHierarchy.chainAtomSegments,m),y=fE.transientSegments(p.model.atomicHierarchy.residueAtomSegments,m);v.hasNext;){var b=v.move();if(u.element=m[b.start],r(e)&&n(e))if(l)c.addElementRange(m,b.start,b.end);else for(y.setSegment(b);y.hasNext;){var _=y.move();if(u.element=m[_.start],i(e))if(d)c.addElementRange(m,_.start,_.end);else for(var x=_.start,S=_.end;x<S;x++)u.element=m[x],a(e)&&c.addElement(u.element)}}else{var w=g.coarseHierarchy.spheres.chainElementSegments;for(v=fE.transientSegments(w,m);v.hasNext;)if(b=v.move(),u.element=m[b.start],r(e)&&n(e))if(l)c.addElementRange(m,b.start,b.end);else for(x=b.start,S=b.end;x<S;x++)u.element=m[x],i(e)&&c.addElement(u.element)}c.commitUnit(),e.throwIfTimedOut()}}return e.popCurrentElement(),oU.Singletons(o,c.getStructure())}}(r)}function MU(e,t,r){for(var n=new Int32Array(t.length),i=0,a=t.length;i<a;i++)n[i]=e.elements[t[i]];return yz.create([e.getChild(PP.ofSortedArray(n))],{parent:r})}var kU,IU,DU=Object.freeze({__proto__:null,all:CU,atoms:EU,bondedAtomicPairs:function(e){return function(t){var r=t.inputStructure,n=r.interUnitBonds,i=oU.UniqueBuilder(t.inputStructure);t.pushCurrentBond();var a=t.atomicBond;a.setTestFn(e),a.setStructure(r);for(var o=0,s=r.units;o<s.length;o++){var u=s[o];if(0===u.kind){var c=u.bonds,l=c.offset,d=c.b,f=c.edgeProps,h=f.flags,p=f.order,m=f.key;a.a.unit=u,a.b.unit=u;for(var g=0,v=u.elements.length;g<v;g++){a.aIndex=g,a.a.element=u.elements[g];for(var y=l[g],b=l[g+1];y<b;y++)a.bIndex=d[y],a.b.element=u.elements[d[y]],a.type=h[y],a.order=p[y],a.key=m[y],a.test(t,!1)&&((S=r.subsetBu
139ilder(!1)).beginUnit(u.id),S.addElement(a.a.element),S.addElement(a.b.element),S.commitUnit(),i.add(S.getStructure()))}}}for(var _=0,x=n.edges;_<x.length;_++){var S,w=x[_];a.a.unit=r.unitMap.get(w.unitA),a.a.element=a.a.unit.elements[w.indexA],a.aIndex=w.indexA,a.b.unit=r.unitMap.get(w.unitB),a.b.element=a.b.unit.elements[w.indexB],a.bIndex=w.indexB,a.order=w.props.order,a.type=w.props.flag,a.key=w.props.key,a.test(t,!1)&&((S=r.subsetBuilder(!1)).addToUnit(a.a.unit.id,a.a.element),S.addToUnit(a.b.unit.id,a.b.element),i.add(S.getStructure()))}return t.popCurrentBond(),i.getSelection()}},chains:function(e){return EU(Ac(Ac({},e),{groupBy:function(e){return Cj.chain.key(e.element)}}))},none:AU,querySelection:function(e,t,r){return void 0===r&&(r=!1),function(n){var i=e(n);if(0===oU.structureCount(i))return i;var a=r?pU(n.inputStructure,oU.unionStructure(i)):oU.unionStructure(i);if(0===a.elementCount)return oU.Empty(n.inputStructure);n.throwIfTimedOut(),n.pushInputStructure(a);var o=t(n);return n.popInputStructure(),oU.withInputStructure(o,n.inputStructure)}},residues:function(e){return EU(Ac(Ac({},e),{groupBy:function(e){return Cj.residue.key(e.element)}}))},rings:function(e,t){return function(r){var n=r.inputStructure.units,i=oU.LinearBuilder(r.inputStructure);if(e&&0!==e.length){for(var a=gS.create(),o=0;o<e.length;o++)gS.add(a,e[o],e[o]);for(var s=0,u=n;s<u.length;s++)if(v=u[s],tU.isAtomic(v))for(var c=v.rings,l=0,d=a.array;l<d.length;l++){var f=d[l];if(c.byFingerprint.has(f))for(var h=0,p=c.byFingerprint.get(f);h<p.length;h++)_=p[h],t&&!c.aromaticRings.includes(_)||i.add(MU(v,c.all[_],r.inputStructure))}}else for(var m=0,g=n;m<g.length;m++){var v=g[m];if(tU.isAtomic(v))if(t)for(var y=0,b=v.rings.aromaticRings;y<b.length;y++){var _=b[y];i.add(MU(v,v.rings.all[_],r.inputStructure))}else for(var x=0,S=v.rings.all;x<S.length;x++)_=S[x],i.add(MU(v,_,r.inputStructure))}return i.getSelection()}}}),OU=function(){function e(e){this.parent=e,this.ids=[],this.unitMap=mE.Mutable(),this.parentId=-1,this.currentUnit=gS.create(),this.elementCount=0}return e.prototype.addToUnit=function(e,t){var r=this.unitMap.get(e);if(r)gS.add(r,t,t)&&this.elementCount++;else{var n=gS.create();gS.add(n,t,t),this.unitMap.set(e,n),this.ids[this.ids.length]=e,this.elementCount++}},e.prototype.has=function(e,t){var r=this.unitMap.get(e);return!!r&&gS.has(r,t)},e.prototype.beginUnit=function(e){this.parentId=e,this.unitMap.has(e)?this.currentUnit=this.unitMap.get(e):this.currentUnit=this.currentUnit.array.length>0?gS.create():this.currentUnit},e.prototype.addElement=function(e){gS.add(this.currentUnit,e,e)&&this.elementCount++},e.prototype.commitUnit=function(){0===this.currentUnit.array.length||this.unitMap.has(this.parentId)||(this.ids[this.ids.length]=this.parentId,this.unitMap.set(this.parentId,this.currentUnit),this.parentId=-1)},e.prototype.getStructure=function(){if(this.isEmpty)return yz.Empty;var e=[];vv(this.ids);for(var t=Kj.UnitEquivalenceBuilder(),r=0,n=this.ids.length;r<n;r++){var i=this.ids[r],a=this.parent.unitMap.get(i),o=this.unitMap.get(i).array,s=o.length;if(o.length!==a.elements.length){s>1&&vv(o);var u=a.getChild(PP.ofSortedArray(o)),c=t.add(u.id,u);u!==c&&(u=c.applyOperator(u.id,u.conformation.operator,!0)),e[e.length]=u}else e[e.length]=a,t.add(a.id,a)}return yz.create(e,{parent:this.parent})},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.elementCount},enumerable:!1,configurable:!0}),e}(),RU={type_symbol:xv.Schema.Aliased(yA.atom_site.type_symbol),label_atom_id:yA.atom_site.label_atom_id,auth_atom_id:yA.atom_site.auth_atom_id,label_alt_id:yA.atom_site.label_alt_id,label_comp_id:yA.atom_site.label_comp_id,auth_comp_id:yA.atom_site.auth_comp_id,pdbx_formal_charge:yA.atom_site.pdbx_formal_charge},BU={group_PDB:yA.atom_site.group_PDB,label_seq_id:yA.atom_site.label_seq_id,auth_seq_id:yA.atom_site.auth_seq_id,pdbx_PDB_ins_code:yA.atom_site.pdbx_PDB_ins_code},NU={label_asym_id:yA.atom_site.label_asym_id,auth_asym_id:yA.atom_site.auth_asym_id,label_entity_id:yA.atom_site.label_entity_id};(function(e){e.EmptyResidueKey=function(){return{label_entity_id:"",label_asym_id:"",auth_seq_id:0,pdbx_PDB_ins_code:void 0}}})(kU||={}),function(e){function t(e,t){return e.residueAtomSegments.index[e.chainAtomSegments.offsets[t]]}function r(e,t){return e.residueAtomSegments.index[e.chainAtomSegments.offsets[t+1]-1]+1}e.chainStartResidueIndex=t,e.chainEndResidueIndexExcl=r,e.chainResidueCount=function(e,n){return r(e,n)-t(e,n)}}(IU||={});var FU={H:1,D:1,T:1,HE:2,LI:3,BE:4,B:5,C:6,N:7,O:8,F:9,NE:10,NA:11,MG:12,AL:13,SI:14,P:15,S:16,CL:17,AR:18,K:19,CA:20,SC:21,TI:22,V:23,CR:24,MN:25,FE:26,CO:27,NI:28,CU:29,ZN:30,GA:31,GE:32,AS:33,SE:34,BR:35,KR:36,RB:37,SR:38,Y:39,ZR:40,NB:41,MO:42,TC:43,RU:44,RH:45,PD:46,AG:47,CD:48,IN:49,SN:50,SB:51,TE:52,I:53,XE:54,CS:55,BA:56,LA:57,CE:58,PR:59,ND:60,PM:61,SM:62,EU:63,GD:64,TB:65,DY:66,HO:67,ER:68,TM:69,YB:70,LU:71,HF:72,TA:73,W:74,RE:75,OS:76,IR:77,PT:78,AU:79,HG:80,TL:81,PB:82,BI:83,PO:84,AT:85,RN:86,FR:87,RA:88,AC:89,TH:90,PA:91,U:92,NP:93,PU:94,AM:95,CM:96,BK:97,CF:98,ES:99,FM:100,MD:101,NO:102,LR:103,RF:104,DB:105,SG:106,BH:107,HS:108,MT:109},LU={1:1.1,2:1.4,3:1.81,4:1.53,5:1.92,6:1.7,7:1.55,8:1.52,9:1.47,10:1.54,11:2.27,12:1.73,13:1.84,14:2.1,15:1.8,16:1.8,17:1.75,18:1.88,19:2.75,20:2.31,21:2.3,22:2.15,23:2.05,24:2.05,25:2.05,26:2.05,27:2,28:2,29:2,30:2.1,31:1.87,32:2.11,33:1.85,34:1.9,35:1.83,36:2.02,37:3.03,38:2.49,39:2.4,40:2.3,41:2.15,42:2.1,43:2.05,44:2.05,45:2,46:2.05,47:2.1,48:2.2,49:2.2,50:1.93,51:2.17,52:2.06,53:1.98,54:2.16,55:3.43,56:2.68,57:2.5,58:2.48,59:2.47,60:2.45,61:2.43,62:2.42,63:2.4,64:2.38,65:2.37,66:2.35,67:2.33,68:2.32,69:2.3,70:2.28,71:2.27,72:2.25,73:2.2,74:2.1,75:2.05,76:2,77:2,78:2.05,79:2.1,80:2.05,81:1.96,82:2.02,83:2.07,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:2.4,91:2,92:2.3,93:2,94:2,95:2,96:2,97:2,98:2,99:2,100:2,101:2,102:2,103:2,104:2,105:2,106:2,107:2,108:2,109:2},$U={1:1.008,2:4.0026,3:6.94,4:9.0122,5:10.81,6:10.81,7:14.007,8:15.999,9:18.998,10:20.18,11:22.99,12:24.305,13:26.982,14:28.085,15:30.974,16:32.06,17:35.45,18:39.948,19
139:39.098,20:40.078,21:44.956,22:47.867,23:50.942,24:51.996,25:54.938,26:55.845,27:58.933,28:58.693,29:63.546,30:65.38,31:69.723,32:72.63,33:74.922,34:78.971,35:79.904,36:83.798,37:85.468,38:87.62,39:88.906,40:91.224,41:92.906,42:95.95,43:96.906,44:101.07,45:102.91,46:106.42,47:107.87,48:112.41,49:114.82,50:118.71,51:121.76,52:127.6,53:127.6,54:131.29,55:132.91,56:137.33,57:138.91,58:140.12,59:140.91,60:144.24,61:144.912,62:150.36,63:151.96,64:157.25,65:158.93,66:162.5,67:164.93,68:167.26,69:168.93,70:173.05,71:174.97,72:178.49,73:180.95,74:183.84,75:186.21,76:190.23,77:192.22,78:195.08,79:196.97,80:200.59,81:204.38,82:207.2,83:208.98,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:232.04,91:231.04,92:238.03,93:237.048,94:244.064,95:243.061,96:247.07,97:247.07,98:251.079,99:252.083,100:257.095,101:258.098,102:259.101,103:262.11,104:267.122,105:270.131,106:271.134,107:270.133,108:270.134,109:278.156};function UU(e){var t=FU[e];return void 0===t?1.7:LU[t]}function jU(e){var t=FU[e];return void 0===t?0:t}function zU(e,t,r,n){return{type:e,key:t,elements:r,getIndex:n}}var GU,VU=-27.888;function HU(e,t,r,n){var i=Cg.distance(e,n),a=Cg.distance(t,n),o=Cg.distance(t,r),s=Cg.distance(e,r),u=VU/i-VU/a+(VU/o-VU/s);return u<-9.9?-9.9:u}!function(e){e.is=Sd.has,e.create=Sd.create}(GU||={});var qU=function(e,t,r){this.partner1=Math.min(e,t),this.partner2=Math.max(e,t),this.type=r};function WU(e,t){if(t.type!==e.type||t.partner1!==e.firstEnd+1)return!1;if(0===t.type){if(t.partner2===e.secondEnd+1)return!0}else if(t.partner2===e.secondStart-1)return!0;return!1}function XU(e,t){return e.type===t.type&&t.firstStart-e.firstEnd<6&&e.firstStart<t.firstStart&&0===t.nextLadder&&(0===e.type?YU(e,t):YU(t,e))}function YU(e,t){return t.secondStart-e.secondEnd>0&&(t.secondStart-e.secondEnd<6&&t.firstStart-e.firstEnd<3||t.secondStart-e.secondEnd<3)}function KU(e){return GU.is(e,8)||GU.is(e,1)||GU.is(e,16)}var ZU,QU,JU={oldDefinition:Ib.Boolean(!0,{description:"Whether to use the old DSSP convention for the annotation of turns and helices, causes them to be two residues shorter"}),oldOrdering:Ib.Boolean(!0,{description:"Alpha-helices are preferred over 3-10 helices"})};function ej(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S;return Pc(this,function(w){for(r=function(e){for(var t=e.model.atomicHierarchy.index,r=e.proteinElements,n=e.residueIndex,i=r.length,a=new Uint32Array(i),o=new Int32Array(i),s=new Int32Array(i),u=new Int32Array(i),c=new Int32Array(i),l=0;l<i;++l){var d=n[r[l]];a[l]=d,o[l]=t.findAtomOnResidue(d,"C"),s[l]=t.findAtomOnResidue(d,"H"),u[l]=t.findAtomOnResidue(d,"O"),c[l]=t.findAtomOnResidue(d,"N")}return{residueIndices:PP.ofSortedArray(a),cIndices:o,hIndices:s,oIndices:u,nIndices:c}}(e),n=r.residueIndices,i=function(e,t){for(var r=e.model.atomicConformation,n=r.x,i=r.y,a=r.z,o=e.model.atomicHierarchy.derived.residue.traceElementIndex,s=new Uint32Array(t.length),u=0,c=t.length;u<c;++u)s[u]=o[t[u]];var l={x:n,y:i,z:a,indices:PP.ofSortedArray(s)};return JE(l,eU(l))}(e,n),a=function(e,t,r){for(var n=t.residueIndices,i=t.cIndices,a=t.hIndices,o=t.nIndices,s=t.oIndices,u=e.model.atomicHierarchy.index,c=e.conformation.invariantPosition,l=e.model.atomicHierarchy.derived.residue.traceElementIndex,d=n.length,f=[],h=[],p=[],m=Cg(),g=Cg(),v=Cg(),y=Cg(),b=Cg(),_=Cg(),x=Cg(),S=0,w=n.length;S<w;++S){var A=S,C=n[S],T=s[A],P=i[A],E=l[C];if(-1!==T&&-1!==P&&-1===u.findAtomOnResidue(C,"OXT")){c(T,m),c(P,g),c(E,v);for(var M=r.find(v[0],v[1],v[2],9),k=M.indices,I=M.count,D=0;D<I;++D){var O=k[D];if(O!==A&&O-1!==A&&O+1!==A){var R=o[O];if(-1!==R){c(R,y);var B=a[O];if(-1===B){if(0===O)continue;var N=O-1,F=s[N],L=i[N];if(-1===F||-1===L)continue;c(F,x),c(L,_),Cg.sub(b,_,x);var $=Cg.distance(x,_);Cg.scaleAndAdd(b,y,b,1/$)}else c(B,b);var U=HU(m,g,y,b);U>-.5||(f[f.length]=A,h[h.length]=O,p[p.length]=U)}}}}}return function(e,t,r,n){for(var i=new DF.DirectedEdgeBuilder(e,t,r),a=new Float32Array(i.slotCount),o=0,s=i.edgeCount;o<s;o++)i.addNextEdge(),i.assignProperty(a,n[o]);return i.createGraph({energies:n})}(d,f,h,p)}(e,r,i),o=n.length,s=new Uint32Array(o),u=function(e,t){var r=t.cIndices,n=t.nIndices,i=t.residueIndices,a=e.conformation.position,o=e.model.atomicHierarchy.index,s=e.model.atomicHierarchy.derived.residue.traceElementIndex,u=i.length,c=function(e,t){return-1===e?Cg.setNaN(t):a(e,t)},l=Cg(),d=Cg(),f=Cg(),h=Cg(),p=Cg(),m=Cg(),g=Cg(),v=Cg(),y=Cg();if(0===u)return{phi:new Float32Array,psi:new Float32Array};var b=new Float32Array(u-1),_=new Float32Array(u-1);c(-1,l),c(-1,d),c(-1,f),c(r[0],h),c(s[i[0]],p),c(n[0],m),c(r[1],g),c(s[i[1]],v),c(n[1],y);for(var x=0;x<u-1;++x)-1===o.findAtomOnResidue(i[x],"OXT")&&(b[x]=kg(Cg.dihedralAngle(l,m,p,h)),_[x]=kg(Cg.dihedralAngle(m,p,h,y)),l=h,d=p,f=m,h=g,p=v,m=y,c(r[x+1],g),c(s[i[x+1]],v),c(n[x+1],y));return{phi:b,psi:_}}(e,r),c=[],l=[],d=t.oldDefinition?nj:aj,f=t.oldOrdering?ij:oj,function(e){for(var t=e.proteinInfo,r=e.hbonds,n=e.flags,i=[1024,2048,4096,128,256,512],a=0;a<3;a++)for(var o=0,s=t.residueIndices.length-1;o<s;++o)if(-1!==r.getDirectedEdgeIndex(o,o+a+3))if(n[o]|=i[a+3]|i[a],e.params.oldDef
139inition)for(var u=1;u<a+3;++u)n[o+u]|=64|i[a+3];else for(u=0;u<=a+3;++u)n[o+u]|=64|i[a+3]}(h={params:t,getResidueFlag:d,getFlagName:f,unit:e,proteinInfo:r,flags:s,hbonds:a,torsionAngles:u,ladders:c,bridges:l}),function(e){for(var t=e.flags,r=e.proteinInfo.residueIndices.length,n=[1024,2048,4096,128,256,512],i=[0,0,0,8,1,16],a=e.params.oldOrdering?[4,3,5]:[3,4,5],o=0;o<a.length;o++)for(var s=a[o],u=1,c=r-s;u<c;u++){var l=GU.create(t[u]),d=GU.create(t[u-1]),f=GU.create(t[u+1]);if(e.params.oldOrdering){if(3===s&&(GU.is(l,1)||GU.is(f,1))||5===s&&(GU.is(l,1)||GU.is(l,8)||GU.is(f,1)||GU.is(f,8)))continue}else if(4===s&&(GU.is(l,8)||GU.is(f,8))||5===s&&(GU.is(l,1)||GU.is(l,8)||GU.is(f,1)||GU.is(f,8)))continue;if(GU.is(l,n[s])&&GU.is(l,n[s-3])&&GU.is(d,n[s])&&GU.is(d,n[s-3]))if(e.params.oldDefinition)for(var h=0;h<s;h++)t[u+h]|=i[s];else for(h=-1;h<=s;h++)t[u+h]|=i[s]}}(h),function(e){var t=e.unit,r=e.flags,n=e.proteinInfo,i=t.conformation.position,a=t.model.atomicHierarchy.derived.residue.traceElementIndex,o=n.residueIndices,s=n.nIndices,u=o.length,c=function(e,t){return-1===e?Cg.setNaN(t):i(e,t)},l=Cg(),d=Cg(),f=Cg(),h=Cg(),p=Cg(),m=Cg(),g=Cg();e:for(var v=2;v<u-2;v++){for(var y=0;y<4;y++){var b=v+y-2;if(c(a[b],h),c(s[b+1],p),Cg.squaredDistance(h,p)>6.25)continue e}var _=o[v-2],x=o[v],S=o[v+2],w=a[_],A=a[x],C=a[S];c(w,l),c(A,d),c(C,f),Cg.sub(m,l,d),Cg.sub(g,d,f);var T=kg(Cg.angle(m,g));T&&T>70&&(r[v]|=32)}}(h),function(e){for(var t,r,n=e.proteinInfo,i=e.hbonds,a=e.flags,o=e.bridges,s=i.offset,u=i.b,c=0,l=n.residueIndices.length;c<l;++c)for(var d=s[c],f=s[c+1];d<f;d++){var h=u[d];c>h||((t=c+1)!==(r=h)&&-1!==i.getDirectedEdgeIndex(r,t+1)&&(a[t]|=2,a[r]|=2,o[o.length]=new qU(t,r,0)),(t=c)!==(r=h-1)&&-1!==i.getDirectedEdgeIndex(r-1,t)&&(a[t]|=2,a[r]|=2,o[o.length]=new qU(r,t,0)),(t=c)!==(r=h)&&-1!==i.getDirectedEdgeIndex(r,t)&&(a[t]|=2,a[r]|=2,o[o.length]=new qU(r,t,1)),(t=c+1)!==(r=h-1)&&-1!==i.getDirectedEdgeIndex(r-1,t+1)&&(a[t]|=2,a[r]|=2,o[o.length]=new qU(r,t,1)))}o.sort(function(e,t){return e.partner1>t.partner1?1:e.partner1<t.partner1?-1:0})}(h),function(e){for(var t=e.bridges,r=e.ladders,n=0;n<t.length;n++){for(var i=t[n],a=!1,o=0;o<r.length;o++){var s=r[o];WU(s,i)&&(a=!0,s.firstEnd++,0===i.type?s.secondEnd++:s.secondStart--)}a||(r[r.length]={previousLadder:0,nextLadder:0,firstStart:i.partner1,firstEnd:i.partner1,secondStart:i.partner2,secondEnd:i.partner2,type:i.type})}for(var u=0;u<r.length;u++)for(var c=r[u],l=u;l<r.length;l++){var d=r[l];XU(c,d)&&(c.nextLadder=l,d.previousLadder=u)}}(h),function(e){for(var t=e.ladders,r=e.flags,n=0;n<t.length;n++){for(var i=t[n],a=i.firstStart;a<=i.firstEnd;a++){var o=i.firstStart-a,s=i.secondStart-o;i.firstStart===i.firstEnd?(!KU(r[a])&&GU.is(r[a],4)&&(r[a]|=2),!KU(r[s])&&GU.is(r[s],4)&&(r[s]|=2)):(r[a]|=4,r[s]|=4)}if(0!==i.nextLadder){var u=t[i.nextLadder];for(a=i.firstStart;a<=u.firstEnd;a++)r[a]|=4;if(0===i.type)for(a=i.secondStart;a<=u.secondEnd;a++)r[a]|=4;else for(a=u.secondEnd;a<=i.secondStart;a++)r[a]|=4}}}(h),p=function(e,t){for(var r=new Uint32Array(e.length),n=0,i=e.length;n<i;++n)r[n]=t(GU.create(e[n]));return r}(s,d),m=new Uint32Array(o),g=[],v=[],y=function(e){return PP.indexOf(n,e)},b=0,_=n.length;b<_;++b)x=p[b],m[b]=x,S=d(s[b]),0!==v.length&&S===v[v.length-1].flags||(v[v.length]=tj(rj(x),s[b],d)),g[b]=v.length-1;return[2,zU(m,g,v,y)]})})}function tj(e,t,r){return"helix"===e?{kind:"helix",flags:r(t)}:"sheet"===e?{kind:"sheet",flags:r(t)}:"turn"===e||"bend"===e?{kind:"turn",flags:r(t)}:{kind:"none"}}function rj(e){return e===ON.SecondaryStructureDssp.H||e===ON.SecondaryStructureDssp.G||e===ON.SecondaryStructureDssp.I?"helix":e===ON.SecondaryStructureDssp.B||e===ON.SecondaryStructureDssp.E?"sheet":e===ON.SecondaryStructureDssp.T?"turn":e===ON.SecondaryStructureDssp.S?"bend":"none"}function nj(e){return GU.is(e,1)?ON.SecondaryStructureDssp.H:GU.is(e,4)?ON.SecondaryStructureDssp.E:GU.is(e,2)?ON.SecondaryStructureDssp.B:GU.is(e,8)?ON.SecondaryStructureDssp.G:GU.is(e,16)?ON.SecondaryStructureDssp.I:GU.is(e,64)?ON.SecondaryStructureDssp.T:GU.is(e,32)?ON.SecondaryStructureDssp.S:0}function ij(e){return GU.is(e,1)?"H":GU.is(e,4)?"E":GU.is(e,2)?"B":GU.is(e,8)?"G":GU.is(e,16)?"I":GU.is(e,64)?"T":GU.is(e,32)?"S":"-"}function aj(e){return GU.is(e,16)?ON.SecondaryStructureDssp.I:GU.is(e,1)?ON.SecondaryStructureDssp.H:GU.is(e,4)?ON.SecondaryStructureDssp.E:GU.is(e,2)?ON.SecondaryStructureDssp.B:GU.is(e,8)?ON.SecondaryStructureDssp.G:GU.is(e,64)?ON.SecondaryStructureDssp.T:GU.is(e,32)?ON.SecondaryStructureDssp.S:0}function oj(e){return GU.is(e,16)?"I":GU.is(e,1)?"H":GU.is(e,4)?"E":GU.is(e,2)?"B":GU.is(e,8)?"G":GU.is(e,64)?"T":GU.is(e,32)?"S":"-"}function sj(e,t,r,n,i,a){for(var o=e.residues,s=o.auth_seq_id,u=o.label_seq_id,c=o.pdbx_PDB_ins_code,l=r.endSeqId,d=r.endInsCode,f=r.key,h=r.type,p="label"===t?u:s,m=n;m<i;){var g=p.value(m);if(a.type[m]=h,a.key[m]=f,g>l||g===l&&c.value(m)===d)break;m++}}function uj(e){var t="model";if(e){t="dssp";for(var r=0,n=e.models.length;r<n;++r){var i=e.models[r];if(Xz.isFromPdbArchive(i)||Xz.hasSecondaryStructure(i)){t="model";break}}}return{type:Ib.MappedStatic(t,{model:Ib.EmptyGroup({label:"Model"}),dssp:Ib.Group(JU,{label:"DSSP",isFlat:!0})},{options:[["model","Model"],["dssp","DSSP"]]})}}(function(e){function t(e){var t=this,r=e.descriptor.name,n="root"===e.type?"inheritedPropertyData":"currentPropertyData",i=function(t){return r in t[n]||(t[n][r]={props:Ac({},Ib.getDefaultValues(e.getParams(t))),data:ef.create(void 0)}),t[n][r]},a=function(e,t,a){var o=i(e);e[n][r]={props:t,data:ef.withValue(o.data,a)}};return{label:e.label,descriptor:e.descriptor,isHidden:e.isHidden,getParams:function(t){var r=Ib.clone(e.getParams(t));return Ib.setDefaultValues(r,i(t).props),r},defaultParams:e.defaultParams,isApplicable:e.isApplicable,attach:function(r,n,o,s){return void 0===o&&(o={}),Tc(t,void 0,void 0,function(){var t,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:return s&&n.customPropertyDescriptors.reference(e.descriptor,!0),"root"===e.type&&(n=n.root),t=i(n.root).props,u=i(n),c=Ib.merge(e.defaultParams,t,o),u.data.value&&Ib.areEqual(e.defaultParams,u.props,c)?[2]:[4,e.obtain(r,n,c)];case 1:return l=h.sent(),d=l.value,f=l.assets,n.customPropertyDescriptors.add(e.descriptor),n.customPropertyDescriptors.assets(e.descriptor,f),a(n,c,d),[2]}})})},ref:function(t,r){return t.customPropertyDescriptors.reference(e.descriptor,r)},get:function(e){return i(e).data},set:function(t,r,n){void 0===r&&(r={}),"root"===e.type&&(t=t.root);var o=i(t),s=Ib.merge(e.defaultParams,o.props,r);
139Ib.areEqual(e.defaultParams,o.props,s)||(a(t,s,n),t.customPropertyDescriptors.assets(e.descriptor))},props:function(e){return i(e).props}}}e.createProvider=t,e.createSimple=function(e,r,n){var i=this,a={value:Ib.Value(n,{isHidden:!0})};return t({label:Yg(e),descriptor:{name:e},isHidden:!0,type:r,defaultParams:a,getParams:function(){return{value:Ib.Value(n,{isHidden:!0})}},isApplicable:function(){return!0},obtain:function(e,t,r){return Tc(i,void 0,void 0,function(){return Pc(this,function(e){return[2,Ac(Ac({},Ib.getDefaultValues(a)),r)]})})}})}})(ZU||={}),function(e){e.Descriptor={name:"model_secondary_structure"},e.Provider=FF.create(e.Descriptor),e.fromStruct=function(e,t,r){var n=new Map,i=[{kind:"none"}],a=function(e,t){if(e._rowCount>0){if(0!==e.beg_label_seq_id.valueKind(0)||0!==e.end_label_seq_id.valueKind(0))return"auth"}else if(t&&(0!==t.beg_label_seq_id.valueKind(0)||0!==t.end_label_seq_id.valueKind(0)))return"auth";return"label"}(e,t);(function(e,t,r,n){if(e._rowCount)for(var i=e.beg_label_asym_id,a=e.beg_label_seq_id,o=e.beg_auth_seq_id,s=e.pdbx_beg_PDB_ins_code,u=e.end_label_seq_id,c=e.end_auth_seq_id,l=e.pdbx_end_PDB_ins_code,d=e.pdbx_PDB_helix_class,f=e.conf_type_id,h=e.details,p="label"===t?a:o,m="label"===t?u:c,g=0,v=e._rowCount;g<v;g++){var y=ON.create(0===d.valueKind(g)?ON.SecondaryStructurePdb[d.value(g)]:0===f.valueKind(g)?ON.SecondaryStructureMmcif[f.value(g)]:536870912),b={kind:"helix",flags:y,type_id:0===f.valueKind(g)?f.value(g):"helx_p",helix_class:d.value(g),details:0===h.valueKind(g)?h.value(g):void 0},_={startSeqId:p.value(g),startInsCode:s.value(g),endSeqId:m.value(g),endInsCode:l.value(g),type:y,key:n.length};n[n.length]=b;var x=i.value(g);if(r.has(x)){var S=r.get(x);S.has(_.startSeqId)?S.get(_.startSeqId).push(_):S.set(_.startSeqId,[_])}else r.set(x,new Map([[_.startSeqId,[_]]]))}})(e,a,n,i),function(e,t,r,n,i){if(e._rowCount)for(var a=e.beg_label_asym_id,o=e.beg_label_seq_id,s=e.beg_auth_seq_id,u=e.pdbx_beg_PDB_ins_code,c=e.end_label_seq_id,l=e.end_auth_seq_id,d=e.pdbx_end_PDB_ins_code,f=e.sheet_id,h="label"===t?o:s,p="label"===t?c:l,m=new Map,g=n+1,v=0,y=e._rowCount;v<y;v++){var b=f.value(v),_=void 0;m.has(b)?_=m.get(b):(_=g++,m.set(b,_));var x=ON.create(8388612),S={kind:"sheet",flags:x,sheet_id:b,symmetry:void 0},w={startSeqId:h.value(v),startInsCode:u.value(v),endSeqId:p.value(v),endInsCode:d.value(v),type:x,key:i.length};i[i.length]=S;var A=a.value(v);if(r.has(A)){var C=r.get(A);C.has(w.startSeqId)?C.get(w.startSeqId).push(w):C.set(w.startSeqId,[w])}else r.set(A,new Map([[w.startSeqId,[w]]]))}}(t,a,n,e._rowCount,i);var o=r.residues._rowCount,s={type:new Int32Array(o),key:new Int32Array(o),elements:i};return n.size>0&&function(e,t,r,n){for(var i=e.chainAtomSegments.count,a=e.chains.label_asym_id,o=e.residues,s=o.auth_seq_id,u=o.label_seq_id,c=o.pdbx_PDB_ins_code,l="label"===t?u:s,d=0;d<i;d++){var f=IU.chainStartResidueIndex(e,d),h=IU.chainEndResidueIndexExcl(e,d),p=a.value(d);if(r.has(p))for(var m=r.get(p),g=f;g<h;g++){var v=l.value(g);if(m.has(v))for(var y=0,b=m.get(v);y<b.length;y++){var _=b[y],x=c.value(g);_.startInsCode===x&&sj(e,t,_,g,h,n)}}}}(r,a,n,s),zU(s.type,s.key,s.elements,function(e){return e})}}(QU||={});var cj=uj(),lj=ZU.createProvider({label:"Secondary Structure",descriptor:{name:"molstar_computed_secondary_structure"},type:"root",defaultParams:cj,getParams:uj,isApplicable:function(e){return!0},obtain:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var e,n,i;return Pc(this,function(a){switch(a.label){case 0:switch((e=Ac(Ac({},Ib.getDefaultValues(cj)),r)).type.name){case"dssp":return[3,1];case"model":return[3,3]}return[3,5];case 1:return n={},[4,dj(t,e.type.params)];case 2:return[2,(n.value=a.sent(),n)];case 3:return i={},[4,fj(t)];case 4:return[2,(i.value=a.sent(),i)];case 5:return[2]}})})}});function dj(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:r=new Map,n=0,i=e.unitSymmetryGroups.length,s.label=1;case 1:return n<i?(a=e.unitSymmetryGroups[n].units[0],!tU.isAtomic(a)||Xz.isCoarseGrained(a.model)?[3,3]:[4,ej(a,t)]):[3,4];case 2:o=s.sent(),r.set(a.invariantId,o),s.label=3;case 3:return++n,[3,1];case 4:return[2,r]}})})}function fj(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a;return Pc(this,function(o){for(t=new Map,r=0,n=e.unitSymmetryGroups.length;r<n;++r)i=e.unitSymmetryGroups[r].units[0],tU.isAtomic(i)&&(a=QU.Provider.get(i.model))&&t.set(i.invariantId,a);return[2,t]})})}function hj(){throw Error("Property only available for atomic models.")}function pj(e){throw Error(e?`Property only available for coarse models (${e}).`:"Property only available for coarse models.")}var mj={key:function(e){return e.element},x:function(e){return e.unit.conformation.x(e.element)},y:function(e){return e.unit.conformation.y(e.element)},z:function(e){return e.unit.conformation.z(e.element)},id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicConformation.atomId.value(e.element):hj()},occupancy:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicConformation.occupancy.value(e.element):hj()},B_iso_or_equiv:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicConformation.B_iso_or_equiv.value(e.element):hj()},sourceIndex:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atomSourceIndex.value(e.element):e.element},type_symbol:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element):hj()},label_atom_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_atom_id.value(e.element):hj()},auth_atom_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_atom_id.value(e.element):hj()},label_alt_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_alt_id.value(e.element):hj()},label_comp_id:gj,auth_comp_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_comp_id.value(e.element):hj()},pdbx_formal_charge:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.element):hj()},vdw_radius:function(e){return tU.isAtomic(e.unit)?UU(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element)):hj()}};function gj(e){return tU.isAtomic(e.unit)||hj(),e.unit.model.atomicHierarchy.atoms.label_comp_id.value(e.element)}function vj(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.label_seq_id.value(e.unit.residueIndex[e.element]):hj()}function yj(e){tU.isAtomic(e.unit)||hj();var t=e.unit.model.sequence.byEntityKey[Sj(e)];return t&&t.sequence.microHet.get(vj(e))||[gj(e)]}var bj={key:function(e){return tU.isAtomic(e.unit)?e.unit.residueIndex[e.element]:hj()},group_PDB:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.group_PDB.value(e.unit.residueIndex[e.element]):hj()},label_seq_id:vj,auth_seq_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.auth_seq_id.value(e.unit.residueIndex[e.element]):hj()},pdbx_PDB_ins_code:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(e.unit.residueIndex[e.element]):hj()},isNonStandard:function(e){return tU.isAtomic(e.unit)?yj(e).some(function(t){return"n"===e.unit.model.properties.chemicalComponentMap.get(t).mon_nstd_flag[0]}):hj()},hasMicroheterogeneity:function(e){tU.isAtomic(e.unit)||hj();var t=e.unit.model.sequence.byEntityKey[Sj(e)];return t&&t.sequence.microHet.has(vj(e))},microheterogeneityCompIds:yj,secondary_structure_type:function(e){tU.isAtomic(e.unit)||hj();var t=lj.get(e.structure).value?.get(e.unit.invariantId);return t?t.type[t.getIndex(e.unit.residueIndex[e.element])]:536870912},secondary_structure_key:function(e){tU.isAtomic(e.unit)||hj();var t=lj.get(e.structure).value?.get(e.unit.invariantId);return t?t.key[t.getIndex(e.unit.residueIndex[e.element])]:-1},chem_comp_type:function(e){return tU.isAtomic(e.unit)?e.unit.model.properties.chemicalComponentMap.get(gj(e)).type:hj()}},_j={key:function(e){return tU.isAtomic(e.unit)?e.unit.chainIndex[e.element]:hj()},label_asym_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_asym_id.value(e.unit.chainIndex[e.element]):hj()},auth_asym_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.auth_asym_id.value(e.unit.chainIndex[e.element]):hj()},label_entity_id:function(e){return tU.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_entity_id.value(e.unit.chainIndex[e.element]):hj()}},xj={key:mj.key,entityKey:function(e){return tU.isCoarse(e.unit)?e.unit.coarseElements.entityKey[e.element]:pj()},x:mj.x,y:mj.y,z:mj.z,asym_id:function(e){return tU.isCoarse(e.unit)?e.unit.coarseElements.asym_id.value(e.element):pj()},entity_id:function(e){return tU.isCoarse(e.unit)?e.unit.coarseElements.entity_id.value(e.element):pj()},seq_id_begin:function(e){return tU.isCoarse(e.unit)?e.unit.coarseElements.seq_id_begin.value(e.element):pj()},seq_id_end:function(e){return tU.isCoarse(e.unit)?e.unit.coarseElements.seq_id_end.value(e.element):pj()},sphere_radius:function(e){return tU.isSpheres(e.unit)?e.unit.coarseConformation.radius[e.element]:pj("spheres")},sphere_rmsf:function(e){return tU.isSpheres(e.unit)?e.unit.coarseConformation.rmsf[e.element]:pj("spheres")},gaussian_weight:function(e){return tU.isGaussians(e.unit)?e.unit.coarseConformation.weight[e.element]:pj("gaussians")},gaussian_covariance_matrix:function(e){return tU.isGaussians(e.unit)?e.unit.coarseConformation.covariance_matrix[e.element]:pj("gaussians")}};function Sj(e){switch(e.unit.kind){case 0:return e.unit.model.atomicHierarchy.index.getEntityFromChain(e.unit.chainIndex[e.element]);case 1:return e.unit.model.coarseHierarchy.spheres.entityKey[e.element];case 2:return e.unit.model.coarseHierarchy.gaussians.entityKey[e.element]}}var wj={key:Sj,id:function(e){return e.unit.model.entities.data.id.value(Sj(e))},type:function(e){return e.unit.model.entities.data.type.value(Sj(e))},src_method:function(e){return e.unit.model.entities.data.src_method.value(Sj(e))},pdbx_description:function(e){return e.unit.model.entities.data.pdbx_description.value(Sj(e))},formula_weight:function(e){return e.unit.model.entities.data.formula_weight.value(Sj(e))},pdbx_number_of_molecules:function(e){return e.unit.model.entities.data.pdbx_number_of_molecules.value(Sj(e))},details:function(e){return e.unit.model.entities.data.details.value(Sj(e))},pdbx_mutation:function(e){return e.unit.model.entities.data.pdbx_mutation.value(Sj(e))},pdbx_fragment:function(e){return e.unit.model.entities.data.pdbx_fragment.value(Sj(e))},pdbx_ec:function(e){return e.unit.model.entities.data.pdbx_ec.value(Sj(e))},subtype:function(e){return e.unit.model.entities.subtype.value(Sj(e))},prd_id:function(e){return e.unit.model.entities.prd_id?.value(Sj(e))??""}},Aj=[],Cj={constant:{true:function(e){return!0},false:function(e){return!1},zero:function(e){return 0}}
139,atom:mj,residue:bj,chain:_j,entity:wj,unit:{id:function(e){return e.unit.id},chainGroupId:function(e){return e.unit.chainGroupId},multiChain:function(e){return tU.Traits.is(e.unit.traits,tU.Trait.MultiChain)},object_primitive:function(e){return e.unit.objectPrimitive},operator_name:function(e){return e.unit.conformation.operator.name},operator_key:function(e){return e.unit.conformation.operator.key},model_index:function(e){return e.unit.model.modelNum},model_label:function(e){return e.unit.model.label},model_entry_id:function(e){return e.unit.model.entryId},hkl:function(e){return e.unit.conformation.operator.hkl},spgrOp:function(e){return e.unit.conformation.operator.spgrOp},model_num:function(e){return e.unit.model.modelNum},pdbx_struct_assembly_id:function(e){return e.unit.conformation.operator.assembly?.id||AE.DefaultName},pdbx_struct_oper_list_ids:function(e){return e.unit.conformation.operator.assembly?.operList||Aj},struct_ncs_oper_id:function(e){return e.unit.conformation.operator.ncsId}},coarse:xj},Tj=function(){function e(e){var t;this.index=new Map,this.checkOperator=!1,this.checkOperator=null!=(t=e?.checkOperator)&&t}return e.prototype.add=function(e){var t=this.index.get(e.label_asym_id);t||(t=new Map,this.index.set(e.label_asym_id,t));var r=t.get(e.label_seq_id);return r||(r=[],t.set(e.label_seq_id,r)),!this._find(e,r)&&(r.push(e),!0)},e.prototype.hasLabelAsymId=function(e){return this.index.has(e)},e.prototype.has=function(e){var t=Pj(e);if(this.index.has(t)){var r=this.index.get(t),n=Ej(e);if(r.has(n))for(var i=r.get(n),a=Mj(e),o=kj(e),s=Ij(e),u=Dj(e)??"1_555",c=0,l=i;c<l.length;c++){var d=l[c];if(d.label_comp_id===a&&d.label_alt_id===o&&d.ins_code===s&&(!this.checkOperator||(d.operator_name??"1_555")===u))return d}}},e.getLabel=function(e,t){return void 0===t&&(t=!1),`${e.label_asym_id} ${e.label_comp_id} ${e.label_seq_id}:${e.ins_code}:${e.label_alt_id}${t?" "+(e.operator_name??"1_555"):""}`},e.getEntryFromLocation=function(e){return{label_asym_id:Pj(e),label_comp_id:Mj(e),label_seq_id:Ej(e),label_alt_id:kj(e),ins_code:Ij(e),operator_name:Dj(e)??"1_555"}},e.prototype._find=function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];if(i.label_comp_id===e.label_comp_id&&i.label_alt_id===e.label_alt_id&&i.ins_code===e.ins_code&&(!this.checkOperator||(i.operator_name??"1_555")===(e.operator_name??"1_555")))return!0}return!1},e}(),Pj=Cj.chain.label_asym_id,Ej=Cj.residue.label_seq_id,Mj=Cj.atom.label_comp_id,kj=Cj.atom.label_alt_id,Ij=Cj.residue.pdbx_PDB_ins_code,Dj=Cj.unit.operator_name;function Oj(e,t,r){for(var n=t.subsetBuilder(!0),i=0,a=r.units;i<a.length;i++){var o=a[i];if(0===o.kind){var s=o.model.atomicHierarchy.residueAtomSegments,u=t.unitMap.get(o.id).elements,c=o.elements;n.beginUnit(o.id);for(var l=fE.transientSegments(s,c);l.hasNext;)for(var d=l.move().index,f=s.offsets[d],h=s.offsets[d+1];f<h;f++)PP.has(u,f)&&n.addElement(f);n.commitUnit(),e.throwIfTimedOut()}else n.setUnit(o.id,o.elements)}return n.getStructure()}function Rj(e,t,r,n){for(var i=new OU(t),a=t.lookup3d,o=n.radius,s=0,u=r.units;s<u.length;s++){for(var c=u[s],l=c.conformation,d=l.x,f=l.y,h=l.z,p=c.elements,m=0,g=p.length;m<g;m++){var v=p[m];a.findIntoBuilder(d(v),f(v),h(v),o,i)}e.throwIfTimedOut()}return n.wholeResidues?Oj(e,t,i.getStructure()):i.getStructure()}function Bj(e,t,r,n){var i=new OU(t),a=t.lookup3d,o=n.elementRadius,s=n.elementRadiusClosure,u=n.sourceMaxRadius,c=n.radius;e.pushCurrentElement(),e.element.structure=r;for(var l=0,d=r.units;l<d.length;l++){var f=d[l];e.element.unit=f;for(var h=f.conformation,p=h.x,m=h.y,g=h.z,v=f.elements,y=0,b=v.length;y<b;y++){var _=v[y];e.element.element=_;var x=o(e);a.findIntoBuilderWithRadius(p(_),m(_),g(_),x,u,c,s,i)}e.throwIfTimedOut()}return e.popCurrentElement(),n.wholeResidues?Oj(e,t,i.getStructure()):i.getStructure()}function Nj(e,t){return function(r){return e.element.structure=r.structure,e.element.unit=r.unit,e.element.element=r.element,t(e)}}function Fj(e,t){var r=0;e.element.structure=e.inputStructure;for(var n=0,i=e.inputStructure.units;n<i.length;n++){var a=i[n];e.element.unit=a;for(var o=a.elements,s=0,u=o.length;s<u;s++){var c=o[s];e.element.element=c;
139var l=t(e);l>r&&(r=l)}}return e.throwIfTimedOut(),r}function Lj(e,t,r){var n=function(e,t){for(var r=e.inputStructure,n=r.interUnitBonds,i=new OU(r),a=e.atomicBond,o=0,s=t.units;o<s.length;o++){var u=s[o];if(0===u.kind){var c=r.unitMap.get(u.id),l=c.bonds,d=l.offset,f=l.b,h=l.edgeProps,p=h.flags,m=h.order,g=h.key;for(a.setStructure(r),a.a.unit=c,a.b.unit=c,O=0,R=u.elements.length;O<R;O++){i.addToUnit(u.id,u.elements[O]);for(var v=PP.indexOf(c.elements,u.elements[O]),y=d[v],b=d[v+1];y<b;y++){var _=f[y],x=c.elements[_];PP.has(u.elements,x)||i.has(u.id,x)||(a.aIndex=v,a.a.element=u.elements[O],a.bIndex=_,a.b.element=x,a.type=p[y],a.order=m[y],a.key=g[y],a.test(e,!0)&&i.addToUnit(u.id,x))}}for(var S=0,w=n.getConnectedUnits(c.id);S<w.length;S++)for(var A=w[S],C=t.unitMap.get(A.unitB),T=r.unitMap.get(A.unitB),P=0,E=A.connectedIndices;P<E.length;P++){var M=E[P];if(PP.has(u.elements,c.elements[M]))for(var k=0,I=A.getEdges(M);k<I.length;k++){var D=I[k];x=T.elements[D.indexB],C&&PP.has(C.elements,x)||i.has(A.unitB,x)||(a.a.unit=c,a.aIndex=M,a.a.element=c.elements[M],a.b.unit=T,a.bIndex=D.indexB,a.b.element=x,a.type=D.props.flag,a.order=D.props.order,a.key=D.props.key,a.test(e,!0)&&i.addToUnit(A.unitB,x))}}}else{i.beginUnit(u.id);for(var O=0,R=u.elements.length;O<R;O++)i.addElement(u.elements[O]);i.commitUnit()}}return i.getStructure()}(e,r);return t?Oj(e,e.inputStructure,n):n}var $j=Cj.entity.type;function Uj(e){return"water"===$j(e)}var jj,zj,Gj=function(){function e(){this.vertices=new Map,this.edges=new Map}return e.prototype.addVertex=function(e,t){this.vertices.has(t)||(this.vertices.set(t,e),this.edges.set(t,[]))},e.prototype.addEdge=function(e,t){var r=Tj.getLabel(e),n=Tj.getLabel(t);this.addVertex(e,r),this.addVertex(t,n),Hb(this.edges.get(r),n),Hb(this.edges.get(n),r)},e.prototype.addComponent=function(e,t){var r=Tj.getLabel(e);if(this.vertices.has(r)){var n=new Set,i=new Set,a=[r];for(i.add(r),t.add(e);a.length>0;){var o=a.pop();n.add(o);for(var s=this.vertices.get(o),u=0,c=this.edges.get(o);u<c.length;u++){var l=c[u];if(!n.has(l)&&(a.push(l),!i.has(l))){i.add(l);var d=this.vertices.get(l);s.operator_name===d.operator_name?t.add(Ac(Ac({},d),{operator_name:e.operator_name})):t.add(d)}}}}else t.add(e)},e}(),Vj=Object.freeze({__proto__:null,exceptBy:function(e,t){return function(r){var n=e(r);if(0===oU.structureCount(n))return n;var i=t(r);if(0===oU.structureCount(i))return n;var a=oU.unionStructure(i),o=oU.UniqueBuilder(r.inputStructure);return oU.forEach(n,function(e,t){var n=pU(e,a);0!==n.elementCount&&o.add(n),t%50==0&&r.throwIfTimedOut()}),o.getSelection()}},expandProperty:function(e,t){return function(r){var n=e(r),i=new Map,a=[];r.pushCurrentElement(),oU.forEach(n,function(e,n){r.element.structure=e;for(var o=0,s=e.units;o<s.length;o++){var u=s[o];r.element.unit=u;for(var c=u.elements,l=0,d=c.length;l<d;l++){r.element.element=c[l];var f=t(r),h=void 0;i.has(f)?h=i.get(f):(h=gS.create(),i.set(f,h)),gS.add(h,n,n)}}a[n]=r.inputStructure.subsetBuilder(!0),n%10==0&&r.throwIfTimedOut()}),r.element.structure=r.inputStructure;for(var o=0,s=r.inputStructure.units;o<s.length;o++){var u=s[o];r.element.unit=u;for(var c=u.elements,l=0,d=c.length;l<d;l++){r.element.element=c[l];var f=t(r);if(i.has(f))for(var h=i.get(f).array,p=0,m=h.length;p<m;p++)a[h[p]].addToUnit(u.id,c[l])}}r.popCurrentElement();for(var g=oU.UniqueBuilder(r.inputStructure),v=0,y=a;v<y.length;v++){var b=y[v];g.add(b.getStructure())}return g.getSelection()}},includeConnected:function(e){var t=e.query,r=e.layerCount,n=e.wholeResidues,i=e.bondTest,a=e.fixedPoint,o=Math.max(r,0);return function(e){var r=oU.UniqueBuilder(e.inputStructure),s=t(e);return e.pushCurrentBond(),e.atomicBond.setTestFn(i),oU.forEach(s,function(t,i){var s=t;if(a)for(;;){var u=s.elementCount;if((s=Lj(e,n,s)).elementCount===u)break}else for(var c=0;c<o;c++)s=Lj(e,n,s);r.add(s),i%10==0&&e.throwIfTimedOut()}),e.popCurrentBond(),r.getSelection()}},includeSurroundings:function(e,t){return function(r){var n=e(r);if(t.elementRadius){var i=Ac(Ac({},t),{elementRadius:t.elementRadius,elementRadiusClosure:Nj(r,t.elementRadius),sourceMaxRadius:Fj(r,t.elementRadius)});if(oU.isSingleton(n)){var a=Bj(r,r.inputStructure,n.structure,i);return oU.Singletons(r.inputStructure,a)}for(var o=new SU(r.inputStructure),s=0,u=n.structures;s<u.length;s++){var c=u[s];o.add(Bj(r,r.inputStructure,c,i))}return o.getSelection()}if(oU.isSingleton(n))return a=Rj(r,r.inputStructure,n.structure,t),oU.Singletons(r.inputStructure,a);o=new SU(r.inputStructure);for(var l=0,d=n.structures;l<d.length;l++)c=d[l],o.add(Rj(r,r.inputStructure,c,t));return o.getSelection()}},intersectBy:function(e,t){return function(r){var n=e(r);if(0===oU.structureCount(n))return n;var i=t(r);if(0===oU.structureCount(i))return oU.Empty(r.inputStructure);
139var a=oU.unionStructure(i),o=oU.UniqueBuilder(r.inputStructure);return oU.forEach(n,function(e,t){var n=hU(a,e);0!==n.elementCount&&o.add(n),t%50==0&&r.throwIfTimedOut()}),o.getSelection()}},querySelection:function(e,t){return function(r){var n=e(r);if(0===oU.structureCount(n))return n;var i=oU.UniqueBuilder(r.inputStructure),a=function(e){return i.add(e)};return oU.forEach(n,function(e,n){r.pushInputStructure(e),oU.forEach(t(r),a),r.popInputStructure(),n%10==0&&r.throwIfTimedOut()}),i.getSelection()}},surroundingLigands:function(e){var t=e.query,r=e.radius,n=e.includeWater;return function(e){for(var i=oU.unionStructure(t(e)),a=Oj(e,e.inputStructure,Rj(e,e.inputStructure,i,{radius:r})),o=function(e){var t=e.models[0],r=new Set;if(!qz.is(t.sourceData))return r;for(var n=t.sourceData.data.db.pdbx_molecule,i=n._rowCount,a=n.asym_id,o=0;o<i;o++)r.add(a.value(o));return r}(e.inputStructure),s=function(e){var t=e.models[0],r=new Gj;if(!qz.is(t.sourceData))return r;for(var n=t.sourceData.data.db.struct_conn,i=n.conn_type_id,a=n.ptnr1_label_asym_id,o=n.ptnr1_label_comp_id,s=n.ptnr1_label_seq_id,u=n.ptnr1_symmetry,c=n.pdbx_ptnr1_label_alt_id,l=n.pdbx_ptnr1_PDB_ins_code,d=n.ptnr2_label_asym_id,f=n.ptnr2_label_comp_id,h=n.ptnr2_label_seq_id,p=n.ptnr2_symmetry,m=n.pdbx_ptnr2_label_alt_id,g=n.pdbx_ptnr2_PDB_ins_code,v=0;v<n._rowCount;v++){var y=i.value(v);if("covale"===y||"metalc"===y){var b={label_asym_id:a.value(v),label_comp_id:o.value(v),label_seq_id:s.value(v),label_alt_id:c.value(v),ins_code:l.value(v),operator_name:u.value(v)??"1_555"},_={label_asym_id:d.value(v),label_comp_id:f.value(v),label_seq_id:h.value(v),label_alt_id:m.value(v),ins_code:g.value(v),operator_name:p.value(v)??"1_555"};r.addEdge(b,_)}}return r}(e.inputStructure),u=qF.create(a),c=new Map,l=new Tj({checkOperator:!0}),d=0,f=a.units;d<f.length;d++)if(0===(M=f[d]).kind){u.unit=M;for(var h=M.elements,p=fE.transientSegments(M.model.atomicHierarchy.chainAtomSegments,h),m=fE.transientSegments(M.model.atomicHierarchy.residueAtomSegments,h);p.hasNext;){var g=p.move();u.element=h[g.start];var v=Cj.chain.label_asym_id(u),y=Cj.unit.operator_name(u);if(o.has(v))c.has(v)?Hb(c.get(v),y):c.set(v,[y]);else{var b=Cj.entity.type(u);if("water"!==b&&"polymer"!==b)for(m.setSegment(g);m.hasNext;){var _=m.move();u.element=h[_.start],s.addComponent(Tj.getEntryFromLocation(u),l)}}}e.throwIfTimedOut()}for(var x=e.inputStructure.subsetBuilder(!0),S=0,w=e.inputStructure.units;S<w.length;S++)if(0===(M=w[S]).kind){for(u.unit=M,h=M.elements,p=fE.transientSegments(M.model.atomicHierarchy.chainAtomSegments,h),m=fE.transientSegments(M.model.atomicHierarchy.residueAtomSegments,h),x.beginUnit(M.id);p.hasNext;)if(g=p.move(),u.element=h[g.start],v=Cj.chain.label_asym_id(u),y=Cj.unit.operator_name(u),c.has(v)&&c.get(v).indexOf(y)>=0)x.addElementRange(h,g.start,g.end);else if(l.hasLabelAsymId(v))for(m.setSegment(g);m.hasNext;)_=m.move(),u.element=h[_.start],l.has(u)&&x.addElementRange(h,_.start,_.end);x.commitUnit(),e.throwIfTimedOut()}var A=cU(e.inputStructure,[x.getStructure(),i]);if(n){for(var C=new OU(e.inputStructure),T=e.inputStructure.lookup3d,P=0,E=A.units;P<E.length;P++){for(var M,k=(M=E[P]).conformation,I=k.x,D=k.y,O=k.z,R=0,B=(h=M.elements).length;R<B;R++){var N=h[R];T.findIntoBuilderIf(I(N),D(N),O(N),r,C,Uj),C.addToUnit(M.id,N)}e.throwIfTimedOut()}return oU.Sequence(e.inputStructure,[C.getStructure()])}return oU.Sequence(e.inputStructure,[A])}},union:function(e){return function(t){var r=oU.LinearBuilder(t.inputStructure);return r.add(oU.unionStructure(e(t))),r.getSelection()}},wholeResidues:function(e){return function(t){var r=e(t);if(oU.isSingleton(r))return oU.Singletons(t.inputStructure,Oj(t,t.inputStructure,r.structure));for(var n=new SU(t.inputStructure),i=0,a=r.structures;i<a.length;i++){var o=a[i];n.add(Oj(t,t.inputStructure,o))}return n.getSelection()}}});function Hj(e,t,r){var n=e.currentStructure.units,i=e.pushCurrentElement();i.structure=e.currentStructure;for(var a=0,o=n;a<o.length;a++){var s=o[a];i.unit=s;var u=s.elements,c=t;if(c){for(var l=0,d=u.length;l<d;l++)i.element=u[l],r.add(c(e));e.throwIfTimedOut()}}return e.popCurrentElement(),r}(function(e){var t=Cg.zero();function r(e,r,n,i,a,o,s){var u=r.elements,c=r.conformation.position,l=t;e.element.unit=r;
139for(var d=!1,f=0,h=u.length;f<h;f++){var p=u[f];e.element.element=p;var m=Math.max(0,Cg.distance(n,c(p,l))-i-s(e));if(m<a)return 0;m<o&&(d=!0)}return d?1:2}function n(e,t,n,i,a,o,s){for(var u=t.units,c=!1,l=0,d=u.length;l<d;l++){var f=r(e,u[l],n,i,a,o,s);if(0===f)return 0;1===f&&(c=!0)}return c?1:2}var i=Cg.zero();e.check=function(e,t,r,a,o,s){if(0===t.elementCount||0===r.elementCount)return 0;var u=t.units,c=!1;e.element.structure=t;for(var l=0,d=u.length;l<d;l++){var f=u[l],h=f.elements,p=f.conformation.position;e.element.unit=f;for(var m=0,g=h.length;m<g;m++){var v=h[m];e.element.element=v;var y=n(e,r,p(v,i),s(e),a,o,s);if(0===y)return!1;1===y&&(c=!0)}}return c}})(jj||={}),function(e){var t=Cg.zero();function r(e,r,n,i,a,o){var s=r.elements,u=r.conformation.position,c=t;e.element.unit=r;for(var l=0,d=s.length;l<d;l++){var f=s[l];if(e.element.element=f,Math.max(0,Cg.distance(n,u(f,c))-i-o(e))<=a)return!0}return!1}function n(e,t,n,i,a,o){for(var s=t.units,u=0,c=s.length;u<c;u++)if(r(e,s[u],n,i,a,o))return!0;return!1}var i=Cg.zero();e.check=function(e,t,r,a,o){if(0===t.elementCount||0===r.elementCount)return 0;var s=t.units;e.element.structure=t;for(var u=0,c=s.length;u<c;u++){var l=s[u];e.element.unit=l;for(var d=l.elements,f=l.conformation.position,h=0,p=d.length;h<p;h++){var m=d[h];if(e.element.element=m,n(e,r,f(m,i),o(e),a,o))return!0}}return!1}}(zj||={});var qj,Wj=Object.freeze({__proto__:null,areIntersectedBy:function(e,t){return function(r){var n=oU.unionStructure(t(r)),i=oU.LinearBuilder(r.inputStructure);return oU.forEach(e(r),function(e,t){fU(n,e)&&i.add(e),t%10&&r.throwIfTimedOut()}),i.getSelection()}},first:function(e){return function(t){var r=e(t),n=oU.LinearBuilder(t.inputStructure);if("singletons"===r.kind){if(r.structure.elementCount>0){var i=r.structure.units[0],a=yz.create([i.getChild(PP.ofSingleton(i.elements[0]))],{parent:t.inputStructure});n.add(a)}}else r.structures.length>0&&n.add(r.structures[0]);return n.getSelection()}},getCurrentStructureProperties:Hj,isConnectedTo:function(e){var t=e.query,r=e.target,n=e.disjunct,i=e.invert,a=e.bondTest;return function(e){var o=r(e);if(oU.isEmpty(o))return o;var s=t(e);if(oU.isEmpty(s))return s;var u={queryCtx:e,input:e.inputStructure,disjunct:n,target:oU.unionStructure(o)},c=oU.LinearBuilder(e.inputStructure);return e.pushCurrentBond(),e.atomicBond.setTestFn(a),oU.forEach(s,function(t,r){(function(e,t){var r=e.queryCtx,n=e.input,i=e.target,a=e.disjunct,o=r.atomicBond,s=n.interUnitBonds;o.setStructure(n);for(var u=0,c=t.units;u<c.length;u++){var l=c[u];if(tU.isAtomic(l))for(var d=n.unitMap.get(l.id),f=d.bonds,h=f.offset,p=f.b,m=f.edgeProps,g=m.flags,v=m.order,y=m.key,b=s.getConnectedUnits(l.id),_=b.length,x=l.elements,S=d.elements,w=0,A=x.length;w<A;w++){var C=PP.indexOf(S,x[w]);o.a.unit=d,o.b.unit=d;for(var T=h[C],P=h[C+1];T<P;T++)if(o.b.element=d.elements[p[T]],(!a||!PP.has(l.elements,o.b.element))&&i.hasElement(o.b)&&(o.aIndex=C,o.a.element=x[w],o.bIndex=p[T],o.type=g[T],o.order=v[T],o.key=y[T],o.test(r,!0)))return!0;for(var E=0;E<_;E++)for(var M=b[E],k=n.unitMap.get(M.unitB),I=k.elements,D=M.getEdges(C),O=0,R=D.length;O<R;O++){var B=D[O];if(o.b.unit=k,o.b.element=I[B.indexB],i.hasElement(o.b)&&(!a||!t.hasElement(o.b))&&(o.a.unit=d,o.aIndex=C,o.a.element=x[w],o.bIndex=B.indexB,o.type=B.props.flag,o.order=B.props.order,o.key=B.props.key,o.test(r,!0)))return!0}}}return!1}(u,t)||i)&&c.add(t),r%5==0&&e.throwIfTimedOut()}),e.popCurrentBond(),c.getSelection()}},pick:function(e,t){return function(r){var n=e(r),i=oU.LinearBuilder(r.inputStructure);return r.pushCurrentElement(),oU.forEach(n,function(e,n){r.currentStructure=e,t(r)&&i.add(e),n%100&&r.throwIfTimedOut()}),r.popCurrentStructure(),i.getSelection()}},withSameAtomProperties:function(e,t,r){return function(n){var i=e(n),a=function(e,t,r){var n=new Set,i=t(e);return e.pushCurrentElement(),oU.forEach(i,function(t,i){e.currentStructure=t,Hj(e,r,n),i%10&&e.throwIfTimedOut()}),e.popCurrentElement(),n}(n,t,r),o=oU.LinearBuilder(n.inputStructure);return n.pushCurrentStructure(),oU.forEach(i,function(e,t){n.currentStructure=e;var i=Hj(n,r,new Set);mN.isSuperset(a,i)&&o.add(e),t%10&&n.throwIfTimedOut()}),n.popCurrentStructure(),o.getSelection()}},within:function(e){return function(t){var r={queryCtx:t,selection:e.query(t),target:e.target(t),maxRadius:e.maxRadius,minRadius:e.minRadius?Math.max(0,e.minRadius):0,elementRadius:e.elementRadius,invert:!!e.invert};return 0===r.minRadius&&void 0===e.minRadius?function(e){var t=e.queryCtx,r=e.selection,n=e.target,i=e.maxRadius,a=e.invert,o=oU.unionStru
139cture(n).lookup3d,s=oU.LinearBuilder(t.inputStructure),u=Cg.zero();return oU.forEach(r,function(e,r){for(var n=e.units,c=!1,l=0,d=n.length;l<d;l++){for(var f=n[l],h=f.elements,p=f.conformation,m=p.position,g=p.r,v=0,y=h.length;v<y;v++){var b=h[v];if(m(b,u),o.check(u[0],u[1],u[2],i+g(b))){c=!0;break}}if(c)break}a&&(c=!c),c&&s.add(e),r%10==0&&t.throwIfTimedOut()}),s.getSelection()}(r):0===r.minRadius?function(e){var t=e.queryCtx,r=e.selection,n=e.target,i=e.maxRadius,a=e.invert,o=e.elementRadius,s=oU.unionStructure(n),u=oU.LinearBuilder(t.inputStructure);return t.pushCurrentElement(),oU.forEach(r,function(e,r){var n=function(e,t,r,n,i){return 0===t.elementCount||0===r.elementCount||(t.elementCount<=r.elementCount?zj.check(e,t,r,n,i):zj.check(e,r,t,n,i))}(t,s,e,i,o);a&&(n=!n),n&&u.add(e),r%10==0&&t.throwIfTimedOut()}),t.popCurrentElement(),u.getSelection()}(r):function(e){var t=e.queryCtx,r=e.selection,n=e.target,i=e.minRadius,a=e.maxRadius,o=e.invert,s=e.elementRadius,u=oU.unionStructure(n),c=oU.LinearBuilder(t.inputStructure);return t.pushCurrentElement(),oU.forEach(r,function(e,r){var n=function(e,t,r,n,i,a){return 0===t.elementCount||0===r.elementCount||(t.elementCount<=r.elementCount?jj.check(e,t,r,n,i,a):jj.check(e,r,t,n,i,a))}(t,u,e,i,a,s);o&&(n=!n),n&&c.add(e),r%10==0&&t.throwIfTimedOut()}),t.popCurrentElement(),c.getSelection()}(r)}}}),Xj=Object.freeze({__proto__:null,intersect:function(e){return 0===e.length?AU:1===e.length?e[0]:function(t){for(var r=[],n=0;n<e.length;n++)r.push(e[n](t));var i=0,a=oU.structureCount(r[0]);for(n=1;n<r.length;n++){var o=oU.structureCount(r[n]);o<a&&(i=n,a=o)}t.throwIfTimedOut();var s=hS(function(e){return e.hashCode},yz.areUnitIdsAndIndicesEqual);oU.forEach(r[i],function(e){return s.add(e)});for(var u=oU.UniqueBuilder(t.inputStructure),c=0;c<r.length;c++)c!==i&&(oU.forEach(r[c],function(e){s.has(e)&&u.add(e)}),t.throwIfTimedOut());return u.getSelection()}},merge:function(e){return 0===e.length?AU:1===e.length?e[0]:function(t){for(var r=oU.UniqueBuilder(t.inputStructure),n=function(n){oU.forEach(e[n](t),function(e,i){r.add(e),n%100&&t.throwIfTimedOut()})},i=0;i<e.length;i++)n(i);return r.getSelection()}}}),Yj=Object.freeze({__proto__:null,atomCount:function(e){return e.currentStructure.elementCount},countQuery:function(e){return function(t){var r=e(t);return oU.structureCount(r)}},propertySet:function(e){return function(t){return Hj(t,e,new Set)}}});!function(e){function t(e){return!0}function r(e){return!1}e.eq=function(e,t){return function(r){return e(r)===t}},e.lt=function(e,t){return function(r){return e(r)<t}},e.lte=function(e,t){return function(r){return e(r)<=t}},e.gt=function(e,t){return function(r){return e(r)>t}},e.gte=function(e,t){return function(r){return e(r)>=t}},e.inSet=function(e,t){if(function(e){return!!e&&!!e.has}(t))return function(r){return t.has(e(r))};if(0===t.length)return r;for(var n=new Set,i=0;i<t.length;i++)n.add(t[i]);return function(t){return n.has(e(t))}},e.and=function(){var e=[...arguments];switch(e.length){case 0:return t;case 1:return e[0];case 2:var r=e[0],n=e[1];return function(e){return r(e)&&n(e)};case 3:var i=e[0],a=e[1],o=e[2];return function(e){return i(e)&&a(e)&&o(e)};case 4:var s=e[0],u=e[1],c=e[2],l=e[3];return function(e){return s(e)&&u(e)&&c(e)&&l(e)};case 5:var d=e[0],f=e[1],h=e[2],p=e[3],m=e[4];return function(e){return d(e)&&f(e)&&h(e)&&p(e)&&m(e)};case 6:var g=e[0],v=e[1],y=e[2],b=e[3],_=e[4],x=e[5];return function(e){return g(e)&&v(e)&&y(e)&&b(e)&&_(e)&&x(e)};default:var S=e.length;return function(t){for(var r=0;r<S;r++)if(!e[r])return!1;return!0}}},e.or=function(){var e=[...arguments];switch(e.length){case 0:return r;case 1:return e[0];case 2:var t=e[0],n=e[1];return function(e){return t(e)||n(e)};case 3:var i=e[0],a=e[1],o=e[2];return function(e){return i(e)||a(e)||o(e)};case 4:var s=e[0],u=e[1],c=e[2],l=e[3];return function(e){return s(e)||u(e)||c(e)||l(e)};case 5:var d=e[0],f=e[1],h=e[2],p=e[3],m=e[4];return function(e){return d(e)||f(e)||h(e)||p(e)||m(e)};case 6:var g=e[0],v=e[1],y=e[2],b=e[3],_=e[4],x=e[5];return function(e){return g(e)||v(e)||y(e)||b(e)||_(e)||x(e)};default:var S=e.length;return function(t){for(var r=0;r<S;r++)if(e[r])return!0;return!1}}}}(qj||={});var Kj,Zj={generators:DU,filters:Wj,modifiers:Vj,combinators:Xj,pred:qj,internal:bU,atomset:Yj};function Qj(e,t,r,n,i,a){var o=e.spacegroup,s=e.ncsOperators,u=[],c=o.cell.toFractional,l=Cg.transformMat4(Cg(),a,c),d=$E.getSymmetryOperatorRef(o,t,r,n,i,l);if(s&&s.length)for(var f=0,h=s.length;f<h;
139++f){var p=s[f],m=Og.mul(Og(),d.matrix,p.matrix),g=AE.create(`${d.name} ${p.name}`,m,{assembly:d.assembly,ncsId:p.ncsId,hkl:d.hkl,spgrOp:d.spgrOp});u.push(g)}else u.push(d);return u}function Jj(e,t,r,n){var i=e.spacegroup,a=e.ncsOperators,o=a&&a.length||0,s=[];!o&&t[0]<=0&&r[0]>=0&&t[1]<=0&&r[1]>=0&&t[2]<=0&&r[2]>=0&&(s[0]=$E.getSymmetryOperator(i,0,0,0,0));for(var u=0;u<i.operators.length;u++)for(var c=t[0];c<=r[0];c++)for(var l=t[1];l<=r[1];l++)for(var d=t[2];d<=r[2];d++)(o||0!==u||0!==c||0!==l||0!==d)&&s.push.apply(s,Qj(e,u,c,l,d,n));return s}function ez(e,t){for(var r=yz.Builder({label:e.label,dynamicBonds:e.dynamicBonds}),n=e.units,i=0,a=t;i<a.length;i++)for(var o=a[i],s=0,u=n;s<u.length;s++){var c=u[s];r.addWithOperator(c,o)}return r.getStructure()}!function(e){function t(e,t){return e.invariantId===t.invariantId&&e.model.id===t.model.id&&PP.areEqual(e.elements,t.elements)}function r(){return function(e,t){return new Av(e,t)}(tU.hashUnit,t)}e.buildAssembly=function(e,t){var r=this;return vy.create("Build Assembly",function(n){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v;return Pc(this,function(y){if(1!==(r=e.models).length)throw Error("Can only build assemblies from structures based on 1 model.");if(!(n=jF.findAssembly(r[0],t)))throw Error(`Assembly '${t}' is not defined.`);for(i=AE.create(n.id,Og.identity(),{assembly:{id:n.id,operId:0,operList:[]}}),a=yz.Builder({coordinateSystem:i,label:e.label,dynamicBonds:e.dynamicBonds}),o=new _U(e),s=0,u=n.operatorGroups;s<u.length;s++)if(c=u[s],l=c.selector(o),0!==oU.structureCount(l))for(d=oU.unionStructure(l).units,f=0,h=c.operators;f<h.length;f++)for(p=h[f],m=0,g=d;m<g.length;m++)v=g[m],a.addWithOperator(v,p);return[2,a.getStructure()]})})})},e.buildSymmetryAssembly=function(e,t,r){var n=this;return vy.create("Build Symmetry Assembly",function(i){return Tc(n,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P;return Pc(this,function(E){if(1!==(n=e.models).length)throw Error("Can only build symmetry assemblies from structures based on 1 model.");for(i=Cg(),a=yz.Builder({label:e.label,representativeModel:n[0],dynamicBonds:e.dynamicBonds}),o=new _U(e),s=0,u=t;s<u.length;s++)if(M=(c=u[s]).asymIds,l=Zj.generators.atoms({chainTest:Zj.pred.and(Zj.pred.eq(function(e){return Cj.unit.operator_name(e.element)},AE.DefaultName),Zj.pred.inSet(function(e){return Cj.chain.label_asym_id(e.element)},M))}),d=l(o),0!==oU.structureCount(d))for(f=oU.unionStructure(d).units,h=0,p=c.operators;h<p.length;h++)for(m=p[h],g=m.index,v=m.shift,y=v[0],b=v[1],_=v[2],x=Qj(r,g,y,b,_,i),S=0,w=f;S<w.length;S++)for(A=w[S],C=0,T=x;C<T.length;C++)P=T[C],a.addWithOperator(A,P);var M;return[2,a.getStructure()]})})})},e.builderSymmetryMates=function(e,t){return vy.create("Find Symmetry Mates",function(r){return function(e,t,r){return Tc(this,void 0,void 0,function(){function n(e,t){return`${e.invariantId}|${t.name}`}var i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A;return Pc(this,function(C){switch(C.label){case 0:if(1!==(i=t.models).length)throw Error("Can only build symmetries from structures based on 1 model.");return(a=Dz.Provider.get(i[0]))?(o=a.spacegroup,LE.isZero(o.cell)?[2,t]:e.shouldUpdate?[4,e.update("Initialing...")]:[3,2]):[2,t];
139case 1:C.sent(),C.label=2;case 2:s=Xz.getCenter(i[0]),u=function(e,t){return e._operators_333&&Cg.equals(t,e._operators_333.ref)||(e._operators_333={ref:Cg.clone(t),operators:Jj(e,Cg.create(-3,-3,-3),Cg.create(3,3,3),t)}),e._operators_333.operators}(a,s),c=t.lookup3d,l=new Set,d=yz.Builder({label:t.label,dynamicBonds:t.dynamicBonds}),f=t.units,h=Cg.zero(),p=0,m=u,C.label=3;case 3:if(!(p<m.length))return[3,6];for(g=m[p],v=0,y=f;v<y.length;v++)for(b=y[v],_=b.lookup3d.boundary.sphere,Cg.transformMat4(h,_.center,g.matrix),x=c.findUnitIndices(h[0],h[1],h[2],_.radius+r),S=0,w=x.count;S<w;S++)f[x.indices[S]].lookup3d.check(h[0],h[1],h[2],_.radius+r)&&(A=n(b,g),l.has(A)||(d.addWithOperator(b,g),l.add(A)));return e.shouldUpdate?[4,e.update("Building symmetry...")]:[3,5];case 4:C.sent(),C.label=5;case 5:return p++,[3,3];case 6:return[2,d.getStructure()]}})})}(r,e,t)})},e.buildSymmetryRange=function(e,t,r){return vy.create("Build Symmetry",function(n){return function(e,t,r,n){return Tc(this,void 0,void 0,function(){var e,i,a,o,s;return Pc(this,function(u){if(1!==(e=t.models).length)throw Error("Can only build symmetries from structures based on 1 model.");return(i=Dz.Provider.get(e[0]))?(a=i.spacegroup,LE.isZero(a.cell)?[2,t]:(o=Xz.getCenter(e[0]),s=Jj(i,r,n,o),[2,ez(t,s)])):[2,t]})})}(0,e,t,r)})},e.buildNcs=function(e){return vy.create("Build NCS",function(t){return function(e,t){return Tc(this,void 0,void 0,function(){var e,r,n;return Pc(this,function(i){if(1!==(e=t.models).length)throw Error("Can only build NCS from structures based on 1 model.");return(r=Dz.Provider.get(e[0]))&&(n=r.ncsOperators)&&n.length?[2,ez(t,n)]:[2,t]})})}(0,e)})},e.areUnitsEquivalent=t,e.UnitEquivalenceBuilder=r,e.computeTransformGroups=function(e){for(var t=r(),n=0,i=e.units;n<i.length;n++){var a=i[n];t.add(a.id,a)}for(var o=[],s=0,u=t.groups;s<u.length;s++){var c=u[s];o.push(tU.SymmetryGroup(c.map(function(t){return e.unitMap.get(t)})))}return o},e.areTransformGroupsEquivalent=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;++r){var i=e[r].units,a=t[r].units;if(i.length!==a.length||e[r].hashCode!==t[r].hashCode)return!1;for(var o=0,s=i.length;o<s;o++)if(i[o].conformation!==a[o].conformation)return!1}return!0}}(Kj||={});var tz=function(){function e(e,t){this.parent=e,this.isSorted=t,this.ids=[],this.unitMap=mE.Mutable(),this.parentId=-1,this.currentUnit=[],this.elementCount=0}return e.prototype.addToUnit=function(e,t){var r=this.unitMap.get(e);r?r[r.length]=t:(this.unitMap.set(e,[t]),this.ids[this.ids.length]=e),this.elementCount++},e.prototype.beginUnit=function(e){this.parentId=e,this.currentUnit=this.currentUnit.length>0?[]:this.currentUnit},e.prototype.addElement=function(e){this.currentUnit[this.currentUnit.length]=e,this.elementCount++},e.prototype.addElementRange=function(e,t,r){for(var n=t;n<r;n++)this.currentUnit[this.currentUnit.length]=e[n],this.elementCount++},e.prototype.commitUnit=function(){0!==this.currentUnit.length&&(this.ids[this.ids.length]=this.parentId,this.unitMap.set(this.parentId,this.currentUnit),this.parentId=-1)},e.prototype.setUnit=function(e,t){this.ids[this.ids.length]=e,this.unitMap.set(e,t),this.elementCount+=t.length},e.prototype._getStructure=function(e){if(this.isEmpty)return yz.Empty;var t=[];vv(this.ids);for(var r=Kj.UnitEquivalenceBuilder(),n=0,i=this.ids.length;n<i;n++){var a=this.ids[n],o=this.parent.unitMap.get(a),s=this.unitMap.get(a),u=!1;e&&(this.isSorted||vv(s),s=PP.deduplicate(PP.ofSortedArray(this.currentUnit)),u=!0);var c=s.length;if(s.length!==o.elements.length){!this.isSorted&&!u&&c>1&&vv(s);var l=o.getChild(PP.ofSortedArray(s)),d=r.add(l.id,l);l!==d&&(l=d.applyOperator(l.id,l.conformation.operator,!0)),t[t.length]=l}else t[t.length]=o,r.add(o.id,o)}return yz.create(t,{parent:this.parent})},e.prototype.getStructure=function(){return this._getStructure(!1)},e.prototype.getStructureDeduplicate=function(){return this._getStructure(!0)},e.prototype.setSingletonLocation=function(e){var t=this.ids[0];e.unit=this.parent.unitMap.get(t),e.element=this.unitMap.get(t)[0]},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.elementCount}
139,enumerable:!1,configurable:!0}),e}();function rz(e,t){for(var r=1;t--;)r*=e--;return r}var nz=function(){function e(e,t){this.array=e,this.hasNext=!1,this.index=(1<<t)-1,this.size=function(e,t){return t>e?0:rz(e,t)/rz(t,t)}(e.length,t),this.maxIndex=1<<e.length,this.value=Array(t),this.hasNext=t>0&&t<=e.length}return e.prototype.move=function(){if(this.hasNext){for(var e=0,t=0,r=this.index;r;r>>>=1,e++)1&r&&(this.value[t++]=this.array[e]);this.index=function(e){var t=e&-e,r=e+t;return r|((r&-r)/t>>1)-1}(this.index),this.hasNext=this.index<this.maxIndex}return this.value},e}();function iz(e,t){for(var r=[],n=new nz(e,t);n.hasNext;)r.push(n.move().slice());return r}var az=[],oz={links:az,terminalLinks:az,elements:az,partialElements:az,getElementIndices:function(){return az},getLinkIndices:function(){return az},getTerminalLinkIndices:function(){return az}},sz=kN("C"),uz=kN("O"),cz=[z$.elementFingerprint([sz,sz,sz,uz]),z$.elementFingerprint([sz,sz,sz,sz,uz]),z$.elementFingerprint([sz,sz,sz,sz,sz,uz]),z$.elementFingerprint([sz,sz,sz,sz,sz,sz,uz])];function lz(e,t){for(var r=-1,n=-1,i=-1,a=-1,o=e.elements,s=e.model.atomicHierarchy.atoms,u=s.type_symbol,c=s.label_atom_id,l=e.bonds,d=l.b,f=l.offset,h=0,p=t.length;h<p;++h){var m=o[t[h]];if(u.value(m)===sz){for(var g=0,v=0,y=f[t[h]],b=f[t[h]+1];y<b;++y){var _=o[d[y]],x=u.value(_);x===uz?++g:x===sz&&++v}if(2===g){r=m;break}1===g&&1===v?n=m:c.value(m).startsWith("C1")?i=m:a=m}}return-1===r?-1===n?-1===i?-1===a?o[t[0]]:a:i:n:r}function dz(e,t,r,n){var i=t.conformation.position;return Cg.normalize(e,Cg.sub(e,n,i(r,e))),e}function fz(e,t){var r=e.elements;return e.model.atomicHierarchy.atoms.label_atom_id.value(r[t])}function hz(e,t){if(t&&t.length){for(var r=e.unit,n=e.all,i=new Set,a=iz(zb(Array(t.length)),2),o=0,s=a.length;o<s;++o){var u=a[o],c=n[t[u[0]]],l=n[t[u[1]]];PP.areIntersecting(c,l)&&z$.getAltId(r,c)===z$.getAltId(r,l)&&(i.add(t[u[0]]),i.add(t[u[1]]))}if(i.size){var d=[];for(o=0,s=t.length;o<s;++o)i.has(t[o])||d.push(t[o]);return d}return t}}function pz(e,t){return t.properties.saccharideComponentMap.get(e)}var mz=XE(),gz=new PM("14"),vz=new PM("98"),yz=function(){function e(e,t,r,n,i){this.units=e,this.unitMap=t,this.unitIndexMap=r,this.state=n,this._child=i?.child,this._target=i?.target,this._proxy=void 0}return e.prototype.subsetBuilder=function(e){return new tz(this,e)},Object.defineProperty(e.prototype,"elementCount",{get:function(){return this.state.elementCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bondCount",{get:function(){return-1===this.state.bondCount&&(this.state.bondCount=this.interUnitBonds.edgeCount+C$.getIntraUnitBondCount(this)),this.state.bondCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasCustomProperties",{get:function(){return!!this.state.customProps&&this.state.customProps.all.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"customPropertyDescriptors",{get:function(){return this.state.customProps||(this.state.customProps=new vR),this.state.customProps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentPropertyData",{get:function(){return this.state.propertyData||(this.state.propertyData=Object.create(null)),this.state.propertyData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inheritedPropertyData",{get:function(){return this.parent?this.parent.currentPropertyData:this.currentPropertyData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polymerResidueCount",{get:function(){return-1===this.state.polymerResidueCount&&(this.state.polymerResidueCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++)r+=t[n].polymerElements.length;return r}(this)),this.state.polymerResidueCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polymerGapCount",{get:function(){return-1===this.state.polymerGapCount&&(this.state.polymerGapCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++)r+=t[n].gapElements.length/2;return r}(this)),this.state.polymerGapCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polymerUnitCount",{get:function(){return-1===this.state.polymerUnitCount&&(this.state.polymerUnitCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++)t[n].polymerElements.length>0&&(r+=1);return r}(this)),this.state.polymerUnitCount}
139,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueElementCount",{get:function(){return-1===this.state.uniqueElementCount&&(this.state.uniqueElementCount=function(e){for(var t=e.unitSymmetryGroups,r=0,n=0,i=t.length;n<i;n++)r+=t[n].elements.length;return r}(this)),this.state.uniqueElementCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"atomicResidueCount",{get:function(){return-1===this.state.atomicResidueCount&&(this.state.atomicResidueCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++){var a=t[n];if(tU.isAtomic(a))for(var o=a.elements,s=a.residueIndex,u=-1,c=-1,l=0,d=o.length;l<d;++l)(u=s[o[l]])!==c&&(r+=1,c=u)}return r}(this)),this.state.atomicResidueCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCoarseGrained",{get:function(){return this.models.some(function(e){return Xz.isCoarseGrained(e)})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.units.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hashCode",{get:function(){return-1===this.state.hashCode?this.computeHash():this.state.hashCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transformHash",{get:function(){return-1!==this.state.transformHash||(this.state.transformHash=Iv(this.units.map(function(e){return e.id}))),this.state.transformHash},enumerable:!1,configurable:!0}),e.prototype.computeHash=function(){for(var e=23,t=0,r=this.units.length;t<r;t++){var n=this.units[t];e=31*(e=31*e+n.id|0)+PP.hashCode(n.elements)|0}return-1===(e=Cv(e=31*e+this.elementCount|0))&&(e=0),this.state.hashCode=e,e},e.prototype.elementLocations=function(){return new e.ElementLocationIterator(this)},Object.defineProperty(e.prototype,"root",{get:function(){return this.state.parent??this},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.state.parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coordinateSystem",{get:function(){return this.state.coordinateSystem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"label",{get:function(){return this.state.label},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this.state.boundary||(this.state.boundary=function(e){var t=e.units,r=function(e){return e>500?gz:vz}(t.length);r.reset();for(var n=0,i=t.length;n<i;n++){var a=(o=t[n]).boundary;(s=o.conformation.operator).isIdentity?r.includeSphere(a.sphere):(XE.transform(mz,a.sphere,s.matrix),r.includeSphere(mz))}for(r.finishedIncludeStep(),n=0,i=t.length;n<i;n++){var o,s;a=(o=t[n]).boundary,(s=o.conformation.operator).isIdentity?r.radiusSphere(a.sphere):(XE.transform(mz,a.sphere,s.matrix),r.radiusSphere(mz))}return{box:r.getBox(),sphere:r.getSphere()}}(this)),this.state.boundary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lookup3d",{get:function(){return this.state.lookup3d||(this.state.lookup3d=new uU(this)),this.state.lookup3d},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interUnitBonds",{get:function(){return this.state.interUnitBonds||(this.parent&&this.state.dynamicBonds===this.parent.state.dynamicBonds&&this.parent.state.interUnitBonds&&0===this.parent.state.interUnitBonds.edgeCount?this.state.interUnitBonds=new PL(new Map):this.state.interUnitBonds=function(e,t){var r=Ac(Ac({},E$),t);return function(e,t){var r=new AL.Builder,n=e.models.some(function(e){return LF.Provider.get(e)}),i=e.models.some(function(e){return c$.isExhaustive(e)});return t.noCompute||e.isCoarseGrained&&!n&&!i||yz.eachUnitPair(e,function(e,n){!function(e,t,r,n){var i=r.maxRadius,a=e.elements,o=e.residueIndex,s=e.model.atomicConformation,u=s.x,c=s.y,l=s.z,d=t.elements,f=t.residueIndex,h=e.elements.length,p=e.model.atomicHierarchy.atoms,m=p.type_symbol,g=p.label_alt_id,v=p.label_atom_id,y=p.label_comp_id,b=t.model.atomicHierarchy.atoms,_=b.type_symbol,x=b.label_alt_id,S=b.label_atom_id,w=b.label_comp_id,A=e.model.atomicHierarchy.residues.auth_seq_id,C=t.model.atomicHierarchy.residues.auth_seq_id,T=e.model.atomicConformation.occupancy,P=t.model.atomicConformation.occupancy,E=T.isDefined&&P.isDefined,M=e.model===t.model&&c$.Provider.get(e.model),k=!r.forceCompute&&e.model===t.model&&LF.Provider.get(e.model),I=e.model.atomicHierarchy.atomSourceIndex,D=(k?Xz.getInvertedAtomSourceIndex(t.model):{invertedIndex:void 0}).invertedIndex,O=e.model===t.model&&c$.isExhaustive(e.model),R=Og.mul(T$,t.conformation.operator.inverse,e.conformation.operator.matrix),B=!Og.isIdentity(R),N=t.boundary.sphere,F=N.
139center,L=N.radius,$=(L+i)*(L+i);n.startUnitPair(e.id,t.id);for(var U=e.conformation.operator.key,j=t.conformation.operator.key,z=0;z<h;z++){var G=a[z];if(b$(P$,u[G],c[G],l[G]),B&&x$(P$,P$,R),!(_$(P$,F)>$))if(r.forceCompute||!k){var V=r.forceCompute?void 0:M&&M.byAtomIndex.get(G);if(V&&V.length){for(var H=!1,q=0,W=V;q<W.length;q++){var X=W[q],Y=X.partnerA,K=X.partnerB,Z=Y.atomIndex===G?K:Y;(Ie=PP.indexOf(t.elements,Z.atomIndex))<0||A$(e,G,t,Z.atomIndex)>i||(n.add(z,Ie,{order:X.order,flag:X.flags,key:X.rowIndex}),H=!0)}if(H)continue}if(!O){var Q=T.value(G),J=t.lookup3d.find(P$[0],P$[1],P$[2],i),ee=J.indices,te=J.count,re=J.squaredDistances;if(0!==te)for(var ne=OL(m.value(G)),ie=FL(ne),ae=RL(ne),oe=g.value(G),se=DL.has(ne),ue=v.value(G),ce=y.value(o[G]),le=0;le<te;le++){De=d[Ie=ee[le]];var de=x.value(De);if(!(oe&&de&&oe!==de||E&&P.value(De)<1&&Q<1&&A.value(G)===C.value(De))){var fe=FL(Be=OL(_.value(De)));if(!ie||!fe){var he=(se||DL.has(Be))&&!(ie||fe);if(0!==(Fe=Math.sqrt(re[le]))&&Fe<=BL(ne,Be,ae,RL(Be))){var pe=S.value(De),me=w.value(f[De]);n.add(z,Ie,{order:VL(ce,me,ue,pe),flag:32|(he?2:1),key:-1})}}}}}}else for(var ge=k.maxDistance,ve=k.bonds,ye=ve.offset,be=ve.b,_e=ve.edgeProps,xe=_e.order,Se=_e.distance,we=_e.flag,Ae=_e.key,Ce=_e.operatorA,Te=_e.operatorB,Pe=I.value(G),Ee=OL(m.value(G)),Me=ye[Pe],ke=ye[Pe+1];Me<ke;++Me){var Ie,De=D[be[Me]];if(!((Ie=PP.indexOf(t.elements,De))<0)){var Oe=Ce[Me],Re=Te[Me];if(!(Oe>=0&&Oe!==U&&Oe!==j||Re>=0&&Re!==j&&Re!==U)){var Be=OL(m.value(De)),Ne=Se[Me],Fe=A$(e,G,t,De),Le=!1;Ne>=0?Le=yg(Fe,Ne,.3):ge>=0?Le=Fe<ge:(Le=Fe<BL(Ee,Be,RL(Ee),RL(Be)),FL(Ee)&&FL(Be)&&(Le=!1)),Le&&n.add(z,Ie,{order:xe[Me],flag:we[Me],key:Ae[Me]})}}}}n.finishUnitPair()}(e,n,t,r)},{maxRadius:t.maxRadius,validUnit:function(e){return t.validUnit(e)},validUnitPair:function(r,n){return t.validUnitPair(e,r,n)}}),new PL(r.getMap())}(e,Ac(Ac({},r),{validUnit:t&&t.validUnit||function(e){return tU.isAtomic(e)},validUnitPair:t&&t.validUnitPair||function(e,t,n){if(!yz.validUnitPair(e,t,n))return!1;var i=t.model.atomicHierarchy.derived.residue.moleculeType,a=n.model.atomicHierarchy.derived.residue.moleculeType,o=!(tU.isAtomic(t)&&2===i[t.residueIndex[t.elements[0]]]||tU.isAtomic(n)&&2===a[n.residueIndex[n.elements[0]]]),s=!tU.isAtomic(t)||3!==i[t.residueIndex[t.elements[0]]],u=!tU.isAtomic(n)||3!==a[n.residueIndex[n.elements[0]]],c=s&&u;return!(!o&&r.ignoreWater||!c&&r.ignoreIon)||function(e,t){if(e.model!==t.model||!tU.isAtomic(e)||!tU.isAtomic(t))return!1;var r=c$.Provider.get(e.model);if(!r)return!1;for(var n=e.elements.length<t.elements.length?e:t,i=e.elements.length>=t.elements.length?e:t,a=n.elements,o=i.elements,s=PP.indexOf,u=0,c=a.length;u<c;u++){var l=a[u],d=r.byAtomIndex.get(l);if(d?.length)for(var f=0,h=d;f<h.length;f++){var p=h[f];if(s(o,p.partnerA.atomIndex===l?p.partnerB.atomIndex:p.partnerA.atomIndex)>=0)return!0}}return!1}(t,n)}}))}(this,{ignoreWater:!this.dynamicBonds,ignoreIon:!this.dynamicBonds,validUnit:this.state.interBondsValidUnit,validUnitPair:this.state.interBondsValidUnitPair})),this.state.interUnitBonds},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dynamicBonds",{get:function(){return this.state.dynamicBonds},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interBondsValidUnit",{get:function(){return this.state.interBondsValidUnit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interBondsValidUnitPair",{get:function(){return this.state.interBondsValidUnitPair},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unitSymmetryGroups",{get:function(){return this.state.unitSymmetryGroups||(this.state.unitSymmetryGroups=Kj.computeTransformGroups(this)),this.state.unitSymmetryGroups},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unitSymmetryGroupsIndexMap",{get:function(){return this.state.unitSymmetryGroupsIndexMap||(this.state.unitSymmetryGroupsIndexMap=tU.SymmetryGroup.getUnitSymmetryGroupsIndexMap(this.unitSymmetryGroups)),this.state.unitSymmetryGroupsIndexMap},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"carbohydrates",{get:function(){return this.state.carbohydrates||(this.state.carbohydrates=function(e){if(0===e.models.reduce(function(e,t){return e+t.properties.saccharideComponentMap.size},0))return oz;var t=[],r=[],n=[],i=[],a=new Map;function o(e,t,r){return`${e}|${t}|${r}`}function s(e,t){a.has(e)?a.get(e).push(t):a.set(e,[t])}function u(e,t){Cg.sub(n[e].geometry.direction,n[t].geometry.center,n[e].geometry.center),Cg.normalize(n[e].geometry.direction,n[e].geometry.direction)}
139var c=Cg();function l(e,t,r){var i=r.conformation.position,a=n[e].geometry;Cg.sub(a.direction,i(r.elements[t],c),a.center),Cg.normalize(a.direction,a.direction)}for(var d=0,f=e.units.length;d<f;++d){var h=e.units[d];if(tU.isAtomic(h))for(var p=h.model,m=h.rings,g=p.atomicHierarchy,v=g.chainAtomSegments,y=g.residueAtomSegments,b=g.atoms.label_comp_id,_=fE.transientSegments(v,h.elements),x=fE.transientSegments(y,h.elements),S=void 0;_.hasNext;)for(x.setSegment(_.move());x.hasNext;){var w=x.move().index,A=pz(b.value(y.offsets[w]),p);if(A){S||=V$.byFingerprintAndResidue(m,cz);var C=hz(m,S.get(w));if(C&&C.length){for(var T=[],P=0,E=C.length;P<E;++P){var M=m.all[C[P]],k=lz(h,M),I=zE.calculateMomentsAxes(j$(h,M)),D=zE.calculateNormalizedAxes(I),O=Cg.copy(Cg(),D.origin),R=Cg.copy(Cg(),D.dirC),B=dz(Cg(),h,k,O);Cg.orthogonalize(B,R,B);var N=z$.getAltId(h,M),F=n.length;T.push(F),s(o(w,h.id,N),F),N&&s(o(w,h.id,""),F),n.push({geometry:{center:O,normal:R,direction:B},component:A,ringIndex:C[P],altId:N,unit:h,residueIndex:w})}var L=iz(zb(Array(C.length)),2);for(P=0,E=L.length;P<E;++P){var $=L[P],U=m.all[C[$[0]]],j=m.all[C[$[1]]];if(DF.areVertexSetsConnected(h.bonds,U,j,3)){var z=T[$[0]],G=T[$[1]];n[z].altId===n[G].altId&&(u(z,G),u(G,z),t.push({carbohydrateIndexA:z,carbohydrateIndexB:G}),t.push({carbohydrateIndexA:G,carbohydrateIndexB:z}))}}}else i.push({unit:h,residueIndex:w,component:A})}}}function V(e,t){return a.get(o(e.getResidueIndex(t),e.id,function(e,t){var r=e.elements;return e.model.atomicHierarchy.atoms.label_alt_id.value(r[t])}(e,t)))||[]}for(d=0,f=n.length;d<f;++d){var H=n[d];for(h=H.unit,P=d+1;P<f;++P){var q=n[P];if(h===q.unit&&H.residueIndex!==q.residueIndex){var W=h.rings.all[H.ringIndex],X=h.rings.all[q.ringIndex];DF.areVertexSetsConnected(h.bonds,W,X,3)&&(u(d,P),u(P,d),t.push({carbohydrateIndexA:d,carbohydrateIndexB:P}),t.push({carbohydrateIndexA:P,carbohydrateIndexB:d}))}}}for(d=0,f=e.units.length;d<f;++d)h=e.units[d],tU.isAtomic(h)&&e.interUnitBonds.getConnectedUnits(h.id).forEach(function(n){n.connectedIndices.forEach(function(i){n.getEdges(i).forEach(function(a){var o=a.props,s=a.indexB;if(RN.isCovalent(o.flag)){var c=e.unitMap.get(n.unitA),d=e.unitMap.get(n.unitB),f=V(c,i),h=V(d,s);if(f.length>0&&h.length>0)for(var p=f.length,m=h.length,g=0,v=Math.max(p,m);g<v;++g){var y=f[Math.min(g,p-1)],b=h[Math.min(g,m-1)];((S=fz(c,i)).startsWith("O1")||S.startsWith("C1"))&&u(y,b),t.push({carbohydrateIndexA:y,carbohydrateIndexB:b})}else if(0===h.length)for(var _=0,x=f;_<x.length;_++){var S;y=x[_],((S=fz(c,i)).startsWith("O1")||S.startsWith("C1"))&&l(y,s,d),r.push({carbohydrateIndex:y,elementIndex:s,elementUnit:d,fromCarbohydrate:!0})}else if(0===f.length)for(var w=0,A=h;w<A.length;w++)b=A[w],r.push({carbohydrateIndex:b,elementIndex:i,elementUnit:c,fromCarbohydrate:!1})}})})});return Ac({links:t,terminalLinks:r,elements:n,partialElements:i},function(e,t,r){function n(e,t){return Ev(e.id,t)}function i(e,t,r){var i=[],a=e.get(n(t,r));if(void 0!==a)for(var o=0,s=a;o<s.length;o++)Hb(i,s[o]);return i}for(var a=new Map,o=0,s=e.length;o<s;++o)for(var u=e[o],c=u.unit,l=u.ringIndex,d=0,f=(S=c.rings.all[l]).length;d<f;++d){var h=n(c,c.elements[S[d]]);void 0===(A=a.get(h))?a.set(h,[o]):A.push(o)}var p=new Map;for(o=0,s=t.length;o<s;++o){var m=e[t[o].carbohydrateIndexA];for(c=m.unit,l=m.ringIndex,d=0,f=(S=c.rings.all[l]).length;d<f;++d)h=n(c,c.elements[S[d]]),void 0===(A=p.get(h))?p.set(h,[o]):A.push(o)}var g=new Map;for(o=0,s=r.length;o<s;++o){var v=r[o],y=v.fromCarbohydrate,b=v.carbohydrateIndex,_=v.elementUnit,x=v.elementIndex;if(y){var S,w=e[b];for(c=w.unit,l=w.ringIndex,d=0,f=(S=c.rings.all[l]).length;d<f;++d)h=n(c,c.elements[S[d]]),void 0===(A=g.get(h))?g.set(h,[o]):A.push(o)}else{var A;h=n(_,_.elements[x]),void 0===(A=g.get(h))?g.set(h,[o]):A.push(o)}}return{getElementIndices:function(e,t){return i(a,e,t)},getLinkIndices:function(e,t){return i(p,e,t)},getTerminalLinkIndices:function(e,t){return i(g,e,t)}}}(n,t,r))}(this)),this.state.carbohydrates},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"models",{get:function(){return this.state.models||(this.state.models=function(e){for(var t=e.units,r=gS.create(),n=0,i=t;n<i.length;n++){var a=i[n];gS.add(r,a.model.id,a.model)}return r.array}(this)),this.state.models}
139,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueResidueNames",{get:function(){return this.state.uniqueResidueNames||(this.state.uniqueResidueNames=function(e){for(var t=Cj.residue.microheterogeneityCompIds,r=new Set,n=qF.create(e),i=0,a=e.unitSymmetryGroups;i<a.length;i++){var o=a[i].units[0];if(tU.isAtomic(o)){var s=fE.transientSegments(o.model.atomicHierarchy.residueAtomSegments,o.elements);for(n.unit=o;s.hasNext;){var u=s.move();n.element=o.elements[u.start];for(var c=0,l=t(n);c<l.length;c++){var d=l[c];r.add(d)}}}}return r}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueElementSymbols",{get:function(){return this.state.uniqueElementSymbols||(this.state.uniqueElementSymbols=function(e){for(var t=Cj.atom.type_symbol,r=new Set,n=qF.create(e),i=0,a=e.unitSymmetryGroups;i<a.length;i++){var o=a[i].units[0];if(tU.isAtomic(o)){n.unit=o;for(var s=0,u=o.elements.length;s<u;++s)n.element=o.elements[s],r.add(t(n))}}return r}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entityIndices",{get:function(){return this.state.entityIndices||(this.state.entityIndices=function(e){for(var t=e.units,r=qF.create(e),n=gS.create(),i=0,a=t;i<a.length;i++){var o=a[i],s=0===o.kind?Cj.entity.key:Cj.coarse.entityKey;r.unit=o;for(var u=o.elements,c=fE.transientSegments(o.model.atomicHierarchy.chainAtomSegments,u);c.hasNext;){r.element=u[c.move().start];var l=s(r);gS.add(n,l,l)}}return vv(n.array),n.array}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueAtomicResidueIndices",{get:function(){return this.state.uniqueAtomicResidueIndices||(this.state.uniqueAtomicResidueIndices=function(e){for(var t=new Map,r=[],n=0,i=e.unitSymmetryGroups;n<i.length;n++){var a=i[n].units[0];if(tU.isAtomic(a)){var o=void 0;t.has(a.model.id)?o=t.get(a.model.id):(o=gS.create(),r.push(a.model.id),t.set(a.model.id,o));for(var s=fE.transientSegments(a.model.atomicHierarchy.residueAtomSegments,a.elements);s.hasNext;){var u=s.move();gS.add(o,u.index,u.index)}}}for(var c=new Map,l=0,d=r;l<d.length;l++){var f=d[l],h=t.get(f).array;vv(h),c.set(f,h)}return c}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAtomic",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(!tU.isAtomic(r))return!1}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasAtomic",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(tU.isAtomic(r))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCoarse",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(!tU.isCoarse(r))return!1}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasCoarse",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(tU.isCoarse(r))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serialMapping",{get:function(){return this.state.serialMapping||(this.state.serialMapping=function(e){for(var t=e.units,r=e.elementCount,n=e.unitIndexMap,i=new Uint32Array(t.length),a=new Uint32Array(r),o=new Uint32Array(r),s=0,u=0,c=t.length;s<c;++s){i[s]=u;for(var l=t[s].elements,d=0,f=l.length;d<f;++d){var h=u+d;a[h]=s,o[h]=l[d]}u+=l.length}return{cumulativeUnitElementCount:i,unitIndices:a,elementIndices:o,getSerialIndex:function(e,t){return i[n.get(e.id)]+kP.indexOf(e.elements,t)}}}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"model",{get:function(){if(this.state.model)return this.state.model;if(this.state.representativeModel)return this.state.representativeModel;if(this.state.masterModel)return this.state.masterModel;var e=this.models;if(e.length>1)throw Error("The structure is based on multiple models and has neither a master- nor a representative-model.");return this.state.model=e[0],this.state.model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"masterModel",{get:function(){return this.state.masterModel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"representativeModel",{get:function(){return this.state.representativeModel}
139,enumerable:!1,configurable:!0}),e.prototype.hasElement=function(e){return!!this.unitMap.has(e.unit.id)&&PP.has(this.unitMap.get(e.unit.id).elements,e.element)},e.prototype.getModelIndex=function(e){return this.models.indexOf(e)},e.prototype.remapModel=function(t){for(var r=this.state,n=r.dynamicBonds,i=r.interUnitBonds,a=r.parent,o=[],s=0,u=this.unitSymmetryGroups;s<u.length;s++){var c=u[s],l=c.units[0].remapModel(t,n);o.push(l);for(var d=1,f=c.units.length;d<f;++d){var h=c.units[d];o.push(h.remapModel(t,n,l.props))}}return e.create(o,{parent:a?.remapModel(t),label:this.label,interUnitBonds:n?void 0:i,dynamicBonds:n,interBondsValidUnit:this.state.interBondsValidUnit,interBondsValidUnitPair:this.state.interBondsValidUnitPair,coordinateSystem:this.state.coordinateSystem,masterModel:this.state.masterModel,representativeModel:this.state.representativeModel})},e.prototype.asParent=function(){if(this._proxy)return this._proxy;if(this.parent){var t=this.parent.coordinateSystem.isIdentity?this.parent:e.transform(this.parent,this.parent.coordinateSystem.inverse),r=this.coordinateSystem.isIdentity?t:e.transform(t,this.coordinateSystem.matrix);this._proxy=new e(r.units,r.unitMap,r.unitIndexMap,Ac(Ac({},r.state),{dynamicBonds:this.dynamicBonds}),{child:this,target:this.parent})}else this._proxy=this;return this._proxy},Object.defineProperty(e.prototype,"child",{get:function(){return this._child},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target??this},enumerable:!1,configurable:!0}),e}();function bz(e,t,r){return e[t].id-e[r].id}!function(e){function t(e){return{kind:"structure-loci",structure:e}}function r(t,r){void 0===r&&(r={});for(var n=mE.Mutable(),i=mE.Mutable(),a=0,o=!0,s=t.length>0?t[0].id:0,u=0,c=t.length;u<c;u++){var l=t[u];n.set(l.id,l),a+=l.elements.length,l.id<s&&(o=!1),s=l.id}for(o||yv(t,0,t.length,bz,cv),u=0,c=t.length;u<c;u++)i.set(t[u].id,u);var d={hashCode:-1,transformHash:-1,elementCount:a,bondCount:-1,uniqueElementCount:-1,atomicResidueCount:-1,polymerResidueCount:-1,polymerGapCount:-1,polymerUnitCount:-1,dynamicBonds:!1,coordinateSystem:AE.Default,label:""};return r.parent&&(d.parent=r.parent.parent||r.parent),r.interUnitBonds&&(d.interUnitBonds=r.interUnitBonds),r.interBondsValidUnit?d.interBondsValidUnit=r.interBondsValidUnit:r.parent&&(d.interBondsValidUnit=r.parent.interBondsValidUnit),r.interBondsValidUnitPair?d.interBondsValidUnitPair=r.interBondsValidUnitPair:r.parent&&(d.interBondsValidUnitPair=r.parent.interBondsValidUnitPair),r.dynamicBonds?d.dynamicBonds=r.dynamicBonds:r.parent&&(d.dynamicBonds=r.parent.dynamicBonds),r.coordinateSystem?d.coordinateSystem=r.coordinateSystem:r.parent&&(d.coordinateSystem=r.parent.coordinateSystem),r.label?d.label=r.label:r.parent&&(d.label=r.parent.label),r.masterModel?d.masterModel=r.masterModel:r.parent&&(d.masterModel=r.parent.masterModel),r.representativeModel?d.representativeModel=r.representativeModel:r.parent&&(d.representativeModel=r.parent.representativeModel),new e(t,n,i,d)}function n(e,t){void 0===t&&(t={});for(var r=e.atomicHierarchy.chainAtomSegments,n=e.atomicHierarchy.index,s=e.atomicHierarchy.chains.auth_asym_id,u=e.atomicChainOperatorMappinng,c=new o(Ac({label:e.label},t)),l=0;l<r.count;l++){var d=u.get(l)||AE.Default,f=r.offsets[l];IU.chainResidueCount(e.atomicHierarchy,l),r.offsets[l+1],r.offsets[l];var h=!1;if(i(e,l))for(;l+1<r.count&&i(e,l+1)&&u.get(l)===u.get(l+1);)h=!0,l++;else for(;l+1<r.count&&r.offsets[l+1]-r.offsets[l]==1&&r.offsets[l+2]-r.offsets[l+1]==1&&n.getEntityFromChain(l)===n.getEntityFromChain(l+1)&&s.value(l)===s.value(l+1)&&u.get(l)===u.get(l+1);)h=!0,l++;var p=PP.ofBounds(f,r.offsets[l+1]);c.addUnit(0,e,d,p,h?tU.Trait.MultiChain:tU.Trait.None)}var m=e.coarseHierarchy;return m.isDefined&&(m.spheres.count>0&&a(c,e,e.coarseHierarchy.spheres,1),m.gaussians.count>0&&a(c,e,e.coarseHierarchy.gaussians,2)),c.getStructure()}function i(e,t){var r=e.atomicHierarchy.index.getEntityFromChain(t);return"water"===e.entities.data.type.value(r)}function a(e,t,r,n){for(var i=r.chainElementSegments,a=0;a<i.count;a++){var o=PP.ofBounds(i.offsets[a],i.offsets[a+1]);e.addUnit(n,t,AE.Default,o,tU.Trait.None)}}e.Empty=r([]),e.Loci=t,e.toStructureElementLoci=function(e){for(var t=[],r=0,n=e.units;r<n.length;r++){var i=n[r];t.push({unit:i,indices:$T.ofBounds(0,i.elements.length)})}return Az(e,t)},e.toSubStructureElementLoci=function(e,t){return oU.toLociWithSourceUnits(oU.Singletons(e,t))},e.isLoci=function(e){return!!e&&"structure-loci"===e.kind},e.areLociEqual=function(e,t){return e.structure===t.structure},e.isLociEmpty=function(e){return e.structure.isEmpty}
139,e.remapLoci=function(e,r){return r===e.structure?e:t(r)},e.create=r,e.ofTrajectory=function(t,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p,m,g,v;return Pc(this,function(y){switch(y.label){case 0:if(0===t.frameCount)return[2,e.Empty];a=[],o=void 0,s=0,u=0,c=t.frameCount,y.label=1;case 1:return u<c?[4,vy.resolveInContext(t.getFrameAtIndex(u),i)]:[3,4];case 2:for(l=y.sent(),o||=l,d=n(l),f=0,h=d.units.length;f<h;++f)p=d.units[f],m=p.invariantId+s,g=p.chainGroupId+s,v=tU.create(a.length,m,g,p.traits,p.kind,p.model,p.conformation.operator,p.elements),a.push(v);s=a.length,y.label=3;case 3:return++u,[3,1];case 4:return[2,r(a,{representativeModel:o,label:o.label})]}})})},e.ofModel=n,e.transform=function(e,t){if(Og.isIdentity(t))return e;if(!Og.isRotationAndTranslation(t,AE.RotationTranslationEpsilon))throw Error("Only rotation/translation combination can be applied.");for(var n=[],i=0,a=e.units;i<a.length;i++){var o=a[i],s=o.conformation.operator,u=AE.create(s.name,t,s);n.push(o.applyOperator(o.id,u))}var c=e.coordinateSystem;return r(n,{parent:e,coordinateSystem:AE.compose(AE.create(c.name,t,c),c)})};var o=function(){function e(e){void 0===e&&(e={}),this.props=e,this.units=[],this.invariantId=Jd(),this.chainGroupId=-1,this.inChainGroup=!1,this.p=Cg(),this.singleElementUnits=new Map}return e.prototype.beginChainGroup=function(){this.chainGroupId++,this.inChainGroup=!0},e.prototype.endChainGroup=function(){this.inChainGroup=!1},e.prototype.addUnit=function(e,t,r,n,i,a){void 0===a&&(a=this.invariantId());var o=this.inChainGroup?this.chainGroupId:++this.chainGroupId,s=tU.create(this.units.length,a,o,i,e,t,r,n);return this.add(s)},e.prototype.add=function(e){if(1===e.elements.length){e.conformation.position(e.elements[0],this.p);var t=[e.invariantId,this.p[0],this.p[1],this.p[2]].join("|");if(this.singleElementUnits.has(t))return this.singleElementUnits.get(t);this.singleElementUnits.set(t,e)}return this.units.push(e),e},e.prototype.addWithOperator=function(e,t,r){return void 0===r&&(r=!1),this.add(e.applyOperator(this.units.length,t,r))},e.prototype.getStructure=function(){return r(this.units,this.props)},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.units.length},enumerable:!1,configurable:!0}),e}();function s(e,t){if(e===t)return!0;if(e.elementCount!==t.elementCount)return!1;var r=e.units.length;if(r!==t.units.length)return!1;for(var n=0;n<r;n++)if(e.units[n].id!==t.units[n].id)return!1;return!0}function u(e,t){return e===t||e.hashCode===t.hashCode&&Kj.areTransformGroupsEquivalent(e.unitSymmetryGroups,t.unitSymmetryGroups)}e.StructureBuilder=o,e.Builder=function(e){return void 0===e&&(e={}),new o(e)},e.hashCode=function(e){return e.hashCode},e.conformationHash=function(e){return Pv(e.units.map(function(e){return tU.conformationId(e)}).join("|"))},e.areUnitIdsEqual=s,e.areUnitIdsAndIndicesEqual=function(e,t){if(e===t)return!0;if(!s(e,t))return!1;for(var r=0,n=e.units.length;r<n;r++)if(!PP.areEqual(e.units[r].elements,t.units[r].elements))return!1;return!0},e.areHierarchiesEqual=function(e,t){if(e.hashCode!==t.hashCode)return!1;var r=e.models.length;if(r!==t.models.length)return!1;for(var n=0;n<r;n++)if(!Xz.areHierarchiesEqual(e.models[n],t.models[n]))return!1;return!0},e.areEquivalent=u,e.areRootsEquivalent=function(e,t){return u(e.root,t.root)},e.areRootsEqual=function(e,t){return e.root===t.root},e.ElementLocationIterator=function(){function e(e){this.structure=e,this.unitIndex=0,this.maxIdx=0,this.idx=-1,this.current=qF.create(e),this.hasNext=e.elementCount>0,this.hasNext&&(this.elements=e.units[0].elements,this.maxIdx=this.elements.length-1,this.current.unit=e.units[0])}return e.prototype.move=function(){return this.advance(),this.current.element=this.elements[this.idx],this.current},e.prototype.advance=function(){if(this.idx<this.maxIdx)return this.idx++,void(this.idx===this.maxIdx&&(this.hasNext=this.unitIndex+1<this.structure.units.length));this.idx=0,this.unitIndex++,this.unitIndex>=this.structure.units.length?this.hasNext=!1:(this.current.unit=this.structure.units[this.unitIndex],this.elements=this.current.unit.elements,this.maxIdx=this.elements.length-1,0===this.maxIdx&&(this.hasNext=this.unitIndex+1<this.structure.units.length))},e}();
139var c=Cg();function l(e,t,r){for(var n=e.elements,i=e.conformation,a=i.position,o=i.r,s=c,u=Number.MAX_VALUE,l=0,d=n.length;l<d;l++){var f=n[l],h=Cg.distance(t,a(f,s))-r-o(f);h<u&&(u=h)}return u}function d(e,t,r){for(var n=e.units,i=Number.MAX_VALUE,a=0,o=n.length;a<o;a++){var s=l(n[a],t,r);s<i&&(i=s)}return i}e.minDistanceToPoint=d;var f,h=Cg();function p(e){return e.unitSymmetryGroups.filter(function(e){return e.units[0].polymerElements.length>0})}e.distance=function(e,t){if(0===e.elementCount||0===t.elementCount)return 0;for(var r=e.units,n=Number.MAX_VALUE,i=0,a=r.length;i<a;i++)for(var o=r[i],s=o.elements,u=o.conformation,c=u.position,l=u.r,f=0,p=s.length;f<p;f++){var m=s[f],g=d(t,c(m,h),l(m));g<n&&(n=g)}return n},e.elementDescription=function(e){return 1===e.elementCount?"1 element":`${e.elementCount} elements`},e.validUnitPair=function(e,t,r){return e.masterModel?t.model===r.model||t.model===e.masterModel||r.model===e.masterModel:t.model===r.model},e.eachUnitPair=function(e,t,r){var n=r.maxRadius,i=r.validUnit,a=r.validUnitPair;if(e.units.some(function(e){return i(e)}))for(var o=e.lookup3d,s=Cg(),u=0,c=e.units;u<c.length;u++){var l=c[u];if(i(l)){var d=l.boundary.sphere;Cg.transformMat4(s,d.center,l.conformation.operator.matrix);for(var f=o.findUnitIndices(s[0],s[1],s[2],d.radius+n),h=0;h<f.count;h++){var p=e.units[f.indices[h]];l.id>=p.id||i(p)&&a(l,p)&&(p.elements.length>=l.elements.length?t(l,p):t(p,l))}}}},e.eachAtomicHierarchyElement=function(e,t){for(var r=t.chain,n=t.residue,i=t.atom,a=qF.create(e),o=0,s=e.units;o<s.length;o++){var u=s[o];if(0===u.kind){a.unit=u;for(var c=u.elements,l=fE.transientSegments(u.model.atomicHierarchy.chainAtomSegments,c),d=fE.transientSegments(u.model.atomicHierarchy.residueAtomSegments,c);l.hasNext;){var f=l.move();if(r&&(a.element=c[f.start],r(a)),n||i)for(d.setSegment(f);d.hasNext;){var h=d.move();if(n&&(a.element=c[h.start],n(a)),i)for(var p=h.start,m=h.end;p<m;p++)a.element=c[p],i(a)}}}}},e.DefaultSizeThresholds={smallResidueCount:10,mediumResidueCount:5e3,largeResidueCount:3e4,highSymmetryUnitCount:10,fiberResidueCount:15},function(e){e[e.Small=0]="Small",e[e.Medium=1]="Medium",e[e.Large=2]="Large",e[e.Huge=3]="Huge",e[e.Gigantic=4]="Gigantic"}(f=e.Size||={}),e.getSize=function(t,r,n){void 0===r&&(r={}),void 0===n&&(n=1);var i=Ac(Ac({},e.DefaultSizeThresholds),r);return t.polymerResidueCount>=i.largeResidueCount*n?function(e,t){var r=p(e);return r.length>=1&&r[0].units.length>t.highSymmetryUnitCount}(t,i)?f.Huge:f.Gigantic:function(e,t){var r=p(e);return 1===r.length&&r[0].units.length>2&&r[0].units[0].polymerElements.length<t.fiberResidueCount}(t,i)||t.polymerResidueCount<i.smallResidueCount*n?f.Small:t.polymerResidueCount<i.mediumResidueCount*n?f.Medium:f.Large},e.Index=ZU.createSimple("index","root"),e.MaxIndex=ZU.createSimple("max_index","root");var m="__PrincipalAxes__";e.getPrincipalAxes=function(t){if(t.currentPropertyData[m])return t.currentPropertyData[m];var r=Az.getPrincipalAxes(e.toStructureElementLoci(t));return t.currentPropertyData[m]=r,r}}(yz||={});var _z,xz,Sz,wz=KC.diff;function Az(e,t){return{kind:"element-loci",structure:e,elements:t}}(function(e){function t(e){for(var t=0,r=e.elements;t<r.length;t++){var n=r[t];if(kP.size(n.indices)>0)return!1}return!0}function r(e){for(var t=0,r=0,n=e.elements;r<n.length;r++){var i=n[r].indices;t+="number"==typeof i?wz(i):i.length}return t}function n(r){return t(r)?r:e(r.structure,[{unit:r.elements[0].unit,indices:kP.ofSingleton(kP.start(r.elements[0].indices))}])}function i(e){return e.length>3&&PP.isRange(e)?$T.ofRange(e[0],e[e.length-1]):PP.ofSortedArray(e)}function a(t,r){for(var n=[],a=new Set,o=0,u=t.elements;o<u.length;o++){var c=u[o];if(s(c))n[n.length]=c;else if(0===c.unit.kind){for(var l=c.unit.elements,d=c.unit.model.atomicHierarchy,f=c.unit.model.atomicHierarchy.atoms.label_alt_id,h=d.residueAtomSegments,p=h.index,m=h.offsets,g=[],v=c.indices,y=kP.size(v),b=0;b<y;){a.clear();var _=l[kP.getAt(v,b)],x=p[_];for(a.add(f.value(_)),b++;b<y;){var S=l[kP.getAt(v,b)];if(p[S]!==x)break;a.add(f.value(S)),b++}for(var w=a.has(""),A=m[x],C=m[x+1];A<C;A++){var T=kP.indexOf(l,A);if(T>=0){var P=f.value(A);r&&!w&&P&&!a.has(P)||(g[g.length]=T)}}}n[n.length]={unit:c.unit,indices:i(g)}}else n[n.length]=c}return e(t.structure,n)}function o(e){switch(e.kind){case 0:return e.model.atomicHierarchy.chainAtomSegments;case 1:return e.model.coarseHierarchy.spheres.chainElementSegments;case 2:return e.model.coarseHierarchy.gaussians.chainElementSegments}}function s(e){return e.unit.elements.length===kP.size(e.indices)}function u(e,t,r){for(var n=o(e).index,a=e.elements,s=0,u=0,c=a.length;u<c;u++){var l=n[a[u]];t.has(l)&&s++}
139if(s!==e.elements.length){var d=new Int32Array(s);for(s=0,u=0,c=a.length;u<c;u++)l=n[a[u]],t.has(l)&&(d[s++]=u);d.length>0&&(r[r.length]={unit:e,indices:i(d)})}else r[r.length]={unit:e,indices:$T.ofBounds(0,s)}}function c(e,t,r,n,i){for(var a=o(e.elements[0].unit).index,s=new Set,c=t;c<r;c++)for(var l=e.elements[c],d=l.indices,f=l.unit.elements,h=0,p=kP.size(d);h<p;h++)s.add(a[f[kP.getAt(d,h)]]);if(n)for(var m=e.elements[0].unit,g=0,v=e.structure.units;g<v.length;g++){var y=v[g];tU.areSameChainOperatorGroup(y,m)&&u(y,s,i)}else for(c=t;c<r;c++)u(e.elements[c].unit,s,i)}function l(t){for(var r=[],n=0,i=t.elements.length;n<i;n++){var a=t.elements[n];if(tU.Traits.is(a.unit.traits,tU.Trait.Partitioned)){for(var o=n;n<i&&tU.areSameChainOperatorGroup(t.elements[n].unit,a.unit);)n++;var u=n;n--,c(t,o,u,!0,r)}else s(a)?r[r.length]=a:c(t,n,n+1,!1,r)}return e(t.structure,r)}function d(e){return`${e.unit.model.id}|${Cj.entity.id(e)}`}function f(e,t){for(var r=[],n=0,i=kP.size(t);n<i;++n)r.push(e[kP.getAt(t,n)]);return PP.ofSortedArray(r)}function h(e,t){return PP.isRange(e)&&PP.areEqual(e,t)?$T.ofLength(e.length):i(PP.indicesOf(e,t))}e.is=function(e){return!!e&&"element-loci"===e.kind},e.areEqual=function(e,t){if(e.structure!==t.structure||e.elements.length!==t.elements.length)return!1;for(var r=0,n=e.elements.length;r<n;++r){var i=e.elements[r],a=t.elements[r];if(i.unit.id!==a.unit.id||!kP.areEqual(i.indices,a.indices))return!1}return!0},e.isEmpty=t,e.isWholeStructure=function(e){return r(e)===e.structure.elementCount},e.size=r,e.all=function(t){return e(t,t.units.map(function(e){return{unit:e,indices:kP.ofBounds(0,e.elements.length)}}))},e.none=function(t){return e(t,[])},e.getFirstLocation=function(e,r){if(!t(e)){var n=e.elements[0].unit,i=n.elements[kP.getAt(e.elements[0].indices,0)];return r?(r.structure=e.structure,r.unit=e.elements[0].unit,r.element=i,r):qF.create(e.structure,n,i)}},e.firstElement=n,e.firstResidue=function(e){return t(e)?e:a(n(e))},e.firstChain=function(e){return t(e)?e:l(n(e))},e.toStructure=function(e){for(var t=[],r=function(e){var r=e.unit,n=e.indices,i=new Int32Array(kP.size(n));kP.forEach(n,function(e,t){return i[t]=r.elements[e]}),t.push(r.getChild(PP.ofSortedArray(i)))},n=0,i=e.elements;n<i.length;n++)r(i[n]);return yz.create(t,{parent:e.structure.parent})},e.forEachLocation=function(t,r){if(!e.isEmpty(t))for(var n=qF.create(t.structure),i=0,a=t.elements;i<a.length;i++){var o=a[i],s=o.unit,u=o.indices;n.unit=s;for(var c=o.unit.elements,l=0,d=kP.size(u);l<d;l++)n.element=c[kP.getAt(u,l)],r(n)}},e.remap=function(t,r){if(r===t.structure)return t;var n=[];return t.elements.forEach(function(e){if(r.unitMap.has(e.unit.id)){var t=r.unitMap.get(e.unit.id),i=kP.indexedIntersect(e.indices,e.unit.elements,t.elements);kP.size(i)>0&&n.push({unit:t,indices:i})}}),e(r,n)},e.union=function t(r,n){if(r.elements.length>n.elements.length)return t(n,r);if(e.isEmpty(r))return n;for(var i=new Map,a=0,o=r.elements;a<o.length;a++){var s=o[a];i.set(s.unit.id,s.indices)}for(var u=[],c=0,l=n.elements;c<l.length;c++)s=l[c],i.has(s.unit.id)?(u[u.length]={unit:s.unit,indices:kP.union(i.get(s.unit.id),s.indices)},i.delete(s.unit.id)):u[u.length]=s;return i.forEach(function(e,t){u[u.length]={unit:r.structure.unitMap.get(t),indices:e}}),e(r.structure,u)},e.subtract=function(t,r){for(var n=new Map,i=0,a=r.elements;i<a.length;i++){var o=a[i];n.set(o.unit.id,o.indices)}for(var s=[],u=0,c=t.elements;u<c.length;u++)if(o=c[u],n.has(o.unit.id)){var l=kP.subtract(o.indices,n.get(o.unit.id));if(0===kP.size(l))continue;s[s.length]={unit:o.unit,indices:l}}else s[s.length]=o;return e(t.structure,s)},e.intersect=function(t,r){for(var n=new Map,i=0,a=t.elements;i<a.length;i++){var o=a[i];n.set(o.unit.id,o.indices)}for(var s=[],u=0,c=r.elements;u<c.length;u++)if(o=c[u],n.has(o.unit.id)){var l=kP.intersect(n.get(o.unit.id),o.indices);0!==kP.size(l)&&(s[s.length]={unit:o.unit,indices:l})}return e(t.structure,s)},e.areIntersecting=function t(r,n){if(r.elements.length>n.elements.length)return t(n,r);if(e.isEmpty(r))return e.isEmpty(n);for(var i=new Map,a=0,o=r.elements;a<o.length;a++){var s=o[a];i.set(s.unit.id,s.indices)}for(var u=0,c=n.elements;u<c.length;u++)if(s=c[u],i.has(s.unit.id)&&kP.areIntersecting(i.get(s.unit.id),s.indices))return!0;return!1},e.isSubset=function(t,r){if(e.isEmpty(t))return e.isEmpty(r);for(var n=new Map,i=0,a=t.elements;i<a.length;i++){var o=a[i];n.set(o.unit.id,o.indices)}for(var s=!1,u=0,c=r.elements;u<c.length;u++)if(o=c[u],n.has(o.unit.id)){if(!kP.isSubset(n.get(o.unit.id),o.indices))return!1;s=!0}return s},e.extendToWholeResidues=a,e.extendToWholeChains=l,e.extendToWholeEntities=function(t){for(var r=[],n=qF.create(t.structure),i=new Set,a=t.structure.units,o=0,s=t.elements.length;o<s;o++){var u=t.elements[o];n.unit=u.unit,n.element=u.unit.elements[0],i.add(d(n))}o=0;for(var c=a.length;o<c;++o){var l=a[o];if(n.unit=l,n.element=l.elements[0],i.has(d(n))){var f=kP.ofBounds(0,l.elements.length);r[r.length]={unit:l,indices:f}}}return e(t.structure,r)},e.extendToWholeModels=function(t){for(var r=[],n=new Set,i=t.structure.units,a=0,o=t.elements.length;a<o;a++){var s=t.elements[a];n.add(s.unit.model.id)}a=0;for(var u=i.length;a<u;++a){var c=i[a];if(n.has(c.model.id)){var l=kP.ofBounds(0,c.elements.length);r[r.length]={unit:c,indices:l}}}return e(t.structure,r)},e.extendToAllInstances=function(t){for(var r=[],n=new Map,i=0,a=t.elements.length;i<a;i++){var o=t.elements[i],s=o.unit.model,u=f(o.unit.elements,o.indices);n.has(s)?n.set(s,PP.union(u,n.get(s))):n.set(s,u)}i=0;for(var c=t.structure.units.length;i<c;++i){var l=t.structure.units[i];if(u=n.get(l.model)){var d=h(l.elements,u);kP.size(d)&&(r[r.length]={unit:l,indices:d})}}return e(t.structure,r)},e.extendToWholeOperators=function(t){for(var r=[],n=new Set,i=t.structure.units,a=0,o=t.elements.length;a<o;a++){var s=t.elements[a];n.add(s.unit.conformation.operator.name)}a=0;for(var u=i.length;a<u;++a){var c=i[a];if(n.has(c.conformation.operator.name)){var l=kP.ofBounds(0,c.elements.length);r[r.length]={unit:c,indices:l}}}return e(t.structure,r)};var p=new PM("98"),m=Cg();e.getBoundary=function(e,t){p.reset();for(var r=0,n=e.elements;r<n.length;r++)for(var i=(f=n[r]).indices,a=f.unit.conformation.position,o=f.unit.conformation.r,s=f.unit.elements,u=0,c=kP.size(i);u<c;u++)a(h=s[kP.getAt(i,u)],m),t&&Cg.transformMat4(m,m,t),p.includePositionRadius(m,o(h));p.finishedIncludeStep();for(var l=0,d=e.elements;l<d.length;l++){var f;for(i=(f=d[l]).indices,a=f.unit.conformation.position,o=f.unit.conformation.r,s=f.unit.elements,u=0,c=kP.size(i);u<c;u++){var h;a(h=s[kP.getAt(i,u)],m),t&&Cg.transformMat4(m,m,t),p.radiusPositionRadius(m,o(h))}}return{box:p.getBox(),sphere:p.getSphere()}};var g=Cg();function v(e,t,r){void 0===r&&(r=0);for(var n=r,i=0,a=e.elements;i<a.length;i++){for(var o=a[i],s=o.indices,u=o.unit.conformation.position,c=o.unit.elements,l=kP.size(s),d=0;d<l;d++)u(c[kP.getAt(s,d)],g),Cg.toArray(g,t,n+3*d);n+=3*l}return t}function y(e,t){return tU.isAtomic(e)?e.model.atomicHierarchy.atomSourceIndex.value(t):t}function b(e,t,r,n,i){vv(t);for(var a=[],o=[],s=0,u=t.length;s<u;){var c=s;for(s++;s<u&&t[s-1]+1===t[s];)s++;var l=s;if(l-c>12)a[a.length]=t[c],a[a.length]=t[l-1];else for(var d=c;d<l;d++)o[o.length]=t[d]}return r?{atom:{set:o,ranges:a},chain:{opName:[e]},entity:{modelLabel:n,modelIndex:i}}:{atom:{set:o,ranges:a},chain:{opName:[e]}}}e.toPositionsArray=v,e.getPrincipalAxes=function(e){var t=r(e),n=v(e,new Float32Array(3*t));return zE.ofPositions(n)},e.getPrincipalAxesMany=function(e){var t=0;e.forEach(function(e){t+=r(e)});var n=new Float32Array(3*t),i=0;return e.forEach(function(e){v(e,n,i),i+=3*r(e)}),zE.ofPositions(n)},e.toExpression=function(t){var r;if(e.isEmpty(t))return SL.struct.generator.empty();for(var n=t.structure.models,i=new Map,a=0,o=t.elements;a<o.length;a++){var s=(v=o[a]).indices,u=v.unit.elements,c=v.unit.conformation.operator.name,l=void 0;i.has(c)?l=i.get(c).xs:(l=gS.create(),i.set(c,{modelLabel:v.unit.model.label,modelIndex:v.unit.model.modelNum,xs:l}));for(var d=0,f=kP.size(s);d<f;d++){var h=y(v.unit,u[kP.getAt(s,d)]);gS.add(l,h,h)}}for(var p=[],m=i.keys();;){var g=m.next();if(g.done)break;var v=i.get(g.value);p.push(b(g.value,v.xs.array,n.length>1,v.modelLabel,v.modelIndex))}for(var _=new Map,x=(d=0,p.length);d<x;++d){var S=p[d];c=`${Tv(Iv(S.atom.ranges),Iv(S.atom.set))}|${S.entity?S.entity.modelLabel+S.entity.modelIndex:""}`,_.has(c)?(r=_.get(c).chain.opName).push.apply(r,S.chain.opName):_.set(c,S)}var w=[];return _.forEach(function(e){var t=e.atom,r=t.ranges,n=t.set,i=e.chain.opName,a=SL.struct.atomProperty.core.operatorName(),o=SL.struct.atomProperty.core.sourceIndex(),s=[];n.length>0&&(s[s.length]=SL.core.set.has([SL.core.type.set(n),o]));for(var u=0,c=r.length/2;u<c;u++)s[s.length]=SL.core.rel.inRange([o,r[2*u],r[2*u+1]]);if(e.entity){var l=e.entity,d=l.modelLabel,f=l.modelIndex;w.push(SL.struct.generator.atomGroups({"atom-test":s.length>1?SL.core.logic.or(s):s[0],"chain-test":i.length>
1391?SL.core.set.has([SL.core.type.set(i),a]):SL.core.rel.eq([a,i[0]]),"entity-test":SL.core.logic.and([SL.core.rel.eq([SL.struct.atomProperty.core.modelLabel(),d]),SL.core.rel.eq([SL.struct.atomProperty.core.modelIndex(),f])])}))}else w.push(SL.struct.generator.atomGroups({"atom-test":s.length>1?SL.core.logic.or(s):s[0],"chain-test":i.length>1?SL.core.set.has([SL.core.type.set(i),a]):SL.core.rel.eq([a,i[0]])}))}),SL.struct.modifier.union([1===w.length?w[0]:SL.struct.combinator.merge(w.map(function(e){return SL.struct.modifier.union([e])}))])}})(Az||={}),function(e){function t(){return{elementCount:0,conformationCount:0,residueCount:0,chainCount:0,unitCount:0,structureCount:0,firstElementLoc:qF.create(void 0),firstConformationLoc:qF.create(void 0),firstResidueLoc:qF.create(void 0),firstChainLoc:qF.create(void 0),firstUnitLoc:qF.create(void 0),firstStructureLoc:qF.create(void 0)}}function r(e,t,r){var n=e.get(t)||0;e.set(t,n+r)}function n(e,t,n){var i=n.indices,a=n.unit,o=a.elements,s=kP.size(i),u=new Map,c=new Map;if(s>0&&qF.set(e.firstElementLoc,t,a,o[kP.start(i)]),s===o.length)e.unitCount+=1,1===e.unitCount&&qF.set(e.firstUnitLoc,t,a,o[kP.start(i)]);else if(1===s){if(tU.Traits.is(a.traits,tU.Trait.MultiChain))return;e.elementCount+=1,1===e.elementCount&&qF.set(e.firstElementLoc,t,a,o[kP.start(i)])}else if(tU.isAtomic(a))for(var l=a.model.atomicHierarchy.residueAtomSegments,d=l.index,f=l.offsets,h=a.model.atomicHierarchy.atoms.label_alt_id,p=0,m=function(){u.clear();var n=0,l=o[kP.getAt(i,p)],m=d[l];for(r(u,h.value(l),1),++p,++n;p<s;){var g=o[kP.getAt(i,p)];if(d[g]!==m)break;r(u,h.value(g),1),++p,++n}if(f[m+1]-f[m]===n)e.residueCount+=1,1===e.residueCount&&qF.set(e.firstResidueLoc,t,a,f[m]);else{c.clear();for(var v=f[m],y=f[m+1];v<y;++v)r(c,h.value(v),1);c.get("")===u.get("")&&u.forEach(function(r,i){if(c.get(i)===r){if(""!==i&&(e.conformationCount+=1,1===e.conformationCount))for(var o=f[m],s=f[m+1];o<s;++o)if(i===h.value(o)){qF.set(e.firstConformationLoc,t,a,o);break}n-=r}}),e.elementCount+=n}};p<s;)m();else e.elementCount+=s,1===e.elementCount&&qF.set(e.firstElementLoc,t,a,o[kP.start(i)])}function i(e,t,r){var n=r.indices,i=r.unit,a=kP.size(n);if(0!==a){var o=i.elements;if(tU.Traits.is(i.traits,tU.Trait.MultiChain)){var s=tU.isAtomic(i)?i.model.atomicHierarchy.chainAtomSegments:tU.isSpheres(i)?i.model.coarseHierarchy.spheres.chainElementSegments:tU.isGaussians(i)?i.model.coarseHierarchy.gaussians.chainElementSegments:void 0;if(s)for(var u=s.index,c=s.offsets,l=0;l<a;){var d=0,f=o[kP.getAt(n,l)],h=u[f];for(++l,++d;l<a&&u[o[kP.getAt(n,l)]]===h;)++l,++d;c[h+1]-c[h]===d?(e.chainCount+=1,1===e.chainCount&&qF.set(e.firstChainLoc,t,i,c[h])):1===a&&(e.elementCount+=1,1===e.elementCount&&qF.set(e.firstElementLoc,t,i,f))}else console.warn("StructureElement loci stats: unknown unit type")}else a===o.length&&(e.chainCount+=1,1===e.chainCount&&qF.set(e.firstChainLoc,t,i,o[kP.start(n)]))}}function a(e,t,n,i,a){var o=n[i],s=tU.isAtomic(o.unit)?o.unit.model.atomicHierarchy.chainAtomSegments:tU.isSpheres(o.unit)?o.unit.model.coarseHierarchy.spheres.chainElementSegments:tU.isGaussians(o.unit)?o.unit.model.coarseHierarchy.gaussians.chainElementSegments:void 0;if(s){for(var u=s.index,c=s.offsets,l=new Map,d=i;d<a;d++){var f=(o=n[d]).indices,h=o.unit;if(0!==(b=kP.size(f))){var p=h.elements;if(tU.Traits.is(h.traits,tU.Trait.MultiChain))for(var m=0;m<b;){var g=0,v=u[_=p[kP.getAt(f,m)]];for(++m,++g;m<b&&u[p[kP.getAt(f,m)]]===v;)++m,++g;r(l,v,g)}else r(l,u[_=p[kP.start(f)]],p.length)}}var y=-1;if(l.forEach(function(t,r){c[r+1]-c[r]===t&&(e.chainCount+=1,1===e.chainCount&&(y=r))}),!(y<0))for(d=i;d<a;d++){var b;if(f=(o=n[d]).indices,h=o.unit,0!==(b=kP.size(f)))for(p=h.elements,m=0;m<b;){var _;if((v=u[_=p[kP.getAt(f,m)]])===y)return void qF.set(e.firstChainLoc,t,h,_)}}}else console.warn("StructureElement loci stats: unknown unit type")}e.create=t,e.ofLoci=function(e){var r=t();if(Az.isEmpty(e))return r;var o=!1;if(Az.isWholeStructure(e)){if(r.structureCount+=1,1===r.structureCount){var s=e.elements[0],u=s.unit,c=s.indices;qF.set(r.firstStructureLoc,e.structure,u,u.elements[kP.min(c)])}}else for(var l=0,d=e.elements;l<d.length;l++){var f=d[l];
139n(r,e.structure,f),tU.Traits.is(f.unit.traits,tU.Trait.Partitioned)?o=!0:i(r,e.structure,f)}if(o)for(var h=0,p=e.elements.length;h<p;h++)if(f=e.elements[h],tU.Traits.is(f.unit.traits,tU.Trait.Partitioned)){for(var m=h;h<p&&tU.areSameChainOperatorGroup(e.elements[h].unit,f.unit);)h++;var g=h;h--,g-m==1?i(r,e.structure,f):a(r,e.structure,e.elements,m,g)}return r},e.add=function(e,t,r){return 1===t.elementCount&&0===r.elementCount?qF.copy(e.firstElementLoc,t.firstElementLoc):0===t.elementCount&&1===r.elementCount&&qF.copy(e.firstElementLoc,r.firstElementLoc),1===t.conformationCount&&0===r.conformationCount?qF.copy(e.firstConformationLoc,t.firstConformationLoc):0===t.conformationCount&&1===r.conformationCount&&qF.copy(e.firstConformationLoc,r.firstConformationLoc),1===t.residueCount&&0===r.residueCount?qF.copy(e.firstResidueLoc,t.firstResidueLoc):0===t.residueCount&&1===r.residueCount&&qF.copy(e.firstResidueLoc,r.firstResidueLoc),1===t.chainCount&&0===r.chainCount?qF.copy(e.firstChainLoc,t.firstChainLoc):0===t.chainCount&&1===r.chainCount&&qF.copy(e.firstChainLoc,r.firstChainLoc),1===t.unitCount&&0===r.unitCount?qF.copy(e.firstUnitLoc,t.firstUnitLoc):0===t.unitCount&&1===r.unitCount&&qF.copy(e.firstUnitLoc,r.firstUnitLoc),1===t.structureCount&&0===r.structureCount?qF.copy(e.firstStructureLoc,t.firstStructureLoc):0===t.structureCount&&1===r.structureCount&&qF.copy(e.firstStructureLoc,r.firstStructureLoc),e.elementCount=t.elementCount+r.elementCount,e.conformationCount=t.conformationCount+r.conformationCount,e.residueCount=t.residueCount+r.residueCount,e.chainCount=t.chainCount+r.chainCount,e.unitCount=t.unitCount+r.unitCount,e.structureCount=t.structureCount+r.structureCount,e}}(_z||={}),function(e){function t(e){var t=this,r=e.descriptor.name,n="static"===e.type?"_staticPropertyData":"_dynamicPropertyData",i=function(t){return r in t[n]||(t[n][r]={props:Ac({},Ib.getDefaultValues(e.getParams(t))),data:ef.create(void 0)}),t[n][r]},a=function(e,t,a){var o=i(e);e[n][r]={props:t,data:ef.withValue(o.data,a)}};return{label:e.label,descriptor:e.descriptor,isHidden:e.isHidden,getParams:function(t){var r=Ib.clone(e.getParams(t));return Ib.setDefaultValues(r,i(t).props),r},defaultParams:e.defaultParams,isApplicable:e.isApplicable,attach:function(r,n,o,s){return void 0===o&&(o={}),Tc(t,void 0,void 0,function(){var t,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return s&&n.customProperties.reference(e.descriptor,!0),t=i(n),u=Ib.merge(e.defaultParams,t.props,o),t.data.value&&Ib.areEqual(e.defaultParams,t.props,u)?[2]:[4,e.obtain(r,n,u)];case 1:return c=f.sent(),l=c.value,d=c.assets,n.customProperties.add(e.descriptor),n.customProperties.assets(e.descriptor,d),a(n,u,l),[2]}})})},ref:function(t,r){return t.customProperties.reference(e.descriptor,r)},get:function(e){return i(e)?.data},set:function(t,r,n){void 0===r&&(r={});var o=i(t),s=Ib.merge(e.defaultParams,o.props,r);Ib.areEqual(e.defaultParams,o.props,s)||(a(t,s,n),t.customProperties.assets(e.descriptor))},props:function(e){return i(e).props}}}e.createProvider=t,e.createSimple=function(e,r,n){var i=this,a={value:Ib.Value(n,{isHidden:!0})};return t({label:Yg(e),descriptor:{name:e},isHidden:!0,type:r,defaultParams:a,getParams:function(){return{value:Ib.Value(n,{isHidden:!0})}},isApplicable:function(){return!0},obtain:function(e,t,r){return Tc(i,void 0,void 0,function(){return Pc(this,function(e){return[2,Ac(Ac({},Ib.getDefaultValues(a)),r)]})})}})}}(xz||={}),function(e){var t=this;function r(e){if(!qz.is(e.sourceData))return!1;var t=e.sourceData.data.db.atom_site,r=t.pdbx_sifts_xref_db_name,n=t.pdbx_sifts_xref_db_acc,i=t.pdbx_sifts_xref_db_num,a=t.pdbx_sifts_xref_db_res;return r.isDefined&&n.isDefined&&i.isDefined&&a.isDefined}function n(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db.atom_site,r=t.pdbx_sifts_xref_db_name,n=t.pdbx_sifts_xref_db_acc,i=t.pdbx_sifts_xref_db_num,a=t.pdbx_sifts_xref_db_res;if(r.isDefined&&n.isDefined&&i.isDefined&&a.isDefined){for(var o=e.atomicHierarchy.atomSourceIndex,s=e.atomicHierarchy.residueAtomSegments,u=s.count,c=s.offsets,l=Array(u),d=Array(u),f=Array(u),h=Array(u),p=0;p<u;p++){var m=o.value(c[p]);0===r.valueKind(m)?(l[p]=r.value(m),d[p]=n.value(m),f[p]=i.value(m),h[p]=a.value(m)):(l[p]="",d[p]="",f[p]="",h[p]="")}return{dbName:l,accession:d,num:f,residue:h}}}}e.Provider=xz.createProvider({label:"SIFTS Mapping",descriptor:{name:"sifts_sequence_mapping"},type:"static",defaultParams:{},getParams:function(){return{}},isApplicable:function(e){return r(e)},obtain:function(e,r){return Tc(t,void 0,void 0,function(){return Pc(this,function(e){return[2,{value:n(r)}]})})}}),e.isAvailable=r,e.getKey=function(t){var r=t.unit.model,n=e.Provider.get(r).value;if(!n)return"";var i=r.atomicHierarchy.residueAtomSegments.index[t.element];return n.accession[i]},e.getLabel=function(t){var r=t.unit.model,n=e.Provider.get(r).value;if(n){var i=r.atomicHierarchy.residueAtomSegments.index[t.element],a=n.dbName[i];if(a)return`${a} ${n.accession[i]} ${n.num[i]} ${n.residue[i]}`}}}(Sz||={}),s$.Field,s$.Encodings,s$.Field,s$.Category,s$.Category;
139var Cz,Tz,Pz,Ez={molstar_atom_site_operator_mapping:{label_asym_id:xv.Schema.Str(),auth_asym_id:xv.Schema.Str(),operator_name:xv.Schema.Str(),suffix:xv.Schema.Str(),assembly_id:xv.Schema.Str(),assembly_operator_id:xv.Schema.Int(),symmetry_operator_index:xv.Schema.Int(),symmetry_hkl:xv.Schema.Vector(3),ncs_id:xv.Schema.Int()}},Mz=function(e,t){return+(void 0===t[e].operator.assembly)},kz=function(e,t){return+(-1===t[e].operator.spgrOp)};function Iz(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(r,e[r]);return t}s$.fields().str("label_asym_id",function(e,t){return t[e].label_asym_id}).str("auth_asym_id",function(e,t){return t[e].auth_asym_id}).str("operator_name",function(e,t){return t[e].operator.name}).str("suffix",function(e,t){return t[e].operator.suffix}).str("assembly_id",function(e,t){return t[e].operator.assembly?.id||""},{valueKind:Mz}).int("assembly_operator_id",function(e,t){return t[e].operator.assembly?.operId||0},{valueKind:Mz}).int("symmetry_operator_index",function(e,t){return t[e].operator.spgrOp},{valueKind:kz}).vec("symmetry_hkl",[function(e,t){return t[e].operator.hkl[0]},function(e,t){return t[e].operator.hkl[1]},function(e,t){return t[e].operator.hkl[2]}],{valueKind:kz}).int("ncs_id",function(e,t){return t[e].operator.ncsId},{valueKind:kz}).getFields(),s$.Category,function(e){e.create=function(e){var t=Array.isArray(e)?e:[e];return{structures:t,firstModel:t[0].model,cache:Object.create(null)}}}(Cz||={}),function(e){e.AtomSitePositionsFieldNames=new Set(["id","Cartn_x","Cartn_y","Cartn_z"])}(Tz||={}),function(e){e.getCifDataSource=function(e,t,r){if(!t)return{rowCount:0};if(r&&r[t.id])return r[t.id];var n=t.getElements(e),i={data:n,rowCount:n.elements.length};return r&&(r[t.id]=i),i},e.fromAtomMap=function(e){return new Rz(e)},e.fromAtomArray=function(e){return new Rz(Iz(e))};var t=function(e){return e.atomicHierarchy.residueAtomSegments};e.fromResidueMap=function(e){return new Oz("residue",e,t,0)},e.fromResidueArray=function(e){return new Oz("residue",Iz(e),t,0)};var r=function(e){return e.atomicHierarchy.chainAtomSegments};e.fromChainMap=function(e){return new Oz("chain",e,r,0)},e.fromChainArray=function(e){return new Oz("chain",Iz(e),r,0)},e.fromEntityMap=function(e){return new Bz(e)}}(Pz||={});var Dz,Oz=function(){function e(e,t,r,n){this.level=e,this.map=t,this.segmentGetter=r,this.id=Wd.create22(),this.kind=n}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.getStructureElements=function(e){var t=e.models;if(1!==t.length)throw Error("Only works on structures with a single model.");for(var r=new Set,n=e.unitSymmetryGroups,i=[],a=this.segmentGetter(t[0]),o=0,s=n;o<s.length;o++){var u=s[o].units[0];if(u.kind===this.kind)for(var c=fE.transientSegments(a,u.elements);c.hasNext;){var l=c.move();this.has(l.index)&&!r.has(l.index)&&(r.add(l.index),i[i.length]=qF.create(e,u,u.elements[l.start]))}}return i.sort(function(e,t){return e.element-t.element}),i},e.prototype.getElements=function(e){var t=this,r=this.segmentGetter(e.model).index,n=this.getStructureElements(e);return{elements:n,property:function(e){return t.get(r[n[e].element])}}},e}(),Rz=function(){function e(e){this.map=e,this.id=Wd.create22(),this.level="atom",this.kind=0}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.getStructureElements=function(e){if(1!==e.models.length)throw Error("Only works on structures with a single model.");for(var t=new Set,r=[],n=0,i=e.unitSymmetryGroups;n<i.length;n++){var a=i[n].units[0];if(a.kind===this.kind)for(var o=a.elements,s=0,u=o.length;s<u;s++){var c=o[s];this.has(c)&&!t.has(c)&&(t.add(o[s]),r[r.length]=qF.create(e,a,c))}}return r.sort(function(e,t){return e.element-t.element}),r},e.prototype.getElements=function(e){var t=this,r=this.getStructureElements(e);return{elements:r,property:function(e){return t.get(r[e].element)}}},e}(),Bz=function(){function e(e){this.map=e,this.id=Wd.create22(),this.level="entity",this.kind=0}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.getStructureElements=function(e){var t=e.models;if(1!==t.length)throw Error("Only works on structures with a single model.");for(var r=t[0].atomicHierarchy.index,n=new Set,i=e.unitSymmetryGroups,a=[],o=t[0].atomicHierarchy.chainAtomSegments,s=0,u=i;s<u.length;s++){var c=u[s].units[0];if(c.kind===this.kind)for(var l=fE.transientSegments(o,c.elements);l.hasNext;){var d=l.move(),f=r.getEntityFromChain(d.index);this.has(f)&&!n.has(f)&&(n.add(f),a[a.length]=qF.create(e,c,c.elements[d.start]))}}return a.sort(function(e,t){return e.element-t.element}),a},e.prototype.getElements=function(e){var t=this,r=this.getStructureElements(e),n=e.model.atomicHierarchy.chainAtomSegments.index,i=e.model.atomicHierarchy.index;return{elements:r,property:function(e){return t.get(i.getEntityFromChain(n[r[e].element]))}}},e}(),Nz=function(){function e(e){this.frames=e,this.frameCount=e.length,this.representative=e[0],this.duration=e.length}return e.prototype.getFrameAtIndex=function(e){return this.frames[e]},e}();function Fz(e,t,r){if(!e._rowCount)return[];for(var n=function(e){for(var t=e.id,r=e.matrix,n=e.vector,i=e._schema,a=new Map,o=Cg(),s=0,u=e._rowCount;s<u;s++){var c=Tg.toMat4(Og(),i.matrix.space,r.value(s));Tg.toVec3(o,i.vector.space,n.value(s)),Og.setTranslation(c,o),Og.setValue(c,3,3,1),a.set(t.value(s),c)}return a}(r),i=[],a=0;a<e._rowCount;a++)i[i.length]=Lz(e,t,a,n);return i}function Lz(e,t,r,n){for(var i=e.id.value(r),a=e.details.value(r),o=[],s=t.assembly_id,u=t.oper_expression,c=t.asym_id_list,l=0,d=t._rowCount;l<d;l++)s.value(l)===i&&(o[o.length]={assemblyId:i,expression:u.value(l),asymIds:c.value(l)});return GF.create(i,a,function(e,t){return function(){for(var r=[],n=0,i=0;i<e.length;i++){var a=e[i],o=jz(t,$z(zz(a.expression)),n,a.assemblyId),s=Zj.generators.atoms({chainTest:Zj.pred.and(Zj.pred.eq(function(e){return Cj.unit.operator_name(e.element)},AE.DefaultName),Zj.pred.inSet(function(e){return Cj.chain.label_asym_id(e.element)},a.asymIds))});r[r.length]={selector:s,operators:o,asymIds:a.asymIds},n+=o.length}return r}}(o,n))}function $z(e){for(var t=[],r=[],n=0;n<e.length;n++)r[n]="";return Uz(e,t,e.length-1,r),t}function Uz(e,t,r,n){if(r<0)t[t.length]=n.slice(0);else for(var i=e[r],a=i.length,o=0;o<a;o++)n[r]=i[o],Uz(e,t,r-1,n)}function jz(e,t,r,n){for(var i=[],a=r,o=0,s=t;o<s.length;o++){for(var u=s[o],c=Og.identity(),l=0;l<u.length;l++)Og.mul(c,c,e.get(u[l]));a++,i[i.length]=AE.create(`ASM_${a}`,c,{assembly:{id:n,operId:a,operList:u}})}return i}function zz(e){for(var t,r=/\(?([^\(\)]+)\)?]*/g,n=[],i=[];t=r.exec(e);)n[n.length]=t[1];
139return n.forEach(function(e){var t=[];e.split(",").forEach(function(e){var r=e.indexOf("-");if(r>0)for(var n=parseInt(e.substring(0,r)),i=parseInt(e.substr(r+1)),a=n;a<=i;a++)t[t.length]=a.toString();else t[t.length]=e.trim()}),i[i.length]=t}),i}function Gz(e){if(0!==e._rowCount){for(var t=e.id,r=e.matrix,n=e.vector,i=yA.struct_ncs_oper.matrix.space,a=yA.struct_ncs_oper.vector.space,o=[],s=0;s<e._rowCount;s++){var u=Tg.toMat3(Rg(),i,r.value(s)),c=Tg.toVec3(Cg(),a,n.value(s));if(AE.checkIfRotationAndTranslation(u,c)&&("given"!==e.code.value(s)||Rg.isIdentity(u)||Cg.isZero(c))){var l=t.value(s);o[o.length]=AE.ofRotationAndOffset(`ncs_${l}`,u,c,l)}}return o}}!function(e){e.Descriptor={name:"model_symmetry"},e.Provider=FF.create(e.Descriptor),e.fromData=function(e){return{assemblies:Fz(e.pdbx_struct_assembly,e.pdbx_struct_assembly_gen,e.pdbx_struct_oper_list),spacegroup:function(e,t){if(0===e._rowCount||0===t._rowCount)return $E.ZeroP1;var r=t.length_a.value(0),n=t.length_b.value(0),i=t.length_c.value(0);if(0===r||0===n||0===i)return $E.ZeroP1;var a=t.angle_alpha.value(0),o=t.angle_beta.value(0),s=t.angle_gamma.value(0);if(0===a||0===o||0===s)return $E.ZeroP1;var u=function(e){var t=e.Int_Tables_number.value(0),r=e["space_group_name_H-M"].value(0);return e.Int_Tables_number.isDefined?e["space_group_name_H-M"].isDefined?r:t:r}(e),c=LE.create(u,Cg.create(r,n,i),Cg.scale(Cg(),Cg.create(a,o,s),Math.PI/180));return $E.create(c)}(e.symmetry,e.cell),isNonStandardCrystalFrame:(e.atom_sites._rowCount,!1),ncsOperators:Gz(e.struct_ncs_oper)}},e.fromCell=function(e,t){var r=LE.create("P 1",e,t);return{assemblies:[],spacegroup:$E.create(r),isNonStandardCrystalFrame:!1}}}(Dz||={});var Vz,Hz,qz,Wz,Xz,Yz={U:yA.atom_site_anisotrop.U,U_esd:yA.atom_site_anisotrop.U_esd};function Kz(e,t){var r=qz.fromFrame(e,void 0,void 0,t),n=wF(r.data.db,!0);return vy.create("Create mmCIF Model",function(e){return MG(n,r,e)})}function Zz(e){var t=Wz.fromFrame(e);return vy.create("Create CCD Models",function(r){return function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return[4,Qz(e,t,{coordinateType:"ideal",cartn_x:"pdbx_model_Cartn_x_ideal",cartn_y:"pdbx_model_Cartn_y_ideal",cartn_z:"pdbx_model_Cartn_z_ideal"},r)];case 1:return n=u.sent(),[4,Qz(e,t,{coordinateType:"model",cartn_x:"model_Cartn_x",cartn_y:"model_Cartn_y",cartn_z:"model_Cartn_z"},r)];case 2:for(i=u.sent(),a=[],n&&a.push(n),i&&a.push(i),o=0,s=a.length;o<s;++o)Xz.TrajectoryInfo.set(a[o],{index:o,size:a.length});return[2,new Nz(a)]}})})}(t.data.db,Wz.fromFrame(e),r)})}function Qz(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B,N,F,L,$,U;return Pc(this,function(j){switch(j.label){case 0:for(i=e.chem_comp,a=e.chem_comp_atom,o=e.chem_comp_bond,s=r.coordinateType,u=r.cartn_x,c=r.cartn_y,l=r.cartn_z,d=i.name.value(0),f=i.id.value(0),h=a.atom_id,p=a.charge,m=a.comp_id,g=a.pdbx_ordinal,v=a.type_symbol,y=a._rowCount,b=[],_=0;_<y;_++)a[u].valueKind(_)>0||(b[b.length]=_);return x=b.length,S=xv.ofConst("A",x,xv.Schema.str),w=xv.ofConst(1,x,xv.Schema.int),A=xv.ofConst("1",x,xv.Schema.str),C=xv.ofConst(1,x,xv.Schema.float),T=xv.ofConst(1,x,xv.Schema.int),P=xv.view(h,b),E=xv.view(m,b),M=xv.view(a[u],b),k=xv.view(a[c],b),I=xv.view(a[l],b),D=xv.view(g,b),O=xv.view(v,b),R=xv.view(p,b),B=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:S,auth_atom_id:P,auth_comp_id:E,auth_seq_id:w,Cartn_x:M,Cartn_y:k,Cartn_z:I,id:D,label_asym_id:S,label_atom_id:P,label_comp_id:E,label_seq_id:w,label_entity_id:A,occupancy:C,type_symbol:O,pdbx_PDB_model_num:T,pdbx_formal_charge:R},x),(N=new BF).setNames([[f,`${d} (${s})`]]),N.getEntityId(f,0,"A"),(F=new kF(w,v)).setNames([[f,`${d} (${s})`]]),F.add(f,0),[4,MG(wF({entity:N.getEntityTable(),chem_comp:F.getChemCompTable(),atom_site:B}),t,n)];case 1:return(L=j.sent()).representative?($=L.representative,U=u$.getEntriesFromChemCompBond(o),u$.Provider.set($,{data:o,entries:U}),Wz.CoordinateType.set($,s),[2,L.representative]):[2]}})})}function Jz(e,t){return t?1===t.length?Ev(t.charCodeAt(0),e):2===t.length?Ev(t.charCodeAt(0),Ev(t.charCodeAt(1),e)):`${e} ${t}`:e}function eG(e,t,r,n){if(e.has(t))(i=e.get(t)).has(r)||i.set(r,n);else{var i=new Map;e.set(t,i),i.set(r,n)}}function tG(e){throw Error(`Missing entity entry for entity id '${e}'.`)}(function(e){e.Schema=Yz,e.Descriptor={name:"atom_site_anisotrop",cifExport:{prefix:"",categories:[{name:"atom_site_anisotrop",instance:function(t){return e.Provider.get(t.firstModel)&&qz.is(t.firstModel.sourceData)?s$.Category.ofTable(t.firstModel.sourceData.data.db.atom_site_anisotrop):s$.Category.Empty}}]}},e.Provider=FF.create(e.Descriptor),e.getElementToAnsiotrop=function(e,t){var r=new Int32Array(e.rowCount);r.fill(-1);for(var n=0,i=e.rowCount;n<i;n++)r[e.value(n)]=n;var a=new Int32Array(e.rowCount);for(a.fill(-1),n=0,i=t.rowCount;n<i;++n){var o=r[t.value(n)];-1!==o&&(a[o]=n)}return a},e.getElementToAnsiotropFromLabel=function(e,t){for(var r={},n=0,i=e.rowCount;n<i;n++)r[e.value(n)]=n;var a=new Int32Array(e.rowCount);for(a.fill(-1),n=0,i=t.rowCount;n<i;++n){var o=r[t.value(n)];void 0!==o&&(a[o]=n)}return a}})(Vz||={}),function(e){var t,r="molstar_global_model_transform_info";function n(t){return e.Provider.get(t)}e.Schema=((t={})[r]={matrix:xv.Schema.Matrix(4,4,xv.Schema.float)},t),e.Descriptor={name:r,cifExport:{categories:[{name:r,instance:function(t){var r=n(t.firstModel);if(!r)return s$.Category.Empty;var i=Sv.ofRows(e.Schema.molstar_global_model_transform_info,[{matrix:r}]);return s$.Category.ofTable(i)}}],prefix:"molstar"}},e.Provider=FF.create(e.Descriptor),e.attach=function(t,r){t.customProperties.has(e.Descriptor)||t.customProperties.add(e.Descriptor),e.Provider.set(t,r)},e.get=n,e.fromMmCif=function(t){if(qz.is(t.sourceData)){var n=t.sourceData.data.frame.categories[r];if(n){var i=nA(e.Schema[r],n);if(0!==i._rowCount)return i.matrix.value(0)}}},e.hasData=function(e){if(!qz.is(e.sourceData))return!1;var t=e.sourceData.data.frame.categories[r];return!!t&&t.rowCount>0},e.writeMmCif=function(t,n){t.writeCategory({name:r,instance:function(){var t=Sv.ofRows(e.Schema.molstar_global_model_transform_info,[{matrix:n}]);return s$.Category.ofTable(t)}})}}(Hz||={}),Dz.Provider.formatRegistry.add("mmCIF",function(e){if(qz.is(e.sourceData))return Dz.fromData(e.sourceData.data.db)}),QU.Provider.formatRegistry.add("mmCIF",function(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db,r=t.struct_conf,n=t.struct_sheet_range;return QU.fromStruct(r,n,e.atomicHierarchy)}}),Vz.Provider.formatRegistry.add("mmCIF",function(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db.atom_site_anisotrop;return{data:Sv.ofColumns(Vz.Schema,t),elementToAnsiotrop:Vz.getElementToAnsiotrop(e.atomicConformation.atomId,t.id)}}},function(e){return!!qz.is(e.sourceData)&&e.sourceData.data.db.atom_site_anisotrop.U.isDefined}),u$.Provider.formatRegistry.add("mmCIF",function(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db.chem_comp_bond;if(0!==t._rowCount)return{data:t,entries:u$.getEntriesFromChemCompBond(t)}}}),c$.Provider.formatRegistry.add("mmCIF",function(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db.struct_conn;if(0!==t._rowCount){var r=c$.getEntriesFromStructConn(t,e);return{data:t,byAtomIndex:c$.getAtomIndexFromEntries(r),entries:r}}}}),Hz.Provider.formatRegistry.add("mmCIF",Hz.fromMmCif,Hz.hasData),function(e){e.is=function(e){return"mmCIF"===e?.kind},e.fromFrame=function(e,t,r,n){return t||=JA.schema.mmCIF(e),{kind:"mmCIF",name:t._name,data:{db:t,file:n,frame:e,source:r}}}}(qz||={}),function(e){var t="__CcdCoordinateType__";e.CoordinateType={get:function(e){return e._staticPropertyData[t]},set:function(e,r){return e._staticPropertyData[t]=r}},e.is=function(e){return"CCD"===e?.kind},e.fromFrame=function(e,t){return t||=JA.schema.CCD(e),{kind:"CCD",name:t._name,data:{db:t,frame:e}}}}(Wz||={}),function(e){function t(t,r){for(var n=[],i=r.frames,a=t.atomicHierarchy.atomSourceIndex,o=xv.isIdentity(a)?void 0:a.toArray({array:Int32Array}),s=u(t),c=t.atomicHierarchy.atoms._rowCount,l=0,d=i.length;l<d;++l){var f=i[l];if(f.elementCount!==c)throw Error(`Frame element count mismatch, got ${f.elementCount} but expected ${c}.`);var h=Ac(Ac({},t),{id:Wd.create22(),modelNum:l,atomicConformation:LB.getAtomicConformation(f,{atomId:t.atomicConformation.atomId,occupancy:t.atomicConformation.occupancy,B_iso_or_equiv:t.atomicConformation.B_iso_or_equiv},o),customProperties:new vR,_staticPropertyData:Object.create(null),_dynamicPropertyData:Object.create(null)});if(f.cell){var p=Dz.fromCell(f.cell.size,f.cell.anglesInRadians);Dz.Provider.set(h,p)}e.TrajectoryInfo.set(h,{index:l,size:i.length}),e.CoarseGrained.set(h,s),n.push(h)}return{trajectory:n,srcIndexArray:o}}e.trajectoryFromModelAndCoordinates=function(e,r){return new Nz(t(e,r).trajectory)},e.trajectoryFromTopologyAndCoordinates=function(r,n){var i=this;return vy.create("Create Trajectory",function(a){return Tc(i,void 0,void 0,function(){var i,o,s,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:return[4,MG(r.basic,r.sourceData,a)];case 1:if(0===(i=g.sent()).frameCount)throw Error("found no model");for(o=i.representative,s=t(o,n).trajectory,c={pairs:r.bonds,count:o.atomicHierarchy.atoms._rowCount},l=LF.fromData(c),d=u(o),f=0,h=0,p=s;h<p.length;h++)m=p[h],LF.Provider.set(m,l),e.TrajectoryInfo.set(m,{index:f++,size:s.length}),e.CoarseGrained.set(m,d);return[2,new Nz(s)]}})})})};var r="__Center__";e.getCenter=function(e){if(e._dynamicPropertyData[r])return e._dynamicPropertyData[r];var t=function(e,t){var r=[],n=[],i=[];e.x.length&&(r.push.apply(r,Lb(e.x)),n.push.apply(n,Lb(e.y)),i.push.apply(i,Lb(e.z))),t&&(t.spheres.x.length&&(r.push.apply(r,Lb(t.spheres.x)),n.push.apply(n,Lb(t.spheres.y)),i.push.apply(i,Lb(t.spheres.z))),t.gaussians.x.length&&(r.push.apply(r,Lb(t.gaussians.x)),n.push.apply(n,Lb(t.gaussians.y)),i.push.apply(i,Lb(t.gaussians.z))));var a=Lb(r),o=a[0],s=a[1],u=Lb(n),c=u[0],l=u[1],d=Lb(i),f=d[0],h=o+(s-o)/2,p=c+(l-c)/2,m=f+(d[1]-f)/2;return Cg.create(h,p,m)}(e.atomicConformation,e.coarseConformation);return e._dynamicPropertyData[r]=t,t};var n="__InvertedAtomSrcIndex__";e.getInvertedAtomSourceIndex=function(e){if(e._staticPropertyData[n])return e._staticPropertyData[n];var t=function(e){for(var t=new Int32Array(e.rowCount),r=!1,n=0,i=e.rowCount;n<i;n++){var a=e.value(n);a!==n&&(r=!1),t[a]=n}return{isIdentity:r,invertedIndex:t}}(e.atomicHierarchy.atomSourceIndex);return e._staticPropertyData[n]=t,t};var i="__TrajectoryInfo__";e.TrajectoryInfo={get:function(e){return e._dynamicPropertyData[i]||{index:0,size:1}},set:function(e,t){return e._dynamicPropertyData[i]=t}};var a="__AsymIdCount__";e.AsymIdCount={get:function(e){if(e._dynamicPropertyData[a])return e._dynamicPropertyData[a];var t=function(e){var t=new Set,r=new Set;
139return e.properties.structAsymMap.forEach(function(e,n){var i=e.auth_id;t.add(i),r.add(n)}),{auth:t.size,label:r.size}}(e);return e._dynamicPropertyData[a]=t,t}},e.AsymIdOffset=xz.createSimple("asym_id_offset","static"),e.Index=xz.createSimple("index","static"),e.MaxIndex=xz.createSimple("max_index","static"),e.getRoot=function(e){return e.parent||e},e.areHierarchiesEqual=function(e,t){return e.atomicHierarchy===t.atomicHierarchy&&e.coarseHierarchy===t.coarseHierarchy};var o="__CoordinatesHistory__";e.CoordinatesHistory={get:function(e){return e._staticPropertyData[o]},set:function(e,t){return e._staticPropertyData[o]=t}};var s="__CoarseGrained__";function u(t){var r=e.CoarseGrained.get(t);if(void 0===r){for(var n=0,i=t.atomicHierarchy.derived.residue.polymerType,a=0;a<i.length;++a)0!==i[a]&&(n+=1);var o=!1,s=!1,u=t.atomicHierarchy.atoms,c=u.label_atom_id,l=u._rowCount;for(a=0;a<l;++a){var d=c.value(a);if(o||"BB"!==d||(o=!0),s||"SC1"!==d||(s=!0),o&&s)break}r=o&&s||!(!n||!l)&&l/n<3,e.CoarseGrained.set(t,r)}return r}function c(e){return!!qz.is(e.sourceData)&&(null!==e.entryId.match(/^[1-9][a-z0-9]{3,3}$/i)||null!==e.entryId.match(/^pdb_[0-9]{4,4}[1-9][a-z0-9]{3,3}$/i))}e.CoarseGrained={get:function(e){return e._staticPropertyData[s]},set:function(e,t){return e._staticPropertyData[s]=t}},e.isCoarseGrained=u,e.hasCarbohydrate=function(e){return e.properties.saccharideComponentMap.size>0},e.hasProtein=function(e){for(var t=e.entities.subtype,r=0,n=t.rowCount;r<n;++r)if(t.value(r).startsWith("polypeptide"))return!0;return!1},e.hasNucleic=function(e){for(var t=e.entities.subtype,r=0,n=t.rowCount;r<n;++r){var i=t.value(r);if(i.endsWith("ribonucleotide hybrid")||i.endsWith("ribonucleotide"))return!0}return!1},e.isFromPdbArchive=function(e){if(!qz.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0,n=t.database_2.database_id.rowCount;r<n;++r)if("pdb"===t.database_2.database_id.value(r))return!0;return!1},e.hasPdbId=c,e.hasSecondaryStructure=function(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db;return t.struct_conf.id.isDefined||t.struct_sheet_range.id.isDefined}return QU.Provider.isApplicable(e)};var l=Cg.create(1.5707963,1.5707963,1.5707963),d=Cg.create(1,1,1);function f(e){if(!qz.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0;r<t.exptl.method.rowCount;r++)if(t.exptl.method.value(r).toUpperCase().indexOf("DIFFRACTION")>=0)return!0;return!1}function h(e){if(!qz.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0;r<t.exptl.method.rowCount;r++)if(t.exptl.method.value(r).toUpperCase().indexOf("MICROSCOPY")>=0)return!0;return!1}function p(e){if(!qz.is(e.sourceData)||!f(e))return!1;var t=e.sourceData.data.db.pdbx_database_status.status_code_sf;return t.isDefined&&"REL"===t.value(0)}function m(e){if(!qz.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=t.pdbx_database_related,n=r.db_name,i=r.content_type,a=0,o=t.pdbx_database_related._rowCount;a<o;++a)if("EMDB"===n.value(a).toUpperCase()&&"associated EM volume"===i.value(a))return!0;return!1}function g(e){return!!qz.is(e.sourceData)&&(p(e)||m(e))}e.hasCrystalSymmetry=function(e){var t=Dz.Provider.get(e)?.spacegroup;return!(!t||1===t.num&&Cg.equals(t.cell.anglesInRadians,l)&&Cg.equals(t.cell.size,d))},e.isFromXray=f,e.isFromEm=h,e.isFromNmr=function(e){if(!qz.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0;r<t.exptl.method.rowCount;r++)if(t.exptl.method.value(r).toUpperCase().indexOf("NMR")>=0)return!0;return!1},e.hasXrayMap=p,e.hasEmMap=m,e.hasDensityMap=g,e.probablyHasDensityMap=function(e){if(!qz.is(e.sourceData))return!1;var t=e.sourceData.data.db;return g(e)||c(e)&&(!t.exptl.method.isDefined||f(e)&&(!t.pdbx_database_status.status_code_sf.isDefined||2===t.pdbx_database_status.status_code_sf.valueKind(0))||h(e)&&!t.pdbx_database_related.db_name.isDefined)}}(Xz||={});var rG=kU.EmptyResidueKey(),nG=function(){function e(e){this.map=e,this.entityIndex=e.entities.getEntityIndex,this.residueOffsets=this.map.segments.residueAtomSegments.offsets}return e.prototype.getEntityFromChain=function(e){return this.map.chain_index_entity_index[e]},e.prototype.findEntity=function(e){var t=this.map.label_asym_id.get(e);return void 0===t?-1:t}
139,e.prototype.findChainLabel=function(e){var t=this.entityIndex(e.label_entity_id);if(t<0||!this.map.entity_index_label_asym_id.has(t))return-1;var r=this.map.entity_index_label_asym_id.get(t);return r&&r.has(e.label_asym_id)?r.get(e.label_asym_id):-1},e.prototype.findChainAuth=function(e){if(!this.map.auth_asym_id_auth_seq_id.has(e.auth_asym_id))return-1;var t=this.map.auth_asym_id_auth_seq_id.get(e.auth_asym_id);return t.has(e.auth_seq_id)?t.get(e.auth_seq_id):-1},e.prototype.findResidue=function(e,t,r,n){var i;1===arguments.length?i=e:(rG.label_entity_id=e,rG.label_asym_id=t,rG.auth_seq_id=r,rG.pdbx_PDB_ins_code=n,i=rG);var a=this.findChainLabel(i);if(a<0)return-1;var o=this.map.chain_index_auth_seq_id.get(a),s=Jz(i.auth_seq_id,i.pdbx_PDB_ins_code||"");return o.has(s)?o.get(s):-1},e.prototype.findResidueLabel=function(e){var t=this.findChainLabel(e);if(t<0)return-1;var r=this.map.chain_index_label_seq_id.get(t),n=Jz(e.label_seq_id,e.pdbx_PDB_ins_code||"");return r.has(n)?r.get(n):-1},e.prototype.findResidueAuth=function(e){var t=this.findChainAuth(e);if(t<0)return-1;var r=this.map.chain_index_auth_seq_id.get(t),n=Jz(e.auth_seq_id,e.pdbx_PDB_ins_code||"");return r.has(n)?r.get(n):-1},e.prototype.findResidueInsertion=function(e){var t=this.findChainLabel(e);if(t<0)return-1;var r=this.map.chain_index_label_seq_id.get(t),n=Jz(e.label_seq_id,e.pdbx_PDB_ins_code||"");if(r.has(n))return r.get(n);var i=PP.findPredecessorIndex(this.map.label_seq_id,e.label_seq_id),a=IU.chainStartResidueIndex(this.map.segments,t);if(i<a)return a;var o=IU.chainEndResidueIndexExcl(this.map.segments,t)-1;return i>=o?o:i},e.prototype.findAtom=function(e){var t=this.findResidue(e);return t<0?-1:void 0===e.label_alt_id?iG(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,e.label_atom_id):aG(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,this.map.label_alt_id,e.label_atom_id,e.label_alt_id)},e.prototype.findAtomAuth=function(e){var t=this.findResidueAuth(e);return t<0?-1:void 0===e.label_alt_id?iG(this.residueOffsets[t],this.residueOffsets[t+1],this.map.auth_atom_id,e.auth_atom_id):aG(this.residueOffsets[t],this.residueOffsets[t+1],this.map.auth_atom_id,this.map.label_alt_id,e.auth_atom_id,e.label_alt_id)},e.prototype.findAtomOnResidue=function(e,t,r){return void 0===r?iG(this.residueOffsets[e],this.residueOffsets[e+1],this.map.label_atom_id,t):aG(this.residueOffsets[e],this.residueOffsets[e+1],this.map.label_atom_id,this.map.label_alt_id,t,r)},e.prototype.findAtomsOnResidue=function(e,t){return function(e,t,r,n){for(var i=e;i<t;i++)if(n.has(r.value(i)))return i;return-1}(this.residueOffsets[e],this.residueOffsets[e+1],this.map.label_atom_id,t)},e.prototype.findElementOnResidue=function(e,t){return function(e,t,r,n){for(var i=e;i<t;i++)if(r.value(i)===n)return i;return-1}(this.residueOffsets[e],this.residueOffsets[e+1],this.map.type_symbol,t)},e}();function iG(e,t,r,n){for(var i=e;i<t;i++)if(r.value(i)===n)return i;return-1}function aG(e,t,r,n,i,a){for(var o=e;o<t;o++)if(r.value(o)===i&&n.value(o)===a)return o;return-1}function oG(e,t,r,n,i,a){var o=function(e,t,r,n,i,a){var o=function(e){if(0===e._rowCount)return{residues:[],chains:[]};for(var t=e._rowCount,r=[0],n=[0],i=e.label_entity_id,a=e.label_asym_id,o=e.label_seq_id,s=e.auth_seq_id,u=e.pdbx_PDB_ins_code,c=1;c<t;c++){var l=!i.areValuesEqual(c-1,c)||!a.areValuesEqual(c-1,c);(l||!o.areValuesEqual(c-1,c)||!s.areValuesEqual(c-1,c)||!u.areValuesEqual(c-1,c))&&(r[r.length]=c),l&&(n[n.length]=c)}return{residues:r,chains:n}}(e),s=function(e,t,r){var n=Sv.ofColumns(RU,{type_symbol:xv.ofArray({array:xv.mapToArray(e.type_symbol,kN),schema:xv.Schema.Aliased(xv.Schema.str)}),label_atom_id:e.label_atom_id,auth_atom_id:e.auth_atom_id,label_alt_id:e.label_alt_id,label_comp_id:e.label_comp_id,auth_comp_id:e.auth_comp_id,pdbx_formal_charge:e.pdbx_formal_charge}),i=Sv.view(e,BU,r.residues),a=Sv.view(e,NU,r.chains);if(!i.label_seq_id.isDefined){for(var o=new Int32Array(i.label_seq_id.rowCount),s=r.residues,u=r.chains,c=0,l=0,d=0,f=o.length;d<f;++d)s[d]>=u[c+1]&&(c+=1,l=0),o[d]=++l;i.label_seq_id=xv.ofIntArray(o)}return Sv.columnToArray(i,"label_seq_id",Int32Array),Sv.columnToArray(i,"auth_seq_id",Int32Array),{atoms:n,residues:i,chains:a,atomSourceIndex:t}}(e,t,o),u=function(e,t){var r=new Map;if(!qz.is(t))return r;var n=rA(Ez,t.data.frame).molstar_atom_site_operator_mapping;if(0===n._rowCount)return r;for(var i=new Map,a=new Map,o=0;o<n._rowCount;o++){var s=0===n.assembly_operator_id.valueKind(o)?{id:n.assembly_id.value(o),operList:[],operId:n.assembly_operator_id.value(o)}:void 0,u=AE.create(n.operator_name.value(o),Og.identity(),{assembly:s,spgrOp:0===n.symmetry_operator_index.valueKind(o)?n.symmetry_operator_index.value(o):void 0,hkl:Cg.ofArray(n.symmetry_hkl.value(o)),ncsId:n.ncs_i
139d.value(o)}),c=n.suffix.value(o),l=n.label_asym_id.value(o);i.set(`${l}${c}`,{name:l,operator:u});var d=n.auth_asym_id.value(o);a.set(`${d}${c}`,d)}var f=e.chains,h=f.label_asym_id,p=f.auth_asym_id,m=Array(h.rowCount),g=Array(h.rowCount);for(o=0;o<h.rowCount;o++)if(l=h.value(o),d=p.value(o),i.has(l)){var v=i.get(l),y=v.name;u=v.operator,r.set(o,u),m[o]=y,g[o]=a.get(d)||d}else m[o]=l,g[o]=d;return e.chains.label_asym_id=xv.ofArray({array:m,valueKind:e.chains.label_asym_id.valueKind,schema:e.chains.label_asym_id.schema}),e.chains.auth_asym_id=xv.ofArray({array:g,valueKind:e.chains.auth_asym_id.valueKind,schema:e.chains.auth_asym_id.schema}),r}(s,i);if(a&&function(e,t){return Sv.areEqual(e.chains,t.chains)&&Sv.areEqual(e.residues,t.residues)&&Sv.areEqual(e.atoms,t.atoms)}(a.atomicHierarchy,s))return{sameAsPrevious:!0,hierarchy:a.atomicHierarchy,chainOperatorMapping:u};var c={residueAtomSegments:fE.ofOffsets(o.residues,$T.ofBounds(0,e._rowCount)),chainAtomSegments:fE.ofOffsets(o.chains,$T.ofBounds(0,e._rowCount))},l=function(e,t,r){for(var n=function(e,t,r){return{entities:e,segments:r,label_seq_id:PP.ofSortedArray(t.residues.label_seq_id.toArray({array:Int32Array})),label_atom_id:t.atoms.label_atom_id,auth_atom_id:t.atoms.auth_atom_id,label_alt_id:t.atoms.label_alt_id,type_symbol:t.atoms.type_symbol,chain_index_entity_index:new Int32Array(t.chains._rowCount),entity_index_label_asym_id:new Map,chain_index_label_seq_id:new Map,auth_asym_id_auth_seq_id:new Map,chain_index_auth_seq_id:new Map,label_asym_id:new Map}}(t,e,r),i=e.residues,a=i.label_seq_id,o=i.auth_seq_id,s=i.pdbx_PDB_ins_code,u=e.chains,c=u.label_entity_id,l=u.label_asym_id,d=u.auth_asym_id,f=$T.ofBounds(0,e.atoms._rowCount),h=fE.transientSegments(r.chainAtomSegments,f);h.hasNext;){var p=h.move(),m=p.index,g=t.getEntityIndex(c.value(m));g<0&&tG(c.value(m)),n.chain_index_entity_index[m]=g;var v=d.value(m),y=n.auth_asym_id_auth_seq_id.get(v);y||(y=new Map,n.auth_asym_id_auth_seq_id.set(v,y));var b=l.value(m);n.label_asym_id.has(b)||n.label_asym_id.set(b,g),eG(n.entity_index_label_asym_id,g,b,m);var _=new Map,x=new Map;n.chain_index_label_seq_id.set(m,_),n.chain_index_auth_seq_id.set(m,x);for(var S=fE.transientSegments(r.residueAtomSegments,f,p);S.hasNext;){var w=S.move().index,A=o.value(w),C=s.value(w);_.set(Jz(a.value(w),C),w),x.set(Jz(A,C),w),y.set(A,m)}}return new nG(n)}(s,r,c),d=function(e,t,r,n){for(var i=e.atoms,a=i.label_comp_id,o=i.type_symbol,s=i._rowCount,u=e.residues._rowCount,c=t.residueAtomSegments.offsets,l=new Uint8Array(s),d=0;d<s;++d)l[d]=jU(o.value(d));var f=new Int32Array(u),h=new Int32Array(u),p=new Int32Array(u),m=new Uint8Array(u),g=new Uint8Array(u),v=new Map,y=new Map;for(d=0;d<u;++d){var b=a.value(c[d]),_=n,x=void 0,S=void 0;if(v.has(b))x=v.get(b),S=y.get(b);else{var w=void 0;_.has(b)?w=_.get(b).type:(iy||console.info("chemComp not found",b),w=dF(b)),S=lF(w,x=cF(w,b)),v.set(b,x),y.set(b,S)}m[d]=x,g[d]=S;var A=$$(S,"trace"),C=r.findAtomsOnResidue(d,A);if(-1===C){var T=$$(S,"coarseBackbone");-1===(C=r.findAtomsOnResidue(d,T))&&pF(x)&&(C=r.findElementOnResidue(d,kN("C")))}f[d]=C;var P=$$(S,"directionFrom");h[d]=r.findAtomsOnResidue(d,P);var E=$$(S,"directionTo");p[d]=r.findAtomsOnResidue(d,E)}return{atom:{atomicNumber:l},residue:{traceElementIndex:f,directionFromElementIndex:h,directionToElementIndex:p,moleculeType:m,polymerType:g}}}(s,c,l,n);return{sameAsPrevious:!1,hierarchy:Ac(Ac(Ac({},s),c),{index:l,derived:d}),chainOperatorMapping:u}}(e,t,r,n,i,a),s=o.sameAsPrevious,u=o.hierarchy,c=o.chainOperatorMapping;return{sameAsPrevious:s,hierarchy:u,conformation:function(e){return{id:Wd.create22(),atomId:e.id,occupancy:e.occupancy.isDefined?e.occupancy:xv.ofConst(1,e._rowCount,xv.Schema.float),B_iso_or_equiv:e.B_iso_or_equiv,xyzDefined:e.Cartn_x.isDefined&&e.Cartn_y.isDefined&&e.Cartn_z.isDefined,x:e.Cartn_x.toArray({array:Float32Array}),y:e.Cartn_y.toArray({array:Float32Array}),z:e.Cartn_z.toArray({array:Float32Array})}}(e),chainOperatorMapping:c}}var sG,uG={chainKey:[],entityKey:[],findSequenceKey:function(){return-1},findChainKey:function(){return-1},getEntityFromChain:function(){return-1},count:0,entity_id:xv.Undefined(0,xv.Schema.str),asym_id:xv.Undefined(0,xv.Schema.str),seq_id_begin:xv.Undefined(0,xv.Schema.int),seq_id_end:xv.Undefined(0,xv.Schema.int),chainElementSegments:fE.create([]),polymerRanges:G$.ofSortedRanges([]),gapRanges:G$.ofSortedRanges([])};function cG(e,t,r){if(e.has(t))return e.get(t);var n=r.index++;return e.set(t,n),n}function lG(e,t){if(e.has(t))return e.get(t);var r=new Map;return e.set(t,r),r}function dG(e){throw Error(`Missing entity entry for entity id '${e}'.`)}function fG(e,t){for(var r=e.entity_id,n=e.asym_id,i=e.seq_id_begin,a=e.seq_id_end,o=e.count,s=e.chainElementSegments,u=new Map,c=new Map,l={index:0},d=new Int32Array(o),f=new Int32Array(o),h=new Int32Array(s.count),p=0;p<o;p++)f[p]=t.getEntityIndex(r.value(p)),f[p]<0&&dG(r.value(p));for(var m=0;m<s.count;m++){var g=s.offsets[m],v=s.offsets[m+1],y=f[g];h[m]=y;var b=cG(lG(c,y),n.value(g),l);for(p=g;p<v;p++)d[p]=b;var _=[],x=[];for(p=g;p<v;p++){var S=i.value(p),w=a.value(p);_.push(p),x.push(S,w)}var A={elementIndices:_,seqRanges:G$.ofSortedRanges(x)};u.set(b,A)}var C=function(e,t,r){var n=e.getEntityIndex;return{findChainKey:function(e,r){var i=n(e);if(i<0)return-1;var a=t.get(i);return a.has(r)?a.get(r):-1},findSequenceKey:function(e,i,a){var o=n(e);if(o<0)return-1;var s=t.get(o);if(void 0===s)return-1;var u=s.get(i);if(void 0===u)return-1;var c=r.get(u),l=c.elementIndices,d=c.seqRanges,f=G$.firstIntersectionIndex(d,kP.ofSingleton(a));return-1===f?-1:l[f]}}}(t,c,u),T=C.findChainKey;return{chainKey:d,entityKey:f,findSequenceKey:C.findSequenceKey,findC
139hainKey:T,getEntityFromChain:function(e){return h[e]}}}function hG(e,t){for(var r=[],n=[],i=fE.transientSegments(e.chainElementSegments,$T.ofBounds(0,e.count)),a=e.seq_id_begin,o=e.seq_id_end;i.hasNext;)for(var s=i.move(),u=s.start,c=s.end,l=-1,d=-1,f=u;f<c;++f){var h=o.value(f);f===u?(l=f,d=o.value(f)):a.value(f)-d>1&&(r.push(l,f-1),n.push(f-1,f),l=f),f===c-1&&r.push(l,f),d=h}return{polymerRanges:G$.ofSortedRanges(r),gapRanges:G$.ofSortedRanges(n)}}!function(e){e.Empty={isDefined:!1,spheres:uG,gaussians:uG}}(sG||={});var pG={hierarchy:sG.Empty,conformation:void 0};function mG(e){var t=e.entity_id,r=e.seq_id_begin,n=e.seq_id_end,i=e.asym_id;return Ac({count:t.rowCount,entity_id:t,asym_id:i,seq_id_begin:r,seq_id_end:n},function(e){for(var t=[0],r=1,n=e.rowCount;r<n;r++)!e.areValuesEqual(r-1,r)&&(t[t.length]=r);return{chainElementSegments:fE.ofOffsets(t,$T.ofBounds(0,e.rowCount))}}(i))}function gG(e,t,r,n){if(!e.entity_poly_seq||!e.entity_poly_seq._rowCount)return HF.fromHierarchy(t,r,n);for(var i=e.entity_poly_seq,a=i.entity_id,o=i.num,s=i.mon_id,u={},c=[],l=a.rowCount,d=0;d<l;){for(var f=d;d<l-1&&a.areValuesEqual(d,d+1);)d++;d++;var h=a.value(f),p=xv.window(s,f,d),m=xv.window(o,f,d),g=t.getEntityIndex(h);u[g]={entityId:h,sequence:VF.ofResidueNames(p,m)},c.push(u[g])}return{byEntityKey:u,sequences:c}}function vG(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return i=qv(r,n-1),a=t.label_entity_id,o=t.label_asym_id,s=t.label_seq_id,u=_v(i,a.value),e.shouldUpdate?[4,e.update()]:[3,2];case 1:m.sent(),m.label=2;case 2:c=0,l=u.length-1,m.label=3;case 3:if(!(c<l))return[3,10];d=_v(i,o.value,{start:u[c],end:u[c+1]}),f=0,h=d.length-1,m.label=4;case 4:return f<h?(p=d[f],0===s.valueKind(p)?(_v(i,s.value,{sort:!0,start:p,end:d[f+1]}),e.shouldUpdate?[4,e.update()]:[3,6]):[3,6]):[3,7];case 5:m.sent(),m.label=6;case 6:return f++,[3,4];case 7:return e.shouldUpdate?[4,e.update()]:[3,9];case 8:m.sent(),m.label=9;case 9:return c++,[3,3];case 10:return function(e){for(var t=0,r=e.length;t<r;t++)if(e[t]!==t)return!1;return!0}(i)&&i.length===t._rowCount?[2,{atom_site:t,sourceIndex:xv.ofIntArray(i)}]:[2,{atom_site:Sv.view(t,t._schema,i),sourceIndex:xv.ofIntArray(i)}]}})})}function yG(e,t,r,n,i){var a=i.residue,o=a.polymerType,s=a.traceElementIndex,u=a.directionFromElementIndex,c=a.directionToElementIndex,l=o[e],d=o[t];if(0===l||0===d||-1===s[e]||-1===s[t])return!1;var f=n.findAtomsOnResidue(e,$$(l,"backboneStart")),h=n.findAtomsOnResidue(t,$$(d,"backboneEnd"));-1!==f&&-1!==h||(f=n.findAtomsOnResidue(e,$$(l,"coarseBackbone")),h=n.findAtomsOnResidue(t,$$(d,"coarseBackbone")));var p=r.x,m=r.y,g=r.z,v=Cg.create(p[f],m[f],g[f]),y=Cg.create(p[h],m[h],g[h]),b=-1===u[e]||-1===c[e]||-1===u[t]||-1===c[t];return Cg.distance(v,y)<(b?10:3)}function bG(e,t,r,n){for(var i,a,o,s,u=[],c=[],l=new Map,d=fE.transientSegments(e.chainAtomSegments,$T.ofBounds(0,e.atoms._rowCount)),f=fE.transientSegments(e.residueAtomSegments,$T.ofBounds(0,e.atoms._rowCount)),h=e.index,p=e.derived,m=e.residues.label_seq_id,g=e.chains.label_entity_id,v=p.residue,y=v.moleculeType,b=v.traceElementIndex;d.hasNext;){var _=d.move();f.setSegment(_),i=-1,a=-1,o=-1,s=-1;var x=t.getEntityIndex(g.value(_.index)),S=n.byEntityKey[x],w=S?S.sequence.seqId.value(S.sequence.seqId.rowCount-1):-1,A=e.residueAtomSegments.index[_.start],C=e.residueAtomSegments.index[_.end-1],T=m.value(A),P=m.value(C);for(1===T&&P===w&&r.xyzDefined&&yG(A,C,r,h,p)&&(l.set(A,C),l.set(C,A));f.hasNext;){var E=f.move(),M=E.index,k=m.value(M);if(pF(y[M])&&-1!==b[M])if(-1!==s)if(k!==i+1)u.push(s,o-1),c.push(a,E.end-1),s=E.start;else if(f.hasNext){var I=e.residueAtomSegments.index[E.start],D=e.residueAtomSegments.index[o-1];r.xyzDefined&&!yG(I,D,r,e.index,p)&&(u.push(s,o-1),c.push(a,E.end-1),s=E.start)}else u.push(s,E.end-1);else s=E.start;else-1!==s&&(u.push(s,o-1),s=-1);a=E.start,o=E.end,i=k}}return{polymerRanges:G$.ofSortedRanges(u),gapRanges:G$.ofSortedRanges(c),cyclicPolymerMap:l}}function _G(e){for(var t=new Map,r=function(e,t,r){return`${e}|${t}|${r}`},n=e.pdbx_unobs_or_zero_occ_residues,i=0,a=n._rowCount;i<a;++i){var o=r(n.PDB_model_num.value(i),n.label_asym_id.value(i),n.label_seq_id.value(i));t.set(o,{polymer_flag:n.polymer_flag.value(i),occupancy_flag:n.occupancy_flag.value(i)})}return{has:function(e,n,i){return t.has(r(e,n,i))},get:function(e,n,i){return t.get(r(e,n,i))},size:t.size}}function xG(e){var t=new Map;if(e.chem_comp._rowCount>0)for(var r=e.chem_comp.id,n=0,i=r.rowCount;n<i;++n)t.set(r.value(n),Sv.getRow(e.chem_comp,n));else wG(e).forEach(function(e){t.set(e,function(e){return{formula:"",formula_weight:0,id:e,name:e,mon_nstd_flag:uF.has(e)?"y":"n",pdbx_synonyms:[],type:dF(e)}}(e))});return t}function SG(e){var t=new Map;if(e.pdbx_chem_comp_identifier._rowCount>0)for(var r=e.pdbx_chem_comp_identifier,n=r.comp_id,i=r.type,a=r.identifier,o=0,s=n.rowCount;o<s;++o)if("SNFG CARBOHYDRATE SYMBOL"===i.value(o)||"SNFG CARB SYMBOL"===i.value(o)){var u=a.value(o),c=yN.get(u);c?t.set(n.value(o),c):console.warn(`Unknown SNFG name '${u}'`)}if(e.chem_comp._rowCount>0){var l=e.chem_comp,d=l.id;for(i=l.type,o=0,s=d.rowCount;o<s;++o){var f=d.value(o);if(!t.has(f)){var h=i.value(o);CN.has(f)?t.set(f,CN.get(f)):9===cF(h,f)&&t.set(f,gN)}}}else{var p=wG(e);CN.forEach(function(e,r){!t.has(r)&&p.has(r)&&t.set(r,e)})}return t}var wG=IF(function(e){for(var t=new Set,r=e.atom_site,n=r.label_comp_id,i=r.auth_comp_id,a=n.isDefined?n:i,o=0,s=a.rowCount;o<s;++o)t.add(a.value(o));return t});function AG(e,t){for(var r=new Map,n=e.chains,i=n.auth_asym_id,a=n.label_asym_id,o=n.label_entity_id,s=0,u=e.chains._rowCount;s<u;s++){var c=a.value(s);r.set(c,{id:c,auth_id:i.value(s),entity_id:o.value(s)})}if(t?.struct_asym._rowCount)for(var l=t.struct_asym,d=(c=l.id,l.entity_id),f=(s=0,c.rowCount);s<f;++s){var h=c.value(s);r.has(h)||r.set(h,{id:h,auth_id:"",entity_id:d.value(s)})}return r}var CG,TG=xv.Schema.Aliased(xv.Schema.Str());function PG(e){var t;if(e.entity.id.isDefined)t=e.entity;else{for(var r=new Set,n=[],i=[],a=e.atom_site,o=a.label_entity_id,s=a.label_comp_id,u=0,c=e.atom_site._rowCount;u<c;u++){var l=o.value(u);r.has(l)||(n.push(l),i.push(fF(s.value(u))),r.add(l))}var d=e.ihm_sphere_obj_site.entity_id;for(u=0,c=e.ihm_sphere_obj_site._rowCount;u<c;u++)l=d.value(u),r.has(l)||(n.push(l),i.push("polymer"),r.add(l));var f=e.ihm_gaussian_obj_site.entity_id;for(u=0,c=e.ihm_gaussian_obj_site._rowCount;u<c;u++)l=f.value(u),r.has(l)||(n.push(l),i.push("polymer"),r.add(l));
139t=Sv.ofPartialColumns(SF.entity,{id:xv.ofArray({array:n,schema:SF.entity.id}),type:xv.ofArray({array:i,schema:SF.entity.type})},n.length)}var h=xv.createIndexer(t.id),p=Array(t._rowCount);p.fill("other");var m=new Set,g=!1;if(e.entity_poly&&e.entity_poly.type.isDefined){var v=e.entity_poly,y=v.entity_id,b=v.type,_=v._rowCount;for(u=0;u<_;++u)p[h(l=y.value(u))]=b.value(u),m.add(l)}else g=!0;if(e.pdbx_entity_branch&&e.pdbx_entity_branch.entity_id.isDefined){var x=e.pdbx_entity_branch;for(y=x.entity_id,b=x.type,_=x._rowCount,u=0;u<_;++u)p[h(l=y.value(u))]=b.value(u),m.add(l)}else g=!0;if(m.size<p.length&&(g=!0),g){var S=new Map;if(e.chem_comp){var w=e.chem_comp,A=w.id;for(b=w.type,u=0,c=e.chem_comp._rowCount;u<c;u++)S.set(A.value(u),b.value(u))}if(e.atom_site){var C=e.atom_site;for(o=C.label_entity_id,s=C.label_comp_id,u=0,c=e.atom_site._rowCount;u<c;u++)if(l=o.value(u),!m.has(l)){var T=s.value(u),P=S.get(T)||"other";p[h(l)]=hF(T,P),m.add(l)}}}return{data:t,subtype:xv.ofArray({array:p,schema:TG}),getEntityIndex:h}}function EG(e,t,r){if(!e.pdbx_molecule||!e.pdbx_molecule.prd_id.isDefined)return t;var n=Array(t.data._rowCount);n.fill("");for(var i=e.pdbx_molecule,a=i.asym_id,o=i.prd_id,s=i._rowCount,u=0;u<s;++u){var c=a.value(u),l=r.get(c)?.entity_id;void 0!==l&&(n[t.getEntityIndex(l)]=o.value(u))}var d=xv.ofArray({array:n,schema:xv.Schema.str});return Ac(Ac({},t),{prd_id:d})}function MG(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return n=function(e){return{missingResidues:_G(e),chemicalComponentMap:xG(e),saccharideComponentMap:SG(e)}}(e),e.ihm_model_list._rowCount>0?[4,OG(r,e,n,t)]:[3,2];case 1:return a=s.sent(),[3,4];case 2:return[4,IG(r,e,n,t)];case 3:a=s.sent(),s.label=4;case 4:for(i=a,o=0;o<i.length;o++)Xz.TrajectoryInfo.set(i[o],{index:o,size:i.length});return[2,new Nz(i)]}})})}function kG(e,t){var r=e.rowCount;if(!e.isDefined)return r;for(var n=t+1;n<r&&e.areValuesEqual(t,n);)n++;return n}function IG(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:if(i=[],!t.atom_site)return[3,3];a=t.atom_site.id.rowCount,o=PG(t),s=0,h.label=1;case 1:return s<a?(u=kG(t.atom_site.pdbx_PDB_model_num,s),[4,vG(e,t.atom_site,s,u)]):[3,3];case 2:return c=h.sent(),l=c.atom_site,d=c.sourceIndex,f=function(e,t,r,n,i,a,o){var s=oG(t,r,n,i.chemicalComponentMap,a,o),u=t.pdbx_PDB_model_num.value(0);if(o&&s.sameAsPrevious)return Ac(Ac({},o),{id:Wd.create22(),modelNum:u,atomicConformation:s.conformation,_dynamicPropertyData:Object.create(null)});var c=pG,l=gG(e,n,s.hierarchy,c.hierarchy),d=bG(s.hierarchy,n,s.conformation,l),f=AG(s.hierarchy),h=0===e.entry.id.valueKind(0)?e.entry.id.value(0):a.name,p=[];return h&&p.push(h),0===e.struct.title.valueKind(0)&&p.push(e.struct.title.value(0)),{id:Wd.create22(),entryId:h,label:p.join(" | "),entry:h,sourceData:a,modelNum:u,parent:void 0,entities:EG(e,n,f),sequence:l,atomicHierarchy:s.hierarchy,atomicConformation:s.conformation,atomicRanges:d,atomicChainOperatorMappinng:s.chainOperatorMapping,coarseHierarchy:c.hierarchy,coarseConformation:c.conformation,properties:Ac(Ac({},i),{structAsymMap:f}),customProperties:new vR,_staticPropertyData:Object.create(null),_dynamicPropertyData:Object.create(null)}}(t,l,d,o,r,n,i.length>0?i[i.length-1]:void 0),i.push(f),s=u,[3,1];case 3:return[2,i]}})})}function DG(e,t){for(var r=new Map,n=e._rowCount,i=0;i<n;){var a=kG(t,i),o=t.value(i);r.set(o,{table:Sv.window(e,e._schema,i,a),start:i,end:a}),i=a}return r}function OG(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S;return Pc(this,function(w){switch(w.label){case 0:if(i=PG(t),a=t.atom_site.ihm_model_id.isDefined?t.atom_site.ihm_model_id:t.atom_site.pdbx_PDB_model_num,o=DG(t.atom_site,a),s=DG(t.ihm_sphere_obj_site,t.ihm_sphere_obj_site.model_id),u=DG(t.ihm_gaussian_obj_site,t.ihm_gaussian_obj_site.model_id),c=[],!t.ihm_model_list)return[3,6];l=t.ihm_model_list,d=l.model_id,f=l.model_name,h=0,w.label=1;case 1:return h<t.ihm_model_list._rowCount?(p=d.value(h),m=void 0,g=void 0,o.has(p)?(v=o.get(p),[4,vG(e,t.atom_site,v.start,v.end)]):[3,3]):[3,6];case 2:return y=w.sent(),b=y.atom_site,_=y.sourceIndex,m=b,g=_,[3,4];case 3:m=Sv.window(t.atom_site,t.atom_site._schema,0,0),g=xv.ofIntArray([]),w.label=4;case 4:x={model_id:p,model_name:f.value(h),model_group_name:bF(p,t),entities:i,atom_site:m,atom_site_sourceIndex:g,ihm_sphere_obj_site:s.has(p)?s.get(p).table:Sv.window(t.
139ihm_sphere_obj_site,t.ihm_sphere_obj_site._schema,0,0),ihm_gaussian_obj_site:u.has(p)?u.get(p).table:Sv.window(t.ihm_gaussian_obj_site,t.ihm_gaussian_obj_site._schema,0,0)},S=function(e,t,r,n){var i=oG(t.atom_site,t.atom_site_sourceIndex,t.entities,r.chemicalComponentMap,n),a=function(e){var t=e.ihm_sphere_obj_site,r=e.ihm_gaussian_obj_site;if(0===t._rowCount&&0===r._rowCount)return pG;var n=mG(t),i=function(e){return{x:e.Cartn_x.toArray({array:Float32Array}),y:e.Cartn_y.toArray({array:Float32Array}),z:e.Cartn_z.toArray({array:Float32Array}),radius:e.object_radius.toArray({array:Float32Array}),rmsf:e.rmsf.toArray({array:Float32Array})}}(t),a=fG(n,e.entities),o=hG(n),s=mG(r),u=function(e){for(var t=SF.ihm_gaussian_obj_site.covariance_matrix.space,r=[],n=e.covariance_matrix,i=0,a=n.rowCount;i<a;i++)r[i]=Tg.toMat3(Rg(),t,n.value(i));return{x:e.mean_Cartn_x.toArray({array:Float32Array}),y:e.mean_Cartn_y.toArray({array:Float32Array}),z:e.mean_Cartn_z.toArray({array:Float32Array}),weight:e.weight.toArray({array:Float32Array}),covariance_matrix:r}}(r),c=fG(s,e.entities),l=hG(s);return{hierarchy:{isDefined:!0,spheres:Ac(Ac(Ac({},n),a),o),gaussians:Ac(Ac(Ac({},s),c),l)},conformation:{id:Wd.create22(),spheres:i,gaussians:u}}}(t,r.chemicalComponentMap),o=gG(e,t.entities,i.hierarchy,a.hierarchy),s=bG(i.hierarchy,t.entities,i.conformation,o),u=0===e.entry.id.valueKind(0)?e.entry.id.value(0):n.name,c=[];u&&c.push(u),0===e.struct.title.valueKind(0)&&c.push(e.struct.title.value(0)),t.model_name&&c.push(t.model_name),t.model_group_name&&c.push(t.model_group_name);var l=AG(i.hierarchy,e);return{id:Wd.create22(),entryId:u,label:c.join(" | "),entry:u,sourceData:n,modelNum:t.model_id,parent:void 0,entities:EG(e,t.entities,l),sequence:o,atomicHierarchy:i.hierarchy,atomicConformation:i.conformation,atomicRanges:s,atomicChainOperatorMappinng:i.chainOperatorMapping,coarseHierarchy:a.hierarchy,coarseConformation:a.conformation,properties:Ac(Ac({},r),{structAsymMap:l}),customProperties:new vR,_staticPropertyData:Object.create(null),_dynamicPropertyData:Object.create(null)}}(t,x,r,n),c.push(S),w.label=5;case 5:return h++,[3,1];case 6:return[2,c]}})})}function RG(e){var t=this;return vy.create("Parse GRO",function(r){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:t=CG.fromGro(e),n=[],i=0,a=e.structures.length,u.label=1;case 1:return i<a?(o=function(e,t){for(var r=e.atomName,n=e.residueName,i=Array(e.count),a=Array(e.count),o=new Uint32Array(e.count),s=new Uint32Array(e.count),u=Array(e.count),c=new BF,l=new kF(e.residueNumber,e.atomName),d="",f=0,h="",p=0,m=0,g=-1,v=0,y=e.count;v<y;++v){var b=e.residueNumber.value(v);if(b!==g){var _=e.residueName.value(v),x=cF(l.add(_,v).type,_);x===m&&(b===g+1||99999===g&&0===b)||(h=RF(f),f+=1,p=0),d=c.getEntityId(_,x,h),p+=1,g=b,m=x}i[v]=d,a[v]=h,o[v]=p,s[v]=v,u[v]=ZB(e.atomName.value(v),e.residueName.value(v))}var S=xv.ofStringArray(a),w=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:S,auth_atom_id:r,auth_comp_id:n,auth_seq_id:e.residueNumber,Cartn_x:xv.ofFloatArray(xv.mapToArray(e.x,function(e){return 10*e},Float32Array)),Cartn_y:xv.ofFloatArray(xv.mapToArray(e.y,function(e){return 10*e},Float32Array)),Cartn_z:xv.ofFloatArray(xv.mapToArray(e.z,function(e){return 10*e},Float32Array)),id:xv.ofIntArray(s),label_asym_id:S,label_atom_id:r,label_comp_id:n,label_seq_id:xv.ofIntArray(o),label_entity_id:xv.ofStringArray(i),occupancy:xv.ofConst(1,e.count,xv.Schema.float),type_symbol:xv.ofStringArray(u),pdbx_PDB_model_num:xv.ofConst(t,e.count,xv.Schema.int)},e.count);return wF({entity:c.getEntityTable(),chem_comp:l.getChemCompTable(),atom_site:w})}(e.structures[i].atoms,i+1),[4,MG(o,t,r)]):[3,4];case 2:1===(s=u.sent()).frameCount&&n.push(s.representative),u.label=3;case 3:return++i,[3,1];case 4:return[2,new Nz(n)]}})})})}function BG(e,t){var r=function(e,r){return(t.substr(e,r)||"").trim()},n={entry_id:LS.ofString(e),length_a:LS.ofString(r(6,9)),length_b:LS.ofString(r(15,9)),length_c:LS.ofString(r(24,9)),angle_alpha:LS.ofString(r(33,7)),angle_beta:LS.ofString(r(40,7)),angle_gamma:LS.ofString(r(47,7)),Z_PDB:LS.ofString(r(66,4)),pdbx_unique_axis:LS.ofString("?")},i={entry_id:LS.ofString(e),"space_group_name_H-M":LS.ofString(r(55,11)),Int_Tables_number:LS.ofString("?"),cell_setting:LS.ofString("?"),space_group_name_Hall:LS.ofString("?")};return[dw.ofFields("cell",n),dw.ofFields("symmetry",i)]}function NG(e,t){return{id:e,details:t,groups:[]}}function FG(e,t,r){for(var n,i,a,o=[],s=1,u=1,c=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},l=t;l<r;l++){var d=c(l);if("BIOMOLECULE:"===d.substr(11,12)){var f=d.substr(23).trim(),h=`Biomolecule ${f}`;"APPLY THE FOLLOWING TO CHAINS:"!==(d=c(l+1)).substr(11,30)&&(l++,h=d.substr(11).trim()),n=NG(f,h),o.push(n)}else if("BIOMT"===d.substr(13,5)){var p=d.split(/\s+/);0==(N=parseInt(d[18])-1)&&(a=Og.identity(),i.operators.push({id:s++,matrix:a})),Og.setValue(a,N,0,parseFloat(p[4])),Og.setValue(a,N,1,parseFloat(p[5])),Og.setValue(a,N,2,parseFloat(p[6])),Og.setValue(a,N,3,parseFloat(p[7]))}else if("APPLY THE FOLLOWING TO CHAINS:"===d.substr(11,30)||"                   AND CHAINS:"===d.substr(11,30)){"APPLY"===d.substr(11,5)&&(i={chains:[],operators:[]},n.groups.push(i));for(var m=0,g=(v=d.substr(41,30).split(",")).length;m<g;++m)(y=v[m].trim())&&i.chains.push(y)}else if("APPLYING THE FOLLOWING TO CHAINS:"===d.substr(11,33)){var v;
139for(n=NG(`${u}`,`Biomolecule ${u}`),o.push(n),u+=1,i={chains:[],operators:[]},n.groups.push(i),m=0,g=(v=(d=c(++l)).substr(11,69).split(",")).length;m<g;++m){var y;(y=v[m].trim())&&i.chains.push(y)}}}if(0===o.length)return[];for(var b={id:LS.ofStrings(o.map(function(e){return e.id})),details:LS.ofStrings(o.map(function(e){return e.details}))},_=[],x=0,S=o;x<S.length;x++)for(var w=0,A=(k=S[x]).groups;w<A.length;w++){var C=A[w];_.push({assembly_id:k.id,oper_expression:C.operators.map(function(e){return e.id}).join(","),asym_id_list:C.chains.join(",")})}for(var T={assembly_id:LS.ofStrings(_.map(function(e){return e.assembly_id})),oper_expression:LS.ofStrings(_.map(function(e){return e.oper_expression})),asym_id_list:LS.ofStrings(_.map(function(e){return e.asym_id_list}))},P=[],E=0,M=o;E<M.length;E++)for(var k,I=0,D=(k=M[E]).groups;I<D.length;I++)for(var O=0,R=D[I].operators;O<R.length;O++){var B=R[O],N={id:""+B.id,type:"?",name:"?",symmetry_operation:"?"};for(l=0;l<3;l++){for(m=0;m<3;m++)N[`matrix[${l+1}][${m+1}]`]=""+Og.getValue(B.matrix,l,m);N[`vector[${l+1}]`]=""+Og.getValue(B.matrix,l,3)}P.push(N)}var F={id:LS.ofStrings(P.map(function(e){return e.id})),type:LS.ofStrings(P.map(function(e){return e.type})),name:LS.ofStrings(P.map(function(e){return e.name})),symmetry_operation:LS.ofStrings(P.map(function(e){return e.symmetry_operation}))},L=function(e){for(var t=function(t){var r=`matrix[${e+1}][${t+1}]`;F[r]=LS.ofStrings(P.map(function(e){return e[r]}))},r=0;r<3;r++)t(r);var n=`vector[${e+1}]`;F[n]=LS.ofStrings(P.map(function(e){return e[n]}))};for(l=0;l<3;l++)L(l);return[dw.ofFields("pdbx_struct_assembly",b),dw.ofFields("pdbx_struct_assembly_gen",T),dw.ofFields("pdbx_struct_oper_list",F)]}function LG(e,t,r){for(var n,i=[],a=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},o=t;o<r;o++){var s=a(o),u=s.split(/\s+/);0==(p=parseInt(s[5])-1)&&(n=Og.identity(),i.push(n)),Og.setValue(n,p,0,parseFloat(u[2])),Og.setValue(n,p,1,parseFloat(u[3])),Og.setValue(n,p,2,parseFloat(u[4])),Og.setValue(n,p,3,parseFloat(u[5]))}if(0===i.length)return[];for(var c=[],l=1,d=0,f=i;d<f.length;d++){var h=f[d],p={id:"ncsop"+l++,code:".",details:"."};for(o=0;o<3;o++){for(var m=0;m<3;m++)p[`matrix[${o+1}][${m+1}]`]=""+Og.getValue(h,o,m);p[`vector[${o+1}]`]=""+Og.getValue(h,o,3)}c.push(p)}var g={id:LS.ofStrings(c.map(function(e){return e.id})),code:LS.ofStrings(c.map(function(e){return e.code})),details:LS.ofStrings(c.map(function(e){return e.details}))},v=function(e){for(var t=function(t){var r=`matrix[${e+1}][${t+1}]`;g[r]=LS.ofStrings(c.map(function(e){return e[r]}))},r=0;r<3;r++)t(r);var n=`vector[${e+1}]`;g[n]=LS.ofStrings(c.map(function(e){return e[n]}))};for(o=0;o<3;o++)v(o);return[dw.ofFields("struct_ncs_oper",g)]}!function(e){e.is=function(e){return"gro"===e?.kind},e.fromGro=function(e){return{kind:"gro",name:e.structures[0].header.title,data:e}}}(CG||={});var $G={1:"helx_rh_al_p",2:"helx_rh_om_p",3:"helx_rh_pi_p",4:"helx_rh_ga_p",5:"helx_rh_3t_p",6:"helx_lh_al_p",7:"helx_lh_om_p",8:"helx_lh_ga_p",9:"helx_rh_27_p",10:"helx_rh_pp_p"};function UG(e,t,r){for(var n=[],i=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},a=t;a<r;a++){var o=i(a);n.push({serNum:o.substr(7,3).trim(),helixID:o.substr(11,3).trim(),initResName:o.substr(15,3).trim(),initChainID:o.substr(19,1).trim(),initSeqNum:o.substr(21,4).trim(),initICode:o.substr(25,1).trim(),endResName:o.substr(27,3).trim(),endChainID:o.substr(31,3).trim(),endSeqNum:o.substr(33,4).trim(),endICode:o.substr(37,1).trim(),helixClass:o.substr(38,2).trim(),comment:o.substr(40,30).trim(),length:o.substr(71,5).trim()})}var s=LS.ofStrings(n.map(function(e){return e.initChainID})),u=LS.ofStrings(n.map(function(e){return e.initResName})),c=LS.ofStrings(n.map(function(e){return e.endChainID})),l=LS.ofStrings(n.map(function(e){return e.endResName})),d={beg_label_asym_id:s,beg_label_comp_id:u,beg_label_seq_id:LS.ofUndefined(n.length,xv.Schema.int),beg_auth_asym_id:s,beg_auth_comp_id:u,beg_auth_seq_id:LS.ofStrings(n.map(function(e){return e.initSeqNum})),conf_type_id:LS.ofStrings(n.map(function(e){return function(e){return $G[e]||"helx_p"}(e.helixClass)})),details:LS.ofStrings(n.map(function(e){return e.comment})),end_label_asym_id:c,end_label_comp_id:l,end_label_seq_id:LS.ofUndef
139ined(n.length,xv.Schema.int),end_auth_asym_id:c,end_auth_comp_id:l,end_auth_seq_id:LS.ofStrings(n.map(function(e){return e.endSeqNum})),id:LS.ofStrings(n.map(function(e){return e.serNum})),pdbx_beg_PDB_ins_code:LS.ofStrings(n.map(function(e){return e.initICode})),pdbx_end_PDB_ins_code:LS.ofStrings(n.map(function(e){return e.endICode})),pdbx_PDB_helix_class:LS.ofStrings(n.map(function(e){return e.helixClass})),pdbx_PDB_helix_length:LS.ofStrings(n.map(function(e){return e.length})),pdbx_PDB_helix_id:LS.ofStrings(n.map(function(e){return e.helixID}))};return dw.ofFields("struct_conf",d)}function jG(e,t,r){for(var n=[],i=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},a=t;a<r;a++){var o=i(a);n.push({strand:o.substr(7,3).trim(),sheetID:o.substr(11,3).trim(),numStrands:o.substr(14,2).trim(),initResName:o.substr(17,3).trim(),initChainID:o.substr(21,1).trim(),initSeqNum:o.substr(22,4).trim(),initICode:o.substr(26,1).trim(),endResName:o.substr(28,3).trim(),endChainID:o.substr(32,1).trim(),endSeqNum:o.substr(33,4).trim(),endICode:o.substr(37,1).trim(),sense:o.substr(38,2).trim(),curAtom:o.substr(41,4).trim(),curResName:o.substr(45,3).trim(),curChainId:o.substr(49,1).trim(),curResSeq:o.substr(50,4).trim(),curICode:o.substr(54,1).trim(),prevAtom:o.substr(56,4).trim(),prevResName:o.substr(60,3).trim(),prevChainId:o.substr(64,1).trim(),prevResSeq:o.substr(65,4).trim(),prevICode:o.substr(69,1).trim()})}var s=LS.ofStrings(n.map(function(e){return e.initChainID})),u=LS.ofStrings(n.map(function(e){return e.initResName})),c=LS.ofStrings(n.map(function(e){return e.initSeqNum})),l=LS.ofStrings(n.map(function(e){return e.endChainID})),d=LS.ofStrings(n.map(function(e){return e.endResName})),f=LS.ofStrings(n.map(function(e){return e.endSeqNum})),h={beg_label_asym_id:s,beg_label_comp_id:u,beg_label_seq_id:c,beg_auth_asym_id:s,beg_auth_comp_id:u,beg_auth_seq_id:c,end_label_asym_id:l,end_label_comp_id:l,end_label_seq_id:f,end_auth_asym_id:l,end_auth_comp_id:d,end_auth_seq_id:f,id:LS.ofStrings(n.map(function(e){return e.strand})),sheet_id:LS.ofStrings(n.map(function(e){return e.sheetID})),pdbx_beg_PDB_ins_code:LS.ofStrings(n.map(function(e){return e.initICode})),pdbx_end_PDB_ins_code:LS.ofStrings(n.map(function(e){return e.endICode}))};return dw.ofFields("struct_sheet_range",h)}var zG,GG,VG,HG={MOL_ID:"",MOLECULE:"",CHAIN:"",FRAGMENT:"",SYNONYM:"",EC:"",ENGINEERED:"",MUTATION:"",OTHER_DETAILS:""};function qG(e,t,r){for(var n,i=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},a={chains:[],description:""},o=[],s=t;s<r;s++){var u=i(s).substr(10,70).trim(),c=u.indexOf(":"),l=u.substring(0,c),d=void 0;l in HG?(n=l,d=u.substring(c+2)):d=u,d=d.replace(/;$/,""),"MOL_ID"===n?(a={chains:[],description:""},o.push(a)):"MOLECULE"===n?(a.description&&(a.description+=" "),a.description+=d):"CHAIN"===n&&Array.prototype.push.apply(a.chains,d.split(/\s*,\s*/))}for(var f=[],h=0,p=o;h<p.length;h++)for(var m=p[h],g=0,v=m.chains;g<v.length;g++){var y=v[g];f.push({description:m.description,chains:[y]})}return f}function WG(e,t,r){for(var n=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},i=new Map,a=t;a<r;a++){var o=n(a),s=o.substr(11,3).trim(),u=o.substr(15).trim();i.has(s)?i.set(s,`${i.get(s)} ${u}`):i.set(s,u)}return i}function XG(e,t,r,n,i,a){var o=r.data,s=i-n;$S.addToken(e.group_PDB,fw.trim(r,n,n+6)),fw.trim(r,n+6,n+11),e.id[e.index]=r.data.substring(r.tokenStart,r.tokenEnd),$S.addToken(e.auth_atom_id,fw.trim(r,n+12,n+16)),32===o.charCodeAt(n+16)?$S.add(e.label_alt_id,0,0):$S.add(e.label_alt_id,n+16,n+17),$S.addToken(e.auth_comp_id,fw.trim(r,n+17,n+20)),$S.add(e.auth_asym_id,n+21,n+22),$S.addToken(e.auth_seq_id,fw.trim(r,n+22,n+26)),32===o.charCodeAt(n+26)?$S.add(e.pdbx_PDB_ins_code,0,0):$S.add(e.pdbx_PDB_ins_code,n+26,n+27),$S.addToken(e.Cartn_x,fw.trim(r,n+30,n+38)),$S.addToken(e.Cartn_y,fw.trim(r,n+38,n+46)),$S.addToken(e.Cartn_z,fw.trim(r,n+46,n+54)),$S.addToken(e.occupancy,fw.trim(r,n+54,n+60)),s>=66?$S.addToken(e.B_iso_or_equiv,fw.trim(r,n+60,n+66)):$S.add(e.B_iso_or_equiv,0,0),a&&$S.addToken(e.partial_charge,fw.trim(r,n+70,n+76)),s>=78&&!a?(fw.trim(r,n+76,n+78),r.tokenStart<r.tokenEnd?$S.addToken(e.type_symbol,r):WB(e.type_symbol,o,n+12,n+16)):WB(e.type_symbol,o,n+12,n+16),e.pdbx_PDB_model_num[e.index]=t,e.index++}function YG(e,t,r,n,i){var a=r.data,o=i-n;fw.trim(r,n+6,n+11),e.id[e.index]=a.substring(r.tokenStart,r.tokenEnd),$S.addToken(e.pdbx_auth_atom_id,fw.trim(r,n+12,n+16)),32===a.charCo
139deAt(n+16)?$S.add(e.pdbx_label_alt_id,0,0):$S.add(e.pdbx_label_alt_id,n+16,n+17),$S.addToken(e.pdbx_auth_comp_id,fw.trim(r,n+17,n+20)),$S.add(e.pdbx_auth_asym_id,n+21,n+22),$S.addToken(e.pdbx_auth_seq_id,fw.trim(r,n+22,n+26)),32===a.charCodeAt(n+26)?$S.add(e.pdbx_PDB_ins_code,0,0):$S.add(e.pdbx_PDB_ins_code,n+26,n+27),e["U[1][1]"][e.index]=Fv(a,n+28,n+35)/1e4,e["U[2][2]"][e.index]=Fv(a,n+35,n+42)/1e4,e["U[3][3]"][e.index]=Fv(a,n+42,n+49)/1e4,e["U[1][2]"][e.index]=Fv(a,n+49,n+56)/1e4,e["U[1][3]"][e.index]=Fv(a,n+56,n+63)/1e4,e["U[2][3]"][e.index]=Fv(a,n+63,n+70)/1e4,o>=78?(fw.trim(r,n+76,n+78),r.tokenStart<r.tokenEnd?$S.addToken(e.type_symbol,r):WB(e.type_symbol,a,n+12,n+16)):WB(e.type_symbol,a,n+12,n+16),e.index++}function KG(e,t,r,n){var i=e.substring(t,r);n.id_code=i.substring(62,66).trim()||void 0,n.dep_date=i.substring(50,59).trim()||void 0,n.classification=i.substring(10,50).trim()||void 0}function ZG(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B,N,F,L,$;return Pc(this,function(U){for(t=e.lines,r=t.data,n=t.indices,i=fw(r),a=!!e.isPdbqt,o=0,s=0,I=0,b=t.count;I<b;I++)switch(_=n[2*I],x=n[2*I+1],r[_]){case"A":Kg(r,_,x,"ATOM  ")?o++:Kg(r,_,x,"ANISOU")&&s++;break;case"H":Kg(r,_,x,"HETATM")&&o++}for(u={},c=function(e,t){var r=function(){return $S.create(e,2*t)};return{index:0,group_PDB:r(),id:[],auth_atom_id:r(),label_alt_id:r(),auth_comp_id:r(),auth_asym_id:r(),auth_seq_id:r(),pdbx_PDB_ins_code:r(),Cartn_x:r(),Cartn_y:r(),Cartn_z:r(),occupancy:r(),B_iso_or_equiv:r(),type_symbol:r(),pdbx_PDB_model_num:[],label_entity_id:[],partial_charge:r()}}(r,o),l=function(e,t){var r=function(){return new Float32Array(t)},n=function(){return $S.create(e,2*t)};return{index:0,count:t,id:[],type_symbol:n(),pdbx_label_atom_id:n(),pdbx_label_alt_id:n(),pdbx_label_comp_id:n(),pdbx_label_asym_id:n(),pdbx_label_seq_id:n(),pdbx_PDB_ins_code:n(),"U[1][1]":r(),"U[2][2]":r(),"U[3][3]":r(),"U[1][2]":r(),"U[1][3]":r(),"U[2][3]":r(),pdbx_auth_seq_id:n(),pdbx_auth_comp_id:n(),pdbx_auth_asym_id:n(),pdbx_auth_atom_id:n()}}(r,s),d=new BF,f=[],h=[],p=0,m="",g=void 0,v=!1,y=new Set,I=0,b=t.count;I<b;I++)switch(_=n[2*I],x=n[2*I+1],r[_]){case"A":Kg(r,_,x,"ATOM  ")?(p||(p++,m=""+p),XG(c,m,i,_,x,a)):Kg(r,_,x,"ANISOU")&&YG(l,0,i,_,x);break;case"C":if(Kg(r,_,x,"CRYST1"))f.push.apply(f,BG(e.id||"?",r.substring(_,x)));else if(Kg(r,_,x,"CONECT")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"CONECT");)S++;g?ay&&console.log("only single CONECT block allowed, ignoring others"):g=[I,S],I=S-1}else if(Kg(r,_,x,"COMPND")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"COMPND");)S++;d.setCompounds(qG(t,I,S)),I=S-1}break;case"H":if(Kg(r,_,x,"HEADER"))KG(r,_,x,u);else if(Kg(r,_,x,"HETATM"))p||(p++,m=""+p),XG(c,m,i,_,x,a);else if(Kg(r,_,x,"HELIX")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"HELIX");)S++;f.push(UG(t,I,S)),I=S-1}else if(Kg(r,_,x,"HETNAM")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"HETNAM");)S++;h.push.apply(h,Array.from(WG(t,I,S).entries())),I=S-1}break;case"M":if(Kg(r,_,x,"MODEL ")&&(p++,m=""+p),Kg(r,_,x,"MTRIX")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"MTRIX");)S++;f.push.apply(f,LG(t,I,S)),I=S-1}break;case"O":break;case"R":if(Kg(r,_,x,"REMARK 350")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"REMARK 350");)S++;f.push.apply(f,FG(t,I,S)),I=S-1,v=!0}break;case"S":if(Kg(r,_,x,"SHEET")){for(S=I+1;_=n[2*S],x=n[2*S+1],Kg(r,_,x,"SHEET");)S++;f.push(jG(t,I,S)),I=S-1}break;case"T":Kg(r,_,x,"TER")&&y.add(c.index)}for(u.id_code&&(w={id:LS.ofString(u.id_code)},f.push(dw.ofFields("entry",w))),u.classification&&(A={pdbx_keywords:LS.ofString(u.classification)},f.push(dw.ofFields("struct_keywords",A))),u.dep_date&&(C={recvd_initial_deposition_date:LS.ofString(u.dep_date)},f.push(dw.ofFields("pdbx_database_status",C))),T=xv.ofIntTokens(c.auth_seq_id),P=xv.ofStringTokens(c.auth_atom_id),E=xv.ofStringTokens(c.auth_comp_id),M=xv.ofStringTokens(c.auth_asym_id),(k=new kF(T,P)).setNames(h),d.setNames(h),I=0,D=E.rowCount;I<D;++I)O=E.value(I),R=cF(k.add(O,I).type,O),c.label_entity_id[I]=d.getEntityId(O,R,M.value(I));var j,z,G,V,H,q;for(B=function(e,t,r){for(var n=LS.ofStrings(e.pdbx_PDB_model_num),i=LS.ofTokens(e.auth_asym_id),a=LS.ofTokens(e.auth_seq_id),o=LS.ofTokens(e.pdbx_PDB_ins_code),s=LS.ofTokens(e.auth_atom_id),u=LS.ofTokens(e.auth_comp_id),c=LS.ofStrings(e.id),l=n.str(0),d=i.str(0),f=a.int(0),h=o.str(0),p=d,m=f,g=new Map,v=new Map,y=[],b=[],_=[],x=!1,S=0,w=c.rowCount;S<w;++S)if(""!==o.str(S)){x=!0;break}for(S=0,w=c.rowCount;S<w;++S){var A=n.str(S),C=i.str(S),T=a.int(S),P=o.str(S),E=s.str(S);if(A===l?d===C?f===T?h!==P&&(v.clear(),h=P,m+=1):(v.clear(),f===m?m=T:m+=1,f=T,h=P):(v.clear(),d=C,f=T,h=P,p=C,m=T):(g.clear(),v.clear(),l=A,d=C,f=T,h=P,p=C,m=T),g.has(C)){if(t.has(S)&&!r.hasA
139ssemblies){var M=g.get(C)+1;g.set(C,M),p=`${C}_${M}`}}else g.set(C,0);if(y[S]=p,v.has(E)){var k=v.get(E)+1;v.set(E,k),E=`${E}_${k}`}else v.set(E,0);b[S]=E,x&&(_[S]=m)}var I=xv.ofStringArray(y),D=xv.ofStringArray(b),O=x?LS.ofColumn(xv.ofIntArray(_)):LS.ofUndefined(e.index,xv.Schema.int);return{auth_asym_id:i,auth_atom_id:s,auth_comp_id:u,auth_seq_id:a,B_iso_or_equiv:LS.ofTokens(e.B_iso_or_equiv),Cartn_x:LS.ofTokens(e.Cartn_x),Cartn_y:LS.ofTokens(e.Cartn_y),Cartn_z:LS.ofTokens(e.Cartn_z),group_PDB:LS.ofTokens(e.group_PDB),id:c,label_alt_id:LS.ofTokens(e.label_alt_id),label_asym_id:LS.ofColumn(I),label_atom_id:LS.ofColumn(D),label_comp_id:u,label_seq_id:O,label_entity_id:LS.ofStrings(e.label_entity_id),occupancy:uw(e.occupancy)?LS.ofUndefined(e.index,xv.Schema.float):LS.ofTokens(e.occupancy),type_symbol:LS.ofTokens(e.type_symbol),pdbx_PDB_ins_code:LS.ofTokens(e.pdbx_PDB_ins_code),pdbx_PDB_model_num:n,partial_charge:LS.ofTokens(e.partial_charge)}}(c,y,{hasAssemblies:v}),a||delete B.partial_charge,g&&f.push(function(e,t,r,n){for(var i={},a=0,o=n.id.rowCount;a<o;++a)i[n.id.str(a)]=a;var s=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},u=[],c=[],l=[],d=[],f=[],h=[],p=[],m=[],g=[],v=[],y=[],b=[],_=[],x=[],S=[11,16,21,26],w=1;for(a=t;a<r;a++){var A=s(a),C=i[parseInt(A.substr(6,5))],T={};if(void 0!==C)for(var P=0;P<4;++P){var E=parseInt(A.substr(S[P],5));if(!Number.isNaN(E)){var M=i[E];void 0!==M&&(C>M||void 0===T[M]&&(u.push(`covale${w}`),c.push("covale"),l.push(n.label_asym_id.str(C)),d.push(n.label_seq_id.int(C)),f.push(n.auth_seq_id.int(C)),h.push(n.label_atom_id.str(C)),p.push(n.label_alt_id.str(C)),m.push(n.pdbx_PDB_ins_code.str(C)),g.push(n.label_asym_id.str(M)),v.push(n.label_seq_id.int(M)),y.push(n.auth_seq_id.int(M)),b.push(n.label_atom_id.str(M)),_.push(n.label_alt_id.str(M)),x.push(n.pdbx_PDB_ins_code.str(M)),w+=1))}}}var k={id:LS.ofStrings(u),conn_type_id:LS.ofStrings(c),ptnr1_label_asym_id:LS.ofStrings(l),ptnr1_label_seq_id:LS.ofNumbers(d),ptnr1_auth_seq_id:LS.ofNumbers(f),ptnr1_label_atom_id:LS.ofStrings(h),pdbx_ptnr1_label_alt_id:LS.ofStrings(p),pdbx_ptnr1_PDB_ins_code:LS.ofStrings(m),ptnr2_label_asym_id:LS.ofStrings(g),ptnr2_label_seq_id:LS.ofNumbers(v),ptnr2_auth_seq_id:LS.ofNumbers(y),ptnr2_label_atom_id:LS.ofStrings(b),pdbx_ptnr2_label_alt_id:LS.ofStrings(_),pdbx_ptnr2_PDB_ins_code:LS.ofStrings(x)};return dw.ofFields("struct_conn",k)}(t,g[0],g[1],B)),N={entity:dw.ofTable("entity",d.getEntityTable()),chem_comp:dw.ofTable("chem_comp",k.getChemCompTable()),atom_site:dw.ofFields("atom_site",B),atom_site_anisotrop:dw.ofFields("atom_site_anisotrop",(j=l,z=LS.ofTokens(j.pdbx_auth_seq_id),G=LS.ofTokens(j.pdbx_auth_comp_id),V=LS.ofTokens(j.pdbx_auth_asym_id),H=LS.ofTokens(j.pdbx_auth_atom_id),q={id:LS.ofStrings(j.id),type_symbol:LS.ofTokens(j.type_symbol),pdbx_label_atom_id:H,pdbx_label_alt_id:LS.ofTokens(j.pdbx_label_alt_id),pdbx_label_comp_id:G,pdbx_label_asym_id:V,pdbx_label_seq_id:z,pdbx_PDB_ins_code:LS.ofTokens(j.pdbx_PDB_ins_code),pdbx_auth_seq_id:z,pdbx_auth_comp_id:G,pdbx_auth_asym_id:V,pdbx_auth_atom_id:H},q["U[1][1]"]=LS.ofNumbers(j["U[1][1]"]),q["U[2][2]"]=LS.ofNumbers(j["U[2][2]"]),q["U[3][3]"]=LS.ofNumbers(j["U[3][3]"]),q["U[1][2]"]=LS.ofNumbers(j["U[1][2]"]),q["U[1][3]"]=LS.ofNumbers(j["U[1][3]"]),q["U[2][3]"]=LS.ofNumbers(j["U[2][3]"]),q))},F=0,L=f;F<L.length;F++)$=L[F],N[$.name]=$;return[2,{header:e.id||"PDB",categoryNames:Object.keys(N),categories:N}]})})}function QG(e){var t=this;return vy.create("Parse PDB",function(r){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return[4,r.update("Converting to mmCIF")];case 1:return f.sent(),[4,ZG(e)];case 2:return t=f.sent(),[4,MG(wF((n=qz.fromFrame(t,void 0,GG.create(e))).data.db,!0),n,r)];case 3:return i=f.sent(),(a=t.categories.atom_site?.getField("partial_charge"))&&1===i.frameCount&&(o=i.representative,s=o.atomicHierarchy.atomSourceIndex,u=xv.isIdentity(s),c=u?void 0:s.toArray({array:Int32Array}),l=a.toFloatArray(),d=c?xv.ofFloatArray(xv.mapToArray(s,function(e){return l[e]},Float32Array)):xv.ofFloatArray(l),zG.Provider.set(o,{data:d,type:"GASTEIGER"})),[2,i]}})})})}function JG(e){var t=this;return vy.create("Parse PSF",function(r){return Tc(t,void 0,void 0,function(){var t,r,n,i,a,o;return Pc(this,function(s){return t=VG.fromPsf(e),r=function(e){for(var t=Array(e.count),r=Array(e.count),n=new Uint32Array(e.count),i=new Uint32Array(e.count),a=Array(e.count),o=new BF,s=new kF(e.residueId,e.atomName),u="",c=0,l="",d=0,f=e.segmentName.value(0),h=!1,p=0,m=-1,g=0,v=e.count;g<v;++g){var y=e.residueId.value(g),b=e.segmentName.value(g);if(f===b?h=!1:(l=RF(c),c+=1,d=0,h=!0,f=b),h||y!==m){var _=e.residueName.value(g),x=cF(s.add(_,g).t
139ype,_);h||x===p&&y===m+1||(l=RF(c),c+=1,d=0),u=o.getEntityId(_,x,l),d+=1,m=y,p=x}t[g]=u,r[g]=l,n[g]=d,i[g]=g,a[g]=ZB(e.atomName.value(g),e.residueName.value(g))}var S=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:e.segmentName,auth_atom_id:e.atomName,auth_comp_id:e.residueName,auth_seq_id:e.residueId,id:xv.ofIntArray(i),label_asym_id:xv.ofStringArray(r),label_atom_id:e.atomName,label_comp_id:e.residueName,label_seq_id:xv.ofIntArray(n),label_entity_id:xv.ofStringArray(t),occupancy:xv.ofConst(1,e.count,xv.Schema.float),type_symbol:xv.ofStringArray(a),pdbx_PDB_model_num:xv.ofConst(1,e.count,xv.Schema.int)},e.count);return wF({entity:o.getEntityTable(),chem_comp:s.getChemCompTable(),atom_site:S})}(e.atoms),n=e.bonds,i=n.atomIdA,a=n.atomIdB,o={indexA:xv.ofLambda({value:function(e){return i.value(e)-1},rowCount:i.rowCount,schema:i.schema}),indexB:xv.ofLambda({value:function(e){return a.value(e)-1},rowCount:a.rowCount,schema:a.schema}),order:xv.ofConst(1,e.bonds.count,xv.Schema.int)},[2,zF.create(e.id,r,o,t)]})})})}function eV(e){return Object.keys(e).filter(function(e){return!isNaN(e)}).map(function(e){return+e}).sort(function(e,t){return e-t}).map(function(t){return e[t]})}function tV(e,t,r){return e&&void 0!==e[t]?e[t]:r}function rV(e){return{kind:"alias",aliases:[...arguments].slice(1),symbol:e}}function nV(e,t){var r=[...arguments].slice(2);return e.info.namespace="molscript-macro",e.id=`molscript-macro.${e.info.name}`,{kind:"macro",symbol:e,translate:t,aliases:kc([e.info.name],r,!0)}}function iV(e){return"alias"===e.kind||"macro"===e.kind}(function(e){e.Descriptor={name:"atom_partial_charge"},e.Provider=FF.create(e.Descriptor)})(zG||={}),function(e){e.is=function(e){return"pdb"===e?.kind},e.create=function(e){return{kind:"pdb",name:e.id||"",data:e}}}(GG||={}),function(e){e.is=function(e){return"psf"===e?.kind},e.fromPsf=function(e){return{kind:"psf",name:e.id,data:e}}}(VG||={});var aV=[["Core symbols",rV(xL.core.type.bool,"bool"),rV(xL.core.type.num,"num"),rV(xL.core.type.str,"str"),rV(xL.core.type.regex,"regex"),rV(xL.core.type.list,"list"),rV(xL.core.type.set,"set"),rV(xL.core.type.compositeKey,"composite-key"),rV(xL.core.logic.not,"not"),rV(xL.core.logic.and,"and"),rV(xL.core.logic.or,"or"),rV(xL.core.ctrl.if,"if"),rV(xL.core.ctrl.fn,"fn"),rV(xL.core.ctrl.eval,"eval"),rV(xL.core.math.add,"add","+"),rV(xL.core.math.sub,"sub","-"),rV(xL.core.math.mult,"mult","*"),rV(xL.core.math.div,"div","/"),rV(xL.core.math.pow,"pow","**"),rV(xL.core.math.mod,"mod"),rV(xL.core.math.min,"min"),rV(xL.core.math.max,"max"),rV(xL.core.math.cantorPairing,"cantor-pairing"),rV(xL.core.math.sortedCantorPairing,"sorted-cantor-pairing"),rV(xL.core.math.invertCantorPairing,"invert-cantor-pairing"),rV(xL.core.math.floor,"floor"),rV(xL.core.math.ceil,"ceil"),rV(xL.core.math.roundInt,"round"),rV(xL.core.math.trunc,"trunc"),rV(xL.core.math.abs,"abs"),rV(xL.core.math.sign,"sign"),rV(xL.core.math.sqrt,"sqrt"),rV(xL.core.math.cbrt,"cbrt"),rV(xL.core.math.sin,"sin"),rV(xL.core.math.cos,"cos"),rV(xL.core.math.tan,"tan"),rV(xL.core.math.asin,"asin"),rV(xL.core.math.acos,"acos"),rV(xL.core.math.atan,"atan"),rV(xL.core.math.sinh,"sinh"),rV(xL.core.math.cosh,"cosh"),rV(xL.core.math.tanh,"tanh"),rV(xL.core.math.exp,"exp"),rV(xL.core.math.log,"log"),rV(xL.core.math.log10,"log10"),rV(xL.core.math.atan2,"atan2"),rV(xL.core.rel.eq,"eq","="),rV(xL.core.rel.neq,"neq","!="),rV(xL.core.rel.lt,"lt","<"),rV(xL.core.rel.lte,"lte","<="),rV(xL.core.rel.gr,"gr",">"),rV(xL.core.rel.gre,"gre",">="),rV(xL.core.rel.inRange,"in-range"),rV(xL.core.str.concat,"concat"),rV(xL.core.str.match,"regex.match"),rV(xL.core.list.getAt,"list.get"),rV(xL.core.set.has,"set.has"),rV(xL.core.set.isSubset,"set.subset")],["Structure",["Types",rV(xL.structureQuery.type.entityType,"ent-type"),rV(xL.structureQuery.type.authResidueId,"auth-resid"),rV(xL.structureQuery.type.labelResidueId,"label-resid"),rV(xL.structureQuery.type.ringFingerprint,"ringfp"),rV(xL.structureQuery.type.bondFlags,"bond-flags")],["Slots",rV(xL.structureQuery.slot.elementSetReduce,"atom.set.reduce.value")],["Generators",rV(xL.structureQuery.generator.atomGroups,"sel.atom.atom-groups"),rV(xL.structureQuery.generator.queryInSelection,"sel.atom.query-in-selection"),rV(xL.structureQuery.generator.rings,"sel.atom.rings"),rV(xL.structureQuery.generator.empty,"sel.atom.empty"),rV(xL.structureQuery.generator.all,"sel.atom.all"),rV(xL.structureQuery.generator.bondedAtomicPairs,"sel.atom.bonded-pairs"),nV(iL("sel.atom.atoms",YF.Dictionary({0:nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to each atom."})}),vL.ElementSelection,"A selection of singleton atom sets."),function(e){return SL.struct.generator.atomGroups({"atom-test":tV(e,0,!0)})}),nV(iL("sel.atom.res",YF.Dictionary({0:nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each residue."})}),vL.ElementSelection,"A selection of atom sets grouped by residue."),function(e){return SL.struct.generator.atomGroups({"residue-test":tV(e,0,!0),"group-by":SL.ammp("residueKey")})}),nV(iL("sel.atom.chains",YF.Dictionary({0:nL(WF.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each chain."})}),vL.ElementSelection,"A selection of atom sets grouped by chain."),function(e){return SL.struct.generator.atomGroups({"chain-test":tV(e,0,!0),"group-by":SL.ammp("chainKey")})})],["Modifiers",rV(xL.structureQuery.modifier.queryEach,"sel.atom.query-each"),rV(xL.structureQuery.modifier.intersectBy,"sel.atom.intersect-by"),rV(xL.structureQuery.modifier.exceptBy,"sel.atom.except-by"),rV(xL.structureQuery.modifier.unionBy,"sel.atom.union-by"),rV(xL.structureQuery.modifier.union,"sel.atom.union"),rV(xL.structureQuery.modifier.cluster,"sel.atom.cluster"),rV(xL.structureQuery.modifier.includeSurroundings,"sel.atom.include-surroundings"),rV(xL.structureQuery.modifier.surroundingLigands,"sel.atom.surrounding-ligands"),rV(xL.structureQuery.modifier.includeConnected,"sel.atom.include-connected"),rV(xL.structureQuery.modifier.expandProperty,"sel.atom.expand-property")],["Filters",rV(xL.structureQuery.filter.pick,"sel.atom.pick"),rV(xL.structureQuery.filter.first,"sel.atom.first"),rV(xL.structureQuery.filter.withSameAtomProperties,"sel.atom.with-same-atom-properties"),rV(xL.structureQuery.filter.intersectedBy,"sel.atom.intersected-by"),rV(xL.structureQuery.filter.within,"sel.atom.within"),rV(xL.structureQuery.filter.isConnectedTo,"sel.atom.is-connected-to")],["Combinators",rV(xL.structureQuery.combinator.intersect,"sel.atom.intersect"),rV(xL.structureQuery.combinator.merge,"sel.atom.merge"),rV(xL.structureQuery.combinator.distanceCluster,"sel.atom.dist-cluster")],["Atom Set Properties",rV(xL.structureQuery.atomSet.atomCount,"atom.set.atom-count"),rV(xL.structureQuery.atomSet.countQuery,"atom.set.count-query"),rV(xL.structureQuery.atomSet.reduce,"atom.set.reduce"),rV(xL.structureQuery.atomSet.propertySet,"atom.set.property")],["Atom Properties",rV(xL.structureQuery.atomProperty.core.elementSymbol,"atom.el"),rV(xL.structureQuery.atomProperty.core.vdw,"atom.vdw"),rV(xL.structureQuery.atomProperty.core.mass,"atom.mass"),rV(xL.structureQuery.atomProperty.core.atomicNumber,"atom.atomic-number"),rV(xL.structureQuery.atomProperty.core.x,"atom.x"),rV(xL.structureQuery.atomProperty.core.y,"atom.y"),rV(xL.structureQuery.atomProperty.core.z,"atom.z"),rV(xL.structureQuery.atomProperty.core.sourceIndex,"atom.src-index"),rV(xL.structureQuery.atomProperty.core.operatorName,"atom.op-name"),rV(xL.structureQuery.atomProperty.core.operatorKey,"atom.op-key"),rV(xL.structureQuery.atomProperty.core.modelIndex,"atom.model-index"),rV(xL.structureQuery.atomProperty.core.modelLabel,"atom.model-label"),rV(xL.structureQuery.atomProperty.core.atomKey,"atom.key"),rV(xL.structureQuery.atomProperty.core.bondCount,"atom.bond-count"),rV(xL.structureQuery.atomProperty.topology.connectedComponentKey,"atom.key.molecule"),rV(xL.structureQuery.atomProperty.macromolecular.authResidueId,"atom.auth-resid"),rV(xL.structureQuery.atomProperty.macromolecular.labelResidueId,"atom.label-resid"),rV(xL.structureQuery.atomProperty.macromolecular.residueKey,"atom.key.res"),rV(xL.structureQuery.atomProperty.macromolecular.chainKey,"atom.key.chain"),rV(xL.structureQuery.atomProperty.macromolecular.entityKey,"atom.key.entity"),rV(xL.structureQuery.atomProperty.macromolecular.isHet,"atom.is-het"),rV(xL.structureQuery.atomProperty.macromolecular.id,"atom.id"),rV(xL.structureQuery.atomProperty.macromolecular.label_atom_id,"atom.label_atom_id"),rV(xL.structureQuery.atomProperty.macromolecular.label_alt_id,"atom.label_alt_id","atom.altloc"),rV(xL.structureQuery.atomProperty.macromolecular.label_comp_id,"atom.label_comp_id"),rV(xL.structureQuery.atomProperty.macromolecular.label_asym_id,"atom.label_asym_id"),rV(xL.structureQuery.atomProperty.macromolecular.label_entity_id,"atom.label_entity_id"),rV(xL.structureQuery.atomProperty.macromolecular.label_seq_id,"atom.label_seq_id"),rV(xL.structureQuery.atomProperty.macromolecular.auth_atom_id,"atom.auth_atom_id","atom.name"),rV(xL.structureQuery.atomProperty.macromolecular.auth_comp_id,"atom.auth_comp_id","atom.resname"),rV(xL.structureQuery.atomProperty.macromolecular.auth_asym_id,"atom.auth_asym_id","atom.chain"),rV(xL.structureQuery.atomProperty.macromolecular.auth_seq_id,"atom.auth_seq_id","atom.resno"),rV(xL.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,"atom.pdbx_PDB_ins_code","atom.inscode"),rV(xL.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,"atom.pdbx_formal_charge"),rV(xL.structureQuery.atomProperty.macromolecular.occupancy,"atom.occupancy"),rV(xL.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,"atom.B_iso_or_equiv","atom.bfactor"),rV(xL.structureQuery.atomProperty.macromolecular.entityType,"atom.entity-type"),rV(xL.structureQuery.atomProperty.macromolecular.entitySubtype,"atom.entity-subtype"),rV(xL.structureQuery.atomProperty.macromolecular.entityPrdId,"atom.entity-prd-id"),rV(xL.structureQuery.atomProperty.macromolecular.entityDescription,"atom.entity-description"),rV(xL.structureQuery.atomProperty.macromolecular.objectPrimitive,"atom.object-primitive"),rV(xL.structureQuery.atomProperty.macromolecular.chemCompType,"atom.chem-comp-type"),rV(xL.structureQuery.atomProperty.macromolecular.secondaryStructureKey,"atom.key.sec-struct"),rV(xL.structureQuery.atomProperty.macromolecular.isModified,"atom.is-modified"),rV(xL.structureQuery.atomProperty.macromolecular.modifiedParentName,"atom.modified-parent")],["Bond Properties",rV(xL.structureQuery.bondProperty.order,"bond.order"),rV(xL.structureQuery.bondProperty.length,"bond.length"),rV(xL.structureQuery.bondProperty.key,"bond.key"),rV(xL.structureQuery.bondProperty.atomA,"bond.atom-a"),rV(xL.structureQuery.bondProperty.atomB,"bond.atom-b"),nV(iL("bond.is",YF.List(vL.BondFlag),WF.Bool,`Test if the current bond has at least one (or all if partial = false) of the specified flags: ${WF.oneOfValues(vL.BondFlag).join(", ")}
139`),function(e){return SL.core.flags.hasAny([SL.struct.bondProperty.flags(),SL.struct.type.bondFlags(eV(e))])})]]],oV=[];!function e(t){for(var r=0,n=t;r<n.length;r++){var i=n[r];iV(i)?oV.push(i):i instanceof Array&&e(i)}}(aV);var sV=function(){for(var e=[],t=Object.create(null),r=gS.create(),n=gS.create(),i=0,a=oV;i<a.length;i++){for(var o=a[i],s=0,u=o.aliases;s<u.length;s++){var c=u[s];if(e.push([c,o]),t[c])throw Error(`Alias '${c}' already in use.`);t[c]=o}var l=o.symbol.args;if("dictionary"===l.kind)for(var d=0,f=Object.keys(l.map);d<f.length;d++){c=f[d],isNaN(c)&&gS.add(r,c,c);var h=l.map[c];"oneof"===h.type.kind&&WF.oneOfValues(h.type).forEach(function(e){return gS.add(n,e,e)})}else"oneof"===l.type.kind&&WF.oneOfValues(l.type).forEach(function(e){return gS.add(n,e,e)})}return{symbolList:e,symbolMap:t,namedArgs:r.array,constants:n.array}}().symbolMap;function uV(e){if(XF.isLiteral(e))return e;if(XF.isSymbol(e)){if(!sV[e.name])return e;var t=sV[e.name];if("alias"===t.kind)return XF.Symbol(sV[e.name].symbol.id);throw t.translate([])}var r=XF.isSymbol(e.head)&&!!sV[e.head.name]&&"macro"===sV[e.head.name].kind,n=r?e.head:uV(e.head),i=n!==e.head;if(!e.args)return r?uV(e.head):i?XF.Apply(n):e;var a,o=!1;if(XF.isArgumentsArray(e.args)){a=[];for(var s=0,u=e.args.length;s<u;s++)(d=e.args[s])!==(f=uV(d))&&(o=!0),a[a.length]=f;if(o||(a=e.args),!r&&!i&&!o)return e}else{a={};for(var c=0,l=Object.keys(e.args);c<l.length;c++){var d,f,h=l[c];(d=e.args[h])!==(f=uV(d))&&(o=!0),a[h]=f}if(!r&&!i&&!o)return e;o||(a=e.args)}if(r){var p=sV[e.head.name];return"macro"===p.kind?p.translate(a):XF.Apply(n,a)}return XF.Apply(n,a)}function cV(e){return uV(e)}var lV,dV=function(){function e(e){this._=e}return e.prototype.parse=function(t){var r=this.skip(e.eof)._(t,0);return r.status?{success:!0,value:r.value}:{success:!1,index:gV(t,r.furthest),expected:r.expected}},e.prototype.tryParse=function(e){var t=this.parse(e);if(t.success)return t.value;var r=function(e,t){return`expected ${function(e){return 1===e.length?e[0]:"one of "+e.join(", ")}(t.expected)}${function(e,t){var r=t.index,n=r.offset;if(n===e.length)return", got the end of the input";var i=n>0?"'...":"'",a=e.length-n>12?"...'":"'";return` at line ${r.line} column ${r.column}, got ${i}${e.slice(n,n+12)}${a}`}(e,t)}`}(e,t);throw Error(r)},e.prototype.or=function(t){return e.alt(this,t)},e.prototype.trim=function(e){return this.wrap(e,e)},e.prototype.wrap=function(t,r){return fV(1,"string"==typeof t?e.string(t):t,this,"string"==typeof r?e.string(r):r)},e.prototype.thru=function(e){return e(this)},e.prototype.then=function(e){return fV(1,this,e)},e.prototype.many=function(){var t=this;return new e(function(e,r){for(var n=[],i=void 0;;){if(!(i=mV(t._(e,r),i)).status)return mV(hV(r,n),i);if(r===i.index)throw Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");r=i.index,n.push(i.value)}})},e.prototype.times=function(t,r){var n=this,i=void 0===r?t:r;return new e(function(e,r){var a,o=[],s=void 0,u=void 0;for(a=0;a<t;a++){if(u=mV(s=n._(e,r),u),!s.status)return u;r=s.index,o.push(s.value)}for(;a<i&&(u=mV(s=n._(e,r),u),s.status);a+=1)r=s.index,o.push(s.value);return mV(hV(r,o),u)})},e.prototype.result=function(e){return this.map(function(){return e})},e.prototype.atMost=function(e){return this.times(0,e)},e.prototype.atLeast=function(t){return e.seq(this.times(t),this.many()).map(function(e){return kc(kc([],e[0],!0),e[1],!0)})},e.prototype.map=function(t){var r=this;return new e(function(e,n){var i=r._(e,n);return i.status?mV(hV(i.index,t(i.value)),i):i})},e.prototype.skip=function(e){return fV(0,this,e)},e.prototype.mark=function(){return e.seq(e.index,this,e.index).map(function(e){return{start:e[0],value:e[1],end:e[2]}})},e.prototype.node=function(t){return e.seq(e.index,this,e.index).map(function(e){return{name:t,start:e[0],value:e[1],end:e[2]}})},e.prototype.sepBy=function(t){return e.sepBy(this,t)},e.prototype.sepBy1=function(t){return e.sepBy1(this,t)},e.prototype.lookahead=function(t){return this.skip(e.lookahead(t))},e.prototype.notFollowedBy=function(t){return this.skip(e.notFollowedBy(t))},e.prototype.desc=function(t){var r=this;return new e(function(e,n){var i=r._(e,n);return i.status||(i.expected=[t]),i})},e.prototype.fallback=function(t){return this.or(e.succeed(t))},e.prototype.ap=function(t){return e.seq(t,this).map(function(e){return(0,e[0])(e[1])})},e.prototype.chain=function(t){var r=this;return new e(function(e,n){var i=r._(e,n);return i.status?mV(t(i.value)._(e,i.index),i):i})},e}();function fV(e){var t=[...arguments].slice(1),r=t.length;return new dV(function(n,i){for(var a,o,s=i,u=0;u<r;u++){if(!(a=mV(t[u]._(n,s),a)).status)return a;
139e===u&&(o=a.value),s=a.index}return mV(hV(s,o),a)})}function hV(e,t){return{status:!0,index:e,value:t}}function pV(e,t){return{status:!1,furthest:e,expected:[t]}}function mV(e,t){if(!t||e.status||t.status||e.furthest>t.furthest)return e;var r=e.furthest===t.furthest?function(e,t){var r=e.length,n=t.length;if(0===r)return t;if(0===n)return e;for(var i=new Set,a=[],o=0;o<r;o++)i.has(e[o])||(a[a.length]=e[o],i.add(e[o]));for(o=0;o<n;o++)i.has(t[o])||(a[a.length]=t[o],i.add(t[o]));return a.sort(),a}(e.expected,t.expected):t.expected;return{status:e.status,furthest:t.furthest,expected:r}}function gV(e,t){var r=e.slice(0,t).split("\n");return{offset:t,line:r.length,column:r[r.length-1].length+1}}(function(e){function t(){var t=[...arguments],r=t.length;return new e(function(e,n){for(var i,a=Array(r),o=n,s=0;s<r;s++){if(!(i=mV(t[s]._(e,o),i)).status)return i;a[s]=i.value,o=i.index}return mV(hV(o,a),i)})}function r(){var t=[...arguments];return 0===t.length?s("zero alternates"):new e(function(e,r){for(var n,i=0;i<t.length;i++)if((n=mV(t[i]._(e,r),n)).status)return n;return n})}function n(e,r){return t(e,r.then(e).many()).map(function(e){return kc([e[0]],e[1],!0)})}function i(t){var r=`'${t}'`;if(1===t.length){var n=t.charCodeAt(0);return new e(function(e,i){return e.charCodeAt(i)===n?hV(i+1,t):pV(i,r)})}return new e(function(e,n){var i=n+t.length;return e.slice(n,i)===t?hV(i,t):pV(n,r)})}function a(t,r){void 0===r&&(r=0);var n=function(e){return RegExp("^(?:"+e.source+")",function(e){var t=""+e;return t.slice(t.lastIndexOf("/")+1)}(e))}(t),i=""+t;return new e(function(e,t){var a=n.exec(e.slice(t));if(a){if(0<=r&&r<=a.length){var o=a[0],s=a[r];return hV(t+o.length,s)}return pV(t,`invalid match group (0 to ${a.length}) in ${i}`)}return pV(t,i)})}function o(t){return new e(function(e,r){return hV(r,t)})}function s(t){return new e(function(e,r){return pV(r,t)})}function u(t){return new e(function(e,r){var n=e.charAt(r);return r<e.length&&t(n)?hV(r+1,n):pV(r,"a character "+t)})}function c(t){var r=new e(function(e,n){var i=t()._;return r._=i,i(e,n)});return r}e.seqMap=function(e,r,n){var i=[].slice.call(arguments);if(0===i.length)throw Error("seqMap needs at least one argument");var a=i.pop();return function(e){if("function"!=typeof e)throw Error("not a function: "+e)}(a),t.apply(null,i).map(function(e){return a.apply(null,e)})},e.createLanguage=function(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++)(function(r){t[r]=c(function(){return e[r](t)})})(n[r]);return t},e.seq=t,e.alt=r,e.sepBy=function(e,t){return n(e,t).or(o([]))},e.sepBy1=n,e.string=i,e.regexp=a,e.succeed=o,e.fail=s,e.lookahead=function t(r){if(function(e){return e instanceof dV}(r))return new e(function(e,t){var n=r._(e,t);return n.status&&(n.index=t,n.value=null),n});if("string"==typeof r)return t(i(r));if(r instanceof RegExp)return t(a(r));throw Error("not a string, regexp, or parser: "+r)},e.notFollowedBy=function(t){return new e(function(e,r){var n=t._(e,r);return n.status?pV(r,'not "'+e.slice(r,n.index)+'"'):hV(r,null)})},e.test=u,e.oneOf=function(e){return u(function(t){return e.indexOf(t)>=0})},e.noneOf=function(e){return u(function(t){return e.indexOf(t)<0})},e.range=function(e,t){return u(function(r){return e<=r&&r<=t}).desc(e+"-"+t)},e.takeWhile=function(t){return new e(function(e,r){for(var n=r;n<e.length&&t(e.charAt(n));)n++;return hV(n,e.slice(r,n))})},e.lazy=c,e.empty=function(){return s("empty")},e.index=new e(function(e,t){return hV(t,gV(e,t))}),e.anyChar=new e(function(e,t){return t>=e.length?pV(t,"any character"):hV(t+1,e.charAt(t))}),e.all=new e(function(e,t){return hV(e.length,e.slice(t))}),e.eof=new e(function(e,t){return t<e.length?pV(t,"EOF"):hV(t,null)}),e.digit=a(/[0-9]/).desc("a digit"),e.digits=a(/[0-9]*/).desc("optional digits"),e.letter=a(/[a-z]/i).desc("a letter"),e.letters=a(/[a-z]*/i).desc("optional letters"),e.optWhitespace=a(/\s*/).desc("optional whitespace"),e.whitespace=a(/\s+/).desc("whitespace"),e.cr=i("\r"),e.lf=i("\n"),e.crlf=i("\r\n"),e.newline=r(e.crlf,e.lf,e.cr).desc("newline"),e.end=r(e.newline,e.eof),e.of=function(e){return o(e)},e.regex=function(e){return a(e)}})(dV||={}),function(e){var t;!function(e){e.str=function(e){return{kind:"string",value:e}}
139,e.symb=function(e){return{kind:"symbol",value:e}},e.list=function(e,t){return{kind:"list",bracket:e,nodes:t}},e.comment=function(e){return{kind:"comment",value:e}}}(t||={});var r=dV.regexp(/[\n\r\s]*/),n=dV.lazy(function(){return dV.alt(i,d,a,o).trim(r)}),i=dV.takeWhile(function(e){return"`"!==e}).trim("`").map(t.str),a=dV.regexp(/[^()\[\]{};`,\n\r\s]+/).map(t.symb),o=dV.regexp(/\s*;+([^\n\r]*)\n/,1).map(t.comment),s=n.many(),u=s.wrap("(",")").map(function(e){return t.list("(",e)}),c=s.wrap("[","]").map(function(e){return t.list("[",e)}),l=s.wrap("{","}").map(function(e){return t.list("{",e)}),d=dV.alt(u,c,l),f=n.many();function h(e){switch(e.kind){case"string":return e.value;case"symbol":var t=e.value;if(t.length>1)switch(t.charAt(0)){case".":return SL.atomName(t.substr(1));case"_":return SL.struct.type.elementSymbol([t.substr(1)])}return"true"===t||"false"!==t&&(function(e){return/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/.test(e)&&!isNaN(+e)}(t)?+t:XF.Symbol(t));case"list":switch(e.bracket){case"[":return SL.core.type.list(p(e.nodes).map(h));case"{":return SL.core.type.set(p(e.nodes).map(h));case"(":if("comment"===e.nodes[0].kind)throw Error("Invalid expression");var r=h(e.nodes[0]);return XF.Apply(r,function(e){if(!(e.length<=1)){if(!function(e){for(var t=1,r=e.length;t<r;t++){var n=e[t];if("symbol"===n.kind&&n.value.length>1&&":"===n.value.charAt(0))return!0}return!1}(e)){for(var t=[],r=1,n=e.length;r<n;r++)"comment"!==(s=e[r]).kind&&(t[t.length]=h(s));return t}var i={},a=!0,o=0;for(r=1,n=e.length;r<n;r++){var s;if("comment"!==(s=e[r]).kind)if("symbol"===s.kind&&s.value.length>1&&":"===s.value.charAt(0)){var u=s.value.substr(1);for(++r;r<n&&"comment"===e[r].kind;)r++;if(r>=n)throw Error(`There must be a value foolowed a named arg ':${u}'.`);if("comment"===e[r].kind)throw Error("Invalid expression");i[u]=h(e[r]),isNaN(+u)&&(a=!1)}else i[o++]=h(s)}
139if(a){var c=Object.keys(i).map(function(e){return+e}).sort(function(e,t){return e-t}),l=!0;for(r=0,n=c.length;r<n;r++)if(c[r]!==r){l=!1;break}if(l){var d=[];for(r=0,n=c.length;r<n;r++)d[r]=i[r];return d}}return i}}(e.nodes));default:Lg(e.bracket)}default:Lg()}}function p(e){for(var t=!1,r=0,n=e.length;r<n;r++)if("comment"===e[r].kind){t=!0;break}return t?e.filter(function(e){return"comment"!==e.kind}):e}e.parse=function(e){for(var t=function(e){return f.tryParse(e)}(e),r=[],n=0,i=t;n<i.length;n++){var a=i[n];"comment"!==a.kind&&(r[r.length]=h(a))}return r}}(lV||={});var vV=SL;function yV(e,t,r){var n=dV.lazy(function(){return dV.seq(e,n).map(function(e){return r.apply(void 0,e)}).or(t)});return n}function bV(e,t,r){return dV.seqMap(t,e.many(),function(e,t){return t.reduce(function(e,t){return r(t,e)},e)})}function _V(e,t,r){return dV.seqMap(t,dV.seq(e,t).many(),function(e,t){return t.reduce(function(e,t){var n=t[0],i=t[1];return r(n,e,i)},e)})}function xV(e,t){return e.reduce(function(e,t){var r=t.isUnsupported?TV(`operator '${t.name}' not supported`):t.map;return t.type(t.rule,e,r)},t)}function SV(e,t){return void 0===t&&(t=0),dV.optWhitespace.then(dV.regexp(e,t).skip(dV.optWhitespace))}function wV(e,t){return void 0===t&&(t=0),dV.regexp(e,t).skip(dV.optWhitespace)}function AV(e,t){return void 0===t&&(t=0),dV.optWhitespace.then(dV.regexp(e,t))}function CV(e,t){var r=t?`${e}|${Qg(t)}`:e;return SV(RegExp(`(${r})\\s+([-+]?[0-9]*\\.?[0-9]+)\\s+OF`,"i"),2).map(parseFloat)}function TV(e){return function(){throw Error(e)}}function PV(e){return 1===e.length?e[0]:e.length>1?vV.core.logic.and(e):void 0}function EV(e,t){if(!t||void 0===t.op||void 0===t.val)return t&&void 0!==t.flags?vV.core.flags.hasAny([e,t.flags]):t&&void 0!==t.min&&void 0!==t.max?vV.core.rel.inRange([e,t.min,t.max]):Array.isArray(t)?t.length>1?vV.core.set.has([vV.core.type.set(t),e]):vV.core.rel.eq([e,t[0]]):vV.core.rel.eq([e,t]);var r=[e,t.val];switch(t.op){case"=":return vV.core.rel.eq(r);case"!=":return vV.core.rel.neq(r);case">":return vV.core.rel.gr(r);case"<":return vV.core.rel.lt(r);case">=":return vV.core.rel.gre(r);case"<=":return vV.core.rel.lte(r);default:throw Error(`operator '${t.op}' not supported`)}}function MV(e){return vV.struct.generator.queryInSelection({0:e,query:vV.struct.generator.all(),"in-complement":!0})}function kV(e,t){return e.length<t.length?1:-1}function IV(e,t){var r=(t?[e].concat(t):[e]).sort(kV).map(Qg).join("|");return RegExp(`${r}`,"i")}function DV(e){var t=[];return Object.keys(e).sort(kV).forEach(function(r){var n=e[r],i=TV(`property '${r}' not supported`),a=dV.regexp(n.regex).map(function(e){return n.isUnsupported&&i(),EV(n.property,n.map(e))}),o=dV.regexp(IV(r,n.abbr)).trim(dV.optWhitespace),s=function(e){var t;return vV.struct.generator.atomGroups(((t={})[n.level]=e,t))};n.isNumeric?t.push(o.then(dV.seq(dV.regexp(/>=|<=|=|!=|>|</).trim(dV.optWhitespace),dV.regexp(n.regex).map(n.map))).map(function(e){return n.isUnsupported&&i(),EV(n.property,{op:e[0],val:e[1]})}).map(s)):t.push(o.then(a).map(s))}),t}function OV(e){var t=[];return Object.keys(e).sort(kV).forEach(function(r){var n=e[r],i=n.map?n.map:TV(`keyword '${r}' not supported`),a=dV.regexp(IV(r,n.abbr)).map(i);t.push(a)}),t}function RV(e,t){var r=[];return Object.keys(e).sort(kV).forEach(function(n){var i=e[n],a=TV(`property '${n}' not supported`),o=dV.regexp(IV(n,i.abbr)).lookahead(t).map(function(){return i.isUnsupported&&a(),i.property});r.push(o)}),r}function BV(e,t,r,n){var i=[];for(var a in e)i.push(a),e[a].abbr&&i.push.apply(i,e[a].abbr);for(var o in t)i.push(o),t[o].abbr&&i.push.apply(i,t[o].abbr);return r.forEach(function(e){i.push(e.name),e.abbr&&i.push.apply(i,e.abbr)}),i}function NV(e){return vV.core.type.set(e.map(vV.atomName))}function FV(e){return vV.struct.generator.queryInSelection({0:e,query:vV.struct.generator.all()})}function LV(e,t,r){switch(e.head.name){case"structure-query.atom-property.macromolecular.label_atom_id":return vV.atomName(t);case"structure-query.atom-property.core.element-symbol":return vV.es(t);case"structure-query.atom-property.macromolecular.secondary-structure-flags":return r&&(t=[r[t.toUpperCase()]||"none"]),vV.struct.type.secondaryStructureFlags([t]);default:return t}}var $V=["entityKey","label_entity_id","entityType"],UV=["chainKey","label_asym_id","label_entity_id","auth_asym_id","entityType"],jV=["residueKey","label_comp_id","label_seq_id","auth_comp_id","auth_seq_id","pdbx_formal_charge","secondaryStructureKey","secondaryStructureFlags","isModified","modifiedParentName"],zV=["structure-query.atom-property.macromolecular.secondary-structure-flags"];function GV(e){return vV.struct.generator.atomGroups({"residue-test":vV.core.set.has([vV.core.type.set(e),vV.ammp("label_comp_id")])})}var VV=SL,HV=/[-+]?[0-9]*\.?[0-9]+/,qV=/[0-9]+/;function WV(e){return e}var XV={none:"none",turn:"turn",sheet:"beta",helix:"helix",dna:"dna",rna:"rna",carbohydrate:"carbohydrate",helix310:"3-10",helixalpha:"alpha",helixpi:"pi",0:"none",1:"turn",2:"beta",3:"helix",4:"dna",5:"rna",6:"carbohydrate",7:"3-10",8:"alpha",9:"pi"};function YV(e){if(e.head){if(e.head.name&&"core.type.regex"===e.head.name&&(e=e.args[0].replace(/^\^|\$$/g,"")),e=XV[e.toString().toLowerCase()]||"none",-1!==["dna","rna","carbohydrate"].indexOf(e))throw Error("values 'dna', 'rna', 'carbohydrate' not yet supported for 'structure' property");return VV.struct.type.secondaryStructureFlags([e])}}var KV={adpmax:{"@desc":"the maximum anisotropic displacement parameter for the selected atom","@examples":[""],isUnsupported:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test"},adpmin:{"@desc":"the minimum anisotropic displacement parameter for the selected atom","@examples":[""],isUnsupported:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test"},altloc:{"@desc":"PDB alternate location identifier","@examples":["altloc = A"],regex:/[a-zA-Z0-9]/,map:WV,level:"atom-test",property:VV.ammp("label_alt_id")},altname:{"@desc":"an alternative name given to atoms by some file readers (for example, P2N)","@examples":[""],isUnsupported:!0,regex:/[a-zA-Z0-9]/,map:WV,level:"atom-test"},atomID:{"@desc":"special atom IDs for PDB atoms assigned by Jmol","@examples":[""],isUnsupported:!0,regex:qV,map:function(e){return parseInt(e)},level:"atom-test"},atomIndex:{"@desc":"atom 0-based index; a unique number for each atom regardless of the number of models loaded","@examples":[""],isUnsupported:!0,regex:qV,map:function(e){return parseInt(e)},level:"atom-test"},atomName:{"@desc":"atom name","@examples":["atomName = CA"],regex:/[a-zA-Z0-9]+/,map:function(e){return VV.atomName(e)},level:"atom-test",property:VV.ammp("label_atom_id")}
139,atomno:{"@desc":'sequential number; you can use "@" instead of "atomno=" -- for example, select @33 or Var x = @33 or @35',"@examples":[""],isUnsupported:!0,regex:qV,map:function(e){return parseInt(e)},level:"atom-test"},atomType:{"@desc":"atom type (mol2, AMBER files) or atom name (other file types)","@examples":["atomType = OH"],regex:/[a-zA-Z0-9]+/,map:function(e){return VV.atomName(e)},level:"atom-test",property:VV.ammp("label_atom_id")},atomX:{"@desc":"Cartesian X coordinate (or just X)","@examples":["x = 4.2"],abbr:["X"],isNumeric:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.acp("x")},atomY:{"@desc":"Cartesian Y coordinate (or just Y)","@examples":["y < 42"],abbr:["Y"],isNumeric:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.acp("y")},atomZ:{"@desc":"Cartesian Z coordinate (or just Z)","@examples":["Z > 10"],abbr:["Z"],isNumeric:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.acp("z")},bondcount:{"@desc":"covalent bond count","@examples":["bondcount = 0"],isNumeric:!0,regex:qV,map:function(e){return parseInt(e)},level:"atom-test",property:VV.acp("bondCount")},bondingRadius:{"@desc":"radius used for auto bonding; synonymous with ionic and ionicRadius","@examples":[""],abbr:["ionic","ionicRadius"],isUnsupported:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test"},cell:{"@desc":'crystallographic unit cell, expressed either in lattice integer notation (111-999) or as a coordinate in ijk space, where {1 1 1} is the same as 555. ANDing two cells, for example select cell=555 and cell=556, selects the atoms on the common face. (Note: in the specifc case of CELL, only "=" is allowed as a comparator.)',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},configuration:{"@desc":'Only in the context {configuration=n}, this option selects the set of atoms with either no ALTLOC specified or those atoms having this index into the array of altlocs within its model. So, for example, if the model has altloc "A" and "B", select configuration=1 is equivalent to select altloc="" or altloc="A", and print {configuration=2} is equivalent to print {altloc="" or altloc="B"}. Configuration 0 is "all atoms in a model having configurations", and an invalid configuration number gives no atoms. (Note: in the specifc case of CONFIGURATION, only "=" is allowed as a comparator.)',"@examples":[""],isUnsupported:!0,regex:qV,map:function(e){return parseInt(e)},level:"atom-test"},chain:{"@desc":'protein chain. For newer CIF files allowing multicharacter chain specifications, use quotations marks: select chain="AA". For these multicharacter desigations, case is not checked unless the CIF file has lower-case chain designations.',"@examples":["chain = A",'chain = "AA"'],regex:/[a-zA-Z0-9]+/,map:WV,level:"chain-test",property:VV.ammp("auth_asym_id")},chainNo:{"@desc":'chain number; sequentially counted from 1 for each model; chainNo == 0 means"no chain" or PDB chain identifier indicated as a blank (Jmol 14.0).',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},color:{"@desc":"the atom color","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},covalentRadius:{"@desc":"covalent bonding radius, synonymous with covalent. Not used by Jmol, but could be used, for example, in {*}.spacefill={*}.covalentRadius.all.","@examples":[""],abbr:["covalent"],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},cs:{"@desc":"chemical shift calculated using computational results that include magnetic shielding tensors.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},element:{"@desc":'element symbol. The value of this parameter depends upon the context. Used with select structure=x, x can be either the quoted element symbol, "H", "He", "Li", etc. or atomic number. In all other contexts, the value is the element symbol. When the atom is a specific isotope, the string will contain the isotope number -- "13C", for example.',"@examples":["element=Fe"],regex:/[a-zA-Z]+/,map:function(e){return VV.es(e)},level:"atom-test",property:VV.acp("elementSymbol")}
139,elemno:{"@desc":"atomic element number","@examples":["elemno=8"],regex:/[0-9\s{}-]+/,map:function(e){return parseInt(e)},level:"atom-test",property:VV.acp("atomicNumber")},eta:{"@desc":"Based on Carlos M. Duarte, Leven M. Wadley, and Anna Marie Pyle, RNA structure comparison, motif search and discovery using a reduced representation of RNA conformational space, Nucleic Acids Research, 2003, Vol. 31, No. 16 4755-4761. The parameter eta is the C4'[i-1]-P[i]-C4'[i]-P[i+1] dihedral angle; theta is the P[i]-C4'[i]-P[i+1]-C4'[i+1] dihedral angle. Both are measured on a 0-360 degree scale because they are commonly near 180 degrees. Using the commands plot PROPERTIES eta theta resno; select visible;wireframe only one can create these authors' \"RNA worm\" graph.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},theta:{"@desc":"Based on Carlos M. Duarte, Leven M. Wadley, and Anna Marie Pyle, RNA structure comparison, motif search and discovery using a reduced representation of RNA conformational space, Nucleic Acids Research, 2003, Vol. 31, No. 16 4755-4761. The parameter eta is the C4'[i-1]-P[i]-C4'[i]-P[i+1] dihedral angle; theta is the P[i]-C4'[i]-P[i+1]-C4'[i+1] dihedral angle. Both are measured on a 0-360 degree scale because they are commonly near 180 degrees. Using the commands plot PROPERTIES eta theta resno; select visible;wireframe only one can create these authors' \"RNA worm\" graph.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},file:{"@desc":"file number containing this atom","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},formalCharge:{"@desc":"formal charge","@examples":["formalCharge=1"],regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.ammp("pdbx_formal_charge")},format:{"@desc":"format (label) of the atom.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fXyz:{"@desc":"fractional XYZ coordinates","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fX:{"@desc":"fractional X coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fY:{"@desc":"fractional Y coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fZ:{"@desc":"fractional Z coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fuxyz:{"@desc":"fractional XYZ coordinates in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fux:{"@desc":"fractional X coordinate in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fuy:{"@desc":"fractional Y coordinate in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},fuz:{"@desc":"fractional Z coordinate in the unit cell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},group:{"@desc":"3-letter residue code","@examples":["group = ALA"],regex:/[a-zA-Z0-9]{1,3}/,map:WV,level:"residue-test",property:VV.ammp("label_comp_id")},group1:{"@desc":"single-letter residue code (amino acids only)","@examples":["group1 = G"],regex:/[a-zA-Z]/,map:WV,level:"residue-test",property:VV.ammp("label_comp_id")},groupID:{"@desc":"group ID number: A unique ID for each amino acid or nucleic acid residue in a PDB file. 0  noGroup 1-5  ALA, ARG, ASN, ASP, CYS 6-10  GLN, GLU, GLY, HIS, ILE 11-15  LEU, LYS, MET, PHE, PRO 16-20  SER, THR, TRP, TYR, VAL 21-23  ASX, GLX, UNK 24-29  A, +A, G, +G, I, +I 30-35  C, +C, T, +T, U, +U Additional unique numbers are assigned arbitrarily by Jmol and cannot be used reproducibly.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},groupindex:{"@desc":"overall group index","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},hydrophobicity:{"@desc":"Aminoacid residue scale of hydrophobicity based on Rose, G. D., Geselowitz, A. R., Lesser, G. J., Lee, R. H., and Zehfus, M. H. (1985). Hydrophobicity of amino acid residues in globular proteins, Science, 229(4716):834-838.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},identify:{"@desc":"for a PDB/mmCIF file, a label such as [ILE]7^1:A.CD1%A/3 #47, which includes the group ([ILE]), residue number with optional insertion code (7^1), chain (:A), atom name (CD1), alternate location if present (%A), PDB model number (/3, for NMR models when one file is loaded; /file.model such as /2.3 if more than one file is loaded), and atom number (#47). For non-PDB data, the information is shorter -- for example, H15/2.1 #6, indicating atom name (H15), full file.model number (/2.1), and atom number (#6). If only a single model is loaded, %[identify] does not include the model number.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},insertion:{"@desc":"protein residue insertion code","@examples":["insertion=A"],regex:/[a-zA-Z0-9]/,map:WV,level:"atom-test",property:VV.ammp("pdbx_PDB_ins_code")},label:{"@desc":"current atom label (same as format)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},mass:{"@desc":"atomic mass -- especially useful with appended .max or .sum","@examples":["mass > 13"],regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.acp("mass")},model:{"@desc":"model number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},modelindex:{"@desc":"a unique number for each model, starting with 0 and spanning all models in all files","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},modO:{"@desc":"currently calculated occupancy from modulation (0 to 100; NaN if atom has no occupancy modulation)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},modXYZ:{"@desc":"currently calculated displacement modulation (for incommensurately modulated structures). Also modX, modY, modZ for individual components. For atoms without modultion, {xx}
139.modXYZ is -1 and {xx}.modX is NaN, and in a label %[modXYZ] and %[modX] are blank.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},molecule:{"@desc":"molecule number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},monomer:{"@desc":"monomer number (group number) in a polymer (usually a chain), starting with 1, or 0 if not part of a biopolymer -- that is, not a connected carbohydrate, amino acid, or nucleic acid (Jmol 14.3.15)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},ms:{"@desc":"magnetic shielding calculated from file-loaded tensors.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},occupancy:{"@desc":'CIF file site occupancy. In SELECT command comparisons ("select occupancy < 90"), an integer n implies measurement on a 0-100 scale; also, in the context %[occupancy] or %q for a label, the reported number is a percentage. In all other cases, such as when %Q is used in a label or when a decimal number is used in a comparison, the scale is 0.0 - 1.0.',"@examples":["occupancy < 1"],regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.ammp("occupancy")},partialCharge:{"@desc":"partial charge","@examples":[""],isUnsupported:!0,regex:HV,map:function(e){return parseFloat(e)},level:"atom-test"},phi:{"@desc":"protein group PHI angle for atom's residue","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},polymer:{"@desc":"sequential polymer number in a model, starting with 1.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},polymerLength:{"@desc":"polymer length","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},property_xx:{"@desc":"a property created using the DATA command","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},psi:{"@desc":"protein group PSI angle for the atom's residue","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},radius:{"@desc":'currently displayed radius -- In SELECT command comparisons ("select radius=n"), integer n implies Rasmol units 1/250 Angstroms; in all other cases or when a decimal number is used, the units are Angstroms.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},resno:{"@desc":"PDB residue number, not including insertion code (see also seqcode, below)","@examples":["resno = 100"],regex:/-?[0-9]+/,map:function(e){return parseInt(e)},level:"residue-test",property:VV.ammp("auth_seq_id")},selected:{"@desc":"1.0 if atom is selected; 0.0 if not","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},sequence:{"@desc":'PDB one-character sequence code, as a string of characters, with "?" indicated where single-character codes are not available',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},seqcode:{"@desc":'PDB residue number, including insertion code (for example, 234^2; "seqcode" option added in Jmol 14.3.16)',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},seqid:{"@desc":"(mmCIF only) the value from _atom_site.label_seq_id; a pointer to _entity_poly_seq.num in the ENTITY_POLY_SEQ category specifying the sequence of monomers in a polymer. Allowance is made for the possibility of microheterogeneity in a sample by allowing a given sequence number to be correlated with more than one monomer id. (Jmol 14.2.3)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},shape:{"@desc":'hybridization geometry such as "tetrahedral"',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},site:{"@desc":"crystallographic site number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},spacefill:{"@desc":"currently displayed radius","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},straightness:{"@desc":'quaternion-derived straightness (second derivative of the quaternion describing the orientation of the residue. This quantity will have different values depending upon the setting of quaternionFrame as "A" (alpha-carbon/phosphorus atom only), "C" (alpha-carbon/pyrimidine or purine base based), "P" (carbonyl-carbon peptide plane/phosphorus tetrahedron based), or "N" (amide-nitrogen based). The default is alpha-carbon based, which corresponds closely to the following combination of Ramachandran angles involving three consecutive residues i-1, i, and i+1: -psii-1 - phii + psii + phii+1.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},strucno:{"@desc":"a unique number for each helix, sheet, or turn in a model, starting with 1.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},structure:{"@desc":'The value of this parameter depends upon the context. Used with select structure=x, x can be either the quoted keyword "none", "turn", "sheet", "helix", "dna", "rna", or "carbohydrate" or a respective number 0-6. In the context {*}.structure, the return value is a number; in the context label %[structure], the return is one of the six ke
139ywords.',"@examples":['structure="helix"',"structure=3"],regex:/none|turn|sheet|helix|dna|rna|carbohydrate|[0-6]/i,map:WV,level:"residue-test",property:"structure"},substructure:{"@desc":'like structure, the value of this parameter depends upon the context. Used with select substructure=x, x can be either the quoted keyword "none", "turn", "sheet", "helix", "dna", "rna", "carbohydrate", "helix310", "helixalpha", or "helixpi", or the respective number 0-9. In the context {*}.substructure, the return value is a number; in the context label %[substructure], the return is one of the nine keywords.',"@examples":['substructure = "alphahelix"',"substructure =9"],regex:/none|turn|sheet|helix|dna|rna|carbohydrate|helix310|helixalpha|helixpi|[0-9]/i,map:WV,level:"residue-test",property:"structure"},surfacedistance:{"@desc":"A value related to the distance of an atom to a nominal molecular surface. 0 indicates at the surface. Positive numbers are minimum distances in Angstroms from the given atom to the surface.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},symop:{"@desc":'the first symmetry operation code that generated this atom by Jmol; an integer starting with 1. See also symmetry, below. This operator is only present if the file contains space group information and the file was loaded using the {i, j, k} option so as to generate symmetry-based atoms. To select only the original atoms prior to application of symmetry, you can either use "SYMOP=n", where n is the symmetry operator corresponding to "x,y,z", or you can specify instead simply "NOT symmetry" the way you might specify "NOT hydrogen". Note that atoms in special positions will have multiple operator matches. These atoms can be selected using the keyword SPECIALPOSITION. The special form select SYMOP=nijk selects a specific translation of atoms from the given crystallographic symmetry operation. Comparators <, <=, >, >=, and != can be used and only apply to the ijk part of the designation. The ijk are relative, not absolute. Thus, symop=2555 selects for atoms that have been transformed by symop=2 but not subjected to any further translation. select symop=1555 is identical to select not symmetry. All other ijk are relative to these selections for 555. If the model was loaded using load "filename.cif" {444 666 1}, where the 1 indicates that all symmetry-generated atoms are to be packed within cell 555 and then translated to fill the other 26 specified cells, then select symop=3555 is nearly the same as select symop=3 and cell=555. (The difference being that cell=555 selects for all atoms that are on any edge of the cell, while symop=3555 does not.) However, the situation is different if instead the model was loaded using load "filename.cif" {444 666 0}, where the 0 indicates that symmetry-generated atoms are to be placed exactly where their symmetry operator would put them (x,-y,z being different then from x, 1-y, z). In that case, select symop=3555 is for all atoms that have been generated using symmetry operation 3 but have not had any additional translations applied to the x,y,z expression found in the CIF file. If, for example, symmetry operation 3 is -x,-y,-z, then load "filename.cif" {444 666 0} will place an atom originally at {1/2, 1/2, 1/2} at positions {-1/2, -1/2, -1/2} (symop=3555) and {-3/2, -3/2, -3/2} (symop=3444) and 24 other sites.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},symmetry:{"@desc":'as "symmetry" or in a label as lower-case "o" gives list of crystallographic symmetry operators generating this atom with lattice designations,such as 3555; upper-case "%O" in a label gives a list without the lattice designations. See also symop, above.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},temperature:{"@desc":"yes  yes  temperature factor (B-factor)","@examples":["temperature >= 20"],regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.ammp("B_iso_or_equiv")},unitXyz:{"@desc":"unit cell XYZ coordinates","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"}
139,uX:{"@desc":"unit cell X coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},uY:{"@desc":"unit cell Y coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},uZ:{"@desc":"unit cell Z coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},valence:{"@desc":"the valence of an atom (sum of bonds, where double bond counts as 2 and triple bond counts as 3","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},vanderwaals:{"@desc":"van der Waals radius","@examples":["vanderwaals >2"],regex:HV,map:function(e){return parseFloat(e)},level:"atom-test",property:VV.acp("vdw")},vectorScale:{"@desc":"vibration vector scale","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},volume:{"@desc":"approximate van der Waals volume for this atom. Note, {*}.volume gives an average; use {*}.volume.sum to get total volume.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},vXyz:{"@desc":"vibration vector, or individual components as %vx %vy %vz. For atoms without vibration vectors, {xx}.vXyz is -1; in a label, %[vxyz] is blank.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},vX:{"@desc":"vibration vector X coordinate; for atoms without vibration vector, {xx}.vX is NaN (same for vY and vZ)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},vY:{"@desc":"vibration vector Y coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},vZ:{"@desc":"vibration vector Z coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"},xyz:{"@desc":"Cartesian XYZ coordinates; select xyz > 1.0 selects atoms more than one Angstrom from the origin.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:WV,level:"atom-test"}},ZV=SL,QV=[{"@desc":"Selects atoms that are not included in s1.","@examples":["not ARG"],name:"not",type:yV,rule:dV.alt(dV.regex(/NOT/i).skip(dV.whitespace),dV.string("!").skip(dV.optWhitespace)),map:function(e,t){return MV(t)}},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["ASP and .CA"],name:"and",type:_V,rule:SV(/AND|&/i),map:function(e,t,r){return ZV.struct.modifier.intersectBy({0:t,by:r})}},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["ASP or GLU"],name:"or",type:_V,rule:SV(/OR|\||,/i),map:function(e,t,r){return ZV.struct.combinator.merge([t,r])}}],JV=SL,eH={acidic:["ASP","GLU"],aliphatic:["ALA","GLY","ILE","LEU","VAL"],amino:["ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","SER","THR","TRP","TYR","VAL","ASX","GLX","UNK"],aromatic:["HIS","PHE","TRP","TYR"],basic:["ARG","HIS","LYS"],buried:["ALA","CYS","ILE","LEU","MET","PHE","TRP","VAL"],cg:["CYT","C","GUA","G"],cyclic:["HIS","PHE","PRO","TRP","TYR"],hydrophobic:["ALA","GLY","ILE","LEU","MET","PHE","PRO","TRP","TYR","VAL"],large:["ARG","GLU","GLN","HIS","ILE","LEU","LYS","MET","PHE","TRP","TYR"],medium:["ASN","ASP","CYS","PRO","THR","VAL"],small:["ALA","GLY","SER"],nucleic:["G","C","A","T","U","I","DG","DC","DA","DT","DU","DI","+G","+C","+A","+T","+U","+I"]},tH=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*","C2'","C1'","O4'","O2'"],rH=["C","N","CA"];function nH(){return JV.struct.combinator.merge([JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.set.apply(JV,eH.nucleic),JV.ammp("label_comp_id")])}),JV.struct.filter.pick({0:JV.struct.generator.atomGroups({"group-by":JV.ammp("residueKey")}),test:JV.core.logic.and([JV.core.rel.eq([JV.struct.atomSet.atomCount(),1]),JV.core.rel.eq([JV.ammp("label_atom_id"),JV.atomName("P")])])}),JV.struct.filter.pick({0:JV.struct.generator.atomGroups({"group-by":JV.ammp("residueKey")}),test:JV.core.logic.or([JV.core.set.isSubset([NV(["C1'","C2'","O3'","C3'","C4'","C5'","O5'"]),JV.ammpSet("label_atom_id")]),JV.core.set.isSubset([NV(["C1*","C2*","O3*","C3*","C4*","C5*","O5*"]),JV.ammpSet("label_atom_id")])])})])}var iH={all:{"@desc":"all atoms; same as *",abbr:["*"],map:function(){return JV.struct.generator.all()}},bonded:{"@desc":"covalently bonded",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.rel.gr([JV.struct.atomProperty.core.bondCount({flags:JV.struct.type.bondFlags(["covalent","metallic","sulfide"])}),0])})}},clickable:{"@desc":"actually visible -- having some visible aspect such as wireframe, spacefill, or a label showing, or the alpha-carbon or phosphorus atom in a biomolecule that is rendered with only cartoon, rocket, or other biomolecule-specific shape."},connected:{"@desc":"bonded in any way, including hydrogen bonds",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.rel.gr([JV.struct.atomProperty.core.bondCount({flags:JV.struct.type.bondFlags()}),0])})}},displayed:{"@desc":"displayed using the display or hide command; not necessarily visible"}
139,hidden:{"@desc":"hidden using the display or hide command"},none:{"@desc":"no atoms",map:function(){return JV.struct.generator.empty()}},selected:{"@desc":"atoms that have been selected; defaults to all when a file is first loaded"},thisModel:{"@desc":'atoms in the current frame set, as defined by frame, model, or animation commands. If more than one model is in this set, "thisModel" refers to all of them, regardless of atom displayed/hidden status.'},visible:{"@desc":"visible in any way, including PDB residue atoms for which a cartoon or other such rendering makes their group visible, even if they themselves are not visible."},subset:{"@desc":"the currently defined subset. Note that if a subset is currently defined, then select/display all is the same as select/display subset, restrict none is the same as restrict not subset. In addition, select not subset selects nothing."},specialPosition:{"@desc":"atoms in crystal structures that are at special positions - that is, for which there is more than one operator that leads to them."},unitcell:{"@desc":"atoms within the current unitcell, which may be offset. This includes atoms on the faces and at the vertices of the unitcell."},polyhedra:{"@desc":"all central atoms for which polyhedra have been created. See also polyhera(n), below. (Jmol 14.4)"},nonmetal:{"@desc":"_H,_He,_B,_C,_N,_O,_F,_Ne,_Si,_P,_S,_Cl,_Ar,_As,_Se,_Br,_Kr,_Te,_I,_Xe,_At,_Rn",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.set.apply(JV,["H","He","B","C","N","O","F","Ne","Si","P","S","Cl","Ar","As","Se","Br","Kr","Te","I","Xe","At","Rn"].map(JV.es)),JV.acp("elementSymbol")])})}},metal:{"@desc":"!nonmetal",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.logic.not([JV.core.set.has([JV.set.apply(JV,["H","He","B","C","N","O","F","Ne","Si","P","S","Cl","Ar","As","Se","Br","Kr","Te","I","Xe","At","Rn"].map(JV.es)),JV.acp("elementSymbol")])])})}},alkaliMetal:{"@desc":"_Li,_Na,_K,_Rb,_Cs,_Fr",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.set.apply(JV,["Li","Na","K","Rb","Cs","Fr"].map(JV.es)),JV.acp("elementSymbol")])})}},alkalineEarth:{"@desc":"_Be,_Mg,_Ca,_Sr,_Ba,_Ra",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.set.apply(JV,["Be","Mg","Ca","Sr","Ba","Ra"].map(JV.es)),JV.acp("elementSymbol")])})}},nobleGas:{"@desc":"_He,_Ne,_Ar,_Kr,_Xe,_Rn",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.set.apply(JV,["He","Ne","Ar","Kr","Xe","Rn"].map(JV.es)),JV.acp("elementSymbol")])})}},metalloid:{"@desc":"_B,_Si,_Ge,_As,_Sb,_Te",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.set.apply(JV,["B","Si","Ge","As","Sb","Te"].map(JV.es)),JV.acp("elementSymbol")])})}},transitionMetal:{"@desc":"(includes La and Ac) elemno>=21 and elemno<=30, elemno=57, elemno=89, elemno>=39 and elemno<=48, elemno>=72 and elemno<=80, elemno>=104 and elemno<=112",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.logic.or([JV.core.rel.inRange([JV.acp("atomicNumber"),21,30]),JV.core.rel.inRange([JV.acp("atomicNumber"),39,48]),JV.core.rel.inRange([JV.acp("atomicNumber"),72,80]),JV.core.rel.inRange([JV.acp("atomicNumber"),104,112]),JV.core.set.has([JV.set(57,89),JV.acp("atomicNumber")])])})}},lanthanide:{"@desc":"(does not include La) elemno>57 and elemno<=71",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.rel.inRange([JV.acp("atomicNumber"),57,71])})}},actinide:{"@desc":"(does not include Ac) elemno>89 and elemno<=103",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.rel.inRange([JV.acp("atomicNumber"),89,103])})}},isaromatic:{"@desc":"atoms connected with the AROMATIC, AROMATICSINGLE, or AROMATICDOUBLE bond types",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.rel.gr([JV.struct.atomProperty.core.bondCount({flags:JV.struct.type.bondFlags(["aromatic"])}),0])})}},carbohydrate:{"@desc":""},ions:{"@desc":'(specifically the PDB designations "PO4" and "SO4")'},ligand:{"@desc":'(originally "hetero and not solvent"; changed to "!(protein,nucleic,water,UREA)" for Jmol 12.2)'},nucleic:{"@desc":'any group that (a) has one of the following group names: G, C, A, T, U, I, DG, DC, DA, DT, DU, DI, +G, +C, +A, +T, +U, +I; or (b) can be identified as a group that is only one atom, with name "P"; or (c) has all of the following atoms (prime, \', can replace * here): C1*, C2*, C3*, O3*, C4*, C5*, and O5*.',map:function(){return nH()}},purine:{"@desc":"any nucleic group that (a) has one of the following group names: A, G, I, DA, DG, DI, +A, +G, or +I; or (b) also has atoms N7, C8, and N9.",map:function(){return JV.struct.modifier.intersectBy({0:nH(),by:JV.struct.combinator.merge([JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.set.apply(JV,["A","G","I","DA","DG","DI","+A","+G","+I"]),JV.ammp("label_comp_id")])}),JV.struct.filter.pick({0:JV.struct.generator.atomGroups({"group-by":JV.ammp("residueKey")}),test:JV.core.set.isSubset([NV(["N7","C8","N9"]),JV.ammpSet("label_atom_id")])})])})}},pyrimidine:{"@desc":"any nucleic group that (a) has one of the following group names: C, T, U, DC, DT, DU, +C, +T, +U; or (b) also has atom O2.",map:function(){return JV.struct.modifier.intersectBy({0:nH(),by:JV.struct.combinator.merge([JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.set.apply(JV,["C","T","U","DC","DT","DU","+C","+T","+U"]),JV.ammp("label_comp_id")])}),JV.struct.filter.pick({0:JV.struct.generator.atomGroups({"group-by":JV.ammp("residueKey")}),test:JV.core.logic.or([JV.core.set.has([JV.ammpSet("label_atom_id"),JV.atomName("O2*")]),JV.core.set.has([JV.ammpSet("label_atom_id"),JV.atomName("O2'")])])})])})}},dna:{"@desc":"any nucleic group that (a) has one of the following group names: DG, DC, DA, DT, DU, DI, T, +G, +C, +A, +T; or (b) has neither atom O2* or O2'.",map:function(){return JV.struct.modifier.intersectBy({0:nH(),by:JV.struct.combinator.merge([JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.set.apply(JV,["DG","DC","DA","DT","DU","DI","T","+G","+C","+A","+T"]),JV.ammp("label_comp_id")])}),JV.struct.filter.pick({0:JV.struct.generator.atomGroups({"group-by":JV.ammp("residueKey")}),test:JV.core.logic.not([JV.core.logic.or([JV.core.set.has([JV.ammpSet("label_atom_id"),JV.atomName("O2*")]),JV.core.set.has([JV.ammpSet("label_atom_id"),JV.atomName("O2'")])])])})])})}}
139,rna:{"@desc":"any nucleic group that (a) has one of the following group names: G, C, A, U, I, +U, +I; or (b) has atom O2* or O2'.",map:function(){return JV.struct.modifier.intersectBy({0:nH(),by:JV.struct.combinator.merge([JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.set.apply(JV,["G","C","A","U","I","+U","+I"]),JV.ammp("label_comp_id")])}),JV.struct.filter.pick({0:JV.struct.generator.atomGroups({"group-by":JV.ammp("residueKey")}),test:JV.core.logic.or([JV.core.set.has([JV.ammpSet("label_atom_id"),JV.atomName("O2*")]),JV.core.set.has([JV.ammpSet("label_atom_id"),JV.atomName("O2'")])])})])})}},protein:{"@desc":'defined as a group that (a) has one of the following group names: ALA, ARG, ASN, ASP, CYS, GLN, GLU, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, ASX, GLX, or UNK; or (b) contains PDB atom designations [C, O, CA, and N] bonded correctly; or (c) does not contain "O" but contains [C, CA, and N] bonded correctly; or (d) has only one atom, which has name CA and does not have the group name 
139CA (indicating a calcium atom).',map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.set.apply(JV,eH.amino),JV.ammp("label_comp_id")])})}},acidic:{"@desc":"ASP GLU",map:function(){return GV(eH.acidic)}},acyclic:{"@desc":"amino and not cyclic",map:function(){return JV.struct.modifier.intersectBy({0:GV(eH.amino),by:MV(GV(eH.cyclic))})}},aliphatic:{"@desc":"ALA GLY ILE LEU VAL",map:function(){return GV(eH.aliphatic)}},amino:{"@desc":"all twenty standard amino acids, plus ASX, GLX, UNK",map:function(){return GV(eH.amino)}},aromatic:{"@desc":'HIS PHE TRP TYR (see also "isaromatic" for aromatic bonds)',map:function(){return GV(eH.aromatic)}},basic:{"@desc":"ARG HIS LYS",map:function(){return GV(eH.basic)}},buried:{"@desc":"ALA CYS ILE LEU MET PHE TRP VAL",map:function(){return GV(eH.buried)}},charged:{"@desc":"same as acidic or basic -- ASP GLU, ARG HIS LYS",map:function(){return GV(eH.acidic.concat(eH.basic))}},cyclic:{"@desc":"HIS PHE PRO TRP TYR",map:function(){return GV(eH.cyclic)}},helix:{"@desc":"secondary structure-related.",map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.flags.hasAny([JV.struct.type.secondaryStructureFlags(["helix"]),JV.ammp("secondaryStructureFlags")])})}},helixalpha:{"@desc":"secondary structure-related.",map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.flags.hasAny([JV.struct.type.secondaryStructureFlags(["alpha"]),JV.ammp("secondaryStructureFlags")])})}},helix310:{"@desc":"secondary structure-related.",map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.flags.hasAny([JV.struct.type.secondaryStructureFlags(["3-10"]),JV.ammp("secondaryStructureFlags")])})}},helixpi:{"@desc":"secondary structure-related.",map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.flags.hasAny([JV.struct.type.secondaryStructureFlags(["pi"]),JV.ammp("secondaryStructureFlags")])})}},hetero:{"@desc":"PDB atoms designated as HETATM",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.ammp("isHet")})}},hydrophobic:{"@desc":"ALA GLY ILE LEU MET PHE PRO TRP TYR VAL",map:function(){return GV(eH.hydrophobic)}},large:{"@desc":"ARG GLU GLN HIS ILE LEU LYS MET PHE TRP TYR",map:function(){return GV(eH.large)}},medium:{"@desc":"ASN ASP CYS PRO THR VAL",map:function(){return GV(eH.medium)}},negative:{"@desc":"same as acidic -- ASP GLU",map:function(){return GV(eH.acidic)}},neutral:{"@desc":"amino and not (acidic or basic)",map:function(){return JV.struct.modifier.intersectBy({0:GV(eH.amino),by:MV(GV(eH.acidic.concat(eH.basic)))})}},polar:{"@desc":"amino and not hydrophobic",map:function(){return JV.struct.modifier.intersectBy({0:GV(eH.amino),by:MV(GV(eH.hydrophobic))})}},positive:{"@desc":"same as basic -- ARG HIS LYS",map:function(){return GV(eH.basic)}},sheet:{"@desc":"secondary structure-related",map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.flags.hasAny([JV.struct.type.secondaryStructureFlags(["sheet"]),JV.ammp("secondaryStructureFlags")])})}},small:{"@desc":"ALA GLY SER",map:function(){return GV(eH.small)}},surface:{"@desc":"amino and not buried",map:function(){return JV.struct.modifier.intersectBy({0:GV(eH.amino),by:MV(GV(eH.buried))})}},turn:{"@desc":"secondary structure-related",map:function(){return JV.struct.generator.atomGroups({"residue-test":JV.core.flags.hasAny([JV.struct.type.secondaryStructureFlags(["turn"]),JV.ammp("secondaryStructureFlags")])})}},alpha:{"@desc":"(*.CA)",map:function(){return JV.struct.generator.atomGroups({"atom-test":JV.core.rel.eq([JV.atomName("CA"),JV.ammp("label_atom_id")])})}},base:{"@desc":"(nucleic bases)"},backbone:{"@desc":"(*.C, *.CA, *.N, and all nucleic other than the bases themselves)",abbr:["mainchain"],map:function(){return JV.struct.combinator.merge([JV.struct.modifier.intersectBy({0:JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.core.type.set(eH.amino),JV.ammp("label_comp_id")])}),by:JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.core.type.set(rH),JV.ammp("label_atom_id")])})}),JV.struct.modifier.intersectBy({0:JV.struct.generator.atomGroups({"residue-test":JV.core.set.has([JV.core.type.set(eH.nucleic),JV.ammp("label_comp_id")])}),by:JV.struct.generator.atomGroups({"atom-test":JV.core.set.has([JV.core.type.set(tH),JV.ammp("label_atom_id")])})})])}},sidechain:{"@desc":"((protein or nucleic) and not backbone)"},spine:{"@desc":"(*.CA, *.N, *.C for proteins; *.P, *.O3', *.O5', *.C3', *.C4', *.C5 for nucleic acids)"},leadatom:{"@desc":"(*.CA, *.P, and terminal *.O5')"},solvent:{"@desc":'PDB "HOH", water, also the connected set of H-O-H in any model'}},aH=SL,oH=[{"@desc":"value comparisons","@examples":[],name:"=",abbr:["=="],type:_V,rule:dV.regexp(/\s*(LIKE|>=|<=|=|!=|>|<)\s*/i,1),map:function(e,t,r){var n;
139if("structure"===t?n=aH.core.flags.hasAny([aH.ammp("secondaryStructureFlags"),YV(r)]):"structure"===r?n=aH.core.flags.hasAny([aH.ammp("secondaryStructureFlags"),YV(t)]):void 0===t.head?void 0===r.head?"LIKE"===e.toUpperCase()&&(n=t.head?aH.core.str.match([aH.core.type.regex([`^${r}$`,"i"]),aH.core.type.str([t])]):aH.core.str.match([aH.core.type.regex([`^${t}$`,"i"]),aH.core.type.str([r])])):"core.type.regex"===r.head.name&&(n=aH.core.str.match([r,aH.core.type.str([t])])):"core.type.regex"===t.head.name&&(n=aH.core.str.match([t,aH.core.type.str([r])])),!n)switch(t.head&&(r=LV(t,r)),r.head&&(t=LV(r,t)),e){case"=":n=aH.core.rel.eq([t,r]);break;case"!=":n=aH.core.rel.neq([t,r]);break;case">":n=aH.core.rel.gr([t,r]);break;case"<":n=aH.core.rel.lt([t,r]);break;case">=":n=aH.core.rel.gre([t,r]);break;case"<=":n=aH.core.rel.lte([t,r]);break;default:throw Error(`value operator '${e}' not supported`)}return aH.struct.generator.atomGroups({"atom-test":n})}}];function sH(e){var t=e[1],r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c={};o&&(c["chain-test"]=aH.core.rel.eq([aH.ammp("auth_asym_id"),o]));var l=[];r&&l.push(aH.core.rel.eq([aH.ammp("label_comp_id"),r])),n&&l.push(aH.core.logic.and([aH.core.rel.gre([aH.ammp("auth_seq_id"),n[0]]),aH.core.rel.lte([aH.ammp("auth_seq_id"),n[1]])])),i&&l.push(aH.core.rel.eq([aH.ammp("auth_seq_id"),i])),a&&l.push(aH.core.rel.eq([aH.ammp("pdbx_PDB_ins_code"),a])),l.length&&(c["residue-test"]=PV(l));var d=[];return s&&d.push(aH.core.rel.eq([aH.ammp("auth_atom_id"),s])),u&&d.push(aH.core.rel.eq([aH.ammp("label_alt_id"),u])),d.length&&(c["atom-test"]=PV(d)),aH.struct.generator.atomGroups(c)}var uH=dV.createLanguage({Integer:function(){return dV.regexp(/-?[0-9]+/).map(Number).desc("integer")},Parens:function(e){return dV.alt(e.Parens,e.Operator,e.Expression).wrap(dV.regexp(/\(\s*/),dV.regexp(/\s*\)/))},Expression:function(e){return dV.alt(e.Keywords,e.AtomExpression.map(sH),e.Within.map(function(e){return aH.struct.modifier.includeSurroundings({0:e[1],radius:e[0]})}),e.ValueQuery,e.Element.map(function(e){return aH.struct.generator.atomGroups({"atom-test":aH.core.rel.eq([aH.acp("elementSymbol"),aH.struct.type.elementSymbol(e)])})}),e.Resname.map(function(e){return aH.struct.generator.atomGroups({"residue-test":aH.core.rel.eq([aH.ammp("label_comp_id"),e])})}))},Operator:function(e){return xV(QV,dV.alt(e.Parens,e.Expression))},AtomExpression:function(e){return dV.seq(dV.lookahead(e.AtomPrefix),dV.seq(e.BracketedResname.or(dV.of(null)),e.ResnoRange.or(dV.of(null)),e.Resno.or(dV.of(null)),e.Inscode.or(dV.of(null)),e.Chainname.or(dV.of(null)),e.Atomname.or(dV.of(null)),e.Altloc.or(dV.of(null)),e.Model.or(dV.of(null)))).desc("expression")},AtomPrefix:function(){return dV.regexp(/[\[0-9:^%/.-]/).desc("atom-prefix")},Chainname:function(){return dV.regexp(/:([A-Za-z]{1,3})/,1).desc("chainname")},Model:function(){return dV.regexp(/\/([0-9]+)/,1).map(Number).desc("model")},Element:function(){return dV.regexp(/_([A-Za-z]{1,3})/,1).desc("element")},Atomname:function(){return dV.regexp(/\.([a-zA-Z0-9]{1,4})/,1).map(aH.atomName).desc("atomname")},Resname:function(){return dV.regexp(/[a-zA-Z0-9]{1,4}/).desc("resname")},Resno:function(e){return e.Integer.desc("resno")},Altloc:function(){return dV.regexp(/%([a-zA-Z0-9])/,1).desc("altloc")},Inscode:function(){return dV.regexp(/\^([a-zA-Z0-9])/,1).desc("inscode")},BracketedResname:function(){return dV.regexp(/\[([a-zA-Z0-9]{1,4})\]/,1).desc("bracketed-resname")},ResnoRange:function(e){return dV.seq(e.Integer.skip(dV.seq(dV.optWhitespace,dV.string("-"),dV.optWhitespace)),e.Integer).desc("resno-range")},Within:function(e){return dV.regexp(/within/i).skip(dV.regexp(/\s*\(\s*/)).then(dV.seq(e.Integer.skip(dV.regexp(/\s*,\s*/)),e.Query)).skip(dV.regexp(/\)/))},Keywords:function(){var e;return(e=dV).alt.apply(e,OV(iH)).desc("keyword")},Query:function(e){return dV.alt(e.Operator,e.Parens,e.Expression).trim(dV.optWhitespace)},Number:function(){return dV.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/).map(Number).desc("number")},String:function(){var e=BV(KV,iH,QV).sort(kV).map(Qg).join("|");return dV.alt(dV.regexp(RegExp(`(?!(${e}))[A-Z0-9_]+`,"i")),dV.regexp(/'((?:[^"\\]|\\.)*)'/,1),dV.regexp(/"((?:[^"\\]|\\.)*)"/,1).map(function(e){return aH.core.type.regex([`^${e}$`,"i"])})).desc("string")},Value:function(e){return dV.alt(e.Number,e.String)},ValueParens:function(e){return dV.alt(e.ValueParens,e.ValueOperator,e.ValueExpressions).wrap(dV.string("("),dV.string(")"))},ValuePropertyNames:function(){var e;return(e=dV).alt.apply(e,RV(KV,/LIKE|>=|<=|=|!=|>|<|\)|\s/i))},ValueOperator:function(e){return xV(oH,dV.alt(e.ValueParens,e.ValueExpressions))},ValueExpressions:function(e){return dV.alt(e.Value,e.ValuePropertyNames)},ValueQuery:function(e){return dV.alt(e.ValueOperator.map(function(e){if(e.head){if(e.head.name.startsWith("structure-query.generator"))return e}else if("string"==typeof e&&e.length<=4)return aH.struct.generator.atomGroups({"residue-test":aH.core.rel.eq([aH.ammp("label_comp_id"),e])});throw Error(`values must be part of an comparison, value '${e}'`)}))}}),cH=SL,lH=/[-+]?[0-9]*\.?[0-9]+/;function dH(e){return e.split("+").map(function(e){return e.replace(/^["']|["']$/g,"")})}function fH(e){if(e.includes("-")&&e.includes("+")){var t=e.split("+").map(function(e){return e.replace(/^["']|["']$/g,"")}),r=[];return t.forEach(function(e){if(e.includes("-")&&!e.startsWith("-"))for(var t=e.split("-").map(function(e){return parseInt(e)}),n=t[0],i=t[1],a=n;a<=i;a++)r.push(a);else if(e.includes("-")&&e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/))for(n=-parseInt(e.split("-")[1]),i=void 0,i=e.includes("--")?-parseInt(e.split("-")[3]):parseInt(e.split("-")[2]),a=n;a<=i;a++)r.push(a);else e.includes("-")&&e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/),r.push(parseInt(e))}),r}if(e.includes("-")&&!e.includes("+")){var n=[];if(e.startsWith("-"))if(e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/))for(a=-parseInt(e.split("-")[1]),o=void 0,o=e.includes("--")?-parseInt(e.split("-")[3]):parseInt(e.split("-")[2]),s=a;s<=o;s++)n.push(s);else e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/),n.push(parseInt(e));else for(var i=e.split("-").map(function(e){return parseInt(e)}),a=i[0],o=i[1],s=a;s<=o;s++)n.push(s);return n}return!e.includes("-")&&e.includes("+")?dH(e).map(function(e){return parseInt(e)}):[parseInt(e)]}var hH={H:"helix",S:"beta",L:"none"}
139,pH={symbol:{"@desc":"chemical-symbol-list: list of 1- or 2-letter chemical symbols from the periodic table","@examples":["symbol O+N"],abbr:["e."],regex:/[a-zA-Z'"+]+/,map:function(e){return e.split("+").map(cH.struct.type.elementSymbol)},level:"atom-test",property:cH.acp("elementSymbol")},name:{"@desc":"atom-name-list: list of up to 4-letter codes for atoms in proteins or nucleic acids","@examples":["name CA+CB+CG+CD"],abbr:["n."],regex:/[a-zA-Z0-9'"+]+/,map:function(e){return e.split("+").map(cH.atomName)},level:"atom-test",property:cH.ammp("label_atom_id")},resn:{"@desc":"residue-name-list: list of 3-letter codes for amino acids or list of up to 2-letter codes for nucleic acids","@examples":["resn ASP+GLU+ASN+GLN","resn A+G"],abbr:["resname","r."],regex:/[a-zA-Z0-9'"+]+/,map:dH,level:"residue-test",property:cH.ammp("label_comp_id")},resi:{"@desc":"residue-identifier-list list of up to 4-digit residue numbers or residue-identifier-range","@examples":["resi 1+10+100+1000","resi 1-10"],abbr:["resident","residue","resid","i."],regex:/[0-9+-]+/,map:fH,level:"residue-test",property:cH.ammp("auth_seq_id")},alt:{"@desc":"alternate-conformation-identifier-list list of single letters","@examples":["alt A+B",'alt ""','alt ""+A'],abbr:[],regex:/[a-zA-Z0-9'"+]+/,map:dH,level:"atom-test",property:cH.ammp("label_alt_id")},chain:{"@desc":"chain-identifier-list list of single letters or sometimes numbers","@examples":["chain A"],abbr:["c."],regex:/[a-zA-Z0-9'"+]+/,map:dH,level:"chain-test",property:cH.ammp("auth_asym_id")},segi:{"@desc":"segment-identifier-list list of up to 4 letter identifiers","@examples":["segi lig"],abbr:["segid","s."],regex:/[a-zA-Z0-9'"+]+/,map:dH,level:"chain-test",property:cH.ammp("label_asym_id")},flag:{"@desc":"flag-number a single integer from 0 to 31","@examples":["flag 0"],isUnsupported:!0,abbr:["f."],regex:/[0-9]+/,map:function(e){return parseInt(e)},level:"atom-test"},numeric_type:{"@desc":"type-number a single integer","@examples":["nt. 5"],isUnsupported:!0,abbr:["nt."],regex:/[0-9]+/,map:function(e){return parseInt(e)},level:"atom-test"},text_type:{"@desc":"type-string a list of up to 4 letter codes","@examples":["text_type HA+HC"],isUnsupported:!0,abbr:["tt."],regex:/[a-zA-Z0-9'"+]+/,map:dH,level:"atom-test"},id:{"@desc":"external-index-number a single integer","@examples":["id 23"],regex:/[0-9+-]+/,map:fH,level:"atom-test",property:cH.ammp("id")},index:{"@desc":"internal-index-number a single integer","@examples":["index 11"],regex:/[0-9+-]+/,map:fH,level:"atom-test",property:cH.ammp("id")},ss:{"@desc":"secondary-structure-type list of single letters. Helical regions should be assigned H and sheet regions S. Loop regions can either be assigned L or be blank.","@examples":["ss H+S+L",'ss S+""'],abbr:[],regex:/[a-zA-Z'"+]+/,map:function(e){return{flags:cH.struct.type.secondaryStructureFlags(e.toUpperCase().split("+").map(function(e){return hH[e]||"none"}))}},level:"residue-test",property:cH.ammp("secondaryStructureFlags")},b:{"@desc":"comparison-operator b-factor-value a real number","@examples":["b > 10"],isNumeric:!0,abbr:[],regex:lH,map:function(e){return parseFloat(e)},level:"atom-test",property:cH.ammp("B_iso_or_equiv")},q:{"@desc":"comparison-operator occupancy-value a real number","@examples":["q <0.50"],isNumeric:!0,abbr:[],regex:lH,map:function(e){return parseFloat(e)},level:"atom-test",property:cH.ammp("occupancy")},formal_charge:{"@desc":"comparison-operator formal charge-value an integer","@examples":["fc. = -1"],isNumeric:!0,abbr:["fc."],regex:lH,map:function(e){return parseFloat(e)},level:"atom-test",property:cH.ammp("pdbx_formal_charge")},partial_charge:{"@desc":"comparison-operator partial charge-value a real number","@examples":["pc. > 1"],isUnsupported:!0,isNumeric:!0,abbr:["pc."],regex:lH,map:function(e){return parseFloat(e)},level:"atom-test"},elem:{"@desc":'str  atomic element symbol string ("X" if undefined)',"@examples":["elem N"],regex:/[a-zA-Z0-9]{1,3}/,map:function(e){return cH.es(e)},level:"atom-test",property:cH.acp("elementSymbol")}},mH=SL,gH=[{"@desc":"Selects atoms that are not included in s1.","@examples":["NOT resn ALA","not (resi 42 or chain A)","!resi 42 or chain A"],name:"not",type:yV,rule:dV.alt(dV.regexp(/NOT/i).skip(dV.whitespace),dV.string("!").skip(dV.optWhitespace)),map:function(e,t){return MV(t)}},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["chain A AND name CA"],name:"and",type:_V,rule:SV(/AND|&/i),map:function(e,t,r){return mH.struct.modifier.intersectBy({0:t,by:r})}},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["chain A OR chain B"],name:"or",type:_V,rule:SV(/OR|\|/i),map:function(e,t,r){return mH.struct.combinator.merge([t,r])}},{"@desc":"Selects atoms in s1 whose identifiers name, resi, resn, chain and segi all match atoms in s2.","@examples":["chain A IN chain B"],name:"in",type:_V,rule:SV(/IN/i),map:function(e,t,r){return mH.struct.filter.withSameAtomProperties({0:t,source:r,property:mH.core.type.compositeKey([mH.ammp("label_atom_id"),mH.ammp("label_seq_id"),mH.ammp("label_comp_id"),mH.ammp("auth_asym_id"),mH.ammp("label_asym_id")])})}},{"@desc":"Selects atoms in s1 whose identifiers name and resi match atoms in s2.","@examples":["chain A LIKE chain B"],name:"like",type:_V,rule:SV(/LIKE|l\./i),map:function(e,t,r){return mH.struct.filter.withSameAtomProperties({0:t,source:r,property:mH.core.type.compositeKey([mH.ammp("label_atom_id"),mH.ammp("label_seq_id")])})}},{"@desc":"Selects all atoms whose van der Waals radii are separated from the van der Waals radii of s1 by a minimum of X Angstroms.","@examples":["solvent GAP 2"],name:"gap",type:bV,rule:AV(/GAP\s+([-+]?[0-9]*\.?[0-9]+)/i,1).map(function(e){return parseFloat(e)}),map:function(e,t){return mH.struct.filter.within({0:mH.struct.generator.all(),target:t,"atom-radius":mH.acp("vdw"),"max-radius":e,invert:!0})}},{"@desc":"Selects atoms with centers within X Angstroms of the center of any atom in s1.","@examples":["resname LIG AROUND 1"],name:"around",abbr:["a."],type:bV,rule:AV(/(AROUND|a\.)\s+([-+]?[0-9]*\.?[0-9]+)/i,2).map(function(e){return parseFloat(e)}),map:function(e,t){return mH.struct.modifier.exceptBy({0:mH.struct.filter.within({0:mH.struct.generator.all(),target:t,"max-radius":e}),by:t})}},{"@desc":"Expands s1 by all atoms within X Angstroms of the center of any atom in s1.","@examples":["chain A EXPAND 3"],name:"expand",abbr:["x."],type:bV,rule:AV(/(EXPAND|x\.)\s+([-+]?[0-9]*\.?[0-9]+)/i,2).map(function(e){return parseFloat(e)}),map:function(e,t){return mH.struct.modifier.includeSurroundings({0:t,radius:e})}},{"@desc":"Selects atoms in s1 that are within X Angstroms of any atom in s2.","@examples":["chain A WITHIN 3 OF chain B"],name:"within",abbr:["w."],type:_V,rule:CV("WITHIN","w."),map:function(e,t,r){return mH.struct.filter.within({0:t,target:r,"max-radius":e})}},{"@desc":"Same as within, but excludes s2 from the selection (and thus is identical to s1 and s2 around X).","@examples":["chain A NEAR_TO 3 OF chain B"],name:"near_to",abbr:["nto."],type:_V,rule:CV("NEAR_TO","nto."),map:function(e,t,r){return mH.struct.modifier.exceptBy({0:mH.struct.filter.within({0:t,target:r,"max-radius":e}),by:r})}},{"@desc":"Selects atoms in s1 that are at least X Anstroms away from s2.","@examples":["solvent BEYOND 2 OF chain A"],name:"beyond",abbr:["be."],t
139ype:_V,rule:CV("BEYOND","be."),map:function(e,t,r){return mH.struct.modifier.exceptBy({0:mH.struct.filter.within({0:t,target:r,"max-radius":e,invert:!0}),by:r})}},{"@desc":"Expands selection to complete residues.","@examples":["BYRESIDUE name N"],name:"byresidue",abbr:["byresi","byres","br."],type:yV,rule:wV(/BYRESIDUE|byresi|byres|br\./i),map:function(e,t){return FV(mH.struct.modifier.expandProperty({0:mH.struct.modifier.union({0:t}),property:mH.ammp("residueKey")}))}},{"@desc":"Completely selects all alpha carbons in all residues covered by a selection.","@examples":["BYCALPHA chain A"],name:"bycalpha",abbr:["bca."],type:yV,rule:wV(/BYCALPHA|bca\./i),map:function(e,t){return mH.struct.generator.queryInSelection({0:mH.struct.modifier.expandProperty({0:mH.struct.modifier.union({0:t}),property:mH.ammp("residueKey")}),query:mH.struct.generator.atomGroups({"atom-test":mH.core.rel.eq([mH.atomName("CA"),mH.ammp("label_atom_id")])})})}},{"@desc":"Expands selection to complete molecules.","@examples":["BYMOLECULE resi 20-30"],name:"bymolecule",isUnsupported:!0,abbr:["bymol","bm."],type:yV,rule:wV(/BYMOLECULE|bymol|bm\./i),map:function(e,t){return FV(mH.struct.modifier.expandProperty({0:mH.struct.modifier.union({0:t}),property:mH.atp("connectedComponentKey")}))}},{"@desc":"Expands selection to complete fragments.","@examples":["BYFRAGMENT resi 10"],name:"byfragment",abbr:["byfrag","bf."],isUnsupported:!0,type:yV,rule:wV(/BYFRAGMENT|byfrag|bf\./i),map:function(e,t){return[e,t]}},{"@desc":"Expands selection to complete segments.","@examples":["BYSEGMENT resn CYS"],name:"bysegment",abbr:["bysegi","byseg","bs."],type:yV,rule:wV(/BYSEGMENT|bysegi|byseg|bs\./i),map:function(e,t){return FV(mH.struct.modifier.expandProperty({0:mH.struct.modifier.union({0:t}),property:mH.ammp("chainKey")}))}},{"@desc":"Expands selection to complete objects.","@examples":["BYOBJECT chain A"],name:"byobject",abbr:["byobj","bo."],isUnsupported:!0,type:yV,rule:wV(/BYOBJECT|byobj|bo\./i),map:function(e,t){return[e,t]}},{"@desc":"Expands selection to unit cell.","@examples":["BYCELL chain A"],name:"bycell",isUnsupported:!0,type:yV,rule:wV(/BYCELL/i),map:function(e,t){return[e,t]}},{"@desc":"All rings of size ≤ 7 which have at least one atom in s1.","@examples":["BYRING resn HEM"],name:"byring",type:yV,rule:wV(/BYRING/i),map:function(e,t){return FV(mH.struct.modifier.intersectBy({0:mH.struct.filter.pick({0:mH.struct.generator.rings(),test:mH.core.logic.and([mH.core.rel.lte([mH.struct.atomSet.atomCount(),7]),mH.core.rel.gr([mH.struct.atomSet.countQuery([t]),1])])}),by:t}))}},{"@desc":"Selects atoms directly bonded to s1, excludes s1.","@examples":["NEIGHBOR resn CYS"],name:"neighbor",type:yV,abbr:["nbr."],rule:wV(/NEIGHBOR|nbr\./i),map:function(e,t){return mH.struct.modifier.exceptBy({0:FV(mH.struct.modifier.includeConnected({0:mH.struct.modifier.union({0:t}),"bond-test":!0})),by:t})}},{"@desc":"Selects atoms directly bonded to s1, may include s1.","@examples":["BOUND_TO name CA"],name:"bound_to",abbr:["bto."],type:yV,rule:wV(/BOUND_TO|bto\./i),map:function(e,t){return FV(mH.struct.modifier.includeConnected({0:mH.struct.modifier.union({0:t})}))}},{"@desc":"Extends s1 by X bonds connected to atoms in s1.","@examples":["resname LIG EXTEND 3"],name:"extend",abbr:["xt."],type:bV,rule:AV(/(EXTEND|xt\.)\s+([0-9]+)/i,2).map(function(e){return parseInt(e)}),map:function(e,t){return FV(mH.struct.modifier.includeConnected({0:mH.struct.modifier.union({0:t}),"bond-test":!0,"layer-count":e}))}}],vH=SL,yH={nucleic:["A","C","T","G","U","DA","DC","DT","DG","DU"],protein:["ALA","ARG","ASN","ASP","CYS","CYX","GLN","GLU","GLY","HIS","HID","HIE","HIP","ILE","LEU","LYS","MET","MSE","PHE","PRO","SER","THR","TRP","TYR","VAL"],solvent:["HOH","WAT","H20","TIP","SOL"]},bH=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*","C2'","C1'","O4'","O2'"],_H=["C","N","CA","O"];function xH(){return vH.struct.combinator.merge([vH.struct.modifier.intersectBy({0:vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.protein),vH.ammp("label_comp_id")])}),by:vH.struct.generator.atomGroups({"atom-test":vH.core.set.has([vH.core.type.set(_H),vH.ammp("label_atom_id")])})}),vH.struct.modifier.intersectBy({0:vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.nucleic),vH.ammp("label_comp_id")])}),by:vH.struct.generator.atomGroups({"atom-test":vH.core.set.has([vH.core.type.set(bH),vH.ammp("label_atom_id")])})})])}var SH={all:{"@desc":"All atoms currently loaded into PyMOL",abbr:["*"],map:function(){return vH.struct.generator.all()}},none:{"@desc":"No atoms (empty selection)",map:function(){return vH.struct.generator.empty()}},hydrogens:{"@desc":"All hydrogen atoms currently loaded into PyMOL",abbr:["hydro","h."],map:function(){return vH.struct.generator.atomGroups({"atom-test":vH.core.rel.eq([vH.acp("elementSymbol"),vH.es("H")])})}},hetatm:{"@desc":"All atoms loaded from Protein Data Bank HETATM records",abbr:["het"],map:function(){return vH.struct.generator.atomGroups({"atom-test":vH.core.rel.eq([vH.ammp("isHet"),!0])})}},visible:{"@desc":"All atoms in enabled objects with at least one visible representation",abbr:["v."]},polymer:{"@desc":"All atoms on the polymer (not het). Finds atoms with residue identifiers matching a known polymer, such a peptide and DNA.",abbr:["pol."],map:function(){return vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.nucleic.concat(yH.protein)),vH.ammp("label_comp_id")])})}},sidechain:{"@desc":"Polymer non-backbone atoms (new in PyMOL 1.6.1)",abbr:["sc."],map:function(){return vH.struct.modifier.exceptBy({0:vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.nucleic.concat(yH.protein)),vH.ammp("label_comp_id")])}),by:xH()})}},present:{"@desc":"All atoms with defined coordinates in the current state (used in creating movies)",abbr:["pr."]},center:{"@desc":"Pseudo-atom at the center of the scene"},origin:{"@desc":"Pseudo-atom at the origin of rotation"},enabled:{"@desc":"All enabled objects or selections from the object list."},masked:{"@desc":"All masked atoms.",abbr:["msk."]},protected:{"@desc":"All protected atoms.",abbr:["pr."]},bonded:{"@desc":"All bonded atoms",map:function(){return vH.struct.generator.atomGroups({"atom-test":vH.core.rel.gr([vH.struct.atomProperty.core.bondCount({flags:vH.struct.type.bondFlags(["covalent","metallic","sulfide"])}),0])})}},donors:{"@desc":"All hydrogen bond donor atoms.",abbr:["don."]},acceptors:{"@desc":"All hydrogen bond acceptor atoms.",abbr:["acc."]},fixed:{"@desc":"All fixed atoms.",abbr:["fxd."]},restrained:{"@desc":"All restrained atoms.",abbr:["rst."]},organic:{"@desc":"All atoms in non-polymer organic compounds (e.g. ligands, buffers). Finds carbon-containing molecules that do not match known polymers.",abbr:["org."],map:function(){return FV(vH.struct.modifier.expandProperty({0:vH.struct.modifier.union([vH.struct.generator.queryInSelection({0:vH.struct.generator.atomGroups({"residue-test":vH.core.logic.not([vH.core.set.has([vH.core.type.set(yH.nucleic.concat(yH.protein)),vH.ammp("label_comp_id")])])}),query:vH.struct.generator.atomGroups({"atom-test":vH.core.rel.eq([vH.es("C"),vH.acp("elementSymbol")])})})]),property:vH.ammp("residueKey")}))}},inorganic:{"@desc":"All non-polymer inorganic atoms/ions. Finds atoms in molecules that do not contain carbon and do not match any known solvent residues.",abbr:["ino."],map:function(){return FV(vH.struct.modifier.expandProperty({0:vH.struct.modifier.union([vH.struct.filter.pick({0:vH.struct.generator.atomGroups({"residue-test":vH.core.logic.not([vH.core.set.has([vH.core.type.set(yH.nucleic.concat(yH.protein).concat(yH.solvent)),vH.ammp("label_comp_id")])]),"group-by":vH.ammp("residueKey")}),test:vH.core.logic.not([vH.core.set.has([vH.struct.atomSet.propertySet([vH.acp("elementSymbol")]),vH.es("C")])])})]),property:vH.ammp("residueKey")}))}},solvent:{"@desc":"All water molecules. The hardcoded solvent residue identifiers are currently: HOH, WAT, H20, TIP, SOL.",abbr:["sol."],map:function(){return vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.solvent),vH.ammp("label_comp_id")])})}},guide:{"@desc":"All protein CA and nucleic acid C4*/C4",map:function(){return vH.struct.combinator.merge([vH.struct.generator.atomGroups({"atom-test":vH.core.rel.eq([vH.atomName("CA"),vH.ammp("label_atom_id")]),"residue-test":vH.core.set.has([vH.core.type.set(yH.protein),vH.ammp("label_comp_id")])}),vH.struct.generator.atomGroups({"atom-test":vH.core.set.has([NV(["C4*","C4'"]),vH.ammp("label_atom_id")]),"residue-test":vH.core.set.has([vH.core.type.set(yH.nucleic),vH.ammp("label_comp_id")])})])}}
139,metals:{"@desc":"All metal atoms (new in PyMOL 1.6.1)"},backbone:{"@desc":"Polymer backbone atoms (new in PyMOL 1.6.1)",abbr:["bb."],map:function(){return xH()}},"polymer.protein":{"@desc":"Protein (New in PyMOL 2.1)",abbr:["polymer.protein"],map:function(){return vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.protein),vH.ammp("label_comp_id")])})}},"polymer.nucleic":{"@desc":"Nucleic Acid (New in PyMOL 2.1)",abbr:["polymer.nucleic"],map:function(){return vH.struct.generator.atomGroups({"residue-test":vH.core.set.has([vH.core.type.set(yH.nucleic),vH.ammp("label_comp_id")])})}}},wH=SL,AH=function(e){var t={};return Object.keys(e).sort(kV).forEach(function(r){var n=e[r],i=TV(`property '${r}' not supported`),a=dV.regexp(n.regex).map(function(e){return n.isUnsupported&&i(),EV(n.property,n.map(e))});n.isNumeric||(t[r]=a)}),t}(pH),CH=dV.string("/");function TH(e){return e.or(dV.of(null))}function PH(e){var t={},r={};for(var n in e){var i=pH[n];if(!i)throw Error(`property '${n}' not supported, value '${e[n]}'`);null!==e[n]&&(r[i.level]||(r[i.level]=[]),r[i.level].push(e[n]))}for(var a in r)t[a]=PV(r[a]);return wH.struct.generator.atomGroups(t)}var EH=dV.createLanguage({Parens:function(e){return dV.alt(e.Parens,e.Operator,e.Expression).wrap(dV.string("("),dV.string(")"))},Expression:function(e){return dV.alt(e.Keywords,e.AtomSelectionMacro.map(PH),e.NamedAtomProperties,e.Pepseq,e.Rep,e.Object)},AtomSelectionMacro:function(e){return dV.alt(CH.then(dV.alt(dV.seq(TH(e.ObjectProperty).skip(CH),TH(AH.segi).skip(CH),TH(AH.chain).skip(CH),TH(AH.resi).skip(CH),TH(AH.name)).map(function(e){return{object:e[0],segi:e[1],chain:e[2],resi:e[3],name:e[4]}}),dV.seq(TH(e.ObjectProperty).skip(CH),TH(AH.segi).skip(CH),TH(AH.chain).skip(CH),TH(AH.resi)).map(function(e){return{object:e[0],segi:e[1],chain:e[2],resi:e[3]}}),dV.seq(TH(e.ObjectProperty).skip(CH),TH(AH.segi).skip(CH),TH(AH.chain)).map(function(e){return{object:e[0],segi:e[1],chain:e[2]}}),dV.seq(TH(e.ObjectProperty).skip(CH),TH(AH.segi)).map(function(e){return{object:e[0],segi:e[1]}}),dV.seq(TH(e.ObjectProperty)).map(function(e){return{object:e[0]}}))),dV.alt(dV.seq(TH(e.ObjectProperty).skip(CH),TH(AH.segi).skip(CH),TH(AH.chain).skip(CH),TH(AH.resi).skip(CH),TH(AH.name)).map(function(e){return{object:e[0],segi:e[1],chain:e[2],resi:e[3],name:e[4]}}),dV.seq(TH(AH.segi).skip(CH),TH(AH.chain).skip(CH),TH(AH.resi).skip(CH),TH(AH.name)).map(function(e){return{segi:e[0],chain:e[1],resi:e[2],name:e[3]}}),dV.seq(TH(AH.chain).skip(CH),TH(AH.resi).skip(CH),TH(AH.name)).map(function(e){return{chain:e[0],resi:e[1],name:e[2]}}),dV.seq(TH(AH.resi).skip(CH),TH(AH.name)).map(function(e){return{resi:e[0],name:e[1]}})))},NamedAtomProperties:function(){var e;return(e=dV).alt.apply(e,DV(pH))},Keywords:function(){var e;return(e=dV).alt.apply(e,OV(SH))},ObjectProperty:function(){var e=BV(pH,SH,gH).sort(kV).map(Qg).join("|");return dV.regexp(RegExp(`(?!(${e}))[A-Z0-9_]+`,"i"))},Object:function(e){return e.ObjectProperty.notFollowedBy(CH).map(function(e){throw Error(`property 'object' not supported, value '${e}'`)})},Pepseq:function(){return dV.regexp(/(PEPSEQ|ps\.)\s+([a-z]+)/i,2).map(TV("operator 'pepseq' not supported"))},Rep:function(){return dV.regexp(/REP\s+(lines|spheres|mesh|ribbon|cartoon|sticks|dots|surface|labels|extent|nonbonded|nb_spheres|slice|extent|slice|dashes|angles|dihedrals|cgo|cell|callback|everything)/i,1).map(TV("operator 'rep' not supported"))},Operator:function(e){return xV(gH,dV.alt(e.Parens,e.Expression,e.Operator))},Query:function(e){return dV.alt(e.Operator,e.Parens,e.Expression).trim(dV.optWhitespace)}}),MH=SL,kH=/[-+]?[0-9]*\.?[0-9]+/,IH=/[+]?[0-9]+/,DH=/[-+]?[0-9]+/;function OH(e){return e}var RH={T:"turn",E:"sheet",B:"strand",H:"alpha",G:"3-10",I:"pi",C:"none"};function BH(e){return MH.struct.type.secondaryStructureFlags([RH[e.toUpperCase()]||"none"])}var NH={name:{"@desc":"str    atom name","@examples":["name CA"],regex:/[a-zA-Z0-9]+/,map:MH.atomName,level:"atom-test",property:MH.ammp("label_atom_id")},type:{"@desc":"str    atom type","@examples":["type C3"],isUnsupported:!0,regex:/[a-zA-Z0-9]+/,map:OH,level:"atom-test"},index:{"@desc":"num    the atom number, starting at 0","@examples":["index 10"],isNumeric:!0,regex:IH,map:function(e){return parseInt(e)-1},level:"atom-test",property:MH.ammp("id")},serial:{"@desc":"num    the atom number, starting at 1","@examples":["serial 11"],isNumeric:!0,regex:IH,map:function(e){return parseInt(e)},level:"atom-test",property:MH.ammp("id")},atomicnumber:{"@desc":"num    atomic number (0 if undefined)","@examples":["atomicnumber 13"],isNumeric:!0,regex:IH,map:function(e){return parseInt(e)},level:"atom-test",property:MH.acp("atomicNumber")},element:{"@desc":'str  atomic element symbol string ("X" if undefined)',"@examples":["element N"],regex:/[a-zA-Z0-9]{1,3}/,map:function(e){return MH.es(e)},level:"atom-test",property:MH.acp("elementSymbol")},altloc:{"@desc":"str  alternate location/conformation identifier","@examples":["altloc C"],regex:/[a-zA-Z0-9]+/,map:OH,level:"atom-test",property:MH.ammp("label_alt_id")},chain:{"@desc":"str  the one-character chain identifier","@examples":["chain A"],regex:/[a-zA-Z0-9]+/,map:OH,level:"residue-test",property:MH.ammp("auth_asym_id")},residue:{"@desc":"num  a set of connected atoms with the same residue number","@examples":["residue < 11","residue 11"],isNumeric:!0,regex:DH,map:function(e){return parseInt(e)},level:"residue-test",property:MH.ammp("auth_seq_id")},fragment:{"@desc":"num  a set of connected residues","@examples":["fragment 42"],isUnsupported:!0,isNumeric:!0,regex:DH,map:function(e){return parseInt(e)},level:"residue-test"},pfrag:{"@desc":"num  a set of connected protein residues","@examples":["pfrag 42"],isUnsupported:!0,isNumeric:!0,regex:DH,map:function(e){return parseInt(e)},level:"residue-test"},nfrag:{"@desc":"num  a set of connected nucleic residues","@examples":["nfrag 42"],isUnsupported:!0,isNumeric:!0,regex:DH,map:function(e){return parseInt(e)},level:"residue-test"},sequence:{"@desc":"str  a sequence given by one letter names","@examples":["sequence PGATTACA"],isUnsupported:!0,regex:/[a-zA-Z0-9]+/,map:OH,level:"residue-test"},numbonds:{"@desc":"num  number of bonds","@examples":["numbonds = 2","numbonds >= 3"],isNumeric:!0,regex:IH,map:function(e){return parseInt(e)},level:"atom-test",property:MH.acp("bondCount")},resname:{"@desc":"str  residue name","@examples":["resname ALA"],regex:/[a-zA-Z0-9]+/,map:OH,level:"residue-test",property:MH.ammp("auth_comp_id")},resid:{"@desc":"num  residue id","@examples":["resid 42"],isNumeric:!0,regex:DH,map:function(e){return parseInt(e)},level:"residue-test",property:MH.ammp("auth_seq_id")},segname:{"@desc":"str  segment name","@examples":["segname B"],regex:/[a-zA-Z0-9]+/,map:OH,level:"residue-test",property:MH.ammp("label_asym_id")},x:{"@desc":"float  x coordinate","@examples":["x 42"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.acp("x")},y:{"@desc":"float  y coordinate","@examples":["y > 1.7"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.acp("y")},z:{"@desc":"float  z coordinate","@examples":["z < 11","z > -21"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.acp("z")}
139,radius:{"@desc":"float  atomic radius","@examples":["radius > 1.3"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.acp("vdw")},mass:{"@desc":"float  atomic mass","@examples":["mass > 2"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.acp("mass")},charge:{"@desc":"float  atomic charge","@examples":["charge > 0","charge 1"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.ammp("pdbx_formal_charge")},beta:{"@desc":"float  temperature factor","@examples":["beta < 20","beta > 35"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.ammp("B_iso_or_equiv")},occupancy:{"@desc":"float  occupancy","@examples":["occupancy 1","occupancy < 1"],isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test",property:MH.ammp("occupancy")},user:{"@desc":"float  time-varying user-specified value","@examples":["user < 0.1"],isUnsupported:!0,isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"atom-test"},rasmol:{"@desc":"str  translates Rasmol selection string to VMD","@examples":["rasmol 'all'"],isUnsupported:!0,regex:/[^']*/,map:OH,level:"atom-test"},structure:{"@desc":"str  single letter name for the secondary structure","@examples":["structure H","structure H E"],regex:/T|E|B|H|G|I|C/i,map:BH,level:"atom-test",property:MH.ammp("secondaryStructureFlags")},phi:{"@desc":"float  phi backbone conformational angles","@examples":["phi < 160"],isUnsupported:!0,isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"residue-test"},psi:{"@desc":"float  psi backbone conformational angles","@examples":["psi < 160"],isUnsupported:!0,isNumeric:!0,regex:kH,map:function(e){return parseFloat(e)},level:"residue-test"},ufx:{"@desc":"num  force to apply in the x coordinate","@examples":["ufx 1"],isUnsupported:!0,isNumeric:!0,regex:kH,map:function(e){return parseInt(e)},level:"atom-test"},ufy:{"@desc":"num  force to apply in the y coordinate","@examples":["ufy 1"],isUnsupported:!0,isNumeric:!0,regex:kH,map:function(e){return parseInt(e)},level:"atom-test"},ufz:{"@desc":"num  force to apply in the z coordinate","@examples":["ufz 1"],isUnsupported:!0,isNumeric:!0,regex:kH,map:function(e){return parseInt(e)},level:"atom-test"}},FH=SL,LH=Object.keys(NH).sort(kV).filter(function(e){return!NH[e].isUnsupported}).join("|"),$H=[{"@desc":"Selects atoms that are not included in s1.","@examples":["not protein"],name:"not",type:yV,rule:dV.regexp(/NOT/i).skip(dV.whitespace),map:function(e,t){return MV(t)}},{"@desc":"Selects atoms within a specified distance of a selection","@examples":["within 5 of name FE"],name:"within",type:yV,rule:wV(/WITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i,1).map(function(e){return parseFloat(e)}),map:function(e,t){return FH.struct.modifier.includeSurroundings({0:t,radius:e})}},{"@desc":"Exclusive within, equivalent to (within 3 of X) and not X","@examples":["exwithin 10 of resname HEM"],name:"exwithin",type:yV,rule:wV(/EXWITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i,1).map(function(e){return parseFloat(e)}),map:function(e,t){return FH.struct.modifier.exceptBy({0:FH.struct.modifier.includeSurroundings({0:t,radius:e}),by:t})}},{"@desc":"Selects atoms which have the same keyword as the atoms in a given selection","@examples":["same resid as name FE"],name:"same",type:yV,rule:wV(RegExp(`SAME\\s+(${LH})\\s+AS`,"i"),1).map(function(e){return NH[e].property}),map:function(e,t){return FH.struct.filter.withSameAtomProperties({0:FH.struct.generator.all(),source:t,property:e})}},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["backbone and protein"],name:"and",type:_V,rule:dV.alt(SV(/AND/i),dV.whitespace),map:function(e,t,r){return FH.struct.modifier.intersectBy({0:t,by:r})}},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["water or protein"],name:"or",type:_V,rule:SV(/OR/i),map:function(e,t,r){return FH.struct.combinator.merge([t,r])}}],UH=SL;function jH(){return UH.struct.filter.pick({0:UH.struct.generator.atomGroups({"group-by":UH.ammp("residueKey")}),test:UH.core.set.isSubset([NV(["C","N","CA","O"]),UH.ammpSet("label_atom_id")])})}function zH(){return UH.struct.filter.pick({0:UH.struct.generator.atomGroups({"group-by":UH.ammp("residueKey")}),test:UH.core.logic.and([UH.core.set.isSubset([NV(["P"]),UH.ammpSet("label_atom_id")]),UH.core.logic.or([UH.core.set.isSubset([NV(["O3'","C3'","C4'","C5'","O5'"]),UH.ammpSet("label_atom_id")]),UH.core.set.isSubset([NV(["O3*","C3*","C4*","C5*","O5*"]),UH.ammpSet("label_atom_id")])])])})}function GH(){return UH.struct.combinator.merge([UH.struct.generator.queryInSelection({0:jH(),query:UH.struct.generator.atomGroups({"atom-test":UH.core.set.has([NV(YH.protein),UH.ammp("label_atom_id")])})}),UH.struct.generator.queryInSelection({0:zH(),query:UH.struct.generator.atomGroups({"atom-test":UH.core.set.has([NV(YH.nucleic),UH.ammp("label_atom_id")])})})])}function VH(e){return UH.struct.generator.atomGroups({"residue-test":UH.core.flags.hasAll([UH.ammp("secondaryStructureFlags"),UH.struct.type.secondaryStructureFlags(e)])})}var HH,qH,WH,XH,YH={nucleic:["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],protein:["C","N","CA","O"]},KH={acidic:["ASP","GLU"],aliphatic:["ALA","GLY","ILE","LEU","VAL"],aromatic:["HIS","PHE","TRP","TYR"],at:["ADA","A","THY","T"],basic:["ARG","HIS","LYS"],buried:["ALA","LEU","VAL","ILE","PHE","CYS","MET","TRP"],cg:["CYT","C","GUA","G"],cyclic:["HIS","PHE","PRO","TRP","TYR"],hydrophobic:["ALA","LEU","VAL","ILE","PRO","PHE","MET","TRP"],medium:["VAL","THR","ASP","ASN","PRO","CYS","ASX","PCA","HYP"],neutral:["VAL","PHE","GLN","TYR","HIS","CYS","MET","TRP","ASX","GLX","PCA","HYP"],purine:["ADE","A","GUA","G"],pyrimidine:["CYT","C","THY","T","URI","U"],small:["ALA","GLY","SER"],water:["H2O","HH0","OHH","HOH","OH2","SOL","WAT","TIP","TIP2","TIP3","TIP4"]},ZH={all:{"@desc":"everything",map:function(){return UH.struct.generator.all()}},none:{"@desc":"nothing",map:function(){return UH.struct.generator.empty()}},protein:{"@desc":"a residue with atoms named C, N, CA, and O",map:function(){return jH()}},nucleic:{"@desc":"a residue with atoms named P, O1P, O2P and either O3', C3', C4', C5', O5' or O3*, C3*, C4*, C5*, O5*. This definition assumes that the base is phosphorylated, an assumption which will be corrected in the future.",map:function(){return zH()}},backbone:{"@desc":"the C, N, CA, and O atoms of a protein and the equivalent atoms in a nucleic acid.",map:function(){return GH()}},sidechain:{"@desc":"non-backbone atoms and bonds",map:function(){return MV(GH())}},water:{"@desc":"all atoms with the resname H2O, HH0, OHH, HOH, OH2, SOL, WAT, TIP, TIP2, TIP3 or TIP4",abbr:["waters"],map:function(){return GV(KH.water)}},at:{"@desc":"residues named ADA A THY T",map:function(){return GV(KH.at)}},acidic:{"@desc":"residues named ASP GLU",map:function(){return GV(KH.acidic)}}
139,acyclic:{"@desc":'"protein and not cyclic"',map:function(){return UH.struct.modifier.intersectBy({0:jH(),by:MV(GV(KH.cyclic))})}},aliphatic:{"@desc":"residues named ALA GLY ILE LEU VAL",map:function(){return GV(KH.aliphatic)}},alpha:{"@desc":"atom's residue is an alpha helix",map:function(){return VH(["alpha"])}},amino:{"@desc":"a residue with atoms named C, N, CA, and O",map:function(){return jH()}},aromatic:{"@desc":"residues named HIS PHE TRP TYR",map:function(){return GV(KH.aromatic)}},basic:{"@desc":"residues named ARG HIS LYS",map:function(){return GV(KH.basic)}},bonded:{"@desc":"atoms for which numbonds > 0",map:function(){return FV(UH.struct.filter.pick({0:UH.struct.modifier.includeConnected({0:UH.struct.generator.all(),"bond-test":UH.core.flags.hasAny([UH.struct.bondProperty.flags(),UH.struct.type.bondFlags(["covalent","metallic","sulfide"])])}),test:UH.core.rel.gr([UH.struct.atomSet.atomCount(),1])}))}},buried:{"@desc":"residues named ALA LEU VAL ILE PHE CYS MET TRP",map:function(){return GV(KH.buried)}},cg:{"@desc":"residues named CYT C GUA G",map:function(){return GV(KH.cg)}},charged:{"@desc":'"basic or acidic"',map:function(){return GV(KH.basic.concat(KH.acidic))}},cyclic:{"@desc":"residues named HIS PHE PRO TRP TYR",map:function(){return GV(KH.cyclic)}},hetero:{"@desc":'"not (protein or nucleic)"',map:function(){return MV(UH.struct.combinator.merge([jH(),zH()]))}},hydrogen:{"@desc":'name "[0-9]?H.*"',map:function(){return UH.struct.generator.atomGroups({"atom-test":UH.core.str.match([UH.core.type.regex(["^[0-9]?[H].*$","i"]),UH.core.type.str([UH.ammp("label_atom_id")])])})}},large:{"@desc":'"protein and not (small or medium)"',map:function(){return UH.struct.modifier.intersectBy({0:jH(),by:MV(GV(KH.small.concat(KH.medium)))})}},medium:{"@desc":"residues named VAL THR ASP ASN PRO CYS ASX PCA HYP",map:function(){return GV(KH.medium)}},neutral:{"@desc":"residues named VAL PHE GLN TYR HIS CYS MET TRP ASX GLX PCA HYP",map:function(){return GV(KH.neutral)}},hydrophobic:{"@desc":"hydrophobic resname ALA LEU VAL ILE PRO PHE MET TRP",map:function(){return GV(KH.hydrophobic)}},polar:{"@desc":'"protein and not hydrophobic"',map:function(){return UH.struct.modifier.intersectBy({0:jH(),by:MV(GV(KH.hydrophobic))})}},purine:{"@desc":"residues named ADE A GUA G",map:function(){return GV(KH.purine)}},pyrimidine:{"@desc":"residues named CYT C THY T URI U",map:function(){return GV(KH.pyrimidine)}},small:{"@desc":"residues named ALA GLY SER",map:function(){return GV(KH.small)}},surface:{"@desc":'"protein and not buried"',map:function(){return UH.struct.modifier.intersectBy({0:jH(),by:MV(GV(KH.buried))})}},alpha_helix:{"@desc":"atom's residue is in an alpha helix",map:function(){return VH(["alpha"])}},pi_helix:{"@desc":"atom's residue is in a pi helix",map:function(){return VH(["pi"])}},helix_3_10:{"@desc":"atom's residue is in a 3-10 helix",map:function(){return VH(["3-10"])}},helix:{"@desc":"atom's residue is in an alpha or pi or 3-10 helix",map:function(){return VH(["helix"])}},extended_beta:{"@desc":"atom's residue is a beta sheet",map:function(){return VH(["sheet"])}},bridge_beta:{"@desc":"atom's residue is a beta sheet",map:function(){return VH(["strand"])}},sheet:{"@desc":"atom's residue is a beta sheet",map:function(){return VH(["beta"])}},turn:{"@desc":"atom's residue is in a turn conformation",map:function(){return VH(["turn"])}},coil:{"@desc":"atom's residue is in a coil conformation",map:function(){return UH.struct.modifier.intersectBy({0:jH(),by:VH(["none"])})}}},QH=SL,JH={sqr:{"@desc":"square of x","@examples":["sqr(2)"],map:function(e){return QH.core.math.pow([e,2])}},sqrt:{"@desc":"square root of x","@examples":["sqrt(2)"],map:function(e){return QH.core.math.sqrt([e])}},abs:{"@desc":"absolute value of x","@examples":["abs(2)"],map:function(e){return QH.core.math.abs([e])}},floor:{"@desc":"largest integer not greater than x","@examples":["floor(2)"],map:function(e){return QH.core.math.floor([e])}},ceil:{"@desc":"smallest integer not less than x","@examples":["ceil(2)"],map:function(e){return QH.core.math.ceil([e])}},sin:{"@desc":"sine of x","@examples":["sin(2)"],map:function(e){return QH.core.math.sin([e])}},cos:{"@desc":"cosine of x","@examples":["cos(2)"],map:function(e){return QH.core.math.cos([e])}},tan:{"@desc":"tangent of x","@examples":["tan(2)"],map:function(e){return QH.core.math.tan([e])}},atan:{"@desc":"arctangent of x","@examples":["atan(2)"],map:function(e){return QH.core.math.atan([e])}},asin:{"@desc":"arcsin of x","@examples":["asin(2)"],map:function(e){return QH.core.math.asin([e])}},acos:{"@desc":"arccos of x","@examples":["acos(2)"],map:function(e){return QH.core.math.acos([e])}}
139,sinh:{"@desc":"hyperbolic sine of x","@examples":["sinh(2)"],map:function(e){return QH.core.math.sinh([e])}},cosh:{"@desc":"hyperbolic cosine of x","@examples":["cosh(2)"],map:function(e){return QH.core.math.cosh([e])}},tanh:{"@desc":"hyperbolic tangent of x","@examples":["tanh(2)"],map:function(e){return QH.core.math.tanh([e])}},exp:{"@desc":"e to the power x","@examples":["exp(2)"],map:function(e){return QH.core.math.exp([e])}},log:{"@desc":"natural log of x","@examples":["log(2)"],map:function(e){return QH.core.math.log([e])}},log10:{"@desc":"log base 10 of x","@examples":["log10(2)"],map:function(e){return QH.core.math.log10([e])}}},eq=SL,tq=[{"@desc":"multiplication, division","@examples":[],name:"mul-div",type:_V,rule:dV.regexp(/\s*(\*|\/)\s*/,1),map:function(e,t,r){switch(e){case"*":return eq.core.math.mult([t,r]);case"/":return eq.core.math.div([t,r]);default:throw Error(`value operator '${e}' not supported`)}}},{"@desc":"addition, substraction","@examples":[],name:"add-sub",type:_V,rule:dV.regexp(/\s*(-|\+)\s*/,1),map:function(e,t,r){switch(e){case"-":return eq.core.math.sub([t,r]);case"+":return eq.core.math.add([t,r]);default:throw Error(`value operator '${e}' not supported`)}}},{"@desc":"value comparisons","@examples":[],name:"comparison",type:_V,rule:dV.alt(dV.regexp(/\s*(=~|==|>=|<=|=|!=|>|<)\s*/,1),dV.whitespace.result("=")),map:function(e,t,r){var n;if(void 0===t.head?void 0===r.head?"=~"===e&&(n=t.head?eq.core.str.match([eq.core.type.regex([`^${r}$`,"i"]),eq.core.type.str([t])]):eq.core.str.match([eq.core.type.regex([`^${t}$`,"i"]),eq.core.type.str([r])])):("structure-query.atom-property.macromolecular.secondary-structure-flags"===r.head.name&&(n=eq.core.flags.hasAny([r,BH(t)])),"core.type.regex"===r.head.name&&(n=eq.core.str.match([r,eq.core.type.str([t])]))):("structure-query.atom-property.macromolecular.secondary-structure-flags"===t.head.name&&(n=eq.core.flags.hasAny([t,BH(r)])),"core.type.regex"===t.head.name&&(n=eq.core.str.match([t,eq.core.type.str([r])]))),!n)switch(t.head&&(r=LV(t,r)),r.head&&(t=LV(r,t)),e){case"=":case"==":n=eq.core.rel.eq([t,r]);break;case"!=":n=eq.core.rel.neq([t,r]);break;case">":n=eq.core.rel.gr([t,r]);break;case"<":n=eq.core.rel.lt([t,r]);break;case">=":n=eq.core.rel.gre([t,r]);break;case"<=":n=eq.core.rel.lte([t,r]);break;default:throw Error(`value operator '${e}' not supported`)}return eq.struct.generator.atomGroups({"atom-test":n})}}],rq=dV.createLanguage({Parens:function(e){return dV.alt(e.Parens,e.Operator,e.Expression).wrap(dV.string("("),dV.string(")"))},Expression:function(e){return dV.alt(e.RangeListProperty,e.ValueQuery,e.Keywords)},NamedAtomProperties:function(){var e;return(e=dV).alt.apply(e,DV(NH))},Keywords:function(){var e;return(e=dV).alt.apply(e,OV(ZH))},ValueRange:function(e){return dV.seq(e.Value.skip(dV.regexp(/\s+TO\s+/i)),e.Value).map(function(e){return{range:e}})},RangeListProperty:function(e){var t;return dV.seq((t=dV).alt.apply(t,RV(NH,/\s/)).skip(dV.whitespace),dV.alt(e.ValueRange,e.Value).sepBy1(dV.whitespace)).map(function(e){var t,r=e[0],n=e[1],i=[],a=[];n.forEach(function(e){e.range?a.push(eq.core.rel.inRange([r,e.range[0],e.range[1]])):i.push(LV(r,e,RH))});var o,s,u=1===(o=a).length?o[0]:o.length>1?vV.core.logic.or(o):void 0,c=function(e,t){if(zV.includes(e.head.name)){var r=t[0].head,n=[];return t.forEach(function(e){return n.push.apply(n,e.args[0])}),vV.core.flags.hasAny([e,{head:r,args:n}])}return 1===t.length?vV.core.rel.eq([e,t[0]]):t.length>1?vV.core.set.has([vV.core.type.set(t),e]):void 0}(r,i);return s=u&&c?eq.core.logic.or([u,c]):u||c,eq.struct.generator.atomGroups(((t={})[function(e){if(e.head.name.startsWith("structure-query.atom-property.macromolecular.")){var t=e.head.name.substr(45);if($V.includes(t))return"entity-test";if(UV.includes(t))return"chain-test";if(jV.includes(t))return"residue-test"}return"atom-test"}(r)]=s,t))})},Operator:function(e){return xV($H,dV.alt(e.Parens,e.Expression,e.ValueQuery))},Query:function(e){return dV.alt(e.Operator,e.Parens,e.Expression).trim(dV.optWhitespace)},Number:function(){return dV.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/).map(Number).desc("number")},String:function(){var e=BV(NH,ZH,$H).sort(kV).map(Qg).join("|");return dV.alt(dV.regexp(RegExp(`(?!(${e}))[A-Z0-9_]+`,"i")),dV.regexp(/'((?:[^"\\]|\\.)*)'/,1),dV.regexp(/"((?:[^"\\]|\\.)*)"/,1).map(function(e){return eq.core.type.regex([`^${e}$`,"i"])})).desc("string")},Value:function(e){return dV.alt(e.Number,e.String)},ValueParens:function(e){return dV.alt(e.ValueParens,e.ValueOperator,e.ValueExpressions).wrap(dV.string("("),dV.string(")"))},ValuePropertyNames:function(){var e;return(e=dV).alt.apply(e,RV(NH,/=~|==|>=|<=|=|!=|>|<|\)|\s|\+|-|\*|\//i))},ValueOperator:function(e){return xV(tq,dV.alt(e.ValueParens,e.ValueExpressions))},ValueExpressions:function(e){return dV.alt(e.ValueFunctions,e.Value,e.ValuePropertyNames)},ValueFunctions:function(e){var t;return(t=dV).alt.apply(t,function(e,t){var r=[],n=dV.regexp(/\(\s*/),i=dV.regexp(/\s*\)/);
139return Object.keys(e).sort(kV).forEach(function(a){var o=e[a],s=o.map?o.map:TV(`function '${a}' not supported`),u=dV.regexp(new RegExp(a,"i")).skip(n).then(t).skip(i).map(s);r.push(u)}),r}(JH,e.ValueOperator))},ValueQuery:function(e){return dV.alt(e.ValueOperator.map(function(e){if(e.head.name&&e.head.name.startsWith("structure-query.generator"))return e;throw Error(`values must be part of an comparison, value '${e}'`)}))}}),nq={pymol:function(e){return EH.Query.tryParse(e)},vmd:function(e){return rq.Query.tryParse(e)},jmol:function(e){return uH.Query.tryParse(e)}},iq=new(function(){function e(){this.map=new Map}return e.prototype.removeSymbol=function(e){this.map.delete(e.symbol.id)},e.prototype.addSymbol=function(e){this.map.has(e.symbol.id)&&console.warn(`Symbol '${e.symbol.id}' already added. Call removeSymbol/removeCustomProps re-adding the symbol.`),this.map.set(e.symbol.id,e)},e.prototype.addCustomProp=function(e){if(e.symbols)for(var t=0,r=Object.keys(e.symbols);t<r.length;t++){var n=r[t];this.addSymbol(e.symbols[n])}},e.prototype.removeCustomProp=function(e){if(e.symbols)for(var t=0,r=Object.keys(e.symbols);t<r.length;t++){var n=r[t];this.removeSymbol(e.symbols[n])}},e.prototype.getRuntime=function(e){return this.map.get(e)},e}()),aq=function(e){this.table=e,this.constQueryContext=new _U(yz.Empty)};(function(e){e.Const=function(e){return{kind:"const",value:e}},e.Dynamic=function(e){return{kind:"dynamic",runtime:e}}})(HH||={}),function(e){e.Const=function(e){return{isConst:!0,fn:function(t){return e}}},e.Dynamic=function(e){return{isConst:!1,fn:e}}}(qH||={}),function(e){e.forEachEval=function(e,t,r,n){if("number"==typeof e.length)for(var i=0,a=e.length;i<a;i++)r(e[i](t),i,n);else{i=0;for(var o=0,s=Object.keys(e);o<s.length;o++)r(e[s[o]](t),i++,n)}return n}}(WH||={}),function(e){e.Const=function(e,t){return new oq(e,t,!0)},e.Dynamic=function(e,t){return new oq(e,t,!1)}}(XH||={});var oq=function(){function e(e,t,r){this.symbol=e,this.fn=t,this.isConst=r}return e.prototype.compile=function(e,t){var r,n=!1;if(t)if(XF.isArgumentsArray(t)){r=[],n=!0;for(var i=0,a=t;i<a.length;i++){var o=sq(e,a[i]);n&&=o.isConst,r.push(o.fn)}}else{r=Object.create(null),n=!0;for(var s=0,u=Object.keys(t);s<u.length;s++){var c=u[s];o=sq(e,t[c]),n&&=o.isConst,r[c]=o.fn}}else r=void 0,n=!0;return this.isConst&&this.isConst&&n?qH.Const(this.fn(e.constQueryContext,r)):qH.Dynamic(function(e,t){return function(r){return e(r,t)}}(this.fn,r))},e}();function sq(e,t){if(XF.isLiteral(t))return qH.Const(t);if(XF.isSymbol(t)){var r=e.table.getRuntime(t.name);return r?r.compile(e):qH.Const(t.name)}if(!XF.isSymbol(t.head))throw Error("Can only apply symbols.");var n=e.table.getRuntime(t.head.name);if(!n)throw Error(`Symbol '${t.head.name}' is not implemented.`);return n.compile(e,t.args)}function uq(e){return sq(new aq(iq),e).fn}var cq=XH.Const,lq=XH.Dynamic,dq=[cq(xL.core.type.bool,function(e,t){return!!t[0](e)}),cq(xL.core.type.num,function(e,t){return+t[0](e)}),cq(xL.core.type.str,function(e,t){return""+t[0](e)}),cq(xL.core.type.list,function(e,t){return WH.forEachEval(t,e,function(e,t,r){return r[t]=e},[])}),cq(xL.core.type.set,function(e,t){return WH.forEachEval(t,e,function(e,t,r){return r.add(e)},new Set)}),cq(xL.core.type.regex,function(e,t){return new RegExp(t[0](e),t[1]&&t[1](e)||"")}),cq(xL.core.type.bitflags,function(e,t){return+t[0](e)}),cq(xL.core.type.compositeKey,function(e,t){return WH.forEachEval(t,e,function(e,t,r){return r[t]=""+e},[]).join("-")}),cq(xL.core.logic.not,function(e,t){return!t[0](e)}),cq(xL.core.logic.and,function(e,t){if("number"==typeof t.length){for(var r=0,n=t.length;r<n;r++)if(!t[r](e))return!1}else for(var i=0,a=Object.keys(t);i<a.length;i++)if(!t[a[i]](e))return!1;return!0}),cq(xL.core.logic.or,function(e,t){if("number"==typeof t.length){for(var r=0,n=t.length;r<n;r++)if(t[r](e))return!0}else for(var i=0,a=Object.keys(t);i<a.length;i++)if(t[a[i]](e))return!0;return!1}),cq(xL.core.rel.eq,function(e,t){return t[0](e)===t[1](e)}),cq(xL.core.rel.neq,function(e,t){return t[0](e)!==t[1](e)}),cq(xL.core.rel.lt,function(e,t){return t[0](e)<t[1](e)}),cq(xL.core.rel.lte,function(e,t){return t[0](e)<=t[1](e)}),cq(xL.core.rel.gr,function(e,t){return t[0](e)>t[1](e)}),cq(xL.core.rel.gre,function(e,t){return t[0](e)>=t[1](e)}),cq(xL.core.rel.inRange,function(e,t){var r=t[0](e);return r>=t[1](e)&&r<=t[2](e)}),cq(xL.core.math.add,function(e,t){var r=0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r+=t[n](e);else for(var a=0,o=Object.keys(t);a<o.length;a++)r+=t[o[a]](e);return r}),cq(xL.core.math.sub,function(e,t){var r=0;if("number"==typeof t.length){if(1===t.length)return-t[0](e);r=t[0](e)||0;for(var n=1,i=t.length;n<i;n++)r-=t[n](e)}else{var a=Object.keys(t);if(1===a.length)return-t[a[0]](e);for(r=t[a[0]](e)||0,n=1,i=a.length;n<i;n++)r-=t[a[n]](e)}return r}),cq(xL.core.math.mult,function(e,t){var r=1;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r*=t[n](e);else for(var a=0,o=Object.keys(t);a<o.length;a++)r*=t[o[a]](e);return r}),cq(xL.core.math.div,function(e,t){return t[0](e)/t[1](e)}),cq(xL.core.math.pow,function(e,t){return t[0](e)**+t[1](e)}),cq(xL.core.math.mod,function(e,t){return t[0](e)%t[1](e)}),cq(xL.core.math.min,function(e,t){var r=1/0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=Math.min(t[n](e),r);else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];r=Math.min(t[s](e),r)}return r}),cq(xL.core.math.max,function(e,t){var r=-1/0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=Math.max(t[n](e),r);else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];r=Math.max(t[s](e),r)}return r}),cq(xL.core.math.cantorPairing,function(e,t){return Ev(t[0](e),t[1](e))}),cq(xL.core.math.sortedCantorPairing,function(e,t){return Mv(t[0](e),t[1](e))}),cq(xL.core.math.invertCantorPairing,function(e,t){return kv([0,0],t[0](e))}),cq(xL.core.math.floor,function(e,t){return Math.floor(t[0](e))}),cq(xL.core.math.ceil,function(e,t){return Math.ceil(t[0](e))}),cq(xL.core.math.roundInt,function(e,t){return Math.round(t[0](e))}),cq(xL.core.math.trunc,function(e,t){return Math.trunc(t[0](e))}),cq(xL.core.math.abs,function(e,t){return Math.abs(t[0](e))}),cq(xL.core.math.sign,function(e,t){return Math.sign(t[0](e))}),cq(xL.core.math.sqrt,function(e,t){return Math.sqrt(t[0](e))}),cq(xL.core.math.cbrt,function(e,t){return Math.cbrt(t[0](e))}),cq(xL.core.math.sin,function(e,t){return Math.sin(t[0](e))}),cq(xL.core.math.cos,function(e,t){return Math.cos(t[0](e))}),cq(xL.core.math.tan,function(e,t){return Math.tan(t[0](e))}),cq(xL.core.math.asin,function(e,t){return Math.asin(t[0](e))}),cq(xL.core.math.acos,function(e,t){return Math.acos(t[0](e))}),cq(xL.core.math.atan,function(e,t){return Math.atan(t[0](e))}),cq(xL.core.math.sinh,function(e,t){return Math.sinh(t[0](e))}),cq(xL.core.math.cosh,function(e,t){return Math.cosh(t[0](e))}),cq(xL.core.math.tanh,function(e,t){return Math.tanh(t[0](e))}),cq(xL.core.math.exp,function(e,t){return Math.exp(t[0](e))}),cq(xL.core.math.log,function(e,t){return Math.log(t[0](e))}),cq(xL.core.math.log10,function(e,t){return Math.log10(t[0](e))}),cq(xL.core.math.atan2,function(e,t){return Math.atan2(t[0](e),t[1](e))}),cq(xL.core.str.match,function(e,t){return t[0](e).test(t[1](e))}),cq(xL.core.str.concat,function(e,t){var r=[];if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r.push(t[n](e).toString());else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];r.push(t[s](e).toString())}return r.join("")}),cq(xL.core.list.getAt,function(e,t){return t[0](e)[t[1](e)]}),cq(xL.core.list.equal,function(e,t){return Xb(t[0](e),t[1](e))}),cq(xL.core.set.has,function(e,t){return t[0](e).has(t[1](e))}),cq(xL.core.set.isSubset,function(e,t){return mN.isSuperset(t[1](e),t[0](e))}
139),cq(xL.core.flags.hasAny,function(e,t){var r=t[1](e),n=t[0](e);return r?!!(n&r):!!n}),cq(xL.core.flags.hasAll,function(e,t){var r=t[1](e),n=t[0](e);return r?(n&r)===r:!n}),cq(xL.structureQuery.type.elementSymbol,function(e,t){return kN(t[0](e))}),cq(xL.structureQuery.type.atomName,function(e,t){return(r=t[0](e))?"string"==typeof r?r.toUpperCase():`${r}`.toUpperCase():"";var r}),cq(xL.structureQuery.type.bondFlags,function(e,t){var r=0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=hq(r,t[n](e));else for(var a=0,o=Object.keys(t);a<o.length;a++)r=hq(r,t[o[a]](e));return r}),cq(xL.structureQuery.type.ringFingerprint,function(e,t){return z$.elementFingerprint(function(e,t){var r=[];if(!t)return r;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r.push(t[n](e));else{var a=Object.keys(t);for(n=1,i=a.length;n<i;n++)r.push(t[a[n]](e))}return r}(e,t))}),cq(xL.structureQuery.type.secondaryStructureFlags,function(e,t){var r=0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=pq(r,t[n](e));else for(var a=0,o=Object.keys(t);a<o.length;a++)r=pq(r,t[o[a]](e));return r}),lq(xL.structureQuery.filter.pick,function(e,t){return Zj.filters.pick(t[0],t.test)(e)}),lq(xL.structureQuery.filter.first,function(e,t){return Zj.filters.first(t[0])(e)}),lq(xL.structureQuery.filter.withSameAtomProperties,function(e,t){return Zj.filters.withSameAtomProperties(t[0],t.source,t.property)(e)}),lq(xL.structureQuery.filter.intersectedBy,function(e,t){return Zj.filters.areIntersectedBy(t[0],t.by)(e)}),lq(xL.structureQuery.filter.within,function(e,t){return Zj.filters.within({query:t[0],target:t.target,minRadius:t["min-radius"]?.call(t,e),maxRadius:t["max-radius"]?.call(t,e),elementRadius:t["atom-radius"],invert:t.invert?.call(t,e)})(e)}),lq(xL.structureQuery.filter.isConnectedTo,function(e,t){return Zj.filters.isConnectedTo({query:t[0],target:t.target,disjunct:t.disjunct?.call(t,e),invert:t.invert?.call(t,e),bondTest:t["bond-test"]})(e)}),lq(xL.structureQuery.generator.atomGroups,function(e,t){return Zj.generators.atoms({entityTest:t["entity-test"],chainTest:t["chain-test"],residueTest:t["residue-test"],atomTest:t["atom-test"],groupBy:t["group-by"]})(e)}),lq(xL.structureQuery.generator.all,function(e){return Zj.generators.all(e)}),lq(xL.structureQuery.generator.empty,function(e){return Zj.generators.none(e)}),lq(xL.structureQuery.generator.bondedAtomicPairs,function(e,t){return Zj.generators.bondedAtomicPairs(t&&t[0])(e)}),lq(xL.structureQuery.generator.rings,function(e,t){return Zj.generators.rings((t?.fingerprint)?.call(t,e),(t?.["only-aromatic"])?.call(t,e))(e)}),lq(xL.structureQuery.generator.queryInSelection,function(e,t){return Zj.generators.querySelection(t[0],t.query,t["in-complement"]?.call(t,e))(e)}),lq(xL.structureQuery.modifier.includeSurroundings,function(e,t){return Zj.modifiers.includeSurroundings(t[0],{radius:t.radius(e),wholeResidues:!(!t["as-whole-residues"]||!t["as-whole-residues"](e)),elementRadius:t["atom-radius"]})(e)}),lq(xL.structureQuery.modifier.surroundingLigands,function(e,t){return Zj.modifiers.surroundingLigands({query:t[0],radius:t.radius(e),includeWater:!(!t["include-water"]||!t["include-water"](e))})(e)}),lq(xL.structureQuery.modifier.wholeResidues,function(e,t){return Zj.modifiers.wholeResidues(t[0])(e)}),lq(xL.structureQuery.modifier.union,function(e,t){return Zj.modifiers.union(t[0])(e)}),lq(xL.structureQuery.modifier.expandProperty,function(e,t){return Zj.modifiers.expandProperty(t[0],t.property)(e)}),lq(xL.structureQuery.modifier.exceptBy,function(e,t){return Zj.modifiers.exceptBy(t[0],t.by)(e)}),lq(xL.structureQuery.modifier.includeConnected,function(e,t){var r;return Zj.modifiers.includeConnected({query:t[0],bondTest:t["bond-test"],wholeResidues:!(!t["as-whole-residues"]||!t["as-whole-residues"](e)),layerCount:t["layer-count"]&&t["layer-count"](e)||1,fixedPoint:null!=(r=t["fixed-point"]?.call(t,e))&&r})(e)}),lq(xL.structureQuery.modifier.intersectBy,function(e,t){return Zj.modifiers.intersectBy(t[0],t.by)(e)}),lq(xL.structureQuery.combinator.merge,function(e,t){return Zj.combinators.merge(t)(e)}),lq(xL.structureQuery.atomProperty.core.elementSymbol,fq(Cj.atom.type_symbol)),lq(xL.structureQuery.atomProperty.core.vdw,function(e,t){return UU(Cj.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))}),lq(xL.structureQuery.atomProperty.core.mass,function(e,t){return function(e){var t=FU[e];return void 0===t?10.81:$U[t]}(Cj.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))}),lq(xL.structureQuery.atomProperty.core.atomicNumber,function(e,t){return jU(Cj.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))}),lq(xL.structureQuery.atomProperty.core.x,fq(Cj.atom.x)),lq(xL.structureQuery.atomProperty.core.y,fq(Cj.atom.y)),lq(xL.structureQuery.atomProperty.core.z,fq(Cj.atom.z)),lq(xL.structureQuery.atomProperty.core.sourceIndex,fq(Cj.atom.sourceIndex)),lq(xL.structureQuery.atomProperty.core.operatorName,fq(Cj.unit.operator_name)),lq(xL.structureQuery.atomProperty.core.operatorKey,fq(Cj.unit.operator_key)),lq(xL.structureQuery.atomProperty.core.modelIndex,fq(Cj.unit.model_index)),lq(xL.structureQuery.atomProperty.core.modelLabel,fq(Cj.unit.model_label)),lq(xL.structureQuery.atomProperty.core.atomKey,function(e,t){var r=t&&t[0]&&t[0](e)||e.element;return Ev(r.unit.id,r.element)}),lq(xL.structureQuery.atomProperty.macromolecular.residueKey,function(e,t){return function(e){return tU.isAtomic(e.unit)?e.unit.residueIndex[e.element]:-1}(t&&t[0]&&t[0](e)||e.element)}),lq(xL.structureQuery.atomProperty.macromolecular.chainKey,function(e,t){return function(e){return tU.isAtomic(e.unit)?e.unit.chainIndex[e.element]:-1}(t&&t[0]&&t[0](e)||e.element)}),lq(xL.structureQuery.atomProperty.macromolecular.entityKey,function(e,t){return function(e){return Cj.entity.key(e)}(t&&t[0]&&t[0](e)||e.element)}),lq(xL.structureQuery.atomProperty.macromolecular.id,fq(Cj.atom.id)),lq(xL.structureQuery.atomProperty.macromolecular.isHet,function(e,t){return"ATOM"!==Cj.residue.group_PDB(t&&t[0]&&t[0](e)||e.element)}),lq(xL.structureQuery.atomProperty.macromolecular.label_atom_id,fq(Cj.atom.label_atom_id)),lq(xL.structureQuery.atomProperty.macromolecular.label_alt_id,fq(Cj.atom.label_alt_id)),lq(xL.structureQuery.atomProperty.macromolecular.label_comp_id,fq(Cj.atom.label_comp_id)),lq(xL.structureQuery.atomProperty.macromolecular.label_seq_id,fq(Cj.residue.label_seq_id)),lq(xL.structureQuery.atomProperty.macromolecular.label_asym_id,fq(Cj.chain.label_asym_id)),lq(xL.structureQuery.atomProperty.macromolecular.label_entity_id,fq(Cj.entity.id)),lq(xL.structureQuery.atomProperty.macromolecular.auth_atom_id,fq(Cj.atom.auth_atom_id)),lq(xL.structureQuery.atomProperty.macromolecular.auth_comp_id,fq(Cj.atom.auth_comp_id)),lq(xL.structureQuery.atomProperty.macromolecular.auth_seq_id,fq(Cj.residue.auth_seq_id)),lq(xL.structureQuery.atomProperty.macromolecular.auth_asym_id,fq(Cj.chain.auth_asym_id)),lq(xL.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,fq(Cj.residue.pdbx_PDB_ins_code)),lq(xL.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,fq(Cj.atom.pdbx_formal_charge)),lq(xL.structureQuery.atomProperty.macromolecular.occupancy,fq(Cj.atom.occupancy)),lq(xL.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,fq(Cj.atom.B_iso_or_equiv)),lq(xL.structureQuery.atomProperty.macromolecular.entityType,fq(Cj.entity.type)),lq(xL.structureQuery.atomProperty.macromolecular.entitySubtype,fq(Cj.entity.subtype)),lq(xL.structureQuery.atomProperty.macromolecular.entityPrdId,fq(Cj.entity.prd_id)),lq(xL.structureQuery.atomProperty.macromolecular.entityDescription,fq(Cj.entity.pdbx_description)),lq(xL.structureQuery.atomProperty.macromolecular.objectPrimitive,fq(Cj.unit.object_primitive)),lq(xL.structureQuery.atomProperty.macromolecular.isNonStandard,fq(Cj.residue.isNonStandard)),lq(xL.structureQuery.atomProperty.macromolecular.secondaryStructureKey,fq(Cj.residue.secondary_structure_key)),lq(xL.structureQuery.atomProperty.macromolecular.secondaryStructureFlags,fq(Cj.residue.secondary_structure_type)),lq(xL.structureQuery.atomProperty.macromolecular.chemCompType,fq(Cj.residue.chem_comp_type)),lq(xL.structureQuery.atomSet.atomCount,function(e,t){return Zj.atomset.atomCount(e)}),lq(xL.structureQuery.atomSet.countQuery,function(e,t){return Zj.atomset.countQuery(t[0])(e)}),lq(xL.structureQuery.atomSet.propertySet,function(e,t){return Zj.atomset.propertySet(t[0])(e)}),lq(xL.structureQuery.bondProperty.order,function(e,t){return e.atomicBond.order}),lq(xL.structureQuery.bondProperty.flags,function(e,t){return e.atomicBond.type}),lq(xL.structureQuery.bondProperty.key,function(e,t){return e.atomicBond.key}),lq(xL.structureQuery.bondProperty.atomA,function(e,t){return e.atomicBond.a}),lq(xL.structureQuery.bondProperty.atomB,function(e,t){return e.atomicBond.b}),lq(xL.structureQuery.bondProperty.length,function(e,t){return e.atomicBond.length}),lq(xL.internal.generator.bundleElement,function(e,t){return gU(t.groupedUnits(e),t.ranges(e),t.set(e))}),lq(xL.internal.generator.bundle,function(e,t){return vU(t.elements(e))(e)}),lq(xL.internal.generator.current,function(e,t){return e.tryGetCurrentSelection()})];function fq(e){return function(t,r){return e(r&&r[0]&&r[0](t)||t.element)}}
139function hq(e,t){return e|(RN.isName(t)?RN.fromName(t):0)}function pq(e,t){switch(t.toLowerCase()){case"helix":return 2|e;case"alpha":return 4098|e;case"pi":return 32770|e;case"310":return 2050|e;case"beta":return 4|e;case"strand":return 4194308|e;case"sheet":return 8388612|e;case"turn":return 16|e;case"bend":return 8|e;case"coil":return 536870912|e;default:return e}}function mq(e,t){return{expression:e,language:t}}(function(){for(var e=0,t=dq;e<t.length;e++){var r=t[e];iq.addSymbol(r)}})(),function(e){function t(e){switch(e.language){case"mol-script":var t=(r=e.expression,lV.parse(r));if(0===t.length)throw Error("No query");return cV(t[0]);case"pymol":case"jmol":case"vmd":return function(e,t){try{return nq[e](t)}catch(e){throw console.error(e.message),e}}(e.language,e.expression);default:Lg(e.language)}var r}function r(e){return uq(t(e))}e.Info={"mol-script":"Mol-Script",pymol:"PyMOL",vmd:"VMD",jmol:"Jmol"},e.is=function(e){return!!e&&"string"==typeof e.expression&&!!e.language},e.areEqual=function(e,t){return e.language===t.language&&e.expression===t.expression},e.toExpression=t,e.toQuery=r,e.toLoci=function(e,t){var n=r(e)(new _U(t));return oU.toLociWithSourceUnits(n)},e.getStructureSelection=function(e,t,r){return uq("function"==typeof e?e(SL):e)(new _U(t,r))}}(mq||={});var gq,vq,yq={dynamicBonds:Ib.Optional(Ib.Boolean(!1,{description:"Ensure bonds are recalculated upon model changes. Also enables calculation of inter-unit bonds in water molecules and ions."}))};(function(e){function t(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return a=void 0,o=Dz.Provider.get(r),!n&&o&&0!==o.assemblies.length&&(n=o.assemblies[0].id),o&&0!==o.assemblies.length?(a=jF.findAssembly(r,n||""))||e.log.warn(`Model '${r.entryId}' has no assembly called '${n}', returning model structure.`):e.log.warn(`Model '${r.entryId}' has no assembly, returning model structure.`),s=yz.ofModel(r,i),a?(n=a.id,[4,Kj.buildAssembly(s,n).runInContext(t)]):(u={label:"Model",description:yz.elementDescription(s)},[2,new DS.Molecule.Structure(s,u)]);case 1:return c=d.sent(),l={label:`Assembly ${n}`,description:yz.elementDescription(c)},[2,new DS.Molecule.Structure(c,l)]}})})}function r(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s;return Pc(this,function(u){switch(u.label){case 0:return a=yz.ofModel(t,i),[4,Kj.buildSymmetryRange(a,r,n).runInContext(e)];case 1:return o=u.sent(),s={label:`Symmetry [${r}] to [${n}]`,description:yz.elementDescription(o)},[2,new DS.Molecule.Structure(o,s)]}})})}function n(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o;return Pc(this,function(s){switch(s.label){case 0:return i=yz.ofModel(t,n),[4,Kj.builderSymmetryMates(i,r).runInContext(e)];case 1:return a=s.sent(),o={label:"Symmetry Mates",description:yz.elementDescription(a)},[2,new DS.Molecule.Structure(a,o)]}})})}function i(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s;return Pc(this,function(u){switch(u.label){case 0:return a=yz.ofModel(t,i),[4,Kj.buildSymmetryAssembly(a,r,n).runInContext(e)];case 1:return o=u.sent(),s={label:"Symmetry Assembly",description:yz.elementDescription(o)},[2,new DS.Molecule.Structure(o,s)]}})})}e.getParams=function(e,t){var r=e&&Dz.Provider.get(e),n=r?r.assemblies.map(function(e){return[e.id,`${e.id}: ${Yg(e.details)}`]}):[],i=!r||!LE.isZero(r.spacegroup.cell),a=[];if(r)for(var o=r.spacegroup.operators,s=0,u=o.length;s<u;s++)a.push([s,`${s+1}: ${$E.getOperatorXyz(o[s])}`]);var c=[];e&&e.properties.structAsymMap.forEach(function(e){var t=e.id===e.auth_id?e.id:`${e.id} [auth ${e.auth_id}]`;c.push([e.id,t])});var l={auto:Ib.Group(yq),model:Ib.Group(yq),assembly:Ib.Group(Ac({id:Ib.Optional(e?Ib.Select(n.length?n[0][0]:"",n,{label:"Asm Id",description:"Assembly Id"}):Ib.Text("",{label:"Asm Id",description:"Assembly Id (use empty for the 1st assembly)"}))},yq),{isFlat:!0}),"symmetry-mates":Ib.Group(Ac({radius:Ib.Numeric(5,{min:0,max:50,step:1})},yq),{isFlat:!0}),symmetry:Ib.Group(Ac({ijkMin:Ib.Vec3(Cg.create(-1,-1,-1),{step:1},{label:"Min IJK",fieldLabels:{x:"I",y:"J",z:"K"}}),ijkMax:Ib.Vec3(Cg.create(1,1,1),{step:1},{label:"Max IJK",fieldLabels:{x:"I",y:"J",z:"K"}})},yq),{isFlat:!0}),"symmetry-assembly":Ib.Group(Ac({generators:Ib.ObjectList({operators:Ib.ObjectList({index:Ib.Select(0,a),shift:Ib.Vec3(Cg(),{step:1},{label:"IJK",fieldLabels:{x:"I",y:"J",z:"K"}})},function(e){return`${e.index+1}_${e.shift.map(function(e){return e+5}).join("")}`},{defaultValue:[]}),asymIds:Ib.MultiSelect([],c)},function(e){return`${e.asymIds.length} asym ids, ${e.operators.length} operators`},{defaultValue:[]})},yq),{isFlat:!0})},d=[];return"auto"===t&&d.push(["auto","Auto"]),d.push(["model","Model"]),n.length>0&&d.push(["assembly","Assembly"]),i&&(d.push(["symmetry-mates","Symmetry Mates"]),d.push(["symmetry","Symmetry (indices)"]),d.push(["symmetry-assembly","Symmetry (assembly)"])),{type:Ib.MappedStatic(t||"model",l,{options:d})}},e.canAutoUpdate=function(e,t){return"symmetry-assembly"!==t.name&&("symmetry"!==t.name||"symmetry"!==e.name)},e.create=function(e,a,o,s){return Tc(this,void 0,void 0,function(){var u,c,l;return Pc(this,function(d){return u=s?.params,(c=Dz.Provider.get(o))&&s&&"model"!==s.name?"auto"===s.name?0===c.assemblies.length?(l=yz.ofModel(o,u),[2,new DS.Molecule.Structure(l,{label:"Model",description:yz.elementDescription(l)})]):[2,t(e,a,o,void 0,u)]:"assembly"===s.name?[2,t(e,a,o,s.params.id,u)]:"symmetry"===s.name?[2,r(a,o,s.params.ijkMin,s.params.ijkMax,u)]:"symmetry-mates"===s.name?[2,n(a,o,s.params.radius,u)]:"symmetry-assembly"===s.name?[2,i(a,o,s.params.generators,c,u)]:(Lg(),[2]):(l=yz.ofModel(o,u),[2,new DS.Molecule.Structure(l,{label:"Model",description:yz.elementDescription(l)})])})})}})(gq||={}),function(e){function t(e,t){var r=mq.is(t)?t:void 0,n=mq.is(t)?mq.toExpression(t):t;return{script:r,expression:n,compiled:uq(n),originalStructure:e,currentStructure:e}}function r(e,t){return e.compiled(new _U(t))}e.isUnchanged=function(e,t,r){return e.currentStructure===r&&(mq.is(t)?!!e.script&&mq.areEqual(e.script,t):e.expression===t)},e.create=t,e.run=r,e.createAndRun=function(e,n){var i=t(e,n);return{entry:i,selection:r(i,e)}},e.updateStructure=function(e,t){return e.currentStructure=t,e.compiled(new _U(t))}
139,e.updateStructureObject=function(e,t,r){var n=oU.unionStructure(t);e.label=`${r||"Selection"}`,e.description=yz.elementDescription(n),e.data=n}}(vq||={});var bq,_q=new Set(["LI","NA","K","RB","CS","FR"]),xq=new Set(["BE","MG","CA","SR","BA","RA"]),Sq=new Set(["ZN","GA","CD","IN","SN","HG","TI","PB","BI","PO","CN"]),wq=new Set(["F","CL","BR","I","AT"]);function Aq(e){return wq.has(e)}function Cq(e){var t=jU(e);return t>=21&&t<=29||t>=39&&t<=47||t>=72&&t<=79||t>=104&&t<=108}function Tq(e){return function(e){return _q.has(e)}(e)||function(e){return xq.has(e)}(e)||function(e){var t=jU(e);return t>=57&&t<=71}(e)||function(e){var t=jU(e);return t>=89&&t<=103}(e)||Cq(e)||function(e){return Sq.has(e)}(e)}function Pq(e,t,r){var n;return void 0===r&&(r={}),{label:e,expression:t,description:r.description||"",category:r.category??bq.Misc,isHidden:!!r.isHidden,priority:r.priority||0,referencesCurrent:!!r.referencesCurrent,get query(){return n||=uq(t),n},ensureCustomProperties:r.ensureCustomProperties,getSelection:function(e,i,a){return Tc(this,void 0,void 0,function(){var o,s;return Pc(this,function(u){switch(u.label){case 0:return o=e.managers.structure.selection.getStructure(a),s=o?oU.Sequence(a,[o]):oU.Empty(a),r.ensureCustomProperties?[4,r.ensureCustomProperties({runtime:i,assetManager:e.managers.asset},a)]:[3,2];case 1:u.sent(),u.label=2;case 2:return n||=uq(t),[2,n(new _U(a,{currentSelection:s}))]}})})}}}!function(e){e.Type="Type",e.Structure="Structure Property",e.Atom="Atom Property",e.Bond="Bond Property",e.Residue="Residue Property",e.AminoAcid="Amino Acid",e.NucleicBase="Nucleic Base",e.Manipulate="Manipulate Selection",e.Validation="Validation",e.Misc="Miscellaneous",e.Internal="Internal"}(bq||={});var Eq=Pq("All",SL.struct.generator.all(),{category:"",priority:1e3}),Mq=Pq("Current Selection",SL.internal.generator.current(),{category:"",referencesCurrent:!0}),kq=Pq("Polymer",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.logic.and([SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),SL.core.str.match([SL.re("(polypeptide|cyclic-pseudo-peptide|peptide-like|nucleotide|peptide nucleic acid)","i"),SL.ammp("entitySubtype")])])})]),{category:bq.Type}),Iq=Pq("Trace",SL.struct.modifier.union([SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),"chain-test":SL.core.set.has([SL.set("sphere","gaussian"),SL.ammp("objectPrimitive")])})]),SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"atom-test":SL.core.set.has([SL.set("CA","P"),SL.ammp("label_atom_id")])})])])]),{category:bq.Structure}),Dq=SL.core.logic.and([SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),SL.core.str.match([SL.re("(polypeptide|cyclic-pseudo-peptide|peptide-like)","i"),SL.ammp("entitySubtype")])]),Oq=SL.core.logic.and([SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),SL.core.str.match([SL.re("(nucleotide|peptide nucleic acid)","i"),SL.ammp("entitySubtype")])]),Rq=SL.core.str.match([SL.re("non-polymer|(amino|carboxy) terminus|peptide-like","i"),SL.ammp("chemCompType")]),Bq=Pq("Backbone",SL.struct.modifier.union([SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Dq,"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([Rq]),"atom-test":SL.core.set.has([SL.set.apply(SL,mN.toArray(NN)),SL.ammp("label_atom_id")])})]),SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Oq,"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([Rq]),"atom-test":SL.core.set.has([SL.set.apply(SL,mN.toArray(FN)),SL.ammp("label_atom_id")])})])])]),{category:bq.Structure}),Nq=Pq("Sidechain",SL.struct.modifier.union([SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Dq,"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([Rq]),"atom-test":SL.core.logic.or([SL.core.logic.not([SL.core.set.has([SL.set.apply(SL,mN.toArray(NN)),SL.ammp("label_atom_id")])])])})]),SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Oq,"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([Rq]),"atom-test":SL.core.logic.or([SL.core.logic.not([SL.core.set.has([SL.set.apply(SL,mN.toArray(FN)),SL.ammp("label_atom_id")])])])})])])]),{category:bq.Structure}),Fq=Pq("Sidechain with Trace",SL.struct.modifier.union([SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Dq,"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([Rq]),"atom-test":SL.core.logic.or([SL.core.logic.not([SL.core.set.has([SL.set.apply(SL,mN.toArray(NN)),SL.ammp("label_atom_id")])]),SL.core.rel.eq([SL.ammp("label_atom_id"),"CA"]),SL.core.logic.and([SL.core.rel.eq([SL.ammp("auth_comp_id"),"PRO"]),SL.core.rel.eq([SL.ammp("label_atom_id"),"N"])])])})]),SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Oq,"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([Rq]),"atom-test":SL.core.logic.or([SL.core.logic.not([SL.core.set.has([SL.set.apply(SL,mN.toArray(FN)),SL.ammp("label_atom_id")])]),SL.core.rel.eq([SL.ammp("label_atom_id"),"P"])])})])])]),{category:bq.Structure}),Lq=Pq("Protein",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Dq})]),{category:bq.Type}),$q=Pq("Nucleic",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Oq})]),{category:bq.Type}),Uq=Pq("Helix",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Dq,"residue-test":SL.core.flags.hasA
139ny([SL.ammp("secondaryStructureFlags"),SL.core.type.bitflags([2])])})]),{category:bq.Structure,ensureCustomProperties:function(e,t){return lj.attach(e,t)}}),jq=Pq("Beta Strand/Sheet",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":Dq,"residue-test":SL.core.flags.hasAny([SL.ammp("secondaryStructureFlags"),SL.core.type.bitflags([4])])})]),{category:bq.Structure,ensureCustomProperties:function(e,t){return lj.attach(e,t)}}),zq=Pq("Water",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entityType"),"water"])})]),{category:bq.Type}),Gq=Pq("Ion",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entitySubtype"),"ion"])})]),{category:bq.Type}),Vq=Pq("Lipid",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entitySubtype"),"lipid"])})]),{category:bq.Type}),Hq=Pq("Carbohydrate",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.logic.or([SL.core.rel.eq([SL.ammp("entityType"),"branched"]),SL.core.logic.and([SL.core.rel.eq([SL.ammp("entityType"),"non-polymer"]),SL.core.str.match([SL.re("oligosaccharide","i"),SL.ammp("entitySubtype")])])])})]),{category:bq.Type}),qq=Pq("Carbohydrate with Connected",SL.struct.modifier.union([SL.struct.modifier.includeConnected({0:Hq.expression,"layer-count":1,"as-whole-residues":!0})]),{category:bq.Internal,isHidden:!0}),Wq=Pq("Connected to Carbohydrate",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:qq.expression,by:Hq.expression})]),{category:bq.Internal,isHidden:!0}),Xq=Pq("Ligand",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:SL.struct.modifier.union([SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.logic.and([SL.core.logic.or([SL.core.rel.eq([SL.ammp("entityType"),"non-polymer"]),SL.core.rel.neq([SL.ammp("entityPrdId"),""])]),SL.core.logic.not([SL.core.str.match([SL.re("(oligosaccharide|lipid|ion)","i"),SL.ammp("entitySubtype")])])]),"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.logic.not([SL.core.str.match([SL.re("saccharide","i"),SL.ammp("chemCompType")])])})]),SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":Rq})])])]),by:SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.set.has([SL.set.apply(SL,mN.toArray(uF)),SL.ammp("label_comp_id")])})]),SL.struct.generator.atomGroups({"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.core.set.has([SL.set.apply(SL,mN.toArray(tF)),SL.ammp("label_comp_id")])})])})]),{category:bq.Type}),Yq=Pq("Ligand with Connected",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:SL.struct.modifier.union([SL.struct.modifier.includeConnected({0:Xq.expression,"layer-count":1,"as-whole-residues":!0,"bond-test":SL.core.flags.hasAny([SL.struct.bondProperty.flags(),SL.core.type.bitflags([3])])})]),by:Hq.expression})]),{category:bq.Internal,isHidden:!0}),Kq=Pq("Connected to Ligand",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:Yq.expression,by:Xq.expression})]),{category:bq.Internal,isHidden:!0}),Zq=Pq("Connected to Ligand or Carbohydrate",SL.struct.modifier.union([SL.struct.combinator.merge([Wq.expression,Kq.expression])]),{category:bq.Internal,isHidden:!0}),Qq=Pq("Disulfide Bridges",SL.struct.modifier.union([SL.struct.combinator.merge([SL.struct.modifier.union([SL.struct.modifier.wholeResidues([SL.struct.filter.isConnectedTo({0:SL.struct.generator.atomGroups({"residue-test":SL.core.set.has([SL.set("CYS"),SL.ammp("auth_comp_id")]),"atom-test":SL.core.set.has([SL.set("SG"),SL.ammp("label_atom_id")])}),target:SL.struct.generator.atomGroups({"residue-test":SL.core.set.has([SL.set("CYS"),SL.ammp("auth_comp_id")]),"atom-test":SL.core.set.has([SL.set("SG"),SL.ammp("label_atom_id")])}),"bond-test":!0})])]),SL.struct.modifier.union([SL.struct.modifier.wholeResidues([SL.struct.modifier.union([SL.struct.generator.bondedAtomicPairs({0:SL.core.flags.hasA
139ny([SL.struct.bondProperty.flags(),SL.core.type.bitflags([8])])})])])])])]),{category:bq.Bond}),Jq=Pq("NOS Bridges",SL.struct.modifier.union([SL.struct.modifier.wholeResidues([SL.struct.filter.isConnectedTo({0:SL.struct.generator.atomGroups({"residue-test":SL.core.set.has([SL.set("CSO","LYS"),SL.ammp("auth_comp_id")]),"atom-test":SL.core.set.has([SL.set("OD","NZ"),SL.ammp("label_atom_id")])}),target:SL.struct.generator.atomGroups({"residue-test":SL.core.set.has([SL.set("CSO","LYS"),SL.ammp("auth_comp_id")]),"atom-test":SL.core.set.has([SL.set("OD","NZ"),SL.ammp("label_atom_id")])}),"bond-test":!0})])]),{category:bq.Bond}),eW=Pq("Non-standard Residues in Polymers",SL.struct.modifier.union([SL.struct.generator.atomGroups({"entity-test":SL.core.rel.eq([SL.ammp("entityType"),"polymer"]),"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":SL.ammp("isNonStandard")})]),{category:bq.Residue}),tW=Pq("Coarse Elements",SL.struct.modifier.union([SL.struct.generator.atomGroups({"chain-test":SL.core.set.has([SL.set("sphere","gaussian"),SL.ammp("objectPrimitive")])})]),{category:bq.Type}),rW=Pq("Rings in Residues",SL.struct.modifier.union([SL.struct.generator.rings()]),{category:bq.Residue}),nW=Pq("Aromatic Rings in Residues",SL.struct.modifier.union([SL.struct.generator.rings({"only-aromatic":!0})]),{category:bq.Residue}),iW=Pq("Surrounding Residues (5 Å) of Selection",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:SL.struct.modifier.includeSurroundings({0:SL.internal.generator.current(),radius:5,"as-whole-residues":!0}),by:SL.internal.generator.current()})]),{description:"Select residues within 5 Å of the current selection.",category:bq.Manipulate,referencesCurrent:!0}),aW=Pq("Surrounding Ligands (5 Å) of Selection",SL.struct.modifier.union([SL.struct.modifier.surroundingLigands({0:SL.internal.generator.current(),radius:5,"include-water":!0})]),{description:"Select ligand components within 5 Å of the current selection.",category:bq.Manipulate,referencesCurrent:!0}),oW=Pq("Surrounding Atoms (5 Å) of Selection",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:SL.struct.modifier.includeSurroundings({0:SL.internal.generator.current(),radius:5,"as-whole-residues":!1}),by:SL.internal.generator.current()})]),{description:"Select atoms within 5 Å of the current selection.",category:bq.Manipulate,referencesCurrent:!0}),sW=Pq("Inverse / Complement of Selection",SL.struct.modifier.union([SL.struct.modifier.exceptBy({0:SL.struct.generator.all(),by:SL.internal.generator.current()})]),{description:"Select everything not in the current selection.",category:bq.Manipulate,referencesCurrent:!0}),uW=Pq("Residues Covalently Bonded to Selection",SL.struct.modifier.union([SL.struct.modifier.includeConnected({0:SL.internal.generator.current(),"layer-count":1,"as-whole-residues":!0})]),{description:"Select residues covalently bonded to current selection.",category:bq.Manipulate,referencesCurrent:!0}),cW=Pq("Covalently Bonded Component",SL.struct.modifier.union([SL.struct.modifier.includeConnected({0:SL.internal.generator.current(),"fixed-point":!0})]),{description:"Select covalently bonded component based on current selection.",category:bq.Manipulate,referencesCurrent:!0}),lW=Pq("Residues with Cov. or Metallic Bond to Selection",SL.struct.modifier.union([SL.struct.modifier.includeConnected({0:SL.internal.generator.current(),"layer-count":1,"as-whole-residues":!0,"bond-test":SL.core.flags.hasAny([SL.struct.bondProperty.flags(),SL.core.type.bitflags([3])])})]),{description:"Select residues with covalent or metallic bond to current selection.",category:bq.Manipulate,referencesCurrent:!0}),dW=Pq("Whole Residues of Selection",SL.struct.modifier.union([SL.struct.modifier.wholeResidues({0:SL.internal.generator.current()})]),{description:"Expand current selection to whole residues.",category:bq.Manipulate,referencesCurrent:!0}),fW=[[["HIS"],"Histidine"],[["ARG"],"Arginine"],[["LYS"],"Lysine"],[["ILE"],"Isoleucine"],[["PHE"],"Phenylalanine"],[["LEU"],"Leucine"],[["TRP"],"Tryptophan"],[["ALA"],"Alanine"],[["MET"],"Methionine"],[["PRO"],"Proline"],[["CYS"],"Cysteine"],[["ASN"],"Asparagine"],[["VAL"],"Valine"],[["GLY"],"Glycine"],[["SER"],"Serine"],[["GLN"],"Glutamine"],[["TYR"],"Tyrosine"],[["ASP"],"Aspartic Acid"],[["GLU"],"Glutamic Acid"],[["THR"],"Threonine"],[["SEC"],"Selenocysteine"],[["PYL"],"Pyrrolysine"],[["UNK"],"Unknown"]].sort(function(e,t){return e[1]<t[1]?-1:+(e[1]>t[1])}),hW=[[["A","DA"],"Adenosine"],[["C","DC"],"Cytidine"],[["T","DT"],"Thymidine"],[["G","DG"],"Guanosine"],[["I","DI"],"Inosine"],[["U","DU"],"Uridine"],[["N","DN"],"Unknown"]].sort(function(e,t){return e[1]<t[1]?-1:+(e[1]>t[1])});function pW(e,t,r){var n=e[0],i=e[1];void 0===r&&(r=0);var a=1!==n.length||yW.has(n[0])?`${i} (${n.join(", ")})`:`[${n[0]}] ${i}`;return Pq(a,SL.struct.modifier.union([SL.struct.generator.atomGroups({"residue-test":SL.core.set.has([SL.set.apply(SL,n),SL.ammp("auth_comp_id")])})]),{category:t,priority:r,description:a})}var mW,gW,vW,yW=mN.unionMany(QN,rF,nF,ZN),bW={all:Eq,current:Mq,polymer:kq,trace:Iq,backbone:Bq,sidechain:Nq,sidechainWithTrace:Fq,protein:Lq,nucleic:$q,helix:Uq,beta:jq,water:zq,ion:Gq,lipid:Vq,branched:Hq,branchedPlusConnected:qq,branchedConnectedOnly:Wq,ligand:Xq,ligandPlusConnected:Yq,ligandConnectedOnly:Kq,connectedOnly:Zq,disulfideBridges:Qq,nosBridges:Jq,nonStandardPolymer:eW,coarse:tW,ring:rW,aromaticRing:nW,surroundings:iW,surroundingLigands:aW,surroundingAtoms:oW,complement:sW,covalentlyBonded:uW,covalentlyOrMetallicBonded:lW,covalentlyBondedComponent:cW,wholeResidues:dW},_W=function(){function e(){var e,t;this.list=[],this.options=[],this.version=1,(e=this.list).push.apply(e,kc(kc(kc([],Object.values(bW),!1),fW.map(function(e){return pW(e,bq.AminoAcid)}),!1),hW.map(function(e){return pW(e,bq.NucleicBase)}),!1)),(t=this.options).push.apply(t,this.list.map(function(e){return[e,e.label,e.category]}))}return e.prototype.add=function(e){this.list.push(e),this.options.push([e,e.label,e.category]),this.version+=1},e.prototype.remove=function(e){var t=this.list.indexOf(e);-1!==t&&(this.list.splice(t,1),this.options.splice(t,1),this.version+=1)},e}();function xW(e){switch(e){case 7:return-3;case 6:return-2;
139case 5:return-1;case 0:case 4:return 0;case 3:return 1;case 2:return 2;case 1:return 3;default:return console.error(`Value ${e} is outside the 0-7 range, defaulting to 0.`),0}}function SW(e,t){for(var r=$S.create(e.data,2*t),n=$S.create(e.data,2*t),i=$S.create(e.data,2*t),a=$S.create(e.data,2*t),o=$S.create(e.data,2*t),s=0;s<t;++s){fw.markLine(e);var u=e.tokenStart,c=e.position;fw.trim(e,u,u+10),$S.addUnchecked(r,e.tokenStart,e.tokenEnd),fw.trim(e,u+10,u+20),$S.addUnchecked(n,e.tokenStart,e.tokenEnd),fw.trim(e,u+20,u+30),$S.addUnchecked(i,e.tokenStart,e.tokenEnd),fw.trim(e,u+31,u+34),$S.addUnchecked(a,e.tokenStart,e.tokenEnd),fw.trim(e,u+36,u+39),$S.addUnchecked(o,e.tokenStart,e.tokenEnd),e.position=c}return{count:t,x:aw(r)(xv.Schema.float),y:aw(n)(xv.Schema.float),z:aw(i)(xv.Schema.float),type_symbol:aw(a)(xv.Schema.str),formal_charge:aw(o)(xv.Schema.int)}}function wW(e,t){for(var r=$S.create(e.data,2*t),n=$S.create(e.data,2*t),i=$S.create(e.data,2*t),a=0;a<t;++a){fw.markLine(e);var o=e.tokenStart,s=e.position;fw.trim(e,o,o+3),$S.addUnchecked(r,e.tokenStart,e.tokenEnd),fw.trim(e,o+3,o+6),$S.addUnchecked(n,e.tokenStart,e.tokenEnd),fw.trim(e,o+6,o+9),$S.addUnchecked(i,e.tokenStart,e.tokenEnd),e.position=s}return{count:t,atomIdxA:aw(r)(xv.Schema.int),atomIdxB:aw(n)(xv.Schema.int),order:aw(i)(xv.Schema.int)}}function AW(e,t,r){fw.trim(e,t+6,t+9);for(var n=parseInt(fw.getTokenString(e)),i=0;i<n;++i){var a=9+8*i;fw.trim(e,t+a,t+a+4);var o=fw.getTokenString(e);r.atomIdx.push(+o),fw.trim(e,t+a+4,t+a+8);var s=fw.getTokenString(e);r.charge.push(+s)}fw.eatLine(e)}function CW(e){for(var t={atomIdx:[],charge:[]};e.position<e.length;){var r=e.position;fw.trim(e,r+3,r+6);var n=fw.getTokenString(e);if("END"===n)break;fw.eatLine(e),"CHG"===n&&AW(e,r,t)}return{atomIdx:xv.ofIntArray(t.atomIdx),charge:xv.ofIntArray(t.charge)}}function TW(e){var t=fw(e),r=fw.readLine(t).trim(),n=fw.readLine(t).trim(),i=fw.readLine(t).trim(),a=fw.readLine(t),o=+a.substr(0,3),s=+a.substr(3,3),u={title:r,program:n,comment:i,atoms:SW(t,o),bonds:wW(t,s),formalCharges:CW(t)};return RS.success(u)}function PW(e){var t=this;return vy.create("Parse Mol",function(){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){return[2,TW(e)]})})})}function EW(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b;return Pc(this,function(_){switch(_.label){case 0:if(n=e.atoms,i=e.bonds,a=e.formalCharges,o=xv.ofConst("MOL",e.atoms.count,xv.Schema.str),s=xv.ofConst("A",e.atoms.count,xv.Schema.str),u=xv.asArrayColumn(n.type_symbol),c=xv.ofConst(1,n.count,xv.Schema.int),l=new Int32Array(e.atoms.count),a.atomIdx.rowCount>0)for(d=0;d<a.atomIdx.rowCount;d++)l[a.atomIdx.value(d)-1]=a.charge.value(d);else for(d=0;d<e.atoms.count;d++)l[d]=xW(n.formal_charge.value(d));return f=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:s,auth_atom_id:u,auth_comp_id:o,auth_seq_id:c,Cartn_x:xv.asArrayColumn(n.x,Float32Array),Cartn_y:xv.asArrayColumn(n.y,Float32Array),Cartn_z:xv.asArrayColumn(n.z,Float32Array),id:xv.range(0,n.count-1),label_asym_id:s,label_atom_id:u,label_comp_id:o,label_seq_id:c,label_entity_id:xv.ofConst("1",n.count,xv.Schema.str),occupancy:xv.ofConst(1,n.count,xv.Schema.float),type_symbol:u,pdbx_PDB_model_num:xv.ofConst(1,n.count,xv.Schema.int),pdbx_formal_charge:xv.ofIntArray(l)},n.count),(h=new BF).setNames([["MOL","Unknown Entity"]]),h.getEntityId("MOL",0,"A"),(p=new kF(c,u)).setNames([["MOL","Unknown Molecule"]]),p.add("MOL",0),[4,MG(wF({entity:h.getEntityTable(),chem_comp:p.getChemCompTable(),atom_site:f}),t??mW.create(e),r)];case 1:return(m=_.sent()).frameCount>0&&(g=xv.ofIntArray(xv.mapToArray(i.atomIdxA,function(e){return e-1},Int32Array)),v=xv.ofIntArray(xv.mapToArray(i.atomIdxB,function(e){return e-1},Int32Array)),y=xv.asArrayColumn(i.order,Int32Array),b=LF.fromData({pairs:{indexA:g,indexB:v,order:y},count:n.count},{maxDistance:1/0}),LF.Provider.set(m.representative,b)),[2,m]}})})}function MW(e){var t=gW.fromFrame(e);return vy.create("Parse CIF Core",function(e){return function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B,N,F,L,$,U,j,z,G,V,H,q,W,X,Y,K,Z,Q,J;return Pc(this,function(ee){switch(ee.label){case 0:for(n=e.atom_site._rowCount,i=xv.ofConst("MOL",n,xv.Schema.str),a=xv.ofConst("A",n,xv.Schema.str),o=xv.ofConst(1,n,xv.Schema.int),s=function(e){var t,r,n,i=e.cell,a=(r=(t=e.space_group).it_number.value(0),n=t["name_h-m_full"].value(0).replace("-"," "),t.it_number.isDefined?(t["name_h-m_full"].isDefined,r):n),o=LE.create(a,Cg.create(i.length_a.value(0),i.length_b.value(0),i.length_c.value(0)),Cg.scale(Cg(),Cg.create(i.angle_alpha.value(0),i.angle_beta.value(0),i.angle_gamma.value(0)),Math.PI/180)
139);return{spacegroup:$E.create(o),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}(e),u=s.spacegroup.cell.fromFractional,c=e.atom_site,l=c.fract_x,d=c.fract_y,f=c.fract_z,h=new Float32Array(n),p=new Float32Array(n),m=new Float32Array(n),g=Cg(),Y=0;Y<n;++Y)Cg.set(g,l.value(Y),d.value(Y),f.value(Y)),Cg.transformMat4(g,g,u),h[Y]=g[0],p[Y]=g[1],m[Y]=g[2];if(v=e.atom_site,y=v.type_symbol,b=v.label,y.isDefined){for(C=Array(n),S=new Int8Array(n),Y=0;Y<n;++Y)w=y.value(Y),A=w.length,"+"===w[A-1]?(C[Y]=w.substring(0,A-2),S[Y]=parseInt(w[A-2])):"+"===w[A-2]?(C[Y]=w.substring(0,A-2),S[Y]=parseInt(w[A-1])):"-"===w[A-1]?(C[Y]=w.substring(0,A-2),S[Y]=-parseInt(w[A-2])):"-"===w[A-2]?(C[Y]=w.substring(0,A-2),S[Y]=-parseInt(w[A-1])):(C[Y]=w,S[Y]=0);_=xv.ofStringArray(C),x=xv.ofIntArray(S)}else{for(C=Array(n),Y=0;Y<n;++Y)C[Y]=ZB(b.value(Y),"");_=xv.ofStringArray(C),x=xv.Undefined(n,xv.Schema.int)}return T=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:a,auth_atom_id:b,auth_comp_id:i,auth_seq_id:o,Cartn_x:xv.ofFloatArray(h),Cartn_y:xv.ofFloatArray(p),Cartn_z:xv.ofFloatArray(m),id:xv.range(0,n-1),label_asym_id:a,label_atom_id:b,label_comp_id:i,label_seq_id:o,label_entity_id:xv.ofConst("1",n,xv.Schema.str),occupancy:e.atom_site.occupancy.isDefined?e.atom_site.occupancy:xv.ofConst(1,n,xv.Schema.float),type_symbol:_,pdbx_formal_charge:x,pdbx_PDB_model_num:xv.ofConst(1,n,xv.Schema.int),B_iso_or_equiv:e.atom_site.u_iso_or_equiv},n),P=e.chemical.name_common.value(0)||e.chemical.name_systematic.value(0)||e.chemical_formula.sum.value(0),(E=new BF).setNames([["MOL",P||"Unknown Entity"]]),E.getEntityId("MOL",0,"A"),(M=new kF(o,e.atom_site.type_symbol)).setNames([["MOL",P||"Unknown Molecule"]]),M.add("MOL",0),[4,MG(wF({entity:E.getEntityTable(),chem_comp:M.getChemCompTable(),atom_site:T}),t,r)];case 1:if((k=ee.sent()).frameCount>0&&(I=k.representative,Dz.Provider.set(I,s),(D=e.geom_bond._rowCount)>0)){for(O={},R=e.atom_site.label,Y=0,B=R.rowCount;Y<B;++Y)O[R.value(Y)]=Y;for(N=t.data.frame.categories.ccdc_geom_bond_type?.getField(""),F=[],L=[],$=[],U=[],j=[],z=new Set,G=0,V=e.geom_bond,H=V.atom_site_label_1,q=V.atom_site_label_2,W=V.valence,X=V.distance,Y=0;Y<D;++Y)K=O[H.value(Y)],Z=O[q.value(Y)],Q=K<Z?Ev(K,Z):Ev(Z,K),z.has(Q)||(z.add(Q),F[G]=K,L[G]=Z,U[G]=X.value(Y)||-1,N?"D"===(J=N.str(Y))?($[G]=2,j[G]=1):"A"===J?($[G]=1,j[G]=17):($[G]=1,j[G]=1):(j[G]=1,$[G]=W.isDefined?W.value(Y):1),G+=1);LF.Provider.set(I,LF.fromData({pairs:{indexA:xv.ofIntArray(F),indexB:xv.ofIntArray(L),order:xv.ofIntArray($),distance:xv.ofFloatArray(U),flag:xv.ofIntArray(j)},count:n}))}return[2,k]}})})}(t.data.db,t,e)})}(function(e){e.is=function(e){return"mol"===e?.kind},e.create=function(e){return{kind:"mol",name:e.title,data:e}}})(mW||={}),Vz.Provider.formatRegistry.add("cifCore",function(e){if(gW.is(e.sourceData)){var t=e.sourceData.data.db,r=t.atom_site,n=t.atom_site_aniso;return{data:Sv.ofPartialColumns(Vz.Schema,{U:n.u},n._rowCount),elementToAnsiotrop:Vz.getElementToAnsiotropFromLabel(r.label,n.label)}}},function(e){return!!gW.is(e.sourceData)&&e.sourceData.data.db.atom_site_aniso.u.isDefined}),function(e){e.is=function(e){return"cifCore"===e?.kind},e.fromFrame=function(e,t){return t||=JA.schema.cifCore(e),{kind:"cifCore",name:t.database_code.depnum_ccdc_archive.value(0)||t.database_code.depnum_ccdc_fiz.value(0)||t.database_code.icsd.value(0)||t.database_code.mdf.value(0)||t.database_code.nbs.value(0)||t.database_code.csd.value(0)||t.database_code.cod.value(0)||t._name,data:{db:t,frame:e}}}}(gW||={}),function(e){e.is=function(e){return"cube"===e?.kind},e.create=function(e){return{kind:"cube",name:e.header.comment1,data:e}}}(vW||={});var kW,IW=fw.skipWhitespace,DW=fw.eatValue,OW=fw.markLine,RW=fw.getTokenString,BW=fw.readLine,NW=/\s+/g;function FW(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S;return Pc(this,function(w){switch(w.label){case 0:for(t=e.tokenizer,r=e.molecule;"@<TRIPOS>ATOM"!==RW(t)&&t.position<t.data.length;)OW(t);return n=t.position,i=t.lineNumber,a=BW(t),o=a.trim().split(/\s+/g),s=o.length,u=$S.create(t.data,2*r.num_atoms),c=$S.create(t.data,2*r.num_atoms),l=$S.create(t.data,2*r.num_atoms),d=$S.create(t.data,2*r.num_atoms),f=$S.create(t.data,2*r.num_atoms),h=$S.create(t.data,2*r.num_atoms),p=$S.create(t.data,2*r.num_atoms),m=$S.create(t.data,2*r.num_atoms),g=$S.create(t.data,2*r.num_atoms),v=$S.create(t.data,2*r.num_atoms),y=xv.Undefined(r.num_atoms,xv.Schema.float),b=xv.Undefined(r.num_atoms,xv.Schema.int),_=xv.Undefined(r.num_atoms,xv.Schema.str),t.position=n,t.lineNumber=i,x=t.length,S=0,[4,Sy(e.runtimeCtx,1e5,void 0,function(e){for(var n=Math.min(r.num_atoms-S,e),i=0;i<n;i++)for(var a=0;a<s;a++)switch(IW(t),t.tokenStart=t.position,DW(t),a){case 0:$S.addUnchecked(u,t.tokenStart,t.tokenEnd);break;case 1:$S.addUnchecked(c,t.tokenStart,t.tokenEnd);break;case 2:$S.addUnchecked(l,t.tokenStart,t.tokenEnd);break;case 3:$S.addUnchecked(d,t.tokenStart,t.tokenEnd);break;case 4:$S.addUnchecked(f,t.tokenStart,t.tokenEnd);break;case 5:$S.addUnchecked(h,t.tokenStart,t.tokenEnd);break;case 6:$S.addUnchecked(p,t.tokenStart,t.tokenEnd);break;case 7:$S.addUnchecked(m,t.tokenStart,t.tokenEnd);break;case 8:$S.addUnchecked(g,t.tokenStart,t.tokenEnd);break;case 9:$S.addUnchecked(v,t.tokenStart,t.tokenEnd)}return S+=n,n},function(e){return e.update({message:"Parsing...",current:t.position,max:x})})];case 1:return w.sent(),[2,{count:r.num_atoms,atom_id:aw(u)(xv.Schema.int),atom_name:aw(c)(xv.Schema.str),x:aw(l)(xv.Schema.float),y:aw(d)(xv.Schema.float),z:aw(f)(xv.Schema.float),atom_type:s>5?aw(h)(xv.Schema.str):_,subst_id:s>6?aw(p)(xv.Schema.int):b,subst_name:s>7?aw(m)(xv.Schema.str):_,charge:s>8?aw(g)(xv.Schema.float):y,status_bit:s>9?aw(v)(xv.Schema.str):_}]}})})}function LW(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:for(t=e.tokenizer,r=e.molecule;"@<TRIPOS>BOND"!==RW(t)&&t.position<t.data.length;)OW(t);return n=t.position,i=t.lineNumber,a=BW(t),o=a.trim().split(/\s+/g),s=o.length,u=$S.create(t.data,2*r.num_bonds),c=$S.create(t.data,2*r.num_bonds),l=$S.create(t.data,2*r.num_bonds),d=$S.create(t.data,2*r.num_bonds),f=$S.create(t.data,2*r.num_bonds),t.position=n,t.lineNumber=i,h=t.length,p=0,[4,Sy(e.runtimeCtx,1e5,void 0,function(e){for(var n=Math.min(r.num_bonds-p,e),i=0;i<n;i++)for(var a=0;a<s;a++)switch(IW(t),t.tokenStart=t.position,DW(t),a){case 0:$S.addUnchecked(u,t.tokenStart,t.tokenEnd);break;case 1:$S.addUnchecked(c,t.tokenStart,t.tokenEnd);break;case 2:$S.addUnchecked(l,t.tokenStart,t.tokenEnd);break;case 3:$S.addUnchecked(d,t.tokenStart,t.tokenEnd);break;default:$S.addUnchecked(f,t.tokenStart,t.tokenEnd)}return p+=n,n},function(e){return e.update({message:"Parsing...",current:t.position,max:h})})];case 1:return m.sent(),[2,{count:r.num_bonds,bond_id:aw(u)(xv.Schema.int),origin_atom_id:aw(c)(xv.Schema.int),target_atom_id:aw(l)(xv.Schema.int),bond_type:aw(d)(xv.Schema.str),status_bits:s>4?aw(f)(xv.Schema.str):xv.Undefined(r.num_bonds,xv.Schema.str)}]}})})}function $W(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:n=fw(t),e.update({message:"Parsing...",current:0,max:t.length}),i=[],l.label=1;case 1:return n.position<t.length?(a=function(e,t){return{tokenizer:e,molecule:{mol_name:"",num_atoms:0,num_bonds:0,num_subst:0,num_feat:0,num_sets:0,mol_type:"",charge_type:"",status_bits:"",mol_comment:""},runtimeCtx:t}}(n,e),function(e){for(var t=e.tokenizer,r=e.molecule;"@<TRIPOS>MOLECULE"!==RW(t)&&t.position<t.data.length;)OW(t);OW(t),r.mol_name=RW(t),OW(t);var n=RW(t).trim().split(NW);r.num_atoms=parseInt(n[0]),r.num_bonds=parseInt(n[1]),r.num_subst=parseInt(n[2]),r.num_feat=parseInt(n[3]),r.num_sets=parseInt(n[4]),OW(t);var i=RW(t);if(!i.startsWith("@<TRIPOS>")){r.mol_type=i,OW(t);var a=RW(t);if(!a.startsWith("@<TRIPOS>")){r.charge_type=a,OW(t);var o=RW(t);if(!o.startsWith("@<TRIPOS>")){r.status_bits=o,OW(t);var s=RW(t);s.startsWith("@<TRIPOS>")||(r.mol_comment=s)}}}}(a),[4,FW(a)]):[3,4];case 2:return o=l.sent(),[4,LW(a)];case 3:for(s=l.sent(),u=function(e){for(var t=e.tokenizer;t.position<t.data.length;){var r=RW(t);if("@<TRIPOS>MOLECULE"===r)return;if("@<TRIPOS>CRYSIN"===r)break;OW(t)}if(!(t.position>=t.data.length)){OW(t);var n=RW(t).trim().split(NW);return{a:parseFloat(n[0]),b:parseFloat(n[1]),c:parseFloat(n[2]),alpha:parseFloat(n[3]),beta:parseFloat(n[4]),gamma:parseFloat(n[5]),spaceGroup:parseInt(n[6],10),setting:parseInt(n[7],10)}}}(a),i.push({molecule:a.molecule,atoms:o,bonds:s,crysin:u}),IW(n);"@<TRIPOS>MOLECULE"!==RW(n)&&n.position<n.data.length;)OW(n);return[3,1];case 4:return c={name:r,structures:i},[2,RS.success(c)]}})})}function UW(e,t){var r=this;return vy.create("Parse MOL2",function(n){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){switch(r.label){case 0:return[4,$W(n,e,t)];case 1:return[2,r.sent()]}})})})}!function(e){e.is=function(e){return"mol2"===e?.kind},e.create=function(e){return{kind:"mol2",name:e.name,data:e}}}(kW||={});
139var jW,zW,GW=new Uint32Array([0,0,0,0,0,0,0,0,0,8,10,12,16,20,25,32,40,50,64,80,101,128,161,203,256,322,406,512,645,812,1024,1290,1625,2048,2580,3250,4096,5060,6501,8192,10321,13003,16384,20642,26007,32768,41285,52015,65536,82570,104031,131072,165140,208063,262144,330280,416127,524287,660561,832255,1048576,1321122,1664510,2097152,2642245,3329021,4194304,5284491,6658042,8388607,10568983,13316085,16777216]);function VW(){throw Error("(xdrfile error) Undefined error.")}function HW(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R;return Pc(this,function(B){switch(B.label){case 0:r=new DataView(t.buffer,t.byteOffset),i=(n={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0}).frames,a=n.boxes,o=n.times,s=[0,0,0,0,0,0],u=[0,0,0],c=[0,0,0],l=[0,0,0],d=[.1,.1,.1],f=[.1,.1,.1],h=0,p=jW.buf,B.label=1;case 1:for(m=void 0,g=r.getInt32(h+4),h+=12,o.push(r.getFloat32(h)),h+=4,v=new Float32Array(9),M=0;M<9;++M)v[M]=10*r.getFloat32(h),h+=4;if(a.push(v),g<=9)for(m={count:g/3,x:new Float32Array(g/3),y:new Float32Array(g/3),z:new Float32Array(g/3)},M=0;M<g/3;++M)m.x[M]=r.getFloat32(h),m.y[M]=r.getFloat32(h),m.z[M]=r.getFloat32(h),h+=4;else{for(p[0]=p[1]=p[2]=0,u[0]=u[1]=u[2]=0,l[0]=l[1]=l[2]=0,c[0]=c[1]=c[2]=0,d[0]=d[1]=d[2]=0,f[0]=f[1]=f[2]=0,m={count:g,x:new Float32Array(g),y:new Float32Array(g),z:new Float32Array(g)},y=0,b=r.getInt32(h),h+=4,_=r.getFloat32(h),h+=4,s[0]=r.getInt32(h),s[1]=r.getInt32(h+4),s[2]=r.getInt32(h+8),s[3]=r.getInt32(h+12),s[4]=r.getInt32(h+16),s[5]=r.getInt32(h+20),u[0]=s[3]-s[0]+1,u[1]=s[4]-s[1]+1,u[2]=s[5]-s[2]+1,h+=24,x=void 0,(u[0]|u[1]|u[2])>16777215?(c[0]=jW.sizeOfInt(u[0]),c[1]=jW.sizeOfInt(u[1]),c[2]=jW.sizeOfInt(u[2]),x=0):x=jW.sizeOfInts(3,u),S=r.getInt32(h),h+=4,A=GW[w=9>(w=S-1)?9:w]/2|0,C=GW[S]/2|0,l[0]=l[1]=l[2]=GW[S],T=4*Math.ceil(r.getInt32(h)/4),h+=4,P=1/_,E=0,M=0,d[0]=d[1]=d[2]=0;M<b;){if(0===x?(d[0]=jW.decodeBits(t,h,c[0]),d[1]=jW.decodeBits(t,h,c[1]),d[2]=jW.decodeBits(t,h,c[2])):jW.decodeInts(t,h,x,u,d),M++,d[0]+=s[0],d[1]+=s[1],d[2]+=s[2],f[0]=d[0],f[1]=d[1],f[2]=d[2],k=jW.decodeBits(t,h,1),I=0,1===k&&(E=jW.decodeBits(t,h,5),E-=I=E%3,I--),E>0)for(d[0]=d[1]=d[2]=0,D=0;D<E;D+=3)jW.decodeInts(t,h,S,l,d),M++,d[0]+=f[0]-C,d[1]+=f[1]-C,d[2]+=f[2]-C,0===D?(O=d[0],d[0]=f[0],f[0]=O,O=d[1],d[1]=f[1],f[1]=O,O=d[2],d[2]=f[2],f[2]=O,m.x[y]=f[0]*P,m.y[y]=f[1]*P,m.z[y]=f[2]*P,y++):(f[0]=d[0],f[1]=d[1],f[2]=d[2]),m.x[y]=d[0]*P,m.y[y]=d[1]*P,m.z[y]=d[2]*P,y++;else m.x[y]=d[0]*P,m.y[y]=d[1]*P,m.z[y]=d[2]*P,y++;S+=I,I<0?(C=A,A=S>9?GW[S-1]/2|0:0):I>0&&(A=C,C=GW[S]/2|0),l[0]=l[1]=l[2]=GW[S],0!==l[0]&&0!==l[1]&&0!==l[2]||VW()}h+=T}for(R=0;R<g;R++)m.x[R]*=10,m.y[R]*=10,m.z[R]*=10;return i.push(m),e.shouldUpdate?[4,e.update({current:h,max:t.length})]:[3,3];case 2:B.sent(),B.label=3;case 3:return h>=t.length?[3,4]:[3,1];case 4:return o.length>=1&&(n.timeOffset=o[0]),o.length>=2&&(n.deltaTime=o[1]-o[0]),[2,n]}})})}function qW(e){var t=this;return vy.create("Parse XTC",function(r){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r.update({canAbort:!0,message:"Parsing trajectory..."}),[4,HW(r,e)];case 1:return t=i.sent(),[2,RS.success(t)];case 2:return n=i.sent(),[2,RS.error(""+n)];case 3:return[2]}})})})}function WW(e){var t=this;return vy.create("Parse XTC",function(r){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return[4,r.update("Converting to coordinates")];case 1:for(d.sent(),t=VB(e.deltaTime,"step"),n=VB(e.timeOffset,t.unit),i=[],a=0,o=e.frames.length;a<o;++a)s=e.boxes[a],u=Cg.fromArray(Cg(),s,0),c=Cg.fromArray(Cg(),s,3),l=Cg.fromArray(Cg(),s,6),i.push({elementCount:e.frames[a].count,cell:HB.fromBasis(u,c,l),x:e.frames[a].x,y:e.frames[a].y,z:e.frames[a].z,xyzOrdering:{isIdentity:!0},time:VB(n.value+t.value*a,t.unit)});return[2,LB.create(i,t,n)]}})})})}function XW(e){var t=e.position>=e.data.length-1?0:+fw.readLine(e);isNaN(t)&&(t=0);for(var r=fw.readLine(e),n=new Float64Array(t),i=new Float64Array(t),a=new Float64Array(t),o=Array(t),s=0;s<t;++s){var u=fw.readLineTrim(e).split(/\s+/g);o[s]=u[0],n[s]=+u[1],i[s]=+u[2],a[s]=+u[3]}return{count:t,comment:r,x:xv.ofFloatArray(n),y:xv.ofFloatArray(i),z:xv.ofFloatArray(a),type_symbol:xv.ofStringArray(o)}}function YW(e){for(var t=fw(e),r=[];;){var n=XW(t);if(0===n.count)break;r.push(n)}var i={molecules:r};return RS.success(i)}function KW(e){var t=this;return vy.create("Parse Mol",function(){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){return[2,YW(e)]})})})}function ZW(e){return vy.create("Parse XYZ",function(t){return function(e,t){for(var r=e.molecules,n=0,i=0,a=r;i<a.length;i++)n+=(p=a[i]).count;for(var o=Array(n),s=new Int32Array(n),u=new Float32Array(n),c=new Float32Array(n),l=new Float32Array(n),d=new Int32Array(n),f=0,h=0;h<r.length;h++)for(var p=r[h],m=0;m<p.count;m++)o[f]=p.type_symbol.value(m),u[f]=p.x.value(m),c[f]=p.y.value(m),l[f]=p.z.value(m),s[f]=m,d[f]=h,f++;var g=xv.ofConst("MOL",n,xv.Schema.str),v=xv.ofConst("A",n,xv.Schema.str),y=xv.ofConst(1,n,xv.Schema.int),b=xv.ofStringArray(o),_=Sv.ofParti
139alColumns(SF.atom_site,{auth_asym_id:v,auth_atom_id:b,auth_comp_id:g,auth_seq_id:y,Cartn_x:xv.ofFloatArray(u),Cartn_y:xv.ofFloatArray(c),Cartn_z:xv.ofFloatArray(l),id:xv.ofIntArray(s),label_asym_id:v,label_atom_id:b,label_comp_id:g,label_seq_id:y,label_entity_id:xv.ofConst("1",n,xv.Schema.str),occupancy:xv.ofConst(1,n,xv.Schema.float),type_symbol:b,pdbx_PDB_model_num:xv.ofIntArray(d)},n),x=new BF;x.setNames([["MOL","Unknown Entity"]]),x.getEntityId("MOL",0,"A");var S=new kF(y,b);return S.setNames([["MOL","Unknown Molecule"]]),S.add("MOL",0),MG(wF({entity:x.getEntityTable(),chem_comp:S.getChemCompTable(),atom_site:_}),zW.create(e),t)}(e,t)})}function QW(e){fw.skipWhitespace(e),fw.eatValue(e)}function JW(e,t){var r=e.position;fw.skipWhitespace(e),fw.eatValue(e),fw.trim(e,r,e.position),$S.addUnchecked(t,e.tokenStart,e.tokenEnd)}(function(e){e.sizeOfInt=function(e){for(var t=1,r=0;e>=t&&r<32;)r++,t<<=1;return r};var t=new Uint8Array(32);e.sizeOfInts=function(e,r){var n=1,i=0;t[0]=1;for(var a=0;a<e;a++){var o=void 0,s=0;for(o=0;o<n;o++)s+=t[o]*r[a],t[o]=255&s,s>>=8;for(;0!==s;)t[o++]=255&s,s>>=8;n=o}var u=1;for(n--;t[n]>=u;)i++,u*=2;return i+8*n};var r=new ArrayBuffer(24);e.buf=new Int32Array(r);var n=new Uint32Array(r);function i(t,r,i){for(var a=i,o=(1<<a)-1,s=n[1],u=n[2],c=e.buf[0],l=0;a>=8;)l|=(u=u<<8|t[r+c++])>>s<<a-8,a-=8;return a>0&&(s<a&&(s+=8,u=u<<8|t[r+c++]),l|=u>>(s-=a)&(1<<a)-1),l&=o,e.buf[0]=c,e.buf[1]=s,e.buf[2]=u,l}function a(t,r){var i=n[2],a=e.buf[0];return i=i<<8|t[r+a],e.buf[0]=a+1,e.buf[2]=i,i>>n[1]&255}e.decodeBits=i;var o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];e.decodeInts=function(e,t,r,n,s){var u=r,c=0;for(o[0]=0,o[1]=0,o[2]=0,o[3]=0;u>8;)o[c++]=a(e,t),u-=8;u>0&&(o[c++]=i(e,t,u));for(var l=2;l>0;l--){for(var d=0,f=n[l],h=c-1;h>=0;h--){var p=(d=d<<8|o[h])/f|0;o[h]=p,d-=p*f}s[l]=d}s[0]=o[0]|o[1]<<8|o[2]<<16|o[3]<<24}})(jW||={}),function(e){e.is=function(e){return"xyz"===e?.kind},e.create=function(e){return{kind:"xyz",name:"xyz",data:e}}}(zW||={});var eX,tX="$$$$";function rX(e){var t=fw.readLine(e).trim(),r=fw.readLine(e).trim(),n=fw.readLine(e).trim(),i=fw.readLine(e),a=i.trim().endsWith("V3000"),o=a?function(e){var t=$S.create(e.data,1),r=$S.create(e.data,1);return fw.eatLine(e),QW(e),QW(e),QW(e),JW(e,t),JW(e,r),fw.eatLine(e),{atomCount:aw(t)(xv.Schema.int).value(0),bondCount:aw(r)(xv.Schema.int).value(0)}}(e):function(e){return{atomCount:+e.substr(0,3),bondCount:+e.substr(3,3)}}(i),s=o.atomCount,u=o.bondCount;if(!Number.isNaN(s)&&!Number.isNaN(u)){var c={atomIdx:xv.ofConst(0,s,xv.Schema.int),charge:xv.ofConst(0,s,xv.Schema.int)},l=a?function(e,t){for(var r=$S.create(e.data,2*t),n=$S.create(e.data,2*t),i=$S.create(e.data,2*t),a=$S.create(e.data,2*t),o=0;o<t;++o){fw.markLine(e),QW(e),QW(e),QW(e);var s=e.position;JW(e,a),JW(e,r),JW(e,n),JW(e,i),e.position=s}return fw.eatLine(e),fw.eatLine(e),{count:t,x:aw(r)(xv.Schema.float),y:aw(n)(xv.Schema.float),z:aw(i)(xv.Schema.float),type_symbol:aw(a)(xv.Schema.str),formal_charge:xv.ofConst(0,t,xv.Schema.int)}}(e,s):SW(e,s),d=a?function(e,t){for(var r=$S.create(e.data,2*t),n=$S.create(e.data,2*t),i=$S.create(e.data,2*t),a=0;a<t;++a){fw.markLine(e),QW(e),QW(e),QW(e);var o=e.position;JW(e,i),JW(e,r),JW(e,n),e.position=o}return fw.eatLine(e),fw.eatLine(e),{count:t,atomIdxA:aw(r)(xv.Schema.float),atomIdxB:aw(n)(xv.Schema.float),order:aw(i)(xv.Schema.float)}}(e,u):wW(e,u),f=a?c:CW(e),h=function(e){for(var t=$S.create(e.data,32),r=$S.create(e.data,32);e.position<e.length;){var n=fw.readLine(e);if(n.startsWith(tX))break;if(n&&n.startsWith("> ")){$S.add(t,e.tokenStart+2,e.tokenEnd),fw.markLine(e);for(var i=e.tokenStart,a=e.tokenEnd,o=!1;e.position<e.length;){var s=fw.readLine(e);if(!s||s.startsWith(tX)||s.startsWith("> ")){$S.add(r,i,a),o=!0;break}a=e.tokenEnd}o||$S.add(r,i,a)}}return{dataHeader:aw(t)(xv.Schema.str),data:aw(r)(xv.Schema.str)}}(e);return{molFile:{title:t,program:r,comment:n,atoms:l,bonds:d,formalCharges:f},dataItems:h}}for(;e.position<e.length&&!fw.readLine(e).startsWith(tX););}function nX(e){for(var t=fw(e),r=[];t.position<t.length;){var n=rX(t);n&&r.push(n)}return RS.success({compounds:r})}function iX(e){var t=this;return vy.create("Parse Sdf",function(){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){return[2,nX(e)]})})})}function aX(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A;return Pc(this,function(C){for(t=new DataView(e.buffer),n=(r={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0}).frames,i=r.boxes,a=r.times,o=0;;){if(o+=8,s=t.getInt32(o),o+=4,o+=s,u=t.getInt32(o+8),c=t.getInt32(o+12),l=t.getInt32(o+16),d=t.getInt32(o+28),f=t.getInt32(o+32),h=t.getInt32(o+36),p=t.getInt32(o+40),o+=52,g=3*p,8==(m=u/9)?a.push(t.getFloat64(o)):a.push(t.getFloat32(o)),o+=2*m,u){if(v=new Float32Array(9),8===m)for(A=0;A<9;++A)v[A]=10*t.getFloat64(o),o+=8;else for(A=0;A<9;++A)v[A]=10*t.getFloat32(o),o+=4;i.push(v)}if(o+=c,o+=l,d){if(y=new Float32Array(p),b=new Float32Array(p),_=new Float32Array(p),8===m)for(A=0;A<p;++A)y[A]=10*t.getFloat64(o),b[A]=10*t.getFloat64(o+8),_[A]=10*t.getFloat64(o+16),o+=24;else{for(x=new Uint32Array(e.buffer,o,g),A=0;A<g;
139++A)S=x[A],x[A]=(255&S)<<24|(65280&S)<<8|S>>8&65280|S>>24&255;for(w=new Float32Array(e.buffer,o,g),A=0;A<p;++A)y[A]=10*w[3*A],b[A]=10*w[3*A+1],_[A]=10*w[3*A+2],o+=12}n.push({count:p,x:y,y:b,z:_})}if(o+=f,(o+=h)>=e.byteLength)break}return a.length>=1&&(r.timeOffset=a[0]),a.length>=2&&(r.deltaTime=a[1]-a[0]),[2,r]})})}function oX(e){var t=this;return vy.create("Parse TRR",function(r){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r.update({canAbort:!0,message:"Parsing trajectory..."}),[4,aX(e)];case 1:return t=i.sent(),[2,RS.success(t)];case 2:return n=i.sent(),[2,RS.error(""+n)];case 3:return[2]}})})})}function sX(e){var t=this;return vy.create("Parse TRR",function(r){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return[4,r.update("Converting to coordinates")];case 1:for(d.sent(),t=VB(e.deltaTime,"step"),n=VB(e.timeOffset,t.unit),i=[],a=0,o=e.frames.length;a<o;++a)s=e.boxes[a],u=Cg.fromArray(Cg(),s,0),c=Cg.fromArray(Cg(),s,3),l=Cg.fromArray(Cg(),s,6),i.push({elementCount:e.frames[a].count,cell:HB.fromBasis(u,c,l),x:e.frames[a].x,y:e.frames[a].y,z:e.frames[a].z,xyzOrdering:{isIdentity:!0},time:VB(n.value+t.value*a,t.unit)});return[2,LB.create(i,t,n)]}})})})}!function(e){e.is=function(e){return"sdf"===e?.kind},e.create=function(e){return{kind:"sdf",name:e.molFile.title,data:e}}}(eX||={});var uX=[],cX=function(){function e(e,t){void 0===t&&(t={}),this._mark=0,this._marks=[],this.offset=0,this.littleEndian=!0;var r=!1;void 0===e&&(e=8192),"number"==typeof e?e=new ArrayBuffer(e):r=!0;var n=t.offset?t.offset>>>0:0,i=e.byteLength-n,a=n;e instanceof ArrayBuffer||(e.byteLength!==e.buffer.byteLength&&(a=e.byteOffset+n),e=e.buffer),this._lastWrittenByte=r?i:0,this.buffer=e,this.length=i,this.byteLength=i,this.byteOffset=a,this._data=new DataView(this.buffer,a,i)}return e.prototype.available=function(e){return void 0===e&&(e=1),this.offset+e<=this.length},e.prototype.isLittleEndian=function(){return this.littleEndian},e.prototype.setLittleEndian=function(){return this.littleEndian=!0,this},e.prototype.isBigEndian=function(){return!this.littleEndian},e.prototype.setBigEndian=function(){return this.littleEndian=!1,this},e.prototype.skip=function(e){return void 0===e&&(e=1),this.offset+=e,this},e.prototype.seek=function(e){return this.offset=e,this},e.prototype.mark=function(){return this._mark=this.offset,this},e.prototype.reset=function(){return this.offset=this._mark,this},e.prototype.pushMark=function(){return this._marks.push(this.offset),this},e.prototype.popMark=function(){var e=this._marks.pop();if(void 0===e)throw Error("Mark stack empty");return this.seek(e),this},e.prototype.rewind=function(){return this.offset=0,this},e.prototype.ensureAvailable=function(e){if(void 0===e&&(e=1),!this.available(e)){var t=2*(this.offset+e),r=new Uint8Array(t);r.set(new Uint8Array(this.buffer)),this.buffer=r.buffer,this.length=this.byteLength=t,this._data=new DataView(this.buffer)}return this},e.prototype.readBoolean=function(){return 0!==this.readUint8()},e.prototype.readInt8=function(){return this._data.getInt8(this.offset++)},e.prototype.readUint8=function(){return this._data.getUint8(this.offset++)},e.prototype.readByte=function(){return this.readUint8()},e.prototype.readBytes=function(e){void 0===e&&(e=1);for(var t=new Uint8Array(e),r=0;r<e;r++)t[r]=this.readByte();return t},e.prototype.readInt16=function(){var e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},e.prototype.readUint16=function(){var e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e},e.prototype.readInt32=function(){var e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},e.prototype.readUint32=function(){var e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},e.prototype.readFloat32=function(){var e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},e.prototype.readFloat64=function(){var e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},e.prototype.readChar=function(){return String.fromCharCode(this.readInt8())},e.prototype.readChars=function(e){void 0===e&&(e=1),uX.length=e;for(var t=0;t<e;t++)uX[t]=this.readChar();return uX.join("")},e.prototype.writeBoolean=function(e){return void 0===e&&(e=!1),this.writeUint8(e?255:0),this},e.prototype.writeInt8=function(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this},e.prototype.writeUint8=function(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this},e.prototype.writeByte=function(e){return this.writeUint8(e)},e.prototype.writeBytes=function(e){this.ensureAvailable(e.length);for(var t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this},e.prototype.writeInt16=function(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this},e.prototype.writeUint16=function(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this},e.prototype.writeInt32=function(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this},e.prototype.writeUint32=function(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this},e.prototype.writeFloat32=function(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this},e.prototype.writeFloat64=function(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this},e.prototype.writeChar=function(e){return this.writeUint8(e.charCodeAt(0))},e.prototype.writeChars=function(e){for(var t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this},e.prototype.toArray=function(){return new Uint8Array(this.buffer,this.byteOffset,this._lastWrittenByte)},e.prototype._updateLastWrittenByte=function(){this.offset>this._lastWrittenByte&&(this._lastWrittenByte=this.offset)},e}();function lX(e,t){if(e)throw TypeError("Not a valid NetCDF v3.x file: "+t)}function dX(e){e.offset%4!=0&&e.skip(4-e.offset%4)}function fX(e){var t=e.readUint32(),r=e.readChars(t);return dX(e),r}function hX(e){switch(Number(e)){case 1:return"byte";case 2:return"char";case 3:return"short";case 4:return"int";case 5:return"float";case 6:return"double";default:return"undefined"}}function pX(e){switch(Number(e)){case 1:case 2:return 1;case 3:return 2;case 4:case 5:return 4;case 6:return 8;default:return-1}}function mX(e){switch(String(e)){case"byte":return 1;case"char":return 2;case"short":return 3;case"int":return 4;case"float":return 5;case"double":return 6;default:return-1}}function gX(e,t){if(1!==e){for(var r=Array(e),n=0;n<e;n++)r[n]=t();return r}return t()}function vX(e,t,r){switch(t){case 1:return e.readBytes(r);case 2:return function(e){return 0===e.charCodeAt(e.length-1)?e.substring(0,e.length-1):e}(e.readChars(r));case 3:return gX(r,e.readInt16.bind(e));case 4:return gX(r,e.readInt32.bind(e));case 5:return gX(r,e.readFloat32.bind(e));case 6:return gX(r,e.readFloat64.bind(e));default:return void lX(!0,"non valid type "+t)}}function yX(e){var t,r=e.readUint32();if(0===r)return lX(0!==e.readUint32(),"wrong empty tag for list of attributes"),[];lX(12!==r,"wrong tag for list of attributes");var n=e.readUint32();t=Array(n);for(var i=0;i<n;i++){var a=fX(e),o=e.readUint32();lX(o<1||o>
1396,"non valid type "+o);var s=vX(e,o,e.readUint32());dX(e),t[i]={name:a,type:hX(o),value:s}}return t}var bX,_X,xX=function(){function e(e){var t=new cX(e);t.setBigEndian(),lX("CDF"!==t.readChars(3),"should start with CDF");var r=t.readByte();lX(r>2,"unknown version"),this.header=function(e,t){var r={recordDimension:{length:e.readUint32()}};r.version=t;var n=function(e){var t,r,n,i=e.readUint32();if(0===i)return lX(0!==e.readUint32(),"wrong empty tag for list of dimensions"),[];lX(10!==i,"wrong tag for list of dimensions");var a=e.readUint32();t=Array(a);for(var o=0;o<a;o++){var s=fX(e),u=e.readUint32();0===u&&(r=o,n=s),t[o]={name:s,size:u}}return{dimensions:t,recordId:r,recordName:n}}(e);r.recordDimension.id=n.recordId,r.recordDimension.name=n.recordName,r.dimensions=n.dimensions,r.globalAttributes=yX(e);var i=function(e,t,r){var n,i=e.readUint32(),a=0;if(0===i)return lX(0!==e.readUint32(),"wrong empty tag for list of variables"),[];lX(11!==i,"wrong tag for list of variables");var o=e.readUint32();n=Array(o);for(var s=0;s<o;s++){for(var u=fX(e),c=e.readUint32(),l=Array(c),d=0;d<c;d++)l[d]=e.readUint32();var f=yX(e),h=e.readUint32();lX(h<1&&h>6,"non valid type "+h);var p=e.readUint32(),m=e.readUint32();2===r&&(lX(m>0,"offsets larger than 4GB not supported"),m=e.readUint32()),l[0]===t&&(a+=p),n[s]={name:u,dimensions:l,attributes:f,type:hX(h),size:p,offset:m,record:l[0]===t}}return{variables:n,recordStep:a}}(e,n.recordId,t);return r.variables=i.variables,r.recordDimension.recordStep=i.recordStep,r}(t,r),this.buffer=t}return Object.defineProperty(e.prototype,"version",{get:function(){return 1===this.header.version?"classic format":"64-bit offset format"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"recordDimension",{get:function(){return this.header.recordDimension},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dimensions",{get:function(){return this.header.dimensions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalAttributes",{get:function(){return this.header.globalAttributes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.header.variables},enumerable:!1,configurable:!0}),e.prototype.hasDataVariable=function(e){return this.header.variables&&-1!==this.header.variables.findIndex(function(t){return t.name===e})},e.prototype.getDataVariable=function(e){var t;if(void 0===(t="string"==typeof e?this.header.variables?.find(function(t){return t.name===e}):e))throw Error("variable not found");return this.buffer.seek(t.offset),t.record?function(e,t,r){for(var n=mX(t.type),i=t.size?t.size/pX(n):1,a=r.length,o=Array(a),s=r.recordStep,u=0;u<a;u++){var c=e.offset;o[u]=vX(e,n,i),e.seek(c+s)}return o}(this.buffer,t,this.header.recordDimension):function(e,t){for(var r=mX(t.type),n=t.size/pX(r),i=Array(n),a=0;a<n;a++)i[a]=vX(e,r,1);return i}(this.buffer,t)},e}();function SX(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C;return Pc(this,function(T){for(t=new xX(e),r={coordinates:[],time:[],timeOffset:0,deltaTime:1},n=0,i=t.getDataVariable("coordinates");n<i.length;n++)a=i[n],r.coordinates.push(a);if(t.hasDataVariable("velocities")){for(o=[],s=0,u=t.getDataVariable("velocities");s<u.length;s++)c=u[s],o.push(c);r.velocities=o}if(t.hasDataVariable("forces")){for(l=[],d=0,f=t.getDataVariable("forces");d<f.length;d++)h=f[d],l.push(h);r.forces=l}if(t.hasDataVariable("cell_lengths")){for(p=[],m=0,g=t.getDataVariable("cell_lengths");m<g.length;m++)v=g[m],p.push(v);r.cell_lengths=p}if(t.hasDataVariable("cell_angles")){for(y=[],b=0,_=t.getDataVariable("cell_angles");b<_.length;b++)x=_[b],y.push(x);r.cell_angles=y}if(t.hasDataVariable("time")){for(S=[],w=0,A=t.getDataVariable("time");w<A.length;w++)C=A[w],S.push(C);r.time=S}return r.time&&(r.time.length>=1&&(r.timeOffset=r.time[0]),r.time.length>=2&&(r.deltaTime=r.time[1]-r.time[0])),[2,r]})})}function wX(e){var t=this;return vy.create("Parse NCTRAJ",function(r){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r.update({canAbort:!0,message:"Parsing trajectory..."}),[4,SX(e)];case 1:return t=i.sent(),[2,RS.success(t)];case 2:return n=i.sent(),[2,RS.error(""+n)];case 3:return[2]}})})})}function AX(e){var t=this;return vy.create("Parse NCTRAJ",function(r){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y;return Pc(this,function(b){switch(b.label){case 0:return[4,r.update("Converting to coordinates")];case 1:for(b.sent(),t=VB(e.deltaTime,"step"),n=VB(e.timeOffset,t.unit),i=[],a=0,o=e.coordinates.length;a<o;++a){for(s=e.coordinates[a],u=s.length/3,c=new Float32Array(u),l=new Float32Array(u),d=new Float32Array(u),f=0,h=s.length;f<h;f+=3)c[f/3]=s[f],l[f/3]=s[f+1],d[f/3]=s[f+2];p={elementCount:u,x:c,y:l,z:d,xyzOrdering:{isIdentity:!0},time:VB(n.value+t.value*a,t.unit)},e.cell_lengths&&(m=e.cell_lengths[a],g=Cg.scale(Cg(),Cg.unitX,m[0]),v=Cg.scale(Cg(),Cg.unitY,m[1]),y=Cg.scale(Cg(),Cg.unitZ,m[2]),p.cell=HB.fromBasis(g,v,y)),i.push(p)}return[2,LB.create(i,t,n)]}})})})}function CX(e){var t=this;return vy.create("Parse PRMTOP",function(r){return Tc(t,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c;return Pc(this,function(l){return t=bX.fromPrmtop(e),r=function(e){for(var t=e.pointers,r=e.residuePointer,n=e.residueLabel,i=e.atomName,a=t.NATOM,o=t.NRES,s=new Uint32Array(a),u=[],c=function(e,t,r){for(var i=n.value(e),a=t,o=r;a<o;++a)s[a]=e+1,u[a]=i},l=0,d=o-1;l<d;++l)c(l,r.value(l)-1,r.value(l+1)-1);c(o-1,r.value(o-1)-1,a);var f=xv.ofIntArray(s),h=xv.ofStringArray(u),p=Array(a),m=Array(a),g=new Uint32Array(a),v=new Uint32Array(a),y=new BF,b=new kF(f,i),_="",x=0,S="",w=0,A=0,C=-1;for(l=0,d=a;l<d;++l){var T=f.value(l);if(T!==C){var P=h.value(l),E=cF(b.add(P,l).type,P);E!==A&&(S=RF(x),x+=1,w=0),_=y.getEntityId(P,E,S),w+=1,C=T,A=E}p[l]=_,m[l]=S,g[l]=w,v[l]=l}var M=xv.ofIntArray(v),k=xv.ofStringArray(m),I=Array(a);for(l=0;l<a;++l)I[l]=ZB(i.value(l),h.value(l));
139var D=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:k,auth_atom_id:xv.asArrayColumn(i),auth_comp_id:h,auth_seq_id:f,id:xv.asArrayColumn(M),label_asym_id:k,label_atom_id:xv.asArrayColumn(i),label_comp_id:h,label_seq_id:xv.ofIntArray(g),label_entity_id:xv.ofStringArray(p),occupancy:xv.ofConst(1,a,xv.Schema.float),type_symbol:xv.ofStringArray(I),pdbx_PDB_model_num:xv.ofConst(1,a,xv.Schema.int)},a);return wF({entity:y.getEntityTable(),chem_comp:b.getChemCompTable(),atom_site:D})}(e),n=e.pointers,i=n.NBONH,a=n.NBONA,o=e.bondsIncHydrogen,s=e.bondsWithoutHydrogen,u=i+a,c={indexA:xv.ofLambda({value:function(e){return e<i?o.value(3*e)/3:s.value(3*(e-i))/3},rowCount:u,schema:xv.Schema.int}),indexB:xv.ofLambda({value:function(e){return e<i?o.value(3*e+1)/3:s.value(3*(e-i)+1)/3},rowCount:u,schema:xv.Schema.int}),order:xv.ofConst(1,u,xv.Schema.int)},[2,zF.create(e.title.join(" ")||"PRMTOP",r,c,t)]})})})}function TX(e){var t=this;return vy.create("Parse TOP",function(r){return Tc(t,void 0,void 0,function(){var t,r,n;return Pc(this,function(i){return t=_X.fromTop(e),r=function(e){for(var t=e.molecules,r=e.compounds,n={},i=0,a=0,o=t._rowCount;a<o;++a){var s=t.compound.value(a),u=t.molCount.value(a),c=r[s].atoms;xv.asArrayColumn(c.atom),xv.asArrayColumn(c.resnr),xv.asArrayColumn(c.residu),i+=u*c._rowCount;var l=c.resnr.value(0);n[s]=!0;for(var d=1,f=c._rowCount;d<f;++d){var h=c.resnr.value(d);if(h!==l){n[s]=!1;break}l=h}}var p=Array(i),m=new Uint32Array(i),g=Array(i),v=0;for(a=0,o=t._rowCount;a<o;++a){s=t.compound.value(a),u=t.molCount.value(a),c=r[s].atoms;var y=n[s];for(d=0;d<u;++d)for(var b=0,_=c._rowCount;b<_;++b)p[v]=c.atom.value(b),m[v]=c.resnr.value(b),g[v]=c.residu.value(b),y&&(m[v]+=d),v+=1}var x=xv.ofStringArray(p),S=xv.ofIntArray(m),w=xv.ofStringArray(g),A=Array(i),C=Array(i),T=new Uint32Array(i),P=new Uint32Array(i),E=new BF,M=new kF(S,x),k="",I=0,D="",O=0,R=0,B=-1;for(a=0,o=i;a<o;++a){var N=S.value(a);if(N!==B){var F=w.value(a),L=cF(M.add(F,a).type,F);L!==R&&(D=RF(I),I+=1,O=0),k=E.getEntityId(F,L,D),O+=1,B=N,R=L}A[a]=k,C[a]=D,T[a]=O,P[a]=a}var $=xv.ofIntArray(P),U=xv.ofStringArray(C),j=Array(i);for(a=0;a<i;++a)j[a]=ZB(x.value(a),w.value(a));var z=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:U,auth_atom_id:xv.asArrayColumn(x),auth_comp_id:w,auth_seq_id:S,id:xv.asArrayColumn($),label_asym_id:U,label_atom_id:xv.asArrayColumn(x),label_comp_id:w,label_seq_id:xv.ofIntArray(T),label_entity_id:xv.ofStringArray(A),occupancy:xv.ofConst(1,i,xv.Schema.float),type_symbol:xv.ofStringArray(j),pdbx_PDB_model_num:xv.ofConst(1,i,xv.Schema.int)},i);return wF({entity:E.getEntityTable(),chem_comp:M.getChemCompTable(),atom_site:z})}(e),n=function(e){for(var t=e.molecules,r=e.compounds,n=[],i=[],a=0,o=0,s=t._rowCount;o<s;++o){var u=t.compound.value(o),c=t.molCount.value(o),l=r[u],d=l.atoms,f=l.bonds;if(f)for(var h=0;h<c;++h){for(var p=0,m=f._rowCount;p<m;++p)n.push(f.ai.value(p)-1+a),i.push(f.aj.value(p)-1+a);a+=d._rowCount}else if("TIP3"===u)for(h=0;h<c;++h)n.push(0+a),i.push(1+a),n.push(0+a),i.push(2+a),a+=d._rowCount;else a+=c*d._rowCount}return{indexA:xv.ofIntArray(n),indexB:xv.ofIntArray(i),order:xv.ofConst(1,n.length,xv.Schema.int)}}(e),[2,zF.create(e.system||"TOP",r,n,t)]})})})}(function(e){e.is=function(e){return"prmtop"===e?.kind},e.fromPrmtop=function(e){return{kind:"prmtop",name:e.title.join(" ")||"PRMTOP",data:e}}})(bX||={}),function(e){e.is=function(e){return"top"===e?.kind},e.fromTop=function(e){return{kind:"top",name:e.system||"TOP",data:e}}}(_X||={});var PX=OS.BuiltIn({name:"coordinates-from-dcd",display:{name:"Parse DCD",description:"Parse DCD binary data."},from:[DS.Data.Binary],to:DS.Molecule.Coordinates})({apply:function(e){var t=this,r=e.a;return vy.create("Parse DCD",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,yT(r.data).runInContext(e)];case 1:if((t=i.sent()).isError)throw Error(t.message);return[4,qB(t.result).runInContext(e)];case 2:return n=i.sent(),[2,new DS.Molecule.Coordinates(n,{label:r.label,description:"Coordinates"})]}})})})}}),EX=OS.BuiltIn({name:"coordinates-from-xtc",display:{name:"Parse XTC",description:"Parse XTC binary data."},from:[DS.Data.Binary],to:DS.Molecule.Coordinates})({apply:function(e){var t=this,r=e.a;return vy.create("Parse XTC",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,qW(r.data).runInContext(e)];case 1:if((t=i.sent()).isError)throw Error(t.message);return[4,WW(t.result).runInContext(e)];case 2:return n=i.sent(),[2,new DS.Molecule.Coordinates(n,{label:r.label,description:"Coordinates"})]}})})})}}
139),MX=OS.BuiltIn({name:"coordinates-from-trr",display:{name:"Parse TRR",description:"Parse TRR binary data."},from:[DS.Data.Binary],to:DS.Molecule.Coordinates})({apply:function(e){var t=this,r=e.a;return vy.create("Parse TRR",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,oX(r.data).runInContext(e)];case 1:if((t=i.sent()).isError)throw Error(t.message);return[4,sX(t.result).runInContext(e)];case 2:return n=i.sent(),[2,new DS.Molecule.Coordinates(n,{label:r.label,description:"Coordinates"})]}})})})}}),kX=OS.BuiltIn({name:"coordinates-from-nctraj",display:{name:"Parse NCTRAJ",description:"Parse NCTRAJ binary data."},from:[DS.Data.Binary],to:DS.Molecule.Coordinates})({apply:function(e){var t=this,r=e.a;return vy.create("Parse NCTRAJ",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,wX(r.data).runInContext(e)];case 1:if((t=i.sent()).isError)throw Error(t.message);return[4,AX(t.result).runInContext(e)];case 2:return n=i.sent(),[2,new DS.Molecule.Coordinates(n,{label:r.label,description:"Coordinates"})]}})})})}}),IX=OS.BuiltIn({name:"topology-from-psf",display:{name:"PSF Topology",description:"Create topology from PSF."},from:[DS.Format.Psf],to:DS.Molecule.Topology})({apply:function(e){var t=this,r=e.a;return vy.create("Create Topology",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,JG(r.data).runInContext(e)];case 1:return t=n.sent(),[2,new DS.Molecule.Topology(t,{label:t.label||r.label,description:"Topology"})]}})})})}}),DX=OS.BuiltIn({name:"topology-from-prmtop",display:{name:"PRMTOP Topology",description:"Create topology from PRMTOP."},from:[DS.Format.Prmtop],to:DS.Molecule.Topology})({apply:function(e){var t=this,r=e.a;return vy.create("Create Topology",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,CX(r.data).runInContext(e)];case 1:return t=n.sent(),[2,new DS.Molecule.Topology(t,{label:t.label||r.label,description:"Topology"})]}})})})}}),OX=OS.BuiltIn({name:"topology-from-top",display:{name:"TOP Topology",description:"Create topology from TOP."},from:[DS.Format.Top],to:DS.Molecule.Topology})({apply:function(e){var t=this,r=e.a;return vy.create("Create Topology",function(e){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:return[4,TX(r.data).runInContext(e)];case 1:return t=n.sent(),[2,new DS.Molecule.Topology(t,{label:t.label||r.label,description:"Topology"})]}})})})}});function RX(e,t,r){return Tc(this,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return t.type===DS.Molecule.Topology.type?(n=t.data,[4,Xz.trajectoryFromTopologyAndCoordinates(n,r).runInContext(e)]):[3,2];case 1:return[2,a.sent()];case 2:if(t.type===DS.Molecule.Model.type)return i=t.data,[2,Xz.trajectoryFromModelAndCoordinates(i,r)];a.label=3;case 3:throw Error("no model/topology found")}})})}var BX=OS.BuiltIn({name:"trajectory-from-model-and-coordinates",display:{name:"Trajectory from Topology & Coordinates",description:"Create a trajectory from existing model/topology and coordinates."},from:DS.Root,to:DS.Molecule.Trajectory,params:{modelRef:Ib.Text("",{isHidden:!0}),coordinatesRef:Ib.Text("",{isHidden:!0})}})({apply:function(e){var t=this,r=e.params,n=e.dependencies;return vy.create("Create trajectory from model/topology and coordinates",function(e){return Tc(t,void 0,void 0,function(){var t,i,a;return Pc(this,function(o){switch(o.label){case 0:return t=n[r.coordinatesRef].data,[4,RX(e,n[r.modelRef],t)];case 1:return i=o.sent(),a={label:"Trajectory",description:`${i.frameCount} model${1===i.frameCount?"":"s"}`},[2,new DS.Molecule.Trajectory(i,a)]}})})})}}),NX=OS.BuiltIn({name:"trajectory-from-blob",display:{name:"Parse Blob",description:"Parse format blob into a single trajectory."},from:DS.Format.Blob,to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse Format Blob",function(e){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:t=[],n=0,i=r.data,l.label=1;case 1:return n<i.length?"cif"===(a=i[n]).kind?[4,Kz(a.data.blocks[0]).runInContext(e)]:[3,6]:[3,7];case 2:if(0===(o=l.sent()).frameCount)throw Error("No models found.");u=0,l.label=3;case 3:return u<o.frameCount?[4,vy.resolveInContext(o.getFrameAtIndex(u),e)]:[3,6];case 4:s=l.sent(),t.push(s),l.label=5;case 5:return u++,[3,3];case 6:return n++,[3,1];case 7:for(u=0;
139u<t.length;u++)Xz.TrajectoryInfo.set(t[u],{index:u,size:t.length});return c={label:"Trajectory",description:`${t.length} model${1===t.length?"":"s"}`},[2,new DS.Molecule.Trajectory(new Nz(t),c)]}})})})}});function FX(e){return{label:`${e.representative.entry}`,description:`${e.frameCount} model${1===e.frameCount?"":"s"}`}}var LX=OS.BuiltIn({name:"trajectory-from-mmcif",display:{name:"Trajectory from mmCIF",description:"Identify and create all separate models in the specified CIF data block"},from:DS.Format.Cif,to:DS.Molecule.Trajectory,params:function(e){if(!e)return{loadAllBlocks:Ib.Optional(Ib.Boolean(!1,{description:"If True, ignore Block Header and Block Index parameters and parse all datablocks into a single trajectory."})),blockHeader:Ib.Optional(Ib.Text(void 0,{description:"Header of the block to parse. If not specifed, Block Index parameter applies.",hideIf:function(e){return!0===e.loadAllBlocks}})),blockIndex:Ib.Optional(Ib.Numeric(0,{min:0,step:1},{description:"Zero-based index of the block to parse. Only applies when Block Header parameter is not specified.",hideIf:function(e){return!0===e.loadAllBlocks||e.blockHeader}}))};var t=e.data.blocks,r=t.map(function(e){return[e.header,e.header]});return r.push(["","[Use Block Index]"]),{loadAllBlocks:Ib.Optional(Ib.Boolean(!1,{description:"If True, ignore Block Header and Block Index parameters and parse all data blocks into a single trajectory."})),blockHeader:Ib.Optional(Ib.Select(t[0]&&t[0].header,r,{description:"Header of the block to parse. If not specifed, Block Index parameter applies.",hideIf:function(e){return!0===e.loadAllBlocks}})),blockIndex:Ib.Optional(Ib.Numeric(0,{min:0,step:1,max:t.length-1},{description:"Zero-based index of the block to parse. Only applies when Block Header parameter is not specified.",hideIf:function(e){return!0===e.loadAllBlocks||e.blockHeader}}))}}})({isApplicable:function(e){return e.data.blocks.length>0},apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Parse mmCIF",function(e){return Tc(t,void 0,void 0,function(){var t,i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:if(!n.loadAllBlocks)return[3,10];i=[],a=0,o=r.data.blocks,m.label=1;case 1:return a<o.length?(f=o[a],e.shouldUpdate?[4,e.update(`Parsing ${f.header}...`)]:[3,3]):[3,9];case 2:m.sent(),m.label=3;case 3:return[4,Kz(f).runInContext(e)];case 4:s=m.sent(),u=0,m.label=5;case 5:return u<s.frameCount?(l=(c=i).push,[4,vy.resolveInContext(s.getFrameAtIndex(u),e)]):[3,8];case 6:l.apply(c,[m.sent()]),m.label=7;case 7:return u++,[3,5];case 8:return a++,[3,1];case 9:return t=new Nz(i),[3,15];case 10:if(d=n.blockHeader||r.data.blocks[n.blockIndex??0].header,f=r.data.blocks.find(function(e){return e.header===d}),!f)throw Error(`Data block '${[d]}' not found.`);return!f.categoryNames.includes("chem_comp_atom")||f.categoryNames.includes("atom_site")||f.categoryNames.includes("ihm_sphere_obj_site")||f.categoryNames.includes("ihm_gaussian_obj_site")?[3,12]:[4,Zz(f).runInContext(e)];case 11:return h=m.sent(),[3,14];case 12:return[4,Kz(f,r.data).runInContext(e)];case 13:h=m.sent(),m.label=14;case 14:t=h,m.label=15;case 15:if(0===t.frameCount)throw Error("No models found.");return p=FX(t),[2,new DS.Molecule.Trajectory(t,p)]}})})})}}),$X=OS.BuiltIn({name:"trajectory-from-pdb",display:{name:"Parse PDB",description:"Parse PDB string and create trajectory."},from:[DS.Data.String],to:DS.Molecule.Trajectory,params:{isPdbqt:Ib.Boolean(!1)}})({apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Parse PDB",function(e){return Tc(t,void 0,void 0,function(){var t,i,a;return Pc(this,function(o){switch(o.label){case 0:return[4,ST(r.data,r.label,n.isPdbqt).runInContext(e)];case 1:if((t=o.sent()).isError)throw Error(t.message);return[4,QG(t.result).runInContext(e)];case 2:return i=o.sent(),a=FX(i),[2,new DS.Molecule.Trajectory(i,a)]}})})})}}),UX=OS.BuiltIn({name:"trajectory-from-gro",display:{name:"Parse GRO",description:"Parse GRO string and create trajectory."},from:[DS.Data.String],to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse GRO",function(e){return Tc(t,void 0,void 0,function(){var t,n,i;return Pc(this,function(a){switch(a.label){case 0:return[4,xT(r.data).runInContext(e)];case 1:if((t=a.sent()).isError)throw Error(t.message);return[4,RG(t.result).runInContext(e)];case 2:return n=a.sent(),i=FX(n),[2,new DS.Molecule.Trajectory(n,i)]}})})})}}),jX=OS.BuiltIn({name:"trajectory-from-xyz",display:{name:"Parse XYZ",description:"Parse XYZ string and create trajectory."},from:[DS.Data.String],to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse XYZ",function(e){return Tc(t,void 0,void 0,function(){var t,n,i;return Pc(this,function(a){switch(a.label){case 0:return[4,KW(r.data).runInContext(e)];case 1:if((t=a.sent()).isError)throw Error(t.message);return[4,ZW(t.result).runInContext(e)];case 2:return n=a.sent(),i=FX(n),[2,new DS.Molecule.Trajectory(n,i)]}})})})}}),zX=OS.BuiltIn({name:"trajectory-from-mol",display:{name:"Parse MOL",description:"Parse MOL string and create trajectory."},from:[DS.Data.String],to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse MOL",function(e){return Tc(t,void 0,void 0,function(){var t,n,i;return Pc(this,function(a){switch(a.label){case 0:return[4,PW(r.data).runInContext(e)];case 1:if((t=a.sent()).isError)throw Error(t.message);return[4,(o=t.result,vy.create("Parse MOL",function(e){return EW(o,void 0,e)})).runInContext(e)];case 2:return n=a.sent(),i=FX(n),[2,new DS.Molecule.Trajectory(n,i)]}var o})})})}}),GX=OS.BuiltIn({name:"trajectory-from-sdf",display:{name:"Parse SDF",description:"Parse SDF string and create trajectory."},from:[DS.Data.String],to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse SDF",function(e){return Tc(t,void 0,void 0,function(){var t,n,i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:return[4,iX(r.data).runInContext(e)];case 1:if((t=h.sent()).isError)throw Error(t.message);n=[],i=0,a=t.result.compounds,h.label=2;case 2:return i<a.length?(o=a[i],[4,(p=o,vy.create("Parse SDF",function(e){return EW(p.molFile,eX.create(p),e)})).runInContext(e)]):[3,8];case 3:s=h.sent(),u=0,h.label=4;case 4:return u<s.frameCount?(l=(c=n).push,[4,vy.resolveInContext(s.getFrameAtIndex(u),e)]):[3,7];case 5:l.apply(c,[h.sent()]),h.label=6;case 6:return u++,[3,4];case 7:return i++,[3,2];case 8:return d=new Nz(n),f=FX(d),[2,new DS.Molecule.Trajectory(d,f)]}var p})})})}}),VX=OS.BuiltIn({name:"trajectory-from-mol2",display:{name:"Parse MOL2",description:"Parse MOL2 string and create trajectory."},from:[DS.Data.String],to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse MOL2",function(e){return Tc(t,void 0,void 0,function(){var t,n,i;return Pc(this,function(a){switch(a.label){case 0:return[4,UW(r.data,r.label).runInContext(e)];case 1:if((t=a.sent()).isError)throw Error(t.message);return[4,(o=t.result,vy.create("Parse MOL2",function(e){return function(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E;return Pc(this,function(M){switch(M.label){case 0:r=[],n=0,i=e.structures.length,M.label=1;case 1:if(!(n<i))return[3,4];for(a=e.structures[n],o=a.molecule,s=a.atoms,u=a.bonds,c=a.crysin,l=xv.ofConst("A",s.count,xv.Schema.str),d=Array(s.count),f=!1,h=0;h<s.count;++h)if(s.atom_type.value(h).includes(".")){f=!0;break}for(p=0;p<s.count;++p)d[p]=f?s.atom_type.value(p).split(".")[0].toUpperCase():ZB(s.atom_name.value(p),s.subst_name.value(p));
139for(m=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:l,auth_atom_id:xv.asArrayColumn(s.atom_name),auth_comp_id:s.subst_name,auth_seq_id:s.subst_id,Cartn_x:xv.asArrayColumn(s.x,Float32Array),Cartn_y:xv.asArrayColumn(s.y,Float32Array),Cartn_z:xv.asArrayColumn(s.z,Float32Array),id:xv.asArrayColumn(s.atom_id),label_asym_id:l,label_atom_id:xv.asArrayColumn(s.atom_name),label_comp_id:s.subst_name,label_seq_id:s.subst_id,label_entity_id:xv.ofConst("1",s.count,xv.Schema.str),occupancy:xv.ofConst(1,s.count,xv.Schema.float),type_symbol:xv.ofStringArray(d),pdbx_PDB_model_num:xv.ofConst(n,s.count,xv.Schema.int)},s.count),(g=new BF).setNames([["MOL",o.mol_name||"Unknown Entity"]]),g.getEntityId("MOL",0,"A"),v=new kF(s.subst_id,s.atom_name),y=0,b=s.subst_name.rowCount;y<b;++y)v.add(s.subst_name.value(y),y);return[4,MG(wF({entity:g.getEntityTable(),chem_comp:v.getChemCompTable(),atom_site:m}),kW.create(e),t)];case 2:(_=M.sent()).frameCount>0&&(x=xv.ofIntArray(xv.mapToArray(u.origin_atom_id,function(e){return e-1},Int32Array)),S=xv.ofIntArray(xv.mapToArray(u.target_atom_id,function(e){return e-1},Int32Array)),w=u.bond_id,A=xv.ofIntArray(xv.mapToArray(u.bond_type,function(e){switch(e){case"ar":case"am":case"un":return 1;case"du":case"nc":return 0;default:return parseInt(e)}},Int8Array)),C=xv.ofIntArray(xv.mapToArray(u.bond_type,function(e){switch(e){case"ar":case"am":return 17;case"du":case"nc":return 0;default:return 1}},Int8Array)),T=LF.fromData({pairs:{key:w,indexA:x,indexB:S,order:A,flag:C},count:s.count},{maxDistance:c?-1:1/0}),P=_.representative,LF.Provider.set(P,T),zG.Provider.set(P,{data:s.charge,type:o.charge_type}),c&&(E=function(e){if(1===e.setting){var t=LE.create(e.spaceGroup,Cg.create(e.a,e.b,e.c),Cg.scale(Cg(),Cg.create(e.alpha,e.beta,e.gamma),Math.PI/180));return{spacegroup:$E.create(t),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}}(c),E&&Dz.Provider.set(P,E)),r.push(P)),M.label=3;case 3:return++n,[3,1];case 4:return[2,new Nz(r)]}})})}(o,e)})).runInContext(e)];case 2:return n=a.sent(),i=FX(n),[2,new DS.Molecule.Trajectory(n,i)]}var o})})})}}),HX=OS.BuiltIn({name:"trajectory-from-cube",display:{name:"Parse Cube",description:"Parse Cube file to create a trajectory."},from:DS.Format.Cube,to:DS.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return vy.create("Parse MOL",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,(a=r.data,vy.create("Parse Cube",function(e){return function(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return r=e.atoms,n=xv.ofConst("MOL",e.atoms.count,xv.Schema.str),i=xv.ofConst("A",e.atoms.count,xv.Schema.str),a=xv.ofArray({array:xv.mapToArray(r.number,function(e){return function(e){return DN.has(e)?DN.get(e):kN("H")}(e)}),schema:xv.Schema.Aliased(xv.Schema.str)}),o=xv.ofConst(1,r.count,xv.Schema.int),s=Sv.ofPartialColumns(SF.atom_site,{auth_asym_id:i,auth_atom_id:a,auth_comp_id:n,auth_seq_id:o,Cartn_x:xv.asArrayColumn(r.x,Float32Array),Cartn_y:xv.asArrayColumn(r.y,Float32Array),Cartn_z:xv.asArrayColumn(r.z,Float32Array),id:xv.range(0,r.count-1),label_asym_id:i,label_atom_id:a,label_comp_id:n,label_seq_id:o,label_entity_id:xv.ofConst("1",r.count,xv.Schema.str),occupancy:xv.ofConst(1,r.count,xv.Schema.float),type_symbol:a,pdbx_PDB_model_num:xv.ofConst(1,r.count,xv.Schema.int)},r.count),(u=new BF).setNames([["MOL","Unknown Entity"]]),u.getEntityId("MOL",0,"A"),(c=new kF(o,a)).setNames([["MOL","Unknown Molecule"]]),c.add("MOL",0),[4,MG(wF({entity:u.getEntityTable(),chem_comp:c.getChemCompTable(),atom_site:s}),vW.create(e),t)];case 1:return[2,l.sent()]}})})}(a,e)})).runInContext(e)];case 1:return t=i.sent(),n=FX(t),[2,new DS.Molecule.Trajectory(t,n)]}var a})})})}}),qX=OS.BuiltIn({name:"trajectory-from-cif-core",display:{name:"Parse CIF Core",description:"Identify and create all separate models in the specified CIF data block"},from:DS.Format.Cif,to:DS.Molecule.Trajectory,params:function(e){if(!e)return{blockHeader:Ib.Optional(Ib.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."}))};var t=e.data.blocks;return{blockHeader:Ib.Optional(Ib.Select(t[0]&&t[0].header,t.map(function(e){return[e.header,e.header]}),{description:"Header of the block to parse"}))}}})({apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Parse CIF Core",function(e){return Tc(t,void 0,void 0,function(){var t,i,a,o;return Pc(this,function(s){switch(s.label){case 0:if(t=n.blockHeader||r.data.blocks[0].header,i=r.data.blocks.find(function(e){return e.header===t}),!i)throw Error(`Data block '${[t]}' not found.`);return[4,MW(i).runInContext(e)];case 1:if(0===(a=s.sent()).frameCount)throw Error("No models found.");return o=FX(a),[2,new DS.Molecule.Trajectory(a,o)]}})})})}}),WX=function(e){return e+1},XX=function(e){return e-1},YX=OS.BuiltIn({name:"model-from-trajectory",display:{name:"Molecular Model",description:"Create a molecular model from specified index in a trajectory."},from:DS.Molecule.Trajectory,to:DS.Molecule.Model,params:function(e){return e?{modelIndex:Ib.Converted(WX,XX,Ib.Numeric(1,{min:1,max:e.data.frameCount,step:1},{description:"Model Index",immediateUpdate:!0}))}:{modelIndex:Ib.Numeric(0,{},{description:"Zero-based index of the model",immediateUpdate:!0})}}})({isApplicable:function(e){return e.data.frameCount>0},apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Model from Trajectory",function(e){return Tc(t,void 0,void 0,function(){var t,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return(t=n.modelIndex%r.data.frameCount)<0&&(t+=r.data.frameCount),[4,vy.resolveInContext(r.data.getFrameAtIndex(t),e)];case 1:return i=s.sent(),a=`Model ${t+1}`,o=1===r.data.frameCount?void 0:`of ${r.data.frameCount}`,[2,new DS.Molecule.Model(i,{label:a,description:o})]}})})})},interpolate:function(e,t,r){return{modelIndex:r>=1?t.modelIndex:e.modelIndex+Math.floor((t.modelIndex-e.modelIndex+1)*r)}},dispose:function(e){e.b?.data.customProperties.dispose()}}),KX=OS.BuiltIn({name:"structure-from-trajectory",display:{name:"Structure from Trajectory",description:"Create a molecular structure from a trajectory."},from:DS.Molecule.Trajectory,to:DS.Molecule.Structure})({apply:function(e){var t=this,r=e.a;return vy.create("Build Structure",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,yz.ofTrajectory(r.data,e)];case 1:return t=i.sent(),n={label:"Ensemble",description:yz.elementDescription(t)},[2,new DS.Molecule.Structure(t,n)]}})})})},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),ZX=OS.BuiltIn({name:"structure-from-model",display:{name:"Structure",description:"Create a molecular structure (model, assembly, or symmetry) from the specified model."},from:DS.Molecule.Model,to:DS.Molecule.Structure,params:function(e){return gq.getParams(e&&e.data)}})({canAutoUpdate:function(e){var t=e.oldParams,r=e.newParams;return gq.canAutoUpdate(t.type,r.type)},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Build Structure",function(e){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){return[2,gq.create(t,e,n.data,i&&i.type)]})})})},update:function(e){var t=e.a,r=e.b;return cf(e.oldParams,e.newParams)?r.data.model===t.data?Ob.UpdateResult.Unchanged:Xz.areHierarchiesEqual(t.data,r.data.model)?(r.data=r.data.remapModel(t.data),Ob.UpdateResult.Updated):Ob.UpdateResult.Recreate:Ob.UpdateResult.Recreate},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),QX=Cg(),JX=Og(),eY=Og(),tY=OS.BuiltIn({name:"transform-structure-conformation",display:{name:"Transform Conformation"},isDecorator:!0,from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:{transform:Ib.MappedStatic("components",{components:Ib.Group({axis:Ib.Vec3(Cg.create(1,0,0)),angle:Ib.Numeric(0,{min:-180,max:180,step:.1}),translation:Ib.Vec3(Cg.create(0,0,0))},{isFlat:!0}),matrix:Ib.Group({data:Ib.Mat4(Og.identity()),transpose:Ib.Boolean(!1)},{isFlat:!0})},{label:"Kind"})}})({canAutoUpdate:function(e){return"matrix"!==e.newParams.transform.name},apply:function(e){var t=e.a,r=e.params,n=Og();if("components"===r.transform.name){var i=r.transform.params,a=i.axis,o=i.angle,s=i.translation,u=t.data.boundary.sphere.center;Og.fromTranslation(JX,Cg.negate(QX,u)),Og.fromTranslation(eY,Cg.add(QX,u,s));var c=Og.fromRotation(Og(),Math.PI/180*o,Cg.normalize(Cg(),a));Og.mul3(n,eY,c,JX)}else"matrix"===r.transform.name&&(Og.copy(n,r.transform.params.data),r.transform.params.transpose&&Og.transpose(n,n));var l=yz.transform(t.data,n);return new DS.Molecule.Structure(l,{label:t.label,description:`${t.description} [Transformed]`})},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),rY=OS.BuiltIn({name:"structure-selection-from-expression",display:{name:"Selection",description:"Create a molecular structure from the specified expression."},from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:function(){return{expression:Ib.Value(SL.struct.generator.all,{isHidden:!0}),label:Ib.Optional(Ib.Text("",{isHidden:!0}))}}})({apply:function(e){var t=e.a,r=e.params,n=e.cache,i=vq.createAndRun(t.data,r.expression),a=i.selection;if(n.entry=i.entry,oU.isEmpty(a))return of.Null;
139var o=oU.unionStructure(a),s={label:`${r.label||"Selection"}`,description:yz.elementDescription(o)};return new DS.Molecule.Structure(o,s)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;if(n.expression!==i.expression)return Ob.UpdateResult.Recreate;var o=a.entry;if(o.currentStructure===t.data)return Ob.UpdateResult.Unchanged;var s=vq.updateStructure(o,t.data);return oU.isEmpty(s)?Ob.UpdateResult.Null:(vq.updateStructureObject(r,s,i.label),Ob.UpdateResult.Updated)},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),nY=OS.BuiltIn({name:"structure-multi-selection-from-expression",display:{name:"Multi-structure Measurement Selection",description:"Create selection object from multiple structures."},from:DS.Root,to:DS.Molecule.Structure.Selections,params:function(){return{selections:Ib.ObjectList({key:Ib.Text(void 0,{description:"A unique key."}),ref:Ib.Text(),groupId:Ib.Optional(Ib.Text()),expression:Ib.Value(SL.struct.generator.empty)},function(e){return e.ref},{isHidden:!0}),isTransitive:Ib.Optional(Ib.Boolean(!1,{isHidden:!0,description:"Remap the selections from the original structure if structurally equivalent."})),label:Ib.Optional(Ib.Text("",{isHidden:!0}))}}})({apply:function(e){for(var t=e.params,r=e.cache,n=e.dependencies,i=new Map,a=[],o=0,s=0,u=t.selections;s<u.length;s++){var c=u[s],l=vq.createAndRun(n[c.ref].data,c.expression),d=l.selection,f=l.entry;i.set(c.key,f);var h=oU.toLociWithSourceUnits(d);a.push({key:c.key,loci:h,groupId:c.groupId}),o+=Az.size(h)}r.entries=i;var p={label:`${t.label||"Multi-selection"}`,description:`${t.selections.length} source(s), ${o} element(s) total`};return new DS.Molecule.Structure.Selections(a,p)},update:function(e){var t=e.b,r=e.oldParams,n=e.newParams,i=e.cache,a=e.dependencies;if(!!r.isTransitive!=!!n.isTransitive)return Ob.UpdateResult.Recreate;for(var o=i.entries,s=new Map,u=new Map,c=0,l=t.data;c<l.length;c++){var d=l[c];u.set(d.key,d)}for(var f=!1,h=0,p=[],m=0,g=n.selections;m<g.length;m++){var v=g[m],y=a[v.ref].data,b=!1;if(o.has(v.key)){var _=o.get(v.key);if(vq.isUnchanged(_,v.expression,y)&&u.has(v.key)){(w=u.get(v.key)).groupId!==v.groupId&&(w.groupId=v.groupId,f=!0),s.set(v.key,_),p.push(w),h+=Az.size(w.loci);continue}if(_.expression!==v.expression)b=!0;else{var x=!1;if(n.isTransitive)if(yz.areUnitIdsAndIndicesEqual(_.originalStructure,y)){var S=vq.run(_,_.originalStructure);_.currentStructure=y,s.set(v.key,_);var w=Az.remap(oU.toLociWithSourceUnits(S),y);p.push({key:v.key,loci:w,groupId:v.groupId}),h+=Az.size(w),f=!0}else x=!0;else x=!0;x&&(f=!0,S=vq.updateStructure(_,y),s.set(v.key,_),w=oU.toLociWithSourceUnits(S),p.push({key:v.key,loci:w,groupId:v.groupId}),h+=Az.size(w))}}else b=!0;if(b){f=!0;var A=vq.createAndRun(y,v.expression);S=A.selection,_=A.entry,s.set(v.key,_),w=oU.toLociWithSourceUnits(S),p.push({key:v.key,loci:w}),h+=Az.size(w)}}return f?(i.entries=s,t.data=p,t.label=`${n.label||"Multi-selection"}`,t.description=`${p.length} source(s), ${h} element(s) total`,Ob.UpdateResult.Updated):Ob.UpdateResult.Unchanged}}),iY=OS.BuiltIn({name:"structure-selection-from-script",display:{name:"Selection",description:"Create a molecular structure from the specified script."},from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:function(){return{script:Ib.Script({language:"mol-script",expression:"(sel.atom.atom-groups :residue-test (= atom.resname ALA))"}),label:Ib.Optional(Ib.Text(""))}}})({apply:function(e){var t=e.a,r=e.params,n=e.cache,i=vq.createAndRun(t.data,r.script),a=i.selection;n.entry=i.entry;var o=oU.unionStructure(a),s={label:`${r.label||"Selection"}`,description:yz.elementDescription(o)};return new DS.Molecule.Structure(o,s)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;if(!mq.areEqual(n.script,i.script))return Ob.UpdateResult.Recreate;var o=a.entry;if(o.currentStructure===t.data)return Ob.UpdateResult.Unchanged;var s=vq.updateStructure(o,t.data);return vq.updateStructureObject(r,s,i.label),Ob.UpdateResult.Updated},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),aY=OS.BuiltIn({name:"structure-selection-from-bundle",display:{name:"Selection",description:"Create a molecular structure from the specified structure-element bundle."},from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:function(){return{bundle:Ib.Value(sU.Empty,{isHidden:!0}),label:Ib.Optional(Ib.Text("",{isHidden:!0}))}}})({apply:function(e){var t=e.a,r=e.params,n=e.cache;if(r.bundle.hash!==t.data.hashCode)return of.Null;n.source=t.data;var i=sU.toStructure(r.bundle,t.data);if(0===i.elementCount)return of.Null;var a={label:`${r.label||"Selection"}`,description:yz.elementDescription(i)};return new DS.Molecule.Structure(i,a)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;if(!sU.areEqual(n.bundle,i.bundle))return Ob.UpdateResult.Recreate;if(i.bundle.hash!==t.data.hashCode)return Ob.UpdateResult.Null;if(a.source===t.data)return Ob.UpdateResult.Unchanged;a.source=t.data;var o=sU.toStructure(i.bundle,t.data);return 0===o.elementCount?Ob.UpdateResult.Null:(r.label=`${i.label||"Selection"}`,r.description=yz.elementDescription(o),r.data=o,Ob.UpdateResult.Updated)},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}
139),oY={polymer:"polymer",protein:"protein",nucleic:"nucleic",water:"water",branched:"branched",ligand:"ligand","non-standard":"non-standard",coarse:"coarse","atomic-sequence":"atomic-sequence","atomic-het":"atomic-het",spheres:"spheres"},sY=Ib.objectToOptions(oY),uY=OS.BuiltIn({name:"structure-complex-element",display:{name:"Complex Element",description:"Create a molecular structure from the specified model."},from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:{type:Ib.Select("atomic-sequence",sY,{isHidden:!0})}})({apply:function(e){var t,r,n=e.a,i=e.params;switch(i.type){case"polymer":t=bW.polymer.query,r="Polymer";break;case"protein":t=bW.protein.query,r="Protein";break;case"nucleic":t=bW.nucleic.query,r="Nucleic";break;case"water":t=Zj.internal.water(),r="Water";break;case"branched":t=bW.branchedPlusConnected.query,r="Branched";break;case"ligand":t=bW.ligandPlusConnected.query,r="Ligand";break;case"non-standard":t=bW.nonStandardPolymer.query,r="Non-standard";break;case"coarse":t=bW.coarse.query,r="Coarse";break;case"atomic-sequence":t=Zj.internal.atomicSequence(),r="Sequence";break;case"atomic-het":t=Zj.internal.atomicHet(),r="HET Groups/Ligands";break;case"spheres":t=Zj.internal.spheres(),r="Coarse Spheres";break;default:Lg(i.type)}var a=t(new _U(n.data)),o=oU.unionStructure(a);return 0===o.elementCount?of.Null:new DS.Molecule.Structure(o,{label:r,description:yz.elementDescription(o)})},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),cY=OS.BuiltIn({name:"structure-component",display:{name:"Component",description:"A molecular structure component."},from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:function(){return{type:Ib.MappedStatic("static",{static:Ib.Text("polymer"),expression:Ib.Value(SL.struct.generator.all),bundle:Ib.Value(sU.Empty),script:Ib.Script({language:"mol-script",expression:"(sel.atom.all)"})},{isHidden:!0}),nullIfEmpty:Ib.Optional(Ib.Boolean(!0,{isHidden:!0})),label:Ib.Text("",{isHidden:!0})}}})({apply:function(e){var t=e.a,r=e.params,n=e.cache;return function(e,t,r){r.source=e;var n=yz.Empty,i=void 0;switch(t.type.name){case"static":var a=void 0;switch(t.type.params){case"all":a=bW.all.query,i="All";break;case"polymer":a=bW.polymer.query,i="Polymer";break;case"protein":a=bW.protein.query,i="Protein";break;case"nucleic":a=bW.nucleic.query,i="Nucleic";break;case"water":a=Zj.internal.water(),i="Water";break;case"ion":a=bW.ion.query,i="Ion";break;case"lipid":a=bW.lipid.query,i="Lipid";break;case"branched":a=bW.branchedPlusConnected.query,i="Branched";break;case"ligand":a=bW.ligandPlusConnected.query,i="Ligand";break;case"non-standard":a=bW.nonStandardPolymer.query,i="Non-standard";break;case"coarse":a=bW.coarse.query,i="Coarse";break;default:Lg(t.type)}var o=a(new _U(e));n=oU.unionStructure(o);break;case"script":case"expression":var s=vq.createAndRun(e,t.type.params),u=s.selection;r.entry=s.entry,n=oU.unionStructure(u);break;case"bundle":if(t.type.params.hash!==e.hashCode)break;n=sU.toStructure(t.type.params,e)}if(t.nullIfEmpty&&0===n.elementCount)return of.Null;var c={label:`${t.label||i||"Component"}`,description:yz.elementDescription(n)};return new DS.Molecule.Structure(n,c)}(t.data,r,n)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;return function(e,t,r,n,i){if(r.type.name!==n.type.name)return Ob.UpdateResult.Recreate;var a=!1;switch(n.type.name){case"static":return r.type.params===n.type.params&&yz.areEquivalent(e,i.source)?t.data.model===e.model?Ob.UpdateResult.Unchanged:Xz.areHierarchiesEqual(e.model,t.data.model)?(t.data=t.data.remapModel(e.model),Ob.UpdateResult.Updated):Ob.UpdateResult.Recreate:Ob.UpdateResult.Recreate;case"script":if(!mq.areEqual(r.type.params,n.type.params))return Ob.UpdateResult.Recreate;case"expression":if(r.type.params!==n.type.params)return Ob.UpdateResult.Recreate;if(e===i.source)break;var o=i.entry,s=vq.updateStructure(o,e);i.source=e,t.data=oU.unionStructure(s),vq.updateStructureObject(t,s,n.label),a=!0;break;case"bundle":if(e===i.source&&sU.areEqual(r.type.params,n.type.params))break;i.source=e,n.type.params.hash===e.hashCode?(a=!0,t.data=sU.toStructure(n.type.params,e)):(a=0!==t.data.elementCount,t.data=0===t.data.elementCount?t.data:yz.Empty)}if(a){if(n.nullIfEmpty&&0===t.data.elementCount)return Ob.UpdateResult.Null;t.description=yz.elementDescription(t.data)}return r.label!==n.label&&(a=!0,t.label=`${n.label||t.label}`),a?Ob.UpdateResult.Updated:Ob.UpdateResult.Unchanged}(t.data,r,n,i,a)},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}}),lY=OS.BuiltIn({name:"custom-model-properties",display:{name:"Custom Model Properties"},isDecorator:!0,from:DS.Molecule.Model,to:DS.Molecule.Model,params:function(e,t){return t.customModelProperties.getParams(e?.data)}})({apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Custom Props",function(e){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){switch(r.label){case 0:return[4,dY(n.data,t,e,i)];case 1:return r.sent(),[2,new DS.Molecule.Model(n.data,{label:n.label,description:n.description})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b,a=e.oldParams,o=e.newParams;return vy.create("Custom Props",function(e){return Tc(r,void 0,void 0,function(){var r,s,u,c;return Pc(this,function(l){switch(l.label){case 0:for(i.data=n.data,i.label=n.label,i.description=n.description,r=0,s=a.autoAttach;r<s.length;r++)u=s[r],(c=t.customModelProperties.get(u))&&n.data.customProperties.reference(c.descriptor,!1);return[4,dY(n.data,t,e,o)];case 1:return l.sent(),[2,Ob.UpdateResult.Updated]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}});function dY(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:i={runtime:r,assetManager:t.managers.asset},a=n.autoAttach,o=n.properties,s=0,u=Object.keys(o),h.label=1;case 1:if(!(s<u.length))return[3,8];if(c=u[s],l=t.customModelProperties.get(c),d=o[c],!a.includes(c)&&!l.isHidden)return[3,6];h.label=2;case 2:return h.trys.push([2,4,,5]),[4,l.attach(i,e,d,!0)];case 3:return h.sent(),[3,5];case 4:return f=h.sent(),t.log.warn(`Error attaching model prop '${c}': ${f}`),[3,5];case 5:return[3,7];case 6:l.set(e,d),h.label=7;case 7:return s++,[3,1];case 8:return[2]}})})}var fY=OS.BuiltIn({name:"custom-structure-properties",display:{name:"Custom Structure Properties"},isDecorator:!0,from:DS.Molecule.Structure,to:DS.Molecule.Structure,params:function(e,t){return t.customStructureProperties.getParams(e?.data.root)}})({apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Custom Props",function(e){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){switch(r.label){case 0:return[4,hY(n.data.root,t,e,i)];case 1:return r.sent(),[2,new DS.Molecule.Structure(n.data,{label:n.label,description:n.description})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b,a=e.oldParams,o=e.newParams;return n.data===i.data?vy.create("Custom Props",function(e){return Tc(r,void 0,void 0,function(){var r,s,u,c;return Pc(this,function(l){switch(l.label){case 0:for(i.data=n.data,i.label=n.label,i.description=n.description,r=0,s=a.autoAttach;r<s.length;r++)u=s[r],(c=t.customStructureProperties.get(u))&&n.data.customPropertyDescriptors.reference(c.descriptor,!1);return[4,hY(n.data.root,t,e,o)];case 1:return l.sent(),[2,Ob.UpdateResult.Updated]}})})}):Ob.UpdateResult.Recreate},dispose:function(e){e.b?.data.customPropertyDescriptors.dispose()}});function hY(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:i={runtime:r,assetManager:t.managers.asset},a=n.autoAttach,o=n.properties,s=0,u=Object.keys(o),h.label=1;case 1:if(!(s<u.length))return[3,8];if(c=u[s],l=t.customStructureProperties.get(c),d=o[c],!a.includes(c)&&!l.isHidden)return[3,6];h.label=2;case 2:return h.trys.push([2,4,,5]),[4,l.attach(i,e,d,!0)];case 3:return h.sent(),[3,5];case 4:return f=h.sent(),t.log.warn(`Error attaching structure prop '${c}': ${f}`),[3,5];case 5:return[3,7];case 6:l.set(e,d),h.label=7;case 7:return s++,[3,1];case 8:return[2]}})})}var pY,mY,gY,vY,yY=OS.BuiltIn({name:"shape-from-ply",display:{name:"Shape from PLY",description:"Create Shape from PLY data"},from:DS.Format.Ply,to:DS.Shape.Provider,params:function(e){return{transforms:Ib.Optional(Ib.Value([],{isHidden:!0})),label:Ib.Optional(Ib.Text("",{isHidden:!0}))}}})({apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Create shape from PLY",function(e){return Tc(t,void 0,void 0,function(){var t,i;return Pc(this,function(a){switch(a.label){case 0:return[4,GB(r.data,n).runInContext(e)];case 1:return t=a.sent(),i={label:n.label||"Shape"},[2,new DS.Shape.Provider(t,i)]}})})})}}),bY=Object.freeze({__proto__:null,CoordinatesFromDcd:PX,CoordinatesFromNctraj:kX,CoordinatesFromTrr:MX,CoordinatesFromXtc:EX,CustomModelProperties:lY,CustomStructureProperties:fY,ModelFromTrajectory:YX,MultiStructureSelectionFromExpression:nY,ShapeFromPly:yY,StructureComplexElement:uY,StructureComplexElementTypes:oY,StructureComponent:cY,StructureFromModel:ZX,StructureFromTrajectory:KX,StructureSelectionFromBundle:aY,StructureSelectionFromExpression:rY,StructureSelectionFromScript:iY,TopologyFromPrmtop:DX,TopologyFromPsf:IX,TopologyFromTop:OX,TrajectoryFromBlob:NX,TrajectoryFromCifCore:qX,TrajectoryFromCube:HX,TrajectoryFromGRO:UX,TrajectoryFromMOL:zX,TrajectoryFromMOL2:VX,TrajectoryFromMmCif:LX,TrajectoryFromModelAndCoordinates:BX,TrajectoryFromPDB:$X,TrajectoryFromSDF:GX,TrajectoryFromXYZ:jX,TransformStructureConformation:tY});function _Y(e,t){var r=this;return vy.create("Create Volume",function(n){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y;return Pc(this,function(b){return r=e.header,n=e.values,i=Cg.create(r.xLength,r.yLength,r.zLength),t&&t.voxelSize&&Cg.mul(i,i,t.voxelSize),a=Cg.create(Mg(r.alpha),Mg(r.beta),Mg(r.gamma)),o=r.ISPG>65536?0:r.ISPG,s=LE.create(o||"P 1",i,a),u=Cg.create(r.MAPC-1,r.MAPR-1,r.MAPS-1),c=Tg.convertToCanonicalAxisIndicesFastToSlow(u),l=[r.NX,r.NY,r.NZ],d=c([r.NC,r.NR,r.NS]),f=function(e){return 0===e.originX&&0===e.originY&&0===e.originZ?Cg.create(e.NCSTART,e.NRSTART,e.NSSTART):Cg.create(e.originX/(e.xLength/e.NX),e.originY/(e.yLength/e.NY),e.originZ/(e.zLength/e.NZ))}(r),null!=t&&t.offset&&Cg.add(f,f,t.offset),h=c(f),p=Cg.create(h[0]/l[0],h[1]/l[1],h[2]/l[2]),m=Cg.create(d[0]/l[0],d[1]/l[1],d[2]/l[2]),g=Tg.Space(d,Tg.invertAxisOrder(u),function(e){var t=rw(e);switch(t){case FS.Float32:return Float32Array;case FS.Int8:return Int8Array;case FS.Int16:return Int16Array;case FS.Uint16:return Uint16Array}throw Error(`${t} is not a supported value format.`)}(r)),v=Tg.create(g,Tg.Data1(n)),y=0===r.AMIN&&0===r.AMAX&&0===r.AMEAN&&0===r.ARMS,[2,{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:s,fractionalBox:YE.create(p,Cg.add(Cg.zero(),p,m))},cells:v,stats:{min:isNaN(r.AMIN)||y?Fb(n):r.AMIN,max:isNaN(r.AMAX)||y?Nb
139(n):r.AMAX,mean:isNaN(r.AMEAN)||y?Ub(n):r.AMEAN,sigma:isNaN(r.ARMS)||0===r.ARMS?jb(n):r.ARMS}},sourceData:pY.create(e),customProperties:new vR,_propertyData:Object.create(null)}]})})})}function xY(e,t){var r=this;return vy.create("Create Volume",function(n){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h;return Pc(this,function(p){return r=e.header,n=e.values,i=Cg.create(r.xlen,r.ylen,r.zlen),t&&t.voxelSize&&Cg.mul(i,i,t.voxelSize),a=Cg.create(Mg(r.alpha),Mg(r.beta),Mg(r.gamma)),o=LE.create("P 1",i,a),s=[r.xRate,r.yRate,r.zRate],u=[r.xExtent,r.yExtent,r.zExtent],c=[r.xStart,r.yStart,r.zStart],l=Cg.create(c[0]/s[0],c[1]/s[1],c[2]/s[2]),d=Cg.create(u[0]/s[0],u[1]/s[1],u[2]/s[2]),f=Tg.Space(u,[0,1,2],Float32Array),h=Tg.create(f,Tg.Data1(n)),[2,{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:o,fractionalBox:YE.create(l,Cg.add(Cg.zero(),l,d))},cells:h,stats:{min:Fb(n),max:Nb(n),mean:Ub(n),sigma:void 0===r.sigma?jb(n):r.sigma}},sourceData:mY.create(e),customProperties:new vR,_propertyData:Object.create(null)}]})})})}function SY(e,t){var r=this;return vy.create("Create Volume",function(){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s;return Pc(this,function(u){return r=e.header,n=e.values,i=Tg.Space(r.dim,[0,1,2],Float64Array),a=Tg.create(i,Tg.Data1(n)),o=Og.fromTranslation(Og(),r.min),s=Og.fromScaling(Og(),r.h),Og.mul(o,o,s),[2,{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"matrix",matrix:o},cells:a,stats:{min:Fb(n),max:Nb(n),mean:Ub(n),sigma:jb(n)}},sourceData:gY.create(e),customProperties:new vR,_propertyData:Object.create(null)}]})})})}function wY(e,t){var r=this;return vy.create("Create Segmentation Volume",function(n){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B;return Pc(this,function(N){for(r=e.volume_data_3d_info,n=e.segmentation_data_3d,i=LE.create(r.spacegroup_number.value(0),Cg.ofArray(r.spacegroup_cell_size.value(0)),Cg.scale(Cg(),Cg.ofArray(r.spacegroup_cell_angles.value(0)),Math.PI/180)),a=r.axis_order.value(0),o=Tg.convertToCanonicalAxisIndicesFastToSlow(a),s=o(r.sample_count.value(0)),u=Tg.Space(s,Tg.invertAxisOrder(a),Float32Array),c=Tg.create(u,Tg.Data1(n.values.toArray({array:Float32Array}))),l=Cg.ofArray(o(r.origin.value(0))),d=Cg.ofArray(o(r.dimensions.value(0))),f={label:t?.label,entryId:void 0,grid:{transform:{kind:"spacegroup",cell:i,fractionalBox:YE.create(l,Cg.add(Cg(),l,d))},cells:c,stats:{min:0,max:1,mean:0,sigma:1}},sourceData:vY.create(e),customProperties:new vR,_propertyData:{ownerId:t?.ownerId}},gR.PickingGranularity.set(f,"object"),h=new Map,p=new Map,m=e.segmentation_data_table,g=m.segment_id,v=m.set_id,I=0,D=g.rowCount;I<D;++I)y=g.value(I),0!==(b=v.value(I))&&0!==y&&(p.has(b)||p.set(b,new Set),p.get(b).add(y));for(p.forEach(function(e,t){e.forEach(function(e){h.has(e)||h.set(e,new Set),h.get(e).add(t)})}),_=[0,0,0],x=c.space.getCoords,S=c.data,w=f.grid.cells.space.dimensions,A=w[0],C=w[1],T=w[2],P=A-1,E=C-1,M=T-1,k={},p.forEach(function(e,t){k[t]=[P,E,M,-1,-1,-1]}),I=0,D=S.length;I<D;++I)0!==(O=S[I])&&(x(I,_),R=k[O],_[0]<R[0]&&(R[0]=_[0]),_[1]<R[1]&&(R[1]=_[1]),_[2]<R[2]&&(R[2]=_[2]),_[0]>R[3]&&(R[3]=_[0]),_[1]>R[4]&&(R[4]=_[1]),_[2]>R[5]&&(R[5]=_[2]));return B={},h.forEach(function(e,t){B[t]=YE.create(Cg.create(P,E,M),Cg.create(-1,-1,-1))}),Hg(k,function(e,t){p.get(parseInt(t)).forEach(function(t){var r=B[t];e[0]<r.min[0]&&(r.min[0]=e[0]),e[1]<r.min[1]&&(r.min[1]=e[1]),e[2]<r.min[2]&&(r.min[2]=e[2]),e[3]>r.max[0]&&(r.max[0]=e[3]),e[4]>r.max[1]&&(r.max[1]=e[4]),e[5]>r.max[2]&&(r.max[2]=e[5])})}),gR.Segmentation.set(f,{segments:h,sets:p,bounds:B,labels:t?.segmentLabels??{}}),[2,f]})})})}(function(e){e.is=function(e){return"ccp4"===e?.kind},e.create=function(e){return{kind:"ccp4",name:e.name,data:e}}})(pY||={}),function(e){e.is=function(e){return"dsn6"===e?.kind},e.create=function(e){return{kind:"dsn6",name:e.name,data:e}}}(mY||={}),function(e){e.is=function(e){return"dx"===e?.kind},e.create=function(e){return{kind:"dx",name:e.name,data:e}}}(gY||={}),function(e){e.is=function(e){return"segcif"===e?.kind},e.create=function(e){return{kind:"segcif",name:e._name,data:e}}}(vY||={});var AY=OS.BuiltIn({name:"volume-from-ccp4",display:{name:"Volume from CCP4/MRC/MAP",description:"Create Volume from CCP4/MRC/MAP data"},from:DS.Format.Ccp4,to:DS.Volume.Data,params:function(e){return{voxelSize:Ib.Vec3(Cg.create(1,1,1)),offset:Ib.Vec3(Cg.create(0,0,0)),entryId:Ib.Text("")}}})({apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Create volume from CCP4/MRC/MAP",function(e){return Tc(t,void 0,void 0,function(){var t,i;return Pc(this,function(a){switch(a.label){case 0:return[4,_Y(r.data,Ac(Ac({},n),{label:r.data.name||r.label})).runInContext(e)];case 1:return t=a.sent(),i={label:t.label||"Volume",description:`Volume ${r.data.header.NX}×${r.data.header.NX}×${r.data.header.NX}`},[2,new DS.Volume.Data(t,i)]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}}),CY=OS.BuiltIn({name:"volume-from-dsn6",display:{name:"Volume from DSN6/BRIX",description:"Create Volume from DSN6/BRIX data"},from:DS.Format.Dsn6,to:DS.Volume.Data,params:function(e){return{voxelSize:Ib.Vec3(Cg.create(1,1,1)),entryId:Ib.Text("")}}})({apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Create volume from DSN6/BRIX",function(e){return Tc(t,void 0,void 0,function(){var t,i;return Pc(this,function(a){switch(a.label){case 0:return[4,xY(r.data,Ac(Ac({},n),{label:r.data.name||r.label})).runInContext(e)];case 1:return t=a.sent(),i={label:t.label||"Volume",description:`Volume ${r.data.header.xExtent}×${r.data.header.yExtent}×${r.data.header.zExtent}`},[2,new DS.Volume.Data(t,i)]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}}),TY=OS.BuiltIn({name:"volume-from-cube",display:{name:"Volume from Cube",description:"Create Volume from Cube data"},from:DS.Format.Cube,to:DS.Volume.Data,params:function(e){return{dataIndex:e?Ib.Select(0,e.data.header.dataSetIds.map(function(e,t){return[t,`${e}`]})):Ib.Numeric(0),entryId:Ib.Text("")}}})({apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Create volume from Cube",function(e){return Tc(t,void 0,void 0,function(){var t,i;return Pc(this,function(a){switch(a.label){case 0:return[4,yR(r.data,Ac(Ac({},n),{label:r.data.name||r.label})).runInContext(e)];case 1:return t=a.sent(),i={label:t.label||"Volume",description:`Volume ${r.data.header.dim[0]}×${r.data.header.dim[1]}×${r.data.header.dim[2]}`},[2,new DS.Volume.Data(t,i)]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}}),PY=OS.BuiltIn({name:"volume-from-dx",display:{name:"Parse DX",description:"Create volume from DX data."},from:DS.Format.Dx,to:DS.Volume.Data})({apply:function(e){var t=this,r=e.a;return vy.create("Parse DX",function(e){return Tc(t,void 0,void 0,function(){var t,n;return Pc(this,function(i){switch(i.label){case 0:return[4,SY(r.data,{label:r.data.name||r.label}).runInContext(e)];case 1:return t=i.sent(),n={label:t.label||"Volume",description:`Volume ${r.data.header.dim[0]}×${r.data.header.dim[1]}×${r.data.header.dim[2]}`},[2,new DS.Volume.Data(t,n)]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}}),EY=OS.BuiltIn({name:"volume-from-density-server-cif",display:{name:"Volume from density-server CIF",description:"Identify and create all separate models in the specified CIF data block"},from:DS.Format.Cif,to:DS.Volume.Data,params:function(e){if(!e)return{blockHeader:Ib.Optional(Ib.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),entryId:Ib.Text("")};var t=e.data.blocks.slice(1);return{blockHeader:Ib.Optional(Ib.Select(t[0]&&t[0].header,t.map(function(e){return[e.header,e.header]}),{description:"Header of the block to parse"})),entryId:Ib.Text("")}}})({isApplicable:function(e){return e.data.blocks.length>0},apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Parse density-server CIF",function(e){return Tc(t,void 0,void 0,function(){var t,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:if(t=n.blockHeader||r.data.blocks[1].header,i=r.data.blocks.find(function(e){return e.header===t}),!i)throw Error(`Data block '${[t]}' not found.`);return[4,bR(a=JA.schema.densityServer(i),{entryId:n.entryId}).runInContext(e)];case 1:return o=f.sent(),s=o.grid.cells.space.dimensions,u=s[0],c=s[1],l=s[2],d={label:n.entryId??a.volume_data_3d_info.name.value(0),description:`Volume ${u}×${c}×${l}`},[2,new DS.Volume.Data(o,d)]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}}),MY=OS.BuiltIn({name:"volume-from-segmentation-cif",display:{name:"Volume from Segmentation CIF"},from:DS.Format.Cif,to:DS.Volume.Data,params:function(e){var t=e?.data.blocks.slice(1);return{blockHeader:t?Ib.Optional(Ib.Select(t[0]&&t[0].header,t.map(function(e){return[e.header,e.header]}),{description:"Header of the block to parse"})):Ib.Optional(Ib.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),segmentLabels:Ib.ObjectList({id:Ib.Numeric(-1),label:Ib.Text("")},function(e){return`${e.id} = ${e.label}`},{description:"Mapping of segment IDs to segment labels"}),ownerId:Ib.Text("",{isHidden:!0,description:"Reference to the object which manages this volume"})}}})({isApplicable:function(e){return e.data.blocks.length>0},apply:function(e){var t=this,r=e.a,n=e.params;return vy.create("Parse segmentation CIF",function(e){return Tc(t,void 0,void 0,function(){var t,i,a,o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:if(t=n.blockHeader||r.data.blocks[1].header,i=r.data.blocks.find(function(e){return e.header===t}),!i)throw Error(`Data block '${[t]}' not found.`);for(a=JA.schema.segmentation(i),o={},s=0,u=n.segmentLabels;s<u.length;s++)c=u[s],o[c.id]=c.label;return[4,wY(a,{segmentLabels:o,ownerId:n.ownerId}).runInContext(e)];case 1:return l=g.sent(),d=l.grid.cells.space.dimensions,f=d[0],h=d[1],p=d[2],m={label:a.volume_data_3d_info.name.value(0),description:`Segmentation ${f}×${h}×${p}`},[2,new DS.Volume.Data(l,m)]}})})})},dispose:function(e){e.b?.data.customProperties.dispose()}}),kY=OS.BuiltIn({name:"assign-color-volume",display:{name:"Assign Color Volume",description:"Assigns another volume to be available for coloring."},from:DS.Volume.Data,to:DS.Volume.Data,isDecorator:!0,params:function(e,t){if(!e)return{ref:Ib.Text()};var r=t.state.data.select(Zb.Generators.root.subtree().ofType(DS.Volume.Data).filter(function(t){return!!t.obj&&!t.obj?.data.colorVolume&&t.obj!==e}));return 0===r.length?{ref:Ib.Text("",{isHidden:!0})}:{ref:Ib.Select(r[0].transform.ref,r.map(function(e){return[e.transform.ref,e.obj.label]}))}}})({apply:function(e){var t=this,r=e.a,n=e.params,i=e.dependencies;return vy.create("Assign Color Volume",function(e){return Tc(t,void 0,void 0,function(){var e,t,a;
139return Pc(this,function(o){if(!i||!i[n.ref])throw Error("Dependency not available.");return e=i[n.ref].data,t=Ac(Ac({},r.data),{colorVolume:e}),a={label:r.label,description:"Volume + Colors"},[2,new DS.Volume.Data(t,a)]})})})}}),IY=Object.freeze({__proto__:null,AssignColorVolume:kY,VolumeFromCcp4:AY,VolumeFromCube:TY,VolumeFromDensityServerCif:EY,VolumeFromDsn6:CY,VolumeFromDx:PY,VolumeFromSegmentationCif:MY}),DY=tv(13421772),OY={},RY={name:"carbohydrate-symbol",label:"Carbohydrate Symbol",category:NI.Residue,factory:function e(t,r){var n;if(t.structure){var i=t.structure.carbohydrates,a=i.elements,o=i.getElementIndices,s=function(e,t){if(!tU.isAtomic(e))return DY;var r=o(e,t);return r.length>0?a[r[0]].component.color:DY};n=function(e,t){return t?fN:qF.is(e)?s(e.unit,e.element):C$.isLocation(e)?s(e.aUnit,e.aUnit.elements[e.aIndex]):DY}}else n=function(){return DY};return{factory:e,granularity:"group",color:n,props:r,description:"Assigns colors according to the Symbol Nomenclature for Glycans (SNFG).",legend:wT(bN)}},getParams:function(e){return OY},defaultValues:Ib.getDefaultValues(OY),isApplicable:function(e){return!!e.structure&&e.structure.models.some(function(e){return Xz.hasCarbohydrate(e)})}},BY={hue:Ib.Interval([1,360],{min:0,max:360,step:1}),chroma:Ib.Interval([40,70],{min:0,max:100,step:1}),luminance:Ib.Interval([15,85],{min:0,max:100,step:1}),sort:Ib.Select("contrast",Ib.arrayToOptions(["none","contrast"]),{description:"no sorting leaves colors approximately ordered by hue"}),clusteringStepCount:Ib.Numeric(50,{min:10,max:200,step:1},{isHidden:!0}),minSampleCount:Ib.Numeric(800,{min:100,max:5e3,step:100},{isHidden:!0}),sampleCountFactor:Ib.Numeric(5,{min:1,max:100,step:1},{isHidden:!0})},NY=[0,0,0],FY=[0,0,0];function LY(e,t){return Jg.toHcl(NY,e),Jg.fromColor(FY,Jg.toColor(e)),NY[0]>=t.hue[0]&&NY[0]<=t.hue[1]&&NY[1]>=t.chroma[0]&&NY[1]<=t.chroma[1]&&NY[2]>=t.luminance[0]&&NY[2]<=t.luminance[1]&&FY[0]>=e[0]-2&&FY[0]<=e[0]+2&&FY[1]>=e[1]-2&&FY[1]<=e[1]+2&&FY[2]>=e[2]-2&&FY[2]<=e[2]+2}function $Y(e,t){for(var r=1/0,n=0,i=0;i<e.length;i++){var a=Jg.distance(t,e[i]);a<r&&(r=a,n=i)}return n}var UY={type:"generate",colorList:"red-yellow-blue"};function jY(e){void 0===e&&(e={});var t=Ac(Ac({},UY),e);return{palette:Ib.MappedStatic(t.type,{colors:Ib.Group({list:Ib.ColorList(t.colorList)},{isFlat:!0}),generate:Ib.Group(Ac(Ac({},BY),{maxCount:Ib.Numeric(75,{min:1,max:250,step:1})}),{isFlat:!0})},{options:[["colors","Color List"],["generate","Generate Distinct"]]})}}Ib.getDefaultValues(jY());var zY={valueLabel:function(e){return`${e+1}`},minLabel:"Start",maxLabel:"End"};function GY(e,t,r){var n,i;if(void 0===r&&(r={}),"colors"===t.palette.name&&"interpolate"===t.palette.params.list.kind){var a=t.palette.params.list,o=[0,e-1],s=Ac(Ac({},zY),r),u=s.minLabel,c=s.maxLabel,l=a.colors;0===l.length&&(l=sv(UY.colorList).list);var d=wE.create({listOrName:l,domain:o,minLabel:u,maxLabel:c});i=d.legend,n=d.color}else{var f;"colors"===t.palette.name?(f=t.palette.params.list.colors.map(function(e){return Array.isArray(e)?e[0]:e}),0===f.length&&(f=sv("dark-2").list.map(function(e){return Array.isArray(e)?e[0]:e}))):(e=Math.min(e,t.palette.params.maxCount),f=function(e,t){void 0===t&&(t={});var r=Ac(Ac({},Ib.getDefaultValues(BY)),t);if(e<=0)return[];var n=function(e,t){for(var r=new Map,n=Math.ceil(Math.cbrt(e)),i=ev(),a=Math.max((t.hue[1]-t.hue[0])/n,1),o=Math.max((t.chroma[1]-t.chroma[0])/n,1),s=Math.max((t.luminance[1]-t.luminance[0])/n,1),u=t.hue[0]+a/2;u<=t.hue[1];u+=a)for(var c=t.chroma[0]+o/2;c<=t.chroma[1];c+=o)for(var l=t.luminance[0]+s/2;l<=t.luminance[1];l+=s){var d=Jg.fromHcl(Jg(),ev.set(i,u,c,l));LY(d,t)&&r.set(Jg.toColor(d),d)}return Array.from(r.values())}(Math.max(r.minSampleCount,e*r.sampleCountFactor),r);if(n.length<e)return console.warn("Not enough samples to generate distinct colors, increase sample count."),Array(e).fill(MC.lightgrey);for(var i=[],a=[],o=Math.floor(n.length/e),s=0;s<n.length&&(i.push(n[s]),a.push([]),!(i.length>=e));s+=o);for(var u=1;u<=r.clusteringStepCount;++u){var c=Vg(a),l=Vg(n);for(s=0;s<i.length;++s){var d=$Y(l,i[s]);c[s].push(n[d]),l.splice(d,1)}for(s=0;s<l.length;++s)c[$Y(i,n[s])].push(n[s]);var f=Vg(i);for(s=0;s<c.length;++s){var h=c[s],p=h.length;if(0!==p){for(var m=0,g=0,v=0,y=0,b=h;y<b.length;y++){var _=b[y];m+=_[0],g+=_[1],v+=_[2]}i[s]=[m/p,g/p,v/p]}}if(cf(f,i))break}return("contrast"===r.sort?function(e){for(var t=e.slice(0),r=[t.shift()];t.length>0;){for(var n=r[r.length-1],i=0,a=-1/0,o=0;o<t.length;++o){var s=Jg.distance(n,t[o]);s>a&&(a=s,i=o)}r.push(t.splice(i,1)[0])}return r}(i):i).map(function(e){return Jg.toColor(e)})}(e,t.palette.params));for(var h=r.valueLabel??zY.valueLabel,p=f.length,m=[],g=0;g<e;++g){var v=g%p;void 0===m[v]?m[v]=[h(g),f[v]]:m[v][0]+=`, ${h(g)}`}i=wT(m),n=function(e){return f[e%p]}}return{color:n,legend:i}}var VY=tv(16448250),HY=Ac({asymId:Ib.Select("auth",Ib.arrayToOptions(["auth","label"]))},jY({type:"colors",colorList:"many-distinct"}));function qY(e,t){var r=function(e,t){switch(e.kind){case 0:return"auth"===t?Cj.chain.auth_asym_id:Cj.chain.label_asym_id;case 1:case 2:return Cj.coarse.asym_id}}(e.unit,t)(e);return e.structure.root.models.length>1?WY(e.unit.model,r):r}function WY(e,t){return`${t}|${(Xz.Index.get(e).value||0)+1}`}function XY(e,t){var r,n;if(e.structure){var i=qF.create(e.structure.root),a=function(e,t){for(var r=new Map,n=function(n){var i=Xz.AsymIdOffset.get(n).value,a=("auth"===t?i?.auth:i?.label)||0,o=0;
139n.properties.structAsymMap.forEach(function(i,s){var u=i.auth_id,c="auth"===t?u:s,l=e.models.length>1?WY(n,c):c;r.has(l)||(r.set(l,o+a),++o)})},i=0,a=e.models;i<a.length;i++)n(a[i]);return r}(e.structure.root,t.asymId),o=Array.from(a.keys()),s=GY(a.size,t,{valueLabel:function(e){return o[e]}});n=s.legend,r=function(e){var r=void 0;if(qF.is(e)){var n=qY(e,t.asymId);r=a.get(n)}else C$.isLocation(e)&&(i.unit=e.aUnit,i.element=e.aUnit.elements[e.aIndex],n=qY(i,t.asymId),r=a.get(n));return void 0===r?VY:s.color(r)}}else r=function(){return VY};return{factory:XY,granularity:"group",color:r,props:t,description:"Gives every chain a color based on its `asym_id` value.",legend:n}}var YY={name:"chain-id",label:"Chain Id",category:NI.Chain,factory:XY,getParams:function(e){var t,r=Ib.clone(HY);return null!=(t=e.structure)&&t.models.some(function(e){return e.coarseHierarchy.isDefined})&&(r.asymId.defaultValue="label"),r},defaultValues:Ib.getDefaultValues(HY),isApplicable:function(e){return!!e.structure}},KY=tv(13421772),ZY=Ac({},jY({type:"colors",colorList:"red-yellow-blue"})),QY={name:"element-index",label:"Element Index",category:NI.Atom,factory:function e(t,r){var n,i;if(t.structure){for(var a=t.structure.root.units,o=a.length,s=new Map,u=new Map,c=0,l=0;l<o;++l)s.set(l,c),c+=a[l].elements.length,u.set(a[l].id,l);var d=GY(c,r);i=d.legend,n=function(e){if(qF.is(e)){var t=u.get(e.unit.id),r=kP.findPredecessorIndex(a[t].elements,e.element);return d.color(s.get(t)+r)}return C$.isLocation(e)?(t=u.get(e.aUnit.id),r=kP.findPredecessorIndex(a[t].elements,e.aUnit.elements[e.aIndex]),d.color(s.get(t)+r)):KY}}else n=function(){return KY};return{factory:e,granularity:"groupInstance",preferSmoothing:!0,color:n,props:r,description:"Gives every element (atom or coarse sphere/gaussian) a unique color based on the position (index) of the element in the list of elements in the structure.",legend:i}},getParams:function(e){return ZY},defaultValues:Ib.getDefaultValues(ZY),isApplicable:function(e){return!!e.structure}};function JY(e){var t={};return Hg(e,function(r,n){t[n]=Ib.Color(e[n])}),t}var eK=tv(13421772),tK=Ac({},jY({type:"colors",colorList:"many-distinct"}));function rK(e,t){var r,n;if(e.structure){var i=function(e){for(var t=new Map,r=0,n=e.units.length;r<n;++r){var i=e.units[r].conformation.operator.name;t.has(i)||t.set(i,t.size)}return t}(e.structure.root),a=Array.from(i.keys()),o=GY(i.size,t,{valueLabel:function(e){return a[e]}});n=o.legend,r=function(e){var t=void 0;if(qF.is(e)){var r=e.unit.conformation.operator.name;t=i.get(r)}else if(C$.isLocation(e)){var n=e.aUnit.conformation.operator.name;t=i.get(n)}return void 0===t?eK:o.color(t)}}else r=function(){return eK};return{factory:rK,granularity:"instance",color:r,props:t,description:"Assigns a color based on the operator name of a transformed chain.",legend:n}}var nK={name:"operator-name",label:"Operator Name",category:NI.Symmetry,factory:rK,getParams:function(e){return Ib.clone(tK)},defaultValues:Ib.getDefaultValues(tK),isApplicable:function(e){return!!e.structure}},iK=tv(16448250),aK=Ac({},jY({type:"colors",colorList:"many-distinct"}));function oK(e,t){return`${e}|${t}`}function sK(e){switch(e.unit.kind){case 0:return Cj.chain.label_entity_id(e);case 1:case 2:return Cj.coarse.entity_id(e)}}function uK(e,t){var r,n;if(e.structure){var i=qF.create(e.structure.root),a=function(e){for(var t=new Map,r=0,n=e.models.length;r<n;++r){for(var i=e.models[r].atomicHierarchy.chains.label_entity_id,a=0,o=i.rowCount;a<o;++a){var s=oK(i.value(a),r);t.has(s)||t.set(s,t.size)}var u=e.models[r].coarseHierarchy;if(u.isDefined){var c=u.spheres.entity_id;for(a=0,o=c.rowCount;a<o;++a)s=oK(c.value(a),r),t.has(s)||t.set(s,t.size);var l=u.gaussians.entity_id;for(a=0,o=l.rowCount;a<o;++a)s=oK(l.value(a),r),t.has(s)||t.set(s,t.size)}}return t}(e.structure.root),o=Array.from(a.keys()),s=GY(a.size,t,{valueLabel:function(e){return o[e]}});n=s.legend,r=function(e){var t=void 0;if(qF.is(e)){var r=oK(sK(e),e.structure.models.indexOf(e.unit.model));t=a.get(r)}else C$.isLocation(e)&&(i.unit=e.aUnit,i.element=e.aUnit.elements[e.aIndex],r=oK(sK(i),i.structure.models.indexOf(i.unit.model)),t=a.get(r));return void 0===t?iK:s.color(t)}}else r=function(){return iK};return{factory:uK,granularity:"group",color:r,props:t,description:"Gives every chain a color based on its `label_entity_id` value.",legend:n}}var cK={name:"entity-id",label:"Entity Id",category:NI.Chain,factory:uK,getParams:function(e){return Ib.clone(aK)},defaultValues:Ib.getDefaultValues(aK),isApplicable:function(e){return!!e.structure}},lK="dark-2",dK=tv(16448250),fK=Ac({},jY({type:"colors",colorList:lK}
139));function hK(e,t){return`${e}|${t}`}function pK(e,t,r,n,i,a){return`${e}|${t}|${r}|${a||i||n}`}function mK(e,t,r,n,i,a,o,s){for(var u=i.entity_id,c=i.pdbx_src_id,l=i.pdbx_beg_seq_num,d=i.pdbx_end_seq_num,f=0,h=i._rowCount;f<h;++f){var p=u.value(f),m=hK(r,p),g=void 0;if(e.has(m))g=e.get(m);else{var v=n.entities.getEntityIndex(p),y=n.sequence.sequences[v].sequence;g=new Int16Array(y.length),e.set(m,g)}var b=o?o.value(f):"",_=s?s.value(f)[0]:"",x=pK(r,p,a.value(f),c.value(f),b,_),S=0===l.valueKind(f)?l.value(f):1,w=0===d.valueKind(f)?d.value(f):g.length,A=void 0;t.has(x)?A=t.get(x):(A=t.size+1,t.set(x,A));for(var C=S,T=w;C<=T;++C)g[C-1]=A}}function gK(e){for(var t=new Map,r=new Map,n=0,i=e.length;n<i;++n){var a=e[n];if(qz.is(a.sourceData)){var o=a.sourceData.data.db,s=o.entity_src_gen,u=o.entity_src_nat,c=o.pdbx_entity_src_syn;mK(t,r,n,a,s,s.pdbx_gene_src_scientific_name,s.plasmid_name,s.pdbx_gene_src_gene),mK(t,r,n,a,u,u.pdbx_organism_scientific,u.pdbx_plasmid_name),mK(t,r,n,a,c,c.organism_scientific)}}return{seqToSrcByModelEntity:t,srcKeySerialMap:r}}function vK(e,t){var r,n;if(e.structure){var i=qF.create(e.structure),a=e.structure.root.models,o=gK(a),s=o.seqToSrcByModelEntity,u=o.srcKeySerialMap,c=function(e){var t=0;return Array.from(e.keys()).map(function(e){var r=e.split("|"),n=r[2];return`${function(e){e=e.trim();var t=parseInt(e,10);return!isNaN(t)&&t.toString()===e}(r[3])?"Unnamed "+ ++t:r[3]}${n?` (${n})`:""}`})}(u),l=GY(u.size,t,{valueLabel:function(e){return c[e]}});n=l.legend;var d=function(e){var t=hK(a.indexOf(e.unit.model),Cj.entity.id(e)),r=s.get(t);if(r){var n=r[Cj.residue.label_seq_id(e)-1]-1;return-1===n?dK:l.color(n)}return dK};r=function(e){return qF.is(e)?d(e):C$.isLocation(e)?(i.unit=e.aUnit,i.element=e.aUnit.elements[e.aIndex],d(i)):dK}}else r=function(){return dK};return{factory:vK,granularity:"group",color:r,props:t,description:"Gives ranges of a polymer chain a color based on the entity source it originates from (e.g. gene, plasmid, organism).",legend:n}}var yK={name:"entity-source",label:"Entity Source",category:NI.Chain,factory:vK,getParams:function(e){var t=Ib.clone(fK);return e.structure&&gK(e.structure.root.models).srcKeySerialMap.size>av[lK].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Ac(Ac({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:sv(lK).list}})),t},defaultValues:Ib.getDefaultValues(fK),isApplicable:function(e){return!!e.structure}},bK=tv(13421772),_K=Ac({},jY({type:"colors",colorList:"many-distinct"}));function xK(e,t){var r,n;if(e.structure){var i=GY((Xz.MaxIndex.get(e.structure.models[0]).value??-1)+1,t);n=i.legend,r=function(e){return qF.is(e)?i.color(Xz.Index.get(e.unit.model).value||0):C$.isLocation(e)?i.color(Xz.Index.get(e.aUnit.model).value||0):bK}}else r=function(){return bK};return{factory:xK,granularity:"instance",color:r,props:t,description:"Gives every model a unique color based on its index.",legend:n}}var SK={name:"model-index",label:"Model Index",category:NI.Chain,factory:xK,getParams:function(e){return Ib.clone(_K)},defaultValues:Ib.getDefaultValues(_K),isApplicable:function(e){return!!e.structure&&e.structure.elementCount>0}},wK=tv(13421772),AK=Ac({},jY({type:"colors",colorList:"many-distinct"}));function CK(e,t){var r,n;if(e.structure){var i=GY((yz.MaxIndex.get(e.structure).value??-1)+1,t);n=i.legend,r=function(e){return qF.is(e)?i.color(yz.Index.get(e.structure).value||0):C$.isLocation(e)?i.color(yz.Index.get(e.aStructure).value||0):wK}}else r=function(){return wK};return{factory:CK,granularity:"instance",color:r,props:t,description:"Gives every structure a unique color based on its index.",legend:n}}var TK={name:"structure-index",label:"Structure Index",category:NI.Chain,factory:CK,getParams:function(e){return Ib.clone(AK)},defaultValues:Ib.getDefaultValues(AK),isApplicable:function(e){return!!e.structure&&e.structure.elementCount>0}},PK="dark-2",EK=tv(13421772),MK=Ac({},jY({type:"colors",colorList:PK}));function kK(e,t){var r,n;if(e.structure){var i=e.structure.root.units,a=GY(i.length,t);n=a.legend;for(var o=new Map,s=0,u=i.length;s<u;++s)o.set(i[s].id,a.color(s));r=function(e){return qF.is(e)?o.get(e.unit.id):C$.isLocation(e)?o.get(e.aUnit.id):EK}}else r=function(){return EK};return{factory:kK,granularity:"instance",color:r,props:t,description:"Gives every chain instance (single chain or collection of single elements) a unique color based on the position (index) of the chain in the list of chains in the structure.",legend:n}}var IK={name:"unit-index",label:"Chain Instance",category:NI.Chain,factory:kK,getParams:function(e){var t=Ib.clone(MK);return e.structure&&e.structure.root.units.length>av[PK].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Ac(Ac({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:sv(PK).list}})),t},defaultValues:Ib.getDefaultValues(MK),isApplicable:function(e){return!!e.structure}},DK={H:16777215,D:16777152,T:16777120,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215},OK=tv(16777215),RK={carbonColor:Ib.MappedStatic("chain-id",{"chain-id":Ib.Group(HY),"unit-index":Ib.Group(MK,{label:"Chain Instance"}),"entity-id":Ib.Group(aK),"entity-source":Ib.Group(fK),"operator-name":Ib.Group(tK),"model-index":Ib.Group(_K),"structure-index":Ib.Group(AK),uniform:Ib.Group(LI),"element-symbol":Ib.EmptyGroup()},{description:"Use chain-id coloring for carbon atoms."}),saturation:Ib.Numeric(0,{min:-6,max:6,step:.1}),lightness:Ib.Numeric(.2,{min:-6,max:6,step:.1}),colors:Ib.MappedStatic("default",{default:Ib.EmptyGroup(),custom:Ib.Group(JY(DK))})};function BK(e,t){var r=nv("default"===t.colors.name?DK:t.colors.params,t.saturation,t.lightness),n=function(e,t){switch(t.name){case"chain-id":return XY(e,t.params);case"unit-index":return kK(e,t.params);case"entity-id":return uK(e,t.params);case"entity-source":return vK(e,t.params);case"operator-name":return rK(e,t.params);case"model-index":return xK(e,t.params);case"structure-index":return CK(e,t.params);case"uniform":return $I(0,t.params);case"element-symbol":return;default:Lg()}}(e,t.carbonColor)?.color;function i(e,t){return n&&"C"===e?n(t,!1):function(e,t){var r=e[t];return void 0===r?OK:r}(r,e)}return{factory:BK,granularity:"operator-name"===t.carbonColor.name||"unit-index"===t.carbonColor.name?"groupInstance":"group",preferSmoothing:!0,color:function(e){if(qF.is(e)){
139if(tU.isAtomic(e.unit))return i(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element),e)}else if(C$.isLocation(e)&&tU.isAtomic(e.aUnit))return i(e.aUnit.model.atomicHierarchy.atoms.type_symbol.value(e.aUnit.elements[e.aIndex]),e);return OK},props:t,description:"Assigns a color to every atom according to its chemical element.",legend:wT(Object.keys(r).map(function(e){return[e,r[e]]}))}}var NK={name:"element-symbol",label:"Element Symbol",category:NI.Atom,factory:BK,getParams:function(e){return Ib.clone(RK)},defaultValues:Ib.getDefaultValues(RK),isApplicable:function(e){return!!e.structure}},FK={water:3697840,ion:15729279,protein:12496596,RNA:16629894,DNA:12540695,PNA:4367514,saccharide:8374655},LK=tv(16777113),$K={saturation:Ib.Numeric(0,{min:-6,max:6,step:.1}),lightness:Ib.Numeric(0,{min:-6,max:6,step:.1}),colors:Ib.MappedStatic("default",{default:Ib.EmptyGroup(),custom:Ib.Group(JY(FK))})};function UK(e,t,r){switch(F$(t,r)){case 2:return e.water;case 3:return e.ion;case 5:return e.protein;case 6:return e.RNA;case 7:return e.DNA;case 8:return e.PNA;case 9:return e.saccharide}return LK}function jK(e,t){var r=nv("default"===t.colors.name?FK:t.colors.params,t.saturation,t.lightness);return{factory:jK,granularity:"group",color:function(e){return qF.is(e)?UK(r,e.unit,e.element):C$.isLocation(e)?UK(r,e.aUnit,e.aUnit.elements[e.aIndex]):LK},props:t,description:"Assigns a color based on the molecule type of a residue.",legend:wT(Object.keys(r).map(function(e){return[e,r[e]]}).concat([["Other/unknown",LK]]))}}var zK={name:"molecule-type",label:"Molecule Type",category:NI.Residue,factory:jK,getParams:function(e){return $K},defaultValues:Ib.getDefaultValues($K),isApplicable:function(e){return!!e.structure}},GK="dark-2",VK=tv(16448250),HK=Ac({},jY({type:"colors",colorList:GK}));function qK(e){switch(e.kind){case 0:return Cj.chain.label_asym_id;case 1:case 2:return Cj.coarse.asym_id}}function WK(e){for(var t=new Map,r=0,n=e.unitSymmetryGroups.length;r<n;++r){var i=e.unitSymmetryGroups[r].units[0],a=i.model;if(tU.isAtomic(i))for(var o=a.atomicHierarchy,s=o.chainAtomSegments,u=o.chains,c=fE.transientSegments(s,i.elements);c.hasNext;){var l=c.move().index,d=u.label_entity_id.value(l),f=a.entities.getEntityIndex(d);if("polymer"===a.entities.data.type.value(f)){var h=u.label_asym_id.value(l);t.has(h)||t.set(h,t.size)}}else if(tU.isCoarse(i)){var p=tU.isSpheres(i)?a.coarseHierarchy.spheres:a.coarseHierarchy.gaussians,m=p.chainElementSegments,g=p.asym_id,v=p.entity_id;for(c=fE.transientSegments(m,i.elements);c.hasNext;){l=c.move().index;var y=m.offsets[l];d=v.value(y),f=a.entities.getEntityIndex(d),"polymer"===a.entities.data.type.value(f)&&(h=g.value(y),t.has(h)||t.set(h,t.size))}}}return t}var XK={name:"polymer-id",label:"Polymer Chain Id",category:NI.Chain,factory:function e(t,r){var n,i;if(t.structure){var a=qF.create(t.structure),o=WK(t.structure.root),s=Array.from(o.keys()),u=GY(o.size,r,{valueLabel:function(e){return s[e]}});i=u.legend,n=function(e){var t=void 0;if(qF.is(e)){var r=qK(e.unit);t=o.get(r(e))}else C$.isLocation(e)&&(r=qK(e.aUnit),a.unit=e.aUnit,a.element=e.aUnit.elements[e.aIndex],t=o.get(r(a)));return void 0===t?VK:u.color(t)}}else n=function(){return VK};return{factory:e,granularity:"group",color:n,props:r,description:"Gives every polymer chain a color based on its `asym_id` value.",legend:i}},getParams:function(e){var t=Ib.clone(HK);return e.structure&&WK(e.structure.root).size>av[GK].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Ac(Ac({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:sv(GK).list}})),t},defaultValues:Ib.getDefaultValues(HK),isApplicable:function(e){return!!e.structure}},YK="dark-2",KK=tv(13421772),ZK=Ac({},jY({type:"colors",colorList:YK}));function QK(e){for(var t=0,r=e.units,n=0,i=r.length;n<i;++n)r[n].polymerElements.length>0&&++t;return t}var JK={name:"polymer-index",label:"Polymer Chain Instance",category:NI.Chain,factory:function e(t,r){var n,i;if(t.structure){var a=GY(QK(t.structure.root),r);i=a.legend;for(var o=t.structure.root.units,s=new Map,u=0,c=0,l=o.length;u<l;++u)o[u].polymerElements.length>0&&(s.set(o[u].id,a.color(c)),++c);n=function(e){var t;return qF.is(e)?t=s.get(e.unit.id):C$.isLocation(e)&&(t=s.get(e.aUnit.id)),void 0===t?KK:t}}else n=function(){return KK};return{factory:e,granularity:"instance",color:n,props:r,description:"Gives every polymer chain instance a unique color based on the position (index) of the polymer in the list of polymers in the structure.",legend:i}},getParams:function(e){var t=Ib.clone(ZK);return e.structure&&QK(e.structure.root)>
139av[YK].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Ac(Ac({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:sv(YK).list}})),t},defaultValues:Ib.getDefaultValues(ZK),isApplicable:function(e){return!!e.structure}},eZ={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:15658734,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,A:14423100,G:3329330,I:10145074,C:16766720,T:4286945,U:4251856,DA:14423100,DG:3329330,DI:10145074,DC:16766720,DT:4286945,DU:4251856,APN:14423100,GPN:3329330,CPN:16766720,TPN:4286945},tZ=tv(16711935),rZ={saturation:Ib.Numeric(0,{min:-6,max:6,step:.1}),lightness:Ib.Numeric(1,{min:-6,max:6,step:.1}),colors:Ib.MappedStatic("default",{default:Ib.EmptyGroup(),custom:Ib.Group(JY(eZ))})};function nZ(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function iZ(e,t){var r=e.coarseElements.seq_id_begin.value(t);if(r===e.coarseElements.seq_id_end.value(t)){var n=e.coarseElements.entityKey[t];return e.model.sequence.byEntityKey[n].sequence.compId.value(r-1)}}function aZ(e,t){var r=e[t];return void 0===r?tZ:r}function oZ(e,t){var r=nv("default"===t.colors.name?eZ:t.colors.params,t.saturation,t.lightness);return{factory:oZ,granularity:"group",preferSmoothing:!0,color:function(e){if(qF.is(e)){if(tU.isAtomic(e.unit)){var t=nZ(e.unit,e.element);return aZ(r,t)}if(t=iZ(e.unit,e.element))return aZ(r,t)}else if(C$.isLocation(e)){if(tU.isAtomic(e.aUnit))return t=nZ(e.aUnit,e.aUnit.elements[e.aIndex]),aZ(r,t);if(t=iZ(e.aUnit,e.aUnit.elements[e.aIndex]))return aZ(r,t)}return tZ},props:t,description:"Assigns a color to every residue according to its name.",legend:wT(Object.keys(r).map(function(e){return[e,r[e]]}).concat([["Unknown",tZ]]))}}var sZ={name:"residue-name",label:"Residue Name",category:NI.Residue,factory:oZ,getParams:function(e){return rZ},defaultValues:Ib.getDefaultValues(rZ),isApplicable:function(e){return!!e.structure}},uZ={alphaHelix:16711808,threeTenHelix:10485888,piHelix:6291584,betaTurn:6324479,betaStrand:16762880,coil:16777215,bend:6740169,turn:45670,dna:11403518,rna:16580962,carbohydrate:10921722},cZ=tv(8421504),lZ={saturation:Ib.Numeric(-1,{min:-6,max:6,step:.1}),lightness:Ib.Numeric(0,{min:-6,max:6,step:.1}),colors:Ib.MappedStatic("default",{default:Ib.EmptyGroup(),custom:Ib.Group(JY(uZ))})};function dZ(e,t,r,n){var i=ON.create(0);if(n&&tU.isAtomic(t)){var a=n.get(t.invariantId);a&&(i=a.type[a.getIndex(t.residueIndex[r])])}if(ON.is(i,2))return ON.is(i,2048)?e.threeTenHelix:ON.is(i,32768)?e.piHelix:e.alphaHelix;if(ON.is(i,4))return e.betaStrand;if(ON.is(i,8))return e.bend;if(ON.is(i,16))return e.turn;var o=F$(t,r);return 7===o?e.dna:6===o?e.rna:9===o?e.carbohydrate:5===o?e.coil:cZ}function fZ(e,t){var r=e.structure&&lj.get(e.structure),n=r?Tv(r.id,r.version):-1,i=nv("default"===t.colors.name?uZ:t.colors.params,t.saturation,t.lightness);return{factory:fZ,granularity:"group",preferSmoothing:!0,color:function(e){return qF.is(e)?dZ(i,e.unit,e.element,r?.value):C$.isLocation(e)?dZ(i,e.aUnit,e.aUnit.elements[e.aIndex],r?.value):cZ},props:t,contextHash:n,description:"Assigns a color based on the type of secondary structure and basic molecule type.",legend:wT(Object.keys(i).map(function(e){return[e,i[e]]}).concat([["Other",cZ]]))}}var hZ={name:"secondary-structure",label:"Secondary Structure",category:NI.Residue,factory:fZ,getParams:function(e){return lZ},defaultValues:Ib.getDefaultValues(lZ),isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(e,t){return t.structure?lj.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&lj.ref(e.structure,!1)}}},pZ=tv(13421772),mZ={list:Ib.ColorList("turbo",{presetKind:"scale"})};function gZ(e,t){var r=e.model;switch(e.kind){case 0:var n=r.atomicHierarchy.residueAtomSegments.index[t];return r.atomicHierarchy.residues.label_seq_id.value(n);case 1:return Math.round((r.coarseHierarchy.spheres.seq_id_begin.value(t)+r.coarseHierarchy.spheres.seq_id_end.value(t))/2);case 2:return Math.round((r.coarseHierarchy.gaussians.seq_id_begin.value(t)+r.coarseHierarchy.gaussians.seq_id_end.value(t))/2)}}function vZ(e,t){var r=e.model,n="";switch(e.kind){case 0:var i=r.atomicHierarchy.chainAtomSegments.index[t];n=r.atomicHierarchy.chains.label_entity_id.value(i);break;case 1:n=r.coarseHierarchy.spheres.entity_id.value(t);break;case 2:n=r.coarseHierarchy.gaussians.entity_id.value(t)}if(""===n)return 0;var a=r.entities.getEntityIndex(n);if(-1===a)return 0;var o=r.sequence.byEntityKey[a];return void 0===o?0:o.sequence.length}var yZ={name:"sequence-id",label:"Sequence Id",category:NI.Residue,factory:function e(t,r){var n=wE.create({listOrName:r.list.colors,minLabel:"Start",maxLabel:"End"});return{factory:e,granularity:"group",preferSmoothing:!0,color:function(e){if(qF.is(e)){var t=e.unit,r=e.element;if((i=gZ(t,r))>0&&(a=vZ(t,r)))return n.setDomain(0,a-1),n.color(i)}else if(C$.isLocation(e)){var i,a,o=e.aUnit,s=e.aIndex;if((i=gZ(o,o.elements[s]))>0&&(a=vZ(o,o.elements[s])))return n.setDomain(0,a-1),n.color(i)}return pZ},props:r,description:"Gives every polymer residue a color based on its `seq_id` value.",legend:n?n.legend:void 0}},getParams:function(e){return mZ},defaultValues:Ib.getDefaultValues(mZ),isApplicable:function(e){return!!e.structure}},bZ=tv(16777113),_Z={domain:Ib.Interval([0,100]),list:Ib.ColorList("red-white-blue",{presetKind:"scale"})};function xZ(e,t){return tU.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t):tU.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]:0}var SZ={name:"uncertainty",label:"Uncertainty/Disorder",category:NI.Atom,factory:function e(t,r){var n=wE.create({reverse:!0,domain:r.domain,listOrName:r.list.colors});return{factory:e,granularity:"group",preferSmoothing:!0,color:function(e){return qF.is(e)?n.color(xZ(e.unit,e.element)):C$.isLocation(e)?n.color(xZ(e.aUnit,e.aUnit.elements[e.aIndex])):bZ},props:r,description:"Assigns a color based on the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique.",legend:n?n.legend:void 0}},getParams:function(e){return _Z},defaultValues:Ib.getDefaultValues(_Z),isApplicable:function(e){return!!e.structure&&e.structure.models.some(function(e){return e.atomicConformation.B_iso_or_equiv.isDefined||e.coarseHierarchy.isDefined})}},wZ=tv(15658734),AZ={style:Ib.MappedStatic("entity-id",{uniform:Ib.Group(LI),"chain-id":Ib.Group(HY),"entity-id":Ib.Group(aK),"entity-source":Ib.Group(fK),"molecule-type":Ib.Group($K),"model-index":Ib.Group(_K),"structure-index":Ib.Group(AK)}),carbonLightness:Ib.Numeric(.8,{min:-6,max:6,step:.1})}
139,CZ={name:"illustrative",label:"Illustrative",category:NI.Misc,factory:function e(t,r){var n=function(e,t){switch(t.name){case"uniform":return $I(0,t.params);case"chain-id":return XY(e,t.params);case"entity-id":return uK(e,t.params);case"entity-source":return vK(e,t.params);case"molecule-type":return jK(0,t.params);case"model-index":return xK(e,t.params);case"structure-index":return CK(e,t.params);default:Lg()}}(t,r.style),i=n.color,a=n.legend;function o(e,t){var n=i(e,!1);return"C"===t?tv.lighten(n,r.carbonLightness):n}return{factory:e,granularity:"group",preferSmoothing:!0,color:function(e){if(qF.is(e)&&tU.isAtomic(e.unit)){var t=e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element);return o(e,t)}if(C$.isLocation(e)&&tU.isAtomic(e.aUnit)){var r=e.aUnit.elements[e.aIndex];return t=e.aUnit.model.atomicHierarchy.atoms.type_symbol.value(r),o(e,t)}return wZ},props:r,description:"Assigns an illustrative color that gives every chain a color based on the chosen style but with lighter carbons (inspired by David Goodsell's Molecule of the Month style).",legend:a}},getParams:function(e){return Ib.clone(AZ)},defaultValues:Ib.getDefaultValues(AZ),isApplicable:function(e){return!!e.structure}},TZ={list:Ib.ColorList("red-yellow-green",{presetKind:"scale"}),scale:Ib.Select("DGwif",[["DGwif","DG water-membrane"],["DGwoct","DG water-octanol"],["Oct-IF","DG difference"]])},PZ={DGwif:0,DGwoct:1,"Oct-IF":2};function EZ(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function MZ(e,t){var r=e.coarseElements.seq_id_begin.value(t);if(r===e.coarseElements.seq_id_end.value(t)){var n=e.coarseElements.entityKey[t];return e.model.sequence.byEntityKey[n].sequence.compId.value(r-1)}}var kZ={name:"hydrophobicity",label:"Hydrophobicity",category:NI.Residue,factory:function e(t,r){var n=PZ[r.scale],i=1/0,a=-1/0;for(var o in vF){var s=vF[o][n];i=Math.min(i,s),a=Math.max(a,s)}var u=wE.create({listOrName:r.list.colors,domain:[a,i],minLabel:"Hydrophilic",maxLabel:"Hydrophobic"});return{factory:e,granularity:"group",preferSmoothing:!0,color:function(e){var t;return qF.is(e)?t=tU.isAtomic(e.unit)?EZ(e.unit,e.element):MZ(e.unit,e.element):C$.isLocation(e)&&(t=tU.isAtomic(e.aUnit)?EZ(e.aUnit,e.aUnit.elements[e.aIndex]):MZ(e.aUnit,e.aUnit.elements[e.aIndex])),u.color(t?function(e,t){var r=vF[e];return void 0===r?0:r[t]}(t,n):0)},props:r,description:'Assigns a color to every amino acid according to the "Experimentally determined hydrophobicity scale for proteins at membrane interfaces" by Wimely and White (doi:10.1038/nsb1096-842).',legend:u?u.legend:void 0}},getParams:function(e){return TZ},defaultValues:Ib.getDefaultValues(TZ),isApplicable:function(e){return!!e.structure}},IZ=tv(13421772),DZ=Ac({},jY({type:"colors",colorList:"purples"})),OZ={name:"trajectory-index",label:"Trajectory Index",category:NI.Chain,factory:function e(t,r){var n,i;if(t.structure){for(var a=t.structure.root.models,o=0,s=0,u=a;s<u.length;s++){var c=u[s];o=Math.max(o,Xz.TrajectoryInfo.get(c)?.size||0)}var l=GY(o,r);i=l.legend;for(var d=new Map,f=0,h=a.length;f<h;++f){var p=Xz.TrajectoryInfo.get(a[f])?.index||0;d.set(p,l.color(p))}n=function(e){return qF.is(e)?d.get(Xz.TrajectoryInfo.get(e.unit.model).index):C$.isLocation(e)?d.get(Xz.TrajectoryInfo.get(e.aUnit.model).index):IZ}}else n=function(){return IZ};return{factory:e,granularity:"instance",color:n,props:r,description:"Gives every model (frame) a unique color based on the index in its trajectory.",legend:i}},getParams:function(e){return Ib.clone(DZ)},defaultValues:Ib.getDefaultValues(DZ),isApplicable:function(e){return!!e.structure&&e.structure.elementCount>0&&Xz.TrajectoryInfo.get(e.structure.models[0]).size>1}},RZ=tv(13421772),BZ={domain:Ib.Interval([0,1]),list:Ib.ColorList("purples",{presetKind:"scale"})};function NZ(e,t){return tU.isAtomic(e)?e.model.atomicConformation.occupancy.value(t):0}var FZ={name:"occupancy",label:"Occupancy",category:NI.Atom,factory:function e(t,r){var n=wE.create({reverse:!1,domain:r.domain,listOrName:r.list.colors});return{factory:e,granularity:"group",preferSmoothing:!0,color:function(e){return qF.is(e)?n.color(NZ(e.unit,e.element)):C$.isLocation(e)?n.color(NZ(e.aUnit,e.aUnit.elements[e.aIndex])):RZ},props:r,description:"Assigns a color based on the occupancy of an atom.",legend:n?n.legend:void 0}},getParams:function(e){return BZ},defaultValues:Ib.getDefaultValues(BZ),isApplicable:function(e){return!!e.structure&&e.structure.models.some(function(e){return e.atomicConformation.occupancy.isDefined})}},LZ="dark-2",$Z=tv(13421772),UZ=Ac({},jY({type:"colors",colorList:LZ})),jZ=1e4;function zZ(e){return e.map(function(e){return`${e+jZ}`.padStart(5,"0")}).join("")}function GZ(e){var t=function(e){return Math.abs(e)<0?0:Math.floor(Math.log10(Math.abs(e)))+1}(jZ),r=parseInt(e.substr(0,t)),n=parseInt(e.substr(t,t)),i=parseInt(e.substr(t+t,t));return Cg.create(r-jZ,n-jZ,i-jZ)}function VZ(e){return e.map(function(e){return e+5}).join("")}function HZ(e){for(var t=new Map,r=new Set,n=0,i=e.units.length;n<i;++n){var a=zZ(e.units[n].conformation.operator.hkl);r.add(a)}var o=Array.from(r.values()).sort();return o.forEach(function(e){return t.set(e,t.size)}),{min:GZ(o[0]),max:GZ(o[o.length-1]),map:t}}var qZ={name:"operator-hkl",label:"Operator HKL",category:NI.Symmetry,factory:function e(t,r){var n,i;if(t.structure){var a=HZ(t.structure.root),o=a.min,s=a.max,u=a.map,c=[];u.forEach(function(e,t){var r=e%u.size,n=VZ(GZ(t));void 0===c[r]?c[r]=n:c[r]+=`, ${n}`});var l={minLabel:VZ(o),maxLabel:VZ(s),valueLabel:function(e){return c[e]}},d=GY(u.size,r,l);i=d.legend,n=function(e){var t=void 0;if(qF.is(e)){var r=zZ(e.unit.conformation.operator.hkl);t=u.get(r)}else C$.isLocation(e)&&(r=zZ(e.aUnit.conformation.operator.hkl),t=u.get(r));return void 0===t?$Z:d.color(t)}}else n=function(){return $Z};return{factory:e,granularity:"instance",color:n,props:r,description:"Assigns a color based on the operator HKL value of a transformed chain.",legend:i}},getParams:function(e){var t=Ib.clone(UZ);return e.structure&&HZ(e.structure.root).map.size>av[LZ].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Ac(Ac({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:sv(LZ).list}})),t},defaultValues:Ib.getDefaultValues(UZ),isApplicable:function(e){return!!e.structure}},WZ=tv(16777113),XZ={domain:Ib.Interval([-1,1]),list:Ib.ColorList("red-white-blue",{presetKind:"scale"})};function YZ(e,t){return zG.Provider.get(e.model)?.data.value(t)}
139var KZ,ZZ={name:"partial-charge",label:"Partial Charge",category:NI.Atom,factory:function e(t,r){var n=wE.create({domain:r.domain,listOrName:r.list.colors});return{factory:e,granularity:"group",preferSmoothing:!0,color:function(e){var t;return qF.is(e)?void 0===(t=YZ(e.unit,e.element))?WZ:n.color(t):C$.isLocation(e)&&void 0!==(t=YZ(e.aUnit,e.aUnit.elements[e.aIndex]))?n.color(t):WZ},props:r,description:"Assigns a color based on the partial charge of an atom.",legend:n?n.legend:void 0}},getParams:function(e){return XZ},defaultValues:Ib.getDefaultValues(XZ),isApplicable:function(e){return!!e.structure&&e.structure.models.some(function(e){return void 0!==zG.Provider.get(e)})}},QZ=tv(16448250),JZ=Ac({},jY({type:"colors",colorList:"many-distinct"})),eQ={name:"atom-id",label:"Atom Id",category:NI.Atom,factory:function e(t,r){var n,i;if(t.structure){var a=qF.create(t.structure.root),o=function(e){for(var t=new Map,r=0,n=e.models;r<n.length;r++)for(var i=n[r].atomicHierarchy.atoms.label_atom_id,a=0,o=i.rowCount;a<o;++a){var s=i.value(a);t.has(s)||t.set(s,t.size)}return t}(t.structure.root),s=Array.from(o.keys()),u=GY(o.size,r,{valueLabel:function(e){return s[e]}});i=u.legend,n=function(e){var t=void 0;if(qF.is(e)){var r=Cj.atom.label_atom_id(e);t=o.get(r)}else C$.isLocation(e)&&(a.unit=e.aUnit,a.element=e.aUnit.elements[e.aIndex],r=Cj.atom.label_atom_id(a),t=o.get(r));return void 0===t?QZ:u.color(t)}}else n=function(){return QZ};return{factory:e,granularity:"group",preferSmoothing:!0,color:n,props:r,description:"Gives every atom a color based on its `label_atom_id` value.",legend:i}},getParams:function(e){return Ib.clone(JZ)},defaultValues:Ib.getDefaultValues(JZ),isApplicable:function(e){return!!e.structure}},tQ={colorList:Ib.ColorList({kind:"interpolate",colors:[[MC.white,0],[MC.red,.25],[MC.white,.5],[MC.blue,.75],[MC.white,1]]},{offsets:!0,isEssential:!0})},rQ={name:"volume-value",label:"Volume Value",category:NI.Misc,factory:function e(t,r){for(var n=wE.create({domain:[0,1],listOrName:r.colorList.colors}),i=[],a=0;a<256;++a)i[a]=n.color(a/255);var o={colors:i,filter:"linear"};return{factory:e,granularity:"direct",props:r,description:"Assign color based on the given value of a volume cell.",legend:n.legend,palette:o}},getParams:function(e){return tQ},defaultValues:Ib.getDefaultValues(tQ),isApplicable:function(e){return!!e.volume&&!gR.Segmentation.get(e.volume)}},nQ=tv(13421772),iQ=Ac({},jY({type:"colors",colorList:"many-distinct"})),aQ={name:"volume-segment",label:"Volume Segment",category:NI.Misc,factory:function e(t,r){var n,i,a=t.volume&&gR.Segmentation.get(t.volume);if(a){var o=a.segments.size,s=Array.from(a.segments.keys()),u=GY(o,r);i=u.legend,n=function(e){return gR.Segment.isLocation(e)?u.color(s.indexOf(e.segment)):nQ}}else n=function(){return nQ};return{factory:e,granularity:"instance",color:n,props:r,description:"Gives every volume segment a unique color.",legend:i}},getParams:function(e){return Ib.clone(iQ)},defaultValues:Ib.getDefaultValues(iQ),isApplicable:function(e){return!!e.volume&&!!gR.Segmentation.get(e.volume)}},oQ={volume:Ib.ValueRef(function(e){return e.state.data.selectQ(function(e){return e.root.subtree().filter(function(e){return gR.is(e.obj?.data)})}).map(function(e){return[e.transform.ref,e.obj?.label??"<unknown>"]})},function(e,t){return t(e)}),coloring:Ib.MappedStatic("absolute-value",{"absolute-value":Ib.Group({domain:Ib.MappedStatic("auto",{custom:Ib.Interval([-1,1]),auto:Ib.Group({symmetric:Ib.Boolean(!1,{description:"If true the automatic range is determined as [-|max|, |max|]."})})}),list:Ib.ColorList("red-white-blue",{presetKind:"scale"})}),"relative-value":Ib.Group({domain:Ib.MappedStatic("auto",{custom:Ib.Interval([-1,1]),auto:Ib.Group({symmetric:Ib.Boolean(!1,{description:"If true the automatic range is determined as [-|max|, |max|]."})})}),list:Ib.ColorList("red-white-blue",{presetKind:"scale"})})}),defaultColor:Ib.Color(tv(13421772))},sQ={name:"external-volume",label:"External Volume",category:NI.Misc,factory:function e(t,r){var n,i;try{n=r.volume.getValue()}catch{}if(n){var a=r.coloring.params,o=n.grid.stats,s="custom"===a.domain.name?a.domain.params:[o.min,o.max],u="relative-value"===r.coloring.name;if("auto"===a.domain.name&&u&&(s[0]=(s[0]-o.mean)/o.sigma,s[1]=(s[1]-o.mean)/o.sigma),"auto"===r.coloring.params.domain.name&&r.coloring.params.domain.params.symmetric){var c=Math.max(Math.abs(s[0]),Math.abs(s[1]));s[0]=-c,s[1]=c}
139var l=wE.create({domain:s,listOrName:a.list.colors}),d=tR.getGridToCartesianTransform(n.grid);Og.invert(d,d);var f=Cg(),h=n.grid.cells.space,p=h.dimensions,m=h.get,g=n.grid.cells.data,v=p[0],y=p[1],b=p[2];i=function(e){if(!function(e){return!!e&&"position-location"===e.kind}(e))return r.defaultColor;Cg.copy(f,e.position),Cg.transformMat4(f,f,d);var t=Math.floor(f[0]),n=Math.floor(f[1]),i=Math.floor(f[2]);if(t<0||t>=v||n<0||n>=y||i<0||i>=b)return r.defaultColor;var a=f[0]-t,s=f[1]-n,c=f[2]-i,h=Math.min(t+1,v-1),p=Math.min(n+1,y-1),_=Math.min(i+1,b-1),x=m(g,t,n,i),S=m(g,h,n,i),w=m(g,t,p,i),A=m(g,h,p,i),C=_g(_g(x,S,a),_g(w,A,a),s);x=m(g,t,n,_),S=m(g,h,n,_),w=m(g,t,p,_),A=m(g,h,p,_);var T=_g(C,_g(_g(x,S,a),_g(w,A,a),s),c);return u&&(T=(T-o.mean)/o.sigma),l.color(T)}}else i=function(){return r.defaultColor};return{factory:e,granularity:"vertex",preferSmoothing:!0,color:i,props:r,description:"Assigns a color based volume value at a given vertex."}},getParams:function(){return oQ},defaultValues:Ib.getDefaultValues(oQ),isApplicable:function(e){return!0}},uQ={mainchain:Ib.MappedStatic("molecule-type",{uniform:Ib.Group(LI),"chain-id":Ib.Group(HY),"entity-id":Ib.Group(aK),"entity-source":Ib.Group(fK),"molecule-type":Ib.Group($K),"model-index":Ib.Group(_K),"structure-index":Ib.Group(AK),"secondary-structure":Ib.Group(lZ)}),sidechain:Ib.MappedStatic("residue-name",{uniform:Ib.Group(LI),"residue-name":Ib.Group(rZ),"element-symbol":Ib.Group(RK)})},cQ={name:"cartoon",label:"Cartoon",category:NI.Misc,factory:function e(t,r){var n=function(e,t){switch(t.name){case"uniform":return $I(0,t.params);case"chain-id":return XY(e,t.params);case"entity-id":return uK(e,t.params);case"entity-source":return vK(e,t.params);case"molecule-type":return jK(0,t.params);case"model-index":return xK(e,t.params);case"structure-index":return CK(e,t.params);case"secondary-structure":return fZ(e,t.params);default:Lg()}}(t,r.mainchain),i=function(e,t){switch(t.name){case"uniform":return $I(0,t.params);case"residue-name":return oZ(0,t.params);case"element-symbol":return BK(e,t.params);default:Lg()}}(t,r.sidechain),a=n.legend;return"table-legend"===n.legend?.kind&&"table-legend"===i.legend?.kind&&(a={kind:"table-legend",table:kc(kc([],n.legend.table,!0),i.legend.table,!0)}),{factory:e,granularity:"group",preferSmoothing:!1,color:function(e,t){return t?n.color(e,!1):i.color(e,!1)},props:r,description:"Uses separate themes for coloring mainchain and sidechain visuals.",legend:a}},getParams:function(e){return Ib.clone(uQ)},defaultValues:Ib.getDefaultValues(uQ),isApplicable:function(e){return!!e.structure}};!function(e){e.Category=NI,e.PaletteScale=16777215,e.EmptyFactory=function(){return e.Empty};var t=tv(13421772);e.Empty={factory:e.EmptyFactory,granularity:"uniform",color:function(){return t},props:{}},e.areEqual=function(e,t){return e.contextHash===t.contextHash&&e.factory===t.factory&&cf(e.props,t.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:function(){return{}},defaultValues:{},isApplicable:function(){return!0}},e.createRegistry=function(){return new xQ(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={"atom-id":eQ,"carbohydrate-symbol":RY,cartoon:cQ,"chain-id":YY,"element-index":QY,"element-symbol":NK,"entity-id":cK,"entity-source":yK,hydrophobicity:kZ,illustrative:CZ,"model-index":SK,"molecule-type":zK,occupancy:FZ,"operator-hkl":qZ,"operator-name":nK,"partial-charge":ZZ,"polymer-id":XK,"polymer-index":JK,"residue-name":sZ,"secondary-structure":hZ,"sequence-id":yZ,"shape-group":SB,"structure-index":TK,"trajectory-index":OZ,uncertainty:SZ,"unit-index":IK,uniform:UI,"volume-segment":aQ,"volume-value":rQ,"external-volume":sQ}}(KZ||={});var lQ={scale:Ib.Numeric(1,{min:.1,max:5,step:.1})};function dQ(e,t){return tU.isAtomic(e)?UU(e.model.atomicHierarchy.atoms.type_symbol.value(t)):tU.isSpheres(e)?e.model.coarseConformation.spheres.radius[t]:0}var fQ={name:"physical",label:"Physical",category:"",factory:function e(t,r){var n=void 0===r.scale?1:r.scale;return{factory:e,granularity:"group",size:function(e){return qF.is(e)?n*dQ(e.unit,e.element):C$.isLocation(e)?n*Math.min(dQ(e.aUnit,e.aUnit.elements[e.aIndex]),dQ(e.bUnit,e.bUnit.elements[e.bIndex])):1*n},props:r,description:"Assigns a physical size, i.e. vdW radius for atoms or given radius for coarse spheres."}},getParams:function(e){return lQ},defaultValues:Ib.getDefaultValues(lQ),isApplicable:function(e){return!!e.structure}}
139,hQ={bfactorFactor:Ib.Numeric(.1,{min:0,max:1,step:.01}),rmsfFactor:Ib.Numeric(.05,{min:0,max:1,step:.01}),baseSize:Ib.Numeric(.2,{min:0,max:2,step:.1})};function pQ(e,t,r){return tU.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t)*r.bfactorFactor:tU.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]*r.rmsfFactor:0}var mQ,gQ,vQ={name:"uncertainty",label:"Uncertainty/Disorder",category:"",factory:function e(t,r){return{factory:e,granularity:"group",size:function(e){var t=r.baseSize;return qF.is(e)?t+=pQ(e.unit,e.element,r):C$.isLocation(e)&&(t+=pQ(e.aUnit,e.aUnit.elements[e.aIndex],r)),t},props:r,description:"Assigns a size reflecting the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique."}},getParams:function(e){return hQ},defaultValues:Ib.getDefaultValues(hQ),isApplicable:function(e){return!!e.structure&&e.structure.models.some(function(e){return e.atomicConformation.B_iso_or_equiv.isDefined||e.coarseHierarchy.isDefined})}};function yQ(e){return e.map(function(e){return[e.name,e.provider.label,e.provider.category]})}(function(e){e.EmptyFactory=function(){return e.Empty},e.Empty={factory:e.EmptyFactory,granularity:"uniform",size:function(){return 1},props:{}},e.areEqual=function(e,t){return e.contextHash===t.contextHash&&e.factory===t.factory&&cf(e.props,t.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:function(){return{}},defaultValues:{},isApplicable:function(){return!0}},e.createRegistry=function(){return new xQ(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={physical:fQ,"shape-group":gB,uncertainty:vQ,uniform:GI}})(mQ||={}),function(e){function t(){return{color:KZ.Empty,size:mQ.Empty}}e.create=function(e,r,n,i){i||=t();var a=n.colorTheme,o=n.sizeTheme;return i.color=e.colorThemeRegistry.create(a.name,r,a.params),i.size=e.sizeThemeRegistry.create(o.name,r,o.params),i},e.createEmpty=t,e.ensureDependencies=function(e,t,r,n){return Tc(this,void 0,void 0,function(){return Pc(this,function(i){switch(i.label){case 0:return[4,t.colorThemeRegistry.get(n.colorTheme.name).ensureCustomProperties?.attach(e,r)];case 1:return i.sent(),[4,t.sizeThemeRegistry.get(n.sizeTheme.name).ensureCustomProperties?.attach(e,r)];case 2:return i.sent(),[2]}})})},e.releaseDependencies=function(e,t,r){var n,i;null==(n=e.colorThemeRegistry.get(r.colorTheme.name).ensureCustomProperties)||n.detach(t),null==(i=e.sizeThemeRegistry.get(r.sizeTheme.name).ensureCustomProperties)||i.detach(t)}}(gQ||={});var bQ,_Q,xQ=function(){function e(e,t){var r=this;this.emptyProvider=t,this._list=[],this._map=new Map,this._name=new Map,Hg(e,function(e,t){if(e.name!==t)throw Error(`Fix build in themes to have matching names. ${e.name} ${t}`);r.add(e)})}return Object.defineProperty(e.prototype,"default",{get:function(){return this._list[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"types",{get:function(){return yQ(this._list)},enumerable:!1,configurable:!0}),e.prototype.sort=function(){this._list.sort(function(e,t){return e.provider.category===t.provider.category?e.provider.label<t.provider.label?-1:+(e.provider.label>t.provider.label):e.provider.category<t.provider.category?-1:1})},e.prototype.add=function(e){if(this._map.has(e.name))throw Error(`${e.name} already registered.`);var t=e.name;this._list.push({name:t,provider:e}),this._map.set(t,e),this._name.set(e,t),this.sort()},e.prototype.remove=function(e){this._list.splice(this._list.findIndex(function(t){return t.name===e.name}),1);var t=this._map.get(e.name);t&&(this._map.delete(e.name),this._name.delete(t))},e.prototype.has=function(e){return this._map.has(e.name)},e.prototype.get=function(e){return this._map.get(e)||this.emptyProvider},e.prototype.getName=function(e){if(!this._name.has(e))throw Error(`'${e.label}' is not a registered theme provider.`);return this._name.get(e)},e.prototype.create=function(e,t,r){void 0===r&&(r={});var n=this.get(e);return n.factory(t,Ac(Ac({},Ib.getDefaultValues(n.getParams(t))),r))},e.prototype.getApplicableList=function(e){return this._list.filter(function(t){return t.provider.isApplicable(e)}
139)},e.prototype.getApplicableTypes=function(e){return yQ(this.getApplicableList(e))},e.prototype.clear=function(){this._list.length=0,this._map.clear(),this._name.clear()},e}();function SQ(e,t,r){switch(r){case bQ.Highlight:e[t]|=1;break;case bQ.RemoveHighlight:e[t]&=-2;break;case bQ.Select:e[t]|=2;break;case bQ.Deselect:e[t]&=-3;break;case bQ.Toggle:e[t]^=2;break;case bQ.Clear:e[t]=0}}function wQ(e,t,r){if(r===bQ.None)return!1;if($T.is(t)){var n=$T.start(t),i=$T.end(t),a=n+3>>2,o=a+(i-4*a>>2);if(o<=a){for(var s=n;s<i;++s)SQ(e,s,r);return!0}var u=new Uint32Array(e.buffer,0,e.buffer.byteLength>>2),c=n,l=Math.min(4*a,i),d=Math.max(n,4*o),f=i;switch(r){case bQ.Highlight:for(s=a;s<o;++s)u[s]|=16843009;break;case bQ.RemoveHighlight:for(s=a;s<o;++s)u[s]&=-16843010;break;case bQ.Select:for(s=a;s<o;++s)u[s]|=33686018;break;case bQ.Deselect:for(s=a;s<o;++s)u[s]&=-33686019;break;case bQ.Toggle:for(s=a;s<o;++s)u[s]^=33686018;break;case bQ.Clear:for(s=a;s<o;++s)u[s]=0;break;default:Lg()}for(s=c;s<l;++s)SQ(e,s,r);for(s=d;s<f;++s)SQ(e,s,r)}else switch(r){case bQ.Highlight:s=0;for(var h=t.length;s<h;++s)e[t[s]]|=1;break;case bQ.RemoveHighlight:for(s=0,h=t.length;s<h;++s)e[t[s]]&=-2;break;case bQ.Select:for(s=0,h=t.length;s<h;++s)e[t[s]]|=2;break;case bQ.Deselect:for(s=0,h=t.length;s<h;++s)e[t[s]]&=-3;break;case bQ.Toggle:for(s=0,h=t.length;s<h;++s)e[t[s]]^=2;break;case bQ.Clear:for(s=0,h=t.length;s<h;++s)e[t[s]]=0;break;default:Lg()}return!0}(function(e){e[e.None=0]="None",e[e.Highlight=1]="Highlight",e[e.RemoveHighlight=2]="RemoveHighlight",e[e.Select=4]="Select",e[e.Deselect=8]="Deselect",e[e.Toggle=16]="Toggle",e[e.Clear=32]="Clear"})(bQ||={}),function(e){e.is=Sd.has,e.All=bQ.Highlight|bQ.RemoveHighlight|bQ.Select|bQ.Deselect|bQ.Toggle|bQ.Clear,e.Highlighting=bQ.Highlight|bQ.RemoveHighlight|bQ.Clear,e.Selecting=bQ.Select|bQ.Deselect|bQ.Toggle|bQ.Clear,e.isReverse=function(e,t){return e===bQ.Highlight&&t===bQ.RemoveHighlight||e===bQ.RemoveHighlight&&t===bQ.Highlight||e===bQ.Select&&t===bQ.Deselect||e===bQ.Deselect&&t===bQ.Select||e===bQ.Toggle&&t===bQ.Toggle}}(_Q||={});var AQ={kind:"every-loci"};function CQ(e){return!!e&&"every-loci"===e.kind}var TQ,PQ,EQ={kind:"empty-loci"};function MQ(e){return!!e&&"empty-loci"===e.kind}function kQ(e){return!!e&&"data-loci"===e.kind}function IQ(e,t,r,n,i){return{kind:"data-loci",tag:e,data:t,elements:r,getBoundingSphere:n,getLabel:i}}function DQ(e,t){return{kind:e,layers:t}}function OQ(e,t){return{kind:e,layers:t}}(function(e){var t=new PM("98");function r(e,t){if("every-loci"!==e.kind&&"empty-loci"!==e.kind)return t||=XE(),"structure-loci"===e.kind?XE.copy(t,e.structure.boundary.sphere):"element-loci"===e.kind?XE.copy(t,Az.getBoundary(e).sphere):"bond-loci"===e.kind?C$.getBoundingSphere(e,t):"shape-loci"===e.kind?XE.copy(t,e.shape.geometry.boundingSphere):"group-loci"===e.kind?xB.getBoundingSphere(e,t):"data-loci"===e.kind?e.getBoundingSphere?.call(e,t):"volume-loci"===e.kind?gR.getBoundingSphere(e.volume,t):"isosurface-loci"===e.kind?gR.Isosurface.getBoundingSphere(e.volume,e.isoValue,t):"cell-loci"===e.kind?gR.Cell.getBoundingSphere(e.volume,e.indices,t):"segment-loci"===e.kind?gR.Segment.getBoundingSphere(e.volume,e.segments,t):void 0}e.getBundleBoundingSphere=function(e){var n=e.loci.map(function(e){return r(e)}).filter(function(e){return!!e});t.reset();for(var i=0,a=n;i<a.length;i++){var o=a[i];t.includePositionRadius(o.center,o.radius)}t.finishedIncludeStep();for(var s=0,u=n;s<u.length;s++)o=u[s],t.radiusPositionRadius(o.center,o.radius);return t.getSphere()},e.areEqual=function(e,t){return!(!CQ(e)||!CQ(t))||!(!MQ(e)||!MQ(t))||(kQ(e)&&kQ(t)?function(e,t){if(!lf(e.data,t.data)||e.tag!==t.tag||e.elements.length!==t.elements.length)return!1;for(var r=0,n=e.elements.length;r<n;++r)if(!lf(e.elements[r],t.elements[r]))return!1;return!0}(e,t):yz.isLoci(e)&&yz.isLoci(t)?yz.areLociEqual(e,t):Az.is(e)&&Az.is(t)?Az.areEqual(e,t):C$.isLoci(e)&&C$.isLoci(t)?C$.areLociEqual(e,t):_B.isLoci(e)&&_B.isLoci(t)?_B.areLociEqual(e,t):xB.isLoci(e)&&xB.isLoci(t)?xB.areLociEqual(e,t):gR.isLoci(e)&&gR.isLoci(t)?gR.areLociEqual(e,t):gR.Isosurface.isLoci(e)&&gR.Isosurface.isLoci(t)?gR.Isosurface.areLociEqual(e,t):gR.Cell.isLoci(e)&&gR.Cell.isLoci(t)?gR.Cell.areLociEqual(e,t):!(!gR.Segment.isLoci(e)||!gR.Segment.isLoci(t))&&gR.Segment.areLociEqual(e,t))},e.isEvery=function(e){return!!e&&"every-loci"===e.kind},e.isEmpty=function(e){return!CQ(e)&&(!!MQ(e)||(kQ(e)?function(e){return 0===e.elements.length}(e):yz.isLoci(e)?yz.isLociEmpty(e):Az.is(e)?Az.isEmpty(e):C$.isLoci(e)?C$.isLociEmpty(e):_B.isLoci(e)?_B.isLociEmpty(e):xB.isLoci(e)?xB.isLociEmpty(e):gR.isLoci(e)?gR.isLociEmpty(e):gR.Isosurface.isLoci(e)?gR.Isosurface.isLociEmpty(e):gR.Cell.isLoci(e)?gR.Cell.isLociEmpty(e):!!gR.Segment.isLoci(e)&&gR.Segment.isLociEmpty(e)))},e.remap=function(e,t){return t instanceof yz&&(Az.is(e)?e=Az.remap(e,t):yz.isLoci(e)?e=yz.remapLoci(e,t):C$.isLoci(e)&&(e=C$.remapLoci(e,t))),e},e.getBoundingSphere=r;var n=XE.zero();e.getCenter=function(e,t){var i=r(e,n);return i?Cg.copy(t||Cg(),i.center):void 0},e.getPrincipalAxes=function(e){if("every-loci"!==e.kind&&"empty-loci"!==e.kind)return"structure-loci"===e.kind?Az.getPrincipalAxes(yz.toStructureElementLoci(e.structure)):"element-loci"===e.kind?Az.getPrincipalAxes(e):void("bond-loci"!==e.kind&&"shape-loci"!==e.kind&&"group-loci"!==e.kind&&"data-loci"!==e.kind&&"volume-loci"!==e.kind&&"isosurface-loci"!==e.kind&&"cell-loci"!==e.kind&&e.kind)};var i={element:function(e){return e},residue:function(e){return Az.is(e)?Az.extendToWholeResidues(e,!0):e},chain:function(e){return Az.is(e)?Az.extendToWholeChains(e):e},entity:function(e){return Az.is(e)?Az.extendToWholeEntities(e):e},model:function(e){return Az.is(e)?Az.extendToWholeModels(e):e},operator:function(e){return Az.is(e)?Az.extendToWholeOperators(e):e},structure:function(e){return Az.is(e)?yz.toStructureElementLoci(e.structure):xB.isLoci(e)?_B.Loci(e.shape):gR.Cell.isLoci(e)?gR.Loci(e.volume):e},elementInstances:function(e){return Az.is(e)?Az.extendToAllInstances(e):e},residueInstances:function(e){return Az.is(e)?Az.extendToAllInstances(Az.extendToWholeResidues(e,!0)):e},chainInstances:function(e){return Az.is(e)?Az.extendToAllInstances(Az.extendToWholeChains(e)):e}};function a(e,t){return i[t](e)}e.GranularityOptions=Ib.objectToOptions(i,function(e){switch(e){case"element":return"Atom/Coarse Element";case"elementInstances":return["Atom/Coarse Element Instances","With Symmetry"];case"structure":return"Structure/Shape";default:return e.indexOf("Instances")?[Yg(e),"With Symmetry"]:Yg(e)}}),e.simpleGranularity=function(e){return e.replace("Instances","")},e.applyGranularity=a,e.normalize=function(e,t,r){return void 0===r&&(r=!1),("element"!==t||r)&&C$.isLoci(e)&&(e=C$.toStructureElementLoci(e)),yz.isLoci(e)&&(e=yz.toStructureElementLoci(e.structure)),Az.is(e)&&(e=Az.remap(e,e.structure.root)),t&&(e=a(e,t)),e}})(TQ||={}),function(e){function t(e){return 0===e.layers.length}e.Empty={kind:"empty-loci",layers:[]},e.areEqual=function(e,t){if(0===e.layers.length&&0===t.layers.length)return!0;
139if(e.layers.length!==t.layers.length)return!1;for(var r=0,n=e.layers.length;r<n;++r)if(e.layers[r].clear!==t.layers[r].clear||e.layers[r].color!==t.layers[r].color||!TQ.areEqual(e.layers[r].loci,t.layers[r].loci))return!1;return!0},e.isEmpty=t,e.remap=function(e,t){if("element-loci"===e.kind){for(var r=[],n=0,i=e.layers;n<i.length;n++){var a=i[n],o=a.loci,s=a.color,u=a.clear;o=Az.remap(o,t),Az.isEmpty(o)||r.push({loci:o,color:s,clear:u})}return{kind:"element-loci",layers:r}}return e},e.merge=function(e){if(t(e))return e;if("element-loci"===e.kind){for(var r=e.layers[0].loci.structure,n=new Map,i=Az.none(r),a=0,o=e.layers.length;a<o;++a){var s=e.layers[o-a-1],u=s.loci,c=s.color,l=s.clear;if(u=Az.subtract(u,i),i=Az.union(u,i),!Az.isEmpty(u)){var d=l?-1:c;n.has(d)&&(u=Az.union(u,n.get(d))),n.set(d,u)}}var f=[];return n.forEach(function(e,t){var r=-1===t,n=r?tv(0):t;f.push({loci:e,color:n,clear:r})}),{kind:"element-loci",layers:f}}return e},e.filter=function(e,r){if(t(e))return e;if("element-loci"===e.kind){for(var n=e.layers[0].loci.structure,i=[],a=0,o=e.layers;a<o.length;a++){var s=o[a],u=s.loci,c=s.color,l=s.clear,d=Az.remap(u,r);u=Az.remap(d,n),Az.isEmpty(u)||i.push({loci:u,color:c,clear:l})}return{kind:"element-loci",layers:i}}return e},e.ofScript=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.script,s=a.color,u=a.clear,c=mq.toLoci(o,t);Az.isEmpty(c)||r.push({loci:c,color:s,clear:u})}return{kind:"element-loci",layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.bundle,s=a.color,u=a.clear,c=sU.toLoci(o,t.root);r.push({loci:c,color:s,clear:u})}return{kind:"element-loci",layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var i=e.layers[r],a=i.loci,o=i.color,s=i.clear,u=sU.fromLoci(a);t.push({bundle:u,color:o,clear:s})}return{kind:"element-loci",layers:t}}}(DQ||={}),function(e){function t(e){return 0===e.layers.length}e.Empty={kind:"empty-loci",layers:[]},e.areEqual=function(e,t){if(0===e.layers.length&&0===t.layers.length)return!0;if(e.layers.length!==t.layers.length)return!1;for(var r=0,n=e.layers.length;r<n;++r)if(e.layers[r].value!==t.layers[r].value||!TQ.areEqual(e.layers[r].loci,t.layers[r].loci))return!1;return!0},e.isEmpty=t,e.remap=function(e,t){if("element-loci"===e.kind){for(var r=[],n=0,i=e.layers;n<i.length;n++){var a=i[n],o=Az.remap(a.loci,t);Az.isEmpty(o)||r.push({loci:o,value:a.value})}return{kind:"element-loci",layers:r}}return e},e.merge=function(e){if(t(e))return e;if("element-loci"===e.kind){for(var r=e.layers[0].loci.structure,n=new Map,i=Az.none(r),a=0,o=e.layers.length;a<o;++a){var s=e.layers[o-a-1],u=s.loci,c=s.value;u=Az.subtract(u,i),i=Az.union(u,i),Az.isEmpty(u)||(n.has(c)&&(u=Az.union(u,n.get(c))),n.set(c,u))}var l=[];return n.forEach(function(e,t){l.push({loci:e,value:t})}),{kind:"element-loci",layers:l}}return e},e.filter=function(e,r){if(t(e))return e;if("element-loci"===e.kind){for(var n=e.layers[0].loci.structure,i=[],a=0,o=e.layers;a<o.length;a++){var s=o[a],u=s.loci,c=s.value,l=Az.remap(u,r);u=Az.remap(l,n),Az.isEmpty(u)||i.push({loci:u,value:c})}return{kind:"element-loci",layers:i}}return e},e.ofScript=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.script,s=a.value,u=mq.toLoci(o,t);Az.isEmpty(u)||r.push({loci:u,value:s})}return{kind:"element-loci",layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.bundle,s=a.value,u=sU.toLoci(o,t.root);r.push({loci:u,value:s})}return{kind:"element-loci",layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var i=e.layers[r],a=i.loci,o=i.value,s=sU.fromLoci(a);t.push({bundle:s,value:o})}return{kind:"element-loci",layers:t}}}(OQ||={}),function(e){e.create=function(){return{updateTransform:!1,updateMatrix:!1,updateColor:!1,updateSize:!1,createGeometry:!1,createNew:!1,info:{}}},e.reset=function(e){e.updateTransform=!1,e.updateMatrix=!1,e.updateColor=!1,e.updateSize=!1,e.createGeometry=!1,e.createNew=!1}}(PQ||={});var RQ={lowestElementCount:1e6,lowerElementCount:5e5,lowElementCount:1e5,mediumElementCount:2e4,highElementCount:2e3,coarseGrainedFactor:10,elementCountFactor:1};function BQ(e,t){void 0===t&&(t={});var r=Ac(Ac({},RQ),t),n=e.elementCount*r.elementCountFactor;return(e.isCoarseGrained||e.isCoarse)&&(n*=r.coarseGrainedFactor),n>r.lowestElementCount?"lowest":n>r.lowerElementCount?"lower":n>r.lowElementCount?"low":n>r.mediumElementCount?"medium":n>r.highElementCount?"high":"higher"}function NQ(e,t){var r=ff(e.quality,"auto"),n=ff(e.detail,1),i=ff(e.radialSegments,12),a=ff(e.linearSegments,8),o=ff(e.resolution,2),s=ff(e.probePositions,12),u=ff(e.doubleSided,!0),c=0;if("auto"===r)if(t instanceof yz)r=BQ(t.root),c=function(e){if(1===e.root.models.length){var t=Dz.Provider.get(e.root.model);if(t&&"P 1"===t.spacegroup.name&&!LE.isZero(t.spacegroup.cell))return t.spacegroup.cell.volume}return YE.volume(e.root.boundary.box)}(t);else if(gR.is(t)){var l=t.grid.cells.space.dimensions;r=(c=l[0]*l[1]*l[2])<1e7?"medium":"low"}switch(r){case"highest":n=3,i=36,a=18,o=.1,s=72,u=!0;break;case"higher":n=3,i=28,a=14,o=.3,s=48,u=!0;break;case"high":n=2,i=20,a=10,o=.5,s=36,u=!0;break;case"medium":n=1,i=12,a=8,o=.8,s=24,u=!0;break;case"low":n=0,i=8,a=3,o=1.3,s=24,u=!1;break;case"lower":n=0,i=4,a=2,o=3,s=12,u=!1;break;case"lowest":n=0,i=2,a=1,o=8,s=12,u=!1}return o=Math.max(o,c/5e8),o=Math.min(o,20),"off"===e.transparentBackfaces&&(void 0!==e.alpha&&e.alpha<1||e.xraySha
139ded)&&(u=!1),{detail:n,radialSegments:i,linearSegments:a,resolution:o,probePositions:s,doubleSided:u}}var FQ=Cg.set,LQ=Cg.normalize,$Q=Cg.sub,UQ=Cg.addScalar,jQ=Cg.scale,zQ=Cg.toArray;function GQ(e,t,r,n){var i=!1;if(gR.isLoci(e)){if(!gR.areEquivalent(e.volume,t))return!1;n($T.ofLength(t.grid.cells.data.length))&&(i=!0)}else if(gR.Isosurface.isLoci(e)){if(!gR.areEquivalent(e.volume,t))return!1;if(r?.isoValue){if(!gR.IsoValue.areSame(e.isoValue,r.isoValue,t.grid.stats))return!1;n($T.ofLength(t.grid.cells.data.length))&&(i=!0)}else for(var a=t.grid,o=a.stats,s=a.cells.data,u=o.sigma,c=gR.IsoValue.toAbsolute(e.isoValue,o).absoluteValue,l=0,d=s.length;l<d;++l)yg(c,s[l],u)&&n($T.ofSingleton(l))&&(i=!0)}else if(gR.Cell.isLoci(e)){if(!gR.areEquivalent(e.volume,t))return!1;$T.is(e.indices)?n(e.indices)&&(i=!0):kP.forEach(e.indices,function(e){n($T.ofSingleton(e))&&(i=!0)})}else if(gR.Segment.isLoci(e)){if(!gR.areEquivalent(e.volume,t))return!1;if(r?.segments){if(!PP.areIntersecting(e.segments,r.segments))return!1;n($T.ofLength(t.grid.cells.data.length))&&(i=!0)}else{var f=gR.Segmentation.get(t);if(f){var h=new Set;for(l=0,d=e.segments.length;l<d;++l)mN.add(h,f.segments.get(e.segments[l]));var p=Array.from(h.values()),m=t.grid.cells.data;for(l=0,d=m.length;l<d;++l)p.includes(m[l])&&n($T.ofSingleton(l))&&(i=!0)}}}return i}function VQ(e,t){void 0===t&&(t=0);var r=e[0]*e[1]*e[2],n=2**Math.ceil(Math.log(Math.sqrt(r))/Math.log(2)),i=e[0]+t,a=e[1]+t,o=1,s=i;return n<i*e[2]?(i*=s=Math.floor(n/i),a*=o=Math.ceil(e[2]/s)):i*=e[2],{width:i,height:a,columns:s,rows:o,powerOfTwoSize:a<n?n:2*n}}function HQ(e,t,r){void 0===r&&(r=0);for(var n=e.grid,i=n.cells,a=i.space,o=i.data,s=n.stats,u=s.max,c=s.min,l=a.dimensions,d=a.dataOffset,f=VQ(l,r),h=f.width,p=f.height,m="data"===t?1:4,g=new Uint8Array(h*p*m),v={array:g,width:h,height:p},y=u-c,b=l[0],_=l[1],x=l[2],S=b+r,w=_+r,A=Cg(),C=Cg(),T=b-1,P=_-1,E=x-1,M=0;M<x;++M)for(var k=0;k<_;++k)for(var I=0;I<b;++I){var D=Math.floor(M*S%h/S),O=m*(Math.floor(M*S/h)*w*h+k*h+(D*S+I)),R=d(I,k,M);
139"data"===t?g[O]=Math.round((o[R]-c)/y*255):("groups"===t?TO(R,g,O):(FQ(A,o[d(Math.max(0,I-1),k,M)],o[d(I,Math.max(0,k-1),M)],o[d(I,k,Math.max(0,M-1))]),FQ(C,o[d(Math.min(T,I+1),k,M)],o[d(I,Math.min(P,k+1),M)],o[d(I,k,Math.min(E,M+1))]),LQ(A,$Q(A,A,C)),UQ(A,jQ(A,A,.5),.5),zQ(jQ(A,A,255),g,O)),g[O+3]=Math.round((o[R]-c)/y*255))}return v}function qQ(e,t,r,n,i){var a=e.colorType,o=e.vertexCount,s=e.groupCount,u=e.positionBuffer,c=e.transformBuffer,l=e.groupBuffer,d=e.itemSize,f=a.endsWith("Instance"),h=YE.fromSphere3D(YE(),f?e.boundingSphere:e.invariantBoundingSphere),p=1+t,m=YE.expand(YE(),h,Cg.create(p,p,p)),g=1/t,v=YE.scale(YE(),m,g),y=YE.size(Cg(),v);Cg.ceil(y,y),Cg.add(y,y,Cg.create(2,2,2));var b=m.min,_=y[0],x=y[1],S=VQ(y),w=S.width,A=S.height,C=new Float32Array(w*A*d),T=new Float32Array(w*A),P=new Uint8Array(w*A*d),E={array:P,width:w,height:A,filter:"linear"},M=f?e.instanceCount:1,k=e.colorData.array;function I(e,t,r){var n=Math.floor(r*_%w/_);return d*(Math.floor(r*_/w)*x*w+t*w+(n*_+e))}for(var D=y[0],O=y[1],R=y[2],B=Cg(),N=0;N<M;++N)for(var F=0;F<o;F+=r){Cg.fromArray(B,u,3*F),f&&Cg.transformMat4Offset(B,B,c,0,0,16*N),Cg.sub(B,B,b),Cg.scale(B,B,g);for(var L=B[0],$=B[1],U=B[2],j=Math.floor(L),z=Math.floor($),G=Math.floor(U),V=(N*s+l[F])*d,H=Math.max(0,j-2),q=Math.max(0,z-2),W=Math.max(0,G-2),X=Math.min(D,j+2+2),Y=Math.min(O,z+2+2),K=Math.min(R,G+2+2),Z=H;Z<X;++Z)for(var Q=Z-L,J=q;J<Y;++J)for(var ee=J-$,te=W;te<K;++te){var re=te-U,ne=Math.sqrt(Q*Q+ee*ee+re*re);if(!(ne>2)){for(var ie=2-ne,ae=I(Z,J,te),oe=0;oe<d;++oe)C[ae+oe]+=k[V+oe]*ie;T[ae/d]+=ie}}}N=0;for(var se=T.length;N<se;++N){var ue=N*d,ce=T[N];for(oe=0;oe<d;++oe)P[ue+oe]=Math.round(C[ue+oe]/ce)}var le=Bg.create(w,A),de=Ng.create(b[0],b[1],b[2],g),fe=f?"volumeInstance":"volume";if(n){if(!i){var he=4===d?"rgba":3===d?"rgb":"alpha";i=n.resources.texture("image-uint8",he,"ubyte","linear")}return i.load(E),{kind:"volume",texture:i,gridTexDim:le,gridDim:y,gridTransform:de,type:fe}}var pe=function(e){var t=e.vertexCount,r=e.positionBuffer,n=e.transformBuffer,i=e.grid,a=e.gridDim,o=e.gridTexDim,s=e.gridTransform,u=e.vertexStride,c=e.colorStride,l=e.itemOffset||0,d=e.outputStride;
139if(d+l>c)throw Error("outputStride + itemOffset must NOT be larger than colorStride");var f=e.colorType.endsWith("Instance"),h=f?e.instanceCount:1,p=NM(Math.max(1,h*t),d,Uint8Array),m=p.array,g=a[0],v=a[1],y=o[0],b=Cg.fromArray(Cg(),s,0),_=s[3];function x(e,t,r){var n=Math.floor(r*g%y/g);return c*(Math.floor(r*g/y)*v*y+t*y+(n*g+e))}for(var S=Cg(),w=Cg(),A=Cg(),C=Cg(),T=0;T<h;++T)for(var P=0;P<t;++P){Cg.fromArray(S,r,P*u),f&&Cg.transformMat4Offset(S,S,n,0,0,16*T),Cg.sub(S,S,b),Cg.scale(S,S,_),Cg.floor(w,S),Cg.ceil(A,S),Cg.sub(C,S,w),Cg.sub(S,A,w),Cg.div(C,C,S);for(var E=w[0],M=w[1],k=w[2],I=A[0],D=A[1],O=A[2],R=C[0],B=C[1],N=C[2],F=x(E,M,k)+l,L=x(I,M,k)+l,$=x(E,M,O)+l,U=x(I,M,O)+l,j=x(E,D,k)+l,z=x(I,D,k)+l,G=x(E,D,O)+l,V=x(I,D,O)+l,H=(T*t+P)*d,q=0;q<d;++q){var W=i[F+q],X=i[L+q],Y=i[$+q],K=i[U+q],Z=i[j+q],Q=i[z+q],J=i[G+q],ee=i[V+q],te=_g(W,X,R),re=_g(Y,K,R),ne=_g(Z,Q,R),ie=_g(J,ee,R),ae=_g(te,ne,B),oe=_g(re,ie,B);m[H+q]=_g(ae,oe,N)}}return p}({vertexCount:o,instanceCount:M,transformBuffer:c,positionBuffer:u,colorType:fe,grid:P,gridDim:y,gridTexDim:le,gridTransform:de,vertexStride:3,colorStride:d,outputStride:d});return{kind:"vertex",texture:pe,texDim:Bg.create(pe.width,pe.height),type:f?"vertexInstance":"vertex"}}function WQ(e,t,r,n,i){if(function(e){return"group"===e||"groupInstance"===e}(e.dColorType.ref.value)){var a=qQ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tColor.ref.value,colorType:e.dColorType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:3},t,r,n,i);"volume"===a.kind?(tf.updateIfChanged(e.dColorType,a.type),tf.update(e.tColorGrid,a.texture),tf.update(e.uColorTexDim,a.gridTexDim),tf.update(e.uColorGridDim,a.gridDim),tf.update(e.uColorGridTransform,a.gridTransform)):"vertex"===a.kind&&(tf.updateIfChanged(e.dColorType,a.type),tf.update(e.tColor,a.texture),tf.update(e.uColorTexDim,a.texDim))}}var XQ={drawCount:MR("number"),instanceCount:MR("number"),stride:MR("number"),uGroupCount:CR("i","material"),aTransform:AR("float32",16,1),aInstance:AR("float32",1,1),aSample:AR("float32",1,0),uGeoTexDim:CR("v2","material"),tPosition:TR("texture","rgba","float","nearest","material"),tGroup:TR("texture","rgba","float","nearest","material"),uColorTexDim:CR("v2","material"),tColor:TR("texture","rgba","ubyte","nearest","material"),dColorType:ER("string",["group","groupInstance","vertex","vertexInstance"]),uCurrentSlice:CR("f"),uCurrentX:CR("f"),uCurrentY:CR("f"),uBboxMin:CR("v3","material"),uBboxSize:CR("v3","material"),uResolution:CR("f","material")},YQ="color-accumulate",KQ="color-count";function ZQ(e,t){for(var r=new Float32Array(e),n=0;n<e;++n)r[n]=n*t;return r}var QQ=Ac(Ac({},rB),{tColor:TR("texture","rgba","float","nearest"),tCount:TR("texture","alpha","float","nearest"),uTexSize:CR("v2")}),JQ="color-normalize";function eJ(e,t,r,n,i){var a=n.extensions.drawBuffers;if(!a)throw Error("need WebGL draw buffers");var o=n.gl,s=n.resources,u=n.state,c=n.extensions,l=c.colorBufferHalfFloat,d=c.textureHalfFloat,f=e.colorType.endsWith("Instance"),h=YE.fromSphere3D(YE(),f?e.boundingSphere:e.invariantBoundingSphere),p=1+t,m=YE.expand(YE(),h,Cg.create(p,p,p)),g=1/t,v=YE.scale(YE(),m,g),y=YE.size(Cg(),v);Cg.ceil(y,y),Cg.add(y,y,Cg.create(2,2,2));var b=m.min,_=y[0],x=y[1],S=y[2],w=function(e){var t=e[0]*e[1]*e[2],r=2**Math.ceil(Math.log(Math.sqrt(t))/Math.log(2)),n=0,i=e[1],a=1,o=e[2];return r<e[0]*e[2]?(o=Math.floor(r/e[0]),a=Math.ceil(e[2]/o),n=o*e[0],i*=a):n=e[0]*e[2],{texDimX:n,texDimY:i,texRows:a,texCols:o,powerOfTwoSize:i<r?r:2*r}}(y),A=w.texDimX,C=w.texDimY,T=w.texCols;n.namedFramebuffers[YQ]||(n.namedFramebuffers[YQ]=n.resources.framebuffer());var P=n.namedFramebuffers[YQ];dI(o)?(n.namedTextures[YQ]||(n.namedTextures[YQ]=l&&d?s.texture("image-float16","rgba","fp16","nearest"):s.texture("image-float32","rgba","float","nearest")),n.namedTextures[KQ]||(n.namedTextures[KQ]=s.texture("image-float32","alpha","float","nearest"))):(n.namedTextures[YQ]||(n.namedTextures[YQ]=s.texture("image-float32","rgba","float","nearest")),n.namedTextures[KQ]||(n.namedTextures[KQ]=s.texture("image-float32","rgba","float","nearest")));var E=n.namedTextures[YQ],M=n.namedTextures[KQ];E.define(A,C),M.define(A,C),E.attachFramebuffer(P,0),M.attachFramebuffer(P,1);var k=function(e,t,r,n,i){if(e.namedComputeRenderables[YQ]){var a=Cg.sub(Cg(),r.max,r.min),o=e.namedComputeRenderables[YQ].values,s=Math.round(t.vertexCount/i);(s>o.drawCount.ref.value||i!==o.stride.ref.value)&&tf.update(o.aSample,ZQ(s,i)),tf.updateIfChanged(o.drawCount,s),tf.updateIfChanged(o.instanceCount,t.instanceCount),tf.updateIfChanged(o.stride,i),tf.updateIfChanged(o.uGroupCount,t.groupCount),tf.update(o.aTransform,t.transformBuffer),tf.update(o.aInstance,t.instanceBuffer),tf.update(o.uGeoTexDim,Bg.set(o.uGeoTexDim.ref.value,t.positionTexture.getWidth(),t.positionTexture.getHeight())),tf.update(o.tPosition,t.positionTexture),tf.update(o.tGroup,t.groupTexture),tf.update(o.uColorTexDim,Bg.set(o.uColorTexDim.ref.value,t.colorData.getWidth(),t.colorData.getHeight())),tf.update(o.tColor,t.colorData),tf.updateIfChanged(o.dColorType,t.colorType),tf.updateIfChanged(o.uCurrentSlice,0),tf.updateIfChanged(o.uCurrentX,0),tf.updateIfChanged(o.uCurrentY,0),tf.update(o.uBboxMin,r.min),tf.update(o.uBboxSize,a),tf.updateIfChanged(o.uResolution,n),e.namedComputeRenderables[YQ].update()}else e.namedComputeRenderables[YQ]=function(e,t,r,n,i){var a=Cg.sub(Cg(),r.max,r.min),o=Math.round(t.vertexCount/i),s={drawCount:tf.create(o),instanceCount:tf.create(t.instanceCount),stride:tf.create(i),uGroupCount:tf.create(t.groupCount),aTransform:tf.create(t.transformBuffer),aInstance:tf.create(t.instanceBuffer),aSample:tf.create(ZQ(o,i)),uGeoTexDim:tf.create(Bg.create(t.positionTexture.getWidth(),t.positionTexture.getHeight())),tPosition:tf.create(t.positionTexture),tGroup:tf.create(t.groupTexture),uColorTexDim:tf.create(Bg.create(t.colorData.getWidth(),t.colorData.getHeight())),tColor:tf.create(t.colorData),dColorType:tf.create(t.colorType),uCurrentSlice:tf.create(0),uCurrentX:tf.create(0),uCurrentY:tf.create(0),uBboxMin:tf.create(r.min),uBboxSize:tf.create(a),uResolution:tf.create(n)},u=Ac({},XQ);return eB(KR(e,"points",fk("accumulate","\nprecision highp float;\n\n#include common\n#include read_from_texture\n\nuniform int uGroupCount;\n\nattribute float aSample;\n#define SampleID int(aSample)\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform vec2 uGeoTexDim;\nuniform sampler2D tPosition;\nuniform sampler2D tGroup;\n\nuniform vec2 uColorTexDim;\nuniform sampler2D tColor;\n\nvarying vec3 vPosition;\nvarying vec4 vColor;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n    vec3 position = readFromTexture(tPosition, SampleID, uGeoTexDim).xyz;\n    float group = unpackRGBToInt(readFromTexture(tGroup, SampleID, uGeoTexDim).rgb);
139\n\n    position = (aTransform * vec4(position, 1.0)).xyz;\n    gl_PointSize = 7.0;\n    vPosition = (position - uBboxMin) / uResolution;\n    gl_Position = vec4(((position - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n\n    #if defined(dColorType_group)\n        vColor = readFromTexture(tColor, group, uColorTexDim);\n    #elif defined(dColorType_groupInstance)\n        vColor = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim);\n    #endif\n}\n","\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying vec4 vColor;\n\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uResolution;\n\nconst float p = 2.0;\n\nvoid main() {\n    vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n    vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n    float dist = distance(fragPos, vPosition);\n    if (dist > p) discard;\n\n    float f = p - dist;\n    gl_FragColor = vColor * f;\n    gl_FragData[1] = vec4(f);\n}\n",{drawBuffers:"required"}),u,s),s)}(e,t,r,n,i);return e.namedComputeRenderables[YQ]}(n,e,m,t,r);u.currentRenderItemId=-1,P.bind(),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]);var I=k.values,D=I.uCurrentSlice,O=I.uCurrentX,R=I.uCurrentY;(function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.enable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.clearColor(0,0,0,0),r.blendFunc(t.ONE,t.ONE),r.blendEquation(t.FUNC_ADD)})(n),u.viewport(0,0,A,C),u.scissor(0,0,A,C),o.clear(o.COLOR_BUFFER_BIT),tf.update(R,0);for(var B=0,N=0,F=0,L=0;L<S;++L)B>=T&&(B-=T,N+=x,F=0,tf.update(R,N)),tf.update(O,F),tf.update(D,L),u.viewport(F,N,_,x),u.scissor(F,N,_,x),k.render(),++B,F+=_;E.detachFramebuffer(P,0),M.detachFramebuffer(P,1),a.drawBuffers([o.COLOR_ATTACHMENT0,o.NONE]),i&&!function(e){return-1===e.format}(i)||(i=s.texture("image-uint8","rgba","ubyte","linear")),i.define(A,C);var $=function(e,t,r){if(e.namedComputeRenderables[JQ]){var n=e.namedComputeRenderables[JQ].values;tf.update(n.tColor,t),tf.update(n.tCount,r),tf.update(n.uTexSize,Bg.set(n.uTexSize.ref.value,t.getWidth(),t.getHeight())),e.namedComputeRenderables[JQ].update()}else e.namedComputeRenderables[JQ]=function(e,t,r){var n=Ac(Ac({},nB),{tColor:tf.create(t),tCount:tf.create(r),uTexSize:tf.create(Bg.create(t.getWidth(),t.getHeight()))}),i=Ac({},QQ);return eB(KR(e,"triangles",fk("normalize",jR,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform sampler2D tCount;\nuniform vec2 uTexSize;\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    vec4 color = texture2D(tColor, coords);\n    float count = texture2D(tCount, coords).r;\n\n    gl_FragColor = color / count;\n}\n"),i,n),n)}(e,t,r);return e.namedComputeRenderables[JQ]}(n,E,M);u.currentRenderItemId=-1,function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.enable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.clearColor(0,0,0,0),r.blendFunc(t.ONE,t.ONE),r.blendEquation(t.FUNC_ADD)}(n),i.attachFramebuffer(P,0),u.viewport(0,0,A,C),u.scissor(0,0,A,C),o.clear(o.COLOR_BUFFER_BIT),$.render();var U=Ng.create(b[0],b[1],b[2],g),j=f?"volumeInstance":"volume";return{texture:i,gridDim:y,gridTexDim:Bg.create(A,C),gridTransform:U,type:j}}var tJ,rJ,nJ="color-smoothing-rgb",iJ="color-smoothing-rgba",aJ="color-smoothing-alpha";function oJ(e,t,r,n,i){if(function(e){return"group"===e||"groupInstance"===e}(e.dColorType.ref.value)){r*=3,n.namedTextures[nJ]||(n.namedTextures[nJ]=n.resources.texture("image-uint8","rgb","ubyte","nearest"));var a=n.namedTextures[nJ];a.load(e.tColor.ref.value);var o=eJ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:a,colorType:e.dColorType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,r,n,i);tf.updateIfChanged(e.dColorType,o.type),tf.update(e.tColorGrid,o.texture),tf.update(e.uColorTexDim,o.gridTexDim),tf.update(e.uColorGridDim,o.gridDim),tf.update(e.uColorGridTransform,o.gridTransform)}}function sJ(e,t){return{kind:e,layers:t}}function uJ(e,t){return{kind:e,layers:t}}(function(e){e.setVisibility=function(e,t){e&&(e.state.visible=t)},e.setAlphaFactor=function(e,t){e&&(e.state.alphaFactor=t)}
139,e.setPickable=function(e,t){e&&(e.state.pickable=t)},e.setColorOnly=function(e,t){e&&(e.state.colorOnly=t)},e.mark=function(e,t,r,n,i){if(!e||MQ(t))return!1;var a=e.values,o=a.tMarker,s=a.uMarker,u=a.markerAverage,c=a.markerStatus,l=a.uGroupCount,d=a.instanceCount,f=a.instanceGranularity.ref.value?d.ref.value:l.ref.value*d.ref.value,h=o.ref.value.array,p=c.ref.value;if(!CQ(t)){var m=0;if(n(t,function(e){return m+=$T.size(e),!0},!0),0===m)return!1;m===f&&(t=AQ)}var g=!1,v=-1,y=-1;if(CQ(t)){var b=function(e,t){var r=-1,n=-1;switch(e){case bQ.Highlight:0===t||1===t?(r=1,n=1):2===t||3===t?(r=1,n=3):r=1;break;case bQ.RemoveHighlight:0===t||1===t?(r=0,n=0):2!==t&&3!==t||(r=1,n=2);break;case bQ.Select:1===t||3===t?(r=1,n=3):0===t||2===t?(r=1,n=2):r=1;break;case bQ.Deselect:1===t||3===t?(r=1,n=1):0!==t&&2!==t||(r=0,n=0);break;case bQ.Toggle:1===t?(r=1,n=3):2===t?(r=0,n=0):3===t?(r=1,n=1):0===t&&(r=1,n=2);break;case bQ.Clear:r=0,n=0}return{average:r,status:n}}(r,p);-1===b.status?g=wQ(h,$T.ofLength(f),r):(g=p!==b.status)&&function(e,t,r){e.fill(t,0,r)}(h,b.status,f),v=b.average,y=b.status}else(g=n(t,function(e){return wQ(h,e,r)},!0))&&(v=function(e,t){switch(e){case bQ.Highlight:return.5;case bQ.RemoveHighlight:return 0===t?0:2===t||3===t?.5:-1;case bQ.Select:return.5;case bQ.Deselect:return 1===t||3===t?.5:0===t?0:-1;case bQ.Toggle:return-1===t?-1:.5;case bQ.Clear:return-1===t?-1:0===t?0:.5;case bQ.None:return-1;default:Lg()}}(r,p),i&&-1!==i.status&&-1===v&&_Q.isReverse(i.action,r)&&TQ.areEqual(t,i.loci)&&(v=0===(y=i.status)?0:.5));return g&&(-1===v&&0===(v=HM(h,f))&&(y=0),i&&(i.action=r,i.loci=t,i.status=p),tf.updateIfChanged(s,y),-1===y&&tf.update(o,o.ref.value),tf.updateIfChanged(u,v),tf.updateIfChanged(c,y)),g},e.setOverpaint=function(e,t,r,n,i){if(e){var a=e.values,o=a.tOverpaint,s=a.dOverpaintType,u=a.dOverpaint,c=a.uGroupCount,l=a.instanceCount,d=a.instanceGranularity,f=d.ref.value?l.ref.value:c.ref.value*l.ref.value,h=d.ref.value?"instance":"groupInstance";!function(e,t,r){var n=NM(Math.max(1,e),4,Uint8Array,r&&r.tOverpaint.ref.value.array);r?(tf.update(r.tOverpaint,n),tf.update(r.uOverpaintTexDim,Bg.create(n.width,n.height)),tf.updateIfChanged(r.dOverpaint,e>0),tf.updateIfChanged(r.dOverpaintType,t)):(tf.create(n),tf.create(Bg.create(n.width,n.height)),tf.create(e>0),tf.create(AI()),tf.create(Cg.create(1,1,1)),tf.create(Ng.create(0,0,0,1)),tf.create(t),tf.create(1))}(t.layers.length?f:0,h,e.values);var p=o.ref.value.array;n&&QI(p,0,f);for(var m=function(e,n){var i=t.layers[e],a=i.loci,o=i.color,s=i.clear;r(a,function(e){var t=$T.start(e),r=$T.end(e);return s?QI(p,t,r):function(e,t,r,n){for(var i=t;i<r;++i)tv.toArray(n,e,4*i),e[4*i+3]=255;return!0}(p,t,r,o)},!1)},g=0,v=t.layers.length;g<v;++g)m(g);if(tf.update(o,o.ref.value),tf.updateIfChanged(s,h),tf.updateIfChanged(u,t.layers.length>0),0!==t.layers.length&&"instance"!==h&&i&&KI(i.props)){var y=i.geometry,b=i.props,_=i.webgl;if("mesh"===y.kind){var x=y.meta,S=x.resolution,w=x.overpaintTexture;(A=ZI(b.smoothColors,!0,S))&&(function(e,t,r,n,i){if(function(e){return"groupInstance"===e}(e.dOverpaintType.ref.value)){var a=qQ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tOverpaint.ref.value,colorType:e.dOverpaintType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:4},t,r,n,i);"volume"===a.kind?(tf.updateIfChanged(e.dOverpaintType,a.type),tf.update(e.tOverpaintGrid,a.texture),tf.update(e.uOverpaintTexDim,a.gridTexDim),tf.update(e.uOverpaintGridDim,a.gridDim),tf.update(e.uOverpaintGridTransform,a.gridTransform)):"vertex"===a.kind&&(tf.updateIfChanged(e.dOverpaintType,a.type),tf.update(e.tOverpaint,a.texture),tf.update(e.uOverpaintTexDim,a.texDim))}}(e.values,A.resolution,A.stride,_,w),y.meta.overpaintTexture=e.values.tOverpaintGrid.ref.value)}else if(_&&"texture-mesh"===y.kind){var A,C=y.meta;S=C.resolution,w=C.overpaintTexture,(A=ZI(b.smoothColors,!0,S))&&(function(e,t,r,n,i){if(function(e){return"groupInstance"===e}(e.dOverpaintType.ref.value)){r*=3,n.namedTextures[iJ]||(n.namedTextures[iJ]=n.resources.texture("image-uint8","rgba","ubyte","nearest"));var a=n.namedTextures[iJ];a.load(e.tOverpaint.ref.value);var o=eJ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:a,colorType:e.dOverpaintType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,r,n,i);tf.updateIfChanged(e.dOverpaintType,o.type),tf.update(e.tOverpaintGrid,o.texture),tf.update(e.uOverpaintTexDim,o.gridTexDim),tf.update(e.uOverpaintGridDim,o.gridDim),tf.update(e.uOverpaintGridTransform,o.gridTransform)}}(e.values,A.resolution,A.stride,_,w),y.meta.overpaintTexture=e.values.tOverpaintGrid.ref.value)}}}},e.setTransparency=function(e,t,r,n,i){if(e){var a=e.values,o=a.tTransparency,s=a.dTransparencyType,u=a.transparencyAverage,c=a.dTransparency,l=a.uGroupCount,d=a.instanceCount,f=a.instanceGranularity,h=f.ref.value?d.ref.value:l.ref.value*d.ref.value,p=f.ref.value?"instance":"groupInstance";!function(e,t,r){var n=NM(Math.max(1,e),1,Uint8Array,r&&r.tTransparency.ref.value.array);
139r?(tf.update(r.tTransparency,n),tf.update(r.uTransparencyTexDim,Bg.create(n.width,n.height)),tf.updateIfChanged(r.dTransparency,e>0),tf.updateIfChanged(r.transparencyAverage,tD(n.array,e)),tf.updateIfChanged(r.dTransparencyType,t)):(tf.create(n),tf.create(Bg.create(n.width,n.height)),tf.create(e>0),tf.create(0),tf.create(AI()),tf.create(Cg.create(1,1,1)),tf.create(Ng.create(0,0,0,1)),tf.create(t),tf.create(1))}(t.layers.length?h:0,p,e.values);var m=o.ref.value.array;n&&function(e,t,r){e.fill(0,0,r)}(m,0,h);for(var g=function(e,n){var i=t.layers[e],a=i.loci,o=i.value;r(a,function(e){return function(e,t,r,n){for(var i=t;i<r;++i)e[i]=255*n;return!0}(m,$T.start(e),$T.end(e),o)},!1)},v=0,y=t.layers.length;v<y;++v)g(v);if(tf.update(o,o.ref.value),tf.updateIfChanged(u,tD(m,h)),tf.updateIfChanged(s,p),tf.updateIfChanged(c,t.layers.length>0),0!==t.layers.length&&"instance"!==p&&i&&KI(i.props)){var b=i.geometry,_=i.props,x=i.webgl;if("mesh"===b.kind){var S=b.meta,w=S.resolution,A=S.transparencyTexture;(C=ZI(_.smoothColors,!0,w))&&(function(e,t,r,n,i){if(function(e){return"groupInstance"===e}(e.dTransparencyType.ref.value)){var a=qQ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tTransparency.ref.value,colorType:e.dTransparencyType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:1},t,r,n,i);"volume"===a.kind?(tf.updateIfChanged(e.dTransparencyType,a.type),tf.update(e.tTransparencyGrid,a.texture),tf.update(e.uTransparencyTexDim,a.gridTexDim),tf.update(e.uTransparencyGridDim,a.gridDim),tf.update(e.uTransparencyGridTransform,a.gridTransform)):"vertex"===a.kind&&(tf.updateIfChanged(e.dTransparencyType,a.type),tf.update(e.tTransparency,a.texture),tf.update(e.uTransparencyTexDim,a.texDim))}}(e.values,C.resolution,C.stride,x,A),b.meta.transparencyTexture=e.values.tTransparencyGrid.ref.value)}else if(x&&"texture-mesh"===b.kind){var C,T=b.meta;w=T.resolution,A=T.transparencyTexture,(C=ZI(_.smoothColors,!0,w))&&(function(e,t,r,n,i){if(function(e){return"groupInstance"===e}(e.dTransparencyType.ref.value)){r*=3,n.namedTextures[aJ]||(n.namedTextures[aJ]=n.resources.texture("image-uint8","alpha","ubyte","nearest"));var a=n.namedTextures[aJ];a.load(e.tTransparency.ref.value);var o=eJ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:a,colorType:e.dTransparencyType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,r,n,i);tf.updateIfChanged(e.dTransparencyType,o.type),tf.update(e.tTransparencyGrid,o.texture),tf.update(e.uTransparencyTexDim,o.gridTexDim),tf.update(e.uTransparencyGridDim,o.gridDim),tf.update(e.uTransparencyGridTransform,o.gridTransform)}}(e.values,C.resolution,C.stride,x,A),b.meta.transparencyTexture=e.values.tTransparencyGrid.ref.value)}}}},e.setSubstance=function(e,t,r,n,i){if(e){var a=e.values,o=a.tSubstance,s=a.dSubstanceType,u=a.dSubstance,c=a.uGroupCount,l=a.instanceCount,d=a.instanceGranularity,f=d.ref.value?l.ref.value:c.ref.value*l.ref.value,h=d.ref.value?"instance":"groupInstance";!function(e,t,r){var n=NM(Math.max(1,e),4,Uint8Array,r&&r.tSubstance.ref.value.array);r?(tf.update(r.tSubstance,n),tf.update(r.uSubstanceTexDim,Bg.create(n.width,n.height)),tf.updateIfChanged(r.dSubstance,e>0),tf.updateIfChanged(r.dSubstanceType,t)):(tf.create(n),tf.create(Bg.create(n.width,n.height)),tf.create(e>0),tf.create(AI()),tf.create(Cg.create(1,1,1)),tf.create(Ng.create(0,0,0,1)),tf.create(t),tf.create(1))}(t.layers.length?f:0,h,e.values);var p=o.ref.value.array;n&&oD(p,0,f);for(var m=function(e,n){var i=t.layers[e],a=i.loci,o=i.material,s=i.clear;r(a,function(e){var t=$T.start(e),r=$T.end(e);return s?oD(p,t,r):function(e,t,r,n){for(var i=t;i<r;++i)VI.toArray(n,e,4*i),e[4*i+3]=255;return!0}(p,t,r,o)},!1)},g=0,v=t.layers.length;g<v;++g)m(g);if(tf.update(o,o.ref.value),tf.updateIfChanged(s,h),tf.updateIfChanged(u,t.layers.length>0),0!==t.layers.length&&"instance"!==h&&i&&KI(i.props)){var y=i.geometry,b=i.props,_=i.webgl;if("mesh"===y.kind){var x=y.meta,S=x.resolution,w=x.substanceTexture;(A=ZI(b.smoothColors,!0,S))&&(function(e,t,r,n,i){if(function(e){return"groupInstance"===e}(e.dSubstanceType.ref.value)){var a=qQ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tSubstance.ref.value,colorType:e.dSubstanceType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:4},t,r,n,i);"volume"===a.kind?(tf.updateIfChanged(e.dSubstanceType,a.type),tf.update(e.tSubstanceGrid,a.texture),tf.update(e.uSubstanceTexDim,a.gridTexDim),tf.update(e.uSubstanceGridDim,a.gridDim),tf.update(e.uSubstanceGridTransform,a.gridTransform)):"vertex"===a.kind&&(tf.updateIfChanged(e.dSubstanceType,a.type),tf.update(e.tSubstance,a.texture),tf.update(e.uSubstanceTexDim,a.texDim))}}(e.values,A.resolution,A.stride,_,w),y.meta.substanceTexture=e.values.tSubstanceGrid.ref.value)}else if(_&&"texture-mesh"===y.kind){var A,C=y.meta;S=C.resolution,w=C.substanceTexture,(A=ZI(b.smoothColors,!0,S))&&(function(e,t,r,n,i){if(function(e){return"groupInstance"===e}(e.dSubstanceType.ref.value)){r*=3,n.namedTextures[iJ]||(n.namedTextures[iJ]=n.resources.texture("image-uint8","rgba","ubyte","nearest"));var a=n.namedTextures[iJ];a.load(e.tSubstance.ref.value);var o=eJ({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:a,colorType:e.dSubstanceType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,r,n,i);tf.updateIfChanged(e.dSubstanceType,o.type),tf.update(e.tSubstanceGrid,o.texture),tf.update(e.uSubstanceTexDim,o.gridTexDim),tf.update(e.uSubstanceGridDim,o.gridDim),tf.update(e.uSubstanceGridTransform,o.gridTransform)}}(e.values,A.resolution,A.stride,_,w),y.meta.substanceTexture=e.values.tSubstanceGrid.ref.value)}}}},e.setClipping=function(e,t,r,n){if(e){var i=e.values,a=i.tClipping,o=i.dClippingType,s=i.dClipping,u=i.uGroupCount,c=i.instanceCount,l=i.instanceGranularity,d=l.ref.value?c.ref.value:u.ref.value*c.ref.value,f=t.layers,h=l.ref.value?"instance":"groupInstance";!function(e,t,r){var n=NM(Math.max(1,e),1,Uint8Array,r&&r.tClipping.ref.value.array);r?(tf.update(r.tClipping,n),tf.update(r.uClippingTexDim,Bg.create(n.width,n.height)),tf.updateIfChanged(r.dClipping,e>0),tf.updateIfChanged(r.dClippingType,t)):(tf.create(n),tf.create(Bg.create(n.width,n.height)),tf.create(e>0),tf.create(t))}(f.length?d:0,h,e.values);var p=a.ref.value.array;n&&function(e,t,r){e.fill(0,0,r)}(p,0,d);for(var m=function(e,n){var i=t.layers[e],a=i.loci,o=i.groups;r(a,function(e){return function(e,t,r,n){return e.fill(n,t,r),!0}(p,$T.start(e),$T.end(e),o)},!1)},g=0,v=t.layers.length;g<v;++g)m(g);tf.update(a,a.ref.value),tf.updateIfChanged(o,h),tf.updateIfChanged(s,t.layers.length>0)}},e.setThemeStrength=function(e,t){e&&(tf.updateIfChanged(e.values.uOverpaintStrength,t.overpaint),tf.updateIfChanged(e.values.uTransparencyStrength,t.transparency),tf.updateIfChanged(e.values.uSubstanceStrength,t.substance))},e.setTransform=function(e,t,r){if(e&&(t||r)){var n=e.values;t&&(Og.copy(n.matrix.ref.value,t),tf.update(n.matrix,n.matrix.ref.value)),r?(n.extraTransform.ref.value.set(r),tf.update(n.extraTransform,n.extraTransform.ref.value)):null===r&&(RI(n.extraTransform.ref.value,n.instanceCount.ref.value),tf.update(n.extraTransform,n.extraTransform.ref.value)),BI(n);var i=GM(n.invariantBoundingSphere.ref.value,n.aTransform.ref.value,n.instanceCount.ref.value,0);tf.update(n.boundingSphere,i)}}})(tJ||={}),function(e){function t(e){return 0===e.layers.length}e.Empty={kind:"empty-loci",layers:[]},function(e){var t;function r(e){switch(e){case"one":return t.One;case"two":return t.Two;case"three":return t.Three;case"four":return t.Four;case"five":return t.Five;case"six":return t.Six}}e.is=Sd.has,function(e){e[e.None=0]="None",e[e.One=1]="One",e[e.Two=2]="Two",e[e.Three=4]="Three",e[e.Four=8]="Four",e[e.Five=16]="Five",e[e.Six=32]="Six"}(t=e.Flag||={}),e.create=function(e){return Sd.create(e)},e.Names={one:t.One,two:t.Two,three:t.Three,four:t.Four,five:t.Five,six:t.Six},e.isName=function(t){return t in e.Names},e.fromName=r,e.fromNames=function(e){for(var n=t.None,i=0,a=e.length;i<a;++i)n|=r(e[i]);return n},e.toNames=function(r){var n=[];return e.is(r,t.One)&&n.push("one"),e.is(r,t.Two)&&n.push("two"),e.is(r,t.Three)&&n.push("three"),e.is(r,t.Four)&&n.push("four"),e.is(r,t.Five)&&n.push("five"),e.is(r,t.Six)&&n.push("six"),n}}(e.Groups||={}),e.areEqual=function(e,t){if(e.layers.length!==t.layers.length)return!1;for(var r=0,n=e.layers.length;r<n;++r)if(e.layers[r].groups!==t.layers[r].groups||!TQ.areEqual(e.layers[r].loci,t.layers[r].loci))return!1;return!0},e.isEmpty=t,e.remap=function(e,t){if("element-loci"===e.kind){for(var r=[],n=0,i=e.layers;n<i.length;n++){var a=i[n],o=a.loci,s=a.groups;o=Az.remap(o,t),Az.isEmpty(o)||r.push({loci:o,groups:s})}return{kind:"element-loci",layers:r}}return e},e.merge=function(e){if(t(e))return e;if("element-loci"===e.kind){for(var r=e.layers[0].loci.structure,n=new Map,i=Az.none(r),a=0,o=e.layers.length;a<o;++a){var s=e.layers[o-a-1],u=s.loci,c=s.groups;
139u=Az.subtract(u,i),i=Az.union(u,i),Az.isEmpty(u)||(n.has(c)&&(u=Az.union(u,n.get(c))),n.set(c,u))}var l=[];return n.forEach(function(e,t){l.push({loci:e,groups:t})}),{kind:"element-loci",layers:l}}return e},e.filter=function(e,r){if(t(e))return e;if("element-loci"===e.kind){for(var n=e.layers[0].loci.structure,i=[],a=0,o=e.layers;a<o.length;a++){var s=o[a],u=s.loci,c=s.groups,l=Az.remap(u,r);u=Az.remap(l,n),Az.isEmpty(u)||i.push({loci:u,groups:c})}return{kind:"element-loci",layers:i}}return e},e.ofScript=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.script,s=a.groups,u=mq.toLoci(o,t);Az.isEmpty(u)||r.push({loci:u,groups:s})}return{kind:"element-loci",layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.bundle,s=a.groups,u=sU.toLoci(o,t.root);r.push({loci:u,groups:s})}return{kind:"element-loci",layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var i=e.layers[r],a=i.loci,o=i.groups,s=sU.fromLoci(a);t.push({bundle:s,groups:o})}return{kind:"element-loci",layers:t}}}(sJ||={}),function(e){function t(e){return 0===e.layers.length}e.Empty={kind:"empty-loci",layers:[]},e.areEqual=function(e,t){if(0===e.layers.length&&0===t.layers.length)return!0;if(e.layers.length!==t.layers.length)return!1;for(var r=0,n=e.layers.length;r<n;++r)if(e.layers[r].clear!==t.layers[r].clear||!Gg(e.layers[r].material,t.layers[r].material)||!TQ.areEqual(e.layers[r].loci,t.layers[r].loci))return!1;return!0},e.isEmpty=t,e.remap=function(e,t){if("element-loci"===e.kind){for(var r=[],n=0,i=e.layers;n<i.length;n++){var a=i[n],o=a.loci,s=a.material,u=a.clear;o=Az.remap(o,t),Az.isEmpty(o)||r.push({loci:o,material:s,clear:u})}return{kind:"element-loci",layers:r}}return e},e.merge=function(e){if(t(e))return e;if("element-loci"===e.kind){for(var r=e.layers[0].loci.structure,n=void 0,i=new Map,a=Az.none(r),o=0,s=e.layers.length;o<s;++o){var u=e.layers[s-o-1],c=u.loci,l=u.material,d=u.clear;c=Az.subtract(c,a),a=Az.union(c,a),Az.isEmpty(c)||(d?n=n?Az.union(c,n):c:(i.has(l)&&(c=Az.union(c,i.get(l))),i.set(l,c)))}var f=[];return n&&f.push({loci:n,material:VI(),clear:!0}),i.forEach(function(e,t){f.push({loci:e,material:t,clear:!1})}),{kind:"element-loci",layers:f}}return e},e.filter=function(e,r){if(t(e))return e;if("element-loci"===e.kind){for(var n=e.layers[0].loci.structure,i=[],a=0,o=e.layers;a<o.length;a++){var s=o[a],u=s.loci,c=s.material,l=s.clear,d=Az.remap(u,r);u=Az.remap(d,n),Az.isEmpty(u)||i.push({loci:u,material:c,clear:l})}return{kind:"element-loci",layers:i}}return e},e.ofScript=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.script,s=a.material,u=a.clear,c=mq.toLoci(o,t);Az.isEmpty(c)||r.push({loci:c,material:s,clear:u})}return{kind:"element-loci",layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n],o=a.bundle,s=a.material,u=a.clear,c=sU.toLoci(o,t.root);r.push({loci:c,material:s,clear:u})}return{kind:"element-loci",layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var i=e.layers[r],a=i.loci,o=i.material,s=i.clear,u=sU.fromLoci(a);t.push({bundle:u,material:o,clear:s})}return{kind:"element-loci",layers:t}}}(uJ||={}),function(e){e.getDetaultParams=function(e,t,r){return Ib.getDefaultValues(e.getParams(t,r))}}(rJ||={});var cJ={name:"",label:"",description:"",factory:function(){return dJ.Empty},getParams:function(){return{}},defaultValues:{},defaultColorTheme:KZ.EmptyProvider,defaultSizeTheme:mQ.EmptyProvider,isApplicable:function(){return!0}};function lJ(e){return e.map(function(e){return[e.name,e.provider.label]})}var dJ,fJ=function(){function e(){this._list=[],this._map=new Map,this._name=new Map}return Object.defineProperty(e.prototype,"default",{get:function(){return this._list[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"types",{get:function(){return lJ(this._list)},enumerable:!1,configurable:!0}),e.prototype.add=function(e){if(this._map.has(e.name))throw Error(`${e.name} already registered.`);this._list.push({name:e.name,provider:e}),this._map.set(e.name,e),this._name.set(e,e.name)},e.prototype.getName=function(e){if(!this._name.has(e))throw Error(`'${e.label}' is not a registered represenatation provider.`);return this._name.get(e)},e.prototype.remove=function(e){var t=e.name;this._list.splice(this._list.findIndex(function(e){return e.name===t}),1);var r=this._map.get(t);r&&(this._map.delete(t),this._name.delete(r))},e.prototype.get=function(e){return this._map.get(e)||cJ},Object.defineProperty(e.prototype,"list",{get:function(){return this._list}
139,enumerable:!1,configurable:!0}),e.prototype.getApplicableList=function(e){return this._list.filter(function(t){return t.provider.isApplicable(e)})},e.prototype.getApplicableTypes=function(e){return lJ(this.getApplicableList(e))},e.prototype.clear=function(){this._list.length=0,this._map.clear(),this._name.clear()},e}();function hJ(e,t,r){void 0===r&&(r={});var n,i,a,o,s=0,u=new P_,c=dJ.createState(),l=OB(),d=[],f=-1,h=gQ.createEmpty(),p=Ib.getDefaultValues(t.Params);r.modifyState&&dJ.updateState(c,r.modifyState(c));var m=PQ.create();function g(e,t){return CQ(e)||_B.isLoci(e)&&e.shape===i?p.instanceGranularity?t($T.ofBounds(0,i.transforms.length)):t($T.ofBounds(0,i.groupCount*i.transforms.length)):p.instanceGranularity?function(e,t,r){var n=!1;if(!xB.isLoci(e)||xB.isLociEmpty(e)||e.shape!==t)return!1;for(var i=0,a=e.groups;i<a.length;i++){var o=a[i];r($T.ofSingleton(o.instance))&&(n=!0)}return n}(e,i,t):function(e,t,r){if(!xB.isLoci(e)||e.shape!==t)return!1;for(var n=!1,i=t.groupCount,a=0,o=e.groups;a<o.length;a++){var s=o[a],u=s.ids,c=s.instance;if($T.is(u)){var l=c*i+$T.start(u),d=c*i+$T.end(u);r($T.ofBounds(l,d))&&(n=!0)}else for(var f=0,h=u.length;f<h;f++){var p=c*i+u[f];r($T.ofSingleton(p))&&(n=!0)}}return n}(e,i,t)}return{label:"Shape geometry",get groupCount(){return a?a.count:0},get props(){return p},get params(){},get state(){return c},get theme(){return h},renderObjects:d,get geometryVersion(){return f},updated:u,createOrUpdate:function(g,v){var y=this;return void 0===g&&(g={}),r.modifyProps&&(g=r.modifyProps(g)),vy.create("ShapeRepresentation.create",function(b){return Tc(y,void 0,void 0,function(){var y,_,x,S,w,A,C,T;return Pc(this,function(P){switch(P.label){case 0:return y=Object.assign(p,g),v?[4,e(b,v,y,i)]:[3,2];case 1:return x=P.sent(),[3,3];case 2:x=void 0,P.label=3;case 3:if(function(e,t){void 0===e&&(e={}),PQ.reset(m),(t||i)&&(t&&!i?m.createNew=!0:t&&i&&t.id===i.id||(t&&i&&t.id!==i.id?(m.updateTransform=!0,m.createGeometry=!0):t&&console.warn("unexpected state")),e.instanceGranularity!==p.instanceGranularity&&(m.updateTransform=!0),m.updateTransform&&(m.updateColor=!0,m.updateSize=!0),m.createGeometry&&(m.updateColor=!0,m.updateSize=!0))}(g,_=x),_&&(i=_,Object.assign(h,_B.getTheme(i))),m.createNew)d.length=0,a=_B.groupIterator(i),S=_B.createTransform(i.transforms),w=t.createValues(i.geometry,S,a,h,y),A=t.createRenderableState(y),r.modifyState&&Object.assign(A,r.modifyState(A)),dJ.updateState(c,A),(n=RB(i.geometry.kind,w,A,l))&&d.push(n),o=t.createPositionIterator(i.geometry,n.values);else{if(!n)throw Error("expected renderObject to be available");m.updateTransform&&(_B.createTransform(i.transforms,n.values),a=_B.groupIterator(i),C=a.instanceCount,T=a.groupCount,g.instanceGranularity?qM(C,"instance",n.values):qM(C*T,"groupInstance",n.values)),m.createGeometry&&(tf.updateIfChanged(n.values.drawCount,cB.getDrawCount(i.geometry)),tf.updateIfChanged(n.values.uVertexCount,cB.getVertexCount(i.geometry)),tf.updateIfChanged(n.values.uGroupCount,cB.getGroupCount(i.geometry))),(m.updateTransform||m.createGeometry)&&(t.updateBoundingSphere(n.values,i.geometry),o=t.createPositionIterator(i.geometry,n.values)),m.updateColor&&CI(a,o,h.color,n.values),m.updateSize&&"uSize"in n.values&&DO(a,h.size,n.values),t.updateValues(n.values,y),t.updateRenderableState(n.state,y)}return p=y,(m.createGeometry||m.createNew)&&(f+=1),u.next(s++),[2]}})})})},getLoci:function(e){var t=e.objectId,r=e.groupId,a=e.instanceId;return n&&n.id===t?xB.Loci(i,[{ids:kP.ofSingleton(r),instance:a}]):EQ},getAllLoci:function(){return[_B.Loci(i)]},eachLocation:function(e){for(a.reset();a.hasNext;){var t=a.move();e(t.location,t.isSecondary)}},mark:function(e,t){if(!_Q.is(c.markerActions,t))return!1;if(xB.isLoci(e)||_B.isLoci(e)){if(e.shape!==i)return!1}else if(!CQ(e))return!1;return tJ.mark(n,e,t,g)},setState:function(e){r.modifyState&&(e=r.modifyState(e)),n&&(void 0!==e.visible&&tJ.setVisibility(n,e.visible),void 0!==e.alphaFactor&&tJ.setAlphaFactor(n,e.alphaFactor),void 0!==e.pickable&&tJ.setPickable(n,e.pickable),void 0!==e.colorOnly&&tJ.setColorOnly(n,e.colorOnly),void 0!==e.overpaint&&tJ.setOverpaint(n,e.overpaint,g,!0),void 0!==e.transparency&&tJ.setTransparency(n,e.transparency,g,!0),void 0!==e.substance&&tJ.setSubstance(n,e.substance,g,!0),void 0!==e.transform&&tJ.setTransform(n,e.transform)),dJ.updateState(c,e)},setTheme:function(e){ay&&console.warn("The `ShapeRepresentation` theme is fixed to `ShapeGroupColorTheme` and `ShapeGroupSizeTheme`. Colors are taken from `Shape.getColor` and sizes from `Shape.getSize`")},destroy:function(){d.length=0,n&&=void(n.state.disposed=!0)}}}!function(e){function t(){return{visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,syncManually:!1,transform:Og.identity(),overpaint:DQ.Empty,transparency:OQ.Empty,substance:uJ.Empty,clipping:sJ.Empty,themeStrength:{overpaint:1,transparency:1,substance:1},markerActions:_Q.All}}function r(e,t){void 0!==t.visible&&(e.visible=t.visible),void 0!==t.alphaFactor&&(e.alphaFactor=t.alphaFactor),void 0!==t.pickable&&(e.pickable=t.pickable),void 0!==t.colorOnly&&(e.colorOnly=t.colorOnly),void 0!==t.overpaint&&(e.overpaint=t.overpaint),void 0!==t.transparency&&(e.transparency=t.transparency),void 0!==t.substance&&(e.substance=t.substance),void 0!==t.clipping&&(e.clipping=t.clipping),void 0!==t.themeStrength&&(e.themeStrength=t.themeStrength),void 0!==t.syncManually&&(e.syncManually=t.syncManually),void 0!==t.transform&&Og.copy(e.transform,t.transform),void 0!==t.markerActions&&(e.markerActions=t.markerActions)}(function(e){e.areEqual=function(e,t){return e.repr===t.repr&&TQ.areEqual(e.loci,t.loci)},e.isEmpty=function(e){return TQ.isEmpty(e.loci)},e.Empty={loci:EQ}})(e.Loci||={}),e.createState=t,e.updateState=r,e.StateBuilder={create:t,update:r},e.Empty={label:"",groupCount:0,renderObjects:[],geometryVersion:-1,props:{},params:{},updated:new P_,state:t(),theme:gQ.createEmpty(),createOrUpdate:function(){return vy.constant("",void 0)},setState:function(){},setTheme:function(){},getLoci:function(){return EQ},getAllLoci:function(){return[]},eachLocation:function(){},mark:function(){return!1},destroy:function(){}};var n=function(){function e(){this.curr=new Set,this.next=new Set,this._version=-1}
139return Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),e.prototype.add=function(e,t){this.next.add(Ev(e,t))},e.prototype.snapshot=function(){var e;mN.areEqual(this.curr,this.next)||(this._version+=1),e=[this.next,this.curr],this.curr=e[0],this.next=e[1],this.next.clear()},e}();e.GeometryState=n,e.createMulti=function(e,t,r,i,a){var o,s,u,c=this,l=0,d=new P_,f=new n,h=i.create(),p=gQ.createEmpty(),m={},g=Object.keys(a).map(function(e,n){m[n]=e;var i=a[e](t,r);return i.setState(h),i});return{label:e,updated:d,get groupCount(){var e=0;if(s)for(var t=s.visuals,r=0,n=g.length;r<n;++r)t&&!t.includes(m[r])||(e+=g[r].groupCount);return e},get renderObjects(){var e=[];if(s)for(var t=s.visuals,r=0,n=g.length;r<n;++r)t&&!t.includes(m[r])||e.push.apply(e,g[r].renderObjects);return e},get geometryVersion(){return f.version},get props(){return s},get params(){return o},createOrUpdate:function(n,i){void 0===n&&(n={}),i&&i!==u&&(o=r(t,i),u=i,s||=Ib.getDefaultValues(o));var a=NQ(Object.assign({},s,n),u);Object.assign(s,n,a);var h=s.visuals;return vy.create(`Creating or updating '${e}' representation`,function(e){return Tc(c,void 0,void 0,function(){var t,r;return Pc(this,function(n){switch(n.label){case 0:t=0,r=g.length,n.label=1;case 1:return t<r?h&&!h.includes(m[t])?[3,3]:[4,g[t].createOrUpdate(s,u).runInContext(e)]:[3,5];case 2:n.sent(),n.label=3;case 3:f.add(t,g[t].geometryVersion),n.label=4;case 4:return++t,[3,1];case 5:return f.snapshot(),d.next(l++),[2]}})})})},get state(){return h},get theme(){return p},getLoci:function(e){for(var t=s.visuals,r=0,n=g.length;r<n;++r)if(!t||t.includes(m[r])){var i=g[r].getLoci(e);if(!MQ(i))return i}return EQ},getAllLoci:function(){for(var e=[],t=s.visuals,r=0,n=g.length;r<n;++r)t&&!t.includes(m[r])||e.push.apply(e,g[r].getAllLoci());return e},eachLocation:function(e){for(var t=s.visuals,r=0,n=g.length;r<n;++r)t&&!t.includes(m[r])||g[r].eachLocation(e)},mark:function(e,t){for(var r=!1,n=0,i=g.length;n<i;++n)r=g[n].mark(e,t)||r;return r},setState:function(e){i.update(h,e);for(var t=0,r=g.length;t<r;++t)g[t].setState(e)},setTheme:function(e){p=e;for(var t=0,r=g.length;t<r;++t)g[t].setTheme(e)},destroy:function(){for(var e=0,t=g.length;e<t;++e)g[e].destroy()}}},e.fromRenderObject=function(t,r){var i=this,a=0,o=new P_,s=new n,u=e.createState(),c=gQ.createEmpty(),l=Ib.clone(qI.Params),d=Ib.getDefaultValues(qI.Params);return{label:t,updated:o,get groupCount(){return r.values.uGroupCount.ref.value},get renderObjects(){return[r]},get geometryVersion(){return s.version},get props(){return d},get params(){return l},createOrUpdate:function(e){void 0===e&&(e={});var n=NQ(Object.assign({},d,e));return Object.assign(d,e,n),vy.create(`Updating '${t}' representation`,function(e){return Tc(i,void 0,void 0,function(){return Pc(this,function(e){return s.add(0,r.id),s.snapshot(),o.next(a++),[2]})})})},get state(){return u},get theme(){return c},getLoci:function(){return EQ},getAllLoci:function(){return[]},eachLocation:function(){},mark:function(e,t){return!1},setState:function(t){void 0!==t.visible&&tJ.setVisibility(r,t.visible),void 0!==t.alphaFactor&&tJ.setAlphaFactor(r,t.alphaFactor),void 0!==t.pickable&&tJ.setPickable(r,t.pickable),void 0!==t.colorOnly&&tJ.setColorOnly(r,t.colorOnly),t.overpaint,t.transparency,t.substance,void 0!==t.themeStrength&&tJ.setThemeStrength(r,t.themeStrength),void 0!==t.transform&&tJ.setTransform(r,t.transform),e.updateState(u,t)},setTheme:function(){},destroy:function(){}}}}(dJ||={});var pJ=Og(),mJ=function(){function e(e){this.structure=e,this.groupUnitTransforms=[],this.unitOffsetMap=mE.Mutable(),this.groupIndexMap=mE.Mutable(),this._isIdentity=void 0,this.version=0,this.unitTransforms=new Float32Array(16*e.units.length),this.size=e.units.length,this.reset();for(var t=0,r=0,n=e.unitSymmetryGroups.length;r<n;++r){var i=e.unitSymmetryGroups[r];this.groupIndexMap.set(i.hashCode,r);var a=this.unitTransforms.subarray(t,t+16*i.units.length);this.groupUnitTransforms.push(a);for(var o=0,s=i.units.length;o<s;++o)this.unitOffsetMap.set(i.units[o].id,t+16*o);t+=16*i.units.length}}return e.prototype.reset=function(){this.version=0,RI(this.unitTransforms,this.size),this._isIdentity=!0},Object.defineProperty(e.prototype,"isIdentity",{get:function(){if(void 0===this._isIdentity){this._isIdentity=!0;for(var e=0,t=16*this.size;e<t;e+=16)if(Og.fromArray(pJ,this.unitTransforms,e),!Og.isIdentity(pJ)){this._isIdentity=!1;break}}return this._isIdentity}
139,enumerable:!1,configurable:!0}),e.prototype.setTransform=function(e,t){this.version=(this.version+1)%2147483647,Og.toArray(e,this.unitTransforms,this.unitOffsetMap.get(t.id)),this._isIdentity=void 0},e.prototype.getTransform=function(e,t){return Og.fromArray(e,this.unitTransforms,this.unitOffsetMap.get(t.id))},e.prototype.getSymmetryGroupTransforms=function(e){return this.groupUnitTransforms[this.groupIndexMap.get(e.hashCode)]},e}(),gJ=Og();function vJ(e,t,r){for(var n=0,i=e.units.length;n<i;n++){var a=e.units[n];AE.lerpFromIdentity(gJ,a.conformation.operator,r),t.setTransform(gJ,a)}}var yJ=Cg(),bJ=Cg(),_J=Og();function xJ(e,t,r,n){for(var i=n.radius*r,a=0,o=e.units.length;a<o;a++){var s=e.units[a];Cg.transformMat4(yJ,s.lookup3d.boundary.sphere.center,s.conformation.operator.matrix),Cg.sub(bJ,yJ,n.center),Cg.setMagnitude(bJ,bJ,i),Og.fromTranslation(_J,bJ),t.setTransform(_J,s)}}var SJ={axis:Ib.MappedStatic("custom",{structure:Ib.Group({principalAxis:Ib.Select("dirA",[["dirA","A"],["dirB","B"],["dirC","C"]])}),custom:Ib.Group({vector:Ib.Vec3(Cg.create(0,0,1))})}),origin:Ib.MappedStatic("structure",{structure:Ib.Group({}),custom:Ib.Group({vector:Ib.Vec3(Cg.create(0,0,0))})})};function wJ(e,t){return{axis:"custom"===t.axis.name?t.axis.params.vector:yz.getPrincipalAxes(e).momentsAxes[t.axis.params.principalAxis],origin:"custom"===t.origin.name?t.origin.params.vector:yz.getPrincipalAxes(e).momentsAxes.origin}}var AJ=Og(),CJ=Og(),TJ=Og();function PJ(e,t,r,n,i){for(var a=0,o=e.units.length;a<o;a++){var s=e.units[a];Cg.negate(bJ,i),Og.fromTranslation(_J,bJ),Og.fromRotation(AJ,Math.PI*r*2,n),Og.fromTranslation(CJ,i),Og.mul(TJ,AJ,_J),Og.mul(TJ,CJ,TJ),t.setTransform(TJ,s)}}var EJ=Og.fromTranslation(Og(),Cg.create(.5,.5,.5)),MJ=wD(xD(cR()),EJ),kJ=Cg(),IJ=Og(),DJ=Ac(Ac({},sD.Params),{cellColor:Ib.Color(MC.orange),cellScale:Ib.Numeric(2,{min:.1,max:5,step:.1}),ref:Ib.Select("model",Ib.objectToOptions({origin:"Origin",model:"Model"}),{isEssential:!0}),attachment:Ib.Select("corner",Ib.objectToOptions({corner:"Corner",center:"Center"}),{isEssential:!0})}),OJ={mesh:function(e,t){return hJ(BJ,sD.Utils)}},RJ=Ac({},DJ);function BJ(e,t,r,n){var i=function(e,t,r){var n=dO.createState(256,128,r),i=e.symmetry.spacegroup.cell.fromFractional;Cg.copy(kJ,e.ref),"center"===t.attachment?(Cg.trunc(kJ,kJ),Cg.subScalar(kJ,kJ,.5)):Cg.floor(kJ,kJ),Og.fromTranslation(IJ,kJ);var a=wD(xD(MJ),IJ),o=Math.cbrt(e.symmetry.spacegroup.cell.volume)/300*t.cellScale;n.currentGroup=1,dO.addCage(n,i,a,o,2,20);var s=XE.fromDimensionsAndTransform(XE(),Cg.unit,i);Cg.transformMat4(kJ,kJ,i),XE.translate(s,s,kJ),XE.expand(s,s,o);var u=dO.getMesh(n);return u.setBoundingSphere(s),u}(t,r,n&&n.geometry),a=jF.getUnitcellLabel(t.symmetry);return _B.create(a,t,i,function(){return r.cellColor},function(){return 1},function(){return a})}function NJ(e,t,r){var n=Cg();return"model"===r.ref&&Cg.transformMat4(n,Xz.getCenter(e),t.spacegroup.cell.toFractional),{symmetry:t,ref:n}}var FJ,LJ=new Uint16Array([0,1,2,1,3,2]),$J=iv.add3,UJ=iv.add2,jJ=iv.add;!function(e){e.create=function(e,t,r,n){void 0===e&&(e={}),void 0===t&&(t=2048),void 0===r&&(r=1024),t*=2,r*=2;var i=iv.create(Float32Array,3,r,n?n.centerBuffer.ref.value:t),a=iv.create(Float32Array,2,r,n?n.mappingBuffer.ref.value:t),o=iv.create(Float32Array,1,r,n?n.depthBuffer.ref.value:t),s=iv.create(Uint32Array,3,r,n?n.indexBuffer.ref.value:t),u=iv.create(Float32Array,1,r,n?n.groupBuffer.ref.value:t),c=iv.create(Float32Array,2,r,n?n.tcoordBuffer.ref.value:t),l=Ac(Ac({},Ib.getDefaultValues(UO.Params)),e),d=l.attachment,f=l.background,h=l.backgroundMargin,p=l.tether,m=l.tetherLength,g=l.tetherBaseWidth,v=function(e){var t=JSON.stringify(e);return void 0===jO[t]&&(jO[t]=new GO(e)),jO[t]}(l),y=.4*h,b=v.buffer/v.lineHeight,_=function(e,t,r,n,a){$J(i,e,t,r),jJ(o,n),jJ(u,a)};return{add:function(e,t,r,n,o,u,l){for(var h=0,x=e.length,S=0;S<x;++S)h+=(z=v.get(e[S])).nw-2*b;var w,A;if(w=d.startsWith("top")?.8:d.startsWith("middle")?.4:0,A=d.endsWith("right")?h:d.endsWith("center")?h/2:0,p)switch(d){case"bottom-left":A-=m/2+y+.1,w-=m/2+y;break;case"bottom-center":w-=m+y;break;case"bottom-right":A+=m/2+y+.1,w-=m/2+y;break;case"middle-left":A-=m+y+.1;break;case"middle-center":break;case"middle-right":A+=m+y+.1;break;case"top-left":A-=m/2+y+.1,w+=m/2+y;break;case"top-center":w+=m+y;break;case"top-right":A+=m/2+y+.1,w+=m/2+y}var C=(-A-y-.1)*u,T=(h-A+y+.1)*u,P=(.8-w+y)*u,E=(-w-y)*u;if(f){UJ(a,C,P),UJ(a,C,E),UJ(a,T,P),UJ(a,T,E);for(var M=i.elementCount,k=0;k<4;++k)UJ(c,10,10),_(t,r,n,o,l);$J(s,M+LJ[0],M+LJ[1],M+LJ[2]),$J(s,M+LJ[3],M+LJ[4],M+LJ[5])}if(p){var I=void 0,D=void 0,O=void 0,R=void 0,B=void 0,N=void 0,F=void 0,L=void 0,$=m*u,U=g*u;switch(d){case"bottom-left":I=C-$/2,O=C+U/2,B=C,F=C,D=E-$/2,R=E,N=E+U/2,L=E;break;case"bottom-center":I=0,O=U/2,B=-U/2,F=0,D=E-$,R=E,N=E,L=E;break;case"bottom-right":I=T+$/2,O=T,B=T-U/2,F=T,D=E-$/2,R=E+U/2,N=E,L=E;break;case"middle-left":I=C-$,O=C,B=C,F=C,D=0,R=-U/2,N=U/2,L=0;break;case"middle-center":I=0,O=0,B=0,F=0,D=0,R=0,N=0,L=0;break;case"middle-right":I=T+$,O=T,B=T,F=T,D=0,R=U/2,N=-U/2,L=0;break;case"top-left":I=C-$/2,O=C+U/2,B=C,F=C,D=P+$/2,R=P,N=P-U/2,L=P;break;case"top-center":I=0,O=U/2,B=-U/2,F=0,D=P+$,R=P,N=P,L=P;break;case"top-right":I=T+$/2,O=T,B=T-U/2,F=T,D=P+$/2,R=P-U/2,N=P,L=P;break;default:Lg()}for(UJ(a,I,D),UJ(a,O,R),UJ(a,B,N),UJ(a,F,L),M=i.elementCount,k=0;k<4;++k)UJ(c,10,10),_(t,r,n,o,l);$J(s,M,M+1,M+3),$J(s,M,M+3,M+2)}A+=b,w+=b;var j=0;for(S=0;S<x;++S){var z,G=(j-A)*u,V=(j+(z=v.get(e[S])).nw-A)*u,H=(z.nh-w)*u,q=-w*u;UJ(a,G,H),UJ(a,G,q),UJ(a,V,H),UJ(a,V,q);var W=v.texture.width,X=v.texture.height;for(UJ(c,z.x/W,z.y/X),UJ(c,z.x/W,(z.y+z.h)/X),UJ(c,(z.x+z.w)/W,z.
139y/X),UJ(c,(z.x+z.w)/W,(z.y+z.h)/X),j+=z.nw-2*b,M=i.elementCount,k=0;k<4;++k)_(t,r,n,o,l);$J(s,M+LJ[0],M+LJ[1],M+LJ[2]),$J(s,M+LJ[3],M+LJ[4],M+LJ[5])}},getText:function(){var e=v.texture,t=iv.compact(i,!0),r=iv.compact(a,!0),l=iv.compact(o,!0),d=iv.compact(s,!0),f=iv.compact(u,!0),h=iv.compact(c,!0);return UO.create(e,t,r,l,d,f,h,s.elementCount/2,n)}}}}(FJ||={});var zJ={granularity:"element",condensed:!1,reverse:!1,countsOnly:!1,hidePrefix:!1,htmlStyling:!0};function GJ(e,t){switch(void 0===t&&(t={}),e.kind){case"structure-loci":return e.structure.models.map(function(e){return e.entry}).filter(function(e){return!!e}).join(", ");case"element-loci":return qJ(_z.ofLoci(e),t);case"bond-loci":var r=e.bonds[0];return r?XJ(r,t):"";case"shape-loci":return e.shape.name;case"group-loci":var n=e.groups[0];return n?e.shape.getLabel(kP.start(n.ids),n.instance):"";case"every-loci":return"Everything";case"empty-loci":return"Nothing";case"data-loci":return e.getLabel();case"volume-loci":return e.volume.label||"Volume";case"isosurface-loci":return[`${e.volume.label||"Volume"}`,`Isosurface at ${gR.IsoValue.toString(e.isoValue)}`].join(" | ");case"cell-loci":var i=kP.size(e.indices),a=kP.start(e.indices),o=gR.IsoValue.absolute(e.volume.grid.cells.data[a]),s=gR.IsoValue.toRelative(o,e.volume.grid.stats),u=[`${e.volume.label||"Volume"}`,1===i?`Cell #${a}`:`${i} Cells`];return 1===i&&u.push(`${gR.IsoValue.toString(o)} (${gR.IsoValue.toString(s)})`),u.join(" | ");case"segment-loci":var c=gR.Segmentation.get(e.volume)?.labels;if(c&&1===e.segments.length){var l=c[e.segments[0]];if(l)return l}return[`${e.volume.label||"Volume"}`,1===e.segments.length?`Segment ${e.segments[0]}`:`${e.segments.length} Segments`].join(" | ")}}function VJ(e,t){return 1===e?`1 ${t}`:`${e} ${t}s`}function HJ(e,t,r,n,i,a){return`${KJ(t,{granularity:r,hidePrefix:n,reverse:i,condensed:a})} <small>[+ ${VJ(e-1,`other ${Xg(r)}`)}]</small>`}function qJ(e,t){void 0===t&&(t={});var r=Ac(Ac({},zJ),t),n=function(e,t,r,n,i){void 0===t&&(t=!1),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1);var a=e.structureCount,o=e.chainCount,s=e.residueCount,u=e.conformationCount,c=e.elementCount;if(t||1!==c||0!==s||0!==o){if(t||0!==c||1!==s||0!==o){if(t||0!==c||0!==s||1!==o){if(t)return l=[],a>0&&l.push(VJ(a,"Structure")),o>0&&l.push(VJ(o,"Chain")),s>0&&l.push(VJ(s,"Residue")),u>0&&l.push(VJ(u,"Conformation")),c>0&&l.push(VJ(c,"Element")),l.join("<small> + </small>");var l=[];return a>0&&l.push(1===a?KJ(e.firstStructureLoc,{hidePrefix:r,condensed:n,granularity:"structure",reverse:i}):HJ(a,e.firstStructureLoc,"structure",r,i,n)),o>0&&(l.push(1===o?KJ(e.firstChainLoc,{condensed:n,granularity:"chain",hidePrefix:r,reverse:i}):HJ(o,e.firstChainLoc,"chain",r,i,n)),r=!0),s>0&&(l.push(1===s?KJ(e.firstResidueLoc,{condensed:n,granularity:"residue",hidePrefix:r,reverse:i}):HJ(s,e.firstResidueLoc,"residue",r,i,n)),r=!0),u>0&&(l.push(1===u?KJ(e.firstConformationLoc,{condensed:n,granularity:"conformation",hidePrefix:r,reverse:i}):HJ(u,e.firstConformationLoc,"conformation",r,i,n)),r=!0),c>0&&l.push(1===c?KJ(e.firstElementLoc,{condensed:n,granularity:"element",hidePrefix:r,reverse:i}):HJ(c,e.firstElementLoc,"element",r,i,n)),l.join("<small> + </small>")}var d=e.firstChainLoc.unit,f=tU.isAtomic(d)&&1===function(e){var t=e.elements,r=e.model.atomicHierarchy,n=r.chainAtomSegments,i=r.residueAtomSegments,a=n.offsets[n.index[t[0]]],o=n.offsets[n.index[t[t.length-1]]+1]-1;return i.index[o]-i.index[a]+1}(d)||tU.Traits.is(d.traits,tU.Trait.MultiChain)?"residue":"chain";return KJ(e.firstChainLoc,{hidePrefix:r,condensed:n,granularity:f,reverse:i})}return KJ(e.firstResidueLoc,{hidePrefix:r,condensed:n,granularity:"residue",reverse:i})}return KJ(e.firstElementLoc,{hidePrefix:r,condensed:n,granularity:"element",reverse:i})}(e,r.countsOnly,r.hidePrefix,r.condensed,r.reverse);return r.htmlStyling?n:Zg(n)}function WJ(e,t){void 0===t&&(t={});for(var r=_z.create(),n=0,i=e;n<i.length;n++){var a=i[n];_z.add(r,r,_z.ofLoci(a))}return qJ(r,t)}function XJ(e,t){return void 0===t&&(t={}),YJ({loci:[Az(e.aStructure,[{unit:e.aUnit,indices:kP.ofSingleton(e.aIndex)}]),Az(e.bStructure,[{unit:e.bUnit,indices:kP.ofSingleton(e.bIndex)}])]},t)}function YJ(e,t){void 0===t&&(t={});var r=Ac(Ac({},zJ),t),n=function(e,t){for(var r=t.granularity,n=t.hidePrefix,i=t.reverse,a=t.condensed,o=!0,s=0,u=e.loci;s<u.length;s++){var c=u[s];if(!Az.is(c)||1!==Az.size(c)){o=!1;break}}if(o){var l=e.loci.map(function(e){var t=e.elements[0],r=t.unit,n=t.
139indices;return qF.create(e.structure,r,r.elements[kP.start(n)])}).map(function(e){return ZJ(e,r,n,i||a)});if(a)return l.map(function(e){return e[0].replace(/\[.*\]/g,"").trim()}).filter(function(e){return!!e}).join(" — ");for(var d=0,f=0,h=Math.min.apply(Math,l.map(function(e){return e.length}))-1;f<h;++f){for(var p=!0,m=1,g=l.length;m<g;++m)if(l[0][f]!==l[m][f]){p=!1;break}if(!p)break;d+=1}if(d>0){var v=[l[0].join(" | ")];for(m=1,g=l.length;m<g;++m)v.push(l[m].slice(d).filter(function(e){return!!e}).join(" | "));return v.join(" — ")}return l.map(function(e){return e.filter(function(e){return!!e}).join(" | ")}).filter(function(e){return!!e}).join("</br>")}return(l=e.loci.map(function(e){return GJ(e,t)})).filter(function(e){return!!e}).join(a?" — ":"</br>")}(e,r);return r.htmlStyling?n:Zg(n)}function KJ(e,t){void 0===t&&(t={});var r=Ac(Ac({},zJ),t),n=ZJ(e,r.granularity,r.hidePrefix,r.reverse||r.condensed),i=r.condensed?n[0]?.replace(/\[.*\]/g,"").trim()??"":n.filter(function(e){return!!e}).join(" | ");return r.htmlStyling?i:Zg(i)}function ZJ(e,t,r,n){void 0===t&&(t="element"),void 0===r&&(r=!1),void 0===n&&(n=!1);var i=[];if(!r){var a=e.unit.model.entry;a.length>30&&(a=a.substr(0,27)+"…"),i.push(`<small>${a}</small>`),"structure"!==t&&(i.push(`<small>Model ${e.unit.model.modelNum}</small>`),i.push(`<small>Instance ${e.unit.conformation.operator.name}</small>`))}return tU.isAtomic(e.unit)?i.push.apply(i,function(e,t,r){void 0===r&&(r=!1);var n=qF.residueIndex(e),i=Cj.chain.label_asym_id(e),a=Cj.chain.auth_asym_id(e),o=0===e.unit.model.atomicHierarchy.residues.label_seq_id.valueKind(n),s=Cj.residue.label_seq_id(e),u=Cj.residue.auth_seq_id(e),c=Cj.residue.pdbx_PDB_ins_code(e),l=Cj.atom.label_comp_id(e),d=Cj.atom.label_atom_id(e),f=Cj.atom.label_alt_id(e),h=Cj.atom.occupancy(e),p=Cj.residue.microheterogeneityCompIds(e),m="residue"===t&&p.length>1?`(${p.join("|")})`:l,g=[];switch(t){case"element":g.push(`<b>${d}</b>${f?`%${f}`:""}`);case"conformation":"conformation"===t&&f&&g.push(`<small>Conformation</small> <b>${f}</b>`);case"residue":var v=s!==u&&o?s:u;g.push(`<b>${m} ${v}</b>${v===u?"":` <small>[auth</small> <b>${u}</b><small>]</small>`}<b>${c||""}</b>`);case"chain":i===a?g.push(`<b>${i}</b>`):"chain"===t&&tU.Traits.is(e.unit.traits,tU.Trait.MultiChain)?g.push(`<small>[auth</small> <b>${a}</b><small>]</small>`):g.push(`<b>${i}</b> <small>[auth</small> <b>${a}</b><small>]</small>`)}return g.length>0&&1!==h&&!r&&(g[0]=`${g[0]} <small>[occupancy</small> <b>${Math.round(100*h)/100}</b><small>]</small>`),g.reverse()}(e,t,n)):tU.isCoarse(e.unit)?i.push.apply(i,function(e,t){var r=Cj.coarse.asym_id(e),n=Cj.coarse.seq_id_begin(e),i=Cj.coarse.seq_id_end(e),a=[];switch(t){case"element":case"conformation":case"residue":if(n===i){var o=Cj.coarse.entityKey(e),s=e.unit.model.sequence.byEntityKey[o].sequence.compId.value(n-1);a.push(`<b>${s} ${n}</b>`)}else a.push(`<b>${n}-${i}</b>`);case"chain":a.push(`<b>${r}</b>`)}return a.reverse()}(e,t)):i.push("Unknown"),n?i.reverse():i}function QJ(e,t){void 0===t&&(t={});var r=Ac(Ac(Ac({},zJ),{measureOnly:!1,unitLabel:"Å"}),t),n=e.loci.map(function(e){return TQ.getCenter(e)}),i=n[0],a=n[1],o=`${Cg.distance(i,a).toFixed(2)} ${r.unitLabel}`;if(r.measureOnly)return o;var s=YJ(e,r);return r.condensed?`${o} | ${s}`:`Distance ${o}</br>${s}`}function JJ(e,t){void 0===t&&(t={});var r=Ac(Ac(Ac({},zJ),{measureOnly:!1}),t),n=e.loci.map(function(e){return TQ.getCenter(e)}),i=n[0],a=n[1],o=n[2],s=Cg.sub(Cg(),i,a),u=Cg.sub(Cg(),o,a),c=`${kg(Cg.angle(s,u)).toFixed(2)}°`;if(r.measureOnly)return c;var l=YJ(e,r);return r.condensed?`${c} | ${l}`:`Angle ${c}</br>${l}`}function e0(e,t){void 0===t&&(t={});var r=Ac(Ac(Ac({},zJ),{measureOnly:!1}),t),n=e.loci.map(function(e){return TQ.getCenter(e)}),i=n[0],a=n[1],o=n[2],s=n[3],u=`${kg(Cg.dihedralAngle(i,a,o,s)).toFixed(2)}°`;if(r.measureOnly)return u;var c=YJ(e,r);return r.condensed?`${u} | ${c}`:`Dihedral ${u}</br>${c}`}var t0={customText:Ib.Text("",{label:"Text",description:"Override the label with custom value.",isEssential:!0}),textColor:Ib.Color(MC.black,{isEssential:!0}),textSize:Ib.Numeric(.5,{min:.1,max:10,step:.1},{isEssential:!0})},r0=Ac(Ac(Ac({}
139,UO.Params),t0),{borderWidth:Ib.Numeric(.2,{min:0,max:.5,step:.01})}),n0={unitLabel:Ib.Text("Å",{isEssential:!0})},i0=Ac(Ac(Ac({},qO.Params),n0),{lineSizeAttenuation:Ib.Boolean(!0),linesColor:Ib.Color(MC.lightgreen,{isEssential:!0}),linesSize:Ib.Numeric(.075,{min:.01,max:5,step:.01}),dashLength:Ib.Numeric(.2,{min:.01,max:.2,step:.01})}),a0=Ac(Ac({},r0),n0),o0={lines:function(e,t){return hJ(d0,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{markerActions:_Q.Highlighting})}})},text:function(e,t){return hJ(f0,UO.Utils,{modifyState:function(e){return Ac(Ac({},e),{markerActions:bQ.None})}})}},s0=Ac(Ac(Ac({},i0),a0),{visuals:Ib.MultiSelect(["lines","text"],Ib.objectToOptions(o0))});function u0(e,t){var r=t.sphereA,n=t.sphereB,i=t.center,a=e.loci,o=a[0],s=a[1];return TQ.getBoundingSphere(o,r),TQ.getBoundingSphere(s,n),Cg.add(i,r.center,n.center),Cg.scale(i,i,.5),t.distance=Cg.distance(r.center,n.center),t}var c0={sphereA:XE(),sphereB:XE(),center:Cg(),distance:0};function l0(e,t){return 1===e.pairs.length?`Distance ${QJ(e.pairs[0],{unitLabel:t,measureOnly:!0})}`:`${e.pairs.length} Distances`}function d0(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.pairs.length;i<a;++i)u0(e.pairs[i],c0),n.addFixedLengthDashes(c0.sphereA.center,c0.sphereB.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=l0(t,r.unitLabel);return _B.create(a,t,i,function(){return r.linesColor},function(){return r.linesSize},function(e){return QJ(t.pairs[e],r)})}function f0(e,t,r,n){var i=function(e,t,r){for(var n=FJ.create(t,128,64,r),i=0,a=e.pairs.length;i<a;++i){u0(e.pairs[i],c0);var o=c0.center,s=c0.distance,u=c0.sphereA,c=c0.sphereB,l=t.customText||`${s.toFixed(2)} ${t.unitLabel}`,d=Math.max(2,u.radius,c.radius)/2;n.add(l,o[0],o[1],o[2],1,d,i)}return n.getText()}(t,r,n&&n.geometry),a=l0(t,r.unitLabel);return _B.create(a,t,i,function(){return r.textColor},function(){return r.textSize},function(e){return QJ(t.pairs[e],r)})}function h0(e){return{pairs:[{loci:[e[0].loci,e[1].loci]}]}}function p0(e){return{triples:[{loci:[e[0].loci,e[1].loci,e[2].loci]}]}}function m0(e){return{quads:[{loci:[e[0].loci,e[1].loci,e[2].loci,e[3].loci]}]}}function g0(e){return{infos:[{loci:e[0].loci}]}}function v0(e){return{locis:e.map(function(e){return e.loci})}}function y0(e){return{locis:e.map(function(e){return e.loci})}}var b0=Ac({},r0),_0={text:function(e,t){return hJ(A0,UO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})}},x0=Ac(Ac({},b0),{scaleByRadius:Ib.Boolean(!0),visuals:Ib.MultiSelect(["text"],Ib.objectToOptions(_0))}),S0=XE();function w0(e,t){return void 0===t&&(t=!1),e.label||GJ(e.loci,{hidePrefix:!0,htmlStyling:!1,condensed:t})}function A0(e,t,r,n){var i=function(e,t,r){for(var n=FJ.create(t,128,64,r),i=t.customText.trim(),a=0,o=e.infos.length;a<o;++a){var s=e.infos[a],u=TQ.getBoundingSphere(s.loci,S0);if(u){var c=u.center,l=u.radius,d=i||w0(s,!0);n.add(d,c[0],c[1],c[2],t.scaleByRadius?l/.9:0,t.scaleByRadius?Math.max(1,l):1,a)}}return n.getText()}(t,r,n&&n.geometry),a=function(e){return 1===e.infos.length?w0(e.infos[0]):`${e.infos.length} Labels`}(t),o=r.customText.trim(),s=o?function(e){return o}:function(e){return w0(t.infos[e])};return _B.create(a,t,i,function(){return r.textColor},function(){return r.textSize},s)}var C0=Cg(),T0=Og.identity(),P0=new Float32Array(18),E0=new Uint8Array([0,1,2,3,4,5]);Cg.zero(),Cg.zero();var M0=Cg(),k0=Cg(),I0=Cg(),D0=Cg(),O0=Og.identity(),R0=new Float32Array(24),B0=new Uint8Array([0,1,0,3,0,6,1,2,1,7,2,3,2,4,3,5,4,5,4,7,5,6,6,7]),N0=Og.identity(),F0=Cg();function L0(e,t,r,n,i,a){dO.addPrimitive(e,function(e,t,r,n,i){return Cg.add(F0,t,r),Og.targetTo(e,t,F0,n),Og.setTranslation(e,t),Og.scale(e,e,i)}(N0,t,r,n,i),DD(a))}var $0={color:Ib.Color(MC.orange),scaleFactor:Ib.Numeric(1,{min:.1,max:10,step:.1}),radiusScale:Ib.Numeric(2,{min:.1,max:10,step:.1})},U0=Ac(Ac({},sD.Params),$0),j0=Ac(Ac({},sD.Params),$0),z0=Ac(Ac({},sD.Params),$0),G0={axes:function(e,t){return hJ(H0,sD.Utils)},box:function(e,t){return hJ(q0,sD.Utils)},ellipsoid:function(e,t){return hJ(W0,sD.Utils)}},V0=Ac(Ac(Ac(Ac({}
139,U0),j0),z0),{visuals:Ib.MultiSelect(["box"],Ib.objectToOptions(G0))});function H0(e,t,r,n){var i=function(e,t,r){var n=dO.createState(256,128,r),i=Az.getPrincipalAxesMany(e.locis);return HE.scale(i.momentsAxes,i.momentsAxes,t.scaleFactor),n.currentGroup=0,function(e,t,r){var n=t.origin,i=t.dirA,a=t.dirB,o=t.dirC;Cg.add(C0,n,i),Cg.toArray(Cg.add(C0,n,i),P0,0),Cg.toArray(Cg.sub(C0,n,i),P0,3),Cg.toArray(Cg.add(C0,n,a),P0,6),Cg.toArray(Cg.sub(C0,n,a),P0,9),Cg.toArray(Cg.add(C0,n,o),P0,12),Cg.toArray(Cg.sub(C0,n,o),P0,15);var s=_D(P0,E0),u=HE.volume(t),c=Math.cbrt(u)/300*r;dO.addCage(e,T0,s,c,2,20)}(n,i.momentsAxes,t.radiusScale),dO.getMesh(n)}(t,r,n&&n.geometry),a=function(e){return`Principal Axes of ${WJ(e,{countsOnly:!0})}`}(t.locis);return _B.create(a,t,i,function(){return r.color},function(){return 1},function(){return a})}function q0(e,t,r,n){var i=function(e,t,r){var n=dO.createState(256,128,r),i=Az.getPrincipalAxesMany(e.locis);return HE.scale(i.boxAxes,i.boxAxes,t.scaleFactor),n.currentGroup=0,function(e,t,r){var n=t.origin,i=t.dirA,a=t.dirB,o=t.dirC,s=Cg.negate(k0,i),u=Cg.negate(I0,a),c=Cg.negate(D0,o),l=0,d=function(e,t,r){Cg.copy(M0,n),Cg.add(M0,M0,e),Cg.add(M0,M0,t),Cg.add(M0,M0,r),Cg.toArray(M0,R0,l),l+=3};d(i,a,o),d(i,a,c),d(i,u,c),d(i,u,o),d(s,u,c),d(s,u,o),d(s,a,o),d(s,a,c);var f=_D(R0,B0),h=HE.volume(t),p=Math.cbrt(h)/300*r;dO.addCage(e,O0,f,p,2,20)}(n,i.boxAxes,t.radiusScale),dO.getMesh(n)}(t,r,n&&n.geometry),a=function(e){return`Oriented Box of ${WJ(e,{countsOnly:!0})}`}(t.locis);return _B.create(a,t,i,function(){return r.color},function(){return 1},function(){return a})}function W0(e,t,r,n){var i=function(e,t,r){var n=dO.createState(256,128,r),i=Az.getPrincipalAxesMany(e.locis).boxAxes,a=i.origin,o=i.dirA,s=i.dirB,u=HE.size(Cg(),i);Cg.scale(u,u,.5*t.scaleFactor);var c=Cg.create(u[2],u[1],u[0]);return n.currentGroup=0,L0(n,a,o,s,c,2),dO.getMesh(n)}(t,r,n&&n.geometry),a=function(e){return`Oriented Ellipsoid of ${WJ(e,{countsOnly:!0})}`}(t.locis);return _B.create(a,t,i,function(){return r.color},function(){return 1},function(){return a})}var X0={radius:1,segments:36,thetaStart:0,thetaLength:2*Math.PI};function Y0(e){var t,r=Ac(Ac({},X0),e),n=r.radius,i=r.segments,a=r.thetaStart,o=r.thetaLength,s=o===2*Math.PI,u=s?i+1:i+2,c=new Float32Array(3*u),l=new Float32Array(3*u),d=new Uint32Array(3*i);c[0]=0,c[1]=0,c[2]=0,l[0]=0,l[1]=1,l[2]=0;for(var f=0,h=3;f<i;++f,h+=3){var p=a+f/i*o;c[h]=n*Math.sin(p),c[h+1]=0,c[h+2]=n*Math.cos(p),l[h]=0,l[h+1]=1,l[h+2]=0}for(f=1,h=0;f<i;++f,h+=3)d[h]=f,d[h+1]=f+1,d[h+2]=0;return s?(d[t=3*(i-1)]=i,d[t+1]=1,d[t+2]=0):(p=a+o,c[h=3*(i+1)]=n*Math.sin(p),c[h+1]=0,c[h+2]=n*Math.cos(p),l[h]=0,l[h+1]=1,l[h+2]=0,d[t=3*(i-1)]=i,d[t+1]=i+1,d[t+2]=0),{vertices:c,normals:l,indices:d}}var K0={color:Ib.Color(MC.lightgreen),arcScale:Ib.Numeric(.7,{min:.01,max:1,step:.01})},Z0=Ac(Ac(Ac({},qO.Params),K0),{lineSizeAttenuation:Ib.Boolean(!0),linesSize:Ib.Numeric(.04,{min:.01,max:5,step:.01}),dashLength:Ib.Numeric(.04,{min:.01,max:.2,step:.01})}),Q0=Ac({},Z0),J0=Ac({},Z0),e1=Ac(Ac(Ac({},sD.Params),K0),{ignoreLight:Ib.Boolean(!0),sectorOpacity:Ib.Numeric(.75,{min:0,max:1,step:.01})}),t1={vectors:function(e,t){return hJ(c1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},arc:function(e,t){return hJ(l1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},sector:function(e,t){return hJ(d1,sD.Utils,{modifyProps:function(e){return Ac(Ac({},e),{alpha:e.sectorOpacity})},modifyState:function(e){return Ac(Ac({},e),{markerActions:_Q.Highlighting})}})},text:function(e,t){return hJ(f1,UO.Utils,{modifyState:function(e){return Ac(Ac({},e),{markerActions:bQ.None})}})}},r1=Ac(Ac(Ac(Ac(Ac({},Q0),J0),e1),r0),{visuals:Ib.MultiSelect(["vectors","sector","text"],Ib.objectToOptions(t1))}),n1=Cg(),i1=Og();function a1(e,t,r){var n=t.sphereA,i=t.sphereB,a=t.sphereC,o=t.arcDirA,s=t.arcDirC,u=t.arcNormal,c=e.loci,l=c[0],d=c[1],f=c[2];return TQ.getBoundingSphere(l,n),TQ.getBoundingSphere(d,i),TQ.getBoundingSphere(f,a),Cg.sub(o,n.center,i.center),Cg.sub(s,a.center,i.center),Cg.cross(u,o,s),t.radiu
139s=Math.min(Cg.magnitude(o),Cg.magnitude(s))*r,t.angle=Cg.angle(o,s),t}function o1(e,t){var r=e.radius,n=e.angle,i=t?Dg(n,r)/t:32;return Og.targetTo(i1,e.sphereB.center,e.sphereA.center,e.arcNormal),Og.setTranslation(i1,e.sphereB.center),Og.mul(i1,i1,Og.rotY180),bD(Y0({radius:r,thetaLength:n,segments:i}),i1)}var s1={sphereA:XE(),sphereB:XE(),sphereC:XE(),arcDirA:Cg(),arcDirC:Cg(),arcNormal:Cg(),radius:0,angle:0};function u1(e){return 1===e.triples.length?`Angle ${JJ(e.triples[0],{measureOnly:!0})}`:`${e.triples.length} Angles`}function c1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.triples.length;i<a;++i)a1(e.triples[i],s1,t.arcScale),n.addFixedLengthDashes(s1.sphereB.center,s1.sphereA.center,t.dashLength,i),n.addFixedLengthDashes(s1.sphereB.center,s1.sphereC.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=u1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function l1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.triples.length;i<a;++i){a1(e.triples[i],s1,t.arcScale);for(var o=o1(s1,t.dashLength),s=o.indices,u=o.vertices,c=0,l=s.length;c<l;c+=3)if(c%2!=1){var d=3*s[c],f=3*s[c+1],h=u[d],p=u[d+1],m=u[d+2],g=u[f],v=u[f+1],y=u[f+2];n.add(h,p,m,g,v,y,i)}}return n.getLines()}(t,r,n&&n.geometry),a=u1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function d1(e,t,r,n){var i=function(e,t,r){for(var n=dO.createState(128,64,r),i=0,a=e.triples.length;i<a;++i){a1(e.triples[i],s1,t.arcScale);var o=o1(s1);n.currentGroup=i,dO.addPrimitive(n,Og.id,o),dO.addPrimitiveFlipped(n,Og.id,o)}return dO.getMesh(n)}(t,r,n&&n.geometry),a=u1(t);return _B.create(a,t,i,function(){return r.color},function(){return 1},function(e){return JJ(t.triples[e])})}function f1(e,t,r,n){var i=function(e,t,r){for(var n=FJ.create(t,128,64,r),i=0,a=e.triples.length;i<a;++i){a1(e.triples[i],s1,t.arcScale),Cg.add(n1,s1.arcDirA,s1.arcDirC),Cg.setMagnitude(n1,n1,s1.radius),Cg.add(n1,s1.sphereB.center,n1);var o=kg(s1.angle).toFixed(2),s=t.customText||`${o}
139°`,u=Math.max(2,s1.sphereA.radius,s1.sphereB.radius,s1.sphereC.radius)/2;n.add(s,n1[0],n1[1],n1[2],.1,u,i)}return n.getText()}(t,r,n&&n.geometry),a=u1(t);return _B.create(a,t,i,function(){return r.textColor},function(){return r.textSize},function(e){return JJ(t.triples[e])})}var h1={color:Ib.Color(MC.lightgreen),arcScale:Ib.Numeric(.7,{min:.01,max:1,step:.01})},p1=Ac(Ac(Ac({},qO.Params),h1),{lineSizeAttenuation:Ib.Boolean(!0),linesSize:Ib.Numeric(.04,{min:.01,max:5,step:.01}),dashLength:Ib.Numeric(.04,{min:.01,max:.2,step:.01})}),m1=Ac({},p1),g1=Ac({},p1),v1=Ac({},p1),y1=Ac({},p1),b1=Ac(Ac(Ac({},sD.Params),h1),{ignoreLight:Ib.Boolean(!0),sectorOpacity:Ib.Numeric(.75,{min:0,max:1,step:.01})}),_1={vectors:function(e,t){return hJ(E1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},extenders:function(e,t){return hJ(I1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},connector:function(e,t){return hJ(M1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},arms:function(e,t){return hJ(k1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},arc:function(e,t){return hJ(D1,qO.Utils,{modifyState:function(e){return Ac(Ac({},e),{pickable:!1})}})},sector:function(e,t){return hJ(O1,sD.Utils,{modifyProps:function(e){return Ac(Ac({},e),{alpha:e.sectorOpacity})},modifyState:function(e){return Ac(Ac({},e),{markerActions:_Q.Highlighting})}})},text:function(e,t){return hJ(R1,UO.Utils,{modifyState:function(e){return Ac(Ac({},e),{markerActions:bQ.None})}})}},x1=Ac(Ac(Ac(Ac(Ac(Ac(Ac({},m1),g1),v1),y1),b1),r0),{visuals:Ib.MultiSelect(["extenders","arms","sector","text"],Ib.objectToOptions(_1))}),S1=Cg(),w1=Og();function A1(e,t,r){var n=t.sphereA,i=t.sphereB,a=t.sphereC,o=t.sphereD,s=t.dirBA,u=t.dirCD,c=t.projA,l=t.projD,d=t.arcPointA,f=t.arcPointD,h=t.arcDirA,p=t.arcDirD,m=t.arcCenter,g=t.arcNormal,v=e.loci,y=v[0],b=v[1],_=v[2],x=v[3];TQ.getBoundingSphere(y,n),TQ.getBoundingSphere(b,i),TQ.getBoundingSphere(_,a),TQ.getBoundingSphere(x,o),Cg.add(m,i.center,a.center),Cg.scale(m,m,.5),Cg.sub(s,n.center,i.center),Cg.sub(u,o.center,a.center),Cg.add(d,m,s),Cg.add(f,m,u),Cg.sub(g,a.center,i.center),Cg.orthogonalize(h,g,s),Cg.orthogonalize(p,g,u),Cg.projectPointOnVector(c,d,h,m),Cg.projectPointOnVector(l,f,p,m);var S=Math.min(Cg.distance(c,m),Cg.distance(l,m))*r;Cg.setMagnitude(h,h,S),Cg.setMagnitude(p,p,S),Cg.add(d,m,h),Cg.add(f,m,p),t.radius=S,t.angle=Cg.dihedralAngle(n.center,i.center,a.center,o.center),Cg.matchDirection(S1,g,Cg.sub(S1,d,n.center));var w=Cg.angle(s,S1),A=S/Math.cos(w-Pg);Cg.add(c,i.center,Cg.setMagnitude(S1,s,A)),Cg.matchDirection(S1,g,Cg.sub(S1,f,o.center));var C=Cg.angle(u,S1),T=S/Math.cos(C-Pg);return Cg.add(l,a.center,Cg.setMagnitude(S1,u,T)),t}function C1(e,t){var r=e.radius,n=e.angle,i=t?Dg(n,r)/t:32;return Og.targetTo(w1,e.arcCenter,n<0?e.arcPointD:e.arcPointA,e.arcNormal),Og.setTranslation(w1,e.arcCenter),Og.mul(w1,w1,Og.rotY180),bD(Y0({radius:r,thetaLength:Math.abs(n),segments:i}),w1)}var T1={sphereA:XE(),sphereB:XE(),sphereC:XE(),sphereD:XE(),dirBA:Cg(),dirCD:Cg(),projA:Cg(),projD:Cg(),arcPointA:Cg(),arcPointD:Cg(),arcDirA:Cg(),arcDirD:Cg(),arcCenter:Cg(),arcNormal:Cg(),radius:0,angle:0};function P1(e){return 1===e.quads.length?`Dihedral ${e0(e.quads[0],{measureOnly:!0})}`:`${e.quads.length} Dihedrals`}function E1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.quads.length;i<a;++i)A1(e.quads[i],T1,t.arcScale),n.addFixedLengthDashes(T1.arcCenter,T1.arcPointA,t.dashLength,i),n.addFixedLengthDashes(T1.arcCenter,T1.arcPointD,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function M1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.quads.length;i<a;++i)A1(e.quads[i],T1,t.arcScale),n.addFixedLengthDashes(T1.sphereB.center,T1.sphereC.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function k1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.quads.length;i<a;++i)A1(e.quads[i],T1,t.arcScale),n.addFixedLengthDashes(T1.sphereB.center,T1.sphereA.center,t.dashLength,i),n.addFixedLengthDashes(T1.sphereC.center,T1.sphereD.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function I1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.quads.length;i<a;++i)A1(e.quads[i],T1,t.arcScale),n.addFixedLengthDashes(T1.arcPointA,T1.projA,t.dashLength,i),n.addFixedLengthDashes(T1.arcPointD,T1.projD,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function D1(e,t,r,n){var i=function(e,t,r){for(var n=HO.create(128,64,r),i=0,a=e.quads.length;i<a;++i){A1(e.quads[i],T1,t.arcScale);for(var o=C1(T1,t.dashLength),s=o.indices,u=o.vertices,c=0,l=s.length;c<l;c+=3)if(c%2!=1){var d=3*s[c],f=3*s[c+1],h=u[d],p=u[d+1],m=u[d+2],g=u[f],v=u[f+1],y=u[f+2];n.add(h,p,m,g,v,y,i)}}return n.getLines()}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.color},function(){return r.linesSize},function(){return""})}function O1(e,t,r,n){var i=function(e,t,r){for(var n=dO.createState(128,64,r),i=0,a=e.quads.length;i<a;++i){A1(e.quads[i],T1,t.arcScale);var o=C1(T1);n.currentGroup=i,dO.addPrimitive(n,Og.id,o),dO.addPrimitiveFlipped(n,Og.id,o)}return dO.getMesh(n)}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.color},function(){return 1},function(e){return e0(t.quads[e])})}function R1(e,t,r,n){var i=function(e,t,r){for(var n=FJ.create(t,128,64,r),i=0,a=e.quads.length;i<a;++i){A1(e.quads[i],T1,t.arcScale),Cg.add(S1,T1.arcDirA,T1.arcDirD),Cg.setMagnitude(S1,S1,T1.radius),Cg.add(S1,T1.arcCenter,S1);var o=kg(T1.angle).toFixed(2);"-0.00"===o&&(o="0.00");var s=t.customText||`${o}°`,u=Math.max(2,T1.sphereA.radius,T1.sphereB.radius,T1.sphereC.radius,T1.sphereD.radius)/2;n.add(s,S1[0],S1[1],S1[2],.1,u,i)}return n.getText()}(t,r,n&&n.geometry),a=P1(t);return _B.create(a,t,i,function(){return r.textColor},function(){return r.textSize},function(e){return e0(t.quads[e])})}var B1=OS.BuiltIn({name:"box-shape-3d",display:"Box Shape",from:DS.Root,to:DS.Shape.Provider,params:{bottomLeft:Ib.Vec3(Cg()),topRight:Ib.Vec3(Cg.create(1,1,1)),radius:Ib.Numeric(.15,{min:.01,max:4,step:.01}),color:Ib.Color(MC.red)}})({canAutoUpdate:function(){return!0},apply:function(e){var t=this,r=e.params;return vy.create("Shape Representation",function(e){return Tc(t,void 0,void 0,function(){return Pc(this,function(e){return[2,new DS.Shape.Provider({label:"Box",data:r,params:sD.Params,getShape:function(e,t){var n=N1(YE.create(r.bottomLeft,r.topRight),r.radius);return _B.create("Box",t,n,function(){return t.color},function(){return 1},function(){return"Box"})},geometryUtils:sD.Utils},{label:"Box"})]})})})}});function N1(e,t,r){var n=Cg.sub(Cg(),e.max,e.min),i=Og.fromTranslation(Og(),Cg.create(.5,.5,.5)),a=Og.fromScaling(Og(),n),o=Og.fromTranslation(Og(),e.min),s=Og.mul3(Og(),o,a,i),u=dO.createState(256,128,r);u.currentGroup=1,dO.addCage(u,s,cR(),t,2,20);
139var c=dO.getMesh(u),l=Cg.scaleAndAdd(Cg(),e.min,n,.5),d=Cg.distance(e.min,l);return c.setBoundingSphere(XE.create(l,d)),c}var F1=Object.freeze({__proto__:null,BoxShape3D:B1,getBoxMesh:N1}),L1={vertices:new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),normals:new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]),indices:new Uint32Array([0,2,1,1,2,3])};new Uint32Array([0,1,2,3,3,1,2,0]);var $1=Ac(Ac({},sD.Params),{color:Ib.Color(MC.orange),scaleFactor:Ib.Numeric(1,{min:.1,max:10,step:.1})}),U1={plane:function(e,t){return hJ(V1,sD.Utils)}},j1=Ac(Ac({},$1),{visuals:Ib.MultiSelect(["plane"],Ib.objectToOptions(U1))}),z1=Og(),G1=Cg();function V1(e,t,r,n){var i=function(e,t,r){var n=dO.createState(256,128,r),i=Az.getPrincipalAxesMany(e.locis).boxAxes,a=L1;return Cg.add(G1,i.origin,i.dirC),Og.targetTo(z1,G1,i.origin,i.dirB),Og.scale(z1,z1,HE.size(G1,i)),Og.scaleUniformly(z1,z1,t.scaleFactor),Og.setTranslation(z1,i.origin),n.currentGroup=0,dO.addPrimitive(n,z1,a),dO.addPrimitiveFlipped(n,z1,a),dO.getMesh(n)}(t,r,n&&n.geometry),a=function(e){return`Best Fit Plane of ${WJ(e,{countsOnly:!0})}`}(t.locis);return _B.create(a,t,i,function(){return r.color},function(){return 1},function(){return a})}var H1,q1=OS.BuiltIn({name:"structure-representation-3d",display:"3D Representation",from:DS.Molecule.Structure,to:DS.Molecule.Structure.Representation3D,params:function(e,t){var r=t.representation.structure,n=r.registry,i=r.themes,a=n.get(n.default.name);if(!e)return{type:Ib.Mapped(n.default.name,n.types,function(e){return Ib.Group(n.get(e).getParams(i,yz.Empty))}),colorTheme:Ib.Mapped(a.defaultColorTheme.name,i.colorThemeRegistry.types,function(e){return Ib.Group(i.colorThemeRegistry.get(e).getParams({structure:yz.Empty}))},{help:function(e){var t=e.name,r=e.params,n=i.colorThemeRegistry.get(t).factory({},r);return{description:n.description,legend:n.legend}}}),sizeTheme:Ib.Mapped(a.defaultSizeTheme.name,i.sizeThemeRegistry.types,function(e){return Ib.Group(i.sizeThemeRegistry.get(e).getParams({structure:yz.Empty}))})};var o={structure:e.data};return{type:Ib.Mapped(n.default.name,n.getApplicableTypes(e.data),function(t){return Ib.Group(n.get(t).getParams(i,e.data))}),colorTheme:Ib.Mapped(a.defaultColorTheme.name,i.colorThemeRegistry.getApplicableTypes(o),function(e){return Ib.Group(i.colorThemeRegistry.get(e).getParams(o))},{help:function(e){var t=e.name,r=e.params,n=i.colorThemeRegistry.get(t).factory(o,r);return{description:n.description,legend:n.legend}}}),sizeTheme:Ib.Mapped(a.defaultSizeTheme.name,i.sizeThemeRegistry.getApplicableTypes(o),function(e){return Ib.Group(i.sizeThemeRegistry.get(e).getParams(o))})}}})({canAutoUpdate:function(e){var t=e.a,r=e.oldParams,n=e.newParams;return t.data.elementCount<1e4||r.type.name===n.type.name&&"custom"!==n.type.params.quality},apply:function(e,t){var r=this,n=e.a,i=e.params;return e.cache,vy.create("Structure Representation",function(e){return Tc(r,void 0,void 0,function(){var r,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return r={runtime:e,assetManager:t.managers.asset},a=t.representation.structure.registry.get(i.type.name),o=a.getData?.call(a,n.data,i.type.params)||n.data,a.ensureCustomProperties?[4,a.ensureCustomProperties.attach(r,o)]:[3,2];case 1:c.sent(),c.label=2;case 2:return s=a.factory(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes),a.getParams),[4,gQ.ensureDependencies(r,t.representation.structure.themes,{structure:o},i)];case 3:return c.sent(),s.setTheme(gQ.create(t.representation.structure.themes,{structure:o},i)),u=i.type.params||{},[4,s.createOrUpdate(u,o).runInContext(e)];case 4:return c.sent(),[2,new DS.Molecule.Structure.Representation3D({repr:s,sourceData:n.data},{label:a.label})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b,a=e.oldParams,o=e.newParams;return e.cache,vy.create("Structure Representation",function(e){return Tc(r,void 0,void 0,function(){var r,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return o.type.name===a.type.name?(r=t.representation.structure.registry.get(o.type.name),r.mustRecreate?.call(r,a.type.params,o.type.params)?[2,Ob.UpdateResult.Recreate]:(s=r.getData?.call(r,n.data,o.type.params)||n.data,u={runtime:e,assetManager:t.managers.asset},r.ensureCustomProperties?[4,r.ensureCustomProperties.attach(u,s)]:[3,2])):[2,Ob.UpdateResult.Recreate];case 1:l.sent(),l.label=2;case 2:return gQ.releaseDependencies(t.representation.structure.themes,{structure:i.data.sourceData},a),[4,gQ.ensureDependencies(u,t.representation.structure.themes,{structure:s},o)];case 3:return l.sent(),i.data.repr.setTheme(gQ.create(t.representation.structure.themes,{structure:s},o)),c=Ac(Ac({},i.data.repr.props),o.type.params),[4,i.data.repr.createOrUpdate(c,s).runInContext(e)];case 4:return l.sent(),i.data.sourceData=n.data,[2,Ob.UpdateResult.Updated]}})})})},dispose:function(e,t){var r=e.b,n=e.params;if(r&&n){var i=r.data.sourceData,a=t.representation.structure.registry.get(n.type.name);a.ensureCustomProperties&&a.ensureCustomProperties.detach(i),gQ.releaseDependencies(t.representation.structure.themes,{structure:i},n)}},interpolate:function(e,t,r){if("uniform"!==e.colorTheme.name||"uniform"!==t.colorTheme.name)return r<=.5?e:t;var n=e.colorTheme.params.value,i=t.colorTheme.params.value,a=tv.interpolate(n,i,r);return{type:r<=.5?e.type:t.type,colorTheme:{name:"uniform",params:{value:a}},sizeTheme:r<=.5?e.sizeTheme:t.sizeTheme}}}),W1=OS.BuiltIn({name:"unwind-structure-assembly-representation-3d",display:"Unwind Assembly 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:{t:Ib.Numeric(0,{min:0,max:1,step:.
13901})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=new mJ(n);return vJ(n,i,r.t),new DS.Molecule.Structure.Representation3DState({state:{unitTransforms:i},initialState:{unitTransforms:new mJ(n)},info:n,repr:t.data.repr},{label:`Unwind T = ${r.t.toFixed(2)}`})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=e.oldParams,a=r.data.info;return t.data.sourceData!==a||t.data.repr!==r.data.repr?Ob.UpdateResult.Recreate:i.t===n.t?Ob.UpdateResult.Unchanged:(vJ(a,r.data.state.unitTransforms,n.t),r.label=`Unwind T = ${n.t.toFixed(2)}`,r.data.repr=t.data.repr,Ob.UpdateResult.Updated)}}),X1=OS.BuiltIn({name:"explode-structure-representation-3d",display:"Explode 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:{t:Ib.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=new mJ(n);return xJ(n,i,r.t,n.root.boundary.sphere),new DS.Molecule.Structure.Representation3DState({state:{unitTransforms:i},initialState:{unitTransforms:new mJ(n)},info:n,repr:t.data.repr},{label:`Explode T = ${r.t.toFixed(2)}`})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=e.oldParams,a=t.data.sourceData;return r.data.info!==a||t.data.repr!==r.data.repr?Ob.UpdateResult.Recreate:i.t===n.t?Ob.UpdateResult.Unchanged:(xJ(a,r.data.state.unitTransforms,n.t,a.root.boundary.sphere),r.label=`Explode T = ${n.t.toFixed(2)}`,r.data.repr=t.data.repr,Ob.UpdateResult.Updated)}}),Y1=OS.BuiltIn({name:"spin-structure-representation-3d",display:"Spin 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:Ac({t:Ib.Numeric(0,{min:0,max:1,step:.01})},SJ)})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=new mJ(n),a=wJ(n.root,r),o=a.axis,s=a.origin;return PJ(n,i,r.t,o,s),new DS.Molecule.Structure.Representation3DState({state:{unitTransforms:i},initialState:{unitTransforms:new mJ(n)},info:n,repr:t.data.repr},{label:`Spin T = ${r.t.toFixed(2)}`})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=e.oldParams,a=t.data.sourceData;if(r.data.info!==a||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;if(i.t===n.t&&i.axis===n.axis&&i.origin===n.origin)return Ob.UpdateResult.Unchanged;var o=r.data.state.unitTransforms,s=wJ(a.root,n),u=s.axis,c=s.origin;return PJ(a,o,n.t,u,c),r.label=`Spin T = ${n.t.toFixed(2)}`,r.data.repr=t.data.repr,Ob.UpdateResult.Updated}}),K1=OS.BuiltIn({name:"overpaint-structure-representation-3d-from-script",display:"Overpaint 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({script:Ib.Script(mq("(sel.atom.all)","mol-script")),color:Ib.Color(MC.blueviolet),clear:Ib.Boolean(!1)},function(e){return`${e.clear?"Clear":tv.toRgbString(e.color)}`},{defaultValue:[{script:mq("(sel.atom.all)","mol-script"),color:MC.blueviolet,clear:!1}]})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=t.data.repr.geometryVersion,a=DQ.ofScript(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{overpaint:a},initialState:{overpaint:DQ.Empty},info:{structure:n,geometryVersion:i},repr:t.data.repr},{label:`Overpaint (${a.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info,a=t.data.sourceData;if(a!==i.structure||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var o=t.data.repr.geometryVersion;if(o!==i.geometryVersion&&KI(t.data.repr.props))return Ob.UpdateResult.Recreate;var s=r.data.state.overpaint,u=DQ.ofScript(n.layers,a);return DQ.areEqual(s,u)?Ob.UpdateResult.Unchanged:(i.geometryVersion=o,r.data.state.overpaint=u,r.data.repr=t.data.repr,r.label=`Overpaint (${u.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),Z1=OS.BuiltIn({name:"overpaint-structure-representation-3d-from-bundle",display:"Overpaint 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({bundle:Ib.Value(sU.Empty),color:Ib.Color(MC.blueviolet),clear:Ib.Boolean(!1)},function(e){return`${e.clear?"Clear":tv.toRgbString(e.color)}`},{defaultValue:[{bundle:sU.Empty,color:MC.blueviolet,clear:!1}],isHidden:!0})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=t.data.repr.geometryVersion,a=DQ.ofBundle(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{overpaint:a},initialState:{overpaint:DQ.Empty},info:{structure:n,geometryVersion:i},repr:t.data.repr},{label:`Overpaint (${a.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info,a=t.data.sourceData;if(a!==i.structure||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var o=t.data.repr.geometryVersion;if(o!==i.geometryVersion&&KI(t.data.repr.props))return Ob.UpdateResult.Recreate;
139var s=r.data.state.overpaint,u=DQ.ofBundle(n.layers,a);return DQ.areEqual(s,u)?Ob.UpdateResult.Unchanged:(i.geometryVersion=o,r.data.state.overpaint=u,r.data.repr=t.data.repr,r.label=`Overpaint (${u.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),Q1=OS.BuiltIn({name:"transparency-structure-representation-3d-from-script",display:"Transparency 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({script:Ib.Script(mq("(sel.atom.all)","mol-script")),value:Ib.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},function(e){return`Transparency (${e.value})`},{defaultValue:[{script:mq("(sel.atom.all)","mol-script"),value:.5}]})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=t.data.repr.geometryVersion,a=OQ.ofScript(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{transparency:a},initialState:{transparency:OQ.Empty},info:{structure:n,geometryVersion:i},repr:t.data.repr},{label:`Transparency (${a.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info,a=t.data.sourceData;if(a!==i.structure||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var o=t.data.repr.geometryVersion;if(o!==i.geometryVersion&&KI(t.data.repr.props))return Ob.UpdateResult.Recreate;var s=r.data.state.transparency,u=OQ.ofScript(n.layers,a);return OQ.areEqual(s,u)?Ob.UpdateResult.Unchanged:(i.geometryVersion=o,r.data.state.transparency=u,r.data.repr=t.data.repr,r.label=`Transparency (${u.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),J1=OS.BuiltIn({name:"transparency-structure-representation-3d-from-bundle",display:"Transparency 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({bundle:Ib.Value(sU.Empty),value:Ib.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},function(e){return`Transparency (${e.value})`},{defaultValue:[{bundle:sU.Empty,value:.5}],isHidden:!0})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=t.data.repr.geometryVersion,a=OQ.ofBundle(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{transparency:a},initialState:{transparency:OQ.Empty},info:{structure:n,geometryVersion:i},repr:t.data.repr},{label:`Transparency (${a.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info,a=t.data.sourceData;if(a!==i.structure||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var o=t.data.repr.geometryVersion;if(o!==i.geometryVersion&&KI(t.data.repr.props))return Ob.UpdateResult.Recreate;var s=r.data.state.transparency,u=OQ.ofBundle(n.layers,a);return OQ.areEqual(s,u)?Ob.UpdateResult.Unchanged:(i.geometryVersion=o,r.data.state.transparency=u,r.data.repr=t.data.repr,r.label=`Transparency (${u.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),e2=OS.BuiltIn({name:"substance-structure-representation-3d-from-script",display:"Substance 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({script:Ib.Script(mq("(sel.atom.all)","mol-script")),material:VI.getParam(),clear:Ib.Boolean(!1)},function(e){return`${e.clear?"Clear":VI.toString(e.material)}`},{defaultValue:[{script:mq("(sel.atom.all)","mol-script"),material:VI({roughness:1}),clear:!1}]})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=t.data.repr.geometryVersion,a=uJ.ofScript(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{substance:a},initialState:{substance:uJ.Empty},info:{structure:n,geometryVersion:i},repr:t.data.repr},{label:`Substance (${a.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info,a=t.data.sourceData;if(a!==i.structure||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var o=t.data.repr.geometryVersion;if(o!==i.geometryVersion&&KI(t.data.repr.props))return Ob.UpdateResult.Recreate;var s=r.data.state.substance,u=uJ.ofScript(n.layers,a);return uJ.areEqual(s,u)?Ob.UpdateResult.Unchanged:(i.geometryVersion=o,r.data.state.substance=u,r.data.repr=t.data.repr,r.label=`Substance (${u.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),t2=OS.BuiltIn({name:"substance-structure-representation-3d-from-bundle",display:"Substance 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({bundle:Ib.Value(sU.Empty),material:VI.getParam(),clear:Ib.Boolean(!1)},function(e){return`${e.clear?"Clear":VI.toString(e.material)}`},{defaultValue:[{bundle:sU.Empty,material:VI({roughness:1}),clear:!1}],isHidden:!0})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=t.data.repr.geometryVersion,a=uJ.ofBundle(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{substance:a},initialState:{substance:uJ.Empty},info:{structure:n,geometryVersion:i},repr:t.data.repr},{label:`Substance (${a.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info,a=t.data.sourceData;if(a!==i.structure||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var o=t.data.repr.geometryVersion;if(o!==i.geometryVersion&&KI(t.data.repr.props))return Ob.UpdateResult.Recreate;var s=r.data.state.substance,u=uJ.ofBundle(n.layers,a);return uJ.areEqual(s,u)?Ob.UpdateResult.Unchanged:(i.geometryVersion=o,r.data.state.substance=u,r.data.repr=t.data.repr,r.label=`Substance (${u.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),r2=OS.BuiltIn({name:"clipping-structure-representation-3d-from-script",display:"Clipping 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({script:Ib.Script(mq("(sel.atom.all)","mol-script")),groups:Ib.Converted(function(e){return sJ.Groups.toNames(e)}
139,function(e){return sJ.Groups.fromNames(e)},Ib.MultiSelect(Fg(sJ.Groups.Names),Ib.objectToOptions(sJ.Groups.Names)))},function(e){return`${sJ.Groups.toNames(e.groups).length} group(s)`},{defaultValue:[{script:mq("(sel.atom.all)","mol-script"),groups:sJ.Groups.Flag.None}]})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=sJ.ofScript(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{clipping:i},initialState:{clipping:sJ.Empty},info:n,repr:t.data.repr},{label:`Clipping (${i.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info;if(t.data.sourceData!==i||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var a=r.data.state.clipping,o=sJ.ofScript(n.layers,i);return sJ.areEqual(a,o)?Ob.UpdateResult.Unchanged:(r.data.state.clipping=o,r.data.repr=t.data.repr,r.label=`Clipping (${o.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),n2=OS.BuiltIn({name:"clipping-structure-representation-3d-from-bundle",display:"Clipping 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{layers:Ib.ObjectList({bundle:Ib.Value(sU.Empty),groups:Ib.Converted(function(e){return sJ.Groups.toNames(e)},function(e){return sJ.Groups.fromNames(e)},Ib.MultiSelect(Fg(sJ.Groups.Names),Ib.objectToOptions(sJ.Groups.Names)))},function(e){return`${sJ.Groups.toNames(e.groups).length} group(s)`},{defaultValue:[{bundle:sU.Empty,groups:sJ.Groups.Flag.None}],isHidden:!0})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.sourceData,i=sJ.ofBundle(r.layers,n);return new DS.Molecule.Structure.Representation3DState({state:{clipping:i},initialState:{clipping:sJ.Empty},info:n,repr:t.data.repr},{label:`Clipping (${i.layers.length} Layers)`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;e.oldParams;var i=r.data.info;if(t.data.sourceData!==i||t.data.repr!==r.data.repr)return Ob.UpdateResult.Recreate;var a=r.data.state.clipping,o=sJ.ofBundle(n.layers,i);return sJ.areEqual(a,o)?Ob.UpdateResult.Unchanged:(r.data.state.clipping=o,r.data.repr=t.data.repr,r.label=`Clipping (${o.layers.length} Layers)`,Ob.UpdateResult.Updated)}}),i2=OS.BuiltIn({name:"theme-strength-representation-3d",display:"Theme Strength 3D Representation",from:DS.Molecule.Structure.Representation3D,to:DS.Molecule.Structure.Representation3DState,params:function(){return{overpaintStrength:Ib.Numeric(1,{min:0,max:1,step:.01}),transparencyStrength:Ib.Numeric(1,{min:0,max:1,step:.01}),substanceStrength:Ib.Numeric(1,{min:0,max:1,step:.01})}}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params;return new DS.Molecule.Structure.Representation3DState({state:{themeStrength:{overpaint:r.overpaintStrength,transparency:r.transparencyStrength,substance:r.substanceStrength}},initialState:{themeStrength:{overpaint:1,transparency:1,substance:1}},info:{},repr:t.data.repr},{label:"Theme Strength",description:`${r.overpaintStrength.toFixed(2)}, ${r.transparencyStrength.toFixed(2)}, ${r.substanceStrength.toFixed(2)}`})},update:function(e){var t=e.a,r=e.b,n=e.newParams;return e.oldParams,n.overpaintStrength===r.data.state.themeStrength?.overpaint&&n.transparencyStrength===r.data.state.themeStrength?.transparency&&n.substanceStrength===r.data.state.themeStrength?.substance?Ob.UpdateResult.Unchanged:(r.data.state.themeStrength={overpaint:n.overpaintStrength,transparency:n.transparencyStrength,substance:n.substanceStrength},r.data.repr=t.data.repr,r.label="Theme Strength",r.description=`${n.overpaintStrength.toFixed(2)}, ${n.transparencyStrength.toFixed(2)}, ${n.substanceStrength.toFixed(2)}`,Ob.UpdateResult.Updated)},interpolate:function(e,t,r){return{overpaintStrength:_g(e.overpaintStrength,t.overpaintStrength,r),transparencyStrength:_g(e.transparencyStrength,t.transparencyStrength,r),substanceStrength:_g(e.substanceStrength,t.substanceStrength,r)}}});!function(e){e.getDefaultParams=function(e,t,r,n,i,a,o,s){var u=e.representation.volume.registry.get(t),c=e.representation.volume.themes.colorThemeRegistry.get(i||u.defaultColorTheme.name),l=e.representation.volume.themes.sizeThemeRegistry.get(o||u.defaultSizeTheme.name),d=Ib.getDefaultValues(u.getParams(e.representation.volume.themes,r));return{type:{name:t,params:n?Ac(Ac({},d),n):d},colorTheme:{name:c.name,params:a?Ac(Ac({},c.defaultValues),a):c.defaultValues},sizeTheme:{name:l.name,params:s?Ac(Ac({},l.defaultValues),s):l.defaultValues}}},e.getDefaultParamsStatic=function(e,t,r,n,i,a,o){var s=e.representation.volume.registry.get(t),u=e.representation.volume.themes.colorThemeRegistry.get(n||s.defaultColorTheme.name),c=e.representation.volume.themes.sizeThemeRegistry.get(a||s.defaultSizeTheme.name);return{type:{name:t,params:r?Ac(Ac({},s.defaultValues),r):s.defaultValues},colorTheme:{name:s.defaultColorTheme.name,params:i?Ac(Ac({},u.defaultValues),i):u.defaultValues},sizeTheme:{name:s.defaultSizeTheme.name,params:o?Ac(Ac({},c.defaultValues),o):c.defaultValues}}},e.getDescription=function(e){return e.isoValue?gR.IsoValue.toString(e.isoValue):e.renderMode?.params?.isoValue?gR.IsoValue.toString(e.renderMode?.params?.isoValue):void 0}}(H1||={});var a2=OS.BuiltIn({name:"volume-representation-3d",display:"3D Representation",from:DS.Volume.Data,to:DS.Volume.Representation3D,params:function(e,t){var r=t.representation.volume,n=r.registry,i=r.themes,a=n.get(n.default.name);if(!e)return{type:Ib.Mapped(n.default.name,n.types,function(e){return Ib.Group(n.get(e).getParams(i,gR.One))}),colorTheme:Ib.Mapped(a.defaultColorTheme.name,i.colorThemeRegistry.types,function(e){return Ib.Group(i.colorThemeRegistry.get(e).getParams({volume:gR.One}))}
139),sizeTheme:Ib.Mapped(a.defaultSizeTheme.name,i.sizeThemeRegistry.types,function(e){return Ib.Group(i.sizeThemeRegistry.get(e).getParams({volume:gR.One}))})};var o={volume:e.data};return{type:Ib.Mapped(n.default.name,n.types,function(t){return Ib.Group(n.get(t).getParams(i,e.data))}),colorTheme:Ib.Mapped(a.defaultColorTheme.name,i.colorThemeRegistry.getApplicableTypes(o),function(e){return Ib.Group(i.colorThemeRegistry.get(e).getParams(o))}),sizeTheme:Ib.Mapped(a.defaultSizeTheme.name,i.sizeThemeRegistry.getApplicableTypes(o),function(e){return Ib.Group(i.sizeThemeRegistry.get(e).getParams(o))})}}})({canAutoUpdate:function(e){var t=e.oldParams,r=e.newParams;return t.type.name===r.type.name},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Volume Representation",function(e){return Tc(r,void 0,void 0,function(){var r,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return r={runtime:e,assetManager:t.managers.asset},(a=t.representation.volume.registry.get(i.type.name)).ensureCustomProperties?[4,a.ensureCustomProperties.attach(r,n.data)]:[3,2];case 1:u.sent(),u.label=2;case 2:return(o=a.factory(Ac({webgl:t.canvas3d?.webgl},t.representation.volume.themes),a.getParams)).setTheme(gQ.create(t.representation.volume.themes,{volume:n.data},i)),s=i.type.params||{},[4,o.createOrUpdate(s,n.data).runInContext(e)];case 3:return u.sent(),[2,new DS.Volume.Representation3D({repr:o,sourceData:n.data},{label:a.label,description:H1.getDescription(s)})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b,a=e.oldParams,o=e.newParams;return vy.create("Volume Representation",function(e){return Tc(r,void 0,void 0,function(){var r,s,u;return Pc(this,function(c){switch(c.label){case 0:return o.type.name===a.type.name?(s=Ac(Ac({},i.data.repr.props),o.type.params),i.data.repr.setTheme(gQ.create(t.representation.volume.themes,{volume:n.data},o)),[4,i.data.repr.createOrUpdate(s,n.data).runInContext(e)]):(r=t.representation.volume.registry.get(a.type.name),null==(u=r.ensureCustomProperties)||u.detach(n.data),[2,Ob.UpdateResult.Recreate]);case 1:return c.sent(),i.data.sourceData=n.data,i.description=H1.getDescription(s),[2,Ob.UpdateResult.Updated]}})})})}}),o2=OS.BuiltIn({name:"shape-representation-3d",display:"3D Representation",from:DS.Shape.Provider,to:DS.Shape.Representation3D,params:function(e,t){return e?e.data.params:qI.Params}})({canAutoUpdate:function(){return!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Shape Representation",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(a){switch(a.label){case 0:return t=Ac(Ac({},Ib.getDefaultValues(n.data.params)),i),[4,(r=hJ(n.data.getShape,n.data.geometryUtils)).createOrUpdate(t,n.data.data).runInContext(e)];case 1:return a.sent(),[2,new DS.Shape.Representation3D({repr:r,sourceData:n.data},{label:n.data.label})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Shape Representation",function(e){return Tc(r,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),[4,i.data.repr.createOrUpdate(t,n.data.data).runInContext(e)];case 1:return r.sent(),i.data.sourceData=n.data,[2,Ob.UpdateResult.Updated]}})})})}}),s2=OS.BuiltIn({name:"model-unitcell-3d",display:"Model Unit Cell",from:DS.Molecule.Model,to:DS.Shape.Representation3D,params:function(){return Ac({},RJ)}})({isApplicable:function(e){return!!Dz.Provider.get(e.data)},canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Model Unit Cell",function(e){return Tc(r,void 0,void 0,function(){var r,a,o;return Pc(this,function(s){switch(s.label){case 0:return(r=Dz.Provider.get(n.data))?(a=NJ(n.data,r,i),o=function(e){return dJ.createMulti("Unit Cell",e,function(){return RJ},dJ.StateBuilder,OJ)}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,o.createOrUpdate(i,a).runInContext(e)]):[2,of.Null];case 1:return s.sent(),[2,new DS.Shape.Representation3D({repr:o,sourceData:a},{label:"Unit Cell",description:r.spacegroup.name})]}})})})},update:function(e){var t=this,r=e.a,n=e.b,i=e.newParams;return vy.create("Model Unit Cell",function(e){return Tc(t,void 0,void 0,function(){var t,a,o;return Pc(this,function(s){switch(s.label){case 0:return(t=Dz.Provider.get(r.data))?(a=Ac(Ac({},n.data.repr.props),i),o=NJ(r.data,t,a),[4,n.data.repr.createOrUpdate(a,o).runInContext(e)]):[2,Ob.UpdateResult.Null];case 1:return s.sent(),n.data.sourceData=o,[2,Ob.UpdateResult.Updated]}})})})}}),u2=OS.BuiltIn({name:"structure-bounding-box-3d",display:"Bounding Box",from:DS.Molecule.Structure,to:DS.Shape.Representation3D,params:Ac({radius:Ib.Numeric(.05,{min:.01,max:4,step:.01},{isEssential:!0}),color:Ib.Color(MC.red,{isEssential:!0})},sD.Params)})({canAutoUpdate:function(){return!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Bounding Box",function(e){return Tc(r,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:return[4,(t=hJ(function(e,t,r,n){var i=N1(t.box,t.radiu
139s,n?.geometry);return _B.create("Bouding Box",t,i,function(){return t.color},function(){return 1},function(){return"Bounding Box"})},sD.Utils)).createOrUpdate(i,{box:n.data.boundary.box,radius:i.radius,color:i.color}).runInContext(e)];case 1:return r.sent(),[2,new DS.Shape.Representation3D({repr:t,sourceData:n.data},{label:"Bounding Box"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Bounding Box",function(e){return Tc(r,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,i.data.repr.createOrUpdate(a,{box:n.data.boundary.box,radius:a.radius,color:a.color}).runInContext(e)];case 1:return t.sent(),i.data.sourceData=n.data,[2,Ob.UpdateResult.Updated]}})})})}}),c2=OS.BuiltIn({name:"structure-selections-distance-3d",display:"3D Distance",from:DS.Molecule.Structure.Selections,to:DS.Shape.Representation3D,params:function(){return Ac({},s0)}})({canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Structure Distance",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=h0(n.data),a=function(e){return dJ.createMulti("Distance",e,function(){return s0},dJ.StateBuilder,o0)}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,a.createOrUpdate(i,r).runInContext(e)];case 1:return o.sent(),[2,new DS.Shape.Representation3D({repr:a,sourceData:r},{label:"Distance"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Structure Distance",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(o){switch(o.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),r=h0(n.data),[4,i.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return o.sent(),i.data.sourceData=r,[2,Ob.UpdateResult.Updated]}})})})}}),l2=OS.BuiltIn({name:"structure-selections-angle-3d",display:"3D Angle",from:DS.Molecule.Structure.Selections,to:DS.Shape.Representation3D,params:function(){return Ac({},r1)}})({canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Structure Angle",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=p0(n.data),a=function(e){return dJ.createMulti("Angle",e,function(){return r1},dJ.StateBuilder,t1)}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,a.createOrUpdate(i,r).runInContext(e)];case 1:return o.sent(),[2,new DS.Shape.Representation3D({repr:a,sourceData:r},{label:"Angle"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Structure Angle",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(o){switch(o.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),r=p0(n.data),[4,i.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return o.sent(),i.data.sourceData=r,[2,Ob.UpdateResult.Updated]}})})})}}),d2=OS.BuiltIn({name:"structure-selections-dihedral-3d",display:"3D Dihedral",from:DS.Molecule.Structure.Selections,to:DS.Shape.Representation3D,params:function(){return Ac({},x1)}})({canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Structure Dihedral",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=m0(n.data),a=function(e){return dJ.createMulti("Dihedral",e,function(){return x1},dJ.StateBuilder,_1)}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,a.createOrUpdate(i,r).runInContext(e)];case 1:return o.sent(),[2,new DS.Shape.Representation3D({repr:a,sourceData:r},{label:"Dihedral"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Structure Dihedral",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(o){switch(o.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),r=m0(n.data),[4,i.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return o.sent(),i.data.sourceData=r,[2,Ob.UpdateResult.Updated]}})})})}}),f2=OS.BuiltIn({name:"structure-selections-label-3d",display:"3D Label",from:DS.Molecule.Structure.Selections,to:DS.Shape.Representation3D,params:function(){return Ac({},x0)}})({canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Structure Label",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=g0(n.data),a=function(e){return dJ.createMulti("Label",e,function(){return x0},dJ.StateBuilder,_0)}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,a.createOrUpdate(i,r).runInContext(e)];case 1:return o.sent(),[2,new DS.Shape.Representation3D({repr:a,sourceData:r},{label:"Label"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Structure Label",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(o){switch(o.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),r=g0(n.data),[4,i.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return o.sent(),i.data.sourceData=r,[2,Ob.UpdateResult.Updated]}})})})}}),h2=OS.BuiltIn({name:"structure-selections-orientation-3d",display:"3D Orientation",from:DS.Molecule.Structure.Selections,to:DS.Shape.Representation3D,params:function(){return Ac({},V0)}})({canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Structure Orientation",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=v0(n.data),a=function(e){var t=dJ.createMulti("Orientation",e,function(){return V0},dJ.StateBuilder,G0);return t.setState({markerActions:_Q.Highlighting}),t}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,a.createOrUpdate(i,r).runInContext(e)];case 1:return o.sent(),[2,new DS.Shape.Representation3D({repr:a,sourceData:r},{label:"Orientation"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Structure Orientation",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(o){switch(o.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),r=v0(n.data),[4,i.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return o.sent(),i.data.sourceData=r,[2,Ob.UpdateResult.Updated]}})})})}}),p2=OS.BuiltIn({name:"structure-selections-plane-3d",display:"3D Plane",from:DS.Molecule.Structure.Selections,to:DS.Shape.Representation3D,params:function(){return Ac({},j1)}})({canAutoUpdate:function(e){return e.oldParams,e.newParams,!0},apply:function(e,t){var r=this,n=e.a,i=e.params;return vy.create("Structure Plane",function(e){return Tc(r,void 0,void 0,function(){var r,a;return Pc(this,function(o){switch(o.label){case 0:return r=y0(n.data),a=function(e){var t=dJ.createMulti("Plane",e,function(){return j1},dJ.StateBuilder,U1);return t.setState({markerActions:_Q.Highlighting}),t}(Ac({webgl:t.canvas3d?.webgl},t.representation.structure.themes)),[4,a.createOrUpdate(i,r).runInContext(e)];case 1:return o.sent(),[2,new DS.Shape.Representation3D({repr:a,sourceData:r},{label:"Plane"})]}})})})},update:function(e,t){var r=this,n=e.a,i=e.b;e.oldParams;var a=e.newParams;return vy.create("Structure Plane",function(e){return Tc(r,void 0,void 0,function(){var t,r;return Pc(this,function(o){switch(o.label){case 0:return t=Ac(Ac({},i.data.repr.props),a),r=y0(n.data),[4,i.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return o.sent(),i.data.sourceData=r,[2,Ob.UpdateResult.Updated]}})})})}}),m2={Data:mT,Misc:vT,Model:bY,Volume:IY,Representation:Object.freeze({__proto__:null,ClippingStructureRepresentation3DFromBundle:n2,ClippingStructureRepresentation3DFromScript:r2,ExplodeStructureRepresentation3D:X1,ModelUnitcell3D:s2,OverpaintStructureRepresentation3DFromBundle:Z1,OverpaintStructureRepresentation3DFromScript:K1,ShapeRepresentation3D:o2,SpinStructureRepresentation3D:Y1,StructureBoundingBox3D:u2,StructureRepresentation3D:q1,StructureSelectionsAngle3D:l2,StructureSelectionsDihedral3D:d2,StructureSelectionsDistance3D:c2,StructureSelectionsLabel3D:f2,StructureSelectionsOrientation3D:h2,StructureSelectionsPlane3D:p2,SubstanceStructureRepresentation3DFromBundle:t2,SubstanceStructureRepresentation3DFromScript:e2,ThemeStrengthRepresentation3D:i2,TransparencyStructureRepresentation3DFromBundle:J1,TransparencyStructureRepresentation3DFromScript:Q1,UnwindStructureAssemblyRepresentation3D:W1,VolumeRepresentation3D:a2,get VolumeRepresentation3DHelpers(){return H1}}),Shape:F1};function g2(){var e=function(t,r){return t.commands.dispatch(e,r||{})};return e.subscribe=function(t,r){return t.commands.subscribe(e,r)},e.id=Wd.create22(),e}var v2=function(){function e(){this.subs=new Map,this.disposing=!1}return e.prototype.subscribe=function(e,t){var r=this,n=this.subs.get(e.id);return n||(n=[],this.subs.set(e.id,n)),n.push(t),{unsubscribe:function(){var n=r.subs.get(e.id);if(n){var i=n.indexOf(t);if(!(i<0)){for(var a=i+1;a<n.length;a++)n[a-1]=n[a];n.pop()}}}}},e.prototype.dispatch=function(e,t){var r=this;
139return new Promise(function(n,i){r.disposing?i("disposed"):r.subs.get(e.id)?r.resolve({cmd:e,params:t,resolve:n,reject:i}):n()})},e.prototype.dispose=function(){this.subs.clear()},e.prototype.resolve=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i;return Pc(this,function(a){switch(a.label){case 0:if(!(t=this.subs.get(e.cmd.id)))return e.resolve(),[2];a.label=1;case 1:a.trys.push([1,6,,7]),r=0,n=t,a.label=2;case 2:return r<n.length?[4,(0,n[r])(e.params)]:[3,5];case 3:a.sent(),a.label=4;case 4:return r++,[3,2];case 5:return e.resolve(),[3,7];case 6:return i=a.sent(),e.reject(i),[3,7];case 7:return[2]}})})},e}(),y2={State:{SetCurrentObject:g2(),ApplyAction:g2(),Update:g2(),RemoveObject:g2(),ToggleExpanded:g2(),ToggleVisibility:g2(),Snapshots:{Add:g2(),Replace:g2(),Move:g2(),Remove:g2(),Apply:g2(),Clear:g2(),Upload:g2(),Fetch:g2(),DownloadToFile:g2(),OpenFile:g2(),OpenUrl:g2()}},Interactivity:{Object:{Highlight:g2()},Structure:{Highlight:g2(),Select:g2()},ClearHighlights:g2()},Layout:{Update:g2()},Toast:{Show:g2(),Hide:g2()},Camera:{Reset:g2(),SetSnapshot:g2(),Focus:g2(),OrientAxes:g2(),ResetAxes:g2()},Canvas3D:{SetSettings:g2(),ResetSettings:g2()}},b2=xd.create({name:"built-in.animate-assembly-unwind",display:{name:"Unwind Assembly"},isExportable:!0,params:function(e){for(var t=[["all","All"]],r=0,n=e.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Structure));r<n.length;r++){var i=n[r];t.push([i.transform.ref,i.obj.data.models[0].label])}return{durationInMs:Ib.Numeric(3e3,{min:100,max:1e4,step:100}),playOnce:Ib.Boolean(!1),target:Ib.Select(t[0][0],t)}},canApply:function(e){var t=e.state.data,r=Rb.RootRef;return{canApply:t.select(Zb.Generators.ofType(DS.Molecule.Structure.Representation3D,r)).length>0}},getDuration:function(e){return{kind:"fixed",durationMs:e.durationInMs}},initialState:function(){return{t:0}},setup:function(e,t,r){for(var n=r.state.data,i=e.target&&"all"!==e.target?e.target:Rb.RootRef,a=n.select(Zb.Generators.ofType(DS.Molecule.Structure.Representation3D,i)),o=n.build(),s=!1,u=0,c=a;u<c.length;u++){var l=c[u];n.select(Zb.Generators.ofTransformer(m2.Representation.UnwindStructureAssemblyRepresentation3D,l.transform.ref)).length>0||(s=!0,o.to(l).apply(m2.Representation.UnwindStructureAssemblyRepresentation3D,{t:0},{tags:"animate-assembly-unwind"}))}if(s)return o.commit({doNotUpdateCurrent:!0})},teardown:function(e,t,r){var n=r.state.data,i=n.select(Zb.Generators.ofType(DS.Molecule.Structure.Representation3DState).withTag("animate-assembly-unwind"));if(0!==i.length){for(var a=n.build(),o=0,s=i;o<s.length;o++){var u=s[o];a.delete(u.transform.ref)}return a.commit()}},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:if(n=r.plugin.state.data,i=r.params.target&&"all"!==r.params.target?r.params.target:Rb.RootRef,0===(a=n.select(Zb.Generators.ofTransformer(m2.Representation.UnwindStructureAssemblyRepresentation3D,i))).length)return[2,{kind:"finished"}];for(o=n.build(),s=(t.current-t.lastApplied)/r.params.durationInMs,u=e.t+s,c=!1,r.params.playOnce&&u>=1?(c=!0,u=1):u%=1,l=0,d=a;l<d.length;l++)f=d[l],o.to(f).update({t:u});return[4,y2.State.Update(r.plugin,{state:n,tree:o,options:{doNotLogTiming:!0}})];case 1:return h.sent(),c?[2,{kind:"finished"}]:[2,{kind:"next",state:{t:u}}]}})})}}),_2=Cg(),x2=Cg(),S2=Ug(),w2=xd.create({name:"built-in.animate-camera-spin",display:{name:"Camera Spin",description:"Spin the 3D scene around the x-axis in view space"},isExportable:!0,params:function(){return{durationInMs:Ib.Numeric(4e3,{min:100,max:2e4,step:100}),speed:Ib.Numeric(1,{min:1,max:10,step:1},{description:"How many times to spin in the specified duration."}),direction:Ib.Select("cw",[["cw","Clockwise"],["ccw","Counter Clockwise"]],{cycle:!0})}},initialState:function(e,t){return{snapshot:t.canvas3d?.camera.getSnapshot()}},getDuration:function(e){return{kind:"fixed",durationMs:e.durationInMs}},teardown:function(e,t,r){var n;null==(n=r.canvas3d)||n.requestCameraReset({snapshot:t.snapshot,durationMs:0})},apply:function(e,t,r){var n;return Tc(this,void 0,void 0,function(){var i,a,o,s;return Pc(this,function(u){return 0===t.current?[2,{kind:"next",state:e}]:(i=e.snapshot).radiusMax<1e-4?[2,{kind:"finished"}]:(a=t.animation?t.animation?.currentFrame/(t.animation.frameCount+1):bg(t.current/r.params.durationInMs,0,1),o=2*Math.PI*a*r.params.speed*("ccw"===r.params.direction?-1:1),Cg.sub(_2,i.position,i.target),Cg.normalize(x2,i.up),Ug.setAxisAngle(S2,x2,o),Cg.transformQuat(_2,_2,S2),s=Cg.add(Cg(),i.target,_2),null==(n=r.plugin.canvas3d)||n.requestCameraReset({snapshot:Ac(Ac({},i),{position:s}),durationMs:0}),a>=.99999?[2,{kind:"finished"}]:[2,{kind:"next",state:e}])})})}}),A2=xd.create({name:"built-in.animate-model-index",display:{name:"Animate Trajectory"},isExportable:!0,params:function(){return{mode:Ib.MappedStatic("loop",{palindrome:Ib.Group({}),loop:Ib.Group({direction:Ib.Select("forward",[["forward","Forward"],["backward","Backward"]])}),once:Ib.Group({direction:Ib.Select("forward",[["forward","Forward"],["backward","Backward"]])},{isFlat:!0})},{options:[["palindrome","Palindrome"],["loop","Loop"],["once","Once"]]}),duration:Ib.MappedStatic("fixed",{fixed:Ib.Group({durationInS:Ib.Numeric(5,{min:1,max:120,step:.1},{description:"Duration in seconds"})},{isFlat:!0}),computed:Ib.Group({targetFps:Ib.Numeric(30,{min:5,max:250,step:1},{label:"Target FPS"})},{isFlat:!0}),sequential:Ib.Group({maxFps:Ib.Numeric(30,{min:5,max:60,step:1})},{isFlat:!0})})}},canApply:function(e){for(var t=e.state.data,r=0,n=t.select(Zb.Generators.ofTransformer(m2.Model.ModelFromTrajectory));r<n.length;
139r++){var i=n[r],a=Zb.findAncestorOfType(t.tree,t.cells,i.transform.ref,DS.Molecule.Trajectory);if(a&&a.obj&&a.obj.data.frameCount>1)return{canApply:!0}}return{canApply:!1,reason:"No trajectory to animate"}},getDuration:function(e,t){if("fixed"===e.duration?.name)return{kind:"fixed",durationMs:1e3*e.duration.params.durationInS};if("computed"===e.duration.name){for(var r=t.state.data,n=0,i=0,a=r.select(Zb.Generators.ofTransformer(m2.Model.ModelFromTrajectory));i<a.length;i++){var o=a[i],s=Zb.findAncestorOfType(r.tree,r.cells,o.transform.ref,DS.Molecule.Trajectory);if(s&&s.obj){var u=s.obj;n=Math.max(Math.ceil(1e3*u.data.frameCount/e.duration.params.targetFps),n)}}return{kind:"fixed",durationMs:n}}return{kind:"unknown"}},initialState:function(){return{}},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h;return Pc(this,function(p){switch(p.label){case 0:if("sequential"===r.params.duration.name&&t.current>0&&t.current-t.lastApplied<1e3/r.params.duration.params.maxFps)return[2,{kind:"skip"}];if(n=r.plugin.state.data,0===(i=n.select(Zb.Generators.ofTransformer(m2.Model.ModelFromTrajectory))).length)return[2,{kind:"finished"}];for(a=n.build(),o=r.params,s=e.palindromeDirections||{},u=!1,c=!0,l=function(e){var r=Zb.findAncestorOfType(n.tree,n.cells,e.transform.ref,DS.Molecule.Trajectory);if(!r||!r.obj)return"continue";var i=r.obj;if(i.data.frameCount<=1)return"continue";a.to(e).update(function(r){var n=i.data.frameCount;if(1===n)return r;if(c=!1,"sequential"===o.duration.name){var a=1;if("once"===o.mode.name){if(-1==(a="backward"===o.mode.params.direction?-1:1)&&0===r.modelIndex||1===a&&r.modelIndex===n-1)return u=!0,r}else"palindrome"===o.mode.name&&(a=0===r.modelIndex?1:r.modelIndex===n-1?-1:s[e.transform.ref]||1);return s[e.transform.ref]=a,(d=(r.modelIndex+a)%n)<0&&(d+=n),u=u||-1===a&&0===d||1===a&&d===n-1,{modelIndex:d}}var l="fixed"===o.duration.name?1e3*o.duration.params.durationInS:Math.ceil(1e3*i.data.frameCount/o.duration.params.targetFps);if("once"===o.mode.name&&t.current>=l)return u=!0,{modelIndex:i.data.frameCount-1};var d,f=t.current%l/l;
139return"loop"===o.mode.name&&"backward"===o.mode.params.direction&&(f=1-f),"palindrome"===o.mode.name&&(f*=2)>1&&(f=2-f),{modelIndex:d=Math.min(Math.floor(i.data.frameCount*f),i.data.frameCount-1)}})},d=0,f=i;d<f.length;d++)h=f[d],l(h);return c?[3,2]:[4,y2.State.Update(r.plugin,{state:n,tree:a,options:{doNotLogTiming:!0}})];case 1:p.sent(),p.label=2;case 2:return c||"once"===o.mode.name&&u?[2,{kind:"finished"}]:"palindrome"===o.mode.name?[2,{kind:"next",state:{palindromeDirections:s}}]:[2,{kind:"next",state:{}}]}})})}});function C2(e,t,r){var n;return void 0===r&&(r=!1),Tc(this,void 0,void 0,function(){return Pc(this,function(i){switch(i.label){case 0:return t.snapshot.data?[4,e.runTask(e.state.data.setSnapshot(t.snapshot.data))]:[3,2];case 1:i.sent(),i.label=2;case 2:return t.snapshot.camera&&(null==(n=e.canvas3d)||n.requestCameraReset({snapshot:t.snapshot.camera.current,durationMs:r||"instant"===t.snapshot.camera.transitionStyle?0:t.snapshot.camera.transitionDurationInMs})),[2]}})})}var T2,P2=xd.create({name:"built-in.animate-state-snapshots",display:{name:"State Snapshots"},isExportable:!0,params:function(){return{}},canApply:function(e){var t=e.managers.snapshot.state.entries;return t.size<2?{canApply:!1,reason:"At least 2 states required."}:t.some(function(e){return!!e?.snapshot.startAnimation})?{canApply:!1,reason:"Nested animations not supported."}:{canApply:e.managers.snapshot.state.entries.size>1}},setup:function(e,t,r){C2(r,r.managers.snapshot.state.entries.get(0),!0)},getDuration:function(e,t){return{kind:"fixed",durationMs:t.managers.snapshot.state.entries.toArray().reduce(function(e,t){return e+(t.snapshot.durationInMs??0)},0)}},initialState:function(e,t){var r=t.managers.snapshot.state.entries.toArray();return{totalDuration:r.reduce(function(e,t){return e+(t.snapshot.durationInMs??0)},0),snapshots:r,currentIndex:0}},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s;return Pc(this,function(u){if(t.current>=e.totalDuration)return[2,{kind:"finished"}];for(n=0,i=0,a=0,o=e.snapshots;a<o.length&&(s=o[a],n+=s.snapshot.durationInMs??0,!(t.current<n));a++)i++;return i>=e.snapshots.length?[2,{kind:"finished"}]:i===e.currentIndex?[2,{kind:"skip"}]:(C2(r.plugin,e.snapshots[i]),[2,{kind:"next",state:Ac(Ac({},e),{currentIndex:i})}])})})}});!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(DS.Create({name:"Root",typeClass:"Root"}));e.Root=t;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(DS.Create({name:"Category",typeClass:"Object"}));e.Category=r;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(DS.CreateBehavior({name:"Behavior"}));e.Behavior=n,e.Categories={common:"Common",representation:"Representation",interaction:"Interaction","custom-props":"Custom Properties",misc:"Miscellaneous"},e.CreateCategory=OS.BuiltIn({name:"create-behavior-category",display:{name:"Behavior Category"},from:t,to:r,params:{label:Ib.Text("",{isHidden:!0})}})({apply:function(e){var t=e.params;return new r({},{label:t.label})}});var i=new Map;e.getCategoryId=function(e){return i.get(e.id)},e.create=function(e){var r=OS.CreateBuiltIn({name:e.name,display:e.display,from:[t],to:[n],params:e.params,apply:function(t,r){var i=t.params,a=e.label?e.label(i):{label:e.display.name,description:e.display.description};return new n(new e.ctor(r,i),a)},update:function(e){var t=this,r=e.b,n=e.newParams;return vy.create("Update Behavior",function(){return Tc(t,void 0,void 0,function(){return Pc(this,function(e){switch(e.label){case 0:return r.data.update?[4,r.data.update(n)]:[2,Ob.UpdateResult.Unchanged];case 1:return[2,e.sent()?Ob.UpdateResult.Updated:Ob.UpdateResult.Unchanged]}})})})},canAutoUpdate:e.canAutoUpdate});return i.set(r.id,e.category),r},e.simpleCommandHandler=function(e,t){return function(){function r(e){this.ctx=e,this.sub=void 0}return r.prototype.register=function(){var r=this;this.sub=e.subscribe(this.ctx,function(e){return t(e,r.ctx)})},r.prototype.dispose=function(){this.sub&&this.sub.unsubscribe(),this.sub=void 0},r}()},e.Handler=function(){function e(e,t){this.ctx=e,this.params=t,this.subs=[]}return e.prototype.subscribeCommand=function(e,t){this.subs.push(e.subscribe(this.ctx,t))}
139,e.prototype.subscribeObservable=function(e,t){this.subs.push(e.subscribe(t))},e.prototype.track=function(e){this.subs.push(e)},e.prototype.dispose=function(){for(var e=0,t=this.subs;e<t.length;e++)t[e].unsubscribe();this.subs=[]},e.prototype.update=function(e){return!df(e,this.params)&&(this.params=e,!0)},e}(),e.WithSubscribers=function(){function e(e,t){this.plugin=e,this.params=t,this.subs=[]}return e.prototype.subscribeCommand=function(e,t){this.subs.push(e.subscribe(this.plugin,t))},e.prototype.subscribeObservable=function(e,t){var r=this,n=e.subscribe(t);return this.subs.push(n),{unsubscribe:function(){var e=r.subs.indexOf(n);e>=0&&(r.subs.splice(e,1),n.unsubscribe())}}},e.prototype.dispose=function(){for(var e=0,t=this.subs;e<t.length;e++)t[e].unsubscribe();this.subs=[]},e}()}(T2||={});var E2=function(){function e(){this.subs=void 0}return e.prototype.subscribe=function(e,t){var r=this;void 0===this.subs&&(this.subs=[]);var n=e.subscribe(t);return this.subs.push(n),{unsubscribe:function(){n&&r.subs&&qb(r.subs,n)&&(n.unsubscribe(),n=void 0)}}},Object.defineProperty(e.prototype,"ev",{get:function(){return this._ev||=H_.create()},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){if(this._ev&&this._ev.dispose(),this.subs){for(var e=0,t=this.subs;e<t.length;e++)t[e].unsubscribe();this.subs=void 0}},e}(),M2=function(e){function t(t){var r=e.call(this)||this;return r._state=t,r}return wc(t,e),t.prototype.updateState=function(){var e=[...arguments],t=this.state,r=function(e,t){for(var r=e,n=0;n<t.length;n++)if(t[n]&&(r=zg(e,t[n]))!==e){for(var i=n+1;i<t.length;i++)r=Object.assign(r,t[i]);break}return r}(t,e);return r!==t&&(this._state=r,!0)},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t}(E2),k2="3.44.0",I2=new Date(typeof __MOLSTAR_DEBUG_TIMESTAMP__<"u"?__MOLSTAR_DEBUG_TIMESTAMP__:1704560431276);function D2(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(n){return[2,new Promise(function(n,i){var a=function(e){e?n(e):i("no blob returned")};HTMLCanvasElement.prototype.toBlob?e.toBlob(a,t,r):function(e,t,r,n){for(var i=atob(e.toDataURL(r,n).split(",")[1]),a=i.length,o=a>>2,s=new Uint8Array(a),u=new Uint32Array(s.buffer,0,o),c=0,l=0;l<o;++l)u[l]=i.charCodeAt(c++)|i.charCodeAt(c++)<<8|i.charCodeAt(c++)<<16|i.charCodeAt(c++)<<24;for(var d=3&a;d--;)s[c]=i.charCodeAt(c++);t(new Blob([s],{type:r}))}(e,a,t,r)})]})})}var O2=function(e){function t(r){var n=e.call(this,{current:void 0,entries:om(),isPlaying:!1,nextSnapshotDelayInMs:t.DefaultNextSnapshotDelayInMs})||this;return n.plugin=r,n.entryMap=new Map,n.defaultSnapshotId=void 0,n.events={changed:n.ev(),opened:n.ev()},n.timeoutHandle=void 0,n.next=function(){return Tc(n,void 0,void 0,function(){var e,t,r;return Pc(this,function(n){switch(n.label){case 0:return this.timeoutHandle=void 0,(e=this.getNextId(this.state.current,1))&&e!==this.state.current?(t=this.setCurrent(e),[4,this.plugin.state.setSnapshot(t)]):(this.stop(),[2]);case 1:return n.sent(),r=void 0===t.durationInMs?this.state.nextSnapshotDelayInMs:t.durationInMs,this.state.isPlaying&&(this.timeoutHandle=setTimeout(this.next,r)),[2]}})})},n}return wc(t,e),t.prototype.getIndex=function(e){return this.state.entries.indexOf(e)},t.prototype.getEntry=function(e){if(e)return this.entryMap.get(e)},t.prototype.remove=function(e){var t=this.entryMap.get(e);t&&(null!=t&&t.image&&this.plugin.managers.asset.delete(t.image),this.entryMap.delete(e),this.updateState({current:this.state.current===e?void 0:this.state.current,entries:this.state.entries.delete(this.getIndex(t))}),this.events.changed.next(void 0))},t.prototype.add=function(e){this.entryMap.set(e.snapshot.id,e),this.updateState({current:e.snapshot.id,entries:this.state.entries.push(e)}),this.events.changed.next(void 0)},t.prototype.replace=function(e,r,n){var i=this.getEntry(e);if(i){this.defaultSnapshotId=void 0,null!=i&&i.image&&this.plugin.managers.asset.delete(i.image);var a=this.getIndex(i),o=t.Entry(r,{key:n?.key??i.key,name:n?.name??i.name,description:n?.description??i.description,image:n?.image});this.entryMap.set(r.id,o),this.updateState({current:o.snapshot.id,entries:this.state.entries.set(a,o)}),this.events.changed.next(void 0)}},t.prototype.move=function(e,t){var r=this.state.entries.size;if(!(r<2)){var n=this.getEntry(e);if(n){var i=this.getIndex(n),a=(i+t)%r;a<0&&(a+=r);var o=this.state.entries.get(a),s=this.state.entries.asMutable();s.set(a,n),s.set(i,o),this.updateState({current:n.snapshot.id,entries:s.asImmutable()}),this.events.changed.next(void 0)}}},t.prototype.update=function(e,t){var r=this.getIndex(e);if(!(r<0)){var n=this.state.entries.set(r,Ac(Ac({},e),{key:t.key?.trim()||void 0,name:t.name?.trim()||void 0,description:t.description?.trim()||void 0}));this.updateState({entries:n}),this.entryMap.set(e.snapshot.id,this.state.entries.get(r)),this.events.changed.next(void 0)}},t.prototype.clear=function(){var e=this;
1390!==this.state.entries.size&&(this.entryMap.forEach(function(t){null!=t&&t.image&&e.plugin.managers.asset.delete(t.image)}),this.entryMap.clear(),this.updateState({current:void 0,entries:om()}),this.events.changed.next(void 0))},t.prototype.applyKey=function(e){var t=this.state.entries.find(function(t){return t.key===e});t&&(this.updateState({current:t.snapshot.id}),this.events.changed.next(void 0),this.plugin.state.setSnapshot(t.snapshot))},t.prototype.setCurrent=function(e){var t=this.getEntry(e);return t&&(this.updateState({current:e}),this.events.changed.next(void 0)),t&&t.snapshot},t.prototype.getNextId=function(e,t){var r=this.state.entries.size;if(!e){if(0===r)return;var n=-1===t?r-1:0;return this.state.entries.get(n).snapshot.id}var i=this.getEntry(e);if(i){var a=this.getIndex(i);if(!(a<0))return(a=(a+t)%r)<0&&(a+=r),this.state.entries.get(a).snapshot.id}},t.prototype.setStateSnapshot=function(e){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:for(e.version,this.clear(),r=om().asMutable(),n=0,i=e.entries;n<i.length;n++)a=i[n],this.entryMap.set(a.snapshot.id,a),r.push(a);return o=e.current?e.current:e.entries.length>0?e.entries[0].snapshot.id:void 0,this.updateState({current:o,entries:r.asImmutable(),isPlaying:!1,nextSnapshotDelayInMs:e.playback?e.playback.nextSnapshotDelayInMs:t.DefaultNextSnapshotDelayInMs}),this.events.changed.next(void 0),o?(s=this.getEntry(o),(u=s&&s.snapshot)?[4,this.plugin.state.setSnapshot(u)]:[2]):[2];case 1:return c.sent(),e.playback&&e.playback.isPlaying&&this.play(!0),[2,u]}})})},t.prototype.syncCurrent=function(e){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return r=0===this.state.entries.size,n=1===this.state.entries.size&&this.state.current&&this.state.current===this.defaultSnapshotId,r||n?(i=this.plugin.state.getSnapshot(e?.params),e?.params?.image??this.plugin.state.snapshotParams.value.image?[4,t.getCanvasImageAsset(this.plugin,`${i.id}-image.png`)]:[3,2]):[2];case 1:return o=u.sent(),[3,3];case 2:o=void 0,u.label=3;case 3:return a=o,r?this.add(t.Entry(i,{name:e?.name,description:e?.description,image:a})):n&&(null!=(s=this.getEntry(this.state.current))&&s.image&&this.plugin.managers.asset.delete(s.image),this.replace(this.state.current,i,{image:a})),this.defaultSnapshotId=i.id,[2]}})})},t.prototype.getStateSnapshot=function(e){return Tc(this,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,this.syncCurrent(e)];case 1:return t.sent(),[2,{timestamp:+new Date,version:k2,name:e&&e.name,description:e&&e.description,current:this.state.current,playback:{isPlaying:!(!e||!e.playOnLoad),nextSnapshotDelayInMs:this.state.nextSnapshotDelayInMs},entries:this.state.entries.valueSeq().toArray()}]}})})},t.prototype.serialize=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v;return Pc(this,function(y){switch(y.label){case 0:return n=(r=JSON).stringify,[4,this.getStateSnapshot({params:e?.params})];case 1:return t=n.apply(r,[y.sent(),null,2]),e?.type&&"json"!==e.type&&"molj"!==e.type?[3,2]:[2,new Blob([t],{type:"application/json;charset=utf-8"})];case 2:Xv(i=new Uint8Array(Jv(t)),0,t),a={"state.json":i},o=[],s=0,u=this.plugin.managers.asset.assets,y.label=3;case 3:return s<u.length?(c=u[s],l=c.asset,d=c.file,o.push([l.id,l]),f=a,h=`assets/${l.id}`,p=Uint8Array.bind,[4,d.arrayBuffer()]):[3,6];case 4:f[h]=new(p.apply(Uint8Array,[void 0,y.sent()])),y.label=5;case 5:return s++,[3,3];case 6:return o.length>0&&(m=JSON.stringify(o,null,2),Xv(g=new Uint8Array(Jv(m)),0,m),a["assets.json"]=g),[4,this.plugin.runTask(mb(a))];case 7:return v=y.sent(),[2,new Blob([v],{type:"application/zip"})]}})})},t.prototype.open=function(e){return Tc(this,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v;return Pc(this,function(y){switch(y.label){case 0:return y.trys.push([0,15,,16]),(r=e.name.toLowerCase()).endsWith("json")||r.endsWith("molj")?[4,this.plugin.runTask(vb(e,"string"))]:[3,8];case 1:return n=y.sent(),g=JSON.parse(n),t.isStateSnapshot(g)?[4,this.setStateSnapshot(g)]:[3,3];case 2:return y.sent(),[3,7];case 3:return t.isStateSnapshot(g.data)?[4,this.setStateSnapshot(g.data)]:[3,5];case 4:return y.sent(),[3,7];case 5:return[4,this.plugin.state.setSnapshot(g)];case 6:y.sent(),y.label=7;case 7:return[3,14];case 8:return[4,this.plugin.runTask(vb(e,"zip"))];case 9:return n=y.sent(),i=Object.create(null),Hg(n,function(e,t){if("state.json"!==t&&"assets.json"!==t){var r=t.substring(t.indexOf("/")+1);i[r]=e}}),a=new File([n["state.json"]],"state.json"),[4,this.plugin.runTask(vb(a,"string"))];case 10:return o=y.sent(),n["assets.json"]?(s=new File([n["assets.json"]],"assets.json"),l=(c=JSON).parse,[4,this.plugin.runTask(vb(s,"string"))]):[3,12];case 11:for(u=l.apply(c,[y.sent()]),d=0,f=u;d<f.length;
139d++)h=f[d],p=h[0],m=h[1],this.plugin.managers.asset.set(m,new File([i[p]],m.name));y.label=12;case 12:return g=JSON.parse(o),[4,this.setStateSnapshot(g)];case 13:y.sent(),y.label=14;case 14:return this.events.opened.next(void 0),[3,16];case 15:return v=y.sent(),console.error(v),this.plugin.log.error("Error reading state"),[3,16];case 16:return[2]}})})},t.prototype.play=function(e){if(void 0===e&&(e=!1),this.updateState({isPlaying:!0}),e){var t=this.getEntry(this.state.current);if(!t)return void this.next();this.events.changed.next(void 0);var r=t.snapshot,n=void 0===r.durationInMs?this.state.nextSnapshotDelayInMs:r.durationInMs;this.timeoutHandle=setTimeout(this.next,n)}else this.next()},t.prototype.stop=function(){this.updateState({isPlaying:!1}),void 0!==this.timeoutHandle&&clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0,this.events.changed.next(void 0)},t.prototype.togglePlay=function(){this.state.isPlaying?(this.stop(),this.plugin.managers.animation.stop()):this.play()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.entryMap.clear()},t.DefaultNextSnapshotDelayInMs=1500,t}(M2);function R2(e){return e.toISOString().replace(/T/," ").replace(/\..+/,"")}function B2(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");
139t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}function N2(e,t){if(void 0===t&&(t="download"),e)if("download"in HTMLAnchorElement.prototype){var r=document.createElement("a");r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,B2(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){return URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){return B2(r)}))}else if(typeof navigator<"u"&&navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,t);else{var n=window.navigator.userAgent,i=/Safari/i.test(n),a=/CriOS\/[\d]+/.test(n),o=function(e){var t=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");window.open(t,"_blank")||(window.location.href=t)};if((i||a)&&FileReader)if(e instanceof Blob){var s=new FileReader;s.onloadend=function(){return o(s.result)},s.readAsDataURL(e)}else o(e);else{var u=URL.createObjectURL("string"==typeof e?new Blob([e]):e);location.href=u,setTimeout(function(){return URL.revokeObjectURL(u)},4e4)}}}function F2(e,t){return`${e}${"/"===e[e.length-1]||"/"===t[0]?"":"/"}${t}`}!function(e){e.Entry=function(e,t){return Ac({timestamp:+new Date,snapshot:e},t)},e.isStateSnapshot=function(e){var t=e;return!!t&&!!t.timestamp&&!!t.entries},e.getCanvasImageAsset=function(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a;return Pc(this,function(o){switch(o.label){case 0:return e.helpers.viewportScreenshot&&(r=e.helpers.viewportScreenshot.getPreview(512))?[4,D2(r.canvas,"png")]:[2];case 1:return n=o.sent(),i=new File([n],t),a={kind:"file",id:Wd.create22(),name:t},e.managers.asset.set(a,i),[2,a]}})})}}(O2||={});var L2={get preferWebGl1(){if(typeof navigator>"u"||typeof window>"u")return!1;if(["Version/15.1 Safari","Version/15.2 Safari","Version/15.3 Safari"].some(function(e){return navigator.userAgent.indexOf(e)>0}))return!0;var e=/iPad|iPhone|iPod/.test(navigator.userAgent),t=navigator.userAgent.includes("Macintosh"),r=navigator.maxTouchPoints>=4;return!window.MSStream&&(e||t&&r)}},$2=function(){function e(e,t){this.key=e,this.defaultValue=t}return e.prototype.toString=function(){return this.key},e.prototype.valueOf=function(){return this.key},e}();function U2(e,t){return new $2(e,t)}var j2={item:U2,General:{IsBusyTimeoutMs:U2("plugin-config.is-busy-timeout",750),DisableAntialiasing:U2("plugin-config.disable-antialiasing",!1),DisablePreserveDrawingBuffer:U2("plugin-config.disable-preserve-drawing-buffer",!1),PixelScale:U2("plugin-config.pixel-scale",1),PickScale:U2("plugin-config.pick-scale",.25),PickPadding:U2("plugin-config.pick-padding",3),EnableWboit:U2("plugin-config.enable-wboit",!0),EnableDpoit:U2("plugin-config.enable-dpoit",!1),PreferWebGl1:U2("plugin-config.prefer-webgl1",L2.preferWebGl1),AllowMajorPerformanceCaveat:U2("plugin-config.allow-major-performance-caveat",!1),PowerPreference:U2("plugin-config.power-preference","high-performance")},State:{DefaultServer:U2("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),CurrentServer:U2("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),HistoryCapacity:U2("history-capacity.server",5)},VolumeStreaming:{Enabled:U2("volume-streaming.enabled",!0),DefaultServer:U2("volume-streaming.server","https://ds.litemol.org"),CanStream:U2("volume-streaming.can-stream",function(e,t){return 1===e.models.length&&Xz.probablyHasDensityMap(e.models[0])}),EmdbHeaderServer:U2("volume-streaming.emdb-header-server","https://files.wwpdb.org/pub/emdb/structures")},Viewport:{ShowExpand:U2("viewer.show-expand-button",!0),ShowControls:U2("viewer.show-controls-button",!0),ShowSettings:U2("viewer.show-settings-button",!0),ShowSelectionMode:U2("viewer.show-selection-model-button",!0),ShowAnimation:U2("viewer.show-animation-button",!0),ShowTrajectoryControls:U2("viewer.show-trajectory-controls",!0)},Download:{DefaultPdbProvider:U2("download.default-pdb-provider","pdbe"),DefaultEmdbProvider:U2("download.default-emdb-provider","pdbe")},Structure:{SizeThresholds:U2("structure.size-thresholds",yz.DefaultSizeThresholds),DefaultRepresentationPreset:U2("structure.default-representation-preset","auto"),DefaultRepresentationPresetParams:U2("structure.default-representation-preset-params",{}),SaccharideCompIdMapType:U2("structure.saccharide-comp-id-map-type","default")}
139,Background:{Styles:U2("background.styles",[])}},z2=function(){function e(e){var t=this;this._config=new Map,e&&e.forEach(function(e){var r=e[0],n=e[1];return t._config.set(r,n)})}return e.prototype.get=function(e){return this._config.has(e)?this._config.get(e):e.defaultValue},e.prototype.set=function(e,t){this._config.set(e,t)},e.prototype.delete=function(e){this._config.delete(e)},e}();function G2(e){e.state.events.object.created.subscribe(function(e){DS.isBehavior(e.obj)&&e.obj.data.register(e.ref)}),e.state.events.object.removed.subscribe(function(e){var t,r,n,i;DS.isBehavior(e.obj)&&(null==(r=(t=e.obj.data).unregister)||r.call(t),null==(i=(n=e.obj.data).dispose)||i.call(n))}),e.state.events.object.updated.subscribe(function(e){var t,r,n,i;"recreate"===e.action&&(e.oldObj&&DS.isBehavior(e.oldObj)&&(null==(r=(t=e.oldObj.data).unregister)||r.call(t),null==(i=(n=e.oldObj.data).dispose)||i.call(n)),e.obj&&DS.isBehavior(e.obj)&&e.obj.data.register(e.ref))})}function V2(e){y2.State.SetCurrentObject.subscribe(e,function(e){var t=e.state,r=e.ref;return t.setCurrent(r)})}function H2(e){y2.State.Update.subscribe(e,function(t){var r=t.state,n=t.tree,i=t.options;return e.runTask(r.updateTree(n,i))})}function q2(e){y2.State.ApplyAction.subscribe(e,function(t){var r=t.state,n=t.action,i=t.ref;return e.runTask(r.applyAction(n.action,n.params,i))})}function W2(e){function t(t,r){var n=t.build().delete(r);return e.runTask(t.updateTree(n))}y2.State.RemoveObject.subscribe(e,function(e){var r=e.state,n=e.ref;if(!e.removeParentGhosts)return t(r,n);var i=r.tree,a=i.transforms.get(n);if(a.parent===n)return t(r,n);for(;;){var o=i.children.get(a.parent);if(a.parent===a.ref||o.size>1)return t(r,a.ref);var s=i.transforms.get(a.parent);if(!s.state.isGhost)return t(r,a.ref);a=s}})}function X2(e){y2.State.ToggleExpanded.subscribe(e,function(e){var t=e.state,r=e.ref;return t.updateCellState(r,function(e){return{isCollapsed:!e.isCollapsed}})})}function Y2(e){y2.State.ToggleVisibility.subscribe(e,function(e){var t=e.state,r=e.ref;return K2(t,r,!t.cells.get(r).state.isHidden)})}function K2(e,t,r){Kb.doPreOrder(e.tree,e.transforms.get(t),{state:e,value:r},Z2)}function Z2(e,t,r){r.state.updateCellState(e.ref,{isHidden:r.value})}function Q2(e){y2.Interactivity.Object.Highlight.subscribe(e,function(t){var r=t.state,n=t.ref;if(e.canvas3d&&!e.isBusy){e.managers.interactivity.lociHighlights.clearHighlights();for(var i=0,a="string"==typeof n?[n]:n;i<a.length;i++){var o=a[i],s=r.cells.get(o);if(s)if(DS.Molecule.Structure.is(s.obj))e.managers.interactivity.lociHighlights.highlight({loci:yz.Loci(s.obj.data)},!1);else if(s&&DS.isRepresentation3D(s.obj))for(var u=s.obj.data.repr,c=0,l=u.getAllLoci();c<l.length;c++){var d=l[c];e.managers.interactivity.lociHighlights.highlight({loci:d,repr:u},!1)}else if(DS.Molecule.Structure.Selections.is(s.obj))for(var f=0,h=s.obj.data;f<h.length;f++){var p=h[f];e.managers.interactivity.lociHighlights.highlight({loci:p.loci},!1)}}}})}function J2(e){y2.Interactivity.ClearHighlights.subscribe(e,function(){e.managers.interactivity.lociHighlights.clearHighlights()})}function e3(e){var t=this;e.config.set(j2.State.CurrentServer,e.config.get(j2.State.DefaultServer)),y2.State.Snapshots.Clear.subscribe(e,function(){e.managers.snapshot.clear()}),y2.State.Snapshots.Remove.subscribe(e,function(t){var r=t.id;e.managers.snapshot.remove(r)}),y2.State.Snapshots.Add.subscribe(e,function(r){var n=r.key,i=r.name,a=r.description,o=r.params;return Tc(t,void 0,void 0,function(){var t,r,s,u;return Pc(this,function(c){switch(c.label){case 0:return t=e.state.getSnapshot(o),o?.image??e.state.snapshotParams.value.image?[4,O2.getCanvasImageAsset(e,`${t.id}-image.png`)]:[3,2];case 1:return s=c.sent(),[3,3];case 2:s=void 0,c.label=3;case 3:return r=s,u=O2.Entry(t,{key:n,name:i,description:a,image:r}),e.managers.snapshot.add(u),[2]}})})}),y2.State.Snapshots.Replace.subscribe(e,function(r){var n=r.id,i=r.params;return Tc(t,void 0,void 0,function(){var t,r,a;return Pc(this,function(o){switch(o.label){case 0:return t=e.state.getSnapshot(i),i?.image??e.state.snapshotParams.value.image?[4,O2.getCanvasImageAsset(e,`${t.id}-image.png`)]:[3,2];case 1:return a=o.sent(),[3,3];case 2:a=void 0,o.label=3;case 3:return r=a,e.managers.snapshot.replace(n,e.state.getSnapshot(i),{image:r}),[2]}})})}),y2.State.Snapshots.Move.subscribe(e,function(t){var r=t.id,n=t.dir;e.managers.snapshot.move(r,n)}),y2.State.Snapshots.Apply.subscribe(e,function(t){var r=t.id,n=e.managers.snapshot.setCurrent(r);if(n)return e.state.setSnapshot(n)}),y2.State.Snapshots.Upload.subscribe(e,function(r){var n=r.name,i=r.description,a=r.playOnLoad,o=r.serverUrl;return r.params,Tc(t,void 0,void 0,function(){var t,r,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return t=fetch,r=[F2(o,`set?name=${encodeURIComponent(n||"")}&description=${encodeURIComponent(i||"")}`)],c={method:"POST",mode:"cors",referrer:"no-referrer",headers:{"Content-Type":"application/json; charset=utf-8"}},u=(s=JSON).stringify,[4,e.managers.snapshot.getStateSnapshot({name:n,description:i,playOnLoad:a})];case 1:return[2,t.apply(void 0,r.concat([(c.body=u.apply(s,[l.sent()]),c)]))]}})})}),y2.State.Snapshots.Fetch.subscribe(e,function(r){var n=r.url;return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:return[4,e.runTask(e.fetch({url:n,type:"json"}))];case 1:return t=r.sent(),[4,e.managers.snapshot.setStateSnapshot(t.data)];case 2:return r.sent(),[2]}})})}),y2.State.Snapshots.DownloadToFile.subscribe(e,function(r){var n=r.name,i=r.type,a=r.params;return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:return t=`mol-star_state_${n||(o=new Date,o.getFullYear()+"-"+(o.getMonth()+1)+"-"+o.getDate()+"-"+o.getHours()+"-"+o.getMinutes()+"-"+o.getSeconds())}.${"json"===i?"molj":"molx"}`,[4,e.managers.snapshot.serialize({type:i,params:a})];case 1:return N2(r.sent(),`${t}`),[2]}var o})})}),y2.State.Snapshots.OpenFile.subscribe(e,function(t){var r=t.file;return e.managers.snapshot.open(r)}),y2.State.Snapshots.OpenUrl.subscribe(e,function(r){var n=r.url,i=r.type;return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:return[4,e.runTask(e.fetch({url:n,type:"binary"}))];case 1:return t=r.sent(),[2,e.managers.snapshot.open(new File([t],`state.${i}`))]}})})})}var t3=Object.freeze({__proto__:null,ApplyAction:q2,ClearHighlights:J2,Highlight:Q2,RemoveObject:W2,SetCurrentObject:V2,Snapshots:e3,SyncBehaviors:G2,ToggleExpanded:X2,ToggleVisibility:Y2,Update:H2,registerDefault:function(e){G2(e),V2(e),H2(e),q2(e),W2(e),X2(e),Y2(e),Q2(e),J2(e),e3(e)},setSubtreeVisibility:K2});function r3(e){var t=e.state.data.events;t.object.created.subscribe(function(t){var r;DS.isRepresentation3D(t.obj)&&(a3(t.state.cells.get(t.ref),t.obj.data.repr),t.obj.data.repr.setState({syncManually:!0}),null==(r=e.canvas3d)||r.add(t.obj.data.repr))}),t.object.updated.subscribe(function(t){var r,n;t.oldObj&&DS.isRepresentation3D(t.oldObj)&&(null==(r=e.canvas3d)||r.remove(t.oldObj.data.repr),t.oldObj.data.repr.destroy()),DS.isRepresentation3D(t.obj)&&(a3(t.state.cells.get(t.ref),t.obj.data.repr),"recreate"===t.action&&t.obj.data.repr.setState({syncManually:!0}),null==(n=e.canvas3d)||n.add(t.obj.data.repr))}),t.object.removed.subscribe(function(t){var r;DS.isRepresentation3D(t.obj)&&(null==(r=e.canvas3d)||r.remove(t.obj.data.repr),t.obj.data.repr.destroy())})}function n3(e){var t=e.state.data.events;t.object.created.subscribe(function(t){var r;if(DS.Molecule.Structure.Representation3DState.is(t.obj)){var n=t.obj.data;n.repr.setState(n.state),null==(r=e.canvas3d)||r.update(n.repr)}}),t.object.updated.subscribe(function(t){var r;if(DS.Molecule.Structure.Representation3DState.is(t.obj)){var n=t.obj.data;n.repr.setState(n.state),null==(r=e.canvas3d)||r.update(n.repr)}}),t.object.removed.subscribe(function(t){var r;if(DS.Molecule.Structure.Representation3DState.is(t.obj)){var n=t.obj.data;n.repr.setState(n.initialState),null==(r=e.canvas3d)||r.update(n.repr)}})}function i3(e){e.state.data.events.cell.stateUpdated.subscribe(function(t){var r,n=t.state.cells.get(t.ref);DS.isRepresentation3D(n.obj)&&a3(n,n.obj.data.repr)&&(null==(r=e.canvas3d)||r.syncVisibility())})}function a3(e,t){return t.state.visible===!!e.state.isHidden&&(t.setState({visible:!e.state.isHidden}),!0)}var o3=Object.freeze({__proto__:null,SyncRepresentationToCanvas:r3,SyncStructureRepresentation3DState:n3,UpdateRepresentationVisibility:i3,registerDefault:function(e){r3(e),n3(e),i3(e)}});function s3(e){y2.Camera.Reset.subscribe(e,function(t){e.managers.camera.reset(t?.snapshot,t?.durationMs)})}function u3(e){y2.Camera.SetSnapshot.subscribe(e,function(t){var r=t.snapshot,n=t.durationMs;e.managers.camera.setSnapshot(r,n)})}function c3(e){y2.Camera.Focus.subscribe(e,function(t){var r=t.center,n=t.radius,i=t.durationMs;e.managers.camera.focusSphere({center:r,radius:n},{durationMs:i}),e.events.canvas3d.settingsUpdated.next(void 0)})}function l3(e){y2.Camera.OrientAxes.subscribe(e,function(t){var r=t.structures,n=t.durationMs;e.managers.camera.orientAxes(r,n)})}function d3(e){y2.Camera.ResetAxes.subscribe(e,function(t){var r=t.durationMs;e.managers.camera.resetAxes(r)})}var f3=Object.freeze({__proto__:null,Focus:c3,OrientAxes:l3,Reset:s3,ResetAxes:d3,SetSnapshot:u3,registerDefault:function(e){s3(e),c3(e),u3(e),l3(e),d3(e)}});function h3(){return h3.zero()}!function(e){e.zero=function(){return{x:0,y:0,width:0,height:0}},e.create=function(e,t,r,n){return{x:e,y:t,width:r,height:n}},e.clone=function(e){return Ac({},e)},e.copy=function(e,t){return Object.assign(e,t)},e.set=function(e,t,r,n,i){return e.x=t,e.y=r,e.width=n,e.height=i,e},e.toVec4=function(e,t){return e[0]=t.x,e[1]=t.y,e[2]=t.width,e[3]=t.height,e},e.equals=function(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}}(h3||={});var p3=Ng();function m3(e,t,r,n){var i=r.x,a=r.y,o=r.width,s=r.height,u=t[0]-i,c=t[1]-a,l=t[2];return e[0]=2*u/o-1,e[1]=2*c/s-1,e[2]=2*l-1,Cg.transformMat4(e,e,n)}function g3(e){if("object"==typeof e){if("buttons"in e)return e.buttons;if("which"in e){var t=e.which;if(2===t)return 4;if(3===t)return 2;if(t>0)return 1<<t-1}}return 0}function v3(e){if("object"==typeof e&&"button"in e){var t=e.button;if(1===t)return 4;if(2===t)return 2;if(t>=0)return 1<<t}return 0}var y3,b3,_3={noScroll:!0,noMiddleClickScroll:!0,noContextMenu:!0,noPinchZo
139om:!0,noTextSelect:!0,preventGestures:!1,mask:function(e,t){return!0},pixelScale:1};(function(e){function t(e,t){return e.shift===t.shift&&e.alt===t.alt&&e.control===t.control&&e.meta===t.meta}function r(e){return void 0===e&&(e={}),{shift:!!e.shift,alt:!!e.alt,control:!!e.control,meta:!!e.meta}}e.None=r(),e.areEqual=t,e.areNone=function(r){return t(r,e.None)},e.size=function(e){if(!e)return 0;var t=0;return e.shift&&t++,e.alt&&t++,e.control&&t++,e.meta&&t++,t},e.create=r})(y3||={}),function(e){var t;e.has=Sd.has,e.create=Sd.create,(t=e.Flag||={})[t.None=0]="None",t[t.Primary=1]="Primary",t[t.Secondary=2]="Secondary",t[t.Auxilary=4]="Auxilary",t[t.Forth=8]="Forth",t[t.Five=16]="Five"}(b3||={});var x3,S3={key:"",code:"",modifiers:y3.None,x:-1,y:-1,pageX:-1,pageY:-1,preventDefault:nf};function w3(){return{drag:new P_,interactionEnd:new P_,click:new P_,move:new P_,wheel:new P_,pinch:new P_,gesture:new P_,resize:new P_,leave:new P_,enter:new P_,modifiers:new P_,key:new P_,keyUp:new P_,keyDown:new P_,lock:new P_}}!function(e){e[e.Stopped=0]="Stopped",e[e.Started=1]="Started",e[e.Moving=2]="Moving"}(x3||={});var A3,C3,T3,P3=["Backspace","Delete"];(function(e){e.create=function(e){void 0===e&&(e={});var t=Ac(Ac({},_3),e),r=t.noScroll,n=t.noContextMenu;return Ac(Ac({noScroll:r,noContextMenu:n,pointerLock:!1,width:0,height:0,pixelRatio:1},w3()),{requestPointerLock:nf,exitPointerLock:nf,dispose:nf})},e.fromElement=function(e,t){void 0===t&&(t={});var r=Ac(Ac({},_3),t),n=r.noScroll,i=r.noMiddleClickScroll,a=r.noContextMenu,o=r.noPinchZoom,s=r.noTextSelect,u=r.mask,c=r.pixelScale,l=r.preventGestures,d=e.clientWidth*A(),f=e.clientHeight*A(),h=!1,p=h3(),m=0,g=0,v=Bg(),y=Bg(),b=Bg(),_=Bg(),x=Bg(),S={shift:!1,alt:!1,control:!1,meta:!1},w={x:-1,y:-1,pageX:-1,pageY:-1};function A(){return window.devicePixelRatio*c}function C(){return Ac({},S)}function T(t){return t.target===document.body||t.target===e}var P,E=x3.Stopped,M=!1,k=b3.create(b3.Flag.None),I=b3.Flag.None,D=!1,O=!1;void 0!==window.ResizeObserver&&(P=new window.ResizeObserver(Pe));var R=w3(),B=R.drag,N=R.interactionEnd,F=R.wheel,L=R.pinch,$=R.gesture,U=R.click,j=R.move,z=R.leave,G=R.enter,V=R.resize,H=R.modifiers,q=R.key,W=R.keyUp,X=R.keyDown,Y=R.lock;function K(){Oe(h=e.ownerDocument.pointerLockElement===e),Y.next(h)}function Z(){console.error("Unable to use Pointer Lock API"),Oe(h=!1),Y.next(h)}function Q(e){u(e.clientX,e.clientY)&&a&&e.preventDefault()}function J(e){S.alt=e.altKey,S.shift=e.shiftKey,S.control=e.ctrlKey,S.meta=e.metaKey}function ee(){(k||S.shift||S.alt||S.meta||S.control)&&(k=0,S.shift=S.alt=S.control=S.meta=!1)}function te(e){var t=!1;!S.alt&&e.altKey&&(t=!0,S.alt=!0),!S.shift&&e.shiftKey&&(t=!0,S.shift=!0),!S.control&&e.ctrlKey&&(t=!0,S.control=!0),!S.meta&&e.metaKey&&(t=!0,S.meta=!0),t&&D&&H.next(C()),T(e)&&D&&X.next(Ac(Ac({key:e.key,code:e.code,modifiers:C()},w),{preventDefault:function(){return e.preventDefault()}}))}function re(e){var t=!1;S.alt&&!e.altKey&&(t=!0,S.alt=!1),S.shift&&!e.shiftKey&&(t=!0,S.shift=!1),S.control&&!e.ctrlKey&&(t=!0,S.control=!1),S.meta&&!e.metaKey&&(t=!0,S.meta=!1),t&&D&&H.next(C()),P3.includes(e.key)&&ne(e),T(e)&&D&&W.next(Ac(Ac({key:e.key,code:e.code,modifiers:C()},w),{preventDefault:function(){return e.preventDefault()}}))}function ne(e){T(e)&&D&&q.next(Ac(Ac({key:e.key,code:e.code,modifiers:C()},w),{preventDefault:function(){return e.preventDefault()}}))}function ie(e){var t=e.touches[0],r=e.touches[1];return{clientX:(t.clientX+r.clientX)/2,clientY:(t.clientY+r.clientY)/2,pageX:(t.pageX+r.pageX)/2,pageY:(t.pageY+r.pageY)/2,target:e.target}}function ae(e){var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;return Math.sqrt(t*t+r*r)}e.addEventListener("contextmenu",Q,!1),e.addEventListener("wheel",be,!1),e.addEventListener("mousedown",he,!1),window.addEventListener("mousemove",pe,!1),window.addEventListener("mouseup",me,!1),e.addEventListener("touchstart",le,!1),e.addEventListener("touchmove",fe,!1),e.addEventListener("touchend",de,!1),e.addEventListener("gesturechange",Ce,!1),e.addEventListener("gesturestart",we,!1),e.addEventListener("gestureend",Te,!1),window.addEventListener("blur",ee),window.addEventListener("keyup",re,!1),window.addEventListener("keydown",te,!1),window.addEventListener("keypress",ne,!1),document.addEventListener("pointerlockchange",K,!1),document.addEventListener("pointerlockerror",Z,!1),null==P?window.addEventListener("resize",Pe,!1):P.observe(e.parentElement);var oe=-1,se=void 0,ue=Bg(),ce=Bg();function le(e){if(e.preventDefault(),se=void 0,oe=-1,1===e.touches.length)oe=0,Bg.set(ue,e.touches[0].pageX,e.touches[0].pageY),se=e.touches[0],k=I=b3.Flag.Primary,ve(e.touches[0]);else if(2===e.touches.length){k=b3.Flag.Secondary&b3.Flag.Auxilary,I=b3.Flag.Secondary,ve(ie(e));var t=ae(e);m=t,L.next({distance:t,fraction:1,fractionDelta:0,delta:0,isStart:!0,buttons:k,button:I,modifiers:C()})}else 3===e.touches.length&&(k=I=b3.Flag.Forth,ve(ie(e)))}function de(e){if(ge(),se&&oe<=4){var t=se;if(!u(t.clientX,t.clientY))return;Me(ce,t);var r=ke(t),n=r.pageX,i=r.pageY,a=ce[0],o=ce[1];U.next({x:a,y:o,pageX:n,pageY:i,buttons:k,button:I,modifiers:C()})}se=void 0}function fe(e){if(I=b3.Flag.None,o&&(e.preventDefault(),e.stopPropagation(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())),se=void 0,1===e.touches.length)k=b3.Flag.Primary,se=e.touches[0],function(e){oe<0||(Bg.set(ce,e.touches[0].pageX,e.touches[0].pageY),oe+=Bg.distance(ue,ce),Bg.copy(ue,ce))}(e),ye(e.touches[0]);else if(2===e.touches.length){var t=ae(e),r=m-t;if(Math.abs(r)<4)k=b3.Flag.Secondary,ye(ie(e));else{k=b3.Flag.Auxilary,J(e);var n=m/t;L.next({delta:r,fraction:n,fractionDelta:g-n,distance:t,isStart:!1,buttons:k,button:I,modifiers:C()}),g=n}m=t}else 3===e.touches.length&&(k=b3.Flag.Forth,ye(ie(e)))}function he(e){J(e),k=g3(e),I=v3(e),i&&k===b3.Flag.Auxilary&&e.preventDefault,ve(e)}function pe(e){J(e),k=g3(e),I=b3.Flag.None,ye(e)}function me(e){J(e),k=g3(e),I=v3(e),function(e){if(E=x3.Stopped,u(e.clientX,e.clientY)){if(Me(b,e),!O&&Bg.distance(b,v)<4){var t=ke(e),r=t.pageX,n=t.pageY,i=b[0],a=b[1];U.next({x:i,y:a,pageX:r,pageY:n,buttons:k,button:I,modifiers:C()})}O=!1}}(e),ge()}function ge(){N.next(void 0)}function ve(e){u(e.clientX,e.clientY)&&(Me(y,e),Bg.copy(v,y),Ee(y)&&(E=x3.Started))}function ye(t){var r;Me(b,t);var n,i=ke(t),a=i.pageX,o=i.pageY,c=b[0],l=b[1],d=t.movementX,f=t.movementY,h=Ee(b)&&u(t.clientX,t.clientY);if(D&&!h?z.next(void 0):!D&&h&&G.next(void 0),D=h,w.x=c,w.y=l,w.pageX=a,w.pageY=o,j.next({x:c,y:l,pageX:a,pageY:o,movementX:d,movementY:f,buttons:k,button:I,modifiers:C(),inside:h,onElement:t.target===e}),!(E===x3.Stopped||(s&&(null==(r=t.preventDefault)||r.call(t)),Bg.div(_,Bg.sub(_,b,y),((n=x)[0]=e.clientWidth,n[1]=e.clientHeight,n)),Bg.magnitude(_)<vg))){var p=E===x3.Started;if(!p||u(t.clientX,t.clientY)){Bg.distance(b,v)>=4&&(O=!0);var m=_[0],g=_[1];B.next({x:c,y:l,dx:m,dy:g,pageX:a,pageY:o,buttons:k,button:I,modifiers:C(),isStart:p}),Bg.copy(y,b),E=x3.Moving}}}function be(e){if(u(e.clientX,e.clientY)){Me(b,e);var t=ke(e),r=t.pageX,i=t.pageY,a=b[0],o=b[1];n&&e.preventDefault();var s=function(e){var t=0,r=0,n=0,i=0,a=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120
139),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),n=10*t,i=10*r,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(n=e.deltaX),"deltaZ"in e&&(a=e.deltaZ),(n||i||a)&&e.deltaMode&&(1===e.deltaMode?(n*=40,i*=40,a*=40):(n*=800,i*=800,a*=800)),n&&!t&&(t=n<1?-1:1),i&&!r&&(r=i<1?-1:1),{spinX:t,spinY:r,dx:n,dy:i,dz:a}}(e);k=I=b3.Flag.Auxilary,(s.dx||s.dy||s.dz)&&F.next(Ac(Ac({x:a,y:o,pageX:r,pageY:i},s),{buttons:k,button:I,modifiers:C()}))}}function _e(e){var t,r;l&&(e.preventDefault(),null==(t=e.stopImmediatePropagation)||t.call(e),null==(r=e.stopPropagation)||r.call(e))}var xe=0,Se=0;function we(e){_e(e),xe=e.scale,Se=e.rotation,$.next({scale:e.scale,rotation:e.rotation,deltaRotation:0,deltaScale:0,isStart:!0})}function Ae(e,t){$.next({scale:e.scale,rotation:e.rotation,deltaRotation:Se-e.rotation,deltaScale:xe-e.scale,isEnd:t}),Se=e.rotation,xe=e.scale}function Ce(e){_e(e),Ae(e)}function Te(e){_e(e),Ae(e,!0)}function Pe(){V.next({})}function Ee(t){if(e instanceof Window||e instanceof Document||e===document.body)return!0;var r=e.getBoundingClientRect();return t[0]>=0&&t[1]>=0&&t[0]<r.width&&t[1]<r.height}function Me(t,r){if(d=e.clientWidth*A(),f=e.clientHeight*A(),h){var n=A();t[0]=(p.x+p.width/2)/n,t[1]=(f-(p.y+p.height/2))/n}else{var i=e.getBoundingClientRect();t[0]=(r.clientX||0)-i.left,t[1]=(r.clientY||0)-i.top}return t}function ke(e){return h?{pageX:Math.round(window.innerWidth/2)+p.x,pageY:Math.round(window.innerHeight/2)+p.y}:{pageX:e.pageX,pageY:e.pageY}}var Ie=30,De=function(){var t,r=document.createElement("div"),n="#000 30%, #0000 0 calc(100% - 30%), #000 0",i=`linear-gradient(0deg, ${n}) 50%/10% 100% no-repeat`,a=`linear-gradient(90deg, ${n}) 50%/100% 10% no-repeat`;return Object.assign(r.style,{width:`${Ie}px`,aspectRatio:1,background:`${i}, ${a}, radial-gradient(circle at 50%, #000 5%, #0000 5%)`,display:"none",zIndex:1e3,position:"absolute",mixBlendMode:"difference",filter:"invert(1)"}),null==(t=e.parentElement)||t.appendChild(r),r}();function Oe(e){if(De.style.display=e?"block":"none",e){var t=A(),r=(p.x+p.width/2)/t,n=(p.y+p.height/2)/t;De.style.width=`${Ie}px`,De.style.left=`calc(${r}px - ${Ie/2}px)`,De.style.bottom=`calc(${n}px - ${Ie/2}px)`}}return Ac(Ac({get noScroll(){return n},set noScroll(e){n=e},get noContextMenu(){return a},set noContextMenu(e){a=e},get width(){return d},get height(){return f},get pixelRatio(){return A()},get pointerLock(){return h}},R),{requestPointerLock:function(t){p=t,h||e.requestPointerLock()},exitPointerLock:function(){h&&e.ownerDocument.exitPointerLock()},dispose:function(){M||(M=!0,e.removeEventListener("contextmenu",Q,!1),e.removeEventListener("wheel",be,!1),e.removeEventListener("mousedown",he,!1),window.removeEventListener("mousemove",pe,!1),window.removeEventListener("mouseup",me,!1),e.removeEventListener("touchstart",le,!1),e.removeEventListener("touchmove",fe,!1),e.removeEventListener("touchend",de,!1),e.removeEventListener("gesturechange",Ce,!1),e.removeEventListener("gesturestart",we,!1),e.removeEventListener("gestureend",Te,!1),window.removeEventListener("blur",ee),window.removeEventListener("keyup",re,!1),window.removeEventListener("keydown",te,!1),window.removeEventListener("keypress",ne,!1),document.removeEventListener("pointerlockchange",K,!1),document.removeEventListener("pointerlockerror",Z,!1),De.remove(),null==P?window.removeEventListener("resize",Pe,!1):(P.unobserve(e.parentElement),P.disconnect()))}})}})(A3||={}),function(e){e[e.None=0]="None",e[e.Object=1]="Object",e[e.Instance=2]="Instance",e[e.Group=3]="Group"}(C3||={}),function(e){e[e.None=0]="None",e[e.Depth=1]="Depth",e[e.Mask=2]="Mask"}(T3||={});var E3,M3={backgroundColor:Ib.Color(tv(0),{description:"Background color of the 3D canvas"}),pickingAlphaThreshold:Ib.Numeric(.5,{min:0,max:1,step:.01},{description:"The minimum opacity value needed for an object to be pickable."}),interiorDarkening:Ib.Numeric(.5,{min:0,max:1,step:.01}),interiorColorFlag:Ib.Boolean(!0,{label:"Use Interior Color"}),interiorColor:Ib.Color(tv.fromNormalizedRgb(.3,.3,.3)),colorMarker:Ib.Boolean(!0,{description:"Enable color marker"}),highlightColor:Ib.Color(tv.fromNormalizedRgb(1,.4,.6)),selectColor:Ib.Color(tv.fromNormalizedRgb(.2,1,.1)),dimColor:Ib.Color(tv.fromNormalizedRgb(1,1,1)),highlightStrength:Ib.Numeric(.3,{min:0,max:1,step:.1}),selectStrength:Ib.Numeric(.3,{min:0,max:1,step:.1}),dimStrength:Ib.Numeric(0,{min:0,max:1,step:.1}
139),markerPriority:Ib.Select(1,[[1,"Highlight"],[2,"Select"]]),xrayEdgeFalloff:Ib.Numeric(1,{min:0,max:3,step:.1}),exposure:Ib.Numeric(1,{min:0,max:3,step:.01}),light:Ib.ObjectList({inclination:Ib.Numeric(150,{min:0,max:180,step:1}),azimuth:Ib.Numeric(320,{min:0,max:360,step:1}),color:Ib.Color(tv.fromNormalizedRgb(1,1,1)),intensity:Ib.Numeric(.6,{min:0,max:5,step:.01})},function(e){return tv.toHexString(e.color)},{defaultValue:[{inclination:150,azimuth:320,color:tv.fromNormalizedRgb(1,1,1),intensity:.6}]}),ambientColor:Ib.Color(tv.fromNormalizedRgb(1,1,1)),ambientIntensity:Ib.Numeric(.4,{min:0,max:2,step:.01})},k3=Cg(),I3=Cg();function D3(e,t){for(var r=e.length,n=t||{direction:Array(3*r).fill(0),color:Array(3*r).fill(0)},i=n.direction,a=n.color,o=0;o<r;++o){var s=e[o];Cg.directionFromSpherical(k3,Mg(s.inclination),Mg(s.azimuth),1),Cg.toArray(k3,i,3*o),Cg.scale(I3,tv.toVec3Normalized(I3,s.color),s.intensity),Cg.toArray(I3,a,3*o)}return{count:r,direction:i,color:a}}function O3(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=""),O3.create(e,t,r)}(function(e){e.create=function(e,t){void 0===t&&(t={});var r=e.gl,n=e.state,i=e.stats,a=Ib.merge(M3,Ib.getDefaultValues(M3),t),o=D3(a.light),s=h3(),u=Bg.create(r.drawingBufferWidth,r.drawingBufferHeight),c=tv.toVec3Normalized(Cg(),a.backgroundColor),l=!1,d=e.resources.texture("image-uint8","rgba","ubyte","nearest");d.define(1,1),d.load({array:new Uint8Array([255,255,255,255]),width:1,height:1});var f=[["tDepth",d]],h=Og(),p=Og(),m=Og(),g=Og(),v=Og(),y=Og(),b=Og(),_=Cg(),x=Bg(),S=Cg();Cg.scale(S,tv.toArrayNormalized(a.ambientColor,S,0),a.ambientIntensity);var w={uModel:tf.create(Og.identity()),uView:tf.create(h),uInvView:tf.create(p),uModelView:tf.create(m),uInvModelView:tf.create(g),uInvProjection:tf.create(v),uProjection:tf.create(Og()),uModelViewProjection:tf.create(y),uInvModelViewProjection:tf.create(b),uIsOrtho:tf.create(1),uViewOffset:tf.create(x),uPixelRatio:tf.create(e.pixelRatio),uViewport:tf.create(h3.toVec4(Ng(),s)),uDrawingBufferSize:tf.create(u),uCameraPosition:tf.create(Cg()),uCameraDir:tf.create(_),uNear:tf.create(1),uFar:tf.create(1e4),uFog:tf.create(!0),uFogNear:tf.create(1),uFogFar:tf.create(1e4),uFogColor:tf.create(c),uRenderMask:tf.create(0),uMarkingDepthTest:tf.create(!1),uPickType:tf.create(C3.None),uMarkingType:tf.create(T3.None),uTransparentBackground:tf.create(!1),uLightDirection:tf.create(o.direction),uLightColor:tf.create(o.color),uAmbientColor:tf.create(S),uPickingAlphaThreshold:tf.create(a.pickingAlphaThreshold),uInteriorDarkening:tf.create(a.interiorDarkening),uInteriorColorFlag:tf.create(a.interiorColorFlag),uInteriorColor:tf.create(tv.toVec3Normalized(Cg(),a.interior
139Color)),uHighlightColor:tf.create(tv.toVec3Normalized(Cg(),a.highlightColor)),uSelectColor:tf.create(tv.toVec3Normalized(Cg(),a.selectColor)),uDimColor:tf.create(tv.toVec3Normalized(Cg(),a.dimColor)),uHighlightStrength:tf.create(a.highlightStrength),uSelectStrength:tf.create(a.selectStrength),uDimStrength:tf.create(a.dimStrength),uMarkerPriority:tf.create(a.markerPriority),uMarkerAverage:tf.create(0),uXrayEdgeFalloff:tf.create(a.xrayEdgeFalloff),uExposure:tf.create(a.exposure)},A=Object.entries(w),C=!0,T=function(e,t,i){if(!e.state.disposed&&e.state.visible&&(e.state.pickable||"pick"!==t)){var s=!1;e.values.dLightCount.ref.value!==o.count&&(tf.update(e.values.dLightCount,o.count),s=!0),e.values.dColorMarker.ref.value!==a.colorMarker&&(tf.update(e.values.dColorMarker,a.colorMarker),s=!0),s&&e.update();var u=e.getProgram(t);if(n.currentProgramId!==u.id&&(C=!0,u.use()),C&&=(u.setUniforms(A),u.bindTextures(f,0),!1),"directVolume"===e.values.dGeometryType.ref.value){if("colorDpoit"!==t&&"colorWboit"!==t&&"colorBlended"!==t)return;n.disable(r.CULL_FACE),n.frontFace(r.CCW),"colorBlended"===t&&(n.disable(r.DEPTH_TEST),n.depthMask(!1))}else 1===i?(n.enable(r.CULL_FACE),e.values.dFlipSided?.ref.value?(n.frontFace(r.CW),n.cullFace(r.FRONT)):(n.frontFace(r.CCW),n.cullFace(r.BACK))):2===i?(n.enable(r.CULL_FACE),e.values.dFlipSided?.ref.value?(n.frontFace(r.CW),n.cullFace(r.BACK)):(n.frontFace(r.CCW),n.cullFace(r.FRONT))):(e.values.uDoubleSided?e.values.uDoubleSided.ref.value||e.values.hasReflection.ref.value?n.disable(r.CULL_FACE):n.enable(r.CULL_FACE):n.disable(r.CULL_FACE),e.values.dFlipSided?.ref.value?(n.frontFace(r.CW),n.cullFace(r.FRONT)):(n.frontFace(r.CCW),n.cullFace(r.BACK)));e.render(t,f.length)}},P=function(e,t,i,a,o){Yb(f,"tDepth",i||d),tf.update(w.uModel,e.view),tf.update(w.uModelView,Og.mul(m,t.view,e.view)),tf.update(w.uInvModelView,Og.invert(g,m)),tf.update(w.uModelViewProjection,Og.mul(y,m,t.projection)),tf.update(w.uInvModelViewProjection,Og.invert(b,y)),tf.updateIfChanged(w.uRenderMask,a),tf.updateIfChanged(w.uMarkingDepthTest,o),n.enable(r.SCISSOR_TEST),n.colorMask(!0,!0,!0,!0);var u=s.x,c=s.y,l=s.width,h=s.height;n.viewport(u,c,l,h),n.scissor(u,c,l,h),C=!0,n.currentRenderItemId=-1},E=function(e,t,i){var a;n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,1,!1);for(var o=e.renderables,s=0,u=o.length;s<u;++s){var c=o[s];c.state.opaque?T(c,"colorBlended",0):null!=(a=c.values.uDoubleSided)&&a.ref.value&&"opaque"===c.values.dTransparentBackfaces?.ref.value&&T(c,"colorBlended",2)}},M=function(e,t,i){n.enable(r.DEPTH_TEST),P(e,t,i,2,!1);var a=e.renderables;l?n.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA):n.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),n.enable(r.BLEND),n.depthMask(!0);for(var o=0,s=a.length;o<s;++o)!(u=a[o]).state.opaque&&u.state.writeDepth&&T(u,"colorBlended",0);for(n.depthMask(!1),o=0,s=a.length;o<s;++o){var u;(!(u=a[o]).state.opaque&&!u.state.writeDepth||u.values.transparencyAverage.ref.value>0)&&(u.values.uDoubleSided?.ref.value?("opaque"!==u.values.dTransparentBackfaces?.ref.value&&T(u,"colorBlended",2),T(u,"colorBlended",1)):T(u,"colorBlended",0))}};return{clear:function(e,t){n.enable(r.SCISSOR_TEST),n.enable(r.DEPTH_TEST),n.colorMask(!0,!0,!0,!0),n.depthMask(!0),l&&!t?n.clearColor(0,0,0,0):e?n.clearColor(c[0],c[1],c[2],1):n.clearColor(1,1,1,1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)},clearDepth:function(e){void 0===e&&(e=!1),n.enable(r.SCISSOR_TEST),e?(n.colorMask(!0,!0,!0,!0),n.clearColor(1,1,1,1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)):(n.enable(r.DEPTH_TEST),n.depthMask(!0),r.clear(r.DEPTH_BUFFER_BIT))},update:function(e,t){tf.update(w.uView,e.view),tf.update(w.uInvView,Og.invert(p,e.view)),tf.update(w.uProjection,e.projection),tf.update(w.uInvProjection,Og.invert(v,e.projection)),tf.updateIfChanged(w.uIsOrtho,+("orthographic"===e.state.mode)),tf.update(w.uViewOffset,e.viewOffset.enabled?Bg.set(x,16*e.viewOffset.offsetX,16*e.viewOffset.offsetY):Bg.set(x,0,0)),tf.update(w.uCameraPosition,e.state.position),tf.update(w.uCameraDir,Cg.normalize(_,Cg.sub(_,e.state.target,e.state.position))),tf.updateIfChanged(w.uFar,e.far),tf.updateIfChanged(w.uNear,e.near),tf.updateIfChanged(w.uFogFar,e.fogFar),tf.updateIfChanged(w.uFogNear,e.fogNear),tf.updateIfChanged(w.uTransparentBackgroun
139d,l),tf.updateIfChanged(w.uMarkerAverage,t.markerAverage)},renderPick:function(e,t,i,a,o){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,a,0,!1),tf.updateIfChanged(w.uPickType,o);for(var s=e.renderables,u=0,c=s.length;u<c;++u)s[u].state.colorOnly||T(s[u],i,0)},renderDepth:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,0,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o)T(a[o],"depth",0)},renderDepthOpaque:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,1,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o],c="on"===u.values.dXrayShaded?.ref.value||"inverted"===u.values.dXrayShaded?.ref.value;u.state.opaque&&1!==u.values.transparencyAverage.ref.value&&!c&&T(u,"depth",0)}},renderDepthTransparent:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,2,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o],c="on"===u.values.dXrayShaded?.ref.value||"inverted"===u.values.dXrayShaded?.ref.value;(!u.state.opaque||u.values.transparencyAverage.ref.value>0||c)&&T(u,"depth",0)}},renderMarkingDepth:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,0,!1),tf.updateIfChanged(w.uMarkingType,T3.Depth);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o];0!==bg(u.values.alpha.ref.value*u.state.alphaFactor,0,1)&&1!==u.values.markerAverage.ref.value&&T(a[o],"marking",0)}},renderMarkingMask:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,0,!!i),tf.updateIfChanged(w.uMarkingType,T3.Mask);for(var a=e.renderables,o=0,s=a.length;o<s;++o)a[o].values.markerAverage.ref.value>0&&T(a[o],"marking",0)},renderBlended:function(e,t){e.hasOpaque&&E(e,t,null),e.opacityAverage<1&&M(e,t,null)},renderBlendedOpaque:E,renderBlendedTransparent:M,renderBlendedVolume:function(e,t,i){n.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),n.enable(r.BLEND),P(e,t,i,2,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o];"directVolume"===u.values.dGeometryType.ref.value&&T(u,"colorBlended",0)}},renderWboitOpaque:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,1,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o],c=bg(u.values.alpha.ref.value*u.state.alphaFactor,0,1),l="on"===u.values.dXrayShaded?.ref.value||"inverted"===u.values.dXrayShaded?.ref.value;(1===c&&1!==u.values.transparencyAverage.ref.value&&"directVolume"!==u.values.dGeometryType.ref.value&&"fuzzy"!==u.values.dPointStyle?.ref.value&&!l||"opaque"===u.values.dTransparentBackfaces?.ref.value)&&T(u,"colorWboit",0)}},renderWboitTransparent:function(e,t,r){P(e,t,r,2,!1);for(var n=e.renderables,i=0,a=n.length;i<a;++i){var o=n[i],s=bg(o.values.alpha.ref.value*o.state.alphaFactor,0,1),u="on"===o.values.dXrayShaded?.ref.value||"inverted"===o.values.dXrayShaded?.ref.value;(s<1&&0!==s||o.values.transparencyAverage.ref.value>0||"directVolume"===o.values.dGeometryType.ref.value||"fuzzy"===o.values.dPointStyle?.ref.value||"text"===o.values.dGeometryType.ref.value||u)&&T(o,"colorWboit",0)}},renderDpoitOpaque:function(e,t,i){n.disable(r.BLEND),n.enable(r.DEPTH_TEST),n.depthMask(!0),P(e,t,i,1,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o],c=bg(u.values.alpha.ref.value*u.state.alphaFactor,0,1),l="on"===u.values.dXrayShaded?.ref.value||"inverted"===u.values.dXrayShaded?.ref.value;(1===c&&1!==u.values.transparencyAverage.ref.value&&"fuzzy"!==u.values.dPointStyle?.ref.value&&!l||"opaque"===u.values.dTransparentBackfaces?.ref.value)&&T(u,"colorDpoit",0)}},renderDpoitTransparent:function(e,t,i,a){n.enable(r.BLEND),Yb(f,"tDpoitDepth",a.depth),Yb(f,"tDpoitFrontColor",a.frontColor),Yb(f,"tDpoitBackColor",a.backColor),P(e,t,i,2,!1);for(var o=e.renderables,s=0,u=o.length;s<u;++s){var c=o[s],l=bg(c.values.alpha.ref.value*c.state.alphaFactor,0,1),d="on"===c.values.dXrayShaded?.ref.value||"inverted"===c.values.dXrayShaded?.ref.value;(l<1&&0!==l||c.values.transparencyAverage.ref.value>0||"fuzzy"===c.values.dPointStyle?.ref.value||"text"===c.values.dGeometryType.ref.value||d)&&T(c,"colorDpoit",0)}},renderDpoitVolume:function(e,t,i){n.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),n.enable(r.BLEND),P(e,t,i,2,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var u=a[o];"directVolume"===u.values.dGeometryType.ref.value&&T(u,"colorDpoit",0)}},setProps:function(e){void 0!==e.backgroundColor&&e.backgroundColor!==a.backgroundColor&&(a.backgroundColor=e.backgroundColor,tv.toVec3Normalized(c,a.backgroundColor),tf.update(w.uFogColor,Cg.copy(w.uFogColor.ref.value,c))),void 0!==e.pickingAlphaThreshold&&e.pickingAlphaThreshold!==a.pickingAlphaThreshold&&(a.pickingAlphaThreshold=e.pickingAlphaThreshold,tf.update(w.uPickingAlphaThreshold,a.pickingAlphaThreshold)),void 0!==e.interiorDarkening&&e.interiorDarkening!==a.interiorDarkening&&(a.interiorDarkening=e.interiorDarkening,tf.update(w.uInteriorDarkening,a.interiorDarkening)),void 0!==e.interior
139ColorFlag&&e.interiorColorFlag!==a.interiorColorFlag&&(a.interiorColorFlag=e.interiorColorFlag,tf.update(w.uInteriorColorFlag,a.interiorColorFlag)),void 0!==e.interiorColor&&e.interiorColor!==a.interiorColor&&(a.interiorColor=e.interiorColor,tf.update(w.uInteriorColor,tv.toVec3Normalized(w.uInteriorColor.ref.value,a.interiorColor))),void 0!==e.colorMarker&&e.colorMarker!==a.colorMarker&&(a.colorMarker=e.colorMarker),void 0!==e.highlightColor&&e.highlightColor!==a.highlightColor&&(a.highlightColor=e.highlightColor,tf.update(w.uHighlightColor,tv.toVec3Normalized(w.uHighlightColor.ref.value,a.highlightColor))),void 0!==e.selectColor&&e.selectColor!==a.selectColor&&(a.selectColor=e.selectColor,tf.update(w.uSelectColor,tv.toVec3Normalized(w.uSelectColor.ref.value,a.selectColor))),void 0!==e.dimColor&&e.dimColor!==a.dimColor&&(a.dimColor=e.dimColor,tf.update(w.uDimColor,tv.toVec3Normalized(w.uDimColor.ref.value,a.dimColor))),void 0!==e.highlightStrength&&e.highlightStrength!==a.highlightStrength&&(a.highlightStrength=e.highlightStrength,tf.update(w.uHighlightStrength,a.highlightStrength)),void 0!==e.selectStrength&&e.selectStrength!==a.selectStrength&&(a.selectStrength=e.selectStrength,tf.update(w.uSelectStrength,a.selectStrength)),void 0!==e.dimStrength&&e.dimStrength!==a.dimStrength&&(a.dimStrength=e.dimStrength,tf.update(w.uDimStrength,a.dimStrength)),void 0!==e.markerPriority&&e.markerPriority!==a.markerPriority&&(a.markerPriority=e.markerPriority,tf.update(w.uMarkerPriority,a.markerPriority)),void 0!==e.xrayEdgeFalloff&&e.xrayEdgeFalloff!==a.xrayEdgeFalloff&&(a.xrayEdgeFalloff=e.xrayEdgeFalloff,tf.update(w.uXrayEdgeFalloff,a.xrayEdgeFalloff)),void 0!==e.exposure&&e.exposure!==a.exposure&&(a.exposure=e.exposure,tf.update(w.uExposure,a.exposure)),void 0===e.light||cf(e.light,a.light)||(a.light=e.light,Object.assign(o,D3(e.light,o)),tf.update(w.uLightDirection,o.direction),tf.update(w.uLightColor,o.color)),void 0!==e.ambientColor&&e.ambientColor!==a.ambientColor&&(a.ambientColor=e.ambientColor,Cg.scale(S,tv.toArrayNormalized(a.ambientColor,S,0),a.ambientIntensity),tf.update(w.uAmbientColor,S)),void 0!==e.ambientIntensity&&e.ambientIntensity!==a.ambientIntensity&&(a.ambientIntensity=e.ambientIntensity,Cg.scale(S,tv.toArrayNormalized(a.ambientColor,S,0),a.ambientIntensity),tf.update(w.uAmbientColor,S))},setViewport:function(e,t,r,i){n.viewport(e,t,r,i),n.scissor(e,t,r,i),e===s.x&&t===s.y&&r===s.width&&i===s.height||(h3.set(s,e,t,r,i),tf.update(w.uViewport,Ng.set(w.uViewport.ref.value,e,t,r,i)))},setTransparentBackground:function(e){l=e},setDrawingBufferSize:function(e,t){e===u[0]&&t===u[1]||tf.update(w.uDrawingBufferSize,Bg.set(u,e,t))},setPixelRatio:function(e){tf.update(w.uPixelRatio,e)},props:a,get stats(){return{programCount:e.stats.resourceCounts.program,shaderCount:e.stats.resourceCounts.shader,attributeCount:e.stats.resourceCounts.attribute,elementsCount:e.stats.resourceCounts.elements,framebufferCount:e.stats.resourceCounts.framebuffer,renderbufferCount:e.stats.resourceCounts.renderbuffer,textureCount:e.stats.resourceCounts.texture,vertexArrayCount:e.stats.resourceCounts.vertexArray,drawCount:i.drawCount,instanceCount:i.instanceCount,instancedDrawCount:i.instancedDrawCount}},get light(){return o},dispose:function(){}}}})(E3||={}),function(e){function t(e){return e.triggers.map(r.format).join(" or ")}function r(e,t){return r.create(e,t)}e.create=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=""),{triggers:e,action:t,description:r}},e.isBinding=function(e){return!!e&&Array.isArray(e.triggers)&&"string"==typeof e.action},e.Empty={triggers:[],action:"",description:""},e.isEmpty=function(e){return 0===e.triggers.length||e.triggers.every(function(e){return void 0===e.buttons&&void 0===e.modifiers&&!e.code})},e.match=function(e,t,n){return e.triggers.some(function(e){return r.match(e,t,n)})},e.matchKey=function(e,t,n,i){return e.triggers.some(function(e){return r.matchKey(e,t,n,i)})},e.formatTriggers=t,e.format=function(e,r){return void 0===r&&(r=""),function(e,t){var r=Object.keys(t),n=Object.values(t);return(new(Function.bind.apply(Function,kc(kc([void 0],r,!1),[`return \`${e}\`;`],!1)))).apply(void 0,n)}(e.description||Yg(r),{triggers:"<i>"+t(e)+"</i>"})},e.Trigger=r,e.TriggerKey=function(e,t){return r.create(void 0,t,e)},function(e){e.create=function(e,t,r){return{buttons:e,modifiers:t,code:r}},e.Empty={},e.match=function(e,t,r){var n=e.buttons,i=e.modifiers;return void 0!==n&&(n===t||b3.has(n,t))&&(!i||y3.areEqual(i,r))},e.matchKey=function(e,t,r,n){var i=e.modifiers,a=e.code;return void 0!==a&&(a===t||1===a.length&&4===t.length&&t.startsWith("Key")&&!!n&&1===n.length&&n.toUpperCase()===a.toUpperCase())&&(!i||y3.areEqual(i,r))},e.format=function(e){var t=[],r=function(e,t){var r=[];return void 0!==e||t?0===e?r.push("mouse hover"):void 0!==e&&(N3.has(e,N3.Flag.Primary)&&r.push("left mouse button"),N3.has(e,N3.Flag.Secondary)&&r.push("right mouse button"),N3.has(e,N3.Flag.Auxilary)&&r.push("wheel/middle mouse button"),N3.has(e,N3.Flag.Forth)&&r.push("three fingers")):r.push("any mouse button"),r.join(" + ")}(e.buttons,e.code);r&&t.push(r);var n=function(e){return null!=e&&e.startsWith("Key")&&(e=e.substring(3)),e&&function(e){return Xg(qg(e))}(e).toLowerCase()}(e.code);
139n&&t.push(n);var i=function(e){var t=[];return e&&(e.alt&&t.push("alt key"),e.control&&t.push("control key"),e.meta&&t.push("meta/command key"),e.shift&&t.push("shift key")),t.join(" + ")}(e.modifiers);return i&&t.push(i),t.join(" + ")}}(r=e.Trigger||={})}(O3||={});var R3,B3,N3=b3,F3=b3,L3=y3,$3=O3.Trigger,U3=O3.TriggerKey,j3={dragRotate:O3([$3(F3.Flag.Primary,L3.create())],"Rotate","Drag using ${triggers}"),dragRotateZ:O3([$3(F3.Flag.Primary,L3.create({shift:!0,control:!0}))],"Rotate around z-axis (roll)","Drag using ${triggers}"),dragPan:O3([$3(F3.Flag.Secondary,L3.create()),$3(F3.Flag.Primary,L3.create({control:!0}))],"Pan","Drag using ${triggers}"),dragZoom:O3.Empty,dragFocus:O3([$3(F3.Flag.Forth,L3.create())],"Focus","Drag using ${triggers}"),dragFocusZoom:O3([$3(F3.Flag.Auxilary,L3.create())],"Focus and zoom","Drag using ${triggers}"),scrollZoom:O3([$3(F3.Flag.Auxilary,L3.create())],"Zoom","Scroll using ${triggers}"),scrollFocus:O3([$3(F3.Flag.Auxilary,L3.create({shift:!0}))],"Clip","Scroll using ${triggers}"),scrollFocusZoom:O3.Empty,keyMoveForward:O3([U3("KeyW")],"Move forward","Press ${triggers}"),keyMoveBack:O3([U3("KeyS")],"Move back","Press ${triggers}"),keyMoveLeft:O3([U3("KeyA")],"Move left","Press ${triggers}"),keyMoveRight:O3([U3("KeyD")],"Move right","Press ${triggers}"),keyMoveUp:O3([U3("KeyR")],"Move up","Press ${triggers}"),keyMoveDown:O3([U3("KeyF")],"Move down","Press ${triggers}"),keyRollLeft:O3([U3("KeyQ")],"Roll left","Press ${triggers}"),keyRollRight:O3([U3("KeyE")],"Roll right","Press ${triggers}"),keyPitchUp:O3([U3("ArrowUp",L3.create({shift:!0}))],"Pitch up","Press ${triggers}"),keyPitchDown:O3([U3("ArrowDown",L3.create({shift:!0}))],"Pitch down","Press ${triggers}"),keyYawLeft:O3([U3("ArrowLeft",L3.create({shift:!0}))],"Yaw left","Press ${triggers}"),keyYawRight:O3([U3("ArrowRight",L3.create({shift:!0}))],"Yaw right","Press ${triggers}"),boostMove:O3([U3("ShiftLeft")],"Boost move","Press ${triggers}"),enablePointerLock:O3([U3("Space",L3.create({control:!0}))],"Enable pointer lock","Press ${triggers}")},z3={noScroll:Ib.Boolean(!0,{isHidden:!0}),rotateSpeed:Ib.Numeric(5,{min:1,max:10,step:1}),zoomSpeed:Ib.Numeric(7,{min:1,max:15,step:1}),panSpeed:Ib.Numeric(1,{min:.1,max:5,step:.1}),moveSpeed:Ib.Numeric(.75,{min:.1,max:3,step:.1}),boostMoveFactor:Ib.Numeric(5,{min:.1,max:10,step:.1}),flyMode:Ib.Boolean(!1),animate:Ib.MappedStatic("off",{off:Ib.EmptyGroup(),spin:Ib.Group({speed:Ib.Numeric(1,{min:-20,max:20,step:1})},{description:"Spin the 3D scene around the x-axis in view space"}),rock:Ib.Group({speed:Ib.Numeric(.3,{min:-5,max:5,step:.1}),angle:Ib.Numeric(10,{min:0,max:90,step:1},{description:"How many degrees to rotate in each direction."})},{description:"Rock the 3D scene around the x-axis in view space"})}),staticMoving:Ib.Boolean(!0,{isHidden:!0}),dynamicDampingFactor:Ib.Numeric(.2,{},{isHidden:!0}),minDistance:Ib.Numeric(.01,{},{isHidden:!0}),maxDistance:Ib.Numeric(1e150,{},{isHidden:!0}),gestureScaleFactor:Ib.Numeric(1,{},{isHidden:!0}),maxWheelDelta:Ib.Numeric(.02,{},{isHidden:!0}),bindings:Ib.Value(j3,{isHidden:!0}),autoAdjustMinMaxDistance:Ib.MappedStatic("on",{off:Ib.EmptyGroup(),on:Ib.Group({minDistanceFactor:Ib.Numeric(0),minDistancePadding:Ib.Numeric(5),maxDistanceFactor:Ib.Numeric(10),maxDistanceMin:Ib.Numeric(20)})},{isHidden:!0})};(function(e){e.create=function(e,t,r,n){void 0===n&&(n={});var i=Ac(Ac(Ac({},Ib.getDefaultValues(z3)),n),{bindings:Ac(Ac({},j3),n.bindings)}),a=i.bindings,o=h3.clone(t.viewport),s=!1,u=e.drag.subscribe(function(r){var n=r.x,i=r.y,s=r.pageX,u=r.pageY,c=r.buttons,l=r.modifiers,d=r.isStart,f=ue(n,i);if((!d||!f)&&(d||y)){y=!0,ge();var h=O3.match(a.dragRotate,c,l),p=O3.match(a.dragRotateZ,c,l),m=O3.match(a.dragPan,c,l),g=O3.match(a.dragZoom,c,l),v=O3.match(a.dragFocus,c,l),b=O3.match(a.dragFocusZoom,c,l);j(s,u),function(e,t){Bg.set($,(e-o.x)/o.width,(t-o.y)/o.height)}(s,u);var _=e.pixelRatio,w=(n*_-o.width/2-o.x)/o.width,A=-(e.height-i*_-o.height/2-o.y)/o.height;if(d&&(h&&(Bg.copy(S,U),Bg.copy(x,S)),p&&(Bg.set(T,w,A),Bg.copy(C,T)),(g||b)&&(Bg.copy(k,$),Bg.copy(I,k)),v&&(Bg.copy(D,$),Bg.copy(O,D)),m&&(Bg.copy(R,$),Bg.copy(B,R))),h&&Bg.copy(S,U),p&&Bg.set(T,w,A),(g||b)&&Bg.copy(I,$),v&&Bg.copy(O,$),b){var P=Cg.distance(t.state.position,t.state.target);t.setState({radius:P/5})}m&&Bg.copy(B,$)}}),c=e.interactionEnd.subscribe(function(){y=!1}),l=e.wheel.subscribe(function(e){var t=e.x,r=e.y,n=e.spinX,o=e.spinY,s=e.dz,u=e.buttons,c=e.modifiers;if(!ue(t,r)){var l=function(){for(var e=[...arguments],t=0,r=0,n=0,i=e.length;n<i;++n){var a=e[n],o=Math.abs(a);o>r&&(t=a,r=o)}return t}(.075*n,.075*o,1e-4*s);l<-i.maxWheelDelta?l=-i.maxWheelDelta:l>i.maxWheelDelta&&(l=i.maxWheelDelta),O3.match(a.scrollZoom,u,c)&&(I[1]+=l),O3.match(a.scrollFocus,u,c)&&(O[1]+=l)}}),d=e.pinch.subscribe(function(e){var t=e.fractionDelta,r=e.buttons,n=e.modifiers;O3.match(a.scrollZoom,r,n)&&(y=!0,I[1]+=i.gestureScaleFactor*t)}),f=e.gesture.subscribe(function(e){var t=e.deltaScale;y=!0,I[1]+=i.gestureScaleFactor*t}
139),h=e.keyDown.subscribe(function(t){var r=t.modifiers,n=t.code,i=t.key;ue(t.x,t.y)||(O3.matchKey(a.keyMoveForward,n,r,i)?ie.moveForward=1:O3.matchKey(a.keyMoveBack,n,r,i)?ie.moveBack=1:O3.matchKey(a.keyMoveLeft,n,r,i)?ie.moveLeft=1:O3.matchKey(a.keyMoveRight,n,r,i)?ie.moveRight=1:O3.matchKey(a.keyMoveUp,n,r,i)?ie.moveUp=1:O3.matchKey(a.keyMoveDown,n,r,i)?ie.moveDown=1:O3.matchKey(a.keyRollLeft,n,r,i)?ie.rollLeft=1:O3.matchKey(a.keyRollRight,n,r,i)?ie.rollRight=1:O3.matchKey(a.keyPitchUp,n,r,i)?ie.pitchUp=1:O3.matchKey(a.keyPitchDown,n,r,i)?ie.pitchDown=1:O3.matchKey(a.keyYawLeft,n,r,i)?ie.yawLeft=1:O3.matchKey(a.keyYawRight,n,r,i)&&(ie.yawRight=1),O3.matchKey(a.boostMove,n,r,i)&&(ie.boostMove=1),O3.matchKey(a.enablePointerLock,n,r,i)&&e.requestPointerLock(o))}),p=e.keyUp.subscribe(function(e){var t=e.modifiers,r=e.code,n=e.key;if(!ue(e.x,e.y)){var i=!1;r.startsWith("Alt")?(i=!0,t.alt=!0):r.startsWith("Shift")?(i=!0,t.shift=!0):r.startsWith("Control")?(i=!0,t.control=!0):r.startsWith("Meta")&&(i=!0,t.meta=!0);var o=[];i?(ie.moveForward&&o.push(a.keyMoveForward.triggers[0]?.code||""),ie.moveBack&&o.push(a.keyMoveBack.triggers[0]?.code||""),ie.moveLeft&&o.push(a.keyMoveLeft.triggers[0]?.code||""),ie.moveRight&&o.push(a.keyMoveRight.triggers[0]?.code||""),ie.moveUp&&o.push(a.keyMoveUp.triggers[0]?.code||""),ie.moveDown&&o.push(a.keyMoveDown.triggers[0]?.code||""),ie.rollLeft&&o.push(a.keyRollLeft.triggers[0]?.code||""),ie.rollRight&&o.push(a.keyRollRight.triggers[0]?.code||""),ie.pitchUp&&o.push(a.keyPitchUp.triggers[0]?.code||""),ie.pitchDown&&o.push(a.keyPitchDown.triggers[0]?.code||""),ie.yawLeft&&o.push(a.keyYawLeft.triggers[0]?.code||""),ie.yawRight&&o.push(a.keyYawRight.triggers[0]?.code||"")):o.push(r);for(var s=0,u=o;s<u.length;s++){var c=u[s];O3.matchKey(a.keyMoveForward,c,t,n)?ie.moveForward=0:O3.matchKey(a.keyMoveBack,c,t,n)?ie.moveBack=0:O3.matchKey(a.keyMoveLeft,c,t,n)?ie.moveLeft=0:O3.matchKey(a.keyMoveRight,c,t,n)?ie.moveRight=0:O3.matchKey(a.keyMoveUp,c,t,n)?ie.moveUp=0:O3.matchKey(a.keyMoveDown,c,t,n)?ie.moveDown=0:O3.matchKey(a.keyRollLeft,c,t,n)?ie.rollLeft=0:O3.matchKey(a.keyRollRight,c,t,n)?ie.rollRight=0:O3.matchKey(a.keyPitchUp,c,t,n)?ie.pitchUp=0:O3.matchKey(a.keyPitchDown,c,t,n)?ie.pitchDown=0:O3.matchKey(a.keyYawLeft,c,t,n)?ie.yawLeft=0:O3.matchKey(a.keyYawRight,c,t,n)&&(ie.yawRight=0)}O3.matchKey(a.boostMove,r,t,n)&&(ie.boostMove=0)}}),m=e.move.subscribe(function(t){var r=t.movementX,n=t.movementY;if(e.pointerLock&&void 0!==r&&void 0!==n){var i=.5*o.width-o.x,a=.5*o.height-o.y;Bg.copy(x,j(i,a)),Bg.copy(S,j(r+i,n+a))}}),g=e.lock.subscribe(function(e){e?de():fe()}),v=e.leave.subscribe(function(){ie.moveForward=0,ie.moveBack=0,ie.moveLeft=0,ie.moveRight=0,ie.moveUp=0,ie.moveDown=0,ie.rollLeft=0,ie.rollRight=0,ie.pitchUp=0,ie.pitchDown=0,ie.yawLeft=0,ie.yawRight=0,ie.boostMove=0}),y=!1,b=Cg(),_=Cg(),x=Bg(),S=Bg(),w=Cg(),A=0,C=Bg(),T=Bg(),P=0,E=0,M=0,k=Bg(),I=Bg(),D=Bg(),O=Bg(),R=Bg(),B=Bg(),N=Cg.clone(t.target),F=Cg.clone(t.position),L=Cg.clone(t.up),$=Bg(),U=Bg();function j(e,t){return Bg.set(U,(e-.5*o.width-o.x)/(.5*o.width),(o.height+2*(o.y-t))/o.width)}function z(){var t=e.width/e.height;return i.rotateSpeed*e.pixelRatio*t}
139var G=Cg(),V=Ug(),H=Cg(),q=Cg(),W=Cg(),X=Cg(),Y=Ug(),K=Cg(),Z=Ug(),Q=Cg(),J=Ug(),ee=Cg(),te=Bg(),re=Cg(),ne=Cg(),ie={moveUp:0,moveDown:0,moveLeft:0,moveRight:0,moveForward:0,moveBack:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0,boostMove:0},ae=Cg(),oe=Cg();function se(){var e=Math.min(Math.max(1e3*t.state.radiusMax,.01),i.maxDistance);Cg.squaredMagnitude(_)>e*e&&(Cg.setMagnitude(_,_,e),Cg.add(t.position,t.target,_),Bg.copy(k,I),Bg.copy(D,O)),Cg.squaredMagnitude(_)<i.minDistance*i.minDistance&&(Cg.setMagnitude(_,_,i.minDistance),Cg.add(t.position,t.target,_),Bg.copy(k,I),Bg.copy(D,O))}function ue(t,r){return t*=e.pixelRatio,r*=e.pixelRatio,t>o.x+o.width||e.height-r>o.y+o.height||t<o.x||e.height-r<o.y}var ce=-1;function le(n){if(ce!==n){var a,o=n-ce;ce>0&&("spin"===i.animate.name?function(e){if("spin"===i.animate.name&&0!==i.animate.params.speed&&!y){var t=i.animate.params.speed/1e3;he[0]=60*Math.min(Math.abs(e),125)/1e3*t,Bg.add(S,x,he)}}(o):"rock"===i.animate.name&&function(e){if("rock"===i.animate.name&&0!==i.animate.params.speed&&!y){var t=e/1e3*i.animate.params.speed,r=Mg(i.animate.params.angle)/z(),n=Math.sin(pe*Math.PI*2)*r;me[0]=Math.sin((pe+t)*Math.PI*2)*r-n,Bg.add(S,x,me),(pe+=t)>=1&&(pe=0)}}(o)),Cg.sub(_,t.position,t.target),function(){var e=S[0]-x[0],r=S[1]-x[1];Cg.set(X,e,r,0);var n=Cg.magnitude(X)*z();n?(Cg.sub(_,t.position,t.target),Cg.normalize(H,_),Cg.normalize(q,t.up),Cg.normalize(W,Cg.cross(W,q,H)),Cg.setMagnitude(q,q,r),Cg.setMagnitude(W,W,e),Cg.add(X,q,W),Cg.normalize(G,Cg.cross(G,X,_)),Ug.setAxisAngle(V,G,n),Cg.transformQuat(_,_,V),Cg.transformQuat(t.up,t.up,V),Cg.copy(w,G),A=n):!i.staticMoving&&A&&(A*=Math.sqrt(1-i.dynamicDampingFactor),Cg.sub(_,t.position,t.target),Ug.setAxisAngle(V,w,A),Cg.transformQuat(_,_,V),Cg.transformQuat(t.up,t.up,V)),Bg.copy(x,S)}(),function(){var e=(ie.rollRight-ie.rollLeft)/45,r=(T[0]-C[0])*-Math.sign(T[1]),n=(T[1]-C[1])*-Math.sign(T[0]),a=-i.rotateSpeed*(-r+n)+e;a?(Cg.normalize(K,_),Ug.setAxisAngle(Y,K,a),Cg.transformQuat(t.up,t.up,Y),P=a):!i.staticMoving&&P&&(P*=Math.sqrt(1-i.dynamicDampingFactor),Cg.normalize(K,_),Ug.setAxisAngle(Y,K,P),Cg.transformQuat(t.up,t.up,Y)),Bg.copy(C,T)}(),function(){var e=(ie.pitchUp-ie.pitchDown)/(i.flyMode?360:90),r=-i.rotateSpeed*e;r?(Cg.cross(Q,_,t.up),Cg.normalize(Q,Q),Ug.setAxisAngle(Z,Q,r),Cg.transformQuat(_,_,Z),Cg.transformQuat(t.up,t.up,Z),E=r):!i.staticMoving&&E&&(E*=Math.sqrt(1-i.dynamicDampingFactor),Cg.cross(Q,_,t.up),Cg.normalize(Q,Q),Ug.setAxisAngle(Z,Q,E),Cg.transformQuat(_,_,Z),Cg.transformQuat(t.up,t.up,Z))}(),function(){var e=(ie.yawRight-ie.yawLeft)/(i.flyMode?360:90),r=-i.rotateSpeed*e;r?(Cg.normalize(ee,t.up),Ug.setAxisAngle(J,ee,r),Cg.transformQuat(_,_,J),Cg.transformQuat(t.up,t.up,J),M=r):!i.staticMoving&&M&&(M*=Math.sqrt(1-i.dynamicDampingFactor),Cg.normalize(ee,t.up),Ug.setAxisAngle(J,ee,M),Cg.transformQuat(_,_,J),Cg.transformQuat(t.up,t.up,J))}(),1!=(a=1+(I[1]-k[1])*i.zoomSpeed)&&a>0&&Cg.scale(_,_,a),i.staticMoving?Bg.copy(k,I):k[1]+=(I[1]-k[1])*i.dynamicDampingFactor,function(){var e=(O[1]-D[1])*i.zoomSpeed;if(0!==e){var r=Math.max(1,t.state.radius+t.state.radius*e);t.setState({radius:r})}i.staticMoving?Bg.copy(D,O):D[1]+=(O[1]-D[1])*i.dynamicDampingFactor}(),function(){if(Bg.sub(te,Bg.copy(te,B),R),Bg.squaredMagnitude(te)){var r=e.pixelRatio*i.panSpeed;te[0]*=1/t.zoom*t.viewport.width*r,te[1]*=1/t.zoom*t.viewport.height*r,Cg.cross(ne,Cg.copy(ne,_),t.up),Cg.setMagnitude(ne,ne,te[0]),Cg.setMagnitude(re,t.up,te[1]),Cg.add(ne,ne,re),Cg.add(t.position,t.position,ne),Cg.add(t.target,t.target,ne),i.staticMoving?Bg.copy(R,B):(Bg.sub(te,B,R),Bg.scale(te,te,i.dynamicDampingFactor),Bg.add(R,R,te))}}(),Cg.add(t.position,t.target,_),se(),ce>0&&function(n){Cg.sub(oe,t.position,t.target);var a=Math.max(t.state.minNear,i.minDistance);Cg.setMagnitude(oe,oe,a);var o=.06*n*i.moveSpeed*(1===ie.boostMove?i.boostMoveFactor:1);if(1===ie.moveForward&&(Cg.normalize(ae,oe),Cg.scaleAndSub(t.position,t.position,ae,o),(i.flyMode||e.pointerLock)&&Cg.sub(t.target,t.position,oe)),1===ie.moveBack&&(Cg.normalize(ae,oe),Cg.scaleAndAdd(t.position,t.position,ae,o),(i.flyMode||e.pointerLock)&&Cg.
139sub(t.target,t.position,oe)),1===ie.moveLeft&&(Cg.cross(ae,oe,t.up),Cg.normalize(ae,ae),i.flyMode||e.pointerLock?(Cg.scaleAndAdd(t.position,t.position,ae,o),Cg.sub(t.target,t.position,oe)):(Cg.scaleAndSub(t.position,t.position,ae,o),Cg.sub(t.target,t.position,_))),1===ie.moveRight&&(Cg.cross(ae,oe,t.up),Cg.normalize(ae,ae),i.flyMode||e.pointerLock?(Cg.scaleAndSub(t.position,t.position,ae,o),Cg.sub(t.target,t.position,oe)):(Cg.scaleAndAdd(t.position,t.position,ae,o),Cg.sub(t.target,t.position,_))),1===ie.moveUp&&(Cg.normalize(ae,t.up),i.flyMode||e.pointerLock?(Cg.scaleAndAdd(t.position,t.position,ae,o),Cg.sub(t.target,t.position,oe)):(Cg.scaleAndSub(t.position,t.position,ae,o),Cg.sub(t.target,t.position,_))),1===ie.moveDown&&(Cg.normalize(ae,t.up),i.flyMode||e.pointerLock?(Cg.scaleAndSub(t.position,t.position,ae,o),Cg.sub(t.target,t.position,oe)):(Cg.scaleAndAdd(t.position,t.position,ae,o),Cg.sub(t.target,t.position,_))),i.flyMode||e.pointerLock){var s=Cg.distance(t.position,r.boundingSphereVisible.center);t.setState({minFar:s+r.boundingSphereVisible.radius})}}(Math.min(o,250)),Cg.sub(_,t.position,t.target),se(),Cg.squaredDistance(b,t.position)>vg&&Cg.copy(b,t.position),ce=n}}function de(){Cg.sub(oe,t.position,t.target);var e=Math.max(t.state.minNear,i.minDistance);Cg.setMagnitude(oe,oe,e),Cg.sub(t.target,t.position,oe);var n=Cg.distance(t.position,r.boundingSphereVisible.center);t.setState({minFar:n+r.boundingSphereVisible.radius})}function fe(){var e=r.boundingSphereVisible,n=e.center,i=e.radius;if(Cg.distance(t.position,n)>i){var a=t.getFocus(n,i);t.setState(Ac(Ac({},a),{minFar:0}))}else t.setState({minFar:0,radius:r.boundingSphereVisible.radius})}var he=Bg.create(.005,0),pe=0,me=Bg.create(.005,0);function ge(){pe=0}return{viewport:o,get isAnimating(){return"off"!==i.animate.name},get isMoving(){return 1===ie.moveForward||1===ie.moveBack||1===ie.moveLeft||1===ie.moveRight||1===ie.moveUp||1===ie.moveDown||1===ie.rollLeft||1===ie.rollRight||1===ie.pitchUp||1===ie.pitchDown||1===ie.yawLeft||1===ie.yawRight},get props(){return i},setProps:function(e){"rock"===e.animate?.name&&"rock"!==i.animate.name&&ge(),void 0!==e.flyMode&&e.flyMode!==i.flyMode&&(e.flyMode?de():fe()),Object.assign(i,e),Object.assign(a,e.bindings)},start:function(e){ce=-1,le(e)},update:le,reset:function(){Cg.copy(t.target,N),Cg.copy(t.position,F),Cg.copy(t.up,L),Cg.sub(_,t.position,t.target),Cg.copy(b,t.position)},dispose:function(){s||(s=!0,u.unsubscribe(),l.unsubscribe(),d.unsubscribe(),f.unsubscribe(),c.unsubscribe(),h.unsubscribe(),p.unsubscribe(),m.unsubscribe(),g.unsubscribe(),v.unsubscribe())}}}})(R3||={}),function(e){e.create=function(){return{view:Og.identity(),position:Cg.create(0,0,0),direction:Cg.create(0,0,-1),up:Cg.create(0,1,0)}};var t=Cg.zero();e.update=function(e){Cg.add(t,e.position,e.direction),Og.lookAt(e.view,e.position,t,e.up)}}(B3||={});var G3,V3=function(){function e(){this.removeList=pS(),this.removeMap=new Map,this.addList=pS(),this.addMap=new Map}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.removeList.count&&0===this.addList.count},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.removeMap.size+this.addMap.size},enumerable:!1,configurable:!0}),e.prototype.add=function(e){if(this.removeMap.has(e)){var t=this.removeMap.get(e);this.removeMap.delete(e),this.removeList.remove(t)}if(!this.addMap.has(e)){var r=this.addList.addLast(e);this.addMap.set(e,r)}},e.prototype.remove=function(e){if(this.addMap.has(e)){var t=this.addMap.get(e);this.addMap.delete(e),this.addList.remove(t)}if(!this.removeMap.has(e)){var r=this.removeList.addLast(e);this.removeMap.set(e,r)}},e.prototype.tryGetRemove=function(){var e=this.removeList.removeFirst();return e&&this.removeMap.delete(e),e},e.prototype.tryGetAdd=function(){var e=this.addList.removeFirst();return e&&this.addMap.delete(e),e},e}(),H3=new PM("98");function q3(e,t,r){H3.reset();for(var n=0,i=e.length;n<i;++n)if(!r||e[n].state.visible){var a=e[n].values.boundingSphere.ref.value;a.radius&&H3.includeSphere(a)}for(H3.finishedIncludeStep(),n=0,i=e.length;n<i;++n)if(!r||e[n].state.visible){var o=e[n].values.boundingSphere.ref.value;o.radius&&H3.radiusSphere(o)}return H3.getSphere(t)}function W3(e,t){var r=(e.getProgram("colorBlended")||e.getProgram("colorWboit")||e.getProgram("colorDpoit")).id,n=(t.getProgram("colorBlended")||t.getProgram("colorWboit")||t.getProgram("colorDpoit")).id,i=e.materialId,a=t.materialId;return r===n?i===a?e.id-t.id:i-a:r-n}!function(e){e.create=function(e,t){void 0===t&&(t=GR);var r=new Map,n=[],i=XE(),a=XE(),o=[],s=[],u=!0,c=!0,l=!0,d=!0,f=!0,h=0,p=0,m=!1,g=B3.create(),v=g.view,y=g.position,b=g.direction,_=g.up;function x(i){if(r.has(i))console.warn(`RenderObject with id '${i.id}' already present`);else{var a=function(e,t,r){switch(t.type){case"mesh":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),AB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",_k,o,Ac(Ac({}
139,r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"points":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),CB),s={uObjectId:tf.create(t)};return JR(YR(e,"points",mk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"spheres":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),PB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",gk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"cylinders":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),IB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",vk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"text":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),EB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",yk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"lines":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),TB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",bk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"direct-volume":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),wB);e.isWebGL2||(o.uMaxSteps=ER("number"));var s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",xk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"image":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),kB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",Sk,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r);case"texture-mesh":return function(e,t,r,n,i,a){var o=Ac(Ac(Ac(Ac({},kR),IR),DR),MB),s={uObjectId:tf.create(t)};return JR(YR(e,"triangles",_k,o,Ac(Ac({},r),s),i,a),r,n)}(e,t.id,t.values,t.state,t.materialId,r)}throw Error("unsupported type")}(e,i,t);n.push(a),"direct-volume"===i.type?s.push(a):o.push(a),r.set(i,a),u=!0,c=!0}}function S(e){var t=r.get(e);t&&(t.dispose(),qb(n,t),qb(o,t),qb(s,t),r.delete(e),u=!0,c=!0)}var w=new V3,A=-1;function C(){var e=function(){for(var e=23,t=0,r=n.length;t<r;++t)n[t].state.visible&&(e=31*e+n[t].id|0);return-1===(e=Cv(e))&&(e=0),e}();return e!==A&&(c=!0,l=!0,d=!0,f=!0,A=e,!0)}return{view:v,position:y,direction:b,up:_,renderables:n,primitives:{view:v,position:y,direction:b,up:_,renderables:o},volumes:{view:v,position:y,direction:b,up:_,renderables:s},syncVisibility:C,update:function(e,t){var i;if(B3.update(g),e)for(var a=0,o=e.length;a<o;++a)null==(i=r.get(e[a]))||i.update();else for(a=0,o=n.length;a<o;++a)n[a].update();t?C():(u=!0,c=!0),l=!0,d=!0,f=!0},add:function(e){return w.add(e)},remove:function(e){return w.remove(e)},commit:function(e){return void 0===e&&(e=Number.MAX_VALUE),function(e){for(var t=Kd(),r=0;i=w.tryGetRemove();)if(S(i),++r%100==0&&Kd()-t>e)return!1;for(;;){var i;if(!(i=w.tryGetAdd()))break;if(x(i),++r%100==0&&Kd()-t>e)return!1}return n.sort(W3),l=!0,d=!0,f=!0,!0}(e)},get commitQueueSize(){return w.size},get needsCommit(){return!w.isEmpty},has:function(e){return r.has(e)},clear:function(){for(var e=0,t=n.length;e<t;++e)n[e].dispose();n.length=0,o.length=0,s.length=0,r.clear(),u=!0,c=!0},forEach:function(e){r.forEach(e)},get count(){return n.length},get boundingSphere(){return u&&=(q3(n,i,!1),!1),i},get boundingSphereVisible(){return c&&=(q3(n,a,!0),!1),a},get markerAverage(){return l&&=(h=function(){if(0===o.length)return 0;for(var e=0,t=0,r=0,n=o.length;r<n;++r)o[r].state.visible&&(t+=o[r].values.markerAverage.ref.value,e+=1);return e>0?t/e:0}(),!1),h},get opacityAverage(){return d&&=(p=function(){if(0===o.length)return 0;for(var e=0,t=0,r=0,n=o.length;r<n;++r){var i=o[r];if(i.state.visible){var a=bg(i.values.alpha.ref.value*i.state.alphaFactor,0,1),s=i.values.dXrayShaded?.ref.value?.5:1,u="fuzzy"===i.values.dPointStyle?.ref.value?.5:1,c="text"===i.values.dGeometryType.ref.value?.5:1;t+=(1-i.values.transparencyAverage.ref.value)*a*s*u*c,e+=1}}return e>0?t/e:0}(),!1),p},get hasOpaque(){return f&&=(m=function(){if(0===o.length)return!1;for(var e=0,t=o.length;e<t;++e){var r=o[e];if(r.state.visible&&(r.state.opaque||1===r.state.alphaFactor&&1===r.values.alpha.ref.value&&1!==r.values.transparencyAverage.ref.value||"opaque"===r.values.dTransparentBackfaces?.ref.value))return!0}return!1}(),!1),m}}}}(G3||={});var X3=function(){function e(t){this.camera=t,this.t=0,this.func=e.defaultTransition,this.start=0,this.inTransition=!1,this.durationMs=0,this._source=Q3.createDefaultSnapshot(),this._target=Q3.createDefaultSnapshot(),this._current=Q3.createDefaultSnapshot()}return Object.defineProperty(e.prototype,"source",{get:function(){return this._source}
139,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,r,n){void 0===r&&(r=0),(!this.inTransition||r>0)&&Q3.copySnapshot(this._source,this.camera.state),this.inTransition||Q3.copySnapshot(this._target,this.camera.state),Q3.copySnapshot(this._target,t),this._target.radius>this._target.radiusMax&&(this._target.radius=this._target.radiusMax),this._target.radius<.01&&(this._target.radius=.01),this._target.radiusMax<.01&&(this._target.radiusMax=.01),!this.inTransition&&r<=0||void 0!==t.mode&&t.mode!==this.camera.state.mode?this.finish(this._target):(this.inTransition=!0,this.func=n||e.defaultTransition,(!this.inTransition||r>0)&&(this.start=this.t,this.durationMs=r))},e.prototype.tick=function(e){this.t=e,this.update()},e.prototype.finish=function(e){Q3.copySnapshot(this.camera.state,e),this.inTransition=!1},e.prototype.update=function(){if(this.inTransition){var e=Math.min((this.t-this.start)/this.durationMs,1);1===e?this.finish(this._target):(this.func(this._current,e,this._source,this._target),Q3.copySnapshot(this.camera.state,this._current))}},e}();!function(e){var t=Ug.identity();e.defaultTransition=function(e,r,n,i){Q3.copySnapshot(e,i),Ug.slerp(t,Ug.Identity,Ug.rotationTo(t,n.up,i.up),r),Cg.transformQuat(e.up,n.up,t),Cg.lerp(e.target,n.target,i.target,r),Cg.lerp(e.position,n.position,i.position,r),e.radius=_g(n.radius,i.radius,r),e.radiusMax=_g(n.radiusMax,i.radiusMax,r),e.fov=_g(n.fov,i.fov,r),e.fog=_g(n.fog,i.fog,r)}}(X3||={});var Y3=Cg(),K3=Cg(),Z3=Ng(),Q3=function(){function e(t,r,n){void 0===r&&(r=h3.create(0,0,128,128)),void 0===n&&(n={}),this.view=Og.identity(),this.projection=Og.identity(),this.projectionView=Og.identity(),this.inverseProjectionView=Og.identity(),this.state=e.createDefaultSnapshot(),this.viewOffset=e.ViewOffset(),this.near=1,this.far=1e4,this.fogNear=5e3,this.fogFar=1e4,this.zoom=1,this.transition=new X3(this),this.stateChanged=new M_(this.state),this.prevProjection=Og.identity(),this.prevView=Og.identity(),this.deltaDirection=Cg(),this.newPosition=Cg(),this.viewport=r,this.pixelScale=n.pixelScale||1,e.copySnapshot(this.state,t)}return Object.defineProperty(e.prototype,"pixelRatio",{get:function(){return(typeof window<"u"?window.devicePixelRatio:1)*this.pixelScale},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.state.position},set:function(e){Cg.copy(this.state.position,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"up",{get:function(){return this.state.up},set:function(e){Cg.copy(this.state.up,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this.state.target},set:function(e){Cg.copy(this.state.target,e)},enumerable:!1,configurable:!0}),e.prototype.update=function(){var e=this.state;if(0===e.radiusMax)return!1;var t=2*Math.tan(e.fov/2)*Cg.distance(e.position,e.target);switch(this.zoom=this.viewport.height/t,function(e){var t=e.state,r=t.radius,n=t.radiusMax,i=(t.mode,t.fog),a=t.clipFar,o=t.minNear,s=t.minFar;r<.01&&(r=.01);var u=Math.max(a?r:n,s),c=Cg.distance(e.position,e.target),l=c-r,d=c+u;(l=Math.max(Math.min(n,o),l))===(d=Math.max(o,d))&&(d=l+.01);var f=c-u*(-(50-i)/50),h=d;e.near=l,e.far=d,e.fogNear=f,e.fogFar=h}(this),this.state.mode){case"orthographic":!function(e){var t=e.viewport,r=e.zoom,n=e.near,i=e.far,a=e.viewOffset,o=-t.width/2,s=t.width/2,u=t.height/2,c=-t.height/2,l=(s-o)/(2*r),d=(u-c)/(2*r),f=(s+o)/2,h=(u+c)/2,p=f-l,m=f+l,g=h+d,v=h-d;if(a.enabled){var y=r/(a.width/a.fullWidth),b=r/(a.height/a.fullHeight),_=(s-o)/a.width,x=(u-c)/a.height;m=(p+=_*(a.offsetX/y))+_*(a.width/y),v=(g-=x*(a.offsetY/b))-x*(a.height/b)}Og.ortho(e.projection,p,m,g,v,n,i),Og.lookAt(e.view,e.position,e.target,e.up)}(this);break;case"perspective":!function(e){var t=e.viewport.width/e.viewport.height,r=e.near,n=e.far,i=e.viewOffset,a=r*Math.tan(.5*e.state.fov),o=2*a,s=t*o,u=-.5*s;i.enabled&&(u+=i.offsetX*s/i.fullWidth,a-=i.offsetY*o/i.fullHeight,s*=i.width/i.fullWidth,o*=i.height/i.fullHeight),Og.perspective(e.projection,u,u+s,a,a-o,r,n),Og.lookAt(e.view,e.position,e.target,e.up)}(this);break;default:Lg(this.state.mode)}var r=!Og.areEqual(this.projection,this.prevProjection,vg)||!Og.areEqual(this.view,this.prevView,vg);if(r){if(Og.mul(this.projectionView,this.projection,this.view),!Og.tryInvert(this.inverseProjectionView,this.projectionView))return Og.copy(this.view,this.prevView),Og.copy(this.projection,this.prevProjection),Og.mul(this.projectionView,this.projection,this.view),!1;Og.copy(this.prevView,this.view),Og.copy(this.prevProjection,this.projection)}return r},e.prototype.setState=function(e,t){this.transition.apply(e,t),this.stateChanged.next(e)},e.prototype.getSnapshot=function(){return e.copySnapshot(e.createDefaultSnapshot(),this.state)},e.prototype.getTargetDistance=function(t){return e.targetDistance(t,this.state.mode,this.state.fov,this.viewport.width,this.viewport.height)},e.prototype.getFocus=function(t,r,n,i,a){var o=Math.max(r,.01),s=this.getTargetDistance(o);Cg.sub(this.deltaDirection,a?.target??this.target,a?.position??this.position),i&&Cg.matchDirection(this.deltaDirection,i,this.deltaDirection),Cg.setMagnitude(this.deltaDirection,this.deltaDirection,s),Cg.sub(this.newPosition,t,this.deltaDirection);var u=e.copySnapshot(e.createDefaultSnapshot(),this.state);return u.target=Cg.clone(t),u.radius=o,u.position=Cg.clone(this.newPosition),n&&Cg.matchDirection(u.up,n,u.up),u},e.prototype.getCenter=function(t,r){Cg.sub(this.deltaDirection,this.target,this.position),Cg.sub(this.newPosition,t,this.deltaDirection);var n=e.copySnapshot(e.createDefaultSnapshot(),this.state);return n.target=Cg.clone(t),n.position=Cg.clone(this.newPosition),r&&(n.radius=Math.max(r,.01)),n},e.prototype.getInvariantFocus=function(t,r,n,i){var a=Math.max(r,.01),o=this.getTargetDistance(a);Cg.copy(this.deltaDirection,i),Cg.setMagnitude(this.deltaDirection,this.deltaDirection,o),Cg.sub(this.newPosition,t,this.deltaDirection);var s=e.copySnapshot(e.createDefaultSnapshot(),this.state);return s.target=Cg.clone(t),s.radius=a,s.position=Cg.clone(this.newPosition),Cg.copy(s.up,n),s}
139,e.prototype.focus=function(e,t,r,n,i){t>0&&this.setState(this.getFocus(e,t,n,i),r)},e.prototype.center=function(e,t){this.setState(this.getCenter(e),t)},e.prototype.project=function(e,t){return function(e,t,r,n){var i=r.x,a=r.y,o=r.width,s=r.height;Ng.set(p3,t[0],t[1],t[2],1),Ng.transformMat4(p3,p3,n);var u=p3[3];return 0!==u&&(p3[0]/=u,p3[1]/=u,p3[2]/=u),e[0]=(p3[0]+1)*o*.5+i,e[1]=(p3[1]+1)*s*.5+a,e[2]=.5*(p3[2]+1),e[3]=0===u?0:1/u,e}(e,t,this.viewport,this.projectionView)},e.prototype.unproject=function(e,t){return m3(e,t,this.viewport,this.inverseProjectionView)},e.prototype.getPixelSize=function(e){return this.project(Z3,e),this.unproject(Y3,Z3),Z3[0]+=1,this.unproject(K3,Z3),Cg.distance(Y3,K3)},e}();!function(e){e.ViewOffset=function(){return{enabled:!1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}},e.setViewOffset=function(e,t,r,n,i,a,o){e.fullWidth=t,e.fullHeight=r,e.offsetX=n,e.offsetY=i,e.width=a,e.height=o},e.copyViewOffset=function(e,t){e.enabled=t.enabled,e.fullWidth=t.fullWidth,e.fullHeight=t.fullHeight,e.offsetX=t.offsetX,e.offsetY=t.offsetY,e.width=t.width,e.height=t.height},e.targetDistance=function(e,t,r,n,i){var a=Math.max(e,.01),o=i<n?1:n/i;return Math.abs("orthographic"===t?a/o/Math.tan(r/2):a/o/Math.sin(r/2))},e.createDefaultSnapshot=function(){return{mode:"perspective",fov:Math.PI/4,position:Cg.create(0,0,100),up:Cg.create(0,1,0),target:Cg.create(0,0,0),radius:0,radiusMax:10,fog:50,clipFar:!0,minNear:5,minFar:0}},e.copySnapshot=function(e,t){return t?(void 0!==t.mode&&(e.mode=t.mode),void 0!==t.fov&&(e.fov=t.fov),void 0!==t.position&&Cg.copy(e.position,t.position),void 0!==t.up&&Cg.copy(e.up,t.up),void 0!==t.target&&Cg.copy(e.target,t.target),void 0!==t.radius&&(e.radius=t.radius),void 0!==t.radiusMax&&(e.radiusMax=t.radiusMax),void 0!==t.fog&&(e.fog=t.fog),void 0!==t.clipFar&&(e.clipFar=t.clipFar),void 0!==t.minNear&&(e.minNear=t.minNear),void 0!==t.minFar&&(e.minFar=t.minFar),e):e},e.areSnapshotsEqual=function(e,t){return e.mode===t.mode&&e.fov===t.fov&&e.radius===t.radius&&e.radiusMax===t.radiusMax&&e.fog===t.fog&&e.clipFar===t.clipFar&&e.minNear===t.minNear&&e.minFar===t.minFar&&Cg.exactEquals(e.position,t.position)&&Cg.exactEquals(e.up,t.up)&&Cg.exactEquals(e.target,t.target)}}(Q3||={});var J3={sceneBoundingSpheres:Ib.Boolean(!1,{description:"Show full scene bounding spheres."}),visibleSceneBoundingSpheres:Ib.Boolean(!1,{description:"Show visible scene bounding spheres."}),objectBoundingSpheres:Ib.Boolean(!1,{description:"Show bounding spheres of visible render objects."}),instanceBoundingSpheres:Ib.Boolean(!1,{description:"Show bounding spheres of visible instances."})},e4=function(){function e(e,t,r){this.objectsData=new Map,this.instancesData=new Map,this.scene=G3.create(e,VR),this.parent=t,this._props=Ac(Ac({},Ib.getDefaultValues(J3)),r)}return e.prototype.update=function(){var e=this,t=t4(this.scene,this.parent.boundingSphere,this.sceneData,MC.lightgrey,n4);t&&(this.sceneData=t);var r=t4(this.scene,this.parent.boundingSphereVisible,this.visibleSceneData,MC.black,i4);r&&(this.visibleSceneData=r),this.parent.forEach(function(t,r){var n=e.objectsData.get(r),i=t4(e.scene,t.values.boundingSphere.ref.value,n,MC.tomato,a4);i&&e.objectsData.set(r,i);var a=e.instancesData.get(r),o=t4(e.scene,t.values.invariantBoundingSphere.ref.value,a,MC.skyblue,o4,{aTransform:r.values.aTransform,matrix:r.values.matrix,transform:r.values.transform,extraTransform:r.values.extraTransform,uInstanceCount:r.values.uInstanceCount,instanceCount:r.values.instanceCount,aInstance:r.values.aInstance,hasReflection:r.values.hasReflection});o&&e.instancesData.set(r,o)}),this.objectsData.forEach(function(t,r){e.parent.has(r)||(e.scene.remove(t.renderObject),e.objectsData.delete(r))}),this.instancesData.forEach(function(t,r){e.parent.has(r)||(e.scene.remove(t.renderObject),e.instancesData.delete(r))}),this.scene.update(void 0,!1),this.scene.commit()},e.prototype.syncVisibility=function(){var e=this;this.sceneData&&(this.sceneData.renderObject.state.visible=this._props.sceneBoundingSpheres),this.visibleSceneData&&(this.visibleSceneData.renderObject.state.visible=this._props.visibleSceneBoundingSpheres),this.parent.forEach(function(t,r){var n=e.objectsData.get(r);
139n&&(n.renderObject.state.visible=r.state.visible&&e._props.objectBoundingSpheres);var i=e.instancesData.get(r);i&&(i.renderObject.state.visible=r.state.visible&&e._props.instanceBoundingSpheres)})},e.prototype.clear=function(){this.sceneData=void 0,this.objectsData.clear(),this.scene.clear()},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._props.sceneBoundingSpheres||this._props.visibleSceneBoundingSpheres||this._props.objectBoundingSpheres||this._props.instanceBoundingSpheres},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"props",{get:function(){return this._props},enumerable:!1,configurable:!0}),e.prototype.setProps=function(e){Object.assign(this._props,e),this.isEnabled&&this.update()},e}();function t4(e,t,r,n,i,a){if(!r||!XE.equals(r.boundingSphere,t)){var o=function(e,t){var r=MD(2),n=dO.createState(r,r/2,t);if(e.radius&&(OD(n,e.center,e.radius,2),XE.hasExtrema(e)))for(var i=0,a=e.extrema;i<a.length;i++)OD(n,a[i],1,0);return dO.getMesh(n)}(t,r&&r.mesh),s=r?r.renderObject:function(e,t,r,n){return RB("mesh",sD.Utils.createValuesSimple(e,{alpha:.1,doubleSided:!1},t,1,n),{disposed:!1,visible:!0,alphaFactor:1,pickable:!1,colorOnly:!1,opaque:!1,writeDepth:!1},r)}(o,n,i,a);return r?tf.updateIfChanged(s.values.drawCount,cB.getDrawCount(o)):e.add(s),{boundingSphere:XE.clone(t),renderObject:s,mesh:o}}}var r4,n4=OB(),i4=OB(),a4=OB(),o4=OB();!function(e){e[e.Move=0]="Move",e[e.Click=1]="Click",e[e.Drag=2]="Drag"}(r4||={});var s4=Cg(),u4=Cg(),c4=Cg(),l4={maxFps:Ib.Numeric(30,{min:10,max:60,step:10}),preferAtomPixelPadding:Ib.Numeric(3,{min:0,max:20,step:1},{description:"Number of extra pixels at which to prefer atoms over bonds."})},d4=function(){function e(e,t,r,n,i,a){void 0===a&&(a={});var o=this;this.canvasIdentify=e,this.lociGetter=t,this.input=r,this.camera=n,this.controls=i,this.ev=H_.create(),this.events={hover:this.ev(),drag:this.ev(),click:this.ev()},this.startX=-1,this.startY=-1,this.endX=-1,this.endY=-1,this.id=void 0,this.position=void 0,this.currentIdentifyT=0,this.isInteracting=!1,this.prevLoci=dJ.Loci.Empty,this.prevT=0,this.inside=!1,this.buttons=b3.create(0),this.button=b3.create(0),this.modifiers=y3.None,this.props=Ac(Ac({},Ib.getDefaultValues(l4)),a),r.drag.subscribe(function(e){var t=e.x,r=e.y,n=e.buttons,i=e.button,a=e.modifiers;o.isInteracting=!0,o.drag(t,r,n,i,a)}),r.move.subscribe(function(e){var t=e.x,r=e.y,n=e.inside,i=e.buttons,a=e.button,s=e.modifiers,u=e.onElement;n&&!o.isInteracting&&(u?o.move(t,r,i,a,s):o.leave())}),r.leave.subscribe(function(){o.leave()}),r.click.subscribe(function(e){var t=e.x,r=e.y,n=e.buttons,i=e.button,a=e.modifiers;o.outsideViewport(t,r)||o.click(t,r,n,i,a)}),r.interactionEnd.subscribe(function(){o.isInteracting=!1}),r.modifiers.subscribe(function(e){o.modify(e)})}return e.prototype.setProps=function(e){Object.assign(this.props,e)},e.prototype.identify=function(e,t){var r=this.startX!==this.endX||this.startY!==this.endY||this.input.pointerLock&&!this.controls.isMoving;if(e!==r4.Drag){if(r){var n=this.canvasIdentify(this.endX,this.endY);this.id=n?.id,this.position=n?.position,this.startX=this.endX,this.startY=this.endY}if(e===r4.Click){var i=this.getLoci(this.id,this.position);return this.events.click.next({current:i,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Bg.create(this.endX,this.endY),position:this.position}),void(this.prevLoci=i)}if(this.inside&&this.currentIdentifyT===t&&r&&!this.outsideViewport(this.endX,this.endY)){var a=this.getLoci(this.id,this.position);this.events.hover.next({current:a,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Bg.create(this.endX,this.endY),position:this.position}),this.prevLoci=a}}else r&&!this.outsideViewport(this.startX,this.startY)&&(this.events.drag.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,pageStart:Bg.create(this.startX,this.startY),pageEnd:Bg.create(this.endX,this.endY)}),this.startX=this.endX,this.startY=this.endY)},e.prototype.tick=function(e){this.inside&&e-this.prevT>1e3/this.props.maxFps&&(this.prevT=e,this.currentIdentifyT=e,this.identify(this.isInteracting?r4.Drag:r4.Move,e))},e.prototype.leave=function(){this.inside=!1,dJ.Loci.isEmpty(this.prevLoci)||(this.prevLoci=dJ.Loci.Empty,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers}))},e.prototype.move=function(e,t,r,n,i){this.inside=!0,this.buttons=r,this.button=n,this.modifiers=i,this.endX=e,this.endY=t},e.prototype.click=function(e,t,r,n,i){this.endX=e,this.endY=t,this.buttons=r,this.button=n,this.modifiers=i,this.identify(r4.Click,0)},e.prototype.drag=function(e,t,r,n,i){this.endX=e,this.endY=t,this.buttons=r,this.button=n,this.modifiers=i,this.identify(r4.Drag,0)},e.prototype.modify=function(e){y3.areEqual(e,this.modifiers)||(this.modifiers=e,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Bg.create(this.endX,this.endY),position:this.position}))},e.prototype.outsideViewport=function(e,t){var r=this.input,n=this.camera.viewport;return e*=r.pixelRatio,t*=r.pixelRatio,e>n.x+n.width||r.height-t>n.y+n.height||e<n.x||r.height-t<n.y},e.prototype.getLoci=function(e,t){var r=this.lociGetter(e),n=r.repr,i=r.loci;
139if(t&&n&&C$.isLoci(i)&&2===i.bonds.length){var a=i.bonds[0],o=a.aUnit,s=a.aIndex;o.conformation.position(o.elements[s],s4),Cg.sub(c4,this.camera.state.position,this.camera.state.target),Cg.projectPointOnPlane(u4,t,c4,s4);var u=this.camera.getPixelSize(u4),c=n.theme.size.size(i.bonds[0])*(n.props.sizeFactor??1);if(!1===n.props.lineSizeAttenuation&&(c*=u/2),c+=this.props.preferAtomPixelPadding*u,Cg.distance(u4,s4)<c)return{repr:n,loci:C$.toFirstStructureElementLoci(i)}}return{repr:n,loci:i}},e.prototype.dispose=function(){this.ev.dispose()},e}(),f4={edgeThresholdMin:Ib.Numeric(.0312,{min:.0312,max:.0833,step:1e-4},{description:"Trims the algorithm from processing darks."}),edgeThresholdMax:Ib.Numeric(.063,{min:.063,max:.333,step:.001},{description:"The minimum amount of local contrast required to apply algorithm."}),iterations:Ib.Numeric(12,{min:0,max:16,step:1},{description:"Number of edge exploration steps."}),subpixelQuality:Ib.Numeric(.3,{min:0,max:1,step:.01},{description:"Choose the amount of sub-pixel aliasing removal."})},h4=function(){function e(e,t){var r,n,i,a,o,s;this.webgl=e,this.renderable=(r=e,i=(n=t).getWidth(),a=n.getHeight(),o=Ac(Ac({},nB),{tColor:tf.create(n),uTexSizeInv:tf.create(Bg.create(1/i,1/a)),dEdgeThresholdMin:tf.create(.0312),dEdgeThresholdMax:tf.create(.125),dIterations:tf.create(12),dSubpixelQuality:tf.create(.3)}),s=Ac({},p4),eB(KR(r,"triangles",m4,s,o),o))}return e.prototype.updateState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.disable(r.BLEND),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,s=e.height;n.viewport(i,a,o,s),n.scissor(i,a,o,s),n.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)},e.prototype.setSize=function(e,t){tf.update(this.renderable.values.uTexSizeInv,Bg.set(this.renderable.values.uTexSizeInv.ref.value,1/e,1/t))},e.prototype.update=function(e,t){var r=this.renderable.values,n=t.edgeThresholdMin,i=t.edgeThresholdMax,a=t.iterations,o=t.subpixelQuality,s=!1;r.tColor.ref.value!==e&&(tf.update(this.renderable.values.tColor,e),s=!0),r.dEdgeThresholdMin.ref.value!==n&&(s=!0),tf.updateIfChanged(r.dEdgeThresholdMin,n),r.dEdgeThresholdMax.ref.value!==i&&(s=!0),tf.updateIfChanged(r.dEdgeThresholdMax,i),r.dIterations.ref.value!==a&&(s=!0),tf.updateIfChanged(r.dIterations,a),r.dSubpixelQuality.ref.value!==o&&(s=!0),tf.updateIfChanged(r.dSubpixelQuality,o),s&&this.renderable.update()},e.prototype.render=function(e,t){t?t.bind():this.webgl.unbindFramebuffer(),this.updateState(e),this.renderable.render()},e}(),p4=Ac(Ac({},rB),{tColor:TR("texture","rgba","ubyte","linear"),uTexSizeInv:CR("v2"),dEdgeThresholdMin:ER("number"),dEdgeThresholdMax:ER("number"),dIterations:ER("number"),dSubpixelQuality:ER("number")}),m4=fk("fxaa",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\n// adapted from https://github.com/kosua20/Rendu\n// MIT License Copyright (c) 2017 Simon Rodriguez\n\n#define QUALITY(q) ((q) < 5 ? 1.0 : ((q) > 5 ? ((q) < 10 ? 2.0 : ((q) < 11 ? 4.0 : 8.0)) : 1.5))\n\nfloat rgb2luma(vec3 rgb){\n    return sqrt(dot(rgb, vec3(0.299, 0.587, 0.114)));\n}\n\nfloat sampleLuma(vec2 uv) {\n    return rgb2luma(texture2D(tColor, uv).rgb);\n}\n\nfloat sampleLuma(vec2 uv, float uOffset, float vOffset) {\n    uv += uTexSizeInv * vec2(uOffset, vOffset);\n    return sampleLuma(uv);\n}\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n    vec2 inverseScreenSize = uTexSizeInv;\n\n    vec4 colorCenter = texture2D(tColor, coords);\n\n    // Luma at the current fragment\n    float lumaCenter = rgb2luma(colorCenter.rgb);\n\n    // Luma at the four direct neighbours of the current fragment.\n    float lumaDown = sampleLuma(coords, 0.0, -1.0);\n    float lumaUp = sampleLuma(coords, 0.0, 1.0);\n    float lumaLeft = sampleLuma(coords, -1.0, 0.0);\n    float lumaRight = sampleLuma(coords, 1.0, 0.0);\n\n    // Find the maximum and minimum luma around the current fragment.\n    float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight)));\n    float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight)));\n\n    // Compute the delta.\n    float lumaRange = lumaMax - lumaMin;\n\n    // If the luma variation is lower that a threshold (or if we are in a really dark area),\n    // we are not on an edge, don't perform any AA.\n    if (lumaRange < max(dEdgeThresholdMin, lumaMax * dEdgeThresholdMax)) {\n        gl_FragColor = colorCenter;\n        return;\n    }\n\n    // Query the 4 remaining corners lumas.\n    float lumaDownLeft = sampleLuma(coords, -1.0, -1.0);\n    float lumaUpRight = sampleLuma(coords, 1.0, 1.0);\n    float lumaUpLeft = sampleLuma(coords, -1.0, 1.0);\n    float lumaDownRight = sampleLuma(coords, 1.0, -1.0);\n\n    // Combine the four edges lumas (using intermediary variables for future computations\n    // with the same values).\n    float lumaDownUp = lumaDown + lumaUp;\n    float lumaLeftRight = lumaLeft + lumaRight;\n\n    // Same for corners\n    float lumaLeftCorners = lumaDownLeft + lumaUpLeft;\n    float lumaDownCorners = lumaDownLeft + lumaDownRight;\n    float lumaRightCorners = lumaDownRight + lumaUpRight;\n    float lumaUpCorners = lumaUpRight + lumaUpLeft;\n\n    // Compute an estimation of the gradient along the horizontal and vertical axis.\n    float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners) + abs(-2.0 * lumaCenter + lumaDownUp) * 2.0 + abs(-2.0 * lumaRight + lumaRightCorners);\n    float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners) + abs(-2.0 * lumaCenter + lumaLeftRight) * 2.0 + abs(-2.0 * lumaDown + lumaDownCorners);
139\n\n    // Is the local edge horizontal or vertical ?\n    bool isHorizontal = (edgeHorizontal >= edgeVertical);\n\n    // Choose the step size (one pixel) accordingly.\n    float stepLength = isHorizontal ? inverseScreenSize.y : inverseScreenSize.x;\n\n    // Select the two neighboring texels lumas in the opposite direction to the local edge.\n    float luma1 = isHorizontal ? lumaDown : lumaLeft;\n    float luma2 = isHorizontal ? lumaUp : lumaRight;\n    // Compute gradients in this direction.\n    float gradient1 = luma1 - lumaCenter;\n    float gradient2 = luma2 - lumaCenter;\n\n    // Which direction is the steepest ?\n    bool is1Steepest = abs(gradient1) >= abs(gradient2);\n\n    // Gradient in the corresponding direction, normalized.\n    float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2));\n\n    // Average luma in the correct direction.\n    float lumaLocalAverage = 0.0;\n    if(is1Steepest){\n        // Switch the direction\n        stepLength = -stepLength;\n        lumaLocalAverage = 0.5 * (luma1 + lumaCenter);\n    } else {\n        lumaLocalAverage = 0.5 * (luma2 + lumaCenter);\n    }\n\n    // Shift UV in the correct direction by half a pixel.\n    vec2 currentUv = coords;\n    if(isHorizontal){\n        currentUv.y += stepLength * 0.5;\n    } else {\n        currentUv.x += stepLength * 0.5;\n    }\n\n    // Compute offset (for each iteration step) in the right direction.\n    vec2 offset = isHorizontal ? vec2(inverseScreenSize.x, 0.0) : vec2(0.0, inverseScreenSize.y);\n    // Compute UVs to explore on each side of the edge, orthogonally.\n    // The QUALITY allows us to step faster.\n    vec2 uv1 = currentUv - offset * QUALITY(0);\n    vec2 uv2 = currentUv + offset * QUALITY(0);\n\n    // Read the lumas at both current extremities of the exploration segment,\n    // and compute the delta wrt to the local average luma.\n    float lumaEnd1 = sampleLuma(uv1);\n    float lumaEnd2 = sampleLuma(uv2);\n    lumaEnd1 -= lumaLocalAverage;\n    lumaEnd2 -= lumaLocalAverage;\n\n    // If the luma deltas at the current extremities is larger than the local gradient,\n    // we have reached the side of the edge.\n    bool reached1 = abs(lumaEnd1) >= gradientScaled;\n    bool reached2 = abs(lumaEnd2) >= gradientScaled;\n    bool reachedBoth = reached1 && reached2;\n\n    // If the side is not reached, we continue to explore in this direction.\n    if(!reached1){\n        uv1 -= offset * QUALITY(1);\n    }\n    if(!reached2){\n        uv2 += offset * QUALITY(1);\n    }\n\n    // If both sides have not been reached, continue to explore.\n    if(!reachedBoth){\n        for(int i = 2; i < dIterations; i++){\n            // If needed, read luma in 1st direction, compute delta.\n            if(!reached1){\n                lumaEnd1 = sampleLuma(uv1);\n                lumaEnd1 = lumaEnd1 - lumaLocalAverage;\n            }\n            // If needed, read luma in opposite direction, compute delta.\n            if(!reached2){\n                lumaEnd2 = sampleLuma(uv2);\n                lumaEnd2 = lumaEnd2 - lumaLocalAverage;\n            }\n            // If the luma deltas at the current extremities is larger than the local gradient,\n            // we have reached the side of the edge.\n            reached1 = abs(lumaEnd1) >= gradientScaled;\n            reached2 = abs(lumaEnd2) >= gradientScaled;\n            reachedBoth = reached1 && reached2;\n\n            // If the side is not reached, we continue to explore in this direction,\n            // with a variable quality.\n            if(!reached1){\n                uv1 -= offset * QUALITY(i);\n            }\n            if(!reached2){\n                uv2 += offset * QUALITY(i);\n            }\n\n            // If both sides have been reached, stop the exploration.\n            if(reachedBoth){\n                break;\n            }\n        }\n    }\n\n    // Compute the distances to each side edge of the edge (!).\n    float distance1 = isHorizontal ? (coords.x - uv1.x) : (coords.y - uv1.y);\n    float distance2 = isHorizontal ? (uv2.x - coords.x) : (uv2.y - coords.y);\n\n    // In which direction is the side of the edge closer ?\n    bool isDirection1 = distance1 < distance2;\n    float distanceFinal = min(distance1, distance2);\n\n    // Thickness of the edge.\n    float edgeThickness = (distance1 + distance2);\n\n    // Is the luma at center smaller than the local average ?\n    bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage;\n\n    // If the luma at center is smaller than at its neighbour,\n    // the delta luma at each end should be positive (same variation).\n    bool correctVariation1 = (lumaEnd1 < 0.0) != isLumaCenterSmaller;\n    bool correctVariation2 = (lumaEnd2 < 0.0) != isLumaCenterSmaller;\n\n    // Only keep the result in the direction of the closer side of the edge.\n    bool correctVariation = isDirection1 ? c
139orrectVariation1 : correctVariation2;\n\n    // UV offset: read in the direction of the closest side of the edge.\n    float pixelOffset = - distanceFinal / edgeThickness + 0.5;\n\n    // If the luma variation is incorrect, do not offset.\n    float finalOffset = correctVariation ? pixelOffset : 0.0;\n\n    // Sub-pixel shifting\n    // Full weighted average of the luma over the 3x3 neighborhood.\n    float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners);\n    // Ratio of the delta between the global average and the center luma,\n    // over the luma range in the 3x3 neighborhood.\n    float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0);\n    float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1;\n    // Compute a sub-pixel offset based on this delta.\n    float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * float(dSubpixelQuality);\n\n    // Pick the biggest of the two offsets.\n    finalOffset = max(finalOffset, subPixelOffsetFinal);\n\n    // Compute the final UV coordinates.\n    vec2 finalUv = coords;\n    if(isHorizontal){\n        finalUv.y += finalOffset * stepLength;\n    } else {\n        finalUv.x += finalOffset * stepLength;\n    }\n\n    // Read the color at the new UV coordinates, and use it.\n    gl_FragColor = texture2D(tColor, finalUv);\n}\n"),g4={edgeThreshold:Ib.Numeric(.1,{min:.05,max:.15,step:.01}),maxSearchSteps:Ib.Numeric(16,{min:0,max:32,step:1})},v4=function(){function e(e,t){if(this.webgl=e,this._supported=!1,typeof HTMLImageElement<"u"){var r=t.getWidth(),n=t.getHeight();this.edgesTarget=e.createRenderTarget(r,n,!1,"uint8","linear"),this.weightsTarget=e.createRenderTarget(r,n,!1,"uint8","linear"),this.edgesRenderable=function(e,t){var r=t.getWidth(),n=t.getHeight(),i=Ac(Ac({},nB),{tColor:tf.create(t),uTexSizeInv:tf.create(Bg.create(1/r,1/n)),uViewport:tf.create(Ng()),dEdgeThreshold:tf.create(.1)});return eB(KR(e,"triangles",b4,Ac({},y4),i),i)}(e,t),this.weightsRenderable=function(e,t){var r=t.getWidth(),n=t.getHeight(),i=e.resources.texture("image-uint8","rgb","ubyte","linear"),a=e.resources.texture("image-uint8","rgba","ubyte","nearest"),o=Ac(Ac({},nB),{tEdges:tf.create(t),tArea:tf.create(i),tSearch:tf.create(a),uTexSizeInv:tf.create(Bg.create(1/r,1/n)),uViewport:tf.create(Ng()),dMaxSearchSteps:tf.create(16)});return wI("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fi
139BPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQ
139Q/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJ
139wXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+
1397WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEm
139jmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4
139+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyAS
139dgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNm
139yz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII=",o.tArea,i),wI("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII=",o.tSearch,a),eB(KR(e,"triangles",x4,Ac({},_4),o),o)}(e,this.edgesTarget.texture),this.blendRenderable=function(e,t,r){var n=t.getWidth(),i=t.getHeight(),a=Ac(Ac({},nB),{tColor:tf.create(t),tWeights:tf.create(r),uTexSizeInv:tf.create(Bg.create(1/n,1
139/i)),uViewport:tf.create(Ng())});return eB(KR(e,"triangles",w4,Ac({},S4),a),a)}(e,t,this.weightsTarget.texture),this._supported=!0}else ay&&console.log('Missing "HTMLImageElement" required for "SMAA"')}return Object.defineProperty(e.prototype,"supported",{get:function(){return this._supported},enumerable:!1,configurable:!0}),e.prototype.updateState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.disable(r.BLEND),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,s=e.height;n.viewport(i,a,o,s),n.scissor(i,a,o,s),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT),tf.update(this.edgesRenderable.values.uViewport,h3.toVec4(this.edgesRenderable.values.uViewport.ref.value,e)),tf.update(this.weightsRenderable.values.uViewport,h3.toVec4(this.weightsRenderable.values.uViewport.ref.value,e)),tf.update(this.blendRenderable.values.uViewport,h3.toVec4(this.blendRenderable.values.uViewport.ref.value,e))},e.prototype.setSize=function(e,t){var r=this.edgesTarget.getWidth(),n=this.edgesTarget.getHeight();e===r&&t===n||(this.edgesTarget.setSize(e,t),this.weightsTarget.setSize(e,t),tf.update(this.edgesRenderable.values.uTexSizeInv,Bg.set(this.edgesRenderable.values.uTexSizeInv.ref.value,1/e,1/t)),tf.update(this.weightsRenderable.values.uTexSizeInv,Bg.set(this.weightsRenderable.values.uTexSizeInv.ref.value,1/e,1/t)),tf.update(this.blendRenderable.values.uTexSizeInv,Bg.set(this.blendRenderable.values.uTexSizeInv.ref.value,1/e,1/t)))},e.prototype.update=function(e,t){var r=!1;this.edgesRenderable.values.tColor.ref.value!==e&&(tf.update(this.edgesRenderable.values.tColor,e),r=!0),this.edgesRenderable.values.dEdgeThreshold.ref.value!==t.edgeThreshold&&(tf.update(this.edgesRenderable.values.dEdgeThreshold,t.edgeThreshold),r=!0),r&&this.edgesRenderable.update(),this.weightsRenderable.values.dMaxSearchSteps.ref.value!==t.maxSearchSteps&&(tf.update(this.weightsRenderable.values.dMaxSearchSteps,t.maxSearchSteps),this.weightsRenderable.update()),this.blendRenderable.values.tColor.ref.value!==e&&(tf.update(this.blendRenderable.values.tColor,e),this.blendRenderable.update())},e.prototype.render=function(e,t){this.edgesTarget.bind(),this.updateState(e),this.edgesRenderable.render(),this.weightsTarget.bind(),this.updateState(e),this.weightsRenderable.render(),t?t.bind():this.webgl.unbindFramebuffer(),this.updateState(e),this.blendRenderable.render()},e}(),y4=Ac(Ac({},rB),{tColor:TR("texture","rgba","ubyte","linear"),uTexSizeInv:CR("v2"),uViewport:CR("v4"),dEdgeThreshold:ER("number")}),b4=fk("smaa-edges","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvoid SMAAEdgeDetectionVS(vec2 texCoord) {\n    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n    vOffset[2] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-2.0, 0.0, 0.0, 2.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n    vec2 scale = uViewport.zw * uTexSizeInv;\n    vec2 shift = uViewport.xy * uTexSizeInv;\n    vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n    SMAAEdgeDetectionVS(vUv);\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvec4 SMAAColorEdgeDetectionPS(vec2 texcoord, vec4 offset[3], sampler2D colorTex) {\n    vec2 threshold = vec2(dEdgeThreshold, dEdgeThreshold);\n\n    // Calculate color deltas:\n    vec4 delta;\n    vec3 C = texture2D(colorTex, texcoord).rgb;\n\n    vec3 Cleft = texture2D(colorTex, offset[0].xy).rgb;\n    vec3 t = abs(C - Cleft);\n    delta.x = max(max(t.r, t.g), t.b);\n\n    vec3 Ctop = texture2D(colorTex, offset[0].zw).rgb;\n    t = abs(C - Ctop);\n    delta.y = max(max(t.r, t.g), t.b);\n\n    // We do the usual threshold:\n    vec2 edges = step(threshold, delta.xy);\n\n    // Then discard if there is no edge:\n    if (dot(edges, vec2(1.0, 1.0 )) == 0.0)\n        discard;\n\n    // Calculate right and bottom deltas:\n    vec3 Cright = texture2D(colorTex, offset[1].xy).rgb;\n    t = abs( C - Cright );\n    delta.z = max(max(t.r, t.g), t.b);\n\n    vec3 Cbottom  = texture2D(colorTex, offset[1].zw).rgb;\n    t = abs(C - Cbottom);\n    delta.w = max(max(t.r, t.g), t.b);\n\n    // Calculate the maximum delta in the direct neighborhood:\n    float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w );\n\n    // Calculate left-left and top-top deltas:\n    vec3 Cleftleft  = texture2D(colorTex, offset[2].xy).rgb;\n    t = abs( C - Cleftleft );\n    delta.z = max(max(t.r, t.g), t.b);\n\n    vec3 Ctoptop = texture2D(colorTex, offset[2].zw).rgb;\n    t = abs(C - Ctoptop);\n    delta.w = max(max(t.r, t.g), t.b);\n\n    // Calculate the final maximum delta:\n    maxDelta = max(max(maxDelta, delta.z), delta.w);\n\n    // Local contrast adaptation in action:\n    edges.xy *= step(0.5 * maxDelta, delta.xy);\n\n    return vec4(edges, 0.0, 0.0);\n}\n\nvoid main() {\n    gl_FragColor = SMAAColorEdgeDetectionPS(vUv, vOffset, tColor);\n}\n"),_4=Ac(Ac({},rB),{tEdges:TR("texture","rgba","ubyte","linear"),tArea:TR("texture","rgb","ubyte","linear"),tSearch:TR("texture","rgba","ubyte","nearest"),uTexSizeInv:CR("v2"),uViewport:CR("v4"),dMaxSearchSteps:ER("number")}),x4=fk("smaa-weights","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\nvoid SMAABlendingWeightCalculationVS(vec2 texCoord) {\n    vPixCoord = texCoord / uTexSizeInv;\n\n    // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.25, 0.125, 1.25, 0.125); // WebGL port note: Changed sign in Y and W components\n    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.125, 0.25, -0.125, -1.25); // WebGL port note: Changed sign in Y and W components\n\n    // And these for the searches, they indicate the ends of the loops:\n    vOffset[2] = vec4(vOffset[0].xz, vOffset[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * uTexSizeInv.xxyy * float(dMaxSearchSteps);\n}\n\nvoid main() {\n    vec2 scale = uViewport.zw * uTexSizeInv;\n    vec2 shift = uViewport.xy * uTexSizeInv;\n    vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n    SMAABlendingWeightCalculationVS(vUv);\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#define SMAASampleLevelZeroOffset(tex, coord, offset) texture2D(tex, coord + float(offset) * uTexSizeInv, 0.0)\n\n#define SMAA_AREATEX_MAX_DISTANCE 16\n#define SMAA_AREATEX_PIXEL_SIZE (1.0 / vec2(160.0, 560.0))\n#define SMAA_AREATEX_SUBTEX_SIZE (1.0 / 7.0)\n\nuniform sampler2D tEdges;\nuniform sampler2D tArea;\nuniform sampler2D tSearch;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\n#if __VERSION__ == 100\n    vec2 round(vec2 x) {\n        return sign(x) * floor(abs(x) + 0.5);\n    }\n#endif\n\nfloat SMAASearchLength(sampler2D searchTex, vec2 e, float bias, float scale) {\n    // Not required if searchTex accesses are set to point:\n    // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n    // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n    //     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n    e.r = bias + e.r * scale;\n    return 255.0 * texture2D(searchTex, e, 0.0).r;\n}\n\nfloat SMAASearchXLeft(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    /**\n     * @PSEUDO_GATHER4\n     * This texCoord has been offset by (-0.25, -0.125) in the vertex shader to\n     * sample between edge, thus fetching four edges in a row.\n     * Sampling with different offsets in each direction allows to disambiguate\n     * which edges are active from the four fetched ones.\n     */\n    vec2 e = vec2(0.0, 1.0);\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D( edgesTex, texCoord, 0.0).rg;\n        texCoord -= vec2(2.0, 0.0) * uTexSizeInv;\n        if (!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) break;\n    }\n\n    // We correct the previous (-0.25, -0.125) offset we applied:\n    texCoord.x += 0.25 * uTexSizeInv.x;\n\n    // The searches are bias by 1, so adjust the coords accordingly:\n    texCoord.x += uTexSizeInv.x;\n\n    // Disambiguate the length added by the last step:\n    texCoord.x += 2.0 * uTexSizeInv.x; // Undo last step\n    texCoord.x -= uTexSizeInv.x * SMAASearchLength(searchTex, e, 0.0, 0.5);\n\n    return texCoord.x;\n}\n\nfloat SMAASearchXRight(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    vec2 e = vec2( 0.0, 1.0 );\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D(edgesTex, texCoord, 0.0).rg;\n        texCoord += vec2(2.0, 0.0) * uTexSizeInv;\n        if (!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) break;\n    }\n\n    texCoord.x -= 0.25 * uTexSizeInv.x;\n    texCoord.x -= uTexSizeInv.x;\n    texCoord.x -= 2.0 * uTexSizeInv.x;\n    texCoord.x += uTexSizeInv.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );\n\n    return texCoord.x;\n}\n\nfloat SMAASearchYUp(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    vec2 e = vec2( 1.0, 0.0 );\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D(edgesTex, texCoord, 0.0).rg;\n        texCoord += vec2(0.0, 2.0) * uTexSizeInv; // WebGL port note: Changed sign\n        if (!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) break;\n    }\n\n    texCoord.y -= 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y -= uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y -= 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y += uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5); // WebGL port note: Changed sign\n\n    return texCoord.y;\n}\n\nfloat SMAASearchYDown(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    vec2 e = vec2( 1.0, 0.0 );\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D(edgesTex, texCoord, 0.0).rg;\n        texCoord -= vec2( 0.0, 2.0 ) * uTexSizeInv; // WebGL port note: Changed sign\n        if (!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) break;\n    }\n\n    texCoord.y += 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y += uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y += 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y -= uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5); // WebGL port note: Changed sign\n\n    return texCoord.y;\n}\n\nvec2 SMAAArea(sampler2D areaTex, vec2 dist, float e1, float e2, float offset) {\n    // Rounding prevents precision errors of bilinear filtering:\n    vec2 texCoord = float(SMAA_AREATEX_MAX_DISTANCE) * round(4.0 * vec2(e1, e2)) + dist;\n\n    // We do a scale and bias for mapping to texel space:\n    texCoord = SMAA_AREATEX_PIXEL_SIZE * texCoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);\n\n    // Move to proper place, according to the subpixel offset:\n    texCoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n\n    return texture2D(areaTex, texCoord, 0.0).rg;\n}\n\nvec4 SMAABlendingWeightCalculationPS(vec2 texCoord, vec2 pixCoord, vec4 offset[3], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices) {\n    vec4 weights = vec4(0.0, 0.0, 0.0, 0.0);\n\n    vec2 e = texture2D(edgesTex, texCoord).rg;\n\n    if (e.g > 0.0) { // Edge at north\n        vec2 d;\n\n        // Find the distance to the left:\n        vec2 coords;\n        coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x );\n        coords.y = offset[1].y; // offset[1].y = texCoord.y - 0.25 * uTexSizeInv.y (@CROSSING_OFFSET)\n        d.x = coords.x;\n\n        // Now fetch the left crossing edges, two at a time using bilinear\n        // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n        // discern what value each edge has:\n        float e1 = texture2D(edgesTex, coords, 0.0
139).r;\n\n        // Find the distance to the right:\n        coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);\n        d.y = coords.x;\n\n        // We want the distances to be in pixel units (doing this here allow to\n        // better interleave arithmetic and memory accesses):\n        d = d / uTexSizeInv.x - pixCoord.x;\n\n        // SMAAArea below needs a sqrt, as the areas texture is compressed\n        // quadratically:\n        vec2 sqrt_d = sqrt(abs(d));\n\n        // Fetch the right crossing edges:\n        coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(1, 0)).r;\n\n        // Ok, we know how this pattern looks like, now it is time for getting\n        // the actual area:\n        weights.rg = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.y));\n    }\n\n    if (e.r > 0.0) { // Edge at west\n        vec2 d;\n\n        // Find the distance to the top:\n        vec2 coords;\n\n        coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z );\n        coords.x = offset[0].x; // offset[1].x = texCoord.x - 0.25 * uTexSizeInv.x;\n        d.x = coords.y;\n\n        // Fetch the top crossing edges:\n        float e1 = texture2D(edgesTex, coords, 0.0).g;\n\n        // Find the distance to the bottom:\n        coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);\n        d.y = coords.y;\n\n        // We want the distances to be in pixel units:\n        d = d / uTexSizeInv.y - pixCoord.y;\n\n        // SMAAArea below needs a sqrt, as the areas texture is compressed\n        // quadratically:\n        vec2 sqrt_d = sqrt(abs(d));\n\n        // Fetch the bottom crossing edges:\n        coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(0, 1)).g;\n\n        // Get the area for this direction:\n        weights.ba = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.x));\n    }\n\n    return weights;\n}\n\nvoid main() {\n    gl_FragColor = SMAABlendingWeightCalculationPS(vUv, vPixCoord, vOffset, tEdges, tArea, tSearch, ivec4(0.0));\n}\n"),S4=Ac(Ac({},rB),{tColor:TR("texture","rgba","ubyte","linear"),tWeights:TR("texture","rgba","ubyte","linear"),uTexSizeInv:CR("v2"),uViewport:CR("v4")}),w4=fk("smaa-blend","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvoid SMAANeighborhoodBlendingVS(vec2 texCoord) {\n    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n    vec2 scale = uViewport.zw * uTexSizeInv;\n    vec2 shift = uViewport.xy * uTexSizeInv;\n    vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n    SMAANeighborhoodBlendingVS(vUv);\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tWeights;\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvec4 SMAANeighborhoodBlendingPS(vec2 texCoord, vec4 offset[2], sampler2D colorTex, sampler2D blendTex) {\n    // Fetch the blending weights for current pixel:\n    vec4 a;\n    a.xz = texture2D(blendTex, texCoord).xz;\n    a.y = texture2D(blendTex, offset[1].zw).g;\n    a.w = texture2D(blendTex, offset[1].xy).a;\n\n    // Is there any blending weight with a value greater than 0.0?\n    if (dot(a, vec4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {\n        return texture2D(colorTex, texCoord, 0.0);\n    } else {\n        // Up to 4 lines can be crossing a pixel (one through each edge). We\n        // favor blending by choosing the line with the maximum weight for each\n        // direction:\n        vec2 offset;\n        offset.x = a.a > a.b ? a.a : -a.b; // left vs. right\n        offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs\n\n        // Then we go in the direction that has the maximum weight:\n        if (abs(offset.x) > abs(offset.y)) { // horizontal vs. vertical\n            offset.y = 0.0;\n        } else {\n            offset.x = 0.0;\n        }\n\n        // Fetch the opposite color and lerp by hand:\n        vec4 C = texture2D(colorTex, texCoord, 0.0);\n        texCoord += sign(offset) * uTexSizeInv;\n        vec4 Cop = texture2D(colorTex, texCoord, 0.0);\n        float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n\n        // WebGL port note: Added gamma correction\n        C.xyz = pow(C.xyz, vec3(2.2));\n        Cop.xyz = pow(Cop.xyz, vec3(2.2));\n        vec4 mixed = mix(C, Cop, s);\n        mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));\n\n        return mixed;\n    }\n}\n\nvoid main() {\n    gl_FragColor = SMAANeighborhoodBlendingPS(vUv, vOffset, tColor, tWeights);\n}
139\n"),A4={opacity:Ib.Numeric(1,{min:0,max:1,step:.01}),saturation:Ib.Numeric(0,{min:-1,max:1,step:.01}),lightness:Ib.Numeric(0,{min:-1,max:1,step:.01})},C4=Ac({faces:Ib.MappedStatic("urls",{urls:Ib.Group({nx:Ib.Text("",{label:"Negative X / Left"}),ny:Ib.Text("",{label:"Negative Y / Bottom"}),nz:Ib.Text("",{label:"Negative Z / Back"}),px:Ib.Text("",{label:"Positive X / Right"}),py:Ib.Text("",{label:"Positive Y / Top"}),pz:Ib.Text("",{label:"Positive Z / Front"})},{isExpanded:!0,label:"URLs"}),files:Ib.Group({nx:Ib.File({label:"Negative X / Left",accept:"image/*"}),ny:Ib.File({label:"Negative Y / Bottom",accept:"image/*"}),nz:Ib.File({label:"Negative Z / Back",accept:"image/*"}),px:Ib.File({label:"Positive X / Right",accept:"image/*"}),py:Ib.File({label:"Positive Y / Top",accept:"image/*"}),pz:Ib.File({label:"Positive Z / Front",accept:"image/*"})},{isExpanded:!0,label:"Files"})}),blur:Ib.Numeric(0,{min:0,max:1,step:.01},{description:'Note, this only works in WebGL2 or when "EXT_shader_texture_lod" is available.'})},A4),T4=Ac(Ac({source:Ib.MappedStatic("url",{url:Ib.Text(""),file:Ib.File({accept:"image/*"})}),blur:Ib.Numeric(0,{min:0,max:1,step:.01},{description:'Note, this only works in WebGL2 or with power-of-two images and when "EXT_shader_texture_lod" is available.'})},A4),{coverage:Ib.Select("viewport",Ib.arrayToOptions(["viewport","canvas"]))}),P4={topColor:Ib.Color(tv(14540253)),bottomColor:Ib.Color(tv(15658734)),ratio:Ib.Numeric(.5,{min:0,max:1,step:.01}),coverage:Ib.Select("viewport",Ib.arrayToOptions(["viewport","canvas"]))},E4={centerColor:Ib.Color(tv(14540253)),edgeColor:Ib.Color(tv(15658734)),ratio:Ib.Numeric(.5,{min:0,max:1,step:.01}),coverage:Ib.Select("viewport",Ib.arrayToOptions(["viewport","canvas"]))},M4={variant:Ib.MappedStatic("off",{off:Ib.EmptyGroup(),skybox:Ib.Group(C4,{isExpanded:!0}),image:Ib.Group(T4,{isExpanded:!0}),horizontalGradient:Ib.Group(P4,{isExpanded:!0}),radialGradient:Ib.Group(E4,{isExpanded:!0})},{label:"Environment"})},k4=function(){function e(e,t,r,n){this.webgl=e,this.assetManager=t,this.camera=new Q3,this.target=Cg(),this.position=Cg(),this.dir=Cg(),this.renderable=function(e,t,r){var n={drawCount:tf.create(6),instanceCount:tf.create(1),aPosition:tf.create(tB),tSkybox:tf.create(AI()),tImage:tf.create(AI()),uImageScale:tf.create(Bg()),uImageOffset:tf.create(Bg()),uTexSize:tf.create(Bg.create(t,r)),uViewport:tf.create(Ng()),uViewportAdjusted:tf.create(!0),uViewDirectionProjectionInverse:tf.create(Og()),uGradientColorA:tf.create(Cg()),uGradientColorB:tf.create(Cg()),uGradientRatio:tf.create(.5),uBlur:tf.create(0),uOpacity:tf.create(1),uSaturation:tf.create(0),uLightness:tf.create(0),dVariant:tf.create("skybox")};return eB(KR(e,"triangles",N4,Ac({},B4),n),n)}(e,r,n)}return e.prototype.setSize=function(e,t){var r=this.renderable.values.uTexSize.ref.value,n=r[0],i=r[1];e===n&&t===i||tf.update(this.renderable.values.uTexSize,Bg.set(this.renderable.values.uTexSize.ref.value,e,t))},e.prototype.clearSkybox=function(){var e=this;void 0!==this.skybox&&(this.skybox.texture.destroy(),this.skybox.assets.forEach(function(t){return e.assetManager.release(t)}),this.skybox=void 0)},e.prototype.updateSkybox=function(e,t,r){var n,i,a=this,o=this.skybox?.props.faces,s=t.faces.params;if(!(s.nx&&s.ny&&s.nz&&s.px&&s.py&&s.pz))return this.clearSkybox(),void(null==r||r(!1));if(this.skybox&&o&&(n=t.faces,i=this.skybox.props.faces,D4(n)===D4(i)))r?.(!1);else{this.clearSkybox();var u=function(e,t,r,n){var i=function(e,t){return"urls"===t.name?{nx:Cb.getUrlAsset(e,t.params.nx),ny:Cb.getUrlAsset(e,t.params.ny),nz:Cb.getUrlAsset(e,t.params.nz),px:Cb.getUrlAsset(e,t.params.px),py:Cb.getUrlAsset(e,t.params.py),pz:Cb.getUrlAsset(e,t.params.pz)}:{nx:t.params.nx,ny:t.params.ny,nz:t.params.nz,px:t.params.px,py:t.params.py,pz:t.params.pz}}(t,r),a=function(e,t){var r=function(t){return e.resolve(t,"binary").run().then(function(e){return new Blob([e.data])})};return{nx:r(t.nx),ny:r(t.ny),nz:r(t.nz),px:r(t.px),py:r(t.py),pz:r(t.pz)}}(t,i),o=[i.nx,i.ny,i.nz,i.px,i.py,i.pz];return typeof HTMLImageElement>"u"?(console.error('Missing "HTMLImageElement" required for background skybox'),n?.(!0),{texture:AI(),assets:o}):{texture:e.resources.cubeTexture(a,!0,n),assets:o}}(this.webgl,this.assetManager,t.faces,function(e){a.skybox&&(a.skybox.loaded=!e),r?.(!0)}),c=u.texture,l=u.assets;this.skybox={texture:c,props:Ac({},t),assets:l,loaded:!1},tf.update(this.renderable.values.tSkybox,c),this.renderable.update(
139)}if(this.skybox){var d=e;"orthographic"===e.state.mode&&(this.camera.setState(Ac(Ac({},e.state),{mode:"perspective"})),this.camera.update(),d=this.camera);var f=this.renderable.values.uViewDirectionProjectionInverse.ref.value;Cg.sub(this.dir,d.state.position,d.state.target),Cg.setMagnitude(this.dir,this.dir,.1),Cg.copy(this.position,this.dir),Og.lookAt(f,this.position,this.target,d.state.up),Og.mul(f,d.projection,f),Og.invert(f,f),tf.update(this.renderable.values.uViewDirectionProjectionInverse,f),tf.updateIfChanged(this.renderable.values.uBlur,t.blur),tf.updateIfChanged(this.renderable.values.uOpacity,t.opacity),tf.updateIfChanged(this.renderable.values.uSaturation,t.saturation),tf.updateIfChanged(this.renderable.values.uLightness,t.lightness),tf.updateIfChanged(this.renderable.values.dVariant,"skybox"),this.renderable.update()}},e.prototype.clearImage=function(){void 0!==this.image&&(this.image.texture.destroy(),this.assetManager.release(this.image.asset),this.image=void 0)},e.prototype.updateImage=function(e,t){var r,n,i=this;if(!e.source.params)return this.clearImage(),void(null==t||t(!1));if(this.image&&this.image.props.source.params&&(r=e.source,n=this.image.props.source,R4(r)===R4(n)))t?.(!1);else{this.clearImage();var a=function(e,t,r,n){var i="url"===r.name?Cb.getUrlAsset(t,r.params):r.params;if(typeof HTMLImageElement>"u")return console.error('Missing "HTMLImageElement" required for background image'),n?.(!0),{texture:AI(),asset:i};var a=e.resources.texture("image-uint8","rgba","ubyte","linear"),o=new Image;return o.onload=function(){a.load(o),(e.isWebGL2||Ig(o.width)&&Ig(o.height))&&a.mipmap(),n?.()},o.onerror=function(){n?.(!0)},t.resolve(i,"binary").run().then(function(e){var t=new Blob([e.data]);o.src=URL.createObjectURL(t)}),{texture:a,asset:i}}(this.webgl,this.assetManager,e.source,function(e){i.image&&(i.image.loaded=!e),t?.(!0)}),o=a.texture,s=a.asset;this.image={texture:o,props:Ac({},e),asset:s,loaded:!1},tf.update(this.renderable.values.tImage,o),this.renderable.update()}this.image&&(tf.updateIfChanged(this.renderable.values.uBlur,e.blur),tf.updateIfChanged(this.renderable.values.uOpacity,e.opacity),tf.updateIfChanged(this.renderable.values.uSaturation,e.saturation),tf.updateIfChanged(this.renderable.values.uLightness,e.lightness),tf.updateIfChanged(this.renderable.values.uViewportAdjusted,"viewport"===e.coverage),tf.updateIfChanged(this.renderable.values.dVariant,"image"),this.renderable.update())},e.prototype.updateImageScaling=function(){var e=this.renderable.values,t=e.uTexSize.ref.value,r=t[0],n=t[1],i=this.image?.texture.getWidth()||0,a=this.image?.texture.getHeight()||0,o=r/n;o<i/a?tf.update(e.uImageScale,Bg.set(e.uImageScale.ref.value,i*n/a,n)):tf.update(e.uImageScale,Bg.set(e.uImageScale.ref.value,r,a*r/i));var s=e.uImageScale.ref.value,u=s[0]/s[1];u>o?tf.update(e.uImageOffset,Bg.set(e.uImageOffset.ref.value,(1-o/u)/2,0)):tf.update(e.uImageOffset,Bg.set(e.uImageOffset.ref.value,0,(1-u/o)/2))},e.prototype.updateGradient=function(e,t,r,n,i){tf.update(this.renderable.values.uGradientColorA,tv.toVec3Normalized(this.renderable.values.uGradientColorA.ref.value,e)),tf.update(this.renderable.values.uGradientColorB,tv.toVec3Normalized(this.renderable.values.uGradientColorB.ref.value,t)),tf.updateIfChanged(this.renderable.values.uGradientRatio,r),tf.updateIfChanged(this.renderable.values.uViewportAdjusted,i),tf.updateIfChanged(this.renderable.values.dVariant,n),this.renderable.update()},e.prototype.update=function(e,t,r){if("off"===t.variant.name)return this.clearSkybox(),this.clearImage(),void(null==r||r(!1));"skybox"===t.variant.name?(this.clearImage(),this.updateSkybox(e,t.variant.params,r)):"image"===t.variant.name?(this.clearSkybox(),this.updateImage(t.variant.params,r)):"horizontalGradient"===t.variant.name?(this.clearSkybox(),this.clearImage(),this.updateGradient(t.variant.params.topColor,t.variant.params.bottomColor,t.variant.params.ratio,t.variant.name,"viewport"===t.variant.params.coverage),r?.(!1)):"radialGradient"===t.variant.name&&(this.clearSkybox(),this.clearImage(),this.updateGradient(t.variant.params.centerColor,t.variant.params.edgeColor,t.variant.params.ratio,t.variant.name,"viewport"===t.variant.params.coverage),r?.(!1));var n=e.viewport,i=n.x,a=n.y,o=n.width,s=n.height;tf.update(this.renderable.values.uViewport,Ng.set(this.renderable.values.uViewport.ref.value,i,a,o,s))},e.prototype.isEnabled=function(e){return!!(this.skybox&&this.skybox.loaded||this.image&&this.image.loaded||"horizontalGradient"===e.variant.name||"radialGradient"===e.variant.name)},e.prototype.isReady=function(){return!!(this.skybox&&this.skybox.loaded||this.image&&this.image.loaded||"horizontalGradient"===this.renderable.values.dVariant.ref.value||"radialGradient"===this.renderable.values.dVariant.ref.value)},e.prototype.render=function(){this.isReady()&&("image"===this.renderable.values.dVariant.ref.value&&this.updateImageScaling(),this.renderable.render())},e.prototype.dispose=function(){this.clearSkybox(),this.clearImage()},e}(),I4="background-skybox";function D4(e){return"urls"===e.name?`${I4}_${e.params.nx}|${e.params.ny}|${e.params.nz}|${e.params.px}|${e.params.py}|${e.params.pz}`:`${I4}_${e.params.nx?.id}|${e.params.ny?.id}|${e.params.nz?.id}|${e.params.px?.id}|${e.params.py?.id}|${e.params.pz?.id}`}var O4="background-image";function R4(e){return"url"===e.name?`${O4}_${e.params}`:`${O4}_${e.params?.id}`}var B4={drawCount:MR("number"),instanceCount:MR("number"),aPosition:AR("float32",2,0),tSkybox:TR("texture","rgba","ubyte","linear"),tImage:TR("texture","rgba","ubyte","linear"),uImageScale:CR("v2"),uImageOffset:CR("v2"),uTexSize:CR("v2"),uViewport:CR("v4"),uViewportAdjusted:CR("b"),uViewDirectionProjectionInverse:CR("m4"),uGradientColorA:CR("v3"),uGradientColorB:CR("v3"),uGradientRatio:CR("f"),uBlur:CR("f"),uOpacity:CR("f"),uSaturation:CR("f"),uLightness:CR("f"),dVariant:ER("string",["skybox","image","verticalGradient","horizontalGradient","radialGradient"])},N4=fk("background","\nprecision mediump float;\n\nattribute vec2 aPosition;\n\nvarying vec4 vPosition;\n\nvoid main() {\n    vPosition = vec4(aPosition, 1.0, 1.0);\n    gl_Position = vec4(aPosition, 1.0, 1.0);\n}\n","\nprecision mediump float;\nprecision mediump samplerCube;\nprecision mediump sampler2D;\n\n#if defined(dVariant_skybox)\n    uniform samplerCube tSkybox;\n    uniform mat4 uViewDirectionProjectionInverse;\n    uniform float uBlur;\n    uniform float uOpacity;\n    uniform float uSaturation;\n    uniform float uLightness;\n#elif defined(dVariant_image)\n    uniform sampler2D tImage;\n    uniform vec2 uImageScale;\n    uniform vec2 uImageOffset;\n    uniform float uBlur;\n    uniform float uOpacity;\n    uniform float uSaturation;\n    uniform float uLightness;\n#elif defined(dVariant_horizontalGradient) || defined(dVariant_radialGradient)\n    uniform vec3 uGradientColorA;\n    uniform vec3 uGradientColorB;\n    uniform float uGradientRatio;\n#endif\n\nuniform vec2 uTexSize;\nuniform vec4 uViewport;\nuniform bool uViewportAdjusted;\nvarying vec4 vPosition;\n\n// TODO: add as general pp option to remove banding?\n// Iestyn's RGB dither from http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf\nvec3 ScreenSpaceDither(vec2 vScreenPos) {\n    vec3 vDither = vec3(dot(vec2(171.0, 231.0), vScreenPos.xy));\n    vDither.rgb = fract(vDither.rgb / vec3(103.0, 71.0, 97.0));\n    return vDither.rgb / 255.0;\n}
139\n\nvec3 saturateColor(vec3 c, float amount) {\n    // https://www.w3.org/TR/WCAG21/#dfn-relative-luminance\n    const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n    vec3 intensity = vec3(dot(c, W));\n    return mix(intensity, c, 1.0 + amount);\n}\n\nvec3 lightenColor(vec3 c, float amount) {\n    return c + amount;\n}\n\nvoid main() {\n    #if defined(dVariant_skybox)\n        vec4 t = uViewDirectionProjectionInverse * vPosition;\n        #ifdef enabledShaderTextureLod\n            gl_FragColor = textureCubeLodEXT(tSkybox, normalize(t.xyz / t.w), uBlur * 8.0);\n        #else\n            gl_FragColor = textureCube(tSkybox, normalize(t.xyz / t.w));\n        #endif\n        gl_FragColor.a = uOpacity;\n        gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);\n    #elif defined(dVariant_image)\n        vec2 coords;\n        if (uViewportAdjusted) {\n            coords = ((gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uImageScale) + uImageOffset;\n        } else {\n            coords = (gl_FragCoord.xy / uImageScale) + uImageOffset;\n        }\n        #ifdef enabledShaderTextureLod\n            gl_FragColor = texture2DLodEXT(tImage, vec2(coords.x, 1.0 - coords.y), uBlur * 8.0);\n        #else\n            gl_FragColor = texture2D(tImage, vec2(coords.x, 1.0 - coords.y));\n        #endif\n        gl_FragColor.a = uOpacity;\n        gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);\n    #elif defined(dVariant_horizontalGradient)\n        float d;\n        if (uViewportAdjusted) {\n            d = ((gl_FragCoord.y - uViewport.y) * (uTexSize.y / uViewport.w) / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);\n        } else {\n            d = (gl_FragCoord.y / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);\n        }\n        gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, clamp(d, 0.0, 1.0)), 1.0);\n        gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);\n    #elif defined(dVariant_radialGradient)\n        float d;\n        if (uViewportAdjusted) {\n            d = distance(vec2(0.5), (gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uTexSize) + uGradientRatio - 0.5;\n        } else {\n            d = distance(vec2(0.5), gl_FragCoord.xy / uTexSize) + uGradientRatio - 0.5;\n        }\n        gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, 1.0 - clamp(d, 0.0, 1.0)), 1.0);\n        gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);\n    #endif\n}\n",{shaderTextureLod:"optional"}),F4={sharpness:Ib.Numeric(.5,{min:0,max:1,step:.05}),denoise:Ib.Boolean(!0)},L4=function(){function e(e,t){var r,n,i,a,o,s;this.webgl=e,this.renderable=(r=e,i=(n=t).getWidth(),a=n.getHeight(),o=Ac(Ac({},nB),{tColor:tf.create(n),uTexSizeInv:tf.create(Bg.create(1/i,1/a)),uSharpness:tf.create(.5),dDenoise:tf.create(!0)}),s=Ac({},$4),eB(KR(r,"triangles",U4,s,o),o))}return e.prototype.updateState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.disable(r.BLEND),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,s=e.height;n.viewport(i,a,o,s),n.scissor(i,a,o,s),n.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)},e.prototype.setSize=function(e,t){tf.update(this.renderable.values.uTexSizeInv,Bg.set(this.renderable.values.uTexSizeInv.ref.value,1/e,1/t))},e.prototype.update=function(e,t){var r=this.renderable.values,n=t.sharpness,i=t.denoise,a=!1;r.tColor.ref.value!==e&&(tf.update(this.renderable.values.tColor,e),a=!0),tf.updateIfChanged(r.uSharpness,2-2*n**.25),r.dDenoise.ref.value!==i&&(a=!0),tf.updateIfChanged(r.dDenoise,i),a&&this.renderable.update()},e.prototype.render=function(e,t){t?t.bind():this.webgl.unbindFramebuffer(),this.updateState(e),this.renderable.render()},e}(),$4=Ac(Ac({},rB),{tColor:TR("texture","rgba","ubyte","linear"),uTexSizeInv:CR("v2"),uSharpness:CR("f"),dDenoise:ER("boolean")}),U4=fk("cas",jR,"\nprecision mediump float;\nprecision mediump sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nuniform float uSharpness;\n\n// adapted from https://www.shadertoy.com/view/stXSWB\n\n/*\n* FidelityFX Super Resolution scales up a low resolution\n* image, while adding fine detail.\n*\n* MIT Open License\n*\n* https://gpuopen.com/fsr\n*\n* Left: FSR processed\n* Right: Original texture, bilinear interpolation\n*\n* Mouse at top: Sharpness 0 stops (maximum)\n* Mouse at bottom: Sharpness 2 stops (minimum)\n*\n* It works in two passes-\n*   EASU upsamples the image with a clamped Lanczos kernel.\n*   RCAS sharpens the image at the target resolution.\n*\n* I needed to make a few changes to improve readability and\n* WebGL compatibility in an algorithm I don't fully understand.\
139n* Expect bugs.\n*\n* Shader not currently running for WebGL1 targets (eg. mobile Safari)\n*\n* There is kind of no point to using FSR in Shadertoy, as it renders buffers\n* at full target resolution. But this might be useful for WebGL based demos\n* running smaller-than-target render buffers.\n*\n* For sharpening with a full resolution render buffer,\n* FidelityFX CAS is a better option.\n* https://www.shadertoy.com/view/ftsXzM\n*\n* For readability and compatibility, these optimisations have been removed:\n*   * Fast approximate inverse and inversesqrt\n*   * textureGather fetches (not WebGL compatible)\n*   * Multiplying by reciprocal instead of division\n*\n* Apologies to AMD for the numerous slowdowns and errors I have introduced.\n*\n*/\n\n/***** RCAS *****/\n#define FSR_RCAS_LIMIT (0.25-(1.0/16.0))\n\n// Input callback prototypes that need to be implemented by calling shader\nvec4 FsrRcasLoadF(vec2 p);\n//------------------------------------------------------------------------------------------------------------------------------\nvoid FsrRcasCon(\n    out float con,\n    // The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}.\n    float sharpness\n) {\n    // Transform from stops to linear value.\n    con = exp2(-sharpness);\n}\n\nvec3 FsrRcasF(\n    vec2 ip, // Integer pixel position in output.\n    float con\n) {\n    // Constant generated by RcasSetup().\n    // Algorithm uses minimal 3x3 pixel neighborhood.\n    //    b\n    //  d e f\n    //    h\n    vec2 sp = vec2(ip);\n    vec3 b = FsrRcasLoadF(sp + vec2( 0,-1)).rgb;\n    vec3 d = FsrRcasLoadF(sp + vec2(-1, 0)).rgb;\n    vec3 e = FsrRcasLoadF(sp).rgb;\n    vec3 f = FsrRcasLoadF(sp + vec2( 1, 0)).rgb;\n    vec3 h = FsrRcasLoadF(sp + vec2( 0, 1)).rgb;\n\n    // Luma times 2.\n    float bL = b.g + .5 * (b.b + b.r);\n    float dL = d.g + .5 * (d.b + d.r);\n    float eL = e.g + .5 * (e.b + e.r);\n    float fL = f.g + .5 * (f.b + f.r);\n    float hL = h.g + .5 * (h.b + h.r);\n\n    // Noise detection.\n    #ifdef dDenoise\n        float nz = .25 * (bL + dL + fL + hL) - eL;\n        nz=clamp(\n            abs(nz)\n            /(\n                max(max(bL,dL),max(eL,max(fL,hL)))\n                -min(min(bL,dL),min(eL,min(fL,hL)))\n            ),\n            0., 1.\n        );\n        nz=1.-.5*nz;\n    #endif\n\n    // Min and max of ring.\n    vec3 mn4 = min(b, min(f, h));\n    vec3 mx4 = max(b, max(f, h));\n\n    // Immediate constants for peak range.\n    vec2 peakC = vec2(1., -4.);\n\n    // Limiters, these need to be high precision RCPs.\n    vec3 hitMin = mn4 / (4. * mx4);\n    vec3 hitMax = (peakC.x - mx4) / (4.* mn4 + peakC.y);\n    vec3 lobeRGB = max(-hitMin, hitMax);\n    float lobe = max(\n        -FSR_RCAS_LIMIT,\n        min(max(lobeRGB.r, max(lobeRGB.g, lobeRGB.b)), 0.)\n    )*con;\n\n    // Apply noise removal.\n    #ifdef dDenoise\n        lobe *= nz;\n    #endif\n\n    // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes.\n    return (lobe * (b + d + h + f) + e) / (4. * lobe + 1.);\n}\n\n\nvec4 FsrRcasLoadF(vec2 p) {\n    return texture2D(tColor, p * uTexSizeInv);\n}\n\nvoid main() {\n    // Set up constants\n    float con;\n    FsrRcasCon(con, uSharpness);\n\n    // Perform RCAS pass\n    vec3 col = FsrRcasF(gl_FragCoord.xy, con);\n\n    gl_FragColor = vec4(col, FsrRcasLoadF(gl_FragCoord.xy).a);\n}\n"),j4=Ac(Ac({},rB),{tDepthOpaque:TR("texture","rgba","ubyte","nearest"),tDepthTransparent:TR("texture","rgba","ubyte","nearest"),uTexSize:CR("v2"),dOrthographic:ER("number"),uNear:CR("f"),uFar:CR("f"),uInvProjection:CR("m4"),uOutlineThreshold:CR("f"),dTransparentOutline:ER("boolean")}),z4=Ac(Ac({},rB),{tDepth:TR("texture","rgba","ubyte","nearest"),uTexSize:CR("v2"),uProjection:CR("m4"),uInvProjection:CR("m4"),uBounds:CR("v4"),dOrthographic:ER("number"),uNear:CR("f"),uFar:CR("f"),dSteps:ER("number"),uMaxDistance:CR("f"),uTolerance:CR("f"),uBias:CR("f"),uLightDirection:CR("v3[]"),uLightColor:CR("v3[]"),dLightCount:ER("number")}),G4=Ac(Ac({},rB),{tDepth:TR("texture","rgba","ubyte","nearest"),tDepthHalf:TR("texture","rgba","ubyte","nearest"),tDepthQuarter:TR("texture","rgba","ubyte","nearest"),uSamples:CR("v3[]"),dNSamples:ER("number"),uProjection:CR("m4"),uInvProjection:CR("m4"),uBounds:CR("v4"),uTexSize:CR("v2"),uRadius:CR("f"),uBias:CR("f"),dMultiScale:ER("boolean"),dLevels:ER("number"),uLevelRadius:CR("f[]"),uLevelBias:CR("f[]"),uNearThreshold:CR("f"),uFarThreshold:CR("f")}),V4=Ac(Ac({},rB),{tSsaoDepth:TR("texture","rgba","ubyte","nearest"),uTexSize:CR("v2"),uKernel:CR("f[]"),dOcclusionKernelSize:ER("number"),uBlurDirectionX:CR("f"),uBlurDirectionY:CR("f"),uInvProjection:CR("m4"),uNear:CR("f"),uFar:CR("f"),uBounds:CR("v4"),dOrthographic:ER("number")});function H4(e,t,r){var n=Ac(Ac({},nB),{tSsaoDepth:tf.create(t),uTexSize:tf.create(Bg.create(t.getW
139idth(),t.getHeight())),uKernel:tf.create(q4(15)),dOcclusionKernelSize:tf.create(15),uBlurDirectionX:tf.create(+("horizontal"===r)),uBlurDirectionY:tf.create(+("vertical"===r)),uInvProjection:tf.create(Og.identity()),uNear:tf.create(0),uFar:tf.create(1e4),uBounds:tf.create(Ng()),dOrthographic:tf.create(0)}),i=Ac({},V4);return eB(KR(e,"triangles",fk("ssao_blur",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform float uKernel[dOcclusionKernelSize];\n\nuniform float uBlurDirectionX;\nuniform float uBlurDirectionY;\n\nuniform mat4 uInvProjection;\nuniform float uNear;\nuniform float uFar;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nbool outsideBounds(const in vec2 p) {\n    return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n    vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n    vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n    return distance(viewPos0, viewPos1);\n}\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n\n    vec2 packedDepth = texture2D(tSsaoDepth, coords).zw;\n\n    if (outsideBounds(coords)) {\n        gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n        return;\n    }\n\n    float selfDepth = unpackRGToUnitInterval(packedDepth);\n    // if background and if second pass\n    if (isBackground(selfDepth) && uBlurDirectionY != 0.0) {\n        gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n        return;\n    }\n\n    float selfViewZ = getViewZ(selfDepth);\n    float pixelSize = getPixelSize(coords, selfDepth);\n    float maxDiffViewZ = pixelSize * 10.0;\n\n    vec2 offset = vec2(uBlurDirectionX, uBlurDirectionY) / uTexSize;\n\n    float sum = 0.0;\n    float kernelSum = 0.0;\n    // only if kernelSize is odd\n    for (int i = -dOcclusionKernelSize / 2; i <= dOcclusionKernelSize / 2; i++) {\n        if (abs(float(i)) > 1.0 && abs(float(i)) * pixelSize > 0.8) continue;\n\n        vec2 sampleCoords = coords + float(i) * offset;\n        if (outsideBounds(sampleCoords)) {\n            continue;\n        }\n\n        vec4 sampleSsaoDepth = texture2D(tSsaoDepth, sampleCoords);\n\n        float sampleDepth = unpackRGToUnitInterval(sampleSsaoDepth.zw);\n        if (isBackground(sampleDepth)) {\n            continue;\n        }\n\n        if (abs(float(i)) > 1.0) {\n            float sampleViewZ = getViewZ(sampleDepth);\n            if (abs(selfViewZ - sampleViewZ) > maxDiffViewZ) {\n                continue;\n            }\n        }\n\n        float kernel = uKernel[int(abs(float(i)))]; // abs is not defined for int in webgl1\n        float sampleValue = unpackRGToUnitInterval(sampleSsaoDepth.xy);\n\n        sum += kernel * sampleValue;\n        kernelSum += kernel;\n    }\n\n    gl_FragColor = vec4(packUnitIntervalToRG(sum / kernelSum), packedDepth);\n}\n"),i,n),n)}function q4(e){for(var t=e/3,r=Math.floor((e+1)/2),n=[],i=0;i<r;i++)n.push(1/(Math.sqrt(2*Math.PI)*t)*Math.exp(-i*i/(2*t*t)));return n}for(var W4=[],X4=0;X4<256;X4++){var Y4=Cg();Y4[0]=2*Math.random()-1,Y4[1]=2*Math.random()-1,Y4[2]=Math.random(),Cg.normalize(Y4,Y4),Cg.scale(Y4,Y4,Math.random()),W4.push(Y4)}function K4(e){for(var t=[],r=0;r<e;r++){var n=(r*r+2*r+1)/(e*e);n=.1+.9*n,t.push(W4[r][0]*n),t.push(W4[r][1]*n),t.push(W4[r][2]*n)}return t}var Z4=Ac(Ac({},rB),{tSsaoDepth:TR("texture","rgba","ubyte","nearest"),tColor:TR("texture","rgba","ubyte","nearest"),tDepthOpaque:TR("texture","rgba","ubyte","nearest"),tDepthTransparent:TR("texture","rgba","ubyte","nearest"),tShadows:TR("texture","rgba","ubyte","nearest"),tOutlines:TR("texture","rgba","ubyte","nearest"),uTexSize:CR("v2"),dOrthographic:ER("number"),uNear:CR("f"),uFar:CR("f"),uFogNear:CR("f"),uFogFar:CR("f"),uFogColor:CR("v3"),uOutlineColor:CR("v3"),uOcclusionColor:CR("v3"),uTransparentBackgroun
139d:CR("b"),dOcclusionEnable:ER("boolean"),uOcclusionOffset:CR("v2"),dShadowEnable:ER("boolean"),dOutlineEnable:ER("boolean"),dOutlineScale:ER("number"),dTransparentOutline:ER("boolean")}),Q4={occlusion:Ib.MappedStatic("on",{on:Ib.Group({samples:Ib.Numeric(32,{min:1,max:256,step:1}),multiScale:Ib.MappedStatic("off",{on:Ib.Group({levels:Ib.ObjectList({radius:Ib.Numeric(5,{min:0,max:20,step:.1},{description:"Final occlusion radius is 2^x"}),bias:Ib.Numeric(1,{min:0,max:3,step:.1})},function(e){return`${e.radius}, ${e.bias}`},{defaultValue:[{radius:2,bias:1},{radius:5,bias:1},{radius:8,bias:1},{radius:11,bias:1}]}),nearThreshold:Ib.Numeric(10,{min:0,max:50,step:1}),farThreshold:Ib.Numeric(1500,{min:0,max:1e4,step:100})}),off:Ib.Group({})},{cycle:!0}),radius:Ib.Numeric(5,{min:0,max:20,step:.1},{description:"Final occlusion radius is 2^x",hideIf:function(e){return"on"===e?.multiScale.name}}),bias:Ib.Numeric(.8,{min:0,max:3,step:.1}),blurKernelSize:Ib.Numeric(15,{min:1,max:25,step:2}),resolutionScale:Ib.Numeric(1,{min:.1,max:1,step:.05},{description:"Adjust resolution of occlusion calculation"}),color:Ib.Color(tv(0))}),off:Ib.Group({})},{cycle:!0,description:"Darken occluded crevices with the ambient occlusion effect"}),shadow:Ib.MappedStatic("off",{on:Ib.Group({steps:Ib.Numeric(1,{min:1,max:64,step:1}),bias:Ib.Numeric(.6,{min:0,max:1,step:.01}),maxDistance:Ib.Numeric(3,{min:0,max:256,step:1}),tolerance:Ib.Numeric(1,{min:0,max:10,step:.1})}),off:Ib.Group({})},{cycle:!0,description:"Simplistic shadows"}),outline:Ib.MappedStatic("off",{on:Ib.Group({scale:Ib.Numeric(1,{min:1,max:5,step:1}),threshold:Ib.Numeric(.33,{min:.01,max:1,step:.01}),color:Ib.Color(tv(0)),includeTransparent:Ib.Boolean(!0,{description:"Whether to show outline for transparent objects"})}),off:Ib.Group({})},{cycle:!0,description:"Draw outline around 3D objects"}),antialiasing:Ib.MappedStatic("smaa",{fxaa:Ib.Group(f4),smaa:Ib.Group(g4),off:Ib.Group({})},{options:[["fxaa","FXAA"],["smaa","SMAA"],["off","Off"]],description:"Smooth pixel edges"}),sharpening:Ib.MappedStatic("off",{on:Ib.Group(F4),off:Ib.Group({})},{cycle:!0,description:"Contrast Adaptive Sharpening"}),background:Ib.Group(M4,{isFlat:!0})},J4=function(){function e(e,t,r){this.webgl=e,this.drawPass=r,this.bgColor=Cg(),this.occlusionOffset=[0,0],this.transparentBackground=!1;var n=r.colorTarget,i=r.depthTextureTransparent,a=r.depthTextureOpaque,o=n.getWidth(),s=n.getHeight();this.nSamples=1,this.blurKernelSize=1,this.ssaoScale=this.calcSsaoScale(1),this.levels=[],this.target=e.createRenderTarget(o,s,!1,"uint8","linear"),this.outlinesTarget=e.createRenderTarget(o,s,!1),this.outlinesRenderable=function(e,t,r){var n=t.getWidth(),i=t.getHeight(),a=Ac(Ac({},nB),{tDepthOpaque:tf.create(t),tDepthTransparent:tf.create(r),uTexSize:tf.create(Bg.create(n,i)),dOrthographic:tf.create(0),uNear:tf.create(1),uFar:tf.create(1e4),uInvProjection:tf.create(Og.identity()),uOutlineThreshold:tf.create(.33),dTransparentOutline:tf.create(!0)}),o=Ac({},j4);return eB(KR(e,"triangles",fk("outlines",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tDepthOpaque;\nuniform sampler2D tDepthTransparent;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform mat4 uInvProjection;\n\nuniform float uOutlineThreshold;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nfloat getDepthOpaque(const in vec2 coords) {\n    #ifdef depthTextureSupport\n        return texture2D(tDepthOpaque, coords).r;\n    #else\n        return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));\n    #endif\n}\n\nfloat getDepthTransparent(const in vec2 coords) {\n    #ifdef dTransparentOutline\n        return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));\n    #else\n        return 1.0;\n    #endif\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n    vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n    vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n    return distance(viewPos0, viewPos1);\n}\n\nvoid main(void) {\n    float backgroundViewZ = 2.0 * uFar;\n\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    vec2 invTexSize = 1.0 / uTexSize;\n\n    float selfDepthOpaque = getDepthOpaque(coords);
139\n    float selfViewZOpaque = isBackground(selfDepthOpaque) ? backgroundViewZ : getViewZ(selfDepthOpaque);\n    float pixelSizeOpaque = getPixelSize(coords, selfDepthOpaque) * uOutlineThreshold;\n\n    float selfDepthTransparent = getDepthTransparent(coords);\n    float selfViewZTransparent = isBackground(selfDepthTransparent) ? backgroundViewZ : getViewZ(selfDepthTransparent);\n    float pixelSizeTransparent = getPixelSize(coords, selfDepthTransparent) * uOutlineThreshold;\n\n    float outline = 1.0;\n    float bestDepth = 1.0;\n    float transparentFlag = 0.0;\n\n    for (int y = -1; y <= 1; y++) {\n        for (int x = -1; x <= 1; x++) {\n            vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n            float sampleDepthOpaque = getDepthOpaque(sampleCoords);\n            float sampleDepthTransparent = getDepthTransparent(sampleCoords);\n\n            float sampleViewZOpaque = isBackground(sampleDepthOpaque) ? backgroundViewZ : getViewZ(sampleDepthOpaque);\n            if (abs(selfViewZOpaque - sampleViewZOpaque) > pixelSizeOpaque && selfDepthOpaque > sampleDepthOpaque && sampleDepthOpaque <= bestDepth) {\n                outline = 0.0;\n                bestDepth = sampleDepthOpaque;\n            }\n\n            if (sampleDepthTransparent < sampleDepthOpaque) {\n                float sampleViewZTransparent = isBackground(sampleDepthTransparent) ? backgroundViewZ : getViewZ(sampleDepthTransparent);\n                if (abs(selfViewZTransparent - sampleViewZTransparent) > pixelSizeTransparent && selfDepthTransparent > sampleDepthTransparent && sampleDepthTransparent <= bestDepth) {\n                    outline = 0.0;\n                    bestDepth = sampleDepthTransparent;\n                    transparentFlag = 1.0;\n                }\n            }\n        }\n    }\n\n    gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth), transparentFlag);\n}\n"),o,a),a)}(e,a,i),this.shadowsTarget=e.createRenderTarget(o,s,!1),this.shadowsRenderable=function(e,t){var r=t.getWidth(),n=t.getHeight(),i=Ac(Ac({},nB),{tDepth:tf.create(t),uTexSize:tf.create(Bg.create(r,n)),uProjection:tf.create(Og.identity()),uInvProjection:tf.create(Og.identity()),uBounds:tf.create(Ng()),dOrthographic:tf.create(0),uNear:tf.create(1),uFar:tf.create(1e4),dSteps:tf.create(1),uMaxDistance:tf.create(3),uTolerance:tf.create(1),uBias:tf.create(.6),uLightDirection:tf.create([]),uLightColor:tf.create([]),dLightCount:tf.create(0)}),a=Ac({},z4);return eB(KR(e,"triangles",fk("shadows",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform float uNear;\nuniform float uFar;\n\n#if dLightCount != 0\n    uniform vec3 uLightDirection[dLightCount];\n    uniform vec3 uLightColor[dLightCount];\n#endif\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\nuniform float uMaxDistance;\nuniform float uTolerance;\nuniform float uBias;\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nbool outsideBounds(const in vec2 p) {\n    return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;\n}\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n    #ifdef depthTextureSupport\n        return texture2D(tDepth, coords).r;\n    #else\n        return unpackRGBAToDepth(texture2D(tDepth, coords));\n    #endif\n}\n\nfloat screenFade(const in vec2 coords) {\n    vec2 c = (coords - uBounds.xy) / (uBounds.zw - uBounds.xy);\n    vec2 fade = max(12.0 * abs(c - 0.5) - 5.0, vec2(0.0));\n    return saturate(1.0 - dot(fade, fade));\n}\n\n// based on https://panoskarabelas.com/posts/screen_space_shadows/\nfloat screenSpaceShadow(const in vec3 position, const in vec3 lightDirection, const in float stepLength) {\n    // Ray position and direction (in view-space)\n    vec3 rayPos = position;\n    vec3 rayDir = -lightDirection;\n\n    // Compute ray step\n    vec3 rayStep = rayDir * stepLength;
139\n\n    // Ray march towards the light\n    float occlusion = 0.0;\n    vec4 rayCoords = vec4(0.0);\n    for (int i = 0; i < dSteps; ++i) {\n        // Step the ray\n        rayPos += rayStep;\n\n        rayCoords = uProjection * vec4(rayPos, 1.0);\n        rayCoords.xyz = (rayCoords.xyz / rayCoords.w) * 0.5 + 0.5;\n\n        if (outsideBounds(rayCoords.xy))\n            return 1.0;\n\n        // Compute the difference between the ray's and the camera's depth\n        float depth = getDepth(rayCoords.xy);\n        float viewZ = getViewZ(depth);\n        float zDelta = rayPos.z - viewZ;\n\n        if (zDelta < uTolerance) {\n            occlusion = 1.0;\n\n            // Fade out as we approach the edges of the screen\n            occlusion *= screenFade(rayCoords.xy);\n\n            break;\n        }\n    }\n\n    return 1.0 - (uBias * occlusion);\n}\n\nvoid main(void) {\n    vec2 invTexSize = 1.0 / uTexSize;\n    vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n    float selfDepth = getDepth(selfCoords);\n\n    if (isBackground(selfDepth)) {\n        gl_FragColor = vec4(0.0);\n        return;\n    }\n\n    vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n    float stepLength = uMaxDistance / float(dSteps);\n\n    float o = 1.0;\n    #if dLightCount != 0\n        float sh[dLightCount];\n        #pragma unroll_loop_start\n        for (int i = 0; i < dLightCount; ++i) {\n            sh[i] = screenSpaceShadow(selfViewPos, uLightDirection[i], stepLength);\n            o = min(o, sh[i]);\n        }\n        #pragma unroll_loop_end\n    #endif\n\n    gl_FragColor = vec4(o);\n}\n"),a,i),i)}(e,a),this.ssaoFramebuffer=e.resources.framebuffer(),this.ssaoBlurFirstPassFramebuffer=e.resources.framebuffer(),this.ssaoBlurSecondPassFramebuffer=e.resources.framebuffer();var u=Math.floor(o*this.ssaoScale),c=Math.floor(s*this.ssaoScale),l=Math.max(1,Math.floor(.5*u)),d=Math.max(1,Math.floor(.5*c)),f=Math.max(1,Math.floor(.25*u)),h=Math.max(1,Math.floor(.25*c));this.downsampledDepthTarget=r.packedDepth?e.createRenderTarget(u,c,!1,"uint8","linear","rgba"):e.createRenderTarget(u,c,!1,"float32","linear",e.isWebGL2?"alpha":"rgba"),this.downsampleDepthRenderable=oB(e,a);var p=1===this.ssaoScale?a:this.downsampledDepthTarget.texture;this.depthHalfTarget=r.packedDepth?e.createRenderTarget(l,d,!1,"uint8","linear","rgba"):e.createRenderTarget(l,d,!1,"float32","linear",e.isWebGL2?"alpha":"rgba"),this.depthHalfRenderable=oB(e,p),this.depthQuarterTarget=r.packedDepth?e.createRenderTarget(f,h,!1,"uint8","linear","rgba"):e.createRenderTarget(f,h,!1,"float32","linear",e.isWebGL2?"alpha":"rgba"),this.depthQuarterRenderable=oB(e,this.depthHalfTarget.texture),this.ssaoDepthTexture=e.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthTexture.define(u,c),this.ssaoDepthTexture.attachFramebuffer(this.ssaoFramebuffer,"color0"),this.ssaoDepthBlurProxyTexture=e.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthBlurProxyTexture.define(u,c),this.ssaoDepthBlurProxyTexture.attachFramebuffer(this.ssaoBlurFirstPassFramebuffer,"color0"),this.ssaoDepthTexture.attachFramebuffer(this.ssaoBlurSecondPassFramebuffer,"color0"),this.ssaoRenderable=function(e,t,r,n){var i=Ac(Ac({},nB),{tDepth:tf.create(t),tDepthHalf:tf.create(r),tDepthQuarter:tf.create(n),uSamples:tf.create(K4(32)),dNSamples:tf.create(32),uProjection:tf.create(Og.identity()),uInvProjection:tf.create(Og.identity()),uBounds:tf.create(Ng()),uTexSize:tf.create(Bg.create(e.gl.drawingBufferWidth,e.gl.drawingBufferHeight)),uRadius:tf.create(32),uBias:tf.create(.8),dMultiScale:tf.create(!1),dLevels:tf.create(3),uLevelRadius:tf.create([4,32,256]),uLevelBias:tf.create([.8,.8,.8]),uNearThreshold:tf.create(10),uFarThreshold:tf.create(1500)}),a=Ac({},G4);return eB(KR(e,"triangles",fk("ssao",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\nuniform sampler2D tDepthHalf;\nuniform sampler2D tDepthQuarter;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform vec3 uSamples[dNSamples];\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\n#ifdef dMultiScale\n    uniform float uLevelRadius[dLevels];\n    uniform float uLevelBias[dLevels];\n    uniform float uNearThreshold;\n    uniform float uFarThreshold;\n#else\n    uniform float uRadius;\n#endif\nuniform float uBias;\n\nfloat smootherstep(float edge0, float edge1, float x) {\n    x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n    return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);\n}\n\nfloat noise(const in vec2 coords) {\n    float a = 12.9898;\n    float b = 78.233;\n    float c = 43758.5453;\n    float dt = dot(coords, vec2(a,b));\n    float sn = mod(dt, PI);\n    return abs(fract(sin(sn) * c)); // is abs necessary?\n}\n\nvec2 getNoiseVec2(const in vec2 coords) {\n    return vec2(noise(coords), noise(coords + vec2(PI, 2.71828)));\n}
139\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nfloat getDepth(const in vec2 coords) {\n    vec2 c = vec2(clamp(coords.x, uBounds.x, uBounds.z), clamp(coords.y, uBounds.y, uBounds.w));\n    #ifdef depthTextureSupport\n        return texture2D(tDepth, c).r;\n    #else\n        return unpackRGBAToDepth(texture2D(tDepth, c));\n    #endif\n}\n\n#define dQuarterThreshold 0.1\n#define dHalfThreshold 0.05\n\nfloat getMappedDepth(const in vec2 coords, const in vec2 selfCoords) {\n    vec2 c = vec2(clamp(coords.x, uBounds.x, uBounds.z), clamp(coords.y, uBounds.y, uBounds.w));\n    float d = distance(coords, selfCoords);\n    #ifdef depthTextureSupport\n        if (d > dQuarterThreshold) {\n            return texture2D(tDepthQuarter, c).r;\n        } else if (d > dHalfThreshold) {\n            return texture2D(tDepthHalf, c).r;\n        } else {\n            return texture2D(tDepth, c).r;\n        }\n    #else\n        if (d > dQuarterThreshold) {\n            return unpackRGBAToDepth(texture2D(tDepthQuarter, c));\n        } else if (d > dHalfThreshold) {\n            return unpackRGBAToDepth(texture2D(tDepthHalf, c));\n        } else {\n            return unpackRGBAToDepth(texture2D(tDepth, c));\n        }\n    #endif\n}\n\nvec3 normalFromDepth(const in float depth, const in float depth1, const in float depth2, vec2 offset1, vec2 offset2) {\n    vec3 p1 = vec3(offset1, depth1 - depth);\n    vec3 p2 = vec3(offset2, depth2 - depth);\n\n    vec3 normal = cross(p1, p2);\n    normal.z = -normal.z;\n\n    return normalize(normal);\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n    vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n    vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n    return distance(viewPos0, viewPos1);\n}\n\n// StarCraft II Ambient Occlusion by [Filion and McNaughton 2008]\nvoid main(void) {\n    vec2 invTexSize = 1.0 / uTexSize;\n    vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n    float selfDepth = getDepth(selfCoords);\n    vec2 selfPackedDepth = packUnitIntervalToRG(selfDepth);\n\n    if (isBackground(selfDepth)) {\n        gl_FragColor = vec4(packUnitIntervalToRG(1.0), selfPackedDepth);\n        return;\n    }\n\n    vec2 offset1 = vec2(0.0, invTexSize.y);\n    vec2 offset2 = vec2(invTexSize.x, 0.0);\n\n    float selfDepth1 = getDepth(selfCoords + offset1);\n    float selfDepth2 = getDepth(selfCoords + offset2);\n\n    vec3 selfViewNormal = normalFromDepth(selfDepth, selfDepth1, selfDepth2, offset1, offset2);\n    vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n\n    vec3 randomVec = normalize(vec3(getNoiseVec2(selfCoords) * 2.0 - 1.0, 0.0));\n    vec3 tangent = normalize(randomVec - selfViewNormal * dot(randomVec, selfViewNormal));\n    vec3 bitangent = cross(selfViewNormal, tangent);\n    mat3 TBN = mat3(tangent, bitangent, selfViewNormal);\n\n    float occlusion = 0.0;\n    #ifdef dMultiScale\n        float pixelSize = getPixelSize(selfCoords, selfDepth);\n\n        for(int l = 0; l < dLevels; l++) {\n            // TODO: smooth transition\n            if (pixelSize * uNearThreshold > uLevelRadius[l]) continue;\n            if (pixelSize * uFarThreshold < uLevelRadius[l]) continue;\n\n            float levelOcclusion = 0.0;\n            for(int i = 0; i < dNSamples; i++) {\n                vec3 sampleViewPos = TBN * uSamples[i];\n                sampleViewPos = selfViewPos + sampleViewPos * uLevelRadius[l];\n\n                vec4 offset = vec4(sampleViewPos, 1.0);\n                offset = uProjection * offset;\n                offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n                float sampleDepth = getMappedDepth(offset.xy, selfCoords);\n                float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, sampleDepth), uInvProjection).z;\n\n                levelOcclusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uLevelRadius[l] / abs(selfViewPos.z - sampleViewZ)) * uLevelBias[l];\n            }\n            occlusion = max(occlusion, levelOcclusion);\n        }\n    #else\n        for(int i = 0; i < dNSamples;
139 i++) {\n            vec3 sampleViewPos = TBN * uSamples[i];\n            sampleViewPos = selfViewPos + sampleViewPos * uRadius;\n\n            vec4 offset = vec4(sampleViewPos, 1.0);\n            offset = uProjection * offset;\n            offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n            float sampleDepth = getMappedDepth(offset.xy, selfCoords);\n            float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, sampleDepth), uInvProjection).z;\n\n            occlusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uRadius / abs(selfViewPos.z - sampleViewZ));\n        }\n    #endif\n    occlusion = 1.0 - (uBias * occlusion / float(dNSamples));\n\n    vec2 packedOcclusion = packUnitIntervalToRG(clamp(occlusion, 0.01, 1.0));\n\n    gl_FragColor = vec4(packedOcclusion, selfPackedDepth);\n}\n"),a,i),i)}(e,p,this.depthHalfTarget.texture,this.depthQuarterTarget.texture),this.ssaoBlurFirstPassRenderable=H4(e,this.ssaoDepthTexture,"horizontal"),this.ssaoBlurSecondPassRenderable=H4(e,this.ssaoDepthBlurProxyTexture,"vertical"),this.renderable=function(e,t,r,n,i,a,o){var s=Ac(Ac({},nB),{tSsaoDepth:tf.create(o),tColor:tf.create(t),tDepthOpaque:tf.create(r),tDepthTransparent:tf.create(n),tShadows:tf.create(i),tOutlines:tf.create(a),uTexSize:tf.create(Bg.create(t.getWidth(),t.getHeight())),dOrthographic:tf.create(0),uNear:tf.create(1),uFar:tf.create(1e4),uFogNear:tf.create(1e4),uFogFar:tf.create(1e4),uFogColor:tf.create(Cg.create(1,1,1)),uOutlineColor:tf.create(Cg.create(0,0,0)),uOcclusionColor:tf.create(Cg.create(0,0,0)),uTransparentBackground:tf.create(!1),dOcclusionEnable:tf.create(!0),uOcclusionOffset:tf.create(Bg.create(0,0)),dShadowEnable:tf.create(!1),dOutlineEnable:tf.create(!1),dOutlineScale:tf.create(1),dTransparentOutline:tf.create(!0)}),u=Ac({},Z4);return eB(KR(e,"triangles",fk("postprocessing",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepthOpaque;\nuniform sampler2D tDepthTransparent;\nuniform sampler2D tShadows;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform vec3 uOutlineColor;\nuniform vec3 uOcclusionColor;\nuniform bool uTransparentBackground;\nuniform vec2 uOcclusionOffset;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nfloat getDepthOpaque(const in vec2 coords) {\n    #ifdef depthTextureSupport\n        return texture2D(tDepthOpaque, coords).r;\n    #else\n        return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));\n    #endif\n}\n\nfloat getDepthTransparent(const in vec2 coords) {\n    #ifdef dTransparentOutline\n        return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));\n    #else\n        return 1.0;\n    #endif\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, const in float opaqueDepth, out float closestTexel) {\n    float backgroundViewZ = 2.0 * uFar;\n    vec2 invTexSize = 1.0 / uTexSize;\n\n    float transparentDepth = getDepthTransparent(coords);\n    float opaqueSelfViewZ = isBackground(opaqueDepth) ? backgroundViewZ : getViewZ(opaqueDepth);\n    float transparentSelfViewZ = isBackground(transparentDepth) ? backgroundViewZ : getViewZ(transparentDepth);\n    float selfDepth = min(opaqueDepth, transparentDepth);\n\n    float outline = 1.0;\n    closestTexel = 1.0;\n    for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n        for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n            if (x * x + y * y > dOutlineScale * dOutlineScale) {\n                continue;\n            }\n\n            vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n            vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);
139\n            float sampleOutline = sampleOutlineCombined.r;\n            float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n            float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);\n\n            float selfViewZ = sampleOutlineCombined.a == 0.0 ? opaqueSelfViewZ : transparentSelfViewZ;\n            if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel) {\n                outline = 0.0;\n                closestTexel = sampleOutlineDepth;\n            }\n        }\n    }\n    return closestTexel < opaqueDepth ? outline : 1.0;\n}\n\nfloat getSsao(vec2 coords) {\n    float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n    if (rawSsao > 0.999) {\n        return 1.0;\n    } else if (rawSsao > 0.001) {\n        return rawSsao;\n    }\n    // treat values close to 0.0 as errors and return no occlusion\n    return 1.0;\n}\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    vec4 color = texture2D(tColor, coords);\n\n    float viewDist;\n    float fogFactor;\n    float opaqueDepth = getDepthOpaque(coords);\n\n    #ifdef dOcclusionEnable\n        if (!isBackground(opaqueDepth)) {\n            viewDist = abs(getViewZ(opaqueDepth));\n            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n            float occlusionFactor = getSsao(coords + uOcclusionOffset);\n            if (!uTransparentBackground) {\n                color.rgb = mix(mix(uOcclusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n            } else {\n                color.rgb = mix(uOcclusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n            }\n        }\n    #endif\n\n    #ifdef dShadowEnable\n        if (!isBackground(opaqueDepth)) {\n            viewDist = abs(getViewZ(opaqueDepth));\n            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n            vec4 shadow = texture2D(tShadows, coords);\n            if (!uTransparentBackground) {\n                color.rgb = mix(mix(vec3(0), uFogColor, fogFactor), color.rgb, shadow.a);\n            } else {\n                color.rgb = mix(vec3(0) * (1.0 - fogFactor), color.rgb, shadow.a);\n            }\n        }\n    #endif\n\n    // outline needs to be handled after occlusion and shadow to keep them clean\n    #ifdef dOutlineEnable\n        float closestTexel;\n        float outline = getOutline(coords, opaqueDepth, closestTexel);\n        if (outline == 0.0) {\n            viewDist = abs(getViewZ(closestTexel));\n            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n            if (!uTransparentBackground) {\n                color.rgb = mix(uOutlineColor, uFogColor, fogFactor);\n            } else {\n                color.a = 1.0 - fogFactor;\n                color.rgb = mix(uOutlineColor, color.rgb, fogFactor);\n            }\n        }\n    #endif\n\n    gl_FragColor = color;\n}\n"),u,s),s)}(e,n.texture,a,i,this.shadowsTarget.texture,this.outlinesTarget.texture,this.ssaoDepthTexture),this.background=new k4(e,t,o,s)}return e.isEnabled=function(e){return"on"===e.occlusion.name||"on"===e.shadow.name||"on"===e.outline.name||"off"!==e.background.variant.name},e.isTransparentOutlineEnabled=function(e){return"on"===e.outline.name&&e.outline.params.includeTransparent},e.prototype.calcSsaoScale=function(e){return Math.min(1,1/this.webgl.pixelRatio)*e},e.prototype.setSize=function(e,t){var r=this.renderable.values.uTexSize.ref.value,n=r[0],i=r[1],a=this.calcSsaoScale(1);if(e!==n||t!==i||this.ssaoScale!==a){this.ssaoScale=a,this.target.setSize(e,t),this.outlinesTarget.setSize(e,t),this.shadowsTarget.setSize(e,t);var o=Math.floor(e*this.ssaoScale),s=Math.floor(t*this.ssaoScale);this.downsampledDepthTarget.setSize(o,s),this.ssaoDepthTexture.define(o,s),this.ssaoDepthBlurProxyTexture.define(o,s);var u=Math.max(1,Math.floor(.5*o)),c=Math.max(1,Math.floor(.5*s));this.depthHalfTarget.setSize(u,c);var l=Math.max(1,Math.floor(.25*o)),d=Math.max(1,Math.floor(.25*s));this.depthQuarterTarget.setSize(l,d),tf.update(this.renderable.values.uTexSize,Bg.set(this.renderable.values.uTexSize.ref.value,e,t)),tf.update(this.outlinesRenderable.values.uTexSize,Bg.set(this.outlinesRenderable.values.uTexSize.ref.value,e,t)),tf.update(this.shadowsRenderable.values.uTexSize,Bg.set(this.shadowsRenderable.values.uTexSize.ref.value,e,t)),tf.update(this.downsampleDepthRenderable.values.uTexSize,Bg.set(this.downsampleDepthRenderable.values.uTexSize.ref.value,o,s)),tf.update(this.depthHalfRenderable.values.uTexSize,Bg.set(this.depthHalfRenderable.values.uTexSize.ref.value,u,c)),tf.update(this.depthQuarterRenderable.values.uTexSize,Bg.set(this.depthQuarterRenderable.values.uTexSize.ref.value,l,d)),tf.update(this.ssaoRenderable.values.uTexSize,Bg.set(this.ssaoRenderable.values.uTexSize.ref.value,o,s)),tf.update(this.ssaoBlurFirstPassRenderable.values.uTexSize,Bg.set(this.ssaoBlurFirstPassRenderable.values.uTexSize.ref.value,o,s)),tf.update(this.ssaoBlurSecondPassRenderable.values.uTexSize,Bg.set(this.ssaoBlurSecondPassRenderable.values.uTexSize.ref.value,o,s));var f=1===this.ssaoScale?this.drawPass.depthTextureOpaque:this.downsampledDepthTarget.texture;tf.update(this.depthHalfRenderable.values.tColor,f),tf.update(this.ssaoRenderable.values.tDepth,f),this.depthHalfRenderable.update(
139),this.ssaoRenderable.update(),this.background.setSize(e,t)}},e.prototype.updateState=function(e,t,r,n,i){var a,o=!1,s=!1,u=!1,c=!1,l=!1,d=!1,f=+("orthographic"===e.state.mode),h="on"===n.outline.name,p="on"===n.shadow.name,m="on"===n.occlusion.name,g=Og.identity();Og.invert(g,e.projection);var v=this.renderable.values.uTexSize.ref.value,y=v[0],b=v[1],_=e.viewport;if("on"===n.occlusion.name){tf.update(this.ssaoRenderable.values.uProjection,e.projection),tf.update(this.ssaoRenderable.values.uInvProjection,g);var x=this.ssaoRenderable.values.uBounds,S=this.ssaoScale;Ng.set(x.ref.value,Math.floor(_.x*S)/(y*S),Math.floor(_.y*S)/(b*S),Math.ceil((_.x+_.width)*S)/(y*S),Math.ceil((_.y+_.height)*S)/(b*S)),tf.update(x,x.ref.value),tf.update(this.ssaoBlurFirstPassRenderable.values.uBounds,x.ref.value),tf.update(this.ssaoBlurSecondPassRenderable.values.uBounds,x.ref.value),tf.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uNear,e.near),tf.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uNear,e.near),tf.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uFar,e.far),tf.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uFar,e.far),tf.update(this.ssaoBlurFirstPassRenderable.values.uInvProjection,g),tf.update(this.ssaoBlurSecondPassRenderable.values.uInvProjection,g),this.ssaoBlurFirstPassRenderable.values.dOrthographic.ref.value!==f&&(c=!0,tf.update(this.ssaoBlurFirstPassRenderable.values.dOrthographic,f),tf.update(this.ssaoBlurSecondPassRenderable.values.dOrthographic,f)),this.nSamples!==n.occlusion.params.samples&&(u=!0,this.nSamples=n.occlusion.params.samples,tf.update(this.ssaoRenderable.values.uSamples,K4(this.nSamples)),tf.updateIfChanged(this.ssaoRenderable.values.dNSamples,this.nSamples));var w="on"===n.occlusion.params.multiScale.name;if(this.ssaoRenderable.values.dMultiScale.ref.value!==w&&(u=!0,tf.update(this.ssaoRenderable.values.dMultiScale,w)),"on"===n.occlusion.params.multiScale.name){var A=n.occlusion.params.multiScale.params;if(!cf(this.levels,A.levels)){u=!0,this.levels=A.levels;var C=function(e){var t=e.length,r={radius:Array(3*t).fill(0),bias:Array(3*t).fill(0)},n=r.radius,i=r.bias;e=e.slice().sort(function(e,t){return e.radius-t.radius});for(var a=0;a<t;++a){var o=e[a];n[a]=2**o.radius,i[a]=o.bias}return{count:t,radius:n,bias:i}}(A.levels);tf.updateIfChanged(this.ssaoRenderable.values.dLevels,C.count),tf.update(this.ssaoRenderable.values.uLevelRadius,C.radius),tf.update(this.ssaoRenderable.values.uLevelBias,C.bias)}tf.updateIfChanged(this.ssaoRenderable.values.uNearThreshold,A.nearThreshold),tf.updateIfChanged(this.ssaoRenderable.values.uFarThreshold,A.farThreshold)}else tf.updateIfChanged(this.ssaoRenderable.values.uRadius,2**n.occlusion.params.radius);if(tf.updateIfChanged(this.ssaoRenderable.values.uBias,n.occlusion.params.bias),this.blurKernelSize!==n.occlusion.params.blurKernelSize){c=!0,this.blurKernelSize=n.occlusion.params.blurKernelSize;var T=q4(this.blurKernelSize);tf.update(this.ssaoBlurFirstPassRenderable.values.uKernel,T),tf.update(this.ssaoBlurSecondPassRenderable.values.uKernel,T),tf.update(this.ssaoBlurFirstPassRenderable.values.dOcclusionKernelSize,this.blurKernelSize),tf.update(this.ssaoBlurSecondPassRenderable.values.dOcclusionKernelSize,this.blurKernelSize)}var P=this.calcSsaoScale(n.occlusion.params.resolutionScale);if(this.ssaoScale!==P){u=!0,l=!0,this.ssaoScale=P;var E=Math.floor(y*this.ssaoScale),M=Math.floor(b*this.ssaoScale);this.downsampledDepthTarget.setSize(E,M),this.ssaoDepthTexture.define(E,M),this.ssaoDepthBlurProxyTexture.define(E,M);var k=Math.floor(.5*E),I=Math.floor(.5*M);this.depthHalfTarget.setSize(k,I);var D=Math.floor(.25*E),O=Math.floor(.25*M);this.depthQuarterTarget.setSize(D,O);var R=1===this.ssaoScale?this.drawPass.depthTextureOpaque:this.downsampledDepthTarget.texture;tf.update(this.depthHalfRenderable.values.tColor,R),tf.update(this.ssaoRenderable.values.tDepth,R),tf.update(this.ssaoRenderable.values.tDepthHalf,this.depthHalfTarget.texture),tf.update(this.ssaoRenderable.values.tDepthQuarter,this.depthQuarterTarget.texture),tf.update(this.downsampleDepthRenderable.values.uTexSize,Bg.set(this.downsampleDepthRenderable.values.uTexSize.ref.value,E,M)),tf.update(this.depthHalfRenderable.values.uTexSize,Bg.set(this.depthHalfRenderable.values.uTexSize.ref.value,k,I)),tf.update(this.depthQuarterRenderable.values.uTexSize,Bg.set(this.depthQuarterRenderable.values.uTexSize.ref.value,D,O)),tf.update(this.ssaoRenderable.values.uTexSize,Bg.set(this.ssaoRenderable.values.uTexSize.ref.value,E,M)),tf.update(this.ssaoBlurFirstPassRenderable.values.uTexSize,Bg.set(this.ssaoBlurFirstPassRenderable.values.uTexSize.ref.value,E,M)),tf.update(this.ssaoBlurSecondPassRenderable.values.uTexSize,Bg.set(this.ssaoBlurSecondPassRenderable.values.uTexSize.ref.value,E,M))}tf.update(this.renderable.values.uOcclusionColor,tv.toVec3Normalized(this.renderable.values.uOcclusionColor.ref.value,n.occlusion.params.color))}if("on"===n.shadow.name&&(tf.update(this.shadowsRenderable.values.uProjection,e.projection),tf.update(this.shadowsRenderable.values.uInvProjection,g),Ng.set(this.shadowsRenderable.values.uBounds.ref.value,_.x/y,_.y/b,(_.x+_.width)/y,(_.y+_.height)/b),tf.update(this.shadowsRenderable.values.uBounds,this.shadowsRenderable.values.uBounds.ref.value),tf.updateIfChanged(this.shadowsRenderable.values.uNear,e.near),tf.updateIfChanged(this.shadowsRenderable.values.uFar,e.far),this.shadowsRenderable.values.dOrthographic.ref.value!==f&&(tf.update(this.shadowsRenderable.values.dOrthographic,f),o=!0),tf.updateIfChanged(this.shadowsRenderable.values.uMaxDistance,n.shadow.params.maxDistance),tf.updateIfChanged(this.shadowsRenderable.values.uTolerance,n.shadow.params.tolerance),tf.updateIfChanged(this.shadowsRenderable.values.uBias,n.shadow.params.bias),this.shadowsRenderable.values.dSteps.ref.value!==n.shadow.params.steps&&(tf.update(this.shadowsRenderable.values.dSteps,n.shadow.params.steps),o=!0),tf.update(this.shadowsRenderable.values.uLightDirection,i.direction),tf.update(this.shadowsRenderable.values.uLightColor,i.color),this.shadowsRenderable.values.dLightCount.ref.value!==i.count&&(tf.update(this.shadowsRenderable.values.dLightCount,i.count),o=!0)),"on"===n.outline.name){var B=null==(a=n.outline.params.includeTransparent)||a,N=Math.max(1,Math.round(n.outline.params.scale*this.webgl.pixelRatio))-1,F=50*n.outline.params.threshold*this.webgl.pixelRatio;tf.updateIfChanged(this.outlinesRenderable.values.uNear,e.near),tf.updateIfChanged(this.outlinesRenderable.values.uFar,e.far),tf.update(this.outlinesRenderable.values.uInvProjection,g),this.outlinesRenderable.values.dTransparentOutline.ref.value!==B&&(d=!0,tf.update(this.outlinesRenderable.values.dTransparentOutline,B)),this.outlinesRenderable.values.dOrthographic.ref.value!==f&&(d=!0,tf.update(this.outlinesRenderable.values.dOrthographic,f)),tf.updateIfChanged(this.outlinesRenderable.values.uOutlineThreshold,F),tf.update(this.renderable.values.uOutlineColor,tv.toVec3Normalized(this.renderable.values.uOutlineColor.ref.value,n.outline.params.color)),this.renderable.values.dOutlineScale.ref.value!==N&&(s=!0,tf.update(this.renderable.values.dOutlineScale,N)),this.renderable.values.dTransparentOutline.ref.value!==B&&(s=!0,tf.update(this.renderable.values.dTransparentOutline,B))}tf.updateIfChanged(this.renderable.values.uFar,e.far),tf.updateIfChanged(this.renderable.values.uNear,e.near),tf.updateIfChanged(this.renderable.values.uFogFar,e.fogFar),tf.updateIfChanged(this.renderable.values.uFogNear,e.fogNear),tf.update(this.renderable.values.uFogColor,tv.toVec3Normalized(this.renderable.values.uFogColor.ref.value,r)),tf.updateIfChanged(this.renderable.values.uTransparentBackgroun
139d,t),this.renderable.values.dOrthographic.ref.value!==f&&(s=!0,tf.update(this.renderable.values.dOrthographic,f)),this.renderable.values.dOutlineEnable.ref.value!==h&&(s=!0,tf.update(this.renderable.values.dOutlineEnable,h)),this.renderable.values.dShadowEnable.ref.value!==p&&(s=!0,tf.update(this.renderable.values.dShadowEnable,p)),this.renderable.values.dOcclusionEnable.ref.value!==m&&(s=!0,tf.update(this.renderable.values.dOcclusionEnable,m)),d&&this.outlinesRenderable.update(),o&&this.shadowsRenderable.update(),u&&this.ssaoRenderable.update(),c&&(this.ssaoBlurFirstPassRenderable.update(),this.ssaoBlurSecondPassRenderable.update()),l&&this.depthHalfRenderable.update(),s&&this.renderable.update();var L=this.webgl,$=L.gl,U=L.state;U.enable($.SCISSOR_TEST),U.disable($.BLEND),U.disable($.DEPTH_TEST),U.depthMask(!1)},e.prototype.setOcclusionOffset=function(e,t){this.occlusionOffset[0]=e,this.occlusionOffset[1]=t,tf.update(this.renderable.values.uOcclusionOffset,Bg.set(this.renderable.values.uOcclusionOffset.ref.value,e,t))},e.prototype.setTransparentBackground=function(e){this.transparentBackground=e},e.prototype.render=function(e,t,r,n,i,a){this.updateState(e,r,n,i,a);var o=this.webgl,s=o.gl,u=o.state,c=e.viewport,l=c.x,d=c.y,f=c.width,h=c.height;if("on"===i.occlusion.name&&0===this.occlusionOffset[0]&&0===this.occlusionOffset[1]){var p=Math.floor(l*this.ssaoScale),m=Math.floor(d*this.ssaoScale),g=Math.ceil(f*this.ssaoScale),v=Math.ceil(h*this.ssaoScale);u.viewport(p,m,g,v),u.scissor(p,m,g,v),this.ssaoScale<1&&(this.downsampledDepthTarget.bind(),this.downsampleDepthRenderable.render()),this.depthHalfTarget.bind(),this.depthHalfRenderable.render(),this.depthQuarterTarget.bind(),this.depthQuarterRenderable.render(),this.ssaoFramebuffer.bind(),this.ssaoRenderable.render(),this.ssaoBlurFirstPassFramebuffer.bind(),this.ssaoBlurFirstPassRenderable.render(),this.ssaoBlurSecondPassFramebuffer.bind(),this.ssaoBlurSecondPassRenderable.render()}u.viewport(l,d,f,h),u.scissor(l,d,f,h),"on"===i.outline.name&&(this.outlinesTarget.bind(),this.outlinesRenderable.render()),"on"===i.shadow.name&&(this.shadowsTarget.bind(),this.shadowsRenderable.render()),t?this.webgl.unbindFramebuffer():this.target.bind(),this.background.update(e,i.background),this.background.isEnabled(i.background)?(this.transparentBackground?u.clearColor(0,0,0,0):(tv.toVec3Normalized(this.bgColor,n),u.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],1)),s.clear(s.COLOR_BUFFER_BIT),u.enable(s.BLEND),u.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA),this.background.render()):(u.clearColor(0,0,0,1),s.clear(s.COLOR_BUFFER_BIT)),this.renderable.render()},e}(),e5=function(){function e(e,t){this.drawPass=t;var r=t.colorTarget,n=r.getWidth(),i=r.getHeight();this.target=e.createRenderTarget(n,i,!1),this.internalTarget=e.createRenderTarget(n,i,!1),this.fxaa=new h4(e,this.target.texture),this.smaa=new v4(e,this.target.texture),this.cas=new L4(e,this.target.texture)}return e.isEnabled=function(e){return"off"!==e.antialiasing.name},e.prototype.setSize=function(e,t){var r=this.target.texture.getWidth(),n=this.target.texture.getHeight();e===r&&t===n||(this.target.setSize(e,t),this.internalTarget.setSize(e,t),this.fxaa.setSize(e,t),this.smaa.supported&&this.smaa.setSize(e,t),this.cas.setSize(e,t))},e.prototype._renderFxaa=function(e,t,r){if("fxaa"===r.antialiasing.name){var n=J4.isEnabled(r)?this.drawPass.postprocessing.target.texture:this.drawPass.colorTarget.texture;this.fxaa.update(n,r.antialiasing.params),this.fxaa.render(e.viewport,t)}},e.prototype._renderSmaa=function(e,t,r){if("smaa"===r.antialiasing.name){var n=J4.isEnabled(r)?this.drawPass.postprocessing.target.texture:this.drawPass.colorTarget.texture;this.smaa.update(n,r.antialiasing.params),this.smaa.render(e.viewport,t)}},e.prototype._renderAntialiasing=function(e,t,r){"fxaa"===r.antialiasing.name?this._renderFxaa(e,t,r):"smaa"===r.antialiasing.name&&this._renderSmaa(e,t,r)},e.prototype._renderCas=function(e,t,r){if("on"===r.sharpening.name){var n="off"===r.antialiasing.name?J4.isEnabled(r)?this.drawPass.postprocessing.target.texture:this.drawPass.colorTarget.texture:this.internalTarget.texture;this.cas.update(n,r.sharpening.params),this.cas.render(e.viewport,t)}},e.prototype.render=function(e,t,r){if("off"!==r.antialiasing.name||"off"!==r.sharpening.name)if("smaa"!==r.antialiasing.name||this.smaa.supported){var n=t?void 0:this.target;"off"===r.sharpening.name?this._renderAntialiasing(e,n,r):("off"===r.antialiasing.name||this._renderAntialiasing(e,this.internalTarget,r),this._renderCas(e,n,r))}else console.error('SMAA not supported, missing "HTMLImageElement"')},e}(),t5=Ac(Ac({},rB),{tColor:TR("texture","rgba","ubyte","nearest"),uTexSize:CR("v2"),uWeight:CR("f")}),r5=fk("compose",jR,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSize;\nuniform float uWeight;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    gl_FragColor = texture2D(tColor, coords) * uWeight;\n}\n"),n5={mode:Ib.Select("temporal",[["off","Off"],["on","On"],["temporal","Temporal"]]),sampleLevel:Ib.Numeric(2,{min:0,max:5,step:1},{description:"Take level^2 samples."}),reduceFlicker:Ib.Boolean(!0,{description:'Reduce flicker in "temporal" mode.'})},i5=function(){function e(e,t){this.webgl=e,this.drawPass=t;var r=e.extensions,n=r.colorBufferFloat,i=r.textureFloat,a=r.colorBufferHalfFloat,o=r.textureHalfFloat,s=t.colorTarget.getWidth(),u=t.colorTarget.getHeight();this.colorTarget=e.createRenderTarget(s,u,!1);var c,l,d,f,h=a&&o?"fp16":n&&i?"float32":"uint8";this.composeTarget=e.createRenderTarget(s,u,!1,h),this.holdTarget=e.createRenderTarget(s,u,!1),this.compose=(c=e,l=t.colorTarget.texture,d=Ac(Ac({},nB),{tColor:tf.create(l),uTexSize:tf.create(Bg.create(l.getWidth(),l.getHeight())),uWeight:tf.create(1)}),f=Ac({},t5),eB(KR(c,"triangles",r5,f,d),d))}return e.isEnabled=function(e){return"off"!==e.mode},e.prototype.syncSize=function(){var e=this.drawPass.colorTarget.getWidth(),t=this.drawPass.colorTarget.getHeight(),r=this.compose.values.uTexSize.ref.value,n=r[0],i=r[1];e===n&&t===i||(this.colorTarget.setSize(e,t),this.composeTarget.setSize(e,t),this.holdTarget.setSize(e,t),tf.update(this.compose.values.uTexSize,Bg.set(this.compose.values.uTexSize.ref.value,e,t)))},e.prototype.render=function(e,t,r,n,i){return"temporal"!==r.multiSample.mode||i?(this.renderMultiSample(t,n,r),-2):this.renderTemporalMultiSample(e,t,r,n)},e.prototype.bindOutputTarget=function(e){e?this.webgl.unbindFramebuffer():this.colorTarget.bind()},e.prototype.renderMultiSample=function(e,t,r){var n=e.camera,i=this,a=i.compose,o=i.composeTarget,s=i.drawPass,u=i.webgl,c=u.gl,l=u.state,d=a5[Math.max(0,Math.min(r.multiSample.sampleLevel,5))],f=n.viewport,h=f.x,p=f.y,m=f.width,g=f.height,v=1/d.length;n.viewOffset.enabled=!0,tf.update(a.values.tColor,s.getColorTarget(r.postprocessing).texture),a.update();for(var y=0;y<d.length;++y){var b=d[y];Q3.setViewOffset(n.viewOffset,m,g,b[0],b[1],m,g),n.update();var _=v+.03125*((y+.5)/d.length-.5);tf.update(a.values.uWeight,_),0===y?s.postprocessing.setOcclusionOffset(0,0):s.postprocessing.setOcclusionOffset(b[0]/m,b[1]/g),s.render(e,r,!1),o.bind(),l.enable(c.BLEND),l.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),l.blendFuncSeparate(c.ONE,c.ONE,c.ONE,c.ONE),l.disable(c.DEPTH_TEST),l.depthMask(!1),l.viewport(h,p,m,g),l.scissor(h,p,m,g),0===y&&(l.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT)),a.render()}s.postprocessing.setOcclusionOffset(0,0),tf.update(a.values.uWeight,1),tf.update(a.values.tColor,o.texture),a.update(),this.bindOutputTarget(t),l.viewport(h,p,m,g),l.scissor(h,p,m,g),l.disable(c.BLEND),a.render(),n.viewOffset.enabled=!1,n.update()},e.prototype.renderTemporalMultiSample=function(e,t,r,n){var i=t.camera,a=this,o=a.compose,s=a.c
139omposeTarget,u=a.holdTarget,c=a.drawPass,l=a.webgl,d=l.gl,f=l.state,h=a5[Math.max(0,Math.min(r.multiSample.sampleLevel,5))];if(-2===e||e>=h.length)return-2;var p=i.viewport,m=p.x,g=p.y,v=p.width,y=p.height,b=1/h.length;if(-1===e)c.render(t,r,!1),tf.update(o.values.uWeight,1),tf.update(o.values.tColor,c.getColorTarget(r.postprocessing).texture),o.update(),u.bind(),f.disable(d.BLEND),f.disable(d.DEPTH_TEST),f.depthMask(!1),f.viewport(m,g,v,y),f.scissor(m,g,v,y),o.render(),e+=1;else{i.viewOffset.enabled=!0,tf.update(o.values.tColor,c.getColorTarget(r.postprocessing).texture),tf.update(o.values.uWeight,b),o.update();for(var _=2**Math.max(0,r.multiSample.sampleLevel-2),x=0;x<_;++x){var S=h[e];if(Q3.setViewOffset(i.viewOffset,v,y,S[0],S[1],v,y),i.update(),0===e?c.postprocessing.setOcclusionOffset(0,0):c.postprocessing.setOcclusionOffset(S[0]/v,S[1]/y),c.render(t,r,!1),s.bind(),f.enable(d.BLEND),f.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),f.blendFuncSeparate(d.ONE,d.ONE,d.ONE,d.ONE),f.disable(d.DEPTH_TEST),f.depthMask(!1),f.viewport(m,g,v,y),f.scissor(m,g,v,y),0===e&&(f.clearColor(0,0,0,0),d.clear(d.COLOR_BUFFER_BIT)),o.render(),(e+=1)>=h.length)break}}c.postprocessing.setOcclusionOffset(0,0),this.bindOutputTarget(n),f.viewport(m,g,v,y),f.scissor(m,g,v,y);var w=e*b;return w>0&&(tf.update(o.values.uWeight,1),tf.update(o.values.tColor,s.texture),o.update(),f.disable(d.BLEND),o.render()),w<1&&(tf.update(o.values.uWeight,1-w),tf.update(o.values.tColor,u.texture),o.update(),0===w?f.disable(d.BLEND):f.enable(d.BLEND),o.render()),i.viewOffset.enabled=!1,i.update(),e>=h.length?-2:e},e}(),a5=[[[0,0]],[[0,0],[-4,-4]],[[0,0],[6,-2],[-6,2],[2,6]],[[0,0],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[0,0],[-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]],[[0,0],[-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]]];a5.forEach(function(e){e.forEach(function(e){e[0]*=.0625,e[1]*=.0625})});var o5=function(){function e(e){this.multiSamplePass=e,this.sampleIndex=-2}return e.prototype.update=function(e,t){return e&&(this.sampleIndex=-1),"temporal"===t.mode&&-2!==this.sampleIndex},e.prototype.render=function(e,t,r,n){return this.sampleIndex=this.multiSamplePass.render(this.sampleIndex,e,t,r,!!n),this.sampleIndex<0},e}(),s5={eyeSeparation:Ib.Numeric(.062,{min:.02,max:.1,step:.001},{description:"Distance between left and right camera."}),focus:Ib.Numeric(10,{min:1,max:20,step:.1},{description:"Apparent object distance."})},u5=Ib.getDefaultValues(s5),c5=function(){function e(e,t){void 0===t&&(t={}),this.parent=e,this.left=new d5,this.right=new d5,this.props=Ac(Ac({},u5),t)}return Object.defineProperty(e.prototype,"viewport",{get:function(){return this.parent.viewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewOffset",{get:function(){return this.parent.viewOffset},enumerable:!1,configurable:!0}),e.prototype.setProps=function(e){Object.assign(this.props,e)},e.prototype.update=function(){this.parent.update(),function(e,t,r,n){h3.copy(r.viewport,e.viewport),Og.copy(r.view,e.view),Og.copy(r.projection,e.projection),Q3.copySnapshot(r.state,e.state),Q3.copyViewOffset(r.viewOffset,e.viewOffset),r.far=e.far,r.near=e.near,r.fogFar=e.fogFar,r.fogNear=e.fogNear,h3.copy(n.viewport,e.viewport),Og.copy(n.view,e.view),Og.copy(n.projection,e.projection),Q3.copySnapshot(n.state,e.state),Q3.copyViewOffset(n.viewOffset,e.viewOffset),n.far=e.far,n.near=e.near,n.fogFar=e.fogFar,n.fogNear=e.fogNear;var i=Math.floor(e.viewport.width/2),a=i/e.viewport.height;r.viewport.width=i,n.viewport.x+=i,n.viewport.width-=i;var o,s,u=t.eyeSeparation/2,c=u*e.near/t.focus,l=e.near*Math.tan(.5*e.state.fov);f5[12]=-u,h5[12]=u,o=-l*a+c,s=l*a+c,r.projection[0]=2*e.near/(s-o),r.projection[8]=(s+o)/(s-o),Og.mul(r.view,r.view,f5),Og.mul(r.projectionView,r.projection,r.view),Og.invert(r.inverseProjectionView,r.projectionView),o=-l*a-c,s=l*a-c,n.projection[0]=2*e.near/(s-o),n.projection[8]=(s+o)/(s-o),Og.mul(n.view,n.view,h5),Og.mul(n.projectionView,n.projection,n.view),Og.invert(n.inverseProjectionView,n.projectionView)}(this.parent,this.props,this.left,this.right)},e}();!function(e){e.is=function(e){return"left"in e&&"right"in e}}(c5||={});var l5,d5=function(){this.viewport=h3.create(0,0,0,0),this.view=Og(),this.projection=Og(),this.projectionView=Og(),this.inverseProjectionView=Og(),this.state=Q3.createDefaultSnapshot(),this.viewOffset=Q3.ViewOffset(),this.far=0,this.near=0,this.fogFar=0,this.fogNear=0},f5=Og.identity(),h5=Og.identity(),p5=2**24-2,m5=function(){function e(e,t,r){this.webgl=e,this.drawPass=t,this.pickBaseScale=r;var n=r/e.pixelRatio;this.pickWidth=Math.ceil(t.colorTarget.getWidth()*n),this.pickHeight=Math.ceil(t.colorTarget.getHeight()*n);var i=e.resources,a=e.extensions.drawBuffers,o=e.gl;a?(this.objectPickTexture=i.texture("image-uint8","rgba","ubyte","nearest"),this.objectPickTexture.define(this.pickWidth,this.pickHeight),this.instancePickTexture=i.texture("image-uint8","rgba","ubyte","nearest"),this.instancePickTexture.define(this.pickWidth,this.pickHeight),this.groupPickTexture=i.texture("image-uint8","rgba","ubyte","nearest"),this.groupPickTexture.define(this.pickWidth,this.pickHeight),this.depthPickTexture=i.texture("image-uint8","rgba","ubyte","nearest"),this.depthPickTexture.define(this.pickWidth,this.pickHeight),this.framebuffer=i.framebuffer(),this.objectPickFramebuffer=i.framebuffer(),this.instancePickFramebuffer=i.framebuffer(),this.groupPickFramebuffer=i.framebuffer(),this.depthPickFramebuffer=i.framebuffer(),this.framebuffer.bind(),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1,a.COLOR_ATTACHMENT2,a.COLOR_ATTACHMENT3]),this.objectPickTexture.attachFramebuffer(this.framebuffer,"color0"),this.instancePickTexture.attachFramebuffer(this.framebuffer,"color1"),this.groupPickTexture.attachFramebuffer(this.framebuffer,"color2"),this.depthPickTexture.attachFramebuffer(this.framebuffer,"color3"),this.depthRenderbuffer=dI(o)?i.renderbuffer("depth32f","depth",this.pickWidth,this.pickHeight):i.renderbuffer("depth16","depth",this.pickWidth,this.pickHeight),this.depthRenderbuffer.attachFramebuffer(this.framebuffer),this.objectPickTexture.attachFramebuffer(this.objectPickFramebuffer,"color0"),this.instancePickTexture.attachFramebuffer(this.instancePickFramebuffer,"color0"),this.groupPickTexture.attachFramebuffer(this.groupPickFramebuffer,"color0"),this.depthPickTexture.attachFramebuffer(this.depthPickFramebuffer,"color0")):(this.objectPickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight),this.instancePickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight),this.groupPickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight),this.depthPickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight))}return e.prototype.bindObject=function(){this.webgl.extensions.drawBuffers?this.objectPickFramebuffer.bind():this.objectPickTarget.bind()},e.prototype.bindInstance=function(){this.webgl.extensions.drawBuffers?this.instancePickFramebuffer.bind():this.instancePickTarget.bind()},e.prototype.bindGroup=function(){this.webgl.extensions.drawBuffers?this.groupPickFramebuffer.bind():this.groupPickTarget.bind()},e.prototype.bindDepth=function(){this.webgl.extensions.drawBuffers?this.depthPickFramebuffer.bind():this.depthPickTarget.bind()},Object.defineProperty(e.prototype,"drawingBufferHeight",{get:function(){return this.drawPass.colorTarget.getHeight()}
139,enumerable:!1,configurable:!0}),e.prototype.syncSize=function(){var e=this.pickBaseScale/this.webgl.pixelRatio,t=Math.ceil(this.drawPass.colorTarget.getWidth()*e),r=Math.ceil(this.drawPass.colorTarget.getHeight()*e);t===this.pickWidth&&r===this.pickHeight||(this.pickWidth=t,this.pickHeight=r,this.webgl.extensions.drawBuffers?(this.objectPickTexture.define(this.pickWidth,this.pickHeight),this.instancePickTexture.define(this.pickWidth,this.pickHeight),this.groupPickTexture.define(this.pickWidth,this.pickHeight),this.depthPickTexture.define(this.pickWidth,this.pickHeight),this.depthRenderbuffer.setSize(this.pickWidth,this.pickHeight)):(this.objectPickTarget.setSize(this.pickWidth,this.pickHeight),this.instancePickTarget.setSize(this.pickWidth,this.pickHeight),this.groupPickTarget.setSize(this.pickWidth,this.pickHeight),this.depthPickTarget.setSize(this.pickWidth,this.pickHeight)))},e.prototype.renderVariant=function(e,t,r,n,i,a){e.clear(!1),e.update(t,r),e.renderPick(r.primitives,t,i,null,a),n.handle.isEnabled&&e.renderPick(n.handle.scene,t,i,null,a),n.camera.isEnabled&&(n.camera.update(t),e.update(n.camera.camera,n.camera.scene),e.renderPick(n.camera.scene,n.camera.camera,i,null,a))},e.prototype.render=function(e,t,r,n){this.webgl.extensions.drawBuffers?(this.framebuffer.bind(),this.renderVariant(e,t,r,n,"pick",C3.None)):(this.objectPickTarget.bind(),this.renderVariant(e,t,r,n,"pick",C3.Object),this.instancePickTarget.bind(),this.renderVariant(e,t,r,n,"pick",C3.Instance),this.groupPickTarget.bind(),this.renderVariant(e,t,r,n,"pick",C3.Group),this.depthPickTarget.bind(),this.renderVariant(e,t,r,n,"depth",C3.None))},e}(),g5=function(){function e(e,t,r,n,i,a,o){void 0===o&&(o=1),this.webgl=e,this.renderer=t,this.scene=r,this.helper=n,this.pickPass=i,this.pickPadding=o,this.dirty=!0,this.viewport=h3(),this.setViewport(a.x,a.y,a.width,a.height)}return e.prototype.setupBuffers=function(){var e=this.pickWidth*this.pickHeight*4;this.objectBuffer&&this.objectBuffer.length===e||(this.objectBuffer=new Uint8Array(e),this.instanceBuffer=new Uint8Array(e),this.groupBuffer=new Uint8Array(e),this.depthBuffer=new Uint8Array(e))},e.prototype.setViewport=function(e,t,r,n){h3.set(this.viewport,e,t,r,n),this.pickScale=this.pickPass.pickBaseScale/this.webgl.pixelRatio,this.pickX=Math.ceil(e*this.pickScale),this.pickY=Math.ceil(t*this.pickScale);var i=Math.floor(r*this.pickScale),a=Math.floor(n*this.pickScale);i===this.pickWidth&&a===this.pickHeight||(this.pickWidth=i,this.pickHeight=a,this.halfPickWidth=Math.floor(this.pickWidth/2),this.setupBuffers()),this.spiral=function(e){for(var t,r=0,n=0,i=[0,-1],a=2*e+1,o=a/2,s=[],u=a**2;u>0;--u)-o<r&&r<=o&&-o<n&&n<=o&&s.push([r,n]),(r===n||r<0&&r===-n||r>0&&r===1-n)&&(t=[-i[1],i[0]],i[0]=t[0],i[1]=t[1]),r+=i[0],n+=i[1];return s}(Math.round(this.pickScale*this.pickPadding))},e.prototype.syncBuffers=function(){var e=this,t=e.pickX,r=e.pickY,n=e.pickWidth,i=e.pickHeight;this.pickPass.bindObject(),this.webgl.readPixels(t,r,n,i,this.objectBuffer),this.pickPass.bindInstance(),this.webgl.readPixels(t,r,n,i,this.instanceBuffer),this.pickPass.bindGroup(),this.webgl.readPixels(t,r,n,i,this.groupBuffer),this.pickPass.bindDepth(),this.webgl.readPixels(t,r,n,i,this.depthBuffer)},e.prototype.getBufferIdx=function(e,t){return 4*(t*this.pickWidth+e)},e.prototype.getDepth=function(e,t){var r=this.getBufferIdx(e,t),n=this.depthBuffer;return function(e,t,r,n){return Ng.set(IO,e/255,t/255,r/255,n/255),Ng.dot(IO,kO)}(n[r],n[r+1],n[r+2],n[r+3])},e.prototype.getId=function(e,t,r){var n=this.getBufferIdx(e,t);return PO(r[n],r[n+1],r[n+2])},e.prototype.render=function(e){var t=this,r=t.pickX,n=t.pickY,i=t.pickWidth,a=t.pickHeight,o=t.halfPickWidth,s=this,u=s.renderer,c=s.scene,l=s.helper;u.setTransparentBackground(!1),u.setDrawingBufferSize(i,a),u.setPixelRatio(this.pickScale),c5.is(e)?(u.setViewport(r,n,o,a),this.pickPass.render(u,e.left,c,l),u.setViewport(r+o,n,i-o,a),this.pickPass.render(u,e.right,c,l)):(u.setViewport(r,n,i,a),this.pickPass.render(u,e,c,l)),this.dirty=!1},e.prototype.identifyInternal=function(e,t,r){var n=this.webgl,i=this.pickScale;if(!n.isContextLost){e*=n.pixelRatio,t*=n.pixelRatio,t=this.pickPass.drawingBufferHeight-t;var a=this.viewport;if(!(e<a.x||t<a.y||e>a.x+a.width||t>a.y+a.height)){this.dirty&&(this.render(r),this.syncBuffers());
139var o=e-a.x,s=t-a.y,u=Math.floor(o*i),c=Math.floor(s*i),l=this.getId(u,c,this.objectBuffer);if(-1!==l&&l!==p5){var d=this.getId(u,c,this.instanceBuffer);if(-1!==d&&d!==p5){var f=this.getId(u,c,this.groupBuffer);if(-1!==f&&f!==p5){var h=this.getDepth(u,c),p=Cg.create(e,t,h);if(c5.is(r)){var m=Math.floor(a.width/2);e>a.x+m?(p[0]=a.x+2*(o-m),m3(p,p,a,r.right.inverseProjectionView)):(p[0]=a.x+2*o,m3(p,p,a,r.left.inverseProjectionView))}else m3(p,p,a,r.inverseProjectionView);return{id:{objectId:l,instanceId:d,groupId:f},position:p}}}}}}},e.prototype.identify=function(e,t,r){for(var n=0,i=this.spiral;n<i.length;n++){var a=i[n],o=this.identifyInternal(e+a[0],t+a[1],r);if(o)return o}},e}(),v5=Ac(Ac({},rB),{tWboitA:TR("texture","rgba","float","nearest"),tWboitB:TR("texture","rgba","float","nearest"),uTexSize:CR("v2")}),y5=fk("evaluate-wboit",jR,"\nprecision highp float;\n\nuniform sampler2D tWboitA;\nuniform sampler2D tWboitB;\nuniform vec2 uTexSize;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n\n    vec4 accum = texture2D(tWboitA, coords);\n    float r = 1.0 - accum.a;\n\n    accum.a = texture2D(tWboitB, coords).r;\n    // divisor needs to allow very small values for nice fading\n    gl_FragColor = vec4(accum.rgb / clamp(accum.a, 0.00000001, 50000.0), r);\n}\n"),b5=function(){function e(t,r,n){if(this.webgl=t,this._supported=!1,e.isSupported(t)){var i,a,o,s,u,c=t.resources,l=t.gl;this.textureA=c.texture("image-float32","rgba","float","nearest"),this.textureA.define(r,n),this.textureB=c.texture("image-float32","rgba","float","nearest"),this.textureB.define(r,n),this.depthRenderbuffer=dI(l)?c.renderbuffer("depth32f","depth",r,n):c.renderbuffer("depth16","depth",r,n),this.renderable=(i=t,a=this.textureA,o=this.textureB,s=Ac(Ac({},nB),{tWboitA:tf.create(a),tWboitB:tf.create(o),uTexSize:tf.create(Bg.create(a.getWidth(),a.getHeight()))}),u=Ac({},v5),eB(KR(i,"triangles",y5,u,s),s)),this.framebuffer=c.framebuffer(),this._supported=!0,this._init()}}return Object.defineProperty(e.prototype,"supported",{get:function(){return this._supported},enumerable:!1,configurable:!0}),e.prototype.bind=function(){var e=this.webgl,t=e.state,r=e.gl;this.framebuffer.bind(),t.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT),t.disable(r.DEPTH_TEST),t.blendFuncSeparate(r.ONE,r.ONE,r.ZERO,r.ONE_MINUS_SRC_ALPHA),t.enable(r.BLEND)},e.prototype.render=function(){var e=this.webgl,t=e.state,r=e.gl;t.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.enable(r.BLEND),this.renderable.update(),this.renderable.render()},e.prototype.setSize=function(e,t){var r=this.renderable.values.uTexSize.ref.value,n=r[0],i=r[1];e===n&&t===i||(this.textureA.define(e,t),this.textureB.define(e,t),this.depthRenderbuffer.setSize(e,t),tf.update(this.renderable.values.uTexSize,Bg.set(this.renderable.values.uTexSize.ref.value,e,t)))},e.prototype.reset=function(){this._supported&&this._init()},e.prototype._init=function(){var e=this.webgl.extensions.drawBuffers;this.framebuffer.bind(),e.drawBuffers([e.COLOR_ATTACHMENT0,e.COLOR_ATTACHMENT1]),this.textureA.attachFramebuffer(this.framebuffer,"color0"),this.textureB.attachFramebuffer(this.framebuffer,"color1"),this.depthRenderbuffer.attachFramebuffer(this.framebuffer)},e.isSupported=function(e){var t=e.extensions,r=t.drawBuffers,n=t.textureFloat,i=t.colorBufferFloat,a=t.depthTexture;if(n&&i&&a&&r)return!0;if(ay){var o=[];n||o.push("textureFloat"),i||o.push("colorBufferFloat"),a||o.push("depthTexture"),r||o.push("drawBuffers"),console.log(`Missing "${o.join('", "')}" extensions required for "wboit"`)}return!1},e}(),_5=Ac(Ac({},rB),{tDpoitBackColor:TR("texture","rgba","float","nearest"),uTexSize:CR("v2")}),x5=fk("blend-back-dpoit",jR,"\n    precision highp float;\n\n    uniform sampler2D tDpoitBackColor;\n    uniform vec2 uTexSize;\n\n    void main() {\n        vec2 coords = gl_FragCoord.xy / uTexSize;\n        gl_FragColor = texture2D(tDpoitBackColor, coords);\n        if (gl_FragColor.a == 0.0) {\n            discard;\n        }\n    }\n"),S5=Ac(Ac({},rB),{tDpoitFrontColor:TR("texture","rgba","float","nearest"),uTexSize:CR("v2")}),w5=fk("evaluate-dpoit",jR,"\nprecision highp float;\n\nuniform sampler2D tDpoitFrontColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    gl_FragColor = texture2D(tDpoitFrontColor, coords);\n}\n"),A5=function(){function e(t,r,n){if(this.webgl=t,this.DEPTH_CLEAR_VALUE=-99999,this.MAX_DEPTH=1,this.MIN_DEPTH=0,this.passCount=0,this._supported=!1,e.isSupported(t)){var i,a,o,s,u=t.resources,c=t.extensions,l=c.colorBufferHalfFloat,d=c.textureHalfFloat;dI(t.gl)?(this.depthTextures=[u.texture("image-float32","rg","float","nearest"),u.texture("image-float32","rg","float","nearest")],this.colorFrontTextures=l&&d?[u.texture("image-float16","rgba","fp16","nearest"),u.texture("image-float16","rgba","fp16","nearest")]:[u.texture("image-float32","rgba","float","nearest"),u.texture("image-float32","rgba","float","nearest")],this.colorBackTextures=l&&d?[u.texture("image-float16","rgba","fp16","nearest"),u.texture("image-float16","rgba","fp16","nearest")]:[u.texture("image-float32","rgba","float","nearest"),u.texture("image-float32","rgba","float","nearest")]):(this.depthTextures=[u.texture("image-float32","rgba","float","nearest"),u.texture("image-float32","rgba","float","nearest")],this.colorFrontTextures=[u.texture("image-float32","rgba","float","nearest"),u.texture("image-float32","rgba","float","nearest")],this.colorBackTextures=[u.texture("image-float32","rgba","float","nearest"),u.texture("image-float32","rgba","float","nearest")]),this.depthTextures[0].define(r,n),this.depthTextures[1].define(r,n),this.colorFrontTextures[0].define(r,n),this.colorFrontTextures[1].define(r,n),this.colorBackTextures[0].define(r,n),this.colorBackTextures[1].define(r,n),this.depthFramebuffers=[u.framebuffer(),u.framebuffer()],this.colorFramebuffers=[u.framebuffer(),u.framebuffer()],this.blendBackRenderable=(i=t,a=this.colorBackTextures[0],o=Ac(Ac({},nB),{tDpoitBackColor:tf.create(a),uTexSize:tf.create(Bg.create(a.getWidth(),a.getHeight()))}),s=Ac({},_5),eB(KR(i,"triangles",x5,s,o),o)),this.renderable=function(e,t){var r=Ac(Ac({},nB),{tDpoitFrontColor:tf.create(t),uTexSize:tf.create(Bg.create(t.getW
139idth(),t.getHeight()))});return eB(KR(e,"triangles",w5,Ac({},S5),r),r)}(t,this.colorFrontTextures[0]),this._supported=!0,this._init()}}return Object.defineProperty(e.prototype,"supported",{get:function(){return this._supported},enumerable:!1,configurable:!0}),e.prototype.bind=function(){var e=this.webgl,t=e.state,r=e.gl,n=e.extensions.blendMinMax;return this.passCount=0,this.depthFramebuffers[0].bind(),t.clearColor(this.DEPTH_CLEAR_VALUE,this.DEPTH_CLEAR_VALUE,0,0),r.clear(r.COLOR_BUFFER_BIT),this.depthFramebuffers[1].bind(),t.clearColor(-this.MIN_DEPTH,this.MAX_DEPTH,0,0),r.clear(r.COLOR_BUFFER_BIT),this.colorFramebuffers[0].bind(),t.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),this.colorFramebuffers[1].bind(),t.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),this.depthFramebuffers[0].bind(),t.blendEquation(n.MAX),t.depthMask(!1),{depth:this.depthTextures[1],frontColor:this.colorFrontTextures[1],backColor:this.colorBackTextures[1]}},e.prototype.bindDualDepthPeeling=function(){var e=this.webgl,t=e.state,r=e.gl,n=e.extensions.blendMinMax;return this.readId=this.passCount%2,this.writeId=1-this.readId,this.passCount+=1,this.depthFramebuffers[this.writeId].bind(),t.clearColor(this.DEPTH_CLEAR_VALUE,this.DEPTH_CLEAR_VALUE,0,0),r.clear(r.COLOR_BUFFER_BIT),this.colorFramebuffers[this.writeId].bind(),t.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),this.depthFramebuffers[this.writeId].bind(),t.blendEquation(n.MAX),t.depthMask(!1),{depth:this.depthTextures[this.readId],frontColor:this.colorFrontTextures[this.readId],backColor:this.colorBackTextures[this.readId]}},e.prototype.renderBlendBack=function(){var e=this.webgl,t=e.state,r=e.gl;t.blendEquation(r.FUNC_ADD),t.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),tf.update(this.blendBackRenderable.values.tDpoitBackColor,this.colorBackTextures[this.writeId]),this.blendBackRenderable.update(),this.blendBackRenderable.render()},e.prototype.render=function(){var e=this.webgl,t=e.state,r=e.gl;t.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),tf.update(this.renderable.values.tDpoitFrontColor,this.colorFrontTextures[this.writeId]),this.renderable.update(),this.renderable.render()},e.prototype.setSize=function(e,t){var r=this.renderable.values.uTexSize.ref.value,n=r[0],i=r[1];if(e!==n||t!==i){for(var a=0;a<2;a++)this.depthTextures[a].define(e,t),this.colorFrontTextures[a].define(e,t),this.colorBackTextures[a].define(e,t);tf.update(this.renderable.values.uTexSize,Bg.set(this.renderable.values.uTexSize.ref.value,e,t)),tf.update(this.blendBackRenderable.values.uTexSize,Bg.set(this.blendBackRenderable.values.uTexSize.ref.value,e,t))}},e.prototype.reset=function(){this._supported&&this._init()},e.prototype._init=function(){for(var e=this.webgl.extensions.drawBuffers,t=0;t<2;t++)this.depthFramebuffers[t].bind(),e.drawBuffers([e.COLOR_ATTACHMENT0,e.COLOR_ATTACHMENT1,e.COLOR_ATTACHMENT2]),this.colorFrontTextures[t].attachFramebuffer(this.depthFramebuffers[t],"color0"),this.colorBackTextures[t].attachFramebuffer(this.depthFramebuffers[t],"color1"),this.depthTextures[t].attachFramebuffer(this.depthFramebuffers[t],"color2"),this.colorFramebuffers[t].bind(),e.drawBuffers([e.COLOR_ATTACHMENT0,e.COLOR_ATTACHMENT1]),this.colorFrontTextures[t].attachFramebuffer(this.colorFramebuffers[t],"color0"),this.colorBackTextures[t].attachFramebuffer(this.colorFramebuffers[t],"color1")},e.isSupported=function(e){var t=e.extensions,r=t.drawBuffers,n=t.textureFloat,i=t.colorBufferFloat,a=t.blendMinMax;if(n&&i&&r&&a)return!0;if(ay){var o=[];n||o.push("textureFloat"),i||o.push("colorBufferFloat"),r||o.push("drawBuffers"),a||o.push("blendMinMax"),console.log(`Missing "${o.join('", "')}" extensions required for "dpoit"`)}return!1},e}(),C5={enabled:Ib.Boolean(!0),highlightEdgeColor:Ib.Color(tv.darken(tv.fromNormalizedRgb(1,.4,.6),1)),selectEdgeColor:Ib.Color(tv.darken(tv.fromNormalizedRgb(.2,1,.1),1)),edgeScale:Ib.Numeric(1,{min:1,max:3,step:1},{description:"Thickness of the edge."}),highlightEdgeStrength:Ib.Numeric(1,{min:0,max:1,step:.1}),selectEdgeStrength:Ib.Numeric(1,{min:0,max:1,step:.1}),ghostEdgeStrength:Ib.Numeric(.3,{min:0,max:1,step:.1},{description:"Opacity of the hidden edges that are covered by other geometry. When set to 1, one less geometry render pass is done."}),innerEdgeFactor:Ib.Numeric(1.5,{min:0,max:3,step:.1},{description:"Factor to multiply the inner edge color with - for added contrast."})},T5=function(){function e(e,t,r){this.webgl=e,this.depthTarget=e.createRenderTarget(t,r),this.maskTarget=e.createRenderTarget(t,r),this.edgesTarget=e.createRenderTarget(t,r),this.edge=function(e,t){var r=t.getW
139idth(),n=t.getHeight(),i=Ac(Ac({},nB),{tMaskTexture:tf.create(t),uTexSizeInv:tf.create(Bg.create(1/r,1/n)),dEdgeScale:tf.create(1)});return eB(KR(e,"triangles",E5,Ac({},P5),i),i)}(e,this.maskTarget.texture),this.overlay=function(e,t){var r=t.getWidth(),n=t.getHeight(),i=Ac(Ac({},nB),{tEdgeTexture:tf.create(t),uTexSizeInv:tf.create(Bg.create(1/r,1/n)),uHighlightEdgeColor:tf.create(Cg()),uSelectEdgeColor:tf.create(Cg()),uHighlightEdgeStrength:tf.create(1),uSelectEdgeStrength:tf.create(1),uGhostEdgeStrength:tf.create(0),uInnerEdgeFactor:tf.create(0)});return eB(KR(e,"triangles",k5,Ac({},M5),i),i)}(e,this.edgesTarget.texture)}return e.isEnabled=function(e){return e.enabled},e.prototype.setEdgeState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.enable(r.BLEND),n.blendFunc(r.ONE,r.ONE),n.blendEquation(r.FUNC_ADD),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,s=e.height;n.viewport(i,a,o,s),n.scissor(i,a,o,s),n.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)},e.prototype.setOverlayState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.enable(r.BLEND),n.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),n.blendEquation(r.FUNC_ADD),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,s=e.height;n.viewport(i,a,o,s),n.scissor(i,a,o,s)},e.prototype.setSize=function(e,t){var r=this.depthTarget.getWidth(),n=this.depthTarget.getHeight();e===r&&t===n||(this.depthTarget.setSize(e,t),this.maskTarget.setSize(e,t),this.edgesTarget.setSize(e,t),tf.update(this.edge.values.uTexSizeInv,Bg.set(this.edge.values.uTexSizeInv.ref.value,1/e,1/t)),tf.update(this.overlay.values.uTexSizeInv,Bg.set(this.overlay.values.uTexSizeInv.ref.value,1/e,1/t)))},e.prototype.update=function(e){var t=e.highlightEdgeColor,r=e.selectEdgeColor,n=e.edgeScale,i=e.innerEdgeFactor,a=e.ghostEdgeStrength,o=e.highlightEdgeStrength,s=e.selectEdgeStrength,u=this.edge.values,c=Math.max(1,Math.round(n*this.webgl.pixelRatio));u.dEdgeScale.ref.value!==c&&(tf.update(u.dEdgeScale,c),this.edge.update());var l=this.overlay.values;tf.update(l.uHighlightEdgeColor,tv.toVec3Normalized(l.uHighlightEdgeColor.ref.value,t)),tf.update(l.uSelectEdgeColor,tv.toVec3Normalized(l.uSelectEdgeColor.ref.value,r)),tf.updateIfChanged(l.uInnerEdgeFactor,i),tf.updateIfChanged(l.uGhostEdgeStrength,a),tf.updateIfChanged(l.uHighlightEdgeStrength,o),tf.updateIfChanged(l.uSelectEdgeStrength,s)},e.prototype.render=function(e,t){this.edgesTarget.bind(),this.setEdgeState(e),this.edge.render(),t?t.bind():this.webgl.unbindFramebuffer(),this.setOverlayState(e),this.overlay.render()},e}(),P5=Ac(Ac({},rB),{tMaskTexture:TR("texture","rgba","ubyte","linear"),uTexSizeInv:CR("v2"),dEdgeScale:ER("number")}),E5=fk("edge",jR,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tMaskTexture;\nuniform vec2 uTexSizeInv;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n    vec4 offset = vec4(float(dEdgeScale), 0.0, 0.0, float(dEdgeScale)) * vec4(uTexSizeInv, uTexSizeInv);\n    vec4 c0 = texture2D(tMaskTexture, coords);\n    vec4 c1 = texture2D(tMaskTexture, coords + offset.xy);\n    vec4 c2 = texture2D(tMaskTexture, coords - offset.xy);\n    vec4 c3 = texture2D(tMaskTexture, coords + offset.yw);\n    vec4 c4 = texture2D(tMaskTexture, coords - offset.yw);\n    float diff1 = (c1.r - c2.r) * 0.5;\n    float diff2 = (c3.r - c4.r) * 0.5;\n    float d = length(vec2(diff1, diff2));\n    if (d <= 0.0)\n        discard;\n    float a1 = min(c1.g, c2.g);\n    float a2 = min(c3.g, c4.g);\n    float visibility = min(a1, a2) > 0.001 ? 1.0 : 0.0;\n    float mask = c0.r;\n    float marker = min(c1.b, min(c2.b, min(c3.b, c4.b)));\n    float fogAlpha = min(c1.a, min(c2.a, min(c3.a, c4.a)));\n    gl_FragColor = vec4(visibility, mask, marker, fogAlpha);\n}\n"),M5=Ac(Ac({},rB),{tEdgeTexture:TR("texture","rgba","ubyte","linear"),uTexSizeInv:CR("v2"),uHighlightEdgeColor:CR("v3"),uSelectEdgeColor:CR("v3"),uHighlightEdgeStrength:CR("f"),uSelectEdgeStrength:CR("f"),uGhostEdgeStrength:CR("f"),uInnerEdgeFactor:CR("f")}),k5=fk("overlay",jR,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec2 uTexSizeInv;\nuniform sampler2D tEdgeTexture;\nuniform vec3 uHighlightEdgeColor;\nuniform vec3 uSelectEdgeColor;\nuniform float uHighlightEdgeStrength;\nuniform float uSelectEdgeStrength;\nuniform float uGhostEdgeStrength;\nuniform float uInnerEdgeFactor;
139\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n    vec4 edgeValue = texture2D(tEdgeTexture, coords);\n    if (edgeValue.a > 0.0) {\n        vec3 edgeColor = edgeValue.b == 1.0 ? uHighlightEdgeColor : uSelectEdgeColor;\n        gl_FragColor.rgb = edgeValue.g > 0.0 ? edgeColor : edgeColor * uInnerEdgeFactor;\n        gl_FragColor.a = (edgeValue.r == 1.0 ? uGhostEdgeStrength : 1.0) * edgeValue.a;\n        float edgeStrength = edgeValue.b == 1.0 ? uHighlightEdgeStrength : uSelectEdgeStrength;\n        gl_FragColor.a *= edgeStrength;\n    } else {\n        gl_FragColor = vec4(0.0);\n    }\n}\n"),I5=function(){function e(e,t,r,n,i,a){this.webgl=e;var o,s=e.extensions,u=e.resources,c=e.isWebGL2;this.drawTarget=(o=e.gl,{id:eI(),texture:AI(o),framebuffer:{id:QM(),bind:function(){},reset:function(){},destroy:function(){}},depthRenderbuffer:null,getWidth:function(){return 0},getHeight:function(){return 0},bind:function(){o.bindFramebuffer(o.FRAMEBUFFER,null)},setSize:function(){},reset:function(){},destroy:function(){}}),this.colorTarget=e.createRenderTarget(r,n,!0,"uint8","linear"),this.packedDepth=!s.depthTexture,this.depthTargetTransparent=e.createRenderTarget(r,n),this.depthTextureTransparent=this.depthTargetTransparent.texture,this.depthTargetOpaque=this.packedDepth?e.createRenderTarget(r,n):null,this.depthTextureOpaque=this.depthTargetOpaque?this.depthTargetOpaque.texture:u.texture("image-depth","depth",c?"float":"ushort","nearest"),this.packedDepth||this.depthTextureOpaque.define(r,n),this.wboit=i?new b5(e,r,n):void 0,this.dpoit=a?new A5(e,r,n):void 0,this.marking=new T5(e,r,n),this.postprocessing=new J4(e,t,this),this.antialiasing=new e5(e,this),this.copyFboTarget=oB(e,this.colorTarget.texture),this.copyFboPostprocessing=oB(e,this.postprocessing.target.texture)}return Object.defineProperty(e.prototype,"wboitEnabled",{get:function(){return!!this.wboit?.supported},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dpoitEnabled",{get:function(){return!!this.dpoit?.supported},enumerable:!1,configurable:!0}),e.prototype.reset=function(){var e,t;null==(e=this.wboit)||e.reset(),null==(t=this.dpoit)||t.reset()},e.prototype.setSize=function(e,t){var r,n,i=this.colorTarget.getWidth(),a=this.colorTarget.getHeight();e===i&&t===a||(this.colorTarget.setSize(e,t),this.depthTargetTransparent.setSize(e,t),this.depthTargetOpaque?this.depthTargetOpaque.setSize(e,t):this.depthTextureOpaque.define(e,t),tf.update(this.copyFboTarget.values.uTexSize,Bg.set(this.copyFboTarget.values.uTexSize.ref.value,e,t)),tf.update(this.copyFboPostprocessing.values.uTexSize,Bg.set(this.copyFboPostprocessing.values.uTexSize.ref.value,e,t))),null!=(r=this.wboit)&&r.supported&&this.wboit.setSize(e,t),null!=(n=this.dpoit)&&n.supported&&this.dpoit.setSize(e,t),this.marking.setSize(e,t),this.postprocessing.setSize(e,t),this.antialiasing.setSize(e,t)},e.prototype._renderDpoit=function(e,t,r,n,i,a){if(!this.dpoit?.supported)throw Error("expected dpoit to be supported");if(this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),e.clear(!0),r.hasOpaque&&e.renderDpoitOpaque(r.primitives,t,null),J4.isEnabled(a)&&(J4.isTransparentOutlineEnabled(a)&&(this.depthTargetTransparent.bind(),e.clearDepth(!0),r.opacityAverage<1&&e.renderDepthTransparent(r.primitives,t,this.depthTextureOpaque)),this.postprocessing.render(t,!1,i,e.props.backgroundColor,a,e.light)),this.depthTextureOpaque.detachFramebuffer(this.colorTarget.framebuffer,"depth"),r.opacityAverage<1){var o=J4.isEnabled(a)?this.postprocessing.target:this.colorTarget,s=this.dpoit.bind();e.renderDpoitTransparent(r.primitives,t,this.depthTextureOpaque,s);for(var u=0;u<n;u++){var c=this.dpoit.bindDualDepthPeeling();e.renderDpoitTransparent(r.primitives,t,this.depthTextureOpaque,c),o.bind(),this.dpoit.renderBlendBack()}o.bind(),this.dpoit.render()}r.volumes.renderables.length>0&&e.renderDpoitVolume(r.volumes,t,this.depthTextureOpaque)},e.prototype._renderWboit=function(e,t,r,n,i){if(!this.wboit?.supported)throw Error("expected wboit to be supported");this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),e.clear(!0),r.hasOpaque&&e.renderWboitOpaque(r.primitives,t,null),J4.isEnabled(i)&&(J4.isTransparentOutlineEnabled(i)&&(this.depthTargetTransparent.bind(),e.clearDepth(!0),r.opacityAverage<1&&e.renderDepthTransparent
139(r.primitives,t,this.depthTextureOpaque)),this.postprocessing.render(t,!1,n,e.props.backgroundColor,i,e.light)),(r.opacityAverage<1||r.volumes.renderables.length>0)&&(this.wboit.bind(),r.opacityAverage<1&&e.renderWboitTransparent(r.primitives,t,this.depthTextureOpaque),r.volumes.renderables.length>0&&e.renderWboitTransparent(r.volumes,t,this.depthTextureOpaque),J4.isEnabled(i)?this.postprocessing.target.bind():this.colorTarget.bind(),this.wboit.render())},e.prototype._renderBlended=function(e,t,r,n,i,a){var o,s,u,c;if(n?this.drawTarget.bind():this.packedDepth?this.colorTarget.bind():this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),e.clear(!0),r.hasOpaque&&e.renderBlendedOpaque(r.primitives,t,null),!n&&(this.depthTargetOpaque&&(this.depthTargetOpaque.bind(),e.clearDepth(!0),e.renderDepthOpaque(r.primitives,t,null),this.colorTarget.bind()),J4.isEnabled(a)&&(this.packedDepth?null==(o=this.colorTarget.depthRenderbuffer)||o.detachFramebuffer(this.postprocessing.target.framebuffer):this.depthTextureOpaque.detachFramebuffer(this.postprocessing.target.framebuffer,"depth"),J4.isTransparentOutlineEnabled(a)&&(this.depthTargetTransparent.bind(),e.clearDepth(!0),r.opacityAverage<1&&e.renderDepthTransparent(r.primitives,t,this.depthTextureOpaque)),this.postprocessing.render(t,!1,i,e.props.backgroundColor,a,e.light),this.packedDepth?null==(s=this.colorTarget.depthRenderbuffer)||s.attachFramebuffer(this.postprocessing.target.framebuffer):this.depthTextureOpaque.attachFramebuffer(this.postprocessing.target.framebuffer,"depth")),r.volumes.renderables.length>0)){var l=J4.isEnabled(a)?this.postprocessing.target:this.colorTarget;this.packedDepth?null==(u=this.colorTarget.depthRenderbuffer)||u.detachFramebuffer(l.framebuffer):this.depthTextureOpaque.detachFramebuffer(l.framebuffer,"depth"),l.bind(),e.renderBlendedVolume(r.volumes,t,this.depthTextureOpaque),this.packedDepth?null==(c=this.colorTarget.depthRenderbuffer)||c.attachFramebuffer(l.framebuffer):this.depthTextureOpaque.attachFramebuffer(l.framebuffer,"depth"),l.bind()}r.opacityAverage<1&&e.renderBlendedTransparent(r.primitives,t,null)},e.prototype._render=function(e,t,r,n,i,a,o){var s=r.volumes.renderables.length>0,u=J4.isEnabled(o.postprocessing),c=e5.isEnabled(o.postprocessing),l=T5.isEnabled(o.marking),d=t.viewport,f=d.x,h=d.y,p=d.width,m=d.height;e.setViewport(f,h,p,m),e.update(t,r),a&&!c&&i&&(this.drawTarget.bind(),e.clear(!1)),this.wboitEnabled?this._renderWboit(e,t,r,a,o.postprocessing):this.dpoitEnabled?this._renderDpoit(e,t,r,o.dpoitIterations,a,o.postprocessing):this._renderBlended(e,t,r,!s&&!u&&!c&&i,a,o.postprocessing);var g=u?this.postprocessing.target:!i||s||this.wboitEnabled||this.dpoitEnabled?this.colorTarget:this.drawTarget;if(l&&r.markerAverage>0){var v=o.marking.ghostEdgeStrength<1;v&&1!==r.markerAverage&&(this.marking.depthTarget.bind(),e.clear(!1,!0),e.renderMarkingDepth(r.primitives,t,null)),this.marking.maskTarget.bind(),e.clear(!1,!0),e.renderMarkingMask(r.primitives,t,v?this.marking.depthTarget.texture:null),this.marking.update(o.marking),this.marking.render(t.viewport,g)}else g.bind();n.debug.isEnabled&&(n.debug.syncVisibility(),e.renderBlended(n.debug.scene,t)),n.handle.isEnabled&&e.renderBlended(n.handle.scene,t),n.camera.isEnabled&&(n.camera.update(t),e.update(n.camera.camera,n.camera.scene),e.renderBlended(n.camera.scene,n.camera.camera)),c?this.antialiasing.render(t,i,o.postprocessing):i&&(this.drawTarget.bind(),this.webgl.state.disable(this.webgl.gl.DEPTH_TEST),u?this.copyFboPostprocessing.render():(s||this.wboitEnabled||this.dpoitEnabled)&&this.copyFboTarget.render()),this.webgl.gl.flush()},e.prototype.render=function(e,t,r){var n=e.renderer,i=e.camera,a=e.scene,o=e.helper;this.postprocessing.setTransparentBackground(t.transparentBackground);var s=t.transparentBackground||this.postprocessing.background.isEnabled(t.postprocessing.background);n.setTransparentBackground(s),n.setDrawingBufferSize(this.colorTarget.getWidth(),this.colorTarget.getHeight()),n.setPixelRatio(this.webgl.pixelRatio),c5.is(i)?(this._render(n,i.left,a,o,r,s,t),this._render(n,i.right,a,o,r,s,t)):this._render(n,i,a,o,r,s,t)},e.prototype.getColorTarget=function(e){return e5.isEnabled(e)?this.antialiasing.target:J4.isEnabled(e)?this.postprocessing.target:this.colorTarget},e}
139(),D5={alpha:Ib.Numeric(.51,{min:0,max:1,step:.01},{isEssential:!0,label:"Opacity"}),colorX:Ib.Color(MC.red,{isEssential:!0}),colorY:Ib.Color(MC.green,{isEssential:!0}),colorZ:Ib.Color(MC.blue,{isEssential:!0}),scale:Ib.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0}),location:Ib.Select("bottom-left",Ib.arrayToOptions(["bottom-left","bottom-right","top-left","top-right"])),locationOffsetX:Ib.Numeric(0),locationOffsetY:Ib.Numeric(0),originColor:Ib.Color(MC.grey),radiusScale:Ib.Numeric(.075,{min:.01,max:.3,step:.001}),showPlanes:Ib.Boolean(!0),planeColorXY:Ib.Color(MC.grey,{label:"Plane Color XY"}),planeColorXZ:Ib.Color(MC.grey,{label:"Plane Color XZ"}),planeColorYZ:Ib.Color(MC.grey,{label:"Plane Color YZ"}),showLabels:Ib.Boolean(!1),labelX:Ib.Text("X"),labelY:Ib.Text("Y"),labelZ:Ib.Text("Z"),labelColorX:Ib.Color(MC.grey),labelColorY:Ib.Color(MC.grey),labelColorZ:Ib.Color(MC.grey),labelOpacity:Ib.Numeric(1,{min:0,max:1,step:.01}),labelScale:Ib.Numeric(.25,{min:.1,max:1,step:.01})},O5={axes:Ib.MappedStatic("on",{on:Ib.Group(D5),off:Ib.Group({})},{cycle:!0,description:"Show camera orientation axes"})},R5=function(){function e(e,t){void 0===t&&(t={});var r=this;this.webgl=e,this.props={axes:{name:"off",params:{}}},this.pixelRatio=1,this.eachGroup=function(e,t){if(!B5(e))return!1;var n=!1;if(r.meshRenderObject)for(var i=r.meshRenderObject.values.uGroupCount.ref.value,a=0,o=e.elements;a<o.length;a++){var s=o[a],u=s.groupId,c=s.instanceId*i+u;t($T.ofSingleton(c))&&(n=!0)}if(r.textRenderObject){i=r.textRenderObject.values.uGroupCount.ref.value;for(var l=0,d=e.elements;l<d.length;l++){var f=d[l];u=f.groupId,c=f.instanceId*i+u,t($T.ofSingleton(c))&&(n=!0)}}return n},this.scene=G3.create(e,VR),this.camera=new Q3,Cg.set(this.camera.up,0,1,0),Cg.set(this.camera.target,0,0,0),this.setProps(t)}return e.prototype.setProps=function(e){var t=this;this.props=oS(this.props,function(r){if(void 0!==e.axes&&(r.axes.name=e.axes.name,"on"===e.axes.name)){t.scene.clear(),t.pixelRatio=t.webgl.pixelRatio;var n=Ac(Ac({},e.axes.params),{scale:e.axes.params.scale*t.pixelRatio,labelScale:e.axes.params.labelScale*t.pixelRatio});t.meshRenderObject=function(e){var t=function(e){var t=100*e.scale,r=function(e){var t=dO.createState(512,256,void 0),r=100*e.scale,n=e.radiusScale*r,i=e.showLabels?100*e.labelScale/3:0,a=Cg.scale(Cg(),Cg.unitX,r-i),o=Cg.scale(Cg(),Cg.unitY,r-i),s=Cg.scale(Cg(),Cg.unitZ,r-i),u={radiusTop:n,radiusBottom:n,radialSegments:32};if(t.currentGroup=l5.Origin,OD(t,Cg.origin,n,2),t.currentGroup=l5.X,OD(t,a,n,2),uO(t,Cg.origin,a,1,u),t.currentGroup=l5.Y,OD(t,o,n,2),uO(t,Cg.origin,o,1,u),t.currentGroup=l5.Z,OD(t,s,n,2),uO(t,Cg.origin,s,1,u),e.showPlanes){Cg.scale(a,a,.5),Cg.scale(o,o,.5),Cg.scale(s,s,.5),t.currentGroup=l5.XY,dO.addTriangle(t,Cg.origin,a,o),dO.addTriangle(t,Cg.origin,o,a);var c=Cg.add(Cg(),a,o);dO.addTriangle(t,c,a,o),dO.addTriangle(t,c,o,a),t.currentGroup=l5.XZ,dO.addTriangle(t,Cg.origin,a,s),dO.addTriangle(t,Cg.origin,s,a);var l=Cg.add(Cg(),a,s);dO.addTriangle(t,l,a,s),dO.addTriangle(t,l,s,a),t.currentGroup=l5.YZ,dO.addTriangle(t,Cg.origin,o,s),dO.addTriangle(t,Cg.origin,s,o);var d=Cg.add(Cg(),o,s);dO.addTriangle(t,d,o,s),dO.addTriangle(t,d,s,o)}return dO.getMesh(t)}(e);return r.setBoundingSphere(XE.create(Cg.create(t/2,t/2,t/2),t+t/4)),_B.create("axes-mesh",{},r,function(t){switch(t){case l5.X:return e.colorX;case l5.Y:return e.colorY;case l5.Z:return e.colorZ;case l5.XY:return e.planeColorXY;case l5.XZ:return e.planeColorXZ;case l5.YZ:return e.planeColorYZ;case l5.Origin:return e.originColor;default:return MC.grey}},function(){return 1},function(){return""})}(e);return _B.createRenderObject(t,Ac(Ac(Ac({},Ib.getDefaultValues(sD.Params)),e),{ignoreLight:!0}))}(n),t.scene.add(t.meshRenderObject),e.axes.params.showLabels?(t.textRenderObject=function(e){var t=function(e){var t=100*e.scale,r=function(e){var t=FJ.create(e,8,8,void 0),r=100*e.scale,n=Cg.scale(Cg(),Cg.unitX,r),i=Cg.scale(Cg(),Cg.unitY,r),a=Cg.scale(Cg(),Cg.unitZ,r),o=100*e.labelScale;return t.add(e.labelX,n[0],n[1],n[2],0,o,l5.X),t.add(e.labelY,i[0],i[1],i[2],0,o,l5.Y),t.add(e.labelZ,a[0],a[1],a[2],0,o,l5.Z),t.getText()}(e);return r.setBoundingSphere(XE.create(Cg.create(t/2,t/2,t/2),t)),_B.create("axes-text",{},r,function(t){switch(t){case l5.X:return e.labelColorX;case l5.Y:return e.labelColorY;case l5.Z:return e.labelColorZ;default:return MC.grey}},function(){return 1},function(){return""})}(e);return _B.createRenderObject(t,Ac(Ac(Ac({},Ib.getDefaultValues(UO.Params)),e),{alpha:e.labelOpacity}))}(n),t.scene.add(t.textRenderObject)):t.textRenderObject=void 0,t.scene.commit(),Cg.set(t.camera.position,0,0,200*n.scale),Og.lookAt(t.camera.view,t.camera.position,t.camera.target,t.camera.up),r.axes.params=Ac({},e.axes.params)}})}
139,Object.defineProperty(e.prototype,"isEnabled",{get:function(){return"on"===this.props.axes.name},enumerable:!1,configurable:!0}),e.prototype.getLoci=function(e){var t=e.objectId,r=e.groupId,n=e.instanceId;return(this.meshRenderObject&&t===this.meshRenderObject.id||this.textRenderObject&&t===this.textRenderObject.id)&&r!==l5.None?function(e,t,r){return IQ("camera-axes",e,[{groupId:t,instanceId:r}],void 0,function(){return function(e,t){var r=t.props.axes,n="on"===r.name?r.params.labelX:"X",i="on"===r.name?r.params.labelY:"Y",a="on"===r.name?r.params.labelZ:"Z";switch(e){case l5.X:return`${n} Axis`;case l5.Y:return`${i} Axis`;case l5.Z:return`${a} Axis`;case l5.XY:return`${n}${i} Plane`;case l5.XZ:return`${n}${a} Plane`;case l5.YZ:return`${i}${a} Plane`;case l5.Origin:return"Origin";default:return"Axes"}}(t,e)})}(this,r,n):EQ},e.prototype.mark=function(e,t){return!(!_Q.is(_Q.Highlighting,t)||!(CQ(e)||B5(e)&&e.data===this))&&(tJ.mark(this.meshRenderObject,e,t,this.eachGroup)||tJ.mark(this.textRenderObject,e,t,this.eachGroup))},e.prototype.update=function(e){if(this.meshRenderObject&&"off"!==this.props.axes.name){this.pixelRatio!==this.webgl.pixelRatio&&this.setProps(this.props),function(e,t,r){var n=e.near,i=e.far,a=-t.width/2,o=t.width/2,s=t.height/2,u=-t.height/2,c=(o-a)/2,l=(s-u)/2,d=(o+a)/2,f=(s+u)/2,h=d-c,p=d+c,m=f+l,g=f-l;if(r.enabled){var v=(o-a)/r.width,y=(s-u)/r.height;p=(h+=v*r.offsetX)+v*r.width,g=(m-=y*r.offsetY)-y*r.height}Og.ortho(e.projection,h,p,m,g,n,i)}(this.camera,e.viewport,e.viewOffset),Og.extractRotation(this.scene.view,e.view);var t=this.textRenderObject?this.textRenderObject.values.boundingSphere.ref.value.radius:this.meshRenderObject.values.boundingSphere.ref.value.radius,r=this.props.axes.params.location,n=this.props.axes.params.locationOffsetX*this.pixelRatio,i=this.props.axes.params.locationOffsetY*this.pixelRatio;"bottom-left"===r?Og.setTranslation(this.scene.view,Cg.create(-e.viewport.width/2+t+n,-e.viewport.height/2+t+i,0)):"bottom-right"===r?Og.setTranslation(this.scene.view,Cg.create(e.viewport.width/2-t-n,-e.viewport.height/2+t+i,0)):"top-left"===r?Og.setTranslation(this.scene.view,Cg.create(-e.viewport.width/2+t+n,e.viewport.height/2-t-i,0)):"top-right"===r?Og.setTranslation(this.scene.view,Cg.create(e.viewport.width/2-t-n,e.viewport.height/2-t-i,0)):Lg()}},e}();function B5(e){return"data-loci"===e.kind&&"camera-axes"===e.tag}!function(e){e[e.None=0]="None",e[e.X=1]="X",e[e.Y=2]="Y",e[e.Z=3]="Z",e[e.XY=4]="XY",e[e.XZ=5]="XZ",e[e.YZ=6]="YZ",e[e.Origin=7]="Origin"}(l5||={});var N5={transparentBackground:Ib.Boolean(!1),dpoitIterations:Ib.Numeric(2,{min:1,max:10,step:1}),multiSample:Ib.Group(n5),postprocessing:Ib.Group(Q4),marking:Ib.Group(C5),cameraHelper:Ib.Group(O5)},F5=function(){function e(e,t,r,n,i,a,o,s,u){this.webgl=e,this.renderer=r,this.scene=n,this.camera=i,this._width=0,this._height=0,this._camera=new Q3,this.props=Ac(Ac({},Ib.getDefaultValues(N5)),u),this.drawPass=new I5(e,t,128,128,o,s),this.multiSamplePass=new i5(e,this.drawPass),this.multiSampleHelper=new o5(this.multiSamplePass),this.helper={camera:new R5(e,this.props.cameraHelper),debug:a.debug,handle:a.handle},this.setSize(1024,768)}return Object.defineProperty(e.prototype,"colorTarget",{get:function(){return this._colorTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}
139),e.prototype.updateBackground=function(){var e=this;return new Promise(function(t){e.drawPass.postprocessing.background.update(e.camera,e.props.postprocessing.background,function(){t()})})},e.prototype.setSize=function(e,t){e===this._width&&t===this._height||(this._width=e,this._height=t,this.drawPass.setSize(e,t),this.multiSamplePass.syncSize())},e.prototype.setProps=function(e){void 0===e&&(e={}),Object.assign(this.props,e),e.cameraHelper&&this.helper.camera.setProps(e.cameraHelper)},e.prototype.render=function(){Q3.copySnapshot(this._camera.state,this.camera.state),h3.set(this._camera.viewport,0,0,this._width,this._height),this._camera.update();var e={renderer:this.renderer,camera:this._camera,scene:this.scene,helper:this.helper};i5.isEnabled(this.props.multiSample)?(this.multiSampleHelper.render(e,this.props,!1),this._colorTarget=this.multiSamplePass.colorTarget):(this.drawPass.render(e,this.props,!1),this._colorTarget=this.drawPass.getColorTarget(this.props.postprocessing))},e.prototype.getImageData=function(e,t,r){this.setSize(e,t),this.render(),this.colorTarget.bind();var n=r?.width??e,i=r?.height??t,a=new Uint8Array(n*i*4);r?this.webgl.readPixels(r.x,t-r.y-r.height,n,i,a):this.webgl.readPixels(0,0,n,i,a);var o=ZM.create(a,n,i);return ZM.flipY(o),ZM.divideByAlpha(o),new ImageData(new Uint8ClampedArray(a),n,i)},e}(),L5=Ac(Ac({},sD.Params),{alpha:Ac(Ac({},sD.Params.alpha),{defaultValue:1}),ignoreLight:Ac(Ac({},sD.Params.ignoreLight),{defaultValue:!0}),colorX:Ib.Color(MC.red,{isEssential:!0}),colorY:Ib.Color(MC.green,{isEssential:!0}),colorZ:Ib.Color(MC.blue,{isEssential:!0}),scale:Ib.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0})}),$5={handle:Ib.MappedStatic("off",{on:Ib.Group(L5),off:Ib.Group({})},{cycle:!0,description:"Show handle tool"})},U5=function(){function e(e,t){void 0===t&&(t={});var r=this;this.webgl=e,this.props={handle:{name:"off",params:{}}},this.pixelRatio=1,this._transform=Og(),this.eachGroup=function(e,t){if(!r.renderObject||!z5(e))return!1;for(var n=!1,i=r.renderObject.values.uGroupCount.ref.value,a=0,o=e.elements;a<o.length;a++){var s=o[a],u=s.groupId,c=s.instanceId*i+u;t($T.ofSingleton(c))&&(n=!0)}return n},this.scene=G3.create(e,VR),this.setProps(t)}return e.prototype.getBoundingSphere=function(e,t){return this.renderObject&&(XE.copy(e,this.renderObject.values.invariantBoundingSphere.ref.value),Og.fromArray(this._transform,this.renderObject.values.aTransform.ref.value,16*t),XE.transform(e,e,this._transform)),e},e.prototype.setProps=function(e){var t=this;this.props=oS(this.props,function(r){void 0!==e.handle&&(r.handle.name=e.handle.name,"on"===e.handle.name)&&(t.scene.clear(),t.pixelRatio=t.webgl.pixelRatio,t.renderObject=function(e){var t=function(e){var t=10*e.scale,r=function(e){var t=dO.createState(512,256,void 0),r=.05*e,n=Cg.scale(Cg(),Cg.unitX,e),i=Cg.scale(Cg(),Cg.unitY,e),a=Cg.scale(Cg(),Cg.unitZ,e),o={radiusTop:r,radiusBottom:r,radialSegments:32};return t.currentGroup=j5.TranslateScreenXY,OD(t,Cg.origin,3*r,2),t.currentGroup=j5.TranslateObjectX,OD(t,n,r,2),uO(t,Cg.origin,n,1,o),t.currentGroup=j5.TranslateObjectY,OD(t,i,r,2),uO(t,Cg.origin,i,1,o),t.currentGroup=j5.TranslateObjectZ,OD(t,a,r,2),uO(t,Cg.origin,a,1,o),dO.getMesh(t)}(t);return r.setBoundingSphere(XE.create(Cg.create(t/2,t/2,t/2),t+t/4)),_B.create("handle",{},r,function(t){switch(t){case j5.TranslateObjectX:return e.colorX;case j5.TranslateObjectY:return e.colorY;case j5.TranslateObjectZ:return e.colorZ;default:return MC.grey}},function(){return 1},function(){return""})}(e);return _B.createRenderObject(t,e)}(Ac(Ac({},e.handle.params),{scale:e.handle.params.scale*t.webgl.pixelRatio})),t.scene.add(t.renderObject),t.scene.commit(),r.handle.params=Ac({},e.handle.params))})},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return"on"===this.props.handle.name},enumerable:!1,configurable:!0}),e.prototype.update=function(e,t,r){this.renderObject&&(this.pixelRatio!==this.webgl.pixelRatio&&this.setProps(this.props),Og.setTranslation(this.renderObject.values.aTransform.ref.value,t),Og.fromMat3(this.renderObject.values.aTransform.ref.value,r),tf.update(this.renderObject.values.aTransform,this.renderObject.values.aTransform.ref.value),this.scene.update([this.renderObject],!0))},e.prototype.getLoci=function(e){var t=e.objectId,r=e.groupId,n=e.instanceId;return this.renderObject&&t===this.renderObject.id?function(e,t,r){return IQ("handle",e,[{groupId:t,instanceId:r}],function(t){return e.getBoundingSphere(t,r)},function(){return`Handle Helper | Group Id ${t} | Instance Id ${r}`})}(this,r,n):EQ},e.prototype.mark=function(e,t){return!(!_Q.is(_Q.Highlighting,t)||!(CQ(e)||z5(e)&&e.data===this))&&tJ.mark(this.renderObject,e,t,this.eachGroup)},e}
139(),j5={None:0,TranslateScreenXY:1,TranslateObjectX:3,TranslateObjectY:4,TranslateObjectZ:5};function z5(e){return"data-loci"===e.kind&&"handle"===e.tag}var G5,V5={debug:Ib.Group(J3),camera:Ib.Group({helper:Ib.Group(O5)}),handle:Ib.Group($5)},H5=Ib.getDefaultValues(V5),q5=function(e,t,r){void 0===r&&(r={});var n=Ac(Ac({},H5),r);this.debug=new e4(e,t,n.debug),this.camera=new R5(e,n.camera.helper),this.handle=new U5(e,n.handle)},W5=function(){function e(e,t,r){void 0===r&&(r={}),this.webgl=e;var n=e.gl;this.draw=new I5(e,t,n.drawingBufferWidth,n.drawingBufferHeight,r.enableWboit||!1,r.enableDpoit||!1),this.pick=new m5(e,this.draw,r.pickScale||.25),this.multiSample=new i5(e,this.draw)}return e.prototype.updateSize=function(){var e=this.webgl.gl,t=Math.max(e.drawingBufferWidth,2),r=Math.max(e.drawingBufferHeight,2);this.draw.setSize(t,r),this.pick.syncSize(),this.multiSample.syncSize()},e}(),X5={camera:Ib.Group({mode:Ib.Select("perspective",Ib.arrayToOptions(["perspective","orthographic"]),{label:"Camera"}),helper:Ib.Group(O5,{isFlat:!0}),stereo:Ib.MappedStatic("off",{on:Ib.Group(s5),off:Ib.Group({})},{cycle:!0,hideIf:function(e){return"perspective"!==e?.mode}}),fov:Ib.Numeric(45,{min:10,max:130,step:1},{label:"Field of View"}),manualReset:Ib.Boolean(!1,{isHidden:!0})},{pivot:"mode"}),cameraFog:Ib.MappedStatic("on",{on:Ib.Group({intensity:Ib.Numeric(15,{min:1,max:100,step:1})}),off:Ib.Group({})},{cycle:!0,description:"Show fog in the distance"}),cameraClipping:Ib.Group({radius:Ib.Numeric(100,{min:0,max:99,step:1},{label:"Clipping",description:"How much of the scene to show."}),far:Ib.Boolean(!0,{description:"Hide scene in the distance"}),minNear:Ib.Numeric(5,{min:.1,max:100,step:.1},{description:"Note, may cause performance issues rendering impostors when set too small and cause issues with outline rendering when too close to 0."})},{pivot:"radius"}),viewport:Ib.MappedStatic("canvas",{canvas:Ib.Group({}),"static-frame":Ib.Group({x:Ib.Numeric(0),y:Ib.Numeric(0),width:Ib.Numeric(128),height:Ib.Numeric(128)}),"relative-frame":Ib.Group({x:Ib.Numeric(.33,{min:0,max:1,step:.01}),y:Ib.Numeric(.33,{min:0,max:1,step:.01}),width:Ib.Numeric(.5,{min:.01,max:1,step:.01}),height:Ib.Numeric(.5,{min:.01,max:1,step:.01})})}),cameraResetDurationMs:Ib.Numeric(250,{min:0,max:1e3,step:1},{description:"The time it takes to reset the camera."}),sceneRadiusFactor:Ib.Numeric(1,{min:1,max:10,step:.1}),transparentBackground:Ib.Boolean(!1),dpoitIterations:Ib.Numeric(2,{min:1,max:10,step:1}),multiSample:Ib.Group(n5),postprocessing:Ib.Group(Q4),marking:Ib.Group(C5),renderer:Ib.Group(M3),trackball:Ib.Group(z3),interaction:Ib.Group(l4),debug:Ib.Group(J3),handle:Ib.Group($5)},Y5=Ib.getDefaultValues(X5);!function(e){e.DefaultAttribs={powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,antialias:!0,preserveDrawingBuffer:!0,pixelScale:1,pickScale:.25,pickPadding:1,enableWboit:!0,enableDpoit:!1,preferWebGl1:!1},e.fromCanvas=function(t,r,n){void 0===n&&(n={});var i=Ac(Ac({},e.DefaultAttribs),n);if(i.enableWboit&&i.enableDpoit)throw Error("Multiple transparency methods not allowed.");var a=i.powerPreference,o=i.failIfMajorPerformanceCaveat,s=i.antialias,u=i.preserveDrawingBuffer,c=i.pixelScale,l=function(e,t){function r(r){try{return e.getContext(r,t)}catch{return null}}var n=(t?.preferWebGl1?null:r("webgl2"))||r("webgl")||r("experimental-webgl");return ay&&console.log(`isWebgl2: ${dI(n)}`),n}(t,{powerPreference:a,failIfMajorPerformanceCaveat:o,antialias:s,preserveDrawingBuffer:u,alpha:!0,depth:!0,premultipliedAlpha:!0,preferWebGl1:i.preferWebGl1});if(null===l)throw Error("Could not create a WebGL rendering context");var d=A3.fromElement(t,{pixelScale:c,preventGestures:!0}),f=function(e,t){var r=this;void 0===t&&(t={});var n=tk(e),i=function(e,t){var r={},n=e.getParameter(e.FRONT_FACE),i=e.getParameter(e.CULL_FACE_MODE),a=e.getParameter(e.DEPTH_WRITEMASK),o=e.getParameter(e.DEPTH_CLEAR_VALUE),s=e.getParameter(e.DEPTH_FUNC),u=e.getParameter(e.COLOR_WRITEMASK),c=e.getParameter(e.COLOR_CLEAR_VALUE),l=e.getParameter(e.BLEND_SRC_RGB),d=e.getParameter(e.BLEND_DST_RGB),f=e.getParameter(e.BLEND_SRC_ALPHA),h=e.getParameter(e.BLEND_DST_ALPHA),p=e.getParameter(e.BLEND_COLOR),m=e.getParameter(e.BLEND_EQUATION_RGB),g=e.getParameter(e.BLEND_EQUATION_ALPHA),v=e.getParameter(e.STENCIL_FUNC),y=e.getParameter(e.STENCIL_VALUE_MASK),b=e.getParameter(e.STENCIL_REF),_=e.getParameter(e.STENCIL_BACK_FUNC),x=e.getParameter(e.STENCIL_BACK_VALUE_MASK),S=e.getParameter(e.STENCIL_BACK_REF),w=e.getParameter(e.STENCIL_WRITEMA
139SK),A=e.getParameter(e.STENCIL_BACK_WRITEMASK),C=e.getParameter(e.STENCIL_FAIL),T=e.getParameter(e.STENCIL_PASS_DEPTH_PASS),P=e.getParameter(e.STENCIL_PASS_DEPTH_FAIL),E=e.getParameter(e.STENCIL_BACK_FAIL),M=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_PASS),k=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_FAIL),I=e.getParameter(e.MAX_VERTEX_ATTRIBS),D=[],O=e.getParameter(e.VIEWPORT),R=e.getParameter(e.SCISSOR_BOX),B=t.clipControl?e.getParameter(t.clipControl.CLIP_ORIGIN):-1,N=t.clipControl?e.getParameter(t.clipControl.CLIP_DEPTH_MODE):-1,F=function(){for(var e=0;e<I;++e)D[e]=0};return F(),{currentProgramId:-1,currentMaterialId:-1,currentRenderItemId:-1,enable:function(t){!0!==r[t]&&(e.enable(t),r[t]=!0)},disable:function(t){!1!==r[t]&&(e.disable(t),r[t]=!1)},frontFace:function(t){t!==n&&(e.frontFace(t),n=t)},cullFace:function(t){t!==i&&(e.cullFace(t),i=t)},depthMask:function(t){t!==a&&(e.depthMask(t),a=t)},clearDepth:function(t){t!==o&&(e.clearDepth(t),o=t)},depthFunc:function(t){t!==s&&(e.depthFunc(t),s=t)},colorMask:function(t,r,n,i){t===u[0]&&r===u[1]&&n===u[2]&&i===u[3]||(e.colorMask(t,r,n,i),u[0]=t,u[1]=r,u[2]=n,u[3]=i)},clearColor:function(t,r,n,i){t===c[0]&&r===c[1]&&n===c[2]&&i===c[3]||(e.clearColor(t,r,n,i),c[0]=t,c[1]=r,c[2]=n,c[3]=i)},blendFunc:function(t,r){t===l&&r===d&&t===f&&r===h||(e.blendFunc(t,r),l=t,d=r,f=t,h=r)},blendFuncSeparate:function(t,r,n,i){t===l&&r===d&&n===f&&i===h||(e.blendFuncSeparate(t,r,n,i),l=t,d=r,f=n,h=i)},blendEquation:function(t){t===m&&t===g||(e.blendEquation(t),m=t,g=t)},blendEquationSeparate:function(t,r){t===m&&r===g||(e.blendEquationSeparate(t,r),m=t,g=r)},blendColor:function(t,r,n,i){t===p[0]&&r===p[1]&&n===p[2]&&i===p[3]||(e.blendColor(t,r,n,i),p[0]=t,p[1]=r,p[2]=n,p[3]=i)},stencilFunc:function(t,r,n){t===v&&r===b&&n===y&&t===_&&r===S&&n===x||(e.stencilFunc(t,r,n),v=t,b=r,y=n,_=t,S=r,x=n)},stencilFuncSeparate:function(t,r,n,i){t===e.FRONT?r===v&&n===b&&i===y||(e.stencilFuncSeparate(t,r,n,i),v=r,b=n,y=i):t===e.BACK?r===_&&n===S&&i===x||(e.stencilFuncSeparate(t,r,n,i),_=r,S=n,x=i):t===e.FRONT_AND_BACK&&(r===v&&n===b&&i===y&&r===_&&n===S&&i===x||(e.stencilFuncSeparate(t,r,n,i),v=r,b=n,y=i,_=r,S=n,x=i))},stencilMask:function(t){t===w&&t===A||(e.stencilMask(t),w=t,A=t)},stencilMaskSeparate:function(t,r){t===e.FRONT?r!==w&&(e.stencilMaskSeparate(t,r),w=r):t===e.BACK?r!==A&&(e.stencilMaskSeparate(t,r),A=r):t===e.FRONT_AND_BACK&&(r===w&&r===A||(e.stencilMaskSeparate(t,r),w=r,A=r))},stencilOp:function(t,r,n){t===C&&r===P&&n===T&&t===E&&r===k&&n===M||(e.stencilOp(t,r,n),C=t,P=r,T=n,E=t,k=r,M=n)},stencilOpSeparate:function(t,r,n,i){t===e.FRONT?r===C&&n===P&&i===T||(e.stencilOpSeparate(t,r,n,i),C=r,P=n,T=i):t===e.BACK?r===E&&n===k&&i===M||(e.stencilOpSeparate(t,r,n,i),E=r,k=n,M=i):t===e.FRONT_AND_BACK&&(r===C&&n===P&&i===T&&r===E&&n===k&&i===M||(e.stencilOpSeparate(t,r,n,i),C=r,P=n,T=i,E=r,k=n,M=i))},enableVertexAttrib:function(t){e.enableVertexAttribArray(t),D[t]=1},clearVertexAttribsState:F,disableUnusedVertexAttribs:function(){for(var t=0;t<I;++t)0===D[t]&&e.disableVertexAttribArray(t)},viewport:function(t,r,n,i){t===O[0]&&r===O[1]&&n===O[2]&&i===O[3]||(e.viewport(t,r,n,i),O[0]=t,O[1]=r,O[2]=n,O[3]=i)},scissor:function(t,r,n,i){t===R[0]&&r===R[1]&&n===R[2]&&i===R[3]||(e.scissor(t,r,n,i),R[0]=t,R[1]=r,R[2]=n,R[3]=i)},clipControl:t.clipControl?function(e,r){e===B&&r===N||(t.clipControl.clipControl(e,r),B=e,N=r)}:void 0,reset:function(){r={},n=e.getParameter(e.FRONT_FACE),i=e.getParameter(e.CULL_FACE_MODE),a=e.getParameter(e.DEPTH_WRITEMASK),o=e.getParameter(e.DEPTH_CLEAR_VALUE),s=e.getParameter(e.DEPTH_FUNC),u=e.getParameter(e.COLOR_WRITEMASK),c=e.getParameter(e.COLOR_CLEAR_VALUE),l=e.getParameter(e.BLEND_SRC_RGB),d=e.getParameter(e.BLEND_DST_RGB),f=e.getParameter(e.BLEND_SRC_ALPHA),h=e.getParameter(e.BLEND_DST_ALPHA),p=e.getParameter(e.BLEND_COLOR),m=e.getParameter(e.BLEND_EQUATION_RGB),g=e.getParameter(e.BLEND_EQUATION_ALPHA),v=e.getParameter(e.STENCIL_FUNC),y=e.getParameter(e.STENCIL_VALUE_MASK),b=e.getParameter(e.STENCIL_REF),_=e.getParameter(e.STENCIL_BACK_FUNC),x=e.getParameter(e.STENCIL_BACK_VALUE_MASK),S=e.getParameter(e.STENCIL_BACK_REF),w=e.getParameter(e.STENCIL_WRITEMA
139SK),A=e.getParameter(e.STENCIL_BACK_WRITEMASK),C=e.getParameter(e.STENCIL_FAIL),T=e.getParameter(e.STENCIL_PASS_DEPTH_PASS),P=e.getParameter(e.STENCIL_PASS_DEPTH_FAIL),E=e.getParameter(e.STENCIL_BACK_FAIL),M=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_PASS),k=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_FAIL),I=e.getParameter(e.MAX_VERTEX_ATTRIBS),D.length=0;for(var F=0;F<I;++F)D[F]=0;O=e.getParameter(e.VIEWPORT),R=e.getParameter(e.SCISSOR_BOX),B=t.clipControl?e.getParameter(t.clipControl.CLIP_ORIGIN):-1,N=t.clipControl?e.getParameter(t.clipControl.CLIP_DEPTH_MODE):-1}}}(e,n),a={resourceCounts:{attribute:0,elements:0,framebuffer:0,program:0,renderbuffer:0,shader:0,texture:0,cubeTexture:0,vertexArray:0},drawCount:0,instanceCount:0,instancedDrawCount:0,calls:{drawInstanced:0,counts:0}},o=Jk(e,i,a,n),s=function(e,t,r){var n=t.disjointTimerQuery,i=new Map,a=new Map,o=[],s=new tI(30),u=new tI(30),c=[],l=null,d=!1,f=function(){n&&(i.forEach(function(e,t){n.deleteQuery(t)}),a.clear(),c=[],l=null)},h=function(){if(n){var e=function(e){return e.disjointTimerQuery?e.disjointTimerQuery.createQuery():null}(t);e&&(n.beginQuery(n.TIME_ELAPSED,e),a.forEach(function(t,r){t.queries.push(e)}),i.set(e,{refCount:a.size}),l=e)}};return{resolve:function(){var t=[];if(!n||!c.length)return t;i.forEach(function(t,r){if(void 0===t.timeElapsed){var i=n.getQueryParameter(r,n.QUERY_RESULT_AVAILABLE),a=e.getParameter(n.GPU_DISJOINT);i&&!a&&(t.timeElapsed=n.getQueryParameter(r,n.QUERY_RESULT)),(i||a)&&n.deleteQuery(r)}});for(var r=[],a=function(e){if(e.queries.every(function(e){return void 0!==i.get(e)?.timeElapsed})){for(var n=0,a=0,o=e.queries;a<o.length;a++){var c=o[a],l=i.get(c);n+=l.timeElapsed,--l.refCount}if(e.timeElapsed=n,e.root){var d=[],f=function(e,t){for(var r=0,n=e;r<n.length;r++){var i=n[r],a=i.timeElapsed,o=i.cpu.end-i.cpu.start,c={label:i.label,gpuElapsed:a,gpuAvg:s.add(i.label,a),cpuElapsed:o,cpuAvg:u.add(i.label,o),children:[],calls:i.calls};t.push(c),f(i.children,c.children)}};f(e.children,d);var h=e.cpu.end-e.cpu.start;t.push({label:e.label,gpuElapsed:n,gpuAvg:s.add(e.label,n),cpuElapsed:h,cpuAvg:u.add(e.label,h),children:d,calls:e.calls})}}else r.push(e)},o=0,l=c;o<l.length;o++)a(l[o]);return c=r,i.forEach(function(e,t){0===e.refCount&&i.delete(t)}),t},mark:function(e,t){if(void 0===t&&(t=!1),n){if(a.has(e))throw Error(`Timer mark for '${e}' already exists`);null!==l&&n.endQuery(n.TIME_ELAPSED);var i={label:e,queries:[],children:[],root:null===l,cpu:{start:Kd(),end:-1},captureCalls:t};if(a.set(e,i),o.length&&o[o.length-1].children.push(i),o.push(i),t){if(d)throw Error("Already capturing calls");(function(e){e.calls.drawInstanced=0,e.calls.counts=0})(r),d=!0}h()}},markEnd:function(e){if(n){var t=a.get(e);if(!t)throw Error(`Timer mark for '${e}' does not exist`);if(o.pop()?.label!==e)throw Error(`Timer mark for '${e}' has pending nested mark`);n.endQuery(n.TIME_ELAPSED),a.delete(e),t.cpu.end=Kd(),t.captureCalls&&(t.calls={drawInstanced:r.calls.drawInstanced,counts:r.calls.counts},d=!1),c.push(t),a.size>0?h():l=null}},stats:function(){return{gpu:s.stats(),cpu:u.stats()}},formatedStats:function(){for(var e={},t=s.stats(),r=u.stats(),n=0,i=Object.keys(t);n<i.length;n++){var a=i[n];e[a]=`${(t[a]/1e3/1e3).toFixed(2)} ms | CPU: ${r[a].toFixed(2)} ms`}return e},clear:f,destroy:function(){f()}}}(e,n,a),u={maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),max3dTextureSize:dI(e)?e.getParameter(e.MAX_3D_TEXTURE_SIZE):0,maxRenderbufferSize:e.getParameter(e.MAX_RENDERBUFFER_SIZE),maxDrawBuffers:n.drawBuffers?e.getParameter(n.drawBuffers.MAX_DRAW_BUFFERS):0,maxTextureImageUnits:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)};if(u.maxVertexTextureImageUnits<8)throw Error('Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8');var c=n.provokingVertex;c?.provokingVertex(c.FIRST_VERTEX_CONVENTION);var l,d=!1,f=new M_(0);if(dI(e)){var h=e.createBuffer(),p=void 0,m=void 0,g=!1,v=function(){e.bindBuffer(e.PIXEL_PACK_BUFFER,h),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,p),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),g=!1,m(),m=void 0,p=void 0};l=function(t,r,n,i,a){return new Promise(function(o,s){g?s("Can not call multiple readPixelsAsync at the same time"):(g=!0,e.bindBuffer(e.PIXEL_PACK_BUFFER,h),e.bufferData(e.PIXEL_PACK_BUFFER,n*i*4,e.STREAM_READ),e.readPixels(t,r,n,i,e.RGBA,e.UNSIGNED_BYTE,0),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),m=o,p=a,sI(e,v))})}}else l=function(t,n,i,a,o){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){return lI(e,t,n,i,a,o),[2]})})};var y=new Set;return{gl:e,isWebGL2:dI(e),get pixelRatio(){return(typeof window<"u"&&window.devicePixelRatio||1)*(t.pixelScale||1)},extensions:n,state:i,stats:a,resources:o,timer:s,get maxTextureSize(){return u.maxTextureSize},get max3dTextureSize(){return u.max3dTextureSize},get maxRenderbufferSize(){return u.maxRenderbufferSize},get maxDrawBuffers(){return u.maxDrawBuffers},get maxTextureImageUnits(){return u.maxTextureImageUnits},namedComputeRenderables:Object.create(null),namedFramebuffers:Object.create(null),namedTextures:Object.create(null),get isContextLost(){return d||e.isContextLost()},contextRestored:f,setContextLost:function(){d=!0},handleContextRestored:function(t){Object.assign(n,tk(e)),i.reset(),i.currentMaterialId=-1,i.currentProgramId=-1,i.currentRenderItemId=-1,o.reset(),y.forEac
139h(function(e){return e.reset()}),t?.(),d=!1,f.next(Kd())},createRenderTarget:function(t,r,n,i,a,s){var u=function(e,t,r,n,i,a,o,s){if(void 0===i&&(i=!0),void 0===a&&(a="uint8"),void 0===o&&(o="nearest"),void 0===s&&(s="rgba"),"alpha"===s&&!dI(e))throw Error("cannot render to alpha format in webgl1");var u=t.framebuffer(),c="fp16"===a?t.texture("image-float16",s,"fp16",o):"float32"===a?t.texture("image-float32",s,"float",o):t.texture("image-uint8",s,"ubyte",o),l=i?dI(e)?t.renderbuffer("depth32f","depth",r,n):t.renderbuffer("depth16","depth",r,n):null;function d(){c.define(r,n),c.attachFramebuffer(u,"color0"),l&&l.attachFramebuffer(u)}d();var f=!1;return{id:eI(),texture:c,framebuffer:u,depthRenderbuffer:l,getWidth:function(){return r},getHeight:function(){return n},bind:function(){u.bind()},setSize:function(e,t){r===e&&n===t||(r=e,n=t,c.define(r,n),l&&l.setSize(r,n))},reset:function(){d()},destroy:function(){f||=(c.destroy(),u.destroy(),l&&l.destroy(),!0)}}}(e,o,t,r,n,i,a,s);return y.add(u),Ac(Ac({},u),{destroy:function(){u.destroy(),y.delete(u)}})},unbindFramebuffer:function(){return iI(e)},readPixels:function(t,r,n,i,a){lI(e,t,r,n,i,a)},readPixelsAsync:l,waitForGpuCommandsComplete:function(){return function(e){return new Promise(function(t){dI(e)?sI(e,t):(uI||=(console.info("Sync object not supported in WebGL"),!0),cI(e),t())})}(e)},waitForGpuCommandsCompleteSync:function(){return cI(e)},getDrawingBufferPixelData:function(){return function(e,t){var r=e.drawingBufferWidth,n=e.drawingBufferHeight,i=new Uint8Array(r*n*4);return iI(e),t.viewport(0,0,r,n),lI(e,0,0,r,n,i),ZM.flipY(ZM.create(i,r,n))}(e,i)},clear:function(t,r,n,a){iI(e),i.enable(e.SCISSOR_TEST),i.depthMask(!0),i.colorMask(!0,!0,!0,!0),i.clearColor(t,r,n,a),i.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),i.scissor(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},destroy:function(t){var r,n;o.destroy(),function(e){for(var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),r=0;r<t;++r)e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null),dI(e)&&(e.bindTexture(e.TEXTURE_2D_ARRAY,null),e.bindTexture(e.TEXTURE_3D,null));var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n);var i=e.getParameter(e.MAX_VERTEX_ATTRIBS);for(r=0;r<i;++r)e.vertexAttribPointer(r,1,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),iI(e)}(e),null!=t&&t.doNotForceWebGLContextLoss||(null==(r=e.getExtension("WEBGL_lose_context"))||r.loseContext(),null==(n=e.getExtension("STACKGL_destroy_context"))||n.destroy())}}}(l,{pixelScale:c}),h=new W5(f,r,i);if(ay){var p=l.getExtension("WEBGL_lose_context");p&&t.addEventListener("mousedown",function(e){f.isContextLost||e.shiftKey&&e.ctrlKey&&e.altKey&&(ay&&console.log("lose context"),p.loseContext(),setTimeout(function(){f.isContextLost&&(ay&&console.log("restore context"),p.restoreContext())},1e3))},!1)}var m=new M_(0),g=function(e){f.setContextLost(),e.preventDefault(),ay&&console.log("context lost"),m.next(Kd())},v=function(){f.isContextLost&&(f.handleContextRestored(function(){h.draw.reset()}),ay&&console.log("context restored"))};return t.addEventListener("webglcontextlost",g,!1),t.addEventListener("webglcontextrestored",v,!1),{canvas:t,webgl:f,input:d,passes:h,attribs:i,contextLost:m,contextRestored:f.contextRestored,assetManager:r,dispose:function(e){d.dispose(),t.removeEventListener("webglcontextlost",g,!1),t.removeEventListener("webglcontextrestored",v,!1),f.destroy(e)}}}}(G5||={});var K5,Z5=typeof window<"u"?window.requestAnimationFrame:function(e){return setImmediate(function(){return e(Date.now())})},Q5=typeof window<"u"?window.cancelAnimationFrame:function(e){return clearImmediate(e)};function J5(e){y2.Canvas3D.ResetSettings.subscribe(e,function(){var t;null==(t=e.canvas3d)||t.setProps(Y5),e.events.canvas3d.settingsUpdated.next(void 0)}),y2.Canvas3D.SetSettings.subscribe(e,function(t){var r;e.canvas3d&&(null==(r=e.canvas3d)||r.setProps(t.settings),e.events.canvas3d.settingsUpdated.next(void 0))})}!function(e){e.create=function(e,t){var r=e.webgl,n=e.input,i=e.passes,a=e.attribs,o=e.assetManager;void 0===t&&(t={});var s=Ac(Ac({},Vg(Y5)),Vg(t)),u=new Map,c=new Map,l=new M_(0),d=Kd(),f=new M_(0),h=new M_(0),p=new M_(0),m=r.gl,g=r.contextRestored,v=0,y=0,b=128,_=128,x=!1,S=0;ie();var w=G3.create(r,i.draw.dpoitEnabled?qR:i.draw.wboitEnabled?HR:VR);function A(){return w.boundingSphere.radius*s.sceneRadiusFactor}var C=new Q3({position:Cg.create(0,0,100),mode:s.camera.mode,fog:"on"===s.cameraFog.name?s.cameraFog.params.intensity:0,clipFar:s.cameraClipping.far,minNear:s.cameraClipping.minNear,fov:Mg(s.camera.fov)},{x:v,y,width:b,height:_},{pixelScale:a.pixelScale}),T=new c5(C,s.camera.stereo.params),P=R3.create(n,C,w,s.trackball),E=E3.create(r,s.renderer),M=new q5(r,w,s),k=new g5(r,E,w,M,i.pick,{x:v,y,width:b,height:_},a.pickPadding),I=new d4(X,L,n,C,P,s.interaction),D=new o5(i.multiSample);i.draw.postprocessing.background.update(C,s.postprocessing.background,function(e){e&&V()});var O=!1,R=void 0,B=void 0,N=!1,F=!0;function L(e){var t=EQ,r=dJ.Empty;if(e){var n=M.camera.getLoci(e);if(n!==EQ)return{loci:n,repr:r};t=M.handle.getLoci(e),u.forEach(function(n,i){var a=i.getLoci(e);MQ(a)||(MQ(t)||console.warn("found another loci, this should not happen"),t=a,r=i)})}return{loci:t,repr:r}}var $=[];function U(e,t){var r=e.repr,n=e.loci,i=!1;return r?i=r.mark(n,t)||i:u.forEach(function(e,r){i=r.mark(n,t)||i}),i=M.handle.mark(n,t)||i,i=M.camera.mark(n,t)||i}var j=!1,z=!1;function G(e){z||function(e){if(r.isContextLost)return!1;var t=!1;if(N&&(ne(!1),N=!1,t=!0),v>m.drawingBufferWidth||v+b<0||y>m.drawingBufferHeight||y+_<0)return!1;var n=function(){for(var e=!1,t=0,r=$;t<r.length;t++){var n=r[t];e=U(n[0],n[1])||e}return $=[],e&&(w.update(void 0,!0),M.handle.scene.update(void 0,!0),M.camera.scene.update(void 0,!0)),e}()&&(E.props.colorMarker||s.marking.enabled),a=!1;P.update(S);var o=C.update(),u=e||o||t||x;x=!1;var c=D.update(n||u,s.multiSample);if(u||c||n){var l=C;
139"on"===s.camera.stereo.name&&(T.update(),l=T);var d={renderer:E,camera:l,scene:w,helper:M};if(i5.isEnabled(s.multiSample)){var f=s.multiSample.reduceFlicker&&!o&&n&&!P.isAnimating;D.render(d,s,!0,f)}else i.draw.render(d,s,!0);k.dirty=k.dirty||u,a=!0}return a}(!!e?.force)&&F&&f.next(Kd()-d)}function V(){x=!0}var H=0;function q(e,t){S=e,Y(t?.isSynchronous),C.transition.tick(S),null!=t&&t.manualDraw||(G(),C.transition.inTransition||r.isContextLost||I.tick(S))}function W(){q(Kd()),H=Z5(W)}function X(e,t){var n="on"===s.camera.stereo.name?T:C;return r.isContextLost?void 0:k.identify(e,t,n)}function Y(e){void 0===e&&(e=!1),function(e){return!w.needsCommit||(XE.copy(K,w.boundingSphereVisible),w.commit(e?void 0:Q)?(p.next(0),M.debug.isEnabled&&M.debug.update(),s.camera.manualReset||0!==l.value&&!function(){if(0===C.state.radiusMax)return!0;if(C.transition.inTransition||B)return!1;var e=!0,t=!0;XE.set(Z,C.state.target,C.state.radius);for(var r=0,n=w.renderables;r<n.length;r++){var i=n[r];if(i.state.visible){var a=i.values.boundingSphere.ref.value;if(a.radius){t=!1;var o=Cg.distance(Z.center,a.center);if((o>Z.radius||o>a.radius||a.radius>C.state.radiusMax)&&!XE.includes(K,a))return!0;XE.overlaps(Z,a)&&(e=!1)}}}return e||!t&&Z.radius<=.1}()||(O=!0),0===K.radius&&(R=0),s.camera.manualReset||C.setState({radiusMax:A()},0),l.next(u.size),ay&&J(),!0):(p.next(w.commitQueueSize),!1))}(e)&&(function(){if(O){var e=w.boundingSphereVisible,t=e.center,r=e.radius,n=P.props.autoAdjustMinMaxDistance;if("on"===n.name){var i=n.params.minDistanceFactor*r+n.params.minDistancePadding,a=Math.max(n.params.maxDistanceFactor*r,n.params.maxDistanceMin);P.setProps({minDistance:i,maxDistance:a})}if(r>0){var o=void 0===R?s.cameraResetDurationMs:R,u=C.getFocus(t,r),c="function"==typeof B?B(w,C):B,l=c?Ac(Ac({},u),c):u;C.setState(Ac(Ac({},l),{radiusMax:A()}),o)}R=void 0,B=void 0,O=!1}}(),j&&=(M.debug.isEnabled&&M.debug.update(),G({force:!0}),!1),h.next(Kd()))}var K=XE(),Z=XE(),Q=250;function J(){var e=w.renderables.map(function(e){return{drawCount:e.values.drawCount.ref.value,instanceCount:e.values.instanceCount.ref.value,materialId:e.materialId,renderItemId:e.id}});console.groupCollapsed(`${e.length} RenderItems`),e.length<50?console.table(e):console.log(e),console.log(JSON.stringify(r.stats,void 0,4));var t=r.resources.getByteCounts(),n=t.texture,i=t.attribute,a=t.elements;console.log(JSON.stringify({texture:`${(n/1024/1024).toFixed(3)} MiB`,attribute:`${(i/1024/1024).toFixed(3)} MiB`,elements:`${(a/1024/1024).toFixed(3)} MiB`},void 0,4)),console.log(JSON.stringify(r.timer.formatedStats(),void 0,4)),console.groupEnd()}function ee(){var e=w.boundingSphere.radius>0?100-Math.round(C.transition.target.radius/A()*100):0;return{camera:{mode:C.state.mode,helper:Ac({},M.camera.props),stereo:Ac({},s.camera.stereo),fov:Math.round(kg(C.state.fov)),manualReset:!!s.camera.manualReset},cameraFog:C.state.fog>0?{name:"on",params:{intensity:C.state.fog}}:{name:"off",params:{}},cameraClipping:{far:C.state.clipFar,radius:e,minNear:C.state.minNear},cameraResetDurationMs:s.cameraResetDurationMs,sceneRadiusFactor:s.sceneRadiusFactor,transparentBackground:s.transparentBackground,dpoitIterations:s.dpoitIterations,viewport:s.viewport,postprocessing:Ac({},s.postprocessing),marking:Ac({},s.marking),multiSample:Ac({},s.multiSample),renderer:Ac({},E.props),trackball:Ac({},P.props),interaction:Ac({},I.props),debug:Ac({},M.debug.props),handle:Ac({},M.handle.props)}}var te=g.subscribe(function(){k.dirty=!0,G({force:!0}),G({force:!0})}),re=new M_(0);function ne(e){void 0===e&&(e=!0),i.updateSize(),ie(),ae(),e&&V(),re.next(+new Date)}return{webgl:r,add:function e(t){!function(t){c.has(t)||c.set(t,t.updated.subscribe(function(r){t.state.syncManually||e(t)}))}(t);var r=u.get(t),n=new Set;t.renderObjects.forEach(function(e){return n.add(e)}),r?mN.areEqual(n,r)||(n.forEach(function(e){r.has(e)||w.add(e)}),r.forEach(function(e){n.has(e)||w.remove(e)})):t.renderObjects.forEach(function(e){return w.add(e)}),u.set(t,n),w.update(t.renderObjects,!1),j=!0,ay&&J()},remove:function(e){!function(e){var t=c.get(e);t&&(t.unsubscribe(),c.delete(e))}(e);var t=u.get(e);t&&(t.forEach(function(e){return w.remove(e)}),u.delete(e),j=!0,ay&&J())},commit:Y,update:function(e,t){if(e){if(!u.has(e))return;w.update(e.renderObjects,!!t)}else w.update(void 0,!!t);j=!0}
139,clear:function(){c.forEach(function(e){return e.unsubscribe()}),c.clear(),u.clear(),w.clear(),M.debug.clear(),V(),l.next(u.size)},syncVisibility:function(){0===C.state.radiusMax&&(O=!0,R=0),w.syncVisibility()&&M.debug.isEnabled&&M.debug.update(),V()},requestDraw:V,tick:q,animate:function(){z=!1,P.start(Kd()),0===H&&W()},resetTime:function(e){d=e,P.start(e)},pause:function(e){void 0===e&&(e=!1),z=e,Q5(H),H=0},resume:function(){z=!1},identify:X,mark:function(e,t){$.push([e,t])},getLoci:L,handleResize:ne,requestResize:function(){N=!0},requestCameraReset:function(e){R=e?.durationMs,B=e?.snapshot,O=!0},camera:C,boundingSphere:w.boundingSphere,boundingSphereVisible:w.boundingSphereVisible,get notifyDidDraw(){return F},set notifyDidDraw(e){F=e},didDraw:f,commited:h,commitQueueSize:p,reprCount:l,resized:re,setProps:function(e,t){var r,n;void 0===t&&(t=!1);var a="function"==typeof e?nS(ee(),e):e;void 0!==a.sceneRadiusFactor&&(s.sceneRadiusFactor=a.sceneRadiusFactor,C.setState({radiusMax:A()},0));var o=Object.create(null);a.camera&&void 0!==a.camera.mode&&a.camera.mode!==C.state.mode&&(o.mode=a.camera.mode);var u=Math.round(kg(C.state.fov));if(a.camera&&void 0!==a.camera.fov&&a.camera.fov!==u&&(o.fov=Mg(a.camera.fov)),void 0!==a.cameraFog&&a.cameraFog.params){var c="on"===a.cameraFog.name?a.cameraFog.params.intensity:0;c!==C.state.fog&&(o.fog=c)}if(void 0!==a.cameraClipping&&(void 0!==a.cameraClipping.far&&a.cameraClipping.far!==C.state.clipFar&&(o.clipFar=a.cameraClipping.far),void 0!==a.cameraClipping.minNear&&a.cameraClipping.minNear!==C.state.minNear&&(o.minNear=a.cameraClipping.minNear),void 0!==a.cameraClipping.radius)){var l=A()/100*(100-a.cameraClipping.radius);l>0&&l!==o.radius&&(o.radius=Math.max(l,.01))}Object.keys(o).length>0&&C.setState(o),null!=(r=a.camera)&&r.helper&&M.camera.setProps(a.camera.helper),void 0!==a.camera?.manualReset&&(s.camera.manualReset=a.camera.manualReset),void 0!==a.camera?.stereo&&(Object.assign(s.camera.stereo,a.camera.stereo),T.setProps(s.camera.stereo.params)),void 0!==a.cameraResetDurationMs&&(s.cameraResetDurationMs=a.cameraResetDurationMs),void 0!==a.transparentBackground&&(s.transparentBackground=a.transparentBackground),void 0!==a.dpoitIterations&&(s.dpoitIterations=a.dpoitIterations),void 0!==a.viewport&&(s.viewport===a.viewport||s.viewport.name===a.viewport.name&&lf(s.viewport.params,a.viewport.params)||(s.viewport=a.viewport,ie(),ae())),null!=(n=a.postprocessing)&&n.background&&(Object.assign(s.postprocessing.background,a.postprocessing.background),i.draw.postprocessing.background.update(C,s.postprocessing.background,function(e){e&&!t&&V()})),a.postprocessing&&Object.assign(s.postprocessing,a.postprocessing),a.marking&&Object.assign(s.marking,a.marking),a.multiSample&&Object.assign(s.multiSample,a.multiSample),a.renderer&&E.setProps(a.renderer),a.trackball&&P.setProps(a.trackball),a.interaction&&I.setProps(a.interaction),a.debug&&M.debug.setProps(a.debug),a.handle&&M.handle.setProps(a.handle),"orthographic"===o.mode&&(s.camera.stereo.name="off"),t||V()},getImagePass:function(e){return void 0===e&&(e={}),new F5(r,o,E,w,C,M,i.draw.wboitEnabled,i.draw.dpoitEnabled,e)},getRenderObjects:function(){var e=[];return w.forEach(function(t,r){return e.push(r)}),e},get props(){return ee()},get input(){return n},get stats(){return E.stats},get interaction(){return I.events},dispose:function(){te.unsubscribe(),Q5(H),$=[],w.clear(),M.debug.clear(),P.dispose(),E.dispose(),I.dispose()}};function ie(){var e=v,t=y,n=b,i=_;"canvas"===s.viewport.name?(v=0,y=0,b=m.drawingBufferWidth,_=m.drawingBufferHeight):"static-frame"===s.viewport.name?(v=s.viewport.params.x*r.pixelRatio,_=s.viewport.params.height*r.pixelRatio,y=m.drawingBufferHeight-_-s.viewport.params.y*r.pixelRatio,b=s.viewport.params.width*r.pixelRatio):"relative-frame"===s.viewport.name&&(v=Math.round(s.viewport.params.x*m.drawingBufferWidth),_=Math.round(s.viewport.params.height*m.drawingBufferHeight),y=Math.round(m.drawingBufferHeight-_-s.viewport.params.y*m.drawingBufferHeight),b=Math.round(s.viewport.params.width*m.drawingBufferWidth)),e===v&&t===y&&n===b&&i===_||(x=!0)}
139function ae(){k.setViewport(v,y,b,_),E.setViewport(v,y,b,_),h3.set(C.viewport,v,y,b,_),h3.set(P.viewport,v,y,b,_)}}}(K5||={});var e6=Object.freeze({__proto__:null,Canvas3DSetSettings:J5,registerDefault:function(e){J5(e)}}),t6=b3,r6=y3,n6=O3.Trigger,i6={hoverHighlightOnly:O3([n6(t6.Flag.None)],"Highlight","Hover element using ${triggers}"),hoverHighlightOnlyExtend:O3([n6(t6.Flag.None,r6.create({shift:!0}))],"Extend highlight","From selected to hovered element along polymer using ${triggers}")},a6={bindings:Ib.Value(i6,{isHidden:!0}),ignore:Ib.Value([],{isHidden:!0}),preferAtoms:Ib.Boolean(!1,{description:"Always prefer atoms over bonds"}),mark:Ib.Boolean(!0)},o6=T2.create({name:"representation-highlight-loci",category:"interaction",ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.lociMarkProvider=function(e,r){t.ctx.canvas3d&&t.params.mark&&t.ctx.canvas3d.mark(e,r)},t}return wc(t,e),t.prototype.getLoci=function(e){return this.params.preferAtoms&&C$.isLoci(e)&&2===e.bonds.length?C$.toFirstStructureElementLoci(e):e},t.prototype.register=function(){var e=this;this.subscribeObservable(this.ctx.behaviors.interaction.hover,function(t){var r=t.current,n=t.buttons,i=t.modifiers;if(e.ctx.canvas3d&&!e.ctx.isBusy){var a=e.getLoci(r.loci);if(e.params.ignore.includes(a.kind))e.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:r.repr,loci:EQ});else{var o=!1;O3.match(e.params.bindings.hoverHighlightOnly,n,i)&&(e.ctx.managers.interactivity.lociHighlights.highlightOnly({loci:a}),o=!0),O3.match(e.params.bindings.hoverHighlightOnlyExtend,n,i)&&(e.ctx.managers.interactivity.lociHighlights.highlightOnlyExtend({loci:a}),o=!0),o||e.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:r.repr,loci:EQ})}}}),this.ctx.managers.interactivity.lociHighlights.addProvider(this.lociMarkProvider)},t.prototype.unregister=function(){this.ctx.managers.interactivity.lociHighlights.removeProvider(this.lociMarkProvider)},t}(T2.Handler),params:function(){return a6},display:{name:"Highlight Loci on Canvas"}}),s6={clickSelect:O3.Empty,clickToggleExtend:O3([n6(t6.Flag.Primary,r6.create({shift:!0}))],"Toggle extended selection","Click on element using ${triggers} to extend selection along polymer"),clickSelectOnly:O3.Empty,clickToggle:O3([n6(t6.Flag.Primary,r6.create())],"Toggle selection","Click on element using ${triggers}"),clickDeselect:O3.Empty,clickDeselectAllOnEmpty:O3([n6(t6.Flag.Primary,r6.create())],"Deselect all","Click on nothing using ${triggers}")},u6={bindings:Ib.Value(s6,{isHidden:!0}),ignore:Ib.Value([],{isHidden:!0}),preferAtoms:Ib.Boolean(!1,{description:"Always prefer atoms over bonds"}),mark:Ib.Boolean(!0)},c6=T2.create({name:"representation-select-loci",category:"interaction",ctor:function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.lociMarkProvider=function(e,t){n.ctx.canvas3d&&n.params.mark&&n.ctx.canvas3d.mark({loci:e.loci},t)},n.spine=new cS.Impl(t.state.data.cells),n}return wc(t,e),t.prototype.getLoci=function(e){return this.params.preferAtoms&&C$.isLoci(e)&&2===e.bonds.length?C$.toFirstStructureElementLoci(e):e},t.prototype.applySelectMark=function(e,t){var r=this.ctx.state.data.cells.get(e);if(r&&DS.isRepresentation3D(r.obj)){this.spine.current=r;var n=this.spine.getRootOfType(DS.Molecule.Structure);if(n){t&&this.lociMarkProvider({loci:yz.Loci(n.data)},bQ.Deselect);var i=this.ctx.managers.structure.selection.getLoci(n.data);this.lociMarkProvider({loci:i},bQ.Select)}}},t.prototype.register=function(){var e=this,t=function(e){return!TQ.isEmpty(e)},r=[["clickSelect",function(t){return e.ctx.managers.interactivity.lociSelects.select(t)},t],["clickToggle",function(t){return e.ctx.managers.interactivity.lociSelects.toggle(t)},t],["clickToggleExtend",function(t){return e.ctx.managers.interactivity.lociSelects.toggleExtend(t)},t],["clickSelectOnly",function(t){return e.ctx.managers.interactivity.lociSelects.selectOnly(t)},t],["clickDeselect",function(t){return e.ctx.managers.interactivity.lociSelects.deselect(t)},t],["clickDeselectAllOnEmpty",function(){return e.ctx.managers.interactivity.lociSelects.deselectAll()},function(e){return TQ.isEmpty(e)}]];r.sort(function(t,r){var n=e.params.bindings[t[0]],i=e.params.bindings[r[0]],a=0===n.triggers.length?0:Nb(n.triggers.map(function(e){return r6.size(e.modifiers)}));return(0===i.triggers.length?0:Nb(i.triggers.map(function(e){return r6.size(e.modifiers)})))-a}
139),this.subscribeObservable(this.ctx.behaviors.interaction.click,function(t){var n=t.current,i=t.button,a=t.modifiers;if(e.ctx.canvas3d&&!e.ctx.isBusy&&e.ctx.selectionMode){var o=e.getLoci(n.loci);if(!e.params.ignore.includes(o.kind))for(var s=0,u=r;s<u.length;s++){var c=u[s],l=c[0],d=c[1],f=c[2];if(O3.match(e.params.bindings[l],i,a)&&(!f||f(o))){d({repr:n.repr,loci:o});break}}}}),this.ctx.managers.interactivity.lociSelects.addProvider(this.lociMarkProvider),this.subscribeObservable(this.ctx.state.events.object.created,function(t){var r=t.ref;return e.applySelectMark(r)}),this.subscribeObservable(this.ctx.state.events.object.updated,function(t){var r=t.ref,n=t.obj,i=t.oldObj,a=t.oldData,o=t.action,s=e.ctx.state.data.cells.get(r);if(s&&DS.Molecule.Structure.is(s.obj)){var u=n.data,c="recreate"===o?i?.data:"in-place"===o?a:void 0;if(c&&yz.areEquivalent(u,c)&&yz.areHierarchiesEqual(u,c))return;for(var l=0,d=e.ctx.state.data.select(Zb.children(r).ofType(DS.Molecule.Structure.Representation3D));l<d.length;l++){var f=d[l];e.applySelectMark(f.transform.ref,!0)}}})},t.prototype.unregister=function(){this.ctx.managers.interactivity.lociSelects.removeProvider(this.lociMarkProvider)},t}(T2.Handler),params:function(){return u6},display:{name:"Select Loci on Canvas"}}),l6=T2.create({name:"default-loci-label-provider",category:"interaction",ctor:function(){function e(e){this.ctx=e,this.f={label:function(e){var t=[];if(Az.is(e)){for(var r=new Set,n=0,i=e.elements;n<i.length;n++){var a=i[n].unit,o=qF.create(e.structure,a,a.elements[0]),s=Cj.entity.pdbx_description(o).join(", ");r.add(s)}1===r.size&&r.forEach(function(e){return t.push(e)})}return t.push(GJ(e)),t.filter(function(e){return!!e}).join("</br>")},group:function(e){return e.toString().replace(/Model [0-9]+/g,"Models")},priority:100}}return e.prototype.register=function(){this.ctx.managers.lociLabels.addProvider(this.f)},e.prototype.unregister=function(){this.ctx.managers.lociLabels.removeProvider(this.f)},e}(),display:{name:"Provide Default Loci Label"}}),d6={clickFocus:O3([n6(t6.Flag.Primary,r6.create())],"Representation Focus","Click element using ${triggers}"),clickFocusAdd:O3([n6(t6.Flag.Primary,r6.create({shift:!0}))],"Representation Focus Add","Click element using ${triggers}"),clickFocusSelectMode:O3([],"Representation Focus","Click element using ${triggers}"),clickFocusAddSelectMode:O3([],"Representation Focus Add","Click element using ${triggers}")},f6={bindings:Ib.Value(d6,{isHidden:!0})},h6=T2.create({name:"representation-focus-loci",category:"interaction",ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t.prototype.register=function(){var e=this;this.subscribeObservable(this.ctx.behaviors.interaction.click,function(t){var r=t.current,n=t.button,i=t.modifiers,a=e.params.bindings,o=a.clickFocus,s=a.clickFocusAdd,u=a.clickFocusSelectMode,c=a.clickFocusAddSelectMode,l=e.ctx.managers.interactivity.props.granularity;if("residue"===l||"element"===l){var d=e.ctx.selectionMode?u:o,f=O3.match(d,n,i),h=e.ctx.selectionMode?c:s,p=O3.match(h,n,i);if(f||p){var m=TQ.normalize(r.loci,"residue"),g=e.ctx.managers.structure.focus.current;if(g&&TQ.areEqual(g.loci,m))e.ctx.managers.structure.focus.clear();else if(f)e.ctx.managers.structure.focus.setFromLoci(m);else{e.ctx.managers.structure.focus.addFromLoci(m);var v=e.ctx.managers.structure.focus.current?.loci;v&&e.ctx.managers.camera.focusLoci(v)}}}})},t}(T2.Handler),params:function(){return f6},display:{name:"Representation Focus Loci on Canvas"}}),p6=Object.freeze({__proto__:null,DefaultFocusLociBindings:d6,DefaultLociLabelProvider:l6,DefaultSelectLociBindings:s6,FocusLoci:h6,HighlightLoci:o6,SelectLoci:c6}),m6=b3,g6=y3,v6=O3.Trigger,y6=O3.TriggerKey,b6=O3([v6(m6.Flag.Primary,g6.create()),v6(m6.Flag.Secondary,g6.create()),v6(m6.Flag.Primary,g6.create({control:!0}))],"Reset camera focus","Click on nothing using ${triggers}"),_6=O3([v6(m6.Flag.Secondary,g6.create()),v6(m6.Flag.Primary,g6.create({control:!0}))],"Reset camera focus","Click on nothing using ${triggers}"),x6={clickCenterFocus:O3([v6(m6.Flag.Primary,g6.create()),v6(m6.Flag.Secondary,g6.create()),v6(m6.Flag.Primary,g6.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickCenterFocusSelectMode:O3([v6(m6.Flag.Secondary,g6.create()),v6(m6.Flag.Primary,g6.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickResetCameraOnEmpty:b6,clickResetCameraOnEmptySelectMode:_6},S6={minRadius:Ib.Numeric(8,{min:1,max:50,step:1}),extraRadius:Ib.Numeric(4,{min:1,max:50,step:1},{description:"Value added to the bounding-sphere radius of the Loci"}),durationMs:Ib.Numeric(250,{min:0,max:1e3,step:1},{description:"Camera transition duration"}),bindings:Ib.Value(x6,{isHidden:!0})},w6=T2.create({name:"camera-focus-loci",category:"interaction",ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t.prototype.register=function(){var e=this;
139this.subscribeObservable(this.ctx.behaviors.interaction.click,function(t){var r=t.current,n=t.button,i=t.modifiers;if(e.ctx.canvas3d){var a=e.ctx.selectionMode?e.params.bindings.clickCenterFocusSelectMode:e.params.bindings.clickCenterFocus,o=e.ctx.selectionMode?e.params.bindings.clickResetCameraOnEmptySelectMode??_6:e.params.bindings.clickResetCameraOnEmpty??b6;if(TQ.isEmpty(r.loci)&&O3.match(o,n,i))y2.Camera.Reset(e.ctx,{});else if(O3.match(a,n,i)){var s=TQ.normalize(r.loci,e.ctx.managers.interactivity.props.granularity);e.ctx.managers.camera.focusLoci(s,e.params)}}})},t}(T2.Handler),params:function(){return S6},display:{name:"Camera Focus Loci on Canvas"}}),A6=T2.create({name:"camera-axis-helper",category:"interaction",ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t.prototype.register=function(){var e=this,t=l5.None,r=0;this.subscribeObservable(this.ctx.behaviors.interaction.click,function(n){var i=n.current;if(e.ctx.canvas3d&&B5(i.loci)){var a=i.loci.elements[0].groupId;if(a===l5.None)return t=l5.None,void(r=0);var o,s,u=e.ctx.canvas3d.camera;if(a>=l5.X&&a<=l5.Z){t=l5.None,r=0;var c=Cg.sub(Cg(),u.target,u.position),l=Cg.cross(Cg(),c,u.up);(s=Cg())[a-1]=1,o=Cg.cross(Cg(),s,l),0===Cg.magnitude(o)&&(o=c)}else t===a?r=(r+1)%2:(t=a,r=0),a===l5.XY?(s=r?Cg.unitX:Cg.unitY,o=Cg.negUnitZ):a===l5.XZ?(s=r?Cg.unitX:Cg.unitZ,o=Cg.negUnitY):(s=r?Cg.unitY:Cg.unitZ,o=Cg.negUnitX);e.ctx.canvas3d.requestCameraReset({snapshot:function(e,t){return t.getInvariantFocus(e.boundingSphereVisible.center,e.boundingSphereVisible.radius,s,o)}})}})},t}(T2.Handler),params:function(){return{}},display:{name:"Camera Axis Helper"}}),C6={keySpinAnimation:O3([y6("I")],"Spin Animation","Press ${triggers}"),keyRockAnimation:O3([y6("O")],"Rock Animation","Press ${triggers}"),keyToggleFlyMode:O3([y6("Space",g6.create({shift:!0}))],"Toggle Fly Mode","Press ${triggers}"),keyResetView:O3([y6("T")],"Reset View","Press ${triggers}")},T6={bindings:Ib.Value(C6,{isHidden:!0})},P6=T2.create({name:"camera-controls",category:"interaction",ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t.prototype.register=function(){var e=this;this.subscribeObservable(this.ctx.behaviors.interaction.key,function(t){var r,n=t.code,i=t.key,a=t.modifiers;if(e.ctx.canvas3d){var o=Ac(Ac({},C6),e.params.bindings),s=e.ctx.canvas3d.props.trackball;if(O3.matchKey(o.keySpinAnimation,n,a,i)){var u="spin"===s.animate.name?"off":"spin";"off"===u?e.ctx.canvas3d.setProps({trackball:{animate:{name:u,params:{}}}}):e.ctx.canvas3d.setProps({trackball:{animate:{name:u,params:{speed:1}}}})}if(O3.matchKey(o.keyRockAnimation,n,a,i)){var c="rock"===s.animate.name?"off":"rock";"off"===c?e.ctx.canvas3d.setProps({trackball:{animate:{name:c,params:{}}}}):e.ctx.canvas3d.setProps({trackball:{animate:{name:c,params:{speed:.3,angle:10}}}})}if(O3.matchKey(o.keyToggleFlyMode,n,a,i)){var l=!s.flyMode;e.ctx.canvas3d.setProps({trackball:{flyMode:l}}),null!=(r=e.ctx.canvas3dContext)&&r.canvas&&(e.ctx.canvas3dContext.canvas.style.cursor=l?"crosshair":"unset")}O3.matchKey(o.keyResetView,n,a,i)&&y2.Camera.Reset(e.ctx,{})}})},t}(T2.Handler),params:function(){return T6},display:{name:"Camera Controls on Canvas"}}),E6=Object.freeze({__proto__:null,CameraAxisHelper:A6,CameraControls:P6,DefaultClickResetCameraOnEmpty:b6,DefaultClickResetCameraOnEmptySelectMode:_6,DefaultFocusLociBindings:x6,FocusLoci:w6}),M6=T2.create({name:"structure-info-prop",category:"custom-props",display:{name:"Structure Info"},ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),Object.defineProperty(t.prototype,"maxModelIndex",{get:function(){for(var e=-1,t=0,r=this.ctx.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Model));t<r.length;t++){var n=r[t],i=n.obj?.data&&Xz.Index.get(n.obj?.data).value;void 0!==i&&i>e&&(e=i)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxStructureIndex",{get:function(){for(var e=-1,t=0,r=this.ctx.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Structure));t<r.length;t++){var n=r[t],i=n.obj?.data&&yz.Index.get(n.obj?.data).value;void 0!==i&&i>e&&(e=i)}return e}
139,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asymIdOffset",{get:function(){for(var e=0,t=0,r=0,n=this.ctx.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Model));r<n.length;r++){var i=n[r].obj?.data;if(i){var a=Xz.AsymIdCount.get(i),o=Xz.AsymIdOffset.get(i).value;void 0!==a&&void 0!==o&&(e=Math.max(e,o.auth+a.auth),t=Math.max(t,o.label+a.label))}}return{auth:e,label:t}},enumerable:!1,configurable:!0}),t.prototype.setModelMaxIndex=function(){for(var e=this.maxModelIndex,t=0,r=this.ctx.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Model));t<r.length;t++){var n=r[t].obj?.data;n&&Xz.MaxIndex.get(n).value!==e&&Xz.MaxIndex.set(n,{value:e},e)}},t.prototype.setStructureMaxIndex=function(){for(var e=this.maxModelIndex,t=0,r=this.ctx.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Structure));t<r.length;t++){var n=r[t].obj?.data;n&&yz.MaxIndex.get(n).value!==e&&yz.MaxIndex.set(n,{value:e},e)}},t.prototype.handleModel=function(e,t){if(void 0===Xz.Index.get(e).value){var r=(t&&Xz.Index.get(t).value)??this.maxModelIndex+1;Xz.Index.set(e,{value:r},r)}void 0===Xz.AsymIdOffset.get(e).value&&(r=(t&&Xz.AsymIdOffset.get(t).value)??Ac({},this.asymIdOffset),Xz.AsymIdOffset.set(e,{value:r},r))},t.prototype.handleStructure=function(e,t){if(void 0===e.parent&&void 0===yz.Index.get(e).value){var r=(t&&yz.Index.get(t).value)??this.maxStructureIndex+1;yz.Index.set(e,{value:r},r)}},t.prototype.handle=function(e,t,r){DS.Molecule.Structure.is(t)?this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator||void 0!==t.data.parent||this.handleStructure(t.data,r?.data):DS.Molecule.Model.is(t)&&(this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator||this.handleModel(t.data,r?.data))},t.prototype.register=function(){var e=this;this.ctx.customModelProperties.register(Xz.AsymIdOffset,!0),this.ctx.customModelProperties.register(Xz.Index,!0),this.ctx.customModelProperties.register(Xz.MaxIndex,!0),this.ctx.customStructureProperties.register(yz.Index,!0),this.ctx.customStructureProperties.register(yz.MaxIndex,!0),this.subscribeObservable(this.ctx.state.data.events.object.created,function(t){e.handle(t.ref,t.obj),e.setModelMaxIndex(),e.setStructureMaxIndex()}),this.subscribeObservable(this.ctx.state.data.events.object.updated,function(t){e.handle(t.ref,t.obj,t.oldObj)})},t.prototype.unregister=function(){this.ctx.customModelProperties.unregister(Xz.AsymIdOffset.descriptor.name),this.ctx.customModelProperties.unregister(Xz.Index.descriptor.name),this.ctx.customModelProperties.unregister(Xz.MaxIndex.descriptor.name),this.ctx.customStructureProperties.unregister(yz.Index.descriptor.name),this.ctx.customStructureProperties.unregister(yz.MaxIndex.descriptor.name)},t}(T2.Handler)}),k6=[-1,1.76,1.87,1.65,1.5,1.4,1.85,1.8,1.6,1.4],I6={ALA:121,ARG:265,ASN:187,ASP:187,CYS:148,GLU:214,GLN:214,GLY:97,HIS:216,ILE:195,LEU:191,LYS:230,MET:203,PHE:228,PRO:154,SER:143,THR:163,TRP:264,TYR:255,VAL:165};function D6(e,t,r){switch(t){case"O":return 5;case"S":return 6;case"N":return"NZ"===e?4:3;case"C":switch(e){case"C":case"CE1":case"CE2":case"CE3":case"CH2":case"CZ":case"CZ2":case"CZ3":return 1;case"CA":case"CB":case"CE":case"CG1":case"CG2":return 2;default:switch(r){case"PHE":case"TRP":case"TYR":case"HIS":case"ASP":case"ASN":return 1;case"PRO":case"LYS":case"ARG":case"MET":case"ILE":case"LEU":return 2;case"GLU":case"GLN":return"CD"===e?1:2}}}return R6(t)}function O6(e,t,r){switch(t){case"C":return 7;case"N":return 8;case"P":return 9;case"O":return 5}return R6(t)}function R6(e){var t=UU(e),r=k6.indexOf(t);return-1===r&&(r=k6.length,k6[r]=t),r}function B6(e,t){return Tc(this,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:r=t.atomRadiusType,n=0,i.label=1;case 1:return n<r.length?e.shouldUpdate?[4,e.update({message:"Computing per residue surface accessibility...",current:n,max:r.length})]:[3,3]:[3,5];case 2:i.sent(),i.label=3;case 3:(function(e,t,r){for(var n=e.structure,i=e.atomRadiusType,a=e.serialResidueIndex,o=e.area,s=e.spherePoints,u=e.scalingConstant,c=e.maxLookupRadius,l=e.probeSize,d=n.lookup3d,f=n.seri
139alMapping,h=n.unitIndexMap,p=n.units,m=f.cumulativeUnitElementCount,g=f.elementIndices,v=f.unitIndices,y=t;y<r;++y){var b=k6[i[y]];if(b!==k6[0]){for(var _=p[v[y]],x=g[y],S=_.conformation.x(x),w=_.conformation.y(x),A=_.conformation.z(x),C=d.find(S,w,A,c),T=C.count,P=C.units,E=C.indices,M=C.squaredDistances,k=l+b,I=l+k,D=[],O=0;O<T;++O){var R=P[O],B=m[h.get(R.id)]+E[O],N=g[B],F=k6[i[B]];if((_!==R||x!==N)&&F!==k6[0]){var L=l+F;if(M[O]<(I+F)*(I+F)){var $=g[B];D[D.length]=[M[O],(M[O]+k*k-L*L)/(2*k),R.conformation.x($)-S,R.conformation.y($)-w,R.conformation.z($)-A]}}}D.sort(function(e,t){return e[0]-t[0]});var U=0;e:for(var j=0;j<s.length;++j){for(var z=s[j],G=z[0],V=z[1],H=z[2],q=0;q<D.length;++q){var W=D[q],X=W[1];if(G*W[2]+V*W[3]+H*W[4]>X)continue e}++U}o[a[y]]+=u*U*k*k}}})(t,n,Math.min(n+5e3,r.length)),i.label=4;case 4:return n+=5e3,[3,1];case 5:return[2]}})})}var N6,F6={numberOfSpherePoints:Ib.Numeric(92,{min:12,max:360,step:1},{description:"Number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC) - see Shrake A, Rupley JA: Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol 1973."}),probeSize:Ib.Numeric(1.4,{min:.1,max:4,step:.01},{description:"Corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)"}),nonPolymer:Ib.Boolean(!1,{description:"Include non-polymer atoms as occluders."}),traceOnly:Ib.Boolean(!1,{description:"Compute only using alpha-carbons, if true increase probeSize accordingly (e.g., 4 A). Considers only canonical amino acids."})};!function(e){function t(e,t,n){return Tc(this,void 0,void 0,function(){var i,a,o;return Pc(this,function(s){switch(s.label){case 0:return i=function(e,t){var n=e.elementCount,i=e.atomicResidueCount,a=t.probeSize,o=t.nonPolymer,s=t.traceOnly,u=t.numberOfSpherePoints;return{structure:e,probeSize:a,nonPolymer:o,traceOnly:s,spherePoints:r(u),scalingConstant:4*Math.PI/u,maxLookupRadius:2*t.probeSize+2*k6[2],atomRadiusType:new Int8Array(n),serialResidueIndex:new Int32Array(n),area:new Float32Array(i)}}(t,n),function(e){var t=Cj.residue.key,r=Cj.atom,n=r.type_symbol,i=r.label_atom_id,a=r.label_comp_id,o=e.structure,s=e.atomRadiusType,u=e.serialResidueIndex,c=qF.create(o),l=0,d=0,f=-1;c.structure=o;for(var h=0,p=0,m=o.units.length;h<m;++h){var g=o.units[h],v=g.elements;c.unit=g,l=-1;for(var y=0,b=v.length;y<b;++y){var _=v[y],x=p+y;c.element=_,l!==(d=t(c))&&++f,l=d;var S=n(c);if(FL(OL(S)))s[x]=0,u[x]=-1;else{var w=i(c),A=F$(g,_);if(2!==A&&(e.nonPolymer||pF(A))){var C=a(c);!e.traceOnly||("CA"===w||"BB"===w)&&I6[C]?(mF(A)?s[x]=O6(0,S):s[x]=5===A?D6(w,S,C):R6(S),u[x]=f):(s[x]=0,u[x]=f)}else s[x]=0,u[x]=-1}}p+=v.length}}(i),[4,B6(e,i)];case 1:return s.sent(),a=i.area,o=i.serialResidueIndex,[2,{area:a,serialResidueIndex:o}]}})})}function r(e){for(var t=[],r=Math.PI*(3-Math.sqrt(5)),n=2/e,i=0;i<e;++i){var a=i*n-1+n/2,o=Math.sqrt(1-a*a),s=i*r;t[t.length]=Cg.create(Math.cos(s)*o,a,Math.sin(s)*o)}return t}function n(e,t){return t/(I6[e]||121)}function i(e,t){var r=t.area,n=t.serialResidueIndex[PP.indexOf(PP.ofSortedArray(e.structure.root.serialMapping.elementIndices),e.element)];return-1===n?-1:r[n]}function a(e,t){var r=i(e,t);return-1===r?-1:n(Cj.atom.label_comp_id(e),r)}e.compute=function(e,r){var n=this;void 0===r&&(r={});var i=Ac(Ac({},Ib.getDefaultValues(F6)),r);return vy.create("Compute Accessible Surface Area",function(r){return Tc(n,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return[4,t(r,e,i)];case 1:return[2,n.sent()]}})})})},e.Flag={NA:0,Buried:1,Accessible:2},e.normalize=n,e.getValue=i,e.getNormalizedValue=a,e.getFlag=function(e,t){var r=a(e,t);return-1===r?0:r<.16?1:2}}(N6||={});var L6,$6=Ac({},F6),U6={isBuried:XH.Dynamic(aL("computed","accessible-surface-area.is-buried",WF.Bool),function(e){if(!tU.isAtomic(e.element.unit))return!1;var t=j6.get(e.element.structure).value;return!!t&&1===N6.getFlag(e.element,t)}),isAccessible:XH.Dynamic(aL("computed","accessible-surface-area.is-accessible",WF.Bool),function(e){if(!tU.isAtomic(e.element.unit))return!1;var t=j6.get(e.element.structure).value;return!!t&&2===N6.getFlag(e.element,t)})},j6=ZU.createProvider({label:"Accessible Surface Area",descriptor:{name:"molstar_accessible_surface_area",symbols:U6},type:"root",defaultParams:$6,getParams:function(e){return $6},isApplicable:function(e){return!0},obtain:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=Ac(Ac({},Ib.getDefaultValues($6)),r),i={},[4,N6.compute(t,n).runInContext(e.runtime)];case 1:return[2,(i.value=a.sent(),i)]}})})}}),z6=tv(16448250),G6={list:Ib.ColorList("rainbow",{presetKind:"scale"})},V6={name:"accessible-surface-area",label:"Accessible Surface Area",category:KZ.Category.Residue,factory:function e(t,r){var n,i=wE.create({listOrName:r.list.colors,minLabel:"buried",maxLabel:"exposed",domain:[0,1]}),a=t.structure&&j6.get(t.structure),o=a?Tv(a.id,a.version):-1;
139if(a?.value&&t.structure){var s=qF.create(t.structure),u=a.value,c=function(e){var t=N6.getNormalizedValue(e,u);return-1===t?z6:i.color(t)};n=function(e){return qF.is(e)&&tU.isAtomic(e.unit)?c(e):C$.isLocation(e)?(s.unit=e.aUnit,s.element=e.aUnit.elements[e.aIndex],c(s)):z6}}else n=function(){return z6};return{factory:e,granularity:"group",preferSmoothing:!0,color:n,props:r,contextHash:o,description:"Assigns a color based on the relative accessible surface area of a residue.",legend:i?i.legend:void 0}},getParams:function(e){return G6},defaultValues:Ib.getDefaultValues(G6),isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(e,t){return t.structure?j6.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&j6.ref(e.structure,!1)}}},H6=T2.create({name:"computed-accessible-surface-area-prop",category:"custom-props",display:{name:"Accessible Surface Area"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=j6,t.labelProvider={label:function(e){if(t.params.showTooltip)return function(e){if("element-loci"===e.kind){if(0===e.elements.length||!(l=j6.get(e.structure).value)||e.structure.customPropertyDescriptors.hasReference(j6.descriptor))return;for(var t=e.structure.root.serialMapping.getSerialIndex,r=l.area,n=l.serialResidueIndex,i=new Set,a=0,o=function(e,o){var s=o.elements;kP.forEach(e,function(e){var u=n[t(o,s[e])];-1===u||i.has(u)||(a+=r[u],i.add(u))})},s=0,u=e.elements;s<u.length;s++){var c=u[s];o(c.indices,c.unit)}return 0===i.size?void 0:`Accessible Surface Area <small>(${i.size} ${i.size>1?"Residues sum":"Residue"})</small>: ${a.toFixed(2)} Å<sup>2</sup>`}var l;if("structure-loci"===e.kind)return!(l=j6.get(e.structure).value)||e.structure.customPropertyDescriptors.hasReference(j6.descriptor)?void 0:`Accessible Surface Area <small>(Whole Structure)</small>: ${$b(l.area).toFixed(2)} Å<sup>2</sup>`}(e)}},t}return wc(t,e),t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){iq.addCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(V6),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.query.structure.registry.add(q6),this.ctx.query.structure.registry.add(W6)},t.prototype.unregister=function(){iq.removeCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(V6),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.query.structure.registry.remove(q6),this.ctx.query.structure.registry.remove(W6)},t}(T2.Handler),params:function(){return{autoAttach:Ib.Boolean(!1),showTooltip:Ib.Boolean(!0)}}}),q6=Pq("Buried Protein Residues",SL.struct.modifier.union([SL.struct.modifier.wholeResidues([SL.struct.modifier.union([SL.struct.generator.atomGroups({"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":U6.isBuried.symbol()})])])]),{description:"Select buried protein residues.",category:bq.Residue,ensureCustomProperties:function(e,t){return j6.attach(e,t)}}),W6=Pq("Accessible Protein Residues",SL.struct.modifier.union([SL.struct.modifier.wholeResidues([SL.struct.modifier.union([SL.struct.generator.atomGroups({"chain-test":SL.core.rel.eq([SL.ammp("objectPrimitive"),"atomistic"]),"residue-test":U6.isAccessible.symbol()})])])]),{description:"Select accessible protein residues.",category:bq.Residue,ensureCustomProperties:function(e,t){return j6.attach(e,t)}});function X6(e,t){return e.model.atomicHierarchy.atoms.type_symbol.value(e.elements[t])}function Y6(e,t){return e.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.elements[t])}function K6(e,t){return e.model.atomicHierarchy.atoms.label_atom_id.value(e.elements[t])}function Z6(e,t){return e.model.atomicHierarchy.atoms.label_alt_id.value(e.elements[t])}function Q6(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(e.elements[t])}function J6(e,t,r){return function(e,t,r){for(var n=0,i=e.interUnitBonds.getEdgeIndices(r,t.id),a=0,o=i.length;a<o;++a){var s=e.interUnitBonds.edges[i[a]];RN.isCovalent(s.props.flag)&&(n+=1)}return n}(e,t,r)+function(e,t){for(var r=0,n=e.bonds,i=n.offset,a=n.edgeProps.flags,o=i[t],s=i[t+1];o<s;++o)RN.isCovalent(a[o])&&(r+=1);return r}(t,r)}function e8(e,t,r,n){var i=0;return r8(e,t,r,function(e,t){X6(e,t)===n&&(i+=1)}),i}function t8(e,t,r){for(var n=e.bonds,i=n.offset,a=n.b,o=n.edgeProps.flags,s=i[t],u=i[t+1];s<u;++s)RN.isCovalent(o[s])&&r(e,a[s])}function r8(e,t,r,n){(function(e,t,r,n){for(var i=e.interUnitBonds.getEdgeIndices(r,t.id),a=0,o=i.length;a<o;++a){var s=e.interUnitBonds.edges[i[a]],u=e.unitMap.get(s.unitB);RN.isCovalent(s.props.flag)&&n(u,s.indexB)}})(e,t,r,n),t8(t,r,n)}function n8(e){switch(e){case L6.Spherical:return"Spherical";case L6.Terminal:return"Terminal";case L6.Linear:return"Linear";case L6.Trigonal:return"Trigonal";case L6.Tetrahedral:return"Tetrahedral";case L6.TrigonalBiPyramidal:return"Trigonal Bi-Pyramidal";case L6.Octahedral:return"Octahedral";case L6.SquarePlanar:return"Square Planar";case L6.Unknown:return"Unknown"}}function i8(e){switch(e){case 0:return L6.Spherical;case 1:return L6.Terminal;case 2:return L6.Linear;case 3:return L6.Trigonal;case 4:return L6.Tetrahedral;default:return L6.Unknown}}!function(e){e[e.Spherical=0]="Spherical",e[e.Terminal=1]="Terminal",e[e.Linear=2]="Linear",e[e.Trigonal=3]="Trigonal",e[e.Tetrahedral=4]="Tetrahedral",e[e.TrigonalBiPyramidal=5]="TrigonalBiPyramidal",e[e.Octahedral=6]="Octahedral",e[e.SquarePlanar=7]="SquarePlanar",e[e.Unknown=8]="Unknown"}(L6||={});var a8=new Map([[L6.Linear,Mg(180)],[L6.Trigonal,Mg(120)],[L6.Tetrahedral,Mg(109.4721)],[L6.Octahedral,Mg(90)]]),o8=Cg(),s8=Cg(),u8=Cg(),c8=Cg(),l8=Cg();function d8(e,t,r,n,i){var a=[];return t.conformation.position(t.elements[r],u8),n.conformation.position(n.elements[i],c8),Cg.sub(o8,c8,u8),r8(e,t,r,function(e,t){"H"!==X6(e,t)&&(e.conformation.position(e.elements[t],l8),Cg.sub(s8,l8,u8),a.push(Cg.angle(o8,s8)))}),a}function f8(e,t,r,n,i){t.conformation.position(t.elements[r],u8),n.conformation.position(n.elements[i],c8),Cg.sub(o8,c8,u8);var a,o,s=[Cg(),Cg()],u=0;if(r8(e,t,r,function(e,t){u>1||"H"!==X6(e,t)&&(a=e,o=t,e.conformation.position(e.elements[t],l8),Cg.sub(s[u++],l8,u8))}),1===u&&a&&o&&r8(e,a,o,function(e,n){u>1||e===t&&n===r||"H"!==X6(e,n)&&(e.conformation.position(e.elements[n],l8),Cg.sub(s[u++],l8,u8))}),2===u)return Cg.cross(s8,s[0],s[1]),Math.abs(Math.PI/2-Cg.angle(s8,o8))}var h8=new C$.ElementBondIterator,p8=new C$.ElementBondIterator,m8=new C$.ElementBondIterator,g8=new C$.ElementBondIterator;function v8(e,t,r,n){var i=e8(e,t,r,"H"),a=X6(t,r),o=Y6(t,r),s="always"===n.assignCharge||"auto"===n.assignCharge&&0===o,u="always"===n.assignH||"auto"===n.assignH&&0===i,c=J6(e,t,r),l=function(e,t,r){for(var n=0,i=t.bonds,a=i.offset,o=i.edgeProps,s=o.flags,u=o.order,c=a[r],l=a[r+1];c<l;++c)RN.isCovalent(s[c])&&(n+=u[c]);
139return e.interUnitBonds.getEdgeIndices(r,t.id).forEach(function(t){var r=e.interUnitBonds.edges[t];RN.isCovalent(r.props.flag)&&(n+=r.props.order)}),n}(e,t,r),d=function(e,t,r){var n=X6(t,r),i="O"===n||"N"===n;if(i&&4===J6(e,t,r))return!1;for(h8.setElement(e,t,r);h8.hasNext;){var a=h8.move();if(a.order>1)return!0;if(i){var o=X6(a.otherUnit,a.otherIndex);for(p8.setElement(e,a.otherUnit,a.otherIndex);p8.hasNext;){var s=p8.move();if(s.order>1){if(("P"===o||"S"===o)&&"O"===X6(s.otherUnit,s.otherIndex))continue;return!0}}}}return!1}(e,t,r),f=l-c>0,h=0,p=L6.Unknown;switch(a){case"H":s&&(0===c?(o=1,p=L6.Spherical):1===c&&(o=0,p=L6.Terminal));break;case"C":s&&(o=0),u&&(h=Math.max(0,4-l-Math.abs(o))),p=i8(c+h+Math.max(0,-o));break;case"N":if(s)if(u)if(d&&l<4)o=+(c-i==1&&l-i==2);else for(m8.setElement(e,t,r);m8.hasNext;){var m=m8.move(),g=X6(m.otherUnit,m.otherIndex);if("S"===g||Tq(g)){o=0;break}o=1}else o=l-3;u&&(h=Math.max(0,3-l+o)),p=i8(d&&!f?c+h-o:c+h+1-o);break;case"O":if(s&&(u||(o=l-2),1===l)){m8.setElement(e,t,r);e:for(;m8.hasNext;){var v=m8.move();for(g8.setElement(e,v.otherUnit,v.otherIndex);g8.hasNext;){var y=g8.move();if((y.otherUnit!==t||y.otherIndex!==r)&&"O"===X6(y.otherUnit,y.otherIndex)&&2===y.order){o=-1;break e}}}}u&&(h=Math.max(0,2-l+o)),p=i8(d&&!f?c+h-o+1:c+h-o+2);break;case"S":s&&(u||(o=l<=3&&0===e8(e,t,r,"O")?l-2:0)),u&&l<2&&(h=Math.max(0,2-l+o)),l<=3&&(p=i8(c+h-o+2));break;case"F":case"CL":case"BR":case"I":case"AT":s&&(o=l-1);break;case"LI":case"NA":case"K":case"RB":case"CS":case"FR":s&&(o=1-l);break;case"BE":case"MG":case"CA":case"SR":case"BA":case"RA":s&&(o=2-l);break;default:ay&&console.warn("Requested charge, protonation for an unhandled element",a)}return[o,h,h+i,p]}function y8(e,t,r){var n,i=t.elements.length,a=new Int8Array(i),o=new Int8Array(i),s=new Int8Array(i),u=new Int8Array(i),c=!!e.parent;if(c){var l=e.root.unitMap.get(t.id);if((n=PP.indicesOf(l.elements,t.elements)).length!==t.elements.length)throw Error("expected to find an index for every element");t=l,e=e.root}for(var d=0;d<i;++d){var f=v8(e,t,c?n[d]:d,r),h=f[0],p=f[1],m=f[2],g=f[3];a[d]=h,o[d]=p,s[d]=m,u[d]=g}return{charge:a,implicitH:o,totalH:s,idealGeometry:u}}var b8={assignCharge:Ib.Select("auto",[["always","always"],["auto","auto"],["never","never"]]),assignH:Ib.Select("auto",[["always","always"],["auto","auto"],["never","never"]])};function _8(e,t,r){return Tc(this,void 0,void 0,function(){var e,n,i,a,o,s;return Pc(this,function(u){for(e=Ac(Ac({},Ib.getDefaultValues(b8)),r),n=new Map,i=0,a=t.units.length;i<a;++i)o=t.units[i],tU.isAtomic(o)&&(s=y8(t,o,e),n.set(o.id,s));return[2,n]})})}var x8,S8,w8,A8=Ac({},b8),C8=ZU.createProvider({label:"Valence Model",descriptor:{name:"molstar_computed_valence_model"},type:"local",defaultParams:A8,getParams:function(e){return A8},isApplicable:function(e){return!0},obtain:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=Ac(Ac({},Ib.getDefaultValues(A8)),r),i={},[4,_8(e.runtime,t,n)];case 1:return[2,(i.value=a.sent(),i)]}})})}});(function(e){function t(e,t){for(var r=new Int32Array(t+1),n=new Int32Array(t),i=new Int32Array(t),a=e.members,o=e.count,s=e.offsets,u=0,c=s[o];u<c;++u)++i[a[u]];var l=0;for(u=0;u<t;u++)r[u]=l,l+=i[u];r[t]=l;var d=new Int32Array(l);for(u=0;u<o;++u)for(var f=s[u],h=s[u+1];f<h;++f){var p=a[f];d[r[p]+n[p]]=u,++n[p]}return{indices:d,offsets:r}}function r(e,t){for(var r,n=e.count,i=e.types,a=[],o=0;o<n;++o)t.has(i[o])&&a.push(o);var s=PP.ofSortedArray(a);return{indices:s,get lookup3d(){if(!r){var t={x:e.x,y:e.y,z:e.z,indices:s};r=JE(t,eU(t))}return r}}}e.setPosition=function(e,t,r,n){return Cg.set(e,n.x[r],n.y[r],n.z[r]),Cg.transformMat4(e,e,t.conformation.operator.matrix),e},e.createElementsIndex=t,e.create=function(e,n){var i,a;return Ac(Ac({},n),{get lookup3d(){if(!i){var e={x:n.x,y:n.y,z:n.z,indices:kP.ofBounds(0,n.count)};i=JE(e,eU(e))}return i},get elementsIndex(){return a||=t(n,e)},subset:function(e){return r(n,e)}})},e.createSubset=r,e.Info=function(e,t,r){var n=C8.get(e).value;if(!n||!n.has(t.id))throw Error("valence model required");return{unit:t,types:r.types,feature:-1,x:r.x,y:r.y,z:r.z,members:r.members,offsets:r.offsets,idealGeometry:n.get(t.id).idealGeometry}},e.position=function(e,t){return Cg.set(e,t.x[t.feature],t.y[t.feature],t.z[t.feature]),Cg.transformMat4(e,e,t.unit.conformation.operator.matrix),e};var n=Cg(),i=Cg();e.distance=function(e,t){var r=e.members[e.offsets[e.feature]],a=t.members[t.offsets[t.feature]];return e.unit.conformation.position(e.unit.elements[r],n),t.unit.conformation.position(t.unit.elements[a],i),Cg.distance(n,i)},e.Provider=function(e,t){return{types:new Set(e),add:t}}})(x8||={}),function(e){e.create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=iv.create(Float32Array,1,t,r?r.x:e),i=iv.create(Float32Array,1,t,r?r.y:e),a=iv.create(Float32Array,1,t,r?r.z:e),o=iv.create(Uint8Array,1,t,r?r.types:e),s=iv.create(Uint8Array,1,t,r?r.groups:e),u=iv.create(Uint32Array,1,t,r?r.offsets:e),c=iv.create(Uint32Array,1,t,r?r.members:e),l={x:0,y:0,z:0,offset:0,count:0};return{startState:function(){l.x=0,l.y=0,l.z=0,l.offset=c.elementCount,l.count=0},pushMember:function(e,t,r,n){iv.add(c,n),l.x+=e,l.y+=t,l.z+=r,l.count+=1},finishState:function(e,t){var r=l.count;0!==r&&(iv.add(o,e),iv.add(s,t),iv.add(n,l.x/r),iv.add(i,l.y/r),iv.add(a,l.z/r),iv.add(u,l.offset))},add:function(e,t,r,l,d,f){iv.add(o,e),iv.add(s,t),iv.add(n,r),iv.add(i,l),iv.add(a,d),iv.add(u,c.elementCount),iv.add(c,f)},getFeatures:function(e){iv.add(u,c.elementCount);var t=iv.compact(n,!0),r=iv.compact(i,!0),l=iv.compact(a,!0),d=n.elementCount;return x8.create(e,{x:t,y:r,z:l,count:d,types:iv.compact(o,!0),groups:iv.compact(s,!0),offsets:iv.compact(u,!0),members:iv.compact(c,!0)})}}}}(S8||={}),function(e){e.createElementsIndex=function(e,t,r){for(var n=new Int32Array(r+1),i=new Int32Array(r),a=new Int32Array(r),o=t.members,s=t.offsets,u=0,c=2*e.edgeCount;u<c;++u)if(!((p=e.a[u])>(m=e.b[u]))){for(var l=s[p],d=s[p+1];l<d;++l)++a[o[l]];for(l=s[m],d=s[m+1];l<d;++l)++a[o[l]]}var f=0;for(u=0;
139u<r;u++)n[u]=f,f+=a[u];n[r]=f;var h=new Int32Array(f);for(u=0,c=2*e.edgeCount;u<c;++u){var p,m;if(!((p=e.a[u])>(m=e.b[u]))){for(l=s[p],d=s[p+1];l<d;++l)h[n[g=o[l]]+i[g]]=u,++i[g];for(l=s[m],d=s[m+1];l<d;++l){var g;h[n[g=o[l]]+i[g]]=u,++i[g]}}}return{indices:h,offsets:n}}}(w8||={});var T8,P8,E8,M8,k8,I8,D8=function(e){function t(t,r){var n=e.call(this,t)||this;n.elementKeyIndex=new Map;for(var i=0,a=n.edges.length;i<a;++i)for(var o=n.edges[i],s=o.unitA,u=o.indexA,c=r.get(s),l=c.offsets,d=c.members,f=l[u],h=l[u+1];f<h;++f){var p=n.getElementKey(d[f],s),m=n.elementKeyIndex.get(p);void 0===m?n.elementKeyIndex.set(p,[i]):m.push(i)}return n}return wc(t,e),t.prototype.getContactIndicesForElement=function(e,t){return this.elementKeyIndex.get(this.getElementKey(e,t.id))||[]},t.prototype.getElementKey=function(e,t){return`${e}|${t}`},t}(AL);function O8(e){switch(e){case P8.HydrogenBond:return"Hydrogen Bond";case P8.Hydrophobic:return"Hydrophobic Contact";case P8.HalogenBond:return"Halogen Bond";case P8.Ionic:return"Ionic Interaction";case P8.MetalCoordination:return"Metal Coordination";case P8.CationPi:return"Cation-Pi Interaction";case P8.PiStacking:return"Pi Stacking";case P8.WeakHydrogenBond:return"Weak Hydrogen Bond";case P8.Unknown:return"Unknown Interaction"}}function R8(e){switch(e){case 0:return"None";case 1:return"Positive Charge";case 2:return"Negative Charge";case 3:return"Aromatic Ring";case 4:return"Hydrogen Donor";case 5:return"Hydrogen Acceptor";case 6:return"Halogen Donor";case 7:return"Halogen Acceptor";case 8:return"HydrophobicAtom";case 9:return"Weak Hydrogen Donor";case 10:return"Ionic Type Partner";case 11:return"Dative Bond Partner";case 12:return"Transition Metal";case 13:return"Ionic Type Metal"}}function B8(e){switch(e){case M8.None:return"None";case M8.QuaternaryAmine:return"Quaternary Amine";case M8.TertiaryAmine:return"Tertiary Amine";case M8.Sulfonium:return"Sulfonium";case M8.SulfonicAcid:return"Sulfonic Acid";case M8.Sulfate:return"Sulfate";case M8.Phosphate:return"Phosphate";case M8.Halocarbon:return"Halocarbon";case M8.Guanidine:return"Guanidine";case M8.Acetamidine:return"Acetamidine";case M8.Carboxylate:return"Carboxylate"}}(function(e){e[e.None=0]="None",e[e.Filtered=1]="Filtered"})(T8||={}),function(e){e[e.Unknown=0]="Unknown",e[e.Ionic=1]="Ionic",e[e.CationPi=2]="CationPi",e[e.PiStacking=3]="PiStacking",e[e.HydrogenBond=4]="HydrogenBond",e[e.HalogenBond=5]="HalogenBond",e[e.Hydrophobic=6]="Hydrophobic",e[e.MetalCoordination=7]="MetalCoordination",e[e.WeakHydrogenBond=8]="WeakHydrogenBond"}(P8||={}),function(e){e[e.None=0]="None",e[e.PositiveCharge=1]="PositiveCharge",e[e.NegativeCharge=2]="NegativeCharge",e[e.AromaticRing=3]="AromaticRing",e[e.HydrogenDonor=4]="HydrogenDonor",e[e.HydrogenAcceptor=5]="HydrogenAcceptor",e[e.HalogenDonor=6]="HalogenDonor",e[e.HalogenAcceptor=7]="HalogenAcceptor",e[e.HydrophobicAtom=8]="HydrophobicAtom",e[e.WeakHydrogenDonor=9]="WeakHydrogenDonor",e[e.IonicTypePartner=10]="IonicTypePartner",e[e.DativeBondPartner=11]="DativeBondPartner",e[e.TransitionMetal=12]="TransitionMetal",e[e.IonicTypeMetal=13]="IonicTypeMetal"}(E8||={}),function(e){e[e.None=0]="None",e[e.QuaternaryAmine=1]="QuaternaryAmine",e[e.TertiaryAmine=2]="TertiaryAmine",e[e.Sulfonium=3]="Sulfonium",e[e.SulfonicAcid=4]="SulfonicAcid",e[e.Sulfate=5]="Sulfate",e[e.Phosphate=6]="Phosphate",e[e.Halocarbon=7]="Halocarbon",e[e.Guanidine=8]="Guanidine",e[e.Acetamidine=9]="Acetamidine",e[e.Carboxylate=10]="Carboxylate"}(M8||={}),function(e){e.create=function(e,t){var r=[],n=[],i=[];return{add:function(e,t,a){r[r.length]=e,n[n.length]=t,i[i.length]=a},getContacts:function(){for(var a=new DF.EdgeBuilder(e.count,r,n),o=new Int8Array(a.slotCount),s=new Int8Array(a.slotCount),u=0,c=a.edgeCount;u<c;u++)a.addNextEdge(),a.assignProperty(o,i[u]);var l,d=a.createGraph({type:o,flag:s});return Object.defineProperty(d,"elementsIndex",{get:function(){return l||=w8.createElementsIndex(d,e,t)}})}}}}(k8||={}),function(e){e.create=function(){var e=new AL.Builder;return{startUnitPair:function(t,r){e.startUnitPair(t.id,r.id)},finishUnitPair:function(){e.finishUnitPair()},add:function(t,r,n){e.add(t,r,{type:n,flag:T8.None})},getContacts:function(t){return new D8(e.getMap(),t)}}}}(I8||={});var N8={lineOfSightDistFactor:Ib.Numeric(1,{min:0,max:3,step:.1})};function F8(e,t,r){var n=t.members[t.offsets[t.feature]],i=r.members[r.offsets[r.feature]];if(n===i&&t.unit===r.unit)return!1;var a=Z6(t.unit,n),o=Z6(r.unit,i);return!(a&&o&&a!==o||t.unit===r.unit&&t.unit.model.atomicHierarchy.residueAtomSegments.count>1&&t.unit.residueIndex[t.unit.elements[n]]===r.unit.residueIndex[r.unit.elements[i]]||function(e,t,r,n,i){return t===n?function(e,t,r){var n=e.bonds,i=n.offset,a=n.b,o=n.edgeProps.flags;RN.is;for(var s=i[t],u=i[t+1];s<u;++s)if(a[s]===r&&RN.isCovalent(o[s]))return!0;return!1}(t,r,i):function(e,t,r,n,i){var a=e.interUnitBonds.getEdge(r,t.id,i,n.id);return a&&RN.isCovalent(a.props.flag)}(e,t,r,n,i)}(e,t.unit,n,r.unit,i))}function L8(e,t,r,n){var i=Z6(e,t),a=Z6(r,n);return i&&a&&i!==a}function $8(e,t){for(var r=t.feature,n=t.offsets,i=t.members,a=n[r],o=n[r+1];a<o;++a)if(i[a]===e)return!0;return!1}var U8=Cg(),j8=Cg(),z8=Cg(),G8=aU();function V8(e,t,r,n){var i=t.feature,a=r.feature,o=t.members[t.offsets[i]],s=r.members[r.offsets[a]];x8.position(j8,t),x8.position(z8,r),Cg.scale(U8,Cg.add(U8,j8,z8),.5);
139var u=3*n,c=e.lookup3d.find(U8[0],U8[1],U8[2],u,G8),l=c.count,d=c.indices,f=c.units,h=c.squaredDistances;if(0===l)return!0;for(var p=0;p<l;++p){var m=d[p],g=f[p];if(tU.isAtomic(g)){var v=X6(g,m);if("H"!==v){var y=UU(v);if(!(y*y*n*n<=h[p]||L8(g,m,t.unit,o)||L8(g,m,r.unit,s)||t.unit===g&&$8(m,t)||r.unit===g&&$8(m,r)||(g.conformation.position(g.elements[m],U8),Cg.squaredDistance(U8,j8)<1||Cg.squaredDistance(U8,z8)<1)))return!1}}}return!0}function H8(e,t,r,n,i,a){for(var o=r.x,s=r.y,u=r.z,c=r.subset(i.requiredFeatures),l=c.lookup3d,d=c.indices,f=x8.Info(e,t,r),h=Ac({},f),p=a.lineOfSightDistFactor,m=0,g=kP.size(d);m<g;++m){var v=kP.getAt(d,m),y=l.find(o[v],s[v],u[v],i.maxDistance),b=y.count,_=y.indices,x=y.squaredDistances;if(0!==b){f.feature=v;for(var S=0;S<b;++S){var w=kP.getAt(d,_[S]);if(!(w<=v)&&(h.feature=w,F8(e,f,h))){var A=i.getType(e,f,h,x[S]);A&&V8(e,f,h,p)&&n.add(v,w,A)}}}}}var q8=Og(),W8={distanceMax:Ib.Numeric(4,{min:1,max:5,step:.1}),angleMax:Ib.Numeric(30,{min:0,max:60,step:1})},X8=["CL","BR","I","AT"],Y8=["N","O","S"],K8=["C","N","P","S"],Z8=Mg(180),Q8=Mg(120),J8=x8.Provider([6],function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=n.length;u<c;++u){var l=X6(t,u);X8.includes(l)&&r.add(6,M8.None,a[n[u]],o[n[u]],s[n[u]],u)}}),e7=x8.Provider([7],function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=function(i,u){var c=X6(t,i);if(Y8.includes(c)){var l=!1;r8(e,t,i,function(e,t){K8.includes(X6(e,t))&&(l=!0)}),l&&r.add(7,M8.None,a[n[i]],o[n[i]],s[n[i]],i)}},c=0,l=n.length;c<l;++c)u(c)}),t7={name:"halogen-bonds",params:W8,createTester:function(e){var t=function(e){return{angleMax:Mg(e.angleMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([6,7]),getType:function(e,r,n){return function(e,t,r,n){var i=t.types[t.feature];if(o=r.types[r.feature],7===(a=i)&&6===o||6===a&&7===o){var a,o,s=6===i?[t,r]:[r,t],u=s[0],c=s[1],l=u.members[u.offsets[u.feature]],d=c.members[c.offsets[c.feature]],f=d8(e,u.unit,l,c.unit,d);if(1===f.length&&!(Z8-f[0]>n.angleMax)){var h=d8(e,c.unit,d,u.unit,l);if(0!==h.length&&!h.some(function(e){return Q8-e>n.angleMax}))return P8.HalogenBond}}}(e,r,n,t)}}}},r7={distanceMax:Ib.Numeric(3.5,{min:1,max:5,step:.1}),backbone:Ib.Boolean(!0,{description:"Include backbone-to-backbone hydrogen bonds"}),accAngleDevMax:Ib.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal acceptor angle"}),donAngleDevMax:Ib.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal donor angle"}),accOutOfPlaneAngleMax:Ib.Numeric(90,{min:0,max:180,step:1}),donOutOfPlaneAngleMax:Ib.Numeric(45,{min:0,max:180,step:1})},n7=Ac(Ac({},r7),{water:Ib.Boolean(!1,{description:"Include water-to-water hydrogen bonds"}),sulfurDistanceMax:Ib.Numeric(4.1,{min:1,max:5,step:.1})}),i7=Ac({},r7);function a7(e,t){var r=C8.get(e).value;if(!r)throw Error("expected valence model to be available");var n=r.get(t.id);if(!n)throw Error("expected valence model for unit to be available");return n}function o7(e,t){var r=e.rings,n=r.elementAromaticRingIndices,i=r.all,a=n.get(t);if(void 0===a)return!1;for(var o=0,s=a.length;o<s;++o)for(var u=i[a[o]],c=0,l=u.length;c<l;++c){var d=X6(e,u[c]);if("N"===d||"O"===d)return!0}return!1}function s7(e,t){return 2===e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[e.elements[t]]]}function u7(e,t){return NN.has(K6(e,t))}function c7(e,t){return"HIS"===Q6(e,t)&&"N"===X6(e,t)&&function(e,t){return e.rings.elementRingIndices.has(t)}(e,t)}function l7(e){return{includeBackbone:e.backbone,maxAccAngleDev:Mg(e.accAngleDevMax),maxDonAngleDev:Mg(e.donAngleDevMax),maxAccOutOfPlaneAngle:Mg(e.accOutOfPlaneAngleMax),maxDonOutOfPlaneAngle:Mg(e.donOutOfPlaneAngleMax)}}var d7=Mg(120);function f7(e,t,r,n){var i=t.members[t.offsets[t.feature]],a=r.members[r.offsets[r.feature]];if(n.includeBackbone||(o=t.unit,s=i,u=r.unit,c=a,!u7(o,s)||!u7(u,c))){var o,s,u,c,l=d8(e,t.unit,i,r.unit,a),d=a8.get(t.idealGeometry[i])||d7;if(!l.some(function(e){return Math.abs(d-e)>n.maxDonAngleDev})){if(t.idealGeometry[i]===L6.Trigonal&&void 0!==(f=f8(e,t.unit,i,r.unit,a))&&f>n.maxDonOutOfPlaneAngle)return;var f,h=d8(e,r.unit,a,t.unit,i),p=a8.get(r.idealGeometry[a])||d7;if(!h.some(function(e){return p-e>n.maxAccAngleDev}))return!(r.idealGeometry[a]===L6.Trigonal&&void 0!==(f=f8(e,r.unit,a,t.unit,i))&&f>n.maxAccOutOfPlaneAngle)||void 0}}}var h7=x8.Provider([4],function(e,t,r){for(var n=a7(e,t).totalH,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=0,l=i.length;c<l;++c){var d=X6(t,c);(c7(t,c)||n[c]>0&&("N"===d||"O"===d||"S"===d))&&r.add(4,M8.None,o[i[c]],s[i[c]],u[i[c]],c)}}),p7=x8.Provider([9],function(e,t,r){for(var n=a7(e,t).totalH,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=0,l=i.length;c<l;++c)"C"===X6(t,c)&&n[c]>0&&(e8(e,t,c,"N")>0||e8(e,t,c,"O")>
1390||o7(t,c))&&r.add(9,M8.None,o[i[c]],s[i[c]],u[i[c]],c)}),m7=x8.Provider([5],function(e,t,r){for(var n=a7(e,t),i=n.charge,a=n.implicitH,o=n.idealGeometry,s=t.elements,u=t.model.atomicConformation,c=u.x,l=u.y,d=u.z,f=function(e){r.add(5,M8.None,c[s[e]],l[s[e]],d[s[e]],e)},h=0,p=s.length;h<p;++h){var m=X6(t,h);if("O"===m)f(h);else if("N"===m){if(c7(t,h))f(h);else if(i[h]<1){var g=J6(e,t,h)+a[h],v=o[h];(v===L6.Tetrahedral&&g<4||v===L6.Trigonal&&g<3||v===L6.Linear&&g<2)&&f(h)}}else if("S"===m){var y=Q6(t,h);"CYS"!==y&&"MET"!==y&&-1!==Y6(t,h)||f(h)}}}),g7={name:"hydrogen-bonds",params:n7,createTester:function(e){var t=Math.max(e.distanceMax,e.sulfurDistanceMax),r=function(e){return Ac(Ac({},l7(e)),{includeWater:e.water,maxSulfurDistSq:e.sulfurDistanceMax*e.sulfurDistanceMax,maxDistSq:e.distanceMax*e.distanceMax})}(e);return{maxDistance:t,requiredFeatures:new Set([4,5]),getType:function(e,t,n,i){return function(e,t,r,n,i){var a=t.types[t.feature],o=r.types[r.feature];if(u=o,5===(s=a)&&4===u||4===s&&5===u){var s,u,c,l,d,f,h=5===o?[t,r]:[r,t],p=h[0],m=h[1],g=p.members[p.offsets[p.feature]],v=m.members[m.offsets[m.feature]];if(!(n>("S"===X6(p.unit,g)||"S"===X6(m.unit,v)?i.maxSulfurDistSq:i.maxDistSq))&&(i.includeWater||(c=p.unit,l=g,d=m.unit,f=v,!s7(c,l)||!s7(d,f)))&&f7(e,p,m,i))return P8.HydrogenBond}}(e,t,n,i,r)}}}},v7={name:"weak-hydrogen-bonds",params:i7,createTester:function(e){var t=l7(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([9,5]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a=t.types[t.feature],o=r.types[r.feature];if(u=o,9===(s=a)&&5===u||5===s&&9===u){var s,u,c=5===o?[t,r]:[r,t];if(f7(e,c[0],c[1],i))return P8.WeakHydrogenBond}}(e,r,n,0,t)}}}};function y7(e,t,r){return"S"===X6(t,r)&&3===e8(e,t,r,"O")}function b7(e,t,r){return"S"===X6(t,r)&&4===e8(e,t,r,"O")}function _7(e,t,r){return"P"===X6(t,r)&&e8(e,t,r,"O")===J6(e,t,r)}function x7(e,t,r){var n=0;return"C"===X6(t,r)&&2===e8(e,t,r,"O")&&1===e8(e,t,r,"C")&&r8(e,t,r,function(t,r){"O"===X6(t,r)&&J6(e,t,r)-e8(e,t,r,"H")==1&&(n+=1)}),2===n}function S7(e,t,r){var n=0;return"C"===X6(t,r)&&3===J6(e,t,r)&&3===e8(e,t,r,"N")&&r8(e,t,r,function(t,r){J6(e,t,r)-e8(e,t,r,"H")==1&&(n+=1)}),2===n}function w7(e,t,r){var n=0;return"C"===X6(t,r)&&3===J6(e,t,r)&&2===e8(e,t,r,"N")&&1===e8(e,t,r,"C")&&r8(e,t,r,function(t,r){J6(e,t,r)-e8(e,t,r,"H")==1&&(n+=1)}),2===n}var A7=new Set(["N","O","S","F","CL","BR","I"]),C7={distanceMax:Ib.Numeric(5,{min:0,max:8,step:.1})},T7={distanceMax:Ib.Numeric(5.5,{min:1,max:8,step:.1}),offsetMax:Ib.Numeric(2,{min:0,max:4,step:.1}),angleDevMax:Ib.Numeric(30,{min:0,max:180,step:1})},P7={distanceMax:Ib.Numeric(6,{min:1,max:8,step:.1}),offsetMax:Ib.Numeric(2,{min:0,max:4,step:.1})},E7=["ARG","HIS","LYS"],M7=["GLU","ASP"];function k7(e,t){var r=C8.get(e).value;if(!r)throw Error("expected valence model to be available");var n=r.get(t.id);if(!n)throw Error("expected valence model for unit to be available");return n}var I7=Cg(),D7=Cg(),O7=Cg(),R7=Cg(),B7=Cg(),N7=Cg();function F7(e,t){var r=t.unit,n=t.feature,i=t.offsets,a=t.members,o=r.elements,s=i[n];return t.unit.conformation.position(o[a[s]],O7),t.unit.conformation.position(o[a[s+1]],R7),t.unit.conformation.position(o[a[s+2]],B7),Cg.triangleNormal(e,O7,R7,B7)}var L7=function(e,t,r){return x8.position(O7,e),x8.position(R7,t),Cg.sub(B7,O7,R7),Cg.projectOnPlane(N7,B7,r),Cg.add(N7,N7,R7),Cg.distance(N7,R7)},$7=Mg(180),U7=Mg(90),j7=Cg(),z7=Cg(),G7=x8.Provider([2],function(e,t,r){for(var n=k7(e,t).charge,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=new Set,l=t.model.atomicHierarchy.atoms.label_comp_id,d=fE.transientSegments(t.model.atomicHierarchy.residueAtomSegments,i);d.hasNext;){var f=d.move(),h=f.index,p=f.start,m=f.end,g=l.value(t.model.atomicHierarchy.residueAtomSegments.offsets[h]);if(M7.includes(g)){r.startState();for(var v=p;v<m;++v)"O"!==X6(t,v)||NN.has(K6(t,v))||r.pushMember(o[i[v]],s[i[v]],u[i[v]],v);r.finishState(2,M8.None)}else if(sF.has(g))for(v=p;v<m;++v)_7(e,t,v)&&(r.startState(),r8(e,t,v,function(e,n){"O"===X6(t,n)&&r.pushMember(o[i[n]],s[i[n]],u[i[n]],n)}),r.finishState(2,M8.Phosphate));else if(!uF.has(g)){for(v=p;v<m;++v){r.startState(),"N"!==X6(t,v)||NN.has(K6(t,v))||r.pushMember(o[i[v]],s[i[v]],u[i[v]],v),r.finishState(2,M8.None);var y=M8.None;y7(e,t,v)?y=M8.SulfonicAcid:_7(e,t,v)?y=M8.Phosphate:b7(e,t,v)?y=M8.Sulfate:x7(e,t,v)&&(y=M8.Carboxylate),y&&(r.startState(),r8(e,t,v,function(e,n){"O"===X6(t,n)&&(c.add(n),r.pushMember(o[i[n]],s[i[n]],u[i[n]],n))}),r.finishState(2,y))}for(v=p;v<m;++v)n[v]<0&&!c.has(v)&&r.add(2,M8.None,o[i[v]],s[i[v]],u[i[v]],v)}}}),V7=x8.Provider([1],function(e,t,r){for(var n=k7(e,t).charge,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=new Set,l=t.model.atomicHierarchy.atoms.label_comp_id,d=fE.transientSegments(t.model.atomicHierarchy.residueAtomSegments,i);d.hasNext;){var f=d.move(),h=f.index,p=f.start,m=f.end,g=l.value(t.model.atomicHierarchy.residueAtomSegments.offsets[h]);if(E7.includes(g)){r.startState();for(var v=p;v<m;++v)"N"!==X6(t,v)||NN.has(K6(t,v))||r.pushMember(o[i[v]],s[i[v]],u[i[v]],v);r.finishState(1,M8.None)}else if(!uF.has(g)){for(c.clear(),v=p;v<m;++v){var y=M8.None;S7(e,t,v)?y=M8.Guanidine:w7(e,t,v)&&(y=M8.Acetamidine),y&&(r.startState(),r8(e,t,v,function(e,n){"N"===X6(t,n)&&(c.add(n),r.pushMember(o[i[n]],s[i[n]],u[i[n]],n))}),r.finishState(1,y))}for(v=p;v<m;++v)n[v]>0&&!c.has(v)&&r.add(1,M8.None,o[i[v]],s[i[v]],u[i[v]],v)}}}),H7=x8.Provider([3],function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=t.rings.aromaticRings;u<c.length;u++){var l=c[u],d=t.rings.all[l];r.startState();for(var f=0,h=d.length;f<h;++f){var p=d[f];r.pushMember(a[n[p]],o[n[p]],s[n[p]],p)}r.finishState(3,M8.None)}}),q7={name:"ionic",params:C7,createTester:function(e){var t=function(e){return{distanceMaxSq:e.distanceMax*e.distanceMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([2,1]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a,o,s=t.types[t.feature];if(o=r.types[r.feature],(2===(a=s)&&1===o||1===a&&2===o)&&function(e,t,r){for(var n=e.feature,i=e.offsets,a=e.members,o=t.feature,s=t.offsets,u=t.members,c=i[n],l=i[n+1];c<l;++c){var d=a[c];e.unit.conformation.position(e.unit.elements[d],I7);for(var f=s[o],h=s[o+1];f<h;++f){var p=u[f];if(t.unit.conformation.position(t.unit.elements[p],D7),Cg.squaredDistance(I7,D7)<r)return!0}}return!1}(t,r,i.distanceMaxSq))return P8.Ionic}(0,r,n,0,t)}}}},W7={name:"pi-stacking",params:T7,createTester:function(e){var t=function(e){return{offsetMax:e.offsetMax,angleDevMax:Mg(e.angleDevMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a,o=t.types[t.feature];if(a=r.types[r.feature],3===o&&3===a){F7(j7,t),F7(z7,r);var s=Cg.angle(j7,z7);if(Math.min(L7(t,r,z7),L7(r,t,j7))<=i.offsetMax&&(s<=i.angleDevMax||s>=$7-i.angleDevMax||s<=i.angleDevMax+U7&&s>=U7-i.angleDevMax))return P8.PiStacking}}(0,r,n,0,t)}}}},X7={name:"cation-pi",params:P7,createTester:function(e){var t=function(e){return{offsetMax:e.offsetMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3,1]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a,o,s=t.types[t.feature];if(o=r.types[r.feature],3===(a=s)&&1===o||1===a&&3===o){var u=3===s?[t,r]:[r,t],c=u[0],l=u[1];if(F7(j7,c),L7(l,c,j7)<=i.offsetMax)return P8.CationPi}}(0,r,n,0,t)}}}},Y7={distanceMax:Ib.Numeric(4,{min:1,max:5,step:.1})},K7=x8.Provider([8],function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=function(i,u){var c=X6(t,i),l=!1;"C"===c?(l=!0,r8(e,t,i,function(e,t){var r=X6(e,t);"C"!==r&&"H"!==r&&(l=!1)})):"F"===c&&(l=!0),l&&r.add(8,M8.None,a[n[i]],o[n[i]],s[n[i]],i)},c=0,l=n.length;c<l;++c)u(c)}),Z7={name:"hydrophobic",params:Y7,createTester:function(e){return{maxDistance:e.distanceMax,requiredFeatures:new Set([8]),getType:function(e,t,r,n){return function(e,t,r){var n=t.types[t.feature];if(i=r.types[r.feature],8===n&&8===i){var i,a=t.members[t.offsets[t.feature]],o=r.members[r.offsets[r.feature]];if("F"!==X6(t.unit,a)||"F"!==X6(r.unit,o))return P8.Hydrophobic}}(0,t,r)}}}},Q7={distanceMax:Ib.Numeric(3,{min:1,max:5,step:.1})},J7=["LI","NA","K","RB","CS","MG","CA","SR","BA","AL","GA","IN","TL","SC","SN","PB","BI","SB","HG"];function e9(e){return!NN.has(e)}function t9(e){return NN.has(e)}function r9(e){return FN.has(e)}function n9(e,t){return 12===e?11===t||12===t:13===e?10===t:void 0}var i9,a9=x8.Provider([13,12],function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=n.length;u<c;++u){var l=X6(t,u),d=0;J7.includes(l)?d=13:(Cq(l)||"ZN"===l||"CD"===l)&&(d=12),d&&r.add(d,M8.None,a[n[u]],o[n[u]],s[n[u]],u)}}),o9=x8.Provider([10,11],function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=n.length;u<c;++u){var l=X6(t,u),d=Q6(t,u),f=K6(t,u),h=!1,p=!1,m=eF.has(d),g=sF.has(d);m||g?m?"O"===l?(["ASP","GLU","SER","THR","TYR","ASN","GLN"].includes(d)&&e9(f)||t9(f))&&(h=!0,p=!0):"S"!==l||"CYS"!==d&&"MET"!==d?"N"===l&&"HIS"===d&&e9(f)&&(h=!0):(h=!0,p=!0):g&&("O"===l&&r9(f)?(h=!0,p=!0):["N3","N4","N7"].includes(f)?h=!0:["O2","O4","O6"].includes(f)&&(h=!0,p=!0)):Aq(l)||"O"===l||"S"===l?(h=!0,p=!0):"N"===l&&(h=!0),h&&r.add(11,M8.None,a[n[u]],o[n[u]],s[n[u]],u),p&&r.add(10,M8.None,a[n[u]],o[n[u]],s[n[u]],u)}}
139),s9={name:"metal-coordination",params:Q7,createTester:function(e){return{maxDistance:e.distanceMax,requiredFeatures:new Set([13,12,10,11]),getType:function(e,t,r,n){return function(e,t,r){var n=t.types[t.feature],i=r.types[r.feature];if(n9(n,i)||n9(i,n))return P8.MetalCoordination}(0,t,r)}}}};function u9(e,t){var r=t.contacts,n=function(e,t,r,n,i){var a=n.get(r)||[1/0,-1],o=a[0],s=a[1];e<o?(-1!==s&&i(s),n.set(r,[e,t])):i(t)};function i(e,t,r,i,a){var o=t.members[t.offsets[t.feature]],s=r.members[r.offsets[r.feature]],u=t.unit.getResidueIndex(o),c=r.unit.getResidueIndex(s),l=`${o}|${t.unit.id}|${c}|${r.unit.id}|A`,d=`${s}|${r.unit.id}|${u}|${t.unit.id}|B`,f=x8.distance(t,r);n(f,e,l,i,a),n(f,e,d,i,a)}var a,o,s=new Map,u=function(e){return r.edges[e].props.flag=T8.Filtered};return{isApplicable:function(e){return e===P8.Hydrophobic},handleInterContact:function(e,t,r){i(e,t,r,s,u)},startUnit:function(e,t,r){a=new Map,o=function(e){return t.edgeProps.flag[e]=T8.Filtered}},handleIntraContact:function(e,t,r){i(e,t,r,a,o)}}}function c9(e,t){var r=t.contacts,n=function(e,n){for(var i=9===e.types[e.feature]?n:e,a=i.members[i.offsets[i.feature]],o=t.unitsContacts.get(i.unit.id),s=o.edgeProps.type,u=o.elementsIndex,c=u.offsets,l=u.indices,d=c[a],f=c[a+1];d<f;++d)if(s[l[d]]===P8.HydrogenBond)return!0;var h=r.getEdgeIndices(i.feature,i.unit.id);for(d=0,f=h.length;d<f;++d)if(r.edges[h[d]].props.type===P8.HydrogenBond)return!0;return!1};return{isApplicable:function(e){return e===P8.WeakHydrogenBond},handleInterContact:function(e,t,i){n(t,i)&&(r.edges[e].props.flag=T8.Filtered)},startUnit:function(){},handleIntraContact:function(e,r,i){n(r,i)&&(t.unitsContacts.get(r.unit.id).edgeProps.flag[e]=T8.Filtered)}}}function l9(e,t,r,n,i){for(var a=r.offsets,o=r.feature,s=n.offsets,u=n.feature,c=a[o],l=a[o+1];c<l;++c)for(var d=r.members[c],f=i.getContactIndicesForElement(d,r.unit),h=0,p=f.length;h<p;++h){var m=f[h];if(e.includes(i.edges[m].props.type))for(var g=s[u],v=s[u+1];g<v;++g){var y=n.members[g];if(i.getContactIndicesForElement(y,n.unit).includes(m))return void(i.edges[t].props.flag=T8.Filtered)}}}function d9(e,t,r,n,i){for(var a=i.edgeProps,o=a.type,s=a.flag,u=i.elementsIndex,c=u.offsets,l=u.indices,d=r.offsets,f=r.feature,h=n.offsets,p=n.feature,m=d[f],g=d[f+1];m<g;++m)for(var v=r.members[m],y=c[v],b=c[v+1];y<b;++y){var _=l[y];if(e.includes(o[_]))for(var x=h[p],S=h[p+1];x<S;++x)for(var w=n.members[x],A=c[w],C=c[w+1];A<C;++A)if(_===l[A])return void(s[t]=T8.Filtered)}}function f9(e,t){var r=t.contacts;return{isApplicable:function(e){return e===P8.Ionic},handleInterContact:function(e,t,n){l9([P8.HydrogenBond,P8.WeakHydrogenBond],e,t,n,r)},startUnit:function(){},handleIntraContact:function(e,r,n){d9([P8.HydrogenBond,P8.WeakHydrogenBond],e,r,n,t.unitsContacts.get(r.unit.id))}}}function h9(e,t){var r=t.contacts;return{isApplicable:function(e){return e===P8.Hydrophobic||e===P8.CationPi},handleInterContact:function(e,t,n){l9([P8.PiStacking],e,t,n,r)},startUnit:function(){},handleIntraContact:function(e,r,n){d9([P8.PiStacking],e,r,n,t.unitsContacts.get(r.unit.id))}}}function p9(e,t){var r=t.contacts;return{isApplicable:function(e){return e===P8.Ionic},handleInterContact:function(e,t,n){l9([P8.MetalCoordination],e,t,n,r)},startUnit:function(){},handleIntraContact:function(e,r,n){d9([P8.MetalCoordination],e,r,n,t.unitsContacts.get(r.unit.id))}}}!function(e){function t(e,t){var r=t.unitA,n=t.indexA,i=t.unitB,a=t.indexB,o=e.contacts,s=e.unitsContacts;if(r===i){var u=s.get(r.id),c=u.getDirectedEdgeIndex(n,a);return O8(u.edgeProps.type[c])}return c=o.getEdgeIndex(n,r.id,a,i.id),O8(o.edges[c].props.type)}function r(e,t,r){var n=e.unitsFeatures;return SM.fromPairProvider(t.length,function(e,r,i){var a=t[e];x8.setPosition(r,a.unitA,a.indexA,n.get(a.unitA.id)),x8.setPosition(i,a.unitB,a.indexB,n.get(a.unitB.id))},r)}function n(e,r,n){var i=n[0];if(void 0===i)return"";var a=i.unitA,o=i.indexA,s=i.unitB,u=i.indexB,c=r.unitsFeatures,l=c.get(a.id),d=l.members,f=l.offsets,h=c.get(s.id),p=h.members,m=h.offsets,g={granularity:"element"};return(f[o+1]-f[o]>1||m[u+1]-m[u]>1)&&(g.granularity="residue"),[t(r,i),XJ(C$.Location(e,a,d[f[o]],e,s,p[m[u]]),g)].join("</br>")}e.Location=function(e,t,r,n,i,a){return XM("interactions",{structure:t,interactions:e},{unitA:r,indexA:n,unitB:i,indexB:a})},e.isLocation=function(e){return!!e&&"data-location"===e.kind&&"interactions"===e.tag},e.areLocationsEqual=function(e,t){return e.data.structure===t.data.structure&&e.data.interactions===t.data.interactions&&e.element.indexA===t.element.indexA&&e.element.indexB===t.element.indexB&&e.element.unitA===t.element.unitA&&e.element.unitB===t.element.unitB},e.locationLabel=function(e){return t(e.data.interactions,e.element)},e.Loci=function(e,t,i){return IQ("interactions",{structure:e,interactions:t},i,function(e){return r(t,i,e)},function(){return n(e,t,i)})},e.isLoci=function(e){return!!e&&"data-loci"===e.kind&&"interactions"===e.tag},e.getBoundingSphere=r,e.getLabel=n}(i9||={});var m9=[h7,p7,m7,G7,V7,H7,J8,e7,K7,a9,o9],g9={ionic:q7,"pi-stacking":W7,"cation-
139pi":X7,"halogen-bonds":t7,"hydrogen-bonds":g7,"weak-hydrogen-bonds":v7,hydrophobic:Z7,"metal-coordination":s9},v9=function(e){void 0===e&&(e=[]);var t=Object.create(null);return Object.keys(g9).forEach(function(r){t[r]=Ib.MappedStatic(e.includes(r)?"on":"off",{on:Ib.Group(g9[r].params),off:Ib.Group({})},{cycle:!0})}),t}(["cation-pi","pi-stacking","hydrogen-bonds","halogen-bonds","metal-coordination"]),y9={providers:Ib.Group(v9,{isFlat:!0}),contacts:Ib.Group(N8,{label:"Advanced Options"})};function b9(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y;return Pc(this,function(b){switch(b.label){case 0:return n=Ac(Ac({},Ib.getDefaultValues(y9)),r),[4,C8.attach(e,t)];case 1:b.sent(),i=[],Fg(g9).forEach(function(e){var t=n.providers[e],r=t.name,a=t.params;"on"===r&&i.push(g9[e].createTester(a))}),a=new Set,i.forEach(function(e){return mN.add(a,e.requiredFeatures)}),o=m9.filter(function(e){return mN.areIntersecting(a,e.types)}),s=mE.Mutable(),u=mE.Mutable(),c=0,l=t.unitSymmetryGroups.length,b.label=2;case 2:return c<l?(d=t.unitSymmetryGroups[c],e.runtime.shouldUpdate?[4,e.runtime.update({message:"computing interactions",current:c,max:l})]:[3,4]):[3,6];case 3:b.sent(),b.label=4;case 4:for(f=function(e,t,r){var n=t.elements.length,i=S8.create(n,n/2);if(tU.isAtomic(t))for(var a=0,o=r;a<o.length;a++)o[a].add(e,t,i);return i.getFeatures(n)}(t,d.units[0],o),h=function(e,t,r,n,i){var a=k8.create(r,t.elements.length);return tU.isAtomic(t)&&function(e,t,r,n,i,a){for(var o=0,s=i;o<s.length;o++)H8(e,t,r,n,s[o],a)}(e,t,r,a,n,i),a.getContacts()}(t,d.units[0],f,i,n.contacts),p=0,m=d.units.length;p<m;++p)g=d.units[p],s.set(g.id,f),u.set(g.id,h);b.label=5;case 5:return++c,[3,2];case 6:return v=function(e,t,r,n){var i=I8.create();return yz.eachUnitPair(e,function(a,o){!function(e,t,r,n,i,a,o,s){var u=r.count,c=r.x,l=r.y,d=r.z,f=i.lookup3d,h=Og.mul(q8,n.conformation.operator.inverse,t.conformation.operator.matrix),p=!Og.isIdentity(h),m=Cg(),g=Math.max.apply(Math,o.map(function(e){return e.maxDistance})),v=f.boundary.sphere,y=v.center,b=v.radius,_=(b+g)*(b+g),x=s.lineOfSightDistFactor,S=x8.Info(e,t,r),w=x8.Info(e,n,i);a.startUnitPair(t,n);for(var A=0;A<u;++A)if(Cg.set(m,c[A],l[A],d[A]),p&&Cg.transformMat4(m,m,h),!(Cg.squaredDistance(m,y)>_)){var C=f.find(m[0],m[1],m[2],g),T=C.indices,P=C.count,E=C.squaredDistances;if(0!==P){S.feature=A;for(var M=0;M<P;++M){var k=T[M];if(w.feature=k,F8(e,S,w))for(var I=E[M],D=0,O=o;D<O.length;D++){var R=O[D];if(I<R.maxDistance*R.maxDistance){var B=R.getType(e,S,w,I);if(B&&V8(e,S,w,x)){a.add(A,k,B);break}}}}}}a.finishUnitPair()}(e,a,t.get(a.id),o,t.get(o.id),i,r,n)},{maxRadius:Math.max.apply(Math,r.map(function(e){return e.maxDistance})),validUnit:function(e){return tU.isAtomic(e)},validUnitPair:function(t,r){return yz.validUnitPair(e,t,r)}}),i.getContacts(t)}(t,s,i,n.contacts),function(e,t){for(var r=t.contacts,n=t.unitsContacts,i=t.unitsFeatures,a=[u9(0,t),c9(0,t),f9(0,t),h9(0,t),p9(0,t)],o=0,s=r.edgeCount;o<s;++o){var u=r.edges[o],c=e.unitMap.get(u.unitA),l=e.unitMap.get(u.unitB);(_=x8.Info(e,c,i.get(u.unitA))).feature=u.indexA,(x=x8.Info(e,l,i.get(u.unitB))).feature=u.indexB;for(var d=0,f=a;d<f.length;d++)(T=f[d]).isApplicable(u.props.type)&&T.handleInterContact(o,_,x)}for(var h=n.keys();;){var p=h.next(),m=p.done,g=p.value;if(m)break;var v=n.get(g),y=i.get(g),b=e.unitMap.get(g);if(tU.isAtomic(b)){for(var _=x8.Info(e,b,y),x=x8.Info(e,b,y),S=0,w=a;S<w.length;S++)(T=w[S]).startUnit(b,v,y);for(o=0,s=2*v.edgeCount;o<s;++o){_.feature=v.a[o],x.feature=v.b[o];for(var A=0,C=a;A<C.length;A++){var T;(T=C[A]).isApplicable(v.edgeProps.type[o])&&T.handleIntraContact(o,_,x)}}}}}(t,y={unitsFeatures:s,unitsContacts:u,contacts:v}),[2,y]}})})}var _9=Ac({},y9),x9=ZU.createProvider({label:"Interactions",descriptor:{name:"molstar_computed_interactions"},type:"local",defaultParams:_9,getParams:function(e){return _9},isApplicable:function(e){return!e.isCoarseGrained},obtain:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=Ac(Ac({},Ib.getDefaultValues(_9)),r),i={},[4,b9(e,t,n)];case 1:return[2,(i.value=a.sent(),i)]}})})}}),S9=tv(13421772),w9=2851770,A9=8421504,C9=4259775,T9=15779860,P9=9191577,E9=16744448,M9=9220966,k9=12967404,I9=[["Hydrogen Bond",w9],["Hydrophobic",A9],["Halogen Bond",C9],["Ionic",T9],["Metal Coordination",P9],["Cation Pi",E9],["Pi Stacking",M9],["Weak HydrogenBond",k9]];function D9(e){switch(e){case P8.HydrogenBond:return w9;case P8.Hydrophobic:return A9;case P8.HalogenBond:return C9;case P8.Ionic:return T9;case P8.MetalCoordination:return P9;case P8.CationPi:return E9;case P8.PiStacking:return M9;case P8.WeakHydrogenBond:return k9;case P8.Unknown:return S9}}var O9={},R9={name:"interaction-type",label:"Interaction Type",category:KZ.Category.Misc,factory:function e(t,r){var n,i=t.structure?x9.get(t.
139structure):void 0,a=i?Tv(i.id,i.version):-1;return n=i&&i.value?function(e){if(i9.isLocation(e)){var t=e.data.interactions,r=t.unitsContacts,n=t.contacts,i=e.element,a=i.unitA,o=i.unitB,s=i.indexA,u=i.indexB;if(a===o){var c=r.get(a.id),l=c.getDirectedEdgeIndex(s,u);return D9(c.edgeProps.type[l])}return l=n.getEdgeIndex(s,a.id,u,o.id),D9(n.edges[l].props.type)}return S9}:function(){return S9},{factory:e,granularity:"group",color:n,props:r,contextHash:a,description:"Assigns colors according the interaction type of a link.",legend:wT(I9)}},getParams:function(e){return O9},defaultValues:Ib.getDefaultValues(O9),isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(e,t){return t.structure?x9.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&x9.ref(e.structure,!1)}}};function B9(e,t,r,n){var i,a,o,s,u=0,c=t.webgl,l=new P_,d=new dJ.GeometryState,f=OB(),h=[],p=Iee.create(),m=gQ.createEmpty();function g(e){if(Iee.update(p,e),void 0!==e.visible&&i&&i.setVisibility(e.visible&&(null===p.unitTransforms||p.unitTransforms.isIdentity)),void 0!==e.alphaFactor&&i&&i.setAlphaFactor(e.alphaFactor),void 0!==e.pickable&&i&&i.setPickable(e.pickable),void 0!==e.overpaint&&i){var t=DQ.remap(e.overpaint,a);i.setOverpaint(t,c)}if(void 0!==e.transparency&&i){var r=OQ.remap(e.transparency,a);i.setTransparency(r,c)}if(void 0!==e.substance&&i){var n=uJ.remap(e.substance,a);i.setSubstance(n,c)}if(void 0!==e.clipping&&i){var o=sJ.remap(e.clipping,a);i.setClipping(o)}void 0!==e.themeStrength&&i&&i.setThemeStrength(e.themeStrength),void 0!==e.transform&&i&&i.setTransform(e.transform),void 0!==e.unitTransforms&&i&&i.setVisibility(p.visible&&(null===e.unitTransforms||e.unitTransforms.isIdentity))}return{label:e,get groupCount(){return i?i.groupCount:0},get props(){return s},get params(){return o},get state(){return p},get theme(){return m},get geometryVersion(){return d.version},renderObjects:h,updated:l,createOrUpdate:function(e,v){var y=this;return void 0===e&&(e={}),v&&v!==a&&(o=r(t,v),a=v,s||=Ib.getDefaultValues(o)),s=Object.assign({},s,e),vy.create("Creating or updating ComplexRepresentation",function(e){return Tc(y,void 0,void 0,function(){var t,r,o;return Pc(this,function(y){switch(y.label){case 0:return t=!1,i?null!=(o=i.mustRecreate)&&o.call(i,a,s,c)&&(i.destroy(),i=n(f,a,s,c),t=!0):(i=n(f,a,s,c),t=!0),(r=i.createOrUpdate({webgl:c,runtime:e},m,s,v))?[4,r]:[3,2];case 1:y.sent(),y.label=2;case 2:return t&&g(p),h.length=0,i&&i.renderObject&&(h.push(i.renderObject),d.add(i.renderObject.id,i.geometryVersion)),d.snapshot(),u+=1,l.next(u),[2]}})})})},setState:g,setTheme:function(e){m=e},getLoci:function(e){return i?i.getLoci(e):EQ},getAllLoci:function(){return[yz.Loci(a.child??a)]},eachLocation:function(e){i?.eachLocation(e)},mark:function(e,t){if(!a||!_Q.is(p.markerActions,t))return!1;if(yz.isLoci(e)||Az.is(e)||C$.isLoci(e)){if(!yz.areRootsEquivalent(e.structure,a))return!1;e=TQ.remap(e,a),(yz.isLoci(e)||Az.is(e)&&Az.isWholeStructure(e))&&(e=AQ)}else if(!CQ(e)&&!kQ(e))return!1;return!TQ.isEmpty(e)&&!!i&&i.mark(e,t)},destroy:function(){i&&i.destroy()}}}function N9(e,t,r){var n=t.elements,i=t.model;if(-1!==kP.indexOf(n,r)){for(var a=i.atomicHierarchy.residueAtomSegments,o=a.index,s=a.offsets,u=o[r],c=[],l=s[u],d=s[u+1];l<d;++l){var f=kP.indexOf(n,l);-1!==f&&c.push(f)}return Az(e,[{unit:t,indices:kP.ofSortedArray(PP.ofSortedArray(c))}])}return EQ}function F9(e,t,r,n){for(var i=t.elements,a=t.model,o=a.atomicHierarchy.atoms.label_alt_id,s=a.atomicHierarchy.residueAtomSegments.offsets,u=[],c=s[r],l=s[r+1];c<l;++c){var d=kP.indexOf(i,c);if(-1!==d){var f=o.value(c);n!==f&&""!==f||u.push(d)}}return Az(e,[{unit:t,indices:kP.ofSortedArray(PP.ofSortedArray(u))}])}function L9(e,t,r){for(var n=e.structure.child,i=t&&n?e.group.units.filter(function(e){return n.unitMap.has(e.id)}):e.group.units,a=i.length,o=16*a,s=r&&r.aTransform.ref.value.length>=o?r.aTransform.ref.value:new Float32Array(o),u=0;u<a;u++)Og.toArray(i[u].conformation.operator.matrix,s,16*u);return II(s,a,r)}var $9=Ib.objectToOptions({atomic:{},spheres:{},gaussians:{}}),U9=5e8;function j9(e,t,r){void 0===r&&(r=U9);var n=YE.size(Cg(),e);Cg.ceil(n,n),n.sort(function(e,t){return t-e});var i=Math.floor(Math.cbrt(r)*Math.cbrt(r)),a=n[0]*n[1];return{area:a,areaCells:Math.ceil(a/(t*t)),maxAreaCells:i}}function z9(e,t,r){void 0===r&&(r=U9);var n=j9(e,t.resolution,r),i=n.area,a=n.areaCells,o=n.maxAreaCells,s=a>o?Math.sqrt(i/o):t.resolution;return Ac(Ac({},t),{resolution:s})}var G9={ignoreHydrogens:Ib.Boolean(!1,{description:"Whether or not to include hydrogen atoms in the surface calculation."}),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),traceOnly:Ib.Boolean(!1,{description:"Whether or not to only use trace atoms in the surface calculation."}),includeParent:Ib.Boolean(!1,{description:"Include elements of the parent structure in surface calculation to get a surface patch of the current structure."})};Ib.getDefaultValues(G9);var V9=Cg();function H9(e,t,r,n){return Cg.squaredDistance(Cg.set(V9,e,t,r),n)}function q9(e,t,r,n){var i,a,o=n.ignoreHydrogens,s=n.ignoreHydrogensVariant,u=n.traceOnly,c=n.includeParent,l=c?e.root.unitMap.get(t.id):t,d=c&&l!==t,f=function(e){switch(e.kind){case 0:return e.model.atomicConformation;case 1:return e.model.coarseConformation.spheres;case 2:return e.model.coarseConformation.gaussians}}(l),h=f.x,p=f.y,m=f.z,g=l.elements,v=t.boundary.sphere,y=v.center,b=v.radiu
139s,_=(b+11)*(b+11);if(o||u||d){for(var x=[],S=[],w=0,A=g.length;w<A;++w){var C=g[w];o&&Y9(e,l,C,s)||u&&!Z9(l,C)||d&&H9(h[C],p[C],m[C],y)>_||(x.push(C),S.push(w))}i=PP.ofSortedArray(x),a=S}else i=g,a=zb(new Int32Array(i.length));c&&l!==t&&function(e,t,r){for(var n=0,i=t.length,a=0,o=r.length;a<o;++a){var s=PP.indexOfInRange(t,r[a],n,i);-1===s?e[a]=-2:(e[a]=s,n=s)}}(a,t.elements,i);var T={indices:i,x:h,y:p,z:m,id:a},P=d?eU(T):t.boundary,E=qF.create(e,l);return{position:T,boundary:P,radius:function(e){return E.element=e,r.size(E)}}}function W9(e,t,r){var n,i,a,o,s,u,c=r.ignoreHydrogens,l=r.ignoreHydrogensVariant,d=r.traceOnly,f=r.includeParent&&!!e.parent,h=qF.create(e.root),p=e.boundary.sphere,m=p.center,g=p.radius,v=(g+11)*(g+11);if(c||d||f){for(var y=e.serialMapping.getSerialIndex,b=f?e.root.units:e.units,_=[],x=[],S=[],w=[],A=[],C=0,T=b.length;C<T;++C){var P=(j=b[C]).elements,E=j.conformation,M=E.x,k=E.y,I=E.z,D=e.unitMap.get(j.id);h.unit=j;for(var O=0,R=P.length;O<R;++O){var B=P[O];if((!c||!Y9(e,j,B,l))&&(!d||Z9(j,B))){var N=M(B),F=k(B),L=I(B);f&&H9(N,F,L,m)>v||(_.push(N),x.push(F),S.push(L),h.element=B,w.push(t.size(h)),f?-1===(D?PP.indexOf(D.elements,B):-1)?A.push(-2):A.push(y(D,B)):A.push(y(j,B)))}}}n=_,i=x,a=S,o=w,s=A,u=kP.ofRange(0,s.length)}else{var $=e.elementCount,U=(_=new Float32Array($),x=new Float32Array($),S=new Float32Array($),w=new Float32Array($),C=0,0);for(T=e.units.length;C<T;++C){P=(j=e.units[C]).elements;var j,z=j.conformation;for(M=z.x,k=z.y,I=z.z,h.unit=j,O=0,R=P.length;O<R;++O){B=P[O];var G=U+O;_[G]=M(B),x[G]=k(B),S[G]=I(B),h.element=B,w[G]=t.size(h)}U+=P.length}n=_,i=x,a=S,o=w,s=zb(new Uint32Array($)),u=kP.ofRange(0,s.length)}var V={indices:u,x:n,y:i,z:a,id:s};return{position:V,boundary:f?eU(V):e.boundary,radius:function(e){return o[e]}}}var X9=FU.H;function Y9(e,t,r,n){if(tU.isCoarse(t)||t.model.atomicHierarchy.derived.atom.atomicNumber[r]!==X9)return!1;if("all"===n)return!0;var i=function(e,t,r){var n=!1;return r8(e,t,r,function(e,t){var r=X6(e,t);A7.has(r)&&(n=!0)}),n}(e,t,PP.indexOf(t.elements,r));return!(!i||"polar"!==n)||!i&&"non-polar"===n}function K9(e,t){return e[t]===X9}function Z9(e,t){if(tU.isCoarse(e))return!0;var r=e.model.atomicHierarchy.atoms.label_atom_id.value(t);return"CA"===r||"BB"===r||"P"===r}function Q9(e){return Ib.MultiSelect(e,$9,{description:"For which kinds of units/chains to show the representation visuals."})}var J9={unitKinds:Q9(["atomic","spheres"]),includeParent:Ib.Boolean(!1,{isHidden:!0})},eee=Ac({},sD.Params),tee=Ac({},xR.Params),ree=Ac({},uB.Params),nee=Ac({},BO.Params),iee=Ac({},qO.Params),aee=Ac({},UO.Params),oee=Ac({},_R.Params),see=Ac({},SR.Params);function uee(e,t){var r,n,i,a,o,s,u,c,l=e.defaultProps,d=e.createGeometry,f=e.createLocationIterator,h=e.getLoci,p=e.eachLocation,m=e.setUpdateState,g=e.mustRecreate,v=e.processValues,y=e.dispose,b=e.geometryUtils,_=b.updateValues,x=b.updateBoundingSphere,S=b.updateRenderableState,w=b.createPositionIterator,A=PQ.create(),C={loci:EQ,action:bQ.None,status:-1},T=Object.assign({},l),P=gQ.createEmpty(),E=-1;function M(e){if(A.createNew){if(u=f(a),!e)throw Error("expected geometry to be given");r=function(e,t,r,n,i,a){var o=cB.getUtils(t),s=o.createValues,u=o.createRenderableState,c=s(t,OI(),r,n,i),l=u(i);return RB(t.kind,c,l,a)}(0,e,u,i,n,t),c=w(e,r.values)}else{if(!r)throw Error("expected renderObject to be available");if(A.updateTransform){var l=(u=f(a)).instanceCount,d=u.groupCount;n.instanceGranularity?qM(l,"instance",r.values):qM(l*d,"groupInstance",r.values)}if(A.createGeometry){if(!e)throw Error("expected geometry to be given");tf.updateIfChanged(r.values.drawCount,cB.getDrawCount(e)),tf.updateIfChanged(r.values.uVertexCount,cB.getVertexCount(e)),tf.updateIfChanged(r.values.uGroupCount,cB.getGroupCount(e))}(A.updateTransform||A.createGeometry)&&(x(r.values,e||s),c=w(s,r.values)),A.updateSize&&"uSize"in r.values&&DO(u,i.size,r.values),A.updateColor&&CI(u,c,i.color,r.values),_(r.values,n),S(r.state,n)}T=n,P=i,o=a,e&&(s=e,E+=1)}function k(e,t,r){return function(e){return!!CQ(e)||!(!yz.isLoci(e)||!yz.areRootsEquivalent(e.structure,o))||!!(Az.is(e)&&yz.areRootsEquivalent(e.structure,o)&&Az.isWholeStructure(e))}(e)?T.instanceGranularity?t($T.ofBounds(0,u.instanceCount)):t($T.ofBounds(0,u.groupCount*u.instanceCount)):T.instanceGranularity?function(e,t,r){var n=!1;return!(!Az.is(e)&&!C$.isLoci(e))&&!!yz.areEquivalent(e.structure,t)&&(r($T.ofSingleton(0))&&(n=!0),n)}(e,o,t):p(e,o,t,r)}function I(e){r&&v?.(r.values,s,T,P,e.webgl)}return{get groupCount(){return u?u.count:0},get renderObject(){return u&&u.count?r:void 0},get geometryVersion(){return E},createOrUpdate:function(e,t,u,c){if(void 0===u&&(u={}),function(e,t,s){if(!s&&!o)throw Error("missing structure");
139if(n=Object.assign({},T,t),i=e,a=s,PQ.reset(A),!r||!o)return A.createNew=!0,void(A.createGeometry=!0);m(A,n,T,i,P,a,o),yz.areEquivalent(a,o)||(A.createGeometry=!0),yz.areHierarchiesEqual(a,o)||(A.updateTransform=!0,A.createGeometry=!0),KZ.areEqual(e.color,P.color)||(A.updateColor=!0),cf(n.unitKinds,T.unitKinds)||(A.createGeometry=!0),o.child!==a.child&&(A.createGeometry=!0),n.instanceGranularity!==T.instanceGranularity&&(A.updateTransform=!0),A.updateSize&&!("uSize"in r.values)&&(A.createGeometry=!0),A.createGeometry&&(A.updateColor=!0,A.updateSize=!0)}(t,u,c||o),A.createGeometry){var l=d(e,a,i,n,s);if($g(l))return l.then(function(t){M(t),I(e)});M(l)}else M();I(e)},getLoci:function(e){return r?h(e,o,r.id):EQ},eachLocation:function(e){for(u.reset();u.hasNext;){var t=u.move();e(t.location,t.isSecondary)}},mark:function(e,t){return tJ.mark(r,e,t,k,C)},setVisibility:function(e){tJ.setVisibility(r,e)},setAlphaFactor:function(e){tJ.setAlphaFactor(r,e)},setPickable:function(e){tJ.setPickable(r,e)},setColorOnly:function(e){tJ.setColorOnly(r,e)},setTransform:function(e,t){tJ.setTransform(r,e,t)},setOverpaint:function(e,t){var n={geometry:s,props:T,webgl:t};tJ.setOverpaint(r,e,k,!0,n)},setTransparency:function(e,t){var n={geometry:s,props:T,webgl:t};tJ.setTransparency(r,e,k,!0,n)},setSubstance:function(e,t){var n={geometry:s,props:T,webgl:t};tJ.setSubstance(r,e,k,!0,n)},setClipping:function(e){tJ.setClipping(r,e,k,!0)},setThemeStrength:function(e){tJ.setThemeStrength(r,e)},destroy:function(){y?.(s),r&&=void(r.state.disposed=!0)},mustRecreate:g}}var cee=Ac(Ac({},eee),J9);function lee(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:sD.Utils}),t)}var dee=Ac(Ac({},tee),J9),fee=Ac(Ac({},ree),J9),hee=Ac(Ac({},iee),J9),pee=Ac(Ac({},aee),J9),mee=Ac(Ac({},oee),J9),gee=Ac(Ac({},see),J9);function vee(e,t,r,n){var i,a,o,s,u=0,c=t.webgl,l=new P_,d=OB(),f=[],h=new dJ.GeometryState,p=Iee.create(),m=new Map,g=gQ.createEmpty();function v(e,t,r){var n=r.visible,i=r.alphaFactor,a=r.pickable,o=r.overpaint,s=r.transparency,u=r.substance,l=r.clipping,d=r.themeStrength,f=r.transform,h=r.unitTransforms;void 0!==n&&e.setVisibility(n),void 0!==i&&e.setAlphaFactor(i),void 0!==a&&e.setPickable(a),void 0!==o&&e.setOverpaint(o,c),void 0!==s&&e.setTransparency(s,c),void 0!==u&&e.setSubstance(u,c),void 0!==l&&e.setClipping(l),void 0!==d&&e.setThemeStrength(d),void 0!==f&&(f===p.transform&&Og.areEqual(f,p.transform,vg)||e.setTransform(f)),void 0!==h&&(h?e.setTransform(void 0,h.getSymmetryGroupTransforms(t)):h!==p.unitTransforms&&e.setTransform(void 0,null))}return{label:e,get groupCount(){var e=0;return m.forEach(function(t){var r=t.visual;r.renderObject&&(e+=r.groupCount)}),e},get geometryVersion(){return h.version},get props(){return s},get params(){return o},get state(){return p},get theme(){return g},renderObjects:f,updated:l,createOrUpdate:function(e,y){var b=this;return void 0===e&&(e={}),y&&y!==i&&(o=r(t,y),s||=Ib.getDefaultValues(o)),s=Object.assign({},s,e),vy.create("Creating or updating UnitsRepresentation",function(e){return Tc(b,void 0,void 0,function(){var r,o,b,_,x,S,w,A,C,T;return Pc(this,function(P){switch(P.label){case 0:if(i||y)return[3,1];throw Error("missing structure");case 1:if(!y||i)return[3,8];a=y.unitSymmetryGroups,x=0,P.label=2;case 2:return x<a.length?(C=a[x],A=n(d,y,s,c),(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:y}))?[4,T]:[3,4]):[3,7];case 3:P.sent(),P.label=4;case 4:return v(A,C,p),m.set(C.hashCode,{visual:A,group:C}),e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:x,max:a.length})]:[3,6];case 5:P.sent(),P.label=6;case 6:return x++,[3,2];case 7:return[3,43];case 8:if(!y||yz.areUnitIdsAndIndicesEqual(y,i)&&y.child===i.child)return[3,22];a=y.unitSymmetryGroups,r=m,m=new Map,x=0,P.label=9;case 9:return x<a.length?(C=a[x],(b=r.get(C.hashCode))?(A=b.visual,A.mustRecreate?.call(A,{group:C,structure:y},s,c)?(A.destroy(),A=n(d,y,s,c),(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:y}))?[4,T]:[3,11]):[3,12]):[3,15]):[3,21];case 10:P.sent(),P.label=11;case 11:return v(A,C,p),[3,14];case 12:return(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:y}))?[4,T]:[3,14];case 13:P.sent(),P.label=14;case 14:return m.set(C.hashCode,{visual:A,group:C}
139),r.delete(C.hashCode),A.renderObject&&wQ(o=A.renderObject.values.tMarker.ref.value.array,$T.ofBounds(0,o.length),bQ.RemoveHighlight),[3,18];case 15:return A=n(d,y,s,c),(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:y}))?[4,T]:[3,17];case 16:P.sent(),P.label=17;case 17:v(A,C,p),m.set(C.hashCode,{visual:A,group:C}),P.label=18;case 18:return e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:x,max:a.length})]:[3,20];case 19:P.sent(),P.label=20;case 20:return x++,[3,9];case 21:return r.forEach(function(e){e.visual.destroy()}),[3,43];case 22:if(!y||y===i||!yz.areUnitIdsAndIndicesEqual(y,i))return[3,34];a=y.unitSymmetryGroups,x=0,P.label=23;case 23:return x<a.length?(C=a[x],(b=m.get(C.hashCode))?(A=b.visual,A.mustRecreate?.call(A,{group:C,structure:y},s,t.webgl)?(A.destroy(),A=n(d,y,s,t.webgl),b.visual=A,(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:y}))?[4,T]:[3,25]):[3,26]):[3,29]):[3,33];case 24:P.sent(),P.label=25;case 25:return v(A,C,p),[3,28];case 26:return(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:y}))?[4,T]:[3,28];case 27:P.sent(),P.label=28;case 28:return b.group=C,[3,30];case 29:throw Error(`expected to find visual for hashCode ${C.hashCode}`);case 30:return e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:x,max:a.length})]:[3,32];case 31:P.sent(),P.label=32;case 32:return x++,[3,23];case 33:return[3,43];case 34:_=[],m.forEach(function(e){return _.push(e)}),x=0,S=_.length,P.label=35;case 35:return x<S?(w=_[x],A=w.visual,C=w.group,A.mustRecreate?.call(A,{group:C,structure:i},s,t.webgl)?(A.destroy(),A=n(d,i,s,c),_[x].visual=A,(T=A.createOrUpdate({webgl:c,runtime:e},g,s,{group:C,structure:i}))?[4,T]:[3,37]):[3,38]):[3,43];case 36:P.sent(),P.label=37;case 37:return v(A,C,p),[3,40];case 38:return(T=A.createOrUpdate({webgl:c,runtime:e},g,s))?[4,T]:[3,40];case 39:P.sent(),P.label=40;case 40:return e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:x,max:S})]:[3,42];case 41:P.sent(),P.label=42;case 42:return++x,[3,35];case 43:return f.length=0,m.forEach(function(e){var t=e.visual;t.renderObject&&(f.push(t.renderObject),h.add(t.renderObject.id,t.geometryVersion))}),h.snapshot(),y&&(i=y),l.next(u++),[2]}})})})},setState:function(e){var t=e.visible,r=e.alphaFactor,n=e.pickable,a=e.overpaint,o=e.transparency,s=e.substance,u=e.clipping,c=e.themeStrength,l=e.transform,d=e.unitTransforms,f=e.syncManually,h=e.markerActions,g={};void 0!==t&&(g.visible=t),void 0!==r&&(g.alphaFactor=r),void 0!==n&&(g.pickable=n),void 0!==a&&i&&(g.overpaint=DQ.remap(a,i)),void 0!==o&&i&&(g.transparency=OQ.remap(o,i)),void 0!==s&&i&&(g.substance=uJ.remap(s,i)),void 0!==u&&i&&(g.clipping=sJ.remap(u,i)),void 0!==c&&(g.themeStrength=c),void 0===l||Og.areEqual(l,p.transform,vg)||(g.transform=l),d===p.unitTransforms&&d?.version===p.unitTransformsVersion||(g.unitTransforms=d,p.unitTransformsVersion=d?d?.version:-1),void 0!==f&&(g.syncManually=f),void 0!==h&&(g.markerActions=h),m.forEach(function(e){return v(e.visual,e.group,g)}),Iee.update(p,g)},setTheme:function(e){g=e},getLoci:function(e){var t=EQ;return m.forEach(function(r){var n=r.visual.getLoci(e);MQ(n)||(t=n)}),t},getAllLoci:function(){return[yz.Loci(i.child??i)]},eachLocation:function(e){m.forEach(function(t){t.visual.eachLocation(e)})},mark:function(e,t){if(!i||!_Q.is(p.markerActions,t))return!1;if(yz.isLoci(e)||Az.is(e)||C$.isLoci(e)){if(!yz.areRootsEquivalent(e.structure,i))return!1;e=TQ.remap(e,i),(yz.isLoci(e)||Az.is(e)&&Az.isWholeStructure(e))&&(e=AQ)}else if(!CQ(e)&&!kQ(e))return!1;if(TQ.isEmpty(e))return!1;var r=!1;return m.forEach(function(n){r=n.visual.mark(e,t)||r}),r},destroy:function(){m.forEach(function(e){return e.visual.destroy()}),m.clear()}}}function yee(e,t){var r,n,i,a,o,s,u,c,l=e.defaultProps,d=e.createGeometry,f=e.createLocationIterator,h=e.getLoci,p=e.eachLocation,m=e.setUpdateState,g=e.mustRecreate,v=e.processValues,y=e.dispose,b=e.geometryUtils,_=b.createEmpty,x=b.updateValues,S=b.updateBoundingSphere,w=b.updateRenderableState,A=b.createPositionIterator,C=PQ.create(),T={loci:EQ,action:bQ.None,status:-1},P=Object.assign({}
139,l),E=gQ.createEmpty(),M=-1;function k(e){if(C.createNew){if(u=f(n),!e)throw Error("expected geometry to be given");r=function(e,t,r,n,i,a){var o=cB.getUtils(t),s=o.createValues,u=o.createRenderableState,c=s(t,L9(e,i.includeParent),r,n,i),l=u(i);return RB(t.kind,c,l,a)}(n,e,u,E,P,t),c=A(e,r.values)}else{if(!r)throw Error("expected renderObject to be available");if(C.updateTransform){var l=(u=f(n)).instanceCount,d=u.groupCount;P.instanceGranularity?qM(l,"instance",r.values):qM(l*d,"groupInstance",r.values)}if(C.updateMatrix&&L9(n,P.includeParent,r.values),C.createGeometry){if(!e)throw Error("expected geometry to be given");tf.updateIfChanged(r.values.drawCount,cB.getDrawCount(e)),tf.updateIfChanged(r.values.uVertexCount,cB.getVertexCount(e)),tf.updateIfChanged(r.values.uGroupCount,cB.getGroupCount(e))}(C.updateTransform||C.createGeometry)&&(S(r.values,e||s),c=A(e||s,r.values)),C.updateSize&&"uSize"in r.values&&DO(u,E.size,r.values),C.updateColor&&CI(u,c,E.color,r.values),x(r.values,P),w(r.state,P)}i=P,a=E,o=n,e&&(s=e,M+=1)}function I(e,t,r){return function(e){return!!CQ(e)||!(!yz.isLoci(e)||!yz.areRootsEquivalent(e.structure,o.structure))||!!(Az.is(e)&&yz.areRootsEquivalent(e.structure,o.structure)&&Az.isWholeStructure(e))}(e)?i.instanceGranularity?t($T.ofBounds(0,u.instanceCount)):t($T.ofBounds(0,u.groupCount*u.instanceCount)):i.instanceGranularity?function(e,t,r){var n=!1;if(C$.isLoci(e)){var i=t.structure,a=t.group;if(!yz.areEquivalent(e.structure,i))return!1;for(var o=0,s=e.bonds;o<s.length;o++){var u=s[o];u.aUnit===u.bUnit&&void 0!==(d=a.unitIndexMap.get(u.aUnit.id))&&r($T.ofSingleton(d))&&(n=!0)}}else if(Az.is(e)){if(i=t.structure,a=t.group,!yz.areEquivalent(e.structure,i))return!1;for(var c=0,l=e.elements;c<l.length;c++){var d,f=l[c];void 0!==(d=a.unitIndexMap.get(f.unit.id))&&r($T.ofSingleton(d))&&(n=!0)}}return n}(e,o,t):p(e,o,t,r)}function D(e){r&&v?.(r.values,s,i,a,e.webgl)}return{get groupCount(){return u?u.count:0},get renderObject(){return u&&u.count?r:void 0},get geometryVersion(){return M},createOrUpdate:function(e,t,u,c){if(function(e,t,s){if(!s&&!o)throw Error("missing structureGroup");if(P=t,E=e,n=s,PQ.reset(C),!r||!o)return C.createNew=!0,void(C.createGeometry=!0);m(C,P,i,E,a,n,o),yz.areHierarchiesEqual(o.structure,n.structure)||(C.updateTransform=!0,C.updateColor=!0,C.updateSize=!0),KZ.areEqual(E.color,a.color)||(C.updateColor=!0),o.structure.child!==n.structure.child&&(C.createGeometry=!0),P.instanceGranularity!==i.instanceGranularity&&(C.updateTransform=!0),cf(P.unitKinds,i.unitKinds)||(C.createGeometry=!0),n.group.transformHash!==o.group.transformHash&&(n.group.units.length!==o.group.units.length||C.updateColor?C.updateTransform=!0:C.updateMatrix=!0);var u=n.group.units[0],c=o.group.units[0];tU.areOperatorsEqual(u,c)||(C.updateTransform=!0),tU.areConformationsEqual(u,c)||(C.createGeometry=!0),C.updateTransform&&(C.updateMatrix=!0),C.updateSize&&!("uSize"in r.values)&&(C.createGeometry=!0),(C.createGeometry||C.updateTransform)&&(o.structure.hashCode!==n.structure.hashCode&&(C.updateColor=!0,C.updateSize=!0),(E.color.granularity.startsWith("vertex")||r.values.dColorType.ref.value.startsWith("vertex")||E.color.granularity.startsWith("volume")||r.values.dColorType.ref.value.startsWith("volume"))&&(C.updateColor=!0))}(t,u,c||o),C.createGeometry){var l=function(e,t,r,n,i,a){return function(e,t){for(var r=0,n=e.length;r<n;++r)if(tU.isAtomic(t)&&"atomic"===e[r]||tU.isSpheres(t)&&"spheres"===e[r]||tU.isGaussians(t)&&"gaussians"===e[r])return!0;return!1}(i.unitKinds,t)?d(e,t,r,n,i,a):_(a)}(e,n.group.units[0],n.structure,E,P,s);if($g(l))return l.then(function(t){k(t),D(e)});k(l)}else k();D(e)},getLoci:function(e){return r?h(e,o,r.id):EQ},eachLocation:function(e){for(u.reset();u.hasNext;){var t=u.move();e(t.location,t.isSecondary)}},mark:function(e,t){var n=!0;if(Az.is(e)){n=!1;for(var i=o.group.units[0].invariantId,a=0,s=e.elements;a<s.length;a++)if(s[a].unit.invariantId===i){n=!0;break}}return!!n&&tJ.mark(r,e,t,I,T)},setVisibility:function(e){tJ.setVisibility(r,e)},setAlphaFactor:function(e){tJ.setAlphaFactor(r,e)},setPickable:function(e){tJ.setPickable(r,e)},setColorOnly:function(e){tJ.setColorOnly(r,e)},setTransform:function(e,t){tJ.setTransform(r,e,t)},setOverpaint:function(e,t){var n={geometry:s,props:i,webgl:t};tJ.setOverpaint(r,e,I,!0,n)},setTransparency:function(e,t){var n={geometry:s,props:i,webgl:t};tJ.setTransparency(r,e,I,!0,n)},setSubstance:function(e,t){var n={geometry:s,props:i,webgl:t};tJ.setSubstance(r,e,I,!0,n)},setClipping:function(e){tJ.setClipping(r,e,I,!0)},setThemeStrength:function(e){tJ.setThemeStrength(r,e)},destroy:function(){y?.(s),r&&=void(r.state.disposed=!0)},mustRecreate:g}}var bee=Ac(Ac({},eee),J9);function _ee(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:sD.Utils}),t)}var xee=Ac(Ac({},tee),J9);function See(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:xR.Utils}),t)}var wee=Ac(Ac({},ree),J9);function Aee(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:uB.Utils}),t)}var Cee=Ac(Ac({},nee),J9),Tee=Ac(Ac({},iee),J9);function Pee(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:qO.Utils}),t)}Ac(Ac({},aee),J9);var Eee,Mee=Ac(Ac({},oee),J9),kee=Ac(Ac({},see),J9),Iee={create:function(){return Ac(Ac({},dJ.createState()),{unitTransforms:null,unitTransformsVersion:-1})},update:function(e,t){dJ.updateState(e,t),void 0!==t.unitTransforms&&(e.unitTransforms=t.unitTransforms)}},Dee=Cg(),Oee=Cg(),Ree=Cg(),Bee=iv.add,Nee=iv.add3;!function(e){e.create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=iv.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e),i=iv.create(Float32Array,3,t,r?r.startBuffer.ref.value:e),a=iv.create(Float32Array,3,t,r?r.endBuffer.ref.value:e),o=iv.create(Float32Array,1,t,r?r.scaleBuffer.ref.value:e),s=iv.create(Float32Array,1,t,r?r.capBuffer.ref.value:e),u=function(e,t,r,u,c,l,d,f,h,p){for(var m=0;m<6;++m)Nee(i,e,t,r),Nee(a,u,c,l),Bee(n,p),Bee(o,d),Bee(s,+!!f+(h?2:0))},c=function(e,t,r,n,i,a,o,s){var c=Cg.distance(e,t),l=r%2!=0,d=Math.floor((r+1)/2),f=c/(r+.5);Cg.setMagnitude(Ree,Cg.sub(Ree,t,e),f),Cg.copy(Dee,e);for(var h=0;h<d;++h)Cg.add(Dee,Dee,Ree),l&&h===d-1?(Cg.copy(Oee,t),o||(a=!1)):Cg.add(Oee,Dee,Ree),u(Dee[0],Dee[1],Dee[2],Oee[0],Oee[1],Oee[2],n,i,a,s),Cg.add(Dee,Dee,Ree)};return{add:u,addFixedCountDashes:c,addFixedLengthDashes:function(e,t,r,n,i,a,o){c(e,t,Cg.distance(e,t)/r,n,i,a,!0,o)},getCylinders:function(){var e=n.elementCount/6,t=iv.compact(n,!0),u=iv.compact(i,!0),c=iv.compact(a,!0),l=iv.compact(o,!0),d=iv.compact(s,!0),f=r&&e<=r.cylinderCount?r.mappingBuffer.ref.value:new Float32Array(18*e),h=r&&e<=r.cylinderCount?r.indexBuffer.ref.value:new Uint32Array(12*e);return(!r||e>r.cylinderCount)&&function(e,t,r){for(var n=0;n<e;++n){var i=18*n;t[i]=-1,t[i+1]=1,t[i+2]=-1,t[i+3]=-1,t[i+4]=-1,t[i+5]=-1,t[i+6]=1,t[i+7]=1,t[i+8]=-1,t[i+9]=1,t[i+10]=1,t[i+11]=1,t[i+12]=1,t[i+13]=-1,t[i+14]=-1,t[i+15]=1,t[i+16]=-1,t[i+17]=1}for(n=0;n<e;++n){var a=6*n,o=12*n;r[o]=a,r[o+1]=a+1,r[o+2]=a+2,r[o+3]=a+1,r[o+4]=a+4,r[o+5]=a+2,r[o+6]=a+2,r[o+7]=a+4,r[o+8]=a+3,r[o+9]=a+4,r[o+10]=a+5,r[o+11]=a+3}}(e,f,h),uB.create(f,h,t,u,c,l,d,e,r)}}}}(Eee||={});
139var Fee={linkScale:Ib.Numeric(.45,{min:0,max:1,step:.01}),linkSpacing:Ib.Numeric(1,{min:0,max:2,step:.01}),linkCap:Ib.Boolean(!1),aromaticScale:Ib.Numeric(.3,{min:0,max:1,step:.01}),aromaticSpacing:Ib.Numeric(1.5,{min:0,max:3,step:.01}),aromaticDashCount:Ib.Numeric(2,{min:1,max:6,step:1}),dashCount:Ib.Numeric(4,{min:0,max:10,step:1}),dashScale:Ib.Numeric(.8,{min:0,max:2,step:.1}),dashCap:Ib.Boolean(!0),stubCap:Ib.Boolean(!0),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo)};Ib.getDefaultValues(Fee);var Lee={linkScale:Ib.Numeric(.5,{min:0,max:1,step:.1}),linkSpacing:Ib.Numeric(.1,{min:0,max:2,step:.01}),aromaticDashCount:Ib.Numeric(2,{min:1,max:6,step:1}),dashCount:Ib.Numeric(4,{min:0,max:10,step:1})};Ib.getDefaultValues(Lee);var $ee=Cg(),Uee=Cg(),jee=Cg(),zee=Cg.create(0,1,0);function Gee(e,t,r,n){Cg.normalize(Uee,Cg.sub(Uee,t,r)),null===n?Cg.copy(jee,t):Cg.sub(jee,t,n),Cg.normalize(jee,jee);var i=Cg.dot(Uee,jee);return 1-Math.abs(i)<1e-5&&(Cg.set(jee,1,0,0),i=Cg.dot(Uee,jee),1-Math.abs(i)<1e-5&&(Cg.set(jee,0,1,0),i=Cg.dot(Uee,jee))),Cg.setMagnitude(Uee,Uee,i),Cg.sub(jee,jee,Uee),Cg.normalize(e,jee)}var Vee=Cg.scale,Hee=Cg.add,qee=Cg.sub,Wee=Cg.setMagnitude,Xee=Cg.dot;function Yee(e,t,r,n){var i=t.linkCount,a=t.referencePosition,o=t.position,s=t.style,u=t.radius,c=t.ignore,l=t.stub;if(!i)return{mesh:sD.createEmpty(n)};for(var d=r.linkScale,f=r.linkSpacing,h=r.radialSegments,p=r.linkCap,m=r.aromaticScale,g=r.aromaticSpacing,v=r.aromaticDashCount,y=r.dashCount,b=r.dashScale,_=r.dashCap,x=r.stubCap,S=2*h*i*2,w=dO.createState(S,S/4,n),A=Cg(),C=Cg(),T=Cg(),P=Cg(),E=0,M={radiusTop:1,radiusBottom:1,radialSegments:h,topCap:p,bottomCap:p},k=0,I=i;k<I;++k)if(!c||!c(k)){o(A,C,k),Hee(P,P,A),Hee(P,P,C),E+=2,qee($ee,C,A);var D=Xee($ee,zee)>0,O=u(k),R=s?s(k):0,B=x&&!!l&&l(k),N=D?[B,p]:[p,B],F=N[0],L=N[1];if(w.currentGroup=k,0===R)M.radiusTop=M.radiusBottom=O,M.topCap=F,M.bottomCap=L,uO(w,A,C,.5,M);else if(1===R)M.radiusTop=M.radiusBottom=O*b,M.topCap=M.bottomCap=_,lO(w,A,C,.5,y,B,M);else if(2===R||3===R||4===R||5===R||7===R||8===R){var $=2===R||3===R?2:4===R||5===R?3:1.5,U=O*(d/(.5*$)),j=(O-U)*f;if(Gee(T,A,C,a?a(k):null),M.topCap=F,M.bottomCap=L,7===R||8===R){M.radiusTop=M.radiusBottom=O,uO(w,A,C,.5,M);var z=O+m*O+m*O*g;Wee($ee,qee($ee,C,A),.5*O),Hee(A,A,$ee),qee(C,C,$ee),M.radiusTop=M.radiusBottom=O*m,M.topCap=M.bottomCap=_,Wee(T,T,z),qee(A,A,T),qee(C,C,T),lO(w,A,C,.5,v,B,M),8===R&&(Wee(T,T,2*z),Hee(A,A,T),Hee(C,C,T),lO(w,A,C,.5,v,B,M))}else if(3===R||5===R){var G=O+U+d*O*f;Wee(T,T,G),M.radiusTop=M.radiusBottom=O,uO(w,A,C,.5,M),Vee($ee,$ee,f*d*.2),Hee(A,A,$ee),qee(C,C,$ee),M.radiusTop=M.radiusBottom=U,M.topCap=D?B:_,M.bottomCap=D?_:B,Wee(T,T,G),qee(A,A,T),qee(C,C,T),uO(w,A,C,.5,M),3===$&&(Wee(T,T,2*G),Hee(A,A,T),Hee(C,C,T),uO(w,A,C,.5,M))}else Wee(T,T,j),M.radiusTop=M.radiusBottom=U,3===$&&uO(w,A,C,.5,M),cO(w,A,C,.5,T,M)}else 6===R&&(Vee($ee,$ee,.475),Hee(A,A,$ee),qee(C,C,$ee),M.radiusTop=M.radiusBottom=O,M.topCap=F,M.bottomCap=L,uO(w,A,C,.5,M))}var V=n?XE.clone(n.boundingSphere):void 0,H=dO.getMesh(w);return 0===E?{mesh:H}:(Cg.scale(P,P,1/E),V&&Cg.distance(P,V.center)/V.radius<.1?{mesh:H,boundingSphere:V}:{mesh:H})}function Kee(e,t,r,n){var i=t.linkCount,a=t.referencePosition,o=t.position,s=t.style,u=t.radius,c=t.ignore,l=t.stub;if(!i)return{cylinders:uB.createEmpty(n)};for(var d=r.linkScale,f=r.linkSpacing,h=r.linkCap,p=r.aromaticScale,m=r.aromaticSpacing,g=r.aromaticDashCount,v=r.dashCount,y=r.dashScale,b=r.dashCap,_=r.stubCap,x=2*i,S=Eee.create(x,x/4,n),w=Cg(),A=Cg(),C=Cg(),T=Cg(),P=Cg(),E=0,M=0,k=i;M<k;++M)if(!c||!c(M)){o(w,A,M),Hee(P,P,w),Hee(P,P,A),E+=2;var I=u(M),D=s?s(M):0,O=_&&!!l&&l(M);if(0===D)Vee(C,Hee(C,w,A),.5),S.add(w[0],w[1],w[2],C[0],C[1],C[2],1,h,O,M);else if(1===D)Vee(C,Hee(C,w,A),.5),S.addFixedCountDashes(w,C,v,y,b,b,O,M);else if(2===D||3===D||4===D||5===D||7===D||8===D){var R=2===D||3===D?2:4===D||5===D?3:1.5,B=d/(.5*R),N=(I-B*I)*f;if(Vee(C,Hee(C,w,A),.5),Gee(T,w,A,a?a(M):null),7===D||8===D){S.add(w[0],w[1],w[2],C[0],C[1],C[2],1,h,O,M);var F=I+p*I+p*I*m;Wee($ee,qee($ee,A,w),.5*I),Hee(w,w,$ee),Wee(T,T,F),qee(w,w,T),qee(C,C,T),S.addFixedCountDashes(w,C,g,p,b,b,O,M),8===D&&(Wee(T,T,2*F),Hee(w,w,T),Hee(C,C,T),S.addFixedCountDashes(w,C,g,p,b,b,O,M))}else 3===D||5===D?(Wee(T,T,I+B*I+d*I*f),S.add(w[0],w[1],w[2],C[0],C[1],C[2],1,h,O,M),Wee($ee,qee($ee,w,C),I/1.5),qee(w,w,$ee),3===R&&S.add(w[0]+T[0],w[1]+T[1],w[2]+T[2],C[0]+T[0],C[1]+T[1],C[2]+T[2],B,h,O,M),S.add(w[0]-T[0],w[1]-T[1],w[2]-T[2],C[0]-T[0],C[1]-T[1],C[2]-T[2],B,b,O,M)):(Wee(T,T,N),3===R&&S.add(w[0],w[1],w[2],C[0],C[1],C[2],B,h,O,M),S.add(w[0]+T[0],w[1]+T[1],w[2]+T[2],C[0]+T[0],C[1]+T[1],C[2]+T[2],B,h,O,M),S.add(w[0]-T[0],w[1]-T[1],w[2]-T[2],C[0]-T[0],C[1]-T[1],C[2]-T[2],B,h,O,M))}else 6===D&&(Vee($ee,qee($ee,C,w),.475),Hee(w,w,$ee),qee(C,C,$ee),S.add(w[0],w[1],w[2],C[0],C[1],C[2],1,h,O,M))}var L=n?XE.clone(n.boundingSphere):void 0,$=S.getCylinders();return 0===E?{cylinders:$}:(Cg.scale(P,P,1/E),L&&Cg.distance(P,L.center)/L.radius<.1?{cylinders:$,boun
139dingSphere:L}:{cylinders:$})}function Zee(e,t,r,n){var i=t.linkCount,a=t.referencePosition,o=t.position,s=t.style,u=t.ignore;if(!i)return{lines:qO.createEmpty(n)};for(var c=r.linkScale,l=r.linkSpacing,d=r.aromaticDashCount,f=r.dashCount,h=2*i,p=HO.create(h,h/4,n),m=Cg(),g=Cg(),v=Cg(),y=Cg(),b=Cg(),_=0,x=0,S=i;x<S;++x)if(!u||!u(x)){o(m,g,x),Hee(b,b,m),Hee(b,b,g),_+=2;var w=s?s(x):0;if(0===w)Vee(v,Hee(v,m,g),.5),p.add(m[0],m[1],m[2],v[0],v[1],v[2],x);else if(1===w)Vee(v,Hee(v,m,g),.5),p.addFixedCountDashes(m,v,f,x);else if(2===w||3===w||4===w||5===w||7===w||8===w){var A=2===w||3===w?2:4===w||5===w?3:1.5,C=(1-c/(.5*A)*1)*l;if(Vee(v,Hee(v,m,g),.5),Gee(y,m,g,a?a(x):null),7===w||8===w){p.add(m[0],m[1],m[2],v[0],v[1],v[2],x);var T=4.5*C;Wee($ee,qee($ee,g,m),.5*T),Hee(m,m,$ee),Wee(y,y,T),qee(m,m,y),qee(v,v,y),p.addFixedCountDashes(m,v,d,x),8===w&&(Wee(y,y,2*T),Hee(m,m,y),Hee(v,v,y),p.addFixedCountDashes(m,v,d,x))}else 3===w||5===w?(Wee(y,y,3*C),p.add(m[0],m[1],m[2],v[0],v[1],v[2],x),Vee($ee,qee($ee,m,v),l*c),qee(m,m,$ee),3===A&&p.add(m[0]+y[0],m[1]+y[1],m[2]+y[2],v[0]+y[0],v[1]+y[1],v[2]+y[2],x),p.add(m[0]-y[0],m[1]-y[1],m[2]-y[2],v[0]-y[0],v[1]-y[1],v[2]-y[2],x)):(Wee(y,y,1.5*C),3===A&&p.add(m[0],m[1],m[2],v[0],v[1],v[2],x),p.add(m[0]+y[0],m[1]+y[1],m[2]+y[2],v[0]+y[0],v[1]+y[1],v[2]+y[2],x),p.add(m[0]-y[0],m[1]-y[1],m[2]-y[2],v[0]-y[0],v[1]-y[1],v[2]-y[2],x))}else 6===w&&(Vee($ee,qee($ee,v,m),.475),Hee(m,m,$ee),qee(v,v,$ee),p.add(m[0],m[1],m[2],v[0],v[1],v[2],x))}var P=n?XE.clone(n.boundingSphere):void 0,E=p.getLines();return 0===_?{lines:E}:(Cg.scale(b,b,1/_),P&&Cg.distance(b,P.center)/P.radius<.1?{lines:E,boundingSphere:P}:{lines:E})}var Qee={sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),dashCount:Ib.Numeric(6,{min:1,max:10,step:1}),dashScale:Ib.Numeric(.4,{min:0,max:2,step:.1}),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),includeParent:Ib.Boolean(!1),parentDisplay:Ib.Select("stub",Ib.arrayToOptions(["stub","full","between"]),{description:'Only has an effect when "includeParent" is enabled. "Stub" shows just the child side of interactions to the parent. "Full" shows both sides of interactions to the parent. "Between" shows only interactions to the parent.'})};function Jee(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var e,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B;return Pc(this,function(N){return tU.isAtomic(t)?(e=r.child,o=e?.unitMap.get(t.id),e&&!o?[2,sD.createEmpty(a)]:(s=qF.create(r,t),u=x9.get(r).value,c=u.unitsFeatures.get(t.id),l=u.unitsContacts.get(t.id),d=c.x,f=c.y,h=c.z,p=c.members,m=c.offsets,g=l.edgeCount,v=l.a,y=l.b,b=l.edgeProps,_=b.flag,x=b.type,S=i.sizeFactor,w=i.ignoreHydrogens,A=i.ignoreHydrogensVariant,C=i.parentDisplay,g?(T=t.conformation.invariantPosition,P=t.elements,E=Cg(),M=Cg(),k=Cg(),I={linkCount:2*g,position:function(e,n,i){var a=x[i];if(w&&"all"===A||a!==P8.HydrogenBond&&a!==P8.WeakHydrogenBond)Cg.set(e,d[v[i]],f[v[i]],h[v[i]]),Cg.set(n,d[y[i]],f[y[i]],h[y[i]]);else{var o=p[m[v[i]]],s=p[m[y[i]]];T(P[o],M),T(P[s],k);var u=Cg.distance(M,k),c=u;Cg.copy(e,M),Cg.copy(n,k),t8(t,o,function(n,i){if(Y9(r,t,P[i],"polar")){T(P[i],E);var a=Cg.distance(E,k);a<u&&(u=a,Cg.copy(e,E))}}),t8(t,s,function(e,i){if(Y9(r,t,P[i],"polar")){T(P[i],E);var a=Cg.distance(E,M);a<c&&(c=a,Cg.copy(n,E))}})}},style:function(e){return 1},radius:function(e){s.element=P[p[m[v[e]]]];var t=n.size.size(s);s.element=P[p[m[y[e]]]];var r=n.size.size(s);return Math.min(t,r)*S},ignore:function(e){if(_[e]===T8.Filtered)return!0;if(o)if("stub"===C)for(var t=v[e],r=m[t],n=m[t+1];r<n;++r){var i=P[p[m[r]]];if(!PP.has(o.elements,i))return!0}else{if("full"===C||"between"===C){var a=!1,s=!1,u=v[e];for(r=m[u],n=m[u+1];r<n;++r){var c=P[p[m[r]]];PP.has(o.elements,c)||(a=!0)}var l=y[e];for(r=m[l],n=m[l+1];r<n;++r){var d=P[p[m[r]]];PP.has(o.elements,d)||(s=!0)}return"full"===C?a&&s:a===s}Lg()}return!1}},D=Yee(0,I,i,a),O=D.mesh,(R=D.boundingSphere)?O.setBoundingSphere(R):O.triangleCount>0&&(B=XE.expand(XE(),(o??t).boundary.sphere,1*S),O.setBoundingSphere(B)),[2,O]):[2,sD.createEmpty(a)])):[2,sD.createEmpty(a)]})})}var ete=Ac(Ac(Ac({},bee),Fee),Qee);function tte(e){return _ee({defaultProps:Ib.getDefaultValues(ete),createGeometry:Jee,createLocationIterator:ate,getLoci:rte,eachLocation:ite,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.radialSegments!==r.radialSegments||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.parentDisplay!==r.parentDisplay;var s=x9.get(a.structure).version;e.info.interactionsHash!==s&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.info.interactionsHash=s)}},e)}function rte(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group,u=o.unitMap.get(s.units[i].id),c=x9.get(o).value,l=c.unitsContacts.get(u.id),d=l.a,f=l.b;return i9.Loci(o,c,[{unitA:u,indexA:d[a],unitB:u,indexB:f[a]},{unitA:u,indexA:f[a],unitB:u,indexB:d[a]}])}return EQ}var nte=new Set;function ite(e,t,r,n){var i=!1;if(i9.isLoci(e)){var a=t.structure,o=t.group;if(!yz.areEquivalent(e.data.structure,a))return!1;var s=x9.get(a).value;if(e.data.interactions!==s)return!1;for(var u=o.units[0],c=s.unitsContacts.get(u.id),l=2*c.edgeCount,d=0,f=e.elements;d<f.length;d++)if((P=f[d]).unitA===P.unitB){var h=o.unitIndexMap.get(P.unitA.id);if(void 0!==h){var p=c.getDirectedEdgeIndex(P.indexA,P.indexB);
139-1!==p&&r($T.ofSingleton(h*l+p))&&(i=!0)}}}else if(Az.is(e)){if(a=t.structure,o=t.group,!yz.areEquivalent(e.structure,a)||!(s=x9.get(a).value))return!1;u=o.units[0];for(var m=s.unitsContacts.get(u.id),g=s.unitsFeatures.get(u.id),v=2*m.edgeCount,y=m.offset,b=g.elementsIndex,_=b.offsets,x=b.indices,S=g.members,w=g.offsets,A=function(e){var t=o.unitIndexMap.get(e.unit.id);if(void 0===t)return"continue";kP.forEach(e.indices,function(e){for(var t=_[e],r=_[e+1];t<r;++t)for(var n=x[t],i=y[n],a=y[n+1];i<a;++i)nte.add(i)}),nte.forEach(function(a){if(n){for(var o=m.a[a],s=w[o],u=w[o+1];s<u;++s)if(!kP.has(e.indices,S[s]))return;var c=m.b[a];for(s=w[c],u=w[c+1];s<u;++s)if(!kP.has(e.indices,S[s]))return}r($T.ofSingleton(t*v+a))&&(i=!0)}),nte.clear()},C=0,T=e.elements;C<T.length;C++){var P;A(P=T[C])}}return i}function ate(e){var t=e.structure,r=e.group,n=r.units[0],i=x9.get(t).value,a=i.unitsContacts.get(n.id),o=2*a.edgeCount,s=r.units.length,u=i9.Location(i,t),c=u.element;return YM(o,s,1,function(e,t){var n=r.units[t];return c.unitA=n,c.indexA=a.a[e],c.unitB=n,c.indexB=a.b[e],u})}function ote(e,t,r,n,i){if(!t.hasAtomic)return sD.createEmpty(i);var a=qF.create(t),o=x9.get(t).value,s=o.contacts,u=o.unitsFeatures,c=s.edgeCount,l=s.edges,d=n.sizeFactor,f=n.ignoreHydrogens,h=n.ignoreHydrogensVariant,p=n.parentDisplay;if(!c)return sD.createEmpty(i);var m=t.child,g=Cg(),v=Cg(),y=Cg(),b=Yee(0,{linkCount:c,position:function(e,r,n){var i=l[n],a=i.unitA,o=i.indexA,s=i.unitB,c=i.indexB,d=i.props.type,p=u.get(a),m=u.get(s),b=t.unitMap.get(a),_=t.unitMap.get(s);if(f&&"all"===h||d!==P8.HydrogenBond&&d!==P8.WeakHydrogenBond)Cg.set(e,p.x[o],p.y[o],p.z[o]),Cg.transformMat4(e,e,b.conformation.operator.matrix),Cg.set(r,m.x[c],m.y[c],m.z[c]),Cg.transformMat4(r,r,_.conformation.operator.matrix);else{var x=p.members[p.offsets[o]],S=m.members[m.offsets[c]];b.conformation.position(b.elements[x],v),_.conformation.position(_.elements[S],y);var w=Cg.distance(v,y),A=w;Cg.copy(e,v),Cg.copy(r,y),r8(t,b,x,function(r,n){var i=r.elements[n];if(Y9(t,r,i,"polar")){r.conformation.position(i,g);var a=Cg.distance(g,y);a<w&&(w=a,Cg.copy(e,g))}}),r8(t,_,S,function(e,n){var i=e.elements[n];if(Y9(t,e,i,"polar")){e.conformation.position(i,g);var a=Cg.distance(g,v);a<A&&(A=a,Cg.copy(r,g))}})}},style:function(e){return 1},radius:function(e){var n=l[e],i=u.get(n.unitA);a.unit=t.unitMap.get(n.unitA),a.element=a.unit.elements[i.members[i.offsets[n.indexA]]];var o=r.size.size(a),s=u.get(n.unitB);a.unit=t.unitMap.get(n.unitB),a.element=a.unit.elements[s.members[s.offsets[n.indexB]]];var c=r.size.size(a);return Math.min(o,c)*d},ignore:function(e){if(l[e].props.flag===T8.Filtered)return!0;if(m){var r=l[e];if("stub"===p){if(!(f=m.unitMap.get(r.unitA)))return!0;for(var n=t.unitMap.get(r.unitA),i=u.get(r.unitA),a=i.offsets,o=i.members,s=a[r.indexA],c=a[r.indexA+1];s<c;++s){var d=n.elements[o[s]];if(!PP.has(f.elements,d))return!0}}else{if("full"===p||"between"===p){var f,h=!1,g=!1;if(f=m.unitMap.get(r.unitA)){n=t.unitMap.get(r.unitA);var v=u.get(r.unitA);for(a=v.offsets,o=v.members,s=a[r.indexA],c=a[r.indexA+1];s<c;++s)d=n.elements[o[s]],PP.has(f.elements,d)||(h=!0)}else h=!0;var y=m.unitMap.get(r.unitB);if(y){var b=t.unitMap.get(r.unitB),_=u.get(r.unitB);for(a=_.offsets,o=_.members,s=a[r.indexB],c=a[r.indexB+1];s<c;++s){var x=b.elements[o[s]];PP.has(y.elements,x)||(g=!0)}}else g=!0;return"full"===p?h&&g:h===g}Lg()}}return!1}},n,i),_=b.mesh,x=b.boundingSphere;if(x)_.setBoundingSphere(x);else if(_.triangleCount>0){var S=t.child,w=XE.expand(XE(),(S??t).boundary.sphere,1*d);_.setBoundingSphere(w)}return _}var ste=Ac(Ac(Ac({},cee),Fee),Qee);function ute(e){return lee({defaultProps:Ib.getDefaultValues(ste),createGeometry:ote,createLocationIterator:hte,getLoci:cte,eachLocation:fte,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.radialSegments!==r.radialSegments||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.parentDisplay!==r.parentDisplay;var s=x9.get(a).version;e.info.interactionsHash!==s&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.info.interactionsHash=s)}},e)}function cte(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=x9.get(t).value,o=a.contacts.edges[i],s=t.unitMap.get(o.unitA),u=t.unitMap.get(o.unitB);return i9.Loci(t,a,[{unitA:s,indexA:o.indexA,unitB:u,indexB:o.indexB},{unitA:u,indexA:o.indexB,unitB:s,indexB:o.indexA}])}return EQ}var lte=new Map,dte=new Set;function fte(e,t,r,n){var i=!1;if(i9.isLoci(e)){if(!yz.areEquivalent(e.data.structure,t))return!1;var a=x9.get(t).value;if(e.data.interactions!==a)return!1;for(var o=a.contacts,s=0,u=e.elements;s<u.length;s++){var c=u[s],l=o.getEdgeIndex(c.indexA,c.unitA.id,c.indexB,c.unitB.id);-1!==l&&r($T.ofSingleton(l))&&(i=!0)}}else if(Az.is(e)){if(!yz.areEquivalent(e.structure,t)||n&&1===e.elements.length||!(a=x9.get(t).value))return!1;for(var d=a.contacts,f=a.unitsFeatures,h=0,p=e.elements;h<p.length;h++){var m=p[h];lte.set(m.unit.id,m.indices)}for(var g=function(e){var t=e.unit;if(!tU.isAtomic(t))return"continue";kP.forEach(e.indices,function(e){for(var r=0,n=d.getContactIndicesForElement(e,t);r<n.length;r++){var i=n[r];dte.add(i)}})},v=0,y=e.elements;v<y.length;v++)g(m=y[v]);dte.forEach(function(e){if(n){var t=d.edges[e],a=t.indexA,o=t.unitA,s=t.indexB,u=t.unitB,c=lte.get(o),l=lte.get(u);if(!c||!l)return;
139for(var h=f.get(o),p=h.offsets,m=h.members,g=p[a],v=p[a+1];g<v;++g)if(!kP.has(c,m[g]))return;var y=f.get(u),b=y.offsets,_=y.members;for(g=b[s],v=b[s+1];g<v;++g)if(!kP.has(l,_[g]))return}r($T.ofSingleton(e))&&(i=!0)}),lte.clear(),dte.clear()}return i}function hte(e){var t=x9.get(e).value,r=t.contacts,n=r.edgeCount,i=i9.Location(t,e),a=i.element;return YM(n,1,1,function(t){var n=r.edges[t];return a.unitA=e.unitMap.get(n.unitA),a.indexA=n.indexA,a.unitB=e.unitMap.get(n.unitB),a.indexB=n.indexB,i},!0)}var pte,mte={"intra-unit":function(e,t){return vee("Intra-unit interactions cylinder",e,t,tte)},"inter-unit":function(e,t){return B9("Inter-unit interactions cylinder",e,t,ute)}},gte=Ac(Ac(Ac({},ete),ste),{unitKinds:Q9(["atomic"]),sizeFactor:Ib.Numeric(.2,{min:.01,max:1,step:.01}),visuals:Ib.MultiSelect(["intra-unit","inter-unit"],Ib.objectToOptions(mte))}),vte={name:"interactions",label:"Non-covalent Interactions",description:"Displays non-covalent interactions as dashed cylinders.",factory:function(e,t){return dJ.createMulti("Interactions",e,t,Iee,mte)},getParams:function(e,t){return Ib.clone(gte)},defaultValues:Ib.getDefaultValues(gte),defaultColorTheme:{name:"interaction-type"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0&&x9.isApplicable(e)},ensureCustomProperties:{attach:function(e,t){return x9.attach(e,t,void 0,!0)},detach:function(e){return x9.ref(e,!1)}},getData:function(e,t){return t.includeParent?e.asParent():e},mustRecreate:function(e,t){return e.includeParent!==t.includeParent}},yte=T2.create({name:"computed-interactions-prop",category:"custom-props",display:{name:"Interactions"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=x9,t.labelProvider={label:function(e){if(t.params.showTooltip&&"element-loci"===e.kind){if(0===e.elements.length)return;for(var r=[],n=0,i=t.getStructures(e.structure);n<i.length;n++){var a=i[n],o=t.provider.get(a).value;if(o){var s=Az.remap(e,a);if(1===s.elements.length){var u=s.elements[0];if(1===kP.size(u.indices)){var c=o.unitsFeatures.get(u.unit.id);if(c){for(var l=[],d=[],f=[],h=kP.start(u.indices),p=c.types,m=c.groups,g=c.elementsIndex,v=g.indices,y=g.offsets,b=y[h],_=y[h+1];b<_;++b){var x=v[b],S=p[x],w=m[x];S&&l.push(R8(S)),w&&d.push(B8(w))}l.length&&f.push(`<small>Types</small> ${l.join(", ")}`),d.length&&f.push(`<small>Groups</small> ${d.join(", ")}`),f.length&&r.push(`Interaction Feature: ${f.join(" | ")}`)}}}}}return r.length?r.join("<br/>"):void 0}}},t}return wc(t,e),t.prototype.getStructures=function(e){var t=[],r=this.ctx.helpers.substructureParent.get(e);if(r)for(var n=0,i=this.ctx.state.data.select(Zb.Generators.ofType(DS.Molecule.Structure,r.transform.ref));n<i.length;n++){var a=i[n];a.obj&&Hb(t,a.obj.data)}return t},t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(R9),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.representation.structure.registry.add(vte)},t.prototype.unregister=function(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(R9),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.representation.structure.registry.remove(vte)},t}(T2.Handler),params:function(){return{autoAttach:Ib.Boolean(!1),showTooltip:Ib.Boolean(!0)}}}),bte=T2.create({name:"computed-secondary-structure-prop",category:"custom-props",display:{name:"Secondary Structure"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=lj,t}return wc(t,e),t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach)},t.prototype.unregister=function(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name)},t}(T2.Handler),params:function(){return{autoAttach:Ib.Boolean(!1)}}}),_te=T2.create({name:"computed-valence-model-prop",category:"custom-props",display:{name:"Valence Model"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=C8,t.labelProvider={label:function(e){if(t.params.showTooltip&&"element-loci"===e.kind){if(0===e.elements.length)return;for(var r=[],n=0,i=t.getStructures(e.structure);n<i.length;n++){var a=i[n],o=t.provider.get(a).value;if(o){var s=Az.remap(e,a);if(1===s.elements.length){var u=s.elements[0];if(1===kP.size(u.indices)){var c=o.get(u.unit.id);if(c){var l=kP.start(u.indices),d=c.charge[l],f=c.idealGeometry[l],h=c.implicitH[l],p=c.totalH[l];r.push(`Valence Model: <small>Charge</small> ${d} | <small>Ideal Geometry</small> ${n8(f)} | <small>Implicit H</small> ${h} | <small>Total H</small> ${p}`)}}}}}return r.length?r.join("<br/>"):void 0}}},t}return wc(t,e),t.prototype.getStructures=function(e){var t=[],r=this.ctx.helpers.substructureParent.get(e);if(r)for(var n=0,i=this.ctx.state.data.select(Zb.Generators.ofType(DS.Molecule.Structure,r.transform.ref));n<i.length;n++){var a=i[n];a.obj&&Hb(t,a.obj.data)}return t},t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelProvider)},t.prototype.unregister=function(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)},t}(T2.Handler),params:function(){return{autoAttach:Ib.Boolean(!1),showTooltip:Ib.Boolean(!0)}}}),xte=tv(16448250),Ste=new Map,wte=Ac({},jY({type:"colors",colorList:"set-1"})),Ate={name:"sifts-mapping",label:"SIFTS Mapping",category:KZ.Category.Residue,factory:function e(t,r){var n;if(t.structure){for(var i=0,a=t.structure.models;i<a.length;i++){var o=a[i],s=Sz.Provider.get(o).value;if(s)for(var u=0,c=s.accession;u<c.length;u++){var l=c[u];l&&!Ste.has(l)&&Ste.set(l,Ste.size)}}var d=qF.create(t.structure),f=GY(Ste.size+1,r,{valueLabel:function(e){return`${e}`}}),h=new Map,p=function(e){var t=Sz.getKey(e);if(!t)return xte;if(h.has(t))return h.get(t);var r=f.color(Ste.get(t));return h.set(t,r),r};n=function(e){return qF.is(e)&&tU.isAtomic(e.unit)?p(e):C$.isLocation(e)?(d.unit=e.aUnit,d.element=e.aUnit.elements[e.aIndex],p(d)):xte}}else n=function(){return xte};return{factory:e,granularity:"group",preferSmoothing:!0,color:n,props:r,description:"Assigns a color based on SIFTS mapping."}},getParams:function(e){return wte},defaultValues:Ib.getDefaultValues(wte),isApplicable:function(e){return!!e.structure?.models.some(function(e){return Sz.Provider.isApplicable(e)}
139)},ensureCustomProperties:{attach:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n,i;return Pc(this,function(a){switch(a.label){case 0:if(!t.structure)return[2];r=0,n=t.structure.models,a.label=1;case 1:return r<n.length?(i=n[r],[4,Sz.Provider.attach(e,i,void 0,!0)]):[3,4];case 2:a.sent(),a.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},detach:function(e){if(e.structure)for(var t=0,r=e.structure.models;t<r.length;t++){var n=r[t];Sz.Provider.ref(n,!1)}}}},Cte=T2.create({name:"sifts-mapping-prop",category:"custom-props",display:{name:"SIFTS Mapping"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=Sz.Provider,t.labelProvider={label:function(e){if(t.params.showTooltip)return function(e){if("element-loci"===e.kind){if(0===e.elements.length)return;var t=e.elements[0],r=t.unit,n=qF.create(e.structure,r,r.elements[kP.getAt(t.indices,0)]);return Sz.getLabel(n)}}(e)}},t}return wc(t,e),t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customModelProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(Ate),this.ctx.managers.lociLabels.addProvider(this.labelProvider)},t.prototype.unregister=function(){this.ctx.customModelProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(Ate),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)},t}(T2.Handler),params:function(){return{autoAttach:Ib.Boolean(!0),showTooltip:Ib.Boolean(!0)}}});!function(e){e.Descriptor={name:"ihm_cross_link_restraint"},e.Provider=FF.create(e.Descriptor),e.fromTable=function(e,t){var r={entity_id:e.entity_id_1,asym_id:e.asym_id_1,seq_id:e.seq_id_1,atom_id:e.atom_id_1},n={entity_id:e.entity_id_2,asym_id:e.asym_id_2,seq_id:e.seq_id_2,atom_id:e.atom_id_2};function i(e,t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])}function a(r,n){var a=n.entity_id.value(r),c=n.asym_id.value(r),l=n.seq_id.value(r);if("by-atom"===e.model_granularity.value(r)){var d=t.atomicHierarchy.index.findAtom({auth_seq_id:l,label_asym_id:c,label_atom_id:n.atom_id.value(r),label_entity_id:a});d>=0&&i(o,d,r)}else if(t.coarseHierarchy.isDefined){var f=t.coarseHierarchy.spheres.findSequenceKey(a,c,l);if(f>=0)i(s,f,r);else{var h=t.coarseHierarchy.gaussians.findSequenceKey(a,c,l);h>=0&&i(u,h,r)}}}for(var o=new Map,s=new Map,u=new Map,c=[],l=0;l<e._rowCount;++l)a(l,r),a(l,n);return{getIndicesByElement:function(e,t){var r=function(e){switch(e){case 0:return o;case 1:return s;case 2:return u}}(t).get(e);return void 0===r?c:r},data:e}}}(pte||={});var Tte=[];function Pte(e,t,r,n){return`${e}|${t.id}|${r}|${n.id}`}var Ete,Mte=function(){function e(e){this.pairs=e;var t=new Map;this.pairs.forEach(function(e,r){var n=Pte(e.indexA,e.unitA,e.indexB,e.unitB),i=t.get(n);i?i.push(r):t.set(n,[r])}),this.count=e.length,this.pairKeyIndices=t}return e.prototype.getPairIndices=function(e,t,r,n){var i=Pte(e,t,r,n);return this.pairKeyIndices.get(i)||Tte},e.prototype.getPairs=function(e,t,r,n){var i=this;return this.getPairIndices(e,t,r,n).map(function(e){return i.pairs[e]})},e}(),kte=ZU.createProvider({label:"Cross Link Restraint",descriptor:{name:"integrative-cross-link-restraint"},type:"local",defaultParams:{},getParams:function(e){return{}},isApplicable:function(e){return e.models.some(function(e){return!!pte.Provider.get(e)})},obtain:function(e,t,r){return Tc(void 0,void 0,void 0,function(){return Pc(this,function(e){return[2,{value:Bte(t)}]})})}});function Ite(e,t,r){for(var n=t.elements,i=n.length,a=t.kind,o=function(t){var i=n[t];r.getIndicesByElement(i,a).forEach(function(r){return e.set(r,t)})},s=0;s<i;s++)o(s)}function Dte(e,t,r){if(t.model===r.model&&"mmCIF"===t.model.sourceData.kind){var n=pte.Provider.get(t.model);if(n){var i=new Map,a=new Map;
139Ite(i,t,n),Ite(a,r,n),i.forEach(function(i,o){var s=a.get(o);void 0!==s&&e.push(Rte(t,i,r,s,n,o),Rte(r,s,t,i,n,o))})}}}function Ote(e,t){if("mmCIF"===t.model.sourceData.kind){var r=pte.Provider.get(t.model);if(r){for(var n=t.elements,i=n.length,a=t.kind,o=new Map,s=function(e){var t=n[e];r.getIndicesByElement(t,a).forEach(function(t){var r=o.get(t);r?r.push(e):o.set(t,[e])})},u=0;u<i;u++)s(u);o.forEach(function(n,i){if(!(n.length<2)){var a=n[0],o=n[1];e.push(Rte(t,a,t,o,r,i),Rte(t,o,t,a,r,i))}})}}}function Rte(e,t,r,n,i,a){return{unitA:e,indexA:t,unitB:r,indexB:n,restraintType:i.data.restraint_type.value(a),distanceThreshold:i.data.distance_threshold.value(a),psi:i.data.psi.value(a),sigma1:i.data.sigma_1.value(a),sigma2:i.data.sigma_2.value(a)}}function Bte(e){var t=[];if(!e.models.some(function(e){return pte.Provider.get(e)}))return new Mte(t);for(var r=e.units.length,n=0;n<r;++n){var i=e.units[n];Ote(t,i);for(var a=n+1;a<r;++a){var o=e.units[a];i.model===o.model&&Dte(t,i,o)}}return new Mte(t)}function Nte(e,t,r,n,i){var a=kte.get(t).value;if(!a.count)return sD.createEmpty(i);var o=n.sizeFactor,s=qF.create(t),u=Yee(0,{linkCount:a.count,position:function(e,t,r){var n=a.pairs[r],i=n.unitA,o=n.unitB;i.conformation.position(i.elements[n.indexA],e),o.conformation.position(o.elements[n.indexB],t)},radius:function(e){var t=a.pairs[e];return s.unit=t.unitA,s.element=t.unitA.elements[t.indexA],r.size.size(s)*o}},n,i),c=u.mesh,l=u.boundingSphere;if(l)c.setBoundingSphere(l);else if(c.triangleCount>0){var d=XE.expand(XE(),t.boundary.sphere,1*o);c.setBoundingSphere(d)}return c}!function(e){(e.Tag||={}).CrossLinkRestraint="cross-link-restraint",e.isApplicable=function(e){return e.models.some(function(e){return!!pte.Provider.get(e)})};var t=Cg(),r=Cg();function n(e){return e.unitA.conformation.position(e.unitA.elements[e.indexA],t),e.unitB.conformation.position(e.unitB.elements[e.indexB],r),Cg.distance(t,r)}function i(e,t){var r=e.pairs[t];return`Cross Link Restraint | Type: ${r.restraintType} | Threshold: ${r.distanceThreshold} Å | Psi: ${r.psi} | Sigma 1: ${r.sigma1} | Sigma 2: ${r.sigma2} | Distance: ${n(r).toFixed(2)} Å`}function a(e,t,r){return SM.fromPairProvider(t.length,function(r,n,i){var a=e.pairs[t[r]];a.unitA.conformation.position(a.unitA.elements[a.indexA],n),a.unitB.conformation.position(a.unitB.elements[a.indexB],i)},r)}function o(e,t,r){var n=r[0];if(void 0===n)return"";var a=t.pairs[n];return[i(t,n),XJ(C$.Location(e,a.unitA,a.indexA,e,a.unitB,a.indexB))].join("</br>")}e.distance=n,e.Location=function(e,t,r){return XM("cross-link-restraints",{structure:t,crossLinkRestraints:e},r)},e.isLocation=function(e){return!!e&&"data-location"===e.kind&&"cross-link-restraints"===e.tag},e.areLocationsEqual=function(e,t){return e.data.structure===t.data.structure&&e.data.crossLinkRestraints===t.data.crossLinkRestraints&&e.element===t.element},e.locationLabel=function(e){return i(e.data.crossLinkRestraints,e.element)},e.Loci=function(e,t,r){return IQ("cross-link-restraints",{structure:e,crossLinkRestraints:t},r,function(e){return a(t,r,e)},function(){return o(e,t,r)})},e.isLoci=function(e){return!!e&&"data-loci"===e.kind&&"interactions"===e.tag},e.getBoundingSphere=a,e.getLabel=o}(Ete||={});var Fte=Ac(Ac(Ac({},cee),Fee),{sizeFactor:Ib.Numeric(.5,{min:0,max:10,step:.1})});function Lte(e){return lee({defaultProps:Ib.getDefaultValues(Fte),createGeometry:Nte,createLocationIterator:$te,getLoci:Ute,eachLocation:jte,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments||t.linkCap!==r.linkCap}},e)}function $te(e){var t=kte.get(e).value,r=t.pairs.length,n=Ete.Location(t,e);return YM(r,1,1,function(e){return n.element=e,n},!0)}function Ute(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=kte.get(t).value;if(a.pairs[i])return Ete.Loci(t,a,[i])}return EQ}function jte(e,t,r){var n=!1;if(Ete.isLoci(e)){if(!yz.areEquivalent(e.data.structure,t))return!1;var i=kte.get(t).value;if(e.data.crossLinkRestraints!==i)return!1;for(var a=0,o=e.elements;a<o.length;a++){var s=o[a];r($T.ofSingleton(s))&&(n=!0)}}return n}var zte={"cross-link-restraint":function(e,t){return B9("Cross-link restraint",e,t,Lte)}},Gte=Ac({},Fte),Vte={name:Ete.Tag.CrossLinkRestraint,label:"Cross Link Restraint",description:"Displays cross-link restraints.",factory:function(e,t){return dJ.createMulti("CrossLinkRestraint",e,t,Iee,zte)},getParams:function(e,t){return Ib.clone(Gte)},defaultValues:Ib.getDefaultValues(Gte),defaultColorTheme:{name:Ete.Tag.CrossLinkRestraint},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return Ete.isApplicable(e)},ensureCustomProperties:{attach:function(e,t){return kte.attach(e,t,void 0,!0)},detach:function(e){return kte.ref(e,!1)}}}
139,Hte=tv(13421772),qte={domain:Ib.Interval([.5,1.5],{step:.01}),list:Ib.ColorList("red-grey",{presetKind:"scale"})},Wte={name:"cross-link",label:"Cross Link",category:KZ.Category.Misc,factory:function e(t,r){var n,i=void 0,a=t.structure&&kte.get(t.structure).value;if(a){var o=(i=wE.create({domain:r.domain,listOrName:r.list.colors})).color;n=function(e){if(Ete.isLocation(e)){var t=a.pairs[e.element];if(t)return o(Ete.distance(t)/t.distanceThreshold)}return Hte}}else n=function(){return Hte};return{factory:e,granularity:"group",color:n,props:r,description:"Colors cross-links by the deviation of the observed distance versus the modeled distance (e.g. modeled / `ihm_cross_link_restraint.distance_threshold`).",legend:i?i.legend:void 0}},getParams:function(e){return qte},defaultValues:Ib.getDefaultValues(qte),isApplicable:function(e){return!!e.structure&&Ete.isApplicable(e.structure)},ensureCustomProperties:{attach:function(e,t){return t.structure?kte.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&kte.ref(e.structure,!1)}}},Xte=T2.create({name:"integrative-cross-link-restraint",category:"custom-props",display:{name:"Cross Link Restraint"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=pte.Provider,t}return wc(t,e),t.prototype.register=function(){this.provider.formatRegistry.add("mmCIF",Yte),this.ctx.representation.structure.themes.colorThemeRegistry.add(Wte),this.ctx.representation.structure.registry.add(Vte)},t.prototype.unregister=function(){this.provider.formatRegistry.remove("mmCIF"),this.ctx.representation.structure.themes.colorThemeRegistry.remove(Wte),this.ctx.representation.structure.registry.remove(Vte)},t}(T2.Handler)});function Yte(e){if(qz.is(e.sourceData)){var t=e.sourceData.data.db.ihm_cross_link_restraint;if(0!==t._rowCount)return pte.fromTable(t,e)}}var Kte={State:t3,Representation:o3,Camera:f3,Misc:e6},Zte={Representation:p6,Camera:E6,CustomProps:Object.freeze({__proto__:null,AccessibleSurfaceArea:H6,BestDatabaseSequenceMapping:Cte,CrossLinkRestraint:Xte,Interactions:yte,SecondaryStructure:bte,StructureInfo:M6,ValenceModel:_te})};function Qte(e,t,r){void 0===r&&(r={});var n=r;return"string"==typeof n.type||"string"==typeof n.color||"string"==typeof n.size?function(e,t,r){var n=r.type&&e.representation.structure.registry.get(r.type)||e.representation.structure.registry.default.provider,i=r.color&&e.representation.structure.themes.colorThemeRegistry.get(r.color)||e.representation.structure.themes.colorThemeRegistry.get(n.defaultColorTheme.name),a=r.size&&e.representation.structure.themes.sizeThemeRegistry.get(r.size)||e.representation.structure.themes.sizeThemeRegistry.get(n.defaultSizeTheme.name);return tre(e,t,{type:n,typeParams:r.typeParams,color:i,colorParams:r.colorParams,size:a,sizeParams:r.sizeParams})}(e,t||yz.Empty,r):tre(e,t||yz.Empty,r)}function Jte(e,t,r,n,i){var a=e.representation.structure,o=a.registry,s=a.themes,u=o.get(r||o.default.name),c=s.colorThemeRegistry.get(n||u.defaultColorTheme.name),l=Ib.getDefaultValues(c.getParams({structure:t||yz.Empty}));return c.name===u.defaultColorTheme.name&&Object.assign(l,u.defaultColorTheme.props),{name:c.name,params:Object.assign(l,i)}}function ere(e,t,r,n,i){var a=e.representation.structure,o=a.registry,s=a.themes,u=o.get(r||o.default.name),c=s.sizeThemeRegistry.get(n||u.defaultSizeTheme.name),l=Ib.getDefaultValues(c.getParams({structure:t||yz.Empty}));return c.name===u.defaultSizeTheme.name&&Object.assign(l,u.defaultSizeTheme.props),{name:c.name,params:Object.assign(l,i)}}function tre(e,t,r){void 0===r&&(r={});var n=e.representation.structure.themes,i={structure:t},a=r.type||e.representation.structure.registry.default.provider,o=Ib.getDefaultValues(a.getParams(n,t)),s=Object.assign(o,r.typeParams),u=r.color||n.colorThemeRegistry.get(a.defaultColorTheme.name),c=Ib.getDefaultValues(u.getParams(i));u.name===a.defaultColorTheme.name&&Object.assign(c,a.defaultColorTheme.props);var l=Object.assign(c,r.colorParams),d=r.size||n.sizeThemeRegistry.get(a.defaultSizeTheme.name),f=Ib.getDefaultValues(d.getParams(i));d.name===a.defaultSizeTheme.name&&Object.assign(f,a.defaultSizeTheme.props);var h=Object.assign(f,r.sizeParams);return{type:{name:a.name,params:s},colorTheme:{name:u.name,params:l},sizeTheme:{name:d.name,params:h}}}var rre,nre=["target","surroundings","interactions"];
139!function(e){e.TargetSel="structure-focus-target-sel",e.TargetRepr="structure-focus-target-repr",e.SurrSel="structure-focus-surr-sel",e.SurrRepr="structure-focus-surr-repr",e.SurrNciRepr="structure-focus-surr-nci-repr"}(rre||={});var ire=new Set([rre.TargetSel,rre.TargetRepr,rre.SurrSel,rre.SurrRepr,rre.SurrNciRepr]),are=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.currentSource=void 0,t}return wc(t,e),Object.defineProperty(t.prototype,"surrLabel",{get:function(){return`[Focus] Surroundings (${this.params.expandRadius} Å)`},enumerable:!1,configurable:!0}),t.prototype.getReprParams=function(e){return Ac(Ac({},e),{type:{name:e.type.name,params:Ac(Ac({},e.type.params),{ignoreHydrogens:this.params.ignoreHydrogens,ignoreHydrogensVariant:this.params.ignoreHydrogensVariant,ignoreLight:this.params.ignoreLight,material:this.params.material,clip:this.params.clip})}})},t.prototype.ensureShape=function(e){var t=this.plugin.state.data,r=t.tree,n=t.build(),i=Zb.findUniqueTagsInSubtree(r,e.transform.ref,ire);i[rre.TargetSel]||(i[rre.TargetSel]=n.to(e).apply(m2.Model.StructureSelectionFromBundle,{bundle:sU.Empty,label:"[Focus] Target"},{tags:rre.TargetSel}).ref),i[rre.SurrSel]||(i[rre.SurrSel]=n.to(e).apply(m2.Model.StructureSelectionFromExpression,{expression:SL.struct.generator.empty(),label:this.surrLabel},{tags:rre.SurrSel}).ref);var a=this.params.components;return a.indexOf("target")>=0&&!i[rre.TargetRepr]&&(i[rre.TargetRepr]=n.to(i[rre.TargetSel]).apply(m2.Representation.StructureRepresentation3D,this.getReprParams(this.params.targetParams),{tags:rre.TargetRepr}).ref),a.indexOf("surroundings")>=0&&!i[rre.SurrRepr]&&(i[rre.SurrRepr]=n.to(i[rre.SurrSel]).apply(m2.Representation.StructureRepresentation3D,this.getReprParams(this.params.surroundingsParams),{tags:rre.SurrRepr}).ref),a.indexOf("interactions")>=0&&!i[rre.SurrNciRepr]&&e.obj&&vte.isApplicable(e.obj?.data)&&(i[rre.SurrNciRepr]=n.to(i[rre.SurrSel]).apply(m2.Representation.StructureRepresentation3D,this.getReprParams(this.params.nciParams),{tags:rre.SurrNciRepr}).ref),{state:t,builder:n,refs:i}},t.prototype.clear=function(e){var t=this.plugin.state.data;this.currentSource=void 0;var r=t.select(Zb.Generators.byRef(e).subtree().withTag(rre.TargetSel)),n=t.select(Zb.Generators.byRef(e).subtree().withTag(rre.SurrSel));if(0!==r.length||0!==n.length){for(var i=t.build(),a=sU.Empty,o=0,s=r;o<s.length;o++){var u=s[o];i.to(u).update(m2.Model.StructureSelectionFromBundle,function(e){return Ac(Ac({},e),{bundle:a})})}for(var c=SL.struct.generator.empty(),l=0,d=n;l<d.length;l++){var f=d[l];i.to(f).update(m2.Model.StructureSelectionFromExpression,function(e){return Ac(Ac({},e),{expression:c})})}return y2.State.Update(this.plugin,{state:t,tree:i,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})}},t.prototype.focus=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d=this;return Pc(this,function(f){switch(f.label){case 0:return(t=this.plugin.helpers.substructureParent.get(e.structure))&&t.obj?(this.currentSource=e,r=Az.remap(e,t.obj.data),n=Az.extendToWholeResidues(r),i=sU.fromLoci(n),a=sU.toExpression(i),o=SL.struct.modifier.includeSurroundings({0:a,radius:this.params.expandRadius,"as-whole-residues":!0}),this.params.excludeTargetFromSurroundings&&(o=SL.struct.modifier.exceptBy({0:o,by:a})),s=this.ensureShape(t),u=s.state,c=s.builder,l=s.refs,c.to(l[rre.Target
139Sel]).update(m2.Model.StructureSelectionFromBundle,function(e){return Ac(Ac({},e),{bundle:i})}),c.to(l[rre.SurrSel]).update(m2.Model.StructureSelectionFromExpression,function(e){return Ac(Ac({},e),{expression:o,label:d.surrLabel})}),[4,y2.State.Update(this.plugin,{state:u,tree:c,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})]):[2];case 1:return f.sent(),[2]}})})},t.prototype.register=function(e){var t=this;this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,function(e){e?t.focus(e.loci):t.clear(Rb.RootRef)})},t.prototype.update=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f,h;return Pc(this,function(p){switch(p.label){case 0:if(t=this.params,this.params=e,t.excludeTargetFromSurroundings!==e.excludeTargetFromSurroundings)return this.currentSource&&this.focus(this.currentSource),[2,!0];for(r=this.plugin.state.data,n=r.build(),i=Zb.Generators.root.subtree(),a=this.params.components,o=a.indexOf("target")>=0,s=0,u=r.select(i.withTag(rre.TargetRepr));s<u.length;s++)h=u[s],o?n.to(h).update(this.getReprParams(this.params.targetParams)):n.delete(h.transform.ref);for(o=a.indexOf("surroundings")>=0,c=0,l=r.select(i.withTag(rre.SurrRepr));c<l.length;c++)h=l[c],o?n.to(h).update(this.getReprParams(this.params.surroundingsParams)):n.delete(h.transform.ref);for(o=a.indexOf("interactions")>=0,d=0,f=r.select(i.withTag(rre.SurrNciRepr));d<f.length;d++)h=f[d],o?n.to(h).update(this.getReprParams(this.params.nciParams)):n.delete(h.transform.ref);return[4,y2.State.Update(this.plugin,{state:r,tree:n,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})];case 1:return p.sent(),e.expandRadius===t.expandRadius||this.currentSource&&this.focus(this.currentSource),[2,!0]}})})},t}(T2.WithSubscribers),ore=T2.create({name:"create-structure-focus-representation",display:{name:"Structure Focus Representation"},category:"interaction",ctor:are,params:function(e,t){return function(e){var t=m2.Representation.StructureRepresentation3D.definition.params(void 0,e);return{expandRadius:Ib.Numeric(5,{min:1,max:10,step:1}),targetParams:Ib.Group(t,{label:"Target",customDefault:Qte(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.22,sizeAspectRatio:.73,adjustCylinderLength:!0,xrayShaded:!0,aromaticBonds:!1,multipleBonds:"off",excludeTypes:["hydrogen-bond","metal-coordination"]}})}),surroundingsParams:Ib.Group(t,{label:"Surroundings",customDefault:Qte(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.16,excludeTypes:["hydrogen-bond","metal-coordination"]}})}),nciParams:Ib.Group(t,{label:"Non-covalent Int.",customDefault:Qte(e,void 0,{type:vte,color:R9,size:mQ.BuiltIn.uniform})}),components:Ib.MultiSelect(nre,Ib.arrayToOptions(nre)),excludeTargetFromSurroundings:Ib.Boolean(!1,{label:"Exclude Target",description:'Exclude the focus "target" from the surroudings component.'}),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),ignoreLight:Ib.Boolean(!1),material:VI.getParam(),clip:Ib.Group(HI.Params)}}(t)}});function sre(e){return e}!function(e){e.CommonParams={ignoreHydrogens:Ib.Optional(Ib.Boolean(!1)),ignoreHydrogensVariant:Ib.Optional(Ib.Select("all",Ib.arrayToOptions(["all","non-polar"]))),ignoreLight:Ib.Optional(Ib.Boolean(!1)),quality:Ib.Optional(Ib.Select("auto",XI)),theme:Ib.Optional(Ib.Group({globalName:Ib.Optional(Ib.Text("")),globalColorParams:Ib.Optional(Ib.Value({},{isHidden:!0})),carbonColor:Ib.Optional(Ib.Select("chain-id",Ib.arrayToOptions(["chain-id","operator-name","element-symbol"]))),symmetryColor:Ib.Optional(Ib.Text("")),symmetryColorParam
139s:Ib.Optional(Ib.Value({},{isHidden:!0})),focus:Ib.Optional(Ib.Group({name:Ib.Optional(Ib.Text("")),params:Ib.Optional(Ib.Value({}))}))}))},e.reprBuilder=function(e,t,r){var n=e.state.data.build(),i=e.builders.structure.representation,a=e.managers.structure.component.state.options.hydrogens,o={quality:e.managers.structure.component.state.options.visualQuality,ignoreHydrogens:"all"!==a,ignoreHydrogensVariant:"only-polar"===a?"non-polar":"all",ignoreLight:e.managers.structure.component.state.options.ignoreLight};t.quality&&"auto"!==t.quality&&(o.quality=t.quality),void 0!==t.ignoreHydrogens&&(o.ignoreHydrogens=!!t.ignoreHydrogens),void 0!==t.ignoreHydrogensVariant&&(o.ignoreHydrogensVariant=t.ignoreHydrogensVariant),void 0!==t.ignoreLight&&(o.ignoreLight=!!t.ignoreLight);var s,u=t.theme?.globalName?t.theme?.globalName:void 0,c=void 0===t.theme?.carbonColor?Ac({},t.theme?.globalColorParams):Ac({carbonColor:(s=t.theme?.carbonColor,"chain-id"===s?{name:s,params:YY.defaultValues}:"operator-name"===s?{name:s,params:nK.defaultValues}:{name:s,params:{}})},t.theme?.globalColorParams);return{update:n,builder:i,color:u,symmetryColor:r&&t.theme?.symmetryColor&&function(e){return e.units.some(function(e){return!e.conformation.operator.assembly&&e.conformation.operator.spgrOp>=0})}
139(r)?t.theme?.symmetryColor:u,symmetryColorParams:t.theme?.symmetryColorParams?Ac(Ac({},t.theme?.globalColorParams),t.theme?.symmetryColorParams):Ac({},t.theme?.globalColorParams),globalColorParams:t.theme?.globalColorParams?Ac({},t.theme?.globalColorParams):void 0,typeParams:o,ballAndStickColor:c}},e.updateFocusRepr=function(e,t,r,n){if(e.state.hasBehavior(ore))return e.state.updateBehavior(ore,function(i){var a=Jte(e,t,"ball-and-stick",r||"element-symbol",n);i.surroundingsParams.colorTheme=a,i.targetParams.colorTheme=a})}}(sre||={});var ure=sre.CommonParams,cre=sre.reprBuilder,lre=sre.updateFocusRepr,dre={id:"preset-structure-representation-auto",display:{name:"Automatic",description:"Show representations based on the size of the structure. Smaller structures are shown with more detail than larger ones, ranging from atomistic display to coarse surfaces."},params:function(){return ure},apply:function(e,t,r){var n=hf.resolveAndCheck(r.state.data,e)?.obj?.data;if(!n)return{};var i=r.config.get(j2.Structure.SizeThresholds)||yz.DefaultSizeThresholds,a=yz.getSize(n,i),o=n.polymerResidueCount/n.polymerGapCount;switch(a){case yz.Size.Gigantic:case yz.Size.Huge:return mre.apply(e,t,r);case yz.Size.Large:return gre.apply(e,t,r);case yz.Size.Medium:if(o>3)return hre.apply(e,t,r);case yz.Size.Small:return vre.apply(e,Ac(Ac({},t),{showCarbohydrateSymbol:!0}),r);default:Lg()}}},fre="Basic",hre={id:"preset-structure-representation-polymer-and-ligand",display:{name:"Polymer & Ligand",group:fre,description:"Shows polymers as Cartoon, ligands as Ball & Stick, carbohydrates as 3D-SNFG and water molecules semi-transparent."},params:function(){return ure},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b;return Pc(this,function(_){switch(_.label){case 0:return(n=hf.resolveAndCheck(r.state.data,e))?(b={},[4,bre(r,n,"polymer")]):[2,{}];case 1:return b.polymer=_.sent(),[4,bre(r,n,"ligand")];case 2:return b.ligand=_.sent(),[4,bre(r,n,"non-standard")];case 3:return b.nonStandard=_.sent(),[4,bre(r,n,"branched",{label:"Carbohydrate"})];case 4:return b.branched=_.sent(),[4,bre(r,n,"water")];case 5:return b.water=_.sent(),[4,bre(r,n,"ion")];case 6:return b.ion=_.sent(),[4,bre(r,n,"lipid")];case 7:return b.lipid=_.sent(),[4,bre(r,n,"coarse")];case 8:return b.coarse=_.sent(),i=b,a=n.obj.data,o={sizeFactor:a.isCoarseGrained?.8:.2},s=(i.water?.obj?.data?.elementCount||0)>5e4?"line":"ball-and-stick",u=(i.lipid?.obj?.data?.elementCount||0)>2e4?"line":"ball-and-stick",c=cre(r,t,a),l=c.update,d=c.builder,f=c.typeParams,h=c.color,p=c.symmetryColor,m=c.symmetryColorParam
139s,g=c.globalColorParams,v=c.ballAndStickColor,y={polymer:d.buildRepresentation(l,i.polymer,{type:"cartoon",typeParams:Ac(Ac({},f),o),color:p,colorParams:m},{tag:"polymer"}),ligand:d.buildRepresentation(l,i.ligand,{type:"ball-and-stick",typeParams:f,color:h,colorParams:v},{tag:"ligand"}),nonStandard:d.buildRepresentation(l,i.nonStandard,{type:"ball-and-stick",typeParams:f,color:h,colorParams:v},{tag:"non-standard"}),branchedBallAndStick:d.buildRepresentation(l,i.branched,{type:"ball-and-stick",typeParams:Ac(Ac({},f),{alpha:.3}),color:h,colorParams:v},{tag:"branched-ball-and-stick"}),branchedSnfg3d:d.buildRepresentation(l,i.branched,{type:"carbohydrate",typeParams:f,color:h,colorParams:g},{tag:"branched-snfg-3d"}),water:d.buildRepresentation(l,i.water,{type:s,typeParams:Ac(Ac({},f),{alpha:.6,visuals:"line"===s?["intra-bond","element-point"]:void 0}),color:h,colorParams:Ac({carbonColor:{name:"element-symbol",params:{}}},g)},{tag:"water"}),ion:d.buildRepresentation(l,i.ion,{type:"ball-and-stick",typeParams:f,color:h,colorParams:Ac({carbonColor:{name:"element-symbol",params:{}}},g)},{tag:"ion"}),lipid:d.buildRepresentation(l,i.lipid,{type:u,typeParams:Ac(Ac({},f),{alpha:.6,visuals:"line"===u?["intra-bond"]:void 0}),color:h,colorParams:Ac({carbonColor:{name:"element-symbol",params:{}}},g)},{tag:"lipid"}),coarse:d.buildRepresentation(l,i.coarse,{type:"spacefill",typeParams:f,color:h||"chain-id",colorParams:g},{tag:"coarse"})},[4,l.commit({revertOnError:!1})];case 9:return _.sent(),[4,lre(r,a,t.theme?.focus?.name,t.theme?.focus?.params)];case 10:return _.sent(),[2,{components:i,representations:y}]}})})}},pre={id:"preset-structure-representation-protein-and-nucleic",display:{name:"Protein & Nucleic",group:fre,description:"Shows proteins as Cartoon and RNA/DNA as Gaussian Surface."},params:function(){return ure},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:return(n=hf.resolveAndCheck(r.state.data,e))?(m={},[4,_re(r,n,"protein")]):[2,{}];case 1:return m.protein=g.sent(),[4,_re(r,n,"nucleic")];case 2:return m.nucleic=g.sent(),i=m,a=n.obj.data,o={sizeFactor:a.isCoarseGrained?.8:.2},s={radiusOffset:a.isCoarseGrained?2:0,smoothness:a.isCoarseGrained?1:1.5},u=cre(r,t,a),c=u.update,l=u.builder,d=u.typeParams,f=u.symmetryColor,h=u.symmetryColorParam
139s,p={protein:l.buildRepresentation(c,i.protein,{type:"cartoon",typeParams:Ac(Ac({},d),o),color:f,colorParams:h},{tag:"protein"}),nucleic:l.buildRepresentation(c,i.nucleic,{type:"gaussian-surface",typeParams:Ac(Ac({},d),s),color:f,colorParams:h},{tag:"nucleic"})},[4,c.commit({revertOnError:!0})];case 3:return g.sent(),[4,lre(r,a,t.theme?.focus?.name,t.theme?.focus?.params)];case 4:return g.sent(),[2,{components:i,representations:p}]}})})}},mre={id:"preset-structure-representation-coarse-surface",display:{name:"Coarse Surface",group:fre,description:"Shows polymers and lipids as coarse Gaussian Surface."},params:function(){return ure},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g;return Pc(this,function(v){switch(v.label){case 0:return(n=hf.resolveAndCheck(r.state.data,e))?(g={},[4,bre(r,n,"polymer")]):[2,{}];case 1:return g.polymer=v.sent(),[4,bre(r,n,"lipid")];case 2:return g.lipid=v.sent(),i=g,a=n.obj.data,o=r.config.get(j2.Structure.SizeThresholds)||yz.DefaultSizeThresholds,s=yz.getSize(a,o),u=Object.create(null),s===yz.Size.Gigantic?Object.assign(u,{traceOnly:!a.isCoarseGrained,radiusOffset:2,smoothness:1,visuals:["structure-gaussian-surface-mesh"]}):s===yz.Size.Huge?Object.assign(u,{radiusOffset:a.isCoarseGrained?2:0,smoothness:1}):a.isCoarseGrained&&Object.assign(u,{radiusOffset:2,smoothness:1}),c=cre(r,t,a),l=c.update,d=c.builder,f=c.typeParams,h=c.symmetryColor,p=c.symmetryColorParam
139s,m={polymer:d.buildRepresentation(l,i.polymer,{type:"gaussian-surface",typeParams:Ac(Ac({},f),u),color:h,colorParams:p},{tag:"polymer"}),lipid:d.buildRepresentation(l,i.lipid,{type:"gaussian-surface",typeParams:Ac(Ac({},f),u),color:h,colorParams:p},{tag:"lipid"})},[4,l.commit({revertOnError:!0})];case 3:return v.sent(),[4,lre(r,a,t.theme?.focus?.name,t.theme?.focus?.params)];case 4:return v.sent(),[2,{components:i,representations:m}]}})})}},gre={id:"preset-structure-representation-polymer-cartoon",display:{name:"Polymer Cartoon",group:fre,description:"Shows polymers as Cartoon."},params:function(){return ure},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return(n=hf.resolveAndCheck(r.state.data,e))?(p={},[4,bre(r,n,"polymer")]):[2,{}];case 1:return p.polymer=m.sent(),i=p,a=n.obj.data,o={sizeFactor:a.isCoarseGrained?.8:.2},s=cre(r,t,a),u=s.update,c=s.builder,l=s.typeParams,d=s.symmetryColor,f=s.symmetryColorParams,h={polymer:c.buildRepresentation(u,i.polymer,{type:"cartoon",typeParams:Ac(Ac({},l),o),color:d,colorParams:f},{tag:"polymer"})},[4,u.commit({revertOnError:!0})];case 2:return m.sent(),[4,lre(r,a,t.theme?.focus?.name,t.theme?.focus?.params)];case 3:return m.sent(),[2,{components:i,representations:h}]}})})}},vre={id:"preset-structure-representation-atomic-detail",display:{name:"Atomic Detail",group:fre,description:"Shows everything in atomic detail with Ball & Stick."},params:function(){return Ac(Ac({},ure),{showCarbohydrateSymbol:Ib.Boolean(!1)})},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C;return Pc(this,function(T){switch(T.label){case 0:return(n=hf.resolveAndCheck(r.state.data,e))?(A={},[4,bre(r,n,"all")]):[2,{}];case 1:return A.all=T.sent(),A.branched=void 0,i=A,a=n.obj.data,o=a.elementCount>1e5,s=a.atomicResidueCount&&a.elementCount>1e3&&a.atomicResidueCount/a.elementCount<3,u=a.models[0],c=!!LF.Provider.get(u)||c$.isExhaustive(u),l="ball-and-stick",a.isCoarseGrained?l=a.elementCount>1e6?"point":"spacefill":s&&!c?l="spacefill":o&&(l="line"),(d=t.showCarbohydrateSymbol&&!o&&!s)?(h=(f=Object).assign,p=[i],C={},[4,bre(r,n,"branched",{label:"Carbohydrate"})]):[3,3];case 2:h.apply(f,p.concat([(C.branched=T.sent(),C)])),T.label=3;case 3:return m=cre(r,t,a),g=m.update,v=m.builder,y=m.typeParams,b=m.color,_=m.ballAndStickColor,x=m.globalColorParams,S=s&&!c?Ac({carbonColor:{name:"element-symbol",params:{}}},x):_,w={all:v.buildRepresentation(g,i.all,{type:l,typeParams:y,color:b,colorParams:S},{tag:"all"})},d&&Object.assign(w,{snfg3d:v.buildRepresentation(g,i.branched,{type:"carbohydrate",typeParams:Ac(Ac({},y),{alpha:.4,visuals:["carbohydrate-symbol"]}),color:b,colorParams:x},{tag:"snfg-3d"})}),[4,g.commit({revertOnError:!0})];case 4:return T.sent(),[4,lre(r,a,t.theme?.focus?.name??b,t.theme?.focus?.params??S)];case 5:return T.sent(),[2,{components:i,representations:w}]}})})}},yre={id:"preset-structure-representation-illustrative",display:{name:"Illustrative",group:"Miscellaneous",description:"..."},params:function(){return Ac(Ac({},ure),{showCarbohydrateSymbol:Ib.Boolean(!1)})},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:return(n=hf.resolveAndCheck(r.state.data,e))?(f={},[4,bre(r,n,"all")]):[2,{}];case 1:return f.all=h.sent(),f.branched=void 0,i=f,a=n.obj.data,o=cre(r,t,a),s=o.update,u=o.builder,c=o.typeParams,l=o.color,d={all:u.buildRepresentation(s,i.all,{type:"spacefill",typeParams:Ac(Ac({},c),{ignoreLight:!0}),color:"illustrative"},{tag:"all"})},[4,s.commit({revertOnError:!0})];case 2:return h.sent(),[4,lre(r,a,t.theme?.focus?.name??l,t.theme?.focus?.params)];case 3:return h.sent(),[2,{components:i,representations:d}]}})})}};function bre(e,t,r,n){return e.builders.structure.tryCreateComponentStatic(t,r,n)}function _re(e,t,r,n){return e.builders.structure.tryCreateComponentFromSelection(t,bW[r],`selection-${r}`,n)}var xre={empty:{id:"preset-structure-representation-empty",display:{name:"Empty",description:"Removes all existing representations."},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(e){return[2,{}]})})}}
139,auto:dre,"atomic-detail":vre,"polymer-cartoon":gre,"polymer-and-ligand":hre,"protein-and-nucleic":pre,"coarse-surface":mre,illustrative:yre};function Sre(e,t){if("bcif"===e.ext)try{var r=Xw(t).encoder;if(r.startsWith("VolumeServer"))return"dscif";if(r.startsWith("volseg-volume-server"))return"segcif"}catch(e){console.error(e)}else if("cif"===e.ext){var n=t;if(n.startsWith("data_SERVER\n#\n_density_server_result"))return"dscif";if(n.startsWith("data_SERVER\n#\ndata_SEGMENTATION_DATA"))return"segcif";if(n.includes("atom_site_fract_x")||n.includes("atom_site.fract_x"))return"coreCif"}return-1}var wre="Trajectory";function Are(e,t){return e.builders.structure.hierarchy.applyPreset(t.trajectory,"default")}var Cre={label:"mmCIF",description:"mmCIF",category:wre,stringExtensions:["cif","mmcif","mcif"],binaryExtensions:["bcif"],isApplicable:function(e,t){return"mmcif"===e.ext||"mcif"===e.ext||("cif"===e.ext||"bcif"===e.ext)&&-1===Sre(e,t)},parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i,a;return Pc(this,function(o){switch(o.label){case 0:return n=e.state.data,[4,(i=n.build().to(t).apply(m2.Data.ParseCif,void 0,{state:{isGhost:!0}})).apply(m2.Model.TrajectoryFromMmCif,void 0,{tags:r?.trajectoryTags}).commit({revertOnError:!0})];case 1:return a=o.sent(),((i.selector.cell?.obj)?.data.blocks.length||0)>1&&e.state.data.updateCellState(i.ref,{isGhost:!1}),[2,{trajectory:a}]}})})},visuals:Are},Tre={label:"cifCore",description:"CIF Core",category:wre,stringExtensions:["cif"],isApplicable:function(e,t){return"cif"===e.ext&&"coreCif"===Sre(e,t)},parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i,a;return Pc(this,function(o){switch(o.label){case 0:return n=e.state.data,[4,(i=n.build().to(t).apply(m2.Data.ParseCif,void 0,{state:{isGhost:!0}})).apply(m2.Model.TrajectoryFromCifCore,void 0,{tags:r?.trajectoryTags}).commit({revertOnError:!0})];case 1:return a=o.sent(),((i.selector.cell?.obj)?.data.blocks.length||0)>1&&e.state.data.updateCellState(i.ref,{isGhost:!1}),[2,{trajectory:a}]}})})},visuals:Are};function Pre(e,t){var r=this;return function(n,i,a){return Tc(r,void 0,void 0,function(){return Pc(this,function(r){switch(r.label){case 0:return[4,n.state.data.build().to(i).apply(e,t,{tags:a?.trajectoryTags}).commit({revertOnError:!0})];case 1:return[2,{trajectory:r.sent()}]}})})}}var Ere={label:"PDB",description:"PDB",category:wre,stringExtensions:["pdb","ent"],parse:Pre(m2.Model.TrajectoryFromPDB),visuals:Are},Mre={label:"PDBQT",description:"PDBQT",category:wre,stringExtensions:["pdbqt"],parse:Pre(m2.Model.TrajectoryFromPDB,{isPdbqt:!0}),visuals:Are},kre={label:"XYZ",description:"XYZ",category:wre,stringExtensions:["xyz"],parse:Pre(m2.Model.TrajectoryFromXYZ),visuals:Are},Ire=[["mmcif",Cre],["cifCore",Tre],["pdb",Ere],["pdbqt",Mre],["gro",{label:"GRO",description:"GRO",category:wre,stringExtensions:["gro"],binaryExtensions:[],parse:Pre(m2.Model.TrajectoryFromGRO),visuals:Are}],["xyz",kre],["mol",{label:"MOL",description:"MOL",category:wre,stringExtensions:["mol"],parse:Pre(m2.Model.TrajectoryFromMOL),visuals:Are}],["sdf",{label:"SDF",description:"SDF",category:wre,stringExtensions:["sdf","sd"],parse:Pre(m2.Model.TrajectoryFromSDF),visuals:Are}],["mol2",{label:"MOL2",description:"MOL2",category:wre,stringExtensions:["mol2"],parse:Pre(m2.Model.TrajectoryFromMOL2),visuals:Are}]],Dre=["gz","zip"];function Ore(e){var t=e,r="",n=t.lastIndexOf("?"),i=-1===n?"":t.substring(n),a=(t=t.substring(0,-1===n?t.length:n)).replace(/^.*[\\/]/,""),o=a.substring(0,a.lastIndexOf(".")),s=a.split("."),u=s.length>1?(s.pop()||"").toLowerCase():"",c=t.match(/^(.+):\/\/(.+)$/);c&&(r=c[1].toLowerCase(),t=c[2]||"");var l=t.substring(0,t.lastIndexOf("/")+1);if(Dre.includes(u)){var d=t.length-u.length-1;u=(t.substr(0,d).split(".").pop()||"").toLowerCase();var f=o.length-u.length-1;o=o.substr(0,f)}return{path:t,name:a,ext:u,base:o,dir:l,protocol:r,query:i}}var Rre="Topology",Bre=[["psf",{label:"PSF",description:"PSF",category:Rre,stringExtensions:["psf"],parse:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r=e.state.data.build().to(t).apply(m2.Data.ParsePsf,{},{state:{isGhost:!0}}),n=r.apply(m2.Model.TopologyFromPsf),[4,r.commit()];case 1:return i.sent(),[2,{format:r.selector,topology:n.selector}]}})})}}],["prmtop",{label:"PRMTOP",description:"PRMTOP",category:Rre,stringExtensions:["prmtop","parm7"],parse:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r=e.state.data.build().to(t).apply(m2.Data.ParsePrmtop,{},{state:{isGhost:!0}}),n=r.apply(m2.Model.TopologyFromPrmtop),[4,r.commit()];case 1:return i.sent(),[2,{format:r.selector,topology:n.selector}]}})})}}],["top",{label:"TOP",description:"TOP",category:Rre,stringExtensions:["top"],parse:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r=e.state.data.build().to(t).apply(m2.Data.ParseTop,{},{state:{isGhost:!0}}),n=r.apply(m2.Model.TopologyFromTop),[4,r.commit()];case 1:return i.sent(),[2,{format:r.selector,topology:n.selector}]}})})}}]],Nre="Coordinates",Fre=[["dcd",{label:"DCD",description:"DCD",category:Nre,binaryExtensions:["dcd"],parse:function(e,t){return e.state.data.build().to(t).apply(m2.Model.CoordinatesFromDcd).commit()}}],["xtc",{label:"XTC",description:"XTC",category:Nre,binaryExtensions:["xtc"],parse:function(e,t){return e.state.data.build().to(t).apply(m2.Model.CoordinatesFromXtc).commit()}}],["trr",{label:"TRR",description:"TRR",category:Nre,binaryExtensions:["trr"],parse:function(e,t){return e.state.data.build().to(t).apply(m2.Model.CoordinatesFromTrr).commit()}}],["nctraj",{label:"NCTRAJ",description:"NCTRAJ",category:Nre,binaryExtensions:["nc","nctraj"],parse:function(e,t){return e.state.data.build().to(t).apply(m2.Model.CoordinatesFromNctraj).commit()}}]],Lre={rcsb:Ib.Group({encoding:Ib.Select("bcif",Ib.arrayToOptions(["cif","bcif"]))},{label:"RCSB PDB",isFlat:!0}),pdbe:Ib.Group({variant:Ib.Select("updated-bcif",[["updated-bcif","Updated (bcif)"],["updated","Updated"],["archival","Archival"]])},{label:"PDBe",isFlat:!0}),pdbj:Ib.EmptyGroup({label:"PDBj"})},$re=Db.build({from:DS.Root,display:{name:"Download Structure",description:"Load a structure from the provided source and create its representation."},params:function(e,t){var r=function(e){var t=e.config.get(j2.Structure.DefaultRepresentationPreset)||xre.auto.id;return Ib.Group({type:gq.getParams(void 0,"auto").type,representation:Ib.Select(t,e.builders.structure.representation.getPresets().map(function(e){return[e.id,e.display.name,e.display.group]}),{description:"Which representation preset to use."}),representationParams:Ib.Group(sre.CommonParams,{isHidden:!0}),asTrajectory:Ib.Optional(Ib.Boolean(!1,{description:"Load all entries into a single trajectory."}))},{isExpanded:!1})}(t),n=t.config.get(j2.Download.DefaultPdbProvider)||"pdbe";return{source:Ib.MappedStatic("pdb",{pdb:Ib.Group({provider:Ib.Group({id:Ib.Text("1tqn",{label:"PDB Id(s)",description:"One or more comma/space separated PDB ids."}),server:Ib.MappedStatic(n,Lre)},{pivot:"id"}),options:r},{isFlat:!0,label:"PDB"}),"pdb-dev":Ib.Group({provider:Ib.Group({id:Ib.Text("PDBDEV_00000001",{label:"PDB-Dev Id(s)",description:"One or more comma/space separated ids."}),encoding:Ib.Select("bcif",Ib.arrayToOptions(["cif","bcif"]))},{pivot:"id"}),options:r},{isFlat:!0,label:"PDB-Dev"}),swissmodel:Ib.Group({id:Ib.Text("Q9Y2I8",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:r},{isFlat:!0,label:"SWISS-MODEL",description:"Loads the best homology model or experimental structure"}),alphafolddb:Ib.Group({id:Ib.Text("Q8W3K0",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:r},{isFlat:!0,label:"AlphaFold DB",description:"Loads the predicted model if available"}),modelarchive:Ib.Group({id:Ib.Text("ma-bak-cepc-0003",{label:"Accession Code(s)",description:"One or more comma/space separated ACs."}),options:r},{isFlat:!0,label:"Model Archive"}),pubchem:Ib.Group({id:Ib.Text("2244,2245",{label:"PubChem ID",description:"One or more comma/space separated IDs."}),options:r},{isFlat:!0,label:"PubChem",description:"Loads 3D conformer from PubChem."}),url:Ib.Group({url:Ib.Url(""),format:Ib.Select("mmcif",Ib.arrayToOptions(Ire.map(function(e){return e[0]}),function(e){return e})),isBinary:Ib.Boolean(!1),label:Ib.Optional(Ib.Text("")),options:r},{isFlat:!0,label:"URL"})})}}})(function(e,t){var r=e.params,n=e.state;return vy.create("Download Structure",function(e){return Tc(void 0,void 0,void 0,function(){var i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:switch(t.behaviors.layout.leftPanelTabName.next("data"),i=r.source,o=!1,s="mmcif",i.name){case"url":return[3,1];case"pdb":return[3,2];case"pdb-dev":return[3,4];case"swissmodel":return[3,6];case"alphafolddb":return[3,8];case"modelarchive":return[3,10];case"pubchem":return[3,12]}return[3,14];
139case 1:return a=[{url:i.params.url,isBinary:i.params.isBinary,label:i.params.label||void 0}],s=i.params.format,[3,15];case 2:return[4,"pdbe"===i.params.provider.server.name?jre(i):"pdbj"===i.params.provider.server.name?zre(i):"rcsb"===i.params.provider.server.name?Gre(i):Lg()];case 3:return a=d.sent(),o=!!i.params.options.asTrajectory,[3,15];case 4:return[4,Ure(i.params.provider.id,function(e){var t=e.toUpperCase().startsWith("PDBDEV_")?e:`PDBDEV_${e.padStart(8,"0")}`;return"bcif"===i.params.provider.encoding?`https://pdb-dev.wwpdb.org/bcif/${t.toUpperCase()}.bcif`:`https://pdb-dev.wwpdb.org/cif/${t.toUpperCase()}.cif`},function(e){return e.toUpperCase().startsWith("PDBDEV_")?e:`PDBDEV_${e.padStart(8,"0")}`},"bcif"===i.params.provider.encoding)];case 5:return a=d.sent(),o=!!i.params.options.asTrajectory,[3,15];case 6:return[4,Ure(i.params.id,function(e){return`https://swissmodel.expasy.org/repository/uniprot/${e.toUpperCase()}.pdb`},function(e){return`SWISS-MODEL: ${e}`},!1)];case 7:return a=d.sent(),o=!!i.params.options.asTrajectory,s="pdb",[3,15];case 8:return[4,Ure(i.params.id,function(e){return Tc(void 0,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r=`https://www.alphafold.ebi.ac.uk/api/prediction/${e.toUpperCase()}`,[4,t.runTask(t.fetch({url:r,type:"json"}))];case 1:if(n=i.sent(),Array.isArray(n)&&n.length>0)return[2,n[0].cifUrl];throw Error(`No AlphaFold DB entry for '${e}'`)}})})},function(e){return`AlphaFold DB: ${e}`},!1)];case 9:return a=d.sent(),o=!!i.params.options.asTrajectory,s="mmcif",[3,15];case 10:return[4,Ure(i.params.id,function(e){return`https://www.modelarchive.org/doi/10.5452/${e.toLowerCase()}.cif`},function(e){return`Model Archive: ${e}`},!1)];case 11:return a=d.sent(),o=!!i.params.options.asTrajectory,s="mmcif",[3,15];case 12:return[4,Ure(i.params.id,function(e){return`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/${e.trim()}/record/SDF/?record_type=3d`},function(e){return`PubChem: ${e}`},!1)];case 13:return a=d.sent(),o=!!i.params.options.asTrajectory,s="mol",[3,15];case 14:Lg(),d.label=15;case 15:return u=r.source.params.options.representation||t.config.get(j2.Structure.DefaultRepresentationPreset)||xre.auto.id,c=u!==xre.empty.id,l="auto"===i.params.options.type.name?void 0:i.params.options.type,[4,n.transaction(function(){return Tc(void 0,void 0,void 0,function(){var e,n,i,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return a.length>0&&o?[4,t.builders.data.downloadBlob({sources:a.map(function(e,t){return{id:""+t,url:e.url,isBinary:e.isBinary}}),maxConcurrency:6},{state:{isGhost:!0}})]:[3,4];case 1:return e=m.sent(),[4,t.builders.structure.parseTrajectory(e,{formats:a.map(function(e,t){return{id:""+t,format:"cif"}})})];case 2:return p=m.sent(),[4,t.builders.structure.hierarchy.applyPreset(p,"default",{structure:l,showUnitcell:c,representationPreset:u,representationPresetParams:r.source.params.options.representationParams})];case 3:return m.sent(),[3,10];case 4:n=0,i=a,m.label=5;case 5:return n<i.length?(d=i[n],[4,t.builders.data.download(d,{state:{isGhost:!0}})]):[3,10];case 6:if(f=m.sent(),!(h="auto"===s?t.dataFormats.auto(Ore(Cb.getUrl(d.url)),f.cell?.obj):t.dataFormats.get(s)))throw Error("unknown file format");return[4,t.builders.structure.parseTrajectory(f,h)];case 7:return p=m.sent(),[4,t.builders.structure.hierarchy.applyPreset(p,"default",{structure:l,showUnitcell:c,representationPreset:u,representationPresetParams:r.source.params.options.representationParams})];case 8:m.sent(),m.label=9;case 9:return n++,[3,5];case 10:return[2]}})})}).runInContext(e)];case 16:return d.sent(),[2]}})})})});function Ure(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h;return Pc(this,function(p){switch(p.label){case 0:i=e.split(/[,\s]/).map(function(e){return e.trim()}).filter(function(e){return!!e&&(e.length>=4||/^[1-9][0-9]*$/.test(e))}),a=[],o=0,s=i,p.label=1;case 1:return o<s.length?(u=s[o],l=(c=a).push,h={},f=(d=Cb).Url,[4,t(u)]):[3,4];case 2:l.apply(c,[(h.url=f.apply(d,[p.sent()]),h.isBinary=n,h.label=r(u),h)]),p.label=3;case 3:return o++,[3,1];case 4:return[2,a]}})})}function jre(e){return Tc(this,void 0,void 0,function(){return Pc(this,function(t){if("pdb"!==e.name||"pdbe"!==e.params.provider.server.name)throw Error("expected pdbe");return[2,"updated"===e.params.provider.server.params.variant?Ure(e.params.provider.id,function(e){return`https://www.ebi.ac.uk/pdbe/static/entry/${e.toLowerCase()}_updated.cif`},function(e){return`PDBe: ${e} (updated cif)`},!1):"updated-bcif"===e.params.provider.server.params.variant?Ure(e.params.provider.id,function(e){return`https://www.ebi.ac.uk/pdbe/entry-files/download/${e.toLowerCase()}.bcif`},function(e){return`PDBe: ${e} (updated cif)`},!0):Ure(e.params.provider.id,function(e){return`https://www.ebi.ac.uk/pdbe/static/entry/${e.toLowerCase()}.cif`},function(e){return`PDBe: ${e} (cif)`},!1)]})})}function zre(e){return Tc(this,void 0,void 0,function(){return Pc(this,function(t){if("pdb"!==e.name||"pdbj"!==e.params.provider.server.name)throw Error("expected pdbj");return[2,Ure(e.params.provider.id,function(e){return`https://data.pdbjbk1.pdbj.org/pub/pdb/data/structures/divided/mmCIF/${e.toLowerCase().substring(1,3)}/${e.toLowerCase()}.cif`},function(e){return`PDBj: ${e} (cif)`},!1)]})})}function Gre(e){return Tc(this,void 0,void 0,function(){return Pc(this,function(t){if("pdb"!==e.name||"rcsb"!==e.params.provider.server.name)throw Error("expected rcsb");return[2,"cif"===e.params.provider.server.params.encoding?Ure(e.params.provider.id,function(e){return`https://files.rcsb.org/download/${e.toUpperCase()}.cif`},function(e){return`RCSB PDB: ${e} (cif)`},!1):Ure(e.params.provider.id,function(e){return`https://models.rcsb.org/${e.toUpperCase()}.bcif`},function(e){return`RCSB PDB: ${e} (bcif)`},!0)]})})}var Vre=Db.build({display:{name:"Update Trajectory"},params:{action:Ib.Select("advance",Ib.arrayToOptions(["advance","reset"])),by:Ib.Optional(Ib.Numeric(1,{min:-1,max:1,step:1}))}})(function(e){var t=e.params,r=e.state,n=r.selectQ(function(e){return e.ofTransformer(m2.Model.ModelFromTrajectory)}),i=r.build();if("reset"===t.action)for(var a=0,o=n;a<o.length;a++){var s=o[a];i.to(s).update({modelIndex:0})}
139else for(var u=function(e){var n=Zb.findAncestorOfType(r.tree,r.cells,e.transform.ref,DS.Molecule.Trajectory);if(!n||!n.obj)return"continue";var a=n.obj;i.to(e).update(function(e){var r=(e.modelIndex+t.by)%a.data.frameCount;return r<0&&(r+=a.data.frameCount),{modelIndex:r}})},c=0,l=n;c<l.length;c++)u(s=l[c]);return r.updateTree(i)}),Hre=Db.build({display:{name:"Custom Model Properties",description:"Enable parameters for custom properties of the model."},from:DS.Molecule.Model,params:function(e,t){return t.customModelProperties.getParams(e?.data)},isApplicable:function(e,t,r){return t.transformer!==lY}})(function(e,t){var r=e.ref,n=e.params;return t.builders.structure.insertModelProperties(r,n)}),qre=Db.build({display:{name:"Custom Structure Properties",description:"Enable parameters for custom properties of the structure."},from:DS.Molecule.Structure,params:function(e,t){return t.customStructureProperties.getParams(e?.data)},isApplicable:function(e,t,r){return t.transformer!==fY}})(function(e,t){var r=e.ref,n=e.params;return t.builders.structure.insertStructureProperties(r,n)}),Wre=Db.build({display:{name:"Add Trajectory",description:"Add trajectory from existing model/topology and coordinates."},from:DS.Root,params:function(e,t){var r=t.state.data,n=kc(kc([],r.selectQ(function(e){return e.rootsOfType(DS.Molecule.Model)}),!0),r.selectQ(function(e){return e.rootsOfType(DS.Molecule.Topology)}),!0).map(function(e){return[e.transform.ref,e.obj.label]}),i=r.selectQ(function(e){return e.rootsOfType(DS.Molecule.Coordinates)}).map(function(e){return[e.transform.ref,e.obj.label]});return{model:Ib.Select(n.length?n[0][0]:"",n),coordinates:Ib.Select(i.length?i[0][0]:"",i)}}})(function(e,t){var r=e.params,n=e.state;return vy.create("Add Trajectory",function(e){return n.transaction(function(){return Tc(void 0,void 0,void 0,function(){var i,a,o;return Pc(this,function(s){switch(s.label){case 0:return i=[r.model,r.coordinates],a=n.build().toRoot().apply(BX,{modelRef:r.model,coordinatesRef:r.coordinates},{dependsOn:i}).apply(m2.Model.ModelFromTrajectory,{modelIndex:0}),[4,n.updateTree(a).runInContext(e)];case 1:return s.sent(),[4,t.builders.structure.createStructure(a.selector)];case 2:return o=s.sent(),[4,t.builders.structure.representation.applyPreset(o,"auto")];case 3:return s.sent(),[2]}})})}).runInContext(e)})}),Xre=Db.build({display:{name:"Load Trajectory",description:"Load trajectory of model/topology and coordinates from URL or file."},from:DS.Root,params:function(e,t){for(var r=t.dataFormats.options,n=r.filter(function(e){return e[2]===wre||e[2]===Rre}),i=r.filter(function(e){return e[2]===Nre}),a=[],o=[],s=0,u=t.dataFormats.list;s<u.length;s++){var c=u[s].provider;c.category===wre||c.category===Rre?(c.binaryExtensions&&a.push.apply(a,c.binaryExtensions),c.stringExtensions&&a.push.apply(a,c.stringExtensions)):c.category===Nre&&(c.binaryExtensions&&o.push.apply(o,c.binaryExtensions),c.stringExtensions&&o.push.apply(o,c.stringExtensions))}return{source:Ib.MappedStatic("file",{url:Ib.Group({model:Ib.Group({url:Ib.Url(""),format:Ib.Select(n[0][0],n),isBinary:Ib.Boolean(!1)},{isExpanded:!0}),coordinates:Ib.Group({url:Ib.Url(""),format:Ib.Select(i[0][0],i)},{isExpanded:!0})},{isFlat:!0}),file:Ib.Group({model:Ib.File({accept:a.map(function(e){return`.${e}`}).join(","),label:"Model"}),coordinates:Ib.File({accept:o.map(function(e){return`.${e}`}).join(","),label:"Coordinates"})},{isFlat:!0})},{options:[["url","URL"],["file","File"]]})}}})(function(e,t){var r=e.params,n=e.state;return vy.create("Load Trajectory",function(e){return n.transaction(function(){return Tc(void 0,void 0,void 0,function(){var i,a,o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:if("file"===(i=r.source).name&&(null===i.params.model||null===i.params.coordinates))return t.log.error("No file(s) selected"),[2];if(!("url"!==i.name||i.params.model&&i.params.coordinates))return t.log.error("No URL(s) given"),[2];a=function(e,r,n){return Tc(void 0,void 0,void 0,function(){var i,a;return Pc(this,function(o){switch(o.label){case 0:return[4,t.builders.data.download({url:e,isBinary:n})];case 1:return i=o.sent(),(a=t.dataFormats.get(r))?[2,a.parse(t,i)]:(t.log.warn(`LoadTrajectory: could not find data provider for '${r}'`),[2])}})})},o=function(e){return Tc(void 0,void 0,void 0,function(){var r,n,i,a;return Pc(this,function(o){switch(o.label){case 0:if(!e)throw Error("No file selected");return r=Ore(e.file?.name??""),n=t.dataFormats.binaryExtensions.has(r.ext),[4,t.builders.data.readFile({file:e,isBinary:n})];case 1:return i=o.sent().data,(a=t.dataFormats.auto(r,i.cell?.obj))?[3,3]:(t.log.warn(`LoadTrajectory: could not find data provider for '${r.ext}'`),[4,t.state.data.build().delete(i).commit()]);case 2:return o.sent(),[2];case 3:return[2,a.parse(t,i)]}})})},g.label=1;case 1:return g.trys.push([1,16,,17]),"url"===i.name?[4,a(i.params.model.url,i.params.model.format,i.params.model.isBinary)]:[3,3];case 2:return u=g.sent(),[3,5];case 3:return[4,o(i.params.model)];case 4:u=g.sent(),g.label=5;case 5:return c=void 0,"trajectory"in(s=u)?[4,n.build().to(s.trajectory).apply(YX,{modelIndex:0}).commit()]:[3,7];case 6:return c=g.sent(),[3,8];case 7:c=s.topology,g.label=8;case 8:return"url"===i.name?[4,a(i.params.coordinates.url,i.params.coordinates.format,!0)]:[3,10];case 9:return d=g.sent(),[3,12];case 10:return[4,o(i.params.coordinates)];case 11:d=g.sent(),g.label=12;case 12:return l=d,f=[c.ref,l.ref],h=n.build().toRoot().apply(BX,{modelRef:c.ref,coordinatesRef:l.ref},{dependsOn:f}).apply(m2.Model.ModelFromTrajectory,{modelIndex:0}),[4,n.updateTree(h).runInContext(e)];case 13:return g.sent(),[4,t.builders.structure.createStructure(h.selector)];case 14:return p=g.sent(),[4,t.builders.structure.representation.applyPreset(p,"auto")];case 15:return g.sent(),[3,17];case 16:return m=g.sent(),console.error(m),t.log.error("Error loading trajectory"),[3,17];case 17:return[2]}})})}).runInContext(e)}
139)}),Yre=Object.freeze({__proto__:null,AddTrajectory:Wre,DownloadStructure:$re,EnableModelCustomProps:Hre,EnableStructureCustomProps:qre,LoadTrajectory:Xre,PdbDownloadProvider:Lre,UpdateTrajectory:Vre}),Kre=Db.build({from:DS.Root,display:{name:"Download Density",description:"Load a density from the provided source and create its default visual."},params:function(e,t){var r=t.dataFormats.options;return{source:Ib.MappedStatic("pdb-xray",{"pdb-xray":Ib.Group({provider:Ib.Group({id:Ib.Text("1tqn",{label:"Id"}),server:Ib.Select("rcsb",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),type:Ib.Select("2fofc",[["2fofc","2Fo-Fc"],["fofc","Fo-Fc"]])},{isFlat:!0}),"pdb-xray-ds":Ib.Group({provider:Ib.Group({id:Ib.Text("1tqn",{label:"Id"}),server:Ib.Select("pdbe",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),detail:Ib.Numeric(3,{min:0,max:6,step:1},{label:"Detail"})},{isFlat:!0}),"pdb-emd-ds":Ib.Group({provider:Ib.Group({id:Ib.Text("emd-8004",{label:"Id"}),server:Ib.Select("pdbe",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),detail:Ib.Numeric(3,{min:0,max:6,step:1},{label:"Detail"})},{isFlat:!0}),url:Ib.Group({url:Ib.Url(""),isBinary:Ib.Boolean(!1),format:Ib.Select("auto",r)},{isFlat:!0})},{options:[["pdb-xray","PDB X-ray maps"],["pdb-emd-ds","PDB EMD Density Server"],["pdb-xray-ds","PDB X-ray Density Server"],["url","URL"]]})}}})(function(e,t){var r=e.params;return vy.create("Download Density",function(e){return Tc(void 0,void 0,void 0,function(){var e,n,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:switch((e=r.source).name){case"url":n=e.params;break;case"pdb-xray":n="pdbe"===e.params.provider.server?{url:Cb.Url("2fofc"===e.params.type?`https://www.ebi.ac.uk/pdbe/coordinates/files/${e.params.provider.id.toLowerCase()}.ccp4`:`https://www.ebi.ac.uk/pdbe/coordinates/files/${e.params.provider.id.toLowerCase()}_diff.ccp4`),isBinary:!0,label:`PDBe X-ray map: ${e.params.provider.id}`}:{url:Cb.Url("2fofc"===e.params.type?`https://edmaps.rcsb.org/maps/${e.params.provider.id.toLowerCase()}_2fofc.dsn6`:`https://edmaps.rcsb.org/maps/${e.params.provider.id.toLowerCase()}_fofc.dsn6`),isBinary:!0,label:`RCSB X-ray map: ${e.params.provider.id}`};break;case"pdb-emd-ds":n="pdbe"===e.params.provider.server?{url:Cb.Url(`https://www.ebi.ac.uk/pdbe/densities/emd/${e.params.provider.id.toLowerCase()}/cell?detail=${e.params.detail}`),isBinary:!0,label:`PDBe EMD Density Server: ${e.params.provider.id}`}:{url:Cb.Url(`https://maps.rcsb.org/em/${e.params.provider.id.toLowerCase()}/cell?detail=${e.params.detail}`),isBinary:!0,label:`RCSB PDB EMD Density Server: ${e.params.provider.id}`};break;case"pdb-xray-ds":n="pdbe"===e.params.provider.server?{url:Cb.Url(`https://www.ebi.ac.uk/pdbe/densities/x-ray/${e.params.provider.id.toLowerCase()}/cell?detail=${e.params.detail}`),isBinary:!0,label:`PDBe X-ray Density Server: ${e.params.provider.id}`}:{url:Cb.Url(`https://maps.rcsb.org/x-ray/${e.params.provider.id.toLowerCase()}/cell?detail=${e.params.detail}`),isBinary:!0,label:`RCSB PDB X-ray Density Server: ${e.params.provider.id}`};break;default:Lg()}return[4,t.builders.data.download(n)];case 1:switch(a=u.sent(),o=void 0,e.name){case"url":n=e.params,i="auto"===e.params.format?t.dataFormats.auto(Ore(Cb.getUrl(n.url)),a.cell?.obj):t.dataFormats.get(e.params.format);break;case"pdb-xray":o=e.params.provider.id,i="pdbe"===e.params.provider.server?t.dataFormats.get("ccp4"):t.dataFormats.get("dsn6");break;case"pdb-emd-ds":case"pdb-xray-ds":o=e.params.provider.id,i=t.dataFormats.get("dscif");break;default:Lg()}return i?[4,i.parse(t,a,{entryId:o})]:(t.log.warn("DownloadDensity: Format provider not found."),[2]);case 2:return s=u.sent(),[4,i.visuals?.call(i,t,s)];case 3:return u.sent(),[2]}})})})}),Zre=Db.build({display:{name:"Assign Volume Colors",description:"Assigns another volume to be available for coloring."},from:DS.Volume.Data,isApplicable:function(e){return!e.data.colorVolume},params:function(e,t){var r=t.state.data.select(Zb.Generators.root.subtree().ofType(DS.Volume.Data).filter(function(t){return!!t.obj&&!t.obj?.data.colorVolume&&t.obj!==e}));return 0===r.length?{ref:Ib.Text("",{isHidden:!0,label:"Volume"})}:{ref:Ib.Select(r[0].transform.ref,r.map(function(e){return[e.transform.ref,e.obj.label]}),{label:"Volume"})}}})(function(e,t){var r=e.ref,n=e.params;return e.state,t.build().to(r).apply(m2.Volume.AssignColorVolume,{ref:n.ref},{dependsOn:[n.ref]}).commit()}),Qre=Object.freeze({__proto__:null,AssignColorVolume:Zre,DownloadDensity:Kre});function Jre(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return i=Ore(e.file?.name??""),a=t.dataFormats.binaryExtensions.has(i.ext),[4,t.builders.data.readFile({file:e,isBinary:a})];case 1:return o=c.sent().data,(s="auto"===r?t.dataFormats.auto(i,o.cell?.obj):t.dataFormats.get(r))?[3,3]:(t.log.warn(`OpenFiles: could not find data provider for '${i.ext}'`),[4,t.state.data.build().delete(o).commit()]);case 2:return c.sent(),[2];case 3:return[4,s.parse(t,o)];case 4:return u=c.sent(),n?[4,s.visuals?.call(s,t,u)]:[3,6];case 5:c.sent(),c.label=6;case 6:return[2]}})})}var ene,tne,rne=Db.build({display:{name:"Open Files",description:"Load one or more files and optionally create default visual
139s"},from:DS.Root,params:function(e,t){var r=t.dataFormats,n=r.extensions,i=r.options;return{files:Ib.FileList({accept:Array.from(n.values()).map(function(e){return`.${e}`}).join(",")+",.gz,.zip",multiple:!0}),format:Ib.MappedStatic("auto",{auto:Ib.EmptyGroup(),specific:Ib.Select(i[0][0],i)}),visuals:Ib.Boolean(!0,{description:"Add default visuals"})}}})(function(e,t){var r=e.params,n=e.state;return vy.create("Open Files",function(e){return Tc(void 0,void 0,void 0,function(){return Pc(this,function(i){switch(i.label){case 0:return t.behaviors.layout.leftPanelTabName.next("data"),[4,n.transaction(function(){return Tc(void 0,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:if(null===r.files)return t.log.error("No file(s) selected"),[2];n=0,i=r.files,g.label=1;case 1:if(!(n<i.length))return[3,14];a=i[n],g.label=2;case 2:return g.trys.push([2,12,,13]),a.file&&a.name.toLowerCase().endsWith(".zip")?(s=lb,u=[e],[4,a.file.arrayBuffer()]):[3,9];case 3:return[4,s.apply(void 0,u.concat([g.sent()]))];case 4:o=g.sent(),c=0,l=Object.entries(o),g.label=5;case 5:return c<l.length?(d=l[c],f=d[0],(h=d[1])instanceof Uint8Array&&0!==h.length?[4,Jre(Cb.File(new File([h],f)),t,"auto",r.visuals)]:[3,7]):[3,8];case 6:g.sent(),g.label=7;case 7:return c++,[3,5];case 8:return[3,11];case 9:return p="auto"===r.format.name?"auto":r.format.params,[4,Jre(a,t,p,r.visuals)];case 10:g.sent(),g.label=11;case 11:return[3,13];case 12:return m=g.sent(),console.error(m),t.log.error(`Error opening file '${a.name}'`),[3,13];case 13:return n++,[3,1];case 14:return[2]}})})}).runInContext(e)];case 1:return i.sent(),[2]}})})})}),nne=Db.build({display:{name:"Download File",description:"Load one or more file from an URL"},from:DS.Root,params:function(e,t){var r=kc(kc([],t.dataFormats.options,!0),[["zip","Zip"],["gzip","Gzip"]],!1);return{url:Ib.Url(""),format:Ib.Select(r[0][0],r),isBinary:Ib.Boolean(!1),visuals:Ib.Boolean(!0,{description:"Add default visuals"})}}})(function(e,t){var r=e.params,n=e.state;return vy.create("Open Files",function(e){return Tc(void 0,void 0,void 0,function(){return Pc(this,function(i){switch(i.label){case 0:return t.behaviors.layout.leftPanelTabName.next("data"),[4,n.transaction(function(){return Tc(void 0,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return m.trys.push([0,15,,16]),"zip"!==r.format&&"gzip"!==r.format?[3,10]:[4,t.builders.data.download({url:r.url,isBinary:!0})];case 1:return f=m.sent(),"zip"===r.format?[4,lb(e,(f.obj?.data).buffer)]:[3,7];case 2:n=m.sent(),i=0,a=Object.entries(n),m.label=3;case 3:return i<a.length?(o=a[i],s=o[0],(u=o[1])instanceof Uint8Array&&0!==u.length?[4,Jre(Cb.File(new File([u],s)),t,"auto",r.visuals)]:[3,5]):[3,6];case 4:m.sent(),m.label=5;case 5:return i++,[3,3];case 6:return[3,9];case 7:return c=Cb.getUrl(r.url),l=Ore(c).name,[4,Jre(Cb.File(new File([f.obj?.data],l)),t,"auto",r.visuals)];case 8:m.sent(),m.label=9;case 9:return[3,14];case 10:return(d=t.dataFormats.get(r.format))?[4,t.builders.data.download({url:r.url,isBinary:r.isBinary})]:(t.log.warn(`DownloadFile: could not find data provider for '${r.format}'`),[2]);case 11:return f=m.sent(),[4,d.parse(t,f)];case 12:return h=m.sent(),r.visuals?[4,d.visuals?.call(d,t,h)]:[3,14];case 13:m.sent(),m.label=14;case 14:return[3,16];case 15:return p=m.sent(),console.error(p),t.log.error(`Error downloading '${"string"==typeof r.url?r.url:r.url.url}'`),[3,16];case 16:return[2]}})})}).runInContext(e)];case 1:return i.sent(),[2]}})})})}),ine={Structure:Yre,Volume:Qre,DataFormat:Object.freeze({__proto__:null,DownloadFile:nne,OpenFiles:rne})},ane=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(DS.Create({name:"Volume Streaming",typeClass:"Object"}));function one(e,t,r,n){return Tc(this,void 0,void 0,function(){return Pc(this,function(i){switch(e){case"emdb":return[2,sne(t,r,n)];case"pdbe":return[2,une(t,r,n)]}return[2]})})}function sne(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return n=e.config.get(j2.VolumeStreaming.EmdbHeaderServer),[4,e.fetch({url:`${n}/${r.toUpperCase()}/header/${r.toLowerCase()}.xml`,type:"xml"}).runInContext(t)];case 1:for(i=c.sent(),a=i.getElementsByTagName("map")[0],o=a.getElementsByTagName("contour"),s=o[0],u=1;u<o.length;u++)if("true"===o[u].getAttribute("primary")){s=o[u];break}return[2,parseFloat(s.getElementsByTagName("level")[0].textContent)]}})})}function une(e,t,r){return Tc(this,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return r=r.toUpperCase(),[4,e.fetch({url:`https://www.ebi.ac.uk/emdb/api/entry/map/${r}`,type:"json"}).runInContext(t)];
139case 1:return n=a.sent(),(i=n?.map?.contour_list?.contour)&&0!==i.length?[2,i.find(function(e){return e.primary})?.level??i[0].level]:[2,cne(e,t,r)]}})})}function cne(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a;return Pc(this,function(o){switch(o.label){case 0:return r=r.toUpperCase(),[4,e.fetch({url:`https://www.ebi.ac.uk/pdbe/api/emdb/entry/map/${r}`,type:"json"}).runInContext(t)];case 1:return n=o.sent(),i=n?.[r],a=void 0,void 0!==i?.[0]?.map?.contour_level?.value&&(a=+i[0].map.contour_level.value),[2,a]}})})}function lne(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return[4,e.fetch({url:`https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/${r}`,type:"json"}).runInContext(t)];case 1:if(n=s.sent(),i=n?.[r],a=[],!i?.[0]?.related_structures||(o=i[0].related_structures.filter(function(e){return"EMDB"===e.resource&&"associated EM volume"===e.relationship}),!o.length))throw Error(`No related EMDB entry found for '${r}'.`);return a.push.apply(a,o.map(function(e){return e.accession})),[2,a]}})})}(function(e){var t;(t=e.ValueType||={}).Float32="float32",t.Int8="int8"})(ene||={}),function(e){e.create=function(e){return{entries:pS(),capacity:Math.max(1,e)}},e.get=function(e,t){for(var r=e.entries.first;r;r=r.next)if(r.value.key===t)return e.entries.remove(r),e.entries.addLast(r.value),r.value.data},e.set=function(e,t,r){var n=void 0;if(e.entries.count>=e.capacity){var i=e.entries.first;n=i.value.data,e.entries.remove(i)}return e.entries.addLast(function(e,t){return{key:e,data:t}}(t,r)),n},e.remove=function(e,t){for(var r=e.entries.first;r;r=r.next)if(r.value.key===t){e.entries.remove(r);break}}}(tne||={});var dne=function(){function e(e){void 0===e&&(e=!1),this.isRunning=!1,this.queue=[],this.counter=0,this.log=e}return e.prototype.enqueue=function(e){this.log&&console.log("SingleAsyncQueue enqueue",this.counter),this.queue[0]={id:this.counter,func:e},this.counter++,this.run()},e.prototype.run=function(){return Tc(this,void 0,void 0,function(){var e;return Pc(this,function(t){switch(t.label){case 0:if(this.isRunning||!(e=this.queue.pop()))return[2];this.isRunning=!0,t.label=1;case 1:return t.trys.push([1,,3,4]),this.log&&console.log("SingleAsyncQueue run",e.id),[4,e.func()];case 2:return t.sent(),this.log&&console.log("SingleAsyncQueue complete",e.id),[3,4];case 3:return this.isRunning=!1,this.run(),[7];case 4:return[2]}})})},e}(),fne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t}(DS.CreateBehavior({name:"Volume Streaming"}));function hne(e,t,r){return{i:e,j:t,k:r}}function pne(e,t){return{a:e,b:t}}!function(e){function t(e,t,r,n,i){var a;return void 0===i&&(i={}),Ib.Group({isoValue:gR.createIsoValueParam(i.isoValue??r,n),color:Ib.Color(i.color??t),wireframe:Ib.Boolean(null!=(a=i.wireframe)&&a),opacity:Ib.Numeric(i.opacity??.3,{min:0,max:1,step:.01})},{label:e,isExpanded:!0})}e.RootTag="volume-streaming-info";var r={byteOffset:0,rate:1,sampleCount:[1,1,1],valuesInfo:[{mean:0,min:-1,max:1,sigma:.1},{mean:0,min:-1,max:1,sigma:.1}]};function n(n){var a=n.entryData,o=n.defaultView,s=n.structure,u=n.channelParams,c=void 0===u?{}:u,l=a||{kind:"em",header:{sampling:[r],availablePrecisions:[{precision:0,maxVoxels:0}]},emDefaultContourLevel:gR.IsoValue.relative(0)},d=s&&s.boundary.box||YE();return{view:Ib.MappedStatic(o||("em"===l.kind?"auto":"selection-box"),{off:Ib.Group({}),box:Ib.Group({bottomLeft:Ib.Vec3(d.min),topRight:Ib.Vec3(d.max)},{description:"Static box defined by cartesian coords.",isFlat:!0}),"selection-box":Ib.Group({radius:Ib.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in Å within which the volume is shown."}),bottomLeft:Ib.Vec3(Cg.create(0,0,0),{},{isHidden:!0}),topRight:Ib.Vec3(Cg.create(0,0,0),{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0}),"camera-target":Ib.Group({radius:Ib.Numeric(.5,{min:0,max:1,step:.05},{description:"Radius within which the volume is shown (relative to the field of view)."}),dynamicDetailLevel:i(l.header.availablePrecisions,0,{label:"Dynamic Detail"}),bottomLeft:Ib.Vec3(Cg.create(0,0,0),{},{isHidden:!0}),topRight:Ib.Vec3(Cg.create(0,0,0),{},{isHidden:!0})},{description:"Box around camera target.",isFlat:!0}),cell:Ib.Group({}
139),auto:Ib.Group({radius:Ib.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in Å within which the volume is shown."}),selectionDetailLevel:i(l.header.availablePrecisions,6,{label:"Selection Detail"}),isSelection:Ib.Boolean(!1,{isHidden:!0}),bottomLeft:Ib.Vec3(d.min,{},{isHidden:!0}),topRight:Ib.Vec3(d.max,{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0})},{options:e.ViewTypeOptions,description:'Controls what of the volume is displayed. "Off" hides the volume alltogether. "Bounded box" shows the volume inside the given box. "Around Interaction" shows the volume around the focused element/atom. "Whole Structure" shows the volume for the whole structure.'}),detailLevel:i(l.header.availablePrecisions,3),channels:"em"===l.kind?Ib.Group({em:t("EM",tv(6524815),l.emDefaultContourLevel||gR.IsoValue.relative(1),l.header.sampling[0].valuesInfo[0],c.em)},{isFlat:!0}):Ib.Group({"2fo-fc":t("2Fo-Fc",tv(3367602),gR.IsoValue.relative(1.5),l.header.sampling[0].valuesInfo[0],c["2fo-fc"]),"fo-fc(+ve)":t("Fo-Fc(+ve)",tv(3390259),gR.IsoValue.relative(3),l.header.sampling[0].valuesInfo[1],c["fo-fc(+ve)"]),"fo-fc(-ve)":t("Fo-Fc(-ve)",tv(12268339),gR.IsoValue.relative(-3),l.header.sampling[0].valuesInfo[1],c["fo-fc(-ve)"])},{isFlat:!0})}}function i(e,t,r){return Ib.Select(Math.min(t,e.length-1),e.map(function(e,t){return[t,`${t+1} [ ${0|e.maxVoxels**(1/3)}^3 cells ]`]}),Ac({description:"Determines the maximum number of voxels. Depending on the size of the volume options are in the range from 1 (0.52M voxels) to 7 (25.17M voxels)."},r))}function a(e){return{entry:{name:e.entry.name,params:{detailLevel:e.entry.params.detailLevel,channels:e.entry.params.channels,view:{name:e.entry.params.view.name,params:Ac({},e.entry.params.view.params)}}}}}e.createParams=function(e){void 0===e&&(e={});var t=e.data,r=e.defaultView,i=e.channelParams,a=new Map;t&&t.entries.forEach(function(e){return a.set(e.dataId,e)});var o=t?t.entries.map(function(e){return[e.dataId,e.dataId]}):[],s=t?t.entries[0].dataId:"";return{entry:Ib.Mapped(s,o,function(e){return Ib.Group(n({entryData:a.get(e),defaultView:r,structure:t&&t.structure,channelParams:i}
139))})}},e.createEntryParams=n,e.copyParams=a,e.ViewTypeOptions=[["off","Off"],["box","Bounded Box"],["selection-box","Around Focus"],["camera-target","Around Camera"],["cell","Whole Structure"],["auto","Auto"]],e.ChannelTypeOptions=[["em","em"],["2fo-fc","2fo-fc"],["fo-fc(+ve)","fo-fc(+ve)"],["fo-fc(-ve)","fo-fc(-ve)"]],e.Behavior=function(e){function t(t,r){var n,i,a=e.call(this,t,{})||this;return a.plugin=t,a.data=r,a.cache=tne.create(25),a.params={},a.lastLoci=EQ,a.ref="",a.cameraTargetObservable=a.plugin.canvas3d.didDraw.pipe(ux(500,void 0,{leading:!0,trailing:!0}),rx(function(){return a.plugin.canvas3d?.camera.getSnapshot()}),(n=function(e,t){return a.isCameraTargetSame(e,t)},void 0===i&&(i=__),n??=sx,w_(function(e,t){var r,a=!0;e.subscribe(A_(t,function(e){var o=i(e);!a&&n(r,o)||(a=!1,r=o,t.next(e))}))})),ax(function(e){return void 0!==e})),a.cameraTargetSubscription=void 0,a.channels={},a._invTransform=Og(),a.infoMap=new Map,a.data.entries.forEach(function(e){return a.infoMap.set(e.dataId,e)}),a.updateQueue=new dne,a}return wc(t,e),Object.defineProperty(t.prototype,"info",{get:function(){return this.infoMap.get(this.params.entry.name)},enumerable:!1,configurable:!0}),t.prototype.queryData=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return t=F2(this.data.serverUrl,`${this.info.kind}/${this.info.dataId.toLowerCase()}`),e?(r=e.min,n=e.max,t+=`/box/${r.map(function(e){return Math.round(1e3*e)/1e3}).join(",")}/${n.map(function(e){return Math.round(1e3*e)/1e3}).join(",")}`):t+="/cell",i=this.params.entry.params.detailLevel,"auto"===this.params.entry.params.view.name&&this.params.entry.params.view.params.isSelection&&(i=this.params.entry.params.view.params.selectionDetailLevel),"camera-target"===this.params.entry.params.view.name&&e&&(i=this.decideDetail(e,this.params.entry.params.view.params.dynamicDetailLevel)),t+=`?detail=${i}`,(a=tne.get(this.cache,t))?[2,a.data]:(o=Cb.getUrlAsset(this.plugin.managers.asset,t),[4,this.plugin.runTask(this.plugin.managers.asset.resolve(o,"binary"))]);case 1:return s=l.sent(),[4,this.parseCif(s.data)];case 2:return(u=l.sent())?((c=tne.set(this.cache,t,{data:u,asset:s}))&&c.asset.dispose(),[2,u]):[2]}})})},t.prototype.parseCif=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:return[4,this.plugin.runTask(JA.parseBinary(e))];case 1:if((t=s.sent()).isError)return this.plugin.log.error("VolumeStreaming, parsing CIF: "+t.toString()),[2];if(t.result.blocks.length<2)return this.plugin.log.error("VolumeStreaming: Invalid data."),[2];r={},n=1,s.label=2;case 2:return n<t.result.blocks.length?(i=t.result.blocks[n],a=JA.schema.densityServer(i),[4,this.plugin.runTask(bR(a))]):[3,5];case 3:o=s.sent(),r[i.header]=o,s.label=4;case 4:return n++,[3,2];case 5:return[2,r]}})})},t.prototype.updateParams=function(e,t){return void 0===t&&(t=!1),Tc(this,void 0,void 0,function(){var r,n,i,o;return Pc(this,function(s){switch(s.label){case 0:return r=a(this.params),"off"!==(n=r.entry.params.view.name)&&"cell"!==n&&(r.entry.params.view.params.bottomLeft=e?.min||Cg.zero(),r.entry.params.view.params.topRight=e?.max||Cg.zero()),"auto"===n&&(r.entry.params.view.params.isSelection=t),i=this.plugin.state.data,o=i.build().to(this.ref).update(r),[4,y2.State.Update(this.plugin,{state:i,tree:o,options:{doNotUpdateCurrent:!0}})];case 1:return s.sent(),[2]}})})},t.prototype.getStructureRoot=function(){return this.plugin.state.data.select(Zb.Generators.byRef(this.ref).rootOfType(DS.Molecule.Structure))[0]},t.prototype.register=function(e){var t=this;this.ref=e,this.subscribeObservable(this.plugin.state.events.object.removed,function(e){DS.Molecule.Structure.is(e.obj)&&Az.is(t.lastLoci)&&t.lastLoci.structure===e.obj.data&&(t.lastLoci=EQ)}),this.subscribeObservable(this.plugin.state.events.object.updated,function(e){DS.Molecule.Structure.is(e.oldObj)&&Az.is(t.lastLoci)&&t.lastLoci.structure===e.oldObj.data&&(t.lastLoci=EQ)}),this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,function(e){if(t.plugin.state.data.tree.children.has(t.ref)){var r=e?e.loci:EQ;switch(t.params.entry.params.view.name){case"auto":t.updateAuto(r);break;case"selection-box":t.updateSelectionBox(r);break;default:t.lastLoci=r}}})},t.prototype.unregister=function(){for(var e=this.cache.entries.first;e;)e.value.data.asset.dispose(),e=e.next},t.prototype.isCameraTargetSame=function(e,t){if(!e||!t)return!1;var r=Cg.equals(e.target,t.target),n=Cg.squaredDistance(e.target,e.position),i=Cg.squaredDistance(t.target,t.position),a=Math.abs(n-i)/n<.001;return r&&a},t.prototype.cameraTargetDistance=function(e){return Cg.distance(e.target,e.position)},t.prototype.getBoxFromLoci=function(e){if(TQ.isEmpty(e)||MQ(e))return YE();var t=this.plugin.helpers.substructureParent.get(e.structure,!0);if(!t)return YE();var r=this.getStructureRoot();if(!r||r.obj?.data!==t.obj?.data)return YE();var n=Hz.get(r.obj?.data.models[0]);n&&Og.invert(this._invTransform,n);var i=Az.extendToWholeResidues(e),a=Az.getBoundary(i,n&&!Number.isNaN(this._invTransform[0])?this._invTransform:void 0).box;return 1===Az.size(i)&&YE.expand(a,a,Cg.create(1,1,1)),a},t.prototype.updateAuto=function(e){var t=this;this.updateQueue.enqueue(function(){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return this.lastLoci=e,MQ(e)?[4,this.updateParams("x-ray"===this.info.kind?this.data.structure.boundary.box:void 0,!1)]:[3,2];case 1:return t.sent(),[3,4];case 2:return[4,this.updateParams(this.getBoxFromLoci(e),!0)];case 3:t.sent(),t.label=4;case 4:return[2]}})})})},t.prototype.updateSelectionBox=function(e){var t=this;this.updateQueue.enqueue(function(){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:return TQ.areEqual(this.lastLoci,e)?this.lastLoci=EQ:this.lastLoci=e,t=this.getBoxFromLoci(this.lastLoci),[4,this.updateParams(t)];case 1:return r.sent(),[2]}})})})},t.prototype.updateCameraTarget=function(e){var t=this;this.updateQueue.enqueue(function(){return Tc(t,void 0,void 0,function(){var t,r,n,i;return Pc(this,function(a){switch(a.label){case 0:t=this.plugin.canvas3d?.props.camera.manualReset,a.label=1;case 1:return a.trys.push([1,,3,4]),t||null==(n=this.plugin.canvas3d)||n.setProps({camera:{manualReset:!0}}),r=this.boxFromCameraTarget(e,!0),[4,this.updateParams(r)];case 2:return a.sent(),[3,4];case 3:return t||null==(i=this.plugin.canvas3d)||i.setProps({camera:{manualReset:t}}),[7];case 4:return[2]}})})})},t.prototype.boxFromCameraTarget=function(e,t){var r,n,i,a=e.target,o=this.cameraTargetDistance(e),s=Math.tan(.5*e.fov)*o,u=this.plugin.canvas3d?.camera.viewport;if(u&&u.width>u.height&&(s*=u.width/u.height),s*="camera-target"===this.params.entry.params.view.name?this.params.entry.params.view.params.radius:.5,t){var c=Cg.zero();
139YE.size(c,this.data.structure.boundary.box),r=Math.min(s,.5*c[0]),n=Math.min(s,.5*c[1]),i=Math.min(s,.5*c[2])}else r=n=i=s;return YE.create(Cg.create(a[0]-r,a[1]-n,a[2]-i),Cg.create(a[0]+r,a[1]+n,a[2]+i))},t.prototype.decideDetail=function(e,t){for(var r="x-ray"===this.info.kind?YE.volume(this.data.structure.boundary.box):this.info.header.spacegroup.size.reduce(function(e,t){return e*t},1),n=YE.volume(e)/r,i=this.info.header.availablePrecisions.length-1,a=t;n<=.5&&a<i;)n*=2,a+=1;return a},t.prototype.update=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u=this;return Pc(this,function(c){switch(c.label){case 0:switch(t="selection-box"===e.entry.params.view.name&&this.params&&this.params.entry&&this.params.entry.params&&this.params.entry.params.view&&"selection-box"!==this.params.entry.params.view.name,this.params=e,r=void 0,n=!1,"camera-target"!==e.entry.params.view.name&&this.cameraTargetSubscription&&(this.cameraTargetSubscription.unsubscribe(),this.cameraTargetSubscription=void 0),e.entry.params.view.name){case"off":n=!0;break;case"box":r=YE.create(e.entry.params.view.params.bottomLeft,e.entry.params.view.params.topRight),n=YE.volume(r)<1e-4;break;case"selection-box":r=t?this.getBoxFromLoci(this.lastLoci)||YE():YE.create(Cg.clone(e.entry.params.view.params.bottomLeft),Cg.clone(e.entry.params.view.params.topRight)),i=e.entry.params.view.params.radius,n=YE.volume(r)<1e-4,YE.expand(r,r,Cg.create(i,i,i));break;case"camera-target":this.cameraTargetSubscription||=this.subscribeObservable(this.cameraTargetObservable,function(e){return u.updateCameraTarget(e)}),r=this.boxFromCameraTarget(this.plugin.canvas3d.camera.getSnapshot(),!0);break;case"cell":r="x-ray"===this.info.kind?this.data.structure.boundary.box:void 0;break;case"auto":(r=e.entry.params.view.params.isSelection||"x-ray"===this.info.kind?YE.create(Cg.clone(e.entry.params.view.params.bottomLeft),Cg.clone(e.entry.params.view.params.topRight)):void 0)&&(n=YE.volume(r)<1e-4,e.entry.params.view.params.isSelection&&(i=e.entry.params.view.params.radius,YE.expand(r,r,Cg.create(i,i,i))))}return n?(o={},[3,3]):[3,1];case 1:return[4,this.queryData(r)];case 2:o=c.sent(),c.label=3;case 3:return(a=o)?(s=e.entry.params.channels,"x-ray"===this.info.kind?(this.channels["2fo-fc"]=this.createChannel(a["2FO-FC"]||gR.One,s["2fo-fc"],this.info.header.sampling[0].valuesInfo[0]),this.channels["fo-fc(+ve)"]=this.createChannel(a["FO-FC"]||gR.One,s["fo-fc(+ve)"],this.info.header.sampling[0].valuesInfo[1]),this.channels["fo-fc(-ve)"]=this.createChannel(a["FO-FC"]||gR.One,s["fo-fc(-ve)"],this.info.header.sampling[0].valuesInfo[1])):this.channels.em=this.createChannel(a.EM||gR.One,s.em,this.info.header.sampling[0].valuesInfo[0]),[2,!0]):[2,!1]}})})},t.prototype.createChannel=function(e,t,r){var n=t;return{data:e,color:n.color,wireframe:n.wireframe,opacity:n.opacity,isoValue:"relative"===n.isoValue.kind?n.isoValue:gR.IsoValue.toRelative(n.isoValue,r)}},t.prototype.getDescription=function(){return"selection-box"===this.params.entry.params.view.name?"Selection":"camera-target"===this.params.entry.params.view.name?"Camera":"box"===this.params.entry.params.view.name?"Static Box":"cell"===this.params.entry.params.view.name?"Cell":""},t}(T2.WithSubscribers)}(fne||={});var mne=[hne(0,0,0),hne(1,0,0),hne(1,1,0),hne(0,1,0),hne(0,0,1),hne(1,0,1),hne(1,1,1),hne(0,1,1)],gne=[pne(mne[0],mne[1]),pne(mne[1],mne[2]),pne(mne[2],mne[3]),pne(mne[3],mne[0]),pne(mne[4],mne[5]),pne(mne[5],mne[6]),pne(mne[6],mne[7]),pne(mne[7],mne[4]),pne(mne[0],mne[4]),pne(mne[1],mne[5]),pne(mne[2],mne[6]),pne(mne[3],mne[7])],vne=[{i:0,j:0,k:0,e:0},{i:1,j:0,k:0,e:1},{i:0,j:1,k:0,e:0},{i:0,j:0,k:0,e:1},{i:0,j:0,k:1,e:0},{i:1,j:0,k:1,e:1},{i:0,j:1,k:1,e:0},{i:0,j:0,k:1,e:1},{i:0,j:0,k:0,e:2},{i:1,j:0,k:0,e:2},{i:1,j:1,k:0,e:2},{i:0,j:1,k:0,e:2}],yne=[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,
1391898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0],bne=[[],[0,8,3],[0,1,9],[1,8,3,9,8,1],[1,2,10],[0,8,3,1,2,10],[9,2,10,0,2,9],[2,8,3,2,10,8,10,9,8],[3,11,2],[0,11,2,8,11,0],[1,9,0,2,3,11],[1,11,2,1,9,11,9,8,11],[3,10,1,11,10,3],[0,10,1,0,8,10,8,11,10],[3,9,0,3,11,9,11,10,9],[9,8,10,10,8,11],[4,7,8],[4,3,0,7,3,4],[0,1,9,8,4,7],[4,1,9,4,7,1,7,3,1],[1,2,10,8,4,7],[3,4,7,3,0,4,1,2,10],[9,2,10,9,0,2,8,4,7],[2,10,9,2,9,7,2,7,3,7,9,4],[8,4,7,3,11,2],[11,4,7,11,2,4,2,0,4],[9,0,1,8,4,7,2,3,11],[4,7,11,9,4,11,9,11,2,9,2,1],[3,10,1,3,11,10,7,8,4],[1,11,10,1,4,11,1,0,4,7,11,4],[4,7,8,9,0,11,9,11,10,11,0,3],[4,7,11,4,11,9,9,11,10],[9,5,4],[9,5,4,0,8,3],[0,5,4,1,5,0],[8,5,4,8,3,5,3,1,5],[1,2,10,9,5,4],[3,0,8,1,2,10,4,9,5],[5,2,10,5,4,2,4,0,2],[2,10,5,3,2,5,3,5,4,3,4,8],[9,5,4,2,3,11],[0,11,2,0,8,11,4,9,5],[0,5,4,0,1,5,2,3,11],[2,1,5,2,5,8,2,8,11,4,8,5],[10,3,11,10,1,3,9,5,4],[4,9,5,0,8,1,8,10,1,8,11,10],[5,4,0,5,0,11,5,11,10,11,0,3],[5,4,8,5,8,10,10,8,11],[9,7,8,5,7,9],[9,3,0,9,5,3,5,7,3],[0,7,8,0,1,7,1,5,7],[1,5,3,3,5,7],[9,7,8,9,5,7,10,1,2],[10,1,2,9,5,0,5,3,0,5,7,3],[8,0,2,8,2,5,8,5,7,10,5,2],[2,10,5,2,5,3,3,5,7],[7,9,5,7,8,9,3,11,2],[9,5,7,9,7,2,9,2,0,2,7,11],[2,3,11,0,1,8,1,7,8,1,5,7],[11,2,1,11,1,7,7,1,5],[9,5,8,8,5,7,10,1,3,10,3,11],[5,7,0,5,0,9,7,11,0,1,0,10,11,10,0],[11,10,0,11,0,3,10,5,0,8,0,7,5,7,0],[11,10,5,7,11,5],[10,6,5],[0,8,3,5,10,6],[9,0,1,5,10,6],[1,8,3,1,9,8,5,10,6],[1,6,5,2,6,1],[1,6,5,1,2,6,3,0,8],[9,6,5,9,0,6,0,2,6],[5,9,8,5,8,2,5,2,6,3,2,8],[2,3,11,10,6,5],[11,0,8,11,2,0,10,6,5],[0,1,9,2,3,11,5,10,6],[5,10,6,1,9,2,9,11,2,9,8,11],[6,3,11,6,5,3,5,1,3],[0,8,11,0,11,5,0,5,1,5,11,6],[3,11,6,0,3,6,0,6,5,0,5,9],[6,5,9,6,9,11,11,9,8],[5,10,6,4,7,8],[4,3,0,4,7,3,6,5,10],[1,9,0,5,10,6,8,4,7],[10,6,5,1,9,7,1,7,3,7,9,4],[6,1,2,6,5,1,4,7,8],[1,2,5,5,2,6,3,0,4,3,4,7],[8,4,7,9,0,5,0,6,5,0,2,6],[7,3,9,7,9,4,3,2,9,5,9,6,2,6,9],[3,11,2,7,8,4,10,6,5],[5,10,6,4,7,2,4,2,0,2,7,11],[0,1,9,4,7,8,2,3,11,5,10,6],[9,2,1,9,11,2,9,4,11,7,11,4,5,10,6],[8,4,7,3,11,5,3,5,1,5,11,6],[5,1,11,5,11,6,1,0,11,7,11,4,0,4,11],[0,5,9,0,6,5,0,3,6,11,6,3,8,4,7],[6,5,9,6,9,11,4,7,9,7,11,9],[10,4,9,6,4,10],[4,10,6,4,9,10,0,8,3],[10,0,1,10,6,0,6,4,0],[8,3,1,8,1,6,8,6,4,6,1,10],[1,4,9,1,2,4,2,6,4],[3,0,8,1,2,9,2,4,9,2,6,4],[0,2,4,4,2,6],[8,3,2,8,2,4,4,2,6],[10,4,9,10,6,4,11,2,3],[0,8,2,2,8,11,4,9,10,4,10,6],[3,11,2,0,1,6,0,6,4,6,1,10],[6,4,1,6,1,10,4,8,1,2,1,11,8,11,1],[9,6,4,9,3,6,9,1,3,11,6,3],[8,11,1,8,1,0,11,6,1,9,1,4,6,4,1],[3,11,6,3,6,0,0,6,4],[6,4,8,11,6,8],[7,10,6,7,8,10,8,9,10],[0,7,3,0,10,7,0,9,10,6,7,10],[10,6,7,1,10,7,1,7,8,1,8,0],[10,6,7,10,7,1,1,7,3],[1,2,6,1,6,8,1,8,9,8,6,7],[2,6,9,2,9,1,6,7,9,0,9,3,7,3,9],[7,8,0,7,0,6,6,0,2],[7,3,2,6,7,2],[2,3,11,10,6,8,10,8,9,8,6,7],[2,0,7,2,7,11,0,9,7,6,7,10,9,10,7],[1,8,0,1,7,8,1,10,7,6,7,10,2,3,11],[11,2,1,11,1,7,10,6,1,6,7,1],[8,9,6,8,6,7,9,1,6,11,6,3,1,3,6],[0,9,1,11,6,7],[7,8,0,7,0,6,3,11,0,11,6,0],[7,11,6],[7,6,11],[3,0,8,11,7,6],[0,1,9,11,7,6],[8,1,9,8,3,1,11,7,6],[10,1,2,6,11,7],[1,2,10,3,0,8,6,11,7],[2,9,0,2,10,9,6,11,7],[6,11,7,2,10,3,10,8,3,10,9,8],[7,2,3,6,2,7],[7,0,8,7,6,0,6,2,0],[2,7,6,2,3,7,0,1,9],[1,6,2,1,8,6,1,9,8,8,7,6],[10,7,6,10,1,7,1,3,7],[10,7,6,1,7,10,1,8,7,1,0,8],[0,3,7,0,7,10,0,10,9,6,10,7],[7,6,10,7,10,8,8,10,9],[6,8,4,11,8,6],[3,6,11,3,0,6,0,4,6],[8,6,11,8,4,6,9,0,1],[9,4,6,9,6,3,9,3,1,11,3,6],[6,8,4,6,11,8,2,10,1],[1,2,10,3,0,11,0,6,11,0,4,6],[4,11,8,4,6,11,0,2,9,2,10,9],[10,9,3,10,3,2,9,4,3,11,3,6,4,6,3],[8,2,3,8,4,2,4,6,2],[0,4,2,4,6,2],[1,9,0,2,3,4,2,4,6,4,3,8],[1,9,4,1,4,2,2,4,6],[8,1,3,8,6,1,8,4,6,6,10,1],[10,1,0,10,0,6,6,0,4],[4,6,3,4,3,8,6,10,3,0,3,9,10,9,3],[10,9,4,6,10,4],[4,9,5,7,6,11],[0,8,3,4,9,5,11,7,6],[5,0,1,5,4,0,7,6,11],[11,7,6,8,3,4,3,5,4,3,1,5],[9,5,4,10,1,2,7,6,11],[6,11,7,1,2,10,0,8,3,4,9,5],[7,6,11,5,4,10,4,2,10,4,0,2],[3,4,8,3,5,4,3,2,5,10,5,2,11,7,6],[7,2,3,7,6,2,5,4,9],[9,5,4,0,8,6,0,6,2,6,8,7],[3,6,2,3,7,6,1,5,0,5,4,0],[6,2,8,6,8,7,2,1,8,4,8,5,1,5,8],[9,5,4,10,1,6,1,7,6,1,3,7],[1,6,10,1,7,
1396,1,0,7,8,7,0,9,5,4],[4,0,10,4,10,5,0,3,10,6,10,7,3,7,10],[7,6,10,7,10,8,5,4,10,4,8,10],[6,9,5,6,11,9,11,8,9],[3,6,11,0,6,3,0,5,6,0,9,5],[0,11,8,0,5,11,0,1,5,5,6,11],[6,11,3,6,3,5,5,3,1],[1,2,10,9,5,11,9,11,8,11,5,6],[0,11,3,0,6,11,0,9,6,5,6,9,1,2,10],[11,8,5,11,5,6,8,0,5,10,5,2,0,2,5],[6,11,3,6,3,5,2,10,3,10,5,3],[5,8,9,5,2,8,5,6,2,3,8,2],[9,5,6,9,6,0,0,6,2],[1,5,8,1,8,0,5,6,8,3,8,2,6,2,8],[1,5,6,2,1,6],[1,3,6,1,6,10,3,8,6,5,6,9,8,9,6],[10,1,0,10,0,6,9,5,0,5,6,0],[0,3,8,5,6,10],[10,5,6],[11,5,10,7,5,11],[11,5,10,11,7,5,8,3,0],[5,11,7,5,10,11,1,9,0],[10,7,5,10,11,7,9,8,1,8,3,1],[11,1,2,11,7,1,7,5,1],[0,8,3,1,2,7,1,7,5,7,2,11],[9,7,5,9,2,7,9,0,2,2,11,7],[7,5,2,7,2,11,5,9,2,3,2,8,9,8,2],[2,5,10,2,3,5,3,7,5],[8,2,0,8,5,2,8,7,5,10,2,5],[9,0,1,5,10,3,5,3,7,3,10,2],[9,8,2,9,2,1,8,7,2,10,2,5,7,5,2],[1,3,5,3,7,5],[0,8,7,0,7,1,1,7,5],[9,0,3,9,3,5,5,3,7],[9,8,7,5,9,7],[5,8,4,5,10,8,10,11,8],[5,0,4,5,11,0,5,10,11,11,3,0],[0,1,9,8,4,10,8,10,11,10,4,5],[10,11,4,10,4,5,11,3,4,9,4,1,3,1,4],[2,5,1,2,8,5,2,11,8,4,5,8],[0,4,11,0,11,3,4,5,11,2,11,1,5,1,11],[0,2,5,0,5,9,2,11,5,4,5,8,11,8,5],[9,4,5,2,11,3],[2,5,10,3,5,2,3,4,5,3,8,4],[5,10,2,5,2,4,4,2,0],[3,10,2,3,5,10,3,8,5,4,5,8,0,1,9],[5,10,2,5,2,4,1,9,2,9,4,2],[8,4,5,8,5,3,3,5,1],[0,4,5,1,0,5],[8,4,5,8,5,3,9,0,5,0,3,5],[9,4,5],[4,11,7,4,9,11,9,10,11],[0,8,3,4,9,7,9,11,7,9,10,11],[1,10,11,1,11,4,1,4,0,7,4,11],[3,1,4,3,4,8,1,10,4,7,4,11,10,11,4],[4,11,7,9,11,4,9,2,11,9,1,2],[9,7,4,9,11,7,9,1,11,2,11,1,0,8,3],[11,7,4,11,4,2,2,4,0],[11,7,4,11,4,2,8,3,4,3,2,4],[2,9,10,2,7,9,2,3,7,7,4,9],[9,10,7,9,7,4,10,2,7,8,7,0,2,0,7],[3,7,10,3,10,2,7,4,10,1,10,0,4,0,10],[1,10,2,8,7,4],[4,9,1,4,1,7,7,1,3],[4,9,1,4,1,7,0,8,1,8,7,1],[4,0,3,7,4,3],[4,8,7],[9,10,8,10,11,8],[3,0,9,3,9,11,11,9,10],[0,1,10,0,10,8,8,10,11],[3,1,10,11,3,10],[1,2,11,1,11,9,9,11,8],[3,0,9,3,9,11,1,2,9,2,11,9],[0,2,11,8,0,11],[3,2,11],[2,3,8,2,8,10,10,8,9],[9,10,2,0,9,2],[2,3,8,2,8,10,0,1,8,1,10,8],[1,10,2],[1,3,8,9,1,8],[0,9,1],[0,3,8],[]],_ne=[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]];function xne(e){return Ac(Ac({},e),{bottomLeft:ff(e.bottomLeft,[0,0,0]),topRight:ff(e.topRight,e.scalarField.space.dimensions)})}function Sne(e){return{dX:e.topRight[0]-e.bottomLeft[0],dY:e.topRight[1]-e.bottomLeft[1],dZ:e.topRight[2]-e.bottomLeft[2]}}function wne(e,t){var r=this;return vy.create("Marching Cubes Mesh",function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return r=xne(e),i=Sne(r),a=i.dX,o=i.dY,s=i.dZ,u=Math.min(262144,Math.max(a*o*s/32,1024)),c=function(e,t){var r=Math.min(65536,4*e),n=iv.create(Float32Array,3,e,t&&t.vertexBuffer.ref.value),i=iv.create(Float32Array,3,e,t&&t.normalBuffer.ref.value),a=iv.create(Float32Array,1,e,t&&t.groupBuffer.ref.value),o=iv.create(Uint32Array,3,r,t&&t.indexBuffer.ref.value),s=0,u=0;return{addVertex:function(e,t,r){return++s,iv.add3(n,e,t,r)},addNormal:function(e,t,r){iv.add3(i,e,t,r)},addGroup:function(e){iv.add(a,e)},addTriangle:function(e,t,r,n){var i=e[t],a=e[r],s=e[n];i>=0&&a>=0&&s>=0&&(++u,iv.add3(o,i,a,s))},get:function(){var e=iv.compact(n,!0),r=iv.compact(i,!0),c=iv.compact(o,!0),l=iv.compact(a,!0);return sD.create(e,c,r,l,s,u,t)}}}(u,t),[4,new Cne(n,c,r).run()];case 1:return l.sent(),[2,c.get()]}})})})}function Ane(e,t){var r=this;return vy.create("Marching Cubes Lines",function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return r=xne(e),i=Sne(r),a=i.dX,o=i.dY,s=i.dZ,u=Math.min(262144,Math.max(a*o*s/32,1024)),c=function(e,t){var r=iv.create(Float32Array,3,e),n=iv.create(Float32Array,1,e),i=iv.create(Float32Array,2,e),a=0;return{addVertex:function(e,t,n){return iv.add3(r,e,t,n)},addNormal:function(){return nf},addGroup:function(e){iv.add(n,e)},addTriangle:function(e,t,r,n,o){var s=e[t],u=e[r],c=e[n];s>=0&&u>=0&&c>=0&&(_ne[t][r]&o&&(++a,iv.add2(i,e[t],e[r])),_ne[r][n]&o&&(++a,iv.add2(i,e[r],e[n])),_ne[t][n]&o&&(++a,iv.add2(i,e[t],e[n])))},get:function(){for(var e=iv.compact(r,!0),o=iv.compact(i,!0),s=iv.compact(n,!0),u=HO.create(a,a/10,t),c=0;c<a;++c){var l=o[2*c],d=o[2*c+1];u.add(e[3*l],e[3*l+1],e[3*l+2],e[3*d],e[3*d+1],e[3*d+2],s[l])}return u.getLines()}}}(u,t),[4,new Cne(n,c,r).run()];case 1:return l.sent(),[2,c.get()]}})})})}var Cne=function(){function e(e,t,r){this.ctx=e,this.minX=0,this.minY=0,this.minZ=0,this.maxX=0,this.maxY=0,this.maxZ=0,this.state=new Tne(t,r),this.minX=r.bottomLeft[0],this.minY=r.bottomLeft[1],this.minZ=r.bottomLeft[2],this.maxX=r.topRight[0]-1,this.maxY=r.topRight[1]-1,this.maxZ=r.topRight[2]-1,this.size=(this.maxX-this.minX)*(this.maxY-this.minY)*(this.maxZ-this.minZ),this.sliceSize=(this.maxX-this.minX)*(this.maxY-this.minY)}return e.prototype.doSlices=function(){return Tc(this,void 0,void 0,function(){var e,t;return Pc(this,function(r){switch(r.label){case 0:e=0,this.edgeFilter=15,t=this.minZ,r.label=1;case 1:return t<this.maxZ?(this.slice(t),e+=this.sliceSize,this.ctx.shouldUpdate?[4,this.ctx.update({message:"Computing surface...",current:e,max:this.size})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t++,this.edgeFilter&=-5,[3,1];case 4:return[2]}})})},e.prototype.slice=function(e){this.edgeFilter|=2;for(var t=this.minY;t<this.maxY;t++,this.edgeFilter&=-3){this.edgeFilter|=1;for(var r=this.minX;r<this.maxX;r++,this.edgeFilter&=-2)this.state.processCell(r,t,e,this.edgeFilter)}this.state.clearEdgeVertexIndexSlice(e)},e.prototype.run=function(){return Tc(this,void 0,void 0,function(){return Pc(this,function(e){switch(e.label){case 0:return[4,this.doSlices()];case 1:return e.sent(),[2]}})})},e}(),Tne=function(){function e(e,t){this.builder=e,this.vertList=[0,0,0,0,0,0,0,0,0,0,0,0],this.i=0,this.j=0,this.k=0;var r=t.scalarField.space.dimensions;this.nX=r[0],this.nY=r[1],this.nZ=r[2],this.isoLevel=t.isoLevel,this.scalarFieldGet=t.scalarField.space.get,this.scalarField=t.scalarField.data,t.idField&&(this.idField=t.idField.data,this.idFieldGet=t.idField.space.get),this.verticesOnEdges=new Int32Array(3*this.nX*this.nY*2)}return e.prototype.get3dOffsetFromEdgeInfo=function(e){return this.nX*((this.k+e.k)%2*this.nY+this.j+e.j)+this.i+e.i},e.prototype.clearEdgeVertexIndexSlice=function(e){var t=e%2==0?0:3*this.nX*this.nY,r=e%2==0?3*this.nX*this.nY:this.verticesOnEdges.length;this.verticesOnEdges.fill(0,t,r)},e.prototype.interpolate=function(e){var t=vne[e],r=3*this.get3dOffsetFromEdgeInfo(t)+t.e,n=this.verticesOnEdges[r];if(n>0)return n-1;var i=this.scalarField,a=this.scalarFieldGet,o=gne[e],s=o.a,u=o.b,c=s.i+this.i,l=s.j+this.j,d=s.k+this.k,f=u.i+this.i,h=u.j+this.j,p=u.k+this.k,m=a(i,c,l,d),g=a(i,f,h,p),v=(this.isoLevel-m)/(m-g);if(this.idField){var y=this.idFieldGet(this.idField,c,l,d),b=this.idFieldGet(this.idField,f,h,p),_=v<.5?y:b;if(-1===_&&(_=v<.5?b:y),-2===_)return-1;this.builder.addGroup(_)}else this.builder.addGroup(0);var x=this.builder.addVertex(c+v*(c-f),l+v*(l-h),d+v*(d-p));this.verticesOnEdges[r]=x+1;var S=a(i,Math.max(0,c-1),l,d)-a(i,Math.min(this.nX-1,c+1),l,d),w=a(i,c,Math.max(0,l-1),d)-a(i,c,Math.min(this.nY-1,l+1),d),A=a(i,c,l,Math.max(0,d-1))-a(i,c,l,Math.min(this.nZ,d+1)),C=S+v*(S-(a(i,Math.max(0,f-1),h,p)-a(i,Math.min(this.nX-1,f+1),h,p))),T=w+v*(w-(a(i,f,Math.max(0,h-1),p)-a(i,f,Math.min(this.nY-1,h+1),p))),P=A+v*(A-(a(i,f,h,Math.max(0,p-1))-a(i,f,h,Math.min(this.nZ-1,p+1))));return this.isoLevel>=0?this.builder.addNormal(C,T,P):this.builder.addNormal(-C,-T,-P),x},e.prototype.get=function(e,t,r){return this.scalarFieldGet(this.scalarField,e,t,r)},e.prototype.processCell=function(e,t,r,n){var i=0;if(this.get(e,t,r)<this.isoLevel&&(i|=1),this.get(e+1,t,r)<this.isoLevel&&(i|=2),this.get(e+1,t+1,r)<this.isoLevel&&(i|=4),this.get(e,t+1,r)<this.isoLevel&&(i|=8),this.get(e,t,r+1)<this.isoLevel&&(i|=16),this.get(e+1,t,r+1)<this.isoLevel&&(i|=32),this.get(e+1,t+1,r+1)<this.isoLevel&&(i|=64),this.get(e,t+1,r+1)<this.isoLevel&&(i|=128),0!==i&&255!==i){this.i=e,this.j=t,this.k=r;var a=yne[i];(1&a)>0&&(this.vertList[0]=this.interpolate(0)),(2&a)>0&&(this.vertList[1]=this.interpolate(1)),(4&a)>0&&(this.vertList[2]=this.interpolate(2)),(8&a)>0&&(this.vertList[3]=this.interpolate(3)),(16&a)>0&&(this.vertList[4]=this.interpolate(4)),(32&a)>0&&(this.vertList[5]=this.interpolate(5)),(64&a)>0&&(this.vertList[6]=this.interpolate(6)),(128&a)>0&&(this.vertList[7]=this.interpolate(7)),(256&a)>0&&(this.vertList[8]=this.interpolate(8)),(512&a)>0&&(this.vertList[9]=this.interpolate(9)),(1024&a)>
1390&&(this.vertList[10]=this.interpolate(10)),(2048&a)>0&&(this.vertList[11]=this.interpolate(11));for(var o=bne[i],s=0;s<o.length;s+=3){var u=o[s],c=o[s+1],l=o[s+2];this.isoLevel>=0?this.builder.addTriangle(this.vertList,u,c,l,n):this.builder.addTriangle(this.vertList,l,c,u,n)}}},e}();function Pne(e,t){var r,n,i,a,o,s,u,c,l,d,f=e.defaultProps,h=e.createGeometry,p=e.createLocationIterator,m=e.getLoci,g=e.eachLocation,v=e.setUpdateState,y=e.mustRecreate,b=e.dispose,_=e.geometryUtils,x=_.updateValues,S=_.updateBoundingSphere,w=_.updateRenderableState,A=_.createPositionIterator,C=PQ.create(),T=Object.assign({},f),P=gQ.createEmpty(),E=-1;function M(e){if(C.createNew){if(l=p(a,o),!e)throw Error("expected geometry to be given");r=function(e,t,r,n,i,a){var o=cB.getUtils(t),s=o.createValues,u=o.createRenderableState,c=s(t,OI(),r,n,i),l=u(i);return RB(t.kind,c,l,a)}(0,e,l,i,n,t),d=A(e,r.values)}else{if(!r)throw Error("expected renderObject to be available");if(C.updateTransform){var f=(l=p(a,o)).instanceCount,h=l.groupCount;n.instanceGranularity?qM(f,"instance",r.values):qM(f*h,"groupInstance",r.values)}else l.reset();if(C.createGeometry){if(!e)throw Error("expected geometry to be given");tf.updateIfChanged(r.values.drawCount,cB.getDrawCount(e)),tf.updateIfChanged(r.values.uVertexCount,cB.getVertexCount(e)),tf.updateIfChanged(r.values.uGroupCount,cB.getGroupCount(e))}(C.updateTransform||C.createGeometry)&&(S(r.values,e||c),d=A(e||c,r.values)),C.updateSize&&"uSize"in r.values&&DO(l,i.size,r.values),C.updateColor&&CI(l,d,i.color,r.values),x(r.values,n),w(r.state,n)}T=n,P=i,s=a,u=o,e&&(c=e,E+=1)}function k(e,t){return CQ(e)?T.instanceGranularity?t($T.ofBounds(0,l.instanceCount)):t($T.ofBounds(0,l.groupCount*l.instanceCount)):T.instanceGranularity?function(e,t,r,n){var i=!1;if(gR.Cell.isLoci(e)){if(gR.Cell.isLociEmpty(e)||!gR.areEquivalent(e.volume,t))return!1;n($T.ofSingleton(0))&&(i=!0)}else if(gR.Segment.isLoci(e)){if(gR.Segment.isLociEmpty(e)||!gR.areEquivalent(e.volume,t)||!PP.has(e.segments,r))return!1;n($T.ofSingleton(0))&&(i=!0)}return i}(e,s,u,t):g(e,s,u,T,t)}return{get groupCount(){return l?l.count:0},get renderObject(){return r},get geometryVersion(){return E},createOrUpdate:function(e,t,l,d){return void 0===l&&(l={}),Tc(this,void 0,void 0,function(){var f;return Pc(this,function(p){return function(e,t,c,l){if(!c&&!s)throw Error("missing volume");n=Object.assign({},T,t),i=e,a=c,o=l,PQ.reset(C),r&&gR.areEquivalent(a,s)&&o===u||(C.createNew=!0),C.createNew?C.createGeometry=!0:(v(C,c,n,T,i,P),KZ.areEqual(e.color,P.color)||(C.updateColor=!0),C.createGeometry&&(C.updateColor=!0),n.instanceGranularity!==T.instanceGranularity&&(C.updateTransform=!0))}(t,l,d?.volume||s,d?.key||u),C.createGeometry?[2,$g(f=h(e,a,o,i,n,c))?f.then(M):M(f)]:(M(),[2])})})},getLoci:function(e){return r?m(e,s,u,T,r.id):EQ},eachLocation:function(e){for(l.reset();l.hasNext;){var t=l.move();e(t.location,t.isSecondary)}},mark:function(e,t){return tJ.mark(r,e,t,k)},setVisibility:function(e){tJ.setVisibility(r,e)},setAlphaFactor:function(e){tJ.setAlphaFactor(r,e)},setPickable:function(e){tJ.setPickable(r,e)},setColorOnly:function(e){tJ.setColorOnly(r,e)},setTransform:function(e,t){tJ.setTransform(r,e,t)},setOverpaint:function(e){return tJ.setOverpaint(r,e,k,!0)},setTransparency:function(e){return tJ.setTransparency(r,e,k,!0)},setSubstance:function(e){return tJ.setSubstance(r,e,k,!0)},setClipping:function(e){return tJ.setClipping(r,e,k,!0)},setThemeStrength:function(e){tJ.setThemeStrength(r,e)},destroy:function(){b?.(c),r&&=void(r.state.disposed=!0)},mustRecreate:y}}function Ene(e,t,r,n,i,a){void 0===a&&(a=function(){return[-1]});var o,s,u,c,l=0,d=t.webgl,f=new P_,h=new dJ.GeometryState,p=OB(),m=[],g=dJ.createState(),v=new Map,y=gQ.createEmpty();return{label:e,get groupCount(){var e=0;return v.forEach(function(t){t.renderObject&&(e+=t.groupCount)}),e},get props(){return c},get params(){return u},get state(){return g},get theme(){return y},get geometryVersion(){return h.version},renderObjects:m,updated:f,createOrUpdate:function(e,i){var g=this;void 0===e&&(e={}),i&&i!==o&&(u=r(t,i),o=i,c||=Ib.getDefaultValues(u));var b=NQ(Object.assign({},c,e),o);return Object.assign(c,e,b),s=a(c),vy.create("Creating or updating VolumeRepresentation",function(e){return Tc(g,void 0,void 0,function(){var t,r,i,a,u;return Pc(this,function(g){switch(g.label){case 0:t=new Set(v.keys()),r=0,i=s.length,g.label=1;case 1:return r<i?(a=s[r],t.delete(a),u=function(e,t){var r;return Tc(this,void 0,void 0,function(){var i;return Pc(this,function(a){return(i=v.get(t))?null!=(r=i.mustRecreate)&&r.call(i,{volume:o,key:t},c,d)&&(i.destroy(),i=n(p,o,t,c,d),v.set(t,i)):(i=n(p,o,t,c,d),v.set(t,i)),[2,i.createOrUpdate({webgl:d,runtime:e},y,c,{volume:o,key:t})]})})}(e,a),u?[4,u]:[3,3]):[3,4];
139case 2:g.sent(),g.label=3;case 3:return++r,[3,1];case 4:return t.forEach(function(e){var t;null==(t=v.get(e))||t.destroy(),v.delete(e)}),m.length=0,v.forEach(function(e){e.renderObject&&(m.push(e.renderObject),h.add(e.renderObject.id,e.geometryVersion))}),h.snapshot(),f.next(l++),[2]}})})})},setState:function(e){var t=e.visible,r=e.alphaFactor,n=e.pickable,i=e.overpaint,a=e.transparency,o=e.substance,s=e.clipping,u=e.transform,c=e.themeStrength,l=e.syncManually,d=e.markerActions,f={};void 0!==t&&(f.visible=t),void 0!==r&&(f.alphaFactor=r),void 0!==n&&(f.pickable=n),void 0!==i&&(f.overpaint=i),void 0!==a&&(f.transparency=a),void 0!==o&&(f.substance=o),void 0!==s&&(f.clipping=s),void 0!==c&&(f.themeStrength=c),void 0===u||Og.areEqual(u,g.transform,vg)||(f.transform=u),void 0!==l&&(f.syncManually=l),void 0!==d&&(f.markerActions=d),v.forEach(function(e){return function(e,t){void 0!==t.visible&&e&&e.setVisibility(t.visible),void 0!==t.alphaFactor&&e&&e.setAlphaFactor(t.alphaFactor),void 0!==t.pickable&&e&&e.setPickable(t.pickable),void 0!==t.overpaint&&e&&e.setOverpaint(t.overpaint),void 0!==t.transparency&&e&&e.setTransparency(t.transparency),void 0!==t.substance&&e&&e.setSubstance(t.substance),void 0!==t.clipping&&e&&e.setClipping(t.clipping),void 0!==t.transform&&e&&e.setTransform(t.transform),void 0!==t.themeStrength&&e&&e.setThemeStrength(t.themeStrength)}(e,f)}),dJ.updateState(g,e)},setTheme:function(e){y=e},getLoci:function(e){var t=EQ;return v.forEach(function(r){var n=r.getLoci(e);MQ(n)||(t=n)}),t},getAllLoci:function(){return[i(o,c)]},eachLocation:function(e){v.forEach(function(t){t.eachLocation(e)})},mark:function(e,t){var r=!1;return v.forEach(function(n){r=n.mark(e,t)||r}),r},destroy:function(){v.forEach(function(e){return e.destroy()}),v.clear()}}}Ac({},qI.Params);var Mne,kne,Ine=Ac(Ac({},rB),{tTexture:TR("texture","rgba","float","nearest")}),Dne="histopyramid-sum",One=new Uint8Array(4),Rne=new Int32Array(4),Bne=Ac(Ac({},rB),{tInputLevel:TR("texture","rgba","float","nearest"),tPreviousLevel:TR("texture","rgba","float","nearest"),uSize:CR("f"),uTexSize:CR("f"),uFirst:CR("b")}),Nne="histogram-pyramid";function Fne(e,t){var r=2**t,n=`level${t}`,i=e.isWebGL2?$ne(n,e,"image-int32","alpha","int","nearest"):$ne(n,e,"image-uint8","rgba","ubyte","nearest");i.define(r,r);var a=function(e,t){var r=`${Nne}-${e}`;return t.namedFramebuffers[r]}(n,e);return a||(a=Lne(n,e),i.attachFramebuffer(a,0)),{texture:i,framebuffer:a}}function Lne(e,t){var r=`${Nne}-${e}`;return t.namedFramebuffers[r]||(t.namedFramebuffers[r]=t.resources.framebuffer()),t.namedFramebuffers[r]}function $ne(e,t,r,n,i,a){var o=`${Nne}-${e}`;return t.namedTextures[o]||(t.namedTextures[o]=t.resources.texture(r,n,i,a)),t.namedTextures[o]}function Une(){if(void 0!==Mne)return Mne;for(var e=(Mne=NM(256,1,Uint8Array)).array,t=0,r=bne.length;t<r;++t)e[t]=bne[t].length/3;return Mne}function jne(){if(void 0!==kne)return kne;for(var e=(kne=NM(4096,1,Uint8Array)).array,t=0,r=bne.length;t<r;++t)for(var n=0;n<16;++n)n<bne[t].length?e[16*t+n]=bne[t][n]:e[16*t+n]=255;return kne}var zne=Ac(Ac({},rB),{tTriCount:TR("image-uint8","alpha","ubyte","nearest"),tVolumeData:TR("texture","rgba","ubyte","nearest"),uIsoValue:CR("f"),uGridDim:CR("v3"),uGridTexDim:CR("v3"),uScale:CR("v2")}),Gne="active-voxels",Vne=Ac(Ac({},rB),{tTriIndices:TR("image-uint8","alpha","ubyte","nearest"),tActiveVoxelsPyramid:TR("texture","rgba","float","nearest"),tActiveVoxelsBase:TR("texture","rgba","float","nearest"),tVolumeData:TR("texture","rgba","ubyte","nearest"),uIsoValue:CR("f"),uSize:CR("f"),uLevels:CR("f"),uCount:CR("f"),uInvert:CR("b"),uGridDim:CR("v3"),uGridTexDim:CR("v3"),uGridTransform:CR("m4"),uScale:CR("v2"),dPackedGroup:ER("boolean"),dAxisOrder:ER("string",["012","021","102","120","201","210"]),dConstantGroup:ER("boolean")}),Hne="isosurface";function qne(e,t,r,n,i,a,o,s,u,c,l,d,f,h){var p=function(e,t,r,n,i,a){var o=e.gl,s=e.state,u=e.resources,c=t.getWidth(),l=t.getHeight();e.namedFramebuffers[Gne]||(e.namedFramebuffers[Gne]=u.framebuffer());var d=e.namedFramebuffers[Gne];d.bind(),e.namedTextures[Gne]||(e.namedTextures[Gne]=u.texture("image-uint8","rgba","ubyte","nearest"));var f=e.namedTextures[Gne];f.define(c,l);var h=function(e,t,r,n,i,a){if(e.namedComputeRenderables[Gne]){var o=e.namedComputeRenderables[Gne].values;tf.update(o.uQuadScale,a),tf.update(o.tVolumeData,t),tf.updateIfChanged(o.uIsoValue,i),tf.update(o.uGridDim,r),tf.update(o.uGridTexDim,n),tf.update(o.uScale,a),e.namedComputeRenderables[Gne].update()}else e.namedComputeRenderables[Gne]=function(e,t,r,n,i,a){var o=Ac(Ac({}
139,nB),{tTriCount:tf.create(Une()),uQuadScale:tf.create(a),tVolumeData:tf.create(t),uIsoValue:tf.create(i),uGridDim:tf.create(r),uGridTexDim:tf.create(n),uScale:tf.create(a)}),s=Ac({},zne);return eB(KR(e,"triangles",fk("active-voxels",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tTriCount;\nuniform sampler2D tVolumeData;\n\nuniform float uIsoValue;\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n    vec2 gridTexPos = coord * uGridTexDim.xy;\n    vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n    vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n    float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n    return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n    float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n    float row = intDiv(zSlice * gridDim.x, texDim.x);\n    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n    return texture2D(tex, coord);\n}\n\nvec4 voxel(vec3 pos) {\n    pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvoid main(void) {\n    vec2 uv = gl_FragCoord.xy / uGridTexDim.xy;\n    vec3 posXYZ = index3dFrom2d(uv);\n\n    // get MC case as the sum of corners that are below the given iso level\n    float c = step(voxel(posXYZ).a, uIsoValue)\n        + 2. * step(voxel(posXYZ + c1).a, uIsoValue)\n        + 4. * step(voxel(posXYZ + c2).a, uIsoValue)\n        + 8. * step(voxel(posXYZ + c3).a, uIsoValue)\n        + 16. * step(voxel(posXYZ + c4).a, uIsoValue)\n        + 32. * step(voxel(posXYZ + c5).a, uIsoValue)\n        + 64. * step(voxel(posXYZ + c6).a, uIsoValue)\n        + 128. * step(voxel(posXYZ + c7).a, uIsoValue);\n    c *= step(c, 254.);\n\n    // handle out of bounds positions\n    posXYZ += 1.0;\n    posXYZ.xy += 1.0; // pixel padding (usually ok even if the texture has no padding)\n    if (posXYZ.x >= uGridDim.x || posXYZ.y >= uGridDim.y || posXYZ.z >= uGridDim.z)\n        c = 0.0;\n\n    // get total triangles to generate for calculated MC case from triCount texture\n    float totalTrianglesToGenerate = texture2D(tTriCount, vec2(intMod(c, 16.), floor(c / 16.)) / 16.).a;\n    gl_FragColor = vec4(vec3(totalTrianglesToGenerate * 3.0), c / 255.0);\n}\n"),s,o),o)}(e,t,r,n,i,a);return e.namedComputeRenderables[Gne]}(e,t,r,n,i,a);return e.state.currentRenderItemId=-1,f.attachFramebuffer(d,0),function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e),s.viewport(0,0,c,l),s.scissor(0,0,c,l),o.clear(o.COLOR_BUFFER_BIT),s.scissor(0,0,n[0],n[1]),h.render(),o.finish(),f}(e,t,r,n,o,i);return function(e,t,r,n,i,a,o,s,u,c,l,d,f,h,p){var m=e.extensions.drawBuffers;if(!m)throw Error("need WebGL draw buffers");var g=e.gl,v=e.state,y=e.resources,b=e.extensions,_=n.pyramidTex,x=n.height,S=n.levels,w=n.scale,A=n.count,C=_.getWidth();e.namedFramebuffers[Hne]||(e.namedFramebuffers[Hne]=y.framebuffer());var T=e.namedFramebuffers[Hne];dI(g)?(f||=y.texture("image-float32","rgba","float","nearest"),h||=y.texture("image-uint8","rgba","ubyte","nearest"),p||=b.colorBufferHalfFloat&&b.textureHalfFloat?y.texture("image-float16","rgba","fp16","nearest"):y.texture("image-float32","rgba","float","nearest")):(f||=y.texture("image-float32","rgba","float","nearest"),h||=y.texture("image-float32","rgba","float","nearest"),p||=y.texture("image-float32","rgba","float","nearest")),f.define(C,x),h.define(C,x),p.define(C,x),f.attachFramebuffer(T,0),h.attachFramebuffer(T,1),p.attachFramebuffer(T,2);var P=function(e,t,r,n,i,a,o,s,u,c,l,d,f,h,p){if(e.namedComputeRenderables[Hne]){var m=e.namedComputeRenderables[Hne].values;tf.update(m.tActiveVoxelsPyramid,t),tf.update(m.tActiveVoxelsBase,r),tf.update(m.tVolumeData,n),tf.updateIfChanged(m.uIsoValue,s),tf.updateIfChanged(m.uSize,2**u),tf.updateIfChanged(m.uLevels,u),tf.updateIfChanged(m.uCount,l),tf.updateIfChanged(m.uInvert,d),tf.update(m.uGridDim,i),tf.update(m.uGridTexDim,a),tf.update(m.uGridTransform,o),tf.update(m.uScale,c),tf.updateIfChanged(m.dPackedGroup,f),tf.updateIfChanged(m.dAxisOrder,h.join("")),tf.updateIfChanged(m.dConstantGroup,p),e.namedComputeRenderables[Hne].update()}else e.namedComputeRenderables[Hne]=function(e,t,r,n,i,a,o,s,u,c,l,d,f,h,p){var m=Ac(Ac({},nB),{tTriIndices:tf.create(jne()),tActiveVoxelsPyramid:tf.create(t),tActiveVoxelsBase:tf.create(r),tVolumeData:tf.create(n),uIsoValue:tf.create(s),uSize:tf.create(2**u),uLevels:tf.create(u),uCount:tf.create(l),uInvert:tf.create(d),uGridDim:tf.create(i),uGridTexDim:tf.create(a),uGridTransform:tf.create(o),uScale:tf.create(c),dPackedGroup:tf.create(f),dAxisOrder:tf.create(h.join("")),dConstantGroup:tf.create(p)}),g=Ac({},Vne);return eB(KR(e,"triangles",fk("isosurface",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#if __VERSION__ == 100\n    uniform sampler2D tActiveVoxelsPyramid;\n#else\n    precision highp isampler2D;\n    uniform isampler2D tActiveVoxelsPyramid;\n#endif\n\nuniform sampler2D tActiveVoxelsBase;\nuniform sampler2D tVolumeData;\nuniform sampler2D tTriIndices;\n\nuniform float uIsoValue;\nuniform float uLevels;\nuniform float uSize;\nuniform float uCount;\nuniform bool uInvert;\n\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform mat4 uGridTransform;\n\n// scale to volume data coord\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n    vec2 gridTexPos = coord * uGridTexDim.xy;\n    vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n    vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n    float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n    return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n    float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n    float row = intDiv(zSlice * gridDim.x, texDim.x);\n    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n    return texture2D(tex, coord + 0.5 / (texDim / uScale));\n}\n\nvec4 voxel(vec3 pos) {\n    pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvec4 voxelPadded(vec3 pos) {\n    pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding\n    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nint idot2(const in ivec2 a, const in ivec2 b) {\n    return a.x * b.x + a.y * b.y;\n}\n\nint idot4(const in ivec4 a, const in ivec4 b) {\n    return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\n}\n\n#if __VERSION__ == 100\n    int pyramidVoxel(vec2 pos) {\n        return int(unpackRGBToInt(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));\n    }\n#else\n    int pyramidVoxel(vec2 pos) {\n        return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;\n    }\n#endif\n\nvec4 baseVoxel(vec2 pos) {\n    return texture2D(tActiveVoxelsBase, pos / uSize);\n}\n\nvec4 getGroup(const in vec3 p) {\n    vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n    // note that we swap x and z because the texture is flipped around y\n    #if defined(dAxisOrder_012)\n        float group = p.z + p.y * gridDim.z + p.x * gridDim.z * gridDim.y; // 210\n    #elif defined(dAxisOrder_021)\n        float group = p.y + p.z * gridDim.y + p.x * gridDim.y * gridDim.z; // 120\n    #elif defined(dAxisOrder_102)\n        float group = p.z + p.x * gridDim.z + p.y * gridDim.z * gridDim.x; // 201\n    #elif defined(dAxisOrder_120)\n        float group = p.x + p.z * gridDim.x + p.y * gridDim.x * gridDim.z; // 021\n    #elif defined(dAxisOrder_201)\n        float group = p.y + p.x * gridDim.y + p.z * gridDim.y * gridDim.x; // 102\n    #elif defined(dAxisOrder_210)\n        float group = p.x + p.y * gridDim.x + p.z * gridDim.x * gridDim.y; // 012\n    #endif\n    return vec4(group > 16777215.5 ? vec3(1.0) : packIntToRGB(group), 1.0);\n}\n\nvoid main(void) {\n    // get 1D index\n    int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);\n\n    // ignore 1D indices outside of the grid\n    if(vI >= int(uCount)) discard;\n\n    ivec2 offset = ivec2(int(uSize) - 2, 0);\n\n    int start = 0;\n    ivec4 starts = ivec4(0);\n    ivec4 ends = ivec4(0);\n    int diff = 2;\n    ivec4 m = ivec4(0);\n    ivec2 position = ivec2(0);\n    ivec4 vI4 = ivec4(vI);\n\n    ivec2 relativePosition = ivec2(0);\n    int end = 0;\n    ivec2 pos1 = ivec2(0);\n    ivec2 pos2 = ivec2(0);\n    ivec2 pos3 = ivec2(0);\n    ivec2 pos4 = ivec2(0);\n    ivec3 vI3 = ivec3(vI);\n    ivec3 mask = ivec3(0);\n\n    // traverse the different levels of the pyramid\n    for(int i = 1; i < 14;
139 i++) {\n        if(float(i) >= uLevels) break;\n\n        offset.x -= diff;\n        diff *= 2;\n        relativePosition = position + offset;\n\n        end = start + pyramidVoxel(vec2(relativePosition));\n        pos1 = ivec2(relativePosition);\n        starts.x = start;\n        ends.x = end;\n        pos2 = ivec2(relativePosition + ivec2(1, 0));\n        starts.y = ends.x;\n        ends.y = ends.x + pyramidVoxel(vec2(pos2));\n        pos3 = relativePosition + ivec2(0, 1);\n        starts.z = ends.y;\n        ends.z = ends.y + pyramidVoxel(vec2(pos3));\n        pos4 = relativePosition + ivec2(1, 1);\n        starts.w = ends.z;\n        mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n        m = ivec4(mask, 1 - int(any(bvec3(mask))));\n\n        relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n        start = idot4(m, starts);\n        position = 2 * (relativePosition - offset);\n    }\n\n    end = start + int(baseVoxel(vec2(position)).r * 255.0);\n    pos1 = position;\n    starts.x = start;\n    ends.x = end;\n    pos2 = position + ivec2(1, 0);\n    starts.y = ends.x;\n    ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);\n    pos3 = position + ivec2(0, 1);\n    starts.z = ends.y;\n    ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);\n    pos4 = position + ivec2(1, 1);\n    starts.w = ends.z;\n    mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n    m = ivec4(mask, 1 - int(any(bvec3(mask))));\n    position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n\n    vec2 coord2d = (vec2(position) / uSize) / uScale;\n    vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);\n\n    float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);\n\n    // current vertex for the up to 15 MC cases\n    int currentVertex = vI - idot4(m, starts);\n\n    // ensure winding-order is the same for negative and positive iso-levels\n    if (uInvert) {\n        int v = imod(currentVertex + 1, 3);\n        if (v == 1) currentVertex += 2;\n        else if (v == 0) currentVertex -= 2;\n    }\n\n    // get index into triIndices table\n    int mcIndex = 16 * int(edgeIndex) + currentVertex;\n    vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);\n\n    // bit mask to avoid conditionals (see comment below) for getting MC case corner\n    vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));\n\n    // get edge value masks\n    vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));\n    vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));\n    vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));\n\n    // apply bit masks\n    vec3 b0 = coord3d +\n                m1.y * c1 +\n                m1.z * c2 +\n                m1.w * c3 +\n                m2.x * c4 +\n                m2.y * c5 +\n                m2.z * c6 +\n                m2.w * c7 +\n                m3.y * c1 +\n                m3.z * c2 +\n                m3.w * c3;\n    vec3 b1 = coord3d +\n                m1.x * c1 +\n                m1.y * c2 +\n                m1.z * c3 +\n                m2.x * c5 +\n                m2.y * c6 +\n                m2.z * c7 +\n                m2.w * c4 +\n                m3.x * c4 +\n                m3.y * c5 +\n                m3.z * c6 +\n                m3.w * c7;\n\n    // the conditionals that are avoided by above bitmasks\n    // vec3 b0 = coord3d;\n    // vec3 b1 = coord3d;\n    // if (mcIndex == 0.0) {\n    //     b1 += c1;\n    // } else if (mcIndex == 1.0) {\n    //     b0 += c1; b1 += c2;\n    // } else if (mcIndex == 2.0) {\n    //     b0 += c2; b1 += c3;\n    // } else if (mcIndex == 3.0) {\n    //     b0 += c3;\n    // } else if (mcIndex == 4.0) {\n    //     b0 += c4; b1 += c5;\n    // } else if (mcIndex == 5.0) {\n    //     b0 += c5; b1 += c6;\n    // } else if (mcIndex == 6.0) {\n    //     b0 += c6; b1 += c7;\n    // } else if (mcIndex == 7.0) {\n    //     b0 += c7; b1 += c4;\n    // } else if (mcIndex == 8.0) {\n    //     b1 += c4;\n    // } else if (mcIndex == 9.0) {\n    //     b0 += c1; b1 += c5;\n    // } else if (mcIndex == 10.0) {\n    //     b0 += c2; b1 += c6;\n    // } else if (mcIndex == 11.0) {\n    //     b0 += c3; b1 += c7;\n    // }\n    // b0 = floor(b0 + 0.5);\n    // b1 = floor(b1 + 0.5);\n\n    vec4 d0 = voxel(b0);\n    vec4 d1 = voxel(b1);\n\n    float v0 = d0.a;\n    float v1 = d1.a;\n\n    float t = (uIsoValue - v0) / (v0 - v1);\n    gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;\n\n    // group id\n    #if __VERSION__ == 100 || defined(dConstantGroup)\n        // webgl1 does not support 'flat' interpolation (i.e. no interpolation)\n        // ensure a constant group id per triangle as needed\n        #ifdef dPackedGroup\n            gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);\n        #else\n            gl_FragData[1] = getGroup(coord3d);\n        #endif\n    #else\n        #ifdef dPackedGroup\n            gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 
1391.0);\n        #else\n            gl_FragData[1] = getGroup(t < 0.5 ? b0 : b1);\n        #endif\n    #endif\n\n    // normals from gradients\n    vec3 n0 = -normalize(vec3(\n        voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,\n        voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,\n        voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a\n    ));\n    vec3 n1 = -normalize(vec3(\n        voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,\n        voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,\n        voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a\n    ));\n    gl_FragData[2].xyz = -vec3(\n        n0.x + t * (n0.x - n1.x),\n        n0.y + t * (n0.y - n1.y),\n        n0.z + t * (n0.z - n1.z)\n    );\n\n    // ensure normal-direction is the same for negative and positive iso-levels\n    if (uInvert) {\n        gl_FragData[2].xyz *= -1.0;\n    }\n\n    // apply normal matrix\n    gl_FragData[2].xyz *= transpose3(inverse3(mat3(uGridTransform)));\n}\n",{drawBuffers:"required"}),g,m),m)}(e,t,r,n,i,a,o,s,u,c,l,d,f,h,p);return e.namedComputeRenderables[Hne]}(e,_,t,r,i,a,o,s,S,w,A,u,c,l,d);return e.state.currentRenderItemId=-1,T.bind(),m.drawBuffers([m.COLOR_ATTACHMENT0,m.COLOR_ATTACHMENT1,m.COLOR_ATTACHMENT2]),function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.disable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e),v.viewport(0,0,C,x),g.clear(g.COLOR_BUFFER_BIT),P.render(),g.finish(),{vertexTexture:f,groupTexture:h,normalTexture:p,vertexCount:A}}(e,p,t,function(e,t,r,n){var i=e.gl,a=e.state,o=t.getWidth();if(o!==t.getHeight()||!Ig(o))throw Error("inputTexture must be of square power-of-two size");var s=Math.ceil(Math.log(o)/Math.log(2)),u=2**s,c=2**s,l=2**(s-1),d=e.isWebGL2?$ne("pyramid",e,"image-int32","alpha","int","nearest"):$ne("pyramid",e,"image-uint8","rgba","ubyte","nearest");d.define(c,l);var f=Lne("pyramid",e);d.attachFramebuffer(f,0),a.viewport(0,0,c,l),dI(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT);for(var h=[],p=0;p<s;++p)h.push(Fne(e,p));var m=function(e,t,r){if(e.namedComputeRenderables[Nne]){var n=e.namedComputeRenderables[Nne].values;tf.update(n.tInputLevel,t),tf.update(n.tPreviousLevel,r),e.namedComputeRenderables[Nne].update()}else e.namedComputeRenderables[Nne]=function(e,t,r){var n=Ac(Ac({},nB),{tInputLevel:tf.create(t),tPreviousLevel:tf.create(r),uSize:tf.create(0),uTexSize:tf.create(0),uFirst:tf.create(!0)}),i=Ac({},Bne);return eB(KR(e,"triangles",fk("reduction",jR,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n    uniform sampler2D tPreviousLevel;\n#else\n    precision highp isampler2D;\n    uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n    float k = 0.5 * uSize;\n    vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n    #if __VERSION__ == 100\n        float a, b, c, d;\n\n        if (uFirst) {\n            a = texture2D(tInputLevel, position).r * 255.0;\n            b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n            c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n            d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n        } else {\n            a = unpackRGBToInt(texture2D(tPreviousLevel, position).rgb);\n            b = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);\n            c = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);\n            d = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);\n        }\n        gl_FragColor = vec4(packIntToRGB(a + b + c + d), 1.0);\n    #else\n        int a, b, c, d;\n\n        if (uFirst) {\n            a = int(texture2D(tInputLevel, position).r * 255.0);\n            b = int(texture2D(tInputLevel, position + vec2(k, 0.0
139)).r * 255.0);\n            c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);\n            d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);\n        } else {\n            a = texture2D(tPreviousLevel, position).r;\n            b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;\n            c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;\n            d = texture2D(tPreviousLevel, position + vec2(k, k)).r;\n        }\n        gl_FragColor = ivec4(a + b + c + d);\n    #endif\n}\n",{},{0:"ivec4"}),i,n),n)}(e,t,r);return e.namedComputeRenderables[Nne]}(e,t,h[0].texture);a.currentRenderItemId=-1,function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e);var g=0;for(p=0;p<s;p++){var v=s-1-p;h[v].framebuffer.bind();var y=2**v;tf.update(m.values.uSize,2**(p+1)/u),tf.update(m.values.uTexSize,y),tf.updateIfChanged(m.values.uFirst,0===p),p>0&&(tf.update(m.values.tPreviousLevel,h[s-p].texture),m.update()),a.currentRenderItemId=-1,a.viewport(0,0,y,y),a.scissor(0,0,y,y),dI(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT),a.scissor(0,0,n[0],n[1]),m.render(),d.bind(0),i.copyTexSubImage2D(i.TEXTURE_2D,0,g,0,0,0,y,y),d.unbind(0),g+=y}i.finish();var b=Math.max(1,function(e,t){var r=e.gl,n=e.state,i=e.resources,a=function(e,t){if(e.namedComputeRenderables[Dne]){var r=e.namedComputeRenderables[Dne].values;tf.update(r.tTexture,t),e.namedComputeRenderables[Dne].update()}else e.namedComputeRenderables[Dne]=function(e,t){var r=Ac(Ac({},nB),{tTexture:tf.create(t)}),n=Ac({},Ine);return eB(KR(e,"triangles",fk("sum",jR,"\nprecision highp float;\nprecision highp int;\n\n#if __VERSION__ == 100\n    precision highp sampler2D;\n    uniform sampler2D tTexture;\n#else\n    precision highp isampler2D;\n    uniform isampler2D tTexture;\n#endif\n\nvoid main(void) {\n    #if __VERSION__ == 100\n        gl_FragColor = texture2D(tTexture, vec2(0.5));\n    #else\n        gl_FragColor = ivec4(texture2D(tTexture, vec2(0.5)).r);\n    #endif\n}\n",{},{0:"ivec4"}),n,r),r)}(e,t);return e.namedComputeRenderables[Dne]}(e,t);e.state.currentRenderItemId=-1,e.namedFramebuffers[Dne]||(e.namedFramebuffers[Dne]=i.framebuffer());var o=e.namedFramebuffers[Dne];return e.namedTextures[Dne]||(e.namedTextures[Dne]=dI(r)?i.texture("image-int32","rgba","int","nearest"):i.texture("image-uint8","rgba","ubyte","nearest"),e.namedTextures[Dne].define(1,1)),e.namedTextures[Dne].attachFramebuffer(o,0),function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.disable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e),n.viewport(0,0,1,1),a.render(),r.finish(),e.readPixels(0,0,1,1,dI(r)?Rne:One),e.unbindFramebuffer(),dI(r)?Rne[0]:PO(One[0],One[1],One[2])}(e,h[0].texture));return{pyramidTex:d,count:b,height:Math.ceil(b/2**s),levels:s,scale:r}}(e,p,i,n),r,n,a,o,s,u,c,l,d,f,h)}var Wne={isoValue:gR.IsoValueParam};function Xne(e,t){return!(e.grid.cells.data.length<1e3)&&VQ(e.grid.cells.space.dimensions,1).powerOfTwoSize<=t.maxTextureSize/2}function Yne(e,t,r,n,i){return n.tryUseGpu&&i&&function(e){return e.extensions.colorBufferFloat&&e.extensions.textureFloat&&e.extensions.drawBuffers}(i)&&Xne(t,i)?function(e){return Pne({defaultProps:Ib.getDefaultValues(tie),createGeometry:rie,createLocationIterator:function(e){return YM(e.grid.cells.data.length,1,1,function(){return WM})},getLoci:Zne,eachLocation:Qne,setUpdateState:function(e,t,r,n){gR.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||(e.createGeometry=!0)},geometryUtils:SR.Utils,mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!Xne(e.volume,r)},dispose:function(e){e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy(),e.doubleBuffer.destroy()}},e)}(e):function(e){return Pne({defaultProps:Ib.getDefaultValues(tie),createGeometry:Jne,createLocationIterator:function(e){return YM(e.grid.cells.data.length,1,1,function(){return WM})},getLoci:Zne,eachLocation:Qne,setUpdateState:function(e,t,r,n){gR.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||(e.createGeometry=!0)},geometryUtils:sD.Utils,mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&Xne(e.volume,r)}},e)}(e)}function Kne(e,t){return gR.Isosurface.Loci(e,t.isoValue)}function Zne(e,t,r,n,i){var a=e.objectId,o=e.groupId;if(i===a){var s=gR.PickingGranularity.get(t);return"volume"===s?gR.Loci(t):"object"===s?gR.Isosurface.Loci(t,n.isoValue):gR.Cell.Loci(t,$T.ofSingleton(o))}return EQ}function Qne(e,t,r,n,i){return GQ(e,t,{isoValue:n.isoValue},i)}function Jne(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var r,n,o;return Pc(this,function(s){switch(s.label){case 0:return e.runtime.update({message:"Marching cubes..."}),r=zb(new Int32Array(t.grid.cells.data.length)),[4,wne({isoLevel:gR.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:Tg.create(t.grid.cells.space,Tg.Data1(r))},a).runAsChild(e.runtime)];case 1:return n=s.sent(),o=tR.getGridToCartesianTransform(t.grid),sD.transform(n,o),e.
139webgl&&!e.webgl.isWebGL2?(sD.uniformTriangleGroup(n,!1),tf.updateIfChanged(n.varyingGroup,!1)):tf.updateIfChanged(n.varyingGroup,!0),n.setBoundingSphere(gR.Isosurface.getBoundingSphere(t,i.isoValue)),[2,n]}})})}var eie,tie=Ac(Ac(Ac(Ac({},sD.Params),SR.Params),Wne),{quality:Ac(Ac({},sD.Params.quality),{isEssential:!1}),tryUseGpu:Ib.Boolean(!0)});function rie(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var r,n,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x;return Pc(this,function(S){if(!e.webgl)throw Error("webgl context required to create volume isosurface texture-mesh");return t.grid.cells.data.length<=1?[2,SR.createEmpty(a)]:(r=t.grid.stats,n=r.max,o=r.min,s=n-o,u=gR.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,c=(u-o)/s,l=eie.get(t,e.webgl),d=l.texture,f=l.gridDimension,h=l.gridTexDim,p=l.gridTexScale,m=l.transform,g=t.grid.cells.space.axisOrderSlowToFast,v=a?.doubleBuffer.get(),y=qne(e.webgl,d,f,h,p,m,c,u<0,!1,g,!0,v?.vertex,v?.group,v?.normal),b=t.grid.cells.data.length,_=gR.getBoundingSphere(t),(x=SR.create(y.vertexCount,b,y.vertexTexture,y.groupTexture,y.normalTexture,_,a)).meta.webgl=e.webgl,[2,x])})})}function nie(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var r,n,o;return Pc(this,function(s){switch(s.label){case 0:return e.runtime.update({message:"Marching cubes..."}),r=zb(new Int32Array(t.grid.cells.data.length)),[4,Ane({isoLevel:gR.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:Tg.create(t.grid.cells.space,Tg.Data1(r))},a).runAsChild(e.runtime)];case 1:return n=s.sent(),o=tR.getGridToCartesianTransform(t.grid),qO.transform(n,o),n.setBoundingSphere(gR.Isosurface.getBoundingSphere(t,i.isoValue)),[2,n]}})})}!function(e){var t="volume-isosurface-texture";e.descriptor={name:t},e.get=function(r,n){var i=n.resources,a=tR.getGridToCartesianTransform(r.grid),o=Cg.clone(r.grid.cells.space.dimensions),s=VQ(o,1),u=s.width,c=s.height,l=s.powerOfTwoSize,d=Cg.create(u,c,0),f=Bg.create(u/l,c/l);if(l>n.maxTextureSize/2)throw Error("volume too large for gpu isosurface extraction");if(!r._propertyData[t]){r._propertyData[t]=i.texture("image-uint8","alpha","ubyte","linear");var h=r._propertyData[t];h.define(l,l),h.load(HQ(r,"data",1),!0),r.customProperties.add(e.descriptor),r.customProperties.assets(e.descriptor,[{dispose:function(){return h.destroy()}}])}return o[0]+=1,o[1]+=1,{texture:r._propertyData[t],transform:a,gridDimension:o,gridTexDim:d,gridTexScale:f}}}(eie||={});var iie=Ac(Ac(Ac({},qO.Params),Wne),{quality:Ac(Ac({},qO.Params.quality),{isEssential:!1}),sizeFactor:Ib.Numeric(3,{min:0,max:10,step:.1})});function aie(e){return Pne({defaultProps:Ib.getDefaultValues(iie),createGeometry:nie,createLocationIterator:function(e){return YM(e.grid.cells.data.length,1,1,function(){return WM})},getLoci:Zne,eachLocation:Qne,setUpdateState:function(e,t,r,n){gR.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||(e.createGeometry=!0)},geometryUtils:qO.Utils},e)}var oie={solid:function(e,t){return Ene("Isosurface mesh",e,t,Yne,Kne)},wireframe:function(e,t){return Ene("Isosurface wireframe",e,t,aie,Kne)}},sie=Ac(Ac(Ac({},tie),iie),{visuals:Ib.MultiSelect(["solid"],Ib.objectToOptions(oie)),bumpFrequency:Ib.Numeric(1,{min:0,max:10,step:.1},qI.ShadingCategory)}),uie={name:"isosurface",label:"Isosurface",description:"Displays a triangulated isosurface of volumetric data.",factory:function(e,t){return dJ.createMulti("Isosurface",e,t,dJ.StateBuilder,oie)},getParams:function(e,t){var r=Ib.clone(sie);return r.isoValue=gR.createIsoValueParam(gR.IsoValue.relative(2),t.grid.stats),r},defaultValues:Ib.getDefaultValues(sie),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!gR.isEmpty(e)&&!gR.Segmentation.get(e)}};function cie(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var e,r,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B,N,F,L,$,U;return Pc(this,function(j){for((e=i.dimension.name,r=i.isoValue,o=t.grid.cells,s=o.space,u=o.data,c=t.grid.stats,l=c.min,d=c.max,f=gR.IsoValue.toAbsolute(r,t.grid.stats).absoluteValue,h="color"in n.color?n.color.color(WM,!1):tv(16777215),p=tv.toRgbNormalized(h),m=p[0],g=p[1],v=p[2],y=lie(t.grid,i),b=y.width,_=y.height,x=y.x,S=y.y,w=y.z,A=y.x0,C=y.y0,T=y.z0,P=y.nx,E=y.ny,M=y.nz,k=new Float32Array("x"===e?[x,0,0,x,S,0,x,0,w,x,S,w]:"y"===e?[0,S,0,x,S,0,0,S,w,x,S,w]:[0,0,w,0,S,w,x,0,w,x,S,w]),I=new Uint8Array(b*_*4),D=function(e,t){for(var r=e.cells.space,n=lie(e,t),i=n.width,a=n.height,o=n.x0,s=n.y0,u=n.z0,c=n.nx,l=n.ny,d=n.nz,f=new 
139Uint8Array(i*a*4),h=0,p=s;p<l;++p)for(var m=o;m<c;++m)for(var g=u;g<d;++g)TO(r.dataOffset(m,p,g),f,h),h+=4;return f}(t.grid,i),O=0,R=C);R<E;++R)for(B=A;B<P;++B)for(N=T;N<M;++N)F=s.get(u,B,R,N),L=(F-l)/(d-l),I[O]=m*L*2*255,I[O+1]=g*L*2*255,I[O+2]=v*L*2*255,I[O+3]=F>=f?255:0,O+=4;return $={width:b,height:_,array:I,flipY:!0},U={width:b,height:_,array:D,flipY:!0},dM(tR.getGridToCartesianTransform(t.grid),k,0,4),[2,sB.create($,k,U,a)]})})}function lie(e,t){var r,n,i,a,o,s=t.dimension,u=s.name,c=s.params,l=0,d=0,f=0,h=e.cells.space.dimensions,p=h[0],m=h[1],g=h[2];return"x"===u?(a=m-1,o=g-1,r=g,n=m,p=(l=i=c)+1):"y"===u?(i=p-1,o=g-1,r=g,n=p,m=(d=a=c)+1):(i=p-1,a=m-1,r=p,n=m,g=(f=o=c)+1),{width:r,height:n,x:i,y:a,z:o,x0:l,y0:d,z0:f,nx:p,ny:m,nz:g}}function die(e,t){var r=function(e,t){for(var r=e.cells.space,n=lie(e,t),i=n.width,a=n.height,o=n.x0,s=n.y0,u=n.z0,c=n.nx,l=n.ny,d=n.nz,f=new Uint32Array(i*a),h=0,p=s;p<l;++p)for(var m=o;m<c;++m)for(var g=u;g<d;++g)f[h]=r.dataOffset(m,p,g),h+=1;return f}(e.grid,t);return gR.Cell.Loci(e,PP.ofUnsortedArray(r))}function fie(e,t,r,n,i){var a=e.objectId,o=e.groupId;if(i===a){var s=gR.PickingGranularity.get(t);return"volume"===s?gR.Loci(t):"object"===s?die(t,n):gR.Cell.Loci(t,$T.ofSingleton(o))}return EQ}function hie(e,t,r,n,i){return GQ(e,t,void 0,i)}var pie=Ac(Ac({},sB.Params),{quality:Ac(Ac({},sB.Params.quality),{isEssential:!1}),dimension:Ib.MappedStatic("x",{x:Ib.Numeric(0,{min:0,max:0,step:1}),y:Ib.Numeric(0,{min:0,max:0,step:1}),z:Ib.Numeric(0,{min:0,max:0,step:1})},{isEssential:!0}),isoValue:gR.IsoValueParam});function mie(e){return Pne({defaultProps:Ib.getDefaultValues(pie),createGeometry:cie,createLocationIterator:function(e){return YM(e.grid.cells.data.length,1,1,function(){return WM})},getLoci:fie,eachLocation:hie,setUpdateState:function(e,t,r,n,i,a){e.createGeometry=r.dimension.name!==n.dimension.name||r.dimension.params!==n.dimension.params||!gR.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||!KZ.areEqual(i.color,a.color)},geometryUtils:Ac(Ac({},sB.Utils),{createRenderableState:function(e){var t=sB.Utils.createRenderableState(e);return gie(t,e),t},updateRenderableState:gie})},e)}function gie(e,t){sB.Utils.updateRenderableState(e,t),e.opaque=!1,e.writeDepth=!0}var vie={name:"slice",label:"Slice",description:"Slice of volume rendered as image with interpolation.",factory:function(e,t){return Ene("Slice",e,t,mie,die)},getParams:function(e,t){var r=Ib.clone(pie),n=t.grid.cells.space.dimensions;return r.dimension=Ib.MappedStatic("x",{x:Ib.Numeric(0,{min:0,max:n[0]-1,step:1}),y:Ib.Numeric(0,{min:0,max:n[1]-1,step:1}),z:Ib.Numeric(0,{min:0,max:n[2]-1,step:1})},{isEssential:!0}),r.isoValue=gR.createIsoValueParam(gR.IsoValue.absolute(t.grid.stats.min),t.grid.stats),r},defaultValues:Ib.getDefaultValues(pie),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!gR.isEmpty(e)&&!gR.Segmentation.get(e)}};function yie(e,t){var r=YE();return YE.add(r,e),YE.transform(r,r,t),r}function bie(e,t,r,n){var i=r.grid.cells.space.dimensions,a=VQ(i),o=a.width,s=a.height;if(Math.max(o,s)>t.maxTextureSize/2)throw Error("volume too large for direct-volume rendering");var u=HQ(r,"normals"),c=tR.getGridToCartesianTransform(r.grid),l=yie(i,c),d=n?n.gridTexture.ref.value:t.resources.texture("image-uint8","rgba","ubyte","linear");d.load(u);var f=_ie(r.grid),h=f.unitToCartn,p=f.cellDim,m=r.grid.cells.space.axisOrderSlowToFast;return _R.create(l,i,c,h,p,d,r.grid.stats,!1,m,n)}function _ie(e){if("matrix"===e.transform.kind)return{unitToCartn:Og.mul(Og(),e.transform.matrix,Og.fromScaling(Og(),e.cells.space.dimensions)),cellDim:Og.getScaling(Cg(),e.transform.matrix)};var t=e.transform.fractionalBox,r=YE.size(Cg(),t);return{unitToCartn:Og.mul3(Og(),e.transform.cell.fromFractional,Og.fromTranslation(Og(),t.min),Og.fromScaling(Og(),r)),cellDim:Cg.div(Cg(),e.transform.cell.size,e.cells.space.dimensions)}}function xie(e,t,r,n){var i=r.grid.cells.space.dimensions;if(Math.max.apply(Math,i)>t.max3dTextureSize/2)throw Error("volume too large for direct-volume rendering");var a=function(e){for(var t=e.grid,r=t.cells,n=r.space,i=r.data,a=t.stats,o=a.max,s=a.min,u=n.dimensions,c=u[0],l=u[1],d=u[2],f=n.dataOffset,h=new Uint8Array(c*l*d*4),p={array:h,width:c,height:l,depth:d},m=o-s,g=Cg(),v=Cg(),y=c-1,b=l-1,_=d-1,x=0,S=0;S<d;++S)for(var w=0;w<l;++w)for(var A=0;A<c;
139++A){var C=f(A,w,S);FQ(g,i[f(Math.max(0,A-1),w,S)],i[f(A,Math.max(0,w-1),S)],i[f(A,w,Math.max(0,S-1))]),FQ(v,i[f(Math.min(y,A+1),w,S)],i[f(A,Math.min(b,w+1),S)],i[f(A,w,Math.min(_,S+1))]),LQ(g,$Q(g,g,v)),UQ(g,jQ(g,g,.5),.5),zQ(jQ(g,g,255),h,x),h[x+3]=Math.round((i[C]-s)/m*255),x+=4}return p}(r),o=tR.getGridToCartesianTransform(r.grid),s=yie(i,o),u=n?n.gridTexture.ref.value:t.resources.texture("volume-uint8","rgba","ubyte","linear");u.load(a);var c=_ie(r.grid),l=c.unitToCartn,d=c.cellDim,f=r.grid.cells.space.axisOrderSlowToFast;return _R.create(s,i,o,l,d,u,r.grid.stats,!1,f,n)}function Sie(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var r;return Pc(this,function(n){if(e.runtime,void 0===(r=e.webgl))throw Error("DirectVolumeVisual requires `webgl` in props");return[2,r.isWebGL2?xie(0,r,t,a):bie(0,r,t,a)]})})}function wie(e,t){return gR.Loci(e)}function Aie(e,t,r,n,i){var a=e.objectId,o=e.groupId;return i===a?gR.Cell.Loci(t,$T.ofSingleton(o)):EQ}function Cie(e,t,r,n,i){return GQ(e,t,void 0,i)}var Tie=Ac(Ac({},_R.Params),{quality:Ac(Ac({},_R.Params.quality),{isEssential:!1})});function Pie(e){return Pne({defaultProps:Ib.getDefaultValues(Tie),createGeometry:Sie,createLocationIterator:function(e){return YM(e.grid.cells.data.length,1,1,function(){return WM})},getLoci:Aie,eachLocation:Cie,setUpdateState:function(e,t,r,n){},geometryUtils:_R.Utils,dispose:function(e){e.gridTexture.ref.value.destroy()}},e)}var Eie={name:"direct-volume",label:"Direct Volume",description:"Direct rendering of volumetric data.",factory:function(e,t){return Ene("Direct Volume",e,t,Pie,wie)},getParams:function(e,t){var r=Ib.clone(Tie);return r.controlPoints.getVolume=function(){return t},r},defaultValues:Ib.getDefaultValues(Tie),defaultColorTheme:{name:"volume-value"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!gR.isEmpty(e)&&!gR.Segmentation.get(e)}},Mie={segments:Ib.Converted(function(e){return e.map(function(e){return`${e}`})},function(e){return e.map(function(e){return parseInt(e)})},Ib.MultiSelect(["0"],Ib.arrayToOptions(["0"]),{isEssential:!0}))};function kie(e,t){return!(e.grid.cells.data.length<1e3)&&VQ(e.grid.cells.space.dimensions,1).powerOfTwoSize<=t.maxTextureSize/2}var Iie=Og();function Die(e,t){var r=tR.getGridToCartesianTransform(e),n=Og.fromTranslation(Iie,t.min);return Og.mul(Og(),r,n)}function Oie(e,t,r,n,i){return n.tryUseGpu&&i&&function(e){return e.extensions.colorBufferFloat&&e.extensions.textureFloat&&e.extensions.drawBuffers}(i)&&kie(t,i)?function(e){return Pne({defaultProps:Ib.getDefaultValues(Lie),createGeometry:Uie,createLocationIterator:function(e,t){var r=gR.Segment.Location(e,t);return YM(e.grid.cells.data.length,1,1,function(){return r})},getLoci:Bie,eachLocation:Nie,setUpdateState:function(e,t,r,n){},geometryUtils:SR.Utils,mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!kie(e.volume,r)},dispose:function(e){e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy(),e.doubleBuffer.destroy()}},e)}(e):function(e){return Pne({defaultProps:Ib.getDefaultValues(Lie),createGeometry:Fie,createLocationIterator:function(e,t){var r=gR.Segment.Location(e,t);return YM(e.grid.cells.data.length,1,1,function(){return r})},getLoci:Bie,eachLocation:Nie,setUpdateState:function(e,t,r,n){},geometryUtils:sD.Utils,mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&kie(e.volume,r)}},e)}(e)}function Rie(e,t){return gR.Segment.Loci(e,t.segments)}function Bie(e,t,r,n,i){var a=e.objectId,o=e.groupId;if(i===a){var s=gR.PickingGranularity.get(t);return"volume"===s?gR.Loci(t):"object"===s?gR.Segment.Loci(t,[r]):gR.Cell.Loci(t,$T.ofSingleton(o))}return EQ}function Nie(e,t,r,n,i){return GQ(e,t,{segments:PP.ofSingleton(r)},i)}function Fie(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var n,i,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:if(!(n=gR.Segmentation.get(t)))throw Error("missing volume segmentation");return e.runtime.update({message:"Marching cubes..."}),i=YE.clone(n.bounds[r]),YE.expand(i,i,Cg.create(2,2,2)),o=Array.from(n.segments.get(r).values()),s=function(e,t,r){for(var n=r.data,i=r.space.dataOffset,a=YE.size(Cg(),t),o=a[0],s=a[1],u=a[2],c=o-1,l=s-1,d=u-1,f=t.min,h=f[0],p=f[1],m=f[2],g=t.max,v=g[0],y=g[1],b=g[2],_=kc([],r.space.axisOrderSlowToFast,!0),x=Tg.Space(a,_,Uint8Array),S=Tg.create(x,x.create()),w=S.data,A=x.set,C=0;C<u;++C)for(var T=0;T<s;++T)for(var P=0;P<o;++P){var E=e.includes(n[i(P+h,T+p,C+m)])?255:0,M=e.includes(n[i(Math.min(c+v,P+1+h),T+p,C+m)])?255:0,k=e.includes(n[i(Math.max(0,P-1+h),T+p,C+m)])?255:0,I=e.includes(n[i(P+h,Math.min(l+y,T+1+p),C+m)])?255:0,D=e.includes(n[i(P+h,Math.max(0,T-1+p),C+m)])?255:0,O=e.includes(n[i(P+h,T+p,Math.min(d+b,C+1+m))])?255:0,R=e.includes(n[i(P+h,T+p,Math.max(0,C-1+m))])?255:0;A(w,P,T,C,Math.round((E+E+M+k+I+D+O+R)/8))}return S}(o,i,t.grid.cells),u=zb(new Int32Array(s.data.length)),[4,wne({isoLevel:128,
139scalarField:s,idField:Tg.create(s.space,Tg.Data1(u))},a).runAsChild(e.runtime)];case 1:return c=d.sent(),l=Die(t.grid,i),sD.transform(c,l),e.webgl&&!e.webgl.isWebGL2?(sD.uniformTriangleGroup(c,!1),tf.updateIfChanged(c.varyingGroup,!1)):tf.updateIfChanged(c.varyingGroup,!0),c.setBoundingSphere(gR.Segment.getBoundingSphere(t,[r])),[2,c]}})})}var Lie=Ac(Ac(Ac(Ac({},sD.Params),SR.Params),Mie),{quality:Ac(Ac({},sD.Params.quality),{isEssential:!1}),tryUseGpu:Ib.Boolean(!0)}),$ie="segment-texture";function Uie(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var n,i,o,s,u,c,l,d,f,h;return Pc(this,function(p){if(!e.webgl)throw Error("webgl context required to create volume segment texture-mesh");return t.grid.cells.data.length<=1?[2,SR.createEmpty(a)]:(n=function(e,t,r){var n=gR.Segmentation.get(e);if(!n)throw Error("missing volume segmentation");var i=r.resources,a=YE.clone(n.bounds[t]);YE.expand(a,a,Cg.create(2,2,2));var o=Die(e.grid,a),s=YE.size(Cg(),a),u=VQ(s,1),c=u.width,l=u.height,d=u.powerOfTwoSize,f=Cg.create(c,l,0),h=Bg.create(c/d,l/d);if(d>r.maxTextureSize/2)throw Error("volume too large for gpu segment extraction");r.namedTextures[$ie]||(r.namedTextures[$ie]=i.texture("image-uint8","alpha","ubyte","linear"));var p=r.namedTextures[$ie];p.define(d,d);var m=Array.from(n.segments.get(t).values());return p.load(function(e,t,r){for(var n=e.grid.cells.data,i=YE.size(Cg(),r),a=e.grid.cells.space.dataOffset,o=VQ(i,1),s=o.width,u=o.height,c=new Uint8Array(s*u*1),l={array:c,width:s,height:u},d=i[0],f=i[1],h=i[2],p=d-1,m=f-1,g=h-1,v=d+1,y=f+1,b=r.min,_=b[0],x=b[1],S=b[2],w=r.max,A=w[0],C=w[1],T=w[2],P=0;P<h;++P)for(var E=0;E<f;++E)for(var M=0;M<d;++M){var k=Math.floor(P*v%s/v),I=1*(Math.floor(P*v/s)*y*s+E*s+(k*v+M)),D=t.includes(n[a(M+_,E+x,P+S)])?255:0,O=t.includes(n[a(Math.min(p+A,M+1+_),E+x,P+S)])?255:0,R=t.includes(n[a(Math.max(0,M-1+_),E+x,P+S)])?255:0,B=t.includes(n[a(M+_,Math.min(m+C,E+1+x),P+S)])?255:0,N=t.includes(n[a(M+_,Math.max(0,E-1+x),P+S)])?255:0,F=t.includes(n[a(M+_,E+x,Math.min(g+T,P+1+S))])?255:0,L=t.includes(n[a(M+_,E+x,Math.max(0,P-1+S))])?255:0;c[I]=Math.round((D+D+O+R+B+N+F+L)/8)}return l}(e,m,a),!0),s[0]+=1,s[1]+=1,{texture:p,transform:o,gridDimension:s,gridTexDim:f,gridTexScale:h}}(t,r,e.webgl),i=n.texture,o=n.gridDimension,s=n.gridTexDim,u=n.gridTexScale,c=n.transform,l=t.grid.cells.space.axisOrderSlowToFast,d=a?.doubleBuffer.get(),f=qne(e.webgl,i,o,s,u,c,.5,!1,!1,l,!0,d?.vertex,d?.group,d?.normal),h=t.grid.cells.data.length,[2,SR.create(f.vertexCount,h,f.vertexTexture,f.groupTexture,f.normalTexture,gR.Segment.getBoundingSphere(t,[r]),a)])})})}function jie(e){return PP.ofUnsortedArray(e.segments)}var zie={segment:function(e,t){return Ene("Segment mesh",e,t,Oie,Rie,jie)}},Gie=Ac(Ac({},Lie),{visuals:Ib.MultiSelect(["segment"],Ib.objectToOptions(zie)),bumpFrequency:Ib.Numeric(1,{min:0,max:10,step:.1},qI.ShadingCategory)}),Vie={name:"segment",label:"Segment",description:"Displays a triangulated segment of volumetric data.",factory:function(e,t){return dJ.createMulti("Segment",e,t,dJ.StateBuilder,zie)},getParams:function(e,t){var r=Ib.clone(Gie),n=gR.Segmentation.get(t);if(n){var i=Array.from(n.segments.keys());r.segments=Ib.Converted(function(e){return e.map(function(e){return`${e}`})},function(e){return e.map(function(e){return parseInt(e)})},Ib.MultiSelect(i.map(function(e){return`${e}`}),Ib.arrayToOptions(i.map(function(e){return`${e}`})),{isEssential:!0}))}return r},defaultValues:Ib.getDefaultValues(Gie),defaultColorTheme:{name:"volume-segment"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!gR.isEmpty(e)&&!!gR.Segmentation.get(e)}},Hie=function(e){function t(){var r=e.call(this)||this;return Hg(t.BuiltIn,function(e,t){if(e.name!==t)throw Error(`Fix BuiltInVolumeRepresentations to have matching names. ${e.name} ${t}`);r.add(e)}),r}return wc(t,e),t}(fJ);function qie(e,t,r,n){e.push({source:"em"===t?{name:"em",params:{isoValue:gR.IsoValue.absolute(n||0)}}:{name:"x-ray",params:{}},dataId:r})}!function(e){e.BuiltIn={isosurface:uie,slice:vie,"direct-volume":Eie,segment:Vie}}(Hie||={});var Wie=Db.build({display:{name:"Volume Streaming"},from:DS.Molecule.Structure,params:function(e,t){var r=function(e,t){if(void 0===t&&(t="x-ray"),!e)return t;var r=e.models[0];return qz.is(r.sourceData)?Xz.hasEmMap(r)?"em":Xz.hasXrayMap(r)?"x-ray":Xz.isFromEm(r)?"em":Xz.isFromXray(r)?"x-ray":t:t}(e&&e.data),n=function(e,t){if(!t||!t.models.length)return[];var r=t.models[0];switch(e){case"em":return function(e){var t=[];if(!qz.is(e.sourceData))return[e.entryId];var r=e.sourceData.data.db.pdbx_database_related,n=r.db_id,i=r.db_name,a=r.content_type;if(!i.isDefined)return[e.entryId];for(var o=0,s=i.rowCount;o<s;++o)"EMDB"===i.value(o).toUpperCase()&&"associated EM volume"===a.value(o)&&t.pu
139sh(n.value(o));return t}(r);case"x-ray":return function(e){return[e.entryId]}(r)}}(r,e&&e.data);return{method:Ib.Select(r,[["em","EM"],["x-ray","X-Ray"]]),entries:Ib.ObjectList({id:Ib.Text(n[0]||"")},function(e){return e.id},{defaultValue:n.map(function(e){return{id:e}})}),defaultView:Ib.Select("em"===r?"auto":"selection-box",fne.ViewTypeOptions),options:Ib.Group({serverUrl:Ib.Text(t.config.get(j2.VolumeStreaming.DefaultServer)||"https://ds.litemol.org"),behaviorRef:Ib.Text("",{isHidden:!0}),emContourProvider:Ib.Select("emdb",[["emdb","EMDB"],["pdbe","PDBe"]],{isHidden:!0}),channelParams:Ib.Value({},{isHidden:!0})})}},isApplicable:function(e,t,r){var n=r.config.get(j2.VolumeStreaming.CanStream);return n?n(e.data,r):1===e.data.models.length&&Xz.probablyHasDensityMap(e.data.models[0])}})(function(e,t){var r=e.ref,n=e.state,i=e.params;return vy.create("Volume Streaming",function(e){return Tc(void 0,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x;return Pc(this,function(S){switch(S.label){case 0:a=[],o=0,s=i.entries.length,S.label=1;case 1:return o<s?(u=i.entries[o].id.toLowerCase(),c=void 0,"em"===i.method?u.toUpperCase().startsWith("EMD")?[3,11]:[4,e.update("Getting EMDB info...")]:[3,14]):[3,16];case 2:return S.sent(),[4,lne(t,e,u)];case 3:l=S.sent(),d=0,f=l.length,S.label=4;case 4:if(!(d<f))return[3,10];h=l[d],p=void 0,S.label=5;case 5:return S.trys.push([5,7,,8]),[4,one(i.options.emContourProvider,t,e,h)];case 6:return p=S.sent(),[3,8];case 7:return m=S.sent(),console.info(`Could not get map info for ${h}: ${m}`),[3,9];case 8:qie(a,i.method,h,p||0),S.label=9;case 9:return++d,[3,4];case 10:return[3,15];case 11:return S.trys.push([11,13,,14]),[4,one(i.options.emContourProvider,t,e,u)];case 12:return c=S.sent(),[3,14];case 13:return g=S.sent(),console.info(`Could not get map info for ${u}: ${g}`),[3,15];case 14:qie(a,i.method,u,c||0),S.label=15;case 15:return++o,[3,1];case 16:return[4,(v=n.build().to(r).applyOrUpdateTagged(fne.RootTag,Kie,{serverUrl:i.options.serverUrl,entries:a})).commit()];case 17:return S.sent(),(y=v.selector).isOk?(b=n.tree.children.get(y.ref))?.size>0?[4,t.managers.structure.hierarchy.remove(b?.toArray())]:[3,19]:[2];case 18:S.sent(),S.label=19;case 19:return _=y.cell.obj,x=n.build().to(v.ref).apply(Zie,Ib.getDefaultValues(fne.createParams({data:_.data,defaultView:i.defaultView,channelParams:i.options.channelParams})),{ref:i.options.behaviorRef?i.options.behaviorRef:void 0}),"em"===i.method?x.apply(Qie,{channel:"em"},{state:{isGhost:!0},tags:"em"}):(x.apply(Qie,{channel:"2fo-fc"},{state:{isGhost:!0},tags:"2fo-fc"}),x.apply(Qie,{channel:"fo-fc(+ve)"},{state:{isGhost:!0},tags:"fo-fc(+ve)"}),x.apply(Qie,{channel:"fo-fc(-ve)"},{state:{isGhost:!0},tags:"fo-fc(-ve)"})),[4,n.updateTree(x).runInContext(e)];case 20:return S.sent(),[2]}})})})}),Xie=Db.build({display:{name:"Boxify Volume Streaming",description:"Make the current box permanent."},from:fne,isApplicable:function(e){return"selection-box"===e.data.params.entry.params.view.name}})(function(e,t){var r=e.a,n=e.ref,i=e.state,a=r.data.params;if("selection-box"===a.entry.params.view.name){var o=YE.create(Cg.clone(a.entry.params.view.params.bottomLeft),Cg.clone(a.entry.params.view.params.topRight)),s=a.entry.params.view.params.radius;YE.expand(o,o,Cg.create(s,s,s));var u=Ac(Ac({},a),{entry:{name:a.entry.name,params:Ac(Ac({},a.entry.params),{view:{name:"box",params:{bottomLeft:o.min,topRight:o.max}}})}});return i.updateTree(i.build().to(n).update(u))}}),Yie={dataId:Ib.Text(""),source:Ib.MappedStatic("x-ray",{em:Ib.Group({isoValue:gR.createIsoValueParam(gR.IsoValue.relative(1))}),"x-ray":Ib.Group({})})},Kie=OS.BuiltIn({name:"create-volume-streaming-info",display:{name:"Volume Streaming Info"},from:DS.Molecule.Structure,to:ane,params:function(e){return{serverUrl:Ib.Text("https://ds.litemol.org"),entries:Ib.ObjectList(Yie,function(e){return e.dataId},{defaultValue:[{dataId:"",source:{name:"x-ray",params:{}}}]})}}})({apply:function(e,t){var r=e.a,n=e.params;return vy.create("",function(e){return Tc(void 0,void 0,void 0,function(){var i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:i=[],a=0,o=n.entries.length,f.label=1;case 1:return a<o?(s=n.entries[a],u=s.dataId,c="em"===s.source.name?s.source.params.isoValue:gR.IsoValue.relative(1),[4,e.update("Getting server header...")]):[3,5];case 2:return f.sent(),[4,t.fetch({url:F2(n.serverUrl,`${s.source.name}/${u.toLocaleLowerCase()}`),type:"json"}).runInContext(e)];case 3:l=f.sent(),i.push({dataId:u,kind:s.source.name,header:l,emDefaultContourLevel:c}),f.label=4;case 4:return++a,[3,1];case 5:return d={serverUrl:n.serverUrl,entries:i,structure:r.data},[2,new ane(d,{label:"Volume Server",description:`${i.map(function(e){return e.dataId}).join(", ")}`})]}})})})}}),Zie=OS.BuiltIn({name:"create-volume-streaming-behavior",display:{name:"Volume Streaming Behavior"},from:ane,to:fne,params:function(e){return fne.createParams({data:e&&e.data})}})({canAutoUpdate:function(e){var t=e.oldParams,r=e.newParams;return t.entry.params.view===r.entry.params.view||"selection-box"===r.entry.params.view.name||"camera-target"===r.entry.params.view.name||"off"===r.entry.params.view.name},apply:function(e,t){var r=e.a,n=e.params;return vy.create("Volume streaming",function(e){return Tc(void 0,void 0,void 0,function(){var e;return Pc(this,function(i){switch(i.label){case 0:return[4,(e=new fne.Behavior(t,r.data)).update(n)];case 1:return i.sent(),[2,new fne(e,{label:"Volume Streaming",description:e.getDescription()})]}})})})},update:function(e){var t=this;e.a;var r=e.b,n=e.oldParams,i=e.newParams;return vy.create("Update Volume Streaming",function(e){return Tc(t,void 0,void 0,function(){var e,t;return Pc(this,function(a){switch(a.label){case 0:return n.entry.name!==i.entry.name&&"em"in i.entry.params.channels&&(e=r.data.infoMap.get(i.entry.name).emDefaultContourLevel)&&(i.entry.params.channels.em.isoValue=e),[4,r.data.update(i)];case 1:return t=a.sent()?Ob.UpdateResult.Updated:Ob.UpdateResult.Unchanged,r.description=r.data.getDescription(),[2,t]}})})})}}),Qie=OS.BuiltIn({name:"create-volume-streaming-visual",display:{name:"Volume Streaming Visual"},from:fne,to:DS.Volume.Representation3D,params:{channel:Ib.Select("em",fne.ChannelTypeOptions,{isHidden:!0})}})({apply:function(e,t){var r=e.a,n=e.params,i=e.spine;return vy.create("Volume Representation",function(e){return Tc(void 0,void 0,void 0,function(){var a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return(a=r.data.channels[n.channel])?(o=Jie(r.data,n.channel),s=Hie.BuiltIn.isosurface,u=o.type.params||{},(c=s.factory(Ac({webgl:t.canvas3d?.webgl},t.representation.volume.themes),s.getParams)).setTheme(gQ.create(t.representation.volume.themes,{volume:a.data},o)),l=i.getAncestorOfType(DS.Molecule.Structure)?.data,d=0===l?.models.length?void 0:Hz.get(l?.models[0]),[4,c.createOrUpdate(u,a.data).runInContext(e)]):[2,of.Null];
139case 1:return f.sent(),d&&c.setState({transform:d}),[2,new DS.Volume.Representation3D({repr:c,sourceData:a.data},{label:`${Math.round(100*a.isoValue.relativeValue)/100} σ [${n.channel}]`})]}})})})},update:function(e,t){var r=e.a,n=e.b,i=e.newParams;return e.spine,vy.create("Volume Representation",function(e){return Tc(void 0,void 0,void 0,function(){var a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return(a=r.data.channels[i.channel])?(o=n.data.repr.state.visible,s=Jie(r.data,i.channel),u=Ac(Ac({},n.data.repr.props),s.type.params),n.data.repr.setTheme(gQ.create(t.representation.volume.themes,{volume:a.data},s)),[4,n.data.repr.createOrUpdate(u,a.data).runInContext(e)]):[2,Ob.UpdateResult.Unchanged];case 1:return c.sent(),n.data.repr.setState({visible:o}),n.data.sourceData=a.data,[2,Ob.UpdateResult.Updated]}})})})}});function Jie(e,t){var r=e.channels[t];return H1.getDefaultParamsStatic(e.plugin,"isosurface",{isoValue:r.isoValue,alpha:r.opacity,visuals:r.wireframe?["wireframe"]:["solid"]},"uniform",{value:r.color})}var eae,tae,rae=xd.create({name:"built-in.animate-state-interpolation",display:{name:"Animate State (experimental)"},params:function(){return{transtionDurationInMs:Ib.Numeric(2e3,{min:100,max:3e4,step:10})}},canApply:function(e){return{canApply:e.managers.snapshot.state.entries.size>1}},initialState:function(){return{}},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var e,n,i,a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x;return Pc(this,function(S){switch(S.label){case 0:if((e=r.plugin.managers.snapshot.state.entries).size<2)return[2,{kind:"finished"}];if(n=t.current%r.params.transtionDurationInMs/r.params.transtionDurationInMs,i=Math.floor(t.current/r.params.transtionDurationInMs)%e.size,(a=Math.ceil(t.current/r.params.transtionDurationInMs))===i&&a++,a%=e.size,o=e.get(i).snapshot,s=e.get(a).snapshot,!o.data||!s.data)return[2,{kind:"skip"}];for(u=o.data.tree.transforms,c=s.data.tree.transforms,l=r.plugin.state.data,d=l.build(),f=0,h=u;f<h.length;f++)for(p=h[f],m=0,g=c;m<g.length;m++)(v=g[m]).ref===p.ref&&v.version!==p.version&&(y=Rb.fromJSON(p),b=Rb.fromJSON(v),(_=l.cells.get(p.ref))&&(x=y.transformer.definition.interpolate?y.transformer.definition.interpolate(y.params,b.params,n,r.plugin):n<=.5?y.params:b.params,lf(_,x)||d.to(p.ref).update(x)));return[4,y2.State.Update(r.plugin,{state:l,tree:d,options:{doNotLogTiming:!0}})];case 1:return S.sent(),[2,{kind:"next",state:{}}]}})})}}),nae=xd.create({name:"built-in.animate-structure-spin",display:{name:"Spin Structure"},isExportable:!0,params:function(){return{durationInMs:Ib.Numeric(3e3,{min:100,max:1e4,step:100})}},initialState:function(){return{t:0}},getDuration:function(e){return{kind:"fixed",durationMs:e.durationInMs}},setup:function(e,t,r){return Tc(this,void 0,void 0,function(){var e,t,n,i,a,o,s;return Pc(this,function(u){for(e=r.state.data,t=e.select(Zb.Generators.ofType(DS.Molecule.Structure.Representation3D)),n=e.build(),i=!1,a=0,o=t;a<o.length;a++)s=o[a],e.select(Zb.Generators.ofTransformer(m2.Representation.SpinStructureRepresentation3D,s.transform.ref)).length>0||(i=!0,n.to(s.transform.ref).apply(m2.Representation.SpinStructureRepresentation3D,{t:0},{tags:"animate-structure-spin"}));return i?[2,n.commit({doNotUpdateCurrent:!0})]:[2]})})},teardown:function(e,t,r){var n=r.state.data,i=n.select(Zb.Generators.ofType(DS.Molecule.Structure.Representation3DState).withTag("animate-structure-spin"));if(0!==i.length){for(var a=n.build(),o=0,s=i;o<s.length;o++){var u=s[o];a.delete(u.transform.ref)}return a.commit()}},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:if(n=r.plugin.state.data,0===(i=n.select(Zb.Generators.ofTransformer(m2.Representation.SpinStructureRepresentation3D))).length)return[2,{kind:"finished"}];for(a=n.build(),o=(t.current-t.lastApplied)/r.params.durationInMs,s=(e.t+o)%1,u=0,c=i;u<c.length;u++)l=c[u],a.to(l).update(Ac(Ac({},l.params?.values),{t:s}));return[4,y2.State.Update(r.plugin,{state:n,tree:a,options:{doNotLogTiming:!0}})];case 1:return d.sent(),[2,{kind:"next",state:{t:s}}]}})})}}),iae=Cg(),aae=Cg(),oae=Ug(),sae=xd.create({name:"built-in.animate-camera-rock",display:{name:"Camera Rock",description:"Rock the 3D scene around the x-axis in view space"},isExportable:!0,params:function(){return{durationInMs:Ib.Numeric(4e3,{min:100,max:2e4,step:100}),speed:Ib.Numeric(1,{min:1,max:10,step:1},{description:"How many times to rock from side to side."}),angle:Ib.Numeric(10,{min:0,max:180,step:1},{description:"How many degrees to rotate in each direction."})}},initialState:function(e,t){return{snapshot:t.canvas3d.camera.getSnapshot()}},getDuration:function(e){return{kind:"fixed",durationMs:e.durationInMs}},teardown:function(e,t,r){var n;null==(n=r.canvas3d)||n.requestCameraReset({snapshot:t.snapshot,durationMs:0})},apply:function(e,t,r){var n;return Tc(this,void 0,void 0,function(){var i,a,o,s;return Pc(this,function(u){return 0===t.current?[2,{kind:"next",state:e}]:(i=e.snapshot).radiusMax<1e-4?[2,{kind:"finished"}]:(a=t.animation?t.animation?.currentFrame/(t.animation.frameCount+1):bg(t.current/r.params.durationInMs,0,1),o=Math.sin(a*r.params.speed*Math.PI*2)*Mg(r.params.angle),Cg.sub(iae,i.position,i.target),Cg.normalize(aae,i.up),Ug.setAxisAngle(oae,aae,o),Cg.transformQuat(iae,iae,oae),s=Cg.add(Cg(),i.target,iae),null==(n=r.plugin.canvas3d)||n.requestCameraReset({snapshot:Ac(Ac({},i),{position:s}),durationMs:0}),a>=.99999?[2,{kind:"finished"}]:[2,{kind:"next",state:e}])})})}});!function(e){e.Action=function(e,t){return{action:e,customControl:t&&t.customControl,autoUpdate:t&&t.autoUpdate}},e.Behavior=function(e,t){return void 0===t&&(t={}),{transformer:e,defaultParams:t}}}(eae||={}),function(e){e.Registry=function(){function e(){this.providers=_m().asMutable(),this.defaultAutoAttachValues=new Map}return e.prototype.getParams=function(e){var t={},r=[],n=[];if(e)for(var i=this.providers.values();;){var a=i.next();if(a.done)break;var o=a.value;o.isApplicable(e)&&(o.isHidden||(r.push([o.descriptor.name,o.label]),this.defaultAutoAttachValues.get(o.descriptor.name)&&n.push(o.descriptor.name)),t[o.descriptor.name]=Ib.Group(Ac({},o.getParams(e)),{label:o.label,isHidden:o.isHidden}))}return{autoAttach:Ib.MultiSelect(n,r),properties:Ib.Group(t,{isFlat:!0})}},e.prototype.setDefaultAutoAttach=function(e,t){this.defaultAutoAttachValues.set(e,t)},e.prototype.get=function(e){if(!this.providers.get(e))throw Error(`Custom property '${e}' is not registered.`);return this.providers.get(e)},e.prototype.register=function(e,t){this.providers.set(e.descriptor.name,e),this.defaultAutoAttachValues.set(e.descriptor.name,t)},e.prototype.unregister=function(e){this.providers.delete(e),this.defaultAutoAttachValues.delete(e)},e}()}(tae||={});var uae=function(){function e(e){this.plugin=e}return Object.defineProperty(e.prototype,"dataState",{get:function(){return this.plugin.state.data}
139,enumerable:!1,configurable:!0}),e.prototype.rawData=function(e,t){return this.dataState.build().toRoot().apply(JC,e,t).commit({revertOnError:!0})},e.prototype.download=function(e,t){return this.dataState.build().toRoot().apply(ZC,e,t).commit({revertOnError:!0})},e.prototype.downloadBlob=function(e,t){return this.dataState.build().toRoot().apply(QC,e,t).commit({revertOnError:!0})},e.prototype.readFile=function(e,t){return Tc(this,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return[4,this.dataState.build().toRoot().apply(eT,e,t).commit({revertOnError:!0})];case 1:return r=i.sent(),n=Ore(e.file?.file?.name??""),[2,{data:r,fileInfo:n}]}})})},e}(),cae=function(){function e(e){var t=this;this.plugin=e,this._providers=[],this.providerMap=new Map,this.defaultProvider=xre.auto,Hg(xre,function(e){return t.registerPreset(e)})}return Object.defineProperty(e.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),e.prototype.resolveProvider=function(e){return"string"==typeof e?xre[e]??Vv(this._providers,function(t){return t.id===e}):e},e.prototype.hasPreset=function(e){for(var t=0,r=this._providers;t<r.length;t++){var n=r[t];if(!n.isApplicable||n.isApplicable(e,this.plugin))return!0}return!1},Object.defineProperty(e.prototype,"providers",{get:function(){return this._providers},enumerable:!1,configurable:!0}),e.prototype.getPresets=function(e){if(!e)return this.providers;for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push(i)}return t},e.prototype.getPresetSelect=function(e){for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];e&&i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push([i.id,i.display.name,i.display.group])}return Ib.Select("auto",t)},e.prototype.getPresetsWithOptions=function(e){for(var t=[],r=Object.create(null),n=0,i=this._providers;n<i.length;n++){var a=i[n];a.isApplicable&&!a.isApplicable(e,this.plugin)||(t.push([a.id,a.display.name]),r[a.id]=a.params?Ib.Group(a.params(e,this.plugin)):Ib.EmptyGroup())}return 0===t.length?Ib.MappedStatic("",{"":Ib.EmptyGroup()}):Ib.MappedStatic(t[0][0],r,{options:t})},e.prototype.registerPreset=function(e){if(this.providerMap.has(e.id))throw Error(`Representation provider with id '${e.id}' already registered.`);this._providers.push(e),this.providerMap.set(e.id,e)},e.prototype.unregisterPreset=function(e){this.providerMap.delete(e.id),Gb(this._providers,e)},e.prototype.applyPreset=function(e,t,r){var n=this,i=this.resolveProvider(t);if(i){var a=this.plugin.state.data,o=hf.resolveAndCheck(a,e);if(o){var s=i.params?.call(i,o.obj,this.plugin)||{},u=r||(i.params?Ib.getDefaultValues(s):{}),c=this.plugin.config.get(j2.Structure.DefaultRepresentationPresetParams);u=Ib.merge(s,c,u);var l=vy.create(`${i.display.name}`,function(){return i.apply(o,u,n.plugin)});return this.plugin.runTask(l)}iy||console.warn("Applying structure repr. provider to bad cell.")}},e.prototype.addRepresentation=function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=this.dataState.build(),(i=this.buildRepresentation(n,e,t,r))?[4,n.commit()]:[2];case 1:return a.sent(),[2,i]}})})},e.prototype.buildRepresentation=function(e,t,r,n){if(t){var i=hf.resolveAndCheck(this.dataState,t)?.obj?.data;if(i){var a=Qte(this.plugin,i,r);return n?.tag?e.to(t).applyOrUpdateTagged(n.tag,q1,a,{state:n?.initialState}).selector:e.to(t).apply(q1,a,{state:n?.initialState}).selector}}},e}();function lae(e){return e}!function(e){e.CommonParams=function(e,t){return{modelProperties:Ib.Optional(Ib.Group(Ob.getParamDefinition(m2.Model.CustomModelProperties,void 0,t))),structureProperties:Ib.Optional(Ib.Group(Ob.getParamDefinition(m2.Model.CustomStructureProperties,void 0,t))),representationPreset:Ib.Optional(Ib.Text("auto"))}}}(lae||={});var dae=lae.CommonParams,fae={id:"preset-trajectory-default",display:{name:"Default (Assembly)",group:"Preset",description:"Shows the first assembly or, if that is unavailable, the first model."},isApplicable:function(e){return!0},params:function(e,t){return Ac({model:Ib.Optional(Ib.Group(Ob.getParamDefinition(m2.Model.ModelFromTrajectory,e,t))),showUnitcell:Ib.Optional(Ib.Boolean(!1)),structure:Ib.Optional(gq.getParams(void 0,"assembly").type),representationPresetParams:Ib.Optional(Ib.Group(sre.CommonParams))},dae(e,t))},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return[4,(n=r.builders.structure).createModel(e,t.model)];case 1:return i=f.sent(),[4,n.insertModelProperties(i,t.modelProperties)];case 2:return a=f.sent(),[4,n.createStructure(a||i,t.structure)];case 3:return o=f.sent(),[4,n.insertStructureProperties(o,t.structureProperties)];case 4:return s=f.sent(),void 0===t.showUnitcell||t.showUnitcell?[4,n.tryCreateUnitcell(a,void 0,{isHidden:!0})]:[3,6];case 5:return c=f.sent(),[3,7];case 6:c=void 0,f.label=7;case 7:return u=c,l=t.representationPreset||r.config.get(j2.Structure.DefaultRepresentationPreset)||xre.auto.id,[4,r.builders.structure.representation.applyPreset(s,l,t.representationPresetParams)];case 8:return d=f.sent(),[2,{model:i,modelProperties:a,unitcell:u,structure:o,structureProperties:s,representation:d}]}})})}},hae={id:"preset-trajectory-all-models",display:{name:"All Models",group:"Preset",description:"Shows all models; colored by trajectory-index."},isApplicable:function(e){return e.data.frameCount>1},params:function(e,t){return Ac({useDefaultIfSingleModel:Ib.Optional(Ib.Boolean(!1)),representationPresetParams:Ib.Optional(Ib.Group(sre.CommonParams))},dae(e,t))},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h;return Pc(this,function(p){switch(p.label){case 0:if(!(n=hf.resolveAndCheck(r.state.data,e)?.obj?.data))return[2,{}];if(1===n.frameCount&&t.useDefaultIfSingleModel)return[2,fae.apply(e,t,r)];i=r.builders.structure,a=[],o=[],s=0,p.label=1;case 1:return s<n.frameCount?[4,i.createModel(e,{modelIndex:s})]:[3,8];case 2:return u=p.sent(),[4,i.insertModelProperties(u,t.modelProperties,{isCollapsed:!0})];case 3:return c=p.sent(),[4,i.createStructure(c||u,{name:"model",params:{}})];case 4:return l=p.sent(),[4,i.insertStructureProperties(l,t.structureProperties)];case 5:return d=p.sent(),a.push(u),o.push(l),f=l.obj?BQ(l.obj.data,{elementCountFactor:n.frameCount}):"medium",h=t.representationPreset||r.config.get(j2.Structure.DefaultRepresentationPreset)||xre.auto.id,[4,i.representation.applyPreset(d,h,{theme:{globalName:"trajectory-index"},quality:f})];case 6:p.sent(),p.label=7;case 7:return s++,[3,1];case 8:return[2,{models:a,structures:o}]}})})}},pae=function(e,t){return Ac({model:Ib.Optional(Ib.Group(Ob.getParamDefinition(m2.Model.ModelFromTrajectory,e,t)))},dae(e,t))};function mae(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return[4,(i=n.builders.structure).createModel(t,r.model)];case 1:return a=f.sent(),[4,i.insertModelProperties(a,r.modelProperties)];case 2:return o=f.sent(),[4,i.createStructure(o||a,{name:"symmetry",params:e})];case 3:return s=f.sent(),[4,i.insertStructureProperties(s,r.structureProperties)];case 4:return u=f.sent(),[4,i.tryCreateUnitcell(o,void 0,{isHidden:!1})];case 5:return c=f.sent(),l=r.representationPreset||n.config.get(j2.Structure.DefaultRepresentationPreset)||xre.auto.id,[4,n.builders.structure.representation.applyPreset(u,l,{theme:{globalName:e.theme}})];case 6:return d=f.sent(),[2,{model:a,modelProperties:o,unitcell:c,structure:s,structureProperties:u,representation:d}]}})})}var gae,vae,yae={default:fae,"all-models":hae,unitcell:{id:"preset-trajectory-unitcell",display:{name:"Unit Cell",group:"Preset",description:"Shows the fully populated unit cell."},isApplicable:function(e){return Xz.hasCrystalSymmetry(e.data.representative)},params:pae,apply:function(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return[4,mae({ijkMin:Cg.create(0,0,0),ijkMax:Cg.create(0,0,0)},e,t,r)];case 1:return[2,n.sent()]}})})}},supercell:{id:"preset-trajectory-supercell",display:{name:"Super Cell",group:"Preset",description:"Shows the super cell, i.e. the central unit cell and all adjacent unit cells."},isApplicable:function(e){return Xz.hasCrystalSymmetry(e.data.representative)},params:pae,apply:function(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return[4,mae({ijkMin:Cg.create(-1,-1,-1),ijkMax:Cg.create(1,1,1),theme:"operator-hkl"},e,t,r)];case 1:return[2,n.sent()]}})})}},crystalContacts:{id:"preset-trajectory-crystal-contacts",display:{name:"Crystal Contacts",group:"Preset",description:"Showsasymetric unit and chains from neighbours within 5 Å, i.e., symmetry mates."},isApplicable:function(e){return Xz.hasCrystalSymmetry(e.data.representative)},params:function(e,t){return Ac({model:Ib.Optional(Ib.Group(Ob.getParamDefinition(m2.Model.ModelFromTrajectory,e,t)))},dae(e,t))},apply:function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return[4,(n=r.builders.structure).createModel(e,t.model)];case 1:return i=d.sent(),[4,n.insertModelProperties(i,t.modelProperties)];case 2:return a=d.sent(),[4,n.createStructure(a||i,{name:"symmetry-mates",params:{radiu
139s:5}})];case 3:return o=d.sent(),[4,n.insertStructureProperties(o,t.structureProperties)];case 4:return s=d.sent(),[4,n.tryCreateUnitcell(a,void 0,{isHidden:!0})];case 5:return u=d.sent(),c=t.representationPreset||r.config.get(j2.Structure.DefaultRepresentationPreset)||xre.auto.id,[4,r.builders.structure.representation.applyPreset(s,c,{theme:{globalName:"operator-name",carbonColor:"operator-name",focus:{name:"element-symbol",params:{carbonColor:{name:"operator-name",params:nK.defaultValues}}}}})];case 6:return l=d.sent(),[2,{model:i,modelProperties:a,unitcell:u,structure:o,structureProperties:s,representation:l}]}})})}}},bae=function(){function e(e){var t=this;this.plugin=e,this._providers=[],this.providerMap=new Map,this.defaultProvider=yae.default,Hg(yae,function(e){return t.registerPreset(e)})}return e.prototype.resolveProvider=function(e){return"string"==typeof e?yae[e]??Vv(this._providers,function(t){return t.id===e}):e},e.prototype.hasPreset=function(e){for(var t=0,r=this._providers;t<r.length;t++){var n=r[t];if(!n.isApplicable||n.isApplicable(e,this.plugin))return!0}return!1},Object.defineProperty(e.prototype,"providers",{get:function(){return this._providers},enumerable:!1,configurable:!0}),e.prototype.getPresets=function(e){if(!e)return this.providers;for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push(i)}return t},e.prototype.getPresetSelect=function(e){for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];e&&i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push([i.id,i.display.name])}return Ib.Select("auto",t)},e.prototype.getPresetsWithOptions=function(e){for(var t=[],r=Object.create(null),n=0,i=this._providers;n<i.length;n++){var a=i[n];a.isApplicable&&!a.isApplicable(e,this.plugin)||(t.push([a.id,a.display.name]),r[a.id]=a.params?Ib.Group(a.params(e,this.plugin)):Ib.EmptyGroup())}return 0===t.length?Ib.MappedStatic("",{"":Ib.EmptyGroup()}):Ib.MappedStatic(t[0][0],r,{options:t})},e.prototype.registerPreset=function(e){if(this.providerMap.has(e.id))throw Error(`Hierarchy provider with id '${e.id}' already registered.`);this._providers.push(e),this.providerMap.set(e.id,e)},e.prototype.unregisterPreset=function(e){this.providerMap.delete(e.id),Gb(this._providers,e)},e.prototype.applyPreset=function(e,t,r){var n=this,i=this.resolveProvider(t);if(i){var a=this.plugin.state.data,o=hf.resolveAndCheck(a,e);if(o){var s=r||(i.params?Ib.getDefaultValues(i.params(o.obj,this.plugin)):{}),u=vy.create(`${i.display.name}`,function(){return i.apply(o,s,n.plugin)});return this.plugin.runTask(u)}iy||console.warn("Applying hierarchy preset provider to bad cell.")}},e}(),_ae=function(){function e(e){this.plugin=e,this.hierarchy=new bae(this.plugin),this.representation=new cae(this.plugin)}return Object.defineProperty(e.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),e.prototype.parseTrajectoryData=function(e,t){return Tc(this,void 0,void 0,function(){var r;return Pc(this,function(n){switch(n.label){case 0:if(!(r="string"==typeof t?this.plugin.dataFormats.get(t):t))throw Error(`'${t}' is not a supported data format.`);return[4,r.parse(this.plugin,e)];case 1:return[2,n.sent().trajectory]}})})},e.prototype.parseTrajectoryBlob=function(e,t){return this.dataState.build().to(e).apply(m2.Data.ParseBlob,t,{state:{isGhost:!0}}).apply(m2.Model.TrajectoryFromBlob,void 0).commit({revertOnError:!0})},e.prototype.parseTrajectory=function(e,t){var r=hf.resolveAndCheck(this.dataState,e);if(!r)throw Error("Invalid data cell.");return DS.Data.Blob.is(r.obj)?this.parseTrajectoryBlob(e,t):this.parseTrajectoryData(e,t)},e.prototype.createModel=function(e,t,r){return this.dataState.build().to(e).apply(m2.Model.ModelFromTrajectory,t||{modelIndex:0},{state:r}).commit({revertOnError:!0})},e.prototype.insertModelProperties=function(e,t,r){return this.dataState.build().to(e).apply(m2.Model.CustomModelProperties,t,{state:r}).commit({revertOnError:!0})},e.prototype.tryCreateUnitcell=function(e,t,r){var n=this.dataState,i=hf.resolveAndCheck(n,e)?.obj?.data;if(i){var a=Dz.Provider.get(i)?.spacegroup.cell;if(!LE.isZero(a))return n.build().to(e).apply(m2.Representation.ModelUnitcell3D,t,{state:r}).commit({revertOnError:!0})}},e.prototype.createStructure=function(e,t,r,n){var i=this.dataState;if(!t){var a=hf.resolveAndCheck(i,e);if(a){var o=Dz.Provider.get(a.obj?.data);o&&0!==o?.assemblies.length||(t={name:"model",params:{}})}}return i.build().to(e).apply(m2.Model.StructureFromModel,{type:t||{name:"assembly",params:{}}},{state:r,tags:n}).commit({revertOnError:!0})},e.prototype.insertStructureProperties=function(e,t){return this.dataState.build().to(e).apply(m2.Model.CustomStructureProperties,t).commit({revertOnError:!0})},e.prototype.isComponentTransform=function(e){return e.transform.transformer===m2.Model.StructureComponent},e.prototype.tryCreateComponent=function(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return i=this.dataState,a=i.build().to(e),o=`structure-component-${r}`,[4,(s=a.applyOrUpdateTagged(o,m2.Model.StructureComponent,t,{tags:n?kc(kc([],n,!0),[o],!1):[o]})).commit()];case 1:return c.sent(),(u=s.selector).isOk&&0!==(u.cell?.obj)?.data.elementCount?[3,3]:[4,i.build().delete(u.ref).commit()];case 2:return c.sent(),[2];case 3:return[2,u]}})})},e.prototype.tryCreateComponentFromExpression=function(e,t,r,n){return this.tryCreateComponent(e,{type:{name:"expression",params:t},nullIfEmpty:!0,label:(n?.label||"").trim()},r,n?.tags)},e.prototype.tryCreateComponentStatic=function(e,t,r){return this.tryCreateComponent(e,{type:{name:"static",params:t},nullIfEmpty:!0,label:(r?.label||"").trim()},`static-${t}`,r?.tags)},e.prototype.tryCreateComponentFromSelection=function(e,t,r,n){var i=this;return this.plugin.runTask(vy.create("Query Component",function(a){return Tc(i,void 0,void 0,function(){var i,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return o=(i=n||{}).label,s=i.tags,o=(o||"").trim(),(u=hf.resolveAndCheck(this.dataState,e)?.obj?.data)?t.referencesCurrent?(h={},p={name:"bundle"},f=(d=sU).fromSelection,[4,t.getSelection(this.plugin,a,u)]):[3,2]:[2];case 1:return h.type=(p.params=f.apply(d,[m.sent()]),p),h.nullIfEmpty=!0,h.label=o||t.label,l=h,[3,3];case 2:l={type:{name:"expression",params:t.expression},nullIfEmpty:!0,label:o||t.label},m.label=3;case 3:return c=l,t.ensureCustomProperties?[4,t.ensureCustomProperties({runtime:a,assetManager:this.plugin.managers.asset},u)]:[3,5];case 4:m.sent(),m.label=5;case 5:return[2,this.tryCreateComponent(e,c,r,s)]}})})}))},e}();function xae(e,t,r){void 0===r&&(r={});var n=r;return"string"==typeof n.type||"string"==typeof n.color||"string"==typeof n.size?function(e,t,r){var n=r.type&&e.representation.volume.registry.get(r.type)||e.representation.volume.registry.default.provider,i=r.color&&e.representation.volume.themes.colorThemeRegistry.get(r.color)||e.representation.volume.themes.colorThemeRegistry.get(n.defaultColorTheme.name),a=r.size&&e.representation.volume.themes.sizeThemeRegistry.get(r.size)||e.representation.volume.themes.sizeThemeRegistry.get(n.defaultSizeTheme.name);return Sae(e,t,{type:n,typeParams:r.typeParams,color:i,colorParam
139s:r.colorParams,size:a,sizeParams:r.sizeParams})}(e,t||gR.One,r):Sae(e,t||gR.One,r)}function Sae(e,t,r){void 0===r&&(r={});var n=e.representation.volume.themes,i={volume:t},a=r.type||e.representation.volume.registry.default.provider,o=Ib.getDefaultValues(a.getParams(n,t)),s=Object.assign(o,r.typeParams),u=r.color||n.colorThemeRegistry.get(a.defaultColorTheme.name),c=Ib.getDefaultValues(u.getParams(i));u.name===a.defaultColorTheme.name&&Object.assign(c,a.defaultColorTheme.props);var l=Object.assign(c,r.colorParams),d=r.size||n.sizeThemeRegistry.get(a.defaultSizeTheme.name),f=Ib.getDefaultValues(d.getParams(i));d.name===a.defaultSizeTheme.name&&Object.assign(f,a.defaultSizeTheme.props);var h=Object.assign(f,r.sizeParams);return{type:{name:a.name,params:s},colorTheme:{name:u.name,params:l},sizeTheme:{name:d.name,params:h}}}(function(e){e.create=function(e){var t=e.name;return{descriptor:e,get:function(e){return e._propertyData[t]},set:function(r,n){r.customProperties.add(e),r._propertyData[t]=n}}}})(gae||={}),function(e){e.Descriptor={name:"recommended_iso_value"},e.Provider=gae.create(e.Descriptor)}(vae||={});var wae="Volume";function Aae(e,t){return Tc(this,void 0,void 0,function(){var r,n=this;return Pc(this,function(i){return t&&(r=t.entryId)&&r.toLowerCase().startsWith("emd")?[2,e.runTask(vy.create("Try Set Recommended IsoValue",function(i){return Tc(n,void 0,void 0,function(){var n,a;return Pc(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,sne(e,i,r)];case 1:return n=o.sent(),vae.Provider.set(t,gR.IsoValue.absolute(n)),[3,3];case 2:return a=o.sent(),console.warn(a),[3,3];case 3:return[2]}})})}))]:[2]})})}function Cae(e){var t=vae.Provider.get(e);if(t)return"relative"===t.kind?t:gR.adjustedIsoValue(e,t.absoluteValue,"absolute")}function Tae(e,t){return Tc(this,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r={},(n=t.volume.data&&Cae(t.volume.data))&&(r.isoValue=n),[4,e.build().to(t.volume).apply(m2.Representation.VolumeRepresentation3D,xae(e,t.volume.data,{type:"isosurface",typeParams:r})).commit()];case 1:return[2,[i.sent()]]}})})}var Pae=[["ccp4",{label:"CCP4/MRC/MAP",description:"CCP4/MRC/MAP",category:wae,binaryExtensions:["ccp4","mrc","map"],parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=e.build().to(t).apply(m2.Data.ParseCcp4,{},{state:{isGhost:!0}}),i=n.apply(m2.Volume.VolumeFromCcp4,{entryId:r?.entryId}),[4,n.commit({revertOnError:!0})];case 1:return a.sent(),[4,Aae(e,i.selector.data)];case 2:return a.sent(),[2,{format:n.selector,volume:i.selector}]}})})},visuals:Tae}],["dsn6",{label:"DSN6/BRIX",description:"DSN6/BRIX",category:wae,binaryExtensions:["dsn6","brix"],parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=e.build().to(t).apply(m2.Data.ParseDsn6,{},{state:{isGhost:!0}}),i=n.apply(m2.Volume.VolumeFromDsn6,{entryId:r?.entryId}),[4,n.commit({revertOnError:!0})];case 1:return a.sent(),[4,Aae(e,i.selector.data)];case 2:return a.sent(),[2,{format:n.selector,volume:i.selector}]}})})},visuals:Tae}],["cube",{label:"Cube",description:"Cube",category:wae,stringExtensions:["cub","cube"],parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i,a;return Pc(this,function(o){switch(o.label){case 0:return n=e.build().to(t).apply(m2.Data.ParseCube,{},{state:{isGhost:!0}}),i=n.apply(m2.Volume.VolumeFromCube,{entryId:r?.entryId}),a=n.apply(m2.Model.TrajectoryFromCube,void 0,{state:{isGhost:!0}}).apply(m2.Model.ModelFromTrajectory).apply(m2.Model.StructureFromModel),[4,n.commit({revertOnError:!0})];case 1:return o.sent(),[4,Aae(e,i.selector.data)];case 2:return o.sent(),[2,{format:n.selector,volume:i.selector,structure:a.selector}]}})})},visuals:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n,i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return r=e.build(),n=[],(i=t.volume.cell?.obj?.data)&&gR.isOrbitals(i)?(a=r.to(t.volume).apply(m2.Representation.VolumeRepresentation3D,xae(e,i,{type:"isosurface",typeParams:{isoValue:gR.IsoValue.relative(1),alph
139a:.4},color:"uniform",colorParams:{value:MC.blue}})),o=r.to(t.volume).apply(m2.Representation.VolumeRepresentation3D,xae(e,i,{type:"isosurface",typeParams:{isoValue:gR.IsoValue.relative(-1),alpha:.4},color:"uniform",colorParams:{value:MC.red}})),n.push(a.selector,o.selector)):(s=r.to(t.volume).apply(m2.Representation.VolumeRepresentation3D,xae(e,i,{type:"isosurface",typeParams:{isoValue:gR.IsoValue.relative(2),alpha:.4},color:"uniform",colorParams:{value:MC.grey}})),n.push(s.selector)),[4,e.builders.structure.representation.applyPreset(t.structure,"auto")];case 1:return u=l.sent(),[4,r.commit()];case 2:return l.sent(),c=[],Hg(u?.representations,function(e){e&&c.push(e)}),[2,kc(kc([],n,!0),c,!0)]}})})}}],["dx",{label:"DX",description:"DX",category:wae,stringExtensions:["dx"],binaryExtensions:["dxbin"],parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i;return Pc(this,function(a){switch(a.label){case 0:return n=e.build().to(t).apply(m2.Data.ParseDx,{},{state:{isGhost:!0}}),[4,(i=n.apply(m2.Volume.VolumeFromDx,{entryId:r?.entryId})).commit({revertOnError:!0})];case 1:return a.sent(),[4,Aae(e,i.selector.data)];case 2:return a.sent(),[2,{volume:i.selector}]}})})},visuals:Tae}],["dscif",{label:"DensityServer CIF",description:"DensityServer CIF",category:wae,stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:function(e,t){return"dscif"===Sre(e,t)},parse:function(e,t,r){return Tc(void 0,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return[4,e.build().to(t).apply(m2.Data.ParseCif).commit()];case 1:if(n=m.sent(),i=e.build().to(n),0===(a=n.obj.data.blocks).length)throw Error("no data blocks");for(o=[],s=0,u=0,c=a;u<c.length;u++)"SERVER"!==(l=c[u]).header.toUpperCase()&&(d=Array.isArray(r?.entryId)?r?.entryId[s]:r?.entryId,l.categories.volume_data_3d_info?.rowCount>0&&(o.push(i.apply(m2.Volume.VolumeFromDensityServerCif,{blockHeader:l.header,entryId:d}).selector),s++));return[4,i.commit()];case 2:m.sent(),f=0,h=o,m.label=3;case 3:return f<h.length?(p=h[f],[4,Aae(e,p.data)]):[3,6];case 4:m.sent(),m.label=5;case 5:return f++,[3,3];case 6:return[2,{volumes:o}]}})})},visuals:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return r=t.volumes,n=e.build(),i=[],r.length>0&&(a=r[0].data&&Cae(r[0].data)||gR.IsoValue.relative(1.5),i[0]=n.to(r[0]).apply(m2.Representation.VolumeRepresentation3D,H1.getDefaultParamsStatic(e,"isosurface",{isoValue:a,alpha:1},"uniform",{value:MC.teal})).selector),r.length>1&&(o=H1.getDefaultParamsStatic(e,"isosurface",{isoValue:gR.IsoValue.relative(3),alpha:.3},"uniform",{value:MC.green}),s=H1.getDefaultParamsStatic(e,"isosurface",{isoValue:gR.IsoValue.relative(-3),alpha:.3},"uniform",{value:MC.red}),i[i.length]=n.to(r[1]).apply(m2.Representation.VolumeRepresentation3D,o).selector,i[i.length]=n.to(r[1]).apply(m2.Representation.VolumeRepresentation3D,s).selector),[4,n.commit()];case 1:return u.sent(),[2,i]}})})}}],["segcif",{label:"Segmentation CIF",description:"Segmentation CIF",category:wae,stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:function(e,t){return"segcif"===Sre(e,t)},parse:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return[4,e.build().to(t).apply(m2.Data.ParseCif).commit()];case 1:if(r=c.sent(),n=e.build().to(r),0===(i=r.obj.data.blocks).length)throw Error("no data blocks");for(a=[],o=0,s=i;o<s.length;o++)"SERVER"!==(u=s[o]).header.toUpperCase()&&u.categories.volume_data_3d_info?.rowCount>0&&a.push(n.apply(m2.Volume.VolumeFromSegmentationCif,{blockHeader:u.header}).selector);return[4,n.commit()];case 2:return c.sent(),[2,{volumes:a}]}})})},visuals:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n,i;return Pc(this,function(a){switch(a.label){case 0:return r=t.volumes,n=e.build(),i=[],r.length>0&&gR.Segmentation.get(r[0].data)&&(i[i.length]=n.to(r[0]).apply(m2.Representation.VolumeRepresentation3D,H1.getDefaultParams(e,"segment",r[0].data,{alpha:1,instanceGranularity:!0},"volume-segment",{})).selector),[4,n.commit()];case 1:return a.sent(),[2,i]}})})}}]],Eae=[["ply",{label:"PLY",description:"PLY",category:"Shape",stringExtensions:["ply"],parse:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r=e.state.data.build().to(t).apply(m2.Data.ParsePly,{},{state:{isGhost:!0}}),n=r.apply(m2.Model.ShapeFromPly),[4,r.commit()];case 1:return i.sent(),[2,{format:r.selector,shape:n.selector}]}})})},visuals:function(e,t){return e.state.data.build().to(t.shape).apply(m2.Representation.ShapeRepresentation3D).commit()}}]],Mae=function(){function e(){this._list=[],this._map=new Map,this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0;for(var e=0,t=Pae;e<t.length;e++){var r=t[e],n=r[0],i=r[1];this.add(n,i)}for(var a=0,o=Bre;a<o.length;a++){var s=o[a];n=s[0],i=s[1],this.add(n,i)}for(var u=0,c=Fre;u<c.length;u++){var l=c[u];n=l[0],i=l[1],this.add(n,i)}for(var d=0,f=Eae;d<f.length;d++){var h=f[d];n=h[0],i=h[1],this.add(n,i)}for(var p=0,m=Ire;p<m.length;p++){var g=m[p];n=g[0],i=g[1],this.add(n,i)}}return Object.defineProperty(e.prototype,"types",{get:function(){return this._list.map(function(e){return[e.name,e.provider.label]})}
139,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){if(this._extensions)return this._extensions;var e=new Set;return this._list.forEach(function(t){var r,n,i=t.provider;null==(r=i.stringExtensions)||r.forEach(function(t){return e.add(t)}),null==(n=i.binaryExtensions)||n.forEach(function(t){return e.add(t)})}),this._extensions=e,e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"binaryExtensions",{get:function(){if(this._binaryExtensions)return this._binaryExtensions;var e=new Set;return this._list.forEach(function(t){return t.provider.binaryExtensions?.forEach(function(t){return e.add(t)})}),this._binaryExtensions=e,e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){if(this._options)return this._options;var e=[];return this._list.forEach(function(t){var r=t.name,n=t.provider;return e.push([r,n.label,n.category||""])}),this._options=e,e},enumerable:!1,configurable:!0}),e.prototype._clear=function(){this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0},e.prototype.add=function(e,t){this._clear(),this._list.push({name:e,provider:t}),this._map.set(e,t)},e.prototype.remove=function(e){this._clear(),this._list.splice(this._list.findIndex(function(t){return t.name===e}),1),this._map.delete(e)},e.prototype.auto=function(e,t){for(var r,n,i=0,a=this.list.length;i<a;++i){var o=this._list[i].provider,s=!1;if((null!=(r=o.binaryExtensions)&&r.includes(e.ext)||null!=(n=o.stringExtensions)&&n.includes(e.ext))&&(s=!0),s&&(!o.isApplicable||o.isApplicable(e,t.data)))return o}},e.prototype.get=function(e){if(this._map.has(e))return this._map.get(e);throw Error(`unknown data format name '${e}'`)},Object.defineProperty(e.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),e}(),kae=function(e){function t(t){var r=e.call(this,{params:{current:""},animationState:"stopped"})||this;return r.context=t,r.map=new Map,r._animations=[],r.currentTime=0,r._params=void 0,r.events={updated:r.ev(),applied:r.ev()},r.isStopped=!0,r.isApplying=!1,r}return wc(t,e),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this._animations.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animations",{get:function(){return this._animations},enumerable:!1,configurable:!0}),t.prototype.triggerUpdate=function(){this.events.updated.next(void 0)},t.prototype.triggerApply=function(){this.events.applied.next(void 0)},t.prototype.getParams=function(){return this._params||={current:Ib.Select(this._animations[0]&&this._animations[0].name,this._animations.map(function(e){return[e.name,e.display.name]}),{label:"Animation"})},this._params},t.prototype.updateParams=function(e){if(!this.isEmpty){this.updateState({params:Ac(Ac({},this.state.params),e)});var t=this.map.get(this.state.params.current),r=t.params(this.context);this._current={anim:t,params:r,paramValues:Ib.getDefaultValues(r),state:{},startedTime:-1,lastTime:0},this.triggerUpdate()}},t.prototype.updateCurrentParams=function(e){this.isEmpty||(this._current.paramValues=Ac(Ac({},this._current.paramValues),e),this.triggerUpdate())},t.prototype.register=function(e){this.map.has(e.name)?this.context.log.error(`Animation '${e.name}' is already registered.`):(this._params=void 0,this.map.set(e.name,e),this._animations.push(e),1===this._animations.length?this.updateParams({current:e.name}):this.triggerUpdate())},t.prototype.play=function(e,t){return Tc(this,void 0,void 0,function(){return Pc(this,function(r){switch(r.label){case 0:return[4,this.stop()];case 1:return r.sent(),this.map.has(e.name)||this.register(e),this.updateParams({current:e.name}),this.updateCurrentParams(t),[4,this.start()];case 2:return r.sent(),[2]}})})},t.prototype.tick=function(e,t,r){return Tc(this,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return this.currentTime=e,this.isStopped?[2]:t||r?[4,this.applyFrame(r)]:[3,2];case 1:return n.sent(),[3,3];case 2:this.applyAsync(),n.label=3;case 3:return[2]}})})},t.prototype.start=function(){return Tc(this,void 0,void 0,function(){var e,t,r;return Pc(this,function(n){switch(n.label){case 0:return this.updateState({animationState:"playing"}),this.context.behaviors.state.isAnimating.value||this.context.behaviors.state.isAnimating.next(!0),this.triggerUpdate(),e=this._current.anim,t=this._current.anim.initialState(this._current.paramValues,this.context),e.setup?[4,e.setup(this._current.paramValues,t,this.context)]:[3,2];case 1:(r=n.sent())&&(t=r),n.label=2;case 2:return this._current.lastTime=0,this._current.startedTime=-1,this._current.state=t,this.isStopped=!1,[2]}})})},t.prototype.stop=function(){return Tc(this,void 0,void 0,function(){var e;return Pc(this,function(t){switch(t.label){case 0:return this.isStopped=!0,"stopped"===this.state.animationState?[3,3]:(e=this._current.anim).teardown?[4,e.teardown(this._current.paramValues,this._current.state,this.context)]:[3,2];case 1:t.sent(),t.label=2;case 2:this.updateState({animationState:"stopped"}),this.triggerUpdate(),t.label=3;case 3:return this.context.behaviors.state.isAnimating.value&&this.context.behaviors.state.isAnimating.next(!1),[2]}})})},Object.defineProperty(t.prototype,"isAnimating",{get:function(){return"playing"===this.state.animationState}
139,enumerable:!1,configurable:!0}),t.prototype.applyAsync=function(){return Tc(this,void 0,void 0,function(){return Pc(this,function(e){switch(e.label){case 0:if(this.isApplying)return[2];this.isApplying=!0,e.label=1;case 1:return e.trys.push([1,,3,4]),[4,this.applyFrame()];case 2:return e.sent(),[3,4];case 3:return this.isApplying=!1,[7];case 4:return[2]}})})},t.prototype.applyFrame=function(e){return Tc(this,void 0,void 0,function(){var t,r;return Pc(this,function(n){switch(n.label){case 0:return t=this.currentTime,this._current.startedTime<0&&(this._current.startedTime=t),[4,this._current.anim.apply(this._current.state,{lastApplied:this._current.lastTime,current:t-this._current.startedTime,animation:e},{params:this._current.paramValues,plugin:this.context})];case 1:return"finished"===(r=n.sent()).kind?this.stop():"next"===r.kind&&(this._current.state=r.state,this._current.lastTime=t-this._current.startedTime),this.triggerApply(),[2]}})})},t.prototype.getSnapshot=function(){return this.current?{state:this.state,current:{paramValues:this._current.paramValues,state:this._current.anim.stateSerialization?this._current.anim.stateSerialization.toJSON(this._current.state):this._current.state}}:{state:this.state}},t.prototype.setSnapshot=function(e){this.isEmpty||(this.updateState({animationState:e.state.animationState}),this.updateParams(e.state.params),e.current&&(this.current.paramValues=e.current.paramValues,this.current.state=this._current.anim.stateSerialization?this._current.anim.stateSerialization.fromJSON(e.current.state):e.current.state,this.triggerUpdate(),"playing"===this.state.animationState&&this.resume()))},t.prototype.resume=function(){return Tc(this,void 0,void 0,function(){var e;return Pc(this,function(t){switch(t.label){case 0:return this._current.lastTime=0,this._current.startedTime=-1,e=this._current.anim,this.context.behaviors.state.isAnimating.value||this.context.behaviors.state.isAnimating.next(!0),e.setup?[4,e.setup(this._current.paramValues,this._current.state,this.context)]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.isStopped=!1,[2]}})})},t}(M2);function Iae(e,t,r){var n=r[0],i=r[1],a=r[2],o=-n*t[0]-i*t[1]-a*t[2];return(n*e[0]+i*e[1]+a*e[2]+o)/Math.sqrt(n*n+i*i+a*a)}var Dae={identity:Rg.create(1,0,0,0,1,0,0,0,1),rotX90:Rg.create(1,0,0,0,0,1,0,-1,0),rotY90:Rg.create(0,0,-1,0,1,0,1,0,0),rotZ90:Rg.create(0,1,0,-1,0,0,0,0,1),rotX270:Rg.create(1,0,0,0,0,-1,0,1,0),rotY270:Rg.create(0,0,1,0,1,0,-1,0,0),rotZ270:Rg.create(0,-1,0,1,0,0,0,0,1),rotX180:Rg.create(1,0,0,0,-1,0,0,0,-1),rotY180:Rg.create(-1,0,0,0,1,0,0,0,-1),rotZ180:Rg.create(-1,0,0,0,-1,0,0,0,1)};function Oae(e,t){for(var r=t.onlyTrace,n=t.skipHydrogens,i=t.skipWater,a=Cj.atom,o=a.x,s=a.y,u=a.z,c=a.type_symbol,l=a.label_comp_id,d=[],f=0,h=e;f<h.length;f++)for(var p=h[f],m=qF.create(p),g=0,v=p.units;g<v.length;g++){var y=v[g];m.unit=y;for(var b=r?y.polymerElements:y.elements,_=0;_<b.length;_++)m.element=b[_],n&&"H"===c(m)||i&&"HOH"===l(m)||d.push(o(m),s(m),u(m))}return d}function Rae(e,t){var r=Math.floor(t/2);return e<r?t%2?r-e:r-e-1:e-r}function Bae(e,t){var r=Rg.invert(Rg(),t),n=Cg.distance(e.position,e.target),i=Cg.transformMat3(Cg(),Cg.create(0,0,n),r),a=Cg.transformMat3(Cg(),Cg.create(0,1,0),r),o=Cg.add(Cg(),e.target,i);return Ac(Ac({},e),{position:o,up:a})}var Nae={minRadius:5,extraRadius:4,durationMs:250},Fae=function(){function e(e){this.plugin=e,this.boundaryHelper=new PM("98")}return e.prototype.transformedLoci=function(e){if(Az.is(e)){var t=this.plugin.helpers.substructureParent.get(e.structure)?.obj?.data;t&&(e=Az.remap(e,t))}return e},e.prototype.focusRenderObjects=function(e,t){if(e){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n].values.boundingSphere.ref.value;0!==a.radius&&r.push(a)}this.focusSpheres(r,function(e){return e},t)}},e.prototype.focusLoci=function(e,t){var r;if(Array.isArray(e)&&e.length>1){for(var n=[],i=0,a=e;i<a.length;i++){var o=a[i];(c=TQ.getBoundingSphere(this.transformedLoci(o)))&&n.push(c)}if(0===n.length)return;this.boundaryHelper.reset();for(var s=0,u=n;s<u.length;s++){var c=u[s];this.boundaryHelper.includeSphere(c)}this.boundaryHelper.finishedIncludeStep();for(var l=0,d=n;l<d.length;
139l++)c=d[l],this.boundaryHelper.radiusSphere(c);r=this.boundaryHelper.getSphere()}else if(Array.isArray(e)){if(0===e.length)return;r=TQ.getBoundingSphere(this.transformedLoci(e[0]))}else r=TQ.getBoundingSphere(this.transformedLoci(e));r&&this.focusSphere(r,t)},e.prototype.focusSpheres=function(e,t,r){for(var n=[],i=0,a=e;i<a.length;i++)(u=t(a[i]))&&n.push(u);if(0!==n.length){if(1===n.length)return this.focusSphere(n[0],r);this.boundaryHelper.reset();for(var o=0,s=n;o<s.length;o++){var u=s[o];this.boundaryHelper.includeSphere(u)}this.boundaryHelper.finishedIncludeStep();for(var c=0,l=n;c<l.length;c++)u=l[c],this.boundaryHelper.radiusSphere(u);this.focusSphere(this.boundaryHelper.getSphere(),r)}},e.prototype.focusSphere=function(e,t){var r,n=this.plugin.canvas3d;if(n){var i=Ac(Ac({},Nae),t),a=i.extraRadius,o=i.minRadius,s=i.durationMs,u=Math.max(e.radius+a,o);if(t?.principalAxes){var c=function(e,t,r){if(e.canvas3d){var n=r.principalAxes.boxAxes,i=n.origin,a=n.dirA,o=n.dirB,s=n.dirC,u=Cg.clone(a),c=Cg.clone(s);if(r.positionToFlip){var l=function(e,t,r,n){var i=Iae(e,t,n);return{aroundX:Iae(e,t,r)<0,aroundY:i<0}}(r.positionToFlip,i,u,o),d=l.aroundX,f=l.aroundY;d&&(Cg.negate(c,c),Cg.negate(u,u)),f&&Cg.negate(c,c)}var h=Cg.scale(Cg(),i,-100);return Cg.dot(h,u)<=0&&Cg.negate(c,c),Cg.dot(Cg.unitY,c)<=0&&Cg.negate(u,u),e.canvas3d.camera.getFocus(i,t,u,c,Q3.createDefaultSnapshot())}}(this.plugin,u,t);null==(r=this.plugin.canvas3d)||r.requestCameraReset({durationMs:s,snapshot:c})}else c=n.camera.getFocus(e.center,u),n.requestCameraReset({durationMs:s,snapshot:c})}},e.prototype.orientAxes=function(e,t){if(this.plugin.canvas3d){e||=this.plugin.state.data.selectQ(function(e){return e.ofType(DS.Molecule.Structure)}).filter(function(e){return e.obj&&!e.transform.transformer.definition.isDecorator&&!e.obj.data.parent}).map(function(e){return e.obj?.data}).filter(function(e){return!!e});var r=function(e){return function(e){if(0===e.length)return console.warn("Skipping PCA, no atoms"),{rotation:Dae.identity,origin:Cg.zero()};var t=zE.calculateMomentsAxes(e),r=zE.calculateNormalizedAxes(t),n=function(e,t,r){var n=Rg();return Rg.setValue(n,0,0,e[0]),Rg.setValue(n,0,1,e[1]),Rg.setValue(n,0,2,e[2]),Rg.setValue(n,1,0,t[0]),Rg.setValue(n,1,1,t[1]),Rg.setValue(n,1,2,t[2]),Rg.setValue(n,2,0,r[0]),Rg.setValue(n,2,1,r[1]),Rg.setValue(n,2,2,r[2]),n}(r.dirA,r.dirB,r.dirC);i=n,Rg.determinant(i)<0&&(Rg.setValue(i,2,0,-Rg.getValue(i,2,0)),Rg.setValue(i,2,1,-Rg.getValue(i,2,1)),Rg.setValue(i,2,2,-Rg.getValue(i,2,2)));var i,a=function(e,t,r){for(var n=Cg.create(Rg.getValue(t,0,0),Rg.getValue(t,0,1),Rg.getValue(t,0,2)),i=Cg.create(Rg.getValue(t,1,0),Rg.getValue(t,1,1),Rg.getValue(t,1,2)),a=Cg.create(Rg.getValue(t,2,0),Rg.getValue(t,2,1),Rg.getValue(t,2,2)),o=Math.floor(e.length/3),s=Cg(),u=0,c=0,l=0,d=0;d<o;d++)Cg.fromArray(s,e,3*d),Cg.sub(s,s,r),u+=d*Cg.dot(s,n),c+=d*Cg.dot(s,i),l+=Rae(d,o)*Cg.dot(s,a);var f=l<0,h=f?u+c<0:u-c<0;return h&&f?Dae.rotY180:f?Dae.rotX180:h?Dae.rotZ180:Dae.identity}(e,n,t.origin);return Rg.mul(n,a,n),{rotation:n,origin:r.origin}}(function(e){var t;return(t=Oae(e,{onlyTrace:!0})).length>=9||(t=Oae(e,{skipHydrogens:!0,skipWater:!0})).length>=9||(t=Oae(e,{})),t}(e))}(e).rotation,n=Bae(this.plugin.canvas3d.camera.getSnapshot(),r);this.setSnapshot(n,t)}},e.prototype.resetAxes=function(e){if(this.plugin.canvas3d){var t=Bae(this.plugin.canvas3d.camera.getSnapshot(),Rg.Identity);this.setSnapshot(t,e)}},e.prototype.setSnapshot=function(e,t){var r;null==(r=this.plugin.canvas3d)||r.requestCameraReset({snapshot:e,durationMs:t})},e.prototype.reset=function(e,t){var r;null==(r=this.plugin.canvas3d)||r.requestCameraReset({snapshot:e,durationMs:t})},e}(),Lae=function(e){function t(r,n){void 0===n&&(n={});var i=e.call(this,{props:Ac(Ac({},Ib.getDefaultValues(t.Params)),n)})||this;return i.plugin=r,i._props=Ib.getDefaultValues(t.Params),i.events={propsUpdated:i.ev()},i.lociSelects=new t.LociSelectManager(r,i._props),i.lociHighlights=new t.LociHighlightManager(r,i._props),i}return wc(t,e),Object.defineProperty(t.prototype,"props",{get:function(){return Ac({},this.state.props)}
139,enumerable:!1,configurable:!0}),t.prototype.setProps=function(e){var t=this.props,r=Ac(Ac({},this.state.props),e);Gg(t,r)||(this.updateState({props:r}),this.lociSelects.setProps(r),this.lociHighlights.setProps(r),this.events.propsUpdated.next(void 0))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.lociSelects.dispose(),this.lociHighlights.dispose()},t}(M2);!function(e){e.Params={granularity:Ib.Select("residue",TQ.GranularityOptions,{label:"Picking Level",description:"Controls if selections are expanded upon picking to whole residues, chains, structures, instances, or left as atoms and coarse elements"})};var t=function(){function t(t,r){void 0===r&&(r={}),this.ctx=t,this.providers=[],this.props=Ib.getDefaultValues(e.Params),this.sel=t.managers.structure.selection,this.setProps(r)}return t.prototype.setProps=function(e){Object.assign(this.props,e)},t.prototype.addProvider=function(e){this.providers.push(e)},t.prototype.removeProvider=function(e){this.providers=this.providers.filter(function(t){return t!==e})},t.prototype.normalizedLoci=function(e,t,r){void 0===r&&(r=!1);var n=e.loci,i=e.repr,a=t?this.props.granularity:void 0;return{loci:TQ.normalize(n,a,r),repr:i}},t.prototype.mark=function(e,t,r){if(void 0===r&&(r=!1),!TQ.isEmpty(e.loci))for(var n=0,i=this.providers;n<i.length;n++)(0,i[n])(e,t,r)},t.prototype.dispose=function(){this.providers.length=0,this.sel.dispose()},t}();e.LociMarkManager=t,e.LociHighlightManager=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.prev=[],t.clearHighlights=function(e){void 0===e&&(e=!1);for(var r=0,n=t.prev;r<n.length;r++){var i=n[r];t.mark(i,bQ.RemoveHighlight,e)}t.prev.length=0},t}return wc(t,e),t.prototype.isHighlighted=function(e){for(var t=0,r=this.prev;t<r.length;t++){var n=r[t];if(dJ.Loci.areEqual(n,e))return!0}return!1},t.prototype.addHighlight=function(e){this.mark(e,bQ.Highlight),this.prev.push(e)},t.prototype.highlight=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);this.isHighlighted(r)||this.addHighlight(r)},t.prototype.highlightOnly=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);this.isHighlighted(r)||(TQ.isEmpty(r.loci)?this.clearHighlights():(this.clearHighlights(!0),this.addHighlight(r)))},t.prototype.highlightOnlyExtend=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);if(Az.is(r.loci)){var n={loci:this.sel.tryGetRange(r.loci)||r.loci,repr:r.repr};this.isHighlighted(n)||(TQ.isEmpty(n.loci)?this.clearHighlights():(this.clearHighlights(!0),this.addHighlight(n)))}},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.prev.length=0},t}(t),e.LociSelectManager=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wc(t,e),t.prototype.toggle=function(t,r){if(void 0===r&&(r=!0),!TQ.isEmpty(t.loci)){var n=this.normalizedLoci(t,r,!0);Az.is(n.loci)?this.toggleSel(n):e.prototype.mark.call(this,n,bQ.Toggle)}},t.prototype.toggleExtend=function(e,t){if(void 0===t&&(t=!0),!TQ.isEmpty(e.loci)){var r=this.normalizedLoci(e,t,!0);if(Az.is(r.loci)){var n=this.sel.tryGetRange(r.loci)||r.loci;this.toggleSel({loci:n,repr:r.repr})}}},t.prototype.select=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t,!0);Az.is(r.loci)&&this.sel.modify("add",r.loci),this.mark(r,bQ.Select)},t.prototype.selectJoin=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t,!0);Az.is(r.loci)&&this.sel.modify("intersect",r.loci),this.mark(r,bQ.Select)},t.prototype.selectOnly=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t,!0);Az.is(r.loci)&&(this.mark({loci:yz.Loci(r.loci.structure),repr:r.repr},bQ.Deselect),this.sel.modify("set",r.loci)),this.mark(r,bQ.Select)},t.prototype.deselect=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t,!0);Az.is(r.loci)&&this.sel.modify("remove",r.loci),this.mark(r,bQ.Deselect)},t.prototype.deselectAll=function(){this.sel.clear(),this.mark({loci:AQ},bQ.Deselect)},t.prototype.deselectAllOnEmpty=function(e){MQ(e.loci)&&this.deselectAll()},t.prototype.mark=function(t,r){var n=t.loci;if(!TQ.isEmpty(n))if(Az.is(n)){var i=this.sel.getLoci(n.structure);e.prototype.mark.call(this,{loci:yz.Loci(n.structure)},bQ.Deselect,!TQ.isEmpty(i)),e.prototype.mark.call(this,{loci:i},bQ.Select)}
139else e.prototype.mark.call(this,t,r)},t.prototype.toggleSel=function(e){this.sel.has(e.loci)?(this.sel.modify("remove",e.loci),this.mark(e,bQ.Deselect)):(this.sel.modify("add",e.loci),this.mark(e,bQ.Select))},t}(t)}(Lae||={});var $ae=function(){function e(e){var t=this;this.ctx=e,this.providers=[],this.locis=[],this.isDirty=!1,this.labels=[],this.groupedLabels=new Map,e.managers.interactivity.lociHighlights.addProvider(function(e,r,n){0!==t.providers.length&&(t.mark(e,r),n||t.showLabels())})}return e.prototype.clearProviders=function(){this.providers=[],this.isDirty=!0,this.showLabels()},e.prototype.addProvider=function(e){this.providers.push(e),this.providers.sort(function(e,t){return(t.priority||0)-(e.priority||0)}),this.isDirty=!0,this.showLabels()},e.prototype.removeProvider=function(e){this.providers=this.providers.filter(function(t){return t!==e}),this.isDirty=!0,this.showLabels()},e.prototype.mark=function(e,t){var r=this.locis.findIndex(function(t){return dJ.Loci.areEqual(e,t)});-1===r&&t===bQ.Highlight?(this.locis.push(e),this.isDirty=!0):-1!==r&&t===bQ.RemoveHighlight&&(Vb(this.locis,r),this.isDirty=!0)},e.prototype.showLabels=function(){this.ctx.behaviors.labels.highlight.next({labels:this.getLabels()})},e.prototype.getLabels=function(){var e=this;if(this.isDirty){this.groupedLabels.clear(),this.labels.length=0;for(var t=0,r=this.providers;t<r.length;t++)for(var n=r[t],i=0,a=this.locis;i<a.length;i++){var o=a[i];if(!TQ.isEmpty(o.loci)){var s=n.label(o.loci,o.repr);if(s){var u=n.group?n.group(s):s.toString(),c=this.groupedLabels.get(u);c?c.push(s):this.groupedLabels.set(u,[s])}}}
139this.labels.length=0,this.groupedLabels.forEach(function(t,r){var n=t.length,i=n>1&&t[0]!==t[1]?r:t[0];e.labels.push(1===n?i:`${i} <small>|| × ${n}</small>`)}),this.isDirty=!1}return this.labels},e}(),Uae="overpaint-controls";function jae(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a=this;return Pc(this,function(o){switch(o.label){case 0:return[4,zae(e,t,function(e,t,o){return Tc(a,void 0,void 0,function(){var a,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return i&&i.length>0&&!i.includes(t.params.values.type.name)?[2]:(a=t.obj.data.sourceData,[4,n(a.root)]);case 1:return s=d.sent(),TQ.isEmpty(s)||MQ(s)||(u={bundle:sU.fromLoci(s),color:-1===r?tv(0):r,clear:-1===r},o?(c=kc(kc([],o.params.values.layers,!0),[u],!1),l=Gae(c,a),e.to(o).update(DQ.toBundle(l))):(l=Gae([u],a),e.to(t.transform.ref).apply(m2.Representation.OverpaintStructureRepresentation3DFromBundle,DQ.toBundle(l),{tags:Uae}))),[2]}})})})];case 1:return o.sent(),[2]}})})}function zae(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:n=e.state.data,i=n.build(),a=0,o=t,f.label=1;case 1:if(!(a<o.length))return[3,6];s=o[a],u=0,c=s.representations,f.label=2;case 2:return u<c.length?(l=c[u],d=n.select(Zb.Generators.ofTransformer(m2.Representation.OverpaintStructureRepresentation3DFromBundle,l.cell.transform.ref).withTag(Uae)),[4,r(i,l.cell,d[0])]):[3,5];case 3:f.sent(),f.label=4;case 4:return u++,[3,2];case 5:return a++,[3,1];case 6:return[2,i.commit({doNotUpdateCurrent:!0})]}})})}function Gae(e,t){var r=DQ.ofBundle(e,t.root),n=DQ.merge(r);return DQ.filter(n,t)}var Vae="clipping-controls";function Hae(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a=this;return Pc(this,function(o){switch(o.label){case 0:return[4,qae(e,t,function(e,t,o){return Tc(a,void 0,void 0,function(){var a,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return i&&i.length>0&&!i.includes(t.params.values.type.name)?[2]:(a=t.obj.data.sourceData,[4,n(a.root)]);case 1:return s=d.sent(),TQ.isEmpty(s)||MQ(s)||(u={bundle:sU.fromLoci(s),groups:r},o?(c=kc(kc([],o.params.values.layers,!0),[u],!1),l=Wae(c,a),e.to(o).update(sJ.toBundle(l))):(l=Wae([u],a),e.to(t.transform.ref).apply(m2.Representation.ClippingStructureRepresentation3DFromBundle,sJ.toBundle(l),{tags:Vae}))),[2]}})})})];case 1:return o.sent(),[2]}})})}function qae(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:n=e.state.data,i=n.build(),a=0,o=t,f.label=1;case 1:if(!(a<o.length))return[3,6];s=o[a],u=0,c=s.representations,f.label=2;case 2:return u<c.length?(l=c[u],d=n.select(Zb.Generators.ofTransformer(m2.Representation.ClippingStructureRepresentation3DFromBundle,l.cell.transform.ref).withTag(Vae)),[4,r(i,l.cell,d[0])]):[3,5];case 3:f.sent(),f.label=4;case 4:return u++,[3,2];case 5:return a++,[3,1];case 6:return[2,i.commit({doNotUpdateCurrent:!0})]}})})}function Wae(e,t){var r=sJ.ofBundle(e,t.root),n=sJ.merge(r);return sJ.filter(n,t)}var Xae="transparency-controls";function Yae(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a=this;return Pc(this,function(o){switch(o.label){case 0:return[4,Kae(e,t,function(e,t,o){return Tc(a,void 0,void 0,function(){var a,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return i&&i.length>0&&!i.includes(t.params.values.type.name)?[2]:(a=t.obj.data.sourceData,[4,n(a.root)]);case 1:return s=d.sent(),TQ.isEmpty(s)||MQ(s)||(u={bundle:sU.fromLoci(s),value:r},o?(c=kc(kc([],o.params.values.layers,!0),[u],!1),l=Zae(c,a),e.to(o).update(OQ.toBundle(l))):(l=Zae([u],a),e.to(t.transform.ref).apply(m2.Representation.TransparencyStructureRepresentation3DFromBundle,OQ.toBundle(l),{tags:Xae}))),[2]}})})})];case 1:return o.sent(),[2]}})})}function Kae(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:n=e.state.data,i=n.build(),a=0,o=t,f.label=1;case 1:if(!(a<o.length))return[3,6];s=o[a],u=0,c=s.representations,f.label=2;case 2:return u<c.length?(l=c[u],d=n.select(Zb.Generators.ofTransformer(m2.Representation.TransparencyStructureRepresentation3DFromBundle,l.cell.transform.ref).withTag(Xae)),[4,r(i,l.cell,d[0])]):[3,5];case 3:f.sent(),f.label=4;case 4:return u++,[3,2];case 5:return a++,[3,1];
139case 6:return[2,i.commit({doNotUpdateCurrent:!0})]}})})}function Zae(e,t){var r=OQ.ofBundle(e,t.root),n=OQ.merge(r);return OQ.filter(n,t)}var Qae="substance-controls";function Jae(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a=this;return Pc(this,function(o){switch(o.label){case 0:return[4,eoe(e,t,function(e,t,o){return Tc(a,void 0,void 0,function(){var a,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return i&&i.length>0&&!i.includes(t.params.values.type.name)?[2]:(a=t.obj.data.sourceData,[4,n(a.root)]);case 1:return s=d.sent(),TQ.isEmpty(s)||MQ(s)||(u={bundle:sU.fromLoci(s),material:r??VI(),clear:!r},o?(c=kc(kc([],o.params.values.layers,!0),[u],!1),l=toe(c,a),e.to(o).update(uJ.toBundle(l))):(l=toe([u],a),e.to(t.transform.ref).apply(m2.Representation.SubstanceStructureRepresentation3DFromBundle,uJ.toBundle(l),{tags:Qae}))),[2]}})})})];case 1:return o.sent(),[2]}})})}function eoe(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:n=e.state.data,i=n.build(),a=0,o=t,f.label=1;case 1:if(!(a<o.length))return[3,6];s=o[a],u=0,c=s.representations,f.label=2;case 2:return u<c.length?(l=c[u],d=n.select(Zb.Generators.ofTransformer(m2.Representation.SubstanceStructureRepresentation3DFromBundle,l.cell.transform.ref).withTag(Qae)),[4,r(i,l.cell,d[0])]):[3,5];case 3:f.sent(),f.label=4;case 4:return u++,[3,2];case 5:return a++,[3,1];case 6:return[2,i.commit({doNotUpdateCurrent:!0})]}})})}function toe(e,t){var r=uJ.ofBundle(e,t.root),n=uJ.merge(r);return uJ.filter(n,t)}var roe=function(e){function t(r){var n=e.call(this,{options:Ib.getDefaultValues(t.OptionsParams)})||this;return n.plugin=r,n.events={optionsUpdated:n.ev()},n}return wc(t,e),Object.defineProperty(t.prototype,"currentStructures",{get:function(){return this.plugin.managers.structure.hierarchy.selection.structures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivotStructure",{get:function(){return this.currentStructures[0]},enumerable:!1,configurable:!0}),t.prototype._setSnapshotState=function(e){this.updateState({options:e}),this.events.optionsUpdated.next(void 0)},t.prototype.setOptions=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c=this;return Pc(this,function(l){for(t=e.interactions!==this.state.options.interactions,this.updateState({options:e}),this.events.optionsUpdated.next(void 0),r=this.dataState.build(),n=0,i=this.currentStructures;n<i.length;n++)for(a=i[n],o=0,s=a.components;o<s.length;o++)u=s[o],this.updateReprParams(r,u);return[2,this.plugin.dataTransaction(function(){return Tc(c,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return[4,r.commit()];case 1:return n.sent(),[4,this.plugin.state.updateBehavior(ore,function(t){t.ignoreHydrogens="all"!==e.hydrogens,t.ignoreHydrogensVariant="only-polar"===e.hydrogens?"non-polar":"all",t.ignoreLight=e.ignoreLight,t.material=e.materialStyle,t.clip=e.clipObjects})];case 2:return n.sent(),t?[4,this.updateInterationProps()]:[3,4];case 3:n.sent(),n.label=4;case 4:return[2]}})})})]})})},t.prototype.updateReprParams=function(e,t){for(var r=this.state.options,n=r.hydrogens,i=r.visualQuality,a=r.ignoreLight,o=r.materialStyle,s=r.clipObjects,u="all"!==n,c="only-polar"===n?"non-polar":"all",l=0,d=t.representations;l<d.length;l++){var f=d[l];if(f.cell.transform.transformer===q1){var h=f.cell.transform.params;!!h.type.params.ignoreHydrogens===u&&h.type.params.ignoreHydrogensVariant===c&&h.type.params.quality===i&&h.type.params.ignoreLight===a&&lf(h.type.params.material,o)&&Ib.areEqual(HI.Params,h.type.params.clip,s)||e.to(f.cell).update(function(e){e.type.params.ignoreHydrogens=u,e.type.params.ignoreHydrogensVariant=c,e.type.params.quality=i,e.type.params.ignoreLight=a,e.type.params.material=o,e.type.params.clip=s})}}},t.prototype.updateInterationProps=function(){return Tc(this,void 0,void 0,function(){var e,t,r,n,i,a,o,s=this;return Pc(this,function(u){switch(u.label){case 0:e=0,t=this.currentStructures,u.label=1;case 1:return e<t.length?(r=t[e],n=x9.getParams(r.cell.obj?.data),r.properties?(i=r.properties.cell.transform.params?.properties[x9.descriptor.name],Ib.areEqual(n,i,this.state.options.interactions)?[3,5]:[4,this.dataState.build().to(r.properties.cell).update(function(e){e.properties[x9.descriptor.name]=s.state.options.interactions}).commit()]):[3,3]):[3,6];case 2:return u.sent(),[3,5];case 3:return a=this.plugin.customStructureProperties.getParams(r.cell.obj?.data),o=Ib.getDefaultValues(a),Ib.areEqual(n,o.properties[x9.descriptor.name],this.state.options.interactions)?[3,5]:(o.properties[x9.descriptor.name]=this.state.options.interactions,[4,this.plugin.builders.structure.insertStructureProperties(r.cell,o)]);case 4:u.sent(),u.label=5;case 5:return e++,[3,1];case 6:return[2]}})})},t.prototype.applyPreset=function(e,t,r){var n=this;return this.plugin.dataTransaction(function(){return Tc(n,void 0,void 0,function(){var n,i,a,o;return Pc(this,function(s){switch(s.label){case 0:n=0,i=e,s.label=1;case 1:return n<i.length?(a=i[n],[4,this.plugin.builders.structure.representation.applyPreset(a.cell,t,r)]):[3,5];case 2:return o=s.sent(),[4,this.syncPreset(a,o)];case 3:s.sent(),s.label=4;case 4:return n++,[3,1];case 5:return[2]}})})},{canUndo:"Preset"})},t.prototype.syncPreset=function(e,t){if(!t||!t.components)return this.clearComponents([e]);var r=new Set;if(Hg(t.components,function(e){e&&r.add(e.ref)}),t.representations&&Hg(t.representations,function(e){e&&r.add(e.ref)}),0===r.size)return this.clearComponents([e]);for(var n=!1,i=this.dataState.build(),a=function(e){r.has(e.cell.transform.ref)||(n=!0,i.delete(e.cell))},o=0,s=e.components;o<s.length;o++){var u=s[o];a(u);for(var c=0,l=u.representations;c<l.length;c++)a(l[c]);if(u.genericRepresentations)for(var d=0,f=u.genericRepresentations;d<f.length;d++)a(f[d])}if(e.genericRepresentations)for(var h=0,p=e.genericRepresentations;h<p.length;h++)a(p[h]);return n?i.commit():void 0},t.prototype.clear=function(e){return this.clearComponents(e)},t.prototype.selectThis=function(e){var t=this.plugin.managers.structure.selection;t.clear();for(var r=0,n=e;r<n.length;r++){var i=n[r],a=yz.toSubStructureElementLoci(i.structure.cell.obj.data,i.cell.obj?.data);t.fromLoci("set",a)}},t.prototype.canBeModified=function(e){return this.plugin.builders.structure.isComponentTransform(e.cell)},t.prototype.modifyByCurrentSelection=function(e,t){var r=this;return this.plugin.runTask(vy.create("Modify Component",function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:for(r=this.dataState.build(),i=0,a=e;i<a.length;i++)o=a[i],this.canBeModified(o)&&(s=this.plugin.managers.structure.selection.getStructure(o.structure.cell.obj.data))&&0!==s.elementCount&&this.modifyComponent(r,o,s,t);return[4,this.dataState.updateTree(r,{canUndo:"Modify Selection"}).runInContext(n)];case 1:return u.sent(),[2]}})})}))},t.prototype.toggleVisibility=function(e,t){if(0!==e.length)if(t)for(var r=e[0].representations.indexOf(t),n=(o=!t.cell.state.isHidden,0),i=e;n<i.length;n++){var a=(c=i[n]).representations[r];a&&K2(this.dataState,a.cell.transform.ref,o)}else for(var o=!e[0].cell.state.isHidden,s=0,u=e;s<u.length;s++){var c=u[s];K2(this.dataState,c.cell.transform.ref,o)}},t.prototype.removeRepresentations=function(e,t){if(0!==e.length){var r=[];if(t){var n=e[0].representations.indexOf(t);if(n<0)return;for(var i=0,a=e;i<a.length;i++)(u=a[i]).representations[n]&&r.push(u.representations[n])}else for(var o=0,s=e;o<s.length;o++)for(var u,c=0,l=(u=s[o]).representations;c<l.length;c++){var d=l[c];r.push(d)}return this.plugin.managers.structure.hierarchy.remove(r,!0)}},t.prototype.updateRepresentations=function(e,t,r){if(0===e.length)return Promise.resolve();var n=e[0].representations.indexOf(t);if(n<0)return Promise.resolve();for(var i=this.dataState.build(),a=0,o=e;a<o.length;a++){var s=o[a].representations[n];s&&s.cell.transform.transformer===t.cell.transform.transformer&&i.to(s.cell).update(r)}return i.commit({canUndo:"Update Representation"})},t.prototype.updateRepresentationsTheme=function(e,t){if(0!==e.length){for(var r=this.dataState.build(),n=0,i=e;n<i.length;n++)for(var a=i[n],o=function(e){var n=e.cell.transform.params,i="function"==typeof t?t(a,e):t,o="default"===i.color?Jte(s.plugin,a.structure.cell.obj?.data,n?.type.n
139ame):i.color?Jte(s.plugin,a.structure.cell.obj?.data,n?.type.name,i.color,i.colorParams):void 0,u="default"===i.size?ere(s.plugin,a.structure.cell.obj?.data,n?.type.name):i.color?ere(s.plugin,a.structure.cell.obj?.data,n?.type.name,i.size,i.sizeParams):void 0;(o||u)&&r.to(e.cell).update(function(e){o&&(e.colorTheme=o),u&&(e.sizeTheme=u)})},s=this,u=0,c=a.representations;u<c.length;u++)o(c[u]);return r.commit({canUndo:"Update Theme"})}},t.prototype.addRepresentation=function(e,t){var r=this;if(0!==e.length){var n=this.state.options,i=n.hydrogens,a={ignoreHydrogens:"all"!==i,ignoreHydrogensVariant:"only-polar"===i?"non-polar":"all",quality:n.visualQuality,ignoreLight:n.ignoreLight,material:n.materialStyle,clip:n.clipObjects};return this.plugin.dataTransaction(function(){return Tc(r,void 0,void 0,function(){var r,n,i;return Pc(this,function(o){switch(o.label){case 0:r=0,n=e,o.label=1;case 1:return r<n.length?(i=n[r],[4,this.plugin.builders.structure.representation.addRepresentation(i.cell,{type:this.plugin.representation.structure.registry.get(t),typeParams:a})]):[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},{canUndo:"Add Representation"})}},t.prototype.tryFindComponent=function(e,t){var r=this;if(0!==e.components.length)return this.plugin.runTask(vy.create("Find Component",function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:return(r=e.cell.obj?.data)?(o=(a=oU).unionStructure,[4,t.getSelection(this.plugin,n,r)]):[2];case 1:for(i=o.apply(a,[d.sent()]),s=0,u=e.components;s<u.length;s++)if(c=u[s],(l=c.cell.obj?.data)&&c.cell.parent&&dU(i,l))return[2,c.cell];return[2]}})})}))},t.prototype.add=function(e,t){return Tc(this,void 0,void 0,function(){var r=this;return Pc(this,function(n){return[2,this.plugin.dataTransaction(function(){return Tc(r,void 0,void 0,function(){var r,n,i,a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:if(0===(r=t||this.currentStructures).length)return[2];n=this.state.options,i=n.hydrogens,a=n.visualQuality,o=n.ignoreLight,s=n.materialStyle,u=n.clipObjects,c={ignoreHydrogens:"all"!==i,ignoreHydrogensVariant:"only-polar"===i?"non-polar":"all",quality:a,ignoreLight:o,material:s,clip:u},l=Wd.create22(),d=0,f=r,m.label=1;case 1:return d<f.length?(h=f[d],p=void 0,e.options.checkExisting?[4,this.tryFindComponent(h,e.selection)]:[3,3]):[3,8];case 2:p=m.sent(),m.label=3;case 3:return p?[3,5]:[4,this.plugin.builders.structure.tryCreateComponentFromSelection(h.cell,e.selection,l,{label:e.options.label||(e.selection===bW.current?"Custom Selection":"")})];case 4:p=m.sent(),m.label=5;case 5:return"none"!==e.representation&&p?[4,this.plugin.builders.structure.representation.addRepresentation(p,{type:this.plugin.representation.structure.registry.get(e.representation),typeParams:c})]:[3,7];case 6:m.sent(),m.label=7;case 7:return d++,[3,1];case 8:return[2]}})})},{canUndo:"Add Selection"})]})})},t.prototype.applyTheme=function(e,t){return Tc(this,void 0,void 0,function(){var r=this;return Pc(this,function(n){return[2,this.plugin.dataTransaction(function(n){return Tc(r,void 0,void 0,function(){var r,i,a,o,s,u,c=this;return Pc(this,function(l){switch(l.label){case 0:if(0===(r=t||this.currentStructures).length)return[2];i=function(t){return Tc(c,void 0,void 0,function(){var r,i;return Pc(this,function(a){switch(a.label){case 0:return i=(r=oU).toLociWithSourceUnits,[4,e.selection.getSelection(this.plugin,n,t)];case 1:return[2,i.apply(r,[a.sent()])]}})})},a=0,o=r,l.label=1;case 1:return a<o.length?(s=o[a],"color"===e.action.name?(u=e.action.params,[4,jae(this.plugin,s.components,u.color,i,e.representations)]):[3,3]):[3,14];case 2:return l.sent(),[3,13];case 3:return"resetColor"===e.action.name?[4,jae(this.plugin,s.components,-1,i,e.representations)]:[3,5];case 4:return l.sent(),[3,13];case 5:return"transparency"===e.action.name?(u=e.action.params,[4,Yae(this.plugin,s.components,u.value,i,e.representations)]):[3,7];case 6:return l.sent(),[3,13];case 7:return"material"===e.action.name?(u=e.action.params,[4,Jae(this.plugin,s.components,u.material,i,e.representations)]):[3,9];case 8:return l.sent(),[3,13];case 9:return"resetMaterial"===e.action.name?[4,Jae(this.plugin,s.components,void 0,i,e.representations)]:[3,11];case 10:return l.sent(),[3,13];case 11:return"clipping"===e.action.name?(u=e.action.params,[4,Hae(this.plugin,s.components,sJ.Groups.fromN
139ames(u.excludeGroups),i,e.representations)]):[3,13];case 12:l.sent(),l.label=13;case 13:return a++,[3,1];case 14:return[2]}})})},{canUndo:"Apply Theme"})]})})},t.prototype.modifyComponent=function(e,t,r,n){var i=t.cell.obj?.data;if(i&&("subtract"!==n&&"intersect"!==n||fU(i,r))){var a=t.structure.cell.obj?.data,o="union"===n?cU(a,[i,r]):"intersect"===n?hU(i,r):pU(i,r);if(0===o.elementCount)e.delete(t.cell.transform.ref);else{var s={type:{name:"bundle",params:sU.fromSubStructure(a,o)},nullIfEmpty:!0,label:t.cell.obj?.label};e.to(t.cell).update(s)}}},t.prototype.updateLabel=function(e,t){var r={type:e.cell.params?.values.type,nullIfEmpty:e.cell.params?.values.nullIfEmpty,label:t};this.dataState.build().to(e.cell).update(r).commit()},Object.defineProperty(t.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),t.prototype.clearComponents=function(e){for(var t=this.dataState.build(),r=0,n=e;r<n.length;r++)for(var i=0,a=n[r].components;i<a.length;i++){var o=a[i];t.delete(o.cell.transform.ref)}return t.commit({canUndo:"Clear Selections"})},t}(M2);!function(e){function t(e,t){return t?.cell.obj?.data?e.representation.structure.registry.getApplicableTypes(t.cell.obj?.data):e.representation.structure.registry.types}function r(e,r,n,i){var a=kc(kc([],n,!0),t(e,r),!0);return Ib.Select(a[0][0],a,{label:i})}e.OptionsParams={hydrogens:Ib.Select("all",[["all","Show All"],["hide-all","Hide All"],["only-polar","Only Polar"]],{description:"Determine display of hydrogen atoms in representations"}),visualQuality:Ib.Select("auto",XI,{description:"Control the visual/rendering quality of representations"}),ignoreLight:Ib.Boolean(!1,{description:"Ignore light for stylized rendering of representations"}),materialStyle:VI.getParam(),clipObjects:Ib.Group(HI.Params),interactions:Ib.Group(x9.defaultParams,{label:"Non-covalent Interactions"})},e.getAddParams=function(e,t){var n=e.query.structure.registry.options;return t=Ac({pivot:e.managers.structure.component.pivotStructure,allowNone:!0,hideSelection:!1,checkExisting:!1},t),{selection:Ib.Select(n[1][0],n,{isHidden:t?.hideSelection}),representation:r(e,t?.pivot,t?.allowNone?[["none","< Create Later >"]]:[]),options:Ib.Group({label:Ib.Text(""),checkExisting:Ib.Boolean(!!t?.checkExisting,{help:function(){return{description:"Checks if a selection with the specifield elements already exists to avoid creating duplicate components."}}})})}},e.getThemeParams=function(e,r){var n=e.query.structure.registry.options;return{selection:Ib.Select(n[1][0],n,{isHidden:!1}),action:Ib.MappedStatic("color",{color:Ib.Group({color:Ib.Color(MC.blue,{isExpanded:!0})},{isFlat:!0}),resetColor:Ib.EmptyGroup({label:"Reset Color"}),transparency:Ib.Group({value:Ib.Numeric(.5,{min:0,max:1,step:.01})},{isFlat:!0}),material:Ib.Group({material:VI.getParam({isFlat:!0})},{isFlat:!0}),resetMaterial:Ib.EmptyGroup({label:"Reset Material"}),clipping:Ib.Group({excludeGroups:Ib.MultiSelect([],Ib.objectToOptions(sJ.Groups.Names))},{isFlat:!0})}),representations:Ib.MultiSelect([],t(e,r),{emptyValue:"All"})}},e.getRepresentationTypes=t}(roe||={});var noe=function(e){function t(t){var r=e.call(this,{history:[]})||this;r.plugin=t,r.events={historyUpdated:r.ev()},r.behaviors={current:r.ev.behavior(void 0)},t.state.data.events.object.removed.subscribe(function(e){var t,n=e.obj;if(DS.Molecule.Structure.is(n)){r.current?.loci.structure===n.data&&r.clear();for(var i=[],a=0,o=r.history;a<o.length;a++){var s=o[a];s.loci.structure===n.data&&i.push(s)}i.length!==r.history.length&&(r.history.length=0,(t=r.history).push.apply(t,i),r.events.historyUpdated.next(void 0))}});var n=XE();return t.state.data.events.object.updated.subscribe(function(e){var t=e.oldData,i=e.obj,a=e.action;if(DS.Molecule.Structure.is(i)&&t!==i.data&&"in-place"===a){var o=r.state.current,s=i.data;if(o&&o.loci.structure===t){var u=Az.remap(o.loci,s);r.state.current=Ac(Ac({},o),{loci:u}),r.behaviors.current.next(r.state.current),TQ.getBoundingSphere(u,n);var c=r.plugin.canvas3d?.camera,l=c.getTargetDistance(n.radius+4);(Cg.distance(c.target,n.center)>n.radius||l>c.viewport.height/c.zoom)&&r.plugin.managers.camera.focusSphere(n,{durationMs:0})}}}),r}return wc(t,e),Object.defineProperty(t.prototype,"current",{get:function(){return this.state.current}
139,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"history",{get:function(){return this.state.history},enumerable:!1,configurable:!0}),t.prototype.tryAddHistory=function(e){if(!Az.isEmpty(e.loci)){for(var t=0,r=void 0,n=0,i=this.state.history;n<i.length;n++){var a=i[n];if(Az.areEqual(a.loci,e.loci)){r=a;break}t++}if(r)return Vb(this.state.history,t),this.state.history.unshift(e),void this.events.historyUpdated.next(void 0);this.state.history.unshift(e),this.state.history.length>8&&this.state.history.pop(),this.events.historyUpdated.next(void 0)}},t.prototype.set=function(e){this.tryAddHistory(e),this.state.current&&Az.areEqual(this.state.current.loci,e.loci)||(this.state.current=e,this.behaviors.current.next(e))},t.prototype.setFromLoci=function(e){var t=TQ.normalize(e);Az.is(t)&&!Az.isEmpty(t)?this.set({loci:t,label:GJ(t,{reverse:!0,hidePrefix:!0,htmlStyling:!1})}):this.clear()},t.prototype.addFromLoci=function(e){var t=this.state.current&&Az.is(e)&&e.structure===this.state.current.loci.structure?Az.union(e,this.state.current.loci):e;this.setFromLoci(t)},t.prototype.clear=function(){this.state.current&&(this.state.current=void 0,this.behaviors.current.next(void 0))},t.prototype.getSnapshot=function(){if(!this.current)return{};var e=this.plugin.helpers.substructureParent.get(this.current.loci.structure)?.transform.ref;return e?{current:{label:this.current.label,ref:e,bundle:sU.fromLoci(this.current.loci),category:this.current.category}}:{}},t.prototype.setSnapshot=function(e){if(e.current){var t=e.current,r=t.label,n=t.ref,i=t.bundle,a=t.category,o=this.plugin.state.data.select(Zb.Generators.byRef(n))[0]?.obj?.data;if(o){var s=sU.toLoci(i,o);this.set({label:r,loci:s,category:a})}}else this.clear()},t}(M2);function ioe(){return{trajectories:[],models:[],structures:[],refs:new Map}}function aoe(e){return{kind:"trajectory",cell:e,version:e.transform.version,models:[]}}function ooe(e,t){return{kind:"model",cell:e,version:e.transform.version,trajectory:t,structures:[]}}function soe(e,t){return{kind:"model-properties",cell:e,version:e.transform.version,model:t}}function uoe(e,t){return{kind:"model-unitcell",cell:e,version:e.transform.version,model:t}}function coe(e,t){return{kind:"structure",cell:e,version:e.transform.version,model:t,components:[]}}function loe(e,t){return{kind:"structure-properties",cell:e,version:e.transform.version,structure:t}}function doe(e,t){return{kind:"structure-transform",cell:e,version:e.transform.version,structure:t}}function foe(e,t){return{kind:"structure-volume-streaming",cell:e,version:e.transform.version,structure:t}}function hoe(e){return e.transform.tags?kc([],e.transform.tags,!0).sort().join():e.transform.ref}function poe(e,t){return{kind:"structure-component",cell:e,version:e.transform.version,structure:t,key:hoe(e),representations:[]}}function moe(e,t){return{kind:"structure-representation",cell:e,version:e.transform.version,component:t}}function goe(e,t){return{kind:"generic-representation",cell:e,version:e.transform.version,parent:t}}function voe(e,t,r,n){var i=[...arguments].slice(4),a=n.apply(void 0,i);r.push(a),e.hierarchy.refs.set(t.transform.ref,a);var o=e.oldHierarchy.refs.get(t.transform.ref);return o?o.version!==t.transform.version&&(e.changed=!0):(e.added.add(a.cell.transform.ref),e.changed=!0),a}function yoe(e,t,r){var n=[...arguments].slice(3),i=r.apply(void 0,n);e.hierarchy.refs.set(t.transform.ref,i);var a=e.oldHierarchy.refs.get(t.transform.ref);return a?a.version!==t.transform.version&&(e.changed=!0):(e.added.add(i.cell.transform.ref),e.changed=!0),i}function boe(e){return function(t){return e.is(t.obj)}}function _oe(e,t){return function(r,n){return!t(n)&&e.is(r.obj)}}function xoe(e){return function(t){return t.transform.transformer===e}}function Soe(){}var woe=[[boe(DS.Molecule.Trajectory),function(e,t){e.currentTrajectory=voe(e,t,e.hierarchy.trajectories,aoe,t)},function(e){e.currentTrajectory=void 0}],[_oe(DS.Molecule.Model,function(e){return e.currentModel}),function(e,t){e.currentTrajectory?e.currentModel=voe(e,t,e.currentTrajectory.models,ooe,t,e.currentTrajectory):e.currentModel=yoe(e,t,ooe,t),e.hierarchy.models.push(e.currentModel)},function(e){e.currentModel=void 0}],[xoe(m2.Model.CustomModelProperties),function(e,t){if(!e.currentModel)return!1;e.currentModel.properties=yoe(e,t,soe,t,e.currentModel)},Soe],[xoe(m2.Representation.ModelUnitcell3D),function(e,t){if(!e.currentModel)return!1;e.currentModel.unitcell=yoe(e,t,uoe,t,e.currentModel)},Soe],[_oe(DS.Molecule.Structure,function(e){return e.currentStructure}),function(e,t){e.currentModel?e.currentStructure=voe(e,t,e.currentModel.structures,coe,t,e.currentModel):e.currentStructure=yoe(e,t,coe,t),e.hierarchy.structures.push(e.currentStructure)},function(e){e.currentStructure=void 0}],[xoe(m2.Model.CustomStructureProperties),function(e,t){if(!e.currentStructure)return!1;e.currentStructure.properties=yoe(e,t,loe,t,e.currentStructure)},Soe],[xoe(m2.Model.TransformStructureConformation),function(e,t){if(!e.currentStructure)return!1;e.currentStructure.transform=yoe(e,t,doe,t,e.currentStructure)},Soe],[boe(fne),function(e,t){return!!e.currentStructure&&(e.currentStructure.volumeStreaming=yoe(e,t,foe,t,e.currentStructure),!1)},Soe],[function(e,t){return!(t.currentComponent||!t.currentStructure||e.transform.transformer.definition.isDecorator)&&DS.Molecule.Structure.is(e.obj)},function(e,t){e.currentStructure&&(e.currentComponent=voe(e,t,e.currentStructure.components,poe,t,e.currentStructure))},function(e){e.currentComponent=void 0}],[function(e,t){return!e.state.isGhost&&!!t.currentComponent&&DS.Molecule.Structure.Representation3D.is(e.obj)},function(e,t){return e.currentComponent&&voe(e,t,e.currentComponent.representations,moe,t,e.currentComponent),!1},Soe],[function(e){return!e.state.isGhost&&DS.isRepresentation3D(e.obj)},function(e,t){var r=e.currentComponent||e.currentStructure||e.currentModel;r&&(r.genericRepresentations||=[],voe(e,t,r.genericRepresentations,goe,t,r))},Soe]];function Aoe(e){if(!e||!e?.parent||!e.parent.cells.has(e.transform.ref))return!1;var t=e.obj;return!(!t||t===of.Null||"ok"!==e.status&&"error"!==e.status)}function Coe(e){Aoe(e.cell)||(this.changed=!0)}function Toe(e){Poe(this,this.tree.transforms.get(e))}function Poe(e,t){var r=e.state,n=r.state.cells.get(t.ref);if(Aoe(n)){for(var i=void 0,a=!1,o=0,s=woe;o<s.length;o++){var u=s[o],c=u[0],l=u[1],d=u[2];if(c(n,r)){if(!1===l(r,n)){a=!0;break}i=d;break}}if(!a){var f=e.tree.children.get(t.ref);f&&f.size&&f.forEach(Toe,e),i&&i(r)}}}var Eoe=function(e){function t(t){var r=e.call(this)||this;return r.plugin=t,r.state={syncedTree:r.dataState.tree,notified:!1,hierarchy:ioe(),selection:{trajectories:[],models:[],structures:[]}},r.behaviors={selection:r.ev.behavior({hierarchy:r.current,trajectories:r.selection.trajectories,models:r.selection.models,structures:r.selection.structures})},r._currentComponentGroups=void 0,r._currentSelectionSet=void 0,r.subscribe(t.state.data.events.changed,function(e){e.inTransaction||t.behaviors.state.isAnimating.value||r.sync(!0)}),r.subscribe(t.behaviors.state.isAnimating,function(e){e||t.behaviors.state.isUpdating.value||r.sync(!0)}),r}return wc(t,e),Object.defineProperty(t.prototype,"dataState",{get:function(){return this.plugin.state.data}
139,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentComponentGroups",{get:function(){return this._currentComponentGroups||=t.getComponentGroups(this.selection.structures),this._currentComponentGroups},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"seletionSet",{get:function(){if(this._currentSelectionSet)return this._currentSelectionSet;this._currentSelectionSet=new Set;for(var e=0,t=this.selection.trajectories;e<t.length;e++){var r=t[e];this._currentSelectionSet.add(r.cell.transform.ref)}for(var n=0,i=this.selection.models;n<i.length;n++)r=i[n],this._currentSelectionSet.add(r.cell.transform.ref);for(var a=0,o=this.selection.structures;a<o.length;a++)r=o[a],this._currentSelectionSet.add(r.cell.transform.ref);return this._currentSelectionSet},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"current",{get:function(){return this.sync(!1),this.state.hierarchy},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selection",{get:function(){return this.sync(!1),this.state.selection},enumerable:!1,configurable:!0}),t.prototype.getStructuresWithSelection=function(){for(var e=[],t=0,r=this.plugin.managers.structure.hierarchy.current.structures;t<r.length;t++){var n=r[t];this.plugin.managers.structure.selection.structureHasSelection(n)&&e.push(n)}return e},t.prototype.findStructure=function(e){if(e){var t=this.plugin.helpers.substructureParent.get(e);if(t){var r=this.plugin.state.data.selectQ(function(e){return e.byValue(t).rootOfType(DS.Molecule.Structure)})[0];if(r)return this.behaviors.selection.value.structures.find(function(e){return e.cell===r})}}},t.prototype.syncCurrent=function(e,t){for(var r=this.seletionSet,n=[],i=0,a=e;i<a.length;i++){var o=a[i],s=o.cell.transform.ref;(r.has(s)||t.has(s))&&n.push(o)}return 0===n.length?e.length>0?[e[0]]:[]:n},t.prototype.sync=function(e){if(e||!this.dataState.inUpdate)if(this.state.syncedTree!==this.dataState.tree){this.state.syncedTree=this.dataState.tree;var t=function(e,t){var r=function(e,t){return{state:e,oldHierarchy:t,hierarchy:ioe(),changed:!1,added:new Set}}(e,t||ioe());return function(e,t){Poe({tree:e,state:t},e.root)}(e.tree,r),t&&t.refs.forEach(Coe,r),{hierarchy:r.hierarchy,added:r.added,changed:r.changed}}(this.plugin.state.data,this.current);if(t.changed){var r=t.hierarchy,n=this.syncCurrent(r.trajectories,t.added),i=this.syncCurrent(r.models,t.added),a=this.syncCurrent(r.structures,t.added);this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.hierarchy=r,this.state.selection.trajectories=n,this.state.selection.models=i,this.state.selection.structures=a,e?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,trajectories:n,models:i,structures:a})):this.state.notified=!1}}else e&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next(Ac({hierarchy:this.state.hierarchy},this.state.selection)))},t.prototype.updateCurrent=function(e,t){for(var r=this.current,n="add"===t?mN.union(this.seletionSet,new Set(e.map(function(e){return e.cell.transform.ref}))):mN.difference(this.seletionSet,new Set(e.map(function(e){return e.cell.transform.ref}))),i=[],a=[],o=[],s=0,u=r.trajectories;s<u.length;s++){var c=u[s];n.has(c.cell.transform.ref)&&i.push(c)}for(var l=0,d=r.models;l<d.length;l++){var f=d[l];n.has(f.cell.transform.ref)&&a.push(f)}for(var h=0,p=r.structures;h<p.length;h++){var m=p[h];n.has(m.cell.transform.ref)&&o.push(m)}this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.selection.trajectories=i,this.state.selection.models=a,this.state.selection.structures=o,this.behaviors.selection.next({hierarchy:r,trajectories:i,models:a,structures:o})},t.prototype.remove=function(e,t){if(0!==e.length){for(var r=this.plugin.state.data.build(),n=0,i=e;n<i.length;n++){var a=i[n];r.delete("string"==typeof a?a:a.cell.transform.ref)}return r.commit({canUndo:!!t&&"Remove"})}},t.prototype.toggleVisibility=function(e,t){if(0!==e.length)for(var r=void 0===t?!e[0].cell.state.isHidden:"show"!==t,n=0,i=e;n<i.length;n++){var a=i[n];K2(this.dataState,a.cell.transform.ref,r)}},t.prototype.applyPreset=function(e,t,r){var n=this;return this.plugin.dataTransaction(function(){return Tc(n,void 0,void 0,function(){var n,i,a;return Pc(this,function(o){switch(o.label){case 0:n=0,i=e,o.label=1;case 1:return n<i.length?(a=i[n]).models.length>0?[4,this.clearTrajectory(a)]:[3,3]:[3,6];case 2:o.sent(),o.label=3;case 3:return[4,this.plugin.builders.structure.hierarchy.applyPreset(a.cell,t,r)];case 4:o.sent(),o.label=5;case 5:return n++,[3,1];case 6:return[2]}})})})},t.prototype.updateStructure=function(e,t){return Tc(this,void 0,void 0,function(){var r=this;return Pc(this,function(n){switch(n.label){case 0:return[4,this.plugin.dataTransaction(function(){return Tc(r,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:return r=Kb.getDecoratorRoot(this.dataState.tree,e.cell.transform.ref),n=this.dataState.tree.children.get(r).toArray(),[4,this.remove(n,!1)];case 1:return i.sent(),[4,this.plugin.state.updateTransform(this.plugin.state.data,e.cell.transform.ref,t,"Structure Type")];case 2:return i.sent(),[4,this.plugin.builders.structure.representation.applyPreset(e.cell.transform.ref,"auto")];case 3:return i.sent(),[2]}})})},{canUndo:"Structure Type"})];case 1:return n.sent(),y2.Camera.Reset(this.plugin),[2]}})})},t.prototype.clearTrajectory=function(e){for(var t=this.dataState.build(),r=0,n=e.models;r<n.length;r++){var i=n[r];t.delete(i.cell)}return t.commit()},t}(E2);!function(e){e.getComponentGroups=function(e){if(!e.length)return[];if(1===e.length)return e[0].components.map(function(e){return[e]});for(var t=[],r=new Map,n=0,i=e;n<i.length;n++)for(var a=0,o=i[n].components;a<o.length;a++){var s=o[a],u=s.key;if(u){var c=r.get(u);c||(c=[],r.set(u,c),t.push(c)),c.push(s)}}return t}
139,e.getSelectedStructuresDescription=function(e){var t=e.managers.structure.hierarchy.selection.structures;if(0===t.length)return"";if(1===t.length){var r=(c=t[0]).cell.obj?.data;if(!r)return c.cell.obj?.label||"Structure";var n=r.models[0]||r.representativeModel||r.masterModel;if(!n)return c.cell.obj?.label||"Structure";var i=n.entryId;return c.model?.trajectory?.models&&1===c.model.trajectory.models.length?i:c.model?`${c.model.cell.obj?.label} | ${i}`:i}for(var a=t[0]?.model?.trajectory,o=!0,s=0,u=t;s<u.length;s++){var c;if((c=u[s])?.model?.trajectory!==a){o=!1;break}}return o&&a?`${a.cell.obj?.label} | ${t.length} structures`:`${t.length} structures`}}(Eoe||={});var Moe="measurement-group",koe="measurement-order-label",Ioe={distanceUnitLabel:Ib.Text("Å",{isEssential:!0}),textColor:t0.textColor},Doe=Ib.getDefaultValues(Ioe),Ooe=function(e){function t(t){var r=e.call(this,{labels:[],distances:[],angles:[],dihedrals:[],orientations:[],planes:[],options:Doe})||this;return r.plugin=t,r.behaviors={state:r.ev.behavior(r.state)},r._empty=[],t.state.data.events.changed.subscribe(function(e){e.inTransaction||t.behaviors.state.isAnimating.value||r.sync()}),t.behaviors.state.isAnimating.subscribe(function(e){e||t.behaviors.state.isUpdating.value||r.sync()}),r}return wc(t,e),t.prototype.stateUpdated=function(){this.behaviors.state.next(this.state)},t.prototype.getGroup=function(){var e=this.plugin.state.data,t=Zb.findTagInSubtree(e.tree,Rb.RootRef,Moe),r=this.plugin.state.data.build();return t?r.to(t):r.toRoot().group(m2.Misc.CreateGroup,{label:"Measurements"},{tags:Moe})},t.prototype.setOptions=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l;return Pc(this,function(d){switch(d.label){case 0:for(this.updateState({options:e})&&this.stateUpdated(),t=this.plugin.state.data.build(),r=0,n=this.state.distances;r<n.length;r++)l=n[r],t.to(l).update(function(t){t.unitLabel=e.distanceUnitLabel,t.textColor=e.textColor});for(i=0,a=this.state.labels;i<a.length;i++)l=a[i],t.to(l).update(function(t){t.textColor=e.textColor});for(o=0,s=this.state.angles;o<s.length;o++)l=s[o],t.to(l).update(function(t){t.textColor=e.textColor});for(u=0,c=this.state.dihedrals;u<c.length;u++)l=c[u],t.to(l).update(function(t){t.textColor=e.textColor});return 0===t.editInfo.count?[2]:[4,y2.State.Update(this.plugin,{state:this.plugin.state.data,tree:t,options:{doNotLogTiming:!0}})];case 1:return d.sent(),[2]}})})},t.prototype.addDistance=function(e,t,r){return Tc(this,void 0,void 0,function(){var n,i,a,o,s;return Pc(this,function(u){switch(u.label){case 0:return n=this.plugin.helpers.substructureParent.get(e.structure),i=this.plugin.helpers.substructureParent.get(t.structure),n&&i?(Hb(a=[n.transform.ref],i.transform.ref),(o=this.getGroup()).apply(m2.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",groupId:"a",ref:n.transform.ref,expression:Az.toExpression(e)},{key:"b",groupId:"b",ref:i.transform.ref,expression:Az.toExpression(t)}],isTransitive:!0,label:"Distance"},{dependsOn:a,tags:r?.selectionTags}).apply(m2.Representation.StructureSelectionsDistance3D,Ac(Ac(Ac({customText:r?.customText||"",unitLabel:this.state.options.distanceUnitLabel,textColor:this.state.options.textColor},r?.lineParams),r?.labelParams),r?.visualParams),{tags:r?.reprTags}),s=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:s,tree:o,options:{doNotLogTiming:!0}})]):[2];case 1:return u.sent(),[2]}})})},t.prototype.addAngle=function(e,t,r,n){return Tc(this,void 0,void 0,function(){var i,a,o,s,u,c;return Pc(this,function(l){switch(l.label){case 0:return i=this.plugin.helpers.substructureParent.get(e.structure),a=this.plugin.helpers.substructureParent.get(t.structure),o=this.plugin.helpers.substructureParent.get(r.structure),i&&a&&o?(Hb(s=[i.transform.ref],a.transform.ref),Hb(s,o.transform.ref),(u=this.getGroup()).apply(m2.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:i.transform.ref,expression:Az.toExpression(e)},{key:"b",ref:a.transform.ref,expression:Az.toExpression(t)},{key:"c",ref:o.transform.ref,expression:Az.toExpression(r)}],isTransitive:!0,label:"Angle"},{dependsOn:s,tags:n?.selectionTags}).apply(m2.Representation.StructureSelectionsAngle3D,Ac(Ac(Ac({customText:n?.customText||"",textColor:this.state.options.textColor},n?.lineParams),n?.labelParams),n?.visualParams),{tags:n?.reprTags}),c=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:c,tree:u,options:{doNotLogTiming:!0}})]):[2];case 1:return l.sent(),[2]}})})},t.prototype.addDihedral=function(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d;return Pc(this,function(f){switch(f.label){case 0:return a=this.plugin.helpers.substructureParent.get(e.structure),o=this.plugin.helpers.substructureParent.get(t.structure),s=this.plugin.helpers.substructureParent.get(r.structure),u=this.plugin.helpers.substructureParent.get(n.structure),a&&o&&s&&u?(Hb(c=[a.transform.ref],o.transform.ref),Hb(c,s.transform.ref),Hb(c,u.transform.ref),(l=this.getGroup()).apply(m2.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:a.transform.ref,expression:Az.toExpression(e)},{key:"b",ref:o.transform.ref,expression:Az.toExpression(t)},{key:"c",ref:s.transform.ref,expression:Az.toExpression(r)},{key:"d",ref:u.transform.ref,expression:Az.toExpression(n)}],isTransitive:!0,label:"Dihedral"},{dependsOn:c,tags:i?.selectionTags}).apply(m2.Representation.StructureSelectionsDihedral3D,Ac(Ac(Ac({customText:i?.customText||"",textColor:this.state.options.textColor},i?.lineParams),i?.labelParams),i?.visualParams),{tags:i?.reprTags}),d=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:d,tree:l,options:{doNotLogTiming:!0}})]):[2];case 1:return f.sent(),[2]}})})},t.prototype.addLabel=function(e,t){return Tc(this,void 0,void 0,function(){var r,n,i,a;return Pc(this,function(o){switch(o.label){case 0:return(r=this.plugin.helpers.substructureParent.get(e.structure))?(n=[r.transform.ref],(i=this.getGroup()).apply(m2.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:r.transform.ref,expression:Az.toExpression(e)}],isTransitive:!0,label:"Label"},{dependsOn:n,tags:t?.selectionTags}).apply(m2.Representation.StructureSelectionsLabel3D,Ac(Ac({textColor:this.state.options.textColor},t?.labelParams),t?.visualParams),{tags:t?.reprTags}),a=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:a,tree:i,options:{doNotLogTiming:!0}})]):[2];case 1:return o.sent(),[2]}})})},t.prototype.addOrientation=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:for(t=[],r=[],n=0,i=e.length;n<i;
139++n)a=e[n],(o=this.plugin.helpers.substructureParent.get(a.structure))&&(Hb(r,o.transform.ref),t.push({key:`l${n}`,ref:o.transform.ref,expression:Az.toExpression(a)}));return 0===t.length?[2]:((s=this.getGroup()).apply(m2.Model.MultiStructureSelectionFromExpression,{selections:t,isTransitive:!0,label:"Orientation"},{dependsOn:r}).apply(m2.Representation.StructureSelectionsOrientation3D),u=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:u,tree:s,options:{doNotLogTiming:!0}})]);case 1:return c.sent(),[2]}})})},t.prototype.addPlane=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:for(t=[],r=[],n=0,i=e.length;n<i;++n)a=e[n],(o=this.plugin.helpers.substructureParent.get(a.structure))&&(Hb(r,o.transform.ref),t.push({key:`l${n}`,ref:o.transform.ref,expression:Az.toExpression(a)}));return 0===t.length?[2]:((s=this.getGroup()).apply(m2.Model.MultiStructureSelectionFromExpression,{selections:t,isTransitive:!0,label:"Plane"},{dependsOn:r}).apply(m2.Representation.StructureSelectionsPlane3D),u=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:u,tree:s,options:{doNotLogTiming:!0}})]);case 1:return c.sent(),[2]}})})},t.prototype.addOrderLabels=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:for(t=this.getGroup(),r=this.plugin.state.data.select(Zb.Generators.ofType(DS.Molecule.Structure.Selections).withTag(koe)),n=0,i=r;n<i.length;n++)a=i[n],t.delete(a);for(o=1,s=0,u=e;s<u.length;s++)c=u[s],(l=this.plugin.helpers.substructureParent.get(c.structure))&&(d=[l.transform.ref],t.apply(m2.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:l.transform.ref,expression:Az.toExpression(c)}],isTransitive:!0,label:"Order"},{dependsOn:d,tags:koe}).apply(m2.Representation.StructureSelectionsLabel3D,{textColor:tv.fromRgb(255,255,255),borderColor:tv.fromRgb(0,0,0),textSize:.33,borderWidth:.3,offsetZ:.75,customText:""+o++},{tags:koe}));return f=this.plugin.state.data,[4,y2.State.Update(this.plugin,{state:f,tree:t,options:{doNotLogTiming:!0}})];case 1:return h.sent(),[2]}})})},t.prototype.getTransforms=function(e){var t=this.plugin.state.data,r=Zb.findTagInSubtree(t.tree,Rb.RootRef,Moe),n=r?t.select(Zb.Generators.ofTransformer(e,r)):this._empty;return 0===n.length?this._empty:n},t.prototype.sync=function(){for(var e=[],t=0,r=this.getTransforms(m2.Representation.StructureSelectionsLabel3D);t<r.length;t++){var n=r[t],i=n.obj.tags;i&&i.includes(koe)||e.push(n)}this.updateState({labels:e,distances:this.getTransforms(m2.Representation.StructureSelectionsDistance3D),angles:this.getTransforms(m2.Representation.StructureSelectionsAngle3D),dihedrals:this.getTransforms(m2.Representation.StructureSelectionsDihedral3D),orientations:this.getTransforms(m2.Representation.StructureSelectionsOrientation3D),planes:this.getTransforms(m2.Representation.StructureSelectionsPlane3D)})&&this.stateUpdated()},t}(M2),Roe=new PM("98"),Boe=function(e){function t(t){var r=e.call(this,{entries:new Map,additionsHistory:[],stats:{structureCount:0,elementCount:0,label:"Nothing Selected"}})||this;return r.plugin=t,r.events={changed:r.ev(),additionsHistoryUpdated:r.ev(),loci:{add:r.ev(),remove:r.ev(),clear:r.ev()}},t.helpers.substructureParent.events.removed.subscribe(function(e){return r.onRemove(e.ref,e.obj)}),t.helpers.substructureParent.events.updated.subscribe(function(e){return r.onUpdate(e.ref,e.oldObj,e.obj)}),r}return wc(t,e),Object.defineProperty(t.prototype,"entries",{get:function(){return this.state.entries},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"additionsHistory",{get:function(){return this.state.additionsHistory},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stats",{get:function(){return this.state.stats||(this.state.stats=this.calcStats()),this.state.stats},enumerable:!1,configurable:!0}),t.prototype.getEntry=function(e){var t=this.plugin.helpers.substructureParent.get(e,!0);if(t){var r=t.transform.ref;if(!this.entries.has(r)){var n=new Noe(Az(e,[]));return this.entries.set(r,n),n}return this.entries.get(r)}},t.prototype.calcStats=function(){var e=0,t=0,r=_z.create();
139this.entries.forEach(function(n){var i=n.selection.elements;if(i.length){e+=1;for(var a=0,o=i.length;a<o;++a)t+=kP.size(i[a].indices);_z.add(r,r,_z.ofLoci(n.selection))}});var n=qJ(r,{countsOnly:!0});return{structureCount:e,elementCount:t,label:n}},t.prototype.add=function(e){if(!Az.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=Az.union(t.selection,e),this.tryAddHistory(e),this.referenceLoci=e,this.events.loci.add.next(e),!Az.areEqual(r,t.selection)},t.prototype.remove=function(e){if(!Az.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=Az.subtract(t.selection,e),this.referenceLoci=e,this.events.loci.remove.next(e),!Az.areEqual(r,t.selection)},t.prototype.intersect=function(e){if(!Az.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=Az.intersect(t.selection,e),this.referenceLoci=e,!Az.areEqual(r,t.selection)},t.prototype.set=function(e){if(!Az.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=e,this.tryAddHistory(e),this.referenceLoci=void 0,!Az.areEqual(r,t.selection)},t.prototype.modifyHistory=function(e,t,r,n){void 0===n&&(n=!1);var i=this.additionsHistory,a=i.indexOf(e);if(!(a<0)){var o=void 0;switch(t){case"remove":Vb(i,a);break;case"up":o=a-1;break;case"down":o=a+1}if(void 0!==o)for(var s=r?Math.min(i.length,r):i.length;;){if((o%=s)<0&&(o+=s),!n||i[a].loci.structure===i[o].loci.structure){var u=i[a];i[a]=i[o],i[o]=u;break}o+="up"===t?-1:1}this.events.additionsHistoryUpdated.next(void 0)}},t.prototype.tryAddHistory=function(e){if(!TQ.isEmpty(e)){for(var t=0,r=void 0,n=0,i=this.additionsHistory;n<i.length;n++){var a=i[n];if(TQ.areEqual(a.loci,e)){r=a;break}t++}if(r)return Vb(this.additionsHistory,t),this.additionsHistory.unshift(r),void this.events.additionsHistoryUpdated.next(void 0);var o=qJ(_z.ofLoci(e),{reverse:!0});this.additionsHistory.unshift({id:Wd.create22(),loci:e,label:o}),this.additionsHistory.length>24&&this.additionsHistory.pop(),this.events.additionsHistoryUpdated.next(void 0)}},t.prototype.clearHistory=function(){0!==this.state.additionsHistory.length&&(this.state.additionsHistory=[],this.events.additionsHistoryUpdated.next(void 0))},t.prototype.clearHistoryForStructure=function(e){for(var t=[],r=0,n=this.state.additionsHistory;r<n.length;r++)(o=n[r]).loci.structure.root===e.root&&t.push(o);for(var i=0,a=t;i<a.length;i++){var o=a[i];this.modifyHistory(o,"remove")}0!==t.length&&this.events.additionsHistoryUpdated.next(void 0)},t.prototype.onRemove=function(e,t){this.entries.has(e)&&(this.entries.delete(e),null!=t&&t.data&&this.clearHistoryForStructure(t.data),this.referenceLoci?.structure===t?.data&&(this.referenceLoci=void 0),this.state.stats=void 0,this.events.changed.next(void 0))},t.prototype.onUpdate=function(e,t,r){if(t!==r&&t?.data!==r.data){var n=this.plugin.helpers.substructureParent.get(r.data,!0);if(n&&e===n.transform.ref&&this.entries.has(e)){var i=this.plugin.helpers.substructureParent.get(r.data)?.obj?.data;if(i)if(!t?.data||yz.areUnitIdsAndIndicesEqual(t.data,r.data)){this.entries.set(e,function(e,t){return new Noe(Az.remap(e.selection,t))}(this.entries.get(e),i)),this.referenceLoci?.structure.root===i.root&&(this.referenceLoci=Az.remap(this.referenceLoci,i));for(var a=!1,o=0,s=this.state.additionsHistory;o<s.length;o++){var u=s[o];u.loci.structure.root===i.root&&(u.loci=Az.remap(u.loci,i),a=!0)}a&&this.events.additionsHistoryUpdated.next(void 0)}else this.entries.set(e,new Noe(Az(i,[]))),this.referenceLoci?.structure.root===i.root&&(this.referenceLoci=void 0),this.clearHistoryForStructure(i),this.state.stats=void 0,this.events.changed.next(void 0)}}},t.prototype.clear=function(){for(var e=this.entries.keys(),t=[];;){var r=e.next();if(r.done)break;var n=this.entries.get(r.value);Az.isEmpty(n.selection)||t.push(n.selection),n.selection=Az(n.selection.structure,[])}return this.referenceLoci=void 0,this.state.stats=void 0,this.events.changed.next(void 0),this.events.loci.clear.next(void 0),this.clearHistory(),t},t.prototype.getLoci=function(e){var t=this.getEntry(e);return t?t.selection:EQ},t.prototype.getStructure=function(e){var t=this.getEntry(e);if(t)return t.structure},t.prototype.structureHasSelection=function(e){var t=e.cell?.obj?.data;if(!t)return!1;var r=this.getEntry(t);return!!r&&!Az.isEmpty(r.selection)},t.prototype.has=function(e){if(Az.is(e)){var t=this.getEntry(e.structure);if(t)return Az.isSubset(t.selection,e)}return!1},t.prototype.tryGetRange=function(e){if(Az.is(e)&&1===e.elements.length&&this.getEntry(e.structure)){var t=e.elements[0];if(t){var r=this.referenceLoci;if(r&&Az.is(r)&&r.structure===e.structure){for(var n,i=0,a=r.elements;i<a.length;i++){var o=a[i];if(t.unit===o.unit){n=o;break}}if(n&&t.unit===n.unit)return function(e,t,r){var n=Math.min(kP.min(t.indices),kP.min(r.indices)),i=Math.max(kP.max(t.indices),kP.max(r.indices));return Az(e,[{unit:t.unit,indices:kP.ofRange(n,i)}])}(e.structure,n,t)}}}},t.prototype.elementCount=function(){var e=0;
139return this.entries.forEach(function(t){e+=Az.size(t.selection)}),e},t.prototype.getBoundary=function(){var e=Cg.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t=Cg.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);Roe.reset();var r=[];this.entries.forEach(function(e){var t=e.selection;Az.isEmpty(t)||r.push(Az.getBoundary(t))});for(var n=0,i=r.length;n<i;++n){var a=r[n],o=a.box,s=a.sphere;Cg.min(e,e,o.min),Cg.max(t,t,o.max),Roe.includePositionRadius(s.center,s.radius)}for(Roe.finishedIncludeStep(),n=0,i=r.length;n<i;++n)s=r[n].sphere,Roe.radiusPositionRadius(s.center,s.radius);return{box:{min:e,max:t},sphere:Roe.getSphere()}},t.prototype.getPrincipalAxes=function(){var e=Hv(this.entries.values());return Az.getPrincipalAxesMany(e.map(function(e){return e.selection}))},t.prototype.modify=function(e,t){var r=!1;switch(e){case"add":r=this.add(t);break;case"remove":r=this.remove(t);break;case"intersect":r=this.intersect(t);break;case"set":r=this.set(t)}r&&(this.state.stats=void 0,this.events.changed.next(void 0))},Object.defineProperty(t.prototype,"applicableStructures",{get:function(){return this.plugin.managers.structure.hierarchy.selection.structures.filter(function(e){return!!e.cell.obj}).map(function(e){return e.cell.obj.data})},enumerable:!1,configurable:!0}),t.prototype.triggerInteraction=function(e,t,r){switch(void 0===r&&(r=!0),e){case"add":this.plugin.managers.interactivity.lociSelects.select({loci:t},r);break;case"remove":this.plugin.managers.interactivity.lociSelects.deselect({loci:t},r);break;case"intersect":this.plugin.managers.interactivity.lociSelects.selectJoin({loci:t},r);break;case"set":this.plugin.managers.interactivity.lociSelects.selectOnly({loci:t},r)}},t.prototype.fromLoci=function(e,t,r){void 0===r&&(r=!0),this.triggerInteraction(e,t,r)},t.prototype.fromCompiledQuery=function(e,t,r){void 0===r&&(r=!0);for(var n=0,i=this.applicableStructures;n<i.length;n++){var a=i[n],o=t(new _U(a));this.triggerInteraction(e,oU.toLociWithSourceUnits(o),r)}},t.prototype.fromSelectionQuery=function(e,t,r){var n=this;void 0===r&&(r=!0),this.plugin.runTask(vy.create("Structure Selection",function(i){return Tc(n,void 0,void 0,function(){var n,a,o,s;return Pc(this,function(u){switch(u.label){case 0:n=0,a=this.applicableStructures,u.label=1;case 1:return n<a.length?(o=a[n],[4,t.getSelection(this.plugin,i,o)]):[3,4];case 2:s=u.sent(),this.triggerInteraction(e,oU.toLociWithSourceUnits(s),r),u.label=3;case 3:return n++,[3,1];case 4:return[2]}})})}))},t.prototype.fromSelections=function(e){var t=hf.resolveAndCheck(this.plugin.state.data,e);if(t&&t.obj)if(DS.Molecule.Structure.Selections.is(t.obj)){this.clear();for(var r=0,n=t.obj?.data;r<n.length;r++){var i=n[r];this.fromLoci("set",i.loci)}}else console.warn("fromSelections applied to wrong object type.",t.obj)},t.prototype.getSnapshot=function(){var e=[];return this.entries.forEach(function(t,r){e.push({ref:r,bundle:sU.fromLoci(t.selection)})}),{entries:e}},t.prototype.setSnapshot=function(e){this.entries.clear();for(var t=0,r=e.entries;t<r.length;t++){var n=r[t],i=n.ref,a=n.bundle,o=this.plugin.state.data.select(Zb.Generators.byRef(i))[0]?.obj?.data;if(o){var s=sU.toLoci(a,o);this.fromLoci("set",s,!1)}}},t}(M2),Noe=function(){function e(e){this._structure=void 0,this._selection=e}return Object.defineProperty(e.prototype,"selection",{get:function(){return this._selection},set:function(e){this._selection=e,this._structure=void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"structure",{get:function(){return this._structure||(TQ.isEmpty(this._selection)?this._structure=void 0:this._structure=Az.toStructure(this._selection)),this._structure},enumerable:!1,configurable:!0}),e}();function Foe(){return{volumes:[],lazyVolumes:[],refs:new Map}}function Loe(e){return{kind:"volume",cell:e,version:e.transform.version,representations:[]}}function $oe(e){return{kind:"lazy-volume",cell:e,version:e.transform.version}}function Uoe(e,t){return{kind:"volume-representation",cell:e,version:e.transform.version,volume:t}}function joe(e,t,r,n){var i=[...arguments].slice(4),a=n.apply(void 0,i);r.push(a),e.hierarchy.refs.set(t.transform.ref,a);var o=e.oldHierarchy.refs.get(t.transform.ref);return o?o.version!==t.transform.version&&(e.changed=!0):(e.added.add(a.cell.transform.ref),e.changed=!0),a}function zoe(){}var Goe=[[function(e){return function(t,r){return!function(e){return e.currentVolume}(r)&&e.is(t.obj)}}(DS.Volume.Data),function(e,t){e.currentVolume=joe(e,t,e.hierarchy.volumes,Loe,t)},function(e){e.currentVolume=void 0}],[function(e){return DS.Volume.Lazy.is(e.obj)},function(e,t){joe(e,t,e.hierarchy.lazyVolumes,$oe,t)},zoe],[function(e,t){return!e.state.isGhost&&!!t.currentVolume&&DS.Volume.Representation3D.is(e.obj)},function(e,t){return e.currentVolume&&joe(e,t,e.currentVolume.representations,Uoe,t,e.currentVolume),!1},zoe]];function Voe(e){if(!e||!e?.parent||!e.parent.cells.has(e.transform.ref))return!1;var t=e.obj;return!(!t||t===of.Null||"ok"!==e.status&&"error"!==e.status)}function Hoe(e){Voe(e.cell)||(this.changed=!0)}function qoe(e){Woe(this,this.tree.transforms.get(e))}function Woe(e,t){var r=e.state,n=r.state.cells.get(t.ref);if(Voe(n)){for(var i=void 0,a=!1,o=0,s=Goe;o<s.length;o++){var u=s[o],c=u[0],l=u[1],d=u[2];if(c(n,r)){if(!1===l(r,n)){a=!0;break}i=d;break}}if(!a){var f=e.tree.children.get(t.ref);f&&f.size&&f.forEach(qoe,e),i&&i(r)}}}var Xoe=function(e){function t(t){var r=e.call(this)||this;return r.plugin=t,r.state={syncedTree:r.dataState.tree,notified:!1,hierarchy:Foe(),selection:void 0},r.behaviors={selection:r.ev.behavior({hierarchy:r.current,volume:r.selection})},r.subscribe(t.state.data.events.changed,function(e){e.inTransaction||t.behaviors.state.isAnimating.value||r.sync(!0)}),r.subscribe(t.behaviors.state.isAnimating,function(e){e||t.behaviors.state.isUpdating.value||r.sync(!0)}),r}return wc(t,e),Object.defineProperty(t.prototype,"dataState",{get:function(){return this.plugin.state.data}
139,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"current",{get:function(){return this.sync(!1),this.state.hierarchy},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selection",{get:function(){return this.sync(!1),this.state.selection},enumerable:!1,configurable:!0}),t.prototype.sync=function(e){if(e||!this.dataState.inUpdate)if(this.state.syncedTree!==this.dataState.tree){this.state.syncedTree=this.dataState.tree;var t=function(e,t){var r=function(e,t){return{state:e,oldHierarchy:t,hierarchy:Foe(),changed:!1,added:new Set}}(e,t||Foe());return function(e,t){Woe({tree:e,state:t},e.root)}(e.tree,r),t&&t.refs.forEach(Hoe,r),{hierarchy:r.hierarchy,added:r.added,changed:r.changed}}(this.plugin.state.data,this.current);if(t.changed){var r=t.hierarchy;this.state.hierarchy=r,this.state.selection?this.state.selection=r.refs.has(this.state.selection.cell.transform.ref)?r.refs.get(this.state.selection.cell.transform.ref):r.volumes[0]:this.state.selection=r.volumes[0],e?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,volume:this.state.selection})):this.state.notified=!1}}else e&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:this.state.selection}))},t.prototype.setCurrent=function(e){this.state.selection=e||this.state.hierarchy.volumes[0],this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:e||this.state.hierarchy.volumes[0]})},t.prototype.remove=function(e,t){if(0!==e.length){for(var r=this.plugin.state.data.build(),n=0,i=e;n<i.length;n++){var a=i[n];r.delete("string"==typeof a?a:a.cell.transform.ref)}return r.commit({canUndo:!!t&&"Remove"})}},t.prototype.toggleVisibility=function(e,t){if(0!==e.length)for(var r=void 0===t?!e[0].cell.state.isHidden:"show"!==t,n=0,i=e;n<i.length;n++){var a=i[n];K2(this.dataState,a.cell.transform.ref,r)}},t.prototype.addRepresentation=function(e,t){return this.dataState.build().to(e.cell).apply(m2.Representation.VolumeRepresentation3D,xae(this.plugin,e.cell.obj?.data,{type:t})).commit({canUndo:"Add Representation"})},t}(E2);!function(e){e.getRepresentationTypes=function(e,t){return t?.cell.obj?.data?e.representation.volume.registry.getApplicableTypes(t.cell.obj?.data):e.representation.volume.registry.types}}(Xoe||={});var Yoe=[["full","Full"],["hidden","Hidden"]],Koe={isExpanded:Ib.Boolean(!1),showControls:Ib.Boolean(!0),regionState:Ib.Group({left:Ib.Select("full",[["full","Full"],["collapsed","Collapsed"],["hidden","Hidden"]]),top:Ib.Select("full",Yoe),right:Ib.Select("full",Yoe),bottom:Ib.Select("full",Yoe)}),controlsDisplay:Ib.Value("outside",{isHidden:!0})},Zoe=function(e){function t(t){var r=e.call(this,Ac(Ac({},Ib.getDefaultValues(Koe)),t.spec.layout&&t.spec.layout.initial))||this;return r.context=t,r.events={updated:r.ev()},r.rootState=void 0,y2.Layout.Update.subscribe(t,function(e){return r.updateProps(e.state)}),typeof document<"u"&&(r.expandedViewport=document.createElement("meta"),r.expandedViewport.name="viewport",r.expandedViewport.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"),r}return wc(t,e),t.prototype.updateProps=function(e){var t=!!this.state.isExpanded;this.updateState(e),this.root&&"boolean"==typeof e.isExpanded&&e.isExpanded!==t&&this.handleExpand(),this.events.updated.next(void 0)},t.prototype.setProps=function(e){this.updateState(e)},t.prototype.setRoot=function(e){this.root=e,this.state.isExpanded&&this.handleExpand()},t.prototype.getScrollElement=function(){return document.scrollingElement?document.scrollingElement:document.documentElement?document.documentElement:document.body},t.prototype.handleExpand=function(){try{var e=document.getElementsByTagName("body")[0],t=document.getElementsByTagName("head")[0];if(!e||!t||!this.root)return;if(this.state.isExpanded){for(var r=t.children,n=[],i=!1,a=0;a<r.length;a++)r[a]===this.expandedViewport?i=!0:"viewport"===(r[a].name||"").toLowerCase()&&n.push(r[a]);for(var o=0,s=n;o<s.length;o++){var u=s[o];t.removeChild(u)}i||t.appendChild(this.expandedViewport);var c=e.style,l=(m=this.getScrollElement()).scrollLeft,d=m.scrollTop;this.rootState={top:c.top,bottom:c.bottom,right:c.right,left:c.left,scrollTop:d,scrollLeft:l,position:c.position,overflow:c.overflow,viewports:n,zIndex:this.root.style.zIndex,width:c.width,height:c.height,maxWidth:c.maxWidth,maxHeight:c.maxHeight,margin:c.margin,marginLeft:c.marginLeft,marginRight:c.marginRight,marginTop:c.marginTop,marginBottom:c.marginBottom},c.overflow="hidden",c.position="fixed",c.top="0",c.bottom="0",c.right="0",c.left="0",c.width="100%",c.height="100%",c.maxWidth="100%",c.maxHeight="100%",c.margin="0",c.marginLeft="0",c.marginRight="0",c.marginTop="0",c.marginBottom="0"}else{for(r=t.children,a=0;a<r.length;a++)if(r[a]===this.expandedViewport){t.removeChild(this.expandedViewport);break}if(this.rootState){for(var f=this.rootState,h=0,p=f.viewports;h<p.length;h++)u=p[h],t.appendChild(u);var m;(c=e.style).top=f.top,c.bottom=f.bottom,c.left=f.left,c.right=f.right,c.width=f.width,c.height=f.height,c.maxWidth=f.maxWidth,c.maxHeight=f.maxHeight,c.margin=f.margin,c.marginLeft=f.marginLeft,c.marginRight=f.marginRight,c.marginTop=f.marginTop,c.marginBottom=f.marginBottom,c.position=f.position,c.overflow=f.overflow||"",(m=this.getScrollElement()).scrollTop=f.scrollTop,m.scrollLeft=f.scrollLeft,this.rootState=void 0,this.root.style.zIndex=f.zIndex}}}catch(e){var g="Layout change error, you might have to reload the page.";this.context.log.error(g),console.error(g,e)}},t}(M2),Qoe={includeTypes:Ib.MultiSelect(Fg(RN.Names),Ib.objectToOptions(RN.Names)),excludeTypes:Ib.MultiSelect([],Ib.objectToOptions(RN.Names)),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),aromaticBonds:Ib.Boolean(!0,{description:"Display aromatic bonds with dashes"}),multipleBonds:Ib.Select("symmetric",Ib.arrayToOptions(["off","symmetric","offset"]))};Ib.getDefaultValues(Qoe);var Joe=Ac(Ac(Ac({},Fee),Qoe),{adjustCylinderLength:Ib.Boolean(!1,{description:"Shorten cylinders to reduce overlap with spheres. Useful for for transparent bonds. Not working well with aromatic bonds."})});Ib.getDefaultValues(Joe);var ese,tse=Ac(Ac({},Lee),Qoe);function rse(e,t,r){return!RN.is(e,r)||RN.is(t,r)}function nse(e,t,r){var n=t.elements,i=t.bonds,a=i.a,o=i.b,s=i.edgeProps.flags,u=r.ignoreHydrogens,c=r.ignoreHydrogensVariant,l=r.includeTypes,d=r.excludeTypes,f=RN.fromNames(l),h=RN.fromNames(d),p=RN.isAll(f)&&0===h,m=e.child,g=m?.unitMap.get(t.id);if(m&&!g)throw Error("expected childUnit to exist if child exists");if(!p||u||m)return function(r){var i=a[r],l=o[r];return!((!g||PP.has(g.elements,n[i]))&&(p||!rse(f,h,s[r]))&&(!u||!Y9(e,t,n[i],c)&&!Y9(e,t,n[l],c)))}}function ise(e,t){var r=e.interUnitBonds.edges,n=t.ignoreHydrogens,i=t.ignoreHydrogensVariant,a=t.includeTypes,o=t.excludeTypes,s=RN.fromNames(a),u=RN.fromNames(o),c=RN.isAll(s)&&0===u,l=e.child;if(!c||n||l)return function(t){if(l){var a=r[t],o=l.unitMap.get(a.unitA);if(!o)return!0;var d=e.unitMap.get(a.unitA).elements[a.indexA];if(!PP.has(o.elements,d))return!0}if(n){a=r[t];var f=e.unitMap.get(a.unitA),h=e.unitMap.get(a.unitB);if(Y9(e,f,f.elements[a.indexA],i)||Y9(e,h,h.elements[a.indexB],i))return!0}return!(c||!rse(s,u,r[t].props.flag))}}function ase(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i];if(tU.isAtomic(s)){var u=o.target,c=s.bonds.a[a],l=s.bonds.b[a];return C$.Loci(u,[C$.Location(u,s,c,u,s,l),C$.Location(u,s,l,u,s,c)])}}return EQ}function ose(e,t,r,n){var i=!1;if(C$.isLoci(e)){var a=t.structure,o=t.group;if(!yz.areEquivalent(e.structure,a))return!1;var s=o.units[0];if(!tU.isAtomic(s))return!1;for(var u=2*s.bonds.edgeCount,c=0,l=e.bonds;c<l.length;c++){var d=l[c];if(d.aUnit===d.bUnit){var f=o.unitIndexMap.get(d.aUnit.id);if(void 0!==f){var h=s.bonds.getDirectedEdgeIndex(d.aIndex,d.bIndex);-1!==h&&r($T.ofSingleton(f*u+h))&&(i=!0)}}}}else if(Az.is(e)){if(a=t.structure,o=t.group,!yz.areEquivalent(e.structure,a)||(s=o.units[0],!tU.isAtomic(s)))return!1;for(var p=2*s.bonds.edgeCount,m=function(e){var t=o.unitIndexMap.get(e.unit.id);if(void 0!==t){var a=s.bonds,u=a.offset,c=a.b;kP.forEach(e.indices,function(a){for(var o=u[a],s=u[a+1];o<s;o++)n&&!kP.has(e.indices,c[o])||r($T.ofSingleton(t*p+o))&&(i=!0)})}},g=0,v=e.elements;g<v.length;g++)m(v[g])}return i}function sse(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.target,o=t.interUnitBonds.edges[i],s=t.unitMap.get(o.unitA),u=t.unitMap.get(o.unitB);return C$.Loci(a,[C$.Location(a,s,o.indexA,a,u,o.indexB),C$.Location(a,u,o.indexB,a,s,o.indexA)])}return EQ}Ib.getDefaultValues(tse),function(e){e.fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0],i=tU.isAtomic(n)?2*n.bonds.edgeCount:0,a=t.units.length,o=C$.Location(r,void 0,void 0,r,void 0,void 0);return YM(i,a,1,function(e,r){var n=t.units[r];return o.aUnit=n,o.bUnit=n,o.aIndex=n.bonds.a[e],o.bIndex=n.bonds.b[e],o})},e.fromStructure=function(e){var t=e.interUnitBonds.edgeCount,r=C$.Location(e,void 0,void 0,e,void 0,void 0);return YM(t,1,1,function(t){var n=e.interUnitBonds.edges[t];return r.aUnit=e.unitMap.get(n.unitA),r.aIndex=n.indexA,r.bUnit=e.unitMap.get(n.unitB),r.bIndex=n.indexB,r},!0)}}(ese||={});var use=new Map;function cse(e,t,r,n){var i=!1;if(C$.isLoci(e)){if(!yz.areEquivalent(e.structure,t))return!1;for(var a=0,o=e.bonds;a<o.length;a++){var s=o[a],u=t.interUnitBonds.getBondIndexFromLocation(s);-1!==u&&r($T.ofSingleton(u))&&(i=!0)}}else if(Az.is(e)){if(!yz.areEquivalent(e.structure,t)||n&&1===e.elements.length)return!1;for(var c=0,l=e.elements;c<l.length;c++){var d=l[c];use.set(d.unit.id,d.indices)}for(var f=function(e){var a=e.unit;if(!tU.isAtomic(a))return"continue";
139t.interUnitBonds.getConnectedUnits(a.id).forEach(function(o){var s=use.get(o.unitB);n&&!s||kP.forEach(e.indices,function(e){o.connectedIndices.includes(e)&&o.getEdges(e).forEach(function(u){if(!n||s&&kP.has(s,u.indexB)){var c=t.interUnitBonds.getEdgeIndex(e,a.id,u.indexB,o.unitB);r($T.ofSingleton(c))&&(i=!0)}})})})},h=0,p=e.elements;h<p.length;h++)f(d=p[h]);use.clear()}return i}var lse=RN.is;function dse(e,t,r,n){var i,a=e.elements,o=e.bonds,s=o.edgeCount,u=o.a,c=o.b,l=o.edgeProps,d=o.offset,f=l.order,h=l.flags,p=n.sizeFactor,m=n.sizeAspectRatio,g=n.adjustCylinderLength,v=n.aromaticBonds,y=n.includeTypes,b=n.excludeTypes,_=n.multipleBonds,x="off"===_,S="symmetric"===_,w=rse(RN.fromNames(y),RN.fromNames(b),32),A=Cg(),C=Cg(),T=e.conformation.invariantPosition,P=qF.create(t,e),E=C$.Location(t,e,void 0,t,e,void 0),M=t.child;if(n.includeParent&&M){var k=M.unitMap.get(e.id);if(!k)throw Error("expected childUnit to exist");i=function(e){var t=a[u[e]],r=a[c[e]];return PP.has(k.elements,t)&&!PP.has(k.elements,r)}}var I=e.rings,D=I.elementRingIndices,O=I.elementAromaticRingIndices,R=v?e.resonance.delocalizedTriplets:void 0;return{linkCount:2*s,referencePosition:function(e){var t,r,n=u[e],i=c[e],o=R?.getThirdElement(n,i);if(void 0!==o)return T(a[o],A);n>i&&(n=(t=[i,n])[0],i=t[1]),d[n+1]-d[n]==1&&(n=(r=[i,n])[0],i=r[1]);for(var s=O.get(n)||D.get(n),l=0,f=d[n],h=d[n+1];f<h;++f){var p=c[f];if(p!==i&&p!==n){if(!s)return T(a[p],A);var m=O.get(p)||D.get(p);if(!m)continue;var g=Wb(s,m);g>l&&(l=g,T(a[p],A))}}return l>0?A:null},position:function(e,t,n){if(T(a[u[n]],e),T(a[c[n]],t),g){var i=function(e){return P.element=a[u[e]],r.size.size(P)*p}(n),o=function(e){return P.element=a[c[e]],r.size.size(P)*p}(n),s=Math.min(i,o)*m,l=Math.sqrt(Math.max(0,i*i-s*s))-.05,d=Math.sqrt(Math.max(0,o*o-s*s))-.05;if(l<=.01&&d<=.01)return;Cg.normalize(C,Cg.sub(C,t,e)),Cg.scaleAndAdd(e,e,C,l),Cg.scaleAndAdd(t,t,C,-d)}},style:function(e){var t=f[e],r=h[e];if(lse(r,2)||lse(r,4))return 1;if(3===t)return x?0:S?4:5;if(v){var n=u[e],i=c[e],a=O.get(n),o=O.get(i),s=a&&o?Wb(a,o):0;if(lse(r,16)||s&&!w)return 2===s?8:7}return 2!==t||x?0:S?2:3},radius:function(e){return function(e){return E.aIndex=u[e],E.bIndex=c[e],r.size.size(E)*p}(e)*m},ignore:nse(t,e,n),stub:i}}function fse(e,t,r,n,i,a){if(!tU.isAtomic(t)||!t.bonds.edgeCount)return uB.createEmpty(a);var o=r.child,s=o?.unitMap.get(t.id);if(o&&!s)return uB.createEmpty(a);var u=Kee(0,dse(t,r,n,i),i,a),c=u.cylinders,l=u.boundingSphere;if(l)c.setBoundingSphere(l);else if(c.cylinderCount>0){var d=XE.expand(XE(),(s??t).boundary.sphere,1*i.sizeFactor);c.setBoundingSphere(d)}return c}function hse(e,t,r,n,i,a){if(!tU.isAtomic(t)||!t.bonds.edgeCount)return sD.createEmpty(a);var o=r.child,s=o?.unitMap.get(t.id);if(o&&!s)return sD.createEmpty(a);var u=Yee(0,dse(t,r,n,i),i,a),c=u.mesh,l=u.boundingSphere;if(l)c.setBoundingSphere(l);else if(c.triangleCount>0){var d=XE.expand(XE(),(s??t).boundary.sphere,1*i.sizeFactor);c.setBoundingSphere(d)}return c}var pse=Ac(Ac(Ac(Ac({},bee),wee),Joe),{sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:Ib.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:Ib.Boolean(!0),includeParent:Ib.Boolean(!1)});function mse(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return Aee({defaultProps:Ib.getDefaultValues(pse),createGeometry:fse,createLocationIterator:ese.fromGroup,getLoci:ase,eachLocation:ose,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.sizeAspectRatio!==r.sizeAspectRatio||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.linkCap!==r.linkCap||t.aromaticScale!==r.aromaticScale||t.aromaticSpacing!==r.aromaticSpacing||t.aromaticDashCount!==r.aromaticDashCount||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.stubCap!==r.stubCap||!af(t.includeTypes,r.includeTypes)||!af(t.excludeTypes,r.excludeTypes)||t.adjustCylinderLength!==r.adjustCylinderLength||t.aromaticBonds!==r.aromaticBonds||t.multipleBonds!==r.multipleBonds;var s=a.group.units[0],u=o.group.units[0];tU.isAtomic(s)&&tU.isAtomic(u)&&(DF.areEqual(s.bonds,u.bonds)||(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0))},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues(pse),createGeometry:hse,createLocationIterator:ese.fromGroup,getLoci:ase,eachLocation:ose,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.sizeAspectRatio!==r.sizeAspectRatio||t.radialSegments!==r.radialSegments||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkS
139pacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.linkCap!==r.linkCap||t.aromaticScale!==r.aromaticScale||t.aromaticSpacing!==r.aromaticSpacing||t.aromaticDashCount!==r.aromaticDashCount||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.stubCap!==r.stubCap||!af(t.includeTypes,r.includeTypes)||!af(t.excludeTypes,r.excludeTypes)||t.adjustCylinderLength!==r.adjustCylinderLength||t.aromaticBonds!==r.aromaticBonds||t.multipleBonds!==r.multipleBonds;var s=a.group.units[0],u=o.group.units[0];tU.isAtomic(s)&&tU.isAtomic(u)&&(DF.areEqual(s.bonds,u.bonds)||(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0))},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var gse=new C$.ElementBondIterator;function vse(e,t,r,n){for(gse.setElement(t,r,n);gse.hasNext;){var i=gse.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}var yse=Cg();function bse(e,t,r){var n,i=qF.create(e),a=C$.Location(e,void 0,void 0,e,void 0,void 0),o=e.interUnitBonds,s=o.edgeCount,u=o.edges,c=r.sizeFactor,l=r.sizeAspectRatio,d=r.adjustCylinderLength,f=r.aromaticBonds,h=r.multipleBonds,p="off"===h,m="symmetric"===h,g=Cg(),v=e.child;return r.includeParent&&v&&(n=function(t){var r=u[t],n=v.unitMap.get(r.unitA),i=v.unitMap.get(r.unitB),a=e.unitMap.get(r.unitA).elements[r.indexA],o=e.unitMap.get(r.unitB).elements[r.indexB];return n&&PP.has(n.elements,a)&&(!i||!PP.has(i.elements,o))}),{linkCount:s,referencePosition:function(t){var r,n,i,a,o=u[t];if(o.unitA<o.unitB)r=e.unitMap.get(o.unitA),n=e.unitMap.get(o.unitB),i=o.indexA,a=o.indexB;else{if(!(o.unitA>o.unitB))throw Error("same units in createInterUnitBondCylinderMesh");r=e.unitMap.get(o.unitB),n=e.unitMap.get(o.unitA),i=o.indexB,a=o.indexA}return vse(yse,e,r,i)||vse(yse,e,n,a)},position:function(r,n,a){var o=u[a],s=e.unitMap.get(o.unitA),f=e.unitMap.get(o.unitB);if(s.conformation.position(s.elements[o.indexA],r),f.conformation.position(f.elements[o.indexB],n),d){var h=function(r){var n=u[r];return i.unit=e.unitMap.get(n.unitA),i.element=i.unit.elements[n.indexA],t.size.size(i)*c}(a),p=function(r){var n=u[r];return i.unit=e.unitMap.get(n.unitB),i.element=i.unit.elements[n.indexB],t.size.size(i)*c}(a),m=Math.min(h,p)*l,v=Math.sqrt(Math.max(0,h*h-m*m))-.05,y=Math.sqrt(Math.max(0,p*p-m*m))-.05;if(v<=.01&&y<=.01)return;Cg.normalize(g,Cg.sub(g,n,r)),Cg.scaleAndAdd(r,r,g,v),Cg.scaleAndAdd(n,n,g,-y)}},style:function(e){var t=u[e].props.order,r=Sd.create(u[e].props.flag);return RN.is(r,2)||RN.is(r,4)?1:3===t?p?0:m?4:5:f&&RN.is(r,16)?7:2!==t||p?0:m?2:3},radius:function(r){return function(r){var n=u[r];return a.aUnit=e.unitMap.get(n.unitA),a.aIndex=n.indexA,a.bUnit=e.unitMap.get(n.unitB),a.bIndex=n.indexB,t.size.size(a)*c}(r)*l},ignore:ise(e,r),stub:n}}function _se(e,t,r,n,i){if(!t.interUnitBonds.edgeCount)return uB.createEmpty(i);var a=Kee(0,bse(t,r,n),n,i),o=a.cylinders,s=a.boundingSphere;if(s)o.setBoundingSphere(s);else if(o.cylinderCount>0){var u=t.child,c=XE.expand(XE(),(u??t).boundary.sphere,1*n.sizeFactor);o.setBoundingSphere(c)}return o}function xse(e,t,r,n,i){if(!t.interUnitBonds.edgeCount)return sD.createEmpty(i);var a=Yee(0,bse(t,r,n),n,i),o=a.mesh,s=a.boundingSphere;if(s)o.setBoundingSphere(s);else if(o.triangleCount>0){var u=t.child,c=XE.expand(XE(),(u??t).boundary.sphere,1*n.sizeFactor);o.setBoundingSphere(c)}return o}var Sse=Ac(Ac(Ac(Ac({},cee),fee),Joe),{sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:Ib.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:Ib.Boolean(!0),includeParent:Ib.Boolean(!1)});function wse(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return function(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:uB.Utils}),t)}({defaultProps:Ib.getDefaultValues(Sse),createGeometry:_se,createLocationIterator:ese.fromStructure,getLoci:sse,eachLocation:cse,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.sizeAspectRatio!==r.sizeAspectRatio||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkS
139pacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.linkCap!==r.linkCap||t.aromaticScale!==r.aromaticScale||t.aromaticSpacing!==r.aromaticSpacing||t.aromaticDashCount!==r.aromaticDashCount||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.stubCap!==r.stubCap||!af(t.includeTypes,r.includeTypes)||!af(t.excludeTypes,r.excludeTypes)||t.adjustCylinderLength!==r.adjustCylinderLength||t.multipleBonds!==r.multipleBonds,a.interUnitBonds!==o.interUnitBonds&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0)},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return lee({defaultProps:Ib.getDefaultValues(Sse),createGeometry:xse,createLocationIterator:ese.fromStructure,getLoci:sse,eachLocation:cse,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.sizeAspectRatio!==r.sizeAspectRatio||t.radialSegments!==r.radialSegments||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.linkCap!==r.linkCap||t.aromaticScale!==r.aromaticScale||t.aromaticSpacing!==r.aromaticSpacing||t.aromaticDashCount!==r.aromaticDashCount||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.stubCap!==r.stubCap||!af(t.includeTypes,r.includeTypes)||!af(t.excludeTypes,r.excludeTypes)||t.adjustCylinderLength!==r.adjustCylinderLength||t.multipleBonds!==r.multipleBonds,a.interUnitBonds!==o.interUnitBonds&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0)},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var Ase,Cse=iv.add3,Tse=iv.add;!function(e){e.create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=iv.create(Float32Array,3,t,r?r.centerBuffer.ref.value:e),i=iv.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e);return{add:function(e,t,r,a){Cse(n,e,t,r),Tse(i,a)},getSpheres:function(){var e=iv.compact(n,!0),t=iv.compact(i,!0);return xR.create(e,t,n.elementCount,r)}}}}(Ase||={});var Pse,Ese=Cg.add;function Mse(e,t,r){var n=r.ignoreHydrogens,i=r.ignoreHydrogensVariant,a=r.traceOnly,o=tU.isCoarse(t),s=e.child,u=s?.unitMap.get(t.id);if(s&&!u)throw Error("expected childUnit to exist if child exists");if(s||n||a)return function(r){return!!u&&!PP.has(u.elements,r)||!o&&n&&Y9(e,t,r,i
139)||a&&!Z9(t,r)}}function kse(e,t,r,n,i,a){var o=r.child,s=o?.unitMap.get(t.id);if(o&&!s)return sD.createEmpty(a);for(var u=i.detail,c=i.sizeFactor,l=i.stride,d=t.elements,f=d.length,h=f*MD(u),p=dO.createState(h,h/2,a),m=Cg(),g=t.conformation.invariantPosition,v=Mse(r,t,i),y=qF.create(r,t),b=n.size.size,_=Cg(),x=0,S=0,w=0;w<f;w++)if(!(l&&w%l!=0||v&&v(d[w]))){g(d[w],m),Ese(_,_,m),S+=1,y.element=d[w];var A=b(y);A>x&&(x=A),p.currentGroup=w,OD(p,m,A*c,u)}var C,T=a?XE.clone(a.boundingSphere):void 0,P=dO.getMesh(p);return 0===S||(Cg.scale(_,_,1/S),C=T&&Cg.distance(_,T.center)/T.radius<.1?T:XE.expand(XE(),(s??t).boundary.sphere,x*c+.05),P.setBoundingSphere(C)),P}function Ise(e,t,r,n,i,a){var o=r.child,s=o?.unitMap.get(t.id);if(o&&!s)return xR.createEmpty(a);var u=i.sizeFactor,c=i.stride,l=t.elements,d=l.length,f=Ase.create(d,d/2,a),h=Cg(),p=t.conformation.invariantPosition,m=Mse(r,t,i),g=qF.create(r,t),v=n.size.size,y=Cg(),b=0,_=0;if(c&&c>1||m||"uniform"!==n.size.granularity){for(var x=0;x<d;x++)if(!(c&&x%c!=0||m&&m(l[x]))){p(l[x],h),f.add(h[0],h[1],h[2],x),Ese(y,y,h),_+=1,g.element=l[x];var S=v(g);S>b&&(b=S)}}else{for(x=0;x<d;x++)p(l[x],h),f.add(h[0],h[1],h[2],x),Ese(y,y,h);_=d,b=v(g)}var w,A=a?XE.clone(a.boundingSphere):void 0,C=f.getSpheres();return 0===_||(Cg.scale(y,y,1/_),w=A&&Cg.distance(y,A.center)/A.radius<.1?A:XE.expand(XE(),(s??t).boundary.sphere,b*u+.05),C.setBoundingSphere(w)),C}function Dse(e,t,r){var n=!1;if(!Az.is(e))return!1;var i=t.structure,a=t.group;if(!yz.areEquivalent(e.structure,i))return!1;for(var o=a.elements.length,s=a.unitIndexMap,u=0,c=e.elements;u<c.length;u++){var l=c[u],d=s.get(l.unit.id);if(void 0!==d){var f=d*o;if($T.is(l.indices)){var h=f+$T.start(l.indices),p=f+$T.end(l.indices);r($T.ofBounds(h,p))&&(n=!0)}else for(var m=0,g=l.indices.length;m<g;m++){h=l.indices[m];for(var v=m+1;v<g&&l.indices[v]===h;)v++;m=v-1,p=l.indices[m],n=r($T.ofRange(f+h,f+p))||n}}}return n}function Ose(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i],u=kP.ofSingleton(a);return Az(o.target,[{unit:s,indices:u}])}return EQ}function Rse(e,t,r,n,i){for(var a=t.child,o=n.detail,s=n.sizeFactor,u=n.stride,c=t.serialMapping.getSerialIndex,l=t.elementCount*MD(o),d=dO.createState(l,l/2,i),f=r.size.size,h=Cg(),p=0,m=0,g=0,v=t.units;g<v.length;g++){var y=v[g],b=a?.unitMap.get(y.id);if(!a||b)for(var _=y.elements,x=_.length,S=Cg(),w=y.conformation.position,A=Mse(t,y,n),C=qF.create(t,y),T=0;T<x;T++){var P=_[T];if(!(u&&T%u!=0||A&&A(P))){w(P,S),Ese(h,h,S),m+=1,C.element=P;var E=f(C);E>p&&(p=E),d.currentGroup=c(y,P),OD(d,S,E*s,o)}}}var M,k=i?XE.clone(i.boundingSphere):void 0,I=dO.getMesh(d);return 0===m||(Cg.scale(h,h,1/m),M=k&&Cg.distance(h,k.center)/k.radius<1?k:XE.expand(XE(),(a??t).boundary.sphere,p*s+.05),I.setBoundingSphere(M)),I}function Bse(e,t,r,n,i){for(var a=t.child,o=n.sizeFactor,s=n.stride,u=t.serialMapping.getSerialIndex,c=t.elementCount,l=Ase.create(c,c/2,i),d=r.size.size,f=Cg(),h=0,p=0,m=0,g=t.units;m<g.length;m++){var v=g[m],y=a?.unitMap.get(v.id);if(a&&!y)return xR.createEmpty(i);var b=v.elements,_=b.length,x=Cg(),S=v.conformation.position,w=Mse(t,v,n),A=qF.create(t,v);if(s&&s>1||w||"uniform"!==r.size.granularity)for(var C=0;C<_;C++){var T=b[C];if(!(s&&C%s!=0||w&&w(T))){S(T,x),l.add(x[0],x[1],x[2],u(v,T)),Ese(f,f,x),p+=1,A.element=T;var P=d(A);P>h&&(h=P)}}else{for(C=0;C<_;C++)S(T=b[C],x),l.add(x[0],x[1],x[2],u(v,T)),Ese(f,f,x);p+=_,h=d(A)}}var E,M=i?XE.clone(i.boundingSphere):void 0,k=l.getSpheres();return 0===p||(Cg.scale(f,f,1/p),E=M&&Cg.distance(f,M.center)/M.radius<1?M:XE.expand(XE(),(a??t).boundary.sphere,h*o+.05),k.setBoundingSphere(E)),k}function Nse(e,t,r){var n=!1;if(!Az.is(e)||!yz.areEquivalent(e.structure,t))return!1;for(var i=t.serialMapping.cumulativeUnitElementCount,a=0,o=e.elements;a<o.length;a++){var s=o[a],u=t.unitIndexMap.get(s.unit.id);if(void 0!==u)if($T.is(s.indices)){var c=i[u]+$T.start(s.indices),l=i[u]+$T.end(s.indices);r($T.ofBounds(c,l))&&(n=!0)}else for(var d=0,f=s.indices.length;d<f;d++){var h=i[u]+s.indices[d];r($T.ofSingleton(h))&&(n=!0)}}return n}function Fse(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.serialMapping,o=a.unitIndices,s=a.cumulativeUnitElementCount,u=o[i],c=t.units[u],l=i-s[u];return Az(t,[{unit:c,indices:kP.ofSingleton(l)}])}return EQ}!function(e){e.fromGroup=function(e){var t=e.group,r=e.structure,n=t.elements.length,i=t.units.length,a=qF.create(r);return YM(n,i,1,function(e,r){var n=t.units[r];return a.unit=n,a.element=n.elements[e],a})},e.fromStructure=function(e){var t=e.units,r=e.elementCount,n=e.serialMapping,i=n.unitIndices,a=n.elementIndices,o=qF.create(e);return YM(r,1,1,function(e){return o.unit=t[i[e]],o.element=a[e],o},!0)}}(Pse||={});var Lse={sizeFactor:Ib.Numeric(1,{min:0,max:10,step:.1}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),traceOnly:Ib.Boolean(!1),tr
139yUseImpostor:Ib.Boolean(!0),stride:Ib.Numeric(1,{min:1,max:100,step:1})},$se=Ac(Ac(Ac({},bee),xee),Lse);function Use(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth&&n.extensions.textureFloat?function(e){return See({defaultProps:Ib.getDefaultValues($se),createGeometry:Ise,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){e.createGeometry=t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.traceOnly!==r.traceOnly||t.stride!==r.stride},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues($se),createGeometry:kse,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.traceOnly!==r.traceOnly||t.stride!==r.stride},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var jse=Ac(Ac(Ac({},cee),dee),Lse);function zse(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth&&n.extensions.textureFloat?function(e){return function(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:xR.Utils}),t)}({defaultProps:Ib.getDefaultValues(jse),createGeometry:Bse,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){e.createGeometry=t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.traceOnly!==r.traceOnly||t.stride!==r.stride},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return lee({defaultProps:Ib.getDefaultValues(jse),createGeometry:Rse,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.traceOnly!==r.traceOnly||t.stride!==r.stride},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var Gse={"element-sphere":function(e,t){return vee("Element sphere",e,t,Use)},"intra-bond":function(e,t){return vee("Intra-unit bond cylinder",e,t,mse)},"inter-bond":function(e,t){return B9("Inter-unit bond cylinder",e,t,wse)}},Vse=Ac(Ac(Ac(Ac(Ac({},$se),{traceOnly:Ib.Boolean(!1,{isHidden:!0})}),pse),Sse),{includeParent:Ib.Boolean(!1),unitKinds:Q9(["atomic"]),sizeFactor:Ib.Numeric(.15,{min:.01,max:10,step:.01}),sizeAspectRatio:Ib.Numeric(2/3,{min:.01,max:3,step:.01}),visuals:Ib.MultiSelect(["element-sphere","intra-bond","inter-bond"],Ib.objectToOptions(Gse)),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory)}),Hse={name:"ball-and-stick",label:"Ball & Stick",description:"Displays atoms as spheres and bonds as cylinders.",factory:function(e,t){return dJ.createMulti("Ball & Stick",e,t,Iee,Gse)},getParams:function(e,t){if(yz.getSize(t)>=yz.Size.Huge){var r=Ib.clone(Vse);return r.visuals.defaultValue=["element-sphere","intra-bond"],r}return Vse},defaultValues:Ib.getDefaultValues(Vse),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0},getData:function(e,t){return t.includeParent?e.asParent():e},mustRecreate:function(e,t){return e.includeParent!==t.includeParent}};function qse(e,t,r,n,i){var a=t.carbohydrates,o=a.links,s=a.elements,u=n.linkSizeFactor,c=qF.create(t),l=Yee(0,{linkCount:o.length,position:function(e,t,r){var n=o[r];Cg.copy(e,s[n.carbohydrateIndexA].geometry.center),Cg.copy(t,s[n.carbohydrateIndexB].geometry.center)},radius:function(e){var t=s[o[e].carbohydrateIndexA],n=t.unit.rings.all[t.ringIndex];return c.unit=t.unit,c.element=t.unit.elements[n[0]],r.size.size(c)*u}},n,i),d=l.mesh,f=l.boundingSphere;if(f)d.setBoundingSphere(f);else if(d.triangleCount>0){var h=XE.expand(XE(),t.boundary.sphere,1*u);d.setBoundingSphere(h)}return d}var Wse=Ac(Ac(Ac({},bee),Fee),{linkSizeFactor:Ib.Numeric(.3,{min:0,max:3,step:.01})});function Xse(e){return lee({defaultProps:Ib.getDefaultValues(Wse),createGeometry:qse,createLocationIterator:Yse,getLoci:Kse,eachLocation:Qse,setUpdateState:function(e,t,r){e.createGeometry=t.linkSizeFactor!==r.linkSizeFactor||t.radialSegments!==r.radialSegments||t.linkCap!==r.linkCap}},e)}function Yse(e){var t=e.carbohydrates,r=t.elements,n=t.links,i=n.length,a=qF.create(e);return YM(i,1,1,function(e){var t=r[n[e].carbohydrateIndexA],i=t.unit.rings.all[t.ringIndex];return a.unit=t.unit,a.element=t.unit.elements[i[0]],a},!0)}function Kse(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.carbohydrates,o=a.links,s=a.elements,u=o[i],c=s[u.carbohydrateIndexA],l=s[u.carbohydrateIndexB];return Az.union(F9(t,c.unit,c.residueIndex,c.altId),F9(t,l.unit,l.residueIndex,l.altId))}return EQ}var Zse=new Set;function Qse(e,t,r){var n=!1;if(!Az.is(e)||!yz.areEquivalent(e.structure,t))return!1;for(var i=t.carbohydrates.getLinkIndices,a=function(e,t){if(!tU.isAtomic(e))return"continue";Zse.clear(),kP.forEach(t,function(t){for(var a=i(e,e.elements[t]),o=0,s=a.length;o<s;++o)Zse.has(a[o])||(Zse.add(a[o]),r($T.ofSingleton(a[o]))&&(n=!0))})},o=0,s=e.elements;o<s.length;o++){var u=s[o];a(u.unit,u.indices)}return n}var Jse,eue,tue,rue,nue=Cg.create(0,0,-.5),iue=Cg.create(0,0,.5),aue=Cg(),oue=Cg(),sue=Cg(),uue=Cg(),cue={pointCount:5,outerRadius:1,innerRadius:.5,thickness:.3},lue=Cg.zero(),due=Cg.zero(),fue=Cg.zero(),hue=Cg.zero(),pue=Cg.zero(),mue=[.5,0,0,-.5,0,0,0,.5,0,0,-.5,0,0,0,.5,0,0,-.5],gue=Og.identity(),vue=Cg(),yue=Cg(),bue=uR(),_ue=(JO||=sR(!0),JO),xue=(Jse||=function(e){for(var t=e.length/3,r=(3===t?1:4===t?2:t)+t,n=gD(r,4===t?3*t+4:3*r),i=0;i<t;++i){var a=(i+1)%t;Cg.set(aue,e[3*i],e[3*i+1],-.5),Cg.set(oue,e[3*a],e[3*a+1],-.5),n.add(aue,oue,iue)}if(3===t)Cg.set(aue,e[0],e[1],-.5),Cg.set(oue,e[3],e[4],-.5),Cg.set(sue,e[6],e[7],-.5),n.add(sue,oue,aue);else if(4===t)Cg.set(aue,e[0],e[1],-.5),Cg.set(oue,e[3],e[4],-.5),Cg.set(sue,e[6],e[7],-.5),Cg.set(uue,e[9],e[10],-.5),n.addQuad(uue,sue,oue,aue);else for(i=0;i<t;++i)a=(i+1)%t,Cg.set(aue,e[3*i],e[3*i+1],-.5),Cg.set(oue,e[3*a],e[3*a+1],-.5),n.add(nue,oue,aue);return n.getPrimitive()}(BD(8,!0)),Jse),Sue=function(){if(!eue){for(var e=BD(8,!0),t=new Float32Array(30),r=0;r<8;++r)t[3*r]=e[3*r],t[3*r+1]=e[3*r+1],t[3*r+2]=-.5;t[24]=0,t[25]=0,t[26]=-.5,t[27]=0,t[28]=0,t[29]=.5,eue=pD(t,[0,1,8,1,2,8,4,5,8,5,6,8,2,3,9,3,4,9,6,7,9,7,0,9])}return eue}(),wue=function(){for(var e=Ac(Ac({},cue),{outerRadius:1,innerRadius:.5,thickness:.5,pointCount:5}),t=e.outerRadius,r=e.innerRadius,n=e.thickness,i=e.pointCount,a=gD(2*i*2),o=new Float32Array(2*i),s=new Float32Array(2*i),u=0;u<i;++u){var c=2*u,l=2*u+1,d=(c+1)/i*Math.PI,f=(l+1)/i*Math.PI;s[c]=Math.cos(d)*t,s[l]=Math.sin(d)*t,o[c]=Math.cos(f)*r,o[l]=Math.sin(f)*r}for(Cg.set(lue,0,0,n/2),Cg.set(due,0,0,-n/2),u=0;u<i;++u){var h=(u+1)%i;Cg.set(fue,s[2*u],s[2*u+1],0),Cg.set(hue,o[2*u],o[2*u+1],0),Cg.set(pue,s[2*h],s[2*h+1],0),a.add(lue,fue,hue),a.add(hue,fue,due),a.add(lue,hue,pue),a.add(pue,hue,due)}return a.getPrimitive()}(),Aue=(tue||=pD(mue,[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2]),tue),Cue=(rue||=pD(mue,[0,2,4,0,4,3,1,2,5,1,5,3]),rue),Tue=(ND||=XD(BD(4,!1)),ND),Pue=(FD||=XD(BD(5,!1)),FD),Eue=(LD||=XD(BD(6,!1)),LD),Mue=($D||=XD(BD(6,!0)),$D),kue=(UD||=XD(BD(7,!1)),UD);function Iue(e,t,r,n,i){for(var a=dO.createState(256,128,i),o=n.detail,s=n.sizeFactor,u=t.carbohydrates,c=u.elements.length,l=qF.create(t),d=0;d<c;++d){var f=u.elements[d],h=f.unit.rings.all[f.ringIndex],p=pN(f.component.type,h.length);l.unit=f.unit,l.element=f.unit.elements[h[0]];var m=r.size.size(l),g=m*s,v=m*s*1.612,y=f.geometry,b=y.center,_=y.normal,x=y.direction;switch(Cg.add(yue,b,x),Og.targetTo(gue,b,yue,_),Og.setTranslation(gue,b),a.currentGroup=2*d,p){case eN.FilledSphere:OD(a,b,g,o);break;case eN.FilledCube:Og.scaleUniformly(gue,gue,v),dO.addPrimitive(a,gue,bue);break;case eN.CrossedCube:Og.scaleUniformly(gue,gue,v),dO.addPrimitive(a,gue,_ue),Og.mul(gue,gue,Og.rotZ90X180),a.currentGroup+=1,dO.addPrimitive(a,gue,_ue);break;case eN.FilledCone:Og.scaleUniformly(gue,gue,1.2*v),dO.addPrimitive(a,gue,xue);break;case eN.DevidedCone:Og.scaleUniformly(gue,gue,1.2*v),dO.addPrimitive(a,gue,Sue),Og.mul(gue,gue,Og.rotZ90),a.currentGroup+=1,dO.addPrimitive(a,gue,Sue);break;case eN.FlatBox:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,v,v,v/2)),dO.addPrimitive(a,gue,bue);break;case eN.FilledStar:Og.scaleUniformly(gue,gue,v),Og.mul(gue,gue,Og.rotZY90),dO.addPrimitive(a,gue,wue);break;case eN.FilledDiamond:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,1.4*v,1.4*v,1.4*v)),dO.addPrimitive(a,gue,Aue);break;case eN.DividedDiamond:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,1.4*v,1.4*v,1.4*v)),dO.addPrimitive(a,gue,Cue),Og.mul(gue,gue,Og.rotY90),a.currentGroup+=1,dO.addPrimitive(a,gue,Cue);break;case eN.FlatDiamond:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,v,v/2,v/2)),dO.addPrimitive(a,gue,Tue);break;case eN.DiamondPrism:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,v,v,v/2)),dO.addPrimitive(a,gue,Tue);break;case eN.PentagonalPrism:case eN.Pentagon:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,v,v,v/2)),dO.addPrimitive(a,gue,Pue);break;case eN.HexagonalPrism:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,v,v,v/2)),dO.addPrimitive(a,gue,Eue);break;case eN.HeptagonalPrism:Og.mul(gue,gue,Og.rotZY90),Og.scale(gue,gue,Cg.set(vue,v,v,v/2)),dO.addPrimitive(a,gue,kue);break;case eN.FlatHexagon:default:Og.mul(gue,gue,Og.rotZYZ90),Og.scale(gue,gue,Cg.set(vue,v/1.5,v,v/2)),dO.addPrimitive(a,gue,Mue)}}return dO.getMesh(a)}var Due=Ac(Ac({},cee),{detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),sizeFactor:Ib.Numeric(1.75,{min:0,max:10,step:.
13901})});function Oue(e){return lee({defaultProps:Ib.getDefaultValues(Due),createGeometry:Iue,createLocationIterator:Rue,getLoci:Bue,eachLocation:Fue,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail}},e)}function Rue(e){var t=e.carbohydrates.elements,r=2*t.length,n=qF.create(e);return YM(r,1,1,function(e,r){var i=t[Math.floor(e/2)],a=i.unit.rings.all[i.ringIndex];return n.unit=i.unit,n.element=i.unit.elements[a[0]],n},!0,function(e,t){return e%2==1})}function Bue(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.carbohydrates.elements[Math.floor(i/2)];return F9(t,a.unit,a.residueIndex,a.altId)}return EQ}var Nue=new Set;function Fue(e,t,r){var n=t.carbohydrates.getElementIndices,i=!1;if(!Az.is(e)||!yz.areEquivalent(e.structure,t))return!1;for(var a=function(e,t){if(!tU.isAtomic(e))return"continue";Nue.clear(),kP.forEach(t,function(t){for(var a=n(e,e.elements[t]),o=0,s=a.length;o<s;++o)Nue.has(a[o])||(Nue.add(a[o]),r($T.ofSingleton(2*a[o]))&&(i=!0))})},o=0,s=e.elements;o<s.length;o++){var u=s[o];a(u.unit,u.indices)}return i}function Lue(e,t,r,n,i){var a=t.carbohydrates,o=a.terminalLinks,s=a.elements,u=n.terminalLinkSizeFactor,c=qF.create(t),l=Yee(0,{linkCount:o.length,position:function(e,t,r){var n=o[r];n.fromCarbohydrate?(Cg.copy(e,s[n.carbohydrateIndex].geometry.center),n.elementUnit.conformation.position(n.elementUnit.elements[n.elementIndex],t)):(n.elementUnit.conformation.position(n.elementUnit.elements[n.elementIndex],e),Cg.copy(t,s[n.carbohydrateIndex].geometry.center))},radius:function(e){var t=o[e];if(t.fromCarbohydrate){var n=s[t.carbohydrateIndex],i=n.unit.rings.all[n.ringIndex];c.unit=n.unit,c.element=n.unit.elements[i[0]]}else c.unit=t.elementUnit,c.element=t.elementUnit.elements[t.elementIndex];return r.size.size(c)*u},style:function(e){var t=o[e],r=t.elementUnit.elements[t.elementIndex],n=OL(t.elementUnit.model.atomicHierarchy.atoms.type_symbol.value(r));return+!!DL.has(n)}},n,i),d=l.mesh,f=l.boundingSphere;if(f)d.setBoundingSphere(f);else if(d.triangleCount>0){var h=XE.expand(XE(),t.boundary.sphere,1*u);d.setBoundingSphere(h)}return d}var $ue=Ac(Ac(Ac({},bee),Fee),{terminalLinkSizeFactor:Ib.Numeric(.2,{min:0,max:3,step:.01})});function Uue(e){return lee({defaultProps:Ib.getDefaultValues($ue),createGeometry:Lue,createLocationIterator:jue,getLoci:zue,eachLocation:Vue,setUpdateState:function(e,t,r){e.createGeometry=t.terminalLinkSizeFactor!==r.terminalLinkSizeFactor||t.radialSegments!==r.radialSegments||t.linkCap!==r.linkCap}},e)}function jue(e){var t=e.carbohydrates,r=t.elements,n=t.terminalLinks,i=n.length,a=qF.create(e);return YM(i,1,1,function(e){var t=n[e];if(t.fromCarbohydrate){var i=r[t.carbohydrateIndex],o=i.unit.rings.all[i.ringIndex];a.unit=i.unit,a.element=i.unit.elements[o[0]]}else a.unit=t.elementUnit,a.element=t.elementUnit.elements[t.elementIndex];return a},!0)}function zue(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.carbohydrates,o=a.terminalLinks,s=a.elements,u=o[i],c=s[u.carbohydrateIndex];return Az.union(F9(t,c.unit,c.residueIndex,c.altId),function(e,t,r){var n=t.elements,i=t.model,a=i.atomicHierarchy.atoms.label_alt_id.value(r);return-1===kP.indexOf(n,r)?Az(e,[]):F9(e,t,i.atomicHierarchy.residueAtomSegments.index[r],a)}(t,u.elementUnit,u.elementUnit.elements[u.elementIndex]))}return EQ}var Gue=new Set;function Vue(e,t,r){var n=!1;if(!Az.is(e)||!yz.areEquivalent(e.structure,t))return!1;for(var i=t.carbohydrates.getTerminalLinkIndices,a=function(e,t){if(!tU.isAtomic(e))return"continue";Gue.clear(),kP.forEach(t,function(t){for(var a=i(e,e.elements[t]),o=0,s=a.length;o<s;++o)Gue.has(a[o])||(Gue.add(a[o]),r($T.ofSingleton(a[o]))&&(n=!0))})},o=0,s=e.elements;o<s.length;o++){var u=s[o];a(u.unit,u.indices)}return n}var Hue={"carbohydrate-symbol":function(e,t){return B9("Carbohydrate symbol mesh",e,t,Oue)},"carbohydrate-link":function(e,t){return B9("Carbohydrate link cylinder",e,t,Xse)},"carbohydrate-terminal-link":function(e,t){return B9("Carbohydrate terminal link cylinder",e,t,Uue)}},que=Ac(Ac(Ac(Ac({},Due),Wse),$ue),{visuals:Ib.MultiSelect(["carbohydrate-symbol","carbohydrate-link","carbohydrate-terminal-link"],Ib.objectToOptions(Hue)),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory)}),Wue={name:"carbohydrate",label:"Carbohydrate",description:"Displays carbohydrate symbols (3D SNFG).",factory:function(e,t){return dJ.createMulti("Carbohydrate",e,t,Iee,Hue)},getParams:function(e,t){return que},defaultValues:Ib.getDefaultValues(que),defaultColorTheme:{name:"carbohydrate-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.models.some(function(e){return Xz.hasCarbohydrate(e)})}};function Xue(e,t){switch(e.kind){case 0:return function(e,t){for(var r=e.model.atomicRanges.cyclicPolymerMap,n=G$.transientSegments(Gce(e),e.elements),i=fE.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),a=e.model.atomicHierarchy.derived.residue.traceElementIndex,o=e.model.atomicHierarchy.derived.residue.moleculeType,s=-1,u=-1,c=!0,l=-1,d=0;n.hasNext;){for(c=!0,l=d,i.setSegment(n.move());i.hasNext;){if(c){var f=i.move().index;if(++d,!i.hasNext)continue;c=!1,u=f}s=u,u=i.move().index,t(a[s],a[u],d-1,d,o[s]),++d}r.has(u)&&(s=u,u=r.get(s),t(a[s],a[u],d-1,l,o[s]))}}(e,t);case 1:case 2:return function(e,t){for(var r=G$.transientSegments(Gce(e),e.elements),n=e.elements,i=!0,a=0;r.hasNext;){i=!0;for(var o=r.move(),s=o.start,u=o.end;s<u;++s){if(i){if(++a,++s>u)continue;i=!1}t(n[s-1],n[s],a-1,a,0),++a}}}(e,t)}}function Yue(e,t){switch(e.kind){case 0:return function(e,t){for(var r=G$.transientSegments(Gce(e),e.elements),n=fE.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),i=e.model.atomicHierarchy.derived.residue.traceElementIndex,a=0;r.hasNext;)for(n.setSegment(r.move());n.hasNext;)t(i[n.move().index],a),++a}(e,t);case 1:case 2:return function(e,t){for(var r=G$.transientSegments(Gce(e),e.elements),n=e.elements,i=0;r.hasNext;)for(var a=r.move(),o=a.start,s=a.end;o<s;++o)t(n[o],i),++i}(e,t)}}function Kue(e,t){return{centerA:qF.create(e,t),centerB:qF.create(e,t)}}var Zue=function(){function e(e,t){this.unit=t,this.hasNext=!1,this.traceElementIndex=t.model.atomicHierarchy.derived.residue.traceElementIndex,this.gapIt=G$.transientSegments(Vce(t),t.elements),this.value=Kue(e,t),this.hasNext=this.gapIt.hasNext}return e.prototype.move=function(){var e=this.unit,t=e.elements,r=e.residueIndex,n=this.gapIt.move();return this.value.centerA.element=this.traceElementIndex[r[t[n.start]]],this.value.centerB.element=this.traceElementIndex[r[t[n.end-1]]],this.hasNext=this.gapIt.hasNext,this.value},e}(),Que=function(){function e(e,t){this.unit=t,this.hasNext=!1,this.gapIt=G$.transientSegments(Vce(t),t.elements),this.value=Kue(e,t),this.hasNext=this.gapIt.hasNext}return e.prototype.move=function(){var e=this.gapIt.move();return this.value.centerA.element=this.unit.elements[e.start],this.value.centerB.element=this.unit.elements[e.end-1],this.hasNext=this.gapIt.hasNext,this.value},e}();function Jue(e){for(var t=e.atomicConformation,r=t.x,n=t.y,i=t.z,a=e.atomicHierarchy.derived.residue,o=a.polymerType,s=a.traceElementIndex,u=o.length,c=kP.ofBounds(0,e.atomicConformation.atomId.rowCount),l=G$.transientSegments(e.atomicRanges.polymerRanges,c),d=fE.transientSegments(e.atomicHierarchy.residueAtomSegments,c),f=new Float32Array(3*u),h=new Float32Array(3*u),p=0,m=-1,g=-1,v=Cg(),y=Cg(),b=Cg(),_=Cg(),x=Cg(),S=Cg(),w=Cg(),A=Cg(),C=Cg(),T=Cg(),P=Cg(),E=Cg(),M=Cg(),k=Cg();l.hasNext;){var I=l.move();for(d.setSegment(I),p=-1,g=-1;d.hasNext;){p+=1;var D=d.move().index;0===p&&(g=D);var O=3*(m=D-2);Cg.copy(v,y),Cg.copy(y,b),Cg.copy(b,_);var R=s[D];if(Cg.set(_,r[R],n[R],i[R]),!(p<3)){Cg.sub(x,y,v),Cg.sub(S,b,y),Cg.sub(w,_,b),Cg.
139sub(P,x,S),Cg.sub(E,S,w),Cg.cross(M,P,E),Cg.normalize(M,M),Cg.toArray(M,h,O);var B=Math.cos(Cg.angle(P,E)),N=Cg.magnitude(P),F=Cg.magnitude(E),L=Math.sqrt(F*N)/Math.max(2,2*(1-B));Cg.scale(A,P,L/N),Cg.sub(A,y,A),Cg.toArray(A,f,O),Cg.scale(C,E,L/F),Cg.sub(C,b,C),Cg.toArray(C,f,O+3),Cg.copy(k,M)}}var $=3*g;Cg.fromArray(A,f,$+3),Cg.fromArray(C,f,$+6),Cg.normalize(M,Cg.sub(M,A,C));var U=s[g];Cg.set(v,r[U],n[U],i[U]),Cg.copy(T,v),Cg.projectPointOnVector(T,T,M,A),Cg.toArray(T,f,$);var j=m+2,z=3*j;Cg.fromArray(A,f,z-3),Cg.fromArray(C,f,z-6),Cg.normalize(M,Cg.sub(M,A,C));var G=s[j];Cg.set(v,r[G],n[G],i[G]),Cg.copy(T,v),Cg.projectPointOnVector(T,T,M,A),Cg.toArray(T,f,z)}return{centers:f}}var ece=xz.createProvider({label:"Helix Orientation",descriptor:{name:"molstar_helix_orientation"},type:"dynamic",defaultParams:{},getParams:function(){return{}},isApplicable:function(e){return!0},obtain:function(e,t){return Tc(void 0,void 0,void 0,function(){return Pc(this,function(e){return[2,{value:Jue(t)}]})})}});function tce(e){return ON.is(e,2)}function rce(e,t,r){switch(void 0===r&&(r={}),e.kind){case 0:return new uce(e,t,r);case 1:case 2:return new cce(e,t)}}var nce=ON.create(536870912);function ice(e,t){return{center:qF.create(e,t),centerPrev:qF.create(e,t),centerNext:qF.create(e,t),first:!1,last:!1,initial:!1,final:!1,secStrucFirst:!1,secStrucLast:!1,secStrucType:nce,moleculeType:0,coarseBackboneFirst:!1,coarseBackboneLast:!1,isCoarseBackbone:!1,p0:Cg(),p1:Cg(),p2:Cg(),p3:Cg(),p4:Cg(),d12:Cg(),d23:Cg()}}var ace=Cg(),oce=Cg(),sce=Cg(),uce=function(){function e(e,t,r){if(void 0===r&&(r={}),this.unit=e,this.state=0,this.p0=Cg(),this.p1=Cg(),this.p2=Cg(),this.p3=Cg(),this.p4=Cg(),this.p5=Cg(),this.p6=Cg(),this.d01=Cg(),this.d12=Cg(),this.d23=Cg(),this.d34=Cg(),this.hasNext=!1,this.atomicConformation=e.model.atomicConformation,this.residueAtomSegments=e.model.atomicHierarchy.residueAtomSegments,this.polymerRanges=e.model.atomicRanges.polymerRanges,this.traceElementIndex=e.model.atomicHierarchy.derived.residue.traceElementIndex,this.directionFromElementIndex=e.model.atomicHierarchy.derived.residue.directionFromElementIndex,this.directionToElementIndex=e.model.atomicHierarchy.derived.residue.directionToElementIndex,this.moleculeType=e.model.atomicHierarchy.derived.residue.moleculeType,this.cyclicPolymerMap=e.model.atomicRanges.cyclicPolymerMap,this.polymerIt=G$.transientSegments(this.polymerRanges,e.elements),this.residueIt=fE.transientSegments(this.residueAtomSegments,e.elements),this.value=ice(t,e),this.hasNext=this.residueIt.hasNext&&this.polymerIt.hasNext,r.ignoreSecondaryStructure||(this.secondaryStructure=lj.get(t).value?.get(e.invariantId)),r.useHelixOrientation){var n=ece.get(e.model).value;if(!n)throw Error("missing helix-orientation");this.helixOrientationCenters=n.centers}}return e.prototype.atomicPos=function(e,t){-1!==t&&(e[0]=this.atomicConformation.x[t],e[1]=this.atomicConformation.y[t],e[2]=this.atomicConformation.z[t])},e.prototype.pos=function(e,t,r){var n=this.traceElementIndex[t];this.helixOrientationCenters&&tce(r)?Cg.fromArray(e,this.helixOrientationCenters,3*t):this.atomicPos(e,n)},e.prototype.updateResidueSegmentRange=function(e){var t=this.residueAtomSegments.index;this.residueSegmentMin=t[this.polymerRanges[2*e.index]],this.residueSegmentMax=t[this.polymerRanges[2*e.index+1]]},e.prototype.getResidueIndex=function(e){if(e<this.residueSegmentMin)e=void 0===(t=this.cyclicPolymerMap.get(this.residueSegmentMin))?this.residueSegmentMin:t-(this.residueSegmentMin-e-1);else if(e>this.residueSegmentMax){var t;e=void 0===(t=this.cyclicPolymerMap.get(this.residueSegmentMax))?this.residueSegmentMax:t+(e-this.residueSegmentMax-1)}return e},e.prototype.getSecStruc=function(e){if(this.secondaryStructure){var t=this.secondaryStructure,r=t.type[(0,t.getIndex)(e)];return tce(r)?2:r}return nce},e.prototype.setControlPoint=function(e,t,r,n,i){(function(e){return ON.is(e,4)})(i)||this.helixOrientationCenters&&tce(i)?Cg.scale(e,Cg.add(e,t,Cg.add(e,n,Cg.add(e,r,r))),1/4):Cg.copy(e,r)},e.prototype.setFromToVector=function(e,t,r){this.value.isCoarseBackbone||this.helixOrientationCenters&&tce(r)?Cg.set(e,1,0,0):(this.atomicPos(oce,this.directionFromElementIndex[t]),this.atomicPos(sce,this.directionToElementIndex[t]),Cg.sub(e,sce,oce))},e.prototype.setDirection=function(e,t,r,n){Cg.matchDirection(oce,t,r),Cg.matchDirection(sce,n,r),Cg.
139scale(e,Cg.add(e,oce,Cg.add(e,sce,Cg.add(e,r,r))),1/4)},e.prototype.move=function(){var e=this,t=e.residueIt,r=e.polymerIt,n=e.value;if(0===this.state)for(;r.hasNext;)if(this.polymerSegment=r.move(),t.setSegment(this.polymerSegment),this.updateResidueSegmentRange(this.polymerSegment),t.hasNext){this.state=1;var i=this.residueAtomSegments.index[this.unit.elements[this.polymerSegment.start]],a=this.getResidueIndex(i-1);this.currSecStrucType=i===a?nce:this.getSecStruc(a),this.nextSecStrucType=this.getSecStruc(i),this.currCoarseBackbone=-1===this.directionFromElementIndex[a]||-1===this.directionToElementIndex[a],this.nextCoarseBackbone=-1===this.directionFromElementIndex[i]||-1===this.directionToElementIndex[i];break}if(1===this.state){var o=t.move().index,s=this.getResidueIndex(o-3),u=this.getResidueIndex(o-2),c=this.getResidueIndex(o-1),l=this.getResidueIndex(o+1),d=this.getResidueIndex(o+2),f=this.getResidueIndex(o+3);this.prevSecStrucType=this.getSecStruc(c),this.currSecStrucType=this.getSecStruc(o),this.nextSecStrucType=o===l?nce:this.getSecStruc(l),this.prevCoarseBackbone=this.currCoarseBackbone,this.currCoarseBackbone=this.nextCoarseBackbone,this.nextCoarseBackbone=-1===this.directionFromElementIndex[l]||-1===this.directionToElementIndex[l],n.secStrucType=this.currSecStrucType,n.secStrucFirst=this.prevSecStrucType!==this.currSecStrucType,n.secStrucLast=this.currSecStrucType!==this.nextSecStrucType,n.isCoarseBackbone=this.currCoarseBackbone,n.coarseBackboneFirst=this.prevCoarseBackbone!==this.currCoarseBackbone,n.coarseBackboneLast=this.currCoarseBackbone!==this.nextCoarseBackbone,n.first=o===this.residueSegmentMin,n.last=o===this.residueSegmentMax,n.moleculeType=this.moleculeType[o],n.initial=o===c,n.final=o===l,n.centerPrev.element=this.traceElementIndex[c],n.center.element=this.traceElementIndex[o],n.centerNext.element=this.traceElementIndex[l];var h=this.getSecStruc(s),p=this.getSecStruc(u),m=this.getSecStruc(c),g=this.getSecStruc(o),v=this.getSecStruc(l),y=this.getSecStruc(d),b=this.getSecStruc(f);this.pos(this.p0,s,h),this.pos(this.p1,u,p),this.pos(this.p2,c,m),this.pos(this.p3,o,g),this.pos(this.p4,l,v),this.pos(this.p5,d,y),this.pos(this.p6,f,b);var _=tce(h),x=tce(p),S=tce(m),w=tce(g),A=tce(v),C=tce(y),T=tce(b);this.helixOrientationCenters&&(w===S?w===x?w!==_&&(w?Cg.copy(this.p0,this.p1):_&&(Cg.scale(ace,Cg.sub(ace,this.p0,this.p1),2),Cg.add(this.p0,this.p1,ace))):w?(Cg.copy(this.p0,this.p2),Cg.copy(this.p1,this.p2)):x&&(Cg.scale(ace,Cg.sub(ace,this.p1,this.p2),2),Cg.add(this.p1,this.p2,ace),Cg.add(this.p0,this.p1,ace)):w?(Cg.copy(this.p0,this.p3),Cg.copy(this.p1,this.p3),Cg.copy(this.p2,this.p3)):S&&(Cg.scale(ace,Cg.sub(ace,this.p2,this.p3),2),Cg.add(this.p2,this.p3,ace),Cg.add(this.p1,this.p2,ace),Cg.add(this.p0,this.p1,ace)),w===A?w===C?w!==T&&(w?Cg.copy(this.p6,this.p5):T&&(Cg.scale(ace,Cg.sub(ace,this.p6,this.p5),2),Cg.add(this.p6,this.p5,ace))):w?(Cg.copy(this.p5,this.p4),Cg.copy(this.p6,this.p4)):C&&(Cg.scale(ace,Cg.sub(ace,this.p5,this.p4),2),Cg.add(this.p5,this.p4,ace),Cg.add(this.p6,this.p5,ace)):w?(Cg.copy(this.p4,this.p3),Cg.copy(this.p5,this.p3),Cg.copy(this.p6,this.p3)):A&&(Cg.scale(ace,Cg.sub(ace,this.p4,this.p3),2),Cg.add(this.p4,this.p3,ace),Cg.add(this.p5,this.p4,ace),Cg.add(this.p6,this.p5,ace))),this.setFromToVector(this.d01,c,m),this.setFromToVector(this.d12,o,g),this.setFromToVector(this.d23,l,v),this.setFromToVector(this.d34,d,y);var P=w&&this.helixOrientationCenters,E=1.5;o===c||g!==m&&P?(Cg.setMagnitude(ace,Cg.sub(ace,this.p3,this.p4),E),Cg.add(this.p2,this.p3,ace),Cg.add(this.p1,this.p2,ace),Cg.add(this.p0,this.p1,ace)):c===u||g!==p&&P?(Cg.setMagnitude(ace,Cg.sub(ace,this.p2,this.p3),E),Cg.add(this.p1,this.p2,ace),Cg.add(this.p0,this.p1,ace)):(u===s||g!==h&&P)&&(Cg.setMagnitude(ace,Cg.sub(ace,this.p1,this.p2),E),Cg.add(this.p0,this.p1,ace)),o===l||g!==v&&P?(Cg.setMagnitude(ace,Cg.sub(ace,this.p3,this.p2),E),Cg.add(this.p4,this.p3,ace),Cg.add(this.p5,this.p4,ace),Cg.add(this.p6,this.p5,ace)):l===d||g!==y&&P?(Cg.setMagnitude(ace,Cg.sub(ace,this.p4,this.p3),E),Cg.add(this.p5,this.p4,ace),Cg.add(this.p6,this.p5,ace)):(d===f||g!==b&&P)&&(Cg.setMagnitude(ace,Cg.sub(ace,this.p5,this.p4),E),Cg.add(this.p6,this.p5,ace)),this.setControlPoint(n.p0,this.p0,this.p1,this.p2,p),this.setControlPoint(n.p1,this.p1,this.p2,this.p3,m),this.setControlPoint(n.p2,this.p2,this.p3,this.p4,g),this.setControlPoint(n.p3,this.p3,this.p4,this.p5,v),this.setControlPoint(n.p4,this.p4,this.p5,this.p6,y),this.setDirection(n.d12,this.d01,this.d12,this.d23),this.setDirection(n.d23,this.d12,this.d23,this.d34),t.hasNext||(this.state=0)}return this.hasNext=t.hasNext||r.hasNext,this.value},e}(),cce=function(){function e(e,t){switch(this.unit=e,this.state=0,this.hasNext=!1,this.polymerIt=G$.transientSegments(Gce(e),e.elements),this.value=ice(t,e),Cg.set(this.value.d12,1,0,0),Cg.set(this.value.d23,1,0,0),e.kind){case 1:this.conformation=e.model.coarseConformation.spheres;break;case 2:this.conformation=e.model.coarseConformation.gaussians}this.hasNext=this.polymerIt.hasNext}return e.prototype.getElementIndex=function(e){return Math.min(Math.max(this.polymerSegment.start,e),this.polymerSegment.end-1)},e.prototype.pos=function(e,t){var r=this.unit.elements[t];e[0]=this.conformation.x[r],e[1]=this.conformation.y[r],e[2]=this.conformation.z[r]},e.prototype.move=function(){if(0===this.state)for(;this.polymerIt.hasNext;)if(this.polymerSegment=this.polymerIt.move(),this.elementIndex=this.polymerSegment.start,this.elementIndex<this.polymerSegment.end
139){this.state=1;break}if(1===this.state){var e=this.getElementIndex(this.elementIndex-2),t=this.getElementIndex(this.elementIndex-1),r=this.getElementIndex(this.elementIndex+1),n=this.getElementIndex(this.elementIndex+2);this.value.centerPrev.element=this.value.center.unit.elements[t],this.value.center.element=this.value.center.unit.elements[this.elementIndex],this.value.centerNext.element=this.value.center.unit.elements[r],this.pos(this.value.p0,e),this.pos(this.value.p1,t),this.pos(this.value.p2,this.elementIndex),this.pos(this.value.p3,r),this.pos(this.value.p4,n);var i=.5;this.elementIndex===t?(Cg.scale(ace,Cg.sub(ace,this.value.p2,this.value.p3),i),Cg.add(this.value.p1,this.value.p2,ace),Cg.add(this.value.p0,this.value.p1,ace)):t===e&&(Cg.scale(ace,Cg.sub(ace,this.value.p1,this.value.p2),i),Cg.add(this.value.p0,this.value.p1,ace)),this.elementIndex===r?(Cg.scale(ace,Cg.sub(ace,this.value.p2,this.value.p1),i),Cg.add(this.value.p3,this.value.p2,ace),Cg.add(this.value.p4,this.value.p3,ace)):r===n&&(Cg.scale(ace,Cg.sub(ace,this.value.p3,this.value.p2),i),Cg.add(this.value.p4,this.value.p3,ace)),this.value.first=this.elementIndex===this.polymerSegment.start,this.value.last=this.elementIndex===this.polymerSegment.end-1,this.elementIndex+1>=this.polymerSegment.end&&(this.state=0)}return this.hasNext=this.elementIndex+1<this.polymerSegment.end||this.polymerIt.hasNext,this.elementIndex+=1,this.value},e}(),lce=Cg.fromArray,dce=Cg.toArray,fce=Cg.normalize,hce=Cg.sub,pce=Cg.spline,mce=Cg.slerp,gce=Cg.copy,vce=Cg.cross,yce=Cg.orthogonalize,bce=Cg.matchDirection,_ce=Cg.scale,xce=Cg.add;function Sce(e){var t=e+1,r=3*t;return{curvePoints:new Float32Array(r),tangentVectors:new Float32Array(r),normalVectors:new Float32Array(r),binormalVectors:new Float32Array(r),widthValues:new Float32Array(t),heightValues:new Float32Array(t),linearSegments:e}}function wce(e,t,r,n){(function(e,t,r,n){for(var i=e.curvePoints,a=e.tangentVectors,o=e.linearSegments,s=t.p0,u=t.p1,c=t.p2,l=t.p3,d=t.p4,f=1-n,h=t.secStrucFirst?.5:r,p=t.secStrucLast?.5:r,m=0;m<=o;++m){var g=1*m/o;if(g<f){var v=_g(h,r,g);pce(Tce,s,u,c,l,g+n,v),pce(Ace,s,u,c,l,g+n+.01,h),pce(Cce,s,u,c,l,g+n-.01,h)}else v=_g(r,p,g),pce(Tce,u,c,l,d,g-f,v),pce(Ace,u,c,l,d,g-f+.01,v),pce(Cce,u,c,l,d,g-f-.01,v);dce(Tce,i,3*m),fce(Ece,hce(Ece,Ace,Cce)),dce(Ece,a,3*m)}})(e,t,r,n),function(e,t){var r=e.curvePoints,n=e.tangentVectors,i=e.normalVectors,a=e.binormalVectors,o=t.d12,s=t.d23,u=r.length/3;lce(Oce,n,0),lce(Rce,n,3*(u-1)),yce(Bce,Oce,o),yce(Nce,Rce,s),bce(Nce,Nce,Bce),gce(Ice,Bce);for(var c=u-1,l=0;l<u;++l){var d=wg(0,c,l)*c,f=0===l?0:1/(u-d);lce(Ece,n,3*l),yce(Mce,Ece,mce(Pce,Ice,Nce,f)),dce(Mce,i,3*l),gce(Ice,Mce),fce(kce,vce(kce,Ece,Mce)),dce(kce,a,3*l)}for(l=1;l<c;++l)lce(Ice,i,3*(l-1)),lce(Mce,i,3*l),lce(Dce,i,3*(l+1)),_ce(Mce,xce(Mce,Ice,xce(Mce,Dce,Mce)),1/3),dce(Mce,i,3*l),lce(Ece,n,3*l),fce(kce,vce(kce,Ece,Mce)),dce(kce,a,3*l)}(e,t)}var Ace=Cg(),Cce=Cg(),Tce=Cg(),Pce=Cg(),Ece=Cg(),Mce=Cg(),kce=Cg(),Ice=Cg(),Dce=Cg(),Oce=Cg(),Rce=Cg(),Bce=Cg(),Nce=Cg();function Fce(e,t,r,n,i,a,o,s){for(var u=e.widthValues,c=e.heightValues,l=e.linearSegments,d=1-s,f=0;f<=l;++f){var h=1*f/l;h<d?(u[f]=_g(t,r,h+s),c[f]=_g(i,a,h+s)):(u[f]=_g(r,n,h-d),c[f]=_g(a,o,h-d))}}var Lce,$ce,Uce,jce=.5,zce=.3;function Gce(e){switch(e.kind){case 0:return e.model.atomicRanges.polymerRanges;case 1:return e.model.coarseHierarchy.spheres.polymerRanges;case 2:return e.model.coarseHierarchy.gaussians.polymerRanges}}function Vce(e){switch(e.kind){case 0:return e.model.atomicRanges.gapRanges;case 1:return e.model.coarseHierarchy.spheres.gapRanges;case 2:return e.model.coarseHierarchy.gaussians.gapRanges}}function Hce(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i];if(tU.isAtomic(s))return N9(o,s,s.polymerElements[a]);var u=s.elements,c=s.polymerElements[a],l=kP.indexOf(u,c);if(-1!==l)return Az(o,[{unit:s,indices:kP.ofSingleton(l)}])}return EQ}function qce(e,t,r,n,i,a){for(var o=-1,s=-1,u=i;u<=a;u++)if(!((l=r[u])<0)&&(o=kP.indexOf(t,l))>=0){s=u;break}if(o<0)return!1;var c=o;for(u=a;u>s;u--){var l;if(!((l=r[u])<0)){var d=kP.indexOf(t,l);if(d>=0){c=d;break}}}return n($T.ofRange(e+o,e+c))}function Wce(e,t,r,n,i){var a=!1,o=i.unit.elements,s=i.unit.model.atomicHierarchy.derived.residue.traceElementIndex,u=i.unit.model.atomicHierarchy.residueAtomSegments.index,c=r(i.unit);if($T.is(i.indices))a=0===$T.start(i.indices)&&$T.end(i.indices)===i.unit.elements.length?n($T.ofBounds(e,e+t))||a:qce(e,c,s,n,h=u[o[$T.min(i.indices)]],p=u[o[$T.max(i.indices)]])||a;else for(var l=i.indices,d=0,f=l.length;d<f;d++){for(var h,p=h=u[o[l[d]]],m=d+1;m<f;){var g=u[o[l[m]]];if(g-p>1)break;p=g,m++}d=m-1,a=qce(e,c,s,n,h,p)||a}return a}function Xce(e){return e.polymerElements}function Yce(e,t,r){var n=!1;if(!Az.is(e))return!1;var i=t.structure,a=t.group;if(!yz.areEquivalent(e.structure,i))return!1;for(var o=a.units[0].polymerElements.length,s=0,u=e.elements;s<u.length;s++){var c=u[s];if(a.unitIndexMap.has(c.unit.id)){var l=a.unitIndexMap.get(c.unit.id)*o;if(tU.isAtomic(c.unit))n=Wce(l,o,Xce,r,c)||n;else if($T.is(c.indices)){var d=l+$T.start(c.indices),f=l+$T.end(c.indices);n=r($T.ofBounds(d,f))||n}else for(var h=0,p=c.indices.length;h<p;h++){d=c.indices[h];for(var m=h+1;m<p&&c.indices[m]===d;)m++;h=m-1,f=c.indices[h],n=r($T.ofRange(l+d,l+f))||n}}}return n}function Kce(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i],u=kP.indexOf(s.elements,s.gapElements[a]),c=kP.indexOf(s.elements,s.gapElements[a%2?a-1:a+1]);if(-1!==u&&-1!==c)return C$.Loci(o,[C$.Location(o,s,u,o,s,c),C$.Location(o,s,c,o,s,u)])}return EQ}function Zce(e,t,r){var n=!1;if(C$.isLoci(e)){var i=t.structure,a=t.group;if(!yz.areRootsEquivalent(e.structure,i))return!1;e=C$.remapLoci(e,i);for(var o=a.units[0].gapElements.length,s=0,u=e.bonds;s<u.length;s++){var c=u[s],l=a.unitIndexMap.get(c.aUnit.id);if(void 0!==l){var d=kP.indexOf(c.aUnit.gapElements,c.aUnit.elements[c.aIndex]),f=kP.indexOf(c.bUnit.gapElements,c.bUnit.elements[c.bIndex]);-1!==d&&-1!==f&&r($T.ofSingleton(l*o+d))&&(n=!0)}}}else if(Az.is(e)){if(i=t.structure,a=t.group,!yz.areRootsEquivalent(e.structure,i))return!1;e=Az.remap(e,i);for(var h=a.units[0].gapElements.length,p=function(e){var t=a.unitIndexMap.get(e.unit.id);void 0!==t&&kP.forEach(e.indices,function(i){var a=kP.indexOf(e.unit.gapElements,e.unit.elements[i]);
139-1!==a&&r($T.ofSingleton(t*h+a))&&(n=!0)})},m=0,g=e.elements;m<g.length;m++)p(g[m])}return n}function Qce(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i];if(tU.isAtomic(s))return N9(o,s,s.nucleotideElements[a])}return EQ}function Jce(e){return e.nucleotideElements}function ele(e,t,r){var n=!1;if(!Az.is(e))return!1;var i=t.structure,a=t.group;if(!yz.areEquivalent(e.structure,i))return!1;var o=a.units[0];if(!tU.isAtomic(o))return!1;for(var s=o.nucleotideElements.length,u=0,c=e.elements;u<c.length;u++){var l=c[u];if(tU.isAtomic(l.unit)&&a.unitIndexMap.has(l.unit.id)){var d=a.unitIndexMap.get(l.unit.id)*s;tU.isAtomic(l.unit)&&(n=Wce(d,s,Jce,r,l)||n)}}return n}(function(e){e.fromGroup=function(e,t){void 0===t&&(t=!1);var r=e.group,n=e.structure,i=r.units[0].polymerElements,a=i.length,o=r.units.length,s=qF.create(n);return YM(a,o,1,function(e,t){return s.unit=r.units[t],s.element=i[e],s},!1,function(e,r){return t})}})(Lce||={}),function(e){e.fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0].gapElements,i=n.length,a=t.units.length,o=qF.create(r);return YM(i,a,1,function(e,r){return o.unit=t.units[r],o.element=n[e],o})}}($ce||={}),function(e){e.fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0],i=tU.isAtomic(n)?n.nucleotideElements:[],a=i.length,o=t.units.length,s=qF.create(r);return YM(a,o,1,function(e,r){return s.unit=t.units[r],s.element=i[e],s})}}(Uce||={});var tle=Cg(),rle=Cg();function nle(e,t){var r=e.model.atomicHierarchy,n=r.residueAtomSegments,i=r.atoms,a=r.index,o=i.label_comp_id,s=e.conformation.invariantPosition,u=o.value(n.offsets[t]),c=function(e){return aF.has(e.toUpperCase())}(u),l=function(e){return oF.has(e.toUpperCase())}(u);if(!c&&!l){var d=a.findAtomOnResidue(t,"C4"),f=a.findAtomOnResidue(t,"N9");-1!==d&&-1!==f&&Cg.distance(s(d,tle),s(f,rle))<1.6?c=!0:l=!0}return{isPurine:c,isPyrimidine:l}}function ile(e,t,r){var n=t.model.atomicHierarchy.index;return e.trace=t.model.atomicHierarchy.derived.residue.traceElementIndex[r],e.N1=n.findAtomOnResidue(r,"N1"),e.C2=n.findAtomOnResidue(r,"C2"),e.N3=n.findAtomOnResidue(r,"N3"),e.C4=n.findAtomOnResidue(r,"C4"),e.C5=n.findAtomOnResidue(r,"C5"),-1===e.C5&&(e.C5=n.findAtomOnResidue(r,"N5")),e.C6=n.findAtomOnResidue(r,"C6"),e.N7=n.findAtomOnResidue(r,"N7"),-1===e.N7&&(e.N7=n.findAtomOnResidue(r,"C7")),e.C8=n.findAtomOnResidue(r,"C8"),e.N9=n.findAtomOnResidue(r,"N9"),e}function ale(e){return-1!==e.trace&&-1!==e.N1&&-1!==e.C2&&-1!==e.N3&&-1!==e.C4&&-1!==e.C5&&-1!==e.C6&&-1!==e.N7&&-1!==e.C8&&-1!==e.N9}function ole(e,t,r){var n=t.model.atomicHierarchy.index;return e.trace=t.model.atomicHierarchy.derived.residue.traceElementIndex[r],e.N1=n.findAtomOnResidue(r,"N1"),-1===e.N1&&(e.N1=n.findAtomOnResidue(r,"C1")),e.C2=n.findAtomOnResidue(r,"C2"),e.N3=n.findAtomOnResidue(r,"N3"),e.C4=n.findAtomOnResidue(r,"C4"),e.C5=n.findAtomOnResidue(r,"C5"),e.C6=n.findAtomOnResidue(r,"C6"),e}function sle(e){return-1!==e.trace&&-1!==e.N1&&-1!==e.C2&&-1!==e.N3&&-1!==e.C4&&-1!==e.C5&&-1!==e.C6}function ule(e,t,r){var n=t.model.atomicHierarchy.index;return e.trace=t.model.atomicHierarchy.derived.residue.traceElementIndex[r],e.C1_1=n.findAtomOnResidue(r,"C1'"),e.C2_1=n.findAtomOnResidue(r,"C2'"),e.C3_1=n.findAtomOnResidue(r,"C3'"),e.C4_1=n.findAtomOnResidue(r,"C4'"),e.O4_1=n.findAtomOnResidue(r,"O4'"),e}function cle(e){return-1!==e.trace&&-1!==e.C1_1&&-1!==e.C2_1&&-1!==e.C3_1&&-1!==e.C4_1&&-1!==e.O4_1}var lle=Cg(),dle=Cg(),fle=Cg(),hle=Cg(),ple=Cg(),mle=Cg(),gle=Cg(),vle=Cg(),yle=Cg(),ble=Cg(),_le=Og.identity(),xle=Cg(),Sle=uR(),wle={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:Ib.Numeric(1,{min:0,max:2,step:.01}),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo)};function Ale(e,t,r,n,i,a){if(!tU.isAtomic(t))return sD.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.thicknessFactor,c=i.radialSegments,l=o*(Sle.vertices.length/3+2*c),d=dO.createState(l,l/4,a),f=t.elements,h=t.model,p=h.atomicHierarchy,m=p.chainAtomSegments,g=p.residueAtomSegments,v=h.atomicHierarchy.derived.residue.moleculeType,y=t.conformation.invariantPosition,b=fE.transientSegments(m,f),_=fE.transientSegments(g,f),x=1*s,S=u*s*2,w={radiu
139sTop:x,radiusBottom:x,radialSegments:c,bottomCap:!0},A=0;b.hasNext;)for(_.setSegment(b.move());_.hasNext;){var C=_.move().index;if(mF(v[C])){var T={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1},P=-1,E=-1,M=-1,k=-1,I=-1,D=4.5,O=nle(t,C),R=O.isPurine,B=O.isPyrimidine;R?(D=4.5,ile(T,t,C),P=T.N1,E=T.C4,M=T.C6,k=T.C2,I=T.N9):B&&(D=3,ole(T,t,C),P=T.N3,E=T.C6,M=T.C4,k=T.C2,I=T.N1),-1!==I&&-1!==T.trace&&(y(I,ple),y(T.trace,mle),d.currentGroup=A,uO(d,ple,mle,1,w),-1!==P&&-1!==E&&-1!==M&&-1!==k&&(y(P,lle),y(E,dle),y(M,fle),y(k,hle),Cg.normalize(gle,Cg.sub(gle,dle,lle)),Cg.normalize(vle,Cg.sub(vle,hle,fle)),Cg.normalize(yle,Cg.cross(yle,gle,vle)),Og.targetTo(_le,lle,dle,yle),Cg.scaleAndAdd(ble,lle,gle,D/2-.2),Og.scale(_le,_le,Cg.set(xle,4.5,S,D)),Og.setTranslation(_le,ble),dO.addPrimitive(d,_le,Sle))),++A}}var N=dO.getMesh(d),F=XE.expand(XE(),t.boundary.sphere,x);return N.setBoundingSphere(F),N}Ib.getDefaultValues(wle);var Cle=Ac(Ac({},bee),wle);function Tle(e){return _ee({defaultProps:Ib.getDefaultValues(Cle),createGeometry:Ale,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.thicknessFactor!==r.thicknessFactor||t.radialSegments!==r.radialSegments}},e)}var Ple=Cg(),Ele=Cg(),Mle=Cg(),kle=Cg(),Ile=Cg(),Dle=Cg(),Ole=Cg(),Rle=Cg(),Ble=Cg(),Nle=Cg(),Fle=Cg(),Lle={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:Ib.Numeric(1,{min:0,max:2,step:.01}),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo)};Ib.getDefaultValues(Lle);var $le=new Float32Array(54),Ule=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),jle=new Uint32Array([8,12,14,16,6,4,2,0,10]),zle=new Uint32Array([9,11,1,3,5,7,17,15,13]),Gle=new Float32Array(36),Vle=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),Hle=new Uint32Array([0,10,8,6,4,2]),qle=new Uint32Array([1,3,5,7,9,11]),Wle=Cg();function Xle(e,t){for(var r=[...arguments].slice(2),n=0,i=r.length;n<i;++n){var a=r[n];Cg.toArray(Cg.add(Wle,a,t),e,2*n*3),Cg.toArray(Cg.sub(Wle,a,t),e,3*(2*n+1))}}function Yle(e,t,r,n,i,a){if(!tU.isAtomic(t))return sD.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.thicknessFactor,c=i.radialSegments,l=i.detail,d=o*(26+2*c),f=dO.createState(d,d/4,a),h=t.elements,p=t.model,m=p.atomicHierarchy,g=m.chainAtomSegments,v=m.residueAtomSegments,y=p.atomicHierarchy.derived.residue.moleculeType,b=t.conformation.invariantPosition,_=fE.transientSegments(g,h),x=fE.transientSegments(v,h),S=1*s,w=u*s,A={radiusTop:S,radiusBottom:S,radialSegments:c},C=0;_.hasNext;)for(x.setSegment(_.move());x.hasNext;){var T=x.move().index;if(mF(y[T])){var P={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};f.currentGroup=C;var E=nle(t,T),M=E.isPurine,k=E.isPyrimidine;M?(ile(P,t,T),-1!==P.N9&&-1!==P.trace&&(b(P.N9,Nle),b(P.trace,Ple),f.currentGroup=C,uO(f,Nle,Ple,1,A),OD(f,Nle,S,l)),ale(P)&&(b(P.N1,Ele),b(P.C2,Mle),b(P.N3,kle),b(P.C4,Ile),b(P.C5,Dle),b(P.C6,Ole),b(P.N7,Rle),b(P.C8,Ble),Cg.triangleNormal(Fle,Ele,Ile,Dle),Cg.scale(Fle,Fle,w),Xle($le,Fle,Ele,Mle,kle,Ile,Dle,Ole,Rle,Ble,Nle),dO.addTriangleStrip(f,$le,Ule),dO.addTriangleFan(f,$le,jle),dO.addTriangleFan(f,$le,zle))):k&&(ole(P,t,T),-1!==P.N1&&-1!==P.trace&&(b(P.N1,Ele),b(P.trace,Ple),f.currentGroup=C,uO(f,Ele,Ple,1,A),OD(f,Ele,S,l)),sle(P)&&(b(P.C2,Mle),b(P.N3,kle),b(P.C4,Ile),b(P.C5,Dle),b(P.C6,Ole),Cg.triangleNormal(Fle,Ele,Ile,Dle),Cg.scale(Fle,Fle,w),Xle(Gle,Fle,Ele,Mle,kle,Ile,Dle,Ole),dO.addTriangleStrip(f,Gle,Vle),dO.addTriangleFan(f,Gle,Hle),dO.addTriangleFan(f,Gle,qle))),++C}}var I=dO.getMesh(f),D=XE.expand(XE(),t.boundary.sphere,S);return I.setBoundingSphere(D),I}var Kle=Ac(Ac({},bee),Lle);function Zle(e){return _ee({defaultProps:Ib.getDefaultValues(Kle),createGeometry:Yle,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.thicknessFactor!==r.thicknessFactor||t.radialSegments!==r.radialSegments}},e)}var Qle=Cg(),Jle=Cg(),ede=Cg(),tde=Cg(),rde=Cg(),nde=Cg(),ide=Cg(),ade=Cg(),ode=Cg(),sde=Cg(),ude=Cg(),cde=Cg(),lde=Cg(),dde=Cg(),fde=Cg(),hde=Cg(),pde=Cg(),mde={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.
13901}),thicknessFactor:Ib.Numeric(1,{min:0,max:2,step:.01})};Ib.getDefaultValues(mde);var gde=new Float32Array(54),vde=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),yde=new Uint32Array([8,12,14,16,6,4,2,0,10]),bde=new Uint32Array([9,11,1,3,5,7,17,15,13]),_de=new Float32Array(36),xde=new Uint32Array([2,3,4,5,6,7,8,9,10,11,2,3]),Sde=new Uint32Array([0,10,8,6,4,2,10]),wde=new Uint32Array([1,3,5,7,9,11,3]),Ade=new Float32Array(36),Cde=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),Tde=new Uint32Array([0,10,8,6,4,2]),Pde=new Uint32Array([1,3,5,7,9,11]),Ede=Cg();function Mde(e,t){for(var r=[...arguments].slice(2),n=0,i=r.length;n<i;++n){var a=r[n];Cg.toArray(Cg.add(Ede,a,t),e,2*n*3),Cg.toArray(Cg.sub(Ede,a,t),e,3*(2*n+1))}}function kde(e,t,r,n,i,a){if(!tU.isAtomic(t))return sD.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.thicknessFactor,c=25*o,l=dO.createState(c,c/4,a),d=t.elements,f=t.model,h=f.atomicHierarchy,p=h.chainAtomSegments,m=h.residueAtomSegments,g=f.atomicHierarchy.derived.residue.moleculeType,v=t.conformation.invariantPosition,y=fE.transientSegments(p,d),b=fE.transientSegments(m,d),_=s*u,x=0;y.hasNext;)for(b.setSegment(y.move());b.hasNext;){var S=b.move().index;if(mF(g[S])){var w={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};l.currentGroup=x,ule(w,t,S),cle(w)&&(v(w.C1_1,sde),v(w.C2_1,ude),v(w.C3_1,cde),v(w.C4_1,lde),v(w.O4_1,dde),Cg.triangleNormal(hde,cde,lde,sde),Cg.scale(fde,Cg.add(fde,dde,Cg.add(fde,lde,Cg.add(fde,cde,Cg.add(fde,sde,ude)))),.2),Cg.scale(pde,hde,_),Mde(_de,pde,fde,cde,lde,dde,sde,ude),dO.addTriangleStrip(l,_de,xde),dO.addTriangleFanWithNormal(l,_de,Sde,hde),Cg.negate(hde,hde),dO.addTriangleFanWithNormal(l,_de,wde,hde));var A=nle(t,S),C=A.isPurine,T=A.isPyrimidine;C?(ile(w,t,S),ale(w)&&(v(w.N1,Qle),v(w.C2,Jle),v(w.N3,ede),v(w.C4,tde),v(w.C5,rde),v(w.C6,nde),v(w.N7,ide),v(w.C8,ade),v(w.N9,ode),Cg.triangleNormal(hde,Qle,tde,rde),Cg.scale(pde,hde,_),Mde(gde,pde,Qle,Jle,ede,tde,rde,nde,ide,ade,ode),dO.addTriangleStrip(l,gde,vde),dO.addTriangleFanWithNormal(l,gde,yde,hde),Cg.negate(hde,hde),dO.addTriangleFanWithNormal(l,gde,bde,hde))):T&&(ole(w,t,S),sle(w)&&(v(w.N1,Qle),v(w.C2,Jle),v(w.N3,ede),v(w.C4,tde),v(w.C5,rde),v(w.C6,nde),Cg.triangleNormal(hde,Qle,tde,rde),Cg.scale(pde,hde,_),Mde(Ade,pde,Qle,Jle,ede,tde,rde,nde),dO.addTriangleStrip(l,Ade,Cde),dO.addTriangleFanWithNormal(l,Ade,Tde,hde),Cg.negate(hde,hde),dO.addTriangleFanWithNormal(l,Ade,Pde,hde))),++x}}
139var P=dO.getMesh(l),E=XE.expand(XE(),t.boundary.sphere,_);return P.setBoundingSphere(E),P}var Ide=Ac(Ac({},bee),mde);function Dde(e){return _ee({defaultProps:Ib.getDefaultValues(Ide),createGeometry:kde,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.thicknessFactor!==r.thicknessFactor}},e)}var Ode=Cg(),Rde=Cg(),Bde=Cg(),Nde=Cg(),Fde=Cg(),Lde=Cg(),$de=Cg(),Ude=Cg(),jde=Cg(),zde=Cg(),Gde=Cg(),Vde=Cg(),Hde=Cg(),qde=Cg(),Wde=Cg(),Xde=Ac(Ac(Ac({},bee),wee),{sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo),tryUseImpostor:Ib.Boolean(!0)});function Yde(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return Aee({defaultProps:Ib.getDefaultValues(Xde),createGeometry:Kde,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues(Xde),createGeometry:Zde,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}function Kde(e,t,r,n,i,a){if(!tU.isAtomic(t))return uB.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return uB.createEmpty(a);for(var s=15*o,u=Eee.create(s,s/4,a),c=t.elements,l=t.model,d=l.atomicHierarchy,f=d.chainAtomSegments,h=d.residueAtomSegments,p=l.atomicHierarchy.derived.residue.moleculeType,m=t.conformation.invariantPosition,g=fE.transientSegments(f,c),v=fE.transientSegments(h,c),y=0;g.hasNext;)for(v.setSegment(g.move());v.hasNext;){var b=v.move().index;if(mF(p[b])){var _={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};ule(_,t,b),cle(_)&&(m(_.C1_1,Gde),m(_.C2_1,Vde),m(_.C3_1,Hde),m(_.C4_1,qde),m(_.O4_1,Wde),m(_.trace,Ode),u.add(Hde[0],Hde[1],Hde[2],Ode[0],Ode[1],Ode[2],1,!0,!0,y),u.add(Hde[0],Hde[1],Hde[2],qde[0],qde[1],qde[2],1,!0,!0,y),u.add(qde[0],qde[1],qde[2],Wde[0],Wde[1],Wde[2],1,!0,!0,y),u.add(Wde[0],Wde[1],Wde[2],Gde[0],Gde[1],Gde[2],1,!0,!0,y),u.add(Gde[0],Gde[1],Gde[2],Vde[0],Vde[1],Vde[2],1,!0,!0,y),u.add(Vde[0],Vde[1],Vde[2],Hde[0],Hde[1],Hde[2],1,!0,!0,y));var x=nle(t,b),S=x.isPurine,w=x.isPyrimidine;S?(ile(_,t,b),-1!==_.C1_1&&-1!==_.N9?(m(_.C1_1,Gde),m(_.N9,zde),u.add(zde[0],zde[1],zde[2],Gde[0],Gde[1],Gde[2],1,!0,!0,y)):-1!==_.N9&&-1!==_.trace&&(m(_.N9,zde),m(_.trace,Ode),u.add(zde[0],zde[1],zde[2],Ode[0],Ode[1],Ode[2],1,!0,!0,y)),ale(_)&&(m(_.N1,Rde),m(_.C2,Bde),m(_.N3,Nde),m(_.C4,Fde),m(_.C5,Lde),m(_.C6,$de),m(_.N7,Ude),m(_.C8,jde),m(_.N9,zde),u.add(zde[0],zde[1],zde[2],jde[0],jde[1],jde[2],1,!0,!0,y),u.add(jde[0],jde[1],jde[2],Ude[0],Ude[1],Ude[2],1,!0,!0,y),u.add(Ude[0],Ude[1],Ude[2],Lde[0],Lde[1],Lde[2],1,!0,!0,y),u.add(Lde[0],Lde[1],Lde[2],$de[0],$de[1],$de[2],1,!0,!0,y),u.add($de[0],$de[1],$de[2],Rde[0],Rde[1],Rde[2],1,!0,!0,y),u.add(Rde[0],Rde[1],Rde[2],Bde[0],Bde[1],Bde[2],1,!0,!0,y),u.add(Bde[0],Bde[1],Bde[2],Nde[0],Nde[1],Nde[2],1,!0,!0,y),u.add(Nde[0],Nde[1],Nde[2],Fde[0],Fde[1],Fde[2],1,!0,!0,y),u.add(Fde[0],Fde[1],Fde[2],Lde[0],Lde[1],Lde[2],1,!0,!0,y),u.add(Fde[0],Fde[1],Fde[2],zde[0],zde[1],zde[2],1,!0,!0,y))):w&&(ole(_,t,b),-1!==_.C1_1&&-1!==_.N1?(m(_.N1,Rde),m(_.C1_1,Gde),u.add(Rde[0],Rde[1],Rde[2],Gde[0],Gde[1],Gde[2],1,!0,!0,y)):-1!==_.N1&&-1!==_.trace&&(m(_.N1,Rde),m(_.trace,Ode),u.add(Rde[0],Rde[1],Rde[2],Ode[0],Ode[1],Ode[2],1,!0,!0,y)),sle(_)&&(m(_.N1,Rde),m(_.C2,Bde),m(_.N3,Nde),m(_.C4,Fde),m(_.C5,Lde),m(_.C6,$de),u.add(Rde[0],Rde[1],Rde[2],$de[0],$de[1],$de[2],1,!0,!0,y),u.add($de[0],$de[1],$de[2],Lde[0],Lde[1],Lde[2],1,!0,!0,y),u.add(Lde[0],Lde[1],Lde[2],Fde[0],Fde[1],Fde[2],1,!0,!0,y),u.add(Fde[0],Fde[1],Fde[2],Nde[0],Nde[1],Nde[2],1,!0,!0,y),u.add(Nde[0],Nde[1],Nde[2],Bde[0],Bde[1],Bde[2],1,!0,!0,y),u.add(Bde[0],Bde[1],Bde[2],Rde[0],Rde[1],Rde[2],1,!0,!0,y))),++y}}var A=u.getCylinders(),C=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);
139return A.setBoundingSphere(C),A}function Zde(e,t,r,n,i,a){if(!tU.isAtomic(t))return sD.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.radialSegments,c=15*u*o,l=dO.createState(c,c/4,a),d=t.elements,f=t.model,h=f.atomicHierarchy,p=h.chainAtomSegments,m=h.residueAtomSegments,g=f.atomicHierarchy.derived.residue.moleculeType,v=t.conformation.invariantPosition,y=fE.transientSegments(p,d),b=fE.transientSegments(m,d),_={radiusTop:1*s,radiusBottom:1*s,radialSegments:u},x=0;y.hasNext;)for(b.setSegment(y.move());b.hasNext;){var S=b.move().index;if(mF(g[S])){var w={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};l.currentGroup=x,ule(w,t,S),cle(w)&&(v(w.C1_1,Gde),v(w.C2_1,Vde),v(w.C3_1,Hde),v(w.C4_1,qde),v(w.O4_1,Wde),v(w.trace,Ode),uO(l,Hde,Ode,1,_),uO(l,Hde,qde,1,_),uO(l,qde,Wde,1,_),uO(l,Wde,Gde,1,_),uO(l,Gde,Vde,1,_),uO(l,Vde,Hde,1,_));var A=nle(t,S),C=A.isPurine,T=A.isPyrimidine;C?(ile(w,t,S),-1!==w.C1_1&&-1!==w.N9?(v(w.C1_1,Gde),v(w.N9,zde),uO(l,zde,Gde,1,_)):-1!==w.N9&&-1!==w.trace&&(v(w.N9,zde),v(w.trace,Ode),uO(l,zde,Ode,1,_)),ale(w)&&(v(w.N1,Rde),v(w.C2,Bde),v(w.N3,Nde),v(w.C4,Fde),v(w.C5,Lde),v(w.C6,$de),v(w.N7,Ude),v(w.C8,jde),v(w.N9,zde),uO(l,zde,jde,1,_),uO(l,jde,Ude,1,_),uO(l,Ude,Lde,1,_),uO(l,Lde,$de,1,_),uO(l,$de,Rde,1,_),uO(l,Rde,Bde,1,_),uO(l,Bde,Nde,1,_),uO(l,Nde,Fde,1,_),uO(l,Fde,Lde,1,_),uO(l,Fde,zde,1,_))):T&&(ole(w,t,S),-1!==w.C1_1&&-1!==w.N1?(v(w.N1,Rde),v(w.C1_1,Gde),uO(l,Rde,Gde,1,_)):-1!==w.N1&&-1!==w.trace&&(v(w.N1,Rde),v(w.trace,Ode),uO(l,Rde,Ode,1,_)),sle(w)&&(v(w.N1,Rde),v(w.C2,Bde),v(w.N3,Nde),v(w.C4,Fde),v(w.C5,Lde),v(w.C6,$de),uO(l,Rde,$de,1,_),uO(l,$de,Lde,1,_),uO(l,Lde,Fde,1,_),uO(l,Fde,Nde,1,_),uO(l,Nde,Bde,1,_),uO(l,Bde,Rde,1,_))),++x}}
139var P=dO.getMesh(l),E=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return P.setBoundingSphere(E),P}var Qde=Cg(),Jde=Cg(),efe=Cg(),tfe=Cg(),rfe=Cg(),nfe=Cg(),ife=Cg(),afe=Cg(),ofe=Cg(),sfe=Cg(),ufe=Cg(),cfe=Cg(),lfe=Cg(),dfe=Cg(),ffe=Cg(),hfe=Ac(Ac(Ac({},bee),xee),{sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),tryUseImpostor:Ib.Boolean(!0)});function pfe(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return See({defaultProps:Ib.getDefaultValues(hfe),createGeometry:mfe,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues(hfe),createGeometry:gfe,createLocationIterator:Uce.fromGroup,getLoci:Qce,eachLocation:ele,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}function mfe(e,t,r,n,i,a){if(!tU.isAtomic(t))return xR.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return xR.createEmpty(a);for(var s=15*o,u=Ase.create(s,s/4,a),c=t.elements,l=t.model,d=l.atomicHierarchy,f=d.chainAtomSegments,h=d.residueAtomSegments,p=l.atomicHierarchy.derived.residue.moleculeType,m=t.conformation.invariantPosition,g=fE.transientSegments(f,c),v=fE.transientSegments(h,c),y=0;g.hasNext;)for(v.setSegment(g.move());v.hasNext;){var b=v.move().index;if(mF(p[b])){var _={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};ule(_,t,b),cle(_)&&(m(_.C1_1,ufe),m(_.C2_1,cfe),m(_.C3_1,lfe),m(_.C4_1,dfe),m(_.O4_1,ffe),m(_.trace,Qde),u.add(Qde[0],Qde[1],Qde[2],y),u.add(lfe[0],lfe[1],lfe[2],y),u.add(dfe[0],dfe[1],dfe[2],y),u.add(ffe[0],ffe[1],ffe[2],y),u.add(ufe[0],ufe[1],ufe[2],y),u.add(cfe[0],cfe[1],cfe[2],y));var x=nle(t,b),S=x.isPurine,w=x.isPyrimidine;S?(ile(_,t,b),ale(_)&&(m(_.N1,Jde),m(_.C2,efe),m(_.N3,tfe),m(_.C4,rfe),m(_.C5,nfe),m(_.C6,ife),m(_.N7,afe),m(_.C8,ofe),m(_.N9,sfe),u.add(sfe[0],sfe[1],sfe[2],y),u.add(ofe[0],ofe[1],ofe[2],y),u.add(afe[0],afe[1],afe[2],y),u.add(nfe[0],nfe[1],nfe[2],y),u.add(ife[0],ife[1],ife[2],y),u.add(Jde[0],Jde[1],Jde[2],y),u.add(efe[0],efe[1],efe[2],y),u.add(tfe[0],tfe[1],tfe[2],y),u.add(rfe[0],rfe[1],rfe[2],y))):w&&(ole(_,t,b),sle(_)&&(m(_.N1,Jde),m(_.C2,efe),m(_.N3,tfe),m(_.C4,rfe),m(_.C5,nfe),m(_.C6,ife),u.add(Jde[0],Jde[1],Jde[2],y),u.add(ife[0],ife[1],ife[2],y),u.add(nfe[0],nfe[1],nfe[2],y),u.add(rfe[0],rfe[1],rfe[2],y),u.add(tfe[0],tfe[1],tfe[2],y),u.add(efe[0],efe[1],efe[2],y))),++y}}var A=u.getSpheres(),C=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return A.setBoundingSphere(C),A}function gfe(e,t,r,n,i,a){if(!tU.isAtomic(t))return sD.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.detail,c=o*MD(u),l=dO.createState(c,c/2,a),d=t.elements,f=t.model,h=f.atomicHierarchy,p=h.chainAtomSegments,m=h.residueAtomSegments,g=f.atomicHierarchy.derived.residue.moleculeType,v=t.conformation.invariantPosition,y=fE.transientSegments(p,d),b=fE.transientSegments(m,d),_=1*s,x=0;y.hasNext;)for(b.setSegment(y.move());b.hasNext;){var S=b.move().index;if(mF(g[S])){var w={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};l.currentGroup=x,ule(w,t,S),cle(w)&&(v(w.C1_1,ufe),v(w.C2_1,cfe),v(w.C3_1,lfe),v(w.C4_1,dfe),v(w.O4_1,ffe),v(w.trace,Qde),OD(l,Qde,_,u),OD(l,dfe,_,u),OD(l,ffe,_,u),OD(l,ufe,_,u),OD(l,cfe,_,u),OD(l,lfe,_,u));var A=nle(t,S),C=A.isPurine,T=A.isPyrimidine;C?(ile(w,t,S),ale(w)&&(v(w.N1,Jde),v(w.C2,efe),v(w.N3,tfe),v(w.C4,rfe),v(w.C5,nfe),v(w.C6,ife),v(w.N7,afe),v(w.C8,ofe),v(w.N9,sfe),OD(l,ofe,_,u),OD(l,afe,_,u),OD(l,nfe,_,u),OD(l,ife,_,u),OD(l,Jde,_,u),OD(l,efe,_,u),OD(l,tfe,_,u),OD(l,rfe,_,u),OD(l,nfe,_,u),OD(l,sfe,_,u))):T&&(ole(w,t,S),sle(w)&&(v(w.N1,Jde),v(w.C2,efe),v(w.N3,tfe),v(w.C4,rfe),v(w.C5,nfe),v(w.C6,ife),OD(l,ife,_,u),OD(l,nfe,_,u),OD(l,rfe,_,u),OD(l,tfe,_,u),OD(l,efe,_,u),OD(l,Jde,_,u))),++x}}
139var P=dO.getMesh(l),E=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return P.setBoundingSphere(E),P}var vfe,yfe=Cg.zero(),bfe=Cg.zero(),_fe=Cg.zero(),xfe=Cg.zero(),Sfe=BD(3,!1),wfe=Og.identity(),Afe=Cg.zero(),Cfe=Cg.zero(),Tfe=Cg.zero(),Pfe=Cg.zero(),Efe=(vfe||=function(){for(var e=gD(8),t=0;t<3;++t){var r=(t+1)%3;Cg.set(yfe,Sfe[3*t],Sfe[3*t+1],-.5),Cg.set(bfe,Sfe[3*r],Sfe[3*r+1],-.5),Cg.set(_fe,Sfe[3*r],Sfe[3*r+1],.5),Cg.set(xfe,Sfe[3*t],Sfe[3*t+1],.5),e.add(yfe,bfe,_fe),e.add(_fe,xfe,yfe)}return Cg.set(yfe,Sfe[0],Sfe[1],-.5),Cg.set(bfe,Sfe[3],Sfe[4],-.5),Cg.set(_fe,Sfe[6],Sfe[7],-.5),e.add(_fe,bfe,yfe),Cg.set(yfe,Sfe[0],Sfe[1],.5),Cg.set(bfe,Sfe[3],Sfe[4],.5),Cg.set(_fe,Sfe[6],Sfe[7],.5),e.add(yfe,bfe,_fe),e.getPrimitive()}(),vfe),Mfe={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01})};function kfe(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=24*o,c=dO.createState(u,u/10,a),l=Sce(1),d=l.normalVectors,f=l.binormalVectors,h=0,p=rce(t,r);p.hasNext;){var m=p.move();c.currentGroup=h;var g=mF(m.moleculeType),v=ON.is(m.secStrucType,4);if(wce(l,m,g||v?.5:.9,g?.3:.5),v&&!m.secStrucLast||!v){var y=n.size.size(m.center)*s,b=4*y,_=4*y,x=6*y,S=g?f:d;Cg.fromArray(Cfe,S,0),Cg.fromArray(Tfe,S,3),Cg.normalize(Pfe,Cg.add(Pfe,Cfe,Tfe)),Og.targetTo(wfe,m.p3,m.p1,Pfe),Og.mul(wfe,wfe,Og.rotY90Z180),Og.scale(wfe,wfe,Cg.set(Afe,x,_,b)),Og.setTranslation(wfe,m.p2),dO.addPrimitive(c,wfe,Efe)}++h}var w=dO.getMesh(c),A=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return w.setBoundingSphere(A),w}Ib.getDefaultValues(Mfe);var Ife=Ac(Ac({},bee),Mfe);function Dfe(e){return _ee({defaultProps:Ib.getDefaultValues(Ife),createGeometry:kfe,createLocationIterator:Lce.fromGroup,getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor}},e)}var Ofe={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo)};function Rfe(e,t,r,n,i,a){var o=t.gapElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.radialSegments,c=10*u*2*o*2,l=dO.createState(c,c/10,a),d=t.conformation.invariantPosition,f=Cg.zero(),h=Cg.zero(),p={radiusTop:1,radiusBottom:1,topCap:!0,bottomCap:!0,radialSegments:u},m=0,g=function(e,t){switch(t.kind){case 0:return new Zue(e,t);case 1:case 2:return new Que(e,t)}}(r,t);g.hasNext;){var v=g.move(),y=v.centerA,b=v.centerB;y.element===b.element||(d(y.element,f),d(b.element,h),p.radiusTop=p.radiusBottom=n.size.size(y)*s,l.currentGroup=m,lO(l,f,h,.5,10,!1,p),p.radiusTop=p.radiusBottom=n.size.size(b)*s,l.currentGroup=m+1,lO(l,h,f,.5,10,!1,p)),m+=2}var _=dO.getMesh(l),x=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return _.setBoundingSphere(x),_}Ib.getDefaultValues(Ofe);var Bfe=Ac(Ac({},bee),Ofe);function Nfe(e){return _ee({defaultProps:Ib.getDefaultValues(Bfe),createGeometry:Rfe,createLocationIterator:$ce.fromGroup,getLoci:Kce,eachLocation:Zce,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments}},e)}var Ffe=Cg(),Lfe=Cg(),$fe=Cg(),Ufe=Cg(),jfe=Cg(),zfe=Cg(),Gfe=Cg(),Vfe=Cg(),Hfe=Cg(),qfe=Cg(),Wfe=Cg(),Xfe=Cg(),Yfe=Cg(),Kfe=Cg(),Zfe=Cg(),Qfe=Cg.fromArray,Jfe=Cg.scale,ehe=Cg.add,the=Cg.sub,rhe=Cg.magnitude,nhe=Cg.negate,ihe=Cg.copy,ahe=Cg.cross,ohe=Cg.set,she=iv.add3,uhe=iv.add;function che(e,t,r,n,i,a,o,s,u){var c=t.vertices,l=t.normals,d=t.indices,f=c.elementCount;if(Qfe(Ffe,n,e),Jfe(Gfe,Ffe,o),Jfe(zfe,Ffe,s),Qfe(Lfe,i,e),Jfe(Ufe,Lfe,a),ahe(qfe,Lfe,Ffe),Qfe(Hfe,r,e),ehe(Xfe,ehe(Xfe,Hfe,Ufe),zfe),the(Yfe,ehe(Yfe,Hfe,Ufe),Gfe),the(Kfe,the(Kfe,Hfe,Ufe),Gfe),ehe(Zfe,the(Zfe,Hfe,Ufe),zfe),o<s?(she(c,Zfe[0],Zfe[1],Zfe[2]),she(c,Kfe[0],Kfe[1],Kfe[2]),she(c,Yfe[0],Yfe[1],Yfe[2]),she(c,Xfe[0],Xfe[1],Xfe[2]),ihe(jfe,zfe)):(she(c,Xfe[0],Xfe[1],Xfe[2]),she(c,Yfe[0],Yfe[1],Yfe[2]),she(c,Kfe[0],Kfe[1],Kfe[2]),she(c,Zfe[0],Zfe[1],Zfe[2]),ihe(jfe,Gfe)),u){for(var h=0;h<4;++h)she(l,-qfe[0],-qfe[1],-qfe[2]);she(d,f,f+1,f+2),she(d,f+2,f+3,f)}else{for(h=0;h<4;++h)she(l,qfe[0],qfe[1],qfe[2]);she(d,f+2,f+1,f),she(d,f,f+3,f+2)}}function lhe(e,t,r,n,i,a,o,s,u,c){var l=e.currentGroup,d=e.vertices,f=e.normals,h=e.indices,p=e.groups,m=d.elementCount,g=0;s>0?(Qfe(Ffe,t,0),Qfe(Lfe,t,3*i),g=s/rhe(the($fe,Lfe,Ffe))):ohe(Vfe,0,0,0);for(var v=0;v<=i;++v){var y=a[v],b=o[v],_=0===s?b:s*(1-v/i),x=3*v;Qfe(jfe,r,x),Jfe(jfe,jfe,_),Qfe(Ufe,n,x),Jfe(Ufe,Ufe,y),s>0&&(Qfe(Ffe,r,x),Qfe(Lfe,n,x),Jfe(Vfe,ahe(Vfe,Ffe,Lfe),g)),Qfe(Hfe,t,x),Qfe(qfe,r,x),Qfe(Wfe,n,x),ehe(Ffe,ehe(Ffe,Hfe,Ufe),jfe),ehe(Lfe,qfe,Vfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),ehe(Ffe,the(Ffe,Hfe,Ufe),jfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),nhe(Lfe,Wfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),the(Ffe,the(Ffe,Hfe,Ufe),jfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),ehe(Lfe,nhe(Lfe,qfe),Vfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),the(Ffe,ehe(Ffe,Hfe,Ufe),jfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),ihe(Lfe,Wfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2]),ehe(Ffe,ehe(Ffe,Hfe,Ufe),jfe),she(d,Ffe[0],Ffe[1],Ffe[2]),she(f,Lfe[0],Lfe[1],Lfe[2])}for(v=0;v<i;++v){for(var S=0;S<2;S++)she(h,m+8*v+2*S,m+8*(v+1)+2*S+1,m+8*v+2*S+1),she(h,m+8*v+2*S,m+8*(v+1)+2*S,m+8*(v+1)+2*S+1);for(S=2;S<4;S++)she(h,m+8*v+2*S,m+8*(v+1)+2*S,m+8*v+2*S+1),she(h,m+8*(v+1)+2*S,m+8*(v+1)+2*S+1,m+8*v+2*S+1)}if(u){y=a[0],b=o[0];var w=0===s?b:s;che(0,e,t,r,n,y,w,w,!1)}else s>0&&(che(0,e,t,r,n,y=a[0],s,-(b=o[0]),!1),che(0,e,t,r,n,y,-s,b,!1));c&&0===s&&che(3*i,e,t,r,n,y=a[i],b=o[i],b,!0),v=0;for(var A=8*(i+1)+(u?4:s>0?8:0)+(c&&0===s?4:0);v<A;++v)uhe(p,l)}var dhe=Cg(),fhe=Cg(),hhe=Cg(),phe=Cg(),mhe=Cg();function ghe(e,t,r,n,i){e[0]=t[0]*n+r[0]*i,e[1]=t[1]*n+r[1]*i,e[2]=t[2]*n+r[2]*i}function vhe(e,t,r,n,i,a){e[0]=t[0]*i+r[0]*a+n[0],e[1]=t[1]*i+r[1]*a+n[1],e[2]=t[2]*i+r[2]*a+n[2]}var yhe=Cg.fromArray,bhe=Cg.normalize,_he=Cg.scaleAndAdd,xhe=Cg.cross,She=Cg.dot,whe=Cg.unitX,Ahe=iv.add3,Che=new Map;function The(e,t,r,n,i,a,o,s,u,c,l){for(var d=e.currentGroup,f=e.vertices,h=e.normals,p=e.indices,m=e.groups,g=f.elementCount,v=function(e,t){var r=+!!t,n=Ev(e,r);if(!Che.has(n)){for(var i=[],a=[],o=0;o<e;++o){var s=(2*o+r)/e*Math.PI;i[o]=Math.cos(s),a[o]=Math.sin(s)}Che.set(n,{cos:i,sin:a})}return Che.get(n)}(a,"rounded"===l),y=v.cos,b=v.sin,_=Math.round(a/4),x=3*_,S=0;S<=i;++S){var w=3*S;yhe(phe,r,w),yhe(mhe,n,w),yhe(hhe,t,w);for(var A=o[S],C=s[S],T="rounded"===l&&C>A,P=0;P<a;
139++P)T?(vhe(fhe,phe,mhe,hhe,A*y[P],A*b[P]),_he(fhe,fhe,phe,She(mhe,whe)<0?P<_||P>=x?C-A:-C+A:P>=_&&P<x?-C+A:C-A),P===_||P===_-1?ghe(dhe,phe,mhe,0,1):P===x||P===x-1?ghe(dhe,phe,mhe,0,-1):ghe(dhe,phe,mhe,y[P],b[P])):(vhe(fhe,phe,mhe,hhe,C*y[P],A*b[P]),ghe(dhe,phe,mhe,A*y[P],C*b[P])),bhe(dhe,dhe),Ahe(f,fhe[0],fhe[1],fhe[2]),Ahe(h,dhe[0],dhe[1],dhe[2])}var E=Math.round(a/2);for(S=0;S<i;++S){for(P=0;P<E;++P)Ahe(p,g+S*a+(P+1)%a,g+(S+1)*a+(P+1)%a,g+S*a+P),Ahe(p,g+(S+1)*a+(P+1)%a,g+(S+1)*a+P,g+S*a+P);for(P=E;P<a;++P)Ahe(p,g+S*a+(P+1)%a,g+(S+1)*a+P,g+S*a+P),Ahe(p,g+(S+1)*a+(P+1)%a,g+(S+1)*a+P,g+S*a+(P+1)%a)}if(u){var M=0,k=f.elementCount;for(yhe(phe,r,M),yhe(mhe,n,M),yhe(hhe,t,M),xhe(dhe,mhe,phe),Ahe(f,hhe[0],hhe[1],hhe[2]),Ahe(h,dhe[0],dhe[1],dhe[2]),A=o[0],C=s[0],(T="rounded"===l&&C>A)&&(C-=A),g=f.elementCount,S=0;S<a;++S)T?(vhe(fhe,phe,mhe,hhe,A*y[S],A*b[S]),_he(fhe,fhe,phe,S<_||S>=x?C:-C)):vhe(fhe,phe,mhe,hhe,C*y[S],A*b[S]),Ahe(f,fhe[0],fhe[1],fhe[2]),Ahe(h,dhe[0],dhe[1],dhe[2]),Ahe(p,g+(S+1)%a,g+S,k)}if(c)for(M=3*i,k=f.elementCount,yhe(phe,r,M),yhe(mhe,n,M),yhe(hhe,t,M),xhe(dhe,phe,mhe),Ahe(f,hhe[0],hhe[1],hhe[2]),Ahe(h,dhe[0],dhe[1],dhe[2]),A=o[i],C=s[i],(T="rounded"===l&&C>A)&&(C-=A),g=f.elementCount,S=0;S<a;
139++S)T?(vhe(fhe,phe,mhe,hhe,A*y[S],A*b[S]),_he(fhe,fhe,phe,S<_||S>=x?C:-C)):vhe(fhe,phe,mhe,hhe,C*y[S],A*b[S]),Ahe(f,fhe[0],fhe[1],fhe[2]),Ahe(h,dhe[0],dhe[1],dhe[2]),Ahe(p,g+S,g+(S+1)%a,k);var I=(i+1)*a+(u?a+1:0)+(c?a+1:0);iv.addRepeat(m,I,d)}var Phe=Cg.fromArray,Ehe=Cg.magnitude,Mhe=Cg.sub,khe=Cg.add,Ihe=Cg.scale,Dhe=Cg.negate,Ohe=Cg.copy,Rhe=Cg.cross,Bhe=iv.add3,Nhe=iv.add,Fhe=Cg(),Lhe=Cg(),$he=Cg(),Uhe=Cg(),jhe=Cg(),zhe=Cg(),Ghe=Cg(),Vhe=Cg(),Hhe=Cg();function qhe(e,t,r,n,i,a,o,s){var u=e.currentGroup,c=e.vertices,l=e.normals,d=e.indices,f=e.groups,h=c.elementCount,p=0;s>0&&(Phe(Fhe,t,0),Phe(Lhe,t,3*i),p=s/Ehe(Mhe($he,Lhe,Fhe)));for(var m=0;m<=i;++m){var g=a[m],v=o[m],y=0===s?v:s*(1-m/i),b=3*m;Phe(jhe,r,b),Ihe(jhe,jhe,y),Phe(Uhe,n,b),Ihe(Uhe,Uhe,g),s>0&&(Phe(Fhe,r,b),Phe(Lhe,n,b),Ihe(zhe,Rhe(zhe,Fhe,Lhe),p)),Phe(Ghe,t,b),Phe(Vhe,r,b),Phe(Hhe,n,b),khe(Fhe,Ghe,jhe),Dhe(Lhe,Hhe),Bhe(c,Fhe[0],Fhe[1],Fhe[2]),Bhe(l,Lhe[0],Lhe[1],Lhe[2]),Mhe(Fhe,Ghe,jhe),Bhe(c,Fhe[0],Fhe[1],Fhe[2]),Bhe(l,Lhe[0],Lhe[1],Lhe[2]),khe(Fhe,Ghe,jhe),Ohe(Lhe,Hhe),Bhe(c,Fhe[0],Fhe[1],Fhe[2]),Bhe(l,Lhe[0],Lhe[1],Lhe[2]),Mhe(Fhe,Ghe,jhe),Bhe(c,Fhe[0],Fhe[1],Fhe[2]),Bhe(l,Lhe[0],Lhe[1],Lhe[2])}for(m=0;m<i;++m)Bhe(d,h+4*m,h+4*(m+1)+1,h+4*m+1),Bhe(d,h+4*m,h+4*(m+1),h+4*(m+1)+1),Bhe(d,h+4*m+2+1,h+4*(m+1)+2+1,h+4*m+2),Bhe(d,h+4*m+2,h+4*(m+1)+2+1,h+4*(m+1)+2);m=0;for(var _=4*(i+1);m<_;++m)Nhe(f,u)}var Whe={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),aspectRatio:Ib.Numeric(5,{min:.1,max:10,step:.1}),arrowFactor:Ib.Numeric(1.5,{min:0,max:3,step:.1},{description:"Size factor for sheet arrows"}),tubularHelices:Ib.Boolean(!1,{description:"Draw alpha helices as tubes"}),helixProfile:Ib.Select("elliptical",Ib.arrayToOptions(["elliptical","rounded","square"]),{description:"Protein helix trace profile"}),nucleicProfile:Ib.Select("square",Ib.arrayToOptions(["elliptical","rounded","square"]),{description:"Nucleic strand trace profile"}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),linearSegments:Ib.Numeric(8,{min:1,max:48,step:1},qI.CustomQualityParamInfo),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo)};Ib.getDefaultValues(Whe);var Xhe=Cg();function Yhe(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.detail,c=i.linearSegments,l=i.radialSegments,d=i.aspectRatio,f=i.arrowFactor,h=i.tubularHelices,p=i.helixProfile,m=i.nucleicProfile,g=c*l*o+(l+1)*o*2,v=dO.createState(g,g/10,a),y=tU.isCoarse(t),b=Sce(c),_=b.curvePoints,x=b.normalVectors,S=b.binormalVectors,w=b.widthValues,A=b.heightValues,C=0,T=rce(t,r,{ignoreSecondaryStructure:!1,useHelixOrientation:h});T.hasNext;){var P=T.move();v.currentGroup=C;var E=mF(P.moleculeType),M=ON.is(P.secStrucType,4),k=ON.is(P.secStrucType,2),I=E?zce:jce;wce(b,P,k&&!h?.9:.5,I);var D=n.size.size(P.centerPrev)*s,O=n.size.size(P.center)*s,R=n.size.size(P.centerNext)*s;y&&(D*=d/2,O*=d/2,R*=d/2);var B=P.secStrucFirst||P.coarseBackboneFirst||P.first,N=P.secStrucLast||P.coarseBackboneLast||P.last,F=c;if(P.initial){var L=c-(F=Math.max(Math.round(c*I),1));_.copyWithin(0,3*L),S.copyWithin(0,3*L),x.copyWithin(0,3*L),Cg.fromArray(Xhe,_,3),Cg.normalize(Xhe,Cg.sub(Xhe,P.p2,Xhe)),Cg.scaleAndAdd(Xhe,P.p2,Xhe,2*O),Cg.toArray(Xhe,_,0)}else P.final&&(F=Math.max(Math.round(c*(1-I)),1),Cg.fromArray(Xhe,_,3*F-3),Cg.normalize(Xhe,Cg.sub(Xhe,P.p2,Xhe)),Cg.scaleAndAdd(Xhe,P.p2,Xhe,2*O),Cg.toArray(Xhe,_,3*F));if(!0===P.initial&&!0===P.final)OD(v,P.p2,2*O,u);else if(M){var $=D*d,U=O*d,j=R*d,z=P.secStrucLast?U*f:0;Fce(b,D,O,R,$,U,j,I),2===l?qhe(v,_,x,S,F,w,A,z):lhe(v,_,x,S,F,w,A,z,B,N)}else{$=void 0,U=void 0,j=void 0,k&&!P.isCoarseBackbone?h?($=D*=1.5*d,U=O*=1.5*d,j=R*=1.5*d):($=D*d,U=O*d,j=R*d):E&&!P.isCoarseBackbone?($=D*d,U=O*d,j=R*d):($=D,U=O,j=R),Fce(b,D,O,R,$,U,j,I);var G=E&&!P.isCoarseBackbone?[S,x]:[x,S],V=G[0],H=G[1];if(E&&!P.isCoarseBackbone)for(var q=0,W=V.length;q<W;q++)V[q]*=-1;var X=E?m:p;2===l?E&&!P.isCoarseBackbone?qhe(v,_,V,H,F,A,w,0):qhe(v,_,V,H,F,w,A,0):4===l?lhe(v,_,V,H,F,w,A,0,B,N):U===O?The(v,_,V,H,F,l,w,A,B,N,"elliptical"):"square"===X?lhe(v,_,V,H,F,w,A,0,B,N):The(v,_,V,H,F,l,w,A,B,N,X)}++C}
139var Y=dO.getMesh(v),K=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return Y.setBoundingSphere(K),Y}var Khe=Ac(Ac({},bee),Whe);function Zhe(e){return _ee({defaultProps:Ib.getDefaultValues(Khe),createGeometry:Yhe,createLocationIterator:function(e){return Lce.fromGroup(e,!0)},getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.tubularHelices!==r.tubularHelices||t.detail!==r.detail||t.linearSegments!==r.linearSegments||t.radialSegments!==r.radialSegments||t.aspectRatio!==r.aspectRatio||t.arrowFactor!==r.arrowFactor||t.helixProfile!==r.helixProfile||t.nucleicProfile!==r.nucleicProfile;var s=lj.get(a.structure).version;e.info.secondaryStructureHash!==s&&(void 0!==e.info.secondaryStructureHash&&(e.createGeometry=!0),e.info.secondaryStructureHash=s)}},e)}var Qhe={"polymer-trace":function(e,t){return vee("Polymer trace mesh",e,t,Zhe)},"polymer-gap":function(e,t){return vee("Polymer gap cylinder",e,t,Nfe)},"nucleotide-block":function(e,t){return vee("Nucleotide block mesh",e,t,Tle)},"nucleotide-ring":function(e,t){return vee("Nucleotide ring mesh",e,t,Zle)},"nucleotide-atomic-ring-fill":function(e,t){return vee("Nucleotide atomic ring fill",e,t,Dde)},"nucleotide-atomic-bond":function(e,t){return vee("Nucleotide atomic bond",e,t,Yde)},"nucleotide-atomic-element":function(e,t){return vee("Nucleotide atomic element",e,t,pfe)},"direction-wedge":function(e,t){return vee("Polymer direction wedge",e,t,Dfe)}},Jhe=Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac(Ac({},Khe),Bfe),Cle),Kle),Xde),hfe),Ide),Ife),{sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),visuals:Ib.MultiSelect(["polymer-trace","polymer-gap","nucleotide-ring","nucleotide-atomic-ring-fill","nucleotide-atomic-bond","nucleotide-atomic-element"],Ib.objectToOptions(Qhe)),bumpFrequency:Ib.Numeric(2,{min:0,max:10,step:.1},qI.ShadingCategory)}),epe={name:"cartoon",label:"Cartoon",description:"Displays ribbons, planks, tubes smoothly following the trace atoms of polymers.",factory:function(e,t){return dJ.createMulti("Cartoon",e,t,Iee,Qhe)},getParams:function(e,t){var r=Ib.clone(Jhe),n=!1,i=!1;return t.units.forEach(function(e){!n&&tU.isAtomic(e)&&e.nucleotideElements.length&&(n=!0),!i&&e.gapElements.length&&(i=!0)}),r.visuals.defaultValue=["polymer-trace"],n&&r.visuals.defaultValue.push("nucleotide-ring"),i&&r.visuals.defaultValue.push("polymer-gap"),r},defaultValues:Ib.getDefaultValues(Jhe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.polymerResidueCount>0},ensureCustomProperties:{attach:function(e,t){return Tc(void 0,void 0,void 0,function(){var r,n,i;return Pc(this,function(a){switch(a.label){case 0:return[4,lj.attach(e,t,void 0,!0)];case 1:a.sent(),r=0,n=t.models,a.label=2;case 2:return r<n.length?(i=n[r],[4,ece.attach(e,i,void 0,!0)]):[3,5];case 3:a.sent(),a.label=4;case 4:return r++,[3,2];case 5:return[2]}})})},detach:function(e){lj.ref(e,!1);for(var t=0,r=e.models;t<r.length;t++){var n=r[t];ece.ref(n,!1)}}}},tpe=Ac(Ac({},bee),{sizeFactor:Ib.Numeric(1,{min:0,max:10,step:.1}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),ignoreHydrogens:Ib.Boolean(!1)});function rpe(e){return _ee({defaultProps:Ib.getDefaultValues(tpe),createGeometry:npe,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.ignoreHydrogens!==r.ignoreHydrogens}},e)}function npe(e,t,r,n,i,a){var o=r.child,s=o?.unitMap.get(t.id);if(o&&!s)return sD.createEmpty(a);var u=i.detail,c=i.sizeFactor,l=i.ignoreHydrogens,d=t.elements,f=t.model,h=t.model.atomicHierarchy.derived.atom.atomicNumber,p=d.length,m=p*MD(u),g=dO.createState(m,m/2,a),v=Vz.Provider.get(f);if(!v)return sD.createEmpty(a);var y=Cg(),b=Rg(),_=Cg(),x=Cg(),S=Cg(),w=v.elementToAnsiotrop,A=v.data,C=A.U,T=A._schema.U.space,P=t.conformation.invariantPosition,E=qF.create(r);E.unit=t;for(var M=0;M<p;M++){var k=d[M],I=w[k];if(-1!==I&&!(s&&!PP.has(s.elements,k)||l&&K9(h,k))){E.element=k,P(k,y),g.currentGroup=M,Tg.toMat3(b,T,C.value(I)),Rg.symmtricFromLower(b,b),Rg.symmetricEigenvalues(_,b),Rg.eigenvector(x,b,_[1]),Rg.eigenvector(S,b,_[2]);for(var D=0;D<3;++D)_[D]=1.5958*c*Math.sqrt(Math.abs(_[D]));yg(_[0],_[1],vg)&&yg(_[1],_[2],vg)?OD(g,y,_[0],u):L0(g,y,S,x,_,u)}}
139var O=dO.getMesh(g),R=XE.expand(XE(),(s||t).boundary.sphere,1*c);return O.setBoundingSphere(R),O}var ipe={"ellipsoid-mesh":function(e,t){return vee("Ellipsoid Mesh",e,t,rpe)},"intra-bond":function(e,t){return vee("Intra-unit bond cylinder",e,t,mse)},"inter-bond":function(e,t){return B9("Inter-unit bond cylinder",e,t,wse)}},ape=Ac(Ac(Ac(Ac({},tpe),pse),Sse),{includeParent:Ib.Boolean(!1),adjustCylinderLength:Ib.Boolean(!1,{isHidden:!0}),unitKinds:Q9(["atomic"]),sizeFactor:Ib.Numeric(1,{min:.01,max:10,step:.01}),sizeAspectRatio:Ib.Numeric(.1,{min:.01,max:3,step:.01}),linkCap:Ib.Boolean(!0),visuals:Ib.MultiSelect(["ellipsoid-mesh","intra-bond","inter-bond"],Ib.objectToOptions(ipe)),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory)}),ope={name:"ellipsoid",label:"Ellipsoid",description:"Displays anisotropic displacement ellipsoids of atomic elements plus bonds as cylinders.",factory:function(e,t){return dJ.createMulti("Ellipsoid",e,t,Iee,ipe)},getParams:function(e,t){return ape},defaultValues:Ib.getDefaultValues(ape),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0&&e.models.some(function(e){return Vz.Provider.isApplicable(e)}
139)},getData:function(e,t){return t.includeParent?e.asParent():e},mustRecreate:function(e,t){return e.includeParent!==t.includeParent}},spe={drawCount:MR("number"),instanceCount:MR("number"),aRadius:AR("float32",1,0),aPosition:AR("float32",3,0),aGroup:AR("float32",1,0),uCurrentSlice:CR("f"),uCurrentX:CR("f"),uCurrentY:CR("f"),uBboxMin:CR("v3","material"),uBboxSize:CR("v3","material"),uGridDim:CR("v3","material"),uGridTexDim:CR("v3","material"),uGridTexScale:CR("v2","material"),uAlpha:CR("f","material"),uResolution:CR("f","material"),uRadiusFactorInv:CR("f","material"),tMinDistanceTex:TR("texture","rgba","float","nearest","material"),dGridTexType:ER("string",["2d","3d"]),dCalcType:ER("string",["density","minDistance","groupId"])},upe="gaussian-density";function cpe(e){return e.namedFramebuffers[upe]||(e.namedFramebuffers[upe]=e.resources.framebuffer()),e.namedFramebuffers[upe]}function lpe(e,t,r,n,i,a){var o=`${upe}-${e}`;return t.namedTextures[o]||(t.namedTextures[o]=t.resources.texture(r,n,i,a)),t.namedTextures[o]}function dpe(e,t,r,n,i,a){return e.isWebGL2?function(e,t,r,n,i,a){return hpe(function(e,t,r,n,i,a){var o=e.gl,s=e.resources,u=e.state,c=e.extensions,l=c.colorBufferFloat,d=c.textureFloat,f=c.colorBufferHalfFloat,h=c.textureHalfFloat,p=i.smoothness,m=i.resolution,g=mpe(t,r,n,i),v=g.drawCount,y=g.positions,b=g.radii,_=g.groups,x=g.scale,S=g.expandedBox,w=g.dim,A=g.maxRadius,C=w[0],T=w[1],P=w[2],E=lpe("min-dist-3d",e,"volume-uint8","rgba","ubyte","nearest");E.define(C,T,P);var M=Bg.create(1,1),k=2*A,I=gpe(e,v,y,b,_,E,S,w,w,M,p,m,k),D=I.values.uCurrentSlice,O=cpe(e);function R(e,t){u.currentRenderItemId=-1;for(var r=0;r<P;++r)tf.update(D,r),e.attachFramebuffer(O,0,r),t&&o.clear(o.COLOR_BUFFER_BIT),I.render();o.flush()}return O.bind(),vpe(e),u.viewport(0,0,C,T),u.scissor(0,0,C,T),a||=f&&h?s.texture("volume-float16","rgba","fp16","linear"):l&&d?s.texture("volume-float32","rgba","float","linear"):s.texture("volume-uint8","rgba","ubyte","linear"),a.define(C,T,P),bpe(e,I),R(a,!0),ype(e,I),R(E,!0),_pe(e,I),R(a,!1),{texture:a,scale:x,bbox:S,gridDim:w,gridTexDim:w,gridTexScale:M,radiusFactor:k,resolution:m,maxRadius:A}}(e,t,r,n,i,a))}(e,t,r,n,i,a):fpe(e,t,r,n,!1,i,a)}function fpe(e,t,r,n,i,a,o){return hpe(function(e,t,r,n,i,a,o){var s=e.gl,u=e.resources,c=e.state,l=e.extensions,d=l.colorBufferFloat,f=l.textureFloat,h=l.colorBufferHalfFloat,p=l.textureHalfFloat,m=l.blendMinMax,g=a.smoothness,v=a.resolution,y=mpe(t,r,n,a),b=y.drawCount,_=y.positions,x=y.radii,S=y.groups,w=y.scale,A=y.expandedBox,C=y.dim,T=y.maxRadius,P=C[0],E=C[1],M=C[2],k=function(e){var t=e[0]*e[1]*e[2],r=2**Math.ceil(Math.log(Math.sqrt(t))/Math.log(2)),n=0,i=e[1],a=1,o=e[2];return r<e[0]*e[2]?(o=Math.floor(r/e[0]),a=Math.ceil(e[2]/o),n=o*e[0],i*=a):n=e[0]*e[2],{texDimX:n,texDimY:i,texRows:a,texCols:o,powerOfTwoSize:i<r?r:2*r}}(C),I=k.texDimX,D=k.texDimY,O=k.texCols,R=k.powerOfTwoSize,B=Cg.create(I,D,0),N=Bg.create(I/R,D/R),F=2*T,L=i?R:I,$=i?R:D,U=lpe("min-dist-2d",e,"image-uint8","rgba","ubyte","nearest");U.define(L,$);var j=gpe(e,b,_,x,S,U,A,C,B,N,g,v,F),z=j.values,G=z.uCurrentSlice,V=z.uCurrentX,H=z.uCurrentY,q=cpe(e);function W(e,t){c.currentRenderItemId=-1,e.attachFramebuffer(q,0),t&&(c.viewport(0,0,L,$),c.scissor(0,0,L,$),s.clear(s.COLOR_BUFFER_BIT)),tf.update(H,0);for(var r=0,n=0,i=0,a=0;a<M;++a)r>=O&&(r-=O,n+=E,i=0,tf.update(H,n)),tf.update(V,i),tf.update(G,a),c.viewport(i,n,P,E),c.scissor(i,n,P,E),j.render(),++r,i+=P;s.flush()}return q.bind(),vpe(e),o||=h&&p?u.texture("image-float16","rgba","fp16","linear"):d&&f?u.texture("image-float32","rgba","float","linear"):u.texture("image-uint8","rgba","ubyte","linear"),o.define(L,$),bpe(e,j),W(o,!0),m&&(ype(e,j),W(U,!0),_pe(e,j),W(o,!1)),{texture:o,scale:w,bbox:A,gridDim:C,gridTexDim:B,gridTexScale:N,radiusFactor:F,resolution:v,maxRadius:T}}(e,t,r,n,i,a,o))}function hpe(e){var t=e.texture,r=e.scale,n=e.bbox,i=e.gridDim,a=e.gridTexDim,o=e.gridTexScale,s=e.radiusFactor,u=e.resolution,c=e.maxRadius;return{transform:ppe(r,n),texture:t,bbox:n,gridDim:i,gridTexDim:a,gridTexScale:o,radiusFactor:s,resolution:u,maxRadius:c}}function ppe(e,t){var r=Og.identity();return Og.fromScaling(r,e),Og.setTranslation(r,t.min),r}function mpe(e,t,r,n){for(var i=n.resolution,a=n.radiusOffset,o=1/i,s=e.indices,u=e.x,c=e.y,l=e.z,d=e.id,f=kP.size(s),h=new Float32Array(3*f),p=new Float32Array(f),m=new Float32Array(f),g=0,v=0;v<f;++v){var y=kP.getAt(s,v);h[3*v]=u[y],h[3*v+1]=c[y],h[3*v+2]=l[y];var b=r(y)+a;g<b&&(g=b),p[v]=b,m[v]=d?d[v]:v}var _=2*g+4*i,x=YE.expand(YE(),t,Cg.create(_,_,_)),S=YE.scale(YE(),x,o),w=YE.size(Cg(),S);return Cg.ceil(w,w),{drawCount:f,positions:h,radii:p,groups:m,scale:Cg.create(i,i,i),expandedBox:x,dim:w,maxRadius:g}}function gpe(e,t,r,n,i,a,o,s,u,c,l,d,f){if(e.namedComputeRenderables[upe]){var h=Cg.sub(Cg(),o.max,o.min),p=e.namedComputeRenderables[upe].values;tf.updateIfChanged(p.drawCount,t),tf.updateIfChanged(p.instanceCount,1),tf.update(p.aRadius,n),tf.update(p.aPosition,r),tf.update(p.aGroup,i),tf.updateIfChanged(p.uCurrentSlice,0),tf.updateIfChanged(p.uCurrentX,0),tf.updateIfChanged(p.uCurrentY,0),tf.update(p.uBboxMin,o.min),tf.update(p.uBboxSize,h),tf.update(p.uGridDim,s),tf.update(p.uGridTexDim,u),tf.update(p.uGridTexScale,c),tf.updateIfChanged(p.uAlpha,l),tf.updateIfChanged(p.uResolution,d),tf.updateIfChanged(p.uRadiusFactorInv,1/f),tf.update(p.tMinDistanceTex,a),tf.updateIfChanged(p.dGridTexType,a.getDepth()>0?"3d":"2d"),tf.updateIfChanged(p.dCalcType,"density"),e.namedComputeRenderables[upe].update()}else e.namedComputeRenderables[upe]=function(e,t,r,n,i,a,o,s,u,c,l,d,f){var h=Cg.sub(Cg(),o.max,o.min),p={drawCount:tf.create(t),instanceCount:tf.create(1),aRadius:tf.create(n),aPosition:tf.create(r),aGroup:tf.create(i),uCurrentSlice:tf.create(0),uCurrentX:tf.create(0),uCurrentY:tf.create(0),uBboxMin:tf.create(o.min),uBboxSize:tf.create(h),uGridDim:tf.create(s),uGridTexDim:tf.create(u),uGridTexScale:tf.create(c),uAlpha:tf.create(l),uResolution:tf.create(d),uRadiusFactorInv:tf.create(1/f),tMinDistanceTex:tf.create(a),dGridTexType:tf.create(a.getDepth()>0?"3d":"2d"),dCalcType:tf.create("density")},m=Ac({},spe);return eB(KR(e,"points",fk(upe,"\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute float aRadius;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n\n#if defined(dCalcType_groupId)\n    attribute float aGroup;\n    varying float vGroup;\n#endif\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n    vRadiusSqInv = 1.0 / (aRadius * aRadius);\n    #if defined(dCalcType_groupId)\n        vGroup = aGroup;\n    #endif\n    gl_PointSize = ceil(((aRadius * 3.0) / uResolution) + uResolution);\n    vPosition = (aPosition - uBboxMin) / uResolution;\n    gl_Position = vec4(((aPosition - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n}\n","\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n    #if defined(dGridTexType_2d)\n        precision highp sampler2D;\n        uniform sampler2D tMinDistanceTex;\n        uniform vec3 uGridTexDim;\n    #elif defined(dGridTexType_3d)\n        precision highp sampler3D;\n        uniform sampler3D tMinDistanceTex;\n    #endif\n    varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n    vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n    vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n    float dist = distance(fragPos, vPosition) * uResolution;\n\n    #if defined(dCalcType_density)\n        float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n        gl_FragColor.a = density * uRadiusFactorInv;\n    #elif defined(dCalcType_minDistance)\n        gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n    #elif defined(dCalcType_groupId)\n        #if defined(dGridTexType_2d)\n            float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n        #elif defined(dGridTexType_3d)\n            float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n        #endif\n        if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n            discard;\n        gl_FragColor.rgb = packIntToRGB(vGroup);\n    #endif\n}\n"),m,p),p)}(e,t,r,n,i,a,o,s,u,c,l,d,f);return e.namedComputeRenderables[upe]}function vpe(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.enable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.clearColor(0,0,0,0)}function ype(e,t){var r=e.gl,n=e.state;
139if(tf.update(t.values.dCalcType,"minDistance"),t.update(),n.colorMask(!1,!1,!1,!0),n.blendFunc(r.ONE,r.ONE),!e.extensions.blendMinMax)throw Error("GPU gaussian surface calculation requires EXT_blend_minmax");n.blendEquation(e.extensions.blendMinMax.MAX)}function bpe(e,t){var r=e.gl,n=e.state;tf.update(t.values.dCalcType,"density"),t.update(),n.colorMask(!1,!1,!1,!0),n.blendFunc(r.ONE,r.ONE),n.blendEquation(r.FUNC_ADD)}function _pe(e,t){var r=e.gl,n=e.state;tf.update(t.values.dCalcType,"groupId"),t.update(),n.colorMask(!0,!0,!0,!1),n.blendFunc(r.ONE,r.ZERO),n.blendEquation(r.FUNC_ADD)}var xpe=new ArrayBuffer(4),Spe=new Int32Array(xpe),wpe=new Float32Array(xpe);function Ape(e){return function(e){return Spe[0]=(1<<23)*((e<-126?-126:e)+126.94269504),wpe[0]}(1.44269504*e)}function Cpe(e,t,r,n,i){return Tc(this,void 0,void 0,function(){function a(){return Tc(this,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<m?(function(e,t){for(var r=e;r<t;++r)for(var n=kP.getAt(l,r),i=d[n],a=f[n],o=h[n],s=g[r],u=1/(s*s),m=2*s,v=m*m,y=Math.ceil(m*c),b=Math.floor(c*(i-S[0])),_=Math.floor(c*(a-S[1])),x=Math.floor(c*(o-S[2])),w=Math.max(0,b-y),A=Math.max(0,_-y),C=Math.max(0,x-y),P=Math.min(k,b+y+2),M=Math.min(I,_+y+2),U=Math.min(D,x+y+2),j=w;j<P;++j)for(var z=B[j]-i,G=j*R,V=A;V<M;++V)for(var H=N[V]-a,q=z*z+H*H,W=V*O+G,X=C;X<U;++X){var Y=F[X]-o,K=q+Y*Y;if(K<=v){var Z=Ape(K*u*-$),Q=X+W;T[Q]+=Z,Z>L[Q]&&(L[Q]=Z,E[Q]=p?p[r]:r)}}}(t,Math.min(t+U,m)),e.shouldUpdate?[4,e.update({message:"filling density grid",current:t,max:m})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t+=U,[3,1];case 4:return[2]}})})}var o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B,N,F,L,$,U,j;return Pc(this,function(e){switch(e.label){case 0:for(o=i.resolution,s=i.radiusOffset,u=i.smoothness,c=1/o,l=t.indices,d=t.x,f=t.y,h=t.z,p=t.id,m=kP.size(l),g=new Float32Array(m),v=0,y=0;y<m;++y)b=n(kP.getAt(l,y))+s,v<b&&(v=b),g[y]=b;return _=2*v+o,x=YE.expand(YE(),r,Cg.create(_,_,_)),S=x.min,w=YE.scale(YE(),x,c),A=YE.size(Cg(),w),Cg.ceil(A,A),C=Tg.Space(A,[0,1,2],Float32Array),T=C.create(),P=Tg.create(C,T),(E=C.create()).fill(-1),M=Tg.create(C,E),k=A[0],I=A[1],D=A[2],R=(O=D)*I,B=TE(A[0],S[0],o),N=TE(A[1],S[1],o),F=TE(A[2],S[2],o),L=C.create(),$=u,U=Math.ceil(1e5/((v**3)**3*c)),[4,a()];case 1:return e.sent(),j=Og.identity(),Og.fromScaling(j,Cg.create(o,o,o)),Og.setTranslation(j,x.min),[2,{field:P,idField:M,transform:j,radiusFactor:1,resolution:o,maxRadius:v}]}})})}var Tpe=Ac({resolution:Ib.Numeric(1,{min:.1,max:20,step:.1},Ac({description:"Grid resolution/cell spacing."},qI.CustomQualityParamInfo)),radiusOffset:Ib.Numeric(0,{min:0,max:10,step:.1},{description:"Extra/offset radius added to the atoms/coarse elements for gaussian calculation. Useful to create coarse, low resolution surfaces."}),smoothness:Ib.Numeric(1.5,{min:.5,max:2.5,step:.1},{description:"Smoothness of the gausian surface, lower is smoother."})},G9);function Ppe(e,t){var r=e.maxTextureSize/3;return r*r/Math.max(1,t?t.units.length/16:1)}function Epe(e,t,r,n){var i=this,a=q9(e,t,r,n),o=a.position,s=a.boundary,u=a.radius,c=z9(s.box,n);return vy.create("Gaussian Density",function(e){return Tc(i,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,Cpe(e,o,s.box,u,c)];case 1:return[2,t.sent()]}})})})}function Mpe(e,t,r,n,i,a){var o=this,s=q9(e,t,r,n),u=s.position,c=s.boundary,l=s.radius,d=z9(c.box,n,Ppe(i,e));return vy.create("Gaussian Density",function(e){return Tc(o,void 0,void 0,function(){return Pc(this,function(e){return[2,dpe(i,u,c.box,l,d,a)]})})})}function kpe(e,t,r,n,i,a,o){var s=this,u=q9(e,t,r,i),c=u.position,l=u.boundary,d=u.radius,f=z9(l.box,i,Ppe(a,e));return vy.create("Gaussian Density",function(e){return Tc(s,void 0,void 0,function(){return Pc(this,function(e){return[2,fpe(a,c,l.box,d,n,f,o)]})})})}function Ipe(e,t,r){var n=this,i=W9(e,t,r),a=i.position,o=i.boundary,s=i.radius,u=z9(o.box,r);return vy.create("Gaussian Density",function(e){return Tc(n,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,Cpe(e,a,o.box,s,u)];case 1:return[2,t.sent()]}})})})}function Dpe(e,t,r,n,i){var a=this,o=W9(e,t,r),s=o.position,u=o.boundary,c=o.radius,l=z9(u.box,r);return vy.create("Gaussian Density",function(e){return Tc(a,void 0,void 0,function(){return Pc(this,function(e){return[2,dpe(n,s,u.box,c,l,i)]})})})}function Ope(e,t,r,n,i,a){var o=this,s=e.lookup3d.boundary.box,u=W9(e,t,n),c=u.position,l=u.boundary,d=u.radius,f=z9(l.box,n);return vy.create("Gaussian Density",function(e){return Tc(o,void 0,void 0,function(){return Pc(this,function(e){return[2,fpe(i,c,s,d,r,f,a)]})})})}Ib.getDefaultValues(Tpe);var Rpe=Ac(Ac(Ac({},Tpe),YI),{ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),tryUseGpu:Ib.Boolean(!0),includeParent:Ib.Boolean(!1,{isHidden:!0})}),Bpe=Ac(Ac(Ac({},bee),kee),Rpe),Npe=Ac(Ac(Ac({},cee),gee),Rpe);function Fpe(e){return e.extensions.colorBufferFloat&&e.extensions.textureFloat&&e.extensions.blendMinMax&&e.extensions.drawBuffers}function Lpe(e,t,r){if(t.resolution>1)return!1;var n=r.maxTextureSize/3,i=j9(e.boundary.box,t.resolution,n*n);return i.areaCells<i.maxAreaCells}function $pe(e,t,r,n){return r.tryUseGpu&&n&&Fpe(n)&&Lpe(t,r,n)?function(e){return function(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:SR.Utils}),t)}({defaultProps:Ib.getDefaultValues(Bpe),createGeometry:Vpe,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiu
139sOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0),t.smoothColors.name===r.smoothColors.name?"on"===t.smoothColors.name&&"on"===r.smoothColors.name&&(t.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(e.updateColor=!0),t.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(e.updateColor=!0)):e.updateColor=!0},mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!Lpe(e.structure,t,r)},processValues:function(e,t,r,n,i){var a=t.meta,o=a.resolution,s=a.colorTexture,u=ZI(r.smoothColors,n.color.preferSmoothing,o);u&&i&&(oJ(e,u.resolution,u.stride,i,s),t.meta.colorTexture=e.tColorGrid.ref.value)},dispose:function(e){var t;e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy(),e.doubleBuffer.destroy(),null==(t=e.meta.colorTexture)||t.destroy()}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues(Bpe),createGeometry:jpe,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0),t.smoothColors.name===r.smoothColors.name?"on"===t.smoothColors.name&&"on"===r.smoothColors.name&&(t.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(e.updateColor=!0),t.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(e.updateColor=!0)):e.updateColor=!0},mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&Lpe(e.structure,t,r)},processValues:function(e,t,r,n,i){var a=t.meta,o=a.resolution,s=a.colorTexture,u=ZI(r.smoothColors,n.color.preferSmoothing,o);u&&(WQ(e,u.resolution,u.stride,i,s),t.meta.colorTexture=e.tColorGrid.ref.value)},dispose:function(e){var t;null==(t=e.meta.colorTexture)||t.destroy()}},e)}(e)}function Upe(e,t,r,n){return r.tryUseGpu&&n&&Fpe(n)&&Lpe(t,r,n)?function(e){return function(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:SR.Utils}),t)}({defaultProps:Ib.getDefaultValues(Npe),createGeometry:Hpe,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0),t.smoothColors.name===r.smoothColors.name?"on"===t.smoothColors.name&&"on"===r.smoothColors.name&&(t.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(e.updateColor=!0),t.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(e.updateColor=!0)):e.updateColor=!0},mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!Lpe(e,t,r)},processValues:function(e,t,r,n,i){var a=t.meta,o=a.resolution,s=a.colorTexture,u=ZI(r.smoothColors,n.color.preferSmoothing,o);u&&i&&(oJ(e,u.resolution,u.stride,i,s),t.meta.colorTexture=e.tColorGrid.ref.value)},dispose:function(e){var t;e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy(),e.doubleBuffer.destroy(),null==(t=e.meta.colorTexture)||t.destroy()}},e)}(e):function(e){return lee({defaultProps:Ib.getDefaultValues(Npe),createGeometry:zpe,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiu
139sOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.smoothColors.name===r.smoothColors.name?"on"===t.smoothColors.name&&"on"===r.smoothColors.name&&(t.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(e.updateColor=!0),t.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(e.updateColor=!0)):e.updateColor=!0},mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&Lpe(e,t,r)},processValues:function(e,t,r,n,i){var a=t.meta,o=a.resolution,s=a.colorTexture,u=ZI(r.smoothColors,n.color.preferSmoothing,o);u&&(WQ(e,u.resolution,u.stride,i,s),t.meta.colorTexture=e.tColorGrid.ref.value)},dispose:function(e){var t;null==(t=e.meta.colorTexture)||t.destroy()}},e)}(e)}function jpe(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var o,s,u,c,l,d,f,h,p,m;return Pc(this,function(g){switch(g.label){case 0:return o=i.smoothness,[4,Epe(r,t,n.size,i).runInContext(e.runtime)];case 1:return s=g.sent(),u=s.transform,c=s.field,l=s.idField,d=s.radiusFactor,f=s.resolution,h=s.maxRadius,[4,wne({isoLevel:Math.exp(-o)/d,scalarField:c,idField:l},a).runAsChild(e.runtime)];case 2:return(p=g.sent()).meta.resolution=f,sD.transform(p,u),e.webgl&&!e.webgl.isWebGL2?(sD.uniformTriangleGroup(p),tf.updateIfChanged(p.varyingGroup,!1)):tf.updateIfChanged(p.varyingGroup,!0),m=XE.expand(XE(),t.boundary.sphere,h),p.setBoundingSphere(m),[2,p]}})})}function zpe(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return a=n.smoothness,[4,Ipe(t,r.size,n).runInContext(e.runtime)];case 1:return o=m.sent(),s=o.transform,u=o.field,c=o.idField,l=o.radiusFactor,d=o.resolution,f=o.maxRadius,[4,wne({isoLevel:Math.exp(-a)/l,scalarField:u,idField:c},i).runAsChild(e.runtime)];case 2:return(h=m.sent()).meta.resolution=d,sD.transform(h,s),e.webgl&&!e.webgl.isWebGL2?(sD.uniformTriangleGroup(h),tf.updateIfChanged(h.varyingGroup,!1)):tf.updateIfChanged(h.varyingGroup,!0),p=XE.expand(XE(),t.boundary.sphere,f),h.setBoundingSphere(p),[2,h]}})})}var Gpe="gaussian-surface";function Vpe(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var o,s,u,c,l,d,f,h,p,m,g,v,y,b,_,x;return Pc(this,function(S){switch(S.label){case 0:if(!e.webgl)throw Error("webgl context required to create gaussian surface texture-mesh");return o=e.webgl,s=o.namedTextures,u=o.resources,c=o.extensions,l=c.colorBufferFloat,d=c.textureFloat,f=c.colorBufferHalfFloat,h=c.textureHalfFloat,s[Gpe]||(s[Gpe]=f&&h?u.texture("image-float16","rgba","fp16","linear"):l&&d?u.texture("image-float32","rgba","float","linear"):u.texture("image-uint8","rgba","ubyte","linear")),[4,kpe(r,t,n.size,!0,i,e.webgl,s[Gpe]).runInContext(e.runtime)];case 1:return p=S.sent(),m=Math.exp(-i.smoothness)/p.radiusFactor,g=Cg.create(0,1,2),v=a?.doubleBuffer.get(),y=qne(e.webgl,p.texture,p.gridDim,p.gridTexDim,p.gridTexScale,p.transform,m,!1,!0,g,!0,v?.vertex,v?.group,v?.normal),b=t.elements.length,_=XE.expand(XE(),t.boundary.sphere,p.maxRadius),(x=SR.create(y.vertexCount,b,y.vertexTexture,y.groupTexture,y.normalTexture,_,a)).meta.resolution=p.resolution,x.meta.webgl=e.webgl,[2,x]}})})}function Hpe(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p,m,g,v,y,b,_;return Pc(this,function(x){switch(x.label){case 0:if(!e.webgl)throw Error("webgl context required to create structure gaussian surface texture-mesh");return a=e.webgl,o=a.namedTextures,s=a.resources,u=a.extensions,c=u.colorBufferFloat,l=u.textureFloat,d=u.colorBufferHalfFloat,f=u.textureHalfFloat,o[Gpe]||(o[Gpe]=d&&f?s.texture("image-float16","rgba","fp16","linear"):c&&l?s.texture("image-float32","rgba","float","linear"):s.texture("image-uint8","rgba","ubyte","linear")),[4,Ope(t,r.size,!0,n,e.webgl,o[Gpe]).runInContext(e.runtime)];case 1:return h=x.sent(),p=Math.exp(-n.smoothness)/h.radiusFactor,m=Cg.create(0,1,2),g=i?.doubleBuffer.get(),v=qne(e.webgl,h.texture,h.gridDim,h.gridTexDim,h.gridTexScale,h.transform,p,!1,!0,m,!0,g?.vertex,g?.group,g?.normal),y=t.elementCount,b=XE.expand(XE(),t.boundary.sphere,h.maxRadius),(_=SR.create(v.vertexCount,y,v.vertexTexture,v.groupTexture,v.normalTexture,b,i)).meta.resolution=h.resolution,_.meta.webgl=e.webgl,[2,_]}})})}function qpe(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var o,s,u,c,l,d,f,h;return Pc(this,function(p){switch(p.label){case 0:return o=i.smoothness,[4,Epe(r,t,n.size,i).runInContext(e.runtime)];case 1:return s=p.sent(),u=s.transform,c=s.field,l=s.idField,d=s.maxRadius,[4,Ane({isoLevel:Math.exp(-o),scalarField:c,idField:l},a).runAsChild(e.runtime)];case 2:return f=p.sent(),qO.transform(f,u),h=XE.expand(XE(),t.boundary.sphere,d),f.setBoundingSphere(h),[2,f]}})})}var Wpe=Ac(Ac(Ac({},Tee),Tpe),{sizeFactor:Ib.Numeric(3,{min:0,max:10,step:.1}),lineSizeAttenuation:Ib.Boolean(!1),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),includeParent:Ib.Boolean(!1,{isHidden:!0})});function Xpe(e){return Pee({defaultProps:Ib.getDefaultValues(Wpe),createGeometry:qpe,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiu
139sOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)}},e)}var Ype={"gaussian-surface-mesh":function(e,t){return vee("Gaussian surface mesh",e,t,$pe)},"structure-gaussian-surface-mesh":function(e,t){return B9("Structure-Gaussian surface mesh",e,t,Upe)},"gaussian-surface-wireframe":function(e,t){return vee("Gaussian surface wireframe",e,t,Xpe)}},Kpe=Ac(Ac(Ac({},Bpe),Wpe),{visuals:Ib.MultiSelect(["gaussian-surface-mesh"],Ib.objectToOptions(Ype)),bumpFrequency:Ib.Numeric(1,{min:0,max:10,step:.1},qI.ShadingCategory)}),Zpe={name:"gaussian-surface",label:"Gaussian Surface",description:"Displays a gaussian molecular surface.",factory:function(e,t){return dJ.createMulti("Gaussian Surface",e,t,Iee,Ype)},getParams:function(e,t){return Kpe},defaultValues:Ib.getDefaultValues(Kpe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}},Qpe=Ac(Ac({},pee),{background:Ib.Boolean(!1),backgroundMargin:Ib.Numeric(0,{min:0,max:1,step:.01}),backgroundColor:Ib.Color(MC.black),backgroundOpacity:Ib.Numeric(.5,{min:0,max:1,step:.01}),borderWidth:Ib.Numeric(.25,{min:0,max:.5,step:.01}),level:Ib.Select("residue",[["chain","Chain"],["residue","Residue"],["element","Element"]],{isEssential:!0}),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),chainScale:Ib.Numeric(10,{min:0,max:20,step:.1}),residueScale:Ib.Numeric(1,{min:0,max:20,step:.1}),elementScale:Ib.Numeric(.5,{min:0,max:20,step:.1})});function Jpe(e){return function(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0),r.background!==n.background&&(t.createGeometry=!0),r.backgroundMargin!==n.backgroundMargin&&(t.createGeometry=!0),r.tether!==n.tether&&(t.createGeometry=!0),r.tetherLength!==n.tetherLength&&(t.createGeometry=!0),r.tetherBaseWidth!==n.tetherBaseWidth&&(t.createGeometry=!0),r.attachment!==n.attachment&&(t.createGeometry=!0),r.fontFamily!==n.fontFamily&&(t.createGeometry=!0),r.fontQuality!==n.fontQuality&&(t.createGeometry=!0),r.fontStyle!==n.fontStyle&&(t.createGeometry=!0),r.fontVariant!==n.fontVariant&&(t.createGeometry=!0),r.fontWeight!==n.fontWeight&&(t.createGeometry=!0)},geometryUtils:UO.Utils}),t)}({defaultProps:Ib.getDefaultValues(Qpe),createGeometry:eme,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){e.createGeometry=t.level!==r.level||"chain"===t.level&&t.chainScale!==r.chainScale||"residue"===t.level&&t.residueScale!==r.residueScale||"element"===t.level&&t.elementScale!==r.elementScale||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant}},e)}function eme(e,t,r,n,i){switch(n.level){case"chain":return function(e,t,r,n,i){for(var a=qF.create(t),o=t.units,s=t.serialMapping,u=Cj.chain,c=u.auth_asym_id,l=u.label_asym_id,d=s.cumulativeUnitElementCount,f=o.length,h=n.chainScale,p=FJ.create(n,f,f/2,i),m=0,g=o.length;m<g;++m){var v=o[m];a.unit=v,a.element=v.elements[0];var y=v.lookup3d.boundary.sphere,b=y.center,_=y.radius;Cg.transformMat4(tme,b,v.conformation.operator.matrix);var x=c(a),S=l(a),w=x===S?S:`${S} [${x}]`;p.add(w,tme[0],tme[1],tme[2],_,h,d[m])}return p.getText()}(0,t,0,n,i);case"residue":return function(e,t,r,n,i){for(var a=qF.create(t),o=t.units,s=t.serialMapping,u=Cj.atom.label_comp_id,c=Cj.residue.auth_seq_id,l=s.cumulativeUnitElementCount,d=2*t.polymerResidueCount,f=n.residueScale,h=FJ.create(n,d,d/2,i),p=0,m=o.length;p<m;++p){var g=o[p],v=g.conformation.position,y=g.elements;a.unit=g,a.element=g.elements[0];for(var b=g.model.atomicHierarchy.residueAtomSegments.index,_=l[p],x=0,S=y.length;x<S;){var w=x,A=b[y[x]];for(x++;x<S&&b[y[x]]===A;)x++;rme.reset();for(var C=w;C<x;C++)v(y[C],tme),rme.includePosition(tme);for(rme.finishedIncludeStep(),C=w;C<x;C++)v(y[C],tme),rme.radiusPosition(tme);a.element=y[w];var T=rme.getSphere(),P=T.center,E=T.radius,M=c(a),k=`${u(a)} ${M}`;h.add(k,P[0],P[1],P[2],E,f,_+w)}}return h.getText()}(0,t,0,n,i);case"element":return function(e,t,r,n,i){for(var a=qF.create(t),o=t.units,s=t.serialMapping,u=Cj.atom,c=u.label_atom_id,l=u.label_alt_id,d=s.cumulativeUnitElementCount,f=r.size,h=t.elementCount,p=n.elementScale,m=FJ.create(n,h,h/2,i),g=0,v=o.length;g<v;++g){var y=o[g],b=y.conformation.position,_=y.elements;a.unit=y;for(var x=d[g],S=Mse(t,y,Ac(Ac({},n),{traceOnly:!1})),w=0,A=_.length;w<A;w++)if(!S||!S(_[w])){a.element=_[w],b(a.element,tme);var C=c(a),T=l(a),P=T?`${C}%${T}`:C;m.add(P,tme[0],tme[1],tme[2],f.size(a),p,x+w)}}return m.getText()}(0,t,r,n,i)}}var tme=Cg(),rme=new PM("98"),nme={"label-text":function(e,t){return B9("Label text",e,t,Jpe)}},ime=Ac(Ac({}
139,Qpe),{visuals:Ib.MultiSelect(["label-text"],Ib.objectToOptions(nme))}),ame={name:"label",label:"Label",description:"Displays labels.",factory:function(e,t){var r=dJ.createMulti("Label",e,t,Iee,nme);return r.setState({pickable:!1,markerActions:bQ.None}),r},getParams:function(e,t){return ime},defaultValues:Ib.getDefaultValues(ime),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}},ome={probeRadius:Ib.Numeric(1.4,{min:0,max:10,step:.1},{description:"Radius of the probe tracing the molecular surface."}),resolution:Ib.Numeric(.5,{min:.01,max:20,step:.01},Ac({description:"Grid resolution/cell spacing."},qI.CustomQualityParamInfo)),probePositions:Ib.Numeric(36,{min:12,max:90,step:1},Ac({description:"Number of positions tested for probe target intersection."},qI.CustomQualityParamInfo))};function sme(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){function o(e,t,r,n,i){if(-1!==d){if((u=d)!==n&&u!==i&&s(u,e,t,r))return u;d=-1}for(var a=0,o=w.count;a<o;++a){var u;if((u=kP.getAt(A,w.indices[a]))!==n&&u!==i&&s(u,e,t,r))return d=u,u}return-1}function s(e,t,r,n){var i=M[e],a=C[e]-t,o=T[e]-r,s=P[e]-n;return a*a+o*o+s*s<i*i}function u(){return Tc(this,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<k?(function(e,t){for(var r=e;r<t;++r){var n=kP.getAt(A,r),i=C[n],a=T[n],s=P[n],u=M[n],c=u*u;S.find(i,a,s,u);for(var l=Math.ceil(u*b),d=Math.floor(b*(i-R)),f=Math.floor(b*(a-B)),h=Math.floor(b*(s-N)),p=Math.max(0,d-l),m=Math.max(0,f-l),g=Math.max(0,h-l),v=Math.min($,d+l+2),y=Math.min(U,f+l+2),_=Math.min(j,h+l+2),x=p;x<v;++x)for(var w=K[x]-i,k=x*G,I=m;I<y;++I)for(var D=Z[I]-a,O=w*w+D*D,F=I*z+k,L=g;L<_;++L){var V=Q[L]-s,H=O+V*V;if(H<c){var q=L+F;X[q]<0&&(X[q]*=-1);var W=Math.sqrt(H),J=u/W;if(-1===o(w*J+i,D*J+a,V*J+s,n,-1)){var ee=u-W;ee<X[q]&&(X[q]=ee,Y[q]=E[r])}}}}}(t,Math.min(t+J,k)),e.shouldUpdate?[4,e.update({message:"projecting points",current:t,max:k})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t+=J,[3,1];case 4:return[2]}})})}function c(e,t){var r=M[e],n=M[t],i=f[0]=C[t]-C[e],a=f[1]=T[t]-T[e],s=f[2]=P[t]-P[e],u=i*i+a*a+s*s,c=Math.sqrt(u),l=r*((r*r+c*c-n*n)/(2*r*c));Cg.normalize(f,f),function(e,t){e[0]=e[1]=e[2]=1,0===t[0]?0===t[1]?0!==t[2]&&(e[2]=(t[0]+t[1])/-t[2]):e[1]=(t[0]+t[2])/-t[1]:e[0]=(t[1]+t[2])/-t[0]}(p,f),Cg.normalize(p,p),Cg.cross(m,f,p),Cg.normalize(m,m);var g=Math.sqrt(r*r-l*l);Cg.scale(p,p,g),Cg.scale(m,m,g),Cg.scale(f,f,l),h[0]=f[0]+C[e],h[1]=f[1]+T[e],h[2]=f[2]+P[e],d=-1;for(var v=0;v<y;++v){var x=H[v],S=q[v],w=h[0]+x*p[0]+S*m[0],k=h[1]+x*p[1]+S*m[1],I=h[2]+x*p[2]+S*m[2];if(-1===o(w,k,I,e,t))for(var D=Math.floor(b*(w-R)),O=Math.floor(b*(k-B)),F=Math.floor(b*(I-N)),L=Math.max(0,D-_),V=Math.max(0,O-_),W=Math.max(0,F-_),J=Math.min($,D+_+2),ee=Math.min(U,O+_+2),te=Math.min(j,F+_+2),re=L;re<J;++re)for(var ne=w-K[re],ie=re*G,ae=V;ae<ee;++ae)for(var oe=k-Z[ae],se=ne*ne+oe*oe,ue=ae*z+ie,ce=W;ce<te;++ce){var le=I-Q[ce],de=se+le*le,fe=ce+ue,he=X[fe];if(he>0&&de<he*he){X[fe]=Math.sqrt(de);var pe=ne*f[0]+oe*f[1]+le*f[2];Y[fe]=E[kP.indexOf(A,pe<0?t:e)]}}}}function l(){return Tc(this,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<k?(function(e,t){for(var r=e;r<t;++r){var n=kP.getAt(A,r);S.find(C[n],T[n],P[n],M[n]);for(var i=0,a=w.count;i<a;++i){var o=kP.getAt(A,w.indices[i]);n<o&&c(n,o)}}}(t,Math.min(t+J,k)),e.shouldUpdate?[4,e.update({message:"projecting torii",current:t,max:k})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t+=J,[3,1];case 4:return[2]}})})}var d,f,h,p,m,g,v,y,b,_,x,S,w,A,C,T,P,E,M,k,I,D,O,R,B,N,F,L,$,U,j,z,G,V,H,q,W,X,Y,K,Z,Q,J,ee,te,re;return Pc(this,function(e){switch(e.label){case 0:return d=-1,f=Cg(),h=Cg(),p=Cg(),m=Cg(),g=a.resolution,v=a.probeRadius,y=a.probePositions,b=1/g,_=Math.max(5,2+Math.floor(v*b)),x=Cg.create(n,n,n),Cg.scale(x,x,2),S=JE(t,r,x),w=S.result,null===i&&(i=S.boundary.box),A=t.indices,C=t.x,T=t.y,P=t.z,E=t.id,M=t.radius,k=kP.size(A),I=n+g,D=YE.expand(YE(),i,Cg.create(I,I,I)),O=D.min,R=O[0],B=O[1],N=O[2],F=YE.scale(YE(),D,b),L=YE.size(Cg(),F),Cg.ceil(L,L),$=L[0],U=L[1],j=L[2],G=(z=j)*U,V=function(e){for(var t=0,r=2*Math.PI/e,n=new Float32Array(e),i=new Float32Array(e),a=0;a<e;a++)n[a]=Math.cos(t),i[a]=Math.sin(t),t+=r;return{cosTable:n,sinTable:i}}(y),H=V.cosTable,q=V.sinTable,W=Tg.Space(L,[0,1,2],Float32Array),X=W.create(),Y=W.create(),X.fill(-1001),Y.fill(-1),K=TE($,R,g),Z=TE(U,B,g),Q=TE(j,N,g),J=Math.ceil(1e5/((n**3)**3*b)),[4,u()];case 1:return e.sent(),[4,l()];case 2:return e.sent(),ee=Tg.create(W,X),te=Tg.create(W,Y),re=Og.identity(),Og.fromScaling(re,Cg.create(g,g,g)),Og.setTranslation(re,D.min),[2,{field:ee,idField:te,transform:re,resolution:g,maxRadius:n}]}})})}function ume(e,t,r,n){var i=this,a=function(e,t,r,n){for(var i=n.probeRadius,a=q9(e,t,r,n),o=a.position,s=a.boundary,u=a.radius,c=o.indices,l=kP.size(c),d=new Float32Array(kP.end(c)),f=0,h=0;h<l;++h){var p=kP.getAt(c,h),m=u(p);f<m&&(f=m),d[p]=m+i}return{position:Ac(Ac({},o),{radius:d}),boundary:s,maxRadius:f}}(e,t,r,n),o=a.position,s=a.boundary,u=a.maxRadius,c=z9(s.box,n);return vy.create("Molecular Surface",function(e){return Tc(i,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,lme(e,o,s,u,s.box,c
139)];case 1:return[2,t.sent()]}})})})}function cme(e,t,r){var n=this,i=function(e,t,r){for(var n=r.probeRadius,i=W9(e,t,r),a=i.position,o=i.boundary,s=i.radius,u=a.indices,c=kP.size(u),l=new Float32Array(kP.end(u)),d=0,f=0;f<c;++f){var h=kP.getAt(u,f),p=s(h);d<p&&(d=p),l[h]=p+n}return{position:Ac(Ac({},a),{radius:l}),boundary:o,maxRadius:d}}(e,t,r),a=i.position,o=i.boundary,s=i.maxRadius,u=z9(o.box,r);return vy.create("Molecular Surface",function(e){return Tc(n,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,lme(e,a,o,s,o.box,u)];case 1:return[2,t.sent()]}})})})}function lme(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){return Pc(this,function(o){return[2,sme(e,t,r,n,i,a)]})})}Ib.getDefaultValues(ome);var dme=Ac(Ac(Ac(Ac({},bee),ome),G9),YI);function fme(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var o,s,u,c,l,d,f,h,p;return Pc(this,function(m){switch(m.label){case 0:return[4,ume(r,t,n.size,i).runInContext(e.runtime)];case 1:return o=m.sent(),s=o.transform,u=o.field,c=o.idField,l=o.resolution,d=o.maxRadius,[4,wne({isoLevel:i.probeRadius,scalarField:u,idField:c},a).runAsChild(e.runtime)];case 2:return f=m.sent(),i.includeParent&&(h=Math.ceil(2/i.resolution),sD.smoothEdges(f,{iterations:h,maxNewEdgeLength:Math.sqrt(2)})),sD.transform(f,s),e.webgl&&!e.webgl.isWebGL2?(sD.uniformTriangleGroup(f),tf.updateIfChanged(f.varyingGroup,!1)):tf.updateIfChanged(f.varyingGroup,!0),p=XE.expand(XE(),t.boundary.sphere,d),f.setBoundingSphere(p),f.meta.resolution=l,[2,f]}})})}function hme(e){return _ee({defaultProps:Ib.getDefaultValues(dme),createGeometry:fme,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.probeRadius!==r.probeRadius&&(e.createGeometry=!0),t.probePositions!==r.probePositions&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0),t.smoothColors.name===r.smoothColors.name?"on"===t.smoothColors.name&&"on"===r.smoothColors.name&&(t.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(e.updateColor=!0),t.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(e.updateColor=!0)):e.updateColor=!0},processValues:function(e,t,r,n,i){var a=t.meta,o=a.resolution,s=a.colorTexture,u=ZI(r.smoothColors,n.color.preferSmoothing,o);u&&(WQ(e,u.resolution,u.stride,i,s),t.meta.colorTexture=e.tColorGrid.ref.value)},dispose:function(e){var t;null==(t=e.meta.colorTexture)||t.destroy()}},e)}function pme(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h;return Pc(this,function(p){switch(p.label){case 0:return[4,cme(t,r.size,n).runInContext(e.runtime)];case 1:return a=p.sent(),o=a.transform,s=a.field,u=a.idField,c=a.resolution,l=a.maxRadius,[4,wne({isoLevel:n.probeRadius,scalarField:s,idField:u},i).runAsChild(e.runtime)];case 2:return d=p.sent(),n.includeParent&&(f=Math.ceil(2/n.resolution),sD.smoothEdges(d,{iterations:f,maxNewEdgeLength:Math.sqrt(2)})),sD.transform(d,o),e.webgl&&!e.webgl.isWebGL2?(sD.uniformTriangleGroup(d),tf.updateIfChanged(d.varyingGroup,!1)):tf.updateIfChanged(d.varyingGroup,!0),h=XE.expand(XE(),t.boundary.sphere,l),d.setBoundingSphere(h),d.meta.resolution=c,[2,d]}})})}function mme(e){return lee({defaultProps:Ib.getDefaultValues(dme),createGeometry:pme,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.probeRadius!==r.probeRadius&&(e.createGeometry=!0),t.probePositions!==r.probePositions&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0),t.smoothColors.name===r.smoothColors.name?"on"===t.smoothColors.name&&"on"===r.smoothColors.name&&(t.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(e.updateColor=!0),t.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(e.updateColor=!0)):e.updateColor=!0},processValues:function(e,t,r,n,i){var a=t.meta,o=a.resolution,s=a.colorTexture,u=ZI(r.
139smoothColors,n.color.preferSmoothing,o);u&&(WQ(e,u.resolution,u.stride,i,s),t.meta.colorTexture=e.tColorGrid.ref.value)},dispose:function(e){var t;null==(t=e.meta.colorTexture)||t.destroy()}},e)}var gme=Ac(Ac(Ac(Ac({},Tee),ome),G9),{sizeFactor:Ib.Numeric(1.5,{min:0,max:10,step:.1})});function vme(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var o,s,u,c,l,d,f;return Pc(this,function(h){switch(h.label){case 0:return[4,ume(r,t,n.size,i).runInContext(e.runtime)];case 1:return o=h.sent(),s=o.transform,u=o.field,c=o.idField,l=o.maxRadius,[4,Ane({isoLevel:i.probeRadius,scalarField:u,idField:c},a).runAsChild(e.runtime)];case 2:return d=h.sent(),qO.transform(d,s),f=XE.expand(XE(),t.boundary.sphere,l),d.setBoundingSphere(f),[2,d]}})})}function yme(e){return Pee({defaultProps:Ib.getDefaultValues(gme),createGeometry:vme,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.probeRadius!==r.probeRadius&&(e.createGeometry=!0),t.probePositions!==r.probePositions&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)}},e)}var bme={"molecular-surface-mesh":function(e,t){return vee("Molecular surface mesh",e,t,hme)},"structure-molecular-surface-mesh":function(e,t){return B9("Structure Molecular surface mesh",e,t,mme)},"molecular-surface-wireframe":function(e,t){return vee("Molecular surface wireframe",e,t,yme)}},_me=Ac(Ac(Ac({},dme),gme),{visuals:Ib.MultiSelect(["molecular-surface-mesh"],Ib.objectToOptions(bme)),bumpFrequency:Ib.Numeric(1,{min:0,max:10,step:.1},qI.ShadingCategory)}),xme={name:"molecular-surface",label:"Molecular Surface",description:"Displays a molecular surface.",factory:function(e,t){return dJ.createMulti("Molecular Surface",e,t,Iee,bme)},getParams:function(e,t){return _me},defaultValues:Ib.getDefaultValues(_me),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}},Sme=Ac(Ac({},bee),{sizeFactor:Ib.Numeric(1,{min:0,max:2,step:.1}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo)});function wme(e){return _ee({defaultProps:Ib.getDefaultValues(Sme),createGeometry:Ame,createLocationIterator:Cme,getLoci:Tme,eachLocation:Pme,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail}},e)}function Ame(e,t,r,n,i,a){if(!function(e){if(tU.Traits.is(e.traits,tU.Trait.MultiChain)||tU.Traits.is(e.traits,tU.Trait.Partitioned))return!1;if(tU.isCoarse(e))return!0;if(0===e.elements.length)return!1;e.model.atomicHierarchy.derived.residue.moleculeType;var t=e.residueIndex[e.elements[0]],r=e.model.atomicHierarchy.derived.residue.moleculeType[t];return 3!==r&&2!==r}(t))return sD.createEmpty(a);var o=i.detail,s=i.sizeFactor,u=dO.createState(256,128,a),c=t.principalAxes.boxAxes,l=c.origin,d=c.dirA,f=c.dirB,h=HE.size(Cg(),c);Cg.scale(h,h,s/2);var p=Cg.create(h[2],h[1],h[0]);u.currentGroup=0,L0(u,l,d,f,p,o+1);var m=dO.getMesh(u),g=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return m.setBoundingSphere(g),m}function Cme(e){var t=e.group,r=e.structure,n=t.units.length,i=qF.create(r);return YM(1,n,1,function(e,r){var n=t.units[r];return i.unit=n,i.element=n.elements[e],i})}function Tme(e,t,r){var n=e.objectId,i=e.instanceId;if(r===n){var a=t.structure,o=t.group.units[i];return Az(a,[{unit:o,indices:kP.ofBounds(0,o.elements.length)}])}return EQ}function Pme(e,t,r){var n=!1;if(!Az.is(e))return!1;var i=t.structure,a=t.group;if(!yz.areEquivalent(e.structure,i))return!1;for(var o=a.elements.length,s=0,u=e.elements;s<u.length;s++){var c=u[s],l=a.unitIndexMap.get(c.unit.id);void 0!==l&&kP.size(c.indices)===o&&r($T.ofSingleton(l))&&(n=!0)}return n}var Eme,Mme={"orientation-ellipsoid-mesh":function(e,t){return vee("Orientation ellipsoid mesh",e,t,wme)}},kme=Ac(Ac({},Sme),{visuals:Ib.MultiSelect(["orientation-ellipsoid-mesh"],Ib.objectToOptions(Mme)),bumpFrequency:Ib.Numeric(1,{min:0,max:10,step:.1},qI.ShadingCategory)}),Ime={name:"orientation",label:"Orientation",description:"Displays orientation ellipsoids for polymer chains.",factory:function(e,t){return dJ.createMulti("Orientation",e,t,Iee,Mme)},getParams:function(e,t){return kme},defaultValues:Ib.getDefaultValues(kme),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}},Dme=iv.add3,Ome=iv.add;!function(e){e.create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=iv.create(Float32Array,3,t,r?r.centerBuffer.ref.value:e),i=iv.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e);return{add:function(e,t,r,a){Dme(n,e,t,r),Ome(i,a)},getPoints:function(){var e=iv.compact(n,!0),t=iv.compact(i,!0);return BO.create(e,t,n.elementCount,r)}}}}(Eme||={});var Rme=Cg.add,Bme=Ac(Ac({},Cee),{pointSizeAttenuation:Ib.Boolean(!1),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),traceOnly:Ib.Boolean(!1),str
139ide:Ib.Numeric(1,{min:1,max:100,step:1})});function Nme(e,t,r,n,i,a){var o=r.child;if(o&&!o.unitMap.get(t.id))return BO.createEmpty(a);var s=t.elements,u=s.length,c=Eme.create(u,u/10,a),l=Cg(),d=t.conformation.invariantPosition,f=Mse(r,t,i),h=Cg(),p=0;if(f)for(var m=0;m<u;++m)f(s[m])||(d(s[m],l),Rme(h,h,l),p+=1,c.add(l[0],l[1],l[2],m));else for(m=0;m<u;++m)d(s[m],l),Rme(h,h,l),p+=1,c.add(l[0],l[1],l[2],m);var g,v=a?XE.clone(a.boundingSphere):void 0,y=c.getPoints();return 0===p||(Cg.scale(h,h,1/p),g=v&&Cg.distance(h,v.center)/v.radius<.1?v:XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor),y.setBoundingSphere(g)),y}function Fme(e){return function(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:BO.Utils}),t)}({defaultProps:Ib.getDefaultValues(Bme),createGeometry:Nme,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){e.createGeometry=t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.traceOnly!==r.traceOnly||t.stride!==r.stride}},e)}var Lme={"element-point":function(e,t){return vee("Points",e,t,Fme)}},$me=Ac({},Bme),Ume={name:"point",label:"Point",description:"Displays elements (atoms, coarse spheres) as points.",factory:function(e,t){return dJ.createMulti("Point",e,t,Iee,Lme)},getParams:function(e,t){return $me},defaultValues:Ib.getDefaultValues($me),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}},jme={sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),linearSegments:Ib.Numeric(8,{min:1,max:48,step:1},qI.CustomQualityParamInfo),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo)};Ib.getDefaultValues(jme);var zme=Cg();function Gme(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return sD.createEmpty(a);for(var s=i.sizeFactor,u=i.detail,c=i.linearSegments,l=i.radialSegments,d=c*l*o+(l+1)*o*2,f=dO.createState(d,d/10,a),h=Sce(c),p=h.curvePoints,m=h.normalVectors,g=h.binormalVectors,v=h.widthValues,y=h.heightValues,b=0,_=rce(t,r,{ignoreSecondaryStructure:!0});_.hasNext;){var x=_.move();f.currentGroup=b;var S=mF(x.moleculeType)?zce:jce;wce(h,x,.5,S);var w=x.coarseBackboneFirst||x.first,A=x.coarseBackboneLast||x.last,C=n.size.size(x.centerPrev)*s,T=n.size.size(x.center)*s,P=n.size.size(x.centerNext)*s;Fce(h,C,T,P,C,T,P,S);var E=c;if(x.initial){var M=c-(E=Math.max(Math.round(c*S),1));p.copyWithin(0,3*M),g.copyWithin(0,3*M),m.copyWithin(0,3*M),v.copyWithin(0,3*M),y.copyWithin(0,3*M),Cg.fromArray(zme,p,3),Cg.normalize(zme,Cg.sub(zme,x.p2,zme)),Cg.scaleAndAdd(zme,x.p2,zme,2*T),Cg.toArray(zme,p,0)}else x.final&&(E=Math.max(Math.round(c*(1-S)),1),Cg.fromArray(zme,p,3*E-3),Cg.normalize(zme,Cg.sub(zme,x.p2,zme)),Cg.scaleAndAdd(zme,x.p2,zme,2*T),Cg.toArray(zme,p,3*E));!0===x.initial&&!0===x.final?OD(f,x.p2,2*T,u):2===l?qhe(f,p,m,g,E,v,y,0):4===l?lhe(f,p,m,g,E,v,y,0,w,A):The(f,p,m,g,E,l,v,y,w,A,"elliptical"),++b}var k=dO.getMesh(f),I=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return k.setBoundingSphere(I),k}var Vme=Ac(Ac({},bee),jme);function Hme(e){return _ee({defaultProps:Ib.getDefaultValues(Vme),createGeometry:Gme,createLocationIterator:function(e){return Lce.fromGroup(e,!0)},getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.linearSegments!==r.linearSegments||t.radialSegments!==r.radialSegments}},e)}var qme,Wme={"polymer-tube":function(e,t){return vee("Polymer tube mesh",e,t,Hme)},"polymer-gap":function(e,t){return vee("Polymer gap cylinder",e,t,Nfe)}},Xme=Ac(Ac(Ac({},Vme),Bfe),{sizeFactor:Ib.Numeric(.2,{min:0,max:10,step:.01}),visuals:Ib.MultiSelect(["polymer-tube","polymer-gap"],Ib.objectToOptions(Wme)),bumpFrequency:Ib.Numeric(2,{min:0,max:10,step:.1},qI.ShadingCategory)}),Yme={name:"putty",label:"Putty",description:"Displays a tube smoothly following the trace atoms of polymers.",factory:function(e,t){return dJ.createMulti("Putty",e,t,Iee,Wme)},getParams:function(e,t){var r=Ib.clone(Xme),n=!1,i=!1;
139return t.units.forEach(function(e){!n&&tU.isAtomic(e)&&e.nucleotideElements.length&&(n=!0),!i&&e.gapElements.length&&(i=!0)}),r.visuals.defaultValue=["polymer-tube"],i&&r.visuals.defaultValue.push("polymer-gap"),r},defaultValues:Ib.getDefaultValues(Xme),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uncertainty"},isApplicable:function(e){return e.polymerResidueCount>0}},Kme={"element-sphere":function(e,t){return vee("Sphere mesh/impostor",e,t,Use)},"structure-element-sphere":function(e,t){return B9("Structure sphere mesh/impostor",e,t,zse)}},Zme=Ac(Ac({},$se),{bumpFrequency:Ib.Numeric(1,{min:0,max:10,step:.1},qI.ShadingCategory),visuals:Ib.MultiSelect(["element-sphere"],Ib.objectToOptions(Kme))}),Qme={name:"spacefill",label:"Spacefill",description:"Displays atomic/coarse elements as spheres.",factory:function(e,t){return dJ.createMulti("Spacefill",e,t,Iee,Kme)},getParams:function(e,t){return t.isCoarseGrained?(qme||((qme=Ib.clone(Zme)).sizeFactor.defaultValue=2),qme):Zme},defaultValues:Ib.getDefaultValues(Zme),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}},Jme=RN.is;function ege(e,t,r,n,i,a){if(!tU.isAtomic(t))return qO.createEmpty(a);var o=r.child,s=o?.unitMap.get(t.id);if(o&&!s)return qO.createEmpty(a);var u=qF.create(r,t),c=t.elements,l=t.bonds,d=l.edgeCount,f=l.a,h=l.b,p=l.edgeProps,m=l.offset;if(!d)return qO.createEmpty(a);var g=p.order,v=p.flags,y=i.sizeFactor,b=i.aromaticBonds,_=i.includeTypes,x=i.excludeTypes,S=i.multipleBonds,w="off"===S,A="symmetric"===S,C=rse(RN.fromNames(_),RN.fromNames(x),32),T=Cg(),P=t.conformation.invariantPosition,E=t.rings,M=E.elementRingIndices,k=E.elementAromaticRingIndices,I=b?t.resonance.delocalizedTriplets:void 0,D=Zee(0,{linkCount:2*d,referencePosition:function(e){var t,r,n=f[e],i=h[e],a=I?.getThirdElement(n,i);if(void 0!==a)return P(c[a],T);n>i&&(n=(t=[i,n])[0],i=t[1]),m[n+1]-m[n]==1&&(n=(r=[i,n])[0],i=r[1]);for(var o=k.get(n)||M.get(n),s=0,u=m[n],l=m[n+1];u<l;++u){var d=h[u];if(d!==i&&d!==n){if(!o)return P(c[d],T);var p=k.get(d)||M.get(d);if(!p)continue;var g=Wb(o,p);g>s&&(s=g,P(c[d],T))}}return s>0?T:null},position:function(e,t,r){P(c[f[r]],e),P(c[h[r]],t)},style:function(e){var t=g[e],r=v[e];if(Jme(r,2)||Jme(r,4))return 1;if(3===t)return w?0:A?4:5;if(b){var n=f[e],i=h[e],a=k.get(n),o=k.get(i),s=a&&o?Wb(a,o):0;if(Jme(r,16)||s&&!C)return 2===s?8:7}return 2!==t||w?0:A?2:3},radius:function(e){u.element=c[f[e]];var t=n.size.size(u);u.element=c[h[e]];var r=n.size.size(u);return Math.min(t,r)*y},ignore:nse(r,t,i)},i,a),O=D.lines,R=D.boundingSphere;if(R)O.setBoundingSphere(R);else if(O.lineCount>0){var B=XE.expand(XE(),(s??t).boundary.sphere,1*y);O.setBoundingSphere(B)}return O}var tge=Ac(Ac(Ac({},Tee),tse),{includeParent:Ib.Boolean(!1)});function rge(e){return Pee({defaultProps:Ib.getDefaultValues(tge),createGeometry:ege,createLocationIterator:ese.fromGroup,getLoci:ase,eachLocation:ose,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.aromaticDashCount!==r.aromaticDashCount||t.dashCount!==r.dashCount||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||!af(t.includeTypes,r.includeTypes)||!af(t.excludeTypes,r.excludeTypes)||t.aromaticBonds!==r.aromaticBonds||t.multipleBonds!==r.multipleBonds;var s=a.group.units[0],u=o.group.units[0];tU.isAtomic(s)&&tU.isAtomic(u)&&(DF.areEqual(s.bonds,u.bonds)||(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0))}},e)}var nge=new C$.ElementBondIterator;function ige(e,t,r,n){for(nge.setElement(t,r,n);nge.hasNext;){var i=nge.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}function age(e,t,r,n,i){var a=t.interUnitBonds,o=a.edgeCount,s=a.edges;if(!o)return qO.createEmpty(i);var u=n.sizeFactor,c=n.aromaticBonds,l=n.multipleBonds,d="off"===l,f="symmetric"===l,h=Cg(),p=qF.create(),m=Zee(0,{linkCount:o,referencePosition:function(e){var r,n,i,a,o=s[e];if(o.unitA<o.unitB)r=t.unitMap.get(o.unitA),n=t.unitMap.get(o.unitB),i=o.indexA,a=o.indexB;else{if(!(o.unitA>o.unitB))throw Error("same units in createInterUnitBondLines");r=t.unitMap.get(o.unitB),n=t.unitMap.get(o.unitA),i=o.indexB,a=o.indexA}return ige(h,t,r,i)||ige(h,t,n,a)},position:function(e,r,n){var i=s[n],a=t.unitMap.get(i.unitA),o=t.unitMap.get(i.unitB);a.conformation.position(a.elements[i.indexA],e),o.conformation.position(o.elements[i.indexB],r)},style:function(e){var t=s[e].props.order,r=Sd.create(s[e].props.flag);return RN.is(r,2)||RN.is(r,4)?1:3===t?d?0:f?4:5:c&&RN.is(r,16)?7:2!==t||d?0:f?2:3},radius:function(e){var n=s[e];p.structure=t,p.unit=t.unitMap.get(n.unitA),p.element=p.unit.elements[n.indexA];var i=r.size.size(p);p.unit=t.unitMap.get(n.unitB),p.element=p.unit.elements[n.indexB];var a=r.size.size(p);return Math.min(i,a)*u},ignore:ise(t,n)},n,i),g=m.lines,v=m.boundingSphere;if(v)g.setBoundingSphere(v);else if(g.lineCount>0){var y=t.child,b=XE.expand(XE(),(y??t).boundary.sphere,1*u);g.setBoundingSphere(b)}return g}var oge=Ac(Ac(Ac({},hee),tse),{includeParent:Ib.Boolean(!1)});function sge(e){return function(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:qO.Utils}),t)}({defaultProps:Ib.getDefaultValues(oge),createGeometry:age,createLocationIterator:ese.fromStructure,getLoci:sse,eachLocation:cse,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkS
139pacing||t.aromaticDashCount!==r.aromaticDashCount||t.dashCount!==r.dashCount||t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||!af(t.includeTypes,r.includeTypes)||!af(t.excludeTypes,r.excludeTypes)||t.multipleBonds!==r.multipleBonds,a.interUnitBonds!==o.interUnitBonds&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0)}},e)}var uge=Cg.scaleAndAdd,cge=Cg.unitX,lge=Cg.unitY,dge=Cg.unitZ,fge=Ac(Ac({},Tee),{lineSizeAttenuation:Ib.Boolean(!1),ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),traceOnly:Ib.Boolean(!1),crosses:Ib.Select("lone",Ib.arrayToOptions(["lone","all"])),crossSize:Ib.Numeric(.35,{min:0,max:2,step:.01})});function hge(e,t,r,n,i,a){var o=r.child;if(o&&!o.unitMap.get(t.id))return qO.createEmpty(a);for(var s=t.elements,u=s.length,c=HO.create(u,u/10,a),l=Cg(),d=Cg(),f=Cg(),h=t.conformation.invariantPosition,p=Mse(r,t,i),m=i.crossSize/2,g="lone"===i.crosses,v=0;v<u;++v)p&&p(s[v])||g&&tU.isAtomic(t)&&0!==J6(r,t,v)||(h(s[v],l),uge(d,l,cge,m),uge(f,l,cge,-m),c.add(d[0],d[1],d[2],f[0],f[1],f[2],v),uge(d,l,lge,m),uge(f,l,lge,-m),c.add(d[0],d[1],d[2],f[0],f[1],f[2],v),uge(d,l,dge,m),uge(f,l,dge,-m),c.add(d[0],d[1],d[2],f[0],f[1],f[2],v));var y=c.getLines(),b=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return y.setBoundingSphere(b),y}function pge(e){return Pee({defaultProps:Ib.getDefaultValues(fge),createGeometry:hge,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){e.createGeometry=t.ignoreHydrogens!==r.ignoreHydrogens||t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||t.traceOnly!==r.traceOnly||t.crosses!==r.crosses||t.crossSize!==r.crossSize}},e)}var mge={"intra-bond":function(e,t){return vee("Intra-unit bond line",e,t,rge)},"inter-bond":function(e,t){return B9("Inter-unit bond line",e,t,sge)},"element-point":function(e,t){return vee("Points",e,t,Fme)},"element-cross":function(e,t){return vee("Crosses",e,t,pge)}},gge=Ac(Ac(Ac(Ac(Ac({},tge),oge),Bme),fge),{pointStyle:Ib.Select("circle",Ib.objectToOptions(BO.StyleTypes)),multipleBonds:Ib.Select("offset",Ib.arrayToOptions(["off","symmetric","offset"])),includeParent:Ib.Boolean(!1),sizeFactor:Ib.Numeric(2,{min:.01,max:10,step:.01}),unitKinds:Q9(["atomic"]),visuals:Ib.MultiSelect(["intra-bond","inter-bond","element-point","element-cross"],Ib.objectToOptions(mge))}),vge={name:"line",label:"Line",description:"Displays bonds as lines and atoms as points or croses.",factory:function(e,t){return dJ.createMulti("Line",e,t,Iee,mge)},getParams:function(e,t){if(yz.getSize(t)>=yz.Size.Huge){var r=Ib.clone(gge);return r.visuals.defaultValue=["intra-bond","element-point","element-cross"],r}return gge},defaultValues:Ib.getDefaultValues(gge),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0},getData:function(e,t){return t.includeParent?e.asParent():e},mustRecreate:function(e,t){return e.includeParent!==t.includeParent}};function yge(e,t,r,n,i){return Tc(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,h,p,m,g,v,y;return Pc(this,function(b){switch(b.label){case 0:if(a=e.runtime,!(o=e.webgl)||!o.extensions.blendMinMax)throw Error("GaussianDensityVolume requires `webgl` and `blendMinMax` extension");return s=i?i.gridTexture.ref.value:void 0,[4,Dpe(t,r.size,n,o,s).runInContext(a)];case 1:return u=b.sent(),c=u.transform,l=u.texture,d=u.bbox,f=u.gridDim,h={min:0,max:1,mean:.04,sigma:.01},p=Og.mul(Og(),c,Og.fromScaling(Og(),f)),m=Og.getScaling(Cg(),c),g=Cg.create(0,1,2),v=_R.create(d,f,c,p,m,l,h,!0,g,i),y=XE.expand(XE(),t.boundary.sphere,u.maxRadius),v.setBoundingSphere(y),[2,v]}})})}var bge=Ac(Ac(Ac({},mee),Tpe),{ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),includeParent:Ib.Boolean(!1,{isHidden:!0})});function _ge(e){return function(e,t){return uee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:_R.Utils}),t)}({defaultProps:Ib.getDefaultValues(bge),createGeometry:yge,createLocationIterator:Pse.fromStructure,getLoci:Fse,eachLocation:Nse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiu
139sOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)},dispose:function(e){e.gridTexture.ref.value.destroy()}},e)}function xge(e,t,r,n,i,a){return Tc(this,void 0,void 0,function(){var o,s,u,c,l,d,f,h,p,m,g,v,y,b;return Pc(this,function(_){switch(_.label){case 0:if(o=e.runtime,!(s=e.webgl))throw Error("GaussianDensityVolume requires `webgl`");return u=a?a.gridTexture.ref.value:void 0,[4,Mpe(r,t,n.size,i,s,u).runInContext(o)];case 1:return c=_.sent(),l=c.transform,d=c.texture,f=c.bbox,h=c.gridDim,p={min:0,max:1,mean:.04,sigma:.01},m=Og.mul(Og(),l,Og.fromScaling(Og(),h)),g=Og.getScaling(Cg(),l),v=Cg.create(0,1,2),y=_R.create(f,h,l,m,g,d,p,!0,v,a),b=XE.expand(XE(),t.boundary.sphere,c.maxRadius),y.setBoundingSphere(b),[2,y]}})})}var Sge=Ac(Ac(Ac({},Mee),Tpe),{ignoreHydrogens:Ib.Boolean(!1),ignoreHydrogensVariant:Ib.Select("all",Ib.arrayToOptions(["all","non-polar"])),includeParent:Ib.Boolean(!1,{isHidden:!0})});function wge(e){return function(e,t){return yee(Ac(Ac({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),mQ.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:_R.Utils}),t)}({defaultProps:Ib.getDefaultValues(Sge),createGeometry:xge,createLocationIterator:Pse.fromGroup,getLoci:Ose,eachLocation:Dse,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)},dispose:function(e){e.gridTexture.ref.value.destroy()}},e)}var Age={"gaussian-volume":function(e,t){return B9("Gaussian volume",e,t,_ge)},"units-gaussian-volume":function(e,t){return vee("Units-Gaussian volume",e,t,wge)}},Cge=Ac(Ac({},bge),{jumpLength:Ib.Numeric(4,{min:0,max:20,step:.1}),visuals:Ib.MultiSelect(["gaussian-volume"],Ib.objectToOptions(Age))}),Tge={name:"gaussian-volume",label:"Gaussian Volume",description:"Displays a gaussian molecular density using direct volume rendering.",factory:function(e,t){return dJ.createMulti("Gaussian Volume",e,t,Iee,Age)},getParams:function(e,t){return Cge},defaultValues:Ib.getDefaultValues(Cge),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}},Pge=Cg.scale,Ege=Cg.add,Mge=Cg.sub,kge=Ac(Ac(Ac({},bee),wee),{sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),radialSegments:Ib.Numeric(16,{min:2,max:56,step:2},qI.CustomQualityParamInfo),tryUseImpostor:Ib.Boolean(!0)});function Ige(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return Aee({defaultProps:Ib.getDefaultValues(kge),createGeometry:Dge,createLocationIterator:Lce.fromGroup,getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r){},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues(kge),createGeometry:Oge,createLocationIterator:Lce.fromGroup,getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}function Dge(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return uB.createEmpty(a);var s=2*o,u=Eee.create(s,s/4,a),c=t.conformation.invariantPosition,l=Cg(),d=Cg(),f=Cg();Xue(t,function(e,t,r,n,i){c(e,l),c(t,d);var a=mF(i)?zce:jce;Ege(f,l,Pge(f,Mge(f,d,l),a)),u.add(l[0],l[1],l[2],f[0],f[1],f[2],1,!1,!1,r),u.add(f[0],f[1],f[2],d[0],d[1],d[2],1,!1,!1,n)});var h=u.getCylinders(),p=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return h.setBoundingSphere(p),h}function Oge(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return sD.createEmpty(a);var s=i.radialSegments,u=i.sizeFactor,c=2*s*o*2,l=dO.createState(c,c/10,a),d=t.conformation.invariantPosition,f=Cg(),h=Cg(),p={radiusTop:1,radiusBottom:1,radialSegments:s},m=qF.create(r,t),g=qF.create(r,t);Xue(t,function(e,t,r,i,a){m.element=e,g.element=t,d(m.element,f),d(g.element,h);var o=mF(a)?zce:jce;p.radiusTop=p.radiusBottom=n.size.size(m)*u,l.currentGroup=r,uO(l,f,h,o,p),p.radiusTop=p.radiusBottom=n.size.size(g)*u,l.currentGroup=i,uO(l,h,f,1-o,p)});
139var v=dO.getMesh(l),y=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return v.setBoundingSphere(y),v}var Rge=Ac(Ac(Ac({},bee),xee),{sizeFactor:Ib.Numeric(.3,{min:0,max:10,step:.01}),detail:Ib.Numeric(0,{min:0,max:3,step:1},qI.CustomQualityParamInfo),tryUseImpostor:Ib.Boolean(!0)});function Bge(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth&&n.extensions.textureFloat?function(e){return See({defaultProps:Ib.getDefaultValues(Rge),createGeometry:Nge,createLocationIterator:Lce.fromGroup,getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r){},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return _ee({defaultProps:Ib.getDefaultValues(Rge),createGeometry:Fge,createLocationIterator:Lce.fromGroup,getLoci:Hce,eachLocation:Yce,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}function Nge(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return xR.createEmpty(a);var s=Ase.create(o,o/2,a),u=t.conformation.invariantPosition,c=Cg();Yue(t,function(e,t){u(e,c),s.add(c[0],c[1],c[2],t)});var l=s.getSpheres(),d=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return l.setBoundingSphere(d),l}function Fge(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return sD.createEmpty(a);var s=i.detail,u=i.sizeFactor,c=o*MD(s),l=dO.createState(c,c/2,a),d=t.conformation.invariantPosition,f=Cg(),h=qF.create(r,t);Yue(t,function(e,t){h.element=e,d(h.element,f),l.currentGroup=t,OD(l,f,n.size.size(h)*u,s)});var p=dO.getMesh(l),m=XE.expand(XE(),t.boundary.sphere,1*i.sizeFactor);return p.setBoundingSphere(m),p}var Lge={"polymer-backbone-cylinder":function(e,t){return vee("Polymer backbone cylinder",e,t,Ige)},"polymer-backbone-sphere":function(e,t){return vee("Polymer backbone sphere",e,t,Bge)},"polymer-gap":function(e,t){return vee("Polymer gap cylinder",e,t,Nfe)}},$ge=Ac(Ac(Ac(Ac({},Rge),kge),Bfe),{sizeAspectRatio:Ib.Numeric(1,{min:.1,max:3,step:.1}),visuals:Ib.MultiSelect(["polymer-backbone-cylinder","polymer-backbone-sphere","polymer-gap"],Ib.objectToOptions(Lge)),bumpFrequency:Ib.Numeric(0,{min:0,max:10,step:.1},qI.ShadingCategory)}),Uge={name:"backbone",label:"Backbone",description:"Displays polymer backbone with cylinders and spheres.",factory:function(e,t){return dJ.createMulti("Backbone",e,t,Iee,Lge)},getParams:function(e,t){var r=Ib.clone($ge),n=!1;return t.units.forEach(function(e){!n&&e.gapElements.length&&(n=!0)}),r.visuals.defaultValue=["polymer-backbone-cylinder","polymer-backbone-sphere"],n&&r.visuals.defaultValue.push("polymer-gap"),r},defaultValues:Ib.getDefaultValues($ge),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.polymerResidueCount>0}},jge=function(e){function t(){var r=e.call(this)||this;return Hg(t.BuiltIn,function(e,t){if(e.name!==t)throw Error(`Fix BuiltInStructureRepresentations to have matching names. ${e.name} ${t}`);r.add(e)}),r}return wc(t,e),t}(fJ);!function(e){e.BuiltIn={cartoon:epe,backbone:Uge,"ball-and-stick":Hse,carbohydrate:Wue,ellipsoid:ope,"gaussian-surface":Zpe,"gaussian-volume":Tge,label:ame,line:vge,"molecular-surface":xme,orientation:Ime,point:Ume,putty:Yme,spacefill:Qme}}(jge||={});var zge=function(){function e(e){var t=this;this.plugin=e,this.currentFrame=void 0,this._isAnimating=!1,this.frame=function(){t.tick(Kd()),t._isAnimating&&(t.currentFrame=requestAnimationFrame(t.frame))}}return Object.defineProperty(e.prototype,"isAnimating",{get:function(){return this._isAnimating},enumerable:!1,configurable:!0}),e.prototype.tick=function(e,t){var r;return Tc(this,void 0,void 0,function(){return Pc(this,function(n){switch(n.label){case 0:return[4,this.plugin.managers.animation.tick(e,t?.isSynchronous,t?.animation)];case 1:return n.sent(),null==(r=this.plugin.canvas3d)||r.tick(e,t),[2]}})})},e.prototype.resetTime=function(e){var t;void 0===e&&(e=Kd()),null==(t=this.plugin.canvas3d)||t.resetTime(e)},e.prototype.start=function(e){var t;null==(t=this.plugin.canvas3d)||t.resume(),this._isAnimating=!0,this.resetTime(),e?.immediate?this.frame():this.currentFrame=requestAnimationFrame(this.frame)},e.prototype.stop=function(e){var t;this._isAnimating=!1,void 0!==this.currentFrame&&(cancelAnimationFrame(this.currentFrame),this.currentFrame=void 0),null!=e&&e.noDraw&&(null==(t=this.plugin.canvas3d)||t.pause(e?.noDraw))},e}(),Gge=function(e){function t(r){var n=e.call(this)||this;return n.plugin=r,n.data=yS.create(new DS.Root({}),{runTask:n.plugin.runTask,globalContext:n.plugin,historyCapacity:n.plugin.config.get(j2.State.HistoryCapacity)}),n.behaviors=yS.create(new T2.Root({}),{runTask:n.plugin.runTask,globalContext:n.plugin,rootState:{isLocked:!0}}),n.events={cell:{stateUpdated:ix(n.data.events.cell.stateUpdated,n.behaviors.events.cell.stateUpdated),created:ix(n.data.events.cell.created,n.behaviors.events.cell.created),removed:ix(n.data.events.cell.removed,n.behaviors.events.cell.removed)},object:{created:ix(n.data.events.object.created,n.behaviors.events.object.created),removed:ix(n.data.events.object.removed,n.behaviors.events.object.removed),updated:ix(n.data.events.object.updated,n.behaviors.events.object.updated)}},n.snapshotParams=n.ev.behavior(t.DefaultSnapshotParams),n.setSnapshotParams=function(e){n.snapshotParams.next(Ac(Ac({},t.DefaultSnapshotParams),e))},n}return wc(t,e),Object.defineProperty(t.prototype,"animation",{get:function(){return this.plugin.managers.animation}
139,enumerable:!1,configurable:!0}),t.prototype.getSnapshot=function(e){var t=Ac(Ac({},this.snapshotParams.value),e);return{id:Wd.create22(),data:t.data?this.data.getSnapshot():void 0,behaviour:t.behavior?this.behaviors.getSnapshot():void 0,animation:t.animation?this.animation.getSnapshot():void 0,startAnimation:t.startAnimation?!!t.startAnimation:void 0,camera:t.camera?{current:this.plugin.canvas3d.camera.getSnapshot(),transitionStyle:t.cameraTransition.name,transitionDurationInMs:"animate"===t?.cameraTransition?.name?t.cameraTransition.params.durationInMs:void 0}:void 0,canvas3d:t.canvas3d?{props:this.plugin.canvas3d?.props}:void 0,interactivity:t.interactivity?{props:this.plugin.managers.interactivity.props}:void 0,structureFocus:this.plugin.managers.structure.focus.getSnapshot(),structureSelection:t.structureSelection?this.plugin.managers.structure.selection.getSnapshot():void 0,structureComponentManager:t.componentManager?{options:this.plugin.managers.structure.component.state.options}:void 0,durationInMs:t?.durationInMs}},t.prototype.setSnapshot=function(e){var t;return Tc(this,void 0,void 0,function(){var r;return Pc(this,function(n){switch(n.label){case 0:return[4,this.animation.stop()];case 1:return n.sent(),null!=(t=e.structureComponentManager)&&t.options&&this.plugin.managers.structure.component._setSnapshotState(e.structureComponentManager?.options),e.behaviour?[4,this.plugin.runTask(this.behaviors.setSnapshot(e.behaviour))]:[3,3];case 2:n.sent(),n.label=3;case 3:return e.data?[4,this.plugin.runTask(this.data.setSnapshot(e.data))]:[3,5];case 4:n.sent(),n.label=5;case 5:return e.canvas3d?.props?(r=Ib.normalizeParams(X5,e.canvas3d.props,"children"),[4,y2.Canvas3D.SetSettings(this.plugin,{settings:r})]):[3,7];case 6:n.sent(),n.label=7;case 7:return e.interactivity&&e.interactivity.props&&this.plugin.managers.interactivity.setProps(e.interactivity.props),e.structureFocus&&this.plugin.managers.structure.focus.setSnapshot(e.structureFocus),e.structureSelection&&this.plugin.managers.structure.selection.setSnapshot(e.structureSelection),e.animation&&this.animation.setSnapshot(e.animation),e.camera&&y2.Camera.Reset(this.plugin,{snapshot:e.camera.current,durationMs:"animate"===e.camera.transitionStyle?e.camera.transitionDurationInMs:void 0}),e.startAnimation&&this.animation.start(),[2]}})})},t.prototype.updateTransform=function(e,t,r,n){var i=e.build().to(t).update(r);return y2.State.Update(this.plugin,{state:e,tree:i,options:{canUndo:n}})},t.prototype.hasBehavior=function(e){return this.behaviors.tree.transforms.has(e.id)},t.prototype.updateBehavior=function(e,t){var r=this.behaviors.build();if(this.behaviors.tree.transforms.has(e.id))r.to(e.id).update(t);else{var n=e.createDefaultParams(void 0,this.plugin);r.to(T2.getCategoryId(e)).apply(e,nS(n,t),{ref:e.id})}return this.plugin.runTask(this.behaviors.updateTree(r))},t.prototype.dispose=function(){this.behaviors.cells.forEach(function(e){var t,r,n,i;T2.Behavior.is(e.obj)&&(null==(r=(t=e.obj.data).unregister)||r.call(t),null==(i=(n=e.obj.data).dispose)||i.call(n))}),e.prototype.dispose.call(this),this.data.dispose(),this.behaviors.dispose(),this.animation.dispose()},t}(E2);!function(e){e.SnapshotParams={durationInMs:Ib.Numeric(1500,{min:100,max:15e3,step:100},{label:"Duration in ms"}),data:Ib.Boolean(!0),behavior:Ib.Boolean(!1),structureSelection:Ib.Boolean(!1),componentManager:Ib.Boolean(!0),animation:Ib.Boolean(!0),startAnimation:Ib.Boolean(!1),canvas3d:Ib.Boolean(!0),interactivity:Ib.Boolean(!0),camera:Ib.Boolean(!0),cameraTransition:Ib.MappedStatic("animate",{animate:Ib.Group({durationInMs:Ib.Numeric(250,{min:100,max:5e3,step:500},{label:"Duration in ms"})}),instant:Ib.Group({})},{options:[["animate","Animate"],["instant","Instant"]]}),image:Ib.Boolean(!1)},e.DefaultSnapshotParams=Ib.getDefaultValues(e.SnapshotParams)}(Gge||={});var Vge=function(){function e(e){var t=this;this.plugin=e,this.ev=H_.create(),this.events={updated:this.ev(),removed:this.ev()},this.root=new Map,this.tracked=new Map,e.state.data.events.object.created.subscribe(function(e){t.addMapping(e.state,e.ref,e.obj)}),e.state.data.events.object.removed.subscribe(function(e){t.removeMapping(e.ref)&&t.events.removed.next({ref:e.ref,obj:e.obj})}),e.state.data.events.object.updated.subscribe(function(e){t.updateMapping(e.state,e.ref,e.oldObj,e.obj)&&t.events.updated.next({ref:e.ref,oldObj:e.oldObj,obj:e.obj})})}return e.prototype.getDecorator=function(e){var t=this.plugin.state.data.tree,r=t.children.get(e);if(1!==r.size)return e;var n=r.first();return t.transforms.get(n).transformer.definition.isDecorator?this.getDecorator(n):e},e.prototype.get=function(e,t){void 0===t&&(t=!1);var r=this.root.get(e);if(r)return t?this.plugin.state.data.cells.get(r.ref):this.plugin.state.data.cells.get(this.getDecorator(r.ref))},e.prototype.addMapping=function(e,t,r){if(!DS.Molecule.Structure.is(r))return!1;if(this.tracked.set(t,r.data),this.root.has(r.data))this.root.get(r.data).count++;else{var n=e.select(Zb.Generators.byRef(t).rootOfType([DS.Molecule.Structure]))[0];n?this.root.set(r.data,{ref:n.transform.ref,count:1}):this.root.set(r.data,{ref:t,count:1})}return!0},e.prototype.removeMapping=function(e){if(!this.tracked.has(e))return!1;var t=this.tracked.get(e);this.tracked.delete(e);var r=this.root.get(t);return r.count>1?r.count--:this.root.delete(t),!0},e.prototype.updateMapping=function(e,t,r,n){return!!DS.Molecule.Structure.is(n)&&(this.removeMapping(t),this.addMapping(e,t,n),!0)},e.prototype.dispose=function(){this.ev.dispose()},e}(),Hge=function(){function e(){this.ev=H_.create(),this.id=0,this.runningTasks=new Set,this.abortRequests=new Map,this.options=new Map,this.currentContext=[],this.events={progress:this.ev(),finished:this.ev()}}return e.prototype.tryGetAbortTaskId=function(e){if(this.abortRequests.has(e.progress.taskId))return e.progress.taskId;for(var t=0,r=e.children;t<r.length;t++){var n=r[t],i=this.tryGetAbortTaskId(n);if(void 0!==i)return i}},e.prototype.track=function(e,t){var r=this;return function(n){if(n.canAbort&&n.requestAbort){var i=r.tryGetAbortTaskId(n.root);void 0!==i&&n.requestAbort(r.abortRequests.get(i))}var a=Kd()-n.root.progress.startedTime;r.events.progress.next({id:e,useOverlay:r.options.get(t)?.useOverlay,level:a<250?"none":"background",progress:n})}},e.prototype.run=function(e,t){return Tc(this,void 0,void 0,function(){var r,n;return Pc(this,function(i){switch(i.label){case 0:r=this.id++,t?.createNewContext||0===this.currentContext.length?n={ctx:sy(e,this.track(r,e.id),100),refCount:1}:(n=this.currentContext[this.currentContext.length-1]).refCount++,i.label=1;case 1:return i.trys.push([1,,3,4]),this.options.set(e.id,{useOverlay:!!t?.useOverlay}),this.runningTasks.add(e.id),[4,uy(n.ctx,e)];case 2:return[2,i.sent()];case 3:return this.options.delete(e.id),this.runningTasks.delete(e.id),this.events.finished.next({id:r}),this.abortRequests.delete(e.id),n.refCount--,0===n.refCount&&Gb(this.currentContext,n),[7];case 4:return[2]}})})},e.prototype.requestAbortAll=function(e){var t=this;this.runningTasks.forEach(function(r){return t.abortRequests.set(r,e)})},e.prototype.requestAbort=function(e,t){var r="number"==typeof e?e:e.root.progress.taskId;this.abortRequests.set(r,t)},e.prototype.dispose=function(){this.ev.dispose()},e}();!function(e){e.testTask=function(e){var t=this;return vy.create("Test",function(r){return Tc(t,void 0,void 0,function(){var t;return Pc(this,function(n){switch(n.label){case 0:t=0,n.label=1;case 1:return t<e?[4,(i=100+200*Math.random(),new Promise(function(e){return setTimeout(e,i
139)}))]:[3,5];case 2:return n.sent(),r.shouldUpdate?[4,r.update({message:"Step "+t,current:t,max:e,isIndeterminate:!1})]:[3,4];case 3:n.sent(),n.label=4;case 4:return t++,[3,1];case 5:return[2]}var i})})})}}(Hge||={});var qge=function(e){function t(t){var r=e.call(this,{entries:_m()})||this;return r.events={changed:r.ev()},r.serialNumber=0,r.serialId=0,y2.Toast.Show.subscribe(t,function(e){return r.show(e)}),y2.Toast.Hide.subscribe(t,function(e){return r.hide(r.findByKey(e.key))}),r}return wc(t,e),t.prototype.findByKey=function(e){return this.state.entries.find(function(t){return!!t&&t.key===e})},t.prototype.show=function(e){var t,r=this,n=this.state.entries,i=void 0,a=++this.serialId;e.key&&(i=this.findByKey(e.key))?(void 0!==i.timeout&&clearTimeout(i.timeout),t=i.serialNumber,n=n.remove(i.id)):t=++this.serialNumber,i={id:a,serialNumber:t,key:e.key,title:e.title,message:e.message,timeout:this.timeout(a,e.timeoutMs),hide:function(){return r.hideId(a)}},this.updateState({entries:n.set(a,i)})&&this.events.changed.next(void 0)},t.prototype.timeout=function(e,t){var r=this;if(void 0!==t)return t<0&&(t=500),setTimeout(function(){var t=r.state.entries.get(e);t.timeout=void 0,r.hide(t)},t)},t.prototype.hideId=function(e){this.hide(this.state.entries.get(e))},t.prototype.hide=function(e){e&&(void 0!==e.timeout&&clearTimeout(e.timeout),e.hide=void 0,this.updateState({entries:this.state.entries.delete(e.id)})&&this.events.changed.next(void 0))},t}(M2),Wge=function(e){function t(t){var r=e.call(this)||this;return r.plugin=t,r._params=void 0,r.behaviors={values:r.ev.behavior({transparent:r.params.transparent.defaultValue,axes:{name:"off",params:{}},resolution:r.params.resolution.defaultValue}),cropParams:r.ev.behavior({auto:!0,relativePadding:.1}),relativeCrop:r.ev.behavior({x:0,y:0,width:1,height:1})},r.events={previewed:r.ev()},r.canvas=document.createElement("canvas"),r.previewCanvas=document.createElement("canvas"),r.previewData={image:{data:new Uint8ClampedArray(1),width:1,height:0},background:tv(0),transparent:!1},r}return wc(t,e),t.prototype.createParams=function(){var e=Math.min(this.plugin.canvas3d?this.plugin.canvas3d.webgl.maxRenderbufferSize:4096,4096);return{resolution:Ib.MappedStatic("viewport",{viewport:Ib.Group({}),hd:Ib.Group({}),"full-hd":Ib.Group({}),"ultra-hd":Ib.Group({}),custom:Ib.Group({width:Ib.Numeric(1920,{min:128,max:e,step:1}),height:Ib.Numeric(1080,{min:128,max:e,step:1})},{isFlat:!0})},{options:[["viewport","Viewport"],["hd","HD (1280 x 720)"],["full-hd","Full HD (1920 x 1080)"],["ultra-hd","Ultra HD (3840 x 2160)"],["custom","Custom"]]}),transparent:Ib.Boolean(!1),axes:O5.axes}},Object.defineProperty(t.prototype,"params",{get:function(){return this._params?this._params:this._params=this.createParams()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return this.behaviors.values.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cropParams",{get:function(){return this.behaviors.cropParams.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relativeCrop",{get:function(){return this.behaviors.relativeCrop.value},enumerable:!1,configurable:!0}),t.prototype.getCanvasSize=function(){return{width:this.plugin.canvas3d?.webgl.gl.drawingBufferWidth||0,height:this.plugin.canvas3d?.webgl.gl.drawingBufferHeight||0}},t.prototype.getSize=function(){var e=this.values;switch(e.resolution.name){case"viewport":return this.getCanvasSize();case"hd":return{width:1280,height:720};case"full-hd":return{width:1920,height:1080};case"ultra-hd":return{width:3840,height:2160};default:return{width:e.resolution.params.width,height:e.resolution.params.height}}},t.prototype.createPass=function(e){var t=this.plugin.canvas3d,r=t.webgl.extensions,n=r.colorBufferFloat,i=r.textureFloat,a=t.props.postprocessing.occlusion;return t.getImagePass({transparentBackground:this.values.transparent,cameraHelper:{axes:this.values.axes},multiSample:Ac(Ac({},t.props.multiSample),{mode:e?"on":"off",sampleLevel:n&&i?4:2}),postprocessing:Ac(Ac({},t.props.postprocessing),{occlusion:"on"===a.name?{name:"on",params:Ac(Ac({},a.params),{samples:128,resolutionScale:t.webgl.pixelRatio})}:a}),marking:Ac({},t.props.marking)})},Object.defineProperty(t.prototype,"previewPass",{get:function(){return this._previewPass||=this.createPass(!1)}
139,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imagePass",{get:function(){if(this._imagePass){var e=this.plugin.canvas3d,t=e.props.postprocessing.occlusion;return this._imagePass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:Ac(Ac({},e.props.postprocessing),{occlusion:"on"===t.name?{name:"on",params:Ac(Ac({},t.params),{samples:128,resolutionScale:e.webgl.pixelRatio})}:t}),marking:Ac({},e.props.marking)}),this._imagePass}return this._imagePass=this.createPass(!0)},enumerable:!1,configurable:!0}),t.prototype.getFilename=function(e){void 0===e&&(e=".png");var t=this.plugin.state.data.select(Zb.Generators.rootsOfType(DS.Molecule.Model)).map(function(e){return e.obj.data}),r=new Set;return t.forEach(function(e){return r.add(e.entryId.toUpperCase())}),`${mN.toArray(r).join("-")||"molstar-image"}${e}`},t.prototype.resetCrop=function(){this.behaviors.relativeCrop.next({x:0,y:0,width:1,height:1})},t.prototype.toggleAutocrop=function(){this.cropParams.auto?(this.behaviors.cropParams.next(Ac(Ac({},this.cropParams),{auto:!1})),this.resetCrop()):this.behaviors.cropParams.next(Ac(Ac({},this.cropParams),{auto:!0}))},Object.defineProperty(t.prototype,"isFullFrame",{get:function(){var e=this.relativeCrop;return yg(e.x,0,1e-5)&&yg(e.y,0,1e-5)&&yg(e.width,1,1e-5)&&yg(e.height,1,1e-5)},enumerable:!1,configurable:!0}),t.prototype.autocrop=function(e){void 0===e&&(e=this.cropParams.relativePadding);for(var t=this.previewData.image,r=t.data,n=t.width,i=t.height,a=this.previewData.transparent,o=a?this.previewData.background:4278190080|this.previewData.background,s=n,u=0,c=i,l=0,d=0;d<i;d++)for(var f=d*n,h=0;h<n;h++){var p=4*(f+h);if(a){if(0===r[p+3])continue}else if((r[p]<<16|r[p+1]<<8|r[p+2]|r[p+3]<<24)===o)continue;h<s&&(s=h),h>u&&(u=h),d<c&&(c=d),d>l&&(l=d)}if(s>u){var m=s;s=u,u=m}c>l&&(m=c,c=l,l=m);var g=u-s+1,v=l-c+1;s-=e*g,u+=e*g,c-=e*v,l+=e*v;var y={x:Math.max(0,s/n),y:Math.max(0,c/i),width:Math.min(1,(u-s+1)/n),height:Math.min(1,(l-c+1)/i)};this.behaviors.relativeCrop.next(y)},t.prototype.getPreview=function(e){void 0===e&&(e=320);var t=this.getSize(),r=t.width,n=t.height;if(!(r<=0||n<=0)){var i=r/n,a=0,o=0;i>1?(a=e,o=Math.round(e/i)):(o=e,a=Math.round(e*i));var s=this.plugin.canvas3d.props;this.previewPass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:s.postprocessing,marking:s.marking});var u=this.previewPass.getImageData(a,o),c=this.previewCanvas;c.width=u.width,c.height=u.height,this.previewData.image=u,this.previewData.background=s.renderer.backgroundColor,this.previewData.transparent=this.values.transparent;var l=c.getContext("2d");if(!l)throw Error("Could not create canvas 2d context");return l.putImageData(u,0,0),this.cropParams.auto&&this.autocrop(),this.events.previewed.next(void 0),{canvas:c,width:a,height:o}}},t.prototype.getSizeAndViewport=function(){var e=this.getSize(),t=e.width,r=e.height,n=this.relativeCrop,i={x:Math.floor(n.x*t),y:Math.floor(n.y*r),width:Math.ceil(n.width*t),height:Math.ceil(n.height*r)};return i.width+i.x>t&&(i.width=t-i.x),i.height+i.y>r&&(i.height=r-i.y),{width:t,height:r,viewport:i}},t.prototype.draw=function(e){return Tc(this,void 0,void 0,function(){var t,r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:return t=this.getSizeAndViewport(),r=t.width,n=t.height,i=t.viewport,r<=0||n<=0?[2]:[4,e.update("Rendering image...")];
139case 1:return c.sent(),[4,(a=this.imagePass).updateBackground()];case 2:return c.sent(),o=a.getImageData(r,n,i),[4,e.update("Encoding image...")];case 3:if(c.sent(),(s=this.canvas).width=o.width,s.height=o.height,!(u=s.getContext("2d")))throw Error("Could not create canvas 2d context");return u.putImageData(o,0,0),[2]}})})},t.prototype.copyToClipboardTask=function(){var e=this,t=navigator.clipboard;if(t?.write)return vy.create("Copy Image",function(r){return Tc(e,void 0,void 0,function(){var e,n;return Pc(this,function(i){switch(i.label){case 0:return[4,this.draw(r)];case 1:return i.sent(),[4,r.update("Converting image...")];case 2:return i.sent(),[4,D2(this.canvas,"png")];case 3:return e=i.sent(),n=new ClipboardItem({"image/png":e}),[4,t.write([n])];case 4:return i.sent(),this.plugin.log.message("Image copied to clipboard."),[2]}})})});this.plugin.log.error("clipboard.write not supported!")},t.prototype.getImageDataUri=function(){var e=this;return this.plugin.runTask(vy.create("Generate Image",function(t){return Tc(e,void 0,void 0,function(){return Pc(this,function(e){switch(e.label){case 0:return[4,this.draw(t)];case 1:return e.sent(),[4,t.update("Converting image...")];case 2:return e.sent(),[2,this.canvas.toDataURL("png")]}})})}))},t.prototype.copyToClipboard=function(){var e=this.copyToClipboardTask();if(e)return this.plugin.runTask(e)},t.prototype.downloadTask=function(e){var t=this;return vy.create("Download Image",function(r){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,this.draw(r)];case 1:return t.sent(),[4,r.update("Downloading image...")];case 2:return t.sent(),[4,D2(this.canvas,"png")];case 3:return N2(t.sent(),e??this.getFilename()),[2]}})})})},t.prototype.download=function(e){this.plugin.runTask(this.downloadTask(e))},t}(E2),Xge=function(){function e(e){this.plugin=e,this.handlers=[]}return e.prototype.addHandler=function(e,t){var r=this.handlers.findIndex(function(t){return t[0]===e});r<0?this.handlers.push([e,t]):this.handlers[r][1]=t},e.prototype.removeHandler=function(e){var t=this.handlers.findIndex(function(t){return t[0]===e});t>=0&&this.handlers.splice(t,1)},e.prototype.handle=function(e){return Tc(this,void 0,void 0,function(){var t;return Pc(this,function(r){switch(r.label){case 0:t=this.handlers.length-1,r.label=1;case 1:return t>=0?[4,(0,this.handlers[t][1])(e,this.plugin)]:[3,4];case 2:if(r.sent())return[2];r.label=3;case 3:return t--,[3,1];case 4:return function(e,t){var r=t.filter(function(e){var t=e.name.toLowerCase();return t.endsWith(".molx")||t.endsWith(".molj")});r.length>0?y2.State.Snapshots.OpenFile(e,{file:r[0]}):e.runTask(e.state.data.applyAction(rne,{files:t.map(function(e){return Cb.File(e)}),format:{name:"auto",params:{}},visuals:!0}))}(this.plugin,e),[2]}})})},e.prototype.dispose=function(){this.handlers.length=0},e}(),Yge=function(){function e(e){var t=this;this.spec=e,this.runTask=function(e,r){return t.managers.task.run(e,r)},this.resolveTask=function(e){if(e)return vy.is(e)?t.runTask(e):e},this.subs=[],this.initCanvas3dPromiseCallbacks=[function(){},function(){}],this._isInitialized=!1,this.initializedPromiseCallbacks=[function(){},function(){}],this.disposed=!1,this.canvasContainer=void 0,this.ev=H_.create(),this.config=new z2(this.spec.config),this.state=new Gge(this),this.commands=new v2,this.canvas3dInit=this.ev.behavior(!1),this.behaviors={state:{isAnimating:this.ev.behavior(!1),isUpdating:this.ev.behavior(!1),isBusy:this.ev.behavior(!1)},interaction:{hover:this.ev.behavior({current:dJ.Loci.Empty,modifiers:y3.None,buttons:0,button:0}),click:this.ev.behavior({current:dJ.Loci.Empty,modifiers:y3.None,buttons:0,button:0}),drag:this.ev.behavior({current:dJ.Loci.Empty,modifiers:y3.None,buttons:0,button:0,pageStart:Bg(),pageEnd:Bg()}),key:this.ev.behavior(S3),keyReleased:this.ev.behavior(S3),selectionMode:this.ev.behavior(!1)},labels:{highlight:this.ev.behavior({labels:[]})},layout:{leftPanelTabName:this.ev.behavior("root")},canvas3d:{initialized:this.canvas3dInit.pipe(ax(function(e){return!!e}),ox(1))}},this.canvas3dInitialized=new Promise(function(e,r){t.initCanvas3dPromiseCallbacks=[e,r]}),this.initialized=new Promise(function(e,r){t.initializedPromiseCallbacks=[e,r]}),this.layout=new Zoe(this),this.animationLoop=new zge(this),this.representation={structure:{registry:new jge,themes:{colorThemeRegistry:KZ.createRegistry(),sizeThemeRegistry:mQ.createRegistry()}},volume:{registry:new Hie,themes:{colorThemeRegistry:KZ.createRegistry(),sizeThemeRegistry:mQ.createRegistry()}}},this.query={structure:{registry:new _W}},this.dataFormats=new Mae,this.builders={data:new uae(this),structure:void 0},this.helpers={substructureParent:new Vge(this),viewportScreenshot:void 0},this.managers={structure:{hierarchy:new Eoe(this),component:new roe(this),measurement:new Ooe(this),selection:new Boe(this),focus:new noe(this)},volume:{hierarchy:new Xoe(this)},interactivity:void 0,camera:new Fae(this),animation:new kae(this),snapshot:new O2(this),lociLabels:void 0,toast:new qge(this),asset:new Bb,task:new Hge,dragAndDrop:new Xge(this)},this.events={log:this.ev(),task:this.managers.task.events,canvas3d:{settingsUpdated:this.ev()}},this.customModelProperties=new tae.Registry,this.customStructureProperties=new tae.Registry,this.customStructureControls=new Map,this.customImportControls=new Map,this.genericRepresentationControls=new Map,this.customState=Object.create(null),this.log={entries:om(),entry:function(e){return t.events.log.next(e)},error:function(e){return t.events.log.next(uS.error(e))},message:function(e){return t.events.log.next(uS.message(e))},info:function(e){return t.events.log.next(uS.info(e))},warn:function(e){return t.events.log.next(uS.warning(e))}},this.fetch=yb,iS(!1),function(e){CN="default"===e?wN:AN}(this.config.get(j2.Structure.SaccharideCompIdMapType)??"default")}return Object.defineProperty(e.prototype,"isInitialized",{get:function(){return this._isInitialized}
139,enumerable:!1,configurable:!0}),e.prototype.build=function(){return this.state.data.build()},e.prototype.initContainer=function(e){if(this.canvasContainer)return!0;var t=document.createElement("div");Object.assign(t.style,{position:"absolute",left:0,top:0,right:0,bottom:0,"-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none","touch-action":"manipulation"});var r=e?.canvas3dContext?.canvas;return r||(r=document.createElement("canvas"),null!=e&&e.checkeredCanvasBackground&&Object.assign(r.style,{"background-image":"linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%, lightgrey), linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%, lightgrey)","background-size":"60px 60px","background-position":"0 0, 30px 30px"}),t.appendChild(r)),!!this.initViewer(r,t,e?.canvas3dContext)&&(this.canvasContainer=t,!0)},e.prototype.mount=function(e,t){var r;if(this.disposed)throw Error("Cannot mount a disposed context");return!!this.initContainer(t)&&(this.canvasContainer.parentElement!==e&&(null==(r=this.canvasContainer.parentElement)||r.removeChild(this.canvasContainer)),e.appendChild(this.canvasContainer),this.handleResize(),!0)},e.prototype.unmount=function(){var e;null==(e=this.canvasContainer?.parentElement)||e.removeChild(this.canvasContainer)},e.prototype.initViewer=function(e,t,r){var n,i,a,o,s,u,c=this;try{if(this.layout.setRoot(t),this.spec.layout&&this.spec.layout.initial&&this.layout.setProps(this.spec.layout.initial),r)this.canvas3dContext=r;else{var l=!(null!=(n=this.config.get(j2.General.DisableAntialiasing))&&n),d=!(null!=(i=this.config.get(j2.General.DisablePreserveDrawingBuffer))&&i),f=this.config.get(j2.General.PixelScale)||1,h=this.config.get(j2.General.PickScale)||.25,p=this.config.get(j2.General.PickPadding)??1,m=this.config.get(j2.General.EnableWboit)||!1,g=this.config.get(j2.General.EnableDpoit)||!1,v=this.config.get(j2.General.PreferWebGl1)||!1,y=!(null!=(a=this.config.get(j2.General.AllowMajorPerformanceCaveat))&&a),b=this.config.get(j2.General.PowerPreference)||"high-performance";this.canvas3dContext=G5.fromCanvas(e,this.managers.asset,{antialias:l,preserveDrawingBuffer:d,pixelScale:f,pickScale:h,pickPadding:p,enableWboit:m,enableDpoit:g,preferWebGl1:v,failIfMajorPerformanceCaveat:y,powerPreference:b})}this.canvas3d=K5.create(this.canvas3dContext),this.canvas3dInit.next(!0);var _=this.spec.canvas3d,x=tv(16579577);return _?(void 0===_.renderer?.backgroundColor&&(_=oS(_,function(e){e.renderer?e.renderer.backgroundColor=x:e.renderer={backgroundColor:x}})),null==(s=this.canvas3d)||s.setProps(_)):null==(o=this.canvas3d)||o.setProps({renderer:{backgroundColor:x}}),this.animationLoop.start(),this.helpers.viewportScreenshot=new Wge(this),this.subs.push(this.canvas3d.interaction.click.subscribe(function(e){return c.behaviors.interaction.click.next(e)})),this.subs.push(this.canvas3d.interaction.drag.subscribe(function(e){return c.behaviors.interaction.drag.next(e)})),this.subs.push(this.canvas3d.interaction.hover.subscribe(function(e){return c.behaviors.interaction.hover.next(e)})),this.subs.push(this.canvas3d.input.resize.pipe((void 0===u&&(u=B_),w_(function(e,t){var r=null,n=null,i=null,a=function(){if(r){r.unsubscribe(),r=null;var e=n;n=null,t.next(e)}};function o(){var e=i+50,n=u.now();if(n<e)return r=this.schedule(void 0,e-n),void t.add(r);a()}e.subscribe(A_(t,function(e){n=e,i=u.now(),r||(r=u.schedule(o,50),t.add(r))},function(){a(),t.complete()},void 0,function(){n=r=null}))})),ux(100,void 0,{leading:!1,trailing:!0})).subscribe(function(){return c.handleResize()})),this.subs.push(this.canvas3d.input.keyDown.subscribe(function(e){return c.behaviors.interaction.key.next(e)})),this.subs.push(this.canvas3d.input.keyUp.subscribe(function(e){return c.behaviors.interaction.keyReleased.next(e)})),this.subs.push(this.layout.events.updated.subscribe(function(){return requestAnimationFrame(function(){return c.handleResize()})})),this.handleResize(),ny.setImmediate(function(){return c.initCanvas3dPromiseCallbacks[0]()}),!0}catch(e){return this.log.error(""+e),console.error(e),ny.setImmediate(function(){return c.initCanvas3dPromiseCallbacks[1](e)}),!1}},e.prototype.handleResize=function(){var e,t=this.canvas3dContext?.canvas,r=this.layout.root;r&&t&&(function(e,t,r){void 0===r&&(r=1);var n=window.innerWidth,i=window.innerHeight;t!==document.body&&(n=t.offsetWidth,i=t.offsetHeight),function(e,t,r,n){void 0===n&&(n=1),e.width=Math.round(window.devicePixelRatio*n*t),e.height=Math.round(window.devicePixelRatio*n*r),Object.assign(e.style,{width:`${t}px`,height:`${r}px`})}(e,n,i,r)}(t,r,this.config.get(j2.General.PixelScale)||1),null==(e=this.canvas3d)||e.requestResize())},Object.defineProperty(e.prototype,"isBusy",{get:function(){return this.behaviors.state.isAnimating.value||this.behaviors.state.isUpdating.value}
139,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectionMode",{get:function(){return this.behaviors.interaction.selectionMode.value},set:function(e){this.behaviors.interaction.selectionMode.next(e)},enumerable:!1,configurable:!0}),e.prototype.dataTransaction=function(e,t){return this.runTask(this.state.data.transaction(e,t))},e.prototype.clear=function(e){var t;return void 0===e&&(e=!1),e&&(null==(t=this.canvas3d)||t.setProps(Y5)),y2.State.RemoveObject(this,{state:this.state.data,ref:Rb.RootRef})},e.prototype.dispose=function(e){var t,r;if(!this.disposed){for(var n=0,i=this.subs;n<i.length;n++)i[n].unsubscribe();this.subs=[],this.animationLoop.stop(),this.commands.dispose(),null==(t=this.canvas3d)||t.dispose(),null==(r=this.canvas3dContext)||r.dispose(e),this.ev.dispose(),this.state.dispose(),this.helpers.substructureParent.dispose(),Hg(this.managers,function(e){return(e?.dispose)?.call(e)}),Hg(this.managers.structure,function(e){return(e?.dispose)?.call(e)}),Hg(this.managers.volume,function(e){return(e?.dispose)?.call(e)}),this.unmount(),this.canvasContainer=void 0,this.customState={},this.disposed=!0}},e.prototype.initBehaviorEvents=function(){var e=this;this.subs.push(ix(this.state.data.behaviors.isUpdating,this.state.behaviors.behaviors.isUpdating).subscribe(function(t){e.behaviors.state.isUpdating.value!==t&&e.behaviors.state.isUpdating.next(t)}));var t=this.config.get(j2.General.IsBusyTimeoutMs)||750,r=this.behaviors.state.isBusy,n=void 0,i=function(){r.value||r.next(!0)},a=function(){void 0!==n&&clearTimeout(n),n=void 0};this.subs.push(ix(this.behaviors.state.isUpdating,this.behaviors.state.isAnimating).subscribe(function(o){var s=e.behaviors.state.isUpdating.value,u=e.behaviors.state.isAnimating.value;s||u?r.value||(a(),n=setTimeout(i,t)):(a(),r.next(!1))})),this.subs.push(this.behaviors.interaction.selectionMode.subscribe(function(t){var r;t||null==(r=e.managers.interactivity)||r.lociSelects.deselectAll()}))},e.prototype.initBuiltInBehavior=function(){var e=this;Kte.State.registerDefault(this),Kte.Representation.registerDefault(this),Kte.Camera.registerDefault(this),Kte.Misc.registerDefault(this),this.subs.push(ix(this.state.data.events.log,this.state.behaviors.events.log).subscribe(function(t){return e.events.log.next(t)}))},e.prototype.initBehaviors=function(){return Tc(this,void 0,void 0,function(){var e,t,r,n,i,a,o,s,u;return Pc(this,function(c){switch(c.label){case 0:for(e=this.state.behaviors.build(),t=0,r=Object.keys(T2.Categories);t<r.length;t++)u=r[t],e.toRoot().apply(T2.CreateCategory,{label:T2.Categories[u]},{ref:u,state:{isLocked:!0}});for(n=0,i=this.spec.behaviors;n<i.length;n++)s=i[n],"custom-props"===(u=T2.getCategoryId(s.transformer))&&e.to(T2.getCategoryId(s.transformer)).apply(s.transformer,s.defaultParams,{ref:s.transformer.id});return[4,this.runTask(this.state.behaviors.updateTree(e,{doNotUpdateCurrent:!0,doNotLogTiming:!0}))];case 1:for(c.sent(),e=this.state.behaviors.build(),a=0,o=this.spec.behaviors;a<o.length;a++)s=o[a],"custom-props"!==(u=T2.getCategoryId(s.transformer))&&e.to(T2.getCategoryId(s.transformer)).apply(s.transformer,s.defaultParams,{ref:s.transformer.id});return[4,this.runTask(this.state.behaviors.updateTree(e,{doNotUpdateCurrent:!0,doNotLogTiming:!0}))];case 2:return c.sent(),[2]}})})},e.prototype.initCustomFormats=function(){if(this.spec.customFormats)for(var e=0,t=this.spec.customFormats;e<t.length;e++){var r=t[e];this.dataFormats.add(r[0],r[1])}},e.prototype.initAnimations=function(){if(this.spec.animations)for(var e=0,t=this.spec.animations;e<t.length;e++){var r=t[e];this.managers.animation.register(r)}},e.prototype.initDataActions=function(){if(this.spec.actions)for(var e=0,t=this.spec.actions;e<t.length;e++){var r=t[e];this.state.data.actions.add(r.action)}},e.prototype.init=function(){return Tc(this,void 0,void 0,function(){var e,t=this;return Pc(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.subs.push(this.events.log.subscribe(function(e){return t.log.entries=t.log.entries.push(e)})),this.initCustomFormats(),this.initBehaviorEvents(),this.initBuiltInBehavior(),this.managers.interactivity=new Lae(this),this.managers.lociLabels=new $ae(this),this.builders.structure=new _ae(this),this.initAnimations(),this.initDataActions(),[4,this.initBehaviors()];case 1:return r.sent(),this.log.message(`Mol* Plugin ${k2}
139 [${I2.toLocaleString()}]`),iy||this.log.message("Development mode enabled"),ay&&this.log.message("Debug mode enabled"),this._isInitialized=!0,this.initializedPromiseCallbacks[0](),[3,3];case 2:throw e=r.sent(),this.initializedPromiseCallbacks[1](e),e;case 3:return[2]}})})},e}(),Kge=e=>{var t;if(!(e?.entryId)?.startsWith("AF"))return!1;let r=e?.sourceData?.data?.frame?.categories;if(r&&"object"==typeof r&&"atom_site"in r&&r.atom_site){let e=((t=r.atom_site)?.getField)?.call(t,"group_PDB");if(e&&e.isDefined)for(let t=0;t<e.rowCount;t++)if("HETATM"===e.str(t))return!1}return!0},Zge={local_metric_values:{label_asym_id:xv.Schema.str,label_comp_id:xv.Schema.str,label_seq_id:xv.Schema.int,metric_id:xv.Schema.int,metric_value:xv.Schema.float,model_id:xv.Schema.int,ordinal_id:xv.Schema.int}},Qge=(e,t)=>{let r=((e,t)=>{if(!qz.is(t.sourceData)||!t.sourceData.data.frame.categoryNames.includes(e))return;let r=t.sourceData.data.frame.categories[e].getField("metric_value");return r&&0!==r.rowCount?{timestamp_utc:r.str(0)||R2(new Date)}:void 0})("ma_qa_metric_local",t);if(r)return{info:r,data:function(e,t){let r=new Map,{label_asym_id:n,label_seq_id:i,metric_value:a,_rowCount:o}=t,s=[];for(let t=0;t<o;t++){let o=a.value(t),u=e.atomicHierarchy.index.findResidue("1",n.value(t),i.value(t),""),c="Very low";o>50&&o<=70?c="Low":o>70&&o<=90?c="Medium":o>90&&(c="High"),r.set(u,[o,c]),Hb(s,c)}return{score:Pz.fromResidueMap(r),category:s}}(t,function(e){if(!qz.is(e.sourceData))throw Error("Data format must be mmCIF.");return{residues:nA(Zge.local_metric_values,e.sourceData.data.frame.categories.ma_qa_metric_local)}}(t).residues)}};function Jge(e){if(!tU.isAtomic(e.unit))return[-1,"No Score"];let t=nve.get(e.unit.model).value;if(!t||!t.data)return[-1,"No Score"];let r=e.unit.residueIndex[e.element];return t.data.score.has(r)?t.data.score.get(r):[-1,"No Score"]}var eve,tve=[],rve={serverUrl:Ib.Text("",{description:"JSON API Server URL"})},nve=xz.createProvider({label:"AF Confidence Score",descriptor:{name:"af_confidence_score"},type:"static",defaultParams:rve,getParams:e=>rve,isApplicable:e=>Kge(e),obtain:async(e,t,r)=>(Ib.getDefaultValues(rve),await async function(e,t){return{value:Qge(0,t)}}(0,t))}),ive={"No Score":tv.fromRgb(170,170,170),"Very low":tv.fromRgb(255,125,69),Low:tv.fromRgb(255,219,19),Medium:tv.fromRgb(101,203,243),High:tv.fromRgb(0,83,214)},ave={type:Ib.MappedStatic("score",{score:Ib.Group({}),category:Ib.Group({kind:Ib.Text()})})},ove={name:"af-confidence",label:"AF Confidence",category:KZ.Category.Validation,factory:function e(t,r){let n;if(t.structure&&!t.structure.isEmpty&&t.structure.models[0].customProperties.has(nve.descriptor))if("score"===r.type.name)n=e=>qF.is(e)?ive[Jge(e)[1]]:ive["No Score"];else{let e=r.type.params.kind;n=t=>{if(qF.is(t)){let r=Jge(t);return r[1]===e?ive[r[1]]:ive["No Score"]}return ive["No Score"]}}else n=()=>ive["No Score"];return{factory:e,granularity:"group",color:n,props:r,description:"Assigns residue colors according to the AF Confidence score"}},getParams:e=>{let t=function(e){if(!e)return tve;let t=nve.get(e.models[0]).value;return t&&t.data?t.data.category:tve}(e.structure);return 0===t.length?{type:Ib.MappedStatic("score",{score:Ib.Group({})})}:{type:Ib.MappedStatic("score",{score:Ib.Group({}),category:Ib.Group({kind:Ib.Select(t[0],Ib.arrayToOptions(t))},{isFlat:!0})})}},defaultValues:Ib.getDefaultValues(ave),isApplicable:e=>Kge(e.structure?.models[0]),ensureCustomProperties:{attach:(e,t)=>t.structure?nve.attach(e,t.structure.models[0],void 0,!0):Promise.resolve(),detach:e=>e.structure&&e.structure.models[0].customProperties.reference(nve.descriptor,!1)}},sve=T2.create({name:"af-confidence-prop",category:"custom-props",display:{name:"AlphaFold Confidence Score",description:"AlphaFold Confidence Score."},ctor:class extends T2.Handler{constructor(){super(...arguments),this.provider=nve,this.labelAfConfScore={label:e=>{if(this.params.showTooltip&&"element-loci"===e.kind&&0!==e.elements.length){let t=e.elements[0],r=t.unit;if(!r.model.customProperties.hasReference(nve.descriptor))return;
139let n=Jge(qF.create(e.structure,r,r.elements[kP.getAt(t.indices,0)]));return n&&+n[0]>0?`Confidence score: ${n[0]} <small>( ${n[1]} )</small>`:""}}}}register(){this.ctx.customModelProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelAfConfScore),this.ctx.representation.structure.themes.colorThemeRegistry.add(ove)}update(e){let t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customModelProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}unregister(){this.ctx.customModelProperties.unregister(nve.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelAfConfScore),this.ctx.representation.structure.themes.colorThemeRegistry.remove(ove)}},params:()=>({autoAttach:Ib.Boolean(!1),showTooltip:Ib.Boolean(!0)})});function uve(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function cve(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function lve(e){let t,r,n;function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===uve||e===cve?e:dve,r=e,n=e):(t=uve,r=(t,r)=>uve(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function dve(){return 0}!function(e){function t(e,t,r){return{name:e.descriptor.name,label:e.label,category:"Custom",factory:function n(i,a){var o,s=i.structure&&e.get(i.structure.models[0]),u=s?.version;if(s?.value&&i.structure){var c=s.value;o=function(e){if(qF.is(e)){var n=c.get(e.element);if(void 0!==n)return t(n)}return r}}else o=function(){return r};return{factory:n,granularity:"group",color:o,props:a,contextHash:u,description:`Assign element colors based on '${e.label}' data.`}},getParams:function(){return{}},defaultValues:{},isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(t,r){return r.structure?e.attach(t,r.structure.models[0],void 0,!0):Promise.resolve()},detach:function(t){return t.structure&&t.structure.models[0].customProperties.reference(e.descriptor,!1)}}}}function r(e,t){return{label:function(r){if("element-loci"===r.kind){var n=r.elements[0];if(!n||!n.unit.model.customProperties.hasReference(e.descriptor))return;var i=e.get(n.unit.model).value,a=n.unit.elements[kP.start(n.indices)],o=i?.get(a);return void 0===o?void 0:t(o)}}}}e.create=function(e){var n=function(e){var t=this;return xz.createProvider({label:e.label,descriptor:{name:e.name},type:e.type||"dynamic",defaultParams:{},getParams:function(e){return{}},isApplicable:function(t){return!e.isApplicable||!!e.isApplicable(t)},obtain:function(r,n){return Tc(t,void 0,void 0,function(){return Pc(this,function(t){switch(t.label){case 0:return[4,e.getData(n,r)];case 1:return[2,t.sent()]}})})}})}(e);return{propertyProvider:n,colorThemeProvider:e.coloring?.getColor&&t(n,e.coloring.getColor,e.coloring.defaultColor),labelProvider:e.getLabel&&r(n,e.getLabel)}}}(eve||={});var fve=lve(uve).right;lve(function(e){return null===e?NaN:+e}).center;var hve=Math.sqrt(50),pve=Math.sqrt(10),mve=Math.sqrt(2);function gve(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=hve?10:u>=pve?5:u>=mve?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?gve(e,t,2*r):[n,i,a]}function vve(e,t,r){return gve(e=+e,t=+t,r=+r)[2]}function yve(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function bve(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function _ve(){}var xve=.7,Sve=1/xve,wve="\\s*([+-]?\\d+)\\s*",Ave="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cve="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Tve=/^#([0-9a-f]{3,8})$/,Pve=RegExp(`^rgb\\(${wve},${wve},${wve}\\)$`),Eve=RegExp(`^rgb\\(${Cve},${Cve},${Cve}\\)$`),Mve=RegExp(`^rgba\\(${wve},${wve},${wve},${Ave}\\)$`),kve=RegExp(`^rgba\\(${Cve},${Cve},${Cve},${Ave}\\)$`),Ive=RegExp(`^hsl\\(${Ave},${Cve},${Cve}\\)$`),Dve=RegExp(`^hsla\\(${Ave},${Cve},${Cve},${Ave}\\)$`),Ove={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Rve(){return this.rgb().formatHex()}function Bve(){return this.rgb().formatRgb()}function Nve(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Tve.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?Fve(t):3===r?new Uve(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?Lve(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?Lve(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Pve.exec(e))?new Uve(t[1],t[2],t[3],1):(t=Eve.exec(e))?new Uve(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Mve.exec(e))?Lve(t[1],t[2],t[3],t[4]):(t=kve.exec(e))?Lve(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ive.exec(e))?qve(t[1],t[2]/100,t[3]/100,1):(t=Dve.exec(e))?qve(t[1],t[2]/100,t[3]/100,t[4]):Ove.hasOwnProperty(e)?Fve(Ove[e]):"transparent"===e?new Uve(NaN,NaN,NaN,0):null}function Fve(e){return new Uve(e>>16&255,e>>8&255,255&e,1)}function Lve(e,t,r,n){return n<=0&&(e=t=r=NaN),new Uve(e,t,r,n)}function $ve(e,t,r,n){return 1===arguments.length?function(e){return e instanceof _ve||(e=Nve(e)),e?new Uve((e=e.rgb()).r,e.g,e.b,e.opacity):new Uve}(e):new Uve(e,t,r,n??1)}function Uve(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function jve(){return`#${Hve(this.r)}${Hve(this.g)}${Hve(this.b)}`}function zve(){let e=Gve(this.opacity);return`${1===e?"rgb(":"rgba("}${Vve(this.r)}, ${Vve(this.g)}, ${Vve(this.b)}${1===e?")":`, ${e})`}`}function Gve(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hve(e){return((e=Vve(e))<16?"0":"")+e.toString(16)}function qve(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Xve(e,t,r,n)}function Wve(e){if(e instanceof Xve)return new Xve(e.h,e.s,e.l,e.opacity);if(e instanceof _ve||(e=Nve(e)),!e)return new Xve;if(e instanceof Xve)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new Xve(o,s,u,e.opacity)}function Xve(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function Yve(e){return(e=(e||0)%360)<0?e+360:e}function Kve(e){return Math.max(0,Math.min(1,e||0))}function Zve(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}yve(_ve,Nve,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rve,formatHex:Rve,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Wve(this).formatHsl()},formatRgb:Bve,toString:Bve}),yve(Uve,$ve,bve(_ve,{brighter(e){return e=null==e?Sve:Sve**+e,new Uve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?xve:xve**+e,new Uve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Uve(Vve(this.r),Vve(this.g),Vve(this.b),Gve(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jve,formatHex:jve,formatHex8:function(){return`#${Hve(this.r)}${Hve(this.g)}${Hve(this.b)}${Hve(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:zve,toString:zve})),yve(Xve,function(e,t,r,n){return 1===arguments.length?Wve(e):new Xve(e,t,r,n??1)},bve(_ve,{brighter(e){return e=null==e?Sve:Sve**+e,new Xve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?xve:xve**+e,new Xve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Uve(Zve(e>=240?e-240:e+120,i,n),Zve(e,i,n),Zve(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Xve(Yve(this.h),Kve(this.s),Kve(this.l),Gve(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Gve(this.opacity);return`${1===e?"hsl(":"hsla("}${Yve(this.h)}, ${100*Kve(this.s)}%, ${100*Kve(this.l)}%${1===e?")":`, ${e})`}`}}));var Qve=e=>()=>e;function Jve(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):Qve(isNaN(e)?t:e)}var eye=function e(t){var r=function(e){return 1==(e=+e)?Jve:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):Qve(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=$ve(e)).r,(t=$ve(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Jve(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function tye(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function rye(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=cye(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function nye(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function iye(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function aye(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=cye(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}var oye=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sye=new RegExp(oye.source,"g");function uye(e,t){var r,n,i,a=oye.lastIndex=sye.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=oye.exec(e))&&(n=sye.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:iye(r,n)})),a=sye.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function cye(e,t){var r,n=typeof t;return null==t||"boolean"===n?Qve(t):("number"===n?iye:"string"===n?(r=Nve(t))?(t=r,eye):uye:t instanceof Nve?eye:t instanceof Date?nye:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?tye:Array.isArray(t)?rye:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?aye:iye)(e,t)}function lye(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function dye(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function fye(e){return(e=dye(Math.abs(e)))?e[1]:NaN}var hye,pye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mye(e){if(!(t=pye.exec(e)))throw Error("invalid format: "+e);var t;return new gye({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function gye(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function vye(e,t){var r=dye(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}mye.prototype=gye.prototype,gye.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?""
vendor: 2,219 bytes, line 139
139:Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var yye={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>vye(100*e,t),r:vye,s:function(e,t){var r=dye(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(hye=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+dye(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function bye(e){return e}var _ye,xye,Sye,wye=Array.prototype.map,Aye=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Cye(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Tye(e){return+e}_ye=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?bye:(t=wye.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?bye:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(wye.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=mye(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):yye[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=yye[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;
vendor: 2,541 bytes, line 139
139if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?Aye[8+hye/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=mye(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(fye(t)/3))),i=10**-n,a=Aye[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),xye=_ye.format,Sye=_ye.formatPrefix;var Pye=[0,1];function Eye(e){return e}function Mye(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function kye(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=Mye(i,n),a=r(o,a)):(n=Mye(n,i),a=r(a,o)),function(e){return a(n(e))}}function Iye(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=Mye(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=fve(e,t,1,n)-1;return a[r](i[r](t))}}function Dye(e,t,r){this.k=e,this.x=t,this.y=r}Dye.prototype={constructor:Dye,scale:function(e){return 1===e?this:new Dye(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Dye(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Dye.prototype;
139var Oye,Rye=/\s*\n\s*/,Bye=/^(.)(\d+)(.),(.+),(\w+)$/,Nye=function e(){var t=function(){var e,t,r,n,i,a,o=Pye,s=Pye,u=cye,c=Eye;function l(){var e=Math.min(o.length,s.length);return c!==Eye&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?Iye:kye,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),iye))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,Tye),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=lye,l()},d.clamp=function(e){return arguments.length?(c=!!e||Eye,l()):c!==Eye},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}()(Eye,Eye);return t.copy=function(){return r=t,e().domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown());var r},Cye.apply(t,arguments),function(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?gve(t,e,r):gve(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return function(e,t,r,n){var i,a=function(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?vve(t,e,r):vve(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}(e,t,r);switch((n=mye(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(fye(t)/3)))-fye(Math.abs(e)))}(a,o))||(n.precision=i),Sye(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,fye(t)-fye(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-fye(Math.abs(e)))}(a))||(n.precision=i-2*("%"===n.type))}return xye(n)}(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=vve(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}(t)}([0,.1132,.2264,.3395,.4527,.5895,.7264,.8632,1],["#2166ac","#4290bf","#8cbcd4","#c3d6e0","#e2e2e2","#edcdba","#e99e7c","#d15e4b","#b2182b"]),Fye=tv(0),Lye=e=>e.reduce((e,t)=>e+t,0)/e.length,$ye=eve.create({label:"Colour by Alphamissense pathogenecity",name:"basic-wrapper-am-coloring",getData:async e=>{let t=new Map;if(e.entry.startsWith("AF")){let r=e.atomicHierarchy.residueAtomSegments.index,n=e.atomicHierarchy.atoms._rowCount,i=(e=>{var t;let r=[];for(let[n,i]of e.split(Rye).entries()){if(0===n||!i)continue;let e=i.match(Bye);if(!e)throw Error(`FormatError: cannot parse "${i}" as a mutation (should look like Y123A)`);(r[t=e[2]-1]??(r[t]=[])).push(+e[4])}return r})(await(await fetch(`https://alphafold.ebi.ac.uk/files/${e.entry}-aa-substitutions.csv`)).text());for(let e=0;e<n;e++){let n=Lye(i[r[e]]);t.set(e,n)}}return{value:t}},coloring:{getColor:e=>{let{r:t,g:r,b:n}=(e=>{let t=Nve(e)?.rgb()||{r:100,g:100,b:100};return{r:t.r,g:t.g,b:t.b}})(Nye(e));return tv.fromRgb(t,r,n)},defaultColor:Fye},getLabel:e=>`Pathogenecity Score: ${e}`}),Uye=(j2.Viewport.ShowControls.defaultValue,j2.Viewport.ShowSettings.defaultValue,{actions:[eae.Action(ine.Structure.DownloadStructure),eae.Action(ine.Volume.DownloadDensity),eae.Action(ine.DataFormat.DownloadFile),eae.Action(ine.DataFormat.OpenFiles),eae.Action(ine.Structure.LoadTrajectory),eae.Action(ine.Structure.EnableModelCustomProps),eae.Action(ine.Structure.EnableStructureCustomProps),eae.Action(Wie),eae.Action(Xie),eae.Action(Zie),eae.Action(m2.Data.Download),eae.Action(m2.Data.ParseCif),eae.Action(m2.Data.ParseCcp4),eae.Action(m2.Data.ParseDsn6),eae.Action(m2.Model.TrajectoryFromMmCif),eae.Action(m2.Model.TrajectoryFromCifCore),eae.Action(m2.Model.TrajectoryFromPDB),eae.Action(m2.Model.TransformStructureConformation),eae.Action(m2.Model.StructureFromModel),eae.Action(m2.Model.StructureFromTrajectory),eae.Action(m2.Model.ModelFromTrajectory),eae.Action(m2.Model.StructureSelectionFromScript),eae.Action(m2.Representation.StructureRepresentation3D),eae.Action(m2.Representation.StructureSelectionsDistance3D),eae.Action(m2.Representation.StructureSelectionsAngle3D),eae.Action(m2.Representation.StructureSelectionsDihedral3D),eae.Action(m2.Representation.StructureSelectionsLabel3D),eae.Action(m2.Representation.StructureSelectionsOrientation3D),eae.Action(m2.Representation.ModelUnitcell3D),eae.Action(m2.Representation.StructureBoundingBox3D),eae.Action(m2.Representation.ExplodeStructureRepresentation3D),eae.Action(m2.Representation.SpinStructureRepresentation3D),eae.Action(m2.Representation.UnwindStructureAssemblyRepresentation3D),eae.Action(m2.Representation.OverpaintStructureRepresentation3DFromScript),eae.Action(m2.Representation.TransparencyStructureRepresentation3DFromScript),eae.Action(m2.Representation.ClippingStructureRepresentation3DFromScript),eae.Action(m2.Representation.SubstanceStructureRepresentation3DFromScript),eae.Action(m2.Representation.ThemeStrengthRepresentation3D),eae.Action(Zre),eae.Action(m2.Volume.VolumeFromCcp4),eae.Action(m2.Volume.VolumeFromDsn6),eae.Action(m2.Volume.VolumeFromCube),eae.Action(m2.Volume.VolumeFromDx),eae.Action(m2.Representation.VolumeRepresentation3D)],behaviors:[eae.Behavior(Zte.Representation.HighlightLoci),eae.Behavior(Zte.Representation.SelectLoci),eae.Behavior(Zte.Representation.DefaultLociLabelProvider),eae.Behavior(Zte.Representation.FocusLoci),eae.Behavior(Zte.Camera.FocusLoci),eae.Behavior(Zte.Camera.CameraAxisHelper),eae.Behavior(Zte.Camera.CameraControls),eae.Behavior(ore),eae.Behavior(Zte.CustomProps.StructureInfo),eae.Behavior(Zte.CustomProps.AccessibleSurfaceArea),eae.Behavior(Zte.CustomProps.BestDatabaseSequenceMapping),eae.Behavior(Zte.CustomProps.Interactions),eae.Behavior(Zte.CustomProps.SecondaryStructure),eae.Behavior(Zte.CustomProps.ValenceModel),eae.Behavior(Zte.CustomProps.CrossLinkRestraint)],animations:[A2,w2,sae,P2,b2,nae,rae]}),jye={actions:Uye.actions,behaviors:[...Uye.behaviors,eae.Behavior(sve,{autoAttach:!0,showTooltip:!0})],layout:{initial:{isExpanded:!1,showControls:!1,controlsDisplay:"reactive"}}
139,config:[[j2.General.DisableAntialiasing,!1],[j2.General.PixelScale,1],[j2.General.EnableWboit,!1],[j2.Viewport.ShowExpand,!0],[j2.Viewport.ShowSelectionMode,!1],[j2.Download.DefaultPdbProvider,"pdbe"],[j2.Structure.DefaultRepresentationPresetParams,{theme:{globalName:"af-confidence",carbonByChainId:!1,focus:{name:"element-symbol",params:{carbonByChainId:!1}}}}]]},zye=async(e,t,r)=>{let n=new Yge(jye);await n.init();let i=e.querySelector("canvas");if(!i||!n.initViewer(i,e))throw Error("Failed to init Mol*");return $ye.colorThemeProvider&&n.representation.structure.themes.colorThemeRegistry.add($ye.colorThemeProvider),$ye.labelProvider&&n.managers.lociLabels.addProvider($ye.labelProvider),n.customModelProperties.register($ye.propertyProvider,!0),n.behaviors.interaction.click.subscribe(e=>{if(Az.is(e.current.loci)){let r=qF.create();Az.getFirstLocation(e.current.loci,r),t([{position:Cj.residue.label_seq_id(r),chain:Cj.chain.auth_asym_id(r)}])}}),y2.Canvas3D.SetSettings(n,{settings:({renderer:e,marking:t})=>{e.backgroundColor=tv(15658734),t.edgeScale=1.5,e.selectStrength=0,e.highlightStrength=1}}),{plugin:n,async loadPdb(e){await this.loadFromUrl(`https://www.ebi.ac.uk/pdbe/model-server/v1/${e.toLowerCase()}/full?encoding=bcif`,!0)},async loadFromUrl(e,t=!1){let i=await n.builders.data.download({url:e,isBinary:t},{state:{isGhost:!0}}),a=await n.builders.structure.parseTrajectory(i,e.endsWith(".pdb")?"pdb":"mmcif");await n.builders.structure.hierarchy.applyPreset(a,"all-models",{useDefaultIfSingleModel:!0}),this.applyColorTheme(r)},applyColorTheme(e){let t;t="alphamissense"===e?$ye.propertyProvider.descriptor.name:ove.name,n?.dataTransaction(async()=>{for(let e of n?.managers.structure.hierarchy.current.structures||[])await(n?.managers.structure.component.updateRepresentationsTheme(e.components,{color:t}))})},highlight(e){let t=n.managers.structure.hierarchy.current.structures[0]?.cell.obj?.data;if(!t)return;let r=mq.getStructureSelection(t=>t.struct.generator.atomGroups({"residue-test":t.core.logic.or(e.map(({start:e,end:r,chain:n})=>t.core.logic.and([t.core.rel.inRange([t.struct.atomProperty.macromolecular.label_seq_id(),e,r]),t.core.rel.eq([t.struct.atomProperty.macromolecular.auth_asym_id(),n])])))}),t),i=oU.toLociWithSourceUnits(r);n.managers.camera.focusLoci(i),n.managers.interactivity.lociSelects.selectOnly({loci:i})},clearHighlight(){n.managers.interactivity.lociSelects.deselectAll(),y2.Camera.Reset(n,{})},changeHighlightColor(e){y2.Canvas3D.SetSettings(n,{settings:({renderer:t,marking:r})=>{r.selectEdgeColor=tv(e),r.highlightEdgeColor=tv(e),t.highlightColor=tv(e)}})},handleResize(){n.layout.events.updated.next(null)}}},Gye=class extends Error{},Vye=(e,t,r,n)=>{if(!n)return[];if(!e||!t||Number.isNaN(e)||Number.isNaN(t))throw new Gye("Invalid start, end coordinates");let i=new Map;for(let e of n){let t=i.get(e.chain_id)||[];t.push(e),i.set(e.chain_id,t)}let a=[];for(let n of i.values()){let i=null,o=null;for(let a of n){if(a.unp_end-a.unp_start!=a.end.residue_number-a.start.residue_number)throw new Gye("Mismatch between protein sequence and structure residues");let[n,s]="UP_PDB"===r?[a.unp_start,a.unp_end]:[a.start.residue_number,a.end.residue_number];if(!i&&e>=n&&e<=s&&(i=a),!o&&t>=n&&t<=s&&(o=a),i&&o)break}if(i&&o){let n="UP_PDB"===r?1:-1;a.push({entity:i.entity_id,chain:i.chain_id,start:e+n*(i.start.residue_number-i.unp_start),end:t+n*(o.start.residue_number-o.unp_start)})}}if(!a.length)throw new Gye("Start or end coordinate outside of mapping range");return a},Hye=class extends(bu(wu(_c))){constructor(){super(),this.message={title:"title",content:"message"},Oye.set(this,void 0),this.updateHighlight=this.updateHighlight.bind(this)}render(){return bl`<style>
140        /* nightingale-structure h4 {
141          display: inline;
142          margin-right: 1em;
143        } */
144
145        /* @property --custom-structure-height {
146          syntax: "<length-percentage>";
147          inherits: false;
148          initial-value: 480px;
149        } */
150
151        nightingale-structure {
152          width: 100%;
153        }
154
155        .structure-viewer-container {
156          position: relative;
157          height: var(--custom-structure-height, 480px);
158        }
159
160        .structure-viewer-messages {
161          opacity: 0.75;
162          position: absolute;
163          right: 0;
164          bottom: 0;
165          border: 1px solid gray;
166          padding: 1ch;
167        }
168
169        .structure-viewer-messages > *:first-child {
170          font-weight: bold;
171        }
172
173        .structure-viewer-message-content {
174          white-space: pre-wrap;
175          line-height: normal;
176        }
177
178        .structure-viewer-messages > button {
179          font-size: 75%;
180          font-weight: bold;
181          position: absolute;
182          top: -2px;
183          right: 0px;
184          border: none;
185          background: transparent;
186          cursor: pointer;
187          padding: 0px 3px;
188        }
189      </style>
190      <div id="molstar-parent" class="structure-viewer-container">
191        <canvas
192          id="molstar-canvas"
193          style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"
194        ></canvas>
195        ${this.message&&this["structure-id"]?bl`<div class="structure-viewer-messages">
196              <span>${this.message?.title}</span>:
197              <span
198                class="structure-viewer-message-content"
199                .innerHTML=${qd.sanitize(this.message?.content??"")}
200              ></span>
201              <button
202                type="button"
203                title="close message"
204                @click="${this.clearMessage}"
205              >
206                x
207              </button>
208            </div> `:xl}
209      </div>`}firstUpdated(){let e=this.renderRoot.querySelector("#molstar-parent");e&&zye(e,this.updateHighlight,this["color-theme"]).then(e=>{!function(e,t,r){if("function"==typeof t||!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,r)}(this,Oye,e);let t=this["highlight-color"].substring(1,7);Dc(this,Oye,"f").changeHighlightColor(parseInt(t,16)),this.selectMolecule()})}updated(e){var t,r,n;if((e.has("structure-id")||e.has("model-url"))&&this.selectMolecule(),(e.has("highlight")||e.has("selectedMolecule"))&&this.highlightChain(),e.has("highlight-color")){let e=this["highlight-color"].substring(1,7);null==(t=Dc(this,Oye,"f"))||t.changeHighlightColor(parseInt(e,16)),null==(r=Dc(this,Oye,"f"))||r.plugin.handleResize()}e.has("color-theme")&&(null==(n=Dc(this,Oye,"f"))||n.applyColorTheme(this["color-theme"]))}disconnectedCallback(){var e;super.disconnectedCallback(),null==(e=Dc(this,Oye,"f"))||e.plugin.dispose()}async loadPDBEntry(e){var t;null==(t=Dc(this,Oye,"f"))||t.plugin.clear(),this.showMessage("Loading",e);try{return await fetch(`https://www.ebi.ac.uk/pdbe/api/mappings/uniprot/${e}`).then(e=>e.json())}catch(t){throw this.showMessage("Error",`Couldn't load PDB entry "${e}"`),t}}async loadAFEntry(e){var t;null==(t=Dc(this,Oye,"f"))||t.plugin.clear(),this.showMessage("Loading",e);try{return await fetch(`https://alphafold.ebi.ac.uk/api/prediction/${e}`).then(e=>e.json())}catch(t){throw this.showMessage("Error",`Couldn't load AF entry "${e}"`),t}}isAF(){return this["structure-id"]?.startsWith("AF-")}async selectMolecule(){var e;if(this["structure-id"]&&this["model-url"])return void console.error("Structure ID and Model URL both are present. Provide only one that you would want to take precedence");let t;if(this["structure-id"]&&this["protein-accession"]){if(this.isAF()){let e=(await this.loadAFEntry(this["protein-accession"])).find(e=>e.modelEntityId===this["structure-id"]);null!=e&&e.cifUrl&&(await(Dc(this,Oye,"f")?.loadFromUrl(e.cifUrl,!1)),this.clearMessage())}else{let e=await this.loadPDBEntry(this["structure-id"]);e&&(t=Object.values(e)[0].UniProt[this["protein-accession"]]?.mappings,this["custom-download-url"]?(await(Dc(this,Oye,"f")?.loadFromUrl(`${this["custom-download-url"]}${this["structure-id"].toLowerCase()}.cif`)),this.clearMessage()):(await(Dc(this,Oye,"f")?.loadPdb(this["structure-id"].toLowerCase())),this.clearMessage()))}this.selectedMolecule={id:this["structure-id"],mappings:t}}this["model-url"]&&(null==(e=Dc(this,Oye,"f"))||e.plugin.clear(),await(Dc(this,Oye,"f")?.loadFromUrl(this["model-url"])),this.clearMessage())}showMessage(e,t,r){let n={title:e,content:t};this.message=n,r&&setTimeout(()=>{this.message===n&&(this.message=null)},r)}clearMessage(){this.message=null}updateHighlight(e){if(!e?.length||e.some(e=>!Number.isInteger(e.position)))return;let t;if(this.isAF())t=e.map(e=>({start:e.position,end:e.position,entity:1,chain:e.chain}));else try{t=e.flatMap(e=>Vye(e.position,e.position,"PDB_UP",this.selectedMolecule?.mappings).filter(t=>t.chain===e.chain)).filter(Boolean)}catch(e){if(e instanceof Gye)return void this.showMessage("Error",e.message);throw e}if(!t.length)return void this.showMessage("Error","Residue outside of sequence range");let r=t.map(e=>`${e.start}:${e.end}`).join(",");this.highlight=r;let n=t.map(e=>{let t=e.start===e.end?e.start:`${e.start}:${e.end}`;return`<span data-article-id="structure_section#description-of-structure-table-contents">Chain</span> ${e.chain}<br /><b>${this["protein-accession"]}</b>: ${t}`}).join("");this.showMessage(this["structure-id"]||"",n);let i=new CustomEvent("change",{detail:{highlight:r},bubbles:!0,cancelable:!0});this.dispatchEvent(i)}highlightChain(){var e,t,r,n;if(!this.highlight)return void(null==(e=Dc(this,Oye,"f"))||e.clearHighlight());let i;try{i=this.highlightedRegion.segments.flatMap(({start:e,end:t})=>this.isAF()?{start:e,end:t,chain:"A"}
209:Vye(e,t,"UP_PDB",this.selectedMolecule?.mappings)).filter(Boolean)}catch(e){if(e instanceof Gye)return null==(t=Dc(this,Oye,"f"))||t.clearHighlight(),void this.showMessage("Error",e.message);throw e}i?.length?null==(n=Dc(this,Oye,"f"))||n.highlight(i):null==(r=Dc(this,Oye,"f"))||r.clearHighlight()}};Oye=new WeakMap,Cc([$l({type:String})],Hye.prototype,"protein-accession",void 0),Cc([$l({type:String})],Hye.prototype,"structure-id",void 0),Cc([$l({type:String})],Hye.prototype,"custom-download-url",void 0),Cc([$l({type:String})],Hye.prototype,"model-url",void 0),Cc([$l({type:String})],Hye.prototype,"color-theme",void 0),Cc([Ul()],Hye.prototype,"selectedMolecule",void 0),Cc([Ul()],Hye.prototype,"message",void 0);var qye=Hye=Cc([Fu("nightingale-structure")],Hye),{I:Wye}=fn,Xye=e=>e,Yye=()=>document.createComment(""),Kye=(e,t,r)=>{let n=e._$AA.parentNode,i=void 0===t?e._$AB:t._$AA;if(void 0===r)r=new Wye(n.insertBefore(Yye(),i),n.insertBefore(Yye(),i),e,e.options);else{let t=r._$AB.nextSibling,a=r._$AM,o=a!==e;if(o){let t;r._$AQ?.(e),r._$AM=e,void 0!==r._$AP&&(t=e._$AU)!==a._$AU&&r._$AP(t)}if(t!==i||o){let e=r._$AA;for(;e!==t;){let t=Xye(e).nextSibling;Xye(n).insertBefore(e,i),e=t}}}return r},Zye=(e,t,r=e)=>(e._$AI(t,r),e),Qye={},Jye=e=>{e._$AR(),e._$AA.remove()},ebe=(e,t,r)=>{let n=new Map;for(let i=t;i<=r;i++)n.set(e[i],i);return n},tbe=Sn(class extends wn{constructor(e){if(super(e),2!==e.type)throw Error("repeat() can only be used in text expressions")}dt(e,t,r){let n;void 0===r?r=t:void 0!==t&&(n=t);let i=[],a=[],o=0;for(let t of e)i[o]=n?n(t,o):o,a[o]=r(t,o),o++;return{values:a,keys:i}}render(e,t,r){return this.dt(e,t,r).values}update(e,[t,r,n]){let i=(e=>e._$AH)(e),{values:a,keys:o}=this.dt(t,r,n);if(!Array.isArray(i))return this.ut=o,a;let s,u,c=this.ut??=[],l=[],d=0,f=i.length-1,h=0,p=a.length-1;for(;d<=f&&h<=p;)if(null===i[d])d++;else if(null===i[f])f--;else if(c[d]===o[h])l[h]=Zye(i[d],a[h]),d++,h++;else if(c[f]===o[p])l[p]=Zye(i[f],a[p]),f--,p--;else if(c[d]===o[p])l[p]=Zye(i[d],a[p]),Kye(e,l[p+1],i[d]),d++,p--;else if(c[f]===o[h])l[h]=Zye(i[f],a[h]),Kye(e,i[d],i[f]),f--,h++;else if(void 0===s&&(s=ebe(o,h,p),u=ebe(c,d,f)),s.has(c[d]))if(s.has(c[f])){let t=u.get(o[h]),r=void 0===t?null:i[t];if(null===r){let t=Kye(e,i[d]);Zye(t,a[h]),l[h]=t}else l[h]=Zye(r,a[h]),Kye(e,i[d],r),i[t]=null;h++}else Jye(i[f]),f--;else Jye(i[d]),d++;for(;h<=p;){let t=Kye(e,l[p+1]);Zye(t,a[h]),l[h++]=t}for(;d<=f;){let e=i[d++];null!==e&&Jye(e)}return this.ut=o,((e,t=Qye)=>{e._$AH=t})(e,l),Kr}});function rbe(e,t){return t?t.split(".").reduce((e,t)=>{if(e&&"object"==typeof e&&t in e)return e[t]},e):e}function nbe(e,t){let r=rbe(e,String(t));return null==r?"":String(r)}function ibe(e,t){let r=rbe(e,t);return null==r?"":String(r)}function abe(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}var obe,sbe=(obe=class extends mn{constructor(...e){super(...e),this.data=[],this.columns=[],this.rowIdKey="id",this.filters={},this.filteredData=[],this.uniqueValuesByKey={},this.onTBodyClick=e=>{let t=e.composedPath().find(e=>e instanceof HTMLTableRowElement),r=t?.dataset?.id;if(!r)return;let n=this.filteredData.find(e=>nbe(e,this.rowIdKey)===r);n&&(this.selectedId=r,this.focusedRowId=r,this.dispatchRowClick(n),(this.shadowRoot?.activeElement||document.activeElement)!==t&&t?.focus())},this.onTBodyKeyDown=e=>{let t=this.filteredData;if(!t.length)return;let r=this.getFocusIndex(t);switch(e.key){case"ArrowDown":return e.preventDefault(),void this.moveFocus(Math.min(r+1,t.length-1));case"ArrowUp":return e.preventDefault(),void this.moveFocus(Math.max(r-1,0));case"Home":return e.preventDefault(),void this.moveFocus(0);case"End":return e.preventDefault(),void this.moveFocus(t.length-1);case"Enter":case" ":return e.preventDefault(),void this.selectCurrentFocus();default:return}},this.onFilterChange=e=>{e.stopPropagation();let t=e.currentTarget,r=t.dataset.key;if(!r)return;let n=t.value,i={...this.filters};n?i[r]=n:delete i[r],this.filters=i,this.focusedRowId=void 0,this.pendingFocusId=void 0},this.onFilterClick=e=>{e.stopPropagation()}}willUpdate(e){(e.has("data")||e.has("columns"))&&(this.uniqueValuesByKey=function(e,t){let r={};for(let n of t){if(!n.filterable)continue;let t=String(n.key),i=new Set;for(let r of e){let e=ibe(r,t);e&&i.add(e)}r[t]=Array.from(i).sort((e,t)=>
209e.localeCompare(t))}return r}(this.data,this.columns.map(e=>({key:String(e.key),filterable:e.filterable})))),(e.has("data")||e.has("filters"))&&(this.filteredData=function(e,t){let r=Object.entries(t);return 0===r.length?e:e.filter(e=>r.every(([t,r])=>!r||ibe(e,t)===r))}(this.data,this.filters),this.selectedId&&(this.filteredData.some(e=>nbe(e,this.rowIdKey)===this.selectedId)||(this.selectedId=void 0)),this.focusedRowId&&(this.filteredData.some(e=>nbe(e,this.rowIdKey)===this.focusedRowId)||(this.focusedRowId=void 0))),e.has("selectedId")&&(this.matches(":focus-within")||(this.focusedRowId=this.selectedId))}updated(e){(e.has("filters")||e.has("data")||e.has("selectedId"))&&this.filteredData.length&&this.matches(":focus-within")&&(this.renderRoot.querySelector('tbody tr[tabindex="0"]')??this.renderRoot.querySelector("tbody tr[data-id]"))?.focus()}dispatchRowClick(e){this.dispatchEvent(new CustomEvent("row-click",{detail:e,bubbles:!0,composed:!0}))}focusRowById(e){this.focusedRowId=e,this.pendingFocusId=e,this.updateComplete.then(()=>{if(this.pendingFocusId!==e)return;let t=this.renderRoot.querySelector(`tbody tr[data-id="${CSS.escape(e)}"]`),r=this.shadowRoot?.activeElement||document.activeElement;t&&r!==t&&t.focus()})}getFocusIndex(e){if(!e.length)return-1;if(this.focusedRowId){let t=e.findIndex(e=>nbe(e,this.rowIdKey)===this.focusedRowId);if(-1!==t)return t}if(this.selectedId){let t=e.findIndex(e=>nbe(e,this.rowIdKey)===this.selectedId);if(-1!==t)return t}return 0}moveFocus(e){let t=this.filteredData;if(e<0||e>=t.length)return;let r=nbe(t[e],this.rowIdKey);r&&this.focusRowById(r)}selectCurrentFocus(){let e=this.filteredData,t=this.getFocusIndex(e);if(-1===t)return;let r=e[t],n=nbe(r,this.rowIdKey);n&&(this.selectedId=n,this.focusedRowId=n,this.dispatchRowClick(r))}renderCell(e,t){return e.render?e.render(t)??Zr:function(e){return null==e||"object"==typeof e?Zr:String(e)}(rbe(t,String(e.key)))}renderFilterDropdown(e){if(!e.filterable)return Zr;let t=String(e.key),r=this.uniqueValuesByKey[t]??[];return Xr`
210      <select
211        aria-label=${(e=>e??Zr)(e.label?`Filter by ${e.label}`:void 0)}
212        data-key=${t}
213        .value=${this.filters[t]??""}
214        @change=${this.onFilterChange}
215        @click=${this.onFilterClick}
216      >
217        <option value="">All</option>
218        ${r.map(e=>Xr`<option value=${e}>${e}</option>`)}
219      </select>
220    `}renderNoResults(){return Xr`
221      <tr>
222        <td colspan=${this.columns.length} class="no-results">
223          No matching results found
224        </td>
225      </tr>
226    `}render(){return Xr`
227      <div class="scroll-container">
228        <table>
229          <thead>
230            <tr>
231              ${this.columns.map(e=>Xr`
232                  <th scope="col">
233                    <div class="header-content">
234                      <span>${e.label}</span>
235                      ${this.renderFilterDropdown(e)}
236                    </div>
237                  </th>
238                `)}
239            </tr>
240          </thead>
241
242          <tbody
243            role="listbox"
244            aria-label="Results"
245            @click=${this.onTBodyClick}
246            @keydown=${this.onTBodyKeyDown}
247          >
248            ${tbe(this.filteredData,(e,t)=>nbe(e,this.rowIdKey)||String(t),(e,t)=>{let r=nbe(e,this.rowIdKey),n=r===this.selectedId,i=this.focusedRowId?r===this.focusedRowId:this.selectedId?r===this.selectedId:0===t;return Xr`
249                  <tr
250                    data-id=${r||""}
251                    class=${n?"active":""}
252                    role="option"
253                    aria-selected=${n?"true":"false"}
254                    tabindex=${i?"0":"-1"}
255                  >
256                    ${this.columns.map(t=>Xr`<td>${this.renderCell(t,e)}</td>`)}
257                  </tr>
258                `})}
259            ${0===this.filteredData.length?this.renderNoResults():Zr}
260          </tbody>
261        </table>
262      </div>
263    `}},obe.styles=cr`
264    :host {
265      display: block;
266      width: 100%;
267      font-family: inherit;
268
269      --protvista-dt-primary: #0053d6;
270      --protvista-dt-text-head: #1a1a1a;
271      --protvista-dt-text-body: #2c2c2c;
272      --protvista-dt-text-muted: #444444;
273      --protvista-dt-text-input: #333333;
274      --protvista-dt-bg-base: #ffffff;
275      --protvista-dt-bg-header: #f8f8f8;
276      --protvista-dt-bg-hover: #f1f7ff;
277      --protvista-dt-bg-active: #e6f3ff;
278      --protvista-dt-border: #e0e0e0;
279      --protvista-dt-border-input: #767676;
280      --protvista-dt-shadow-header: #cccccc;
281    }
282
283    .scroll-container {
284      max-height: var(--protvista-datatable-max-height, 400px);
285      overflow-y: auto;
286      overflow-x: auto;
287      -webkit-overflow-scrolling: touch;
288      border: 1px solid var(--protvista-dt-border);
289      background: var(--protvista-dt-bg-base);
290    }
291
292    table {
293      width: 100%;
294      border-collapse: collapse;
295      font-size: 0.9rem;
296      color: var(--protvista-dt-text-body);
297    }
298
299    thead th {
300      position: sticky;
301      top: 0;
302      z-index: 2;
303      background: var(--protvista-dt-bg-header);
304      text-transform: uppercase;
305      font-size: 0.75rem;
306      letter-spacing: 0.05em;
307      box-shadow: 0 1px 0 var(--protvista-dt-shadow-header);
308    }
309
310    th {
311      text-align: left;
312      padding: 0.75rem 0.5rem;
313      white-space: nowrap;
314      vertical-align: top;
315      font-weight: 700;
316      color: var(--protvista-dt-text-head);
317    }
318
319    td {
320      padding: 0.75rem 0.5rem;
321      border-bottom: 1px solid var(--protvista-dt-border);
322      vertical-align: middle;
323    }
324
325    tbody tr {
326      cursor: pointer;
327      transition: background-color 0.15s ease-in-out;
328      outline: none;
329    }
330
331    tbody tr:hover {
332      background-color: var(--protvista-dt-bg-hover);
333    }
334
335    tbody tr:focus-visible {
336      background-color: var(--protvista-dt-bg-hover);
337      outline: 2px solid var(--protvista-dt-primary);
338      outline-offset: -2px;
339      position: relative;
340      z-index: 1;
341    }
342
343    tbody tr.active {
344      background-color: var(--protvista-dt-bg-active);
345      box-shadow: inset 4px 0 0 var(--protvista-dt-primary);
346    }
347
348    .header-content {
349      display: flex;
350      flex-direction: column;
351      gap: 0.5rem;
352    }
353
354    select {
355      display: block;
356      padding: 0.4rem;
357      font-size: 0.85rem;
358      width: 100%;
359      border: 1px solid var(--protvista-dt-border-input);
360      border-radius: 4px;
361      background-color: var(--protvista-dt-bg-base);
362      color: var(--protvista-dt-text-input);
363    }
364
365    select:focus {
366      outline: 2px solid var(--protvista-dt-primary);
367      border-color: var(--protvista-dt-primary);
368    }
369
370    .no-results {
371      text-align: center;
372      padding: 3rem;
373      color: var(--protvista-dt-text-muted);
374      font-style: italic;
375    }
376  `,obe);abe([_n({attribute:!1})],sbe.prototype,"data",void 0),abe([_n({attribute:!1})],sbe.prototype,"columns",void 0),abe([_n({type:String,attribute:"selected-id"})],sbe.prototype,"selectedId",void 0),abe([_n({type:String,attribute:"row-id-key"})],sbe.prototype,"rowIdKey",void 0),abe([xn()],sbe.prototype,"filters",void 0),abe([xn()],sbe.prototype,"filteredData",void 0),abe([xn()],sbe.prototype,"uniqueValuesByKey",void 0),abe([xn()],sbe.prototype,"focusedRowId",void 0);var ube=sbe=abe([vn("protvista-uniprot-datatable")],sbe),cbe=e=>e.map(e=>({...e,start:e.begin||void 0})),lbe=(e,t)=>
376{customElements.get(e)||customElements.define(e,t)},dbe=async(e,t=null)=>Object.fromEntries(await Promise.all(e.map(async e=>{try{let r=await fetch(t?t(e):e);return r.ok?[e,await r.json()]:(console.warn(`HTTP error status: ${r.status} at ${e}`),[e,null])}catch(t){return console.warn(`Failed to fetch or parse JSON from ${e}:`,t),[e,null]}}))),fbe='<svg xmlns="http://www.w3.org/2000/svg" width="38" height="38" stroke="currentColor"><g fill="none" fill-rule="evenodd" stroke-width="2" transform="translate(1 1)"><circle cx="18" cy="18" r="18" stroke-opacity=".5"/><path d="M36 18c0-9.94-8.06-18-18-18"><animateTransform attributeName="transform" dur="1s" from="0 18 18" repeatCount="indefinite" to="360 18 18" type="rotate"/></path></g></svg>',hbe=cr`
377  .protvista-loader {
378    display: flex;
379    justify-content: center;
380    padding: 4rem 0;
381  }
382  .protvista-loader svg {
383    height: 100px;
384  }
385
386  .protvista-no-results {
387    background-color: #e4e8eb;
388    display: flex;
389    justify-content: center;
390    padding: 1rem;
391    font-size: 0.8rem;
392  }
393`,pbe=new Map([["AlphaFold DB","Predicted"],["SWISS-MODEL","Modeling"],["ModelArchive","Modeling"],["PED","Modeling"],["SASBDB","SAS"],["isoform.io","Predicted"],["AlphaFill","Predicted"],["HEGELAB","Modeling"],["levylab","Modeling"]]),mbe=["SWISS-MODEL","ModelArchive","PED","SASBDB","isoform.io","AlphaFill","HEGELAB","levylab"],gbe=e=>{let t=e.match(/-(\d+)-F1$/);return t?Number(t[1]):0},vbe=(e,t,r)=>[...new Map(e.map(e=>[e.modelEntityId,e])).values()].map(n=>{let i=t?.find(({sequence:e})=>n.sequence===e),a=n.chainId,o=n.isComplex?`${n.assemblyType}${n.oligomericState}`:"Monomer";return n.isComplex&&"Homodimer"===o&&(a=e.filter(({modelEntityId:e})=>e===n.modelEntityId).flatMap(({chainId:e})=>e).sort().join(", ")),{id:n.modelEntityId,source:"AlphaFold DB",positions:`${n.sequenceStart}-${n.sequenceEnd}`,protvistaFeatureId:n.modelEntityId,downloadUrl:n.cifUrl,amAnnotationsUrl:n.amAnnotationsUrl,isoformId:n.isComplex?void 0:i?.isoformId,isoformIsCanonical:!n.isComplex&&i?i.sequence===r:void 0,afPrediction:!0,oligomericState:o,chain:a,method:pbe.get("AlphaFold DB")||void 0}}).sort((e,t)=>gbe(e.id)-gbe(t.id)).sort((e,t)=>("Monomer"===e.oligomericState?0:1)-("Monomer"===t.oligomericState?0:1)),ybe=Xr`
394  <strong>Model Confidence:</strong>
395  <ul class="no-bullet">
396    <li>
397      <span class="af-legend" style="background-color: rgb(0, 83, 214)"></span>
398      Very high (pLDDT > 90)
399    </li>
400    <li>
401      <span
402        class="af-legend"
403        style="background-color: rgb(101, 203, 243)"
404      ></span>
405      Confident (90 > pLDDT > 70)
406    </li>
407    <li>
408      <span class="af-legend" style="background-color:rgb(255, 219, 19)"></span>
409      Low (70 > pLDDT > 50)
410    </li>
411    <li>
412      <span class="af-legend" style="background-color:rgb(255, 125, 69)"></span>
413      Very low (pLDDT < 50)
414    </li>
415  </ul>
416  <p class="small">
417    AlphaFold produces a per-residue confidence score (pLDDT) between 0 and 100.
418    Some regions with low pLDDT may be unstructured in isolation.
419  </p>
420`,bbe=Xr`
421  <strong>Model Pathogenicity:</strong>
422  <ul class="no-bullet">
423    <li>
424      <span class="af-legend" style="background-color: rgb(154, 19, 26)"></span>
425      Likely pathogenic (score > 0.564)
426    </li>
427    <li>
428      <span
429        class="af-legend"
430        style="background-color: rgb(168, 169, 173)"
431      ></span>
432      Uncertain (0.564 >= score >= 0.34)
433    </li>
434    <li>
435      <span class="af-legend" style="background-color: rgb(61, 84, 147)"></span>
436      Likely benign (score < 0.34)
437    </li>
438  </ul>
439  <p class="small">
440    The displayed colour for each residue is the average AlphaMissense
441    pathogenicity score across all possible amino acid substitutions at that
442    position.
443  </p>
444`,_be="protvista-styles",xbe=class extends mn{constructor(){super(),this.modelUrl="",this.columns=[],this.onDatatableRowClick=e=>{this.selectedId=e.detail.id},lbe("nightingale-structure",qye),lbe("protvista-uniprot-datatable",ube),this.loading=!0,this.addStyles(),this.colorTheme="alphafold",this.alphamissenseAvailable=!1}static get properties(){return{accession:{type:String},structureId:{type:String},checksum:{type:String},sequence:{type:String},data:{type:Object},loading:{type:Boolean},colorTheme:{type:String},alphamissenseAvailable:{type:Boolean},isoforms:{type:Object,attribute:!1},selectedId:{type:String,attribute:"selected-id"},noTable:{type:Boolean,attribute:"no-table"}}}getColumns(){let e=[{label:"Source",key:"source",filterable:!0,render:e=>Xr`<strong>${e.source}</strong>`},{label:"Identifier",key:"id"}];return this.isoforms&&e.push({label:"Isoform",key:"isoformId",render:e=>e.isoformId?Xr`<a
445                href="${"https://www.uniprot.org/uniprotkb/"}${this.accession}/entry#${e.isoformId}"
446              >
447                ${e.isoformId}${e.isoformIsCanonical?" (Canonical)":""}
448              </a>`:Zr}),e.push({label:"Method",key:"method",filterable:!0},{label:"Resolution",key:"resolution",render:e=>e.resolution?e.resolution.replace("A","Å"):""},{label:"Chain",key:"chain"},{label:"Positions",key:"positions"},{label:"Links",key:"sourceDBLink",render:e=>this.renderLinksCell(e)},{label:"",key:"downloadUrl",render:e=>this.renderDownloadCell(e)}),e}renderLinksCell(e){let{source:t,id:r,sourceDBLink:n}=e;return Xr`
449      ${"PDB"===t?Xr` <a href="https://www.ebi.ac.uk/pdbe/entry/pdb/${r}">PDBe</a> `:Zr}
450      ${"AlphaFold DB"===t&&this.accession?Xr`<a href="${"https://alphafold.ebi.ac.uk/search/text/"}${this.accession}">AlphaFold</a>`:Zr}
451      ${n?Xr`<a href="${n}">${t}</a>`:Zr}
452    `}renderDownloadCell(e){let{downloadUrl:t,source:r,id:n}=e;return Xr`
453      ${t?Xr`${(e=>Xr`<a
454    href="${e}"
455    aria-label="Download source file"
456    title="Download source file"
457    style="text-decoration: none; display: inline-flex; align-items: center; gap: 4px;"
458  >
459    Source
460    <span style="display: inline-flex; width: 0.9em; height: 0.9em;">
461      ${Yr`${Cn('<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 32 32">
461<path d="M27.6 21h3.9v7.7H.5v-7.8h3.9v4h23.2v-4zm-3.9-9.7L16 22.9 8.2 11.3h5.9V1.6h3.8v9.7h5.9z"/></svg>')}`}
462    </span>
463  </a>`)(t)}`:Zr}
464      ${"PDB"!==r&&"AlphaFold DB"!==r||!this.accession?Zr:Xr` ·
465          ${((e,t)=>Xr`<a
466    href="${"https://search.foldseek.com/search"}?${new URLSearchParams({accession:e,source:t}).toString()}"
467    target="_blank"
468    rel="noopener noreferrer"
469    aria-label="Open Foldseek in a new tab"
470    title="Open Foldseek in a new tab"
471    style="text-decoration: none; display: inline-flex; align-items: center; gap: 4px;"
472  >
473    Foldseek
474    <span style="display: inline-flex; width: 0.8em; height: 0.8em;">
475      ${Yr`${Cn('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"><path fill="currentColor" d="M16 0h-6v2h3.071L7 8.071l1.414 1.414L14 3.9V6h2z"/><path fill="currentColor" d="M7 2H0v14h14V9h-2v5H2V4h5z"/></svg>')}`}
476    </span>
477  </a>`)("PDB"===r?n:this.accession,"PDB"===r?"PDB":"AlphaFoldDB")}`}
478    `}async connectedCallback(){if(super.connectedCallback(),!this.accession&&!this.checksum)return;let e=this.accession&&!this.checksum?`https://rest.uniprot.org/uniprotkb/${this.accession}`:"",t=this.accession&&!this.checksum?`https://alphafold.ebi.ac.uk/api/prediction/${this.accession}?include_complexes=true`:"",r=this.accession&&!this.checksum?`https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/${this.accession}.json?exclude_provider=pdbe`:`https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/v2/sequence/summary?id=${this.checksum}&type=md5`,n=await dbe([e,t,r]);this.loading=!1;let i=(e=>e.uniProtKBCrossReferences?e.uniProtKBCrossReferences.filter(e=>"PDB"===e.database).sort((e,t)=>t.id.localeCompare(e.id)).map(({id:e,properties:t})=>{if(!t)return;let r,n,i=t.reduce((e,t)=>(e[t.key]=t.value,e),{}),a=i.Method,o=i.Resolution,s=i.Chains;if(s){let e=s.split("=");2===e.length&&([r,n]=e)}return{id:e,source:"PDB",method:a,resolution:o&&"-"!==o?o:void 0,downloadUrl:`https://www.ebi.ac.uk/pdbe/entry-files/download/${e.toLowerCase()}_updated.cif`,chain:r,positions:n,protvistaFeatureId:e}}).filter(e=>void 0!==e):[])(n[e]||[]),a=[];if(this.isoforms&&n[t]?.length){let r=n[t]?.filter(({sequence:e})=>this.isoforms?.some(({sequence:t})=>e===t));a=vbe(r,this.isoforms,n[e]?.sequence?.value),this.alphamissenseAvailable=!!a?.[0]?.amAnnotationsUrl}else{let r=n[t]?.filter(({sequence:t})=>n[e]?.sequence?.value===t||this.sequence===t);r?.length&&(a=vbe(r),this.alphamissenseAvailable=r.some(e=>e.amAnnotationsUrl))}let o=((e,t,r)=>{let n=t&&!r?e?.structures?.filter(({summary:e})=>mbe.includes(e.provider)):e?.structures?.sort((e,t)=>t.summary.confidence_avg_local_score-e.summary.confidence_avg_local_score);if(t&&r&&n){let e=n.findIndex(({summary:e})=>e.model_identifier.includes(t));-1!==e&&(n=[n[e],...n.slice(0,e),...n.slice(e+1)])}return n?.map(({summary:e})=>({id:e.model_identifier,source:e.provider,positions:e.uniprot_start&&e.uniprot_end?`${e.uniprot_start}-${e.uniprot_end}`:void 0,protvistaFeatureId:e.model_identifier,downloadUrl:e.model_url,sourceDBLink:"isoform.io"===e.provider?"https://www.isoform.io/home":e.model_page_url,chain:e.entities?.flatMap(e=>"UNIPROT"===e.identifier_category?e.chain_ids:[]).join(", ")||void 0,oligomericState:e.oligomeric_state||void 0,method:pbe.get(e.provider)||void 0}))||[]})(n[r]||[],this.accession,this.checksum),s=[...i,...a,...o];this.data=s,this.columns=this.getColumns(),s.length>0&&!this.selectedId&&(this.selectedId=s[0].id),this.dispatchEvent(new CustomEvent("structures-loaded",{detail:s,bubbles:!0,composed:!0}))}disconnectedCallback(){this.removeStyles()}addStyles(){if(!document.getElementById(_be)){let e=document.createElement("style");e.id=_be,e.textContent=`\n      ${hbe.toString()}\n      ${this.cssStyle}\n      `,document.querySelector("head")?.append(e)}}removeStyles(){document.getElementById(_be)?.remove()}willUpdate(e){if(!e.has("selectedId")&&!e.has("data")||!this.data)return;let t=this.selectedId?this.data.find(e=>e.id===this.selectedId):void 0;t?this.applySelection(t):this.clearViewer()}clearViewer(){!this.structureId&&!this.modelUrl||(this.structureId=void 0,this.modelUrl="",this.metaInfo=void 0)}applySelection(e){let{id:t,source:r,downloadUrl:n,amAnnotationsUrl:i,oligomer
478icState:a}=e;this.checksum||mbe.includes(r)||"AlphaFold DB"===r&&"Monomer"!==a?(this.modelUrl=n??"",this.structureId=void 0,this.metaInfo=void 0,this.colorTheme="alphafold","AlphaFold DB"===r&&(this.metaInfo=ybe,this.alphamissenseAvailable=!!i)):(this.structureId=t,this.modelUrl="",this.structureId.startsWith("AF-")?(this.metaInfo=ybe,this.alphamissenseAvailable=!!i):this.metaInfo=void 0)}get cssStyle(){return cr`
479      .protvista-uniprot-structure {
480        line-height: normal;
481      }
482
483      .theme-selection {
484        padding-bottom: 1rem;
485      }
486
487      .protvista-uniprot-structure__structure {
488        display: flex;
489      }
490
491      .protvista-uniprot-structure__meta {
492        flex: 1;
493        padding: 1rem;
494      }
495
496      .protvista-uniprot-structure__structure nightingale-structure {
497        z-index: 40000;
498        width: 100%;
499        flex: 4;
500      }
501
502      .protvista-uniprot-structure__meta .small {
503        font-size: 0.75rem;
504      }
505
506      .protvista-uniprot-structure__meta .no-bullet {
507        list-style: none;
508        padding: 0;
509        margin: 0;
510      }
511
512      .protvista-uniprot-structure__meta .no-bullet li {
513        padding: 0;
514        margin: 0.5rem 0;
515      }
516
517      .protvista-uniprot-structure__meta .af-legend::before {
518        content: '';
519        margin: 0;
520        display: inline-block;
521        width: 20px;
522        height: 16px;
523      }
524
525      .am-disabled * {
526        cursor: not-allowed;
527        color: #808080;
528      }
529    `}createRenderRoot(){return this}toggleColorTheme(e){let t=e.currentTarget;this.colorTheme=t.value,this.metaInfo="alphafold"===t.value?ybe:bbe}render(){return Xr`
530      <div class="protvista-uniprot-structure">
531        <div class="protvista-uniprot-structure__structure">
532          ${this.metaInfo?Xr`
533                <div class="protvista-uniprot-structure__meta">
534                  <div class="theme-selection">
535                    Select color scale
536                    <div>
537                      <input
538                        type="radio"
539                        id="alphafold"
540                        name="colorScheme"
541                        value="alphafold"
542                        @click=${this.toggleColorTheme}
543                        checked
544                      />
545                      <label for="alphafold">Confidence</label>
546                    </div>
547                    <div
548                      class=${this.alphamissenseAvailable?"":"am-disabled"}
549                    >
550                      <input
551                        type="radio"
552                        id="alphamissense"
553                        name="colorScheme"
554                        value="alphamissense"
555                        @click=${this.toggleColorTheme}
556                        ?disabled=${!this.alphamissenseAvailable}
557                      />
558                      <label
559                        for="alphamissense"
560                        title=${this.alphamissenseAvailable?"":"Color by pathogenicity is disabled as there are no AlphaMissense predictions available for this model"}
561                      >
562                        Pathogenicity
563                        ${this.alphamissenseAvailable?"":" (unavailable)"}
564                      </label>
565                    </div>
566                  </div>
567                  ${this.metaInfo}
568                </div>
569              `:Zr}
570          ${this.structureId?Xr`<nightingale-structure
571                structure-id=${this.structureId}
572                protein-accession=${this.accession}
573                color-theme=${this.colorTheme}
574              ></nightingale-structure>`:Zr}
575          ${this.modelUrl?Xr`<nightingale-structure
576                model-url=${this.modelUrl}
577              ></nightingale-structure>`:Zr}
578        </div>
579
580        ${this.noTable?Zr:Xr`<div class="protvista-uniprot-structure__table">
581              ${this.data&&this.data.length?Xr`
582                    <protvista-uniprot-datatable
583                      .data=${this.data}
584                      .columns=${this.columns}
585                      .selectedId=${this.selectedId}
586                      row-id-key="id"
587                      @row-click=${this.onDatatableRowClick}
588                    ></protvista-uniprot-datatable>
589                  `:Zr}
590              ${this.loading?Xr`<div class="protvista-loader">
591                    ${Yr`${Cn(fbe)}`}
592                  </div>`:Zr}
593              ${this.data&&0!==this.data.length||this.loading?Zr:Xr`<div class="protvista-no-results">
594                    No structure information available
595                    ${this.accession?`for ${this.accession}`:""}
596                  </div>`}
597            </div>`}
598      </div>
599    `}};abe([xn()],xbe.prototype,"modelUrl",void 0);
599var Sbe=xbe=abe([vn("protvista-uniprot-structure")],xbe),wbe=function(e){return new Promise(function(t){return setTimeout(function(){return t()},e)})},Abe="node";typeof importScripts<"u"?Abe="worker":typeof window<"u"&&(Abe="browser");var Cbe=Abe,Tbe=function(){return wbe(0)};"browser"===Cbe&&"requestAnimationFrame"in window&&(Tbe=function(){return new Promise(function(e){return window.requestAnimationFrame(function(){return e()})})});var Pbe,Ebe=Tbe;if("browser"===Cbe&&"requestIdleCallback"in window)Pbe=function(e){return new Promise(function(t){return window.requestIdleCallback(t,{timeout:e})})};else{var Mbe=Object.freeze({didTimeout:!0,timeRemaining:function(){return 1/0}});if(Pbe=function(e){return wbe((e||0)/2).then(function(){return Mbe})},"browser"===Cbe&&"requestAnimationFrame"in window){var kbe=Pbe;Pbe=function(){return kbe().then(Ebe).then(function(){return Mbe})}}}var Ibe=Ebe;function Dbe(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}var Obe=globalThis,Rbe=Obe.ShadowRoot&&(void 0===Obe.ShadyCSS||Obe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Bbe=Symbol(),Nbe=new WeakMap,Fbe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Bbe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Rbe&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=Nbe.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Nbe.set(t,e))}return e}toString(){return this.cssText}},Lbe=Rbe?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new Fbe("string"==typeof e?e:e+"",void 0,Bbe))(t)})(e):e,{is:$be,defineProperty:Ube,getOwnPropertyDescriptor:jbe,getOwnPropertyNames:zbe,getOwnPropertySymbols:Gbe,getPrototypeOf:Vbe}=Object,Hbe=globalThis,qbe=Hbe.trustedTypes,Wbe=qbe?qbe.emptyScript:"",Xbe=Hbe.reactiveElementPolyfillSupport,Ybe=(e,t)=>e,Kbe={toAttribute(e,t){switch(t){case Boolean:e=e?Wbe:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Zbe=(e,t)=>!$be(e,t),Qbe={attribute:!0,type:String,converter:Kbe,reflect:!1,hasChanged:Zbe};Symbol.metadata??=Symbol("metadata"),Hbe.litPropertyMetadata??=new WeakMap;var Jbe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Qbe){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&Ube(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=jbe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Qbe}static _$Ei(){if(this.hasOwnProperty(Ybe("elementProperties")))return;let e=Vbe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ybe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ybe("properties"))){let e=this.properties,t=[...zbe(e),...Gbe(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(Lbe(e))}else void 0!==e&&t.push(Lbe(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
599=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Rbe)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=Obe.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Kbe:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Kbe:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??Zbe)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};Jbe.elementStyles=[],Jbe.shadowRootOptions={mode:"open"},Jbe[Ybe("elementProperties")]=new Map,Jbe[Ybe("finalized")]=new Map,Xbe?.({ReactiveElement:Jbe}),(Hbe.reactiveElementVersions??=[]).push("2.0.4");var e_e={attribute:!0,type:String,converter:Kbe,reflect:!1,hasChanged:Zbe},t_e=(e=e_e,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function r_e(e){return(t,r)=>"object"==typeof r?t_e(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function n_e(e){return r_e({...e,state:!0,attribute:!1})}var i_e,a_e=i_e=class extends _c{constructor(){super(...arguments),this.reflectedAttributes=new Map,this.htmlElements=new Set,this.propertyValues=new Map}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this.changeListener),this.style.display="block"}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),this.applyAttributes()}
599applyAttributes(){this.htmlElements.forEach(e=>this.applyAttributesOnElement(e))}applyAttributesOnElement(e){var t;null==(t=this.reflectedAttributes)||t.forEach((t,r)=>{!1===t||null==t?e.removeAttribute(r):e.setAttribute(r,"boolean"==typeof t?"":t)}),this.length&&e.setAttribute("length",`${this.length}`),this["display-end"]&&e.setAttribute("display-end",`${this["display-end"]}`),this["display-start"]&&e.setAttribute("display-start",`${this["display-start"]}`),this.highlight&&e.setAttribute("highlight",this.highlight)}register(e){this.htmlElements.add(e),this.applyAttributesOnElement(e)}unregister(e){this.htmlElements.delete(e)}applyProperties(e){if(e){let t=this.querySelector(`#${e}`);if(!t)return;this.propertyValues.forEach((e,r)=>{t[r]=e})}else this.htmlElements.forEach(e=>{e&&this.propertyValues.forEach((t,r)=>{e[r]=t})})}isRegisteredAttribute(e){return!!this.reflectedAttributes&&([...this.reflectedAttributes.keys()].includes(e)||i_e.observedAttributes.includes(e))}changeListener(e){var t;e.detail&&("property"===e.detail.handler?(this.propertyValues.set(e.detail.type,e.detail.value),this.applyProperties(e.detail.for)):(this.isRegisteredAttribute(e.detail.type)&&(null==(t=this.reflectedAttributes)||t.set(e.detail.type,e.detail.value)),Object.keys(e.detail).forEach(t=>{var r;this.isRegisteredAttribute(t)&&(null==(r=this.reflectedAttributes)||r.set(t,e.detail[t]))}),this.applyAttributes()))}};Dbe([r_e({attribute:"reflected-attributes",converter:{fromAttribute:e=>{if(!e)return null;let t=e.split(",");if(t.includes("type"))throw Error("'type' can't be used as a Nightingale attribute");if(t.includes("value"))throw Error("'value' can't be used as a Nightingale attribute");return new Map(t.filter(e=>!a_e.observedAttributes.includes(e)).map(e=>[e,null]))}}})],a_e.prototype,"reflectedAttributes",void 0),Dbe([r_e({type:Number})],a_e.prototype,"length",void 0),Dbe([r_e({type:Number})],a_e.prototype,"display-start",void 0),Dbe([r_e({type:Number})],a_e.prototype,"display-end",void 0),Dbe([r_e({type:String})],a_e.prototype,"highlight",void 0),Dbe([n_e()],a_e.prototype,"htmlElements",void 0),Dbe([n_e()],a_e.prototype,"propertyValues",void 0),a_e=i_e=Dbe([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-manager")],a_e);var o_e=a_e;function s_e(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function u_e(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function c_e(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var l_e=globalThis,d_e=l_e.ShadowRoot&&(void 0===l_e.ShadyCSS||l_e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,f_e=Symbol(),h_e=new WeakMap,p_e=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==f_e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(d_e&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=h_e.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&h_e.set(t,e))}return e}toString(){return this.cssText}},m_e=d_e?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new p_e("string"==typeof e?e:e+"",void 0,f_e))(t)})(e):e,{is:g_e,defineProperty:v_e,getOwnPropertyDescriptor:y_e,getOwnPropertyNames:b_e,getOwnPropertySymbols:__e,getPrototypeOf:x_e}=Object,S_e=globalThis,w_e=S_e.trustedTypes,A_e=w_e?w_e.emptyScript:"",C_e=S_e.reactiveElementPolyfillSupport,T_e=(e,t)=>
599e,P_e={toAttribute(e,t){switch(t){case Boolean:e=e?A_e:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},E_e=(e,t)=>!g_e(e,t),M_e={attribute:!0,type:String,converter:P_e,reflect:!1,hasChanged:E_e};Symbol.metadata??=Symbol("metadata"),S_e.litPropertyMetadata??=new WeakMap;var k_e=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=M_e){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&v_e(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=y_e(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??M_e}static _$Ei(){if(this.hasOwnProperty(T_e("elementProperties")))return;let e=x_e(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(T_e("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(T_e("properties"))){let e=this.properties,t=[...b_e(e),...__e(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(m_e(e))}else void 0!==e&&t.push(m_e(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(d_e)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=l_e.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?P_e:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?P_e:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??E_e)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e
599=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};k_e.elementStyles=[],k_e.shadowRootOptions={mode:"open"},k_e[T_e("elementProperties")]=new Map,k_e[T_e("finalized")]=new Map,C_e?.({ReactiveElement:k_e}),(S_e.reactiveElementVersions??=[]).push("2.0.4");var I_e=globalThis,D_e=I_e.trustedTypes,O_e=D_e?D_e.createPolicy("lit-html",{createHTML:e=>e}):void 0,R_e="$lit$",B_e=`lit$${Math.random().toFixed(9).slice(2)}$`,N_e="?"+B_e,F_e=`<${N_e}>`,L_e=document,$_e=()=>L_e.createComment(""),U_e=e=>null===e||"object"!=typeof e&&"function"!=typeof e,j_e=Array.isArray,z_e="[ \t\n\f\r]",G_e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,V_e=/-->/g,H_e=/>/g,q_e=RegExp(`>|${z_e}(?:([^\\s"'>=/]+)(${z_e}*=${z_e}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),W_e=/'/g,X_e=/"/g,Y_e=/^(?:script|style|textarea|title)$/i,K_e=(e,...t)=>({_$litType$:1,strings:e,values:t}),Z_e=Symbol.for("lit-noChange"),Q_e=Symbol.for("lit-nothing"),J_e=new WeakMap,exe=L_e.createTreeWalker(L_e,129);function txe(e,t){if(!j_e(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===O_e?t:O_e.createHTML(t)}var rxe=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=G_e;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===G_e?"!--"===s[1]?o=V_e:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=q_e):(Y_e.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=q_e):o=H_e:o===q_e?">"===s[0]?(o=r??G_e,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?q_e:'"'===s[3]?X_e:W_e):o===X_e||o===W_e?o=q_e:o===V_e||o===H_e?o=G_e:(o=q_e,r=void 0);let d=o===q_e&&e[t+1].startsWith("/>")?" ":"";a+=o===G_e?u+F_e:c>=0?(i.push(n),u.slice(0,c)+R_e+u.slice(c)+B_e+d):u+B_e+(-2===c?t:d)}return[txe(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),exe.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=exe.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(R_e)){let t=l[o++],r=i.getAttribute(e).split(B_e),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?sxe:"?"===n[1]?uxe:"@"===n[1]?cxe:oxe}),i.removeAttribute(e)}else e.startsWith(B_e)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(Y_e.test(i.tagName)){let e=i.textContent.split(B_e),t=e.length-1;if(t>0){i.textContent=D_e?D_e.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],$_e()),exe.nextNode(),u.push({type:2,index:++a});i.append(e[t],$_e())}}}else if(8===i.nodeType)if(i.data===N_e)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(B_e,e+1));)u.push({type:7,index:a}),e+=B_e.length-1}a++}}static createElement(e,t){let r=L_e.createElement("template");return r.innerHTML=e,r}};function nxe(e,t,r=e,n){if(t===Z_e)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=U_e(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=nxe(e,i._$AS(e,t.values),i,n)),t}var ixe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??L_e).importNode(t,!0);exe.currentNode=n;let i=exe.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new axe(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new lxe(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=exe.nextNode(),a++)}return exe.currentNode=L_e,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},axe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=Q_e,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=nxe(this,e,t),U_e(e)?e===Q_e||null==e||""===e?(this._$AH!==Q_e&&this._$AR(),this._$AH=Q_e):e!==this._$AH&&e!==Z_e&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>j_e(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Q_e&&U_e(this._$AH)?this._$AA.nextSibling.data=e:this.T(L_e.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=rxe.createElement(txe(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new ixe(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=J_e.get(e.strings);return void 0===t&&J_e.set(e.strings,t=new rxe(e)),t}k(t){j_e(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O($_e()),this.O($_e()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},oxe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=Q_e,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Q_e}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=nxe(this,e,t,0),a=!U_e(e)||e!==this._$AH&&e!==Z_e,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=nxe(this,s[r+n],t,n),o===Z_e&&(o=this._$AH[n]),a||=!U_e(o)||o!==this._$AH[n],o===Q_e?e=Q_e:e!==Q_e&&(e+=(o??"")+i[n+1]
599),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===Q_e?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},sxe=class extends oxe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q_e?void 0:e}},uxe=class extends oxe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q_e)}},cxe=class extends oxe{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=nxe(this,e,t,0)??Q_e)===Z_e)return;let r=this._$AH,n=e===Q_e&&r!==Q_e||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==Q_e&&(r===Q_e||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},lxe=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){nxe(this,e)}},dxe=I_e.litHtmlPolyfillSupport;dxe?.(rxe,axe),(I_e.litHtmlVersions??=[]).push("3.2.1");var fxe=class extends k_e{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new axe(t.insertBefore($_e(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z_e}};fxe._$litElement$=!0,fxe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:fxe});var hxe=globalThis.litElementPolyfillSupport;hxe?.({LitElement:fxe}),(globalThis.litElementVersions??=[]).push("4.1.1");var pxe={attribute:!0,type:String,converter:P_e,reflect:!1,hasChanged:E_e},mxe=(e=pxe,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function gxe(e){return(t,r)=>"object"==typeof r?mxe(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function vxe(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function yxe(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bxe(e){let t,r,n;function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===vxe||e===yxe?e:_xe,r=e,n=e):(t=vxe,r=(t,r)=>vxe(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function _xe(){return 0}var xxe=bxe(vxe).right;bxe(function(e){return null===e?NaN:+e}).center;var Sxe=Math.sqrt(50),wxe=Math.sqrt(10),Axe=Math.sqrt(2);function Cxe(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=Sxe?10:u>=wxe?5:u>=Axe?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?Cxe(e,t,2*r):[n,i,a]}function Txe(e,t,r){return Cxe(e=+e,t=+t,r=+r)[2]}function Pxe(e){return e}var Exe=1e-6;function Mxe(e){return"translate("+e+",0)"}function kxe(e){return t=>+e(t)}function Ixe(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function Dxe(){return!this.__axis}function Oxe(e,t){var r=[],n=null,i=null,a=6,o=6,s=3,u=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=Mxe;function l(e){var l=n??(t.ticks?t.ticks.apply(t,r):t.domain()),d=i??(t.tickFormat?t.tickFormat.apply(t,r):Pxe),f=Math.max(a,0)+s,h=t.range(),p=+h[0]+u,m=+h[h.length-1]+u,g=(t.bandwidth?Ixe:kxe)(t.copy(),u),v=e.selection?e.selection():e,y=v.selectAll(".domain").data([null]),b=v.selectAll(".tick").data(l,t).order(),_=b.exit(),x=b.enter().append("g").attr("class","tick"),S=b.select("line"),w=b.select("text");
vendor: 15,884 bytes, line 599
599y=y.merge(y.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(x),S=S.merge(x.append("line").attr("stroke","currentColor").attr("y2",1*a)),w=w.merge(x.append("text").attr("fill","currentColor").attr("y",1*f).attr("dy","0.71em")),e!==v&&(y=y.transition(e),b=b.transition(e),S=S.transition(e),w=w.transition(e),_=_.transition(e).attr("opacity",Exe).attr("transform",function(e){return isFinite(e=g(e))?c(e+u):this.getAttribute("transform")}),x.attr("opacity",Exe).attr("transform",function(e){var t=this.parentNode.__axis;return c((t&&isFinite(t=t(e))?t:g(e))+u)})),_.remove(),y.attr("d",o?"M"+p+","+1*o+"V"+u+"H"+m+"V"+1*o:"M"+p+","+u+"H"+m),b.attr("opacity",1).attr("transform",function(e){return c(g(e)+u)}),S.attr("y2",1*a),w.attr("y",1*f).text(d),v.filter(Dxe).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),v.each(function(){this.__axis=g})}return l.scale=function(e){return arguments.length?(t=e,l):t},l.ticks=function(){return r=Array.from(arguments),l},l.tickArguments=function(e){return arguments.length?(r=null==e?[]:Array.from(e),l):r.slice()},l.tickValues=function(e){return arguments.length?(n=null==e?null:Array.from(e),l):n&&n.slice()},l.tickFormat=function(e){return arguments.length?(i=e,l):i},l.tickSize=function(e){return arguments.length?(a=o=+e,l):a},l.tickSizeInner=function(e){return arguments.length?(a=+e,l):a},l.tickSizeOuter=function(e){return arguments.length?(o=+e,l):o},l.tickPadding=function(e){return arguments.length?(s=+e,l):s},l.offset=function(e){return arguments.length?(u=+e,l):u},l}var Rxe={value:()=>{}};function Bxe(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new Nxe(n)}function Nxe(e){this._=e}function Fxe(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function Lxe(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=Rxe,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}Nxe.prototype=Bxe.prototype={constructor:Nxe,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=Lxe(i[r],e.name,t);else if(null==t)for(r in i)i[r]=Lxe(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=Fxe(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Nxe(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var $xe="http://www.w3.org/1999/xhtml",Uxe={svg:"http://www.w3.org/2000/svg",xhtml:$xe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jxe(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),Uxe.hasOwnProperty(t)?{space:Uxe[t],local:e}:e}function zxe(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===$xe&&t.documentElement.namespaceURI===$xe?t.createElement(e):t.createElementNS(r,e)}}function Gxe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Vxe(e){var t=jxe(e);return(t.local?Gxe:zxe)(t)}function Hxe(){}function qxe(e){return null==e?Hxe:function(){return this.querySelector(e)}}function Wxe(){return[]}function Xxe(e){return null==e?Wxe:function(){return this.querySelectorAll(e)}}function Yxe(e){return function(){return this.matches(e)}}function Kxe(e){return function(t){return t.matches(e)}}var Zxe=Array.prototype.find;function Qxe(){return this.firstElementChild}var Jxe=Array.prototype.filter;function eSe(){return Array.from(this.children)}function tSe(e){return Array(e.length)}function rSe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function nSe(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new rSe(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function iSe(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new rSe(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function aSe(e){return e.__data__}function oSe(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function sSe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function uSe(e){return function(){this.removeAttribute(e)}}function cSe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lSe(e,t){return function(){this.setAttribute(e,t)}}function dSe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fSe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function hSe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function pSe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mSe(e){return function(){this.style.removeProperty(e)}}function gSe(e,t,r){return function(){this.style.setProperty(e,t,r)}}function vSe(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function ySe(e,t){return e.style.getPropertyValue(t)||pSe(e).getComputedStyle(e,null).getPropertyValue(t)}function bSe(e){return function(){delete this[e]}}function _Se(e,t){return function(){this[e]=t}}function xSe(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function SSe(e){return e.trim().split(/^|\s+/)}function wSe(e){return e.classList||new ASe(e)}function ASe(e){this._node=e,this._names=SSe(e.getAttribute("class")||"")}function CSe(e,t){for(var r=wSe(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function TSe(e,t){for(var r=wSe(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function PSe(e){return function(){CSe(this,e)}}function ESe(e){return function(){TSe(this,e)}}function MSe(e,t){return function(){(t.apply(this,arguments)?CSe:TSe)(this,e)}}function kSe(){this.textContent=""}function ISe(e){return function(){this.textContent=e}}function DSe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function OSe(){this.innerHTML=""}function RSe(e){return function(){this.innerHTML=e}}function BSe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function NSe(){this.nextSibling&&this.parentNode.appendChild(this)}function FSe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function LSe(){return null}function $Se(){var e=this.parentNode;e&&e.removeChild(this)}function USe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jSe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zSe(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function GSe(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function VSe(e,t,r){var n=pSe(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function HSe(e,t){return function(){return VSe(this,e,t)}}function qSe(e,t){return function(){return VSe(this,e,t.apply(this,arguments))}}rSe.prototype={constructor:rSe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},ASe.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var WSe=[null];function XSe(e,t){this._groups=e,this._parents=t}function YSe(){return new XSe([[document.documentElement]],WSe)}function KSe(e){return"string"==typeof e?new XSe([[document.querySelector(e)]],[document.documentElement]):new XSe([[e]],WSe)}function ZSe(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}XSe.prototype=YSe.prototype={constructor:XSe,select:function(e){"function"!=typeof e&&(e=qxe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new XSe(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):Xxe(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new XSe(n,i)},selectChild:function(e){return this.select(null==e?Qxe:function(e){return function(){return Zxe.call(this.children,e)}}("function"==typeof e?e:Kxe(e)))},selectChildren:function(e){return this.selectAll(null==e?eSe:function(e){return function(){return Jxe.call(this.children,e)}}("function"==typeof e?e:Kxe(e)))},filter:function(e){"function"!=typeof e&&(e=Yxe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new XSe(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,aSe);var r=t?iSe:nSe,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;++c){var l=n[c],d=i[c],f=d.length,h=oSe(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new XSe(o,n))._enter=s,o._exit=u,o},enter:function(){return new XSe(this._enter||this._groups.map(tSe),this._parents)},exit:function(){return new XSe(this._exit||this._groups.map(tSe),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new XSe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=sSe;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new XSe(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=jxe(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?cSe:uSe:"function"==typeof t?r.local?hSe:fSe:r.local?dSe:lSe)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?mSe:"function"==typeof t?vSe:gSe)(e,t,r??"")):ySe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?bSe:"function"==typeof t?xSe:_Se)(e,t)):this.node()[e]},classed:function(e,t){var r=SSe(e+"");if(arguments.length<2){for(var n=wSe(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?MSe:t?PSe:ESe)(r,t))},text:function(e){return arguments.length?this.each(null==e?kSe:("function"==typeof e?DSe:ISe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?OSe:("function"==typeof e?BSe:RSe)(e)):this.node().innerHTML},raise:function(){return this.each(NSe)},lower:function(){return this.each(FSe)},append:function(e){var t="function"==typeof e?e:Vxe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:Vxe(e),n=null==t?LSe:"function"==typeof t?t:qxe(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each($Se)},clone:function(e){return this.select(e?jSe:USe)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?GSe:zSe,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?qSe:HSe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var QSe={capture:!0,passive:!1};function JSe(e){e.preventDefault(),e.stopImmediatePropagation()}function ewe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function twe(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function rwe(){}
vendor: 9,915 bytes, line 599
599var nwe=.7,iwe=1/nwe,awe="\\s*([+-]?\\d+)\\s*",owe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",swe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",uwe=/^#([0-9a-f]{3,8})$/,cwe=RegExp(`^rgb\\(${awe},${awe},${awe}\\)$`),lwe=RegExp(`^rgb\\(${swe},${swe},${swe}\\)$`),dwe=RegExp(`^rgba\\(${awe},${awe},${awe},${owe}\\)$`),fwe=RegExp(`^rgba\\(${swe},${swe},${swe},${owe}\\)$`),hwe=RegExp(`^hsl\\(${owe},${swe},${swe}\\)$`),pwe=RegExp(`^hsla\\(${owe},${swe},${swe},${owe}\\)$`),mwe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function gwe(){return this.rgb().formatHex()}function vwe(){return this.rgb().formatRgb()}function ywe(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=uwe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?bwe(t):3===r?new Swe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?_we(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?_we(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=cwe.exec(e))?new Swe(t[1],t[2],t[3],1):(t=lwe.exec(e))?new Swe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=dwe.exec(e))?_we(t[1],t[2],t[3],t[4]):(t=fwe.exec(e))?_we(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=hwe.exec(e))?Ewe(t[1],t[2]/100,t[3]/100,1):(t=pwe.exec(e))?Ewe(t[1],t[2]/100,t[3]/100,t[4]):mwe.hasOwnProperty(e)?bwe(mwe[e]):"transparent"===e?new Swe(NaN,NaN,NaN,0):null}function bwe(e){return new Swe(e>>16&255,e>>8&255,255&e,1)}function _we(e,t,r,n){return n<=0&&(e=t=r=NaN),new Swe(e,t,r,n)}function xwe(e,t,r,n){return 1===arguments.length?function(e){return e instanceof rwe||(e=ywe(e)),e?new Swe((e=e.rgb()).r,e.g,e.b,e.opacity):new Swe}(e):new Swe(e,t,r,n??1)}function Swe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function wwe(){return`#${Pwe(this.r)}${Pwe(this.g)}${Pwe(this.b)}`}function Awe(){let e=Cwe(this.opacity);return`${1===e?"rgb(":"rgba("}${Twe(this.r)}, ${Twe(this.g)}, ${Twe(this.b)}${1===e?")":`, ${e})`}`}function Cwe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Twe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pwe(e){return((e=Twe(e))<16?"0":"")+e.toString(16)}function Ewe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new kwe(e,t,r,n)}function Mwe(e){if(e instanceof kwe)return new kwe(e.h,e.s,e.l,e.opacity);if(e instanceof rwe||(e=ywe(e)),!e)return new kwe;if(e instanceof kwe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new kwe(o,s,u,e.opacity)}function kwe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function Iwe(e){return(e=(e||0)%360)<0?e+360:e}function Dwe(e){return Math.max(0,Math.min(1,e||0))}function Owe(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}ewe(rwe,ywe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gwe,formatHex:gwe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Mwe(this).formatHsl()},formatRgb:vwe,toString:vwe}),ewe(Swe,xwe,twe(rwe,{brighter(e){return e=null==e?iwe:iwe**+e,new Swe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?nwe:nwe**+e,new Swe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Swe(Twe(this.r),Twe(this.g),Twe(this.b),Cwe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wwe,formatHex:wwe,formatHex8:function(){return`#${Pwe(this.r)}${Pwe(this.g)}${Pwe(this.b)}${Pwe(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Awe,toString:Awe})),ewe(kwe,function(e,t,r,n){return 1===arguments.length?Mwe(e):new kwe(e,t,r,n??1)},twe(rwe,{brighter(e){return e=null==e?iwe:iwe**+e,new kwe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?nwe:nwe**+e,new kwe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Swe(Owe(e>=240?e-240:e+120,i,n),Owe(e,i,n),Owe(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new kwe(Iwe(this.h),Dwe(this.s),Dwe(this.l),Cwe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Cwe(this.opacity);return`${1===e?"hsl(":"hsla("}${Iwe(this.h)}, ${100*Dwe(this.s)}%, ${100*Dwe(this.l)}%${1===e?")":`, ${e})`}`}}));var Rwe=e=>()=>e;function Bwe(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):Rwe(isNaN(e)?t:e)}var Nwe=function e(t){var r=function(e){return 1==(e=+e)?Bwe:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):Rwe(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=xwe(e)).r,(t=xwe(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Bwe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function Fwe(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function Lwe(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=Hwe(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function $we(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Uwe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function jwe(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=Hwe(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}var zwe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gwe=new RegExp(zwe.source,"g");function Vwe(e,t){var r,n,i,a=zwe.lastIndex=Gwe.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=zwe.exec(e))&&(n=Gwe.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:Uwe(r,n)})),a=Gwe.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function Hwe(e,t){var r,n=typeof t;return null==t||"boolean"===n?Rwe(t):("number"===n?Uwe:"string"===n?(r=ywe(t))?(t=r,Nwe):Vwe:t instanceof ywe?Nwe:t instanceof Date?$we:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?Fwe:Array.isArray(t)?Lwe:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?jwe:Uwe)(e,t)}function qwe(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var Wwe,Xwe=180/Math.PI,Ywe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Kwe(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Xwe,skewX:Math.atan(u)*Xwe,scaleX:o,scaleY:s}}function Zwe(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];
599return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:Uwe(e,i)},{i:u-2,x:Uwe(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:Uwe(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:Uwe(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:Uwe(e,r)},{i:s-2,x:Uwe(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var Qwe,Jwe,eAe=Zwe(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ywe:Kwe(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),tAe=Zwe(function(e){return null==e?Ywe:(Wwe||=document.createElementNS("http://www.w3.org/2000/svg","g"),Wwe.setAttribute("transform",e),(e=Wwe.transform.baseVal.consolidate())?Kwe((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Ywe)},", ",")",")"),rAe=0,nAe=0,iAe=0,aAe=0,oAe=0,sAe=0,uAe="object"==typeof performance&&performance.now?performance:Date,cAe="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function lAe(){return oAe||=(cAe(dAe),uAe.now()+sAe)}function dAe(){oAe=0}function fAe(){this._call=this._time=this._next=null}function hAe(e,t,r){var n=new fAe;return n.restart(e,t,r),n}function pAe(){oAe=(aAe=uAe.now())+sAe,rAe=nAe=0;try{!function(){lAe(),++rAe;for(var e,t=Qwe;t;)(e=oAe-t._time)>=0&&t._call.call(void 0,e),t=t._next;--rAe}()}finally{rAe=0,function(){for(var e,t,r=Qwe,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:Qwe=t);Jwe=e,gAe(n)}(),oAe=0}}function mAe(){var e=uAe.now(),t=e-aAe;t>1e3&&(sAe-=t,aAe=e)}function gAe(e){rAe||(nAe&&=clearTimeout(nAe),e-oAe>24?(e<1/0&&(nAe=setTimeout(pAe,e-uAe.now()-sAe)),iAe&&=clearInterval(iAe)):(iAe||=(aAe=uAe.now(),setInterval(mAe,1e3)),rAe=1,cAe(pAe)))}function vAe(e,t,r){var n=new fAe;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}fAe.prototype=hAe.prototype={constructor:fAe,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?lAe():+r)+(null==t?0:+t),this._next||Jwe===this||(Jwe?Jwe._next=this:Qwe=this,Jwe=this),this._call=e,this._time=r,gAe()},stop:function(){this._call&&(this._call=null,this._time=1/0,gAe())}};var yAe=Bxe("start","end","cancel","interrupt"),bAe=[];function _Ae(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return vAe(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(vAe(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
599),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=hAe(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:yAe,tween:bAe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function xAe(e,t){var r=wAe(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function SAe(e,t){var r=wAe(e,t);if(r.state>3)throw Error("too late; already running");return r}function wAe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function AAe(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}function CAe(e,t){var r,n;return function(){var i=SAe(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function TAe(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=SAe(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function PAe(e,t,r){var n=e._id;return e.each(function(){var e=SAe(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return wAe(e,n).value[t]}}function EAe(e,t){var r;return("number"==typeof t?Uwe:t instanceof ywe?Nwe:(r=ywe(t))?(t=r,Nwe):Vwe)(e,t)}function MAe(e){return function(){this.removeAttribute(e)}}function kAe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function IAe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function DAe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function OAe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function RAe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function BAe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function NAe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function FAe(e,t){return function(){xAe(this,e).delay=+t.apply(this,arguments)}}function LAe(e,t){return t=+t,function(){xAe(this,e).delay=t}}function $Ae(e,t){return function(){SAe(this,e).duration=+t.apply(this,arguments)}}function UAe(e,t){return t=+t,function(){SAe(this,e).duration=t}}var jAe=YSe.prototype.constructor;function zAe(e){return function(){this.style.removeProperty(e)}}var GAe=0;function VAe(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function HAe(){return++GAe}var qAe=YSe.prototype;VAe.prototype={constructor:VAe,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=qxe(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,_Ae(d[f],t,r,f,d,wAe(s,r)));return new VAe(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=Xxe(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=wAe(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&_Ae(f,t,r,m,h,p);a.push(h),o.push(u)}return new VAe(a,o,t,r)},selectChild:qAe.selectChild,selectChildren:qAe.selectChildren,filter:function(e){"function"!=typeof e&&(e=Yxe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new VAe(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new VAe(o,this._parents,this._name,this._id)},selection:function(){return new jAe(this._groups,this._parents)}
vendor: 8,423 bytes, line 599
599,transition:function(){for(var e=this._name,t=this._id,r=HAe(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=wAe(o,t);_Ae(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new VAe(n,this._parents,e,r)},call:qAe.call,nodes:qAe.nodes,node:qAe.node,size:qAe.size,empty:qAe.empty,each:qAe.each,on:function(e,t){var r=this._id;return arguments.length<2?wAe(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?xAe:SAe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=jxe(e),n="transform"===r?tAe:EAe;return this.attrTween(e,"function"==typeof t?(r.local?RAe:OAe)(r,n,PAe(this,"attr."+e,t)):null==t?(r.local?kAe:MAe)(r):(r.local?DAe:IAe)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=jxe(e);return this.tween(r,(n.local?BAe:NAe)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?eAe:EAe;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=ySe(this,e),o=(this.style.removeProperty(e),ySe(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,zAe(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=ySe(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=ySe(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,PAe(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=SAe(this,e),c=u.on,l=null==u.value[o]?a||=zAe(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=ySe(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(PAe(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=wAe(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?CAe:TAe)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?FAe:LAe)(t,e)):wAe(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?$Ae:UAe)(t,e)):wAe(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){SAe(this,e).ease=t}}(t,e)):wAe(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();SAe(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=SAe(this,n),i=r.on;i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:qAe[Symbol.iterator]};var WAe={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function XAe(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}YSe.prototype.interrupt=function(e){return this.each(function(){AAe(this,e)})},YSe.prototype.transition=function(e){var t,r;e instanceof VAe?(t=e._id,e=e._name):(t=HAe(),(r=WAe).time=lAe(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&_Ae(o,e,t,c,s,r||XAe(o,t));return new VAe(n,this._parents,e,t)};var YAe=e=>()=>e;function KAe(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function ZAe(e){e.preventDefault(),e.stopImmediatePropagation()}var QAe={name:"drag"},JAe={name:"space"},eCe={name:"handle"},tCe={name:"center"},{abs:rCe,max:nCe,min:iCe}=Math;function aCe(e){return[+e[0],+e[1]]}function oCe(e){return[aCe(e[0]),aCe(e[1])]}var sCe={name:"x",handles:["w","e"].map(pCe),input:function(e,t){return null==e?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},uCe={name:"y",handles:["n","s"].map(pCe),input:function(e,t){return null==e?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},cCe={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},lCe={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},dCe={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},fCe={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},hCe={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function pCe(e){return{type:e}}function mCe(e){return!e.ctrlKey&&!e.button}function gCe(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function vCe(){return navigator.maxTouchPoints||"ontouchstart"in this}function yCe(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function bCe(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function _Ce(e){return(e=bCe(Math.abs(e)))?e[1]:NaN}var xCe,SCe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wCe(e){if(!(t=SCe.exec(e)))throw Error("invalid format: "+e);var t;return new ACe({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ACe(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function CCe(e,t){var r=bCe(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}wCe.prototype=ACe.prototype,ACe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var TCe={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>
vendor: 1,882 bytes, line 599
599e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>CCe(100*e,t),r:CCe,s:function(e,t){var r=bCe(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(xCe=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+bCe(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function PCe(e){return e}var ECe,MCe,kCe,ICe=Array.prototype.map,DCe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function OCe(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function RCe(e){return+e}ECe=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?PCe:(t=ICe.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?PCe:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(ICe.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=wCe(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):TCe[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=TCe[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;
599if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?DCe[8+xCe/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=wCe(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(_Ce(t)/3))),i=10**-n,a=DCe[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),MCe=ECe.format,kCe=ECe.formatPrefix;var BCe,NCe,FCe,LCe,$Ce,UCe,jCe,zCe,GCe,VCe,HCe,qCe,WCe,XCe=[0,1];function YCe(e){return e}function KCe(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function ZCe(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=KCe(i,n),a=r(o,a)):(n=KCe(n,i),a=r(a,o)),function(e){return a(n(e))}}function QCe(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=KCe(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=xxe(e,t,1,n)-1;return a[r](i[r](t))}}function JCe(){var e=function(){var e,t,r,n,i,a,o=XCe,s=XCe,u=Hwe,c=YCe;function l(){var e=Math.min(o.length,s.length);return c!==YCe&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?QCe:ZCe,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),Uwe))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,RCe),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=qwe,l()},d.clamp=function(e){return arguments.length?(c=!!e||YCe,l()):c!==YCe},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}()(YCe,YCe);return e.copy=function(){return t=e,JCe().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},OCe.apply(e,arguments),function(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?Cxe(t,e,r):Cxe(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return function(e,t,r,n){var i,a=function(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?Txe(t,e,r):Txe(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}(e,t,r);switch((n=wCe(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(_Ce(t)/3)))-_Ce(Math.abs(e)))}(a,o))||(n.precision=i),kCe(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,_Ce(t)-_Ce(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-_Ce(Math.abs(e)))}(a))||(n.precision=i-2*("%"===n.type))}return MCe(n)}(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=Txe(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}(e)}function eTe(e,t,r){this.k=e,this.x=t,this.y=r}eTe.prototype={constructor:eTe,scale:function(e){return 1===e?this:new eTe(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new eTe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},eTe.prototype;var tTe=class extends(bu(gu(pu(du(ei(wu(_c))))))){constructor(){super(),BCe.set(this,void 0),NCe.set(this,void 0),FCe.set(this,void 0),LCe.set(this,void 0),$Ce.set(this,void 0),UCe.set(this,void 0),jCe.set(this,void 0),zCe.set(this,void 0),GCe.set(this,void 0),VCe.set(this,void 0),HCe.set(this,void 0),qCe.set(this,void 0),WCe.set(this,null),this["ruler-start"]=1,this["ruler-padding"]=10,this["scale-factor"]=(this.length||0)/5||10,this["show-highlight"]=!1,c_e(this,BCe,null,"f"),c_e(this,NCe,!1,"f")}createNavRuler(){let e=this.width-this["margin-right"]-this["ruler-padding"];c_e(this,BCe,JCe().range([this["margin-left"]+this["ruler-padding"],e]).domain([this["ruler-start"],this["ruler-start"]+(this.length||1)]),"f"),c_e(this,FCe,KSe(this).selectAll("svg").attr("id","").attr("width",this.width).attr("height",this.height),"f"),c_e(this,GCe,Oxe(0,u_e(this,BCe,"f")),"f"),c_e(this,LCe,u_e(this,FCe,"f").append("text").attr("class","start-label").attr("x",this["margin-left"]).attr("y",this.height-this["margin-bottom"]-2).style("font-family","sans-serif").style("font-size",12),"f"),c_e(this,$Ce,u_e(this,FCe,"f").append("text").attr("class","end-label").attr("x",this.width-this["margin-right"]).attr("y",this.height-this["margin-bottom"]-2).attr("text-anchor","end").style("font-family","sans-serif").style("font-size",12),"f"),c_e(this,UCe,u_e(this,FCe,"f").append("g").attr("class","x axis").call(u_e(this,GCe,"f")),"f"),c_e(this,VCe,function(e){var t,r=gCe,n=mCe,i=vCe,a=!0,o=Bxe("start","brush","end"),s=6;function u(t){var r=t.property("__brush",m).selectAll(".overlay").data([pCe("overlay")]);r.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",cCe.overlay).merge(r).each(function(){var e=yCe(this).extent;KSe(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])}),t.selectAll(".selection").data([pCe("selection")]).enter().append("rect").attr("class","selection").attr("cursor",cCe.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var n=t.selectAll(".handle").data(e.handles,function(e){return e.type});
vendor: 5,532 bytes, line 599
599n.exit().remove(),n.enter().append("rect").attr("class",function(e){return"handle handle--"+e.type}).attr("cursor",function(e){return cCe[e.type]}),t.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var e=KSe(this),t=yCe(this).selection;t?(e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]),e.selectAll(".handle").style("display",null).attr("x",function(e){return"e"===e.type[e.type.length-1]?t[1][0]-s/2:t[0][0]-s/2}).attr("y",function(e){return"s"===e.type[0]?t[1][1]-s/2:t[0][1]-s/2}).attr("width",function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+s:s}).attr("height",function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+s:s})):e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function l(e,t,r){var n=e.__brush.emitter;return!n||r&&n.clean?new d(e,t,r):n}function d(e,t,r){this.that=e,this.args=t,this.state=e.__brush,this.active=0,this.clean=r}function f(r){if((!t||r.touches)&&n.apply(this,arguments)){var i,o,s,u,d,f,h,p,m,g,v,y=this,b=r.target.__data__.type,_="selection"===(a&&r.metaKey?b="overlay":b)?QAe:a&&r.altKey?tCe:eCe,x=e===uCe?null:fCe[b],S=e===sCe?null:hCe[b],w=yCe(y),A=w.extent,C=w.selection,T=A[0][0],P=A[0][1],E=A[1][0],M=A[1][1],k=0,I=0,D=x&&S&&a&&r.shiftKey,O=Array.from(r.touches||[r],e=>{let t=e.identifier;return(e=ZSe(e,y)).point0=e.slice(),e.identifier=t,e});AAe(y);var R=l(y,arguments,!0).beforestart();if("overlay"===b){C&&(m=!0);let t=[O[0],O[1]||O[0]];w.selection=C=[[i=e===uCe?T:iCe(t[0][0],t[1][0]),s=e===sCe?P:iCe(t[0][1],t[1][1])],[d=e===uCe?E:nCe(t[0][0],t[1][0]),h=e===sCe?M:nCe(t[0][1],t[1][1])]],O.length>1&&$(r)}else i=C[0][0],s=C[0][1],d=C[1][0],h=C[1][1];o=i,u=s,f=d,p=h;var B=KSe(y).attr("pointer-events","none"),N=B.selectAll(".overlay").attr("cursor",cCe[b]);if(r.touches)R.moved=L,R.ended=U;else{var F=KSe(r.view).on("mousemove.brush",L,!0).on("mouseup.brush",U,!0);a&&F.on("keydown.brush",function(e){switch(e.keyCode){case 16:D=x&&S;break;case 18:_===eCe&&(x&&(d=f-k*x,i=o+k*x),S&&(h=p-I*S,s=u+I*S),_=tCe,$(e));break;case 32:_!==eCe&&_!==tCe||(x<0?d=f-k:x>0&&(i=o-k),S<0?h=p-I:S>0&&(s=u-I),_=JAe,N.attr("cursor",cCe.selection),$(e));break;default:return}ZAe(e)},!0).on("keyup.brush",function(e){switch(e.keyCode){case 16:D&&(g=v=D=!1,$(e));break;case 18:_===tCe&&(x<0?d=f:x>0&&(i=o),S<0?h=p:S>0&&(s=u),_=eCe,$(e));break;case 32:_===JAe&&(e.altKey?(x&&(d=f-k*x,i=o+k*x),S&&(h=p-I*S,s=u+I*S),_=tCe):(x<0?d=f:x>0&&(i=o),S<0?h=p:S>0&&(s=u),_=eCe),N.attr("cursor",cCe[b]),$(e));break;default:return}ZAe(e)},!0),function(e){var t=e.document.documentElement,r=KSe(e).on("dragstart.drag",JSe,QSe);"onselectstart"in t?r.on("selectstart.drag",JSe,QSe):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}(r.view)}c.call(y),R.start(r,_.name)}function L(e){for(let t of e.changedTouches||[e])for(let e of O)e.identifier===t.identifier&&(e.cur=ZSe(t,y));if(D&&!g&&!v&&1===O.length){let e=O[0];rCe(e.cur[0]-e[0])>rCe(e.cur[1]-e[1])?v=!0:g=!0}for(let e of O)e.cur&&(e[0]=e.cur[0],e[1]=e.cur[1]);m=!0,ZAe(e),$(e)}function $(e){let t=O[0],r=t.point0;var n;switch(k=t[0]-r[0],I=t[1]-r[1],_){case JAe:case QAe:x&&(k=nCe(T-i,iCe(E-d,k)),o=i+k,f=d+k),S&&(I=nCe(P-s,iCe(M-h,I)),u=s+I,p=h+I);break;case eCe:O[1]?(x&&=(o=nCe(T,iCe(E,O[0][0])),f=nCe(T,iCe(E,O[1][0])),1),S&&=(u=nCe(P,iCe(M,O[0][1])),p=nCe(P,iCe(M,O[1][1])),1)):(x<0?(k=nCe(T-i,iCe(E-i,k)),o=i+k,f=d):x>0&&(k=nCe(T-d,iCe(E-d,k)),o=i,f=d+k),S<0?(I=nCe(P-s,iCe(M-s,I)),u=s+I,p=h):S>0&&(I=nCe(P-h,iCe(M-h,I)),u=s,p=h+I));break;case tCe:x&&(o=nCe(T,iCe(E,i-k*x)),f=nCe(T,iCe(E,d+k*x))),S&&(u=nCe(P,iCe(M,s-I*S)),p=nCe(P,iCe(M,h+I*S)))}f<o&&(x*=-1,n=i,i=d,d=n,n=o,o=f,f=n,b in lCe&&N.attr("cursor",cCe[b=lCe[b]])),p<u&&(S*=-1,n=s,s=h,h=n,n=u,u=p,p=n,b in dCe&&N.attr("cursor",cCe[b=dCe[b]])),w.selection&&(C=w.selection),g&&(o=C[0][0],f=C[1][0]),v&&(u=C[0][1],p=C[1][1]),C[0][0]===o&&C[0][1]===u&&C[1][0]===f&&C[1][1]===p||(w.selection=[[o,u],[f,p]],c.call(y),R.brush(e,_.name))}function U(e){if(function(e){e.stopImmediatePropagation()}(e),e.touches){if(e.touches.length)return;t&&clearTimeout(t),t=setTimeout(function(){t=null},500)}else(function(e,t){var r=e.document.documentElement,n=KSe(e).on("dragstart.drag",null);t&&(n.on("click.drag",JSe,QSe),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)})(e.view,m),F.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);B.attr("pointer-events","all"),N.attr("cursor",cCe.overlay),w.selection&&(C=w.selection),function(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}(C)&&(w.selection=null,c.call(y)),R.end(e,_.name)}}function h(e){l(this,arguments).moved(e)}function p(e){l(this,arguments).ended(e)}function m(){var t=this.__brush||{selection:null};return t.extent=oCe(r.apply(this,arguments)),t.dim=e,t}return u.move=function(t,r,n){t.tween?t.on("start.brush",function(e){l(this,arguments).beforestart().start(e)}).on("interrupt.brush end.brush",function(e){l(this,arguments).end(e)}).tween("brush",function(){var t=this,n=t.__brush,i=l(t,arguments),a=n.selection,o=e.input("function"==typeof r?r.apply(this,arguments):r,n.extent),s=Hwe(a,o);
599function u(e){n.selection=1===e&&null===o?null:s(e),c.call(t),i.brush()}return null!==a&&null!==o?u:u(1)}):t.each(function(){var t=this,i=arguments,a=t.__brush,o=e.input("function"==typeof r?r.apply(t,i):r,a.extent),s=l(t,i).beforestart();AAe(t),a.selection=null===o?null:o,c.call(t),s.start(n).brush(n).end(n)})},u.clear=function(e,t){u.move(e,null,t)},d.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(e,t){return this.starting?(this.starting=!1,this.emit("start",e,t)):this.emit("brush",e),this},brush:function(e,t){return this.emit("brush",e,t),this},end:function(e,t){return 0==--this.active&&(delete this.state.emitter,this.emit("end",e,t)),this},emit:function(t,r,n){var i=KSe(this.that).datum();o.call(t,this.that,new KAe(t,{sourceEvent:r,target:u,selection:e.output(this.state.selection),mode:n,dispatch:o}),i)}},u.extent=function(e){return arguments.length?(r="function"==typeof e?e:YAe(oCe(e)),u):r},u.filter=function(e){return arguments.length?(n="function"==typeof e?e:YAe(!!e),u):n},u.touchable=function(e){return arguments.length?(i="function"==typeof e?e:YAe(!!e),u):i},u.handleSize=function(e){return arguments.length?(s=+e,u):s},u.keyModifiers=function(e){return arguments.length?(a=!!e,u):a},u.on=function(){var e=o.on.apply(o,arguments);return e===o?u:e},u}(sCe).extent([[this["margin-left"]+this["ruler-padding"],0],[e,.5*this.height+3]]).handleSize(6).on("end",({selection:e})=>{null===e&&u_e(this,WCe,"f")&&u_e(this,jCe,"f")&&u_e(this,VCe,"f")&&u_e(this,jCe,"f").call(u_e(this,VCe,"f").move,u_e(this,WCe,"f"))}).on("brush",({selection:e,transform:t})=>{e&&u_e(this,BCe,"f")&&(c_e(this,WCe,e,"f"),this["display-start"]=Math.round(100*u_e(this,BCe,"f").invert(e[0]))/100,this["display-end"]=Math.round(100*u_e(this,BCe,"f").invert(e[1]))/100,u_e(this,NCe,"f")||this.dispatchEvent(new CustomEvent("change",{detail:{"display-end":this["display-end"],"display-start":this["display-start"],extra:{transform:t}},bubbles:!0,cancelable:!0})),this.updateLabels(),this.updatePolygon())}),"f"),c_e(this,jCe,u_e(this,FCe,"f").append("g").attr("class","brush"),"f"),e>0&&(u_e(this,jCe,"f").call(u_e(this,VCe,"f")),u_e(this,jCe,"f").call(u_e(this,VCe,"f").move,[u_e(this,BCe,"f").call(this,this.getStart()),u_e(this,BCe,"f").call(this,this.getEnd())])),c_e(this,zCe,u_e(this,FCe,"f").append("polygon").attr("class","zoom-polygon").attr("fill","#777").attr("fill-opacity","0.3"),"f"),c_e(this,qCe,u_e(this,FCe,"f").append("g").attr("class","margin"),"f"),this.createHighlight(),this.renderD3()}createHighlight(){u_e(this,FCe,"f")&&(c_e(this,HCe,u_e(this,FCe,"f").append("g").attr("class","highlighted"),"f"),this.updateHighlight())}onDimensionsChange(){var e,t,r,n;u_e(this,BCe,"f")&&(u_e(this,BCe,"f").range([this["margin-left"]+this["ruler-padding"],this.width-this["margin-right"]-this["ruler-padding"]]),null==(e=u_e(this,FCe,"f"))||e.attr("width",this.width),null==(t=u_e(this,FCe,"f"))||t.attr("height",this.height),null==(r=u_e(this,VCe,"f"))||r.extent([[this["margin-left"]+this["ruler-padding"],0],[this.width-this["margin-right"]-this["ruler-padding"],.5*this.height+3]]),u_e(this,VCe,"f")&&(null==(n=u_e(this,jCe,"f"))||n.call(u_e(this,VCe,"f"))))}render(){return K_e`<svg class="container"></svg>`}updated(e){this.renderD3(),super.updated(e)}firstUpdated(){this.createNavRuler()}renderD3(){if(u_e(this,BCe,"f")&&u_e(this,UCe,"f")&&u_e(this,GCe,"f")&&u_e(this,VCe,"f")){u_e(this,BCe,"f").domain([this["ruler-start"],this["ruler-start"]+(this.length||1)-1]),u_e(this,UCe,"f").call(u_e(this,GCe,"f")),this.updatePolygon(),this.updateLabels();let e=[u_e(this,BCe,"f").call(this,this.getStart()),u_e(this,BCe,"f").call(this,this.getEnd())];u_e(this,jCe,"f")&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&e[0]>=0&&e[1]>=0&&e[0]<e[1]&&(c_e(this,NCe,!0,"f"),u_e(this,jCe,"f").call(u_e(this,VCe,"f").move,e),c_e(this,NCe,!1,"f")),this.updateHighlight(),this.renderMarginOnGroup(u_e(this,qCe,"f"))}}locate(e,t){u_e(this,jCe,"f")&&u_e(this,VCe,"f")&&u_e(this,BCe,"f")&&u_e(this,jCe,"f").call(u_e(this,VCe,"f").move,[u_e(this,BCe,"f").call(this,e),u_e(this,BCe,"f").call(this,t)])}
599zoomOut(){this.locate(Math.max(this["ruler-start"]||1,this.getStart()-this["scale-factor"]),Math.min((this.length||1)+this["ruler-start"]-1,this.getEnd()+this["scale-factor"]))}zoomIn(){let e=Math.min(this.getStart()+this["scale-factor"],this.getEnd()-1);this.locate(e,Math.max(this.getEnd()-this["scale-factor"],e+1))}updateHighlight(){if(!u_e(this,HCe,"f"))return;let e=JCe().domain([this["display-start"]||1,(this["display-end"]||this.length||1)+1]).range([this["margin-left"],this.width-this["margin-right"]]),t=JCe().domain([this["ruler-start"],this["ruler-start"]+(this.length||1)]).range([this["margin-left"]+this["ruler-padding"],this.width-this["margin-right"]-this["ruler-padding"]]),r=u_e(this,HCe,"f").selectAll("polygon").data(this["show-highlight"]?this.highlightedRegion.segments:[]);r.enter().append("polygon").attr("class","highlight-polygon").style("pointer-events","none").merge(r).attr("fill",this["highlight-color"]).attr("points",r=>{let n=Math.max(1,r.start),i=Math.min(this.length||1,r.end)+1;return`${t(n)},${this.height/2}\n        ${t(i)},${this.height/2}\n        ${e(i)},${this.height}\n        ${e(n)},${this.height}`}),r.exit().remove();let n=u_e(this,HCe,"f").selectAll("rect").data(this["show-highlight"]?this.highlightedRegion.segments:[]);n.enter().append("rect").attr("class","highlight-rectangle").style("pointer-events","none").merge(n).attr("fill",this["highlight-color"]).attr("x",e=>t(Math.max(1,e.start))).attr("width",e=>t(Math.min(this.length||1,e.end)+1)-t(Math.max(1,e.start))).attr("y",this["margin-top"]).attr("height",this.height/2),n.exit().remove()}updateLabels(){u_e(this,LCe,"f")&&u_e(this,LCe,"f").attr("x",this["margin-left"]).text(Math.round(this.getStart())),u_e(this,$Ce,"f")&&u_e(this,$Ce,"f").attr("x",this.width-this["margin-right"]).text(Math.round(this.getEnd()))}updatePolygon(){u_e(this,zCe,"f")&&u_e(this,BCe,"f")&&u_e(this,zCe,"f").attr("points",`${u_e(this,BCe,"f").call(this,this.getStart())},${this.height/2}\n        ${u_e(this,BCe,"f").call(this,this.getEnd())},${this.height/2}\n        ${this.width-this["margin-right"]},${this.height}\n        ${this["margin-left"]},${this.height}`)}getStart(){return this["display-start"]||1}getEnd(){return((this["display-end"]||0)>0?this["display-end"]:this.length)||1}};BCe=new WeakMap,NCe=new WeakMap,FCe=new WeakMap,LCe=new WeakMap,$Ce=new WeakMap,UCe=new WeakMap,jCe=new WeakMap,zCe=new WeakMap,GCe=new WeakMap,VCe=new WeakMap,HCe=new WeakMap,qCe=new WeakMap,WCe=new WeakMap,s_e([gxe({type:Number})],tTe.prototype,"ruler-start",void 0),s_e([gxe({type:Number})],tTe.prototype,"ruler-padding",void 0),s_e([gxe({type:Number})],tTe.prototype,"scale-factor",void 0),s_e([gxe({type:Boolean})],tTe.prototype,"show-highlight",void 0),tTe=s_e([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-navigation")],tTe);var rTe=tTe;function nTe(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function iTe(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function aTe(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var oTe=globalThis,sTe=oTe.ShadowRoot&&(void 0===oTe.ShadyCSS||oTe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,uTe=Symbol(),cTe=new WeakMap,lTe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==uTe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(sTe&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=cTe.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&cTe.set(t,e))}return e}toString(){return this.cssText}},dTe=sTe?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new lTe("string"==typeof e?e:e+"",void 0,uTe))(t)})(e):e,{is:fTe,defineProperty:hTe,getOwnPropertyDescriptor:pTe,getOwnPropertyNames:mTe,getOwnPropertySymbols:gTe,getPrototypeOf:vTe}=Object,yTe=globalThis,bTe=yTe.trustedTypes,_Te=bTe?bTe.emptyScript:"",xTe=yTe.reactiveElementPolyfillSupport,STe=(e,t)=>
599e,wTe={toAttribute(e,t){switch(t){case Boolean:e=e?_Te:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},ATe=(e,t)=>!fTe(e,t),CTe={attribute:!0,type:String,converter:wTe,reflect:!1,hasChanged:ATe};Symbol.metadata??=Symbol("metadata"),yTe.litPropertyMetadata??=new WeakMap;var TTe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=CTe){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&hTe(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=pTe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??CTe}static _$Ei(){if(this.hasOwnProperty(STe("elementProperties")))return;let e=vTe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(STe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(STe("properties"))){let e=this.properties,t=[...mTe(e),...gTe(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(dTe(e))}else void 0!==e&&t.push(dTe(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(sTe)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=oTe.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?wTe:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?wTe:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??ATe)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e
599=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};TTe.elementStyles=[],TTe.shadowRootOptions={mode:"open"},TTe[STe("elementProperties")]=new Map,TTe[STe("finalized")]=new Map,xTe?.({ReactiveElement:TTe}),(yTe.reactiveElementVersions??=[]).push("2.0.4");var PTe=globalThis,ETe=PTe.trustedTypes,MTe=ETe?ETe.createPolicy("lit-html",{createHTML:e=>e}):void 0,kTe="$lit$",ITe=`lit$${Math.random().toFixed(9).slice(2)}$`,DTe="?"+ITe,OTe=`<${DTe}>`,RTe=document,BTe=()=>RTe.createComment(""),NTe=e=>null===e||"object"!=typeof e&&"function"!=typeof e,FTe=Array.isArray,LTe="[ \t\n\f\r]",$Te=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,UTe=/-->/g,jTe=/>/g,zTe=RegExp(`>|${LTe}(?:([^\\s"'>=/]+)(${LTe}*=${LTe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),GTe=/'/g,VTe=/"/g,HTe=/^(?:script|style|textarea|title)$/i,qTe=(e,...t)=>({_$litType$:1,strings:e,values:t}),WTe=Symbol.for("lit-noChange"),XTe=Symbol.for("lit-nothing"),YTe=new WeakMap,KTe=RTe.createTreeWalker(RTe,129);function ZTe(e,t){if(!FTe(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===MTe?t:MTe.createHTML(t)}var QTe=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=$Te;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===$Te?"!--"===s[1]?o=UTe:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=zTe):(HTe.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=zTe):o=jTe:o===zTe?">"===s[0]?(o=r??$Te,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?zTe:'"'===s[3]?VTe:GTe):o===VTe||o===GTe?o=zTe:o===UTe||o===jTe?o=$Te:(o=zTe,r=void 0);let d=o===zTe&&e[t+1].startsWith("/>")?" ":"";a+=o===$Te?u+OTe:c>=0?(i.push(n),u.slice(0,c)+kTe+u.slice(c)+ITe+d):u+ITe+(-2===c?t:d)}return[ZTe(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),KTe.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=KTe.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(kTe)){let t=l[o++],r=i.getAttribute(e).split(ITe),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?nPe:"?"===n[1]?iPe:"@"===n[1]?aPe:rPe}),i.removeAttribute(e)}else e.startsWith(ITe)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(HTe.test(i.tagName)){let e=i.textContent.split(ITe),t=e.length-1;if(t>0){i.textContent=ETe?ETe.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],BTe()),KTe.nextNode(),u.push({type:2,index:++a});i.append(e[t],BTe())}}}else if(8===i.nodeType)if(i.data===DTe)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(ITe,e+1));)u.push({type:7,index:a}),e+=ITe.length-1}a++}}static createElement(e,t){let r=RTe.createElement("template");return r.innerHTML=e,r}};function JTe(e,t,r=e,n){if(t===WTe)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=NTe(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=JTe(e,i._$AS(e,t.values),i,n)),t}var ePe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??RTe).importNode(t,!0);KTe.currentNode=n;let i=KTe.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new tPe(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new oPe(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=KTe.nextNode(),a++)}return KTe.currentNode=RTe,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},tPe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=XTe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=JTe(this,e,t),NTe(e)?e===XTe||null==e||""===e?(this._$AH!==XTe&&this._$AR(),this._$AH=XTe):e!==this._$AH&&e!==WTe&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>FTe(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==XTe&&NTe(this._$AH)?this._$AA.nextSibling.data=e:this.T(RTe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=QTe.createElement(ZTe(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new ePe(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=YTe.get(e.strings);return void 0===t&&YTe.set(e.strings,t=new QTe(e)),t}k(t){FTe(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(BTe()),this.O(BTe()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},rPe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=XTe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=XTe}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=JTe(this,e,t,0),a=!NTe(e)||e!==this._$AH&&e!==WTe,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=JTe(this,s[r+n],t,n),o===WTe&&(o=this._$AH[n]),a||=!NTe(o)||o!==this._$AH[n],o===XTe?e=XTe:e!==XTe&&(e+=(o??"")+i[n+1]
599),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===XTe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},nPe=class extends rPe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===XTe?void 0:e}},iPe=class extends rPe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==XTe)}},aPe=class extends rPe{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=JTe(this,e,t,0)??XTe)===WTe)return;let r=this._$AH,n=e===XTe&&r!==XTe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==XTe&&(r===XTe||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},oPe=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){JTe(this,e)}},sPe=PTe.litHtmlPolyfillSupport;sPe?.(QTe,tPe),(PTe.litHtmlVersions??=[]).push("3.2.1");var uPe=class extends TTe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new tPe(t.insertBefore(BTe(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return WTe}};uPe._$litElement$=!0,uPe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:uPe});var cPe=globalThis.litElementPolyfillSupport;cPe?.({LitElement:uPe}),(globalThis.litElementVersions??=[]).push("4.1.1");var lPe={attribute:!0,type:String,converter:wTe,reflect:!1,hasChanged:ATe},dPe=(e=lPe,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function fPe(e){return e}var hPe=1e-6;function pPe(e){return"translate("+e+",0)"}function mPe(e){return t=>+e(t)}function gPe(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function vPe(){return!this.__axis}function yPe(e,t){var r=[],n=null,i=null,a=6,o=6,s=3,u=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=pPe;function l(e){var l=n??(t.ticks?t.ticks.apply(t,r):t.domain()),d=i??(t.tickFormat?t.tickFormat.apply(t,r):fPe),f=Math.max(a,0)+s,h=t.range(),p=+h[0]+u,m=+h[h.length-1]+u,g=(t.bandwidth?gPe:mPe)(t.copy(),u),v=e.selection?e.selection():e,y=v.selectAll(".domain").data([null]),b=v.selectAll(".tick").data(l,t).order(),_=b.exit(),x=b.enter().append("g").attr("class","tick"),S=b.select("line"),w=b.select("text");y=y.merge(y.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(x),S=S.merge(x.append("line").attr("stroke","currentColor").attr("y2",1*a)),w=w.merge(x.append("text").attr("fill","currentColor").attr("y",1*f).attr("dy","0.71em")),e!==v&&(y=y.transition(e),b=b.transition(e),S=S.transition(e),w=w.transition(e),_=_.transition(e).attr("opacity",hPe).attr("transform",function(e){return isFinite(e=g(e))?c(e+u):this.getAttribute("transform")}),x.attr("opacity",hPe).attr("transform",function(e){var t=this.parentNode.__axis;return c((t&&isFinite(t=t(e))?t:g(e))+u)})),_.remove(),y.attr("d",o?"M"+p+","+1*o+"V"+u+"H"+m+"V"+1*o:"M"+p+","+u+"H"+m),b.attr("opacity",1).attr("transform",function(e){return c(g(e)+u)}),S.attr("y2",1*a),w.attr("y",1*f).text(d),v.filter(vPe).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),v.each(function(){this.__axis=g})}return l.scale=function(e){return arguments.length?(t=e,l):t},l.ticks=function(){return r=Array.from(arguments),l},l.tickArguments=function(e){return arguments.length?(r=null==e?[]:Array.from(e),l):r.slice()},l.tickValues=function(e){return arguments.length?(n=null==e?null:Array.from(e),l):n&&n.slice()},l.tickFormat=function(e){return arguments.length?(i=e,l):i},l.tickSize=function(e){return arguments.length?(a=o=+e,l):a},l.tickSizeInner=function(e){return arguments.length?(a=+e,l):a},l.tickSizeOuter=function(e){return arguments.length?(o=+e,l):o},l.tickPadding=function(e){return arguments.length?(s=+e,l):s},l.offset=function(e){return arguments.length?(u=+e,l):u},l}var bPe={value:()=>{}};function _Pe(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new xPe(n)}function xPe(e){this._=e}function SPe(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function wPe(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=bPe,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}xPe.prototype=_Pe.prototype={constructor:xPe,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=wPe(i[r],e.name,t);else if(null==t)for(r in i)i[r]=wPe(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=SPe(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new xPe(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var APe="http://www.w3.org/1999/xhtml",CPe={svg:"http://www.w3.org/2000/svg",xhtml:APe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function TPe(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),CPe.hasOwnProperty(t)?{space:CPe[t],local:e}:e}function PPe(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===APe&&t.documentElement.namespaceURI===APe?t.createElement(e):t.createElementNS(r,e)}}function EPe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function MPe(e){var t=TPe(e);return(t.local?EPe:PPe)(t)}function kPe(){}function IPe(e){return null==e?kPe:function(){return this.querySelector(e)}}function DPe(){return[]}function OPe(e){return null==e?DPe:function(){return this.querySelectorAll(e)}}function RPe(e){return function(){return this.matches(e)}}function BPe(e){return function(t){return t.matches(e)}}var NPe=Array.prototype.find;function FPe(){return this.firstElementChild}var LPe=Array.prototype.filter;function $Pe(){return Array.from(this.children)}function UPe(e){return Array(e.length)}function jPe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function zPe(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new jPe(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function GPe(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new jPe(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function VPe(e){return e.__data__}function HPe(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function qPe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function WPe(e){return function(){this.removeAttribute(e)}}function XPe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function YPe(e,t){return function(){this.setAttribute(e,t)}}function KPe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ZPe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function QPe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function JPe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function eEe(e){return function(){this.style.removeProperty(e)}}function tEe(e,t,r){return function(){this.style.setProperty(e,t,r)}}function rEe(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function nEe(e,t){return e.style.getPropertyValue(t)||JPe(e).getComputedStyle(e,null).getPropertyValue(t)}function iEe(e){return function(){delete this[e]}}function aEe(e,t){return function(){this[e]=t}}function oEe(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function sEe(e){return e.trim().split(/^|\s+/)}function uEe(e){return e.classList||new cEe(e)}function cEe(e){this._node=e,this._names=sEe(e.getAttribute("class")||"")}function lEe(e,t){for(var r=uEe(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function dEe(e,t){for(var r=uEe(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function fEe(e){return function(){lEe(this,e)}}function hEe(e){return function(){dEe(this,e)}}function pEe(e,t){return function(){(t.apply(this,arguments)?lEe:dEe)(this,e)}}function mEe(){this.textContent=""}function gEe(e){return function(){this.textContent=e}}function vEe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yEe(){this.innerHTML=""}function bEe(e){return function(){this.innerHTML=e}}function _Ee(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function xEe(){this.nextSibling&&this.parentNode.appendChild(this)}function SEe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wEe(){return null}function AEe(){var e=this.parentNode;e&&e.removeChild(this)}function CEe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function TEe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function PEe(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function EEe(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function MEe(e,t,r){var n=JPe(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function kEe(e,t){return function(){return MEe(this,e,t)}}function IEe(e,t){return function(){return MEe(this,e,t.apply(this,arguments))}}jPe.prototype={constructor:jPe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},cEe.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var DEe=[null];function OEe(e,t){this._groups=e,this._parents=t}function REe(){return new OEe([[document.documentElement]],DEe)}function BEe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function NEe(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function FEe(){}OEe.prototype=REe.prototype={constructor:OEe,select:function(e){"function"!=typeof e&&(e=IPe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new OEe(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):OPe(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new OEe(n,i)},selectChild:function(e){return this.select(null==e?FPe:function(e){return function(){return NPe.call(this.children,e)}}("function"==typeof e?e:BPe(e)))},selectChildren:function(e){return this.selectAll(null==e?$Pe:function(e){return function(){return LPe.call(this.children,e)}}("function"==typeof e?e:BPe(e)))},filter:function(e){"function"!=typeof e&&(e=RPe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new OEe(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,VPe);var r=t?GPe:zPe,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;++c){var l=n[c],d=i[c],f=d.length,h=HPe(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new OEe(o,n))._enter=s,o._exit=u,o},enter:function(){return new OEe(this._enter||this._groups.map(UPe),this._parents)},exit:function(){return new OEe(this._exit||this._groups.map(UPe),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new OEe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=qPe;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new OEe(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);ret
vendor: 8,952 bytes, line 599
599urn this},attr:function(e,t){var r=TPe(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?XPe:WPe:"function"==typeof t?r.local?QPe:ZPe:r.local?KPe:YPe)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?eEe:"function"==typeof t?rEe:tEe)(e,t,r??"")):nEe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?iEe:"function"==typeof t?oEe:aEe)(e,t)):this.node()[e]},classed:function(e,t){var r=sEe(e+"");if(arguments.length<2){for(var n=uEe(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?pEe:t?fEe:hEe)(r,t))},text:function(e){return arguments.length?this.each(null==e?mEe:("function"==typeof e?vEe:gEe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?yEe:("function"==typeof e?_Ee:bEe)(e)):this.node().innerHTML},raise:function(){return this.each(xEe)},lower:function(){return this.each(SEe)},append:function(e){var t="function"==typeof e?e:MPe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:MPe(e),n=null==t?wEe:"function"==typeof t?t:IPe(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(AEe)},clone:function(e){return this.select(e?TEe:CEe)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?EEe:PEe,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?IEe:kEe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var LEe=.7,$Ee=1/LEe,UEe="\\s*([+-]?\\d+)\\s*",jEe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zEe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",GEe=/^#([0-9a-f]{3,8})$/,VEe=RegExp(`^rgb\\(${UEe},${UEe},${UEe}\\)$`),HEe=RegExp(`^rgb\\(${zEe},${zEe},${zEe}\\)$`),qEe=RegExp(`^rgba\\(${UEe},${UEe},${UEe},${jEe}\\)$`),WEe=RegExp(`^rgba\\(${zEe},${zEe},${zEe},${jEe}\\)$`),XEe=RegExp(`^hsl\\(${jEe},${zEe},${zEe}\\)$`),YEe=RegExp(`^hsla\\(${jEe},${zEe},${zEe},${jEe}\\)$`),KEe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ZEe(){return this.rgb().formatHex()}function QEe(){return this.rgb().formatRgb()}function JEe(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=GEe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?eMe(t):3===r?new nMe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?tMe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?tMe(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=VEe.exec(e))?new nMe(t[1],t[2],t[3],1):(t=HEe.exec(e))?new nMe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=qEe.exec(e))?tMe(t[1],t[2],t[3],t[4]):(t=WEe.exec(e))?tMe(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=XEe.exec(e))?cMe(t[1],t[2]/100,t[3]/100,1):(t=YEe.exec(e))?cMe(t[1],t[2]/100,t[3]/100,t[4]):KEe.hasOwnProperty(e)?eMe(KEe[e]):"transparent"===e?new nMe(NaN,NaN,NaN,0):null}function eMe(e){return new nMe(e>>16&255,e>>8&255,255&e,1)}function tMe(e,t,r,n){return n<=0&&(e=t=r=NaN),new nMe(e,t,r,n)}function rMe(e,t,r,n){return 1===arguments.length?function(e){return e instanceof FEe||(e=JEe(e)),e?new nMe((e=e.rgb()).r,e.g,e.b,e.opacity):new nMe}(e):new nMe(e,t,r,n??1)}function nMe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function iMe(){return`#${uMe(this.r)}${uMe(this.g)}${uMe(this.b)}`}function aMe(){let e=oMe(this.opacity);return`${1===e?"rgb(":"rgba("}${sMe(this.r)}, ${sMe(this.g)}, ${sMe(this.b)}${1===e?")":`, ${e})`}`}function oMe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sMe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function uMe(e){return((e=sMe(e))<16?"0":"")+e.toString(16)}function cMe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new dMe(e,t,r,n)}function lMe(e){if(e instanceof dMe)return new dMe(e.h,e.s,e.l,e.opacity);if(e instanceof FEe||(e=JEe(e)),!e)return new dMe;if(e instanceof dMe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new dMe(o,s,u,e.opacity)}function dMe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function fMe(e){return(e=(e||0)%360)<0?e+360:e}function hMe(e){return Math.max(0,Math.min(1,e||0))}function pMe(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}BEe(FEe,JEe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ZEe,formatHex:ZEe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return lMe(this).formatHsl()},formatRgb:QEe,toString:QEe}),BEe(nMe,rMe,NEe(FEe,{brighter(e){return e=null==e?$Ee:$Ee**+e,new nMe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?LEe:LEe**+e,new nMe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new nMe(sMe(this.r),sMe(this.g),sMe(this.b),oMe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:iMe,formatHex:iMe,formatHex8:function(){return`#${uMe(this.r)}${uMe(this.g)}${uMe(this.b)}${uMe(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:aMe,toString:aMe})),BEe(dMe,function(e,t,r,n){return 1===arguments.length?lMe(e):new dMe(e,t,r,n??1)},NEe(FEe,{brighter(e){return e=null==e?$Ee:$Ee**+e,new dMe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?LEe:LEe**+e,new dMe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;
599return new nMe(pMe(e>=240?e-240:e+120,i,n),pMe(e,i,n),pMe(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new dMe(fMe(this.h),hMe(this.s),hMe(this.l),oMe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=oMe(this.opacity);return`${1===e?"hsl(":"hsla("}${fMe(this.h)}, ${100*hMe(this.s)}%, ${100*hMe(this.l)}%${1===e?")":`, ${e})`}`}}));var mMe=e=>()=>e;function gMe(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):mMe(isNaN(e)?t:e)}var vMe=function e(t){var r=function(e){return 1==(e=+e)?gMe:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):mMe(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=rMe(e)).r,(t=rMe(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=gMe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function yMe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var bMe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_Me=new RegExp(bMe.source,"g");function xMe(e,t){var r,n,i,a=bMe.lastIndex=_Me.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=bMe.exec(e))&&(n=_Me.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:yMe(r,n)})),a=_Me.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}var SMe,wMe=180/Math.PI,AMe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function CMe(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*wMe,skewX:Math.atan(u)*wMe,scaleX:o,scaleY:s}}function TMe(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:yMe(e,i)},{i:u-2,x:yMe(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:yMe(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",
599null,n)-2,x:yMe(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:yMe(e,r)},{i:s-2,x:yMe(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var PMe,EMe,MMe=TMe(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?AMe:CMe(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),kMe=TMe(function(e){return null==e?AMe:(SMe||=document.createElementNS("http://www.w3.org/2000/svg","g"),SMe.setAttribute("transform",e),(e=SMe.transform.baseVal.consolidate())?CMe((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):AMe)},", ",")",")"),IMe=0,DMe=0,OMe=0,RMe=0,BMe=0,NMe=0,FMe="object"==typeof performance&&performance.now?performance:Date,LMe="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $Me(){return BMe||=(LMe(UMe),FMe.now()+NMe)}function UMe(){BMe=0}function jMe(){this._call=this._time=this._next=null}function zMe(e,t,r){var n=new jMe;return n.restart(e,t,r),n}function GMe(){BMe=(RMe=FMe.now())+NMe,IMe=DMe=0;try{!function(){$Me(),++IMe;for(var e,t=PMe;t;)(e=BMe-t._time)>=0&&t._call.call(void 0,e),t=t._next;--IMe}()}finally{IMe=0,function(){for(var e,t,r=PMe,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:PMe=t);EMe=e,HMe(n)}(),BMe=0}}function VMe(){var e=FMe.now(),t=e-RMe;t>1e3&&(NMe-=t,RMe=e)}function HMe(e){IMe||(DMe&&=clearTimeout(DMe),e-BMe>24?(e<1/0&&(DMe=setTimeout(GMe,e-FMe.now()-NMe)),OMe&&=clearInterval(OMe)):(OMe||=(RMe=FMe.now(),setInterval(VMe,1e3)),IMe=1,LMe(GMe)))}function qMe(e,t,r){var n=new jMe;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}jMe.prototype=zMe.prototype={constructor:jMe,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?$Me():+r)+(null==t?0:+t),this._next||EMe===this||(EMe?EMe._next=this:PMe=this,EMe=this),this._call=e,this._time=r,HMe()},stop:function(){this._call&&(this._call=null,this._time=1/0,HMe())}};var WMe=_Pe("start","end","cancel","interrupt"),XMe=[];function YMe(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return qMe(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(qMe(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
599),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=zMe(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:WMe,tween:XMe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function KMe(e,t){var r=QMe(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function ZMe(e,t){var r=QMe(e,t);if(r.state>3)throw Error("too late; already running");return r}function QMe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function JMe(e,t){var r,n;return function(){var i=ZMe(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function eke(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=ZMe(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function tke(e,t,r){var n=e._id;return e.each(function(){var e=ZMe(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return QMe(e,n).value[t]}}function rke(e,t){var r;return("number"==typeof t?yMe:t instanceof JEe?vMe:(r=JEe(t))?(t=r,vMe):xMe)(e,t)}function nke(e){return function(){this.removeAttribute(e)}}function ike(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ake(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function oke(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function ske(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function uke(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function cke(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function lke(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function dke(e,t){return function(){KMe(this,e).delay=+t.apply(this,arguments)}}function fke(e,t){return t=+t,function(){KMe(this,e).delay=t}}function hke(e,t){return function(){ZMe(this,e).duration=+t.apply(this,arguments)}}function pke(e,t){return t=+t,function(){ZMe(this,e).duration=t}}var mke=REe.prototype.constructor;function gke(e){return function(){this.style.removeProperty(e)}}var vke=0;function yke(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function bke(){return++vke}var _ke=REe.prototype;yke.prototype={constructor:yke,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=IPe(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,YMe(d[f],t,r,f,d,QMe(s,r)));return new yke(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=OPe(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=QMe(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&YMe(f,t,r,m,h,p);a.push(h),o.push(u)}return new yke(a,o,t,r)},selectChild:_ke.selectChild,selectChildren:_ke.selectChildren,filter:function(e){"function"!=typeof e&&(e=RPe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new yke(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new yke(o,this._parents,this._name,this._id)},selection:function(){return new mke(this._groups,this._parents)}
vendor: 4,303 bytes, line 599
599,transition:function(){for(var e=this._name,t=this._id,r=bke(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=QMe(o,t);YMe(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new yke(n,this._parents,e,r)},call:_ke.call,nodes:_ke.nodes,node:_ke.node,size:_ke.size,empty:_ke.empty,each:_ke.each,on:function(e,t){var r=this._id;return arguments.length<2?QMe(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?KMe:ZMe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=TPe(e),n="transform"===r?kMe:rke;return this.attrTween(e,"function"==typeof t?(r.local?uke:ske)(r,n,tke(this,"attr."+e,t)):null==t?(r.local?ike:nke)(r):(r.local?oke:ake)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=TPe(e);return this.tween(r,(n.local?cke:lke)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?MMe:rke;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=nEe(this,e),o=(this.style.removeProperty(e),nEe(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,gke(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=nEe(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=nEe(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,tke(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=ZMe(this,e),c=u.on,l=null==u.value[o]?a||=gke(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=nEe(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(tke(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=QMe(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?JMe:eke)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?dke:fke)(t,e)):QMe(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?hke:pke)(t,e)):QMe(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){ZMe(this,e).ease=t}}(t,e)):QMe(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();ZMe(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=ZMe(this,n),i=r.on;
599i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:_ke[Symbol.iterator]};var xke,Ske,wke,Ake={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Cke(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}function Tke(e,t,r){this.k=e,this.x=t,this.y=r}REe.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},REe.prototype.transition=function(e){var t,r;e instanceof yke?(t=e._id,e=e._name):(t=bke(),(r=Ake).time=$Me(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&YMe(o,e,t,c,s,r||Cke(o,t));return new yke(n,this._parents,e,t)},Tke.prototype={constructor:Tke,scale:function(e){return 1===e?this:new Tke(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Tke(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Tke.prototype;var Pke=class extends(bu(Tu(gu(pu(du(ei(wu(_c)))))))){constructor(){super(...arguments),xke.set(this,void 0),Ske.set(this,void 0),wke.set(this,void 0)}connectedCallback(){super.connectedCallback();let e=parseInt(this.getAttribute("numberofticks")||"",10);this.numberOfTicks=Number.isInteger(e)?e:3,this.addEventListener("load",e=>{this.data=e.detail.payload})}get data(){return this.sequence||""}set data(e){"string"==typeof e?this.sequence=e:"string"==typeof e?.sequence&&(this.sequence=e.sequence),this.svg&&(this.updateScaleDomain(),this.applyZoomTranslation())}getCharSize(){if(!this.seq_g)return;let e=this.seq_g.select("text.base").node();if(e)this.chWidth=.8*e.getBBox().width,this.chHeight=1.6*e.getBBox().height;else{let e=this.seq_g.append("text").attr("class","base").text("T");this.chWidth=.8*(e.node()?.getBBox().width||0),this.chHeight=1.6*(e.node()?.getBBox().height||0),e.remove()}}createSequence(){this.svg=function(e){return"string"==typeof e?new OEe([[document.querySelector(e)]],[document.documentElement]):new OEe([[e]],DEe)}(this).selectAll("svg").attr("id","").attr("width",this.width).attr("height",this.height),aTe(this,xke,this.svg?.append("g").attr("class","background"),"f"),aTe(this,Ske,this.svg?.append("g").attr("class","x axis"),"f"),this.seq_g=this.svg?.append("g").attr("class","sequence").attr("transform",`translate(0,${this["margin-top"]+.75*this.getHeightWithMargins()})`),this.highlighted=this.svg.append("g").attr("class","highlighted"),this.margins=this.svg.append("g").attr("class","margin"),this.sequence&&(this.updateScaleDomain(),this.applyZoomTranslation())}firstUpdated(){this.createSequence()}zoomRefreshed(){this.renderD3()}renderD3(){var e,t;if(this.getCharSize(),null==(e=this.svg)||e.attr("width",this.width).attr("height",this.height),iTe(this,Ske,"f")){let e=this.getSingleBaseWidth(),r=e-(this.chWidth||0),n=e/2,i=Math.floor(Math.max(0,this.getStart()-1)),a=Math.ceil(Math.min(this.sequence?.length||0,this.getEnd())),o=r<0?[]:this.sequence?.slice(i,a).split("").map((e,t)=>({position:1+i+t,aa:e}))||[];if(this.height>(this.chWidth||0)&&this.xScale){let e=(t=this.xScale,yPe(0,t)).tickFormat(e=>`${Number.isInteger(e)?e:""}`).ticks(this.numberOfTicks,"s");iTe(this,Ske,"f").call(e)}iTe(this,Ske,"f").attr("transform",`translate(${n},${this["margin-top"]})`),iTe(this,Ske,"f").select(".domain").remove(),iTe(this,Ske,"f").selectAll(".tick line").remove(),iTe(this,Ske,"f").selectAll(".tick text").attr("y",2);let s=Math.max(10,this.chWidth||10,Math.min(this["margin-top"]+.25*this.getHeightWithMargins(),e-2));if(iTe(this,Ske,"f").selectAll(".tick text").attr("font-size",s),this.seq_g){this.seq_g.attr("transform",`translate(0,${this["margin-top"]+.75*this.getHeightWithMargins()})`),aTe(this,wke,this.seq_g.selectAll("text.base"),"f");let t=iTe(this,wke,"f").data(o,e=>e.position);if(t.enter().append("text").attr("class","base").attr("text-anchor","middle").attr("x",e=>this.getXFromSeqPosition(e.position)+n).text(e=>e.aa).attr("font-size",s).style("pointer-events","none").style("font-family","monospace"),t.exit().remove(),t.attr("font-size",s).attr("x",e=>this.getXFromSeqPosition(e.position)+n),iTe(this,xke,"f")){let t=iTe(this,xke,"f").selectAll("rect.base_bg").data(o,e=>e.position);t.enter().append("rect").attr("class","base_bg feature").attr("height",this.getHeightWithMargins()).attr("width",e).attr("fill",e=>Math.round(e.position)%2?"#ccc":"#eee").attr("x",e=>this.getXFromSeqPosition(e.position)).attr("y",this["margin-top"]).style("opacity",Math.min(1,r)).call(ku,this),t.attr("width",e).attr("fill",e=>Math.round(e.position)%2?"#ccc":"#eee").attr("height",this.getHeightWithMargins()).attr("x",e=>this.getXFromSeqPosition(e.position)).attr("y",this["margin-top"]),t.exit().remove(),this.seq_g.style("opacity",Math.min(1,r)),t.style("opacity",Math.min(1,r))}}this.updateHighlight(),this.renderMarginOnGroup(this.margins)}}getStart(){return this["display-start"]||1}getEnd(){return((this["display-end"]||0)>0?this["display-end"]:this.length)||0}updateHighlight(){if(!this.highlighted)return;let e=this.highlighted.selectAll("rect").data(this.highlightedRegion.segments);
599e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",this["highlight-color"]).attr("height",this.height).attr("x",e=>this.getXFromSeqPosition(e.start)).attr("width",e=>Math.max(0,this.getSingleBaseWidth()*(e.end-e.start+1))),e.exit().remove()}render(){return qTe`<svg class="container"></svg>`}};xke=new WeakMap,Ske=new WeakMap,wke=new WeakMap,nTe([function(e){return(t,r)=>"object"==typeof r?dPe(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}({type:String})],Pke.prototype,"sequence",void 0);var Eke=Pke=nTe([Fu("nightingale-sequence")],Pke);function Mke(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function kke(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function Ike(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var Dke=globalThis,Oke=Dke.ShadowRoot&&(void 0===Dke.ShadyCSS||Dke.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Rke=Symbol(),Bke=new WeakMap,Nke=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Rke)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Oke&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=Bke.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Bke.set(t,e))}return e}toString(){return this.cssText}},Fke=Oke?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new Nke("string"==typeof e?e:e+"",void 0,Rke))(t)})(e):e,{is:Lke,defineProperty:$ke,getOwnPropertyDescriptor:Uke,getOwnPropertyNames:jke,getOwnPropertySymbols:zke,getPrototypeOf:Gke}=Object,Vke=globalThis,Hke=Vke.trustedTypes,qke=Hke?Hke.emptyScript:"",Wke=Vke.reactiveElementPolyfillSupport,Xke=(e,t)=>e,Yke={toAttribute(e,t){switch(t){case Boolean:e=e?qke:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Kke=(e,t)=>!Lke(e,t),Zke={attribute:!0,type:String,converter:Yke,reflect:!1,hasChanged:Kke};Symbol.metadata??=Symbol("metadata"),Vke.litPropertyMetadata??=new WeakMap;var Qke=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Zke){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&$ke(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=Uke(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zke}static _$Ei(){if(this.hasOwnProperty(Xke("elementProperties")))return;let e=Gke(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Xke("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Xke("properties"))){let e=this.properties,t=[...jke(e),...zke(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(Fke(e))}else void 0!==e&&t.push(Fke(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
599=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Oke)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=Dke.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Yke:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Yke:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??Kke)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};Qke.elementStyles=[],Qke.shadowRootOptions={mode:"open"},Qke[Xke("elementProperties")]=new Map,Qke[Xke("finalized")]=new Map,Wke?.({ReactiveElement:Qke}),(Vke.reactiveElementVersions??=[]).push("2.0.4");var Jke={attribute:!0,type:String,converter:Yke,reflect:!1,hasChanged:Kke},eIe=(e=Jke,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function tIe(e){return(t,r)=>"object"==typeof r?eIe(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function rIe(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function nIe(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function iIe(e){let t,r,n;
vendor: 14,032 bytes, line 599
599function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===rIe||e===nIe?e:aIe,r=e,n=e):(t=rIe,r=(t,r)=>rIe(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function aIe(){return 0}var oIe=iIe(rIe).right;iIe(function(e){return null===e?NaN:+e}).center;var sIe=Math.sqrt(50),uIe=Math.sqrt(10),cIe=Math.sqrt(2);function lIe(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=sIe?10:u>=uIe?5:u>=cIe?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?lIe(e,t,2*r):[n,i,a]}function dIe(e,t,r){return lIe(e=+e,t=+t,r=+r)[2]}function fIe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function hIe(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function pIe(){}var mIe=.7,gIe=1/mIe,vIe="\\s*([+-]?\\d+)\\s*",yIe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bIe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_Ie=/^#([0-9a-f]{3,8})$/,xIe=RegExp(`^rgb\\(${vIe},${vIe},${vIe}\\)$`),SIe=RegExp(`^rgb\\(${bIe},${bIe},${bIe}\\)$`),wIe=RegExp(`^rgba\\(${vIe},${vIe},${vIe},${yIe}\\)$`),AIe=RegExp(`^rgba\\(${bIe},${bIe},${bIe},${yIe}\\)$`),CIe=RegExp(`^hsl\\(${yIe},${bIe},${bIe}\\)$`),TIe=RegExp(`^hsla\\(${yIe},${bIe},${bIe},${yIe}\\)$`),PIe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function EIe(){return this.rgb().formatHex()}function MIe(){return this.rgb().formatRgb()}function kIe(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=_Ie.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?IIe(t):3===r?new RIe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?DIe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?DIe(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=xIe.exec(e))?new RIe(t[1],t[2],t[3],1):(t=SIe.exec(e))?new RIe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=wIe.exec(e))?DIe(t[1],t[2],t[3],t[4]):(t=AIe.exec(e))?DIe(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=CIe.exec(e))?UIe(t[1],t[2]/100,t[3]/100,1):(t=TIe.exec(e))?UIe(t[1],t[2]/100,t[3]/100,t[4]):PIe.hasOwnProperty(e)?IIe(PIe[e]):"transparent"===e?new RIe(NaN,NaN,NaN,0):null}function IIe(e){return new RIe(e>>16&255,e>>8&255,255&e,1)}function DIe(e,t,r,n){return n<=0&&(e=t=r=NaN),new RIe(e,t,r,n)}function OIe(e,t,r,n){return 1===arguments.length?function(e){return e instanceof pIe||(e=kIe(e)),e?new RIe((e=e.rgb()).r,e.g,e.b,e.opacity):new RIe}(e):new RIe(e,t,r,n??1)}function RIe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function BIe(){return`#${$Ie(this.r)}${$Ie(this.g)}${$Ie(this.b)}`}function NIe(){let e=FIe(this.opacity);return`${1===e?"rgb(":"rgba("}${LIe(this.r)}, ${LIe(this.g)}, ${LIe(this.b)}${1===e?")":`, ${e})`}`}function FIe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function LIe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $Ie(e){return((e=LIe(e))<16?"0":"")+e.toString(16)}function UIe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new zIe(e,t,r,n)}function jIe(e){if(e instanceof zIe)return new zIe(e.h,e.s,e.l,e.opacity);if(e instanceof pIe||(e=kIe(e)),!e)return new zIe;if(e instanceof zIe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new zIe(o,s,u,e.opacity)}function zIe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function GIe(e){return(e=(e||0)%360)<0?e+360:e}function VIe(e){return Math.max(0,Math.min(1,e||0))}function HIe(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}fIe(pIe,kIe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:EIe,formatHex:EIe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return jIe(this).formatHsl()},formatRgb:MIe,toString:MIe}),fIe(RIe,OIe,hIe(pIe,{brighter(e){return e=null==e?gIe:gIe**+e,new RIe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?mIe:mIe**+e,new RIe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new RIe(LIe(this.r),LIe(this.g),LIe(this.b),FIe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:BIe,formatHex:BIe,formatHex8:function(){return`#${$Ie(this.r)}${$Ie(this.g)}${$Ie(this.b)}${$Ie(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:NIe,toString:NIe})),fIe(zIe,function(e,t,r,n){return 1===arguments.length?jIe(e):new zIe(e,t,r,n??1)},hIe(pIe,{brighter(e){return e=null==e?gIe:gIe**+e,new zIe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?mIe:mIe**+e,new zIe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new RIe(HIe(e>=240?e-240:e+120,i,n),HIe(e,i,n),HIe(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new zIe(GIe(this.h),VIe(this.s),VIe(this.l),FIe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=FIe(this.opacity);return`${1===e?"hsl(":"hsla("}${GIe(this.h)}, ${100*VIe(this.s)}%, ${100*VIe(this.l)}%${1===e?")":`, ${e})`}`}}));var qIe=e=>()=>e;function WIe(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):qIe(isNaN(e)?t:e)}var XIe=function e(t){var r=function(e){return 1==(e=+e)?WIe:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):qIe(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=OIe(e)).r,(t=OIe(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=WIe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function YIe(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function KIe(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=nDe(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function ZIe(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function QIe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function JIe(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=nDe(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}var eDe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tDe=new RegExp(eDe.source,"g");function rDe(e,t){var r,n,i,a=eDe.lastIndex=tDe.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=eDe.exec(e))&&(n=tDe.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:QIe(r,n)})),a=tDe.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function nDe(e,t){var r,n,i=typeof t;return null==t||"boolean"===i?qIe(t):("number"===i?QIe:"string"===i?(r=kIe(t))?(t=r,XIe):rDe:t instanceof kIe?XIe:t instanceof Date?ZIe:(n=t,!ArrayBuffer.isView(n)||n instanceof DataView?Array.isArray(t)?KIe:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?JIe:QIe:YIe))(e,t)}function iDe(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function aDe(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function oDe(e){return(e=aDe(Math.abs(e)))?e[1]:NaN}var sDe,uDe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function cDe(e){if(!(t=uDe.exec(e)))throw Error("invalid format: "+e);var t;return new lDe({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function lDe(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function dDe(e,t){var r=aDe(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}cDe.prototype=lDe.prototype,lDe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var fDe={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>dDe(100*e,t),r:dDe,s:function(e,t){var r=aDe(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(sDe=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+aDe(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function hDe(e){return e}var pDe,mDe,gDe,vDe=Array.prototype.map,yDe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function bDe(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _De(e){return+e}pDe=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?hDe:(t=vDe.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?hDe:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(vDe.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=cDe(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):fDe[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=fDe[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;
599if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?yDe[8+sDe/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=cDe(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(oDe(t)/3))),i=10**-n,a=yDe[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),mDe=pDe.format,gDe=pDe.formatPrefix;var xDe=[0,1];function SDe(e){return e}function wDe(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function ADe(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=wDe(i,n),a=r(o,a)):(n=wDe(n,i),a=r(a,o)),function(e){return a(n(e))}}function CDe(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=wDe(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=oIe(e,t,1,n)-1;return a[r](i[r](t))}}function TDe(){var e=function(){var e,t,r,n,i,a,o=xDe,s=xDe,u=nDe,c=SDe;function l(){var e=Math.min(o.length,s.length);return c!==SDe&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?CDe:ADe,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),QIe))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,_De),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=iDe,l()},d.clamp=function(e){return arguments.length?(c=!!e||SDe,l()):c!==SDe},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}()(SDe,SDe);return e.copy=function(){return t=e,TDe().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},bDe.apply(e,arguments),function(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?lIe(t,e,r):lIe(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return function(e,t,r,n){var i,a=function(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?dIe(t,e,r):dIe(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}(e,t,r);switch((n=cDe(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(oDe(t)/3)))-oDe(Math.abs(e)))}(a,o))||(n.precision=i),gDe(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,oDe(t)-oDe(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-oDe(Math.abs(e)))}(a))||(n.precision=i-2*("%"===n.type))}return mDe(n)}(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=dIe(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}(e)}function PDe(e,t,r){this.k=e,this.x=t,this.y=r}PDe.prototype={constructor:PDe,scale:function(e){return 1===e?this:new PDe(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new PDe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},PDe.prototype;var EDe,MDe,kDe,IDe,DDe=e=>e,ODe=new Map([["hydrophobicity-interface-scale",{I:-.31,L:-.56,F:-1.13,V:.07,M:-.23,P:.45,W:-1.85,H:.17,T:.14,E:-.
59901,Q:.58,C:-.24,Y:-.94,A:.17,S:.13,N:.42,D:-.07,R:.81,G:.01,K:.99}],["hydrophobicity-octanol-scale",{I:-1.12,L:-1.25,F:-1.71,V:-.46,M:-.67,P:.14,W:-2.09,H:.11,T:.25,E:.11,Q:.77,C:-.02,Y:-.71,A:.5,S:.46,N:.85,D:.43,R:1.15,G:3.63,K:3.64}],["hydrophobicity-scale",{I:-.81,L:-.69,F:-.58,V:-.53,M:-.44,P:-.31,W:-.24,H:-.06,T:.11,E:.12,Q:.19,C:.22,Y:.23,A:.33,S:.33,N:.43,D:.5,R:1.14,G:1.61,K:2.41}],["isoelectric-point-scale",{I:6.04,L:6.04,F:5.91,V:6.02,M:5.74,P:6.3,W:5.88,H:7.64,T:5.6,E:3.08,Q:5.65,C:5.02,Y:5.63,A:6.11,S:5.68,N:5.41,D:2.87,R:10.76,G:6.06,K:9.47}]]),RDe={domain:[-2,2],range:["#ffdd00","#0000FF"]},BDe=class extends Eke{constructor(){super(...arguments),this.scale=void 0,this["color-range"]=void 0,EDe.set(this,""),MDe.set(this,void 0),kDe.set(this,void 0),IDe.set(this,void 0),this.colorScale=RDe}createSequence(){var e,t,r;super.createSequence(),Ike(this,EDe,Math.random().toString(36).substring(7),"f"),null==(e=this.svg)||e.select("g.sequence").attr("transform",null),Ike(this,MDe,this.svg?.append("defs").append("linearGradient").attr("id",`scale-gradient-${kke(this,EDe,"f")}`),"f"),null==(t=this.svg)||t.append("rect").attr("class","seq-gradient").style("pointer-events","none"),null==(r=this.svg)||r.selectAll("g.margin").remove(),this.margins=this.svg?.append("g").attr("class","margin")}getScaleFromAttribute(){let e=null,t=this.scale||"";if(ODe.has(t))return ODe.get(t);if(/([ILFVMPWHTEQCYASNDRGK]:-?\d+\.?\d*)(,[ILFVMPWHTEQCYASNDRGK]:-?\d+\.?\d*)*/.test(t))try{e=((e=null,t)=>{if(null!==e&&"string"!=typeof e)throw Error("The attribute text has to be of type string");let{keyFormatter:r,valueFormatter:n}={keyFormatter:DDe,valueFormatter:DDe,...t};if(e&&""!==e.trim()){let t=e.split(",").map(e=>e.split(":")),i={};return t.forEach(e=>{if(2!==e.length)throw Error(`Bad block: ${e.join(":")}\n The blocks of the string should follow the format KEY:VALUE`);i[r(e[0])]=n(e[1])}),i}return{}})(t,{keyFormatter:e=>e.toUpperCase(),valueFormatter:e=>parseFloat(e)})}catch(e){console.error(`Couldn't parse the given scale "${t}"`,e)}return e}renderD3(){var e,t,r;if(this.seq_g){null==(e=this.svg)||e.attr("width",this.width).attr("height",this.height),this.seq_g.attr("width",this.width);let n=this.getScaleFromAttribute();if(null===n)return void console.error("The attribute scale is not valid.");let i=TDe();this["color-range"]&&(this.colorScale=((e=null)=>{let t=[],r=[];if(null!==e&&"string"!=typeof e)throw Error("The attribute text has to be of type string");if(e&&""!==e.trim()){let n=e.split(",").map(e=>e.split(":"));if(n.length<2)throw Error("There should be at least 2 points to create a scale");t=n.map(e=>{let t=e[0].trim().toUpperCase();if(!function(e){let t=document.createElement("div");return t.style.borderColor="",t.style.borderColor=e,""!==t.style.borderColor}(t))throw Error(`The color '${t} is not valid'`);return t}),r=n.map((e,t)=>{let r=parseFloat(e[1]);if(Number.isNaN(r))throw Error(`The second part of every point should be a number. Error in point ${t}: ${e}`);return r})}return{range:t,domain:r}})(this["color-range"])),i.domain(this.colorScale.domain).range(this.colorScale.range);let a=this.getSingleBaseWidth(),o=Math.round(Math.max(0,this.getStart()-2)),s=Math.round(Math.min(this.sequence?.length||0,this.getEnd()+1)),u=this.sequence?.slice(o,s).split("").map((e,t)=>{let r=n&&e.toUpperCase()in n?n[e.toUpperCase()]:0;return{start:1+o+t,end:1+o+t,aa:e,value:r,color:i(r)}})||[];Ike(this,IDe,this.seq_g.selectAll("rect.base_bg").data(a<8?[]:u,e=>e.start),"f"),kke(this,IDe,"f").enter().append("rect").attr("class","base_bg feature").attr("data-base",({aa:e})=>e).attr("data-pos",({start:e})=>e).attr("height",this.height).merge(kke(this,IDe,"f")).attr("width",a).attr("fill",({color:e})=>e).attr("x",({start:e})=>this.getXFromSeqPosition(e)).call(ku,this),kke(this,IDe,"f").exit().remove();let c=kke(this,MDe,"f")?.selectAll("stop").data((this.sequence||"").split(""));c&&c.enter().append("stop").merge(c).attr("offset",(e,t)=>(t+.5)/(this.sequence?.length||1)).attr("stop-color",e=>i(n&&e.toUpperCase()in n?n[e.toUpperCase()]:0)),null==(t=kke(this,MDe,"f"))||t.exit().remove(),null==(r=this.svg)||r.select("rect.seq-gradient").attr("x",this.getXFromSeqPosition(1)).attr("y",0).attr("height",this.height).attr("width",Math.max(0,this.getXFromSeqPosition(this.sequence?.length||0)-this.getXFromSeqPosition(0))).style("opacity",a<8?1:8/a).attr("fill",`url(#scale-gradient-${kke(this,E
599De,"f")})`),this.updateHighlight(),this.renderMarginOnGroup(this.margins)}}};EDe=new WeakMap,MDe=new WeakMap,kDe=new WeakMap,IDe=new WeakMap,Mke([tIe({type:String,reflect:!0})],BDe.prototype,"scale",void 0),Mke([tIe({type:String,reflect:!0})],BDe.prototype,"color-range",void 0),BDe=Mke([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-colored-sequence")],BDe);var NDe=BDe;function FDe(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function LDe(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function $De(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var UDe={value:()=>{}};function jDe(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new zDe(n)}function zDe(e){this._=e}function GDe(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function VDe(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=UDe,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}zDe.prototype=jDe.prototype={constructor:zDe,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=VDe(i[r],e.name,t);else if(null==t)for(r in i)i[r]=VDe(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=GDe(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new zDe(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var HDe="http://www.w3.org/1999/xhtml",qDe={svg:"http://www.w3.org/2000/svg",xhtml:HDe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function WDe(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),qDe.hasOwnProperty(t)?{space:qDe[t],local:e}:e}function XDe(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===HDe&&t.documentElement.namespaceURI===HDe?t.createElement(e):t.createElementNS(r,e)}}function YDe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function KDe(e){var t=WDe(e);return(t.local?YDe:XDe)(t)}function ZDe(){}function QDe(e){return null==e?ZDe:function(){return this.querySelector(e)}}function JDe(){return[]}function eOe(e){return null==e?JDe:function(){return this.querySelectorAll(e)}}function tOe(e){return function(){return this.matches(e)}}function rOe(e){return function(t){return t.matches(e)}}var nOe=Array.prototype.find;function iOe(){return this.firstElementChild}var aOe=Array.prototype.filter;function oOe(){return Array.from(this.children)}function sOe(e){return Array(e.length)}function uOe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function cOe(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new uOe(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function lOe(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new uOe(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function dOe(e){return e.__data__}function fOe(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function hOe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pOe(e){return function(){this.removeAttribute(e)}}function mOe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gOe(e,t){return function(){this.setAttribute(e,t)}}function vOe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function yOe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function bOe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function _Oe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xOe(e){return function(){this.style.removeProperty(e)}}function SOe(e,t,r){return function(){this.style.setProperty(e,t,r)}}function wOe(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function AOe(e,t){return e.style.getPropertyValue(t)||_Oe(e).getComputedStyle(e,null).getPropertyValue(t)}function COe(e){return function(){delete this[e]}}function TOe(e,t){return function(){this[e]=t}}function POe(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function EOe(e){return e.trim().split(/^|\s+/)}function MOe(e){return e.classList||new kOe(e)}function kOe(e){this._node=e,this._names=EOe(e.getAttribute("class")||"")}function IOe(e,t){for(var r=MOe(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function DOe(e,t){for(var r=MOe(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function OOe(e){return function(){IOe(this,e)}}function ROe(e){return function(){DOe(this,e)}}function BOe(e,t){return function(){(t.apply(this,arguments)?IOe:DOe)(this,e)}}function NOe(){this.textContent=""}function FOe(e){return function(){this.textContent=e}}function LOe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function $Oe(){this.innerHTML=""}function UOe(e){return function(){this.innerHTML=e}}function jOe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function zOe(){this.nextSibling&&this.parentNode.appendChild(this)}function GOe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VOe(){return null}function HOe(){var e=this.parentNode;e&&e.removeChild(this)}function qOe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function WOe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XOe(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function YOe(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function KOe(e,t,r){var n=_Oe(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function ZOe(e,t){return function(){return KOe(this,e,t)}}function QOe(e,t){return function(){return KOe(this,e,t.apply(this,arguments))}}uOe.prototype={constructor:uOe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},kOe.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var JOe=[null];function eRe(e,t){this._groups=e,this._parents=t}function tRe(){return new eRe([[document.documentElement]],JOe)}function rRe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function nRe(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function iRe(){}eRe.prototype=tRe.prototype={constructor:eRe,select:function(e){"function"!=typeof e&&(e=QDe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new eRe(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):eOe(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new eRe(n,i)},selectChild:function(e){return this.select(null==e?iOe:function(e){return function(){return nOe.call(this.children,e)}}("function"==typeof e?e:rOe(e)))},selectChildren:function(e){return this.selectAll(null==e?oOe:function(e){return function(){return aOe.call(this.children,e)}}("function"==typeof e?e:rOe(e)))},filter:function(e){"function"!=typeof e&&(e=tOe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new eRe(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,dOe);var r=t?lOe:cOe,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;++c){var l=n[c],d=i[c],f=d.length,h=fOe(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new eRe(o,n))._enter=s,o._exit=u,o},enter:function(){return new eRe(this._enter||this._groups.map(sOe),this._parents)},exit:function(){return new eRe(this._exit||this._groups.map(sOe),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new eRe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=hOe;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new eRe(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=WDe(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?mOe:pOe:"function"==typeof t?r.local?bOe:yOe:r.local?vOe:gOe)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?xOe:"function"==typeof t?wOe:SOe)(e,t,r??"")):AOe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?COe:"function"==typeof t?POe:TOe)(e,t)):this.node()[e]},classed:function(e,t){var r=EOe(e+"");if(arguments.length<2){for(var n=MOe(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?BOe:t?OOe:ROe)(r,t))},text:function(e){return arguments.length?this.each(null==e?NOe:("function"==typeof e?LOe:FOe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?$Oe:("function"==typeof e?jOe:UOe)(e)):this.node().innerHTML},raise:function(){return this.each(zOe)},lower:function(){return this.each(GOe)},append:function(e){var t="function"==typeof e?e:KDe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:KDe(e),n=null==t?VOe:"function"==typeof t?t:QDe(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(HOe)},clone:function(e){return this.select(e?WOe:qOe)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?YOe:XOe,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?QOe:ZOe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var aRe=.7,oRe=1/aRe,sRe="\\s*([+-]?\\d+)\\s*",uRe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",cRe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lRe=/^#([0-9a-f]{3,8})$/,dRe=RegExp(`^rgb\\(${sRe},${sRe},${sRe}\\)$`),fRe=RegExp(`^rgb\\(${cRe},${cRe},${cRe}
599\\)$`),hRe=RegExp(`^rgba\\(${sRe},${sRe},${sRe},${uRe}\\)$`),pRe=RegExp(`^rgba\\(${cRe},${cRe},${cRe},${uRe}\\)$`),mRe=RegExp(`^hsl\\(${uRe},${cRe},${cRe}\\)$`),gRe=RegExp(`^hsla\\(${uRe},${cRe},${cRe},${uRe}\\)$`),vRe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function yRe(){return this.rgb().formatHex()}function bRe(){return this.rgb().formatRgb()}function _Re(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=lRe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?xRe(t):3===r?new ARe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?SRe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?SRe(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=dRe.exec(e))?new ARe(t[1],t[2],t[3],1):(t=fRe.exec(e))?new ARe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=hRe.exec(e))?SRe(t[1],t[2],t[3],t[4]):(t=pRe.exec(e))?SRe(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=mRe.exec(e))?kRe(t[1],t[2]/100,t[3]/100,1):(t=gRe.exec(e))?kRe(t[1],t[2]/100,t[3]/100,t[4]):vRe.hasOwnProperty(e)?xRe(vRe[e]):"transparent"===e?new ARe(NaN,NaN,NaN,0):null}function xRe(e){return new ARe(e>>16&255,e>>8&255,255&e,1)}function SRe(e,t,r,n){return n<=0&&(e=t=r=NaN),new ARe(e,t,r,n)}function wRe(e,t,r,n){return 1===arguments.length?function(e){return e instanceof iRe||(e=_Re(e)),e?new ARe((e=e.rgb()).r,e.g,e.b,e.opacity):new ARe}(e):new ARe(e,t,r,n??1)}function ARe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function CRe(){return`#${MRe(this.r)}${MRe(this.g)}${MRe(this.b)}`}function TRe(){let e=PRe(this.opacity);return`${1===e?"rgb(":"rgba("}${ERe(this.r)}, ${ERe(this.g)}, ${ERe(this.b)}${1===e?")":`, ${e})`}`}function PRe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ERe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function MRe(e){return((e=ERe(e))<16?"0":"")+e.toString(16)}function kRe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new DRe(e,t,r,n)}function IRe(e){if(e instanceof DRe)return new DRe(e.h,e.s,e.l,e.opacity);if(e instanceof iRe||(e=_Re(e)),!e)return new DRe;if(e instanceof DRe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new DRe(o,s,u,e.opacity)}function DRe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function ORe(e){return(e=(e||0)%360)<0?e+360:e}function RRe(e){return Math.max(0,Math.min(1,e||0))}function BRe(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}rRe(iRe,_Re,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yRe,formatHex:yRe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return IRe(this).formatHsl()},formatRgb:bRe,toString:bRe}),rRe(ARe,wRe,nRe(iRe,{brighter(e){return e=null==e?oRe:oRe**+e,new ARe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?aRe:aRe**+e,new ARe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ARe(ERe(this.r),ERe(this.g),ERe(this.b),PRe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:CRe,formatHex:CRe,formatHex8:function(){return`#${MRe(this.r)}${MRe(this.g)}${MRe(this.b)}${MRe(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:TRe,toString:TRe})),rRe(DRe,function(e,t,r,n){return 1===arguments.length?IRe(e):new DRe(e,t,r,n??1)},nRe(iRe,{brighter(e){return e=null==e?oRe:oRe**+e,new DRe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?aRe:aRe**+e,new DRe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ARe(BRe(e>=240?e-240:e+120,i,n),BRe(e,i,n),BRe(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new DRe(ORe(this.h),RRe(this.s),RRe(this.l),PRe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=PRe(this.opacity);return`${1===e?"hsl(":"hsla("}${ORe(this.h)}, ${100*RRe(this.s)}%, ${100*RRe(this.l)}%${1===e?")":`, ${e})`}`}}));var NRe=e=>()=>e;function FRe(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):NRe(isNaN(e)?t:e)}var LRe=function e(t){var r=function(e){return 1==(e=+e)?FRe:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):NRe(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=wRe(e)).r,(t=wRe(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=FRe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function $Re(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var URe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jRe=new RegExp(URe.source,"g");function zRe(e,t){var r,n,i,a=URe.lastIndex=jRe.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=URe.exec(e))&&(n=jRe.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:$Re(r,n)})),a=jRe.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}var GRe,VRe=180/Math.PI,HRe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qRe(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*VRe,skewX:Math.atan(u)*VRe,scaleX:o,scaleY:s}}function WRe(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];
599return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:$Re(e,i)},{i:u-2,x:$Re(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:$Re(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:$Re(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:$Re(e,r)},{i:s-2,x:$Re(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var XRe,YRe,KRe=WRe(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?HRe:qRe(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),ZRe=WRe(function(e){return null==e?HRe:(GRe||=document.createElementNS("http://www.w3.org/2000/svg","g"),GRe.setAttribute("transform",e),(e=GRe.transform.baseVal.consolidate())?qRe((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):HRe)},", ",")",")"),QRe=0,JRe=0,eBe=0,tBe=0,rBe=0,nBe=0,iBe="object"==typeof performance&&performance.now?performance:Date,aBe="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oBe(){return rBe||=(aBe(sBe),iBe.now()+nBe)}function sBe(){rBe=0}function uBe(){this._call=this._time=this._next=null}function cBe(e,t,r){var n=new uBe;return n.restart(e,t,r),n}function lBe(){rBe=(tBe=iBe.now())+nBe,QRe=JRe=0;try{!function(){oBe(),++QRe;for(var e,t=XRe;t;)(e=rBe-t._time)>=0&&t._call.call(void 0,e),t=t._next;--QRe}()}finally{QRe=0,function(){for(var e,t,r=XRe,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:XRe=t);YRe=e,fBe(n)}(),rBe=0}}function dBe(){var e=iBe.now(),t=e-tBe;t>1e3&&(nBe-=t,tBe=e)}function fBe(e){QRe||(JRe&&=clearTimeout(JRe),e-rBe>24?(e<1/0&&(JRe=setTimeout(lBe,e-iBe.now()-nBe)),eBe&&=clearInterval(eBe)):(eBe||=(tBe=iBe.now(),setInterval(dBe,1e3)),QRe=1,aBe(lBe)))}function hBe(e,t,r){var n=new uBe;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}uBe.prototype=cBe.prototype={constructor:uBe,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?oBe():+r)+(null==t?0:+t),this._next||YRe===this||(YRe?YRe._next=this:XRe=this,YRe=this),this._call=e,this._time=r,fBe()},stop:function(){this._call&&(this._call=null,this._time=1/0,fBe())}};var pBe=jDe("start","end","cancel","interrupt"),mBe=[];function gBe(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return hBe(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(hBe(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
599),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=cBe(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:pBe,tween:mBe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function vBe(e,t){var r=bBe(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function yBe(e,t){var r=bBe(e,t);if(r.state>3)throw Error("too late; already running");return r}function bBe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function _Be(e,t){var r,n;return function(){var i=yBe(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function xBe(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=yBe(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function SBe(e,t,r){var n=e._id;return e.each(function(){var e=yBe(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return bBe(e,n).value[t]}}function wBe(e,t){var r;return("number"==typeof t?$Re:t instanceof _Re?LRe:(r=_Re(t))?(t=r,LRe):zRe)(e,t)}function ABe(e){return function(){this.removeAttribute(e)}}function CBe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TBe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function PBe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function EBe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function MBe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function kBe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function IBe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function DBe(e,t){return function(){vBe(this,e).delay=+t.apply(this,arguments)}}function OBe(e,t){return t=+t,function(){vBe(this,e).delay=t}}function RBe(e,t){return function(){yBe(this,e).duration=+t.apply(this,arguments)}}function BBe(e,t){return t=+t,function(){yBe(this,e).duration=t}}var NBe=tRe.prototype.constructor;function FBe(e){return function(){this.style.removeProperty(e)}}var LBe=0;function $Be(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function UBe(){return++LBe}var jBe=tRe.prototype;$Be.prototype={constructor:$Be,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=QDe(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,gBe(d[f],t,r,f,d,bBe(s,r)));return new $Be(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=eOe(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=bBe(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&gBe(f,t,r,m,h,p);a.push(h),o.push(u)}return new $Be(a,o,t,r)},selectChild:jBe.selectChild,selectChildren:jBe.selectChildren,filter:function(e){"function"!=typeof e&&(e=tOe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new $Be(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new $Be(o,this._parents,this._name,this._id)},selection:function(){return new NBe(this._groups,this._parents)}
vendor: 4,303 bytes, line 599
599,transition:function(){for(var e=this._name,t=this._id,r=UBe(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=bBe(o,t);gBe(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new $Be(n,this._parents,e,r)},call:jBe.call,nodes:jBe.nodes,node:jBe.node,size:jBe.size,empty:jBe.empty,each:jBe.each,on:function(e,t){var r=this._id;return arguments.length<2?bBe(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?vBe:yBe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=WDe(e),n="transform"===r?ZRe:wBe;return this.attrTween(e,"function"==typeof t?(r.local?MBe:EBe)(r,n,SBe(this,"attr."+e,t)):null==t?(r.local?CBe:ABe)(r):(r.local?PBe:TBe)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=WDe(e);return this.tween(r,(n.local?kBe:IBe)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?KRe:wBe;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=AOe(this,e),o=(this.style.removeProperty(e),AOe(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,FBe(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=AOe(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=AOe(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,SBe(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=yBe(this,e),c=u.on,l=null==u.value[o]?a||=FBe(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=AOe(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(SBe(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=bBe(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?_Be:xBe)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?DBe:OBe)(t,e)):bBe(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?RBe:BBe)(t,e)):bBe(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){yBe(this,e).ease=t}}(t,e)):bBe(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();yBe(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=yBe(this,n),i=r.on;
599i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:jBe[Symbol.iterator]};var zBe={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function GBe(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}function VBe(e,t,r){this.k=e,this.x=t,this.y=r}tRe.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},tRe.prototype.transition=function(e){var t,r;e instanceof $Be?(t=e._id,e=e._name):(t=UBe(),(r=zBe).time=oBe(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&gBe(o,e,t,c,s,r||GBe(o,t));return new $Be(n,this._parents,e,t)},VBe.prototype={constructor:VBe,scale:function(e){return 1===e?this:new VBe(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new VBe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},VBe.prototype;var HBe=globalThis,qBe=HBe.ShadowRoot&&(void 0===HBe.ShadyCSS||HBe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,WBe=Symbol(),XBe=new WeakMap,YBe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==WBe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(qBe&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=XBe.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&XBe.set(t,e))}return e}toString(){return this.cssText}},KBe=qBe?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new YBe("string"==typeof e?e:e+"",void 0,WBe))(t)})(e):e,{is:ZBe,defineProperty:QBe,getOwnPropertyDescriptor:JBe,getOwnPropertyNames:eNe,getOwnPropertySymbols:tNe,getPrototypeOf:rNe}=Object,nNe=globalThis,iNe=nNe.trustedTypes,aNe=iNe?iNe.emptyScript:"",oNe=nNe.reactiveElementPolyfillSupport,sNe=(e,t)=>e,uNe={toAttribute(e,t){switch(t){case Boolean:e=e?aNe:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},cNe=(e,t)=>!ZBe(e,t),lNe={attribute:!0,type:String,converter:uNe,reflect:!1,hasChanged:cNe};Symbol.metadata??=Symbol("metadata"),nNe.litPropertyMetadata??=new WeakMap;var dNe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=lNe){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&QBe(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=JBe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??lNe}static _$Ei(){if(this.hasOwnProperty(sNe("elementProperties")))return;let e=rNe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(sNe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(sNe("properties"))){let e=this.properties,t=[...eNe(e),...tNe(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(KBe(e))}else void 0!==e&&t.push(KBe(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
599=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(qBe)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=HBe.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?uNe:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?uNe:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??cNe)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};dNe.elementStyles=[],dNe.shadowRootOptions={mode:"open"},dNe[sNe("elementProperties")]=new Map,dNe[sNe("finalized")]=new Map,oNe?.({ReactiveElement:dNe}),(nNe.reactiveElementVersions??=[]).push("2.0.4");var fNe=globalThis,hNe=fNe.trustedTypes,pNe=hNe?hNe.createPolicy("lit-html",{createHTML:e=>e}):void 0,mNe="$lit$",gNe=`lit$${Math.random().toFixed(9).slice(2)}$`,vNe="?"+gNe,yNe=`<${vNe}>`,bNe=document,_Ne=()=>bNe.createComment(""),xNe=e=>null===e||"object"!=typeof e&&"function"!=typeof e,SNe=Array.isArray,wNe="[ \t\n\f\r]",ANe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,CNe=/-->/g,TNe=/>/g,PNe=RegExp(`>|${wNe}(?:([^\\s"'>=/]+)(${wNe}*=${wNe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ENe=/'/g,MNe=/"/g,kNe=/^(?:script|style|textarea|title)$/i,INe=(e,...t)=>({_$litType$:1,strings:e,values:t}),DNe=Symbol.for("lit-noChange"),ONe=Symbol.for("lit-nothing"),RNe=new WeakMap,BNe=bNe.createTreeWalker(bNe,129);function NNe(e,t){if(!SNe(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===pNe?t:pNe.createHTML(t)}var FNe=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=ANe;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===ANe?"!--"===s[1]?o=CNe:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=PNe):(kNe.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=PNe):o=TNe:o===PNe?">"===s[0]?(o=r??ANe,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?PNe:'"'===s[3]?MNe:ENe):o===MNe||o===ENe?o=PNe:o===CNe||o===TNe?o=ANe:(o=PNe,r=void 0);let d=o===PNe&&e[t+1].startsWith("/>")?" ":"";a+=o===ANe?u+yNe:c>=0?(i.push(n),u.slice(0,c)+mNe+u.slice(c)+gNe+d):u+gNe+(-2===c?t:d)}return[NNe(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),BNe.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=BNe.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(mNe)){let t=l[o++],r=i.getAttribute(e).split(gNe),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?zNe:"?"===n[1]?GNe:"@"===n[1]?VNe:jNe}),i.removeAttribute(e)}
599else e.startsWith(gNe)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(kNe.test(i.tagName)){let e=i.textContent.split(gNe),t=e.length-1;if(t>0){i.textContent=hNe?hNe.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],_Ne()),BNe.nextNode(),u.push({type:2,index:++a});i.append(e[t],_Ne())}}}else if(8===i.nodeType)if(i.data===vNe)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(gNe,e+1));)u.push({type:7,index:a}),e+=gNe.length-1}a++}}static createElement(e,t){let r=bNe.createElement("template");return r.innerHTML=e,r}};function LNe(e,t,r=e,n){if(t===DNe)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=xNe(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=LNe(e,i._$AS(e,t.values),i,n)),t}var $Ne=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??bNe).importNode(t,!0);BNe.currentNode=n;let i=BNe.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new UNe(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new HNe(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=BNe.nextNode(),a++)}return BNe.currentNode=bNe,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},UNe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=ONe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=LNe(this,e,t),xNe(e)?e===ONe||null==e||""===e?(this._$AH!==ONe&&this._$AR(),this._$AH=ONe):e!==this._$AH&&e!==DNe&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>SNe(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ONe&&xNe(this._$AH)?this._$AA.nextSibling.data=e:this.T(bNe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=FNe.createElement(NNe(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new $Ne(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=RNe.get(e.strings);return void 0===t&&RNe.set(e.strings,t=new FNe(e)),t}k(t){SNe(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(_Ne()),this.O(_Ne()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},jNe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=ONe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ONe}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=LNe(this,e,t,0),a=!xNe(e)||e!==this._$AH&&e!==DNe,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=LNe(this,s[r+n],t,n),o===DNe&&(o=this._$AH[n]),a||=!xNe(o)||o!==this._$AH[n],o===ONe?e=ONe:e!==ONe&&(e+=(o??"")+i[n+1]),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===ONe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},zNe=class extends jNe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ONe?void 0:e}},GNe=class extends jNe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ONe)}},VNe=class extends jNe{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}
599_$AI(e,t=this){if((e=LNe(this,e,t,0)??ONe)===DNe)return;let r=this._$AH,n=e===ONe&&r!==ONe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==ONe&&(r===ONe||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},HNe=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){LNe(this,e)}},qNe=fNe.litHtmlPolyfillSupport;qNe?.(FNe,UNe),(fNe.litHtmlVersions??=[]).push("3.2.1");var WNe=class extends dNe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new UNe(t.insertBefore(_Ne(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return DNe}};WNe._$litElement$=!0,WNe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:WNe});var XNe=globalThis.litElementPolyfillSupport;XNe?.({LitElement:WNe}),(globalThis.litElementVersions??=[]).push("4.1.1");var YNe={attribute:!0,type:String,converter:uNe,reflect:!1,hasChanged:cNe},KNe=(e=YNe,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function ZNe(e){return(t,r)=>"object"==typeof r?KNe(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}var QNe,JNe,eFe,tFe,rFe,nFe,iFe,aFe=class{constructor(){QNe.add(this),JNe.set(this,1),eFe.set(this,1),tFe.set(this,1)}shape2function(e){switch(e){case"rectangle":default:return()=>this.rectangle();case"roundRectangle":return()=>this.roundRectangle();case"line":return()=>this.line();case"bridge":return()=>this.bridge();case"diamond":return()=>this.diamond();case"chevron":return()=>this.chevron();case"catFace":return()=>this.catFace();case"triangle":return()=>this.triangle();case"wave":return()=>this.wave();case"hexagon":return()=>this.hexagon();case"pentagon":return()=>this.pentagon();case"circle":return()=>this.circle();case"arrow":return()=>this.arrow();case"doubleBar":return()=>this.doubleBar();case"discontinuosStart":return()=>this.discontinuousStart();case"discontinuos":return()=>this.discontinuous();case"discontinuosEnd":return()=>this.discontinuousEnd();case"helix":return()=>this.helix();case"strand":return()=>this.strand();case"leftEndedTag":return()=>this.tag({left:!0});case"rightEndedTag":return()=>this.tag({right:!0});case"doubleEndedTag":return()=>this.tag({left:!0,right:!0})}}getFeatureShape(e,t,r,n){return n||="rectangle",$De(this,JNe,r,"f"),$De(this,eFe,t,"f"),$De(this,tFe,e*r,"f"),this.shape2function(n)()}static isContinuous(e){return"bridge"!==e.toLowerCase()}rectangle(){return`M0,0L${LDe(this,tFe,"f")},0L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")}L0,${LDe(this,eFe,"f")}Z`}roundRectangle(){return`M6,0h${LDe(this,tFe,"f")-12},0a6,6 0 0 1 6,6v${LDe(this,eFe,"f")-12}a6,6 0 0 1 -6,6h${12-LDe(this,tFe,"f")}a6,6 0 0 1 -6,-6v${12-LDe(this,eFe,"f")}a6,6 0 0 1 6,-6Z`}line(){return`M0,${LDe(this,eFe,"f")/2} L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")/2}`}bridge(){return 1===LDe(this,JNe,"f")?`M0,${LDe(this,eFe,"f")}L0,${LDe(this,eFe,"f")/2}
599L${LDe(this,tFe,"f")/2},${LDe(this,eFe,"f")/2}L${LDe(this,tFe,"f")/2},0L${LDe(this,tFe,"f")/2},${LDe(this,eFe,"f")/2}L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")/2}L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")}Z`:`M0,${LDe(this,eFe,"f")}L0,0L${LDe(this,tFe,"f")},0L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")}L${LDe(this,tFe,"f")},2L0,2Z`}diamond(){let e=LDe(this,tFe,"f")/2,t=`M${e},0L${e+5},5L${e},10L${e-5},5`;return 1===LDe(this,JNe,"f")?`${t}Z`:t+LDe(this,QNe,"m",rFe).call(this,5)}chevron(){let e=LDe(this,tFe,"f")/2,t=`M${e},5L${5+e},0L${5+e},5L${e},10L${-5+e},5L${-5+e},0`;return 1===LDe(this,JNe,"f")?t+"Z":`${t}L${e},5${LDe(this,QNe,"m",rFe).call(this,5)}Z`}catFace(){let e=LDe(this,tFe,"f")/2,t=`M${-5+e},0L${-5+e},6L${-2+e},10L${2+e},10L${5+e},6L${5+e},0L${2+e},4L${-2+e},4`;return 1===LDe(this,JNe,"f")?`${t}Z`:`${t}M${e},0${LDe(this,QNe,"m",rFe).call(this,5)}Z`}triangle(){let e=LDe(this,tFe,"f")/2,t=`M${e},0L${5+e},10L${-5+e},10`;return 1===LDe(this,JNe,"f")?`${t}Z`:`${t}L${e},0${LDe(this,QNe,"m",rFe).call(this,5)}Z`}wave(){let e=LDe(this,tFe,"f")/2,t=`M${-5+e},5A2.5,5 0 1,1 ${e},5A2.5,5 0 1,0 ${5+e},5`;return 1===LDe(this,JNe,"f")?`${t}Z`:`${t+LDe(this,QNe,"m",rFe).call(this,5)}Z`}getPolygon(e){let t="M ",r=LDe(this,tFe,"f")/2;for(let n=0;n<e;n++)t+=`${5*Math.cos(2*Math.PI*n/e)+r},${5*Math.sin(2*Math.PI*n/e)+5} `;return 1===LDe(this,JNe,"f")?`${t}Z`:`${t} ${5*Math.cos(0)+r},${5*Math.sin(0)+5} ${LDe(this,QNe,"m",rFe).call(this,5)}Z`}hexagon(){return this.getPolygon(6)}pentagon(){return this.getPolygon(5)}circle(){let e=LDe(this,tFe,"f")/2,t=Math.sqrt(10/Math.PI),r=`M${e},0A${t},${t} 0 1,1 ${e},10A${t},${t} 0 1,1 ${e},0`;return 1===LDe(this,JNe,"f")?`${r}Z`:`${r+LDe(this,QNe,"m",rFe).call(this,5)}Z`}arrow(){let e=LDe(this,tFe,"f")/2,t=`M${e},0L${-1+e},0L${-5+e},4L${-1+e},${LDe(this,eFe,"f")}L${e},${LDe(this,eFe,"f")}L${4+e},4`;return 1===LDe(this,JNe,"f")?`${t}Z`:`${t}L${e},0${LDe(this,QNe,"m",rFe).call(this,5)}Z`}doubleBar(){let e=LDe(this,tFe,"f")/2,t=`M${e},0L${-5+e},10L${e},10L${5+e},0`;return 1===LDe(this,JNe,"f")?`${t}Z`:`${t}L${e},0${LDe(this,QNe,"m",rFe).call(this,5)}Z`}discontinuousStart(){return`M0,0L${LDe(this,tFe,"f")},0L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")}L0,${LDe(this,eFe,"f")}${LDe(this,QNe,"m",iFe).call(this)}Z`}discontinuous(){return`M0,0L${LDe(this,tFe,"f")},0${LDe(this,QNe,"m",nFe).call(this)}L0,${LDe(this,eFe,"f")}${LDe(this,QNe,"m",iFe).call(this)}Z`}discontinuousEnd(){return`M0,0L${LDe(this,tFe,"f")},0${LDe(this,QNe,"m",nFe).call(this)}L0,${LDe(this,eFe,"f")}Z`}helix(){let e=2.5,t=Math.round(LDe(this,tFe,"f")/5),r="";for(let n=0;n<t;n++)r+=`M${-2.5+e},${LDe(this,eFe,"f")} C${e+2.5},7.5 ${2.5+e},2.5 ${e}, 0 C${e-2.5},2.5 ${e},7.5 ${2.5+e},${LDe(this,eFe,"f")}`,e+=5;return r}strand(){let e=0;LDe(this,tFe,"f")>5&&(e=LDe(this,tFe,"f")-5);let t=LDe(this,eFe,"f")/4;return`M0,${t}L${e},${t}L${e},${3*t}L0,${3*t}L0,${t}M${e},0L${LDe(this,tFe,"f")},${2*t}L${e},${LDe(this,eFe,"f")}Z`}tag(e={}){let t=LDe(this,eFe,"f"),r=LDe(this,tFe,"f"),n=t/Math.sqrt(2),i="M0,"+t/2;return e.left?i+=` L${n},0`:i+=" L0,0",e.right?i+=` L${r-n},0`:i+=` L${r},0`,e.right?i+=` L${r},${t/2} L${r-n},${t}`:i+=` L${r},${t}`,e.left?i+=` L${n},${t}`:i+=` L0,${t}`,i+" Z"}};JNe=new WeakMap,eFe=new WeakMap,tFe=new WeakMap,QNe=new WeakSet,rFe=function(e){return`M0,${e}L${LDe(this,tFe,"f")},${e}Z`},nFe=function(){let e=LDe(this,eFe,"f")/4;return`L${LDe(this,tFe,"f")-e},${e}L${LDe(this,tFe,"f")},${2*e}L${LDe(this,tFe,"f")-e},${3*e}L${LDe(this,tFe,"f")},${LDe(this,eFe,"f")}`},iFe=function(){let e=LDe(this,eFe,"f")/4;return`L${e},${3*e}L0,${2*e}L${e},${e}`};var oFe="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,sFe="object"==typeof self&&self&&self.Object===Object&&self,uFe=(oFe||sFe||Function("return this")()).Symbol,cFe=Object.prototype,lFe=cFe.hasOwnProperty,dFe=cFe.toString,fFe=uFe?uFe.toStringTag:void 0,hFe=Object.prototype.toString,pFe=uFe?uFe.toStringTag:void 0;function mFe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}
599var gFe=/^\s+|\s+$/g,vFe=/^[-+]0x[0-9a-f]+$/i,yFe=/^0b[01]+$/i,bFe=/^0o[0-7]+$/i,_Fe=parseInt;function xFe(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return"object"==typeof e&&!!e}(e)&&"[object Symbol]"==function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":pFe&&pFe in Object(e)?function(e){var t=lFe.call(e,fFe),r=e[fFe];try{e[fFe]=void 0;var n=!0}catch{}var i=dFe.call(e);return n&&(t?e[fFe]=r:delete e[fFe]),i}(e):function(e){return hFe.call(e)}(e)}(e)}(e))return NaN;if(mFe(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=mFe(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(gFe,"");var r=yFe.test(e);return r||bFe.test(e)?_Fe(e.slice(2),r?2:8):vFe.test(e)?NaN:+e}function SFe(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=(r=xFe(r))==r?r:0),void 0!==t&&(t=(t=xFe(t))==t?t:0),function(e,t,r){return e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e}(xFe(e),t,r)}var wFe=class{constructor({layoutHeight:e,margin:t={top:1,bottom:1,left:0,right:0},minHeight:r=.1,maxHeight:n=1/0,gap:i=2}){this.margin=t,this.minHeight=r,this.maxHeight=n,this.gap=i,this.layoutHeight=e,this.features=[]}init(e,...t){this.features=e}getFeatureYPos(e){return.5*(this.margin.top+this.layoutHeight-this.margin.bottom)-.5*this.getFeatureHeight()}getFeatureHeight(...e){return SFe(this.layoutHeight-this.margin.top-this.margin.bottom-this.gap,this.minHeight,this.maxHeight)}},AFe=class extends wFe{constructor(e){super({...e,maxHeight:e.maxHeight??15}),this.rowHeight=0,this.featureHeight=0,this.topOffset=0,this.featuresMap=new Map}init(e){let{featuresMap:t,rows:r}=function(e){let t=new Map,r=[],n={};for(let i of e){let e=r.findIndex((e,t)=>!CFe(i,n[t])||!TFe(i,e));if(e>=0){r[e].push(i),t.set(i,e);let a=n[e];n[e]={start:Math.min(a.start,i.start??-1/0),end:Math.max(a.end,i.end??1/0)}}else r.push([i]),t.set(i,r.length-1),n[r.length-1]={start:i.start??-1/0,end:i.end??1/0}}return{rows:r,featuresMap:t}}(e);this.featuresMap=t;let n=SFe(this.layoutHeight-this.margin.top-this.margin.bottom,0,r.length*(this.maxHeight+this.gap));this.rowHeight=n/Math.max(r.length,1),this.featureHeight=SFe(this.rowHeight-this.gap,this.minHeight,this.maxHeight);let i=.5*(this.margin.top+this.layoutHeight-this.margin.bottom);this.topOffset=i-.5*n}getFeatureYPos(e){let t=this.featuresMap.get(e)??0;return this.topOffset+(t+.5)*this.rowHeight-.5*this.featureHeight}getFeatureHeight(){return this.featureHeight}};function CFe(e,t){return!(Number(t.start)>
599Number(e.end)||Number(t.end)<Number(e.start))}function TFe(e,t){return function(e,t){for(let r=e.length-1;r>=0;r--)if(t(e[r]))return!0;return!1}(t,t=>CFe(e,t))}var PFe,EFe,MFe,kFe,IFe,DFe={CHAIN:{name:"chain",label:"Chain",tooltip:"(aka mature region). This describes the extent of a polypeptide chain in the mature protein following processing",shape:"rectangle",color:"#CC9933"},TRANSIT:{name:"transit peptide",label:"Transit peptide",tooltip:"This describes the extent of a transit peptide",shape:"rectangle",color:"#009966"},INIT_MET:{name:"initiator methionine",label:"Initiator methionine",tooltip:"This indicates that the initiator methionine is cleaved from the mature protein",shape:"arrow",color:"#996633"},PROPEP:{name:"propeptide",label:"Propeptide",tooltip:"Part of a protein that is cleaved during maturation or activation",shape:"rectangle",color:"#99CCCC"},PEPTIDE:{name:"peptide",label:"Peptide",tooltip:"The position and length of an active peptide in the mature protein",shape:"rectangle",color:"#006699"},SIGNAL:{name:"signal peptide",label:"Signal peptide",tooltip:"N-terminal signal peptide",shape:"rectangle",color:"#CC0033"},HELIX:{name:"helix",label:"Helix",tooltip:"The positions of experimentally determined helical regions",shape:"rectangle",color:"#FF0066"},STRAND:{name:"strand",label:"Beta strand",tooltip:"The positions of experimentally determined beta strands",shape:"rectangle",color:"#FFCC00"},TURN:{name:"turn",label:"Turn",tooltip:"The positions of experimentally determined hydrogen-bonded turns",
599shape:"rectangle",color:"#0571AF"},DISULFID:{name:"disulfide bond",label:"Disulfide bond",tooltip:"The positions of cysteine residues participating in disulphide bonds",shape:"bridge",color:"#23B14D"},CROSSLNK:{name:"cross-link",label:"Cross-link",tooltip:"Covalent linkages of various types formed between two proteins or between two parts of the same protein",shape:"bridge",color:"#FF6600"},REGION:{name:"region of interest",label:"Region of interest",tooltip:"Regions in multifunctional enzymes or fusion proteins, or characteristics of a region, e.g., protein-protein interactions mediation",shape:"rectangle",color:"#B33E00"},COILED:{name:"coiled-coil region",label:"Coiled-coil region",tooltip:"Coiled coils are built by two or more alpha-helices that wind around each other to form a supercoil",shape:"rectangle",color:"#006699"},MOTIF:{name:"short sequence motif",label:"Short sequence motif",tooltip:"Short conserved sequence motif of biological significance",shape:"rectangle",color:"#402060"},REPEAT:{name:"repeat",label:"Repeat",tooltip:"Repeated sequence motifs or repeated domains within the protein",shape:"rectangle",color:"#9900FF"},CA_BIND:{name:"calcium-binding region",label:"Calcium-binding region",tooltip:"Calcium-binding regions, such as the EF-hand motif",shape:"rectangle",color:"#FF3399"},DNA_BIND:{name:"DNA-binding region",label:"DNA binding",tooltip:"DNA-binding domains such as AP2/ERF domain, the ETS domain, the Fork-Head domain, the HMG box and the Myb domain",shape:"rectangle",color:"#009933"},DOMAIN:{name:"other domain of interest",label:"Other domain of interest",tooltip:"Specific combination of secondary structures organized into a characteristic three-dimensional structure or fold",shape:"rectangle",color:"#9999FF"},ZN_FING:{name:"zinc finger region",label:"Zinc finger",tooltip:"Small, functional, independently folded domain that coordinates one or more zinc ions",shape:"rectangle",color:"#990066"},NP_BIND:{name:"nucleotide-binding region",label:"Nucleotide-binding region",tooltip:"(aka flavin-binding). Region in the protein which binds nucleotide phosphates",shape:"rectangle",color:"#FF9900"},METAL:{name:"metal ion-binding site",label:"Metal ion-binding site",tooltip:"Binding site for a metal ion",shape:"diamond",color:"#009900"},SITE:{name:"other site of interest",label:"Other site of interest",tooltip:"Any interesting single amino acid site on the sequence",shape:"chevron",color:"#660033"},BINDING:{name:"other binding site",label:"Other binding site",tooltip:"Binding site for any chemical group (co-enzyme, prosthetic group, etc.)",shape:"rectangle",color:"#catFace"},ACT_SITE:{name:"active site",label:"Active site",tooltip:"Amino acid(s) directly involved in the activity of an enzyme",shape:"circle",color:"#FF6666"},MOD_RES:{name:"Post-translationally modified residue",label:"Modified residue",tooltip:"Modified residues such as phosphorylation, acetylation, acylation, methylation",shape:"triangle",color:"#000066"},LIPID:{name:"lipid moiety-binding region",label:"Lipidation",tooltip:"Covalently attached lipid group(s)",shape:"wave",color:"#99CC33"},CARBOHYD:{name:"glycosylation site",label:"Glycosylation",tooltip:"Covalently attached glycan group(s)",shape:"hexagon",color:"#CC3366"},COMPBIAS:{name:"compositionally biased region",label:"Compositionally biased region",tooltip:"Position of regions of compositional bias within the protein and the particular amino acids that are over-represented within those regions",shape:"rectangle",color:"#FF3366"},CONFLICT:{name:"sequence conflict",label:"Sequence conflict",tooltip:"Sequence discrepancies of unknown origin",shape:"rectangle",color:"#6633CC"},NON_CONS:{name:"non-consecutive residues",label:"Non-adjacent residues",tooltip:"Indicates that two residues in a sequence are not consecutive and that there is an undetermined number of unsequenced residues between them",shape:"doubleBar",color:"#FF0033"},NON_TER:{name:"non-terminal residue",label:"Non-terminal residue",tooltip:"The sequence is incomplete. The residue is not the terminal residue of the complete protein",shape:"doubleBar",color:"#339933"},UNSURE:{name:"unsure residue",label:"Sequence uncertainty",tooltip:"Regions of a sequence for which the authors are unsure about the sequence assignment",shape:"rectangle",color:"#33FF00"},NON_STD:{name:"non-standard amino acid",label:"Non-standard residue",tooltip:"Non-standard amino acids (selenocysteine and pyrrolysine)",shape:"pentagon",color:"#330066"},MUTAGEN:{name:"mutagenesis site",label:"Mutagenesis",tooltip:"Site which has been experimentally altered by mutagenesis",shape:"rectangle",color:"#FF9900"},TOPO_DOM:{name:"topological domain",label:"Topological domain",tooltip:"Location of non-membrane regions of membrane-spanning proteins",shape:"rectangle",color:"#CC0000"},TRANSMEM:{name:"transmembrane region",label:"Transmembrane",tooltip:"Extent of a membrane-spanning region",shape:"rectangle",color:"#CC00CC"}
599,INTRAMEM:{name:"intramembrane region",label:"Intramembrane",tooltip:"Extent of a region located in a membrane without crossing it",shape:"rectangle",color:"#0000CC"},VAR_SEQ:{name:"splice variant",label:"Splice variant",tooltip:"",shape:"rectangle",color:"#CC11CC"},VARIANT:{name:"sequence variant",label:"Natural variant",tooltip:"Natural variant of the protein, including polymorphisms, variations between strains, isolates or cultivars, disease-associated mutations and RNA editing events",shape:"circle",color:"black"},UNIQUE:{name:"unique",label:"Unique peptide",tooltip:"",shape:"rectangle",color:"#fc3133"},NON_UNIQUE:{name:"non-unique",label:"Non-unique peptide",tooltip:"",shape:"rectangle",color:"#8585fc"},RESIDUE:{name:"residue",label:"PTM residue",tooltip:"",shape:"rectangle",color:"#06038D"},EPITOPE:{name:"epitope",label:"Epitopes",tooltip:"",shape:"rectangle",color:"#4ade33"},ANTIGEN:{name:"antigen",label:"Antibody binding sequences",tooltip:"",shape:"rectangle",color:"#996699"},PDBE_COVER:{name:"pdbe coverage",label:"PDBe 3D structure coverage",tooltip:"",shape:"rectangle",color:"#669966"}},OFe=e=>{if(e.toUpperCase()in DFe)return DFe[e.toUpperCase()].shape;let t=Object.values(DFe).find(t=>t.name.toUpperCase()===e.toUpperCase());return t?t.shape:"rectangle"},RFe=e=>{if(e.toUpperCase()in DFe)return DFe[e.toUpperCase()].color;let t=Object.values(DFe).find(t=>t.name.toUpperCase()===e.toUpperCase());return t||console.log(e),t?t.color:"black"},BFe=["length","width","height"],NFe=IFe=class extends(bu(Tu(gu(pu(du(ei(wu(_c)))))))){constructor(){super(...arguments),PFe.add(this),this.featureShape=new aFe,EFe.set(this,[]),MFe.set(this,[]),this.filters=null}getLayout(){return"non-overlapping"===String(this.layout).toLowerCase()?new AFe({layoutHeight:this.height,margin:{top:this["margin-top"],bottom:this["margin-bottom"],left:this["margin-left"],right:this["margin-right"]}}):new wFe({layoutHeight:this.height,margin:{top:this["margin-top"],bottom:this["margin-bottom"],left:this["margin-left"],right:this["margin-right"]}})}connectedCallback(){super.connectedCallback(),this.layoutObj=this.getLayout(),LDe(this,MFe,"f")&&this.createTrack()}static normalizeLocations(e){return e.map(e=>(e.locations?(e.start??=function(e){let t;for(let r of e)for(let e of r.fragments)(void 0===t||e.start<t)&&(t=e.start);return t}(e.locations),e.end??=function(e){let t;for(let r of e)for(let e of r.fragments)(void 0===t||e.end>t)&&(t=e.end);return t}(e.locations)):(e.start??=1,e.end??=e.start,e.locations=[{fragments:[{start:e.start,end:e.end}]}]),e))}processData(e){$De(this,EFe,IFe.normalizeLocations(e),"f")}set data(e){this.processData(e),this.applyFilters(),this.layoutObj=this.getLayout(),this.createTrack()}get data(){return LDe(this,MFe,"f")}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),(BFe.includes(e)||e.startsWith("margin-"))&&(this.applyFilters(),this.layoutObj=this.getLayout(),this.createTrack())}getFeatureColor(e){let t="gray";return e.color?e.color||t:e?.feature?.color?e?.feature?.color||t:this.color?this.color:e.type?RFe(e.type):e?.feature?.type?RFe(e.feature.type):t}getFeatureFillColor(e){let t="gray";return e.fill?e.fill||t:e?.feature?.fill?e.feature.fill||t:this.getFeatureColor(e)}getShape(e){let t="rectangle";return e.shape?e.shape||t:e?.feature?.shape?e.feature.shape||t:this.shape?this.shape:e.type?OFe(e.type):e.feature?.type?OFe(e.feature.type):t}createTrack(){var e,t;LDe(this,MFe,"f")&&(null==(e=this.layoutObj)||e.init(LDe(this,MFe,"f")),null==(t=this.svg)||t.selectAll("g").remove(),this.svg=function(e){return"string"==typeof e?new eRe([[document.querySelector(e)]],[document.documentElement]):new eRe([[e]],JOe)}(this).selectAll("svg").attr("width",this.width).attr("height",this.height),this.svg&&(this.seqG=this.svg.append("g").attr("class","sequence-features"),this.createFeatures(),this.highlighted=this.svg.append("g").attr("class","highlighted"),this.margins=this.svg.append("g").attr("class","margin")))}createFeatures(){if(!this.seqG)return;let e=this.seqG.selectAll("g.feature-group").data(LDe(this,MFe,"f")).enter().append("g").attr("class","feature-group").attr("id",e=>`g_${e.accession}`).selectAll("g.location-group").data(e=>(e.locations||[]).map(t=>Object.assign({},t,{feature:e}))).enter().append("g").attr("class","location-group").selectAll("g.fragment-group").data(e=>e.fragments.map(t=>Object.assign({},t,{feature:e.feature}))).enter().append("g").attr("class","fragment-group");e.append("path").attr("class",e=>
599`${this.getShape(e)} feature`).attr("d",e=>this.featureShape.getFeatureShape(this.getSingleBaseWidth(),this.layoutObj?.getFeatureHeight()||0,e.end?e.end-e.start+1:1,this.getShape(e))).attr("transform",e=>`translate(${this.getXFromSeqPosition(e.start)},${this.layoutObj?.getFeatureYPos(e.feature)||0})`).style("fill",e=>this.getFeatureFillColor(e)).attr("stroke",e=>this.getFeatureColor(e)).style("fill-opacity",({feature:e})=>e.opacity?e.opacity:.9).style("stroke-opacity",({feature:e})=>e.opacity?e.opacity:.9);let t=e.selectAll("g.residue-group").data(e=>e.feature.residuesToHighlight?[e.feature.residuesToHighlight?.map(t=>Object.assign({},t,{feature:e.feature,position:t.position}))]:[]).enter().append("g").attr("class","residue-group");e.append("rect").attr("class","outer-rectangle feature").attr("width",e=>Math.max(0,this.getSingleBaseWidth()*(e.end?e.end-e.start+1:1))).attr("height",this.layoutObj?.getFeatureHeight()||0).attr("transform",e=>`translate(${this.getXFromSeqPosition(e.start)},${this.layoutObj?.getFeatureYPos(e.feature)||0})`).style("fill","transparent").attr("stroke","transparent").call(ku,this),t.selectAll("g.residue").data(e=>e).enter().append("path").attr("class",e=>
599`${this.getShape(e)} residue`).attr("d",e=>LDe(this,PFe,"m",kFe).call(this,e)).attr("transform",e=>`translate(${this.getXFromSeqPosition(Number(e.feature.start)+Number(e.position)-1)+this.getSingleBaseWidth()/4},\n          ${this.layoutObj?.getFeatureYPos(e.feature)})`).attr("fill",RFe("RESIDUE")).style("fill-opacity",({feature:e})=>e.opacity?e.opacity:.9).style("stroke-opacity",({feature:e})=>e.opacity?e.opacity:.9).call(ku,this)}applyFilters(){(this.filters||[]).length<=0&&$De(this,MFe,LDe(this,EFe,"f"),"f")}refresh(){if(this.xScale&&this.seqG){let e=this.seqG.selectAll("g.fragment-group").data(LDe(this,MFe,"f").reduce((e,t)=>e.concat((t.locations||[]).reduce((e,r)=>e.concat(r.fragments.map(e=>Object.assign({},e,{feature:t}))),[])),[])),t=this.seqG.selectAll("g.residue-group").data(LDe(this,MFe,"f").reduce((e,t)=>e.concat([t.residuesToHighlight?.reduce(e=>e.concat(e=>Object.assign({},e,{feature:t,position:e.position})),[])]),[]));e.selectAll("path.feature").attr("d",e=>this.featureShape.getFeatureShape(this.getSingleBaseWidth(),this.layoutObj?.getFeatureHeight()||0,e?.end&&e?.start?e.end-e.start+1:1,this.getShape(e))).attr("transform",e=>`translate(${this.getXFromSeqPosition(e.start||0)},${this.layoutObj?.getFeatureYPos(e.feature)})`),t.selectAll("path.residue").attr("d",e=>LDe(this,PFe,"m",kFe).call(this,e)).attr("transform",e=>`translate(${this.getXFromSeqPosition(Number(e.feature?.start)+Number(e.position)-1)+this.getSingleBaseWidth()/4},${this.layoutObj?.getFeatureYPos(e.feature)})`),e.selectAll("rect.outer-rectangle").attr("width",e=>Math.max(0,this.getSingleBaseWidth()*(e?.end&&e?.start?e.end-e.start+1:1))).attr("height",this.layoutObj?.getFeatureHeight()||0).attr("transform",e=>`translate(${this.getXFromSeqPosition(e.start||0)},${this.layoutObj?.getFeatureYPos(e.feature)||0})`)}this.updateHighlight(),this.renderMarginOnGroup(this.margins)}updateHighlight(){if(!this.highlighted)return;let e=this.highlighted.selectAll("rect").data(this.highlightedRegion.segments);e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",this["highlight-color"]).attr("height",this.height).attr("x",e=>this.getXFromSeqPosition(e.start)).attr("width",e=>Math.max(0,this.getSingleBaseWidth()*(e.end-e.start+1))),e.exit().remove()}zoomRefreshed(){super.zoomRefreshed(),this.getWidthWithMargins()>0&&this.refresh()}firstUpdated(){this.createTrack()}render(){return INe`<svg class="container"></svg>`}};EFe=new WeakMap,MFe=new WeakMap,PFe=new WeakSet,kFe=function(e){let t=1,r=this.getSingleBaseWidth(),n=6-r;return r<6&&n>t&&(t=n),this.featureShape.getFeatureShape(r/2,this.layoutObj?.getFeatureHeight(e)||0,t,this.getShape(e))},FDe([ZNe({type:String})],NFe.prototype,"color",void 0),FDe([ZNe({type:String})],NFe.prototype,"shape",void 0),FDe([ZNe({type:String})],NFe.prototype,"layout",void 0);var FFe=NFe=IFe=FDe([Fu("nightingale-track")],NFe),LFe={value:()=>{}};function $Fe(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new UFe(n)}function UFe(e){this._=e}function jFe(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function zFe(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=LFe,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}UFe.prototype=$Fe.prototype={constructor:UFe,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=zFe(i[r],e.name,t);else if(null==t)for(r in i)i[r]=zFe(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=jFe(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new UFe(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var GFe="http://www.w3.org/1999/xhtml",VFe={svg:"http://www.w3.org/2000/svg",xhtml:GFe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function HFe(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),VFe.hasOwnProperty(t)?{space:VFe[t],local:e}:e}function qFe(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===GFe&&t.documentElement.namespaceURI===GFe?t.createElement(e):t.createElementNS(r,e)}}function WFe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function XFe(e){var t=HFe(e);return(t.local?WFe:qFe)(t)}function YFe(){}function KFe(e){return null==e?YFe:function(){return this.querySelector(e)}}function ZFe(){return[]}function QFe(e){return null==e?ZFe:function(){return this.querySelectorAll(e)}}function JFe(e){return function(){return this.matches(e)}}function eLe(e){return function(t){return t.matches(e)}}var tLe=Array.prototype.find;function rLe(){return this.firstElementChild}var nLe=Array.prototype.filter;function iLe(){return Array.from(this.children)}function aLe(e){return Array(e.length)}function oLe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function sLe(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new oLe(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function uLe(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new oLe(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function cLe(e){return e.__data__}function lLe(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function dLe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fLe(e){return function(){this.removeAttribute(e)}}function hLe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pLe(e,t){return function(){this.setAttribute(e,t)}}function mLe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function gLe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function vLe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function yLe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bLe(e){return function(){this.style.removeProperty(e)}}function _Le(e,t,r){return function(){this.style.setProperty(e,t,r)}}function xLe(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function SLe(e,t){return e.style.getPropertyValue(t)||yLe(e).getComputedStyle(e,null).getPropertyValue(t)}function wLe(e){return function(){delete this[e]}}function ALe(e,t){return function(){this[e]=t}}function CLe(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function TLe(e){return e.trim().split(/^|\s+/)}function PLe(e){return e.classList||new ELe(e)}
vendor: 4,653 bytes, line 599
599function ELe(e){this._node=e,this._names=TLe(e.getAttribute("class")||"")}function MLe(e,t){for(var r=PLe(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function kLe(e,t){for(var r=PLe(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function ILe(e){return function(){MLe(this,e)}}function DLe(e){return function(){kLe(this,e)}}function OLe(e,t){return function(){(t.apply(this,arguments)?MLe:kLe)(this,e)}}function RLe(){this.textContent=""}function BLe(e){return function(){this.textContent=e}}function NLe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function FLe(){this.innerHTML=""}function LLe(e){return function(){this.innerHTML=e}}function $Le(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ULe(){this.nextSibling&&this.parentNode.appendChild(this)}function jLe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zLe(){return null}function GLe(){var e=this.parentNode;e&&e.removeChild(this)}function VLe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function HLe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qLe(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function WLe(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function XLe(e,t,r){var n=yLe(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function YLe(e,t){return function(){return XLe(this,e,t)}}function KLe(e,t){return function(){return XLe(this,e,t.apply(this,arguments))}}oLe.prototype={constructor:oLe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},ELe.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var ZLe=[null];function QLe(e,t){this._groups=e,this._parents=t}function JLe(){return new QLe([[document.documentElement]],ZLe)}function e$e(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function t$e(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function r$e(){}QLe.prototype=JLe.prototype={constructor:QLe,select:function(e){"function"!=typeof e&&(e=KFe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new QLe(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):QFe(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new QLe(n,i)},selectChild:function(e){return this.select(null==e?rLe:function(e){return function(){return tLe.call(this.children,e)}}("function"==typeof e?e:eLe(e)))},selectChildren:function(e){return this.selectAll(null==e?iLe:function(e){return function(){return nLe.call(this.children,e)}}("function"==typeof e?e:eLe(e)))},filter:function(e){"function"!=typeof e&&(e=JFe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new QLe(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,cLe);var r=t?uLe:sLe,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;
vendor: 8,871 bytes, line 599
599++c){var l=n[c],d=i[c],f=d.length,h=lLe(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new QLe(o,n))._enter=s,o._exit=u,o},enter:function(){return new QLe(this._enter||this._groups.map(aLe),this._parents)},exit:function(){return new QLe(this._exit||this._groups.map(aLe),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new QLe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=dLe;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new QLe(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=HFe(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?hLe:fLe:"function"==typeof t?r.local?vLe:gLe:r.local?mLe:pLe)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?bLe:"function"==typeof t?xLe:_Le)(e,t,r??"")):SLe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?wLe:"function"==typeof t?CLe:ALe)(e,t)):this.node()[e]},classed:function(e,t){var r=TLe(e+"");if(arguments.length<2){for(var n=PLe(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?OLe:t?ILe:DLe)(r,t))},text:function(e){return arguments.length?this.each(null==e?RLe:("function"==typeof e?NLe:BLe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?FLe:("function"==typeof e?$Le:LLe)(e)):this.node().innerHTML},raise:function(){return this.each(ULe)},lower:function(){return this.each(jLe)},append:function(e){var t="function"==typeof e?e:XFe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:XFe(e),n=null==t?zLe:"function"==typeof t?t:KFe(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(GLe)},clone:function(e){return this.select(e?HLe:VLe)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?WLe:qLe,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?KLe:YLe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var n$e=.7,i$e=1/n$e,a$e="\\s*([+-]?\\d+)\\s*",o$e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",s$e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u$e=/^#([0-9a-f]{3,8})$/,c$e=RegExp(`^rgb\\(${a$e},${a$e},${a$e}\\)$`),l$e=RegExp(`^rgb\\(${s$e},${s$e},${s$e}\\)$`),d$e=RegExp(`^rgba\\(${a$e},${a$e},${a$e},${o$e}\\)$`),f$e=RegExp(`^rgba\\(${s$e},${s$e},${s$e},${o$e}\\)$`),h$e=RegExp(`^hsl\\(${o$e},${s$e},${s$e}\\)$`),p$e=RegExp(`^hsla\\(${o$e},${s$e},${s$e},${o$e}\\)$`),m$e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function g$e(){return this.rgb().formatHex()}function v$e(){return this.rgb().formatRgb()}function y$e(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=u$e.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?b$e(t):3===r?new S$e(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?_$e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?_$e(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=c$e.exec(e))?new S$e(t[1],t[2],t[3],1):(t=l$e.exec(e))?new S$e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=d$e.exec(e))?_$e(t[1],t[2],t[3],t[4]):(t=f$e.exec(e))?_$e(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=h$e.exec(e))?E$e(t[1],t[2]/100,t[3]/100,1):(t=p$e.exec(e))?E$e(t[1],t[2]/100,t[3]/100,t[4]):m$e.hasOwnProperty(e)?b$e(m$e[e]):"transparent"===e?new S$e(NaN,NaN,NaN,0):null}function b$e(e){return new S$e(e>>16&255,e>>8&255,255&e,1)}function _$e(e,t,r,n){return n<=0&&(e=t=r=NaN),new S$e(e,t,r,n)}function x$e(e,t,r,n){return 1===arguments.length?function(e){return e instanceof r$e||(e=y$e(e)),e?new S$e((e=e.rgb()).r,e.g,e.b,e.opacity):new S$e}(e):new S$e(e,t,r,n??1)}function S$e(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function w$e(){return`#${P$e(this.r)}${P$e(this.g)}${P$e(this.b)}`}function A$e(){let e=C$e(this.opacity);return`${1===e?"rgb(":"rgba("}${T$e(this.r)}, ${T$e(this.g)}, ${T$e(this.b)}${1===e?")":`, ${e})`}`}function C$e(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function T$e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}
599function P$e(e){return((e=T$e(e))<16?"0":"")+e.toString(16)}function E$e(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new k$e(e,t,r,n)}function M$e(e){if(e instanceof k$e)return new k$e(e.h,e.s,e.l,e.opacity);if(e instanceof r$e||(e=y$e(e)),!e)return new k$e;if(e instanceof k$e)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new k$e(o,s,u,e.opacity)}function k$e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function I$e(e){return(e=(e||0)%360)<0?e+360:e}function D$e(e){return Math.max(0,Math.min(1,e||0))}function O$e(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}e$e(r$e,y$e,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:g$e,formatHex:g$e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return M$e(this).formatHsl()},formatRgb:v$e,toString:v$e}),e$e(S$e,x$e,t$e(r$e,{brighter(e){return e=null==e?i$e:i$e**+e,new S$e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?n$e:n$e**+e,new S$e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new S$e(T$e(this.r),T$e(this.g),T$e(this.b),C$e(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:w$e,formatHex:w$e,formatHex8:function(){return`#${P$e(this.r)}${P$e(this.g)}${P$e(this.b)}${P$e(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:A$e,toString:A$e})),e$e(k$e,function(e,t,r,n){return 1===arguments.length?M$e(e):new k$e(e,t,r,n??1)},t$e(r$e,{brighter(e){return e=null==e?i$e:i$e**+e,new k$e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?n$e:n$e**+e,new k$e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new S$e(O$e(e>=240?e-240:e+120,i,n),O$e(e,i,n),O$e(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new k$e(I$e(this.h),D$e(this.s),D$e(this.l),C$e(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=C$e(this.opacity);return`${1===e?"hsl(":"hsla("}${I$e(this.h)}, ${100*D$e(this.s)}%, ${100*D$e(this.l)}%${1===e?")":`, ${e})`}`}}));var R$e=e=>()=>e;function B$e(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):R$e(isNaN(e)?t:e)}var N$e=function e(t){var r=function(e){return 1==(e=+e)?B$e:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):R$e(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=x$e(e)).r,(t=x$e(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=B$e(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function F$e(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var L$e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$$e=new RegExp(L$e.source,"g");function U$e(e,t){var r,n,i,a=L$e.lastIndex=$$e.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=L$e.exec(e))&&(n=$$e.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:F$e(r,n)})),a=$$e.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}var j$e,z$e=180/Math.PI,G$e={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function V$e(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*z$e,skewX:Math.atan(u)*z$e,scaleX:o,scaleY:s}}function H$e(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];
599return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:F$e(e,i)},{i:u-2,x:F$e(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:F$e(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:F$e(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:F$e(e,r)},{i:s-2,x:F$e(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var q$e,W$e,X$e=H$e(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?G$e:V$e(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Y$e=H$e(function(e){return null==e?G$e:(j$e||=document.createElementNS("http://www.w3.org/2000/svg","g"),j$e.setAttribute("transform",e),(e=j$e.transform.baseVal.consolidate())?V$e((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):G$e)},", ",")",")"),K$e=0,Z$e=0,Q$e=0,J$e=0,eUe=0,tUe=0,rUe="object"==typeof performance&&performance.now?performance:Date,nUe="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function iUe(){return eUe||=(nUe(aUe),rUe.now()+tUe)}function aUe(){eUe=0}function oUe(){this._call=this._time=this._next=null}function sUe(e,t,r){var n=new oUe;return n.restart(e,t,r),n}function uUe(){eUe=(J$e=rUe.now())+tUe,K$e=Z$e=0;try{!function(){iUe(),++K$e;for(var e,t=q$e;t;)(e=eUe-t._time)>=0&&t._call.call(void 0,e),t=t._next;--K$e}()}finally{K$e=0,function(){for(var e,t,r=q$e,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:q$e=t);W$e=e,lUe(n)}(),eUe=0}}function cUe(){var e=rUe.now(),t=e-J$e;t>1e3&&(tUe-=t,J$e=e)}function lUe(e){K$e||(Z$e&&=clearTimeout(Z$e),e-eUe>24?(e<1/0&&(Z$e=setTimeout(uUe,e-rUe.now()-tUe)),Q$e&&=clearInterval(Q$e)):(Q$e||=(J$e=rUe.now(),setInterval(cUe,1e3)),K$e=1,nUe(uUe)))}function dUe(e,t,r){var n=new oUe;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}oUe.prototype=sUe.prototype={constructor:oUe,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?iUe():+r)+(null==t?0:+t),this._next||W$e===this||(W$e?W$e._next=this:q$e=this,W$e=this),this._call=e,this._time=r,lUe()},stop:function(){this._call&&(this._call=null,this._time=1/0,lUe())}};var fUe=$Fe("start","end","cancel","interrupt"),hUe=[];function pUe(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return dUe(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(dUe(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
599),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=sUe(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:fUe,tween:hUe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function mUe(e,t){var r=vUe(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function gUe(e,t){var r=vUe(e,t);if(r.state>3)throw Error("too late; already running");return r}function vUe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function yUe(e,t){var r,n;return function(){var i=gUe(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function bUe(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=gUe(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function _Ue(e,t,r){var n=e._id;return e.each(function(){var e=gUe(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return vUe(e,n).value[t]}}function xUe(e,t){var r;return("number"==typeof t?F$e:t instanceof y$e?N$e:(r=y$e(t))?(t=r,N$e):U$e)(e,t)}function SUe(e){return function(){this.removeAttribute(e)}}function wUe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AUe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function CUe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function TUe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function PUe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function EUe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function MUe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function kUe(e,t){return function(){mUe(this,e).delay=+t.apply(this,arguments)}}function IUe(e,t){return t=+t,function(){mUe(this,e).delay=t}}function DUe(e,t){return function(){gUe(this,e).duration=+t.apply(this,arguments)}}function OUe(e,t){return t=+t,function(){gUe(this,e).duration=t}}var RUe=JLe.prototype.constructor;function BUe(e){return function(){this.style.removeProperty(e)}}var NUe=0;function FUe(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function LUe(){return++NUe}var $Ue=JLe.prototype;FUe.prototype={constructor:FUe,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=KFe(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,pUe(d[f],t,r,f,d,vUe(s,r)));return new FUe(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=QFe(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=vUe(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&pUe(f,t,r,m,h,p);a.push(h),o.push(u)}return new FUe(a,o,t,r)},selectChild:$Ue.selectChild,selectChildren:$Ue.selectChildren,filter:function(e){"function"!=typeof e&&(e=JFe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new FUe(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new FUe(o,this._parents,this._name,this._id)},selection:function(){return new RUe(this._groups,this._parents)}
vendor: 4,303 bytes, line 599
599,transition:function(){for(var e=this._name,t=this._id,r=LUe(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=vUe(o,t);pUe(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new FUe(n,this._parents,e,r)},call:$Ue.call,nodes:$Ue.nodes,node:$Ue.node,size:$Ue.size,empty:$Ue.empty,each:$Ue.each,on:function(e,t){var r=this._id;return arguments.length<2?vUe(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?mUe:gUe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=HFe(e),n="transform"===r?Y$e:xUe;return this.attrTween(e,"function"==typeof t?(r.local?PUe:TUe)(r,n,_Ue(this,"attr."+e,t)):null==t?(r.local?wUe:SUe)(r):(r.local?CUe:AUe)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=HFe(e);return this.tween(r,(n.local?EUe:MUe)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?X$e:xUe;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=SLe(this,e),o=(this.style.removeProperty(e),SLe(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,BUe(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=SLe(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=SLe(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,_Ue(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=gUe(this,e),c=u.on,l=null==u.value[o]?a||=BUe(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=SLe(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(_Ue(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=vUe(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?yUe:bUe)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?kUe:IUe)(t,e)):vUe(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?DUe:OUe)(t,e)):vUe(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){gUe(this,e).ease=t}}(t,e)):vUe(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();gUe(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=gUe(this,n),i=r.on;
599i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:$Ue[Symbol.iterator]};var UUe={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function jUe(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}function zUe(e,t,r){this.k=e,this.x=t,this.y=r}JLe.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},JLe.prototype.transition=function(e){var t,r;e instanceof FUe?(t=e._id,e=e._name):(t=LUe(),(r=UUe).time=iUe(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&pUe(o,e,t,c,s,r||jUe(o,t));return new FUe(n,this._parents,e,t)},zUe.prototype={constructor:zUe,scale:function(e){return 1===e?this:new zUe(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new zUe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},zUe.prototype;var GUe=globalThis,VUe=GUe.ShadowRoot&&(void 0===GUe.ShadyCSS||GUe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,HUe=Symbol(),qUe=new WeakMap,WUe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==HUe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(VUe&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=qUe.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&qUe.set(t,e))}return e}toString(){return this.cssText}},XUe=VUe?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new WUe("string"==typeof e?e:e+"",void 0,HUe))(t)})(e):e,{is:YUe,defineProperty:KUe,getOwnPropertyDescriptor:ZUe,getOwnPropertyNames:QUe,getOwnPropertySymbols:JUe,getPrototypeOf:eje}=Object,tje=globalThis,rje=tje.trustedTypes,nje=rje?rje.emptyScript:"",ije=tje.reactiveElementPolyfillSupport,aje=(e,t)=>e,oje={toAttribute(e,t){switch(t){case Boolean:e=e?nje:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},sje=(e,t)=>!YUe(e,t),uje={attribute:!0,type:String,converter:oje,reflect:!1,hasChanged:sje};Symbol.metadata??=Symbol("metadata"),tje.litPropertyMetadata??=new WeakMap;var cje=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=uje){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&KUe(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=ZUe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??uje}static _$Ei(){if(this.hasOwnProperty(aje("elementProperties")))return;let e=eje(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(aje("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(aje("properties"))){let e=this.properties,t=[...QUe(e),...JUe(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(XUe(e))}else void 0!==e&&t.push(XUe(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
599=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(VUe)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=GUe.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?oje:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?oje:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??sje)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};cje.elementStyles=[],cje.shadowRootOptions={mode:"open"},cje[aje("elementProperties")]=new Map,cje[aje("finalized")]=new Map,ije?.({ReactiveElement:cje}),(tje.reactiveElementVersions??=[]).push("2.0.4");var lje=globalThis,dje=lje.trustedTypes,fje=dje?dje.createPolicy("lit-html",{createHTML:e=>e}):void 0,hje="$lit$",pje=`lit$${Math.random().toFixed(9).slice(2)}$`,mje="?"+pje,gje=`<${mje}>`,vje=document,yje=()=>vje.createComment(""),bje=e=>null===e||"object"!=typeof e&&"function"!=typeof e,_je=Array.isArray,xje="[ \t\n\f\r]",Sje=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wje=/-->/g,Aje=/>/g,Cje=RegExp(`>|${xje}(?:([^\\s"'>=/]+)(${xje}*=${xje}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Tje=/'/g,Pje=/"/g,Eje=/^(?:script|style|textarea|title)$/i,Mje=(e,...t)=>({_$litType$:1,strings:e,values:t}),kje=Symbol.for("lit-noChange"),Ije=Symbol.for("lit-nothing"),Dje=new WeakMap,Oje=vje.createTreeWalker(vje,129);function Rje(e,t){if(!_je(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===fje?t:fje.createHTML(t)}var Bje=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=Sje;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);
599)l=o.lastIndex,o===Sje?"!--"===s[1]?o=wje:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=Cje):(Eje.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=Cje):o=Aje:o===Cje?">"===s[0]?(o=r??Sje,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?Cje:'"'===s[3]?Pje:Tje):o===Pje||o===Tje?o=Cje:o===wje||o===Aje?o=Sje:(o=Cje,r=void 0);let d=o===Cje&&e[t+1].startsWith("/>")?" ":"";a+=o===Sje?u+gje:c>=0?(i.push(n),u.slice(0,c)+hje+u.slice(c)+pje+d):u+pje+(-2===c?t:d)}return[Rje(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),Oje.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Oje.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(hje)){let t=l[o++],r=i.getAttribute(e).split(pje),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?Uje:"?"===n[1]?jje:"@"===n[1]?zje:$je}),i.removeAttribute(e)}else e.startsWith(pje)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(Eje.test(i.tagName)){let e=i.textContent.split(pje),t=e.length-1;if(t>0){i.textContent=dje?dje.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],yje()),Oje.nextNode(),u.push({type:2,index:++a});i.append(e[t],yje())}}}else if(8===i.nodeType)if(i.data===mje)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(pje,e+1));)u.push({type:7,index:a}),e+=pje.length-1}a++}}static createElement(e,t){let r=vje.createElement("template");return r.innerHTML=e,r}};function Nje(e,t,r=e,n){if(t===kje)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=bje(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=Nje(e,i._$AS(e,t.values),i,n)),t}var Fje=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??vje).importNode(t,!0);Oje.currentNode=n;let i=Oje.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new Lje(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new Gje(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=Oje.nextNode(),a++)}return Oje.currentNode=vje,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},Lje=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=Ije,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Nje(this,e,t),bje(e)?e===Ije||null==e||""===e?(this._$AH!==Ije&&this._$AR(),this._$AH=Ije):e!==this._$AH&&e!==kje&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>_je(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Ije&&bje(this._$AH)?this._$AA.nextSibling.data=e:this.T(vje.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Bje.createElement(Rje(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new Fje(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=Dje.get(e.strings);return void 0===t&&Dje.set(e.strings,t=new Bje(e)),t}k(t){_je(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(yje()),this.O(yje()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},$je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=Ije,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Ije}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=Nje(this,e,t,0),a=!bje(e)||e!==this._$AH&&e!==kje,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=Nje(this,s[r+n],t,n),o===kje&&(o=this._$AH[n]),a||=!bje(o)||o!==this._$AH[n],o===Ije?e=Ije:e!==Ije&&(e+=(o??"")+i[n+1]
599),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===Ije?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Uje=class extends $je{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ije?void 0:e}},jje=class extends $je{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ije)}},zje=class extends $je{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=Nje(this,e,t,0)??Ije)===kje)return;let r=this._$AH,n=e===Ije&&r!==Ije||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==Ije&&(r===Ije||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Gje=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Nje(this,e)}},Vje=lje.litHtmlPolyfillSupport;Vje?.(Bje,Lje),(lje.litHtmlVersions??=[]).push("3.2.1");var Hje=class extends cje{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new Lje(t.insertBefore(yje(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return kje}};Hje._$litElement$=!0,Hje.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:Hje});var qje=globalThis.litElementPolyfillSupport;function Wje(e,t,r,n){e.beginPath(),e.arc(t,r-.5*n,.2*n,.25*Math.PI,1*Math.PI,!0),e.arc(t-.35*n,r-.5*n,.15*n,0,1*Math.PI,!1),e.arc(t,r-.5*n,.5*n,1*Math.PI,.25*Math.PI,!1),e.arc(t+.25*n,r+.3*n,.2*n,1.25*Math.PI,1*Math.PI,!0),e.arc(t+.25*n-.35*n,r+.3*n,.15*n,0,1*Math.PI,!1),e.arc(t+.25*n,r+.3*n,.5*n,1*Math.PI,1.25*Math.PI,!1),e.closePath(),e.fill(),e.stroke(),e.beginPath(),e.arc(t+.25*n-.35*n,r+.85*n,.15*n,0,2*Math.PI,!0),e.closePath(),e.fill(),e.stroke()}function Xje(e,t,r,n,i){let a=Kje[t];return!!a&&(a(e,r,n,i),!0)}function Yje(e,t,r,n,i,a,o,s){let u=Zje[t];return!!u&&(u(e,r,n,i,a,o,s),!0)}qje?.({LitElement:Hje}),(globalThis.litElementVersions??=[]).push("4.1.1");var Kje={circle(e,t,r,n){e.beginPath(),e.arc(t,r,n,0,2*Math.PI),e.fill(),e.stroke()},triangle(e,t,r,n){e.beginPath(),e.moveTo(t,r-n),e.lineTo(t+n,r+n),e.lineTo(t-n,r+n),e.closePath(),e.fill(),e.stroke()},diamond(e,t,r,n){e.beginPath(),e.moveTo(t,r-n),e.lineTo(t+n,r),e.lineTo(t,r+n),e.lineTo(t-n,r),e.closePath(),e.fill(),e.stroke()},pentagon:(e,t,r,n)=>Qje(e,5,t,r,n),hexagon:(e,t,r,n)=>Qje(e,6,t,r,n),chevron(e,t,r,n){e.beginPath(),e.moveTo(t,r),e.lineTo(t+n,r-n),e.lineTo(t+n,r),e.lineTo(t,r+n),e.lineTo(t-n,r),e.lineTo(t-n,r-n),e.closePath(),e.fill(),e.stroke()},catFace(e,t,r,n){let i=.2*n,a=.4*n,o=n;e.beginPath(),e.moveTo(t+a,r-i),e.lineTo(t+o,r-o),e.lineTo(t+o,r+i),e.lineTo(t+a,r+o),e.lineTo(t-a,r+o),e.lineTo(t-o,r+i),e.lineTo(t-o,r-o),e.lineTo(t-a,r-i),e.closePath(),e.fill(),e.stroke()},arrow(e,t,r,n){let i=.1*n,a=.4*n,o=.8*n,s=1.2*n;e.beginPath(),e.moveTo(t-i,r-s),e.lineTo(t-o,r-a),e.lineTo(t-i,r+s),e.lineTo(t+i,r+s),e.lineTo(t+o,r-a),e.lineTo(t+i,r-s),e.closePath(),e.fill(),e.stroke()},wave(e,t,r,n){let i=.5*n;e.beginPath(),e.ellipse(t-i,r,i,n,0,Math.PI,0,!1),e.ellipse(t+i,r,i,n,0,Math.PI,0,!0),e.closePath(),e.fill(),e.stroke()},doubleBar(e,t,r,n){e.beginPath(),e.moveTo(t,r-n),e.lineTo(t+n,r-n),e.lineTo(t,r+n),e.lineTo(t-n,r+n),e.closePath(),e.fill(),e.stroke()}},Zje={rectangle(e,t,r,n,i){e.fillRect(t,r,n,i),e.strokeRect(t,r,n,i)},roundRectangle(e,t,r,n,i){let a=.5*i,o=Math.min(a,.5*n);e.beginPath(),e.ellipse(t+o,r+a,o,a,0,Math.PI,1.5*Math.PI,!1),e.ellipse(t+n-o,r+a,o,a,0,1.5*Math.PI,0,!1),e.ellipse(t+n-o,r+i-a,o,a,0,0,.5*Math.PI,!1),e.ellipse(t+o,r+i-a,o,a,0,.5*Math.PI,Math.PI,!1),e.closePath(),e.fill(),e.stroke()},line(e,t,r,n,i,a){let o=r+.5*i;!function(e,t,r,n,i){e.beginPath(),e.moveTo(t,r),e.lineTo(n,i),e.stroke()}(e,t+a,o,t+n-a,o)},bridge(e,t,r,n,i,a,o){if(t+=a,n-=2*a,1===o)e.beginPath(),e.moveTo(t,r+.5*i),e.lineTo(t+.5*n,r+.5*i),e.lineTo(t+.5*n,r),e.lineTo(t+.5*n,r+.5*i),e.lineTo(t+n,r+.5*i),e.lineTo(t+n,r+i),e.lineTo(t,r+i),e.closePath(),e.fill(),e.stroke();else{let a=.2*i;e.beginPath(),e.moveTo(t,r),e.lineTo(t+n,r),e.lineTo(t+n,r+i),e.lineTo(t+n,r+a),e.lineTo(t,r+a),e.lineTo(t,r+i),e.closePath(),e.fill(),e.stroke()}},discontinuosStart(e,t,r,n,i){let a=.2*i,o=Math.min(a,.5*n);e.beginPath(),e.moveTo(t,r),e.lineTo(t+o,r+a),e.lineTo(t,r+2*a),e.lineTo(t+o,r+3*a),e.lineTo(t,r+4*a),e.lineTo(t+o,r+i),e.lineTo(t+n,r+i),e.lineTo(t+n,r),e.closePath(),e.fill(),e.stroke()},discontinuosEnd(e,t,r,n,i){let a=.2*i,o=Math.min(a,.5*n);e.beginPath(),e.moveTo(t,r),e.lineTo(t,r+i),e.lineTo(t+n,r+i),e.lineTo(t+n-o,r+4*a),e.lineTo(t+n,r+3*a),e.lineTo(t+n-o,r+2*a),e.lineTo(t+n,r+1*a),e.lineTo(t+n-o,r),e.closePath(),e.fill(),e.stroke()},discontinuos(e,t,r,n,i){let a=.2*i,o=Math.min(a,.5*n);e.beginPath(),e.moveTo(t,r),e.lineTo(t+o,r+a),e.lineTo(t,r+2*a),e.lineTo(t+o,r+3*a),e.lineTo(t,r+4*a),e.lineTo(t+o,r+i),e.lineTo(t+n,r+i),e.lineTo(t+n-o,r+4*a),e.lineTo(t+n,r+3*a),e.lineTo(t+n-o,r+2*a),e.lineTo(t+n,r+1*a),e.lineTo(t+n-o,r),e.closePath(),e.fill(),e.stroke()},helix(e,t,r,n,i,a){t+=a,n-=2*a;let o=Math.min(.4*i,n),s=Math.floor(n/o),u=r+.05*i,c=r+.95*i;e.beginPath(),e.moveTo(t,c);for(let r=0;r<s;r++){let n=t+r*o;e.bezierCurveTo(n+.75*o,c,n+1.25*o,u,n+.5*o,u),e.bezierCurveTo(n,u,n+.5*o,c,n+o,c)}e.lineTo(t+n,c),e.fill(),e.stroke()},strand(e,t,r,n,i,a){t+=a,n-=2*a;let o=.25*i,s=Math.min(.5*i,.75*n),u=.01*s;e.beginPath(),e.moveTo(t,r+o),e.lineTo(t+n-s,r+o),e.lineTo(t+n-s,r),e.lineTo(t+n-s+u,r),e.lineTo(t+n,r+.5*i),e.lineTo(t+n-s+u,r+i),e.lineTo(t+n-s,r+i),e.lineTo(t+n-s,r+i-o),e.lineTo(t,r+i-o),e.closePath(),e.fill(),e.stroke()}};function Qje(e,t,r,n,i){e.beginPath(),e.moveTo(r+i,n);for(let a=1;a<t;a++){let o=2*Math.PI*a/t,s=r+i*Math.cos(o),u=n+i*Math.sin(o);e.lineTo(s,u)}e.closePath(),e.fill(),e.stroke()}Zje.discontinuousStart=Zje.discontinuosStart,Zje.discontinuousEnd=Zje.discontinuosEnd,Zje.discontinuous=Zje.discontinuos;var Jje=class{constructor(e,t){var r;this.Q=2,this._tmpArrays={},this.compareFn=(e,t)=>this.starts[e]-this.starts[t]||this.stops[t]-this.stops[e];let{start:n,stop:i}=t;this.items=e,this.starts=e.map(n),this.stops=e.map(i),this.bins={};for(let t=0;t<e.length;t++){let e=this.stops[t]-this.starts[t],n=1;for(;n<e;)n*=this.Q;((r=this.bins)[n]??(r[n]=[])).push(t)}this.binSpans=function(e){return e.sort((e,t)=>
599e-t)}(Object.keys(this.bins).map(Number));for(let e of this.binSpans)this.bins[e].sort(this.compareFn)}size(){return this.items.length}overlappingItems(e,t){return this.overlappingItemIndices(e,t).map(e=>this.items[e])}overlappingItemIndices(e,t){return function(e,t){let r=e.map((e,t)=>t).filter(t=>e[t].length>0);r.sort((r,n)=>t(e[r][0],e[n][0]));let n=e.map(()=>0),i=[];for(;r.length>0;){let a=r[0],o=e[a];if(i.push(o[n[a]++]),n[a]===o.length)r.shift();else{let i=o[n[a]],s=1;for(;s<r.length;s++){let a=r[s],o=e[a][n[a]];if(!(t(o,i)<0))break;r[s-1]=a}r[s-1]=a}}return i}(this.binSpans.map(r=>{var n;return this.overlappingItemIndicesInBin(r,e,t,(n=this._tmpArrays)[r]??(n[r]=[]))}),this.compareFn)}overlappingItemIndicesInBin(e,t,r,n){n.length=0;let i=this.bins[e],a=Du.firstGteqIndex(i,t-e,e=>this.starts[e]),o=Du.firstGteqIndex(i,r,e=>this.starts[e]);for(let e=a;e<o;e++){let r=i[e];this.stops[r]>t&&n.push(r)}return n}print(){for(let e of this.binSpans)console.log(`Bin ${e}:`,this.bins[e].map(e=>`${this.starts[e]}-${this.stops[e]}(${this.stops[e]-this.starts[e]})`).join("  "))}},eze=class extends(cu(FFe)){constructor(){super(...arguments),this._drawStamp=new Bu(()=>({data:this.data,canvasCtx:this.canvasCtx,width:this.width,height:this.height,canvasScale:this.canvasScale,length:this.length,"display-start":this["display-start"],"display-end":this["display-end"],"margin-color":this["margin-color"],"margin-left":this["margin-left"],"margin-right":this["margin-right"],"margin-top":this["margin-top"],"margin-bottom":this["margin-bottom"]})),this.requestDraw=()=>this._drawer.requestRefresh(),this._drawer=Ou(()=>this._draw()),this._unknownShapeWarningPrinted=new Set}createTrack(){var e;this.svg&&(this.svg.selectAll("g").remove(),this.unbindEvents(this.svg)),this.data&&(null==(e=this.layoutObj)||e.init(this.data),this.svg=function(e){return"string"==typeof e?new QLe([[document.querySelector(e)]],[document.documentElement]):new QLe([[e]],ZLe)}(this).selectAll("svg"),this.fragmentCollection=function(e){return new Jje(function(e){let t=[],r=e.length;for(let n=0;n<r;n++){let r=e[n];if(r.locations){for(let e of r.locations)for(let r of e.fragments)t.push({...r,featureIndex:n});if(r.start&&r.residuesToHighlight)for(let e of r.residuesToHighlight){let i=Number(r.start)+Number(e.position)-1;t.push({start:i,end:i,featureIndex:n,isResidue:!0})}}}return t}(e),{start:e=>e.start,stop:e=>(e.end??e.start)+1})}(this.data),this.svg&&(this.bindEvents(this.svg),this.highlighted=this.svg.append("g").attr("class","highlighted")))}refresh(){super.refresh(),this.requestDraw()}render(){return Mje`
600      <div class="container">
601        <div style="position: relative; z-index: 0;">
602          <canvas style="position: absolute; left: 0; top: 0; z-index: -1;"></canvas>
603          <svg></svg>
604        </div>
605      </div>
606    `}onCanvasScaleChange(){super.onCanvasScaleChange(),this.refresh()}_draw(){this._drawStamp.update().changed&&(this.adjustCanvasCtxLogicalSize(),this.drawCanvasContent())}drawCanvasContent(){let e=this.canvasCtx;if(!e)return;let t=e.canvas.width,r=e.canvas.height;if(e.clearRect(0,0,t,r),!this.fragmentCollection)return;let n=this.canvasScale;e.lineWidth=n*nze;let i=n*this.getSingleBaseWidth(),a=n*Math.max(0,this.layoutObj?.getFeatureHeight()??0),o=Math.min(1.5*n,.25*i),s=this.getSeqPositionFromX(0-rze-.5*nze)??-1/0,u=this.getSeqPositionFromX(t/n+rze+.5*nze)??1/0,c=this.fragmentCollection.overlappingItems(s,u);for(let t of c){let r=t.featureIndex,s=Number(t.end??t.start)-Number(t.start)+1,u=n*this.getXFromSeqPosition(t.start),c=s*i,l=n*(this.layoutObj?.getFeatureYPos(this.data[r])??0),d=this.getShape(this.data[r]);if(t.isResidue){let t=6-i;i<6&&t>s&&(s=t),u+=i/4,c=s*i/2,e.fillStyle=RFe("RESIDUE")}else e.fillStyle=this.getFeatureFillColor(this.data[r]);if(e.strokeStyle=this.getFeatureColor(this.data[r]),e.globalAlpha=this.data[r].opacity??.9,!Yje(e,d,u,l,c,a,o,s)){let t=u+.5*c,r=l+.5*a,i=n*rze;Xje(e,d,t,r,i)||(this.printUnknownShapeWarning(d),Wje(e,t,r,i)),s>1&&Yje(e,"line",u,l,c,a,o,s)}}e.globalAlpha=1,e.fillStyle=this["margin-color"];let l=this["margin-left"]*n,d=this["margin-right"]*n,f=this["margin-top"]*n,h=this["margin-bottom"]*n;e.fillRect(0,0,l,r),e.fillRect(t-d,0,d,r),e.fillRect(l,0,t-l-d,f),e.fillRect(l,r-h,t-l-d,h)}printUnknownShapeWarning(e){this._unknownShapeWarningPrinted.has(e)||(console.warn(`NightingaleTrackCanvas: Drawing shape "${e}" is not implemented. Will draw question marks instead ¯\\_(ツ)_/¯`),this._unknownShapeWarningPrinted.add(e))}getFragmentAt(e,t){if(!this.fragmentCollection)return;let r=.5*nze,n=this.getSeqPositionFromX(e-rze-r),i=this.getSeqPositionFromX(e+rze+r);if(void 0===n||void 0===i)return;let a=this.fragmentCollection.overlappingItems(n,i),o=this.getSingleBaseWidth(),s=this.layoutObj?.getFeatureHeight()??0;return function(e,t){if(!t)return e.length>0?e[e.length-1]:void 0;for(let r=e.length-1;r>=0;r--){let n=e[r];if(t(n))return n}}(a,n=>{let i=this.data[n.featureIndex],a=this.layoutObj?.getFeatureYPos(i)??0;if(!(a-r<=t&&t<=a+s+r))return!1;let u=(n.end??n.start)+1-n.start,c=this.getXFromSeqPosition(n.start);if(c-r<=e&&e<=c+u*o+r)return!0;
606if("range"!=((l=this.getShape(i))in Kje?"symbol":l in Zje?"range":"unknown")){let t=c+.5*u*o;if(t-rze-r<=e&&e<=t+rze+r)return!0}var l;return!1})}bindEvents(e){e.on("click.NightingaleTrackCanvas",e=>this.handleClick(e)),e.on("mousemove.NightingaleTrackCanvas",e=>this.handleMousemove(e)),e.on("mouseout.NightingaleTrackCanvas",e=>this.handleMouseout(e))}unbindEvents(e){e.on("click.NightingaleTrackCanvas",null),e.on("mousemove.NightingaleTrackCanvas",null),e.on("mouseout.NightingaleTrackCanvas",null)}handleClick(e){let t=this.getFragmentAt(e.offsetX,e.offsetY);if(!t)return;let r=Mu("click",this.data[t.featureIndex],"onclick"===this.getAttribute("highlight-event"),!0,t.start,t.end??t.start,e.target instanceof HTMLElement?e.target:void 0,e,this);this.dispatchEvent(r)}handleMousemove(e){let t=this.getFragmentAt(e.offsetX,e.offsetY);if(!t)return this.handleMouseout(e);let r=Mu("mouseover",this.data[t.featureIndex],"onmouseover"===this.getAttribute("highlight-event"),!1,t.start,t.end??t.start,e.target instanceof HTMLElement?e.target:void 0,e,this);this.dispatchEvent(r)}handleMouseout(e){let t=Mu("mouseout",null,"onmouseover"===this.getAttribute("highlight-event"),void 0,void 0,void 0,e.target instanceof HTMLElement?e.target:void 0,e,this);this.dispatchEvent(t)}};eze=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}([Fu("nightingale-track-canvas")],eze);var tze=eze,rze=5,nze=1;function ize(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function aze(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function oze(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var sze=globalThis,uze=sze.ShadowRoot&&(void 0===sze.ShadyCSS||sze.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,cze=Symbol(),lze=new WeakMap,dze=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==cze)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(uze&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=lze.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&lze.set(t,e))}return e}toString(){return this.cssText}},fze=uze?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new dze("string"==typeof e?e:e+"",void 0,cze))(t)})(e):e,{is:hze,defineProperty:pze,getOwnPropertyDescriptor:mze,getOwnPropertyNames:gze,getOwnPropertySymbols:vze,getPrototypeOf:yze}=Object,bze=globalThis,_ze=bze.trustedTypes,xze=_ze?_ze.emptyScript:"",Sze=bze.reactiveElementPolyfillSupport,wze=(e,t)=>e,Aze={toAttribute(e,t){switch(t){case Boolean:e=e?xze:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Cze=(e,t)=>!hze(e,t),Tze={attribute:!0,type:String,converter:Aze,reflect:!1,hasChanged:Cze};Symbol.metadata??=Symbol("metadata"),bze.litPropertyMetadata??=new WeakMap;var Pze=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Tze){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&pze(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=mze(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Tze}static _$Ei(){if(this.hasOwnProperty(wze("elementProperties")))return;let e=yze(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wze("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wze("properties"))){let e=this.properties,t=[...gze(e),...vze(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(fze(e))}else void 0!==e&&t.push(fze(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
606=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(uze)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=sze.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Aze:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Aze:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??Cze)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};Pze.elementStyles=[],Pze.shadowRootOptions={mode:"open"},Pze[wze("elementProperties")]=new Map,Pze[wze("finalized")]=new Map,Sze?.({ReactiveElement:Pze}),(bze.reactiveElementVersions??=[]).push("2.0.4");var Eze={attribute:!0,type:String,converter:Aze,reflect:!1,hasChanged:Cze},Mze=(e=Eze,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function kze(e){return(t,r)=>"object"==typeof r?Mze(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}var Ize={value:()=>{}};function Dze(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new Oze(n)}function Oze(e){this._=e}function Rze(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function Bze(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=Ize,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}Oze.prototype=Dze.prototype={constructor:Oze,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=Bze(i[r],e.name,t);else if(null==t)for(r in i)i[r]=Bze(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=Rze(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Oze(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var Nze="http://www.w3.org/1999/xhtml",Fze={svg:"http://www.w3.org/2000/svg",xhtml:Nze,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lze(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),Fze.hasOwnProperty(t)?{space:Fze[t],local:e}:e}function $ze(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Nze&&t.documentElement.namespaceURI===Nze?t.createElement(e):t.createElementNS(r,e)}}function Uze(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function jze(e){var t=Lze(e);return(t.local?Uze:$ze)(t)}function zze(){}function Gze(e){return null==e?zze:function(){return this.querySelector(e)}}function Vze(){return[]}function Hze(e){return null==e?Vze:function(){return this.querySelectorAll(e)}}function qze(e){return function(){return this.matches(e)}}function Wze(e){return function(t){return t.matches(e)}}var Xze=Array.prototype.find;function Yze(){return this.firstElementChild}var Kze=Array.prototype.filter;function Zze(){return Array.from(this.children)}function Qze(e){return Array(e.length)}function Jze(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function eGe(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new Jze(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function tGe(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new Jze(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function rGe(e){return e.__data__}function nGe(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function iGe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function aGe(e){return function(){this.removeAttribute(e)}}function oGe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sGe(e,t){return function(){this.setAttribute(e,t)}}function uGe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cGe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function lGe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function dGe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fGe(e){return function(){this.style.removeProperty(e)}}function hGe(e,t,r){return function(){this.style.setProperty(e,t,r)}}function pGe(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function mGe(e,t){return e.style.getPropertyValue(t)||dGe(e).getComputedStyle(e,null).getPropertyValue(t)}function gGe(e){return function(){delete this[e]}}function vGe(e,t){return function(){this[e]=t}}function yGe(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function bGe(e){return e.trim().split(/^|\s+/)}function _Ge(e){return e.classList||new xGe(e)}function xGe(e){this._node=e,this._names=bGe(e.getAttribute("class")||"")}function SGe(e,t){for(var r=_Ge(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function wGe(e,t){for(var r=_Ge(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function AGe(e){return function(){SGe(this,e)}}function CGe(e){return function(){wGe(this,e)}}function TGe(e,t){return function(){(t.apply(this,arguments)?SGe:wGe)(this,e)}}function PGe(){this.textContent=""}function EGe(e){return function(){this.textContent=e}}function MGe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function kGe(){this.innerHTML=""}function IGe(e){return function(){this.innerHTML=e}}function DGe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function OGe(){this.nextSibling&&this.parentNode.appendChild(this)}function RGe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function BGe(){return null}function NGe(){var e=this.parentNode;e&&e.removeChild(this)}function FGe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function LGe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $Ge(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function UGe(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function jGe(e,t,r){var n=dGe(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function zGe(e,t){return function(){return jGe(this,e,t)}}function GGe(e,t){return function(){return jGe(this,e,t.apply(this,arguments))}}Jze.prototype={constructor:Jze,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},xGe.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var VGe=[null];function HGe(e,t){this._groups=e,this._parents=t}function qGe(){return new HGe([[document.documentElement]],VGe)}function WGe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function XGe(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function YGe(){}HGe.prototype=qGe.prototype={constructor:HGe,select:function(e){"function"!=typeof e&&(e=Gze(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new HGe(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}(e):Hze(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new HGe(n,i)},selectChild:function(e){return this.select(null==e?Yze:function(e){return function(){return Xze.call(this.children,e)}}("function"==typeof e?e:Wze(e)))},selectChildren:function(e){return this.selectAll(null==e?Zze:function(e){return function(){return Kze.call(this.children,e)}}("function"==typeof e?e:Wze(e)))},filter:function(e){"function"!=typeof e&&(e=qze(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new HGe(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,rGe);var r,n=t?tGe:eGe,i=this._parents,a=this._groups;"function"!=typeof e&&(r=e,e=function(){return r});for(var o=a.length,s=Array(o),u=Array(o),c=Array(o),l=0;l<o;++l){var d=i[l],f=a[l],h=f.length,p=nGe(e.call(d,d&&d.__data__,l,i)),m=p.length,g=u[l]=Array(m),v=s[l]=Array(m);n(d,f,g,v,c[l]=Array(h),p,t);for(var y,b,_=0,x=0;_<m;++_)if(y=g[_]){for(_>=x&&(x=_+1);!(b=v[x])&&++x<m;);y._next=b||null}}return(s=new HGe(s,i))._enter=u,s._exit=c,s},enter:function(){return new HGe(this._enter||this._groups.map(Qze),this._parents)},exit:function(){return new HGe(this._exit||this._groups.map(Qze),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new HGe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=iGe;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new HGe(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=Lze(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?oGe:aGe:"function"==typeof t?r.local?lGe:cGe:r.local?uGe:sGe)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?fGe:"function"==typeof t?pGe:hGe)(e,t,r??"")):mGe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?gGe:"function"==typeof t?yGe:vGe)(e,t)):this.node()[e]},classed:function(e,t){var r=bGe(e+"");if(arguments.length<2){for(var n=_Ge(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?TGe:t?AGe:CGe)(r,t))},text:function(e){return arguments.length?this.each(null==e?PGe:("function"==typeof e?MGe:EGe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?kGe:("function"==typeof e?DGe:IGe)(e)):this.node().innerHTML},raise:function(){return this.each(OGe)},lower:function(){return this.each(RGe)},append:function(e){var t="function"==typeof e?e:jze(e);retu
vendor: 8,413 bytes, line 606
606rn this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:jze(e),n=null==t?BGe:"function"==typeof t?t:Gze(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(NGe)},clone:function(e){return this.select(e?LGe:FGe)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?UGe:$Ge,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?GGe:zGe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var KGe=.7,ZGe=1/KGe,QGe="\\s*([+-]?\\d+)\\s*",JGe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",eVe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tVe=/^#([0-9a-f]{3,8})$/,rVe=RegExp(`^rgb\\(${QGe},${QGe},${QGe}\\)$`),nVe=RegExp(`^rgb\\(${eVe},${eVe},${eVe}\\)$`),iVe=RegExp(`^rgba\\(${QGe},${QGe},${QGe},${JGe}\\)$`),aVe=RegExp(`^rgba\\(${eVe},${eVe},${eVe},${JGe}\\)$`),oVe=RegExp(`^hsl\\(${JGe},${eVe},${eVe}\\)$`),sVe=RegExp(`^hsla\\(${JGe},${eVe},${eVe},${JGe}\\)$`),uVe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function cVe(){return this.rgb().formatHex()}function lVe(){return this.rgb().formatRgb()}function dVe(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=tVe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?fVe(t):3===r?new mVe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?hVe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?hVe(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=rVe.exec(e))?new mVe(t[1],t[2],t[3],1):(t=nVe.exec(e))?new mVe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=iVe.exec(e))?hVe(t[1],t[2],t[3],t[4]):(t=aVe.exec(e))?hVe(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=oVe.exec(e))?xVe(t[1],t[2]/100,t[3]/100,1):(t=sVe.exec(e))?xVe(t[1],t[2]/100,t[3]/100,t[4]):uVe.hasOwnProperty(e)?fVe(uVe[e]):"transparent"===e?new mVe(NaN,NaN,NaN,0):null}function fVe(e){return new mVe(e>>16&255,e>>8&255,255&e,1)}function hVe(e,t,r,n){return n<=0&&(e=t=r=NaN),new mVe(e,t,r,n)}function pVe(e,t,r,n){return 1===arguments.length?function(e){return e instanceof YGe||(e=dVe(e)),e?new mVe((e=e.rgb()).r,e.g,e.b,e.opacity):new mVe}(e):new mVe(e,t,r,n??1)}function mVe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function gVe(){return`#${_Ve(this.r)}${_Ve(this.g)}${_Ve(this.b)}`}function vVe(){let e=yVe(this.opacity);return`${1===e?"rgb(":"rgba("}${bVe(this.r)}, ${bVe(this.g)}, ${bVe(this.b)}${1===e?")":`, ${e})`}`}function yVe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function bVe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _Ve(e){return((e=bVe(e))<16?"0":"")+e.toString(16)}function xVe(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new wVe(e,t,r,n)}function SVe(e){if(e instanceof wVe)return new wVe(e.h,e.s,e.l,e.opacity);if(e instanceof YGe||(e=dVe(e)),!e)return new wVe;if(e instanceof wVe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new wVe(o,s,u,e.opacity)}function wVe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function AVe(e){return(e=(e||0)%360)<0?e+360:e}function CVe(e){return Math.max(0,Math.min(1,e||0))}function TVe(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}WGe(YGe,dVe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cVe,formatHex:cVe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return SVe(this).formatHsl()},formatRgb:lVe,toString:lVe}),WGe(mVe,pVe,XGe(YGe,{brighter(e){return e=null==e?ZGe:ZGe**+e,new mVe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?KGe:KGe**+e,new mVe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mVe(bVe(this.r),bVe(this.g),bVe(this.b),yVe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:gVe,formatHex:gVe,formatHex8:function(){return`#${_Ve(this.r)}${_Ve(this.g)}${_Ve(this.b)}${_Ve(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:vVe,toString:vVe})),WGe(wVe,function(e,t,r,n){return 1===arguments.length?SVe(e):new wVe(e,t,r,n??1)},XGe(YGe,{brighter(e){return e=null==e?ZGe:ZGe**+e,new wVe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?KGe:KGe**+e,new wVe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new mVe(TVe(e>=240?e-240:e+120,i,n),TVe(e,i,n),TVe(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new wVe(AVe(this.h),CVe(this.s),CVe(this.l),yVe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=yVe(this.opacity);return`${1===e?"hsl(":"hsla("}${AVe(this.h)}, ${100*CVe(this.s)}%, ${100*CVe(this.l)}%${1===e?")":`, ${e})`}`}}));var PVe=e=>()=>e;function EVe(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):PVe(isNaN(e)?t:e)}
606var MVe=function e(t){var r=function(e){return 1==(e=+e)?EVe:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):PVe(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=pVe(e)).r,(t=pVe(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=EVe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function kVe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var IVe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,DVe=new RegExp(IVe.source,"g");function OVe(e,t){var r,n,i,a=IVe.lastIndex=DVe.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=IVe.exec(e))&&(n=DVe.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:kVe(r,n)})),a=DVe.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}var RVe,BVe=180/Math.PI,NVe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function FVe(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*BVe,skewX:Math.atan(u)*BVe,scaleX:o,scaleY:s}}function LVe(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:kVe(e,i)},{i:u-2,x:kVe(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:kVe(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",
606null,n)-2,x:kVe(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:kVe(e,r)},{i:s-2,x:kVe(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var $Ve,UVe,jVe=LVe(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?NVe:FVe(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),zVe=LVe(function(e){return null==e?NVe:(RVe||=document.createElementNS("http://www.w3.org/2000/svg","g"),RVe.setAttribute("transform",e),(e=RVe.transform.baseVal.consolidate())?FVe((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):NVe)},", ",")",")"),GVe=0,VVe=0,HVe=0,qVe=0,WVe=0,XVe=0,YVe="object"==typeof performance&&performance.now?performance:Date,KVe="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ZVe(){return WVe||=(KVe(QVe),YVe.now()+XVe)}function QVe(){WVe=0}function JVe(){this._call=this._time=this._next=null}function eHe(e,t,r){var n=new JVe;return n.restart(e,t,r),n}function tHe(){WVe=(qVe=YVe.now())+XVe,GVe=VVe=0;try{!function(){ZVe(),++GVe;for(var e,t=$Ve;t;)(e=WVe-t._time)>=0&&t._call.call(void 0,e),t=t._next;--GVe}()}finally{GVe=0,function(){for(var e,t,r=$Ve,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:$Ve=t);UVe=e,nHe(n)}(),WVe=0}}function rHe(){var e=YVe.now(),t=e-qVe;t>1e3&&(XVe-=t,qVe=e)}function nHe(e){GVe||(VVe&&=clearTimeout(VVe),e-WVe>24?(e<1/0&&(VVe=setTimeout(tHe,e-YVe.now()-XVe)),HVe&&=clearInterval(HVe)):(HVe||=(qVe=YVe.now(),setInterval(rHe,1e3)),GVe=1,KVe(tHe)))}function iHe(e,t,r){var n=new JVe;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}JVe.prototype=eHe.prototype={constructor:JVe,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?ZVe():+r)+(null==t?0:+t),this._next||UVe===this||(UVe?UVe._next=this:$Ve=this,UVe=this),this._call=e,this._time=r,nHe()},stop:function(){this._call&&(this._call=null,this._time=1/0,nHe())}};var aHe=Dze("start","end","cancel","interrupt"),oHe=[];function sHe(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return iHe(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(iHe(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
606),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=eHe(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:aHe,tween:oHe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function uHe(e,t){var r=lHe(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function cHe(e,t){var r=lHe(e,t);if(r.state>3)throw Error("too late; already running");return r}function lHe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function dHe(e,t){var r,n;return function(){var i=cHe(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function fHe(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=cHe(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function hHe(e,t,r){var n=e._id;return e.each(function(){var e=cHe(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return lHe(e,n).value[t]}}function pHe(e,t){var r;return("number"==typeof t?kVe:t instanceof dVe?MVe:(r=dVe(t))?(t=r,MVe):OVe)(e,t)}function mHe(e){return function(){this.removeAttribute(e)}}function gHe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vHe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function yHe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function bHe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function _He(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function xHe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function SHe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function wHe(e,t){return function(){uHe(this,e).delay=+t.apply(this,arguments)}}function AHe(e,t){return t=+t,function(){uHe(this,e).delay=t}}function CHe(e,t){return function(){cHe(this,e).duration=+t.apply(this,arguments)}}function THe(e,t){return t=+t,function(){cHe(this,e).duration=t}}var PHe=qGe.prototype.constructor;function EHe(e){return function(){this.style.removeProperty(e)}}var MHe=0;function kHe(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function IHe(){return++MHe}var DHe=qGe.prototype;kHe.prototype={constructor:kHe,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=Gze(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,sHe(d[f],t,r,f,d,lHe(s,r)));return new kHe(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=Hze(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=lHe(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&sHe(f,t,r,m,h,p);a.push(h),o.push(u)}return new kHe(a,o,t,r)},selectChild:DHe.selectChild,selectChildren:DHe.selectChildren,filter:function(e){"function"!=typeof e&&(e=qze(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new kHe(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new kHe(o,this._parents,this._name,this._id)},selection:function(){return new PHe(this._groups,this._parents)}
vendor: 4,303 bytes, line 606
606,transition:function(){for(var e=this._name,t=this._id,r=IHe(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=lHe(o,t);sHe(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new kHe(n,this._parents,e,r)},call:DHe.call,nodes:DHe.nodes,node:DHe.node,size:DHe.size,empty:DHe.empty,each:DHe.each,on:function(e,t){var r=this._id;return arguments.length<2?lHe(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?uHe:cHe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=Lze(e),n="transform"===r?zVe:pHe;return this.attrTween(e,"function"==typeof t?(r.local?_He:bHe)(r,n,hHe(this,"attr."+e,t)):null==t?(r.local?gHe:mHe)(r):(r.local?yHe:vHe)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=Lze(e);return this.tween(r,(n.local?xHe:SHe)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?jVe:pHe;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=mGe(this,e),o=(this.style.removeProperty(e),mGe(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,EHe(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=mGe(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=mGe(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,hHe(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=cHe(this,e),c=u.on,l=null==u.value[o]?a||=EHe(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=mGe(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(hHe(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=lHe(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?dHe:fHe)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?wHe:AHe)(t,e)):lHe(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?CHe:THe)(t,e)):lHe(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){cHe(this,e).ease=t}}(t,e)):lHe(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();cHe(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=cHe(this,n),i=r.on;
606i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:DHe[Symbol.iterator]};var OHe={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function RHe(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}function BHe(e,t,r){this.k=e,this.x=t,this.y=r}qGe.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},qGe.prototype.transition=function(e){var t,r;e instanceof kHe?(t=e._id,e=e._name):(t=IHe(),(r=OHe).time=ZVe(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&sHe(o,e,t,c,s,r||RHe(o,t));return new kHe(n,this._parents,e,t)},BHe.prototype={constructor:BHe,scale:function(e){return 1===e?this:new BHe(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new BHe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},BHe.prototype;var NHe=Array.isArray,FHe="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,LHe="object"==typeof self&&self&&self.Object===Object&&self,$He=FHe||LHe||Function("return this")(),UHe=$He.Symbol,jHe=Object.prototype,zHe=jHe.hasOwnProperty,GHe=jHe.toString,VHe=UHe?UHe.toStringTag:void 0,HHe=Object.prototype.toString,qHe=UHe?UHe.toStringTag:void 0;function WHe(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qHe&&qHe in Object(e)?function(e){var t=zHe.call(e,VHe),r=e[VHe];try{e[VHe]=void 0;var n=!0}catch{}var i=GHe.call(e);return n&&(t?e[VHe]=r:delete e[VHe]),i}(e):function(e){return HHe.call(e)}(e)}function XHe(e){return"symbol"==typeof e||function(e){return"object"==typeof e&&!!e}(e)&&"[object Symbol]"==WHe(e)}var YHe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,KHe=/^\w*$/;function ZHe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var QHe,JHe=$He["__core-js_shared__"],eqe=(QHe=/[^.]+$/.exec(JHe&&JHe.keys&&JHe.keys.IE_PROTO||""))?"Symbol(src)_1."+QHe:"",tqe=Function.prototype.toString,rqe=/^\[object .+?Constructor\]$/,nqe=Function.prototype,iqe=Object.prototype,aqe=nqe.toString,oqe=iqe.hasOwnProperty,sqe=RegExp("^"+aqe.call(oqe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function uqe(e,t){var r=function(e,t){return e?.[t]}(e,t);return function(e){return!(!ZHe(e)||(t=e,eqe&&eqe in t))&&(function(e){if(!ZHe(e))return!1;var t=WHe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}(e)?sqe:rqe).test(function(e){if(null!=e){try{return tqe.call(e)}catch{}try{return e+""}catch{}}return""}(e));var t}(r)?r:void 0}var cqe=uqe(Object,"create"),lqe=Object.prototype.hasOwnProperty,dqe=Object.prototype.hasOwnProperty;function fqe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function hqe(e,t){for(var r,n,i=e.length;i--;)if((r=e[i][0])===(n=t)||r!=r&&n!=n)return i;return-1}fqe.prototype.clear=function(){this.__data__=cqe?cqe(null):{},this.size=0},fqe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},fqe.prototype.get=function(e){var t=this.__data__;if(cqe){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return lqe.call(t,e)?t[e]:void 0},fqe.prototype.has=function(e){var t=this.__data__;return cqe?void 0!==t[e]:dqe.call(t,e)},fqe.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=cqe&&void 0===t?"__lodash_hash_undefined__":t,this};var pqe=Array.prototype.splice;function mqe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}mqe.prototype.clear=function(){this.__data__=[],this.size=0},mqe.prototype.delete=function(e){var t=this.__data__,r=hqe(t,e);return!(r<0||(r==t.length-1?t.pop():pqe.call(t,r,1),--this.size,0))},mqe.prototype.get=function(e){var t=this.__data__,r=hqe(t,e);return r<0?void 0:t[r][1]},mqe.prototype.has=function(e){return hqe(this.__data__,e)>-1},mqe.prototype.set=function(e,t){var r=this.__data__,n=hqe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var gqe=uqe($He,"Map");function vqe(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function yqe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function bqe(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(bqe.Cache||yqe),r}yqe.prototype.clear=function(){this.size=0,this.__data__={hash:new fqe,map:new(gqe||mqe),string:new fqe}},yqe.prototype.delete=function(e){var t=vqe(this,e).delete(e);return this.size-=+!!t,t},yqe.prototype.get=function(e){return vqe(this,e).get(e)},yqe.prototype.has=function(e){return vqe(this,e).has(e)},yqe.prototype.set=function(e,t){var r=vqe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},bqe.Cache=yqe;var _qe,xqe,Sqe,wqe,Aqe,Cqe,Tqe,Pqe,Eqe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mqe=/\\(\\)?/g,kqe=(_qe=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Eqe,function(e,r,n,i){t.push(n?i.replace(Mqe,"$1"):r||e)}),t},xqe=bqe(_qe,function(e){return 500===Sqe.size&&Sqe.clear(),e}),Sqe=xqe.cache,xqe),Iqe=UHe?UHe.prototype:void 0,Dqe=Iqe?Iqe.toString:void 0;function Oqe(e){if("string"==typeof e)return e;if(NHe(e))return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(e,Oqe)+"";if(XHe(e))return Dqe?Dqe.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Rqe(e){if("string"==typeof e||XHe(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}var Bqe=class extends wFe{constructor({expanded:e,padding:t,...r}){super(r),wqe.add(this),Cqe.set(this,new Map),Tqe.set(this,new Map),this.maxYPos=0,this.expanded=!1,this.padding=1,this.expanded=e,this.padding=t}init(e,t){let r=0;if(oze(this,Cqe,new Map,"f"),oze(this,Tqe,new Map,"f"),this.maxYPos=0,!e)return;let n={};for(let i=0;i<e.length;i++){let a=e[i],o=a?.residues?.length||t?.length;aze(this,Cqe,"f").set(a.accession,o&&!this.expanded?16:14),aze(this,Tqe,"f").set(a.accession,this.padding),r=(aze(this,Cqe,"f").get(a.accession)||0)+2*this.padding,this.maxYPos=Math.max(this.maxYPos,r),a.accession in n||(n[a.accession]={}),a.residues&&(r=aze(this,wqe,"m",Pqe).call(this,a.residues,a.accession,this.expanded?r:aze(this,Tqe,"f").get(a.accession)||0,i,3,a.locations,n,this.expanded))}if(t)for(let e=0;e<t.length;e++){let i=t[e];aze(this,Cqe,"f").has(i.accession)||(aze(this,Cqe,"f").set(i.accession,10),aze(this,Tqe,"f").set(i.accession,(this.expanded?this.maxYPos:3)+this.padding),r+=this.expanded?2*this.padding+(aze(this,Cqe,"f").get(i.accession)||14):0,this.maxYPos=Math.max(this.maxYPos,r)),i.accession in n||(n[i.accession]={}),i.residues&&(r=aze(this,wqe,"m",Pqe).call(this,i.residues,i.accession,i.expanded?r:aze(this,Tqe,"f").get(i.accession)||0,e,3,
606i.locations,n,this.expanded&&i.expanded))}this.maxYPos+=this.padding}static filterOutResidueFragmentsOutOfLocation(e,t){e.locations.forEach(e=>e.fragments=e.fragments.filter(e=>t.some(t=>t.fragments.some(t=>e.start>=t.start&&e.end<=t.end)))),e.locations=e.locations.filter(e=>e.fragments.length)}static getAccFromFeature(e){let t="";return"string"==typeof e?t=e:e.accession&&(t=e.accession),t}getFeatureYPos(e){let t=Aqe.getAccFromFeature(e);return aze(this,Tqe,"f").get(t)||0}getFeatureHeight(e){let t=Aqe.getAccFromFeature(e);return aze(this,Cqe,"f").get(t)||0}};Aqe=Bqe,Cqe=new WeakMap,Tqe=new WeakMap,wqe=new WeakSet,Pqe=function(e,t,r,n,i,a,o={},s=!0){for(let u=0;u<e.length;u++){let c=e[u];Aqe.filterOutResidueFragmentsOutOfLocation(c,a||[]),c.accession in o[t]||(o[t][c.accession]={});for(let e=0;e<c.locations.length;e++){let a=c.locations[e].description;a in o[t][c.accession]||(o[t][c.accession][a]={height:s?10:(aze(this,Cqe,"f").get(t)||14)-2*i,yPos:s?this.maxYPos+this.padding:r+i},r=s?this.maxYPos+2*this.padding+10:r),aze(this,Cqe,"f").set(`${c.accession}_${n}_${u}_${e}`,o[t][c.accession][a].height),aze(this,Tqe,"f").set(`${c.accession}_${n}_${u}_${e}`,o[t][c.accession][a].yPos),this.maxYPos=Math.max(this.maxYPos,r)}}return s?r:this.maxYPos+2*this.padding};var Nqe,Fqe,Lqe,$qe,Uqe,jqe,zqe,Gqe,Vqe=(e,t)=>{let r={value:1,...e},n=[];for(let e of t)r?r.end<e.start?(n.push(r),r=null,n.push(e)):r.start<e.start&&r.end>=e.end?(n.push({start:r.start,end:e.start-1,value:r.value}),n.push({start:e.start,end:e.end,value:(e.value||0)+(r?.value||0)}),r=e.end===r.end?null:{start:e.end+1,end:r.end,value:r.value}):e.start<r.start&&e.end>r.end?(n.push({start:e.start,end:r.start-1,value:e.value}),n.push({start:r.start,end:r.end,value:(e.value||0)+(r?.value||0)}),n.push({start:r.end+1,end:e.end,value:e.value}),r=null):e.end>=r.start&&e.end<=r.end?(e.start<r.start&&n.push({start:e.start,end:r.start-1,value:e.value}),n.push({start:r.start,end:e.end,value:(e.value||0)+(r?.value||0)}),r=e.end<r.end?{start:e.end+1,end:r.end,value:r.value}:null):r.end>=e.start&&r.end<e.end?(n.push({start:r.start,end:e.start-1,value:r.value}),n.push({start:e.start,end:r.end,value:(e.value||0)+(r?.value||0)}),n.push({start:r.end+1,end:e.end,value:e.value}),r=null):n.push(e):n.push(e);return r&&n.push(r),n},Hqe=e=>e.selectAll("g.residues-group").data(e=>e.residues?.map((t,r)=>({...t,feature:e,i:r}))||[]).enter().append("g").attr("class","residues-group").selectAll("g.residues-locations").data(e=>e.locations.map((t,r)=>({...t,accession:e.accession,feature:e.feature,location:t,i:e.i,j:r}))).enter().append("g").attr("class","residues-locations"),qqe=({baseG:e,getResidueShape:t,getResidueTransform:r,getResidueFill:n,element:i})=>e.selectAll("path.residue").data(e=>e.fragments.map(t=>({...t,accession:e.accession,feature:{...e.feature,currentResidue:{...t,description:e.location.description}},location:e.location,k:e.feature.k,i:e.i,j:e.j}))).enter().append("path").attr("class","feature rectangle residue").attr("d",t).attr("transform",r).attr("fill",n).attr("stroke","transparent").call(ku,i),Wqe=({baseG:e,expanded:t,getResidueShape:r,getResidueTransform:n,getResidueFill:i})=>{let a=e.selectAll("path.residue"),o=new Set(a.data().map(e=>`${e.feature?.accession}-${e.location?.description}`)).size;a.attr("d",r).attr("transform",n).style("pointer-events",e=>t||e.feature&&e.feature.expanded?"auto":"none").style("stroke",()=>t?null:"none").style("opacity",()=>t?null:.8/o).attr("fill",i)},Xqe={},Yqe=Gqe=class extends FFe{constructor(){super(),this.expanded=!1,this["show-label"]=!1,this.label=null,Nqe.set(this,void 0),Fqe.set(this,void 0),Lqe.set(this,!1),$qe.set(this,void 0),Uqe.set(this,void 0),jqe.set(this,void 0),zqe.set(this,void 0),this["margin-top"]=2,this["margin-bottom"]=2}createTrack(){this.layoutObj&&(this.layoutObj.expanded=!!this.expanded,oze(this,$qe,void 0,"f"),super.createTrack(),this.zoomRefreshed())}connectedCallback(){super.connectedCallback(),oze(this,Lqe,!1,"f")}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),"expanded"===e&&t!==r&&aze(this,Nqe,"f"))for(let e of aze(this,Nqe,"f"))e.expanded=!t}set contributors(e){oze(this,Nqe,Gqe.normalizeLocations(e),"f"),oze(this,Fqe,((e,t=100,r=!0)=>{let n=[];return r&&(n=Vqe({start:1,end:t,value:0}
606,n)),e.forEach(e=>e.locations?.forEach(e=>e.fragments.forEach(e=>{n=Vqe(e,n)}))),n})(aze(this,Nqe,"f"),this.length),"f"),this.data&&this.createTrack()}getLayout(){return new Bqe({layoutHeight:this.height,expanded:!!this.expanded,padding:(this["margin-top"]+this["margin-bottom"])/2})}createFeatures(){var e,t,r;if(!this.seqG)return;null==(e=this.layoutObj)||e.init(this.data,aze(this,Nqe,"f")),this.data.forEach((e,t)=>e.k=t),oze(this,Uqe,this.seqG.selectAll("g.feature-group").data(this.data).enter().append("g").attr("class","feature-group").attr("id",e=>`g_${e.accession}`),"f");let n=aze(this,Uqe,"f").selectAll("g.location-group").data(e=>e.locations?.map(t=>({...t,feature:e}))||[]).enter().append("g").attr("class","location-group").style("cursor",aze(this,Nqe,"f")?"pointer":"default");if(n.selectAll("line.cover").data(e=>[e.fragments.reduce((t,r)=>({start:Math.min(t.start,r.start),end:Math.max(t.end,r.end),feature:e.feature}),{start:1/0,end:-1/0})]).enter().append("line").attr("class","cover"),n.selectAll("path.feature").data(e=>e.fragments.map(t=>({...t,feature:e.feature,fragments:e.fragments}))).enter().append("path").attr("class",e=>
606`${this.getShape(e)} feature`).on("click.expanded",()=>{this.expanded?this.removeAttribute("expanded"):this.setAttribute("expanded","expanded")}).call(ku,this),n.selectAll("text.feature-label").data(e=>e.fragments.map(t=>({...t,feature:e.feature,fragments:e.fragments}))).enter().append("text").attr("class","feature-label").attr("dominant-baseline","middle").attr("text-anchor","middle").style("cursor","inherit").style("pointer-events","none"),oze(this,jqe,Hqe(aze(this,Uqe,"f")),"f"),qqe({baseG:aze(this,jqe,"f"),getResidueShape:e=>this.getResidueShape(e),getResidueTransform:e=>this.getResidueTransform(e),getResidueFill:e=>this.getResidueFill(e,!!this.expanded),element:this}),aze(this,Nqe,"f")){aze(this,Nqe,"f").forEach((e,t)=>e.k=t),aze(this,$qe,"f")||oze(this,$qe,this.svg?.append("g").attr("class","children-features"),"f");let e=(aze(this,$qe,"f")?.append("g").attr("class","children-group"))?.selectAll("g.child-group").data(aze(this,Nqe,"f")).enter().append("g").attr("class","child-group");if(!e)return;let r=e.selectAll("g.child-location-group").data(e=>(e.expanded=this.expanded,(e.locations||[]).map(t=>({...t,feature:e})))).enter().append("g").attr("class",(e,t)=>`child-location-group clg-${t}`);r?.selectAll("line.cover").data(e=>[e.fragments.reduce((t,r)=>({start:Math.min(t.start,r.start),end:Math.max(t.end,r.end),feature:e.feature}),{start:1/0,end:-1/0})]).enter().append("line").attr("class","cover"),r?.selectAll("path.child-fragment").data(e=>e.fragments.map(t=>({...t,feature:e.feature,fragments:e.fragments}))).enter().append("path").attr("class",e=>
606`${this.getShape(e)} child-fragment feature`).call(ku,this).on("click.expanded",(e,t)=>{t.feature.expanded=!t.feature.expanded,this.refresh()}),r.selectAll("text.child-label").data(e=>e.fragments.map(t=>({...t,feature:e.feature,fragments:e.fragments}))).enter().append("text").attr("class","child-label").attr("dominant-baseline","middle").attr("text-anchor","middle").style("cursor","default").style("pointer-events","none"),oze(this,zqe,Hqe(e),"f"),qqe({baseG:aze(this,zqe,"f"),getResidueShape:e=>this.getResidueShape(e),getResidueTransform:e=>this.getResidueTransform(e),getResidueFill:e=>this.getResidueFill(e,!!e.feature?.expanded),element:this}),null!=(t=aze(this,Fqe,"f"))&&t.length&&(({element:e,coverage:t})=>{e.accession=e?.data?.[0]?.accession||"_";let r=e.svg?.select("defs mask");null!=r&&r.size()||(r=e.svg?.append("defs").append("mask").attr("id",`mask-${e.accession}`)),r?.selectAll("rect").data(t).enter().append("rect").attr("y",0).attr("height",e.height)})({element:this,coverage:aze(this,Fqe,"f")})}null==(r=this.svg)||r.attr("height",(this.layoutObj?.maxYPos||0)+this["margin-bottom"]),oze(this,Lqe,!0,"f")}getResidueShape(e){return this.featureShape.getFeatureShape(this.getSingleBaseWidth(),this.layoutObj?.getFeatureHeight(`${e.accession}_${e.k}_${e.i}_${e.j}`)||0,e.end&&e.start?e.end-e.start+1:1,"rectangle")}getResidueTransform(e){return`translate(${this.getXFromSeqPosition(e.start||1)},${this["margin-top"]+(this.layoutObj?.getFeatureYPos(`${e.accession}_${e.k}_${e.i}_${e.j}`)||0)})`}getResidueFill(e,t){return t?this.getFeatureColor(e):"white"}getTextLabel(e){return this.label?.length?this.label.startsWith(".")?function(e,t,r){var n=null==e?void 0:function(e,t){for(var r=0,n=(t=function(e,t){return NHe(e)?e:function(e,t){if(NHe(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!XHe(e))||KHe.test(e)||!YHe.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:kqe(function(e){return null==e?"":Oqe(e)}(e))}(t,e)).length;null!=e&&r<n;)e=e[Rqe(t[r++])];return r&&r==n?e:void 0}(e,t);return void 0===n?r:n}(e,this.label.slice(1),null):this.label:e?.feature?.accession||null}refreshLabels(e,t=2){e&&e.attr("x",e=>{let t=Kqe(this["display-start"],e.start),r=Zqe(this["display-end"],e.end,this.length);return this.getXFromSeqPosition(t+(r-t)/2||1)}).attr("y",e=>this["margin-top"]+(this.layoutObj?.getFeatureYPos(e.feature)||0)+(this.layoutObj?.getFeatureHeight(e.feature)||0)/2).attr("fill",(e,t,r)=>r[t].parentElement?.querySelector("path.feature")?function(e){return e?function(e){return.2126*e[0]+.7152*e[1]+.0722*e[2]}(e)>=165?"black":"white":"black"}(function(e){if(Xqe[e])return Xqe[e];let t=document.createElement("div");t.style.color=e,document.body.appendChild(t);let r=window.getComputedStyle(t).color;document.body.removeChild(t);let n=(r?.match(/[.\d]+/g))?.map(Number)||null;return Xqe[e]=n,n}(this.getFeatureFillColor(e))):null).attr("font-size",e=>(this.layoutObj?.getFeatureHeight(e.feature)||2)-t).text(e=>this["show-label"]?this.getTextLabel(e):null).each(function(e,t,r,n,i){return function(a){var o;let s=function(e){return"string"==typeof e?new HGe([[document.querySelector(e)]],[document.documentElement]):new HGe([[e]],VGe)}(this),u=Kqe(e,a.start),c=n(Zqe(t,a.end,r))-n(u),l=i(a.feature)/2,d=((o=s.node())?.getComputedTextLength)?.call(o)||0,f=s.text();for(;d>c-2*l&&f.length>0;)f=f.slice(0,-1),s.text(f.length?f+"…":""),d=s.node()?.getComputedTextLength()||0}}(this["display-start"],this["display-end"],this.length,e=>this.getXFromSeqPosition(e),e=>this.layoutObj?.getFeatureHeight(e)||0))}refreshFeatures(e,t=!0){if(!e)return;let r=new Set(e.data().map(e=>e.feature?.accession)).size;e.attr("d",e=>this.featureShape.getFeatureShape(this.getSingleBaseWidth(),this.layoutObj?.getFeatureHeight(e.feature||"")||0,e.end&&e.start?e.end-e.start+1:1,t?this.getShape(e.shape?e:e.feature):"rectangle")).style("fill",e=>t?this.getFeatureColor(e.feature):"white").attr("opacity",t?1:.8/r).style("stroke",e=>t?this.getFeatureColor(e.feature):"none").attr("transform",e=>`translate(${this.getXFromSeqPosition(e.start||1)},${this["margin-top"]+(this.layoutObj?.getFeatureYPos(e.feature)||0)})`).style("pointer-events",t?"auto":"none")}refreshCoverLine(e,t=!0){e&&e.attr("x1",e=>this.getXFromSeqPosition(e.start||1)).attr("x2",e=>this.getXFromSeqPosition((e.end||0)+1)).attr("y1",e=>this["margin-top"]+(this.layoutObj?.getFeatureYPos(e.feature)||0)+(this.layoutObj?.getFeatureHeight(e.feature)||0)/2).attr("y2",e=>this["margin-top"]+(this.layoutObj?.getFeatureYPos(e.feature)||0)+(this.layoutObj?.getFeatureHeight(e.feature)||0)/2).attr("stroke",e=>this.getFeatureColor(e.feature)).attr("visibility",t?"visible":"hidden")}refresh(){var e,t,r;if(aze(this,Lqe,"f")&&this.layoutObj){if(this.layoutObj.expanded=!!this.expanded,this.layoutObj.init(this.data,aze(this,Nqe,"f")),this.height=this.layoutObj.maxYPos,this.refreshCoverLine(aze(this,Uqe,"f")?.selectAll("g.location-group line.cover")),this.refreshFeatures(aze(this,Uqe,"f")?.selectAll("g.location-group path.feature")),this.refreshLabels(aze(this,Uqe,"f")?.selectAll("g.location-group text.feature-label")),aze(this,jqe,"f")&&Wqe({baseG:aze(this,jqe,"f"),expanded:!!this.expanded,getResidueShape:e=>this.getResidueShape(e),getResidueTransform:e=>this.getResidueTransform(e),getResidueFill:e=>this.getResidueFill(e,!!this.expanded)}),aze(this,Nqe,"f")){let r=aze(this,$qe,"f")?.select("g.children-group");r?.attr("visibility",this.expanded?"visible":"hidden");let n=r?.selectAll("g.child-group"),i=n?.selectAll("g.child-location-group"),a=i?.selectAll("line.cover"),o=i?.selectAll("path.child-fragment");this.refreshCoverLine(a,this.expanded),this.refreshFeatures(o,this.expanded),this.refreshLabels(n?.selectAll("g.child-location-group text.child-label"),0),null==(e=aze(this,zqe,"f"))||e.attr("visibility",()=>this.expanded?"visible":"hidden"),aze(this,zqe,"f")&&Wqe({baseG:aze(this,zqe,"f"),expanded:!!this.expanded,getResidueShape:e=>this.getResidueShape(e),getResidueTransform:e=>this.getResidueTransform(e),getResidueFill:e=>this.getResidueFill(e,!!e.feature?.expanded)}),null!=(t=aze(this,Fqe,"f"))&&t.length&&(({element:e,featuresG:t,contributorsLength:r})=>{var n;t?.attr("mask",e.expanded?null:`url(#mask-${e.accession})`),null==(n=e.svg)||n.selectAll("defs mask rect").attr("x",t=>e.getXFromSeqPosition(t.start)).attr("width",t=>e.getSingleBaseWidth()*(t.end-t.start+1)).attr("height",e.height).attr("fill","white").attr("opacity",e=>((e.value||0)/(r||1)+.3)/1.3)})({element:this,featuresG:aze(this,Uqe,"f"),contributorsLength:aze(this,Nqe,"f")?.length})}null==(r=this.svg)||r.attr("height",this.layoutObj.maxYPos+this["margin-bottom"]),this.updateHighlight(),this.renderMarginOnGroup(this.margins)}}};function Kqe(e,t){return Math.max(t||0,e&&e>0?e:0)}function Zqe(e,t,r){return Math.min(t||0,e&&e>0?e:r||0)}
606Nqe=new WeakMap,Fqe=new WeakMap,Lqe=new WeakMap,$qe=new WeakMap,Uqe=new WeakMap,jqe=new WeakMap,zqe=new WeakMap,ize([kze({type:Boolean})],Yqe.prototype,"expanded",void 0),ize([kze({type:Boolean})],Yqe.prototype,"show-label",void 0),ize([kze({type:String})],Yqe.prototype,"label",void 0),Yqe=Gqe=ize([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-interpro-track")],Yqe);var Qqe=Yqe;function Jqe(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function eWe(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var tWe=globalThis,rWe=tWe.ShadowRoot&&(void 0===tWe.ShadyCSS||tWe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nWe=Symbol(),iWe=new WeakMap,aWe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==nWe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(rWe&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=iWe.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&iWe.set(t,e))}return e}toString(){return this.cssText}},oWe=rWe?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new aWe("string"==typeof e?e:e+"",void 0,nWe))(t)})(e):e,{is:sWe,defineProperty:uWe,getOwnPropertyDescriptor:cWe,getOwnPropertyNames:lWe,getOwnPropertySymbols:dWe,getPrototypeOf:fWe}=Object,hWe=globalThis,pWe=hWe.trustedTypes,mWe=pWe?pWe.emptyScript:"",gWe=hWe.reactiveElementPolyfillSupport,vWe=(e,t)=>e,yWe={toAttribute(e,t){switch(t){case Boolean:e=e?mWe:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},bWe=(e,t)=>!sWe(e,t),_We={attribute:!0,type:String,converter:yWe,reflect:!1,hasChanged:bWe};Symbol.metadata??=Symbol("metadata"),hWe.litPropertyMetadata??=new WeakMap;var xWe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_We){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&uWe(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=cWe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_We}static _$Ei(){if(this.hasOwnProperty(vWe("elementProperties")))return;let e=fWe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(vWe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vWe("properties"))){let e=this.properties,t=[...lWe(e),...dWe(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(oWe(e))}else void 0!==e&&t.push(oWe(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
606=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(rWe)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=tWe.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?yWe:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?yWe:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??bWe)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};xWe.elementStyles=[],xWe.shadowRootOptions={mode:"open"},xWe[vWe("elementProperties")]=new Map,xWe[vWe("finalized")]=new Map,gWe?.({ReactiveElement:xWe}),(hWe.reactiveElementVersions??=[]).push("2.0.4");var SWe=globalThis,wWe=SWe.trustedTypes,AWe=wWe?wWe.createPolicy("lit-html",{createHTML:e=>e}):void 0,CWe="$lit$",TWe=`lit$${Math.random().toFixed(9).slice(2)}$`,PWe="?"+TWe,EWe=`<${PWe}>`,MWe=document,kWe=()=>MWe.createComment(""),IWe=e=>null===e||"object"!=typeof e&&"function"!=typeof e,DWe=Array.isArray,OWe="[ \t\n\f\r]",RWe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,BWe=/-->/g,NWe=/>/g,FWe=RegExp(`>|${OWe}(?:([^\\s"'>=/]+)(${OWe}*=${OWe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),LWe=/'/g,$We=/"/g,UWe=/^(?:script|style|textarea|title)$/i,jWe=(e,...t)=>({_$litType$:1,strings:e,values:t}),zWe=Symbol.for("lit-noChange"),GWe=Symbol.for("lit-nothing"),VWe=new WeakMap,HWe=MWe.createTreeWalker(MWe,129);function qWe(e,t){if(!DWe(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===AWe?t:AWe.createHTML(t)}var WWe=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=RWe;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===RWe?"!--"===s[1]?o=BWe:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=FWe):(UWe.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=FWe):o=NWe:o===FWe?">"===s[0]?(o=r??RWe,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?FWe:'"'===s[3]?$We:LWe):o===$We||o===LWe?o=FWe:o===BWe||o===NWe?o=RWe:(o=FWe,r=void 0);let d=o===FWe&&e[t+1].startsWith("/>")?" ":"";a+=o===RWe?u+EWe:c>=0?(i.push(n),u.slice(0,c)+CWe+u.slice(c)+TWe+d):u+TWe+(-2===c?t:d)}return[qWe(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),HWe.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=HWe.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(CWe)){let t=l[o++],r=i.getAttribute(e).split(TWe),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?QWe:"?"===n[1]?JWe:"@"===n[1]?eXe:ZWe}),i.removeAttribute(e)}
606else e.startsWith(TWe)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(UWe.test(i.tagName)){let e=i.textContent.split(TWe),t=e.length-1;if(t>0){i.textContent=wWe?wWe.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],kWe()),HWe.nextNode(),u.push({type:2,index:++a});i.append(e[t],kWe())}}}else if(8===i.nodeType)if(i.data===PWe)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(TWe,e+1));)u.push({type:7,index:a}),e+=TWe.length-1}a++}}static createElement(e,t){let r=MWe.createElement("template");return r.innerHTML=e,r}};function XWe(e,t,r=e,n){if(t===zWe)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=IWe(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=XWe(e,i._$AS(e,t.values),i,n)),t}var YWe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??MWe).importNode(t,!0);HWe.currentNode=n;let i=HWe.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new KWe(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new tXe(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=HWe.nextNode(),a++)}return HWe.currentNode=MWe,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},KWe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=GWe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=XWe(this,e,t),IWe(e)?e===GWe||null==e||""===e?(this._$AH!==GWe&&this._$AR(),this._$AH=GWe):e!==this._$AH&&e!==zWe&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>DWe(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==GWe&&IWe(this._$AH)?this._$AA.nextSibling.data=e:this.T(MWe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=WWe.createElement(qWe(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new YWe(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=VWe.get(e.strings);return void 0===t&&VWe.set(e.strings,t=new WWe(e)),t}k(t){DWe(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(kWe()),this.O(kWe()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},ZWe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=GWe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=GWe}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=XWe(this,e,t,0),a=!IWe(e)||e!==this._$AH&&e!==zWe,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=XWe(this,s[r+n],t,n),o===zWe&&(o=this._$AH[n]),a||=!IWe(o)||o!==this._$AH[n],o===GWe?e=GWe:e!==GWe&&(e+=(o??"")+i[n+1]),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===GWe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},QWe=class extends ZWe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===GWe?void 0:e}},JWe=class extends ZWe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==GWe)}},eXe=class extends ZWe{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}
606_$AI(e,t=this){if((e=XWe(this,e,t,0)??GWe)===zWe)return;let r=this._$AH,n=e===GWe&&r!==GWe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==GWe&&(r===GWe||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},tXe=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){XWe(this,e)}},rXe=SWe.litHtmlPolyfillSupport;rXe?.(WWe,KWe),(SWe.litHtmlVersions??=[]).push("3.2.1");var nXe=class extends xWe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new KWe(t.insertBefore(kWe(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return zWe}};nXe._$litElement$=!0,nXe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:nXe});var iXe=globalThis.litElementPolyfillSupport;iXe?.({LitElement:nXe}),(globalThis.litElementVersions??=[]).push("4.1.1");var aXe={attribute:!0,type:String,converter:yWe,reflect:!1,hasChanged:bWe},oXe=(e=aXe,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function sXe(e){return(t,r)=>"object"==typeof r?oXe(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function uXe(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function cXe(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function lXe(e){let t,r,n;function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===uXe||e===cXe?e:dXe,r=e,n=e):(t=uXe,r=(t,r)=>uXe(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function dXe(){return 0}var fXe=lXe(uXe).right;lXe(function(e){return null===e?NaN:+e}).center;var hXe=class extends Map{constructor(e,t=mXe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(let[t,r]of e)this.set(t,r)}get(e){return super.get(pXe(this,e))}has(e){return super.has(pXe(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}(this,e))}};function pXe({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function mXe(e){return"object"==typeof e&&e?e.valueOf():e}var gXe=Math.sqrt(50),vXe=Math.sqrt(10),yXe=Math.sqrt(2);function bXe(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=gXe?10:u>=vXe?5:u>=yXe?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?bXe(e,t,2*r):[n,i,a]}function _Xe(e,t,r){return bXe(e=+e,t=+t,r=+r)[2]}function xXe(e){return e}var SXe=1e-6;function wXe(e){return"translate("+e+",0)"}function AXe(e){return"translate(0,"+e+")"}function CXe(e){return t=>+e(t)}function TXe(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function PXe(){return!this.__axis}function EXe(e,t){var r=[],n=null,i=null,a=6,o=6,s=3,u=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=1===e||4===e?-1:1,l=4===e||2===e?"x":"y",d=1===e||3===e?wXe:AXe;function f(f){var h=n??(t.ticks?t.ticks.apply(t,r):t.domain()),p=i??(t.tickFormat?t.tickFormat.apply(t,r):xXe),m=Math.max(a,0)+s,g=t.range(),v=+g[0]+u,y=+g[g.length-1]+u,b=(t.bandwidth?TXe:CXe)(t.copy(),u),_=f.selection?f.selection():f,x=_.selectAll(".domain").data([null]),S=_.selectAll(".tick").data(h,t).order(),w=S.exit(),A=S.enter().append("g").attr("class","tick"),C=S.select("line"),T=S.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge
vendor: 15,638 bytes, line 606
606(A),C=C.merge(A.append("line").attr("stroke","currentColor").attr(l+"2",c*a)),T=T.merge(A.append("text").attr("fill","currentColor").attr(l,c*m).attr("dy",1===e?"0em":3===e?"0.71em":"0.32em")),f!==_&&(x=x.transition(f),S=S.transition(f),C=C.transition(f),T=T.transition(f),w=w.transition(f).attr("opacity",SXe).attr("transform",function(e){return isFinite(e=b(e))?d(e+u):this.getAttribute("transform")}),A.attr("opacity",SXe).attr("transform",function(e){var t=this.parentNode.__axis;return d((t&&isFinite(t=t(e))?t:b(e))+u)})),w.remove(),x.attr("d",4===e||2===e?o?"M"+c*o+","+v+"H"+u+"V"+y+"H"+c*o:"M"+u+","+v+"V"+y:o?"M"+v+","+c*o+"V"+u+"H"+y+"V"+c*o:"M"+v+","+u+"H"+y),S.attr("opacity",1).attr("transform",function(e){return d(b(e)+u)}),C.attr(l+"2",c*a),T.attr(l,c*m).text(p),_.filter(PXe).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===e?"start":4===e?"end":"middle"),_.each(function(){this.__axis=b})}return f.scale=function(e){return arguments.length?(t=e,f):t},f.ticks=function(){return r=Array.from(arguments),f},f.tickArguments=function(e){return arguments.length?(r=null==e?[]:Array.from(e),f):r.slice()},f.tickValues=function(e){return arguments.length?(n=null==e?null:Array.from(e),f):n&&n.slice()},f.tickFormat=function(e){return arguments.length?(i=e,f):i},f.tickSize=function(e){return arguments.length?(a=o=+e,f):a},f.tickSizeInner=function(e){return arguments.length?(a=+e,f):a},f.tickSizeOuter=function(e){return arguments.length?(o=+e,f):o},f.tickPadding=function(e){return arguments.length?(s=+e,f):s},f.offset=function(e){return arguments.length?(u=+e,f):u},f}var MXe={value:()=>{}};function kXe(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new IXe(n)}function IXe(e){this._=e}function DXe(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function OXe(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=MXe,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}IXe.prototype=kXe.prototype={constructor:IXe,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=OXe(i[r],e.name,t);else if(null==t)for(r in i)i[r]=OXe(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=DXe(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new IXe(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var RXe="http://www.w3.org/1999/xhtml",BXe={svg:"http://www.w3.org/2000/svg",xhtml:RXe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function NXe(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),BXe.hasOwnProperty(t)?{space:BXe[t],local:e}:e}function FXe(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===RXe&&t.documentElement.namespaceURI===RXe?t.createElement(e):t.createElementNS(r,e)}}function LXe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $Xe(e){var t=NXe(e);return(t.local?LXe:FXe)(t)}function UXe(){}function jXe(e){return null==e?UXe:function(){return this.querySelector(e)}}function zXe(){return[]}function GXe(e){return null==e?zXe:function(){return this.querySelectorAll(e)}}function VXe(e){return function(){return this.matches(e)}}function HXe(e){return function(t){return t.matches(e)}}var qXe=Array.prototype.find;function WXe(){return this.firstElementChild}var XXe=Array.prototype.filter;function YXe(){return Array.from(this.children)}function KXe(e){return Array(e.length)}function ZXe(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function QXe(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new ZXe(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function JXe(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new ZXe(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function eYe(e){return e.__data__}function tYe(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function rYe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nYe(e){return function(){this.removeAttribute(e)}}function iYe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aYe(e,t){return function(){this.setAttribute(e,t)}}function oYe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sYe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function uYe(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function cYe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lYe(e){return function(){this.style.removeProperty(e)}}function dYe(e,t,r){return function(){this.style.setProperty(e,t,r)}}function fYe(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function hYe(e,t){return e.style.getPropertyValue(t)||cYe(e).getComputedStyle(e,null).getPropertyValue(t)}function pYe(e){return function(){delete this[e]}}function mYe(e,t){return function(){this[e]=t}}function gYe(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function vYe(e){return e.trim().split(/^|\s+/)}function yYe(e){return e.classList||new bYe(e)}function bYe(e){this._node=e,this._names=vYe(e.getAttribute("class")||"")}function _Ye(e,t){for(var r=yYe(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function xYe(e,t){for(var r=yYe(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function SYe(e){return function(){_Ye(this,e)}}function wYe(e){return function(){xYe(this,e)}}function AYe(e,t){return function(){(t.apply(this,arguments)?_Ye:xYe)(this,e)}}function CYe(){this.textContent=""}function TYe(e){return function(){this.textContent=e}}function PYe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function EYe(){this.innerHTML=""}function MYe(e){return function(){this.innerHTML=e}}function kYe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function IYe(){this.nextSibling&&this.parentNode.appendChild(this)}function DYe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function OYe(){return null}function RYe(){var e=this.parentNode;e&&e.removeChild(this)}function BYe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function NYe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function FYe(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function LYe(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function $Ye(e,t,r){var n=cYe(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function UYe(e,t){return function(){return $Ye(this,e,t)}}function jYe(e,t){return function(){return $Ye(this,e,t.apply(this,arguments))}}ZXe.prototype={constructor:ZXe,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},bYe.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var zYe=[null];function GYe(e,t){this._groups=e,this._parents=t}function VYe(){return new GYe([[document.documentElement]],zYe)}function HYe(e){return"string"==typeof e?new GYe([[document.querySelector(e)]],[document.documentElement]):new GYe([[e]],zYe)}function qYe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function WYe(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function XYe(){}GYe.prototype=VYe.prototype={constructor:GYe,select:function(e){"function"!=typeof e&&(e=jXe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new GYe(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):GXe(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new GYe(n,i)},selectChild:function(e){return this.select(null==e?WXe:function(e){return function(){return qXe.call(this.children,e)}}("function"==typeof e?e:HXe(e)))},selectChildren:function(e){return this.selectAll(null==e?YXe:function(e){return function(){return XXe.call(this.children,e)}}("function"==typeof e?e:HXe(e)))},filter:function(e){"function"!=typeof e&&(e=VXe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new GYe(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,eYe);var r=t?JXe:QXe,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;++c){var l=n[c],d=i[c],f=d.length,h=tYe(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new GYe(o,n))._enter=s,o._exit=u,o},enter:function(){return new GYe(this._enter||this._groups.map(KXe),this._parents)},exit:function(){return new GYe(this._exit||this._groups.map(KXe),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new GYe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=rYe;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new GYe(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=NXe(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?iYe:nYe:"function"==typeof t?r.local?uYe:sYe:r.local?oYe:aYe)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?lYe:"function"==typeof t?fYe:dYe)(e,t,r??"")):hYe(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?pYe:"function"==typeof t?gYe:mYe)(e,t)):this.node()[e]},classed:function(e,t){var r=vYe(e+"");if(arguments.length<2){for(var n=yYe(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?AYe:t?SYe:wYe)(r,t))},text:function(e){return arguments.length?this.each(null==e?CYe:("function"==typeof e?PYe:TYe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?EYe:("function"==typeof e?kYe:MYe)(e)):this.node().innerHTML},raise:function(){return this.each(IYe)},lower:function(){return this.each(DYe)},append:function(e){var t="function"==typeof e?e:$Xe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:$Xe(e),n=null==t?OYe:"function"==typeof t?t:jXe(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(RYe)},clone:function(e){return this.select(e?NYe:BYe)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?LYe:FYe,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?jYe:UYe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var YYe=.7,KYe=1/YYe,ZYe="\\s*([+-]?\\d+)\\s*",QYe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",JYe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",eKe=/^#([0-9a-f]{3,8})$/,tKe=RegExp(`^rgb\\(${ZYe},${ZYe},${ZYe}\\)$`),rKe=RegExp(`^rgb\\(${JYe},${JYe},${JYe}
606\\)$`),nKe=RegExp(`^rgba\\(${ZYe},${ZYe},${ZYe},${QYe}\\)$`),iKe=RegExp(`^rgba\\(${JYe},${JYe},${JYe},${QYe}\\)$`),aKe=RegExp(`^hsl\\(${QYe},${JYe},${JYe}\\)$`),oKe=RegExp(`^hsla\\(${QYe},${JYe},${JYe},${QYe}\\)$`),sKe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function uKe(){return this.rgb().formatHex()}function cKe(){return this.rgb().formatRgb()}function lKe(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=eKe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?dKe(t):3===r?new pKe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?fKe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?fKe(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=tKe.exec(e))?new pKe(t[1],t[2],t[3],1):(t=rKe.exec(e))?new pKe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=nKe.exec(e))?fKe(t[1],t[2],t[3],t[4]):(t=iKe.exec(e))?fKe(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=aKe.exec(e))?_Ke(t[1],t[2]/100,t[3]/100,1):(t=oKe.exec(e))?_Ke(t[1],t[2]/100,t[3]/100,t[4]):sKe.hasOwnProperty(e)?dKe(sKe[e]):"transparent"===e?new pKe(NaN,NaN,NaN,0):null}function dKe(e){return new pKe(e>>16&255,e>>8&255,255&e,1)}function fKe(e,t,r,n){return n<=0&&(e=t=r=NaN),new pKe(e,t,r,n)}function hKe(e,t,r,n){return 1===arguments.length?function(e){return e instanceof XYe||(e=lKe(e)),e?new pKe((e=e.rgb()).r,e.g,e.b,e.opacity):new pKe}(e):new pKe(e,t,r,n??1)}function pKe(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function mKe(){return`#${bKe(this.r)}${bKe(this.g)}${bKe(this.b)}`}function gKe(){let e=vKe(this.opacity);return`${1===e?"rgb(":"rgba("}${yKe(this.r)}, ${yKe(this.g)}, ${yKe(this.b)}${1===e?")":`, ${e})`}`}function vKe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yKe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bKe(e){return((e=yKe(e))<16?"0":"")+e.toString(16)}function _Ke(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new SKe(e,t,r,n)}function xKe(e){if(e instanceof SKe)return new SKe(e.h,e.s,e.l,e.opacity);if(e instanceof XYe||(e=lKe(e)),!e)return new SKe;if(e instanceof SKe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new SKe(o,s,u,e.opacity)}function SKe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function wKe(e){return(e=(e||0)%360)<0?e+360:e}function AKe(e){return Math.max(0,Math.min(1,e||0))}function CKe(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}qYe(XYe,lKe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:uKe,formatHex:uKe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return xKe(this).formatHsl()},formatRgb:cKe,toString:cKe}),qYe(pKe,hKe,WYe(XYe,{brighter(e){return e=null==e?KYe:KYe**+e,new pKe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?YYe:YYe**+e,new pKe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pKe(yKe(this.r),yKe(this.g),yKe(this.b),vKe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mKe,formatHex:mKe,formatHex8:function(){return`#${bKe(this.r)}${bKe(this.g)}${bKe(this.b)}${bKe(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:gKe,toString:gKe})),qYe(SKe,function(e,t,r,n){return 1===arguments.length?xKe(e):new SKe(e,t,r,n??1)},WYe(XYe,{brighter(e){return e=null==e?KYe:KYe**+e,new SKe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?YYe:YYe**+e,new SKe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new pKe(CKe(e>=240?e-240:e+120,i,n),CKe(e,i,n),CKe(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new SKe(wKe(this.h),AKe(this.s),AKe(this.l),vKe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=vKe(this.opacity);return`${1===e?"hsl(":"hsla("}${wKe(this.h)}, ${100*AKe(this.s)}%, ${100*AKe(this.l)}%${1===e?")":`, ${e})`}`}}));var TKe=e=>()=>e;function PKe(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):TKe(isNaN(e)?t:e)}var EKe=function e(t){var r=function(e){return 1==(e=+e)?PKe:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):TKe(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=hKe(e)).r,(t=hKe(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=PKe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function MKe(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function kKe(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=FKe(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function IKe(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function DKe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function OKe(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=FKe(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}var RKe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,BKe=new RegExp(RKe.source,"g");function NKe(e,t){var r,n,i,a=RKe.lastIndex=BKe.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=RKe.exec(e))&&(n=BKe.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:DKe(r,n)})),a=BKe.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function FKe(e,t){var r,n=typeof t;return null==t||"boolean"===n?TKe(t):("number"===n?DKe:"string"===n?(r=lKe(t))?(t=r,EKe):NKe:t instanceof lKe?EKe:t instanceof Date?IKe:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?MKe:Array.isArray(t)?kKe:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?OKe:DKe)(e,t)}function LKe(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var $Ke,UKe=180/Math.PI,jKe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zKe(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*UKe,skewX:Math.atan(u)*UKe,scaleX:o,scaleY:s}}function GKe(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];
606return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:DKe(e,i)},{i:u-2,x:DKe(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:DKe(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:DKe(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:DKe(e,r)},{i:s-2,x:DKe(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var VKe,HKe,qKe=GKe(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?jKe:zKe(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),WKe=GKe(function(e){return null==e?jKe:($Ke||=document.createElementNS("http://www.w3.org/2000/svg","g"),$Ke.setAttribute("transform",e),(e=$Ke.transform.baseVal.consolidate())?zKe((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):jKe)},", ",")",")"),XKe=0,YKe=0,KKe=0,ZKe=0,QKe=0,JKe=0,eZe="object"==typeof performance&&performance.now?performance:Date,tZe="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rZe(){return QKe||=(tZe(nZe),eZe.now()+JKe)}function nZe(){QKe=0}function iZe(){this._call=this._time=this._next=null}function aZe(e,t,r){var n=new iZe;return n.restart(e,t,r),n}function oZe(){QKe=(ZKe=eZe.now())+JKe,XKe=YKe=0;try{!function(){rZe(),++XKe;for(var e,t=VKe;t;)(e=QKe-t._time)>=0&&t._call.call(void 0,e),t=t._next;--XKe}()}finally{XKe=0,function(){for(var e,t,r=VKe,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:VKe=t);HKe=e,uZe(n)}(),QKe=0}}function sZe(){var e=eZe.now(),t=e-ZKe;t>1e3&&(JKe-=t,ZKe=e)}function uZe(e){XKe||(YKe&&=clearTimeout(YKe),e-QKe>24?(e<1/0&&(YKe=setTimeout(oZe,e-eZe.now()-JKe)),KKe&&=clearInterval(KKe)):(KKe||=(ZKe=eZe.now(),setInterval(sZe,1e3)),XKe=1,tZe(oZe)))}function cZe(e,t,r){var n=new iZe;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}iZe.prototype=aZe.prototype={constructor:iZe,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?rZe():+r)+(null==t?0:+t),this._next||HKe===this||(HKe?HKe._next=this:VKe=this,HKe=this),this._call=e,this._time=r,uZe()},stop:function(){this._call&&(this._call=null,this._time=1/0,uZe())}};var lZe=kXe("start","end","cancel","interrupt"),dZe=[];function fZe(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return cZe(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(cZe(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
606),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=aZe(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:lZe,tween:dZe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function hZe(e,t){var r=mZe(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function pZe(e,t){var r=mZe(e,t);if(r.state>3)throw Error("too late; already running");return r}function mZe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function gZe(e,t){var r,n;return function(){var i=pZe(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function vZe(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=pZe(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function yZe(e,t,r){var n=e._id;return e.each(function(){var e=pZe(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return mZe(e,n).value[t]}}function bZe(e,t){var r;return("number"==typeof t?DKe:t instanceof lKe?EKe:(r=lKe(t))?(t=r,EKe):NKe)(e,t)}function _Ze(e){return function(){this.removeAttribute(e)}}function xZe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function SZe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function wZe(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function AZe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function CZe(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function TZe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function PZe(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function EZe(e,t){return function(){hZe(this,e).delay=+t.apply(this,arguments)}}function MZe(e,t){return t=+t,function(){hZe(this,e).delay=t}}function kZe(e,t){return function(){pZe(this,e).duration=+t.apply(this,arguments)}}function IZe(e,t){return t=+t,function(){pZe(this,e).duration=t}}var DZe=VYe.prototype.constructor;function OZe(e){return function(){this.style.removeProperty(e)}}var RZe=0;function BZe(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function NZe(){return++RZe}var FZe=VYe.prototype;BZe.prototype={constructor:BZe,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=jXe(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,fZe(d[f],t,r,f,d,mZe(s,r)));return new BZe(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=GXe(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=mZe(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&fZe(f,t,r,m,h,p);a.push(h),o.push(u)}return new BZe(a,o,t,r)},selectChild:FZe.selectChild,selectChildren:FZe.selectChildren,filter:function(e){"function"!=typeof e&&(e=VXe(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new BZe(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new BZe(o,this._parents,this._name,this._id)},selection:function(){return new DZe(this._groups,this._parents)}
vendor: 4,303 bytes, line 606
606,transition:function(){for(var e=this._name,t=this._id,r=NZe(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=mZe(o,t);fZe(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new BZe(n,this._parents,e,r)},call:FZe.call,nodes:FZe.nodes,node:FZe.node,size:FZe.size,empty:FZe.empty,each:FZe.each,on:function(e,t){var r=this._id;return arguments.length<2?mZe(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?hZe:pZe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=NXe(e),n="transform"===r?WKe:bZe;return this.attrTween(e,"function"==typeof t?(r.local?CZe:AZe)(r,n,yZe(this,"attr."+e,t)):null==t?(r.local?xZe:_Ze)(r):(r.local?wZe:SZe)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=NXe(e);return this.tween(r,(n.local?TZe:PZe)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?qKe:bZe;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=hYe(this,e),o=(this.style.removeProperty(e),hYe(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,OZe(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=hYe(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=hYe(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,yZe(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=pZe(this,e),c=u.on,l=null==u.value[o]?a||=OZe(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=hYe(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(yZe(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=mZe(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?gZe:vZe)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?EZe:MZe)(t,e)):mZe(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?kZe:IZe)(t,e)):mZe(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){pZe(this,e).ease=t}}(t,e)):mZe(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();pZe(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=pZe(this,n),i=r.on;
606i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:FZe[Symbol.iterator]};var LZe={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function $Ze(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}function UZe(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function jZe(e){return(e=UZe(Math.abs(e)))?e[1]:NaN}VYe.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},VYe.prototype.transition=function(e){var t,r;e instanceof BZe?(t=e._id,e=e._name):(t=NZe(),(r=LZe).time=rZe(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&fZe(o,e,t,c,s,r||$Ze(o,t));return new BZe(n,this._parents,e,t)};var zZe,GZe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function VZe(e){if(!(t=GZe.exec(e)))throw Error("invalid format: "+e);var t;return new HZe({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function HZe(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function qZe(e,t){var r=UZe(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}VZe.prototype=HZe.prototype,HZe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var WZe={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>qZe(100*e,t),r:qZe,s:function(e,t){var r=UZe(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(zZe=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+UZe(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function XZe(e){return e}var YZe,KZe,ZZe,QZe=Array.prototype.map,JZe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function eQe(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}YZe=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?XZe:(t=QZe.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?XZe:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(QZe.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=VZe(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):WZe[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");
606var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=WZe[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?JZe[8+zZe/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=VZe(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(jZe(t)/3))),i=10**-n,a=JZe[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),KZe=YZe.format,ZZe=YZe.formatPrefix;var tQe=Symbol("implicit");function rQe(){var e=new hXe,t=[],r=[],n=tQe;function i(i){let a=e.get(i);if(void 0===a){if(n!==tQe)return n;e.set(i,a=t.push(i)-1)}return r[a%r.length]}return i.domain=function(r){if(!arguments.length)return t.slice();t=[],e=new hXe;for(let n of r)e.has(n)||e.set(n,t.push(n)-1);return i},i.range=function(e){return arguments.length?(r=Array.from(e),i):r.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return rQe(t,r).unknown(n)},eQe.apply(i,arguments),i}function nQe(){var e,t,r=rQe().unknown(void 0),n=r.domain,i=r.range,a=0,o=1,s=!1,u=0,c=0,l=.5;function d(){var r=n().length,d=o<a,f=d?o:a,h=d?a:o;e=(h-f)/Math.max(1,r-u+2*c),s&&(e=Math.floor(e)),f+=(h-f-e*(r-u))*l,t=e*(1-u),s&&(f=Math.round(f),t=Math.round(t));var p=function(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((t-e)/r)),a=Array(i);++n<i;)a[n]=e+n*r;return a}(r).map(function(t){return f+e*t});return i(d?p.reverse():p)}return delete r.unknown,r.domain=function(e){return arguments.length?(n(e),d()):n()},r.range=function(e){return arguments.length?([a,o]=e,a=+a,o=+o,d()):[a,o]},r.rangeRound=function(e){return[a,o]=e,a=+a,o=+o,s=!0,d()},r.bandwidth=function(){return t},r.step=function(){return e},r.round=function(e){return arguments.length?(s=!!e,d()):s},r.padding=function(e){return arguments.length?(u=Math.min(1,c=+e),d()):u},r.paddingInner=function(e){return arguments.length?(u=Math.min(1,e),d()):u},r.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},r.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),d()):l},r.copy=function(){return nQe(n(),[a,o]).round(s).paddingInner(u).paddingOuter(c).align(l)},eQe.apply(d(),arguments)}function iQe(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return iQe(t())},e}function aQe(){return iQe(nQe.apply(null,arguments).paddingInner(1))}function oQe(e){return+e}var sQe,uQe,cQe,lQe,dQe,fQe,hQe,pQe=[0,1];function mQe(e){return e}function gQe(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function vQe(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=gQe(i,n),a=r(o,a)):(n=gQe(n,i),a=r(a,o)),function(e){return a(n(e))}}function yQe(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=gQe(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=fXe(e,t,1,n)-1;return a[r](i[r](t))}}function bQe(e){return function(t){return t<0?-((-t)**+e):t**+e}}function _Qe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function xQe(e){return e<0?-e*e:e*e}function SQe(){var e=function(e){var t=e(mQe,mQe),r=1;return t.exponent=function(t){return arguments.length?1==(r=+t)?e(mQe,mQe):.5===r?e(_Qe,xQe):e(bQe(r),bQe(1/r)):r},function(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];
606if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?bXe(t,e,r):bXe(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return function(e,t,r,n){var i,a=function(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?_Xe(t,e,r):_Xe(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}(e,t,r);switch((n=VZe(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(jZe(t)/3)))-jZe(Math.abs(e)))}(a,o))||(n.precision=i),ZZe(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,jZe(t)-jZe(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-jZe(Math.abs(e)))}(a))||(n.precision=i-2*("%"===n.type))}return KZe(n)}(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=_Xe(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}(t)}(function(){var e,t,r,n,i,a,o=pQe,s=pQe,u=FKe,c=mQe;function l(){var e=Math.min(o.length,s.length);return c!==mQe&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?yQe:vQe,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),DKe))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,oQe),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=LKe,l()},d.clamp=function(e){return arguments.length?(c=!!e||mQe,l()):c!==mQe},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}());return e.copy=function(){return(t=e,r=SQe(),r.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())).exponent(e.exponent());var t,r},eQe.apply(e,arguments),e}function wQe(e,t,r){this.k=e,this.x=t,this.y=r}wQe.prototype={constructor:wQe,scale:function(e){return 1===e?this:new wQe(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new wQe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},wQe.prototype;var AQe=class{constructor(){this._frequency=SQe().exponent(.001).domain([0,1]).range([5,10]),this.drawVariationPlot=this.drawVariationPlot.bind(this)}drawVariationPlot(e,t){let r=t.getSingleBaseWidth()/2;e.each((e,n,i)=>{let a=HYe(i[n]),o=e.filter(e=>0!==e.variants.length),s=a.selectAll("g").data(o,e=>e.pos);s.exit().remove();let u=s.enter().append("g").merge(s).selectAll("circle").data(e=>e.variants);u.exit().remove(),u.enter().append("circle").merge(u).attr("class","feature").attr("title",e=>e.start).attr("r",e=>e.size?e.size:5).attr("cx",e=>t.getXFromSeqPosition(e.start)+r).attr("cy",e=>t.yScale?.call(t,e.variant.charAt(0))||0).attr("name",e=>{let t="*"===e.alternativeSequence?"STOP":e.alternativeSequence;return e.internalId=`var_${e.wildType}${e.start}${t}`,e.internalId}).attr("fill",e=>e.color?e.color:t.colorConfig(e)).call(ku,t)})}};(function(e){e.A="A",e.C="C",e.D="D",e.E="E",e.Empty="*",e.F="F",e.G="G",e.H="H",e.I="I",e.K="K",e.L="L",e.M="M",e.N="N",e.Nl="NL",e.P="P",e.Q="Q",e.R="R",e.S="S",e.T="T",e.V="V",e.W="W",e.Y="Y"})(sQe||={}),function(e){e.CLINVAR="ClinVar",e.ESP="ESP",e.EXAC="ExAC",e.GENOMES1K="1000Genomes",e.BOVINE_SNP50="BovineSNP50",e.BOVINE_LD="BovineLD",e.BOVINE_HD="BovineHD",e.EQUINE_SNP50="EquineSNP50",e.CHICKEN_600K="Chicken600K",e.KG_HQ="1kg_hq",e.COSMIC="cosmic curated",e.REVIEWED="reviewed",e.UNIPROT="UniProt",e.DBSNP="dbSNP",e.ENSEMBL="Ensembl",e.ENSEMBL_PLANTS="EnsemblPlants",e.VECTORBASE="VectorBase",e.REFSEQ="RefSeq",e.DBGAP="dbGaP",e.DDD="DDD",e.PHARMCOGKB="PharmGKB",e.ENSEMBL_FUNGI="EnsemblFungi",e.ENSEMBL_METAZOA="EnsemblMetazoa",e.GNOMAD_V2="gnomAD_v2.0",e.GNOMAD_V3="gnomAD_v3.0",e.TCGA="NCI-TCGA",e.TCGA_COSMIC="NCI-TCGA Cosmic",e.DECIPHER="ddG2P",e.TOPMED="TOPMed",e.GNOMAD="gn
606omAD",e.PHARMGKB="pharmgkb",e.SGRP="SGRP",e.SGD="SGD",e.JEFFARES_SNPS="Jeffares_SNPs",e.JEFFARES_INDELS="Jeffares_Indels",e.ENSEMBL_VIRUSES="EnsemblViruses"}(uQe||={}),function(e){e.Benign="Benign",e.Disease="Disease",e.LikelyBenign="Likely benign",e.LikelyPathogenic="Likely pathogenic",e.Pathogenic="Pathogenic",e.Protective="Protective",e.VariantOfUncertainSignificance="Variant of uncertain significance"}(cQe||={}),function(e){e.Empty="-",e.Frameshift="frameshift",e.InframeDeletion="inframe deletion",e.Insertion="insertion",e.Missense="missense",e.StopGained="stop gained"}(lQe||={}),function(e){e.PolyPhen="PolyPhen",e.Sift="SIFT"}(dQe||={}),function(e){e.Benign="benign",e.Deleterious="deleterious",e.DeleteriousLowConfidence="deleterious - low confidence",e.PossiblyDamaging="possibly damaging",e.ProbablyDamaging="probably damaging",e.Tolerated="tolerated",e.ToleratedLowConfidence="tolerated - low confidence",e.Unknown="unknown"}(fQe||={}),function(e){e.LargeScaleStudy="large_scale_study",e.Mixed="mixed",e.UniProt="uniprot"}(hQe||={});var CQe,TQe,PQe=(e,t)=>{let r=e?e.map(e=>e.name):[];return"uniprot"!==t&&"mixed"!==t||r.push("uniprot"),r},EQe=["G","A","V","L","I","S","T","C","M","D","N","E","Q","R","K","H","F","Y","W","P","d","*"],MQe=TQe=class extends(bu(Pu(_c))){constructor(){super(),this.proteinAPI=!1,this.condensedView=!1,CQe.set(this,void 0),this.colorConfig=e=>"pink",this["margin-top"]=10,this["margin-bottom"]=10}connectedCallback(){super.connectedCallback(),this.yScale=aQe().domain(EQe).range([0,this.height-this["margin-top"]-this["margin-bottom"]])}processData(e){!function(e,t,r){if("function"==typeof t||!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,r)}(this,CQe,e);let t=this.proteinAPI?(e=>{let{sequence:t,features:r}=e,n=r.map(e=>({...e,accession:0===(e.genomicLocation||[]).length?String(Math.random()):(e.genomicLocation||[])[0],variant:e.alternativeSequence?e.alternativeSequence:sQe.Empty,start:Number(e.begin),xrefNames:PQe(e.xrefs,e.sourceType),hasPredictions:e.predictions&&e.predictions.length>0,consequenceType:e.consequenceType}));return n?{sequence:t,variants:n}:null})(e):e;t&&(this.processedData=function(e){let{variants:t,sequence:r}=e||{};if(!r||!t)return null;let n={},i=r.split("").map((e,t)=>({type:"VARIANT",normal:e,pos:t+1,variants:[]}));return t.forEach(e=>{i[e.start-1]&&(i[e.start-1].variants.push(e),n[e.variant||""]=!0)}),{mutationArray:i,aaPresence:n}}(t))}set data(e){eWe(this,CQe,"f")!==e&&(this.processData(e),this.createFeatures())}get data(){return eWe(this,CQe,"f")}static get css(){return"\n    <style>\n    nightingale-variation {\n      display: flex;\n      width: 100%;\n    }\n\n    nightingale-variation svg {\n      background-color: #fff;\n    }\n\n    nightingale-variation circle {\n      opacity: 0.6;\n    }\n    nightingale-variation circle:hover {\n      opacity: 1;\n    }\n    nightingale-variation .tick line,\n    nightingale-variation .axis path {\n      opacity: 0.1;\n      pointer-events: none;\n    }\n\n    nightingale-highlight {\n      fill: #ffe999;\n    }\n\n    nightingale-variation .variation-y-right line,\n    nightingale-variation .axis path {\n      fill: none;\n      stroke: none;\n    }\n\n    </style>\n    "}createFeatures(){if(this.svg=HYe(this).selectAll("svg").attr("id","").attr("width",this.width).attr("height",this.height),!this.processedData)return;this.variationPlot=new AQe;let e=this.svg.select("g.sequence-features").attr("transform",`translate(0, ${this["margin-top"]})`),t=e.select("g.points");t.empty()&&(t=e.append("g").attr("class","points"),this.axisLeft=e.append("g"),this.axisRight=e.append("g")),this.series=t.datum(this.processedData.mutationArray),this.updateScale()}firstUpdated(){this.createFeatures(),this.createHighlightGroup()}zoomRefreshed(){this.series&&(this.updateScale(),this.variationPlot&&this.series.call(this.variationPlot.drawVariationPlot,this),this.updateHighlight())}updateScale(){var e,t,r,n;if(this.yScale){let i=EQe.filter(e=>!this.condensedView||this.processedData?.aaPresence[e]);this.rowHeight&&(this.height=i.length*this.rowHeight+this["margin-top"]+this["margin-bottom"]),this.yScale.range([0,this.height-this["margin-top"]-this["margin-bottom"]]).domain(i),null==(e=this.svg)||e.attr("width",this.width).attr("height",this.height);let a=(n=this.yScale,EXe(4,n)).tickSize(-this.getWidthWithMargins());null==(t=this.axisLeft)||t.attr("class","variation-y-left axis").attr("transform",`translate(${this["margin-left"]},0)`).call(a);let o=function(e){return EXe(2,e)}(this.yScale);null==(r=this.axisRight)||r.attr("transform",`translate(${this.getWidthWithMargins()-this["margin-right"]+2}, 0)`).attr("class","variation-y-right axis").call(o)}}updateData(e){this.series&&this.series.datum(e)}render(){return jWe`<style>
607        ${TQe.css}
608      </style>
609      <svg class="container">
610        <g class="sequence-features" />
611      </svg>`}};CQe=new WeakMap,Jqe([sXe({type:Boolean,attribute:"protein-api"})],MQe.prototype,"proteinAPI",void 0),Jqe([sXe({type:Boolean,attribute:"condensed-view"})],MQe.prototype,"condensedView",void 0),Jqe([sXe({type:Number,attribute:"row-height"})],MQe.prototype,"rowHeight",void 0),Jqe([sXe({state:!0,attribute:!1})],MQe.prototype,"colorConfig",void 0),MQe=TQe=Jqe([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-variation")],MQe);var kQe=MQe,IQe=globalThis,DQe=IQe.ShadowRoot&&(void 0===IQe.ShadyCSS||IQe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,OQe=Symbol(),RQe=new WeakMap,BQe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==OQe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(DQe&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=RQe.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&RQe.set(t,e))}return e}toString(){return this.cssText}},NQe=DQe?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new BQe("string"==typeof e?e:e+"",void 0,OQe))(t)})(e):e,{is:FQe,defineProperty:LQe,getOwnPropertyDescriptor:$Qe,getOwnPropertyNames:UQe,getOwnPropertySymbols:jQe,getPrototypeOf:zQe}=Object,GQe=globalThis,VQe=GQe.trustedTypes,HQe=VQe?VQe.emptyScript:"",qQe=GQe.reactiveElementPolyfillSupport,WQe=(e,t)=>e,XQe={toAttribute(e,t){switch(t){case Boolean:e=e?HQe:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},YQe=(e,t)=>!FQe(e,t),KQe={attribute:!0,type:String,converter:XQe,reflect:!1,hasChanged:YQe};Symbol.metadata??=Symbol("metadata"),GQe.litPropertyMetadata??=new WeakMap;var ZQe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=KQe){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&LQe(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=$Qe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??KQe}static _$Ei(){if(this.hasOwnProperty(WQe("elementProperties")))return;let e=zQe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(WQe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(WQe("properties"))){let e=this.properties,t=[...UQe(e),...jQe(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(NQe(e))}else void 0!==e&&t.push(NQe(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
611=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(DQe)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=IQe.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?XQe:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?XQe:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??YQe)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};ZQe.elementStyles=[],ZQe.shadowRootOptions={mode:"open"},ZQe[WQe("elementProperties")]=new Map,ZQe[WQe("finalized")]=new Map,qQe?.({ReactiveElement:ZQe}),(GQe.reactiveElementVersions??=[]).push("2.0.4");var QQe=globalThis,JQe=QQe.trustedTypes,eJe=JQe?JQe.createPolicy("lit-html",{createHTML:e=>e}):void 0,tJe="$lit$",rJe=`lit$${Math.random().toFixed(9).slice(2)}$`,nJe="?"+rJe,iJe=`<${nJe}>`,aJe=document,oJe=()=>aJe.createComment(""),sJe=e=>null===e||"object"!=typeof e&&"function"!=typeof e,uJe=Array.isArray,cJe="[ \t\n\f\r]",lJe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,dJe=/-->/g,fJe=/>/g,hJe=RegExp(`>|${cJe}(?:([^\\s"'>=/]+)(${cJe}*=${cJe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pJe=/'/g,mJe=/"/g,gJe=/^(?:script|style|textarea|title)$/i,vJe=(e,...t)=>({_$litType$:1,strings:e,values:t}),yJe=Symbol.for("lit-noChange"),bJe=Symbol.for("lit-nothing"),_Je=new WeakMap,xJe=aJe.createTreeWalker(aJe,129);function SJe(e,t){if(!uJe(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===eJe?t:eJe.createHTML(t)}var wJe=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=lJe;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===lJe?"!--"===s[1]?o=dJe:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=hJe):(gJe.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=hJe):o=fJe:o===hJe?">"===s[0]?(o=r??lJe,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?hJe:'"'===s[3]?mJe:pJe):o===mJe||o===pJe?o=hJe:o===dJe||o===fJe?o=lJe:(o=hJe,r=void 0);let d=o===hJe&&e[t+1].startsWith("/>")?" ":"";a+=o===lJe?u+iJe:c>=0?(i.push(n),u.slice(0,c)+tJe+u.slice(c)+rJe+d):u+rJe+(-2===c?t:d)}return[SJe(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),xJe.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=xJe.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(tJe)){let t=l[o++],r=i.getAttribute(e).split(rJe),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?EJe:"?"===n[1]?MJe:"@"===n[1]?kJe:PJe}),i.removeAttribute(e)}
611else e.startsWith(rJe)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(gJe.test(i.tagName)){let e=i.textContent.split(rJe),t=e.length-1;if(t>0){i.textContent=JQe?JQe.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],oJe()),xJe.nextNode(),u.push({type:2,index:++a});i.append(e[t],oJe())}}}else if(8===i.nodeType)if(i.data===nJe)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(rJe,e+1));)u.push({type:7,index:a}),e+=rJe.length-1}a++}}static createElement(e,t){let r=aJe.createElement("template");return r.innerHTML=e,r}};function AJe(e,t,r=e,n){if(t===yJe)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=sJe(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=AJe(e,i._$AS(e,t.values),i,n)),t}var CJe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??aJe).importNode(t,!0);xJe.currentNode=n;let i=xJe.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new TJe(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new IJe(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=xJe.nextNode(),a++)}return xJe.currentNode=aJe,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},TJe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=bJe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=AJe(this,e,t),sJe(e)?e===bJe||null==e||""===e?(this._$AH!==bJe&&this._$AR(),this._$AH=bJe):e!==this._$AH&&e!==yJe&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>uJe(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==bJe&&sJe(this._$AH)?this._$AA.nextSibling.data=e:this.T(aJe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=wJe.createElement(SJe(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new CJe(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=_Je.get(e.strings);return void 0===t&&_Je.set(e.strings,t=new wJe(e)),t}k(t){uJe(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(oJe()),this.O(oJe()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},PJe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=bJe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=bJe}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=AJe(this,e,t,0),a=!sJe(e)||e!==this._$AH&&e!==yJe,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=AJe(this,s[r+n],t,n),o===yJe&&(o=this._$AH[n]),a||=!sJe(o)||o!==this._$AH[n],o===bJe?e=bJe:e!==bJe&&(e+=(o??"")+i[n+1]),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===bJe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},EJe=class extends PJe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===bJe?void 0:e}},MJe=class extends PJe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==bJe)}},kJe=class extends PJe{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}
611_$AI(e,t=this){if((e=AJe(this,e,t,0)??bJe)===yJe)return;let r=this._$AH,n=e===bJe&&r!==bJe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==bJe&&(r===bJe||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},IJe=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){AJe(this,e)}},DJe=QQe.litHtmlPolyfillSupport;DJe?.(wJe,TJe),(QQe.litHtmlVersions??=[]).push("3.2.1");var OJe=class extends ZQe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new TJe(t.insertBefore(oJe(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return yJe}};OJe._$litElement$=!0,OJe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:OJe});var RJe=globalThis.litElementPolyfillSupport;RJe?.({LitElement:OJe}),(globalThis.litElementVersions??=[]).push("4.1.1");var BJe=class extends(cu(kQe)){constructor(){super(...arguments),this.hoveredVariant=null,this.lastDispatchedVariant=null,this._backgroundStamp=new Bu(()=>({processedData:this.processedData,canvasCtx:this.canvasCtx,width:this.width,height:this.height,canvasScale:this.canvasScale,length:this.length,"display-start":this["display-start"],"display-end":this["display-end"],"margin-left":this["margin-left"],"margin-right":this["margin-right"],"margin-top":this["margin-top"],"margin-bottom":this["margin-bottom"],condensedView:this.condensedView,rowHeight:this.rowHeight,colorConfig:this.colorConfig})),this.requestDraw=()=>this._drawer.requestRefresh(),this._drawer=Ou(()=>this._draw()),this._drawCompleteResolvers=[]}render(){return vJe`
612      <style>
613        nightingale-variation-canvas {
614          display: flex;
615          width: 100%;
616        }
617        nightingale-variation-canvas svg {
618          background-color: transparent;
619        }
620        nightingale-variation-canvas .tick line,
621        nightingale-variation-canvas .axis path {
622          opacity: 0.1;
623          pointer-events: none;
624        }
625        nightingale-variation-canvas .variation-y-right line,
626        nightingale-variation-canvas .axis path {
627          fill: none;
628          stroke: none;
629        }
630      </style>
631      <div class="container">
632        <div style="position: relative; z-index: 0;">
633          <canvas
634            class="background"
635            style="position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none;"
636          ></canvas>
637          <svg>
638            <g class="sequence-features" />
639          </svg>
640          <canvas
641            class="foreground"
642            style="position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none;"
643          ></canvas>
644        </div>
645      </div>
646    `}createFeatures(){super.createFeatures(),this.onDimensionsChange(),this.variantIndex=function(e){let t=new Map;if(!e)return t;let r=!1;for(let n of e)if(0!==n.variants.length&&(t.set(n.pos,n.variants),!r))for(let e of n.variants)if((e.size??0)>10){console.warn(`nightingale-variation-canvas: variant size ${e.size} exceeds MAX_HIT_RADIUS=10; the outer ring will render but may not be hit-testable.`),r=!0;break}return t}(this.processedData?.mutationArray),this.svg&&(this.unbindEvents(this.svg),this.bindEvents(this.svg)),this.requestDraw()}zoomRefreshed(){this.series&&(this.updateScale(),this.onDimensionsChange(),this.updateHighlight()),this.requestDraw()}refresh(){this.requestDraw()}firstUpdated(){super.firstUpdated();let e=this.renderRoot.querySelector("canvas.foreground");this.foregroundCanvasCtx=e?.getContext("2d")??void 0,e&&(e.style.width=`${this.width}px`,e.style.height=`${this.height}px`),this.requestDraw()}onCanvasScaleChange(){super.onCanvasScaleChange(),this.refresh()}whenDrawn(){return new Promise(e=>{this._drawCompleteResolvers.push(e)})}_draw(){if(this._backgroundStamp.update().changed&&(this.adjustCanvasCtxLogicalSize(),this.drawCanvasContent()),this.adjustForegroundCtxLogicalSize(),this.drawForegroundContent(),this._drawCompleteResolvers.length>0){let e=this._drawCompleteResolvers;this._drawCompleteResolvers=[];for(let t of e)t()}}adjustForegroundCtxLogicalSize(){let e=this.foregroundCanvasCtx;if(!e)return;let t=Math.floor(this.width*this.canvasScale),r=Math.floor(this.height*this.canvasScale);e.canvas.width!==t&&(e.canvas.width=t),e.canvas.height!==r&&(e.canvas.height=r),e.canvas.style.width=`${this.width}px`,e.canvas.style.height=`${this.height}px`}drawForegroundContent(){let e=this.foregroundCanvasCtx;if(!e)return;e.clearRect(0,0,e.canvas.width,e.canvas.height);let t=this.hoveredVariant;if(!t||!this.yScale)return;let r=t.variant?.charAt(0);if(!r)return;let n=this.yScale(r);if(void 0===n)return;let i=this.canvasScale,a=.5*this.getSingleBaseWidth(),o=i*(this.getXFromSeqPosition(t.start)+a),s=i*(this["margin-top"]+n),u=i*(t.size??5);e.globalAlpha=1,e.fillStyle=t.color??this.colorConfig(t),e.beginPath(),e.arc(o,s,u,0,2*Math.PI),e.fill()}drawCanvasContent(){let e=this.canvasCtx;if(!e)return;let t=e.canvas.width,r=e.canvas.height;e.clearRect(0,0,t,r);let n=this.processedData?.mutationArray;if(!n||!this.yScale)return;let i=this.canvasScale,a=.5*this.getSingleBaseWidth(),o=this.getSeqPositionFromX(-10)??-1/0,s=this.getSeqPositionFromX(t/i+10)??1/0,u=this["margin-top"];e.globalAlpha=.6;for(let t of n){if(t.pos<o||t.pos>s||0===t.variants.length)continue;let r=i*(this.getXFromSeqPosition(t.pos)+a);for(let n of t.variants){let t=n.variant?.charAt(0);if(!t)continue;let a=this.yScale(t);if(void 0===a)continue;let o=i*(u+a),s=i*(n.size??5);e.fillStyle=n.color??this.colorConfig(n),e.beginPath(),e.arc(r,o,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}setHoveredVariant(e){this.hoveredVariant!==e&&(this.hoveredVariant=e,this.requestDraw())}getVariantAt(e,t){if(!this.variantIndex||!this.yScale)return;let r=this.getSingleBaseWidth();if(!(r>0))return;let n=.5*r,i=this.getSeqPositionFromX(e-10),a=this.getSeqPositionFromX(e+10);if(void 0===i||void 0===a)return;let o,s=Math.max(1,Math.floor(i)),u=Math.ceil(a),c=this["margin-top"];for(let r=s;r<=u;r++){let i=this.variantIndex.get(r);if(!i)continue;let a=this.getXFromSeqPosition(r)+n;for(let r of i){let n=r.variant?.charAt(0);if(!n)continue;let i=this.yScale(n);if(void 0===i)continue;let s=c+i,u=r.size??5,l=e-a,d=t-s;l*l+d*d<=u*u&&(o=r)}}return o}bindEvents(e){e.on("click.NightingaleVariationCanvas",e=>this.handleClick(e)),e.on("mousemove.NightingaleVariationCanvas",e=>this.handleMousemove(e)),e.on("mouseout.NightingaleVariationCanvas",e=>this.handleMouseout(e))}unbindEvents(e){e.on("click.NightingaleVariationCanvas",null),e.on("mousemove.NightingaleVariationCanvas",null),e.on("mouseout.NightingaleVariationCanvas",null)}getLocalCoords(e){let t=this.svg?.node();if(!t)return null;let r=t.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}}handleClick(e){let t=this.getLocalCoords(e);if(!t)return;let r=this.getVariantAt(t.x,t.y);if(!r)return;let n=Mu("click",r,"onclick"===this.getAttribute("highlight-event"),!0,r.start,FJe(r),e.target instanceof HTMLElement?e.target:void 0,e,this);this.dispatchEvent(n)}handleMousemove(e){let t=this.getLocalCoords(e);if(!t)return;let r=this.getVariantAt(t.x,t.y)??null;this.setHoveredVariant(r),r!==this.lastDispatchedVariant&&(this.lastDispatchedVariant&&this.dispatchMouseout(e),r&&this.dispatchMouseover(e,r),this.lastDispatchedVariant=r)}handleMouseout(e){this.setHoveredVariant(null),this.lastDispatchedVariant&&=(this.dispatchMouseout(e),null)}
vendor: 26,814 bytes, line 646
646dispatchMouseover(e,t){let r=Mu("mouseover",t,"onmouseover"===this.getAttribute("highlight-event"),!1,t.start,FJe(t),e.target instanceof HTMLElement?e.target:void 0,e,this);this.dispatchEvent(r)}dispatchMouseout(e){let t=Mu("mouseout",null,"onmouseover"===this.getAttribute("highlight-event"),void 0,void 0,void 0,e.target instanceof HTMLElement?e.target:void 0,e,this);this.dispatchEvent(t)}};BJe=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}([Fu("nightingale-variation-canvas")],BJe);var NJe=BJe;function FJe(e){let t=e.end;if(null==t||""===t)return e.start;let r=Number(t);return Number.isFinite(r)?r:e.start}function LJe(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function $Je(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function UJe(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function jJe(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function zJe(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function GJe(e){let t,r,n;function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===jJe||e===zJe?e:VJe,r=e,n=e):(t=jJe,r=(t,r)=>jJe(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function VJe(){return 0}var HJe=GJe(jJe).right;GJe(function(e){return null===e?NaN:+e}).center;var qJe=Math.sqrt(50),WJe=Math.sqrt(10),XJe=Math.sqrt(2);function YJe(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=qJe?10:u>=WJe?5:u>=XJe?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?YJe(e,t,2*r):[n,i,a]}function KJe(e,t,r){return YJe(e=+e,t=+t,r=+r)[2]}function ZJe(e,t){let r;if(void 0===t)for(let t of e)null!=t&&(r<t||void 0===r&&t>=t)&&(r=t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(r<i||void 0===r&&i>=i)&&(r=i)}return r}function QJe(e,t){let r;if(void 0===t)for(let t of e)null!=t&&(r>t||void 0===r&&t>=t)&&(r=t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(r>i||void 0===r&&i>=i)&&(r=i)}return r}var JJe={value:()=>{}};function e0e(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new t0e(n)}function t0e(e){this._=e}function r0e(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function n0e(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=JJe,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}t0e.prototype=e0e.prototype={constructor:t0e,on:function(e,t){var r,n,i=this._,a=(n=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");if(r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),e&&!n.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++o<s;)if(r=(e=a[o]).type)i[r]=n0e(i[r],e.name,t);else if(null==t)for(r in i)i[r]=n0e(i[r],e.name,null);return this}for(;++o<s;)if((r=(e=a[o]).type)&&(r=r0e(i[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new t0e(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var i0e="http://www.w3.org/1999/xhtml",a0e={svg:"http://www.w3.org/2000/svg",xhtml:i0e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function o0e(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),a0e.hasOwnProperty(t)?{space:a0e[t],local:e}:e}function s0e(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===i0e&&t.documentElement.namespaceURI===i0e?t.createElement(e):t.createElementNS(r,e)}}function u0e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function c0e(e){var t=o0e(e);return(t.local?u0e:s0e)(t)}function l0e(){}function d0e(e){return null==e?l0e:function(){return this.querySelector(e)}}function f0e(){return[]}function h0e(e){return null==e?f0e:function(){return this.querySelectorAll(e)}}function p0e(e){return function(){return this.matches(e)}}function m0e(e){return function(t){return t.matches(e)}}var g0e=Array.prototype.find;function v0e(){return this.firstElementChild}var y0e=Array.prototype.filter;function b0e(){return Array.from(this.children)}function _0e(e){return Array(e.length)}function x0e(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function S0e(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new x0e(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function w0e(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new x0e(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function A0e(e){return e.__data__}function C0e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function T0e(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function P0e(e){return function(){this.removeAttribute(e)}}function E0e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M0e(e,t){return function(){this.setAttribute(e,t)}}function k0e(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function I0e(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function D0e(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function O0e(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function R0e(e){return function(){this.style.removeProperty(e)}}function B0e(e,t,r){return function(){this.style.setProperty(e,t,r)}}function N0e(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function F0e(e,t){return e.style.getPropertyValue(t)||O0e(e).getComputedStyle(e,null).getPropertyValue(t)}function L0e(e){return function(){delete this[e]}}function $0e(e,t){return function(){this[e]=t}}function U0e(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function j0e(e){return e.trim().split(/^|\s+/)}function z0e(e){return e.classList||new G0e(e)}function G0e(e){this._node=e,this._names=j0e(e.getAttribute("class")||"")}function V0e(e,t){for(var r=z0e(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function H0e(e,t){for(var r=z0e(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function q0e(e){return function(){V0e(this,e)}}function W0e(e){return function(){H0e(this,e)}}function X0e(e,t){return function(){(t.apply(this,arguments)?V0e:H0e)(this,e)}}function Y0e(){this.textContent=""}function K0e(e){return function(){this.textContent=e}}function Z0e(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Q0e(){this.innerHTML=""}function J0e(e){return function(){this.innerHTML=e}}function e1e(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function t1e(){this.nextSibling&&this.parentNode.appendChild(this)}function r1e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function n1e(){return null}function i1e(){var e=this.parentNode;e&&e.removeChild(this)}function a1e(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function o1e(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function s1e(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function u1e(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function c1e(e,t,r){var n=O0e(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function l1e(e,t){return function(){return c1e(this,e,t)}}function d1e(e,t){return function(){return c1e(this,e,t.apply(this,arguments))}}x0e.prototype={constructor:x0e,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},G0e.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var f1e=[null];function h1e(e,t){this._groups=e,this._parents=t}function p1e(){return new h1e([[document.documentElement]],f1e)}function m1e(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}function g1e(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function v1e(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function y1e(){}h1e.prototype=p1e.prototype={constructor:h1e,select:function(e){"function"!=typeof e&&(e=d0e(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new h1e(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):h0e(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new h1e(n,i)},selectChild:function(e){return this.select(null==e?v0e:function(e){return function(){return g0e.call(this.children,e)}}("function"==typeof e?e:m0e(e)))},selectChildren:function(e){return this.selectAll(null==e?b0e:function(e){return function(){return y0e.call(this.children,e)}}("function"==typeof e?e:m0e(e)))},filter:function(e){"function"!=typeof e&&(e=p0e(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new h1e(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,A0e);var r=t?w0e:S0e,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;++c){var l=n[c],d=i[c],f=d.length,h=C0e(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new h1e(o,n))._enter=s,o._exit=u,o},enter:function(){return new h1e(this._enter||this._groups.map(_0e),this._parents)},exit:function(){return new h1e(this._exit||this._groups.map(_0e),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new h1e(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=T0e;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new h1e(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=o0e(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?E0e:P0e:"function"==typeof t?r.local?D0e:I0e:r.local?k0e:M0e)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?R0e:"function"==typeof t?N0e:B0e)(e,t,r??"")):F0e(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?L0e:"function"==typeof t?U0e:$0e)(e,t)):this.node()[e]},classed:function(e,t){var r=j0e(e+"");if(arguments.length<2){for(var n=z0e(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?X0e:t?q0e:W0e)(r,t))},text:function(e){return arguments.length?this.each(null==e?Y0e:("function"==typeof e?Z0e:K0e)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Q0e:("function"==typeof e?e1e:J0e)(e)):this.node().innerHTML},raise:function(){return this.each(t1e)},lower:function(){return this.each(r1e)},append:function(e){var t="function"==typeof e?e:c0e(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:c0e(e),n=null==t?n1e:"function"==typeof t?t:d0e(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(i1e)},clone:function(e){return this.select(e?o1e:a1e)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?u1e:s1e,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?d1e:l1e)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var b1e=.7,_1e=1/b1e,x1e="\\s*([+-]?\\d+)\\s*",S1e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",w1e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",A1e=/^#([0-9a-f]{3,8})$/,C1e=RegExp(`^rgb\\(${x1e},${x1e},${x1e}\\)$`),T1e=RegExp(`^rgb\\(${w1e},${w1e},${w1e}\\)$`),P1e=RegExp(`^rgba\\(${x1e},${x1e},${x1e},${S1e}\\)$`),E1e=RegExp(`^rgba\\(${w1e},${w1e},${w1e},${S1e}\\)$`),M1e=RegExp(`^hsl\\(${S1e},${w1e},${w1e}\\)$`),k1e=RegExp(`^hsla\\(${S1e},${w1e},${w1e},${S1e}\\)$`),I1e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function D1e(){return this.rgb().formatHex()}function O1e(){return this.rgb().formatRgb()}function R1e(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=A1e.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?B1e(t):3===r?new $1e(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?N1e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?N1e(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=C1e.exec(e))?new $1e(t[1],t[2],t[3],1):(t=T1e.exec(e))?new $1e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=P1e.exec(e))?N1e(t[1],t[2],t[3],t[4]):(t=E1e.exec(e))?N1e(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=M1e.exec(e))?H1e(t[1],t[2]/100,t[3]/100,1):(t=k1e.exec(e))?H1e(t[1],t[2]/100,t[3]/100,t[4]):I1e.hasOwnProperty(e)?B1e(I1e[e]):"transparent"===e?new $1e(NaN,NaN,NaN,0):null}function B1e(e){return new $1e(e>>16&255,e>>8&255,255&e,1)}function N1e(e,t,r,n){return n<=0&&(e=t=r=NaN),new $1e(e,t,r,n)}function F1e(e){return e instanceof y1e||(e=R1e(e)),e?new $1e((e=e.rgb()).r,e.g,e.b,e.opacity):new $1e}function L1e(e,t,r,n){return 1===arguments.length?F1e(e):new $1e(e,t,r,n??1)}function $1e(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function U1e(){return`#${V1e(this.r)}${V1e(this.g)}${V1e(this.b)}`}function j1e(){let e=z1e(this.opacity);return`${1===e?"rgb(":"rgba("}${G1e(this.r)}, ${G1e(this.g)}, ${G1e(this.b)}${1===e?")":`, ${e})`}`}function z1e(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function G1e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function V1e(e){return((e=G1e(e))<16?"0":"")+e.toString(16)}function H1e(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new W1e(e,t,r,n)}function q1e(e){if(e instanceof W1e)return new W1e(e.h,e.s,e.l,e.opacity);if(e instanceof y1e||(e=R1e(e)),!e)return new W1e;if(e instanceof W1e)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new W1e(o,s,u,e.opacity)}function W1e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function X1e(e){return(e=(e||0)%360)<0?e+360:e}function Y1e(e){return Math.max(0,Math.min(1,e||0))}function K1e(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}g1e(y1e,R1e,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:D1e,formatHex:D1e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return q1e(this).formatHsl()},formatRgb:O1e,toString:O1e}),g1e($1e,L1e,v1e(y1e,{brighter(e){return e=null==e?_1e:_1e**+e,new $1e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?b1e:b1e**+e,new $1e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $1e(G1e(this.r),G1e(this.g),G1e(this.b),z1e(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:U1e,formatHex:U1e,formatHex8:function(){return`#${V1e(this.r)}${V1e(this.g)}${V1e(this.b)}${V1e(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:j1e,toString:j1e})),g1e(W1e,function(e,t,r,n){return 1===arguments.length?q1e(e):new W1e(e,t,r,n??1)},v1e(y1e,{brighter(e){return e=null==e?_1e:_1e**+e,new W1e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?b1e:b1e**+e,new W1e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new $1e(K1e(e>=240?e-240:e+120,i,n),K1e(e,i,n),K1e(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new W1e(X1e(this.h),Y1e(this.s),Y1e(this.l),z1e(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=z1e(this.opacity);return`${1===e?"hsl(":"hsla("}${X1e(this.h)}, ${100*Y1e(this.s)}%, ${100*Y1e(this.l)}%${1===e?")":`, ${e})`}`}}));var Z1e=Math.PI/180,Q1e=180/Math.PI,J1e=-.14861,e2e=1.78277,t2e=-.29227,r2e=-.90649,n2e=1.97294,i2e=n2e*r2e,a2e=n2e*e2e,o2e=e2e*t2e-r2e*J1e;function s2e(e,t,r,n){return 1===arguments.length?function(e){if(e instanceof u2e)return new u2e(e.h,e.s,e.l,e.opacity);e instanceof $1e||(e=F1e(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(o2e*n+i2e*t-a2e*r)/(o2e+i2e-a2e),a=n-i,o=(n2e*(r-i)-t2e*a)/r2e,s=Math.sqrt(o*o+a*a)/(n2e*i*(1-i)),u=s?Math.atan2(o,a)*Q1e-120:NaN;return new u2e(u<0?u+360:u,s,i,e.opacity)}(e):new u2e(e,t,r,n??1)}function u2e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}g1e(u2e,s2e,v1e(y1e,{brighter(e){return e=null==e?_1e:_1e**+e,new u2e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?b1e:b1e**+e,new u2e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Z1e,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new $1e(255*(t+r*(J1e*n+e2e*i)),255*(t+r*(t2e*n+r2e*i)),255*(t+n2e*n*r),this.opacity)}}));var c2e=e=>()=>e;function l2e(e,t){return function(r){return e+r*t}}function d2e(e,t){var r=t-e;return r?l2e(e,r):c2e(isNaN(e)?t:e)}var f2e=function e(t){var r=function(e){return 1==(e=+e)?d2e:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):c2e(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=L1e(e)).r,(t=L1e(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=d2e(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1);function h2e(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function p2e(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=x2e(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function m2e(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function g2e(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function v2e(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=x2e(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}
646var y2e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,b2e=new RegExp(y2e.source,"g");function _2e(e,t){var r,n,i,a=y2e.lastIndex=b2e.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=y2e.exec(e))&&(n=b2e.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:g2e(r,n)})),a=b2e.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function x2e(e,t){var r,n=typeof t;return null==t||"boolean"===n?c2e(t):("number"===n?g2e:"string"===n?(r=R1e(t))?(t=r,f2e):_2e:t instanceof R1e?f2e:t instanceof Date?m2e:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?h2e:Array.isArray(t)?p2e:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?v2e:g2e)(e,t)}function S2e(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var w2e,A2e=180/Math.PI,C2e={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function T2e(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*A2e,skewX:Math.atan(u)*A2e,scaleX:o,scaleY:s}}function P2e(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:g2e(e,i)},{i:u-2,x:g2e(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:g2e(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",
646null,n)-2,x:g2e(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:g2e(e,r)},{i:s-2,x:g2e(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var E2e=P2e(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?C2e:T2e(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),M2e=P2e(function(e){return null==e?C2e:(w2e||=document.createElementNS("http://www.w3.org/2000/svg","g"),w2e.setAttribute("transform",e),(e=w2e.transform.baseVal.consolidate())?T2e((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):C2e)},", ",")",")");function k2e(e){return function t(r){function n(t,n){var i=e((t=s2e(t)).h,(n=s2e(n)).h),a=d2e(t.s,n.s),o=d2e(t.l,n.l),s=d2e(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+r),t.opacity=s(e),t+""}}return r=+r,n.gamma=t,n}(1)}k2e(function(e,t){var r=t-e;return r?l2e(e,r>180||r<-180?r-360*Math.round(r/360):r):c2e(isNaN(e)?t:e)});var I2e,D2e,O2e=k2e(d2e),R2e=0,B2e=0,N2e=0,F2e=0,L2e=0,$2e=0,U2e="object"==typeof performance&&performance.now?performance:Date,j2e="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function z2e(){return L2e||=(j2e(G2e),U2e.now()+$2e)}function G2e(){L2e=0}function V2e(){this._call=this._time=this._next=null}function H2e(e,t,r){var n=new V2e;return n.restart(e,t,r),n}function q2e(){L2e=(F2e=U2e.now())+$2e,R2e=B2e=0;try{!function(){z2e(),++R2e;for(var e,t=I2e;t;)(e=L2e-t._time)>=0&&t._call.call(void 0,e),t=t._next;--R2e}()}finally{R2e=0,function(){for(var e,t,r=I2e,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:I2e=t);D2e=e,X2e(n)}(),L2e=0}}function W2e(){var e=U2e.now(),t=e-F2e;t>1e3&&($2e-=t,F2e=e)}function X2e(e){R2e||(B2e&&=clearTimeout(B2e),e-L2e>24?(e<1/0&&(B2e=setTimeout(q2e,e-U2e.now()-$2e)),N2e&&=clearInterval(N2e)):(N2e||=(F2e=U2e.now(),setInterval(W2e,1e3)),R2e=1,j2e(q2e)))}function Y2e(e,t,r){var n=new V2e;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}V2e.prototype=H2e.prototype={constructor:V2e,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?z2e():+r)+(null==t?0:+t),this._next||D2e===this||(D2e?D2e._next=this:I2e=this,D2e=this),this._call=e,this._time=r,X2e()},stop:function(){this._call&&(this._call=null,this._time=1/0,X2e())}};var K2e=e0e("start","end","cancel","interrupt"),Z2e=[];function Q2e(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return Y2e(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(Y2e(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
646),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=H2e(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:K2e,tween:Z2e,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function J2e(e,t){var r=t3e(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function e3e(e,t){var r=t3e(e,t);if(r.state>3)throw Error("too late; already running");return r}function t3e(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function r3e(e,t){var r,n;return function(){var i=e3e(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function n3e(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=e3e(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function i3e(e,t,r){var n=e._id;return e.each(function(){var e=e3e(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return t3e(e,n).value[t]}}function a3e(e,t){var r;return("number"==typeof t?g2e:t instanceof R1e?f2e:(r=R1e(t))?(t=r,f2e):_2e)(e,t)}function o3e(e){return function(){this.removeAttribute(e)}}function s3e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function u3e(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function c3e(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function l3e(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function d3e(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function f3e(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function h3e(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function p3e(e,t){return function(){J2e(this,e).delay=+t.apply(this,arguments)}}function m3e(e,t){return t=+t,function(){J2e(this,e).delay=t}}function g3e(e,t){return function(){e3e(this,e).duration=+t.apply(this,arguments)}}function v3e(e,t){return t=+t,function(){e3e(this,e).duration=t}}var y3e=p1e.prototype.constructor;function b3e(e){return function(){this.style.removeProperty(e)}}var _3e=0;function x3e(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function S3e(){return++_3e}var w3e=p1e.prototype;x3e.prototype={constructor:x3e,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=d0e(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,Q2e(d[f],t,r,f,d,t3e(s,r)));return new x3e(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=h0e(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=t3e(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&Q2e(f,t,r,m,h,p);a.push(h),o.push(u)}return new x3e(a,o,t,r)},selectChild:w3e.selectChild,selectChildren:w3e.selectChildren,filter:function(e){"function"!=typeof e&&(e=p0e(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new x3e(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new x3e(o,this._parents,this._name,this._id)},selection:function(){return new y3e(this._groups,this._parents)}
vendor: 4,303 bytes, line 646
646,transition:function(){for(var e=this._name,t=this._id,r=S3e(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=t3e(o,t);Q2e(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new x3e(n,this._parents,e,r)},call:w3e.call,nodes:w3e.nodes,node:w3e.node,size:w3e.size,empty:w3e.empty,each:w3e.each,on:function(e,t){var r=this._id;return arguments.length<2?t3e(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?J2e:e3e;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=o0e(e),n="transform"===r?M2e:a3e;return this.attrTween(e,"function"==typeof t?(r.local?d3e:l3e)(r,n,i3e(this,"attr."+e,t)):null==t?(r.local?s3e:o3e)(r):(r.local?c3e:u3e)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=o0e(e);return this.tween(r,(n.local?f3e:h3e)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?E2e:a3e;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=F0e(this,e),o=(this.style.removeProperty(e),F0e(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,b3e(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=F0e(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=F0e(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,i3e(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=e3e(this,e),c=u.on,l=null==u.value[o]?a||=b3e(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=F0e(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(i3e(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=t3e(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?r3e:n3e)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?p3e:m3e)(t,e)):t3e(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?g3e:v3e)(t,e)):t3e(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){e3e(this,e).ease=t}}(t,e)):t3e(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();e3e(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=e3e(this,n),i=r.on;
646i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:w3e[Symbol.iterator]};var A3e={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function C3e(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}p1e.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}(this,e)})},p1e.prototype.transition=function(e){var t,r;e instanceof x3e?(t=e._id,e=e._name):(t=S3e(),(r=A3e).time=z2e(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&Q2e(o,e,t,c,s,r||C3e(o,t));return new x3e(n,this._parents,e,t)};var T3e=Math.PI,P3e=2*T3e,E3e=1e-6,M3e=P3e-E3e;function k3e(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}var I3e=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?k3e:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return k3e;let r=10**t;return function(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=Math.round(arguments[t]*r)/r+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,r,n){this._append`Q${+e},${+t},${this._x1=+r},${this._y1=+n}`}bezierCurveTo(e,t,r,n,i,a){this._append`C${+e},${+t},${+r},${+n},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,r,n,i){if(e=+e,t=+t,r=+r,n=+n,(i=+i)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=r-e,u=n-t,c=a-e,l=o-t,d=c*c+l*l;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>E3e)if(Math.abs(l*s-u*c)>E3e&&i){let f=r-a,h=n-o,p=s*s+u*u,m=f*f+h*h,g=Math.sqrt(p),v=Math.sqrt(d),y=i*Math.tan((T3e-Math.acos((p+d-m)/(2*g*v)))/2),b=y/v,_=y/g;Math.abs(b-1)>E3e&&this._append`L${e+b*c},${t+b*l}`,this._append`A${i},${i},0,0,${+(l*f>c*h)},${this._x1=e+_*s},${this._y1=t+_*u}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,r,n,i,a){if(e=+e,t=+t,a=!!a,(r=+r)<0)throw Error(`negative radius: ${r}`);let o=r*Math.cos(n),s=r*Math.sin(n),u=e+o,c=t+s,l=1^a,d=a?n-i:i-n;null===this._x1?this._append`M${u},${c}`:(Math.abs(this._x1-u)>E3e||Math.abs(this._y1-c)>E3e)&&this._append`L${u},${c}`,r&&(d<0&&(d=d%P3e+P3e),d>M3e?this._append`A${r},${r},0,1,${l},${e-o},${t-s}A${r},${r},0,1,${l},${this._x1=u},${this._y1=c}`:d>E3e&&this._append`A${r},${r},0,${+(d>=T3e)},${l},${this._x1=e+r*Math.cos(i)},${this._y1=t+r*Math.sin(i)}`)}rect(e,t,r,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}};function D3e(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function O3e(e){return(e=D3e(Math.abs(e)))?e[1]:NaN}var R3e,B3e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function N3e(e){if(!(t=B3e.exec(e)))throw Error("invalid format: "+e);var t;return new F3e({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function F3e(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function L3e(e,t){var r=D3e(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}N3e.prototype=F3e.prototype,F3e.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?""
vendor: 2,219 bytes, line 646
646:Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var $3e={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>L3e(100*e,t),r:L3e,s:function(e,t){var r=D3e(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(R3e=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+D3e(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function U3e(e){return e}var j3e,z3e,G3e,V3e=Array.prototype.map,H3e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function q3e(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function W3e(e){return+e}j3e=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?U3e:(t=V3e.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?U3e:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(V3e.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=N3e(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):$3e[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=$3e[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;
646if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?H3e[8+R3e/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=N3e(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(O3e(t)/3))),i=10**-n,a=H3e[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),z3e=j3e.format,G3e=j3e.formatPrefix;var X3e=[0,1];function Y3e(e){return e}function K3e(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function Z3e(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=K3e(i,n),a=r(o,a)):(n=K3e(n,i),a=r(a,o)),function(e){return a(n(e))}}function Q3e(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=K3e(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=HJe(e,t,1,n)-1;return a[r](i[r](t))}}function J3e(){var e=function(){var e,t,r,n,i,a,o=X3e,s=X3e,u=x2e,c=Y3e;function l(){var e=Math.min(o.length,s.length);return c!==Y3e&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?Q3e:Z3e,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),g2e))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,W3e),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=S2e,l()},d.clamp=function(e){return arguments.length?(c=!!e||Y3e,l()):c!==Y3e},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}()(Y3e,Y3e);return e.copy=function(){return t=e,J3e().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},q3e.apply(e,arguments),function(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?YJe(t,e,r):YJe(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return function(e,t,r,n){var i,a=function(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?KJe(t,e,r):KJe(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}(e,t,r);switch((n=N3e(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(O3e(t)/3)))-O3e(Math.abs(e)))}(a,o))||(n.precision=i),G3e(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,O3e(t)-O3e(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-O3e(Math.abs(e)))}(a))||(n.precision=i-2*("%"===n.type))}return z3e(n)}(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=KJe(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}(e)}O2e(s2e(-100,.75,.35),s2e(80,1.5,.8)),O2e(s2e(260,.75,.35),s2e(80,1.5,.8));var e4e=s2e();function t4e(e){return function(){return e}}function r4e(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(null==r)t=null;else{let e=Math.floor(r);if(!(e>=0))throw RangeError(`invalid digits: ${r}`);t=e}return e},()=>new I3e(t)}function n4e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function i4e(e){this._context=e}function a4e(e){return new i4e(e)}function o4e(e){return e[0]}function s4e(e){return e[1]}function u4e(e,t){var r=t4e(!0),n=null,i=a4e,a=null,o=r4e(s);function s(s){var u,c,l,d=(s=n4e(s)).length,f=!1;for(n??(a=i(l=o())),u=0;u<=d;++u)!(u<d&&r(c=s[u],u,s))===f&&((f=!f)?a.lineStart():a.lineEnd()),f&&a.point(+e(c,u,s),+t(c,u,s));if(l)return a=null,l+""||null}return e="function"==typeof e?e:void 0===e?o4e:t4e(e),t="function"==typeof t?t:void 0===t?s4e:t4e(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:t4e
vendor: 8,292 bytes, line 646
646(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:t4e(+e),s):t},s.defined=function(e){return arguments.length?(r="function"==typeof e?e:t4e(!!e),s):r},s.curve=function(e){return arguments.length?(i=e,null!=n&&(a=i(n)),s):i},s.context=function(e){return arguments.length?(null==e?n=a=null:a=i(n=e),s):n},s}function c4e(){}function l4e(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function d4e(e){this._context=e}function f4e(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function h4e(e,t){this._context=e,this._k=(1-t)/6}i4e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},d4e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:l4e(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:l4e(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},h4e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:f4e(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:f4e(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var p4e=function e(t){function r(e){return new h4e(e,t)}return r.tension=function(t){return e(+t)},r}(0);function m4e(e){this._context=e}function g4e(e){return e<0?-1:1}function v4e(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(g4e(a)+g4e(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function y4e(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function b4e(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-n)/3;e._context.bezierCurveTo(n+s,i+s*t,a-s,o-s*r,a,o)}function _4e(e){this._context=e}function x4e(e){this._context=new S4e(e)}function S4e(e){this._context=e}function w4e(e){this._context=e}function A4e(e){var t,r,n=e.length-1,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function C4e(e,t){this._context=e,this._t=t}function T4e(e,t,r){this.k=e,this.x=t,this.y=r}m4e.prototype={areaStart:c4e,areaEnd:c4e,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},_4e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:b4e(this,this._t0,y4e(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,b4e(this,y4e(this,r=v4e(this,e,t)),r);break;default:b4e(this,this._t0,r=v4e(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}},(x4e.prototype=Object.create(_4e.prototype)).point=function(e,t){_4e.prototype.point.call(this,t,e)},S4e.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}},w4e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===r)this._context.lineTo(e[1],t[1]);else for(var n=A4e(e),i=A4e(t),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===r)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},C4e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}}this._x=e,this._y=t}},T4e.prototype={constructor:T4e,scale:function(e){return 1===e?this:new T4e(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new T4e(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},T4e.prototype;var P4e=globalThis,E4e=P4e.ShadowRoot&&(void 0===P4e.ShadyCSS||P4e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,M4e=Symbol(),k4e=new WeakMap,I4e=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==M4e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(E4e&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=k4e.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&k4e.set(t,e))}return e}toString(){return this.cssText}},D4e=E4e?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new I4e("string"==typeof e?e:e+"",void 0,M4e))(t)})(e):e,{is:O4e,defineProperty:R4e,getOwnPropertyDescriptor:B4e,getOwnPropertyNames:N4e,getOwnPropertySymbols:F4e,getPrototypeOf:L4e}=Object,$4e=globalThis,U4e=$4e.trustedTypes,j4e=U4e?U4e.emptyScript:"",z4e=$4e.reactiveElementPolyfillSupport,G4e=(e,t)=>
646e,V4e={toAttribute(e,t){switch(t){case Boolean:e=e?j4e:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},H4e=(e,t)=>!O4e(e,t),q4e={attribute:!0,type:String,converter:V4e,reflect:!1,hasChanged:H4e};Symbol.metadata??=Symbol("metadata"),$4e.litPropertyMetadata??=new WeakMap;var W4e=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=q4e){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&R4e(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=B4e(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??q4e}static _$Ei(){if(this.hasOwnProperty(G4e("elementProperties")))return;let e=L4e(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(G4e("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(G4e("properties"))){let e=this.properties,t=[...N4e(e),...F4e(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(D4e(e))}else void 0!==e&&t.push(D4e(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(E4e)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=P4e.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?V4e:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?V4e:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??H4e)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e
646=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};W4e.elementStyles=[],W4e.shadowRootOptions={mode:"open"},W4e[G4e("elementProperties")]=new Map,W4e[G4e("finalized")]=new Map,z4e?.({ReactiveElement:W4e}),($4e.reactiveElementVersions??=[]).push("2.0.4");var X4e=globalThis,Y4e=X4e.trustedTypes,K4e=Y4e?Y4e.createPolicy("lit-html",{createHTML:e=>e}):void 0,Z4e="$lit$",Q4e=`lit$${Math.random().toFixed(9).slice(2)}$`,J4e="?"+Q4e,e5e=`<${J4e}>`,t5e=document,r5e=()=>t5e.createComment(""),n5e=e=>null===e||"object"!=typeof e&&"function"!=typeof e,i5e=Array.isArray,a5e="[ \t\n\f\r]",o5e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,s5e=/-->/g,u5e=/>/g,c5e=RegExp(`>|${a5e}(?:([^\\s"'>=/]+)(${a5e}*=${a5e}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),l5e=/'/g,d5e=/"/g,f5e=/^(?:script|style|textarea|title)$/i,h5e=(e,...t)=>({_$litType$:1,strings:e,values:t}),p5e=Symbol.for("lit-noChange"),m5e=Symbol.for("lit-nothing"),g5e=new WeakMap,v5e=t5e.createTreeWalker(t5e,129);function y5e(e,t){if(!i5e(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===K4e?t:K4e.createHTML(t)}var b5e=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=o5e;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===o5e?"!--"===s[1]?o=s5e:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=c5e):(f5e.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=c5e):o=u5e:o===c5e?">"===s[0]?(o=r??o5e,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?c5e:'"'===s[3]?d5e:l5e):o===d5e||o===l5e?o=c5e:o===s5e||o===u5e?o=o5e:(o=c5e,r=void 0);let d=o===c5e&&e[t+1].startsWith("/>")?" ":"";
646a+=o===o5e?u+e5e:c>=0?(i.push(n),u.slice(0,c)+Z4e+u.slice(c)+Q4e+d):u+Q4e+(-2===c?t:d)}return[y5e(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),v5e.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=v5e.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Z4e)){let t=l[o++],r=i.getAttribute(e).split(Q4e),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?A5e:"?"===n[1]?C5e:"@"===n[1]?T5e:w5e}),i.removeAttribute(e)}else e.startsWith(Q4e)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(f5e.test(i.tagName)){let e=i.textContent.split(Q4e),t=e.length-1;if(t>0){i.textContent=Y4e?Y4e.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],r5e()),v5e.nextNode(),u.push({type:2,index:++a});i.append(e[t],r5e())}}}else if(8===i.nodeType)if(i.data===J4e)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(Q4e,e+1));)u.push({type:7,index:a}),e+=Q4e.length-1}a++}}static createElement(e,t){let r=t5e.createElement("template");return r.innerHTML=e,r}};function _5e(e,t,r=e,n){if(t===p5e)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=n5e(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=_5e(e,i._$AS(e,t.values),i,n)),t}var x5e=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??t5e).importNode(t,!0);v5e.currentNode=n;let i=v5e.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new S5e(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new P5e(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=v5e.nextNode(),a++)}return v5e.currentNode=t5e,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},S5e=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=m5e,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=_5e(this,e,t),n5e(e)?e===m5e||null==e||""===e?(this._$AH!==m5e&&this._$AR(),this._$AH=m5e):e!==this._$AH&&e!==p5e&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>i5e(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m5e&&n5e(this._$AH)?this._$AA.nextSibling.data=e:this.T(t5e.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=b5e.createElement(y5e(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new x5e(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=g5e.get(e.strings);return void 0===t&&g5e.set(e.strings,t=new b5e(e)),t}k(t){i5e(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(r5e()),this.O(r5e()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},w5e=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=m5e,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=m5e}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=_5e(this,e,t,0),a=!n5e(e)||e!==this._$AH&&e!==p5e,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=_5e(this,s[r+n],t,n),o===p5e&&(o=this._$AH[n]),a||=!n5e(o)||o!==this._$AH[n],o===m5e?e=m5e:e!==m5e&&(e+=(o??"")+i[n+1]
646),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===m5e?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},A5e=class extends w5e{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m5e?void 0:e}},C5e=class extends w5e{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m5e)}},T5e=class extends w5e{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=_5e(this,e,t,0)??m5e)===p5e)return;let r=this._$AH,n=e===m5e&&r!==m5e||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==m5e&&(r===m5e||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},P5e=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){_5e(this,e)}},E5e=X4e.litHtmlPolyfillSupport;E5e?.(b5e,S5e),(X4e.litHtmlVersions??=[]).push("3.2.1");var M5e=class extends W4e{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new S5e(t.insertBefore(r5e(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return p5e}};M5e._$litElement$=!0,M5e.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:M5e});var k5e=globalThis.litElementPolyfillSupport;k5e?.({LitElement:M5e}),(globalThis.litElementVersions??=[]).push("4.1.1");var I5e={attribute:!0,type:String,converter:V4e,reflect:!1,hasChanged:H4e},D5e=(e=I5e,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function O5e(e){return(t,r)=>"object"==typeof r?D5e(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}var R5e,B5e,N5e,F5e,L5e,$5e,U5e,j5e={curveLinear:a4e,curveLinearClosed:function(e){return new m4e(e)},curveMonotoneX:function(e){return new _4e(e)},curveMonotoneY:function(e){return new x4e(e)},curveBasis:function(e){return new d4e(e)},curveCardinal:p4e,curveStep:function(e){return new C4e(e,.5)},curveStepAfter:function(e){return new C4e(e,1)},curveStepBefore:function(e){return new C4e(e,0)},curveNatural:function(e){return new w4e(e)}},z5e=class extends(bu(Tu(gu(pu(du(ei(wu(_c)))))))){constructor(){super(),R5e.set(this,void 0),B5e.set(this,void 0),N5e.set(this,void 0),F5e.set(this,void 0),L5e.set(this,void 0),$5e.set(this,void 0),U5e.set(this,void 0),this.yScale=J3e()}connectedCallback(){super.connectedCallback(),$Je(this,F5e,"f")&&this.createTrack()}set data(e){UJe(this,F5e,e,"f"),this.createTrack()}get data(){return $Je(this,F5e,"f")}createTrack(){var e;if(!$Je(this,F5e,"f")||(null==(e=this.svg)||e.selectAll("g").remove(),this.svg=function(e){return"string"==typeof e?new h1e([[document.querySelector(e)]],[document.documentElement]):new h1e([[e]],f1e)}(this).selectAll("svg").attr("width",this.width).attr("height",this.height),!this.svg))return;UJe(this,R5e,this.svg.append("g").attr("class","highlighted"),"f"),UJe(this,B5e,this.svg.append("g").attr("class","margin"),"f");let t=[],r=[],n=[];
646$Je(this,F5e,"f").forEach(e=>{t.push(...e.range),r.push(QJe(e.values,e=>e.position)||1/0),n.push(ZJe(e.values,e=>e.position)||-1/0)}),UJe(this,L5e,QJe(t)||0,"f"),UJe(this,$5e,ZJe(t)||0,"f");let i=QJe(r)||0,a=ZJe(n)||this.length||0,o=this.svg.append("g").attr("class","chart-group");this._initYScale(),UJe(this,N5e,o.selectAll(".chart").data($Je(this,F5e,"f")).enter().append("g").attr("class","chart"),"f"),$Je(this,N5e,"f").append("path").attr("class","graph").attr("id",e=>e.name).attr("d",e=>(e.color=e.color||function(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return e4e.h=360*e-100,e4e.s=1.5-1.5*t,e4e.l=.8-.9*t,e4e+""}(Math.random()),e.fill=e.fill||"none",this.drawLine(e)(e.values))).attr("fill",e=>e.fill||null).attr("stroke",e=>e.color||null).attr("transform","translate(0,0)");let s=o.append("g").attr("class","mouse-over-effects"),u=o.selectAll("path.graph"),c=s.selectAll(".mouse-per-line").data($Je(this,F5e,"f")).enter().append("g").attr("class","mouse-per-line");c.append("circle").attr("r",7).style("stroke",e=>e.color||null).style("fill","none").style("stroke-width","1px").style("opacity","0"),c.append("text").attr("transform","translate(10,0)").attr("pointer-events","none");let l=e=>{o.selectAll(".mouse-per-line circle").style("opacity","0"),o.selectAll(".mouse-per-line text").style("opacity","0");
646let t={eventtype:"mouseout",feature:void 0,type:this.type,target:this,parentEvent:e};this["highlight-on-click"]||(t.highlight=""),this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,cancelable:!0}))};UJe(this,U5e,s.append("rect").attr("width",this.width).attr("height",this.height).attr("fill","none").attr("pointer-events","all").on("mouseout",l).on("mousemove",e=>{let t=m1e(e);if(t[0]<(this.xScale?.call(this,i)||0)+this["margin-left"]||t[0]>(this.xScale?.call(this,a)||0)+this.getSingleBaseWidth()+this["margin-left"])return l(e);let r={},n=Math.floor(this.xScale?.invert(t[0]-this["margin-left"])||0);o.selectAll(".mouse-per-line circle").style("opacity",e=>{let t=e.values.find(e=>e.position===n);return t&&t.value?"1":"0"}),o.selectAll(".mouse-per-line text").style("opacity","1"),o.selectAll(".mouse-per-line text").text(e=>{let t=e.values.find(e=>e.position===n);r[e.name]=t;let i=t?`${e.name}${1===t.value?"":"s"}`:"";return this["show-label-name"]?t?`${t.value} ${i}`:"":t?t.value:""}),o.selectAll(".mouse-per-line").attr("transform",(e,r)=>{let n,i=0,a=u.nodes()[r].getTotalLength();for(;;){let e=Math.floor((i+a)/2);if(n=u.nodes()[r].getPointAtLength(e),(e===a||e===i)&&n.x!==t[0])break;if(n.x>t[0])a=e;else{if(!(n.x<t[0]))break;i=e}}return`translate(${t[0]},${n?.y||0})`});let s={eventtype:"mouseover",feature:r,type:this.type,target:this,parentEvent:e};this["highlight-on-click"]||(s.highlight=`${n}:${n}`),this.dispatchEvent(new CustomEvent("change",{detail:s,bubbles:!0,cancelable:!0}))}).on("click",e=>{let t=m1e(e),r=Math.floor(this.xScale?.invert(t[0]-this["margin-left"])||0),n={eventtype:"click",feature:void 0,type:this.t
646ype,target:this,parentEvent:e};this["highlight-on-click"]&&(n.highlight=`${r}:${r}`),this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,cancelable:!0}))}),"f")}refresh(){var e;$Je(this,N5e,"f")&&($Je(this,N5e,"f").selectAll("path.graph").attr("d",e=>this.drawLine(e)(e.values)),null==(e=this.svg)||e.attr("width",this.width),this.updateHighlight(),this.renderMarginOnGroup($Je(this,B5e,"f")))}onDimensionsChange(){var e;super.onDimensionsChange(),null==(e=$Je(this,U5e,"f"))||e.attr("width",this.width).attr("height",this.height)}_initYScale(){var e;null==(e=this.yScale)||e.domain([$Je(this,L5e,"f")||0,$Je(this,$5e,"f")||0]).range([this.height,0])}drawLine(e){let t,r=e.lineCurve||"curveLinear";return t="none"===e.fill?u4e().y(e=>this.yScale?.call(this,e.value)||0):function(e,t,r){var n=null,i=t4e(!0),a=null,o=a4e,s=null,u=r4e(c);function c(c){var l,d,f,h,p,m=(c=n4e(c)).length,g=!1,v=Array(m),y=Array(m);for(a??(s=o(p=u())),l=0;l<=m;++l){if(!(l<m&&i(h=c[l],l,c))===g)if(g=!g)d=l,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=l-1;f>=d;--f)s.point(v[f],y[f]);s.lineEnd(),s.areaEnd()}g&&(v[l]=+e(h,l,c),y[l]=+t(h,l,c),s.point(n?+n(h,l,c):v[l],r?+r(h,l,c):y[l]))}if(p)return s=null,p+""||null}function l(){return u4e().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?o4e:t4e(+e),t="function"==typeof t?t:t4e(void 0===t?0:+t),r="function"==typeof r?r:void 0===r?s4e:t4e(+r),c.x=function(t){return arguments.length?(e="function"==typeof t?t:t4e(+t),n=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:t4e(+t),c):e},c.x1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:t4e(+e),c):n},c.y=function(e){return arguments.length?(t="function"==typeof e?e:t4e(+e),r=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:t4e(+e),c):t},c.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:t4e(+e),c):r},c.lineX0=c.lineY0=function(){return l().x(e).y(t)},c.lineY1=function(){return l().x(e).y(r)},c.lineX1=function(){return l().x(n).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:t4e(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}().y1(e=>this.yScale?.call(this,e.value)||0).y0(()=>this.yScale?.call(this,0)||0),t.defined(e=>null!==e.value).x((e,t,r)=>{let n=this.getSingleBaseWidth()/2;return 0===t||null===r[t-1]?.value?n=this.getSingleBaseWidth():t+1!==r.length&&null!==r[t+1]?.value||(n=0),this.getXFromSeqPosition(e.position+1)-n}).curve(j5e[r]||a4e)}updateHighlight(){if(!$Je(this,R5e,"f"))return;let e=$Je(this,R5e,"f").selectAll("rect").data(this.highlightedRegion.segments);e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",this["highlight-color"]).attr("height",this.height).attr("x",e=>this.getXFromSeqPosition(e.start)).attr("width",e=>this.getSingleBaseWidth()*(e.end-e.start+1)),e.exit().remove()}zoomRefreshed(){this.refresh()}firstUpdated(){this.createTrack()}render(){return h5e`<svg class="container"></svg>`}};R5e=new WeakMap,B5e=new WeakMap,N5e=new WeakMap,F5e=new WeakMap,L5e=new WeakMap,$5e=new WeakMap,U5e=new WeakMap,LJe([O5e({type:String})],z5e.prototype,"type",void 0),LJe([O5e({type:Boolean})],z5e.prototype,"show-label-name",void 0),LJe([O5e({type:Boolean})],z5e.prototype,"highlight-on-click",void 0),z5e=LJe([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-linegraph-track")],z5e);var G5e=z5e,V5e=function(e,t){return V5e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},V5e(e,t)};function H5e(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}V5e(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var q5e=function(){return q5e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},q5e.apply(this,arguments)};function W5e(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function X5e(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function Y5e(e,t){return function(r,n){t(r,n,e)}}function K5e(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function Z5e(e,t,r,n){return new(r||=Promise)(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})}function Q5e(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var J5e=Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);
646i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function e6e(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||J5e(t,e,r)}function t6e(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r6e(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function n6e(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r6e(arguments[t]));return e}function i6e(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}function a6e(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||=Array.prototype.slice.call(t,0,i),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function o6e(e){return this instanceof o6e?(this.v=e,this):new o6e(e)}function s6e(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),a=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(e){i[e]&&(n[e]=function(t){return new Promise(function(r,n){a.push([e,t,r,n])>1||s(e,t)})})}function s(e,t){try{!function(e){e.value instanceof o6e?Promise.resolve(e.value.v).then(u,c):l(a[0][2],e)}(i[e](t))}catch(e){l(a[0][3],e)}}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function u6e(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:o6e(e[n](t)),done:!1}:i?i(t):t}:i}}function c6e(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=t6e(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}}function l6e(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var d6e=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function f6e(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&J5e(t,e,r);return d6e(t,e),t}function h6e(e){return e&&e.__esModule?e:{default:e}}function p6e(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function m6e(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function g6e(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function v6e(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var y6e="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function b6e(e){function t(t){e.error=e.hasError?new y6e(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var i=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(i).then(r,function(e){return t(e),r()})}catch(e){t(e)}}if(e.hasError)throw e.error}()}var _6e=Object.freeze({__proto__:null,__addDisposableResource:v6e,get __assign(){return q5e},__asyncDelegator:u6e,__asyncGenerator:s6e,__asyncValues:c6e,__await:o6e,__awaiter:Z5e,__classPrivateFieldGet:p6e,__classPrivateFieldIn:g6e,__classPrivateFieldSet:m6e,__createBinding:J5e,__decorate:X5e,__disposeResources:b6e,__esDecorate:function(e,t,r,n,i,a){function o(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,u=n.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),f=!1,h=r.length-1;h>=0;h--){var p={};for(var m in n)p[m]="access"===m?{}:n[m];for(var m in n.access)p.access[m]=n.access[m];p.addInitializer=function(e){if(f)throw TypeError("Cannot add initializer
646s after decoration has completed");a.push(o(e||null))};var g=(0,r[h])("accessor"===u?{get:d.get,set:d.set}:d[c],p);if("accessor"===u){if(void 0===g)continue;if("object"!=typeof g||!g)throw TypeError("Object expected");(s=o(g.get))&&(d.get=s),(s=o(g.set))&&(d.set=s),(s=o(g.init))&&i.unshift(s)}else(s=o(g))&&("field"===u?i.unshift(s):d[c]=s)}l&&Object.defineProperty(l,n.name,d),f=!0},__exportStar:e6e,__extends:H5e,__generator:Q5e,__importDefault:h6e,__importStar:f6e,__makeTemplateObject:l6e,__metadata:K5e,__param:Y5e,__propKey:function(e){return"symbol"==typeof e?e:`${e}`},__read:r6e,__rest:W5e,__runInitializers:function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},__setFunctionName:function(e,t,r){return"symbol"==typeof t&&(t=t.description?`[${t.description}]`:""),Object.defineProperty(e,"name",{configurable:!0,value:r?`${r} ${t}`:t})},__spread:n6e,__spreadArray:a6e,__spreadArrays:i6e,__values:t6e,default:{__extends:H5e,__assign:q5e,__rest:W5e,__decorate:X5e,__param:Y5e,__metadata:K5e,__awaiter:Z5e,__generator:Q5e,__createBinding:J5e,__exportStar:e6e,__values:t6e,__read:r6e,__spread:n6e,__spreadArrays:i6e,__spreadArray:a6e,__await:o6e,__asyncGenerator:s6e,__asyncDelegator:u6e,__asyncValues:c6e,__makeTemplateOb
646ject:l6e,__importStar:f6e,__importDefault:h6e,__classPrivateFieldGet:p6e,__classPrivateFieldSet:m6e,__classPrivateFieldIn:g6e,__addDisposableResource:v6e,__disposeResources:b6e}});function x6e(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function S6e(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function w6e(e){let t,r,n;function i(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<0?i=t+1:a=t}while(i<a)}return i}return 2===e.length?(t=e===x6e||e===S6e?e:A6e,r=e,n=e):(t=x6e,r=(t,r)=>x6e(e(t),r),n=(t,r)=>e(t)-r),{left:i,center:function(e,t,r=0,a=e.length){let o=i(e,t,r,a-1);return o>r&&n(e[o-1],t)>-n(e[o],t)?o-1:o},right:function(e,n,i=0,a=e.length){if(i<a){if(0!==t(n,n))return a;do{let t=i+a>>>1;r(e[t],n)<=0?i=t+1:a=t}while(i<a)}return i}}}function A6e(){return 0}function C6e(e){return null===e?NaN:+e}var T6e=w6e(x6e).right;w6e(C6e).center;var P6e=class extends Map{constructor(e,t=M6e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(let[t,r]of e)this.set(t,r)}get(e){return super.get(E6e(this,e))}has(e){return super.has(E6e(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}(this,e))}};function E6e({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function M6e(e){return"object"==typeof e&&e?e.valueOf():e}function k6e(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}var I6e=Math.sqrt(50),D6e=Math.sqrt(10),O6e=Math.sqrt(2);function R6e(e,t,r){let n,i,a,o=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(o)),u=o/10**s,c=u>=I6e?10:u>=D6e?5:u>=O6e?2:1;return s<0?(a=10**-s/c,n=Math.round(e*a),i=Math.round(t*a),n/a<e&&++n,i/a>t&&--i,a=-a):(a=10**s*c,n=Math.round(e/a),i=Math.round(t/a),n*a<e&&++n,i*a>t&&--i),i<n&&.5<=r&&r<2?R6e(e,t,2*r):[n,i,a]}function B6e(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];let n=t<e,[i,a,o]=n?R6e(t,e,r):R6e(e,t,r);if(!(a>=i))return[];let s=a-i+1,u=Array(s);if(n)if(o<0)for(let e=0;e<s;++e)u[e]=(a-e)/-o;else for(let e=0;e<s;++e)u[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)u[e]=(i+e)/-o;else for(let e=0;e<s;++e)u[e]=(i+e)*o;return u}function N6e(e,t,r){return R6e(e=+e,t=+t,r=+r)[2]}function F6e(e,t,r){r=+r;let n=(t=+t)<(e=+e),i=n?N6e(t,e,r):N6e(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function L6e(e,t){let r;for(let t of e)null!=t&&(r<t||void 0===r&&t>=t)&&(r=t);return r}function $6e(e,t){let r;for(let t of e)null!=t&&(r>t||void 0===r&&t>=t)&&(r=t);return r}function U6e(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=void 0===i?k6e:function(e=x6e){if(e===x6e)return k6e;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||0===n?n:(0===e(r,r))-(0===e(t,t))}}(i);n>r;){if(n-r>600){let a=n-r+1,o=t-r+1,s=Math.log(a),u=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*u*(a-u)/a)*(o-a/2<0?-1:1);U6e(e,t,Math.max(r,Math.floor(t-o*u/a+c)),Math.min(n,Math.floor(t+(a-o)*u/a+c)),i)}let a=e[t],o=r,s=n;for(j6e(e,r,t),i(e[n],a)>0&&j6e(e,r,n);o<s;){for(j6e(e,o,s),++o,--s;i(e[o],a)<0;)++o;for(;i(e[s],a)>0;)--s}0===i(e[r],a)?j6e(e,r,s):(++s,j6e(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function j6e(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function z6e(e,t,r=C6e){if((n=e.length)&&!isNaN(t=+t)){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e);return o+(+r(e[a+1],a+1,e)-o)*(i-a)}}var G6e={value:()=>{}};function V6e(){for(var e,t=0,r=arguments.length,n={};t<r;++t){if(!(e=arguments[t]+"")||e in n||/[\s.]/.test(e))throw Error("illegal type: "+e);n[e]=[]}return new H6e(n)}function H6e(e){this._=e}function q6e(e,t){for(var r,n=0,i=e.length;n<i;++n)if((r=e[n]).name===t)return r.value}function W6e(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=G6e,e=e.slice(0,n).concat(e.slice(n+1));break}return null!=r&&e.push({name:t,value:r}),e}H6e.prototype=V6e.prototype={constructor:H6e,on:function(e,t){var r,n=this._,i=function(e,t){return e.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");if(n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),e&&!t.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:r}})}(e+"",n),a=-1,o=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++a<o;)if(r=(e=i[a]).type)n[r]=W6e(n[r],e.name,t);else if(null==t)for(r in n)n[r]=W6e(n[r],e.name,null);return this}for(;++a<o;)if((r=(e=i[a]).type)&&(r=q6e(n[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new H6e(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,n,i=Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(a=0,r=(n=this._[e]).length;a<r;++a)n[a].value.apply(t,i)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};var X6e="http://www.w3.org/1999/xhtml",Y6e={svg:"http://www.w3.org/2000/svg",xhtml:X6e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function K6e(e){var t=e+="",r=t.indexOf(":");return r>=0&&"xmlns"!==(t=e.slice(0,r))&&(e=e.slice(r+1)),Y6e.hasOwnProperty(t)?{space:Y6e[t],local:e}:e}function Z6e(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===X6e&&t.documentElement.namespaceURI===X6e?t.createElement(e):t.createElementNS(r,e)}}function Q6e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function J6e(e){var t=K6e(e);return(t.local?Q6e:Z6e)(t)}function e8e(){}function t8e(e){return null==e?e8e:function(){return this.querySelector(e)}}function r8e(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}function n8e(){return[]}function i8e(e){return null==e?n8e:function(){return this.querySelectorAll(e)}}function a8e(e){return function(){return this.matches(e)}}function o8e(e){return function(t){return t.matches(e)}}var s8e=Array.prototype.find;function u8e(){return this.firstElementChild}var c8e=Array.prototype.filter;function l8e(){return Array.from(this.children)}function d8e(e){return Array(e.length)}function f8e(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}
vendor: 13,011 bytes, line 646
646function h8e(e,t,r,n,i,a){for(var o,s=0,u=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],n[s]=o):r[s]=new f8e(e,a[s]);for(;s<u;++s)(o=t[s])&&(i[s]=o)}function p8e(e,t,r,n,i,a,o){var s,u,c,l=new Map,d=t.length,f=a.length,h=Array(d);for(s=0;s<d;++s)(u=t[s])&&(h[s]=c=o.call(u,u.__data__,s,t)+"",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<f;++s)c=o.call(e,a[s],s,a)+"",(u=l.get(c))?(n[s]=u,u.__data__=a[s],l.delete(c)):r[s]=new f8e(e,a[s]);for(s=0;s<d;++s)(u=t[s])&&l.get(h[s])===u&&(i[s]=u)}function m8e(e){return e.__data__}function g8e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function v8e(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function y8e(e){return function(){this.removeAttribute(e)}}function b8e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _8e(e,t){return function(){this.setAttribute(e,t)}}function x8e(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function S8e(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttribute(e):this.setAttribute(e,r)}}function w8e(e,t){return function(){var r=t.apply(this,arguments);null==r?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function A8e(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function C8e(e){return function(){this.style.removeProperty(e)}}function T8e(e,t,r){return function(){this.style.setProperty(e,t,r)}}function P8e(e,t,r){return function(){var n=t.apply(this,arguments);null==n?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function E8e(e,t){return e.style.getPropertyValue(t)||A8e(e).getComputedStyle(e,null).getPropertyValue(t)}function M8e(e){return function(){delete this[e]}}function k8e(e,t){return function(){this[e]=t}}function I8e(e,t){return function(){var r=t.apply(this,arguments);null==r?delete this[e]:this[e]=r}}function D8e(e){return e.trim().split(/^|\s+/)}function O8e(e){return e.classList||new R8e(e)}function R8e(e){this._node=e,this._names=D8e(e.getAttribute("class")||"")}function B8e(e,t){for(var r=O8e(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function N8e(e,t){for(var r=O8e(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function F8e(e){return function(){B8e(this,e)}}function L8e(e){return function(){N8e(this,e)}}function $8e(e,t){return function(){(t.apply(this,arguments)?B8e:N8e)(this,e)}}function U8e(){this.textContent=""}function j8e(e){return function(){this.textContent=e}}function z8e(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function G8e(){this.innerHTML=""}function V8e(e){return function(){this.innerHTML=e}}function H8e(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function q8e(){this.nextSibling&&this.parentNode.appendChild(this)}function W8e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function X8e(){return null}function Y8e(){var e=this.parentNode;e&&e.removeChild(this)}function K8e(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Z8e(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Q8e(e){return function(){var t=this.__on;if(t){for(var r,n=0,i=-1,a=t.length;n<a;++n)r=t[n],e.type&&r.type!==e.type||r.name!==e.name?t[++i]=r:this.removeEventListener(r.type,r.listener,r.options);++i?t.length=i:delete this.__on}}}function J8e(e,t,r){return function(){var n,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((n=i[o]).type===e.type&&n.name===e.name)return this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=a,n.options=r),void(n.value=t);this.addEventListener(e.type,a,r),n={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(n):this.__on=[n]}}function e7e(e,t,r){var n=A8e(e),i=n.CustomEvent;"function"==typeof i?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function t7e(e,t){return function(){return e7e(this,e,t)}}function r7e(e,t){return function(){return e7e(this,e,t.apply(this,arguments))}}f8e.prototype={constructor:f8e,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},R8e.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var n7e=[null];function i7e(e,t){this._groups=e,this._parents=t}function a7e(){return new i7e([[document.documentElement]],n7e)}function o7e(e){return"string"==typeof e?new i7e([[document.querySelector(e)]],[document.documentElement]):new i7e([[e]],n7e)}i7e.prototype=a7e.prototype={constructor:i7e,select:function(e){"function"!=typeof e&&(e=t8e(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o,s=t[i],u=s.length,c=n[i]=Array(u),l=0;l<u;++l)(a=s[l])&&(o=e.call(a,a.__data__,l,s))&&("__data__"in a&&(o.__data__=a.__data__),c[l]=o);return new i7e(n,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return r8e(e.apply(this,arguments))}}(e):i8e(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o,s=t[a],u=s.length,c=0;c<u;++c)(o=s[c])&&(n.push(e.call(o,o.__data__,c,s)),i.push(o));return new i7e(n,i)},selectChild:function(e){return this.select(null==e?u8e:function(e){return function(){return s8e.call(this.children,e)}}("function"==typeof e?e:o8e(e)))},selectChildren:function(e){return this.selectAll(null==e?l8e:function(e){return function(){return c8e.call(this.children,e)}}("function"==typeof e?e:o8e(e)))},filter:function(e){"function"!=typeof e&&(e=a8e(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new i7e(n,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,m8e);var r=t?p8e:h8e,n=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=Array(a),s=Array(a),u=Array(a),c=0;c<a;++c){var l=n[c],d=i[c],f=d.length,h=g8e(e.call(l,l&&l.__data__,c,n)),p=h.length,m=s[c]=Array(p),g=o[c]=Array(p);r(l,d,m,g,u[c]=Array(f),h,t);for(var v,y,b=0,_=0;b<p;++b)if(v=m[b]){for(b>=_&&(_=b+1);!(y=g[_])&&++_<p;);v._next=y||null}}return(o=new i7e(o,n))._enter=s,o._exit=u,o},enter:function(){return new i7e(this._enter||this._groups.map(d8e),this._parents)},exit:function(){return new i7e(this._exit||this._groups.map(d8e),this._parents)},join:function(e,t,r){var n=this.enter(),i=this,a=this.exit();return"function"==typeof e?(n=e(n))&&(n=n.selection()):n=n.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==r?a.remove():r(a),n&&i?n.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=Array(i),u=0;u<o;++u)for(var c,l=r[u],d=n[u],f=l.length,h=s[u]=Array(f),p=0;p<f;++p)(c=l[p]||d[p])&&(h[p]=c);for(;u<i;++u)s[u]=r[u];return new i7e(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n,i=e[t],a=i.length-1,o=i[a];--a>=0;)(n=i[a])&&(o&&4^n.compareDocumentPosition(o)&&o.parentNode.insertBefore(n,o),o=n);return this},sort:function(e){function t(t,r){return t&&r?e(t.__data__,r.__data__):!t-!r}e||=v8e;for(var r=this._groups,n=r.length,i=Array(n),a=0;a<n;++a){for(var o,s=r[a],u=s.length,c=i[a]=Array(u),l=0;l<u;++l)(o=s[l])&&(c[l]=o);c.sort(t)}return new i7e(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i,a=t[r],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var r=K6e(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((null==t?r.local?b8e:y8e:"function"==typeof t?r.local?w8e:S8e:r.local?x8e:_8e)(r,t))},style:function(e,t,r){return arguments.length>1?this.each((null==t?C8e:"function"==typeof t?P8e:T8e)(e,t,r??"")):E8e(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?M8e:"function"==typeof t?I8e:k8e)(e,t)):this.node()[e]},classed:function(e,t){var r=D8e(e+"");if(arguments.length<2){for(var n=O8e(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each(("function"==typeof t?$8e:t?F8e:L8e)(r,t))},text:function(e){return arguments.length?this.each(null==e?U8e:("function"==typeof e?z8e:j8e)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?G8e:("function"==typeof e?H8e:V8e)(e)):this.node().innerHTML},raise:function(){return this.each(q8e)},lower:function(){return this.each(W8e)},append:function(e){var t="function"==typeof e?e:J6e(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var r="function"==typeof e?e:J6e(e),n=null==t?X8e:"function"==typeof t?t:t8e(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(Y8e)},clone:function(e){return this.select(e?Z8e:K8e)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,r){var n,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",r=e.indexOf(".");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?J8e:Q8e,n=0;n<o;++n)this.each(s(a[n],t,r));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(n=0,u=s[c];n<o;++n)if((i=a[n]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?r7e:t7e)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n,i=e[t],a=0,o=i.length;a<o;++a)(n=i[a])&&(yield n)}};var s7e=0;function u7e(){return new c7e}function c7e(){this._="@"+(++s7e).toString(36)}function l7e(e){let t;for(;t=e.sourceEvent;)e=t;return e}function d7e(e,t){if(e=l7e(e),void 0===t&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}c7e.prototype=u7e.prototype={constructor:c7e,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};var f7e=Object.freeze({__proto__:null,create:function(e){return o7e(J6e(e).call(document.documentElement))},creator:J6e,local:u7e,matcher:a8e,namespace:K6e,namespaces:Y6e,pointer:d7e,pointers:function(e,t){return e.target&&(e=l7e(e),void 0===t&&(t=e.currentTarget),e=e.touches||[e]),Array.from(e,e=>d7e(e,t))},select:o7e,selectAll:function(e){return"string"==typeof e?new i7e([document.querySelectorAll(e)],[document.documentElement]):new i7e([r8e(e)],n7e)},selection:a7e,selector:t8e,selectorAll:i8e,style:E8e,window:A8e}),h7e={capture:!0,passive:!1};function p7e(e){e.preventDefault(),e.stopImmediatePropagation()}function m7e(e){var t=e.document.documentElement,r=o7e(e).on("dragstart.drag",p7e,h7e);"onselectstart"in t?r.on("selectstart.drag",p7e,h7e):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function g7e(e,t){var r=e.document.documentElement,n=o7e(e).on("dragstart.drag",null);t&&(n.on("click.drag",p7e,h7e),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function v7e(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function y7e(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function b7e(){}var _7e=.7,x7e=1/_7e,S7e="\\s*([+-]?\\d+)\\s*",w7e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",A7e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",C7e=/^#([0-9a-f]{3,8})$/,T7e=RegExp(`^rgb\\(${S7e},${S7e},${S7e}\\)$`),P7e=RegExp(`^rgb\\(${A7e},${A7e},${A7e}
646\\)$`),E7e=RegExp(`^rgba\\(${S7e},${S7e},${S7e},${w7e}\\)$`),M7e=RegExp(`^rgba\\(${A7e},${A7e},${A7e},${w7e}\\)$`),k7e=RegExp(`^hsl\\(${w7e},${A7e},${A7e}\\)$`),I7e=RegExp(`^hsla\\(${w7e},${A7e},${A7e},${w7e}\\)$`),D7e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function O7e(){return this.rgb().formatHex()}function R7e(){return this.rgb().formatRgb()}function B7e(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=C7e.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?N7e(t):3===r?new U7e(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?F7e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?F7e(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=T7e.exec(e))?new U7e(t[1],t[2],t[3],1):(t=P7e.exec(e))?new U7e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=E7e.exec(e))?F7e(t[1],t[2],t[3],t[4]):(t=M7e.exec(e))?F7e(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=k7e.exec(e))?q7e(t[1],t[2]/100,t[3]/100,1):(t=I7e.exec(e))?q7e(t[1],t[2]/100,t[3]/100,t[4]):D7e.hasOwnProperty(e)?N7e(D7e[e]):"transparent"===e?new U7e(NaN,NaN,NaN,0):null}function N7e(e){return new U7e(e>>16&255,e>>8&255,255&e,1)}function F7e(e,t,r,n){return n<=0&&(e=t=r=NaN),new U7e(e,t,r,n)}function L7e(e){return e instanceof b7e||(e=B7e(e)),e?new U7e((e=e.rgb()).r,e.g,e.b,e.opacity):new U7e}function $7e(e,t,r,n){return 1===arguments.length?L7e(e):new U7e(e,t,r,n??1)}function U7e(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function j7e(){return`#${H7e(this.r)}${H7e(this.g)}${H7e(this.b)}`}function z7e(){let e=G7e(this.opacity);return`${1===e?"rgb(":"rgba("}${V7e(this.r)}, ${V7e(this.g)}, ${V7e(this.b)}${1===e?")":`, ${e})`}`}function G7e(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function V7e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function H7e(e){return((e=V7e(e))<16?"0":"")+e.toString(16)}function q7e(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Y7e(e,t,r,n)}function W7e(e){if(e instanceof Y7e)return new Y7e(e.h,e.s,e.l,e.opacity);if(e instanceof b7e||(e=B7e(e)),!e)return new Y7e;if(e instanceof Y7e)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(o=t===a?(r-n)/s+6*(r<n):r===a?(n-t)/s+2:(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new Y7e(o,s,u,e.opacity)}function X7e(e,t,r,n){return 1===arguments.length?W7e(e):new Y7e(e,t,r,n??1)}function Y7e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function K7e(e){return(e=(e||0)%360)<0?e+360:e}function Z7e(e){return Math.max(0,Math.min(1,e||0))}function Q7e(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}v7e(b7e,B7e,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:O7e,formatHex:O7e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return W7e(this).formatHsl()},formatRgb:R7e,toString:R7e}),v7e(U7e,$7e,y7e(b7e,{brighter(e){return e=null==e?x7e:x7e**+e,new U7e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?_7e:_7e**+e,new U7e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new U7e(V7e(this.r),V7e(this.g),V7e(this.b),G7e(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:j7e,formatHex:j7e,formatHex8:function(){return`#${H7e(this.r)}${H7e(this.g)}${H7e(this.b)}${H7e(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:z7e,toString:z7e})),v7e(Y7e,X7e,y7e(b7e,{brighter(e){return e=null==e?x7e:x7e**+e,new Y7e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?_7e:_7e**+e,new Y7e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new U7e(Q7e(e>=240?e-240:e+120,i,n),Q7e(e,i,n),Q7e(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Y7e(K7e(this.h),Z7e(this.s),Z7e(this.l),G7e(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=G7e(this.opacity);return`${1===e?"hsl(":"hsla("}${K7e(this.h)}, ${100*Z7e(this.s)}%, ${100*Z7e(this.l)}%${1===e?")":`, ${e})`}`}}));var J7e=Math.PI/180,e9e=180/Math.PI,t9e=.96422,r9e=.82521,n9e=4/29,i9e=6/29,a9e=3*i9e*i9e,o9e=i9e*i9e*i9e;function s9e(e){if(e instanceof c9e)return new c9e(e.l,e.a,e.b,e.opacity);if(e instanceof g9e)return v9e(e);e instanceof U7e||(e=L7e(e));var t,r,n=h9e(e.r),i=h9e(e.g),a=h9e(e.b),o=l9e((.2225045*n+.7168786*i+.0606169*a)/1);return n===i&&i===a?t=r=o:(t=l9e((.4360747*n+.3850649*i+.1430804*a)/t9e),r=l9e((.0139322*n+.0971045*i+.7141733*a)/r9e)),new c9e(116*o-16,500*(t-o),200*(o-r),e.opacity)}function u9e(e,t,r,n){return 1===arguments.length?s9e(e):new c9e(e,t,r,n??1)}function c9e(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}function l9e(e){return e>o9e?e**(1/3):e/a9e+n9e}function d9e(e){return e>i9e?e*e*e:a9e*(e-n9e)}function f9e(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function h9e(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function p9e(e){if(e instanceof g9e)return new g9e(e.h,e.c,e.l,e.opacity);if(e instanceof c9e||(e=s9e(e)),0===e.a&&0===e.b)return new g9e(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*e9e;return new g9e(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function m9e(e,t,r,n){return 1===arguments.length?p9e(e):new g9e(e,t,r,n??1)}function g9e(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function v9e(e){if(isNaN(e.h))return new c9e(e.l,0,0,e.opacity);var t=e.h*J7e;return new c9e(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}v7e(c9e,u9e,y7e(b7e,{brighter(e){return new c9e(this.l+18*(e??1),this.a,this.b,this.opacity)},darker(e){return new c9e(this.l-18*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return new U7e(f9e(3.1338561*(t=t9e*d9e(t))-1.6168667*(e=1*d9e(e))-.4906146*(r=r9e*d9e(r))),f9e(-.9787684*t+1.9161415*e+.033454*r),f9e(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}})),v7e(g9e,m9e,y7e(b7e,{brighter(e){return new g9e(this.h,this.c,this.l+18*(e??1),this.opacity)},darker(e){return new g9e(this.h,this.c,this.l-18*(e??1),this.opacity)},rgb(){return v9e(this).rgb()}}));var y9e=-.14861,b9e=1.78277,_9e=-.29227,x9e=-.90649,S9e=1.97294,w9e=S9e*x9e,A9e=S9e*b9e,C9e=b9e*_9e-x9e*y9e;function T9e(e,t,r,n){return 1===arguments.length?function(e){if(e instanceof P9e)return new P9e(e.h,e.s,e.l,e.opacity);e instanceof U7e||(e=L7e(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(C9e*n+w9e*t-A9e*r)/(C9e+w9e-A9e),a=n-i,o=(S9e*(r-i)-_9e*a)/x9e,s=Math.sqrt(o*o+a*a)/(S9e*i*(1-i)),u=s?Math.atan2(o,a)*e9e-120:NaN;return new P9e(u<0?u+360:u,s,i,e.opacity)}(e):new P9e(e,t,r,n??1)}function P9e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}v7e(P9e,T9e,y7e(b7e,{brighter(e){return e=null==e?x7e:x7e**+e,new P9e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?_7e:_7e**+e,new P9e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*J7e,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new U7e(255*(t+r*(y9e*n+b9e*i)),255*(t+r*(_9e*n+x9e*i)),255*(t+S9e*n*r),this.opacity)}}));var E9e=Object.freeze({__proto__:null,color:B7e,cubehelix:T9e,gray:function(e,t){return new c9e(e,0,0,t??1)},hcl:m9e,hsl:X7e,lab:u9e,lch:function(e,t,r,n){return 1===arguments.length?p9e(e):new g9e(r,t,e,n??1)},rgb:$7e}),M9e=e=>()=>e;function k9e(e,t){return function(r){return e+r*t}}function I9e(e,t){var r=t-e;return r?k9e(e,r):M9e(isNaN(e)?t:e)}var D9e,O9e=function e(t){var r=function(e){return 1==(e=+e)?I9e:function(t,r){return r-t?function(e,t,r){return t=t**+r-(e**=+r),r=1/r,function(n){return(e+n*t)**+r}}(t,r,e):M9e(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=$7e(e)).r,(t=$7e(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=I9e(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return n.gamma=e,n}(1),R9e=(D9e=function(e){var t=e.length-1;
646return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],a=e[n+1],o=n>0?e[n-1]:2*i-a,s=n<t-1?e[n+2]:2*a-i;return function(e,t,r,n,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*r+(1+3*e+3*a-3*o)*n+o*i)/6}((r-n/t)*t,o,i,a,s)}},function(e){var t,r,n=e.length,i=Array(n),a=Array(n),o=Array(n);for(t=0;t<n;++t)r=$7e(e[t]),i[t]=r.r||0,a[t]=r.g||0,o[t]=r.b||0;return i=D9e(i),a=D9e(a),o=D9e(o),r.opacity=1,function(e){return r.r=i(e),r.g=a(e),r.b=o(e),r+""}});function B9e(e,t){t||=[];var r,n=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(r=0;r<n;++r)i[r]=e[r]*(1-a)+t[r]*a;return i}}function N9e(e,t){var r,n=t?t.length:0,i=e?Math.min(n,e.length):0,a=Array(i),o=Array(n);for(r=0;r<i;++r)a[r]=G9e(e[r],t[r]);for(;r<n;++r)o[r]=t[r];return function(e){for(r=0;r<i;++r)o[r]=a[r](e);return o}}function F9e(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function L9e(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function $9e(e,t){var r,n={},i={};for(r in"object"==typeof e&&e||(e={}),"object"==typeof t&&t||(t={}),t)r in e?n[r]=G9e(e[r],t[r]):i[r]=t[r];return function(e){for(r in n)i[r]=n[r](e);return i}}var U9e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,j9e=new RegExp(U9e.source,"g");function z9e(e,t){var r,n,i,a=U9e.lastIndex=j9e.lastIndex=0,o=-1,s=[],u=[];for(e+="",t+="";(r=U9e.exec(e))&&(n=j9e.exec(t));)(i=n.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:L9e(r,n)})),a=j9e.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var r,n=0;n<t;++n)s[(r=u[n]).i]=r.x(e);return s.join("")})}function G9e(e,t){var r,n=typeof t;return null==t||"boolean"===n?M9e(t):("number"===n?L9e:"string"===n?(r=B7e(t))?(t=r,O9e):z9e:t instanceof B7e?O9e:t instanceof Date?F9e:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?B9e:Array.isArray(t)?N9e:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?$9e:L9e)(e,t)}function V9e(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var H9e,q9e=180/Math.PI,W9e={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function X9e(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*q9e,skewX:Math.atan(u)*q9e,scaleX:o,scaleY:s}}function Y9e(e,t,r,n){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],u=[];return a=e(a),o=e(o),function(e,n,i,a,o,s){if(e!==i||n!==a){var u=o.push("translate(",null,t,null,r);s.push({i:u-4,x:L9e(e,i)},{i:u-2,x:L9e(n,a)})}else(i||a)&&o.push("translate("+i+t+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"rotate("+t+n):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:L9e(e,t)}))}(a.rotate,o.rotate,s,u),function(e,t,r,a){e===t?t&&r.push(i(r)+"skewX("+t+n):a.push({i:r.push(i(r)+"skewX(",
646null,n)-2,x:L9e(e,t)})}(a.skewX,o.skewX,s,u),function(e,t,r,n,a,o){if(e!==r||t!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:L9e(e,r)},{i:s-2,x:L9e(t,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,u),a=o=null,function(e){for(var t,r=-1,n=u.length;++r<n;)s[(t=u[r]).i]=t.x(e);return s.join("")}}}var K9e=Y9e(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?W9e:X9e(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Z9e=Y9e(function(e){return null==e?W9e:(H9e||=document.createElementNS("http://www.w3.org/2000/svg","g"),H9e.setAttribute("transform",e),(e=H9e.transform.baseVal.consolidate())?X9e((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):W9e)},", ",")",")");function Q9e(e){return((e=Math.exp(e))+1/e)/2}var J9e=function e(t,r,n){function i(e,i){var a,o,s=e[0],u=e[1],c=e[2],l=i[0],d=i[1],f=i[2],h=l-s,p=d-u,m=h*h+p*p;if(m<1e-12)o=Math.log(f/c)/t,a=function(e){return[s+e*h,u+e*p,c*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),v=(f*f-c*c+n*m)/(2*c*r*g),y=(f*f-c*c-n*m)/(2*f*r*g),b=Math.log(Math.sqrt(v*v+1)-v);o=(Math.log(Math.sqrt(y*y+1)-y)-b)/t,a=function(e){var n=e*o,i=Q9e(b),a=c/(r*g)*(i*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*n+b)-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+a*h,u+a*p,c*i/Q9e(t*n+b)]}}return a.duration=1e3*o*t/Math.SQRT2,a}return i.rho=function(t){var r=Math.max(.001,+t),n=r*r;return e(r,n,n*n)},i}(Math.SQRT2,2,4);function eet(e){return function t(r){function n(t,n){var i=e((t=T9e(t)).h,(n=T9e(n)).h),a=I9e(t.s,n.s),o=I9e(t.l,n.l),s=I9e(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+r),t.opacity=s(e),t+""}}return r=+r,n.gamma=t,n}(1)}eet(function(e,t){var r=t-e;return r?k9e(e,r>180||r<-180?r-360*Math.round(r/360):r):M9e(isNaN(e)?t:e)});var tet,ret,net=eet(I9e),iet=0,aet=0,oet=0,set=0,uet=0,cet=0,det="object"==typeof performance&&performance.now?performance:Date,fet="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function het(){return uet||=(fet(pet),det.now()+cet)}function pet(){uet=0}function met(){this._call=this._time=this._next=null}function get(e,t,r){var n=new met;return n.restart(e,t,r),n}function vet(){uet=(set=det.now())+cet,iet=aet=0;try{!function(){het(),++iet;for(var e,t=tet;t;)(e=uet-t._time)>=0&&t._call.call(void 0,e),t=t._next;--iet}()}finally{iet=0,function(){for(var e,t,r=tet,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:tet=t);ret=e,bet(n)}(),uet=0}}function yet(){var e=det.now(),t=e-set;t>1e3&&(cet-=t,set=e)}function bet(e){iet||(aet&&=clearTimeout(aet),e-uet>24?(e<1/0&&(aet=setTimeout(vet,e-det.now()-cet)),oet&&=clearInterval(oet)):(oet||=(set=det.now(),setInterval(yet,1e3)),iet=1,fet(vet)))}function _et(e,t,r){var n=new met;return t=null==t?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,r),n}met.prototype=get.prototype={constructor:met,restart:function(e,t,r){if("function"!=typeof e)throw TypeError("callback is not a function");r=(null==r?het():+r)+(null==t?0:+t),this._next||ret===this||(ret?ret._next=this:tet=this,ret=this),this._call=e,this._time=r,bet()},stop:function(){this._call&&(this._call=null,this._time=1/0,bet())}};var xet=V6e("start","end","cancel","interrupt"),wet=[];function Aet(e,t,r,n,i,a){var o=e.__transition;if(o){if(r in o)return}else e.__transition={};!function(e,t,r){var n,i=e.__transition;function a(u){var c,l,d,f;if(1!==r.state)return s();for(c in i)if((f=i[c]).name===r.name){if(3===f.state)return _et(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[c])}if(_et(function(){3===r.state&&(r.state=4,r.timer.restart(o,r.delay,r.time),o(u))}),r.state=2,r.on.call("start",e,e.__data__,r.index,r.group),2===r.state){for(r.state=3,n=Array(d=r.tween.length),c=0,l=-1;c<d;++c)(f=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(n[++l]=f);n.length=l+1}}function o(t){for(var i=t<r.duration?r.ease.call(null,t/r.duration):(r.timer.restart(s),r.state=5,1
646),a=-1,o=n.length;++a<o;)n[a].call(e,i);5===r.state&&(r.on.call("end",e,e.__data__,r.index,r.group),s())}function s(){for(var n in r.state=6,r.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=r,r.timer=get(function(e){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=e&&a(e-r.delay)},0,r.time)}(e,r,{name:t,index:n,group:i,on:xet,tween:wet,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Cet(e,t){var r=Pet(e,t);if(r.state>0)throw Error("too late; already scheduled");return r}function Tet(e,t){var r=Pet(e,t);if(r.state>3)throw Error("too late; already running");return r}function Pet(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw Error("transition not found");return r}function Eet(e,t){var r,n,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(r=a[i]).name===t?(n=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(n?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete a[i]):o=!1;o&&delete e.__transition}}function Met(e,t){var r,n;return function(){var i=Tet(this,e),a=i.tween;if(a!==r)for(var o=0,s=(n=r=a).length;o<s;++o)if(n[o].name===t){(n=n.slice()).splice(o,1);break}i.tween=n}}function ket(e,t,r){var n,i;if("function"!=typeof r)throw Error();return function(){var a=Tet(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function Iet(e,t,r){var n=e._id;return e.each(function(){var e=Tet(this,n);(e.value||={})[t]=r.apply(this,arguments)}),function(e){return Pet(e,n).value[t]}}function Det(e,t){var r;return("number"==typeof t?L9e:t instanceof B7e?O9e:(r=B7e(t))?(t=r,O9e):z9e)(e,t)}function Oet(e){return function(){this.removeAttribute(e)}}function Ret(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bet(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttribute(e);return o===a?null:o===n?i:i=t(n=o,r)}}function Net(e,t,r){var n,i,a=r+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===n?i:i=t(n=o,r)}}function Fet(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttribute(e))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttribute(e)}}function Let(e,t,r){var n,i,a;return function(){var o,s,u=r(this);if(null!=u)return(o=this.getAttributeNS(e.space,e.local))===(s=u+"")?null:o===n&&s===i?a:(i=s,a=t(n=o,u));this.removeAttributeNS(e.space,e.local)}}function $et(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}(e,i)),r}return i._value=t,i}function Uet(e,t){var r,n;function i(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&function(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}(e,i)),r}return i._value=t,i}function jet(e,t){return function(){Cet(this,e).delay=+t.apply(this,arguments)}}function zet(e,t){return t=+t,function(){Cet(this,e).delay=t}}function Get(e,t){return function(){Tet(this,e).duration=+t.apply(this,arguments)}}function Vet(e,t){return t=+t,function(){Tet(this,e).duration=t}}var Het=a7e.prototype.constructor;function qet(e){return function(){this.style.removeProperty(e)}}var Wet=0;function Xet(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function Yet(){return++Wet}var Ket=a7e.prototype;Xet.prototype={constructor:Xet,select:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=t8e(e));for(var n=this._groups,i=n.length,a=Array(i),o=0;o<i;++o)for(var s,u,c=n[o],l=c.length,d=a[o]=Array(l),f=0;f<l;++f)(s=c[f])&&(u=e.call(s,s.__data__,f,c))&&("__data__"in s&&(u.__data__=s.__data__),d[f]=u,Aet(d[f],t,r,f,d,Pet(s,r)));return new Xet(a,this._parents,t,r)},selectAll:function(e){var t=this._name,r=this._id;"function"!=typeof e&&(e=i8e(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u,c=n[s],l=c.length,d=0;d<l;++d)if(u=c[d]){for(var f,h=e.call(u,u.__data__,d,c),p=Pet(u,r),m=0,g=h.length;m<g;++m)(f=h[m])&&Aet(f,t,r,m,h,p);a.push(h),o.push(u)}return new Xet(a,o,t,r)},selectChild:Ket.selectChild,selectChildren:Ket.selectChildren,filter:function(e){"function"!=typeof e&&(e=a8e(e));for(var t=this._groups,r=t.length,n=Array(r),i=0;i<r;++i)for(var a,o=t[i],s=o.length,u=n[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&u.push(a);return new Xet(n,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=Array(n),s=0;s<a;++s)for(var u,c=t[s],l=r[s],d=c.length,f=o[s]=Array(d),h=0;h<d;++h)(u=c[h]||l[h])&&(f[h]=u);for(;s<n;++s)o[s]=t[s];return new Xet(o,this._parents,this._name,this._id)},selection:function(){return new Het(this._groups,this._parents)}
vendor: 17,806 bytes, line 646
646,transition:function(){for(var e=this._name,t=this._id,r=Yet(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)if(o=s[c]){var l=Pet(o,t);Aet(o,e,r,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Xet(n,this._parents,e,r)},call:Ket.call,nodes:Ket.nodes,node:Ket.node,size:Ket.size,empty:Ket.empty,each:Ket.each,on:function(e,t){var r=this._id;return arguments.length<2?Pet(this.node(),r).on.on(e):this.each(function(e,t,r){var n,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Cet:Tet;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}(r,e,t))},attr:function(e,t){var r=K6e(e),n="transform"===r?Z9e:Det;return this.attrTween(e,"function"==typeof t?(r.local?Let:Fet)(r,n,Iet(this,"attr."+e,t)):null==t?(r.local?Ret:Oet)(r):(r.local?Net:Bet)(r,n,t))},attrTween:function(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();var n=K6e(e);return this.tween(r,(n.local?$et:Uet)(n,t))},style:function(e,t,r){var n="transform"==(e+="")?K9e:Det;return null==t?this.styleTween(e,function(e,t){var r,n,i;return function(){var a=E8e(this,e),o=(this.style.removeProperty(e),E8e(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}(e,n)).on("end.style."+e,qet(e)):"function"==typeof t?this.styleTween(e,function(e,t,r){var n,i,a;return function(){var o=E8e(this,e),s=r(this),u=s+"";return s??(this.style.removeProperty(e),u=s=E8e(this,e)),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}(e,n,Iet(this,"style."+e,t))).each(function(e,t){var r,n,i,a,o="style."+t,s="end."+o;return function(){var u=Tet(this,e),c=u.on,l=null==u.value[o]?a||=qet(t):void 0;c===r&&i===l||(n=(r=c).copy()).on(s,i=l),u.on=n}}(this._id,e)):this.styleTween(e,function(e,t,r){var n,i,a=r+"";return function(){var o=E8e(this,e);return o===a?null:o===n?i:i=t(n=o,r)}}(e,n,t),r).on("end.style."+e,null)},styleTween:function(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(e,t,r){var n,i;function a(){var a=t.apply(this,arguments);return a!==i&&(n=(i=a)&&function(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}(e,a,r)),n}return a._value=t,a}(e,t,r??""))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(Iet(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,r;function n(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&function(e){return function(t){this.textContent=e.call(this,t)}}(n)),t}return n._value=e,n}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n,i=Pet(this.node(),r).tween,a=0,o=i.length;a<o;++a)if((n=i[a]).name===e)return n.value;return null}return this.each((null==t?Met:ket)(r,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?jet:zet)(t,e)):Pet(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Get:Vet)(t,e)):Pet(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){Tet(this,e).ease=t}}(t,e)):Pet(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw Error();return this.each(function(e,t){return function(){var r=t.apply(this,arguments);if("function"!=typeof r)throw Error();Tet(this,e).ease=r}}(this._id,e))},end:function(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){0==--i&&a()}};r.each(function(){var r=Tet(this,n),i=r.on;i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),r.on=t}),0===i&&a()})},[Symbol.iterator]:Ket[Symbol.iterator]};var Zet={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Qet(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return r}a7e.prototype.interrupt=function(e){return this.each(function(){Eet(this,e)})},a7e.prototype.transition=function(e){var t,r;e instanceof Xet?(t=e._id,e=e._name):(t=Yet(),(r=Zet).time=het(),e=null==e?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o,s=n[a],u=s.length,c=0;c<u;++c)(o=s[c])&&Aet(o,e,t,c,s,r||Qet(o,t));return new Xet(n,this._parents,e,t)};var Jet=e=>()=>e;function ett(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function ttt(e){e.preventDefault(),e.stopImmediatePropagation()}var rtt={name:"drag"},ntt={name:"space"},itt={name:"handle"},att={name:"center"},{abs:ott,max:stt,min:utt}=Math;function ctt(e){return[+e[0],+e[1]]}function ltt(e){return[ctt(e[0]),ctt(e[1])]}var dtt={name:"x",handles:["w","e"].map(btt),input:function(e,t){return null==e?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},ftt={name:"y",handles:["n","s"].map(btt),input:function(e,t){return null==e?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},htt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(btt),input:function(e){return null==e?null:ltt(e)},output:function(e){return e}},ptt={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},mtt={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},gtt={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},vtt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ytt={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function btt(e){return{type:e}}function _tt(e){return!e.ctrlKey&&!e.button}function xtt(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function Stt(){return navigator.maxTouchPoints||"ontouchstart"in this}function wtt(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function Att(e){var t,r=xtt,n=_tt,i=Stt,a=!0,o=V6e("start","brush","end"),s=6;function u(t){var r=t.property("__brush",m).selectAll(".overlay").data([btt("overlay")]);r.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",ptt.overlay).merge(r).each(function(){var e=wtt(this).extent;o7e(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])}),t.selectAll(".selection").data([btt("selection")]).enter().append("rect").attr("class","selection").attr("cursor",ptt.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var n=t.selectAll(".handle").data(e.handles,function(e){return e.type});n.exit().remove(),n.enter().append("rect").attr("class",function(e){return"handle handle--"+e.type}).attr("cursor",function(e){return ptt[e.type]}),t.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var e=o7e(this),t=wtt(this).selection;t?(e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]),e.selectAll(".handle").style("display",null).attr("x",function(e){return"e"===e.type[e.type.length-1]?t[1][0]-s/2:t[0][0]-s/2}).attr("y",function(e){return"s"===e.type[0]?t[1][1]-s/2:t[0][1]-s/2}).attr("width",function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+s:s}).attr("height",function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+s:s})):e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function l(e,t,r){var n=e.__brush.emitter;return!n||r&&n.clean?new d(e,t,r):n}function d(e,t,r){this.that=e,this.args=t,this.state=e.__brush,this.active=0,this.clean=r}function f(r){if((!t||r.touches)&&n.apply(this,arguments)){var i,o,s,u,d,f,h,p,m,g,v,y=this,b=r.target.__data__.type,_="selection"===(a&&r.metaKey?b="overlay":b)?rtt:a&&r.altKey?att:itt,x=e===ftt?null:vtt[b],S=e===dtt?null:ytt[b],w=wtt(y),A=w.extent,C=w.selection,T=A[0][0],P=A[0][1],E=A[1][0],M=A[1][1],k=0,I=0,D=x&&S&&a&&r.shiftKey,O=Array.from(r.touches||[r],e=>{let t=e.identifier;return(e=d7e(e,y)).point0=e.slice(),e.identifier=t,e});Eet(y);var R=l(y,arguments,!0).beforestart();if("overlay"===b){C&&(m=!0);let t=[O[0],O[1]||O[0]];w.selection=C=[[i=e===ftt?T:utt(t[0][0],t[1][0]),s=e===dtt?P:utt(t[0][1],t[1][1])],[d=e===ftt?E:stt(t[0][0],t[1][0]),h=e===dtt?M:stt(t[0][1],t[1][1])]],O.length>1&&$(r)}else i=C[0][0],s=C[0][1],d=C[1][0],h=C[1][1];o=i,u=s,f=d,p=h;var B=o7e(y).attr("pointer-events","none"),N=B.selectAll(".overlay").attr("cursor",ptt[b]);if(r.touches)R.moved=L,R.ended=U;else{var F=o7e(r.view).on("mousemove.brush",L,!0).on("mouseup.brush",U,!0);a&&F.on("keydown.brush",function(e){switch(e.keyCode){case 16:D=x&&S;break;case 18:_===itt&&(x&&(d=f-k*x,i=o+k*x),S&&(h=p-I*S,s=u+I*S),_=att,$(e));break;case 32:_!==itt&&_!==att||(x<0?d=f-k:x>0&&(i=o-k),S<0?h=p-I:S>0&&(s=u-I),_=ntt,N.attr("cursor",ptt.selection),$(e));break;default:return}ttt(e)},!0).on("keyup.brush",function(e){switch(e.keyCode){case 16:D&&(g=v=D=!1,$(e));break;case 18:_===att&&(x<0?d=f:x>0&&(i=o),S<0?h=p:S>0&&(s=u),_=itt,$(e));break;case 32:_===ntt&&(e.altKey?(x&&(d=f-k*x,i=o+k*x),S&&(h=p-I*S,s=u+I*S),_=att):(x<0?d=f:x>0&&(i=o),S<0?h=p:S>0&&(s=u),_=itt),N.attr("cursor",ptt[b]),$(e));break;default:return}ttt(e)},!0),m7e(r.view)}c.call(y),R.start(r,_.name)}function L(e){for(let t of e.changedTouches||[e])for(let e of O)e.identifier===t.identifier&&(e.cur=d7e(t,y));if(D&&!g&&!v&&1===O.length){let e=O[0];ott(e.cur[0]-e[0])>ott(e.cur[1]-e[1])?v=!0:g=!0}for(let e of O)e.cur&&(e[0]=e.cur[0],e[1]=e.cur[1]);m=!0,ttt(e),$(e)}function $(e){let t=O[0],r=t.point0;var n;switch(k=t[0]-r[0],I=t[1]-r[1],_){case ntt:case rtt:x&&(k=stt(T-i,utt(E-d,k)),o=i+k,f=d+k),S&&(I=stt(P-s,utt(M-h,I)),u=s+I,p=h+I);break;case itt:O[1]?(x&&=(o=stt(T,utt(E,O[0][0])),f=stt(T,utt(E,O[1][0])),1),S&&=(u=stt(P,utt(M,O[0][1])),p=stt(P,utt(M,O[1][1])),1)):(x<0?(k=stt(T-i,utt(E-i,k)),o=i+k,f=d):x>0&&(k=stt(T-d,utt(E-d,k)),o=i,f=d+k),S<0?(I=stt(P-s,utt(M-s,I)),u=s+I,p=h):S>0&&(I=stt(P-h,utt(M-h,I)),u=s,p=h+I));break;case att:x&&(o=stt(T,utt(E,i-k*x)),f=stt(T,utt(E,d+k*x))),S&&(u=stt(P,utt(M,s-I*S)),p=stt(P,utt(M,h+I*S)))}f<o&&(x*=-1,n=i,i=d,d=n,n=o,o=f,f=n,b in mtt&&N.attr("cursor",ptt[b=mtt[b]])),p<u&&(S*=-1,n=s,s=h,h=n,n=u,u=p,p=n,b in gtt&&N.attr("cursor",ptt[b=gtt[b]])),w.selection&&(C=w.selection),g&&(o=C[0][0],f=C[1][0]),v&&(u=C[0][1],p=C[1][1]),C[0][0]===o&&C[0][1]===u&&C[1][0]===f&&C[1][1]===p||(w.selection=[[o,u],[f,p]],c.call(y),R.brush(e,_.name))}function U(e){if(function(e){e.stopImmediatePropagation()}(e),e.touches){if(e.touches.length)return;t&&clearTimeout(t),t=setTimeout(function(){t=null},500)}else g7e(e.view,m),F.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);B.attr("pointer-events","all"),N.attr("cursor",ptt.overlay),w.selection&&(C=w.selection),function(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}(C)&&(w.selection=null,c.call(y)),R.end(e,_.name)}}function h(e){l(this,arguments).moved(e)}function p(e){l(this,arguments).ended(e)}function m(){var t=this.__brush||{selection:null};return t.extent=ltt(r.apply(this,arguments)),t.dim=e,t}return u.move=function(t,r,n){t.tween?t.on("start.brush",function(e){l(this,arguments).beforestart().start(e)}).on("interrupt.brush end.brush",function(e){l(this,arguments).end(e)}).tween("brush",function(){var t=this,n=t.__brush,i=l(t,arguments),a=n.selection,o=e.input("function"==typeof r?r.apply(this,arguments):r,n.extent),s=G9e(a,o);function u(e){n.selection=1===e&&null===o?null:s(e),c.call(t),i.brush()}return null!==a&&null!==o?u:u(1)}):t.each(function(){var t=this,i=arguments,a=t.__brush,o=e.input("function"==typeof r?r.apply(t,i):r,a.extent),s=l(t,i).beforestart();Eet(t),a.selection=null===o?null:o,c.call(t),s.start(n).brush(n).end(n)})},u.clear=function(e,t){u.move(e,null,t)},d.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(e,t){return this.starting?(this.starting=!1,this.emit("start",e,t)):this.emit("brush",e),this},brush:function(e,t){return this.emit("brush",e,t),this},end:function(e,t){return 0==--this.active&&(delete this.state.emitter,this.emit("end",e,t)),this},emit:function(t,r,n){var i=o7e(this.that).datum();o.call(t,this.that,new ett(t,{sourceEvent:r,target:u,selection:e.output(this.state.selection),mode:n,dispatch:o}),i)}},u.extent=function(e){return arguments.length?(r="function"==typeof e?e:Jet(ltt(e)),u):r},u.filter=function(e){return arguments.length?(n="function"==typeof e?e:Jet(!!e),u):n},u.touchable=function(e){return arguments.length?(i="function"==typeof e?e:Jet(!!e),u):i},u.handleSize=function(e){return arguments.length?(s=+e,u):s},u.keyModifiers=function(e){return arguments.length?(a=!!e,u):a},u.on=function(){var e=o.on.apply(o,arguments);return e===o?u:e},u}var Ctt=Object.freeze({__proto__:null,brush:function(){return Att(htt)},brushSelection:function(e){var t=e.__brush;return t?t.dim.output(t.selection):null},brushX:function(){return Att(dtt)},brushY:function(){return Att(ftt)}});function Ttt(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Ptt(e){return(e=Ttt(Math.abs(e)))?e[1]:NaN}var Ett,Mtt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ktt(e){if(!(t=Mtt.exec(e)))throw Error("invalid format: "+e);var t;return new Itt({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Itt(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Dtt(e,t){var r=Ttt(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+Array(i-n.length+2).join("0")}ktt.prototype=Itt.prototype,Itt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ott={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Dtt(100*e,t),r:Dtt,s:function(e,t){var r=Ttt(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(Ett=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=n.length;return a===o?n:a>o?n+Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+Array(1-a).join("0")+Ttt(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Rtt(e){return e}var Btt,Ntt,Ftt,Ltt=Array.prototype.map,$tt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Utt(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function jtt(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}Btt=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?Rtt:(t=Ltt.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var i=e.length,a=[],o=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>n));)s=t[o=(o+1)%t.length];return a.reverse().join(r)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?Rtt:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(Ltt.call(e.numerals,String)),u=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=ktt(e)).fill,r=e.align,d=e.sign,f=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,v=e.trim,y=e.type;"n"===y?(m=!0,y="g"):Ott[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===t&&"="===r)&&(h=!0,t="0",r="=");
vendor: 5,442 bytes, line 646
646var b="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?a:/[%p]/.test(y)?u:"",x=Ott[y],S=/[defgprs%]/.test(y);function w(e){var i,a,u,f=b,w=_;if("c"===y)w=x(e)+w,e="";else{var A=(e=+e)<0||1/e<0;if(e=isNaN(e)?l:x(Math.abs(e),g),v&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n<r;++n)switch(e[n]){case".":i=t=n;break;case"0":0===i&&(i=n),t=n;break;default:if(!+e[n])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),A&&0==+e&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,w=("s"===y?$tt[8+Ett/3]:"")+w+(A&&"("===d?")":""),S)for(i=-1,a=e.length;++i<a;)if(48>(u=e.charCodeAt(i))||u>57){w=(46===u?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}m&&!h&&(e=n(e,1/0));var C=f.length+e.length+w.length,T=C<p?Array(p-C+1).join(t):"";switch(m&&h&&(e=n(T+e,T.length?p-w.length:1/0),T=""),r){case"<":e=f+e+w+T;break;case"=":e=f+T+e+w;break;case"^":e=T.slice(0,C=T.length>>1)+f+e+w+T.slice(C);break;default:e=T+f+e+w}return s(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return e+""},w}return{format:d,formatPrefix:function(e,t){var r=d(((e=ktt(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(Ptt(t)/3))),i=10**-n,a=$tt[8+n/3];return function(e){return r(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),Ntt=Btt.format,Ftt=Btt.formatPrefix;var ztt=Symbol("implicit");function Gtt(){var e=new P6e,t=[],r=[],n=ztt;function i(i){let a=e.get(i);if(void 0===a){if(n!==ztt)return n;e.set(i,a=t.push(i)-1)}return r[a%r.length]}return i.domain=function(r){if(!arguments.length)return t.slice();t=[],e=new P6e;for(let n of r)e.has(n)||e.set(n,t.push(n)-1);return i},i.range=function(e){return arguments.length?(r=Array.from(e),i):r.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Gtt(t,r).unknown(n)},Utt.apply(i,arguments),i}function Vtt(){var e,t,r=Gtt().unknown(void 0),n=r.domain,i=r.range,a=0,o=1,s=!1,u=0,c=0,l=.5;function d(){var r=n().length,d=o<a,f=d?o:a,h=d?a:o;e=(h-f)/Math.max(1,r-u+2*c),s&&(e=Math.floor(e)),f+=(h-f-e*(r-u))*l,t=e*(1-u),s&&(f=Math.round(f),t=Math.round(t));var p=function(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((t-e)/r)),a=Array(i);++n<i;)a[n]=e+n*r;return a}(r).map(function(t){return f+e*t});return i(d?p.reverse():p)}return delete r.unknown,r.domain=function(e){return arguments.length?(n(e),d()):n()},r.range=function(e){return arguments.length?([a,o]=e,a=+a,o=+o,d()):[a,o]},r.rangeRound=function(e){return[a,o]=e,a=+a,o=+o,s=!0,d()},r.bandwidth=function(){return t},r.step=function(){return e},r.round=function(e){return arguments.length?(s=!!e,d()):s},r.padding=function(e){return arguments.length?(u=Math.min(1,c=+e),d()):u},r.paddingInner=function(e){return arguments.length?(u=Math.min(1,e),d()):u},r.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},r.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),d()):l},r.copy=function(){return Vtt(n(),[a,o]).round(s).paddingInner(u).paddingOuter(c).align(l)},Utt.apply(d(),arguments)}function Htt(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return Htt(t())},e}function qtt(e){return+e}var Wtt=[0,1];function Xtt(e){return e}function Ytt(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function Ktt(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i<n?(n=Ytt(i,n),a=r(o,a)):(n=Ytt(n,i),a=r(a,o)),function(e){return a(n(e))}}function Ztt(e,t,r){var n=Math.min(e.length,t.length)-1,i=Array(n),a=Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)i[o]=Ytt(e[o],e[o+1]),a[o]=r(t[o],t[o+1]);return function(t){var r=T6e(e,t,1,n)-1;return a[r](i[r](t))}}function Qtt(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Jtt(){var e,t,r,n,i,a,o=Wtt,s=Wtt,u=G9e,c=Xtt;function l(){var e=Math.min(o.length,s.length);return c!==Xtt&&(c=function(e,t){var r;return e>t&&(r=e,e=t,t=r),function(r){return Math.max(e,Math.min(t,r))}}(o[0],o[e-1])),n=e>2?Ztt:Ktt,i=a=null,d}function d(t){return null==t||isNaN(t=+t)?r:(i||=n(o.map(e),s,u))(e(c(t)))}return d.invert=function(r){return c(t((a||=n(s,o.map(e),L9e))(r)))},d.domain=function(e){return arguments.length?(o=Array.from(e,qtt),l()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),l()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),u=V9e,l()},d.clamp=function(e){return arguments.length?(c=!!e||Xtt,l()):c!==Xtt},d.interpolate=function(e){return arguments.length?(u=e,l()):u},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,l()}}function ert(){return Jtt()(Xtt,Xtt)}function trt(e,t,r,n){var i,a=F6e(e,t,r);switch((n=ktt(n??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=n.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ptt(t)/3)))-Ptt(Math.abs(e)))}(a,o))||(n.precision=i),Ftt(n,o);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ptt(t)-Ptt(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(e){return Math.max(0,-Ptt(Math.abs(e)))}
vendor: 12,822 bytes, line 646
646(a))||(n.precision=i-2*("%"===n.type))}return Ntt(n)}function rrt(e){var t=e.domain;return e.ticks=function(e){var r=t();return B6e(r[0],r[r.length-1],e??10)},e.tickFormat=function(e,r){var n=t();return trt(n[0],n[n.length-1],e??10,r)},e.nice=function(r){r??=10;var n,i,a=t(),o=0,s=a.length-1,u=a[o],c=a[s],l=10;for(c<u&&(i=u,u=c,c=i,i=o,o=s,s=i);l-- >0;){if((i=N6e(u,c,r))===n)return a[o]=u,a[s]=c,t(a);if(i>0)u=Math.floor(u/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,c=Math.floor(c*i)/i}n=i}return e},e}function nrt(e,t){var r,n=0,i=(e=e.slice()).length-1,a=e[n],o=e[i];return o<a&&(r=n,n=i,i=r,r=a,a=o,o=r),e[n]=t.floor(a),e[i]=t.ceil(o),e}function irt(e){return Math.log(e)}function art(e){return Math.exp(e)}function ort(e){return-Math.log(-e)}function srt(e){return-Math.exp(-e)}function urt(e){return isFinite(e)?+("1e"+e):e<0?0:e}function crt(e){return(t,r)=>-e(-t,r)}function lrt(e){let t,r,n=e(irt,art),i=n.domain,a=10;function o(){return t=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(a),r=function(e){return 10===e?urt:e===Math.E?Math.exp:t=>e**+t}(a),i()[0]<0?(t=crt(t),r=crt(r),e(ort,srt)):e(irt,art),n}return n.base=function(e){return arguments.length?(a=+e,o()):a},n.domain=function(e){return arguments.length?(i(e),o()):i()},n.ticks=e=>{let n=i(),o=n[0],s=n[n.length-1],u=s<o;u&&([o,s]=[s,o]);let c,l,d=t(o),f=t(s),h=null==e?10:+e,p=[];if(!(a%1)&&f-d<h){if(d=Math.floor(d),f=Math.ceil(f),o>0){for(;d<=f;++d)for(c=1;c<a;++c)if(l=d<0?c/r(-d):c*r(d),!(l<o)){if(l>s)break;p.push(l)}}else for(;d<=f;++d)for(c=a-1;c>=1;--c)if(l=d>0?c/r(-d):c*r(d),!(l<o)){if(l>s)break;p.push(l)}2*p.length<h&&(p=B6e(o,s,h))}else p=B6e(d,f,Math.min(f-d,h)).map(r);return u?p.reverse():p},n.tickFormat=(e,i)=>{if(e??=10,i??=10===a?"s":",","function"!=typeof i&&(a%1||null!=(i=ktt(i)).precision||(i.trim=!0),i=Ntt(i)),e===1/0)return i;let o=Math.max(1,a*e/n.ticks().length);return e=>{let n=e/r(Math.round(t(e)));return n*a<a-.5&&(n*=a),n<=o?i(e):""}},n.nice=()=>i(nrt(i(),{floor:e=>r(Math.floor(t(e))),ceil:e=>r(Math.ceil(t(e)))})),n}function drt(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function frt(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function hrt(e){var t=1,r=e(drt(t),frt(t));return r.constant=function(r){return arguments.length?e(drt(t=+r),frt(t)):t},rrt(r)}function prt(e){return function(t){return t<0?-((-t)**+e):t**+e}}function mrt(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function grt(e){return e<0?-e*e:e*e}function vrt(e){var t=e(Xtt,Xtt),r=1;return t.exponent=function(t){return arguments.length?1==(r=+t)?e(Xtt,Xtt):.5===r?e(mrt,grt):e(prt(r),prt(1/r)):r},rrt(t)}function yrt(){var e=vrt(Jtt());return e.copy=function(){return Qtt(e,yrt()).exponent(e.exponent())},Utt.apply(e,arguments),e}function brt(e){return Math.sign(e)*e*e}var _rt=new Date,xrt=new Date;function Srt(e,t,r,n){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=r=>(e(r=new Date(r-1)),t(r,1),e(r),r),i.round=e=>{let t=i(e),r=i.ceil(e);return e-t<r-e?t:r},i.offset=(e,r)=>(t(e=new Date(+e),null==r?1:Math.floor(r)),e),i.range=(r,n,a)=>{let o,s=[];if(r=i.ceil(r),a=null==a?1:Math.floor(a),!(r<n&&a>0))return s;do{s.push(o=new Date(+r)),t(r,a),e(r)}while(o<r&&r<n);return s},i.filter=r=>Srt(t=>{if(t>=t)for(;e(t),!r(t);)t.setTime(t-1)},(e,n)=>{if(e>=e)if(n<0)for(;++n<=0;)for(;t(e,-1),!r(e););else for(;--n>=0;)for(;t(e,1),!r(e););}),r&&(i.count=(t,n)=>(_rt.setTime(+t),xrt.setTime(+n),e(_rt),e(xrt),Math.floor(r(_rt,xrt))),i.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(n?t=>n(t)%e==0:t=>i.count(0,t)%e==0):i:null)),i}var wrt=Srt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);wrt.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?Srt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):wrt:null),wrt.range;var Art=1e3,Crt=6e4,Trt=36e5,Prt=864e5,Ert=6048e5,Mrt=31536e6,krt=Srt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Art)},(e,t)=>(t-e)/Art,e=>e.getUTCSeconds());krt.range;var Irt=Srt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Art)},(e,t)=>{e.setTime(+e+t*Crt)},(e,t)=>(t-e)/Crt,e=>e.getMinutes());Irt.range;var Drt=Srt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Crt)},(e,t)=>(t-e)/Crt,e=>e.getUTCMinutes());Drt.range;var Ort=Srt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Art-e.getMinutes()*Crt)},(e,t)=>{e.setTime(+e+t*Trt)},(e,t)=>(t-e)/Trt,e=>e.getHours());Ort.range;var Rrt=Srt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Trt)},(e,t)=>(t-e)/Trt,e=>e.getUTCHours());Rrt.range;var Brt=Srt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Crt)/Prt,e=>e.getDate()-1);Brt.range;var Nrt=Srt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Prt,e=>e.getUTCDate()-1);Nrt.range;var Frt=Srt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Prt,e=>Math.floor(e/Prt));function Lrt(e){return Srt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Crt)/Ert)}Frt.range;var $rt=Lrt(0),Urt=Lrt(1),jrt=Lrt(2),zrt=Lrt(3),Grt=Lrt(4),Vrt=Lrt(5),Hrt=Lrt(6);function qrt(e){return Srt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/Ert)}$rt.range,Urt.range,jrt.range,zrt.range,Grt.range,Vrt.range,Hrt.range;var Wrt=qrt(0),Xrt=qrt(1),Yrt=qrt(2),Krt=qrt(3),Zrt=qrt(4),Qrt=qrt(5),Jrt=qrt(6);Wrt.range,Xrt.range,Yrt.range,Krt.range,Zrt.range,Qrt.range,Jrt.range;var ent=Srt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth());ent.range;var tnt=Srt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth());tnt.range;var rnt=Srt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());rnt.every=e=>isFinite(e=Math.floor(e))&&e>0?Srt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)}):null,rnt.range;var nnt=Srt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());function int(e,t,r,n,i,a){let o=[[krt,1,Art],[krt,5,5e3],[krt,15,15e3],[krt,30,3e4],[a,1,Crt],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,Trt],[i,3,108e5],[i,6,216e5],[i,12,432e5],[n,1,Prt],[n,2,1728e5],[r,1,Ert],[t,1,2592e6],[t,3,7776e6],[e,1,Mrt]];function s(t,r,n){let i=Math.abs(r-t)/n,a=w6e(([,,e])=>e).right(o,i);if(a===o.length)return e.every(F6e(t/Mrt,r/Mrt,n));if(0===a)return wrt.every(Math.max(F6e(t,r,n),1));let[s,u]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(u)}return[function(e,t,r){let n=t<e;n&&([e,t]=[t,e]);let i=r&&"function"==typeof r.range?r:s(e,t,r),a=i?i.range(e,+t+1):[];return n?a.reverse():a},s]}nnt.every=e=>isFinite(e=Math.floor(e))&&e>0?Srt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)}):null,nnt.range;var[ant,ont]=int(nnt,tnt,Wrt,Frt,Rrt,Drt),[snt,unt]=int(rnt,ent,$rt,Brt,Ort,Irt);function cnt(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function lnt(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function dnt(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}var fnt,hnt,pnt,mnt={"-":"",_:" ",0:"0"},gnt=/^\s*\d+/,vnt=/^%/,ynt=/[\\^$*+?|[\]().{}]/g;function bnt(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a<r?Array(r-a+1).join(t)+i:i)}function _nt(e){return e.replace(ynt,"\\$&")}function xnt(e){return RegExp("^(?:"+e.map(_nt).join("|")+")","i")}function Snt(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function wnt(e,t,r){var n=gnt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Ant(e,t,r){var n=gnt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Cnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Tnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Pnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Ent(e,t,r){var n=gnt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Mnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function knt(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Int(e,t,r){var n=gnt.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function Dnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Ont(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Rnt(e,t,r){var n=gnt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function Bnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Nnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Fnt(e,t,r){var n=gnt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Lnt(e,t,r){var n=gnt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function $nt(e,t,r){var n=gnt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Unt(e,t,r){var n=vnt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function jnt(e,t,r){var n=gnt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function znt(e,t,r){var n=gnt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function Gnt(e,t){return bnt(e.getDate(),t,2)}function Vnt(e,t){return bnt(e.getHours(),t,2)}function Hnt(e,t){return bnt(e.getHours()%12||12,t,2)}function qnt(e,t){return bnt(1+Brt.count(rnt(e),e),t,3)}function Wnt(e,t){return bnt(e.getMilliseconds(),t,3)}function Xnt(e,t){return Wnt(e,t)+"000"}function Ynt(e,t){return bnt(e.getMonth()+1,t,2)}function Knt(e,t){return bnt(e.getMinutes(),t,2)}function Znt(e,t){return bnt(e.getSeconds(),t,2)}function Qnt(e){var t=e.getDay();return 0===t?7:t}function Jnt(e,t){return bnt($rt.count(rnt(e)-1,e),t,2)}function eit(e){var t=e.getDay();return t>=4||0===t?Grt(e):Grt.ceil(e)}function tit(e,t){return e=eit(e),bnt(Grt.count(rnt(e),e)+(4===rnt(e).getDay()),t,2)}function rit(e){return e.getDay()}function nit(e,t){return bnt(Urt.count(rnt(e)-1,e),t,2)}function iit(e,t){return bnt(e.getFullYear()%100,t,2)}function ait(e,t){return bnt((e=eit(e)).getFullYear()%100,t,2)}function oit(e,t){return bnt(e.getFullYear()%1e4,t,4)}function sit(e,t){var r=e.getDay();return bnt((e=r>=4||0===r?Grt(e):Grt.ceil(e)).getFullYear()%1e4,t,4)}function uit(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+bnt(t/60|0,"0",2)+bnt(t%60,"0",2)}function cit(e,t){return bnt(e.getUTCDate(),t,2)}function lit(e,t){return bnt(e.getUTCHours(),t,2)}function dit(e,t){return bnt(e.getUTCHours()%12||12,t,2)}function fit(e,t){return bnt(1+Nrt.count(nnt(e),e),t,3)}function hit(e,t){return bnt(e.getUTCMilliseconds(),t,3)}function pit(e,t){return hit(e,t)+"000"}function mit(e,t){return bnt(e.getUTCMonth()+1,t,2)}function git(e,t){return bnt(e.getUTCMinutes(),t,2)}function vit(e,t){return bnt(e.getUTCSeconds(),t,2)}function yit(e){var t=e.getUTCDay();return 0===t?7:t}function bit(e,t){return bnt(Wrt.count(nnt(e)-1,e),t,2)}function _it(e){var t=e.getUTCDay();return t>=4||0===t?Zrt(e):Zrt.ceil(e)}function xit(e,t){return e=_it(e),bnt(Zrt.count(nnt(e),e)+(4===nnt(e).getUTCDay()),t,2)}function Sit(e){return e.getUTCDay()}function wit(e,t){return bnt(Xrt.count(nnt(e)-1,e),t,2)}function Ait(e,t){return bnt(e.getUTCFullYear()%100,t,2)}function Cit(e,t){return bnt((e=_it(e)).getUTCFullYear()%100,t,2)}function Tit(e,t){return bnt(e.getUTCFullYear()%1e4,t,4)}function Pit(e,t){var r=e.getUTCDay();return bnt((e=r>=4||0===r?Zrt(e):Zrt.ceil(e)).getUTCFullYear()%1e4,t,4)}function Eit(){return"+0000"}function Mit(){return"%"}function kit(e){return+e}function Iit(e){return Math.floor(e/1e3)}function Dit(e){return new Date(e)}function Oit(e){return e instanceof Date?+e:+new Date(+e)}function Rit(e,t,r,n,i,a,o,s,u,c){var l=ert(),d=l.invert,f=l.domain,h=c(".%L"),p=c(":%S"),m=c("%I:%M"),g=c("%I %p"),v=c("%a %d"),y=c("%b %
646d"),b=c("%B"),_=c("%Y");function x(e){return(u(e)<e?h:s(e)<e?p:o(e)<e?m:a(e)<e?g:n(e)<e?i(e)<e?v:y:r(e)<e?b:_)(e)}return l.invert=function(e){return new Date(d(e))},l.domain=function(e){return arguments.length?f(Array.from(e,Oit)):f().map(Dit)},l.ticks=function(t){var r=f();return e(r[0],r[r.length-1],t??10)},l.tickFormat=function(e,t){return null==t?x:c(t)},l.nice=function(e){var r=f();return e&&"function"==typeof e.range||(e=t(r[0],r[r.length-1],e??10)),e?f(nrt(r,e)):l},l.copy=function(){return Qtt(l,Rit(e,t,r,n,i,a,o,s,u,c))},l}function Bit(){var e,t,r,n,i,a=0,o=1,s=Xtt,u=!1;function c(t){return null==t||isNaN(t=+t)?i:s(0===r?.5:(t=(n(t)-e)*r,u?Math.max(0,Math.min(1,t)):t))}function l(e){return function(t){var r,n;return arguments.length?([r,n]=t,s=e(r,n),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=n(a=+a),t=n(o=+o),r=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(u=!!e,c):u},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=l(G9e),c.rangeRound=l(V9e),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return n=i,e=i(a),t=i(o),r=e===t?0:1/(t-e),c}}function Nit(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Fit(){var e=vrt(Bit());return e.copy=function(){return Nit(e,Fit()).exponent(e.exponent())},jtt.apply(e,arguments)}function Lit(){var e,t,r,n,i,a,o,s=0,u=.5,c=1,l=1,d=Xtt,f=!1;function h(e){return isNaN(e=+e)?o:(e=.5+((e=+a(e))-t)*(l*e<l*t?n:i),d(f?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var r,n,i;return arguments.length?([r,n,i]=t,d=function(e,t){void 0===t&&(t=e,e=G9e);for(var r=0,n=t.length-1,i=t[0],a=Array(n<0?0:n);r<n;)a[r]=e(i,i=t[++r]);return function(e){var t=Math.max(0,Math.min(n-1,Math.floor(e*=n)));return a[t](e-t)}}(e,[r,n,i]),h):[d(0),d(.5),d(1)]}}return h.domain=function(o){return arguments.length?([s,u,c]=o,e=a(s=+s),t=a(u=+u),r=a(c=+c),n=e===t?0:.5/(t-e),i=t===r?0:.5/(r-t),l=t<e?-1:1,h):[s,u,c]},h.clamp=function(e){return arguments.length?(f=!!e,h):f},h.interpolator=function(e){return arguments.length?(d=e,h):d},h.range=p(G9e),h.rangeRound=p(V9e),h.unknown=function(e){return arguments.length?(o=e,h):o},function(o){return a=o,e=o(s),t=o(u),r=o(c),n=e===t?0:.5/(t-e),i=t===r?0:.5/(r-t),l=t<e?-1:1,h}}function $it(){var e=vrt(Lit());return e.copy=function(){return Nit(e,$it()).exponent(e.exponent())},jtt.apply(e,arguments)}fnt=function(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,u=e.shortMonths,c=xnt(i),l=Snt(i),d=xnt(a),f=Snt(a),h=xnt(o),p=Snt(o),m=xnt(s),g=Snt(s),v=xnt(u),y=Snt(u),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return u[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Gnt,e:Gnt,f:Xnt,g:ait,G:sit,H:Vnt,I:Hnt,j:qnt,L:Wnt,m:Ynt,M:Knt,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:kit,s:Iit,S:Znt,u:Qnt,U:Jnt,V:tit,w:rit,W:nit,x:null,X:null,y:iit,Y:oit,Z:uit,"%":Mit},_={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return u[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:cit,e:cit,f:pit,g:Cit,G:Pit,H:lit,I:dit,j:fit,L:hit,m:mit,M:git,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:kit,s:Iit,S:vit,u:yit,U:bit,V:xit,w:Sit,W:wit,x:null,X:null,y:Ait,Y:Tit,Z:Eit,"%":Mit},x={a:function(e,t,r){var n=h.exec(t.slice(r));return n?(e.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){var n=d.exec(t.slice(r));return n?(e.w=f.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){var n=v.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){var n=m.exec(t.slice(r));return n?(e.m=g.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,r,n){return A(e,t,r,n)},d:Ont,e:Ont,f:$nt,g:Mnt,G:Ent,H:Bnt,I:Bnt,j:Rnt,L:Lnt,m:Dnt,M:Nnt,p:function(e,t,r){var n=c.exec(t.slice(r));return n?(e.p=l.get(n[0].toLowerCase()),r+n[0].length):-1}
646,q:Int,Q:jnt,s:znt,S:Fnt,u:Ant,U:Cnt,V:Tnt,w:wnt,W:Pnt,x:function(e,t,n){return A(e,r,t,n)},X:function(e,t,r){return A(e,n,t,r)},y:Mnt,Y:Ent,Z:knt,"%":Unt};function S(e,t){return function(r){var n,i,a,o=[],s=-1,u=0,c=e.length;for(r instanceof Date||(r=new Date(+r));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(u,s)),null==(i=mnt[n=e.charAt(++s)])?i="e"===n?" ":"0":n=e.charAt(++s),(a=t[n])&&(n=a(r,i)),o.push(n),u=s+1);return o.push(e.slice(u,s)),o.join("")}}function w(e,t){return function(r){var n,i,a=dnt(1900,void 0,1);if(A(a,e,r+="",0)!=r.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(t&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(n=lnt(dnt(a.y,0,1))).getUTCDay(),n=i>4||0===i?Xrt.ceil(n):Xrt(n),n=Nrt.offset(n,7*(a.V-1)),a.y=n.getUTCFullYear(),a.m=n.getUTCMonth(),a.d=n.getUTCDate()+(a.w+6)%7):(i=(n=cnt(dnt(a.y,0,1))).getDay(),n=i>4||0===i?Urt.ceil(n):Urt(n),n=Brt.offset(n,7*(a.V-1)),a.y=n.getFullYear(),a.m=n.getMonth(),a.d=n.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?lnt(dnt(a.y,0,1)).getUTCDay():cnt(dnt(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,lnt(a)):cnt(a)}}function A(e,t,r,n){for(var i,a,o=0,s=t.length,u=r.length;o<s;){if(n>=u)return-1;if(37===(i=t.charCodeAt(o++))){if(i=t.charAt(o++),!(a=x[i in mnt?t.charAt(o++):i])||(n=a(e,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return b.x=S(r,b),b.X=S(n,b),b.c=S(t,b),_.x=S(r,_),_.X=S(n,_),_.c=S(t,_),{format:function(e){var t=S(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=w(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+="",_);return t.toString=function(){return e},t},utcParse:function(e){var t=w(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),hnt=fnt.format,fnt.parse,pnt=fnt.utcFormat,fnt.utcParse;var Uit=Object.freeze({__proto__:null,scaleBand:Vtt,scaleDiverging:function e(){var t=rrt(Lit()(Xtt));return t.copy=function(){return Nit(t,e())},jtt.apply(t,arguments)},scaleDivergingLog:function e(){var t=lrt(Lit()).domain([.1,1,10]);return t.copy=function(){return Nit(t,e()).base(t.base())},jtt.apply(t,arguments)},scaleDivergingPow:$it,scaleDivergingSqrt:function(){return $it.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function e(){var t=hrt(Lit());return t.copy=function(){return Nit(t,e()).constant(t.constant())},jtt.apply(t,arguments)},scaleIdentity:function e(t){var r;function n(e){return null==e||isNaN(e=+e)?r:e}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=Array.from(e,qtt),n):t.slice()},n.unknown=function(e){return arguments.length?(r=e,n):r},n.copy=function(){return e(t).unknown(r)},t=arguments.length?Array.from(t,qtt):[0,1],rrt(n)},scaleImplicit:ztt,scaleLinear:function e(){var t=ert();return t.copy=function(){return Qtt(t,e())},Utt.apply(t,arguments),rrt(t)},scaleLog:function e(){let t=lrt(Jtt()).domain([1,10]);return t.copy=()=>Qtt(t,e()).base(t.base()),Utt.apply(t,arguments),t},scaleOrdinal:Gtt,scalePoint:function(){return Htt(Vtt.apply(null,arguments).paddingInner(1))},scalePow:yrt,scaleQuantile:function e(){var t,r=[],n=[],i=[];function a(){var e=0,t=Math.max(1,n.length);for(i=Array(t-1);++e<t;)i[e-1]=z6e(r,e/t);return o}function o(e){return null==e||isNaN(e=+e)?t:n[T6e(i,e)]}return o.invertExtent=function(e){var t=n.indexOf(e);return t<0?[NaN,NaN]:[t>0?i[t-1]:r[0],t<i.length?i[t]:r[r.length-1]]},o.domain=function(e){if(!arguments.length)return r.slice();r=[];for(let t of e)null==t||isNaN(t=+t)||r.push(t);return r.sort(x6e),a()},o.range=function(e){return arguments.length?(n=Array.from(e),a()):n.slice()},o.unknown=function(e){return arguments.length?(t=e,o):t},o.quantiles=function(){return i.slice()},o.copy=function(){return e().domain(r).range(n).unknown(t)},Utt.apply(o,arguments)},scaleQuantize:function e(){var t,r=0,n=1,i=1,a=[.5],o=[0,1];function s(e){return null!=e&&e<=e?o[T6e(a,e,0,i)]:t}function u(){var e=-1;for(a=Array(i);++e<i;)a[e]=((e+1)*n-(e-i)*r)/(i+1);return s}return s.domain=function(e){return arguments.length?([r,n]=e,r=+r,n=+n,u()):[r,n]},s.range=function(e){return arguments.length?(i=(o=Array.from(e)).length-1,u()):o.slice()},s.invertExtent=function(e){var t=o.indexOf(e);return t<0?[NaN,NaN]:t<1?[r,a[0]]:t>=i?[a[i-1],n]:[a[t-1],a[t]]},s.unknown=function(e){return arguments.length&&(t=e),s},s.thresholds=function(){return a.slice()},s.copy=function(){return e().domain([r,n]).range(o).unknown(t)},Utt.apply(rrt(s),arguments)},scaleRadial:function e(){var t,r=ert(),n=[0,1],i=!1;function a(e){var n=function(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}(r(e));return isNaN(n)?t:i?Math.round(n):n}return a.invert=function(e){return r.invert(brt(e))},a.domain=function(e){return arguments.length?(r.domain(e),a):r.domain()},a.range=function(e){return arguments.length?(r.range((n=Array.from(e,qtt)).map(brt)),a):n.slice()},a.rangeRound=function(e){return a.range(e).round(!0)},a.round=function(e){return arguments.length?(i=!!e,a):i},a.clamp=function(e){return arguments.length?(r.clamp(e),a):r.clamp()},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return e(r.domain(),n).round(i).clamp(r.clamp()).unknown(t)},Utt.apply(a,arguments),rrt(a)},scaleSequential:function e(){var t=rrt(Bit()(Xtt));return t.copy=function(){return Nit(t,e())},jtt.apply(t,arguments)},scaleSequentialLog:function e(){var t=lrt(Bit()).domain([1,10]);return t.copy=function(){return Nit(t,e()).base(t.base())},jtt.apply(t,arguments)},scaleSequentialPow:Fit,scaleSequentialQuantile:function e(){var t=[],r=Xtt;function n(e){if(null!=e&&!isNaN(e=+e))return r((T6e(t,e,1)-1)/(t.length-1))}return n.domain=function(e){if(!arguments.length)return t.slice();t=[];for(let r of e)null==r||isNaN(r=+r)||t.push(r);return t.sort(x6e),n},n.interpolator=function(e){return arguments.length?(r=e,n):r},n.range=function(){return t.map((e,n)=>r(n/(t.length-1)))},n.quantiles=function(e){return Array.from({length:e+1},(r,n)=>function(e,t){if((r=(e=Float64Array.from(function*(e){for(let t of e)null!=t&&(t=+t)>=t&&(yield t)}(e))).length)&&!isNaN(t=+t)){if(t<=0||r<2)return $6e(e);if(t>=1)return L6e(e);
646var r,n=(r-1)*t,i=Math.floor(n),a=L6e(U6e(e,i).subarray(0,i+1));return a+($6e(e.subarray(i+1))-a)*(n-i)}}(t,n/e))},n.copy=function(){return e(r).domain(t)},jtt.apply(n,arguments)},scaleSequentialSqrt:function(){return Fit.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function e(){var t=hrt(Bit());return t.copy=function(){return Nit(t,e()).constant(t.constant())},jtt.apply(t,arguments)},scaleSqrt:function(){return yrt.apply(null,arguments).exponent(.5)},scaleSymlog:function e(){var t=hrt(Jtt());return t.copy=function(){return Qtt(t,e()).constant(t.constant())},Utt.apply(t,arguments)},scaleThreshold:function e(){var t,r=[.5],n=[0,1],i=1;function a(e){return null!=e&&e<=e?n[T6e(r,e,0,i)]:t}return a.domain=function(e){return arguments.length?(r=Array.from(e),i=Math.min(r.length,n.length-1),a):r.slice()},a.range=function(e){return arguments.length?(n=Array.from(e),i=Math.min(r.length,n.length-1),a):n.slice()},a.invertExtent=function(e){var t=n.indexOf(e);return[r[t-1],r[t]]},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return e().domain(r).range(n).unknown(t)},Utt.apply(a,arguments)},scaleTime:function(){return Utt.apply(Rit(snt,unt,rnt,ent,$rt,Brt,Ort,Irt,krt,hnt).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},scaleUtc:function(){return Utt.apply(Rit(ant,ont,nnt,tnt,Wrt,Nrt,Rrt,Drt,krt,pnt).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:trt});function jit(e){for(var t=e.length/6|0,r=Array(t),n=0;n<t;)r[n]="#"+e.slice(6*n,6*++n);return r}var zit=jit("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Git=jit("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Vit=jit("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Hit=jit("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),qit=jit("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Wit=jit("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Xit=jit("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Yit=jit("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Kit=jit("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Zit=jit("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),Qit=jit("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Jit=e=>R9e(e[e.length-1]),eat=[,,,"d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30"].map(jit),tat=Jit(eat),rat=[,,,"af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b"].map(jit),nat=Jit(rat),iat=[,,,"e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419"].map(jit),aat=Jit(iat),oat=[,,,"998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08"].map(jit),sat=Jit(oat),uat=[,,,"ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061"].map(jit),cat=Jit(uat),lat=[,,,"ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a"].map(jit),dat=Jit(lat),fat=[,,,"fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695"].map(jit),hat=Jit(fat),pat=[,,,"fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d
6467191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"].map(jit),mat=Jit(pat),gat=[,,,"fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2"].map(jit),vat=Jit(gat),yat=[,,,"e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b"].map(jit),bat=Jit(yat),_at=[,,,"e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b"].map(jit),xat=Jit(_at),Sat=[,,,"e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081"].map(jit),wat=Jit(Sat),Aat=[,,,"fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000"].map(jit),Cat=Jit(Aat),Tat=[,,,"ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636"].map(jit),Pat=Jit(Tat),Eat=[,,,"ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858"].map(jit),Mat=Jit(Eat),kat=[,,,"e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f"].map(jit),Iat=Jit(kat),Dat=[,,,"fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a"].map(jit),Oat=Jit(Dat),Rat=[,,,"edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58"].map(jit),Bat=Jit(Rat),Nat=[,,,"f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529"].map(jit),Fat=Jit(Nat),Lat=[,,,"fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506"].map(jit),$at=Jit(Lat),Uat=[,,,"ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026"].map(jit),jat=Jit(Uat),zat=[,,,"deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ec
646ae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b"].map(jit),Gat=Jit(zat),Vat=[,,,"e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b"].map(jit),Hat=Jit(Vat),qat=[,,,"f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000"].map(jit),Wat=Jit(qat),Xat=[,,,"efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d"].map(jit),Yat=Jit(Xat),Kat=[,,,"fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d"].map(jit),Zat=Jit(Kat),Qat=[,,,"fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704"].map(jit),Jat=Jit(Qat),eot=net(T9e(300,.5,0),T9e(-240,.5,1)),tot=net(T9e(-100,.75,.35),T9e(80,1.5,.8)),rot=net(T9e(260,.75,.35),T9e(80,1.5,.8)),not=T9e(),iot=$7e(),aot=Math.PI/3,oot=2*Math.PI/3;function sot(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var uot=sot(jit("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),cot=sot(jit("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb8
6461febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),lot=sot(jit("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),dot=sot(jit("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),fot=Object.freeze({__proto__:null,interpolateBlues:Gat,interpolateBrBG:tat,interpolateBuGn:bat,interpolateBuPu:xat,interpolateCividis:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-2710.57*e)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-67.37*e)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-2475.67*e)))))))+")"},interpolateCool:rot,interpolateCubehelixDefault:eot,interpolateGnBu:wat,interpolateGreens:Hat,interpolateGreys:Wat,interpolateInferno:lot,interpolateMagma:cot,interpolateOrRd:Cat,interpolateOranges:Jat,interpolatePRGn:nat,interpolatePiYG:aat,interpolatePlasma:dot,interpolatePuBu:Mat,interpolatePuBuGn:Pat,interpolatePuOr:sat,interpolatePuRd:Iat,interpolatePurples:Yat,interpolateRainbow:function(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return not.h=360*e-100,not.s=1.5-1.5*t,not.l=.8-.9*t,not+""},interpolateRdBu:cat,interpolateRdGy:dat,interpolateRdPu:Oat,interpolateRdYlBu:hat,interpolateRdYlGn:mat,interpolateReds:Zat,interpolateSinebow:function(e){var t;
vendor: 9,384 bytes, line 646
646return e=(.5-e)*Math.PI,iot.r=255*(t=Math.sin(e))*t,iot.g=255*(t=Math.sin(e+aot))*t,iot.b=255*(t=Math.sin(e+oot))*t,iot+""},interpolateSpectral:vat,interpolateTurbo:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"},interpolateViridis:uot,interpolateWarm:tot,interpolateYlGn:Fat,interpolateYlGnBu:Bat,interpolateYlOrBr:$at,interpolateYlOrRd:jat,schemeAccent:Git,schemeBlues:zat,schemeBrBG:eat,schemeBuGn:yat,schemeBuPu:_at,schemeCategory10:zit,schemeDark2:Vit,schemeGnBu:Sat,schemeGreens:Vat,schemeGreys:qat,schemeObservable10:Hit,schemeOrRd:Aat,schemeOranges:Qat,schemePRGn:rat,schemePaired:qit,schemePastel1:Wit,schemePastel2:Xit,schemePiYG:iat,schemePuBu:Eat,schemePuBuGn:Tat,schemePuOr:oat,schemePuRd:kat,schemePurples:Xat,schemeRdBu:uat,schemeRdGy:lat,schemeRdPu:Dat,schemeRdYlBu:fat,schemeRdYlGn:pat,schemeReds:Kat,schemeSet1:Yit,schemeSet2:Kit,schemeSet3:Zit,schemeSpectral:gat,schemeTableau10:Qit,schemeYlGn:Nat,schemeYlGnBu:Rat,schemeYlOrBr:Lat,schemeYlOrRd:Uat}),hot=e=>()=>e;function pot(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function mot(e,t,r){this.k=e,this.x=t,this.y=r}mot.prototype={constructor:mot,scale:function(e){return 1===e?this:new mot(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new mot(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var got=new mot(1,0,0);function vot(e){for(;!e.__zoom;)if(!(e=e.parentNode))return got;return e.__zoom}function yot(e){e.stopImmediatePropagation()}function bot(e){e.preventDefault(),e.stopImmediatePropagation()}function _ot(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function xot(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Sot(){return this.__zoom||got}function wot(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Aot(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cot(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}vot.prototype=mot.prototype;var Tot=Object.freeze({__proto__:null,ZoomTransform:mot,zoom:function(){var e,t,r,n=_ot,i=xot,a=Cot,o=wot,s=Aot,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,d=J9e,f=V6e("start","zoom","end"),h=0,p=10;function m(e){e.property("__zoom",Sot).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",C).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(u[0],Math.min(u[1],t)))===e.k?e:new mot(t,e.x,e.y)}function v(e,t,r){var n=t[0]-r[0]*e.k,i=t[1]-r[1]*e.k;return n===e.x&&i===e.y?e:new mot(e.k,n,i)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,r,n){e.on("start.zoom",function(){_(this,arguments).event(n).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(n).end()}).tween("zoom",function(){var e=this,a=arguments,o=_(e,a).event(n),s=i.apply(e,a),u=null==r?y(s):"function"==typeof r?r.apply(e,a):r,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=e.__zoom,f="function"==typeof t?t.apply(e,a):t,h=d(l.invert(u).concat(c/l.k),f.invert(u).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),r=c/t[2];e=new mot(r,u[0]-t[0]*r,u[1]-t[1]*r)}o.zoom(null,e)}})}function _(e,t,r){return!r&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function S(e,...t){if(n.apply(this,arguments)){var r=_(this,t).event(e),i=this.__zoom,s=Math.max(u[0],Math.min(u[1],i.k*2**o.apply(this,arguments))),l=d7e(e);if(r.wheel)r.mouse[0][0]===l[0]&&r.mouse[0][1]===l[1]||(r.mouse[1]=i.invert(r.mouse[0]=l)),clearTimeout(r.wheel);else{if(i.k===s)return;r.mouse=[l,i.invert(l)],Eet(this),r.start()}bot(e),r.wheel=setTimeout(function(){r.wheel=null,r.end()},150),r.zoom("mouse",a(v(g(i,s),r.mouse[0],r.mouse[1]),r.extent,c))}}function w(e,...t){if(!r&&n.apply(this,arguments)){var i=e.currentTarget,o=_(this,t,!0).event(e),s=o7e(e.view).on("mousemove.zoom",function(e){if(bot(e),!o.moved){var t=e.clientX-l,r=e.clientY-d;o.moved=t*t+r*r>h}o.event(e).zoom("mouse",a(v(o.that.__zoom,o.mouse[0]=d7e(e,i),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),g7e(e.view,o.moved),bot(e),o.event(e).end()},!0),u=d7e(e,i),l=e.clientX,d=e.clientY;m7e(e.view),yot(e),o.mouse=[u,this.__zoom.invert(u)],Eet(this),o.start()}}function A(e,...t){if(n.apply(this,arguments)){var r=this.__zoom,o=d7e(e.changedTouches?e.changedTouches[0]:e,this),s=r.invert(o),u=r.k*(e.shiftKey?.5:2),d=a(v(g(r,u),o,s),i.apply(this,t),c);bot(e),l>0?o7e(this).transition().duration(l).call(b,d,o,e):o7e(this).call(m.transform,d,o,e)}}function C(r,...i){if(n.apply(this,arguments)){var a,o,s,u,c=r.touches,l=c.length,d=_(this,i,r.changedTouches.length===l).event(r);for(yot(r),o=0;o<l;++o)u=[u=d7e(s=c[o],this),this.__zoom.invert(u),s.identifier],d.touch0?d.touch1||d.touch0[2]===u[2]||(d.touch1=u,d.taps=0):(d.touch0=u,a=!0,d.taps=1+!!e);e&&=clearTimeout(e),a&&(d.taps<2&&(t=u[0],e=setTimeout(function(){e=null},500)),Eet(this),d.start())}}function T(e,...t){if(this.__zooming){var r,n,i,o,s=_(this,t).event(e),u=e.changedTouches,l=u.length;for(bot(e),r=0;r<l;++r)i=d7e(n=u[r],this),s.touch0&&s.touch0[2]===n.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===n.identifier&&(s.touch1[0]=i);if(n=s.that.__zoom,s.touch1){var d=s.touch0[0],f=s.touch0[1],h=s.touch1[0],p=s.touch1[1],m=(m=h[0]-d[0])*m+(m=h[1]-d[1])*m,y=(y=p[0]-f[0])*y+(y=p[1]-f[1])*y;n=g(n,Math.sqrt(m/y)),i=[(d[0]+h[0])/2,(d[1]+h[1])/2],o=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],o=s.touch0[1]}s.zoom("touch",a(v(n,i,o),s.extent,c))}}function P(e,...n){if(this.__zooming){var i,a,o=_(this,n).event(e),s=e.changedTouches,u=s.length;for(yot(e),r&&clearTimeout(r),r=setTimeout(function(){r=null},500),i=0;i<u;++i)a=s[i],o.touch0&&o.touch0[2]===a.identifier?delete o.touch0:o.touch1&&o.touch1[2]===a.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(a=d7e(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<p)){var c=o7e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,r,n){var i=e.selection?e.selection():e;i.property("__zoom",Sot),e===i?i.interrupt().each(function(){_(this,arguments).event(n).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}):b(e,t,r,n)},m.scaleBy=function(e,t,r,n){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},r,n)},m.scaleTo=function(e,t,r,n){m.transform(e,function(){var e=i.apply(this,arguments),n=this.__zoom,o=null==r?y(e):"function"==typeof r?r.apply(this,arguments):r,s=n.invert(o),u="function"==typeof t?t.apply(this,arguments):t;return a(v(g(n,u),o,s),e,c)},r,n)},m.translateBy=function(e,t,r,n){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof r?r.apply(this,arguments):r),i.apply(this,arguments),c)},null,n)},m.translateTo=function(e,t,r,n,o){m.transform(e,function(){var e=i.apply(this,arguments),o=this.__zoom,s=null==n?y(e):"function"==typeof n?n.apply(this,arguments):n;return a(got.translate(s[0],s[1]).scale(o.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof r?-r.apply(this,arguments):-r),e,c)},n,o)},x.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit
646("end")),this},emit:function(e){var t=o7e(this.that).datum();f.call(e,this.that,new pot(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(o="function"==typeof e?e:hot(+e),m):o},m.filter=function(e){return arguments.length?(n="function"==typeof e?e:hot(!!e),m):n},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:hot(!!e),m):s},m.extent=function(e){return arguments.length?(i="function"==typeof e?e:hot([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):i},m.scaleExtent=function(e){return arguments.length?(u[0]=+e[0],u[1]=+e[1],m):[u[0],u[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(l=+e,m):l},m.interpolate=function(e){return arguments.length?(d=e,m):d},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,m):Math.sqrt(h)},m.tapDistance=function(e){return arguments.length?(p=+e,m):p},m},zoomIdentity:got,zoomTransform:vot}),Pot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof r.g<"u"?r.g:typeof self<"u"?self:{};function Eot(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Mot,kot={},Iot=Eot(_6e),Dot={},Oot={},Rot=Eot(Ctt),Bot=Eot(E9e),Not=Eot(Uit),Fot=Eot(fot),Lot=Eot(f7e),$ot=Eot(Tot);function Uot(){return Mot||(Mot=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Iot;t.__exportStar(Rot,e),t.__exportStar(Bot,e),t.__exportStar(Not,e),t.__exportStar(Fot,e),t.__exportStar(Lot,e),t.__exportStar($ot,e)}(Oot)),Oot}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorNames=e.Color=void 0,e.benchmarkColor=function(r,n,i){void 0===i&&(i=3);var a=e.Color.fromString(r),o=t.rgb(r);console.log(r,a,e.Color.toString(a),o,o.formatHex8());for(var s=0;s<i;s++){console.time("fromString");for(var u=0;u<n;u++)e.Color.fromString(r);console.timeEnd("fromString")}for(s=0;s<i;s++){for(console.time("d3 from string"),u=0;u<n;u++)t.rgb(r);console.timeEnd("d3 from string")}for(s=0;s<i;s++){var c=[0,0,0,0];for(console.time("toArray"),u=0;u<n;u++)e.Color.toRgbaArray(a,c,0);console.timeEnd("toArray")}for(s=0;s<i;s++){var l=o.r,d=o.g,f=o.b,h=o.opacity;for(console.time("fromRgba"),u=0;u<n;u++)e.Color.fromRgba(l,d,f,h);console.timeEnd("fromRgba")}for(s=0;s<i;s++){for(console.time("toString"),u=0;u<n;u++)e.Color.toString(a);console.timeEnd("toString")}};var t=Iot.__importStar(Uot()),r=255,n=1/r;function i(e){return e<65?e-48:e<97?e-55:e-87}function a(e){return e<=9?48+e:87+e}e.Color={fromNumber:function(e){return e},fromRgba:function(e,t,n,i){return r*i<<24|e<<16|t<<8|n},fromRgb:function(e,t,r){return-16777216|e<<16|t<<8|r},fromString:function(r){var n=e.ColorNames[r];if(n)return n;if("#"===r[0]){if(7===r.length)return o|i(r.charCodeAt(1))<<20|i(r.charCodeAt(2))<<16|i(r.charCodeAt(3))<<12|i(r.charCodeAt(4))<<8|i(r.charCodeAt(5))<<4|i(r.charCodeAt(6));if(9===r.length)return(i(r.charCodeAt(7))<<4|i(r.charCodeAt(8)))<<24|i(r.charCodeAt(1))<<20|i(r.charCodeAt(2))<<16|i(r.charCodeAt(3))<<12|i(r.charCodeAt(4))<<8|i(r.charCodeAt(5))<<4|i(r.charCodeAt(6));if(4===r.length)return o|17*i(r.charCodeAt(1))<<16|17*i(r.charCodeAt(2))<<8|17*i(r.charCodeAt(3));if(5===r.length)return 17*i(r.charCodeAt(4))<<24|17*i(r.charCodeAt(1))<<16|17*i(r.charCodeAt(2))<<8|17*i(r.charCodeAt(3))}var a=t.rgb(r),s=a.r,u=a.g,c=a.b,l=a.opacity;return isNaN(s)||isNaN(u)||isNaN(c)||isNaN(l)?e.Color.fromRgba(0,0,0,0):e.Color.fromRgba(s,u,c,l)},toString:function(e){var t=e>>>24&255;return t===r?String.fromCharCode(35,a(e>>>20&15),a(e>>>16&15),a(e>>>12&15),a(e>>>8&15),a(e>>>4&15),a(15&e)):String.fromCharCode(35,a(e>>>20&15),a(e>>>16&15),a(e>>>12&15),a(e>>>8&15),a(e>>>4&15),a(15&e),a(t>>>4&15),a(15&t))},toRgba:function(e){return{r:e>>>16&255,g:e>>>8&255,b:255&e,opacity:n*(e>>>24&255)}},toRgbaArray:function(e,t,r){var n=e>>>24&255,i=e>>>16&255,a=e>>>8&255,o=255&e;t[r]=i,t[r+1]=a,t[r+2]=o,t[r+3]=n},toRgbArray:function(e,t,r){var n=e>>>16&255,i=e>>>8&255,a=255&e;t[r]=n,t[r+1]=i,t[r+2]=a},toAragabaArray:function(e,t,r){var i=e>>>24&255,a=n*i,o=e>>>16&255,s=e>>>8&255,u=255&e;t[r]=i,t[r+1]=o*a,t[r+2]=s*a,t[r+3]=u*a},addToAragabaArray:function(e,t,r){var i=e>>>24&255,a=n*i,o=e>>>16&255,s=e>>>8&255,u=255&e;t[r]+=i,t[r+1]+=o*a,t[r+2]+=s*a,t[r+3]+=u*a},fromAragabaArray:function(e,t){var n=e[t],i=n>0?r/n:0;return n<<24|i*e[t+1]<<16|i*e[t+2]<<8|i*e[t+3]},mix:function(e,t,r){return(1-r)*(e>>>24&255)+r*(t>>>24&255)<<24|(1-r)*(e>>>16&255)+r*(t>>>16&255)<<16|(1-r)*(e>>>8&255)+r*(t>>>8&255)<<8|(1-r)*(255&e)+r*(255&t)},scaleAlpha:function(e,t){return t*(e>>>24&255)<<24|e&s}};var o=-16777216,s=16777215;e.ColorNames={aliceblue:15792383|o,antiquewhite:16444375|o,aqua:65535|o,aquamarine:8388564|o,azure:15794175|o,beige:16119260|o,bisque:16770244|o,black:0|o,blanchedalmond:16772045|o,blue:255|o,blueviolet:9055202|o,brown:10824234|o,burlywood:14596231|o,cadetblue:6266528|o,chartreuse:8388352|o,chocolate:13789470|o,coral:16744272|o,cornflower:6591981|o,cornflowerblue:6591981|o,cornsilk:16775388|o,
646crimson:14423100|o,cyan:65535|o,darkblue:139|o,darkcyan:35723|o,darkgoldenrod:12092939|o,darkgray:11119017|o,darkgreen:25600|o,darkgrey:11119017|o,darkkhaki:12433259|o,darkmagenta:9109643|o,darkolivegreen:5597999|o,darkorange:16747520|o,darkorchid:10040012|o,darkred:9109504|o,darksalmon:15308410|o,darkseagreen:9419919|o,darkslateblue:4734347|o,darkslategray:3100495|o,darkslategrey:3100495|o,darkturquoise:52945|o,darkviolet:9699539|o,deeppink:16716947|o,deepskyblue:49151|o,dimgray:6908265|o,dimgrey:6908265|o,dodgerblue:2003199|o,firebrick:11674146|o,floralwhite:16775920|o,forestgreen:2263842|o,fuchsia:16711935|o,gainsboro:14474460|o,ghostwhite:16316671|o,gold:16766720|o,goldenrod:14329120|o,gray:8421504|o,green:32768|o,greenyellow:11403055|o,grey:8421504|o,honeydew:15794160|o,hotpink:16738740|o,indianred:13458524|o,indigo:4915330|o,ivory:16777200|o,khaki:15787660|o,laserlemon:16777044|o,lavender:15132410|o,lavenderblush:16773365|o,lawngreen:8190976|o,lemonchiffon:16775885|o,lightblue:11393254|o,lightcoral:15761536|o,lightcyan:14745599|o,lightgoldenrod:16448210|o,lightgoldenrodyellow:16448210|o,lightgray:13882323|o,lightgreen:9498256|o,lightgrey:13882323|o,lightpink:16758465|o,lightsalmon:16752762|o,lightseagreen:2142890|o,lightskyblue:8900346|o,lightslategray:7833753|o,lightslategrey:7833753|o,lightsteelblue:11584734|o,lightyellow:16777184|o,lime:65280|o,limegreen:3329330|o,linen:16445670|o,magenta:16711935|o,maroon:8388608|o,maroon2:8323072|o,maroon3:11546720|o,mediumaquamarine:6737322|o,mediumblue:205|o,mediumorchid:12211667|o,mediumpurple:9662683|o,mediumseagreen:3978097|o,mediumslateblue:8087790|o,mediumspringgreen:64154|o,mediumturquoise:4772300|o,mediumvioletred:13047173|o,midnightblue:1644912|o,mintcream:16121850|o,mistyrose:16770273|o,moccasin:16770229|o,navajowhite:16768685|o,navy:128|o,oldlace:16643558|o,olive:8421376|o,olivedrab:7048739|o,orange:16753920|o,orangered:16729344|o,orchid:14315734|o,palegoldenrod:15657130|o,palegreen:10025880|o,paleturquoise:11529966|o,palevioletred:14381203|o,papayawhip:16773077|o,peachpuff:16767673|o,peru:13468991|o,pink:16761035|o,plum:14524637|o,powderblue:11591910|o,purple:8388736|o,purple2:8323199|o,purple3:10494192|o,rebeccapurple:6697881|o,red:16711680|o,rosybrown:12357519|o,royalblue:4286945|o,saddlebrown:9127187|o,salmon:16416882|o,sandybrown:16032864|o,seagreen:3050327|o,seashell:16774638|o,sienna:10506797|o,silver:12632256|o,skyblue:8900331|o,slateblue:6970061|o,slategray:7372944|o,slategrey:7372944|o,snow:16775930|o,springgreen:65407|o,steelblue:4620980|o,tan:13808780|o,teal:32896|o,thistle:14204888|o,tomato:16737095|o,turquoise:4251856|o,violet:15631086|o,wheat:16113331|o,white:16777215|o,whitesmoke:16119285|o,yellow:16776960|o,yellowgreen:10145074|o}}(Dot);var jot,zot,Got={},Vot={exports:{}};jot=Vot,zot=Vot.exports,function(){var e,t="Expected a function",r="__lodash_hash_undefined__",n="__lodash_placeholder__",i=32,a=128,o=1/0,s=9007199254740991,u=NaN,c=4294967295,l=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",256]],d="[object Arguments]",f="[object Array]",h="[object Boolean]",p="[object Date]",m="[object Error]",g="[object Function]",v="[object GeneratorFunction]",y="[object Map]",b="[object Number]",_="[object Object]",x="[object Promise]",S="[object RegExp]",w="[object Set]",A="[object String]",C="[object Symbol]",T="[object WeakMap]",P="[object ArrayBuffer]",E="[object DataView]",M="[object Float32Array]",k="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",R="[object Uint8Array]",B="[object Uint8ClampedArray]",N="[object Uint16Array]",F="[object Uint32Array]",L=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,z=/[&<>"']/g,G=RegExp(j.source),V=RegExp(z.source),H=/<%-([\s\S]+?)%>/g,q=/<%([\s\S]+?)%>/g,W=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,K=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,Q=RegExp(Z.source),J=/^\s+/,ee=/\s/,te=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,re=/\{\n\/\* \[wrapped with (.+)\] \*/,ne=/,? & /,ie=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ae=/[()=,{}\[\]\/\s]/,oe=/\\(\\)?/g,se=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ue=/\w*$/,ce=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,fe=/^0o[0-7]+$/i,he=/^(?:0|[1-9]\d*)$/,pe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 7,270 bytes, line 646
6467f]/g,me=/($^)/,ge=/['\n\r\u2028\u2029\\]/g,ve="\\ud800-\\udfff",ye="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",Se="\\ufe0e\\ufe0f",we="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ae="["+ve+"]",Ce="["+we+"]",Te="["+ye+"]",Pe="\\d+",Ee="["+be+"]",Me="["+_e+"]",ke="[^"+ve+we+Pe+be+_e+xe+"]",Ie="\\ud83c[\\udffb-\\udfff]",De="[^"+ve+"]",Oe="(?:\\ud83c[\\udde6-\\uddff]){2}",Re="[\\ud800-\\udbff][\\udc00-\\udfff]",Be="["+xe+"]",Ne="\\u200d",Fe="(?:"+Me+"|"+ke+")",Le="(?:"+Be+"|"+ke+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",je="(?:"+Te+"|"+Ie+")?",ze="["+Se+"]?",Ge=ze+je+"(?:"+Ne+"(?:"+[De,Oe,Re].join("|")+")"+ze+je+")*",Ve="(?:"+[Ee,Oe,Re].join("|")+")"+Ge,He="(?:"+[De+Te+"?",Te,Oe,Re,Ae].join("|")+")",qe=RegExp("['’]","g"),We=RegExp(Te,"g"),Xe=RegExp(Ie+"(?="+Ie+")|"+He+Ge,"g"),Ye=RegExp([Be+"?"+Me+"+"+$e+"(?="+[Ce,Be,"$"].join("|")+")",Le+"+"+Ue+"(?="+[Ce,Be+Fe,"$"].join("|")+")",Be+"?"+Fe+"+"+$e,Be+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pe,Ve].join("|"),"g"),Ke=RegExp("["+Ne+ve+ye+Se+"]"),Ze=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qe="Array.Buffer.DataView.Date.Error.Float32Array.Float64Array.Function.Int8Array.Int16Array.Int32Array.Map.Math.Object.Promise.RegExp.Set.String.Symbol.TypeError.Uint8Array.Uint8ClampedArray.Uint16Array.Uint32Array.WeakMap._.clearTimeout.isFinite.parseInt.setTimeout".split("."),Je=-1,et={};et[M]=et[k]=et[I]=et[D]=et[O]=et[R]=et[B]=et[N]=et[F]=!0,et[d]=et[f]=et[P]=et[h]=et[E]=et[p]=et[m]=et[g]=et[y]=et[b]=et[_]=et[S]=et[w]=et[A]=et[T]=!1;var tt={};tt[d]=tt[f]=tt[P]=tt[E]=tt[h]=tt[p]=tt[M]=tt[k]=tt[I]=tt[D]=tt[O]=tt[y]=tt[b]=tt[_]=tt[S]=tt[w]=tt[A]=tt[C]=tt[R]=tt[B]=tt[N]=tt[F]=!0,tt[m]=tt[g]=tt[T]=!1;var rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nt=parseFloat,it=parseInt,at="object"==typeof Pot&&Pot&&Pot.Object===Object&&Pot,ot="object"==typeof self&&self&&self.Object===Object&&self,st=at||ot||Function("return this")(),ut=zot&&!zot.nodeType&&zot,ct=ut&&jot&&!jot.nodeType&&jot,lt=ct&&ct.exports===ut,dt=lt&&at.process,ft=function(){try{return ct&&ct.require&&ct.require("util").types||dt&&dt.binding&&dt.binding("util")}catch{}}(),ht=ft&&ft.isArrayBuffer,pt=ft&&ft.isDate,mt=ft&&ft.isMap,gt=ft&&ft.isRegExp,vt=ft&&ft.isSet,yt=ft&&ft.isTypedArray;function bt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function _t(e,t,r,n){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),e)}return n}function xt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function St(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function wt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function At(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}function Ct(e,t){return!(null==e||!e.length)&&Bt(e,t,0)>-1}function Tt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Pt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Et(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Mt(e,t,r,n){var i=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function kt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function It(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Dt=$t("length");function Ot(e,t,r){var n;return r(e,function(e,r,i){if(t(e,r,i))return n=r,!1}),n}function Rt(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Bt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Rt(e,Ft,r)}function Nt(e,t,r,n){for(var i=r-1,a=e.length;++i<a;)if(n(e[i],t))return i;return-1}function Ft(e){return e!=e}function Lt(e,t){var r=null==e?0:e.length;return r?zt(e,t)/r:u}function $t(t){return function(r){return null==r?e:r[t]}}function Ut(t){return function(r){return null==t?e:t[r]}}function jt(e,t,r,n,i){return i(e,function(e,i,a){r=n?(n=!1,e):t(r,e,i,a)}),r}function zt(t,r){for(var n,i=-1,a=t.length;++i<a;){var o=r(t[i]);o!==e&&(n=n===e?o:n+o)}return n}function Gt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Vt(e){return e&&e.slice(0,or(e)+1).replace(J,"")}function Ht(e){return function(t){return e(t)}}function qt(e,t){return Pt(t,function(t){return e[t]})}function Wt(e,t){return e.has(t)}function Xt(e,t){for(var r=-1,n=e.length;++r<n&&Bt(t,e[r],0)>-1;);return r}function Yt(e,t){for(var r=e.length;r--&&Bt(t,e[r],0)>-1;);return r}var Kt=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Zt=Ut({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Qt(e){return"\\"+rt[e]}function Jt(e){return Ke.test(e)}function er(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function tr(e,t){return function(r){return e(t(r))}}function rr(e,t){for(var r=-1,i=e.length,a=0,o=[];++r<i;){var s=e[r];s!==t&&s!==n||(e[r]=n,o[a++]=r)}return o}function nr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function ir(e){return Jt(e)?function(e){for(var t=Xe.lastIndex=0;Xe.test(e);)++t;return t}(e):Dt(e)}function ar(e){return Jt(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function or(e){for(var t=e.length;t--&&ee.test(e.charAt(t)););return t}var sr=Ut({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}
vendor: 8,358 bytes, line 646
646),ur=function ee(ve){var ye,be=(ve=null==ve?st:ur.defaults(st.Object(),ve,ur.pick(st,Qe))).Array,_e=ve.Date,xe=ve.Error,Se=ve.Function,we=ve.Math,Ae=ve.Object,Ce=ve.RegExp,Te=ve.String,Pe=ve.TypeError,Ee=be.prototype,Me=Se.prototype,ke=Ae.prototype,Ie=ve["__core-js_shared__"],De=Me.toString,Oe=ke.hasOwnProperty,Re=0,Be=(ye=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+ye:"",Ne=ke.toString,Fe=De.call(Ae),Le=st._,$e=Ce("^"+De.call(Oe).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=lt?ve.Buffer:e,je=ve.Symbol,ze=ve.Uint8Array,Ge=Ue?Ue.allocUnsafe:e,Ve=tr(Ae.getPrototypeOf,Ae),He=Ae.create,Xe=ke.propertyIsEnumerable,Ke=Ee.splice,rt=je?je.isConcatSpreadable:e,at=je?je.iterator:e,ot=je?je.toStringTag:e,ut=function(){try{var e=sa(Ae,"defineProperty");return e({},"",{}),e}catch{}}(),ct=ve.clearTimeout!==st.clearTimeout&&ve.clearTimeout,dt=_e&&_e.now!==st.Date.now&&_e.now,ft=ve.setTimeout!==st.setTimeout&&ve.setTimeout,Dt=we.ceil,Ut=we.floor,cr=Ae.getOwnPropertySymbols,lr=Ue?Ue.isBuffer:e,dr=ve.isFinite,fr=Ee.join,hr=tr(Ae.keys,Ae),pr=we.max,mr=we.min,gr=_e.now,vr=ve.parseInt,yr=we.random,br=Ee.reverse,_r=sa(ve,"DataView"),xr=sa(ve,"Map"),Sr=sa(ve,"Promise"),wr=sa(ve,"Set"),Ar=sa(ve,"WeakMap"),Cr=sa(Ae,"create"),Tr=Ar&&new Ar,Pr={},Er=Oa(_r),Mr=Oa(xr),kr=Oa(Sr),Ir=Oa(wr),Dr=Oa(Ar),Or=je?je.prototype:e,Rr=Or?Or.valueOf:e,Br=Or?Or.toString:e;function Nr(e){if(Zo(e)&&!Uo(e)&&!(e instanceof Ur)){if(e instanceof $r)return e;if(Oe.call(e,"__wrapped__"))return Ra(e)}return new $r(e)}var Fr=function(){function t(){}return function(r){if(!Ko(r))return{};if(He)return He(r);t.prototype=r;var n=new t;return t.prototype=e,n}}();function Lr(){}function $r(t,r){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=e}function Ur(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=c,this.__views__=[]}function jr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function zr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Gr;++t<r;)this.add(e[t])}function Hr(e){var t=this.__data__=new zr(e);this.size=t.size}function qr(e,t){var r=Uo(e),n=!r&&$o(e),i=!r&&!n&&Vo(e),a=!r&&!n&&!i&&as(e),o=r||n||i||a,s=o?Gt(e.length,Te):[],u=s.length;for(var c in e)!t&&!Oe.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||pa(c,u))||s.push(c);return s}function Wr(t){var r=t.length;return r?t[Vn(0,r-1)]:e}function Xr(e,t){return ka(Ci(e),nn(t,0,e.length))}function Yr(e){return ka(Ci(e))}function Kr(t,r,n){(n!==e&&!No(t[r],n)||n===e&&!(r in t))&&tn(t,r,n)}function Zr(t,r,n){var i=t[r];Oe.call(t,r)&&No(i,n)&&(n!==e||r in t)||tn(t,r,n)}function Qr(e,t){for(var r=e.length;r--;)if(No(e[r][0],t))return r;return-1}function Jr(e,t,r,n){return cn(e,function(e,i,a){t(n,e,r(e),a)}),n}function en(e,t){return e&&Ti(t,Ps(t),e)}function tn(e,t,r){"__proto__"==t&&ut?ut(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function rn(t,r){for(var n=-1,i=r.length,a=be(i),o=null==t;++n<i;)a[n]=o?e:Ss(t,r[n]);return a}function nn(t,r,n){return t==t&&(n!==e&&(t=t<=n?t:n),r!==e&&(t=t>=r?t:r)),t}function an(t,r,n,i,a,o){var s,u=1&r,c=2&r,l=4&r;if(n&&(s=a?n(t,i,a,o):n(t)),s!==e)return s;if(!Ko(t))return t;var f=Uo(t);if(f){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(t),!u)return Ci(t,s)}else{var m=la(t),x=m==g||m==v;if(Vo(t))return bi(t,u);if(m==_||m==d||x&&!a){if(s=c||x?{}:fa(t),!u)return c?function(e,t){return Ti(e,ca(e),t)}(t,function(e,t){return e&&Ti(t,Es(t),e)}(s,t)):function(e,t){return Ti(e,ua(e),t)}(t,en(s,t))}else{if(!tt[m])return a?t:{};s=function(e,t,r){var n,i=e.constructor;switch(t){case P:return _i(e);case h:case p:return new i(+e);case E:return function(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case M:case k:case I:case D:case O:case R:case B:case N:case F:return xi(e,r);case y:return new i;case b:case A:return new i(e);case S:return function(e){var t=new e.constructor(e.source,ue.exec(e));return t.lastIndex=e.lastIndex,t}(e);case w:return new i;case C:return n=e,Rr?Ae(Rr.call(n)):{}}}(t,m,u)}}o||=new Hr;var T=o.get(t);if(T)return T;o.set(t,s),rs(t)?t.forEach(function(e){s.add(an(e,r,n,e,t,o))}):Qo(t)&&t.forEach(function(e,i){s.set(i,an(e,r,n,i,t,o))});var L=f?e:(l?c?ea:Ji:c?Es:Ps)(t);return xt(L||t,function(e,i){L&&(e=t[i=e]),Zr(s,i,an(e,r,n,i,t,o))}),s}function on(t,r,n){var i=n.length;if(null==t)return!i;for(t=Ae(t);i--;){var a=n[i],o=r[a],s=t[a];if(s===e&&!(a in t)||!o(s))return!1}return!0}function sn(r,n,i){if("function"!=typeof r)throw new Pe(t);return Ta(function(){r.apply(e,i)},n)}function un(e,t,r,n){var i=-1,a=Ct,o=!0,s=e.length,u=[],c=t.length;if(!s)return u;r&&(t=Pt(t,Ht(r))),n?(a=Tt,o=!1):t.length>=200&&(a=Wt,o=!1,t=new Vr(t));e:for(;++i<s;){var l=e[i],d=null==r?l:r(l);if(l=n||0!==l?l:0,o&&d==d){for(var f=c;f--;)if(t[f]===d)continue e;u.push(l)}else a(t,d,n)||u.push(l)}return u}Nr.templateSettings={escape:H,evaluate:q,interpolate:W,variable:"",imports:{_:Nr}},Nr.prototype=Lr.prototype,Nr.prototype.constructor=Nr,$r.prototype=Fr(Lr.prototype),$r.prototype.constructor=$r,Ur.prototype=Fr(Lr.prototype),Ur.prototype.constructor=Ur,jr.prototype.clear=function(){this.__data__=Cr?Cr(null):{},this.size=0},jr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},jr.prototype.get=function(t){var n=this.__data__;if(Cr){var i=n[t];return i===r?e:i}return Oe.call(n,t)?n[t]:e},jr.prototype.has=function(t){var r=this.__data__;return Cr?r[t]!==e:Oe.call(r,t)},jr.prototype.set=function(t,n){var i=this.__data__;return this.size+=+!this.has(t),i[t]=Cr&&n===e?r:n,this},zr.prototype.clear=function(){this.__data__=[],this.size=0},zr.prototype.delete=function(e){var t=this.__data__,r=Qr(t,e);return!(r<0||(r==t.length-1?t.pop():Ke.call(t,r,1),--this.size,0))},zr.prototype.get=function(t){var r=this.__data__,n=Qr(r,t);return n<0?e:r[n][1]},zr.prototype.has=function(e){return Qr(this.__data__,e)>-1},zr.prototype.set=function(e,t){var r=this.__data__,n=Qr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Gr.prototype.clear=function(){this.size=0,this.__data__={hash:new jr,map:new(xr||zr),string:new jr}},Gr.prototype.delete=function(e){var t=aa(this,e).delete(e);return this.size-=+!!t,t},Gr.prototype.get=function(e){return aa(this,e).get(e)},Gr.prototype.has=function(e){return aa(this,e).has(e)},Gr.prototype.set=function(e,t){var r=aa(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr.prototype.add=Vr.prototype.push=function(e){return this.__data__.set(e,r),this},Vr.prototype.has=function(e){return this.__data__.has(e)},Hr.prototype.clear=function(){this.__data__=new zr,this.size=0},Hr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Hr.prototype.get=function(e){return this.__data__.get(e)},Hr.prototype.has=function(e){return this.__data__.has(e)},Hr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof zr){var n=r.__data__;if(!xr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Gr(n)}return r.set(e,t),this.size=r.size,this};var cn=Mi(vn),ln=Mi(yn,!0);function dn(e,t){var r=!0;return cn(e,function(e,n,i){return r=!!t(e,n,i)}),r}function fn(t,r,n){for(var i=-1,a=t.length;++i<a;){var o=t[i],s=r(o);if(null!=s&&(u===e?s==s&&!is(s):n(s,u)))var u=s,c=o}return c}function hn(e,t){var r=[];return cn(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function pn(e,t,r,n,i){var a=-1,o=e.length;for(r||=ha,i||=[];++a<o;){var s=e[a];t>0&&r(s)?t>1?pn(s,t-1,r,n,i):Et(i,s):n||(i[i.length]=s)}return i}var mn=ki(),gn=ki(!0);function vn(e,t){return e&&mn(e,t,Ps)}function yn(e,t){return e&&gn(e,t,Ps)}function bn(e,t){return At(t,function(t){return Wo(e[t])})}function _n(t,r){for(var n=0,i=(r=mi(r,t)).length;null!=t&&n<i;)t=t[Da(r[n++])];return n&&n==i?t:e}function xn(e,t,r){var n=t(e);return Uo(e)?n:Et(n,r(e))}
vendor: 1,812 bytes, line 646
646function Sn(t){return null==t?t===e?"[object Undefined]":"[object Null]":ot&&ot in Ae(t)?function(t){var r=Oe.call(t,ot),n=t[ot];try{t[ot]=e;var i=!0}catch{}var a=Ne.call(t);return i&&(r?t[ot]=n:delete t[ot]),a}(t):function(e){return Ne.call(e)}(t)}function wn(e,t){return e>t}function An(e,t){return null!=e&&Oe.call(e,t)}function Cn(e,t){return null!=e&&t in Ae(e)}function Tn(t,r,n){for(var i=n?Tt:Ct,a=t[0].length,o=t.length,s=o,u=be(o),c=1/0,l=[];s--;){var d=t[s];s&&r&&(d=Pt(d,Ht(r))),c=mr(d.length,c),u[s]=!n&&(r||a>=120&&d.length>=120)?new Vr(s&&d):e}d=t[0];var f=-1,h=u[0];e:for(;++f<a&&l.length<c;){var p=d[f],m=r?r(p):p;if(p=n||0!==p?p:0,!(h?Wt(h,m):i(l,m,n))){for(s=o;--s;){var g=u[s];if(!(g?Wt(g,m):i(t[s],m,n)))continue e}h&&h.push(m),l.push(p)}}return l}function Pn(t,r,n){var i=null==(t=wa(t,r=mi(r,t)))?t:t[Da(Ha(r))];return null==i?e:bt(i,t,n)}function En(e){return Zo(e)&&Sn(e)==d}function Mn(t,r,n,i,a){return t===r||(null==t||null==r||!Zo(t)&&!Zo(r)?t!=t&&r!=r:function(t,r,n,i,a,o){var s=Uo(t),u=Uo(r),c=s?f:la(t),l=u?f:la(r),g=(c=c==d?_:c)==_,v=(l=l==d?_:l)==_,x=c==l;if(x&&Vo(t)){if(!Vo(r))return!1;s=!0,g=!1}if(x&&!g)return o||=new Hr,s||as(t)?Zi(t,r,n,i,a,o):function(e,t,r,n,i,a,o){switch(r){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case P:return!(e.byteLength!=t.byteLength||!a(new ze(e),new ze(t)));case h:case p:case b:return No(+e,+t);case m:return e.name==t.name&&e.message==t.message;case S:case A:return e==t+"";case y:var s=er;case w:var u=1&n;if(s||=nr,e.size!=t.size&&!u)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var l=Zi(s(e),s(t),n,i,a,o);return o.delete(e),l;case C:if(Rr)return Rr.call(e)==Rr.call(t)}return!1}(t,r,c,n,i,a,o);if(!(1&n)){var T=g&&Oe.call(t,"__wrapped__"),M=v&&Oe.call(r,"__wrapped__");
vendor: 36,038 bytes, line 646
646if(T||M){var k=T?t.value():t,I=M?r.value():r;return o||=new Hr,a(k,I,n,i,o)}}return!!x&&(o||=new Hr,function(t,r,n,i,a,o){var s=1&n,u=Ji(t),c=u.length;if(c!=Ji(r).length&&!s)return!1;for(var l=c;l--;){var d=u[l];if(!(s?d in r:Oe.call(r,d)))return!1}var f=o.get(t),h=o.get(r);if(f&&h)return f==r&&h==t;var p=!0;o.set(t,r),o.set(r,t);for(var m=s;++l<c;){var g=t[d=u[l]],v=r[d];if(i)var y=s?i(v,g,d,r,t,o):i(g,v,d,t,r,o);if(!(y===e?g===v||a(g,v,n,i,o):y)){p=!1;break}m||="constructor"==d}if(p&&!m){var b=t.constructor,_=r.constructor;b==_||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(t),o.delete(r),p}(t,r,n,i,a,o))}(t,r,n,i,Mn,a))}function kn(t,r,n,i){var a=n.length,o=a,s=!i;if(null==t)return!o;for(t=Ae(t);a--;){var u=n[a];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++a<o;){var c=(u=n[a])[0],l=t[c],d=u[1];if(s&&u[2]){if(l===e&&!(c in t))return!1}else{var f=new Hr;if(i)var h=i(l,d,c,t,r,f);if(!(h===e?Mn(d,l,3,i,f):h))return!1}}return!0}function In(e){return!(!Ko(e)||(t=e,Be&&Be in t))&&(Wo(e)?$e:de).test(Oa(e));var t}function Dn(e){return"function"==typeof e?e:null==e?Js:"object"==typeof e?Uo(e)?Fn(e[0],e[1]):Nn(e):uu(e)}function On(e){if(!ba(e))return hr(e);var t=[];for(var r in Ae(e))Oe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Rn(e,t){return e<t}function Bn(e,t){var r=-1,n=zo(e)?be(e.length):[];return cn(e,function(e,i,a){n[++r]=t(e,i,a)}),n}function Nn(e){var t=oa(e);return 1==t.length&&t[0][2]?xa(t[0][0],t[0][1]):function(r){return r===e||kn(r,e,t)}}function Fn(t,r){return ga(t)&&_a(r)?xa(Da(t),r):function(n){var i=Ss(n,t);return i===e&&i===r?ws(n,t):Mn(r,i,3)}}function Ln(t,r,n,i,a){t!==r&&mn(r,function(o,s){if(a||=new Hr,Ko(o))!function(t,r,n,i,a,o,s){var u=Aa(t,n),c=Aa(r,n),l=s.get(c);if(l)Kr(t,n,l);else{var d=o?o(u,c,n+"",t,r,s):e,f=d===e;if(f){var h=Uo(c),p=!h&&Vo(c),m=!h&&!p&&as(c);d=c,h||p||m?Uo(u)?d=u:Go(u)?d=Ci(u):p?(f=!1,d=bi(c,!0)):m?(f=!1,d=xi(c,!0)):d=[]:es(c)||$o(c)?(d=u,$o(u)?d=hs(u):Ko(u)&&!Wo(u)||(d=fa(c))):f=!1}f&&(s.set(c,d),a(d,c,i,o,s),s.delete(c)),Kr(t,n,d)}}(t,r,s,n,Ln,i,a);else{var u=i?i(Aa(t,s),o,s+"",t,r,a):e;u===e&&(u=o),Kr(t,s,u)}},Es)}function $n(t,r){var n=t.length;if(n)return pa(r+=r<0?n:0,n)?t[r]:e}function Un(e,t,r){t=t.length?Pt(t,function(e){return Uo(e)?function(t){return _n(t,1===e.length?e[0]:e)}:e}):[Js];var n=-1;return t=Pt(t,Ht(ia())),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(Bn(e,function(e,r,i){return{criteria:Pt(t,function(t){return t(e)}),index:++n,value:e}}),function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,a=t.criteria,o=i.length,s=r.length;++n<o;){var u=Si(i[n],a[n]);if(u)return n>=s?u:u*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)})}function jn(e,t,r){for(var n=-1,i=t.length,a={};++n<i;){var o=t[n],s=_n(e,o);r(s,o)&&Yn(a,mi(o,e),s)}return a}function zn(e,t,r,n){var i=n?Nt:Bt,a=-1,o=t.length,s=e;for(e===t&&(t=Ci(t)),r&&(s=Pt(e,Ht(r)));++a<o;)for(var u=0,c=t[a],l=r?r(c):c;(u=i(s,l,u,n))>-1;)s!==e&&Ke.call(s,u,1),Ke.call(e,u,1);return e}function Gn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==a){var a=i;pa(i)?Ke.call(e,i,1):si(e,i)}}return e}function Vn(e,t){return e+Ut(yr()*(t-e+1))}function Hn(e,t){var r="";if(!e||t<1||t>s)return r;do{t%2&&(r+=e),(t=Ut(t/2))&&(e+=e)}while(t);return r}function qn(e,t){return Pa(Sa(e,t,Js),e+"")}function Wn(e){return Wr(Ns(e))}function Xn(e,t){var r=Ns(e);return ka(r,nn(t,0,r.length))}function Yn(t,r,n,i){if(!Ko(t))return t;for(var a=-1,o=(r=mi(r,t)).length,s=o-1,u=t;null!=u&&++a<o;){var c=Da(r[a]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(a!=s){var d=u[c];(l=i?i(d,c,u):e)===e&&(l=Ko(d)?d:pa(r[a+1])?[]:{})}Zr(u,c,l),u=u[c]}return t}var Kn=Tr?function(e,t){return Tr.set(e,t),e}:Js,Zn=ut?function(e,t){return ut(e,"toString",{configurable:!0,enumerable:!1,value:Ks(t),writable:!0})}:Js;function Qn(e){return ka(Ns(e))}function Jn(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=be(i);++n<i;)a[n]=e[n+t];return a}function ei(e,t){var r;return cn(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function ti(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var a=n+i>>>1,o=e[a];null!==o&&!is(o)&&(r?o<=t:o<t)?n=a+1:i=a}return i}return ri(e,t,Js,r)}function ri(t,r,n,i){var a=0,o=null==t?0:t.length;if(0===o)return 0;for(var s=(r=n(r))!=r,u=null===r,c=is(r),l=r===e;a<o;){var d=Ut((a+o)/2),f=n(t[d]),h=f!==e,p=null===f,m=f==f,g=is(f);if(s)var v=i||m;else v=l?m&&(i||h):u?m&&h&&(i||!p):c?m&&h&&!p&&(i||!g):!p&&!g&&(i?f<=r:f<r);v?a=d+1:o=d}return mr(o,4294967294)}function ni(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r],s=t?t(o):o;if(!r||!No(s,u)){var u=s;a[i++]=0===o?0:o}}return a}function ii(e){return"number"==typeof e?e:is(e)?u:+e}function ai(e){if("string"==typeof e)return e;if(Uo(e))return Pt(e,ai)+"";if(is(e))return Br?Br.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function oi(e,t,r){var n=-1,i=Ct,a=e.length,o=!0,s=[],u=s;if(r)o=!1,i=Tt;else if(a>=200){var c=t?null:Hi(e);if(c)return nr(c);o=!1,i=Wt,u=new Vr}else u=t?[]:s;e:for(;++n<a;){var l=e[n],d=t?t(l):l;if(l=r||0!==l?l:0,o&&d==d){for(var f=u.length;f--;)if(u[f]===d)continue e;t&&u.push(d),s.push(l)}else i(u,d,r)||(u!==s&&u.push(d),s.push(l))}return s}function si(e,t){return null==(e=wa(e,t=mi(t,e)))||delete e[Da(Ha(t))]}function ui(e,t,r,n){return Yn(e,t,r(_n(e,t)),n)}function ci(e,t,r,n){for(var i=e.length,a=n?i:-1;(n?a--:++a<i)&&t(e[a],a,e););return r?Jn(e,n?0:a,n?a+1:i):Jn(e,n?a+1:0,n?i:a)}function li(e,t){var r=e;return r instanceof Ur&&(r=r.value()),Mt(t,function(e,t){return t.func.apply(t.thisArg,Et([e],t.args))},r)}function di(e,t,r){var n=e.length;if(n<2)return n?oi(e[0]):[];for(var i=-1,a=be(n);++i<n;)for(var o=e[i],s=-1;++s<n;)s!=i&&(a[i]=un(a[i]||o,e[s],t,r));return oi(pn(a,1),t,r)}function fi(t,r,n){for(var i=-1,a=t.length,o=r.length,s={};++i<a;){var u=i<o?r[i]:e;n(s,t[i],u)}return s}function hi(e){return Go(e)?e:[]}function pi(e){return"function"==typeof e?e:Js}function mi(e,t){return Uo(e)?e:ga(e,t)?[e]:Ia(ps(e))}var gi=qn;function vi(t,r,n){var i=t.length;return n=n===e?i:n,!r&&n>=i?t:Jn(t,r,n)}var yi=ct||function(e){return st.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var r=e.length,n=Ge?Ge(r):new e.constructor(r);return e.copy(n),n}function _i(e){var t=new e.constructor(e.byteLength);return new ze(t).set(new ze(e)),t}function xi(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Si(t,r){if(t!==r){var n=t!==e,i=null===t,a=t==t,o=is(t),s=r!==e,u=null===r,c=r==r,l=is(r);if(!u&&!l&&!o&&t>r||o&&s&&c&&!u&&!l||i&&s&&c||!n&&c||!a)return 1;if(!i&&!o&&!l&&t<r||l&&n&&a&&!i&&!o||u&&n&&a||!s&&a||!c)return-1}return 0}function wi(e,t,r,n){for(var i=-1,a=e.length,o=r.length,s=-1,u=t.length,c=pr(a-o,0),l=be(u+c),d=!n;++s<u;)l[s]=t[s];for(;++i<o;)(d||i<a)&&(l[r[i]]=e[i]);for(;c--;)l[s++]=e[i++];return l}function Ai(e,t,r,n){for(var i=-1,a=e.length,o=-1,s=r.length,u=-1,c=t.length,l=pr(a-s,0),d=be(l+c),f=!n;++i<l;)d[i]=e[i];for(var h=i;++u<c;)d[h+u]=t[u];for(;++o<s;)(f||i<a)&&(d[h+r[o]]=e[i++]);return d}function Ci(e,t){var r=-1,n=e.length;for(t||=be(n);++r<n;)t[r]=e[r];return t}function Ti(t,r,n,i){var a=!n;n||={};for(var o=-1,s=r.length;++o<s;){var u=r[o],c=i?i(n[u],t[u],u,n,t):e;c===e&&(c=t[u]),a?tn(n,u,c):Zr(n,u,c)}return n}function Pi(e,t){return function(r,n){var i=Uo(r)?_t:Jr,a=t?t():{};return i(r,e,ia(n,2),a)}}function Ei(t){return qn(function(r,n){var i=-1,a=n.length,o=a>1?n[a-1]:e,s=a>2?n[2]:e;for(o=t.length>3&&"function"==typeof o?(a--,o):e,s&&ma(n[0],n[1],s)&&(o=a<3?e:o,a=1),r=Ae(r);++i<a;){var u=n[i];u&&t(r,u,i,o)}return r})}function Mi(e,t){return function(r,n){if(null==r)return r;if(!zo(r))return e(r,n);for(var i=r.length,a=t?i:-1,o=Ae(r);(t?a--:++a<i)&&!1!==n(o[a],a,o););return r}}function ki(e){return function(t,r,n){for(var i=-1,a=Ae(t),o=n(t),s=o.length;s--;){var u=o[e?s:++i];if(!1===r(a[u],u,a))break}return t}}function Ii(t){return function(r){var n=Jt(r=ps(r))?ar(r):e,i=n?n[0]:r.charAt(0),a=n?vi(n,1).join(""):r.slice(1);return i[t]()+a}}function Di(e){return function(t){return Mt(Ws($s(t).replace(qe,"")),e,"")}}function Oi(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Fr(e.prototype),n=e.apply(r,t);return Ko(n)?n:r}}function Ri(t){return function(r,n,i){var a=Ae(r);if(!zo(r)){var o=ia(n,3);r=Ps(r),n=function(e){return o(a[e],e,a)}}var s=t(r,n,i);return s>-1?a[o?r[s]:s]:e}}function Bi(r){return Qi(function(n){var i=n.length,a=i,o=$r.prototype.thru;for(r&&n.reverse();a--;){var s=n[a];if("function"!=typeof s)throw new Pe(t);if(o&&!u&&"wrapper"==ra(s))var u=new $r([],!0)}for(a=u?a:i;++a<i;){var c=ra(s=n[a]),l="wrapper"==c?ta(s):e;u=l&&va(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ra(l[0])].apply(u,l[3]):1==s.length&&va(s)?u[c]():u.thru(s)}return function(){var e=arguments,t=e[0];if(u&&1==e.length&&Uo(t))return u.plant(t).value();for(var r=0,a=i?n[r].apply(this,e):t;++r<i;)a=n[r].call(this,a);return a}})}function Ni(t,r,n,i,o,s,u,c,l,d){var f=r&a,h=1&r,p=2&r,m=24&r,g=512&r,v=p?e:Oi(t);return function a(){for(var y=arguments.length,b=be(y),_=y;_--;)b[_]=arguments[_];if(m)var x=na(a),S=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(b,x);if(i&&(b=wi(b,i,o,m)),s&&(b=Ai(b,s,u,m)),y-=S,m&&y<d){var w=rr(b,x);return Gi(t,r,Ni,a.placeholder,n,b,w,c,l,d-y)}var A=h?n:this,C=p?A[t]:t;return y=b.length,c?b=function(t,r){for(var n=t.length,i=mr(r.length,n),a=Ci(t);i--;){var o=r[i];t[i]=pa(o,n)?a[o]:e}return t}(b,c):g&&y>1&&b.reverse(),f&&l<y&&(b.length=l),this&&this!==st&&this instanceof a&&(C=v||Oi(C)),C.apply(A,b)}}function Fi(e,t){return function(r,n){return function(e,t,r,n){return vn(e,function(e,i,a){t(n,r(e),i,a)}),n}(r,e,t(n),{})}}function Li(t,r){return function(n,i){var a;if(n===e&&i===e)return r;if(n!==e&&(a=n),i!==e){if(a===e)return i;"string"==typeof n||"string"==typeof i?(n=ai(n),i=ai(i)):(n=ii(n),i=ii(i)),a=t(n,i)}return a}}function $i(e){return Qi(function(t){return t=Pt(t,Ht(ia())),qn(function(r){var n=this;return e(t,function(e){return bt(e,n,r)})})})}function Ui(t,r){var n=(r=r===e?" ":ai(r)).length;if(n<2)return n?Hn(r,t):r;var i=Hn(r,Dt(t/ir(r)));return Jt(r)?vi(ar(i),0,t).join(""):i.slice(0,t)}function ji(t){return function(r,n,i){return i&&"number"!=typeof i&&ma(r,n,i)&&(n=i=e),r=cs(r),n===e?(n=r,r=0):n=cs(n),function(e,t,r,n){for(var i=-1,a=pr(Dt((t-e)/(r||1)),0),o=be(a);a--;)o[n?a:++i]=e,e+=r;return o}(r,n,i=i===e?r<n?1:-1:cs(i),t)}}function zi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=fs(t),r=fs(r)),e(t,r)}}function Gi(t,r,n,a,o,s,u,c,l,d){var f=8&r;r|=f?i:64,4&(r&=~(f?64:i))||(r&=-4);var h=[t,r,o,f?s:e,f?u:e,f?e:s,f?e:u,c,l,d],p=n.apply(e,h);return va(t)&&Ca(p,h),p.placeholder=a,Ea(p,t,r)}function Vi(e){var t=we[e];return function(e,r){if(e=fs(e),(r=null==r?0:mr(ls(r),292))&&dr(e)){var n=(ps(e)+"e").split("e");return+((n=(ps(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Hi=wr&&1/nr(new wr([,-0]))[1]==o?function(e){return new wr(e)}:iu;function qi(e){return function(t){var r=la(t);return r==y?er(t):r==w?function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=[e,e]}),r}(t):function(e,t){return Pt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Wi(r,o,s,u,c,l,d,f){var h=2&o;if(!h&&"function"!=typeof r)throw new Pe(t);var p=u?u.length:0;if(p||(o&=-97,u=c=e),d=d===e?d:pr(ls(d),0),f=f===e?f:ls(f),p-=c?c.length:0,64&o){var m=u,g=c;u=c=e}var v=h?e:ta(r),y=[r,o,s,u,c,m,g,l,d,f];if(v&&function(e,t){var r=e[1],i=t[1],o=r|i,s=o<131,u=i==a&&8==r||i==a&&256==r&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==r;if(!s&&!u)return e;1&i&&(e[2]=t[2],o|=1&r?0:4);var c=t[3];if(c){var l=e[3];e[3]=l?wi(l,c,t[4]):c,e[4]=l?rr(e[3],n):t[4]}(c=t[5])&&(l=e[5],e[5]=l?Ai(l,c,t[6]):c,e[6]=l?rr(e[5],n):t[6]),(c=t[7])&&(e[7]=c),i&a&&(e[8]=null==e[8]?t[8]:mr(e[8],t[8])),e[9]??=t[9],e[0]=t[0],e[1]=o}(y,v),r=y[0],o=y[1],s=y[2],u=y[3],c=y[4],!(f=y[9]=y[9]===e?h?0:r.length:pr(y[9]-p,0))&&24&o&&(o&=-25),o&&1!=o)b=8==o||16==o?function(t,r,n){var i=Oi(t);return function a(){for(var o=arguments.length,s=be(o),u=o,c=na(a);u--;)s[u]=arguments[u];var l=o<3&&s[0]!==c&&s[o-1]!==c?[]:rr(s,c);return(o-=l.length)<n?Gi(t,r,Ni,a.placeholder,e,s,l,e,e,n-o):bt(this&&this!==st&&this instanceof a?i:t,this,s)}}(r,o,f):o!=i&&33!=o||c.length?Ni.apply(e,y):function(e,t,r,n){var i=1&t,a=Oi(e);return function t(){for(var o=-1,s=arguments.length,u=-1,c=n.length,l=be(c+s),d=this&&this!==st&&this instanceof t?a:e;++u<c;)l[u]=n[u];for(;s--;)l[u++]=arguments[++o];return bt(d,i?r:this,l)}}(r,o,s,u);else var b=function(e,t,r){var n=1&t,i=Oi(e);return function t(){return(this&&this!==st&&this instanceof t?i:e).apply(n?r:this,arguments)}}(r,o,s);return Ea((v?Kn:Ca)(b,y),r,o)}function Xi(t,r,n,i){return t===e||No(t,ke[n])&&!Oe.call(i,n)?r:t}function Yi(t,r,n,i,a,o){return Ko(t)&&Ko(r)&&(o.set(r,t),Ln(t,r,e,Yi,o),o.delete(r)),t}function Ki(t){return es(t)?e:t}function Zi(t,r,n,i,a,o){var s=1&n,u=t.length,c=r.length;if(u!=c&&!(s&&c>u))return!1;var l=o.get(t),d=o.get(r);if(l&&d)return l==r&&d==t;var f=-1,h=!0,p=2&n?new Vr:e;for(o.set(t,r),o.set(r,t);++f<u;){var m=t[f],g=r[f];if(i)var v=s?i(g,m,f,r,t,o):i(m,g,f,t,r,o);if(v!==e){if(v)continue;h=!1;break}if(p){if(!It(r,function(e,t){if(!Wt(p,t)&&(m===e||a(m,e,n,i,o)))return p.push(t)})){h=!1;break}}else if(m!==g&&!a(m,g,n,i,o)){h=!1;break}}return o.delete(t),o.delete(r),h}function Qi(t){return Pa(Sa(t,e,Ua),t+"")}function Ji(e){return xn(e,Ps,ua)}function ea(e){return xn(e,Es,ca)}var ta=Tr?function(e){return Tr.get(e)}:iu;function ra(e){for(var t=e.name+"",r=Pr[t],n=Oe.call(Pr,t)?r.length:0;n--;){var i=r[n],a=i.func;if(null==a||a==e)return i.name}return t}function na(e){return(Oe.call(Nr,"placeholder")?Nr:e).placeholder}function ia(){var e=Nr.iteratee||eu;return e=e===eu?Dn:e,arguments.length?e(arguments[0],arguments[1]):e}function aa(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function oa(e){for(var t=Ps(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,_a(i)]}return t}function sa(t,r){var n=function(t,r){return null==t?e:t[r]}(t,r);return In(n)?n:e}var ua=cr?function(e){return null==e?[]:(e=Ae(e),At(cr(e),function(t){return Xe.call(e,t)}))}:du,ca=cr?function(e){for(var t=[];e;)Et(t,ua(e)),e=Ve(e);return t}:du,la=Sn;function da(e,t,r){for(var n=-1,i=(t=mi(t,e)).length,a=!1;++n<i;){var o=Da(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&Yo(i)&&pa(o,i)&&(Uo(e)||$o(e))}function fa(e){return"function"!=typeof e.constructor||ba(e)?{}:Fr(Ve(e))}function ha(e){return Uo(e)||$o(e)||!!(rt&&e&&e[rt])}function pa(e,t){var r=typeof e;return!!(t??=s)&&("number"==r||"symbol"!=r&&he.test(e))&&e>-1&&e%1==0&&e<t}function ma(e,t,r){if(!Ko(r))return!1;var n=typeof t;return!!("number"==n?zo(r)&&pa(t,r.length):"string"==n&&t in r)&&No(r[t],e)}function ga(e,t){if(Uo(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!is(e))||Y.test(e)||!X.test(e)||null!=t&&e in Ae(t)}function va(e){var t=ra(e),r=Nr[t];if("function"!=typeof r||!(t in Ur.prototype))return!1;if(e===r)return!0;var n=ta(r);return!!n&&e===n[0]}(_r&&la(new _r(new ArrayBuffer(1)))!=E||xr&&la(new xr)!=y||Sr&&la(Sr.resolve())!=x||wr&&la(new wr)!=w||Ar&&la(new Ar)!=T)&&(la=function(t){var r=Sn(t),n=r==_?t.constructor:e,i=n?Oa(n):"";if(i)switch(i){case Er:return E;case Mr:return y;case kr:return x;case Ir:return w;case Dr:return T}return r});var ya=Ie?Wo:fu;function ba(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ke)}function _a(e){return e==e&&!Ko(e)}function xa(t,r){return function(n){return null!=n&&n[t]===r&&(r!==e||t in Ae(n))}}function Sa(t,r,n){return r=pr(r===e?t.length-1:r,0),function(){for(var e=arguments,i=-1,a=pr(e.length-r,0),o=be(a);++i<a;)o[i]=e[r+i];i=-1;for(var s=be(r+1);++i<r;)s[i]=e[i];return s[r]=n(o),bt(t,this,s)}}function wa(e,t){return t.length<2?e:_n(e,Jn(t,0,-1))}function Aa(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ca=Ma(Kn),Ta=ft||function(e,t){return st.setTimeout(e,t)},Pa=Ma(Zn);function Ea(e,t,r){var n=t+"";return Pa(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(te,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return xt(l,function(r){var n="_."+r[0];t&r[1]&&!Ct(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(re);return t?t[1].split(ne):[]}(n),r)))}function Ma(t){var r=0,n=0;return function(){var i=gr(),a=16-(i-n);if(n=i,a>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(e,arguments)}}function ka(t,r){var n=-1,i=t.length,a=i-1;for(r=r===e?i:r;++n<r;){var o=Vn(n,a),s=t[o];t[o]=t[n],t[n]=s}return t.length=r,t}var Ia=function(){var e=ko(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(K,function(e,r,n,i){t.push(n?i.replace(oe,"$1"):r||e)}),t},function(e){return 500===t.size&&t.clear(),e}),t=e.cache;return e}();function Da(e){if("string"==typeof e||is(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Oa(e){if(null!=e){try{return De.call(e)}catch{}try{return e+""}catch{}}return""}function Ra(e){if(e instanceof Ur)return e.clone();var t=new $r(e.__wrapped__,e.__chain__);return t.__actions__=Ci(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ba=qn(function(e,t){return Go(e)?un(e,pn(t,1,Go,!0)):[]}),Na=qn(function(t,r){var n=Ha(r);return Go(n)&&(n=e),Go(t)?un(t,pn(r,1,Go,!0),ia(n,2)):[]}),Fa=qn(function(t,r){var n=Ha(r);return Go(n)&&(n=e),Go(t)?un(t,pn(r,1,Go,!0),e,n):[]});function La(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ls(r);return i<0&&(i=pr(n+i,0)),Rt(e,ia(t,3),i)}function $a(t,r,n){var i=null==t?0:t.length;if(!i)return-1;var a=i-1;return n!==e&&(a=ls(n),a=n<0?pr(i+a,0):mr(a,i-1)),Rt(t,ia(r,3),a,!0)}function Ua(e){return null!=e&&e.length?pn(e,1):[]}function ja(t){return t&&t.length?t[0]:e}var za=qn(function(e){var t=Pt(e,hi);return t.length&&t[0]===e[0]?Tn(t):[]}),Ga=qn(function(t){var r=Ha(t),n=Pt(t,hi);return r===Ha(n)?r=e:n.pop(),n.length&&n[0]===t[0]?Tn(n,ia(r,2)):[]}),Va=qn(function(t){var r=Ha(t),n=Pt(t,hi);return(r="function"==typeof r?r:e)&&n.pop(),n.length&&n[0]===t[0]?Tn(n,e,r):[]});function Ha(t){var r=null==t?0:t.length;return r?t[r-1]:e}var qa=qn(Wa);function Wa(e,t){return e&&e.length&&t&&t.length?zn(e,t):e}var Xa=Qi(function(e,t){var r=null==e?0:e.length,n=rn(e,t);return Gn(e,Pt(t,function(e){return pa(e,r)?+e:e}).sort(Si)),n});function Ya(e){return null==e?e:br.call(e)}var Ka=qn(function(e){return oi(pn(e,1,Go,!0))}),Za=qn(function(t){var r=Ha(t);return Go(r)&&(r=e),oi(pn(t,1,Go,!0),ia(r,2))}),Qa=qn(function(t){var r=Ha(t);return r="function"==typeof r?r:e,oi(pn(t,1,Go,!0),e,r)});function Ja(e){if(!e||!e.length)return[];var t=0;return e=At(e,function(e){if(Go(e))return t=pr(e.length,t),!0}),Gt(t,function(t){return Pt(e,$t(t))})}function eo(t,r){if(!t||!t.length)return[];var n=Ja(t);return null==r?n:Pt(n,function(t){return bt(r,e,t)})}var to=qn(function(e,t){return Go(e)?un(e,t):[]}),ro=qn(function(e){return di(At(e,Go))}),no=qn(function(t){var r=Ha(t);return Go(r)&&(r=e),di(At(t,Go),ia(r,2))}),io=qn(function(t){var r=Ha(t);return r="function"==typeof r?r:e,di(At(t,Go),e,r)}),ao=qn(Ja),oo=qn(function(t){var r=t.length,n=r>1?t[r-1]:e;return n="function"==typeof n?(t.pop(),n):e,eo(t,n)});function so(e){var t=Nr(e);return t.__chain__=!0,t}function uo(e,t){return t(e)}var co=Qi(function(t){var r=t.length,n=r?t[0]:0,i=this.__wrapped__,a=function(e){return rn(e,t)};return!(r>1||this.__actions__.length)&&i instanceof Ur&&pa(n)?((i=i.slice(n,+n+ +!!r)).__actions__.push({func:uo,args:[a],thisArg:e}),new $r(i,this.__chain__).thru(function(t){return r&&!t.length&&t.push(e),t})):this.thru(a)}),lo=Pi(function(e,t,r){Oe.call(e,r)?++e[r]:tn(e,r,1)}),fo=Ri(La),ho=Ri($a);function po(e,t){return(Uo(e)?xt:cn)(e,ia(t,3))}function mo(e,t){return(Uo(e)?St:ln)(e,ia(t,3))}var go=Pi(function(e,t,r){Oe.call(e,r)?e[r].push(t):tn(e,r,[t])}),vo=qn(function(e,t,r){var n=-1,i="function"==typeof t,a=zo(e)?be(e.length):[];return cn(e,function(e){a[++n]=i?bt(t,e,r):Pn(e,t,r)}),a}),yo=Pi(function(e,t,r){tn(e,r,t)});function bo(e,t){return(Uo(e)?Pt:Bn)(e,ia(t,3))}var _o=Pi(function(e,t,r){e[+!r].push(t)},function(){return[[],[]]}),xo=qn(function(e,t){if(null==e)return[];var r=t.length;return r>1&&ma(e,t[0],t[1])?t=[]:r>2&&ma(t[0],t[1],t[2])&&(t=[t[0]]),Un(e,pn(t,1),[])}),So=dt||function(){return st.Date.now()};function wo(t,r,n){return r=n?e:r,r=t&&null==r?t.length:r,Wi(t,a,e,e,e,e,r)}function Ao(r,n){var i;if("function"!=typeof n)throw new Pe(t);return r=ls(r),function(){return--r>0&&(i=n.apply(this,arguments)),r<=1&&(n=e),i}}var Co=qn(function(e,t,r){var n=1;if(r.length){var a=rr(r,na(Co));n|=i}return Wi(e,n,t,r,a)}),To=qn(function(e,t,r){var n=3;if(r.length){var a=rr(r,na(To));n|=i}return Wi(t,n,e,r,a)});function Po(r,n,i){var a,o,s,u,c,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof r)throw new Pe(t);function m(t){var n=a,i=o;return a=o=e,d=t,u=r.apply(i,n)}function g(t){var r=t-l;return l===e||r>=n||r<0||h&&t-d>=s}function v(){var e=So();if(g(e))return y(e);c=Ta(v,function(e){var t=n-(e-l);return h?mr(t,s-(e-d)):t}(e))}function y(t){return c=e,p&&a?m(t):(a=o=e,u)}function b(){var t=So(),r=g(t);if(a=arguments,o=this,l=t,r){if(c===e)return function(e){return d=e,c=Ta(v,n),f?m(e):u}(l);if(h)return yi(c),c=Ta(v,n),m(l)}return c===e&&(c=Ta(v,n)),u}return n=fs(n)||0,Ko(i)&&(f=!!i.leading,s=(h="maxWait"in i)?pr(fs(i.maxWait)||0,n):s,p="trailing"in i?!!i.trailing:p),b.cancel=function(){c!==e&&yi(c),d=0,a=l=o=c=e},b.flush=function(){return c===e?u:y(So())},b}var Eo=qn(function(e,t){return sn(e,1,t)}),Mo=qn(function(e,t,r){return sn(e,fs(t)||0,r)});function ko(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new Pe(t);var n=function(){var t=arguments,i=r?r.apply(this,t):t[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,t);return n.cache=a.set(i,o)||a,o};return n.cache=new(ko.Cache||Gr),n}function Io(e){if("function"!=typeof e)throw new Pe(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ko.Cache=Gr;var Do=gi(function(e,t){var r=(t=1==t.length&&Uo(t[0])?Pt(t[0],Ht(ia())):Pt(pn(t,1),Ht(ia()))).length;return qn(function(n){for(var i=-1,a=mr(n.length,r);++i<a;)n[i]=t[i].call(this,n[i]);return bt(e,this,n)})}),Oo=qn(function(t,r){return Wi(t,i,e,r,rr(r,na(Oo)))}),Ro=qn(function(t,r){return Wi(t,64,e,r,rr(r,na(Ro)))}),Bo=Qi(function(t,r){return Wi(t,256,e,e,e,r)});function No(e,t){return e===t||e!=e&&t!=t}var Fo=zi(wn),Lo=zi(function(e,t){return e>=t}),$o=En(function(){return arguments}())?En:function(e){return Zo(e)&&Oe.call(e,"callee")&&!Xe.call(e,"callee")},Uo=be.isArray,jo=ht?Ht(ht):function(e){return Zo(e)&&Sn(e)==P};function zo(e){return null!=e&&Yo(e.length)&&!Wo(e)}function Go(e){return Zo(e)&&zo(e)}var Vo=lr||fu,Ho=pt?Ht(pt):function(e){return Zo(e)&&Sn(e)==p};function qo(e){if(!Zo(e))return!1;var t=Sn(e);return t==m||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!es(e)}function Wo(e){if(!Ko(e))return!1;var t=Sn(e);return t==g||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xo(e){return"number"==typeof e&&e==ls(e)}function Yo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}function Ko(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Zo(e){return"object"==typeof e&&!!e}var Qo=mt?Ht(mt):function(e){return Zo(e)&&la(e)==y};function Jo(e){return"number"==typeof e||Zo(e)&&Sn(e)==b}function es(e){if(!Zo(e)||Sn(e)!=_)return!1;var t=Ve(e);if(null===t)return!0;var r=Oe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&De.call(r)==Fe}var ts=gt?Ht(gt):function(e){return Zo(e)&&Sn(e)==S},rs=vt?Ht(vt):function(e){return Zo(e)&&la(e)==w};function ns(e){return"string"==typeof e||!Uo(e)&&Zo(e)&&Sn(e)==A}function is(e){return"symbol"==typeof e||Zo(e)&&Sn(e)==C}var as=yt?Ht(yt):function(e){return Zo(e)&&Yo(e.length)&&!!et[Sn(e)]},os=zi(Rn),ss=zi(function(e,t){return e<=t});function us(e){if(!e)return[];if(zo(e))return ns(e)?ar(e):Ci(e);if(at&&e[at])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[at]());var t=la(e);return(t==y?er:t==w?nr:Ns)(e)}function cs(e){return e?(e=fs(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ls(e){var t=cs(e),r=t%1;return t==t?r?t-r:t:0}function ds(e){return e?nn(ls(e),0,c):0}function fs(e){if("number"==typeof e)return e;if(is(e))return u;if(Ko(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ko(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Vt(e);var r=le.test(e);return r||fe.test(e)?it(e.slice(2),r?2:8):ce.test(e)?u:+e}function hs(e){return Ti(e,Es(e))}function ps(e){return null==e?"":ai(e)}var ms=Ei(function(e,t){if(ba(t)||zo(t))Ti(t,Ps(t),e);else for(var r in t)Oe.call(t,r)&&Zr(e,r,t[r])}),gs=Ei(function(e,t){Ti(t,Es(t),e)}),vs=Ei(function(e,t,r,n){Ti(t,Es(t),e,n)}),ys=Ei(function(e,t,r,n){Ti(t,Ps(t),e,n)}),bs=Qi(rn),_s=qn(function(t,r){t=Ae(t);var n=-1,i=r.length,a=i>2?r[2]:e;for(a&&ma(r[0],r[1],a)&&(i=1);++n<i;)for(var o=r[n],s=Es(o),u=-1,c=s.length;++u<c;){var l=s[u],d=t[l];(d===e||No(d,ke[l])&&!Oe.call(t,l))&&(t[l]=o[l])}return t}),xs=qn(function(t){return t.push(e,Yi),bt(ks,e,t)});function Ss(t,r,n){var i=null==t?e:_n(t,r);return i===e?n:i}function ws(e,t){return null!=e&&da(e,t,Cn)}var As=Fi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=r},Ks(Js)),Cs=Fi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),Oe.call(e,t)?e[t].push(r):e[t]=[r]},ia),Ts=qn(Pn);function Ps(e){return zo(e)?qr(e):On(e)}function Es(e){return zo(e)?qr(e,!0):function(e){if(!Ko(e))return function(e){var t=[];if(null!=e)for(var r in Ae(e))t.push(r);return t}(e);var t=ba(e),r=[];for(var n in e)("constructor"!=n||!t&&Oe.call(e,n))&&r.push(n);return r}(e)}var Ms=Ei(function(e,t,r){Ln(e,t,r)}),ks=Ei(function(e,t,r,n){Ln(e,t,r,n)}),Is=Qi(function(e,t){var r={};if(null==e)return r;var n=!1;t=Pt(t,function(t){return t=mi(t,e),n||=t.length>1,t}),Ti(e,ea(e),r),n&&(r=an(r,7,Ki));for(var i=t.length;i--;)si(r,t[i]);return r}),Ds=Qi(function(e,t){return null==e?{}:function(e,t){return jn(e,t,function(t,r){return ws(e,r)})}(e,t)});function Os(e,t){if(null==e)return{};var r=Pt(ea(e),function(e){return[e]});return t=ia(t),jn(e,r,function(e,r){return t(e,r[0])})}var Rs=qi(Ps),Bs=qi(Es);function Ns(e){return null==e?[]:qt(e,Ps(e))}var Fs=Di(function(e,t,r){return t=t.toLowerCase(),e+(r?Ls(t):t)});function Ls(e){return qs(ps(e).toLowerCase())}function $s(e){return(e=ps(e))&&e.replace(pe,Kt).replace(We,"")}var Us=Di(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),js=Di(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),zs=Ii("toLowerCase"),Gs=Di(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Vs=Di(function(e,t,r){return e+(r?" ":"")+qs(t)}),Hs=Di(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),qs=Ii("toUpperCase");function Ws(t,r,n){return t=ps(t),(r=n?e:r)===e?function(e){return Ze.test(e)}(t)?function(e){return e.match(Ye)||[]}(t):function(e){return e.match(ie)||[]}(t):t.match(r)||[]}var Xs=qn(function(t,r){try{return bt(t,e,r)}catch(e){return qo(e)?e:new xe(e)}}),Ys=Qi(function(e,t){return xt(t,function(t){t=Da(t),tn(e,t,Co(e[t],e))}),e});function Ks(e){return function(){return e}}var Zs=Bi(),Qs=Bi(!0);function Js(e){return e}function eu(e){return Dn("function"==typeof e?e:an(e,1))}var tu=qn(function(e,t){return function(r){return Pn(r,e,t)}}),ru=qn(function(e,t){return function(r){return Pn(e,r,t)}});function nu(e,t,r){var n=Ps(t),i=bn(t,n);null!=r||Ko(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=bn(t,Ps(t)));var a=!(Ko(r)&&"chain"in r&&!r.chain),o=Wo(e);return xt(i,function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(a||t){var r=e(this.__wrapped__);return(r.__actions__=Ci(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Et([this.value()],arguments))})}),e}function iu(){}var au=$i(Pt),ou=$i(wt),su=$i(It);function uu(e){return ga(e)?$t(Da(e)):function(e){return function(t){return _n(t,e)}}(e)}var cu=ji(),lu=ji(!0);function du(){return[]}function fu(){return!1}var hu,pu=Li(function(e,t){return e+t},0),mu=Vi("ceil"),gu=Li(function(e,t){return e/t},1),vu=Vi("floor"),yu=Li(function(e,t){return e*t},1),bu=Vi("round"),_u=Li(function(e,t){return e-t},0);return Nr.after=function(e,r){if("function"!=typeof r)throw new Pe(t);return e=ls(e),function(){if(--e<1)return r.apply(this,arguments)}},Nr.ary=wo,Nr.assign=ms,Nr.assignIn=gs,Nr.assignInWith=vs,Nr.assignWith=ys,Nr.at=bs,Nr.before=Ao,Nr.bind=Co,Nr.bindAll=Ys,Nr.bindKey=To,Nr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Uo(e)?e:[e]},Nr.chain=so,Nr.chunk=function(t,r,n){r=(n?ma(t,r,n):r===e)?1:pr(ls(r),0);var i=null==t?0:t.length;if(!i||r<1)return[];for(var a=0,o=0,s=be(Dt(i/r));a<i;)s[o++]=Jn(t,a,a+=r);return s},Nr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var a=e[t];a&&(i[n++]=a)}return i},Nr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=be(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Et(Uo(r)?Ci(r):[r],pn(t,1))},Nr.cond=function(e){var r=null==e?0:e.length,n=ia();return e=r?Pt(e,function(e){if("function"!=typeof e[1])throw new Pe(t);return[n(e[0]),e[1]]}):[],qn(function(t){for(var n=-1;++n<r;){var i=e[n];if(bt(i[0],this,t))return bt(i[1],this,t)}})},Nr.conforms=function(e){return function(e){var t=Ps(e);return function(r){return on(r,e,t)}}(an(e,1))},Nr.constant=Ks,Nr.countBy=lo,Nr.create=function(e,t){var r=Fr(e);return null==t?r:en(r,t)},Nr.curry=function t(r,n,i){var a=Wi(r,8,e,e,e,e,e,n=i?e:n);return a.placeholder=t.placeholder,a},Nr.curryRight=function t(r,n,i){var a=Wi(r,16,e,e,e,e,e,n=i?e:n);return a.placeholder=t.placeholder,a},Nr.debounce=Po,Nr.defaults=_s,Nr.defaultsDeep=xs,Nr.defer=Eo,Nr.delay=Mo,Nr.difference=Ba,Nr.differenceBy=Na,Nr.differenceWith=Fa,Nr.drop=function(t,r,n){var i=null==t?0:t.length;return i?Jn(t,(r=n||r===e?1:ls(r))<0?0:r,i):[]},Nr.dropRight=function(t,r,n){var i=null==t?0:t.length;return i?Jn(t,0,(r=i-(r=n||r===e?1:ls(r)))<0?0:r):[]},Nr.dropRightWhile=function(e,t){return e&&e.length?ci(e,ia(t,3),!0,!0):[]},Nr.dropWhile=function(e,t){return e&&e.length?ci(e,ia(t,3),!0):[]},Nr.fill=function(t,r,n,i){var a=null==t?0:t.length;return a?(n&&"number"!=typeof n&&ma(t,r,n)&&(n=0,i=a),function(t,r,n,i){var a=t.length;for((n=ls(n))<0&&(n=-n>a?0:a+n),(i=i===e||i>a?a:ls(i))<0&&(i+=a),i=n>i?0:ds(i);n<i;)t[n++]=r;return t}(t,r,n,i)):[]},Nr.filter=function(e,t){return(Uo(e)?At:hn)(e,ia(t,3))},Nr.flatMap=function(e,t){return pn(bo(e,t),1)},Nr.flatMapDeep=function(e,t){return pn(bo(e,t),o)},Nr.flatMapDepth=function(t,r,n){return n=n===e?1:ls(n),pn(bo(t,r),n)},Nr.flatten=Ua,Nr.flattenDeep=function(e){return null!=e&&e.length?pn(e,o):[]},Nr.flattenDepth=function(t,r){return null!=t&&t.length?pn(t,r=r===e?1:ls(r)):[]},Nr.flip=function(e){return Wi(e,512)},Nr.flow=Zs,Nr.flowRight=Qs,Nr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Nr.functions=function(e){return null==e?[]:bn(e,Ps(e))},Nr.functionsIn=function(e){return null==e?[]:bn(e,Es(e))},Nr.groupBy=go,Nr.initial=function(e){return null!=e&&e.length?Jn(e,0,-1):[]},Nr.intersection=za,Nr.intersectionBy=Ga,Nr.intersectionWith=Va,Nr.invert=As,Nr.invertBy=Cs,Nr.invokeMap=vo,Nr.iteratee=eu,Nr.keyBy=yo,Nr.keys=Ps,Nr.keysIn=Es,Nr.map=bo,Nr.mapKeys=function(e,t){var r={};return t=ia(t,3),vn(e,function(e,n,i){tn(r,t(e,n,i),e)}),r},Nr.mapValues=function(e,t){var r={};return t=ia(t,3),vn(e,function(e,n,i){tn(r,n,t(e,n,i))}),r},Nr.matches=function(e){return Nn(an(e,1))},Nr.matchesProperty=function(e,t){return Fn(e,an(t,1))},Nr.memoize=ko,Nr.merge=Ms,Nr.mergeWith=ks,Nr.method=tu,Nr.methodOf=ru,Nr.mixin=nu,Nr.negate=Io,Nr.nthArg=function(e){return e=ls(e),qn(function(t){return $n(t,e)})},Nr.omit=Is,Nr.omitBy=function(e,t){return Os(e,Io(ia(t)))},Nr.once=function(e){return Ao(2,e)},Nr.orderBy=function(t,r,n,i){return null==t?[]:(Uo(r)||(r=null==r?[]:[r]),Uo(n=i?e:n)||(n=null==n?[]:[n]),Un(t,r,n))},Nr.over=au,Nr.overArgs=Do,Nr.overEvery=ou,Nr.overSome=su,Nr.partial=Oo,Nr.partialRight=Ro,Nr.partition=_o,Nr.pick=Ds,Nr.pickBy=Os,Nr.property=uu,Nr.propertyOf=function(t){return function(r){return null==t?e:_n(t,r)}},Nr.pull=qa,Nr.pullAll=Wa,Nr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?zn(e,t,ia(r,2)):e},Nr.pullAllWith=function(t,r,n){return t&&t.length&&r&&r.length?zn(t,r,e,n):t},Nr.pullAt=Xa,Nr.range=cu,Nr.rangeRight=lu,Nr.rearg=Bo,Nr.reject=function(e,t){return(Uo(e)?At:hn)(e,Io(ia(t,3)))},Nr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],a=e.length;for(t=ia(t,3);++n<a;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return Gn(e,i),r},Nr.rest=function(r,n){if("function"!=typeof r)throw new Pe(t);return qn(r,n=n===e?n:ls(n))},Nr.reverse=Ya,Nr.sampleSize=function(t,r,n){return r=(n?ma(t,r,n):r===e)?1:ls(r),(Uo(t)?Xr:Xn)(t,r)},Nr.set=function(e,t,r){return null==e?e:Yn(e,t,r)},Nr.setWith=function(t,r,n,i){return i="function"==typeof i?i:e,null==t?t:Yn(t,r,n,i)},Nr.shuffle=function(e){return(Uo(e)?Yr:Qn)(e)},Nr.slice=function(t,r,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&ma(t,r,n)?(r=0,n=i):(r=null==r?0:ls(r),n=n===e?i:ls(n)),Jn(t,r,n)):[]},Nr.sortBy=xo,Nr.sortedUniq=function(e){return e&&e.length?ni(e):[]},Nr.sortedUniqBy=function(e,t){return e&&e.length?ni(e,ia(t,2)):[]},Nr.split=function(t,r,n){return n&&"number"!=typeof n&&ma(t,r,n)&&(r=n=e),(n=n===e?c:n>>>0)?(t=ps(t))&&("string"==typeof r||null!=r&&!ts(r))&&!(r=ai(r))&&Jt(t)?vi(ar(t),0,n):t.split(r,n):[]},Nr.spread=function(e,r){if("function"!=typeof e)throw new Pe(t);return r=null==r?0:pr(ls(r),0),qn(function(t){var n=t[r],i=vi(t,0,r);return n&&Et(i,n),bt(e,this,i)})},Nr.tail=function(e){var t=null==e?0:e.length;return t?Jn(e,1,t):[]},Nr.take=function(t,r,n){return t&&t.length?Jn(t,0,(r=n||r===e?1:ls(r))<0?0:r):[]},Nr.takeRight=function(t,r,n){var i=null==t?0:t.length;return i?Jn(t,(r=i-(r=n||r===e?1:ls(r)))<0?0:r,i):[]},Nr.takeRightWhile=function(e,t){return e&&e.length?ci(e,ia(t,3),!1,!0):[]},Nr.takeWhile=function(e,t){return e&&e.length?ci(e,ia(t,3)):[]},Nr.tap=function(e,t){return t(e),e},Nr.throttle=function(e,r,n){var i=!0,a=!0;if("function"!=typeof e)throw new Pe(t);return Ko(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Po(e,r,{leading:i,maxWait:r,trailing:a})},Nr.thru=uo,Nr.toArray=us,Nr.toPairs=Rs,Nr.toPairsIn=Bs,Nr.toPath=function(e){return Uo(e)?Pt(e,Da):is(e)?[e]:Ci(Ia(ps(e)))},Nr.toPlainObject=hs,Nr.transform=function(e,t,r){var n=Uo(e),i=n||Vo(e)||as(e);if(t=ia(t,4),null==r){var a=e&&e.constructor;r=i?n?new a:[]:Ko(e)&&Wo(a)?Fr(Ve(e)):{}}return(i?xt:vn)(e,function(e,n,i){return t(r,e,n,i)}),r},Nr.unary=function(e){return wo(e,1)},Nr.union=Ka,Nr.unionBy=Za,Nr.unionWith=Qa,Nr.uniq=function(e){return e&&e.length?oi(e):[]},Nr.uniqBy=function(e,t){return e&&e.length?oi(e,ia(t,2)):[]},Nr.uniqWith=function(t,r){return r="function"==typeof r?r:e,t&&t.length?oi(t,e,r):[]},Nr.unset=function(e,t){return null==e||si(e,t)},Nr.unzip=Ja,Nr.unzipWith=eo,Nr.update=function(e,t,r){return null==e?e:ui(e,t,pi(r))},Nr.updateWith=function(t,r,n,i){return i="function"==typeof i?i:e,null==t?t:ui(t,r,pi(n),i)}
vendor: 4,942 bytes, line 646
646,Nr.values=Ns,Nr.valuesIn=function(e){return null==e?[]:qt(e,Es(e))},Nr.without=to,Nr.words=Ws,Nr.wrap=function(e,t){return Oo(pi(t),e)},Nr.xor=ro,Nr.xorBy=no,Nr.xorWith=io,Nr.zip=ao,Nr.zipObject=function(e,t){return fi(e||[],t||[],Zr)},Nr.zipObjectDeep=function(e,t){return fi(e||[],t||[],Yn)},Nr.zipWith=oo,Nr.entries=Rs,Nr.entriesIn=Bs,Nr.extend=gs,Nr.extendWith=vs,nu(Nr,Nr),Nr.add=pu,Nr.attempt=Xs,Nr.camelCase=Fs,Nr.capitalize=Ls,Nr.ceil=mu,Nr.clamp=function(t,r,n){return n===e&&(n=r,r=e),n!==e&&(n=(n=fs(n))==n?n:0),r!==e&&(r=(r=fs(r))==r?r:0),nn(fs(t),r,n)},Nr.clone=function(e){return an(e,4)},Nr.cloneDeep=function(e){return an(e,5)},Nr.cloneDeepWith=function(t,r){return an(t,5,r="function"==typeof r?r:e)},Nr.cloneWith=function(t,r){return an(t,4,r="function"==typeof r?r:e)},Nr.conformsTo=function(e,t){return null==t||on(e,t,Ps(t))},Nr.deburr=$s,Nr.defaultTo=function(e,t){return null==e||e!=e?t:e},Nr.divide=gu,Nr.endsWith=function(t,r,n){t=ps(t),r=ai(r);var i=t.length,a=n=n===e?i:nn(ls(n),0,i);return(n-=r.length)>=0&&t.slice(n,a)==r},Nr.eq=No,Nr.escape=function(e){return(e=ps(e))&&V.test(e)?e.replace(z,Zt):e},Nr.escapeRegExp=function(e){return(e=ps(e))&&Q.test(e)?e.replace(Z,"\\$&"):e},Nr.every=function(t,r,n){var i=Uo(t)?wt:dn;return n&&ma(t,r,n)&&(r=e),i(t,ia(r,3))},Nr.find=fo,Nr.findIndex=La,Nr.findKey=function(e,t){return Ot(e,ia(t,3),vn)},Nr.findLast=ho,Nr.findLastIndex=$a,Nr.findLastKey=function(e,t){return Ot(e,ia(t,3),yn)},Nr.floor=vu,Nr.forEach=po,Nr.forEachRight=mo,Nr.forIn=function(e,t){return null==e?e:mn(e,ia(t,3),Es)},Nr.forInRight=function(e,t){return null==e?e:gn(e,ia(t,3),Es)},Nr.forOwn=function(e,t){return e&&vn(e,ia(t,3))},Nr.forOwnRight=function(e,t){return e&&yn(e,ia(t,3))},Nr.get=Ss,Nr.gt=Fo,Nr.gte=Lo,Nr.has=function(e,t){return null!=e&&da(e,t,An)},Nr.hasIn=ws,Nr.head=ja,Nr.identity=Js,Nr.includes=function(e,t,r,n){e=zo(e)?e:Ns(e),r=r&&!n?ls(r):0;var i=e.length;return r<0&&(r=pr(i+r,0)),ns(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Bt(e,t,r)>-1},Nr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ls(r);return i<0&&(i=pr(n+i,0)),Bt(e,t,i)},Nr.inRange=function(t,r,n){return r=cs(r),n===e?(n=r,r=0):n=cs(n),function(e,t,r){return e>=mr(t,r)&&e<pr(t,r)}(t=fs(t),r,n)},Nr.invoke=Ts,Nr.isArguments=$o,Nr.isArray=Uo,Nr.isArrayBuffer=jo,Nr.isArrayLike=zo,Nr.isArrayLikeObject=Go,Nr.isBoolean=function(e){return!0===e||!1===e||Zo(e)&&Sn(e)==h},Nr.isBuffer=Vo,Nr.isDate=Ho,Nr.isElement=function(e){return Zo(e)&&1===e.nodeType&&!es(e)},Nr.isEmpty=function(e){if(null==e)return!0;if(zo(e)&&(Uo(e)||"string"==typeof e||"function"==typeof e.splice||Vo(e)||as(e)||$o(e)))return!e.length;var t=la(e);if(t==y||t==w)return!e.size;if(ba(e))return!On(e).length;for(var r in e)if(Oe.call(e,r))return!1;return!0},Nr.isEqual=function(e,t){return Mn(e,t)},Nr.isEqualWith=function(t,r,n){var i=(n="function"==typeof n?n:e)?n(t,r):e;return i===e?Mn(t,r,e,n):!!i},Nr.isError=qo,Nr.isFinite=function(e){return"number"==typeof e&&dr(e)},Nr.isFunction=Wo,Nr.isInteger=Xo,Nr.isLength=Yo,Nr.isMap=Qo,Nr.isMatch=function(e,t){return e===t||kn(e,t,oa(t))},Nr.isMatchWith=function(t,r,n){return n="function"==typeof n?n:e,kn(t,r,oa(r),n)},Nr.isNaN=function(e){return Jo(e)&&e!=+e},Nr.isNative=function(e){if(ya(e))throw new xe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return In(e)},Nr.isNil=function(e){return null==e},Nr.isNull=function(e){return null===e},Nr.isNumber=Jo,Nr.isObject=Ko,Nr.isObjectLike=Zo,Nr.isPlainObject=es,Nr.isRegExp=ts,Nr.isSafeInteger=function(e){return Xo(e)&&e>=-9007199254740991&&e<=s},Nr.isSet=rs,Nr.isString=ns,Nr.isSymbol=is,Nr.isTypedArray=as,Nr.isUndefined=function(t){return t===e},Nr.isWeakMap=function(e){return Zo(e)&&la(e)==T},Nr.isWeakSet=function(e){return Zo(e)&&"[object WeakSet]"==Sn(e)},Nr.join=function(e,t){return null==e?"":fr.call(e,t)},Nr.kebabCase=Us,Nr.last=Ha,Nr.lastIndexOf=function(t,r,n){var i=null==t?0:t.length;if(!i)return-1;var a=i;return n!==e&&(a=(a=ls(n))<0?pr(i+a,0):mr(a,i-1)),r==r?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(t,r,a):Rt(t,Ft,a,!0)},Nr.lowerCase=js,Nr.lowerFirst=zs,Nr.lt=os,Nr.lte=ss,Nr.max=function(t){return t&&t.length?fn(t,Js,wn):e},Nr.maxBy=function(t,r){return t&&t.length?fn(t,ia(r,2),wn):e},Nr.mean=function(e){return Lt(e,Js)},Nr.meanBy=function(e,t){return Lt(e,ia(t,2))},Nr.min=function(t){return t&&t.length?fn(t,Js,Rn):e},Nr.minBy=function(t,r){return t&&t.length?fn(t,ia(r,2),Rn):e},Nr.stubArray=du,Nr.stubFalse=fu,Nr.stubObject=function(){return{}},Nr.stubString=function(){return""},Nr.stubTrue=function(){return!0},Nr.multiply=yu,Nr.nth=function(t,r){return t&&t.length?$n(t,ls(r)):e},Nr.noConflict=function(){return st._===this&&(st._=Le),this},Nr.noop=iu,Nr.now=So,Nr.pad=function(e,t,r){e=ps(e);var n=(t=ls(t))?ir(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Ui(Ut(i),r)+e+Ui(Dt(i),r)},Nr.padEnd=function(e,t,r){e=ps(e);var n=(t=ls(t))?ir(e):0;
vendor: 9,856 bytes, line 646
646return t&&n<t?e+Ui(t-n,r):e},Nr.padStart=function(e,t,r){e=ps(e);var n=(t=ls(t))?ir(e):0;return t&&n<t?Ui(t-n,r)+e:e},Nr.parseInt=function(e,t,r){return r||null==t?t=0:t&&=+t,vr(ps(e).replace(J,""),t||0)},Nr.random=function(t,r,n){if(n&&"boolean"!=typeof n&&ma(t,r,n)&&(r=n=e),n===e&&("boolean"==typeof r?(n=r,r=e):"boolean"==typeof t&&(n=t,t=e)),t===e&&r===e?(t=0,r=1):(t=cs(t),r===e?(r=t,t=0):r=cs(r)),t>r){var i=t;t=r,r=i}if(n||t%1||r%1){var a=yr();return mr(t+a*(r-t+nt("1e-"+((a+"").length-1))),r)}return Vn(t,r)},Nr.reduce=function(e,t,r){var n=Uo(e)?Mt:jt,i=arguments.length<3;return n(e,ia(t,4),r,i,cn)},Nr.reduceRight=function(e,t,r){var n=Uo(e)?kt:jt,i=arguments.length<3;return n(e,ia(t,4),r,i,ln)},Nr.repeat=function(t,r,n){return r=(n?ma(t,r,n):r===e)?1:ls(r),Hn(ps(t),r)},Nr.replace=function(){var e=arguments,t=ps(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Nr.result=function(t,r,n){var i=-1,a=(r=mi(r,t)).length;for(a||(a=1,t=e);++i<a;){var o=null==t?e:t[Da(r[i])];o===e&&(i=a,o=n),t=Wo(o)?o.call(t):o}return t},Nr.round=bu,Nr.runInContext=ee,Nr.sample=function(e){return(Uo(e)?Wr:Wn)(e)},Nr.size=function(e){if(null==e)return 0;if(zo(e))return ns(e)?ir(e):e.length;var t=la(e);return t==y||t==w?e.size:On(e).length},Nr.snakeCase=Gs,Nr.some=function(t,r,n){var i=Uo(t)?It:ei;return n&&ma(t,r,n)&&(r=e),i(t,ia(r,3))},Nr.sortedIndex=function(e,t){return ti(e,t)},Nr.sortedIndexBy=function(e,t,r){return ri(e,t,ia(r,2))},Nr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ti(e,t);if(n<r&&No(e[n],t))return n}return-1},Nr.sortedLastIndex=function(e,t){return ti(e,t,!0)},Nr.sortedLastIndexBy=function(e,t,r){return ri(e,t,ia(r,2),!0)},Nr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ti(e,t,!0)-1;if(No(e[r],t))return r}return-1},Nr.startCase=Vs,Nr.startsWith=function(e,t,r){return e=ps(e),r=null==r?0:nn(ls(r),0,e.length),t=ai(t),e.slice(r,r+t.length)==t},Nr.subtract=_u,Nr.sum=function(e){return e&&e.length?zt(e,Js):0},Nr.sumBy=function(e,t){return e&&e.length?zt(e,ia(t,2)):0},Nr.template=function(t,r,n){var i=Nr.templateSettings;n&&ma(t,r,n)&&(r=e),t=ps(t),r=vs({},r,i,Xi);var a,o,s=vs({},r.imports,i.imports,Xi),u=Ps(s),c=qt(s,u),l=0,d=r.interpolate||me,f="__p += '",h=Ce((r.escape||me).source+"|"+d.source+"|"+(d===W?se:me).source+"|"+(r.evaluate||me).source+"|$","g"),p="//# sourceURL="+(Oe.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Je+"]")+"\n";t.replace(h,function(e,r,n,i,s,u){return n||=i,f+=t.slice(l,u).replace(ge,Qt),r&&(a=!0,f+="' +\n__e("+r+") +\n'"),s&&(o=!0,f+="';\n"+s+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),f+="';\n";var m=Oe.call(r,"variable")&&r.variable;if(m){if(ae.test(m))throw new xe("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(L,""):f).replace($,"$1").replace(U,"$1;"),f="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var g=Xs(function(){return Se(u,p+"return "+f).apply(e,c)});if(g.source=f,qo(g))throw g;return g},Nr.times=function(e,t){if((e=ls(e))<1||e>s)return[];var r=c,n=mr(e,c);t=ia(t),e-=c;for(var i=Gt(n,t);++r<e;)t(r);return i},Nr.toFinite=cs,Nr.toInteger=ls,Nr.toLength=ds,Nr.toLower=function(e){return ps(e).toLowerCase()},Nr.toNumber=fs,Nr.toSafeInteger=function(e){return e?nn(ls(e),-9007199254740991,s):0===e?e:0},Nr.toString=ps,Nr.toUpper=function(e){return ps(e).toUpperCase()},Nr.trim=function(t,r,n){if((t=ps(t))&&(n||r===e))return Vt(t);if(!t||!(r=ai(r)))return t;var i=ar(t),a=ar(r);return vi(i,Xt(i,a),Yt(i,a)+1).join("")},Nr.trimEnd=function(t,r,n){if((t=ps(t))&&(n||r===e))return t.slice(0,or(t)+1);if(!t||!(r=ai(r)))return t;var i=ar(t);return vi(i,0,Yt(i,ar(r))+1).join("")},Nr.trimStart=function(t,r,n){if((t=ps(t))&&(n||r===e))return t.replace(J,"");if(!t||!(r=ai(r)))return t;var i=ar(t);return vi(i,Xt(i,ar(r))).join("")},Nr.truncate=function(t,r){var n=30,i="...";if(Ko(r)){var a="separator"in r?r.separator:a;n="length"in r?ls(r.length):n,i="omission"in r?ai(r.omission):i}var o=(t=ps(t)).length;if(Jt(t)){var s=ar(t);o=s.length}if(n>=o)return t;var u=n-ir(i);if(u<1)return i;var c=s?vi(s,0,u).join(""):t.slice(0,u);if(a===e)return c+i;if(s&&(u+=c.length-u),ts(a)){if(t.slice(u).search(a)){var l,d=c;for(a.global||(a=Ce(a.source,ps(ue.exec(a))+"g")),a.lastIndex=0;l=a.exec(d);)var f=l.index;c=c.slice(0,f===e?u:f)}}else if(t.indexOf(ai(a),u)!=u){var h=c.lastIndexOf(a);h>-1&&(c=c.slice(0,h))}return c+i},Nr.unescape=function(e){return(e=ps(e))&&G.test(e)?e.replace(j,sr):e},Nr.uniqueId=function(e){var t=++Re;return ps(e)+t},Nr.upperCase=Hs,Nr.upperFirst=qs,Nr.each=po,Nr.eachRight=mo,Nr.first=ja,nu(Nr,(hu={},vn(Nr,function(e,t){Oe.call(Nr.prototype,t)||(hu[t]=e)}),hu),{chain:!1}),Nr.VERSION="4.17.21",xt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Nr[e].placeholder=Nr}),xt(["drop","take"],function(t,r){Ur.prototype[t]=function(n){n=n===e?1:pr(ls(n),0);var i=this.__filtered__&&!r?new Ur(this):this.clone();return i.__filtered__?i.__takeCount__=mr(n,i.__takeCount__):i.__views__.push({size:mr(n,c),type:t+(i.__dir__<0?"Right":"")}),i},Ur.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),xt(["filter","map","takeWhile"],function(e,t){var r=t+1,n=1==r||3==r;Ur.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ia(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),xt(["head","last"],function(e,t){var r="take"+(t?"Right":"");Ur.prototype[e]=function(){return this[r](1).value()[0]}}),xt(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");Ur.prototype[e]=function(){return this.__filtered__?new Ur(this):this[r](1)}}),Ur.prototype.compact=function(){return this.filter(Js)},Ur.prototype.find=function(e){return this.filter(e).head()},Ur.prototype.findLast=function(e){return this.reverse().find(e)},Ur.prototype.invokeMap=qn(function(e,t){return"function"==typeof e?new Ur(this):this.map(function(r){return Pn(r,e,t)})}),Ur.prototype.reject=function(e){return this.filter(Io(ia(e)))},Ur.prototype.slice=function(t,r){t=ls(t);var n=this;return n.__filtered__&&(t>0||r<0)?new Ur(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),r!==e&&(n=(r=ls(r))<0?n.dropRight(-r):n.take(r-t)),n)},Ur.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ur.prototype.toArray=function(){return this.take(c)},vn(Ur.prototype,function(t,r){var n=/^(?:filter|find|map|reject)|While$/.test(r),i=/^(?:head|last)$/.test(r),a=Nr[i?"take"+("last"==r?"Right":""):r],o=i||/^find/.test(r);a&&(Nr.prototype[r]=function(){var r=this.__wrapped__,s=i?[1]:arguments,u=r instanceof Ur,c=s[0],l=u||Uo(r),d=function(e){var t=a.apply(Nr,Et([e],s));return i&&f?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=o&&!f,m=u&&!h;if(!o&&l){r=m?r:new Ur(this);var g=t.apply(r,s);return g.__actions__.push({func:uo,args:[d],thisArg:e}),new $r(g,f)}return p&&m?t.apply(this,s):(g=this.thru(d),p?i?g.value()[0]:g.value():g)})}),xt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Ee[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Nr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Uo(i)?i:[],e)}return this[r](function(r){return t.apply(Uo(r)?r:[],e)})}}),vn(Ur.prototype,function(e,t){var r=Nr[t];if(r){var n=r.name+"";Oe.call(Pr,n)||(Pr[n]=[]),Pr[n].push({name:t,func:r})}}),Pr[Ni(e,2).name]=[{name:"wrapper",func:e}],Ur.prototype.clone=function(){var e=new Ur(this.__wrapped__);return e.__actions__=Ci(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ci(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ci(this.__views__),e},Ur.prototype.reverse=function(){if(this.__filtered__){var e=new Ur(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ur.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Uo(e),n=t<0,i=r?e.length:0,a=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var a=r[n],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=mr(t,e+o);break;case"takeRight":e=pr(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,u=s-o,c=n?s:o-1,l=this.__iteratees__,d=l.length,f=0,h=mr(u,this.__takeCount__);if(!r||!n&&i==u&&h==u)return li(e,this.__actions__);var p=[];e:for(;u--&&f<h;){for(var m=-1,g=e[c+=t];++m<d;){var v=l[m],y=v.iteratee,b=v.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue e;break e}}p[f++]=g}return p},Nr.prototype.at=co,Nr.prototype.chain=function(){return so(this)},Nr.prototype.commit=function(){return new $r(this.value(),this.__chain__)},Nr.prototype.next=function(){this.__values__===e&&(this.__values__=us(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Nr.prototype.plant=function(t){for(var r,n=this;n instanceof Lr;){var i=Ra(n);i.__index__=0,i.__values__=e,r?a.__wrapped__=i:r=i;var a=i;n=n.__wrapped__}return a.__wrapped__=t,r},Nr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Ur){var r=t;return this.__actions__.length&&(r=new Ur(this)),(r=r.reverse()).__actions__.push({func:uo,args:[Ya],thisArg:e}),new $r(r,this.__chain__)}return this.thru(Ya)},Nr.prototype.toJSON=Nr.prototype.valueOf=Nr.prototype.value=function(){return li(this.__wrapped__,this.__actions__)},Nr.prototype.first=Nr.prototype.head,at&&(Nr.prototype[at]=function(){return this}),Nr}();ct?((ct.exports=ur)._=ur,ut._=ur):st._=ur}.call(Pot);var Hot,qot,Wot=Vot.exports,Xot={},Yot={};function Kot(){if(Hot)return Yot;
646Hot=1,Object.defineProperty(Yot,"__esModule",{value:!0}),Yot.isNumericArray=function(e){for(var t=0,r=e.length;t<r;t++)if("number"!=typeof e[t])return!1;return!0},Yot.sleep=r,Yot.getSize=function(e){var t=e.node().getBoundingClientRect();return{width:t.width,height:t.height}},Yot.attrd=function(e,t){for(var r in t)"style"!==r&&e.attr(n(r),t[r]);for(var i in t.style)e.style(n(i),t.style[i]);return e},Yot.kebabCase=n,Yot.minimum=function(){var e=[...arguments].filter(function(e){return!(0,t.isNil)(e)});return e.length>0?Math.min.apply(Math,e):void 0},Yot.sortDirection=function(e){var t=e.length;if(t<2)return"none";if("asc"==(e[0]<e[1]?"asc":"desc")){for(var r=1;r<t;r++)if(e[r-1]>=e[r])return"none";return"asc"}for(r=1;r<t;r++)if(e[r-1]<=e[r])return"none";return"desc"},Yot.Refresher=function(t){var n=!1,i=!1;return{requestRefresh:function(){n=!0,i||function(){e.__awaiter(this,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return n?(n=!1,i=!0,[4,r(0)]):[3,2];case 1:e.sent();try{t()}catch(e){console.error(e)}return i=!1,[3,0];case 2:return[2]}})})}()}}},Yot.removeElement=function(e,t){var r=e.indexOf(t);r>=0&&e.splice(r)},Yot.shallowMerge=function(t,r){var n=e.__assign({},t);for(var i in r){var a=r[i];void 0!==a&&(n[i]=a)}return n};var e=Iot,t=Wot;function r(t){return e.__awaiter(this,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return e.sent(),[2]}})})}function n(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}return Yot}function Zot(){if(qot)return Xot;qot=1,Object.defineProperty(Xot,"__esModule",{value:!0}),Xot.Domain=void 0;var e=Wot,t=Kot();function r(e){for(var t=new Map,r=e.length,n=0;n<r;n++)t.set(e[n],n);return t}return Xot.Domain={create:function(e){var n=(0,t.isNumericArray)(e);return{values:e,isNumeric:n,sortDirection:n?(0,t.sortDirection)(e):"none",index:r(e)}},interpolateValue:function(t,r){if(t.isNumeric){var n=t.values,i=(0,e.clamp)(Math.floor(r),0,n.length-2),a=i+1,o=n[i];return(r-i)*(n[a]-o)+o}},interpolateIndex:function(t,r){if(t.isNumeric)if("number"==typeof r){var n=t,i=n.sortDirection,a=n.values;if("none"!==i){var o="asc"===i?(0,e.sortedIndex)(a,r):(0,e.sortedIndexBy)(a,r,function(e){return-e}),s=(o=(0,e.clamp)(o,1,a.length-1))-1,u=a[s];return(r-u)/(a[o]-u)+s}console.warn("Cannot interpolate index because the domain is not sorted")}else console.warn("Cannot interpolate index because the value is not numeric");else console.warn("Cannot interpolate index because the domain is not numeric")}},Xot}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorScale=void 0;var t=Iot,r=Wot,n=t.__importStar(Uot()),i=Dot,a=Zot(),o=Object.keys(n).filter(function(e){return 0===e.indexOf("interpolate")}).map(function(e){return e.replace(/^interpolate/,"")}),s=Object.keys(n).filter(function(e){return 0===e.indexOf("scheme")&&h(n[e])}).map(function(e){return e.replace(/^scheme/,"")}),u=(0,r.uniq)(t.__spreadArray(t.__spreadArray([],o,!0),s,!0)).sort();function c(e,t){if(e.length!==t.length)throw Error("`values` and `colors` must have the same length");var n=e.length,o=a.Domain.create(e),s=t.map(function(e){return"string"==typeof e?i.Color.fromString(e):e});if(!o.isNumeric||"none"===o.sortDirection)throw Error("Provided list of `values` is not numeric and monotonous");return function(e){var t=(0,r.clamp)(a.Domain.interpolateIndex(o,e),0,n-1),u=Math.floor(t);return u===n?s[n]:i.Color.mix(s[u],s[u+1],t-u)}}function l(e,t,r){if(void 0===r&&(r="#888888"),e.length!==t.length)throw Error("`values` and `colors` must have the same length");for(var n=e.length,a=new Map,o=0;o<n;o++){var s=t[o];a.set(e[o],"string"==typeof s?i.Color.fromString(s):s)}var u="string"==typeof r?i.Color.fromString(r):r;return function(e){return a.get(e)??u}}function d(e,t){var i=n.scaleLinear([0,t-1],e);return(0,r.range)(t).map(function(e){return i(e)})}function f(e,t,r){return d(t,r).map(function(t){return i.Color.fromString(e(t))})}function h(e){return(0,r.isArray)(e)&&e.length>0&&"string"==typeof e[0]}e.ColorScale={ContinuousSchemes:o,DiscreteSchemes:u,continuous:function(t,r,i){return"string"==typeof t?function(t,r,i){void 0===r&&(r=[0,1]),void 0===i&&(i=[0,1]);var a=n[`interpolate${t}`];if(void 0!==a)return c(d(r,101),f(a,i,101));throw Error(`Invalid color scheme name: "${t}".\n(Available schemes: ${e.ColorScale.ContinuousSchemes})`)}(t,r,i):c(t,r)},discrete:function(t,r,a){return"string"==typeof t?function(t,r,a){var o=n[`scheme${t}`];if(h(o))return l(r,function(e,t){for(var r=[];r.length<t;)r.push.apply(r,e);return r.length=t,r}(o.map(function(e){return i.Color.fromString(e)}),r.length),a);var s=n[`interpolate${t}`];if(void 0!==s)return l(r,f(s,[0,1],r.length),a);throw Error(`Invalid color scheme name: "${t}".\n(Available schemes: ${e.ColorScale.DiscreteSchemes})`)}(t,r,a):l(t,r,a)}}}(Got);var Qot,Jot,est,tst={},rst={},nst={};function ist(){if(Qot)return nst;
646Qot=1,Object.defineProperty(nst,"__esModule",{value:!0}),nst.Array2D=void 0;var e=Kot();return nst.Array2D={get:function(e,t,r){if(!(t<0||t>=e.nColumns||r<0||r>=e.nRows))return e.values[e.nColumns*r+t]},empty:function(){return{nColumns:0,nRows:0,values:[],isNumeric:!0}},create:function(t,r,n){if(n.length!==t*r)throw Error("ValueError: length of `values` must be nColumns * nRows");return{nColumns:t,nRows:r,values:n,isNumeric:(0,e.isNumericArray)(n)}},createRandom:function(e,t){for(var r=e*t,n=new Float32Array(r),i=0;i<r;i++)n[i]=Math.random();return{nColumns:e,nRows:t,values:n,isNumeric:!0}},createDummy:function(e,t){for(var r=e*t,n=new Float32Array(r),i=0;i<r;i++){var a=i%e,o=Math.floor(i/e);n[i]=.5*(0===a||o===t-1?0:a===e-1||0===o?1:Math.random())+i%e/e*.5}return{nColumns:e,nRows:t,values:n,isNumeric:!0}},getRange:function(e){for(var t=e.values,r=t.length,n=1/0,i=-1/0,a=0;a<r;a++){var o=t[a];o<n&&(n=o),o>i&&(i=o)}return{min:n,max:i}},validateLength:function(e){if(e.values.length!==e.nColumns*e.nRows)throw Error("ValueError: length of data.values must be data.nColumns * data.nRows")}},nst}function ast(){if(Jot)return rst;Jot=1,Object.defineProperty(rst,"__esModule",{value:!0}),rst.DataDescription=void 0;var e=Wot,t=ist(),r=Zot();return rst.DataDescription={empty:function(){return{data:[],xDomain:[null],yDomain:[null],x:function(){return null},y:function(){return null}}},toArray2D:function(e){for(var n=e.data,i=e.x,a=e.y,o=e.filter,s=r.Domain.create(e.xDomain),u=r.Domain.create(e.yDomain),c=s.values.length,l=u.values.length,d=Array(c*l).fill(void 0),f="function"==typeof i?i:function(e,t){return i[t]},h="function"==typeof a?a:function(e,t){return a[t]},p=!1,m=!1,g=0;g<n.length;g++){var v=n[g],y=f(v,g),b=h(v,g),_=s.index.get(y),x=u.index.get(b);void 0===_?p||=(console.warn("Some data items map to X values out of the X domain:",v,"maps to X",y),!0):void 0===x?m||=(console.warn("Some data items map to Y values out of the Y domain:",v,"maps to Y",b),!0):(void 0===o||o(v,y,b,_,x))&&(d[c*x+_]=v)}return{array2d:t.Array2D.create(c,l,d),xDomain:s,yDomain:u}},createRandom:function(r,n){return{data:t.Array2D.createRandom(r,n).values,x:function(e,t){return t%r},y:function(e,t){return Math.floor(t/r)},xDomain:(0,e.range)(r),yDomain:(0,e.range)(n)}},createDummy:function(r,n){return{data:t.Array2D.createDummy(r,n).values,x:function(e,t){return t%r},y:function(e,t){return Math.floor(t/r)},xDomain:(0,e.range)(r),yDomain:(0,e.range)(n)}}},rst}var ost,sst={},ust={},cst={};function lst(){return ost||(ost=1,Object.defineProperty(cst,"__esModule",{value:!0}),cst.Class=void 0,cst.Class={MainDiv:"heatmap-main-div",CanvasDiv:"heatmap-canvas-div",Canvas:"heatmap-canvas",Svg:"heatmap-svg",Marker:"heatmap-marker",MarkerX:"heatmap-marker-x",MarkerY:"heatmap-marker-y",TooltipBox:"heatmap-tooltip-box",TooltipContent:"heatmap-tooltip-content",PinnedTooltipBox:"heatmap-pinned-tooltip-box",PinnedTooltipContent:"heatmap-pinned-tooltip-content",PinnedTooltipPin:"heatmap-pinned-tooltip-pin",PinnedTooltipClose:"heatmap-pinned-tooltip-close",Overlay:"heatmap-overlay",OverlayShade:"heatmap-overlay-shade",OverlayMessage:"heatmap-overlay-message",BrushClose:"heatmap-brush-close"}),cst}var dst,fst={};function hst(){if(dst)return fst;
646dst=1,Object.defineProperty(fst,"__esModule",{value:!0}),fst.Extension=fst.BehaviorBase=void 0;var e=Iot,t=Kot();return fst.BehaviorBase=function(){function r(e,t){this.state=e,this.params=t,this.subscriptions=[]}return r.prototype.register=function(){},r.prototype.getParams=function(){return e.__assign({},this.params)},r.prototype.update=function(e){this.params=(0,t.shallowMerge)(this.params,e)},r.prototype.unregister=function(){this.unsubscribeAll()},r.prototype.subscribe=function(e,r){var n=this,i=e.subscribe(r);return this.subscriptions.push(i),{unsubscribe:function(){(0,t.removeElement)(n.subscriptions,i),i.unsubscribe()}}},r.prototype.unsubscribeAll=function(){for(var e=0,t=this.subscriptions;e<t.length;e++)t[e].unsubscribe();this.subscriptions.length=0},r}(),fst.Extension={fromBehaviorClass:function(e){return{name:e.name,defaultParams:e.defaultParams,create:function(r,n){return new e.behavior(r,(0,t.shallowMerge)(e.defaultParams,n))}}}},fst}var pst,mst,gst={};function vst(){return pst||(pst=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Box=void 0,e.Scales=function(e){return{worldToSvg:{x:i(e.visWorld,e.svg),y:a(e.visWorld,e.svg)},svgToWorld:{x:i(e.svg,e.visWorld),y:a(e.svg,e.visWorld)},worldToCanvasContext:{x:i(e.visWorld,e.canvasContext),y:a(e.visWorld,e.canvasContext)},canvasContextToWorld:{x:i(e.canvasContext,e.visWorld),y:a(e.canvasContext,e.visWorld)}}},e.scaleDistance=function(e,t){if(e.clamp())throw Error("NotImplementedError: this function is not implemented for clamping scales");return e(t)-e(0)};var t=Wot,r=Iot.__importStar(Uot());function n(e,t,r){void 0===r&&(r=0);var n=e[0],i=e[1],a=t[0],o=t[1];if(i-n>=r)return[n,i];var s=.5*(n+i);return s<a+.5*r?[a,Math.min(a+r,o)]:s>o-.5*r?[Math.max(o-r,a),o]:[s-.5*r,s+.5*r]}function i(e,t){return r.scaleLinear([e.xmin,e.xmax],[t.xmin,t.xmax]).clamp(!1)}function a(e,t){return r.scaleLinear([e.ymin,e.ymax],[t.ymin,t.ymax]).clamp(!1)}e.Box={create:function(e,t,r,n){return{xmin:e,ymin:t,xmax:r,ymax:n}},width:function(e){return e.xmax-e.xmin},height:function(e){return e.ymax-e.ymin},containsPoint:function(e,t){return t.x>=e.xmin&&t.x<=e.xmax&&t.y>=e.ymin&&t.y<=e.ymax},clamp:function(e,r,i){var a={xmin:isNaN(e.xmin)?r.xmin:(0,t.clamp)(e.xmin,r.xmin,r.xmax),xmax:isNaN(e.xmax)?r.xmax:(0,t.clamp)(e.xmax,r.xmin,r.xmax),ymin:isNaN(e.ymin)?r.ymin:(0,t.clamp)(e.ymin,r.ymin,r.ymax),ymax:isNaN(e.ymax)?r.ymax:(0,t.clamp)(e.ymax,r.ymin,r.ymax)};return void 0===i?a:function(e,t,r){var i=n([e.xmin,e.xmax],[t.xmin,t.xmax],r.width),a=i[0],o=i[1],s=n([e.ymin,e.ymax],[t.ymin,t.ymax],r.height);return{xmin:a,xmax:o,ymin:s[0],ymax:s[1]}}(a,r,i)},snap:function(t,r,n){if(t){var i="out"===r?{xmin:Math.floor(t.xmin),xmax:Math.ceil(t.xmax),ymin:Math.floor(t.ymin),ymax:Math.ceil(t.ymax)}:{xmin:Math.round(t.xmin),xmax:Math.round(t.xmax),ymin:Math.round(t.ymin),ymax:Math.round(t.ymax)};if(n&&(i=e.Box.clamp(i,n)),i.xmin!==i.xmax&&i.ymin!==i.ymax)return i}}}}(gst)),gst}var yst,bst,_st,xst={},Sst={},wst={};function Ast(){return yst||(yst=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Image=void 0;var t=Dot;e.Image={create:function(e,t){return{nColumns:e,nRows:t,values:new Uint8ClampedArray(e*t*4)}},clear:function(e){e.values.fill(0)},getColor:function(e,r,n){return t.Color.fromAragabaArray(e.values,4*(n*e.nColumns+r))},setColor:function(e,r,n,i){return t.Color.toAragabaArray(i,e.values,4*(n*e.nColumns+r))},addColor:function(e,r,n,i){return t.Color.addToAragabaArray(i,e.values,4*(n*e.nColumns+r))},addRect:function(r,n,i,a,o,s){n=Math.min(Math.max(n,0),r.nColumns),a=Math.min(Math.max(a,0),r.nColumns),i=Math.min(Math.max(i,0),r.nRows),o=Math.min(Math.max(o,0),r.nRows);for(var u=Math.floor(n),c=Math.floor(i),l=Math.ceil(a),d=Math.ceil(o),f=c;f<d;f++)for(var h=Math.min(f+1,o)-Math.max(f,i),p=u;p<l;p++){var m=Math.min(p+1,a)-Math.max(p,n),g=t.Color.scaleAlpha(s,m*h);e.Image.addColor(r,p,f,g)}},toImageData:function(e,r){for(var n=0,i=e.values.length;n<i;n+=4){var a=t.Color.fromAragabaArray(e.values,n);t.Color.toRgbaArray(a,r.data,n)}return r},validateLength:function(e){if(e.values.length!==4*e.nColumns*e.nRows)throw Error("ValueError: length of image.values must be 4 * image.nColumns * image.nRows")}}}(wst)),wst}var Cst,Tst,Pst,Est={},Mst={},kst={},Ist={},Dst={},Ost={},Rst={},Bst={};function Nst(){return Pst||(Pst=1,Object.defineProperty(Bst,"__esMo
646dule",{value:!0}),Bst.isFunction=void 0,Bst.isFunction=function(e){return"function"==typeof e}),Bst}var Fst,Lst,$st={},Ust={},jst={};function zst(){return Fst||(Fst=1,Object.defineProperty(jst,"__esModule",{value:!0}),jst.createErrorClass=void 0,jst.createErrorClass=function(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}),jst}function Gst(){return Lst||(Lst=1,Object.defineProperty(Ust,"__esModule",{value:!0}),Ust.UnsubscriptionError=void 0,Ust.UnsubscriptionError=zst().createErrorClass(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t}})),Ust}var Vst,Hst,qst={};function Wst(){return Vst||(Vst=1,Object.defineProperty(qst,"__esModule",{value:!0}),qst.arrRemove=void 0,qst.arrRemove=function(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}),qst}function Xst(){if(Hst)return $st;Hst=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},t=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},r=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty($st,"__esModule",{value:!0}),$st.isSubscription=$st.EMPTY_SUBSCRIPTION=$st.Subscription=void 0;var n=Nst(),i=Gst(),a=Wst(),o=function(){function o(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return o.prototype.unsubscribe=function(){var a,o,u,c,l;if(!this.closed){this.closed=!0;var d=this._parentage;if(d)if(this._parentage=null,Array.isArray(d))try{for(var f=e(d),h=f.next();!h.done;h=f.next())h.value.remove(this)}catch(e){a={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(a)throw a.error}}else d.remove(this);var p=this.initialTeardown;if(n.isFunction(p))try{p()}catch(e){l=e instanceof i.UnsubscriptionError?e.errors:[e]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var g=e(m),v=g.next();!v.done;v=g.next()){var y=v.value;try{s(y)}catch(e){l??=[],e instanceof i.UnsubscriptionError?l=r(r([],t(l)),t(e.errors)):l.push(e)}}}catch(e){u={error:e}}finally{try{v&&!v.done&&(c=g.return)&&c.call(g)}finally{if(u)throw u.error}}}if(l)throw new i.UnsubscriptionError(l)}},o.prototype.add=function(e){if(e&&e!==this)if(this.closed)s(e);else{if(e instanceof o){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=this._finalizers??[]).push(e)}},o.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},o.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},o.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&a.arrRemove(t,e)},o.prototype.remove=function(e){var t=this._finalizers;t&&a.arrRemove(t,e),e instanceof o&&e._removeParent(this)},o.EMPTY=function(){var e=new o;return e.closed=!0,e}(),o}();function s(e){n.isFunction(e)?e():e.unsubscribe()}return $st.Subscription=o,$st.EMPTY_SUBSCRIPTION=o.EMPTY,$st.isSubscription=function(e){return e instanceof o||e&&"closed"in e&&n.isFunction(e.remove)&&n.isFunction(e.add)&&n.isFunction(e.unsubscribe)},$st}var Yst,Kst={};function Zst(){return Yst||(Yst=1,Object.defineProperty(Kst,"__esModule",{value:!0}),Kst.config=void 0,Kst.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}),Kst}var Qst,Jst,eut={},tut={};function rut(){return Qst||(Qst=1,function(e){var t=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},r=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.timeoutProvider=void 0,e.timeoutProvider={setTimeout:function(n,i){var a=[...arguments].slice(2),o=e.timeoutProvider.delegate;return o?.setTimeout?o.setTimeout.apply(o,r([n,i],t(a))):setTimeout.apply(void 0,r([n,i],t(a)))},clearTimeout:function(t){return(e.timeoutProvider.delegate?.clearTimeout||clearTimeout)(t)},delegate:void 0}}(tut)),tut}function nut(){if(Jst)return eut;Jst=1,Object.defineProperty(eut,"__esModule",{value:!0}),eut.reportUnhandledError=void 0;var e=Zst(),t=rut();return eut.reportUnhandledError=function(r){t.timeoutProvider.setTimeout(function(){var t=e.config.onUnhandledError;if(!t)throw r;t(r)})},eut}var iut,aut={};function out(){return iut||(iut=1,Object.defineProperty(aut,"__esModule",{value:!0}),aut.noop=void 0,aut.noop=function(){}),aut}var sut,uut,cut,lut={},dut={};function fut(){if(uut)return dut;uut=1,Object.defineProperty(dut,"__esModule",{value:!0}),dut.captureError=dut.errorContext=void 0;var e=Zst(),t=null;return dut.errorContext=function(r){if(e.config.useDeprecatedSynchronousErrorHandling){var n=!t;if(n&&(t={errorThrown:!1,error:null}),r(),n){var i=t,a=i.errorThrown,o=i.error;if(t=null,a)throw o}}else r()},dut.captureError=function(r){e.config.useDeprecatedSynchronousErrorHandling&&t&&(t.errorThrown=!0,t.error=r)},dut}function hut(){return cut||(cut=1,function(e){var t=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();
646Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_OBSERVER=e.SafeSubscriber=e.Subscriber=void 0;var r=Nst(),n=Xst(),i=Zst(),a=nut(),o=out(),s=function(){if(sut)return lut;function e(e,t,r){return{kind:e,value:t,error:r}}return sut=1,Object.defineProperty(lut,"__esModule",{value:!0}),lut.createNotification=lut.nextNotification=lut.errorNotification=lut.COMPLETE_NOTIFICATION=void 0,lut.COMPLETE_NOTIFICATION=e("C",void 0,void 0),lut.errorNotification=function(t){return e("E",void 0,t)},lut.nextNotification=function(t){return e("N",t,void 0)},lut.createNotification=e,lut}(),u=rut(),c=fut(),l=function(r){function i(t){var i=r.call(this)||this;return i.isStopped=!1,t?(i.destination=t,n.isSubscription(t)&&t.add(i)):i.destination=e.EMPTY_OBSERVER,i}return t(i,r),i.create=function(e,t,r){return new p(e,t,r)},i.prototype.next=function(e){this.isStopped?g(s.nextNotification(e),this):this._next(e)},i.prototype.error=function(e){this.isStopped?g(s.errorNotification(e),this):(this.isStopped=!0,this._error(e))},i.prototype.complete=function(){this.isStopped?g(s.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},i.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},i.prototype._next=function(e){this.destination.next(e)},i.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},i.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},i}(n.Subscription);e.Subscriber=l;var d=Function.prototype.bind;function f(e,t){return d.call(e,t)}var h=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){m(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){m(e)}else m(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){m(e)}},e}(),p=function(e){function n(t,n,a){var o,s,u=e.call(this)||this;return r.isFunction(t)||!t?o={next:t??void 0,error:n??void 0,complete:a??void 0}:u&&i.config.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},o={next:t.next&&f(t.next,s),error:t.error&&f(t.error,s),complete:t.complete&&f(t.complete,s)}):o=t,u.destination=new h(o),u}return t(n,e),n}(l);function m(e){i.config.useDeprecatedSynchronousErrorHandling?c.captureError(e):a.reportUnhandledError(e)}function g(e,t){var r=i.config.onStoppedNotification;r&&u.timeoutProvider.setTimeout(function(){return r(e,t)})}e.SafeSubscriber=p,e.EMPTY_OBSERVER={closed:!0,next:o.noop,error:function(e){throw e},complete:o.noop}}(Rst)),Rst}var put,mut={};function gut(){return put||(put=1,Object.defineProperty(mut,"__esModule",{value:!0}),mut.observable=void 0,mut.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"),mut}var vut,yut,but,_ut={},xut={};function Sut(){return vut||(vut=1,Object.defineProperty(xut,"__esModule",{value:!0}),xut.identity=void 0,xut.identity=function(e){return e}),xut}function wut(){if(yut)return _ut;yut=1,Object.defineProperty(_ut,"__esModule",{value:!0}),_ut.pipeFromArray=_ut.pipe=void 0;var e=Sut();function t(t){return 0===t.length?e.identity:1===t.length?t[0]:function(e){return t.reduce(function(e,t){return t(e)},e)}}return _ut.pipe=function(){return t([...arguments])},_ut.pipeFromArray=t,_ut}function Aut(){if(but)return Ost;but=1,Object.defineProperty(Ost,"__esModule",{value:!0}),Ost.Observable=void 0;var e=hut(),t=Xst(),r=gut(),n=wut(),i=Zst(),a=Nst(),o=fut(),s=function(){function i(e){e&&(this._subscribe=e)}return i.prototype.lift=function(e){var t=new i;return t.source=this,t.operator=e,t},i.prototype.subscribe=function(r,n,i){var s,u=this,c=(s=r)&&s instanceof e.Subscriber||function(e){return e&&a.isFunction(e.next)&&a.isFunction(e.error)&&a.isFunction(e.complete)}(s)&&t.isSubscription(s)?r:new e.SafeSubscriber(r,n,i);return o.errorContext(function(){var e=u,t=e.operator,r=e.source;c.add(t?t.call(c,r):r?u._subscribe(c):u._trySubscribe(c))}),c},i.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},i.prototype.forEach=function(t,r){var n=this;return new(r=u(r))(function(r,i){var a=new e.SafeSubscriber({next:function(e){try{t(e)}catch(e){i(e),a.unsubscribe()}},error:i,complete:r});n.subscribe(a)})},i.prototype._subscribe=function(e){return this.source?.subscribe(e)},i.prototype[r.observable]=function(){return this},i.prototype.pipe=function(){var e=[...arguments];return n.pipeFromArray(e)(this)},i.prototype.toPromise=function(e){var t=this;return new(e=u(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},i.create=function(e){return new i(e)},i}();function u(e){return e??i.config.Promise??Promise}return Ost.Observable=s,Ost}var Cut,Tut={},Put={},Eut={};function Mut(){if(Cut)return Eut;
646Cut=1,Object.defineProperty(Eut,"__esModule",{value:!0}),Eut.operate=Eut.hasLift=void 0;var e=Nst();function t(t){return e.isFunction(t?.lift)}return Eut.hasLift=t,Eut.operate=function(e){return function(r){if(t(r))return r.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}},Eut}var kut,Iut,Dut,Out={};function Rut(){if(kut)return Out;kut=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Out,"__esModule",{value:!0}),Out.OperatorSubscriber=Out.createOperatorSubscriber=void 0;var t=hut();Out.createOperatorSubscriber=function(e,t,n,i,a){return new r(e,t,n,i,a)};var r=function(t){function r(e,r,n,i,a,o){var s=t.call(this,e)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,s._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,s._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,s}return e(r,t),r.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null==(e=this.onFinalize)||e.call(this))}},r}(t.Subscriber);return Out.OperatorSubscriber=r,Out}function But(){if(Iut)return Put;Iut=1,Object.defineProperty(Put,"__esModule",{value:!0}),Put.refCount=void 0;var e=Mut(),t=Rut();return Put.refCount=function(){return e.operate(function(e,r){var n=null;e._refCount++;var i=t.createOperatorSubscriber(r,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount)n=null;else{var t=e._connection,i=n;n=null,!t||i&&t!==i||t.unsubscribe(),r.unsubscribe()}});e.subscribe(i),i.closed||(n=e.connect())})},Put}function Nut(){if(Dut)return Tut;Dut=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Tut,"__esModule",{value:!0}),Tut.ConnectableObservable=void 0;var t=Aut(),r=Xst(),n=But(),i=Rut(),a=Mut();return Tut.ConnectableObservable=function(t){function o(e,r){var n=t.call(this)||this;return n.source=e,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,a.hasLift(e)&&(n.lift=e.lift),n}return e(o,t),o.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},o.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},o.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,e?.unsubscribe()},o.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new r.Subscription;var n=this.getSubject();t.add(this.source.subscribe(i.createOperatorSubscriber(n,void 0,function(){e._teardown(),n.complete()},function(t){e._teardown(),n.error(t)},function(){return e._teardown()}))),t.closed&&(this._connection=null,t=r.Subscription.EMPTY)}return t},o.prototype.refCount=function(){return n.refCount()(this)},o}(t.Observable),Tut}var Fut,Lut,$ut,Uut={},jut={},zut={};function Gut(){return Lut||(Lut=1,function(e){var t=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},r=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrameProvider=void 0;var n=Xst();e.animationFrameProvider={schedule:function(t){var r=requestAnimationFrame,i=cancelAnimationFrame,a=e.animationFrameProvider.delegate;a&&(r=a.requestAnimationFrame,i=a.cancelAnimationFrame);var o=r(function(e){i=void 0,t(e)});return new n.Subscription(function(){return i?.(o)})},requestAnimationFrame:function(){var n=[...arguments];return(e.animationFrameProvider.delegate?.requestAnimationFrame||requestAnimationFrame).apply(void 0,r([],t(n)))},cancelAnimationFrame:function(){var n=[...arguments];return(e.animationFrameProvider.delegate?.cancelAnimationFrame||cancelAnimationFrame).apply(void 0,r([],t(n)))},delegate:void 0}}(zut)),zut}var Vut,Hut,qut={},Wut={};function Xut(){return Vut||(Vut=1,Object.defineProperty(Wut,"__esModule",{value:!0}),Wut.ObjectUnsubscribedError=void 0,Wut.ObjectUnsubscribedError=zst().createErrorClass(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Wut}function Yut(){if(Hut)return qut;Hut=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),t=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(qut,"__esModule",{value:!0}),qut.AnonymousSubject=qut.Subject=void 0;var r=Aut(),n=Xst(),i=Xut(),a=Wst(),o=fut(),s=function(s){function c(){var e=s.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return e(c,s),c.prototype.lift=function(e){var t=new u(this,this);return t.operator=e,t},c.prototype._throwIfClosed=function(){if(this.closed)throw new i.ObjectUnsubscribedError},c.prototype.next=function(e){var r=this;o.errorContext(function(){var n,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||=Array.from(r.observers);try{for(var a=t(r.currentObservers),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}}})},c.prototype.error=function(e){var t=this;o.errorContext(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},c.prototype.complete=function(){var e=this;o.errorContext(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},c.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(c.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),c.prototype._trySubscribe=function(e){return this._throwIfClosed(),s.prototype._trySubscribe.call(this,e)},c.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},c.prototype._innerSubscribe=function(e){var t=this,r=this,i=r.hasError,o=r.isStopped,s=r.observers;return i||o?n.EMPTY_SUBSCRIPTION:(this.currentObservers=null,s.push(e),new n.Subscription(function(){t.currentObservers=null,a.arrRemove(s,e)}))},c.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},c.prototype.asObservable=function(){var e=new r.Observable;return e.source=this,e},c.create=function(e,t){return new u(e,t)},c}(r.Observable);qut.Subject=s;var u=function(t){function r(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return e(r,t),r.prototype.next=function(e){var t,r;null==(r=(t=this.destination)?.next)||r.call(t,e)},r.prototype.error=function(e){var t,r;null==(r=(t=this.destination)?.error)||r.call(t,e)},r.prototype.complete=function(){var e,t;null==(t=(e=this.destination)?.complete)||t.call(e)},r.prototype._subscribe=function(e){return this.source?.subscribe(e)??n.EMPTY_SUBSCRIPTION},r}(s);return qut.AnonymousSubject=u,qut}var Kut,Zut={};function Qut(){if(Kut)return Zut;Kut=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();
646return Object.defineProperty(Zut,"__esModule",{value:!0}),Zut.BehaviorSubject=void 0,Zut.BehaviorSubject=function(t){function r(e){var r=t.call(this)||this;return r._value=e,r}return e(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},r.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},r.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},r}(Yut().Subject),Zut}var Jut,ect,tct={},rct={};function nct(){return Jut||(Jut=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.dateTimestampProvider=void 0,e.dateTimestampProvider={now:function(){return(e.dateTimestampProvider.delegate||Date).now()},delegate:void 0}}(rct)),rct}function ict(){if(ect)return tct;ect=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(tct,"__esModule",{value:!0}),tct.ReplaySubject=void 0;var t=Yut(),r=nct();return tct.ReplaySubject=function(t){function n(e,n,i){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===i&&(i=r.dateTimestampProvider);var a=t.call(this)||this;return a._bufferSize=e,a._windowTime=n,a._timestampProvider=i,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,e),a._windowTime=Math.max(1,n),a}return e(n,t),n.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,a=r._infiniteTimeWindow,o=r._timestampProvider,s=r._windowTime;n||(i.push(e),!a&&i.push(o.now()+s)),this._trimBuffer(),t.prototype.next.call(this,e)},n.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!e.closed;i+=r?1:2)e.next(n[i]);return this._checkFinalizedStatuses(e),t},n.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,i=e._infiniteTimeWindow,a=(i?1:2)*t;if(t<1/0&&a<n.length&&n.splice(0,n.length-a),!i){for(var o=r.now(),s=0,u=1;u<n.length&&n[u]<=o;u+=2)s=u;s&&n.splice(0,s+1)}},n}(t.Subject),tct}var act,oct={};function sct(){if(act)return oct;act=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();return Object.defineProperty(oct,"__esModule",{value:!0}),oct.AsyncSubject=void 0,oct.AsyncSubject=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}return e(r,t),r.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,i=t._value,a=t.thrownError,o=t.isStopped,s=t._isComplete;r?e.error(a):(o||s)&&(n&&e.next(i),e.complete())},r.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},r.prototype.complete=function(){var e=this,r=e._hasValue,n=e._value;e._isComplete||(this._isComplete=!0,r&&t.prototype.next.call(this,n),t.prototype.complete.call(this))},r}(Yut().Subject),oct}var uct,cct,lct,dct={},fct={},hct={},pct={},mct={};function gct(){if(lct)return hct;lct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();
646Object.defineProperty(hct,"__esModule",{value:!0}),hct.AsyncAction=void 0;var t=function(){if(uct)return pct;uct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();return Object.defineProperty(pct,"__esModule",{value:!0}),pct.Action=void 0,pct.Action=function(t){function r(e,r){return t.call(this)||this}return e(r,t),r.prototype.schedule=function(e,t){return this},r}(Xst().Subscription),pct}(),r=(cct||(cct=1,function(e){var t=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},r=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.intervalProvider=void 0,e.intervalProvider={setInterval:function(n,i){var a=[...arguments].slice(2),o=e.intervalProvider.delegate;return o?.setInterval?o.setInterval.apply(o,r([n,i],t(a))):setInterval.apply(void 0,r([n,i],t(a)))},clearInterval:function(t){return(e.intervalProvider.delegate?.clearInterval||clearInterval)(t)},delegate:void 0}}(mct)),mct),n=Wst();return hct.AsyncAction=function(t){function i(e,r){var n=t.call(this,e,r)||this;
646return n.scheduler=e,n.work=r,n.pending=!1,n}return e(i,t),i.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(n,this.id,t),this},i.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),r.intervalProvider.setInterval(e.flush.bind(e,this),n)},i.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&r.intervalProvider.clearInterval(t)},i.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},i.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},i.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,r=this.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,n.arrRemove(i,this),null!=e&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},i}(t.Action),hct}var vct,yct,bct,_ct,xct,Sct,wct,Act={},Cct={},Tct={},Pct={},Ect={};function Mct(){if(_ct)return Ect;_ct=1,Object.defineProperty(Ect,"__esModule",{value:!0}),Ect.Scheduler=void 0;var e=nct();return Ect.Scheduler=function(){function t(e,r){void 0===r&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},t.now=e.dateTimestampProvider.now,t}(),Ect}function kct(){if(xct)return Pct;xct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Pct,"__esModule",{value:!0}),Pct.AsyncScheduler=void 0;var t=Mct();return Pct.AsyncScheduler=function(r){function n(e,n){void 0===n&&(n=t.Scheduler.now);var i=r.call(this,e,n)||this;return i.actions=[],i._active=!1,i}return e(n,r),n.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},n}(t.Scheduler),Pct}var Ict,Dct={};function Oct(){return Ict||(Ict=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.async=e.asyncScheduler=void 0;var t=gct();e.asyncScheduler=new(kct().AsyncScheduler)(t.AsyncAction),e.async=e.asyncScheduler}(Dct)),Dct}var Rct,Bct,Nct,Fct,Lct,$ct,Uct,jct,zct={},Gct={},Vct={},Hct={},qct={},Wct={},Xct={},Yct={},Kct={};function Zct(){return jct||(jct=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.empty=e.EMPTY=void 0;var t=Aut();e.EMPTY=new t.Observable(function(e){return e.complete()}),e.empty=function(r){return r?function(e){return new t.Observable(function(t){return e.schedule(function(){return t.complete()})})}(r):e.EMPTY}}(Kct)),Kct}var Qct,Jct,elt={},tlt={},rlt={};function nlt(){if(Qct)return rlt;Qct=1,Object.defineProperty(rlt,"__esModule",{value:!0}),rlt.isScheduler=void 0;var e=Nst();return rlt.isScheduler=function(t){return t&&e.isFunction(t.schedule)},rlt}function ilt(){if(Jct)return tlt;Jct=1,Object.defineProperty(tlt,"__esModule",{value:!0}),tlt.popNumber=tlt.popScheduler=tlt.popResultSelector=void 0;var e=Nst(),t=nlt();function r(e){return e[e.length-1]}return tlt.popResultSelector=function(t){return e.isFunction(r(t))?t.pop():void 0},tlt.popScheduler=function(e){return t.isScheduler(r(e))?e.pop():void 0},tlt.popNumber=function(e,t){return"number"==typeof r(e)?e.pop():t},tlt}var alt,olt={},slt={},ult={}
646,clt={},llt={};function dlt(){return alt||(alt=1,Object.defineProperty(llt,"__esModule",{value:!0}),llt.isArrayLike=void 0,llt.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}),llt}var flt,hlt={};function plt(){if(flt)return hlt;flt=1,Object.defineProperty(hlt,"__esModule",{value:!0}),hlt.isPromise=void 0;var e=Nst();return hlt.isPromise=function(t){return e.isFunction(t?.then)},hlt}var mlt,glt={};function vlt(){if(mlt)return glt;mlt=1,Object.defineProperty(glt,"__esModule",{value:!0}),glt.isInteropObservable=void 0;var e=gut(),t=Nst();return glt.isInteropObservable=function(r){return t.isFunction(r[e.observable])},glt}var ylt,blt={};function _lt(){if(ylt)return blt;ylt=1,Object.defineProperty(blt,"__esModule",{value:!0}),blt.isAsyncIterable=void 0;var e=Nst();return blt.isAsyncIterable=function(t){return Symbol.asyncIterator&&e.isFunction(t?.[Symbol.asyncIterator])},blt}var xlt,Slt={};function wlt(){return xlt||(xlt=1,Object.defineProperty(Slt,"__esModule",{value:!0}),Slt.createInvalidObservableTypeError=void 0,Slt.createInvalidObservableTypeError=function(e){return TypeError("You provided "+("object"==typeof e&&e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}),Slt}var Alt,Clt,Tlt={},Plt={};function Elt(){if(Alt)return Plt;function e(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}return Alt=1,Object.defineProperty(Plt,"__esModule",{value:!0}),Plt.iterator=Plt.getSymbolIterator=void 0,Plt.getSymbolIterator=e,Plt.iterator=e(),Plt}function Mlt(){if(Clt)return Tlt;Clt=1,Object.defineProperty(Tlt,"__esModule",{value:!0}),Tlt.isIterable=void 0;var e=Elt(),t=Nst();return Tlt.isIterable=function(r){return t.isFunction(r?.[e.iterator])},Tlt}var klt,Ilt,Dlt={};function Olt(){if(klt)return Dlt;klt=1;var e=Pot&&Pot.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},t=Pot&&Pot.__await||function(e){return this instanceof t?(this.v=e,this):new t(e)},r=Pot&&Pot.__asyncGenerator||function(e,r,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,a=n.apply(e,r||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){a[e]&&(i[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||u(e,t)})})}function u(e,r){try{!function(e){e.value instanceof t?Promise.resolve(e.value.v).then(c,l):d(o[0][2],e)}(a[e](r))}catch(e){d(o[0][3],e)}}function c(e){u("next",e)}function l(e){u("throw",e)}function d(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}};Object.defineProperty(Dlt,"__esModule",{value:!0}),Dlt.isReadableStreamLike=Dlt.readableStreamLikeToAsyncGenerator=void 0;var n=Nst();return Dlt.readableStreamLikeToAsyncGenerator=function(n){return r(this,arguments,function(){var r,i,a;return e(this,function(e){switch(e.label){case 0:r=n.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,t(r.read())];case 3:return i=e.sent(),a=i.value,i.done?[4,t(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,t(a)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})},Dlt.isReadableStreamLike=function(e){return n.isFunction(e?.getReader)},Dlt}function Rlt(){if(Ilt)return clt;Ilt=1;var e=Pot&&Pot.__awaiter||function(e,t,r,n){return new(r||=Promise)(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}u((n=n.apply(e,t||[])).next())})},t=Pot&&Pot.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;
646function s(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},r=Pot&&Pot.__asyncValues||function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof n?n(e):e[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}},n=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(clt,"__esModule",{value:!0}),clt.fromReadableStreamLike=clt.fromAsyncIterable=clt.fromIterable=clt.fromPromise=clt.fromArrayLike=clt.fromInteropObservable=clt.innerFrom=void 0;var i=dlt(),a=plt(),o=Aut(),s=vlt(),u=_lt(),c=wlt(),l=Mlt(),d=Olt(),f=Nst(),h=nut(),p=gut();function m(e){return new o.Observable(function(t){var r=e[p.observable]();if(f.isFunction(r.subscribe))return r.subscribe(t);throw TypeError("Provided object does not correctly implement Symbol.observable")})}function g(e){return new o.Observable(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function v(e){return new o.Observable(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,h.reportUnhandledError)})}function y(e){return new o.Observable(function(t){var r,i;try{for(var a=n(e),o=a.next();!o.done;o=a.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}t.complete()})}function b(n){return new o.Observable(function(i){(function(n,i){var a,o,s,u;return e(this,void 0,void 0,function(){var e,c;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,5,6,11]),a=r(n),t.label=1;case 1:return[4,a.next()];case 2:if((o=t.sent()).done)return[3,4];if(e=o.value,i.next(e),i.closed)return[2];t.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=t.sent(),s={error:c},[3,11];case 6:return t.trys.push([6,,9,10]),o&&!o.done&&(u=a.return)?[4,u.call(a)]:[3,8];case 7:t.sent(),t.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return i.complete(),[2]}})})})(n,i).catch(function(e){return i.error(e)})})}function _(e){return b(d.readableStreamLikeToAsyncGenerator(e))}return clt.innerFrom=function(e){if(e instanceof o.Observable)return e;if(null!=e){if(s.isInteropObservable(e))return m(e);if(i.isArrayLike(e))return g(e);if(a.isPromise(e))return v(e);if(u.isAsyncIterable(e))return b(e);if(l.isIterable(e))return y(e);if(d.isReadableStreamLike(e))return _(e)}throw c.createInvalidObservableTypeError(e)},clt.fromInteropObservable=m,clt.fromArrayLike=g,clt.fromPromise=v,clt.fromIterable=y,clt.fromAsyncIterable=b,clt.fromReadableStreamLike=_,clt}var Blt,Nlt,Flt={},Llt={};function $lt(){return Blt||(Blt=1,Object.defineProperty(Llt,"__esModule",{value:!0}),Llt.executeSchedule=void 0,Llt.executeSchedule=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var a=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!i)return a}),Llt}function Ult(){if(Nlt)return Flt;
646Nlt=1,Object.defineProperty(Flt,"__esModule",{value:!0}),Flt.observeOn=void 0;var e=$lt(),t=Mut(),r=Rut();return Flt.observeOn=function(n,i){return void 0===i&&(i=0),t.operate(function(t,a){t.subscribe(r.createOperatorSubscriber(a,function(t){return e.executeSchedule(a,n,function(){return a.next(t)},i)},function(){return e.executeSchedule(a,n,function(){return a.complete()},i)},function(t){return e.executeSchedule(a,n,function(){return a.error(t)},i)}))})},Flt}var jlt,zlt,Glt={};function Vlt(){if(jlt)return Glt;jlt=1,Object.defineProperty(Glt,"__esModule",{value:!0}),Glt.subscribeOn=void 0;var e=Mut();return Glt.subscribeOn=function(t,r){return void 0===r&&(r=0),e.operate(function(e,n){n.add(t.schedule(function(){return e.subscribe(n)},r))})},Glt}var Hlt,qlt,Wlt,Xlt={},Ylt={},Klt={};function Zlt(){if(Wlt)return Klt;Wlt=1,Object.defineProperty(Klt,"__esModule",{value:!0}),Klt.scheduleIterable=void 0;var e=Aut(),t=Elt(),r=Nst(),n=$lt();return Klt.scheduleIterable=function(i,a){return new e.Observable(function(e){var o;return n.executeSchedule(e,a,function(){o=i[t.iterator](),n.executeSchedule(e,a,function(){var t,r,n;try{r=(t=o.next()).value,n=t.done}catch(t){return void e.error(t)}n?e.complete():e.next(r)},0,!0)}),function(){return r.isFunction(o?.return)&&o.return()}})},Klt}var Qlt,Jlt={};function edt(){if(Qlt)return Jlt;Qlt=1,Object.defineProperty(Jlt,"__esModule",{value:!0}),Jlt.scheduleAsyncIterable=void 0;var e=Aut(),t=$lt();return Jlt.scheduleAsyncIterable=function(r,n){if(!r)throw Error("Iterable cannot be null");return new e.Observable(function(e){t.executeSchedule(e,n,function(){var i=r[Symbol.asyncIterator]();t.executeSchedule(e,n,function(){i.next().then(function(t){t.done?e.complete():e.next(t.value)})},0,!0)})})},Jlt}var tdt,rdt,ndt,idt,adt={};function odt(){if(rdt)return slt;rdt=1,Object.defineProperty(slt,"__esModule",{value:!0}),slt.scheduled=void 0;var e=function(){if(zlt)return ult;zlt=1,Object.defineProperty(ult,"__esModule",{value:!0}),ult.scheduleObservable=void 0;var e=Rlt(),t=Ult(),r=Vlt();return ult.scheduleObservable=function(n,i){return e.innerFrom(n).pipe(r.subscribeOn(i),t.observeOn(i))},ult}(),t=function(){if(Hlt)return Xlt;Hlt=1,Object.defineProperty(Xlt,"__esModule",{value:!0}),Xlt.schedulePromise=void 0;var e=Rlt(),t=Ult(),r=Vlt();return Xlt.schedulePromise=function(n,i){return e.innerFrom(n).pipe(r.subscribeOn(i),t.observeOn(i))},Xlt}(),r=function(){if(qlt)return Ylt;qlt=1,Object.defineProperty(Ylt,"__esModule",{value:!0}),Ylt.scheduleArray=void 0;var e=Aut();return Ylt.scheduleArray=function(t,r){return new e.Observable(function(e){var n=0;return r.schedule(function(){n===t.length?e.complete():(e.next(t[n++]),e.closed||this.schedule())})})},Ylt}(),n=Zlt(),i=edt(),a=vlt(),o=plt(),s=dlt(),u=Mlt(),c=_lt(),l=wlt(),d=Olt(),f=function(){if(tdt)return adt;tdt=1,Object.defineProperty(adt,"__esModule",{value:!0}),adt.scheduleReadableStreamLike=void 0;var e=edt(),t=Olt();return adt.scheduleReadableStreamLike=function(r,n){return e.scheduleAsyncIterable(t.readableStreamLikeToAsyncGenerator(r),n)},adt}();return slt.scheduled=function(h,p){if(null!=h){if(a.isInteropObservable(h))return e.scheduleObservable(h,p);if(s.isArrayLike(h))return r.scheduleArray(h,p);if(o.isPromise(h))return t.schedulePromise(h,p);if(c.isAsyncIterable(h))return i.scheduleAsyncIterable(h,p);if(u.isIterable(h))return n.scheduleIterable(h,p);if(d.isReadableStreamLike(h))return f.scheduleReadableStreamLike(h,p)}throw l.createInvalidObservableTypeError(h)},slt}function sdt(){if(ndt)return olt;ndt=1,Object.defineProperty(olt,"__esModule",{value:!0}),olt.from=void 0;var e=odt(),t=Rlt();return olt.from=function(r,n){return n?e.scheduled(r,n):t.innerFrom(r)},olt}function udt(){if(idt)return elt;idt=1,Object.defineProperty(elt,"__esModule",{value:!0}),elt.of=void 0;var e=ilt(),t=sdt();return elt.of=function(){var r=[...arguments],n=e.popScheduler(r);return t.from(r,n)},elt}var cdt,ldt,ddt={};function fdt(){if(cdt)return ddt;cdt=1,Object.defineProperty(ddt,"__esModule",{value:!0}),ddt.throwError=void 0;var e=Aut(),t=Nst();return ddt.throwError=function(r,n){var i=t.isFunction(r)?r:function(){return r},a=function(e){return e.error(i())};return new e.Observable(n?function(e){return n.schedule(a,0,e)}:a)},ddt}function hdt(){return ldt||(ldt=1,function(e){Object.defineProperty(e,"__esMo
646dule",{value:!0}),e.observeNotification=e.Notification=e.NotificationKind=void 0;var t,r=Zct(),n=udt(),i=fdt(),a=Nst();(t=e.NotificationKind||={}).NEXT="N",t.ERROR="E",t.COMPLETE="C";var o=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){return s(this,e)},e.prototype.do=function(e,t,r){var n=this,i=n.kind,a=n.value,o=n.error;return"N"===i?e?.(a):"E"===i?t?.(o):r?.()},e.prototype.accept=function(e,t,r){return a.isFunction(e?.next)?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){var e=this,t=e.kind,a=e.value,o=e.error,s="N"===t?n.of(a):"E"===t?i.throwError(function(){return o}):"C"===t?r.EMPTY:0;if(!s)throw TypeError("Unexpected notification kind "+t);return s},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function s(e,t){var r,n,i,a=e,o=a.kind,s=a.value,u=a.error;if("string"!=typeof o)throw TypeError('Invalid notification, missing "kind"');"N"===o?null==(r=t.next)||r.call(t,s):"E"===o?null==(n=t.error)||n.call(t,u):null==(i=t.complete)||i.call(t)}e.Notification=o,e.observeNotification=s}(Yct)),Yct}var pdt,mdt,gdt,vdt={},ydt={},bdt={};function _dt(){return mdt||(mdt=1,Object.defineProperty(bdt,"__esModule",{value:!0}),bdt.EmptyError=void 0,bdt.EmptyError=zst().createErrorClass(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),bdt}var xdt,Sdt,wdt={},Adt={};function Cdt(){return Sdt||(Sdt=1,Object.defineProperty(Adt,"__esModule",{value:!0}),Adt.ArgumentOutOfRangeError=void 0,Adt.ArgumentOutOfRangeError=zst().createErrorClass(function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Adt}var Tdt,Pdt={};function Edt(){return Tdt||(Tdt=1,Object.defineProperty(Pdt,"__esModule",{value:!0}),Pdt.NotFoundError=void 0,Pdt.NotFoundError=zst().createErrorClass(function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Pdt}var Mdt,kdt={};function Idt(){return Mdt||(Mdt=1,Object.defineProperty(kdt,"__esModule",{value:!0}),kdt.SequenceError=void 0,kdt.SequenceError=zst().createErrorClass(function(e){return function(t){e(this),this.name="SequenceError",this.message=t}})),kdt}var Ddt,Odt,Rdt={},Bdt={};function Ndt(){return Ddt||(Ddt=1,Object.defineProperty(Bdt,"__esModule",{value:!0}),Bdt.isValidDate=void 0,Bdt.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}),Bdt}function Fdt(){return Odt||(Odt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeout=e.TimeoutError=void 0;var t=Oct(),r=Ndt(),n=Mut(),i=Rlt(),a=zst(),o=Rut(),s=$lt();function u(t){throw new e.TimeoutError(t)}e.TimeoutError=a.createErrorClass(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}),e.timeout=function(e,a){var c=r.isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,l=c.first,d=c.each,f=c.with,h=void 0===f?u:f,p=c.scheduler,m=void 0===p?a??t.asyncScheduler:p,g=c.meta,v=void 0===g?null:g;if(null==l&&null==d)throw TypeError("No timeout provided.");return n.operate(function(e,t){var r,n,a=null,u=0,c=function(e){n=s.executeSchedule(t,m,function(){try{r.unsubscribe(),i.innerFrom(h({meta:v,lastValue:a,seen:u})).subscribe(t)}catch(e){t.error(e)}},e)};r=e.subscribe(o.createOperatorSubscriber(t,function(e){n?.unsubscribe(),u++,t.next(a=e),d>0&&c(d)},void 0,void 0,function(){null!=n&&n.closed||null==n||n.unsubscribe(),a=null})),!u&&c(null==l?d:"number"==typeof l?l:+l-m.now())})}}(Rdt)),Rdt}var Ldt,$dt,Udt,jdt,zdt={},Gdt={},Vdt={},Hdt={};function qdt(){if(Ldt)return Hdt;Ldt=1,Object.defineProperty(Hdt,"__esModule",{value:!0}),Hdt.map=void 0;var e=Mut(),t=Rut();return Hdt.map=function(r,n){return e.operate(function(e,i){var a=0;e.subscribe(t.createOperatorSubscriber(i,function(e){i.next(r.call(n,e,a++))}))})},Hdt}function Wdt(){if($dt)return Vdt;$dt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty(Vdt,"__esModule",{value:!0}),Vdt.mapOneOrManyArgs=void 0;var r=qdt(),n=Array.isArray;return Vdt.mapOneOrManyArgs=function(i){return r.map(function(r){return function(r,i){return n(i)?r.apply(void 0,t([],e(i))):r(i)}(i,r)})},Vdt}function Xdt(){if(Udt)return Gdt;Udt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Gdt,"__esModule",{value:!0}),Gdt.bindCallbackInternals=void 0;var r=nlt(),n=Aut(),i=Vlt(),a=Wdt(),o=Ult(),s=sct();return Gdt.bindCallbackInternals=function u(c,l,d,f){if(d){if(!r.isScheduler(d))return function(){var e=[...arguments];return u(c,l,f).apply(this,e).pipe(a.mapOneOrManyArgs(d))};f=d}return f?function(){var e=[...arguments];return u(c,l).apply(this,e).pipe(i.subscribeOn(f),o.observeOn(f))}:function(){for(var r=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=new s.AsyncSubject,u=!0;return new n.Observable(function(n){var a=o.subscribe(n);if(u){u=!1;var s=!1,d=!1;l.apply(r,t(t([],e(i)),[function(){var e=[...arguments];if(c){var t=e.shift();if(null!=t)return void o.error(t)}o.next(1<e.length?e:e[0]),d=!0,s&&o.complete()}])),d&&o.complete(),s=!0}return a})}},Gdt}var Ydt,Kdt,Zdt={},Qdt={},Jdt={};function eft(){if(Kdt)return Jdt;Kdt=1,Object.defineProperty(Jdt,"__esModule",{value:!0}),Jdt.argsArgArrayOrObject=void 0;var e=Array.isArray,t=Object.getPrototypeOf,r=Object.prototype,n=Object.keys;return Jdt.argsArgArrayOrObject=function(i){if(1===i.length){var a=i[0];if(e(a))return{args:a,keys:null};if((s=a)&&"object"==typeof s&&t(s)===r){var o=n(a);return{args:o.map(function(e){return a[e]}),keys:o}}}var s;return{args:i,keys:null}},Jdt}var tft,rft,nft={};function ift(){return tft||(tft=1,Object.defineProperty(nft,"__esModule",{value:!0}),nft.createObject=void 0,nft.createObject=function(e,t){return e.reduce(function(e,r,n){return e[r]=t[n],e},{})}),nft}function aft(){if(rft)return Qdt;rft=1,Object.defineProperty(Qdt,"__esModule",{value:!0}),Qdt.combineLatestInit=Qdt.combineLatest=void 0;var e=Aut(),t=eft(),r=sdt(),n=Sut(),i=Wdt(),a=ilt(),o=ift(),s=Rut(),u=$lt();function c(e,t,i){return void 0===i&&(i=n.identity),function(n){l(t,function(){for(var a=e.length,o=Array(a),u=a,c=a,d=function(a){l(t,function(){var l=r.from(e[a],t),d=!1;l.subscribe(s.createOperatorSubscriber(n,function(e){o[a]=e,d||(d=!0,c--),c||n.next(i(o.slice()))},function(){--u||n.complete()}))},n)},f=0;f<a;f++)d(f)},n)}}function l(e,t,r){e?u.executeSchedule(r,e,t):t()}return Qdt.combineLatest=function(){var s=[...arguments],u=a.popScheduler(s),l=a.popResultSelector(s),d=t.argsArgArrayOrObject(s),f=d.args,h=d.keys;if(0===f.length)return r.from([],u);var p=new e.Observable(c(f,u,h?function(e){return o.createObject(h,e)}:n.identity));return l?p.pipe(i.mapOneOrManyArgs(l)):p},Qdt.combineLatestInit=c,Qdt}var oft,sft,uft,cft,lft,dft={},fft={},hft={},pft={},mft={};function gft(){if(oft)return mft;oft=1,Object.defineProperty(mft,"__esModule",{value:!0}),mft.mergeInternals=void 0;var e=Rlt(),t=$lt(),r=Rut();return mft.mergeInternals=function(n,i,a,o,s,u,c,l){var d=[],f=0,h=0,p=!1,m=function(){!p||d.length||f||i.complete()},g=function(e){return f<o?v(e):d.push(e)},v=function(n){u&&i.next(n),f++;var l=!1;e.innerFrom(a(n,h++)).subscribe(r.createOperatorSubscriber(i,function(e){s?.(e),u?g(e):i.next(e)},function(){l=!0},void 0,function(){if(l)try{f--;for(var e=function(){var e=d.shift();c?t.executeSchedule(i,c,function(){return v(e)}):v(e)};d.length&&f<o;)e();m()}catch(e){i.error(e)}}))};return n.subscribe(r.createOperatorSubscriber(i,g,function(){p=!0,m()})),function(){l?.()}},mft}function vft(){if(sft)return pft;sft=1,Object.defineProperty(pft,"__esModule",{value:!0}),pft.mergeMap=void 0;var e=qdt(),t=Rlt(),r=Mut(),n=gft(),i=Nst();return pft.mergeMap=function a(o,s,u){return void 0===u&&(u=1/0),i.isFunction(s)?a(function(r,n){return e.map(function(e,t){return s(r,e,n,t)}
646)(t.innerFrom(o(r,n)))},u):("number"==typeof s&&(u=s),r.operate(function(e,t){return n.mergeInternals(e,t,o,u)}))},pft}function yft(){if(uft)return hft;uft=1,Object.defineProperty(hft,"__esModule",{value:!0}),hft.mergeAll=void 0;var e=vft(),t=Sut();return hft.mergeAll=function(r){return void 0===r&&(r=1/0),e.mergeMap(t.identity,r)},hft}function bft(){if(cft)return fft;cft=1,Object.defineProperty(fft,"__esModule",{value:!0}),fft.concatAll=void 0;var e=yft();return fft.concatAll=function(){return e.mergeAll(1)},fft}function _ft(){if(lft)return dft;lft=1,Object.defineProperty(dft,"__esModule",{value:!0}),dft.concat=void 0;var e=bft(),t=ilt(),r=sdt();return dft.concat=function(){var n=[...arguments];return e.concatAll()(r.from(n,t.popScheduler(n)))},dft}var xft,Sft,wft={},Aft={};function Cft(){if(xft)return Aft;xft=1,Object.defineProperty(Aft,"__esModule",{value:!0}),Aft.defer=void 0;var e=Aut(),t=Rlt();return Aft.defer=function(r){return new e.Observable(function(e){t.innerFrom(r()).subscribe(e)})},Aft}var Tft,Pft,Eft,Mft,kft,Ift,Dft,Oft={},Rft={},Bft={},Nft={},Fft={},Lft={},$ft={};function Uft(){if(Ift)return $ft;Ift=1,Object.defineProperty($ft,"__esModule",{value:!0}),$ft.timer=void 0;var e=Aut(),t=Oct(),r=nlt(),n=Ndt();return $ft.timer=function(i,a,o){void 0===i&&(i=0),void 0===o&&(o=t.async);var s=-1;return null!=a&&(r.isScheduler(a)?o=a:s=a),new e.Observable(function(e){var t=n.isValidDate(i)?+i-o.now():i;t<0&&(t=0);var r=0;return o.schedule(function(){e.closed||(e.next(r++),0<=s?this.schedule(void 0,s):e.complete())},t)})},$ft}function jft(){if(Dft)return Lft;Dft=1,Object.defineProperty(Lft,"__esModule",{value:!0}),Lft.interval=void 0;var e=Oct(),t=Uft();return Lft.interval=function(r,n){return void 0===r&&(r=0),void 0===n&&(n=e.asyncScheduler),r<0&&(r=0),t.timer(r,r,n)},Lft}var zft,Gft,Vft={},Hft={};function qft(){return Gft||(Gft=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.never=e.NEVER=void 0;var t=Aut(),r=out();e.NEVER=new t.Observable(r.noop),e.never=function(){return e.NEVER}}(Hft)),Hft}var Wft,Xft,Yft={},Kft={};function Zft(){if(Wft)return Kft;Wft=1,Object.defineProperty(Kft,"__esModule",{value:!0}),Kft.argsOrArgArray=void 0;var e=Array.isArray;return Kft.argsOrArgArray=function(t){return 1===t.length&&e(t[0])?t[0]:t},Kft}function Qft(){if(Xft)return Yft;Xft=1,Object.defineProperty(Yft,"__esModule",{value:!0}),Yft.onErrorResumeNext=void 0;var e=Aut(),t=Zft(),r=Rut(),n=out(),i=Rlt();return Yft.onErrorResumeNext=function(){var a=[...arguments],o=t.argsOrArgArray(a);return new e.Observable(function(e){var t=0,a=function(){if(t<o.length){var s=void 0;try{s=i.innerFrom(o[t++])}catch{return void a()}var u=new r.OperatorSubscriber(e,void 0,n.noop,n.noop);s.subscribe(u),u.add(a)}else e.complete()};a()})},Yft}var Jft,eht,tht,rht,nht={},iht={},aht={},oht={};function sht(){if(tht)return oht;
646tht=1,Object.defineProperty(oht,"__esModule",{value:!0}),oht.filter=void 0;var e=Mut(),t=Rut();return oht.filter=function(r,n){return e.operate(function(e,i){var a=0;e.subscribe(t.createOperatorSubscriber(i,function(e){return r.call(n,e,a++)&&i.next(e)}))})},oht}var uht,cht={};function lht(){if(uht)return cht;uht=1,Object.defineProperty(cht,"__esModule",{value:!0}),cht.raceInit=cht.race=void 0;var e=Aut(),t=Rlt(),r=Zft(),n=Rut();function i(e){return function(r){for(var i=[],a=function(a){i.push(t.innerFrom(e[a]).subscribe(n.createOperatorSubscriber(r,function(e){if(i){for(var t=0;t<i.length;t++)t!==a&&i[t].unsubscribe();i=null}r.next(e)})))},o=0;i&&!r.closed&&o<e.length;o++)a(o)}}return cht.race=function(){var n=[...arguments];return 1===(n=r.argsOrArgArray(n)).length?t.innerFrom(n[0]):new e.Observable(i(n))},cht.raceInit=i,cht}var dht,fht,hht,pht={},mht={},ght={};function vht(){if(hht)return ght;hht=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ght,"__esModule",{value:!0}),ght.zip=void 0;var r=Aut(),n=Rlt(),i=Zft(),a=Zct(),o=Rut(),s=ilt();return ght.zip=function(){var u=[...arguments],c=s.popResultSelector(u),l=i.argsOrArgArray(u);return l.length?new r.Observable(function(r){var i=l.map(function(){return[]}),a=l.map(function(){return!1});r.add(function(){i=a=null});for(var s=function(s){n.innerFrom(l[s]).subscribe(o.createOperatorSubscriber(r,function(n){if(i[s].push(n),i.every(function(e){return e.length})){var o=i.map(function(e){return e.shift()});r.next(c?c.apply(void 0,t([],e(o))):o),i.some(function(e,t){return!e.length&&a[t]})&&r.complete()}},function(){a[s]=!0,!i[s].length&&r.complete()}))},u=0;!r.closed&&u<l.length;u++)s(u);return function(){i=a=null}}):a.EMPTY},ght}var yht,bht,_ht={},xht={};function Sht(){if(bht)return xht;
646bht=1,Object.defineProperty(xht,"__esModule",{value:!0}),xht.audit=void 0;var e=Mut(),t=Rlt(),r=Rut();return xht.audit=function(n){return e.operate(function(e,i){var a=!1,o=null,s=null,u=!1,c=function(){if(s?.unsubscribe(),s=null,a){a=!1;var e=o;o=null,i.next(e)}u&&i.complete()},l=function(){s=null,u&&i.complete()};e.subscribe(r.createOperatorSubscriber(i,function(e){a=!0,o=e,s||t.innerFrom(n(e)).subscribe(s=r.createOperatorSubscriber(i,c,l))},function(){u=!0,(!a||!s||s.closed)&&i.complete()}))})},xht}var wht,Aht,Cht,Tht,Pht,Eht,Mht,kht,Iht,Dht,Oht,Rht,Bht,Nht={},Fht={},Lht={},$ht={},Uht={},jht={},zht={},Ght={},Vht={},Hht={},qht={},Wht={},Xht={};function Yht(){if(kht)return Xht;kht=1,Object.defineProperty(Xht,"__esModule",{value:!0}),Xht.scanInternals=void 0;var e=Rut();return Xht.scanInternals=function(t,r,n,i,a){return function(o,s){var u=n,c=r,l=0;o.subscribe(e.createOperatorSubscriber(s,function(e){var r=l++;c=u?t(c,e,r):(u=!0,e),i&&s.next(c)},a&&function(){u&&s.next(c),s.complete()}))}},Xht}function Kht(){if(Iht)return Wht;Iht=1,Object.defineProperty(Wht,"__esModule",{value:!0}),Wht.reduce=void 0;var e=Yht(),t=Mut();return Wht.reduce=function(r,n){return t.operate(e.scanInternals(r,n,arguments.length>=2,!1,!0))},Wht}function Zht(){if(Dht)return qht;Dht=1,Object.defineProperty(qht,"__esModule",{value:!0}),qht.toArray=void 0;var e=Kht(),t=Mut(),r=function(e,t){return e.push(t),e};return qht.toArray=function(){return t.operate(function(t,n){e.reduce(r,[])(t).subscribe(n)})},qht}function Qht(){if(Oht)return Hht;Oht=1,Object.defineProperty(Hht,"__esModule",{value:!0}),Hht.joinAllInternals=void 0;var e=Sut(),t=Wdt(),r=wut(),n=vft(),i=Zht();return Hht.joinAllInternals=function(a,o){return r.pipe(i.toArray(),n.mergeMap(function(e){return a(e)}),o?t.mapOneOrManyArgs(o):e.identity)},Hht}function Jht(){if(Rht)return Vht;Rht=1,Object.defineProperty(Vht,"__esModule",{value:!0}),Vht.combineLatestAll=void 0;var e=aft(),t=Qht();return Vht.combineLatestAll=function(r){return t.joinAllInternals(e.combineLatest,r)},Vht}var ept,tpt,rpt,npt={},ipt={},apt={};function opt(){if(rpt)return apt;
646rpt=1,Object.defineProperty(apt,"__esModule",{value:!0}),apt.concatMap=void 0;var e=vft(),t=Nst();return apt.concatMap=function(r,n){return t.isFunction(n)?e.mergeMap(r,n,1):e.mergeMap(r,1)},apt}var spt,upt,cpt,lpt,dpt,fpt={},hpt={},ppt={},mpt={},gpt={};function vpt(){if(dpt)return mpt;dpt=1,Object.defineProperty(mpt,"__esModule",{value:!0}),mpt.connect=void 0;var e=Yut(),t=Rlt(),r=Mut(),n=function(){if(lpt)return gpt;lpt=1,Object.defineProperty(gpt,"__esModule",{value:!0}),gpt.fromSubscribable=void 0;var e=Aut();return gpt.fromSubscribable=function(t){return new e.Observable(function(e){return t.subscribe(e)})},gpt}(),i={connector:function(){return new e.Subject}};return mpt.connect=function(e,a){void 0===a&&(a=i);var o=a.connector;return r.operate(function(r,i){var a=o();t.innerFrom(e(n.fromSubscribable(a))).subscribe(i),i.add(r.subscribe(a))})},mpt}var ypt,bpt,_pt,xpt,Spt={},wpt={},Apt={},Cpt={};function Tpt(){if(xpt)return Cpt;xpt=1,Object.defineProperty(Cpt,"__esModule",{value:!0}),Cpt.defaultIfEmpty=void 0;var e=Mut(),t=Rut();return Cpt.defaultIfEmpty=function(r){return e.operate(function(e,n){var i=!1;e.subscribe(t.createOperatorSubscriber(n,function(e){i=!0,n.next(e)},function(){i||n.next(r),n.complete()}))})},Cpt}var Ppt,Ept={},Mpt={},kpt={};function Ipt(){if(Ppt)return kpt;Ppt=1,Object.defineProperty(kpt,"__esModule",{value:!0}),kpt.take=void 0;var e=Zct(),t=Mut(),r=Rut();return kpt.take=function(n){return n<=0?function(){return e.EMPTY}:t.operate(function(e,t){var i=0;e.subscribe(r.createOperatorSubscriber(t,function(e){++i<=n&&(t.next(e),n<=i&&t.complete())}))})},kpt}var Dpt,Opt={};function Rpt(){if(Dpt)return Opt;Dpt=1,Object.defineProperty(Opt,"__esModule",{value:!0}),Opt.ignoreElements=void 0;var e=Mut(),t=Rut(),r=out();return Opt.ignoreElements=function(){return e.operate(function(e,n){e.subscribe(t.createOperatorSubscriber(n,r.noop))})},Opt}var Bpt,Npt,Fpt,Lpt={};function $pt(){if(Bpt)return Lpt;Bpt=1,Object.defineProperty(Lpt,"__esModule",{value:!0}),Lpt.mapTo=void 0;var e=qdt();return Lpt.mapTo=function(t){return e.map(function(){return t})},Lpt}function Upt(){if(Npt)return Mpt;
646Npt=1,Object.defineProperty(Mpt,"__esModule",{value:!0}),Mpt.delayWhen=void 0;var e=_ft(),t=Ipt(),r=Rpt(),n=$pt(),i=vft(),a=Rlt();return Mpt.delayWhen=function o(s,u){return u?function(n){return e.concat(u.pipe(t.take(1),r.ignoreElements()),n.pipe(o(s)))}:i.mergeMap(function(e,r){return a.innerFrom(s(e,r)).pipe(t.take(1),n.mapTo(e))})},Mpt}var jpt,zpt,Gpt,Vpt={},Hpt={},qpt={};function Wpt(){if(Gpt)return qpt;Gpt=1,Object.defineProperty(qpt,"__esModule",{value:!0}),qpt.distinctUntilChanged=void 0;var e=Sut(),t=Mut(),r=Rut();function n(e,t){return e===t}return qpt.distinctUntilChanged=function(i,a){return void 0===a&&(a=e.identity),i??=n,t.operate(function(e,t){var n,o=!0;e.subscribe(r.createOperatorSubscriber(t,function(e){var r=a(e);!o&&i(n,r)||(o=!1,n=r,t.next(e))}))})},qpt}var Xpt,Ypt,Kpt,Zpt={},Qpt={},Jpt={};function emt(){if(Ypt)return Jpt;Ypt=1,Object.defineProperty(Jpt,"__esModule",{value:!0}),Jpt.throwIfEmpty=void 0;var e=_dt(),t=Mut(),r=Rut();function n(){return new e.EmptyError}return Jpt.throwIfEmpty=function(e){return void 0===e&&(e=n),t.operate(function(t,n){var i=!1;t.subscribe(r.createOperatorSubscriber(n,function(e){i=!0,n.next(e)},function(){return i?n.complete():n.error(e())}))})},Jpt}var tmt,rmt,nmt,imt,amt,omt={},smt={},umt={},cmt={},lmt={};function dmt(){if(nmt)return lmt;nmt=1,Object.defineProperty(lmt,"__esModule",{value:!0}),lmt.exhaustMap=void 0;var e=qdt(),t=Rlt(),r=Mut(),n=Rut();return lmt.exhaustMap=function i(a,o){return o?function(r){return r.pipe(i(function(r,n){return t.innerFrom(a(r,n)).pipe(e.map(function(e,t){return o(r,e,n,t)}))}))}:r.operate(function(e,r){var i=0,o=null,s=!1;e.subscribe(n.createOperatorSubscriber(r,function(e){o||(o=n.createOperatorSubscriber(r,void 0,function(){o=null,s&&r.complete()}),t.innerFrom(a(e,i++)).subscribe(o))},function(){s=!0,!o&&r.complete()}))})},lmt}function fmt(){if(imt)return cmt;imt=1,Object.defineProperty(cmt,"__esModule",{value:!0}),cmt.exhaustAll=void 0;var e=dmt(),t=Sut();return cmt.exhaustAll=function(){return e.exhaustMap(t.identity)},cmt}var hmt,pmt,mmt,gmt={},vmt={},ymt={};function bmt(){if(mmt)return ymt;mmt=1,Object.defineProperty(ymt,"__esModule",{value:!0}),ymt.createFind=ymt.find=void 0;var e=Mut(),t=Rut();function r(e,r,n){var i="index"===n;return function(n,a){var o=0;n.subscribe(t.createOperatorSubscriber(a,function(t){var s=o++;e.call(r,t,s,n)&&(a.next(i?s:t),a.complete())},function(){a.next(i?-1:void 0),a.complete()}))}}return ymt.find=function(t,n){return e.operate(r(t,n,"value"))},ymt.createFind=r,ymt}var _mt,xmt,Smt,wmt,Amt,Cmt,Tmt={},Pmt={},Emt={},Mmt={},kmt={},Imt={};function Dmt(){if(Amt)return Imt;Amt=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Imt,"__esModule",{value:!0}),Imt.takeLast=void 0;var t=Zct(),r=Mut(),n=Rut();return Imt.takeLast=function(i){return i<=0?function(){return t.EMPTY}:r.operate(function(t,r){var a=[];t.subscribe(n.createOperatorSubscriber(r,function(e){a.push(e),i<a.length&&a.shift()},function(){var t,n;try{for(var i=e(a),o=i.next();!o.done;o=i.next()){var s=o.value;r.next(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}r.complete()},void 0,function(){a=null}))})},Imt}var Omt,Rmt,Bmt,Nmt,Fmt,Lmt,$mt,Umt,jmt,zmt={},Gmt={},Vmt={},Hmt={},qmt={},Wmt={},Xmt={},Ymt={},Kmt={};function Zmt(){if(jmt)return Kmt;jmt=1,Object.defineProperty(Kmt,"__esModule",{value:!0}),Kmt.multicast=void 0;var e=Nut(),t=Nst(),r=vpt();return Kmt.multicast=function(n,i){var a=t.isFunction(n)?n:function(){return n};return t.isFunction(i)?r.connect(i,{connector:a}):function(t){return new e.ConnectableObservable(t,a)}},Kmt}var Qmt,Jmt,egt,tgt,rgt,ngt,igt,agt,ogt,sgt,ugt,cgt,lgt,dgt={},fgt={},hgt={},pgt={},mgt={},ggt={},vgt={},ygt={},bgt={},_gt={},xgt={},Sgt={},wgt={};function Agt(){if(lgt)return wgt;
646lgt=1,Object.defineProperty(wgt,"__esModule",{value:!0}),wgt.sample=void 0;var e=Rlt(),t=Mut(),r=out(),n=Rut();return wgt.sample=function(i){return t.operate(function(t,a){var o=!1,s=null;t.subscribe(n.createOperatorSubscriber(a,function(e){o=!0,s=e})),e.innerFrom(i).subscribe(n.createOperatorSubscriber(a,function(){if(o){o=!1;var e=s;s=null,a.next(e)}},r.noop))})},wgt}var Cgt,Tgt,Pgt,Egt,Mgt={},kgt={},Igt={},Dgt={};function Ogt(){if(Egt)return Dgt;Egt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Dgt,"__esModule",{value:!0}),Dgt.share=void 0;var r=Rlt(),n=Yut(),i=hut(),a=Mut();function o(n,a){var o=[...arguments].slice(2);if(!0!==a){if(!1!==a){var s=new i.SafeSubscriber({next:function(){s.unsubscribe(),n()}});return r.innerFrom(a.apply(void 0,t([],e(o)))).subscribe(s)}}else n()}return Dgt.share=function(e){void 0===e&&(e={});var t=e.connector,s=void 0===t?function(){return new n.Subject}:t,u=e.resetOnError,c=void 0===u||u,l=e.resetOnComplete,d=void 0===l||l,f=e.resetOnRefCountZero,h=void 0===f||f;return function(e){var t,n,u,l=0,f=!1,p=!1,m=function(){n?.unsubscribe(),n=void 0},g=function(){m(),t=u=void 0,f=p=!1},v=function(){var e=t;g(),e?.unsubscribe()};return a.operate(function(e,a){l++,p||f||m();var y=u??=s();a.add(function(){0!==--l||p||f||(n=o(v,h))}),y.subscribe(a),!t&&l>0&&(t=new i.SafeSubscriber({next:function(e){return y.next(e)},error:function(e){p=!0,m(),n=o(g,c,e),y.error(e)},complete:function(){f=!0,m(),n=o(g,d),y.complete()}}),r.innerFrom(e).subscribe(t))})(e)}},Dgt}var Rgt,Bgt,Ngt,Fgt,Lgt,$gt,Ugt,jgt,zgt,Ggt={},Vgt={},Hgt={},qgt={},Wgt={},Xgt={},Ygt={},Kgt={},Zgt={};function Qgt(){if(jgt)return Zgt;jgt=1,Object.defineProperty(Zgt,"__esModule",{value:!0}),Zgt.switchMap=void 0;var e=Rlt(),t=Mut(),r=Rut();return Zgt.switchMap=function(n,i){return t.operate(function(t,a){var o=null,s=0,u=!1,c=function(){return u&&!o&&a.complete()};t.subscribe(r.createOperatorSubscriber(a,function(t){o?.unsubscribe();var u=0,l=s++;e.innerFrom(n(t,l)).subscribe(o=r.createOperatorSubscriber(a,function(e){return a.next(i?i(t,e,l,u++):e)},function(){o=null,c()}))},function(){u=!0,c()}))})},Zgt}var Jgt,evt,tvt,rvt,nvt,ivt,avt={},ovt={},svt={},uvt={},cvt={},lvt={};function dvt(){if(ivt)return lvt;ivt=1,Object.defineProperty(lvt,"__esModule",{value:!0}),lvt.throttle=void 0;var e=Mut(),t=Rut(),r=Rlt();return lvt.throttle=function(n,i){return e.operate(function(e,a){var o=i??{},s=o.leading,u=void 0===s||s,c=o.trailing,l=void 0!==c&&c,d=!1,f=null,h=null,p=!1,m=function(){h?.unsubscribe(),h=null,l&&(y(),p&&a.complete())},g=function(){h=null,p&&a.complete()},v=function(e){return h=r.innerFrom(n(e)).subscribe(t.createOperatorSubscriber(a,m,g))},y=function(){if(d){d=!1;var e=f;f=null,a.next(e),!p&&v(e)}};e.subscribe(t.createOperatorSubscriber(a,function(e){d=!0,f=e,(!h||h.closed)&&(u?y():v(e))},function(){p=!0,(!(l&&d&&h)||h.closed)&&a.complete()}))})},lvt}var fvt,hvt,pvt,mvt,gvt,vvt,yvt,bvt,_vt,xvt,Svt,wvt,Avt,Cvt,Tvt,Pvt,Evt={},Mvt={},kvt={},Ivt={},Dvt={},Ovt={},Rvt={},Bvt={},Nvt={},Fvt={},Lvt={},$vt={},Uvt={};function jvt(){return Cvt||(Cvt=1,function(e){var t=Pot&&Pot.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Pot&&Pot.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.interval=e.iif=e.generate=e.fromEventPattern=e.fromEvent=e.from=e.forkJoin=e.empty=e.defer=e.connectable=e.concat=e.combineLatest=e.bindNodeCallback=e.bindCallback=e.UnsubscriptionError=e.TimeoutError=e.SequenceError=e.ObjectUnsubscribedError=e.NotFoundError=e.EmptyError=e.ArgumentOutOfRangeError=e.firstValueFrom=e.lastValueFrom=e.isObservable=e.identity=e.noop=e.pipe=e.NotificationKind=e.Notification=e.Subscriber=e.Subscription=e.Scheduler
646=e.VirtualAction=e.VirtualTimeScheduler=e.animationFrameScheduler=e.animationFrame=e.queueScheduler=e.queue=e.asyncScheduler=e.async=e.asapScheduler=e.asap=e.AsyncSubject=e.ReplaySubject=e.BehaviorSubject=e.Subject=e.animationFrames=e.observable=e.ConnectableObservable=e.Observable=void 0,e.filter=e.expand=e.exhaustMap=e.exhaustAll=e.exhaust=e.every=e.endWith=e.elementAt=e.distinctUntilKeyChanged=e.distinctUntilChanged=e.distinct=e.dematerialize=e.delayWhen=e.delay=e.defaultIfEmpty=e.debounceTime=e.debounce=e.count=e.connect=e.concatWith=e.concatMapTo=e.concatMap=e.concatAll=e.combineLatestWith=e.combineLatestAll=e.combineAll=e.catchError=e.bufferWhen=e.bufferToggle=e.bufferTime=e.bufferCount=e.buffer=e.auditTime=e.audit=e.config=e.NEVER=e.EMPTY=e.scheduled=e.zip=e.using=e.timer=e.throwError=e.range=e.race=e.partition=e.pairs=e.onErrorResumeNext=e.of=e.never=e.merge=void 0,e.switchMap=e.switchAll=e.subscribeOn=e.startWith=e.skipWhile=e.skipUntil=e.skipLast=e.skip=e.single=e.shareReplay=e.share=e.sequenceEqual=e.scan=e.sampleTime=e.sample=e.refCount=e.retryWhen=e.retry=e.repeatWhen=e.repeat=e.reduce=e.raceWith=e.publishReplay=e.publishLast=e.publishBehavior=e.publish=e.pluck=e.pairwise=e.onErrorResumeNextWith=e.observeOn=e.multicast=e.min=e.mergeWith=e.mergeScan=e.mergeMapTo=e.mergeMap=e.flatMap=e.mergeAll=e.max=e.materialize=e.mapTo=e.map=e.last=e.isEmpty=e.ignoreElements=e.groupBy=e.first=e.findIndex=e.find=e.finalize=void 0,e.zipWith=e.zipAll=e.withLatestFrom=e.windowWhen=e.windowToggle=e.windowTime=e.windowCount=e.window=e.toArray=e.timestamp=e.timeoutWith=e.timeout=e.timeInterval=e.throwIfEmpty=e.throttleTime=e.throttle=e.tap=e.takeWhile=e.takeUntil=e.takeLast=e.take=e.switchScan=e.switchMapTo=void 0;var n=Aut();Object.defineProperty(e,"Observable",{enumerable:!0,get:function(){return n.Observable}});var i=Nut();Object.defineProperty(e,"ConnectableObservable",{enumerable:!0,get:function(){return i.ConnectableObservable}});var a=gut();Object.defineProperty(e,"observable",{enumerable:!0,get:function(){return a.observable}});var o=function(){if($ut)return Uut;$ut=1,Object.defineProperty(Uut,"__esModule",{value:!0}),Uut.animationFrames=void 0;var e=Aut(),t=(Fut||(Fut=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.performanceTimestampProvider=void 0,e.performanceTimestampProvider={now:function(){return(e.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}}(jut)),jut),r=Gut();function n(n){return new e.Observable(function(e){var i=n||t.performanceTimestampProvider,a=i.now(),o=0,s=function(){e.closed||(o=r.animationFrameProvider.requestAnimationFrame(function(t){o=0;var r=i.now();e.next({timestamp:n?r:t,elapsed:r-a}),s()}))};return s(),function(){o&&r.animationFrameProvider.cancelAnimationFrame(o)}})}Uut.animationFrames=function(e){return e?n(e):i};var i=n();return Uut}();Object.defineProperty(e,"animationFrames",{enumerable:!0,get:function(){return o.animationFrames}});var s=Yut();Object.defineProperty(e,"Subject",{enumerable:!0,get:function(){return s.Subject}});var u=Qut();Object.defineProperty(e,"BehaviorSubject",{enumerable:!0,get:function(){return u.BehaviorSubject}});var c=ict();Object.defineProperty(e,"ReplaySubject",{enumerable:!0,get:function(){return c.ReplaySubject}});var l=sct();Object.defineProperty(e,"AsyncSubject",{enumerable:!0,get:function(){return l.AsyncSubject}});var d=(wct||(wct=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.asap=e.asapScheduler=void 0;var t=function(){if(bct)return fct;bct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(fct,"__esModule",{value:!0}),fct.AsapAction=void 0;var t=gct(),r=(yct||(yct=1,function(e){var t=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},r=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty(e,"__esModule",{value:!0}),e.immediateProvider=void 0;var n=function(){if(vct)return Cct;vct=1,Object.defineProperty(Cct,"__esModule",{value:!0}),Cct.TestTools=Cct.Immediate=void 0;var e,t=1,r={};function n(e){return e in r&&(delete r[e],!0)}return Cct.Immediate={setImmediate:function(i){var a=t++;return r[a]=!0,e||=Promise.resolve(),e.then(function(){return n(a)&&i()}),a},clearImmediate:function(e){n(e)}},Cct.TestTools={pending:function(){return Object.keys(r).length}},Cct}(),i=n.Immediate.setImmediate,a=n.Immediate.clearImmediate;e.immediateProvider={setImmediate:function(){var n=[...arguments];return(e.immediateProvider.delegate?.setImmediate||i).apply(void 0,r([],t(n)))},clearImmediate:function(t){return(e.immediateProvider.delegate?.clearImmediate||a)(t)},delegate:void 0}}(Act)),Act);return fct.AsapAction=function(t){function n(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return e(n,t),n.prototype.requestAsyncId=function(e,n,i){return void 0===i&&(i=0),null!==i&&i>0?t.prototype.requestAsyncId.call(this,e,n,i):(e.actions.push(this),e._scheduled||=r.immediateProvider.setImmediate(e.flush.bind(e,void 0)))},n.prototype.recycleAsyncId=function(e,n,i){if(void 0===i&&(i=0),null==i?this.delay>0:i>0)return t.prototype.recycleAsyncId.call(this,e,n,i);var a=e.actions;null!=n&&a[a.length-1]?.id!==n&&(r.immediateProvider.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))},n}(t.AsyncAction),fct}();e.asapScheduler=new(function(){if(Sct)return Tct;Sct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();
646return Object.defineProperty(Tct,"__esModule",{value:!0}),Tct.AsapScheduler=void 0,Tct.AsapScheduler=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e||=n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},r}(kct().AsyncScheduler),Tct}().AsapScheduler)(t.AsapAction),e.asap=e.asapScheduler}(dct)),dct);Object.defineProperty(e,"asap",{enumerable:!0,get:function(){return d.asap}}),Object.defineProperty(e,"asapScheduler",{enumerable:!0,get:function(){return d.asapScheduler}});var f=Oct();Object.defineProperty(e,"async",{enumerable:!0,get:function(){return f.async}}),Object.defineProperty(e,"asyncScheduler",{enumerable:!0,get:function(){return f.asyncScheduler}});var h=(Nct||(Nct=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.queue=e.queueScheduler=void 0;var t=function(){if(Rct)return Gct;Rct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();return Object.defineProperty(Gct,"__esModule",{value:!0}),Gct.QueueAction=void 0,Gct.QueueAction=function(t){function r(e,r){var n=t.call(this,e,r)||this;
646return n.scheduler=e,n.work=r,n}return e(r,t),r.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},r.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},r.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.flush(this),0)},r}(gct().AsyncAction),Gct}();e.queueScheduler=new(function(){if(Bct)return Vct;Bct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();return Object.defineProperty(Vct,"__esModule",{value:!0}),Vct.QueueScheduler=void 0,Vct.QueueScheduler=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r}(kct().AsyncScheduler),Vct}().QueueScheduler)(t.QueueAction),e.queue=e.queueScheduler}(zct)),zct);Object.defineProperty(e,"queue",{enumerable:!0,get:function(){return h.queue}}),Object.defineProperty(e,"queueScheduler",{enumerable:!0,get:function(){return h.queueScheduler}});var p=($ct||($ct=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrame=e.animationFrameScheduler=void 0;var t=function(){if(Fct)return qct;Fct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(qct,"__esModule",{value:!0}),qct.AnimationFrameAction=void 0;var t=gct(),r=Gut();return qct.AnimationFrameAction=function(t){function n(e,r){var n=t.call(this,e,r)||this;
646return n.scheduler=e,n.work=r,n}return e(n,t),n.prototype.requestAsyncId=function(e,n,i){return void 0===i&&(i=0),null!==i&&i>0?t.prototype.requestAsyncId.call(this,e,n,i):(e.actions.push(this),e._scheduled||=r.animationFrameProvider.requestAnimationFrame(function(){return e.flush(void 0)}))},n.prototype.recycleAsyncId=function(e,n,i){if(void 0===i&&(i=0),null==i?this.delay>0:i>0)return t.prototype.recycleAsyncId.call(this,e,n,i);var a=e.actions;null!=n&&a[a.length-1]?.id!==n&&(r.animationFrameProvider.cancelAnimationFrame(n),e._scheduled=void 0)},n}(t.AsyncAction),qct}();e.animationFrameScheduler=new(function(){if(Lct)return Wct;Lct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();return Object.defineProperty(Wct,"__esModule",{value:!0}),Wct.AnimationFrameScheduler=void 0,Wct.AnimationFrameScheduler=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e||=n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},r}(kct().AsyncScheduler),Wct}().AnimationFrameScheduler)(t.AnimationFrameAction),e.animationFrame=e.animationFrameScheduler}(Hct)),Hct);Object.defineProperty(e,"animationFrame",{enumerable:!0,get:function(){return p.animationFrame}}),Object.defineProperty(e,"animationFrameScheduler",{enumerable:!0,get:function(){return p.animationFrameScheduler}});var m=function(){if(Uct)return Xct;Uct=1;var e=Pot&&Pot.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Xct,"__esModule",{value:!0}
646),Xct.VirtualAction=Xct.VirtualTimeScheduler=void 0;var t=gct(),r=Xst();Xct.VirtualTimeScheduler=function(t){function r(e,r){void 0===e&&(e=n),void 0===r&&(r=1/0);var i=t.call(this,e,function(){return i.frame})||this;return i.maxFrames=r,i.frame=0,i.index=-1,i}return e(r,t),r.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},r.frameTimeFactor=10,r}(kct().AsyncScheduler);var n=function(t){function n(e,r,n){void 0===n&&(n=e.index+=1);var i=t.call(this,e,r)||this;return i.scheduler=e,i.work=r,i.index=n,i.active=!0,i.index=e.index=n,i}return e(n,t),n.prototype.schedule=function(e,i){if(void 0===i&&(i=0),Number.isFinite(i)){if(!this.id)return t.prototype.schedule.call(this,e,i);this.active=!1;var a=new n(this.scheduler,this.work);return this.add(a),a.schedule(e,i)}return r.Subscription.EMPTY},n.prototype.requestAsyncId=function(e,t,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(n.sortActions),1},n.prototype.recycleAsyncId=function(e,t,r){},n.prototype._execute=function(e,r){if(!0===this.active)return t.prototype._execute.call(this,e,r)},n.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>
vendor: 1,484 bytes, line 646
646t.index?1:-1:e.delay>t.delay?1:-1},n}(t.AsyncAction);return Xct.VirtualAction=n,Xct}();Object.defineProperty(e,"VirtualTimeScheduler",{enumerable:!0,get:function(){return m.VirtualTimeScheduler}}),Object.defineProperty(e,"VirtualAction",{enumerable:!0,get:function(){return m.VirtualAction}});var g=Mct();Object.defineProperty(e,"Scheduler",{enumerable:!0,get:function(){return g.Scheduler}});var v=Xst();Object.defineProperty(e,"Subscription",{enumerable:!0,get:function(){return v.Subscription}});var y=hut();Object.defineProperty(e,"Subscriber",{enumerable:!0,get:function(){return y.Subscriber}});var b=hdt();Object.defineProperty(e,"Notification",{enumerable:!0,get:function(){return b.Notification}}),Object.defineProperty(e,"NotificationKind",{enumerable:!0,get:function(){return b.NotificationKind}});var _=wut();Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return _.pipe}});var x=out();Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return x.noop}});var S=Sut();Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return S.identity}});var w=function(){if(pdt)return vdt;pdt=1,Object.defineProperty(vdt,"__esModule",{value:!0}),vdt.isObservable=void 0;var e=Aut(),t=Nst();return vdt.isObservable=function(r){return!!r&&(r instanceof e.Observable||t.isFunction(r.lift)&&t.isFunction(r.subscribe))},vdt}();Object.defineProperty(e,"isObservable",{enumerable:!0,get:function(){return w.isObservable}});var A=function(){if(gdt)return ydt;
646gdt=1,Object.defineProperty(ydt,"__esModule",{value:!0}),ydt.lastValueFrom=void 0;var e=_dt();return ydt.lastValueFrom=function(t,r){var n="object"==typeof r;return new Promise(function(i,a){var o,s=!1;t.subscribe({next:function(e){o=e,s=!0},error:a,complete:function(){s?i(o):n?i(r.defaultValue):a(new e.EmptyError)}})})},ydt}();Object.defineProperty(e,"lastValueFrom",{enumerable:!0,get:function(){return A.lastValueFrom}});var C=function(){if(xdt)return wdt;xdt=1,Object.defineProperty(wdt,"__esModule",{value:!0}),wdt.firstValueFrom=void 0;var e=_dt(),t=hut();return wdt.firstValueFrom=function(r,n){var i="object"==typeof n;return new Promise(function(a,o){var s=new t.SafeSubscriber({next:function(e){a(e),s.unsubscribe()},error:o,complete:function(){i?a(n.defaultValue):o(new e.EmptyError)}});r.subscribe(s)})},wdt}();Object.defineProperty(e,"firstValueFrom",{enumerable:!0,get:function(){return C.firstValueFrom}});var T=Cdt();Object.defineProperty(e,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return T.ArgumentOutOfRangeError}});var P=_dt();Object.defineProperty(e,"EmptyError",{enumerable:!0,get:function(){return P.EmptyError}});var E=Edt();Object.defineProperty(e,"NotFoundError",{enumerable:!0,get:function(){return E.NotFoundError}});var M=Xut();Object.defineProperty(e,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return M.ObjectUnsubscribedError}});var k=Idt();Object.defineProperty(e,"SequenceError",{enumerable:!0,get:function(){return k.SequenceError}});var I=Fdt();Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return I.TimeoutError}});var D=Gst();Object.defineProperty(e,"UnsubscriptionError",{enumerable:!0,get:function(){return D.UnsubscriptionError}});var O=function(){if(jdt)return zdt;jdt=1,Object.defineProperty(zdt,"__esModule",{value:!0}),zdt.bindCallback=void 0;var e=Xdt();return zdt.bindCallback=function(t,r,n){return e.bindCallbackInternals(!1,t,r,n)},zdt}();Object.defineProperty(e,"bindCallback",{enumerable:!0,get:function(){return O.bindCallback}});var R=function(){if(Ydt)return Zdt;Ydt=1,Object.defineProperty(Zdt,"__esModule",{value:!0}),Zdt.bindNodeCallback=void 0;var e=Xdt();return Zdt.bindNodeCallback=function(t,r,n){return e.bindCallbackInternals(!0,t,r,n)},Zdt}();Object.defineProperty(e,"bindNodeCallback",{enumerable:!0,get:function(){return R.bindNodeCallback}});var B=aft();Object.defineProperty(e,"combineLatest",{enumerable:!0,get:function(){return B.combineLatest}});var N=_ft();Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return N.concat}});var F=function(){if(Sft)return wft;Sft=1,Object.defineProperty(wft,"__esModule",{value:!0}),wft.connectable=void 0;var e=Yut(),t=Aut(),r=Cft(),n={connector:function(){return new e.Subject},resetOnDisconnect:!0};return wft.connectable=function(e,i){void 0===i&&(i=n);var a=null,o=i.connector,s=i.resetOnDisconnect,u=void 0===s||s,c=o(),l=new t.Observable(function(e){return c.subscribe(e)});return l.connect=function(){return a&&!a.closed||(a=r.defer(function(){return e}).subscribe(c),u&&a.add(function(){return c=o()})),a},l},wft}();Object.defineProperty(e,"connectable",{enumerable:!0,get:function(){return F.connectable}});var L=Cft();Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return L.defer}});var $=Zct();Object.defineProperty(e,"empty",{enumerable:!0,get:function(){return $.empty}});var U=function(){if(Tft)return Oft;Tft=1,Object.defineProperty(Oft,"__esModule",{value:!0}),Oft.forkJoin=void 0;var e=Aut(),t=eft(),r=Rlt(),n=ilt(),i=Rut(),a=Wdt(),o=ift();return Oft.forkJoin=function(){var s=[...arguments],u=n.popResultSelector(s),c=t.argsArgArrayOrObject(s),l=c.args,d=c.keys,f=new e.Observable(function(e){var t=l.length;if(t)for(var n=Array(t),a=t,s=t,u=function(t){var u=!1;r.innerFrom(l[t]).subscribe(i.createOperatorSubscriber(e,function(e){u||(u=!0,s--),n[t]=e},function(){return a--},void 0,function(){a&&u||(s||e.next(d?o.createObject(d,n):n),e.complete())}))},c=0;c<t;c++)u(c);else e.complete()});return u?f.pipe(a.mapOneOrManyArgs(u)):f},Oft}();Object.defineProperty(e,"forkJoin",{enumerable:!0,get:function(){return U.forkJoin}});var j=sdt();Object.defineProperty(e,"from",{enumerable:!0,get:function(){return j.from}});var z=function(){if(Pft)return Rft;Pft=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};
646Object.defineProperty(Rft,"__esModule",{value:!0}),Rft.fromEvent=void 0;var t=Rlt(),r=Aut(),n=vft(),i=dlt(),a=Nst(),o=Wdt(),s=["addListener","removeListener"],u=["addEventListener","removeEventListener"],c=["on","off"];function l(e,t){return function(r){return function(n){return e[r](t,n)}}}return Rft.fromEvent=function d(f,h,p,m){if(a.isFunction(p)&&(m=p,p=void 0),m)return d(f,h,p).pipe(o.mapOneOrManyArgs(m));var g=e(function(e){return a.isFunction(e.addEventListener)&&a.isFunction(e.removeEventListener)}(f)?u.map(function(e){return function(t){return f[e](h,t,p)}}):function(e){return a.isFunction(e.addListener)&&a.isFunction(e.removeListener)}(f)?s.map(l(f,h)):function(e){return a.isFunction(e.on)&&a.isFunction(e.off)}(f)?c.map(l(f,h)):[],2),v=g[0],y=g[1];if(!v&&i.isArrayLike(f))return n.mergeMap(function(e){return d(e,h,p)})(t.innerFrom(f));if(!v)throw TypeError("Invalid event target");return new r.Observable(function(e){var t=function(){var t=[...arguments];return e.next(1<t.length?t:t[0])};return v(t),function(){return y(t)}})},Rft}();
646Object.defineProperty(e,"fromEvent",{enumerable:!0,get:function(){return z.fromEvent}});var G=function(){if(Eft)return Bft;Eft=1,Object.defineProperty(Bft,"__esModule",{value:!0}),Bft.fromEventPattern=void 0;var e=Aut(),t=Nst(),r=Wdt();return Bft.fromEventPattern=function n(i,a,o){return o?n(i,a).pipe(r.mapOneOrManyArgs(o)):new e.Observable(function(e){var r=function(){var t=[...arguments];return e.next(1===t.length?t[0]:t)},n=i(r);return t.isFunction(a)?function(){return a(r,n)}:void 0})},Bft}();Object.defineProperty(e,"fromEventPattern",{enumerable:!0,get:function(){return G.fromEventPattern}});var V=function(){if(Mft)return Nft;Mft=1;var e=Pot&&Pot.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(Nft,"__esModule",{value:!0}),Nft.generate=void 0;var t=Sut(),r=nlt(),n=Cft(),i=Zlt();return Nft.generate=function(a,o,s,u,c){var l,d,f,h;function p(){var t;return e(this,function(e){switch(e.label){case 0:t=h,e.label=1;case 1:return o&&!o(t)?[3,4]:[4,f(t)];case 2:e.sent(),e.label=3;case 3:return t=s(t),[3,1];case 4:return[2]}})}return 1===arguments.length?(h=(l=a).initialState,o=l.condition,s=l.iterate,d=l.resultSelector,f=void 0===d?t.identity:d,c=l.scheduler):(h=a,!u||r.isScheduler(u)?(f=t.identity,c=u):f=u),n.defer(c?function(){return i.scheduleIterable(p(),c)}:p)},Nft}();Object.defineProperty(e,"generate",{enumerable:!0,get:function(){return V.generate}});var H=function(){if(kft)return Fft;kft=1,Object.defineProperty(Fft,"__esModule",{value:!0}),Fft.iif=void 0;var e=Cft();return Fft.iif=function(t,r,n){return e.defer(function(){return t()?r:n})},Fft}();Object.defineProperty(e,"iif",{enumerable:!0,get:function(){return H.iif}});var q=jft();Object.defineProperty(e,"interval",{enumerable:!0,get:function(){return q.interval}});var W=function(){if(zft)return Vft;zft=1,Object.defineProperty(Vft,"__esModule",{value:!0}),Vft.merge=void 0;var e=yft(),t=Rlt(),r=Zct(),n=ilt(),i=sdt();return Vft.merge=function(){var a=[...arguments],o=n.popScheduler(a),s=n.popNumber(a,1/0),u=a;return u.length?1===u.length?t.innerFrom(u[0]):e.mergeAll(s)(i.from(u,o)):r.EMPTY},Vft}();Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return W.merge}});var X=qft();Object.defineProperty(e,"never",{enumerable:!0,get:function(){return X.never}});var Y=udt();Object.defineProperty(e,"of",{enumerable:!0,get:function(){return Y.of}});var K=Qft();Object.defineProperty(e,"onErrorResumeNext",{enumerable:!0,get:function(){return K.onErrorResumeNext}});var Z=function(){if(Jft)return nht;Jft=1,Object.defineProperty(nht,"__esModule",{value:!0}),nht.pairs=void 0;var e=sdt();return nht.pairs=function(t,r){return e.from(Object.entries(t),r)},nht}();Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return Z.pairs}});var Q=function(){if(rht)return iht;rht=1,Object.defineProperty(iht,"__esModule",{value:!0}),iht.partition=void 0;
646var e=(eht||(eht=1,Object.defineProperty(aht,"__esModule",{value:!0}),aht.not=void 0,aht.not=function(e,t){return function(r,n){return!e.call(t,r,n)}}),aht),t=sht(),r=Rlt();return iht.partition=function(n,i,a){return[t.filter(i,a)(r.innerFrom(n)),t.filter(e.not(i,a))(r.innerFrom(n))]},iht}();Object.defineProperty(e,"partition",{enumerable:!0,get:function(){return Q.partition}});var J=lht();Object.defineProperty(e,"race",{enumerable:!0,get:function(){return J.race}});var ee=function(){if(dht)return pht;dht=1,Object.defineProperty(pht,"__esModule",{value:!0}),pht.range=void 0;var e=Aut(),t=Zct();return pht.range=function(r,n,i){if(n??(n=r,r=0),n<=0)return t.EMPTY;var a=n+r;return new e.Observable(i?function(e){var t=r;return i.schedule(function(){t<a?(e.next(t++),this.schedule()):e.complete()})}:function(e){for(var t=r;t<a&&!e.closed;)e.next(t++);e.complete()})},pht}();Object.defineProperty(e,"range",{enumerable:!0,get:function(){return ee.range}});var te=fdt();Object.defineProperty(e,"throwError",{enumerable:!0,get:function(){return te.throwError}});var re=Uft();Object.defineProperty(e,"timer",{enumerable:!0,get:function(){return re.timer}});var ne=function(){if(fht)return mht;fht=1,Object.defineProperty(mht,"__esModule",{value:!0}),mht.using=void 0;var e=Aut(),t=Rlt(),r=Zct();return mht.using=function(n,i){return new e.Observable(function(e){var a=n(),o=i(a);return(o?t.innerFrom(o):r.EMPTY).subscribe(e),function(){a&&a.unsubscribe()}})},mht}();Object.defineProperty(e,"using",{enumerable:!0,get:function(){return ne.using}});var ie=vht();Object.defineProperty(e,"zip",{enumerable:!0,get:function(){return ie.zip}});var ae=odt();Object.defineProperty(e,"scheduled",{enumerable:!0,get:function(){return ae.scheduled}});var oe=Zct();Object.defineProperty(e,"EMPTY",{enumerable:!0,get:function(){return oe.EMPTY}});var se=qft();Object.defineProperty(e,"NEVER",{enumerable:!0,get:function(){return se.NEVER}}),r((yht||(yht=1,Object.defineProperty(_ht,"__esModule",{value:!0})),_ht),e);var ue=Zst();Object.defineProperty(e,"config",{enumerable:!0,get:function(){return ue.config}});var ce=Sht();Object.defineProperty(e,"audit",{enumerable:!0,get:function(){return ce.audit}});var le=function(){if(wht)return Nht;wht=1,Object.defineProperty(Nht,"__esModule",{value:!0}),Nht.auditTime=void 0;var e=Oct(),t=Sht(),r=Uft();return Nht.auditTime=function(n,i){return void 0===i&&(i=e.asyncScheduler),t.audit(function(){return r.timer(n,i)})},Nht}();Object.defineProperty(e,"auditTime",{enumerable:!0,get:function(){return le.auditTime}});var de=function(){if(Aht)return Fht;Aht=1,Object.defineProperty(Fht,"__esModule",{value:!0}),Fht.buffer=void 0;var e=Mut(),t=out(),r=Rut(),n=Rlt();return Fht.buffer=function(i){return e.operate(function(e,a){var o=[];return e.subscribe(r.createOperatorSubscriber(a,function(e){return o.push(e)},function(){a.next(o),a.complete()})),n.innerFrom(i).subscribe(r.createOperatorSubscriber(a,function(){var e=o;o=[],a.next(e)},t.noop)),function(){o=null}})},Fht}();Object.defineProperty(e,"buffer",{enumerable:!0,get:function(){return de.buffer}});var fe=function(){if(Cht)return Lht;Cht=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Lht,"__esModule",{value:!0}),Lht.bufferCount=void 0;var t=Mut(),r=Rut(),n=Wst();return Lht.bufferCount=function(i,a){return void 0===a&&(a=null),a??=i,t.operate(function(t,o){var s=[],u=0;t.subscribe(r.createOperatorSubscriber(o,function(t){var r,c,l,d,f=null;u++%a==0&&s.push([]);try{for(var h=e(s),p=h.next();!p.done;p=h.next())(v=p.value).push(t),i<=v.length&&(f??=[]).push(v)}catch(e){r={error:e}}finally{try{p&&!p.done&&(c=h.return)&&c.call(h)}finally{if(r)throw r.error}}if(f)try{for(var m=e(f),g=m.next();!g.done;g=m.next()){var v=g.value;n.arrRemove(s,v),o.next(v)}}catch(e){l={error:e}}finally{try{g&&!g.done&&(d=m.return)&&d.call(m)}finally{if(l)throw l.error}}},function(){var t,r;try{for(var n=e(s),i=n.next();!i.done;i=n.next()){var a=i.value;o.next(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}o.complete()},void 0,function(){s=null}))})},Lht}();Object.defineProperty(e,"bufferCount",{enumerable:!0,get:function(){return fe.bufferCount}});var he=function(){if(Tht)return $ht;Tht=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
646if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty($ht,"__esModule",{value:!0}),$ht.bufferTime=void 0;var t=Xst(),r=Mut(),n=Rut(),i=Wst(),a=Oct(),o=ilt(),s=$lt();return $ht.bufferTime=function(u){var c=[...arguments].slice(1),l=o.popScheduler(c)??a.asyncScheduler,d=c[0]??null,f=c[1]||1/0;return r.operate(function(r,a){var o=[],c=!1,h=function(e){var t=e.buffer;e.subs.unsubscribe(),i.arrRemove(o,e),a.next(t),c&&p()},p=function(){if(o){var e=new t.Subscription;a.add(e);var r={buffer:[],subs:e};o.push(r),s.executeSchedule(e,l,function(){return h(r)},u)}};null!==d&&d>=0?s.executeSchedule(a,l,p,d,!0):c=!0,p();var m=n.createOperatorSubscriber(a,function(t){var r,n,i=o.slice();try{for(var a=e(i),s=a.next();!s.done;s=a.next()){var u=s.value,c=u.buffer;c.push(t),f<=c.length&&h(u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},function(){for(;o?.length;)a.next(o.shift().buffer);m?.unsubscribe(),a.complete(),a.unsubscribe()},void 0,function(){return o=null});r.subscribe(m)})},$ht}();Object.defineProperty(e,"bufferTime",{enumerable:!0,get:function(){return he.bufferTime}});var pe=function(){if(Pht)return Uht;Pht=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Uht,"__esModule",{value:!0}),Uht.bufferToggle=void 0;var t=Xst(),r=Mut(),n=Rlt(),i=Rut(),a=out(),o=Wst();return Uht.bufferToggle=function(s,u){return r.operate(function(r,c){var l=[];n.innerFrom(s).subscribe(i.createOperatorSubscriber(c,function(e){var r=[];l.push(r);var s=new t.Subscription;s.add(n.innerFrom(u(e)).subscribe(i.createOperatorSubscriber(c,function(){o.arrRemove(l,r),c.next(r),s.unsubscribe()},a.noop)))},a.noop)),r.subscribe(i.createOperatorSubscriber(c,function(t){var r,n;try{for(var i=e(l),a=i.next();!a.done;a=i.next())a.value.push(t)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},function(){for(;l.length>0;)c.next(l.shift());c.complete()}))})},Uht}();Object.defineProperty(e,"bufferToggle",{enumerable:!0,get:function(){return pe.bufferToggle}});var me=function(){if(Eht)return jht;Eht=1,Object.defineProperty(jht,"__esModule",{value:!0}),jht.bufferWhen=void 0;var e=Mut(),t=out(),r=Rut(),n=Rlt();return jht.bufferWhen=function(i){return e.operate(function(e,a){var o=null,s=null,u=function(){s?.unsubscribe();var e=o;o=[],e&&a.next(e),n.innerFrom(i()).subscribe(s=r.createOperatorSubscriber(a,u,t.noop))};u(),e.subscribe(r.createOperatorSubscriber(a,function(e){return o?.push(e)},function(){o&&a.next(o),a.complete()},void 0,function(){return o=s=null}))})},jht}();Object.defineProperty(e,"bufferWhen",{enumerable:!0,get:function(){return me.bufferWhen}});var ge=function(){if(Mht)return zht;Mht=1,Object.defineProperty(zht,"__esModule",{value:!0}),zht.catchError=void 0;var e=Rlt(),t=Rut(),r=Mut();return zht.catchError=function n(i){return r.operate(function(r,a){var o,s=null,u=!1;s=r.subscribe(t.createOperatorSubscriber(a,void 0,void 0,function(t){o=e.innerFrom(i(t,n(i)(r))),s?(s.unsubscribe(),s=null,o.subscribe(a)):u=!0})),u&&(s.unsubscribe(),s=null,o.subscribe(a))})},zht}();Object.defineProperty(e,"catchError",{enumerable:!0,get:function(){return ge.catchError}});var ve=(Bht||(Bht=1,Object.defineProperty(Ght,"__esModule",{value:!0}),Ght.combineAll=void 0,Ght.combineAll=Jht().combineLatestAll),Ght);Object.defineProperty(e,"combineAll",{enumerable:!0,get:function(){return ve.combineAll}});var ye=Jht();Object.defineProperty(e,"combineLatestAll",{enumerable:!0,get:function(){return ye.combineLatestAll}});var be=function(){if(tpt)return npt;tpt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty(npt,"__esModule",{value:!0}),npt.combineLatestWith=void 0;var r=function(){if(ept)return ipt;ept=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ipt,"__esModule",{value:!0}),ipt.combineLatest=void 0;var r=aft(),n=Mut(),i=Zft(),a=Wdt(),o=wut(),s=ilt();return ipt.combineLatest=function u(){var c=[...arguments],l=s.popResultSelector(c);return l?o.pipe(u.apply(void 0,t([],e(c))),a.mapOneOrManyArgs(l)):n.operate(function(n,a){r.combineLatestInit(t([n],e(i.argsOrArgArray(c))))(a)})},ipt}();return npt.combineLatestWith=function(){var n=[...arguments];return r.combineLatest.apply(void 0,t([],e(n)))},npt}();Object.defineProperty(e,"combineLatestWith",{enumerable:!0,get:function(){return be.combineLatestWith}});var _e=bft();Object.defineProperty(e,"concatAll",{enumerable:!0,get:function(){return _e.concatAll}});var xe=opt();Object.defineProperty(e,"concatMap",{enumerable:!0,get:function(){return xe.concatMap}});var Se=function(){if(spt)return fpt;spt=1,Object.defineProperty(fpt,"__esModule",{value:!0}),fpt.concatMapTo=void 0;var e=opt(),t=Nst();return fpt.concatMapTo=function(r,n){return t.isFunction(n)?e.concatMap(function(){return r},n):e.concatMap(function(){return r})},fpt}();Object.defineProperty(e,"concatMapTo",{enumerable:!0,get:function(){return Se.concatMapTo}});var we=function(){if(cpt)return hpt;cpt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(hpt,"__esModule",{value:!0}),hpt.concatWith=void 0;var r=function(){if(upt)return ppt;upt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ppt,"__esModule",{value:!0}),ppt.concat=void 0;var r=Mut(),n=bft(),i=ilt(),a=sdt();return ppt.concat=function(){var o=[...arguments],s=i.popScheduler(o);return r.operate(function(r,i){n.concatAll()(a.from(t([r],e(o)),s)).subscribe(i)})},ppt}();return hpt.concatWith=function(){var n=[...arguments];return r.concat.apply(void 0,t([],e(n)))},hpt}();Object.defineProperty(e,"concatWith",{enumerable:!0,get:function(){return we.concatWith}});var Ae=vpt();Object.defineProperty(e,"connect",{enumerable:!0,get:function(){return Ae.connect}});var Ce=function(){if(ypt)return Spt;ypt=1,Object.defineProperty(Spt,"__esModule",{value:!0}),Spt.count=void 0;var e=Kht();return Spt.count=function(t){return e.reduce(function(e,r,n){return!t||t(r,n)?e+1:e},0)},Spt}();Object.defineProperty(e,"count",{enumerable:!0,get:function(){return Ce.count}});var Te=function(){if(bpt)return wpt;bpt=1,Object.defineProperty(wpt,"__esModule",{value:!0}),wpt.debounce=void 0;var e=Mut(),t=out(),r=Rut(),n=Rlt();return wpt.debounce=function(i){return e.operate(function(e,a){var o=!1,s=null,u=null,c=function(){if(u?.unsubscribe(),u=null,o){o=!1;var e=s;s=null,a.next(e)}};e.subscribe(r.createOperatorSubscriber(a,function(e){u?.unsubscribe(),o=!0,s=e,u=r.createOperatorSubscriber(a,c,t.noop),n.innerFrom(i(e)).subscribe(u)},function(){c(),a.complete()},void 0,function(){s=u=null}))})},wpt}();Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return Te.debounce}});var Pe=function(){if(_pt)return Apt;
646_pt=1,Object.defineProperty(Apt,"__esModule",{value:!0}),Apt.debounceTime=void 0;var e=Oct(),t=Mut(),r=Rut();return Apt.debounceTime=function(n,i){return void 0===i&&(i=e.asyncScheduler),t.operate(function(e,t){var a=null,o=null,s=null,u=function(){if(a){a.unsubscribe(),a=null;var e=o;o=null,t.next(e)}};function c(){var e=s+n,r=i.now();if(r<e)return a=this.schedule(void 0,e-r),void t.add(a);u()}e.subscribe(r.createOperatorSubscriber(t,function(e){o=e,s=i.now(),a||(a=i.schedule(c,n),t.add(a))},function(){u(),t.complete()},void 0,function(){o=a=null}))})},Apt}();Object.defineProperty(e,"debounceTime",{enumerable:!0,get:function(){return Pe.debounceTime}});var Ee=Tpt();Object.defineProperty(e,"defaultIfEmpty",{enumerable:!0,get:function(){return Ee.defaultIfEmpty}});var Me=function(){if(Fpt)return Ept;Fpt=1,Object.defineProperty(Ept,"__esModule",{value:!0}),Ept.delay=void 0;var e=Oct(),t=Upt(),r=Uft();return Ept.delay=function(n,i){void 0===i&&(i=e.asyncScheduler);var a=r.timer(n,i);return t.delayWhen(function(){return a})},Ept}();Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return Me.delay}});var ke=Upt();Object.defineProperty(e,"delayWhen",{enumerable:!0,get:function(){return ke.delayWhen}});var Ie=function(){if(jpt)return Vpt;jpt=1,Object.defineProperty(Vpt,"__esModule",{value:!0}),Vpt.dematerialize=void 0;var e=hdt(),t=Mut(),r=Rut();return Vpt.dematerialize=function(){return t.operate(function(t,n){t.subscribe(r.createOperatorSubscriber(n,function(t){return e.observeNotification(t,n)}))})},Vpt}();Object.defineProperty(e,"dematerialize",{enumerable:!0,get:function(){return Ie.dematerialize}});var De=function(){if(zpt)return Hpt;zpt=1,Object.defineProperty(Hpt,"__esModule",{value:!0}),Hpt.distinct=void 0;var e=Mut(),t=Rut(),r=out(),n=Rlt();return Hpt.distinct=function(i,a){return e.operate(function(e,o){var s=new Set;e.subscribe(t.createOperatorSubscriber(o,function(e){var t=i?i(e):e;s.has(t)||(s.add(t),o.next(e))})),a&&n.innerFrom(a).subscribe(t.createOperatorSubscriber(o,function(){return s.clear()},r.noop))})},Hpt}();Object.defineProperty(e,"distinct",{enumerable:!0,get:function(){return De.distinct}});var Oe=Wpt();Object.defineProperty(e,"distinctUntilChanged",{enumerable:!0,get:function(){return Oe.distinctUntilChanged}});var Re=function(){if(Xpt)return Zpt;Xpt=1,Object.defineProperty(Zpt,"__esModule",{value:!0}),Zpt.distinctUntilKeyChanged=void 0;var e=Wpt();return Zpt.distinctUntilKeyChanged=function(t,r){return e.distinctUntilChanged(function(e,n){return r?r(e[t],n[t]):e[t]===n[t]})},Zpt}();Object.defineProperty(e,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return Re.distinctUntilKeyChanged}});var Be=function(){if(Kpt)return Qpt;Kpt=1,Object.defineProperty(Qpt,"__esModule",{value:!0}),Qpt.elementAt=void 0;var e=Cdt(),t=sht(),r=emt(),n=Tpt(),i=Ipt();return Qpt.elementAt=function(a,o){if(a<0)throw new e.ArgumentOutOfRangeError;var s=arguments.length>=2;return function(u){return u.pipe(t.filter(function(e,t){return t===a}),i.take(1),s?n.defaultIfEmpty(o):r.throwIfEmpty(function(){return new e.ArgumentOutOfRangeError}))}},Qpt}();Object.defineProperty(e,"elementAt",{enumerable:!0,get:function(){return Be.elementAt}});var Ne=function(){if(tmt)return omt;tmt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(omt,"__esModule",{value:!0}),omt.endWith=void 0;var r=_ft(),n=udt();return omt.endWith=function(){var i=[...arguments];return function(a){return r.concat(a,n.of.apply(void 0,t([],e(i))))}},omt}();Object.defineProperty(e,"endWith",{enumerable:!0,get:function(){return Ne.endWith}});var Fe=function(){if(rmt)return smt;rmt=1,Object.defineProperty(smt,"__esModule",{value:!0}),smt.every=void 0;var e=Mut(),t=Rut();return smt.every=function(r,n){return e.operate(function(e,i){var a=0;e.subscribe(t.createOperatorSubscriber(i,function(t){r.call(n,t,a++,e)||(i.next(!1),i.complete())},function(){i.next(!0),i.complete()}
646))})},smt}();Object.defineProperty(e,"every",{enumerable:!0,get:function(){return Fe.every}});var Le=(amt||(amt=1,Object.defineProperty(umt,"__esModule",{value:!0}),umt.exhaust=void 0,umt.exhaust=fmt().exhaustAll),umt);Object.defineProperty(e,"exhaust",{enumerable:!0,get:function(){return Le.exhaust}});var $e=fmt();Object.defineProperty(e,"exhaustAll",{enumerable:!0,get:function(){return $e.exhaustAll}});var Ue=dmt();Object.defineProperty(e,"exhaustMap",{enumerable:!0,get:function(){return Ue.exhaustMap}});var je=function(){if(hmt)return gmt;hmt=1,Object.defineProperty(gmt,"__esModule",{value:!0}),gmt.expand=void 0;var e=Mut(),t=gft();return gmt.expand=function(r,n,i){return void 0===n&&(n=1/0),n=(n||0)<1?1/0:n,e.operate(function(e,a){return t.mergeInternals(e,a,r,n,void 0,!0,i)})},gmt}();Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return je.expand}});var ze=sht();Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return ze.filter}});var Ge=function(){if(pmt)return vmt;pmt=1,Object.defineProperty(vmt,"__esModule",{value:!0}),vmt.finalize=void 0;var e=Mut();return vmt.finalize=function(t){return e.operate(function(e,r){try{e.subscribe(r)}finally{r.add(t)}})},vmt}();Object.defineProperty(e,"finalize",{enumerable:!0,get:function(){return Ge.finalize}});var Ve=bmt();Object.defineProperty(e,"find",{enumerable:!0,get:function(){return Ve.find}});var He=function(){if(_mt)return Tmt;_mt=1,Object.defineProperty(Tmt,"__esModule",{value:!0}),Tmt.findIndex=void 0;var e=Mut(),t=bmt();return Tmt.findIndex=function(r,n){return e.operate(t.createFind(r,n,"index"))},Tmt}();Object.defineProperty(e,"findIndex",{enumerable:!0,get:function(){return He.findIndex}});var qe=function(){if(xmt)return Pmt;xmt=1,Object.defineProperty(Pmt,"__esModule",{value:!0}),Pmt.first=void 0;var e=_dt(),t=sht(),r=Ipt(),n=Tpt(),i=emt(),a=Sut();return Pmt.first=function(o,s){var u=arguments.length>=2;return function(c){return c.pipe(o?t.filter(function(e,t){return o(e,t,c)}):a.identity,r.take(1),u?n.defaultIfEmpty(s):i.throwIfEmpty(function(){return new e.EmptyError}))}},Pmt}();Object.defineProperty(e,"first",{enumerable:!0,get:function(){return qe.first}});var We=function(){if(Smt)return Emt;Smt=1,Object.defineProperty(Emt,"__esModule",{value:!0}),Emt.groupBy=void 0;var e=Aut(),t=Rlt(),r=Yut(),n=Mut(),i=Rut();return Emt.groupBy=function(a,o,s,u){return n.operate(function(n,c){var l;o&&"function"!=typeof o?(s=o.duration,l=o.element,u=o.connector):l=o;var d=new Map,f=function(e){d.forEach(e),e(c)},h=function(e){return f(function(t){return t.error(e)})},p=0,m=!1,g=new i.OperatorSubscriber(c,function(n){try{var o=a(n),f=d.get(o);if(!f){d.set(o,f=u?u():new r.Subject);var v=(b=o,_=f,(x=new e.Observable(function(e){p++;var t=_.subscribe(e);return function(){t.unsubscribe(),0==--p&&m&&g.unsubscribe()}})).key=b,x);if(c.next(v),s){var y=i.createOperatorSubscriber(f,function(){f.complete(),y?.unsubscribe()},void 0,void 0,function(){return d.delete(o)});g.add(t.innerFrom(s(v)).subscribe(y))}}f.next(l?l(n):n)}catch(e){h(e)}var b,_,x},function(){return f(function(e){return e.complete()})},h,function(){return d.clear()},function(){return m=!0,0===p});n.subscribe(g)})},Emt}();Object.defineProperty(e,"groupBy",{enumerable:!0,get:function(){return We.groupBy}});var Xe=Rpt();Object.defineProperty(e,"ignoreElements",{enumerable:!0,get:function(){return Xe.ignoreElements}});var Ye=function(){if(wmt)return Mmt;wmt=1,Object.defineProperty(Mmt,"__esModule",{value:!0}),Mmt.isEmpty=void 0;var e=Mut(),t=Rut();return Mmt.isEmpty=function(){return e.operate(function(e,r){e.subscribe(t.createOperatorSubscriber(r,function(){r.next(!1),r.complete()},function(){r.next(!0),r.complete()}))})},Mmt}();Object.defineProperty(e,"isEmpty",{enumerable:!0,get:function(){return Ye.isEmpty}});var Ke=function(){if(Cmt)return kmt;Cmt=1,Object.defineProperty(kmt,"__esModule",{value:!0}),kmt.last=void 0;var e=_dt(),t=sht(),r=Dmt(),n=emt(),i=Tpt(),a=Sut();return kmt.last=function(o,s){var u=arguments.length>=2;return function(c){return c.pipe(o?t.filter(function(e,t){return o(e,t,c)}):a.identity,r.takeLast(1),u?i.defaultIfEmpty(s):n.throwIfEmpty(function(){return new e.EmptyError}))}},kmt}();Object.defineProperty(e,"last",{enumerable:!0,get:function(){return Ke.last}});var Ze=qdt();Object.defineProperty(e,"map",{enumerable:!0,get:function(){return Ze.map}});
646var Qe=$pt();Object.defineProperty(e,"mapTo",{enumerable:!0,get:function(){return Qe.mapTo}});var Je=function(){if(Omt)return zmt;Omt=1,Object.defineProperty(zmt,"__esModule",{value:!0}),zmt.materialize=void 0;var e=hdt(),t=Mut(),r=Rut();return zmt.materialize=function(){return t.operate(function(t,n){t.subscribe(r.createOperatorSubscriber(n,function(t){n.next(e.Notification.createNext(t))},function(){n.next(e.Notification.createComplete()),n.complete()},function(t){n.next(e.Notification.createError(t)),n.complete()}))})},zmt}();Object.defineProperty(e,"materialize",{enumerable:!0,get:function(){return Je.materialize}});var et=function(){if(Rmt)return Gmt;Rmt=1,Object.defineProperty(Gmt,"__esModule",{value:!0}),Gmt.max=void 0;var e=Kht(),t=Nst();return Gmt.max=function(r){return e.reduce(t.isFunction(r)?function(e,t){return r(e,t)>0?e:t}:function(e,t){return e>t?e:t})},Gmt}();Object.defineProperty(e,"max",{enumerable:!0,get:function(){return et.max}});var tt=yft();Object.defineProperty(e,"mergeAll",{enumerable:!0,get:function(){return tt.mergeAll}});var rt=(Bmt||(Bmt=1,Object.defineProperty(Vmt,"__esModule",{value:!0}),Vmt.flatMap=void 0,Vmt.flatMap=vft().mergeMap),Vmt);Object.defineProperty(e,"flatMap",{enumerable:!0,get:function(){return rt.flatMap}});var nt=vft();Object.defineProperty(e,"mergeMap",{enumerable:!0,get:function(){return nt.mergeMap}});var it=function(){if(Nmt)return Hmt;Nmt=1,Object.defineProperty(Hmt,"__esModule",{value:!0}),Hmt.mergeMapTo=void 0;var e=vft(),t=Nst();return Hmt.mergeMapTo=function(r,n,i){return void 0===i&&(i=1/0),t.isFunction(n)?e.mergeMap(function(){return r},n,i):("number"==typeof n&&(i=n),e.mergeMap(function(){return r},i))},Hmt}();Object.defineProperty(e,"mergeMapTo",{enumerable:!0,get:function(){return it.mergeMapTo}});var at=function(){if(Fmt)return qmt;Fmt=1,Object.defineProperty(qmt,"__esModule",{value:!0}),qmt.mergeScan=void 0;var e=Mut(),t=gft();return qmt.mergeScan=function(r,n,i){return void 0===i&&(i=1/0),e.operate(function(e,a){var o=n;return t.mergeInternals(e,a,function(e,t){return r(o,e,t)},i,function(e){o=e},!1,void 0,function(){return o=null})})},qmt}();Object.defineProperty(e,"mergeScan",{enumerable:!0,get:function(){return at.mergeScan}});var ot=function(){if($mt)return Wmt;$mt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Wmt,"__esModule",{value:!0}),Wmt.mergeWith=void 0;var r=function(){if(Lmt)return Xmt;Lmt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Xmt,"__esModule",{value:!0}),Xmt.merge=void 0;var r=Mut(),n=Zft(),i=yft(),a=ilt(),o=sdt();return Xmt.merge=function(){var s=[...arguments],u=a.popScheduler(s),c=a.popNumber(s,1/0);return s=n.argsOrArgArray(s),r.operate(function(r,n){i.mergeAll(c)(o.from(t([r],e(s)),u)).subscribe(n)})},Xmt}();return Wmt.mergeWith=function(){var n=[...arguments];return r.merge.apply(void 0,t([],e(n)))},Wmt}();Object.defineProperty(e,"mergeWith",{enumerable:!0,get:function(){return ot.mergeWith}});var st=function(){if(Umt)return Ymt;Umt=1,Object.defineProperty(Ymt,"__esModule",{value:!0}),Ymt.min=void 0;var e=Kht(),t=Nst();return Ymt.min=function(r){return e.reduce(t.isFunction(r)?function(e,t){return r(e,t)<0?e:t}:function(e,t){return e<t?e:t})},Ymt}();Object.defineProperty(e,"min",{enumerable:!0,get:function(){return st.min}});var ut=Zmt();Object.defineProperty(e,"multicast",{enumerable:!0,get:function(){return ut.multicast}});var ct=Ult();Object.defineProperty(e,"observeOn",{enumerable:!0,get:function(){return ct.observeOn}});var lt=function(){if(Qmt)return dgt;Qmt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty(dgt,"__esModule",{value:!0}),dgt.onErrorResumeNext=dgt.onErrorResumeNextWith=void 0;var r=Zft(),n=Qft();function i(){var i=[...arguments],a=r.argsOrArgArray(i);return function(r){return n.onErrorResumeNext.apply(void 0,t([r],e(a)))}}return dgt.onErrorResumeNextWith=i,dgt.onErrorResumeNext=i,dgt}();Object.defineProperty(e,"onErrorResumeNextWith",{enumerable:!0,get:function(){return lt.onErrorResumeNextWith}});var dt=function(){if(Jmt)return fgt;Jmt=1,Object.defineProperty(fgt,"__esModule",{value:!0}),fgt.pairwise=void 0;var e=Mut(),t=Rut();return fgt.pairwise=function(){return e.operate(function(e,r){var n,i=!1;e.subscribe(t.createOperatorSubscriber(r,function(e){var t=n;n=e,i&&r.next([t,e]),i=!0}))})},fgt}();Object.defineProperty(e,"pairwise",{enumerable:!0,get:function(){return dt.pairwise}});var ft=function(){if(egt)return hgt;egt=1,Object.defineProperty(hgt,"__esModule",{value:!0}),hgt.pluck=void 0;var e=qdt();return hgt.pluck=function(){var t=[...arguments],r=t.length;if(0===r)throw Error("list of properties cannot be empty.");return e.map(function(e){for(var n=e,i=0;i<r;i++){var a=n?.[t[i]];if(void 0===a)return;n=a}return n})},hgt}();Object.defineProperty(e,"pluck",{enumerable:!0,get:function(){return ft.pluck}});var ht=function(){if(tgt)return pgt;tgt=1,Object.defineProperty(pgt,"__esModule",{value:!0}),pgt.publish=void 0;var e=Yut(),t=Zmt(),r=vpt();return pgt.publish=function(n){return n?function(e){return r.connect(n)(e)}:function(r){return t.multicast(new e.Subject)(r)}},pgt}();Object.defineProperty(e,"publish",{enumerable:!0,get:function(){return ht.publish}});var pt=function(){if(rgt)return mgt;rgt=1,Object.defineProperty(mgt,"__esModule",{value:!0}),mgt.publishBehavior=void 0;var e=Qut(),t=Nut();return mgt.publishBehavior=function(r){return function(n){var i=new e.BehaviorSubject(r);return new t.ConnectableObservable(n,function(){return i})}},mgt}();Object.defineProperty(e,"publishBehavior",{enumerable:!0,get:function(){return pt.publishBehavior}});var mt=function(){if(ngt)return ggt;ngt=1,Object.defineProperty(ggt,"__esModule",{value:!0}),ggt.publishLast=void 0;var e=sct(),t=Nut();return ggt.publishLast=function(){return function(r){var n=new e.AsyncSubject;return new t.ConnectableObservable(r,function(){return n})}},ggt}();Object.defineProperty(e,"publishLast",{enumerable:!0,get:function(){return mt.publishLast}});var gt=function(){if(igt)return vgt;igt=1,Object.defineProperty(vgt,"__esModule",{value:!0}),vgt.publishReplay=void 0;var e=ict(),t=Zmt(),r=Nst();return vgt.publishReplay=function(n,i,a,o){a&&!r.isFunction(a)&&(o=a);var s=r.isFunction(a)?a:void 0;return function(r){return t.multicast(new e.ReplaySubject(n,i,o),s)(r)}},vgt}();Object.defineProperty(e,"publishReplay",{enumerable:!0,get:function(){return gt.publishReplay}});var vt=function(){if(agt)return ygt;agt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ygt,"__esModule",{value:!0}),ygt.raceWith=void 0;var r=lht(),n=Mut(),i=Sut();return ygt.raceWith=function(){var a=[...arguments];return a.length?n.operate(function(n,i){r.raceInit(t([n],e(a)))(i)}):i.identity},ygt}();Object.defineProperty(e,"raceWith",{enumerable:!0,get:function(){return vt.raceWith}});var yt=Kht();Object.defineProperty(e,"reduce",{enumerable:!0,get:function(){return yt.reduce}});var bt=function(){if(ogt)return bgt;ogt=1,Object.defineProperty(bgt,"__esModule",{value:!0}),bgt.repeat=void 0;var e=Zct(),t=Mut(),r=Rut(),n=Rlt(),i=Uft();return bgt.repeat=function(a){var o,s,u=1/0;return null!=a&&("object"==typeof a?(o=a.count,u=void 0===o?1/0:o,s=a.delay):u=a),u<=0?function(){return e.EMPTY}:t.operate(function(e,t){var a,o=0,c=function(){if(a?.unsubscribe(),a=null,null!=s){var e="number"==typeof s?i.timer(s):n.innerFrom(s(o)),u=r.createOperatorSubscriber(t,function(){u.unsubscribe(),l()});e.subscribe(u)}else l()},l=function(){var n=!1;a=e.subscribe(r.createOperatorSubscriber(t,void 0,function(){++o<u?a?c():n=!0:t.complete()}
646)),n&&c()};l()})},bgt}();Object.defineProperty(e,"repeat",{enumerable:!0,get:function(){return bt.repeat}});var _t=function(){if(sgt)return _gt;sgt=1,Object.defineProperty(_gt,"__esModule",{value:!0}),_gt.repeatWhen=void 0;var e=Rlt(),t=Yut(),r=Mut(),n=Rut();return _gt.repeatWhen=function(i){return r.operate(function(r,a){var o,s,u=!1,c=!1,l=!1,d=function(){return l&&c&&(a.complete(),!0)},f=function(){l=!1,o=r.subscribe(n.createOperatorSubscriber(a,void 0,function(){l=!0,!d()&&(s||(s=new t.Subject,e.innerFrom(i(s)).subscribe(n.createOperatorSubscriber(a,function(){o?f():u=!0},function(){c=!0,d()}))),s).next()})),u&&(o.unsubscribe(),o=null,u=!1,f())};f()})},_gt}();Object.defineProperty(e,"repeatWhen",{enumerable:!0,get:function(){return _t.repeatWhen}});var xt=function(){if(ugt)return xgt;ugt=1,Object.defineProperty(xgt,"__esModule",{value:!0}),xgt.retry=void 0;var e=Mut(),t=Rut(),r=Sut(),n=Uft(),i=Rlt();return xgt.retry=function(a){var o;void 0===a&&(a=1/0);var s=(o=a&&"object"==typeof a?a:{count:a}).count,u=void 0===s?1/0:s,c=o.delay,l=o.resetOnSuccess,d=void 0!==l&&l;return u<=0?r.identity:e.operate(function(e,r){var a,o=0,s=function(){var l=!1;a=e.subscribe(t.createOperatorSubscriber(r,function(e){d&&(o=0),r.next(e)},void 0,function(e){if(o++<u){var d=function(){a?(a.unsubscribe(),a=null,s()):l=!0};if(null!=c){var f="number"==typeof c?n.timer(c):i.innerFrom(c(e,o)),h=t.createOperatorSubscriber(r,function(){h.unsubscribe(),d()},function(){r.complete()});f.subscribe(h)}else d()}else r.error(e)})),l&&(a.unsubscribe(),a=null,s())};s()})},xgt}();Object.defineProperty(e,"retry",{enumerable:!0,get:function(){return xt.retry}});var St=function(){if(cgt)return Sgt;cgt=1,Object.defineProperty(Sgt,"__esModule",{value:!0}),Sgt.retryWhen=void 0;var e=Rlt(),t=Yut(),r=Mut(),n=Rut();return Sgt.retryWhen=function(i){return r.operate(function(r,a){var o,s,u=!1,c=function(){o=r.subscribe(n.createOperatorSubscriber(a,void 0,void 0,function(r){s||(s=new t.Subject,e.innerFrom(i(s)).subscribe(n.createOperatorSubscriber(a,function(){return o?c():u=!0}))),s&&s.next(r)})),u&&(o.unsubscribe(),o=null,u=!1,c())};c()})},Sgt}();Object.defineProperty(e,"retryWhen",{enumerable:!0,get:function(){return St.retryWhen}});var wt=But();Object.defineProperty(e,"refCount",{enumerable:!0,get:function(){return wt.refCount}});var At=Agt();Object.defineProperty(e,"sample",{enumerable:!0,get:function(){return At.sample}});var Ct=function(){if(Cgt)return Mgt;Cgt=1,Object.defineProperty(Mgt,"__esModule",{value:!0}),Mgt.sampleTime=void 0;var e=Oct(),t=Agt(),r=jft();return Mgt.sampleTime=function(n,i){return void 0===i&&(i=e.asyncScheduler),t.sample(r.interval(n,i))},Mgt}();Object.defineProperty(e,"sampleTime",{enumerable:!0,get:function(){return Ct.sampleTime}});var Tt=function(){if(Tgt)return kgt;Tgt=1,Object.defineProperty(kgt,"__esModule",{value:!0}),kgt.scan=void 0;var e=Mut(),t=Yht();return kgt.scan=function(r,n){return e.operate(t.scanInternals(r,n,arguments.length>=2,!0))},kgt}();Object.defineProperty(e,"scan",{enumerable:!0,get:function(){return Tt.scan}});var Pt=function(){if(Pgt)return Igt;Pgt=1,Object.defineProperty(Igt,"__esModule",{value:!0}),Igt.sequenceEqual=void 0;var e=Mut(),t=Rut(),r=Rlt();return Igt.sequenceEqual=function(n,i){return void 0===i&&(i=function(e,t){return e===t}),e.operate(function(e,a){var o={buffer:[],complete:!1},s={buffer:[],complete:!1},u=function(e){a.next(e),a.complete()},c=function(e,r){var n=t.createOperatorSubscriber(a,function(t){var n=r.buffer,a=r.complete;0===n.length?a?u(!1):e.buffer.push(t):!i(t,n.shift())&&u(!1)},function(){e.complete=!0;var t=r.complete,i=r.buffer;t&&u(0===i.length),n?.unsubscribe()});return n};e.subscribe(c(o,s)),r.innerFrom(n).subscribe(c(s,o))})},Igt}();Object.defineProperty(e,"sequenceEqual",{enumerable:!0,get:function(){return Pt.sequenceEqual}});var Et=Ogt();Object.defineProperty(e,"share",{enumerable:!0,get:function(){return Et.share}});var Mt=function(){if(Rgt)return Ggt;Rgt=1,Object.defineProperty(Ggt,"__esModule",{value:!0}),Ggt.shareReplay=void 0;var e=ict(),t=Ogt();return Ggt.shareReplay=function(r,n,i){var a,o,s,u,c=!1;return r&&"object"==typeof r?(a=r.bufferSize,u=void 0===a?1/0:a,o=r.windowTime,n=void 0===o?1/0:o,c=void 0!==(s=r.refCount)&&s,i=r.scheduler):u=r??1/0,t.share({connector:function(){return new e.ReplaySubject(u,n,i)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:c})},Ggt}();Object.defineProperty(e,"shareReplay",{enumerable:!0,get:function(){return Mt.shareReplay}});var kt=function(){if(Bgt)return Vgt;
646Bgt=1,Object.defineProperty(Vgt,"__esModule",{value:!0}),Vgt.single=void 0;var e=_dt(),t=Idt(),r=Edt(),n=Mut(),i=Rut();return Vgt.single=function(a){return n.operate(function(n,o){var s,u=!1,c=!1,l=0;n.subscribe(i.createOperatorSubscriber(o,function(e){c=!0,a&&!a(e,l++,n)||(u&&o.error(new t.SequenceError("Too many matching values")),u=!0,s=e)},function(){u?(o.next(s),o.complete()):o.error(c?new r.NotFoundError("No matching values"):new e.EmptyError)}))})},Vgt}();Object.defineProperty(e,"single",{enumerable:!0,get:function(){return kt.single}});var It=function(){if(Ngt)return Hgt;Ngt=1,Object.defineProperty(Hgt,"__esModule",{value:!0}),Hgt.skip=void 0;var e=sht();return Hgt.skip=function(t){return e.filter(function(e,r){return t<=r})},Hgt}();Object.defineProperty(e,"skip",{enumerable:!0,get:function(){return It.skip}});var Dt=function(){if(Fgt)return qgt;Fgt=1,Object.defineProperty(qgt,"__esModule",{value:!0}),qgt.skipLast=void 0;var e=Sut(),t=Mut(),r=Rut();return qgt.skipLast=function(n){return n<=0?e.identity:t.operate(function(e,t){var i=Array(n),a=0;return e.subscribe(r.createOperatorSubscriber(t,function(e){var r=a++;if(r<n)i[r]=e;else{var o=r%n,s=i[o];i[o]=e,t.next(s)}})),function(){i=null}})},qgt}();Object.defineProperty(e,"skipLast",{enumerable:!0,get:function(){return Dt.skipLast}});var Ot=function(){if(Lgt)return Wgt;Lgt=1,Object.defineProperty(Wgt,"__esModule",{value:!0}),Wgt.skipUntil=void 0;var e=Mut(),t=Rut(),r=Rlt(),n=out();return Wgt.skipUntil=function(i){return e.operate(function(e,a){var o=!1,s=t.createOperatorSubscriber(a,function(){s?.unsubscribe(),o=!0},n.noop);r.innerFrom(i).subscribe(s),e.subscribe(t.createOperatorSubscriber(a,function(e){return o&&a.next(e)}))})},Wgt}();Object.defineProperty(e,"skipUntil",{enumerable:!0,get:function(){return Ot.skipUntil}});var Rt=function(){if($gt)return Xgt;$gt=1,Object.defineProperty(Xgt,"__esModule",{value:!0}),Xgt.skipWhile=void 0;var e=Mut(),t=Rut();return Xgt.skipWhile=function(r){return e.operate(function(e,n){var i=!1,a=0;e.subscribe(t.createOperatorSubscriber(n,function(e){return(i||=!r(e,a++))&&n.next(e)}))})},Xgt}();Object.defineProperty(e,"skipWhile",{enumerable:!0,get:function(){return Rt.skipWhile}});var Bt=function(){if(Ugt)return Ygt;Ugt=1,Object.defineProperty(Ygt,"__esModule",{value:!0}),Ygt.startWith=void 0;var e=_ft(),t=ilt(),r=Mut();return Ygt.startWith=function(){var n=[...arguments],i=t.popScheduler(n);return r.operate(function(t,r){(i?e.concat(n,t,i):e.concat(n,t)).subscribe(r)})},Ygt}();Object.defineProperty(e,"startWith",{enumerable:!0,get:function(){return Bt.startWith}});var Nt=Vlt();Object.defineProperty(e,"subscribeOn",{enumerable:!0,get:function(){return Nt.subscribeOn}});var Ft=function(){if(zgt)return Kgt;zgt=1,Object.defineProperty(Kgt,"__esModule",{value:!0}),Kgt.switchAll=void 0;var e=Qgt(),t=Sut();return Kgt.switchAll=function(){return e.switchMap(t.identity)},Kgt}();Object.defineProperty(e,"switchAll",{enumerable:!0,get:function(){return Ft.switchAll}});var Lt=Qgt();Object.defineProperty(e,"switchMap",{enumerable:!0,get:function(){return Lt.switchMap}});var $t=function(){if(Jgt)return avt;Jgt=1,Object.defineProperty(avt,"__esModule",{value:!0}),avt.switchMapTo=void 0;var e=Qgt(),t=Nst();return avt.switchMapTo=function(r,n){return t.isFunction(n)?e.switchMap(function(){return r},n):e.switchMap(function(){return r})},avt}();Object.defineProperty(e,"switchMapTo",{enumerable:!0,get:function(){return $t.switchMapTo}});var Ut=function(){if(evt)return ovt;evt=1,Object.defineProperty(ovt,"__esModule",{value:!0}),ovt.switchScan=void 0;var e=Qgt(),t=Mut();return ovt.switchScan=function(r,n){return t.operate(function(t,i){var a=n;return e.switchMap(function(e,t){return r(a,e,t)},function(e,t){return a=t,t})(t).subscribe(i),function(){a=null}})},ovt}();Object.defineProperty(e,"switchScan",{enumerable:!0,get:function(){return Ut.switchScan}});var jt=Ipt();Object.defineProperty(e,"take",{enumerable:!0,get:function(){return jt.take}});var zt=Dmt();Object.defineProperty(e,"takeLast",{enumerable:!0,get:function(){return zt.takeLast}});var Gt=function(){if(tvt)return svt;
646tvt=1,Object.defineProperty(svt,"__esModule",{value:!0}),svt.takeUntil=void 0;var e=Mut(),t=Rut(),r=Rlt(),n=out();return svt.takeUntil=function(i){return e.operate(function(e,a){r.innerFrom(i).subscribe(t.createOperatorSubscriber(a,function(){return a.complete()},n.noop)),!a.closed&&e.subscribe(a)})},svt}();Object.defineProperty(e,"takeUntil",{enumerable:!0,get:function(){return Gt.takeUntil}});var Vt=function(){if(rvt)return uvt;rvt=1,Object.defineProperty(uvt,"__esModule",{value:!0}),uvt.takeWhile=void 0;var e=Mut(),t=Rut();return uvt.takeWhile=function(r,n){return void 0===n&&(n=!1),e.operate(function(e,i){var a=0;e.subscribe(t.createOperatorSubscriber(i,function(e){var t=r(e,a++);(t||n)&&i.next(e),!t&&i.complete()}))})},uvt}();Object.defineProperty(e,"takeWhile",{enumerable:!0,get:function(){return Vt.takeWhile}});var Ht=function(){if(nvt)return cvt;nvt=1,Object.defineProperty(cvt,"__esModule",{value:!0}),cvt.tap=void 0;var e=Nst(),t=Mut(),r=Rut(),n=Sut();return cvt.tap=function(i,a,o){var s=e.isFunction(i)||a||o?{next:i,error:a,complete:o}:i;return s?t.operate(function(e,t){var n;null==(n=s.subscribe)||n.call(s);var i=!0;e.subscribe(r.createOperatorSubscriber(t,function(e){var r;null==(r=s.next)||r.call(s,e),t.next(e)},function(){var e;i=!1,null==(e=s.complete)||e.call(s),t.complete()},function(e){var r;i=!1,null==(r=s.error)||r.call(s,e),t.error(e)},function(){var e,t;i&&(null==(e=s.unsubscribe)||e.call(s)),null==(t=s.finalize)||t.call(s)}))}):n.identity},cvt}();Object.defineProperty(e,"tap",{enumerable:!0,get:function(){return Ht.tap}});var qt=dvt();Object.defineProperty(e,"throttle",{enumerable:!0,get:function(){return qt.throttle}});var Wt=function(){if(fvt)return Evt;fvt=1,Object.defineProperty(Evt,"__esModule",{value:!0}),Evt.throttleTime=void 0;var e=Oct(),t=dvt(),r=Uft();return Evt.throttleTime=function(n,i,a){void 0===i&&(i=e.asyncScheduler);var o=r.timer(n,i);return t.throttle(function(){return o},a)},Evt}();Object.defineProperty(e,"throttleTime",{enumerable:!0,get:function(){return Wt.throttleTime}});var Xt=emt();Object.defineProperty(e,"throwIfEmpty",{enumerable:!0,get:function(){return Xt.throwIfEmpty}});var Yt=function(){if(hvt)return Mvt;hvt=1,Object.defineProperty(Mvt,"__esModule",{value:!0}),Mvt.TimeInterval=Mvt.timeInterval=void 0;var e=Oct(),t=Mut(),r=Rut();Mvt.timeInterval=function(i){return void 0===i&&(i=e.asyncScheduler),t.operate(function(e,t){var a=i.now();e.subscribe(r.createOperatorSubscriber(t,function(e){var r=i.now(),o=r-a;a=r,t.next(new n(e,o))}))})};var n=function(e,t){this.value=e,this.interval=t};return Mvt.TimeInterval=n,Mvt}();Object.defineProperty(e,"timeInterval",{enumerable:!0,get:function(){return Yt.timeInterval}});var Kt=Fdt();Object.defineProperty(e,"timeout",{enumerable:!0,get:function(){return Kt.timeout}});var Zt=function(){if(pvt)return kvt;pvt=1,Object.defineProperty(kvt,"__esModule",{value:!0}),kvt.timeoutWith=void 0;var e=Oct(),t=Ndt(),r=Fdt();return kvt.timeoutWith=function(n,i,a){var o,s,u;if(a??=e.async,t.isValidDate(n)?o=n:"number"==typeof n&&(s=n),!i)throw TypeError("No observable provided to switch to");if(u=function(){return i},null==o&&null==s)throw TypeError("No timeout provided.");return r.timeout({first:o,each:s,scheduler:a,with:u})},kvt}();Object.defineProperty(e,"timeoutWith",{enumerable:!0,get:function(){return Zt.timeoutWith}});var Qt=function(){if(mvt)return Ivt;mvt=1,Object.defineProperty(Ivt,"__esModule",{value:!0}),Ivt.timestamp=void 0;var e=nct(),t=qdt();return Ivt.timestamp=function(r){return void 0===r&&(r=e.dateTimestampProvider),t.map(function(e){return{value:e,timestamp:r.now()}})},Ivt}();Object.defineProperty(e,"timestamp",{enumerable:!0,get:function(){return Qt.timestamp}});var Jt=Zht();Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return Jt.toArray}});var er=function(){if(gvt)return Dvt;gvt=1,Object.defineProperty(Dvt,"__esModule",{value:!0}),Dvt.window=void 0;var e=Yut(),t=Mut(),r=Rut(),n=out(),i=Rlt();return Dvt.window=function(a){return t.operate(function(t,o){var s=new e.Subject;o.next(s.asObservable());var u=function(e){s.error(e),o.error(e)};return t.subscribe(r.createOperatorSubscriber(o,function(e){return s?.next(e)},function(){s.complete(),o.complete()},u)),i.innerFrom(a).subscribe(r.createOperatorSubscriber(o,function(){s.complete(),o.next(s=new e.Subject)},n.noop,u)),function(){s?.unsubscribe(),s=null}})},Dvt}();Object.defineProperty(e,"window",{enumerable:!0,get:function(){return er.window}
646});var tr=function(){if(vvt)return Ovt;vvt=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Ovt,"__esModule",{value:!0}),Ovt.windowCount=void 0;var t=Yut(),r=Mut(),n=Rut();return Ovt.windowCount=function(i,a){void 0===a&&(a=0);var o=a>0?a:i;return r.operate(function(r,a){var s=[new t.Subject],u=0;a.next(s[0].asObservable()),r.subscribe(n.createOperatorSubscriber(a,function(r){var n,c;try{for(var l=e(s),d=l.next();!d.done;d=l.next())d.value.next(r)}catch(e){n={error:e}}finally{try{d&&!d.done&&(c=l.return)&&c.call(l)}finally{if(n)throw n.error}}var f=u-i+1;if(f>=0&&f%o==0&&s.shift().complete(),++u%o==0){var h=new t.Subject;s.push(h),a.next(h.asObservable())}},function(){for(;s.length>0;)s.shift().complete();a.complete()},function(e){for(;s.length>0;)s.shift().error(e);a.error(e)},function(){s=null}))})},Ovt}();Object.defineProperty(e,"windowCount",{enumerable:!0,get:function(){return tr.windowCount}});var rr=function(){if(yvt)return Rvt;yvt=1,Object.defineProperty(Rvt,"__esModule",{value:!0}),Rvt.windowTime=void 0;var e=Yut(),t=Oct(),r=Xst(),n=Mut(),i=Rut(),a=Wst(),o=ilt(),s=$lt();return Rvt.windowTime=function(u){var c=[...arguments].slice(1),l=o.popScheduler(c)??t.asyncScheduler,d=c[0]??null,f=c[1]||1/0;return n.operate(function(t,n){var o=[],c=!1,h=function(e){var t=e.window,r=e.subs;t.complete(),r.unsubscribe(),a.arrRemove(o,e),c&&p()},p=function(){if(o){var t=new r.Subscription;n.add(t);var i=new e.Subject,a={window:i,subs:t,seen:0};o.push(a),n.next(i.asObservable()),s.executeSchedule(t,l,function(){return h(a)},u)}};null!==d&&d>=0?s.executeSchedule(n,l,p,d,!0):c=!0,p();var m=function(e){return o.slice().forEach(e)},g=function(e){m(function(t){var r=t.window;return e(r)}),e(n),n.unsubscribe()};return t.subscribe(i.createOperatorSubscriber(n,function(e){m(function(t){t.window.next(e),f<=++t.seen&&h(t)})},function(){return g(function(e){return e.complete()})},function(e){return g(function(t){return t.error(e)})})),function(){o=null}})},Rvt}();Object.defineProperty(e,"windowTime",{enumerable:!0,get:function(){return rr.windowTime}});var nr=function(){if(bvt)return Bvt;bvt=1;var e=Pot&&Pot.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Bvt,"__esModule",{value:!0}),Bvt.windowToggle=void 0;var t=Yut(),r=Xst(),n=Mut(),i=Rlt(),a=Rut(),o=out(),s=Wst();return Bvt.windowToggle=function(u,c){return n.operate(function(n,l){var d=[],f=function(e){for(;0<d.length;)d.shift().error(e);l.error(e)};i.innerFrom(u).subscribe(a.createOperatorSubscriber(l,function(e){var n=new t.Subject;d.push(n);var u,h=new r.Subscription;try{u=i.innerFrom(c(e))}catch(e){return void f(e)}l.next(n.asObservable()),h.add(u.subscribe(a.createOperatorSubscriber(l,function(){s.arrRemove(d,n),n.complete(),h.unsubscribe()},o.noop,f)))},o.noop)),n.subscribe(a.createOperatorSubscriber(l,function(t){var r,n,i=d.slice();try{for(var a=e(i),o=a.next();!o.done;o=a.next())o.value.next(t)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},function(){for(;0<d.length;)d.shift().complete();l.complete()},f,function(){for(;0<d.length;)d.shift().unsubscribe()}))})},Bvt}();Object.defineProperty(e,"windowToggle",{enumerable:!0,get:function(){return nr.windowToggle}});var ir=function(){if(_vt)return Nvt;_vt=1,Object.defineProperty(Nvt,"__esModule",{value:!0}),Nvt.windowWhen=void 0;var e=Yut(),t=Mut(),r=Rut(),n=Rlt();return Nvt.windowWhen=function(i){return t.operate(function(t,a){var o,s,u=function(e){o.error(e),a.error(e)},c=function(){var t;s?.unsubscribe(),o?.complete(),o=new e.Subject,a.next(o.asObservable());try{t=n.innerFrom(i())}catch(e){return void u(e)}t.subscribe(s=r.createOperatorSubscriber(a,c,c,u))};c(),t.subscribe(r.createOperatorSubscriber(a,function(e){return o.next(e)},function(){o.complete(),a.complete()},u,function(){s?.unsubscribe(),o=null}))})},Nvt}();Object.defineProperty(e,"windowWhen",{enumerable:!0,get:function(){return ir.windowWhen}});var ar=function(){if(xvt)return Fvt;xvt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};
646Object.defineProperty(Fvt,"__esModule",{value:!0}),Fvt.withLatestFrom=void 0;var r=Mut(),n=Rut(),i=Rlt(),a=Sut(),o=out(),s=ilt();return Fvt.withLatestFrom=function(){var u=[...arguments],c=s.popResultSelector(u);return r.operate(function(r,s){for(var l=u.length,d=Array(l),f=u.map(function(){return!1}),h=!1,p=function(e){i.innerFrom(u[e]).subscribe(n.createOperatorSubscriber(s,function(t){d[e]=t,h||f[e]||(f[e]=!0,(h=f.every(a.identity))&&(f=null))},o.noop))},m=0;m<l;m++)p(m);r.subscribe(n.createOperatorSubscriber(s,function(r){if(h){var n=t([r],e(d));s.next(c?c.apply(void 0,t([],e(n))):n)}}))})},Fvt}();Object.defineProperty(e,"withLatestFrom",{enumerable:!0,get:function(){return ar.withLatestFrom}});var or=function(){if(Svt)return Lvt;Svt=1,Object.defineProperty(Lvt,"__esModule",{value:!0}),Lvt.zipAll=void 0;var e=vht(),t=Qht();return Lvt.zipAll=function(r){return t.joinAllInternals(e.zip,r)},Lvt}();Object.defineProperty(e,"zipAll",{enumerable:!0,get:function(){return or.zipAll}});var sr=function(){if(Avt)return $vt;Avt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty($vt,"__esModule",{value:!0}),$vt.zipWith=void 0;var r=function(){if(wvt)return Uvt;wvt=1;var e=Pot&&Pot.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},t=Pot&&Pot.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Uvt,"__esModule",{value:!0}),Uvt.zip=void 0;var r=vht(),n=Mut();return Uvt.zip=function(){var i=[...arguments];return n.operate(function(n,a){r.zip.apply(void 0,t([n],e(i))).subscribe(a)})},Uvt}();return $vt.zipWith=function(){var n=[...arguments];return r.zip.apply(void 0,t([],e(n)))},$vt}();Object.defineProperty(e,"zipWith",{enumerable:!0,get:function(){return sr.zipWith}})}(Dst)),Dst}function zvt(){return Tvt||(Tvt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.State=e.MIN_ZOOMED_DATAPOINTS_HARD=void 0;var t=Wot,r=jvt(),n=ist(),i=ast(),a=Zot(),o=vst(),s=Kot();e.MIN_ZOOMED_DATAPOINTS_HARD=1;var u=function(){function u(e){this.originalData=i.DataDescription.empty(),this.dataArray=n.Array2D.empty(),this.xDomain=a.Domain.create([]),this.yDomain=a.Domain.create([]),this._xAlignment="left",this._yAlignment="top",this.boxes={wholeWorld:o.Box.create(0,0,1,1),visWorld:o.Box.create(0,0,1,1),svg:o.Box.create(0,0,1,1),canvasContext:o.Box.create(0,0,1,1)},this.scales=(0,o.Scales)(this.boxes),this.canvasScale=1,this.events={hover:new r.BehaviorSubject({cell:void 0,sourceEvent:void 0}),select:new r.BehaviorSubject({cell:void 0,sourceEvent:void 0}),brush:new r.BehaviorSubject({type:"end",selection:void 0,sourceEvent:void 0}),zoom:new r.BehaviorSubject(void 0),resize:new r.BehaviorSubject(void 0),data:new r.BehaviorSubject(void 0),render:new r.BehaviorSubject(void 0)},this.setData(e)}return Object.defineProperty(u.prototype,"xAlignment",{get:function(){return this._xAlignment},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"yAlignment",{get:function(){return this._yAlignment},enumerable:!1,configurable:!0}),u.prototype.setData=function(e){var t=i.DataDescription.toArray2D(e),r=t.array2d,n=t.xDomain,a=t.yDomain,o=this;return o.originalData=e,o.xDomain=n,o.yDomain=a,o.setDataArray(r),o},u.prototype.setDataArray=function(t){this.dataArray=t;var r=o.Box.create(0,0,t.nColumns,t.nRows),n=o.Box.width(r)/o.Box.width(this.boxes.wholeWorld),i=o.Box.height(r)/o.Box.height(this.boxes.wholeWorld);this.boxes.wholeWorld=r,this.boxes.visWorld=o.Box.clamp({xmin:this.boxes.visWorld.xmin*n,xmax:this.boxes.visWorld.xmax*n,ymin:this.boxes.visWorld.ymin*i,ymax:this.boxes.visWorld.ymax*i},r,{width:e.MIN_ZOOMED_DATAPOINTS_HARD,height:e.MIN_ZOOMED_DATAPOINTS_HARD}),this.scales=(0,o.Scales)(this.boxes),this.events.data.next(void 0),this.emitZoom("setDataArray")},u.prototype.getPointedCell=function(e){if(e){var t=Math.floor(this.scales.svgToWorld.x(e.offsetX)),r=Math.floor(this.scales.svgToWorld.y(e.offsetY));return{datum:n.Array2D.get(this.dataArray,t,r),x:this.xDomain.values[t],y:this.yDomain.values[r],xIndex:t,yIndex:r}}},u.prototype.emitResize=function(){if(this.dom){var e=(0,s.getSize)(this.dom.canvas);this.events.resize.next(e)}},u.prototype.emitZoom=function(e){var r=this.getZoomEventValue(e);(0,t.isEqual)(r,this.events.zoom.value)||this.events.zoom.next(r)},u.prototype.setAlignment=function(e,t){e&&(this._xAlignment=e),t&&(this._yAlignment=t),this.emitZoom("setAlignment")},u.prototype.getZoomEventValue=function(e){var t=this.worldBoxToBoxSelection(this.boxes.visWorld);if(t)return{xMinIndex:t.xMinIndex,xMaxIndex:t.xMaxIndex,xMin:t.xMin,xMax:t.xMax,xFirstVisibleIndex:t.xFirstIndex,xLastVisibleIndex:t.xLastIndex,xFirstVisible:t.xFirst,xLastVisible:t.xLast,yMinIndex:t.yMinIndex,yMaxIndex:t.yMaxIndex,yMin:t.yMin,yMax:t.yMax,yFirstVisibleIndex:t.yFirstIndex,yLastVisibleIndex:t.yLastIndex,yFirstVisible:t.yFirst,yLastVisible:t.yLast,origin:e}},u.prototype.worldBoxToBoxSelection=function(e){if(e){var r=(0,t.round)(e.xmin,9),n=(0,t.round)(e.xmax,9),i=(0,t.clamp)(Math.floor(r),0,this.dataArray.nColumns-1),o=(0,t.clamp)(Math.ceil(n)-1,
6460,this.dataArray.nColumns-1),s=(0,t.round)(e.ymin,9),u=(0,t.round)(e.ymax,9),l=(0,t.clamp)(Math.floor(s),0,this.dataArray.nRows-1),d=(0,t.clamp)(Math.ceil(u)-1,0,this.dataArray.nRows-1),f=c(this.xAlignment),h=c(this.yAlignment);return{xMinIndex:r+f,xMaxIndex:n+f,xMin:a.Domain.interpolateValue(this.xDomain,r+f),xMax:a.Domain.interpolateValue(this.xDomain,n+f),xFirstIndex:i,xLastIndex:o,xFirst:this.xDomain.values[i],xLast:this.xDomain.values[o],yMinIndex:s+h,yMaxIndex:u+h,yMin:a.Domain.interpolateValue(this.yDomain,s+h),yMax:a.Domain.interpolateValue(this.yDomain,u+h),yFirstIndex:l,yLastIndex:d,yFirst:this.yDomain.values[l],yLast:this.yDomain.values[d]}}},u.prototype.getIndexFromZoomRequest=function(e,r,n){if(!(0,t.isNil)(n)){var i="Min"===r?"First":"Last",o=n[`${e}${r}Index`],s=n[`${e}${r}`],u=n[`${e}${i}VisibleIndex`],l=n[`${e}${i}Visible`],d=this[`${e}Domain`],f=this[`${e}Alignment`];if([o,s,u,l].filter(function(e){return!(0,t.isNil)(e)}).length>1&&console.warn(`You called zoom function with more that one of these conflicting options: ${e}${r}Index, ${e}${r}, ${e}${i}VisibleIndex, ${e}${i}Visible. Only the first one (in this order of precedence) will be considered.`),!(0,t.isNil)(o))return o-c(f);if(!(0,t.isNil)(s)){var h=a.Domain.interpolateIndex(d,s);if((0,t.isNil)(h))throw Error(`${e}${r} option is not applicable for zoom function, because the ${e.toUpperCase()} domain is not numeric or not sorted. Use one of these options instead: ${e}${r}Index, ${e}${i}VisibleIndex, ${e}${i}Visible.`);return h-c(f)}if(!(0,t.isNil)(u)){if(Math.floor(u)!==u)throw Error(`${e}${i}VisibleIndex must be an integer, not ${u}`);return"First"===i?u:u+1}if(!(0,t.isNil)(l)){var p=d.index.get(l);return(0,t.isNil)(p)?void console.warn(`The provided value of ${e}${i}Visible (${l}) is not in the ${e.toUpperCase()} domain.`):"First"===i?p:p+1}}},u.prototype.zoom=function(t){var r=o.Box.clamp({xmin:this.getIndexFromZoomRequest("x","Min",t)??this.boxes.wholeWorld.xmin,xmax:this.getIndexFromZoomRequest("x","Max",t)??this.boxes.wholeWorld.xmax,ymin:this.getIndexFromZoomRequest("y","Min",t)??this.boxes.wholeWorld.ymin,ymax:this.getIndexFromZoomRequest("y","Max",t)??this.boxes.wholeWorld.ymax},this.boxes.wholeWorld,{width:e.MIN_ZOOMED_DATAPOINTS_HARD,height:e.MIN_ZOOMED_DATAPOINTS_HARD});return this.zoomVisWorldBox(r,t?.origin),this.getZoomEventValue(t?.origin)},u.prototype.zoomVisWorldBox=function(e,t,r){void 0===r&&(r=!0),this.boxes.visWorld=e,this.scales=(0,o.Scales)(this.boxes),r&&this.emitZoom(t)},u.prototype.getZoom=function(){return this.getZoomEventValue(void 0)},u}();function c(e){return"left"===e||"top"===e?0:"center"===e?-.5:-1}e.State=u}(Ist)),Ist}var Gvt,Vvt,Hvt,qvt={};var Wvt=function e(){return Hvt||(Hvt=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Heatmap=t.demos=t.ColorScale=t.Color=void 0;var r=Iot,n=Dot;Object.defineProperty(t,"Color",{enumerable:!0,get:function(){return n.Color}});var i=Got;Object.defineProperty(t,"ColorScale",{enumerable:!0,get:function(){return i.ColorScale}}),t.demos=r.__importStar(function(){if(est)return tst;
646est=1,Object.defineProperty(tst,"__esModule",{value:!0}),tst.demo1=function(e){var t=n.Heatmap.create({xDomain:[1,2,3,4],yDomain:["A","B","C"],data:[{col:1,row:"A",score:0},{col:1,row:"B",score:.2},{col:1,row:"C",score:.4},{col:2,row:"A",score:.6},{col:2,row:"B",score:.8},{col:2,row:"C",score:1},{col:3,row:"A",score:.3},{col:3,row:"C",score:.7},{col:4,row:"B",score:.5}],x:function(e){return e.col},y:function(e){return e.row},filter:function(e,t,r,n,i){return e.score>0}}),r=n.ColorScale.continuous([0,.5,1],["#eeeeee","gold","red"]);t.setColor(function(e){return r(e.score)}),t.setTooltip(function(e,t,r,n,i){return`<div style="font-weight: bold; margin-bottom: 0.5em;">Score: ${e.score}</div>Column ${t}, Row ${r}<br>Indices [${n},${i}]`}),setTimeout(function(){return t.setFilter(void 0)},2e3),t.setVisualParams({xGapPixels:0,yGapPixels:0}),t.events.select.subscribe(function(e){e.cell?console.log("selecting",e.cell.datum,e.cell.x,e.cell.y,e.cell.xIndex,e.cell.yIndex,e.sourceEvent):console.log("selecting nothing")}),t.events.zoom.subscribe(function(e){e&&(o("#xminindex",e.xMinIndex),o("#xmaxindex",e.xMaxIndex),o("#xmin",e.xMin),o("#xmax",e.xMax),o("#xfirstvisibleindex",e.xFirstVisibleIndex,0),o("#xlastvisibleindex",e.xLastVisibleIndex,0),o("#xfirstvisible",e.xFirstVisible,0),o("#xlastvisible",e.xLastVisible,0))}),t.setZooming({axis:"x"}),t.render(e),window.heatmap=t},tst.demo2=function(e){var t=i.DataDescription.createDummy(2e5,20),r=n.Heatmap.create(t);r.setVisualParams({xGapRelative:0,yGapRelative:0}),r.setColor(n.ColorScale.continuous("Magma",[0,1])),r.render(e),r.setZooming({axis:"x"}),window.heatmap=r},tst.demo3=function(e){var t=n.Heatmap.create({xDomain:[1,2,3],yDomain:["A","B","C"],data:[{col:1,row:"A",score:.6},{col:1,row:"B",score:.4},{col:1,row:"C",score:-1},{col:2,row:"B",score:.6},{col:3,row:"A",score:.6},{col:3,row:"B",score:.8},{col:3,row:"C",score:1}],x:function(e){return e.col},y:function(e){return e.row}}),r=n.ColorScale.continuous([-1,0,1],["#E13D3D","white","#2C8C11"]);t.setColor(function(e){return r(e.score)}),t.setVisualParams({xGapRelative:.1,yGapRelative:.1,xGapPixels:null,yGapPixels:null}),t.render(e),window.heatmap=t},tst.demo4=function(e){return t.__awaiter(this,void 0,void 0,function(){var i,s,u,c,l,d,f;return t.__generator(this,function(t){switch(t.label){case 0:return i=new URL(window.location).searchParams.get("uniprot-id"),o("#uniprot-id",s=i??"P06213"),[4,a(s)];case 1:if(!(u=t.sent()))throw o("#error","Error: "+(c=`Failed to fetch data for ${s}.`)),Error(c);return l=n.Heatmap.create({xDomain:(0,r.range)(1,u.n+1),yDomain:(0,r.range)(1,u.n+1),data:u.data,x:function(e,t){return t%u.n+1},y:function(e,t){return Math.floor(t/u.n)+1}}),d=n.ColorScale.continuous("Greens",[0,32],[1,0]),l.setColor(function(e){return d(e)}),l.setTooltip(null),l.setVisualParams({xGapRelative:0,yGapRelative:0}),null==(f=l.extensions.marker)||f.update({freeze:!0}),l.setBrushing({enabled:!0}),l.events.brush.subscribe(function(e){var t,r,n=e?.selection?`Scored residue (x): ${e.selection.xFirst}-${e.selection.xLast} / Aligned residue (y): ${e.selection.yFirst}-${e.selection.yLast}`:"None",i=e.selection?e.selection.xMinIndex/u.n:0,a=e.selection?(e.selection.xMaxIndex-e.selection.xMinIndex)/u.n:0,s=e.selection?e.selection.yMinIndex/u.n:0,c=e.selection?(e.selection.yMaxIndex-e.selection.yMinIndex)/u.n:0,l="end"===e.type?"#777777":"#aaaaaa";o("#selection",n),null==(t=document.getElementById("xindicator"))||t.setAttribute("style",`left: ${100*i}%; width: ${100*a}%; background-color: ${l};`),null==(r=document.getElementById("yindicator"))||r.setAttribute("style",`top: ${100*s}%; height: ${100*c}%; background-color: ${l};`)}),l.render(e),window.heatmap=l,[2]}})})};var t=Iot,r=Wot,n=e(),i=ast();function a(e,r){return t.__awaiter(this,void 0,void 0,function(){var r,n,i;return t.__generator(this,function(t){switch(t.label){case 0:return[4,fetch(`https://alphafold.ebi.ac.uk/files/AF-${e}-F1-predicted_aligned_error_v4.json`)];case 1:return(r=t.sent()).ok?[4,r.json()]:[2,void 0];case 2:return n=t.sent(),[2,{n:(i=n[0].predicted_aligned_error).length,data:i.flatMap(function(e){return e})}]}})})}function o(e,t,r){void 0===r&&(r=4);var n=document.querySelectorAll(e);"number"==typeof t&&r>
646=0&&(t=t.toFixed(r)),n.forEach(function(e){return e.textContent=`${t}`})}return tst}());var a=function(){if(Vvt)return sst;Vvt=1,Object.defineProperty(sst,"__esModule",{value:!0}),sst.Heatmap=void 0;var e=Iot,t=ast(),r=(mst||(mst=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BrushExtension=e.BrushBehavior=e.DefaultBrushExtensionParams=void 0;var t=Iot,r=lst(),n=t.__importStar(Uot()),i=hst(),a=vst();e.DefaultBrushExtensionParams={enabled:!1,snap:!0,closeButton:!0};var o=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.brushBehavior=n.brush().on("start",function(e){return t.handleBrushStart(e)}).on("brush",function(e){return t.handleBrushBrush(e)}).on("end",function(e){return t.handleBrushEnd(e)}),t}return t.__extends(i,e),Object.defineProperty(i.prototype,"svg",{get:function(){return this.state.dom?.svg},enumerable:!1,configurable:!0}),i.prototype.register=function(){var t=this;e.prototype.register.call(this),this.subscribe(this.state.events.render,function(){t.params.enabled&&t.addBrushBehavior()})},i.prototype.update=function(t){e.prototype.update.call(this,t),this.params.enabled&&!this.targetElement&&this.addBrushBehavior(),!this.params.enabled&&this.targetElement&&this.removeBrushBehavior(),this.currentSelection&&(this.params.snap&&(this.currentSelection=a.Box.snap(this.currentSelection,"out",this.state.boxes.wholeWorld),this.brushBehavior.move(this.targetElement,this.worldBoxToBrushSelection(this.currentSelection)),this.state.events.brush.next({type:"end",selection:this.state.worldBoxToBoxSelection(this.currentSelection),sourceEvent:void 0})),this.placeCloseButton(this.currentSelection))},i.prototype.unregister=function(){this.removeBrushBehavior(),e.prototype.unregister.call(this)},i.prototype.addBrushBehavior=function(){var e=this;this.svg&&(this.removeBrushBehavior(),this.targetElement=this.svg.append("g").attr("class","brush-target").call(this.brushBehavior),n.select(document).on("keydown.BrushExtension",function(t){"Escape"===t.key&&e.deselect(t)}))},i.prototype.removeBrushBehavior=function(){this.targetElement&&(this.state.events.brush.value.selection&&this.deselect(),this.targetElement.remove(),this.targetElement=void 0,n.select(document).on("keydown.BrushExtension",null))},i.prototype.handleBrushStart=function(e){if(e.sourceEvent){var t=this.brushSelectionToWorldBox(e.selection);this.placeCloseButton(void 0),this.currentBrushAction=t?.xmin===t?.xmax&&t?.ymin===t?.ymax?"create":"update",this.currentSelection=void 0,this.state.events.brush.next({type:"start",selection:this.state.worldBoxToBoxSelection(t),sourceEvent:e})}},i.prototype.handleBrushBrush=function(e){if(e.sourceEvent){var t=this.brushSelectionToWorldBox(e.selection);this.state.events.brush.next({type:"brush",selection:this.state.worldBoxToBoxSelection(t),sourceEvent:e})}},i.prototype.handleBrushEnd=function(e){if(e.sourceEvent){var t=this.brushSelectionToWorldBox(e.selection);if(this.params.snap){var r="update"===this.currentBrushAction?"nearest":"out";t=a.Box.snap(t,r,this.state.boxes.wholeWorld),this.brushBehavior.move(this.targetElement,this.worldBoxToBrushSelection(t))}this.placeCloseButton(t),this.state.events.brush.next({type:"end",selection:this.state.worldBoxToBoxSelection(t),sourceEvent:e}),this.currentSelection=t,this.currentBrushAction=void 0}},i.prototype.placeCloseButton=function(e){var t=this,n=e?{x:Math.min(this.state.scales.worldToSvg.x(e.xmax),this.state.boxes.svg.xmax-11.2),y:Math.max(this.state.scales.worldToSvg.y(e.ymin),this.state.boxes.svg.ymin+11.2)}:void 0;if(this.svg&&(this.svg.selectAll(`.${r.Class.BrushClose}`).remove(),this.params.closeButton&&n)){var i=this.svg.append("g").classed(r.Class.BrushClose,!0).attr("transform",`translate(${n.x} ${n.y}) scale(${16/24})`).on("mousemove",function(e){t.state.events.hover.next({cell:void 0,sourceEvent:e}),e.stopPropagation()}).on("click",function(e){t.deselect(),e.stopPropagation()});i.append("circle").classed("circle",!0).attr("cx",0).attr("cy",0).attr("r",14),i.append("path").classed("cross",!0).attr("d","M7,-5.59 L5.59,-7 L0,-1.41 L-5.59,-7 L-7,-5.59 L-1.41,0 L-7,5.59 L-5.59,7 L0,1.41 L5.59,7 L7,5.59 L1.41,0 L7,-5.59 Z")}},i.prototype.deselect=function(e){this.brushBehavior.clear(this.targetElement),this.placeCloseButton(void 0),this.state.events.brush.next({type:"end",selection:void 0,sourceEvent:e}),this.currentSelection=void 0},i.prototype.brushSelectionToWorldBox=function(e){if(e){var t=e[0],r=t[0],n=t[1],i=e[1],a=i[0],o=i[1],s=this.state.scales.svgToWorld;return{xmin:s.x(r),xmax:s.x(a),ymin:s.y(n),ymax:s.y(o)}}},i.prototype.worldBoxToBrushSelection=function(e){if(!e)return null;var t=this.state.scales.worldToSvg;return[[t.x(e.xmin),t.y(e.ymin)],[t.x(e.xmax),t.y(e.ymax)]]},i}(i.BehaviorBase);e.BrushBehavior=o,e.BrushExtension=i.Extension.fromBehaviorClass({name:"builtin.brush",defaultParams:e.DefaultBrushExtensionParams,behavior:o})}(ust)),ust),n=(_st||(_st=1,function(e){Object.defineProperty(e,"__esMo
646dule",{value:!0}),e.DrawExtension=e.DrawBehavior=e.DefaultDrawExtensionParams=void 0;var t=Iot,r=Wot,n=ist(),i=Dot,a=function(){if(bst)return Sst;bst=1,Object.defineProperty(Sst,"__esModule",{value:!0}),Sst.Downsampler=void 0;var e=ist(),t=Ast();function r(e){return`${e.x}x${e.y}`}function n(e,t){for(var r=1;r<t&&r<e;)r=Math.min(2*r,e);return r}function i(e,t){return e.downsampled[r(t)]}function a(e,t,n){e.downsampled[r(t)]=n}function o(r,n){var u=i(r,n);if(u)return u;var c=function(e,t){if(e.x>t.x||e.y>t.y)throw Error("ArgumentError: Cannot downsample to higher resolution than original");if(e.x!==t.x||e.y!==t.y)return e.x===t.x||e.y!==t.y&&e.x>e.y?{x:e.x,y:Math.min(2*e.y,t.y)}:{x:Math.min(2*e.x,t.x),y:e.y}}(n,{x:r.nColumns,y:r.nRows});if(!c||c.x>r.nColumns||c.y>r.nRows)throw Error("AssertionError");var l,d,f=(l=o(r,c),d=n,"image"===r.mode?function(e,r){return e.nColumns===2*r.x&&e.nRows===r.y?function(e){var r=e.nColumns,n=e.nRows,i=Math.floor(r/2),a=n;t.Image.validateLength(e);for(var o=new Uint8ClampedArray(a*i*4),s=0;s<a;s++)for(var u=0;u<i;u++){var c=4*(s*r+2*u),l=4*(s*r+2*u+1),d=4*(s*i+u);o[d]=.5*(e.values[c]+e.values[l]),o[d+1]=.5*(e.values[c+1]+e.values[l+1]),o[d+2]=.5*(e.values[c+2]+e.values[l+2]),o[d+3]=.5*(e.values[c+3]+e.values[l+3])}return{nColumns:i,nRows:a,values:o}}(e):e.nColumns===r.x&&e.nRows===2*r.y?function(e){var r=e.nColumns,n=e.nRows,i=r,a=Math.floor(n/2);t.Image.validateLength(e);for(var o=new Uint8ClampedArray(a*i*4),s=0;s<a;s++)for(var u=0;u<i;u++){var c=4*(2*s*r+u),l=4*((2*s+1)*r+u),d=4*(s*i+u);o[d]=.5*(e.values[c]+e.values[l]),o[d+1]=.5*(e.values[c+1]+e.values[l+1]),o[d+2]=.5*(e.values[c+2]+e.values[l+2]),o[d+3]=.5*(e.values[c+3]+e.values[l+3])}return{nColumns:i,nRows:a,values:o}}(e):function(e,r){var n=e.nColumns,i=e.nRows,a=r.x,o=r.y;t.Image.validateLength(e);for(var u=s(n,a),c=s(i,o),l=new Uint8ClampedArray(o*a*4),d=0;d<c.from.length;d++)for(var f=0;f<u.from.length;f++){var h=4*(c.from[d]*n+u.from[f]),p=4*(c.to[d]*a+u.to[f]),m=c.weight[d]*u.weight[f],g=e.values[h],v=e.values[h+1],y=e.values[h+2],b=e.values[h+3];l[p]+=g*m,l[p+1]+=v*m,l[p+2]+=y*m,l[p+3]+=b*m}return{nColumns:a,nRows:o,values:l}}(e,r)}(l,d):function(t,r){return t.nColumns===2*r.x&&t.nRows===r.y?function(t){var r=t.nColumns,n=t.nRows,i=Math.floor(r/2),a=n;e.Array2D.validateLength(t);for(var o=new Float32Array(i*a),s=0;s<a;s++)for(var u=0;u<i;u++){var c=t.values[s*r+2*u],l=t.values[s*r+2*u+1];if(void 0===c||void 0===l)throw Error("NotImplementedError: undefined values in data");var d=.5*(c+l);o[s*i+u]=d}return{nColumns:i,nRows:a,values:o,isNumeric:!0}}(t):t.nColumns===r.x&&t.nRows===2*r.y?function(t){var r=t.nColumns,n=t.nRows,i=r,a=Math.floor(n/2);e.Array2D.validateLength(t);for(var o=new Float32Array(i*a),s=0;s<a;s++)for(var u=0;u<i;u++){var c=t.values[2*s*r+u],l=t.values[(2*s+1)*r+u];if(void 0===c||void 0===l)throw Error("NotImplementedError: undefined values in data");var d=.5*(c+l);o[s*i+u]=d}return{nColumns:i,nRows:a,values:o,isNumeric:!0}}(t):function(t,r){var n=t.nColumns,i=t.nRows,a=r.x,o=r.y;e.Array2D.validateLength(t);for(var u=s(n,a),c=s(i,o),l=new Float32Array(o*a),d=0;d<c.from.length;d++)for(var f=c.from[d]*n,h=c.to[d]*a,p=c.weight[d],m=0;m<u.from.length;m++){var g=t.values[f+u.from[m]];if(void 0===g)throw Error("NotImplementedError: undefined values in data");l[h+u.to[m]]+=g*p*u.weight[m]}return{nColumns:a,nRows:o,values:l,isNumeric:!0}}(t,r)}(l,d));return a(r,n,f),f}function s(e,t){for(var r=t/e,n=0,i=0,a=0,o=[],s=[],u=[];a<t;){var c=r*(n+1),l=i+1;c<=l?(o.push(n),s.push(i),u.push(c-a),a=c,n+=1,c===l&&(i+=1)):(o.push(n),s.push(i),u.push(l-a),a=l,i+=1)}return{from:o,to:s,weight:u}}return Sst.Downsampler={fromNumbers:function(e){var t={mode:"number",nColumns:e.nColumns,nRows:e.nRows,downsampled:{}};return a(t,{x:e.nColumns,y:e.nRows},e),t},fromImage:function(e){var t={mode:"image",nColumns:e.nColumns,nRows:e.nRows,downsampled:{}};return a(t,{x:e.nColumns,y:e.nRows},e),t},getOriginal:function(e){return i(e,{x:e.nColumns,y:e.nRows})},getDownsampled:function(e,t){return o(e,{x:n(e.nColumns,t.x),y:n(e.nRows,t.y)})}},Sst}
646(),o=Ast(),s=hst(),u=vst(),c=Kot(),l=i.Color.fromString("#888888");e.DefaultDrawExtensionParams={colorProvider:function(){return l},xGapPixels:2,xGapRelative:.1,yGapPixels:2,yGapRelative:.1,minRectSizeForGaps:2};var d=function(e){function s(){var t=null!==e&&e.apply(this,arguments)||this;return t.downsamplingPixelsPerRect=1,t._drawer=(0,c.Refresher)(function(){return t._draw()}),t}return t.__extends(s,e),s.prototype.register=function(){var t=this;e.prototype.register.call(this),this.subscribe(this.state.events.render,function(){if(t.state.dom){var e=t.state.dom.canvas.node()?.getContext("2d");if(!e)throw Error("Failed to initialize canvas");t.ctx=e,t.state.dom.svg.on("mouseenter.DrawExtension",function(){return t.requestDraw()})}}),this.subscribe(this.state.events.zoom,function(){t.requestDraw()}),this.subscribe(this.state.events.resize,function(){t.requestDraw()}),this.subscribe(this.state.events.data,function(){t.downsampler=void 0,t.requestDraw()})},s.prototype.update=function(t){t.colorProvider!==this.params.colorProvider&&(this.downsampler=void 0),e.prototype.update.call(this,t),this.requestDraw()},s.prototype.unregister=function(){this.state.dom&&this.state.dom.svg.on("mouseenter.DrawExtension",null),e.prototype.unregister.call(this)},s.prototype.computeFullImage=function(){for(var e=o.Image.create(this.state.dataArray.nColumns,this.state.dataArray.nRows),t=0;t<this.state.dataArray.nRows;t++)for(var r=0;r<this.state.dataArray.nColumns;r++){var a=n.Array2D.get(this.state.dataArray,r,t);if(void 0!==a){var s=this.params.colorProvider(a,this.state.xDomain.values[r],this.state.yDomain.values[t],r,t),u="string"==typeof s?i.Color.fromString(s):s;o.Image.setColor(e,r,t,u)}}return e},s.prototype._draw=function(){if(this.state.dom){var e=u.Box.width(this.state.boxes.canvasContext)/this.downsamplingPixelsPerRect,t=u.Box.height(this.state.boxes.canvasContext)/this.downsamplingPixelsPerRect;this.downsampler??=a.Downsampler.fromImage(this.computeFullImage());var r=a.Downsampler.getDownsampled(this.downsampler,{x:e*u.Box.width(this.state.boxes.wholeWorld)/u.Box.width(this.state.boxes.visWorld),y:t*u.Box.height(this.state.boxes.wholeWorld)/u.Box.height(this.state.boxes.visWorld)});return this.drawThisImage(r,this.state.dataArray.nColumns/r.nColumns,this.state.dataArray.nRows/r.nRows)}},s.prototype.requestDraw=function(){this._drawer.requestRefresh()},s.prototype.getCleanCanvasImage=function(){if(!this.ctx)throw Error("`getCanvasImage` should only be called after canvas is initialized");var e=Math.floor(this.ctx.canvas.width),t=Math.floor(this.ctx.canvas.height);return this._canvasImage&&this._canvasImage.nColumns===e&&this._canvasImage.nRows===t?o.Image.clear(this._canvasImage):this._canvasImage=o.Image.create(e,t),this._canvasImage},s.prototype.getCanvasImageData=function(){if(!this.ctx)throw Error("`getCanvasImageData` should only be called after canvas is initialized");var e=Math.floor(this.ctx.canvas.width),t=Math.floor(this.ctx.canvas.height);return this._canvasImageData&&this._canvasImageData.width===e&&this._canvasImageData.height===t||(this._canvasImageData=new ImageData(e,t)),this._canvasImageData},s.prototype.drawThisImage=function(e,t,n){if(this.state.dom&&this.ctx){this.resizeCanvas();var i=(0,u.scaleDistance)(this.state.scales.worldToCanvasContext.x,1)*t,a=(0,u.scaleDistance)(this.state.scales.worldToCanvasContext.y,1)*n,s=u.Box.width(this.state.boxes.canvasContext)>this.params.minRectSizeForGaps*u.Box.width(this.state.boxes.visWorld),c=u.Box.height(this.state.boxes.canvasContext)>this.params.minRectSizeForGaps*u.Box.height(this.state.boxes.visWorld),l=s?.5*this.getXGap(i):0,d=c?.5*this.getYGap(a):0,f=(s?1:1-this.getXGap(i)/i)*(c?1:1-this.getYGap(a)/a);this.state.dom.canvas.style("opacity",f);for(var h=(0,r.clamp)(Math.floor(this.state.boxes.visWorld.xmin/t),0,e.nColumns),p=(0,r.clamp)(Math.ceil(this.state.boxes.visWorld.xmax/t),0,e.nColumns),m=(0,r.clamp)(Math.floor(this.state.boxes.visWorld.ymin/n),0,e.nRows),g=(0,r.clamp)(Math.ceil(this.state.boxes.visWorld.ymax/n),0,e.nRows),v=this.getCleanCanvasImage(),y=m;y<g;y++)for(var b=this.state.scales.worldToCanvasContext.y(y*n),_=b+d,x=b+a-d,S=h;S<p;S++){var w=this.state.scales.worldToCanvasContext.x(S*t),A=w+l,C=w+i-l,T=o.Image.getColor(e,S,y);o.Image.addRect(v,A,_,C,x,T)}var P=o.Image.toImageData(v,this.getCanvasImageData());this.ctx.clearRect(0,0,u.Box.width(this.state.boxes.canvasContext),u.Box.height(this.state.boxes.canvasContext)),this.ctx.putImageData(P,0,0
646)}},s.prototype.resizeCanvas=function(){if(this.ctx){var e=Math.floor(u.Box.width(this.state.boxes.canvasContext)),t=Math.floor(u.Box.height(this.state.boxes.canvasContext));this.ctx.canvas.width!==e&&(this.ctx.canvas.width=e),this.ctx.canvas.height!==t&&(this.ctx.canvas.height=t)}},s.prototype.getXGap=function(e){var t=(0,r.isNil)(this.params.xGapPixels)?void 0:this.params.xGapPixels,n=(0,r.isNil)(this.params.xGapRelative)?void 0:this.params.xGapRelative*e;return(0,r.clamp)((0,c.minimum)(t,n)??0,0,e)},s.prototype.getYGap=function(e){var t=(0,r.isNil)(this.params.yGapPixels)?void 0:this.params.yGapPixels,n=(0,r.isNil)(this.params.yGapRelative)?void 0:this.params.yGapRelative*e;return(0,r.clamp)((0,c.minimum)(t,n)??0,0,e)},s}(s.BehaviorBase);e.DrawBehavior=d,e.DrawExtension=s.Extension.fromBehaviorClass({name:"builtin.draw",defaultParams:e.DefaultDrawExtensionParams,behavior:d})}(xst)),xst),i=(Cst||(Cst=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MarkerExtension=e.MarkerBehavior=e.DefaultMarkerExtensionParams=void 0;var t=Iot,r=lst(),n=hst(),i=vst(),a=Kot();e.DefaultMarkerExtensionParams={markerCornerRadius:1,freeze:!1};var o=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.currentlyMarked={xIndex:void 0,yIndex:void 0},t}return t.__extends(n,e),n.prototype.register=function(){var t=this;e.prototype.register.call(this),this.subscribe(this.state.events.hover,function(e){if(!t.params.freeze){var r=void 0!==e.cell?.datum;t.drawMarkers(r?e.cell:void 0)}}),this.subscribe(this.state.events.resize,function(){t.drawMarkers(t.currentlyMarked)}),this.subscribe(this.state.events.zoom,function(){t.drawMarkers(t.currentlyMarked)})},n.prototype.drawMarkers=function(e){if(this.state.dom){var t=void 0===e?.xIndex?this.state.xDomain.index.get(e?.x):e.xIndex,n=void 0===e?.yIndex?this.state.yDomain.index.get(e?.y):e.yIndex;this.currentlyMarked.xIndex=t,this.currentlyMarked.yIndex=n;var a=void 0===t?void 0:this.state.scales.worldToSvg.x(t),o=void 0===n?void 0:this.state.scales.worldToSvg.y(n),s=(0,i.scaleDistance)(this.state.scales.worldToSvg.x,1),u=(0,i.scaleDistance)(this.state.scales.worldToSvg.y,1),c={rx:this.params.markerCornerRadius,ry:this.params.markerCornerRadius};void 0===a?this.removeMarker(r.Class.MarkerX):this.addOrUpdateMarker(r.Class.MarkerX,c,{x:a,y:this.state.boxes.svg.ymin,width:s,height:i.Box.height(this.state.boxes.svg)}),void 0===o?this.removeMarker(r.Class.MarkerY):this.addOrUpdateMarker(r.Class.MarkerY,c,{x:this.state.boxes.svg.xmin,y:o,width:i.Box.width(this.state.boxes.svg),height:u}),void 0!==a&&void 0!==o?this.addOrUpdateMarker(r.Class.Marker,c,{x:a,y:o,width:s,height:u}):this.removeMarker(r.Class.Marker)}},n.prototype.addOrUpdateMarker=function(e,r,n){if(this.state.dom){var i=this.state.dom.svg.selectAll("."+e).data([1]);(0,a.attrd)(i.enter().append("rect"),t.__assign(t.__assign({class:e},r),n)),(0,a.attrd)(i,n)}},n.prototype.removeMarker=function(e){this.state.dom&&this.state.dom.svg.selectAll("."+e).remove()},n}(n.BehaviorBase);e.MarkerBehavior=o,e.MarkerExtension=n.Extension.fromBehaviorClass({name:"builtin.marker",defaultParams:e.DefaultMarkerExtensionParams,behavior:o})}(Est)),Est),a=(Tst||(Tst=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TooltipExtension=e.TooltipBehavior=e.DefaultTooltipExtensionParams=void 0;var t=Iot,r=lst(),n=hst(),i=vst(),a=Kot();e.DefaultTooltipExtensionParams={tooltipProvider:function(e,t,r,n,i){return`x: ${JSON.stringify(t)} (index ${n}) <br> y: ${JSON.stringify(r)} (index ${i}) <br> datum: ${JSON.stringify(e)}`},pinnable:!0};var o=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.pinnedTooltip=void 0,t}return t.__extends(n,e),n.prototype.register=function(){var t=this;e.prototype.register.call(this),this.subscribe(this.state.events.hover,function(e){return t.drawTooltip(e)}),this.subscribe(this.state.events.select,function(e){return t.drawPinnedTooltip(e)}),this.subscribe(this.state.events.zoom,function(){return t.updatePinnedTooltipPosition()}),this.subscribe(this.state.events.resize,function(){return t.updatePinnedTooltipPosition()})},n.prototype.drawTooltip=function(e){if(this.state.dom){var n=e.cell&&this.pinnedTooltip&&e.cell.xIndex===Math.floor(this.pinnedTooltip.x)&&e.cell.yIndex===Math.floor(this.pinnedTooltip.y);if(void 0!==e.cell?.datum&&!n&&this.params.tooltipProvider&&e.sourceEvent){var i=this.getTooltipPosition(e.sourceEvent),o=this.params.tooltipProvider(e.cell.datum,e.cell.x,e.cell.y,e.cell.xIndex,e.cell.yIndex),s=this.state.dom.canvasDiv.selectAll("."+r.Class.TooltipBox
646);s.empty()?(s=(0,a.attrd)(this.state.dom.canvasDiv.append("div"),{class:r.Class.TooltipBox,style:t.__assign({position:"absolute"},i)}),(0,a.attrd)(s.append("div"),{class:r.Class.TooltipContent}).html(o)):(0,a.attrd)(s,{style:i}).select("."+r.Class.TooltipContent).html(o)}else this.state.dom.canvasDiv.selectAll("."+r.Class.TooltipBox).remove()}},n.prototype.drawPinnedTooltip=function(e){var n=this;if(this.state.dom)if(this.state.dom.canvasDiv.selectAll("."+r.Class.PinnedTooltipBox).remove(),void 0!==e.cell?.datum&&this.params.tooltipProvider&&this.params.pinnable&&e.sourceEvent){this.pinnedTooltip={x:this.state.scales.svgToWorld.x(e.sourceEvent.offsetX),y:this.state.scales.svgToWorld.y(e.sourceEvent.offsetY)};var i=this.getTooltipPosition(e.sourceEvent),o=this.params.tooltipProvider(e.cell.datum,e.cell.x,e.cell.y,e.cell.xIndex,e.cell.yIndex),s=(0,a.attrd)(this.state.dom.canvasDiv.append("div"),{class:r.Class.PinnedTooltipBox,style:t.__assign({position:"absolute"},i)});(0,a.attrd)(s.append("div"),{class:r.Class.PinnedTooltipContent}).html(o),(0,a.attrd)(s.append("div"),{class:r.Class.PinnedTooltipClose}).on("click.TooltipExtension",function(e){return n.state.events.select.next({cell:void 0,sourceEvent:e})}).append("svg").attr("viewBox","0 0 24 24").attr("preserveAspectRatio","none").append("path").attr("d","M19,6.41 L17.59,5 L12,10.59 L6.41,5 L5,6.41 L10.59,12 L5,17.59 L6.41,19 L12,13.41 L17.59,19 L19,17.59 L13.41,12 L19,6.41 Z"),(0,a.attrd)(s.append("svg"),{class:r.Class.PinnedTooltipPin}).attr("viewBox","0 0 100 100").attr("preserveAspectRatio","none").append("path").attr("d","M0,100 L100,40 L60,0 Z"),this.drawTooltip({cell:void 0,sourceEvent:e.sourceEvent})}else this.pinnedTooltip=void 0},n.prototype.updatePinnedTooltipPosition=function(){if(this.state.dom&&this.pinnedTooltip){var e={offsetX:this.state.scales.worldToSvg.x(this.pinnedTooltip.x),offsetY:this.state.scales.worldToSvg.y(this.pinnedTooltip.y)};(0,a.attrd)(this.state.dom.canvasDiv.selectAll("."+r.Class.PinnedTooltipBox),{style:this.getTooltipPosition(e)})}},n.prototype.getTooltipPosition=function(e){return{left:`${e.offsetX??0}px`,bottom:i.Box.height(this.state.boxes.svg)-(e.offsetY??0)+"px",display:i.Box.containsPoint(this.state.boxes.svg,{x:e.offsetX,y:e.offsetY})?"unset":"none"}},n}(n.BehaviorBase);e.TooltipBehavior=o,e.TooltipExtension=n.Extension.fromBehaviorClass({name:"builtin.tooltip",defaultParams:e.DefaultTooltipExtensionParams,behavior:o})}(Mst)),Mst),o=(Pvt||(Pvt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ZoomExtension=e.ZoomBehavior=e.DefaultZoomExtensionParams=void 0;var t=Iot,r=lst(),n=t.__importStar(Uot()),i=hst(),a=vst(),o=zvt(),s=Kot();e.DefaultZoomExtensionParams={axis:"none",scrollRequireCtrl:!1,zoomSensitivity:1,panSensitivity:.6,minZoomedDatapoints:1};var u=function(i){function u(){var e=null!==i&&i.apply(this,arguments)||this;return e.currentWheelGesture={lastTimestamp:0,lastAbsDelta:0,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1},e.suppressEmit=!1,e}return t.__extends(u,i),Object.defineProperty(u.prototype,"targetElement",{get:function(){return this.state.dom?.svg},enumerable:!1,configurable:!0}),u.prototype.register=function(){var t=this;i.prototype.register.call(this),this.subscribe(this.state.events.render,function(){return t.addZoomBehavior()}),this.subscribe(this.state.events.data,function(){t.adjustZoomExtent(),t.adjustZoom()}),this.subscribe(this.state.events.resize,function(){t.adjustZoomExtent(),t.adjustZoom()}),this.subscribe(this.state.events.zoom,function(r){r?.origin!==e.ZoomExtension.name&&t.adjustZoom()})},u.prototype.update=function(e){var t=void 0!==e.axis&&e.axis!==this.params.axis;i.prototype.update.call(this,e),t&&this.addZoomBehavior(),this.adjustZoomExtent(),this.adjustZoom()},u.prototype.addZoomBehavior=function(){var e=this;this.targetElement&&(this.zoomBehavior&&=(this.zoomBehavior.on("zoom",null),this.targetElement.on(".zoom",null),void this.targetElement.on(".customzoom",null)),"none"!==this.params.axis&&(this.zoomBehavior=n.zoom(),this.zoomBehavior.filter(function(t){return!(t instanceof WheelEvent)||"zoom"===e.wheelAction(t).kind}),this.zoomBehavior.wheelDelta(function(t){var r=e.wheelAction(t);return"zoom"===r.kind?e.params.zoomSensitivity*r.delta:0}),this.zoomBehavior.on("zoom",function(t){return e.handleZoom(t)}),this.targetElement.call(this.zoomBehavior),this.targetElement.on("wheel.customzoom",function(t){return e.handleWheel(t)})))},u.prototype.handleZoom=function(t){var r=this.zoomTransformToVisWorld(t.transform);this.state.zoomVisWorldBox(r,e.ZoomExtension.name,!this.suppressEmit),t.sourceEvent&&this.state.events.hover.next({cell:this.state.getPointedCell(t.sourceEvent),sourceEvent:t.sourceEvent})},u.prototype.handleWheel=function(e){if(this.targetElement){if(e.preventDefault(),this.updateCurrentWheelGesture(e),this.zoomBehavior){var t=this.wheelAction(e);if("pan"===t.kind){var r=this.params.panSensitivity*(0,a.scaleDistance)(this.state.scales.svgToWorld.x,t.deltaX);this.zoomBehavior.duration(1e3).translateBy(this.targetElement,r,0)}"showHelp"===t.kind&&this.showScrollingMessage()}this.state.events.hover.next({cell:this.state.getPointedCell(e),sourceEvent:e})}},u.prototype.updateCurrentWheelGesture=function(e){var t=Date.now(),r=Math.max(Math.abs(e.deltaX),Math.abs(e.deltaY));(t>this.currentWheelGesture.lastTimestamp+150||r>this.currentWheelGesture.lastAbsDelta+1)&&(this.currentWheelGesture.ctrlKey=e.ctrlKey,this.currentWheelGesture.shiftKey=e.shiftKey,this.currentWheelGesture.altKey=e.altKey,this.currentWheelGesture.metaKey=e.metaKey),this.currentWheelGesture.lastTimestamp=t,this.currentWheelGesture.lastAbsDelta=r},u.prototype.adjustZoomExtent=function(){if(this.state.dom&&this.zoomBehavior){this.zoomBehavior.translateExtent([[this.state.boxes.wholeWorld.xmin,-1/0],[this.state.boxes.wholeWorld.xmax,1/0]]);var e=a.Box.width(this.state.boxes.svg),t=e/a.Box.width(this.state.boxes.wholeWorld),r=M
646ath.max(this.params.minZoomedDatapoints,o.MIN_ZOOMED_DATAPOINTS_HARD),n=Math.max(e/r,t);this.zoomBehavior.scaleExtent([t,n]),this.zoomBehavior.extent([[this.state.boxes.svg.xmin,this.state.boxes.svg.ymin],[this.state.boxes.svg.xmax,this.state.boxes.svg.ymax]])}},u.prototype.adjustZoom=function(){if(this.targetElement&&this.zoomBehavior){var e=this.visWorldToZoomTransform(this.state.boxes.visWorld);this.suppressEmit=!0,this.zoomBehavior.transform(this.targetElement,e),this.suppressEmit=!1}},u.prototype.zoomTransformToVisWorld=function(e){return t.__assign(t.__assign({},this.state.boxes.visWorld),{xmin:(this.state.boxes.svg.xmin-e.x)/e.k,xmax:(this.state.boxes.svg.xmax-e.x)/e.k})},u.prototype.visWorldToZoomTransform=function(e){var t=(this.state.boxes.svg.xmax-this.state.boxes.svg.xmin)/(e.xmax-e.xmin),r=this.state.boxes.svg.xmin-t*e.xmin;return new n.ZoomTransform(t,r,0)},u.prototype.showScrollingMessage=function(){if(this.state.dom&&this.state.dom.mainDiv.selectAll(`.${r.Class.Overlay}`).empty()){var e=(0,s.attrd)(this.state.dom.mainDiv.append("div"),{class:r.Class.Overlay});(0,s.attrd)(e.append("div"),{class:r.Class.OverlayShade}),(0,s.attrd)(e.append("div"),{class:r.Class.OverlayMessage}).text("Press Ctrl and scroll to apply zoom"),setTimeout(function(){return e.remove()},750)}},u.prototype.wheelAction=function(e){var t=Math.abs(e.deltaX)>Math.abs(e.deltaY),r=Math.abs(e.deltaX)<Math.abs(e.deltaY),n=1===e.deltaMode?25:e.deltaMode?500:1,i=this.params.scrollRequireCtrl?1:this.currentWheelGesture.ctrlKey||this.currentWheelGesture.metaKey?10:1;return t?{kind:"pan",deltaX:-e.deltaX*n*i,deltaY:0}:r?this.currentWheelGesture.shiftKey?{kind:"pan",deltaX:-e.deltaY*n*i,deltaY:0}:!this.params.scrollRequireCtrl||this.currentWheelGesture.ctrlKey||this.currentWheelGesture.metaKey?{kind:"zoom",delta:.002*-e.deltaY*n*i}:Math.abs(e.deltaY)*n>=5?{kind:"showHelp"}:{kind:"ignore"}:{kind:"ignore"}},u}(i.BehaviorBase);e.ZoomBehavior=u,e.ZoomExtension=i.Extension.fromBehaviorClass({name:"builtin.zoom",defaultParams:e.DefaultZoomExtensionParams,behavior:u})}(kst)),kst);return sst.Heatmap=function(s){function u(){var e=null!==s&&s.apply(this,arguments)||this;return e.extensions={},e}return e.__extends(u,s),Object.defineProperty(u.prototype,"events",{get:function(){return this.state.events},enumerable:!1,configurable:!0}),u.create=function(e){void 0===e&&(e=t.DataDescription.empty());var s=new this(e);return s.extensions.marker=s.registerExtension(i.MarkerExtension),s.extensions.tooltip=s.registerExtension(a.TooltipExtension),s.extensions.draw=s.registerExtension(n.DrawExtension),s.extensions.zoom=s.registerExtension(o.ZoomExtension),s.extensions.brush=s.registerExtension(r.BrushExtension),s},u.prototype.setData=function(e){return this.state.setData(e),this},u.prototype.setDomains=function(t,r){return this.setData(e.__assign(e.__assign({},this.state.originalData),{xDomain:t??this.state.originalData.xDomain,yDomain:r??this.state.originalData.yDomain})),this},u.prototype.setFilter=function(t){return this.setData(e.__assign(e.__assign({},this.state.originalData),{filter:t})),this},u.prototype.setColor=function(e){var t;return null==(t=this.extensions.draw)||t.update({colorProvider:e}),this},u.prototype.setTooltip=function(e){var t;return null==(t=this.extensions.tooltip)||t.update({tooltipProvider:"default"===e?a.DefaultTooltipExtensionParams.tooltipProvider:e}),this},u.prototype.setVisualParams=function(e){var t,r;return null==(t=this.extensions.draw)||t.update({xGapPixels:e.xGapPixels,xGapRelative:e.xGapRelative,yGapPixels:e.yGapPixels,yGapRelative:e.yGapRelative,minRectSizeForGaps:e.minRectSizeForGaps}),null==(r=this.extensions.marker)||r.update({markerCornerRadius:e.markerCornerRadius}),this},u.prototype.setZooming=function(e){var t;return null==(t=this.extensions.zoom)||t.update(e),this},u.prototype.setAlignment=function(e,t){return this.state.setAlignment(e,t),this},u.prototype.zoom=function(e){return this.state.zoom(e)},u.prototype.getZoom=function(){return this.state.getZoom()},u.prototype.setBrushing=function(e){var t;return null==(t=this.extensions.brush)||t.update(e),this},u}(function(){if(Gvt)return qvt;
646Gvt=1,Object.defineProperty(qvt,"__esModule",{value:!0}),qvt.HeatmapCore=void 0;var e=Iot,t=lst(),r=e.__importStar(Uot()),n=vst(),i=zvt(),a=Kot();return qvt.HeatmapCore=function(){function e(e){var t=this;this.state=new i.State(e),this.state.events.resize.subscribe(function(e){if(e){var r=t.state.canvasScale;t.state.boxes.svg=n.Box.create(0,0,e.width,e.height),t.state.boxes.canvasContext=n.Box.create(0,0,r*e.width,r*e.height),t.state.scales=(0,n.Scales)(t.state.boxes)}}),this.state.events.hover.subscribe(function(e){return t.state.dom?.svg.attr("pointing-data",void 0===e.cell?.datum?null:"")})}return e.prototype.updateCanvasScale=function(){var e=(null==window?void 0:window.devicePixelRatio)??1;e!==this.state.canvasScale&&(this.state.canvasScale=e,this.state.events.resize.next(this.state.events.resize.value))},e.prototype.registerExtension=function(e,t){var r=e.create(this.state,t);return r.register(),r},e.prototype.render=function(e){var n=this;if(this.state.dom)throw console.error(`This ${this.constructor.name} has already been rendered in element`,this.state.dom.rootDiv.node()),Error(`This ${this.constructor.name} has already been rendered. Cannot render again.`);var i="string"==typeof e?r.select(`#${e}`):r.select(e);if(i.empty())throw Error("Failed to initialize, wrong div ID?");this.remove();var o=(0,a.attrd)(i.append("div"),{class:t.Class.MainDiv,style:{position:"relative",width:"100%",height:"100%"}}),s=(0,a.attrd)(o.append("div"),{class:t.Class.CanvasDiv,style:{position:"absolute",width:"100%",height:"100%"}}),u=(0,a.attrd)(s.append("canvas"),{class:t.Class.Canvas,width:100,height:100,style:{position:"absolute",width:"100%",height:"100%"}}),c=(0,a.attrd)(s.append("svg"),{class:t.Class.Svg,style:{position:"absolute",width:"100%",height:"100%"}});this.state.dom={rootDiv:i,mainDiv:o,canvasDiv:s,canvas:u,svg:c},c.on("mousemove.heatmapcore",function(e){return n.state.events.hover.next({cell:n.state.getPointedCell(e),sourceEvent:e})}),c.on("mouseleave.heatmapcore",function(e){return n.state.events.hover.next({cell:void 0,sourceEvent:e})}),c.on("click.heatmapcore",function(e){return n.state.events.select.next({cell:n.state.getPointedCell(e),sourceEvent:e})}),this.state.events.render.next(void 0),this.sizeObserver=new ResizeObserver(function(){return n.state.emitResize()});for(var l=0,d=u.nodes();l<d.length;l++){var f=d[l];this.sizeObserver.observe(f)}return this.updateCanvasScale(),r.select(window).on("resize.updateCanvasScale",function(){return n.updateCanvasScale()}),this},e.prototype.remove=function(){var e;null==(e=this.sizeObserver)||e.disconnect(),this.sizeObserver=void 0,this.state.dom&&this.state.dom.rootDiv.select("*").remove()},e}(),qvt}().HeatmapCore),sst}();Object.defineProperty(t,"Heatmap",{enumerable:!0,get:function(){return a.Heatmap}})}(kot)),kot}(),Xvt=globalThis,Yvt=Xvt.ShadowRoot&&(void 0===Xvt.ShadyCSS||Xvt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Kvt=Symbol(),Zvt=new WeakMap,Qvt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Kvt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Yvt&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=Zvt.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Zvt.set(t,e))}return e}toString(){return this.cssText}},Jvt=Yvt?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new Qvt("string"==typeof e?e:e+"",void 0,Kvt))(t)})(e):e,{is:eyt,defineProperty:tyt,getOwnPropertyDescriptor:ryt,getOwnPropertyNames:nyt,getOwnPropertySymbols:iyt,getPrototypeOf:ayt}=Object,oyt=globalThis,syt=oyt.trustedTypes,uyt=syt?syt.emptyScript:"",cyt=oyt.reactiveElementPolyfillSupport,lyt=(e,t)=>e,dyt={toAttribute(e,t){switch(t){case Boolean:e=e?uyt:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},fyt=(e,t)=>
646!eyt(e,t),hyt={attribute:!0,type:String,converter:dyt,reflect:!1,hasChanged:fyt};Symbol.metadata??=Symbol("metadata"),oyt.litPropertyMetadata??=new WeakMap;var pyt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=hyt){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&tyt(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=ryt(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??hyt}static _$Ei(){if(this.hasOwnProperty(lyt("elementProperties")))return;let e=ayt(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(lyt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(lyt("properties"))){let e=this.properties,t=[...nyt(e),...iyt(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(Jvt(e))}else void 0!==e&&t.push(Jvt(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Yvt)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=Xvt.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?dyt:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?dyt:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??fyt)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e
646=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};pyt.elementStyles=[],pyt.shadowRootOptions={mode:"open"},pyt[lyt("elementProperties")]=new Map,pyt[lyt("finalized")]=new Map,cyt?.({ReactiveElement:pyt}),(oyt.reactiveElementVersions??=[]).push("2.0.4");var myt=globalThis,gyt=myt.trustedTypes,vyt=gyt?gyt.createPolicy("lit-html",{createHTML:e=>e}):void 0,yyt="$lit$",byt=`lit$${Math.random().toFixed(9).slice(2)}$`,_yt="?"+byt,xyt=`<${_yt}>`,Syt=document,wyt=()=>Syt.createComment(""),Ayt=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Cyt=Array.isArray,Tyt="[ \t\n\f\r]",Pyt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Eyt=/-->/g,Myt=/>/g,kyt=RegExp(`>|${Tyt}(?:([^\\s"'>=/]+)(${Tyt}*=${Tyt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Iyt=/'/g,Dyt=/"/g,Oyt=/^(?:script|style|textarea|title)$/i,Ryt=(e,...t)=>({_$litType$:1,strings:e,values:t}),Byt=Symbol.for("lit-noChange"),Nyt=Symbol.for("lit-nothing"),Fyt=new WeakMap,Lyt=Syt.createTreeWalker(Syt,129);function $yt(e,t){if(!Cyt(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===vyt?t:vyt.createHTML(t)}var Uyt=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=Pyt;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===Pyt?"!--"===s[1]?o=Eyt:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=kyt):(Oyt.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=kyt):o=Myt:o===kyt?">"===s[0]?(o=r??Pyt,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?kyt:'"'===s[3]?Dyt:Iyt):o===Dyt||o===Iyt?o=kyt:o===Eyt||o===Myt?o=Pyt:(o=kyt,r=void 0);let d=o===kyt&&e[t+1].startsWith("/>")?" ":"";a+=o===Pyt?u+xyt:c>=0?(i.push(n),u.slice(0,c)+yyt+u.slice(c)+byt+d):u+byt+(-2===c?t:d)}return[$yt(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),Lyt.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Lyt.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(yyt)){let t=l[o++],r=i.getAttribute(e).split(byt),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?Hyt:"?"===n[1]?qyt:"@"===n[1]?Wyt:Vyt}),i.removeAttribute(e)}else e.startsWith(byt)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(Oyt.test(i.tagName)){let e=i.textContent.split(byt),t=e.length-1;if(t>0){i.textContent=gyt?gyt.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],wyt()),Lyt.nextNode(),u.push({type:2,index:++a});i.append(e[t],wyt())}}}else if(8===i.nodeType)if(i.data===_yt)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(byt,e+1));)u.push({type:7,index:a}),e+=byt.length-1}a++}}static createElement(e,t){let r=Syt.createElement("template");return r.innerHTML=e,r}};function jyt(e,t,r=e,n){if(t===Byt)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=Ayt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=jyt(e,i._$AS(e,t.values),i,n)),t}var zyt=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??Syt).importNode(t,!0);Lyt.currentNode=n;let i=Lyt.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new Gyt(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new Xyt(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=Lyt.nextNode(),a++)}return Lyt.currentNode=Syt,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},Gyt=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=Nyt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=jyt(this,e,t),Ayt(e)?e===Nyt||null==e||""===e?(this._$AH!==Nyt&&this._$AR(),this._$AH=Nyt):e!==this._$AH&&e!==Byt&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>Cyt(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Nyt&&Ayt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Syt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Uyt.createElement($yt
646(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new zyt(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=Fyt.get(e.strings);return void 0===t&&Fyt.set(e.strings,t=new Uyt(e)),t}k(t){Cyt(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(wyt()),this.O(wyt()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},Vyt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=Nyt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Nyt}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=jyt(this,e,t,0),a=!Ayt(e)||e!==this._$AH&&e!==Byt,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=jyt(this,s[r+n],t,n),o===Byt&&(o=this._$AH[n]),a||=!Ayt(o)||o!==this._$AH[n],o===Nyt?e=Nyt:e!==Nyt&&(e+=(o??"")+i[n+1]),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===Nyt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Hyt=class extends Vyt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Nyt?void 0:e}},qyt=class extends Vyt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Nyt)}},Wyt=class extends Vyt{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}
646_$AI(e,t=this){if((e=jyt(this,e,t,0)??Nyt)===Byt)return;let r=this._$AH,n=e===Nyt&&r!==Nyt||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==Nyt&&(r===Nyt||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Xyt=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){jyt(this,e)}},Yyt=myt.litHtmlPolyfillSupport;Yyt?.(Uyt,Gyt),(myt.litHtmlVersions??=[]).push("3.2.1");var Kyt=class extends pyt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new Gyt(t.insertBefore(wyt(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Byt}};Kyt._$litElement$=!0,Kyt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:Kyt});var Zyt=globalThis.litElementPolyfillSupport;Zyt?.({LitElement:Kyt}),(globalThis.litElementVersions??=[]).push("4.1.1");var Qyt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},Jyt=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends Qyt{constructor(e){if(super(e),1!==e.type||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return null==n?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(e,[t]){let{style:r}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes("-")?r.removeProperty(e):r[e]=null);for(let e in t){let n=t[e];if(null!=n){this.ft.add(e);let t="string"==typeof n&&n.endsWith(" !important");e.includes("-")||t?r.setProperty(e,t?n.slice(0,-11):n,t?"important":""):r[e]=n}}return Byt}}),ebt={attribute:!0,type:String,converter:dyt,reflect:!1,hasChanged:fyt},tbt=(e=ebt,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function rbt(e){return(t,r)=>"object"==typeof r?tbt(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}var nbt="#ffffe5 #f7fcb9 #d9f0a3 #addd8e #78c679 #41ab5d #238443 #006837 #004529".split(" "),ibt=class extends(bu(Tu(gu(pu(du(ei(wu(_c)))))))){constructor(){super(...arguments),this["hm-highlight-width"]=0}updateHighlight(){if(!this.highlighted)return;let e=this.highlighted.selectAll("rect").data(this.highlightedRegion.segments);e.enter().append("rect").style("pointer-events","none").merge(e).attr("fill",this["highlight-color"]).attr("y",0).attr("height",this.height).attr("x",e=>this.getXFromSeqPosition(e.start)-this["margin-left"]).attr("width",e=>Math.max(0,this.getSingleBaseWidth()*(e.end-e.start+1))),e.exit().remove()}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),"highlight"!==e&&"highlight-color"!==e||this.updateHighlight(),"display-start"!==e&&"display-end"!==e||this.triggerHeatmapZoom()}render(){let e={width:this.getWidthWithMargins()+"px",height:this.height+"px",zIndex:1,marginLeft:this["margin-left"]+"px",marginRight:this["margin-right"]+"px",paddingTop:this["margin-top"]+"px",paddingBottom:this["margin-bottom"]+"px"},t={width:this.getWidthWithMargins()+"px",textAlign:"center"};return this.heatmapData?Ryt` <style>
647          /* Default heatmap-component CSS */
648          ${'\n/**\n * heatmap-component\n * @version 1.2.0\n * @link https://github.com/PDBeurope/heatmap-component\n * @license Apache-2.0\n */\n\n:root {\n    /** Position of bottom-left corner of tooltip box relative to the mouse position */\n    --tooltip-offset-x: 5px;\n    /** Position of bottom-left corner of tooltip box relative to the mouse position */\n    --tooltip-offset-y: 8px;\n}\n\n.heatmap-main-div {\n    font-family: sans-serif;\n}\n\n.heatmap-canvas-div {\n    /* Set background-color here to change the background of the heatmap */\n    background-color: none;\n}\n\n.heatmap-svg[pointing-data] {\n    /** Show "pointer" cursor when hovering over a cell with data */\n    cursor: pointer;\n}\n\n\n/* Marker extension */\n\n.heatmap-marker {\n    stroke: black;\n    stroke-width: 4;\n    fill: none;\n    pointer-events: none;\n}\n\n.heatmap-marker-x,\n.heatmap-marker-y {\n    stroke: black;\n    stroke-width: 2;\n    fill: none;\n    pointer-events: none;\n}\n\n\n/* Tooltip extension */\n\n.heatmap-tooltip-box,\n.heatmap-pinned-tooltip-box {\n    z-index: 0;\n    /* Avoid tooltip flickering */\n    pointer-events: none;\n}\n\n.heatmap-tooltip-content,\n.heatmap-pinned-tooltip-content {\n    margin-left: var(--tooltip-offset-x);\n    margin-bottom: var(--tooltip-offset-y);\n    border: solid black 1px;\n    padding-block: 0.35em;\n    padding-inline: 0.7em;\n    background-color: white;\n    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.75);\n    pointer-events: initial;\n    width: max-content;\n}\n\n.heatmap-pinned-tooltip-close {\n    position: absolute;\n    top: -8px;\n    right: -8px;\n    width: 16px;\n    height: 16px;\n    border-radius: 1000px;\n    background-color: black;\n    border: solid black 1px;\n    pointer-events: initial;\n    cursor: pointer;\n}\n\n.heatmap-pinned-tooltip-close svg {\n    position: absolute;\n    width: 100%;\n    height: 100%;\n    fill: white;\n    stroke: white;\n}\n\n.heatmap-pinned-tooltip-pin {\n    position: absolute;\n    left: 0px;\n    bottom: 0px;\n    width: calc(var(--tooltip-offset-x) / 0.6);\n    height: calc(var(--tooltip-offset-y) / 0.6);\n    z-index: -1;\n}\n\n.heatmap-pinned-tooltip-pin svg {\n    fill: black;\n}\n\n\n/* Overlay (Zoom extension) */\n\n.heatmap-overlay {\n    position: absolute;\n    width: 100%;\n    height: 100%;\n    pointer-events: none;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;
648\n    align-items: center;\n    z-index: 0;\n}\n\n.heatmap-overlay-shade {\n    position: absolute;\n    width: 100%;\n    height: 100%;\n    background-color: black;\n    opacity: 0.4;\n    z-index: -1;\n}\n\n.heatmap-overlay-message {\n    margin: 5px;\n    padding-block: 1em;\n    padding-inline: 1.6em;\n    text-align: center;\n    font-size: 150%;\n    font-weight: bold;\n    background-color: white;\n    border: solid black 1px;\n    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.75);\n}\n\n\n/* Brush extension */\n\n.heatmap-brush-close {\n    cursor: pointer;\n}\n\n.heatmap-brush-close .cross {\n    fill: black;\n    stroke: black;\n}\n\n.heatmap-brush-close .circle {\n    fill: white;\n    stroke: white;\n}\n'}
649
650          /* Nightingale CSS */
651          .heatmap-tooltip-content,
652          .heatmap-pinned-tooltip-content {
653            line-height: 1;
654          }
655          .heatmap-marker-x,
656          .heatmap-marker-y {
657            display: none;
658          }
659          .heatmap-svg[pointing-data] {
660            cursor: default;
661          }
662        </style>
663
664        <div id="container">
665          <div id="${this["heatmap-id"]}" style=${Jyt(e)} />
666        </div>`:Ryt` <div id="${this["heatmap-id"]}_loading" style=${Jyt(t)}>
667        ${obt}
668      </div>`}updated(e){super.updated(e),this.heatmapData&&!this.heatmapInstance&&(this.renderHeatmap(),this.svg=o7e(this).select("div#container"),this.highlighted=o7e(this).select("svg.heatmap-svg").append("g").classed("highlighted",!0),this.bindHeatmapEvents(),this.updateHighlight())}setHeatmapData(e,t,r){var n;this.heatmapDomainX=e,this.heatmapDomainY=t,this.heatmapData=r,null==(n=this.heatmapInstance)||n.setData({xDomain:e,yDomain:t,data:r,x:e=>e.xValue,y:e=>e.yValue??"none"}),this.requestUpdate()}createRandomFromLength(){let e=[...Array(this.length).keys()].map(e=>e+1),t=["A","B","C"],r=[];for(let n of e)for(let e of t){let t=Math.random();r.push({xValue:n,yValue:e,score:t})}this.setHeatmapData(e,t,r)}renderHeatmap(){let e=Wvt.Heatmap.create({xDomain:this.heatmapDomainX,yDomain:this.heatmapDomainY,data:this.heatmapData,x:e=>e.xValue,y:e=>e.yValue??"none"}),t=$6e(this.heatmapData?.map(e=>e.score)??[])??0,r=L6e(this.heatmapData?.map(e=>e.score)??[])??1,n=nbt.map((e,n)=>t+(r-t)*n/(nbt.length-1)),i=Wvt.ColorScale.continuous(n,nbt);e.setColor(e=>i(e.score)),e.setTooltip((e,t,r,n,i)=>`\n        <b>You are at</b> <br />\n        x,y: <b>${e.xValue},${e.yValue}</b><br />\n        score: <b>${e.score.toFixed(3)}</b>`),e.setVisualParams({xGapPixels:0,yGapPixels:0}),this.heatmapInstance=e,this.heatmapInstance.render(this["heatmap-id"]),this.heatmapInstance.events.render.subscribe(()=>{this.requestUpdate()})}bindHeatmapEvents(){this.heatmapInstance&&(this.heatmapInstance.events.hover.subscribe(e=>{"onmouseover"===this.getAttribute("highlight-event")&&this.dispatchHighlight(e.cell?.x)}),this.heatmapInstance.events.select.subscribe(e=>{"onclick"===this.getAttribute("highlight-event")&&this.dispatchHighlight(e.cell?.x)}))}dispatchHighlight(e){let t=void 0===e?null:`${e}:${e}`;this.dispatchEvent(new CustomEvent("change",{detail:{type:"highlight",value:t},bubbles:!0,cancelable:!0}))}triggerHeatmapZoom(){let e=this["display-start"],t=this["display-end"]+1;this.heatmapInstance&&this.heatmapInstance.zoom({xMin:e,xMax:t})}};X5e([rbt({type:String})],ibt.prototype,"heatmap-id",void 0),X5e([rbt({type:Number})],ibt.prototype,"hm-highlight-width",void 0),X5e([rbt({type:Boolean})],ibt.prototype,"use-ctrl-to-zoom",void 0);var abt=ibt=X5e([Fu("nightingale-sequence-heatmap")],ibt),obt=Ryt`
669  <svg
670    width="200px"
671    height="200px"
672    xmlns="http://www.w3.org/2000/svg"
673    xmlns:xlink="http://www.w3.org/1999/xlink"
674    viewBox="0 0 100 100"
675    preserveAspectRatio="xMidYMid"
676    style="background: none;"
677  >
678    <circle cx="75" cy="50" fill="#363a3c" r="6.39718">
679      <animate
680        attributeName="r"
681        values="4.8;4.8;8;4.8;4.8"
682        times="0;0.1;0.2;0.3;1"
683        dur="1s"
684        repeatCount="indefinite"
685        begin="-0.875s"
686      ></animate>
687    </circle>
688    <circle cx="67.678" cy="67.678" fill="#363a3c" r="4.8">
689      <animate
690        attributeName="r"
691        values="4.8;4.8;8;4.8;4.8"
692        times="0;0.1;0.2;0.3;1"
693        dur="1s"
694        repeatCount="indefinite"
695        begin="-0.75s"
696      ></animate>
697    </circle>
698    <circle cx="50" cy="75" fill="#363a3c" r="4.8">
699      <animate
700        attributeName="r"
701        values="4.8;4.8;8;4.8;4.8"
702        times="0;0.1;0.2;0.3;1"
703        dur="1s"
704        repeatCount="indefinite"
705        begin="-0.625s"
706      ></animate>
707    </circle>
708    <circle cx="32.322" cy="67.678" fill="#363a3c" r="4.8">
709      <animate
710        attributeName="r"
711        values="4.8;4.8;8;4.8;4.8"
712        times="0;0.1;0.2;0.3;1"
713        dur="1s"
714        repeatCount="indefinite"
715        begin="-0.5s"
716      ></animate>
717    </circle>
718    <circle cx="25" cy="50" fill="#363a3c" r="4.8">
719      <animate
720        attributeName="r"
721        values="4.8;4.8;8;4.8;4.8"
722        times="0;0.1;0.2;0.3;1"
723        dur="1s"
724        repeatCount="indefinite"
725        begin="-0.375s"
726      ></animate>
727    </circle>
728    <circle cx="32.322" cy="32.322" fill="#363a3c" r="4.80282">
729      <animate
730        attributeName="r"
731        values="4.8;4.8;8;4.8;4.8"
732        times="0;0.1;0.2;0.3;1"
733        dur="1s"
734        repeatCount="indefinite"
735        begin="-0.25s"
736      ></animate>
737    </circle>
738    <circle cx="50" cy="25" fill="#363a3c" r="6.40282">
739      <animate
740        attributeName="r"
741        values="4.8;4.8;8;4.8;4.8"
742        times="0;0.1;0.2;0.3;1"
743        dur="1s"
744        repeatCount="indefinite"
745        begin="-0.125s"
746      ></animate>
747    </circle>
748    <circle cx="67.678" cy="32.322" fill="#363a3c" r="7.99718">
749      <animate
750        attributeName="r"
751        values="4.8;4.8;8;4.8;4.8"
752        times="0;0.1;0.2;0.3;1"
753        dur="1s"
754        repeatCount="indefinite"
755        begin="0s"
756      ></animate>
757    </circle>
758  </svg>
759`;function sbt(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function ubt(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var cbt=globalThis,lbt=cbt.ShadowRoot&&(void 0===cbt.ShadyCSS||cbt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,dbt=Symbol(),fbt=new WeakMap,hbt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==dbt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(lbt&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=fbt.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&fbt.set(t,e))}return e}toString(){return this.cssText}},pbt=lbt?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return(e=>new hbt("string"==typeof e?e:e+"",void 0,dbt))(t)})(e):e,{is:mbt,defineProperty:gbt,getOwnPropertyDescriptor:vbt,getOwnPropertyNames:ybt,getOwnPropertySymbols:bbt,getPrototypeOf:_bt}=Object,xbt=globalThis,Sbt=xbt.trustedTypes,wbt=Sbt?Sbt.emptyScript:"",Abt=xbt.reactiveElementPolyfillSupport,Cbt=(e,t)=>e,Tbt={toAttribute(e,t){switch(t){case Boolean:e=e?wbt:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Pbt=(e,t)=>!mbt(e,t),Ebt={attribute:!0,type:String,converter:Tbt,reflect:!1,hasChanged:Pbt};Symbol.metadata??=Symbol("metadata"),xbt.litPropertyMetadata??=new WeakMap;var Mbt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ebt){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&gbt(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:i}=vbt(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){let a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ebt}static _$Ei(){if(this.hasOwnProperty(Cbt("elementProperties")))return;let e=_bt(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Cbt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Cbt("properties"))){let e=this.properties,t=[...ybt(e),...bbt(e)];for(let r of t)this.createProperty(r,e[r])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let e of r)t.unshift(pbt(e))}else void 0!==e&&t.push(pbt(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
759=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(lbt)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=cbt.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){let i=(void 0===r.converter?.toAttribute?Tbt:r.converter).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){let e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0===e.converter?.fromAttribute?Tbt:e.converter;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??Pbt)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}};Mbt.elementStyles=[],Mbt.shadowRootOptions={mode:"open"},Mbt[Cbt("elementProperties")]=new Map,Mbt[Cbt("finalized")]=new Map,Abt?.({ReactiveElement:Mbt}),(xbt.reactiveElementVersions??=[]).push("2.0.4");var kbt={attribute:!0,type:String,converter:Tbt,reflect:!1,hasChanged:Pbt},Ibt=(e=kbt,t,r)=>{let{kind:n,metadata:i}=r,a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){let{name:n}=r;return{set(r){let i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){let{name:n}=r;return function(r){let i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function Dbt(e){return(t,r)=>"object"==typeof r?Ibt(e,t,r):((e,t,r)=>{let n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}var Obt=globalThis,Rbt=Obt.trustedTypes,Bbt=Rbt?Rbt.createPolicy("lit-html",{createHTML:e=>e}):void 0,Nbt="$lit$",Fbt=`lit$${Math.random().toFixed(9).slice(2)}$`,Lbt="?"+Fbt,$bt=`<${Lbt}>`,Ubt=document,jbt=()=>Ubt.createComment(""),zbt=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Gbt=Array.isArray,Vbt="[ \t\n\f\r]",Hbt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>
759\s]*)|(\/?$))/g,qbt=/-->/g,Wbt=/>/g,Xbt=RegExp(`>|${Vbt}(?:([^\\s"'>=/]+)(${Vbt}*=${Vbt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Ybt=/'/g,Kbt=/"/g,Zbt=/^(?:script|style|textarea|title)$/i,Qbt=(e,...t)=>({_$litType$:1,strings:e,values:t}),Jbt=Symbol.for("lit-noChange"),e_t=Symbol.for("lit-nothing"),t_t=new WeakMap,r_t=Ubt.createTreeWalker(Ubt,129);function n_t(e,t){if(!Gbt(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0===Bbt?t:Bbt.createHTML(t)}var i_t=class e{constructor({strings:t,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=t.length-1,u=this.parts,[c,l]=((e,t)=>{let r,n=e.length-1,i=[],a=2===t?"<svg>":3===t?"<math>":"",o=Hbt;for(let t=0;t<n;t++){let n,s,u=e[t],c=-1,l=0;for(;l<u.length&&(o.lastIndex=l,s=o.exec(u),null!==s);)l=o.lastIndex,o===Hbt?"!--"===s[1]?o=qbt:void 0===s[1]?void 0===s[2]?void 0!==s[3]&&(o=Xbt):(Zbt.test(s[2])&&(r=RegExp("</"+s[2],"g")),o=Xbt):o=Wbt:o===Xbt?">"===s[0]?(o=r??Hbt,c=-1):void 0===s[1]?c=-2:(c=o.lastIndex-s[2].length,n=s[1],o=void 0===s[3]?Xbt:'"'===s[3]?Kbt:Ybt):o===Kbt||o===Ybt?o=Xbt:o===qbt||o===Wbt?o=Hbt:(o=Xbt,r=void 0);let d=o===Xbt&&e[t+1].startsWith("/>")?" ":"";a+=o===Hbt?u+$bt:c>=0?(i.push(n),u.slice(0,c)+Nbt+u.slice(c)+Fbt+d):u+Fbt+(-2===c?t:d)}return[n_t(e,a+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(t,r);if(this.el=e.createElement(c,n),r_t.currentNode=this.el.content,2===r||3===r){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=r_t.nextNode())&&u.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Nbt)){let t=l[o++],r=i.getAttribute(e).split(Fbt),n=/([.?@])?(.*)/.exec(t);u.push({type:1,index:a,name:n[2],strings:r,ctor:"."===n[1]?c_t:"?"===n[1]?l_t:"@"===n[1]?d_t:u_t}),i.removeAttribute(e)}else e.startsWith(Fbt)&&(u.push({type:6,index:a}),i.removeAttribute(e));if(Zbt.test(i.tagName)){let e=i.textContent.split(Fbt),t=e.length-1;if(t>0){i.textContent=Rbt?Rbt.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],jbt()),r_t.nextNode(),u.push({type:2,index:++a});i.append(e[t],jbt())}}}else if(8===i.nodeType)if(i.data===Lbt)u.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(Fbt,e+1));)u.push({type:7,index:a}),e+=Fbt.length-1}a++}}static createElement(e,t){let r=Ubt.createElement("template");return r.innerHTML=e,r}};function a_t(e,t,r=e,n){if(t===Jbt)return t;let i=void 0===n?r._$Cl:r._$Co?.[n],a=zbt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0===n?r._$Cl=i:(r._$Co??=[])[n]=i),void 0!==i&&(t=a_t(e,i._$AS(e,t.values),i,n)),t}var o_t=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??Ubt).importNode(t,!0);r_t.currentNode=n;let i=r_t.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new s_t(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new f_t(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=r_t.nextNode(),a++)}return r_t.currentNode=Ubt,n}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0===r.strings?r._$AI(e[t]):(r._$AI(e,r,t),t+=r.strings.length-2)),t++}},s_t=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=e_t,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=a_t(this,e,t),zbt(e)?e===e_t||null==e||""===e?(this._$AH!==e_t&&this._$AR(),this._$AH=e_t):e!==this._$AH&&e!==Jbt&&this._(e):void 0===e._$litType$?void 0===e.nodeType?(e=>Gbt(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==e_t&&zbt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ubt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=i_t.createElement(n_t(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let e=new o_t(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=t_t.get(e.strings);return void 0===t&&t_t.set(e.strings,t=new i_t(e)),t}k(t){Gbt(this._$AH)||(this._$AH=[],this._$AR());let r,n=this._$AH,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(jbt()),this.O(jbt()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},u_t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=e_t,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=e_t}_$AI(e,t=this,r,n){let i=this.strings,a=!1;if(void 0===i)e=a_t(this,e,t,0),a=!zbt(e)||e!==this._$AH&&e!==Jbt,a&&(this._$AH=e);else{let n,o,s=e;for(e=i[0],n=0;n<i.length-1;n++)o=a_t(this,s[r+n],t,n),o===Jbt&&(o=this._$AH[n]),a||=!zbt(o)||o!==this._$AH[n],o===e_t?e=e_t:e!==e_t&&(e+=(o??"")+i[n+1]
759),this._$AH[n]=o}a&&!n&&this.j(e)}j(e){e===e_t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},c_t=class extends u_t{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===e_t?void 0:e}},l_t=class extends u_t{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==e_t)}},d_t=class extends u_t{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=a_t(this,e,t,0)??e_t)===Jbt)return;let r=this._$AH,n=e===e_t&&r!==e_t||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==e_t&&(r===e_t||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},f_t=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){a_t(this,e)}},h_t=Obt.litHtmlPolyfillSupport;h_t?.(i_t,s_t),(Obt.litHtmlVersions??=[]).push("3.2.1");var p_t=class extends Mbt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{let n=r?.renderBefore??t,i=n._$litPart$;if(void 0===i){let e=r?.renderBefore??null;n._$litPart$=i=new s_t(t.insertBefore(jbt(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Jbt}};p_t._$litElement$=!0,p_t.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:p_t});var m_t=globalThis.litElementPolyfillSupport;m_t?.({LitElement:p_t}),(globalThis.litElementVersions??=[]).push("4.1.1");var g_t="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,v_t="object"==typeof self&&self&&self.Object===Object&&self,y_t=g_t||v_t||Function("return this")(),b_t=y_t.Symbol,__t=Object.prototype,x_t=__t.hasOwnProperty,S_t=__t.toString,w_t=b_t?b_t.toStringTag:void 0,A_t=Object.prototype.toString,C_t=b_t?b_t.toStringTag:void 0;function T_t(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":C_t&&C_t in Object(e)?function(e){var t=x_t.call(e,w_t),r=e[w_t];try{e[w_t]=void 0;var n=!0}catch{}var i=S_t.call(e);return n&&(t?e[w_t]=r:delete e[w_t]),i}(e):function(e){return A_t.call(e)}(e)}function P_t(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function E_t(e){if(!P_t(e))return!1;var t=T_t(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var M_t,k_t=y_t["__core-js_shared__"],I_t=(M_t=/[^.]+$/.exec(k_t&&k_t.keys&&k_t.keys.IE_PROTO||""))?"Symbol(src)_1."+M_t:"",D_t=Function.prototype.toString;function O_t(e){if(null!=e){try{return D_t.call(e)}catch{}try{return e+""}catch{}}return""}var R_t=/^\[object .+?Constructor\]$/,B_t=Function.prototype,N_t=Object.prototype,F_t=B_t.toString,L_t=N_t.hasOwnProperty,$_t=RegExp("^"+F_t.call(L_t).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function U_t(e,t){var r=function(e,t){return e?.[t]}(e,t);return function(e){return!(!P_t(e)||(t=e,I_t&&I_t in t))&&(E_t(e)?$_t:R_t).test(O_t(e));var t}(r)?r:void 0}var j_t=function(){try{var e=U_t(Object,"defineProperty");return e({},"",{}),e}catch{}}();function z_t(e,t,r,n){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),e)}return n}function G_t(e){return"object"==typeof e&&!!e}function V_t(e){return G_t(e)&&"[object Arguments]"==T_t(e)}var H_t=Object.prototype,q_t=H_t.hasOwnProperty,W_t=H_t.propertyIsEnumerable,X_t=V_t(function(){return arguments}())?V_t:function(e){return G_t(e)&&q_t.call(e,"callee")&&!W_t.call(e,"callee")},Y_t=Array.isArray,K_t="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z_t=K_t&&"object"==typeof module&&module&&!module.nodeType&&module,Q_t=Z_t&&Z_t.exports===K_t?y_t.Buffer:void 0,J_t=(Q_t?Q_t.isBuffer:void 0)||function(){return!1},ext=/^(?:0|[1-9]\d*)$/;function txt(e,t){var r=typeof e;return!!(t??=9007199254740991)&&("number"==r||"symbol"!=r&&ext.test(e))&&e>-1&&e%1==0&&e<t}function rxt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var nxt={};
759nxt["[object Float32Array]"]=nxt["[object Float64Array]"]=nxt["[object Int8Array]"]=nxt["[object Int16Array]"]=nxt["[object Int32Array]"]=nxt["[object Uint8Array]"]=nxt["[object Uint8ClampedArray]"]=nxt["[object Uint16Array]"]=nxt["[object Uint32Array]"]=!0,nxt["[object Arguments]"]=nxt["[object Array]"]=nxt["[object ArrayBuffer]"]=nxt["[object Boolean]"]=nxt["[object DataView]"]=nxt["[object Date]"]=nxt["[object Error]"]=nxt["[object Function]"]=nxt["[object Map]"]=nxt["[object Number]"]=nxt["[object Object]"]=nxt["[object RegExp]"]=nxt["[object Set]"]=nxt["[object String]"]=nxt["[object WeakMap]"]=!1;var ixt,axt="object"==typeof exports&&exports&&!exports.nodeType&&exports,oxt=axt&&"object"==typeof module&&module&&!module.nodeType&&module,sxt=oxt&&oxt.exports===axt&&g_t.process,uxt=function(){try{return oxt&&oxt.require&&oxt.require("util").types||sxt&&sxt.binding&&sxt.binding("util")}catch{}}(),cxt=uxt&&uxt.isTypedArray,lxt=cxt?(ixt=cxt,function(e){return ixt(e)}):function(e){return G_t(e)&&rxt(e.length)&&!!nxt[T_t(e)]},dxt=Object.prototype.hasOwnProperty,fxt=Object.prototype,hxt=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),pxt=Object.prototype.hasOwnProperty;function mxt(e){return null!=e&&rxt(e.length)&&!E_t(e)}function gxt(e){return mxt(e)?function(e){var t=Y_t(e),r=!t&&X_t(e),n=!t&&!r&&J_t(e),i=!t&&!r&&!n&&lxt(e),a=t||r||n||i,o=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],s=o.length;for(var u in e)!dxt.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||txt(u,s))||o.push(u);return o}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||fxt))return hxt(e);var t,r,n=[];for(var i in Object(e))pxt.call(e,i)&&"constructor"!=i&&n.push(i);return n}(e)}var vxt,yxt=(vxt=function(e,t){return e&&function(e,t,r){for(var n=-1,i=Object(e),a=r(e),o=a.length;o--;){var s=a[++n];if(!1===t(i[s],s,i))break}return e}(e,t,gxt)},function(e,t){if(null==e)return e;if(!mxt(e))return vxt(e,t);for(var r=e.length,n=-1,i=Object(e);++n<r&&!1!==t(i[n],n,i););return e});function bxt(e,t,r,n){return yxt(e,function(e,i,a){t(n,e,r(e),a)}),n}function _xt(e,t){return e===t||e!=e&&t!=t}function xxt(e,t){for(var r=e.length;r--;)if(_xt(e[r][0],t))return r;return-1}var Sxt=Array.prototype.splice;function wxt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}wxt.prototype.clear=function(){this.__data__=[],this.size=0},wxt.prototype.delete=function(e){var t=this.__data__,r=xxt(t,e);return!(r<0||(r==t.length-1?t.pop():Sxt.call(t,r,1),--this.size,0))},wxt.prototype.get=function(e){var t=this.__data__,r=xxt(t,e);return r<0?void 0:t[r][1]},wxt.prototype.has=function(e){return xxt(this.__data__,e)>-1},wxt.prototype.set=function(e,t){var r=this.__data__,n=xxt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var Axt=U_t(y_t,"Map"),Cxt=U_t(Object,"create"),Txt=Object.prototype.hasOwnProperty,Pxt=Object.prototype.hasOwnProperty;function Ext(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Mxt(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function kxt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ixt(e){var t=this.__data__=new wxt(e);this.size=t.size}function Dxt(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new kxt;++t<r;)this.add(e[t])}function Oxt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function Rxt(e,t,r,n,i,a){var o=1&r,s=e.length,u=t.length;if(s!=u&&!(o&&u>s))return!1;var c=a.get(e);if(c&&a.get(t))return c==t;var l=-1,d=!0,f=2&r?new Dxt:void 0;for(a.set(e,t),a.set(t,e);++l<s;){var h=e[l],p=t[l];if(n)var m=o?n(p,h,l,t,e,a):n(h,p,l,e,t,a);if(void 0!==m){if(m)continue;d=!1;break}if(f){if(!Oxt(t,function(e,t){if(o=t,!f.has(o)&&(h===e||i(h,e,r,n,a)))return f.push(t);var o})){d=!1;break}}else if(h!==p&&!i(h,p,r,n,a)){d=!1;break}}return a.delete(e),a.delete(t),d}Ext.prototype.clear=function(){this.__data__=Cxt?Cxt(null):{},this.size=0},Ext.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t},Ext.prototype.get=function(e){var t=this.__data__;if(Cxt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Txt.call(t,e)?t[e]:void 0},Ext.prototype.has=function(e){var t=this.__data__;return Cxt?void 0!==t[e]:Pxt.call(t,e)},Ext.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Cxt&&void 0===t?"__lodash_hash_undefined__":t,this},kxt.prototype.clear=function(){this.size=0,this.__data__={hash:new Ext,map:new(Axt||wxt),string:new Ext}},kxt.prototype.delete=function(e){var t=Mxt(this,e).delete(e);return this.size-=+!!t,t},kxt.prototype.get=function(e){return Mxt(this,e).get(e)},kxt.prototype.has=function(e){return Mxt(this,e).has(e)},kxt.prototype.set=function(e,t){var r=Mxt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Ixt.prototype.clear=function(){this.__data__=new wxt,this.size=0},Ixt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Ixt.prototype.get=function(e){return this.__data__.get(e)},Ixt.prototype.has=function(e){return this.__data__.has(e)},Ixt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof wxt){var n=r.__data__;if(!Axt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new kxt(n)}return r.set(e,t),this.size=r.size,this},Dxt.prototype.add=Dxt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Dxt.prototype.has=function(e){return this.__data__.has(e)};var Bxt=y_t.Uint8Array;function Nxt(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}
759function Fxt(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var Lxt=b_t?b_t.prototype:void 0,$xt=Lxt?Lxt.valueOf:void 0,Uxt=Object.prototype.propertyIsEnumerable,jxt=Object.getOwnPropertySymbols,zxt=jxt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o)&&(a[i++]=o)}return a}(jxt(e),function(t){return Uxt.call(e,t)}))}:function(){return[]};function Gxt(e){return function(e,t,r){var n=t(e);return Y_t(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,gxt,zxt)}var Vxt=Object.prototype.hasOwnProperty,Hxt=U_t(y_t,"DataView"),qxt=U_t(y_t,"Promise"),Wxt=U_t(y_t,"Set"),Xxt=U_t(y_t,"WeakMap"),Yxt="[object Map]",Kxt="[object Promise]",Zxt="[object Set]",Qxt="[object WeakMap]",Jxt="[object DataView]",eSt=O_t(Hxt),tSt=O_t(Axt),rSt=O_t(qxt),nSt=O_t(Wxt),iSt=O_t(Xxt),aSt=T_t;(Hxt&&aSt(new Hxt(new ArrayBuffer(1)))!=Jxt||Axt&&aSt(new Axt)!=Yxt||qxt&&aSt(qxt.resolve())!=Kxt||Wxt&&aSt(new Wxt)!=Zxt||Xxt&&aSt(new Xxt)!=Qxt)&&(aSt=function(e){var t=T_t(e),r="[object Object]"==t?e.constructor:void 0,n=r?O_t(r):"";if(n)switch(n){case eSt:return Jxt;case tSt:return Yxt;case rSt:return Kxt;case nSt:return Zxt;case iSt:return Qxt}return t});var oSt="[object Arguments]",sSt="[object Array]",uSt="[object Object]",cSt=Object.prototype.hasOwnProperty;function lSt(e,t,r,n,i){return e===t||(null==e||null==t||!G_t(e)&&!G_t(t)?e!=e&&t!=t:function(e,t,r,n,i,a){var o=Y_t(e),s=Y_t(t),u=o?sSt:aSt(e),c=s?sSt:aSt(t),l=(u=u==oSt?uSt:u)==uSt,d=(c=c==oSt?uSt:c)==uSt,f=u==c;if(f&&J_t(e)){if(!J_t(t))return!1;o=!0,l=!1}if(f&&!l)return a||=new Ixt,o||lxt(e)?Rxt(e,t,r,n,i,a):function(e,t,r,n,i,a,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Bxt(e),new Bxt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return _xt(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Nxt;case"[object Set]":var u=1&n;if(s||=Fxt,e.size!=t.size&&!u)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var l=Rxt(s(e),s(t),n,i,a,o);return o.delete(e),l;case"[object Symbol]":if($xt)return $xt.call(e)==$xt.call(t)}return!1}(e,t,u,r,n,i,a);if(!(1&r)){var h=l&&cSt.call(e,"__wrapped__"),p=d&&cSt.call(t,"__wrapped__");
759if(h||p){var m=h?e.value():e,g=p?t.value():t;return a||=new Ixt,i(m,g,r,n,a)}}return!!f&&(a||=new Ixt,function(e,t,r,n,i,a){var o=1&r,s=Gxt(e),u=s.length;if(u!=Gxt(t).length&&!o)return!1;for(var c=u;c--;){var l=s[c];if(!(o?l in t:Vxt.call(t,l)))return!1}var d=a.get(e);if(d&&a.get(t))return d==t;var f=!0;a.set(e,t),a.set(t,e);for(var h=o;++c<u;){var p=e[l=s[c]],m=t[l];if(n)var g=o?n(m,p,l,t,e,a):n(p,m,l,e,t,a);if(!(void 0===g?p===m||i(p,m,r,n,a):g)){f=!1;break}h||="constructor"==l}if(f&&!h){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,r,n,i,a))}(e,t,r,n,lSt,i))}function dSt(e){return e==e&&!P_t(e)}function fSt(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}function hSt(e){return"symbol"==typeof e||G_t(e)&&"[object Symbol]"==T_t(e)}var pSt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mSt=/^\w*$/;function gSt(e,t){if(Y_t(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!hSt(e))||mSt.test(e)||!pSt.test(e)||null!=t&&e in Object(t)}function vSt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(vSt.Cache||kxt),r}vSt.Cache=kxt;var ySt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bSt=/\\(\\)?/g,_St=function(){var e=vSt(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ySt,function(e,r,n,i){t.push(n?i.replace(bSt,"$1"):r||e)}),t},function(e){return 500===t.size&&t.clear(),e}),t=e.cache;return e}(),xSt=b_t?b_t.prototype:void 0,SSt=xSt?xSt.toString:void 0;function wSt(e){if("string"==typeof e)return e;if(Y_t(e))return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(e,wSt)+"";if(hSt(e))return SSt?SSt.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ASt(e,t){return Y_t(e)?e:gSt(e,t)?[e]:_St(function(e){return null==e?"":wSt(e)}(e))}function CSt(e){if("string"==typeof e||hSt(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function TSt(e,t){for(var r=0,n=(t=ASt(t,e)).length;null!=e&&r<n;)e=e[CSt(t[r++])];return r&&r==n?e:void 0}function PSt(e,t){return null!=e&&t in Object(e)}function ESt(e){return e}var MSt,kSt,ISt,DSt=Object.prototype.hasOwnProperty,OSt=(MSt=function(e,t,r){DSt.call(e,r)?e[r].push(t):function(e,t,r){"__proto__"==t&&j_t?j_t(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}(e,r,[t])},function(e,t){var r;return(Y_t(e)?z_t:bxt)(e,MSt,"function"==typeof(r=t)?r:null==r?ESt:"object"==typeof r?Y_t(r)?function(e,t){return gSt(e)&&dSt(t)?fSt(CSt(e),t):function(r){var n=function(e,t){var r=null==e?void 0:TSt(e,t);return void 0===r?void 0:r}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n=-1,i=(t=ASt(t,e)).length,a=!1;++n<i;){var o=CSt(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&rxt(i)&&txt(o,i)&&(Y_t(e)||X_t(e))}(e,t,PSt)}(r,e):lSt(t,n,3)}}(r[0],r[1]):function(e){var t=function(e){for(var t=gxt(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,dSt(i)]}return t}(e);return 1==t.length&&t[0][2]?fSt(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r){var n=r.length,i=n;if(null==e)return!i;for(e=Object(e);n--;){var a=r[n];if(a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++n<i;){var o=(a=r[n])[0],s=e[o],u=a[1];if(a[2]){if(void 0===s&&!(o in e))return!1}else if(!lSt(u,s,3,void 0,new Ixt))return!1}return!0}(r,0,t)}}(r):function(e){return gSt(e)?(t=CSt(e),function(e){return e?.[t]}):function(e){return function(t){return TSt(t,e)}}(e);var t}(r),{})}),RSt=class extends _c{constructor(){super(),this.filters=[],this.for="",kSt.set(this,new Set),ISt.set(this,void 0),this.filters=[]}connectedCallback(){super.connectedCallback(),this.closest("nightingale-manager")&&(function(e,t,r){if("function"==typeof t||!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,r)}(this,ISt,this.closest("nightingale-manager")),ubt(this,ISt,"f").register(this))}disconnectedCallback(){super.disconnectedCallback(),ubt(this,ISt,"f")&&ubt(this,ISt,"f").unregister(this)}render(){let e=OSt(this.filters,e=>e.type.text);return Qbt`
760      <style>
761        .group-title {
762          line-height: normal;
763        }
764
765        .group {
766          margin-bottom: 2.5rem;
767        }
768
769        .protvista_checkbox {
770          position: relative;
771          cursor: pointer;
772          box-sizing: border-box;
773          display: flex;
774          align-items: center;
775          margin-top: 10px;
776          line-height: 24px;
777          outline: none;
778        }
779
780        .protvista_checkbox_input {
781          margin: 0 0.25rem 0 0;
782        }
783
784        .protvista_checkbox_label {
785          margin-left: 0.2rem;
786          line-height: 1rem;
787        }
788      </style>
789      ${Object.entries(e).map(([e,t])=>Qbt`
790          <h4 class="group-title">${e}</h4>
791          <div class="group">
792            ${t.map(e=>Qbt` ${this.getCheckBox(e)} `)}
793          </div>
794        `)}
795    `}getCheckBox(e){let{name:t,options:r}=e,{label:n,color:i}=r;return Qbt`
796      <label class="protvista_checkbox" tabindex="0">
797        <input
798          type="checkbox"
799          style=${`accent-color: ${i}`}
800          checked
801          .value="${t}"
802          class="protvista_checkbox_input"
803          @change="${()=>this.toggleFilter(t)}"
804        />
805        <span class="protvista_checkbox_label"> ${n} </span>
806      </label>
807    `}toggleFilter(e){ubt(this,kSt,"f").has(e)?ubt(this,kSt,"f").delete(e):ubt(this,kSt,"f").add(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{type:"filters",handler:"property",for:this.for,value:this.filters?.filter(e=>!ubt(this,kSt,"f").has(e.name)).map(e=>e.name)}}))}};kSt=new WeakMap,ISt=new WeakMap,sbt([Dbt({attribute:!1})],RSt.prototype,"filters",void 0),sbt([Dbt({type:String})],RSt.prototype,"for",void 0),RSt=sbt([(e=>(t,r)=>{void 0===r?customElements.define(e,t):r.addInitializer(()=>{customElements.define(e,t)})})("nightingale-filter")],RSt);var BSt,NSt,FSt,LSt,$St,USt,jSt,zSt,GSt,VSt,HSt,qSt,WSt,XSt,YSt,KSt,ZSt,QSt,JSt=RSt,ewt=e=>Object.keys(e).reduce((t,r)=>`${t}${(e=>e.charAt(0).toUpperCase()+e.slice(1))(r)}: ${e[r]??""}. `,""),twt=(e,t)=>{let r=e?e.map(e=>e.name):[];return("uniprot"===t||"mixed"===t)&&r.push("uniprot"),r},rwt=function(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r},nwt=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)},iwt=function(e){var t=0;e+="x";var r=Math.floor(65745979961613.07);for(let n=0;n<e.length;n++)t>r&&(t=Math.floor(t/137)),t=131*t+e.charCodeAt(n);return t},awt="0123456789abcdef".split(""),owt=[-2147483648,8388608,32768,128],swt=[24,16,8,0],uwt=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],cwt=[],lwt=class{constructor(e=!1,t=!1){BSt.set(this,void 0),NSt.set(this,void 0),FSt.set(this,void 0),LSt.set(this,void 0),$St.set(this,void 0),USt.set(this,void 0),jSt.set(this,void 0),zSt.set(this,void 0),GSt.set(this,void 0),VSt.set(this,void 0),HSt.set(this,void 0),qSt.set(this,void 0),WSt.set(this,void 0),XSt.set(this,void 0),YSt.set(this,void 0),KSt.set(this,void 0),ZSt.set(this,0),QSt.set(this,void 0),this.init(e,t)}init(e,t){t?(cwt[0]=cwt[16]=cwt[1]=cwt[2]=cwt[3]=cwt[4]=cwt[5]=cwt[6]=cwt[7]=cwt[8]=cwt[9]=cwt[10]=cwt[11]=cwt[12]=cwt[13]=cwt[14]=cwt[15]=0,rwt(this,NSt,cwt)):rwt(this,NSt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),e?(rwt(this,USt,3238371032),rwt(this,jSt,914150663),rwt(this,zSt,812702999),rwt(this,GSt,4144912697),rwt(this,VSt,4290775857),rwt(this,HSt,1750603025),rwt(this,qSt,1694076839),rwt(this,WSt,3204075428)):(rwt(this,USt,1779033703),rwt(this,jSt,3144134277),rwt(this,zSt,1013904242),rwt(this,GSt,2773480762),rwt(this,VSt,1359893119),rwt(this,HSt,2600822924),rwt(this,qSt,528734635),rwt(this,WSt,1541459225)),rwt(this,BSt,rwt(this,QSt,rwt(this,FSt,rwt(this,YSt,0)))),rwt(this,LSt,rwt(this,XSt,!1)),rwt(this,$St,!0),rwt(this,KSt,e)}update(e){if(nwt(this,LSt))return this;let t;t=e instanceof ArrayBuffer?new Uint8Array(e):e;let r=0,n=t.length,i=nwt(this,NSt);for(;r<n;){let e;if(nwt(this,XSt)&&(rwt(this,XSt,!1),i[0]=nwt(this,BSt),i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0),"string"!=typeof t)for(e=nwt(this,QSt);r<n&&e<64;++r)i[e>>2]|=t[r]<<swt[3&e++];else for(e=nwt(this,QSt);r<n&&e<64;++r){let n=t.charCodeAt(r);n<128?i[e>>2]|=n<<swt[3&e++]:n<2048?(i[e>>2]|=(192|n>>6)<<swt[3&e++],i[e>>2]|=(128|63&n)<<swt[3&e++]):n<55296||n>=57344?(i[e>>2]|=(224|n>>12)<<swt[3&e++],i[e>>2]|=(128|n>>6&63)<<swt[3&e++],i[e>>2]|=(128|63&n)<<swt[3&e++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++r)),i[e>>2]|=(240|n>>18)<<swt[3&e++],i[e>>2]|=(128|n>>12&63)<<swt[3&e++],i[e>>2]|=(128|n>>6&63)<<swt[3&e++],i[e>>2]|=(128|63&n)<<swt[3&e++])}rwt(this,ZSt,e),rwt(this,FSt,nwt(this,FSt)+(e-nwt(this,QSt))),e>=64?(rwt(this,BSt,i[16]),rwt(this,QSt,e-64),this.hash(),rwt(this,XSt,!0)):rwt(this,QSt,e)}return nwt(this,FSt)>4294967295&&(rwt(this,YSt,nwt(this,YSt)+(nwt(this,FSt)/4294967296|0)),rwt(this,FSt,nwt(this,FSt)%4294967296)),this}finalize(){if(nwt(this,LSt))return;rwt(this,LSt,!0);let e=nwt(this,NSt),t=nwt(this,ZSt);e[16]=nwt(this,BSt),e[t>>2]|=owt[3&t],rwt(this,BSt,e[16]),t>=56&&(nwt(this,XSt)||this.hash(),e[0]=nwt(this,BSt),e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=nwt(this,YSt)<<3|nwt(this,FSt)>>>29,e[15]=nwt(this,FSt)<<3,this.hash()}hash(){let e,t,r,n,i,a,o,s,u,c,l=nwt(this,USt),d=nwt(this,jSt),f=nwt(this,zSt),h=nwt(this,GSt),p=nwt(this,VSt),m=nwt(this,HSt),g=nwt(this,qSt),v=nwt(this,WSt),y=nwt(this,NSt);for(let r=16;r<64;++r)n=y[r-15],e=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,n=y[r-2],t=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,y[r]=y[r-16]+e+y[r-7]+t|0;c=d&f;for(let b=0;b<64;b+=4)nwt(this,$St)?(nwt(this,KSt)?(o=300032,n=y[0]-1413257819,v=n-150054599|0,h=n+24177077|0):(o=704751109,n=y[0]-210244248,v=n-1521486534|0,h=n+143694565|0),rwt(this,$St,!1)):(e=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),t=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),o=l&d,r=o^l&f^c,a=p&m^~p&g,n=v+t+a+uwt[b]+y[b],i=e+r,v=h+n|0,h=n+i|0),e=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),t=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),s=h&l,r=s^h&d^o,a=v&p^~v&m,n=g+t+a+uwt[b+1]+y[b+1],i=e+r,g=f+n|0,f=n+i|0,e=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),t=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),u=f&h,r=u^f&l^s,a=g&v^~g&p,n=m+t+a+uwt[b+2]+y[b+2],i=e+r,m=d+n|0,d=n+i|0,e=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),t=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),c=d&f,r=c^d&h^u,a=m&g^~m&v,n=p+t+a+uwt[b+3]+y[b+3],i=e+r,p=l+n|0,l=n+i|0;rwt(this,USt,nwt(this,USt)+l|0),rwt(this,jSt,nwt(this,jSt)+d|0),rwt(this,zSt,nwt(this,zSt)+f|0),rwt(this,GSt,nwt(this,GSt)+h|0),rwt(this,VSt,nwt(this,VSt)+p|0),rwt(this,HSt,nwt(this,HSt)+m|0),rwt(this,qSt,nwt(this,qSt)+g|0),rwt(this,WSt,nwt(this,WSt)+v|0)}hex(){this.finalize();let e=nwt(this,USt),t=nwt(this,jSt),r=nwt(this,zSt),n=nwt(this,GSt),i=nwt(this,VSt),a=nwt(this,HSt),o=nwt(this,qSt),s=nwt(this,WSt),u=awt[e>>28&15]+awt[e>>24&15]+awt[e>>20&15]+awt[e>>16&15]+awt[e>>12&15]+awt[e>>8&15]+awt[e>>4&15]+awt[15&e]+awt[t>>28&15]+awt[t>>24&15]+awt[t>>20&15]+awt[t>>16&15]+awt[t>>12&15]+awt[t>>8&15]+awt[t>>4&15]+awt[15&t]+awt[r>>28&15]+awt[r>>24&15]+awt[r>>20&15]+awt[r>>16&15]+awt[r>>12&15]+awt[r>>8&15]+awt[r>>4&15]+awt[15&r]+awt[n>>28&15]+awt[n>>24&15]+awt[n>>20&15]+awt[n>>16&15]+awt[n>>12&15]+awt[n>>8&15]+awt[n>>4&15]+awt[15&n]+awt[i>>28&15]+awt[i>>24&15]+awt[i>>20&15]+awt[i>>16&15]+awt[i>>12&15]+awt[i>>8&15]+awt[i>>4&15]+awt[15&i]+awt[a>>28&15]+awt[a>>24&15]+awt[a>>20&15]+awt[a>>16&15]+awt[a>>12&15]+awt[a>>8&15]+awt[a>>4&15]+awt[15&a]+awt[o>>28&15]+awt[o>>24&15]+awt[o>>20&15]+awt[o>>16&15]+awt[o>>12&15]+awt[o>>8&15]+awt[o>>4&15]+awt[15&o];return nwt(this,KSt)||(u+=awt[s>>28&15]+awt[s>>24&15]+awt[s>>20&15]+awt[s>>16&15]+awt[s>>12&15]+awt[s>>8&15]+awt[s>>4&15]+awt[15&s]),u}toString(){return this.hex()}digest(){this.finalize();let e=nwt(this,USt),t=nwt(this,jSt),r=nwt(this,zSt),n=nwt(this,GSt),i=nwt(this,VSt),a=nwt(this,HSt),o=nwt(this,qSt),s=nwt(this,WSt),u=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o];return nwt(this,KSt)||u.push(s>>24&255,s>>16&255,s>>8&255,255&s),u}array(){return this.digest()}arrayBuffer(){this.finalize();let e=new ArrayBuffer(nwt(this,KSt)?28:32),t=new DataView(e);return t.setUint32(0,nwt(this,USt)),t.setUint32(4,nwt(this,jSt)),t.setUint32(8,nwt(this,zSt)),t.setUint32(12,nwt(this,GSt)),t.setUint32(16,nwt(this,VSt)),t.setUint32(20,nwt(this,HSt)),t.setUint32(24,nwt(this,qSt)),nwt(this,KSt)||t.setUint32(28,nwt(this,WSt)),e}};function dwt(e){let t=new lwt;return t.update(e),parseInt(t.hex().substring(0,8),16)}BSt=new WeakMap,NSt=new WeakMap,FSt=new WeakMap,LSt=new WeakMap,$St=new WeakMap,USt=new WeakMap,jSt=new WeakMap,zSt=new WeakMap,GSt=new WeakMap,VSt=new WeakMap,HSt=new WeakMap,qSt=new WeakMap,W
807St=new WeakMap,XSt=new WeakMap,YSt=new WeakMap,KSt=new WeakMap,ZSt=new WeakMap,QSt=new WeakMap;var fwt=function(e,t,r){var n=r<.5?r*(1+t):r+t-r*t,i=2*r-n;return[(e/=360)+1/3,e,e-1/3].map(function(e){return e<0&&e++,e>1&&e--,e=e<1/6?i+6*(n-i)*e:e<.5?n:e<2/3?i+6*(n-i)*(2/3-e):i,Math.round(255*e)})},hwt=(e,t,r)=>`\n      ${e&&t?`<h4>InterPro Representative Domain ${v(e)}-${v(t)}</h4><hr />`:""}\n        <h5>Accession</h5>\n        <p>\n        <a\n          target="_blank"\n          rel="noopener"\n          href="https://www.ebi.ac.uk/interpro/entry/${encodeURIComponent(r.source_database)}/${encodeURIComponent(r.accession)}/"\n        >\n        ${v(r.accession)}\n        </a>\n        </p>\n        <h5>Name</h5>\n        <p>${v(r.name)}</p>\n        ${r.integrated?`<h5>Integrated into </h5>\n        <p>\n        <a\n          target="_blank"\n          rel="noopener"\n          href="https://www.ebi.ac.uk/interpro/entry/InterPro/${encodeURIComponent(r.integrated)}/"\n        >\n          ${v(r.integrated)}\n        </a>\n        </p>`:""}\n      `,pwt=new class{constructor(e={}){let[t,r]=[e.lightness,e.saturation].map(function(e){return e=void 0===e?[.35,.5,.65]:e,Array.isArray(e)?e.concat():[e]});this.L=t,this.S=r,"number"==typeof e.hue&&(e.hue={min:e.hue,max:e.hue}),"object"==typeof e.hue&&!Array.isArray(e.hue)&&(e.hue=[e.hue]),void 0===e.hue&&(e.hue=[]),this.hueRanges=e.hue.map(function(e){return{min:void 0===e.min?0:e.min,max:void 0===e.max?360:e.max}}),this.hash=dwt,"function"==typeof e.hash&&(this.hash=e.hash),"bkdr"===e.hash&&(this.hash=iwt)}hsl(e){var t,r,n=this.hash(e);if(this.hueRanges.length){let e=this.hueRanges[n%this.hueRanges.length];t=n/this.hueRanges.length%727*(e.max-e.min)/727+e.min}else t=n%359;return n=Math.ceil(n/360),r=this.S[n%this.S.length],n=Math.ceil(n/this.S.length),[t,r,this.L[n%this.L.length]]}rgb(e){var t=this.hsl(e);return fwt.apply(this,t)}hex(e){return function(e){var t="#";return e.forEach(function(e){e<16&&(t+=0),t+=e.toString(16)}),t}(this.rgb(e))}}({hash:"bkdr",saturation:[.65,.35,.5],lightness:[.65,.35,.5]}),mwt=e=>`https://www.ensembl.org/id/${encodeURIComponent(e)}`,gwt=({sequence:e,features:t=[]})=>({sequence:e,variants:t.map(e=>{let t={...e,accession:e.variantType.genomicLocation?.join(", "),variant:e.variantType.mutatedType||sQe.Empty,start:+e.locationType.position.position,end:+e.locationType.position.position,consequenceType:e.variantType.consequenceType,tooltipContent:""};return t.tooltipContent=(e=>`\n  ${e.start&&e.end?`<h4>RNA Edit ${v(e.start)}-${v(e.end)}</h4><hr />`:""}\n  <h5>Variant</h5>\n  <p>${v(e.variantType.wildType)} > ${v(e.variantType.mutatedType)}</p>\n  <h5>Consequence</h5>\n  <p>${v(e.consequenceType)}</p>\n  <h5>Location</h5>\n  <ul class="no-bullet">${e.variantType.genomicLocation.map(e=>`<li>${v(e)}</li>`).join("")}\n  ${(e=>{let t=[],r=(e=>e.dbReferenceType.find(e=>"rna_editing"===e.type)?.id)(e);r&&t.push(`REDIportal <a href="${(e=>`http://srv00.recas.ba.infn.it/cgi/atlas/getpage_dev.py?query9=hg&query10=hg38&acc=${encodeURIComponent(e)}`)(r)}" target="_blank">${v(r)}</a>`);for(let r of e.variantType.variantLocation)"Ensembl"===r.source&&t.push(`Ensembl <a href="${mwt(r.seqId)}" target="_blank">${v(r.seqId)}</a>`);return 0===t.length?"":`<br><ul class="no-bullet">${t.map(e=>`<li>${e}</li>`).join("")}</ul>`})(e)}\n  `)(t),t})}),vwt=function(e){return e.Gold="#c39b00",e.Silver="#8194a1",e.Bronze="#a65708",e}(vwt||{}),ywt=.1132,bwt=.2264,_wt=.3395,xwt=.4527,Swt=.5895,wwt=.7264,Awt=.8632,Cwt=/\s*\n\s*/,Twt=/^(.)(\d+)(.),(.+),(\w+)$/,Pwt=[{min:0,max:ywt,code:"H"},{min:ywt,max:bwt,code:"V"},{min:bwt,max:_wt,code:"L"},{min:_wt,max:xwt,code:"A"},{min:xwt,max:Swt,code:"l"},{min:Swt,max:wwt,code:"h"},{min:wwt,max:Awt,code:"p"},{min:Awt,max:1,code:"P"}],Ewt=e=>{for(let{min:t,max:r,code:n}of Pwt)if(e>=t&&e<r)return n},Mwt="https://www.ebi.ac.uk/proteins/api/",kwt="https://alphafold.ebi.ac.uk/api/",Iwt="https://alphafold.ebi.ac.uk/entry/",Dwt=`${Mwt}proteins/`,Owt=`${Mwt}features/`,Rwt=`${Mwt}variation/`,Bwt=`${Mwt}proteomics/nonPtm/`,Nwt=`${Mwt}proteomics/ptm/`,Fwt={categories:[{name:"MOLECULE_PROCESSING",label:"Molecule processing",trackType:"nightingale-track-canvas",tracks:[{name:"signal",label:"Signal peptide",filter:"SIGNAL",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"N-terminal signal peptide",helpPage:"signal"},{name:"chain",label:"Chain",filter:"CHAIN",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"(aka mature region). This describes the extent of a polypeptide chain in the mature protein following processing",helpPage:"chain"},{name:"transit",label:"Transit peptide",filter:"TRANSIT",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"This describes the extent of a transit peptide",helpPage:"transit"},{name:"init_met",label:"Initiator methionine",filter:"INIT_MET",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"This indicates that the initiator methionine is cleaved from the mature protein",helpPage:"init_met"},{name:"propep",label:"Propeptide",filter:"PROPEP",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Part of a protein that is cleaved during maturation or activation",helpPage:"propep"},{name:"peptide",label:"Peptide",filter:"PEPTIDE",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"The position and length of an active peptide in the mature protein",helpPage:"peptide"}]},{name:"SEQUENCE_INFORMATION",label:"Sequence information",trackType:"nightingale-track-canvas",tracks:[{name:"compbias",label:"Compositional bias",filter:"COMPBIAS",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Position of regions of compositional bias within the protein and the particular amino acids that are over-represented within those regions",helpPage:"compbias"},{name:"conflict",label:"Sequence conflict",filter:"CONFLICT",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Sequence discrepancies of unknown origin",helpPage:"conflict"},{name:"non_cons",filter:"NON_CONS",trackType:"nightingale-track-canvas",label:"Non-adjacent residues",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Indicates that two residues in a sequence are not consecutive and that there is an undetermined number of unsequenced residues between them",helpPage:"non_cons"},{name:"non_ter",filter:"NON_TER",trackType:"nightingale-track-canvas",label:"Non-terminal residue",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"The sequence is incomplete. The residue is not the terminal residue of the complete protein",helpPage:"non_ter"},{name:"unsure",filter:"UNSURE",trackType:"nightingale-track-canvas",label:"Sequence uncertainty",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Regions of a sequence for which the authors are unsure about the sequence assignment",helpPage:"unsure"},{name:"non_std",filter:"NON_STD",trackType:"nightingale-track-canvas",label:"Non-standard residue",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Non-standard amino acids (selenocysteine and pyrrolysine)",helpPage:"non_std"}]},{name:"TOPOLOGY",label:"Topology",trackType:"nightingale-track-canvas",tracks:[{name:"topo_dom",label:"Topological domain",filter:"TOPO_DOM",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Location of non-membrane regions of membrane-spanning proteins",helpPage:"topo_dom"},{name:"transmem",label:"Transmembrane",filter:"TRANSMEM",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Extent of a membrane-spanning region",helpPage:"transmem"},{name:"intramem",label:"Intramembrane",filter:"INTRAMEM",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}
807],tooltip:"Extent of a region located in a membrane without crossing it",helpPage:"intramem"}]},{name:"DOMAINS",label:"Domains",trackType:"nightingale-track-canvas",tracks:[{name:"domain",label:"Domain",filter:"DOMAIN",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Specific combination of secondary structures organized into a characteristic three-dimensional structure or fold",helpPage:"domain"},{name:"InterPro representative domain",label:"InterPro Representative Domain",trackType:"nightingale-track-canvas",data:[{adapter:"interpro-adapter",url:"https://www.ebi.ac.uk/interpro/wwwapi/entry/all/protein/uniprot/{accession}?type=domain&page_size=100"}],tooltip:"InterPro representative domains",helpPage:"InterPro_rep_domain"},{name:"region",label:"Region",filter:"REGION",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Regions in multifunctional enzymes or fusion proteins, or characteristics of a region, e.g., protein-protein interactions mediation",helpPage:"region"},{name:"repeat",label:"Repeat",filter:"REPEAT",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Repeated sequence motifs or repeated domains within the protein",helpPage:"repeat"},{name:"motif",label:"Motif",filter:"MOTIF",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Short conserved sequence motif of biological significance",helpPage:"motif"},{name:"zn_fing",label:"Zinc finger",filter:"ZN_FING",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Small, functional, independently folded domain that coordinates one or more zinc ions",helpPage:"zn_fing"}]},{name:"SITES",label:"Sites",trackType:"nightingale-track-canvas",tracks:[{name:"metal",label:"Metal binding",filter:"METAL",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Binding site for a metal ion",helpPage:"binding"},{name:"site",label:"Site",filter:"SITE",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Any interesting single amino acid site on the sequence",helpPage:"site"},{name:"ca_bind",label:"Calcium binding",filter:"CA_BIND",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Calcium-binding regions, such as the EF-hand motif",helpPage:"binding"},{name:"dna_bind",label:"DNA binding",filter:"DNA_BIND",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"DNA-binding domains such as AP2/ERF domain, the ETS domain, the Fork-Head domain, the HMG box and the Myb domain",helpPage:"dna_bind"},{name:"np_bind",label:"Nucleotide binding",filter:"NP_BIND",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"(aka flavin-binding). Region in the protein which binds nucleotide phosphates",helpPage:"binding"},{name:"binding",label:"Binding site",filter:"BINDING",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Binding site for any chemical group (co-enzyme, prosthetic group, etc.)",helpPage:"binding"},{name:"act_site",label:"Active site",filter:"ACT_SITE",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Amino acid(s) directly involved in the activity of an enzyme",helpPage:"act_site"}]},{name:"PTM",label:"PTM",trackType:"nightingale-track-canvas",tracks:[{name:"mod_res",label:"Modified residue",filter:"MOD_RES",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Modified residues such as phosphorylation, acetylation, acylation, methylation",helpPage:"mod_res"},{name:"mod_res_ls",label:"Modified residue (large scale data)",filter:"MOD_RES_LS",trackType:"nightingale-track-canvas",data:[{adapter:"proteomics-ptm-adapter",url:`${Nwt}{accession}`}],tooltip:"Modified residues from Large scale studies",helpPage:"mod_res_large_scale"},{name:"carbohyd",label:"Glycosylation",filter:"CARBOHYD",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}
807],tooltip:"Covalently attached glycan group(s)",helpPage:"carbohyd"},{name:"disulfid",label:"Disulfide bond",filter:"DISULFID",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"The positions of cysteine residues participating in disulphide bonds",helpPage:"disulfid"},{name:"crosslnk",label:"Cross-link",filter:"CROSSLNK",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Covalent linkages of various types formed between two proteins or between two parts of the same protein",helpPage:"crosslnk"},{name:"lipid",label:"Lipidation",filter:"LIPID",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Covalently attached lipid group(s)",helpPage:"lipid"}]},{name:"EPITOPE",label:"Epitopes",trackType:"nightingale-track-canvas",tracks:[{name:"epitope",label:"Epitope",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Mwt}epitope/{accession}`}],tooltip:"",helpPage:"epitopes"}]},{name:"ANTIGEN",label:"Antigenic sequences",trackType:"nightingale-track-canvas",tracks:[{name:"antigen",label:"Antibody binding sequences",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Mwt}antigen/{accession}`}],tooltip:"",helpPage:"Antibody_binding_sequences"}]},{name:"MUTAGENESIS",label:"Mutagenesis",trackType:"nightingale-track-canvas",tracks:[{name:"mutagen",label:"Mutagenesis",filter:"MUTAGEN",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Owt}{accession}`}],tooltip:"Site which has been experimentally altered by mutagenesis",helpPage:"mutagen"},{name:"othermutagen",label:"Mutagenesis (large scale data)",trackType:"nightingale-track-canvas",data:[{adapter:"feature-adapter",url:`${Mwt}mutagenesis/{accession}`}],tooltip:"Site which has been experimentally altered by mutagenesis",helpPage:"mutagen"}]},{name:"VARIATION",label:"Variants",trackType:"nightingale-linegraph-track",helpPage:"variant_viewer",tracks:[{name:"variation_graph",label:"Counts",trackType:"nightingale-linegraph-track",data:[{adapter:"variation-graph-adapter",url:`${Rwt}{accession}`}],tooltip:"Natural variant of the protein, including polymorphisms, variations between strains, isolates or cultivars, disease-associated mutations and RNA editing events"},{name:"variation",filterComponent:"nightingale-filter",trackType:"nightingale-variation-canvas",data:[{adapter:"variation-adapter",url:`${Rwt}{accession}`}],tooltip:"Natural variant of the protein, including polymorphisms, variations between strains, isolates or cultivars, disease-associated mutations and RNA editing events"}]},{name:"RNA_EDITING",label:"RNA Editing",trackType:"nightingale-linegraph-track",helpPage:"rna_editing",tracks:[{name:"rna_editing_graph",label:"Counts",trackType:"nightingale-linegraph-track",data:[{adapter:"rna-editing-graph-adapter",url:`${Mwt}rna-editing/{accession}`}],tooltip:"RNA editing events leading to one or more amino acid changes compared to the translation of the non-edited RNA version."},{name:"RNA Editing",trackType:"nightingale-variation-canvas",data:[{adapter:"rna-editing-adapter",url:`${Mwt}rna-editing/{accession}`}],tooltip:"RNA editing events leading to one or more amino acid changes compared to the translation of the non-edited RNA version."}]},{name:"PROTEOMICS",label:"Proteomics",trackType:"nightingale-track-canvas",tracks:[{name:"unique",label:"Unique peptide",filter:"unique",trackType:"nightingale-track-canvas",data:[{adapter:"proteomics-adapter",url:`${Bwt}{accession}`}],tooltip:"",helpPage:"proteomics#1-data-from-public-mass-spectrometry-based-proteomics-resources"},{name:"non_unique",label:"Non-unique peptide",filter:"non_unique",trackType:"nightingale-track-canvas",data:[{adapter:"proteomics-adapter",url:`${Bwt}{accession}`}],tooltip:"",helpPage:"proteomics#1-data-from-public-mass-spectrometry-based-proteomics-resources"},{name:"hpp",label:"Human proteome project",trackType:"nightingale-track-canvas",data:[{adapter:"proteomics-adapter",url:`${Mwt}proteomics/hpp/{accession}`}],tooltip:"",helpPage:"proteomics#3-human-proteome-project"},{name:"proteomics-ptm",label:"PTM-containing peptide",trackType:"nightingale-track-canvas",data:[{adapter:"proteomics-adapter",url:`${Nwt}{accession}`}],tooltip:"",helpPage:"proteomics#4-post-translational-modification-ptm-data-derived-from-large-scale-mass-spectrometry-ms-datasets"}]},{name:"STRUCTURE_COVERAGE",label:"PDBe 3D structure coverage",trackType:"nightingale-track-canvas",tracks:[{name:"pdbe_cover",label:"PDBe coverage",trackType:"nightingale-track-canvas",tooltip:"PDBe 3D structure coverage",data:[{adapter:"structure-adapter",url:`${Dwt}{accession}`}],helpPage:"structure_section#structure-coverage"}]},{name:"ALPHAFOLD_CONFIDENCE",label:"AlphaFold",trackType:"nightingale-colored-sequence",scale:"H:90,M:70,L:50,D:0","color-range":"#ff7d45:0,#ffdb13:50,#65cbf3:70,#0053d6:90,#0053d6:100",helpPage:"structure_section#alphafold-structural-models",tracks:[{name:"alphafold_confidence",label:"AlphaFold Confidence",labelUrl:`${Iwt}{accession}`,trackType:"nightingale-colored-sequence",data:[{adapter:"alphafold-confidence-adapter",url:[`${kwt}prediction/{accession}`,`${Dwt}{accession}`]}],tooltip:"AlphaFold prediction confidence"}]},{name:"ALPHAMISSENSE_PATHOGENICITY",label:"AlphaMissense",trackType:"nightingale-colored-sequence",scale:"B:0,H:0.1132,V:0.2264,L:0.3395,A:0.4527,l:0.5895,h:0.7264,p:0.8632,P:1","color-range":"#2166ac:0,#4290bf:0.1132,#8cbcd4:0.2264,#c3d6e0:0.3395,#e2e2e2:0.4527,#edcdba:0.5895,#e99e7c:0.7264,#d15e4b:0.8632,#b2182b:1",helpPage:"structure_section#alphamissense-prediction-of-genetic-variation-consequence-in-the-feature-viewer",tracks:[{name:"alphamissense_pathogenicity",label:"Average Pathogenicity Score",trackType:"nightingale-colored-sequence",data:[{adapter:"alphamissense-pathogenicity-adapter",url:[`${kwt}prediction/{accession}`,`${Dwt}{accession}`]}],tooltip:"AlphaMissense pathogenicity"},{name:"alphamissense_pathogenicity_heatmap",label:"AlphaMissense Pathogenicity",labelUrl:`${Iwt}{accession}`,trackType:"nightingale-sequence-heatmap",data:[{adapter:"alphamissense-heatmap-adapter",url:[`${kwt}prediction/{accession}`,`${Dwt}{accession}`]}],tooltip:"AlphaMissense pathogenicity"}]}]},Lwt=cr`
808  .track-content {
809    width: 80vw;
810  }
811
812  .track-content__coloured-sequence {
813    display: flex;
814    align-items: center;
815  }
816
817  .nav-container,
818  .category__track {
819    display: flex;
820    margin-bottom: 0.1rem;
821  }
822
823  .category {
824    display: none;
825    margin-bottom: 0.1rem;
826  }
827
828  .category-label,
829  .track-label,
830  .nav-track-label,
831  .credits {
832    min-width: 20vw;
833    max-width: 20vw;
834    padding: 0.5em;
835    line-height: normal;
836  }
837
838  .category-label {
839    background-color: #b2f5ff;
840    cursor: pointer;
841  }
842
843  .category-label::before {
844    content: ' ';
845    display: inline-block;
846    width: 0;
847    height: 0;
848    border-top: 5px solid transparent;
849    border-bottom: 5px solid transparent;
850    border-left: 5px solid #333;
851    margin-right: 5px;
852    -webkit-transition: all 0.1s;
853    /* Safari */
854    -o-transition: all 0.1s;
855    transition: all 0.1s;
856  }
857
858  .category-label.open::before {
859    content: ' ';
860    display: inline-block;
861    width: 0;
862    height: 0;
863    border-left: 5px solid transparent;
864    border-right: 5px solid transparent;
865    border-top: 5px solid #333;
866    margin-right: 5px;
867  }
868
869  .track-label {
870    background-color: #d9faff;
871  }
872
873  nightingale-track-canvas {
874    border-top: 1px solid #d9faff;
875  }
876
877  nightingale-navigation {
878    .handle {
879      fill: darkgrey;
880      stroke: black;
881      stroke-width: 0.5px;
882      height: 19px;
883    }
884  }
885
886  nightingale-filter {
887    font-size: 0.8rem;
888  }
889
890  .feature {
891    cursor: pointer;
892  }
893
894  .proforma {
895    padding-left: 4em;
896    white-space: normal;
897    overflow-wrap: anywhere;
898    word-break: break-word;
899  }
900
901  .mod-link {
902    white-space: nowrap;
903  }
904`,$wt=e=>{0===performance.getEntriesByName(e,"mark").length&&performance.mark(e)},Uwt=(e,t,r)=>{if(0===performance.getEntriesByName(e,"measure").length)try{performance.measure(e,t,r)}catch{}};async function jwt(e,t){switch(e){case"feature-adapter":return(e=>{let t=[],{features:r}=e;return r&&r.length>0&&(t=cbe(r).map(e=>({...e,tooltipContent:N(e)}))),t})(...t);case"interpro-adapter":return(e=>{try{return e?.results?.map(({metadata:e,proteins:t})=>{let r=t[0].entry_protein_locations?Math.min(...t[0].entry_protein_locations.map(e=>Math.min(...e.fragments.map(e=>e.start)))):"",n=t[0].entry_protein_locations?Math.max(...t[0].entry_protein_locations?.map(e=>Math.max(...e.fragments.map(e=>e.end)))||[]):"";return{...e,locations:t[0].entry_protein_locations,start:r,end:n,color:pwt.hex(e.accession.toLowerCase().split("").reverse().join("")),tooltipContent:hwt(r,n,e),length:t[0].protein_length}})}catch(e){throw Error(`Failed transforming the data: ${e}`)}})(...t);case"proteomics-adapter":return(e=>{let t=[];return e&&e.features&&0!==e.features.length&&(t=cbe(e.features).map(t=>(t.residuesToHighlight=t.ptms?.map(e=>({name:e.name,position:e.position,sources:e.sources,dbReferences:e.dbReferences})),Object.assign(t,((e,t)=>({category:"PROTEOMICS",type:e.unique?"unique":"non_unique",tooltipContent:N(e,String(t))}))(t,e.taxid))))),t})(...t);case"structure-adapter":return(e=>{let t=[];return e&&e.dbReferences&&(t=(e=>{if(!e||e.length<=0)return[];let t=e.sort((e,t)=>e.start-t.start),r=[];return t.forEach(e=>{let t=r[r.length-1];!t||t.end<e.start?r.push(e):(t.end<e.end&&(t.end=e.end),t.structures.push(e.structures[0]))}),r})((e=>e.dbReferences.filter(e=>"PDB"===e.type).map(e=>{let t=e.properties?.chains?(e=>{let t=e.indexOf("="),r=e.indexOf("-");return-1===t||-1===r?{start:0,end:0}:{start:+e.slice(t+1,r),end:+e.slice(r+1)}})(e.properties.chains):{start:0,end:0};return{type:"PDBE_COVER",category:"STRUCTURE_COVERAGE",structures:[{description:e.properties?ewt(e.properties):"",start:t.start,end:t.end,source:{id:e.id,url:`http://www.ebi.ac.uk/pdbe-srv/view/entry/${e.id}`}}],start:t.start,end:t.end}}))(e)),t.forEach(e=>{e.tooltipContent=F(e)})),t})(...t);case"variation-adapter":return(e=>{let{sequence:t,features:r}=e,n=r.map(e=>{let t={...e,accession:e.genomicLocation?.join(", ")??"",variant:e.alternativeSequence||sQe.Empty,start:+e.begin,xrefNames:twt(e.xrefs,e.sourceType),hasPredictions:!!(e.predictions&&e.predictions.length>0)};return{...t,tooltipContent:nr(t)}});return n?{sequence:t,variants:n}:null})(...t);case"variation-graph-adapter":return(e=>{if(e.sequence&&e.features.length){let t=e.features.map(e=>({...e,accession:e.genomicLocation?.join(", "),start:e.begin})),r=new Uint8ClampedArray(e.sequence.length),n=new Uint8ClampedArray(e.sequence.length);for(let{start:i,association:a}of t){let t=+i;t<1||t>e.sequence.length||(r[t]+=1,a&&a.find(e=>!0===e.disease)&&(n[t]+=1))}let i=[0,Math.max(Math.max(...r),Math.max(...n))];return[{name:"variant",range:i,color:"darkgrey",values:[...r].map((e,t)=>({position:t,value:e}))},{name:"disease causing variant",range:i,color:"red",values:[...n].map((e,t)=>({position:t,value:e}))}]}})(...t);case"rna-editing-adapter":return gwt(...t);case"rna-editing-graph-adapter":return(e=>{if(e.sequence&&e.features.length){let t=new Uint8ClampedArray(e.sequence.length),r=new 
904Uint8ClampedArray(e.sequence.length),n=new Uint8ClampedArray(e.sequence.length);for(let i of e.features){let a=+i.locationType.position.position,o=i.variantType.consequenceType;a>=0&&a<=e.sequence.length&&(t[a]+=1,"missense"===o?r[a]+=1:"synonymous"===o&&(n[a]+=1))}return[{name:"missense",range:[0,Math.max(...t)],color:"darkgrey",values:[...r].map((e,t)=>({position:t,value:e}))}]}})(...t);case"proteomics-ptm-adapter":return(e=>{if(e){let{features:t}=e,r={};if(t){for(let e of t)for(let t of e.ptms){let n=+e.begin+t.position-1;if(!Number.isFinite(n)){console.error(`Encountered infinite number: +feature.begin + ptm.position - 1 = ${+e.begin} + ${t.position} - 1`);continue}let i=e.peptide[t.position-1];n in r?r[n].aa===i?r[n].ptms.push(t):console.error(`One PTM has different amino acid values: [${r[n].aa}, ${i}]`):r[n]={ptms:[t],aa:i}}return Object.entries(r).map(([e,{ptms:t,aa:r}])=>((e,t,r)=>{let n={};for(let t of e)n[t.name]?n[t.name].push(t):n[t.name]=[t];return Object.values(n).map(e=>{let n=new Set(e.flatMap(({dbReferences:e})=>e?.map(({properties:e})=>e["Confidence score"]))),i=null;return n.size&&(n.size>1?console.error(`PTMeXchange PTM has a mixture of confidence scores: ${Array.from(n)}`):[i]=n),{source:"PTMeXchange",type:"MOD_RES_LS",start:r,end:r,shape:"triangle",tooltipContent:k(`MOD_RES_LS ${r}-${r}`,e,t,i??""),color:null!==i&&i in vwt&&vwt[i]||"black"}})})(t,r,+e)).flat()}}return[]})(...t);case"alphafold-confidence-adapter":return(async(e,t)=>{let r=e?.filter(({sequence:e})=>t.sequence.sequence===e);if(1===r.length){let e=(e=>e.cifUrl?.replace("-model","-confidence").replace(".cif",".json"))(r[0]);return e?(await(async e=>{try{return(await fetch(e)).json()}catch(e){return void console.error("Could not load AlphaFold confidence",e)}})(e))?.confidenceCategory.join(""):void 0}r.length>1&&console.warn(`Found more than one matches (${r.length}) for AlphaFold confidence adapter against protein sequence: ${t.sequence}`)})(...t);case"alphamissense-pathogenicity-adapter":return(async(e,t)=>{let r=e?.filter(({sequence:e,amAnnotationsUrl:r})=>t.sequence.sequence===e&&r);if(1===r.length){let e=r[0].amAnnotationsUrl;return e?await(async e=>{try{return(e=>{let t=[];for(let[r,n]of e.split(Cwt).entries()){if(0===r||!n)continue;let e=n.match(Twt);if(!e)continue;let[,i,a,o,s,u]=e,c=+a,l=c-1;t[l]||(t[l]=[]),t[l].push({wildType:i,position:c,mutated:o,pathogenicityScore:+s,pathogenicityLabel:u})}let r=[];for(let e of t){let t=Ewt(e.reduce((e,t)=>e+ +t.pathogenicityScore,0)/e.length);r.push(t)}return r.join("")})(await(await fetch(e)).text())}catch(e){return void console.error("Could not load AlphaMissense pathogenicity score",e)}})(e):void 0}r.length>1&&console.warn(`Found more than one matches (${r.length}) for AlphaMissense pathogenicity score against protein sequence: ${t.sequence}`)})(...t);case"alphamissense-heatmap-adapter":return(async(e,t)=>{let r=e?.filter(({sequence:e,amAnnotationsUrl:r})=>t.sequence.sequence===e&&r);if(1===r.length){let e=r[0].amAnnotationsUrl;return e?await(async e=>{try{return(e=>{let t=[];for(let[r,n]of e.split(Cwt).entries()){if(0===r||!n)continue;let e=n.match(Twt);if(!e)continue;let[,,i,a,o]=e;t.push({xValue:+i,yValue:a,score:+o})}return t})(await(await fetch(e)).text())}catch(e){return void console.error("Could not load AlphaMissense pathogenicity",e)}})(e):void 0}r.length>1&&console.warn(`Found more than one matches (${r.length}) for AlphaMissense pathogenicity against protein sequence: ${t.sequence}`)})(...t);default:throw Error(`Unknown adapter: ${e}`)}}var zwt=class extends mn{constructor(){super(),this.data={},this.rawData={},this.displayCoordinates={},this.openCategories=[],this.nostructure=!1,this.hasData=!1,this.loading=!0,this.displayCoordinates={},this.transformedVariants={sequence:"",variants:[]},this.addStyles()}static get properties(){return{suspend:{type:Boolean,reflect:!0},accession:{type:String,reflect:!0},sequence:{type:String},data:{type:Object},openCategories:{type:Array},config:{type:Object},notooltip:{type:Boolean,reflect:!0},nostructure:{type:Boolean,reflect:!0}}}addStyles(){let e=document.createElement("style");e.textContent=`${Lwt.toString()} ${hbe.toString()}`,document.querySelector("head")?.append(e)}registerWebComponents(){lbe("nightingale-navigation",rTe),lbe("nightingale-track-canvas",tze),lbe("nightingale-colored-sequence",NDe),lbe("nightingale-interpro-track",Qqe),lbe("nightingale-sequence",Eke),lbe("nightingale-variation-canvas",NJe),lbe("nightingale-linegraph-track",G5e),lbe("nightingale-filter",JSt),lbe("nightingale-manager",o_e),lbe("protvista-uniprot-structure",Sbe),lbe("nightingale-sequence-heatmap",abt)}
904async _loadData(){let e=this.accession;if(e&&this.config){let t=this.config.categories.flatMap(({tracks:e})=>e.flatMap(({data:e})=>e[0].url));this.rawData=await dbe([...new Set(t)],t=>t.replace("{accession}",e));let r=this.hasData;this.hasData=this.hasData||Object.values(this.rawData).some(e=>{if(e&&"object"==typeof e&&"features"in e){let t=e.features;return Array.isArray(t)&&t.length>0}return!1}),this.hasData&&!r&&this.dispatchEvent(new CustomEvent("protvista-event",{detail:{hasData:!0},bubbles:!0}));for(let{name:e,tracks:t,trackType:r}of this.config.categories){let n=await Promise.all(t.map(async({data:t,name:r,filter:n})=>{let{url:i,adapter:a}=t[0],o=(Array.isArray(i)?i:[i]).map(e=>this.rawData[e]||[]);if(!o||"variation-adapter"===a&&Array.isArray(o[0])&&0===o[0].length)return;let s=a?await jwt(a,o):o;if("interpro-adapter"===a){let e=[];s?.forEach(t=>{t.locations?.forEach(r=>{r.representative&&r.fragments?.forEach(r=>{e.push({...t,type:"InterPro Representative Domain",start:r.start,end:r.end})})})}),s=e}let u=Array.isArray(s)&&n?s.filter(({type:e})=>e===n):s;return u?(this.data[`${e}-${r}`]=u,"variation"===r&&(this.transformedVariants=u),u):void 0}));this.data[e]="nightingale-linegraph-track"===r||"nightingale-colored-sequence"===r?n[0]:n.flat()}}this.loading=!1,$wt("protvista:data-loaded"),Uwt("protvista:fetch-and-parse","protvista:script-start","protvista:data-loaded"),this.requestUpdate()}async _loadDataInComponents(){await Ibe(),Object.entries(this.data).forEach(([e,t])=>{let r=document.getElementById(`track-${e}`);r&&r.data!==t&&(r.data=t);let n=this.config?.categories.find(({name:t})=>t===e),i=t;if(n&&n.tracks&&i&&((i.length??0)>0||(i.variants?.length??0)>0)){let t=document.getElementById(`category_${n.name}`);t&&(t.style.display="flex");for(let t of n.tracks){let r=document.getElementById(`track-${e}-${t.name}`);r&&(r.data=this.data[`${e}-${t.name}`])}}if("ALPHAMISSENSE_PATHOGENICITY"===n?.name&&n.tracks)for(let t of n.tracks)if("nightingale-sequence-heatmap"===t.trackType){let r=this.querySelector("nightingale-sequence-heatmap");if(r&&this.sequence){let n=this.data[`${e}-${t.name}`],i=Array.from({length:this.sequence.length},(e,t)=>t+1),a=[...new Set(n.map(e=>e.yValue))];r.setHeatmapData(i,a,n),r.updateComplete.then(()=>{r.heatmapInstance?.setColor(e=>Nye(e.score))})}}})}updated(e){super.updated(e),this.hasData&&!this.loading&&($wt("protvista:first-render"),Uwt("protvista:render","protvista:data-loaded","protvista:first-render"),Uwt("protvista:total","protvista:script-start","protvista:first-render"));let t=this.querySelector("nightingale-filter");t&&t.filters!==d&&(t.filters=d);let r=this.querySelector("nightingale-variation-canvas");if(r&&r?.colorConfig!==h&&(r.colorConfig=h),e.has("suspend")){if(this.suspend)return;this._init()}this._loadDataInComponents()}_init(){this.config||=Fwt,this.accession&&(this.loadEntry(this.accession).then(e=>{e&&(this.sequence=e.sequence.sequence,this.displayCoordinates={start:1,end:this.sequence?.length})}),this._loadData())}connectedCallback(){super.connectedCallback(),$wt("protvista:script-start"),this.registerWebComponents(),this.suspend||this._init(),this.addEventListener("change",e=>{e.detail?.displaystart&&(this.displayCoordinates.start=e.detail.displaystart),e.detail?.displayend&&(this.displayCoordinates.end=e.detail.displayend)})}async loadEntry(e){try{return await(await fetch(`https://www.ebi.ac.uk/proteins/api/proteins/${e}`)).json()}catch(e){return void console.error("Couldn't load UniProt entry",e)}}createRenderRoot(){return this}render(){return this.sequence&&this.config&&!this.suspend?this.loading?Xr`<div class="protvista-loader">
905        ${Yr`${Cn(fbe)}`}
906      </div>`:this.hasData?Xr`
907      <nightingale-manager
908        reflected-attributes="length display-start display-end highlight activefilters filters"
909      >
910        <div class="nav-container">
911          <div class="nav-track-label"></div>
912          <div class="track-content">
913            <nightingale-navigation
914              length="${this.sequence.length}"
915              height="40"
916            ></nightingale-navigation>
917            <nightingale-sequence
918              length="${this.sequence.length}"
919              height="40"
920              sequence="${this.sequence}"
921              display-start=${this.displayCoordinates?.start}
922              display-end="${this.displayCoordinates?.end}"
923              highlight-event="onclick"
924              use-ctrl-to-zoom
925            ></nightingale-sequence>
926          </div>
927        </div>
928        ${this.config.categories.map(e=>this.data[e.name]&&Xr`
929              <div class="category" id="category_${e.name}">
930                <div
931                  class="category-label"
932                  data-category-toggle="${e.name}"
933                  @click="${this.handleCategoryClick}"
934                >
935                  ${e.helpPage?Xr`<span data-article-id="${e.helpPage}"
936                        >${e.label}</span
937                      >`:e.label}
938                </div>
939                <div
940                  data-id="category_${e.name}"
941                  class="aggregate-track-content track-content ${"nightingale-colored-sequence"===e.trackType?"track-content__coloured-sequence":""}"
942                  .style="${this.openCategories.includes(e.name)?"opacity:0":"opacity:1"}"
943                >
944                  ${this.data[e.name]&&this.getTrack(e.trackType,"non-overlapping",e.color,e.shape,e.name,e.scale,e["color-range"])}
945                </div>
946              </div>
947
948              <!-- Expanded Categories -->
949              ${e.tracks&&e.tracks.map(t=>{if(this.openCategories.includes(e.name)){let r=this.data[`${e.name}-${t.name}`];return r&&(Array.isArray(r)&&r.length||Object.keys(r).length)?Xr`
950                        <div class="category__track" id="track_${t.name}">
951                          <div class="track-label" title="${t.tooltip}">
952                            ${t.filterComponent&&this.getFilterComponent(`${e.name}-${t.name}`)||t.labelUrl&&this.accession&&Xr`<a
953                                target="_blank"
954                                href="${t.labelUrl.replace("{accession}",this.accession)}"
955                                >${t.label}</a
956                              >`||(t.helpPage?Xr`<span data-article-id="${t.helpPage}"
957                                  >${t.label}</span
958                                >`:t.label)}
959                          </div>
960                          <div
961                            class="track-content"
962                            class="track-content ${"nightingale-colored-sequence"===e.trackType?"track-content__coloured-sequence":""}"
963                            data-id="track_${t.name}"
964                          >
965                            ${this.getTrack(t.trackType,"non-overlapping",t.color||e.color,t.shape||e.shape,`${e.name}-${t.name}`,t.scale||e.scale,t["color-range"]||e["color-range"])}
966                          </div>
967                        </div>
968                      `:""}})}
969              ${e.tracks?"":this.data[e.name].map(t=>{if(this.openCategories.includes(e.name))return t&&t.accession?Xr`
970                          <div
971                            class="category__track"
972                            id="track_${t.accession}"
973                          >
974                            <div class="track-label" title="${t.accession}">
975                              ${t.accession}
976                            </div>
977                            <div
978                              class="track-content"
979                              data-id="track_${t.accession}"
980                            >
981                              ${this.getTrack(e.trackType,"non-overlapping",e.color,e.shape,`${e.name}-${t.accession}`,e.scale,e["color-range"])}
982                            </div>
983                          </div>
984                        `:""})}
985            `)}
986        <div class="nav-container">
987          <div class="credits"></div>
988          <div class="track-content">
989            <nightingale-sequence
990              length="${this.sequence.length}"
991              height="40"
992              sequence="${this.sequence}"
993              display-start=${this.displayCoordinates.start}
994              display-end="${this.displayCoordinates.end}"
995              highlight-event="onclick"
996              use-ctrl-to-zoom
997            ></nightingale-sequence>
998          </div>
999        </div>
1000        ${this.nostructure?"":Xr`
1001              <protvista-uniprot-structure
1002                accession="${this.accession||""}"
1003              ></protvista-uniprot-structure>
1004            `}
1005      </nightingale-manager>
1006    `:Xr`<div class="protvista-no-results">
1007        No feature data available for ${this.accession}
1008      </div>`:Xr``}handleCategoryClick(e){let t=e.target;t instanceof HTMLSpanElement&&(t=t.parentElement);let r=t.getAttribute("data-category-toggle");r&&!t.classList.contains("open")?(t.classList.add("open"),this.openCategories=[...this.openCategories,r]):(t.classList.remove("open"),this.openCategories=[...this.openCategories].filter(e=>e!==r))}groupByCategory(e,t){return e?.filter(e=>
1008e.type.name===t)}getFilter(e,t){return e?.filter(e=>e.name===t)?.[0]}handleFilterClick(e){let t=e.target,r=this.groupByCategory(t.filters,"consequence"),n=this.groupByCategory(t.filters,"provenance"),i=e.detail?.value;if(i){let e=i.map(e=>this.getFilter(r,e)).filter(Boolean),t=i.map(e=>this.getFilter(n,e)).filter(Boolean),a=this.transformedVariants?.variants?.filter(t=>e.some(e=>e.filterPredicate(t))).filter(e=>t.some(t=>t.filterPredicate(e))),o=this.data["VARIATION-variation"];this.data["VARIATION-variation"]={...o&&"object"==typeof o&&!Array.isArray(o)?o:{},variants:a},this._loadDataInComponents()}}getCategoryTypesAsString(e){return e.map(e=>e.filter).join(",")}getFilterComponent(e){return Xr`
1009      <nightingale-filter
1010        style="minWidth: 20%"
1011        for="track-${e}"
1012        @change="${this.handleFilterClick}"
1013      ></nightingale-filter>
1014    `}getTrack(e,t="",r="",n="",i="",a="",o=""){switch(e){case"nightingale-track-canvas":return Xr`
1015          <nightingale-track-canvas
1016            length="${this.sequence?.length}"
1017            height="40"
1018            layout="${t}"
1019            color="${r}"
1020            shape="${n}"
1021            display-start="${this.displayCoordinates?.start}"
1022            display-end="${this.displayCoordinates?.end}"
1023            id="track-${i}"
1024            highlight-event="onclick"
1025            use-ctrl-to-zoom
1026          >
1027          </nightingale-track-canvas>
1028        `;case"nightingale-interpro-track":return Xr`
1029          <nightingale-interpro-track
1030            length="${this.sequence?.length}"
1031            height="40"
1032            color="${r}"
1033            shape="${n}"
1034            display-start="${this.displayCoordinates?.start}"
1035            display-end="${this.displayCoordinates?.end}"
1036            id="track-${i}"
1037            highlight-event="onclick"
1038            use-ctrl-to-zoom
1039          >
1040          </nightingale-interpro-track>
1041        `;case"nightingale-variation-canvas":return Xr`
1042          <nightingale-variation-canvas
1043            length="${this.sequence?.length}"
1044            height="500"
1045            display-start="${this.displayCoordinates?.start}"
1046            display-end="${this.displayCoordinates?.end}"
1047            id="track-${i}"
1048            highlight-event="onclick"
1049            use-ctrl-to-zoom
1050          >
1051          </nightingale-variation-canvas
1052        `;case"nightingale-linegraph-track":return Xr`
1053          <nightingale-linegraph-track
1054            length="${this.sequence?.length}"
1055            height="50"
1056            display-start="${this.displayCoordinates?.start}"
1057            display-end="${this.displayCoordinates?.end}"
1058            id="track-${i}"
1059            show-label-name
1060            highlight-on-click
1061            use-ctrl-to-zoom
1062          >
1063          </nightingale-linegraph-track>
1064        `;case"nightingale-colored-sequence":return Xr`
1065          <nightingale-colored-sequence
1066            length="${this.sequence?.length}"
1067            display-start="${this.displayCoordinates?.start}"
1068            display-end="${this.displayCoordinates?.end}"
1069            id="track-${i}"
1070            scale="${a}"
1071            color-range="${o}"
1072            height="13"
1073            highlight-event="onclick"
1074            use-ctrl-to-zoom
1075          >
1076          </nightingale-colored-sequence>
1077        `;case"nightingale-sequence-heatmap":return Xr`
1078          <nightingale-sequence-heatmap
1079            id="track-${i}"
1080            heatmap-id="seq-heatmap"
1081            length="${this.sequence?.length}"
1082            display-start="${this.displayCoordinates?.start}"
1083            display-end="${this.displayCoordinates?.end}"
1084            highlight-event="onclick"
1085            highlight-color="#EB3BFF66"
1086            height="300"
1087            use-ctrl-to-zoom
1088          >
1089          </nightingale-sequence-heatmap>
1090        `;default:console.warn("No Matching ProtvistaTrack Found.")}}},Gwt=zwt=abe([vn("protvista-uniprot")],zwt)}}]);
1091//# sourceMappingURL=legacy.nightingale.3db5cf.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.