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

forest

Package Overview
Dependencies
Maintainers
1
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.16.2 to 0.16.3

2

forest.cjs.js

@@ -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,n;e.status='active',t=a(e),(n=e).cursor.prev&&(n.cursor.prev.cursor.next=n.cursor.next),n.cursor.next&&(n.cursor.next.cursor.prev=n.cursor.prev),t.last===n&&(t.last=n.cursor.prev),t.first===n&&(t.first=n.cursor.next),n.cursor.prev=null,n.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function n(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function l(n,l){if(l.value.active===n)return l.value.pending=n,void('pending'===l.status&&(t(l),a(l).first||e(l.group,l.priority)));var r,i,o,s;'active'===l.status&&(l.status='pending',a(l).first||((o=l.group).queue[s=l.priority].last?(o.cursor[s].prev=o.queue[s].last,o.queue[s].last.cursor[s].next=o,o.queue[s].last=o):o.queue[s].first=o.queue[s].last=o),i=l,(r=a(l)).last?(i.cursor.prev=r.last,r.last.cursor.next=i,r.last=i):r.first=r.last=i),l.value.pending=n,l.group.queue.rafID||(l.group.queue.rafID=_(l.group.queue.execQueue))}function r(a){j('execQueue');let n,l,r=U(),i=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(U()-r>=10){i=1;break e}let o=!!a.props.first;for(o&&j('props');n=a.props.first;){for(;l=n.activeChilds.props.first;){if(U()-r>=10){i=1,z('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'props')}o&&z('props');let s=!!a.tree.first;for(s&&j('tree');n=a.tree.first;){for(;l=n.activeChilds.tree.first;){if(U()-r>=10){i=1,z('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'tree')}s&&z('tree');let u=!!a.data.first;for(u&&j('data');n=a.data.first;){for(;l=n.activeChilds.data.first;){if(U()-r>=10){i=1,z('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'data')}u&&z('data')}if(z('execQueue'),i)a.rafID=_(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}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 o({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=r.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 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 c(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){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function f(e,t,a){d(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function h(e,t,a){d(a)?delete e.style[t]:e.style[t]=""+a}function v(e,t,a){d(a)?delete e.dataset[t]:e.dataset[t]=""+a}function m(e,t,a){if(d(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 g(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function y({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:i,env:o}){let s=H,u=$,p={id:++Q,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page)return console.error('context lost',a),0;if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?effector.launch({target:t,params:e,defer:1,page:l[n.indexOf(r)],stack:a}):console.error('context drift',{stack:a,node:t}):effector.launch({target:t,params:e,defer:1,page:null,stack:a})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{effector.launch({params:e,target:a.node,page:t,defer:1})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===l?{params:e,target:a.node,page:null,defer:1}:{params:e,target:a.node,page:n[l],defer:1})}else p.pages.forEach(t=>{t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:a.node,page:t,defer:1})})}else p.pages.forEach(t=>{effector.launch({params:e,target:a.node,page:t,defer:1})});return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let c=effector.createNode({meta:{template:p}});$=p;let d=H={template:p,node:c,api:null,trigger:{mount:effector.createEvent(),unmount:effector.createEvent()},draft:l,isSvgRoot:r,namespace:i,env:o};return a?d.deferredInit=()=>{let a=H,n=$;H=d,$=p,d.deferredInit=null;try{effector.withRegion(c,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{H=a,$=n}}:effector.withRegion(c,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),H=s,$=u,p.actor=d,d}function b(e){switch(e.type){case'list':return[...e.current];case'shape':return{...e.current};default:return e.current}}function w(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:i,domSubtree:o,hydration:s}){function u(e){if(e.before)for(let t of e.before)switch(t.type){case'map':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current=t.fn(f[a.id].current);break}case'field':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current[t.field]=f[a.id].current;break}case'closure':f[t.of.id]||(f[t.of.id]=t.of)}if(!e.after)return;let t=f[e.id].current;for(let a of e.after){let e=a.to;switch(f[e.id]||(f[e.id]={id:e.id,current:e.current}),a.type){case'copy':f[e.id].current=t;break;case'map':f[e.id].current=a.fn(t)}}}function p(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].current)}catch(e){console.error(e),t.stop=0}}let c=a?a.spawn:null,d=e.template,f={},h={id:++G,fullID:'',reg:f,template:d,parent:c,childSpawns:{},active:1};d.pages.push(h);let v={},m={spawn:h,api:v,draft:e.draft,ops:{group:i,domSubtree:o},svgRoot:l,data:r,parentLeaf:a,hydration:s},g=W;W=m,c&&(c.childSpawns[d.id]||(c.childSpawns[d.id]=[]),c.childSpawns[d.id].push(h)),h.fullID=c?`${c.fullID}_${h.id}`:""+h.id,c&&Object.assign(f,c.reg);for(let e of d.closure){let t=e,a=h.parent;e:for(;a;){if(e.id in a.reg){t=a.reg[e.id];break e}a=a.parent}f[e.id]=t}for(let e of d.plain){let t={id:e.id,current:b(e)};f[e.id]=t}for(let e in t){let a=d.nameMap[e].stateRef.id;f[a]={id:a,current:t[e]}}for(let e of d.closure)u(e);for(let e of d.plain)u(e);let y={i:0,stop:0};for(;!y.stop;)p(d.watch,y,f);if(c)for(let e in h.childSpawns)e in c.childSpawns||(c.childSpawns[e]=[]),c.childSpawns[e].push(...h.childSpawns[e]);if(v.mount=(t,a=1)=>effector.launch({target:e.trigger.mount,params:t,defer:a,page:h}),v.unmount=(t,a=1)=>effector.launch({target:e.trigger.unmount,params:t,defer:a,page:h}),e.api)for(let t in e.api)v[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:h});return m.spawn.api=v,m.spawn.leaf=m,m.api.mount({node:n,leaf:m}),W=g,m}function x(e){let t=function e(t){switch(t.type){case'fragment':switch(t.parent.type){case'EF':case'UF':return t.parent.parent}return e(t.parent.parent);case'route':default:return e(t.parent.parent)}}(e);return t?t.value:null}function k(e){if(!e.visible)return null;switch(e.type){case'FE':case'FT':return e.child;case'FR':return k(e.child.child);case'LF':case'RF':case'FF':return S(e.child);case'FRec':case'FRecItem':return S(e.child.child.child);case'FL':{let t=e.child.lastChild;if(!t)return null;for(;t;){let e=k(t);if(e)return e;t=t.left}return null}default:return null}}function S(e){let t=e.child;for(let e=t.length-1;e>=0;e--){let a=k(t[e]);if(a)return a}return null}function I(e){if('fragment'===e.type)switch(e.parent.type){case'EF':case'UF':return null;case'RecF':case'RecItemF':case'RF':{let t=e.parent.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=k(a.child[e]);if(t)return t}return I(a)}case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=k(a.child[e]);if(t)return t}return I(a)}case'LF':{let t=e.parent.left;for(;t;){let e=k(t);if(e)return e;t=t.left}return I(e.parent.parent)}default:return null}if('route'===e.type){let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=k(e);if(n)return n}return I(t)}let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=k(e);if(n)return n}return I(t)}function C(e){let t=I(e);return t?t.value:null}function F(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{R({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function R({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let o,{draft:u}=n,{queue:p}=t.ops.group,c=s(p),d=t.ops.domSubtree,f=d;switch(u.type){case'route':{let t={type:'route',parent:{type:'FR',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let t={type:'element',parent:{type:'FE',parent:e,child:null,visible:0,index:u.inParentIndex},child:{type:'EF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:u.stencil.cloneNode()};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'element',block:t,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(T(t),o.needToCallNode&&(o.needToCallNode=0,effector.launch({target:J,params:{element:t.value,fns:u.node},page:h.spawn}))):(t.value.remove(),t.parent.visible=0)},group:d})},needToCallNode:u.node.length>0},f=s(p);break}case'list':{let t={type:'list',parent:{type:'FL',parent:e,child:null,visible:1,index:u.inParentIndex},child:[],lastChild:null};t.parent.child=t,e.child[u.inParentIndex]=t.parent,o={type:'list',draft:u,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:{type:'FRec',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:{type:'FRecItem',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecItemF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec item',block:t};break}default:console.warn("unexpected draft type "+u.type)}let h=w(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:o,opGroup:c,domSubtree:f,hydration:t.hydration})}function T(e){let t=C(e);t?t.after(e.value):x(e).prepend(e.value),e.parent.visible=1}function A(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 l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function q(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function P(e){let t=H.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':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&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?D(t.config||{},t.on):D(t)}e.ɔ&&P(e.ɔ)}function D(e,t){let a=H.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});let{passive:n=1,capture:l=0,prevent:r=0,stop:i=0}=e;a.handler.push({options:{prevent:r,stop:i},domConfig:{passive:r?0:n,capture:l},map:t})}function E({source:e,visible:t,fn:a}){let n=y({name:'route',isSvgRoot:0,namespace:H.namespace,env:H.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:r,unmount:i}){let o=e.map(e=>({value:e,visible:t(e)})),s={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},u=y({name:'route item',isSvgRoot:0,namespace:H.namespace,env:H.env,draft:s,state:{store:null},fn({store:e},{mount:t,unmount:n}){let r=effector.createEvent();e.on(r,(e,t)=>t),a({store:e});let i=effector.sample({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,F(s,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),i.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}),O(e,e=>{let a=e.data;switch(a.type){case'element':l(t,a.ops.visible);break;default:console.log('unsupported type',a.type)}})}),effector.sample({source:t,clock:n,greedy:1}).watch(({leaf:e})=>{O(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,B(t,t.parent.childSpawns[t.template.id]),B(t,t.template.pages)})}});V(u);let{onMount:p,onState:c}=L({mount:r,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});effector.merge([p,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(R({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:u,values:{store:a}}),l.initialized=1)}),effector.sample({source:r,clock:i,greedy:1}).watch(({leaf:e})=>{O(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,B(t,t.parent.childSpawns[t.template.id]),B(t,t.template.pages)})}});V(n)}function O(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 M(e){let t={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},a=y({name:'rec',state:{store:null},isSvgRoot:0,namespace:H.namespace,env:H.env,draft:t,defer:1,fn({store:a},{mount:n,unmount:l}){e({state:a});let r=effector.createEvent();return a.on(r,(e,t)=>t),n.watch(({node:e,leaf:a})=>{F(t,{parentBlockFragment:a.data.block.child.child,leaf:a,node:e})}),effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,O(e,e=>{e.api.unmount()})}),{itemUpdater:r}}});return({state:e})=>{a.deferredInit&&a.deferredInit();let{env:t,namespace:n}=H;V(y({name:'rec item',isSvgRoot:0,namespace:n,env:t,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(t,{mount:n,unmount:l}){let{onMount:r,onState:i}=L({state:e,mount:n,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,O(e,e=>{e.api.unmount()})}),i.watch(({state:e,leaf:t})=>{O(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:n})=>{R({parentBlockFragment:t.data.block.child.child,leaf:t,node:e,actor:a,values:{store:n}})})}}))}}function N(e,t){'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:r,fields:i=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,d={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},f=H.env,h=H.namespace;V(y({name:'list',draft:d,isSvgRoot:0,namespace:h,fn(e,{mount:t,unmount:n}){let v=y({name:'list item',state:{id:-1,store:null},draft:d,isSvgRoot:0,namespace:h,fn({id:e,store:t},{mount:n,unmount:r}){a({store:t,key:e,fields:A(t,i)});let o=effector.createEvent();t.on(o,(e,t)=>t);let s=effector.createStore({leaf:null});if(effector.sample({source:s,clock:r,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;B(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,O(e,e=>{e.api.unmount()});let{spawn:l}=e;l.active=0,B(l,l.parent.childSpawns[l.template.id]),B(l,l.template.pages)}),d.itemVisible){let{onMount:e,onState:t}=L({mount:n,state:d.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{s.setState({leaf:a});let n=a.data.block;n.visible=e,n.childInitialized=e,e&&F(d,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?O(a,t=>{let a=t.data;switch(a.type){case'element':l(e,a.ops.visible);break;default:console.log('unsupported type',a.type)}}):e&&(n.childInitialized=1,F(d,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{s.setState({leaf:t});let a=t.data.block;a.visible=1,a.childInitialized=1,F(d,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:f}),m=effector.createStore([]),g=r.map(e=>e),b=effector.sample({source:r,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),x=effector.sample({source:b,clock:g,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1}),k=effector.merge([b,x]);effector.sample({source:m,clock:k,greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:l}){let i=n.data.block;j('list update ['+r.shortName+']');let d=Array(a.length).fill(0),f=a.map(o),h=[];for(let t=0;t<e.length;t++){let n=e[t],l=f.indexOf(n.key);-1!==l?(h.push(n),d[l]=1,c(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),p(n.asyncValue))}for(let e=0;e<a.length;e++){if(d[e])continue;let r=a[e],o=f[e],p=s(n.ops.group.queue),c={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:c},asyncValue:u({value:r,group:p,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(l||(m.instance=w(v,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l})))}})},g=h.length;h.push(m);let y=g>0?h[g-1].leafData:null;if(c.child.parent=c,i.child.push(c),y){let e=y.block;c.left=e;let t=e.right;t?(t.left=c,c.right=t):i.lastChild=c,e.right=c}else i.lastChild=c;l&&(m.instance=w(v,{values:{id:o,store:r},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l}))}return z('list update ['+r.shortName+']'),0===h.length&&(i.lastChild=null),h},target:m}),effector.sample({source:t,clock:effector.sample({source:m,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}let{spawn:a}=e;a.active=0,B(a,a.parent.childSpawns[a.template.id]),B(a,a.template.pages)})},env:f}))}function V(e){if(!H)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(H.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':t.inParentIndex=H.draft.childCount,H.draft.childCount+=1,H.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+H.draft.type)}}function B(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function L({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})}}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let j,z,U;'undefined'!=typeof performance&&performance.mark?(j=e=>{performance.mark('☄️ '+e+' start')},z=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(j=()=>{},z=()=>{}),U='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 _='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Q=0,G=0,$=null,W=null,H=null,J=effector.createEvent();J.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),exports.h=(e,t)=>{function a(e){return e.data.block.value}function r(e,t,a){let n=e.data.block.child.child,l={type:'text',parent:{type:'FT',parent:n,child:null,visible:0,index:a},value:null};if(l.parent.child=l,n.child[a]=l.parent,e.hydration){let e=I(l);if(e)switch(e.type){case'text':l.value=p.document.createTextNode(t),e.value.after(l.value);break;case'element':l.value=e.value.nextSibling,g(l.value,t)}else{let e=x(l);l.value=e.firstChild,g(l.value,t)}l.parent.visible=1}else l.value=p.document.createTextNode(t),T(l);return l}let o,s=0,u=0;'function'==typeof t?(s=1,o=t):t&&(u=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)));let p=H.env,c=H.namespace,d=c,b='html';d=b='svg'===c?'svg':'html','svg'===e&&(b='svg',d='svg');let w='svg'===b?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e);'foreignObject'===c?(w.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),d='html'):'svg'===e?(w.setAttribute('xmlns','http://www.w3.org/2000/svg'),d='svg'):'foreignObject'===e&&(d='foreignObject');let k=w,S={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:k,seq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]},R=y({name:'element',draft:S,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:p,unmount:c}){function d(e){return L({mount:y,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let y=effector.createEvent(),b=p.map(({leaf:e})=>e);s&&o(),u&&P(t);let w={attr:{},data:{},text:S.text,styleProp:{},styleVar:{},visible:S.visible||null,handler:S.handler};for(let e=0;e<S.attr.length;e++){let t=S.attr[e];for(let e in t)'xlink:href'===e?w.attr.href=t[e]:w.attr[e]=t[e]}for(let e=0;e<S.data.length;e++){let t=S.data[e];for(let e in t)w.data[e]=t[e]}for(let e=0;e<S.styleProp.length;e++){let t=S.styleProp[e];for(let e in t)e.startsWith('--')?w.styleVar[e.slice(2)]=t[e]:w.styleProp[e]=t[e]}for(let e=0;e<S.styleVar.length;e++){let t=S.styleVar[e];for(let e in t)w.styleVar[e]=t[e]}w.visible&&S.seq.push({type:'visible',value:w.visible});for(let e in w.attr){let t=w.attr[e];effector.is.unit(t)?S.seq.push({type:'attr',field:e,value:t}):m(k,e,t)}for(let e in w.data){let t=w.data[e];effector.is.unit(t)?S.seq.push({type:'data',field:e,value:t}):v(k,e,t)}for(let e in w.styleProp){let t=w.styleProp[e];effector.is.unit(t)?S.seq.push({type:'style',field:e,value:t}):h(k,e,t)}for(let e in w.styleVar){let t=w.styleVar[e];effector.is.unit(t)?S.seq.push({type:'styleVar',field:e,value:t}):f(k,e,t)}for(let e=0;e<w.text.length;e++){let t=w.text[e];if(null!==t.value)if(effector.is.unit(t.value)){S.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=$;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else S.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<w.handler.length;e++){let t=w.handler[e];for(let e in t.map)S.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(w.visible){let{onMount:e,onState:t}=L({mount:b,state:w.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 l=e.data,r=l.block;if(a&&(n(t,l.ops.visible),t)){let e,t=C(r);if(e=t?t.nextSibling:x(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,effector.launch({target:J,params:{element:l.block.value,fns:S.node},page:e.spawn,defer:1})),effector.launch({target:y,params:e,defer:1,page:e.spawn})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}for(let e=0;e<S.seq.length;e++){let t=S.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}=d(t.value);if(n)effector.merge([o,r]).watch(({leaf:t,value:n})=>{m(a(t),e,n)});else{let t=S.opsAmount++;r.watch(({value:n,leaf:l})=>{let r=a(l),o=i({value:n,priority:'props',runOp(t){m(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=o,m(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){v(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,v(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'style':{let e=S.opsAmount++,{field:n}=t,{onMount:r,onState:o}=d(t.value);r.watch(({value:t,leaf:l})=>{let r=a(l),o=i({value:t,priority:'props',runOp(e){h(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=o,h(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){f(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,f(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'staticText':y.map(e=>e).watch(e=>{r(e,t.value,t.childIndex)});break;case'dynamicText':{let e=S.opsAmount++;effector.sample({source:t.value,clock:y,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:n})=>{let l=i({value:a,priority:'props',runOp(e){g(o.value,e)},group:n.ops.group});n.ops.group.ops[e]=l;let o=r(n,a,t.childIndex)}),effector.sample({source:y,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;y.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:t.handler,params:e,page:l})},t.domConfig)});break}}}effector.sample({source:b,clock:c,greedy:1}).watch(e=>{let{spawn:t}=e;B(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,B(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,e.data.ops.visible)}),p.watch(({leaf:e})=>{let t=e.data;if(!S.visible){let a=t.ops.visible,r=t.block;if(e.hydration){n(1,a);let e,t=C(r);if(e=t?t.nextSibling:x(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),effector.launch({target:y,params:e,defer:1,page:e.spawn}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:J,params:{element:t.block.value,fns:S.node},page:e.spawn,defer:1})):l(1,a)}})},env:p});V(R)},exports.handler=D,exports.list=N,exports.node=e=>{let t=H.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':return}t.node.push(e)},exports.rec=M,exports.remap=A,exports.route=E,exports.spec=P,exports.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);P({text:a})},exports.tree=({source:e,child:t,fn:a})=>{let n=M(({state:e})=>{N({source:e,fn({store:e}){let l=e.map(e=>e[t]||[]);a({store:e,child(){n({state:l})}})}})});n({state:e})},exports.using=(e,t)=>{let a,n,l,r,i;'function'==typeof t?(a=t,l=q(),r=0):(a=t.fn,l=t.env?t.env:q(),r=t.hydrate,n=t.onComplete,i=t.onRoot);let u=e.namespaceURI,p=e.tagName.toLowerCase(),c={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=y({name:'using',draft:c,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{F(c,{parentBlockFragment:t.data.block.child.child,leaf:t,node:e})})},env:l}),f={type:'using',child:{type:'UF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:e};f.child.parent=f,f.child.child.parent=f.child;let h=o({onComplete:n}),v=w(d,{parentLeaf:W||null,mountNode:e,svgRoot:d.isSvgRoot?e:W?W.svgRoot:null,leafData:{type:'using',draft:c,element:e,block:f},opGroup:s(h),domSubtree:s(h),hydration:r});i&&i({template:d,leaf:v})},exports.variant=({source:e,cases:t,key:a})=>{let n='function'==typeof a?a:e=>String(e[a]),l=0;for(let a in t)'__'!==a?E({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);E({source:e,visible:e=>!a.includes(n(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,n;e.status='active',t=a(e),(n=e).cursor.prev&&(n.cursor.prev.cursor.next=n.cursor.next),n.cursor.next&&(n.cursor.next.cursor.prev=n.cursor.prev),t.last===n&&(t.last=n.cursor.prev),t.first===n&&(t.first=n.cursor.next),n.cursor.prev=null,n.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function n(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function l(n,l){if(l.value.active===n)return l.value.pending=n,void('pending'===l.status&&(t(l),a(l).first||e(l.group,l.priority)));var r,i,o,s;'active'===l.status&&(l.status='pending',a(l).first||((o=l.group).queue[s=l.priority].last?(o.cursor[s].prev=o.queue[s].last,o.queue[s].last.cursor[s].next=o,o.queue[s].last=o):o.queue[s].first=o.queue[s].last=o),i=l,(r=a(l)).last?(i.cursor.prev=r.last,r.last.cursor.next=i,r.last=i):r.first=r.last=i),l.value.pending=n,l.group.queue.rafID||(l.group.queue.rafID=_(l.group.queue.execQueue))}function r(a){j('execQueue');let n,l,r=U(),i=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(U()-r>=10){i=1;break e}let o=!!a.props.first;for(o&&j('props');n=a.props.first;){for(;l=n.activeChilds.props.first;){if(U()-r>=10){i=1,z('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'props')}o&&z('props');let s=!!a.tree.first;for(s&&j('tree');n=a.tree.first;){for(;l=n.activeChilds.tree.first;){if(U()-r>=10){i=1,z('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'tree')}s&&z('tree');let u=!!a.data.first;for(u&&j('data');n=a.data.first;){for(;l=n.activeChilds.data.first;){if(U()-r>=10){i=1,z('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'data')}u&&z('data')}if(z('execQueue'),i)a.rafID=_(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}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 o({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=r.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 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 c(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){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function f(e,t,a){d(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function h(e,t,a){d(a)?delete e.style[t]:e.style[t]=""+a}function v(e,t,a){d(a)?delete e.dataset[t]:e.dataset[t]=""+a}function m(e,t,a){if(d(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 g(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function y({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:i,env:o}){let s=H,u=$,p={id:++Q,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:effector.step.filter({fn(e,t,a){if(!a.page)return console.error('context lost',a),0;if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?effector.launch({target:t,params:e,defer:1,page:l[n.indexOf(r)],stack:a}):console.error('context drift',{stack:a,node:t}):effector.launch({target:t,params:e,defer:1,page:null,stack:a})}),0}}),loader:effector.step.filter({fn(e,t,a){if(a.parent){if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{effector.launch({params:e,target:a.node,page:t,defer:1})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);effector.launch(-1===l?{params:e,target:a.node,page:null,defer:1}:{params:e,target:a.node,page:n[l],defer:1})}else p.pages.forEach(t=>{t.fullID.startsWith(a.page.fullID)&&effector.launch({params:e,target:a.node,page:t,defer:1})})}else p.pages.forEach(t=>{effector.launch({params:e,target:a.node,page:t,defer:1})});return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let c=effector.createNode({meta:{template:p}});$=p;let d=H={template:p,node:c,api:null,trigger:{mount:effector.createEvent(),unmount:effector.createEvent()},draft:l,isSvgRoot:r,namespace:i,env:o};return a?d.deferredInit=()=>{let a=H,n=$;H=d,$=p,d.deferredInit=null;try{effector.withRegion(c,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{H=a,$=n}}:effector.withRegion(c,()=>{let a=effector.restore(t);d.api=e(a,d.trigger),p.nameMap=a}),H=s,$=u,p.actor=d,d}function b(e){switch(e.type){case'list':return[...e.current];case'shape':return{...e.current};default:return e.current}}function w(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:i,domSubtree:o,hydration:s}){function u(e){if(e.before)for(let t of e.before)switch(t.type){case'map':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current=t.fn(f[a.id].current);break}case'field':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current[t.field]=f[a.id].current;break}case'closure':f[t.of.id]||(f[t.of.id]=t.of)}if(!e.after)return;let t=f[e.id].current;for(let a of e.after){let e=a.to;switch(f[e.id]||(f[e.id]={id:e.id,current:e.current}),a.type){case'copy':f[e.id].current=t;break;case'map':f[e.id].current=a.fn(t)}}}function p(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].current)}catch(e){console.error(e),t.stop=0}}let c=a?a.spawn:null,d=e.template,f={},h={id:++G,fullID:'',reg:f,template:d,parent:c,childSpawns:{},active:1};d.pages.push(h);let v={},m={spawn:h,api:v,draft:e.draft,ops:{group:i,domSubtree:o},svgRoot:l,data:r,parentLeaf:a,hydration:s},g=W;W=m,c&&(c.childSpawns[d.id]||(c.childSpawns[d.id]=[]),c.childSpawns[d.id].push(h)),h.fullID=c?`${c.fullID}_${h.id}`:""+h.id,c&&Object.assign(f,c.reg);for(let e of d.closure){let t=e,a=h.parent;e:for(;a;){if(e.id in a.reg){t=a.reg[e.id];break e}a=a.parent}f[e.id]=t}for(let e of d.plain){let t={id:e.id,current:b(e)};f[e.id]=t}for(let e in t){let a=d.nameMap[e].stateRef.id;f[a]={id:a,current:t[e]}}for(let e of d.closure)u(e);for(let e of d.plain)u(e);let y={i:0,stop:0};for(;!y.stop;)p(d.watch,y,f);if(c)for(let e in h.childSpawns)e in c.childSpawns||(c.childSpawns[e]=[]),c.childSpawns[e].push(...h.childSpawns[e]);if(v.mount=(t,a=1)=>effector.launch({target:e.trigger.mount,params:t,defer:a,page:h}),v.unmount=(t,a=1)=>effector.launch({target:e.trigger.unmount,params:t,defer:a,page:h}),e.api)for(let t in e.api)v[t]=(a,n=1)=>effector.launch({target:e.api[t],params:a,defer:n,page:h});return m.spawn.api=v,m.spawn.leaf=m,m.api.mount({node:n,leaf:m}),W=g,m}function x(e){let t=function e(t){switch(t.type){case'fragment':switch(t.parent.type){case'EF':case'UF':return t.parent.parent}return e(t.parent.parent);case'route':default:return e(t.parent.parent)}}(e);return t?t.value:null}function k(e){if(!e.visible)return null;switch(e.type){case'FE':case'FT':return e.child;case'FR':return k(e.child.child);case'LF':case'RF':case'FF':return S(e.child);case'FRec':case'FRecItem':return S(e.child.child.child);case'FL':{let t=e.child.lastChild;if(!t)return null;for(;t;){let e=k(t);if(e)return e;t=t.left}return null}default:return null}}function S(e){let t=e.child;for(let e=t.length-1;e>=0;e--){let a=k(t[e]);if(a)return a}return null}function I(e){if('fragment'===e.type)switch(e.parent.type){case'EF':case'UF':return null;case'RecF':case'RecItemF':case'RF':{let t=e.parent.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=k(a.child[e]);if(t)return t}return I(a)}case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=k(a.child[e]);if(t)return t}return I(a)}case'LF':{let t=e.parent.left;for(;t;){let e=k(t);if(e)return e;t=t.left}return I(e.parent.parent)}default:return null}if('route'===e.type){let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=k(e);if(n)return n}return I(t)}let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=k(e);if(n)return n}return I(t)}function C(e){let t=I(e);return t?t.value:null}function F(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{R({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function R({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let o,{draft:u}=n,{queue:p}=t.ops.group,c=s(p),d=t.ops.domSubtree,f=d;switch(u.type){case'route':{let t={type:'route',parent:{type:'FR',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let t={type:'element',parent:{type:'FE',parent:e,child:null,visible:0,index:u.inParentIndex},child:{type:'EF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:u.stencil.cloneNode()};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'element',block:t,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(T(t),o.needToCallNode&&(o.needToCallNode=0,effector.launch({target:J,params:{element:t.value,fns:u.node},page:h.spawn}))):(t.value.remove(),t.parent.visible=0)},group:d})},needToCallNode:u.node.length>0},f=s(p);break}case'list':{let t={type:'list',parent:{type:'FL',parent:e,child:null,visible:1,index:u.inParentIndex},child:[],lastChild:null};t.parent.child=t,e.child[u.inParentIndex]=t.parent,o={type:'list',draft:u,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:{type:'FRec',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:{type:'FRecItem',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecItemF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec item',block:t};break}default:console.warn("unexpected draft type "+u.type)}let h=w(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:o,opGroup:c,domSubtree:f,hydration:t.hydration})}function T(e){let t=C(e);t?t.after(e.value):x(e).prepend(e.value),e.parent.visible=1}function A(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 l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function q(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function P(e){let t=H.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':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&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?D(t.config||{},t.on):D(t)}e.ɔ&&P(e.ɔ)}function D(e,t){let a=H.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});let{passive:n=1,capture:l=0,prevent:r=0,stop:i=0}=e;a.handler.push({options:{prevent:r,stop:i},domConfig:{passive:r?0:n,capture:l},map:t})}function E({source:e,visible:t,fn:a}){let n=y({name:'route',isSvgRoot:0,namespace:H.namespace,env:H.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:r,unmount:i}){let o=e.map(e=>({value:e,visible:t(e)})),s={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},u=y({name:'route item',isSvgRoot:0,namespace:H.namespace,env:H.env,draft:s,state:{store:null},fn({store:e},{mount:t,unmount:n}){let r=effector.createEvent();e.on(r,(e,t)=>t),a({store:e});let i=effector.sample({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,F(s,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),i.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});let n=e=>{let a=e.data;switch(a.type){case'element':l(t,a.ops.visible);break;case'route':O(e,n);break;default:console.log('unsupported type',a.type)}};O(e,n)}),effector.sample({source:t,clock:n,greedy:1}).watch(({leaf:e})=>{O(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,B(t,t.parent.childSpawns[t.template.id]),B(t,t.template.pages)})}});V(u);let{onMount:p,onState:c}=L({mount:r,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});effector.merge([p,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(R({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:u,values:{store:a}}),l.initialized=1)}),effector.sample({source:r,clock:i,greedy:1}).watch(({leaf:e})=>{O(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,B(t,t.parent.childSpawns[t.template.id]),B(t,t.template.pages)})}});V(n)}function O(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 M(e){let t={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},a=y({name:'rec',state:{store:null},isSvgRoot:0,namespace:H.namespace,env:H.env,draft:t,defer:1,fn({store:a},{mount:n,unmount:l}){e({state:a});let r=effector.createEvent();return a.on(r,(e,t)=>t),n.watch(({node:e,leaf:a})=>{F(t,{parentBlockFragment:a.data.block.child.child,leaf:a,node:e})}),effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,O(e,e=>{e.api.unmount()})}),{itemUpdater:r}}});return({state:e})=>{a.deferredInit&&a.deferredInit();let{env:t,namespace:n}=H;V(y({name:'rec item',isSvgRoot:0,namespace:n,env:t,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(t,{mount:n,unmount:l}){let{onMount:r,onState:i}=L({state:e,mount:n,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});effector.sample({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,O(e,e=>{e.api.unmount()})}),i.watch(({state:e,leaf:t})=>{O(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:n})=>{R({parentBlockFragment:t.data.block.child.child,leaf:t,node:e,actor:a,values:{store:n}})})}}))}}function N(e,t){'function'==typeof t&&(effector.is.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:r,fields:i=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,d={type:'list',key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},f=H.env,h=H.namespace;V(y({name:'list',draft:d,isSvgRoot:0,namespace:h,fn(e,{mount:t,unmount:n}){let v=y({name:'list item',state:{id:-1,store:null},draft:d,isSvgRoot:0,namespace:h,fn({id:e,store:t},{mount:n,unmount:r}){a({store:t,key:e,fields:A(t,i)});let o=effector.createEvent();t.on(o,(e,t)=>t);let s=effector.createStore({leaf:null});if(effector.sample({source:s,clock:r,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;B(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,O(e,e=>{e.api.unmount()});let{spawn:l}=e;l.active=0,B(l,l.parent.childSpawns[l.template.id]),B(l,l.template.pages)}),d.itemVisible){let{onMount:e,onState:t}=L({mount:n,state:d.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{s.setState({leaf:a});let n=a.data.block;n.visible=e,n.childInitialized=e,e&&F(d,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?O(a,t=>{let a=t.data;switch(a.type){case'element':l(e,a.ops.visible);break;default:console.log('unsupported type',a.type)}}):e&&(n.childInitialized=1,F(d,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{s.setState({leaf:t});let a=t.data.block;a.visible=1,a.childInitialized=1,F(d,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:f}),m=effector.createStore([]),g=r.map(e=>e),b=effector.sample({source:r,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),x=effector.sample({source:b,clock:g,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1}),k=effector.merge([b,x]);effector.sample({source:m,clock:k,greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:l}){let i=n.data.block;j('list update ['+r.shortName+']');let d=Array(a.length).fill(0),f=a.map(o),h=[];for(let t=0;t<e.length;t++){let n=e[t],l=f.indexOf(n.key);-1!==l?(h.push(n),d[l]=1,c(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),p(n.asyncValue))}for(let e=0;e<a.length;e++){if(d[e])continue;let r=a[e],o=f[e],p=s(n.ops.group.queue),c={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:c},asyncValue:u({value:r,group:p,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(l||(m.instance=w(v,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l})))}})},g=h.length;h.push(m);let y=g>0?h[g-1].leafData:null;if(c.child.parent=c,i.child.push(c),y){let e=y.block;c.left=e;let t=e.right;t?(t.left=c,c.right=t):i.lastChild=c,e.right=c}else i.lastChild=c;l&&(m.instance=w(v,{values:{id:o,store:r},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l}))}return z('list update ['+r.shortName+']'),0===h.length&&(i.lastChild=null),h},target:m}),effector.sample({source:t,clock:effector.sample({source:m,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}let{spawn:a}=e;a.active=0,B(a,a.parent.childSpawns[a.template.id]),B(a,a.template.pages)})},env:f}))}function V(e){if(!H)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(H.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':t.inParentIndex=H.draft.childCount,H.draft.childCount+=1,H.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+H.draft.type)}}function B(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function L({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})}}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');let j,z,U;'undefined'!=typeof performance&&performance.mark?(j=e=>{performance.mark('☄️ '+e+' start')},z=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(j=()=>{},z=()=>{}),U='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 _='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Q=0,G=0,$=null,W=null,H=null,J=effector.createEvent();J.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),exports.h=(e,t)=>{function a(e){return e.data.block.value}function r(e,t,a){let n=e.data.block.child.child,l={type:'text',parent:{type:'FT',parent:n,child:null,visible:0,index:a},value:null};if(l.parent.child=l,n.child[a]=l.parent,e.hydration){let e=I(l);if(e)switch(e.type){case'text':l.value=p.document.createTextNode(t),e.value.after(l.value);break;case'element':l.value=e.value.nextSibling,g(l.value,t)}else{let e=x(l);l.value=e.firstChild,g(l.value,t)}l.parent.visible=1}else l.value=p.document.createTextNode(t),T(l);return l}let o,s=0,u=0;'function'==typeof t?(s=1,o=t):t&&(u=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)));let p=H.env,c=H.namespace,d=c,b='html';d=b='svg'===c?'svg':'html','svg'===e&&(b='svg',d='svg');let w='svg'===b?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e);'foreignObject'===c?(w.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),d='html'):'svg'===e?(w.setAttribute('xmlns','http://www.w3.org/2000/svg'),d='svg'):'foreignObject'===e&&(d='foreignObject');let k=w,S={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:k,seq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]},R=y({name:'element',draft:S,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:p,unmount:c}){function d(e){return L({mount:y,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let y=effector.createEvent(),b=p.map(({leaf:e})=>e);s&&o(),u&&P(t);let w={attr:{},data:{},text:S.text,styleProp:{},styleVar:{},visible:S.visible||null,handler:S.handler};for(let e=0;e<S.attr.length;e++){let t=S.attr[e];for(let e in t)'xlink:href'===e?w.attr.href=t[e]:w.attr[e]=t[e]}for(let e=0;e<S.data.length;e++){let t=S.data[e];for(let e in t)w.data[e]=t[e]}for(let e=0;e<S.styleProp.length;e++){let t=S.styleProp[e];for(let e in t)e.startsWith('--')?w.styleVar[e.slice(2)]=t[e]:w.styleProp[e]=t[e]}for(let e=0;e<S.styleVar.length;e++){let t=S.styleVar[e];for(let e in t)w.styleVar[e]=t[e]}w.visible&&S.seq.push({type:'visible',value:w.visible});for(let e in w.attr){let t=w.attr[e];effector.is.unit(t)?S.seq.push({type:'attr',field:e,value:t}):m(k,e,t)}for(let e in w.data){let t=w.data[e];effector.is.unit(t)?S.seq.push({type:'data',field:e,value:t}):v(k,e,t)}for(let e in w.styleProp){let t=w.styleProp[e];effector.is.unit(t)?S.seq.push({type:'style',field:e,value:t}):h(k,e,t)}for(let e in w.styleVar){let t=w.styleVar[e];effector.is.unit(t)?S.seq.push({type:'styleVar',field:e,value:t}):f(k,e,t)}for(let e=0;e<w.text.length;e++){let t=w.text[e];if(null!==t.value)if(effector.is.unit(t.value)){S.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=$;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else S.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<w.handler.length;e++){let t=w.handler[e];for(let e in t.map)S.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(w.visible){let{onMount:e,onState:t}=L({mount:b,state:w.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 l=e.data,r=l.block;if(a&&(n(t,l.ops.visible),t)){let e,t=C(r);if(e=t?t.nextSibling:x(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,effector.launch({target:J,params:{element:l.block.value,fns:S.node},page:e.spawn,defer:1})),effector.launch({target:y,params:e,defer:1,page:e.spawn})}),effector.merge([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}for(let e=0;e<S.seq.length;e++){let t=S.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}=d(t.value);if(n)effector.merge([o,r]).watch(({leaf:t,value:n})=>{m(a(t),e,n)});else{let t=S.opsAmount++;r.watch(({value:n,leaf:l})=>{let r=a(l),o=i({value:n,priority:'props',runOp(t){m(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=o,m(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){v(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,v(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'style':{let e=S.opsAmount++,{field:n}=t,{onMount:r,onState:o}=d(t.value);r.watch(({value:t,leaf:l})=>{let r=a(l),o=i({value:t,priority:'props',runOp(e){h(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=o,h(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){f(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,f(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'staticText':y.map(e=>e).watch(e=>{r(e,t.value,t.childIndex)});break;case'dynamicText':{let e=S.opsAmount++;effector.sample({source:t.value,clock:y,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:n})=>{let l=i({value:a,priority:'props',runOp(e){g(o.value,e)},group:n.ops.group});n.ops.group.ops[e]=l;let o=r(n,a,t.childIndex)}),effector.sample({source:y,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;y.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),effector.launch({target:t.handler,params:e,page:l})},t.domConfig)});break}}}effector.sample({source:b,clock:c,greedy:1}).watch(e=>{let{spawn:t}=e;B(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,B(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,e.data.ops.visible)}),p.watch(({leaf:e})=>{let t=e.data;if(!S.visible){let a=t.ops.visible,r=t.block;if(e.hydration){n(1,a);let e,t=C(r);if(e=t?t.nextSibling:x(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),effector.launch({target:y,params:e,defer:1,page:e.spawn}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,effector.launch({target:J,params:{element:t.block.value,fns:S.node},page:e.spawn,defer:1})):l(1,a)}})},env:p});V(R)},exports.handler=D,exports.list=N,exports.node=e=>{let t=H.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':return}t.node.push(e)},exports.rec=M,exports.remap=A,exports.route=E,exports.spec=P,exports.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);P({text:a})},exports.tree=({source:e,child:t,fn:a})=>{let n=M(({state:e})=>{N({source:e,fn({store:e}){let l=e.map(e=>e[t]||[]);a({store:e,child(){n({state:l})}})}})});n({state:e})},exports.using=(e,t)=>{let a,n,l,r,i;'function'==typeof t?(a=t,l=q(),r=0):(a=t.fn,l=t.env?t.env:q(),r=t.hydrate,n=t.onComplete,i=t.onRoot);let u=e.namespaceURI,p=e.tagName.toLowerCase(),c={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=y({name:'using',draft:c,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{F(c,{parentBlockFragment:t.data.block.child.child,leaf:t,node:e})})},env:l}),f={type:'using',child:{type:'UF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:e};f.child.parent=f,f.child.child.parent=f.child;let h=o({onComplete:n}),v=w(d,{parentLeaf:W||null,mountNode:e,svgRoot:d.isSvgRoot?e:W?W.svgRoot:null,leafData:{type:'using',draft:c,element:e,block:f},opGroup:s(h),domSubtree:s(h),hydration:r});i&&i({template:d,leaf:v})},exports.variant=({source:e,cases:t,key:a})=>{let n='function'==typeof a?a:e=>String(e[a]),l=0;for(let a in t)'__'!==a?E({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);E({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}};
//# sourceMappingURL=forest.cjs.js.map

@@ -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,n;e.status='active',t=a(e),(n=e).cursor.prev&&(n.cursor.prev.cursor.next=n.cursor.next),n.cursor.next&&(n.cursor.next.cursor.prev=n.cursor.prev),t.last===n&&(t.last=n.cursor.prev),t.first===n&&(t.first=n.cursor.next),n.cursor.prev=null,n.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function n(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function l(n,l){if(l.value.active===n)return l.value.pending=n,void('pending'===l.status&&(t(l),a(l).first||e(l.group,l.priority)));var r,i,o,s;'active'===l.status&&(l.status='pending',a(l).first||((o=l.group).queue[s=l.priority].last?(o.cursor[s].prev=o.queue[s].last,o.queue[s].last.cursor[s].next=o,o.queue[s].last=o):o.queue[s].first=o.queue[s].last=o),i=l,(r=a(l)).last?(i.cursor.prev=r.last,r.last.cursor.next=i,r.last=i):r.first=r.last=i),l.value.pending=n,l.group.queue.rafID||(l.group.queue.rafID=re(l.group.queue.execQueue))}function r(a){ae('execQueue');let n,l,r=le(),i=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(le()-r>=10){i=1;break e}let o=!!a.props.first;for(o&&ae('props');n=a.props.first;){for(;l=n.activeChilds.props.first;){if(le()-r>=10){i=1,ne('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'props')}o&&ne('props');let s=!!a.tree.first;for(s&&ae('tree');n=a.tree.first;){for(;l=n.activeChilds.tree.first;){if(le()-r>=10){i=1,ne('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'tree')}s&&ne('tree');let u=!!a.data.first;for(u&&ae('data');n=a.data.first;){for(;l=n.activeChilds.data.first;){if(le()-r>=10){i=1,ne('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'data')}u&&ne('data')}if(ne('execQueue'),i)a.rafID=re(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}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 o({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=r.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 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 c(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){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function f(e,t,a){d(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function h(e,t,a){d(a)?delete e.style[t]:e.style[t]=""+a}function v(e,t,a){d(a)?delete e.dataset[t]:e.dataset[t]=""+a}function m(e,t,a){if(d(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 g(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function y({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:i,env:o}){let s=pe,u=se,p={id:++ie,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:$.filter({fn(e,t,a){if(!a.page)return console.error('context lost',a),0;if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?W({target:t,params:e,defer:1,page:l[n.indexOf(r)],stack:a}):console.error('context drift',{stack:a,node:t}):W({target:t,params:e,defer:1,page:null,stack:a})}),0}}),loader:$.filter({fn(e,t,a){if(a.parent){if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{W({params:e,target:a.node,page:t,defer:1})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);W(-1===l?{params:e,target:a.node,page:null,defer:1}:{params:e,target:a.node,page:n[l],defer:1})}else p.pages.forEach(t=>{t.fullID.startsWith(a.page.fullID)&&W({params:e,target:a.node,page:t,defer:1})})}else p.pages.forEach(t=>{W({params:e,target:a.node,page:t,defer:1})});return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let c=H({meta:{template:p}});se=p;let d=pe={template:p,node:c,api:null,trigger:{mount:J(),unmount:J()},draft:l,isSvgRoot:r,namespace:i,env:o};return a?d.deferredInit=()=>{let a=pe,n=se;pe=d,se=p,d.deferredInit=null;try{K(c,()=>{let a=X(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{pe=a,se=n}}:K(c,()=>{let a=X(t);d.api=e(a,d.trigger),p.nameMap=a}),pe=s,se=u,p.actor=d,d}function b(e){switch(e.type){case'list':return[...e.current];case'shape':return{...e.current};default:return e.current}}function w(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:i,domSubtree:o,hydration:s}){function u(e){if(e.before)for(let t of e.before)switch(t.type){case'map':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current=t.fn(f[a.id].current);break}case'field':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current[t.field]=f[a.id].current;break}case'closure':f[t.of.id]||(f[t.of.id]=t.of)}if(!e.after)return;let t=f[e.id].current;for(let a of e.after){let e=a.to;switch(f[e.id]||(f[e.id]={id:e.id,current:e.current}),a.type){case'copy':f[e.id].current=t;break;case'map':f[e.id].current=a.fn(t)}}}function p(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].current)}catch(e){console.error(e),t.stop=0}}let c=a?a.spawn:null,d=e.template,f={},h={id:++oe,fullID:'',reg:f,template:d,parent:c,childSpawns:{},active:1};d.pages.push(h);let v={},m={spawn:h,api:v,draft:e.draft,ops:{group:i,domSubtree:o},svgRoot:l,data:r,parentLeaf:a,hydration:s},g=ue;ue=m,c&&(c.childSpawns[d.id]||(c.childSpawns[d.id]=[]),c.childSpawns[d.id].push(h)),h.fullID=c?`${c.fullID}_${h.id}`:""+h.id,c&&Object.assign(f,c.reg);for(let e of d.closure){let t=e,a=h.parent;e:for(;a;){if(e.id in a.reg){t=a.reg[e.id];break e}a=a.parent}f[e.id]=t}for(let e of d.plain){let t={id:e.id,current:b(e)};f[e.id]=t}for(let e in t){let a=d.nameMap[e].stateRef.id;f[a]={id:a,current:t[e]}}for(let e of d.closure)u(e);for(let e of d.plain)u(e);let y={i:0,stop:0};for(;!y.stop;)p(d.watch,y,f);if(c)for(let e in h.childSpawns)e in c.childSpawns||(c.childSpawns[e]=[]),c.childSpawns[e].push(...h.childSpawns[e]);if(v.mount=(t,a=1)=>W({target:e.trigger.mount,params:t,defer:a,page:h}),v.unmount=(t,a=1)=>W({target:e.trigger.unmount,params:t,defer:a,page:h}),e.api)for(let t in e.api)v[t]=(a,n=1)=>W({target:e.api[t],params:a,defer:n,page:h});return m.spawn.api=v,m.spawn.leaf=m,m.api.mount({node:n,leaf:m}),ue=g,m}function k(e){let t=function e(t){switch(t.type){case'fragment':switch(t.parent.type){case'EF':case'UF':return t.parent.parent}return e(t.parent.parent);case'route':default:return e(t.parent.parent)}}(e);return t?t.value:null}function x(e){if(!e.visible)return null;switch(e.type){case'FE':case'FT':return e.child;case'FR':return x(e.child.child);case'LF':case'RF':case'FF':return S(e.child);case'FRec':case'FRecItem':return S(e.child.child.child);case'FL':{let t=e.child.lastChild;if(!t)return null;for(;t;){let e=x(t);if(e)return e;t=t.left}return null}default:return null}}function S(e){let t=e.child;for(let e=t.length-1;e>=0;e--){let a=x(t[e]);if(a)return a}return null}function I(e){if('fragment'===e.type)switch(e.parent.type){case'EF':case'UF':return null;case'RecF':case'RecItemF':case'RF':{let t=e.parent.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=x(a.child[e]);if(t)return t}return I(a)}case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=x(a.child[e]);if(t)return t}return I(a)}case'LF':{let t=e.parent.left;for(;t;){let e=x(t);if(e)return e;t=t.left}return I(e.parent.parent)}default:return null}if('route'===e.type){let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=x(e);if(n)return n}return I(t)}let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=x(e);if(n)return n}return I(t)}function C(e){let t=I(e);return t?t.value:null}function F(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{R({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function R({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let o,{draft:u}=n,{queue:p}=t.ops.group,c=s(p),d=t.ops.domSubtree,f=d;switch(u.type){case'route':{let t={type:'route',parent:{type:'FR',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let t={type:'element',parent:{type:'FE',parent:e,child:null,visible:0,index:u.inParentIndex},child:{type:'EF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:u.stencil.cloneNode()};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'element',block:t,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(T(t),o.needToCallNode&&(o.needToCallNode=0,W({target:ce,params:{element:t.value,fns:u.node},page:h.spawn}))):(t.value.remove(),t.parent.visible=0)},group:d})},needToCallNode:u.node.length>0},f=s(p);break}case'list':{let t={type:'list',parent:{type:'FL',parent:e,child:null,visible:1,index:u.inParentIndex},child:[],lastChild:null};t.parent.child=t,e.child[u.inParentIndex]=t.parent,o={type:'list',draft:u,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:{type:'FRec',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:{type:'FRecItem',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecItemF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec item',block:t};break}default:console.warn("unexpected draft type "+u.type)}let h=w(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:o,opGroup:c,domSubtree:f,hydration:t.hydration})}function T(e){let t=C(e);t?t.after(e.value):k(e).prepend(e.value),e.parent.visible=1}function A(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 l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function q(e,t){function a(e){return e.data.block.value}function r(e,t,a){let n=e.data.block.child.child,l={type:'text',parent:{type:'FT',parent:n,child:null,visible:0,index:a},value:null};if(l.parent.child=l,n.child[a]=l.parent,e.hydration){let e=I(l);if(e)switch(e.type){case'text':l.value=p.document.createTextNode(t),e.value.after(l.value);break;case'element':l.value=e.value.nextSibling,g(l.value,t)}else{let e=k(l);l.value=e.firstChild,g(l.value,t)}l.parent.visible=1}else l.value=p.document.createTextNode(t),T(l);return l}let o,s=0,u=0;'function'==typeof t?(s=1,o=t):t&&(u=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)));let p=pe.env,c=pe.namespace,d=c,b='html';d=b='svg'===c?'svg':'html','svg'===e&&(b='svg',d='svg');let w='svg'===b?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e);'foreignObject'===c?(w.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),d='html'):'svg'===e?(w.setAttribute('xmlns','http://www.w3.org/2000/svg'),d='svg'):'foreignObject'===e&&(d='foreignObject');let x=w,S={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:x,seq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]},R=y({name:'element',draft:S,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:p,unmount:c}){function d(e){return G({mount:y,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let y=J(),b=p.map(({leaf:e})=>e);s&&o(),u&&M(t);let w={attr:{},data:{},text:S.text,styleProp:{},styleVar:{},visible:S.visible||null,handler:S.handler};for(let e=0;e<S.attr.length;e++){let t=S.attr[e];for(let e in t)'xlink:href'===e?w.attr.href=t[e]:w.attr[e]=t[e]}for(let e=0;e<S.data.length;e++){let t=S.data[e];for(let e in t)w.data[e]=t[e]}for(let e=0;e<S.styleProp.length;e++){let t=S.styleProp[e];for(let e in t)e.startsWith('--')?w.styleVar[e.slice(2)]=t[e]:w.styleProp[e]=t[e]}for(let e=0;e<S.styleVar.length;e++){let t=S.styleVar[e];for(let e in t)w.styleVar[e]=t[e]}w.visible&&S.seq.push({type:'visible',value:w.visible});for(let e in w.attr){let t=w.attr[e];ee.unit(t)?S.seq.push({type:'attr',field:e,value:t}):m(x,e,t)}for(let e in w.data){let t=w.data[e];ee.unit(t)?S.seq.push({type:'data',field:e,value:t}):v(x,e,t)}for(let e in w.styleProp){let t=w.styleProp[e];ee.unit(t)?S.seq.push({type:'style',field:e,value:t}):h(x,e,t)}for(let e in w.styleVar){let t=w.styleVar[e];ee.unit(t)?S.seq.push({type:'styleVar',field:e,value:t}):f(x,e,t)}for(let e=0;e<w.text.length;e++){let t=w.text[e];if(null!==t.value)if(ee.unit(t.value)){S.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=se;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else S.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<w.handler.length;e++){let t=w.handler[e];for(let e in t.map)S.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(w.visible){let{onMount:e,onState:t}=G({mount:b,state:w.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 l=e.data,r=l.block;if(a&&(n(t,l.ops.visible),t)){let e,t=C(r);if(e=t?t.nextSibling:k(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,W({target:ce,params:{element:l.block.value,fns:S.node},page:e.spawn,defer:1})),W({target:y,params:e,defer:1,page:e.spawn})}),Z([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}for(let e=0;e<S.seq.length;e++){let t=S.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}=d(t.value);if(n)Z([o,r]).watch(({leaf:t,value:n})=>{m(a(t),e,n)});else{let t=S.opsAmount++;r.watch(({value:n,leaf:l})=>{let r=a(l),o=i({value:n,priority:'props',runOp(t){m(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=o,m(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){v(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,v(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'style':{let e=S.opsAmount++,{field:n}=t,{onMount:r,onState:o}=d(t.value);r.watch(({value:t,leaf:l})=>{let r=a(l),o=i({value:t,priority:'props',runOp(e){h(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=o,h(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){f(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,f(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'staticText':y.map(e=>e).watch(e=>{r(e,t.value,t.childIndex)});break;case'dynamicText':{let e=S.opsAmount++;Y({source:t.value,clock:y,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:n})=>{let l=i({value:a,priority:'props',runOp(e){g(o.value,e)},group:n.ops.group});n.ops.group.ops[e]=l;let o=r(n,a,t.childIndex)}),Y({source:y,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;y.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),W({target:t.handler,params:e,page:l})},t.domConfig)});break}}}Y({source:b,clock:c,greedy:1}).watch(e=>{let{spawn:t}=e;Q(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,Q(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,e.data.ops.visible)}),p.watch(({leaf:e})=>{let t=e.data;if(!S.visible){let a=t.ops.visible,r=t.block;if(e.hydration){n(1,a);let e,t=C(r);if(e=t?t.nextSibling:k(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),W({target:y,params:e,defer:1,page:e.spawn}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,W({target:ce,params:{element:t.block.value,fns:S.node},page:e.spawn,defer:1})):l(1,a)}})},env:p});U(R)}function P(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function D(e,t){let a,n,l,r,i;'function'==typeof t?(a=t,l=P(),r=0):(a=t.fn,l=t.env?t.env:P(),r=t.hydrate,n=t.onComplete,i=t.onRoot);let u=e.namespaceURI,p=e.tagName.toLowerCase(),c={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=y({name:'using',draft:c,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{F(c,{parentBlockFragment:t.data.block.child.child,leaf:t,node:e})})},env:l}),f={type:'using',child:{type:'UF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:e};f.child.parent=f,f.child.child.parent=f.child;let h=o({onComplete:n}),v=w(d,{parentLeaf:ue||null,mountNode:e,svgRoot:d.isSvgRoot?e:ue?ue.svgRoot:null,leafData:{type:'using',draft:c,element:e,block:f},opGroup:s(h),domSubtree:s(h),hydration:r});i&&i({template:d,leaf:v})}function O(e){let t=pe.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':return}t.node.push(e)}function M(e){let t=pe.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':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&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?N(t.config||{},t.on):N(t)}e.ɔ&&M(e.ɔ)}function N(e,t){let a=pe.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});let{passive:n=1,capture:l=0,prevent:r=0,stop:i=0}=e;a.handler.push({options:{prevent:r,stop:i},domConfig:{passive:r?0:n,capture:l},map:t})}function V({source:e,cases:t,key:a}){let n='function'==typeof a?a:e=>String(e[a]),l=0;for(let a in t)'__'!==a?E({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);E({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}}function E({source:e,visible:t,fn:a}){let n=y({name:'route',isSvgRoot:0,namespace:pe.namespace,env:pe.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:r,unmount:i}){let o=e.map(e=>({value:e,visible:t(e)})),s={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},u=y({name:'route item',isSvgRoot:0,namespace:pe.namespace,env:pe.env,draft:s,state:{store:null},fn({store:e},{mount:t,unmount:n}){let r=J();e.on(r,(e,t)=>t),a({store:e});let i=Y({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,F(s,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),i.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&W({target:r,params:a,defer:1,page:e.spawn}),B(e,e=>{let a=e.data;switch(a.type){case'element':l(t,a.ops.visible);break;default:console.log('unsupported type',a.type)}})}),Y({source:t,clock:n,greedy:1}).watch(({leaf:e})=>{B(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,Q(t,t.parent.childSpawns[t.template.id]),Q(t,t.template.pages)})}});U(u);let{onMount:p,onState:c}=G({mount:r,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});Z([p,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(R({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:u,values:{store:a}}),l.initialized=1)}),Y({source:r,clock:i,greedy:1}).watch(({leaf:e})=>{B(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,Q(t,t.parent.childSpawns[t.template.id]),Q(t,t.template.pages)})}});U(n)}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 L(e){let t={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},a=y({name:'rec',state:{store:null},isSvgRoot:0,namespace:pe.namespace,env:pe.env,draft:t,defer:1,fn({store:a},{mount:n,unmount:l}){e({state:a});let r=J();return a.on(r,(e,t)=>t),n.watch(({node:e,leaf:a})=>{F(t,{parentBlockFragment:a.data.block.child.child,leaf:a,node:e})}),Y({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,B(e,e=>{e.api.unmount()})}),{itemUpdater:r}}});return({state:e})=>{a.deferredInit&&a.deferredInit();let{env:t,namespace:n}=pe;U(y({name:'rec item',isSvgRoot:0,namespace:n,env:t,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(t,{mount:n,unmount:l}){let{onMount:r,onState:i}=G({state:e,mount:n,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});Y({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,B(e,e=>{e.api.unmount()})}),i.watch(({state:e,leaf:t})=>{B(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:n})=>{R({parentBlockFragment:t.data.block.child.child,leaf:t,node:e,actor:a,values:{store:n}})})}}))}}function j({source:e,child:t,fn:a}){let n=L(({state:e})=>{z({source:e,fn({store:e}){let l=e.map(e=>e[t]||[]);a({store:e,child(){n({state:l})}})}})});n({state:e})}function z(e,t){'function'==typeof t&&(ee.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:r,fields:i=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,d={type:'list',key:ee.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},f=pe.env,h=pe.namespace;U(y({name:'list',draft:d,isSvgRoot:0,namespace:h,fn(e,{mount:t,unmount:n}){let v=y({name:'list item',state:{id:-1,store:null},draft:d,isSvgRoot:0,namespace:h,fn({id:e,store:t},{mount:n,unmount:r}){a({store:t,key:e,fields:A(t,i)});let o=J();t.on(o,(e,t)=>t);let s=te({leaf:null});if(Y({source:s,clock:r,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;Q(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,B(e,e=>{e.api.unmount()});let{spawn:l}=e;l.active=0,Q(l,l.parent.childSpawns[l.template.id]),Q(l,l.template.pages)}),d.itemVisible){let{onMount:e,onState:t}=G({mount:n,state:d.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{s.setState({leaf:a});let n=a.data.block;n.visible=e,n.childInitialized=e,e&&F(d,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?B(a,t=>{let a=t.data;switch(a.type){case'element':l(e,a.ops.visible);break;default:console.log('unsupported type',a.type)}}):e&&(n.childInitialized=1,F(d,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{s.setState({leaf:t});let a=t.data.block;a.visible=1,a.childInitialized=1,F(d,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:f}),m=te([]),g=r.map(e=>e),b=Y({source:r,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),k=Y({source:b,clock:g,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1}),x=Z([b,k]);Y({source:m,clock:x,greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:l}){let i=n.data.block;ae('list update ['+r.shortName+']');let d=Array(a.length).fill(0),f=a.map(o),h=[];for(let t=0;t<e.length;t++){let n=e[t],l=f.indexOf(n.key);-1!==l?(h.push(n),d[l]=1,c(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),p(n.asyncValue))}for(let e=0;e<a.length;e++){if(d[e])continue;let r=a[e],o=f[e],p=s(n.ops.group.queue),c={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:c},asyncValue:u({value:r,group:p,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(l||(m.instance=w(v,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l})))}})},g=h.length;h.push(m);let y=g>0?h[g-1].leafData:null;if(c.child.parent=c,i.child.push(c),y){let e=y.block;c.left=e;let t=e.right;t?(t.left=c,c.right=t):i.lastChild=c,e.right=c}else i.lastChild=c;l&&(m.instance=w(v,{values:{id:o,store:r},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l}))}return ne('list update ['+r.shortName+']'),0===h.length&&(i.lastChild=null),h},target:m}),Y({source:t,clock:Y({source:m,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}let{spawn:a}=e;a.active=0,Q(a,a.parent.childSpawns[a.template.id]),Q(a,a.template.pages)})},env:f}))}function U(e){if(!pe)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(pe.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':t.inParentIndex=pe.draft.childCount,pe.draft.childCount+=1,pe.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+pe.draft.type)}}function Q(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function G({mount:e,state:t,onMount:a,onState:n}){return{onMount:Y({source:t,clock:e,fn:a,greedy:1}),onState:Y({source:e,clock:t,fn:n,greedy:1})}}function _(e,...t){let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);M({text:a})}import{step as $,launch as W,createNode as H,createEvent as J,withRegion as K,restore as X,sample as Y,merge as Z,is as ee,createStore as te}from'effector';let ae,ne,le;'undefined'!=typeof performance&&performance.mark?(ae=e=>{performance.mark('☄️ '+e+' start')},ne=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(ae=()=>{},ne=()=>{}),le='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 re='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),ie=0,oe=0,se=null,ue=null,pe=null,ce=J();ce.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})});export{q as h,N as handler,z as list,O as node,L as rec,A as remap,E as route,M as spec,_ as text,j as tree,D as using,V as variant};
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,n;e.status='active',t=a(e),(n=e).cursor.prev&&(n.cursor.prev.cursor.next=n.cursor.next),n.cursor.next&&(n.cursor.next.cursor.prev=n.cursor.prev),t.last===n&&(t.last=n.cursor.prev),t.first===n&&(t.first=n.cursor.next),n.cursor.prev=null,n.cursor.next=null}function a(e){return e.group.activeChilds[e.priority]}function n(e,a){a.value.active=a.value.pending=e,'active'!==a.status&&t(a)}function l(n,l){if(l.value.active===n)return l.value.pending=n,void('pending'===l.status&&(t(l),a(l).first||e(l.group,l.priority)));var r,i,o,s;'active'===l.status&&(l.status='pending',a(l).first||((o=l.group).queue[s=l.priority].last?(o.cursor[s].prev=o.queue[s].last,o.queue[s].last.cursor[s].next=o,o.queue[s].last=o):o.queue[s].first=o.queue[s].last=o),i=l,(r=a(l)).last?(i.cursor.prev=r.last,r.last.cursor.next=i,r.last=i):r.first=r.last=i),l.value.pending=n,l.group.queue.rafID||(l.group.queue.rafID=re(l.group.queue.execQueue))}function r(a){ae('execQueue');let n,l,r=le(),i=0;e:for(;a.props.first||a.tree.first||a.data.first;){if(le()-r>=10){i=1;break e}let o=!!a.props.first;for(o&&ae('props');n=a.props.first;){for(;l=n.activeChilds.props.first;){if(le()-r>=10){i=1,ne('props');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'props')}o&&ne('props');let s=!!a.tree.first;for(s&&ae('tree');n=a.tree.first;){for(;l=n.activeChilds.tree.first;){if(le()-r>=10){i=1,ne('tree');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'tree')}s&&ne('tree');let u=!!a.data.first;for(u&&ae('data');n=a.data.first;){for(;l=n.activeChilds.data.first;){if(le()-r>=10){i=1,ne('data');break e}l.runOp(l.value.pending),l.value.active=l.value.pending,t(l)}e(n,'data')}u&&ne('data')}if(ne('execQueue'),i)a.rafID=re(a.execQueue);else if(a.rafID=null,a.onDrain){let e=a.onDrain;a.onDrain=null,e()}}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 o({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=r.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 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 c(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){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function f(e,t,a){d(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function h(e,t,a){d(a)?delete e.style[t]:e.style[t]=""+a}function v(e,t,a){d(a)?delete e.dataset[t]:e.dataset[t]=""+a}function m(e,t,a){if(d(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 g(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function y({fn:e,state:t={},defer:a=0,name:n="",draft:l,isSvgRoot:r,namespace:i,env:o}){let s=pe,u=se,p={id:++ie,name:n,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:$.filter({fn(e,t,a){if(!a.page)return console.error('context lost',a),0;if(!a.page.active)return 0;let n=[a.page.template],l=[a.page];{let e=a.page.parent;for(;e;)l.push(e),n.push(e.template),e=e.parent}return a.node.next.forEach(t=>{let r=t.meta.nativeTemplate;r?n.includes(r)?W({target:t,params:e,defer:1,page:l[n.indexOf(r)],stack:a}):console.error('context drift',{stack:a,node:t}):W({target:t,params:e,defer:1,page:null,stack:a})}),0}}),loader:$.filter({fn(e,t,a){if(a.parent){if(a.page){if(!a.page.active)return 0;if(a.page.template===p)return 1;if(a.page.childSpawns[p.id])a.page.childSpawns[p.id].forEach(t=>{W({params:e,target:a.node,page:t,defer:1})});else if(t.targetTemplate){let n=[a.page];{let e=a.page.parent;for(;e;)n.push(e),e=e.parent}let l=n.findIndex(e=>t.targetTemplate===e.template);W(-1===l?{params:e,target:a.node,page:null,defer:1}:{params:e,target:a.node,page:n[l],defer:1})}else p.pages.forEach(t=>{t.fullID.startsWith(a.page.fullID)&&W({params:e,target:a.node,page:t,defer:1})})}else p.pages.forEach(t=>{W({params:e,target:a.node,page:t,defer:1})});return 0}return 1}}),parent:u};u&&u.childTemplates.push(p);let c=H({meta:{template:p}});se=p;let d=pe={template:p,node:c,api:null,trigger:{mount:J(),unmount:J()},draft:l,isSvgRoot:r,namespace:i,env:o};return a?d.deferredInit=()=>{let a=pe,n=se;pe=d,se=p,d.deferredInit=null;try{K(c,()=>{let a=X(t);d.api=e(a,d.trigger),p.nameMap=a})}finally{pe=a,se=n}}:K(c,()=>{let a=X(t);d.api=e(a,d.trigger),p.nameMap=a}),pe=s,se=u,p.actor=d,d}function b(e){switch(e.type){case'list':return[...e.current];case'shape':return{...e.current};default:return e.current}}function w(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:l,leafData:r,opGroup:i,domSubtree:o,hydration:s}){function u(e){if(e.before)for(let t of e.before)switch(t.type){case'map':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current=t.fn(f[a.id].current);break}case'field':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current[t.field]=f[a.id].current;break}case'closure':f[t.of.id]||(f[t.of.id]=t.of)}if(!e.after)return;let t=f[e.id].current;for(let a of e.after){let e=a.to;switch(f[e.id]||(f[e.id]={id:e.id,current:e.current}),a.type){case'copy':f[e.id].current=t;break;case'map':f[e.id].current=a.fn(t)}}}function p(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].current)}catch(e){console.error(e),t.stop=0}}let c=a?a.spawn:null,d=e.template,f={},h={id:++oe,fullID:'',reg:f,template:d,parent:c,childSpawns:{},active:1};d.pages.push(h);let v={},m={spawn:h,api:v,draft:e.draft,ops:{group:i,domSubtree:o},svgRoot:l,data:r,parentLeaf:a,hydration:s},g=ue;ue=m,c&&(c.childSpawns[d.id]||(c.childSpawns[d.id]=[]),c.childSpawns[d.id].push(h)),h.fullID=c?`${c.fullID}_${h.id}`:""+h.id,c&&Object.assign(f,c.reg);for(let e of d.closure){let t=e,a=h.parent;e:for(;a;){if(e.id in a.reg){t=a.reg[e.id];break e}a=a.parent}f[e.id]=t}for(let e of d.plain){let t={id:e.id,current:b(e)};f[e.id]=t}for(let e in t){let a=d.nameMap[e].stateRef.id;f[a]={id:a,current:t[e]}}for(let e of d.closure)u(e);for(let e of d.plain)u(e);let y={i:0,stop:0};for(;!y.stop;)p(d.watch,y,f);if(c)for(let e in h.childSpawns)e in c.childSpawns||(c.childSpawns[e]=[]),c.childSpawns[e].push(...h.childSpawns[e]);if(v.mount=(t,a=1)=>W({target:e.trigger.mount,params:t,defer:a,page:h}),v.unmount=(t,a=1)=>W({target:e.trigger.unmount,params:t,defer:a,page:h}),e.api)for(let t in e.api)v[t]=(a,n=1)=>W({target:e.api[t],params:a,defer:n,page:h});return m.spawn.api=v,m.spawn.leaf=m,m.api.mount({node:n,leaf:m}),ue=g,m}function k(e){let t=function e(t){switch(t.type){case'fragment':switch(t.parent.type){case'EF':case'UF':return t.parent.parent}return e(t.parent.parent);case'route':default:return e(t.parent.parent)}}(e);return t?t.value:null}function x(e){if(!e.visible)return null;switch(e.type){case'FE':case'FT':return e.child;case'FR':return x(e.child.child);case'LF':case'RF':case'FF':return S(e.child);case'FRec':case'FRecItem':return S(e.child.child.child);case'FL':{let t=e.child.lastChild;if(!t)return null;for(;t;){let e=x(t);if(e)return e;t=t.left}return null}default:return null}}function S(e){let t=e.child;for(let e=t.length-1;e>=0;e--){let a=x(t[e]);if(a)return a}return null}function I(e){if('fragment'===e.type)switch(e.parent.type){case'EF':case'UF':return null;case'RecF':case'RecItemF':case'RF':{let t=e.parent.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=x(a.child[e]);if(t)return t}return I(a)}case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=x(a.child[e]);if(t)return t}return I(a)}case'LF':{let t=e.parent.left;for(;t;){let e=x(t);if(e)return e;t=t.left}return I(e.parent.parent)}default:return null}if('route'===e.type){let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=x(e);if(n)return n}return I(t)}let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=x(e);if(n)return n}return I(t)}function C(e){let t=I(e);return t?t.value:null}function F(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r}){e.childTemplates.forEach(e=>{R({parentBlockFragment:t,leaf:a,node:n,svgRoot:l,values:r,actor:e})})}function R({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:l,values:r}){let o,{draft:u}=n,{queue:p}=t.ops.group,c=s(p),d=t.ops.domSubtree,f=d;switch(u.type){case'route':{let t={type:'route',parent:{type:'FR',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let t={type:'element',parent:{type:'FE',parent:e,child:null,visible:0,index:u.inParentIndex},child:{type:'EF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:u.stencil.cloneNode()};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'element',block:t,ops:{visible:i({value:0,priority:'tree',runOp(e){e?(T(t),o.needToCallNode&&(o.needToCallNode=0,W({target:ce,params:{element:t.value,fns:u.node},page:h.spawn}))):(t.value.remove(),t.parent.visible=0)},group:d})},needToCallNode:u.node.length>0},f=s(p);break}case'list':{let t={type:'list',parent:{type:'FL',parent:e,child:null,visible:1,index:u.inParentIndex},child:[],lastChild:null};t.parent.child=t,e.child[u.inParentIndex]=t.parent,o={type:'list',draft:u,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:{type:'FRec',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:{type:'FRecItem',parent:e,child:null,visible:1,index:u.inParentIndex},child:{type:'RecItemF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[u.inParentIndex]=t.parent,o={type:'rec item',block:t};break}default:console.warn("unexpected draft type "+u.type)}let h=w(n,{values:r,parentLeaf:t,mountNode:a,svgRoot:l||t.svgRoot,leafData:o,opGroup:c,domSubtree:f,hydration:t.hydration})}function T(e){let t=C(e);t?t.after(e.value):k(e).prepend(e.value),e.parent.visible=1}function A(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 l=t[n];a[n]=e.map('function'==typeof l?e=>l(e):e=>e[l])}return a}return e.map(e=>e[t])}function q(e,t){function a(e){return e.data.block.value}function r(e,t,a){let n=e.data.block.child.child,l={type:'text',parent:{type:'FT',parent:n,child:null,visible:0,index:a},value:null};if(l.parent.child=l,n.child[a]=l.parent,e.hydration){let e=I(l);if(e)switch(e.type){case'text':l.value=p.document.createTextNode(t),e.value.after(l.value);break;case'element':l.value=e.value.nextSibling,g(l.value,t)}else{let e=k(l);l.value=e.firstChild,g(l.value,t)}l.parent.visible=1}else l.value=p.document.createTextNode(t),T(l);return l}let o,s=0,u=0;'function'==typeof t?(s=1,o=t):t&&(u=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)));let p=pe.env,c=pe.namespace,d=c,b='html';d=b='svg'===c?'svg':'html','svg'===e&&(b='svg',d='svg');let w='svg'===b?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e);'foreignObject'===c?(w.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),d='html'):'svg'===e?(w.setAttribute('xmlns','http://www.w3.org/2000/svg'),d='svg'):'foreignObject'===e&&(d='foreignObject');let x=w,S={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:x,seq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]},R=y({name:'element',draft:S,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:p,unmount:c}){function d(e){return G({mount:y,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let y=J(),b=p.map(({leaf:e})=>e);s&&o(),u&&M(t);let w={attr:{},data:{},text:S.text,styleProp:{},styleVar:{},visible:S.visible||null,handler:S.handler};for(let e=0;e<S.attr.length;e++){let t=S.attr[e];for(let e in t)'xlink:href'===e?w.attr.href=t[e]:w.attr[e]=t[e]}for(let e=0;e<S.data.length;e++){let t=S.data[e];for(let e in t)w.data[e]=t[e]}for(let e=0;e<S.styleProp.length;e++){let t=S.styleProp[e];for(let e in t)e.startsWith('--')?w.styleVar[e.slice(2)]=t[e]:w.styleProp[e]=t[e]}for(let e=0;e<S.styleVar.length;e++){let t=S.styleVar[e];for(let e in t)w.styleVar[e]=t[e]}w.visible&&S.seq.push({type:'visible',value:w.visible});for(let e in w.attr){let t=w.attr[e];ee.unit(t)?S.seq.push({type:'attr',field:e,value:t}):m(x,e,t)}for(let e in w.data){let t=w.data[e];ee.unit(t)?S.seq.push({type:'data',field:e,value:t}):v(x,e,t)}for(let e in w.styleProp){let t=w.styleProp[e];ee.unit(t)?S.seq.push({type:'style',field:e,value:t}):h(x,e,t)}for(let e in w.styleVar){let t=w.styleVar[e];ee.unit(t)?S.seq.push({type:'styleVar',field:e,value:t}):f(x,e,t)}for(let e=0;e<w.text.length;e++){let t=w.text[e];if(null!==t.value)if(ee.unit(t.value)){S.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=se;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else S.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<w.handler.length;e++){let t=w.handler[e];for(let e in t.map)S.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(w.visible){let{onMount:e,onState:t}=G({mount:b,state:w.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 l=e.data,r=l.block;if(a&&(n(t,l.ops.visible),t)){let e,t=C(r);if(e=t?t.nextSibling:k(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),t&&l.needToCallNode&&(l.needToCallNode=0,W({target:ce,params:{element:l.block.value,fns:S.node},page:e.spawn,defer:1})),W({target:y,params:e,defer:1,page:e.spawn})}),Z([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||l(t,e.data.ops.visible)})}for(let e=0;e<S.seq.length;e++){let t=S.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}=d(t.value);if(n)Z([o,r]).watch(({leaf:t,value:n})=>{m(a(t),e,n)});else{let t=S.opsAmount++;r.watch(({value:n,leaf:l})=>{let r=a(l),o=i({value:n,priority:'props',runOp(t){m(r,e,t)},group:l.ops.group});l.ops.group.ops[t]=o,m(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){v(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,v(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'style':{let e=S.opsAmount++,{field:n}=t,{onMount:r,onState:o}=d(t.value);r.watch(({value:t,leaf:l})=>{let r=a(l),o=i({value:t,priority:'props',runOp(e){h(r,n,e)},group:l.ops.group});l.ops.group.ops[e]=o,h(r,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}=d(t.value),o=S.opsAmount++;n.watch(({value:t,leaf:n})=>{let l=a(n),r=i({value:t,priority:'props',runOp(t){f(l,e,t)},group:n.ops.group});n.ops.group.ops[o]=r,f(l,e,t)}),r.watch(({value:e,leaf:t})=>{l(e,t.ops.group.ops[o])});break}case'staticText':y.map(e=>e).watch(e=>{r(e,t.value,t.childIndex)});break;case'dynamicText':{let e=S.opsAmount++;Y({source:t.value,clock:y,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:n})=>{let l=i({value:a,priority:'props',runOp(e){g(o.value,e)},group:n.ops.group});n.ops.group.ops[e]=l;let o=r(n,a,t.childIndex)}),Y({source:y,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;y.watch(n=>{let l=null;if(e){let t=0,a=n.spawn;for(;!t&&a;)a.template===e?(t=1,l=a):a=a.parent}a(n).addEventListener(t.for,e=>{t.options.prevent&&e.preventDefault(),t.options.stop&&e.stopPropagation(),W({target:t.handler,params:e,page:l})},t.domConfig)});break}}}Y({source:b,clock:c,greedy:1}).watch(e=>{let{spawn:t}=e;Q(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,Q(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),l(0,e.data.ops.visible)}),p.watch(({leaf:e})=>{let t=e.data;if(!S.visible){let a=t.ops.visible,r=t.block;if(e.hydration){n(1,a);let e,t=C(r);if(e=t?t.nextSibling:k(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}F(S,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:R.isSvgRoot?r.value:null}),W({target:y,params:e,defer:1,page:e.spawn}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,W({target:ce,params:{element:t.block.value,fns:S.node},page:e.spawn,defer:1})):l(1,a)}})},env:p});U(R)}function P(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function D(e,t){let a,n,l,r,i;'function'==typeof t?(a=t,l=P(),r=0):(a=t.fn,l=t.env?t.env:P(),r=t.hydrate,n=t.onComplete,i=t.onRoot);let u=e.namespaceURI,p=e.tagName.toLowerCase(),c={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},d=y({name:'using',draft:c,isSvgRoot:'svg'===p,namespace:'http://www.w3.org/2000/svg'===u?'svg':'foreignobject'===p?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{F(c,{parentBlockFragment:t.data.block.child.child,leaf:t,node:e})})},env:l}),f={type:'using',child:{type:'UF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:e};f.child.parent=f,f.child.child.parent=f.child;let h=o({onComplete:n}),v=w(d,{parentLeaf:ue||null,mountNode:e,svgRoot:d.isSvgRoot?e:ue?ue.svgRoot:null,leafData:{type:'using',draft:c,element:e,block:f},opGroup:s(h),domSubtree:s(h),hydration:r});i&&i({template:d,leaf:v})}function O(e){let t=pe.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':return}t.node.push(e)}function M(e){let t=pe.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':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&&t.styleProp.push(e.style),e.styleVar&&t.styleVar.push(e.styleVar),e.visible&&(t.visible=e.visible),e.handler){let t=e.handler;'object'==typeof t.on?N(t.config||{},t.on):N(t)}e.ɔ&&M(e.ɔ)}function N(e,t){let a=pe.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});let{passive:n=1,capture:l=0,prevent:r=0,stop:i=0}=e;a.handler.push({options:{prevent:r,stop:i},domConfig:{passive:r?0:n,capture:l},map:t})}function V({source:e,cases:t,key:a}){let n='function'==typeof a?a:e=>String(e[a]),l=0;for(let a in t)'__'!==a?E({source:e,visible:e=>n(e)===a,fn:t[a]}):l=1;if(l){let a=Object.keys(t);E({source:e,visible:e=>!a.includes(n(e)),fn:t.__})}}function E({source:e,visible:t,fn:a}){let n=y({name:'route',isSvgRoot:0,namespace:pe.namespace,env:pe.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:r,unmount:i}){let o=e.map(e=>({value:e,visible:t(e)})),s={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},u=y({name:'route item',isSvgRoot:0,namespace:pe.namespace,env:pe.env,draft:s,state:{store:null},fn({store:e},{mount:t,unmount:n}){let r=J();e.on(r,(e,t)=>t),a({store:e});let i=Y({source:t,clock:o,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,F(s,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),i.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&W({target:r,params:a,defer:1,page:e.spawn});let n=e=>{let a=e.data;switch(a.type){case'element':l(t,a.ops.visible);break;case'route':B(e,n);break;default:console.log('unsupported type',a.type)}};B(e,n)}),Y({source:t,clock:n,greedy:1}).watch(({leaf:e})=>{B(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,Q(t,t.parent.childSpawns[t.template.id]),Q(t,t.template.pages)})}});U(u);let{onMount:p,onState:c}=G({mount:r,state:o,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});Z([p,c]).watch(({leaf:e,visible:t,value:a,node:n})=>{let l=e.data;l.block.child.visible=t,t&&!l.initialized&&(R({parentBlockFragment:l.block.child.child,leaf:e,node:n,actor:u,values:{store:a}}),l.initialized=1)}),Y({source:r,clock:i,greedy:1}).watch(({leaf:e})=>{B(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,Q(t,t.parent.childSpawns[t.template.id]),Q(t,t.template.pages)})}});U(n)}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 L(e){let t={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},a=y({name:'rec',state:{store:null},isSvgRoot:0,namespace:pe.namespace,env:pe.env,draft:t,defer:1,fn({store:a},{mount:n,unmount:l}){e({state:a});let r=J();return a.on(r,(e,t)=>t),n.watch(({node:e,leaf:a})=>{F(t,{parentBlockFragment:a.data.block.child.child,leaf:a,node:e})}),Y({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,B(e,e=>{e.api.unmount()})}),{itemUpdater:r}}});return({state:e})=>{a.deferredInit&&a.deferredInit();let{env:t,namespace:n}=pe;U(y({name:'rec item',isSvgRoot:0,namespace:n,env:t,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(t,{mount:n,unmount:l}){let{onMount:r,onState:i}=G({state:e,mount:n,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});Y({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,B(e,e=>{e.api.unmount()})}),i.watch(({state:e,leaf:t})=>{B(t,t=>{t.api.itemUpdater(e)})}),r.watch(({node:e,leaf:t,state:n})=>{R({parentBlockFragment:t.data.block.child.child,leaf:t,node:e,actor:a,values:{store:n}})})}}))}}function j({source:e,child:t,fn:a}){let n=L(({state:e})=>{z({source:e,fn({store:e}){let l=e.map(e=>e[t]||[]);a({store:e,child(){n({state:l})}})}})});n({state:e})}function z(e,t){'function'==typeof t&&(ee.unit(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:r,fields:i=[]}=e,o=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,d={type:'list',key:ee.store(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},f=pe.env,h=pe.namespace;U(y({name:'list',draft:d,isSvgRoot:0,namespace:h,fn(e,{mount:t,unmount:n}){let v=y({name:'list item',state:{id:-1,store:null},draft:d,isSvgRoot:0,namespace:h,fn({id:e,store:t},{mount:n,unmount:r}){a({store:t,key:e,fields:A(t,i)});let o=J();t.on(o,(e,t)=>t);let s=te({leaf:null});if(Y({source:s,clock:r,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;Q(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,B(e,e=>{e.api.unmount()});let{spawn:l}=e;l.active=0,Q(l,l.parent.childSpawns[l.template.id]),Q(l,l.template.pages)}),d.itemVisible){let{onMount:e,onState:t}=G({mount:n,state:d.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{s.setState({leaf:a});let n=a.data.block;n.visible=e,n.childInitialized=e,e&&F(d,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?B(a,t=>{let a=t.data;switch(a.type){case'element':l(e,a.ops.visible);break;default:console.log('unsupported type',a.type)}}):e&&(n.childInitialized=1,F(d,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{s.setState({leaf:t});let a=t.data.block;a.visible=1,a.childInitialized=1,F(d,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:o}},env:f}),m=te([]),g=r.map(e=>e),b=Y({source:r,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),k=Y({source:b,clock:g,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1}),x=Z([b,k]);Y({source:m,clock:x,greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:l}){let i=n.data.block;ae('list update ['+r.shortName+']');let d=Array(a.length).fill(0),f=a.map(o),h=[];for(let t=0;t<e.length;t++){let n=e[t],l=f.indexOf(n.key);-1!==l?(h.push(n),d[l]=1,c(a[l],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),p(n.asyncValue))}for(let e=0;e<a.length;e++){if(d[e])continue;let r=a[e],o=f[e],p=s(n.ops.group.queue),c={type:'LF',parent:i,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},m={type:'listItem',key:o,index:o,active:1,leafData:{type:'list item',block:c},asyncValue:u({value:r,group:p,onTerminate(e){},onChange(e){m.instance&&m.instance.api.itemUpdater(e)},onInit(e){m.active&&(l||(m.instance=w(v,{values:{id:o,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l})))}})},g=h.length;h.push(m);let y=g>0?h[g-1].leafData:null;if(c.child.parent=c,i.child.push(c),y){let e=y.block;c.left=e;let t=e.right;t?(t.left=c,c.right=t):i.lastChild=c,e.right=c}else i.lastChild=c;l&&(m.instance=w(v,{values:{id:o,store:r},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:m.leafData,opGroup:p,domSubtree:n.ops.domSubtree,hydration:l}))}return ne('list update ['+r.shortName+']'),0===h.length&&(i.lastChild=null),h},target:m}),Y({source:t,clock:Y({source:m,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}let{spawn:a}=e;a.active=0,Q(a,a.parent.childSpawns[a.template.id]),Q(a,a.template.pages)})},env:f}))}function U(e){if(!pe)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(pe.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':t.inParentIndex=pe.draft.childCount,pe.draft.childCount+=1,pe.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+pe.draft.type)}}function Q(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function G({mount:e,state:t,onMount:a,onState:n}){return{onMount:Y({source:t,clock:e,fn:a,greedy:1}),onState:Y({source:e,clock:t,fn:n,greedy:1})}}function _(e,...t){let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);M({text:a})}import{step as $,launch as W,createNode as H,createEvent as J,withRegion as K,restore as X,sample as Y,merge as Z,is as ee,createStore as te}from'effector';let ae,ne,le;'undefined'!=typeof performance&&performance.mark?(ae=e=>{performance.mark('☄️ '+e+' start')},ne=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(ae=()=>{},ne=()=>{}),le='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 re='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),ie=0,oe=0,se=null,ue=null,pe=null,ce=J();ce.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})});export{q as h,N as handler,z as list,O as node,L as rec,A as remap,E as route,M as spec,_ as text,j as tree,D as using,V as variant};
//# sourceMappingURL=forest.es.js.map

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

((e,t)=>{'object'==typeof exports&&'undefined'!=typeof module?t(exports):'function'==typeof define&&define.amd?define(['exports'],t):t((e=e||self).forest={})})(this,e=>{function t(e,t="combine"){let a=t+'(',n='',r=0;for(let t in e){let l=e[t];if(null!=l&&(a+=n,a+=K(l)?l.compositeName.fullName:l.toString()),r+=1,25===r)break;n=', '}return a+=')',a}function a({node:e=[],from:t,source:a,parent:n=t||a,to:r,target:l,child:o=r||l,scope:i={},meta:s={},family:u={type:'regular'}}={}){let p=ze(n),c=ze(u.links),d=ze(u.owners),f=[],h={};for(let t=0;t<e.length;t++){let a=e[t];a&&(f.push(a),je(a,h))}let m={seq:f,next:ze(o),meta:s,scope:i,family:{type:u.type||'crosslink',links:c,owners:d},reg:h};for(let e=0;e<c.length;e++)oe(c[e]).push(m);for(let e=0;e<d.length;e++)ie(d[e]).push(m);for(let e=0;e<p.length;e++)p[e].next.push(m);return m}function n(e,t){ut={parent:ut,value:e,template:le(e).meta.template||ut&&ut.template};try{return t()}finally{ut=fe(ut)}}function r(e,t){let n=(e,...t)=>n.create(e,t,t);n.graphite=a({meta:mt('event',n,t,e)}),n.create=e=>(Ye(n,e),e),n.watch=ke(dt,n),n.map=e=>{let t,a;ne(e)&&(t=e,a=e.name,e=e.fn);let l=r(me(n,a),t);return vt(n,l,'map',e),l},n.filter=e=>re(e)?(console.error('.filter(fn) is deprecated, use .filterMap instead'),l(n,e)):gt(n,'filter',e.fn,[Ae({fn:Ve})]),n.filterMap=ke(l,n),n.prepend=e=>{let t=r('* → '+n.shortName,{parent:fe(n)}),a=pt();return a&&le(t).seq.push(a.upward),vt(t,n,'prepend',e),((e,t)=>{fe(e)&&fe(e).hooks.event(t)})(n,t),t},yt(n,n);let o=pt();return o&&(le(n).meta.nativeTemplate=o),st(n)}function l(e,t){return gt(e,'filterMap',t,[Fe({fn:Ve}),Te()])}function o(e,t){function n(e,t){p.off(e),de(p).set(e,ot(bt(e,p,'on',1,t)))}let l=Pe(e),i=Pe(e),s=(()=>r({named:'updates'}))(),u=pt();l.after=[{type:'copy',to:i}],u&&u.plain.push(l);let p={subscribers:new Map,updates:s,defaultState:e,stateRef:l,getState(){let e=Xe();return De(e&&e.reg[l.id]?e.reg[l.id]:l)},setState(e){Ye({target:p,params:e,defer:1})},reset(...e){for(let t of e)p.on(t,()=>p.defaultState);return p},on(e,t){if(Array.isArray(e))for(let a of e)n(a,t);else n(e,t);return p},off(e){let t=de(p).get(e);return t&&(t(),de(p).delete(e)),p},map(e,t){let a,n,r;ne(e)&&(a=e,n=e.name,t=e.firstState,e=e.fn);let i=p.getState(),s=pt();s?r=null:void 0!==i&&(r=e(i,t));let u=o(r,{name:me(p,n),config:a,strict:0}),c=bt(p,u,'map',0,e);return se(u).before=[{type:'map',fn:e,from:l}],s&&(s.plain.includes(l)||c.seq.includes(s.loader)||c.seq.unshift(s.loader)),u},[ve]:()=>yt(p,{})};return p.graphite=a({scope:{state:l},node:[Te(),Ne({store:l}),Ce({store:i}),Ne({store:i})],child:s,meta:mt('store',p,t)}),ht&&void 0===e&&ae("current state can't be undefined, use null instead"),u&&(le(p).meta.nativeTemplate=u),p.watch=p.subscribe=(e,t)=>{if(!t||!K(e)){re(e)||ae('watch requires function handler');let t=pt();return t?t.watch.push({of:l,fn:e}):e(p.getState()),dt(p,e)}return re(t)||ae('second argument should be a function'),e.watch(e=>t(p.getState(),e))},Ee(p,[s]),st(p)}function i(...e){let t,n,l;et(e[0],(t,a)=>{l=t,e=a});let i,[s,u,p,c=0]=e;void 0===u&&'source'in s&&('clock'in s&&null==s.clock&&ae('config.clock should be defined'),u=s.clock,p=s.fn,c=s.greedy,t=s.target,n=s.name,i=s.sid,s=s.source),void 0===u&&(u=s),n=l||n||s.shortName,s=It(s),u=It(u),'boolean'==typeof p&&(c=p,p=null);let d=pt(),f=!!t;t||(Y(s)&&Y(u)?t=o(p?p(De(se(s)),De(se(u))):De(se(s)),{name:n,sid:i}):(t=r(n),d&&le(t).seq.push(d.loader)));let h=f&&K(t)&&le(t).meta.nativeTemplate;if(Y(s))Ee(s,[ct(u,t,{scope:{fn:p,targetTemplate:h},node:[d&&d.loader,!c&&Ie({priority:'sampler'}),Re({store:se(s),to:p?'a':'stack'}),p&&Fe({fn:Oe}),d&&f&&d.upward],meta:{op:'sample',sample:'store'}})]);else{let e=Pe(0),n=Pe(),r=Pe();d&&d.plain.push(e,n,r),st(a({parent:s,node:[Ne({store:n}),Re({from:'value',store:1,target:e})],family:{owners:[s,t,u],links:t},meta:{op:'sample',sample:'source'}})),Ee(s,[ct(u,t,{scope:{fn:p,targetTemplate:h},node:[d&&d.loader,Ne({store:r}),Re({store:e}),Ae({fn:e=>e}),!c&&Ie({priority:'sampler'}),Re({store:n}),Re({store:r,to:'a'}),p&&Fe({fn:Me}),d&&f&&d.upward],meta:{op:'sample',sample:'clock'}})])}return t}function s(e){let n=r(t(e,'merge'));return(e=>{let t;et(e,(a,n)=>{t=a,e=n});let{from:n,to:r,meta:l={op:'forward'}}=e;n&&r||ae('from and to fields should be defined'),t&&(l.config=t),ot(st(a({parent:n,child:r,meta:l,family:{}})))})({from:e,to:n,meta:{op:'merge'}}),n}function u(e,t,a){if(Y(e))return e;if(K(e)){let n,r=fe(e);return Z(e)&&(n=o(t,{parent:r,name:e.shortName,ɔ:a}).on(e,(e,t)=>t)),ee(e)&&(n=o(t,{parent:r,name:e.shortName,ɔ:a}).on(e.done,(e,{result:t})=>t)),r&&r.hooks.store(n),n}let n={};return kt(e,(e,t)=>{n[t]=Y(e)?e:o(e,{name:t})}),n}function p(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 c(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})(d(e),e)}function d(e){return e.group.activeChilds[e.priority]}function f(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&c(t)}function h(e,t){if(t.value.active===e)return t.value.pending=e,void('pending'===t.status&&(c(t),d(t).first||p(t.group,t.priority)));'active'===t.status&&(t.status='pending',d(t).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})(t.group,t.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(d(t),t)),t.value.pending=e,t.group.queue.rafID||(t.group.queue.rafID=Rt(t.group.queue.execQueue))}function m(e){wt('execQueue');let t,a,n=St(),r=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(St()-n>=10){r=1;break e}let l=!!e.props.first;for(l&&wt('props');t=e.props.first;){for(;a=t.activeChilds.props.first;){if(St()-n>=10){r=1,xt('props');break e}a.runOp(a.value.pending),a.value.active=a.value.pending,c(a)}p(t,'props')}l&&xt('props');let o=!!e.tree.first;for(o&&wt('tree');t=e.tree.first;){for(;a=t.activeChilds.tree.first;){if(St()-n>=10){r=1,xt('tree');break e}a.runOp(a.value.pending),a.value.active=a.value.pending,c(a)}p(t,'tree')}o&&xt('tree');let i=!!e.data.first;for(i&&wt('data');t=e.data.first;){for(;a=t.activeChilds.data.first;){if(St()-n>=10){r=1,xt('data');break e}a.runOp(a.value.pending),a.value.active=a.value.pending,c(a)}p(t,'data')}i&&xt('data')}if(xt('execQueue'),r)e.rafID=Rt(e.execQueue);else if(e.rafID=null,e.onDrain){let t=e.onDrain;e.onDrain=null,t()}}function v({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 g({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=m.bind(null,t),t}function y(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 b({value:e,group:t,onInit:a,onChange:n,onTerminate:r}){let l=v({value:e,group:t,runOp(e){o.status='A',n(e)},priority:'data'}),o={status:'IA',value:l.value,hooks:{onTerminate:r},ops:{init:v({value:0,group:t,runOp(e){o.status='A',a(o.value.active)},priority:'data'}),change:l,terminate:v({value:0,group:t,runOp(e){o.status='T',o.hooks.onTerminate(1)},priority:'data'})}};return h(1,o.ops.init),o}function k(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',h(1,e.ops.terminate);break;case'AA':e.status='AT',h(1,e.ops.terminate),h(e.value.active,e.ops.change);break;case'IA':e.status='T',h(0,e.ops.init),e.hooks.onTerminate(0)}}function w(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',h(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',h(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function x(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function S(e,t,a){x(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function I(e,t,a){x(a)?delete e.style[t]:e.style[t]=""+a}function R(e,t,a){x(a)?delete e.dataset[t]:e.dataset[t]=""+a}function T(e,t,a){if(x(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 C(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function F({fn:e,state:t={},defer:l=0,name:o="",draft:i,isSvgRoot:s,namespace:p,env:c}){let d=qt,f=Ft,h={id:++Tt,name:o,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:Ae({fn(e,t,a){if(!a.page)return console.error('context lost',a),0;if(!a.page.active)return 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)?Ye({target:t,params:e,defer:1,page:r[n.indexOf(l)],stack:a}):console.error('context drift',{stack:a,node:t}):Ye({target:t,params:e,defer:1,page:null,stack:a})}),0}}),loader:Ae({fn(e,t,a){if(a.parent){if(a.page){if(!a.page.active)return 0;if(a.page.template===h)return 1;if(a.page.childSpawns[h.id])a.page.childSpawns[h.id].forEach(t=>{Ye({params:e,target:a.node,page:t,defer:1})});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);Ye(-1===r?{params:e,target:a.node,page:null,defer:1}:{params:e,target:a.node,page:n[r],defer:1})}else h.pages.forEach(t=>{t.fullID.startsWith(a.page.fullID)&&Ye({params:e,target:a.node,page:t,defer:1})})}else h.pages.forEach(t=>{Ye({params:e,target:a.node,page:t,defer:1})});return 0}return 1}}),parent:f};f&&f.childTemplates.push(h);let m=a({meta:{template:h}});Ft=h;let v=qt={template:h,node:m,api:null,trigger:{mount:r(),unmount:r()},draft:i,isSvgRoot:s,namespace:p,env:c};return l?v.deferredInit=()=>{let a=qt,r=Ft;qt=v,Ft=h,v.deferredInit=null;try{n(m,()=>{let a=u(t);v.api=e(a,v.trigger),h.nameMap=a})}finally{qt=a,Ft=r}}:n(m,()=>{let a=u(t);v.api=e(a,v.trigger),h.nameMap=a}),qt=d,Ft=f,h.actor=v,v}function A(e){switch(e.type){case'list':return[...e.current];case'shape':return{...e.current};default:return e.current}}function q(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:r,leafData:l,opGroup:o,domSubtree:i,hydration:s}){function u(e){if(e.before)for(let t of e.before)switch(t.type){case'map':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current=t.fn(f[a.id].current);break}case'field':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current[t.field]=f[a.id].current;break}case'closure':f[t.of.id]||(f[t.of.id]=t.of)}if(!e.after)return;let t=f[e.id].current;for(let a of e.after){let e=a.to;switch(f[e.id]||(f[e.id]={id:e.id,current:e.current}),a.type){case'copy':f[e.id].current=t;break;case'map':f[e.id].current=a.fn(t)}}}function p(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].current)}catch(e){console.error(e),t.stop=0}}let c=a?a.spawn:null,d=e.template,f={},h={id:++Ct,fullID:'',reg:f,template:d,parent:c,childSpawns:{},active:1};d.pages.push(h);let m={},v={spawn:h,api:m,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:r,data:l,parentLeaf:a,hydration:s},g=At;At=v,c&&(c.childSpawns[d.id]||(c.childSpawns[d.id]=[]),c.childSpawns[d.id].push(h)),h.fullID=c?`${c.fullID}_${h.id}`:""+h.id,c&&Object.assign(f,c.reg);for(let e of d.closure){let t=e,a=h.parent;e:for(;a;){if(e.id in a.reg){t=a.reg[e.id];break e}a=a.parent}f[e.id]=t}for(let e of d.plain){let t={id:e.id,current:A(e)};f[e.id]=t}for(let e in t){let a=d.nameMap[e].stateRef.id;f[a]={id:a,current:t[e]}}for(let e of d.closure)u(e);for(let e of d.plain)u(e);let y={i:0,stop:0};for(;!y.stop;)p(d.watch,y,f);if(c)for(let e in h.childSpawns)e in c.childSpawns||(c.childSpawns[e]=[]),c.childSpawns[e].push(...h.childSpawns[e]);if(m.mount=(t,a=1)=>Ye({target:e.trigger.mount,params:t,defer:a,page:h}),m.unmount=(t,a=1)=>Ye({target:e.trigger.unmount,params:t,defer:a,page:h}),e.api)for(let t in e.api)m[t]=(a,n=1)=>Ye({target:e.api[t],params:a,defer:n,page:h});return v.spawn.api=m,v.spawn.leaf=v,v.api.mount({node:n,leaf:v}),At=g,v}function N(e){let t=function e(t){switch(t.type){case'fragment':switch(t.parent.type){case'EF':case'UF':return t.parent.parent}return e(t.parent.parent);case'route':default:return e(t.parent.parent)}}(e);return t?t.value:null}function P(e){if(!e.visible)return null;switch(e.type){case'FE':case'FT':return e.child;case'FR':return P(e.child.child);case'LF':case'RF':case'FF':return D(e.child);case'FRec':case'FRecItem':return D(e.child.child.child);case'FL':{let t=e.child.lastChild;if(!t)return null;for(;t;){let e=P(t);if(e)return e;t=t.left}return null}default:return null}}function D(e){let t=e.child;for(let e=t.length-1;e>=0;e--){let a=P(t[e]);if(a)return a}return null}function M(e){if('fragment'===e.type)switch(e.parent.type){case'EF':case'UF':return null;case'RecF':case'RecItemF':case'RF':{let t=e.parent.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=P(a.child[e]);if(t)return t}return M(a)}case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=P(a.child[e]);if(t)return t}return M(a)}case'LF':{let t=e.parent.left;for(;t;){let e=P(t);if(e)return e;t=t.left}return M(e.parent.parent)}default:return null}if('route'===e.type){let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=P(e);if(n)return n}return M(t)}let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=P(e);if(n)return n}return M(t)}function O(e){let t=M(e);return t?t.value:null}function V(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l}){e.childTemplates.forEach(e=>{E({parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l,actor:e})})}function E({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:r,values:l}){let o,{draft:i}=n,{queue:s}=t.ops.group,u=y(s),p=t.ops.domSubtree,c=p;switch(i.type){case'route':{let t={type:'route',parent:{type:'FR',parent:e,child:null,visible:1,index:i.inParentIndex},child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let t={type:'element',parent:{type:'FE',parent:e,child:null,visible:0,index:i.inParentIndex},child:{type:'EF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:i.stencil.cloneNode()};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'element',block:t,ops:{visible:v({value:0,priority:'tree',runOp(e){e?(z(t),o.needToCallNode&&(o.needToCallNode=0,Ye({target:Nt,params:{element:t.value,fns:i.node},page:d.spawn}))):(t.value.remove(),t.parent.visible=0)},group:p})},needToCallNode:i.node.length>0},c=y(s);break}case'list':{let t={type:'list',parent:{type:'FL',parent:e,child:null,visible:1,index:i.inParentIndex},child:[],lastChild:null};t.parent.child=t,e.child[i.inParentIndex]=t.parent,o={type:'list',draft:i,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:{type:'FRec',parent:e,child:null,visible:1,index:i.inParentIndex},child:{type:'RecF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:{type:'FRecItem',parent:e,child:null,visible:1,index:i.inParentIndex},child:{type:'RecItemF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'rec item',block:t};break}default:console.warn("unexpected draft type "+i.type)}let d=q(n,{values:l,parentLeaf:t,mountNode:a,svgRoot:r||t.svgRoot,leafData:o,opGroup:u,domSubtree:c,hydration:t.hydration})}function z(e){let t=O(e);t?t.after(e.value):N(e).prepend(e.value),e.parent.visible=1}function j(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(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function L(e){let t=qt.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':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&&t.styleProp.push(e.style),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.ɔ&&L(e.ɔ)}function U(e,t){let a=qt.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});let{passive:n=1,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}){let n=F({name:'route',isSvgRoot:0,namespace:qt.namespace,env:qt.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:l,unmount:o}){let u=e.map(e=>({value:e,visible:t(e)})),p={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},c=F({name:'route item',isSvgRoot:0,namespace:qt.namespace,env:qt.env,draft:p,state:{store:null},fn({store:e},{mount:t,unmount:n}){let l=r();e.on(l,(e,t)=>t),a({store:e});let o=i({source:t,clock:u,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,V(p,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),o.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&Ye({target:l,params:a,defer:1,page:e.spawn}),Q(e,e=>{let a=e.data;switch(a.type){case'element':h(t,a.ops.visible);break;default:console.log('unsupported type',a.type)}})}),i({source:t,clock:n,greedy:1}).watch(({leaf:e})=>{Q(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,H(t,t.parent.childSpawns[t.template.id]),H(t,t.template.pages)})}});W(c);let{onMount:d,onState:f}=J({mount:l,state:u,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});s([d,f]).watch(({leaf:e,visible:t,value:a,node:n})=>{let r=e.data;r.block.child.visible=t,t&&!r.initialized&&(E({parentBlockFragment:r.block.child.child,leaf:e,node:n,actor:c,values:{store:a}}),r.initialized=1)}),i({source:l,clock:o,greedy:1}).watch(({leaf:e})=>{Q(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,H(t,t.parent.childSpawns[t.template.id]),H(t,t.template.pages)})}});W(n)}function Q(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 G(e){let t={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},a=F({name:'rec',state:{store:null},isSvgRoot:0,namespace:qt.namespace,env:qt.env,draft:t,defer:1,fn({store:a},{mount:n,unmount:l}){e({state:a});let o=r();return a.on(o,(e,t)=>t),n.watch(({node:e,leaf:a})=>{V(t,{parentBlockFragment:a.data.block.child.child,leaf:a,node:e})}),i({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,Q(e,e=>{e.api.unmount()})}),{itemUpdater:o}}});return({state:e})=>{a.deferredInit&&a.deferredInit();let{env:t,namespace:n}=qt;W(F({name:'rec item',isSvgRoot:0,namespace:n,env:t,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(t,{mount:n,unmount:r}){let{onMount:l,onState:o}=J({state:e,mount:n,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});i({source:n,clock:r,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,Q(e,e=>{e.api.unmount()})}),o.watch(({state:e,leaf:t})=>{Q(t,t=>{t.api.itemUpdater(e)})}),l.watch(({node:e,leaf:t,state:n})=>{E({parentBlockFragment:t.data.block.child.child,leaf:t,node:e,actor:a,values:{store:n}})})}}))}}function $(e,t){'function'==typeof t&&(K(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:l,fields:u=[]}=e,p=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,c={type:'list',key:Y(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},d=qt.env,f=qt.namespace;W(F({name:'list',draft:c,isSvgRoot:0,namespace:f,fn(e,{mount:t,unmount:n}){let m=F({name:'list item',state:{id:-1,store:null},draft:c,isSvgRoot:0,namespace:f,fn({id:e,store:t},{mount:n,unmount:l}){a({store:t,key:e,fields:j(t,u)});let s=r();t.on(s,(e,t)=>t);let p=o({leaf:null});if(i({source:p,clock:l,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;H(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,Q(e,e=>{e.api.unmount()});let{spawn:r}=e;r.active=0,H(r,r.parent.childSpawns[r.template.id]),H(r,r.template.pages)}),c.itemVisible){let{onMount:e,onState:t}=J({mount:n,state:c.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{p.setState({leaf:a});let n=a.data.block;n.visible=e,n.childInitialized=e,e&&V(c,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?Q(a,t=>{let a=t.data;switch(a.type){case'element':h(e,a.ops.visible);break;default:console.log('unsupported type',a.type)}}):e&&(n.childInitialized=1,V(c,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{p.setState({leaf:t});let a=t.data.block;a.visible=1,a.childInitialized=1,V(c,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:s}},env:d}),v=o([]),g=l.map(e=>e),x=i({source:l,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),S=i({source:x,clock:g,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1});i({source:v,clock:s([x,S]),greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:r}){let o=n.data.block;wt('list update ['+l.shortName+']');let i=Array(a.length).fill(0),s=a.map(p),u=[];for(let t=0;t<e.length;t++){let n=e[t],r=s.indexOf(n.key);-1!==r?(u.push(n),i[r]=1,w(a[r],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),k(n.asyncValue))}for(let e=0;e<a.length;e++){if(i[e])continue;let l=a[e],p=s[e],c=y(n.ops.group.queue),d={type:'LF',parent:o,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},f={type:'listItem',key:p,index:p,active:1,leafData:{type:'list item',block:d},asyncValue:b({value:l,group:c,onTerminate(e){},onChange(e){f.instance&&f.instance.api.itemUpdater(e)},onInit(e){f.active&&(r||(f.instance=q(m,{values:{id:p,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:f.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r})))}})},h=u.length;u.push(f);let v=h>0?u[h-1].leafData:null;if(d.child.parent=d,o.child.push(d),v){let e=v.block;d.left=e;let t=e.right;t?(t.left=d,d.right=t):o.lastChild=d,e.right=d}else o.lastChild=d;r&&(f.instance=q(m,{values:{id:p,store:l},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:f.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r}))}return xt('list update ['+l.shortName+']'),0===u.length&&(o.lastChild=null),u},target:v}),i({source:t,clock:i({source:v,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}let{spawn:a}=e;a.active=0,H(a,a.parent.childSpawns[a.template.id]),H(a,a.template.pages)})},env:d}))}function W(e){if(!qt)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(qt.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':t.inParentIndex=qt.draft.childCount,qt.draft.childCount+=1,qt.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+qt.draft.type)}}function H(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function J({mount:e,state:t,onMount:a,onState:n}){return{onMount:i({source:t,clock:e,fn:a,greedy:1}),onState:i({source:e,clock:t,fn:n,greedy:1})}}let K=e=>(re(e)||ne(e))&&'kind'in e;const X=e=>t=>K(t)&&t.kind===e;let Y=X('store'),Z=X('event'),ee=X('effect'),te=X('domain'),ae=e=>{throw Error(e)},ne=e=>'object'==typeof e&&null!==e,re=e=>'function'==typeof e,le=e=>e.graphite||e,oe=e=>e.family.owners,ie=e=>e.family.links,se=e=>e.stateRef,ue=e=>e.config,pe=e=>e.ɔ,ce=e=>e.value,de=e=>e.subscribers,fe=e=>e.parent,he=(e,t)=>''+e.shortName+t,me=(e,t)=>null==t?he(e,' → *'):t;var ve=(()=>{var e,t=('undefined'!=typeof self?self:'undefined'!=typeof window?window:'undefined'!=typeof global?global:'undefined'!=typeof module?module:Function("","return this")()).Symbol;return'function'==typeof t?t.observable?e=t.observable:(e=t('observable'),t.observable=e):e='@@observable',e})();const ge=()=>{let e=0;return()=>(++e).toString(36)};let ye=ge(),be=ge(),ke=(e,t)=>e.bind(null,t),we=(e,t,a)=>e.bind(null,t,a);const xe=(e,t,a)=>({id:be(),type:e,data:a,hasRef:t});let Se=0,Ie=({priority:e="barrier"})=>xe('barrier',0,{barrierID:++Se,priority:e}),Re=({from:e="store",store:t,target:a,to:n=(a?'store':'stack')})=>xe('mov','store'===e,{from:e,store:t,to:n,target:a}),Te=()=>xe('check',0,{type:'defined'}),Ce=({store:e})=>xe('check',1,{type:'changed',store:e}),Fe=we(xe,'compute',0),Ae=we(xe,'filter',0),qe=we(xe,'run',0),Ne=({store:e})=>Re({from:'stack',target:e}),Pe=e=>({id:be(),current:e}),De=({current:e})=>e,Me=(e,{fn:t},{a})=>t(e,a),Oe=(e,{fn:t},{a})=>t(a,e),Ve=(e,{fn:t})=>t(e),Ee=(e,t)=>{let a=le(e);for(let e=0;e<t.length;e++){let n=le(t[e]);'domain'!==a.family.type&&(n.family.type='crosslink'),oe(n).push(a),ie(a).push(n)}};const ze=(e=[])=>{let t=[];if(Array.isArray(e))for(let a=0;a<e.length;a++)Array.isArray(e[a])?t.push(...e[a]):t.push(e[a]);else t.push(e);return t.map(le)};let je=({hasRef:e,type:t,data:a},n)=>{let r;e&&(r=a.store,n[r.id]=r),'mov'===t&&'store'===a.to&&(r=a.target,n[r.id]=r)},Be=null;const Le=(e,t)=>{if(!e)return t;if(!t)return e;let a,n=e.v.type===t.v.type;return(n&&e.v.id>t.v.id||!n&&'sampler'===e.v.type)&&(a=e,e=t,t=a),a=Le(e.r,t),e.r=e.l,e.l=a,e},Ue=[];let _e=0;for(;_e<5;)Ue.push({first:null,last:null,size:0}),_e+=1;const Qe=()=>{for(let e=0;e<5;e++){let t=Ue[e];if(t.size>0){if(2===e||3===e){t.size-=1;let e=Be.v;return Be=Le(Be.l,Be.r),e}1===t.size&&(t.last=null);let a=t.first;return t.first=a.r,t.size-=1,a.v}}},Ge=(e,t,a,n,r)=>$e(0,{a:null,b:null,node:a,parent:n,value:r,page:t},e),$e=(e,t,a,n=0)=>{let r=We(a),l=Ue[r],o={v:{idx:e,stack:t,type:a,id:n},l:0,r:0};2===r||3===r?Be=Le(Be,o):(0===l.size?l.first=o:l.last.r=o,l.last=o),l.size+=1},We=e=>{switch(e){case'child':return 0;case'pure':return 1;case'barrier':return 2;case'sampler':return 3;case'effect':return 4;default:return-1}},He=new Set;let Je=0,Ke=null,Xe=()=>Ke,Ye=(e,t,a)=>{let n=Ke,r=null;if(e.target&&(t=e.params,a=e.defer,n='page'in e?e.page:n,e.stack&&(r=e.stack),e=e.target),Array.isArray(e))for(let a=0;a<e.length;a++)Ge('pure',n,le(e[a]),r,t[a]);else Ge('pure',n,le(e),r,t);a&&Je||(()=>{let e,t,a,n,r,l,o={alreadyStarted:Je,currentPage:Ke};Je=1;e:for(;n=Qe();){let{idx:o,stack:i,type:s}=n;a=i.node,Ke=r=i.page,l=(r||a).reg;let u={fail:0,scope:a.scope};e=t=0;for(let n=o;n<a.seq.length&&!e;n++){let p=a.seq[n],c=p.data;switch(p.type){case'barrier':{let e=c.barrierID;r&&(e=`${r.fullID}_${e}`);let t=c.priority;if(n!==o||s!==t){He.has(e)||(He.add(e),$e(n,i,t,e));continue e}He.delete(e);break}case'mov':{let e;switch(c.from){case'stack':e=ce(i);break;case'a':e=i.a;break;case'b':e=i.b;break;case'value':e=c.store;break;case'store':l[c.store.id]||(i.page=r=null,l=a.reg),e=De(l[c.store.id])}switch(c.to){case'stack':i.value=e;break;case'a':i.a=e;break;case'b':i.b=e;break;case'store':l[c.target.id].current=e}break}case'check':switch(c.type){case'defined':t=void 0===ce(i);break;case'changed':t=ce(i)===De(l[c.store.id])}break;case'filter':t=!Ze(u,c,i);break;case'run':if(n!==o||'effect'!==s){$e(n,i,'effect');continue e}case'compute':i.value=Ze(u,c,i)}e=u.fail||t}if(!e)for(let e=0;e<a.next.length;e++)Ge('child',r,a.next[e],i,ce(i))}Je=o.alreadyStarted,Ke=o.currentPage})()};const Ze=(e,{fn:t},a)=>{try{return t(ce(a),e.scope,a)}catch(t){console.error(t),e.fail=1}};let et=(e,t)=>{pe(e)&&t(ue(e),pe(e))};const tt=(e,t)=>{let a=e.indexOf(t);-1!==a&&e.splice(a,1)},at=(e,t)=>{tt(e.next,t),tt(oe(e),t),tt(ie(e),t)},nt=(e,t,a)=>{let n;e.next.length=0,e.seq.length=0,e.scope=null;let r=ie(e);for(;n=r.pop();)at(n,e),(t||a&&!e.meta.sample||'crosslink'===n.family.type)&&nt(n,t,a);for(r=oe(e);n=r.pop();)at(n,e),a&&'crosslink'===n.family.type&&nt(n,t,a)},rt=e=>e.clear();let lt=(e,{deep:t}={})=>{let a=0;if(e.ownerSet&&e.ownerSet.delete(e),Y(e))rt(de(e));else if(te(e)){a=1;let t=e.history;rt(t.events),rt(t.effects),rt(t.stores),rt(t.domains)}nt(le(e),!!t,a)},ot=e=>{let t=we(lt,e,void 0);return t.unsubscribe=t,t},st=e=>(ut&&Ee(ce(ut),[e]),e),ut=null,pt=()=>ut&&ut.template,ct=(e,t,{node:n,scope:r,meta:l})=>st(a({node:n,parent:e,child:t,scope:r,meta:l,family:{owners:[e,t],links:t}})),dt=(e,t)=>ot(st(a({scope:{fn:t},node:[qe({fn:Ve})],parent:e,meta:{op:'watch'},family:{owners:e}})));const ft=(e,t)=>(ne(e)&&(ft(ue(e),t),null!=e.name&&(ne(e.name)?ft(e.name,t):t.name=e.name),e.loc&&(t.loc=e.loc),(e.sid||null===e.sid)&&(t.sid=e.sid),e.handler&&(t.handler=e.handler),fe(e)&&(t.parent=fe(e)),'strict'in e&&(t.strict=e.strict),e.named&&(t.named=e.named),ft(pe(e),t)),t);let ht,mt=(e,t,a,n)=>{let r=ft({name:n,config:a},{}),l=ye(),{parent:o=null,sid:i=null,strict:s=1,named:u=null}=r,p=u||r.name||('domain'===e?'':l),c=((e,t)=>{let a,n,r,l=e;return t?(r=t.compositeName,0===e.length?(a=r.path,n=r.fullName):(a=r.path.concat([e]),n=0===r.fullName.length?e:r.fullName+'/'+e)):(a=0===e.length?[]:[e],n=e),{shortName:l,fullName:n,path:a}})(p,o);return t.kind=e,t.id=l,t.sid=i,t.shortName=p,t.parent=o,t.compositeName=c,t.defaultConfig=r,t.thru=e=>e(t),t.getType=()=>c.fullName,ht=s,{unit:e,name:p,sid:i,named:u}};const vt=(e,t,a,n)=>ct(e,t,{scope:{fn:n},node:[Fe({fn:Ve})],meta:{op:a}}),gt=(e,t,a,n)=>{let l;ne(a)&&(l=a,a=a.fn);let o=r(he(e,' →? *'),l);return ct(e,o,{scope:{fn:a},node:n,meta:{op:t}}),o},yt=(e,t)=>(t.subscribe=t=>((e=>{ne(e)||re(e)||ae('expect value to be an object')})(t),e.watch(e=>{t.next&&t.next(e)})),t[ve]=()=>t,t),bt=(e,t,a,n,r)=>{let l=se(t),o=[Re({store:l,to:'a'}),Fe({fn:n?Oe:Me}),Te(),Ce({store:l}),Ne({store:l})],i=pt();if(i&&(o.unshift(i.loader),o.push(i.upward),Y(e))){let t=se(e);i.plain.includes(t)||(i.closure.includes(t)||i.closure.push(t),l.before||(l.before=[]),l.before.push({type:'closure',of:t}))}return ct(e,t,{scope:{fn:r},node:o,meta:{op:a}})};let kt=(e,t)=>{for(let a in e)t(e[a],a)};a({node:[qe({fn({fn:e,value:t}){e(t)}})],meta:{op:'fx',fx:'sidechain'}});let wt,xt,St,It=e=>K(e)?e:((...e)=>{let a,n,r;0===e.length&&ae('at least one argument required'),et(e[0],(t,a)=>{r=t,e=a});let l,i,s=e[e.length-1];if(re(s)?(n=e.slice(0,-1),a=s):n=e,1===n.length){let e=n[0];Y(e)||(l=e,i=1)}return i||(l=n,a&&(a=(e=>t=>e(...t))(a))),((e,a,n,r)=>{let l=e?e=>e.slice():e=>Object.assign({},e),i=e?[]:{},s=pt(),u=l(i),p=Pe(u),c=Pe(1);p.type=e?'list':'shape',s&&s.plain.push(p,c);let d=o(u,{name:n||t(a)}),f=[Te(),Re({store:p,to:'a'}),Ae({fn:(e,{key:t},{a})=>e!==a[t]}),Re({store:c,to:'b'}),Fe({fn(e,{clone:t,key:a},n){n.b&&(n.a=t(n.a)),n.a[a]=e}}),Re({from:'a',target:p}),Re({from:'value',store:0,target:c}),Ie({priority:'barrier'}),Re({from:'value',store:1,target:c}),Re({store:p}),r&&Fe({fn:r}),Ce({store:se(d)})],h=p.before=[];return kt(a,(e,t)=>{if(!Y(e))return void(u[t]=i[t]=e);i[t]=e.defaultState,u[t]=e.getState();let a=ct(e,d,{scope:{key:t,clone:l},node:f,meta:{op:'combine'}}),n=se(e);h.push({type:'field',field:t,from:n}),s&&(s.plain.includes(n)||a.seq.unshift(s.loader))}),d.defaultShape=a,p.after=[r?{type:'map',to:se(d),fn:r}:{type:'copy',to:se(d)}],s||(d.defaultState=r?se(d).current=r(u):i),d})(Array.isArray(l),l,r,a)})(e);Ae({fn:(e,{state:t})=>void 0!==e&&e!==De(t)}),Fe({fn:e=>e}),'undefined'!=typeof performance&&performance.mark?(wt=e=>{performance.mark('☄️ '+e+' start')},xt=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(wt=()=>{},xt=()=>{}),St='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 Rt='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Tt=0,Ct=0,Ft=null,At=null,qt=null,Nt=r();Nt.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),e.h=(e,t)=>{function a(e){return e.data.block.value}function n(e,t,a){let n=e.data.block.child.child,r={type:'text',parent:{type:'FT',parent:n,child:null,visible:0,index:a},value:null};if(r.parent.child=r,n.child[a]=r.parent,e.hydration){let e=M(r);if(e)switch(e.type){case'text':r.value=p.document.createTextNode(t),e.value.after(r.value);break;case'element':r.value=e.value.nextSibling,C(r.value,t)}else{let e=N(r);r.value=e.firstChild,C(r.value,t)}r.parent.visible=1}else r.value=p.document.createTextNode(t),z(r);return r}let l,o=0,u=0;'function'==typeof t?(o=1,l=t):t&&(u=1,t.fn&&(o=1,l=t.fn),t.ɔ&&('function'==typeof t.ɔ?(o=1,l=t.ɔ):'function'==typeof t.ɔ.fn&&(o=1,l=t.ɔ.fn)));let p=qt.env,c=qt.namespace,d=c,m='html';d=m='svg'===c?'svg':'html','svg'===e&&(m='svg',d='svg');let g='svg'===m?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e);'foreignObject'===c?(g.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),d='html'):'svg'===e?(g.setAttribute('xmlns','http://www.w3.org/2000/svg'),d='svg'):'foreignObject'===e&&(d='foreignObject');let y=g,b={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:y,seq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]},k=F({name:'element',draft:b,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:p,unmount:c}){function d(e){return J({mount:m,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let m=r(),g=p.map(({leaf:e})=>e);o&&l(),u&&L(t);let w={attr:{},data:{},text:b.text,styleProp:{},styleVar:{},visible:b.visible||null,handler:b.handler};for(let e=0;e<b.attr.length;e++){let t=b.attr[e];for(let e in t)'xlink:href'===e?w.attr.href=t[e]:w.attr[e]=t[e]}for(let e=0;e<b.data.length;e++){let t=b.data[e];for(let e in t)w.data[e]=t[e]}for(let e=0;e<b.styleProp.length;e++){let t=b.styleProp[e];for(let e in t)e.startsWith('--')?w.styleVar[e.slice(2)]=t[e]:w.styleProp[e]=t[e]}for(let e=0;e<b.styleVar.length;e++){let t=b.styleVar[e];for(let e in t)w.styleVar[e]=t[e]}w.visible&&b.seq.push({type:'visible',value:w.visible});for(let e in w.attr){let t=w.attr[e];K(t)?b.seq.push({type:'attr',field:e,value:t}):T(y,e,t)}for(let e in w.data){let t=w.data[e];K(t)?b.seq.push({type:'data',field:e,value:t}):R(y,e,t)}for(let e in w.styleProp){let t=w.styleProp[e];K(t)?b.seq.push({type:'style',field:e,value:t}):I(y,e,t)}for(let e in w.styleVar){let t=w.styleVar[e];K(t)?b.seq.push({type:'styleVar',field:e,value:t}):S(y,e,t)}for(let e=0;e<w.text.length;e++){let t=w.text[e];if(null!==t.value)if(K(t.value)){b.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=Ft;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else b.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<w.handler.length;e++){let t=w.handler[e];for(let e in t.map)b.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(w.visible){let{onMount:e,onState:t}=J({mount:g,state:w.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,r=n.block;if(a&&(f(t,n.ops.visible),t)){let e,t=O(r);if(e=t?t.nextSibling:N(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}V(b,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:k.isSvgRoot?r.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,Ye({target:Nt,params:{element:n.block.value,fns:b.node},page:e.spawn,defer:1})),Ye({target:m,params:e,defer:1,page:e.spawn})}),s([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||h(t,e.data.ops.visible)})}for(let e=0;e<b.seq.length;e++){let t=b.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:l}=d(t.value);if(n)s([l,r]).watch(({leaf:t,value:n})=>{T(a(t),e,n)});else{let t=b.opsAmount++;r.watch(({value:n,leaf:r})=>{let l=a(r),o=v({value:n,priority:'props',runOp(t){T(l,e,t)},group:r.ops.group});r.ops.group.ops[t]=o,T(l,e,n)}),l.watch(({value:e,leaf:a})=>{h(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),l=b.opsAmount++;n.watch(({value:t,leaf:n})=>{let r=a(n),o=v({value:t,priority:'props',runOp(t){R(r,e,t)},group:n.ops.group});n.ops.group.ops[l]=o,R(r,e,t)}),r.watch(({value:e,leaf:t})=>{h(e,t.ops.group.ops[l])});break}case'style':{let e=b.opsAmount++,{field:n}=t,{onMount:r,onState:l}=d(t.value);r.watch(({value:t,leaf:r})=>{let l=a(r),o=v({value:t,priority:'props',runOp(e){I(l,n,e)},group:r.ops.group});r.ops.group.ops[e]=o,I(l,n,t)}),l.watch(({value:t,leaf:a})=>{h(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),l=b.opsAmount++;n.watch(({value:t,leaf:n})=>{let r=a(n),o=v({value:t,priority:'props',runOp(t){S(r,e,t)},group:n.ops.group});n.ops.group.ops[l]=o,S(r,e,t)}),r.watch(({value:e,leaf:t})=>{h(e,t.ops.group.ops[l])});break}case'staticText':m.map(e=>e).watch(e=>{n(e,t.value,t.childIndex)});break;case'dynamicText':{let e=b.opsAmount++;i({source:t.value,clock:m,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:r})=>{let l=v({value:a,priority:'props',runOp(e){C(o.value,e)},group:r.ops.group});r.ops.group.ops[e]=l;let o=n(r,a,t.childIndex)}),i({source:m,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{h(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;m.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(),Ye({target:t.handler,params:e,page:r})},t.domConfig)});break}}}i({source:g,clock:c,greedy:1}).watch(e=>{let{spawn:t}=e;H(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,H(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),h(0,e.data.ops.visible)}),p.watch(({leaf:e})=>{let t=e.data;if(!b.visible){let a=t.ops.visible,n=t.block;if(e.hydration){f(1,a);let e,t=O(n);if(e=t?t.nextSibling:N(n).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}n.value=e,n.parent.visible=1}V(b,{parentBlockFragment:n.child.child,leaf:e,node:n.value,svgRoot:k.isSvgRoot?n.value:null}),Ye({target:m,params:e,defer:1,page:e.spawn}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,Ye({target:Nt,params:{element:t.block.value,fns:b.node},page:e.spawn,defer:1})):h(1,a)}})},env:p});W(k)},e.handler=U,e.list=$,e.node=e=>{let t=qt.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':return}t.node.push(e)},e.rec=G,e.remap=j,e.route=_,e.spec=L,e.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);L({text:a})},e.tree=({source:e,child:t,fn:a})=>{let n=G(({state:e})=>{$({source:e,fn({store:e}){let r=e.map(e=>e[t]||[]);a({store:e,child(){n({state:r})}})}})});n({state:e})},e.using=(e,t)=>{let a,n,r,l,o;'function'==typeof t?(a=t,r=B(),l=0):(a=t.fn,r=t.env?t.env:B(),l=t.hydrate,n=t.onComplete,o=t.onRoot);let i=e.namespaceURI,s=e.tagName.toLowerCase(),u={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},p=F({name:'using',draft:u,isSvgRoot:'svg'===s,namespace:'http://www.w3.org/2000/svg'===i?'svg':'foreignobject'===s?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{V(u,{parentBlockFragment:t.data.block.child.child,leaf:t,node:e})})},env:r}),c={type:'using',child:{type:'UF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:e};c.child.parent=c,c.child.child.parent=c.child;let d=g({onComplete:n}),f=q(p,{parentLeaf:At||null,mountNode:e,svgRoot:p.isSvgRoot?e:At?At.svgRoot:null,leafData:{type:'using',draft:u,element:e,block:c},opGroup:y(d),domSubtree:y(d),hydration:l});o&&o({template:p,leaf:f})},e.variant=({source:e,cases:t,key:a})=>{let n='function'==typeof a?a:e=>String(e[a]),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):'function'==typeof define&&define.amd?define(['exports'],t):t((e=e||self).forest={})})(this,e=>{function t(e,t="combine"){let a=t+'(',n='',r=0;for(let t in e){let l=e[t];if(null!=l&&(a+=n,a+=K(l)?l.compositeName.fullName:l.toString()),r+=1,25===r)break;n=', '}return a+=')',a}function a({node:e=[],from:t,source:a,parent:n=t||a,to:r,target:l,child:o=r||l,scope:i={},meta:s={},family:u={type:'regular'}}={}){let p=ze(n),c=ze(u.links),d=ze(u.owners),f=[],h={};for(let t=0;t<e.length;t++){let a=e[t];a&&(f.push(a),je(a,h))}let m={seq:f,next:ze(o),meta:s,scope:i,family:{type:u.type||'crosslink',links:c,owners:d},reg:h};for(let e=0;e<c.length;e++)oe(c[e]).push(m);for(let e=0;e<d.length;e++)ie(d[e]).push(m);for(let e=0;e<p.length;e++)p[e].next.push(m);return m}function n(e,t){ut={parent:ut,value:e,template:le(e).meta.template||ut&&ut.template};try{return t()}finally{ut=fe(ut)}}function r(e,t){let n=(e,...t)=>n.create(e,t,t);n.graphite=a({meta:mt('event',n,t,e)}),n.create=e=>(Ye(n,e),e),n.watch=ke(dt,n),n.map=e=>{let t,a;ne(e)&&(t=e,a=e.name,e=e.fn);let l=r(me(n,a),t);return vt(n,l,'map',e),l},n.filter=e=>re(e)?(console.error('.filter(fn) is deprecated, use .filterMap instead'),l(n,e)):gt(n,'filter',e.fn,[Ae({fn:Ve})]),n.filterMap=ke(l,n),n.prepend=e=>{let t=r('* → '+n.shortName,{parent:fe(n)}),a=pt();return a&&le(t).seq.push(a.upward),vt(t,n,'prepend',e),((e,t)=>{fe(e)&&fe(e).hooks.event(t)})(n,t),t},yt(n,n);let o=pt();return o&&(le(n).meta.nativeTemplate=o),st(n)}function l(e,t){return gt(e,'filterMap',t,[Fe({fn:Ve}),Te()])}function o(e,t){function n(e,t){p.off(e),de(p).set(e,ot(bt(e,p,'on',1,t)))}let l=Pe(e),i=Pe(e),s=(()=>r({named:'updates'}))(),u=pt();l.after=[{type:'copy',to:i}],u&&u.plain.push(l);let p={subscribers:new Map,updates:s,defaultState:e,stateRef:l,getState(){let e=Xe();return De(e&&e.reg[l.id]?e.reg[l.id]:l)},setState(e){Ye({target:p,params:e,defer:1})},reset(...e){for(let t of e)p.on(t,()=>p.defaultState);return p},on(e,t){if(Array.isArray(e))for(let a of e)n(a,t);else n(e,t);return p},off(e){let t=de(p).get(e);return t&&(t(),de(p).delete(e)),p},map(e,t){let a,n,r;ne(e)&&(a=e,n=e.name,t=e.firstState,e=e.fn);let i=p.getState(),s=pt();s?r=null:void 0!==i&&(r=e(i,t));let u=o(r,{name:me(p,n),config:a,strict:0}),c=bt(p,u,'map',0,e);return se(u).before=[{type:'map',fn:e,from:l}],s&&(s.plain.includes(l)||c.seq.includes(s.loader)||c.seq.unshift(s.loader)),u},[ve]:()=>yt(p,{})};return p.graphite=a({scope:{state:l},node:[Te(),Ne({store:l}),Ce({store:i}),Ne({store:i})],child:s,meta:mt('store',p,t)}),ht&&void 0===e&&ae("current state can't be undefined, use null instead"),u&&(le(p).meta.nativeTemplate=u),p.watch=p.subscribe=(e,t)=>{if(!t||!K(e)){re(e)||ae('watch requires function handler');let t=pt();return t?t.watch.push({of:l,fn:e}):e(p.getState()),dt(p,e)}return re(t)||ae('second argument should be a function'),e.watch(e=>t(p.getState(),e))},Ee(p,[s]),st(p)}function i(...e){let t,n,l;et(e[0],(t,a)=>{l=t,e=a});let i,[s,u,p,c=0]=e;void 0===u&&'source'in s&&('clock'in s&&null==s.clock&&ae('config.clock should be defined'),u=s.clock,p=s.fn,c=s.greedy,t=s.target,n=s.name,i=s.sid,s=s.source),void 0===u&&(u=s),n=l||n||s.shortName,s=It(s),u=It(u),'boolean'==typeof p&&(c=p,p=null);let d=pt(),f=!!t;t||(Y(s)&&Y(u)?t=o(p?p(De(se(s)),De(se(u))):De(se(s)),{name:n,sid:i}):(t=r(n),d&&le(t).seq.push(d.loader)));let h=f&&K(t)&&le(t).meta.nativeTemplate;if(Y(s))Ee(s,[ct(u,t,{scope:{fn:p,targetTemplate:h},node:[d&&d.loader,!c&&Ie({priority:'sampler'}),Re({store:se(s),to:p?'a':'stack'}),p&&Fe({fn:Oe}),d&&f&&d.upward],meta:{op:'sample',sample:'store'}})]);else{let e=Pe(0),n=Pe(),r=Pe();d&&d.plain.push(e,n,r),st(a({parent:s,node:[Ne({store:n}),Re({from:'value',store:1,target:e})],family:{owners:[s,t,u],links:t},meta:{op:'sample',sample:'source'}})),Ee(s,[ct(u,t,{scope:{fn:p,targetTemplate:h},node:[d&&d.loader,Ne({store:r}),Re({store:e}),Ae({fn:e=>e}),!c&&Ie({priority:'sampler'}),Re({store:n}),Re({store:r,to:'a'}),p&&Fe({fn:Me}),d&&f&&d.upward],meta:{op:'sample',sample:'clock'}})])}return t}function s(e){let n=r(t(e,'merge'));return(e=>{let t;et(e,(a,n)=>{t=a,e=n});let{from:n,to:r,meta:l={op:'forward'}}=e;n&&r||ae('from and to fields should be defined'),t&&(l.config=t),ot(st(a({parent:n,child:r,meta:l,family:{}})))})({from:e,to:n,meta:{op:'merge'}}),n}function u(e,t,a){if(Y(e))return e;if(K(e)){let n,r=fe(e);return Z(e)&&(n=o(t,{parent:r,name:e.shortName,ɔ:a}).on(e,(e,t)=>t)),ee(e)&&(n=o(t,{parent:r,name:e.shortName,ɔ:a}).on(e.done,(e,{result:t})=>t)),r&&r.hooks.store(n),n}let n={};return kt(e,(e,t)=>{n[t]=Y(e)?e:o(e,{name:t})}),n}function p(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 c(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})(d(e),e)}function d(e){return e.group.activeChilds[e.priority]}function f(e,t){t.value.active=t.value.pending=e,'active'!==t.status&&c(t)}function h(e,t){if(t.value.active===e)return t.value.pending=e,void('pending'===t.status&&(c(t),d(t).first||p(t.group,t.priority)));'active'===t.status&&(t.status='pending',d(t).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})(t.group,t.priority),((e,t)=>{e.last?(t.cursor.prev=e.last,e.last.cursor.next=t,e.last=t):e.first=e.last=t})(d(t),t)),t.value.pending=e,t.group.queue.rafID||(t.group.queue.rafID=Rt(t.group.queue.execQueue))}function m(e){wt('execQueue');let t,a,n=St(),r=0;e:for(;e.props.first||e.tree.first||e.data.first;){if(St()-n>=10){r=1;break e}let l=!!e.props.first;for(l&&wt('props');t=e.props.first;){for(;a=t.activeChilds.props.first;){if(St()-n>=10){r=1,xt('props');break e}a.runOp(a.value.pending),a.value.active=a.value.pending,c(a)}p(t,'props')}l&&xt('props');let o=!!e.tree.first;for(o&&wt('tree');t=e.tree.first;){for(;a=t.activeChilds.tree.first;){if(St()-n>=10){r=1,xt('tree');break e}a.runOp(a.value.pending),a.value.active=a.value.pending,c(a)}p(t,'tree')}o&&xt('tree');let i=!!e.data.first;for(i&&wt('data');t=e.data.first;){for(;a=t.activeChilds.data.first;){if(St()-n>=10){r=1,xt('data');break e}a.runOp(a.value.pending),a.value.active=a.value.pending,c(a)}p(t,'data')}i&&xt('data')}if(xt('execQueue'),r)e.rafID=Rt(e.execQueue);else if(e.rafID=null,e.onDrain){let t=e.onDrain;e.onDrain=null,t()}}function v({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 g({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=m.bind(null,t),t}function y(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 b({value:e,group:t,onInit:a,onChange:n,onTerminate:r}){let l=v({value:e,group:t,runOp(e){o.status='A',n(e)},priority:'data'}),o={status:'IA',value:l.value,hooks:{onTerminate:r},ops:{init:v({value:0,group:t,runOp(e){o.status='A',a(o.value.active)},priority:'data'}),change:l,terminate:v({value:0,group:t,runOp(e){o.status='T',o.hooks.onTerminate(1)},priority:'data'})}};return h(1,o.ops.init),o}function k(e){switch(e.status){case'I':case'T':case'AT':return;case'A':e.status='AT',h(1,e.ops.terminate);break;case'AA':e.status='AT',h(1,e.ops.terminate),h(e.value.active,e.ops.change);break;case'IA':e.status='T',h(0,e.ops.init),e.hooks.onTerminate(0)}}function w(e,t){switch(t.status){case'I':case'T':return;case'A':t.value.active!==e&&(t.status='AA',h(e,t.ops.change));break;case'AA':t.value.active===e?(t.status='A',h(e,t.ops.change)):t.value.pending!==e&&(t.value.pending=e);break;case'IA':t.value.active=t.value.pending=e}}function x(e){return''!==e&&0!==e&&'0'!==e&&(0==e||null==e)}function S(e,t,a){x(a)?e.style.removeProperty("--"+t):e.style.setProperty("--"+t,""+a)}function I(e,t,a){x(a)?delete e.style[t]:e.style[t]=""+a}function R(e,t,a){x(a)?delete e.dataset[t]:e.dataset[t]=""+a}function T(e,t,a){if(x(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 C(e,t){e.replaceData(0,(e.textContent||'').length,String(t))}function F({fn:e,state:t={},defer:l=0,name:o="",draft:i,isSvgRoot:s,namespace:p,env:c}){let d=qt,f=Ft,h={id:++Tt,name:o,plain:[],watch:[],nameMap:{},pages:[],closure:[],childTemplates:[],upward:Ae({fn(e,t,a){if(!a.page)return console.error('context lost',a),0;if(!a.page.active)return 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)?Ye({target:t,params:e,defer:1,page:r[n.indexOf(l)],stack:a}):console.error('context drift',{stack:a,node:t}):Ye({target:t,params:e,defer:1,page:null,stack:a})}),0}}),loader:Ae({fn(e,t,a){if(a.parent){if(a.page){if(!a.page.active)return 0;if(a.page.template===h)return 1;if(a.page.childSpawns[h.id])a.page.childSpawns[h.id].forEach(t=>{Ye({params:e,target:a.node,page:t,defer:1})});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);Ye(-1===r?{params:e,target:a.node,page:null,defer:1}:{params:e,target:a.node,page:n[r],defer:1})}else h.pages.forEach(t=>{t.fullID.startsWith(a.page.fullID)&&Ye({params:e,target:a.node,page:t,defer:1})})}else h.pages.forEach(t=>{Ye({params:e,target:a.node,page:t,defer:1})});return 0}return 1}}),parent:f};f&&f.childTemplates.push(h);let m=a({meta:{template:h}});Ft=h;let v=qt={template:h,node:m,api:null,trigger:{mount:r(),unmount:r()},draft:i,isSvgRoot:s,namespace:p,env:c};return l?v.deferredInit=()=>{let a=qt,r=Ft;qt=v,Ft=h,v.deferredInit=null;try{n(m,()=>{let a=u(t);v.api=e(a,v.trigger),h.nameMap=a})}finally{qt=a,Ft=r}}:n(m,()=>{let a=u(t);v.api=e(a,v.trigger),h.nameMap=a}),qt=d,Ft=f,h.actor=v,v}function A(e){switch(e.type){case'list':return[...e.current];case'shape':return{...e.current};default:return e.current}}function q(e,{values:t={},parentLeaf:a,mountNode:n,svgRoot:r,leafData:l,opGroup:o,domSubtree:i,hydration:s}){function u(e){if(e.before)for(let t of e.before)switch(t.type){case'map':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current=t.fn(f[a.id].current);break}case'field':{let a=t.from;f[a.id]||(f[a.id]=a),f[e.id].current[t.field]=f[a.id].current;break}case'closure':f[t.of.id]||(f[t.of.id]=t.of)}if(!e.after)return;let t=f[e.id].current;for(let a of e.after){let e=a.to;switch(f[e.id]||(f[e.id]={id:e.id,current:e.current}),a.type){case'copy':f[e.id].current=t;break;case'map':f[e.id].current=a.fn(t)}}}function p(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].current)}catch(e){console.error(e),t.stop=0}}let c=a?a.spawn:null,d=e.template,f={},h={id:++Ct,fullID:'',reg:f,template:d,parent:c,childSpawns:{},active:1};d.pages.push(h);let m={},v={spawn:h,api:m,draft:e.draft,ops:{group:o,domSubtree:i},svgRoot:r,data:l,parentLeaf:a,hydration:s},g=At;At=v,c&&(c.childSpawns[d.id]||(c.childSpawns[d.id]=[]),c.childSpawns[d.id].push(h)),h.fullID=c?`${c.fullID}_${h.id}`:""+h.id,c&&Object.assign(f,c.reg);for(let e of d.closure){let t=e,a=h.parent;e:for(;a;){if(e.id in a.reg){t=a.reg[e.id];break e}a=a.parent}f[e.id]=t}for(let e of d.plain){let t={id:e.id,current:A(e)};f[e.id]=t}for(let e in t){let a=d.nameMap[e].stateRef.id;f[a]={id:a,current:t[e]}}for(let e of d.closure)u(e);for(let e of d.plain)u(e);let y={i:0,stop:0};for(;!y.stop;)p(d.watch,y,f);if(c)for(let e in h.childSpawns)e in c.childSpawns||(c.childSpawns[e]=[]),c.childSpawns[e].push(...h.childSpawns[e]);if(m.mount=(t,a=1)=>Ye({target:e.trigger.mount,params:t,defer:a,page:h}),m.unmount=(t,a=1)=>Ye({target:e.trigger.unmount,params:t,defer:a,page:h}),e.api)for(let t in e.api)m[t]=(a,n=1)=>Ye({target:e.api[t],params:a,defer:n,page:h});return v.spawn.api=m,v.spawn.leaf=v,v.api.mount({node:n,leaf:v}),At=g,v}function N(e){let t=function e(t){switch(t.type){case'fragment':switch(t.parent.type){case'EF':case'UF':return t.parent.parent}return e(t.parent.parent);case'route':default:return e(t.parent.parent)}}(e);return t?t.value:null}function P(e){if(!e.visible)return null;switch(e.type){case'FE':case'FT':return e.child;case'FR':return P(e.child.child);case'LF':case'RF':case'FF':return D(e.child);case'FRec':case'FRecItem':return D(e.child.child.child);case'FL':{let t=e.child.lastChild;if(!t)return null;for(;t;){let e=P(t);if(e)return e;t=t.left}return null}default:return null}}function D(e){let t=e.child;for(let e=t.length-1;e>=0;e--){let a=P(t[e]);if(a)return a}return null}function M(e){if('fragment'===e.type)switch(e.parent.type){case'EF':case'UF':return null;case'RecF':case'RecItemF':case'RF':{let t=e.parent.parent.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=P(a.child[e]);if(t)return t}return M(a)}case'FF':{let t=e.parent,a=t.parent;for(let e=t.index-1;e>=0;e--){let t=P(a.child[e]);if(t)return t}return M(a)}case'LF':{let t=e.parent.left;for(;t;){let e=P(t);if(e)return e;t=t.left}return M(e.parent.parent)}default:return null}if('route'===e.type){let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=P(e);if(n)return n}return M(t)}let t=e.parent.parent;for(let a=e.parent.index-1;a>=0;a--){let e=t.child[a];if(!e)continue;let n=P(e);if(n)return n}return M(t)}function O(e){let t=M(e);return t?t.value:null}function V(e,{parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l}){e.childTemplates.forEach(e=>{E({parentBlockFragment:t,leaf:a,node:n,svgRoot:r,values:l,actor:e})})}function E({parentBlockFragment:e,leaf:t,node:a,actor:n,svgRoot:r,values:l}){let o,{draft:i}=n,{queue:s}=t.ops.group,u=y(s),p=t.ops.domSubtree,c=p;switch(i.type){case'route':{let t={type:'route',parent:{type:'FR',parent:e,child:null,visible:1,index:i.inParentIndex},child:{type:'RF',parent:null,child:{type:'fragment',parent:null,child:[]},visible:0}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'route',block:t,ops:{},initialized:0};break}case'element':{let t={type:'element',parent:{type:'FE',parent:e,child:null,visible:0,index:i.inParentIndex},child:{type:'EF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:i.stencil.cloneNode()};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'element',block:t,ops:{visible:v({value:0,priority:'tree',runOp(e){e?(z(t),o.needToCallNode&&(o.needToCallNode=0,Ye({target:Nt,params:{element:t.value,fns:i.node},page:d.spawn}))):(t.value.remove(),t.parent.visible=0)},group:p})},needToCallNode:i.node.length>0},c=y(s);break}case'list':{let t={type:'list',parent:{type:'FL',parent:e,child:null,visible:1,index:i.inParentIndex},child:[],lastChild:null};t.parent.child=t,e.child[i.inParentIndex]=t.parent,o={type:'list',draft:i,block:t};break}case'using':case'listItem':break;case'rec':{let t={type:'rec',parent:{type:'FRec',parent:e,child:null,visible:1,index:i.inParentIndex},child:{type:'RecF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'rec',block:t};break}case'recItem':{let t={type:'recItem',parent:{type:'FRecItem',parent:e,child:null,visible:1,index:i.inParentIndex},child:{type:'RecItemF',parent:null,child:{type:'fragment',parent:null,child:[]}}};t.parent.child=t,t.child.parent=t,t.child.child.parent=t.child,e.child[i.inParentIndex]=t.parent,o={type:'rec item',block:t};break}default:console.warn("unexpected draft type "+i.type)}let d=q(n,{values:l,parentLeaf:t,mountNode:a,svgRoot:r||t.svgRoot,leafData:o,opGroup:u,domSubtree:c,hydration:t.hydration})}function z(e){let t=O(e);t?t.after(e.value):N(e).prepend(e.value),e.parent.visible=1}function j(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(){if('undefined'!=typeof document)return{document};throw Error('your environment has no document')}function L(e){let t=qt.draft;switch(t.type){case'list':return void(e.visible&&(t.itemVisible=e.visible));case'listItem':case'using':case'route':case'rec':case'recItem':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&&t.styleProp.push(e.style),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.ɔ&&L(e.ɔ)}function U(e,t){let a=qt.draft;if('element'!==a.type)throw Error(`"handler" extension can be used only with element nodes, got "${a.type}"`);void 0===t&&(t=e,e={});let{passive:n=1,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}){let n=F({name:'route',isSvgRoot:0,namespace:qt.namespace,env:qt.env,draft:{type:'route',childTemplates:[],childCount:0,inParentIndex:-1},fn(n,{mount:l,unmount:o}){let u=e.map(e=>({value:e,visible:t(e)})),p={type:'route',childTemplates:[],childCount:0,inParentIndex:-1},c=F({name:'route item',isSvgRoot:0,namespace:qt.namespace,env:qt.env,draft:p,state:{store:null},fn({store:e},{mount:t,unmount:n}){let l=r();e.on(l,(e,t)=>t),a({store:e});let o=i({source:t,clock:u,fn:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n}),greedy:1});t.watch(({leaf:e,node:t})=>{let a=e.data;a.block.child.visible=1,V(p,{parentBlockFragment:a.block.child.child,leaf:e,node:t})}),o.watch(({leaf:e,visible:t,value:a})=>{e.data.block.child.visible=t,t&&Ye({target:l,params:a,defer:1,page:e.spawn});let n=e=>{let a=e.data;switch(a.type){case'element':h(t,a.ops.visible);break;case'route':Q(e,n);break;default:console.log('unsupported type',a.type)}};Q(e,n)}),i({source:t,clock:n,greedy:1}).watch(({leaf:e})=>{Q(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,H(t,t.parent.childSpawns[t.template.id]),H(t,t.template.pages)})}});W(c);let{onMount:d,onState:f}=J({mount:l,state:u,onMount:({visible:e,value:t},{leaf:a,node:n})=>({leaf:a,visible:e,node:n,value:t}),onState:({leaf:e,node:t},{visible:a,value:n})=>({leaf:e,visible:a,node:t,value:n})});s([d,f]).watch(({leaf:e,visible:t,value:a,node:n})=>{let r=e.data;r.block.child.visible=t,t&&!r.initialized&&(E({parentBlockFragment:r.block.child.child,leaf:e,node:n,actor:c,values:{store:a}}),r.initialized=1)}),i({source:l,clock:o,greedy:1}).watch(({leaf:e})=>{Q(e,e=>{e.api.unmount()});let{spawn:t}=e;t.active=0,H(t,t.parent.childSpawns[t.template.id]),H(t,t.template.pages)})}});W(n)}function Q(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 G(e){let t={type:'rec',childTemplates:[],childCount:0,inParentIndex:0},a=F({name:'rec',state:{store:null},isSvgRoot:0,namespace:qt.namespace,env:qt.env,draft:t,defer:1,fn({store:a},{mount:n,unmount:l}){e({state:a});let o=r();return a.on(o,(e,t)=>t),n.watch(({node:e,leaf:a})=>{V(t,{parentBlockFragment:a.data.block.child.child,leaf:a,node:e})}),i({source:n,clock:l,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,Q(e,e=>{e.api.unmount()})}),{itemUpdater:o}}});return({state:e})=>{a.deferredInit&&a.deferredInit();let{env:t,namespace:n}=qt;W(F({name:'rec item',isSvgRoot:0,namespace:n,env:t,draft:{type:'recItem',childTemplates:[],childCount:0,inParentIndex:-1},fn(t,{mount:n,unmount:r}){let{onMount:l,onState:o}=J({state:e,mount:n,onMount:(e,{leaf:t,node:a})=>({state:e,leaf:t,node:a}),onState:({leaf:e,node:t},a)=>({state:a,leaf:e,node:t})});i({source:n,clock:r,greedy:1}).watch(({leaf:e})=>{e.spawn.active=0,Q(e,e=>{e.api.unmount()})}),o.watch(({state:e,leaf:t})=>{Q(t,t=>{t.api.itemUpdater(e)})}),l.watch(({node:e,leaf:t,state:n})=>{E({parentBlockFragment:t.data.block.child.child,leaf:t,node:e,actor:a,values:{store:n}})})}}))}}function $(e,t){'function'==typeof t&&(K(e)?e={source:e,fn:t}:e.fn=t);let{fn:a,key:n,source:l,fields:u=[]}=e,p=void 0!==n?'function'==typeof n?n:e=>e[n]:(e,t)=>t,c={type:'list',key:Y(e)?{type:'index'}:{type:'key',key:e.key},childTemplates:[],childCount:0,inParentIndex:-1},d=qt.env,f=qt.namespace;W(F({name:'list',draft:c,isSvgRoot:0,namespace:f,fn(e,{mount:t,unmount:n}){let m=F({name:'list item',state:{id:-1,store:null},draft:c,isSvgRoot:0,namespace:f,fn({id:e,store:t},{mount:n,unmount:l}){a({store:t,key:e,fields:j(t,u)});let s=r();t.on(s,(e,t)=>t);let p=o({leaf:null});if(i({source:p,clock:l,greedy:1}).watch(({leaf:e})=>{let t=e.data.block;H(t,t.parent.child);let a=t.left,n=t.right;a&&(a.right=n,n||t.parent.lastChild!==t||(t.parent.lastChild=a)),n&&(n.left=a),a||n||t.parent.lastChild!==t||(t.parent.lastChild=null),t.left=null,t.right=null,Q(e,e=>{e.api.unmount()});let{spawn:r}=e;r.active=0,H(r,r.parent.childSpawns[r.template.id]),H(r,r.template.pages)}),c.itemVisible){let{onMount:e,onState:t}=J({mount:n,state:c.itemVisible,onMount:(e,{node:t,leaf:a})=>({visible:e,node:t,leaf:a}),onState:({node:e,leaf:t},a)=>({visible:a,node:e,leaf:t})});e.watch(({visible:e,node:t,leaf:a})=>{p.setState({leaf:a});let n=a.data.block;n.visible=e,n.childInitialized=e,e&&V(c,{parentBlockFragment:n.child,leaf:a,node:t})}),t.watch(({visible:e,node:t,leaf:a})=>{let n=a.data.block;n.visible=e,n.childInitialized?Q(a,t=>{let a=t.data;switch(a.type){case'element':h(e,a.ops.visible);break;default:console.log('unsupported type',a.type)}}):e&&(n.childInitialized=1,V(c,{parentBlockFragment:n.child,leaf:a,node:t}))})}else n.watch(({node:e,leaf:t})=>{p.setState({leaf:t});let a=t.data.block;a.visible=1,a.childInitialized=1,V(c,{parentBlockFragment:a.child,leaf:t,node:e})});return{itemUpdater:s}},env:d}),v=o([]),g=l.map(e=>e),x=i({source:l,clock:t,fn:(e,{node:t,leaf:a})=>({updates:e,node:t,leaf:a,hydration:a.hydration}),greedy:1}),S=i({source:x,clock:g,fn:({node:e,leaf:t},a)=>({updates:a,node:e,leaf:t,hydration:0}),greedy:1});i({source:v,clock:s([x,S]),greedy:1,fn(e,{node:t,updates:a,leaf:n,hydration:r}){let o=n.data.block;wt('list update ['+l.shortName+']');let i=Array(a.length).fill(0),s=a.map(p),u=[];for(let t=0;t<e.length;t++){let n=e[t],r=s.indexOf(n.key);-1!==r?(u.push(n),i[r]=1,w(a[r],n.asyncValue)):(n.active=0,n.instance&&n.instance.api.unmount(),k(n.asyncValue))}for(let e=0;e<a.length;e++){if(i[e])continue;let l=a[e],p=s[e],c=y(n.ops.group.queue),d={type:'LF',parent:o,child:{type:'fragment',parent:null,child:[]},childInitialized:0,visible:0,left:null,right:null},f={type:'listItem',key:p,index:p,active:1,leafData:{type:'list item',block:d},asyncValue:b({value:l,group:c,onTerminate(e){},onChange(e){f.instance&&f.instance.api.itemUpdater(e)},onInit(e){f.active&&(r||(f.instance=q(m,{values:{id:p,store:e},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:f.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r})))}})},h=u.length;u.push(f);let v=h>0?u[h-1].leafData:null;if(d.child.parent=d,o.child.push(d),v){let e=v.block;d.left=e;let t=e.right;t?(t.left=d,d.right=t):o.lastChild=d,e.right=d}else o.lastChild=d;r&&(f.instance=q(m,{values:{id:p,store:l},parentLeaf:n,mountNode:t,svgRoot:n.svgRoot,leafData:f.leafData,opGroup:c,domSubtree:n.ops.domSubtree,hydration:r}))}return xt('list update ['+l.shortName+']'),0===u.length&&(o.lastChild=null),u},target:v}),i({source:t,clock:i({source:v,clock:n,greedy:1}),fn:({leaf:e},t)=>({leaf:e,records:t}),greedy:1}).watch(({leaf:e,records:t})=>{for(let e=0;e<t.length;e++){let a=t[e];a.instance&&a.instance.api.unmount(),a.active=0}let{spawn:a}=e;a.active=0,H(a,a.parent.childSpawns[a.template.id]),H(a,a.template.pages)})},env:d}))}function W(e){if(!qt)return;let{draft:t}=e;if('listItem'!==t.type&&'rec'!==t.type)switch(qt.draft.type){case'element':case'using':case'route':case'list':case'rec':case'recItem':t.inParentIndex=qt.draft.childCount,qt.draft.childCount+=1,qt.draft.childTemplates.push(e);break;default:console.warn("unexpected currentActor type "+qt.draft.type)}}function H(e,t){if(!t)return;let a=t.indexOf(e);-1!==a&&t.splice(a,1)}function J({mount:e,state:t,onMount:a,onState:n}){return{onMount:i({source:t,clock:e,fn:a,greedy:1}),onState:i({source:e,clock:t,fn:n,greedy:1})}}let K=e=>(re(e)||ne(e))&&'kind'in e;const X=e=>t=>K(t)&&t.kind===e;let Y=X('store'),Z=X('event'),ee=X('effect'),te=X('domain'),ae=e=>{throw Error(e)},ne=e=>'object'==typeof e&&null!==e,re=e=>'function'==typeof e,le=e=>e.graphite||e,oe=e=>e.family.owners,ie=e=>e.family.links,se=e=>e.stateRef,ue=e=>e.config,pe=e=>e.ɔ,ce=e=>e.value,de=e=>e.subscribers,fe=e=>e.parent,he=(e,t)=>''+e.shortName+t,me=(e,t)=>null==t?he(e,' → *'):t;var ve=(()=>{var e,t=('undefined'!=typeof self?self:'undefined'!=typeof window?window:'undefined'!=typeof global?global:'undefined'!=typeof module?module:Function("","return this")()).Symbol;return'function'==typeof t?t.observable?e=t.observable:(e=t('observable'),t.observable=e):e='@@observable',e})();const ge=()=>{let e=0;return()=>(++e).toString(36)};let ye=ge(),be=ge(),ke=(e,t)=>e.bind(null,t),we=(e,t,a)=>e.bind(null,t,a);const xe=(e,t,a)=>({id:be(),type:e,data:a,hasRef:t});let Se=0,Ie=({priority:e="barrier"})=>xe('barrier',0,{barrierID:++Se,priority:e}),Re=({from:e="store",store:t,target:a,to:n=(a?'store':'stack')})=>xe('mov','store'===e,{from:e,store:t,to:n,target:a}),Te=()=>xe('check',0,{type:'defined'}),Ce=({store:e})=>xe('check',1,{type:'changed',store:e}),Fe=we(xe,'compute',0),Ae=we(xe,'filter',0),qe=we(xe,'run',0),Ne=({store:e})=>Re({from:'stack',target:e}),Pe=e=>({id:be(),current:e}),De=({current:e})=>e,Me=(e,{fn:t},{a})=>t(e,a),Oe=(e,{fn:t},{a})=>t(a,e),Ve=(e,{fn:t})=>t(e),Ee=(e,t)=>{let a=le(e);for(let e=0;e<t.length;e++){let n=le(t[e]);'domain'!==a.family.type&&(n.family.type='crosslink'),oe(n).push(a),ie(a).push(n)}};const ze=(e=[])=>{let t=[];if(Array.isArray(e))for(let a=0;a<e.length;a++)Array.isArray(e[a])?t.push(...e[a]):t.push(e[a]);else t.push(e);return t.map(le)};let je=({hasRef:e,type:t,data:a},n)=>{let r;e&&(r=a.store,n[r.id]=r),'mov'===t&&'store'===a.to&&(r=a.target,n[r.id]=r)},Be=null;const Le=(e,t)=>{if(!e)return t;if(!t)return e;let a,n=e.v.type===t.v.type;return(n&&e.v.id>t.v.id||!n&&'sampler'===e.v.type)&&(a=e,e=t,t=a),a=Le(e.r,t),e.r=e.l,e.l=a,e},Ue=[];let _e=0;for(;_e<5;)Ue.push({first:null,last:null,size:0}),_e+=1;const Qe=()=>{for(let e=0;e<5;e++){let t=Ue[e];if(t.size>0){if(2===e||3===e){t.size-=1;let e=Be.v;return Be=Le(Be.l,Be.r),e}1===t.size&&(t.last=null);let a=t.first;return t.first=a.r,t.size-=1,a.v}}},Ge=(e,t,a,n,r)=>$e(0,{a:null,b:null,node:a,parent:n,value:r,page:t},e),$e=(e,t,a,n=0)=>{let r=We(a),l=Ue[r],o={v:{idx:e,stack:t,type:a,id:n},l:0,r:0};2===r||3===r?Be=Le(Be,o):(0===l.size?l.first=o:l.last.r=o,l.last=o),l.size+=1},We=e=>{switch(e){case'child':return 0;case'pure':return 1;case'barrier':return 2;case'sampler':return 3;case'effect':return 4;default:return-1}},He=new Set;let Je=0,Ke=null,Xe=()=>Ke,Ye=(e,t,a)=>{let n=Ke,r=null;if(e.target&&(t=e.params,a=e.defer,n='page'in e?e.page:n,e.stack&&(r=e.stack),e=e.target),Array.isArray(e))for(let a=0;a<e.length;a++)Ge('pure',n,le(e[a]),r,t[a]);else Ge('pure',n,le(e),r,t);a&&Je||(()=>{let e,t,a,n,r,l,o={alreadyStarted:Je,currentPage:Ke};Je=1;e:for(;n=Qe();){let{idx:o,stack:i,type:s}=n;a=i.node,Ke=r=i.page,l=(r||a).reg;let u={fail:0,scope:a.scope};e=t=0;for(let n=o;n<a.seq.length&&!e;n++){let p=a.seq[n],c=p.data;switch(p.type){case'barrier':{let e=c.barrierID;r&&(e=`${r.fullID}_${e}`);let t=c.priority;if(n!==o||s!==t){He.has(e)||(He.add(e),$e(n,i,t,e));continue e}He.delete(e);break}case'mov':{let e;switch(c.from){case'stack':e=ce(i);break;case'a':e=i.a;break;case'b':e=i.b;break;case'value':e=c.store;break;case'store':l[c.store.id]||(i.page=r=null,l=a.reg),e=De(l[c.store.id])}switch(c.to){case'stack':i.value=e;break;case'a':i.a=e;break;case'b':i.b=e;break;case'store':l[c.target.id].current=e}break}case'check':switch(c.type){case'defined':t=void 0===ce(i);break;case'changed':t=ce(i)===De(l[c.store.id])}break;case'filter':t=!Ze(u,c,i);break;case'run':if(n!==o||'effect'!==s){$e(n,i,'effect');continue e}case'compute':i.value=Ze(u,c,i)}e=u.fail||t}if(!e)for(let e=0;e<a.next.length;e++)Ge('child',r,a.next[e],i,ce(i))}Je=o.alreadyStarted,Ke=o.currentPage})()};const Ze=(e,{fn:t},a)=>{try{return t(ce(a),e.scope,a)}catch(t){console.error(t),e.fail=1}};let et=(e,t)=>{pe(e)&&t(ue(e),pe(e))};const tt=(e,t)=>{let a=e.indexOf(t);-1!==a&&e.splice(a,1)},at=(e,t)=>{tt(e.next,t),tt(oe(e),t),tt(ie(e),t)},nt=(e,t,a)=>{let n;e.next.length=0,e.seq.length=0,e.scope=null;let r=ie(e);for(;n=r.pop();)at(n,e),(t||a&&!e.meta.sample||'crosslink'===n.family.type)&&nt(n,t,a);for(r=oe(e);n=r.pop();)at(n,e),a&&'crosslink'===n.family.type&&nt(n,t,a)},rt=e=>e.clear();let lt=(e,{deep:t}={})=>{let a=0;if(e.ownerSet&&e.ownerSet.delete(e),Y(e))rt(de(e));else if(te(e)){a=1;let t=e.history;rt(t.events),rt(t.effects),rt(t.stores),rt(t.domains)}nt(le(e),!!t,a)},ot=e=>{let t=we(lt,e,void 0);return t.unsubscribe=t,t},st=e=>(ut&&Ee(ce(ut),[e]),e),ut=null,pt=()=>ut&&ut.template,ct=(e,t,{node:n,scope:r,meta:l})=>st(a({node:n,parent:e,child:t,scope:r,meta:l,family:{owners:[e,t],links:t}})),dt=(e,t)=>ot(st(a({scope:{fn:t},node:[qe({fn:Ve})],parent:e,meta:{op:'watch'},family:{owners:e}})));const ft=(e,t)=>(ne(e)&&(ft(ue(e),t),null!=e.name&&(ne(e.name)?ft(e.name,t):t.name=e.name),e.loc&&(t.loc=e.loc),(e.sid||null===e.sid)&&(t.sid=e.sid),e.handler&&(t.handler=e.handler),fe(e)&&(t.parent=fe(e)),'strict'in e&&(t.strict=e.strict),e.named&&(t.named=e.named),ft(pe(e),t)),t);let ht,mt=(e,t,a,n)=>{let r=ft({name:n,config:a},{}),l=ye(),{parent:o=null,sid:i=null,strict:s=1,named:u=null}=r,p=u||r.name||('domain'===e?'':l),c=((e,t)=>{let a,n,r,l=e;return t?(r=t.compositeName,0===e.length?(a=r.path,n=r.fullName):(a=r.path.concat([e]),n=0===r.fullName.length?e:r.fullName+'/'+e)):(a=0===e.length?[]:[e],n=e),{shortName:l,fullName:n,path:a}})(p,o);return t.kind=e,t.id=l,t.sid=i,t.shortName=p,t.parent=o,t.compositeName=c,t.defaultConfig=r,t.thru=e=>e(t),t.getType=()=>c.fullName,ht=s,{unit:e,name:p,sid:i,named:u}};const vt=(e,t,a,n)=>ct(e,t,{scope:{fn:n},node:[Fe({fn:Ve})],meta:{op:a}}),gt=(e,t,a,n)=>{let l;ne(a)&&(l=a,a=a.fn);let o=r(he(e,' →? *'),l);return ct(e,o,{scope:{fn:a},node:n,meta:{op:t}}),o},yt=(e,t)=>(t.subscribe=t=>((e=>{ne(e)||re(e)||ae('expect value to be an object')})(t),e.watch(e=>{t.next&&t.next(e)})),t[ve]=()=>t,t),bt=(e,t,a,n,r)=>{let l=se(t),o=[Re({store:l,to:'a'}),Fe({fn:n?Oe:Me}),Te(),Ce({store:l}),Ne({store:l})],i=pt();if(i&&(o.unshift(i.loader),o.push(i.upward),Y(e))){let t=se(e);i.plain.includes(t)||(i.closure.includes(t)||i.closure.push(t),l.before||(l.before=[]),l.before.push({type:'closure',of:t}))}return ct(e,t,{scope:{fn:r},node:o,meta:{op:a}})};let kt=(e,t)=>{for(let a in e)t(e[a],a)};a({node:[qe({fn({fn:e,value:t}){e(t)}})],meta:{op:'fx',fx:'sidechain'}});let wt,xt,St,It=e=>K(e)?e:((...e)=>{let a,n,r;0===e.length&&ae('at least one argument required'),et(e[0],(t,a)=>{r=t,e=a});let l,i,s=e[e.length-1];if(re(s)?(n=e.slice(0,-1),a=s):n=e,1===n.length){let e=n[0];Y(e)||(l=e,i=1)}return i||(l=n,a&&(a=(e=>t=>e(...t))(a))),((e,a,n,r)=>{let l=e?e=>e.slice():e=>Object.assign({},e),i=e?[]:{},s=pt(),u=l(i),p=Pe(u),c=Pe(1);p.type=e?'list':'shape',s&&s.plain.push(p,c);let d=o(u,{name:n||t(a)}),f=[Te(),Re({store:p,to:'a'}),Ae({fn:(e,{key:t},{a})=>e!==a[t]}),Re({store:c,to:'b'}),Fe({fn(e,{clone:t,key:a},n){n.b&&(n.a=t(n.a)),n.a[a]=e}}),Re({from:'a',target:p}),Re({from:'value',store:0,target:c}),Ie({priority:'barrier'}),Re({from:'value',store:1,target:c}),Re({store:p}),r&&Fe({fn:r}),Ce({store:se(d)})],h=p.before=[];return kt(a,(e,t)=>{if(!Y(e))return void(u[t]=i[t]=e);i[t]=e.defaultState,u[t]=e.getState();let a=ct(e,d,{scope:{key:t,clone:l},node:f,meta:{op:'combine'}}),n=se(e);h.push({type:'field',field:t,from:n}),s&&(s.plain.includes(n)||a.seq.unshift(s.loader))}),d.defaultShape=a,p.after=[r?{type:'map',to:se(d),fn:r}:{type:'copy',to:se(d)}],s||(d.defaultState=r?se(d).current=r(u):i),d})(Array.isArray(l),l,r,a)})(e);Ae({fn:(e,{state:t})=>void 0!==e&&e!==De(t)}),Fe({fn:e=>e}),'undefined'!=typeof performance&&performance.mark?(wt=e=>{performance.mark('☄️ '+e+' start')},xt=e=>{try{performance.measure('☄️ '+e,'☄️ '+e+' start')}catch(e){}performance.clearMarks('☄️ '+e+' start'),performance.clearMeasures('☄️ '+e)}):(wt=()=>{},xt=()=>{}),St='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 Rt='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Tt=0,Ct=0,Ft=null,At=null,qt=null,Nt=r();Nt.watch(({fns:e,element:t})=>{e.forEach(e=>{e(t)})}),e.h=(e,t)=>{function a(e){return e.data.block.value}function n(e,t,a){let n=e.data.block.child.child,r={type:'text',parent:{type:'FT',parent:n,child:null,visible:0,index:a},value:null};if(r.parent.child=r,n.child[a]=r.parent,e.hydration){let e=M(r);if(e)switch(e.type){case'text':r.value=p.document.createTextNode(t),e.value.after(r.value);break;case'element':r.value=e.value.nextSibling,C(r.value,t)}else{let e=N(r);r.value=e.firstChild,C(r.value,t)}r.parent.visible=1}else r.value=p.document.createTextNode(t),z(r);return r}let l,o=0,u=0;'function'==typeof t?(o=1,l=t):t&&(u=1,t.fn&&(o=1,l=t.fn),t.ɔ&&('function'==typeof t.ɔ?(o=1,l=t.ɔ):'function'==typeof t.ɔ.fn&&(o=1,l=t.ɔ.fn)));let p=qt.env,c=qt.namespace,d=c,m='html';d=m='svg'===c?'svg':'html','svg'===e&&(m='svg',d='svg');let g='svg'===m?p.document.createElementNS('http://www.w3.org/2000/svg',e):p.document.createElement(e);'foreignObject'===c?(g.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),d='html'):'svg'===e?(g.setAttribute('xmlns','http://www.w3.org/2000/svg'),d='svg'):'foreignObject'===e&&(d='foreignObject');let y=g,b={type:'element',tag:e,attr:[],data:[],text:[],styleProp:[],styleVar:[],handler:[],stencil:y,seq:[],childTemplates:[],childCount:0,inParentIndex:-1,opsAmount:1,node:[]},k=F({name:'element',draft:b,isSvgRoot:'svg'===e,namespace:d,fn(e,{mount:p,unmount:c}){function d(e){return J({mount:m,state:e,onMount:(e,t)=>({leaf:t,value:e}),onState:(e,t)=>({leaf:e,value:t})})}let m=r(),g=p.map(({leaf:e})=>e);o&&l(),u&&L(t);let w={attr:{},data:{},text:b.text,styleProp:{},styleVar:{},visible:b.visible||null,handler:b.handler};for(let e=0;e<b.attr.length;e++){let t=b.attr[e];for(let e in t)'xlink:href'===e?w.attr.href=t[e]:w.attr[e]=t[e]}for(let e=0;e<b.data.length;e++){let t=b.data[e];for(let e in t)w.data[e]=t[e]}for(let e=0;e<b.styleProp.length;e++){let t=b.styleProp[e];for(let e in t)e.startsWith('--')?w.styleVar[e.slice(2)]=t[e]:w.styleProp[e]=t[e]}for(let e=0;e<b.styleVar.length;e++){let t=b.styleVar[e];for(let e in t)w.styleVar[e]=t[e]}w.visible&&b.seq.push({type:'visible',value:w.visible});for(let e in w.attr){let t=w.attr[e];K(t)?b.seq.push({type:'attr',field:e,value:t}):T(y,e,t)}for(let e in w.data){let t=w.data[e];K(t)?b.seq.push({type:'data',field:e,value:t}):R(y,e,t)}for(let e in w.styleProp){let t=w.styleProp[e];K(t)?b.seq.push({type:'style',field:e,value:t}):I(y,e,t)}for(let e in w.styleVar){let t=w.styleVar[e];K(t)?b.seq.push({type:'styleVar',field:e,value:t}):S(y,e,t)}for(let e=0;e<w.text.length;e++){let t=w.text[e];if(null!==t.value)if(K(t.value)){b.seq.push({type:'dynamicText',value:t.value,childIndex:t.index});let e=t.value.stateRef,a=Ft;a.plain.includes(e)||a.closure.includes(e)||a.closure.push(e)}else b.seq.push({type:'staticText',value:String(t.value),childIndex:t.index})}for(let e=0;e<w.handler.length;e++){let t=w.handler[e];for(let e in t.map)b.seq.push({type:'handler',for:e,handler:t.map[e],options:t.options,domConfig:t.domConfig})}if(w.visible){let{onMount:e,onState:t}=J({mount:g,state:w.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,r=n.block;if(a&&(f(t,n.ops.visible),t)){let e,t=O(r);if(e=t?t.nextSibling:N(r).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}r.value=e,r.parent.visible=1}V(b,{parentBlockFragment:r.child.child,leaf:e,node:r.value,svgRoot:k.isSvgRoot?r.value:null}),t&&n.needToCallNode&&(n.needToCallNode=0,Ye({target:Nt,params:{element:n.block.value,fns:b.node},page:e.spawn,defer:1})),Ye({target:m,params:e,defer:1,page:e.spawn})}),s([t,e]).watch(({leaf:e,value:t,hydration:a})=>{a||h(t,e.data.ops.visible)})}for(let e=0;e<b.seq.length;e++){let t=b.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:l}=d(t.value);if(n)s([l,r]).watch(({leaf:t,value:n})=>{T(a(t),e,n)});else{let t=b.opsAmount++;r.watch(({value:n,leaf:r})=>{let l=a(r),o=v({value:n,priority:'props',runOp(t){T(l,e,t)},group:r.ops.group});r.ops.group.ops[t]=o,T(l,e,n)}),l.watch(({value:e,leaf:a})=>{h(e,a.ops.group.ops[t])})}break}case'data':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),l=b.opsAmount++;n.watch(({value:t,leaf:n})=>{let r=a(n),o=v({value:t,priority:'props',runOp(t){R(r,e,t)},group:n.ops.group});n.ops.group.ops[l]=o,R(r,e,t)}),r.watch(({value:e,leaf:t})=>{h(e,t.ops.group.ops[l])});break}case'style':{let e=b.opsAmount++,{field:n}=t,{onMount:r,onState:l}=d(t.value);r.watch(({value:t,leaf:r})=>{let l=a(r),o=v({value:t,priority:'props',runOp(e){I(l,n,e)},group:r.ops.group});r.ops.group.ops[e]=o,I(l,n,t)}),l.watch(({value:t,leaf:a})=>{h(t,a.ops.group.ops[e])});break}case'styleVar':{let{field:e}=t,{onMount:n,onState:r}=d(t.value),l=b.opsAmount++;n.watch(({value:t,leaf:n})=>{let r=a(n),o=v({value:t,priority:'props',runOp(t){S(r,e,t)},group:n.ops.group});n.ops.group.ops[l]=o,S(r,e,t)}),r.watch(({value:e,leaf:t})=>{h(e,t.ops.group.ops[l])});break}case'staticText':m.map(e=>e).watch(e=>{n(e,t.value,t.childIndex)});break;case'dynamicText':{let e=b.opsAmount++;i({source:t.value,clock:m,fn:(e,t)=>({value:String(e),leaf:t}),greedy:1}).watch(({value:a,leaf:r})=>{let l=v({value:a,priority:'props',runOp(e){C(o.value,e)},group:r.ops.group});r.ops.group.ops[e]=l;let o=n(r,a,t.childIndex)}),i({source:m,clock:t.value,fn:(e,t)=>({leaf:e,text:t}),greedy:1}).watch(({leaf:t,text:a})=>{h(a,t.ops.group.ops[e])});break}case'handler':{let e=t.handler.graphite.meta.nativeTemplate||null;m.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(),Ye({target:t.handler,params:e,page:r})},t.domConfig)});break}}}i({source:g,clock:c,greedy:1}).watch(e=>{let{spawn:t}=e;H(t,t.parent.childSpawns[t.template.id]),function e(t){t.active=0,H(t,t.template.pages);for(let a in t.childSpawns)t.childSpawns[a].forEach(e)}(t),h(0,e.data.ops.visible)}),p.watch(({leaf:e})=>{let t=e.data;if(!b.visible){let a=t.ops.visible,n=t.block;if(e.hydration){f(1,a);let e,t=O(n);if(e=t?t.nextSibling:N(n).firstChild,'#text'===e.nodeName){let t=e;e=e.nextSibling,t.remove()}n.value=e,n.parent.visible=1}V(b,{parentBlockFragment:n.child.child,leaf:e,node:n.value,svgRoot:k.isSvgRoot?n.value:null}),Ye({target:m,params:e,defer:1,page:e.spawn}),e.hydration?t.needToCallNode&&(t.needToCallNode=0,Ye({target:Nt,params:{element:t.block.value,fns:b.node},page:e.spawn,defer:1})):h(1,a)}})},env:p});W(k)},e.handler=U,e.list=$,e.node=e=>{let t=qt.draft;switch(t.type){case'list':case'listItem':case'using':case'route':case'rec':case'recItem':return}t.node.push(e)},e.rec=G,e.remap=j,e.route=_,e.spec=L,e.text=(e,...t)=>{let a=[e[0]];for(let n=0;n<t.length;n++)a.push(t[n],e[n+1]);L({text:a})},e.tree=({source:e,child:t,fn:a})=>{let n=G(({state:e})=>{$({source:e,fn({store:e}){let r=e.map(e=>e[t]||[]);a({store:e,child(){n({state:r})}})}})});n({state:e})},e.using=(e,t)=>{let a,n,r,l,o;'function'==typeof t?(a=t,r=B(),l=0):(a=t.fn,r=t.env?t.env:B(),l=t.hydrate,n=t.onComplete,o=t.onRoot);let i=e.namespaceURI,s=e.tagName.toLowerCase(),u={type:'using',childTemplates:[],childCount:0,inParentIndex:-1},p=F({name:'using',draft:u,isSvgRoot:'svg'===s,namespace:'http://www.w3.org/2000/svg'===i?'svg':'foreignobject'===s?'foreignObject':'html',fn(e,{mount:t}){a(),t.watch(({node:e,leaf:t})=>{V(u,{parentBlockFragment:t.data.block.child.child,leaf:t,node:e})})},env:r}),c={type:'using',child:{type:'UF',parent:null,child:{type:'fragment',parent:null,child:[]}},value:e};c.child.parent=c,c.child.child.parent=c.child;let d=g({onComplete:n}),f=q(p,{parentLeaf:At||null,mountNode:e,svgRoot:p.isSvgRoot?e:At?At.svgRoot:null,leafData:{type:'using',draft:u,element:e,block:c},opGroup:y(d),domSubtree:y(d),hydration:l});o&&o({template:p,leaf:f})},e.variant=({source:e,cases:t,key:a})=>{let n='function'==typeof a?a:e=>String(e[a]),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})});
//# sourceMappingURL=forest.umd.js.map
{
"name": "forest",
"version": "0.16.2",
"version": "0.16.3",
"description": "UI engine for web",

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

"peerDependencies": {
"effector": "^20.15.9"
"effector": "^20.16.1"
},

@@ -15,0 +15,0 @@ "keywords": [

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

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

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