text: /**
   * Chrysalis v1.0.9-beta
   * Casper Søkol, 2020
   * Distributed under the MIT license
   */
  
  Object.defineProperty(exports,"__esModule",{value:!0});var doc=document,NULL=null,EMPTY_OBJ={},FUNCTION="function",RENDER="render",STRING="string",STATE="state",PROPS="props",PARENT_NODE="parentNode",LENGTH="length",CHILDREN="children",CHILD_NODES="childNodes",isArray=Array.isArray,PUSH="push",INSERT_BEFORE="insertBefore",ONCREATE="oncreate",ONDESTROY="ondestroy",ONREMOVE="onremove",ONUPDATE="onupdate",ONINIT="oninit",SHOULDUPDATE="shouldUpdate",FORCEUPDATE="forceUpdate";function merge(e,r){for(var t in r)e[t]=r[t];return e}function isNew(e,r){for(var t in e)if(e[t]!==r[t])return!0;for(var t in r)if(e[t]!==r[t])return!0}function isTextNode(e){return"object"!=typeof e}function getKey(e){if(e&&(e=e[PROPS]))return e.key}function removeElement(e,r,t){t[ONREMOVE]&&t[ONREMOVE](),e.removeChild(r),t[ONDESTROY]&&t[ONDESTROY]()}function clone(e,r){var t={};for(var n in e)t[n]=e[n];for(var n in r)t[n]=r[n];return t}var element,oldNode,id=0;function h(e,r){for(var t,n=[],o=[],E=arguments,N=E[LENGTH];N-- >2;)n[PUSH](E[N]);for(;n[LENGTH]>0;)if(isArray(t=n.pop()))for(var i=t[LENGTH];i-- >0;)n[PUSH](t[i]);else!1===t||!0===t||t==NULL||o[PUSH](t);if(r=r||{},typeof e==FUNCTION)return o[LENGTH]&&(r[CHILDREN]=o),e(r);if("object"==typeof e){var a=merge({},e);return a.props=r,o[LENGTH]&&(r[CHILDREN]=o),a.id=id,id++,a}return{n:e,props:r,childNodes:o}}function eventProxy(e){this.d[e.type](e)}function updateProps(e,r,t,n){for(var o in clone(r,t)){var E=r[o],N=t[o];if("key"==o||o==CHILDREN);else if("style"==o)if(typeof value==STRING)e[o].cssText=E;else for(var i in typeof N==STRING&&(N=e[o].cssText=""),merge(E,N))(E||EMPTY_OBJ)[i]==(N||EMPTY_OBJ)[i]||e[o].setProperty("-"==i[0]&&"-"==i[1]?i:i.replace(/[A-Z]/g,"-$&"),E&&i in E?"number"==typeof E[i]?E[i]+"px":E[i]:"");else"o"==o[0]&&"n"==o[1]?((e.d||(e.d={}))[o=o.substr(2).toLowerCase()]=E)?N||e.addEventListener(o,eventProxy):e.removeEventListener(o,eventProxy):"ref"==o?typeof E==FUNCTION?E(e):E.current=e:!n&&"list"!=o&&o in e?e[o]=E==NULL?"":E:E==NULL||!1===E?e.removeAttribute(o):e.setAttribute(o,E)}}function createComponent(e,r){e[ONINIT]&&e[ONINIT](e[PROPS]);var t=e[RENDER](e[STATE],e[PROPS]);return merge(e,{setState:function(r,t){typeof r==FUNCTION&&(r=r(e[STATE],e[PROPS]));var n,o,E=clone(e[STATE],r);e[ONUPDATE]&&(n=clone(EMPTY_OBJ,e[STATE]),o=clone(EMPTY_OBJ,e[PROPS])),e[SHOULDUPDATE]?e[SHOULDUPDATE](E,t)&&(e[PROPS]=t,e[STATE]=E,e[FORCEUPDATE](n,o,!0)):(e[STATE]=E,e[FORCEUPDATE](n,o,!0))},destroy:function(){removeElement(e.$el[PARENT_NODE],e.$el,e)},v:t,$el:createElement(t,r)}),e[FORCEUPDATE]=function(r,t,n){patch(e.$el[PARENT_NODE],e.$el,e.v,e.v=e[RENDER](e[STATE],e[PROPS])),n&&e[ONUPDATE]&&e[ONUPDATE](r,t)},e.$el}function createElement(e,r,t){function n(e,n,o){for(var E=o,N=n[LENGTH];E<N;E++)e.appendChild(createElement(n[E],r,t))}if(isArray(e)){var o=createElement(e[0]);return n(o,e,1),o}if(isTextNode(e))return doc.createTextNode(e);if(e[RENDER])return e[ONCREATE]&&r[PUSH](e[ONCREATE].bind(e)),createComponent(e,r);var E=(t=t||"svg"==e.n)?doc.createElementNS("http://www.w3.org/2000/svg",e.n,{is:e[PROPS].is}):doc.createElement(e.n,{is:e[PROPS].is});return updateProps(E,e[PROPS],EMPTY_OBJ,t),n(E,e[CHILD_NODES],0),E}function patch(e,r,t,n,o){var E=[];if(n===t);else if(t!=NULL&&isTextNode(t)&&isTextNode(n)&&t!=n)r.data=n;else if(t==NULL)r=e[INSERT_BEFORE](createElement(n,E,o),r);else if(t.id&&t.id==n.id){var N;if(isNew(t[PROPS],n[PROPS]))t[ONUPDATE]&&(N=clone(t[PROPS],n[PROPS])),t.setState(EMPTY_OBJ,N)}else if(n.n&&n.n===t.n){o=o||"svg"==n.n,updateProps(r,t[PROPS],n[PROPS],o);for(var i=n[CHILD_NODES][LENGTH],a=t[CHILD_NODES][LENGTH],O={},T=[],f={},P=0;P<a;P++){var c=r[CHILD_NODES][P];T[P]=c;var s=t[CHILD_NODES][P],l=getKey(s);NULL!=l&&(O[l]=[c,s])}for(var R=0,d=0;d<i;){var S=T[R],u=t[CHILD_NODES][R],p=n[CHILD_NODES][d],v=getKey(u);if(f[v])R++;else{var L=getKey(p),D=O[L]||[];NULL==L?(NULL==v&&(patch(r,S,u,p,o),d++),R++):(v===L?(patch(r,D[0],D[1],p,o),R++):D[0]?(r[INSERT_BEFORE](D[0],S),patch(r,D[0],D[1],p,o)):patch(r,S,NULL,p,o),d++,f[L]=p)}}for(;R<a;){var U=t[CHILD_NODES][R],m=getKey(U);NULL==m&&removeElement(r,T[R],U),R++}for(var A in O){var H=O[A],y=H[1];f[y[PROPS].key]||removeElement(r,H[0],y)}}else if(n!==t){var C=r;e.replaceChild(r=createElement(n,E,o),C)}for(;E[LENGTH];)E.pop()();return r}function render(e,r,t){element=patch(r,element,oldNode,oldNode=e),t&&t()}function createRef(){return{}}function Fragment(e){return e.children}exports.h=h,exports.render=render,exports.createRef=createRef,exports.Fragment=Fragment;
  