chrono-phylo-tree 1.1.8 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ (function(vt,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],U):(vt=typeof globalThis<"u"?globalThis:vt||self,U(vt["chrono-phylo-tree"]={},vt.React))})(this,function(vt,U){"use strict";const Lt=(s,...r)=>s.sort((u,a)=>{for(const d of r){const[f,h]=[u,a].map(b=>d(b));if(f!==h)return f-h}return 0});class xt{constructor(r="",u=0,a=0,d=void 0,f=[],h=void 0,b=void 0){if(this.name="",this.apparition=0,this.duration=0,this.ancestor=void 0,this.descendants=[],this.description=void 0,this.display=!0,this.image=void 0,a<=0)throw new Error("The duration of the species must be greater than 0");this.name=r,this.apparition=u,this.duration=a,this.ancestor=d,this.descendants=f,this.description=h===""?void 0:h,this.image=b===""?void 0:b}onPosition(r=!0){return r&&this.firstAncestor().stepsUntil(this)%2===0}copy(){const r=this.firstAncestor(),u=r.allDescendants(!1).indexOf(this);return xt.fromJSON(r.toJSON()).allDescendants(!1)[u]}unlinkAncestor(){if(!this.ancestor)return;this.ancestor.descendants=this.ancestor.descendants.filter(u=>u!==this);const r=this.ancestor;return this.ancestor=void 0,[r.firstAncestor(),this]}unlinkDescendant(r){if(this.descendants.includes(r))return this.descendants=this.descendants.filter(u=>u!==r),r.ancestor=void 0,[this.firstAncestor(),r]}linkAncestor(r){if(!(this.ancestor===r&&r.descendants.includes(this))){if(r.apparition>this.apparition)throw new Error(`The ancestor's apparition (${r.apparition}) must be before or equal the descendant's apparition (${this.apparition})`);if(r.extinction()<this.apparition)throw new Error(`The ancestor's extinction (${r.extinction()}) must be after or equal the descendant's apparition (${this.apparition})`);this.ancestor!==r&&this.unlinkAncestor(),this.ancestor=r,r.descendants.push(this)}}linkDescendant(r){if(!(r.ancestor===this&&this.descendants.includes(r))){if(r.apparition<this.apparition)throw new Error(`The descendant's apparition (${r.apparition}) must be after or equal the ancestor's apparition (${this.apparition})`);if(r.extinction()>this.extinction())throw new Error(`The descendant's extinction (${r.extinction()}) must be before or equal the ancestor's extinction (${this.extinction()})`);this.descendants.includes(r)||(r.ancestor&&r.unlinkAncestor(),this.descendants.push(r),r.ancestor=this)}}linkDescendants(r){for(const u of r)try{this.linkDescendant(u)}catch(a){console.error(`Error linking descendant ${u.name} to ancestor ${this.name}:`,a)}}addDescendant(r="",u=0,a=0,d=void 0,f=void 0,h=!1){if(u<0||u>this.duration)throw new Error(`The apparition of the descendant must be between the apparition (${this.apparition}) and the extinction (${this.extinction()}) of the ancestor`);const b=h?this.copy():this,j=new xt(r,b.apparition+Math.max(u,0),Math.max(a,0),void 0,[],d,f);return j.linkAncestor(b),h?b:j}removeDescendant(r){this.descendants=this.descendants.filter(u=>u!==r)}addAncestor(r="",u=0,a=0,d=void 0,f=void 0,h=!0,b=!1){if(u<0)throw new Error(`The apparition of the ancestor must be before or equal the apparition (${this.apparition}) of the descendant`);if(a<u)throw new Error(`The extiction of the ancestor must be after or equal the apparition (${this.apparition}) of the descendant`);const j=b?this.copy():this,o=new xt(r,j.apparition-Math.max(u,0),a,void 0,[],d,f);return o.display=h,j.linkAncestor(o),b?j:o}extinction(){return this.apparition+this.duration}absoluteExtinction(){return this.descendants.length>0?Math.max(...this.allDescendants(!1).map(r=>r.extinction())):this.extinction()}absoluteDuration(){return this.absoluteExtinction()-this.apparition}firstAncestor(r=!1){return this.ancestor?this.ancestor.display||r?this.ancestor.firstAncestor():this:this}cousinsExtinction(){return this.firstAncestor().absoluteExtinction()}allDescendants(r=!0){const u=r?Lt(this.descendants,o=>-o.apparition,o=>-o.absoluteExtinction()):this.descendants;if(u.length===0)return[this];const a=u.filter(o=>o.apparition>=this.extinction()),d=u.filter(o=>a.indexOf(o)===-1),h=(this.onPosition(r)?Math.ceil:Math.floor)(a.length/2),b=a.slice(0,h),j=a.slice(h);return b.flatMap(o=>o.allDescendants(r)).concat([this]).concat(j.flatMap(o=>o.allDescendants(r))).concat(d.flatMap(o=>o.allDescendants(r)))}stepsChain(r,u=!1){var a;return this.allDescendants(!1).includes(r)?[this].concat(((a=this.descendants.find(d=>d.allDescendants(!1).includes(r)))==null?void 0:a.stepsChain(r))??[]).filter(d=>d.display||u):[]}stepsUntil(r,u=!1){if(this.allDescendants(!1).includes(r))return this.stepsChain(r,u).length-1}stepsUntilLastDescendant(r=!1){return this.descendants.length===0?0:Math.max(...this.allDescendants(!1).filter(u=>u.descendants.length===0).map(u=>this.stepsUntil(u,r)??0))}toJSON(){return{name:this.name,apparition:this.ancestor?void 0:this.apparition,afterApparition:this.ancestor?this.apparition-this.ancestor.apparition:void 0,description:this.description,duration:this.duration,descendants:this.descendants.length>0?this.descendants.map(r=>r.toJSON()):void 0,image:this.image}}async saveJSON(r=void 0){try{const u=JSON.stringify(this.toJSON(),null,2),a=new Blob([u],{type:"application/json"}),d=URL.createObjectURL(a),f=document.createElement("a");f.href=d,f.download=r??`${this.name}.json`,f.click(),URL.revokeObjectURL(d)}catch(u){console.error("Error saving file:",u)}}static fromJSON(r,u){const a=r.afterApparition??0,d=u?u.apparition:r.apparition??0,f=new xt(r.name??"",d+a,r.duration??0,u,[],r.description,r.image);if(r.descendants)for(const h of r.descendants)f.descendants.push(xt.fromJSON(h,f));return f}}function It(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var jt={exports:{}},wt={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Tt;function Ft(){if(Tt)return wt;Tt=1;var s=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function u(a,d,f){var h=null;if(f!==void 0&&(h=""+f),d.key!==void 0&&(h=""+d.key),"key"in d){f={};for(var b in d)b!=="key"&&(f[b]=d[b])}else f=d;return d=f.ref,{$$typeof:s,type:a,key:h,ref:d!==void 0?d:null,props:f}}return wt.Fragment=r,wt.jsx=u,wt.jsxs=u,wt}var kt={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Ct;function Ut(){return Ct||(Ct=1,process.env.NODE_ENV!=="production"&&function(){function s(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case $:return"Fragment";case ot:return"Portal";case e:return"Profiler";case y:return"StrictMode";case g:return"Suspense";case T:return"SuspenseList"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case i:return(t.displayName||"Context")+".Provider";case n:return(t._context.displayName||"Context")+".Consumer";case p:var l=t.render;return t=t.displayName,t||(t=l.displayName||l.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case X:return l=t.displayName||null,l!==null?l:s(t.type)||"Memo";case lt:l=t._payload,t=t._init;try{return s(t(l))}catch{}}return null}function r(t){return""+t}function u(t){try{r(t);var l=!1}catch{l=!0}if(l){l=console;var m=l.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return m.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",w),r(t)}}function a(){}function d(){if(q===0){Q=console.log,et=console.info,dt=console.warn,D=console.error,I=console.group,V=console.groupCollapsed,k=console.groupEnd;var t={configurable:!0,enumerable:!0,value:a,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}q++}function f(){if(q--,q===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},t,{value:Q}),info:E({},t,{value:et}),warn:E({},t,{value:dt}),error:E({},t,{value:D}),group:E({},t,{value:I}),groupCollapsed:E({},t,{value:V}),groupEnd:E({},t,{value:k})})}0>q&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function h(t){if(H===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);H=l&&l[1]||"",tt=-1<m.stack.indexOf(`
18
+ at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
19
+ `+H+t+tt}function b(t,l){if(!t||W)return"";var m=Y.get(t);if(m!==void 0)return m;W=!0,m=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var w=null;w=x.H,x.H=null,d();try{var B={DetermineComponentFrameRoot:function(){try{if(l){var mt=function(){throw Error()};if(Object.defineProperty(mt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(mt,[])}catch(yt){var Et=yt}Reflect.construct(t,[],mt)}else{try{mt.call()}catch(yt){Et=yt}t.call(mt.prototype)}}else{try{throw Error()}catch(yt){Et=yt}(mt=t())&&typeof mt.catch=="function"&&mt.catch(function(){})}}catch(yt){if(yt&&Et&&typeof yt.stack=="string")return[yt.stack,Et.stack]}return[null,null]}};B.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var O=Object.getOwnPropertyDescriptor(B.DetermineComponentFrameRoot,"name");O&&O.configurable&&Object.defineProperty(B.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=B.DetermineComponentFrameRoot(),it=_[0],bt=_[1];if(it&&bt){var at=it.split(`
20
+ `),gt=bt.split(`
21
+ `);for(_=O=0;O<at.length&&!at[O].includes("DetermineComponentFrameRoot");)O++;for(;_<gt.length&&!gt[_].includes("DetermineComponentFrameRoot");)_++;if(O===at.length||_===gt.length)for(O=at.length-1,_=gt.length-1;1<=O&&0<=_&&at[O]!==gt[_];)_--;for(;1<=O&&0<=_;O--,_--)if(at[O]!==gt[_]){if(O!==1||_!==1)do if(O--,_--,0>_||at[O]!==gt[_]){var ct=`
22
+ `+at[O].replace(" at new "," at ");return t.displayName&&ct.includes("<anonymous>")&&(ct=ct.replace("<anonymous>",t.displayName)),typeof t=="function"&&Y.set(t,ct),ct}while(1<=O&&0<=_);break}}}finally{W=!1,x.H=w,f(),Error.prepareStackTrace=m}return at=(at=t?t.displayName||t.name:"")?h(at):"",typeof t=="function"&&Y.set(t,at),at}function j(t){if(t==null)return"";if(typeof t=="function"){var l=t.prototype;return b(t,!(!l||!l.isReactComponent))}if(typeof t=="string")return h(t);switch(t){case g:return h("Suspense");case T:return h("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case p:return t=b(t.render,!1),t;case X:return j(t.type);case lt:l=t._payload,t=t._init;try{return j(t(l))}catch{}}return""}function o(){var t=x.A;return t===null?null:t.getOwner()}function S(t){if(rt.call(t,"key")){var l=Object.getOwnPropertyDescriptor(t,"key").get;if(l&&l.isReactWarning)return!1}return t.key!==void 0}function A(t,l){function m(){pt||(pt=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}m.isReactWarning=!0,Object.defineProperty(t,"key",{get:m,configurable:!0})}function L(){var t=s(this.type);return R[t]||(R[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function z(t,l,m,w,B,O){return m=O.ref,t={$$typeof:ut,type:t,key:l,props:O,_owner:B},(m!==void 0?m:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:L}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function P(t,l,m,w,B,O){if(typeof t=="string"||typeof t=="function"||t===$||t===e||t===y||t===g||t===T||t===ht||typeof t=="object"&&t!==null&&(t.$$typeof===lt||t.$$typeof===X||t.$$typeof===i||t.$$typeof===n||t.$$typeof===p||t.$$typeof===N||t.getModuleId!==void 0)){var _=l.children;if(_!==void 0)if(w)if(v(_)){for(w=0;w<_.length;w++)J(_[w],t);Object.freeze&&Object.freeze(_)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else J(_,t)}else _="",(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),t===null?w="null":v(t)?w="array":t!==void 0&&t.$$typeof===ut?(w="<"+(s(t.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):w=typeof t,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",w,_);if(rt.call(l,"key")){_=s(t);var it=Object.keys(l).filter(function(at){return at!=="key"});w=0<it.length?"{key: someKey, "+it.join(": ..., ")+": ...}":"{key: someKey}",K[_+w]||(it=0<it.length?"{"+it.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
23
+ let props = %s;
24
+ <%s {...props} />
25
+ React keys must be passed directly to JSX without using spread:
26
+ let props = %s;
27
+ <%s key={someKey} {...props} />`,w,_,it,_),K[_+w]=!0)}if(_=null,m!==void 0&&(u(m),_=""+m),S(l)&&(u(l.key),_=""+l.key),"key"in l){m={};for(var bt in l)bt!=="key"&&(m[bt]=l[bt])}else m=l;return _&&A(m,typeof t=="function"?t.displayName||t.name||"Unknown":t),z(t,_,O,B,o(),m)}function J(t,l){if(typeof t=="object"&&t&&t.$$typeof!==M){if(v(t))for(var m=0;m<t.length;m++){var w=t[m];F(w)&&Z(w,l)}else if(F(t))t._store&&(t._store.validated=1);else if(t===null||typeof t!="object"?m=null:(m=C&&t[C]||t["@@iterator"],m=typeof m=="function"?m:null),typeof m=="function"&&m!==t.entries&&(m=m.call(t),m!==t))for(;!(t=m.next()).done;)F(t.value)&&Z(t.value,l)}}function F(t){return typeof t=="object"&&t!==null&&t.$$typeof===ut}function Z(t,l){if(t._store&&!t._store.validated&&t.key==null&&(t._store.validated=1,l=st(l),!_t[l])){_t[l]=!0;var m="";t&&t._owner!=null&&t._owner!==o()&&(m=null,typeof t._owner.tag=="number"?m=s(t._owner.type):typeof t._owner.name=="string"&&(m=t._owner.name),m=" It was passed a child from "+m+".");var w=x.getCurrentStack;x.getCurrentStack=function(){var B=j(t.type);return w&&(B+=w()||""),B},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',l,m),x.getCurrentStack=w}}function st(t){var l="",m=o();return m&&(m=s(m.type))&&(l=`
28
+
29
+ Check the render method of \``+m+"`."),l||(t=s(t))&&(l=`
30
+
31
+ Check the top-level render call using <`+t+">."),l}var nt=U,ut=Symbol.for("react.transitional.element"),ot=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),e=Symbol.for("react.profiler"),n=Symbol.for("react.consumer"),i=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),lt=Symbol.for("react.lazy"),ht=Symbol.for("react.offscreen"),C=Symbol.iterator,G=Symbol.for("react.client.reference"),x=nt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,rt=Object.prototype.hasOwnProperty,E=Object.assign,N=Symbol.for("react.client.reference"),v=Array.isArray,q=0,Q,et,dt,D,I,V,k;a.__reactDisabledLog=!0;var H,tt,W=!1,Y=new(typeof WeakMap=="function"?WeakMap:Map),M=Symbol.for("react.client.reference"),pt,R={},K={},_t={};kt.Fragment=$,kt.jsx=function(t,l,m,w,B){return P(t,l,m,!1,w,B)},kt.jsxs=function(t,l,m,w,B){return P(t,l,m,!0,w,B)}}()),kt}var At;function zt(){return At||(At=1,process.env.NODE_ENV==="production"?jt.exports=Ft():jt.exports=Ut()),jt.exports}var c=zt();const Wt=({speciesList:s,width:r=1e3,height:u=50,padding:a=0,stroke:d="grey",format:f=A=>A.toString(),chronoScale:h=!0,showImages:b=!0,presentTime:j,handleMouseMove:o,children:S})=>{const A=s.map(J=>J.copy()),L=Math.min(...A.map(J=>J.apparition)),z=Math.max(...A.map(J=>J.apparition-L)),P=new xt("",L,z,void 0,[]);return P.display=!1,P.linkDescendants(A),c.jsx(Dt,{commonAncestor:P,width:r,height:u,padding:a,stroke:d,format:f,chronoScale:h,showImages:b,presentTime:j,handleMouseMove:o,children:(J,F,Z,st)=>S==null?void 0:S(J,F,Z,st)})},Dt=({commonAncestor:s,width:r=1e3,height:u=50,padding:a=0,stroke:d="grey",format:f=A=>A.toString(),chronoScale:h=!0,showImages:b=!0,presentTime:j,handleMouseMove:o,children:S})=>{const[A,L]=U.useState(!1),[z,P]=U.useState(void 0),[J,F]=U.useState(void 0),[Z,st]=U.useState(s.allDescendants().reduce((e,n)=>e.set(n,!0),new Map));U.useEffect(()=>{st(s.allDescendants().reduce((e,n)=>e.set(n,!0),new Map))},[s]);const nt=e=>{P(A?void 0:e),L(!A)},ut=e=>{const n=new Map(Z);n.set(e,!Z.get(e)),st(n)},ot=e=>{F(e)},$=j!==void 0&&h,y=e=>b?e.map(n=>n.image?2:1).reduce((n,i)=>n+i):e.length;return c.jsxs(c.Fragment,{children:[c.jsx("svg",{width:r*($?(Math.min(j,s.absoluteExtinction())-s.apparition)/s.absoluteDuration():1),height:u*y($?s.allDescendants().filter(e=>e.apparition<j):s.allDescendants()),onMouseMove:e=>{o==null||o(e.clientX,e.clientY)},children:c.jsx(Nt,{commonAncestor:s,species:s,y:-1,scaleX:r/(h?s.absoluteDuration():Math.max(0,s.stepsUntilLastDescendant())+1),scaleY:u,padding:a,stroke:d,format:f,chronoScale:h,showImages:b,presentTime:j,toggleShowMenu:nt,hoverShowMenu:ot,showDesc:Z,changeShowDesc:ut})}),S==null?void 0:S(z,A,nt,J)]})},Nt=({commonAncestor:s,species:r,y:u,scaleX:a,scaleY:d,padding:f=0,stroke:h="grey",format:b=J=>J.toString(),chronoScale:j=!0,showImages:o=!0,presentTime:S=void 0,toggleShowMenu:A,hoverShowMenu:L,showDesc:z,changeShowDesc:P})=>{const J=S!==void 0&&j,F=s.allDescendants().filter(y=>J?y.apparition<S:!0),Z=F.indexOf(r),st=(j?r.apparition-s.apparition:s.stepsUntil(r)??0)*a,nt=st+(j?Math.min(z.get(r)?r.duration:r.absoluteDuration(),J?S-r.apparition:r.absoluteDuration()):1)*a,ut=o&&Z>0?[...Array(Z).keys()].map(y=>F[y]).map(y=>(y.image?2:1)*d).reduce((y,e)=>y+e):Z*d,ot=r.descendants.filter(y=>J?y.apparition<S:!0),$=ot.length>0?st+(Math.min(...ot.map(y=>y.apparition))-r.apparition)*a:nt;return c.jsxs("g",{children:[u>=0&&c.jsx("line",{x1:st,y1:u,x2:st,y2:ut,stroke:h}),r.display&&c.jsx(Yt,{commonAncestor:s,species:r,height:d,x1:st,x2:nt,x0:$,y:ut,stroke:h,changeShowDesc:()=>P(r),showDesc:z.get(r),padding:f,format:b,chronoScale:j,showImages:o,presentTime:S,toggleShowMenu:A,hoverShowMenu:L}),r.descendants.map((y,e)=>c.jsx("g",{className:z.get(r)&&ot.includes(y)?"block":"hidden",children:c.jsx(Nt,{commonAncestor:s,species:y,y:y.display?ut:-1,scaleX:a,scaleY:d,padding:f,stroke:h,format:b,chronoScale:j,showImages:o,presentTime:S,toggleShowMenu:A,showDesc:z,changeShowDesc:P,hoverShowMenu:L})},F.length+e))]},Z)},Yt=({commonAncestor:s,species:r,height:u,x1:a,x2:d,x0:f,y:h,stroke:b,showDesc:j=!0,changeShowDesc:o=()=>{},padding:S=0,format:A=nt=>nt.toString(),chronoScale:L=!0,showImages:z=!0,presentTime:P,toggleShowMenu:J,hoverShowMenu:F,className:Z,buttonClassName:st})=>{const nt=P!==void 0,ut=s.allDescendants().filter(i=>nt?i.apparition<P:!0),ot=i=>ut.indexOf(i),$=r.ancestor&&ot(r)>ot(r.ancestor)?-3:1,y=r.descendants.filter(i=>nt?i.apparition<P:!0),e=y.filter(i=>i.apparition===r.extinction()).length===0,n=A(Math.min(j?r.extinction():r.absoluteExtinction(),nt?P:r.absoluteExtinction()));return c.jsxs("g",{children:[c.jsx("line",{x1:a,y1:h,x2:d,y2:h,stroke:b}),c.jsx("foreignObject",{x:a+S,y:h+S*$,width:(L?f??d:d)-a-2*S,height:u+(z&&r.image?u:0),children:c.jsxs("div",{className:`flex flex-row justify-between w-full ${Z??""}`,children:[c.jsx("div",{children:L?A(r.apparition):""}),c.jsxs("button",{className:`p-0.625 justify-center flex flex-col items-center ${st??""}`,onClick:()=>J(r),onMouseEnter:()=>F(r),onMouseLeave:()=>F(void 0),children:[r.name,r.image&&z&&c.jsx("img",{src:r.image,alt:r.name,style:{height:u}})]}),y.length>0?c.jsx("button",{onClick:o,className:"h-1",style:{maxWidth:4},children:(e||!j)&&(!f||f===d)?n:""}):c.jsx("div",{children:L?n:""})]})}),L&&f&&f<d&&c.jsx("foreignObject",{x:f+S,y:h+S*$,width:d-f-2*S,height:u,children:c.jsx("div",{className:"flex flex-row justify-end w-full",children:(e||!j)&&L?n:""})})]})},Jt=(s,r,u)=>s<r?r:s>u?u:s;var St={exports:{}};/* @license
32
+ Papa Parse
33
+ v5.5.2
34
+ https://github.com/mholt/PapaParse
35
+ License: MIT
36
+ */var Bt=St.exports,Mt;function Ht(){return Mt||(Mt=1,function(s,r){((u,a)=>{s.exports=a()})(Bt,function u(){var a=typeof self<"u"?self:typeof window<"u"?window:a!==void 0?a:{},d,f=!a.document&&!!a.postMessage,h=a.IS_PAPA_WORKER||!1,b={},j=0,o={};function S(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(n){var i=ot(n);i.chunkSize=parseInt(i.chunkSize),n.step||n.chunk||(i.chunkSize=null),this._handle=new J(i),(this._handle.streamer=this)._config=i}).call(this,e),this.parseChunk=function(n,i){var p=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<p){let T=this._config.newline;T||(g=this._config.quoteChar||'"',T=this._handle.guessLineEndings(n,g)),n=[...n.split(T).slice(p)].join(T)}this.isFirstChunk&&y(this._config.beforeFirstChunk)&&(g=this._config.beforeFirstChunk(n))!==void 0&&(n=g),this.isFirstChunk=!1,this._halted=!1;var p=this._partialLine+n,g=(this._partialLine="",this._handle.parse(p,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(n=g.meta.cursor,p=(this._finished||(this._partialLine=p.substring(n-this._baseIndex),this._baseIndex=n),g&&g.data&&(this._rowCount+=g.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),h)a.postMessage({results:g,workerId:o.WORKER_ID,finished:p});else if(y(this._config.chunk)&&!i){if(this._config.chunk(g,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=g=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(g.data),this._completeResults.errors=this._completeResults.errors.concat(g.errors),this._completeResults.meta=g.meta),this._completed||!p||!y(this._config.complete)||g&&g.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),p||g&&g.meta.paused||this._nextChunk(),g}this._halted=!0},this._sendError=function(n){y(this._config.error)?this._config.error(n):h&&this._config.error&&a.postMessage({workerId:o.WORKER_ID,error:n,finished:!1})}}function A(e){var n;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),S.call(this,e),this._nextChunk=f?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(i){this._input=i,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),f||(n.onload=$(this._chunkLoaded,this),n.onerror=$(this._chunkError,this)),n.open(this._config.downloadRequestBody?"POST":"GET",this._input,!f),this._config.downloadRequestHeaders){var i,p=this._config.downloadRequestHeaders;for(i in p)n.setRequestHeader(i,p[i])}var g;this._config.chunkSize&&(g=this._start+this._config.chunkSize-1,n.setRequestHeader("Range","bytes="+this._start+"-"+g));try{n.send(this._config.downloadRequestBody)}catch(T){this._chunkError(T.message)}f&&n.status===0&&this._chunkError()}},this._chunkLoaded=function(){n.readyState===4&&(n.status<200||400<=n.status?this._chunkError():(this._start+=this._config.chunkSize||n.responseText.length,this._finished=!this._config.chunkSize||this._start>=(i=>(i=i.getResponseHeader("Content-Range"))!==null?parseInt(i.substring(i.lastIndexOf("/")+1)):-1)(n),this.parseChunk(n.responseText)))},this._chunkError=function(i){i=n.statusText||i,this._sendError(new Error(i))}}function L(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),S.call(this,e);var n,i,p=typeof FileReader<"u";this.stream=function(g){this._input=g,i=g.slice||g.webkitSlice||g.mozSlice,p?((n=new FileReader).onload=$(this._chunkLoaded,this),n.onerror=$(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var g=this._input,T=(this._config.chunkSize&&(T=Math.min(this._start+this._config.chunkSize,this._input.size),g=i.call(g,this._start,T)),n.readAsText(g,this._config.encoding));p||this._chunkLoaded({target:{result:T}})},this._chunkLoaded=function(g){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(g.target.result)},this._chunkError=function(){this._sendError(n.error)}}function z(e){var n;S.call(this,e=e||{}),this.stream=function(i){return n=i,this._nextChunk()},this._nextChunk=function(){var i,p;if(!this._finished)return i=this._config.chunkSize,n=i?(p=n.substring(0,i),n.substring(i)):(p=n,""),this._finished=!n,this.parseChunk(p)}}function P(e){S.call(this,e=e||{});var n=[],i=!0,p=!1;this.pause=function(){S.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){S.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(g){this._input=g,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){p&&n.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),n.length?this.parseChunk(n.shift()):i=!0},this._streamData=$(function(g){try{n.push(typeof g=="string"?g:g.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(n.shift()))}catch(T){this._streamError(T)}},this),this._streamError=$(function(g){this._streamCleanUp(),this._sendError(g)},this),this._streamEnd=$(function(){this._streamCleanUp(),p=!0,this._streamData("")},this),this._streamCleanUp=$(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function J(e){var n,i,p,g,T=Math.pow(2,53),X=-T,lt=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,ht=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,C=this,G=0,x=0,rt=!1,E=!1,N=[],v={data:[],errors:[],meta:{}};function q(D){return e.skipEmptyLines==="greedy"?D.join("").trim()==="":D.length===1&&D[0].length===0}function Q(){if(v&&p&&(dt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),p=!1),e.skipEmptyLines&&(v.data=v.data.filter(function(k){return!q(k)})),et()){let k=function(H,tt){y(e.transformHeader)&&(H=e.transformHeader(H,tt)),N.push(H)};if(v)if(Array.isArray(v.data[0])){for(var D=0;et()&&D<v.data.length;D++)v.data[D].forEach(k);v.data.splice(0,1)}else v.data.forEach(k)}function I(k,H){for(var tt=e.header?{}:[],W=0;W<k.length;W++){var Y=W,M=k[W],M=((pt,R)=>(K=>(e.dynamicTypingFunction&&e.dynamicTyping[K]===void 0&&(e.dynamicTyping[K]=e.dynamicTypingFunction(K)),(e.dynamicTyping[K]||e.dynamicTyping)===!0))(pt)?R==="true"||R==="TRUE"||R!=="false"&&R!=="FALSE"&&((K=>{if(lt.test(K)&&(K=parseFloat(K),X<K&&K<T))return 1})(R)?parseFloat(R):ht.test(R)?new Date(R):R===""?null:R):R)(Y=e.header?W>=N.length?"__parsed_extra":N[W]:Y,M=e.transform?e.transform(M,Y):M);Y==="__parsed_extra"?(tt[Y]=tt[Y]||[],tt[Y].push(M)):tt[Y]=M}return e.header&&(W>N.length?dt("FieldMismatch","TooManyFields","Too many fields: expected "+N.length+" fields but parsed "+W,x+H):W<N.length&&dt("FieldMismatch","TooFewFields","Too few fields: expected "+N.length+" fields but parsed "+W,x+H)),tt}var V;v&&(e.header||e.dynamicTyping||e.transform)&&(V=1,!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(I),V=v.data.length):v.data=I(v.data,0),e.header&&v.meta&&(v.meta.fields=N),x+=V)}function et(){return e.header&&N.length===0}function dt(D,I,V,k){D={type:D,code:I,message:V},k!==void 0&&(D.row=k),v.errors.push(D)}y(e.step)&&(g=e.step,e.step=function(D){v=D,et()?Q():(Q(),v.data.length!==0&&(G+=D.data.length,e.preview&&G>e.preview?i.abort():(v.data=v.data[0],g(v,C))))}),this.parse=function(D,I,V){var k=e.quoteChar||'"',k=(e.newline||(e.newline=this.guessLineEndings(D,k)),p=!1,e.delimiter?y(e.delimiter)&&(e.delimiter=e.delimiter(D),v.meta.delimiter=e.delimiter):((k=((H,tt,W,Y,M)=>{var pt,R,K,_t;M=M||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var t=0;t<M.length;t++){for(var l,m=M[t],w=0,B=0,O=0,_=(K=void 0,new Z({comments:Y,delimiter:m,newline:tt,preview:10}).parse(H)),it=0;it<_.data.length;it++)W&&q(_.data[it])?O++:(l=_.data[it].length,B+=l,K===void 0?K=l:0<l&&(w+=Math.abs(l-K),K=l));0<_.data.length&&(B/=_.data.length-O),(R===void 0||w<=R)&&(_t===void 0||_t<B)&&1.99<B&&(R=w,pt=m,_t=B)}return{successful:!!(e.delimiter=pt),bestDelimiter:pt}})(D,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=k.bestDelimiter:(p=!0,e.delimiter=o.DefaultDelimiter),v.meta.delimiter=e.delimiter),ot(e));return e.preview&&e.header&&k.preview++,n=D,i=new Z(k),v=i.parse(n,I,V),Q(),rt?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return rt},this.pause=function(){rt=!0,i.abort(),n=y(e.chunk)?"":n.substring(i.getCharIndex())},this.resume=function(){C.streamer._halted?(rt=!1,C.streamer.parseChunk(n,!0)):setTimeout(C.resume,3)},this.aborted=function(){return E},this.abort=function(){E=!0,i.abort(),v.meta.aborted=!0,y(e.complete)&&e.complete(v),n=""},this.guessLineEndings=function(H,k){H=H.substring(0,1048576);var k=new RegExp(F(k)+"([^]*?)"+F(k),"gm"),V=(H=H.replace(k,"")).split("\r"),k=H.split(`
37
+ `),H=1<k.length&&k[0].length<V[0].length;if(V.length===1||H)return`
38
+ `;for(var tt=0,W=0;W<V.length;W++)V[W][0]===`
39
+ `&&tt++;return tt>=V.length/2?`\r
40
+ `:"\r"}}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(e){var n=(e=e||{}).delimiter,i=e.newline,p=e.comments,g=e.step,T=e.preview,X=e.fastMode,lt=null,ht=!1,C=e.quoteChar==null?'"':e.quoteChar,G=C;if(e.escapeChar!==void 0&&(G=e.escapeChar),(typeof n!="string"||-1<o.BAD_DELIMITERS.indexOf(n))&&(n=","),p===n)throw new Error("Comment character same as delimiter");p===!0?p="#":(typeof p!="string"||-1<o.BAD_DELIMITERS.indexOf(p))&&(p=!1),i!==`
41
+ `&&i!=="\r"&&i!==`\r
42
+ `&&(i=`
43
+ `);var x=0,rt=!1;this.parse=function(E,N,v){if(typeof E!="string")throw new Error("Input must be a string");var q=E.length,Q=n.length,et=i.length,dt=p.length,D=y(g),I=[],V=[],k=[],H=x=0;if(!E)return w();if(X||X!==!1&&E.indexOf(C)===-1){for(var tt=E.split(i),W=0;W<tt.length;W++){if(k=tt[W],x+=k.length,W!==tt.length-1)x+=i.length;else if(v)return w();if(!p||k.substring(0,dt)!==p){if(D){if(I=[],_t(k.split(n)),B(),rt)return w()}else _t(k.split(n));if(T&&T<=W)return I=I.slice(0,T),w(!0)}}return w()}for(var Y=E.indexOf(n,x),M=E.indexOf(i,x),pt=new RegExp(F(G)+F(C),"g"),R=E.indexOf(C,x);;)if(E[x]===C)for(R=x,x++;;){if((R=E.indexOf(C,R+1))===-1)return v||V.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:I.length,index:x}),l();if(R===q-1)return l(E.substring(x,R).replace(pt,C));if(C===G&&E[R+1]===G)R++;else if(C===G||R===0||E[R-1]!==G){Y!==-1&&Y<R+1&&(Y=E.indexOf(n,R+1));var K=t((M=M!==-1&&M<R+1?E.indexOf(i,R+1):M)===-1?Y:Math.min(Y,M));if(E.substr(R+1+K,Q)===n){k.push(E.substring(x,R).replace(pt,C)),E[x=R+1+K+Q]!==C&&(R=E.indexOf(C,x)),Y=E.indexOf(n,x),M=E.indexOf(i,x);break}if(K=t(M),E.substring(R+1+K,R+1+K+et)===i){if(k.push(E.substring(x,R).replace(pt,C)),m(R+1+K+et),Y=E.indexOf(n,x),R=E.indexOf(C,x),D&&(B(),rt))return w();if(T&&I.length>=T)return w(!0);break}V.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:I.length,index:x}),R++}}else if(p&&k.length===0&&E.substring(x,x+dt)===p){if(M===-1)return w();x=M+et,M=E.indexOf(i,x),Y=E.indexOf(n,x)}else if(Y!==-1&&(Y<M||M===-1))k.push(E.substring(x,Y)),x=Y+Q,Y=E.indexOf(n,x);else{if(M===-1)break;if(k.push(E.substring(x,M)),m(M+et),D&&(B(),rt))return w();if(T&&I.length>=T)return w(!0)}return l();function _t(O){I.push(O),H=x}function t(O){var _=0;return _=O!==-1&&(O=E.substring(R+1,O))&&O.trim()===""?O.length:_}function l(O){return v||(O===void 0&&(O=E.substring(x)),k.push(O),x=q,_t(k),D&&B()),w()}function m(O){x=O,_t(k),k=[],M=E.indexOf(i,x)}function w(O){if(e.header&&!N&&I.length&&!ht){var _=I[0],it={},bt=new Set(_);let at=!1;for(let gt=0;gt<_.length;gt++){let ct=_[gt];if(it[ct=y(e.transformHeader)?e.transformHeader(ct,gt):ct]){let mt,Et=it[ct];for(;mt=ct+"_"+Et,Et++,bt.has(mt););bt.add(mt),_[gt]=mt,it[ct]++,at=!0,(lt=lt===null?{}:lt)[mt]=ct}else it[ct]=1,_[gt]=ct;bt.add(ct)}at&&console.warn("Duplicate headers found and renamed."),ht=!0}return{data:I,errors:V,meta:{delimiter:n,linebreak:i,aborted:rt,truncated:!!O,cursor:H+(N||0),renamedHeaders:lt}}}function B(){g(w()),I=[],V=[]}},this.abort=function(){rt=!0},this.getCharIndex=function(){return x}}function st(e){var n=e.data,i=b[n.workerId],p=!1;if(n.error)i.userError(n.error,n.file);else if(n.results&&n.results.data){var g={abort:function(){p=!0,nt(n.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:ut,resume:ut};if(y(i.userStep)){for(var T=0;T<n.results.data.length&&(i.userStep({data:n.results.data[T],errors:n.results.errors,meta:n.results.meta},g),!p);T++);delete n.results}else y(i.userChunk)&&(i.userChunk(n.results,g,n.file),delete n.results)}n.finished&&!p&&nt(n.workerId,n.results)}function nt(e,n){var i=b[e];y(i.userComplete)&&i.userComplete(n),i.terminate(),delete b[e]}function ut(){throw new Error("Not implemented.")}function ot(e){if(typeof e!="object"||e===null)return e;var n,i=Array.isArray(e)?[]:{};for(n in e)i[n]=ot(e[n]);return i}function $(e,n){return function(){e.apply(n,arguments)}}function y(e){return typeof e=="function"}return o.parse=function(e,n){var i=(n=n||{}).dynamicTyping||!1;if(y(i)&&(n.dynamicTypingFunction=i,i={}),n.dynamicTyping=i,n.transform=!!y(n.transform)&&n.transform,!n.worker||!o.WORKERS_SUPPORTED)return i=null,o.NODE_STREAM_INPUT,typeof e=="string"?(e=(p=>p.charCodeAt(0)!==65279?p:p.slice(1))(e),i=new(n.download?A:z)(n)):e.readable===!0&&y(e.read)&&y(e.on)?i=new P(n):(a.File&&e instanceof File||e instanceof Object)&&(i=new L(n)),i.stream(e);(i=(()=>{var p;return!!o.WORKERS_SUPPORTED&&(p=(()=>{var g=a.URL||a.webkitURL||null,T=u.toString();return o.BLOB_URL||(o.BLOB_URL=g.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",T,")();"],{type:"text/javascript"})))})(),(p=new a.Worker(p)).onmessage=st,p.id=j++,b[p.id]=p)})()).userStep=n.step,i.userChunk=n.chunk,i.userComplete=n.complete,i.userError=n.error,n.step=y(n.step),n.chunk=y(n.chunk),n.complete=y(n.complete),n.error=y(n.error),delete n.worker,i.postMessage({input:e,config:n,workerId:i.id})},o.unparse=function(e,n){var i=!1,p=!0,g=",",T=`\r
44
+ `,X='"',lt=X+X,ht=!1,C=null,G=!1,x=((()=>{if(typeof n=="object"){if(typeof n.delimiter!="string"||o.BAD_DELIMITERS.filter(function(N){return n.delimiter.indexOf(N)!==-1}).length||(g=n.delimiter),typeof n.quotes!="boolean"&&typeof n.quotes!="function"&&!Array.isArray(n.quotes)||(i=n.quotes),typeof n.skipEmptyLines!="boolean"&&typeof n.skipEmptyLines!="string"||(ht=n.skipEmptyLines),typeof n.newline=="string"&&(T=n.newline),typeof n.quoteChar=="string"&&(X=n.quoteChar),typeof n.header=="boolean"&&(p=n.header),Array.isArray(n.columns)){if(n.columns.length===0)throw new Error("Option columns is empty");C=n.columns}n.escapeChar!==void 0&&(lt=n.escapeChar+X),n.escapeFormulae instanceof RegExp?G=n.escapeFormulae:typeof n.escapeFormulae=="boolean"&&n.escapeFormulae&&(G=/^[=+\-@\t\r].*$/)}})(),new RegExp(F(X),"g"));if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return rt(null,e,ht);if(typeof e[0]=="object")return rt(C||Object.keys(e[0]),e,ht)}else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||C),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||typeof e.data[0]=="object"||(e.data=[e.data])),rt(e.fields||[],e.data||[],ht);throw new Error("Unable to serialize unrecognized input");function rt(N,v,q){var Q="",et=(typeof N=="string"&&(N=JSON.parse(N)),typeof v=="string"&&(v=JSON.parse(v)),Array.isArray(N)&&0<N.length),dt=!Array.isArray(v[0]);if(et&&p){for(var D=0;D<N.length;D++)0<D&&(Q+=g),Q+=E(N[D],D);0<v.length&&(Q+=T)}for(var I=0;I<v.length;I++){var V=(et?N:v[I]).length,k=!1,H=et?Object.keys(v[I]).length===0:v[I].length===0;if(q&&!et&&(k=q==="greedy"?v[I].join("").trim()==="":v[I].length===1&&v[I][0].length===0),q==="greedy"&&et){for(var tt=[],W=0;W<V;W++){var Y=dt?N[W]:W;tt.push(v[I][Y])}k=tt.join("").trim()===""}if(!k){for(var M=0;M<V;M++){0<M&&!H&&(Q+=g);var pt=et&&dt?N[M]:M;Q+=E(v[I][pt],M)}I<v.length-1&&(!q||0<V&&!H)&&(Q+=T)}}return Q}function E(N,v){var q,Q;return N==null?"":N.constructor===Date?JSON.stringify(N).slice(1,25):(Q=!1,G&&typeof N=="string"&&G.test(N)&&(N="'"+N,Q=!0),q=N.toString().replace(x,lt),(Q=Q||i===!0||typeof i=="function"&&i(N,v)||Array.isArray(i)&&i[v]||((et,dt)=>{for(var D=0;D<dt.length;D++)if(-1<et.indexOf(dt[D]))return!0;return!1})(q,o.BAD_DELIMITERS)||-1<q.indexOf(g)||q.charAt(0)===" "||q.charAt(q.length-1)===" ")?X+q+X:q)}},o.RECORD_SEP="",o.UNIT_SEP="",o.BYTE_ORDER_MARK="\uFEFF",o.BAD_DELIMITERS=["\r",`
45
+ `,'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!f&&!!a.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=Z,o.ParserHandle=J,o.NetworkStreamer=A,o.FileStreamer=L,o.StringStreamer=z,o.ReadableStreamStreamer=P,a.jQuery&&((d=a.jQuery).fn.parse=function(e){var n=e.config||{},i=[];return this.each(function(T){if(!(d(this).prop("tagName").toUpperCase()==="INPUT"&&d(this).attr("type").toLowerCase()==="file"&&a.FileReader)||!this.files||this.files.length===0)return!0;for(var X=0;X<this.files.length;X++)i.push({file:this.files[X],inputElem:this,instanceConfig:d.extend({},n)})}),p(),this;function p(){if(i.length===0)y(e.complete)&&e.complete();else{var T,X,lt,ht,C=i[0];if(y(e.before)){var G=e.before(C.file,C.inputElem);if(typeof G=="object"){if(G.action==="abort")return T="AbortError",X=C.file,lt=C.inputElem,ht=G.reason,void(y(e.error)&&e.error({name:T},X,lt,ht));if(G.action==="skip")return void g();typeof G.config=="object"&&(C.instanceConfig=d.extend(C.instanceConfig,G.config))}else if(G==="skip")return void g()}var x=C.instanceConfig.complete;C.instanceConfig.complete=function(rt){y(x)&&x(rt,C.file,C.inputElem),g()},o.parse(C.file,C.instanceConfig)}}function g(){i.splice(0,1),p()}}),h&&(a.onmessage=function(e){e=e.data,o.WORKER_ID===void 0&&e&&(o.WORKER_ID=e.workerId),typeof e.input=="string"?a.postMessage({workerId:o.WORKER_ID,results:o.parse(e.input,e.config),finished:!0}):(a.File&&e.input instanceof File||e.input instanceof Object)&&(e=o.parse(e.input,e.config))&&a.postMessage({workerId:o.WORKER_ID,results:e,finished:!0})}),(A.prototype=Object.create(S.prototype)).constructor=A,(L.prototype=Object.create(S.prototype)).constructor=L,(z.prototype=Object.create(z.prototype)).constructor=z,(P.prototype=Object.create(S.prototype)).constructor=P,o})}(St)),St.exports}var Kt=Ht();const qt=It(Kt);let Pt=[];const Rt=async s=>{const a=await(await fetch(s)).body.getReader().read(),f=new TextDecoder("utf-8").decode(a.value),{data:h}=qt.parse(f,{header:!0,dynamicTyping:!0,delimiter:";"});return h},Vt=(s="/translate.csv")=>(async(r="/translate.csv")=>{Pt=await Rt(r)})(s),ft=(s,r,u=[],a="/translate.csv")=>{const[d,f]=U.useState([]);U.useEffect(()=>{Rt(a).then(f),Vt(a)},[r]);const h=d.find(b=>b.code===s)??Pt.find(b=>b.code===s);try{const b=h[r];return u.reduce((o,S,A)=>o.replace(`{${A}}`,S),b)}catch{return}},Gt=async(s,r,u=[],a="/translate.csv")=>{const f=(await Rt(a)).find(h=>h.code===s);try{const h=f[r];return u.reduce((b,j,o)=>b.replace(`{${o}}`,j),h)}catch{return""}},Xt=(s="/translate.csv")=>{const[r,u]=U.useState(new Map);return U.useEffect(()=>{(async()=>{const f=(await Rt(s)).find(h=>h.code==="lan");if(f){delete f.code;const h=new Map(Object.entries(f));u(h)}})()},[]),r},Qt=({species:s,language:r,open:u,onClose:a,saveSpecies:d,createDescendant:f,createAncestor:h,deleteAncestor:b,deleteSpecies:j})=>{const[o,S]=U.useState(s.name),[A,L]=U.useState(s.apparition),[z,P]=U.useState(s.duration),[J,F]=U.useState(s.description??""),[Z,st]=U.useState(!1),[nt,ut]=U.useState(!1),[ot,$]=U.useState(s.image??""),y=()=>{st(!Z)},e=()=>{ut(!nt)},n=i=>i.ancestor?i.ancestor.descendants.length===1&&n(i.ancestor):!0;return c.jsx(te,{open:u,onClose:a,children:c.jsx("form",{style:{backgroundColor:"grey"},className:"flex flex-col text-start w-auto fixed p-2.5",children:c.jsxs(Ot,{name:o,setName:S,apparition:A,setApparition:i=>{L(s.ancestor?Jt(i,s.ancestor.apparition,s.ancestor.extinction()):i),P(s.descendants.length>0?Math.max(Math.max(...s.descendants.map(p=>p.apparition))-A,z):z)},minApparition:s.ancestor?s.ancestor.apparition:void 0,maxApparition:s.ancestor?s.ancestor.extinction():void 0,duration:z,setDuration:P,minDuration:s.descendants.length>0?Math.max(...s.descendants.map(i=>i.apparition))-A:void 0,maxDuration:s.descendants.length>0?Math.max(...s.descendants.map(i=>i.apparition))-A:void 0,description:J,setDescription:F,image:ot,setImage:$,language:r,children:[c.jsx("button",{onClick:async()=>{try{await(d==null?void 0:d(s,o,A,z,J,ot)),a==null||a()}catch(i){console.error(i)}},children:ft("spbtn00",r??"")}),c.jsx("button",{type:"button",onClick:j,children:ft("spbtn01",r??"")}),c.jsx("button",{type:"button",onClick:y,children:ft("spbtn02",r??"")}),Z&&c.jsx(Zt,{species:s,language:r,onClose:a,createDescendant:f}),s.ancestor?n(s)&&c.jsx("button",{type:"button",onClick:async()=>{try{await(b==null?void 0:b()),a==null||a()}catch(i){console.error(i)}},children:ft("spbtn04"+(s.ancestor.ancestor?"_0":""),r??"")}):c.jsx("button",{type:"button",onClick:e,children:ft("spbtn03",r??"")}),nt&&c.jsx($t,{species:s,language:r,onClose:a,createAncestor:h}),c.jsx("button",{type:"button",onClick:a,children:ft("spbtn05",r??"")})]})})})},Ot=({name:s,setName:r,apparition:u,setApparition:a,minApparition:d,maxApparition:f,duration:h,setDuration:b,minDuration:j,maxDuration:o,description:S,setDescription:A,language:L,image:z,setImage:P,children:J})=>c.jsxs(c.Fragment,{children:[c.jsx("table",{children:c.jsxs("tbody",{children:[c.jsxs("tr",{children:[c.jsxs("td",{children:[ft("splbl00",L??""),":"]}),c.jsx("td",{children:c.jsx("input",{type:"text",value:s,onChange:F=>r(F.target.value)})})]}),c.jsxs("tr",{children:[c.jsxs("td",{children:[ft("splbl01",L??""),":"]}),c.jsx("td",{children:c.jsx("input",{type:"number",min:d,max:f,value:u,onChange:F=>a(Number(F.target.value))})})]}),c.jsxs("tr",{children:[c.jsxs("td",{children:[ft("splbl02",L??""),":"]}),c.jsx("td",{children:c.jsx("input",{type:"number",min:j,max:o,value:h,onChange:F=>b(Number(F.target.value))})})]}),c.jsxs("tr",{children:[c.jsxs("td",{children:[ft("splbl03",L??""),":"]}),c.jsx("td",{children:c.jsx("textarea",{value:S,onChange:F=>A(F.target.value)})})]}),c.jsxs("tr",{children:[c.jsxs("td",{children:[ft("splbl04",L??""),":"]}),c.jsx("td",{children:c.jsx("input",{type:"text",value:z,onChange:F=>P(F.target.value)})})]}),c.jsx("tr",{children:c.jsx("td",{colSpan:2,children:c.jsx("img",{src:z,style:{height:"100px"}})})})]})}),J]}),Zt=({species:s,language:r,onClose:u,createDescendant:a})=>{const[d,f]=U.useState(""),[h,b]=U.useState(s.duration),[j,o]=U.useState(s.duration),[S,A]=U.useState(""),[L,z]=U.useState("");return c.jsx(c.Fragment,{children:c.jsx(Ot,{name:d,setName:f,apparition:s.apparition+h,setApparition:P=>b(P-s.apparition),minApparition:s.apparition,maxApparition:s.extinction(),duration:j,setDuration:o,description:S,setDescription:A,image:L,setImage:z,language:r,children:c.jsx("button",{type:"button",onClick:async()=>{try{await(a==null?void 0:a(s,d,h,j,S,L)),u==null||u()}catch(P){console.error(P)}},children:ft("cdbtn00",r??"")})})})},$t=({species:s,language:r,onClose:u,createAncestor:a})=>{const[d,f]=U.useState(""),[h,b]=U.useState(s.duration),[j,o]=U.useState(s.duration),[S,A]=U.useState(""),[L,z]=U.useState("");return c.jsx(c.Fragment,{children:c.jsx(Ot,{name:d,setName:f,apparition:s.apparition-h,setApparition:P=>{b(s.apparition-P),o(Math.max(s.apparition-P,j))},maxApparition:s.apparition,duration:j,setDuration:o,minDuration:h,description:S,setDescription:A,image:L,setImage:z,language:r,children:c.jsx("button",{type:"button",onClick:async()=>{try{await(a==null?void 0:a(s,d,h,j,S,L)),u==null||u()}catch(P){console.error(P)}},children:ft("cdbtn00",r??"")})})})},te=({open:s,onClose:r,children:u})=>c.jsx("div",{style:{backgroundColor:s?"rgba(0, 0, 0, 0.2)":"rgba(0, 0, 0, 0)"},className:`flex fixed inset-0 justify-center items-center transition-colors duration-300 ease-in-out ${s?"visible":"hidden"}`,onClick:r,children:c.jsx("div",{onClick:a=>a.stopPropagation(),className:"flex justify-center items-center",children:u})});vt.Menu=Qt,vt.MultiplePhTrees=Wt,vt.PhTree=Dt,vt.Species=xt,vt.codeText=ft,vt.codeTextAlt=Gt,vt.getLanguageOptions=Xt,Object.defineProperty(vt,Symbol.toStringTag,{value:"Module"})});
package/dist/logo.png ADDED
Binary file
@@ -0,0 +1,37 @@
1
+ code;spanish;english;deutsch
2
+ lan;Español;English;Deutsch
3
+ ttl;Árbol Cronofilogenético;Chronophylogenetic Tree;Chronophylogenetischer Baum
4
+ nvlbl00;Escala;Scale;Skala
5
+ nvlbl01;Presente;Present;Gegenwart
6
+ nvlbl02;Color;Color;Farbe
7
+ nvlbl03;Repositorio;Repository;Entwurfsmuster
8
+ nvlbl04;Importar JSON;Import JSON;Importiere JSON
9
+ nvbtn00;Crear especie vacía;Create empty species;Erschaffe leere Spezies
10
+ nvbtn00_0;Eliminar todas las especies;Delete all species;Lösche alle Spezies
11
+ nvbtn01;Ejemplo;Example;Beispiel
12
+ nvbtn02;Descargar JSON;Download JSON;JSON Herunterladen
13
+ nvlbl05;Idioma;Language;Sprache
14
+ nvlbl06;Escala Cronológica;Chronological Scale;Chronologische Skala
15
+ nvlbl07;Mostrar Datos;Display Data;Daten Anzeigen
16
+ nvlbl08;Mostrar Imágenes;Display Images;Bilder Anzeigen
17
+ splbl00;Nombre;Name;Name
18
+ splbl01;Aparición;Apparition;Erscheinung
19
+ splbl02;Duración;Duration;Dauer
20
+ splbl03;Descripción;Description;Beschreibung
21
+ splbl04;Imagen;Image;Bild
22
+ spbtn00;Guardar;Save;Speichern
23
+ spbtn01;Eliminar;Delete;Löschen
24
+ spbtn02;Crear descendiente;Create descendant;Erschaffe Nachkomme
25
+ spbtn03;Crear ancestro;Create ancestor;Erschaffe Vorfahre
26
+ spbtn04;Quitar Ancestro;Remove Ancestor;Entferne Vorfahr
27
+ spbtn04_0;Quitar Ancestros;Remove Ancestors;Lösche Nachkomme
28
+ spbtn05;Cancelar;Cancel;Abbrechen
29
+ cdbtn00;Crear;Create;Erschaffe
30
+ cnfrm00;¿Estás seguro de que deseas quitar al ancestro de {0}?;Are you sure you want to remove the {0}'s ancestor?;Willst du wirklich den {0}ten Vorfahre entfernen?
31
+ cnfrm00_0;¿Estás seguro de que deseas quitar a los ancestros de {0}?;Are you sure you want to remove the {0}'s ancestors?;Willst du wirklich die {0}ten Vorfahren entfernen?
32
+ cnfrm01;¿Estás seguro de que deseas eliminar la especie {0}?;Are you sure you want to remove the {0} species?;Willst du wirklich die {0}te Spezies entfernen?
33
+ cnfrm01_0;¿Estás seguro de que deseas eliminar la especie {0} junto a sus descendientes?;Are you sure you want to remove the {0} species along with its descendants?;Willst du wirklich die {0}te Spezies mit allen Nachfahren entfernen?
34
+ alert01;La duración de {0} debe ser mayor a 0;The duration of {0} must be greater than 0;Die Dauer von {0} muss grösser sein wie 0.
35
+ alert02;La aparición de {0} debe ser entre la aparición ({1}) y la extinción ({2}) de {3};The apparition of {0} must be between the apparition ({1}) and the extinction ({2}) of {3};Die Erscheinung von {0} muss zwischen der Erscheinung von ({1}) und dem Aussterben von ({2}) von {3}.
36
+ alert03;La aparición de {0} debe ser anterior o igual a la aparición ({1}) de {2};The apparition of {0} must be before or equal the apparition ({1}) of {2};Die Erscheinung von {0} muss zugleich oder befor dem Erscheinen von ({1}) von {2} sein.
37
+ alert03_0;La extinción de {0} debe ser posterior o igual a la aparición ({1}) de {2};The extiction of {0} must be after or equal the apparition ({1}) of {2};Das Aussterben von {0} muss nach oder zugleich zu dem Erscheinen von ({1}) von {2} sein.
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json CHANGED
@@ -1,14 +1,23 @@
1
1
  {
2
2
  "name": "chrono-phylo-tree",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "A React-based phylogenetic tree visualization library",
5
- "main": "src/index.ts",
5
+ "type": "module",
6
+ "main": "./dist/chrono-phylo-tree.umd.js",
7
+ "module": "./dist/chrono-phylo-tree.es.js",
8
+ "types": "./dist/index.d.ts",
6
9
  "files": [
7
- "src"
10
+ "dist"
8
11
  ],
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/chrono-phylo-tree.es.js",
15
+ "require": "./dist/chrono-phylo-tree.umd.js"
16
+ }
17
+ },
9
18
  "scripts": {
10
19
  "dev": "vite",
11
- "build": "tsc -b && vite build",
20
+ "build": "tsc --emitDeclarationOnly --outDir dist && vite build",
12
21
  "lint": "eslint .",
13
22
  "preview": "vite preview"
14
23
  },
@@ -30,10 +39,10 @@
30
39
  "eslint-plugin-react-hooks": "^5.0.0",
31
40
  "eslint-plugin-react-refresh": "^0.4.18",
32
41
  "globals": "^15.14.0",
42
+ "tsup": "^8.5.0",
33
43
  "typescript": "~5.7.2",
34
44
  "typescript-eslint": "^8.21.0",
35
- "vite": "^6.0.11",
36
- "vite-plugin-dts": "^4.5.4"
45
+ "vite": "^6.0.11"
37
46
  },
38
47
  "repository": {
39
48
  "type": "git",
package/src/App.css DELETED
@@ -1,131 +0,0 @@
1
- @import "tailwindcss";
2
-
3
- @tailwindcss base;
4
- @tailwindcss component;
5
- @tailwindcss utilities;
6
-
7
- #root {
8
- max-width: 1280px;
9
- margin: 0 auto;
10
- padding: 2rem;
11
- text-align: center;
12
- }
13
-
14
- .logo {
15
- height: 6em;
16
- padding: 1.5em;
17
- will-change: filter;
18
- transition: filter 300ms;
19
- }
20
- .logo:hover {
21
- filter: drop-shadow(0 0 2em #646cffaa);
22
- }
23
- .logo.react:hover {
24
- filter: drop-shadow(0 0 2em #61dafbaa);
25
- }
26
-
27
- @keyframes logo-spin {
28
- from {
29
- transform: rotate(0deg);
30
- }
31
- to {
32
- transform: rotate(360deg);
33
- }
34
- }
35
-
36
- @media (prefers-reduced-motion: no-preference) {
37
- a:nth-of-type(2) .logo {
38
- animation: logo-spin infinite 20s linear;
39
- }
40
- }
41
-
42
- .card {
43
- padding: 2em;
44
- }
45
-
46
- .read-the-docs {
47
- color: #888;
48
- }
49
-
50
- input:not([type="file"]) {
51
- text-rendering: auto;
52
- color: fieldtext;
53
- letter-spacing: normal;
54
- word-spacing: normal;
55
- line-height: normal;
56
- text-transform: none;
57
- text-indent: 0px;
58
- text-shadow: none;
59
- display: inline-block;
60
- text-align: start;
61
- appearance: auto;
62
- -webkit-rtl-ordering: logical;
63
- cursor: text;
64
- background-color: field;
65
- margin: 0em;
66
- padding: 1px 0px;
67
- border-width: 2px;
68
- border-style: inset;
69
- border-color: light-dark(rgb(118, 118, 118), rgb(133, 133, 133));
70
- border-image: initial;
71
- padding-block: 1px;
72
- padding-inline: 2px;
73
- }
74
-
75
- input:not([type="image" i], [type="range" i], [type="checkbox" i], [type="radio" i]) {
76
- overflow-clip-margin: 0px !important;
77
- overflow: clip !important;
78
- }
79
-
80
- input[type="text" i],
81
- input[type="number" i] {
82
- margin-left: 4px;
83
- margin-right: 4px;
84
- padding-block: 1px;
85
- padding-inline: 2px;
86
- background-color: field;
87
- }
88
-
89
- input[type="range" i] {
90
- appearance: auto;
91
- cursor: default;
92
- color: light-dark(rgb(16, 16, 16), rgb(255, 255, 255));
93
- padding: initial;
94
- border: initial;
95
- margin: 2px;
96
- }
97
-
98
- input[type="file"]::file-selector-button{
99
- background-color: #6b6b6b;
100
- padding-left: 4px;
101
- padding-right: 4px;
102
- border-radius: 0.25rem;
103
- }
104
-
105
- textarea {
106
- font-family: monospace;
107
- text-rendering: auto;
108
- color: fieldtext;
109
- letter-spacing: normal;
110
- word-spacing: normal;
111
- line-height: normal;
112
- text-transform: none;
113
- text-indent: 0px;
114
- text-shadow: none;
115
- display: inline-block;
116
- text-align: start;
117
- appearance: auto;
118
- -webkit-rtl-ordering: logical;
119
- resize: -internal-textarea-auto;
120
- cursor: text;
121
- overflow-wrap: break-word;
122
- background-color: field;
123
- column-count: initial !important;
124
- margin: 0em;
125
- border-width: 1px;
126
- border-style: solid;
127
- border-color: light-dark(rgb(118, 118, 118), rgb(133, 133, 133));
128
- border-image: initial;
129
- padding: 2px;
130
- white-space: pre-wrap;
131
- }
package/src/App.tsx DELETED
@@ -1,149 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import './App.css'
3
- import { PhTree } from './components/PhTree'
4
- import { Species } from './classes/Species'
5
- import { between } from './utils/between';
6
- import { codeTextAlt, getLanguageOptions } from './utils/translate';
7
- import { Menu } from './components/Menu';
8
- import { NavBar } from './components/NavBar';
9
- import { scientificNotation } from './utils/scientificNotation';
10
- import { hexToRGBA } from './utils/hexToRGBA';
11
- import { example } from './utils/example';
12
- import { createAncestor, createDescendant, deleteAncestor, deleteSpecies, saveSpecies } from './utils/updateSpecies';
13
- import { setFromJson } from './utils/setFromJson';
14
- import { HoverDescription } from './components/HoverDescription';
15
-
16
- function App() {
17
- const [scale, setScale] = useState(1);
18
- const [species, setSpecies] = useState<Species | undefined>(undefined);
19
- const [speciesList, setSpeciesList] = useState<Species[]>([]);
20
- const [lineColor, setLineColor] = useState("#7F7F7F");
21
- const [presentTime, setPresentTime] = useState<number>(1);
22
- const [presentTimeBoolean, setPresentTimeBoolean] = useState(true);
23
- const [chronoScale, setChronoScale] = useState(true);
24
- const [language, setLanguage] = useState("spanish");
25
- const [hoverPosition, setHoverPosition] = useState({x: 0, y: 0});
26
- const [showHover, setShowHover] = useState(false);
27
- const [showImages, setShowImages] = useState(true);
28
- const languages = getLanguageOptions();
29
- const minScale = 1e-12;
30
- const offset = {x: 0, y: -50}
31
-
32
- useEffect(() => {
33
- const title = document.getElementById("title");
34
- if(title) {
35
- codeTextAlt("ttl", language).then((ttl) => title.textContent = ttl);
36
- }
37
- }, [language]);
38
- const showScaleNumber = false;
39
-
40
- const showExample = () => {
41
- setSpecies(() =>{
42
- if(presentTimeBoolean){
43
- setPresentTime(example.absoluteExtinction());
44
- }
45
- setScale(example.absoluteDuration());
46
- return example;
47
- });
48
- };
49
-
50
- const changePresentTime = (n: number) => {
51
- setPresentTime(n);
52
- setScale(between(scale, 1, maxScale(n)));
53
- };
54
-
55
- const maxScale = (n: number) => species ? Math.min(species.absoluteDuration(), presentTimeBoolean ? n - species.apparition : species.absoluteDuration()) : 1
56
-
57
- const createEmptySpecies = async () => {
58
- setSpecies(new Species(await codeTextAlt("nvbtn01", language), 0, 1));
59
- setScale(1);
60
- setPresentTime(1);
61
- };
62
-
63
- const deleteAllSpecies = async () => {
64
- if(!species) return;
65
- if(!confirm(await codeTextAlt("cnfrm01" + (species.descendants.length > 0 ? "_0" : ""), language, [species.name]))) return;
66
- setSpecies(undefined);
67
- };
68
-
69
- const handleMouseMove = (x: number, y: number) => {
70
- setHoverPosition({
71
- x: x,
72
- y: y,
73
- });
74
- };
75
-
76
- //document.addEventListener("mousemove", handleMouseMove);
77
-
78
- return (
79
- <>
80
- <NavBar
81
- species={species}
82
- color={hexToRGBA(lineColor, 0.5)}
83
- lineColor={lineColor}
84
- setLineColor={setLineColor}
85
- language={language}
86
- languages={languages}
87
- setLanguage={setLanguage}
88
- minScale={minScale}
89
- maxScale={maxScale(presentTime)}
90
- scale={scale}
91
- setScale={setScale}
92
- chronoScale={chronoScale}
93
- setChronoScale={setChronoScale}
94
- showScaleNumber={showScaleNumber}
95
- showHover={showHover}
96
- setShowHover={setShowHover}
97
- showImages={showImages}
98
- setShowImages={setShowImages}
99
- presentTime={presentTime}
100
- setPresentTime={setPresentTime}
101
- setFromJson={setFromJson(setSpecies, setScale, setPresentTime, presentTimeBoolean)}
102
- presentTimeBoolean={presentTimeBoolean}
103
- setPresentTimeBoolean={setPresentTimeBoolean}
104
- changePresentTime={changePresentTime}
105
- deleteAllSpecies={deleteAllSpecies}
106
- createEmptySpecies={createEmptySpecies}
107
- showExample={showExample}
108
- />
109
- {species && <div className="h-155 sm:h-65"/>}
110
- {species && <PhTree
111
- commonAncestor={species}
112
- width={window.screen.width * (species?.absoluteDuration() ?? 0) / scale - 64}
113
- height={50}
114
- stroke={lineColor}
115
- format={scientificNotation}
116
- chronoScale={chronoScale}
117
- showImages={showImages}
118
- presentTime={presentTimeBoolean ? presentTime : undefined}
119
- padding={1}
120
- handleMouseMove={handleMouseMove}
121
- >
122
- {(sp, showMenu, toggleShowMenu, hoverSpecies) => species &&
123
- <>
124
- {showMenu && sp && <Menu
125
- species={sp}
126
- language={language}
127
- open={showMenu}
128
- onClose={() => toggleShowMenu(sp)}
129
- saveSpecies={saveSpecies(setSpecies, language)}
130
- createDescendant={createDescendant(setSpecies, language, presentTimeBoolean, setPresentTime, setScale)}
131
- createAncestor={createAncestor(setSpecies, language, presentTimeBoolean, setPresentTime, setScale)}
132
- deleteAncestor={deleteAncestor(sp, setSpecies, setScale, language)}
133
- deleteSpecies={deleteSpecies(sp, setSpecies, language)}
134
- />}
135
- {showHover && hoverSpecies && hoverSpecies.description &&
136
- <HoverDescription
137
- hoverPosition={hoverPosition}
138
- hoverSpecies={hoverSpecies}
139
- offset={offset}
140
- />
141
- }
142
- </>
143
- }
144
- </PhTree>}
145
- </>
146
- )
147
- }
148
-
149
- export default App
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>