Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

forest

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forest - npm Package Compare versions

Comparing version 0.19.3 to 0.19.4

21

forest.cjs.d.ts

@@ -1,2 +0,2 @@

import {Store, Event, Fork} from 'effector'
import {Store, Event, Scope} from 'effector'

@@ -61,3 +61,3 @@ export type StoreOrData<T> = Store<T> | T

onComplete?: () => void
scope?: Fork
scope?: Scope
},

@@ -204,4 +204,11 @@ ): void

export function block(config: {fn: () => void}): () => void
export function node(fn: (node: DOMElement) => void): void
export function text(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function remap<T extends {[field: string]: any}, S extends keyof T>(

@@ -219,7 +226,9 @@ store: Store<T>,

export function text(
export function val(
words: TemplateStringsArray,
...values: Array<string | number>
): string
export function val(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function block(config: {fn: () => void}): () => void
): Store<string>

@@ -1,2 +0,2 @@

function e(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function t(e){var t,r;e.status='active',t=a(e),(r=e).cursor.prev&&(r.cursor.prev.cursor.next=r.cursor.next),r.cursor.next&&(r.cursor.next.cursor.prev=r.cursor.prev),t.last===r&&(t.last=r.cursor.prev),t.first===r&&(t.first=r.cursor.next),r.cursor.prev=null,r.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function r(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function n(r,n){if(n.value.active===r)return n.value.pending=r,void('pending'===n.status&&(t(n),a(n).first||e(n.group,n.priority)));var l,o,i,s;'active'===n.status&&(n.status='pending',a(n).first||((i=n.group).queue[s=n.priority].last?(i.cursor[s].prev=i.queue[s].last,i.queue[s].last.cursor[s].next=i,i.queue[s].last=i):i.queue[s].first=i.queue[s].last=i),o=n,(l=a(n)).last?(o.cursor.prev=l.last,l.last.cursor.next=o,l.last=o):l.first=l.last=o),n.value.pending=r,n.group.queue.rafID||(n.group.queue.rafID=ee(n.group.queue.execQueue))}function l(a){K('execQueue');let r,n,l=Y(),o=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(Y()-l>=10){o=1;break e}let i=!!a.props.first;for(i&&K('props');r=a.props.first;){for(;n=r.activeChilds.props.first;){if(Y()-l>=10){o=1,X('props');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(r,'props')}i&&X('props');let s=!!a.tree.first;for(s&&K('tree');r=a.tree.first;){for(;n=r.activeChilds.tree.first;){if(Y()-l>=10){o=1,X('tree');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(r,'tree')}s&&X('tree');let c=!!a.data.first;for(c&&K('data');r=a.data.first;){for(;n=r.activeChilds.data.first;){if(Y()-l>=10){o=1,X('data');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(r,'data')}c&&X('data')}if(X('execQueue'),o)a.rafID=ee(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}function o({value:e,runOp:t,group:a,priority:r}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:r,group:a,cursor:{prev:null,next:null}}}function i({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=l.bind(null,t),t}function s(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function c({value:e,group:t,onInit:a,onChange:r,onTerminate:l}){let i=o({value:e,group:t,runOp(e){s.status='A',r(e)},priority:'data'}),s={status:'IA',value:i.value,hooks:{onTerminate:l},ops:{init:o({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:i,terminate:o({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return n(1,s.ops.init),s}function u(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',n(1,e.ops.terminate);break;case'AA':e.status='AT',n(1,e.ops.terminate),n(e.value.active,e.ops.change);break;case'IA':e.status='T',n(0,e.ops.init),e.hooks.onTerminate(0)}}function p(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',n(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',n(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function f(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function d(e,t){for(let a=0;a<t.length;a++){let{type:r,field:n,value:l}=t[a];te[r](e,n,l)}}function h(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function g(e,t,a){h(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function v(e,t,a){h(a)?delete e.style[t]:e.style[t]=""+a}function m(e,t,a){h(a)?delete e.dataset[t]:e.dataset[t]=""+a}function k(e,t,a){if(h(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function y(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function b({fn:e,state:t={},defer:a=0,name:r="",draft:n,isSvgRoot:l,namespace:o,env:i,isBlock:s=0}){let c=oe,u=ne,p={id:++ae,name:r,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return console.count('inactive page upward'),0;let r=[a.page.template],n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),r.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let l=t.meta.nativeTemplate;l?r.includes(l)?effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:n[r.indexOf(l)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let r=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return console.count('inactive page loader'),0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{(!r||t.leaf.forkPage&&r===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});else if(t.targetTemplate){let r=[a.page];{let e=a.page.parent;for(;e;)r.push(e),e=e.parent}let n=r.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===n?{params:e,target:x(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:x(a.node,a.forkPage),page:r[n],defer:1,forkPage:a.forkPage})}else p.pages.forEach(t=>{(!r||t.leaf.forkPage&&r===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})})}else p.pages.forEach(t=>{(!r||t.leaf.forkPage&&r===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});ne=p;let d=oe={template:p,node:f,api:null,trigger:{mount:effector.createEvent()},draft:n,isSvgRoot:l,namespace:o,env:i,isBlock:s||!(!c||!c.isBlock)};return a?d.deferredInit=()=>{let a=oe,r=ne;oe=d,ne=p,d.deferredInit=null;try{effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{oe=a,ne=r}}:effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),oe=c,ne=u,p.actor=d,d}function x(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function w(e,t){let a=e;switch(t&&ie(t,e)&&(a=ie(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function P(e,t,a){let r=t;for(;r&&!ie(r.spawn,e);)r=r.parentLeaf;return r?ie(r.spawn,e):a&&ie(a,e)?ie(a,e):e}function I(e,t,a){return P(e,t,a).current}function S(e,t){ie(t.spawn,e)||(t.spawn.reg[e.id]=P(e,t.parentLeaf,t.forkPage))}function C(e,{values:t={},parentLeaf:a,mountNode:r,svgRoot:n,leafData:l,opGroup:o,domSubtree:i,hydration:s,forkPage:c,env:u}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;S(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;S(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':S(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let r=e.after[a],n=r.to;switch(g[n.id]||(g[n.id]={id:n.id,current:I(n,k.parentLeaf,c)}),r.type){case'copy':g[n.id].current=t;break;case'map':g[n.id].current=r.fn(t)}}}function f(e,t,a){let r;t.stop=1;try{for(;t.i<e.length;)r=e[t.i],t.i++,r.fn(a[r.of.id]?a[r.of.id].current:I(r.of,k.parentLeaf,c))}catch(e){console.error(e),t.stop=0}}!u&&a&&(u=a.env);let d=a?a.spawn:null,h=e.template,g={},v={id:++re,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(v);let m={},k={actor:e,spawn:v,api:m,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:n,data:l,parentLeaf:a,hydration:s,forkPage:c,env:u,mountNode:r},y=le;le=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(v)),v.fullID=d?`${d.fullID}_${v.id}`:""+v.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,r=v.parent;e:for(;r;){if(ie(r,t)){a=ie(r,t);break e}r=r.parent}!r&&c&&ie(c,t)&&(a=ie(c,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:w(t,c)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in v.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...v.childSpawns[e]);if(m.mount=(t,a=1)=>(e=>{if(se)return void se.steps.push(e);let t;se={parent:se,steps:[e]};do{for(;t=se.steps.shift();)se={parent:se,steps:[]},effector.launch(t)}while(se=se.parent)})({target:e.trigger.mount,params:t,defer:a,page:v,forkPage:c}),e.api)for(let t in e.api)m[t]=(a,r=1)=>effector.launch({target:e.api[t],params:a,defer:r,page:v,forkPage:c});return k.spawn.api=m,k.spawn.leaf=k,k.api.mount(k),le=y,k}function T(e){let t=function e(t){switch(t.type){case'using':return t;case'fragment':switch(t.parent.type){case'element':case'using':return t.parent}default:return e((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;case'fragment':default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(t))}}(e);return t?t.value:null}function R(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return R(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=R(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=R(t);if(e)return e;t=t.left}return null}default:return null}}function q(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=R(a.child[e]);if(t)return t}return q(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=R(a.child[e]);if(t)return t}return q(a)}case'LF':{let t=e.parent.left;for(;t;){let e=R(t);if(e)return e;t=t.left}return q(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let r=R(e);if(r)return r}return q(t)}default:return null}}function A(e){let t=q(e);return t?t.value:null}function D(e,{parentBlockFragment:t,leaf:a,node:r,svgRoot:n,values:l}){e.childTemplates.forEach(e=>{O({parentBlockFragment:t,leaf:a,node:r,svgRoot:n,values:l,actor:e})})}function O({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:r,svgRoot:n,values:l}){let i,{draft:c}=r,{queue:u}=t.ops.group,p=s(u),f=t.ops.domSubtree,h=f;switch(c.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:c.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[c.inParentIndex]=t,i={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(r.isBlock){let e,r,n=t;for(;n&&(!r||!e);){n.actor.env&&(e=n.actor.env);let{draft:t}=n;'element'===t.type&&('svg'===t.tag?r='svg':'foreignObject'===t.tag&&(r='html')),n=n.parentLeaf}r||(r='html'),e&&(a='svg'===r?e.document.createElementNS('http://www.w3.org/2000/svg',c.tag):e.document.createElement(c.tag),d(a,c.staticSeq))}else a=c.stencil.cloneNode();let n={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:c.inParentIndex};n.child.parent=n,e.child[c.inParentIndex]=n,i={type:'element',block:n,ops:{visible:o({value:0,priority:'tree',runOp(e){e?(F(n),i.needToCallNode&&(i.needToCallNode=0,effector.launch({target:ce,params:{element:n.value,fns:c.node},page:g.spawn,forkPage:t.forkPage}))):(n.value.remove(),n.visible=0)},group:f})},needToCallNode:c.node.length>0},h=s(u);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,i={type:'list',draft:c,block:t,records:[]};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'block item',block:t};break}default:console.warn("unexpected draft type "+c.type)}let g=C(r,{values:l,parentLeaf:t,mountNode:a,svgRoot:n||t.svgRoot,leafData:i,opGroup:p,domSubtree:h,hydration:t.hydration,forkPage:t.forkPage})}function F(e){let t=A(e);t?t.after(e.value):T(e).prepend(e.value),e.visible=1}function N(e,t){if(Array.isArray(t))return t.map(t=>e.map(e=>e[t]));if('object'==typeof t&&null!==t){let a={};for(let r in t){let n=t[r];a[r]=e.map('function'==typeof n?e=>n(e):e=>e[n])}return a}return e.map(e=>e[t])}function M(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let r=a.childSpawns[e];for(let e=0;e<r.length;e++)t(r[e].leaf)}}function E(e){e.spawn.active=0,M(e,V)}function B({spawn:e}){_(e,e.parent.childSpawns[e.template.id]),_(e,e.template.pages)}function V(e){let{spawn:t,data:a}=e;switch(a.type){case'element':_(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,_(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),n(0,a.ops.visible);break;case'list':{let t=a.records;for(let e=0;e<t.length;e++){let a=t[e];a.instance&&V(a.instance),a.active=0}e.spawn.active=0,B(e);break}case'list item':{let t=a.block;_(t,t.parent.child);let r=t.left,n=t.right;r&&(r.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=r)),n&&(n.left=r),r||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,E(e),B(e);break}case'route':E(e),B(e);break;case'block':case'block item':case'rec':case'rec item':E(e)}}function _(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function L(e,t){if(!e)throw Error(t)}function j(e,t){if(!e)throw Error(t+"() called outside from using() closure")}function z(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function G(e){j(oe,'spec');let t=oe.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,r=t.childCount;Array.isArray(a)?(t.text.push(...a.map((e,t)=>({index:t+r,value:e}))),t.childCount+=a.length):(t.text.push({index:r,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[f(t)]=e.style[t];t.styleProp.push(a)}if(e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?Q(t.config||{},t.on):Q(t)}e.ɔ&&G(e.ɔ)}function Q(e,t){if(!oe)return;let a=oe.draft;L('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)L(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:r=0,capture:n=0,prevent:l=0,stop:o=0}=e;a.handler.push({options:{prevent:l,stop:o},domConfig:{passive:l?0:r,capture:n},map:t})}function U({source:e,visible:t,fn:a}){j(oe,'route');let{env:r,namespace:n}=oe,l=b({name:'route',isSvgRoot:0,namespace:n,env:r,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(l,{mount:o}){let i;if(effector.is.store(t))i=effector.combine({value:e,visible:t});else{let a=t;i=e.map(e=>({value:e,visible:a(e)}))}let s=b({name:'route item',isSvgRoot:0,namespace:n,env:r,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let r=effector.createEvent();e.on(r,(e,t)=>t),a({store:e});let n=effector.sample({source:t,clock:i,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(ue.routeItem),n.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:r,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),$(t,e)})}});H(s);let{onMount:c,onState:u}=J({mount:o,state:i,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})});effector.merge([c,u]).watch(({leaf:e,visible:t,value:a})=>{let r=e.data;r.block.child.visible=t,t&&!r.initialized&&(O({parentBlockFragment:r.block.child.child,leaf:e,actor:s,values:{store:a}}),r.initialized=1)})}});H(l)}function $(e,t){let a=t=>{let r=t.data;switch(r.type){case'element':n(e,r.ops.visible);break;case'route':case'list':case'list item':M(t,a);break;default:console.log('unsupported type',r.type)}};M(t,a)}function W(e){let t='function'==typeof e?e:e.fn,a=b({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let r=effector.createEvent();return e.on(r,(e,t)=>t),a.watch(ue.rec),{itemUpdater:r}}});return({store:e,state:t=e})=>{j(oe,'(rec instance)');let{env:r,namespace:n}=oe;a.deferredInit&&a.deferredInit(),H(b({name:'rec item',isSvgRoot:0,namespace:n,env:r,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:r}){let{onMount:n,onState:l}=J({state:t,mount:r,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});l.watch(({state:e,leaf:t})=>{M(t,t=>{t.api.itemUpdater(e)})}),n.watch(({leaf:e,state:t})=>{O({parentBlockFragment:e.data.block.child,leaf:e,actor:a,values:{store:t}})})}}))}}function Z(e,t){j(oe,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:r,source:n,fields:l=[]}=e,o=void 0!==r?'function'==typeof r?r:e=>e[r]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:f,namespace:d}=oe;H(b({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t}){let r=b({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:r}){a({store:t,key:e,fields:N(t,l)});let n=effector.createEvent();if(t.on(n,(e,t)=>t),i.itemVisible){let{onMount:e,onState:t}=J({mount:r,state:i.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch(({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&D(i,{parentBlockFragment:a.child,leaf:t})}),t.watch(({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?$(e,t):e&&(a.childInitialized=1,D(i,{parentBlockFragment:a.child,leaf:t}))})}else r.watch(ue.listItem);return{itemUpdater:n}},env:f}),h=effector.createStore([]),g=n.map(e=>e),v=effector.sample({source:n,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),m=effector.sample({source:v,clock:g,fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});effector.sample({source:h,clock:[v,m],greedy:1,fn(e,{updates:t,leaf:a,hydration:l}){let f=a.data,d=f.block;K('list update ['+n.shortName+']');let h=Array(t.length).fill(0),g=t.map(o),v=[];for(let a=0;a<e.length;a++){let r=e[a],n=g.indexOf(r.key);-1!==n?(v.push(r),h[n]=1,p(t[n],r.asyncValue)):(r.active=0,r.instance&&V(r.instance),u(r.asyncValue))}for(let e=0;e<t.length;e++){if(h[e])continue;let n=t[e],o=g[e],u=s(a.ops.group.queue),p={type:'LF',parent:d,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},f={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:i},asyncValue:c({value:n,group:u,onTerminate(e){},onChange(e){f.instance&&f.instance.api.itemUpdater(e)},onInit(e){f.active&&(l||(f.instance=C(r,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:u,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage})))}})},m=v.length;v.push(f);let k=m>0?v[m-1].leafData:null;if(p.child.parent=p,d.child.push(p),k){let e=k.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):d.lastChild=p,e.right=p}else d.lastChild=p;l&&(f.instance=C(r,{values:{id:o,store:n},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:u,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage}))}return X('list update ['+n.shortName+']'),0===v.length&&(d.lastChild=null),f.records=v,v},target:h})},env:f}))}function H(e){if(!oe)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(oe.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=oe.draft.childCount,oe.draft.childCount+=1,oe.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+oe.draft.type)}}function J({mount:e,state:t,onMount:a,onState:r}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:r,greedy:1})}}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let K,X,Y;'undefined'!=typeof performance&&performance.mark?(K=e=>{performance.mark('☄️ '+e+' start')},X=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(K=()=>{},X=()=>{}),Y='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let ee='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const te={attr:k,data:m,style:v,styleVar:g};let ae=0,re=0,ne=null,le=null,oe=null;const ie=(e,t)=>e.reg[t.id];let se=null,ce=effector.createEvent();ce.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})});const ue={using(e){let t=e.data;D(t.draft,{parentBlockFragment:t.block.child,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.child.visible=1,D(t,{parentBlockFragment:a.block.child.child,leaf:e})},block(e){D(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},blockItem(e){O({parentBlockFragment:e.data.block.child,leaf:e,actor:e.draft.itemOf})},rec(e){D(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,D(t.listDraft,{parentBlockFragment:a.child,leaf:e})}};exports.block=({fn:e,env:t,namespace:a="html"})=>{let r=b({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(ue.block)}});return()=>{j(oe,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:r},{env:t,namespace:a}=oe;H(b({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(ue.blockItem)}}))}},exports.h=(e,t)=>{function a(e){return e.data.block.value}function l(e,t,a){let r=e.data.block.child,n={type:'text',parent:r,visible:0,index:a,value:null};if(r.child[a]=n,e.hydration){let a=q(n);if(a)switch(a.type){case'text':n.value=e.env.document.createTextNode(t),a.value.after(n.value);break;case'element':n.value=a.value.nextSibling,y(n.value,t)}else{let e=T(n);n.value=e.firstChild,y(n.value,t)}n.visible=1}else n.value=e.env.document.createTextNode(t),F(n);return n}let i,s=0,c=0;'function'==typeof t?(s=1,i=t):t&&(c=1,t.fn&&(s=1,i=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,i=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,i=t.ɔ.fn))),j(oe,'h');let u,p=oe.env,f=oe.namespace,h=f,w='html';h=w='svg'===f?'svg':'html','svg'===e&&(w='svg',h='svg'),oe.isBlock||(u='svg'===w?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=u,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===f?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),h='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),h='svg'):'foreignObject'===e&&(h='foreignObject');let S=b({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:h,fn(e,{mount:u}){function p(e){return J({mount:f,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let f=effector.createEvent();s&&i(),c&&G(t);let h={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?h.attr.href=t[e]:h.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)h.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?h.styleVar[e.slice(2)]=t[e]:h.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)h.styleVar[e]=t[e]}h.visible&&I.seq.push({type:'visible',value:h.visible});for(let e in h.attr){let t=h.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in h.data){let t=h.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in h.styleProp){let t=h.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in h.styleVar){let t=h.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<h.text.length;e++){let t=h.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=ne;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<h.handler.length;e++){let t=h.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(h.visible){let{onMount:e,onState:t}=J({mount:u,state:h.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch(({leaf:e,value:t,hydration:a})=>{let n=e.data,l=n.block;if(a&&(r(t,n.ops.visible),t)){let e,t=A(l);if(e=t?t.nextSibling:T(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}D(I,{parentBlockFragment:l.child,leaf:e,node:l.value,svgRoot:S.isSvgRoot?l.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:ce,params:{element:n.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||n(t,e.data.ops.visible)})}P&&d(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,r='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:l,onState:i}=p(t.value);if(r)effector.merge([i,l]).watch(({leaf:t,value:r})=>{k(a(t),e,r)});else{let t=I.opsAmount++;l.watch(({value:r,leaf:n})=>{let l=a(n),i=o({value:r,priority:'props',runOp(t){k(l,e,t)},group:n.ops.group});n.ops.group.ops[t]=i,k(l,e,r)}),i.watch(({value:e,leaf:a})=>{n(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:r,onState:l}=p(t.value),i=I.opsAmount++;r.watch(({value:t,leaf:r})=>{let n=a(r),l=o({value:t,priority:'props',runOp(t){m(n,e,t)},group:r.ops.group});r.ops.group.ops[i]=l,m(n,e,t)}),l.watch(({value:e,leaf:t})=>{n(e,t.ops.group.ops[i])});break}case'style':{let e=I.opsAmount++,{field:r}=t,{onMount:l,onState:i}=p(t.value);l.watch(({value:t,leaf:n})=>{let l=a(n),i=o({value:t,priority:'props',runOp(e){v(l,r,e)},group:n.ops.group});n.ops.group.ops[e]=i,v(l,r,t)}),i.watch(({value:t,leaf:a})=>{n(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:r,onState:l}=p(t.value),i=I.opsAmount++;r.watch(({value:t,leaf:r})=>{let n=a(r),l=o({value:t,priority:'props',runOp(t){g(n,e,t)},group:r.ops.group});r.ops.group.ops[i]=l,g(n,e,t)}),l.watch(({value:e,leaf:t})=>{n(e,t.ops.group.ops[i])});break}case'staticText':f.watch(e=>{l(e,t.value,t.childIndex)});break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:f,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:r})=>{let n=o({value:a,priority:'props',runOp(e){y(i.value,e)},group:r.ops.group});r.ops.group.ops[e]=n;let i=l(r,a,t.childIndex)}),effector.sample({source:f,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{n(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;f.watch(r=>{let n=null;if(e){let t=0,a=r.spawn;for(;!t&&a;)a.template===e?(t=1,n=a):a=a.parent}a(r).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:x(t.handler,r.forkPage),params:e,page:n,forkPage:r.forkPage})},t.domConfig)});break}}}u.watch(e=>{let t=e.data;if(!I.visible){let a=t.ops.visible,l=t.block;if(e.hydration){r(1,a);let e,t=A(l);if(e=t?t.nextSibling:T(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}D(I,{parentBlockFragment:l.child,leaf:e,node:l.value,svgRoot:S.isSvgRoot?l.value:null}),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:ce,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):n(1,a)}})},env:p});H(S)},exports.handler=Q,exports.list=Z,exports.node=e=>{j(oe,'node');let t=oe.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},exports.rec=W,exports.remap=N,exports.route=U,exports.spec=G,exports.text=(e,...t)=>{let a=[e[0]];for(let r=0;r<t.length;r++)a.push(t[r],e[r+1]);G({text:a})},exports.tree=({source:e,key:t,child:a,fn:r})=>{let n=W(({store:e})=>{Z({source:e,key:t,fn({store:e}){let t=e.map(e=>e[a]||[]);r({store:e,child(){n({store:t})}})}})});n({store:e})},exports.using=(e,t)=>{let a,r,n,l,o,c;if('function'==typeof t)a=t,n=z(),l=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,n=t.env?t.env:z(),l=t.hydrate,r=t.onComplete,o=t.onRoot,c=t.scope}L(e,'using() first argument is missing');let u=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=b({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(ue.using)},env:n}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h,(e=>{if(e&&!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let r=e.clones[a];t[r.meta.forkOf.id]=r}e.nodeMap=t}})(c);let g=i({onComplete:r}),v=C(d,{parentLeaf:le||null,mountNode:e,svgRoot:d.isSvgRoot?e:le?le.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:s(g),domSubtree:s(g),hydration:l,forkPage:c,env:n});if(o&&o({template:d,leaf:v}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},exports.variant=({source:e,cases:t,key:a})=>{let r;j(oe,'variant'),L(effector.is.unit(e),'variant({source}) should be unit'),r='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let n=0;for(let a in t)'__'!==a?U({source:e,visible:e=>r(e)===a,fn:t[a]}):n=1;if(n){let a=Object.keys(t);U({source:e,visible:e=>!a.includes(r(e)),fn:t.__})}};
function e(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function t(e){var t,r;e.status='active',t=a(e),(r=e).cursor.prev&&(r.cursor.prev.cursor.next=r.cursor.next),r.cursor.next&&(r.cursor.next.cursor.prev=r.cursor.prev),t.last===r&&(t.last=r.cursor.prev),t.first===r&&(t.first=r.cursor.next),r.cursor.prev=null,r.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function r(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function n(r,n){if(n.value.active===r)return n.value.pending=r,void('pending'===n.status&&(t(n),a(n).first||e(n.group,n.priority)));var l,o,i,s;'active'===n.status&&(n.status='pending',a(n).first||((i=n.group).queue[s=n.priority].last?(i.cursor[s].prev=i.queue[s].last,i.queue[s].last.cursor[s].next=i,i.queue[s].last=i):i.queue[s].first=i.queue[s].last=i),o=n,(l=a(n)).last?(o.cursor.prev=l.last,l.last.cursor.next=o,l.last=o):l.first=l.last=o),n.value.pending=r,n.group.queue.rafID||(n.group.queue.rafID=ae(n.group.queue.execQueue))}function l(a){Y('execQueue');let r,n,l=te(),o=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(te()-l>=10){o=1;break e}let i=!!a.props.first;for(i&&Y('props');r=a.props.first;){for(;n=r.activeChilds.props.first;){if(te()-l>=10){o=1,ee('props');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(r,'props')}i&&ee('props');let s=!!a.tree.first;for(s&&Y('tree');r=a.tree.first;){for(;n=r.activeChilds.tree.first;){if(te()-l>=10){o=1,ee('tree');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(r,'tree')}s&&ee('tree');let c=!!a.data.first;for(c&&Y('data');r=a.data.first;){for(;n=r.activeChilds.data.first;){if(te()-l>=10){o=1,ee('data');break e}n.runOp(n.value.pending),n.value.active=n.value.pending,t(n)}e(r,'data')}c&&ee('data')}if(ee('execQueue'),o)a.rafID=ae(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}function o({value:e,runOp:t,group:a,priority:r}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:r,group:a,cursor:{prev:null,next:null}}}function i({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=l.bind(null,t),t}function s(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function c({value:e,group:t,onInit:a,onChange:r,onTerminate:l}){let i=o({value:e,group:t,runOp(e){s.status='A',r(e)},priority:'data'}),s={status:'IA',value:i.value,hooks:{onTerminate:l},ops:{init:o({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:i,terminate:o({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return n(1,s.ops.init),s}function u(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',n(1,e.ops.terminate);break;case'AA':e.status='AT',n(1,e.ops.terminate),n(e.value.active,e.ops.change);break;case'IA':e.status='T',n(0,e.ops.init),e.hooks.onTerminate(0)}}function p(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',n(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',n(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function f(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function d(e,t){for(let a=0;a<t.length;a++){let{type:r,field:n,value:l}=t[a];re[r](e,n,l)}}function h(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function g(e,t,a){h(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function v(e,t,a){h(a)?delete e.style[t]:e.style[t]=""+a}function m(e,t,a){h(a)?delete e.dataset[t]:e.dataset[t]=""+a}function k(e,t,a){if(h(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function y(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function b({fn:e,state:t={},defer:a=0,name:r="",draft:n,isSvgRoot:l,namespace:o,env:i,isBlock:s=0}){let c=se,u=oe,p={id:++ne,name:r,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return console.count('inactive page upward'),0;let r=[a.page.template],n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),r.push(e.template),e=e.parent}return a.node.next.forEach((t=>{let l=t.meta.nativeTemplate;l?r.includes(l)?effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:n[r.indexOf(l)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})})),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let r=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return console.count('inactive page loader'),0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach((t=>{(!r||t.leaf.forkPage&&r===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})}));else if(t.targetTemplate){let r=[a.page];{let e=a.page.parent;for(;e;)r.push(e),e=e.parent}let n=r.findIndex((e=>t.targetTemplate===e.template));effector.launch(-1===n?{params:e,target:x(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:x(a.node,a.forkPage),page:r[n],defer:1,forkPage:a.forkPage})}else p.pages.forEach((t=>{(!r||t.leaf.forkPage&&r===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})}))}else p.pages.forEach((t=>{(!r||t.leaf.forkPage&&r===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})}));return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});oe=p;let d=se={template:p,node:f,api:null,trigger:{mount:effector.createEvent()},draft:n,isSvgRoot:l,namespace:o,env:i,isBlock:s||!(!c||!c.isBlock)};return a?d.deferredInit=()=>{let a=se,r=oe;se=d,oe=p,d.deferredInit=null;try{effector.withRegion(f,(()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}))}finally{se=a,oe=r}}:effector.withRegion(f,(()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})),se=c,oe=u,p.actor=d,d}function x(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function w(e,t){let a=e;switch(t&&ce(t,e)&&(a=ce(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function P(e,t,a){let r=t;for(;r&&!ce(r.spawn,e);)r=r.parentLeaf;return r?ce(r.spawn,e):a&&ce(a,e)?ce(a,e):e}function I(e,t,a){return P(e,t,a).current}function S(e,t){ce(t.spawn,e)||(t.spawn.reg[e.id]=P(e,t.parentLeaf,t.forkPage))}function C(e,{values:t={},parentLeaf:a,mountNode:r,svgRoot:n,leafData:l,opGroup:o,domSubtree:i,hydration:s,forkPage:c,env:u}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;S(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;S(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':S(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let r=e.after[a],n=r.to;switch(g[n.id]||(g[n.id]={id:n.id,current:I(n,k.parentLeaf,c)}),r.type){case'copy':g[n.id].current=t;break;case'map':g[n.id].current=r.fn(t)}}}function f(e,t,a){let r;t.stop=1;try{for(;t.i<e.length;)r=e[t.i],t.i++,r.fn(a[r.of.id]?a[r.of.id].current:I(r.of,k.parentLeaf,c))}catch(e){console.error(e),t.stop=0}}!u&&a&&(u=a.env);let d=a?a.spawn:null,h=e.template,g={},v={id:++le,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(v);let m={},k={actor:e,spawn:v,api:m,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:n,data:l,parentLeaf:a,hydration:s,forkPage:c,env:u,mountNode:r},y=ie;ie=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(v)),v.fullID=d?`${d.fullID}_${v.id}`:""+v.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,r=v.parent;e:for(;r;){if(ce(r,t)){a=ce(r,t);break e}r=r.parent}!r&&c&&ce(c,t)&&(a=ce(c,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:w(t,c)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in v.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...v.childSpawns[e]);if(m.mount=(t,a=1)=>(e=>{if(ue)return void ue.steps.push(e);let t;ue={parent:ue,steps:[e]};do{for(;t=ue.steps.shift();)ue={parent:ue,steps:[]},effector.launch(t)}while(ue=ue.parent)})({target:e.trigger.mount,params:t,defer:a,page:v,forkPage:c}),e.api)for(let t in e.api)m[t]=(a,r=1)=>effector.launch({target:e.api[t],params:a,defer:r,page:v,forkPage:c});return k.spawn.api=m,k.spawn.leaf=k,k.api.mount(k),ie=y,k}function T(e){switch(e.type){case'using':return e;case'fragment':switch(e.parent.type){case'element':case'using':return e.parent}default:return T((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;case'fragment':default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(e))}}function R(e){let t=T(e);return t?t.value:null}function q(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return q(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=q(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=q(t);if(e)return e;t=t.left}return null}default:return null}}function A(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=q(a.child[e]);if(t)return t}return A(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=q(a.child[e]);if(t)return t}return A(a)}case'LF':{let t=e.parent.left;for(;t;){let e=q(t);if(e)return e;t=t.left}return A(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let r=q(e);if(r)return r}return A(t)}default:return null}}function D(e){let t=A(e);return t?t.value:null}function O(e,{parentBlockFragment:t,leaf:a,node:r,svgRoot:n,values:l}){e.childTemplates.forEach((e=>{F({parentBlockFragment:t,leaf:a,node:r,svgRoot:n,values:l,actor:e})}))}function F({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:r,svgRoot:n,values:l}){let i,{draft:c}=r,{queue:u}=t.ops.group,p=s(u),f=t.ops.domSubtree,h=f;switch(c.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:c.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[c.inParentIndex]=t,i={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(r.isBlock){let e,r,n=t;for(;n&&(!r||!e);){n.actor.env&&(e=n.actor.env);let{draft:t}=n;'element'===t.type&&('svg'===t.tag?r='svg':'foreignObject'===t.tag&&(r='html')),n=n.parentLeaf}r||(r='html'),e&&(a='svg'===r?e.document.createElementNS('http://www.w3.org/2000/svg',c.tag):e.document.createElement(c.tag),d(a,c.staticSeq))}else a=c.stencil.cloneNode();let n={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:c.inParentIndex};n.child.parent=n,e.child[c.inParentIndex]=n,i={type:'element',block:n,ops:{visible:o({value:0,priority:'tree',runOp(e){e?(N(n),i.needToCallNode&&(i.needToCallNode=0,effector.launch({target:pe,params:{element:n.value,fns:c.node},page:g.spawn,forkPage:t.forkPage}))):(n.value.remove(),n.visible=0)},group:f})},needToCallNode:c.node.length>0},h=s(u);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:c.inParentIndex};e.child[c.inParentIndex]=t,i={type:'list',draft:c,block:t,records:[]};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:c.inParentIndex};t.child.parent=t,e.child[c.inParentIndex]=t,i={type:'block item',block:t};break}default:console.warn("unexpected draft type "+c.type)}let g=C(r,{values:l,parentLeaf:t,mountNode:a,svgRoot:n||t.svgRoot,leafData:i,opGroup:p,domSubtree:h,hydration:t.hydration,forkPage:t.forkPage})}function N(e){let t=D(e);t?t.after(e.value):R(e).prepend(e.value),e.visible=1}function M(e,t){if(Array.isArray(t))return t.map((t=>e.map((e=>e[t]))));if('object'==typeof t&&null!==t){let a={};for(let r in t){let n=t[r];a[r]=e.map('function'==typeof n?e=>n(e):e=>e[n])}return a}return e.map((e=>e[t]))}function E(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let r=a.childSpawns[e];for(let e=0;e<r.length;e++)t(r[e].leaf)}}function B(e){e.spawn.active=0,E(e,_)}function V({spawn:e}){L(e,e.parent.childSpawns[e.template.id]),L(e,e.template.pages)}function _(e){let{spawn:t,data:a}=e;switch(a.type){case'element':L(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,L(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),n(0,a.ops.visible);break;case'list':{let t=a.records;for(let e=0;e<t.length;e++){let a=t[e];a.instance&&_(a.instance),a.active=0}e.spawn.active=0,V(e);break}case'list item':{let t=a.block;L(t,t.parent.child);let r=t.left,n=t.right;r&&(r.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=r)),n&&(n.left=r),r||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,B(e),V(e);break}case'route':B(e),V(e);break;case'block':case'block item':case'rec':case'rec item':B(e)}}function L(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function j(e,t){if(!e)throw Error(t)}function z(e,t){if(!e)throw Error(t+"() called outside from using() closure")}function G(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function Q(e){z(se,'spec');let t=se.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,r=t.childCount;Array.isArray(a)?(t.text.push(...a.map(((e,t)=>({index:t+r,value:e})))),t.childCount+=a.length):(t.text.push({index:r,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[f(t)]=e.style[t];t.styleProp.push(a)}if(e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?U(t.config||{},t.on):U(t)}e.ɔ&&Q(e.ɔ)}function U(e,t){if(!se)return;let a=se.draft;j('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)j(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:r=0,capture:n=0,prevent:l=0,stop:o=0}=e;a.handler.push({options:{prevent:l,stop:o},domConfig:{passive:l?0:r,capture:n},map:t})}function $({source:e,visible:t,fn:a}){z(se,'route');let{env:r,namespace:n}=se,l=b({name:'route',isSvgRoot:0,namespace:n,env:r,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(l,{mount:o}){let i;if(effector.is.store(t))i=effector.combine({value:e,visible:t});else{let a=t;i=e.map((e=>({value:e,visible:a(e)})))}let s=b({name:'route item',isSvgRoot:0,namespace:n,env:r,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let r=effector.createEvent();e.on(r,((e,t)=>t)),a({store:e});let n=effector.sample({source:t,clock:i,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(fe.routeItem),n.watch((({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:r,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),W(t,e)}))}});J(s);let{onMount:c,onState:u}=K({mount:o,state:i,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})});effector.merge([c,u]).watch((({leaf:e,visible:t,value:a})=>{let r=e.data;r.block.child.visible=t,t&&!r.initialized&&(F({parentBlockFragment:r.block.child.child,leaf:e,actor:s,values:{store:a}}),r.initialized=1)}))}});J(l)}function W(e,t){let a=t=>{let r=t.data;switch(r.type){case'element':n(e,r.ops.visible);break;case'route':case'list':case'list item':E(t,a);break;default:console.log('unsupported type',r.type)}};E(t,a)}function Z(e){let t='function'==typeof e?e:e.fn,a=b({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let r=effector.createEvent();return e.on(r,((e,t)=>t)),a.watch(fe.rec),{itemUpdater:r}}});return({store:e,state:t=e})=>{z(se,'(rec instance)');let{env:r,namespace:n}=se;a.deferredInit&&a.deferredInit(),J(b({name:'rec item',isSvgRoot:0,namespace:n,env:r,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:r}){let{onMount:n,onState:l}=K({state:t,mount:r,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});l.watch((({state:e,leaf:t})=>{E(t,(t=>{t.api.itemUpdater(e)}))})),n.watch((({leaf:e,state:t})=>{F({parentBlockFragment:e.data.block.child,leaf:e,actor:a,values:{store:t}})}))}}))}}function H(e,t){z(se,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:r,source:n,fields:l=[]}=e,o=void 0!==r?'function'==typeof r?r:e=>e[r]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:f,namespace:d}=se;J(b({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t}){let r=b({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:r}){a({store:t,key:e,fields:M(t,l)});let n=effector.createEvent();if(t.on(n,((e,t)=>t)),i.itemVisible){let{onMount:e,onState:t}=K({mount:r,state:i.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&O(i,{parentBlockFragment:a.child,leaf:t})})),t.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?W(e,t):e&&(a.childInitialized=1,O(i,{parentBlockFragment:a.child,leaf:t}))}))}else r.watch(fe.listItem);return{itemUpdater:n}},env:f}),h=effector.createStore([]),g=n.map((e=>e)),v=effector.sample({source:n,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),m=effector.sample({source:v,clock:g,fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});effector.sample({source:h,clock:[v,m],greedy:1,fn(e,{updates:t,leaf:a,hydration:l}){let f=a.data,d=f.block;Y('list update ['+n.shortName+']');let h=Array(t.length).fill(0),g=t.map(o),v=[];for(let a=0;a<e.length;a++){let r=e[a],n=g.indexOf(r.key);-1!==n?(v.push(r),h[n]=1,p(t[n],r.asyncValue)):(r.active=0,r.instance&&_(r.instance),u(r.asyncValue))}for(let e=0;e<t.length;e++){if(h[e])continue;let n=t[e],o=g[e],u=s(a.ops.group.queue),p={type:'LF',parent:d,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},f={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:i},asyncValue:c({value:n,group:u,onTerminate(e){},onChange(e){f.instance&&f.instance.api.itemUpdater(e)},onInit(e){f.active&&(l||(f.instance=C(r,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:u,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage})))}})},m=v.length;v.push(f);let k=m>0?v[m-1].leafData:null;if(p.child.parent=p,d.child.push(p),k){let e=k.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):d.lastChild=p,e.right=p}else d.lastChild=p;l&&(f.instance=C(r,{values:{id:o,store:n},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:u,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage}))}return ee('list update ['+n.shortName+']'),0===v.length&&(d.lastChild=null),f.records=v,v},target:h})},env:f}))}function J(e){if(!se)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(se.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=se.draft.childCount,se.draft.childCount+=1,se.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+se.draft.type)}}function K({mount:e,state:t,onMount:a,onState:r}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:r,greedy:1})}}function X(e,t){let a=[e[0]];for(let r=0;r<t.length;r++)a.push(t[r],e[r+1]);return a}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let Y,ee,te;'undefined'!=typeof performance&&performance.mark?(Y=e=>{performance.mark('☄️ '+e+' start')},ee=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(Y=()=>{},ee=()=>{}),te='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let ae='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const re={attr:k,data:m,style:v,styleVar:g};let ne=0,le=0,oe=null,ie=null,se=null;const ce=(e,t)=>e.reg[t.id];let ue=null,pe=effector.createEvent();pe.watch((({fns:e,element:t})=>{e.forEach((e=>{e(t)}))}));const fe={using(e){let t=e.data;O(t.draft,{parentBlockFragment:t.block.child,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.child.visible=1,O(t,{parentBlockFragment:a.block.child.child,leaf:e})},block(e){O(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},blockItem(e){F({parentBlockFragment:e.data.block.child,leaf:e,actor:e.draft.itemOf})},rec(e){O(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,O(t.listDraft,{parentBlockFragment:a.child,leaf:e})}};exports.block=({fn:e,env:t,namespace:a="html"})=>{let r=b({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(fe.block)}});return()=>{z(se,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:r},{env:t,namespace:a}=se;J(b({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(fe.blockItem)}}))}},exports.h=(e,t)=>{function a(e){return e.data.block.value}function l(e,t,a){let r=e.data.block.child,n={type:'text',parent:r,visible:0,index:a,value:null};if(r.child[a]=n,e.hydration){let a=A(n);if(a)switch(a.type){case'text':n.value=e.env.document.createTextNode(t),a.value.after(n.value);break;case'element':n.value=a.value.nextSibling,y(n.value,t)}else{let e=R(n);n.value=e.firstChild,y(n.value,t)}n.visible=1}else n.value=e.env.document.createTextNode(t),N(n);return n}let i,s=0,c=0;'function'==typeof t?(s=1,i=t):t&&(c=1,t.fn&&(s=1,i=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,i=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,i=t.ɔ.fn))),z(se,'h');let u,p=se.env,f=se.namespace,h=f,w='html';h=w='svg'===f?'svg':'html','svg'===e&&(w='svg',h='svg'),se.isBlock||(u='svg'===w?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=u,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===f?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),h='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),h='svg'):'foreignObject'===e&&(h='foreignObject');let S=b({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:h,fn(e,{mount:u}){function p(e){return K({mount:f,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let f=effector.createEvent();s&&i(),c&&Q(t);let h={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?h.attr.href=t[e]:h.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)h.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?h.styleVar[e.slice(2)]=t[e]:h.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)h.styleVar[e]=t[e]}h.visible&&I.seq.push({type:'visible',value:h.visible});for(let e in h.attr){let t=h.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in h.data){let t=h.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in h.styleProp){let t=h.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in h.styleVar){let t=h.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<h.text.length;e++){let t=h.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=oe;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<h.handler.length;e++){let t=h.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(h.visible){let{onMount:e,onState:t}=K({mount:u,state:h.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch((({leaf:e,value:t,hydration:a})=>{let n=e.data,l=n.block;if(a&&(r(t,n.ops.visible),t)){let e,t=D(l);if(e=t?t.nextSibling:R(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}O(I,{parentBlockFragment:l.child,leaf:e,node:l.value,svgRoot:S.isSvgRoot?l.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:pe,params:{element:n.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})})),effector.merge([t,e]).watch((({leaf:e,value:t,hydration:a})=>{a||n(t,e.data.ops.visible)}))}P&&d(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,r='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:l,onState:i}=p(t.value);if(r)effector.merge([i,l]).watch((({leaf:t,value:r})=>{k(a(t),e,r)}));else{let t=I.opsAmount++;l.watch((({value:r,leaf:n})=>{let l=a(n),i=o({value:r,priority:'props',runOp(t){k(l,e,t)},group:n.ops.group});n.ops.group.ops[t]=i,k(l,e,r)})),i.watch((({value:e,leaf:a})=>{n(e,a.ops.group.ops[t])}))}break}case'data':{let{field:e}=t,{onMount:r,onState:l}=p(t.value),i=I.opsAmount++;r.watch((({value:t,leaf:r})=>{let n=a(r),l=o({value:t,priority:'props',runOp(t){m(n,e,t)},group:r.ops.group});r.ops.group.ops[i]=l,m(n,e,t)})),l.watch((({value:e,leaf:t})=>{n(e,t.ops.group.ops[i])}));break}case'style':{let e=I.opsAmount++,{field:r}=t,{onMount:l,onState:i}=p(t.value);l.watch((({value:t,leaf:n})=>{let l=a(n),i=o({value:t,priority:'props',runOp(e){v(l,r,e)},group:n.ops.group});n.ops.group.ops[e]=i,v(l,r,t)})),i.watch((({value:t,leaf:a})=>{n(t,a.ops.group.ops[e])}));break}case'styleVar':{let{field:e}=t,{onMount:r,onState:l}=p(t.value),i=I.opsAmount++;r.watch((({value:t,leaf:r})=>{let n=a(r),l=o({value:t,priority:'props',runOp(t){g(n,e,t)},group:r.ops.group});r.ops.group.ops[i]=l,g(n,e,t)})),l.watch((({value:e,leaf:t})=>{n(e,t.ops.group.ops[i])}));break}case'staticText':f.watch((e=>{l(e,t.value,t.childIndex)}));break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:f,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch((({value:a,leaf:r})=>{let n=o({value:a,priority:'props',runOp(e){y(i.value,e)},group:r.ops.group});r.ops.group.ops[e]=n;let i=l(r,a,t.childIndex)})),effector.sample({source:f,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch((({leaf:t,text:a})=>{n(a,t.ops.group.ops[e])}));break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;f.watch((r=>{let n=null;if(e){let t=0,a=r.spawn;for(;!t&&a;)a.template===e?(t=1,n=a):a=a.parent}a(r).addEventListener(t.for,(e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:x(t.handler,r.forkPage),params:e,page:n,forkPage:r.forkPage})}),t.domConfig)}));break}}}u.watch((e=>{let t=e.data;if(!I.visible){let a=t.ops.visible,l=t.block;if(e.hydration){r(1,a);let e,t=D(l);if(e=t?t.nextSibling:R(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}O(I,{parentBlockFragment:l.child,leaf:e,node:l.value,svgRoot:S.isSvgRoot?l.value:null}),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:pe,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):n(1,a)}}))},env:p});J(S)},exports.handler=U,exports.list=H,exports.node=e=>{z(se,'node');let t=se.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},exports.rec=Z,exports.remap=M,exports.route=$,exports.spec=Q,exports.text=(e,...t)=>{Q({text:X(e,t)})},exports.tree=({source:e,key:t,child:a,fn:r})=>{let n=Z((({store:e})=>{H({source:e,key:t,fn({store:e}){let t=e.map((e=>e[a]||[]));r({store:e,child(){n({store:t})}})}})}));n({store:e})},exports.using=(e,t)=>{let a,r,n,l,o,c;if('function'==typeof t)a=t,n=G(),l=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,n=t.env?t.env:G(),l=t.hydrate,r=t.onComplete,o=t.onRoot,c=t.scope}j(e,'using() first argument is missing');let u=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=b({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(fe.using)},env:n}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h,(e=>{if(e&&!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let r=e.clones[a];t[r.meta.forkOf.id]=r}e.nodeMap=t}})(c);let g=i({onComplete:r}),v=C(d,{parentLeaf:ie||null,mountNode:e,svgRoot:d.isSvgRoot?e:ie?ie.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:s(g),domSubtree:s(g),hydration:l,forkPage:c,env:n});if(o&&o({template:d,leaf:v}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},exports.val=(e,...t)=>t.every((e=>!effector.is.store(e)))?X(e,t).join(''):effector.combine(t,(t=>X(e,t).join(''))),exports.variant=({source:e,cases:t,key:a})=>{let r;z(se,'variant'),j(effector.is.unit(e),'variant({source}) should be unit'),r='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let n=0;for(let a in t)'__'!==a?$({source:e,visible:e=>r(e)===a,fn:t[a]}):n=1;if(n){let a=Object.keys(t);$({source:e,visible:e=>!a.includes(r(e)),fn:t.__})}};
//# sourceMappingURL=forest.cjs.js.map

@@ -1,2 +0,2 @@

import {Store, Event, Fork} from 'effector'
import {Store, Event, Scope} from 'effector'

@@ -61,3 +61,3 @@ export type StoreOrData<T> = Store<T> | T

onComplete?: () => void
scope?: Fork
scope?: Scope
},

@@ -204,4 +204,11 @@ ): void

export function block(config: {fn: () => void}): () => void
export function node(fn: (node: DOMElement) => void): void
export function text(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function remap<T extends {[field: string]: any}, S extends keyof T>(

@@ -219,7 +226,9 @@ store: Store<T>,

export function text(
export function val(
words: TemplateStringsArray,
...values: Array<string | number>
): string
export function val(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function block(config: {fn: () => void}): () => void
): Store<string>

@@ -1,2 +0,2 @@

import {Store, Event, Fork} from 'effector'
import {Store, Event, Scope} from 'effector'

@@ -61,3 +61,3 @@ export type StoreOrData<T> = Store<T> | T

onComplete?: () => void
scope?: Fork
scope?: Scope
},

@@ -204,4 +204,11 @@ ): void

export function block(config: {fn: () => void}): () => void
export function node(fn: (node: DOMElement) => void): void
export function text(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function remap<T extends {[field: string]: any}, S extends keyof T>(

@@ -219,7 +226,9 @@ store: Store<T>,

export function text(
export function val(
words: TemplateStringsArray,
...values: Array<string | number>
): string
export function val(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function block(config: {fn: () => void}): () => void
): Store<string>

@@ -1,2 +0,2 @@

((e,t)=>{'object'==typeof exports&&'undefined'!=typeof module?t(exports,require('effector')):'function'==typeof define&&define.amd?define(['exports','effector'],t):t((e=e||self).forest={},e.effector)})(this,(e,effector)=>{function t(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function a(e){e.status='active',((e,t)=>{t.cursor.prev&&(t.cursor.prev.cursor.next=t.cursor.next),t.cursor.next&&(t.cursor.next.cursor.prev=t.cursor.prev),e.last===t&&(e.last=t.cursor.prev),e.first===t&&(e.first=t.cursor.next),t.cursor.prev=null,t.cursor.next=null})(n(e),e)}function n(e){return e.group.activeChilds[e.priority]}function r(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&a(t)}function l(e,r){if(r.value.active===e)return r.value.pending=e,void('pending'===r.status&&(a(r),n(r).first||t(r.group,r.priority)));'active'===r.status&&(r.status='pending',n(r).first||((e,t)=>{e.queue[t].last?(e.cursor[t].prev=e.queue[t].last,e.queue[t].last.cursor[t].next=e,e.queue[t].last=e):e.queue[t].first=e.queue[t].last=e})(r.group,r.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(n(r),r)),r.value.pending=e,r.group.queue.rafID||(r.group.queue.rafID=te(r.group.queue.execQueue))}function o(e){X('execQueue');let n,r,l=ee(),o=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(ee()-l>=10){o=1;break e}let i=!!e.props.first;for(i&&X('props');n=e.props.first;){for(;r=n.activeChilds.props.first;){if(ee()-l>=10){o=1,Y('props');break e}r.runOp(r.value.pending),r.value.active=r.value.pending,a(r)}t(n,'props')}i&&Y('props');let s=!!e.tree.first;for(s&&X('tree');n=e.tree.first;){for(;r=n.activeChilds.tree.first;){if(ee()-l>=10){o=1,Y('tree');break e}r.runOp(r.value.pending),r.value.active=r.value.pending,a(r)}t(n,'tree')}s&&Y('tree');let c=!!e.data.first;for(c&&X('data');n=e.data.first;){for(;r=n.activeChilds.data.first;){if(ee()-l>=10){o=1,Y('data');break e}r.runOp(r.value.pending),r.value.active=r.value.pending,a(r)}t(n,'data')}c&&Y('data')}if(Y('execQueue'),o)e.rafID=te(e.execQueue);else if(e.rafID=null,e.onDrain){let t=e.onDrain;e.onDrain=null,t()}}function i({value:e,runOp:t,group:a,priority:n}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:n,group:a,cursor:{prev:null,next:null}}}function s({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=o.bind(null,t),t}function c(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function u({value:e,group:t,onInit:a,onChange:n,onTerminate:r}){let o=i({value:e,group:t,runOp(e){s.status='A',n(e)},priority:'data'}),s={status:'IA',value:o.value,hooks:{onTerminate:r},ops:{init:i({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:o,terminate:i({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return l(1,s.ops.init),s}function p(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',l(1,e.ops.terminate);break;case'AA':e.status='AT',l(1,e.ops.terminate),l(e.value.active,e.ops.change);break;case'IA':e.status='T',l(0,e.ops.init),e.hooks.onTerminate(0)}}function f(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',l(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',l(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function d(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function h(e,t){for(let a=0;a<t.length;a++){let{type:n,field:r,value:l}=t[a];ae[n](e,r,l)}}function g(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function v(e,t,a){g(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function m(e,t,a){g(a)?delete e.style[t]:e.style[t]=""+a}function k(e,t,a){g(a)?delete e.dataset[t]:e.dataset[t]=""+a}function y(e,t,a){if(g(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function b(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function w({fn:e,state:t={},defer:a=0,name:n="",draft:r,isSvgRoot:l,namespace:o,env:i,isBlock:s=0}){let c=ie,u=le,p={id:++ne,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return console.count('inactive page upward'),0;let n=[a.page.template],r=[a.page];{let e=a.page.parent;for(;e;)r.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let l=t.meta.nativeTemplate;l?n.includes(l)?effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:r[n.indexOf(l)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let n=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return console.count('inactive page loader'),0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let r=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===r?{params:e,target:x(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:x(a.node,a.forkPage),page:n[r],defer:1,forkPage:a.forkPage})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})})}else p.pages.forEach(t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})});return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});le=p;let d=ie={template:p,node:f,api:null,trigger:{mount:effector.createEvent()},draft:r,isSvgRoot:l,namespace:o,env:i,isBlock:s||!(!c||!c.isBlock)};return a?d.deferredInit=()=>{let a=ie,n=le;ie=d,le=p,d.deferredInit=null;try{effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{ie=a,le=n}}:effector.withRegion(f,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),ie=c,le=u,p.actor=d,d}function x(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function P(e,t){let a=e;switch(t&&se(t,e)&&(a=se(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function I(e,t,a){let n=t;for(;n&&!se(n.spawn,e);)n=n.parentLeaf;return n?se(n.spawn,e):a&&se(a,e)?se(a,e):e}function S(e,t,a){return I(e,t,a).current}function C(e,t){se(t.spawn,e)||(t.spawn.reg[e.id]=I(e,t.parentLeaf,t.forkPage))}function T(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:r,leafData:l,opGroup:o,domSubtree:i,hydration:s,forkPage:c,env:u}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;C(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;C(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':C(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let n=e.after[a],r=n.to;switch(g[r.id]||(g[r.id]={id:r.id,current:S(r,k.parentLeaf,c)}),n.type){case'copy':g[r.id].current=t;break;case'map':g[r.id].current=n.fn(t)}}}function f(e,t,a){let n;t.stop=1;try{for(;t.i<e.length;)n=e[t.i],t.i++,n.fn(a[n.of.id]?a[n.of.id].current:S(n.of,k.parentLeaf,c))}catch(e){console.error(e),t.stop=0}}!u&&a&&(u=a.env);let d=a?a.spawn:null,h=e.template,g={},v={id:++re,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(v);let m={},k={actor:e,spawn:v,api:m,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:r,data:l,parentLeaf:a,hydration:s,forkPage:c,env:u,mountNode:n},y=oe;oe=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(v)),v.fullID=d?`${d.fullID}_${v.id}`:""+v.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,n=v.parent;e:for(;n;){if(se(n,t)){a=se(n,t);break e}n=n.parent}!n&&c&&se(c,t)&&(a=se(c,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:P(t,c)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in v.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...v.childSpawns[e]);if(m.mount=(t,a=1)=>(e=>{if(ce)return void ce.steps.push(e);let t;ce={parent:ce,steps:[e]};do{for(;t=ce.steps.shift();)ce={parent:ce,steps:[]},effector.launch(t)}while(ce=ce.parent)})({target:e.trigger.mount,params:t,defer:a,page:v,forkPage:c}),e.api)for(let t in e.api)m[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:v,forkPage:c});return k.spawn.api=m,k.spawn.leaf=k,k.api.mount(k),oe=y,k}function R(e){let t=function e(t){switch(t.type){case'using':return t;case'fragment':switch(t.parent.type){case'element':case'using':return t.parent}default:return e((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;case'fragment':default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(t))}}(e);return t?t.value:null}function q(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return q(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=q(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=q(t);if(e)return e;t=t.left}return null}default:return null}}function A(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=q(a.child[e]);if(t)return t}return A(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=q(a.child[e]);if(t)return t}return A(a)}case'LF':{let t=e.parent.left;for(;t;){let e=q(t);if(e)return e;t=t.left}return A(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=q(e);if(n)return n}return A(t)}default:return null}}function D(e){let t=A(e);return t?t.value:null}function O(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l}){e.childTemplates.forEach(e=>{F({parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l,actor:e})})}function F({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:n,svgRoot:r,values:l}){let o,{draft:s}=n,{queue:u}=t.ops.group,p=c(u),f=t.ops.domSubtree,d=f;switch(s.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:s.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[s.inParentIndex]=t,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(n.isBlock){let e,n,r=t;for(;r&&(!n||!e);){r.actor.env&&(e=r.actor.env);let{draft:t}=r;'element'===t.type&&('svg'===t.tag?n='svg':'foreignObject'===t.tag&&(n='html')),r=r.parentLeaf}n||(n='html'),e&&(a='svg'===n?e.document.createElementNS('http://www.w3.org/2000/svg',s.tag):e.document.createElement(s.tag),h(a,s.staticSeq))}else a=s.stencil.cloneNode();let r={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:s.inParentIndex};r.child.parent=r,e.child[s.inParentIndex]=r,o={type:'element',block:r,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(N(r),o.needToCallNode&&(o.needToCallNode=0,effector.launch({target:ue,params:{element:r.value,fns:s.node},page:g.spawn,forkPage:t.forkPage}))):(r.value.remove(),r.visible=0)},group:f})},needToCallNode:s.node.length>0},d=c(u);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'list',draft:s,block:t,records:[]};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block item',block:t};break}default:console.warn("unexpected draft type "+s.type)}let g=T(n,{values:l,parentLeaf:t,mountNode:a,svgRoot:r||t.svgRoot,leafData:o,opGroup:p,domSubtree:d,hydration:t.hydration,forkPage:t.forkPage})}function N(e){let t=D(e);t?t.after(e.value):R(e).prepend(e.value),e.visible=1}function M(e,t){if(Array.isArray(t))return t.map(t=>e.map(e=>e[t]));if('object'==typeof t&&null!==t){let a={};for(let n in t){let r=t[n];a[n]=e.map('function'==typeof r?e=>r(e):e=>e[r])}return a}return e.map(e=>e[t])}function E(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let n=a.childSpawns[e];for(let e=0;e<n.length;e++)t(n[e].leaf)}}function B(e){e.spawn.active=0,E(e,_)}function V({spawn:e}){L(e,e.parent.childSpawns[e.template.id]),L(e,e.template.pages)}function _(e){let{spawn:t,data:a}=e;switch(a.type){case'element':L(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,L(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,a.ops.visible);break;case'list':{let t=a.records;for(let e=0;e<t.length;e++){let a=t[e];a.instance&&_(a.instance),a.active=0}e.spawn.active=0,V(e);break}case'list item':{let t=a.block;L(t,t.parent.child);let n=t.left,r=t.right;n&&(n.right=r,r||t.parent.lastChild!==t||(t.parent.lastChild=n)),r&&(r.left=n),n||r||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,B(e),V(e);break}case'route':B(e),V(e);break;case'block':case'block item':case'rec':case'rec item':B(e)}}function L(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function j(e,t){if(!e)throw Error(t)}function z(e,t){if(!e)throw Error(t+"() called outside from using() closure")}function G(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function Q(e){z(ie,'spec');let t=ie.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,n=t.childCount;Array.isArray(a)?(t.text.push(...a.map((e,t)=>({index:t+n,value:e}))),t.childCount+=a.length):(t.text.push({index:n,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[d(t)]=e.style[t];t.styleProp.push(a)}if(e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?U(t.config||{},t.on):U(t)}e.ɔ&&Q(e.ɔ)}function U(e,t){if(!ie)return;let a=ie.draft;j('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)j(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:n=0,capture:r=0,prevent:l=0,stop:o=0}=e;a.handler.push({options:{prevent:l,stop:o},domConfig:{passive:l?0:n,capture:r},map:t})}function $({source:e,visible:t,fn:a}){z(ie,'route');let{env:n,namespace:r}=ie,l=w({name:'route',isSvgRoot:0,namespace:r,env:n,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(l,{mount:o}){let i;if(effector.is.store(t))i=effector.combine({value:e,visible:t});else{let a=t;i=e.map(e=>({value:e,visible:a(e)}))}let s=w({name:'route item',isSvgRoot:0,namespace:r,env:n,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let n=effector.createEvent();e.on(n,(e,t)=>t),a({store:e});let r=effector.sample({source:t,clock:i,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(pe.routeItem),r.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:n,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),W(t,e)})}});J(s);let{onMount:c,onState:u}=K({mount:o,state:i,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})});effector.merge([c,u]).watch(({leaf:e,visible:t,value:a})=>{let n=e.data;n.block.child.visible=t,t&&!n.initialized&&(F({parentBlockFragment:n.block.child.child,leaf:e,actor:s,values:{store:a}}),n.initialized=1)})}});J(l)}function W(e,t){let a=t=>{let n=t.data;switch(n.type){case'element':l(e,n.ops.visible);break;case'route':case'list':case'list item':E(t,a);break;default:console.log('unsupported type',n.type)}};E(t,a)}function Z(e){let t='function'==typeof e?e:e.fn,a=w({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let n=effector.createEvent();return e.on(n,(e,t)=>t),a.watch(pe.rec),{itemUpdater:n}}});return({store:e,state:t=e})=>{z(ie,'(rec instance)');let{env:n,namespace:r}=ie;a.deferredInit&&a.deferredInit(),J(w({name:'rec item',isSvgRoot:0,namespace:r,env:n,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:n}){let{onMount:r,onState:l}=K({state:t,mount:n,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});l.watch(({state:e,leaf:t})=>{E(t,t=>{t.api.itemUpdater(e)})}),r.watch(({leaf:e,state:t})=>{F({parentBlockFragment:e.data.block.child,leaf:e,actor:a,values:{store:t}})})}}))}}function H(e,t){z(ie,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:r,fields:l=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:s,namespace:d}=ie;J(w({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t}){let n=w({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:n}){a({store:t,key:e,fields:M(t,l)});let r=effector.createEvent();if(t.on(r,(e,t)=>t),i.itemVisible){let{onMount:e,onState:t}=K({mount:n,state:i.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch(({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&O(i,{parentBlockFragment:a.child,leaf:t})}),t.watch(({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?W(e,t):e&&(a.childInitialized=1,O(i,{parentBlockFragment:a.child,leaf:t}))})}else n.watch(pe.listItem);return{itemUpdater:r}},env:s}),h=effector.createStore([]),g=r.map(e=>e),v=effector.sample({source:r,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),m=effector.sample({source:v,clock:g,fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});effector.sample({source:h,clock:[v,m],greedy:1,fn(e,{updates:t,leaf:a,hydration:l}){let s=a.data,d=s.block;X('list update ['+r.shortName+']');let h=Array(t.length).fill(0),g=t.map(o),v=[];for(let a=0;a<e.length;a++){let n=e[a],r=g.indexOf(n.key);-1!==r?(v.push(n),h[r]=1,f(t[r],n.asyncValue)):(n.active=0,n.instance&&_(n.instance),p(n.asyncValue))}for(let e=0;e<t.length;e++){if(h[e])continue;let r=t[e],o=g[e],s=c(a.ops.group.queue),p={type:'LF',parent:d,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},f={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:i},asyncValue:u({value:r,group:s,onTerminate(e){},onChange(e){f.instance&&f.instance.api.itemUpdater(e)},onInit(e){f.active&&(l||(f.instance=T(n,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:s,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage})))}})},m=v.length;v.push(f);let k=m>0?v[m-1].leafData:null;if(p.child.parent=p,d.child.push(p),k){let e=k.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):d.lastChild=p,e.right=p}else d.lastChild=p;l&&(f.instance=T(n,{values:{id:o,store:r},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:s,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage}))}return Y('list update ['+r.shortName+']'),0===v.length&&(d.lastChild=null),s.records=v,v},target:h})},env:s}))}function J(e){if(!ie)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(ie.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=ie.draft.childCount,ie.draft.childCount+=1,ie.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+ie.draft.type)}}function K({mount:e,state:t,onMount:a,onState:n}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:n,greedy:1})}}let X,Y,ee;'undefined'!=typeof performance&&performance.mark?(X=e=>{performance.mark('☄️ '+e+' start')},Y=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(X=()=>{},Y=()=>{}),ee='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let te='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const ae={attr:y,data:k,style:m,styleVar:v};let ne=0,re=0,le=null,oe=null,ie=null;const se=(e,t)=>e.reg[t.id];let ce=null,ue=effector.createEvent();ue.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})});const pe={using(e){let t=e.data;O(t.draft,{parentBlockFragment:t.block.child,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.child.visible=1,O(t,{parentBlockFragment:a.block.child.child,leaf:e})},block(e){O(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},blockItem(e){F({parentBlockFragment:e.data.block.child,leaf:e,actor:e.draft.itemOf})},rec(e){O(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,O(t.listDraft,{parentBlockFragment:a.child,leaf:e})}};e.block=({fn:e,env:t,namespace:a="html"})=>{let n=w({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(pe.block)}});return()=>{z(ie,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:n},{env:t,namespace:a}=ie;J(w({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(pe.blockItem)}}))}},e.h=(e,t)=>{function a(e){return e.data.block.value}function n(e,t,a){let n=e.data.block.child,r={type:'text',parent:n,visible:0,index:a,value:null};if(n.child[a]=r,e.hydration){let a=A(r);if(a)switch(a.type){case'text':r.value=e.env.document.createTextNode(t),a.value.after(r.value);break;case'element':r.value=a.value.nextSibling,b(r.value,t)}else{let e=R(r);r.value=e.firstChild,b(r.value,t)}r.visible=1}else r.value=e.env.document.createTextNode(t),N(r);return r}let o,s=0,c=0;'function'==typeof t?(s=1,o=t):t&&(c=1,t.fn&&(s=1,o=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,o=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,o=t.ɔ.fn))),z(ie,'h');let u,p=ie.env,f=ie.namespace,d=f,g='html';d=g='svg'===f?'svg':'html','svg'===e&&(g='svg',d='svg'),ie.isBlock||(u='svg'===g?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=u,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===f?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),d='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),d='svg'):'foreignObject'===e&&(d='foreignObject');let S=w({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:u}){function p(e){return K({mount:f,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let f=effector.createEvent();s&&o(),c&&Q(t);let d={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?d.attr.href=t[e]:d.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)d.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?d.styleVar[e.slice(2)]=t[e]:d.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)d.styleVar[e]=t[e]}d.visible&&I.seq.push({type:'visible',value:d.visible});for(let e in d.attr){let t=d.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in d.data){let t=d.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in d.styleProp){let t=d.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in d.styleVar){let t=d.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<d.text.length;e++){let t=d.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=le;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<d.handler.length;e++){let t=d.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(d.visible){let{onMount:e,onState:t}=K({mount:u,state:d.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch(({leaf:e,value:t,hydration:a})=>{let n=e.data,l=n.block;if(a&&(r(t,n.ops.visible),t)){let e,t=D(l);if(e=t?t.nextSibling:R(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}O(I,{parentBlockFragment:l.child,leaf:e,node:l.value,svgRoot:S.isSvgRoot?l.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:ue,params:{element:n.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}P&&h(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,n='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:r,onState:o}=p(t.value);if(n)effector.merge([o,r]).watch(({leaf:t,value:n})=>{y(a(t),e,n)});else{let t=I.opsAmount++;r.watch(({value:n,leaf:r})=>{let l=a(r),o=i({value:n,priority:'props',runOp(t){y(l,e,t)},group:r.ops.group});r.ops.group.ops[t]=o,y(l,e,n)}),o.watch(({value:e,leaf:a})=>{l(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:r}=p(t.value),o=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let r=a(n),l=i({value:t,priority:'props',runOp(t){k(r,e,t)},group:n.ops.group});n.ops.group.ops[o]=l,k(r,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'style':{let e=I.opsAmount++,{field:n}=t,{onMount:r,onState:o}=p(t.value);r.watch(({value:t,leaf:r})=>{let l=a(r),o=i({value:t,priority:'props',runOp(e){m(l,n,e)},group:r.ops.group});r.ops.group.ops[e]=o,m(l,n,t)}),o.watch(({value:t,leaf:a})=>{l(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:r}=p(t.value),o=I.opsAmount++;n.watch(({value:t,leaf:n})=>{let r=a(n),l=i({value:t,priority:'props',runOp(t){v(r,e,t)},group:n.ops.group});n.ops.group.ops[o]=l,v(r,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'staticText':f.watch(e=>{n(e,t.value,t.childIndex)});break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:f,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:r})=>{let l=i({value:a,priority:'props',runOp(e){b(o.value,e)},group:r.ops.group});r.ops.group.ops[e]=l;let o=n(r,a,t.childIndex)}),effector.sample({source:f,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{l(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;f.watch(n=>{let r=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,r=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:x(t.handler,n.forkPage),params:e,page:r,forkPage:n.forkPage})},t.domConfig)});break}}}u.watch(e=>{let t=e.data;if(!I.visible){let a=t.ops.visible,n=t.block;if(e.hydration){r(1,a);let e,t=D(n);if(e=t?t.nextSibling:R(n).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}n.value=e,n.visible=1}O(I,{parentBlockFragment:n.child,leaf:e,node:n.value,svgRoot:S.isSvgRoot?n.value:null}),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:ue,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):l(1,a)}})},env:p});J(S)},e.handler=U,e.list=H,e.node=e=>{z(ie,'node');let t=ie.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},e.rec=Z,e.remap=M,e.route=$,e.spec=Q,e.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);Q({text:a})},e.tree=({source:e,key:t,child:a,fn:n})=>{let r=Z(({store:e})=>{H({source:e,key:t,fn({store:e}){let t=e.map(e=>e[a]||[]);n({store:e,child(){r({store:t})}})}})});r({store:e})},e.using=(e,t)=>{let a,n,r,l,o,i;if('function'==typeof t)a=t,r=G(),l=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,r=t.env?t.env:G(),l=t.hydrate,n=t.onComplete,o=t.onRoot,i=t.scope}j(e,'using() first argument is missing');let u=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=w({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(pe.using)},env:r}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h,(e=>{if(e&&!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let n=e.clones[a];t[n.meta.forkOf.id]=n}e.nodeMap=t}})(i);let g=s({onComplete:n}),v=T(d,{parentLeaf:oe||null,mountNode:e,svgRoot:d.isSvgRoot?e:oe?oe.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:c(g),domSubtree:c(g),hydration:l,forkPage:i,env:r});if(o&&o({template:d,leaf:v}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},e.variant=({source:e,cases:t,key:a})=>{let n;z(ie,'variant'),j(effector.is.unit(e),'variant({source}) should be unit'),n='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let r=0;for(let a in t)'__'!==a?$({source:e,visible:e=>n(e)===a,fn:t[a]}):r=1;if(r){let a=Object.keys(t);$({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}},Object.defineProperty(e,'__esModule',{value:1})});
((e,t)=>{'object'==typeof exports&&'undefined'!=typeof module?t(exports,require('effector')):'function'==typeof define&&define.amd?define(['exports','effector'],t):t((e='undefined'!=typeof globalThis?globalThis:e||self).forest={},e.effector)})(this,((e,effector)=>{function t(e,t){e.cursor[t].prev&&(e.cursor[t].prev.cursor[t].next=e.cursor[t].next),e.cursor[t].next&&(e.cursor[t].next.cursor[t].prev=e.cursor[t].prev),e.queue[t].last===e&&(e.queue[t].last=e.cursor[t].prev),e.queue[t].first===e&&(e.queue[t].first=e.cursor[t].next),e.cursor[t].prev=null,e.cursor[t].next=null}function a(e){e.status='active',((e,t)=>{t.cursor.prev&&(t.cursor.prev.cursor.next=t.cursor.next),t.cursor.next&&(t.cursor.next.cursor.prev=t.cursor.prev),e.last===t&&(e.last=t.cursor.prev),e.first===t&&(e.first=t.cursor.next),t.cursor.prev=null,t.cursor.next=null})(n(e),e)}function n(e){return e.group.activeChilds[e.priority]}function r(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&a(t)}function l(e,r){if(r.value.active===e)return r.value.pending=e,void('pending'===r.status&&(a(r),n(r).first||t(r.group,r.priority)));'active'===r.status&&(r.status='pending',n(r).first||((e,t)=>{e.queue[t].last?(e.cursor[t].prev=e.queue[t].last,e.queue[t].last.cursor[t].next=e,e.queue[t].last=e):e.queue[t].first=e.queue[t].last=e})(r.group,r.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(n(r),r)),r.value.pending=e,r.group.queue.rafID||(r.group.queue.rafID=ne(r.group.queue.execQueue))}function o(e){ee('execQueue');let n,r,l=ae(),o=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(ae()-l>=10){o=1;break e}let i=!!e.props.first;for(i&&ee('props');n=e.props.first;){for(;r=n.activeChilds.props.first;){if(ae()-l>=10){o=1,te('props');break e}r.runOp(r.value.pending),r.value.active=r.value.pending,a(r)}t(n,'props')}i&&te('props');let s=!!e.tree.first;for(s&&ee('tree');n=e.tree.first;){for(;r=n.activeChilds.tree.first;){if(ae()-l>=10){o=1,te('tree');break e}r.runOp(r.value.pending),r.value.active=r.value.pending,a(r)}t(n,'tree')}s&&te('tree');let c=!!e.data.first;for(c&&ee('data');n=e.data.first;){for(;r=n.activeChilds.data.first;){if(ae()-l>=10){o=1,te('data');break e}r.runOp(r.value.pending),r.value.active=r.value.pending,a(r)}t(n,'data')}c&&te('data')}if(te('execQueue'),o)e.rafID=ne(e.execQueue);else if(e.rafID=null,e.onDrain){let t=e.onDrain;e.onDrain=null,t()}}function i({value:e,runOp:t,group:a,priority:n}){return{value:{active:e,pending:e},runOp:t,status:'active',priority:n,group:a,cursor:{prev:null,next:null}}}function s({onComplete:e}){let t={props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null},rafID:null,execQueue(){},onDrain:e};return t.execQueue=o.bind(null,t),t}function c(e){return{ops:[],queue:e,activeChilds:{props:{first:null,last:null},tree:{first:null,last:null},data:{first:null,last:null}},cursor:{props:{prev:null,next:null},tree:{prev:null,next:null},data:{prev:null,next:null}}}}function u({value:e,group:t,onInit:a,onChange:n,onTerminate:r}){let o=i({value:e,group:t,runOp(e){s.status='A',n(e)},priority:'data'}),s={status:'IA',value:o.value,hooks:{onTerminate:r},ops:{init:i({value:0,group:t,runOp(e){s.status='A',a(s.value.active)},priority:'data'}),change:o,terminate:i({value:0,group:t,runOp(e){s.status='T',s.hooks.onTerminate(1)},priority:'data'})}};return l(1,s.ops.init),s}function p(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',l(1,e.ops.terminate);break;case'AA':e.status='AT',l(1,e.ops.terminate),l(e.value.active,e.ops.change);break;case'IA':e.status='T',l(0,e.ops.init),e.hooks.onTerminate(0)}}function f(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',l(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',l(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function d(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return e.replace(/[^a-zA-Z0-9\-_]/g,'')}}function h(e,t){for(let a=0;a<t.length;a++){let{type:n,field:r,value:l}=t[a];re[n](e,r,l)}}function g(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function v(e,t,a){g(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function m(e,t,a){g(a)?delete e.style[t]:e.style[t]=""+a}function k(e,t,a){g(a)?delete e.dataset[t]:e.dataset[t]=""+a}function y(e,t,a){if(g(a)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==a)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=""+a;break;case'checked':e.checked=""+a}e.setAttribute(t,""+a)}}function b(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function w({fn:e,state:t={},defer:a=0,name:n="",draft:r,isSvgRoot:l,namespace:o,env:i,isBlock:s=0}){let c=ce,u=ie,p={id:++le,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page){if(!a.parent||!a.parent.page)return 1;a.page=a.parent.page}if(!a.page.active)return console.count('inactive page upward'),0;let n=[a.page.template],r=[a.page];{let e=a.page.parent;for(;e;)r.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach((t=>{let l=t.meta.nativeTemplate;l?n.includes(l)?effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:r[n.indexOf(l)],stack:a,forkPage:a.forkPage}):console.error('context drift',{stack:a,node:t}):effector.launch({target:x(t,a.forkPage),params:e,defer:1,page:null,stack:a,forkPage:a.forkPage})})),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){let n=a.forkPage?a.forkPage.graphite.id:null;if(a.page){if(!a.page.active)return console.count('inactive page loader'),0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach((t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})}));else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let r=n.findIndex((e=>t.targetTemplate===e.template));effector.launch(-1===r?{params:e,target:x(a.node,a.forkPage),page:null,defer:1,forkPage:a.forkPage}:{params:e,target:x(a.node,a.forkPage),page:n[r],defer:1,forkPage:a.forkPage})}else p.pages.forEach((t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})}))}else p.pages.forEach((t=>{(!n||t.leaf.forkPage&&n===t.leaf.forkPage.graphite.id)&&effector.launch({params:e,target:x(a.node,a.forkPage),page:t,defer:1,forkPage:a.forkPage})}));return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let f=effector.createNode({meta:{template:p}});ie=p;let d=ce={template:p,node:f,api:null,trigger:{mount:effector.createEvent()},draft:r,isSvgRoot:l,namespace:o,env:i,isBlock:s||!(!c||!c.isBlock)};return a?d.deferredInit=()=>{let a=ce,n=ie;ce=d,ie=p,d.deferredInit=null;try{effector.withRegion(f,(()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}))}finally{ce=a,ie=n}}:effector.withRegion(f,(()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})),ce=c,ie=u,p.actor=d,d}function x(e,t){return t&&t.nodeMap[(e=e.graphite||e).id]||e}function P(e,t){let a=e;switch(t&&ue(t,e)&&(a=ue(t,e)),e.type){case'list':return[...a.current];case'shape':return{...a.current};default:return a.current}}function I(e,t,a){let n=t;for(;n&&!ue(n.spawn,e);)n=n.parentLeaf;return n?ue(n.spawn,e):a&&ue(a,e)?ue(a,e):e}function S(e,t,a){return I(e,t,a).current}function C(e,t){ue(t.spawn,e)||(t.spawn.reg[e.id]=I(e,t.parentLeaf,t.forkPage))}function T(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:r,leafData:l,opGroup:o,domSubtree:i,hydration:s,forkPage:c,env:u}){function p(e){if(e.before)for(let t=0;t<e.before.length;t++){let a=e.before[t];switch(a.type){case'map':{let t=a.from;C(t,k),g[e.id].current=a.fn(g[t.id].current);break}case'field':{let t=a.from;C(t,k),g[e.id].current[a.field]=g[t.id].current;break}case'closure':C(a.of,k)}}if(!e.after)return;let t=g[e.id].current;for(let a=0;a<e.after.length;a++){let n=e.after[a],r=n.to;switch(g[r.id]||(g[r.id]={id:r.id,current:S(r,k.parentLeaf,c)}),n.type){case'copy':g[r.id].current=t;break;case'map':g[r.id].current=n.fn(t)}}}function f(e,t,a){let n;t.stop=1;try{for(;t.i<e.length;)n=e[t.i],t.i++,n.fn(a[n.of.id]?a[n.of.id].current:S(n.of,k.parentLeaf,c))}catch(e){console.error(e),t.stop=0}}!u&&a&&(u=a.env);let d=a?a.spawn:null,h=e.template,g={},v={id:++oe,fullID:'',reg:g,template:h,parent:d,childSpawns:{},active:1};h.pages.push(v);let m={},k={actor:e,spawn:v,api:m,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:r,data:l,parentLeaf:a,hydration:s,forkPage:c,env:u,mountNode:n},y=se;se=k,d&&(d.childSpawns[h.id]||(d.childSpawns[h.id]=[]),d.childSpawns[h.id].push(v)),v.fullID=d?`${d.fullID}_${v.id}`:""+v.id;for(let e=0;e<h.closure.length;e++){let t=h.closure[e],a=t,n=v.parent;e:for(;n;){if(ue(n,t)){a=ue(n,t);break e}n=n.parent}!n&&c&&ue(c,t)&&(a=ue(c,t)),g[t.id]=a}for(let e=0;e<h.plain.length;e++){let t=h.plain[e],a={id:t.id,current:P(t,c)};g[t.id]=a}for(let e in t){let a=h.nameMap[e].stateRef.id;g[a]={id:a,current:t[e]}}h.closure.forEach(p),h.plain.forEach(p);let b={i:0,stop:0};for(;!b.stop;)f(h.watch,b,g);if(d)for(let e in v.childSpawns)e in d.childSpawns||(d.childSpawns[e]=[]),d.childSpawns[e].push(...v.childSpawns[e]);if(m.mount=(t,a=1)=>(e=>{if(pe)return void pe.steps.push(e);let t;pe={parent:pe,steps:[e]};do{for(;t=pe.steps.shift();)pe={parent:pe,steps:[]},effector.launch(t)}while(pe=pe.parent)})({target:e.trigger.mount,params:t,defer:a,page:v,forkPage:c}),e.api)for(let t in e.api)m[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:v,forkPage:c});return k.spawn.api=m,k.spawn.leaf=k,k.api.mount(k),se=y,k}function R(e){switch(e.type){case'using':return e;case'fragment':switch(e.parent.type){case'element':case'using':return e.parent}default:return R((e=>{switch(e.type){case'text':case'element':case'list':case'route':case'rec':case'recItem':case'block':case'blockItem':return e.parent;case'fragment':default:switch(e.parent.type){case'using':case'block':return e.parent;default:return e.parent.parent}}})(e))}}function q(e){let t=R(e);return t?t.value:null}function A(e){if(!e.visible)return null;switch(e.type){case'text':case'element':return e;case'route':return A(e.child);case'LF':case'RF':case'FF':case'rec':case'recItem':case'block':case'blockItem':return(e=>{let t=e.child;for(let e=t.length-1;e>=0;e--){let a=A(t[e]);if(a)return a}return null})(e.child);case'list':{let t=e.lastChild;if(!t)return null;for(;t;){let e=A(t);if(e)return e;t=t.left}return null}default:return null}}function D(e){switch(e.type){case'fragment':switch(e.parent.type){case'element':case'using':return null;case'RF':{let t=e.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=A(a.child[e]);if(t)return t}return D(a)}case'rec':case'recItem':case'block':case'blockItem':case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=A(a.child[e]);if(t)return t}return D(a)}case'LF':{let t=e.parent.left;for(;t;){let e=A(t);if(e)return e;t=t.left}return D(e.parent.parent)}default:return null}case'element':case'text':case'route':case'rec':case'recItem':case'block':case'blockItem':case'list':{let t=e.parent;for(let a=e.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=A(e);if(n)return n}return D(t)}default:return null}}function O(e){let t=D(e);return t?t.value:null}function F(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l}){e.childTemplates.forEach((e=>{N({parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l,actor:e})}))}function N({parentBlockFragment:e,leaf:t,node:a=t.mountNode,actor:n,svgRoot:r,values:l}){let o,{draft:s}=n,{queue:u}=t.ops.group,p=c(u),f=t.ops.domSubtree,d=f;switch(s.type){case'route':{let t={type:'route',parent:e,child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0},visible:1,index:s.inParentIndex};t.child.parent=t,t.child.child.parent=t.child,e.child[s.inParentIndex]=t,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let a;if(n.isBlock){let e,n,r=t;for(;r&&(!n||!e);){r.actor.env&&(e=r.actor.env);let{draft:t}=r;'element'===t.type&&('svg'===t.tag?n='svg':'foreignObject'===t.tag&&(n='html')),r=r.parentLeaf}n||(n='html'),e&&(a='svg'===n?e.document.createElementNS('http://www.w3.org/2000/svg',s.tag):e.document.createElement(s.tag),h(a,s.staticSeq))}else a=s.stencil.cloneNode();let r={type:'element',parent:e,child:{type:'fragment',parent:null,child:[]},value:a,visible:0,index:s.inParentIndex};r.child.parent=r,e.child[s.inParentIndex]=r,o={type:'element',block:r,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(M(r),o.needToCallNode&&(o.needToCallNode=0,effector.launch({target:fe,params:{element:r.value,fns:s.node},page:g.spawn,forkPage:t.forkPage}))):(r.value.remove(),r.visible=0)},group:f})},needToCallNode:s.node.length>0},d=c(u);break}case'list':{let t={type:'list',parent:e,child:[],lastChild:null,visible:1,index:s.inParentIndex};e.child[s.inParentIndex]=t,o={type:'list',draft:s,block:t,records:[]};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'rec item',block:t};break}case'block':{let t={type:'block',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block',block:t};break}case'blockItem':{let t={type:'blockItem',parent:e,child:{type:'fragment',parent:null,child:[]},visible:1,index:s.inParentIndex};t.child.parent=t,e.child[s.inParentIndex]=t,o={type:'block item',block:t};break}default:console.warn("unexpected draft type "+s.type)}let g=T(n,{values:l,parentLeaf:t,mountNode:a,svgRoot:r||t.svgRoot,leafData:o,opGroup:p,domSubtree:d,hydration:t.hydration,forkPage:t.forkPage})}function M(e){let t=O(e);t?t.after(e.value):q(e).prepend(e.value),e.visible=1}function E(e,t){if(Array.isArray(t))return t.map((t=>e.map((e=>e[t]))));if('object'==typeof t&&null!==t){let a={};for(let n in t){let r=t[n];a[n]=e.map('function'==typeof r?e=>r(e):e=>e[r])}return a}return e.map((e=>e[t]))}function B(e,t){let{spawn:a}=e;for(let e in a.childSpawns){let n=a.childSpawns[e];for(let e=0;e<n.length;e++)t(n[e].leaf)}}function V(e){e.spawn.active=0,B(e,L)}function _({spawn:e}){j(e,e.parent.childSpawns[e.template.id]),j(e,e.template.pages)}function L(e){let{spawn:t,data:a}=e;switch(a.type){case'element':j(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,j(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,a.ops.visible);break;case'list':{let t=a.records;for(let e=0;e<t.length;e++){let a=t[e];a.instance&&L(a.instance),a.active=0}e.spawn.active=0,_(e);break}case'list item':{let t=a.block;j(t,t.parent.child);let n=t.left,r=t.right;n&&(n.right=r,r||t.parent.lastChild!==t||(t.parent.lastChild=n)),r&&(r.left=n),n||r||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,V(e),_(e);break}case'route':V(e),_(e);break;case'block':case'block item':case'rec':case'rec item':V(e)}}function j(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function z(e,t){if(!e)throw Error(t)}function G(e,t){if(!e)throw Error(t+"() called outside from using() closure")}function Q(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function U(e){G(ce,'spec');let t=ce.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return}if(e.attr&&t.attr.push(e.attr),e.data&&t.data.push(e.data),'text'in e){let a=e.text,n=t.childCount;Array.isArray(a)?(t.text.push(...a.map(((e,t)=>({index:t+n,value:e})))),t.childCount+=a.length):(t.text.push({index:n,value:a}),t.childCount+=1)}if(e.style){let a={};for(let t in e.style)a[d(t)]=e.style[t];t.styleProp.push(a)}if(e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?$(t.config||{},t.on):$(t)}e.ɔ&&U(e.ɔ)}function $(e,t){if(!ce)return;let a=ce.draft;z('element'===a.type,`"handler" extension can be used only with element nodes, got "${a.type}"`),void 0===t&&(t=e,e={});for(let e in t)z(effector.is.unit(t[e]),`handler for "${e}" should be event`);let{passive:n=0,capture:r=0,prevent:l=0,stop:o=0}=e;a.handler.push({options:{prevent:l,stop:o},domConfig:{passive:l?0:n,capture:r},map:t})}function W({source:e,visible:t,fn:a}){G(ce,'route');let{env:n,namespace:r}=ce,l=w({name:'route',isSvgRoot:0,namespace:r,env:n,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(l,{mount:o}){let i;if(effector.is.store(t))i=effector.combine({value:e,visible:t});else{let a=t;i=e.map((e=>({value:e,visible:a(e)})))}let s=w({name:'route item',isSvgRoot:0,namespace:r,env:n,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},state:{store:null},fn({store:e},{mount:t}){let n=effector.createEvent();e.on(n,((e,t)=>t)),a({store:e});let r=effector.sample({source:t,clock:i,fn:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a}),greedy:1});t.watch(de.routeItem),r.watch((({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&effector.launch({target:n,params:a,defer:1,page:e.spawn,forkPage:e.forkPage}),Z(t,e)}))}});K(s);let{onMount:c,onState:u}=X({mount:o,state:i,onMount:({visible:e,value:t},a)=>({leaf:a,visible:e,value:t}),onState:(e,{visible:t,value:a})=>({leaf:e,visible:t,value:a})});effector.merge([c,u]).watch((({leaf:e,visible:t,value:a})=>{let n=e.data;n.block.child.visible=t,t&&!n.initialized&&(N({parentBlockFragment:n.block.child.child,leaf:e,actor:s,values:{store:a}}),n.initialized=1)}))}});K(l)}function Z(e,t){let a=t=>{let n=t.data;switch(n.type){case'element':l(e,n.ops.visible);break;case'route':case'list':case'list item':B(t,a);break;default:console.log('unsupported type',n.type)}};B(t,a)}function H(e){let t='function'==typeof e?e:e.fn,a=w({name:'rec',state:{store:null},isSvgRoot:0,namespace:null,env:null,draft:{type:'rec',childTemplates:[],childCount:0,inParentIndex:0},defer:1,isBlock:1,fn({store:e},{mount:a}){t({store:e,state:e});let n=effector.createEvent();return e.on(n,((e,t)=>t)),a.watch(de.rec),{itemUpdater:n}}});return({store:e,state:t=e})=>{G(ce,'(rec instance)');let{env:n,namespace:r}=ce;a.deferredInit&&a.deferredInit(),K(w({name:'rec item',isSvgRoot:0,namespace:r,env:n,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(e,{mount:n}){let{onMount:r,onState:l}=X({state:t,mount:n,onMount:(e,t)=>({state:e,leaf:t}),onState:(e,t)=>({state:t,leaf:e})});l.watch((({state:e,leaf:t})=>{B(t,(t=>{t.api.itemUpdater(e)}))})),r.watch((({leaf:e,state:t})=>{N({parentBlockFragment:e.data.block.child,leaf:e,actor:a,values:{store:t}})}))}}))}}function J(e,t){G(ce,'list'),'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:r,fields:l=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,i={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},{env:s,namespace:d}=ce;K(w({name:'list',draft:i,isSvgRoot:0,namespace:d,fn(e,{mount:t}){let n=w({name:'list item',state:{id:-1,store:null},draft:i,isSvgRoot:0,namespace:d,fn({id:e,store:t},{mount:n}){a({store:t,key:e,fields:E(t,l)});let r=effector.createEvent();if(t.on(r,((e,t)=>t)),i.itemVisible){let{onMount:e,onState:t}=X({mount:n,state:i.itemVisible,onMount:(e,t)=>({visible:e,leaf:t}),onState:(e,t)=>({visible:t,leaf:e})});e.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized=e,e&&F(i,{parentBlockFragment:a.child,leaf:t})})),t.watch((({visible:e,leaf:t})=>{let a=t.data.block;a.visible=e,a.childInitialized?Z(e,t):e&&(a.childInitialized=1,F(i,{parentBlockFragment:a.child,leaf:t}))}))}else n.watch(de.listItem);return{itemUpdater:r}},env:s}),h=effector.createStore([]),g=r.map((e=>e)),v=effector.sample({source:r,clock:t,fn:(e,t)=>({updates:e,leaf:t,hydration:t.hydration}),greedy:1}),m=effector.sample({source:v,clock:g,fn:({leaf:e},t)=>({updates:t,leaf:e,hydration:0}),greedy:1});effector.sample({source:h,clock:[v,m],greedy:1,fn(e,{updates:t,leaf:a,hydration:l}){let s=a.data,d=s.block;ee('list update ['+r.shortName+']');let h=Array(t.length).fill(0),g=t.map(o),v=[];for(let a=0;a<e.length;a++){let n=e[a],r=g.indexOf(n.key);-1!==r?(v.push(n),h[r]=1,f(t[r],n.asyncValue)):(n.active=0,n.instance&&L(n.instance),p(n.asyncValue))}for(let e=0;e<t.length;e++){if(h[e])continue;let r=t[e],o=g[e],s=c(a.ops.group.queue),p={type:'LF',parent:d,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},f={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:p,listDraft:i},asyncValue:u({value:r,group:s,onTerminate(e){},onChange(e){f.instance&&f.instance.api.itemUpdater(e)},onInit(e){f.active&&(l||(f.instance=T(n,{values:{id:o,store:e},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:s,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage})))}})},m=v.length;v.push(f);let k=m>0?v[m-1].leafData:null;if(p.child.parent=p,d.child.push(p),k){let e=k.block;p.left=e;let t=e.right;t?(t.left=p,p.right=t):d.lastChild=p,e.right=p}else d.lastChild=p;l&&(f.instance=T(n,{values:{id:o,store:r},parentLeaf:a,mountNode:a.mountNode,svgRoot:a.svgRoot,leafData:f.leafData,opGroup:s,domSubtree:a.ops.domSubtree,hydration:l,forkPage:a.forkPage}))}return te('list update ['+r.shortName+']'),0===v.length&&(d.lastChild=null),s.records=v,v},target:h})},env:s}))}function K(e){if(!ce)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(ce.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':case'block':case'blockItem':t.inParentIndex=ce.draft.childCount,ce.draft.childCount+=1,ce.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+ce.draft.type)}}function X({mount:e,state:t,onMount:a,onState:n}){return{onMount:effector.sample({source:t,clock:e,fn:a,greedy:1}),onState:effector.sample({source:e,clock:t,fn:n,greedy:1})}}function Y(e,t){let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);return a}let ee,te,ae;'undefined'!=typeof performance&&performance.mark?(ee=e=>{performance.mark('☄️ '+e+' start')},te=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(ee=()=>{},te=()=>{}),ae='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{let e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();let ne='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0);const re={attr:y,data:k,style:m,styleVar:v};let le=0,oe=0,ie=null,se=null,ce=null;const ue=(e,t)=>e.reg[t.id];let pe=null,fe=effector.createEvent();fe.watch((({fns:e,element:t})=>{e.forEach((e=>{e(t)}))}));const de={using(e){let t=e.data;F(t.draft,{parentBlockFragment:t.block.child,leaf:e})},routeItem(e){let t=e.draft,a=e.data;a.block.child.visible=1,F(t,{parentBlockFragment:a.block.child.child,leaf:e})},block(e){F(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},blockItem(e){N({parentBlockFragment:e.data.block.child,leaf:e,actor:e.draft.itemOf})},rec(e){F(e.draft,{parentBlockFragment:e.data.block.child,leaf:e})},listItem(e){let t=e.data,a=t.block;a.visible=1,a.childInitialized=1,F(t.listDraft,{parentBlockFragment:a.child,leaf:e})}};e.block=({fn:e,env:t,namespace:a="html"})=>{let n=w({name:'block',isSvgRoot:0,namespace:a,env:t,draft:{type:'block',childTemplates:[],childCount:0,inParentIndex:0},isBlock:1,fn({},{mount:t}){e(),t.watch(de.block)}});return()=>{G(ce,'(block instance)');let e={type:'blockItem',childTemplates:[],childCount:0,inParentIndex:-1,itemOf:n},{env:t,namespace:a}=ce;K(w({name:'block item',isSvgRoot:0,namespace:a,env:t,draft:e,fn(e,{mount:t}){t.watch(de.blockItem)}}))}},e.h=(e,t)=>{function a(e){return e.data.block.value}function n(e,t,a){let n=e.data.block.child,r={type:'text',parent:n,visible:0,index:a,value:null};if(n.child[a]=r,e.hydration){let a=D(r);if(a)switch(a.type){case'text':r.value=e.env.document.createTextNode(t),a.value.after(r.value);break;case'element':r.value=a.value.nextSibling,b(r.value,t)}else{let e=q(r);r.value=e.firstChild,b(r.value,t)}r.visible=1}else r.value=e.env.document.createTextNode(t),M(r);return r}let o,s=0,c=0;'function'==typeof t?(s=1,o=t):t&&(c=1,t.fn&&(s=1,o=t.fn),t.ɔ&&('function'==typeof t.ɔ?(s=1,o=t.ɔ):'function'==typeof t.ɔ.fn&&(s=1,o=t.ɔ.fn))),G(ce,'h');let u,p=ce.env,f=ce.namespace,d=f,g='html';d=g='svg'===f?'svg':'html','svg'===e&&(g='svg',d='svg'),ce.isBlock||(u='svg'===g?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e));let P=u,I={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:P,seq:[],staticSeq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]};'foreignObject'===f?(I.attr.push({xmlns:'http://www.w3.org/1999/xhtml'}),d='html'):'svg'===e?(I.attr.push({xmlns:'http://www.w3.org/2000/svg'}),d='svg'):'foreignObject'===e&&(d='foreignObject');let S=w({name:'element',draft:I,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:u}){function p(e){return X({mount:f,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let f=effector.createEvent();s&&o(),c&&U(t);let d={attr:{},data:{},text:I.text,styleProp:{},styleVar:{},visible:I.visible||null,handler:I.handler};for(let e=0;e<I.attr.length;e++){let t=I.attr[e];for(let e in t)'xlink:href'===e?d.attr.href=t[e]:d.attr[e]=t[e]}for(let e=0;e<I.data.length;e++){let t=I.data[e];for(let e in t)d.data[e]=t[e]}for(let e=0;e<I.styleProp.length;e++){let t=I.styleProp[e];for(let e in t)e.startsWith('--')?d.styleVar[e.slice(2)]=t[e]:d.styleProp[e]=t[e]}for(let e=0;e<I.styleVar.length;e++){let t=I.styleVar[e];for(let e in t)d.styleVar[e]=t[e]}d.visible&&I.seq.push({type:'visible',value:d.visible});for(let e in d.attr){let t=d.attr[e];effector.is.unit(t)?I.seq.push({type:'attr',field:e,value:t}):I.staticSeq.push({type:'attr',field:e,value:t})}for(let e in d.data){let t=d.data[e];effector.is.unit(t)?I.seq.push({type:'data',field:e,value:t}):I.staticSeq.push({type:'data',field:e,value:t})}for(let e in d.styleProp){let t=d.styleProp[e];effector.is.unit(t)?I.seq.push({type:'style',field:e,value:t}):I.staticSeq.push({type:'style',field:e,value:t})}for(let e in d.styleVar){let t=d.styleVar[e];effector.is.unit(t)?I.seq.push({type:'styleVar',field:e,value:t}):I.staticSeq.push({type:'styleVar',field:e,value:t})}for(let e=0;e<d.text.length;e++){let t=d.text[e];if(null!==t.value)if(effector.is.unit(t.value)){I.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=ie;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else I.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<d.handler.length;e++){let t=d.handler[e];for(let e in t.map)I.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(d.visible){let{onMount:e,onState:t}=X({mount:u,state:d.visible,onMount:(e,t)=>({leaf:t,value:e,hydration:t.hydration}),onState:(e,t)=>({leaf:e,value:t,hydration:0})});e.watch((({leaf:e,value:t,hydration:a})=>{let n=e.data,l=n.block;if(a&&(r(t,n.ops.visible),t)){let e,t=O(l);if(e=t?t.nextSibling:q(l).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}l.value=e,l.visible=1}F(I,{parentBlockFragment:l.child,leaf:e,node:l.value,svgRoot:S.isSvgRoot?l.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,effector.launch({target:fe,params:{element:n.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage})})),effector.merge([t,e]).watch((({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)}))}P&&h(P,I.staticSeq);for(let e=0;e<I.seq.length;e++){let t=I.seq[e];switch(t.type){case'visible':break;case'attr':{let{field:e}=t,n='value'===e||'checked'===e||'min'===e||'max'===e,{onMount:r,onState:o}=p(t.value);if(n)effector.merge([o,r]).watch((({leaf:t,value:n})=>{y(a(t),e,n)}));else{let t=I.opsAmount++;r.watch((({value:n,leaf:r})=>{let l=a(r),o=i({value:n,priority:'props',runOp(t){y(l,e,t)},group:r.ops.group});r.ops.group.ops[t]=o,y(l,e,n)})),o.watch((({value:e,leaf:a})=>{l(e,a.ops.group.ops[t])}))}break}case'data':{let{field:e}=t,{onMount:n,onState:r}=p(t.value),o=I.opsAmount++;n.watch((({value:t,leaf:n})=>{let r=a(n),l=i({value:t,priority:'props',runOp(t){k(r,e,t)},group:n.ops.group});n.ops.group.ops[o]=l,k(r,e,t)})),r.watch((({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])}));break}case'style':{let e=I.opsAmount++,{field:n}=t,{onMount:r,onState:o}=p(t.value);r.watch((({value:t,leaf:r})=>{let l=a(r),o=i({value:t,priority:'props',runOp(e){m(l,n,e)},group:r.ops.group});r.ops.group.ops[e]=o,m(l,n,t)})),o.watch((({value:t,leaf:a})=>{l(t,a.ops.group.ops[e])}));break}case'styleVar':{let{field:e}=t,{onMount:n,onState:r}=p(t.value),o=I.opsAmount++;n.watch((({value:t,leaf:n})=>{let r=a(n),l=i({value:t,priority:'props',runOp(t){v(r,e,t)},group:n.ops.group});n.ops.group.ops[o]=l,v(r,e,t)})),r.watch((({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])}));break}case'staticText':f.watch((e=>{n(e,t.value,t.childIndex)}));break;case'dynamicText':{let e=I.opsAmount++;effector.sample({source:t.value,clock:f,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch((({value:a,leaf:r})=>{let l=i({value:a,priority:'props',runOp(e){b(o.value,e)},group:r.ops.group});r.ops.group.ops[e]=l;let o=n(r,a,t.childIndex)})),effector.sample({source:f,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch((({leaf:t,text:a})=>{l(a,t.ops.group.ops[e])}));break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;f.watch((n=>{let r=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,r=a):a=a.parent}a(n).addEventListener(t.for,(e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:x(t.handler,n.forkPage),params:e,page:r,forkPage:n.forkPage})}),t.domConfig)}));break}}}u.watch((e=>{let t=e.data;if(!I.visible){let a=t.ops.visible,n=t.block;if(e.hydration){r(1,a);let e,t=O(n);if(e=t?t.nextSibling:q(n).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}n.value=e,n.visible=1}F(I,{parentBlockFragment:n.child,leaf:e,node:n.value,svgRoot:S.isSvgRoot?n.value:null}),effector.launch({target:f,params:e,defer:1,page:e.spawn,forkPage:e.forkPage}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:fe,params:{element:t.block.value,fns:I.node},page:e.spawn,defer:1,forkPage:e.forkPage})):l(1,a)}}))},env:p});K(S)},e.handler=$,e.list=J,e.node=e=>{G(ce,'node');let t=ce.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':case'block':case'blockItem':return void console.error('node() hook supported only in h() nodes')}t.node.push(e)},e.rec=H,e.remap=E,e.route=W,e.spec=U,e.text=(e,...t)=>{U({text:Y(e,t)})},e.tree=({source:e,key:t,child:a,fn:n})=>{let r=H((({store:e})=>{J({source:e,key:t,fn({store:e}){let t=e.map((e=>e[a]||[]));n({store:e,child(){r({store:t})}})}})}));r({store:e})},e.using=(e,t)=>{let a,n,r,l,o,i;if('function'==typeof t)a=t,r=Q(),l=0;else{if(!t)throw Error('using() second argument is missing');a=t.fn,r=t.env?t.env:Q(),l=t.hydrate,n=t.onComplete,o=t.onRoot,i=t.scope}z(e,'using() first argument is missing');let u=e.namespaceURI,p=e.tagName.toLowerCase(),f={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=w({name:'using',draft:f,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(de.using)},env:r}),h={type:'using',child:{type:'fragment',parent:null,child:[]},value:e};h.child.parent=h,(e=>{if(e&&!e.nodeMap){let t={};for(let a=0;a<e.clones.length;a++){let n=e.clones[a];t[n.meta.forkOf.id]=n}e.nodeMap=t}})(i);let g=s({onComplete:n}),v=T(d,{parentLeaf:se||null,mountNode:e,svgRoot:d.isSvgRoot?e:se?se.svgRoot:null,leafData:{type:'using',draft:f,element:e,block:h},opGroup:c(g),domSubtree:c(g),hydration:l,forkPage:i,env:r});if(o&&o({template:d,leaf:v}),g.onDrain&&!g.rafID){let e=g.onDrain;g.onDrain=null,e()}},e.val=(e,...t)=>t.every((e=>!effector.is.store(e)))?Y(e,t).join(''):effector.combine(t,(t=>Y(e,t).join(''))),e.variant=({source:e,cases:t,key:a})=>{let n;G(ce,'variant'),z(effector.is.unit(e),'variant({source}) should be unit'),n='function'==typeof a?a:null==a?e=>String(e):e=>String(e[a]);let r=0;for(let a in t)'__'!==a?W({source:e,visible:e=>n(e)===a,fn:t[a]}):r=1;if(r){let a=Object.keys(t);W({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}},Object.defineProperty(e,'__esModule',{value:1})}));
//# sourceMappingURL=forest.umd.js.map

@@ -1,2 +0,2 @@

import {Store, Event, Fork} from 'effector'
import {Store, Event, Scope} from 'effector'

@@ -61,3 +61,3 @@ export type StoreOrData<T> = Store<T> | T

onComplete?: () => void
scope?: Fork
scope?: Scope
},

@@ -204,4 +204,11 @@ ): void

export function block(config: {fn: () => void}): () => void
export function node(fn: (node: DOMElement) => void): void
export function text(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function remap<T extends {[field: string]: any}, S extends keyof T>(

@@ -219,7 +226,9 @@ store: Store<T>,

export function text(
export function val(
words: TemplateStringsArray,
...values: Array<string | number>
): string
export function val(
words: TemplateStringsArray,
...values: Array<DOMProperty | AttributeStore>
): void
export function block(config: {fn: () => void}): () => void
): Store<string>
{
"name": "forest",
"version": "0.19.3",
"version": "0.19.4",
"description": "UI engine for web",

@@ -24,3 +24,3 @@ "main": "forest.cjs.js",

"peerDependencies": {
"effector": "^21.5.0"
"effector": "^21.6.1"
},

@@ -53,3 +53,3 @@ "keywords": [

"bugs": "https://github.com/effector/effector/issues",
"homepage": "https://effector.now.sh",
"homepage": "https://effector.dev",
"engines": {

@@ -56,0 +56,0 @@ "node": ">=6.0.0"

@@ -84,3 +84,3 @@ # forest

Start an application from given root dom node. Can accept forked [Scope](https://effector.now.sh/docs/api/effector/scope). Set `hydrate: true` to reuse `root` html content (useful for ssr)
Start an application from given root dom node. Can accept forked [Scope](https://effector.dev/docs/api/effector/scope). Set `hydrate: true` to reuse `root` html content (useful for ssr)

@@ -231,3 +231,3 @@ ```typescript

Mount one of given cases by selecting a specific one by the current value of the `key` field of `source` store value. Type of `store` in `cases` functions will be inferred from a case type. Optional default case - `__` (like in [split](https://effector.now.sh/docs/api/effector/split))
Mount one of given cases by selecting a specific one by the current value of the `key` field of `source` store value. Type of `store` in `cases` functions will be inferred from a case type. Optional default case - `__` (like in [split](https://effector.dev/docs/api/effector/split))

@@ -290,3 +290,3 @@ ```typescript

Method from `forest/server` to render given application to string. Can accept forked [Scope](https://effector.now.sh/docs/api/effector/scope), in which case `fn` childs must be wrapped in [block](#block) to ensure that all units are created before [fork](https://effector.now.sh/docs/api/effector/fork) call
Method from `forest/server` to render given application to string. Can accept forked [Scope](https://effector.dev/docs/api/effector/scope), in which case `fn` childs must be wrapped in [block](#block) to ensure that all units are created before [fork](https://effector.dev/docs/api/effector/fork) call

@@ -309,2 +309,24 @@ ```typescript

### val
Helper for joininig [properties](#Property) to single string with template literals. If only [plain values](#PlainProperty) are passed, the method returns `string`
```typescript
function val(words: TemplateStringsArray, ...values: Property[]): Store<string>
function val(words: TemplateStringsArray, ...values: PlainProperty[]): string
```
**Example**
```typescript
const x = createStore(10)
const y = 20
h('g', {
attr: {
transform: val`translate(${x} ${y})`,
},
})
```
## Type terms

@@ -311,0 +333,0 @@

@@ -1,2 +0,2 @@

function t(t){switch(t=String(t)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return t.replace(/[^a-zA-Z0-9\-_]/g,'')}}function e(t,e){t.sibling.right=e,t.nextSibling=e}function i(t){return"-"+t.toLowerCase()}function s(t){switch(t){case'&':return'&amp;';case'<':return'&lt;';case'>':return'&gt;';case'"':return'&quot;';case"'":return'&#39;';default:return t}}function n(t){return String(t).replace(r,'')}Object.defineProperty(exports,'__esModule',{value:1});var l=require('forest');const r=/[\\<>"]/g,h=/[A-Z]/g,a=/[&<>'"]/g,c=/<\/(\s|\\n)*script/gim;class g{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.nodeName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new u,this.value=void 0,this.firstChild=null,this.nextSibling=null,this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}cloneNode(){let t=new g;return t.tagName=this.tagName,t.nodeName=this.nodeName,t.namespaceURI=this.namespaceURI,Object.assign(t.dataset,this.dataset),Object.assign(t.style,this.style),t.value=this.value,t.isFragment=this.isFragment,Object.assign(t.attributes,this.attributes),t.textContent=this.textContent,t}after(t){this.sibling.right!==t&&(t.parent&&t.remove(),this.parent&&(this.sibling.right?(this.sibling.right.sibling.left=t,e(t,this.sibling.right)):this.parent.child.last=t,e(this,t),t.sibling.left=this,t.parent=this.parent))}prepend(t){t.parent&&t.remove(),this.child.last?(this.child.first.sibling.left=t,e(t,this.child.first)):(this.child.first=t,this.child.last=t),this.child.first=t,this.firstChild=t,t.parent=this}remove(){if(!this.parent)return;let{parent:t}=this;t.child.first===this&&t.child.last===this?(t.firstChild=null,t.child.first=null,t.child.last=null):t.child.first===this?(t.child.first=this.sibling.right,t.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):t.child.last===this?(t.child.last=this.sibling.left,e(this.sibling.left,null)):(this.sibling.right.sibling.left=this.sibling.left,e(this.sibling.left,this.sibling.right)),this.sibling.left=null,e(this,null),this.parent=null}addEventListener(t,e,i){}removeEventListener(t,e,i){}setAttribute(e,i){this.attributes[t(e)]=n(i)}removeAttribute(e){delete this.attributes[t(e)]}replaceWith(t){if(!this.parent)return;let{parent:i}=this;t.parent&&t.remove(),i.child.first===this&&i.child.last===this?(i.firstChild=t,i.child.first=t,i.child.last=t):i.child.first===this?(i.child.first=t,i.firstChild=t,this.sibling.right.sibling.left=t):i.child.last===this?(i.child.last=t,e(this.sibling.left,t)):(this.sibling.right.sibling.left=t,e(this.sibling.left,t)),t.sibling.left=this.sibling.left,e(t,this.sibling.right),t.parent=i,this.sibling.left=null,e(this,null),this.parent=null}replaceData(t,e,i){'string'==typeof this.textContent&&(this.textContent=`${this.textContent.slice(0,t)}${i}${this.textContent.slice(t+e)}`)}splitText(t){if('string'!=typeof this.textContent)return null;let e=new g;return e.nodeName='#text',e.textContent=this.textContent.slice(t),this.textContent=this.textContent.slice(0,t),this.after(e),e}}class u{setProperty(e,i){this[t(e)]=n(i)}removeProperty(e){delete this[t(e)]}}const o=['area','base','br','col','embed','hr','img','input','keygen','link','meta','param','source','track','wbr'];exports.renderStatic=e=>{let r,u={document:{createTextNode(t){let e=new g;return e.textContent=String(t),e.nodeName='#text',e},createElement(e){let i=new g;return i.tagName=t(e),i.isFragment=0,i},createElementNS(e,i){switch(e){case'http://www.w3.org/1999/xhtml':case'http://www.w3.org/2000/svg':break;default:e='http://www.w3.org/1999/xhtml'}let s=new g;return s.tagName=t(i),s.namespaceURI=e,s.isFragment=0,s},createDocumentFragment:()=>new g}},f=u.document.createDocumentFragment();return'object'==typeof e&&null!==e&&(r=e.scope,e=e.fn),new Promise(g=>{l.using(f,{fn:e,env:u,scope:r,onComplete(){g(function(e){let l=[];(function e(l,r){if(null!==l.textContent){let t=l.textContent;l.parent&&'script'===l.parent.tagName||(t=String(t).replace(a,s)),r.push(t)}if(l.isFragment){let t=l.firstChild;for(;t;)e(t,r),t=t.sibling.right;return}r.push('<',l.tagName);for(let t in l.attributes)r.push(' ',t,'=','"',n(l.attributes[t]),'"');for(let e in l.dataset)r.push(' ','data-',t(e).replace(h,i),'=','"',n(l.dataset[e]),'"');let g=[];for(let t in l.style){let e=l.style[t];if(t.startsWith('--'))g.push(`${t}: ${e}`);else{let i=t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase());(t.startsWith('webkit')||t.startsWith('moz'))&&(i="-"+i),g.push(`${i}: ${e}`)}}if(g.length>0&&r.push(' ','style','=','"',g.join(';'),'"'),r.push('>'),o.includes(l.tagName))return;let u='script'===l.tagName?[]:r,f=l.firstChild;for(;f;)e(f,u),f=f.sibling.right;if('script'===l.tagName){let t=u.join('');r.push((t=>t.replace(c,'<\\/script'))(t))}r.push('</',l.tagName,'>')})(e,l);let r=l.join('');return function t(e){if('html'===e.tagName)return 1;if(e.isFragment&&null===e.textContent){let i=e.firstChild;if(i&&e.child.last===i)return t(i)}return 0}(e)?"<!DOCTYPE html>"+r:r}(f))}})})};
function t(t){switch(t=String(t)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':case'setProperty':case'removeProperty':return'forbidden';default:return t.replace(/[^a-zA-Z0-9\-_]/g,'')}}function e(t,e){t.sibling.right=e,t.nextSibling=e}function i(t){return"-"+t.toLowerCase()}function s(t){switch(t){case'&':return'&amp;';case'<':return'&lt;';case'>':return'&gt;';case'"':return'&quot;';case"'":return'&#39;';default:return t}}function n(t){return String(t).replace(c,'')}function l(e,r){if(null!==e.textContent){let t=e.textContent;e.parent&&'script'===e.parent.tagName||(t=String(t).replace(u,s)),r.push(t)}if(e.isFragment){let t=e.firstChild;for(;t;)l(t,r),t=t.sibling.right;return}r.push('<',e.tagName);for(let t in e.attributes)r.push(' ',t,'=','"',n(e.attributes[t]),'"');for(let s in e.dataset)r.push(' ','data-',t(s).replace(g,i),'=','"',n(e.dataset[s]),'"');let h=[];for(let t in e.style){let i=e.style[t];if(t.startsWith('--'))h.push(`${t}: ${i}`);else{let e=t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));(t.startsWith('webkit')||t.startsWith('moz'))&&(e="-"+e),h.push(`${e}: ${i}`)}}if(h.length>0&&r.push(' ','style','=','"',h.join(';'),'"'),r.push('>'),d.includes(e.tagName))return;let a='script'===e.tagName?[]:r,c=e.firstChild;for(;c;)l(c,a),c=c.sibling.right;if('script'===e.tagName){let t=a.join('');r.push(t.replace(o,'<\\/script'))}r.push('</',e.tagName,'>')}function r(t){let e=[];l(t,e);let i=e.join('');return h(t)?"<!DOCTYPE html>"+i:i}function h(t){if('html'===t.tagName)return 1;if(t.isFragment&&null===t.textContent){let e=t.firstChild;if(e&&t.child.last===e)return h(e)}return 0}Object.defineProperty(exports,'__esModule',{value:1});var a=require('forest');const c=/[\\<>"]/g,g=/[A-Z]/g,u=/[&<>'"]/g,o=/<\/(\s|\\n)*script/gim;class f{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.nodeName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new p,this.value=void 0,this.firstChild=null,this.nextSibling=null,this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}cloneNode(){let t=new f;return t.tagName=this.tagName,t.nodeName=this.nodeName,t.namespaceURI=this.namespaceURI,Object.assign(t.dataset,this.dataset),Object.assign(t.style,this.style),t.value=this.value,t.isFragment=this.isFragment,Object.assign(t.attributes,this.attributes),t.textContent=this.textContent,t}after(t){this.sibling.right!==t&&(t.parent&&t.remove(),this.parent&&(this.sibling.right?(this.sibling.right.sibling.left=t,e(t,this.sibling.right)):this.parent.child.last=t,e(this,t),t.sibling.left=this,t.parent=this.parent))}prepend(t){t.parent&&t.remove(),this.child.last?(this.child.first.sibling.left=t,e(t,this.child.first)):(this.child.first=t,this.child.last=t),this.child.first=t,this.firstChild=t,t.parent=this}remove(){if(!this.parent)return;let{parent:t}=this;t.child.first===this&&t.child.last===this?(t.firstChild=null,t.child.first=null,t.child.last=null):t.child.first===this?(t.child.first=this.sibling.right,t.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):t.child.last===this?(t.child.last=this.sibling.left,e(this.sibling.left,null)):(this.sibling.right.sibling.left=this.sibling.left,e(this.sibling.left,this.sibling.right)),this.sibling.left=null,e(this,null),this.parent=null}addEventListener(t,e,i){}removeEventListener(t,e,i){}setAttribute(e,i){this.attributes[t(e)]=n(i)}removeAttribute(e){delete this.attributes[t(e)]}replaceWith(t){if(!this.parent)return;let{parent:i}=this;t.parent&&t.remove(),i.child.first===this&&i.child.last===this?(i.firstChild=t,i.child.first=t,i.child.last=t):i.child.first===this?(i.child.first=t,i.firstChild=t,this.sibling.right.sibling.left=t):i.child.last===this?(i.child.last=t,e(this.sibling.left,t)):(this.sibling.right.sibling.left=t,e(this.sibling.left,t)),t.sibling.left=this.sibling.left,e(t,this.sibling.right),t.parent=i,this.sibling.left=null,e(this,null),this.parent=null}replaceData(t,e,i){'string'==typeof this.textContent&&(this.textContent=`${this.textContent.slice(0,t)}${i}${this.textContent.slice(t+e)}`)}splitText(t){if('string'!=typeof this.textContent)return null;let e=new f;return e.nodeName='#text',e.textContent=this.textContent.slice(t),this.textContent=this.textContent.slice(0,t),this.after(e),e}}class p{setProperty(e,i){this[t(e)]=n(i)}removeProperty(e){delete this[t(e)]}}const d=['area','base','br','col','embed','hr','img','input','keygen','link','meta','param','source','track','wbr'];exports.renderStatic=e=>{let i,s={document:{createTextNode(t){let e=new f;return e.textContent=String(t),e.nodeName='#text',e},createElement(e){let i=new f;return i.tagName=t(e),i.isFragment=0,i},createElementNS(e,i){switch(e){case'http://www.w3.org/1999/xhtml':case'http://www.w3.org/2000/svg':break;default:e='http://www.w3.org/1999/xhtml'}let s=new f;return s.tagName=t(i),s.namespaceURI=e,s.isFragment=0,s},createDocumentFragment:()=>new f}},n=s.document.createDocumentFragment();return'object'==typeof e&&null!==e&&(i=e.scope,e=e.fn),new Promise((t=>{a.using(n,{fn:e,env:s,scope:i,onComplete(){t(r(n))}})}))};
//# sourceMappingURL=server.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc