drugflow-molstar 0.3.75 → 0.3.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ /*! For license information please see drugflow-molstar-component-build-0.3.76.js.LICENSE.txt */
2
+ (()=>{"use strict";const t="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,e=(t,e,s=null)=>{for(;e!==s;){const s=e.nextSibling;t.removeChild(e),e=s}},s=`{{lit-${String(Math.random()).slice(2)}}}`,i=`\x3c!--${s}--\x3e`,n=new RegExp(`${s}|${i}`),r="$lit$";class o{constructor(t,e){this.parts=[],this.element=e;const i=[],o=[],l=document.createTreeWalker(e.content,133,null,!1);let c=0,p=-1,u=0;const{strings:_,values:{length:m}}=t;for(;u<m;){const t=l.nextNode();if(null!==t){if(p++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:s}=e;let i=0;for(let t=0;t<s;t++)a(e[t].name,r)&&i++;for(;i-- >0;){const e=_[u],s=d.exec(e)[2],i=s.toLowerCase()+r,o=t.getAttribute(i);t.removeAttribute(i);const a=o.split(n);this.parts.push({type:"attribute",index:p,name:s,strings:a}),u+=a.length-1}}"TEMPLATE"===t.tagName&&(o.push(t),l.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(s)>=0){const s=t.parentNode,o=e.split(n),l=o.length-1;for(let e=0;e<l;e++){let i,n=o[e];if(""===n)i=h();else{const t=d.exec(n);null!==t&&a(t[2],r)&&(n=n.slice(0,t.index)+t[1]+t[2].slice(0,-r.length)+t[3]),i=document.createTextNode(n)}s.insertBefore(i,t),this.parts.push({type:"node",index:++p})}""===o[l]?(s.insertBefore(h(),t),i.push(t)):t.data=o[l],u+=l}}else if(8===t.nodeType)if(t.data===s){const e=t.parentNode;null!==t.previousSibling&&p!==c||(p++,e.insertBefore(h(),t)),c=p,this.parts.push({type:"node",index:p}),null===t.nextSibling?t.data="":(i.push(t),p--),u++}else{let e=-1;for(;-1!==(e=t.data.indexOf(s,e+1));)this.parts.push({type:"node",index:-1}),u++}}else l.currentNode=o.pop()}for(const t of i)t.parentNode.removeChild(t)}}const a=(t,e)=>{const s=t.length-e.length;return s>=0&&t.slice(s)===e},l=t=>-1!==t.index,h=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function c(t,e){const{element:{content:s},parts:i}=t,n=document.createTreeWalker(s,133,null,!1);let r=u(i),o=i[r],a=-1,l=0;const h=[];let d=null;for(;n.nextNode();){a++;const t=n.currentNode;for(t.previousSibling===d&&(d=null),e.has(t)&&(h.push(t),null===d&&(d=t)),null!==d&&l++;void 0!==o&&o.index===a;)o.index=null!==d?-1:o.index-l,r=u(i,r),o=i[r]}h.forEach((t=>t.parentNode.removeChild(t)))}const p=t=>{let e=11===t.nodeType?0:1;const s=document.createTreeWalker(t,133,null,!1);for(;s.nextNode();)e++;return e},u=(t,e=-1)=>{for(let s=e+1;s<t.length;s++){const e=t[s];if(l(e))return s}return-1},_=new WeakMap,m=t=>"function"==typeof t&&_.has(t),y={},f={};class g{constructor(t,e,s){this.__parts=[],this.template=t,this.processor=e,this.options=s}update(t){let e=0;for(const s of this.__parts)void 0!==s&&s.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const e=t?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),s=[],i=this.template.parts,n=document.createTreeWalker(e,133,null,!1);let r,o=0,a=0,h=n.nextNode();for(;o<i.length;)if(r=i[o],l(r)){for(;a<r.index;)a++,"TEMPLATE"===h.nodeName&&(s.push(h),n.currentNode=h.content),null===(h=n.nextNode())&&(n.currentNode=s.pop(),h=n.nextNode());if("node"===r.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(h.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(h,r.name,r.strings,this.options));o++}else this.__parts.push(void 0),o++;return t&&(document.adoptNode(e),customElements.upgrade(e)),e}}const S=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),v=` ${s} `;const w=t=>null===t||!("object"==typeof t||"function"==typeof t),b=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class x{constructor(t,e,s){this.dirty=!0,this.element=t,this.name=e,this.strings=s,this.parts=[];for(let t=0;t<s.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new P(this)}_getValue(){const t=this.strings,e=t.length-1,s=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=s[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!b(t))return t}let i="";for(let n=0;n<e;n++){i+=t[n];const e=s[n];if(void 0!==e){const t=e.value;if(w(t)||!b(t))i+="string"==typeof t?t:String(t);else for(const e of t)i+="string"==typeof e?e:String(e)}}return i+=t[e],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class P{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===y||w(t)&&t===this.value||(this.value=t,m(t)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const t=this.value;this.value=y,t(this)}this.value!==y&&this.committer.commit()}}class N{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(h()),this.endNode=t.appendChild(h())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=h()),t.__insert(this.endNode=h())}insertAfterPart(t){t.__insert(this.startNode=h()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=y,t(this)}const t=this.__pendingValue;t!==y&&(w(t)?t!==this.value&&this.__commitText(t):t instanceof class{constructor(t,e,s,i){this.strings=t,this.values=e,this.type=s,this.processor=i}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let o=0;o<t;o++){const t=this.strings[o],a=t.lastIndexOf("\x3c!--");n=(a>-1||n)&&-1===t.indexOf("--\x3e",a+1);const l=d.exec(t);e+=null===l?t+(n?v:i):t.substr(0,l.index)+l[1]+l[2]+r+l[3]+s}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==S&&(e=S.createHTML(e)),t.innerHTML=e,t}}?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):b(t)?this.__commitIterable(t):t===f?(this.value=f,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,s="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=s:this.__commitNode(document.createTextNode(s)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof g&&this.value.template===e)this.value.update(t.values);else{const s=new g(e,t.processor,this.options),i=s._clone();s.update(t.values),this.__commitNode(i),this.value=s}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let s,i=0;for(const n of t)s=e[i],void 0===s&&(s=new N(this.options),e.push(s),0===i?s.appendIntoPart(this):s.insertAfterPart(e[i-1])),s.setValue(n),s.commit(),i++;i<e.length&&(e.length=i,this.clear(s&&s.endNode))}clear(t=this.startNode){e(this.startNode.parentNode,t.nextSibling,this.endNode)}}class C{constructor(t,e,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=s}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=y,t(this)}if(this.__pendingValue===y)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=y}}class T extends x{constructor(t,e,s){super(t,e,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new A(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class A extends P{}let E=!1;(()=>{try{const t={get capture(){return E=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class V{constructor(t,e,s){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=s,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=y,t(this)}if(this.__pendingValue===y)return;const t=this.__pendingValue,e=this.value,s=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),i=null!=t&&(null==e||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=U(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=y}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const U=t=>t&&(E?{capture:t.capture,passive:t.passive,once:t.once}:t.capture);function O(t){let e=R.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},R.set(t.type,e));let i=e.stringsArray.get(t.strings);if(void 0!==i)return i;const n=t.strings.join(s);return i=e.keyString.get(n),void 0===i&&(i=new o(t,t.getTemplateElement()),e.keyString.set(n,i)),e.stringsArray.set(t.strings,i),i}const R=new Map,k=new WeakMap;new class{handleAttributeExpressions(t,e,s,i){const n=e[0];return"."===n?new T(t,e.slice(1),s).parts:"@"===n?[new V(t,e.slice(1),i.eventContext)]:"?"===n?[new C(t,e.slice(1),s)]:new x(t,e,s).parts}handleTextExpression(t){return new N(t)}},"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const M=(t,e)=>`${t}--${e}`;let q=!0;void 0===window.ShadyCSS?q=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),q=!1);const I=t=>e=>{const i=M(e.type,t);let n=R.get(i);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},R.set(i,n));let r=n.stringsArray.get(e.strings);if(void 0!==r)return r;const a=e.strings.join(s);if(r=n.keyString.get(a),void 0===r){const s=e.getTemplateElement();q&&window.ShadyCSS.prepareTemplateDom(s,t),r=new o(e,s),n.keyString.set(a,r)}return n.stringsArray.set(e.strings,r),r},j=["html","svg"],L=new Set;window.JSCompiler_renameProperty=(t,e)=>t;const F={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},H=(t,e)=>e!==t&&(e==e||t==t),z={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:H};class B extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach(((e,s)=>{const i=this._attributeNameForProperty(s,e);void 0!==i&&(this._attributeToPropertyMap.set(i,s),t.push(i))})),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach(((t,e)=>this._classProperties.set(e,t)))}}static createProperty(t,e=z){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const s="symbol"==typeof t?Symbol():`__${t}`,i=this.getPropertyDescriptor(t,s,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdateInternal(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||z}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const s of e)this.createProperty(s,t[s])}}static _attributeNameForProperty(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,s=H){return s(t,e)}static _propertyValueFromAttribute(t,e){const s=e.type,i=e.converter||F,n="function"==typeof i?i:i.fromAttribute;return n?n(t,s):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const s=e.type,i=e.converter;return(i&&i.toAttribute||F.toAttribute)(t,s)}initialize(){this._updateState=0,this._updatePromise=new Promise((t=>this._enableUpdatingResolver=t)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((t,e)=>this[e]=t)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,s){e!==s&&this._attributeToProperty(t,s)}_propertyToAttribute(t,e,s=z){const i=this.constructor,n=i._attributeNameForProperty(t,s);if(void 0!==n){const t=i._propertyValueToAttribute(e,s);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(n):this.setAttribute(n,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const s=this.constructor,i=s._attributeToPropertyMap.get(t);if(void 0!==i){const t=s.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=s._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,s){let i=!0;if(void 0!==t){const n=this.constructor;s=s||n.getPropertyOptions(t),n._valueHasChanged(this[t],e,s.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==s.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,s))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(t,e){return this.requestUpdateInternal(t,e),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(t){}const t=this.performUpdate();return null!=t&&await t,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{t=this.shouldUpdate(e),t?this.update(e):this._markUpdated()}catch(e){throw t=!1,this._markUpdated(),e}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((t,e)=>this._propertyToAttribute(e,this[e],t))),this._reflectingProperties=void 0),this._markUpdated()}updated(t){}firstUpdated(t){}}B.finalized=!0;const $=Element.prototype;$.msMatchesSelector||$.webkitMatchesSelector;const W=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,D=Symbol();class J{constructor(t,e){if(e!==D)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(W?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const G={};class K extends B{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,s)=>t.reduceRight(((t,s)=>Array.isArray(s)?e(s,t):(t.add(s),t)),s),s=e(t,new Set),i=[];s.forEach((t=>i.unshift(t))),this._styles=i}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map((t=>{if(t instanceof CSSStyleSheet&&!W){const e=Array.prototype.slice.call(t.cssRules).reduce(((t,e)=>t+e.cssText),"");return new J(String(e),D)}return t}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?W?this.renderRoot.adoptedStyleSheets=t.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map((t=>t.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==G&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)})))}render(){return G}}K.finalized=!0,K.render=(t,s,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const n=i.scopeName,r=k.has(s),o=q&&11===s.nodeType&&!!s.host,a=o&&!L.has(n),l=a?document.createDocumentFragment():s;if(((t,s,i)=>{let n=k.get(s);void 0===n&&(e(s,s.firstChild),k.set(s,n=new N(Object.assign({templateFactory:O},i))),n.appendInto(s)),n.setValue(t),n.commit()})(t,l,Object.assign({templateFactory:I(n)},i)),a){const t=k.get(l);k.delete(l);((t,e,s)=>{L.add(t);const i=s?s.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:r}=n;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,t);const o=document.createElement("style");for(let t=0;t<r;t++){const e=n[t];e.parentNode.removeChild(e),o.textContent+=e.textContent}(t=>{j.forEach((e=>{const s=R.get(M(e,t));void 0!==s&&s.keyString.forEach((t=>{const{element:{content:e}}=t,s=new Set;Array.from(e.querySelectorAll("style")).forEach((t=>{s.add(t)})),c(t,s)}))}))})(t);const a=i.content;s?function(t,e,s=null){const{element:{content:i},parts:n}=t;if(null==s)return void i.appendChild(e);const r=document.createTreeWalker(i,133,null,!1);let o=u(n),a=0,l=-1;for(;r.nextNode();)for(l++,r.currentNode===s&&(a=p(e),s.parentNode.insertBefore(e,s));-1!==o&&n[o].index===l;){if(a>0){for(;-1!==o;)n[o].index+=a,o=u(n,o);return}o=u(n,o)}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,t);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(s){a.insertBefore(o,a.firstChild);const t=new Set;t.add(o),c(s,t)}})(n,l,t.value instanceof g?t.value.template:void 0),e(s,s.firstChild),s.appendChild(l),k.set(s,t)}!r&&o&&window.ShadyCSS.styleElement(s.host)},K.shadowRootOptions={mode:"open"}})();
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at
5
+ * http://polymer.github.io/LICENSE.txt
6
+ * The complete set of authors may be found at
7
+ * http://polymer.github.io/AUTHORS.txt
8
+ * The complete set of contributors may be found at
9
+ * http://polymer.github.io/CONTRIBUTORS.txt
10
+ * Code distributed by Google as part of the polymer project is also
11
+ * subject to an additional IP rights grant found at
12
+ * http://polymer.github.io/PATENTS.txt
13
+ */
14
+
15
+ /**
16
+ @license
17
+ Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
18
+ This code may only be used under the BSD style license found at
19
+ http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
20
+ http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
21
+ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
22
+ part of the polymer project is also subject to an additional IP rights grant
23
+ found at http://polymer.github.io/PATENTS.txt
24
+ */
@@ -0,0 +1,2 @@
1
+ /*! For license information please see drugflow-molstar-component-build-0.3.77.js.LICENSE.txt */
2
+ (()=>{"use strict";const t="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,e=(t,e,s=null)=>{for(;e!==s;){const s=e.nextSibling;t.removeChild(e),e=s}},s=`{{lit-${String(Math.random()).slice(2)}}}`,i=`\x3c!--${s}--\x3e`,n=new RegExp(`${s}|${i}`),r="$lit$";class o{constructor(t,e){this.parts=[],this.element=e;const i=[],o=[],l=document.createTreeWalker(e.content,133,null,!1);let c=0,p=-1,u=0;const{strings:_,values:{length:m}}=t;for(;u<m;){const t=l.nextNode();if(null!==t){if(p++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:s}=e;let i=0;for(let t=0;t<s;t++)a(e[t].name,r)&&i++;for(;i-- >0;){const e=_[u],s=d.exec(e)[2],i=s.toLowerCase()+r,o=t.getAttribute(i);t.removeAttribute(i);const a=o.split(n);this.parts.push({type:"attribute",index:p,name:s,strings:a}),u+=a.length-1}}"TEMPLATE"===t.tagName&&(o.push(t),l.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(s)>=0){const s=t.parentNode,o=e.split(n),l=o.length-1;for(let e=0;e<l;e++){let i,n=o[e];if(""===n)i=h();else{const t=d.exec(n);null!==t&&a(t[2],r)&&(n=n.slice(0,t.index)+t[1]+t[2].slice(0,-r.length)+t[3]),i=document.createTextNode(n)}s.insertBefore(i,t),this.parts.push({type:"node",index:++p})}""===o[l]?(s.insertBefore(h(),t),i.push(t)):t.data=o[l],u+=l}}else if(8===t.nodeType)if(t.data===s){const e=t.parentNode;null!==t.previousSibling&&p!==c||(p++,e.insertBefore(h(),t)),c=p,this.parts.push({type:"node",index:p}),null===t.nextSibling?t.data="":(i.push(t),p--),u++}else{let e=-1;for(;-1!==(e=t.data.indexOf(s,e+1));)this.parts.push({type:"node",index:-1}),u++}}else l.currentNode=o.pop()}for(const t of i)t.parentNode.removeChild(t)}}const a=(t,e)=>{const s=t.length-e.length;return s>=0&&t.slice(s)===e},l=t=>-1!==t.index,h=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function c(t,e){const{element:{content:s},parts:i}=t,n=document.createTreeWalker(s,133,null,!1);let r=u(i),o=i[r],a=-1,l=0;const h=[];let d=null;for(;n.nextNode();){a++;const t=n.currentNode;for(t.previousSibling===d&&(d=null),e.has(t)&&(h.push(t),null===d&&(d=t)),null!==d&&l++;void 0!==o&&o.index===a;)o.index=null!==d?-1:o.index-l,r=u(i,r),o=i[r]}h.forEach((t=>t.parentNode.removeChild(t)))}const p=t=>{let e=11===t.nodeType?0:1;const s=document.createTreeWalker(t,133,null,!1);for(;s.nextNode();)e++;return e},u=(t,e=-1)=>{for(let s=e+1;s<t.length;s++){const e=t[s];if(l(e))return s}return-1},_=new WeakMap,m=t=>"function"==typeof t&&_.has(t),y={},f={};class g{constructor(t,e,s){this.__parts=[],this.template=t,this.processor=e,this.options=s}update(t){let e=0;for(const s of this.__parts)void 0!==s&&s.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const e=t?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),s=[],i=this.template.parts,n=document.createTreeWalker(e,133,null,!1);let r,o=0,a=0,h=n.nextNode();for(;o<i.length;)if(r=i[o],l(r)){for(;a<r.index;)a++,"TEMPLATE"===h.nodeName&&(s.push(h),n.currentNode=h.content),null===(h=n.nextNode())&&(n.currentNode=s.pop(),h=n.nextNode());if("node"===r.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(h.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(h,r.name,r.strings,this.options));o++}else this.__parts.push(void 0),o++;return t&&(document.adoptNode(e),customElements.upgrade(e)),e}}const S=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),v=` ${s} `;const w=t=>null===t||!("object"==typeof t||"function"==typeof t),b=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class x{constructor(t,e,s){this.dirty=!0,this.element=t,this.name=e,this.strings=s,this.parts=[];for(let t=0;t<s.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new P(this)}_getValue(){const t=this.strings,e=t.length-1,s=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=s[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!b(t))return t}let i="";for(let n=0;n<e;n++){i+=t[n];const e=s[n];if(void 0!==e){const t=e.value;if(w(t)||!b(t))i+="string"==typeof t?t:String(t);else for(const e of t)i+="string"==typeof e?e:String(e)}}return i+=t[e],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class P{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===y||w(t)&&t===this.value||(this.value=t,m(t)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const t=this.value;this.value=y,t(this)}this.value!==y&&this.committer.commit()}}class N{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(h()),this.endNode=t.appendChild(h())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=h()),t.__insert(this.endNode=h())}insertAfterPart(t){t.__insert(this.startNode=h()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=y,t(this)}const t=this.__pendingValue;t!==y&&(w(t)?t!==this.value&&this.__commitText(t):t instanceof class{constructor(t,e,s,i){this.strings=t,this.values=e,this.type=s,this.processor=i}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let o=0;o<t;o++){const t=this.strings[o],a=t.lastIndexOf("\x3c!--");n=(a>-1||n)&&-1===t.indexOf("--\x3e",a+1);const l=d.exec(t);e+=null===l?t+(n?v:i):t.substr(0,l.index)+l[1]+l[2]+r+l[3]+s}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==S&&(e=S.createHTML(e)),t.innerHTML=e,t}}?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):b(t)?this.__commitIterable(t):t===f?(this.value=f,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,s="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=s:this.__commitNode(document.createTextNode(s)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof g&&this.value.template===e)this.value.update(t.values);else{const s=new g(e,t.processor,this.options),i=s._clone();s.update(t.values),this.__commitNode(i),this.value=s}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let s,i=0;for(const n of t)s=e[i],void 0===s&&(s=new N(this.options),e.push(s),0===i?s.appendIntoPart(this):s.insertAfterPart(e[i-1])),s.setValue(n),s.commit(),i++;i<e.length&&(e.length=i,this.clear(s&&s.endNode))}clear(t=this.startNode){e(this.startNode.parentNode,t.nextSibling,this.endNode)}}class C{constructor(t,e,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=s}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=y,t(this)}if(this.__pendingValue===y)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=y}}class T extends x{constructor(t,e,s){super(t,e,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new A(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class A extends P{}let E=!1;(()=>{try{const t={get capture(){return E=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class V{constructor(t,e,s){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=s,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=y,t(this)}if(this.__pendingValue===y)return;const t=this.__pendingValue,e=this.value,s=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),i=null!=t&&(null==e||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=U(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=y}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const U=t=>t&&(E?{capture:t.capture,passive:t.passive,once:t.once}:t.capture);function O(t){let e=R.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},R.set(t.type,e));let i=e.stringsArray.get(t.strings);if(void 0!==i)return i;const n=t.strings.join(s);return i=e.keyString.get(n),void 0===i&&(i=new o(t,t.getTemplateElement()),e.keyString.set(n,i)),e.stringsArray.set(t.strings,i),i}const R=new Map,k=new WeakMap;new class{handleAttributeExpressions(t,e,s,i){const n=e[0];return"."===n?new T(t,e.slice(1),s).parts:"@"===n?[new V(t,e.slice(1),i.eventContext)]:"?"===n?[new C(t,e.slice(1),s)]:new x(t,e,s).parts}handleTextExpression(t){return new N(t)}},"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const M=(t,e)=>`${t}--${e}`;let q=!0;void 0===window.ShadyCSS?q=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),q=!1);const I=t=>e=>{const i=M(e.type,t);let n=R.get(i);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},R.set(i,n));let r=n.stringsArray.get(e.strings);if(void 0!==r)return r;const a=e.strings.join(s);if(r=n.keyString.get(a),void 0===r){const s=e.getTemplateElement();q&&window.ShadyCSS.prepareTemplateDom(s,t),r=new o(e,s),n.keyString.set(a,r)}return n.stringsArray.set(e.strings,r),r},j=["html","svg"],L=new Set;window.JSCompiler_renameProperty=(t,e)=>t;const F={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},H=(t,e)=>e!==t&&(e==e||t==t),z={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:H};class B extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach(((e,s)=>{const i=this._attributeNameForProperty(s,e);void 0!==i&&(this._attributeToPropertyMap.set(i,s),t.push(i))})),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach(((t,e)=>this._classProperties.set(e,t)))}}static createProperty(t,e=z){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const s="symbol"==typeof t?Symbol():`__${t}`,i=this.getPropertyDescriptor(t,s,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdateInternal(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||z}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const s of e)this.createProperty(s,t[s])}}static _attributeNameForProperty(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,s=H){return s(t,e)}static _propertyValueFromAttribute(t,e){const s=e.type,i=e.converter||F,n="function"==typeof i?i:i.fromAttribute;return n?n(t,s):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const s=e.type,i=e.converter;return(i&&i.toAttribute||F.toAttribute)(t,s)}initialize(){this._updateState=0,this._updatePromise=new Promise((t=>this._enableUpdatingResolver=t)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((t,e)=>this[e]=t)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,s){e!==s&&this._attributeToProperty(t,s)}_propertyToAttribute(t,e,s=z){const i=this.constructor,n=i._attributeNameForProperty(t,s);if(void 0!==n){const t=i._propertyValueToAttribute(e,s);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(n):this.setAttribute(n,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const s=this.constructor,i=s._attributeToPropertyMap.get(t);if(void 0!==i){const t=s.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=s._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,s){let i=!0;if(void 0!==t){const n=this.constructor;s=s||n.getPropertyOptions(t),n._valueHasChanged(this[t],e,s.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==s.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,s))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(t,e){return this.requestUpdateInternal(t,e),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(t){}const t=this.performUpdate();return null!=t&&await t,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{t=this.shouldUpdate(e),t?this.update(e):this._markUpdated()}catch(e){throw t=!1,this._markUpdated(),e}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((t,e)=>this._propertyToAttribute(e,this[e],t))),this._reflectingProperties=void 0),this._markUpdated()}updated(t){}firstUpdated(t){}}B.finalized=!0;const $=Element.prototype;$.msMatchesSelector||$.webkitMatchesSelector;const W=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,D=Symbol();class J{constructor(t,e){if(e!==D)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(W?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const G={};class K extends B{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,s)=>t.reduceRight(((t,s)=>Array.isArray(s)?e(s,t):(t.add(s),t)),s),s=e(t,new Set),i=[];s.forEach((t=>i.unshift(t))),this._styles=i}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map((t=>{if(t instanceof CSSStyleSheet&&!W){const e=Array.prototype.slice.call(t.cssRules).reduce(((t,e)=>t+e.cssText),"");return new J(String(e),D)}return t}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?W?this.renderRoot.adoptedStyleSheets=t.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map((t=>t.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==G&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)})))}render(){return G}}K.finalized=!0,K.render=(t,s,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const n=i.scopeName,r=k.has(s),o=q&&11===s.nodeType&&!!s.host,a=o&&!L.has(n),l=a?document.createDocumentFragment():s;if(((t,s,i)=>{let n=k.get(s);void 0===n&&(e(s,s.firstChild),k.set(s,n=new N(Object.assign({templateFactory:O},i))),n.appendInto(s)),n.setValue(t),n.commit()})(t,l,Object.assign({templateFactory:I(n)},i)),a){const t=k.get(l);k.delete(l);((t,e,s)=>{L.add(t);const i=s?s.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:r}=n;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,t);const o=document.createElement("style");for(let t=0;t<r;t++){const e=n[t];e.parentNode.removeChild(e),o.textContent+=e.textContent}(t=>{j.forEach((e=>{const s=R.get(M(e,t));void 0!==s&&s.keyString.forEach((t=>{const{element:{content:e}}=t,s=new Set;Array.from(e.querySelectorAll("style")).forEach((t=>{s.add(t)})),c(t,s)}))}))})(t);const a=i.content;s?function(t,e,s=null){const{element:{content:i},parts:n}=t;if(null==s)return void i.appendChild(e);const r=document.createTreeWalker(i,133,null,!1);let o=u(n),a=0,l=-1;for(;r.nextNode();)for(l++,r.currentNode===s&&(a=p(e),s.parentNode.insertBefore(e,s));-1!==o&&n[o].index===l;){if(a>0){for(;-1!==o;)n[o].index+=a,o=u(n,o);return}o=u(n,o)}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,t);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(s){a.insertBefore(o,a.firstChild);const t=new Set;t.add(o),c(s,t)}})(n,l,t.value instanceof g?t.value.template:void 0),e(s,s.firstChild),s.appendChild(l),k.set(s,t)}!r&&o&&window.ShadyCSS.styleElement(s.host)},K.shadowRootOptions={mode:"open"}})();
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at
5
+ * http://polymer.github.io/LICENSE.txt
6
+ * The complete set of authors may be found at
7
+ * http://polymer.github.io/AUTHORS.txt
8
+ * The complete set of contributors may be found at
9
+ * http://polymer.github.io/CONTRIBUTORS.txt
10
+ * Code distributed by Google as part of the polymer project is also
11
+ * subject to an additional IP rights grant found at
12
+ * http://polymer.github.io/PATENTS.txt
13
+ */
14
+
15
+ /**
16
+ @license
17
+ Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
18
+ This code may only be used under the BSD style license found at
19
+ http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
20
+ http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
21
+ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
22
+ part of the polymer project is also subject to an additional IP rights grant
23
+ found at http://polymer.github.io/PATENTS.txt
24
+ */
package/lib/index.js CHANGED
@@ -1330,10 +1330,15 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
1330
1330
  radius: radius,
1331
1331
  'as-whole-residues': true
1332
1332
  }),
1333
- by: ligandQuery.expression
1333
+ by: builder_1.MolScriptBuilder.struct.generator.atomGroups({
1334
+ 'residue-test': builder_1.MolScriptBuilder.core.rel.eq([
1335
+ builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_comp_id(),
1336
+ 'HOH'
1337
+ ])
1338
+ })
1334
1339
  })
1335
1340
  ]), {
1336
- description: "Surroundings within ".concat(radius, "\u00C5"),
1341
+ description: "Surroundings within ".concat(radius, "\u00C5 (excluding water)"),
1337
1342
  category: structure_selection_query_1.StructureSelectionCategory.Manipulate,
1338
1343
  referencesCurrent: true
1339
1344
  });
@@ -2532,12 +2537,13 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2532
2537
  * ```
2533
2538
  */
2534
2539
  DrugflowMolstarPlugin.prototype.add_interactions_repr = function (options) {
2540
+ var _b;
2535
2541
  return tslib_1.__awaiter(this, void 0, void 0, function () {
2536
- var componentRef, reprRef, _b, structureId, interactionTypes, _c, interChainOnly, _d, visible, _e, params, finalReprRef, structure, reprParams, tree;
2537
- return tslib_1.__generator(this, function (_f) {
2538
- switch (_f.label) {
2542
+ var componentRef, reprRef, _c, structureId, interactionTypes, _d, interChainOnly, _e, visible, _f, params, finalReprRef, structure, reprParams, tree;
2543
+ return tslib_1.__generator(this, function (_g) {
2544
+ switch (_g.label) {
2539
2545
  case 0:
2540
- componentRef = options.componentRef, reprRef = options.reprRef, _b = options.structureId, structureId = _b === void 0 ? '0' : _b, interactionTypes = options.interactionTypes, _c = options.interChainOnly, interChainOnly = _c === void 0 ? false : _c, _d = options.visible, visible = _d === void 0 ? true : _d, _e = options.params, params = _e === void 0 ? {} : _e;
2546
+ componentRef = options.componentRef, reprRef = options.reprRef, _c = options.structureId, structureId = _c === void 0 ? '0' : _c, interactionTypes = options.interactionTypes, _d = options.interChainOnly, interChainOnly = _d === void 0 ? false : _d, _e = options.visible, visible = _e === void 0 ? true : _e, _f = options.params, params = _f === void 0 ? {} : _f;
2541
2547
  finalReprRef = reprRef || "".concat(componentRef, "_interactions_").concat(Date.now());
2542
2548
  structure = this.getObj('Structure_' + structureId);
2543
2549
  if (!structure) {
@@ -2556,6 +2562,11 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2556
2562
  // 只显示 inter-unit(跨单元/跨链)相互作用,不显示 intra-unit(单元内/链内)相互作用
2557
2563
  reprParams.typeParams.visuals = ['inter-unit'];
2558
2564
  }
2565
+ // includeParent 参数:false = 只计算组件内的相互作用,true = 包含父结构
2566
+ // 默认为 false,这样只显示组件范围内的相互作用
2567
+ if (reprParams.typeParams) {
2568
+ reprParams.typeParams.includeParent = (_b = reprParams.typeParams.includeParent) !== null && _b !== void 0 ? _b : false;
2569
+ }
2559
2570
  tree = this.visual_tree(structure, componentRef, finalReprRef, reprParams);
2560
2571
  if (!tree) {
2561
2572
  console.error('Failed to build visual tree for interactions');
@@ -2566,7 +2577,7 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2566
2577
  tree: tree
2567
2578
  })];
2568
2579
  case 1:
2569
- _f.sent();
2580
+ _g.sent();
2570
2581
  // 控制可见性
2571
2582
  if (!visible) {
2572
2583
  this.set_visibility(finalReprRef);
@@ -2765,49 +2776,59 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2765
2776
  *
2766
2777
  * @param componentRef - 组件引用(如 'Ligand_plus_0')
2767
2778
  * @param structureId - 结构ID(可选,默认'0')
2779
+ * @param filterResId - 可选的残基ID,如果提供则只返回与该残基相关的相互作用
2768
2780
  * @returns Interaction 数据数组
2769
2781
  *
2770
2782
  * @example
2771
2783
  * ```javascript
2772
- * // 导出配体周围的相互作用数据
2784
+ * // 导出配体周围的所有相互作用数据
2773
2785
  * const interactions = await viewer.exportInteractionsData('Ligand_plus_0');
2774
- * console.log(interactions);
2786
+ *
2787
+ * // 只导出与残基 1102 相关的相互作用
2788
+ * const ligandInteractions = await viewer.exportInteractionsData('Ligand_plus_0', '0', 1102);
2789
+ * console.log(ligandInteractions);
2775
2790
  * // [
2776
2791
  * // {
2777
2792
  * // type: 'hydrogen-bond',
2778
- * // atomA: { chainId: 'A', resId: 123, resName: 'ASP', atomName: 'OD1' },
2779
- * // atomB: { chainId: 'B', resId: 456, resName: 'LIG', atomName: 'O1' },
2780
- * // distance: 2.8
2793
+ * // atomA: { chainId: 'A', resId: 1102, resName: 'KY9', atomName: 'O38', atomId: 38 },
2794
+ * // atomB: { chainId: 'A', resId: 745, resName: 'LYS', atomName: 'NZ', atomId: null },
2795
+ * // distance: 2.87
2781
2796
  * // },
2782
2797
  * // ...
2783
2798
  * // ]
2784
2799
  * ```
2785
2800
  */
2786
- DrugflowMolstarPlugin.prototype.exportInteractionsData = function (componentRef, structureId) {
2801
+ DrugflowMolstarPlugin.prototype.exportInteractionsData = function (componentRef, structureId, filterResId) {
2787
2802
  if (structureId === void 0) { structureId = '0'; }
2788
2803
  return tslib_1.__awaiter(this, void 0, void 0, function () {
2789
- var InteractionsProvider, interactionTypeLabel, Vec3, componentCell, componentStructure_1, interactionsProperty_1, interactions, exportedData, contacts, unitsFeatures, i, edge, unitA, unitB, featuresA, featuresB, atomInfoA, atomInfoB, posA, posB, distance, error_7;
2804
+ var InteractionsProvider, interactionTypeLabel, Vec3, fullComponentRef, componentCell, fallbackCell, actualCell, componentStructure_1, interactionsProperty_1, interactions, exportedData, addedInteractions, contacts, unitsFeatures, i, edge, unitA, unitB, featuresA, featuresB, atomInfoA, atomInfoB, interactionType, atom1Key, atom2Key, _b, key1, key2, uniqueKey, posA, posB, distance, filterMsg, error_7;
2790
2805
  var _this = this;
2791
- return tslib_1.__generator(this, function (_b) {
2792
- switch (_b.label) {
2806
+ return tslib_1.__generator(this, function (_c) {
2807
+ switch (_c.label) {
2793
2808
  case 0: return [4 /*yield*/, Promise.resolve().then(function () { return tslib_1.__importStar(require('molstar/lib/mol-model-props/computed/interactions')); })];
2794
2809
  case 1:
2795
- InteractionsProvider = (_b.sent()).InteractionsProvider;
2810
+ InteractionsProvider = (_c.sent()).InteractionsProvider;
2796
2811
  return [4 /*yield*/, Promise.resolve().then(function () { return tslib_1.__importStar(require('molstar/lib/mol-model-props/computed/interactions/common')); })];
2797
2812
  case 2:
2798
- interactionTypeLabel = (_b.sent()).interactionTypeLabel;
2813
+ interactionTypeLabel = (_c.sent()).interactionTypeLabel;
2799
2814
  return [4 /*yield*/, Promise.resolve().then(function () { return tslib_1.__importStar(require('molstar/lib/mol-math/linear-algebra')); })];
2800
2815
  case 3:
2801
- Vec3 = (_b.sent()).Vec3;
2802
- _b.label = 4;
2816
+ Vec3 = (_c.sent()).Vec3;
2817
+ _c.label = 4;
2803
2818
  case 4:
2804
- _b.trys.push([4, 7, , 8]);
2805
- componentCell = this.plugin.state.data.select(componentRef)[0];
2819
+ _c.trys.push([4, 7, , 8]);
2820
+ fullComponentRef = componentRef.includes('_') ? componentRef : "".concat(componentRef, "_").concat(structureId);
2821
+ componentCell = this.plugin.state.data.select(fullComponentRef)[0];
2806
2822
  if (!componentCell) {
2807
- console.log("Component ".concat(componentRef, " not found"));
2808
- return [2 /*return*/, []];
2823
+ console.log("Component ".concat(fullComponentRef, " not found, trying original ref ").concat(componentRef));
2824
+ fallbackCell = this.plugin.state.data.select(componentRef)[0];
2825
+ if (!fallbackCell) {
2826
+ console.log("Component ".concat(componentRef, " not found either"));
2827
+ return [2 /*return*/, []];
2828
+ }
2809
2829
  }
2810
- componentStructure_1 = componentCell.obj.data;
2830
+ actualCell = this.plugin.state.data.select(fullComponentRef)[0] || this.plugin.state.data.select(componentRef)[0];
2831
+ componentStructure_1 = actualCell.obj.data;
2811
2832
  if (!componentStructure_1) {
2812
2833
  console.log("Structure data not found for ".concat(componentRef));
2813
2834
  return [2 /*return*/, []];
@@ -2840,8 +2861,8 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2840
2861
  });
2841
2862
  }); }))];
2842
2863
  case 5:
2843
- _b.sent();
2844
- _b.label = 6;
2864
+ _c.sent();
2865
+ _c.label = 6;
2845
2866
  case 6:
2846
2867
  if (!interactionsProperty_1 || !interactionsProperty_1.value) {
2847
2868
  console.log('No interactions data found after computation. Make sure you have added interactions representation first.');
@@ -2849,6 +2870,7 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2849
2870
  }
2850
2871
  interactions = interactionsProperty_1.value;
2851
2872
  exportedData = [];
2873
+ addedInteractions = new Set();
2852
2874
  contacts = interactions.contacts;
2853
2875
  unitsFeatures = interactions.unitsFeatures;
2854
2876
  for (i = 0; i < contacts.edgeCount; i++) {
@@ -2863,11 +2885,27 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2863
2885
  continue;
2864
2886
  atomInfoA = this.getAtomInfoFromFeature(componentStructure_1, unitA, featuresA, edge.indexA);
2865
2887
  atomInfoB = this.getAtomInfoFromFeature(componentStructure_1, unitB, featuresB, edge.indexB);
2888
+ // 如果提供了 filterResId,则只保留与该残基相关的相互作用
2889
+ if (filterResId !== undefined) {
2890
+ if (atomInfoA.resId !== filterResId && atomInfoB.resId !== filterResId) {
2891
+ continue; // 两端都不是目标残基,跳过
2892
+ }
2893
+ }
2894
+ interactionType = interactionTypeLabel(edge.props.type);
2895
+ atom1Key = "".concat(atomInfoA.chainId, ":").concat(atomInfoA.resId, ":").concat(atomInfoA.atomName);
2896
+ atom2Key = "".concat(atomInfoB.chainId, ":").concat(atomInfoB.resId, ":").concat(atomInfoB.atomName);
2897
+ _b = atom1Key < atom2Key ? [atom1Key, atom2Key] : [atom2Key, atom1Key], key1 = _b[0], key2 = _b[1];
2898
+ uniqueKey = "".concat(interactionType, "|").concat(key1, "|").concat(key2);
2899
+ // 跳过重复的相互作用
2900
+ if (addedInteractions.has(uniqueKey)) {
2901
+ continue;
2902
+ }
2903
+ addedInteractions.add(uniqueKey);
2866
2904
  posA = Vec3.create(featuresA.x[edge.indexA], featuresA.y[edge.indexA], featuresA.z[edge.indexA]);
2867
2905
  posB = Vec3.create(featuresB.x[edge.indexB], featuresB.y[edge.indexB], featuresB.z[edge.indexB]);
2868
2906
  distance = Vec3.distance(posA, posB);
2869
2907
  exportedData.push({
2870
- type: interactionTypeLabel(edge.props.type),
2908
+ type: interactionType,
2871
2909
  atomA: atomInfoA,
2872
2910
  atomB: atomInfoB,
2873
2911
  distance: Math.round(distance * 100) / 100,
@@ -2881,10 +2919,11 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2881
2919
  }
2882
2920
  });
2883
2921
  }
2884
- console.log("\u2705 Exported ".concat(exportedData.length, " interactions from ").concat(componentRef));
2922
+ filterMsg = filterResId !== undefined ? " (filtered by resId=".concat(filterResId, ")") : '';
2923
+ console.log("\u2705 Exported ".concat(exportedData.length, " unique interactions from ").concat(fullComponentRef).concat(filterMsg));
2885
2924
  return [2 /*return*/, exportedData];
2886
2925
  case 7:
2887
- error_7 = _b.sent();
2926
+ error_7 = _c.sent();
2888
2927
  console.error('❌ Failed to export interactions data:', error_7);
2889
2928
  throw error_7;
2890
2929
  case 8: return [2 /*return*/];
@@ -2892,6 +2931,22 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2892
2931
  });
2893
2932
  });
2894
2933
  };
2934
+ /**
2935
+ * 从原子名称中提取数字作为 atomId
2936
+ * @param atomName - 原子名称,如 "O38", "NZ", "CA"
2937
+ * @returns 提取的数字,如果没有数字则返回 null
2938
+ * @private
2939
+ */
2940
+ DrugflowMolstarPlugin.prototype.extractAtomIdFromName = function (atomName) {
2941
+ if (!atomName)
2942
+ return null;
2943
+ // 提取原子名称中的所有数字
2944
+ var match = atomName.match(/\d+/);
2945
+ if (match) {
2946
+ return parseInt(match[0], 10);
2947
+ }
2948
+ return null;
2949
+ };
2895
2950
  /**
2896
2951
  * 辅助方法:从 structure、unit、features 和 feature index 获取原子信息
2897
2952
  * @private
@@ -2902,32 +2957,41 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2902
2957
  chainId: 'unknown',
2903
2958
  resId: 0,
2904
2959
  resName: 'UNK',
2905
- atomName: 'unknown'
2960
+ atomName: 'unknown',
2961
+ atomId: null
2906
2962
  };
2907
2963
  }
2908
2964
  try {
2909
- // 根据 Molstar 源码 (features.js):
2965
+ // 根据 Molstar 源码 (features.js 和 interactions-intra-unit-cylinder.js):
2910
2966
  // - offsets[featureIndex] 指向该 feature 的第一个成员在 members 数组中的位置
2911
- // - members[offset] 是原子在 unit.elements 中的索引
2967
+ // - members[offset] 是原子在 unit.elements 中的索引(注意:是索引,不是元素ID)
2968
+ // - 需要通过 unit.elements[index] 来获取实际的元素ID
2912
2969
  var offset = features.offsets[featureIndex];
2913
2970
  if (offset === undefined) {
2914
2971
  console.log('Feature offset undefined for index:', featureIndex);
2915
- return { chainId: 'unknown', resId: 0, resName: 'UNK', atomName: 'unknown' };
2972
+ return { chainId: 'unknown', resId: 0, resName: 'UNK', atomName: 'unknown', atomId: null };
2916
2973
  }
2917
2974
  var elementIndex = features.members[offset];
2918
2975
  if (elementIndex === undefined || elementIndex < 0) {
2919
2976
  console.log('Element index undefined for offset:', offset);
2920
- return { chainId: 'unknown', resId: 0, resName: 'UNK', atomName: 'unknown' };
2977
+ return { chainId: 'unknown', resId: 0, resName: 'UNK', atomName: 'unknown', atomId: null };
2978
+ }
2979
+ // 检查索引是否在有效范围内
2980
+ if (elementIndex >= unit.elements.length) {
2981
+ console.log('Element index out of range:', elementIndex, 'max:', unit.elements.length);
2982
+ return { chainId: 'unknown', resId: 0, resName: 'UNK', atomName: 'unknown', atomId: null };
2921
2983
  }
2922
2984
  // 创建 Location 对象(必须传入 structure)
2923
2985
  var location_2 = structure_2.StructureElement.Location.create(structure, unit);
2924
- location_2.element = elementIndex;
2986
+ // 关键修复:使用 unit.elements[elementIndex] 获取实际的元素ID
2987
+ location_2.element = unit.elements[elementIndex];
2925
2988
  // 使用 StructureProperties 获取信息
2926
2989
  var chainId = structure_1.StructureProperties.chain.auth_asym_id(location_2);
2927
2990
  var resId = structure_1.StructureProperties.residue.auth_seq_id(location_2);
2928
2991
  var resName = structure_1.StructureProperties.atom.label_comp_id(location_2);
2929
2992
  var atomName = structure_1.StructureProperties.atom.auth_atom_id(location_2);
2930
- var atomId = structure_1.StructureProperties.atom.id(location_2);
2993
+ // 从 atomName 中提取数字作为 atomId(如 "O38" -> 38)
2994
+ var atomId = this.extractAtomIdFromName(atomName);
2931
2995
  return {
2932
2996
  chainId: chainId,
2933
2997
  resId: resId,
@@ -2942,7 +3006,8 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
2942
3006
  chainId: 'unknown',
2943
3007
  resId: 0,
2944
3008
  resName: 'UNK',
2945
- atomName: 'unknown'
3009
+ atomName: 'unknown',
3010
+ atomId: null
2946
3011
  };
2947
3012
  }
2948
3013
  };
@@ -3003,8 +3068,8 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
3003
3068
  DrugflowMolstarPlugin.prototype.exportLigandAsMOL = function (ligandComponentRef, structureId) {
3004
3069
  if (structureId === void 0) { structureId = '0'; }
3005
3070
  return tslib_1.__awaiter(this, void 0, void 0, function () {
3006
- var componentCell, structure, molString_1, atomCount, atomLines, bondLines, atomIndexMap, addedBonds, _b, _c, unit, elements, conformation, atoms, i, eI, pos, x, y, z, element, xStr, yStr, zStr, elemStr, atomLine, bondProps, offset, b, edgeProps, unitBondCount, i, eI, molIndexA, bondStart, bondEnd, bondIdx, elementIndexB, atomB, molIndexB, minIdx, maxIdx, bondKey, bondOrder, bondStereo, bondLine;
3007
- return tslib_1.__generator(this, function (_d) {
3071
+ var componentCell, structure, molString_1, atomCount, atomLines, bondLines, atomIndexMap, addedBonds, bondStats, aromaticBondSet, _b, _c, unit, rings, _d, _e, ringIndex, ring, _f, offset, b, ringIdx, indexA, bondStart, bondEnd, bondIdx, indexB, isInRing, k, kl, key, _g, _h, unit, elements, conformation, atoms, i, eI, pos, x, y, z, element, xStr, yStr, zStr, elemStr, atomLine, bondProps, offset, b, edgeProps, i, eI, molIndexA, bondStart, bondEnd, bondIdx, elementIndexB, atomB, molIndexB, minIdx, maxIdx, bondKey, bondOrder, bondType, bondFlags, isAromatic, atomIndexKey, wasInSet, bondStereo, bondLine;
3072
+ return tslib_1.__generator(this, function (_k) {
3008
3073
  try {
3009
3074
  componentCell = this.plugin.state.data.select(ligandComponentRef)[0];
3010
3075
  if (!componentCell) {
@@ -3024,15 +3089,55 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
3024
3089
  bondLines = [];
3025
3090
  atomIndexMap = new Map();
3026
3091
  addedBonds = new Set();
3027
- console.log("\uD83D\uDD0D Structure has ".concat(structure.units.length, " units"));
3028
- // 遍历结构获取原子信息
3092
+ bondStats = {
3093
+ single: 0,
3094
+ double: 0,
3095
+ triple: 0,
3096
+ aromatic: 0,
3097
+ other: 0
3098
+ };
3099
+ aromaticBondSet = new Set();
3029
3100
  for (_b = 0, _c = structure.units; _b < _c.length; _b++) {
3030
3101
  unit = _c[_b];
3102
+ if (unit.kind !== 0)
3103
+ continue;
3104
+ rings = unit.rings;
3105
+ if (rings && rings.aromaticRings && rings.aromaticRings.length > 0) {
3106
+ // 遍历每个芳香环
3107
+ for (_d = 0, _e = rings.aromaticRings; _d < _e.length; _d++) {
3108
+ ringIndex = _e[_d];
3109
+ ring = rings.all[ringIndex];
3110
+ _f = unit.bonds, offset = _f.offset, b = _f.b;
3111
+ // 对环内每个原子,检查它的键是否连接到环内其他原子
3112
+ for (ringIdx = 0; ringIdx < ring.length; ringIdx++) {
3113
+ indexA = ring[ringIdx];
3114
+ bondStart = offset[indexA];
3115
+ bondEnd = offset[indexA + 1];
3116
+ for (bondIdx = bondStart; bondIdx < bondEnd; bondIdx++) {
3117
+ indexB = b[bondIdx];
3118
+ isInRing = false;
3119
+ for (k = 0, kl = ring.length; k < kl; k++) {
3120
+ if (ring[k] === indexB) {
3121
+ isInRing = true;
3122
+ break;
3123
+ }
3124
+ }
3125
+ if (isInRing) {
3126
+ key = indexA < indexB ? "".concat(indexA, "-").concat(indexB) : "".concat(indexB, "-").concat(indexA);
3127
+ aromaticBondSet.add(key);
3128
+ }
3129
+ }
3130
+ }
3131
+ }
3132
+ }
3133
+ }
3134
+ // 遍历结构获取原子信息
3135
+ for (_g = 0, _h = structure.units; _g < _h.length; _g++) {
3136
+ unit = _h[_g];
3031
3137
  if (unit.kind !== 0)
3032
3138
  continue; // 只处理原子单元
3033
3139
  elements = unit.elements, conformation = unit.conformation;
3034
3140
  atoms = unit.model.atomicHierarchy.atoms;
3035
- console.log(" \uD83D\uDCE6 Unit has ".concat(elements.length, " atoms"));
3036
3141
  // 收集原子
3037
3142
  for (i = 0; i < elements.length; i++) {
3038
3143
  eI = elements[i];
@@ -3055,7 +3160,6 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
3055
3160
  if (unit.bonds) {
3056
3161
  bondProps = unit.bonds;
3057
3162
  offset = bondProps.offset, b = bondProps.b, edgeProps = bondProps.edgeProps;
3058
- unitBondCount = 0;
3059
3163
  // 遍历所有原子的键
3060
3164
  for (i = 0; i < elements.length; i++) {
3061
3165
  eI = elements[i];
@@ -3080,19 +3184,50 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
3080
3184
  }
3081
3185
  addedBonds.add(bondKey);
3082
3186
  bondOrder = 1;
3083
- if (edgeProps && edgeProps.order) {
3084
- bondOrder = edgeProps.order[bondIdx] || 1;
3187
+ bondType = 1;
3188
+ bondFlags = (edgeProps && edgeProps.flags) ? edgeProps.flags[bondIdx] : 0;
3189
+ isAromatic = (bondFlags & 16) !== 0;
3190
+ // 方法2:如果方法1失败,从环分析结果检查
3191
+ // 注意:需要使用索引而不是原子ID
3192
+ if (!isAromatic) {
3193
+ atomIndexKey = i < elementIndexB ? "".concat(i, "-").concat(elementIndexB) : "".concat(elementIndexB, "-").concat(i);
3194
+ wasInSet = aromaticBondSet.has(atomIndexKey);
3195
+ if (wasInSet) {
3196
+ isAromatic = true;
3197
+ // 从集合中移除,用于追踪哪些键被使用了
3198
+ aromaticBondSet.delete(atomIndexKey);
3199
+ }
3200
+ }
3201
+ if (isAromatic) {
3202
+ // 芳香键在MOL格式中用 type=4 表示
3203
+ bondType = 4;
3204
+ bondOrder = 1; // 芳香键的order通常记为1,但type表明它是芳香的
3205
+ bondStats.aromatic++;
3206
+ }
3207
+ else {
3208
+ // 非芳香键:从 edgeProps.order 获取键级
3209
+ if (edgeProps && edgeProps.order) {
3210
+ bondOrder = edgeProps.order[bondIdx] || 1;
3211
+ }
3212
+ bondType = bondOrder; // 单键=1, 双键=2, 三键=3
3213
+ // 更新统计
3214
+ if (bondOrder === 1)
3215
+ bondStats.single++;
3216
+ else if (bondOrder === 2)
3217
+ bondStats.double++;
3218
+ else if (bondOrder === 3)
3219
+ bondStats.triple++;
3220
+ else
3221
+ bondStats.other++;
3085
3222
  }
3086
3223
  bondStereo = 0;
3087
- bondLine = "".concat(minIdx.toString().padStart(3)).concat(maxIdx.toString().padStart(3)).concat(bondOrder.toString().padStart(3)).concat(bondStereo.toString().padStart(3));
3224
+ bondLine = "".concat(minIdx.toString().padStart(3)).concat(maxIdx.toString().padStart(3)).concat(bondType.toString().padStart(3)).concat(bondStereo.toString().padStart(3));
3088
3225
  bondLines.push(bondLine);
3089
- unitBondCount++;
3090
3226
  }
3091
3227
  }
3092
- console.log(" \uD83D\uDD17 Unit exported ".concat(unitBondCount, " bonds"));
3093
3228
  }
3094
3229
  else {
3095
- console.log(" \u26A0\uFE0F Unit has no bond information");
3230
+ console.warn('⚠️ Unit has no bond information');
3096
3231
  }
3097
3232
  }
3098
3233
  // Counts line: atoms(3) bonds(3) ... V2000
@@ -3105,9 +3240,12 @@ var DrugflowMolstarPlugin = /** @class */ (function () {
3105
3240
  bondLines.forEach(function (line) {
3106
3241
  molString_1 += line + '\n';
3107
3242
  });
3243
+ // 检查是否有芳香键被标记但未导出(可能的问题)
3244
+ if (aromaticBondSet.size > 0) {
3245
+ console.warn("\u26A0\uFE0F ".concat(aromaticBondSet.size, " aromatic bonds detected in rings but not exported (this may be expected for some ring topologies)"));
3246
+ }
3108
3247
  molString_1 += 'M END\n';
3109
3248
  molString_1 += '$$$$\n';
3110
- console.log("\u2705 Exported ligand as MOL: ".concat(atomCount, " atoms, ").concat(bondLines.length, " bonds"));
3111
3249
  return [2 /*return*/, molString_1];
3112
3250
  }
3113
3251
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drugflow-molstar",
3
- "version": "0.3.75",
3
+ "version": "0.3.77",
4
4
  "description": "Molstar implementation for DrugFlow",
5
5
  "main": "index.js",
6
6
  "scripts": {