react-msaview 9.6.0 → 9.7.0

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.
package/bundle/index.js CHANGED
@@ -611,7 +611,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
611
611
  `)}var e3e,zce=A(()=>{Fce();e3e=10});var Gce=Bo(mU=>{var Hce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");mU.encode=function(e){if(0<=e&&e<Hce.length)return Hce[e];throw new TypeError("Must be between 0 and 63: "+e)};mU.decode=function(e){var t=65,o=90,r=97,n=122,i=48,s=57,a=43,l=47,c=26,u=52;return t<=e&&e<=o?e-t:r<=e&&e<=n?e-r+c:i<=e&&e<=s?e-i+u:e==a?62:e==l?63:-1}});var yU=Bo(hU=>{var Vce=Gce(),gU=5,jce=1<<gU,$ce=jce-1,Yce=jce;function n3e(e){return e<0?(-e<<1)+1:(e<<1)+0}function i3e(e){var t=(e&1)===1,o=e>>1;return t?-o:o}hU.encode=function(t){var o="",r,n=n3e(t);do r=n&$ce,n>>>=gU,n>0&&(r|=Yce),o+=Vce.encode(r);while(n>0);return o};hU.decode=function(t,o,r){var n=t.length,i=0,s=0,a,l;do{if(o>=n)throw new Error("Expected more digits in base 64 VLQ value.");if(l=Vce.decode(t.charCodeAt(o++)),l===-1)throw new Error("Invalid base64 digit: "+t.charAt(o-1));a=!!(l&Yce),l&=$ce,i=i+(l<<s),s+=gU}while(a);r.value=i3e(i),r.rest=o}});var Ny=Bo(un=>{function s3e(e,t,o){if(t in e)return e[t];if(arguments.length===3)return o;throw new Error('"'+t+'" is a required argument.')}un.getArg=s3e;var Wce=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,a3e=/^data:.+\,.+$/;function iv(e){var t=e.match(Wce);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}un.urlParse=iv;function ky(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}un.urlGenerate=ky;var l3e=32;function c3e(e){var t=[];return function(o){for(var r=0;r<t.length;r++)if(t[r].input===o){var n=t[0];return t[0]=t[r],t[r]=n,t[0].result}var i=e(o);return t.unshift({input:o,result:i}),t.length>l3e&&t.pop(),i}}var bU=c3e(function(t){var o=t,r=iv(t);if(r){if(!r.path)return t;o=r.path}for(var n=un.isAbsolute(o),i=[],s=0,a=0;;)if(s=a,a=o.indexOf("/",s),a===-1){i.push(o.slice(s));break}else for(i.push(o.slice(s,a));a<o.length&&o[a]==="/";)a++;for(var l,c=0,a=i.length-1;a>=0;a--)l=i[a],l==="."?i.splice(a,1):l===".."?c++:c>0&&(l===""?(i.splice(a+1,c),c=0):(i.splice(a,2),c--));return o=i.join("/"),o===""&&(o=n?"/":"."),r?(r.path=o,ky(r)):o});un.normalize=bU;function qce(e,t){e===""&&(e="."),t===""&&(t=".");var o=iv(t),r=iv(e);if(r&&(e=r.path||"/"),o&&!o.scheme)return r&&(o.scheme=r.scheme),ky(o);if(o||t.match(a3e))return t;if(r&&!r.host&&!r.path)return r.host=t,ky(r);var n=t.charAt(0)==="/"?t:bU(e.replace(/\/+$/,"")+"/"+t);return r?(r.path=n,ky(r)):n}un.join=qce;un.isAbsolute=function(e){return e.charAt(0)==="/"||Wce.test(e)};function u3e(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var o=0;t.indexOf(e+"/")!==0;){var r=e.lastIndexOf("/");if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++o}return Array(o+1).join("../")+t.substr(e.length+1)}un.relative=u3e;var Jce=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Kce(e){return e}function f3e(e){return Xce(e)?"$"+e:e}un.toSetString=Jce?Kce:f3e;function p3e(e){return Xce(e)?e.slice(1):e}un.fromSetString=Jce?Kce:p3e;function Xce(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var o=t-10;o>=0;o--)if(e.charCodeAt(o)!==36)return!1;return!0}function d3e(e,t,o){var r=Vu(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||o)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:Vu(e.name,t.name)}un.compareByOriginalPositions=d3e;function A3e(e,t,o){var r;return r=e.originalLine-t.originalLine,r!==0||(r=e.originalColumn-t.originalColumn,r!==0||o)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:Vu(e.name,t.name)}un.compareByOriginalPositionsNoSource=A3e;function m3e(e,t,o){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||o)||(r=Vu(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Vu(e.name,t.name)}un.compareByGeneratedPositionsDeflated=m3e;function g3e(e,t,o){var r=e.generatedColumn-t.generatedColumn;return r!==0||o||(r=Vu(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Vu(e.name,t.name)}un.compareByGeneratedPositionsDeflatedNoLine=g3e;function Vu(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function h3e(e,t){var o=e.generatedLine-t.generatedLine;return o!==0||(o=e.generatedColumn-t.generatedColumn,o!==0)||(o=Vu(e.source,t.source),o!==0)||(o=e.originalLine-t.originalLine,o!==0)||(o=e.originalColumn-t.originalColumn,o!==0)?o:Vu(e.name,t.name)}un.compareByGeneratedPositionsInflated=h3e;function y3e(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}un.parseSourceMapInput=y3e;function b3e(e,t,o){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),o){var r=iv(o);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var n=r.path.lastIndexOf("/");n>=0&&(r.path=r.path.substring(0,n+1))}t=qce(ky(r),t)}return bU(t)}un.computeSourceURL=b3e});var vU=Bo(Zce=>{var CU=Ny(),xU=Object.prototype.hasOwnProperty,im=typeof Map<"u";function ju(){this._array=[],this._set=im?new Map:Object.create(null)}ju.fromArray=function(t,o){for(var r=new ju,n=0,i=t.length;n<i;n++)r.add(t[n],o);return r};ju.prototype.size=function(){return im?this._set.size:Object.getOwnPropertyNames(this._set).length};ju.prototype.add=function(t,o){var r=im?t:CU.toSetString(t),n=im?this.has(t):xU.call(this._set,r),i=this._array.length;(!n||o)&&this._array.push(t),n||(im?this._set.set(t,i):this._set[r]=i)};ju.prototype.has=function(t){if(im)return this._set.has(t);var o=CU.toSetString(t);return xU.call(this._set,o)};ju.prototype.indexOf=function(t){if(im){var o=this._set.get(t);if(o>=0)return o}else{var r=CU.toSetString(t);if(xU.call(this._set,r))return this._set[r]}throw new Error('"'+t+'" is not in the set.')};ju.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};ju.prototype.toArray=function(){return this._array.slice()};Zce.ArraySet=ju});var oue=Bo(tue=>{var eue=Ny();function C3e(e,t){var o=e.generatedLine,r=t.generatedLine,n=e.generatedColumn,i=t.generatedColumn;return r>o||r==o&&i>=n||eue.compareByGeneratedPositionsInflated(e,t)<=0}function K1(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}K1.prototype.unsortedForEach=function(t,o){this._array.forEach(t,o)};K1.prototype.add=function(t){C3e(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};K1.prototype.toArray=function(){return this._sorted||(this._array.sort(eue.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};tue.MappingList=K1});var EU=Bo(rue=>{var sv=yU(),Er=Ny(),X1=vU().ArraySet,x3e=oue().MappingList;function Na(e){e||(e={}),this._file=Er.getArg(e,"file",null),this._sourceRoot=Er.getArg(e,"sourceRoot",null),this._skipValidation=Er.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=Er.getArg(e,"ignoreInvalidMapping",!1),this._sources=new X1,this._names=new X1,this._mappings=new x3e,this._sourcesContents=null}Na.prototype._version=3;Na.fromSourceMap=function(t,o){var r=t.sourceRoot,n=new Na(Object.assign(o||{},{file:t.file,sourceRoot:r}));return t.eachMapping(function(i){var s={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(s.source=i.source,r!=null&&(s.source=Er.relative(r,s.source)),s.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(s.name=i.name)),n.addMapping(s)}),t.sources.forEach(function(i){var s=i;r!==null&&(s=Er.relative(r,i)),n._sources.has(s)||n._sources.add(s);var a=t.sourceContentFor(i);a!=null&&n.setSourceContent(i,a)}),n};Na.prototype.addMapping=function(t){var o=Er.getArg(t,"generated"),r=Er.getArg(t,"original",null),n=Er.getArg(t,"source",null),i=Er.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(o,r,n,i)===!1||(n!=null&&(n=String(n),this._sources.has(n)||this._sources.add(n)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:o.line,generatedColumn:o.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:n,name:i}))};Na.prototype.setSourceContent=function(t,o){var r=t;this._sourceRoot!=null&&(r=Er.relative(this._sourceRoot,r)),o!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Er.toSetString(r)]=o):this._sourcesContents&&(delete this._sourcesContents[Er.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};Na.prototype.applySourceMap=function(t,o,r){var n=o;if(o==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);n=t.file}var i=this._sourceRoot;i!=null&&(n=Er.relative(i,n));var s=new X1,a=new X1;this._mappings.unsortedForEach(function(l){if(l.source===n&&l.originalLine!=null){var c=t.originalPositionFor({line:l.originalLine,column:l.originalColumn});c.source!=null&&(l.source=c.source,r!=null&&(l.source=Er.join(r,l.source)),i!=null&&(l.source=Er.relative(i,l.source)),l.originalLine=c.line,l.originalColumn=c.column,c.name!=null&&(l.name=c.name))}var u=l.source;u!=null&&!s.has(u)&&s.add(u);var f=l.name;f!=null&&!a.has(f)&&a.add(f)},this),this._sources=s,this._names=a,t.sources.forEach(function(l){var c=t.sourceContentFor(l);c!=null&&(r!=null&&(l=Er.join(r,l)),i!=null&&(l=Er.relative(i,l)),this.setSourceContent(l,c))},this)};Na.prototype._validateMapping=function(t,o,r,n){if(o&&typeof o.line!="number"&&typeof o.column!="number"){var i="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(i),!1;throw new Error(i)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!o&&!r&&!n)){if(t&&"line"in t&&"column"in t&&o&&"line"in o&&"column"in o&&t.line>0&&t.column>=0&&o.line>0&&o.column>=0&&r)return;var i="Invalid mapping: "+JSON.stringify({generated:t,source:r,original:o,name:n});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(i),!1;throw new Error(i)}};Na.prototype._serializeMappings=function(){for(var t=0,o=1,r=0,n=0,i=0,s=0,a="",l,c,u,f,p=this._mappings.toArray(),d=0,m=p.length;d<m;d++){if(c=p[d],l="",c.generatedLine!==o){t=0;var y=c.generatedLine-o;l+=y===1?";":";".repeat(y),o=c.generatedLine}else if(d>0){if(!Er.compareByGeneratedPositionsInflated(c,p[d-1]))continue;l+=","}l+=sv.encode(c.generatedColumn-t),t=c.generatedColumn,c.source!=null&&(f=this._sources.indexOf(c.source),l+=sv.encode(f-s),s=f,l+=sv.encode(c.originalLine-1-n),n=c.originalLine-1,l+=sv.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(u=this._names.indexOf(c.name),l+=sv.encode(u-i),i=u)),a+=l}return a};Na.prototype._generateSourcesContent=function(t,o){return t.map(function(r){if(!this._sourcesContents)return null;o!=null&&(r=Er.relative(o,r));var n=Er.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)};Na.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};Na.prototype.toString=function(){return JSON.stringify(this.toJSON())};rue.SourceMapGenerator=Na});var nue=Bo(sm=>{sm.GREATEST_LOWER_BOUND=1;sm.LEAST_UPPER_BOUND=2;function TU(e,t,o,r,n,i){var s=Math.floor((t-e)/2)+e,a=n(o,r[s],!0);return a===0?s:a>0?t-s>1?TU(s,t,o,r,n,i):i==sm.LEAST_UPPER_BOUND?t<r.length?t:-1:s:s-e>1?TU(e,s,o,r,n,i):i==sm.LEAST_UPPER_BOUND?s:e<0?-1:e}sm.search=function(t,o,r,n){if(o.length===0)return-1;var i=TU(-1,o.length,t,o,r,n||sm.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&r(o[i],o[i-1],!0)===0;)--i;return i}});var lue=Bo(aue=>{function sue(e){function t(n,i,s){var a=n[i];n[i]=n[s],n[s]=a}function o(n,i){return Math.round(n+Math.random()*(i-n))}function r(n,i,s,a){if(s<a){var l=o(s,a),c=s-1;t(n,l,a);for(var u=n[a],f=s;f<a;f++)i(n[f],u,!1)<=0&&(c+=1,t(n,c,f));t(n,c+1,f);var p=c+1;r(n,i,s,p-1),r(n,i,p+1,a)}}return r}function v3e(e){let t=sue.toString();return new Function(`return ${t}`)()(e)}var E3e=(function(){try{return new Function("return 0")(),!0}catch{return!1}})(),iue=new WeakMap;aue.quickSort=function(e,t,o=0){let r=E3e?iue.get(t):sue(t);r===void 0&&(r=v3e(t),iue.set(t,r)),r(e,t,o,e.length-1)}});var pue=Bo(e_=>{var Fe=Ny(),wU=nue(),Ly=vU().ArraySet,T3e=yU(),av=lue().quickSort,Z1=1e7;function Go(e,t){var o=e;return typeof e=="string"&&(o=Fe.parseSourceMapInput(e)),o.sections!=null?new _l(o,t):new _n(o,t)}Go.fromSourceMap=function(e,t){return _n.fromSourceMap(e,t)};Go.prototype._version=3;Go.prototype.__generatedMappings=null;Object.defineProperty(Go.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});Go.prototype.__originalMappings=null;Object.defineProperty(Go.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});Go.prototype._charIsMappingSeparator=function(t,o){var r=t.charAt(o);return r===";"||r===","};Go.prototype._parseMappings=function(t,o){throw new Error("Subclasses must implement _parseMappings")};Go.GENERATED_ORDER=1;Go.ORIGINAL_ORDER=2;Go.GREATEST_LOWER_BOUND=1;Go.LEAST_UPPER_BOUND=2;Go.prototype.eachMapping=function(t,o,r){var n=o||null,i=r||Go.GENERATED_ORDER,s;switch(i){case Go.GENERATED_ORDER:s=this._generatedMappings;break;case Go.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}for(var a=this.sourceRoot,l=t.bind(n),c=this._names,u=this._sources,f=this._sourceMapURL,p=0,d=s.length;p<d;p++){var m=s[p],y=m.source===null?null:u.at(m.source);y!==null&&(y=Fe.computeSourceURL(a,y,f)),l({source:y,generatedLine:m.generatedLine,generatedColumn:m.generatedColumn,originalLine:m.originalLine,originalColumn:m.originalColumn,name:m.name===null?null:c.at(m.name)})}};Go.prototype.allGeneratedPositionsFor=function(t){var o=Fe.getArg(t,"line"),r={source:Fe.getArg(t,"source"),originalLine:o,originalColumn:Fe.getArg(t,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var n=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",Fe.compareByOriginalPositions,wU.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(t.column===void 0)for(var a=s.originalLine;s&&s.originalLine===a;)n.push({line:Fe.getArg(s,"generatedLine",null),column:Fe.getArg(s,"generatedColumn",null),lastColumn:Fe.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===o&&s.originalColumn==l;)n.push({line:Fe.getArg(s,"generatedLine",null),column:Fe.getArg(s,"generatedColumn",null),lastColumn:Fe.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return n};e_.SourceMapConsumer=Go;function _n(e,t){var o=e;typeof e=="string"&&(o=Fe.parseSourceMapInput(e));var r=Fe.getArg(o,"version"),n=Fe.getArg(o,"sources"),i=Fe.getArg(o,"names",[]),s=Fe.getArg(o,"sourceRoot",null),a=Fe.getArg(o,"sourcesContent",null),l=Fe.getArg(o,"mappings"),c=Fe.getArg(o,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);s&&(s=Fe.normalize(s)),n=n.map(String).map(Fe.normalize).map(function(u){return s&&Fe.isAbsolute(s)&&Fe.isAbsolute(u)?Fe.relative(s,u):u}),this._names=Ly.fromArray(i.map(String),!0),this._sources=Ly.fromArray(n,!0),this._absoluteSources=this._sources.toArray().map(function(u){return Fe.computeSourceURL(s,u,t)}),this.sourceRoot=s,this.sourcesContent=a,this._mappings=l,this._sourceMapURL=t,this.file=c}_n.prototype=Object.create(Go.prototype);_n.prototype.consumer=Go;_n.prototype._findSourceIndex=function(e){var t=e;if(this.sourceRoot!=null&&(t=Fe.relative(this.sourceRoot,t)),this._sources.has(t))return this._sources.indexOf(t);var o;for(o=0;o<this._absoluteSources.length;++o)if(this._absoluteSources[o]==e)return o;return-1};_n.fromSourceMap=function(t,o){var r=Object.create(_n.prototype),n=r._names=Ly.fromArray(t._names.toArray(),!0),i=r._sources=Ly.fromArray(t._sources.toArray(),!0);r.sourceRoot=t._sourceRoot,r.sourcesContent=t._generateSourcesContent(r._sources.toArray(),r.sourceRoot),r.file=t._file,r._sourceMapURL=o,r._absoluteSources=r._sources.toArray().map(function(d){return Fe.computeSourceURL(r.sourceRoot,d,o)});for(var s=t._mappings.toArray().slice(),a=r.__generatedMappings=[],l=r.__originalMappings=[],c=0,u=s.length;c<u;c++){var f=s[c],p=new fue;p.generatedLine=f.generatedLine,p.generatedColumn=f.generatedColumn,f.source&&(p.source=i.indexOf(f.source),p.originalLine=f.originalLine,p.originalColumn=f.originalColumn,f.name&&(p.name=n.indexOf(f.name)),l.push(p)),a.push(p)}return av(r.__originalMappings,Fe.compareByOriginalPositions),r};_n.prototype._version=3;Object.defineProperty(_n.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function fue(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}var IU=Fe.compareByGeneratedPositionsDeflatedNoLine;function cue(e,t){let o=e.length,r=e.length-t;if(!(r<=1))if(r==2){let n=e[t],i=e[t+1];IU(n,i)>0&&(e[t]=i,e[t+1]=n)}else if(r<20)for(let n=t;n<o;n++)for(let i=n;i>t;i--){let s=e[i-1],a=e[i];if(IU(s,a)<=0)break;e[i-1]=a,e[i]=s}else av(e,IU,t)}_n.prototype._parseMappings=function(t,o){var r=1,n=0,i=0,s=0,a=0,l=0,c=t.length,u=0,f={},p={},d=[],m=[],y,b,h,g,C;let x=0;for(;u<c;)if(t.charAt(u)===";")r++,u++,n=0,cue(m,x),x=m.length;else if(t.charAt(u)===",")u++;else{for(y=new fue,y.generatedLine=r,g=u;g<c&&!this._charIsMappingSeparator(t,g);g++);for(b=t.slice(u,g),h=[];u<g;)T3e.decode(t,u,p),C=p.value,u=p.rest,h.push(C);if(h.length===2)throw new Error("Found a source, but no line and column");if(h.length===3)throw new Error("Found a source and line, but no column");if(y.generatedColumn=n+h[0],n=y.generatedColumn,h.length>1&&(y.source=a+h[1],a+=h[1],y.originalLine=i+h[2],i=y.originalLine,y.originalLine+=1,y.originalColumn=s+h[3],s=y.originalColumn,h.length>4&&(y.name=l+h[4],l+=h[4])),m.push(y),typeof y.originalLine=="number"){let I=y.source;for(;d.length<=I;)d.push(null);d[I]===null&&(d[I]=[]),d[I].push(y)}}cue(m,x),this.__generatedMappings=m;for(var E=0;E<d.length;E++)d[E]!=null&&av(d[E],Fe.compareByOriginalPositionsNoSource);this.__originalMappings=[].concat(...d)};_n.prototype._findMapping=function(t,o,r,n,i,s){if(t[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[r]);if(t[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[n]);return wU.search(t,o,i,s)};_n.prototype.computeColumnSpans=function(){for(var t=0;t<this._generatedMappings.length;++t){var o=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var r=this._generatedMappings[t+1];if(o.generatedLine===r.generatedLine){o.lastGeneratedColumn=r.generatedColumn-1;continue}}o.lastGeneratedColumn=1/0}};_n.prototype.originalPositionFor=function(t){var o={generatedLine:Fe.getArg(t,"line"),generatedColumn:Fe.getArg(t,"column")},r=this._findMapping(o,this._generatedMappings,"generatedLine","generatedColumn",Fe.compareByGeneratedPositionsDeflated,Fe.getArg(t,"bias",Go.GREATEST_LOWER_BOUND));if(r>=0){var n=this._generatedMappings[r];if(n.generatedLine===o.generatedLine){var i=Fe.getArg(n,"source",null);i!==null&&(i=this._sources.at(i),i=Fe.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=Fe.getArg(n,"name",null);return s!==null&&(s=this._names.at(s)),{source:i,line:Fe.getArg(n,"originalLine",null),column:Fe.getArg(n,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};_n.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(t){return t==null}):!1};_n.prototype.sourceContentFor=function(t,o){if(!this.sourcesContent)return null;var r=this._findSourceIndex(t);if(r>=0)return this.sourcesContent[r];var n=t;this.sourceRoot!=null&&(n=Fe.relative(this.sourceRoot,n));var i;if(this.sourceRoot!=null&&(i=Fe.urlParse(this.sourceRoot))){var s=n.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!i.path||i.path=="/")&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(o)return null;throw new Error('"'+n+'" is not in the SourceMap.')};_n.prototype.generatedPositionFor=function(t){var o=Fe.getArg(t,"source");if(o=this._findSourceIndex(o),o<0)return{line:null,column:null,lastColumn:null};var r={source:o,originalLine:Fe.getArg(t,"line"),originalColumn:Fe.getArg(t,"column")},n=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",Fe.compareByOriginalPositions,Fe.getArg(t,"bias",Go.GREATEST_LOWER_BOUND));if(n>=0){var i=this._originalMappings[n];if(i.source===r.source)return{line:Fe.getArg(i,"generatedLine",null),column:Fe.getArg(i,"generatedColumn",null),lastColumn:Fe.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};e_.BasicSourceMapConsumer=_n;function _l(e,t){var o=e;typeof e=="string"&&(o=Fe.parseSourceMapInput(e));var r=Fe.getArg(o,"version"),n=Fe.getArg(o,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new Ly,this._names=new Ly;var i={line:-1,column:0},s=0;this._sections=n.map(function(a){if(a.url)throw new Error("Support for url field in sections not implemented.");var l=Fe.getArg(a,"offset"),c=Fe.getArg(l,"line"),u=Fe.getArg(l,"column");if(!uue(c)||!uue(u))throw new Error("Section offset line and column must be non-negative integers.");if(c>Z1)throw new Error("Section offset line must not exceed "+Z1+".");if(c<i.line||c===i.line&&u<i.column)throw new Error("Section offsets must be ordered and non-overlapping.");i=l;var f=new Go(Fe.getArg(a,"map"),t),p=c+(f._maxOffsetLine||0);if(p>Z1)throw new Error("Section offset line must not exceed "+Z1+", including offsets of nested sections.");return p>s&&(s=p),{generatedOffset:{generatedLine:c+1,generatedColumn:u+1},consumer:f}}),this._maxOffsetLine=s}function uue(e){return typeof e=="number"&&e>=0&&e<=9007199254740991&&Math.floor(e)===e}_l.prototype=Object.create(Go.prototype);_l.prototype.constructor=Go;_l.prototype._version=3;Object.defineProperty(_l.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var o=this._sections[t].consumer.sources,r=0;r<o.length;r++)e.push(o[r]);return e}});_l.prototype.originalPositionFor=function(t){var o={generatedLine:Fe.getArg(t,"line"),generatedColumn:Fe.getArg(t,"column")},r=wU.search(o,this._sections,function(i,s){var a=i.generatedLine-s.generatedOffset.generatedLine;return a||i.generatedColumn-s.generatedOffset.generatedColumn}),n=this._sections[r];return n?n.consumer.originalPositionFor({line:o.generatedLine-(n.generatedOffset.generatedLine-1),column:o.generatedColumn-(n.generatedOffset.generatedLine===o.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}};_l.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(t){return t.consumer.hasContentsOfAllSources()})};_l.prototype.sourceContentFor=function(t,o){for(var r=0;r<this._sections.length;r++){var n=this._sections[r],i=n.consumer.sourceContentFor(t,!0);if(i||i==="")return i}if(o)return null;throw new Error('"'+t+'" is not in the SourceMap.')};_l.prototype.generatedPositionFor=function(t){for(var o=0;o<this._sections.length;o++){var r=this._sections[o];if(r.consumer._findSourceIndex(Fe.getArg(t,"source"))!==-1){var n=r.consumer.generatedPositionFor(t);if(n){var i={line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}};_l.prototype._parseMappings=function(t,o){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],i=n.consumer._generatedMappings,s=0;s<i.length;s++){var a=i[s],l=n.consumer._sources.at(a.source);l!==null&&(l=Fe.computeSourceURL(n.consumer.sourceRoot,l,this._sourceMapURL)),this._sources.add(l),l=this._sources.indexOf(l);var c=null;a.name&&(c=n.consumer._names.at(a.name),this._names.add(c),c=this._names.indexOf(c));var u={source:l,generatedLine:a.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:a.generatedColumn+(n.generatedOffset.generatedLine===a.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:a.originalLine,originalColumn:a.originalColumn,name:c};this.__generatedMappings.push(u),typeof u.originalLine=="number"&&this.__originalMappings.push(u)}av(this.__generatedMappings,Fe.compareByGeneratedPositionsDeflated),av(this.__originalMappings,Fe.compareByOriginalPositions)};e_.IndexedSourceMapConsumer=_l});var Aue=Bo(due=>{var I3e=EU().SourceMapGenerator,t_=Ny(),w3e=/(\r?\n)/,S3e=10,Fy="$$$isSourceNode$$$";function js(e,t,o,r,n){this.children=[],this.sourceContents={},this.line=e??null,this.column=t??null,this.source=o??null,this.name=n??null,this[Fy]=!0,r!=null&&this.add(r)}js.fromStringWithSourceMap=function(t,o,r){var n=new js,i=t.split(w3e),s=0,a=function(){var p=m(),d=m()||"";return p+d;function m(){return s<i.length?i[s++]:void 0}},l=1,c=0,u=null;return o.eachMapping(function(p){if(u!==null)if(l<p.generatedLine)f(u,a()),l++,c=0;else{var d=i[s]||"",m=d.substr(0,p.generatedColumn-c);i[s]=d.substr(p.generatedColumn-c),c=p.generatedColumn,f(u,m),u=p;return}for(;l<p.generatedLine;){if(s>=i.length){l=p.generatedLine;break}n.add(a()),l++}if(c<p.generatedColumn){var d=i[s]||"";n.add(d.substr(0,p.generatedColumn)),i[s]=d.substr(p.generatedColumn),c=p.generatedColumn}u=p},this),s<i.length&&(u&&f(u,a()),n.add(i.splice(s).join(""))),o.sources.forEach(function(p){var d=o.sourceContentFor(p);d!=null&&(r!=null&&(p=t_.join(r,p)),n.setSourceContent(p,d))}),n;function f(p,d){if(p===null||p.source===void 0)n.add(d);else{var m=r?t_.join(r,p.source):p.source;n.add(new js(p.originalLine,p.originalColumn,m,d,p.name))}}};js.prototype.add=function(t){if(Array.isArray(t))t.forEach(function(o){this.add(o)},this);else if(t[Fy]||typeof t=="string")t&&this.children.push(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this};js.prototype.prepend=function(t){if(Array.isArray(t))for(var o=t.length-1;o>=0;o--)this.prepend(t[o]);else if(t[Fy]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this};js.prototype.walk=function(t){for(var o,r=0,n=this.children.length;r<n;r++)o=this.children[r],o[Fy]?o.walk(t):o!==""&&t(o,{source:this.source,line:this.line,column:this.column,name:this.name})};js.prototype.join=function(t){var o,r,n=this.children.length;if(n>0){for(o=[],r=0;r<n-1;r++)o.push(this.children[r]),o.push(t);o.push(this.children[r]),this.children=o}return this};js.prototype.replaceRight=function(t,o){var r=this.children[this.children.length-1];return r[Fy]?r.replaceRight(t,o):typeof r=="string"?this.children[this.children.length-1]=r.replace(t,o):this.children.push("".replace(t,o)),this};js.prototype.setSourceContent=function(t,o){this.sourceContents[t_.toSetString(t)]=o};js.prototype.walkSourceContents=function(t){for(var o=0,r=this.children.length;o<r;o++)this.children[o][Fy]&&this.children[o].walkSourceContents(t);for(var n=Object.keys(this.sourceContents),o=0,r=n.length;o<r;o++)t(t_.fromSetString(n[o]),this.sourceContents[n[o]])};js.prototype.toString=function(){var t="";return this.walk(function(o){t+=o}),t};js.prototype.toStringWithSourceMap=function(t){var o={code:"",line:1,column:0},r=new I3e(t),n=!1,i=null,s=null,a=null,l=null;return this.walk(function(c,u){o.code+=c,u.source!==null&&u.line!==null&&u.column!==null?((i!==u.source||s!==u.line||a!==u.column||l!==u.name)&&r.addMapping({source:u.source,original:{line:u.line,column:u.column},generated:{line:o.line,column:o.column},name:u.name}),i=u.source,s=u.line,a=u.column,l=u.name,n=!0):n&&(r.addMapping({generated:{line:o.line,column:o.column}}),i=null,n=!1);for(var f=0,p=c.length;f<p;f++)c.charCodeAt(f)===S3e?(o.line++,o.column=0,f+1===p?(i=null,n=!1):n&&r.addMapping({source:u.source,original:{line:u.line,column:u.column},generated:{line:o.line,column:o.column},name:u.name})):o.column++}),this.walkSourceContents(function(c,u){r.setSourceContent(c,u)}),{code:o.code,map:r}};due.SourceNode=js});var mue=Bo(o_=>{o_.SourceMapGenerator=EU().SourceMapGenerator;o_.SourceMapConsumer=pue().SourceMapConsumer;o_.SourceNode=Aue().SourceNode});async function hue(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} fetching ${e}: ${await t.text()}`);return t.text()}function R3e(e,t){let o=[...e.matchAll(B3e)].at(-1)?.[1]?.trim(),r;return o&&(r=new URL(o,t),!r.search&&r.protocol!=="data:"&&(r.search=new URL(t).search)),r?.href}async function M3e(e){try{let t=R3e(await hue(e),e);return t?new bue.SourceMapConsumer(JSON.parse(await hue(t))):void 0}catch{return}}function Q3e(e){let t=yue.get(e);if(t)return t;{let o=M3e(e);return yue.set(e,o),o}}function P3e(e){let t=_3e.exec(e);if(!t)return;let o=t.index,r=e.slice(o).replace(/\)$/,""),n=r.lastIndexOf(":"),i=r.lastIndexOf(":",n-1),s=r.slice(i+1,n),a=r.slice(n+1);return i>0&&gue.test(s)&&gue.test(a)?{name:e.slice(0,o).trim().replace(/^at\b\s*/,"").replace(/\s*\($/,"").replace(/@$/,""),uri:r.slice(0,i),line:+s,column:+a}:void 0}async function D3e(e){let t=P3e(e),o=t?await Q3e(t.uri):void 0;if(t&&o){let r=o.originalPositionFor({line:t.line,column:t.column-1}),{source:n,line:i,column:s}=r;return n!==null&&i!==null&&s!==null?`${n}:${i}:${s+1}${t.name?` (${t.name})`:""}`:e}else return e}async function Cue(e){return(await Promise.all(e.split(`
612
612
  `).map(D3e))).join(`
613
613
  `)}var bue,B3e,_3e,gue,yue,xue=A(()=>{bue=w(mue(),1),B3e=/\/\/# sourceMappingURL=(.*)/g,_3e=/(?:blob:)?(?:https?|file):\/\//,gue=/^\d+$/;yue=new Map});var Eue={};Hn(Eue,{default:()=>k3e});var lv,vue,O3e,k3e,Tue=A(()=>{lv=w(G(),1);q5();Mle();Ie();Ple();Ule();Yle();dU();AU();zce();xue();vue=1e4,O3e=z(function({error:t,onClose:o,extra:r}){let n=Rle(),i=t?`${t}`:"",s=Uce(t),{data:a,isLoading:l}=Qle(["mappedStackTrace",s],()=>Cue(s)),c=n?`Graphics: ${_le(n)}`:"",u=n?.gpuVendor?`GPU: ${n.gpuVendor}${n.gpuArchitecture?` (${n.gpuArchitecture})`:""}`:"",f=n?.glRenderer?`GL renderer: ${n.glRenderer}${n.softwareWebgl?" (SOFTWARE RASTERIZER)":""}`:"",p=window.JBrowseSession,d=p?.version,m=p?.rpcManager,y=m?`RPC: ${m.driverName}`:"",b=[i.length>vue?`${i.slice(0,vue)}...`:i,a||s||"No stack trace available","--- environment ---",d?`JBrowse ${d}`:"",c,u,f,y,`Cross-origin isolated: ${crossOriginIsolated}`,`CPU cores: ${navigator.hardwareConcurrency}`,`Device pixel ratio: ${window.devicePixelRatio}`,`Window size: ${window.innerWidth}x${window.innerHeight}`,`URL: ${window.location.href}`,`User agent: ${navigator.userAgent}`].filter(Boolean).join(`
614
- `);return(0,lv.jsx)(q1,{open:!0,onClose:()=>{o()},maxWidth:"xl",title:"Stack trace",actions:(0,lv.jsx)(Fle,{variant:"contained",color:"secondary",value:b,copiedLabel:"Copied!",children:"Copy stack trace to clipboard"}),children:l?(0,lv.jsx)(nv,{variant:"h6"}):(0,lv.jsx)($le,{text:b,extra:r})})}),k3e=O3e});var xc,Uy,N3e,L3e,Iue,wue=A(()=>{xc=w(G(),1),Uy=w(D(),1);xle();We();Ie();N3e=(0,Uy.lazy)(()=>Promise.resolve().then(()=>(Tue(),Eue))),L3e=z(function({error:t,color:o}){let[r,n]=(0,Uy.useState)(!1);return(0,xc.jsxs)(xc.Fragment,{children:[(0,xc.jsx)(Xt,{title:"Show stack trace",children:(0,xc.jsx)(jt,{color:o,onClick:()=>{n(!0)},children:(0,xc.jsx)(Cle,{})})}),r?(0,xc.jsx)(Uy.Suspense,{fallback:null,children:(0,xc.jsx)(N3e,{error:t,onClose:()=>{n(!1)}})}):null]})}),Iue=L3e});var $u,F3e,Sue,Bue=A(()=>{$u=w(G(),1);W5();We();Ie();wue();F3e=z(function({error:t,onRetry:o,extraAction:r,color:n}){return(0,$u.jsxs)($u.Fragment,{children:[r,(0,$u.jsx)(Iue,{error:t,color:n}),o?(0,$u.jsx)(Xt,{title:"Retry",children:(0,$u.jsx)(jt,{"data-testid":"reload_button",onClick:()=>{o()},color:n,children:(0,$u.jsx)(z1,{})})}):null]})}),Sue=F3e});var _ue,U3e,z3e,cv,SU=A(()=>{_ue=w(G(),1);Ie();ln();U3e=$t()(e=>({bg:{padding:4,margin:4,overflow:"auto",background:e.palette.mode==="dark"?"#833":"#f88",border:`1px solid ${e.palette.divider}`}})),z3e=z(function({children:t}){let{classes:o}=U3e();return(0,_ue.jsx)("div",{className:o.bg,"data-testid":"error-message-box",children:t})}),cv=z3e});function H3e(e){try{return JSON.parse(e)}catch{return e}}function Rue(e){let t,o="",r=/(?:at path "([^"]*)" )?snapshot `([^`]*)` is not assignable/.exec(e);return r&&(t=H3e(r[2]),o=r[1]?`Snapshot at path "${r[1]}":`:"Snapshot:"),{snapshotValue:t,message:o}}var Mue=A(()=>{});var vc,G3e,V3e,Rce,Mce=A(()=>{vc=w(G(),1);Ie();ln();Bue();SU();Mue();G3e=$t()(e=>({bg:{background:e.palette.divider,border:`1px solid ${e.palette.text.primary}`,margin:20},message:{background:e.palette.action.hover,border:`1px solid ${e.palette.divider}`,padding:"12px 16px",margin:"16px 20px",fontFamily:"monospace",fontSize:"0.9rem"},iconFloat:{float:"right",marginLeft:100}})),V3e=z(function({error:t,onReset:o,extraAction:r}){let{classes:n}=G3e(),i=`${t}`,s=i.indexOf("expected an instance of"),a=s===-1?i:i.slice(0,s),{snapshotValue:l,message:c}=Rue(i);return(0,vc.jsxs)(cv,{children:[a.slice(0,1e4),(0,vc.jsx)("div",{className:n.iconFloat,children:(0,vc.jsx)(Sue,{error:t,onRetry:o,extraAction:r,color:"primary"})}),l!==void 0?(0,vc.jsxs)(vc.Fragment,{children:[(0,vc.jsx)("div",{className:n.message,children:c}),(0,vc.jsx)("pre",{className:n.bg,children:JSON.stringify(l,null,2)})]}):null]})}),Rce=V3e});var Que,Pue,Due=A(()=>{"use client";bo();Que=w(G(),1),Pue=xe((0,Que.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}),"Help")});function r_(){let e=(0,Oue.useRef)(null);return{action:e,autoFocus:!1,disableAutoFocus:!0,onEntering:t=>{e.current?.updatePosition(),t.querySelector(j3e)?.focus({preventScroll:!0})}}}var Oue,j3e,BU=A(()=>{Oue=w(D(),1),j3e='[role^="menuitem"]:not(.Mui-disabled)'});var kue,$3e,Nue,Lue=A(()=>{kue=w(G(),1);We();Ie();BU();$3e=z(function({anchorEl:t,onClose:o,onMouseEnter:r,paperRef:n,anchorOrigin:i,transformOrigin:s,zIndex:a,children:l}){let{onEntering:c,...u}=r_();return(0,kue.jsx)(os,{...u,open:!0,anchorEl:t,onClose:o,anchorOrigin:i,transformOrigin:s,style:{pointerEvents:"none",zIndex:a},hideBackdrop:!0,slotProps:{paper:{style:{pointerEvents:"auto"},onMouseEnter:r,ref:n},transition:{onEntering:c}},onKeyDown:f=>{f.stopPropagation()},children:l})}),Nue=$3e});var Fue,_U,Uue=A(()=>{"use client";bo();Fue=w(G(),1),_U=xe((0,Fue.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}),"HelpOutlined")});var zy,Y3e,zue,Hue=A(()=>{zy=w(G(),1);Ie();dU();Y3e=z(function({onClose:t,helpText:o,label:r}){return(0,zy.jsx)(q1,{open:!0,onClose:t,title:"Help",titleNode:r?(0,zy.jsxs)(zy.Fragment,{children:["Help: ",r]}):void 0,onClick:n=>{n.stopPropagation()},onMouseDown:n=>{n.stopPropagation()},children:o})}),zue=Y3e});var Ec,Gue,Vue,jue,W3e,$ue,Yue=A(()=>{Ec=w(G(),1),Gue=w(D(),1);Uue();We();Ie();Hue();Vue={marginLeft:4,padding:4},jue=z(function(){return(0,Ec.jsx)(jt,{size:"small",disabled:!0,style:{...Vue,visibility:"hidden"},children:(0,Ec.jsx)(_U,{fontSize:"small"})})}),W3e=z(function({helpText:t,label:o}){let[r,n]=(0,Gue.useState)(!1);return(0,Ec.jsxs)(Ec.Fragment,{children:[(0,Ec.jsx)(jt,{size:"small","aria-label":typeof o=="string"?`Help for ${o}`:"Help for this item",onClick:i=>{i.stopPropagation(),n(!0)},style:Vue,children:(0,Ec.jsx)(_U,{fontSize:"small"})}),r?(0,Ec.jsx)(zue,{helpText:t,label:o,onClose:()=>{n(!1)}}):null]})}),$ue=W3e});var Wue,que,Jue=A(()=>{"use client";bo();Wue=w(G(),1),que=xe((0,Wue.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight")});var Kue,RU,Xue=A(()=>{Kue=w(G(),1);Jue();Ie();RU=z(function({hidden:t}){return(0,Kue.jsx)(que,{style:t?{visibility:"hidden"}:void 0})})});var Zue,efe,tfe=A(()=>{"use client";bo();Zue=w(G(),1),efe=xe((0,Zue.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckBox")});var ofe,rfe,nfe=A(()=>{"use client";bo();ofe=w(G(),1),rfe=xe((0,ofe.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"}),"CheckBoxOutlineBlank")});var ife,sfe,afe=A(()=>{"use client";bo();ife=w(G(),1),sfe=xe((0,ife.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"RadioButtonChecked")});var lfe,cfe,ufe=A(()=>{"use client";bo();lfe=w(G(),1),cfe=xe((0,lfe.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"RadioButtonUnchecked")});var Hy,q3e,ffe,pfe=A(()=>{Hy=w(G(),1);tfe();nfe();afe();ufe();Ie();ln();q3e=$t()({menuItemEndDecoration:{padding:0,margin:0,height:16}}),ffe=z(function({type:t,checked:o}){let{classes:r}=q3e(),n;switch(t){case"checkbox":{n=o?(0,Hy.jsx)(efe,{}):(0,Hy.jsx)(rfe,{color:"action"});break}case"radio":{n=o?(0,Hy.jsx)(sfe,{}):(0,Hy.jsx)(cfe,{color:"action"});break}}return(0,Hy.jsx)("div",{className:r.menuItemEndDecoration,children:n})})});function MU(e){return"endAdornment"in e?e.endAdornment:void 0}function QU(e){return e.type==="custom"?!1:"endAdornment"in e&&!!e.endAdornment}var PU=A(()=>{});var fn,J3e,K3e,X3e,dfe,DU,Afe=A(()=>{fn=w(G(),1);Ie();Yue();Xue();pfe();PU();J3e=8,K3e=28,X3e=z(function({type:t,checked:o,separated:r}){return(0,fn.jsx)("div",{style:{marginRight:r?J3e:0},children:(0,fn.jsx)(ffe,{type:t,checked:o})})}),dfe=z(function({children:t}){return(0,fn.jsx)("div",{style:{width:K3e,display:"flex",justifyContent:"flex-end",alignItems:"center"},children:t})}),DU=z(function({item:t,columns:{hasCheckboxOrRadioWithHelp:o,hasEndAdornment:r,hasSubmenuWithHelp:n,sharedActionColumn:i}}){let s="subMenu"in t,a=t.type==="checkbox"||t.type==="radio",l=o||r,c=t.helpText&&!t.disabled?(0,fn.jsx)($ue,{helpText:t.helpText,label:t.label}):void 0;return(0,fn.jsxs)(fn.Fragment,{children:[(0,fn.jsx)("div",{style:{flexGrow:1,minWidth:10}}),a?(0,fn.jsx)(X3e,{type:t.type,checked:t.checked,separated:l}):null,i?(0,fn.jsx)(dfe,{children:c??MU(t)}):(0,fn.jsxs)(fn.Fragment,{children:[c??(a&&o?(0,fn.jsx)(jue,{}):null),r?(0,fn.jsx)(dfe,{children:MU(t)}):null]}),s?(0,fn.jsx)(RU,{}):n?(0,fn.jsx)(RU,{hidden:!0}):null]})})});function mfe(e){return typeof e.subMenu=="function"?e.subMenu():e.subMenu}function gfe(e){return e.keepMenuOpen??(e.type==="checkbox"||e.type==="radio")}var hfe=A(()=>{});function yfe(e,t,o){let n=(Math.abs(o.left-t.x)<=Math.abs(o.right-t.x)?o.left:o.right)-t.x;if(n===0)return!0;let i=Math.min((e.x-t.x)/n,1);return i>0&&e.y>=t.y+(o.top-t.y)*i&&e.y<=t.y+(o.bottom-t.y)*i}var bfe=A(()=>{});function OU(){let e=(0,Bi.use)(Cfe);if(!e)throw new Error("menu row rendered outside a CascadingMenu");return e}function t4e(e){let t,o={current:null},r,n,i,s=()=>{i&&(clearTimeout(i.timer),i=void 0)},a=(p,d)=>{s(),r=p===void 0?void 0:d,n=d,t=p,e(p)},l=p=>t!==void 0&&n!==void 0&&p.x===n.x&&p.y===n.y,c=p=>{let d=o.current;if(!d||!r)return"unmeasured";let m=d.getBoundingClientRect();return m.width===0&&m.height===0?"unmeasured":yfe(p,r,m)?"inside":"outside"},u=(p,d)=>{s(),i={key:p,point:d,timer:setTimeout(()=>{a(p,d)},e4e)}},f=(p,d)=>{if(p===t)s();else{if(l(d))return;t===void 0||c(d)==="outside"?a(p,d):u(p,d)}};return{panelRef:o,setSubmenu:a,cancelPending:s,hoverSubmenu:f,closeOnHover:p=>{f(void 0,{x:p.clientX,y:p.clientY})},onPointerMove:p=>{n={x:p.clientX,y:p.clientY};let d=i;if(!d)return;let m=c({x:p.clientX,y:p.clientY});m==="outside"?a(d.key,d.point):m==="inside"&&u(d.key,d.point)}}}function o4e(){let[e,t]=(0,Bi.useState)(),[o]=(0,Bi.useState)(()=>t4e(t));return(0,Bi.useEffect)(()=>o.cancelPending,[o]),(0,Bi.useEffect)(()=>{if(e!==void 0)return document.addEventListener("mousemove",o.onPointerMove),()=>{document.removeEventListener("mousemove",o.onPointerMove)}},[e,o]),{openSubmenu:e,hover:o}}function r4e(e){let t=new Map;return e.map(o=>{let r="subMenu"in o?"subMenu":o.type==="divider"||o.type==="subHeader"?o.type:o.type==="custom"?"custom":"menuitem",n=o.type==="divider"?"":"id"in o&&o.id||`${o.label}`,i=`${r}-${n}`,s=t.get(i)??0;return t.set(i,s+1),`${s}-${i}`})}function n4e(e){if(!e)return;let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function xfe(e,t){return typeof t=="string"?`cascading-${e}-${t.toLowerCase().replaceAll(/\s+/g,"_")}`:void 0}function i4e(e){let t=e.some(n=>(n.type==="checkbox"||n.type==="radio")&&n.helpText&&!n.disabled),o=e.some(n=>QU(n)),r=e.some(n=>QU(n)&&"helpText"in n&&n.helpText&&!("disabled"in n&&n.disabled));return{hasIcon:e.some(n=>"icon"in n&&n.icon),columns:{hasCheckboxOrRadioWithHelp:t,hasEndAdornment:o,hasSubmenuWithHelp:e.some(n=>"subMenu"in n&&n.helpText&&!n.disabled),sharedActionColumn:t&&o&&!r}}}var Ht,Bi,Z3e,Cfe,e4e,vfe,s4e,Efe,a4e,l4e,c4e,Tfe,u4e,Ife,wfe=A(()=>{Ht=w(G(),1),Bi=w(D(),1);We();Ie();ln();Lue();Afe();hfe();PU();bfe();BU();Z3e=$t()(e=>({subHeader:{lineHeight:"1.8em",fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:"0.05em",color:e.palette.text.secondary,borderTop:`1px solid ${e.palette.divider}`,marginTop:4},leadingSubHeader:{borderTopWidth:0,marginTop:0}})),Cfe=(0,Bi.createContext)(void 0);e4e=120;vfe=z(function({Icon:t}){return t?(0,Ht.jsx)(ny,{children:(0,Ht.jsx)(t,{})}):null});s4e=z(function({item:t,onHover:o}){let{onCloseRoot:r}=OU();return(0,Ht.jsx)("li",{style:{padding:"4px 16px"},onMouseEnter:o,onMouseDown:n=>{n.stopPropagation()},onKeyDown:n=>{n.key!=="Escape"&&n.stopPropagation()},children:t.render(r)})}),Efe=z(function({item:t,children:o}){return t.disabled&&t.disabledHelpText?(0,Ht.jsx)(Xt,{title:t.disabledHelpText,placement:"left",children:(0,Ht.jsx)("span",{children:o})}):o}),a4e=z(function({item:t,itemKey:o,inset:r,columns:n,open:i,hover:s,onNavigateBack:a}){let{zIndex:l}=OU(),[c,u]=(0,Bi.useState)(null),f=i&&!t.disabled;return(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(Efe,{item:t,children:(0,Ht.jsxs)(ar,{ref:u,"data-testid":xfe("submenu",t.label),disabled:t.disabled,"aria-haspopup":"menu","aria-expanded":f,selected:f,onMouseEnter:p=>{s.hoverSubmenu(o,{x:p.clientX,y:p.clientY})},onClick:p=>{s.setSubmenu(o,{x:p.clientX,y:p.clientY})},onKeyDown:p=>{p.key==="ArrowRight"?s.setSubmenu(o,n4e(c)):p.key==="ArrowLeft"&&(p.stopPropagation(),a?.())},children:[(0,Ht.jsx)(vfe,{Icon:t.icon}),(0,Ht.jsx)(HA,{primary:t.label,inset:r}),(0,Ht.jsx)(DU,{item:t,columns:n})]})}),f?(0,Ht.jsx)(Nue,{anchorEl:c,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},zIndex:l,onMouseEnter:s.cancelPending,paperRef:s.panelRef,onClose:()=>{s.setSubmenu(void 0)},children:(0,Ht.jsx)(l4e,{item:t,onNavigateBack:()=>{s.setSubmenu(void 0),c?.focus()}})}):null]})}),l4e=z(function({item:t,onNavigateBack:o}){return(0,Ht.jsx)(Tfe,{menuItems:mfe(t),onNavigateBack:o})}),c4e=z(function({item:t,inset:o,columns:r,onNavigateBack:n,onHover:i}){let{closeAfterItemClick:s,onMenuItemClick:a,onCloseRoot:l}=OU();return(0,Ht.jsx)(Efe,{item:t,children:(0,Ht.jsxs)(ar,{"data-testid":xfe("menuitem",t.label),disabled:t.disabled,role:t.type==="checkbox"?"menuitemcheckbox":t.type==="radio"?"menuitemradio":void 0,"aria-checked":t.type==="checkbox"||t.type==="radio"?t.checked:void 0,onClick:()=>{s&&!gfe(t)&&l(),a(t.onClick)},onMouseEnter:i,onKeyDown:c=>{c.key==="ArrowLeft"&&(c.stopPropagation(),n?.())},children:[(0,Ht.jsx)(vfe,{Icon:t.icon}),(0,Ht.jsx)(HA,{primary:t.label,secondary:t.subLabel,inset:o}),(0,Ht.jsx)(DU,{item:t,columns:r})]})})}),Tfe=z(function({menuItems:t,onNavigateBack:o}){let{classes:r,cx:n}=Z3e(),{openSubmenu:i,hover:s}=o4e(),{closeOnHover:a}=s,{hasIcon:l,columns:c}=(0,Bi.useMemo)(()=>i4e(t),[t]),u=(0,Bi.useMemo)(()=>t.toSorted((p,d)=>(d.priority??0)-(p.priority??0)),[t]),f=(0,Bi.useMemo)(()=>r4e(u),[u]);return(0,Ht.jsx)(Ht.Fragment,{children:u.map((p,d)=>{let m=f[d];return"subMenu"in p?(0,Ht.jsx)(a4e,{itemKey:m,item:p,inset:l&&!p.icon,columns:c,open:i===m,hover:s,onNavigateBack:o},m):p.type==="divider"?(0,Ht.jsx)(Xh,{component:"li"},m):p.type==="subHeader"?(0,Ht.jsx)(jh,{className:n(r.subHeader,d===0&&r.leadingSubHeader),onMouseEnter:a,children:p.label},m):p.type==="custom"?(0,Ht.jsx)(s4e,{item:p,onHover:a},m):(0,Ht.jsx)(c4e,{item:p,inset:l&&!p.icon,columns:c,onNavigateBack:o,onHover:a},m)})})}),u4e=z(function({onMenuItemClick:t,closeAfterItemClick:o=!0,menuItems:r,open:n,onClose:i,anchorEl:s,anchorOrigin:a,transformOrigin:l,anchorReference:c,anchorPosition:u,style:f}){let p=Array.isArray(r)?r:r(),{onEntering:d,...m}=r_();return(0,Ht.jsx)(os,{...m,anchorEl:s,open:n,onClose:i,anchorOrigin:a,transformOrigin:l,anchorReference:c,anchorPosition:u,style:f,slotProps:{transition:{onEntering:d}},children:(0,Ht.jsx)(Cfe,{value:{closeAfterItemClick:o,onMenuItemClick:t,onCloseRoot:i,zIndex:f?.zIndex},children:(0,Ht.jsx)(Tfe,{menuItems:p})})})}),Ife=u4e});var Tc,Sfe,f4e,p4e,d4e,A4e,n_,kU=A(()=>{Tc=w(G(),1),Sfe=w(D(),1);Oh();e1();Ie();wfe();f4e={vertical:"bottom",horizontal:"left"},p4e={vertical:"top",horizontal:"left"},d4e=z(function({title:t,disabled:o,children:r}){return t?(0,Tc.jsx)(Xt,{title:t,children:o?(0,Tc.jsx)("span",{children:r}):r}):r}),A4e=z(function({children:t,menuItems:o,closeAfterItemClick:r=!0,stopPropagation:n,disabled:i,setOpen:s,ButtonComponent:a=jt,onClick:l,onMenuItemClick:c=m=>{m()},anchorOrigin:u=f4e,transformOrigin:f=p4e,tooltip:p,...d}){let[m,y]=(0,Sfe.useState)(null),b=!!m,h=i??(Array.isArray(o)&&o.length===0);return(0,Tc.jsxs)(Tc.Fragment,{children:[(0,Tc.jsx)(d4e,{title:p,disabled:h,children:(0,Tc.jsx)(a,{"aria-label":p,onClick:g=>{n&&g.stopPropagation(),(Array.isArray(o)?o:o()).length>0&&(y(g.currentTarget),s?.(!0)),l?.(g)},...d,disabled:h,children:t})}),b?(0,Tc.jsx)(Ife,{open:b,onClose:()=>{y(null),s?.(!1)},anchorEl:m,anchorOrigin:u,transformOrigin:f,menuItems:o,closeAfterItemClick:r,onMenuItemClick:c}):null]})}),n_=A4e});function m4e(e){let t=e instanceof Error?e.name:"",o=`${e}`.toLowerCase();return t==="ChunkLoadError"||o.includes("loading")&&o.includes("chunk")&&o.includes("failed")||o.includes("failed to fetch dynamically imported module")||o.includes("error loading dynamically imported module")}var _p,g4e,Ic,Bfe=A(()=>{_p=w(G(),1);W5();We();Ie();SU();g4e=z(function({error:t}){return m4e(t)?(0,_p.jsxs)(cv,{children:[(0,_p.jsx)("div",{children:"Failed to load part of the application, likely due to a server update or network error. Refreshing the page usually fixes it."}),(0,_p.jsx)(tt,{variant:"contained",startIcon:(0,_p.jsx)(z1,{}),onClick:()=>{window.location.reload()},style:{margin:4},children:"Refresh page"}),(0,_p.jsx)("div",{children:`${t}`})]}):(0,_p.jsx)(cv,{children:`${t}`})}),Ic=g4e});function h4e(){if(typeof window>"u")return!1;let e=window.location.hash.slice(1);return new URLSearchParams(e.includes("=")?e:window.location.search).get("adminKey")!==null}function Rfe(e){return e.length>_fe?`${e.slice(0,_fe)}\u2026`:e}function Mfe(e){let{toggleContents:t,name:o}=e;return t?typeof t=="string"?Rfe(t):t:Rfe(o)}function Qfe(e){return[...h4e()?[]:["file"],"url",...e]}function Pfe(e,t="file"){return e&&"internetAccountId"in e&&e.internetAccountId?e.internetAccountId:e?Qa(e)?"url":"uri"in e?t:"file":"url"}function Dfe(e,t){if(e){if(Qa(e)){let o=e.internetAccountId??"url";return t==="file"?o:void 0}return"uri"in e||t==="file"?void 0:"file"}}function Ofe(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));if(t===-1)return;let o=e.slice(0,t);return/^[a-zA-Z]:$/.test(o)||o===""?e.slice(0,t+1):o}function NU(e,t){if(!Qa(e))return e;let o=t?.internetAccountId;if(e.internetAccountId===o)return e;let{internetAccountId:r,...n}=e;return o?{...n,internetAccountId:o}:n}var _fe,i_=A(()=>{om();_fe=5});function C4e(){return L1(kfe)}function x4e(e){let t=Ofe(e);t&&Xx(kfe,t)}function v4e(e){if(Nx(e)||qA(e))return e.name;if(p1(e))return e.localPath}function E4e(e){return Nx(e)?!m1(e.blobId):qA(e)?!g1(e.handleId):!1}async function Nfe(){try{let[e]=await window.showOpenFilePicker();return await Die(e)}catch(e){if(e instanceof DOMException&&e.name==="AbortError")return;throw e}}var ti,y4e,b4e,kfe,T4e,I4e,w4e,Lfe,Ffe=A(()=>{ti=w(G(),1);We();Ie();$F();om();WF();ln();JA();i_();y4e=$t()(e=>({filename:{marginLeft:e.spacing(1)}})),b4e=wie()&&!ku,kfe="jbrowse-last-local-file-dir";T4e=z(function({setLocation:t}){return b4e?(0,ti.jsx)(tt,{variant:"outlined",onClick:async()=>{let o=await Nfe();o&&t(o)},children:"Choose File"}):ku?(0,ti.jsx)(tt,{variant:"outlined",onClick:async()=>{let{ipcRenderer:o}=window.require("electron"),r=await o.invoke("promptOpenLocalFile",C4e()),n=typeof r=="string"?r:void 0;n&&(x4e(n),t({localPath:n,locationType:"LocalPathLocation"}))},children:"Choose File"}):(0,ti.jsxs)(tt,{variant:"outlined",component:"label",children:["Choose File",(0,ti.jsx)("input",{type:"file",hidden:!0,onChange:({target:o})=>{let r=o.files?.[0];if(r){let n=Mie({blob:r});"blobId"in n&&t(n)}}})]})}),I4e=z(function({location:t,setLocation:o}){let r=async()=>{if(qA(t))try{await Pie(t.handleId,!0),o({...t})}catch{let n=await Nfe();n&&o(n)}};return(0,ti.jsxs)(Ho,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,ti.jsx)(ve,{color:"error",children:"(need to reload)"}),qA(t)&&(0,ti.jsx)(tt,{size:"small",variant:"text",color:"primary",onClick:r,children:"Reopen"})]})}),w4e=z(function({location:t,setLocation:o}){let{classes:r}=y4e(),n=v4e(t);return(0,ti.jsxs)(Ho,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,ti.jsx)(Ho,{children:(0,ti.jsx)(hc,{fullWidth:!0,children:(0,ti.jsx)(T4e,{setLocation:o})})}),(0,ti.jsxs)(Ho,{children:[(0,ti.jsx)(ve,{component:"span",className:r.filename,color:n?"initial":"textSecondary",children:n||"No file chosen"}),t&&E4e(t)&&(0,ti.jsx)(I4e,{location:t,setLocation:o})]})]})}),Lfe=w4e});var Ufe,LU,S4e,zfe,Hfe=A(()=>{Ufe=w(G(),1),LU=w(D(),1);We();Ie();JA();S4e=z(function({location:t,label:o,style:r,setLocation:n}){let i=t&&Qa(t)?t.uri:"",[s,a]=(0,LU.useState)(i),[l,c]=(0,LU.useState)(i);return i!==l&&(c(i),i!==s.trim()&&a(i)),(0,Ufe.jsx)(an,{variant:"outlined",fullWidth:!0,value:s,label:o||"Enter URL",style:r,onChange:u=>{a(u.target.value),n({uri:u.target.value.trim(),locationType:"UriLocation"})},slotProps:{htmlInput:{"data-testid":"urlInput"}}})}),zfe=S4e});var FU,B4e,Gfe,Vfe=A(()=>{FU=w(G(),1);Ie();Ffe();Hfe();B4e=z(function({toggleButtonValue:t,selectedAccount:o,location:r,inline:n,setLocation:i}){return t==="file"?(0,FU.jsx)(Lfe,{location:r,setLocation:i}):(0,FU.jsx)(zfe,{location:r,setLocation:i,label:o?.selectorLabel,style:n?{margin:0}:void 0})}),Gfe=B4e});var jfe,wc,Gy=A(()=>{"use client";bo();jfe=w(G(),1),wc=xe((0,jfe.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown")});var Rl,_4e,R4e,M4e,$fe,Yfe=A(()=>{Rl=w(G(),1);Gy();We();Ie();kU();i_();_4e=z(function({account:t}){return(0,Rl.jsx)(Xt,{title:t.name,children:(0,Rl.jsx)(Ou,{value:t.internetAccountId,children:Mfe(t)})})}),R4e=z(function({onClick:t,disabled:o,children:r}){return(0,Rl.jsx)(Ou,{value:"more",selected:!1,disabled:o,onClick:n=>{t(n)},children:r})}),M4e=z(function({value:t,sourceTypes:o,shownAccounts:r,hiddenAccounts:n,onChange:i,onHiddenAccountSelect:s}){return(0,Rl.jsxs)(Ay,{value:t,exclusive:!0,size:"small",onChange:i,"aria-label":"file, url, or account picker",children:[o.includes("file")&&(0,Rl.jsx)(Ou,{value:"file","aria-label":"local file",children:"File"}),(0,Rl.jsx)(Ou,{value:"url","aria-label":"url",children:"URL"}),r.map(a=>(0,Rl.jsx)(_4e,{account:a},a.internetAccountId)),n.length>0&&(0,Rl.jsxs)(n_,{menuItems:n.map(a=>({label:a.name,onClick:()=>{s(a.internetAccountId)}})),ButtonComponent:R4e,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:["More",(0,Rl.jsx)(wc,{})]})]})}),$fe=M4e});function qfe(){return(0,s_.use)(Wfe)}var s_,Wfe,F8t,Jfe=A(()=>{s_=w(D(),1),Wfe=(0,s_.createContext)(void 0),F8t=Wfe.Provider});function UU(e){let[t,o]=Jae("fileSelector-recentlyUsedInternetAccounts",[]),r=kF(e)?e.internetAccounts.filter(a=>a.showInFileSelector):[],n=Object.fromEntries(r.map(a=>[a.internetAccountId,a])),i=a=>{let l=t.indexOf(a);return l===-1?Number.POSITIVE_INFINITY:l},s=Object.values(n).sort((a,l)=>i(a.internetAccountId)-i(l.internetAccountId));return{accountMap:n,shownAccounts:s.slice(0,Kfe),hiddenAccounts:s.slice(Kfe),recentlyUsed:t,setRecentlyUsed:o}}var Kfe,Xfe=A(()=>{Kae();JA();Kfe=2});var Ml,Yu,Q4e,uv,Zfe=A(()=>{Ml=w(G(),1),Yu=w(D(),1);We();Ie();om();JA();Vfe();Yfe();Jfe();Xfe();i_();Q4e=z(function({inline:t,location:o,name:r,description:n,rootModel:i,setLocation:s}){let a=qfe(),l=(0,Yu.useId)(),c=(0,Yu.useId)(),[u,f]=(0,Yu.useState)(()=>Pfe(o,a)),{accountMap:p,shownAccounts:d,hiddenAccounts:m,recentlyUsed:y,setRecentlyUsed:b}=UU(i),h=Qfe(Object.keys(p)),g=h.includes(u)?u:"url",[C,x]=(0,Yu.useState)(o);if(o!==C){x(o);let S=Dfe(o,g);S&&f(S)}let E=p[g],I=(0,Yu.useCallback)(S=>{s(NU(S,E))},[s,E]),T=(0,Yu.useCallback)(S=>{if(S&&(b([...new Set([S,...y].filter(Oa))]),f(S),o&&Qa(o))){let B=NU(o,p[S]);B!==o&&s(B)}},[o,y,b,p,s]);return(0,Ml.jsxs)(Ml.Fragment,{children:[(0,Ml.jsx)(Ho,{sx:{display:"flex"},children:(0,Ml.jsx)(ry,{id:l,shrink:!0,children:r})}),(0,Ml.jsxs)(Ho,{role:"group","aria-labelledby":r?l:void 0,"aria-describedby":n?c:void 0,sx:{display:"flex",flexDirection:t?"row":"column",gap:.5},children:[(0,Ml.jsx)($fe,{value:g,sourceTypes:h,shownAccounts:d,hiddenAccounts:m,onChange:(S,B)=>{T(B)},onHiddenAccountSelect:T}),(0,Ml.jsx)(Gfe,{toggleButtonValue:g,selectedAccount:E,location:o,inline:t,setLocation:I})]}),(0,Ml.jsx)(ty,{id:c,children:n})]})}),uv=Q4e});var epe,tpe,ope=A(()=>{"use client";bo();epe=w(G(),1),tpe=xe((0,epe.jsx)("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"}),"RestartAlt")});var rpe=A(()=>{});async function Vy(e){return e.bytes?e.bytes():new Uint8Array(await e.arrayBuffer())}async function a_(e,t,o){if(t==="utf8"||t==="utf-8")return e.text();if(t)throw new Error(`unsupported encoding: ${t}`);return o&&"body"in e?zU(e,o):Vy(e)}function l_(e){return typeof e=="string"?{encoding:e,opts:{}}:{encoding:e?.encoding,opts:e??{}}}function npe(e){let t=/\/(\d+)$/.exec(e??"")?.[1];return t===void 0?void 0:parseInt(t,10)}function P4e(e){let t=e.headers.get("content-length"),o=t===null?Number.NaN:Number(t);return Number.isSafeInteger(o)&&o>=0?o:void 0}async function zU(e,t){let o=P4e(e),r=e.body;if(!r||o===void 0){let l=await Vy(e);return t(l.byteLength,o??l.byteLength),l}let n=r.getReader(),i=new Uint8Array(o),s=0,a=Date.now();t(0,o);for(let l=await n.read();!l.done;l=await n.read()){if(s+l.value.byteLength>i.length){let u=new Uint8Array(Math.max(s+l.value.byteLength,i.length*2));u.set(i.subarray(0,s)),i=u}i.set(l.value,s),s+=l.value.byteLength;let c=Date.now();c-a>=D4e&&(a=c,t(s,o))}return t(s,o),s===i.length?i:i.slice(0,s)}var D4e,HU=A(()=>{D4e=50});var am,ipe=A(()=>{HU();am=class{source;blob;constructor(t){this.blob=t}async read(t,o=0,r={}){if(t===0)return new Uint8Array(0);r.signal?.throwIfAborted();let n=await Vy(this.blob.slice(o,o+t));return r.signal?.throwIfAborted(),n}async readFile(t){let{encoding:o,opts:r}=l_(t);r.signal?.throwIfAborted();let n=await a_(this.blob,o);return r.signal?.throwIfAborted(),n}stat(){return Promise.resolve({size:this.blob.size})}close(){return Promise.resolve()}}});function O4e(...e){let t=new Map;for(let o of e)for(let[r,n]of Object.entries(o??{}))t.set(r.toLowerCase(),[r,n]);return Object.fromEntries(t.values())}function GU(e){let t=e.body;typeof t?.cancel=="function"&&t.cancel().catch(()=>{})}function spe(e){return Number.isSafeInteger(e)&&e>=0}function k4e(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="TypeError"}function N4e(e){return(typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:`${e}`).replace(/\.$/,"")}var jy,ape=A(()=>{HU();jy=class{url;get source(){return this.url}_stat;statProbe;fetchImplementation;baseHeaders;baseOverrides;baseSignal;constructor(t,o={}){this.url=t,this.baseHeaders=o.headers??{},this.baseOverrides=o.overrides??{},this.baseSignal=o.signal,this.fetchImplementation=o.fetch??globalThis.fetch.bind(globalThis)}buildRequest(t,o){let r=t.signal??this.baseSignal;return{method:"GET",redirect:"follow",mode:"cors",...this.baseOverrides,...t.overrides,headers:O4e(this.baseHeaders,t.headers,o),...r?{signal:r}:{}}}async fetch(t,o){let r=i=>k4e(i)&&!o?.signal?.aborted?new Error(`${N4e(i)} fetching ${t}`,{cause:i}):i,n;try{n=await this.fetchImplementation(t,o)}catch(i){if(`${i}`.includes("Failed to fetch")){console.warn(`generic-filehandle: refetching ${t} to attempt to work around chrome CORS header caching bug`);try{n=await this.fetchImplementation(t,{...o,cache:"reload"})}catch(s){throw r(s)}}else throw r(i)}return n}async read(t,o,r={}){if(!spe(t)||!spe(o))throw new TypeError(`read() called with an invalid length or position (length=${t}, position=${o}). The index file may be corrupt.`);return t===0?new Uint8Array(0):this.fetchBytes(t,o,r)}async fetchBytes(t,o,r){let n=await this.fetch(this.url,this.buildRequest(r,{range:`bytes=${o}-${o+t-1}`}));if(n.status===416)return GU(n),new Uint8Array(0);if(this.checkOk(n),n.status===200&&o===0||n.status===206){let i=npe(n.headers.get("content-range"));i!==void 0&&(this._stat={size:i});let s=r.onProgress?await zU(n,r.onProgress):await Vy(n);return!this._stat&&n.status===200&&(this._stat={size:s.byteLength}),s.byteLength<=t?s:s.slice(0,t)}throw GU(n),new Error(n.status===200?`${this.url} fetch returned status 200, expected 206`:`HTTP ${n.status} fetching ${this.url}`)}checkOk(t){if(!t.ok)throw GU(t),new Error(`HTTP ${t.status} fetching ${this.url}`)}async readFile(t){let{encoding:o,opts:r}=l_(t),n=await this.fetch(this.url,this.buildRequest(r));this.checkOk(n);let i=await this.readFileBody(n,o,r.onProgress);return n.status===200&&typeof i!="string"&&(this._stat={size:i.byteLength}),i}readFileBody(t,o,r){return a_(t,o,r)}async stat(){return this._stat||(this.statProbe??=this.read(10,0).finally(()=>{this.statProbe=void 0}),await this.statProbe),this._stat??{size:0}}close(){return Promise.resolve()}}});var c_,VU=A(()=>{rpe();ipe();ape();c_=class{source;constructor(t,o={}){this.source=t}unimplemented(){return Promise.reject(new Error(`LocalFile is unimplemented in the browser (${this.source})`))}readFile(t){return this.unimplemented()}read(t,o,r){return this.unimplemented()}stat(){return this.unimplemented()}close(){return this.unimplemented()}}});function u_(e){typeof e=="object"&&e!==null&&"unref"in e&&typeof e.unref=="function"&&e.unref()}function jU(e){if(!e)return;let t=e.trim(),o=/^bytes (?:(\d+)-(\d+)|\*)\/(?:(\d+)|\*)$/.exec(t);if(!o){let s=/^bytes\b.*\/(\d+)\s*$/i.exec(t);return s?{start:void 0,end:void 0,total:Number.parseInt(s[1],10)}:void 0}let[,r,n,i]=o;return{start:r===void 0?void 0:Number.parseInt(r,10),end:n===void 0?void 0:Number.parseInt(n,10),total:i===void 0?void 0:Number.parseInt(i,10)}}function f_(e){e.body?.cancel().catch(()=>{})}async function cpe(e,t){if(!e.body){let s=new Uint8Array(await e.arrayBuffer());return s.byteLength>t?void 0:s}let o=e.body.getReader(),r=[],n=0,i=!1;for(;!i&&n<=t;){let s=await o.read();s.done?i=!0:(r.push(s.value),n+=s.value.byteLength)}return i||o.cancel().catch(()=>{}),n>t?void 0:L4e(r,n)}function L4e(e,t){let o=new Uint8Array(t),r=0;for(let n of e)o.set(n,r),r+=n.byteLength;return o}function upe(e){let t=e?/^bytes=(\d+)-(\d+)$/.exec(e):null;if(t){let o=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return r<o?void 0:{start:o,end:r}}else return}function fv(e,t,o){if(Number.isNaN(t)||Number.isNaN(o))throw new TypeError(`read() of ${e} called with NaN length or position (length=${t}, position=${o}); the index the offset came from is probably corrupt or truncated`);if(!Number.isSafeInteger(t)||!Number.isSafeInteger(o)||t<0||o<0)throw new TypeError(`read() of ${e} needs a non-negative safe-integer length and position (length=${t}, position=${o}); the index the offset came from is probably corrupt or being read against the wrong file`);if(t>lpe)throw new TypeError(`read() of ${e} asked for ${t} bytes, more than the ${lpe} a Uint8Array can hold; the index the offset came from is probably corrupt or being read against the wrong file`)}function $U(e){try{let t=typeof location>"u"?void 0:location.href,{protocol:o,origin:r}=new URL(e,t);return o==="http:"||o==="https:"?r:void 0}catch{return}}function fpe(){return globalThis.navigator?.locks}function ppe(e){return`@gmod/range-cache-filehandle body ${e}`}async function F4e(e,t){try{await fpe()?.request(ppe(e),{mode:"shared"},()=>t)}catch{}}function YU(e){let t=$U(e);if(t===void 0)return()=>{};$y.set(t,($y.get(t)??0)+1);let o=()=>{};F4e(t,new Promise(n=>{o=n}));let r=!0;return()=>{if(r){r=!1,o();let n=($y.get(t)??1)-1;n>0?$y.set(t,n):$y.delete(t)}}}async function dpe(e){let t=$y.get(e)??0;try{let{held:o=[]}=await fpe()?.query()??{},r=ppe(e);return Math.max(t,o.filter(n=>n.name===r).length)}catch{return t}}var lpe,$y,pv=A(()=>{lpe=2**32-1;$y=new Map});function Ape(e,t,o){let r=o===void 0?void 0:$U(o),n=new AbortController,i=!1,s=0,a,l=()=>!i&&!e?.aborted,c=async()=>{s++;let p=r!==void 0&&s<=10&&await dpe(r)>=6;if(l())p?u():(f.expired=new Error(t(s*3e4/1e3)),n.abort(f.expired));else return},u=()=>{a=setTimeout(()=>{l()&&c()},3e4),u_(a)},f={signal:e?AbortSignal.any([e,n.signal]):n.signal,stop:()=>{i=!0,clearTimeout(a)}};return u(),f}function mpe(e){let t=e;for(let o=0;o<5&&typeof t=="object"&&t!==null;o++){if("name"in t&&t.name==="TypeError")return!0;t="cause"in t?t.cause:void 0}return!1}function z4e(e){if(typeof location>"u"||location.protocol!=="https:")return!1;try{return new URL(e,location.href).protocol==="http:"}catch{return!1}}function gpe(e){return typeof navigator<"u"&&navigator.onLine===!1?" (the browser reports no network connection)":z4e(e)?" (a page served over https may not load a file served over http, and the browser blocked this before it left; the file has to be served over https too)":" (no response at all, so there is no status to report \u2014 most often CORS: the server must send Access-Control-Allow-Origin, and Access-Control-Expose-Headers: Content-Range as well or the size of the file cannot be read either. A host that is down, a DNS failure and a blocked port look identical from here)"}function hpe(e){return e===200?" (the server ignored the Range header and returned the whole file; byte-range support is required for BAM/CRAM/tabix/bigwig files)":e===401||e===403?" (the file is there and the request was refused; a signed URL may have expired, or a bucket policy may not grant read to the page origin)":e===404?" (no such file; check the URL, and that the index file sits where the reader expects it alongside the data file)":e===429||e>=500?" (the server is failing or declining to serve this file just now; nothing is retried automatically, so try again once it recovers)":""}var ype=A(()=>{pv()});function j4e(e){let t=d_.get(e);return t===void 0&&(t={key:e,extents:[],pending:[],turn:void 0},d_.set(e,t)),t}function $4e(e,{start:t,end:o}){let r=Av(e,t-1),n=r,i={start:t,end:o};for(;n<e.length&&e[n].start<=o;)i={start:Math.min(i.start,e[n].start),end:Math.max(i.end,e[n].end)},n++;e.splice(r,n-r,i)}function qU(e,t,o){let r=[];for(let n=Av(e,t);n<e.length&&e[n].start<o;n++)r.push(e[n]);return r}function JU(e){e.extents.length===0&&e.pending.length===0&&e.turn===void 0&&d_.get(e.key)===e&&d_.delete(e.key)}function Av(e,t){let o=0,r=e.length;for(;o<r;){let n=o+r>>>1;e[n].end<=t?o=n+1:r=n}return o}function Cpe(e){e.older=Yy,e.newer=void 0,Yy===void 0?lm=e:Yy.newer=e,Yy=e}function xpe(e){e.older===void 0?lm=e.newer:e.older.newer=e.newer,e.newer===void 0?Yy=e.older:e.newer.older=e.older,e.older=void 0,e.newer=void 0}function vpe(e,t){e!==Yy&&(xpe(e),Cpe(e)),e.lastTouched=t}function Epe(e){xpe(e),dv-=e.end-e.start;let{extents:t}=e.file;t.splice(Av(t,e.start),1),JU(e.file),dv===0&&J4e()}function Y4e(){for(;dv>V4e&&lm!==void 0;)Epe(lm)}function W4e(e,t,o){let r=t+o.length,n=Date.now(),{extents:i}=e,s=Av(i,t),a=(c,u)=>{for(let f=c;f<u;f+=1048576){let p=Math.min(u,f+1048576),d={file:e,start:f,end:p,bytes:new Uint8Array(o.subarray(f-t,p-t)),lastTouched:n,older:void 0,newer:void 0};i.splice(s,0,d),s++,Cpe(d),dv+=p-f}},l=t;for(;s<i.length&&i[s].start<r;){let c=i[s];c.start>l&&a(l,c.start),l=Math.max(l,c.end),s++}l<r&&a(l,r),dv>0&&q4e(),Y4e()}function Tpe(){let e=Date.now()-9e5;for(;lm!==void 0&&lm.lastTouched<=e;)Epe(lm)}function q4e(){Wy===void 0&&(Wy=setInterval(Tpe,225e3),u_(Wy))}function J4e(){Wy!==void 0&&(clearInterval(Wy),Wy=void 0)}function K4e(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t.origin:e}catch{return e}}function X4e(e){let t=A_.get(e);return t===void 0&&(t={active:0,queue:[]},A_.set(e,t)),t}function Ipe(e,t){t.active===0&&t.queue.length===0&&A_.get(e)===t&&A_.delete(e)}function Z4e(e,t){t.queue.length>0&&t.active<20&&(t.active++,t.queue.shift()()),Ipe(e,t)}async function eze(e,t){if(t?.aborted)return!1;let o=!1;return await new Promise(r=>{let n=()=>{o=!0,t?.removeEventListener("abort",i),r()},i=()=>{let s=e.queue.indexOf(n);s!==-1&&e.queue.splice(s,1),r()};e.queue.push(n),t?.addEventListener("abort",i,{once:!0})}),o}async function wpe(e,t,o){let r=K4e(e),n=X4e(r);if(n.active<20)n.active++;else if(!await eze(n,o))throw Ipe(r,n),o?.throwIfAborted(),new Error(`internal: gave up waiting for a request slot for ${e}`);try{return await t()}finally{n.active--,Z4e(r,n)}}async function Spe(e,t){let o=bpe(e);if(o!==void 0)return o;let r=p_.get(e);if(r===void 0){let i={size:wpe(e,t),stale:!1},s=()=>{p_.get(e)===i&&p_.delete(e)};i.size.then(a=>{!i.stale&&a!==void 0&&cm(e,a),s()},s),p_.set(e,i),r=i}let n=await r.size;return bpe(e)??n}function cm(e,t){Number.isFinite(t)&&Bpe(e,{size:t,exact:!0})}function tze(e,t){let o=Rp.get(e);(o===void 0||t<o.size)&&Bpe(e,{size:t,exact:!1})}function Bpe(e,t){Rp.delete(e),oze(Rp,5e3),Rp.set(e,t)}function oze(e,t){for(;e.size>=t;){let o=e.keys().next().value;if(o===void 0)return;e.delete(o)}}function KU(e){let t=Rp.get(e);return t!==void 0&&(Rp.delete(e),Rp.set(e,t)),t?.size}function bpe(e){return Rp.get(e)?.exact?KU(e):void 0}function rze(e,{start:t,end:o,doFetch:r},n){let i=new AbortController,s=wpe(e.key,()=>(i.signal.throwIfAborted(),r(t,o-1,i.signal)),i.signal),a={start:t,end:o,signals:new Set,pinned:!1,controller:i,dispose:new AbortController,settled:!1,stale:n,readers:0,owned:!1,body:s.then(({bytes:c,total:u,owned:f})=>(a.owned=f===!0,a.stale||(u!==void 0&&cm(e.key,u),c.length===0?tze(e.key,t):c.length<o-t&&cm(e.key,t+c.length),W4e(e,t,c)),c))},l=()=>{a.settled=!0,a.dispose.abort(),a.signals.clear(),e.pending.splice(e.pending.indexOf(a),1),JU(e)};return a.body.then(l,l),e.pending.push(a),a}function _pe(e,t){t?.aborted||(e.readers++,t?e.signals.has(t)||(e.signals.add(t),t.addEventListener("abort",()=>{e.signals.delete(t),nze(e,t.reason)},{once:!0,signal:e.dispose.signal})):e.pinned=!0)}function nze(e,t){!e.pinned&&e.signals.size===0&&e.controller.abort(t)}function Rpe(e,t,o,r){let n=qU(e.extents,t,o),i=e.pending.filter(c=>c.start<o&&c.end>t&&!c.controller.signal.aborted),s=[...n,...i,...qU(r,t,o)].sort((c,u)=>c.start-u.start),a=[],l=t;for(let c of s)if(c.start>l&&a.push({start:l,end:c.start}),l=Math.max(l,c.end),l>=o)break;return l<o&&a.push({start:l,end:o}),{extents:n,pending:i,gaps:a}}function ize(e,t){let o=1/0,r=Av(e.extents,t);r<e.extents.length&&(o=Math.max(t,e.extents[r].start));for(let n of e.pending)n.end>t&&!n.controller.signal.aborted&&(o=Math.min(o,Math.max(t,n.start)));return o}function sze(e,t){e.turn===t&&(e.turn=void 0);let o=Date.now(),r=KU(e.key),n=[],i=[],s=[];for(let l of t.readers){let c=r===void 0?l.end:Math.min(l.end,r),u={start:l.start,end:c,extents:[],pending:[]};if(l.start<c&&!l.signal?.aborted){let f=Rpe(e,l.start,c,i);u.extents=f.extents,u.pending=f.pending;for(let p of f.extents)vpe(p,o);for(let p of f.gaps){if(r===void 0&&f.pending.some(d=>d.end===p.start)){u.end=p.start;break}if(p.end-p.start<65536){let d=r===void 0?p.start+65536:Math.min(p.start+65536,r);p.end=Math.max(p.end,Math.min(d,ize(e,p.end)))}n.push({...p,doFetch:l.doFetch}),$4e(i,p)}}s.push({reader:l,plan:u})}let a=aze(n).map(l=>rze(e,l,t.stale));for(let{reader:l,plan:c}of s){if(l.signal?.aborted){l.settle(c);continue}c.pending.push(...qU(a,c.start,c.end));for(let u of c.pending)_pe(u,l.signal);l.settle(c)}JU(e)}function aze(e){e.sort((o,r)=>o.start-r.start);let t=[];for(let o of e){let r=t.at(-1);r!==void 0&&o.start-r.end<=65536?r.end=Math.max(r.end,o.end):t.push({...o})}return t}function lze(e,t,o,r){let{extents:n,pending:i,gaps:s}=Rpe(e,t,o,[]);if(s.length>0)return;let a=Date.now();for(let l of n)vpe(l,a);for(let l of i)_pe(l,r);return{start:t,end:o,extents:n,pending:i}}function cze(e,t){let{turn:o}=e;if(o===void 0){let r={readers:[],stale:!1};e.turn=r,queueMicrotask(()=>{sze(e,r)}),o=r}o.readers.push(t)}function uze({start:e,end:t,extents:o,pending:r},n){let i=t;for(let[c,u]of r.entries()){let f=n[c];f.length<u.end-u.start&&(i=Math.min(i,u.start+f.length))}let s=Math.max(0,i-e);if(o.length===0&&r.length===1){let c=r[0],u=n[0];if(c.owned&&c.readers===1&&c.start===e&&u.length===s&&u.byteOffset===0&&u.buffer.byteLength===s)return u}let a=new Uint8Array(s),l=(c,u)=>{let f=Math.max(e,c),p=Math.min(i,c+u.length);p>f&&a.set(u.subarray(f-c,p-c),f-e)};for(let c of o)l(c.start,c.bytes);for(let[c,u]of r.entries())l(u.start,n[c]);return a}async function mv(e,t,o,r,n){r?.throwIfAborted();let i=KU(e),s=i===void 0?t+o:Math.min(t+o,i);if(t>=s)return new Uint8Array(0);let a=j4e(e),l=lze(a,t,s,r);l===void 0&&(l=await new Promise(d=>{cze(a,{start:t,end:s,signal:r,doFetch:n,settle:d})}),r?.throwIfAborted());let c=[];if(l.pending.length>0)try{c=await fze(Promise.all(l.pending.map(d=>d.body)),r)}finally{r?.throwIfAborted()}let u=uze(l,c);if(l.end===s||u.length<l.end-t)return u;let f=await mv(e,l.end,s-l.end,r,n),p=new Uint8Array(u.length+f.length);return p.set(u),p.set(f,u.length),p}function fze(e,t){if(!t)return e;let o=new AbortController;return Promise.race([e,new Promise((r,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0,signal:o.signal})})]).finally(()=>{o.abort()})}var d_,lm,Yy,dv,V4e,Rp,A_,p_,Wy,XU=A(()=>{pv();d_=new Map,dv=0,V4e=268435456,Rp=new Map,A_=new Map,p_=new Map});function pze(e,t,o,r){if(r?.start===void 0||r.end===void 0)return;let{total:n}=r;if(r.end<r.start||n!==void 0&&r.end>=n)return`${e} answered Content-Range "bytes ${r.start}-${r.end}/${n??"*"}", which does not describe a range of a file that size (the header contradicts itself, so neither the bytes it labels nor the length it reports can be trusted; a caching proxy in front of the file is the usual cause)`;if(r.start!==t)return`${e} answered bytes ${r.start}-${r.end} for a request for bytes starting at ${t} (the response does not describe the range that was asked for, so its bytes would land at the wrong offsets; a caching proxy in front of the file is the usual cause)`;if(n!==void 0&&r.end<Math.min(o,n-1))return`${e} served bytes ${r.start}-${r.end} of a request for bytes ${t}-${o} of a ${n}-byte file (the response stops short of both the end asked for and the end of the file, so the bytes past it would be taken for EOF; a proxy capping how much of a range it will serve is the usual cause)`}function dze(e,t,o,r){return t.expired?t.expired:mpe(e)&&!t.signal.aborted?new Error(`Network error fetching ${r}${gpe(o)}`,{cause:e}):e}var Mp,ZU=A(()=>{VU();ype();XU();pv();Mp=class extends jy{recordSize(t){cm(this.url,t)}async stat(){let t=await Spe(this.url,async()=>(await this.fetchRange(this.url,0,0,this.buildRequest({}))).total);if(t===void 0)throw new Error(`Could not determine size of ${this.url} (the server answered, but no Content-Range carrying the length of the file came back with it: either the header was not readable, which cross-origin needs Access-Control-Expose-Headers: Content-Range to fix, or the server sent the "bytes 0-0/*" form and declined to say how long the file is)`);return{size:t}}async fetchRange(t,o,r,n){let i=await this.fetchWithDeadline(t,n,{start:o,end:r}),s=YU(t);try{return await this.readRange(i,t,o,r)}finally{s()}}async readRange(t,o,r,n){if(t.status===416){let c=jU(t.headers.get("content-range"))?.total;if(f_(t),c!==void 0&&r<c)throw Object.assign(new Error(`HTTP 416 fetching ${o} bytes ${r}-${n}, which starts inside the ${c}-byte file the same response reports (the server refused a range it says exists, so an empty read here would pass for the end of the file; a caching proxy in front of the file is the usual cause)`),{status:416});return{bytes:new Uint8Array(0),total:c}}if(t.status!==206){let c=`HTTP ${t.status} fetching ${o} bytes ${r}-${n}${hpe(t.status)}`;throw f_(t),Object.assign(new Error(c),{status:t.status})}let i=jU(t.headers.get("content-range")),s=pze(o,r,n,i);if(s!==void 0)throw f_(t),new Error(s);let a=i?.start===void 0||i.end===void 0?void 0:i.end-i.start+1,l=await cpe(t,a??n-r+1);if(l===void 0)throw new Error(a===void 0?`${o} sent more than the ${n-r+1} bytes requested for bytes ${r}-${n} with no Content-Range to say what they are (the body cannot be placed, so it is not trusted; a server ignoring the Range header or a caching proxy in front of the file is the usual cause)`:`${o} sent more than the ${a} bytes of the range ${i.start}-${i.end} it declared (the body runs past its own Content-Range, so neither the header nor the bytes can be trusted; a caching proxy in front of the file is the usual cause)`);if(a!==void 0&&l.byteLength!==a)throw new Error(`${o} sent ${l.byteLength} bytes for bytes ${i.start}-${i.end}, which is ${a} bytes (the body is truncated; left alone this is indistinguishable from the file ending here and would be cached as such)`);return{bytes:l,total:i?.total,owned:!0}}async fetchWithDeadline(t,o,r){let n=r&&`bytes ${r.start}-${r.end}`,i=Ape(o?.signal,a=>`No response from ${t}${n?` for ${n}`:""} after ${a}s (the connection was open and the server sent nothing; a transfer already under way is not subject to this limit, so this is a stalled request rather than a slow one)`,t),s={...o,signal:i.signal};if(r){let a=new Headers(o?.headers);a.set("range",`bytes=${r.start}-${r.end}`),s.headers=a}try{return await super.fetch(t,s)}catch(a){throw dze(a,i,t,n?`${t} ${n}`:t)}finally{i.stop()}}cachedRange(t,o,r,n){return mv(t,o,r,n?.signal??void 0,(i,s,a)=>this.fetchRange(t,i,s,{...n,signal:a}))}async fetchBytes(t,o,r){return fv(this.url,t,o),this.cachedRange(this.url,o,t,this.buildRequest(r))}async fetch(t,o){if(typeof t!="string")return super.fetch(t,o);let r=upe(new Headers(o?.headers).get("range"));if(!r)return this.fetchWithDeadline(t,o);let n=r.end-r.start+1;fv(t,n,r.start);let i=await this.cachedRange(t,r.start,n,o);return new Response(i,{status:206})}async readFileBody(...t){let o=YU(this.url);try{return await super.readFileBody(...t)}finally{o()}}}});var Qp,Mpe=A(()=>{ZU();XU();pv();Qp=class e{inner;key;get source(){return this.inner.source}constructor(t,o){if(t instanceof e&&t.key===o||t instanceof Mp&&t.source===o)throw new TypeError(`CachedFilehandle cannot wrap a handle that caches under the same key, ${o}`);this.inner=t,this.key=o}async read(t,o,r={}){return fv(this.key,t,o),t===0?new Uint8Array(0):mv(this.key,o,t,r.signal,async(n,i,s)=>({bytes:await this.inner.read(i-n+1,n,{...r,signal:s})}))}readFile(t){return this.inner.readFile(t)}async stat(){let t=await this.inner.stat();return(t.size>0||t.mtimeMs!==void 0)&&cm(this.key,t.size),t}close(){return this.inner.close()}}});var Qpe=A(()=>{Mpe();ZU()});var Ppe=A(()=>{Qpe()});function Aze(e){return"localPath"in e}function mze(e){return"blobId"in e}function gze(e){return"handleId"in e}function hze(e){return e.baseUri?{...e,uri:new URL(e.uri,e.baseUri).href}:e}function yze(e){if(e.startsWith("/")||/^[a-z]:[\\/]/i.test(e))return e;if(e.startsWith("file:"))try{let{host:t,pathname:o}=new URL(e),r=decodeURIComponent(o);return t&&t!=="localhost"?`//${t}${r}`:/^\/[a-z]:/i.test(r)?r.slice(1):r}catch{return}}function e3(e,t){if(Aze(e)){if(!e.localPath)throw new Error("No local path provided");if(my||ku)return new Qp(new c_(e.localPath),`file://${e.localPath}`);throw new Error("can't use local files in the browser")}if(mze(e)){let o=m1(e.blobId);if(!o)throw new Error(`file ("${e.name}") was opened locally from a previous session. To restore it, go to track settings and reopen the file`);return new Qp(new am(o),`blob://${e.blobId}`)}if(gze(e)){let o=g1(e.handleId);if(!o)throw new Error(`file ("${e.name}") requires permission. Please reopen the file from track settings`);return new Qp(new am(o),`filehandle://${e.handleId}@${o.lastModified}:${o.size}`)}if(Qa(e)){if(!e.uri)throw new Error("No URI provided");let o=hze(e),r=yze(o.uri);if(r!==void 0&&(my||ku))return e3({localPath:r,locationType:"LocalPathLocation"});if(t){let n=bze(o,t);if(n)return n.openLocation(o)}return new Mp(o.uri,{fetch:Cze})}throw new Error("invalid fileLocation")}function bze(e,t){let{rootModel:o}=t;if(o&&NF(o))return o.findAppropriateInternetAccount(e);if(e.internetAccountPreAuthorization){if(!e.internetAccountPreAuthorization.authInfo.token)throw new Error("Failed to obtain token from internet account. Try reloading the page");return t.getInternetAccountType(e.internetAccountPreAuthorization.internetAccountType).stateModel.create({type:e.internetAccountPreAuthorization.internetAccountType,configuration:e.internetAccountPreAuthorization.authInfo.configuration})}}async function Cze(e,t){let o=await fetch(e,t);if(o.status===401&&o.headers.get("WWW-Authenticate")?.includes("Basic"))throw new gy("Accessing HTTPBasic resource without authentication",e.toString());return o}var Dpe=A(()=>{VU();f1();WF();JA();Ppe()});var is=A(()=>{pU();Bfe();Zfe();AU()});function Ope(e,t){let o=(0,qy.useRef)(!1),[r,n]=(0,qy.useState)();return(0,qy.useEffect)(()=>{if(r!==void 0){let c=function(f){o.current||(o.current=!0,requestAnimationFrame(()=>{let p=e==="x"?f.clientX:f.clientY;t(p-a,l),o.current=!1}))},u=function(){n(void 0)};var i=c,s=u;let{client:a,startScroll:l}=r;return document.addEventListener("pointermove",c),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}}},[e,t,r]),{dragging:r!==void 0,startDrag:(i,s)=>{n({client:e==="x"?i.clientX:i.clientY,startScroll:s})}}}var qy,kpe=A(()=>{"use strict";qy=w(D(),1)});function Wu({axis:e,variant:t,getStart:o,onDrag:r,style:n}){let i=Jt(),[s,a]=(0,gv.useState)(!1),{startDrag:l}=Ope(e,r),{fill:c,fillHovered:u,cursor:f,position:p,zIndex:d}=xze[t];return gv.default.createElement("div",{...t==="resizer"&&{role:"separator","aria-orientation":e==="x"?"vertical":"horizontal"},onMouseEnter:()=>{a(!0)},onMouseLeave:()=>{a(!1)},onPointerDown:m=>{l(m,o())},style:{position:p,touchAction:"none",zIndex:d,cursor:f(e),background:s?u(i):c(i),...n}},t==="resizer"?gv.default.createElement("div",{style:{position:"absolute",zIndex:101,...e==="x"?{top:0,bottom:0,left:-m_,right:-m_}:{left:0,right:0,top:-m_,bottom:-m_}}}):null)}var gv,Jy,m_,xze,hv=A(()=>{"use strict";gv=w(D(),1);We();kpe();Jy="rgba(66,119,127,0.3)",m_=4,xze={thumb:{fill:()=>Jy,fillHovered:()=>"rgba(66,119,127,0.6)",cursor:()=>"pointer",position:"absolute",zIndex:100},resizer:{fill:e=>e.palette.mode==="dark"?e.palette.grey[800]:"rgba(200,200,200)",fillHovered:e=>e.palette.mode==="dark"?e.palette.grey[600]:"rgba(150,150,150)",cursor:e=>e==="x"?"ew-resize":"ns-resize",position:"relative"}}});function g_(){return typeof window<"u"}function Dp(e){return o3(e)?(e.nodeName||"").toLowerCase():"#document"}function Rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Sc(e){var t;return(t=(o3(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function o3(e){return g_()?e instanceof Node||e instanceof Rn(e).Node:!1}function oi(e){return g_()?e instanceof Element||e instanceof Rn(e).Element:!1}function Ql(e){return g_()?e instanceof HTMLElement||e instanceof Rn(e).HTMLElement:!1}function yv(e){return!g_()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rn(e).ShadowRoot}function bv(e){let{overflow:t,overflowX:o,overflowY:r,display:n}=La(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+o)&&n!=="inline"&&n!=="contents"}function Upe(e){return/^(table|td|th)$/.test(Dp(e))}function Cv(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}function h_(e){let t=oi(e)?La(e):e;return um(t.transform)||um(t.translate)||um(t.scale)||um(t.rotate)||um(t.perspective)||!xv()&&(um(t.backdropFilter)||um(t.filter))||Eze.test(t.willChange||"")||Tze.test(t.contain||"")}function zpe(e){let t=qu(e);for(;Ql(t)&&!fm(t);){if(h_(t))return t;if(Cv(t))return null;t=qu(t)}return null}function xv(){return t3==null&&(t3=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t3}function fm(e){return/^(html|body|#document)$/.test(Dp(e))}function La(e){return Rn(e).getComputedStyle(e)}function vv(e){return oi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qu(e){if(Dp(e)==="html")return e;let t=e.assignedSlot||e.parentNode||yv(e)&&e.host||Sc(e);return yv(t)?t.host:t}function Hpe(e){let t=qu(e);return fm(t)?(e.ownerDocument||e).body:Ql(t)&&bv(t)?t:Hpe(t)}function Ju(e,t,o){var r;t===void 0&&(t=[]),o===void 0&&(o=!0);let n=Hpe(e),i=n===((r=e.ownerDocument)==null?void 0:r.body),s=Rn(n);if(i){let a=y_(s);return t.concat(s,s.visualViewport||[],bv(n)?n:[],a&&o?Ju(a):[])}else return t.concat(n,Ju(n,[],o))}function y_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Eze,Tze,um,t3,b_=A(()=>{Eze=/transform|translate|scale|rotate|perspective|filter/,Tze=/paint|layout|strict|content/,um=e=>!!e&&e!=="none"});function jpe(e,t,o){return Ku(e,Ky(t,o))}function wv(e,t){return typeof e=="function"?e(t):e}function pm(e){return e.split("-")[0]}function Sv(e){return e.split("-")[1]}function r3(e){return e==="x"?"y":"x"}function n3(e){return e==="y"?"height":"width"}function Xu(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function i3(e){return r3(Xu(e))}function $pe(e,t,o){o===void 0&&(o=!1);let r=Sv(e),n=i3(e),i=n3(n),s=n==="x"?r===(o?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ev(s)),[s,Ev(s)]}function Ype(e){let t=Ev(e);return[C_(e),t,C_(t)]}function C_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}function Bze(e,t,o){switch(e){case"top":case"bottom":return o?t?Vpe:Gpe:t?Gpe:Vpe;case"left":case"right":return t?wze:Sze;default:return[]}}function Wpe(e,t,o,r){let n=Sv(e),i=Bze(pm(e),o==="start",r);return n&&(i=i.map(s=>s+"-"+n),t&&(i=i.concat(i.map(C_)))),i}function Ev(e){let t=pm(e);return Ize[t]+e.slice(t.length)}function _ze(e){var t,o,r,n;return{top:(t=e.top)!=null?t:0,right:(o=e.right)!=null?o:0,bottom:(r=e.bottom)!=null?r:0,left:(n=e.left)!=null?n:0}}function qpe(e){return typeof e!="number"?_ze(e):{top:e,right:e,bottom:e,left:e}}function dm(e){let{x:t,y:o,width:r,height:n}=e;return{width:r,height:n,top:o,left:t,right:t+r,bottom:o+n,x:t,y:o}}var Ky,Ku,Tv,Iv,Bc,Ize,Gpe,Vpe,wze,Sze,x_=A(()=>{Ky=Math.min,Ku=Math.max,Tv=Math.round,Iv=Math.floor,Bc=e=>({x:e,y:e}),Ize={left:"right",right:"left",bottom:"top",top:"bottom"};Gpe=["left","right"],Vpe=["right","left"],wze=["top","bottom"],Sze=["bottom","top"]});function Kpe(e,t){if(!e||!t)return!1;let o=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&yv(o)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Xpe(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Zpe(e,t){let o=["mouse","pen"];return t||o.push("",void 0),o.includes(e)}function v_(e){let t=Bv.useRef(()=>{});return Dze(()=>{t.current=e}),Bv.useCallback(function(){for(var o=arguments.length,r=new Array(o),n=0;n<o;n++)r[n]=arguments[n];return t.current==null?void 0:t.current(...r)},[])}var Bv,Jpe,Rze,Mze,_v,Qze,Pze,Dze,ede=A(()=>{b_();Bv=w(D(),1),Jpe=w(D(),1);Rze=typeof document<"u",Mze=function(){},_v=Rze?Jpe.useLayoutEffect:Mze,Qze={...Bv},Pze=Qze.useInsertionEffect,Dze=Pze||(e=>e())});function tde(e,t,o){let{reference:r,floating:n}=e,i=Xu(t),s=i3(t),a=n3(s),l=pm(t),c=i==="y",u=r.x+r.width/2-n.width/2,f=r.y+r.height/2-n.height/2,p=r[a]/2-n[a]/2,d;switch(l){case"top":d={x:u,y:r.y-n.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-n.width,y:f};break;default:d={x:r.x,y:r.y}}let m=Sv(t);return m&&(d[s]+=p*(m==="end"?1:-1)*(o&&c?-1:1)),d}async function ode(e,t){var o;t===void 0&&(t={});let{x:r,y:n,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=wv(t,e),m=qpe(d),b=a[p?f==="floating"?"reference":"floating":f],h=dm(await i.getClippingRect({element:(o=await(i.isElement==null?void 0:i.isElement(b)))==null||o?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),g=f==="floating"?{x:r,y:n,width:s.floating.width,height:s.floating.height}:s.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(C))&&await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1},E=dm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:C,strategy:l}):g);return{top:(h.top-E.top+m.top)/x.y,bottom:(E.bottom-h.bottom+m.bottom)/x.y,left:(h.left-E.left+m.left)/x.x,right:(E.right-h.right+m.right)/x.x}}async function Nze(e,t){let{placement:o,platform:r,elements:n}=e,i=await(r.isRTL==null?void 0:r.isRTL(n.floating)),s=pm(o),a=Sv(o),l=Xu(o)==="y",c=kze.has(s)?-1:1,u=i&&l?-1:1,f=wv(t,e),{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(d=a==="end"?m*-1:m),l?{x:d*u,y:p*c}:{x:p*c,y:d*u}}var Oze,rde,nde,kze,ide,sde,ade=A(()=>{x_();x_();Oze=50,rde=async(e,t,o)=>{let{placement:r="bottom",strategy:n="absolute",middleware:i=[],platform:s}=o,a=s.detectOverflow?s:{...s,detectOverflow:ode},l=await(s.isRTL==null?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:f}=tde(c,r,l),p=r,d=0,m={};for(let y=0;y<i.length;y++){let b=i[y];if(!b)continue;let{name:h,fn:g}=b,{x:C,y:x,data:E,reset:I}=await g({x:u,y:f,initialPlacement:r,placement:p,strategy:n,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=C??u,f=x??f,m[h]={...m[h],...E},I&&d<Oze&&(d++,typeof I=="object"&&(I.placement&&(p=I.placement),I.rects&&(c=I.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:n}):I.rects),{x:u,y:f}=tde(c,p,l)),y=-1)}return{x:u,y:f,placement:p,strategy:n,middlewareData:m}},nde=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,r;let{placement:n,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...b}=wv(e,t);if((o=i.arrow)!=null&&o.alignmentOffset)return{};let h=pm(n),g=Xu(a),C=pm(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=p||(C||!y?[Ev(a)]:Ype(a)),I=m!=="none";!p&&I&&E.push(...Wpe(a,y,m,x));let T=[a,...E],S=await l.detectOverflow(t,b),B=[],R=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&B.push(S[h]),f){let O=$pe(n,s,x);B.push(S[O[0]],S[O[1]])}if(R=[...R,{placement:n,overflows:B}],!B.every(O=>O<=0)){var M,Q;let O=(((M=i.flip)==null?void 0:M.index)||0)+1,k=T[O];if(k&&(!(f==="alignment"?g!==Xu(k):!1)||R.every(F=>Xu(F.placement)===g?F.overflows[0]>0:!0)))return{data:{index:O,overflows:R},reset:{placement:k}};let N=(Q=R.filter(L=>L.overflows[0]<=0).sort((L,F)=>L.overflows[1]-F.overflows[1])[0])==null?void 0:Q.placement;if(!N)switch(d){case"bestFit":{var v;let L=(v=R.filter(F=>{if(I){let K=Xu(F.placement);return K===g||K==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(K=>K>0).reduce((K,ce)=>K+ce,0)]).sort((F,K)=>F[1]-K[1])[0])==null?void 0:v[0];L&&(N=L);break}case"initialPlacement":N=a;break}if(n!==N)return{reset:{placement:N}}}return{}}}},kze=new Set(["left","top"]);ide=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,r;let{x:n,y:i,placement:s,middlewareData:a}=t,l=await Nze(t,e);return s===((o=a.offset)==null?void 0:o.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:n+l.x,y:i+l.y,data:{...l,placement:s}}}}},sde=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:o,y:r,placement:n,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:g=>{let{x:C,y:x}=g;return{x:C,y:x}}},...c}=wv(e,t),u={x:o,y:r},f=await i.detectOverflow(t,c),p=Xu(n),d=r3(p),m=u[d],y=u[p],b=(g,C)=>jpe(C+f[g==="y"?"top":"left"],C,C-f[g==="y"?"bottom":"right"]);s&&(m=b(d,m)),a&&(y=b(p,y));let h=l.fn({...t,[d]:m,[p]:y});return{...h,data:{x:h.x-o,y:h.y-r,enabled:{[d]:s,[p]:a}}}}}}});function ude(e){let t=La(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,n=Ql(e),i=n?e.offsetWidth:o,s=n?e.offsetHeight:r,a=Tv(o)!==i||Tv(r)!==s;return a&&(o=i,r=s),{width:o,height:r,$:a}}function a3(e){return oi(e)?e:e.contextElement}function Xy(e){let t=a3(e);if(!Ql(t))return Bc(1);let o=t.getBoundingClientRect(),{width:r,height:n,$:i}=ude(t),s=(i?Tv(o.width):o.width)/r,a=(i?Tv(o.height):o.height)/n;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}function fde(e){let t=Rn(e);return!xv()||!t.visualViewport?Lze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fze(e,t,o){return t===void 0&&(t=!1),!!o&&t&&o===Rn(e)}function Am(e,t,o,r){t===void 0&&(t=!1),o===void 0&&(o=!1);let n=e.getBoundingClientRect(),i=a3(e),s=Bc(1);t&&(r?oi(r)&&(s=Xy(r)):s=Xy(e));let a=Fze(i,o,r)?fde(i):Bc(0),l=(n.left+a.x)/s.x,c=(n.top+a.y)/s.y,u=n.width/s.x,f=n.height/s.y;if(i&&r){let p=Rn(i),d=oi(r)?Rn(r):r,m=p,y=y_(m);for(;y&&d!==m;){let b=Xy(y),h=y.getBoundingClientRect(),g=La(y),C=h.left+(y.clientLeft+parseFloat(g.paddingLeft))*b.x,x=h.top+(y.clientTop+parseFloat(g.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=C,c+=x,m=Rn(y),y=y_(m)}}return dm({width:u,height:f,x:l,y:c})}function E_(e,t){let o=vv(e).scrollLeft;return t?t.left+o:Am(Sc(e)).left+o}function pde(e,t){let o=e.getBoundingClientRect(),r=o.left+t.scrollLeft-E_(e,o),n=o.top+t.scrollTop;return{x:r,y:n}}function Uze(e){let{elements:t,rect:o,offsetParent:r,strategy:n}=e,i=n==="fixed",s=Sc(r),a=t?Cv(t.floating):!1;if(r===s||a&&i)return o;let l={scrollLeft:0,scrollTop:0},c=Bc(1),u=Bc(0),f=Ql(r);if((f||!i)&&((Dp(r)!=="body"||bv(s))&&(l=vv(r)),f)){let d=Am(r);c=Xy(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}let p=s&&!f&&!i?pde(s,l):Bc(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:o.y*c.y-l.scrollTop*c.y+u.y+p.y}}function zze(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hze(e){let t=vv(e),o=e.ownerDocument.body,r=Ku(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),n=Ku(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),i=-t.scrollLeft+E_(e),s=-t.scrollTop;return La(o).direction==="rtl"&&(i+=Ku(e.clientWidth,o.clientWidth)-r),{width:r,height:n,x:i,y:s}}function Vze(e,t,o){o===void 0&&(o="viewport");let r=o==="layoutViewport",n=Rn(e),i=Sc(e),s=n.visualViewport,a=i.clientWidth,l=i.clientHeight,c=0,u=0;if(s){let p=!xv()||t==="fixed";r?p||(c=-s.offsetLeft,u=-s.offsetTop):(a=s.width,l=s.height,p&&(c=s.offsetLeft,u=s.offsetTop))}if(E_(i)<=0){let p=i.ownerDocument,d=p.body,m=getComputedStyle(d),y=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(i.clientWidth-d.clientWidth-y),h=getComputedStyle(i).scrollbarGutter==="stable both-edges"?b/2:b;h<=Gze&&(a-=h)}return{width:a,height:l,x:c,y:u}}function jze(e,t){let o=Am(e,!0,t==="fixed"),r=o.top+e.clientTop,n=o.left+e.clientLeft,i=Xy(e),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=n*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function lde(e,t,o){let r;if(t==="viewport"||t==="layoutViewport")r=Vze(e,o,t);else if(t==="document")r=Hze(Sc(e));else if(oi(t))r=jze(t,o);else{let n=fde(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return dm(r)}function $ze(e,t){let o=t.get(e);if(o)return o;let r=Ju(e,[],!1).filter(a=>oi(a)&&Dp(a)!=="body"),n=null,i=La(e).position==="fixed",s=i?qu(e):e;for(;oi(s)&&!fm(s);){let a=La(s),l=h_(s),c=n?n.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(f=>f!==s):n=a,s=qu(s)}return t.set(e,r),r}function Yze(e){let{element:t,boundary:o,rootBoundary:r,strategy:n}=e,s=[...o==="clippingAncestors"?Cv(t)?[]:$ze(t,this._c):[].concat(o),r],a=lde(t,s[0],n),l=a.top,c=a.right,u=a.bottom,f=a.left;for(let p=1;p<s.length;p++){let d=lde(t,s[p],n);l=Ku(d.top,l),c=Ky(d.right,c),u=Ky(d.bottom,u),f=Ku(d.left,f)}return{width:c-f,height:u-l,x:f,y:l}}function Wze(e){let{width:t,height:o}=ude(e);return{width:t,height:o}}function qze(e,t,o){let r=Ql(t),n=Sc(t),i=o==="fixed",s=Am(e,!0,i,t),a={scrollLeft:0,scrollTop:0},l=Bc(0);if((r||!i)&&((Dp(t)!=="body"||bv(n))&&(a=vv(t)),r)){let p=Am(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}!r&&n&&(l.x=E_(n));let c=n&&!r&&!i?pde(n,a):Bc(0),u=s.left+a.scrollLeft-l.x-c.x,f=s.top+a.scrollTop-l.y-c.y;return{x:u,y:f,width:s.width,height:s.height}}function s3(e){return La(e).position==="static"}function cde(e,t){if(!Ql(e)||La(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return Sc(e)===o&&(o=o.ownerDocument.body),o}function dde(e,t){let o=Rn(e);if(Cv(e))return o;if(!Ql(e)){let n=qu(e);for(;n&&!fm(n);){if(oi(n)&&!s3(n))return n;n=qu(n)}return o}let r=cde(e,t);for(;r&&Upe(r)&&s3(r);)r=cde(r,t);return r&&fm(r)&&s3(r)&&!h_(r)?o:r||zpe(e)||o}function Kze(e){return La(e).direction==="rtl"}function Ade(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xze(e,t,o){let r=null,n,i=Sc(e);function s(){var u;clearTimeout(n),(u=r)==null||u.disconnect(),r=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),s();let p=e.getBoundingClientRect(),{left:d,top:m,width:y,height:b}=p;if(u||t(),!y||!b)return;let h=Iv(m),g=Iv(i.clientWidth-(d+y)),C=Iv(i.clientHeight-(m+b)),x=Iv(d),I={rootMargin:-h+"px "+-g+"px "+-C+"px "+-x+"px",threshold:Ku(0,Ky(1,f))||1},T=!0;function S(B){let R=B[0].intersectionRatio;if(!Ade(p,e.getBoundingClientRect()))return a();if(R!==f){if(!T)return a();R?a(!1,R):n=setTimeout(()=>{a(!1,1e-7)},1e3)}T=!1}try{r=new IntersectionObserver(S,{...I,root:i.ownerDocument})}catch{r=new IntersectionObserver(S,I)}r.observe(e)}let l=Rn(e),c=()=>a(o);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),s()}}function T_(e,t,o,r){r===void 0&&(r={});let{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=a3(e),u=n||i?[...c?Ju(c):[],...t?Ju(t):[]]:[];u.forEach(h=>{n&&h.addEventListener("scroll",o),i&&h.addEventListener("resize",o)});let f=c&&a?Xze(c,o,i):null,p=-1,d=null;s&&(d=new ResizeObserver(h=>{let[g]=h;g&&g.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var C;(C=d)==null||C.observe(t)})),o()}),c&&!l&&d.observe(c),t&&d.observe(t));let m,y=l?Am(e):null;l&&b();function b(){let h=Am(e);y&&!Ade(y,h)&&o(),y=h,m=requestAnimationFrame(b)}return o(),()=>{var h;u.forEach(g=>{n&&g.removeEventListener("scroll",o),i&&g.removeEventListener("resize",o)}),f?.(),(h=d)==null||h.disconnect(),d=null,l&&cancelAnimationFrame(m)}}var Lze,Gze,Jze,l3,mde,gde,hde,I_,c3=A(()=>{ade();x_();b_();Lze=Bc(0);Gze=25;Jze=async function(e){let t=this.getOffsetParent||dde,o=this.getDimensions,r=await o(e.floating);return{reference:qze(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};l3={convertOffsetParentRelativeRectToViewportRelativeRect:Uze,getDocumentElement:Sc,getClippingRect:Yze,getOffsetParent:dde,getElementRects:Jze,getClientRects:zze,getDimensions:Wze,getScale:Xy,isElement:oi,isRTL:Kze};mde=ide,gde=sde,hde=nde,I_=(e,t,o)=>{let r=new Map,n=o??{},i={...l3,...n.platform,_c:r};return rde(e,t,{...n,platform:i})}});function S_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let o,r,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(r=o;r--!==0;)if(!S_(e[r],t[r]))return!1;return!0}if(n=Object.keys(e),o=n.length,o!==Object.keys(t).length)return!1;for(r=o;r--!==0;)if(!{}.hasOwnProperty.call(t,n[r]))return!1;for(r=o;r--!==0;){let i=n[r];if(!(i==="_owner"&&e.$$typeof)&&!S_(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function xde(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yde(e,t){let o=xde(e);return Math.round(t*o)/o}function u3(e){let t=Dr.useRef(e);return w_(()=>{t.current=e}),t}function vde(e){e===void 0&&(e={});let{placement:t="bottom",strategy:o="absolute",middleware:r=[],platform:n,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=Dr.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=Dr.useState(r);S_(p,r)||d(r);let[m,y]=Dr.useState(null),[b,h]=Dr.useState(null),g=Dr.useCallback(F=>{F!==I.current&&(I.current=F,y(F))},[]),C=Dr.useCallback(F=>{F!==T.current&&(T.current=F,h(F))},[]),x=i||m,E=s||b,I=Dr.useRef(null),T=Dr.useRef(null),S=Dr.useRef(u),B=l!=null,R=u3(l),M=u3(n),Q=u3(c),v=Dr.useCallback(()=>{if(!I.current||!T.current)return;let F={placement:t,strategy:o,middleware:p};M.current&&(F.platform=M.current),I_(I.current,T.current,F).then(K=>{let ce={...K,isPositioned:Q.current!==!1};O.current&&!S_(S.current,ce)&&(S.current=ce,Cde.flushSync(()=>{f(ce)}))})},[p,t,o,M,Q]);w_(()=>{c===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[c]);let O=Dr.useRef(!1);w_(()=>(O.current=!0,()=>{O.current=!1}),[]),w_(()=>{if(x&&(I.current=x),E&&(T.current=E),x&&E){if(R.current)return R.current(x,E,v);v()}},[x,E,v,R,B]);let k=Dr.useMemo(()=>({reference:I,floating:T,setReference:g,setFloating:C}),[g,C]),N=Dr.useMemo(()=>({reference:x,floating:E}),[x,E]),L=Dr.useMemo(()=>{let F={position:o,left:0,top:0};if(!N.floating)return F;let K=yde(N.floating,u.x),ce=yde(N.floating,u.y);return a?{...F,transform:"translate("+K+"px, "+ce+"px)",...xde(N.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:K,top:ce}},[o,a,N.floating,u.x,u.y]);return Dr.useMemo(()=>({...u,update:v,refs:k,elements:N,floatingStyles:L}),[u,v,k,N,L])}var Dr,bde,Cde,eHe,tHe,w_,B_,f3,p3,d3=A(()=>{c3();c3();Dr=w(D(),1),bde=w(D(),1),Cde=w(NA(),1),eHe=typeof document<"u",tHe=function(){},w_=eHe?bde.useLayoutEffect:tHe;B_=(e,t)=>{let o=mde(e);return{name:o.name,fn:o.fn,options:[e,t]}},f3=(e,t)=>{let o=gde(e);return{name:o.name,fn:o.fn,options:[e,t]}},p3=(e,t)=>{let o=hde(e);return{name:o.name,fn:o.fn,options:[e,t]}}});function fHe(){let[e,t]=lt.useState(()=>Ide?wde():void 0);return _v(()=>{e==null&&t(wde())},[]),lt.useEffect(()=>{Ide=!0},[]),e}function AHe(){let e=new Map;return{emit(t,o){var r;(r=e.get(t))==null||r.forEach(n=>n(o))},on(t,o){e.has(t)||e.set(t,new Set),e.get(t).add(o)},off(t,o){var r;(r=e.get(t))==null||r.delete(o)}}}function bHe(e,t){let o=null,r=null,n=!1;return{contextElement:e||void 0,getBoundingClientRect(){var i;let s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},a=t.axis==="x"||t.axis==="both",l=t.axis==="y"||t.axis==="both",c=["mouseenter","mousemove"].includes(((i=t.dataRef.current.openEvent)==null?void 0:i.type)||"")&&t.pointerType!=="touch",u=s.width,f=s.height,p=s.x,d=s.y;return o==null&&t.x&&a&&(o=s.x-t.x),r==null&&t.y&&l&&(r=s.y-t.y),p-=o||0,d-=r||0,u=0,f=0,!n||c?(u=t.axis==="y"?s.width:0,f=t.axis==="x"?s.height:0,p=a&&t.x!=null?t.x:p,d=l&&t.y!=null?t.y:d):n&&!c&&(f=t.axis==="x"?s.height:f,u=t.axis==="y"?s.width:u),n=!0,{width:u,height:f,x:p,y:d,top:d,right:p+u,bottom:d+f,left:p}}}}function Sde(e){return e!=null&&e.clientX!=null}function _de(e,t){t===void 0&&(t={});let{open:o,dataRef:r,elements:{floating:n,domReference:i},refs:s}=e,{enabled:a=!0,axis:l="both",x:c=null,y:u=null}=t,f=lt.useRef(!1),p=lt.useRef(null),[d,m]=lt.useState(),[y,b]=lt.useState([]),h=v_((I,T)=>{f.current||r.current.openEvent&&!Sde(r.current.openEvent)||s.setPositionReference(bHe(i,{x:I,y:T,axis:l,dataRef:r,pointerType:d}))}),g=v_(I=>{c!=null||u!=null||(o?p.current||b([]):h(I.clientX,I.clientY))}),C=Zpe(d)?n:o,x=lt.useCallback(()=>{if(!C||!a||c!=null||u!=null)return;let I=Rn(n);function T(S){let B=Xpe(S);Kpe(n,B)?(I.removeEventListener("mousemove",T),p.current=null):h(S.clientX,S.clientY)}if(!r.current.openEvent||Sde(r.current.openEvent)){I.addEventListener("mousemove",T);let S=()=>{I.removeEventListener("mousemove",T),p.current=null};return p.current=S,S}s.setPositionReference(i)},[C,a,c,u,n,r,s,i,h]);lt.useEffect(()=>x(),[x,y]),lt.useEffect(()=>{a&&!n&&(f.current=!1)},[a,n]),lt.useEffect(()=>{!a&&o&&(f.current=!0)},[a,o]),_v(()=>{a&&(c!=null||u!=null)&&(f.current=!1,h(c,u))},[a,c,u,h]);let E=lt.useMemo(()=>{function I(T){let{pointerType:S}=T;m(S)}return{onPointerDown:I,onPointerEnter:I,onMouseMove:g,onMouseEnter:g}},[g]);return lt.useMemo(()=>a?{reference:E}:{},[a,E])}function CHe(e){let{open:t=!1,onOpenChange:o,elements:r}=e,n=dHe(),i=lt.useRef({}),[s]=lt.useState(()=>AHe()),a=hHe()!=null,[l,c]=lt.useState(r.reference),u=v_((d,m,y)=>{i.current.openEvent=d?m:void 0,s.emit("openchange",{open:d,event:m,reason:y,nested:a}),o?.(d,m,y)}),f=lt.useMemo(()=>({setPositionReference:c}),[]),p=lt.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return lt.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:p,events:s,floatingId:n,refs:f}),[t,u,p,s,n,f])}function Rde(e){var t,o;let{elements:r,...n}=e===void 0?{}:e,{nodeId:i}=n,s=CHe({...n,elements:{reference:(t=r?.reference)!=null?t:null,floating:(o=r?.floating)!=null?o:null}}),a=n.rootContext||s,l=a.elements,[c,u]=lt.useState(null),[f,p]=lt.useState(null),m=l?.domReference||c,y=lt.useRef(null),b=yHe();_v(()=>{m&&(y.current=m)},[m]);let h=vde({...n,elements:{...l,...f&&{reference:f}}}),g=lt.useCallback(T=>{let S=oi(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;p(S),h.refs.setReference(S)},[h.refs]),C=lt.useCallback(T=>{(oi(T)||T===null)&&(y.current=T,u(T)),(oi(h.refs.reference.current)||h.refs.reference.current===null||T!==null&&!oi(T))&&h.refs.setReference(T)},[h.refs]),x=lt.useMemo(()=>({...h.refs,setReference:C,setPositionReference:g,domReference:y}),[h.refs,C,g]),E=lt.useMemo(()=>({...h.elements,domReference:m}),[h.elements,m]),I=lt.useMemo(()=>({...h,...a,refs:x,elements:E,nodeId:i}),[h,x,E,i,a]);return _v(()=>{a.dataRef.current.floatingContext=I;let T=b?.nodesRef.current.find(S=>S.id===i);T&&(T.context=I)}),lt.useMemo(()=>({...h,context:I,refs:x,elements:E}),[h,x,E,I])}function A3(e,t,o){let r=new Map,n=o==="item",i=e;if(n&&e){let{[Ede]:s,[Tde]:a,...l}=e;i=l}return{...o==="floating"&&{tabIndex:-1,[oHe]:""},...i,...t.map(s=>{let a=s?s[o]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(n&&[Ede,Tde].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),s[c]=function(){for(var p,d=arguments.length,m=new Array(d),y=0;y<d;y++)m[y]=arguments[y];return(p=r.get(c))==null?void 0:p.map(b=>b(...m)).find(b=>b!==void 0)}}}else s[c]=u}),s),{})}}function Mde(e){e===void 0&&(e=[]);let t=e.map(a=>a?.reference),o=e.map(a=>a?.floating),r=e.map(a=>a?.item),n=lt.useCallback(a=>A3(a,e,"reference"),t),i=lt.useCallback(a=>A3(a,e,"floating"),o),s=lt.useCallback(a=>A3(a,e,"item"),r);return lt.useMemo(()=>({getReferenceProps:n,getFloatingProps:i,getItemProps:s}),[n,i,s])}var lt,m3,Bde,oHe,Ede,Tde,rHe,nHe,iHe,sHe,aHe,lHe,C9t,cHe,Ide,uHe,wde,pHe,dHe,mHe,gHe,hHe,yHe,Qde=A(()=>{lt=w(D(),1);ede();m3=w(G(),1);b_();Bde=w(NA(),1);d3();d3();oHe="data-floating-ui-focusable",Ede="active",Tde="selected",rHe="ArrowLeft",nHe="ArrowRight",iHe="ArrowUp",sHe="ArrowDown",aHe=[rHe,nHe],lHe=[iHe,sHe],C9t=[...aHe,...lHe],cHe={...lt},Ide=!1,uHe=0,wde=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+uHe++;pHe=cHe.useId,dHe=pHe||fHe;mHe=lt.createContext(null),gHe=lt.createContext(null),hHe=()=>{var e;return((e=lt.useContext(mHe))==null?void 0:e.id)||null},yHe=()=>lt.useContext(gHe)});var Pde,__,Dde,xHe,vHe,g3,EHe,THe,Op,Rv=A(()=>{Pde=w(G(),1),__=w(D(),1);Qde();Ie();Dde=w(NA(),1);j5();Q0();xHe={pointerEvents:"none",borderRadius:4,fontFamily:"inherit",fontSize:12,padding:"4px 8px",lineHeight:1.4,maxWidth:300,wordWrap:"break-word"},vHe=15;typeof window<"u"&&window.addEventListener("pointermove",e=>{g3={x:e.clientX,y:e.clientY}},{passive:!0,capture:!0});EHe=6,THe=z(function({clientPoint:t,anchor:o,id:r,children:n,placement:i=o?"top":"right"}){let{palette:s,portalContainer:a}=U1(),{refs:l,floatingStyles:c,context:u}=Rde({placement:i,strategy:"fixed",elements:{reference:o},middleware:[B_(o?EHe:vHe),p3(),f3({padding:8})],whileElementsMounted:o?T_:void 0}),[f,p]=(0,__.useState)(g3),d=!o&&t===void 0;(0,__.useEffect)(()=>{if(!d)return;p(g3);let h=g=>{p({x:g.clientX,y:g.clientY})};return window.addEventListener("pointermove",h,{passive:!0,capture:!0}),()=>{window.removeEventListener("pointermove",h,!0)}},[d]);let m=_de(u,{...t??f,enabled:!o}),{getFloatingProps:y}=Mde([m]),b=(typeof a=="function"?a():a)??(typeof document>"u"?void 0:document.body);return b?(0,Dde.createPortal)((0,Pde.jsx)("div",{id:r,ref:l.setFloating,role:"tooltip",style:{...xHe,backgroundColor:$w(Ia[700],.9),color:s.common.white,...c,zIndex:1e5,visibility:c.transform==="translate(0px, 0px)"?"hidden":void 0},...y(),children:n}),b):null}),Op=THe});function P_(e){return e<128?Zy[e]:30}function Ude(e){return e===27||e===28}function gm(e){return mm[e]}function zde(e){return P_(e.charCodeAt(0))}function Hde(e,t=e.reduce((o,r)=>Math.max(o,r.length),0)){let o=new y3(t);for(let r of e)o.addRow(r);return o}var Zy,mm,y3,D_,Mv=A(()=>{"use strict";Zy=new Uint8Array(128).fill(30);for(let e=65;e<=90;e++)Zy[e]=e-65+1;for(let e=97;e<=122;e++)Zy[e]=e-97+1;Zy[45]=27;Zy[46]=28;Zy[42]=29;mm=Array.from({length:32},(e,t)=>t>=1&&t<=26?String.fromCharCode(65+t-1):"");mm[27]="-";mm[28]=".";mm[29]="*";mm[30]="?";y3=class{numColumns;counts;totals;slotTotals=new Uint32Array(32);constructor(t){this.numColumns=t,this.counts=new Uint32Array(t*32),this.totals=new Uint32Array(t)}addRow(t){let{counts:o,totals:r,slotTotals:n,numColumns:i}=this,s=Math.min(t.length,i);for(let a=0;a<s;a++){let l=P_(t.charCodeAt(a));o[a*32+l]++,r[a]++,n[l]++}for(let a=s;a<i;a++)o[a*32+27]++,r[a]++;n[27]+=i-s}add(t,o){let r=P_(o.charCodeAt(0));this.counts[t*32+r]++,this.totals[t]++,this.slotTotals[r]++}total(t){return this.totals[t]??0}count(t,o){return this.counts[t*32+P_(o.charCodeAt(0))]??0}gapCount(t){let o=t*32;return(this.counts[o+27]??0)+(this.counts[o+28]??0)}forEachResidue(t,o){let{counts:r}=this,n=t*32;for(let i=1;i<32;i++){let s=r[n+i];s>0&&!Ude(i)&&o(i,s)}}entropy(t){let o=this.total(t)-this.gapCount(t);if(o===0)return 0;let r=0;return this.forEachResidue(t,(n,i)=>{let s=i/o;r-=s*Math.log2(s)}),r}residueEntries(t){let o=[];return this.forEachResidue(t,(r,n)=>{o.push([mm[r],n])}),o}get lettersPresent(){let t=new Set;for(let o=1;o<32;o++)this.slotTotals[o]>0&&!Ude(o)&&t.add(mm[o]);return t}};D_=32});function Gde(e){return Math.log2(e==="amino"?20:4)}function O_(e,t,o){let r=e.total(t),n=r-e.gapCount(t);if(n===0)return[];let i=Math.max(0,o-e.entropy(t))*(n/r);if(i===0)return[];let s=[];return e.forEachResidue(t,(a,l)=>{s.push({letter:gm(a),bits:l/n*i})}),s.sort((a,l)=>a.bits-l.bits||a.letter.localeCompare(l.letter)),s}var k_=A(()=>{"use strict";Mv()});function _i(e,t,o=!1){e.font=e.font.replace(/(?:bold )?[\d.]+px/,`${o?"bold ":""}${t}px`)}var eb=A(()=>{"use strict"});var Jde,_c,Mn,as,I3,F_,x3,L_,Kde,hm,Pv,v3,Qv,N_,Xde,Zde,Vde,jde,$de,tb,DHe,OHe,kHe,NHe,E3,Yde,LHe,b3,C3,Wde,T3,er,qde,U_,ob=A(()=>{for(Jde={grad:.9,turn:360,rad:360/(2*Math.PI)},_c=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Mn=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=Math.pow(10,t)),Math.round(o*e)/o+0},as=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=1),e>o?o:e>t?e:t},I3=function(e){return(e=isFinite(e)?e%360:0)<0?e+360:e},F_=function(e,t){return t===void 0&&(t=0),Mn(e,t)%360},x3=function(e){return{r:as(e.r,0,255),g:as(e.g,0,255),b:as(e.b,0,255),a:as(e.a)}},L_=function(e){return{r:Mn(e.r),g:Mn(e.g),b:Mn(e.b),a:Mn(e.a,3)}},Kde=/^#([0-9a-f]{3,8})$/i,hm=function(e,t){var o=e.charCodeAt(t);return(15&o)+9*(o>>6)},Pv=function(e,t){return hm(e,t)<<4|hm(e,t+1)},v3=[],Qv=0;Qv<256;Qv++)v3.push((Qv<16?"0":"")+Qv.toString(16));N_=function(e){return v3[as(e,0,255)]},Xde=function(e){var t=e.r,o=e.g,r=e.b,n=e.a,i=Math.max(t,o,r),s=i-Math.min(t,o,r),a=s?i===t?(o-r)/s:i===o?2+(r-t)/s:4+(t-o)/s:0;return{h:60*(a<0?a+6:a),s:i?s/i*100:0,v:i/255*100,a:n}},Zde=function(e){var t=e.h,o=e.s,r=e.v,n=e.a;t=t/360*6,o/=100,r/=100;var i=Math.floor(t),s=r*(1-o),a=r*(1-(t-i)*o),l=r*(1-(1-t+i)*o),c=i%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:n}},Vde=function(e){return{h:I3(e.h),s:as(e.s,0,100),l:as(e.l,0,100),a:as(e.a)}},jde=function(e){return{h:F_(e.h),s:Mn(e.s),l:Mn(e.l),a:Mn(e.a,3)}},$de=function(e){return Zde((o=(t=e).s,{h:t.h,s:(o*=((r=t.l)<50?r:100-r)/100)>0?2*o/(r+o)*100:0,v:r+o,a:t.a}));var t,o,r},tb=function(e){return{h:(t=Xde(e)).h,s:(n=(200-(o=t.s))*(r=t.v)/100)>0&&n<200?o*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,o,r,n},DHe=/^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,OHe=/^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,kHe=/^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,NHe=/^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,E3={string:[[function(e){if(!Kde.test(e))return null;var t=e.length;return t<=5?{r:17*hm(e,1),g:17*hm(e,2),b:17*hm(e,3),a:t===5?Mn(17*hm(e,4)/255,2):1}:t===7||t===9?{r:Pv(e,1),g:Pv(e,3),b:Pv(e,5),a:t===9?Mn(Pv(e,7)/255,2):1}:null},"hex"],[function(e){var t=kHe.exec(e)||NHe.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:x3({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=DHe.exec(e)||OHe.exec(e);if(!t)return null;var o,r,n=Vde({h:(o=t[1],r=t[2],r===void 0&&(r="deg"),Number(o)*(Jde[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return $de(n)},"hsl"]],object:[[function(e){var t=e.r,o=e.g,r=e.b,n=e.a,i=n===void 0?1:n;return _c(t)&&_c(o)&&_c(r)?x3({r:Number(t),g:Number(o),b:Number(r),a:Number(i)}):null},"rgb"],[function(e){var t=e.h,o=e.s,r=e.l,n=e.a,i=n===void 0?1:n;if(!_c(t)||!_c(o)||!_c(r))return null;var s=Vde({h:Number(t),s:Number(o),l:Number(r),a:Number(i)});return $de(s)},"hsl"],[function(e){var t=e.h,o=e.s,r=e.v,n=e.a,i=n===void 0?1:n;if(!_c(t)||!_c(o)||!_c(r))return null;var s=(function(a){return{h:I3(a.h),s:as(a.s,0,100),v:as(a.v,0,100),a:as(a.a)}})({h:Number(t),s:Number(o),v:Number(r),a:Number(i)});return Zde(s)},"hsv"]]},Yde=function(e,t){for(var o=0;o<t.length;o++){var r=t[o][0](e);if(r)return[r,t[o][1]]}return[null,void 0]},LHe=function(e){return typeof e=="string"?Yde(e.trim(),E3.string):typeof e=="object"&&e!==null?Yde(e,E3.object):[null,void 0]},b3=function(e,t){var o=tb(e);return{h:o.h,s:as(o.s+100*t,0,100),l:o.l,a:o.a}},C3=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Wde=function(e,t){var o=tb(e);return{h:o.h,s:o.s,l:as(o.l+100*t,0,100),a:o.a}},T3=(function(){function e(t){this.parsed=LHe(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Mn(C3(this.rgba),2)},e.prototype.isDark=function(){return C3(this.rgba)<.5},e.prototype.isLight=function(){return C3(this.rgba)>=.5},e.prototype.toHex=function(){return t=L_(this.rgba),o=t.r,r=t.g,n=t.b,s=(i=t.a)<1?N_(Mn(255*i)):"","#"+N_(o)+N_(r)+N_(n)+s;var t,o,r,n,i,s},e.prototype.toRgb=function(){return L_(this.rgba)},e.prototype.toRgbString=function(){return t=L_(this.rgba),o=t.r,r=t.g,n=t.b,(i=t.a)<1?"rgba("+o+", "+r+", "+n+", "+i+")":"rgb("+o+", "+r+", "+n+")";var t,o,r,n,i},e.prototype.toHsl=function(){return jde(tb(this.rgba))},e.prototype.toHslString=function(){return t=jde(tb(this.rgba)),o=t.h,r=t.s,n=t.l,(i=t.a)<1?"hsla("+o+", "+r+"%, "+n+"%, "+i+")":"hsl("+o+", "+r+"%, "+n+"%)";var t,o,r,n,i},e.prototype.toHsv=function(){return t=Xde(this.rgba),{h:F_(t.h),s:Mn(t.s),v:Mn(t.v),a:Mn(t.a,3)};var t},e.prototype.invert=function(){return er({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),er(b3(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),er(b3(this.rgba,-t))},e.prototype.grayscale=function(){return er(b3(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),er(Wde(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),er(Wde(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(tb(this.rgba).h+t)},e.prototype.alpha=function(t){return typeof t=="number"?er({r:(o=this.rgba).r,g:o.g,b:o.b,a:t}):Mn(this.rgba.a,3);var o},e.prototype.hue=function(t){var o=tb(this.rgba);return typeof t=="number"?er({h:t,s:o.s,l:o.l,a:o.a}):F_(o.h)},e.prototype.isEqual=function(t){return this.toHex()===er(t).toHex()},e})(),er=function(e){return e instanceof T3?e:new T3(e)},qde=[],U_=function(e){e.forEach(function(t){qde.indexOf(t)<0&&(t(T3,E3),qde.push(t))})}});var w3,S3,eAe,tAe=A(()=>{w3=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},S3=function(e){return .2126*w3(e.r)+.7152*w3(e.g)+.0722*w3(e.b)},eAe=function(e){e.prototype.luminance=function(){return t=S3(this.rgba),(o=2)===void 0&&(o=0),r===void 0&&(r=Math.pow(10,o)),Math.round(r*t)/r+0;var t,o,r},e.prototype.contrast=function(t){t===void 0&&(t="#FFF");var o,r,n,i,s,a,l,c=t instanceof e?t:new e(t);return i=this.rgba,s=c.toRgb(),a=S3(i),l=S3(s),o=a>l?(a+.05)/(l+.05):(l+.05)/(a+.05),(r=2)===void 0&&(r=0),n===void 0&&(n=Math.pow(10,r)),Math.floor(n*o)/n+0},e.prototype.isReadable=function(t,o){return t===void 0&&(t="#FFF"),o===void 0&&(o={}),this.contrast(t)>=(a=(s=(r=o).size)===void 0?"normal":s,(i=(n=r.level)===void 0?"AA":n)==="AAA"&&a==="normal"?7:i==="AA"&&a==="large"?3:4.5);var r,n,i,s,a}}});var oAe,rAe=A(()=>{oAe=function(e,t){var o={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var n in o)r[o[n]]=n;var i={};e.prototype.toName=function(s){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(s?.closest){var u=this.toRgb(),f=1/0,p="black";if(!i.length)for(var d in o)i[d]=new e(o[d]).toRgb();for(var m in o){var y=(a=u,l=i[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<f&&(f=y,p=m)}return p}},t.string.push([function(s){var a=s.toLowerCase(),l=a==="transparent"?"#0000":o[a];return l?new e(l).toRgb():null},"name"])}});function sAe(e,t){let o=`${e}|${t}`,r=nAe.get(o);if(r!==void 0)return r;let n=er(e);if(!n.isReadable(t)){let s=er(t).luminance()<.5;for(let a=0;a<40&&!n.isReadable(t);a++)n=s?n.lighten(.05):n.darken(.05)}let i=n.toHex();return nAe.set(o,i),i}function z_(e,t){let o=er(e);return o.alpha()===1?o.alpha(t).toRgbString():e}function H_(e){return er(e).darken(.1).toHex()}function G_(e,t){return Object.fromEntries(Object.entries(e).map(t))}function Np(e){let t=iAe.get(e);t||(t=new Map,iAe.set(e,t));let o=e.palette.text.primary;return r=>{if(!r)return o;let n=t.get(r);if(n!==void 0)return n;let i=e.palette.getContrastText(er(r).toHex());return t.set(r,i),i}}function aAe(e,t){if(e.length===0)return t;let o=new Set(e);return t.filter((r,n)=>!o.has(n))}function V_(e,t){if(e.length===0)return t;let o=[],r=0;for(let n of e)n>r&&o.push(t.slice(r,n)),r=n+1;return r<t.length&&o.push(t.slice(r)),o.join("")}function lAe(e,t){let o=[],r=e.length,n=0,i=0,s=-1,a=[];for(let l=0;l<t.length;l++)i<r&&e[i]===l?(t.charCodeAt(l)-45>>>0<=1||(s===n?a.push(t[l]):(a.length>0&&o.push({pos:s,letters:a.join("")}),s=n,a=[t[l]])),i++):n++;return a.length>0&&o.push({pos:s,letters:a.join("")}),o}function B3(e){return e.end-e.start}function j_(...e){}var nAe,iAe,Rc=A(()=>{"use strict";ob();tAe();rAe();U_([oAe,eAe]);nAe=new Map;iAe=new WeakMap});function rb(e){let{dynamicColorSchemeName:t}=e;if(t==="clustalx_protein_dynamic"){let{colClustalX:r}=e;return(n,i)=>r[n][i]}if(t==="blosum62_dynamic"){let{colSimilarity:r}=e;return(n,i)=>r[n][i]}if(t==="percent_identity_dynamic"){let{colConsensus:r}=e;return(n,i)=>{let s=r[n];return i===s.letter?s.color:void 0}}let{colorScheme:o}=e;return(r,n)=>o[n]}function cAe(e){let{dynamicColorSchemeName:t}=e;return t==="clustalx_protein_dynamic"?e.colClustalX:t==="blosum62_dynamic"?e.colSimilarity:t==="percent_identity_dynamic"?e.colConsensus:e.colorScheme}var $_=A(()=>{"use strict"});function Fa({offsetX:e,blockWidth:t,colWidth:o}){return{xStart:Math.max(0,Math.floor(e/o)),xEnd:Math.max(0,Math.ceil((e+t)/o))}}var Dv=A(()=>{"use strict"});function FHe({ctx:e,values:t,color:o,colWidth:r,trackHeight:n,offsetX:i,blockSize:s}){let{xStart:a,xEnd:l}=Fa({offsetX:i,blockWidth:s,colWidth:r});e.fillStyle=o;for(let c=a;c<l&&c<t.length;c++){let f=t[c]*n,p=c*r;e.fillRect(p,n-f,r,f)}}function _3(e,t){let o=e.columnTrackContent.get(t)?.values;return o||(t==="property-conservation"?e.propertyConservation:e.conservation)}function UHe({ctx:e,arcs:t,color:o,colWidth:r,trackHeight:n,offsetX:i,blockSize:s}){if(!t?.length)return;let{xStart:a,xEnd:l}=Fa({offsetX:i,blockWidth:s,colWidth:r}),c=1;for(let f of t)c=Math.max(c,f.end-f.start);let u=n-1;e.lineWidth=1;for(let f of t){if(f.end<a||f.start>l)continue;let p=(f.start+.5)*r,d=(f.end+.5)*r,m=u*Math.sqrt((f.end-f.start)/c);e.strokeStyle=f.color??o,e.beginPath(),e.moveTo(p,n),e.quadraticCurveTo((p+d)/2,n-2*m,d,n),e.stroke()}}function zHe({ctx:e,data:t,colorAt:o,contrastText:r,bgColor:n,drawLetters:i,colWidth:s,rowHeight:a,offsetX:l,blockSize:c}){let{xStart:u,xEnd:f}=Fa({offsetX:l,blockWidth:c,colWidth:s}),p=t?.slice(u,f);for(let d=0;p&&d<p.length;d++){let m=p[d],y=u+d,b=n?o(y,m):void 0,h=y*s;b&&(e.fillStyle=b,e.fillRect(h,0,s,a)),i&&(e.fillStyle=r(b),e.fillText(m,h+s/2,a/2))}}function HHe(e,t=55){let o=1,r=[1,2,5];for(let n=0;o*e<t;n++)o=r[n%3]*10**Math.floor(n/3);return o}function GHe(e,t,o){let r=HHe(o),n=r>1&&e<=0&&t>0?[0]:[],i=Math.max(1,Math.ceil((e+1)/r))*r;for(let s=i;s<=t;s+=r)n.push(s-1);return n}function jHe({ctx:e,numColumns:t,label:o,textColor:r,colWidth:n,trackHeight:i,offsetX:s,blockSize:a}){let{xStart:l,xEnd:c}=Fa({offsetX:s,blockWidth:a,colWidth:n}),u=Math.min(c,t);_i(e,VHe),e.textAlign="center",e.textBaseline="alphabetic",e.fillStyle=r,e.strokeStyle=r,e.lineWidth=1;for(let f of GHe(l,u,n)){let p=o(f);if(p===void 0)continue;let d=(f+.5)*n;e.fillText(p,d,i-uAe-2),e.beginPath(),e.moveTo(d,i-uAe),e.lineTo(d,i),e.stroke()}}function WHe({ctx:e,colStats:t,colorScheme:o,maxBits:r,textColor:n,colWidth:i,trackHeight:s,offsetX:a,blockSize:l}){let{xStart:c,xEnd:u}=Fa({offsetX:a,blockWidth:l,colWidth:i}),f=Math.min(u,t.numColumns),p=s;_i(e,p),e.textAlign="left",e.textBaseline="alphabetic";let d=p*$He;for(let m=c;m<f;m++){let y=O_(t,m,r);if(y.length===0)continue;let b=m*i,h=s;for(let{letter:g,bits:C}of y){let x=C/r*s;if(x<YHe){h-=x;continue}let E=e.measureText(g).width;if(E===0){h-=x;continue}e.fillStyle=o[g]??n,e.save(),e.translate(b,h),e.scale(i/E,x/d),e.fillText(g,0,0),e.restore(),h-=x}}}function R3({model:e,ctx:t,track:o,offsetX:r,offsetY:n=0,theme:i,blockSizeXOverride:s,highResScaleFactorOverride:a}){let{blockSize:l,colWidth:c,highResScaleFactor:u}=e,{id:f,kind:p,height:d,barColor:m,arcColor:y,arcs:b,customColorScheme:h,data:g}=o.model,C=s??l,x=a??u,E=i.palette.text.primary;switch(t.resetTransform(),t.scale(x,x),t.translate(-r,n),p){case"bar":{FHe({ctx:t,values:_3(e,f),color:m??"gray",colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"arc":{UHe({ctx:t,arcs:b,color:y??i.palette.text.primary,colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"logo":{WHe({ctx:t,colStats:e.colStats,colorScheme:e.colorScheme,maxBits:e.alphabetMaxBits,textColor:E,colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"ruler":{let{relativeTo:I,numColumns:T}=e;jHe({ctx:t,numColumns:T,label:I?S=>{let B=e.visibleColToSeqPosOneBased(I,S);return B===void 0?void 0:`${B}`}:S=>`${S+1}`,textColor:E,colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"text":case"reference":{let{bgColor:I,fontSize:T,rowHeight:S,showMsaLetters:B}=e,R=h??e.colorScheme;t.textAlign="center",t.textBaseline="middle",_i(t,T),zHe({ctx:t,data:g,colorAt:p==="reference"?rb(e):(M,Q)=>R[Q.toUpperCase()],contrastText:Np(i),bgColor:I,drawLetters:B,colWidth:c,rowHeight:S,offsetX:r,blockSize:C});break}}t.resetTransform()}function fAe({model:e,ctx:t,offsetX:o,theme:r,blockSizeXOverride:n,highResScaleFactorOverride:i}){let s=0;for(let a of e.turnedOnTracks)R3({model:e,ctx:t,track:a,offsetX:o,offsetY:s,theme:r,blockSizeXOverride:n,highResScaleFactorOverride:i}),s+=a.model.height}var VHe,uAe,$He,YHe,Y_=A(()=>{"use strict";k_();eb();Rc();$_();Dv();VHe=10,uAe=4;$He=.72,YHe=3});function kv(e){let t=navigator.clipboard;if(t?.writeText){t.writeText(e).catch(r=>{console.error("Failed to copy to clipboard:",r)});return}let o=document.createElement("textarea");o.value=e,o.style.position="fixed",o.style.opacity="0",document.body.append(o),o.select(),document.execCommand("copy"),o.remove()}var P3=A(()=>{"use strict"});function Nv({text:e,label:t="Copy to clipboard"}){let[o,r]=(0,Fp.useState)(!1),n=(0,Fp.useRef)(void 0);return(0,Fp.useEffect)(()=>()=>{clearTimeout(n.current)},[]),Fp.default.createElement(tt,{variant:"contained",color:"primary",onClick:()=>{kv(typeof e=="string"?e:e()),r(!0),clearTimeout(n.current),n.current=setTimeout(()=>{r(!1)},500)}},o?"Copied!":t)}var Fp,D3=A(()=>{"use strict";Fp=w(D(),1);We();P3()});var hAe={};Hn(hAe,{default:()=>nGe});var Mc,oGe,rGe,nGe,yAe=A(()=>{"use strict";Mc=w(D(),1);is();ln();We();Ie();D3();oGe=$t()(e=>({textArea:{padding:e.spacing(2),overflow:"auto",background:e.palette.action.selected,wordBreak:"break-word"}})),rGe=z(function({model:e,onClose:t}){let{name:o,data:r}=e,{classes:n}=oGe();return Mc.default.createElement(cr,{open:!0,onClose:t,fullWidth:!0,maxWidth:"lg",title:`Track info - ${o}`},Mc.default.createElement(Jo,null,r===void 0?Mc.default.createElement(ve,null,"This track has no text data."):Mc.default.createElement(Mc.default.Fragment,null,Mc.default.createElement(Nv,{text:r}),Mc.default.createElement("pre",{className:n.textArea},r))),Mc.default.createElement(es,null,Mc.default.createElement(tt,{variant:"contained",onClick:t,color:"secondary"},"Close")))}),nGe=rGe});var ib,dGe,IAe,wAe=A(()=>{"use strict";ib=w(D(),1);We();Ie();dGe=z(function({model:t}){let[o,r]=(0,ib.useState)(),n=o??t.allowedGappyness;return ib.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8}},ib.default.createElement(ve,{style:{whiteSpace:"nowrap"}},"\u2265",n,"% gaps"),ib.default.createElement(KB,{"data-testid":"gappyness_slider",style:{width:200,marginInline:10},min:1,max:100,value:n,onChange:(i,s)=>{r(s)},onChangeCommitted:(i,s)=>{t.setAllowedGappyness(s),r(void 0)}}))}),IAe=dGe});var k3={};Hn(k3,{default:()=>mGe});var ym,AGe,mGe,N3=A(()=>{"use strict";ym=w(D(),1);is();We();Ie();wAe();AGe=z(function({model:e,onClose:t}){return ym.default.createElement(cr,{open:!0,onClose:t,title:"Hide gappy columns"},ym.default.createElement(Jo,null,ym.default.createElement(ve,{variant:"body2",sx:{mb:2}},"The viewer hides each column where at least this share of the rows has a gap."),ym.default.createElement(IAe,{model:e})),ym.default.createElement(es,null,ym.default.createElement(tt,{variant:"contained",onClick:t},"Close")))}),mGe=AGe});function NAe(e){return!!e&&/(^|[_ ])site$/i.test(e)}function z3(e){return Math.min(Math.max(6,e-3),18)}var L3,F3,LAe,FAe,UAe,zAe,HAe,GAe,U3,VAe,jAe,$Ae,K_,X_,Z_,bm,eR,YAe,tR,WAe,qAe,JAe,oR,KAe,XAe,ZAe,eme,rR,tme,ome,rme,nme,ime,sme,sb,ame,lme,cme,nR,iR,Zu,ume,H3,fme,Or=A(()=>{"use strict";L3=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR","intron"]),F3=["#9fb6d4","#d4dcea"];LAe=["#b3cde3","#fed9a6","#ccebc5","#decbe4","#fbb4ae","#e5d8bd","#fddaec"],FAe=["#178867","#c05402","#7570b3","#518318","#906719"],UAe=!0,zAe=!1,HAe=["both","horizontal","vertical"],GAe="both",U3=8,VAe=5,jAe=2e3,$Ae=9;K_=z3(16),X_=.2,Z_=.2,bm=80,eR=280,YAe=!0,tR="maeditor",WAe=!0,qAe=!0,JAe=!1,oR=70,KAe=160,XAe=10,ZAe=.3,eme=!0,rR=["branchLength","input","ladderize","ladderizeReverse"],tme="branchLength",ome=!0,rme=!0,nme=!1,ime=!1,sme=120,sb=500,ame=.25,lme="#fff3c4",cme=.6,nR=5e4,iR=56,Zu=22,ume=200,H3=1e3,fme=H3+1});function G3(e){let t=new Set(e.collapsed);return e.leaves.filter(({data:{id:o,name:r}})=>!(t.has(o)&&r===o)).map(o=>o.data.name)}function dme(e,t,o=50){let r=t.toLowerCase();return e.filter(n=>n.toLowerCase().includes(r)).slice(0,o)}function bGe(e,t){let o=t.trim(),r=e.rowNamesSet.get(o);if(r!==void 0)return{row:r};let n=/^(.+):(\d+)$/.exec(o);if(n){let[,i="",s]=n,a=e.rowNamesSet.get(i),l=a===void 0?void 0:pme(e,i,+s);return l===void 0?void 0:{row:a,col:l}}if(/^\d+$/.test(o)){let i=+o,{relativeTo:s,numColumns:a}=e,l=s?pme(e,s,i):i>=1&&i<=a?i-1:void 0;return l===void 0?void 0:{col:l}}}function pme(e,t,o){let r=e.seqPosIndex(t)?.[o-1];return r===void 0?void 0:e.globalColToVisibleCol(r)}function Ame(e,t){let o=bGe(e,t);if(o){let{row:r,col:n}=o,{rowHeight:i,colWidth:s,msaAreaHeight:a,msaAreaWidth:l}=e;r!==void 0&&e.setScrollY(-(r+.5)*i+a/2),n!==void 0&&e.setScrollX(-(n+.5)*s+l/2),e.setMousePos(n,r)}return o!==void 0}var mme=A(()=>{"use strict"});function CGe(e){let{slotProps:t,inputProps:o}=e;return t?{slotProps:{...t,htmlInput:{...t.htmlInput,"aria-label":gme}}}:{inputProps:{...o,"aria-label":gme}}}function xGe(e){e&&requestAnimationFrame(()=>{e.focus()})}function hme(e){return G3(e).length>1||e.numColumns>0}var zv,gme,vGe,yme,V3=A(()=>{"use strict";zv=w(D(),1);We();Ie();mme();gme="Go to row or column";vGe=z(function({model:e,onFound:t}){let[o,r]=(0,zv.useState)(!1);return zv.default.createElement(FS,{freeSolo:!0,options:G3(e),filterOptions:(n,{inputValue:i})=>dme(n,i),value:null,blurOnSelect:!0,onInputChange:()=>{r(!1)},onChange:(n,i)=>{if(i){let s=Ame(e,i);r(!s),s&&t?.()}},renderInput:n=>zv.default.createElement(an,{...n,inputRef:xGe,error:o,placeholder:"Row name or column number",helperText:o?"No row or column matches":"Or name:N for residue N of that row",...CGe(n)})})}),yme=vGe});var xme={};Hn(xme,{default:()=>_Ge});function IGe(e,t){return[e.accession,e.name,e.description].some(o=>o?.toLowerCase().includes(t))}var Yt,wGe,SGe,BGe,_Ge,vme=A(()=>{"use strict";Yt=w(D(),1);is();We();Ie();wGe=z(function({model:e,accessions:t}){let o=r=>{for(let n of t)e.setFilter(n,r)};return Yt.default.createElement("div",null,Yt.default.createElement(tt,{onClick:()=>{o(!0)}},"Toggle all on"),Yt.default.createElement(tt,{onClick:()=>{o(!1)}},"Toggle all off"))}),SGe=z(function({model:e}){let{annotationTypes:t,annotations:o,featureColors:r,fillPalette:n}=e,[i,s]=(0,Yt.useState)(""),a=i.trim().toLowerCase(),l=[...t.values()].filter(f=>!a||IGe(f,a)),c=new Map,u=new Map;for(let f of o){let{accession:p}=f;c.set(p,(c.get(p)??0)+1),u.has(p)||u.set(p,r.get(f)?.fill??n[p])}return Yt.default.createElement(Yt.default.Fragment,null,Yt.default.createElement(an,{label:"Filter",size:"small",value:i,onChange:f=>{s(f.target.value)}}),Yt.default.createElement(wGe,{model:e,accessions:l.map(f=>f.accession)}),Yt.default.createElement(fy,{size:"small"},Yt.default.createElement(r1,null,Yt.default.createElement(VA,null,Yt.default.createElement(sn,{padding:"checkbox"}),Yt.default.createElement(sn,null,"color"),Yt.default.createElement(sn,null,"accession"),Yt.default.createElement(sn,null,"name"),Yt.default.createElement(sn,null,"count"),Yt.default.createElement(sn,null,"description"))),Yt.default.createElement(py,null,l.map(({accession:f,name:p,description:d})=>Yt.default.createElement(VA,{key:f},Yt.default.createElement(sn,{padding:"checkbox"},Yt.default.createElement(Ra,{checked:!e.featureOff(f),onChange:()=>{e.setFilter(f,e.featureOff(f))}})),Yt.default.createElement(sn,null,Yt.default.createElement("div",{style:{width:20,height:20,background:u.get(f)}})),Yt.default.createElement(sn,null,f),Yt.default.createElement(sn,null,p),Yt.default.createElement(sn,null,c.get(f)),Yt.default.createElement(sn,null,d))))))}),BGe=z(function({onClose:e,model:t}){return Yt.default.createElement(cr,{onClose:()=>{e()},open:!0,title:"Feature filters",maxWidth:"xl"},Yt.default.createElement(Jo,null,Yt.default.createElement(SGe,{model:t})))}),_Ge=BGe});function zp(e,t="node",o=0){let r=(s,a)=>({...s,id:a,name:s.name||a,children:[]}),n=r(e,`${t}-${o}`),i=[{src:e,out:n,depth:o}];for(;i.length>0;){let{src:s,out:a,depth:l}=i.pop();if(s.children){a.children=s.children.map((c,u)=>r(c,`${a.id}-${u}-${l+1}`));for(let[c,u]of s.children.entries())i.push({src:u,out:a.children[c],depth:l+1})}}return n}var Y3=A(()=>{"use strict"});var $s,ab=A(()=>{"use strict";$s=class{rows=new Map;names;width;constructor(t){for(let[o,r]of t)this.rows.has(o)||this.rows.set(o,r);this.names=[...this.rows.keys()]}getRow(t){return this.rows.get(t)??""}getNames(){return this.names}getWidth(){return this.width??=this.getNames().reduce((t,o)=>Math.max(t,this.getRow(o).length),0),this.width}getTree(){return{id:"root",name:"root",noTree:!0,children:this.getNames().map(t=>({id:t,children:[],name:t}))}}getRowData(t){}getStructures(){return{}}getHeader(){return{}}get alignmentNames(){return[]}get seqConsensus(){}get secondaryStructureConsensus(){}get tracks(){return[]}get annotations(){return[]}}});function aR(e){return/^(#.*\n)*>/.test(e)}function W3(e){let t=[],o=new Set,r,n=()=>{r&&!o.has(r.id)&&(o.add(r.id),t.push({id:r.id,seq:r.lines.join("").replaceAll(/\s/g,"")}))},i=0;for(let s of e.split(`
614
+ `);return(0,lv.jsx)(q1,{open:!0,onClose:()=>{o()},maxWidth:"xl",title:"Stack trace",actions:(0,lv.jsx)(Fle,{variant:"contained",color:"secondary",value:b,copiedLabel:"Copied!",children:"Copy stack trace to clipboard"}),children:l?(0,lv.jsx)(nv,{variant:"h6"}):(0,lv.jsx)($le,{text:b,extra:r})})}),k3e=O3e});var xc,Uy,N3e,L3e,Iue,wue=A(()=>{xc=w(G(),1),Uy=w(D(),1);xle();We();Ie();N3e=(0,Uy.lazy)(()=>Promise.resolve().then(()=>(Tue(),Eue))),L3e=z(function({error:t,color:o}){let[r,n]=(0,Uy.useState)(!1);return(0,xc.jsxs)(xc.Fragment,{children:[(0,xc.jsx)(Xt,{title:"Show stack trace",children:(0,xc.jsx)(jt,{color:o,onClick:()=>{n(!0)},children:(0,xc.jsx)(Cle,{})})}),r?(0,xc.jsx)(Uy.Suspense,{fallback:null,children:(0,xc.jsx)(N3e,{error:t,onClose:()=>{n(!1)}})}):null]})}),Iue=L3e});var $u,F3e,Sue,Bue=A(()=>{$u=w(G(),1);W5();We();Ie();wue();F3e=z(function({error:t,onRetry:o,extraAction:r,color:n}){return(0,$u.jsxs)($u.Fragment,{children:[r,(0,$u.jsx)(Iue,{error:t,color:n}),o?(0,$u.jsx)(Xt,{title:"Retry",children:(0,$u.jsx)(jt,{"data-testid":"reload_button",onClick:()=>{o()},color:n,children:(0,$u.jsx)(z1,{})})}):null]})}),Sue=F3e});var _ue,U3e,z3e,cv,SU=A(()=>{_ue=w(G(),1);Ie();ln();U3e=$t()(e=>({bg:{padding:4,margin:4,overflow:"auto",background:e.palette.mode==="dark"?"#833":"#f88",border:`1px solid ${e.palette.divider}`}})),z3e=z(function({children:t}){let{classes:o}=U3e();return(0,_ue.jsx)("div",{className:o.bg,"data-testid":"error-message-box",children:t})}),cv=z3e});function H3e(e){try{return JSON.parse(e)}catch{return e}}function Rue(e){let t,o="",r=/(?:at path "([^"]*)" )?snapshot `([^`]*)` is not assignable/.exec(e);return r&&(t=H3e(r[2]),o=r[1]?`Snapshot at path "${r[1]}":`:"Snapshot:"),{snapshotValue:t,message:o}}var Mue=A(()=>{});var vc,G3e,V3e,Rce,Mce=A(()=>{vc=w(G(),1);Ie();ln();Bue();SU();Mue();G3e=$t()(e=>({bg:{background:e.palette.divider,border:`1px solid ${e.palette.text.primary}`,margin:20},message:{background:e.palette.action.hover,border:`1px solid ${e.palette.divider}`,padding:"12px 16px",margin:"16px 20px",fontFamily:"monospace",fontSize:"0.9rem"},iconFloat:{float:"right",marginLeft:100}})),V3e=z(function({error:t,onReset:o,extraAction:r}){let{classes:n}=G3e(),i=`${t}`,s=i.indexOf("expected an instance of"),a=s===-1?i:i.slice(0,s),{snapshotValue:l,message:c}=Rue(i);return(0,vc.jsxs)(cv,{children:[a.slice(0,1e4),(0,vc.jsx)("div",{className:n.iconFloat,children:(0,vc.jsx)(Sue,{error:t,onRetry:o,extraAction:r,color:"primary"})}),l!==void 0?(0,vc.jsxs)(vc.Fragment,{children:[(0,vc.jsx)("div",{className:n.message,children:c}),(0,vc.jsx)("pre",{className:n.bg,children:JSON.stringify(l,null,2)})]}):null]})}),Rce=V3e});var Que,Pue,Due=A(()=>{"use client";bo();Que=w(G(),1),Pue=xe((0,Que.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}),"Help")});function r_(){let e=(0,Oue.useRef)(null);return{action:e,autoFocus:!1,disableAutoFocus:!0,onEntering:t=>{e.current?.updatePosition(),t.querySelector(j3e)?.focus({preventScroll:!0})}}}var Oue,j3e,BU=A(()=>{Oue=w(D(),1),j3e='[role^="menuitem"]:not(.Mui-disabled)'});var kue,$3e,Nue,Lue=A(()=>{kue=w(G(),1);We();Ie();BU();$3e=z(function({anchorEl:t,onClose:o,onMouseEnter:r,paperRef:n,anchorOrigin:i,transformOrigin:s,zIndex:a,children:l}){let{onEntering:c,...u}=r_();return(0,kue.jsx)(os,{...u,open:!0,anchorEl:t,onClose:o,anchorOrigin:i,transformOrigin:s,style:{pointerEvents:"none",zIndex:a},hideBackdrop:!0,slotProps:{paper:{style:{pointerEvents:"auto"},onMouseEnter:r,ref:n},transition:{onEntering:c}},onKeyDown:f=>{f.stopPropagation()},children:l})}),Nue=$3e});var Fue,_U,Uue=A(()=>{"use client";bo();Fue=w(G(),1),_U=xe((0,Fue.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}),"HelpOutlined")});var zy,Y3e,zue,Hue=A(()=>{zy=w(G(),1);Ie();dU();Y3e=z(function({onClose:t,helpText:o,label:r}){return(0,zy.jsx)(q1,{open:!0,onClose:t,title:"Help",titleNode:r?(0,zy.jsxs)(zy.Fragment,{children:["Help: ",r]}):void 0,onClick:n=>{n.stopPropagation()},onMouseDown:n=>{n.stopPropagation()},children:o})}),zue=Y3e});var Ec,Gue,Vue,jue,W3e,$ue,Yue=A(()=>{Ec=w(G(),1),Gue=w(D(),1);Uue();We();Ie();Hue();Vue={marginLeft:4,padding:4},jue=z(function(){return(0,Ec.jsx)(jt,{size:"small",disabled:!0,style:{...Vue,visibility:"hidden"},children:(0,Ec.jsx)(_U,{fontSize:"small"})})}),W3e=z(function({helpText:t,label:o}){let[r,n]=(0,Gue.useState)(!1);return(0,Ec.jsxs)(Ec.Fragment,{children:[(0,Ec.jsx)(jt,{size:"small","aria-label":typeof o=="string"?`Help for ${o}`:"Help for this item",onClick:i=>{i.stopPropagation(),n(!0)},style:Vue,children:(0,Ec.jsx)(_U,{fontSize:"small"})}),r?(0,Ec.jsx)(zue,{helpText:t,label:o,onClose:()=>{n(!1)}}):null]})}),$ue=W3e});var Wue,que,Jue=A(()=>{"use client";bo();Wue=w(G(),1),que=xe((0,Wue.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight")});var Kue,RU,Xue=A(()=>{Kue=w(G(),1);Jue();Ie();RU=z(function({hidden:t}){return(0,Kue.jsx)(que,{style:t?{visibility:"hidden"}:void 0})})});var Zue,efe,tfe=A(()=>{"use client";bo();Zue=w(G(),1),efe=xe((0,Zue.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckBox")});var ofe,rfe,nfe=A(()=>{"use client";bo();ofe=w(G(),1),rfe=xe((0,ofe.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"}),"CheckBoxOutlineBlank")});var ife,sfe,afe=A(()=>{"use client";bo();ife=w(G(),1),sfe=xe((0,ife.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"RadioButtonChecked")});var lfe,cfe,ufe=A(()=>{"use client";bo();lfe=w(G(),1),cfe=xe((0,lfe.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"RadioButtonUnchecked")});var Hy,q3e,ffe,pfe=A(()=>{Hy=w(G(),1);tfe();nfe();afe();ufe();Ie();ln();q3e=$t()({menuItemEndDecoration:{padding:0,margin:0,height:16}}),ffe=z(function({type:t,checked:o}){let{classes:r}=q3e(),n;switch(t){case"checkbox":{n=o?(0,Hy.jsx)(efe,{}):(0,Hy.jsx)(rfe,{color:"action"});break}case"radio":{n=o?(0,Hy.jsx)(sfe,{}):(0,Hy.jsx)(cfe,{color:"action"});break}}return(0,Hy.jsx)("div",{className:r.menuItemEndDecoration,children:n})})});function MU(e){return"endAdornment"in e?e.endAdornment:void 0}function QU(e){return e.type==="custom"?!1:"endAdornment"in e&&!!e.endAdornment}var PU=A(()=>{});var fn,J3e,K3e,X3e,dfe,DU,Afe=A(()=>{fn=w(G(),1);Ie();Yue();Xue();pfe();PU();J3e=8,K3e=28,X3e=z(function({type:t,checked:o,separated:r}){return(0,fn.jsx)("div",{style:{marginRight:r?J3e:0},children:(0,fn.jsx)(ffe,{type:t,checked:o})})}),dfe=z(function({children:t}){return(0,fn.jsx)("div",{style:{width:K3e,display:"flex",justifyContent:"flex-end",alignItems:"center"},children:t})}),DU=z(function({item:t,columns:{hasCheckboxOrRadioWithHelp:o,hasEndAdornment:r,hasSubmenuWithHelp:n,sharedActionColumn:i}}){let s="subMenu"in t,a=t.type==="checkbox"||t.type==="radio",l=o||r,c=t.helpText&&!t.disabled?(0,fn.jsx)($ue,{helpText:t.helpText,label:t.label}):void 0;return(0,fn.jsxs)(fn.Fragment,{children:[(0,fn.jsx)("div",{style:{flexGrow:1,minWidth:10}}),a?(0,fn.jsx)(X3e,{type:t.type,checked:t.checked,separated:l}):null,i?(0,fn.jsx)(dfe,{children:c??MU(t)}):(0,fn.jsxs)(fn.Fragment,{children:[c??(a&&o?(0,fn.jsx)(jue,{}):null),r?(0,fn.jsx)(dfe,{children:MU(t)}):null]}),s?(0,fn.jsx)(RU,{}):n?(0,fn.jsx)(RU,{hidden:!0}):null]})})});function mfe(e){return typeof e.subMenu=="function"?e.subMenu():e.subMenu}function gfe(e){return e.keepMenuOpen??(e.type==="checkbox"||e.type==="radio")}var hfe=A(()=>{});function yfe(e,t,o){let n=(Math.abs(o.left-t.x)<=Math.abs(o.right-t.x)?o.left:o.right)-t.x;if(n===0)return!0;let i=Math.min((e.x-t.x)/n,1);return i>0&&e.y>=t.y+(o.top-t.y)*i&&e.y<=t.y+(o.bottom-t.y)*i}var bfe=A(()=>{});function OU(){let e=(0,Bi.use)(Cfe);if(!e)throw new Error("menu row rendered outside a CascadingMenu");return e}function t4e(e){let t,o={current:null},r,n,i,s=()=>{i&&(clearTimeout(i.timer),i=void 0)},a=(p,d)=>{s(),r=p===void 0?void 0:d,n=d,t=p,e(p)},l=p=>t!==void 0&&n!==void 0&&p.x===n.x&&p.y===n.y,c=p=>{let d=o.current;if(!d||!r)return"unmeasured";let m=d.getBoundingClientRect();return m.width===0&&m.height===0?"unmeasured":yfe(p,r,m)?"inside":"outside"},u=(p,d)=>{s(),i={key:p,point:d,timer:setTimeout(()=>{a(p,d)},e4e)}},f=(p,d)=>{if(p===t)s();else{if(l(d))return;t===void 0||c(d)==="outside"?a(p,d):u(p,d)}};return{panelRef:o,setSubmenu:a,cancelPending:s,hoverSubmenu:f,closeOnHover:p=>{f(void 0,{x:p.clientX,y:p.clientY})},onPointerMove:p=>{n={x:p.clientX,y:p.clientY};let d=i;if(!d)return;let m=c({x:p.clientX,y:p.clientY});m==="outside"?a(d.key,d.point):m==="inside"&&u(d.key,d.point)}}}function o4e(){let[e,t]=(0,Bi.useState)(),[o]=(0,Bi.useState)(()=>t4e(t));return(0,Bi.useEffect)(()=>o.cancelPending,[o]),(0,Bi.useEffect)(()=>{if(e!==void 0)return document.addEventListener("mousemove",o.onPointerMove),()=>{document.removeEventListener("mousemove",o.onPointerMove)}},[e,o]),{openSubmenu:e,hover:o}}function r4e(e){let t=new Map;return e.map(o=>{let r="subMenu"in o?"subMenu":o.type==="divider"||o.type==="subHeader"?o.type:o.type==="custom"?"custom":"menuitem",n=o.type==="divider"?"":"id"in o&&o.id||`${o.label}`,i=`${r}-${n}`,s=t.get(i)??0;return t.set(i,s+1),`${s}-${i}`})}function n4e(e){if(!e)return;let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function xfe(e,t){return typeof t=="string"?`cascading-${e}-${t.toLowerCase().replaceAll(/\s+/g,"_")}`:void 0}function i4e(e){let t=e.some(n=>(n.type==="checkbox"||n.type==="radio")&&n.helpText&&!n.disabled),o=e.some(n=>QU(n)),r=e.some(n=>QU(n)&&"helpText"in n&&n.helpText&&!("disabled"in n&&n.disabled));return{hasIcon:e.some(n=>"icon"in n&&n.icon),columns:{hasCheckboxOrRadioWithHelp:t,hasEndAdornment:o,hasSubmenuWithHelp:e.some(n=>"subMenu"in n&&n.helpText&&!n.disabled),sharedActionColumn:t&&o&&!r}}}var Ht,Bi,Z3e,Cfe,e4e,vfe,s4e,Efe,a4e,l4e,c4e,Tfe,u4e,Ife,wfe=A(()=>{Ht=w(G(),1),Bi=w(D(),1);We();Ie();ln();Lue();Afe();hfe();PU();bfe();BU();Z3e=$t()(e=>({subHeader:{lineHeight:"1.8em",fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:"0.05em",color:e.palette.text.secondary,borderTop:`1px solid ${e.palette.divider}`,marginTop:4},leadingSubHeader:{borderTopWidth:0,marginTop:0}})),Cfe=(0,Bi.createContext)(void 0);e4e=120;vfe=z(function({Icon:t}){return t?(0,Ht.jsx)(ny,{children:(0,Ht.jsx)(t,{})}):null});s4e=z(function({item:t,onHover:o}){let{onCloseRoot:r}=OU();return(0,Ht.jsx)("li",{style:{padding:"4px 16px"},onMouseEnter:o,onMouseDown:n=>{n.stopPropagation()},onKeyDown:n=>{n.key!=="Escape"&&n.stopPropagation()},children:t.render(r)})}),Efe=z(function({item:t,children:o}){return t.disabled&&t.disabledHelpText?(0,Ht.jsx)(Xt,{title:t.disabledHelpText,placement:"left",children:(0,Ht.jsx)("span",{children:o})}):o}),a4e=z(function({item:t,itemKey:o,inset:r,columns:n,open:i,hover:s,onNavigateBack:a}){let{zIndex:l}=OU(),[c,u]=(0,Bi.useState)(null),f=i&&!t.disabled;return(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(Efe,{item:t,children:(0,Ht.jsxs)(ar,{ref:u,"data-testid":xfe("submenu",t.label),disabled:t.disabled,"aria-haspopup":"menu","aria-expanded":f,selected:f,onMouseEnter:p=>{s.hoverSubmenu(o,{x:p.clientX,y:p.clientY})},onClick:p=>{s.setSubmenu(o,{x:p.clientX,y:p.clientY})},onKeyDown:p=>{p.key==="ArrowRight"?s.setSubmenu(o,n4e(c)):p.key==="ArrowLeft"&&(p.stopPropagation(),a?.())},children:[(0,Ht.jsx)(vfe,{Icon:t.icon}),(0,Ht.jsx)(HA,{primary:t.label,inset:r}),(0,Ht.jsx)(DU,{item:t,columns:n})]})}),f?(0,Ht.jsx)(Nue,{anchorEl:c,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},zIndex:l,onMouseEnter:s.cancelPending,paperRef:s.panelRef,onClose:()=>{s.setSubmenu(void 0)},children:(0,Ht.jsx)(l4e,{item:t,onNavigateBack:()=>{s.setSubmenu(void 0),c?.focus()}})}):null]})}),l4e=z(function({item:t,onNavigateBack:o}){return(0,Ht.jsx)(Tfe,{menuItems:mfe(t),onNavigateBack:o})}),c4e=z(function({item:t,inset:o,columns:r,onNavigateBack:n,onHover:i}){let{closeAfterItemClick:s,onMenuItemClick:a,onCloseRoot:l}=OU();return(0,Ht.jsx)(Efe,{item:t,children:(0,Ht.jsxs)(ar,{"data-testid":xfe("menuitem",t.label),disabled:t.disabled,role:t.type==="checkbox"?"menuitemcheckbox":t.type==="radio"?"menuitemradio":void 0,"aria-checked":t.type==="checkbox"||t.type==="radio"?t.checked:void 0,onClick:()=>{s&&!gfe(t)&&l(),a(t.onClick)},onMouseEnter:i,onKeyDown:c=>{c.key==="ArrowLeft"&&(c.stopPropagation(),n?.())},children:[(0,Ht.jsx)(vfe,{Icon:t.icon}),(0,Ht.jsx)(HA,{primary:t.label,secondary:t.subLabel,inset:o}),(0,Ht.jsx)(DU,{item:t,columns:r})]})})}),Tfe=z(function({menuItems:t,onNavigateBack:o}){let{classes:r,cx:n}=Z3e(),{openSubmenu:i,hover:s}=o4e(),{closeOnHover:a}=s,{hasIcon:l,columns:c}=(0,Bi.useMemo)(()=>i4e(t),[t]),u=(0,Bi.useMemo)(()=>t.toSorted((p,d)=>(d.priority??0)-(p.priority??0)),[t]),f=(0,Bi.useMemo)(()=>r4e(u),[u]);return(0,Ht.jsx)(Ht.Fragment,{children:u.map((p,d)=>{let m=f[d];return"subMenu"in p?(0,Ht.jsx)(a4e,{itemKey:m,item:p,inset:l&&!p.icon,columns:c,open:i===m,hover:s,onNavigateBack:o},m):p.type==="divider"?(0,Ht.jsx)(Xh,{component:"li"},m):p.type==="subHeader"?(0,Ht.jsx)(jh,{className:n(r.subHeader,d===0&&r.leadingSubHeader),onMouseEnter:a,children:p.label},m):p.type==="custom"?(0,Ht.jsx)(s4e,{item:p,onHover:a},m):(0,Ht.jsx)(c4e,{item:p,inset:l&&!p.icon,columns:c,onNavigateBack:o,onHover:a},m)})})}),u4e=z(function({onMenuItemClick:t,closeAfterItemClick:o=!0,menuItems:r,open:n,onClose:i,anchorEl:s,anchorOrigin:a,transformOrigin:l,anchorReference:c,anchorPosition:u,style:f}){let p=Array.isArray(r)?r:r(),{onEntering:d,...m}=r_();return(0,Ht.jsx)(os,{...m,anchorEl:s,open:n,onClose:i,anchorOrigin:a,transformOrigin:l,anchorReference:c,anchorPosition:u,style:f,slotProps:{transition:{onEntering:d}},children:(0,Ht.jsx)(Cfe,{value:{closeAfterItemClick:o,onMenuItemClick:t,onCloseRoot:i,zIndex:f?.zIndex},children:(0,Ht.jsx)(Tfe,{menuItems:p})})})}),Ife=u4e});var Tc,Sfe,f4e,p4e,d4e,A4e,n_,kU=A(()=>{Tc=w(G(),1),Sfe=w(D(),1);Oh();e1();Ie();wfe();f4e={vertical:"bottom",horizontal:"left"},p4e={vertical:"top",horizontal:"left"},d4e=z(function({title:t,disabled:o,children:r}){return t?(0,Tc.jsx)(Xt,{title:t,children:o?(0,Tc.jsx)("span",{children:r}):r}):r}),A4e=z(function({children:t,menuItems:o,closeAfterItemClick:r=!0,stopPropagation:n,disabled:i,setOpen:s,ButtonComponent:a=jt,onClick:l,onMenuItemClick:c=m=>{m()},anchorOrigin:u=f4e,transformOrigin:f=p4e,tooltip:p,...d}){let[m,y]=(0,Sfe.useState)(null),b=!!m,h=i??(Array.isArray(o)&&o.length===0);return(0,Tc.jsxs)(Tc.Fragment,{children:[(0,Tc.jsx)(d4e,{title:p,disabled:h,children:(0,Tc.jsx)(a,{"aria-label":p,onClick:g=>{n&&g.stopPropagation(),(Array.isArray(o)?o:o()).length>0&&(y(g.currentTarget),s?.(!0)),l?.(g)},...d,disabled:h,children:t})}),b?(0,Tc.jsx)(Ife,{open:b,onClose:()=>{y(null),s?.(!1)},anchorEl:m,anchorOrigin:u,transformOrigin:f,menuItems:o,closeAfterItemClick:r,onMenuItemClick:c}):null]})}),n_=A4e});function m4e(e){let t=e instanceof Error?e.name:"",o=`${e}`.toLowerCase();return t==="ChunkLoadError"||o.includes("loading")&&o.includes("chunk")&&o.includes("failed")||o.includes("failed to fetch dynamically imported module")||o.includes("error loading dynamically imported module")}var _p,g4e,Ic,Bfe=A(()=>{_p=w(G(),1);W5();We();Ie();SU();g4e=z(function({error:t}){return m4e(t)?(0,_p.jsxs)(cv,{children:[(0,_p.jsx)("div",{children:"Failed to load part of the application, likely due to a server update or network error. Refreshing the page usually fixes it."}),(0,_p.jsx)(tt,{variant:"contained",startIcon:(0,_p.jsx)(z1,{}),onClick:()=>{window.location.reload()},style:{margin:4},children:"Refresh page"}),(0,_p.jsx)("div",{children:`${t}`})]}):(0,_p.jsx)(cv,{children:`${t}`})}),Ic=g4e});function h4e(){if(typeof window>"u")return!1;let e=window.location.hash.slice(1);return new URLSearchParams(e.includes("=")?e:window.location.search).get("adminKey")!==null}function Rfe(e){return e.length>_fe?`${e.slice(0,_fe)}\u2026`:e}function Mfe(e){let{toggleContents:t,name:o}=e;return t?typeof t=="string"?Rfe(t):t:Rfe(o)}function Qfe(e){return[...h4e()?[]:["file"],"url",...e]}function Pfe(e,t="file"){return e&&"internetAccountId"in e&&e.internetAccountId?e.internetAccountId:e?Qa(e)?"url":"uri"in e?t:"file":"url"}function Dfe(e,t){if(e){if(Qa(e)){let o=e.internetAccountId??"url";return t==="file"?o:void 0}return"uri"in e||t==="file"?void 0:"file"}}function Ofe(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));if(t===-1)return;let o=e.slice(0,t);return/^[a-zA-Z]:$/.test(o)||o===""?e.slice(0,t+1):o}function NU(e,t){if(!Qa(e))return e;let o=t?.internetAccountId;if(e.internetAccountId===o)return e;let{internetAccountId:r,...n}=e;return o?{...n,internetAccountId:o}:n}var _fe,i_=A(()=>{om();_fe=5});function C4e(){return L1(kfe)}function x4e(e){let t=Ofe(e);t&&Xx(kfe,t)}function v4e(e){if(Nx(e)||qA(e))return e.name;if(p1(e))return e.localPath}function E4e(e){return Nx(e)?!m1(e.blobId):qA(e)?!g1(e.handleId):!1}async function Nfe(){try{let[e]=await window.showOpenFilePicker();return await Die(e)}catch(e){if(e instanceof DOMException&&e.name==="AbortError")return;throw e}}var ti,y4e,b4e,kfe,T4e,I4e,w4e,Lfe,Ffe=A(()=>{ti=w(G(),1);We();Ie();$F();om();WF();ln();JA();i_();y4e=$t()(e=>({filename:{marginLeft:e.spacing(1)}})),b4e=wie()&&!ku,kfe="jbrowse-last-local-file-dir";T4e=z(function({setLocation:t}){return b4e?(0,ti.jsx)(tt,{variant:"outlined",onClick:async()=>{let o=await Nfe();o&&t(o)},children:"Choose File"}):ku?(0,ti.jsx)(tt,{variant:"outlined",onClick:async()=>{let{ipcRenderer:o}=window.require("electron"),r=await o.invoke("promptOpenLocalFile",C4e()),n=typeof r=="string"?r:void 0;n&&(x4e(n),t({localPath:n,locationType:"LocalPathLocation"}))},children:"Choose File"}):(0,ti.jsxs)(tt,{variant:"outlined",component:"label",children:["Choose File",(0,ti.jsx)("input",{type:"file",hidden:!0,onChange:({target:o})=>{let r=o.files?.[0];if(r){let n=Mie({blob:r});"blobId"in n&&t(n)}}})]})}),I4e=z(function({location:t,setLocation:o}){let r=async()=>{if(qA(t))try{await Pie(t.handleId,!0),o({...t})}catch{let n=await Nfe();n&&o(n)}};return(0,ti.jsxs)(Ho,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,ti.jsx)(ve,{color:"error",children:"(need to reload)"}),qA(t)&&(0,ti.jsx)(tt,{size:"small",variant:"text",color:"primary",onClick:r,children:"Reopen"})]})}),w4e=z(function({location:t,setLocation:o}){let{classes:r}=y4e(),n=v4e(t);return(0,ti.jsxs)(Ho,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,ti.jsx)(Ho,{children:(0,ti.jsx)(hc,{fullWidth:!0,children:(0,ti.jsx)(T4e,{setLocation:o})})}),(0,ti.jsxs)(Ho,{children:[(0,ti.jsx)(ve,{component:"span",className:r.filename,color:n?"initial":"textSecondary",children:n||"No file chosen"}),t&&E4e(t)&&(0,ti.jsx)(I4e,{location:t,setLocation:o})]})]})}),Lfe=w4e});var Ufe,LU,S4e,zfe,Hfe=A(()=>{Ufe=w(G(),1),LU=w(D(),1);We();Ie();JA();S4e=z(function({location:t,label:o,style:r,setLocation:n}){let i=t&&Qa(t)?t.uri:"",[s,a]=(0,LU.useState)(i),[l,c]=(0,LU.useState)(i);return i!==l&&(c(i),i!==s.trim()&&a(i)),(0,Ufe.jsx)(an,{variant:"outlined",fullWidth:!0,value:s,label:o||"Enter URL",style:r,onChange:u=>{a(u.target.value),n({uri:u.target.value.trim(),locationType:"UriLocation"})},slotProps:{htmlInput:{"data-testid":"urlInput"}}})}),zfe=S4e});var FU,B4e,Gfe,Vfe=A(()=>{FU=w(G(),1);Ie();Ffe();Hfe();B4e=z(function({toggleButtonValue:t,selectedAccount:o,location:r,inline:n,setLocation:i}){return t==="file"?(0,FU.jsx)(Lfe,{location:r,setLocation:i}):(0,FU.jsx)(zfe,{location:r,setLocation:i,label:o?.selectorLabel,style:n?{margin:0}:void 0})}),Gfe=B4e});var jfe,wc,Gy=A(()=>{"use client";bo();jfe=w(G(),1),wc=xe((0,jfe.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown")});var Rl,_4e,R4e,M4e,$fe,Yfe=A(()=>{Rl=w(G(),1);Gy();We();Ie();kU();i_();_4e=z(function({account:t}){return(0,Rl.jsx)(Xt,{title:t.name,children:(0,Rl.jsx)(Ou,{value:t.internetAccountId,children:Mfe(t)})})}),R4e=z(function({onClick:t,disabled:o,children:r}){return(0,Rl.jsx)(Ou,{value:"more",selected:!1,disabled:o,onClick:n=>{t(n)},children:r})}),M4e=z(function({value:t,sourceTypes:o,shownAccounts:r,hiddenAccounts:n,onChange:i,onHiddenAccountSelect:s}){return(0,Rl.jsxs)(Ay,{value:t,exclusive:!0,size:"small",onChange:i,"aria-label":"file, url, or account picker",children:[o.includes("file")&&(0,Rl.jsx)(Ou,{value:"file","aria-label":"local file",children:"File"}),(0,Rl.jsx)(Ou,{value:"url","aria-label":"url",children:"URL"}),r.map(a=>(0,Rl.jsx)(_4e,{account:a},a.internetAccountId)),n.length>0&&(0,Rl.jsxs)(n_,{menuItems:n.map(a=>({label:a.name,onClick:()=>{s(a.internetAccountId)}})),ButtonComponent:R4e,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:["More",(0,Rl.jsx)(wc,{})]})]})}),$fe=M4e});function qfe(){return(0,s_.use)(Wfe)}var s_,Wfe,F8t,Jfe=A(()=>{s_=w(D(),1),Wfe=(0,s_.createContext)(void 0),F8t=Wfe.Provider});function UU(e){let[t,o]=Jae("fileSelector-recentlyUsedInternetAccounts",[]),r=kF(e)?e.internetAccounts.filter(a=>a.showInFileSelector):[],n=Object.fromEntries(r.map(a=>[a.internetAccountId,a])),i=a=>{let l=t.indexOf(a);return l===-1?Number.POSITIVE_INFINITY:l},s=Object.values(n).sort((a,l)=>i(a.internetAccountId)-i(l.internetAccountId));return{accountMap:n,shownAccounts:s.slice(0,Kfe),hiddenAccounts:s.slice(Kfe),recentlyUsed:t,setRecentlyUsed:o}}var Kfe,Xfe=A(()=>{Kae();JA();Kfe=2});var Ml,Yu,Q4e,uv,Zfe=A(()=>{Ml=w(G(),1),Yu=w(D(),1);We();Ie();om();JA();Vfe();Yfe();Jfe();Xfe();i_();Q4e=z(function({inline:t,location:o,name:r,description:n,rootModel:i,setLocation:s}){let a=qfe(),l=(0,Yu.useId)(),c=(0,Yu.useId)(),[u,f]=(0,Yu.useState)(()=>Pfe(o,a)),{accountMap:p,shownAccounts:d,hiddenAccounts:m,recentlyUsed:y,setRecentlyUsed:b}=UU(i),h=Qfe(Object.keys(p)),g=h.includes(u)?u:"url",[C,x]=(0,Yu.useState)(o);if(o!==C){x(o);let S=Dfe(o,g);S&&f(S)}let E=p[g],I=(0,Yu.useCallback)(S=>{s(NU(S,E))},[s,E]),T=(0,Yu.useCallback)(S=>{if(S&&(b([...new Set([S,...y].filter(Oa))]),f(S),o&&Qa(o))){let B=NU(o,p[S]);B!==o&&s(B)}},[o,y,b,p,s]);return(0,Ml.jsxs)(Ml.Fragment,{children:[(0,Ml.jsx)(Ho,{sx:{display:"flex"},children:(0,Ml.jsx)(ry,{id:l,shrink:!0,children:r})}),(0,Ml.jsxs)(Ho,{role:"group","aria-labelledby":r?l:void 0,"aria-describedby":n?c:void 0,sx:{display:"flex",flexDirection:t?"row":"column",gap:.5},children:[(0,Ml.jsx)($fe,{value:g,sourceTypes:h,shownAccounts:d,hiddenAccounts:m,onChange:(S,B)=>{T(B)},onHiddenAccountSelect:T}),(0,Ml.jsx)(Gfe,{toggleButtonValue:g,selectedAccount:E,location:o,inline:t,setLocation:I})]}),(0,Ml.jsx)(ty,{id:c,children:n})]})}),uv=Q4e});var epe,tpe,ope=A(()=>{"use client";bo();epe=w(G(),1),tpe=xe((0,epe.jsx)("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"}),"RestartAlt")});var rpe=A(()=>{});async function Vy(e){return e.bytes?e.bytes():new Uint8Array(await e.arrayBuffer())}async function a_(e,t,o){if(t==="utf8"||t==="utf-8")return e.text();if(t)throw new Error(`unsupported encoding: ${t}`);return o&&"body"in e?zU(e,o):Vy(e)}function l_(e){return typeof e=="string"?{encoding:e,opts:{}}:{encoding:e?.encoding,opts:e??{}}}function npe(e){let t=/\/(\d+)$/.exec(e??"")?.[1];return t===void 0?void 0:parseInt(t,10)}function P4e(e){let t=e.headers.get("content-length"),o=t===null?Number.NaN:Number(t);return Number.isSafeInteger(o)&&o>=0?o:void 0}async function zU(e,t){let o=P4e(e),r=e.body;if(!r||o===void 0){let l=await Vy(e);return t(l.byteLength,o??l.byteLength),l}let n=r.getReader(),i=new Uint8Array(o),s=0,a=Date.now();t(0,o);for(let l=await n.read();!l.done;l=await n.read()){if(s+l.value.byteLength>i.length){let u=new Uint8Array(Math.max(s+l.value.byteLength,i.length*2));u.set(i.subarray(0,s)),i=u}i.set(l.value,s),s+=l.value.byteLength;let c=Date.now();c-a>=D4e&&(a=c,t(s,o))}return t(s,o),s===i.length?i:i.slice(0,s)}var D4e,HU=A(()=>{D4e=50});var am,ipe=A(()=>{HU();am=class{source;blob;constructor(t){this.blob=t}async read(t,o=0,r={}){if(t===0)return new Uint8Array(0);r.signal?.throwIfAborted();let n=await Vy(this.blob.slice(o,o+t));return r.signal?.throwIfAborted(),n}async readFile(t){let{encoding:o,opts:r}=l_(t);r.signal?.throwIfAborted();let n=await a_(this.blob,o);return r.signal?.throwIfAborted(),n}stat(){return Promise.resolve({size:this.blob.size})}close(){return Promise.resolve()}}});function O4e(...e){let t=new Map;for(let o of e)for(let[r,n]of Object.entries(o??{}))t.set(r.toLowerCase(),[r,n]);return Object.fromEntries(t.values())}function GU(e){let t=e.body;typeof t?.cancel=="function"&&t.cancel().catch(()=>{})}function spe(e){return Number.isSafeInteger(e)&&e>=0}function k4e(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="TypeError"}function N4e(e){return(typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:`${e}`).replace(/\.$/,"")}var jy,ape=A(()=>{HU();jy=class{url;get source(){return this.url}_stat;statProbe;fetchImplementation;baseHeaders;baseOverrides;baseSignal;constructor(t,o={}){this.url=t,this.baseHeaders=o.headers??{},this.baseOverrides=o.overrides??{},this.baseSignal=o.signal,this.fetchImplementation=o.fetch??globalThis.fetch.bind(globalThis)}buildRequest(t,o){let r=t.signal??this.baseSignal;return{method:"GET",redirect:"follow",mode:"cors",...this.baseOverrides,...t.overrides,headers:O4e(this.baseHeaders,t.headers,o),...r?{signal:r}:{}}}async fetch(t,o){let r=i=>k4e(i)&&!o?.signal?.aborted?new Error(`${N4e(i)} fetching ${t}`,{cause:i}):i,n;try{n=await this.fetchImplementation(t,o)}catch(i){if(`${i}`.includes("Failed to fetch")){console.warn(`generic-filehandle: refetching ${t} to attempt to work around chrome CORS header caching bug`);try{n=await this.fetchImplementation(t,{...o,cache:"reload"})}catch(s){throw r(s)}}else throw r(i)}return n}async read(t,o,r={}){if(!spe(t)||!spe(o))throw new TypeError(`read() called with an invalid length or position (length=${t}, position=${o}). The index file may be corrupt.`);return t===0?new Uint8Array(0):this.fetchBytes(t,o,r)}async fetchBytes(t,o,r){let n=await this.fetch(this.url,this.buildRequest(r,{range:`bytes=${o}-${o+t-1}`}));if(n.status===416)return GU(n),new Uint8Array(0);if(this.checkOk(n),n.status===200&&o===0||n.status===206){let i=npe(n.headers.get("content-range"));i!==void 0&&(this._stat={size:i});let s=r.onProgress?await zU(n,r.onProgress):await Vy(n);return!this._stat&&n.status===200&&(this._stat={size:s.byteLength}),s.byteLength<=t?s:s.slice(0,t)}throw GU(n),new Error(n.status===200?`${this.url} fetch returned status 200, expected 206`:`HTTP ${n.status} fetching ${this.url}`)}checkOk(t){if(!t.ok)throw GU(t),new Error(`HTTP ${t.status} fetching ${this.url}`)}async readFile(t){let{encoding:o,opts:r}=l_(t),n=await this.fetch(this.url,this.buildRequest(r));this.checkOk(n);let i=await this.readFileBody(n,o,r.onProgress);return n.status===200&&typeof i!="string"&&(this._stat={size:i.byteLength}),i}readFileBody(t,o,r){return a_(t,o,r)}async stat(){return this._stat||(this.statProbe??=this.read(10,0).finally(()=>{this.statProbe=void 0}),await this.statProbe),this._stat??{size:0}}close(){return Promise.resolve()}}});var c_,VU=A(()=>{rpe();ipe();ape();c_=class{source;constructor(t,o={}){this.source=t}unimplemented(){return Promise.reject(new Error(`LocalFile is unimplemented in the browser (${this.source})`))}readFile(t){return this.unimplemented()}read(t,o,r){return this.unimplemented()}stat(){return this.unimplemented()}close(){return this.unimplemented()}}});function u_(e){typeof e=="object"&&e!==null&&"unref"in e&&typeof e.unref=="function"&&e.unref()}function jU(e){if(!e)return;let t=e.trim(),o=/^bytes (?:(\d+)-(\d+)|\*)\/(?:(\d+)|\*)$/.exec(t);if(!o){let s=/^bytes\b.*\/(\d+)\s*$/i.exec(t);return s?{start:void 0,end:void 0,total:Number.parseInt(s[1],10)}:void 0}let[,r,n,i]=o;return{start:r===void 0?void 0:Number.parseInt(r,10),end:n===void 0?void 0:Number.parseInt(n,10),total:i===void 0?void 0:Number.parseInt(i,10)}}function f_(e){e.body?.cancel().catch(()=>{})}async function cpe(e,t){if(!e.body){let s=new Uint8Array(await e.arrayBuffer());return s.byteLength>t?void 0:s}let o=e.body.getReader(),r=[],n=0,i=!1;for(;!i&&n<=t;){let s=await o.read();s.done?i=!0:(r.push(s.value),n+=s.value.byteLength)}return i||o.cancel().catch(()=>{}),n>t?void 0:L4e(r,n)}function L4e(e,t){let o=new Uint8Array(t),r=0;for(let n of e)o.set(n,r),r+=n.byteLength;return o}function upe(e){let t=e?/^bytes=(\d+)-(\d+)$/.exec(e):null;if(t){let o=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return r<o?void 0:{start:o,end:r}}else return}function fv(e,t,o){if(Number.isNaN(t)||Number.isNaN(o))throw new TypeError(`read() of ${e} called with NaN length or position (length=${t}, position=${o}); the index the offset came from is probably corrupt or truncated`);if(!Number.isSafeInteger(t)||!Number.isSafeInteger(o)||t<0||o<0)throw new TypeError(`read() of ${e} needs a non-negative safe-integer length and position (length=${t}, position=${o}); the index the offset came from is probably corrupt or being read against the wrong file`);if(t>lpe)throw new TypeError(`read() of ${e} asked for ${t} bytes, more than the ${lpe} a Uint8Array can hold; the index the offset came from is probably corrupt or being read against the wrong file`)}function $U(e){try{let t=typeof location>"u"?void 0:location.href,{protocol:o,origin:r}=new URL(e,t);return o==="http:"||o==="https:"?r:void 0}catch{return}}function fpe(){return globalThis.navigator?.locks}function ppe(e){return`@gmod/range-cache-filehandle body ${e}`}async function F4e(e,t){try{await fpe()?.request(ppe(e),{mode:"shared"},()=>t)}catch{}}function YU(e){let t=$U(e);if(t===void 0)return()=>{};$y.set(t,($y.get(t)??0)+1);let o=()=>{};F4e(t,new Promise(n=>{o=n}));let r=!0;return()=>{if(r){r=!1,o();let n=($y.get(t)??1)-1;n>0?$y.set(t,n):$y.delete(t)}}}async function dpe(e){let t=$y.get(e)??0;try{let{held:o=[]}=await fpe()?.query()??{},r=ppe(e);return Math.max(t,o.filter(n=>n.name===r).length)}catch{return t}}var lpe,$y,pv=A(()=>{lpe=2**32-1;$y=new Map});function Ape(e,t,o){let r=o===void 0?void 0:$U(o),n=new AbortController,i=!1,s=0,a,l=()=>!i&&!e?.aborted,c=async()=>{s++;let p=r!==void 0&&s<=10&&await dpe(r)>=6;if(l())p?u():(f.expired=new Error(t(s*3e4/1e3)),n.abort(f.expired));else return},u=()=>{a=setTimeout(()=>{l()&&c()},3e4),u_(a)},f={signal:e?AbortSignal.any([e,n.signal]):n.signal,stop:()=>{i=!0,clearTimeout(a)}};return u(),f}function mpe(e){let t=e;for(let o=0;o<5&&typeof t=="object"&&t!==null;o++){if("name"in t&&t.name==="TypeError")return!0;t="cause"in t?t.cause:void 0}return!1}function z4e(e){if(typeof location>"u"||location.protocol!=="https:")return!1;try{return new URL(e,location.href).protocol==="http:"}catch{return!1}}function gpe(e){return typeof navigator<"u"&&navigator.onLine===!1?" (the browser reports no network connection)":z4e(e)?" (a page served over https may not load a file served over http, and the browser blocked this before it left; the file has to be served over https too)":" (no response at all, so there is no status to report \u2014 most often CORS: the server must send Access-Control-Allow-Origin, and Access-Control-Expose-Headers: Content-Range as well or the size of the file cannot be read either. A host that is down, a DNS failure and a blocked port look identical from here)"}function hpe(e){return e===200?" (the server ignored the Range header and returned the whole file; byte-range support is required for BAM/CRAM/tabix/bigwig files)":e===401||e===403?" (the file is there and the request was refused; a signed URL may have expired, or a bucket policy may not grant read to the page origin)":e===404?" (no such file; check the URL, and that the index file sits where the reader expects it alongside the data file)":e===429||e>=500?" (the server is failing or declining to serve this file just now; nothing is retried automatically, so try again once it recovers)":""}var ype=A(()=>{pv()});function j4e(e){let t=d_.get(e);return t===void 0&&(t={key:e,extents:[],pending:[],turn:void 0},d_.set(e,t)),t}function $4e(e,{start:t,end:o}){let r=Av(e,t-1),n=r,i={start:t,end:o};for(;n<e.length&&e[n].start<=o;)i={start:Math.min(i.start,e[n].start),end:Math.max(i.end,e[n].end)},n++;e.splice(r,n-r,i)}function qU(e,t,o){let r=[];for(let n=Av(e,t);n<e.length&&e[n].start<o;n++)r.push(e[n]);return r}function JU(e){e.extents.length===0&&e.pending.length===0&&e.turn===void 0&&d_.get(e.key)===e&&d_.delete(e.key)}function Av(e,t){let o=0,r=e.length;for(;o<r;){let n=o+r>>>1;e[n].end<=t?o=n+1:r=n}return o}function Cpe(e){e.older=Yy,e.newer=void 0,Yy===void 0?lm=e:Yy.newer=e,Yy=e}function xpe(e){e.older===void 0?lm=e.newer:e.older.newer=e.newer,e.newer===void 0?Yy=e.older:e.newer.older=e.older,e.older=void 0,e.newer=void 0}function vpe(e,t){e!==Yy&&(xpe(e),Cpe(e)),e.lastTouched=t}function Epe(e){xpe(e),dv-=e.end-e.start;let{extents:t}=e.file;t.splice(Av(t,e.start),1),JU(e.file),dv===0&&J4e()}function Y4e(){for(;dv>V4e&&lm!==void 0;)Epe(lm)}function W4e(e,t,o){let r=t+o.length,n=Date.now(),{extents:i}=e,s=Av(i,t),a=(c,u)=>{for(let f=c;f<u;f+=1048576){let p=Math.min(u,f+1048576),d={file:e,start:f,end:p,bytes:new Uint8Array(o.subarray(f-t,p-t)),lastTouched:n,older:void 0,newer:void 0};i.splice(s,0,d),s++,Cpe(d),dv+=p-f}},l=t;for(;s<i.length&&i[s].start<r;){let c=i[s];c.start>l&&a(l,c.start),l=Math.max(l,c.end),s++}l<r&&a(l,r),dv>0&&q4e(),Y4e()}function Tpe(){let e=Date.now()-9e5;for(;lm!==void 0&&lm.lastTouched<=e;)Epe(lm)}function q4e(){Wy===void 0&&(Wy=setInterval(Tpe,225e3),u_(Wy))}function J4e(){Wy!==void 0&&(clearInterval(Wy),Wy=void 0)}function K4e(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t.origin:e}catch{return e}}function X4e(e){let t=A_.get(e);return t===void 0&&(t={active:0,queue:[]},A_.set(e,t)),t}function Ipe(e,t){t.active===0&&t.queue.length===0&&A_.get(e)===t&&A_.delete(e)}function Z4e(e,t){t.queue.length>0&&t.active<20&&(t.active++,t.queue.shift()()),Ipe(e,t)}async function eze(e,t){if(t?.aborted)return!1;let o=!1;return await new Promise(r=>{let n=()=>{o=!0,t?.removeEventListener("abort",i),r()},i=()=>{let s=e.queue.indexOf(n);s!==-1&&e.queue.splice(s,1),r()};e.queue.push(n),t?.addEventListener("abort",i,{once:!0})}),o}async function wpe(e,t,o){let r=K4e(e),n=X4e(r);if(n.active<20)n.active++;else if(!await eze(n,o))throw Ipe(r,n),o?.throwIfAborted(),new Error(`internal: gave up waiting for a request slot for ${e}`);try{return await t()}finally{n.active--,Z4e(r,n)}}async function Spe(e,t){let o=bpe(e);if(o!==void 0)return o;let r=p_.get(e);if(r===void 0){let i={size:wpe(e,t),stale:!1},s=()=>{p_.get(e)===i&&p_.delete(e)};i.size.then(a=>{!i.stale&&a!==void 0&&cm(e,a),s()},s),p_.set(e,i),r=i}let n=await r.size;return bpe(e)??n}function cm(e,t){Number.isFinite(t)&&Bpe(e,{size:t,exact:!0})}function tze(e,t){let o=Rp.get(e);(o===void 0||t<o.size)&&Bpe(e,{size:t,exact:!1})}function Bpe(e,t){Rp.delete(e),oze(Rp,5e3),Rp.set(e,t)}function oze(e,t){for(;e.size>=t;){let o=e.keys().next().value;if(o===void 0)return;e.delete(o)}}function KU(e){let t=Rp.get(e);return t!==void 0&&(Rp.delete(e),Rp.set(e,t)),t?.size}function bpe(e){return Rp.get(e)?.exact?KU(e):void 0}function rze(e,{start:t,end:o,doFetch:r},n){let i=new AbortController,s=wpe(e.key,()=>(i.signal.throwIfAborted(),r(t,o-1,i.signal)),i.signal),a={start:t,end:o,signals:new Set,pinned:!1,controller:i,dispose:new AbortController,settled:!1,stale:n,readers:0,owned:!1,body:s.then(({bytes:c,total:u,owned:f})=>(a.owned=f===!0,a.stale||(u!==void 0&&cm(e.key,u),c.length===0?tze(e.key,t):c.length<o-t&&cm(e.key,t+c.length),W4e(e,t,c)),c))},l=()=>{a.settled=!0,a.dispose.abort(),a.signals.clear(),e.pending.splice(e.pending.indexOf(a),1),JU(e)};return a.body.then(l,l),e.pending.push(a),a}function _pe(e,t){t?.aborted||(e.readers++,t?e.signals.has(t)||(e.signals.add(t),t.addEventListener("abort",()=>{e.signals.delete(t),nze(e,t.reason)},{once:!0,signal:e.dispose.signal})):e.pinned=!0)}function nze(e,t){!e.pinned&&e.signals.size===0&&e.controller.abort(t)}function Rpe(e,t,o,r){let n=qU(e.extents,t,o),i=e.pending.filter(c=>c.start<o&&c.end>t&&!c.controller.signal.aborted),s=[...n,...i,...qU(r,t,o)].sort((c,u)=>c.start-u.start),a=[],l=t;for(let c of s)if(c.start>l&&a.push({start:l,end:c.start}),l=Math.max(l,c.end),l>=o)break;return l<o&&a.push({start:l,end:o}),{extents:n,pending:i,gaps:a}}function ize(e,t){let o=1/0,r=Av(e.extents,t);r<e.extents.length&&(o=Math.max(t,e.extents[r].start));for(let n of e.pending)n.end>t&&!n.controller.signal.aborted&&(o=Math.min(o,Math.max(t,n.start)));return o}function sze(e,t){e.turn===t&&(e.turn=void 0);let o=Date.now(),r=KU(e.key),n=[],i=[],s=[];for(let l of t.readers){let c=r===void 0?l.end:Math.min(l.end,r),u={start:l.start,end:c,extents:[],pending:[]};if(l.start<c&&!l.signal?.aborted){let f=Rpe(e,l.start,c,i);u.extents=f.extents,u.pending=f.pending;for(let p of f.extents)vpe(p,o);for(let p of f.gaps){if(r===void 0&&f.pending.some(d=>d.end===p.start)){u.end=p.start;break}if(p.end-p.start<65536){let d=r===void 0?p.start+65536:Math.min(p.start+65536,r);p.end=Math.max(p.end,Math.min(d,ize(e,p.end)))}n.push({...p,doFetch:l.doFetch}),$4e(i,p)}}s.push({reader:l,plan:u})}let a=aze(n).map(l=>rze(e,l,t.stale));for(let{reader:l,plan:c}of s){if(l.signal?.aborted){l.settle(c);continue}c.pending.push(...qU(a,c.start,c.end));for(let u of c.pending)_pe(u,l.signal);l.settle(c)}JU(e)}function aze(e){e.sort((o,r)=>o.start-r.start);let t=[];for(let o of e){let r=t.at(-1);r!==void 0&&o.start-r.end<=65536?r.end=Math.max(r.end,o.end):t.push({...o})}return t}function lze(e,t,o,r){let{extents:n,pending:i,gaps:s}=Rpe(e,t,o,[]);if(s.length>0)return;let a=Date.now();for(let l of n)vpe(l,a);for(let l of i)_pe(l,r);return{start:t,end:o,extents:n,pending:i}}function cze(e,t){let{turn:o}=e;if(o===void 0){let r={readers:[],stale:!1};e.turn=r,queueMicrotask(()=>{sze(e,r)}),o=r}o.readers.push(t)}function uze({start:e,end:t,extents:o,pending:r},n){let i=t;for(let[c,u]of r.entries()){let f=n[c];f.length<u.end-u.start&&(i=Math.min(i,u.start+f.length))}let s=Math.max(0,i-e);if(o.length===0&&r.length===1){let c=r[0],u=n[0];if(c.owned&&c.readers===1&&c.start===e&&u.length===s&&u.byteOffset===0&&u.buffer.byteLength===s)return u}let a=new Uint8Array(s),l=(c,u)=>{let f=Math.max(e,c),p=Math.min(i,c+u.length);p>f&&a.set(u.subarray(f-c,p-c),f-e)};for(let c of o)l(c.start,c.bytes);for(let[c,u]of r.entries())l(u.start,n[c]);return a}async function mv(e,t,o,r,n){r?.throwIfAborted();let i=KU(e),s=i===void 0?t+o:Math.min(t+o,i);if(t>=s)return new Uint8Array(0);let a=j4e(e),l=lze(a,t,s,r);l===void 0&&(l=await new Promise(d=>{cze(a,{start:t,end:s,signal:r,doFetch:n,settle:d})}),r?.throwIfAborted());let c=[];if(l.pending.length>0)try{c=await fze(Promise.all(l.pending.map(d=>d.body)),r)}finally{r?.throwIfAborted()}let u=uze(l,c);if(l.end===s||u.length<l.end-t)return u;let f=await mv(e,l.end,s-l.end,r,n),p=new Uint8Array(u.length+f.length);return p.set(u),p.set(f,u.length),p}function fze(e,t){if(!t)return e;let o=new AbortController;return Promise.race([e,new Promise((r,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0,signal:o.signal})})]).finally(()=>{o.abort()})}var d_,lm,Yy,dv,V4e,Rp,A_,p_,Wy,XU=A(()=>{pv();d_=new Map,dv=0,V4e=268435456,Rp=new Map,A_=new Map,p_=new Map});function pze(e,t,o,r){if(r?.start===void 0||r.end===void 0)return;let{total:n}=r;if(r.end<r.start||n!==void 0&&r.end>=n)return`${e} answered Content-Range "bytes ${r.start}-${r.end}/${n??"*"}", which does not describe a range of a file that size (the header contradicts itself, so neither the bytes it labels nor the length it reports can be trusted; a caching proxy in front of the file is the usual cause)`;if(r.start!==t)return`${e} answered bytes ${r.start}-${r.end} for a request for bytes starting at ${t} (the response does not describe the range that was asked for, so its bytes would land at the wrong offsets; a caching proxy in front of the file is the usual cause)`;if(n!==void 0&&r.end<Math.min(o,n-1))return`${e} served bytes ${r.start}-${r.end} of a request for bytes ${t}-${o} of a ${n}-byte file (the response stops short of both the end asked for and the end of the file, so the bytes past it would be taken for EOF; a proxy capping how much of a range it will serve is the usual cause)`}function dze(e,t,o,r){return t.expired?t.expired:mpe(e)&&!t.signal.aborted?new Error(`Network error fetching ${r}${gpe(o)}`,{cause:e}):e}var Mp,ZU=A(()=>{VU();ype();XU();pv();Mp=class extends jy{recordSize(t){cm(this.url,t)}async stat(){let t=await Spe(this.url,async()=>(await this.fetchRange(this.url,0,0,this.buildRequest({}))).total);if(t===void 0)throw new Error(`Could not determine size of ${this.url} (the server answered, but no Content-Range carrying the length of the file came back with it: either the header was not readable, which cross-origin needs Access-Control-Expose-Headers: Content-Range to fix, or the server sent the "bytes 0-0/*" form and declined to say how long the file is)`);return{size:t}}async fetchRange(t,o,r,n){let i=await this.fetchWithDeadline(t,n,{start:o,end:r}),s=YU(t);try{return await this.readRange(i,t,o,r)}finally{s()}}async readRange(t,o,r,n){if(t.status===416){let c=jU(t.headers.get("content-range"))?.total;if(f_(t),c!==void 0&&r<c)throw Object.assign(new Error(`HTTP 416 fetching ${o} bytes ${r}-${n}, which starts inside the ${c}-byte file the same response reports (the server refused a range it says exists, so an empty read here would pass for the end of the file; a caching proxy in front of the file is the usual cause)`),{status:416});return{bytes:new Uint8Array(0),total:c}}if(t.status!==206){let c=`HTTP ${t.status} fetching ${o} bytes ${r}-${n}${hpe(t.status)}`;throw f_(t),Object.assign(new Error(c),{status:t.status})}let i=jU(t.headers.get("content-range")),s=pze(o,r,n,i);if(s!==void 0)throw f_(t),new Error(s);let a=i?.start===void 0||i.end===void 0?void 0:i.end-i.start+1,l=await cpe(t,a??n-r+1);if(l===void 0)throw new Error(a===void 0?`${o} sent more than the ${n-r+1} bytes requested for bytes ${r}-${n} with no Content-Range to say what they are (the body cannot be placed, so it is not trusted; a server ignoring the Range header or a caching proxy in front of the file is the usual cause)`:`${o} sent more than the ${a} bytes of the range ${i.start}-${i.end} it declared (the body runs past its own Content-Range, so neither the header nor the bytes can be trusted; a caching proxy in front of the file is the usual cause)`);if(a!==void 0&&l.byteLength!==a)throw new Error(`${o} sent ${l.byteLength} bytes for bytes ${i.start}-${i.end}, which is ${a} bytes (the body is truncated; left alone this is indistinguishable from the file ending here and would be cached as such)`);return{bytes:l,total:i?.total,owned:!0}}async fetchWithDeadline(t,o,r){let n=r&&`bytes ${r.start}-${r.end}`,i=Ape(o?.signal,a=>`No response from ${t}${n?` for ${n}`:""} after ${a}s (the connection was open and the server sent nothing; a transfer already under way is not subject to this limit, so this is a stalled request rather than a slow one)`,t),s={...o,signal:i.signal};if(r){let a=new Headers(o?.headers);a.set("range",`bytes=${r.start}-${r.end}`),s.headers=a}try{return await super.fetch(t,s)}catch(a){throw dze(a,i,t,n?`${t} ${n}`:t)}finally{i.stop()}}cachedRange(t,o,r,n){return mv(t,o,r,n?.signal??void 0,(i,s,a)=>this.fetchRange(t,i,s,{...n,signal:a}))}async fetchBytes(t,o,r){return fv(this.url,t,o),this.cachedRange(this.url,o,t,this.buildRequest(r))}async fetch(t,o){if(typeof t!="string")return super.fetch(t,o);let r=upe(new Headers(o?.headers).get("range"));if(!r)return this.fetchWithDeadline(t,o);let n=r.end-r.start+1;fv(t,n,r.start);let i=await this.cachedRange(t,r.start,n,o);return new Response(i,{status:206})}async readFileBody(...t){let o=YU(this.url);try{return await super.readFileBody(...t)}finally{o()}}}});var Qp,Mpe=A(()=>{ZU();XU();pv();Qp=class e{inner;key;get source(){return this.inner.source}constructor(t,o){if(t instanceof e&&t.key===o||t instanceof Mp&&t.source===o)throw new TypeError(`CachedFilehandle cannot wrap a handle that caches under the same key, ${o}`);this.inner=t,this.key=o}async read(t,o,r={}){return fv(this.key,t,o),t===0?new Uint8Array(0):mv(this.key,o,t,r.signal,async(n,i,s)=>({bytes:await this.inner.read(i-n+1,n,{...r,signal:s})}))}readFile(t){return this.inner.readFile(t)}async stat(){let t=await this.inner.stat();return(t.size>0||t.mtimeMs!==void 0)&&cm(this.key,t.size),t}close(){return this.inner.close()}}});var Qpe=A(()=>{Mpe();ZU()});var Ppe=A(()=>{Qpe()});function Aze(e){return"localPath"in e}function mze(e){return"blobId"in e}function gze(e){return"handleId"in e}function hze(e){return e.baseUri?{...e,uri:new URL(e.uri,e.baseUri).href}:e}function yze(e){if(e.startsWith("/")||/^[a-z]:[\\/]/i.test(e))return e;if(e.startsWith("file:"))try{let{host:t,pathname:o}=new URL(e),r=decodeURIComponent(o);return t&&t!=="localhost"?`//${t}${r}`:/^\/[a-z]:/i.test(r)?r.slice(1):r}catch{return}}function e3(e,t){if(Aze(e)){if(!e.localPath)throw new Error("No local path provided");if(my||ku)return new Qp(new c_(e.localPath),`file://${e.localPath}`);throw new Error("can't use local files in the browser")}if(mze(e)){let o=m1(e.blobId);if(!o)throw new Error(`file ("${e.name}") was opened locally from a previous session. To restore it, go to track settings and reopen the file`);return new Qp(new am(o),`blob://${e.blobId}`)}if(gze(e)){let o=g1(e.handleId);if(!o)throw new Error(`file ("${e.name}") requires permission. Please reopen the file from track settings`);return new Qp(new am(o),`filehandle://${e.handleId}@${o.lastModified}:${o.size}`)}if(Qa(e)){if(!e.uri)throw new Error("No URI provided");let o=hze(e),r=yze(o.uri);if(r!==void 0&&(my||ku))return e3({localPath:r,locationType:"LocalPathLocation"});if(t){let n=bze(o,t);if(n)return n.openLocation(o)}return new Mp(o.uri,{fetch:Cze})}throw new Error("invalid fileLocation")}function bze(e,t){let{rootModel:o}=t;if(o&&NF(o))return o.findAppropriateInternetAccount(e);if(e.internetAccountPreAuthorization){if(!e.internetAccountPreAuthorization.authInfo.token)throw new Error("Failed to obtain token from internet account. Try reloading the page");return t.getInternetAccountType(e.internetAccountPreAuthorization.internetAccountType).stateModel.create({type:e.internetAccountPreAuthorization.internetAccountType,configuration:e.internetAccountPreAuthorization.authInfo.configuration})}}async function Cze(e,t){let o=await fetch(e,t);if(o.status===401&&o.headers.get("WWW-Authenticate")?.includes("Basic"))throw new gy("Accessing HTTPBasic resource without authentication",e.toString());return o}var Dpe=A(()=>{VU();f1();WF();JA();Ppe()});var is=A(()=>{pU();Bfe();Zfe();AU()});function Ope(e,t){let o=(0,qy.useRef)(!1),[r,n]=(0,qy.useState)();return(0,qy.useEffect)(()=>{if(r!==void 0){let c=function(f){o.current||(o.current=!0,requestAnimationFrame(()=>{let p=e==="x"?f.clientX:f.clientY;t(p-a,l),o.current=!1}))},u=function(){n(void 0)};var i=c,s=u;let{client:a,startScroll:l}=r;return document.addEventListener("pointermove",c),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}}},[e,t,r]),{dragging:r!==void 0,startDrag:(i,s)=>{n({client:e==="x"?i.clientX:i.clientY,startScroll:s})}}}var qy,kpe=A(()=>{"use strict";qy=w(D(),1)});function Wu({axis:e,variant:t,getStart:o,onDrag:r,style:n}){let i=Jt(),[s,a]=(0,gv.useState)(!1),{startDrag:l}=Ope(e,r),{fill:c,fillHovered:u,cursor:f,position:p,zIndex:d}=xze[t];return gv.default.createElement("div",{...t==="resizer"&&{role:"separator","aria-orientation":e==="x"?"vertical":"horizontal"},onMouseEnter:()=>{a(!0)},onMouseLeave:()=>{a(!1)},onPointerDown:m=>{l(m,o())},style:{position:p,touchAction:"none",zIndex:d,cursor:f(e),background:s?u(i):c(i),...n}},t==="resizer"?gv.default.createElement("div",{style:{position:"absolute",zIndex:101,...e==="x"?{top:0,bottom:0,left:-m_,right:-m_}:{left:0,right:0,top:-m_,bottom:-m_}}}):null)}var gv,Jy,m_,xze,hv=A(()=>{"use strict";gv=w(D(),1);We();kpe();Jy="rgba(66,119,127,0.3)",m_=4,xze={thumb:{fill:()=>Jy,fillHovered:()=>"rgba(66,119,127,0.6)",cursor:()=>"pointer",position:"absolute",zIndex:100},resizer:{fill:e=>e.palette.mode==="dark"?e.palette.grey[800]:"rgba(200,200,200)",fillHovered:e=>e.palette.mode==="dark"?e.palette.grey[600]:"rgba(150,150,150)",cursor:e=>e==="x"?"ew-resize":"ns-resize",position:"relative"}}});function g_(){return typeof window<"u"}function Dp(e){return o3(e)?(e.nodeName||"").toLowerCase():"#document"}function Rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Sc(e){var t;return(t=(o3(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function o3(e){return g_()?e instanceof Node||e instanceof Rn(e).Node:!1}function oi(e){return g_()?e instanceof Element||e instanceof Rn(e).Element:!1}function Ql(e){return g_()?e instanceof HTMLElement||e instanceof Rn(e).HTMLElement:!1}function yv(e){return!g_()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rn(e).ShadowRoot}function bv(e){let{overflow:t,overflowX:o,overflowY:r,display:n}=La(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+o)&&n!=="inline"&&n!=="contents"}function Upe(e){return/^(table|td|th)$/.test(Dp(e))}function Cv(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}function h_(e){let t=oi(e)?La(e):e;return um(t.transform)||um(t.translate)||um(t.scale)||um(t.rotate)||um(t.perspective)||!xv()&&(um(t.backdropFilter)||um(t.filter))||Eze.test(t.willChange||"")||Tze.test(t.contain||"")}function zpe(e){let t=qu(e);for(;Ql(t)&&!fm(t);){if(h_(t))return t;if(Cv(t))return null;t=qu(t)}return null}function xv(){return t3==null&&(t3=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t3}function fm(e){return/^(html|body|#document)$/.test(Dp(e))}function La(e){return Rn(e).getComputedStyle(e)}function vv(e){return oi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qu(e){if(Dp(e)==="html")return e;let t=e.assignedSlot||e.parentNode||yv(e)&&e.host||Sc(e);return yv(t)?t.host:t}function Hpe(e){let t=qu(e);return fm(t)?(e.ownerDocument||e).body:Ql(t)&&bv(t)?t:Hpe(t)}function Ju(e,t,o){var r;t===void 0&&(t=[]),o===void 0&&(o=!0);let n=Hpe(e),i=n===((r=e.ownerDocument)==null?void 0:r.body),s=Rn(n);if(i){let a=y_(s);return t.concat(s,s.visualViewport||[],bv(n)?n:[],a&&o?Ju(a):[])}else return t.concat(n,Ju(n,[],o))}function y_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Eze,Tze,um,t3,b_=A(()=>{Eze=/transform|translate|scale|rotate|perspective|filter/,Tze=/paint|layout|strict|content/,um=e=>!!e&&e!=="none"});function jpe(e,t,o){return Ku(e,Ky(t,o))}function wv(e,t){return typeof e=="function"?e(t):e}function pm(e){return e.split("-")[0]}function Sv(e){return e.split("-")[1]}function r3(e){return e==="x"?"y":"x"}function n3(e){return e==="y"?"height":"width"}function Xu(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function i3(e){return r3(Xu(e))}function $pe(e,t,o){o===void 0&&(o=!1);let r=Sv(e),n=i3(e),i=n3(n),s=n==="x"?r===(o?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ev(s)),[s,Ev(s)]}function Ype(e){let t=Ev(e);return[C_(e),t,C_(t)]}function C_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}function Bze(e,t,o){switch(e){case"top":case"bottom":return o?t?Vpe:Gpe:t?Gpe:Vpe;case"left":case"right":return t?wze:Sze;default:return[]}}function Wpe(e,t,o,r){let n=Sv(e),i=Bze(pm(e),o==="start",r);return n&&(i=i.map(s=>s+"-"+n),t&&(i=i.concat(i.map(C_)))),i}function Ev(e){let t=pm(e);return Ize[t]+e.slice(t.length)}function _ze(e){var t,o,r,n;return{top:(t=e.top)!=null?t:0,right:(o=e.right)!=null?o:0,bottom:(r=e.bottom)!=null?r:0,left:(n=e.left)!=null?n:0}}function qpe(e){return typeof e!="number"?_ze(e):{top:e,right:e,bottom:e,left:e}}function dm(e){let{x:t,y:o,width:r,height:n}=e;return{width:r,height:n,top:o,left:t,right:t+r,bottom:o+n,x:t,y:o}}var Ky,Ku,Tv,Iv,Bc,Ize,Gpe,Vpe,wze,Sze,x_=A(()=>{Ky=Math.min,Ku=Math.max,Tv=Math.round,Iv=Math.floor,Bc=e=>({x:e,y:e}),Ize={left:"right",right:"left",bottom:"top",top:"bottom"};Gpe=["left","right"],Vpe=["right","left"],wze=["top","bottom"],Sze=["bottom","top"]});function Kpe(e,t){if(!e||!t)return!1;let o=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&yv(o)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Xpe(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Zpe(e,t){let o=["mouse","pen"];return t||o.push("",void 0),o.includes(e)}function v_(e){let t=Bv.useRef(()=>{});return Dze(()=>{t.current=e}),Bv.useCallback(function(){for(var o=arguments.length,r=new Array(o),n=0;n<o;n++)r[n]=arguments[n];return t.current==null?void 0:t.current(...r)},[])}var Bv,Jpe,Rze,Mze,_v,Qze,Pze,Dze,ede=A(()=>{b_();Bv=w(D(),1),Jpe=w(D(),1);Rze=typeof document<"u",Mze=function(){},_v=Rze?Jpe.useLayoutEffect:Mze,Qze={...Bv},Pze=Qze.useInsertionEffect,Dze=Pze||(e=>e())});function tde(e,t,o){let{reference:r,floating:n}=e,i=Xu(t),s=i3(t),a=n3(s),l=pm(t),c=i==="y",u=r.x+r.width/2-n.width/2,f=r.y+r.height/2-n.height/2,p=r[a]/2-n[a]/2,d;switch(l){case"top":d={x:u,y:r.y-n.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-n.width,y:f};break;default:d={x:r.x,y:r.y}}let m=Sv(t);return m&&(d[s]+=p*(m==="end"?1:-1)*(o&&c?-1:1)),d}async function ode(e,t){var o;t===void 0&&(t={});let{x:r,y:n,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=wv(t,e),m=qpe(d),b=a[p?f==="floating"?"reference":"floating":f],h=dm(await i.getClippingRect({element:(o=await(i.isElement==null?void 0:i.isElement(b)))==null||o?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),g=f==="floating"?{x:r,y:n,width:s.floating.width,height:s.floating.height}:s.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(C))&&await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1},E=dm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:C,strategy:l}):g);return{top:(h.top-E.top+m.top)/x.y,bottom:(E.bottom-h.bottom+m.bottom)/x.y,left:(h.left-E.left+m.left)/x.x,right:(E.right-h.right+m.right)/x.x}}async function Nze(e,t){let{placement:o,platform:r,elements:n}=e,i=await(r.isRTL==null?void 0:r.isRTL(n.floating)),s=pm(o),a=Sv(o),l=Xu(o)==="y",c=kze.has(s)?-1:1,u=i&&l?-1:1,f=wv(t,e),{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(d=a==="end"?m*-1:m),l?{x:d*u,y:p*c}:{x:p*c,y:d*u}}var Oze,rde,nde,kze,ide,sde,ade=A(()=>{x_();x_();Oze=50,rde=async(e,t,o)=>{let{placement:r="bottom",strategy:n="absolute",middleware:i=[],platform:s}=o,a=s.detectOverflow?s:{...s,detectOverflow:ode},l=await(s.isRTL==null?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:f}=tde(c,r,l),p=r,d=0,m={};for(let y=0;y<i.length;y++){let b=i[y];if(!b)continue;let{name:h,fn:g}=b,{x:C,y:x,data:E,reset:I}=await g({x:u,y:f,initialPlacement:r,placement:p,strategy:n,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=C??u,f=x??f,m[h]={...m[h],...E},I&&d<Oze&&(d++,typeof I=="object"&&(I.placement&&(p=I.placement),I.rects&&(c=I.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:n}):I.rects),{x:u,y:f}=tde(c,p,l)),y=-1)}return{x:u,y:f,placement:p,strategy:n,middlewareData:m}},nde=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,r;let{placement:n,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...b}=wv(e,t);if((o=i.arrow)!=null&&o.alignmentOffset)return{};let h=pm(n),g=Xu(a),C=pm(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=p||(C||!y?[Ev(a)]:Ype(a)),I=m!=="none";!p&&I&&E.push(...Wpe(a,y,m,x));let T=[a,...E],S=await l.detectOverflow(t,b),B=[],R=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&B.push(S[h]),f){let O=$pe(n,s,x);B.push(S[O[0]],S[O[1]])}if(R=[...R,{placement:n,overflows:B}],!B.every(O=>O<=0)){var M,Q;let O=(((M=i.flip)==null?void 0:M.index)||0)+1,k=T[O];if(k&&(!(f==="alignment"?g!==Xu(k):!1)||R.every(F=>Xu(F.placement)===g?F.overflows[0]>0:!0)))return{data:{index:O,overflows:R},reset:{placement:k}};let N=(Q=R.filter(L=>L.overflows[0]<=0).sort((L,F)=>L.overflows[1]-F.overflows[1])[0])==null?void 0:Q.placement;if(!N)switch(d){case"bestFit":{var v;let L=(v=R.filter(F=>{if(I){let K=Xu(F.placement);return K===g||K==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(K=>K>0).reduce((K,ce)=>K+ce,0)]).sort((F,K)=>F[1]-K[1])[0])==null?void 0:v[0];L&&(N=L);break}case"initialPlacement":N=a;break}if(n!==N)return{reset:{placement:N}}}return{}}}},kze=new Set(["left","top"]);ide=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,r;let{x:n,y:i,placement:s,middlewareData:a}=t,l=await Nze(t,e);return s===((o=a.offset)==null?void 0:o.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:n+l.x,y:i+l.y,data:{...l,placement:s}}}}},sde=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:o,y:r,placement:n,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:g=>{let{x:C,y:x}=g;return{x:C,y:x}}},...c}=wv(e,t),u={x:o,y:r},f=await i.detectOverflow(t,c),p=Xu(n),d=r3(p),m=u[d],y=u[p],b=(g,C)=>jpe(C+f[g==="y"?"top":"left"],C,C-f[g==="y"?"bottom":"right"]);s&&(m=b(d,m)),a&&(y=b(p,y));let h=l.fn({...t,[d]:m,[p]:y});return{...h,data:{x:h.x-o,y:h.y-r,enabled:{[d]:s,[p]:a}}}}}}});function ude(e){let t=La(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,n=Ql(e),i=n?e.offsetWidth:o,s=n?e.offsetHeight:r,a=Tv(o)!==i||Tv(r)!==s;return a&&(o=i,r=s),{width:o,height:r,$:a}}function a3(e){return oi(e)?e:e.contextElement}function Xy(e){let t=a3(e);if(!Ql(t))return Bc(1);let o=t.getBoundingClientRect(),{width:r,height:n,$:i}=ude(t),s=(i?Tv(o.width):o.width)/r,a=(i?Tv(o.height):o.height)/n;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}function fde(e){let t=Rn(e);return!xv()||!t.visualViewport?Lze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fze(e,t,o){return t===void 0&&(t=!1),!!o&&t&&o===Rn(e)}function Am(e,t,o,r){t===void 0&&(t=!1),o===void 0&&(o=!1);let n=e.getBoundingClientRect(),i=a3(e),s=Bc(1);t&&(r?oi(r)&&(s=Xy(r)):s=Xy(e));let a=Fze(i,o,r)?fde(i):Bc(0),l=(n.left+a.x)/s.x,c=(n.top+a.y)/s.y,u=n.width/s.x,f=n.height/s.y;if(i&&r){let p=Rn(i),d=oi(r)?Rn(r):r,m=p,y=y_(m);for(;y&&d!==m;){let b=Xy(y),h=y.getBoundingClientRect(),g=La(y),C=h.left+(y.clientLeft+parseFloat(g.paddingLeft))*b.x,x=h.top+(y.clientTop+parseFloat(g.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=C,c+=x,m=Rn(y),y=y_(m)}}return dm({width:u,height:f,x:l,y:c})}function E_(e,t){let o=vv(e).scrollLeft;return t?t.left+o:Am(Sc(e)).left+o}function pde(e,t){let o=e.getBoundingClientRect(),r=o.left+t.scrollLeft-E_(e,o),n=o.top+t.scrollTop;return{x:r,y:n}}function Uze(e){let{elements:t,rect:o,offsetParent:r,strategy:n}=e,i=n==="fixed",s=Sc(r),a=t?Cv(t.floating):!1;if(r===s||a&&i)return o;let l={scrollLeft:0,scrollTop:0},c=Bc(1),u=Bc(0),f=Ql(r);if((f||!i)&&((Dp(r)!=="body"||bv(s))&&(l=vv(r)),f)){let d=Am(r);c=Xy(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}let p=s&&!f&&!i?pde(s,l):Bc(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:o.y*c.y-l.scrollTop*c.y+u.y+p.y}}function zze(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hze(e){let t=vv(e),o=e.ownerDocument.body,r=Ku(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),n=Ku(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),i=-t.scrollLeft+E_(e),s=-t.scrollTop;return La(o).direction==="rtl"&&(i+=Ku(e.clientWidth,o.clientWidth)-r),{width:r,height:n,x:i,y:s}}function Vze(e,t,o){o===void 0&&(o="viewport");let r=o==="layoutViewport",n=Rn(e),i=Sc(e),s=n.visualViewport,a=i.clientWidth,l=i.clientHeight,c=0,u=0;if(s){let p=!xv()||t==="fixed";r?p||(c=-s.offsetLeft,u=-s.offsetTop):(a=s.width,l=s.height,p&&(c=s.offsetLeft,u=s.offsetTop))}if(E_(i)<=0){let p=i.ownerDocument,d=p.body,m=getComputedStyle(d),y=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(i.clientWidth-d.clientWidth-y),h=getComputedStyle(i).scrollbarGutter==="stable both-edges"?b/2:b;h<=Gze&&(a-=h)}return{width:a,height:l,x:c,y:u}}function jze(e,t){let o=Am(e,!0,t==="fixed"),r=o.top+e.clientTop,n=o.left+e.clientLeft,i=Xy(e),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=n*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function lde(e,t,o){let r;if(t==="viewport"||t==="layoutViewport")r=Vze(e,o,t);else if(t==="document")r=Hze(Sc(e));else if(oi(t))r=jze(t,o);else{let n=fde(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return dm(r)}function $ze(e,t){let o=t.get(e);if(o)return o;let r=Ju(e,[],!1).filter(a=>oi(a)&&Dp(a)!=="body"),n=null,i=La(e).position==="fixed",s=i?qu(e):e;for(;oi(s)&&!fm(s);){let a=La(s),l=h_(s),c=n?n.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(f=>f!==s):n=a,s=qu(s)}return t.set(e,r),r}function Yze(e){let{element:t,boundary:o,rootBoundary:r,strategy:n}=e,s=[...o==="clippingAncestors"?Cv(t)?[]:$ze(t,this._c):[].concat(o),r],a=lde(t,s[0],n),l=a.top,c=a.right,u=a.bottom,f=a.left;for(let p=1;p<s.length;p++){let d=lde(t,s[p],n);l=Ku(d.top,l),c=Ky(d.right,c),u=Ky(d.bottom,u),f=Ku(d.left,f)}return{width:c-f,height:u-l,x:f,y:l}}function Wze(e){let{width:t,height:o}=ude(e);return{width:t,height:o}}function qze(e,t,o){let r=Ql(t),n=Sc(t),i=o==="fixed",s=Am(e,!0,i,t),a={scrollLeft:0,scrollTop:0},l=Bc(0);if((r||!i)&&((Dp(t)!=="body"||bv(n))&&(a=vv(t)),r)){let p=Am(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}!r&&n&&(l.x=E_(n));let c=n&&!r&&!i?pde(n,a):Bc(0),u=s.left+a.scrollLeft-l.x-c.x,f=s.top+a.scrollTop-l.y-c.y;return{x:u,y:f,width:s.width,height:s.height}}function s3(e){return La(e).position==="static"}function cde(e,t){if(!Ql(e)||La(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return Sc(e)===o&&(o=o.ownerDocument.body),o}function dde(e,t){let o=Rn(e);if(Cv(e))return o;if(!Ql(e)){let n=qu(e);for(;n&&!fm(n);){if(oi(n)&&!s3(n))return n;n=qu(n)}return o}let r=cde(e,t);for(;r&&Upe(r)&&s3(r);)r=cde(r,t);return r&&fm(r)&&s3(r)&&!h_(r)?o:r||zpe(e)||o}function Kze(e){return La(e).direction==="rtl"}function Ade(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xze(e,t,o){let r=null,n,i=Sc(e);function s(){var u;clearTimeout(n),(u=r)==null||u.disconnect(),r=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),s();let p=e.getBoundingClientRect(),{left:d,top:m,width:y,height:b}=p;if(u||t(),!y||!b)return;let h=Iv(m),g=Iv(i.clientWidth-(d+y)),C=Iv(i.clientHeight-(m+b)),x=Iv(d),I={rootMargin:-h+"px "+-g+"px "+-C+"px "+-x+"px",threshold:Ku(0,Ky(1,f))||1},T=!0;function S(B){let R=B[0].intersectionRatio;if(!Ade(p,e.getBoundingClientRect()))return a();if(R!==f){if(!T)return a();R?a(!1,R):n=setTimeout(()=>{a(!1,1e-7)},1e3)}T=!1}try{r=new IntersectionObserver(S,{...I,root:i.ownerDocument})}catch{r=new IntersectionObserver(S,I)}r.observe(e)}let l=Rn(e),c=()=>a(o);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),s()}}function T_(e,t,o,r){r===void 0&&(r={});let{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=a3(e),u=n||i?[...c?Ju(c):[],...t?Ju(t):[]]:[];u.forEach(h=>{n&&h.addEventListener("scroll",o),i&&h.addEventListener("resize",o)});let f=c&&a?Xze(c,o,i):null,p=-1,d=null;s&&(d=new ResizeObserver(h=>{let[g]=h;g&&g.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var C;(C=d)==null||C.observe(t)})),o()}),c&&!l&&d.observe(c),t&&d.observe(t));let m,y=l?Am(e):null;l&&b();function b(){let h=Am(e);y&&!Ade(y,h)&&o(),y=h,m=requestAnimationFrame(b)}return o(),()=>{var h;u.forEach(g=>{n&&g.removeEventListener("scroll",o),i&&g.removeEventListener("resize",o)}),f?.(),(h=d)==null||h.disconnect(),d=null,l&&cancelAnimationFrame(m)}}var Lze,Gze,Jze,l3,mde,gde,hde,I_,c3=A(()=>{ade();x_();b_();Lze=Bc(0);Gze=25;Jze=async function(e){let t=this.getOffsetParent||dde,o=this.getDimensions,r=await o(e.floating);return{reference:qze(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};l3={convertOffsetParentRelativeRectToViewportRelativeRect:Uze,getDocumentElement:Sc,getClippingRect:Yze,getOffsetParent:dde,getElementRects:Jze,getClientRects:zze,getDimensions:Wze,getScale:Xy,isElement:oi,isRTL:Kze};mde=ide,gde=sde,hde=nde,I_=(e,t,o)=>{let r=new Map,n=o??{},i={...l3,...n.platform,_c:r};return rde(e,t,{...n,platform:i})}});function S_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let o,r,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(r=o;r--!==0;)if(!S_(e[r],t[r]))return!1;return!0}if(n=Object.keys(e),o=n.length,o!==Object.keys(t).length)return!1;for(r=o;r--!==0;)if(!{}.hasOwnProperty.call(t,n[r]))return!1;for(r=o;r--!==0;){let i=n[r];if(!(i==="_owner"&&e.$$typeof)&&!S_(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function xde(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yde(e,t){let o=xde(e);return Math.round(t*o)/o}function u3(e){let t=Dr.useRef(e);return w_(()=>{t.current=e}),t}function vde(e){e===void 0&&(e={});let{placement:t="bottom",strategy:o="absolute",middleware:r=[],platform:n,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=Dr.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=Dr.useState(r);S_(p,r)||d(r);let[m,y]=Dr.useState(null),[b,h]=Dr.useState(null),g=Dr.useCallback(F=>{F!==I.current&&(I.current=F,y(F))},[]),C=Dr.useCallback(F=>{F!==T.current&&(T.current=F,h(F))},[]),x=i||m,E=s||b,I=Dr.useRef(null),T=Dr.useRef(null),S=Dr.useRef(u),B=l!=null,R=u3(l),M=u3(n),Q=u3(c),v=Dr.useCallback(()=>{if(!I.current||!T.current)return;let F={placement:t,strategy:o,middleware:p};M.current&&(F.platform=M.current),I_(I.current,T.current,F).then(K=>{let ce={...K,isPositioned:Q.current!==!1};O.current&&!S_(S.current,ce)&&(S.current=ce,Cde.flushSync(()=>{f(ce)}))})},[p,t,o,M,Q]);w_(()=>{c===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[c]);let O=Dr.useRef(!1);w_(()=>(O.current=!0,()=>{O.current=!1}),[]),w_(()=>{if(x&&(I.current=x),E&&(T.current=E),x&&E){if(R.current)return R.current(x,E,v);v()}},[x,E,v,R,B]);let k=Dr.useMemo(()=>({reference:I,floating:T,setReference:g,setFloating:C}),[g,C]),N=Dr.useMemo(()=>({reference:x,floating:E}),[x,E]),L=Dr.useMemo(()=>{let F={position:o,left:0,top:0};if(!N.floating)return F;let K=yde(N.floating,u.x),ce=yde(N.floating,u.y);return a?{...F,transform:"translate("+K+"px, "+ce+"px)",...xde(N.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:K,top:ce}},[o,a,N.floating,u.x,u.y]);return Dr.useMemo(()=>({...u,update:v,refs:k,elements:N,floatingStyles:L}),[u,v,k,N,L])}var Dr,bde,Cde,eHe,tHe,w_,B_,f3,p3,d3=A(()=>{c3();c3();Dr=w(D(),1),bde=w(D(),1),Cde=w(NA(),1),eHe=typeof document<"u",tHe=function(){},w_=eHe?bde.useLayoutEffect:tHe;B_=(e,t)=>{let o=mde(e);return{name:o.name,fn:o.fn,options:[e,t]}},f3=(e,t)=>{let o=gde(e);return{name:o.name,fn:o.fn,options:[e,t]}},p3=(e,t)=>{let o=hde(e);return{name:o.name,fn:o.fn,options:[e,t]}}});function fHe(){let[e,t]=lt.useState(()=>Ide?wde():void 0);return _v(()=>{e==null&&t(wde())},[]),lt.useEffect(()=>{Ide=!0},[]),e}function AHe(){let e=new Map;return{emit(t,o){var r;(r=e.get(t))==null||r.forEach(n=>n(o))},on(t,o){e.has(t)||e.set(t,new Set),e.get(t).add(o)},off(t,o){var r;(r=e.get(t))==null||r.delete(o)}}}function bHe(e,t){let o=null,r=null,n=!1;return{contextElement:e||void 0,getBoundingClientRect(){var i;let s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},a=t.axis==="x"||t.axis==="both",l=t.axis==="y"||t.axis==="both",c=["mouseenter","mousemove"].includes(((i=t.dataRef.current.openEvent)==null?void 0:i.type)||"")&&t.pointerType!=="touch",u=s.width,f=s.height,p=s.x,d=s.y;return o==null&&t.x&&a&&(o=s.x-t.x),r==null&&t.y&&l&&(r=s.y-t.y),p-=o||0,d-=r||0,u=0,f=0,!n||c?(u=t.axis==="y"?s.width:0,f=t.axis==="x"?s.height:0,p=a&&t.x!=null?t.x:p,d=l&&t.y!=null?t.y:d):n&&!c&&(f=t.axis==="x"?s.height:f,u=t.axis==="y"?s.width:u),n=!0,{width:u,height:f,x:p,y:d,top:d,right:p+u,bottom:d+f,left:p}}}}function Sde(e){return e!=null&&e.clientX!=null}function _de(e,t){t===void 0&&(t={});let{open:o,dataRef:r,elements:{floating:n,domReference:i},refs:s}=e,{enabled:a=!0,axis:l="both",x:c=null,y:u=null}=t,f=lt.useRef(!1),p=lt.useRef(null),[d,m]=lt.useState(),[y,b]=lt.useState([]),h=v_((I,T)=>{f.current||r.current.openEvent&&!Sde(r.current.openEvent)||s.setPositionReference(bHe(i,{x:I,y:T,axis:l,dataRef:r,pointerType:d}))}),g=v_(I=>{c!=null||u!=null||(o?p.current||b([]):h(I.clientX,I.clientY))}),C=Zpe(d)?n:o,x=lt.useCallback(()=>{if(!C||!a||c!=null||u!=null)return;let I=Rn(n);function T(S){let B=Xpe(S);Kpe(n,B)?(I.removeEventListener("mousemove",T),p.current=null):h(S.clientX,S.clientY)}if(!r.current.openEvent||Sde(r.current.openEvent)){I.addEventListener("mousemove",T);let S=()=>{I.removeEventListener("mousemove",T),p.current=null};return p.current=S,S}s.setPositionReference(i)},[C,a,c,u,n,r,s,i,h]);lt.useEffect(()=>x(),[x,y]),lt.useEffect(()=>{a&&!n&&(f.current=!1)},[a,n]),lt.useEffect(()=>{!a&&o&&(f.current=!0)},[a,o]),_v(()=>{a&&(c!=null||u!=null)&&(f.current=!1,h(c,u))},[a,c,u,h]);let E=lt.useMemo(()=>{function I(T){let{pointerType:S}=T;m(S)}return{onPointerDown:I,onPointerEnter:I,onMouseMove:g,onMouseEnter:g}},[g]);return lt.useMemo(()=>a?{reference:E}:{},[a,E])}function CHe(e){let{open:t=!1,onOpenChange:o,elements:r}=e,n=dHe(),i=lt.useRef({}),[s]=lt.useState(()=>AHe()),a=hHe()!=null,[l,c]=lt.useState(r.reference),u=v_((d,m,y)=>{i.current.openEvent=d?m:void 0,s.emit("openchange",{open:d,event:m,reason:y,nested:a}),o?.(d,m,y)}),f=lt.useMemo(()=>({setPositionReference:c}),[]),p=lt.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return lt.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:p,events:s,floatingId:n,refs:f}),[t,u,p,s,n,f])}function Rde(e){var t,o;let{elements:r,...n}=e===void 0?{}:e,{nodeId:i}=n,s=CHe({...n,elements:{reference:(t=r?.reference)!=null?t:null,floating:(o=r?.floating)!=null?o:null}}),a=n.rootContext||s,l=a.elements,[c,u]=lt.useState(null),[f,p]=lt.useState(null),m=l?.domReference||c,y=lt.useRef(null),b=yHe();_v(()=>{m&&(y.current=m)},[m]);let h=vde({...n,elements:{...l,...f&&{reference:f}}}),g=lt.useCallback(T=>{let S=oi(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;p(S),h.refs.setReference(S)},[h.refs]),C=lt.useCallback(T=>{(oi(T)||T===null)&&(y.current=T,u(T)),(oi(h.refs.reference.current)||h.refs.reference.current===null||T!==null&&!oi(T))&&h.refs.setReference(T)},[h.refs]),x=lt.useMemo(()=>({...h.refs,setReference:C,setPositionReference:g,domReference:y}),[h.refs,C,g]),E=lt.useMemo(()=>({...h.elements,domReference:m}),[h.elements,m]),I=lt.useMemo(()=>({...h,...a,refs:x,elements:E,nodeId:i}),[h,x,E,i,a]);return _v(()=>{a.dataRef.current.floatingContext=I;let T=b?.nodesRef.current.find(S=>S.id===i);T&&(T.context=I)}),lt.useMemo(()=>({...h,context:I,refs:x,elements:E}),[h,x,E,I])}function A3(e,t,o){let r=new Map,n=o==="item",i=e;if(n&&e){let{[Ede]:s,[Tde]:a,...l}=e;i=l}return{...o==="floating"&&{tabIndex:-1,[oHe]:""},...i,...t.map(s=>{let a=s?s[o]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(n&&[Ede,Tde].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),s[c]=function(){for(var p,d=arguments.length,m=new Array(d),y=0;y<d;y++)m[y]=arguments[y];return(p=r.get(c))==null?void 0:p.map(b=>b(...m)).find(b=>b!==void 0)}}}else s[c]=u}),s),{})}}function Mde(e){e===void 0&&(e=[]);let t=e.map(a=>a?.reference),o=e.map(a=>a?.floating),r=e.map(a=>a?.item),n=lt.useCallback(a=>A3(a,e,"reference"),t),i=lt.useCallback(a=>A3(a,e,"floating"),o),s=lt.useCallback(a=>A3(a,e,"item"),r);return lt.useMemo(()=>({getReferenceProps:n,getFloatingProps:i,getItemProps:s}),[n,i,s])}var lt,m3,Bde,oHe,Ede,Tde,rHe,nHe,iHe,sHe,aHe,lHe,C9t,cHe,Ide,uHe,wde,pHe,dHe,mHe,gHe,hHe,yHe,Qde=A(()=>{lt=w(D(),1);ede();m3=w(G(),1);b_();Bde=w(NA(),1);d3();d3();oHe="data-floating-ui-focusable",Ede="active",Tde="selected",rHe="ArrowLeft",nHe="ArrowRight",iHe="ArrowUp",sHe="ArrowDown",aHe=[rHe,nHe],lHe=[iHe,sHe],C9t=[...aHe,...lHe],cHe={...lt},Ide=!1,uHe=0,wde=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+uHe++;pHe=cHe.useId,dHe=pHe||fHe;mHe=lt.createContext(null),gHe=lt.createContext(null),hHe=()=>{var e;return((e=lt.useContext(mHe))==null?void 0:e.id)||null},yHe=()=>lt.useContext(gHe)});var Pde,__,Dde,xHe,vHe,g3,EHe,THe,Op,Rv=A(()=>{Pde=w(G(),1),__=w(D(),1);Qde();Ie();Dde=w(NA(),1);j5();Q0();xHe={pointerEvents:"none",borderRadius:4,fontFamily:"inherit",fontSize:12,padding:"4px 8px",lineHeight:1.4,maxWidth:300,wordWrap:"break-word"},vHe=15;typeof window<"u"&&window.addEventListener("pointermove",e=>{g3={x:e.clientX,y:e.clientY}},{passive:!0,capture:!0});EHe=6,THe=z(function({clientPoint:t,anchor:o,id:r,children:n,placement:i=o?"top":"right"}){let{palette:s,portalContainer:a}=U1(),{refs:l,floatingStyles:c,context:u}=Rde({placement:i,strategy:"fixed",elements:{reference:o},middleware:[B_(o?EHe:vHe),p3(),f3({padding:8})],whileElementsMounted:o?T_:void 0}),[f,p]=(0,__.useState)(g3),d=!o&&t===void 0;(0,__.useEffect)(()=>{if(!d)return;p(g3);let h=g=>{p({x:g.clientX,y:g.clientY})};return window.addEventListener("pointermove",h,{passive:!0,capture:!0}),()=>{window.removeEventListener("pointermove",h,!0)}},[d]);let m=_de(u,{...t??f,enabled:!o}),{getFloatingProps:y}=Mde([m]),b=(typeof a=="function"?a():a)??(typeof document>"u"?void 0:document.body);return b?(0,Dde.createPortal)((0,Pde.jsx)("div",{id:r,ref:l.setFloating,role:"tooltip",style:{...xHe,backgroundColor:$w(Ia[700],.9),color:s.common.white,...c,zIndex:1e5,visibility:c.transform==="translate(0px, 0px)"?"hidden":void 0},...y(),children:n}),b):null}),Op=THe});function P_(e){return e<128?Zy[e]:30}function Ude(e){return e===27||e===28}function gm(e){return mm[e]}function zde(e){return P_(e.charCodeAt(0))}function Hde(e,t=e.reduce((o,r)=>Math.max(o,r.length),0)){let o=new y3(t);for(let r of e)o.addRow(r);return o}var Zy,mm,y3,D_,Mv=A(()=>{"use strict";Zy=new Uint8Array(128).fill(30);for(let e=65;e<=90;e++)Zy[e]=e-65+1;for(let e=97;e<=122;e++)Zy[e]=e-97+1;Zy[45]=27;Zy[46]=28;Zy[42]=29;mm=Array.from({length:32},(e,t)=>t>=1&&t<=26?String.fromCharCode(65+t-1):"");mm[27]="-";mm[28]=".";mm[29]="*";mm[30]="?";y3=class{numColumns;counts;totals;slotTotals=new Uint32Array(32);constructor(t){this.numColumns=t,this.counts=new Uint32Array(t*32),this.totals=new Uint32Array(t)}addRow(t){let{counts:o,totals:r,slotTotals:n,numColumns:i}=this,s=Math.min(t.length,i);for(let a=0;a<s;a++){let l=P_(t.charCodeAt(a));o[a*32+l]++,r[a]++,n[l]++}for(let a=s;a<i;a++)o[a*32+27]++,r[a]++;n[27]+=i-s}add(t,o){let r=P_(o.charCodeAt(0));this.counts[t*32+r]++,this.totals[t]++,this.slotTotals[r]++}total(t){return this.totals[t]??0}count(t,o){return this.counts[t*32+P_(o.charCodeAt(0))]??0}gapCount(t){let o=t*32;return(this.counts[o+27]??0)+(this.counts[o+28]??0)}forEachResidue(t,o){let{counts:r}=this,n=t*32;for(let i=1;i<32;i++){let s=r[n+i];s>0&&!Ude(i)&&o(i,s)}}entropy(t){let o=this.total(t)-this.gapCount(t);if(o===0)return 0;let r=0;return this.forEachResidue(t,(n,i)=>{let s=i/o;r-=s*Math.log2(s)}),r}residueEntries(t){let o=[];return this.forEachResidue(t,(r,n)=>{o.push([mm[r],n])}),o}get lettersPresent(){let t=new Set;for(let o=1;o<32;o++)this.slotTotals[o]>0&&!Ude(o)&&t.add(mm[o]);return t}};D_=32});function Gde(e){return Math.log2(e==="amino"?20:4)}function O_(e,t,o){let r=e.total(t),n=r-e.gapCount(t);if(n===0)return[];let i=Math.max(0,o-e.entropy(t))*(n/r);if(i===0)return[];let s=[];return e.forEachResidue(t,(a,l)=>{s.push({letter:gm(a),bits:l/n*i})}),s.sort((a,l)=>a.bits-l.bits||a.letter.localeCompare(l.letter)),s}var k_=A(()=>{"use strict";Mv()});function _i(e,t,o=!1){e.font=e.font.replace(/(?:bold )?[\d.]+px/,`${o?"bold ":""}${t}px`)}var eb=A(()=>{"use strict"});var Jde,_c,Mn,as,I3,F_,x3,L_,Kde,hm,Pv,v3,Qv,N_,Xde,Zde,Vde,jde,$de,tb,DHe,OHe,kHe,NHe,E3,Yde,LHe,b3,C3,Wde,T3,er,qde,U_,ob=A(()=>{for(Jde={grad:.9,turn:360,rad:360/(2*Math.PI)},_c=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Mn=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=Math.pow(10,t)),Math.round(o*e)/o+0},as=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=1),e>o?o:e>t?e:t},I3=function(e){return(e=isFinite(e)?e%360:0)<0?e+360:e},F_=function(e,t){return t===void 0&&(t=0),Mn(e,t)%360},x3=function(e){return{r:as(e.r,0,255),g:as(e.g,0,255),b:as(e.b,0,255),a:as(e.a)}},L_=function(e){return{r:Mn(e.r),g:Mn(e.g),b:Mn(e.b),a:Mn(e.a,3)}},Kde=/^#([0-9a-f]{3,8})$/i,hm=function(e,t){var o=e.charCodeAt(t);return(15&o)+9*(o>>6)},Pv=function(e,t){return hm(e,t)<<4|hm(e,t+1)},v3=[],Qv=0;Qv<256;Qv++)v3.push((Qv<16?"0":"")+Qv.toString(16));N_=function(e){return v3[as(e,0,255)]},Xde=function(e){var t=e.r,o=e.g,r=e.b,n=e.a,i=Math.max(t,o,r),s=i-Math.min(t,o,r),a=s?i===t?(o-r)/s:i===o?2+(r-t)/s:4+(t-o)/s:0;return{h:60*(a<0?a+6:a),s:i?s/i*100:0,v:i/255*100,a:n}},Zde=function(e){var t=e.h,o=e.s,r=e.v,n=e.a;t=t/360*6,o/=100,r/=100;var i=Math.floor(t),s=r*(1-o),a=r*(1-(t-i)*o),l=r*(1-(1-t+i)*o),c=i%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:n}},Vde=function(e){return{h:I3(e.h),s:as(e.s,0,100),l:as(e.l,0,100),a:as(e.a)}},jde=function(e){return{h:F_(e.h),s:Mn(e.s),l:Mn(e.l),a:Mn(e.a,3)}},$de=function(e){return Zde((o=(t=e).s,{h:t.h,s:(o*=((r=t.l)<50?r:100-r)/100)>0?2*o/(r+o)*100:0,v:r+o,a:t.a}));var t,o,r},tb=function(e){return{h:(t=Xde(e)).h,s:(n=(200-(o=t.s))*(r=t.v)/100)>0&&n<200?o*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,o,r,n},DHe=/^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,OHe=/^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,kHe=/^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,NHe=/^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,E3={string:[[function(e){if(!Kde.test(e))return null;var t=e.length;return t<=5?{r:17*hm(e,1),g:17*hm(e,2),b:17*hm(e,3),a:t===5?Mn(17*hm(e,4)/255,2):1}:t===7||t===9?{r:Pv(e,1),g:Pv(e,3),b:Pv(e,5),a:t===9?Mn(Pv(e,7)/255,2):1}:null},"hex"],[function(e){var t=kHe.exec(e)||NHe.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:x3({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=DHe.exec(e)||OHe.exec(e);if(!t)return null;var o,r,n=Vde({h:(o=t[1],r=t[2],r===void 0&&(r="deg"),Number(o)*(Jde[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return $de(n)},"hsl"]],object:[[function(e){var t=e.r,o=e.g,r=e.b,n=e.a,i=n===void 0?1:n;return _c(t)&&_c(o)&&_c(r)?x3({r:Number(t),g:Number(o),b:Number(r),a:Number(i)}):null},"rgb"],[function(e){var t=e.h,o=e.s,r=e.l,n=e.a,i=n===void 0?1:n;if(!_c(t)||!_c(o)||!_c(r))return null;var s=Vde({h:Number(t),s:Number(o),l:Number(r),a:Number(i)});return $de(s)},"hsl"],[function(e){var t=e.h,o=e.s,r=e.v,n=e.a,i=n===void 0?1:n;if(!_c(t)||!_c(o)||!_c(r))return null;var s=(function(a){return{h:I3(a.h),s:as(a.s,0,100),v:as(a.v,0,100),a:as(a.a)}})({h:Number(t),s:Number(o),v:Number(r),a:Number(i)});return Zde(s)},"hsv"]]},Yde=function(e,t){for(var o=0;o<t.length;o++){var r=t[o][0](e);if(r)return[r,t[o][1]]}return[null,void 0]},LHe=function(e){return typeof e=="string"?Yde(e.trim(),E3.string):typeof e=="object"&&e!==null?Yde(e,E3.object):[null,void 0]},b3=function(e,t){var o=tb(e);return{h:o.h,s:as(o.s+100*t,0,100),l:o.l,a:o.a}},C3=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Wde=function(e,t){var o=tb(e);return{h:o.h,s:o.s,l:as(o.l+100*t,0,100),a:o.a}},T3=(function(){function e(t){this.parsed=LHe(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Mn(C3(this.rgba),2)},e.prototype.isDark=function(){return C3(this.rgba)<.5},e.prototype.isLight=function(){return C3(this.rgba)>=.5},e.prototype.toHex=function(){return t=L_(this.rgba),o=t.r,r=t.g,n=t.b,s=(i=t.a)<1?N_(Mn(255*i)):"","#"+N_(o)+N_(r)+N_(n)+s;var t,o,r,n,i,s},e.prototype.toRgb=function(){return L_(this.rgba)},e.prototype.toRgbString=function(){return t=L_(this.rgba),o=t.r,r=t.g,n=t.b,(i=t.a)<1?"rgba("+o+", "+r+", "+n+", "+i+")":"rgb("+o+", "+r+", "+n+")";var t,o,r,n,i},e.prototype.toHsl=function(){return jde(tb(this.rgba))},e.prototype.toHslString=function(){return t=jde(tb(this.rgba)),o=t.h,r=t.s,n=t.l,(i=t.a)<1?"hsla("+o+", "+r+"%, "+n+"%, "+i+")":"hsl("+o+", "+r+"%, "+n+"%)";var t,o,r,n,i},e.prototype.toHsv=function(){return t=Xde(this.rgba),{h:F_(t.h),s:Mn(t.s),v:Mn(t.v),a:Mn(t.a,3)};var t},e.prototype.invert=function(){return er({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),er(b3(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),er(b3(this.rgba,-t))},e.prototype.grayscale=function(){return er(b3(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),er(Wde(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),er(Wde(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(tb(this.rgba).h+t)},e.prototype.alpha=function(t){return typeof t=="number"?er({r:(o=this.rgba).r,g:o.g,b:o.b,a:t}):Mn(this.rgba.a,3);var o},e.prototype.hue=function(t){var o=tb(this.rgba);return typeof t=="number"?er({h:t,s:o.s,l:o.l,a:o.a}):F_(o.h)},e.prototype.isEqual=function(t){return this.toHex()===er(t).toHex()},e})(),er=function(e){return e instanceof T3?e:new T3(e)},qde=[],U_=function(e){e.forEach(function(t){qde.indexOf(t)<0&&(t(T3,E3),qde.push(t))})}});var w3,S3,eAe,tAe=A(()=>{w3=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},S3=function(e){return .2126*w3(e.r)+.7152*w3(e.g)+.0722*w3(e.b)},eAe=function(e){e.prototype.luminance=function(){return t=S3(this.rgba),(o=2)===void 0&&(o=0),r===void 0&&(r=Math.pow(10,o)),Math.round(r*t)/r+0;var t,o,r},e.prototype.contrast=function(t){t===void 0&&(t="#FFF");var o,r,n,i,s,a,l,c=t instanceof e?t:new e(t);return i=this.rgba,s=c.toRgb(),a=S3(i),l=S3(s),o=a>l?(a+.05)/(l+.05):(l+.05)/(a+.05),(r=2)===void 0&&(r=0),n===void 0&&(n=Math.pow(10,r)),Math.floor(n*o)/n+0},e.prototype.isReadable=function(t,o){return t===void 0&&(t="#FFF"),o===void 0&&(o={}),this.contrast(t)>=(a=(s=(r=o).size)===void 0?"normal":s,(i=(n=r.level)===void 0?"AA":n)==="AAA"&&a==="normal"?7:i==="AA"&&a==="large"?3:4.5);var r,n,i,s,a}}});var oAe,rAe=A(()=>{oAe=function(e,t){var o={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var n in o)r[o[n]]=n;var i={};e.prototype.toName=function(s){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(s?.closest){var u=this.toRgb(),f=1/0,p="black";if(!i.length)for(var d in o)i[d]=new e(o[d]).toRgb();for(var m in o){var y=(a=u,l=i[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));y<f&&(f=y,p=m)}return p}},t.string.push([function(s){var a=s.toLowerCase(),l=a==="transparent"?"#0000":o[a];return l?new e(l).toRgb():null},"name"])}});function sAe(e,t){let o=`${e}|${t}`,r=nAe.get(o);if(r!==void 0)return r;let n=er(e);if(!n.isReadable(t)){let s=er(t).luminance()<.5;for(let a=0;a<40&&!n.isReadable(t);a++)n=s?n.lighten(.05):n.darken(.05)}let i=n.toHex();return nAe.set(o,i),i}function z_(e,t){let o=er(e);return o.alpha()===1?o.alpha(t).toRgbString():e}function H_(e){return er(e).darken(.1).toHex()}function G_(e,t){return Object.fromEntries(Object.entries(e).map(t))}function Np(e){let t=iAe.get(e);t||(t=new Map,iAe.set(e,t));let o=e.palette.text.primary;return r=>{if(!r)return o;let n=t.get(r);if(n!==void 0)return n;let i=e.palette.getContrastText(er(r).toHex());return t.set(r,i),i}}function aAe(e,t){if(e.length===0)return t;let o=new Set(e);return t.filter((r,n)=>!o.has(n))}function V_(e,t){if(e.length===0)return t;let o=[],r=0;for(let n of e)n>r&&o.push(t.slice(r,n)),r=n+1;return r<t.length&&o.push(t.slice(r)),o.join("")}function lAe(e,t){let o=[],r=e.length,n=0,i=0,s=-1,a=[];for(let l=0;l<t.length;l++)i<r&&e[i]===l?(t.charCodeAt(l)-45>>>0<=1||(s===n?a.push(t[l]):(a.length>0&&o.push({pos:s,letters:a.join("")}),s=n,a=[t[l]])),i++):n++;return a.length>0&&o.push({pos:s,letters:a.join("")}),o}function B3(e){return e.end-e.start}function j_(...e){}var nAe,iAe,Rc=A(()=>{"use strict";ob();tAe();rAe();U_([oAe,eAe]);nAe=new Map;iAe=new WeakMap});function rb(e){let{dynamicColorSchemeName:t}=e;if(t==="clustalx_protein_dynamic"){let{colClustalX:r}=e;return(n,i)=>r[n][i]}if(t==="blosum62_dynamic"){let{colSimilarity:r}=e;return(n,i)=>r[n][i]}if(t==="percent_identity_dynamic"){let{colConsensus:r}=e;return(n,i)=>{let s=r[n];return i===s.letter?s.color:void 0}}let{colorScheme:o}=e;return(r,n)=>o[n]}function cAe(e){let{dynamicColorSchemeName:t}=e;return t==="clustalx_protein_dynamic"?e.colClustalX:t==="blosum62_dynamic"?e.colSimilarity:t==="percent_identity_dynamic"?e.colConsensus:e.colorScheme}var $_=A(()=>{"use strict"});function Fa({offsetX:e,blockWidth:t,colWidth:o}){return{xStart:Math.max(0,Math.floor(e/o)),xEnd:Math.max(0,Math.ceil((e+t)/o))}}var Dv=A(()=>{"use strict"});function FHe({ctx:e,values:t,color:o,colWidth:r,trackHeight:n,offsetX:i,blockSize:s}){let{xStart:a,xEnd:l}=Fa({offsetX:i,blockWidth:s,colWidth:r});e.fillStyle=o;for(let c=a;c<l&&c<t.length;c++){let f=t[c]*n,p=c*r;e.fillRect(p,n-f,r,f)}}function _3(e,t){let o=e.columnTrackContent.get(t)?.values;return o||(t==="property-conservation"?e.propertyConservation:e.conservation)}function UHe({ctx:e,arcs:t,color:o,colWidth:r,trackHeight:n,offsetX:i,blockSize:s}){if(!t?.length)return;let{xStart:a,xEnd:l}=Fa({offsetX:i,blockWidth:s,colWidth:r}),c=1;for(let f of t)c=Math.max(c,f.end-f.start);let u=n-1;e.lineWidth=1;for(let f of t){if(f.end<a||f.start>l)continue;let p=(f.start+.5)*r,d=(f.end+.5)*r,m=u*Math.sqrt((f.end-f.start)/c);e.strokeStyle=f.color??o,e.beginPath(),e.moveTo(p,n),e.quadraticCurveTo((p+d)/2,n-2*m,d,n),e.stroke()}}function zHe({ctx:e,data:t,colorAt:o,contrastText:r,bgColor:n,drawLetters:i,colWidth:s,rowHeight:a,offsetX:l,blockSize:c}){let{xStart:u,xEnd:f}=Fa({offsetX:l,blockWidth:c,colWidth:s}),p=t?.slice(u,f);for(let d=0;p&&d<p.length;d++){let m=p[d],y=u+d,b=n?o(y,m):void 0,h=y*s;b&&(e.fillStyle=b,e.fillRect(h,0,s,a)),i&&(e.fillStyle=r(b),e.fillText(m,h+s/2,a/2))}}function HHe(e,t=55){let o=1,r=[1,2,5];for(let n=0;o*e<t;n++)o=r[n%3]*10**Math.floor(n/3);return o}function GHe(e,t,o){let r=HHe(o),n=r>1&&e<=0&&t>0?[0]:[],i=Math.max(1,Math.ceil((e+1)/r))*r;for(let s=i;s<=t;s+=r)n.push(s-1);return n}function jHe({ctx:e,numColumns:t,label:o,textColor:r,colWidth:n,trackHeight:i,offsetX:s,blockSize:a}){let{xStart:l,xEnd:c}=Fa({offsetX:s,blockWidth:a,colWidth:n}),u=Math.min(c,t);_i(e,VHe),e.textAlign="center",e.textBaseline="alphabetic",e.fillStyle=r,e.strokeStyle=r,e.lineWidth=1;for(let f of GHe(l,u,n)){let p=o(f);if(p===void 0)continue;let d=(f+.5)*n;e.fillText(p,d,i-uAe-2),e.beginPath(),e.moveTo(d,i-uAe),e.lineTo(d,i),e.stroke()}}function WHe({ctx:e,colStats:t,colorScheme:o,maxBits:r,textColor:n,colWidth:i,trackHeight:s,offsetX:a,blockSize:l}){let{xStart:c,xEnd:u}=Fa({offsetX:a,blockWidth:l,colWidth:i}),f=Math.min(u,t.numColumns),p=s;_i(e,p),e.textAlign="left",e.textBaseline="alphabetic";let d=p*$He;for(let m=c;m<f;m++){let y=O_(t,m,r);if(y.length===0)continue;let b=m*i,h=s;for(let{letter:g,bits:C}of y){let x=C/r*s;if(x<YHe){h-=x;continue}let E=e.measureText(g).width;if(E===0){h-=x;continue}e.fillStyle=o[g]??n,e.save(),e.translate(b,h),e.scale(i/E,x/d),e.fillText(g,0,0),e.restore(),h-=x}}}function R3({model:e,ctx:t,track:o,offsetX:r,offsetY:n=0,theme:i,blockSizeXOverride:s,highResScaleFactorOverride:a}){let{blockSize:l,colWidth:c,highResScaleFactor:u}=e,{id:f,kind:p,height:d,barColor:m,arcColor:y,arcs:b,customColorScheme:h,data:g}=o.model,C=s??l,x=a??u,E=i.palette.text.primary;switch(t.resetTransform(),t.scale(x,x),t.translate(-r,n),p){case"bar":{FHe({ctx:t,values:_3(e,f),color:m??"gray",colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"arc":{UHe({ctx:t,arcs:b,color:y??i.palette.text.primary,colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"logo":{WHe({ctx:t,colStats:e.colStats,colorScheme:e.colorScheme,maxBits:e.alphabetMaxBits,textColor:E,colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"ruler":{let{relativeTo:I,numColumns:T}=e;jHe({ctx:t,numColumns:T,label:I?S=>{let B=e.visibleColToSeqPosOneBased(I,S);return B===void 0?void 0:`${B}`}:S=>`${S+1}`,textColor:E,colWidth:c,trackHeight:d,offsetX:r,blockSize:C});break}case"text":case"reference":{let{bgColor:I,fontSize:T,rowHeight:S,showMsaLetters:B}=e,R=h??e.colorScheme;t.textAlign="center",t.textBaseline="middle",_i(t,T),zHe({ctx:t,data:g,colorAt:p==="reference"?rb(e):(M,Q)=>R[Q.toUpperCase()],contrastText:Np(i),bgColor:I,drawLetters:B,colWidth:c,rowHeight:S,offsetX:r,blockSize:C});break}}t.resetTransform()}function fAe({model:e,ctx:t,offsetX:o,theme:r,blockSizeXOverride:n,highResScaleFactorOverride:i}){let s=0;for(let a of e.turnedOnTracks)R3({model:e,ctx:t,track:a,offsetX:o,offsetY:s,theme:r,blockSizeXOverride:n,highResScaleFactorOverride:i}),s+=a.model.height}var VHe,uAe,$He,YHe,Y_=A(()=>{"use strict";k_();eb();Rc();$_();Dv();VHe=10,uAe=4;$He=.72,YHe=3});function kv(e){let t=navigator.clipboard;if(t?.writeText){t.writeText(e).catch(r=>{console.error("Failed to copy to clipboard:",r)});return}let o=document.createElement("textarea");o.value=e,o.style.position="fixed",o.style.opacity="0",document.body.append(o),o.select(),document.execCommand("copy"),o.remove()}var P3=A(()=>{"use strict"});function Nv({text:e,label:t="Copy to clipboard"}){let[o,r]=(0,Fp.useState)(!1),n=(0,Fp.useRef)(void 0);return(0,Fp.useEffect)(()=>()=>{clearTimeout(n.current)},[]),Fp.default.createElement(tt,{variant:"contained",color:"primary",onClick:()=>{kv(typeof e=="string"?e:e()),r(!0),clearTimeout(n.current),n.current=setTimeout(()=>{r(!1)},500)}},o?"Copied!":t)}var Fp,D3=A(()=>{"use strict";Fp=w(D(),1);We();P3()});var hAe={};Hn(hAe,{default:()=>nGe});var Mc,oGe,rGe,nGe,yAe=A(()=>{"use strict";Mc=w(D(),1);is();ln();We();Ie();D3();oGe=$t()(e=>({textArea:{padding:e.spacing(2),overflow:"auto",background:e.palette.action.selected,wordBreak:"break-word"}})),rGe=z(function({model:e,onClose:t}){let{name:o,data:r}=e,{classes:n}=oGe();return Mc.default.createElement(cr,{open:!0,onClose:t,fullWidth:!0,maxWidth:"lg",title:`Track info - ${o}`},Mc.default.createElement(Jo,null,r===void 0?Mc.default.createElement(ve,null,"This track has no text data."):Mc.default.createElement(Mc.default.Fragment,null,Mc.default.createElement(Nv,{text:r}),Mc.default.createElement("pre",{className:n.textArea},r))),Mc.default.createElement(es,null,Mc.default.createElement(tt,{variant:"contained",onClick:t,color:"secondary"},"Close")))}),nGe=rGe});var ib,dGe,IAe,wAe=A(()=>{"use strict";ib=w(D(),1);We();Ie();dGe=z(function({model:t}){let[o,r]=(0,ib.useState)(),n=o??t.allowedGappyness;return ib.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8}},ib.default.createElement(ve,{style:{whiteSpace:"nowrap"}},"\u2265",n,"% gaps"),ib.default.createElement(KB,{"data-testid":"gappyness_slider",style:{width:200,marginInline:10},min:1,max:100,value:n,onChange:(i,s)=>{r(s)},onChangeCommitted:(i,s)=>{t.setAllowedGappyness(s),r(void 0)}}))}),IAe=dGe});var k3={};Hn(k3,{default:()=>mGe});var ym,AGe,mGe,N3=A(()=>{"use strict";ym=w(D(),1);is();We();Ie();wAe();AGe=z(function({model:e,onClose:t}){return ym.default.createElement(cr,{open:!0,onClose:t,title:"Hide gappy columns"},ym.default.createElement(Jo,null,ym.default.createElement(ve,{variant:"body2",sx:{mb:2}},"The viewer hides each column where at least this share of the rows has a gap."),ym.default.createElement(IAe,{model:e})),ym.default.createElement(es,null,ym.default.createElement(tt,{variant:"contained",onClick:t},"Close")))}),mGe=AGe});function NAe(e){return!!e&&/(^|[_ ])site$/i.test(e)}function z3(e){return Math.min(Math.max(6,e-3),18)}var L3,F3,LAe,FAe,UAe,zAe,HAe,GAe,U3,VAe,jAe,$Ae,K_,X_,Z_,bm,eR,YAe,tR,WAe,qAe,JAe,oR,KAe,XAe,ZAe,eme,rR,tme,ome,rme,nme,ime,sme,sb,ame,lme,cme,nR,iR,Zu,ume,H3,fme,Or=A(()=>{"use strict";L3=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR","intron"]),F3=["#9fb6d4","#d4dcea"];LAe=["#8fb3d9","#f2b277","#9fd18f","#c3a5d9","#ee9f9f","#d4c08f","#8fd1cb"],FAe=["#0f6e52","#a84a00","#5a54a0","#3f6b12","#7a5514"],UAe=!0,zAe=!1,HAe=["both","horizontal","vertical"],GAe="both",U3=8,VAe=5,jAe=2e3,$Ae=9;K_=z3(16),X_=.2,Z_=.2,bm=80,eR=280,YAe=!0,tR="maeditor",WAe=!0,qAe=!0,JAe=!1,oR=70,KAe=160,XAe=10,ZAe=.3,eme=!0,rR=["branchLength","input","ladderize","ladderizeReverse"],tme="branchLength",ome=!0,rme=!0,nme=!1,ime=!1,sme=120,sb=500,ame=.25,lme="#fff3c4",cme=.6,nR=5e4,iR=56,Zu=22,ume=200,H3=1e3,fme=H3+1});function G3(e){let t=new Set(e.collapsed);return e.leaves.filter(({data:{id:o,name:r}})=>!(t.has(o)&&r===o)).map(o=>o.data.name)}function dme(e,t,o=50){let r=t.toLowerCase();return e.filter(n=>n.toLowerCase().includes(r)).slice(0,o)}function bGe(e,t){let o=t.trim(),r=e.rowNamesSet.get(o);if(r!==void 0)return{row:r};let n=/^(.+):(\d+)$/.exec(o);if(n){let[,i="",s]=n,a=e.rowNamesSet.get(i),l=a===void 0?void 0:pme(e,i,+s);return l===void 0?void 0:{row:a,col:l}}if(/^\d+$/.test(o)){let i=+o,{relativeTo:s,numColumns:a}=e,l=s?pme(e,s,i):i>=1&&i<=a?i-1:void 0;return l===void 0?void 0:{col:l}}}function pme(e,t,o){let r=e.seqPosIndex(t)?.[o-1];return r===void 0?void 0:e.globalColToVisibleCol(r)}function Ame(e,t){let o=bGe(e,t);if(o){let{row:r,col:n}=o,{rowHeight:i,colWidth:s,msaAreaHeight:a,msaAreaWidth:l}=e;r!==void 0&&e.setScrollY(-(r+.5)*i+a/2),n!==void 0&&e.setScrollX(-(n+.5)*s+l/2),e.setMousePos(n,r)}return o!==void 0}var mme=A(()=>{"use strict"});function CGe(e){let{slotProps:t,inputProps:o}=e;return t?{slotProps:{...t,htmlInput:{...t.htmlInput,"aria-label":gme}}}:{inputProps:{...o,"aria-label":gme}}}function xGe(e){e&&requestAnimationFrame(()=>{e.focus()})}function hme(e){return G3(e).length>1||e.numColumns>0}var zv,gme,vGe,yme,V3=A(()=>{"use strict";zv=w(D(),1);We();Ie();mme();gme="Go to row or column";vGe=z(function({model:e,onFound:t}){let[o,r]=(0,zv.useState)(!1);return zv.default.createElement(FS,{freeSolo:!0,options:G3(e),filterOptions:(n,{inputValue:i})=>dme(n,i),value:null,blurOnSelect:!0,onInputChange:()=>{r(!1)},onChange:(n,i)=>{if(i){let s=Ame(e,i);r(!s),s&&t?.()}},renderInput:n=>zv.default.createElement(an,{...n,inputRef:xGe,error:o,placeholder:"Row name or column number",helperText:o?"No row or column matches":"Or name:N for residue N of that row",...CGe(n)})})}),yme=vGe});var xme={};Hn(xme,{default:()=>_Ge});function IGe(e,t){return[e.accession,e.name,e.description].some(o=>o?.toLowerCase().includes(t))}var Yt,wGe,SGe,BGe,_Ge,vme=A(()=>{"use strict";Yt=w(D(),1);is();We();Ie();wGe=z(function({model:e,accessions:t}){let o=r=>{for(let n of t)e.setFilter(n,r)};return Yt.default.createElement("div",null,Yt.default.createElement(tt,{onClick:()=>{o(!0)}},"Toggle all on"),Yt.default.createElement(tt,{onClick:()=>{o(!1)}},"Toggle all off"))}),SGe=z(function({model:e}){let{annotationTypes:t,annotations:o,featureColors:r,fillPalette:n}=e,[i,s]=(0,Yt.useState)(""),a=i.trim().toLowerCase(),l=[...t.values()].filter(f=>!a||IGe(f,a)),c=new Map,u=new Map;for(let f of o){let{accession:p}=f;c.set(p,(c.get(p)??0)+1),u.has(p)||u.set(p,r.get(f)?.fill??n[p])}return Yt.default.createElement(Yt.default.Fragment,null,Yt.default.createElement(an,{label:"Filter",size:"small",value:i,onChange:f=>{s(f.target.value)}}),Yt.default.createElement(wGe,{model:e,accessions:l.map(f=>f.accession)}),Yt.default.createElement(fy,{size:"small"},Yt.default.createElement(r1,null,Yt.default.createElement(VA,null,Yt.default.createElement(sn,{padding:"checkbox"}),Yt.default.createElement(sn,null,"color"),Yt.default.createElement(sn,null,"accession"),Yt.default.createElement(sn,null,"name"),Yt.default.createElement(sn,null,"count"),Yt.default.createElement(sn,null,"description"))),Yt.default.createElement(py,null,l.map(({accession:f,name:p,description:d})=>Yt.default.createElement(VA,{key:f},Yt.default.createElement(sn,{padding:"checkbox"},Yt.default.createElement(Ra,{checked:!e.featureOff(f),onChange:()=>{e.setFilter(f,e.featureOff(f))}})),Yt.default.createElement(sn,null,Yt.default.createElement("div",{style:{width:20,height:20,background:u.get(f)}})),Yt.default.createElement(sn,null,f),Yt.default.createElement(sn,null,p),Yt.default.createElement(sn,null,c.get(f)),Yt.default.createElement(sn,null,d))))))}),BGe=z(function({onClose:e,model:t}){return Yt.default.createElement(cr,{onClose:()=>{e()},open:!0,title:"Feature filters",maxWidth:"xl"},Yt.default.createElement(Jo,null,Yt.default.createElement(SGe,{model:t})))}),_Ge=BGe});function zp(e,t="node",o=0){let r=(s,a)=>({...s,id:a,name:s.name||a,children:[]}),n=r(e,`${t}-${o}`),i=[{src:e,out:n,depth:o}];for(;i.length>0;){let{src:s,out:a,depth:l}=i.pop();if(s.children){a.children=s.children.map((c,u)=>r(c,`${a.id}-${u}-${l+1}`));for(let[c,u]of s.children.entries())i.push({src:u,out:a.children[c],depth:l+1})}}return n}var Y3=A(()=>{"use strict"});var $s,ab=A(()=>{"use strict";$s=class{rows=new Map;names;width;constructor(t){for(let[o,r]of t)this.rows.has(o)||this.rows.set(o,r);this.names=[...this.rows.keys()]}getRow(t){return this.rows.get(t)??""}getNames(){return this.names}getWidth(){return this.width??=this.getNames().reduce((t,o)=>Math.max(t,this.getRow(o).length),0),this.width}getTree(){return{id:"root",name:"root",noTree:!0,children:this.getNames().map(t=>({id:t,children:[],name:t}))}}getRowData(t){}getStructures(){return{}}getHeader(){return{}}get alignmentNames(){return[]}get seqConsensus(){}get secondaryStructureConsensus(){}get tracks(){return[]}get annotations(){return[]}}});function aR(e){return/^(#.*\n)*>/.test(e)}function W3(e){let t=[],o=new Set,r,n=()=>{r&&!o.has(r.id)&&(o.add(r.id),t.push({id:r.id,seq:r.lines.join("").replaceAll(/\s/g,"")}))},i=0;for(let s of e.split(`
615
615
  `))s.startsWith(">")?(n(),i++,r={id:/^>\s*(\S*)/.exec(s)[1]||`unnamed_${i}`,lines:[]}):r?.lines.push(s);return n(),t}function Hv(e){return typeof e=="string"?W3(e):e}var lR=A(()=>{"use strict"});function Eme(e){return e>=QGe&&e<=PGe}function Tme(e){return e>=RGe&&e<=MGe||e===DGe}function OGe(e){let t=[],o=[""];for(let r of e){let n=r.charCodeAt(0);Tme(n)?(t.push(r),o.push("")):Eme(n)&&(o[o.length-1]+=r.toUpperCase())}return{matches:t,inserts:o}}function kGe(e){let t=e.map(OGe),o=0;for(let{matches:n}of t)o=Math.max(o,n.length);let r=new Array(o+1).fill(0);for(let{inserts:n}of t)for(let[i,s]of n.entries())r[i]=Math.max(r[i],s.length);return t.map(({matches:n,inserts:i})=>{let s=[];for(let a=0;a<=o;a++){let l=i[a]??"";s.push(l,".".repeat(r[a]-l.length)),a<o&&s.push(n[a]??"-")}return s.join("")})}var RGe,MGe,QGe,PGe,DGe,ef,q3=A(()=>{"use strict";ab();lR();RGe=65,MGe=90,QGe=97,PGe=122,DGe=45;ef=class extends $s{constructor(t){let o=Hv(t),r=kGe(o.map(n=>n.seq));super(o.map((n,i)=>[n.id,r[i]]))}static sniff(t){if(typeof t=="string"&&!aR(t))return!1;let o=Hv(t).map(i=>i.seq).filter(i=>!!i);if(o.length<2||new Set(o.map(i=>i.length)).size===1)return!1;let r=!1,n;for(let i of o){let s=0;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);Tme(l)?s++:Eme(l)&&(r=!0)}if(n!==void 0&&s!==n)return!1;n=s}return r}}});function NGe(e){let t=/\(?(\d+(\.\d+)+)\)?/.exec(e);return t&&t.length>1?t[1]:""}function wme(e){let t=["CLUSTAL","PROBCONS","MUSCLE","MSAPROBS","Kalign"];t.some(r=>e.startsWith(r))||console.warn(`${e} is not a known CLUSTAL header: ${t.join(",")}, proceeding but could indicate an issue`);let o=NGe(e);return{info:e,version:o}}function J3(e){let t=e.next();for(;!t.done&&t.value.trim()==="";)t=e.next();return t.value}function LGe(e){let t=e.split(/\s+/),o=e.slice(t[0].length),r=t[0].length+o.indexOf(t[1]),n=r+t[1].length;return[r,n]}function Ime(e){let t=J3(e),o=[],r="";if(!t)return;for(;t;)t.startsWith(" ")?r=t:o.push(t),t=e.next().value;let[n,i]=LGe(o[0]),a=o.map(f=>f.split(/\s+/)).map(f=>f[0]),l=o.map(f=>f.slice(n,i)),c=r.slice(n,i),u=l[0].length-c.length;return u&&(c+=" ".repeat(u)),{ids:a,seqs:l,consensus:c}}function Sme(e){let t,o=Ime(e);if(o!==void 0)for(;t=Ime(e);){for(let r=0;r<t.seqs.length;r++)o.seqs[r]+=t.seqs[r];o.consensus+=t.consensus}return o}var Bme=A(()=>{});function FGe(e){let t=J3(e);if(!t)throw new Error("Empty file received");let o=wme(t),r=Sme(e);if(r===void 0)throw new Error("No blocks parsed");let n=r.seqs.map((s,a)=>({id:r.ids[a],seq:s})),{consensus:i}=r;if(i.length!==n[0].seq.length)throw new Error(`Consensus length != sequence length. Con ${i.length} seq ${n[0].seq.length}`);return{consensus:i,alns:n,header:o}}function _me(e){let t=e.split(`
616
616
  `)[Symbol.iterator]();return FGe(t)}var Rme=A(()=>{Bme()});var Hp,K3=A(()=>{"use strict";Rme();ab();Hp=class extends $s{MSA;constructor(t){let o=_me(t);super(o.alns.map(r=>[r.id,r.seq])),this.MSA=o}getHeader(){return this.MSA.header}get seqConsensus(){return this.MSA.consensus}}});function Mme(e){let t=e.split(`
617
617
  `).map(i=>i.trim()).filter(i=>!!i),o=[],r=[];for(let i of t)if(i.startsWith("SEQ"))o.push(i);else{if(i.startsWith("DATA"))continue;if(i.startsWith("//"))break;r.push(i)}let n=o.map(i=>{let[,s,a,l,c,u,f,p,d]=i.split(" ");return{species:s,protein:a,chr:l,start:+c,end:+u,strand:+f,geneId:p,unknown:d,seq:""}});for(let i of r)for(let s=0;s<o.length;s++)n[s].seq+=i[s];return n}function cR(e){let t=e.split(`
@@ -620,7 +620,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
620
620
  `).trimStart();if(rVe.test(r))throw new Error("Received an HTML page, not an alignment. Check that the URL points at the file itself");if(o==="stockholm")return new jp(r,t);if(o==="a3m")return new ef(r);if(o==="fasta")return new Vp(r);if(o==="emf")return new Gp(r);if(o==="clustal")return new Hp(r);if(Vv(r))return new jp(r,t);if(aR(r)){let i=W3(r);return ef.sniff(i)?new ef(i):new Vp(i)}if(r.startsWith("SEQ"))return new Gp(r);if(nVe.test(r))return new Hp(r);let n=r.split(`
621
621
  `,1)[0].slice(0,80);throw new Error(n?`Unrecognized alignment format: expected FASTA, A3M, Stockholm, Clustal or EMF, but the first line reads "${n}"`:"The alignment file is empty")}function l4(e){return e.replaceAll(/[.-]/g,"")}var rVe,nVe,Ume=A(()=>{"use strict";q3();K3();Z3();e4();s4();lR();X3();n4();q3();K3();Z3();e4();s4();rVe=/^<(!doctype\s+html|html[\s>])/i,nVe=/^(CLUSTAL|MUSCLE|PROBCONS|MSAPROBS|Kalign)/i});function c4(e){return Object.fromEntries(e.map(t=>[t.xref[0]?.id,t]).filter(t=>t[0]!==void 0))}function u4(e){return Object.entries(e).flatMap(([t,{matches:o}])=>o.flatMap(({signature:r,locations:n})=>{let{entry:i}=r,s=i?.accession??r.accession;if(!s)return[];let a=i?.name??r.name??s;return n.map(({start:l,end:c,strand:u})=>({id:t,accession:s,name:a,description:i?.description??r.description??a,start:l,end:c,strand:u}))}))}function f4(e){return u4(c4(e.results))}var dR=A(()=>{"use strict"});function zme(e){try{return decodeURIComponent(e)}catch{return e}}function iVe(e){return e.replace(/^"(.*)"$/,"$1")}function sVe(e){if(!e)return{};let t={};for(let o of e.split(";")){let r=o.indexOf("="),n=o.slice(0,r).trim(),i=o.slice(r+1);r!==-1&&n&&i&&(t[n]=i.split(",").map(s=>iVe(zme(s).trim())).join(" "))}return t}function AR(e){if(!e)return[];let t=[];for(let o of e.split(`
622
622
  `)){let r=o.trim();if(r.startsWith("##FASTA"))break;r&&!r.startsWith("#")&&r.split(" ").length>=8&&t.push(r)}return t.map(o=>{let r=o.split(" "),[n,i,s,a,l,c,u,f]=r,p=r[8];return{...sVe(p),seq_id:zme(n??""),source:i??"",type:s??"",start:Number(a)||0,end:Number(l)||0,score:Number(c)||0,strand:u??".",phase:f??"."}})}var Hme=A(()=>{"use strict"});function lVe({type:e,strand:t}){let o=t==="+"?1:t==="-"?-1:void 0;return aVe.has(e)?o:void 0}function uVe(e){let t=Object.entries(e).filter(([o,r])=>!cVe.has(o)&&typeof r=="string");return t.length>0?Object.fromEntries(t):void 0}function pVe(e){let t=e.color??e.colour??e.Color??e.Colour;if(!t)return;let o=fVe.exec(t.trim());return o?`rgb(${o[1]},${o[2]},${o[3]})`:t.trim()}function mR(e){return e.filter(t=>!dVe.has(t.type)).map(t=>{let o=t.Name||t.ID||`${t.source}_${t.start}_${t.end}`,r=t.signature_desc||t.Name||o;return{id:t.seq_id,accession:o,name:r,description:t.description||t.Note||t.signature_desc||r,featureType:t.type,start:t.start,end:t.end,strand:lVe(t),color:pVe(t),attributes:uVe(t)}})}var aVe,cVe,fVe,dVe,Gme=A(()=>{"use strict";aVe=new Set(["gene","CDS","pseudogene","mRNA","transcript","primary_transcript","ncRNA","tRNA","rRNA","snRNA","snoRNA","miRNA","lnc_RNA"]);cVe=new Set(["seq_id","source","type","start","end","score","strand","phase"]);fVe=/^(\d{1,3})[\s,]+(\d{1,3})[\s,]+(\d{1,3})$/;dVe=new Set(["polypeptide","nucleic_acid"])});function jv(e,t=[]){return["##gff-version 3",...t.map(o=>`# ${o}`),...e.map(o=>{let{accession:r,name:n,description:i,featureType:s}=o,{id:a,start:l,end:c,strand:u}=o;return[a.replaceAll(/[%\t\n\r]/g,encodeURIComponent),"InterProScan",s??"protein_match",l,c,".",u===void 0?".":u>0?"+":"-",".",[`Name=${encodeURIComponent(r)}`,`signature_desc=${encodeURIComponent(n)}`,`description=${encodeURIComponent(i)}`].join(";")].join(" ")})].join(`
623
- `)}var gR=A(()=>{"use strict"});var Vme=A(()=>{"use strict";dR();gR()});var jme=A(()=>{"use strict";Hme();Gme();gR();Vme()});function p4(e){let t=e.trimStart();if(!t.startsWith("{"))return e;let o=JSON.parse(t);return jv(f4(o))}var $me=A(()=>{"use strict";dR();gR()});var $v=A(()=>{"use strict";Y3();Ume();dR();jme();$me()});var Yme={};Hn(Yme,{default:()=>bVe});async function hVe(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} fetching ${e} ${await t.text()}`);return t.text()}var no,gVe,yVe,bVe,Wme=A(()=>{"use strict";no=w(D(),1);is();We();Ie();$v();gVe="https://gmod.org/JBrowseMSA/tutorials/protein_family";yVe=z(function({handleClose:e,model:t}){let[o,r]=(0,no.useState)(),[n,i]=(0,no.useState)("file"),[s,a]=(0,no.useState)(""),[l,c]=(0,no.useState)(),[u,f]=(0,no.useState)(!1);return no.default.createElement(cr,{maxWidth:"xl",title:"Open annotation file",onClose:()=>{e()},open:!0},no.default.createElement(Jo,null,l?no.default.createElement(Ic,{error:l}):null,no.default.createElement(ve,null,"Open a GFF3 file of annotations, such as the one `react-msaview-cli interpro` writes, or the JSON an InterProScan run returns."," ",no.default.createElement(Si,{href:gVe,target:"_blank",rel:"noopener noreferrer"},"How to make one")),no.default.createElement("div",{style:{display:"flex",margin:30}},no.default.createElement(hc,{component:"fieldset"},no.default.createElement(ay,{value:n,onChange:p=>{i(p.target.value)}},no.default.createElement(Zn,{value:"url",control:no.default.createElement(yc,null),label:"URL"}),no.default.createElement(Zn,{value:"file",control:no.default.createElement(yc,null),label:"File"}))),n==="url"?no.default.createElement("div",null,no.default.createElement(ve,null,"Open an annotation file from a URL"),no.default.createElement(an,{label:"URL",value:s,onChange:p=>{a(p.target.value)}})):no.default.createElement("div",{style:{paddingTop:20}},no.default.createElement(ve,null,"Open an annotation file from your local drive"),no.default.createElement(tt,{variant:"outlined",component:"label"},"Choose File",no.default.createElement("input",{type:"file",hidden:!0,onChange:({target:p})=>{let d=p.files?.[0];d&&r(d)}})),o?no.default.createElement(ve,null,o.name):null))),no.default.createElement(es,null,no.default.createElement(tt,{variant:"contained",color:"primary",disabled:u||(n==="file"?!o:!s.trim()),onClick:()=>{(async()=>{f(!0),c(void 0);try{let p=await(n==="file"&&o?o.text():hVe(s));t.setGFFFilehandle(void 0),t.setGFF(p4(p)),t.setShowDomains(!0),t.setCellFill("domain"),e()}catch(p){console.error(p),c(p)}finally{f(!1)}})()}},"Open annotations"),no.default.createElement(tt,{variant:"contained",color:"secondary",onClick:()=>{e()}},"Cancel")))}),bVe=yVe});var hR,A4=A(()=>{"use strict";hR="9.6.0"});var m4={};Hn(m4,{default:()=>Kme});function Kme({onClose:e}){return $r.default.createElement(cr,{open:!0,title:"About",onClose:()=>{e()}},$r.default.createElement(Jo,null,$r.default.createElement(ve,null,"MSAView ",hR," (",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://github.com/gmod/react-msaview"},"Github"),")"),$r.default.createElement("ul",null,$r.default.createElement("li",null,$r.default.createElement(ve,null,"We use some color schemes from the"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://github.com/biotite-dev/biotite"},"biotite")," ","project, and their license is reproduced"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://github.com/biotite-dev/biotite/blob/master/LICENSE.rst"},"here"))),$r.default.createElement("li",null,$r.default.createElement(ve,null,"See this page for some information on jalview colorings"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://www.jalview.org/help/html/colourSchemes/"},"here"))),$r.default.createElement("li",null,$r.default.createElement(ve,null,"See this page for some info on the clustal, cinema, maeditor, and lesk color schemes"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"http://www.bioinformatics.nl/~berndb/aacolour.html"},"here"))),$r.default.createElement("li",null,$r.default.createElement(ve,null,"See this paper about the flower color scheme"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7245768/"},"here"))))))}var $r,g4=A(()=>{"use strict";$r=w(D(),1);is();We();A4()});function vm(e){let t=e.length>1;return e.flatMap(o=>[...t?[{key:o.id,label:o.title}]:[],...o.entries.map(r=>({key:`${o.id}:${r.id}`,label:r.label,color:r.color,hint:r.id}))])}var yR=A(()=>{"use strict"});function IVe(e){let t=e.reduce((r,n)=>Math.max(r,n.label.length),0),o=bR+of+t*y4;return Math.min(TVe,Math.max(120,o))}function b4(e){return of*2+e.length*h4}function CR(e,t){let{scrollX:o,scrollY:r,totalWidth:n,totalHeight:i,effectiveTreeAreaWidth:s,rowPanelsWidth:a,rowPanelsHeaderHeight:l,totalTrackAreaHeight:c,minimapHeight:u,msaAreaHeight:f,msaCanvasWidth:p,showHorizontalScrollbar:d,treeOverviewHeight:m,treeScaleBar:y}=e,b=t.includeTracks?c:0,h=t.exportType==="viewport"&&!!t.includeMinimap&&d,g=vm(e.legends),C=g.length>0?IVe(g):0,x=Math.max(h?u:0,l,m+(y?Zu:0)),E=s+a;return t.exportType==="entire"?{width:n+E,msaAreaWidth:n,height:i+b+x,contentHeight:i,trackHeight:b,topHeight:x,offsetX:0,offsetY:0,includeMinimap:h,legendWidth:C}:{width:p+E,msaAreaWidth:p,height:f+x+b,contentHeight:f,trackHeight:b,topHeight:x,offsetX:-o,offsetY:-r,includeMinimap:h,legendWidth:C}}function xR(e,t){let{width:o,height:r,legendWidth:n,topHeight:i}=t;return{width:o+n,height:n>0?Math.max(r,i+b4(vm(e.legends))):r}}var of,h4,Yv,Xme,y4,TVe,bR,C4=A(()=>{"use strict";yR();Or();of=8,h4=16,Yv=12,Xme=12,y4=7,TVe=360,bR=of+Yv+6});function Em({checked:e,label:t,disabled:o,onChange:r}){return vR.default.createElement("div",null,vR.default.createElement(Zn,{control:vR.default.createElement(Ra,{disabled:o,checked:e,onChange:()=>{r()}}),label:t}))}var vR,x4=A(()=>{"use strict";vR=w(D(),1);We()});var Zme={};Hn(Zme,{default:()=>BVe});function wVe(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Oo,SVe,BVe,ege=A(()=>{"use strict";Oo=w(D(),1);is();We();Ie();C4();x4();SVe=z(function({model:e,onClose:t}){let[o,r]=(0,Oo.useState)(!0),[n,i]=(0,Oo.useState)(!0),[s,a]=(0,Oo.useState)("viewport"),[l,c]=(0,Oo.useState)(),[u,f]=(0,Oo.useState)(!1),p=Jt(),{turnedOnTracks:d,numColumns:m,leaves:y,showMsaLetters:b}=e,h=d.length>0,g=xR(e,CR(e,{theme:p,exportType:"entire",includeTracks:n})),C=b&&s==="entire"?m*y.length:0,x=C>1e5;return Oo.default.createElement(cr,{onClose:()=>{t()},open:!0,title:"Export SVG"},Oo.default.createElement(Jo,null,l?Oo.default.createElement(Ic,{error:l}):null,Oo.default.createElement(ve,null,"Settings:"),Oo.default.createElement(Em,{label:"Include minimap?",disabled:s==="entire",checked:o,onChange:()=>{r(!o)}}),h?Oo.default.createElement(Em,{label:"Include tracks?",checked:n,onChange:()=>{i(!n)}}):null,Oo.default.createElement("div",null,Oo.default.createElement(hc,null,Oo.default.createElement(oy,null,"Export type"),Oo.default.createElement(ay,{value:s,onChange:E=>{let{value:I}=E.target;(I==="entire"||I==="viewport")&&a(I)}},Oo.default.createElement(Zn,{value:"entire",control:Oo.default.createElement(yc,null),label:"Entire MSA"}),Oo.default.createElement(Zn,{value:"viewport",control:Oo.default.createElement(yc,null),label:"Current viewport only"})))),x?Oo.default.createElement(AS,{severity:"warning",style:{marginTop:8}},"The entire MSA is ",Math.round(g.width),"x",Math.round(g.height)," pixels and draws"," ",Math.round(C/1e3),"k residue letters, each its own SVG element. Export may be slow or fail \u2014 zooming out far enough to hide the letters exports the same alignment as an image instead."):null),Oo.default.createElement(es,null,Oo.default.createElement(tt,{variant:"contained",color:"primary",disabled:u,startIcon:u?Oo.default.createElement(wa,{size:16,color:"inherit"}):null,onClick:()=>{f(!0),wVe(()=>{e.exportSVG({theme:p,includeMinimap:o,includeTracks:h&&n,exportType:s}).then(()=>{t()}).catch(E=>{console.error(E),c(E)}).finally(()=>{f(!1)})})}},u?"Exporting\u2026":"Export"),Oo.default.createElement(tt,{variant:"contained",color:"secondary",onClick:()=>{t()}},"Cancel")))}),BVe=SVe});var oge={};Hn(oge,{default:()=>tge});function tge({model:e,onClose:t}){return ER.default.createElement(cr,{open:!0,onClose:t,title:"Go to row or column",maxWidth:"xs",fullWidth:!0},ER.default.createElement(Jo,null,ER.default.createElement(yme,{model:e,onFound:t})))}var ER,rge=A(()=>{"use strict";ER=w(D(),1);is();We();V3()});var nge,v4,ige,sge,age,E4=A(()=>{"use strict";nge=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],v4=[{label:"Arrow keys",action:"Scroll one cell",keys:nge},{label:"Shift + arrow keys",action:"Scroll one page",keys:nge,shiftKey:!0},{label:"+ and -",action:"Zoom in and out",keys:["+","=","-"]},{label:"0",action:"Reset to the default cell size",keys:["0"]},{label:"Home and End",action:"Jump to the first and last column",keys:["Home","End"]},{label:"Escape",action:"Clear the selection",keys:["Escape"]}],ige={label:"Shift + drag",action:"Select a block of cells"},sge=[{label:"Drag",action:"Pan the alignment"},{label:"Wheel",action:"Scroll, or zoom with Zoom on scroll checked"},{label:"Ctrl + wheel",action:"Zoom at the cursor"},ige,{label:"Drag along a track",action:"Select a range of columns across every row"},{label:"Click a tree node",action:"Collapse, rotate, reroot or show only that clade"},{label:"Click the tree overview",action:"Show only the clade under the pointer"},{label:"Drag a divider",action:"Resize the tree area or a track"}],age=["Alignment",...[...v4,ige].map(e=>`${e.label}: ${e.action}`)].join(". ")});var uge={};Hn(uge,{default:()=>cge});function lge({title:e,rows:t}){return Yr.default.createElement(Yr.default.Fragment,null,Yr.default.createElement(ve,{variant:"subtitle2",sx:{mt:1}},e),Yr.default.createElement(fy,{size:"small","aria-label":e},Yr.default.createElement(py,null,t.map(({label:o,action:r})=>Yr.default.createElement(VA,{key:o},Yr.default.createElement(sn,{sx:{whiteSpace:"nowrap",fontWeight:500}},o),Yr.default.createElement(sn,null,r))))))}function cge({model:e,onClose:t}){return Yr.default.createElement(cr,{open:!0,title:"Mouse & keyboard",onClose:t},Yr.default.createElement(Jo,null,Yr.default.createElement(lge,{title:"Mouse",rows:sge}),Yr.default.createElement(lge,{title:"Keyboard (click the alignment first)",rows:v4})),Yr.default.createElement(es,null,Yr.default.createElement(ve,{variant:"caption",sx:{mr:"auto",pl:1}},"MSAView ",hR),Yr.default.createElement(tt,{onClick:()=>{e.queueDialog(o=>[_Ve,{onClose:o}]),t()}},"About & credits"),Yr.default.createElement(tt,{variant:"contained",onClick:t},"Close")))}var Yr,_Ve,fge=A(()=>{"use strict";Yr=w(D(),1);is();We();A4();E4();_Ve=(0,Yr.lazy)(()=>Promise.resolve().then(()=>(g4(),m4)))});function Wv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!rf.default.isValidElement(e)}function T4(e){return Wv(e)&&Object.keys(e).length===0}function nf({record:e,labels:t={},monospaceKeys:o}){let{classes:r,cx:n}=RVe();return rf.default.createElement("dl",{className:r.list},Object.entries(e).filter(([,i])=>i!=null&&!T4(i)).map(([i,s])=>{let a=t[i],l=Wv(s);return rf.default.createElement("div",{key:i,className:r.row},rf.default.createElement("dt",{className:r.key},a??i,a&&a!==i?rf.default.createElement("span",{className:r.code},i):null),rf.default.createElement("dd",{className:n(r.value,l&&r.nested,o?.has(i)&&r.mono)},l?rf.default.createElement(nf,{record:s,labels:t,monospaceKeys:o}):Array.isArray(s)?s.join(`
623
+ `)}var gR=A(()=>{"use strict"});var Vme=A(()=>{"use strict";dR();gR()});var jme=A(()=>{"use strict";Hme();Gme();gR();Vme()});function p4(e){let t=e.trimStart();if(!t.startsWith("{"))return e;let o=JSON.parse(t);return jv(f4(o))}var $me=A(()=>{"use strict";dR();gR()});var $v=A(()=>{"use strict";Y3();Ume();dR();jme();$me()});var Yme={};Hn(Yme,{default:()=>bVe});async function hVe(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status} fetching ${e} ${await t.text()}`);return t.text()}var no,gVe,yVe,bVe,Wme=A(()=>{"use strict";no=w(D(),1);is();We();Ie();$v();gVe="https://gmod.org/JBrowseMSA/tutorials/protein_family";yVe=z(function({handleClose:e,model:t}){let[o,r]=(0,no.useState)(),[n,i]=(0,no.useState)("file"),[s,a]=(0,no.useState)(""),[l,c]=(0,no.useState)(),[u,f]=(0,no.useState)(!1);return no.default.createElement(cr,{maxWidth:"xl",title:"Open annotation file",onClose:()=>{e()},open:!0},no.default.createElement(Jo,null,l?no.default.createElement(Ic,{error:l}):null,no.default.createElement(ve,null,"Open a GFF3 file of annotations, such as the one `react-msaview-cli interpro` writes, or the JSON an InterProScan run returns."," ",no.default.createElement(Si,{href:gVe,target:"_blank",rel:"noopener noreferrer"},"How to make one")),no.default.createElement("div",{style:{display:"flex",margin:30}},no.default.createElement(hc,{component:"fieldset"},no.default.createElement(ay,{value:n,onChange:p=>{i(p.target.value)}},no.default.createElement(Zn,{value:"url",control:no.default.createElement(yc,null),label:"URL"}),no.default.createElement(Zn,{value:"file",control:no.default.createElement(yc,null),label:"File"}))),n==="url"?no.default.createElement("div",null,no.default.createElement(ve,null,"Open an annotation file from a URL"),no.default.createElement(an,{label:"URL",value:s,onChange:p=>{a(p.target.value)}})):no.default.createElement("div",{style:{paddingTop:20}},no.default.createElement(ve,null,"Open an annotation file from your local drive"),no.default.createElement(tt,{variant:"outlined",component:"label"},"Choose File",no.default.createElement("input",{type:"file",hidden:!0,onChange:({target:p})=>{let d=p.files?.[0];d&&r(d)}})),o?no.default.createElement(ve,null,o.name):null))),no.default.createElement(es,null,no.default.createElement(tt,{variant:"contained",color:"primary",disabled:u||(n==="file"?!o:!s.trim()),onClick:()=>{(async()=>{f(!0),c(void 0);try{let p=await(n==="file"&&o?o.text():hVe(s));t.setGFFFilehandle(void 0),t.setGFF(p4(p)),t.setShowDomains(!0),t.setCellFill("domain"),e()}catch(p){console.error(p),c(p)}finally{f(!1)}})()}},"Open annotations"),no.default.createElement(tt,{variant:"contained",color:"secondary",onClick:()=>{e()}},"Cancel")))}),bVe=yVe});var hR,A4=A(()=>{"use strict";hR="9.7.0"});var m4={};Hn(m4,{default:()=>Kme});function Kme({onClose:e}){return $r.default.createElement(cr,{open:!0,title:"About",onClose:()=>{e()}},$r.default.createElement(Jo,null,$r.default.createElement(ve,null,"MSAView ",hR," (",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://github.com/gmod/react-msaview"},"Github"),")"),$r.default.createElement("ul",null,$r.default.createElement("li",null,$r.default.createElement(ve,null,"We use some color schemes from the"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://github.com/biotite-dev/biotite"},"biotite")," ","project, and their license is reproduced"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://github.com/biotite-dev/biotite/blob/master/LICENSE.rst"},"here"))),$r.default.createElement("li",null,$r.default.createElement(ve,null,"See this page for some information on jalview colorings"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://www.jalview.org/help/html/colourSchemes/"},"here"))),$r.default.createElement("li",null,$r.default.createElement(ve,null,"See this page for some info on the clustal, cinema, maeditor, and lesk color schemes"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"http://www.bioinformatics.nl/~berndb/aacolour.html"},"here"))),$r.default.createElement("li",null,$r.default.createElement(ve,null,"See this paper about the flower color scheme"," ",$r.default.createElement(Si,{target:"_blank",rel:"noopener",href:"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7245768/"},"here"))))))}var $r,g4=A(()=>{"use strict";$r=w(D(),1);is();We();A4()});function vm(e){let t=e.length>1;return e.flatMap(o=>[...t?[{key:o.id,label:o.title}]:[],...o.entries.map(r=>({key:`${o.id}:${r.id}`,label:r.label,color:r.color,hint:r.id}))])}var yR=A(()=>{"use strict"});function IVe(e){let t=e.reduce((r,n)=>Math.max(r,n.label.length),0),o=bR+of+t*y4;return Math.min(TVe,Math.max(120,o))}function b4(e){return of*2+e.length*h4}function CR(e,t){let{scrollX:o,scrollY:r,totalWidth:n,totalHeight:i,effectiveTreeAreaWidth:s,rowPanelsWidth:a,rowPanelsHeaderHeight:l,totalTrackAreaHeight:c,minimapHeight:u,msaAreaHeight:f,msaCanvasWidth:p,showHorizontalScrollbar:d,treeOverviewHeight:m,treeScaleBar:y}=e,b=t.includeTracks?c:0,h=t.exportType==="viewport"&&!!t.includeMinimap&&d,g=vm(e.legends),C=g.length>0?IVe(g):0,x=Math.max(h?u:0,l,m+(y?Zu:0)),E=s+a;return t.exportType==="entire"?{width:n+E,msaAreaWidth:n,height:i+b+x,contentHeight:i,trackHeight:b,topHeight:x,offsetX:0,offsetY:0,includeMinimap:h,legendWidth:C}:{width:p+E,msaAreaWidth:p,height:f+x+b,contentHeight:f,trackHeight:b,topHeight:x,offsetX:-o,offsetY:-r,includeMinimap:h,legendWidth:C}}function xR(e,t){let{width:o,height:r,legendWidth:n,topHeight:i}=t;return{width:o+n,height:n>0?Math.max(r,i+b4(vm(e.legends))):r}}var of,h4,Yv,Xme,y4,TVe,bR,C4=A(()=>{"use strict";yR();Or();of=8,h4=16,Yv=12,Xme=12,y4=7,TVe=360,bR=of+Yv+6});function Em({checked:e,label:t,disabled:o,onChange:r}){return vR.default.createElement("div",null,vR.default.createElement(Zn,{control:vR.default.createElement(Ra,{disabled:o,checked:e,onChange:()=>{r()}}),label:t}))}var vR,x4=A(()=>{"use strict";vR=w(D(),1);We()});var Zme={};Hn(Zme,{default:()=>BVe});function wVe(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Oo,SVe,BVe,ege=A(()=>{"use strict";Oo=w(D(),1);is();We();Ie();C4();x4();SVe=z(function({model:e,onClose:t}){let[o,r]=(0,Oo.useState)(!0),[n,i]=(0,Oo.useState)(!0),[s,a]=(0,Oo.useState)("viewport"),[l,c]=(0,Oo.useState)(),[u,f]=(0,Oo.useState)(!1),p=Jt(),{turnedOnTracks:d,numColumns:m,leaves:y,showMsaLetters:b}=e,h=d.length>0,g=xR(e,CR(e,{theme:p,exportType:"entire",includeTracks:n})),C=b&&s==="entire"?m*y.length:0,x=C>1e5;return Oo.default.createElement(cr,{onClose:()=>{t()},open:!0,title:"Export SVG"},Oo.default.createElement(Jo,null,l?Oo.default.createElement(Ic,{error:l}):null,Oo.default.createElement(ve,null,"Settings:"),Oo.default.createElement(Em,{label:"Include minimap?",disabled:s==="entire",checked:o,onChange:()=>{r(!o)}}),h?Oo.default.createElement(Em,{label:"Include tracks?",checked:n,onChange:()=>{i(!n)}}):null,Oo.default.createElement("div",null,Oo.default.createElement(hc,null,Oo.default.createElement(oy,null,"Export type"),Oo.default.createElement(ay,{value:s,onChange:E=>{let{value:I}=E.target;(I==="entire"||I==="viewport")&&a(I)}},Oo.default.createElement(Zn,{value:"entire",control:Oo.default.createElement(yc,null),label:"Entire MSA"}),Oo.default.createElement(Zn,{value:"viewport",control:Oo.default.createElement(yc,null),label:"Current viewport only"})))),x?Oo.default.createElement(AS,{severity:"warning",style:{marginTop:8}},"The entire MSA is ",Math.round(g.width),"x",Math.round(g.height)," pixels and draws"," ",Math.round(C/1e3),"k residue letters, each its own SVG element. Export may be slow or fail \u2014 zooming out far enough to hide the letters exports the same alignment as an image instead."):null),Oo.default.createElement(es,null,Oo.default.createElement(tt,{variant:"contained",color:"primary",disabled:u,startIcon:u?Oo.default.createElement(wa,{size:16,color:"inherit"}):null,onClick:()=>{f(!0),wVe(()=>{e.exportSVG({theme:p,includeMinimap:o,includeTracks:h&&n,exportType:s}).then(()=>{t()}).catch(E=>{console.error(E),c(E)}).finally(()=>{f(!1)})})}},u?"Exporting\u2026":"Export"),Oo.default.createElement(tt,{variant:"contained",color:"secondary",onClick:()=>{t()}},"Cancel")))}),BVe=SVe});var oge={};Hn(oge,{default:()=>tge});function tge({model:e,onClose:t}){return ER.default.createElement(cr,{open:!0,onClose:t,title:"Go to row or column",maxWidth:"xs",fullWidth:!0},ER.default.createElement(Jo,null,ER.default.createElement(yme,{model:e,onFound:t})))}var ER,rge=A(()=>{"use strict";ER=w(D(),1);is();We();V3()});var nge,v4,ige,sge,age,E4=A(()=>{"use strict";nge=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],v4=[{label:"Arrow keys",action:"Scroll one cell",keys:nge},{label:"Shift + arrow keys",action:"Scroll one page",keys:nge,shiftKey:!0},{label:"+ and -",action:"Zoom in and out",keys:["+","=","-"]},{label:"0",action:"Reset to the default cell size",keys:["0"]},{label:"Home and End",action:"Jump to the first and last column",keys:["Home","End"]},{label:"Escape",action:"Clear the selection",keys:["Escape"]}],ige={label:"Shift + drag",action:"Select a block of cells"},sge=[{label:"Drag",action:"Pan the alignment"},{label:"Wheel",action:"Scroll, or zoom with Zoom on scroll checked"},{label:"Ctrl + wheel",action:"Zoom at the cursor"},ige,{label:"Drag along a track",action:"Select a range of columns across every row"},{label:"Click a tree node",action:"Collapse, rotate, reroot or show only that clade"},{label:"Click the tree overview",action:"Show only the clade under the pointer"},{label:"Drag a divider",action:"Resize the tree area or a track"}],age=["Alignment",...[...v4,ige].map(e=>`${e.label}: ${e.action}`)].join(". ")});var uge={};Hn(uge,{default:()=>cge});function lge({title:e,rows:t}){return Yr.default.createElement(Yr.default.Fragment,null,Yr.default.createElement(ve,{variant:"subtitle2",sx:{mt:1}},e),Yr.default.createElement(fy,{size:"small","aria-label":e},Yr.default.createElement(py,null,t.map(({label:o,action:r})=>Yr.default.createElement(VA,{key:o},Yr.default.createElement(sn,{sx:{whiteSpace:"nowrap",fontWeight:500}},o),Yr.default.createElement(sn,null,r))))))}function cge({model:e,onClose:t}){return Yr.default.createElement(cr,{open:!0,title:"Mouse & keyboard",onClose:t},Yr.default.createElement(Jo,null,Yr.default.createElement(lge,{title:"Mouse",rows:sge}),Yr.default.createElement(lge,{title:"Keyboard (click the alignment first)",rows:v4})),Yr.default.createElement(es,null,Yr.default.createElement(ve,{variant:"caption",sx:{mr:"auto",pl:1}},"MSAView ",hR),Yr.default.createElement(tt,{onClick:()=>{e.queueDialog(o=>[_Ve,{onClose:o}]),t()}},"About & credits"),Yr.default.createElement(tt,{variant:"contained",onClick:t},"Close")))}var Yr,_Ve,fge=A(()=>{"use strict";Yr=w(D(),1);is();We();A4();E4();_Ve=(0,Yr.lazy)(()=>Promise.resolve().then(()=>(g4(),m4)))});function Wv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!rf.default.isValidElement(e)}function T4(e){return Wv(e)&&Object.keys(e).length===0}function nf({record:e,labels:t={},monospaceKeys:o}){let{classes:r,cx:n}=RVe();return rf.default.createElement("dl",{className:r.list},Object.entries(e).filter(([,i])=>i!=null&&!T4(i)).map(([i,s])=>{let a=t[i],l=Wv(s);return rf.default.createElement("div",{key:i,className:r.row},rf.default.createElement("dt",{className:r.key},a??i,a&&a!==i?rf.default.createElement("span",{className:r.code},i):null),rf.default.createElement("dd",{className:n(r.value,l&&r.nested,o?.has(i)&&r.mono)},l?rf.default.createElement(nf,{record:s,labels:t,monospaceKeys:o}):Array.isArray(s)?s.join(`
624
624
  `):rf.default.isValidElement(s)?s:String(s)))}))}var rf,RVe,I4=A(()=>{"use strict";rf=w(D(),1);ln();RVe=$t()(e=>({list:{display:"grid",gridTemplateColumns:"minmax(8em, max-content) minmax(0, 1fr)",columnGap:e.spacing(3),margin:0},row:{display:"contents"},key:{fontWeight:600,padding:e.spacing(.75,0),borderTop:`1px solid ${e.palette.divider}`},code:{marginLeft:e.spacing(1),fontWeight:400,fontSize:"0.75em",fontFamily:"monospace",color:e.palette.text.secondary},value:{margin:0,padding:e.spacing(.75,0),borderTop:`1px solid ${e.palette.divider}`,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},mono:{fontFamily:"monospace",fontSize:"0.85em",maxHeight:"8em",overflow:"auto"},nested:{"& > dl":{paddingLeft:e.spacing(2),borderLeft:`2px solid ${e.palette.divider}`}}}))});function qv(e,t){let o=URL.createObjectURL(e),r=document.createElement("a");r.href=o,r.download=t,r.click(),setTimeout(()=>{URL.revokeObjectURL(o)},4e4)}var w4=A(()=>{"use strict"});function pge([e,t],o){return`>${e}
625
625
  ${o?t:l4(t)}`}function DVe(e){return!/[^.-]/.test(e)}function OVe(e,t){let o=[],r=0;for(let n of e){if(o.length>=QVe||r>=PVe)break;let i=pge(n,t);o.push(i),r+=i.length+1}return{text:o.join(`
626
626
  `),hidden:e.length-o.length}}function Jv({str:e}){let{classes:t}=MVe(),[o,r]=(0,Pl.useState)(!1),[n,i]=(0,Pl.useState)(!1),s=n?e:e.filter(([,u])=>o?!!u:!DVe(u)),{text:a,hidden:l}=OVe(s,o),c=()=>s.map(u=>pge(u,o)).join(`
@@ -647,7 +647,7 @@ UniProt/Swiss-Prot|Q7JFM4|IL2_AOTVO MLKPPLPLRSLLFLQLPLLGVGLNPKFLTPSGNEDIG
647
647
  UniProt/Swiss-Prot|Q29416|IL2_CANFA --------------LFLQLSLLG-------------------------------------
648
648
  `,Cye="(((UniProt/Swiss-Prot|P26898|IL2RA_SHEEP:0.24036,(UniProt/Swiss-Prot|P41690|IL2RA_FELCA:0.17737,(UniProt/Swiss-Prot|P01589|IL2RA_HUMAN:0.03906,UniProt/Swiss-Prot|Q5MNY4|IL2RA_MACMU:0.03787):0.13033):0.04964):0.02189,UniProt/Swiss-Prot|P01590|IL2RA_MOUSE:0.23072):0.06814,(((UniProt/Swiss-Prot|Q95118|IL2RG_BOVIN:0.09600,UniProt/Swiss-Prot|P40321|IL2RG_CANFA:0.09845):0.25333,UniProt/Swiss-Prot|Q29416|IL2_CANFA:-0.35055):0.10231,(UniProt/Swiss-Prot|P26896|IL2RB_RAT:0.33631,UniProt/Swiss-Prot|Q7JFM4|IL2_AOTVO:-0.33631):0.10166):0.01607,(UniProt/Swiss-Prot|Q8BZM1|GLMN_MOUSE:0.32378,UniProt/Swiss-Prot|P36835|IL2_CAPHI:-0.32378):0.09999)";function aM(e,t,o,r){e.setError(void 0),t&&e.setMSAFilehandle(t),o&&e.setTreeFilehandle(o),r&&(e.setGFFFilehandle(r),e.setShowDomains(!0))}var xye="https://jbrowse.org/genomes/multiple_sequence_alignments",Q8e="https://jbrowse.org/genomes/newick_trees",Dm="https://gmod.org/JBrowseMSA/demo/data",P8e=[{label:"NLRP1 in 12 mammals, with Pfam domains",msa:`${Dm}/nlrp1.aln`,tree:`${Dm}/nlrp1.nh`,gff:`${Dm}/nlrp1-domains.gff`},{label:"474 human protein kinase domains, with a FastTree tree",msa:`${Dm}/kinase-pocket/kinase-pocket.afa`,tree:`${Dm}/kinase-pocket/kinase-pocket.nwk`},{label:"RSV-A G gene in 1,840 genomes, with the Nextstrain tree",msa:`${Dm}/scale/rsv-full.aln`,tree:`${Dm}/scale/rsv-full.nh`},{label:"230k COVID-19 samples (tree only)",tree:`${Q8e}/sarscov2phylo.pub.ft.nh`},{label:"Pfam SARS-CoV-2 families, multi-Stockholm with domains",msa:`${xye}/pfam-cov2.stock`,gff:`${xye}/pfam-cov2-domains.gff`},{label:"Small protein alignment and tree",inline:{msa:bye,tree:Cye}}];function fz(e){return e?{uri:e,locationType:"UriLocation"}:void 0}var D8e=z(function({model:e}){return aE.default.createElement("ul",null,P8e.map(({label:t,msa:o,tree:r,gff:n,inline:i})=>aE.default.createElement("li",{key:t},aE.default.createElement(Si,{href:"#",onClick:s=>{s.preventDefault(),e.setError(void 0);try{i?e.setData(i):aM(e,fz(o),fz(r),fz(n))}catch(a){console.error(a),e.setError(a)}}},aE.default.createElement(ve,{component:"span"},t)))))}),vye=D8e;var pz="@media (max-width: 640px)",O8e=z(function({model:e}){let[t,o]=(0,ko.useState)(),[r,n]=(0,ko.useState)(),[i,s]=(0,ko.useState)(),{error:a}=e;return ko.default.createElement($S,{sx:{pt:2,pb:3}},ko.default.createElement(Ho,{sx:{width:"50%",mb:2,[pz]:{width:"100%"}}},a?ko.default.createElement(Ic,{error:a}):null,ko.default.createElement(ve,null,"Open an MSA file (FASTA, Stockholm, Clustal, A3M or EMF format) and/or a tree file (Newick format)."),ko.default.createElement(ve,{color:"text.secondary"},"An MSA alone or a tree alone is enough, and a Stockholm file with an embedded tree needs no separate tree file.")),ko.default.createElement(Ho,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:"40px",[pz]:{flexDirection:"column",alignItems:"stretch",gap:"16px"}}},ko.default.createElement(Ho,{sx:{width:400,display:"flex",flexDirection:"column",gap:1.5,[pz]:{width:"auto"}}},ko.default.createElement("div",null,ko.default.createElement(ve,null,"MSA file or URL"),ko.default.createElement(uv,{inline:!0,location:t,setLocation:o})),ko.default.createElement("div",null,ko.default.createElement(ve,null,"Tree file or URL"),ko.default.createElement(uv,{inline:!0,location:r,setLocation:n})),ko.default.createElement("div",null,ko.default.createElement(ve,null,"Annotation GFF file or URL (optional)"),ko.default.createElement(uv,{inline:!0,location:i,setLocation:s}))),ko.default.createElement("div",null,ko.default.createElement(tt,{onClick:()=>{try{aM(e,t,r,i)}catch(l){console.error(l),e.setError(l)}},variant:"contained",color:"primary",disabled:!t&&!r},"Open")),ko.default.createElement("div",null,ko.default.createElement(ve,null,"Examples"),ko.default.createElement(vye,{model:e}))))}),Eye=O8e;var Tye=z(function({model:e,error:t}){return ii.default.createElement("div",null,ii.default.createElement(Ic,{error:t}),e.importForm?ii.default.createElement(tt,{variant:"contained",color:"primary",onClick:()=>{e.reset()}},"Return to import form"):null)}),k8e=z(function({model:e,...t}){let{isLoading:o,dataInitialized:r,data:n,error:i,resetCount:s,msaFilehandle:a,treeFilehandle:l,importForm:c}=e,u=!!(n.msa||n.tree),f=!i&&!!(a||l||o);return ii.default.createElement("div",null,ii.default.createElement(My,{key:s,FallbackComponent:p=>ii.default.createElement(Tye,{model:e,error:p.error})},r?o?ii.default.createElement(Fv,{model:e,variant:"page"}):ii.default.createElement(yye,{model:e,...t}):u?ii.default.createElement(Tye,{model:e,error:i}):ii.default.createElement(ii.default.Fragment,null,f?ii.default.createElement(Fv,{model:e,variant:"page"}):null,c?ii.default.createElement("div",{style:{display:f?"none":void 0}},ii.default.createElement(Eye,{model:e})):i?ii.default.createElement(Ic,{error:i}):null)))}),lM=k8e;var YV=w(D(),1),sTe=w(YQ(),1);var Uo=w(D(),1);G5();pi();hh();al();om();die();pi();al();$v();function Ive(e,t,o){let r=Math.max(0,o-t+1);return e.map(([n,i])=>`>${n}
649
649
  ${i.slice(t-1,o).padEnd(r,"-")}
650
- `).join("")}var _d="rgb(128,179,230)",wve="#d88",U9e="rgb(192, 72, 192)",z9e="rgb(204, 77, 204)",Sve="#8f8",Bve="rgb(26,204,26)",H9e="rgb(240, 128, 128)",G9e="rgb(240, 144, 72)",V9e="rgb(204, 204, 0)",_ve="rgb(26, 179, 179)";function Rve(e,t){let o=e.total(t),r=k=>e.count(t,k),n=r("W"),i=r("L"),s=r("V"),a=r("I"),l=r("M"),c=r("A"),u=r("F"),f=r("C"),p=r("H"),d=r("P"),m=r("R"),y=r("K"),b=r("Q"),h=r("E"),g=r("D"),C=r("T"),x=r("S"),E=r("G"),I=r("Y"),T=r("N"),S=n+i+s+a+l+c+u+f+p+d+I,B=y+m,R=b+h,M=h+g,Q=C+x,v=k=>k/o,O={};return v(S)>.6&&(O.W=_d,O.L=_d,O.V=_d,O.A=_d,O.I=_d,O.M=_d,O.F=_d,O.C=_d),(v(B)>.6||v(y)>.8||v(m)>.8||v(b)>.8)&&(O.K=wve,O.R=wve),(v(B)>.6||v(R)>.5||v(h)>.8||v(b)>.8||v(g)>.8)&&(O.E=U9e),(v(B)>.6||v(M)>.5||v(y)>.8||v(m)>.8||v(b)>.8)&&(O.D=z9e),(v(T)>.5||v(I)>.85)&&(O.N=Sve),(v(B)>.6||v(R)>.6||v(b)>.85||v(h)>.85||v(y)>.85||v(m)>.85)&&(O.Q=Sve),(v(S)>.6||v(Q)>.5||v(x)>.85||v(C)>.85)&&(O.S=Bve,O.T=Bve),v(f)>.85&&(O.C=H9e),E>0&&(O.G=G9e),d>0&&(O.P=V9e),(v(S)>.6||v(n)>.85||v(I)>.85||v(c)>.85||v(f)>.85||v(d)>.85||v(b)>.85||v(u)>.85||v(p)>.85||v(a)>.85||v(i)>.85||v(l)>.85||v(s)>.85)&&(O.H=_ve,O.Y=_ve),O}oq();ob();Rc();var Mve={A:sc[500],C:ic[500],G:Au[500],T:hl[500],U:hl[500]},j9e={none:{},nucleotide:Mve,clustal:{G:"orange",P:"orange",S:"orange",T:"orange",H:"red",K:"red",R:"red",F:"blue",W:"blue",Y:"blue",I:"green",L:"green",M:"green",V:"green"},lesk:{G:"orange",A:"orange",S:"orange",T:"orange",C:"green",V:"green",I:"green",L:"green",P:"green",F:"green",Y:"green",M:"green",W:"green",N:"magenta",Q:"magenta",H:"magenta",D:"red",E:"red",K:"blue",R:"blue"},maeditor:{A:"lightgreen",G:"lightgreen",C:"green",D:"darkgreen",E:"darkgreen",N:"darkgreen",Q:"darkgreen",I:"blue",L:"blue",M:"blue",V:"blue",F:"#c8a2c8",W:"#c8a2c8",Y:"#c8a2c8",H:"darkblue",K:"orange",R:"orange",P:"pink",S:"red",T:"red"},percent_identity_dynamic:{},blosum62_dynamic:{},flower:{A:"#b18a51",C:"#ff5701",D:"#01a578",E:"#2da0a1",F:"#fa559d",G:"#b1c23c",H:"#0194f9",I:"#f27663",K:"#7fc3d7",L:"#df6e75",M:"#fe9daf",N:"#0bcec6",P:"#4fa32a",Q:"#7295ae",R:"#83bff1",S:"#b4bd9b",T:"#d2b576",V:"#fd997b",W:"#ff2ded",Y:"#c96ecf"},rainbow_dna:{A:"#3737f5",C:"#37f537",G:"#f5f537",T:"#f53737",U:"#f53737"},clustalx_protein:{A:"#197fe5",C:"#e57f7f",D:"#cc4ccc",E:"#cc4ccc",F:"#197fe5",G:"#e5994c",H:"#19b2b2",I:"#197fe5",K:"#e53319",L:"#197fe5",M:"#197fe5",N:"#19cc19",P:"#cccc00",Q:"#19cc19",R:"#e53319",S:"#19cc19",T:"#19cc19",V:"#197fe5",W:"#197fe5",Y:"#19b2b2"},clustalx_protein_dynamic:{},clustalx_dna:{A:"#e53319",C:"#197fe5",G:"#e5994c",T:"#19cc19",U:"#19cc19"},jbrowse_dna:Mve,jalview_buried:{A:"#00a35c",R:"#00fc03",N:"#00eb14",D:"#00eb14",C:"#0000ff",Q:"#00f10e",E:"#00f10e",G:"#009d62",H:"#00d52a",I:"#0054ab",L:"#007b84",K:"#00ff00",M:"#009768",F:"#008778",P:"#00e01f",S:"#00d52a",T:"#00db24",W:"#00a857",Y:"#00e619",V:"#005fa0",B:"#00eb14",X:"#00b649",Z:"#00f10e"},jalview_hydrophobicity:{A:"#ad0052",R:"#0000ff",N:"#0c00f3",D:"#0c00f3",C:"#c2003d",Q:"#0c00f3",E:"#0c00f3",G:"#6a0095",H:"#1500ea",I:"#ff0000",L:"#ea0015",K:"#0000ff",M:"#b0004f",F:"#cb0034",P:"#4600b9",S:"#5e00a1",T:"#61009e",W:"#5b00a4",Y:"#4f00b0",V:"#f60009",B:"#0c00f3",X:"#680097",Z:"#0c00f3"},jalview_prophelix:{A:"#e718e7",R:"#6f906f",N:"#1be41b",D:"#778877",C:"#23dc23",Q:"#926d92",E:"#ff00ff",G:"#00ff00",H:"#758a75",I:"#8a758a",L:"#ae51ae",K:"#a05fa0",M:"#ef10ef",F:"#986798",P:"#00ff00",S:"#36c936",T:"#47b847",W:"#8a758a",Y:"#21de21",V:"#857a85",B:"#49b649",X:"#758a75",Z:"#c936c9"},jalview_propstrand:{A:"#5858a7",R:"#6b6b94",N:"#64649b",D:"#2121de",C:"#9d9d62",Q:"#8c8c73",E:"#0000ff",G:"#4949b6",H:"#60609f",I:"#ecec13",L:"#b2b24d",K:"#4747b8",M:"#82827d",F:"#c2c23d",P:"#2323dc",S:"#4949b6",T:"#9d9d62",W:"#c0c03f",Y:"#d3d32c",V:"#ffff00",B:"#4343bc",X:"#797986",Z:"#4747b8"},jalview_propturn:{A:"#2cd3d3",R:"#708f8f",N:"#ff0000",D:"#e81717",C:"#a85757",Q:"#3fc0c0",E:"#778888",G:"#ff0000",H:"#708f8f",I:"#00ffff",L:"#1ce3e3",K:"#7e8181",M:"#1ee1e1",F:"#1ee1e1",P:"#f60909",S:"#e11e1e",T:"#738c8c",W:"#738c8c",Y:"#9d6262",V:"#07f8f8",B:"#f30c0c",X:"#7c8383",Z:"#5ba4a4"},jalview_taylor:{A:"#ccff00",R:"#0000ff",N:"#cc00ff",D:"#ff0000",C:"#ffff00",Q:"#ff00cc",E:"#ff0066",G:"#ff9900",H:"#0066ff",I:"#66ff00",L:"#33ff00",K:"#6600ff",M:"#00ff00",F:"#00ff66",P:"#ffcc00",S:"#ff3300",T:"#ff6600",W:"#00ccff",Y:"#00ffcc",V:"#99ff00"},jalview_zappo:{A:"#ffafaf",R:"#6464ff",N:"#00ff00",D:"#ff0000",C:"#ffff00",Q:"#00ff00",E:"#ff0000",G:"#ff00ff",H:"#6464ff",I:"#ffafaf",L:"#ffafaf",K:"#6464ff",M:"#ffafaf",F:"#ffc800",P:"#ff00ff",S:"#00ff00",T:"#00ff00",W:"#ffc800",Y:"#ffc800",V:"#ffafaf"},cinema:{H:"blue",K:"blue",R:"blue",D:"red",E:"red",S:"green",T:"green",N:"green",Q:"green",A:"white",V:"white",L:"white",I:"white",M:"white",F:"magenta",W:"magenta",Y:"magenta",P:"brown",G:"brown",C:"yellow",B:"gray",Z:"gray",X:"gray","-":"gray",".":"gray"}},cV=G_(j9e,([e,t])=>[e,G_(t,([o,r])=>[o,er(r).toHex()])]),Qve=new WeakMap;function Pve(e){let t=Qve.get(e);return t||(t=G_(e,([o,r])=>[o.toUpperCase(),r]),Qve.set(e,t)),t}Mv();function Dve({col:e,colStats:t,conservation:o,propertyConservation:r}){if(e>=t.numColumns)return;let n=t.total(e);if(!n)return;let i=t.gapCount(e),s=t.residueEntries(e).sort((l,c)=>c[1]-l[1]),a=s[0];return{col:e,total:n,gaps:i,gapFraction:i/n,conservation:o[e]??0,propertyConservation:r[e],consensusLetter:a?.[0]??"",consensusCount:a?.[1]??0,consensusFraction:a?a[1]/n:0,distribution:s}}function fC(e){let t=[],o=new Array(e.length),r=e.map((n,i)=>i).sort((n,i)=>e[n].startCol-e[i].startCol);for(let n of r){let{startCol:i,endCol:s}=e[n],a=t.findIndex(c=>c<=i),l=a===-1?t.length:a;t[l]=s,o[n]=l}return e.map((n,i)=>({...n,lane:o[i],laneCount:t.length}))}Dv();oE();function Ove(e,t){if(e<=0||t<20)return;let o=t/2/e,r=10**Math.floor(Math.log10(o)),n=o/r,i=(n>=5?5:n>=2?2:1)*r,s=i*e;return s>t?void 0:{step:i,px:s,label:`${Number(i.toPrecision(2))}`}}Or();ob();var $9e={grad:.9,turn:360,rad:360/(2*Math.PI)},uV=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},pC=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=Math.pow(10,t)),Math.round(o*e)/o+0},wf=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=1),e>o?o:e>t?e:t},fV=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},pV=function(e){return 255*(e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e)},dV=96.422,AV=100,mV=82.521,Y9e=function(e){var t,o,r={x:.9555766*(t=e).x+-.0230393*t.y+.0631636*t.z,y:-.0282895*t.x+1.0099416*t.y+.0210077*t.z,z:.0122982*t.x+-.020483*t.y+1.3299098*t.z};return o={r:pV(.032404542*r.x-.015371385*r.y-.004985314*r.z),g:pV(-.00969266*r.x+.018760108*r.y+41556e-8*r.z),b:pV(556434e-9*r.x-.002040259*r.y+.010572252*r.z),a:e.a},{r:wf(o.r,0,255),g:wf(o.g,0,255),b:wf(o.b,0,255),a:wf(o.a)}},W9e=function(e){var t=fV(e.r),o=fV(e.g),r=fV(e.b);return(function(n){return{x:wf(n.x,0,dV),y:wf(n.y,0,AV),z:wf(n.z,0,mV),a:wf(n.a)}})((function(n){return{x:1.0478112*n.x+.0228866*n.y+-.050127*n.z,y:.0295424*n.x+.9904844*n.y+-.0170491*n.z,z:-.0092345*n.x+.0150436*n.y+.7521316*n.z,a:n.a}})({x:100*(.4124564*t+.3575761*o+.1804375*r),y:100*(.2126729*t+.7151522*o+.072175*r),z:100*(.0193339*t+.119192*o+.9503041*r),a:e.a}))},cT=216/24389,dC=24389/27,Lve=function(e){return{l:wf(e.l,0,100),c:e.c,h:(t=e.h,(t=isFinite(t)?t%360:0)<0?t+360:t),a:e.a};var t},kve=function(e){return{l:pC(e.l,2),c:pC(e.c,2),h:(t=e.h,o=2,o===void 0&&(o=0),pC(t,o)%360),a:pC(e.a,3)};var t,o},q9e=function(e){var t=e.l,o=e.c,r=e.h,n=e.a,i=n===void 0?1:n;if(!uV(t)||!uV(o)||!uV(r))return null;var s=Lve({l:Number(t),c:Number(o),h:Number(r),a:Number(i)});return Fve(s)},Nve=function(e){var t=(function(i){var s=W9e(i),a=s.x/dV,l=s.y/AV,c=s.z/mV;return a=a>cT?Math.cbrt(a):(dC*a+16)/116,{l:116*(l=l>cT?Math.cbrt(l):(dC*l+16)/116)-16,a:500*(a-l),b:200*(l-(c=c>cT?Math.cbrt(c):(dC*c+16)/116)),alpha:s.a}})(e),o=pC(t.a,3),r=pC(t.b,3),n=Math.atan2(r,o)/Math.PI*180;return{l:t.l,c:Math.sqrt(o*o+r*r),h:n<0?n+360:n,a:t.alpha}},Fve=function(e){return t={l:e.l,a:e.c*Math.cos(e.h*Math.PI/180),b:e.c*Math.sin(e.h*Math.PI/180),alpha:e.a},r=t.a/500+(o=(t.l+16)/116),n=o-t.b/200,Y9e({x:(Math.pow(r,3)>cT?Math.pow(r,3):(116*r-16)/dC)*dV,y:(t.l>8?Math.pow((t.l+16)/116,3):t.l/dC)*AV,z:(Math.pow(n,3)>cT?Math.pow(n,3):(116*n-16)/dC)*mV,a:t.alpha});var t,o,r,n},J9e=/^lch\(\s*([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))\s+([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,K9e=function(e){var t=J9e.exec(e);if(!t)return null;var o,r,n=Lve({l:Number(t[1]),c:Number(t[2]),h:(o=t[3],r=t[4],r===void 0&&(r="deg"),Number(o)*($9e[r]||1)),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fve(n)},Uve=function(e,t){e.prototype.toLch=function(){return kve(Nve(this.rgba))},e.prototype.toLchString=function(){return o=kve(Nve(this.rgba)),r=o.l,n=o.c,i=o.h,(s=o.a)<1?"lch("+r+"% "+n+" "+i+" / "+s+")":"lch("+r+"% "+n+" "+i+")";var o,r,n,i,s},t.string.push([K9e,"lch"]),t.object.push([q9e,"lch"])};var X9e=[["#F8766D"],["#F8766D","#00BFC4"],["#F8766D","#00BA38","#619CFF"],["#F8766D","#7CAE00","#00BFC4","#C77CFF"],["#F8766D","#A3A500","#00BF7D","#00B0F6","#E76BF3"],["#F8766D","#B79F00","#00BA38","#00BFC4","#619CFF","#F564E3"],["#F8766D","#C49A00","#53B400","#00C094","#00B6EB","#A58AFF","#FB61D7"],["#F8766D","#CD9600","#7CAE00","#00BE67","#00BFC4","#00A9FF","#C77CFF","#FF61CC"]],Hve=X9e,gV={set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],okabeito:["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#000000"],tableau:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"]},zve={okabeIto:"okabeito",tableau10:"tableau"};function hV(e){return e===void 0?void 0:Object.hasOwn(gV,e)?gV[e]:Object.hasOwn(zve,e)?gV[zve[e]]:void 0}U_([Uve]);function uT(e,t,o){let r=e.length,n=t??Hve[r-1];return n&&r<=n.length?Object.fromEntries(e.map((i,s)=>[i,n[s]])):Object.fromEntries(e.map((i,s)=>{let a=s*360/r;return[i,(o===void 0?er({h:a,s:60,l:60}):er({l:o,c:40,h:a})).toHex()]}))}function yV(e,t,o="image"){let r=e;return`${(r?.uri??r?.localPath??r?.name)?.split(/[?#]/)[0]?.split(/[/\\]/).pop()?.replace(/\.[^.]*$/,"")||o}.${t}`}Or();Rc();var Z9e="#d9d9d9",eYe=.1;function bV(e,t){return e.width??(e.kind==="features"?ume:t.rowHeight)}function Vve(e){if(typeof e!="object"||e===null)return;let t={};for(let[o,r]of Object.entries(e))typeof r=="string"?t[o]=r:(typeof r=="number"||typeof r=="boolean")&&(t[o]=String(r));return t}function WQ(e,t,o){let r=new Map;for(let[n,i]of Object.entries(e)){let s=i?.[t],a=s===void 0?void 0:o(s);a&&r.set(n,a)}return r}function CV(e,t,o){let r=new Map,n=i=>{let s=r.get(i);if(s!==void 0)return s;let a=H_(i);return r.set(i,a),a};return new Map(e.map(i=>{let s=t?af(i,t.field):void 0,a=i.color??(s===void 0?void 0:t.colorOf(s))??(t?Z9e:o[i.accession]);return[i,{fill:a,stroke:n(a)}]}))}function xV(e,t){let o=new Map;for(let r of e){let n=af(r,t);n!==void 0&&o.set(r,n)}return o}function tYe(e){let t=e.map(([i,s])=>{let a=fC(s.filter(c=>c.annotation.strand===-1)),l=fC(s.filter(c=>c.annotation.strand!==-1));return{name:i,forward:l,reverse:a}}),o=Math.max(0,...t.map(i=>i.forward[0]?.laneCount??0)),r=Math.max(0,...t.map(i=>i.reverse[0]?.laneCount??0)),n=o+r;return new Map(t.map(({name:i,forward:s,reverse:a})=>[i,[...s.map(l=>({...l,lane:o-1-l.lane,laneCount:n})),...a.map(l=>({...l,lane:o+l.lane,laneCount:n}))]]))}function Gve(e,t){return e.position==="strandpile"?tYe(t):new Map(t.map(([o,r])=>[o,fC(r)]))}function jve({panel:e,width:t,colWidth:o,domainBands:r,annotationsByRow:n,shifts:i}){if(e.x==="column")return Gve(e,[...r].map(([f,p])=>[f,p.map(d=>({...d,xStart:d.startCol*o,xEnd:d.endCol*o}))]));let s=Object.entries(n).map(([f,p])=>{let d=i?.get(f)??0;return[f,p.map(m=>({annotation:m,start:m.start-1+d,end:m.end+d}))]}),a=1/0,l=-1/0;for(let[,f]of s)for(let{start:p,end:d}of f)a=Math.min(a,p),l=Math.max(l,d);let c=Math.max(1,t-1),u=l>a?c/(l-a):0;return Gve(e,s.map(([f,p])=>[f,p.map(({annotation:d,start:m,end:y})=>({annotation:d,xStart:(m-a)*u,xEnd:(y-a)*u,startCol:m,endCol:y-(y-m)*eYe}))]))}var oYe=new Set(["row","start","end"]),$ve=new WeakMap;function Yve(e){return e.map(t=>{let o=$ve.get(t);if(o)return o;let r=rYe(t);return $ve.set(t,r),r})}function rYe(e){let{row:t,start:o,end:r,name:n,description:i,type:s,strand:a,color:l}=e,c=n??`${t}:${o}-${r}`,u=Object.fromEntries(Object.entries(e).filter(([f,p])=>!oYe.has(f)&&p!==void 0).map(([f,p])=>[f,String(p)]));return{id:t,accession:c,name:n??c,description:i??n??c,featureType:s,start:o,end:r,strand:a==="+"?1:a==="-"?-1:void 0,color:l,attributes:u}}Dpe();pi();al();om();function nYe(e){return typeof e=="string"?e:e?.message}async function Wve(e,t,{fetcher:o=L5,controller:r=new AbortController}={}){try{return await o(e,{signal:r.signal,statusCallback:n=>{let i=nYe(n);t(i?{msg:i,onCancel:()=>{r.abort()}}:void 0)}})}finally{t(void 0)}}function qve(e){return e instanceof DOMException&&e.name==="AbortError"}function iYe(e){let t;return{cancel(){let o=t!==void 0&&!t.ended;return t?.controller.abort(),t=void 0,o},begin(){t?.controller.abort();let o={controller:new AbortController,ended:!1};return t=o,{controller:o.controller,isCurrent:()=>!o.ended&&o===t&&cl(e),end(){o.ended=!0}}}}}function fT(e,{what:t,getFilehandle:o,onLoad:r,setLoading:n,clearFilehandle:i,optional:s=!1}){let a=iYe(e),l=()=>{a.cancel()&&cl(e)&&e.setStatus(void 0)};au(e,l),au(e,Jl(async()=>{let c=o();if(l(),!c){n?.(!1);return}let{controller:u,isCurrent:f,end:p}=a.begin();try{n?.(!0),s||e.setError(void 0);let d=await Wve(e3(c),m=>{f()&&e.setStatus(m)},{controller:u});f()&&_r(()=>{r(d),c.locationType==="BlobLocation"&&i?.()})}catch(d){f()&&(qve(d)?i?.():(console.error(d),s?e.addWarning(`The ${t} did not load: ${d}`):e.setError(d)))}finally{f()&&n?.(!1),p()}}))}pb();pi();Or();function Jve(e=nR){return $.model({tree:$.maybe($.string),msa:$.maybe($.string),treeMetadata:$.maybe($.string),gff:$.maybe($.string)}).actions(t=>({setTree(o){t.tree=o},setMSA(o){t.msa=o},setTreeMetadata(o){t.treeMetadata=o},setGFF(o){t.gff=o}})).postProcessSnapshot(t=>Object.fromEntries(Object.entries(t).map(([o,r])=>[o,r&&r.length>e?void 0:r])))}pi();function Kve(){return $.model("DialogQueueSessionMixin",{}).volatile(()=>({queueOfDialogs:[]})).views(e=>({get DialogComponent(){return e.queueOfDialogs[0]?.[0]},get DialogProps(){return e.queueOfDialogs[0]?.[1]}})).actions(e=>({removeActiveDialog(){e.queueOfDialogs=e.queueOfDialogs.slice(1)},queueDialog(t){let[o,r]=t(()=>{this.removeActiveDialog()});e.queueOfDialogs=[...e.queueOfDialogs,[o,r]]}}))}pi();Or();pi();function At(e,t){return typeof $.stripDefault=="function"?$.stripDefault(e,t):$.optional(e,t)}var sYe=["stockholm","a3m","fasta","emf","clustal"];function Xve(){return $.model({bgColor:At($.boolean,YAe),colorSchemeName:At($.string,tR),customColorScheme:$.frozen(),showColumnStats:At($.boolean,WAe),msaFormat:$.maybe($.enumeration("MSAFormat",sYe))}).actions(e=>({setColorSchemeName(t){e.colorSchemeName=t,e.customColorScheme=void 0},setCustomColorScheme(t){e.customColorScheme=t},setBgColor(t){e.bgColor=t},setShowColumnStats(t){e.showColumnStats=t},setMSAFormat(t){e.msaFormat=t}}))}pi();Or();function Zve(){return $.model({drawLabels:At($.boolean,qAe),labelsAlignRight:At($.boolean,JAe),treeAreaWidth:$.maybe($.number),treeWidth:$.maybe($.number),showBranchLen:At($.boolean,eme),treeOrder:At($.enumeration("TreeOrder",[...rR]),tme),drawTree:At($.boolean,ome),drawNodeBubbles:At($.boolean,rme),drawNodeLabels:At($.boolean,nme),showTreeOverview:At($.boolean,ime),overviewHeight:At($.number,sme)}).actions(e=>({setTreeAreaWidth(t){e.treeAreaWidth=t===void 0?void 0:Math.round(t),e.treeWidth=void 0},setTreeWidth(t){e.treeWidth=t===void 0?void 0:Math.round(t)},setLabelsAlignRight(t){e.labelsAlignRight=t},setDrawTree(t){e.drawTree=t},setShowBranchLen(t){e.showBranchLen=t},setTreeOrder(t){e.treeOrder=t},setDrawNodeBubbles(t){e.drawNodeBubbles=t},setDrawNodeLabels(t){e.drawNodeLabels=t},setShowTreeOverview(t){e.showTreeOverview=t},setDrawLabels(t){e.drawLabels=t}}))}var eEe="ARNDCQEGHILKMFPSTWYVBZX*",aYe=[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],Xa=eEe.length,pT=Int8Array.from(aYe.flat()),AC=new Int8Array(128).fill(-1);for(let e=0;e<Xa;e++){let t=eEe[e];AC[t.charCodeAt(0)]=e,AC[t.toLowerCase().charCodeAt(0)]=e}var qQ=-2;function tEe(e,t){if(t>=e.length)return qQ;let o=e.charCodeAt(t);return o-45>>>0<=1?qQ:o<128?AC[o]:-1}function vV(e,t){return e<0||t<0?-4:pT[e*Xa+t]}function lYe(e,t){let o=Math.max(e.length,t.length),r=0,n=0,i=0;for(let l=0;l<o;l++){let c=tEe(e,l),u=tEe(t,l),f=c===qQ,p=u===qQ;f&&p||(r++,!(f||p)&&(n+=vV(c,u),i+=Math.max(vV(c,c),vV(u,u))))}if(r===0||i<=0)return 1;let s=n/i,a=Math.max(.01,Math.min(1,s));return-Math.log(a)}function cYe(e){let t=e.length,o=[];for(let r=0;r<t;r++){o[r]=[];for(let n=0;n<t;n++)r===n?o[r][n]=0:n<r?o[r][n]=o[n][r]:o[r][n]=lYe(e[r][1],e[n][1])}return o}function uYe(e,t){let o=e.length;if(o<2)return{name:t[0]};if(o===2){let a=e[0][1];return{left:{name:t[0]},right:{name:t[1]},leftLength:a/2,rightLength:a/2}}let r=[];for(let a=0;a<o;a++)r[a]=[...e[a]];let n=t.map(a=>({name:a})),i=o;for(;i>2;){let a=[];for(let g=0;g<n.length;g++)n[g]!==void 0&&a.push(g);let l=new Map;for(let g of a){let C=0;for(let x of a)g!==x&&(C+=r[g][x]);l.set(g,C)}let c=1/0,u=-1,f=-1;for(let g=0;g<a.length;g++)for(let C=g+1;C<a.length;C++){let x=a[g],E=a[C],I=(i-2)*r[x][E]-l.get(x)-l.get(E);I<c&&(c=I,u=x,f=E)}let p=r[u][f],d=l.get(u),m=l.get(f),y=p/2+(d-m)/(2*(i-2)),b=p-y;y=Math.max(0,y),b=Math.max(0,b);let h={left:n[u],right:n[f],leftLength:y,rightLength:b};for(let g of a)if(g!==u&&g!==f){let C=(r[u][g]+r[f][g]-p)/2;r[u][g]=Math.max(0,C),r[g][u]=Math.max(0,C)}n[f]=void 0,n[u]=h,i--}let s=[];for(let a=0;a<n.length;a++)n[a]!==void 0&&s.push(a);if(s.length===2){let a=s[0],l=s[1],c=r[a][l];return{left:n[a],right:n[l],leftLength:c/2,rightLength:c/2}}return n[s[0]]}function oEe(e,t){return t===void 0?e:`${e}:${t.toFixed(6)}`}function fYe(e){let t=[],o=[e];for(;o.length>0;){let n=o.pop();t.push(n),n.left&&o.push(n.left),n.right&&o.push(n.right)}let r=new Map;for(let n=t.length-1;n>=0;n--){let i=t[n];if(i.name!==void 0&&!i.left&&!i.right)r.set(i,`'${i.name.replaceAll("'","''")}'`);else{let s=i.left?oEe(r.get(i.left),i.leftLength):"",a=i.right?oEe(r.get(i.right),i.rightLength):"";r.set(i,`(${s},${a})`)}}return r.get(e)}function rEe(e){if(e.length<2)throw new Error("Need at least 2 sequences to build a tree");let t=e.map(n=>n[0]),o=cYe(e),r=uYe(o,t);return fYe(r)+";"}Mv();var nEe={A:"hydrophobic",V:"hydrophobic",L:"hydrophobic",I:"hydrophobic",M:"hydrophobic",C:"hydrophobic",F:"aromatic",W:"aromatic",Y:"aromatic",H:"aromatic",K:"positive",R:"positive",D:"negative",E:"negative",S:"polar",T:"polar",N:"polar",Q:"polar",G:"special",P:"special"},EV=[...new Set(Object.values(nEe))],pYe=Math.log2(EV.length),iEe=new Int8Array(D_).fill(-1);for(let[e,t]of Object.entries(nEe))iEe[zde(e)]=EV.indexOf(t);function sEe(e){let t=new Float64Array(EV.length);return Array.from({length:e.numColumns},(o,r)=>{let n=e.total(r),i=0;if(n){t.fill(0);let s=0;if(e.forEachResidue(r,(a,l)=>{let c=iEe[a];c>=0&&(t[c]+=l,s+=l)}),s>0){let a=0;for(let c of t)if(c>0){let u=c/s;a-=u*Math.log2(u)}let l=(n-s)/n;i=Math.max(0,1-a/pYe)*(1-l)}}return i})}function mC(e,t){let o=[],r=[e];for(;r.length>0;){let n=r.pop();o.push(n);for(let i of n.children??[])t?.set(i,n),r.push(i)}return o}function aEe(e){return e.some(t=>t.length!==void 0)}function dYe(e,t){return e.children?.length===2?e.children.find(o=>o!==t):void 0}function JQ(e,t,o){let r=new Map,n=mC(e,r);if(!r.has(t))return e;let i=aEe(n),s=r.get(t)===e?dYe(e,t):void 0,a=(t.length??0)+(s?.length??0),l=Math.min(Math.max(o??a/2,0),a),c=p=>i?p:void 0,u=[t];for(let p=r.get(t);p;p=r.get(p))u.push(p);let f;for(let p=u.length-1;p>=1;p--){let d=u[p],m=u[p-1],y=d.children.filter(b=>b!==m);if(f&&y.push(f),y.length===0)f=void 0;else if(p===u.length-1&&y.length===1){let b=y[0];f={...b,length:c((b.length??0)+(m.length??0)-(p===1?l:0))}}else f={...d,name:p===1?void 0:m.name,children:y,length:c((m.length??0)-(p===1?l:0))}}return{children:[{...t,length:c(l)},...f?[f]:[]]}}function lEe(e){let t=new Map,o=mC(e,t),r=o.filter(y=>!y.children?.length);if(r.length<2)return e;let n=aEe(o),i=y=>n?y.length??0:1;function s(y){let b=new Map([[y,0]]),h=new Map,g=[y];for(;g.length>0;){let C=g.pop(),x=b.get(C),E=t.get(C);E&&!b.has(E)&&(b.set(E,x+i(C)),h.set(E,C),g.push(E));for(let I of C.children??[])b.has(I)||(b.set(I,x+i(I)),h.set(I,C),g.push(I))}return{dist:b,via:h}}function a(y){return r.reduce((b,h)=>y.get(h)>y.get(b)?h:b)}let l=a(s(r[0]).dist),{dist:c,via:u}=s(l),f=a(c);if(f===l)return e;let p=c.get(f)/2,d=f,m=u.get(d);for(;c.get(m)>p;)d=m,m=u.get(d);return t.get(d)===m?JQ(e,d,c.get(d)-p):JQ(e,m,p-c.get(m))}function TV(e,t){let o=0,r=e;for(;o<r;){let n=o+r>>>1;t(n)?r=n:o=n+1}return o}function cEe(e,t){return t+TV(e.length,o=>e[o]-o>t)}function uEe(e,t){let o=fEe(e,t);return e[o]===t?void 0:t-o}function fEe(e,t){return TV(e.length,o=>e[o]>=t)}function gC(e,t){return t-fEe(e,t)}function pEe(e,t){if(!e)return;let o=TV(e.length,r=>e[r]>=t);return e[o]===t?o:void 0}ob();var dEe=/^-?\d+(\.\d+)?$/,AEe=/\d+|\D+/g;function AYe(e,t){let o=e.match(AEe)??[],r=t.match(AEe)??[],n=Math.min(o.length,r.length);for(let i=0;i<n;i++){let s=o[i],a=r[i];if(s!==a){if(/^\d/.test(s)&&/^\d/.test(a)){let l=Number(s),c=Number(a);return l!==c?l<c?-1:1:s.length<a.length?-1:1}return s<a?-1:1}}return o.length-r.length}function mEe(e,t){if(e===t)return 0;if(e===""||t==="")return e===""?1:-1;let o=dEe.test(e),r=dEe.test(t);if(o!==r)return o?-1:1;if(o){let n=Number(e)-Number(t);if(n!==0)return n<0?-1:1}return AYe(e,t)}function mYe(e){if(typeof e!="string")return e;if(hV(e))return;let t=e.split(/,(?![^(]*\))/).map(o=>o.trim());return t.every(o=>er(o).isValid())?t:void 0}function gYe(e,t){let o=mYe(e);return o?new Map(t.slice(0,o.length).map((r,n)=>[r,o[n]])):new Map(Object.entries(uT(t,hV(typeof e=="string"?e:void 0))))}function gEe(e,t){let o=new Set(t),r=new Set(e?.domain),n=[...r,...[...o].filter(s=>!r.has(s)).sort(mEe)],i=gYe(e?.range,n);return{kind:"categorical",colorOf:s=>i.get(s),legend:n.filter(s=>o.has(s)&&i.has(s)).map(s=>({id:s,label:s,color:i.get(s)}))}}function wV({spec:e,field:t,table:o}){let{scale:r="categorical",domain:n,range:i,title:s=t}=e;return JSON.stringify([o,r,n,i,s])}function hEe(e){let t=new Map;for(let o of e){let r=wV(o);t.set(r,[...t.get(r)??[],o])}return new Map([...t].map(([o,r])=>{let{spec:n,field:i}=r[0],s=gEe(n,r.flatMap(c=>c.values)),a=r[0].shown?new Set(r.flatMap(c=>c.shown??[])):void 0,l={...s,key:o,title:n.title??i,legend:a?s.legend.filter(c=>a.has(c.id)):s.legend};return[o,l]}))}function IV(e){let{scale:t,legend:o,...r}=e;if(typeof t!="object"&&o===void 0)return e;let n=typeof t!="object"?t===void 0?{}:{scale:t}:t.map?{domain:Object.keys(t.map),range:Object.values(t.map)}:t.palette===void 0?{}:{range:t.palette};return{...o===void 0?{}:{title:o},...n,...r}}function SV(e){return IV(e)}function BV(e){if(e.kind==="strip")return IV(e);let t=e.encoding?.color;return t?{...e,encoding:{...e.encoding,color:IV(t)}}:e}function _V(e){let{max:t,colors:o,...r}=e;return t===void 0&&o===void 0?e:{...o?{encoding:{color:{domain:Object.keys(o),range:Object.values(o)}}}:{},...t===void 0?{}:{scales:{y:{domainMax:t}}},...r}}function RV(e,t){return Object.fromEntries(gEe(e,t).legend.map(o=>[o.id,o.color]))}function KQ(e){return"map"in e?e.map:RV(e,e.domain??[])}function yEe(e){let t=new Int32Array(e.length),o=0;for(let r=0;r<e.length;r++)e.charCodeAt(r)-45>>>0<=1||(t[o++]=r);return t.slice(0,o)}k_();Mv();var CEe=20,hYe=240,yYe=50,bEe=96,bYe=40,xEe=new Float32Array(Xa*Xa);for(let e=0;e<Xa;e++){let t=1/0,o=-1/0;for(let r=0;r<CEe;r++){let n=pT[e*Xa+r];t=Math.min(t,n),o=Math.max(o,n)}for(let r=0;r<Xa;r++){let n=(pT[e*Xa+r]-t)/(o-t);xEe[e*Xa+r]=Math.min(Math.max(n,0),1)}}var XQ=Int8Array.from({length:D_},(e,t)=>{let o=gm(t);return o.length===1?AC[o.charCodeAt(0)]:-1});function CYe(e){let t=Math.round(bEe-(bEe-bYe)*e);return`hsl(${hYe}, ${yYe}%, ${t}%)`}function vEe(e,t,o){let{counted:r,shaded:n,score:i}=o,s=[],a=0;e.forEachResidue(t,(c,u)=>{r(c)&&(s.push([c,u]),a+=u)});let l={};if(a<2)return l;for(let[c]of s)if(n(c)){let u=-i(c,c);for(let[f,p]of s)u+=p*i(c,f);l[gm(c)]=CYe(u/(a-1))}return l}var xYe={counted:e=>XQ[e]>=0,shaded:e=>XQ[e]<CEe,score:(e,t)=>xEe[XQ[e]*Xa+XQ[t]]},vYe={counted:()=>!0,shaded:()=>!0,score:(e,t)=>e===t?1:0};function EEe(e,t){return vEe(e,t,xYe)}function TEe(e,t){return vEe(e,t,vYe)}WR();var IEe=100;function wEe(e){let t=[],o=0,r=[[e,0]];for(let n=r.pop();n;n=r.pop()){let[i,s]=n,{children:a}=i;if(a.length>0)for(let l of a)r.push([l,s+1]);else t.push(i.name),o=Math.max(o,s)}return{names:t,depth:o}}function SEe(e,t){let o=[];for(let s of e)o[s.length]=(o[s.length]??0)+1;let r=o.length;for(let s=0;r>0&&s<IEe;)r--,s+=o[r]??0;let n=0,i=0;for(let s of e)(s.length>r||s.length===r&&i++<IEe)&&(n=Math.max(n,Qm(s,t)));return n}$v();Or();function BEe(e){let t=new Map(e.map(r=>{let n=r.dist===void 0?void 0:Number(r.dist);return[r.id,{id:`${r.id}`,name:r.label||`${r.id}`,...n!==void 0&&Number.isFinite(n)?{length:n}:{},children:[]}]})),o;for(let r of e){let n=t.get(r.id),i=r.parent!==void 0?t.get(r.parent):void 0;i?i.children.push(n):o??=n}if(o===void 0)throw new Error("could not build tree from flat node list: no root found (input was empty or contains a parent cycle)");return o}pb();var EYe={$NODE_COLLAPSED:"collapsed",$NODE_COLOR:"color",$LABEL_BG_COLOR:"color","seq-id":"seqId","seq-title":"seqTitle","align-index":"alignIndex","accession-nbr":"accessionNbr","blast-name":"blastName","common-name":"commonName","leaf-count":"leafCount"};function QV(e,t){let o=1,r=t+1;for(;r<e.length&&o>0;)e[r]==="{"?o++:e[r]==="}"&&o--,r++;return o===0?r:-1}function MV(e){let t=[],o=0;for(;o<e.length;){let r=e.indexOf("{",o);if(r===-1)break;let n=QV(e,r);if(n===-1)break;t.push(e.slice(r+1,n-1).trim()),o=n}return t}function TYe(e,t){let o=e.indexOf("{",t);if(o===-1)return;let r=QV(e,o);return r===-1?void 0:e.slice(o+1,r-1).trim()}function _Ee(e){let t=e.replace(/\s+/g," ").replace(/\s*{\s*/g,"{").replace(/\s*}\s*/g,"}").replace(/\s*,\s*/g,",").replace(/\s*::\s*=\s*/g,"::=").replace(/^.*?::=/,""),o=IYe(t),{fdict:r,nodes:n}=o;if(r===void 0||n===void 0)throw new Error(`invalid BioTreeContainer ASN.1: missing '${r===void 0?"fdict":"nodes"}' section`);let i=Object.fromEntries(MV(r).flatMap(s=>{let a=wYe(s);return a?[[a.id,EYe[a.name]||a.name]]:[]}));return MV(n).flatMap(s=>{let a=SYe(s);if(!a)return[];let{features:l=[],...c}=a;return[{...c,...Object.fromEntries(l.map(u=>[i[u.featureid],u.value]))}]})}function IYe(e){let t={},o=e.trim();o.startsWith("{")&&o.endsWith("}")&&(o=o.slice(1,-1).trim());let r=0;for(;r<o.length;){for(;r<o.length&&/\s/.test(o[r]);)r++;if(r>=o.length)break;let n=r;for(;r<o.length&&/\w/.test(o[r]);)r++;if(r>=o.length||o[r]!==" "&&o[r]!=="{"){r=o.indexOf(",",r),r=r===-1?o.length:r+1;continue}let i=o.slice(n,r).trim();for(;r<o.length&&/\s/.test(o[r]);)r++;if(r>=o.length||o[r]!=="{"){r=o.indexOf(",",r),r=r===-1?o.length:r+1;continue}let s=QV(o,r);if(s===-1)break;t[i]=o.slice(r+1,s-1).trim(),r=o.indexOf(",",s),r=r===-1?o.length:r+1}return t}function wYe(e){let t=/id\s+(\d+)/.exec(e),o=/name\s+"((?:[^"\\]|\\.)*)"/s.exec(e);return!t||!o?null:{id:parseInt(t[1],10),name:o[1].replace(/\\"/g,'"').replace(/\\\\/g,"\\")}}function SYe(e){let t=/id\s+(\d+)/.exec(e);if(!t)return null;let o=/parent\s+(\d+)/.exec(e),r=e.indexOf("features"),n=r!==-1?TYe(e,r):void 0;return{id:parseInt(t[1],10),...o?{parent:parseInt(o[1],10)}:{},features:n?MV(n).flatMap(i=>{let s=BYe(i);return s?[s]:[]}):[]}}function BYe(e){let t=/featureid\s+(\d+)/.exec(e),o=/value\s+"((?:[^"\\]|\\.)*)"/s.exec(e);return!t||!o?null:{featureid:parseInt(t[1],10),value:o[1].replace(/\\"/g,'"').replace(/\\\\/g,"\\")}}Rc();function REe(e){return e.startsWith("BioTreeContainer")?BEe(_Ee(e)):xm(e.startsWith("SEQ")?cR(e).tree:e)}var _Ye=new Set(["collapse","focus","rotate"]);function RYe(e){let t=new Map,o=0,r=(i,s)=>{for(let a=s.length-1;a>=0;a--)i.push(s[a])},n=[e];for(;n.length>0;){let i=n.pop();if(i.children?.length)r(n,i.children);else{let s=[i];for(;s.length>0;){let a=s.pop(),l=a.children??a._children;l?.length?r(s,l):t.set(a.data.name,{order:t.size,row:o})}o++}}return t}function MYe(e,t,o,r){if(e.range){let[l,c]=e.range.map(p=>o.get(p)?r.get(p):void 0);if(l===void 0||c===void 0)return;let[u,f]=l.order<=c.order?[l,c]:[c,l];return f.order-u.order+1===e.tips?{rows:[u.row,f.row]}:void 0}let n=e.mrca?$R(t,e.mrca,o):void 0;if(!n)return;let i=Qc(n);if(i.length!==e.tips)return;let s=1/0,a=-1/0;for(let l of i){let c=r.get(l.data.name)?.row;c!==void 0&&(s=Math.min(s,c),a=Math.max(a,c))}return s<=a?{rows:[s,a],nodeId:n.data.id}:void 0}function PV(e,t,o){let r=jR(t),n=RYe(o);return e.flatMap(i=>{let s=MYe(i,t,r,n),a=_Ye.has(i.mark);return s&&!(a&&s.nodeId===void 0)?[{...s,mark:i.mark,color:z_(i.color??lme,cme),markColor:i.color,label:i.label}]:[]})}var QYe={input:void 0,branchLength:(e,t)=>(e.data.length??1)-(t.data.length??1),ladderize:(e,t)=>e.value-t.value,ladderizeReverse:(e,t)=>t.value-e.value};function ZQ(e,{collapsed:t,rotated:o,order:r,showOnly:n}){let i=Jp(e,a=>a.children);fR(i,a=>a.children.length>0?0:1);let s=QYe[r];if(s&&pR(i,s),o.length>0){let a=new Set(o);lb(i,l=>{a.has(l.data.id)&&l.children?.reverse()})}if(n){let a=tf(i,l=>l.data.id===n);a&&(i=a)}for(let a of t){let l=tf(i,c=>c.data.id===a);l&&(l.children?qhe(l):l.parent?.children&&(l.parent.children=l.parent.children.filter(c=>c.data.id!==a)))}return i}function DV(e,t){let o=jR(e),r=$R(e,t,o);if(r!==e)return r;let n=new Set(t),i=Qc(e).map(a=>a.data.name).filter(a=>!n.has(a)),s=$R(e,i,o);return s===e?void 0:s}function MEe(e,t){let o=new Map;for(let i of mC(e).reverse())o.set(i,{name:i.name===i.id?void 0:i.name,length:i.length,children:i.children.map(s=>o.get(s))});let r=o.get(e);if(t==="midpoint")return zp(lEe(r));let n=DV(Jp(e,i=>i.children),t.outgroup);return n?zp(JQ(r,o.get(n.data))):e}function OV(e){return[Math.round(e.xMin-.5),Math.round(e.xMax-.5)]}Rc();w4();pb();var PYe=/[\s(),:;[\]']/;function DYe(e){return PYe.test(e)?`'${e.replaceAll("'","''")}'`:e}function QEe(e){let t=new Map;for(let o of Cm(e).reverse()){let{id:r,name:n,length:i}=o.data,s="";if(o.children){s=`(${o.children.map(a=>t.get(a)).join(",")})`;for(let a of o.children)t.delete(a)}o.children&&n===r||(s+=DYe(n)),i!==void 0&&(s+=`:${i}`),t.set(o,s)}return`${t.get(e)};`}var PEe={">":"<",")":"(","]":"[","}":"{"},OYe=new Set(Object.values(PEe));function DEe(e){let t=new Map,o=[],r=(i,s)=>{let a=t.get(i);a?a.push(s):t.set(i,[s])},n=(i,s,a)=>{let l=t.get(i)?.pop();l!==void 0&&o.push({start:l,end:s,pseudoknot:a})};for(let i=0;i<e.length;i++){let s=e[i],a=PEe[s];OYe.has(s)?r(s,i):a?n(a,i,!1):s>="A"&&s<="Z"?r(s,i):s>="a"&&s<="z"&&n(s.toUpperCase(),i,!0)}return o.sort((i,s)=>i.start-s.start)}var a7e={bar:40,logo:80,arc:50,ruler:20},jEe=new Set(["bar","logo","arc"]),oTe=new Set(["sequence-logo","position-ruler"]),l7e=e=>`own:${e}`,c7e="#4e79a7",u7e="#e15759",$Ee=new WeakMap;function f7e(e){let t=$Ee.get(e);return t===void 0&&(t=JSON.stringify(e).length,$Ee.set(e,t)),t}function rTe(e){return(e??[]).map(f7e)}function p7e(e,t){let o=rTe(e),r=e?.filter((n,i)=>o[i]<=t);return r?.length?{columnTracks:r}:{}}var d7e=new Set(["id","type","height","drawMsaLetters","scrollZoom","scrollZoomAxis","bgColor","colorSchemeName","customColorScheme","showColumnStats","drawLabels","labelsAlignRight","treeAreaWidth","treeWidth","showBranchLen","treeOrder","drawTree","drawNodeBubbles","drawNodeLabels","showTreeOverview","overviewHeight","turnedOffTracks","trackHeights","hideGaps","allowedGappyness","subFeatureRows","showDomainLegend","domainFill","embeddedMode"]);function YEe(e,t){return e.get(t)??oTe.has(t)}var WEe=[],qEe=[],FV=new Set(["featureFill","featureLabel"]);function JEe(e,t){if(t.has(e))return e;let o=e.replaceAll(":","_");return t.has(o)?o:e}var KEe=new WeakMap;function XEe(e){return e.rowEnd-e.rowStart===e.structEnd-e.structStart}var A7e=Math.log(1.3);function ZEe(e,t,o,r,n,i){if(e===o&&i){let a=r+Math.log(t);return Math.abs(a)<A7e?{value:e,held:a}:{value:dr(o*Math.exp(a),n,bm),held:0}}let s=dr(e*t,n,bm);return(e-o)*(s-o)<0?{value:o,held:0}:{value:s,held:0}}function eTe(e,t){return e-t>.5}function m7e(e,t){return!!e?.some(([o,r])=>t>=o&&t<=r)}function tTe(e){let t=[];for(let o of e){let r=t.at(-1);r&&o<=r[1]+1?r[1]=Math.max(r[1],o):t.push([o,o])}return t}function g7e(e){let[t]=e;return t!==void 0&&e.every(o=>o===t)?t:void 0}function h7e({maxInlineSnapshotBytes:e=nR}={}){return $.compose(Kve(),Zve(),Xve(),$.model("MsaView",{id:LF,showDomains:At($.boolean,!0),domainFill:At($.boolean,!0),showDomainLegend:At($.boolean,!0),hideGaps:At($.boolean,!0),allowedGappyness:At($.number,100),subFeatureRows:At($.boolean,!1),type:$.literal("MsaView"),drawMsaLetters:At($.boolean,UAe),embeddedMode:At($.boolean,!1),scrollZoom:At($.boolean,zAe),scrollZoomAxis:At($.enumeration("ScrollZoomAxis",[...HAe]),GAe),height:At($.number,550),rowHeight:At($.number,16),scrollY:At($.number,0),scrollX:At($.number,0),colWidth:At($.number,12),treeFilehandle:$.maybe(Lx),msaFilehandle:$.maybe(Lx),treeMetadataFilehandle:$.maybe(Lx),gffFilehandle:$.maybe(Lx),currentAlignment:At($.number,0),collapsed:At($.array($.string),[]),rotated:At($.array($.string),[]),treeRoot:$.frozen(),showOnly:$.maybe($.string),turnedOffTracks:At($.map($.boolean),{}),trackHeights:At($.map($.number),{}),columnTracks:At($.array($.snapshotProcessor($.frozen(),{preProcessor:_V})),[]),residueMappings:At($.array($.frozen()),[]),data:$.optional(Jve(e),{}),turnedOffFeatures:At($.map($.boolean),{}),relativeTo:$.maybe($.string),highlightColumns:$.frozen(),highlights:At($.array($.frozen()),[]),features:At($.array($.frozen()),[]),selection:$.frozen(),region:$.frozen(),clades:At($.array($.frozen()),[]),encodings:At($.array($.snapshotProcessor($.frozen(),{preProcessor:SV})),[]),rowPanels:At($.array($.snapshotProcessor($.frozen(),{preProcessor:BV})),[])})).volatile(()=>({headerHeight:0,settingsOpen:!1,zoomHeld:{col:0,row:0},hideHeader:!1,importForm:!0,status:void 0,highResScaleFactor:typeof window>"u"?1:window.devicePixelRatio,zoomSnapshot:void 0,loadingMSA:!1,loadingTree:!1,volatileWidth:void 0,resizeHandleWidth:5,blockSize:500,mouseRow:void 0,mouseCol:void 0,mouseClickRow:void 0,mouseClickCol:void 0,hoveredTreeNode:void 0,highlightedColumns:void 0,transientHighlights:{},minimapHeight:56,marginLeft:20,error:void 0,loadWarnings:[],dismissedWarnings:[],resetCount:0,hostCarriesData:!1,annotations:[]})).actions(t=>({drawRelativeTo(o){t.relativeTo=o},setHideGaps(o){t.hideGaps=o},setAllowedGappyness(o){t.allowedGappyness=o},setLoadingMSA(o){t.loadingMSA=o},setLoadingTree(o){t.loadingTree=o},setWidth(o){t.volatileWidth=o},setSettingsOpen(o){t.settingsOpen=o},setHighResScaleFactor(o){t.highResScaleFactor=o},setHeight(o){t.height=o},setError(o){t.error=o},addWarning(o){t.loadWarnings.includes(o)||(t.loadWarnings=[...t.loadWarnings,o])},setHostCarriesData(o){t.hostCarriesData=o},setMousePos(o,r){t.mouseCol=o,t.mouseRow=r},setHighlightedColumns(o){t.highlightedColumns=o},setRegion(o){t.region=o},setHighlights(o){t.highlights.replace(o)},setFeatures(o){t.features.replace(o)},setSelection(o){let r=o&&{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end),...o.rows?{rows:o.rows}:{}};hg(r,t.selection)||(t.selection=r)},clearSelection(){this.setSelection(void 0)},setClades(o){t.clades.replace(o)},applyHighlight(o,r){t.transientHighlights={...t.transientHighlights,[o]:r}},clearHighlight(o){if(o in t.transientHighlights){let{[o]:r,...n}=t.transientHighlights;t.transientHighlights=n}},setShowDomains(o){t.showDomains=o},setDomainFill(o){t.domainFill=o},setCellFill(o){t.setBgColor(o!=="none"),o!=="none"&&(t.domainFill=o==="domain")},setShowDomainLegend(o){t.showDomainLegend=o},setSubFeatureRows(o){t.subFeatureRows=o},setMouseClickPos(o,r){t.mouseClickCol=o,t.mouseClickRow=r},setRowHeight(o){t.rowHeight=o,t.zoomHeld={...t.zoomHeld,row:0}},setColWidth(o){t.colWidth=o,t.zoomHeld={...t.zoomHeld,col:0}},setCurrentAlignment(o){o!==t.currentAlignment&&_r(()=>{t.currentAlignment=o,t.collapsed.clear(),t.rotated.clear(),this.setShowOnly(void 0),this.drawRelativeTo(void 0),t.scrollX=0,t.scrollY=0})},toggleCollapsed(o){t.collapsed.includes(o)?t.collapsed.remove(o):t.collapsed.push(o)},toggleRotated(o){t.rotated.includes(o)?t.rotated.remove(o):t.rotated.push(o)},clearRotated(){t.rotated.clear()},setTreeRoot(o){hg(t.treeRoot,o)||_r(()=>{t.treeRoot=o,t.collapsed.clear(),t.rotated.clear(),this.setShowOnly(void 0)})},setShowOnly(o){t.showOnly=o},setData(o){t.data=o},setMSAFilehandle(o){t.msaFilehandle=o},setTreeFilehandle(o){t.treeFilehandle=o},setTreeMetadataFilehandle(o){t.treeMetadataFilehandle=o},setGFFFilehandle(o){t.gffFilehandle=o},setMSA(o){t.data.setMSA(o)},setTree(o){t.data.setTree(o)},setTreeMetadata(o){t.data.setTreeMetadata(o)},setGFF(o){t.data.setGFF(o)}})).views(t=>({get hideGapsEffective(){return t.hideGaps&&(t.collapsed.length>0||t.showOnly!==void 0||t.allowedGappyness<100)},get hostRestoresData(){return t.hostCarriesData},get viewInitialized(){return t.volatileWidth!==void 0},get width(){if(t.volatileWidth===void 0)throw new Error("not initialized");return t.volatileWidth-(t.settingsOpen?eR:0)}})).views(t=>({get colorScheme(){let{customColorScheme:o,colorSchemeName:r}=t;return o?Pve(o):cV[r]??cV[tR]},get dynamicColorSchemeName(){let{customColorScheme:o,colorSchemeName:r}=t;return!o&&r.includes("dynamic")?r:void 0},get header(){return this.MSA?.getHeader()??{}},get alignmentNames(){return this.MSA?.alignmentNames??[]},get noTree(){return!!this.tree.noTree},get noDomains(){return this.allAnnotations.length===0},get unshareableData(){if(t.hostRestoresData)return[];let{data:o}=t,r=rTe(t.columnTracks).filter(n=>n>e).reduce((n,i)=>n+i,0);return[["alignment",o.msa,t.msaFilehandle],["tree",o.tree,t.treeFilehandle],["annotations",o.gff,t.gffFilehandle],["row metadata",o.treeMetadata,t.treeMetadataFilehandle]].flatMap(([n,i,s])=>!s&&i&&i.length>e?[{what:n,bytes:i.length}]:[]).concat(r?[{what:"data tracks",bytes:r}]:[]).sort((n,i)=>i.bytes-n.bytes)},menuItems(){return[]},get rowData(){let o=t.data.treeMetadata;if(!o)return{};try{let r=JSON.parse(o);return typeof r=="object"&&r!==null?Object.fromEntries(Object.entries(r).map(([n,i])=>[n,Vve(i)])):{}}catch(r){return console.error("failed to parse rowData",r),{}}},rowDataOf(o){return this.rowData[o]},get rowFields(){let o=new Set;for(let r of Object.values(this.rowData))for(let n of Object.keys(r??{}))o.add(n);return[...o].sort((r,n)=>r.localeCompare(n))},get MSA(){let o=t.data.msa;return o?a4(o,t.currentAlignment,t.msaFormat):null},get allAnnotations(){let o=this.MSA?.annotations??[];return t.features.length>0||o.length>0?[...t.annotations,...Yve(t.features),...o]:t.annotations},get actuallyShowDomains(){return t.showDomains&&this.allAnnotations.length>0},get numColumns(){return(this.MSA?.getWidth()??0)-this.blanks.length},get inputTree(){let o=t.data.tree;return o?zp(REe(o)):this.MSA?.getTree()??{noTree:!0,children:[],id:"empty",name:"empty"}},get tree(){let o=this.inputTree;return t.treeRoot&&!o.noTree?MEe(o,t.treeRoot):o},get rowNames(){return this.leaves.map(o=>o.data.name)},get rowNamesSet(){return new Map(this.leaves.map((o,r)=>[o.data.name,r]))},get resolvedClades(){return t.clades.length===0?qEe:PV(t.clades,Jp(this.tree,o=>o.children),this.root)},get cladeGutterWidth(){return Zhe(t.clades)},get treeDrawn(){return t.drawTree&&!this.noTree},get treeTips(){return wEe(this.tree)},get maxTipLabelWidth(){return SEe(this.treeTips.names.map(o=>this.rowDataOf(o)?.genome||o),K_)},get labelColumnWidth(){return t.drawLabels?this.maxTipLabelWidth+(this.treeDrawn?10:6):0},get fittedTreeAreaWidth(){let o=t.marginLeft+this.cladeGutterWidth,r=this.treeDrawn?t.treeWidth??dr(this.treeTips.depth*XAe,oR,KAe):0,n=o+r+this.labelColumnWidth,i=t.viewInitialized?this.numColumns>0?t.width*ZAe:t.width-this.rowPanelsWidth-t.resizeHandleWidth:1/0,s=Math.max(i,o+Math.min(r,oR));return Math.ceil(Math.min(n,s))},get effectiveTreeAreaWidth(){return t.treeAreaWidth??this.fittedTreeAreaWidth},get effectiveTreeWidth(){let o=this.showTreeText?this.labelColumnWidth:0;return t.treeWidth??Math.max(oR,Math.floor(this.effectiveTreeAreaWidth-t.marginLeft-this.cladeGutterWidth-o))},get showTreeText(){return t.drawLabels&&t.rowHeight>=U3},get mouseOverRowName(){let{mouseRow:o}=t;return o===void 0?void 0:this.leaves[o]?.data.name},get hoveredInsertion(){let{mouseCol:o,mouseRow:r}=t;if(o!==void 0&&r!==void 0){let n=this.leaves[r]?.data.name;if(n){let i=this.insertionPositions.get(n)?.find(s=>s.pos===o);if(i)return{rowName:n,col:o,letters:i.letters}}}},get root(){return ZQ(this.tree,{collapsed:t.collapsed,rotated:t.rotated,order:t.treeOrder,showOnly:t.showOnly})},get treeNewick(){return QEe(ZQ(this.tree,{collapsed:[],rotated:t.rotated,order:t.treeOrder}))},get treeOverviewHeight(){return t.showTreeOverview?t.overviewHeight:0},get treeOverviewLayout(){if(!t.showTreeOverview)return;let o=oz(ZQ(this.tree,{collapsed:t.collapsed,rotated:t.rotated,order:t.treeOrder}),{rowHeight:1,treeWidth:1});return{root:o.root,numTips:o.leaves.length,maxDepthToLeaf:o.root.depthToLeaf,showBranchLen:t.showBranchLen&&o.rootToTipLength>0}},get treeOverviewClades(){let o=this.treeOverviewLayout;return!o||t.clades.length===0?qEe:PV(t.clades,Jp(this.tree,r=>r.children),o.root)},get treeOverviewFocusRows(){let o=this.treeOverviewLayout;if(!o||!t.showOnly)return;let r=tf(o.root,n=>n.data.id===t.showOnly);return r?OV(r):void 0},treeOverviewHit(o){let r=this.treeOverviewLayout;if(!r)return;let{root:n,numTips:i}=r,s=i/t.overviewHeight,a=dr(Math.floor(o*s),0,i-1),l=dr(Math.ceil((o+1)*s)-1,a,i-1),c=YR(n,a+.5,l+.5);for(;!c.children&&c.parent;)c=c.parent;return c===n?void 0:{id:c.data.id,rows:OV(c)}},get rowPanelsWidth(){return _0(t.rowPanels.map(o=>bV(o,t)))},get rowPanelsHeaderHeight(){return t.rowPanels.length>0?iR:0},get msaAreaWidth(){return t.width-this.effectiveTreeAreaWidth-this.rowPanelsWidth-t.resizeHandleWidth},get treeAreaWidthMinusMargin(){return this.effectiveTreeAreaWidth-t.marginLeft-this.cladeGutterWidth},get blanks(){let{hideGapsEffective:o,allowedGappyness:r}=t;if(!o)return[];let n=this.leaves.map(u=>this.MSA?.getRow(u.data.name)).filter(Oa);if(n.length===0)return[];let i=this.MSA?.getWidth()??0,s=n.length,a=Math.ceil(r/100*s),l=new Uint32Array(i);for(let u=0;u<s;u++){let f=n[u],p=f.length;for(let d=0;d<i;d++)(d>=p||f.charCodeAt(d)-45>>>0<=1)&&l[d]++}let c=[];for(let u=0;u<i;u++)l[u]>=a&&c.push(u);return c},get insertionPositions(){let{blanks:o,rows:r}=this;if(o.length===0)return new Map;let n=new Map;for(let[i,s]of r){let a=lAe(o,s);a.length>0&&n.set(i,a)}return n},get rows(){let o=this.MSA;return this.leaves.map(r=>[r.data.name,o?.getRow(r.data.name)]).filter(r=>!!r[1])},get numRows(){return this.leaves.length},seqPosIndex(o){let r=this.MSA;if(!r)return;let n=KEe.get(r);n||(n=new Map,KEe.set(r,n));let i=n.get(o);if(!i){let s=r.getRow(o);if(!s)return;i=yEe(s),n.set(o,i)}return i},rowSequence(o){return this.MSA?.getRow(o)||void 0},get rowMap(){let o=this.MSA;return new Map(o?.getNames().map(r=>[r,o.getRow(r)]).filter(([,r])=>!!r))},get columns(){let o=this.columns2d;return new Map(this.rows.map((r,n)=>[r[0],o[n]]))},get columns2d(){let{hideGapsEffective:o}=t;return this.rows.map(([,r])=>(o?V_(this.blanks,r):r).toUpperCase())},get fontSize(){return z3(t.rowHeight)},get colStats(){return Hde(this.columns2d,this.numColumns)},get sequenceType(){let o=this.colStats.lettersPresent,r=["N","R","Y","K","M","S","W"],n=new Set(["A","C","G","T",...r]),i=new Set(["A","C","G","U",...r]),s=o.size>0&&[...o].every(l=>n.has(l)),a=o.size>0&&[...o].every(l=>i.has(l));return s?"dna":a?"rna":"amino"},get colConsensus(){let{colStats:o}=this;return Array.from({length:o.numColumns},(r,n)=>{let i=o.total(n),s=0,a="";o.forEachResidue(n,(c,u)=>{u>s&&(s=u,a=gm(c))});let l=i?s/i:0;return{letter:a,color:l>.4?`hsl(240, 30%, ${100*Math.max(1-l/3,.3)}%)`:void 0}})},get colClustalX(){let{colStats:o}=this;return Array.from({length:o.numColumns},(r,n)=>Rve(o,n))},get colSimilarity(){let{colStats:o,sequenceType:r}=this,n=r==="amino"?EEe:TEe;return Array.from({length:o.numColumns},(i,s)=>n(o,s))},get conservation(){let{colStats:o,alphabetMaxBits:r}=this;return Array.from({length:o.numColumns},(n,i)=>{let s=o.total(i),a=o.gapCount(i);return s>a?Math.max(0,1-o.entropy(i)/r)*(1-a/s):0})},get alphabetMaxBits(){return Gde(this.sequenceType)},get propertyConservation(){return this.sequenceType==="amino"?sEe(this.colStats):[]},get treeLayout(){let o=()=>this.effectiveTreeWidth;return oz(this.root,{get rowHeight(){return t.rowHeight},get treeWidth(){return o()}})},get hierarchy(){return this.treeLayout.root},get totalHeight(){return this.leaves.length*t.rowHeight},get leaves(){return this.treeLayout.leaves},get rootToTipLength(){return this.treeLayout.rootToTipLength},get pxPerBranchLength(){let o=this.rootToTipLength;return this.showBranchLenEffective&&o?this.effectiveTreeWidth/o:0},get maxDepthToLeaf(){return this.treeLayout.root.depthToLeaf},get allBranchesLength0(){return this.rootToTipLength===0},get showBranchLenEffective(){return this.allBranchesLength0?!1:t.showBranchLen}})).views(t=>({get totalWidth(){return t.numColumns*t.colWidth}})).views(t=>({get showMsaLetters(){return t.drawMsaLetters&&t.rowHeight>=U3&&t.colWidth>=VAe&&t.colWidth>t.rowHeight/2}})).views(t=>{let o=new WeakMap;return{get columnTrackContent(){let{MSA:r,blanks:n,hideGapsEffective:i}=t,s=r?.getWidth()??0,a=(u,f,p)=>{if(!u.row)return f;let d=Array.from({length:s},()=>p),m=t.seqPosIndex(u.row);return f.forEach((y,b)=>{let h=m?.[b];h!==void 0&&(d[h]=y)}),d},l=u=>i?aAe(n,u):u,c=(u,f)=>{let p=u.row?t.seqPosIndex(u.row)?.[f-1]:f-1;if(!(p===void 0||p<0||p>=s))return i?gC(n,p):p};return new Map(t.columnTracks.map(u=>{if(u.kind==="arc"){let p=(u.arcs??[]).map(d=>{let m=c(u,Math.min(d.start,d.end)),y=c(u,Math.max(d.start,d.end));return m!==void 0&&y!==void 0&&m<y?{start:m,end:y,color:d.color}:void 0}).filter(Oa);return[u.id,{arcs:p}]}if(u.kind==="bar"){let p=u.scales?.y?.domainMax??1,d=l(a(u,u.values??[],0)).map(m=>Math.min(1,Math.max(0,m/p)));return[u.id,{values:d}]}let f=l(a(u,(u.data??"").split("")," "));return[u.id,{data:f.join("")}]}))},trackHeight(r,n=r,i){return t.trackHeights.get(n)??i??a7e[r]??t.rowHeight},columnTrackModel(r){let n=o.get(r);return n||(n=Nf(()=>{let i=jEe.has(r.kind)?l7e(r.id):void 0,s=this.columnTrackContent.get(r.id);return{model:{id:r.id,name:r.name,kind:r.kind,heightKey:i,height:this.trackHeight(r.kind,i,r.height),barColor:r.color,arcColor:r.color,customColorScheme:r.encoding?.color?RV(r.encoding.color,[...r.encoding.color.domain??[],...new Set(r.data)]):void 0,data:s?.data,arcs:s?.arcs}}}),o.set(r,n)),n.get()},get columnTrackModels(){return t.columnTracks.map(r=>this.columnTrackModel(r))}}}).views(t=>({get secondaryStructureConsensus(){return t.MSA?.secondaryStructureConsensus},get secondaryStructureArcs(){let{blanks:o,hideGapsEffective:r}=t,n=this.secondaryStructureConsensus;if(n)return DEe(r?V_(o,n):n).map(({start:i,end:s,pseudoknot:a})=>({start:i,end:s,color:a?u7e:c7e}))},get adapterTrackModels(){let{MSA:o,hideGapsEffective:r,blanks:n}=t,i=(o?.tracks??[]).filter(a=>!!a.data);if(i.length===0)return[];let{rowHeight:s}=t;return i.map(a=>({model:{...a,kind:"text",data:r?V_(n,a.data):a.data,height:s}}))},get basePairTrackModels(){let o=this.secondaryStructureArcs;return o?.length?[{model:{id:"base-pairs",name:"Base pairs",kind:"arc",heightKey:"arc",height:t.trackHeight("arc"),arcs:o}}]:[]},get computedTrackModels(){return[{id:"conservation",name:"Conservation",kind:"bar",barColor:"gray"},...t.sequenceType==="amino"?[{id:"property-conservation",name:"Property conservation",kind:"bar",barColor:"#6a51a3"}]:[],{id:"sequence-logo",name:"Sequence logo",kind:"logo"},{id:"position-ruler",name:"Position",kind:"ruler"}].map(o=>({model:{...o,heightKey:jEe.has(o.kind)?o.kind:void 0,height:t.trackHeight(o.kind)}}))},get referenceTrackModels(){let{relativeTo:o}=t,r=o===void 0?void 0:t.columns.get(o);return o===void 0||r===void 0?[]:[{model:{id:"reference-row",name:o,kind:"reference",data:r,height:t.rowHeight}}]},get tracks(){return[...this.adapterTrackModels,...this.basePairTrackModels,...t.columnTrackModels,...t.numColumns>0?this.computedTrackModels:[],...this.referenceTrackModels]},get turnedOnTracks(){return this.tracks.filter(o=>!YEe(t.turnedOffTracks,o.model.id))},get showHorizontalScrollbar(){return eTe(t.totalWidth,t.msaAreaWidth)},visibleColToRowLetter(o,r){return t.rowSequence(o)?.[this.visibleColToGlobalCol(r)]},visibleColToSeqPos(o,r){return pEe(t.seqPosIndex(o),this.visibleColToGlobalCol(r))},visibleColToSeqPosOneBased(o,r){let n=this.visibleColToSeqPos(o,r);return n!==void 0?n+1:void 0},globalColToVisibleCol(o){let{blanks:r,hideGapsEffective:n}=t;return n?uEe(r,o):o},visibleColToGlobalCol(o){let{blanks:r,hideGapsEffective:n}=t;return n?cEe(r,o):o},seqPosToGlobalCol(o,r){let n=t.rowSequence(o);return n===void 0?void 0:t.seqPosIndex(o)?.[r]??(r===0?0:n.length)},seqEndToGlobalCol(o,r){let n=t.seqPosIndex(o);return n&&n.length>0?n[Math.min(r,n.length-1)]:void 0},seqPosToVisibleCol(o,r){let n=this.seqPosToGlobalCol(o,r);return n===void 0?void 0:this.globalColToVisibleCol(n)},visibleSpan({row:o,start:r,end:n}){let{blanks:i}=t,s=Math.max(1,Math.floor(r)),a=Math.ceil(n),l=s-1,c=Math.min(a,t.MSA?.getWidth()??a)-1;if(o!==void 0){let p=this.seqPosToGlobalCol(o,s-1),d=this.seqEndToGlobalCol(o,a-1);if(p===void 0||d===void 0)return;l=p,c=d}let u=this.globalColToVisibleCol(l)??gC(i,l),f=this.globalColToVisibleCol(c)??gC(i,c)-1;return u<=f?{startCol:u,endCol:f}:void 0},get residueMappingProblems(){let o=[];for(let r of t.residueMappings){let n={row:r.row,structureId:r.structure.id},i=t.seqPosIndex(r.row)?.length;if(i===void 0){o.push({...n,scope:"mapping",reason:"no such row in the alignment"});continue}if(r.rowLength!==void 0&&r.rowLength!==i){o.push({...n,scope:"mapping",reason:`computed against a ${r.rowLength}-residue row; this one has ${i}`});continue}let s=r.segments.find(a=>a.rowEnd>i||a.rowStart<1);if(s){o.push({...n,scope:"mapping",reason:`segment ${s.rowStart}-${s.rowEnd} does not fit a ${i}-residue row`});continue}for(let a of r.segments)XEe(a)||o.push({...n,scope:"segment",reason:`segment ${a.rowStart}-${a.rowEnd} maps to ${a.structStart}-${a.structEnd}, which is a different length`})}return o},get usableResidueMappings(){let o=new Set(this.residueMappingProblems.filter(r=>r.scope==="mapping").map(r=>`${r.row}\0${r.structureId}`));return t.residueMappings.filter(r=>!o.has(`${r.row}\0${r.structure.id}`)).map(r=>({...r,segments:r.segments.filter(XEe)}))},get mappedStructures(){return this.usableResidueMappings.map(o=>({row:o.row,structure:o.structure}))},structureResidue(o,r,n){let i=[];for(let s of this.usableResidueMappings){if(s.row!==o||n!==void 0&&s.structure.id!==n)continue;let a=s.segments.find(l=>r>=l.rowStart&&r<=l.rowEnd);if(a){let l=a.structStart+(r-a.rowStart);i.push({structure:s.structure,position:l,observed:!m7e(s.unobserved,l)})}}return i.length===1?i[0]:void 0},rowResidue(o,r,n){let i=[];for(let s of this.usableResidueMappings){if(s.structure.id!==o||n!==void 0&&s.structure.asymId!==void 0&&s.structure.asymId!==n)continue;let a=s.segments.find(l=>r>=l.structStart&&r<=l.structEnd);a&&i.push({rowName:s.row,seqPos:a.rowStart+(r-a.structStart)})}return i.length===1?i[0]:void 0}})).views(t=>({get treeScaleBar(){return Ove(t.pxPerBranchLength,t.effectiveTreeAreaWidth-t.marginLeft*2)},get topBandHeight(){return Math.max(t.showHorizontalScrollbar?t.minimapHeight:0,t.rowPanelsHeaderHeight,t.treeOverviewHeight+(this.treeScaleBar?Zu:0))},get msaAreaHeight(){return t.height-this.topBandHeight-t.headerHeight-this.totalTrackAreaHeight},get totalTrackAreaHeight(){return _0(t.turnedOnTracks.map(o=>o.model.height))},get annotationTypes(){let o=new Map;for(let r of t.allAnnotations)o.has(r.accession)||o.set(r.accession,r);return o},get defaultOffAccessions(){return new Set(t.allAnnotations.filter(o=>o.defaultOff).map(o=>o.accession))},featureOff(o){return t.turnedOffFeatures.get(o)??this.defaultOffAccessions.has(o)},get filteredAnnotations(){return t.allAnnotations.filter(o=>!this.featureOff(o.accession))},get cellFill(){return t.bgColor?t.actuallyShowDomains&&t.domainFill&&this.filteredAnnotations.length>0?"domain":"residue":"none"},get annotationsByRow(){let{rowNamesSet:o}=t;return ele(this.filteredAnnotations,r=>JEe(r.id,o))}})).views(t=>({get showVerticalScrollbar(){return eTe(t.totalHeight,t.msaAreaHeight)}})).views(t=>({get dataInitialized(){return!!(t.data.msa||t.data.tree)&&!t.error},get blocksX(){return Xv({viewportSize:t.msaAreaWidth,viewportPos:-t.scrollX,blockSize:t.blockSize,mapSize:t.totalWidth})},get blocksY(){return Xv({viewportSize:t.msaAreaHeight,viewportPos:-t.scrollY,blockSize:t.blockSize,mapSize:t.totalHeight})}})).views(t=>({get verticalScrollbarWidth(){return t.showVerticalScrollbar?20:0},get msaCanvasWidth(){return t.msaAreaWidth-this.verticalScrollbarWidth},get maxScrollX(){return Math.min(-t.totalWidth+this.msaCanvasWidth,0)},get blocks2d(){return t.blocksY.flatMap(o=>t.blocksX.map(r=>[r,o]))},get wheelZooming(){return t.zoomSnapshot!==void 0},get isLoading(){return t.loadingMSA||t.loadingTree},get dataWarnings(){let{annotations:o,rowNamesSet:r}=t;return t.dataInitialized&&o.length>0&&!o.some(n=>r.has(JEe(n.id,r)))?[`0 of ${o.length} annotations name a row in this alignment`]:[]},get warnings(){return[...t.loadWarnings,...this.dataWarnings.filter(o=>!t.dismissedWarnings.includes(o))]},get maxScrollY(){return Math.min(-t.totalHeight+t.msaAreaHeight,0)},get wheelZoomAxis(){return t.scrollZoom?t.scrollZoomAxis:"both"}})).actions(t=>({setDrawMsaLetters(o){t.drawMsaLetters=o},clearWarnings(){t.loadWarnings=[],t.dismissedWarnings=t.dataWarnings},setScrollZoom(o){t.scrollZoom=o},setScrollZoomAxis(o){t.scrollZoomAxis=o},setHoveredTreeNode(o){if(o===t.hoveredTreeNode?.nodeId)return;if(!o){t.hoveredTreeNode=void 0;return}let r=tf(t.hierarchy,n=>n.data.id===o);t.hoveredTreeNode=r?{nodeId:o,descendantNames:Qc(r).map(n=>n.data.name)}:void 0},calculateNeighborJoiningTreeFromMSA(){let o=[...t.rowMap];if(o.length<2)throw new Error("Need at least 2 sequences to build a tree");if(o.length>sb)throw new Error(`Neighbor joining here is capped at ${sb} sequences and this alignment has ${o.length}. Build the tree with FastTree or IQ-TREE and open it alongside the alignment: https://gmod.org/JBrowseMSA/tutorials/protein_family`);this.replaceTree(rEe(o))},rerootAt(o){let r=tf(Jp(t.tree,i=>i.children),i=>i.data.id===o);if(!r?.parent)return;let n=DV(Jp(t.inputTree,i=>i.children),Qc(r).map(i=>i.data.name));if(n){let i=Qc(n);t.setTreeRoot({outgroup:[...new Set([i[0].data.name,i.at(-1).data.name])]})}},replaceTree(o){_r(()=>{t.setTreeFilehandle(void 0),t.collapsed.clear(),t.rotated.clear(),t.setShowOnly(void 0),t.setTree(o)})},resetZoom(){t.setColWidth(12),t.setRowHeight(16)},zoomAtCenter(o,r="both"){this.zoomToPos(o,t.msaCanvasWidth/2,t.msaAreaHeight/2,r)},zoomIn(){this.zoomAtCenter(1.5)},zoomOut(){this.zoomAtCenter(.75)},zoomToPos(o,r,n,i="both"){_r(()=>{let s=(-t.scrollX+r)/t.colWidth,a=(-t.scrollY+n)/t.rowHeight,l=i!=="both"||t.colWidth===12&&t.rowHeight===16;if(i!=="vertical"){let{value:d,held:m}=ZEe(t.colWidth,o,12,t.zoomHeld.col,X_,l);t.colWidth=d,t.zoomHeld={...t.zoomHeld,col:m}}if(i!=="horizontal"){let{value:d,held:m}=ZEe(t.rowHeight,o,16,t.zoomHeld.row,Z_,l);t.rowHeight=d,t.zoomHeld={...t.zoomHeld,row:m}}t.scrollX=dr(r-s*t.colWidth,t.maxScrollX,0);let c=n-a*t.rowHeight,u=Math.max(0,-t.maxScrollY),f=t.totalHeight-u,p=f>0?dr(1-u/f,0,1):1;t.scrollY=dr(c*(1-p),t.maxScrollY,0)})},wheelZoomToPos(o,r,n){t.zoomSnapshot??=L4(t,!1),this.zoomToPos(o,r,n,t.wheelZoomAxis),Ahe(t,t.zoomSnapshot)||(t.zoomSnapshot=L4(t,!0))},endWheelZoom(){t.zoomSnapshot=void 0},doScrollY(o){this.setScrollY(t.scrollY+o)},setScrollY(o){t.scrollY=dr(o,t.maxScrollY,0)},setAnnotations(o){t.annotations=o},applyGFFText(o){this.setAnnotations(mR(AR(o)))},doScrollX(o){this.setScrollX(t.scrollX+o)},setScrollX(o){t.scrollX=dr(o,t.maxScrollX,0)},setColumnTracks(o){t.columnTracks.replace(o.map(_V))},setRowData(o){t.data.setTreeMetadata(JSON.stringify(o))},setEncodings(o){t.encodings.replace(o.map(SV))},setRowPanels(o){t.rowPanels.replace(o.map(BV))},setResidueMappings(o){t.residueMappings.replace(o)},toggleTrack(o){t.turnedOffTracks.set(o,!YEe(t.turnedOffTracks,o))},setTracksShown(o,r){for(let n of o)oTe.has(n)===!r?t.turnedOffTracks.delete(n):t.turnedOffTracks.set(n,!r)},setStatus(o){t.status=o}})).views(t=>({cellAt(o,r){let n=t.visibleColToGlobalCol(o),i=r===void 0?void 0:t.leaves[r]?.data.name;return i===void 0?{column:n+1}:{column:n+1,row:i,residue:t.visibleColToSeqPosOneBased(i,o),letter:t.rowSequence(i)?.[n]}},get hoveredCell(){let{mouseCol:o,mouseRow:r}=t;return o===void 0?void 0:this.cellAt(o,r)},get clickedCell(){let{mouseClickCol:o,mouseClickRow:r}=t;return o===void 0?void 0:this.cellAt(o,r)},get viewport(){let{scrollX:o,colWidth:r,numColumns:n,viewInitialized:i}=t;if(n===0||!i)return;let{xStart:s,xEnd:a}=Fa({offsetX:-o,blockWidth:t.msaCanvasWidth,colWidth:r}),l=Math.max(0,Math.min(a,n)-1);return{startColumn:t.visibleColToGlobalCol(Math.min(s,l))+1,endColumn:t.visibleColToGlobalCol(l)+1}},get segmentDomainTypes(){return[...t.annotationTypes.values()].filter(o=>L3.has(o.featureType??"")).toSorted((o,r)=>o.start-r.start)},get categoricalDomainTypes(){return[...t.annotationTypes.values()].filter(o=>!L3.has(o.featureType??""))},get fillPalette(){let o=Object.fromEntries(this.segmentDomainTypes.map((n,i)=>[n.accession,F3[i%F3.length]])),r=n=>this.categoricalDomainTypes.filter(i=>NAe(i.featureType)===n).map(i=>i.accession);return{...o,...uT(r(!1),LAe,85),...uT(r(!0),FAe,45)}},get featureFillEncoding(){return this.resolvedEncodings.find(o=>o.channel==="featureFill")},get featureColors(){return CV(t.filteredAnnotations,this.featureFillEncoding,this.fillPalette)},get featureLabels(){let o=this.resolvedEncodings.find(r=>r.channel==="featureLabel");return o?xV(t.filteredAnnotations,o.field):void 0},get segmentLabels(){return new Map(this.segmentDomainTypes.map((o,r)=>{let n=/(\d+)\s*$/.exec(o.name);return[o.accession,n?n[1]:`${r+1}`]}))},get visibleDomainTypes(){return this.categoricalDomainTypes.filter(o=>!t.featureOff(o.accession)).toSorted((o,r)=>o.start-r.start)},get legends(){let{featureFillEncoding:o,fillPalette:r,visibleDomainTypes:n}=this,i=new Map,s=new Set,a=(l,c,u,f=!1)=>{let p=l??"domains";if(u.length===0||i.has(p))return;let d=f||l===void 0?"domains":`rowData-${c}`,m=d;for(let y=2;s.has(m);y++)m=`${d}-${y}`;s.add(m),i.set(p,{id:m,title:c??"Domains",entries:u})};t.actuallyShowDomains&&t.numColumns>0&&a(o?.key,o?.title,o?o.legend:n.map(l=>({id:l.accession,label:l.name,color:l.color??r[l.accession]})),!0);for(let{channel:l,key:c,title:u,legend:f}of this.resolvedEncodings)FV.has(l)||a(c,u,f);for(let{legendKey:l,legendTitle:c,legend:u}of this.rowPanelScales)a(l,c,u);return[...i.values()]},get domainUnderline(){return t.actuallyShowDomains&&t.cellFill!=="domain"&&!t.subFeatureRows&&t.showMsaLetters},get domainBands(){let{blanks:o}=t,r=new Map;for(let[n,i]of Object.entries(t.annotationsByRow)){let s=i.toSorted((a,l)=>B3(l)-B3(a)).map(a=>{let l=t.seqPosToGlobalCol(n,a.start-1),c=t.seqEndToGlobalCol(n,a.end-1);if(l===void 0||c===void 0)return;let u=gC(o,l),f=gC(o,c+1);return f>u?{annotation:a,startCol:u,endCol:f}:void 0}).filter(Oa).map((a,l)=>({...a,stackIndex:l}));s.length>0&&r.set(n,fC(s))}return r},get domainBandsByStart(){return new Map([...this.domainBands].map(([o,r])=>[o,r.toSorted((n,i)=>n.startCol-i.startCol)]))},get mouseOverDomains(){let{mouseCol:o}=t,r=t.mouseOverRowName;if(r===void 0||o===void 0)return WEe;let n=(this.domainBands.get(r)??[]).filter(i=>o>=i.startCol&&o<i.endCol).map(i=>i.annotation);return n.length>0?n:WEe},get referenceRowIndex(){let{relativeTo:o}=t;return o===void 0?void 0:t.rowNamesSet.get(o)},get hoveredRowIndices(){let{hoveredTreeNode:o,rowNamesSet:r}=t;return o?o.descendantNames.map(n=>r.get(n)).filter(Oa):[]},get highlightedColumnRuns(){return tTe([...t.highlightedColumns??[]].sort((o,r)=>o-r)).map(([o,r])=>({start:o,end:r}))},fillHighlightLabel(o,r,n){if(!o.includes("{"))return o;let i=r&&n!==void 0?t.seqPosIndex(r)?.[n-1]:void 0,s=r&&i!==void 0?t.MSA?.getRow(r)[i]??"":"";return o.replaceAll("{residue}",s).replaceAll("{position}",n===void 0?"":String(n))},get resolvedHighlights(){let{rowNamesSet:o,transientHighlights:r}=t;return[...t.highlights,...Object.values(r).flat()].flatMap(({row:i,rows:s,start:a,end:l,label:c,color:u})=>{let f={label:c&&this.fillHighlightLabel(c,i,a),color:u};if(s){let d=s.map(m=>o.get(m)).filter(Oa);return d.length?[{...f,rowIndices:d}]:[]}if(a===void 0||l===void 0)return[];let p=t.visibleSpan({row:i,start:a,end:l});return p?[{...f,...p,rowIndices:[]}]:[]})},get resolvedSelection(){let{selection:o,rowNamesSet:r,numRows:n}=t,i=o&&t.visibleSpan({start:o.start,end:o.end});if(!o||!i)return;let s=o.rows?tTe(o.rows.map(a=>r.get(a)).filter(Oa).sort((a,l)=>a-l)):n>0?[[0,n-1]]:[];return s.length>0?{...i,rowRuns:s}:void 0},get selectionSize(){let o=this.resolvedSelection,r=this.selectionFileSpan;return o&&r?{columns:r.end-r.start+1,rows:_0(o.rowRuns.map(([n,i])=>i-n+1))}:void 0},get selectionFileSpan(){let{selection:o}=t,r=t.MSA?.getWidth()??0,n=Math.max(1,Math.floor(o?.start??0)),i=Math.min(r,Math.ceil(o?.end??0));return o&&n<=i?{start:n,end:i}:void 0},get selectionFasta(){let{rowNames:o}=t,r=this.resolvedSelection,n=this.selectionFileSpan;if(!r||!n)return"";let i=r.rowRuns.flatMap(([s,a])=>o.slice(s,a+1)).flatMap(s=>{let a=t.rowSequence(s);return a===void 0?[]:[[s,a]]});return Ive(i,n.start,n.end)},columnStatsAt(o){let{colStats:r,conservation:n,propertyConservation:i}=t;return Dve({col:o,colStats:r,conservation:n,propertyConservation:i})},getRowData(o){return{data:t.MSA?.getRowData(o),rowData:t.rowDataOf(o)}},get resolvedEncodings(){return t.encodings.map(o=>({...o,...this.scaleOf(o,FV.has(o.channel)?"features":"rows")}))},get resolvedScales(){let o=Object.values(t.rowData),r=(i,s)=>i.map(a=>af(a,s)).filter(Oa),n=(i,s)=>({spec:i,field:i.field,table:s,...s==="rows"?{values:o.map(a=>a?.[i.field]).filter(Oa)}:{values:r(t.allAnnotations,i.field),shown:r(t.filteredAnnotations,i.field)}});return hEe([...t.encodings.map(i=>n(i,FV.has(i.channel)?"features":"rows")),...t.rowPanels.flatMap(i=>i.kind==="strip"?[n(i,"rows")]:i.encoding?.color?[n(i.encoding.color,"features")]:[])])},scaleOf(o,r){return this.resolvedScales.get(wV({spec:o,field:o.field,table:r}))},get rowPanelScales(){let{rowData:o}=t,{fillPalette:r,featureFillEncoding:n,featureLabels:i}=this,s=t.filteredAnnotations;return t.rowPanels.map(a=>{if(a.kind==="features"){let p=a.encoding?.color,d=p?{field:p.field,...this.scaleOf(p,"features")}:n,m=a.encoding?.label;return{kind:a.kind,x:a.x,header:a.header??"",field:d?.field,legendKey:d?.key,legendTitle:d?.title,colors:p?CV(s,d,r):this.featureColors,labels:m?xV(s,m):i,legend:d?.legend??this.visibleDomainTypes.map(y=>({id:y.accession,label:y.name,color:y.color??r[y.accession]}))}}let{colorOf:l,legend:c,key:u,title:f}=this.scaleOf(a,"rows");return{kind:a.kind,field:a.field,header:a.header??a.field,legendKey:u,legendTitle:f,colors:WQ(o,a.field,l),legend:c}})},get resolvedRowPanels(){let o=this.rowPanelScales,r=0;return t.rowPanels.map((n,i)=>{let s=bV(n,t),a={id:`rowpanel-${i}`,width:s,offsetX:r};if(r+=s,n.kind==="features"){let l=n.transform?.find(c=>c.type==="align");return{...a,...o[i],spans:jve({panel:n,width:s,colWidth:t.colWidth,domainBands:this.domainBands,annotationsByRow:t.annotationsByRow,shifts:l?this.featureAlignShifts.get(l.on):void 0})}}return{...a,...o[i]}})},get featureAlignShifts(){let o=new Set(t.rowPanels.flatMap(r=>r.kind==="features"&&r.x==="position"?(r.transform??[]).filter(n=>n.type==="align").map(n=>n.on):[]));return new Map([...o].map(r=>[r,new Map(Object.entries(t.annotationsByRow).map(([n,i])=>{let s=i.find(a=>GR(a)===r);return s?[n,1-s.start]:void 0}).filter(Oa))]))},get tipLabelColors(){let o=this.resolvedEncodings.find(r=>r.channel==="tipLabel");return o?WQ(t.rowData,o.field,o.colorOf):void 0},get rowTints(){let o=this.resolvedEncodings.find(n=>n.channel==="rowTint");if(!o)return;let r=WQ(t.rowData,o.field,o.colorOf);return t.rowNames.map(n=>{let i=r.get(n);return i&&z_(i,ame)})},get branchColors(){let o=this.resolvedEncodings.find(s=>s.channel==="branch");if(!o)return;let r=mC(t.tree),n=new Map,i=new Map;for(let s=r.length-1;s>=0;s--){let a=r[s],l=a.children.length>0?g7e(a.children.map(u=>n.get(u))):t.rowDataOf(a.name)?.[o.field];n.set(a,l);let c=l===void 0?void 0:o.colorOf(l);c&&i.set(a.id,c)}return i}})).actions(t=>({setHeaderHeight(o){t.headerHeight=o},setHideHeader(o){t.hideHeader=o},setEmbeddedMode(o){t.embeddedMode=o},setImportForm(o){t.importForm=o},treeOverviewClick(o){let r=t.treeOverviewHit(o),n=t.treeOverviewFocusRows,i=!!n&&!!r&&r.rows[0]>=n[0]&&r.rows[1]<=n[1];t.setShowOnly(i||!r?void 0:r.id)},setTrackHeight(o,r){t.trackHeights.set(o,r)},reset(){t.resetCount++,t.loadWarnings=[],t.dismissedWarnings=[],t.setStatus(void 0),V8(t,Object.fromEntries(Object.entries(PC(t)).filter(([o])=>d7e.has(o)))),t.setError(void 0),t.setAnnotations([]),t.setHighlightedColumns(void 0),t.transientHighlights={},t.setMousePos(void 0,void 0),t.setMouseClickPos(void 0,void 0),t.setHoveredTreeNode(void 0)},async exportSVG(o){let{renderToSvg:r}=await Promise.resolve().then(()=>(VEe(),GEe)),n=await r(t,o),i=new Blob([n],{type:"image/svg+xml"});qv(i,yV(t.msaFilehandle,"svg"))},exportNewick(){let o=new Blob([t.treeNewick],{type:"text/plain"});qv(o,yV(t.treeFilehandle??t.msaFilehandle,"nwk","tree"))},setFilter(o,r){r===t.defaultOffAccessions.has(o)?t.turnedOffFeatures.set(o,!r):t.turnedOffFeatures.delete(o)},fit(){_r(()=>{for(let o=0;o<2;o++)this.fitHorizontally(12),this.fitVertically(16)})},fitVertically(o=bm){t.numRows>0&&t.setRowHeight(dr(t.msaAreaHeight/t.numRows,Z_,o)),t.scrollY=0},zoomToRegion(o){let r=t.visibleSpan(o);!r||!t.viewInitialized||_r(()=>{t.setColWidth(dr(t.msaCanvasWidth/(r.endCol-r.startCol+1),X_,bm)),t.scrollX=dr(-r.startCol*t.colWidth,t.maxScrollX,0)})},revealRegion(o){_r(()=>{this.zoomToRegion(o);let r=o.row===void 0?void 0:t.rowNamesSet.get(o.row);r!==void 0&&t.viewInitialized&&t.setScrollY(-(r+.5)*t.rowHeight+t.msaAreaHeight/2)})},zoomToSelection(){let{selection:o,resolvedSelection:r}=t;!o||!r||_r(()=>{if(this.zoomToRegion({start:o.start,end:o.end}),o.rows&&t.viewInitialized){let{rowRuns:n}=r,i=n[0][0],s=n.at(-1)[1];t.setRowHeight(dr(t.msaAreaHeight/(s-i+1),Z_,bm)),t.scrollY=dr(-i*t.rowHeight,t.maxScrollY,0)}})},selectBlock(o,r){let{numColumns:n,numRows:i,rowNames:s}=t;if(n===0||i===0)return;let a=(d,m,y)=>[dr(d,0,y),dr(m,0,y)].sort((b,h)=>b-h),[l,c]=a(o.col,r.col,n-1),[u,f]=o.row===void 0||r.row===void 0?[0,i-1]:a(o.row,r.row,i-1),p=u===0&&f===i-1;t.setSelection({start:t.visibleColToGlobalCol(l)+1,end:t.visibleColToGlobalCol(c)+1,...p?{}:{rows:s.slice(u,f+1)}})},fitHorizontally(o=bm){t.numColumns>0&&t.setColWidth(dr(t.msaCanvasWidth/t.numColumns,X_,o)),t.scrollX=0},afterCreate(){t.highlightColumns?.length&&t.setHighlightedColumns(t.highlightColumns);let o=()=>!!t.treeFilehandle&&!t.data.tree;if(au(t,yg(()=>t.dataInitialized&&!o()?{clades:PC(t.clades),treeRoot:t.treeRoot}:void 0,n=>{if(n?.clades.length)for(let{mark:i,nodeId:s}of t.resolvedClades)s!==void 0&&(i==="collapse"&&!t.collapsed.includes(s)?t.toggleCollapsed(s):i==="focus"?t.setShowOnly(s):i==="rotate"&&!t.rotated.includes(s)&&t.toggleRotated(s))},{fireImmediately:!0,equals:hg})),au(t,Jl(()=>{let{region:n}=t;n&&t.viewInitialized&&t.numColumns>0&&!o()&&(this.revealRegion(n),t.setRegion(void 0))})),typeof window<"u"&&typeof window.matchMedia=="function"){let n=()=>window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),i=n(),s=()=>{t.setHighResScaleFactor(window.devicePixelRatio),i.removeEventListener("change",s),i=n(),i.addEventListener("change",s)};i.addEventListener("change",s),au(t,()=>{i.removeEventListener("change",s)})}fT(t,{what:"tree",getFilehandle:()=>t.treeFilehandle,onLoad:n=>{t.setTree(n)},setLoading:n=>{t.setLoadingTree(n)},clearFilehandle:()=>{t.setTreeFilehandle(void 0)}}),fT(t,{what:"row metadata",optional:!0,getFilehandle:()=>t.treeMetadataFilehandle,onLoad:n=>{t.setTreeMetadata(n)}});let r=!1;au(t,Jl(()=>{let n=t.data.gff;if(n)try{t.applyGFFText(n),r=!0}catch(i){console.error(i),t.addWarning(`The annotations did not parse: ${i}`)}else r&&(r=!1,t.setAnnotations([]))})),fT(t,{what:"annotations",optional:!0,getFilehandle:()=>t.gffFilehandle,onLoad:n=>{t.setGFF(n)},clearFilehandle:()=>{t.setGFFFilehandle(void 0)}}),fT(t,{what:"alignment",getFilehandle:()=>t.msaFilehandle,onLoad:n=>{t.setMSA(n)},setLoading:n=>{t.setLoadingMSA(n)},clearFilehandle:()=>{t.setMSAFilehandle(void 0)}}),au(t,Jl(()=>{t.dynamicColorSchemeName&&j_(t.colStats),t.showColumnStats&&j_(t.colStats,t.conservation,t.propertyConservation),j_(t.columns)}))}})).postProcessSnapshot(({data:t,columnTracks:o,...r})=>({...r,...p7e(o,e),data:{...r.treeFilehandle?{}:{tree:t.tree},...r.msaFilehandle?{}:{msa:t.msa},...r.treeMetadataFilehandle?{}:{treeMetadata:t.treeMetadata},...r.gffFilehandle?{}:{gff:t.gff}}}))}var eP=h7e;lN();function y7e(e){return typeof e=="string"?{colorSchemeName:e}:e?{customColorScheme:KQ(e)}:{}}function b7e(e=[]){let t=[...new Set(e)].sort((r,n)=>r-n),o=[];for(let r of t){let n=o.at(-1);n?.end===r-1?n.end=r:o.push({start:r,end:r})}return o}function GV({highlights:e=[],highlightColumns:t}){return[...e,...b7e(t)]}function HV(e){return e?{uri:e,locationType:"UriLocation"}:void 0}function VV({msaFilehandle:e,treeFilehandle:t,gffFilehandle:o,msaUrl:r,treeUrl:n,gffUrl:i}){return{msaFilehandle:e??HV(r),treeFilehandle:t??HV(n),gffFilehandle:o??HV(i)}}function nTe(e){return Ww(e==="dark"?{palette:{mode:"dark"}}:typeof e=="object"?e:void 0)}function iTe(e){let{msa:t,tree:o,gff:r,rowData:n,colorScheme:i,height:s,colWidth:a,rowHeight:l,allowedGappyness:c,highlightColumns:u,highlights:f,features:p,selection:d,clades:m,relativeTo:y,columnTracks:b,residueMappings:h,encodings:g,rowPanels:C,drawTree:x,treeAreaWidth:E,showBranchLen:I,treeOrder:T,treeRoot:S,region:B,residueEncoding:R}=e,{msaFilehandle:M,treeFilehandle:Q,gffFilehandle:v}=VV(e);return{type:"MsaView",...t||o||r||n?{data:{msa:t??"",tree:o??"",gff:r,...n?{treeMetadata:JSON.stringify(n)}:{}}}:{},...M?{msaFilehandle:M}:{},...Q?{treeFilehandle:Q}:{},...v?{gffFilehandle:v}:{},...y7e(i),...s?{height:s}:{},...a?{colWidth:a}:{},...l?{rowHeight:l}:{},...c!==void 0?{allowedGappyness:c}:{},...f||u?{highlights:GV({highlights:f,highlightColumns:u})}:{},...p?{features:p}:{},...d?{selection:d}:{},...m?{clades:m}:{},...y?{relativeTo:y}:{},...b?{columnTracks:b}:{},...h?{residueMappings:h}:{},...g?{encodings:g}:{},...C?{rowPanels:C}:{},...x!==void 0?{drawTree:x}:{},...E?{treeAreaWidth:E}:{},...I!==void 0?{showBranchLen:I}:{},...T?{treeOrder:T}:{},...S?{treeRoot:S}:{},...B?{region:B}:{},...R!==void 0?{bgColor:R==="fill"}:{}}}function C7e(e,t){return e.msa===t.msa&&e.tree===t.tree&&JSON.stringify([e.msaFilehandle,e.treeFilehandle])===JSON.stringify([t.msaFilehandle,t.treeFilehandle])}var x7e=(0,Uo.forwardRef)(function(t,o){let r={...t,...VV(t)},{msa:n,tree:i,msaFilehandle:s,treeFilehandle:a}=r,l={msa:n,tree:i,msaFilehandle:s,treeFilehandle:a},[c,u]=(0,Uo.useState)({source:l,generation:0});return C7e(c.source,l)||u({source:l,generation:c.generation+1}),Uo.default.createElement(E7e,{key:c.generation,modelRef:o,...r})}),$V=x7e;function tP(e,t,o){let r=(0,Uo.useRef)(o);(0,Uo.useEffect)(()=>{r.current=o});let n=!!o;(0,Uo.useEffect)(()=>n?yg(()=>e[t],i=>{r.current?.(i)},{equals:hg}):void 0,[e,t,n])}function nr(e,t,{inSnapshot:o=!1}={}){return{read:e,apply:t,inSnapshot:o}}function Bf(e){return(t,o)=>{o!==void 0&&e(t,o)}}var jV=[nr(e=>e.height,Bf((e,t)=>{e.setHeight(t)})),nr(e=>e.colWidth,Bf((e,t)=>{e.setColWidth(t)})),nr(e=>e.rowHeight,Bf((e,t)=>{e.setRowHeight(t)})),nr(e=>e.allowedGappyness,Bf((e,t)=>{e.setAllowedGappyness(t)})),nr(e=>e.drawTree,Bf((e,t)=>{e.setDrawTree(t)})),nr(e=>e.treeAreaWidth,Bf((e,t)=>{e.setTreeAreaWidth(t)})),nr(e=>e.showBranchLen,Bf((e,t)=>{e.setShowBranchLen(t)})),nr(e=>e.treeOrder,Bf((e,t)=>{e.setTreeOrder(t)})),nr(e=>e.residueEncoding,Bf((e,t)=>{e.setBgColor(t==="fill")})),nr(e=>!!e.hideHeader,(e,t)=>{e.setHideHeader(t)}),nr(e=>e.relativeTo,(e,t)=>{e.drawRelativeTo(t)}),nr(e=>e.gffFilehandle,(e,t,{gff:o})=>{t?e.setGFFFilehandle(t):e.setGFF(o)},{inSnapshot:!0}),nr(e=>e.gff,(e,t)=>{e.setGFF(t)},{inSnapshot:!0}),nr(e=>e.colorScheme,(e,t)=>{typeof t=="string"?e.setColorSchemeName(t):t&&e.setCustomColorScheme(KQ(t))}),nr(GV,(e,t)=>{e.setHighlights(t)}),nr(e=>e.features??[],(e,t)=>{e.setFeatures(t)}),nr(e=>e.selection,(e,t)=>{e.setSelection(t)}),nr(e=>e.treeRoot,(e,t)=>{e.setTreeRoot(t)}),nr(e=>e.clades??[],(e,t)=>{e.setClades(t)}),nr(e=>e.columnTracks??[],(e,t)=>{e.setColumnTracks(t)}),nr(e=>e.residueMappings??[],(e,t)=>{e.setResidueMappings(t)}),nr(e=>e.rowData,(e,t)=>{t&&Object.keys(t).length&&e.setRowData(t)}),nr(e=>e.encodings??[],(e,t)=>{e.setEncodings(t)}),nr(e=>e.rowPanels??[],(e,t)=>{e.setRowPanels(t)})];function v7e(e,t){let o=(0,Uo.useRef)(void 0);(0,Uo.useEffect)(()=>{let r=jV.map(({read:i})=>JSON.stringify(i(t)??null));o.current??=jV.map(({inSnapshot:i},s)=>i?r[s]:"");let n=o.current;jV.forEach(({apply:i},s)=>{let a=r[s];n[s]!==a&&(n[s]=a,i(e,JSON.parse(a)??void 0,t))})})}function E7e({modelRef:e,...t}){let{region:o,theme:r,onCellHover:n,onCellClick:i,onViewportChange:s,onSelectionChange:a,onModel:l}=t,[c]=(0,Uo.useState)(()=>{let y=eP().create(iTe(t));return y.setImportForm(!1),y}),u=(0,Uo.useRef)(void 0),[f,{width:p}]=Zx();(0,Uo.useEffect)(()=>{p&&c.setWidth(p)},[c,p]),v7e(c,t);let d=JSON.stringify(o??null);(0,Uo.useEffect)(()=>{let y=JSON.parse(d);return y?ru(()=>c.viewInitialized&&c.numColumns>0,()=>{c.revealRegion(y)}):void 0},[c,d]),tP(c,"hoveredCell",n),tP(c,"clickedCell",i),tP(c,"viewport",s),tP(c,"selection",a),(0,Uo.useImperativeHandle)(e,()=>c,[c]);let m=(0,Uo.useRef)(l);return(0,Uo.useEffect)(()=>{m.current=l}),(0,Uo.useEffect)(()=>{m.current?.(c)},[c]),(0,Uo.useEffect)(()=>(u.current!==void 0&&(clearTimeout(u.current),u.current=void 0),()=>{u.current=setTimeout(()=>{u.current=void 0,cl(c)&&eI(c)})}),[c]),Uo.default.createElement(gh,{theme:nTe(r)},Uo.default.createElement("div",{ref:f},Uo.default.createElement(lM,{model:c})))}function oP(e,t){let o=(0,sTe.createRoot)(e),r=t;return o.render(YV.default.createElement($V,{...r})),{update(n){r={...r,...n},o.render(YV.default.createElement($V,{...r}))},destroy(){o.unmount()}}}al();Or();var T7e=["msa","tree","gff","features","colorScheme","highlights","columnTracks","residueMappings"],I7e=["msa-url","tree-url","gff-url","color-scheme","height","hide-header","theme","reference-row","tree-area-width","loading"],w7e="200px",S7e=["display-start","display-end","highlight"];function Rd(e){let t=e?Number(e):Number.NaN;return Number.isFinite(t)?t:void 0}function B7e(e,t){return(e??"").split(",").flatMap(o=>{let[r,n]=o.split(":").map(Rd);return r===void 0?[]:[{row:t,start:r,end:n??r}]})}function WV(e,t,o){let r=e.globalColToVisibleCol(o-1);return r===void 0?void 0:e.visibleColToSeqPosOneBased(t,r)}function _7e(e,t,o){let r,n;for(let i=o.startColumn;i<=o.endColumn&&!r;i++)r=WV(e,t,i);for(let i=o.endColumn;i>=o.startColumn&&!n;i--)n=WV(e,t,i);return r&&n?{start:r,end:n}:void 0}function aTe(e="jbrowse-msa"){let t=customElements.get(e);if(t)return t;class o extends HTMLElement{static observedAttributes=[...I7e,...S7e];#r;#t;#e;#n;#a;#l=!1;#f;#o={};static{for(let n of T7e)Object.defineProperty(o.prototype,n,{configurable:!0,get(){return this.#o[n]},set(i){this.#p({[n]:i})}})}get selection(){return this.#e?this.#e.selection:this.#o.selection}set selection(n){this.#p({selection:n})}get#i(){return this.getAttribute("reference-row")??void 0}#p(n){this.#o={...this.#o,...n},this.#r?.update(this.#c())}#c(){let n=this.getAttribute("theme");return{...this.#o,msaUrl:this.getAttribute("msa-url")??void 0,treeUrl:this.getAttribute("tree-url")??void 0,gffUrl:this.getAttribute("gff-url")??void 0,colorScheme:this.#o.colorScheme??this.getAttribute("color-scheme")??void 0,height:Rd(this.getAttribute("height")),treeAreaWidth:Rd(this.getAttribute("tree-area-width")),hideHeader:this.hasAttribute("hide-header"),theme:n==="dark"?"dark":"light",onCellHover:i=>{this.#s("cell-hover",i),this.#h(i)},onCellClick:i=>{this.#s("cell-click",i)},onViewportChange:i=>{this.#s("viewport-change",i),this.#y(i)},onSelectionChange:i=>{this.#s("selection-change",i)},onModel:i=>{this.#e=i,this.#A(),this.#m()}}}#s(n,i){this.dispatchEvent(new CustomEvent(n,{detail:i}))}#d(n){this.#n&&this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,cancelable:!0}))}#h(n){let i=this.#e,s=this.#i,a=n&&i&&s?WV(i,s,n.column):n?.column;this.#d({type:"highlight",value:a===void 0?null:`${a}:${a}`})}#y(n){let i=this.#e,s=this.#i;if(!n||!i)return;let a=s?_7e(i,s,n):{start:n.startColumn,end:n.endColumn},l=Rd(this.getAttribute("display-start")),c=Rd(this.getAttribute("display-end")),u=a&&l!==void 0&&c!==void 0&&Math.abs(a.start-l)<=1&&Math.abs(a.end-c)<=1;a&&!u&&(this.#f=a,this.#d({"display-start":a.start,"display-end":a.end}))}#A(){let n=this.#e,i=Rd(this.getAttribute("display-start")),s=Rd(this.getAttribute("display-end")),a=this.#f;if(!(a&&a.start===i&&a.end===s)&&(this.#a?.(),n&&i!==void 0&&s!==void 0)){let l=this.#i;this.#a=ru(()=>n.viewInitialized&&n.numColumns>0,()=>{n.zoomToRegion({row:l,start:i,end:s})})}}#m(){let n=B7e(this.getAttribute("highlight"),this.#i);n.length?this.#e?.applyHighlight("nightingale",n):this.#e?.clearHighlight("nightingale")}connectedCallback(){if(this.style.display||(this.style.display="block"),this.#g){let i=Rd(this.getAttribute("height"))??550;this.style.minHeight=`${i+5}px`,this.#t=new IntersectionObserver(s=>{s.some(a=>a.isIntersecting)&&this.#u()},{rootMargin:w7e}),this.#t.observe(this)}else this.#u();let n=this.closest("nightingale-manager");n&&customElements.whenDefined("nightingale-manager").then(()=>{this.isConnected&&(this.#n=n,n.register(this))})}get#g(){return this.getAttribute("loading")==="lazy"&&typeof IntersectionObserver<"u"}#u(){this.#t?.disconnect(),this.#t=void 0,this.#r??=oP(this,this.#c())}disconnectedCallback(){this.#t?.disconnect(),this.#t=void 0,this.#n?.unregister(this),this.#n=void 0,this.#a?.(),this.#r?.destroy(),this.#r=void 0,this.#e=void 0}attributeChangedCallback(n){n==="display-start"||n==="display-end"?this.#l||(this.#l=!0,queueMicrotask(()=>{this.#l=!1,this.#A()})):n==="highlight"?this.#m():n==="loading"?this.#t&&!this.#g&&this.#u():this.#r?.update(this.#c())}}return customElements.define(e,o),o}eu(Jc,w(YQ(),1));return yTe(Jc);})();
650
+ `).join("")}var _d="rgb(128,179,230)",wve="#d88",U9e="rgb(192, 72, 192)",z9e="rgb(204, 77, 204)",Sve="#8f8",Bve="rgb(26,204,26)",H9e="rgb(240, 128, 128)",G9e="rgb(240, 144, 72)",V9e="rgb(204, 204, 0)",_ve="rgb(26, 179, 179)";function Rve(e,t){let o=e.total(t),r=k=>e.count(t,k),n=r("W"),i=r("L"),s=r("V"),a=r("I"),l=r("M"),c=r("A"),u=r("F"),f=r("C"),p=r("H"),d=r("P"),m=r("R"),y=r("K"),b=r("Q"),h=r("E"),g=r("D"),C=r("T"),x=r("S"),E=r("G"),I=r("Y"),T=r("N"),S=n+i+s+a+l+c+u+f+p+d+I,B=y+m,R=b+h,M=h+g,Q=C+x,v=k=>k/o,O={};return v(S)>.6&&(O.W=_d,O.L=_d,O.V=_d,O.A=_d,O.I=_d,O.M=_d,O.F=_d,O.C=_d),(v(B)>.6||v(y)>.8||v(m)>.8||v(b)>.8)&&(O.K=wve,O.R=wve),(v(B)>.6||v(R)>.5||v(h)>.8||v(b)>.8||v(g)>.8)&&(O.E=U9e),(v(B)>.6||v(M)>.5||v(y)>.8||v(m)>.8||v(b)>.8)&&(O.D=z9e),(v(T)>.5||v(I)>.85)&&(O.N=Sve),(v(B)>.6||v(R)>.6||v(b)>.85||v(h)>.85||v(y)>.85||v(m)>.85)&&(O.Q=Sve),(v(S)>.6||v(Q)>.5||v(x)>.85||v(C)>.85)&&(O.S=Bve,O.T=Bve),v(f)>.85&&(O.C=H9e),E>0&&(O.G=G9e),d>0&&(O.P=V9e),(v(S)>.6||v(n)>.85||v(I)>.85||v(c)>.85||v(f)>.85||v(d)>.85||v(b)>.85||v(u)>.85||v(p)>.85||v(a)>.85||v(i)>.85||v(l)>.85||v(s)>.85)&&(O.H=_ve,O.Y=_ve),O}oq();ob();Rc();var Mve={A:sc[500],C:ic[500],G:Au[500],T:hl[500],U:hl[500]},j9e={none:{},nucleotide:Mve,clustal:{G:"orange",P:"orange",S:"orange",T:"orange",H:"red",K:"red",R:"red",F:"blue",W:"blue",Y:"blue",I:"green",L:"green",M:"green",V:"green"},lesk:{G:"orange",A:"orange",S:"orange",T:"orange",C:"green",V:"green",I:"green",L:"green",P:"green",F:"green",Y:"green",M:"green",W:"green",N:"magenta",Q:"magenta",H:"magenta",D:"red",E:"red",K:"blue",R:"blue"},maeditor:{A:"lightgreen",G:"lightgreen",C:"green",D:"darkgreen",E:"darkgreen",N:"darkgreen",Q:"darkgreen",I:"blue",L:"blue",M:"blue",V:"blue",F:"#c8a2c8",W:"#c8a2c8",Y:"#c8a2c8",H:"darkblue",K:"orange",R:"orange",P:"pink",S:"red",T:"red"},percent_identity_dynamic:{},blosum62_dynamic:{},flower:{A:"#b18a51",C:"#ff5701",D:"#01a578",E:"#2da0a1",F:"#fa559d",G:"#b1c23c",H:"#0194f9",I:"#f27663",K:"#7fc3d7",L:"#df6e75",M:"#fe9daf",N:"#0bcec6",P:"#4fa32a",Q:"#7295ae",R:"#83bff1",S:"#b4bd9b",T:"#d2b576",V:"#fd997b",W:"#ff2ded",Y:"#c96ecf"},rainbow_dna:{A:"#3737f5",C:"#37f537",G:"#f5f537",T:"#f53737",U:"#f53737"},clustalx_protein:{A:"#197fe5",C:"#e57f7f",D:"#cc4ccc",E:"#cc4ccc",F:"#197fe5",G:"#e5994c",H:"#19b2b2",I:"#197fe5",K:"#e53319",L:"#197fe5",M:"#197fe5",N:"#19cc19",P:"#cccc00",Q:"#19cc19",R:"#e53319",S:"#19cc19",T:"#19cc19",V:"#197fe5",W:"#197fe5",Y:"#19b2b2"},clustalx_protein_dynamic:{},clustalx_dna:{A:"#e53319",C:"#197fe5",G:"#e5994c",T:"#19cc19",U:"#19cc19"},jbrowse_dna:Mve,jalview_buried:{A:"#00a35c",R:"#00fc03",N:"#00eb14",D:"#00eb14",C:"#0000ff",Q:"#00f10e",E:"#00f10e",G:"#009d62",H:"#00d52a",I:"#0054ab",L:"#007b84",K:"#00ff00",M:"#009768",F:"#008778",P:"#00e01f",S:"#00d52a",T:"#00db24",W:"#00a857",Y:"#00e619",V:"#005fa0",B:"#00eb14",X:"#00b649",Z:"#00f10e"},jalview_hydrophobicity:{A:"#ad0052",R:"#0000ff",N:"#0c00f3",D:"#0c00f3",C:"#c2003d",Q:"#0c00f3",E:"#0c00f3",G:"#6a0095",H:"#1500ea",I:"#ff0000",L:"#ea0015",K:"#0000ff",M:"#b0004f",F:"#cb0034",P:"#4600b9",S:"#5e00a1",T:"#61009e",W:"#5b00a4",Y:"#4f00b0",V:"#f60009",B:"#0c00f3",X:"#680097",Z:"#0c00f3"},jalview_prophelix:{A:"#e718e7",R:"#6f906f",N:"#1be41b",D:"#778877",C:"#23dc23",Q:"#926d92",E:"#ff00ff",G:"#00ff00",H:"#758a75",I:"#8a758a",L:"#ae51ae",K:"#a05fa0",M:"#ef10ef",F:"#986798",P:"#00ff00",S:"#36c936",T:"#47b847",W:"#8a758a",Y:"#21de21",V:"#857a85",B:"#49b649",X:"#758a75",Z:"#c936c9"},jalview_propstrand:{A:"#5858a7",R:"#6b6b94",N:"#64649b",D:"#2121de",C:"#9d9d62",Q:"#8c8c73",E:"#0000ff",G:"#4949b6",H:"#60609f",I:"#ecec13",L:"#b2b24d",K:"#4747b8",M:"#82827d",F:"#c2c23d",P:"#2323dc",S:"#4949b6",T:"#9d9d62",W:"#c0c03f",Y:"#d3d32c",V:"#ffff00",B:"#4343bc",X:"#797986",Z:"#4747b8"},jalview_propturn:{A:"#2cd3d3",R:"#708f8f",N:"#ff0000",D:"#e81717",C:"#a85757",Q:"#3fc0c0",E:"#778888",G:"#ff0000",H:"#708f8f",I:"#00ffff",L:"#1ce3e3",K:"#7e8181",M:"#1ee1e1",F:"#1ee1e1",P:"#f60909",S:"#e11e1e",T:"#738c8c",W:"#738c8c",Y:"#9d6262",V:"#07f8f8",B:"#f30c0c",X:"#7c8383",Z:"#5ba4a4"},jalview_taylor:{A:"#ccff00",R:"#0000ff",N:"#cc00ff",D:"#ff0000",C:"#ffff00",Q:"#ff00cc",E:"#ff0066",G:"#ff9900",H:"#0066ff",I:"#66ff00",L:"#33ff00",K:"#6600ff",M:"#00ff00",F:"#00ff66",P:"#ffcc00",S:"#ff3300",T:"#ff6600",W:"#00ccff",Y:"#00ffcc",V:"#99ff00"},jalview_zappo:{A:"#ffafaf",R:"#6464ff",N:"#00ff00",D:"#ff0000",C:"#ffff00",Q:"#00ff00",E:"#ff0000",G:"#ff00ff",H:"#6464ff",I:"#ffafaf",L:"#ffafaf",K:"#6464ff",M:"#ffafaf",F:"#ffc800",P:"#ff00ff",S:"#00ff00",T:"#00ff00",W:"#ffc800",Y:"#ffc800",V:"#ffafaf"},cinema:{H:"blue",K:"blue",R:"blue",D:"red",E:"red",S:"green",T:"green",N:"green",Q:"green",A:"white",V:"white",L:"white",I:"white",M:"white",F:"magenta",W:"magenta",Y:"magenta",P:"brown",G:"brown",C:"yellow",B:"gray",Z:"gray",X:"gray","-":"gray",".":"gray"}},cV=G_(j9e,([e,t])=>[e,G_(t,([o,r])=>[o,er(r).toHex()])]),Qve=new WeakMap;function Pve(e){let t=Qve.get(e);return t||(t=G_(e,([o,r])=>[o.toUpperCase(),r]),Qve.set(e,t)),t}Mv();function Dve({col:e,colStats:t,conservation:o,propertyConservation:r}){if(e>=t.numColumns)return;let n=t.total(e);if(!n)return;let i=t.gapCount(e),s=t.residueEntries(e).sort((l,c)=>c[1]-l[1]),a=s[0];return{col:e,total:n,gaps:i,gapFraction:i/n,conservation:o[e]??0,propertyConservation:r[e],consensusLetter:a?.[0]??"",consensusCount:a?.[1]??0,consensusFraction:a?a[1]/n:0,distribution:s}}function fC(e){let t=[],o=new Array(e.length),r=e.map((n,i)=>i).sort((n,i)=>e[n].startCol-e[i].startCol);for(let n of r){let{startCol:i,endCol:s}=e[n],a=t.findIndex(c=>c<=i),l=a===-1?t.length:a;t[l]=s,o[n]=l}return e.map((n,i)=>({...n,lane:o[i],laneCount:t.length}))}Dv();oE();function Ove(e,t){if(e<=0||t<20)return;let o=t/2/e,r=10**Math.floor(Math.log10(o)),n=o/r,i=(n>=5?5:n>=2?2:1)*r,s=i*e;return s>t?void 0:{step:i,px:s,label:`${Number(i.toPrecision(2))}`}}Or();ob();var $9e={grad:.9,turn:360,rad:360/(2*Math.PI)},uV=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},pC=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=Math.pow(10,t)),Math.round(o*e)/o+0},wf=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=1),e>o?o:e>t?e:t},fV=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},pV=function(e){return 255*(e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e)},dV=96.422,AV=100,mV=82.521,Y9e=function(e){var t,o,r={x:.9555766*(t=e).x+-.0230393*t.y+.0631636*t.z,y:-.0282895*t.x+1.0099416*t.y+.0210077*t.z,z:.0122982*t.x+-.020483*t.y+1.3299098*t.z};return o={r:pV(.032404542*r.x-.015371385*r.y-.004985314*r.z),g:pV(-.00969266*r.x+.018760108*r.y+41556e-8*r.z),b:pV(556434e-9*r.x-.002040259*r.y+.010572252*r.z),a:e.a},{r:wf(o.r,0,255),g:wf(o.g,0,255),b:wf(o.b,0,255),a:wf(o.a)}},W9e=function(e){var t=fV(e.r),o=fV(e.g),r=fV(e.b);return(function(n){return{x:wf(n.x,0,dV),y:wf(n.y,0,AV),z:wf(n.z,0,mV),a:wf(n.a)}})((function(n){return{x:1.0478112*n.x+.0228866*n.y+-.050127*n.z,y:.0295424*n.x+.9904844*n.y+-.0170491*n.z,z:-.0092345*n.x+.0150436*n.y+.7521316*n.z,a:n.a}})({x:100*(.4124564*t+.3575761*o+.1804375*r),y:100*(.2126729*t+.7151522*o+.072175*r),z:100*(.0193339*t+.119192*o+.9503041*r),a:e.a}))},cT=216/24389,dC=24389/27,Lve=function(e){return{l:wf(e.l,0,100),c:e.c,h:(t=e.h,(t=isFinite(t)?t%360:0)<0?t+360:t),a:e.a};var t},kve=function(e){return{l:pC(e.l,2),c:pC(e.c,2),h:(t=e.h,o=2,o===void 0&&(o=0),pC(t,o)%360),a:pC(e.a,3)};var t,o},q9e=function(e){var t=e.l,o=e.c,r=e.h,n=e.a,i=n===void 0?1:n;if(!uV(t)||!uV(o)||!uV(r))return null;var s=Lve({l:Number(t),c:Number(o),h:Number(r),a:Number(i)});return Fve(s)},Nve=function(e){var t=(function(i){var s=W9e(i),a=s.x/dV,l=s.y/AV,c=s.z/mV;return a=a>cT?Math.cbrt(a):(dC*a+16)/116,{l:116*(l=l>cT?Math.cbrt(l):(dC*l+16)/116)-16,a:500*(a-l),b:200*(l-(c=c>cT?Math.cbrt(c):(dC*c+16)/116)),alpha:s.a}})(e),o=pC(t.a,3),r=pC(t.b,3),n=Math.atan2(r,o)/Math.PI*180;return{l:t.l,c:Math.sqrt(o*o+r*r),h:n<0?n+360:n,a:t.alpha}},Fve=function(e){return t={l:e.l,a:e.c*Math.cos(e.h*Math.PI/180),b:e.c*Math.sin(e.h*Math.PI/180),alpha:e.a},r=t.a/500+(o=(t.l+16)/116),n=o-t.b/200,Y9e({x:(Math.pow(r,3)>cT?Math.pow(r,3):(116*r-16)/dC)*dV,y:(t.l>8?Math.pow((t.l+16)/116,3):t.l/dC)*AV,z:(Math.pow(n,3)>cT?Math.pow(n,3):(116*n-16)/dC)*mV,a:t.alpha});var t,o,r,n},J9e=/^lch\(\s*([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))\s+([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,K9e=function(e){var t=J9e.exec(e);if(!t)return null;var o,r,n=Lve({l:Number(t[1]),c:Number(t[2]),h:(o=t[3],r=t[4],r===void 0&&(r="deg"),Number(o)*($9e[r]||1)),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fve(n)},Uve=function(e,t){e.prototype.toLch=function(){return kve(Nve(this.rgba))},e.prototype.toLchString=function(){return o=kve(Nve(this.rgba)),r=o.l,n=o.c,i=o.h,(s=o.a)<1?"lch("+r+"% "+n+" "+i+" / "+s+")":"lch("+r+"% "+n+" "+i+")";var o,r,n,i,s},t.string.push([K9e,"lch"]),t.object.push([q9e,"lch"])};var X9e=[["#F8766D"],["#F8766D","#00BFC4"],["#F8766D","#00BA38","#619CFF"],["#F8766D","#7CAE00","#00BFC4","#C77CFF"],["#F8766D","#A3A500","#00BF7D","#00B0F6","#E76BF3"],["#F8766D","#B79F00","#00BA38","#00BFC4","#619CFF","#F564E3"],["#F8766D","#C49A00","#53B400","#00C094","#00B6EB","#A58AFF","#FB61D7"],["#F8766D","#CD9600","#7CAE00","#00BE67","#00BFC4","#00A9FF","#C77CFF","#FF61CC"]],Hve=X9e,gV={set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],okabeito:["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#000000"],tableau:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"]},zve={okabeIto:"okabeito",tableau10:"tableau"};function hV(e){return e===void 0?void 0:Object.hasOwn(gV,e)?gV[e]:Object.hasOwn(zve,e)?gV[zve[e]]:void 0}U_([Uve]);function uT(e,t,o){let r=e.length,n=t??Hve[r-1];return n&&r<=n.length?Object.fromEntries(e.map((i,s)=>[i,n[s]])):Object.fromEntries(e.map((i,s)=>{let a=s*360/r;return[i,(o===void 0?er({h:a,s:60,l:60}):er({l:o,c:40,h:a})).toHex()]}))}function yV(e,t,o="image"){let r=e;return`${(r?.uri??r?.localPath??r?.name)?.split(/[?#]/)[0]?.split(/[/\\]/).pop()?.replace(/\.[^.]*$/,"")||o}.${t}`}Or();Rc();var Z9e="#d9d9d9",eYe=.1;function bV(e,t){return e.width??(e.kind==="features"?ume:t.rowHeight)}function Vve(e){if(typeof e!="object"||e===null)return;let t={};for(let[o,r]of Object.entries(e))typeof r=="string"?t[o]=r:(typeof r=="number"||typeof r=="boolean")&&(t[o]=String(r));return t}function WQ(e,t,o){let r=new Map;for(let[n,i]of Object.entries(e)){let s=i?.[t],a=s===void 0?void 0:o(s);a&&r.set(n,a)}return r}function CV(e,t,o){let r=new Map,n=i=>{let s=r.get(i);if(s!==void 0)return s;let a=H_(i);return r.set(i,a),a};return new Map(e.map(i=>{let s=t?af(i,t.field):void 0,a=i.color??(s===void 0?void 0:t.colorOf(s))??(t?Z9e:o[i.accession]);return[i,{fill:a,stroke:n(a)}]}))}function xV(e,t){let o=new Map;for(let r of e){let n=af(r,t);n!==void 0&&o.set(r,n)}return o}function tYe(e){let t=e.map(([i,s])=>{let a=fC(s.filter(c=>c.annotation.strand===-1)),l=fC(s.filter(c=>c.annotation.strand!==-1));return{name:i,forward:l,reverse:a}}),o=Math.max(0,...t.map(i=>i.forward[0]?.laneCount??0)),r=Math.max(0,...t.map(i=>i.reverse[0]?.laneCount??0)),n=o+r;return new Map(t.map(({name:i,forward:s,reverse:a})=>[i,[...s.map(l=>({...l,lane:o-1-l.lane,laneCount:n})),...a.map(l=>({...l,lane:o+l.lane,laneCount:n}))]]))}function Gve(e,t){return e.position==="strandpile"?tYe(t):new Map(t.map(([o,r])=>[o,fC(r)]))}function jve({panel:e,width:t,colWidth:o,domainBands:r,annotationsByRow:n,shifts:i}){if(e.x==="column")return Gve(e,[...r].map(([f,p])=>[f,p.map(d=>({...d,xStart:d.startCol*o,xEnd:d.endCol*o}))]));let s=Object.entries(n).map(([f,p])=>{let d=i?.get(f)??0;return[f,p.map(m=>({annotation:m,start:m.start-1+d,end:m.end+d}))]}),a=1/0,l=-1/0;for(let[,f]of s)for(let{start:p,end:d}of f)a=Math.min(a,p),l=Math.max(l,d);let c=Math.max(1,t-1),u=l>a?c/(l-a):0;return Gve(e,s.map(([f,p])=>[f,p.map(({annotation:d,start:m,end:y})=>({annotation:d,xStart:(m-a)*u,xEnd:(y-a)*u,startCol:m,endCol:y-(y-m)*eYe}))]))}var oYe=new Set(["row","start","end"]),$ve=new WeakMap;function Yve(e){return e.map(t=>{let o=$ve.get(t);if(o)return o;let r=rYe(t);return $ve.set(t,r),r})}function rYe(e){let{row:t,start:o,end:r,name:n,description:i,type:s,strand:a,color:l}=e,c=n??`${t}:${o}-${r}`,u=Object.fromEntries(Object.entries(e).filter(([f,p])=>!oYe.has(f)&&p!==void 0).map(([f,p])=>[f,String(p)]));return{id:t,accession:c,name:n??c,description:i??n??c,featureType:s,start:o,end:r,strand:a==="+"?1:a==="-"?-1:void 0,color:l,attributes:u}}Dpe();pi();al();om();function nYe(e){return typeof e=="string"?e:e?.message}async function Wve(e,t,{fetcher:o=L5,controller:r=new AbortController}={}){try{return await o(e,{signal:r.signal,statusCallback:n=>{let i=nYe(n);t(i?{msg:i,onCancel:()=>{r.abort()}}:void 0)}})}finally{t(void 0)}}function qve(e){return e instanceof DOMException&&e.name==="AbortError"}function iYe(e){let t;return{cancel(){let o=t!==void 0&&!t.ended;return t?.controller.abort(),t=void 0,o},begin(){t?.controller.abort();let o={controller:new AbortController,ended:!1};return t=o,{controller:o.controller,isCurrent:()=>!o.ended&&o===t&&cl(e),end(){o.ended=!0}}}}}function fT(e,{what:t,getFilehandle:o,onLoad:r,setLoading:n,clearFilehandle:i,optional:s=!1}){let a=iYe(e),l=()=>{a.cancel()&&cl(e)&&e.setStatus(void 0)};au(e,l),au(e,Jl(async()=>{let c=o();if(l(),!c){n?.(!1);return}let{controller:u,isCurrent:f,end:p}=a.begin();try{n?.(!0),s||e.setError(void 0);let d=await Wve(e3(c),m=>{f()&&e.setStatus(m)},{controller:u});f()&&_r(()=>{r(d),c.locationType==="BlobLocation"&&i?.()})}catch(d){f()&&(qve(d)?i?.():(console.error(d),s?e.addWarning(`The ${t} did not load: ${d}`):e.setError(d)))}finally{f()&&n?.(!1),p()}}))}pb();pi();Or();function Jve(e=nR){return $.model({tree:$.maybe($.string),msa:$.maybe($.string),treeMetadata:$.maybe($.string),gff:$.maybe($.string)}).actions(t=>({setTree(o){t.tree=o},setMSA(o){t.msa=o},setTreeMetadata(o){t.treeMetadata=o},setGFF(o){t.gff=o}})).postProcessSnapshot(t=>Object.fromEntries(Object.entries(t).map(([o,r])=>[o,r&&r.length>e?void 0:r])))}pi();function Kve(){return $.model("DialogQueueSessionMixin",{}).volatile(()=>({queueOfDialogs:[]})).views(e=>({get DialogComponent(){return e.queueOfDialogs[0]?.[0]},get DialogProps(){return e.queueOfDialogs[0]?.[1]}})).actions(e=>({removeActiveDialog(){e.queueOfDialogs=e.queueOfDialogs.slice(1)},queueDialog(t){let[o,r]=t(()=>{this.removeActiveDialog()});e.queueOfDialogs=[...e.queueOfDialogs,[o,r]]}}))}pi();Or();pi();function At(e,t){return typeof $.stripDefault=="function"?$.stripDefault(e,t):$.optional(e,t)}var sYe=["stockholm","a3m","fasta","emf","clustal"];function Xve(){return $.model({bgColor:At($.boolean,YAe),colorSchemeName:At($.string,tR),customColorScheme:$.frozen(),showColumnStats:At($.boolean,WAe),msaFormat:$.maybe($.enumeration("MSAFormat",sYe))}).actions(e=>({setColorSchemeName(t){e.colorSchemeName=t,e.customColorScheme=void 0},setCustomColorScheme(t){e.customColorScheme=t},setBgColor(t){e.bgColor=t},setShowColumnStats(t){e.showColumnStats=t},setMSAFormat(t){e.msaFormat=t}}))}pi();Or();function Zve(){return $.model({drawLabels:At($.boolean,qAe),labelsAlignRight:At($.boolean,JAe),treeAreaWidth:$.maybe($.number),treeWidth:$.maybe($.number),showBranchLen:At($.boolean,eme),treeOrder:At($.enumeration("TreeOrder",[...rR]),tme),drawTree:At($.boolean,ome),drawNodeBubbles:At($.boolean,rme),drawNodeLabels:At($.boolean,nme),showTreeOverview:At($.boolean,ime),overviewHeight:At($.number,sme)}).actions(e=>({setTreeAreaWidth(t){e.treeAreaWidth=t===void 0?void 0:Math.round(t),e.treeWidth=void 0},setTreeWidth(t){e.treeWidth=t===void 0?void 0:Math.round(t)},setLabelsAlignRight(t){e.labelsAlignRight=t},setDrawTree(t){e.drawTree=t},setShowBranchLen(t){e.showBranchLen=t},setTreeOrder(t){e.treeOrder=t},setDrawNodeBubbles(t){e.drawNodeBubbles=t},setDrawNodeLabels(t){e.drawNodeLabels=t},setShowTreeOverview(t){e.showTreeOverview=t},setDrawLabels(t){e.drawLabels=t}}))}var eEe="ARNDCQEGHILKMFPSTWYVBZX*",aYe=[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],Xa=eEe.length,pT=Int8Array.from(aYe.flat()),AC=new Int8Array(128).fill(-1);for(let e=0;e<Xa;e++){let t=eEe[e];AC[t.charCodeAt(0)]=e,AC[t.toLowerCase().charCodeAt(0)]=e}var qQ=-2;function tEe(e,t){if(t>=e.length)return qQ;let o=e.charCodeAt(t);return o-45>>>0<=1?qQ:o<128?AC[o]:-1}function vV(e,t){return e<0||t<0?-4:pT[e*Xa+t]}function lYe(e,t){let o=Math.max(e.length,t.length),r=0,n=0,i=0;for(let l=0;l<o;l++){let c=tEe(e,l),u=tEe(t,l),f=c===qQ,p=u===qQ;f&&p||(r++,!(f||p)&&(n+=vV(c,u),i+=Math.max(vV(c,c),vV(u,u))))}if(r===0||i<=0)return 1;let s=n/i,a=Math.max(.01,Math.min(1,s));return-Math.log(a)}function cYe(e){let t=e.length,o=[];for(let r=0;r<t;r++){o[r]=[];for(let n=0;n<t;n++)r===n?o[r][n]=0:n<r?o[r][n]=o[n][r]:o[r][n]=lYe(e[r][1],e[n][1])}return o}function uYe(e,t){let o=e.length;if(o<2)return{name:t[0]};if(o===2){let a=e[0][1];return{left:{name:t[0]},right:{name:t[1]},leftLength:a/2,rightLength:a/2}}let r=[];for(let a=0;a<o;a++)r[a]=[...e[a]];let n=t.map(a=>({name:a})),i=o;for(;i>2;){let a=[];for(let g=0;g<n.length;g++)n[g]!==void 0&&a.push(g);let l=new Map;for(let g of a){let C=0;for(let x of a)g!==x&&(C+=r[g][x]);l.set(g,C)}let c=1/0,u=-1,f=-1;for(let g=0;g<a.length;g++)for(let C=g+1;C<a.length;C++){let x=a[g],E=a[C],I=(i-2)*r[x][E]-l.get(x)-l.get(E);I<c&&(c=I,u=x,f=E)}let p=r[u][f],d=l.get(u),m=l.get(f),y=p/2+(d-m)/(2*(i-2)),b=p-y;y=Math.max(0,y),b=Math.max(0,b);let h={left:n[u],right:n[f],leftLength:y,rightLength:b};for(let g of a)if(g!==u&&g!==f){let C=(r[u][g]+r[f][g]-p)/2;r[u][g]=Math.max(0,C),r[g][u]=Math.max(0,C)}n[f]=void 0,n[u]=h,i--}let s=[];for(let a=0;a<n.length;a++)n[a]!==void 0&&s.push(a);if(s.length===2){let a=s[0],l=s[1],c=r[a][l];return{left:n[a],right:n[l],leftLength:c/2,rightLength:c/2}}return n[s[0]]}function oEe(e,t){return t===void 0?e:`${e}:${t.toFixed(6)}`}function fYe(e){let t=[],o=[e];for(;o.length>0;){let n=o.pop();t.push(n),n.left&&o.push(n.left),n.right&&o.push(n.right)}let r=new Map;for(let n=t.length-1;n>=0;n--){let i=t[n];if(i.name!==void 0&&!i.left&&!i.right)r.set(i,`'${i.name.replaceAll("'","''")}'`);else{let s=i.left?oEe(r.get(i.left),i.leftLength):"",a=i.right?oEe(r.get(i.right),i.rightLength):"";r.set(i,`(${s},${a})`)}}return r.get(e)}function rEe(e){if(e.length<2)throw new Error("Need at least 2 sequences to build a tree");let t=e.map(n=>n[0]),o=cYe(e),r=uYe(o,t);return fYe(r)+";"}Mv();var nEe={A:"hydrophobic",V:"hydrophobic",L:"hydrophobic",I:"hydrophobic",M:"hydrophobic",C:"hydrophobic",F:"aromatic",W:"aromatic",Y:"aromatic",H:"aromatic",K:"positive",R:"positive",D:"negative",E:"negative",S:"polar",T:"polar",N:"polar",Q:"polar",G:"special",P:"special"},EV=[...new Set(Object.values(nEe))],pYe=Math.log2(EV.length),iEe=new Int8Array(D_).fill(-1);for(let[e,t]of Object.entries(nEe))iEe[zde(e)]=EV.indexOf(t);function sEe(e){let t=new Float64Array(EV.length);return Array.from({length:e.numColumns},(o,r)=>{let n=e.total(r),i=0;if(n){t.fill(0);let s=0;if(e.forEachResidue(r,(a,l)=>{let c=iEe[a];c>=0&&(t[c]+=l,s+=l)}),s>0){let a=0;for(let c of t)if(c>0){let u=c/s;a-=u*Math.log2(u)}let l=(n-s)/n;i=Math.max(0,1-a/pYe)*(1-l)}}return i})}function mC(e,t){let o=[],r=[e];for(;r.length>0;){let n=r.pop();o.push(n);for(let i of n.children??[])t?.set(i,n),r.push(i)}return o}function aEe(e){return e.some(t=>t.length!==void 0)}function dYe(e,t){return e.children?.length===2?e.children.find(o=>o!==t):void 0}function JQ(e,t,o){let r=new Map,n=mC(e,r);if(!r.has(t))return e;let i=aEe(n),s=r.get(t)===e?dYe(e,t):void 0,a=(t.length??0)+(s?.length??0),l=Math.min(Math.max(o??a/2,0),a),c=p=>i?p:void 0,u=[t];for(let p=r.get(t);p;p=r.get(p))u.push(p);let f;for(let p=u.length-1;p>=1;p--){let d=u[p],m=u[p-1],y=d.children.filter(b=>b!==m);if(f&&y.push(f),y.length===0)f=void 0;else if(p===u.length-1&&y.length===1){let b=y[0];f={...b,length:c((b.length??0)+(m.length??0)-(p===1?l:0))}}else f={...d,name:p===1?void 0:m.name,children:y,length:c((m.length??0)-(p===1?l:0))}}return{children:[{...t,length:c(l)},...f?[f]:[]]}}function lEe(e){let t=new Map,o=mC(e,t),r=o.filter(y=>!y.children?.length);if(r.length<2)return e;let n=aEe(o),i=y=>n?y.length??0:1;function s(y){let b=new Map([[y,0]]),h=new Map,g=[y];for(;g.length>0;){let C=g.pop(),x=b.get(C),E=t.get(C);E&&!b.has(E)&&(b.set(E,x+i(C)),h.set(E,C),g.push(E));for(let I of C.children??[])b.has(I)||(b.set(I,x+i(I)),h.set(I,C),g.push(I))}return{dist:b,via:h}}function a(y){return r.reduce((b,h)=>y.get(h)>y.get(b)?h:b)}let l=a(s(r[0]).dist),{dist:c,via:u}=s(l),f=a(c);if(f===l)return e;let p=c.get(f)/2,d=f,m=u.get(d);for(;c.get(m)>p;)d=m,m=u.get(d);return t.get(d)===m?JQ(e,d,c.get(d)-p):JQ(e,m,p-c.get(m))}function TV(e,t){let o=0,r=e;for(;o<r;){let n=o+r>>>1;t(n)?r=n:o=n+1}return o}function cEe(e,t){return t+TV(e.length,o=>e[o]-o>t)}function uEe(e,t){let o=fEe(e,t);return e[o]===t?void 0:t-o}function fEe(e,t){return TV(e.length,o=>e[o]>=t)}function gC(e,t){return t-fEe(e,t)}function pEe(e,t){if(!e)return;let o=TV(e.length,r=>e[r]>=t);return e[o]===t?o:void 0}ob();var dEe=/^-?\d+(\.\d+)?$/,AEe=/\d+|\D+/g;function AYe(e,t){let o=e.match(AEe)??[],r=t.match(AEe)??[],n=Math.min(o.length,r.length);for(let i=0;i<n;i++){let s=o[i],a=r[i];if(s!==a){if(/^\d/.test(s)&&/^\d/.test(a)){let l=Number(s),c=Number(a);return l!==c?l<c?-1:1:s.length<a.length?-1:1}return s<a?-1:1}}return o.length-r.length}function mEe(e,t){if(e===t)return 0;if(e===""||t==="")return e===""?1:-1;let o=dEe.test(e),r=dEe.test(t);if(o!==r)return o?-1:1;if(o){let n=Number(e)-Number(t);if(n!==0)return n<0?-1:1}return AYe(e,t)}function mYe(e){if(typeof e!="string")return e;if(hV(e))return;let t=e.split(/,(?![^(]*\))/).map(o=>o.trim());return t.every(o=>er(o).isValid())?t:void 0}function gYe(e,t){let o=mYe(e);return o?new Map(t.slice(0,o.length).map((r,n)=>[r,o[n]])):new Map(Object.entries(uT(t,hV(typeof e=="string"?e:void 0))))}function gEe(e,t){let o=new Set(t),r=new Set(e?.domain),n=[...r,...[...o].filter(s=>!r.has(s)).sort(mEe)],i=gYe(e?.range,n);return{kind:"categorical",colorOf:s=>i.get(s),legend:n.filter(s=>o.has(s)&&i.has(s)).map(s=>({id:s,label:s,color:i.get(s)}))}}function wV({spec:e,field:t,table:o}){let{scale:r="categorical",domain:n,range:i,title:s=t}=e;return JSON.stringify([o,r,n,i,s])}function hEe(e){let t=new Map;for(let o of e){let r=wV(o);t.set(r,[...t.get(r)??[],o])}return new Map([...t].map(([o,r])=>{let{spec:n,field:i}=r[0],s=gEe(n,r.flatMap(c=>c.values)),a=r[0].shown?new Set(r.flatMap(c=>c.shown??[])):void 0,l={...s,key:o,title:n.title??i,legend:a?s.legend.filter(c=>a.has(c.id)):s.legend};return[o,l]}))}function IV(e){let{scale:t,legend:o,...r}=e;if(typeof t!="object"&&o===void 0)return e;let n=typeof t!="object"?t===void 0?{}:{scale:t}:t.map?{domain:Object.keys(t.map),range:Object.values(t.map)}:t.palette===void 0?{}:{range:t.palette};return{...o===void 0?{}:{title:o},...n,...r}}function SV(e){return IV(e)}function BV(e){if(e.kind==="strip")return IV(e);let t=e.encoding?.color;return t?{...e,encoding:{...e.encoding,color:IV(t)}}:e}function _V(e){let{max:t,colors:o,...r}=e;return t===void 0&&o===void 0?e:{...o?{encoding:{color:{domain:Object.keys(o),range:Object.values(o)}}}:{},...t===void 0?{}:{scales:{y:{domainMax:t}}},...r}}function RV(e,t){return Object.fromEntries(gEe(e,t).legend.map(o=>[o.id,o.color]))}function KQ(e){return"map"in e?e.map:RV(e,e.domain??[])}function yEe(e){let t=new Int32Array(e.length),o=0;for(let r=0;r<e.length;r++)e.charCodeAt(r)-45>>>0<=1||(t[o++]=r);return t.slice(0,o)}k_();Mv();var CEe=20,hYe=240,yYe=50,bEe=96,bYe=40,xEe=new Float32Array(Xa*Xa);for(let e=0;e<Xa;e++){let t=1/0,o=-1/0;for(let r=0;r<CEe;r++){let n=pT[e*Xa+r];t=Math.min(t,n),o=Math.max(o,n)}for(let r=0;r<Xa;r++){let n=(pT[e*Xa+r]-t)/(o-t);xEe[e*Xa+r]=Math.min(Math.max(n,0),1)}}var XQ=Int8Array.from({length:D_},(e,t)=>{let o=gm(t);return o.length===1?AC[o.charCodeAt(0)]:-1});function CYe(e){let t=Math.round(bEe-(bEe-bYe)*e);return`hsl(${hYe}, ${yYe}%, ${t}%)`}function vEe(e,t,o){let{counted:r,shaded:n,score:i}=o,s=[],a=0;e.forEachResidue(t,(c,u)=>{r(c)&&(s.push([c,u]),a+=u)});let l={};if(a<2)return l;for(let[c]of s)if(n(c)){let u=-i(c,c);for(let[f,p]of s)u+=p*i(c,f);l[gm(c)]=CYe(u/(a-1))}return l}var xYe={counted:e=>XQ[e]>=0,shaded:e=>XQ[e]<CEe,score:(e,t)=>xEe[XQ[e]*Xa+XQ[t]]},vYe={counted:()=>!0,shaded:()=>!0,score:(e,t)=>e===t?1:0};function EEe(e,t){return vEe(e,t,xYe)}function TEe(e,t){return vEe(e,t,vYe)}WR();var IEe=100;function wEe(e){let t=[],o=0,r=[[e,0]];for(let n=r.pop();n;n=r.pop()){let[i,s]=n,{children:a}=i;if(a.length>0)for(let l of a)r.push([l,s+1]);else t.push(i.name),o=Math.max(o,s)}return{names:t,depth:o}}function SEe(e,t){let o=[];for(let s of e)o[s.length]=(o[s.length]??0)+1;let r=o.length;for(let s=0;r>0&&s<IEe;)r--,s+=o[r]??0;let n=0,i=0;for(let s of e)(s.length>r||s.length===r&&i++<IEe)&&(n=Math.max(n,Qm(s,t)));return n}$v();Or();function BEe(e){let t=new Map(e.map(r=>{let n=r.dist===void 0?void 0:Number(r.dist);return[r.id,{id:`${r.id}`,name:r.label||`${r.id}`,...n!==void 0&&Number.isFinite(n)?{length:n}:{},children:[]}]})),o;for(let r of e){let n=t.get(r.id),i=r.parent!==void 0?t.get(r.parent):void 0;i?i.children.push(n):o??=n}if(o===void 0)throw new Error("could not build tree from flat node list: no root found (input was empty or contains a parent cycle)");return o}pb();var EYe={$NODE_COLLAPSED:"collapsed",$NODE_COLOR:"color",$LABEL_BG_COLOR:"color","seq-id":"seqId","seq-title":"seqTitle","align-index":"alignIndex","accession-nbr":"accessionNbr","blast-name":"blastName","common-name":"commonName","leaf-count":"leafCount"};function QV(e,t){let o=1,r=t+1;for(;r<e.length&&o>0;)e[r]==="{"?o++:e[r]==="}"&&o--,r++;return o===0?r:-1}function MV(e){let t=[],o=0;for(;o<e.length;){let r=e.indexOf("{",o);if(r===-1)break;let n=QV(e,r);if(n===-1)break;t.push(e.slice(r+1,n-1).trim()),o=n}return t}function TYe(e,t){let o=e.indexOf("{",t);if(o===-1)return;let r=QV(e,o);return r===-1?void 0:e.slice(o+1,r-1).trim()}function _Ee(e){let t=e.replace(/\s+/g," ").replace(/\s*{\s*/g,"{").replace(/\s*}\s*/g,"}").replace(/\s*,\s*/g,",").replace(/\s*::\s*=\s*/g,"::=").replace(/^.*?::=/,""),o=IYe(t),{fdict:r,nodes:n}=o;if(r===void 0||n===void 0)throw new Error(`invalid BioTreeContainer ASN.1: missing '${r===void 0?"fdict":"nodes"}' section`);let i=Object.fromEntries(MV(r).flatMap(s=>{let a=wYe(s);return a?[[a.id,EYe[a.name]||a.name]]:[]}));return MV(n).flatMap(s=>{let a=SYe(s);if(!a)return[];let{features:l=[],...c}=a;return[{...c,...Object.fromEntries(l.map(u=>[i[u.featureid],u.value]))}]})}function IYe(e){let t={},o=e.trim();o.startsWith("{")&&o.endsWith("}")&&(o=o.slice(1,-1).trim());let r=0;for(;r<o.length;){for(;r<o.length&&/\s/.test(o[r]);)r++;if(r>=o.length)break;let n=r;for(;r<o.length&&/\w/.test(o[r]);)r++;if(r>=o.length||o[r]!==" "&&o[r]!=="{"){r=o.indexOf(",",r),r=r===-1?o.length:r+1;continue}let i=o.slice(n,r).trim();for(;r<o.length&&/\s/.test(o[r]);)r++;if(r>=o.length||o[r]!=="{"){r=o.indexOf(",",r),r=r===-1?o.length:r+1;continue}let s=QV(o,r);if(s===-1)break;t[i]=o.slice(r+1,s-1).trim(),r=o.indexOf(",",s),r=r===-1?o.length:r+1}return t}function wYe(e){let t=/id\s+(\d+)/.exec(e),o=/name\s+"((?:[^"\\]|\\.)*)"/s.exec(e);return!t||!o?null:{id:parseInt(t[1],10),name:o[1].replace(/\\"/g,'"').replace(/\\\\/g,"\\")}}function SYe(e){let t=/id\s+(\d+)/.exec(e);if(!t)return null;let o=/parent\s+(\d+)/.exec(e),r=e.indexOf("features"),n=r!==-1?TYe(e,r):void 0;return{id:parseInt(t[1],10),...o?{parent:parseInt(o[1],10)}:{},features:n?MV(n).flatMap(i=>{let s=BYe(i);return s?[s]:[]}):[]}}function BYe(e){let t=/featureid\s+(\d+)/.exec(e),o=/value\s+"((?:[^"\\]|\\.)*)"/s.exec(e);return!t||!o?null:{featureid:parseInt(t[1],10),value:o[1].replace(/\\"/g,'"').replace(/\\\\/g,"\\")}}Rc();function REe(e){return e.startsWith("BioTreeContainer")?BEe(_Ee(e)):xm(e.startsWith("SEQ")?cR(e).tree:e)}var _Ye=new Set(["collapse","focus","rotate"]);function RYe(e){let t=new Map,o=0,r=(i,s)=>{for(let a=s.length-1;a>=0;a--)i.push(s[a])},n=[e];for(;n.length>0;){let i=n.pop();if(i.children?.length)r(n,i.children);else{let s=[i];for(;s.length>0;){let a=s.pop(),l=a.children??a._children;l?.length?r(s,l):t.set(a.data.name,{order:t.size,row:o})}o++}}return t}function MYe(e,t,o,r){if(e.range){let[l,c]=e.range.map(p=>o.get(p)?r.get(p):void 0);if(l===void 0||c===void 0)return;let[u,f]=l.order<=c.order?[l,c]:[c,l];return f.order-u.order+1===e.tips?{rows:[u.row,f.row]}:void 0}let n=e.mrca?$R(t,e.mrca,o):void 0;if(!n)return;let i=Qc(n);if(i.length!==e.tips)return;let s=1/0,a=-1/0;for(let l of i){let c=r.get(l.data.name)?.row;c!==void 0&&(s=Math.min(s,c),a=Math.max(a,c))}return s<=a?{rows:[s,a],nodeId:n.data.id}:void 0}function PV(e,t,o){let r=jR(t),n=RYe(o);return e.flatMap(i=>{let s=MYe(i,t,r,n),a=_Ye.has(i.mark);return s&&!(a&&s.nodeId===void 0)?[{...s,mark:i.mark,color:z_(i.color??lme,cme),markColor:i.color,label:i.label}]:[]})}var QYe={input:void 0,branchLength:(e,t)=>(e.data.length??1)-(t.data.length??1),ladderize:(e,t)=>e.value-t.value,ladderizeReverse:(e,t)=>t.value-e.value};function ZQ(e,{collapsed:t,rotated:o,order:r,showOnly:n}){let i=Jp(e,a=>a.children);fR(i,a=>a.children.length>0?0:1);let s=QYe[r];if(s&&pR(i,s),o.length>0){let a=new Set(o);lb(i,l=>{a.has(l.data.id)&&l.children?.reverse()})}if(n){let a=tf(i,l=>l.data.id===n);a&&(i=a)}for(let a of t){let l=tf(i,c=>c.data.id===a);l&&(l.children?qhe(l):l.parent?.children&&(l.parent.children=l.parent.children.filter(c=>c.data.id!==a)))}return i}function DV(e,t){let o=jR(e),r=$R(e,t,o);if(r!==e)return r;let n=new Set(t),i=Qc(e).map(a=>a.data.name).filter(a=>!n.has(a)),s=$R(e,i,o);return s===e?void 0:s}function MEe(e,t){let o=new Map;for(let i of mC(e).reverse())o.set(i,{name:i.name===i.id?void 0:i.name,length:i.length,children:i.children.map(s=>o.get(s))});let r=o.get(e);if(t==="midpoint")return zp(lEe(r));let n=DV(Jp(e,i=>i.children),t.outgroup);return n?zp(JQ(r,o.get(n.data))):e}function OV(e){return[Math.round(e.xMin-.5),Math.round(e.xMax-.5)]}Rc();w4();pb();var PYe=/[\s(),:;[\]']/;function DYe(e){return PYe.test(e)?`'${e.replaceAll("'","''")}'`:e}function QEe(e){let t=new Map;for(let o of Cm(e).reverse()){let{id:r,name:n,length:i}=o.data,s="";if(o.children){s=`(${o.children.map(a=>t.get(a)).join(",")})`;for(let a of o.children)t.delete(a)}o.children&&n===r||(s+=DYe(n)),i!==void 0&&(s+=`:${i}`),t.set(o,s)}return`${t.get(e)};`}var PEe={">":"<",")":"(","]":"[","}":"{"},OYe=new Set(Object.values(PEe));function DEe(e){let t=new Map,o=[],r=(i,s)=>{let a=t.get(i);a?a.push(s):t.set(i,[s])},n=(i,s,a)=>{let l=t.get(i)?.pop();l!==void 0&&o.push({start:l,end:s,pseudoknot:a})};for(let i=0;i<e.length;i++){let s=e[i],a=PEe[s];OYe.has(s)?r(s,i):a?n(a,i,!1):s>="A"&&s<="Z"?r(s,i):s>="a"&&s<="z"&&n(s.toUpperCase(),i,!0)}return o.sort((i,s)=>i.start-s.start)}var a7e={bar:40,logo:80,arc:50,ruler:20},jEe=new Set(["bar","logo","arc"]),oTe=new Set(["sequence-logo","position-ruler"]),l7e=e=>`own:${e}`,c7e="#4e79a7",u7e="#e15759",$Ee=new WeakMap;function f7e(e){let t=$Ee.get(e);return t===void 0&&(t=JSON.stringify(e).length,$Ee.set(e,t)),t}function rTe(e){return(e??[]).map(f7e)}function p7e(e,t){let o=rTe(e),r=e?.filter((n,i)=>o[i]<=t);return r?.length?{columnTracks:r}:{}}var d7e=new Set(["id","type","height","drawMsaLetters","scrollZoom","scrollZoomAxis","bgColor","colorSchemeName","customColorScheme","showColumnStats","drawLabels","labelsAlignRight","treeAreaWidth","treeWidth","showBranchLen","treeOrder","drawTree","drawNodeBubbles","drawNodeLabels","showTreeOverview","overviewHeight","turnedOffTracks","trackHeights","hideGaps","allowedGappyness","subFeatureRows","showDomainLegend","domainFill","embeddedMode"]);function YEe(e,t){return e.get(t)??oTe.has(t)}var WEe=[],qEe=[],FV=new Set(["featureFill","featureLabel"]);function JEe(e,t){if(t.has(e))return e;let o=e.replaceAll(":","_");return t.has(o)?o:e}var KEe=new WeakMap;function XEe(e){return e.rowEnd-e.rowStart===e.structEnd-e.structStart}var A7e=Math.log(1.3);function ZEe(e,t,o,r,n,i){if(e===o&&i){let a=r+Math.log(t);return Math.abs(a)<A7e?{value:e,held:a}:{value:dr(o*Math.exp(a),n,bm),held:0}}let s=dr(e*t,n,bm);return(e-o)*(s-o)<0?{value:o,held:0}:{value:s,held:0}}function eTe(e,t){return e-t>.5}function m7e(e,t){return!!e?.some(([o,r])=>t>=o&&t<=r)}function tTe(e){let t=[];for(let o of e){let r=t.at(-1);r&&o<=r[1]+1?r[1]=Math.max(r[1],o):t.push([o,o])}return t}function g7e(e){let[t]=e;return t!==void 0&&e.every(o=>o===t)?t:void 0}function h7e({maxInlineSnapshotBytes:e=nR}={}){return $.compose(Kve(),Zve(),Xve(),$.model("MsaView",{id:LF,showDomains:At($.boolean,!0),domainFill:At($.boolean,!0),showDomainLegend:At($.boolean,!0),hideGaps:At($.boolean,!0),allowedGappyness:At($.number,100),subFeatureRows:At($.boolean,!1),type:$.literal("MsaView"),drawMsaLetters:At($.boolean,UAe),embeddedMode:At($.boolean,!1),scrollZoom:At($.boolean,zAe),scrollZoomAxis:At($.enumeration("ScrollZoomAxis",[...HAe]),GAe),height:At($.number,550),rowHeight:At($.number,16),scrollY:At($.number,0),scrollX:At($.number,0),colWidth:At($.number,12),treeFilehandle:$.maybe(Lx),msaFilehandle:$.maybe(Lx),treeMetadataFilehandle:$.maybe(Lx),gffFilehandle:$.maybe(Lx),currentAlignment:At($.number,0),collapsed:At($.array($.string),[]),rotated:At($.array($.string),[]),treeRoot:$.frozen(),showOnly:$.maybe($.string),turnedOffTracks:At($.map($.boolean),{}),trackHeights:At($.map($.number),{}),columnTracks:At($.array($.snapshotProcessor($.frozen(),{preProcessor:_V})),[]),residueMappings:At($.array($.frozen()),[]),data:$.optional(Jve(e),{}),turnedOffFeatures:At($.map($.boolean),{}),relativeTo:$.maybe($.string),highlightColumns:$.frozen(),highlights:At($.array($.frozen()),[]),features:At($.array($.frozen()),[]),selection:$.frozen(),region:$.frozen(),clades:At($.array($.frozen()),[]),encodings:At($.array($.snapshotProcessor($.frozen(),{preProcessor:SV})),[]),rowPanels:At($.array($.snapshotProcessor($.frozen(),{preProcessor:BV})),[])})).volatile(()=>({headerHeight:0,settingsOpen:!1,zoomHeld:{col:0,row:0},hideHeader:!1,importForm:!0,status:void 0,highResScaleFactor:typeof window>"u"?1:window.devicePixelRatio,zoomSnapshot:void 0,loadingMSA:!1,loadingTree:!1,volatileWidth:void 0,resizeHandleWidth:5,blockSize:500,mouseRow:void 0,mouseCol:void 0,mouseClickRow:void 0,mouseClickCol:void 0,hoveredTreeNode:void 0,highlightedColumns:void 0,transientHighlights:{},minimapHeight:56,marginLeft:20,error:void 0,loadWarnings:[],dismissedWarnings:[],resetCount:0,hostCarriesData:!1,annotations:[]})).actions(t=>({drawRelativeTo(o){t.relativeTo=o},setHideGaps(o){t.hideGaps=o},setAllowedGappyness(o){t.allowedGappyness=o},setLoadingMSA(o){t.loadingMSA=o},setLoadingTree(o){t.loadingTree=o},setWidth(o){t.volatileWidth=o},setSettingsOpen(o){t.settingsOpen=o},setHighResScaleFactor(o){t.highResScaleFactor=o},setHeight(o){t.height=o},setError(o){t.error=o},addWarning(o){t.loadWarnings.includes(o)||(t.loadWarnings=[...t.loadWarnings,o])},setHostCarriesData(o){t.hostCarriesData=o},setMousePos(o,r){t.mouseCol=o,t.mouseRow=r},setHighlightedColumns(o){t.highlightedColumns=o},setRegion(o){t.region=o},setHighlights(o){t.highlights.replace(o)},setFeatures(o){t.features.replace(o)},setSelection(o){let r=o&&{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end),...o.rows?{rows:o.rows}:{}};hg(r,t.selection)||(t.selection=r)},clearSelection(){this.setSelection(void 0)},setClades(o){t.clades.replace(o)},applyHighlight(o,r){t.transientHighlights={...t.transientHighlights,[o]:r}},clearHighlight(o){if(o in t.transientHighlights){let{[o]:r,...n}=t.transientHighlights;t.transientHighlights=n}},setShowDomains(o){t.showDomains=o},setDomainFill(o){t.domainFill=o},setCellFill(o){t.setBgColor(o!=="none"),o!=="none"&&(t.domainFill=o==="domain")},setShowDomainLegend(o){t.showDomainLegend=o},setSubFeatureRows(o){t.subFeatureRows=o},setMouseClickPos(o,r){t.mouseClickCol=o,t.mouseClickRow=r},setRowHeight(o){t.rowHeight=o,t.zoomHeld={...t.zoomHeld,row:0}},setColWidth(o){t.colWidth=o,t.zoomHeld={...t.zoomHeld,col:0}},setCurrentAlignment(o){o!==t.currentAlignment&&_r(()=>{t.currentAlignment=o,t.collapsed.clear(),t.rotated.clear(),this.setShowOnly(void 0),this.drawRelativeTo(void 0),t.scrollX=0,t.scrollY=0})},toggleCollapsed(o){t.collapsed.includes(o)?t.collapsed.remove(o):t.collapsed.push(o)},toggleRotated(o){t.rotated.includes(o)?t.rotated.remove(o):t.rotated.push(o)},clearRotated(){t.rotated.clear()},setTreeRoot(o){hg(t.treeRoot,o)||_r(()=>{t.treeRoot=o,t.collapsed.clear(),t.rotated.clear(),this.setShowOnly(void 0)})},setShowOnly(o){t.showOnly=o},setData(o){t.data=o},setMSAFilehandle(o){t.msaFilehandle=o},setTreeFilehandle(o){t.treeFilehandle=o},setTreeMetadataFilehandle(o){t.treeMetadataFilehandle=o},setGFFFilehandle(o){t.gffFilehandle=o},setMSA(o){t.data.setMSA(o)},setTree(o){t.data.setTree(o)},setTreeMetadata(o){t.data.setTreeMetadata(o)},setGFF(o){t.data.setGFF(o)}})).views(t=>({get hideGapsEffective(){return t.hideGaps&&(t.collapsed.length>0||t.showOnly!==void 0||t.allowedGappyness<100)},get hostRestoresData(){return t.hostCarriesData},get viewInitialized(){return t.volatileWidth!==void 0},get width(){if(t.volatileWidth===void 0)throw new Error("not initialized");return t.volatileWidth-(t.settingsOpen?eR:0)}})).views(t=>({get colorScheme(){let{customColorScheme:o,colorSchemeName:r}=t;return o?Pve(o):cV[r]??cV[tR]},get dynamicColorSchemeName(){let{customColorScheme:o,colorSchemeName:r}=t;return!o&&r.includes("dynamic")?r:void 0},get header(){return this.MSA?.getHeader()??{}},get alignmentNames(){return this.MSA?.alignmentNames??[]},get noTree(){return!!this.tree.noTree},get noDomains(){return this.allAnnotations.length===0},get unshareableData(){if(t.hostRestoresData)return[];let{data:o}=t,r=rTe(t.columnTracks).filter(n=>n>e).reduce((n,i)=>n+i,0);return[["alignment",o.msa,t.msaFilehandle],["tree",o.tree,t.treeFilehandle],["annotations",o.gff,t.gffFilehandle],["row metadata",o.treeMetadata,t.treeMetadataFilehandle]].flatMap(([n,i,s])=>!s&&i&&i.length>e?[{what:n,bytes:i.length}]:[]).concat(r?[{what:"data tracks",bytes:r}]:[]).sort((n,i)=>i.bytes-n.bytes)},menuItems(){return[]},get rowData(){let o=t.data.treeMetadata;if(!o)return{};try{let r=JSON.parse(o);return typeof r=="object"&&r!==null?Object.fromEntries(Object.entries(r).map(([n,i])=>[n,Vve(i)])):{}}catch(r){return console.error("failed to parse rowData",r),{}}},rowDataOf(o){return this.rowData[o]},get rowFields(){let o=new Set;for(let r of Object.values(this.rowData))for(let n of Object.keys(r??{}))o.add(n);return[...o].sort((r,n)=>r.localeCompare(n))},get MSA(){let o=t.data.msa;return o?a4(o,t.currentAlignment,t.msaFormat):null},get allAnnotations(){let o=this.MSA?.annotations??[];return t.features.length>0||o.length>0?[...t.annotations,...Yve(t.features),...o]:t.annotations},get actuallyShowDomains(){return t.showDomains&&this.allAnnotations.length>0},get numColumns(){return(this.MSA?.getWidth()??0)-this.blanks.length},get inputTree(){let o=t.data.tree;return o?zp(REe(o)):this.MSA?.getTree()??{noTree:!0,children:[],id:"empty",name:"empty"}},get tree(){let o=this.inputTree;return t.treeRoot&&!o.noTree?MEe(o,t.treeRoot):o},get rowNames(){return this.leaves.map(o=>o.data.name)},get rowNamesSet(){return new Map(this.leaves.map((o,r)=>[o.data.name,r]))},get resolvedClades(){return t.clades.length===0?qEe:PV(t.clades,Jp(this.tree,o=>o.children),this.root)},get cladeGutterWidth(){return Zhe(t.clades)},get treeDrawn(){return t.drawTree&&!this.noTree},get treeTips(){return wEe(this.tree)},get maxTipLabelWidth(){return SEe(this.treeTips.names.map(o=>this.rowDataOf(o)?.genome||o),K_)},get labelColumnWidth(){return t.drawLabels?this.maxTipLabelWidth+(this.treeDrawn?10:6):0},get fittedTreeAreaWidth(){let o=t.marginLeft+this.cladeGutterWidth,r=this.treeDrawn?t.treeWidth??dr(this.treeTips.depth*XAe,oR,KAe):0,n=o+r+this.labelColumnWidth,i=t.viewInitialized?this.numColumns>0?t.width*ZAe:t.width-this.rowPanelsWidth-t.resizeHandleWidth:1/0,s=Math.max(i,o+Math.min(r,oR));return Math.ceil(Math.min(n,s))},get effectiveTreeAreaWidth(){return t.treeAreaWidth??this.fittedTreeAreaWidth},get effectiveTreeWidth(){let o=this.showTreeText?this.labelColumnWidth:0;return t.treeWidth??Math.max(oR,Math.floor(this.effectiveTreeAreaWidth-t.marginLeft-this.cladeGutterWidth-o))},get showTreeText(){return t.drawLabels&&t.rowHeight>=U3},get mouseOverRowName(){let{mouseRow:o}=t;return o===void 0?void 0:this.leaves[o]?.data.name},get hoveredInsertion(){let{mouseCol:o,mouseRow:r}=t;if(o!==void 0&&r!==void 0){let n=this.leaves[r]?.data.name;if(n){let i=this.insertionPositions.get(n)?.find(s=>s.pos===o);if(i)return{rowName:n,col:o,letters:i.letters}}}},get root(){return ZQ(this.tree,{collapsed:t.collapsed,rotated:t.rotated,order:t.treeOrder,showOnly:t.showOnly})},get treeNewick(){return QEe(ZQ(this.tree,{collapsed:[],rotated:t.rotated,order:t.treeOrder}))},get treeOverviewHeight(){return t.showTreeOverview?t.overviewHeight:0},get treeOverviewLayout(){if(!t.showTreeOverview)return;let o=oz(ZQ(this.tree,{collapsed:t.collapsed,rotated:t.rotated,order:t.treeOrder}),{rowHeight:1,treeWidth:1});return{root:o.root,numTips:o.leaves.length,maxDepthToLeaf:o.root.depthToLeaf,showBranchLen:t.showBranchLen&&o.rootToTipLength>0}},get treeOverviewClades(){let o=this.treeOverviewLayout;return!o||t.clades.length===0?qEe:PV(t.clades,Jp(this.tree,r=>r.children),o.root)},get treeOverviewFocusRows(){let o=this.treeOverviewLayout;if(!o||!t.showOnly)return;let r=tf(o.root,n=>n.data.id===t.showOnly);return r?OV(r):void 0},treeOverviewHit(o){let r=this.treeOverviewLayout;if(!r)return;let{root:n,numTips:i}=r,s=i/t.overviewHeight,a=dr(Math.floor(o*s),0,i-1),l=dr(Math.ceil((o+1)*s)-1,a,i-1),c=YR(n,a+.5,l+.5);for(;!c.children&&c.parent;)c=c.parent;return c===n?void 0:{id:c.data.id,rows:OV(c)}},get rowPanelsWidth(){return _0(t.rowPanels.map(o=>bV(o,t)))},get rowPanelsHeaderHeight(){return t.rowPanels.length>0?iR:0},get msaAreaWidth(){return t.width-this.effectiveTreeAreaWidth-this.rowPanelsWidth-t.resizeHandleWidth},get treeAreaWidthMinusMargin(){return this.effectiveTreeAreaWidth-t.marginLeft-this.cladeGutterWidth},get blanks(){let{hideGapsEffective:o,allowedGappyness:r}=t;if(!o)return[];let n=this.leaves.map(u=>this.MSA?.getRow(u.data.name)).filter(Oa);if(n.length===0)return[];let i=this.MSA?.getWidth()??0,s=n.length,a=Math.ceil(r/100*s),l=new Uint32Array(i);for(let u=0;u<s;u++){let f=n[u],p=f.length;for(let d=0;d<i;d++)(d>=p||f.charCodeAt(d)-45>>>0<=1)&&l[d]++}let c=[];for(let u=0;u<i;u++)l[u]>=a&&c.push(u);return c},get insertionPositions(){let{blanks:o,rows:r}=this;if(o.length===0)return new Map;let n=new Map;for(let[i,s]of r){let a=lAe(o,s);a.length>0&&n.set(i,a)}return n},get rows(){let o=this.MSA;return this.leaves.map(r=>[r.data.name,o?.getRow(r.data.name)]).filter(r=>!!r[1])},get numRows(){return this.leaves.length},seqPosIndex(o){let r=this.MSA;if(!r)return;let n=KEe.get(r);n||(n=new Map,KEe.set(r,n));let i=n.get(o);if(!i){let s=r.getRow(o);if(!s)return;i=yEe(s),n.set(o,i)}return i},rowSequence(o){return this.MSA?.getRow(o)||void 0},get rowMap(){let o=this.MSA;return new Map(o?.getNames().map(r=>[r,o.getRow(r)]).filter(([,r])=>!!r))},get columns(){let o=this.columns2d;return new Map(this.rows.map((r,n)=>[r[0],o[n]]))},get columns2d(){let{hideGapsEffective:o}=t;return this.rows.map(([,r])=>(o?V_(this.blanks,r):r).toUpperCase())},get fontSize(){return z3(t.rowHeight)},get colStats(){return Hde(this.columns2d,this.numColumns)},get sequenceType(){let o=this.colStats.lettersPresent,r=["N","R","Y","K","M","S","W"],n=new Set(["A","C","G","T",...r]),i=new Set(["A","C","G","U",...r]),s=o.size>0&&[...o].every(l=>n.has(l)),a=o.size>0&&[...o].every(l=>i.has(l));return s?"dna":a?"rna":"amino"},get colConsensus(){let{colStats:o}=this;return Array.from({length:o.numColumns},(r,n)=>{let i=o.total(n),s=0,a="";o.forEachResidue(n,(c,u)=>{u>s&&(s=u,a=gm(c))});let l=i?s/i:0;return{letter:a,color:l>.4?`hsl(240, 30%, ${100*Math.max(1-l/3,.3)}%)`:void 0}})},get colClustalX(){let{colStats:o}=this;return Array.from({length:o.numColumns},(r,n)=>Rve(o,n))},get colSimilarity(){let{colStats:o,sequenceType:r}=this,n=r==="amino"?EEe:TEe;return Array.from({length:o.numColumns},(i,s)=>n(o,s))},get conservation(){let{colStats:o,alphabetMaxBits:r}=this;return Array.from({length:o.numColumns},(n,i)=>{let s=o.total(i),a=o.gapCount(i);return s>a?Math.max(0,1-o.entropy(i)/r)*(1-a/s):0})},get alphabetMaxBits(){return Gde(this.sequenceType)},get propertyConservation(){return this.sequenceType==="amino"?sEe(this.colStats):[]},get treeLayout(){let o=()=>this.effectiveTreeWidth;return oz(this.root,{get rowHeight(){return t.rowHeight},get treeWidth(){return o()}})},get hierarchy(){return this.treeLayout.root},get totalHeight(){return this.leaves.length*t.rowHeight},get leaves(){return this.treeLayout.leaves},get rootToTipLength(){return this.treeLayout.rootToTipLength},get pxPerBranchLength(){let o=this.rootToTipLength;return this.showBranchLenEffective&&o?this.effectiveTreeWidth/o:0},get maxDepthToLeaf(){return this.treeLayout.root.depthToLeaf},get allBranchesLength0(){return this.rootToTipLength===0},get showBranchLenEffective(){return this.allBranchesLength0?!1:t.showBranchLen}})).views(t=>({get totalWidth(){return t.numColumns*t.colWidth}})).views(t=>({get showMsaLetters(){return t.drawMsaLetters&&t.rowHeight>=U3&&t.colWidth>=VAe&&t.colWidth>t.rowHeight/2}})).views(t=>{let o=new WeakMap;return{get columnTrackContent(){let{MSA:r,blanks:n,hideGapsEffective:i}=t,s=r?.getWidth()??0,a=(u,f,p)=>{if(!u.row)return f;let d=Array.from({length:s},()=>p),m=t.seqPosIndex(u.row);return f.forEach((y,b)=>{let h=m?.[b];h!==void 0&&(d[h]=y)}),d},l=u=>i?aAe(n,u):u,c=(u,f)=>{let p=u.row?t.seqPosIndex(u.row)?.[f-1]:f-1;if(!(p===void 0||p<0||p>=s))return i?gC(n,p):p};return new Map(t.columnTracks.map(u=>{if(u.kind==="arc"){let p=(u.arcs??[]).map(d=>{let m=c(u,Math.min(d.start,d.end)),y=c(u,Math.max(d.start,d.end));return m!==void 0&&y!==void 0&&m<y?{start:m,end:y,color:d.color}:void 0}).filter(Oa);return[u.id,{arcs:p}]}if(u.kind==="bar"){let p=u.scales?.y?.domainMax??1,d=l(a(u,u.values??[],0)).map(m=>Math.min(1,Math.max(0,m/p)));return[u.id,{values:d}]}let f=l(a(u,(u.data??"").split("")," "));return[u.id,{data:f.join("")}]}))},trackHeight(r,n=r,i){return t.trackHeights.get(n)??i??a7e[r]??t.rowHeight},columnTrackModel(r){let n=o.get(r);return n||(n=Nf(()=>{let i=jEe.has(r.kind)?l7e(r.id):void 0,s=this.columnTrackContent.get(r.id);return{model:{id:r.id,name:r.name,kind:r.kind,heightKey:i,height:this.trackHeight(r.kind,i,r.height),barColor:r.color,arcColor:r.color,customColorScheme:r.encoding?.color?RV(r.encoding.color,[...r.encoding.color.domain??[],...new Set(r.data)]):void 0,data:s?.data,arcs:s?.arcs}}}),o.set(r,n)),n.get()},get columnTrackModels(){return t.columnTracks.map(r=>this.columnTrackModel(r))}}}).views(t=>({get secondaryStructureConsensus(){return t.MSA?.secondaryStructureConsensus},get secondaryStructureArcs(){let{blanks:o,hideGapsEffective:r}=t,n=this.secondaryStructureConsensus;if(n)return DEe(r?V_(o,n):n).map(({start:i,end:s,pseudoknot:a})=>({start:i,end:s,color:a?u7e:c7e}))},get adapterTrackModels(){let{MSA:o,hideGapsEffective:r,blanks:n}=t,i=(o?.tracks??[]).filter(a=>!!a.data);if(i.length===0)return[];let{rowHeight:s}=t;return i.map(a=>({model:{...a,kind:"text",data:r?V_(n,a.data):a.data,height:s}}))},get basePairTrackModels(){let o=this.secondaryStructureArcs;return o?.length?[{model:{id:"base-pairs",name:"Base pairs",kind:"arc",heightKey:"arc",height:t.trackHeight("arc"),arcs:o}}]:[]},get computedTrackModels(){return[{id:"conservation",name:"Conservation",kind:"bar",barColor:"gray"},...t.sequenceType==="amino"?[{id:"property-conservation",name:"Property conservation",kind:"bar",barColor:"#6a51a3"}]:[],{id:"sequence-logo",name:"Sequence logo",kind:"logo"},{id:"position-ruler",name:"Position",kind:"ruler"}].map(o=>({model:{...o,heightKey:jEe.has(o.kind)?o.kind:void 0,height:t.trackHeight(o.kind)}}))},get referenceTrackModels(){let{relativeTo:o}=t,r=o===void 0?void 0:t.columns.get(o);return o===void 0||r===void 0?[]:[{model:{id:"reference-row",name:o,kind:"reference",data:r,height:t.rowHeight}}]},get tracks(){return[...this.adapterTrackModels,...this.basePairTrackModels,...t.columnTrackModels,...t.numColumns>0?this.computedTrackModels:[],...this.referenceTrackModels]},get turnedOnTracks(){return this.tracks.filter(o=>!YEe(t.turnedOffTracks,o.model.id))},get showHorizontalScrollbar(){return eTe(t.totalWidth,t.msaAreaWidth)},visibleColToRowLetter(o,r){return t.rowSequence(o)?.[this.visibleColToGlobalCol(r)]},visibleColToSeqPos(o,r){return pEe(t.seqPosIndex(o),this.visibleColToGlobalCol(r))},visibleColToSeqPosOneBased(o,r){let n=this.visibleColToSeqPos(o,r);return n!==void 0?n+1:void 0},globalColToVisibleCol(o){let{blanks:r,hideGapsEffective:n}=t;return n?uEe(r,o):o},visibleColToGlobalCol(o){let{blanks:r,hideGapsEffective:n}=t;return n?cEe(r,o):o},seqPosToGlobalCol(o,r){let n=t.rowSequence(o);return n===void 0?void 0:t.seqPosIndex(o)?.[r]??(r===0?0:n.length)},seqEndToGlobalCol(o,r){let n=t.seqPosIndex(o);return n&&n.length>0?n[Math.min(r,n.length-1)]:void 0},seqPosToVisibleCol(o,r){let n=this.seqPosToGlobalCol(o,r);return n===void 0?void 0:this.globalColToVisibleCol(n)},visibleSpan({row:o,start:r,end:n}){let{blanks:i}=t,s=Math.max(1,Math.floor(r)),a=Math.ceil(n),l=s-1,c=Math.min(a,t.MSA?.getWidth()??a)-1;if(o!==void 0){let p=this.seqPosToGlobalCol(o,s-1),d=this.seqEndToGlobalCol(o,a-1);if(p===void 0||d===void 0)return;l=p,c=d}let u=this.globalColToVisibleCol(l)??gC(i,l),f=this.globalColToVisibleCol(c)??gC(i,c)-1;return u<=f?{startCol:u,endCol:f}:void 0},get residueMappingProblems(){let o=[];for(let r of t.residueMappings){let n={row:r.row,structureId:r.structure.id},i=t.seqPosIndex(r.row)?.length;if(i===void 0){o.push({...n,scope:"mapping",reason:"no such row in the alignment"});continue}if(r.rowLength!==void 0&&r.rowLength!==i){o.push({...n,scope:"mapping",reason:`computed against a ${r.rowLength}-residue row; this one has ${i}`});continue}let s=r.segments.find(a=>a.rowEnd>i||a.rowStart<1);if(s){o.push({...n,scope:"mapping",reason:`segment ${s.rowStart}-${s.rowEnd} does not fit a ${i}-residue row`});continue}for(let a of r.segments)XEe(a)||o.push({...n,scope:"segment",reason:`segment ${a.rowStart}-${a.rowEnd} maps to ${a.structStart}-${a.structEnd}, which is a different length`})}return o},get usableResidueMappings(){let o=new Set(this.residueMappingProblems.filter(r=>r.scope==="mapping").map(r=>`${r.row}\0${r.structureId}`));return t.residueMappings.filter(r=>!o.has(`${r.row}\0${r.structure.id}`)).map(r=>({...r,segments:r.segments.filter(XEe)}))},get mappedStructures(){return this.usableResidueMappings.map(o=>({row:o.row,structure:o.structure}))},structureResidue(o,r,n){let i=[];for(let s of this.usableResidueMappings){if(s.row!==o||n!==void 0&&s.structure.id!==n)continue;let a=s.segments.find(l=>r>=l.rowStart&&r<=l.rowEnd);if(a){let l=a.structStart+(r-a.rowStart);i.push({structure:s.structure,position:l,observed:!m7e(s.unobserved,l)})}}return i.length===1?i[0]:void 0},rowResidue(o,r,n){let i=[];for(let s of this.usableResidueMappings){if(s.structure.id!==o||n!==void 0&&s.structure.asymId!==void 0&&s.structure.asymId!==n)continue;let a=s.segments.find(l=>r>=l.structStart&&r<=l.structEnd);a&&i.push({rowName:s.row,seqPos:a.rowStart+(r-a.structStart)})}return i.length===1?i[0]:void 0}})).views(t=>({get treeScaleBar(){return Ove(t.pxPerBranchLength,t.effectiveTreeAreaWidth-t.marginLeft*2)},get topBandHeight(){return Math.max(t.showHorizontalScrollbar?t.minimapHeight:0,t.rowPanelsHeaderHeight,t.treeOverviewHeight+(this.treeScaleBar?Zu:0))},get msaAreaHeight(){return t.height-this.topBandHeight-t.headerHeight-this.totalTrackAreaHeight},get totalTrackAreaHeight(){return _0(t.turnedOnTracks.map(o=>o.model.height))},get annotationTypes(){let o=new Map;for(let r of t.allAnnotations)o.has(r.accession)||o.set(r.accession,r);return o},get defaultOffAccessions(){return new Set(t.allAnnotations.filter(o=>o.defaultOff).map(o=>o.accession))},featureOff(o){return t.turnedOffFeatures.get(o)??this.defaultOffAccessions.has(o)},get filteredAnnotations(){return t.allAnnotations.filter(o=>!this.featureOff(o.accession))},get cellFill(){return t.bgColor?t.actuallyShowDomains&&t.domainFill&&this.filteredAnnotations.length>0?"domain":"residue":"none"},get annotationsByRow(){let{rowNamesSet:o}=t;return ele(this.filteredAnnotations,r=>JEe(r.id,o))}})).views(t=>({get showVerticalScrollbar(){return eTe(t.totalHeight,t.msaAreaHeight)}})).views(t=>({get dataInitialized(){return!!(t.data.msa||t.data.tree)&&!t.error},get blocksX(){return Xv({viewportSize:t.msaAreaWidth,viewportPos:-t.scrollX,blockSize:t.blockSize,mapSize:t.totalWidth})},get blocksY(){return Xv({viewportSize:t.msaAreaHeight,viewportPos:-t.scrollY,blockSize:t.blockSize,mapSize:t.totalHeight})}})).views(t=>({get verticalScrollbarWidth(){return t.showVerticalScrollbar?20:0},get msaCanvasWidth(){return t.msaAreaWidth-this.verticalScrollbarWidth},get maxScrollX(){return Math.min(-t.totalWidth+this.msaCanvasWidth,0)},get blocks2d(){return t.blocksY.flatMap(o=>t.blocksX.map(r=>[r,o]))},get wheelZooming(){return t.zoomSnapshot!==void 0},get isLoading(){return t.loadingMSA||t.loadingTree},get dataWarnings(){let{annotations:o,rowNamesSet:r}=t;return t.dataInitialized&&o.length>0&&!o.some(n=>r.has(JEe(n.id,r)))?[`0 of ${o.length} annotations name a row in this alignment`]:[]},get warnings(){return[...t.loadWarnings,...this.dataWarnings.filter(o=>!t.dismissedWarnings.includes(o))]},get maxScrollY(){return Math.min(-t.totalHeight+t.msaAreaHeight,0)},get wheelZoomAxis(){return t.scrollZoom?t.scrollZoomAxis:"both"}})).actions(t=>({setDrawMsaLetters(o){t.drawMsaLetters=o},clearWarnings(){t.loadWarnings=[],t.dismissedWarnings=t.dataWarnings},setScrollZoom(o){t.scrollZoom=o},setScrollZoomAxis(o){t.scrollZoomAxis=o},setHoveredTreeNode(o){if(o===t.hoveredTreeNode?.nodeId)return;if(!o){t.hoveredTreeNode=void 0;return}let r=tf(t.hierarchy,n=>n.data.id===o);t.hoveredTreeNode=r?{nodeId:o,descendantNames:Qc(r).map(n=>n.data.name)}:void 0},calculateNeighborJoiningTreeFromMSA(){let o=[...t.rowMap];if(o.length<2)throw new Error("Need at least 2 sequences to build a tree");if(o.length>sb)throw new Error(`Neighbor joining here is capped at ${sb} sequences and this alignment has ${o.length}. Build the tree with FastTree or IQ-TREE and open it alongside the alignment: https://gmod.org/JBrowseMSA/tutorials/protein_family`);this.replaceTree(rEe(o))},rerootAt(o){let r=tf(Jp(t.tree,i=>i.children),i=>i.data.id===o);if(!r?.parent)return;let n=DV(Jp(t.inputTree,i=>i.children),Qc(r).map(i=>i.data.name));if(n){let i=Qc(n);t.setTreeRoot({outgroup:[...new Set([i[0].data.name,i.at(-1).data.name])]})}},replaceTree(o){_r(()=>{t.setTreeFilehandle(void 0),t.collapsed.clear(),t.rotated.clear(),t.setShowOnly(void 0),t.setTree(o)})},resetZoom(){t.setColWidth(12),t.setRowHeight(16)},zoomAtCenter(o,r="both"){this.zoomToPos(o,t.msaCanvasWidth/2,t.msaAreaHeight/2,r)},zoomIn(){this.zoomAtCenter(1.5)},zoomOut(){this.zoomAtCenter(.75)},zoomToPos(o,r,n,i="both"){_r(()=>{let s=(-t.scrollX+r)/t.colWidth,a=(-t.scrollY+n)/t.rowHeight,l=i!=="both"||t.colWidth===12&&t.rowHeight===16;if(i!=="vertical"){let{value:d,held:m}=ZEe(t.colWidth,o,12,t.zoomHeld.col,X_,l);t.colWidth=d,t.zoomHeld={...t.zoomHeld,col:m}}if(i!=="horizontal"){let{value:d,held:m}=ZEe(t.rowHeight,o,16,t.zoomHeld.row,Z_,l);t.rowHeight=d,t.zoomHeld={...t.zoomHeld,row:m}}t.scrollX=dr(r-s*t.colWidth,t.maxScrollX,0);let c=n-a*t.rowHeight,u=Math.max(0,-t.maxScrollY),f=t.totalHeight-u,p=f>0?dr(1-u/f,0,1):1;t.scrollY=dr(c*(1-p),t.maxScrollY,0)})},wheelZoomToPos(o,r,n){t.zoomSnapshot??=L4(t,!1),this.zoomToPos(o,r,n,t.wheelZoomAxis),Ahe(t,t.zoomSnapshot)||(t.zoomSnapshot=L4(t,!0))},endWheelZoom(){t.zoomSnapshot=void 0},doScrollY(o){this.setScrollY(t.scrollY+o)},setScrollY(o){t.scrollY=dr(o,t.maxScrollY,0)},setAnnotations(o){t.annotations=o},applyGFFText(o){this.setAnnotations(mR(AR(o)))},doScrollX(o){this.setScrollX(t.scrollX+o)},setScrollX(o){t.scrollX=dr(o,t.maxScrollX,0)},setColumnTracks(o){t.columnTracks.replace(o.map(_V))},setRowData(o){t.data.setTreeMetadata(JSON.stringify(o))},setEncodings(o){t.encodings.replace(o.map(SV))},setRowPanels(o){t.rowPanels.replace(o.map(BV))},setResidueMappings(o){t.residueMappings.replace(o)},toggleTrack(o){t.turnedOffTracks.set(o,!YEe(t.turnedOffTracks,o))},setTracksShown(o,r){for(let n of o)oTe.has(n)===!r?t.turnedOffTracks.delete(n):t.turnedOffTracks.set(n,!r)},setStatus(o){t.status=o}})).views(t=>({cellAt(o,r){let n=t.visibleColToGlobalCol(o),i=r===void 0?void 0:t.leaves[r]?.data.name;return i===void 0?{column:n+1}:{column:n+1,row:i,residue:t.visibleColToSeqPosOneBased(i,o),letter:t.rowSequence(i)?.[n]}},get hoveredCell(){let{mouseCol:o,mouseRow:r}=t;return o===void 0?void 0:this.cellAt(o,r)},get clickedCell(){let{mouseClickCol:o,mouseClickRow:r}=t;return o===void 0?void 0:this.cellAt(o,r)},get viewport(){let{scrollX:o,colWidth:r,numColumns:n,viewInitialized:i}=t;if(n===0||!i)return;let{xStart:s,xEnd:a}=Fa({offsetX:-o,blockWidth:t.msaCanvasWidth,colWidth:r}),l=Math.max(0,Math.min(a,n)-1);return{startColumn:t.visibleColToGlobalCol(Math.min(s,l))+1,endColumn:t.visibleColToGlobalCol(l)+1}},get segmentDomainTypes(){return[...t.annotationTypes.values()].filter(o=>L3.has(o.featureType??"")).toSorted((o,r)=>o.start-r.start)},get categoricalDomainTypes(){return[...t.annotationTypes.values()].filter(o=>!L3.has(o.featureType??""))},get fillPalette(){let o=Object.fromEntries(this.segmentDomainTypes.map((n,i)=>[n.accession,F3[i%F3.length]])),r=n=>this.categoricalDomainTypes.filter(i=>NAe(i.featureType)===n).map(i=>i.accession);return{...o,...uT(r(!1),LAe,75),...uT(r(!0),FAe,40)}},get featureFillEncoding(){return this.resolvedEncodings.find(o=>o.channel==="featureFill")},get featureColors(){return CV(t.filteredAnnotations,this.featureFillEncoding,this.fillPalette)},get featureLabels(){let o=this.resolvedEncodings.find(r=>r.channel==="featureLabel");return o?xV(t.filteredAnnotations,o.field):void 0},get segmentLabels(){return new Map(this.segmentDomainTypes.map((o,r)=>{let n=/(\d+)\s*$/.exec(o.name);return[o.accession,n?n[1]:`${r+1}`]}))},get visibleDomainTypes(){return this.categoricalDomainTypes.filter(o=>!t.featureOff(o.accession)).toSorted((o,r)=>o.start-r.start)},get legends(){let{featureFillEncoding:o,fillPalette:r,visibleDomainTypes:n}=this,i=new Map,s=new Set,a=(l,c,u,f=!1)=>{let p=l??"domains";if(u.length===0||i.has(p))return;let d=f||l===void 0?"domains":`rowData-${c}`,m=d;for(let y=2;s.has(m);y++)m=`${d}-${y}`;s.add(m),i.set(p,{id:m,title:c??"Domains",entries:u})};t.actuallyShowDomains&&t.numColumns>0&&a(o?.key,o?.title,o?o.legend:n.map(l=>({id:l.accession,label:l.name,color:l.color??r[l.accession]})),!0);for(let{channel:l,key:c,title:u,legend:f}of this.resolvedEncodings)FV.has(l)||a(c,u,f);for(let{legendKey:l,legendTitle:c,legend:u}of this.rowPanelScales)a(l,c,u);return[...i.values()]},get domainUnderline(){return t.actuallyShowDomains&&t.cellFill!=="domain"&&!t.subFeatureRows&&t.showMsaLetters},get domainBands(){let{blanks:o}=t,r=new Map;for(let[n,i]of Object.entries(t.annotationsByRow)){let s=i.toSorted((a,l)=>B3(l)-B3(a)).map(a=>{let l=t.seqPosToGlobalCol(n,a.start-1),c=t.seqEndToGlobalCol(n,a.end-1);if(l===void 0||c===void 0)return;let u=gC(o,l),f=gC(o,c+1);return f>u?{annotation:a,startCol:u,endCol:f}:void 0}).filter(Oa).map((a,l)=>({...a,stackIndex:l}));s.length>0&&r.set(n,fC(s))}return r},get domainBandsByStart(){return new Map([...this.domainBands].map(([o,r])=>[o,r.toSorted((n,i)=>n.startCol-i.startCol)]))},get mouseOverDomains(){let{mouseCol:o}=t,r=t.mouseOverRowName;if(r===void 0||o===void 0)return WEe;let n=(this.domainBands.get(r)??[]).filter(i=>o>=i.startCol&&o<i.endCol).map(i=>i.annotation);return n.length>0?n:WEe},get referenceRowIndex(){let{relativeTo:o}=t;return o===void 0?void 0:t.rowNamesSet.get(o)},get hoveredRowIndices(){let{hoveredTreeNode:o,rowNamesSet:r}=t;return o?o.descendantNames.map(n=>r.get(n)).filter(Oa):[]},get highlightedColumnRuns(){return tTe([...t.highlightedColumns??[]].sort((o,r)=>o-r)).map(([o,r])=>({start:o,end:r}))},fillHighlightLabel(o,r,n){if(!o.includes("{"))return o;let i=r&&n!==void 0?t.seqPosIndex(r)?.[n-1]:void 0,s=r&&i!==void 0?t.MSA?.getRow(r)[i]??"":"";return o.replaceAll("{residue}",s).replaceAll("{position}",n===void 0?"":String(n))},get resolvedHighlights(){let{rowNamesSet:o,transientHighlights:r}=t;return[...t.highlights,...Object.values(r).flat()].flatMap(({row:i,rows:s,start:a,end:l,label:c,color:u})=>{let f={label:c&&this.fillHighlightLabel(c,i,a),color:u};if(s){let d=s.map(m=>o.get(m)).filter(Oa);return d.length?[{...f,rowIndices:d}]:[]}if(a===void 0||l===void 0)return[];let p=t.visibleSpan({row:i,start:a,end:l});return p?[{...f,...p,rowIndices:[]}]:[]})},get resolvedSelection(){let{selection:o,rowNamesSet:r,numRows:n}=t,i=o&&t.visibleSpan({start:o.start,end:o.end});if(!o||!i)return;let s=o.rows?tTe(o.rows.map(a=>r.get(a)).filter(Oa).sort((a,l)=>a-l)):n>0?[[0,n-1]]:[];return s.length>0?{...i,rowRuns:s}:void 0},get selectionSize(){let o=this.resolvedSelection,r=this.selectionFileSpan;return o&&r?{columns:r.end-r.start+1,rows:_0(o.rowRuns.map(([n,i])=>i-n+1))}:void 0},get selectionFileSpan(){let{selection:o}=t,r=t.MSA?.getWidth()??0,n=Math.max(1,Math.floor(o?.start??0)),i=Math.min(r,Math.ceil(o?.end??0));return o&&n<=i?{start:n,end:i}:void 0},get selectionFasta(){let{rowNames:o}=t,r=this.resolvedSelection,n=this.selectionFileSpan;if(!r||!n)return"";let i=r.rowRuns.flatMap(([s,a])=>o.slice(s,a+1)).flatMap(s=>{let a=t.rowSequence(s);return a===void 0?[]:[[s,a]]});return Ive(i,n.start,n.end)},columnStatsAt(o){let{colStats:r,conservation:n,propertyConservation:i}=t;return Dve({col:o,colStats:r,conservation:n,propertyConservation:i})},getRowData(o){return{data:t.MSA?.getRowData(o),rowData:t.rowDataOf(o)}},get resolvedEncodings(){return t.encodings.map(o=>({...o,...this.scaleOf(o,FV.has(o.channel)?"features":"rows")}))},get resolvedScales(){let o=Object.values(t.rowData),r=(i,s)=>i.map(a=>af(a,s)).filter(Oa),n=(i,s)=>({spec:i,field:i.field,table:s,...s==="rows"?{values:o.map(a=>a?.[i.field]).filter(Oa)}:{values:r(t.allAnnotations,i.field),shown:r(t.filteredAnnotations,i.field)}});return hEe([...t.encodings.map(i=>n(i,FV.has(i.channel)?"features":"rows")),...t.rowPanels.flatMap(i=>i.kind==="strip"?[n(i,"rows")]:i.encoding?.color?[n(i.encoding.color,"features")]:[])])},scaleOf(o,r){return this.resolvedScales.get(wV({spec:o,field:o.field,table:r}))},get rowPanelScales(){let{rowData:o}=t,{fillPalette:r,featureFillEncoding:n,featureLabels:i}=this,s=t.filteredAnnotations;return t.rowPanels.map(a=>{if(a.kind==="features"){let p=a.encoding?.color,d=p?{field:p.field,...this.scaleOf(p,"features")}:n,m=a.encoding?.label;return{kind:a.kind,x:a.x,header:a.header??"",field:d?.field,legendKey:d?.key,legendTitle:d?.title,colors:p?CV(s,d,r):this.featureColors,labels:m?xV(s,m):i,legend:d?.legend??this.visibleDomainTypes.map(y=>({id:y.accession,label:y.name,color:y.color??r[y.accession]}))}}let{colorOf:l,legend:c,key:u,title:f}=this.scaleOf(a,"rows");return{kind:a.kind,field:a.field,header:a.header??a.field,legendKey:u,legendTitle:f,colors:WQ(o,a.field,l),legend:c}})},get resolvedRowPanels(){let o=this.rowPanelScales,r=0;return t.rowPanels.map((n,i)=>{let s=bV(n,t),a={id:`rowpanel-${i}`,width:s,offsetX:r};if(r+=s,n.kind==="features"){let l=n.transform?.find(c=>c.type==="align");return{...a,...o[i],spans:jve({panel:n,width:s,colWidth:t.colWidth,domainBands:this.domainBands,annotationsByRow:t.annotationsByRow,shifts:l?this.featureAlignShifts.get(l.on):void 0})}}return{...a,...o[i]}})},get featureAlignShifts(){let o=new Set(t.rowPanels.flatMap(r=>r.kind==="features"&&r.x==="position"?(r.transform??[]).filter(n=>n.type==="align").map(n=>n.on):[]));return new Map([...o].map(r=>[r,new Map(Object.entries(t.annotationsByRow).map(([n,i])=>{let s=i.find(a=>GR(a)===r);return s?[n,1-s.start]:void 0}).filter(Oa))]))},get tipLabelColors(){let o=this.resolvedEncodings.find(r=>r.channel==="tipLabel");return o?WQ(t.rowData,o.field,o.colorOf):void 0},get rowTints(){let o=this.resolvedEncodings.find(n=>n.channel==="rowTint");if(!o)return;let r=WQ(t.rowData,o.field,o.colorOf);return t.rowNames.map(n=>{let i=r.get(n);return i&&z_(i,ame)})},get branchColors(){let o=this.resolvedEncodings.find(s=>s.channel==="branch");if(!o)return;let r=mC(t.tree),n=new Map,i=new Map;for(let s=r.length-1;s>=0;s--){let a=r[s],l=a.children.length>0?g7e(a.children.map(u=>n.get(u))):t.rowDataOf(a.name)?.[o.field];n.set(a,l);let c=l===void 0?void 0:o.colorOf(l);c&&i.set(a.id,c)}return i}})).actions(t=>({setHeaderHeight(o){t.headerHeight=o},setHideHeader(o){t.hideHeader=o},setEmbeddedMode(o){t.embeddedMode=o},setImportForm(o){t.importForm=o},treeOverviewClick(o){let r=t.treeOverviewHit(o),n=t.treeOverviewFocusRows,i=!!n&&!!r&&r.rows[0]>=n[0]&&r.rows[1]<=n[1];t.setShowOnly(i||!r?void 0:r.id)},setTrackHeight(o,r){t.trackHeights.set(o,r)},reset(){t.resetCount++,t.loadWarnings=[],t.dismissedWarnings=[],t.setStatus(void 0),V8(t,Object.fromEntries(Object.entries(PC(t)).filter(([o])=>d7e.has(o)))),t.setError(void 0),t.setAnnotations([]),t.setHighlightedColumns(void 0),t.transientHighlights={},t.setMousePos(void 0,void 0),t.setMouseClickPos(void 0,void 0),t.setHoveredTreeNode(void 0)},async exportSVG(o){let{renderToSvg:r}=await Promise.resolve().then(()=>(VEe(),GEe)),n=await r(t,o),i=new Blob([n],{type:"image/svg+xml"});qv(i,yV(t.msaFilehandle,"svg"))},exportNewick(){let o=new Blob([t.treeNewick],{type:"text/plain"});qv(o,yV(t.treeFilehandle??t.msaFilehandle,"nwk","tree"))},setFilter(o,r){r===t.defaultOffAccessions.has(o)?t.turnedOffFeatures.set(o,!r):t.turnedOffFeatures.delete(o)},fit(){_r(()=>{for(let o=0;o<2;o++)this.fitHorizontally(12),this.fitVertically(16)})},fitVertically(o=bm){t.numRows>0&&t.setRowHeight(dr(t.msaAreaHeight/t.numRows,Z_,o)),t.scrollY=0},zoomToRegion(o){let r=t.visibleSpan(o);!r||!t.viewInitialized||_r(()=>{t.setColWidth(dr(t.msaCanvasWidth/(r.endCol-r.startCol+1),X_,bm)),t.scrollX=dr(-r.startCol*t.colWidth,t.maxScrollX,0)})},revealRegion(o){_r(()=>{this.zoomToRegion(o);let r=o.row===void 0?void 0:t.rowNamesSet.get(o.row);r!==void 0&&t.viewInitialized&&t.setScrollY(-(r+.5)*t.rowHeight+t.msaAreaHeight/2)})},zoomToSelection(){let{selection:o,resolvedSelection:r}=t;!o||!r||_r(()=>{if(this.zoomToRegion({start:o.start,end:o.end}),o.rows&&t.viewInitialized){let{rowRuns:n}=r,i=n[0][0],s=n.at(-1)[1];t.setRowHeight(dr(t.msaAreaHeight/(s-i+1),Z_,bm)),t.scrollY=dr(-i*t.rowHeight,t.maxScrollY,0)}})},selectBlock(o,r){let{numColumns:n,numRows:i,rowNames:s}=t;if(n===0||i===0)return;let a=(d,m,y)=>[dr(d,0,y),dr(m,0,y)].sort((b,h)=>b-h),[l,c]=a(o.col,r.col,n-1),[u,f]=o.row===void 0||r.row===void 0?[0,i-1]:a(o.row,r.row,i-1),p=u===0&&f===i-1;t.setSelection({start:t.visibleColToGlobalCol(l)+1,end:t.visibleColToGlobalCol(c)+1,...p?{}:{rows:s.slice(u,f+1)}})},fitHorizontally(o=bm){t.numColumns>0&&t.setColWidth(dr(t.msaCanvasWidth/t.numColumns,X_,o)),t.scrollX=0},afterCreate(){t.highlightColumns?.length&&t.setHighlightedColumns(t.highlightColumns);let o=()=>!!t.treeFilehandle&&!t.data.tree;if(au(t,yg(()=>t.dataInitialized&&!o()?{clades:PC(t.clades),treeRoot:t.treeRoot}:void 0,n=>{if(n?.clades.length)for(let{mark:i,nodeId:s}of t.resolvedClades)s!==void 0&&(i==="collapse"&&!t.collapsed.includes(s)?t.toggleCollapsed(s):i==="focus"?t.setShowOnly(s):i==="rotate"&&!t.rotated.includes(s)&&t.toggleRotated(s))},{fireImmediately:!0,equals:hg})),au(t,Jl(()=>{let{region:n}=t;n&&t.viewInitialized&&t.numColumns>0&&!o()&&(this.revealRegion(n),t.setRegion(void 0))})),typeof window<"u"&&typeof window.matchMedia=="function"){let n=()=>window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),i=n(),s=()=>{t.setHighResScaleFactor(window.devicePixelRatio),i.removeEventListener("change",s),i=n(),i.addEventListener("change",s)};i.addEventListener("change",s),au(t,()=>{i.removeEventListener("change",s)})}fT(t,{what:"tree",getFilehandle:()=>t.treeFilehandle,onLoad:n=>{t.setTree(n)},setLoading:n=>{t.setLoadingTree(n)},clearFilehandle:()=>{t.setTreeFilehandle(void 0)}}),fT(t,{what:"row metadata",optional:!0,getFilehandle:()=>t.treeMetadataFilehandle,onLoad:n=>{t.setTreeMetadata(n)}});let r=!1;au(t,Jl(()=>{let n=t.data.gff;if(n)try{t.applyGFFText(n),r=!0}catch(i){console.error(i),t.addWarning(`The annotations did not parse: ${i}`)}else r&&(r=!1,t.setAnnotations([]))})),fT(t,{what:"annotations",optional:!0,getFilehandle:()=>t.gffFilehandle,onLoad:n=>{t.setGFF(n)},clearFilehandle:()=>{t.setGFFFilehandle(void 0)}}),fT(t,{what:"alignment",getFilehandle:()=>t.msaFilehandle,onLoad:n=>{t.setMSA(n)},setLoading:n=>{t.setLoadingMSA(n)},clearFilehandle:()=>{t.setMSAFilehandle(void 0)}}),au(t,Jl(()=>{t.dynamicColorSchemeName&&j_(t.colStats),t.showColumnStats&&j_(t.colStats,t.conservation,t.propertyConservation),j_(t.columns)}))}})).postProcessSnapshot(({data:t,columnTracks:o,...r})=>({...r,...p7e(o,e),data:{...r.treeFilehandle?{}:{tree:t.tree},...r.msaFilehandle?{}:{msa:t.msa},...r.treeMetadataFilehandle?{}:{treeMetadata:t.treeMetadata},...r.gffFilehandle?{}:{gff:t.gff}}}))}var eP=h7e;lN();function y7e(e){return typeof e=="string"?{colorSchemeName:e}:e?{customColorScheme:KQ(e)}:{}}function b7e(e=[]){let t=[...new Set(e)].sort((r,n)=>r-n),o=[];for(let r of t){let n=o.at(-1);n?.end===r-1?n.end=r:o.push({start:r,end:r})}return o}function GV({highlights:e=[],highlightColumns:t}){return[...e,...b7e(t)]}function HV(e){return e?{uri:e,locationType:"UriLocation"}:void 0}function VV({msaFilehandle:e,treeFilehandle:t,gffFilehandle:o,msaUrl:r,treeUrl:n,gffUrl:i}){return{msaFilehandle:e??HV(r),treeFilehandle:t??HV(n),gffFilehandle:o??HV(i)}}function nTe(e){return Ww(e==="dark"?{palette:{mode:"dark"}}:typeof e=="object"?e:void 0)}function iTe(e){let{msa:t,tree:o,gff:r,rowData:n,colorScheme:i,height:s,colWidth:a,rowHeight:l,allowedGappyness:c,highlightColumns:u,highlights:f,features:p,selection:d,clades:m,relativeTo:y,columnTracks:b,residueMappings:h,encodings:g,rowPanels:C,drawTree:x,treeAreaWidth:E,showBranchLen:I,treeOrder:T,treeRoot:S,region:B,residueEncoding:R}=e,{msaFilehandle:M,treeFilehandle:Q,gffFilehandle:v}=VV(e);return{type:"MsaView",...t||o||r||n?{data:{msa:t??"",tree:o??"",gff:r,...n?{treeMetadata:JSON.stringify(n)}:{}}}:{},...M?{msaFilehandle:M}:{},...Q?{treeFilehandle:Q}:{},...v?{gffFilehandle:v}:{},...y7e(i),...s?{height:s}:{},...a?{colWidth:a}:{},...l?{rowHeight:l}:{},...c!==void 0?{allowedGappyness:c}:{},...f||u?{highlights:GV({highlights:f,highlightColumns:u})}:{},...p?{features:p}:{},...d?{selection:d}:{},...m?{clades:m}:{},...y?{relativeTo:y}:{},...b?{columnTracks:b}:{},...h?{residueMappings:h}:{},...g?{encodings:g}:{},...C?{rowPanels:C}:{},...x!==void 0?{drawTree:x}:{},...E?{treeAreaWidth:E}:{},...I!==void 0?{showBranchLen:I}:{},...T?{treeOrder:T}:{},...S?{treeRoot:S}:{},...B?{region:B}:{},...R!==void 0?{bgColor:R==="fill"}:{}}}function C7e(e,t){return e.msa===t.msa&&e.tree===t.tree&&JSON.stringify([e.msaFilehandle,e.treeFilehandle])===JSON.stringify([t.msaFilehandle,t.treeFilehandle])}var x7e=(0,Uo.forwardRef)(function(t,o){let r={...t,...VV(t)},{msa:n,tree:i,msaFilehandle:s,treeFilehandle:a}=r,l={msa:n,tree:i,msaFilehandle:s,treeFilehandle:a},[c,u]=(0,Uo.useState)({source:l,generation:0});return C7e(c.source,l)||u({source:l,generation:c.generation+1}),Uo.default.createElement(E7e,{key:c.generation,modelRef:o,...r})}),$V=x7e;function tP(e,t,o){let r=(0,Uo.useRef)(o);(0,Uo.useEffect)(()=>{r.current=o});let n=!!o;(0,Uo.useEffect)(()=>n?yg(()=>e[t],i=>{r.current?.(i)},{equals:hg}):void 0,[e,t,n])}function nr(e,t,{inSnapshot:o=!1}={}){return{read:e,apply:t,inSnapshot:o}}function Bf(e){return(t,o)=>{o!==void 0&&e(t,o)}}var jV=[nr(e=>e.height,Bf((e,t)=>{e.setHeight(t)})),nr(e=>e.colWidth,Bf((e,t)=>{e.setColWidth(t)})),nr(e=>e.rowHeight,Bf((e,t)=>{e.setRowHeight(t)})),nr(e=>e.allowedGappyness,Bf((e,t)=>{e.setAllowedGappyness(t)})),nr(e=>e.drawTree,Bf((e,t)=>{e.setDrawTree(t)})),nr(e=>e.treeAreaWidth,Bf((e,t)=>{e.setTreeAreaWidth(t)})),nr(e=>e.showBranchLen,Bf((e,t)=>{e.setShowBranchLen(t)})),nr(e=>e.treeOrder,Bf((e,t)=>{e.setTreeOrder(t)})),nr(e=>e.residueEncoding,Bf((e,t)=>{e.setBgColor(t==="fill")})),nr(e=>!!e.hideHeader,(e,t)=>{e.setHideHeader(t)}),nr(e=>e.relativeTo,(e,t)=>{e.drawRelativeTo(t)}),nr(e=>e.gffFilehandle,(e,t,{gff:o})=>{t?e.setGFFFilehandle(t):e.setGFF(o)},{inSnapshot:!0}),nr(e=>e.gff,(e,t)=>{e.setGFF(t)},{inSnapshot:!0}),nr(e=>e.colorScheme,(e,t)=>{typeof t=="string"?e.setColorSchemeName(t):t&&e.setCustomColorScheme(KQ(t))}),nr(GV,(e,t)=>{e.setHighlights(t)}),nr(e=>e.features??[],(e,t)=>{e.setFeatures(t)}),nr(e=>e.selection,(e,t)=>{e.setSelection(t)}),nr(e=>e.treeRoot,(e,t)=>{e.setTreeRoot(t)}),nr(e=>e.clades??[],(e,t)=>{e.setClades(t)}),nr(e=>e.columnTracks??[],(e,t)=>{e.setColumnTracks(t)}),nr(e=>e.residueMappings??[],(e,t)=>{e.setResidueMappings(t)}),nr(e=>e.rowData,(e,t)=>{t&&Object.keys(t).length&&e.setRowData(t)}),nr(e=>e.encodings??[],(e,t)=>{e.setEncodings(t)}),nr(e=>e.rowPanels??[],(e,t)=>{e.setRowPanels(t)})];function v7e(e,t){let o=(0,Uo.useRef)(void 0);(0,Uo.useEffect)(()=>{let r=jV.map(({read:i})=>JSON.stringify(i(t)??null));o.current??=jV.map(({inSnapshot:i},s)=>i?r[s]:"");let n=o.current;jV.forEach(({apply:i},s)=>{let a=r[s];n[s]!==a&&(n[s]=a,i(e,JSON.parse(a)??void 0,t))})})}function E7e({modelRef:e,...t}){let{region:o,theme:r,onCellHover:n,onCellClick:i,onViewportChange:s,onSelectionChange:a,onModel:l}=t,[c]=(0,Uo.useState)(()=>{let y=eP().create(iTe(t));return y.setImportForm(!1),y}),u=(0,Uo.useRef)(void 0),[f,{width:p}]=Zx();(0,Uo.useEffect)(()=>{p&&c.setWidth(p)},[c,p]),v7e(c,t);let d=JSON.stringify(o??null);(0,Uo.useEffect)(()=>{let y=JSON.parse(d);return y?ru(()=>c.viewInitialized&&c.numColumns>0,()=>{c.revealRegion(y)}):void 0},[c,d]),tP(c,"hoveredCell",n),tP(c,"clickedCell",i),tP(c,"viewport",s),tP(c,"selection",a),(0,Uo.useImperativeHandle)(e,()=>c,[c]);let m=(0,Uo.useRef)(l);return(0,Uo.useEffect)(()=>{m.current=l}),(0,Uo.useEffect)(()=>{m.current?.(c)},[c]),(0,Uo.useEffect)(()=>(u.current!==void 0&&(clearTimeout(u.current),u.current=void 0),()=>{u.current=setTimeout(()=>{u.current=void 0,cl(c)&&eI(c)})}),[c]),Uo.default.createElement(gh,{theme:nTe(r)},Uo.default.createElement("div",{ref:f},Uo.default.createElement(lM,{model:c})))}function oP(e,t){let o=(0,sTe.createRoot)(e),r=t;return o.render(YV.default.createElement($V,{...r})),{update(n){r={...r,...n},o.render(YV.default.createElement($V,{...r}))},destroy(){o.unmount()}}}al();Or();var T7e=["msa","tree","gff","features","colorScheme","highlights","columnTracks","residueMappings"],I7e=["msa-url","tree-url","gff-url","color-scheme","height","hide-header","theme","reference-row","tree-area-width","loading"],w7e="200px",S7e=["display-start","display-end","highlight"];function Rd(e){let t=e?Number(e):Number.NaN;return Number.isFinite(t)?t:void 0}function B7e(e,t){return(e??"").split(",").flatMap(o=>{let[r,n]=o.split(":").map(Rd);return r===void 0?[]:[{row:t,start:r,end:n??r}]})}function WV(e,t,o){let r=e.globalColToVisibleCol(o-1);return r===void 0?void 0:e.visibleColToSeqPosOneBased(t,r)}function _7e(e,t,o){let r,n;for(let i=o.startColumn;i<=o.endColumn&&!r;i++)r=WV(e,t,i);for(let i=o.endColumn;i>=o.startColumn&&!n;i--)n=WV(e,t,i);return r&&n?{start:r,end:n}:void 0}function aTe(e="jbrowse-msa"){let t=customElements.get(e);if(t)return t;class o extends HTMLElement{static observedAttributes=[...I7e,...S7e];#r;#t;#e;#n;#a;#l=!1;#f;#o={};static{for(let n of T7e)Object.defineProperty(o.prototype,n,{configurable:!0,get(){return this.#o[n]},set(i){this.#p({[n]:i})}})}get selection(){return this.#e?this.#e.selection:this.#o.selection}set selection(n){this.#p({selection:n})}get#i(){return this.getAttribute("reference-row")??void 0}#p(n){this.#o={...this.#o,...n},this.#r?.update(this.#c())}#c(){let n=this.getAttribute("theme");return{...this.#o,msaUrl:this.getAttribute("msa-url")??void 0,treeUrl:this.getAttribute("tree-url")??void 0,gffUrl:this.getAttribute("gff-url")??void 0,colorScheme:this.#o.colorScheme??this.getAttribute("color-scheme")??void 0,height:Rd(this.getAttribute("height")),treeAreaWidth:Rd(this.getAttribute("tree-area-width")),hideHeader:this.hasAttribute("hide-header"),theme:n==="dark"?"dark":"light",onCellHover:i=>{this.#s("cell-hover",i),this.#h(i)},onCellClick:i=>{this.#s("cell-click",i)},onViewportChange:i=>{this.#s("viewport-change",i),this.#y(i)},onSelectionChange:i=>{this.#s("selection-change",i)},onModel:i=>{this.#e=i,this.#A(),this.#m()}}}#s(n,i){this.dispatchEvent(new CustomEvent(n,{detail:i}))}#d(n){this.#n&&this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,cancelable:!0}))}#h(n){let i=this.#e,s=this.#i,a=n&&i&&s?WV(i,s,n.column):n?.column;this.#d({type:"highlight",value:a===void 0?null:`${a}:${a}`})}#y(n){let i=this.#e,s=this.#i;if(!n||!i)return;let a=s?_7e(i,s,n):{start:n.startColumn,end:n.endColumn},l=Rd(this.getAttribute("display-start")),c=Rd(this.getAttribute("display-end")),u=a&&l!==void 0&&c!==void 0&&Math.abs(a.start-l)<=1&&Math.abs(a.end-c)<=1;a&&!u&&(this.#f=a,this.#d({"display-start":a.start,"display-end":a.end}))}#A(){let n=this.#e,i=Rd(this.getAttribute("display-start")),s=Rd(this.getAttribute("display-end")),a=this.#f;if(!(a&&a.start===i&&a.end===s)&&(this.#a?.(),n&&i!==void 0&&s!==void 0)){let l=this.#i;this.#a=ru(()=>n.viewInitialized&&n.numColumns>0,()=>{n.zoomToRegion({row:l,start:i,end:s})})}}#m(){let n=B7e(this.getAttribute("highlight"),this.#i);n.length?this.#e?.applyHighlight("nightingale",n):this.#e?.clearHighlight("nightingale")}connectedCallback(){if(this.style.display||(this.style.display="block"),this.#g){let i=Rd(this.getAttribute("height"))??550;this.style.minHeight=`${i+5}px`,this.#t=new IntersectionObserver(s=>{s.some(a=>a.isIntersecting)&&this.#u()},{rootMargin:w7e}),this.#t.observe(this)}else this.#u();let n=this.closest("nightingale-manager");n&&customElements.whenDefined("nightingale-manager").then(()=>{this.isConnected&&(this.#n=n,n.register(this))})}get#g(){return this.getAttribute("loading")==="lazy"&&typeof IntersectionObserver<"u"}#u(){this.#t?.disconnect(),this.#t=void 0,this.#r??=oP(this,this.#c())}disconnectedCallback(){this.#t?.disconnect(),this.#t=void 0,this.#n?.unregister(this),this.#n=void 0,this.#a?.(),this.#r?.destroy(),this.#r=void 0,this.#e=void 0}attributeChangedCallback(n){n==="display-start"||n==="display-end"?this.#l||(this.#l=!0,queueMicrotask(()=>{this.#l=!1,this.#A()})):n==="highlight"?this.#m():n==="loading"?this.#t&&!this.#g&&this.#u():this.#r?.update(this.#c())}}return customElements.define(e,o),o}eu(Jc,w(YQ(),1));return yTe(Jc);})();
651
651
  /*! Bundled license information:
652
652
 
653
653
  react/cjs/react.production.js: