drugflow-molstar
Version:
Molstar implementation for DrugFlow
2 lines • 4.23 MB
JavaScript
/*! For license information please see drugflow-molstar-plugin-0.3.26.js.LICENSE.txt */
(()=>{var e={4013:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelInfo=t.QueryHelper=t.LigandView=t.AlphafoldView=t.PDBeVolumes=void 0;var n,a,i,o=r(70655),s=r(65356),u=r(91969),c=r(41943),l=r(99603),d=r(55091),f=r(76614),p=r(99603),m=r(59924),h=r(34054),v=r(57228);(i=t.PDBeVolumes||(t.PDBeVolumes={})).mapParams=function(e,t,r){var n=o.__assign({},e);return n.options.behaviorRef="volume-streaming"+Math.floor(Math.random()*Math.floor(100)),n.options.emContourProvider="pdbe",n.options.serverUrl="https://www.ebi.ac.uk/pdbe/volume-server",n.options.channelParams.em={opacity:t&&t.em&&t.em.opacity?t.em.opacity:.49,wireframe:!!(t&&t.em&&t.em.wireframe)&&t.em.wireframe},n.options.channelParams["2fo-fc"]={opacity:t&&t["2fo-fc"]&&t["2fo-fc"].opacity?t["2fo-fc"].opacity:.49,wireframe:!!(t&&t["2fo-fc"]&&t["2fo-fc"].wireframe)&&t["2fo-fc"].wireframe},n.options.channelParams["fo-fc(+ve)"]={opacity:t&&t["fo-fc(+ve)"]&&t["fo-fc(+ve)"].opacity?t["fo-fc(+ve)"].opacity:.3,wireframe:!(t&&t["fo-fc(+ve)"]&&t["fo-fc(+ve)"].wireframe)||t["fo-fc(+ve)"].wireframe},n.options.channelParams["fo-fc(-ve)"]={opacity:t&&t["fo-fc(-ve)"]&&t["fo-fc(-ve)"].opacity?t["fo-fc(-ve)"].opacity:.3,wireframe:!(t&&t["fo-fc(-ve)"]&&t["fo-fc(-ve)"].wireframe)||t["fo-fc(-ve)"].wireframe},n},i.displayUsibilityMessage=function(e){s.PluginCommands.Toast.Show(e,{title:"Volume",message:"Streaming enabled, click on a residue or an atom to view the data.",key:"toast-1",timeoutMs:7e3})},i.toggle=function(e){var t=e.state.data,r=t.select(c.StateSelection.Generators.ofTransformer(d.CreateVolumeStreamingInfo))[0];r&&s.PluginCommands.State.ToggleVisibility(e,{state:t,ref:r.transform.ref})},(t.AlphafoldView||(t.AlphafoldView={})).getLociByPLDDT=function(e,t){var r=u.MolScriptBuilder.struct.modifier.union([u.MolScriptBuilder.struct.modifier.wholeResidues([u.MolScriptBuilder.struct.modifier.union([u.MolScriptBuilder.struct.generator.atomGroups({"chain-test":u.MolScriptBuilder.core.rel.eq([u.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":u.MolScriptBuilder.core.rel.gr([v.QualityAssessment.symbols.pLDDT.symbol(),e])})])])]),n=(0,f.compile)(r)(new l.QueryContext(t));return l.StructureSelection.toLociWithSourceUnits(n)},(a=t.LigandView||(t.LigandView={})).query=function(e){var t,r={"group-by":u.MolScriptBuilder.core.str.concat([u.MolScriptBuilder.struct.atomProperty.core.operatorName(),u.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])};e.auth_seq_id?t=u.MolScriptBuilder.core.rel.eq([u.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.auth_seq_id]):e.label_comp_id&&(t=u.MolScriptBuilder.core.rel.eq([u.MolScriptBuilder.struct.atomProperty.macromolecular.label_comp_id(),e.label_comp_id])),t&&(r["residue-test"]=t),e.auth_asym_id?r["chain-test"]=u.MolScriptBuilder.core.rel.eq([u.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),e.auth_asym_id]):e.struct_asym_id&&(r["chain-test"]=u.MolScriptBuilder.core.rel.eq([u.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(),e.struct_asym_id]));var n=e.show_all?u.MolScriptBuilder.struct.generator.atomGroups(r):u.MolScriptBuilder.struct.filter.first([u.MolScriptBuilder.struct.generator.atomGroups(r)]);return{core:n,surroundings:u.MolScriptBuilder.struct.modifier.includeSurroundings({0:n,radius:5,"as-whole-residues":!0})}},a.branchedQuery=function(e){var t=[];e.atom_site.forEach((function(e){var r={"group-by":u.MolScriptBuilder.core.str.concat([u.MolScriptBuilder.struct.atomProperty.core.operatorName(),u.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()]),"residue-test":u.MolScriptBuilder.core.rel.eq([u.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.auth_seq_id])};t.push(r)}));var r=[];t.forEach((function(e){r.push(u.MolScriptBuilder.struct.generator.atomGroups(e))}));var n=u.MolScriptBuilder.struct.modifier.union([1===r.length?r[0]:u.MolScriptBuilder.struct.combinator.merge(r.map((function(e){return u.MolScriptBuilder.struct.modifier.union([e])})))]);return{core:n,surroundings:u.MolScriptBuilder.struct.modifier.includeSurroundings({0:n,radius:5,"as-whole-residues":!0})}},(n=t.QueryHelper||(t.QueryHelper={})).getQueryObject=function(e,t){var r,n,a=[];e.forEach((function(e){var i={};e.entity_id&&(i.entityTest=function(t){return l.StructureProperties.entity.id(t.element)===e.entity_id}),e.struct_asym_id?i.chainTest=function(t){return l.StructureProperties.chain.label_asym_id(t.element)===e.struct_asym_id}:e.auth_asym_id&&(i.chainTest=function(t){return l.StructureProperties.chain.auth_asym_id(t.element)===e.auth_asym_id}),e.label_comp_id?i.residueTest=function(t){return l.StructureProperties.atom.label_comp_id(t.element)===e.label_comp_id}:e.uniprot_accession&&e.uniprot_residue_number?i.residueTest=function(a){r&&n===e.uniprot_accession||(r=m.SIFTSMapping.Provider.get(t.models[0]).value,n=e.uniprot_accession);var i=l.StructureProperties.residue.key(a.element);return e.uniprot_accession===r.accession[i]&&e.uniprot_residue_number===+r.num[i]}:e.uniprot_accession&&e.start_uniprot_residue_number&&e.end_uniprot_residue_number?i.residueTest=function(a){r&&n===e.uniprot_accession||(r=m.SIFTSMapping.Provider.get(t.models[0]).value,n=e.uniprot_accession);var i=l.StructureProperties.residue.key(a.element);return e.uniprot_accession===r.accession[i]&&e.start_uniprot_residue_number<=+r.num[i]&&e.end_uniprot_residue_number>=+r.num[i]}:e.residue_number?i.residueTest=function(t){return l.StructureProperties.residue.label_seq_id(t.element)===e.residue_number}:e.start_residue_number&&e.end_residue_number&&e.end_residue_number>e.start_residue_number?i.residueTest=function(t){var r=l.StructureProperties.residue.label_seq_id(t.element);return r>=e.start_residue_number&&r<=e.end_residue_number}:e.start_residue_number&&e.end_residue_number&&e.end_residue_number===e.start_residue_number?i.residueTest=function(t){return l.StructureProperties.residue.label_seq_id(t.element)===e.start_residue_number}:e.auth_seq_id?i.residueTest=function(t){return l.StructureProperties.residue.auth_seq_id(t.element)===e.auth_seq_id}:e.auth_residue_number&&!e.auth_ins_code_id||e.auth_residue_number&&e.auth_ins_code_id?i.residueTest=function(t){return l.StructureProperties.residue.auth_seq_id(t.element)===e.auth_residue_number}:e.start_auth_residue_number&&e.end_auth_residue_number&&e.end_auth_residue_number>e.start_auth_residue_number?i.residueTest=function(t){var r=l.StructureProperties.residue.auth_seq_id(t.element);return r>=e.start_auth_residue_number&&r<=e.end_auth_residue_number}:e.start_auth_residue_number&&e.end_auth_residue_number&&e.end_auth_residue_number===e.start_auth_residue_number&&(i.residueTest=function(t){return l.StructureProperties.residue.auth_seq_id(t.element)===e.start_auth_residue_number}),e.atoms&&(i.atomTest=function(t){return e.atoms.includes(l.StructureProperties.atom.label_atom_id(t.element))}),e.atom_id&&(i.atomTest=function(t){return e.atom_id.includes(l.StructureProperties.atom.id(t.element))}),a.push(i)}));var i=[];return a.forEach((function(e){i.push(p.Queries.generators.atoms(e))})),p.Queries.combinators.merge(i)},n.getInteractivityLoci=function(e,t){var r=h.StructureQuery.run(n.getQueryObject(e,t),t);return l.StructureSelection.toLociWithSourceUnits(r)},n.getHetLoci=function(e,t){var r=(0,f.compile)(e)(new l.QueryContext(t));return l.StructureSelection.toLociWithSourceUnits(r)},(t.ModelInfo||(t.ModelInfo={})).get=function(e,t){return o.__awaiter(this,void 0,void 0,(function(){var t,r,n,a,i,s,u,c,l,d;return o.__generator(this,(function(o){for(t=e.atomicHierarchy.residues._rowCount,r=e.atomicHierarchy.residueAtomSegments.offsets,n=e.atomicHierarchy.chainAtomSegments.index,a=[],i=0,s=0;s<t;s++)u=n[r[s]],c=e.atomicHierarchy.index.getEntityFromChain(u),"non-polymer"!==(l=e.entities.data.type.value(c))&&"branched"!==l||(d=e.atomicHierarchy.atoms.label_comp_id.value(r[s]),"branched"===l?i++:-1===a.indexOf(d)&&a.push(d));return[2,{hetNames:a,carbEntityCount:i}]}))}))}},59924:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SIFTSMapping=void 0;var n,a=r(70655),i=r(52724),o=r(42711),s=r(42194);!function(e){var t=this;function r(e){if(!i.MmcifFormat.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,a=t.pdbx_sifts_xref_db_num,o=t.pdbx_sifts_xref_db_res;return r.isDefined&&n.isDefined&&a.isDefined&&o.isDefined}function n(e){if(i.MmcifFormat.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,a=t.pdbx_sifts_xref_db_num,o=t.pdbx_sifts_xref_db_res;if(r.isDefined&&n.isDefined&&a.isDefined&&o.isDefined){for(var s=e.atomicHierarchy.atomSourceIndex,u=e.atomicHierarchy.residueAtomSegments,c=u.count,l=u.offsets,d=new Array(c),f=new Array(c),p=new Array(c),m=new Array(c),h=0;h<c;h++){var v=s.value(l[h]);0===r.valueKind(v)?(d[h]=r.value(v),f[h]=n.value(v),p[h]=a.value(v),m[h]=o.value(v)):(d[h]="",f[h]="",p[h]="",m[h]="")}return{dbName:d,accession:f,num:p,residue:m}}}}e.Provider=s.CustomModelProperty.createProvider({label:"SIFTS Mapping",descriptor:(0,o.CustomPropertyDescriptor)({name:"sifts_sequence_mapping"}),type:"static",defaultParams:{},getParams:function(){return{}},isApplicable:function(e){return r(e)},obtain:function(e,r){return a.__awaiter(t,void 0,void 0,(function(){return a.__generator(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 a=r.atomicHierarchy.residueAtomSegments.index[t.element];return n.accession[a]},e.getLabel=function(t){var r=t.unit.model,n=e.Provider.get(r).value;if(n){var a=r.atomicHierarchy.residueAtomSegments.index[t.element],i=n.dbName[a];if(i)return"".concat(i," ").concat(n.accession[a]," ").concat(n.num[a]," ").concat(n.residue[a])}}}(n||(n={})),t.SIFTSMapping=n},35369:(e,t,r)=>{"use strict";r.d(t,{D5:()=>Ct,aV:()=>Xt,hU:()=>Xr,zN:()=>sr});var n=32,a=31,i={};function o(e){e&&(e.value=!0)}function s(){}function u(e){return void 0===e.size&&(e.size=e.__iterate(l)),e.size}function c(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?u(e)+t:t}function l(){return!0}function d(e,t,r){return(0===e&&!h(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function f(e,t){return m(e,t,0)}function p(e,t){return m(e,t,t)}function m(e,t,r){return void 0===e?r:h(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function h(e){return e<0||0===e&&1/e==-1/0}var v="@@__IMMUTABLE_ITERABLE__@@";function g(e){return Boolean(e&&e[v])}var y="@@__IMMUTABLE_KEYED__@@";function b(e){return Boolean(e&&e[y])}var _="@@__IMMUTABLE_INDEXED__@@";function S(e){return Boolean(e&&e[_])}function x(e){return b(e)||S(e)}var C=function(e){return g(e)?e:H(e)},A=function(e){function t(e){return b(e)?e:W(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(C),w=function(e){function t(e){return S(e)?e:X(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(C),P=function(e){function t(e){return g(e)&&!x(e)?e:Q(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(C);C.Keyed=A,C.Indexed=w,C.Set=P;var I="@@__IMMUTABLE_SEQ__@@";function D(e){return Boolean(e&&e[I])}var T="@@__IMMUTABLE_RECORD__@@";function O(e){return Boolean(e&&e[T])}function M(e){return g(e)||O(e)}var E="@@__IMMUTABLE_ORDERED__@@";function B(e){return Boolean(e&&e[E])}var k="function"==typeof Symbol&&Symbol.iterator,R=k||"@@iterator",L=function(e){this.next=e};function V(e,t,r,n){var a=0===e?t:1===e?r:[t,r];return n?n.value=a:n={value:a,done:!1},n}function F(){return{value:void 0,done:!0}}function N(e){return!!Array.isArray(e)||!!G(e)}function U(e){return e&&"function"==typeof e.next}function j(e){var t=G(e);return t&&t.call(e)}function G(e){var t=e&&(k&&e[k]||e["@@iterator"]);if("function"==typeof t)return t}L.prototype.toString=function(){return"[Iterator]"},L.KEYS=0,L.VALUES=1,L.ENTRIES=2,L.prototype.inspect=L.prototype.toSource=function(){return this.toString()},L.prototype[R]=function(){return this};var z=Object.prototype.hasOwnProperty;function q(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 H=function(e){function t(e){return null==e?$():M(e)?e.toSeq():function(e){var t,r,n=re(e);if(n)return(r=G(t=e))&&r===t.entries?n.fromEntrySeq():function(e){var t=G(e);return t&&t===e.keys}(e)?n.toSetSeq():n;if("object"==typeof e)return new K(e);throw new 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,a=0;a!==n;){var i=r[t?n-++a:a++];if(!1===e(i[1],i[0],this))break}return a}return this.__iterateUncached(e,t)},t.prototype.__iterator=function(e,t){var r=this._cache;if(r){var n=r.length,a=0;return new L((function(){if(a===n)return{value:void 0,done:!0};var i=r[t?n-++a:a++];return V(e,i[0],i[1])}))}return this.__iteratorUncached(e,t)},t}(C),W=function(e){function t(e){return null==e?$().toKeyedSeq():g(e)?b(e)?e.toSeq():e.fromEntrySeq():O(e)?e.toSeq():ee(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(H),X=function(e){function t(e){return null==e?$():g(e)?b(e)?e.entrySeq():e.toIndexedSeq():O(e)?e.toSeq().entrySeq():te(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}(H),Q=function(e){function t(e){return(g(e)&&!x(e)?e:X(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}(H);H.isSeq=D,H.Keyed=W,H.Set=Q,H.Indexed=X,H.prototype[I]=!0;var Y=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[c(this,e)]:t},t.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length,a=0;a!==n;){var i=t?n-++a:a++;if(!1===e(r[i],i,this))break}return a},t.prototype.__iterator=function(e,t){var r=this._array,n=r.length,a=0;return new L((function(){if(a===n)return{value:void 0,done:!0};var i=t?n-++a:a++;return V(e,i,r[i])}))},t}(X),K=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 z.call(this._object,e)},t.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,a=n.length,i=0;i!==a;){var o=n[t?a-++i:i++];if(!1===e(r[o],o,this))break}return i},t.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,a=n.length,i=0;return new L((function(){if(i===a)return{value:void 0,done:!0};var o=n[t?a-++i:i++];return V(e,o,r[o])}))},t}(W);K.prototype[E]=!0;var Z,J=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=j(this._collection),n=0;if(U(r))for(var a;!(a=r.next()).done&&!1!==e(a.value,n++,this););return n},t.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=j(this._collection);if(!U(r))return new L(F);var n=0;return new L((function(){var t=r.next();return t.done?t:V(e,n++,t.value)}))},t}(X);function $(){return Z||(Z=new Y([]))}function ee(e){var t=re(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new K(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function te(e){var t=re(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function re(e){return q(e)?new Y(e):N(e)?new J(e):void 0}var ne="@@__IMMUTABLE_MAP__@@";function ae(e){return Boolean(e&&e[ne])}function ie(e){return ae(e)&&B(e)}function oe(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function se(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!!(oe(e)&&oe(t)&&e.equals(t))}var ue="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?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 ce(e){return e>>>1&1073741824|3221225471&e}var le=Object.prototype.valueOf;function de(e){if(null==e)return fe(e);if("function"==typeof e.hashCode)return ce(e.hashCode(e));var t,r,n,a=(t=e).valueOf!==le&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==a)return fe(a);switch(typeof a){case"boolean":return a?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 ce(t)}(a);case"string":return a.length>xe?(void 0===(n=we[r=a])&&(n=pe(r),Ae===Ce&&(Ae=0,we={}),Ae++,we[r]=n),n):pe(a);case"object":case"function":return function(e){var t;if(ye&&void 0!==(t=ge.get(e)))return t;if(void 0!==(t=e[Se]))return t;if(!he){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Se]))return t;if(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=ve(),ye)ge.set(e,t);else{if(void 0!==me&&!1===me(e))throw new Error("Non-extensible objects are not allowed as keys.");if(he)Object.defineProperty(e,Se,{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[Se]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Se]=t}}return t}(a);case"symbol":return function(e){var t=be[e];return void 0!==t||(t=ve(),be[e]=t),t}(a);default:if("function"==typeof a.toString)return pe(a.toString());throw new Error("Value type "+typeof a+" cannot be hashed.")}}function fe(e){return null===e?1108378658:1108378659}function pe(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return ce(t)}var me=Object.isExtensible,he=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}();function ve(){var e=++_e;return 1073741824&_e&&(_e=0),e}var ge,ye="function"==typeof WeakMap;ye&&(ge=new WeakMap);var be=Object.create(null),_e=0,Se="__immutablehash__";"function"==typeof Symbol&&(Se=Symbol(Se));var xe=16,Ce=255,Ae=0,we={},Pe=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=Ee(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=Me(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}(W);Pe.prototype[E]=!0;var Ie=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&&u(this),this._iter.__iterate((function(a){return e(a,t?r.size-++n:n++,r)}),t)},t.prototype.__iterator=function(e,t){var r=this,n=this._iter.__iterator(1,t),a=0;return t&&u(this),new L((function(){var i=n.next();return i.done?i:V(e,t?r.size-++a:a++,i.value,i)}))},t}(X),De=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 L((function(){var t=r.next();return t.done?t:V(e,t.value,t.value,t)}))},t}(Q),Te=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){ze(t);var n=g(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 L((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){ze(n);var a=g(n);return V(e,a?n.get(0):n[0],a?n.get(1):n[1],t)}}}))},t}(W);function Oe(e){var t=He(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=We,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 L((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 Me(e,t,r){var n=He(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,a){var o=e.get(n,i);return o===i?a:t.call(r,o,n,e)},n.__iterateUncached=function(n,a){var i=this;return e.__iterate((function(e,a,o){return!1!==n(t.call(r,e,a,o),a,i)}),a)},n.__iteratorUncached=function(n,a){var i=e.__iterator(2,a);return new L((function(){var a=i.next();if(a.done)return a;var o=a.value,s=o[0];return V(n,s,t.call(r,o[1],s,e),a)}))},n}function Ee(e,t){var r=this,n=He(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Oe(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=We,n.__iterate=function(r,n){var a=this,i=0;return n&&u(e),e.__iterate((function(e,o){return r(e,t?o:n?a.size-++i:i++,a)}),!n)},n.__iterator=function(n,a){var i=0;a&&u(e);var o=e.__iterator(2,!a);return new L((function(){var e=o.next();if(e.done)return e;var s=e.value;return V(n,t?s[0]:a?r.size-++i:i++,s[1],e)}))},n}function Be(e,t,r,n){var a=He(e);return n&&(a.has=function(n){var a=e.get(n,i);return a!==i&&!!t.call(r,a,n,e)},a.get=function(n,a){var o=e.get(n,i);return o!==i&&t.call(r,o,n,e)?o:a}),a.__iterateUncached=function(a,i){var o=this,s=0;return e.__iterate((function(e,i,u){if(t.call(r,e,i,u))return s++,a(e,n?i:s-1,o)}),i),s},a.__iteratorUncached=function(a,i){var o=e.__iterator(2,i),s=0;return new L((function(){for(;;){var i=o.next();if(i.done)return i;var u=i.value,c=u[0],l=u[1];if(t.call(r,l,c,e))return V(a,n?c:s++,l,i)}}))},a}function ke(e,t,r,n){var a=e.size;if(d(t,r,a))return e;var i=f(t,a),o=p(r,a);if(i!=i||o!=o)return ke(e.toSeq().cacheResult(),t,r,n);var s,u=o-i;u==u&&(s=u<0?0:u);var l=He(e);return l.size=0===s?s:e.size&&s||void 0,!n&&D(e)&&s>=0&&(l.get=function(t,r){return(t=c(this,t))>=0&&t<s?e.get(t+i,r):r}),l.__iterateUncached=function(t,r){var a=this;if(0===s)return 0;if(r)return this.cacheResult().__iterate(t,r);var o=0,u=!0,c=0;return e.__iterate((function(e,r){if(!u||!(u=o++<i))return c++,!1!==t(e,n?r:c-1,a)&&c!==s})),c},l.__iteratorUncached=function(t,r){if(0!==s&&r)return this.cacheResult().__iterator(t,r);if(0===s)return new L(F);var a=e.__iterator(t,r),o=0,u=0;return new L((function(){for(;o++<i;)a.next();if(++u>s)return{value:void 0,done:!0};var e=a.next();return n||1===t||e.done?e:V(t,u-1,0===t?void 0:e.value[1],e)}))},l}function Re(e,t,r,n){var a=He(e);return a.__iterateUncached=function(a,i){var o=this;if(i)return this.cacheResult().__iterate(a,i);var s=!0,u=0;return e.__iterate((function(e,i,c){if(!s||!(s=t.call(r,e,i,c)))return u++,a(e,n?i:u-1,o)})),u},a.__iteratorUncached=function(a,i){var o=this;if(i)return this.cacheResult().__iterator(a,i);var s=e.__iterator(2,i),u=!0,c=0;return new L((function(){var e,i,l;do{if((e=s.next()).done)return n||1===a?e:V(a,c++,0===a?void 0:e.value[1],e);var d=e.value;i=d[0],l=d[1],u&&(u=t.call(r,l,i,o))}while(u);return 2===a?e:V(a,i,l,e)}))},a}function Le(e,t){var r=b(e),n=[e].concat(t).map((function(e){return g(e)?r&&(e=A(e)):e=r?ee(e):te(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===n.length)return e;if(1===n.length){var a=n[0];if(a===e||r&&b(a)||S(e)&&S(a))return a}var i=new Y(n);return r?i=i.toKeyedSeq():S(e)||(i=i.toSetSeq()),(i=i.flatten(!0)).size=n.reduce((function(e,t){if(void 0!==e){var r=t.size;if(void 0!==r)return e+r}}),0),i}function Ve(e,t,r){var n=He(e);return n.__iterateUncached=function(a,i){if(i)return this.cacheResult().__iterate(a,i);var o=0,s=!1;return function e(u,c){u.__iterate((function(i,u){return(!t||c<t)&&g(i)?e(i,c+1):(o++,!1===a(i,r?u:o-1,n)&&(s=!0)),!s}),i)}(e,0),o},n.__iteratorUncached=function(n,a){if(a)return this.cacheResult().__iterator(n,a);var i=e.__iterator(n,a),o=[],s=0;return new L((function(){for(;i;){var e=i.next();if(!1===e.done){var u=e.value;if(2===n&&(u=u[1]),t&&!(o.length<t)||!g(u))return r?e:V(n,s++,u,e);o.push(i),i=u.__iterator(n,a)}else i=o.pop()}return{value:void 0,done:!0}}))},n}function Fe(e,t,r){t||(t=Xe);var n=b(e),a=0,i=e.toSeq().map((function(t,n){return[n,t,a++,r?r(t,n,e):t]})).valueSeq().toArray();return i.sort((function(e,r){return t(e[3],r[3])||e[2]-r[2]})).forEach(n?function(e,t){i[t].length=2}:function(e,t){i[t]=e[1]}),n?W(i):S(e)?X(i):Q(i)}function Ne(e,t,r){if(t||(t=Xe),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Ue(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Ue(t,e,r)?r:e}))}function Ue(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function je(e,t,r,n){var a=He(e),i=new Y(r).map((function(e){return e.size}));return a.size=n?i.max():i.min(),a.__iterate=function(e,t){for(var r,n=this.__iterator(1,t),a=0;!(r=n.next()).done&&!1!==e(r.value,a++,this););return a},a.__iteratorUncached=function(e,a){var i=r.map((function(e){return e=C(e),j(a?e.reverse():e)})),o=0,s=!1;return new L((function(){var r;return s||(r=i.map((function(e){return e.next()})),s=n?r.every((function(e){return e.done})):r.some((function(e){return e.done}))),s?{value:void 0,done:!0}:V(e,o++,t.apply(null,r.map((function(e){return e.value}))))}))},a}function Ge(e,t){return e===t?e:D(e)?t:e.constructor(t)}function ze(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function qe(e){return b(e)?A:S(e)?w:P}function He(e){return Object.create((b(e)?W:S(e)?X:Q).prototype)}function We(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):H.prototype.cacheResult.call(this)}function Xe(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 Qe(e,t){t=t||0;for(var r=Math.max(0,e.length-t),n=new Array(r),a=0;a<r;a++)n[a]=e[a+t];return n}function Ye(e,t){if(!e)throw new Error(t)}function Ke(e){Ye(e!==1/0,"Cannot perform this action with an infinite size.")}function Ze(e){if(q(e)&&"string"!=typeof e)return e;if(B(e))return e.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}Ie.prototype.cacheResult=Pe.prototype.cacheResult=De.prototype.cacheResult=Te.prototype.cacheResult=We;var Je=Object.prototype.toString;function $e(e){return"object"==typeof e&&(M(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==Je.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 et(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch(t){return JSON.stringify(e)}}function tt(e,t,r){return M(e)?e.get(t,r):function(e,t){return M(e)?e.has(t):$e(e)&&z.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function rt(e){if(Array.isArray(e))return Qe(e);var t={};for(var r in e)z.call(e,r)&&(t[r]=e[r]);return t}function nt(e,t,r,n){n||(n=r,r=void 0);var a=at(M(e),e,Ze(t),0,r,n);return a===i?r:a}function at(e,t,r,n,a,o){var s=t===i;if(n===r.length){var u=s?a:t,c=o(u);return c===u?t:c}if(!s&&!$e(t))throw new TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(et)+"]: "+t);var l=r[n],d=s?i:tt(t,l,i),f=at(d===i?e:M(d),d,r,n+1,a,o);return f===d?t:f===i?function(e,t){if(!$e(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(M(e)){if(!e.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!z.call(e,t))return e;var r=rt(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,l):function(e,t,r){if(!$e(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(M(e)){if(!e.set)throw new TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(z.call(e,t)&&r===e[t])return e;var n=rt(e);return n[t]=r,n}(s?e?Rt():{}:t,l,f)}function it(e,t){return function(e,t,r){return nt(e,t,i,(function(){return r}))}(this,e,t)}function ot(e){return function(e,t){return nt(e,t,(function(){return i}))}(this,e)}function st(e,t,r,n){return nt(e,[t],r,n)}function ut(e,t,r){return 1===arguments.length?e(this):st(this,e,t,r)}function ct(e,t,r){return nt(this,e,t,r)}function lt(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return ft(this,e)}function dt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return ft(this,t,e)}function ft(e,t,r){for(var n=[],a=0;a<t.length;a++){var o=A(t[a]);0!==o.size&&n.push(o)}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){st(e,n,i,(function(e){return e===i?t:r(e,t,n)}))}:function(t,r){e.set(r,t)},a=0;a<n.length;a++)n[a].forEach(t)})):e.constructor(n[0])}function pt(e,t,r){return mt(e,t,function(e){return function t(r,n,a){return $e(r)&&$e(n)&&(i=n,o=H(r),s=H(i),S(o)===S(s)&&b(o)===b(s))?mt(r,[n],t):e?e(r,n,a):n;var i,o,s}}(r))}function mt(e,t,r){if(!$e(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(M(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),a=e,i=n?w:A,o=n?function(t){a===e&&(a=rt(a)),a.push(t)}:function(t,n){var i=z.call(a,n),o=i&&r?r(a[n],t,n):t;i&&o===a[n]||(a===e&&(a=rt(a)),a[n]=o)},s=0;s<t.length;s++)i(t[s]).forEach(o);return a}function ht(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return pt(this,e)}function vt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return pt(this,t,e)}function gt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return nt(this,e,Rt(),(function(e){return mt(e,t)}))}function yt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return nt(this,e,Rt(),(function(e){return pt(e,t)}))}function bt(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function _t(){return this.__ownerID?this:this.__ensureOwner(new s)}function St(){return this.__ensureOwner()}function xt(){return this.__altered}var Ct=function(e){function t(t){return null==t?Rt():ae(t)&&!B(t)?t:Rt().withMutations((function(r){var n=e(t);Ke(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 Rt().withMutations((function(t){for(var r=0;r<e.length;r+=2){if(r+1>=e.length)throw new 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 Lt(this,e,t)},t.prototype.remove=function(e){return Lt(this,e,i)},t.prototype.deleteAll=function(e){var t=C(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):Rt()},t.prototype.sort=function(e){return sr(Fe(this,e))},t.prototype.sortBy=function(e,t){return sr(Fe(this,t,e))},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){n.forEach((function(a,i){n.set(i,e.call(t,a,i,r))}))}))},t.prototype.__iterator=function(e,t){return new Mt(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?kt(this.size,this._root,e,this.__hash):0===this.size?Rt():(this.__ownerID=e,this.__altered=!1,this)},t}(A);Ct.isMap=ae;var At=Ct.prototype;At[ne]=!0,At.delete=At.remove,At.removeAll=At.deleteAll,At.setIn=it,At.removeIn=At.deleteIn=ot,At.update=ut,At.updateIn=ct,At.merge=At.concat=lt,At.mergeWith=dt,At.mergeDeep=ht,At.mergeDeepWith=vt,At.mergeIn=gt,At.mergeDeepIn=yt,At.withMutations=bt,At.wasAltered=xt,At.asImmutable=St,At["@@transducer/init"]=At.asMutable=_t,At["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},At["@@transducer/result"]=function(e){return e.asImmutable()};var wt=function(e,t){this.ownerID=e,this.entries=t};wt.prototype.get=function(e,t,r,n){for(var a=this.entries,i=0,o=a.length;i<o;i++)if(se(r,a[i][0]))return a[i][1];return n},wt.prototype.update=function(e,t,r,n,a,u,c){for(var l=a===i,d=this.entries,f=0,p=d.length;f<p&&!se(n,d[f][0]);f++);var m=f<p;if(m?d[f][1]===a:l)return this;if(o(c),(l||!m)&&o(u),!l||1!==d.length){if(!m&&!l&&d.length>=Gt)return function(e,t,r,n){e||(e=new s);for(var a=new Tt(e,de(r),[r,n]),i=0;i<t.length;i++){var o=t[i];a=a.update(e,0,void 0,o[0],o[1])}return a}(e,d,n,a);var h=e&&e===this.ownerID,v=h?d:Qe(d);return m?l?f===p-1?v.pop():v[f]=v.pop():v[f]=[n,a]:v.push([n,a]),h?(this.entries=v,this):new wt(e,v)}};var Pt=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};Pt.prototype.get=function(e,t,r,n){void 0===t&&(t=de(r));var i=1<<((0===e?t:t>>>e)&a),o=this.bitmap;return 0==(o&i)?n:this.nodes[Ut(o&i-1)].get(e+5,t,r,n)},Pt.prototype.update=function(e,t,r,o,s,u,c){void 0===r&&(r=de(o));var l=(0===t?r:r>>>t)&a,d=1<<l,f=this.bitmap,p=0!=(f&d);if(!p&&s===i)return this;var m=Ut(f&d-1),h=this.nodes,v=p?h[m]:void 0,g=Vt(v,e,t+5,r,o,s,u,c);if(g===v)return this;if(!p&&g&&h.length>=zt)return function(e,t,r,a,i){for(var o=0,s=new Array(n),u=0;0!==r;u++,r>>>=1)s[u]=1&r?t[o++]:void 0;return s[a]=i,new It(e,o+1,s)}(e,h,f,l,g);if(p&&!g&&2===h.length&&Ft(h[1^m]))return h[1^m];if(p&&g&&1===h.length&&Ft(g))return g;var y=e&&e===this.ownerID,b=p?g?f:f^d:f|d,_=p?g?jt(h,m,g,y):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var a=new Array(n),i=0,o=0;o<n;o++)o===t&&(i=1),a[o]=e[o+i];return a}(h,m,y):function(e,t,r,n){var a=e.length+1;if(n&&t+1===a)return e[t]=r,e;for(var i=new Array(a),o=0,s=0;s<a;s++)s===t?(i[s]=r,o=-1):i[s]=e[s+o];return i}(h,m,g,y);return y?(this.bitmap=b,this.nodes=_,this):new Pt(e,b,_)};var It=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};It.prototype.get=function(e,t,r,n){void 0===t&&(t=de(r));var i=(0===e?t:t>>>e)&a,o=this.nodes[i];return o?o.get(e+5,t,r,n):n},It.prototype.update=function(e,t,r,n,o,s,u){void 0===r&&(r=de(n));var c=(0===t?r:r>>>t)&a,l=o===i,d=this.nodes,f=d[c];if(l&&!f)return this;var p=Vt(f,e,t+5,r,n,o,s,u);if(p===f)return this;var m=this.count;if(f){if(!p&&--m<qt)return function(e,t,r,n){for(var a=0,i=0,o=new Array(r),s=0,u=1,c=t.length;s<c;s++,u<<=1){var l=t[s];void 0!==l&&s!==n&&(a|=u,o[i++]=l)}return new Pt(e,a,o)}(e,d,m,c)}else m++;var h=e&&e===this.ownerID,v=jt(d,c,p,h);return h?(this.count=m,this.nodes=v,this):new It(e,m,v)};var Dt=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};Dt.prototype.get=function(e,t,r,n){for(var a=this.entries,i=0,o=a.length;i<o;i++)if(se(r,a[i][0]))return a[i][1];return n},Dt.prototype.update=function(e,t,r,n,a,s,u){void 0===r&&(r=de(n));var c=a===i;if(r!==this.keyHash)return c?this:(o(u),o(s),Nt(this,e,t,r,[n,a]));for(var l=this.entries,d=0,f=l.length;d<f&&!se(n,l[d][0]);d++);var p=d<f;if(p?l[d][1]===a:c)return this;if(o(u),(c||!p)&&o(s),c&&2===f)return new Tt(e,this.keyHash,l[1^d]);var m=e&&e===this.ownerID,h=m?l:Qe(l);return p?c?d===f-1?h.pop():h[d]=h.pop():h[d]=[n,a]:h.push([n,a]),m?(this.entries=h,this):new Dt(e,this.keyHash,h)};var Tt=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};Tt.prototype.get=function(e,t,r,n){return se(r,this.entry[0])?this.entry[1]:n},Tt.prototype.update=function(e,t,r,n,a,s,u){var c=a===i,l=se(n,this.entry[0]);return(l?a===this.entry[1]:c)?this:(o(u),c?void o(s):l?e&&e===this.ownerID?(this.entry[1]=a,this):new Tt(e,this.keyHash,[n,a]):(o(s),Nt(this,e,t,de(n),[n,a])))},wt.prototype.iterate=Dt.prototype.iterate=function(e,t){for(var r=this.entries,n=0,a=r.length-1;n<=a;n++)if(!1===e(r[t?a-n:n]))return!1},Pt.prototype.iterate=It.prototype.iterate=function(e,t){for(var r=this.nodes,n=0,a=r.length-1;n<=a;n++){var i=r[t?a-n:n];if(i&&!1===i.iterate(e,t))return!1}},Tt.prototype.iterate=function(e,t){return e(this.entry)};var Ot,Mt=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&Bt(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++,a=void 0;if(r.entry){if(0===n)return Et(e,r.entry)}else if(r.entries){if(n<=(a=r.entries.length-1))return Et(e,r.entries[this._reverse?a-n:n])}else if(n<=(a=r.nodes.length-1)){var i=r.nodes[this._reverse?a-n:n];if(i){if(i.entry)return Et(e,i.entry);t=this._stack=Bt(i,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(L);function Et(e,t){return V(e,t[0],t[1])}function Bt(e,t){return{node:e,index:0,__prev:t}}function kt(e,t,r,n){var a=Object.create(At);return a.size=e,a._root=t,a.__ownerID=r,a.__hash=n,a.__altered=!1,a}function Rt(){return Ot||(Ot=kt(0))}function Lt(e,t,r){var n,a;if(e._root){var o={value:!1},s={value:!1};if(n=Vt(e._root,e.__ownerID,0,void 0,t,r,o,s),!s.value)return e;a=e.size+(o.value?r===i?-1:1:0)}else{if(r===i)return e;a=1,n=new wt(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=a,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?kt(a,n):Rt()}function Vt(e,t,r,n,a,s,u,c){return e?e.update(t,r,n,a,s,u,c):s===i?e:(o(c),o(u),new Tt(t,n,[a,s]))}function Ft(e){return e.constructor===Tt||e.constructor===Dt}function Nt(e,t,r,n,i){if(e.keyHash===n)return new Dt(t,n,[e.entry,i]);var o,s=(0===r?e.keyHash:e.keyHash>>>r)&a,u=(0===r?n:n>>>r)&a,c=s===u?[Nt(e,t,r+5,n,i)]:(o=new Tt(t,n,i),s<u?[e,o]:[o,e]);return new Pt(t,1<<s|1<<u,c)}function Ut(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,127&(e+=e>>8)+(e>>16)}function jt(e,t,r,n){var a=n?e:Qe(e);return a[t]=r,a}var Gt=8,zt=16,qt=8,Ht="@@__IMMUTABLE_LIST__@@";function Wt(e){return Boolean(e&&e[Ht])}var Xt=function(e){function t(t){var r=er();if(null==t)return r;if(Wt(t))return t;var a=e(t),i=a.size;return 0===i?r:(Ke(i),i>0&&i<n?$t(0,i,5,null,new Yt(a.toArray())):r.withMutations((function(e){e.setSize(i),a.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=c(this,e))>=0&&e<this.size){var r=nr(this,e+=this._origin);return r&&r.array[e&a]}return t},t.prototype.set=function(e,t){return function(e,t,r){if((t=c(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?ar(e,t).set(0,r):ar(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,a=e._root,i={value:!1};return t>=ir(e._capacity)?n=tr(n,e.__ownerID,0,t,r,i):a=tr(a,e.__ownerID,e._level,t,r,i),i.value?e.__ownerID?(e._root=a,e._tail=n,e.__hash=void 0,e.__altered=!0,e):$t(e._origin,e._capacity,e._level,a,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):er()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){ar(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},t.prototype.pop=function(){return ar(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){ar(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},t.prototype.shift=function(){return ar(this,1)},t.prototype.concat=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++){var a=t[n],i=e("string"!=typeof a&&N(a)?a:[a]);0!==i.size&&r.push(i)}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 ar(this,0,e)},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){for(var a=0;a<r.size;a++)n.set(a,e.call(t,n.get(a),a,r))}))},t.prototype.slice=function(e,t){var r=this.size;return d(e,t,r)?this:ar(this,f(e,r),p(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=Jt(this,t);return new L((function(){var a=n();return a===Zt?{value:void 0,done:!0}:V(e,t?--r:r++,a)}))},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,a=Jt(this,t);(r=a())!==Zt&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?$t(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?er():(this.__ownerID=e,this.__altered=!1,this)},t}(w);Xt.isList=Wt;var Qt=Xt.prototype;Qt[Ht]=!0,Qt.delete=Qt.remove,Qt.merge=Qt.concat,Qt.setIn=it,Qt.deleteIn=Qt.removeIn=ot,Qt.update=ut,Qt.updateIn=ct,Qt.mergeIn=gt,Qt.mergeDeepIn=yt,Qt.withMutations=bt,Qt.wasAltered=xt,Qt.asImmutable=St,Qt["@@transducer/init"]=Qt.asMutable=_t,Qt["@@transducer/step"]=function(e,t){return e.push(t)},Qt["@@transducer/result"]=function(e){return e.asImmutable()};var Yt=function(e,t){this.array=e,this.ownerID=t};Yt.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0===this.array.length)return this;var n=r>>>t&a;if(n>=this.array.length)return new Yt([],e);var i,o=0===n;if(t>0){var s=this.array[n];if((i=s&&s.removeBefore(e,t-5,r))===s&&o)return this}if(o&&!i)return this;var u=rr(this,e);if(!o)for(var c=0;c<n;c++)u.array[c]=void 0;return i&&(u.array[n]=i),u},Yt.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||0===this.array.length)return this;var n,i=r-1>>>t&a;if(i>=this.array.length)return this;if(t>0){var o=this.array[i];if((n=o&&o.removeAfter(e,t-5,r))===o&&i===this.array.length-1)return this}var s=rr(this,e);return s.array.splice(i+1),n&&(s.array[i]=n),s};var Kt,Zt={};function Jt(e,t){var r=e._origin,a=e._capacity,i=ir(a),o=e._tail;return function e(s,u,c){return 0===u?function(e,s){var u=s===i?o&&o.array:e&&e.array,c=s>r?0:r-s,l=a-s;return l>n&&(l=n),function(){if(c===l)return Zt;var e=t?--l:c++;return u&&u[e]}}(s,c):function(i,o,s){var u,c=i&&i.array,l=s>r?0:r-s>>o,d=1+(a-s>>o);return d>n&&(d=n),function(){for(;;){if(u){var r=u();if(r!==Zt)return r;u=null}if(l===d)return Zt;var n=t?--d:l++;u=e(c&&c[n],o-5,s+(n<<o))}}}(s,u,c)}(e._root,e._level,0)}function $t(e,t,r,n,a,i,o){var s=Object.create(Qt);return s.size=t-e,s._origin=e,s._capacity=t,s._level=r,s._root=n,s._tail=a,s.__ownerID=i,s.__hash=o,s.__altered=!1,s}function er(){return Kt||(Kt=$t(0,0,5))}function tr(e,t,r,n,i,s){var u,c=n>>>r&a,l=e&&c<e.array.length;if(!l&&void 0===i)return e;if(r>0){var d=e&&e.array[c],f=tr(d,t,r-5,n,i,s);return f===d?e:((u=rr(e,t)).array[c]=f,u)}return l&&e.array[c]===i?e:(s&&o(s),u=rr(e,t),void 0===i&&c===u.array.length-1?u.array.pop():u.array[c]=i,u)}function rr(e,t){return t&&e&&t===e.ownerID?e:new Yt(e?e.array.slice():[],t)}function nr(e,t){if(t>=ir(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&a],n-=5;return r}}function ar(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new s,i=e._origin,o=e._capacity,u=i+t,c=void 0===r?o:r<0?o+r:i+r;if(u===i&&c===o)return e;if(u>=c)return e.clear();for(var l=e._level,d=e._root,f=0;u+f<0;)d=new Yt(d&&d.array.length?[void 0,d]:[],n),f+=1<<(l+=5);f&&(u+=f,i+=f,c+=f,o+=f);for(var p=ir(o),m=ir(c);m>=1<<l+5;)d=new Yt(d&&d.array.length?[d]:[],n),l+=5;var h=e._tail,v=m<p?nr(e,c-1):m>p?new Yt([],n):h;if(h&&m>p&&u<o&&h.array.length){for(var g=d=rr(d,n),y=l;y>5;y-=5){var b=p>>>y&a;g=g.array[b]=rr(g.array[b],n)}g.array[p>>>5&a]=h}if(c<o&&(v=v&&v.removeAfter(n,0,c)),u>=m)u-=m,c-=m,l=5,d=null,v=v&&v.removeBefore(n,0,u);else if(u>i||m<p){for(f=0;d;){var _=u>>>l&a;if(_!==m>>>l&a)break;_&&(f+=(1<<l)*_),l-=5,d=d.array[_]}d&&u>i&&(d=d.removeBefore(n,l,u-f)),d&&m<p&&(d=d.removeAfter(n,l,m-f)),f&&(u-=f,c-=f)}return e.__ownerID?(e.size=c-u,e._origin=u,e._capacity=c,e._level=l,e._root=d,e._tail=v,e.__hash=void 0,e.__altered=!0,e):$t(u,c,l,d,v)}function ir(e){return e<n?0:e-1>>>5<<5}var or,sr=function(e){function t(e){return null==e?cr():ie(e)?e:cr().withMutations((function(t){var r=A(e);Ke(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?this._list.get(r)[1]:t},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):cr()},t.prototype.set=function(e,t){return lr(this,e,t)},t.prototype.remove=function(e){return lr(this,e,i)},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?ur(t,r,e,this.__hash):0===this.size?cr():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(Ct);function ur(e,t,r,n){var a=Object.create(sr.prototype);return a.size=e?e.size:0,a._map=e,a._list=t,a.__ownerID=r,a.__hash=n,a.__altered=!1,a}function cr(){return or||(or=ur(Rt(),er()))}function lr(e,t,r){var a,o,s=e._map,u=e._list,c=s.get(t),l=void 0!==c;if(r===i){if(!l)return e;u.size>=n&&u.size>=2*s.size?(a=(o=u.filter((function(e,t){return void 0!==e&&c!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(a.__ownerID=o.__ownerID=e.__ownerID)):(a=s.remove(t),o=c===u.size-1?u.pop():u.set(c,void 0))}else if(l){if(r===u.get(c)[1])return e;a=s,o=u.set(c,[t,r])}else a=s.set(t,u.size),o=u.set(u.size,[t,r]);return e.__ownerID?(e.size=a.size,e._map=a,e._list=o,e.__hash=void 0,e.__altered=!0,e):ur(a,o)}sr.isOrderedMap=ie,sr.prototype[E]=!0,sr.prototype.delete=sr.prototype.remove;var dr="@@__IMMUTABLE_STACK__@@";function fr(e){return Boolean(e&&e[dr])}var pr=function(e){function t(e){return null==e?gr():fr(e)?e:gr().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=c(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):vr(t,r)},t.prototype.pushAll=function(t)