effector-dom
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -1,2 +0,2 @@ | ||
function e(e,t){const n=H(e);for(let e=0;e<t.length;e++){const s=H(t[e]);s.family.type='crosslink';const l=J(s),r=K(n);l.includes(n)||l.push(n),r.includes(s)||r.push(s)}}function t(e,t){n(e,t),s(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function s(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function l(){const e={stack:null},t=Z.get(),n=effector.createNode({node:[ee,te],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function r(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(ne,'')}}function i(e){return String(e).replace(se,'')}function o({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=oe.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function a(e,t){t.parent=e,t.signal.seq.push(ae),t.signal.scope.stack=t,e.child.push(t)}function c(e,t){return effector.createNode({node:[ce],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function p(){me=0,he()}function f(e,t,n){const s=(e=>'high'===Ee.get(e)?we:xe)(e);let l=s.get(e);if(l||(l=[],s.set(e,l)),t)for(let e=0;e<n.length;e++)l.push(n[e]);else l.push(n);ve()}function u(t,n,s=0,l="low"){const r=++Se,i=effector.createEvent(),o=effector.is.store(a=t)?a.updates:a;var a;const c={type:'crosslink',owners:[o,i]};return effector.createNode({node:[$e],parent:[o],scope:{taskID:r,flat:s},family:c}),e(t,[i]),ke.set(r,effector.createNode({node:[Ae],child:[effector.createNode({node:[Re,_e,Oe],scope:{taskID:r},family:c}),effector.createNode({node:[Ie,_e],child:[i],family:c})],scope:{fn:n},family:c})),Ee.set(r,l),i}function h({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:r=1/0,mark:i=e.shortName}){const o=u(e.map(e=>[{inserted:ue(),retry:0,value:e}]),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const r=e[i],p=ue();if(r.inserted+l>p){c.push(r);continue}if(r.inserted+s<p)continue;if(p-n>=10){o=1;break}const f=t(r.value);void 0!==f&&a.push(f)}if(o)for(let t=i;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=r||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:o,connect:t=>{effector.createNode({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function d({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:r=1/0,mark:i=e.shortName,flatten:o}){const a=u(e.map(e=>{const t=[],n=ue();for(let s=0;s<e.length;s++){const l=o(e[s]);for(let e=0;e<l.length;e++)t.push({inserted:n,retry:0,value:l[e]})}return t}),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const r=e[i],p=ue();if(r.inserted+l>p){c.push(r);continue}if(r.inserted+s<p)continue;if(p-n>=10){o=1;break}const f=t(r.value);void 0!==f&&a.push(f)}if(o)for(let t=i;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=r||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[Pe],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function g(e,t,n){c(e,t.watch(n))}function m(e,t,n){effector.createNode({node:[De],parent:t,child:[Ve],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ve,{data:t.getState(),handler:n},1)}function b(e,t,n,s){effector.is.unit(n)?(e?g:m)(t,n,s):s(n)}function y(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=y(t);if(s)return s}return null}function v(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=y(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=y(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function k(e){return''!==e&&0!==e&&(0==e||null==e)}function w(e,t,n){k(n)?delete e[t]:e[t]=`${n}`}function x(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=v(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function E(e,t,n){if(null===n)return;const s=Z.get().parent.targetElement;m(t,n,x.bind(null,e,s,Z.get()))}function S(e,t,n){if(k(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function N(e,t,n,s,l,r){const i=e.createSVGTransform();switch(r){case'translate':case'scale':s=(e=>effector.is.store(e)?e:effector.is.store(e.x)?effector.is.store(e.y)?effector.combine({x:e.x,y:e.y}):e.x.map(Me.bind(null,e.y)):effector.is.store(e.y)?e.y.map(ze.bind(null,e.x)):e)(s)}b(0,t,s,l.bind(null,i)),n.appendItem(i)}function C(e,t){const n=oe.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function I(e){e.focus()}function R(e){e.blur()}function _(e,t){return e.bind(null,t)}function O(t,n){const s=Z.get();if(Array.isArray(n)){const l=[];for(let e=0;e<n.length;e++)l[e]=t.map(_($,n[e]));return s&&e(s.signal,l),l}if('object'==typeof n&&null!==n){const l=[],r={};for(const e in n)r[e]=t.map(_($,n[e])),l.push(r[e]);return s&&e(s.signal,l),r}const l=t.map(_($,n));return s&&e(s.signal,l),l}function $(e,t){return t[e]}function A(t,n=(()=>{})){let s;n=t.fn?t.fn:n;let r,i=0;effector.is.store(t)?(r=Xe,s=t):(r=_(Ye,t.key),s=t.source,i=!!t.reverse);const o=Z.get(),p=l(),f={parent:o,signal:p,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:i,key:effector.is.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial',visible:1};a(o,f),Z.replace(f);const u={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:i,parentStack:f,getID:r,fields:t.fields?t.fields:null,visible:t.visible?t.visible:null},h=effector.createStore(P(u,[],s.getState()));e(p,[h]),c(p,_(Ue,h)),effector.sample({source:h,clock:s,fn:_(P,u),target:h}),Z.replace(o)}function P(r,i,o){const c=Array(o.length).fill(0),p=o.map(r.getID),f=[],u=[],h=[];for(let e=0;e<i.length;e++){const t=i[e],n=t.node,s=p.indexOf(n.key);-1!==s?(u.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch({target:n.store,params:o[s],defer:1})):h.push(t)}if(h.length>0){for(let e=0;e<h.length;e++){const l=h[e],{node:r,locality:i}=l;r.active=0,r.store=null,t(i.sibling.left.ref,i.sibling.right.ref),n(l,null),s(l,null)}effector.launch({target:Ge,params:h,defer:1})}let d=u.length>0?u[u.length-1]:null;for(let n=0;n<o.length;n++){if(c[n])continue;const s=o[n],i=effector.createStore(s),p=l(),h=r.fields?O(i,r.fields):null;e(p,[i]);const g=r.getID(s,n),m={parent:r.parentStack,signal:p,namespace:r.parentStack.namespace,targetElement:r.parentStack.targetElement,svgRoot:r.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:i,signal:p,active:1,nodes:[],fields:h,visible:r.visible?[i.map(r.visible)]:[]},mountStatus:'initial',visible:1};t(d,m),d=m,a(r.parentStack,m),f.push(m),u.push(m)}return f.length>0&&effector.launch({target:We,params:{context:r,list:f},defer:1}),u}function D(e,t,n,s){const l=v(e);l&&s.contains(l.targetElement)?n?l.targetElement.before(t):l.targetElement.after(t):s.appendChild(t)}function V(t){const n=Z.get();return n&&e(n.signal,[t]),t}function j(e){const t=Z.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function T(e){const t=Z.get();t.targetElement.__STATIC__||e(t.targetElement)}function F(e){e.attr&&M(e.attr),e.data&&z(e.data),e.transform&&L(e.transform),'text'in e&&q(e.text),'visible'in e&&W(e.visible),(e.style||e.styleVar)&&X({prop:e.style,val:e.styleVar}),e.focus&&G(e.focus),e.handler&&Y(e.handler)}function M(e){j('attr'),Z.getElementNode().attr.push(e)}function z(e){j('data'),Z.getElementNode().data.push(e)}function L(e){j('transform'),Z.getElementNode().transform.push(e)}function q(e){j('text'),Z.getElementNode().text.push(e)}function W(e){const t=Z.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);Z.getElementNode().visible.push(e)}function X({prop:e,val:t}){j('style'),e&&Z.getElementNode().styleProp.push(e),t&&Z.getElementNode().styleVar.push(t)}function Y(e,t){j('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0,prevent:l=0,stop:r=0}=e;Z.getElementNode().handler.push({options:{passive:n,capture:s,prevent:l,stop:r},map:t})}function G({focus:e,blur:t}){j('focus');const n=Z.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const U=[];let B;const Z={get:()=>B,replace(e){B=e},getElementNode:()=>B.node},H=e=>e.graphite||e,J=e=>e.family.owners,K=e=>e.family.links,Q=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),ee=effector.step.compute({fn(e,l){l.self.next.push(Q);const{stack:r}=l,{parent:i}=r,{left:o,right:a}=r.locality.sibling;i&&(i.locality.child.last.ref===r&&(i.locality.child.last.ref=o.ref),i.locality.child.first.ref===r&&(i.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===r&&a.ref&&a.ref.locality.sibling.left.ref===r?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===r?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===r&&s(a.ref,null)}}),te=effector.step.compute({fn:(e,{self:t})=>t}),ne=/[^a-zA-Z0-9\-]/g,se=/[\\<>"]/g;class le{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[r(e)]=i(t)}removeProperty(e){delete this.properties[r(e)]}}class re{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ie{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new le,this.firstChild=null,this.transform={baseVal:new re},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[r(e)]=i(t)}removeAttribute(e){delete this.attributes[r(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new ie}}).isBody=1;let oe='undefined'!=typeof document?document:null;const ae=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),ce=effector.step.run({fn(e,{fn:t}){t(e)}});let pe,fe,ue;pe=()=>{},fe=()=>{},ue='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const he=effector.createEvent();let de,ge=0,me=0;const be='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),ye='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,ve=()=>{me||(me=1,de=be(p))},ke=new Map,we=new Map,xe=new Map,Ee=new Map;let Se=0,Ne=0;const Ce=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===we.size&&0===xe.size?0:ue()-Ne>=10?0:(ye(de),ge=1,me=0,1)})],child:[he]});he.watch(()=>{if(me)return;if(0===we.size&&0===xe.size)return void(ge=0);let e=0;ge||(Ne=ue()),ge=0;for(const[t,n]of we){if(ue()-Ne>=10){ve(),e=1;break}we.delete(t),effector.launch({target:ke.get(t),params:n,defer:1})}if(!e)for(const[t,n]of xe){if(ue()-Ne>=10){ve(),e=1;break}xe.delete(t),effector.launch({target:ke.get(t),params:n,defer:1})}effector.launch({target:Ce,params:null,defer:1})});const Ie=effector.step.compute({fn:({done:e})=>e}),Re=effector.step.compute({fn:({fail:e})=>e}),_e=effector.step.filter({fn:e=>e.length>0}),Oe=effector.step.compute({fn(e,{taskID:t}){f(t,1,e)}}),$e=effector.step.compute({fn(e,{taskID:t,flat:n}){f(t,n,e)}}),Ae=effector.step.run({fn:(e,{fn:t})=>t(e,Ne)}),Pe=effector.step.compute({fn:e=>[e]}),De=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ve}=h({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),je=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Te=(e,t,n)=>{k(n)?delete e[t]:e[t]=n},Fe=(e,t,n)=>{k(n)?e.removeProperty(t):e.setProperty(t,n)},Me=(e,t)=>({x:t,y:e}),ze=(e,t)=>({x:e,y:t}),Le={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:qe}=h({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=oe.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);D(n.listItemStack,s,e.reverse,e.node)}}}),{trigger:We}=h({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:r}=e,i=Z.get();Z.replace(n);const o=[],a=[];U.push({node:s,append:a,reverse:r});for(let e=0;e<t.length;e++){const n=t[e],i=n.node;if(i.active){Z.replace(n),effector.withRegion(n.signal,_(l,i));for(let e=0;e<a.length;e++)i.nodes.push(a[e]);i.visible.length>0?effector.withRegion(n.signal,()=>{const e=i.visible[i.visible.length-1];e.updates.watch(e=>{if(0!=i.active)if(e){const e=oe.createDocumentFragment();if(r)for(let t=i.nodes.length-1;t>=0;t--)e.appendChild(i.nodes[t]);else for(let t=0;t<i.nodes.length;t++)e.appendChild(i.nodes[t]);D(n,e,r,s)}else for(let e=0;e<i.nodes.length;e++)i.nodes[e].remove()}),e.getState()&&o.push({listItemStack:n,appended:a.slice(),listItem:i})}):o.push({listItemStack:n,appended:a.slice(),listItem:i}),a.length=0}}U.pop(),o.length>0&&effector.launch({target:qe,params:{node:s,append:o,reverse:r},defer:1}),Z.replace(i)}}),Xe=(e,t)=>t,Ye=(e,t)=>t[e],Ge=effector.createEvent();d({trigger:Ge,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch({target:e,params:null,defer:0})}}),d({trigger:Ge,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const Ue=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch({target:Ge,params:t,defer:1})};exports.attr=M,exports.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),V(effector.combine(e,t))),exports.data=z,exports.explicitUnmount=e=>{const t=Z.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=G,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,r=Z.get(),i=r?r.namespace:'html';let p=i,f='html';'type'in t?(f=t.type,p=t.type):p=f='svg'===i?'svg':'html','svg'===e&&(f='svg',p='svg');const u='svg'===f?oe.createElementNS('http://www.w3.org/2000/svg',e):oe.createElement(e);'foreignObject'===i?(u.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),p='html'):'svg'===e?(u.setAttribute('xmlns','http://www.w3.org/2000/svg'),p='svg'):'foreignObject'===e&&(p='foreignObject');const h=l(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:h,namespace:p,targetElement:u,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};r&&a(r,g),'svg'===e?g.svgRoot=u:r&&(g.svgRoot=r.svgRoot),Z.replace(g),n?((e,t,n,s)=>{let l=0;U.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),l=1}finally{o(U.pop()),l||Z.replace(n)}})(h,u,r,n):(d.pure=1,F(t));const y=(()=>{const e=(()=>{const e=Z.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:s,map:l}=e.handler[n];s.passive=s.prevent?0:s.passive;for(const e in l){const t=l[e];l[e]=e=>{s.prevent&&e.preventDefault(),s.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:s,map:l})}for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=Z.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)b('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],S.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)b(0,t,n[s],w.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:l,map:r}=n[s];for(const t in r)e.addEventListener(t,r[t],l);c(t,je.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],Te.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],Fe.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=Z.get();if('svg'!==s.namespace)return;if(0===n.length)return;const l=e.transform.baseVal,r=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)N(r,t,l,s[e],Le[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?m(t,n,C.bind(null,e)):C(e,n))})(n,s,e.text),E(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],I.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],R.bind(null,e))})(n,s,e.blur),e})();Z.replace(r),g.visible=!y.visible||y.visible.getState(),s||U.length>0&&g.visible&&U[U.length-1].append.push(u)},exports.handler=Y,exports.list=A,exports.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),V(e.map(t))),exports.node=T,exports.nodeMethod=e=>{let t;return T(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=O,exports.signalOwn=V,exports.spec=F,exports.storeField=(t,n)=>{const s=t.map(_($,n)),l=Z.get();return l&&e(l.signal,[s]),s},exports.style=X,exports.text=q,exports.transform=L,exports.tree=function e({key:t,child:n,source:s},l){A({source:s,key:t},({store:s,key:r,signal:i})=>{const o=O(s,n);l({store:s,key:r,signal:i},()=>{e({key:t,child:n,source:o},l)})})},exports.using=(e,t)=>{const n=e.namespaceURI,s=e.tagName.toLowerCase(),r='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=Z.get(),a={parent:i,signal:i&&i.signal?i.signal:l(),namespace:r,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};Z.replace(a),U.push({node:e,append:[],reverse:0});try{effector.withRegion(a.signal,t)}finally{o(U.pop()),Z.replace(i)}},exports.variant=(e,t)=>{const n=effector.createStore(Object.entries(t).map(([e,t])=>({key:e,val:t}))),s=effector.combine(n,e,(e,t)=>e.map(e=>({key:e.key,val:e.val,visible:e.key===t})));A({source:s,key:'key',visible:({visible:e})=>e,fn({store:e}){e.getState().val()}})},exports.visible=W; | ||
function e(e,t){const n=Z(e);for(let e=0;e<t.length;e++){const s=Z(t[e]);s.family.type='crosslink';const r=H(s),i=J(n);r.includes(n)||r.push(n),i.includes(s)||i.push(s)}}function t(e,t){n(e,t),s(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function s(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function r(){const e={stack:null},t=B.get(),n=effector.createNode({node:[Q,ee],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function i(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(te,'')}}function l(e){return String(e).replace(ne,'')}function o({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=le.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function a(e,t){t.parent=e,t.signal.seq.push(oe),t.signal.scope.stack=t,e.child.push(t)}function c(e,t){return effector.createNode({node:[ae],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function f(){ge=0,ue()}function p(t,n,s){const r=++Ee,i=effector.createEvent(),l=effector.is.store(t)?t.updates:t,o={type:'crosslink',owners:[l,i]};return effector.createNode({node:[_e],parent:[l],scope:{taskID:r},family:o}),e(t,[i]),ye.set(r,effector.createNode({node:[Oe],child:[effector.createNode({node:[Ie,Re,_e],scope:{taskID:r},family:o}),effector.createNode({node:[Ce,Re],child:[i],family:o})],scope:{fn:n},family:o})),xe.set(r,s),i}function u({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName}){const o=e.map(e=>[{inserted:pe(),retry:0,value:e}]);return{trigger:e,processed:p(o,(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],f=pe();if(i.inserted+r>f){c.push(i);continue}if(i.inserted+s<f)continue;if(f-n>=10){o=1;break}const p=t(i.value);void 0!==p&&a.push(p)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function h({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName,flatten:o}){const a=e.map(e=>{const t=[],n=pe();for(let s=0;s<e.length;s++){const r=o(e[s]);for(let e=0;e<r.length;e++)t.push({inserted:n,retry:0,value:r[e]})}return t});return{trigger:e,processed:p(a,(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],f=pe();if(i.inserted+r>f){c.push(i);continue}if(i.inserted+s<f)continue;if(f-n>=10){o=1;break}const p=t(i.value);void 0!==p&&a.push(p)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function d(e,t,n){c(e,t.watch(n))}function g(e,t,n){effector.createNode({node:[$e],parent:t,child:[Ae],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ae,{data:t.getState(),handler:n},1)}function m(e,t,n,s){effector.is.unit(n)?(e?d:g)(t,n,s):s(n)}function b(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=b(t);if(s)return s}return null}function v(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=b(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=b(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function y(e){return''!==e&&0!==e&&(0==e||null==e)}function k(e,t,n){y(n)?delete e[t]:e[t]=`${n}`}function w(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=v(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function x(e,t,n){if(null===n)return;const s=B.get().parent.targetElement;g(t,n,w.bind(null,e,s,B.get()))}function E(e,t,n){if(y(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function S(e,t,n,s,r,i){const l=e.createSVGTransform();switch(i){case'translate':case'scale':s=(e=>effector.is.store(e)?e:effector.is.store(e.x)?effector.is.store(e.y)?effector.combine({x:e.x,y:e.y}):e.x.map(je.bind(null,e.y)):effector.is.store(e.y)?e.y.map(Te.bind(null,e.x)):e)(s)}m(0,t,s,r.bind(null,l)),n.appendItem(l)}function N(e,t){const n=le.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function C(e){e.focus()}function I(e){e.blur()}function R(e,t){return e.bind(null,t)}function _(t,n){const s=B.get();if(Array.isArray(n)){const r=[];for(let e=0;e<n.length;e++)r[e]=t.map(R(O,n[e]));return s&&e(s.signal,r),r}if('object'==typeof n&&null!==n){const r=[],i={};for(const e in n)i[e]=t.map(R(O,n[e])),r.push(i[e]);return s&&e(s.signal,r),i}const r=t.map(R(O,n));return s&&e(s.signal,r),r}function O(e,t){return t[e]}function $(t,n=(()=>{})){let s;n=t.fn?t.fn:n;let i,l=0;effector.is.store(t)?(i=Le,s=t):(i=R(qe,t.key),s=t.source,l=!!t.reverse);const o=B.get(),f=r(),p={parent:o,signal:f,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:l,key:effector.is.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial',visible:1};a(o,p),B.replace(p);const u={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:l,parentStack:p,getID:i,fields:t.fields?t.fields:null,visible:t.visible?t.visible:null},h=effector.createStore(A(u,[],s.getState()));e(f,[h]),c(f,R(Xe,h)),effector.sample({source:h,clock:s,fn:R(A,u),target:h}),B.replace(o)}function A(i,l,o){const c=Array(o.length).fill(0),f=o.map(i.getID),p=[],u=[],h=[];for(let e=0;e<l.length;e++){const t=l[e],n=t.node,s=f.indexOf(n.key);-1!==s?(u.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch({target:n.store,params:o[s],defer:1})):h.push(t)}if(h.length>0){for(let e=0;e<h.length;e++){const r=h[e],{node:i,locality:l}=r;i.active=0,i.store=null,t(l.sibling.left.ref,l.sibling.right.ref),n(r,null),s(r,null)}effector.launch({target:We,params:h,defer:1})}let d=u.length>0?u[u.length-1]:null;for(let n=0;n<o.length;n++){if(c[n])continue;const s=o[n],l=effector.createStore(s),f=r(),h=i.fields?_(l,i.fields):null;e(f,[l]);const g=i.getID(s,n),m={parent:i.parentStack,signal:f,namespace:i.parentStack.namespace,targetElement:i.parentStack.targetElement,svgRoot:i.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:l,signal:f,active:1,nodes:[],fields:h,visible:i.visible?[l.map(i.visible)]:[]},mountStatus:'initial',visible:1};t(d,m),d=m,a(i.parentStack,m),p.push(m),u.push(m)}return p.length>0&&effector.launch({target:ze,params:{context:i,list:p},defer:1}),u}function P(e,t,n,s){const r=v(e);r&&s.contains(r.targetElement)?n?r.targetElement.before(t):r.targetElement.after(t):s.appendChild(t)}function V(t){const n=B.get();return n&&e(n.signal,[t]),t}function D(e){const t=B.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function j(e){const t=B.get();t.targetElement.__STATIC__||e(t.targetElement)}function T(e){e.attr&&F(e.attr),e.data&&M(e.data),e.transform&&z(e.transform),'text'in e&&L(e.text),'visible'in e&&q(e.visible),(e.style||e.styleVar)&&W({prop:e.style,val:e.styleVar}),e.focus&&Y(e.focus),e.handler&&X(e.handler)}function F(e){D('attr'),B.getElementNode().attr.push(e)}function M(e){D('data'),B.getElementNode().data.push(e)}function z(e){D('transform'),B.getElementNode().transform.push(e)}function L(e){D('text'),B.getElementNode().text.push(e)}function q(e){const t=B.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);B.getElementNode().visible.push(e)}function W({prop:e,val:t}){D('style'),e&&B.getElementNode().styleProp.push(e),t&&B.getElementNode().styleVar.push(t)}function X(e,t){D('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0,prevent:r=0,stop:i=0}=e;B.getElementNode().handler.push({options:{passive:n,capture:s,prevent:r,stop:i},map:t})}function Y({focus:e,blur:t}){D('focus');const n=B.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const G=[];let U;const B={get:()=>U,replace(e){U=e},getElementNode:()=>U.node},Z=e=>e.graphite||e,H=e=>e.family.owners,J=e=>e.family.links,K=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),Q=effector.step.compute({fn(e,r){r.self.next.push(K);const{stack:i}=r,{parent:l}=i,{left:o,right:a}=i.locality.sibling;l&&(l.locality.child.last.ref===i&&(l.locality.child.last.ref=o.ref),l.locality.child.first.ref===i&&(l.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===i&&a.ref&&a.ref.locality.sibling.left.ref===i?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===i?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===i&&s(a.ref,null)}}),ee=effector.step.compute({fn:(e,{self:t})=>t}),te=/[^a-zA-Z0-9\-]/g,ne=/[\\<>"]/g;class se{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[i(e)]=l(t)}removeProperty(e){delete this.properties[i(e)]}}class re{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ie{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new se,this.firstChild=null,this.transform={baseVal:new re},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[i(e)]=l(t)}removeAttribute(e){delete this.attributes[i(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new ie}}).isBody=1;let le='undefined'!=typeof document?document:null;const oe=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),ae=effector.step.run({fn(e,{fn:t}){t(e)}});let ce,fe,pe;ce=()=>{},fe=()=>{},pe='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const ue=effector.createEvent();let he,de=0,ge=0;const me='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),be='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,ve=()=>{ge||(ge=1,he=me(f))},ye=new Map,ke=new Map,we=new Map,xe=new Map;let Ee=0,Se=0;const Ne=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===ke.size&&0===we.size?0:pe()-Se>=10?0:(be(he),de=1,ge=0,1)})],child:[ue]});ue.watch(()=>{if(ge)return;if(0===ke.size&&0===we.size)return void(de=0);let e=0;de||(Se=pe()),de=0;for(const[t,n]of ke){if(pe()-Se>=10){ve(),e=1;break}ke.delete(t),effector.launch({target:ye.get(t),params:n,defer:1})}if(!e)for(const[t,n]of we){if(pe()-Se>=10){ve(),e=1;break}we.delete(t),effector.launch({target:ye.get(t),params:n,defer:1})}effector.launch({target:Ne,params:null,defer:1})});const Ce=effector.step.compute({fn:({done:e})=>e}),Ie=effector.step.compute({fn:({fail:e})=>e}),Re=effector.step.filter({fn:e=>e.length>0}),_e=effector.step.compute({fn(e,{taskID:t}){const n='high'===xe.get(t)?ke:we;let s=n.get(t);s||(s=[],n.set(t,s));for(let t=0;t<e.length;t++)s.push(e[t]);ve()}}),Oe=effector.step.run({fn:(e,{fn:t})=>t(e,Se)}),$e=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ae}=u({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Pe=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Ve=(e,t,n)=>{y(n)?delete e[t]:e[t]=n},De=(e,t,n)=>{y(n)?e.removeProperty(t):e.setProperty(t,n)},je=(e,t)=>({x:t,y:e}),Te=(e,t)=>({x:e,y:t}),Fe={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Me}=u({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=le.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);P(n.listItemStack,s,e.reverse,e.node)}}}),{trigger:ze}=u({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:r,reverse:i}=e,l=B.get();B.replace(n);const o=[],a=[];G.push({node:s,append:a,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],l=n.node;if(l.active){B.replace(n),effector.withRegion(n.signal,R(r,l));for(let e=0;e<a.length;e++)l.nodes.push(a[e]);l.visible.length>0?effector.withRegion(n.signal,()=>{const e=l.visible[l.visible.length-1];e.updates.watch(e=>{if(0!=l.active)if(e){const e=le.createDocumentFragment();if(i)for(let t=l.nodes.length-1;t>=0;t--)e.appendChild(l.nodes[t]);else for(let t=0;t<l.nodes.length;t++)e.appendChild(l.nodes[t]);P(n,e,i,s)}else for(let e=0;e<l.nodes.length;e++)l.nodes[e].remove()}),e.getState()&&o.push({listItemStack:n,appended:a.slice(),listItem:l})}):o.push({listItemStack:n,appended:a.slice(),listItem:l}),a.length=0}}G.pop(),o.length>0&&effector.launch({target:Me,params:{node:s,append:o,reverse:i},defer:1}),B.replace(l)}}),Le=(e,t)=>t,qe=(e,t)=>t[e],We=effector.createEvent();h({trigger:We,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch({target:e,params:null,defer:0})}}),h({trigger:We,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const Xe=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch({target:We,params:t,defer:1})};exports.attr=F,exports.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),V(effector.combine(e,t))),exports.data=M,exports.explicitUnmount=e=>{const t=B.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=Y,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,i=B.get(),l=i?i.namespace:'html';let f=l,p='html';'type'in t?(p=t.type,f=t.type):f=p='svg'===l?'svg':'html','svg'===e&&(p='svg',f='svg');const u='svg'===p?le.createElementNS('http://www.w3.org/2000/svg',e):le.createElement(e);'foreignObject'===l?(u.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),f='html'):'svg'===e?(u.setAttribute('xmlns','http://www.w3.org/2000/svg'),f='svg'):'foreignObject'===e&&(f='foreignObject');const h=r(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},b={parent:null,signal:h,namespace:f,targetElement:u,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};i&&a(i,b),'svg'===e?b.svgRoot=u:i&&(b.svgRoot=i.svgRoot),B.replace(b),n?((e,t,n,s)=>{let r=0;G.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),r=1}finally{o(G.pop()),r||B.replace(n)}})(h,u,i,n):(d.pure=1,T(t));const v=(()=>{const e=(()=>{const e=B.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:s,map:r}=e.handler[n];s.passive=s.prevent?0:s.passive;for(const e in r){const t=r[e];r[e]=e=>{s.prevent&&e.preventDefault(),s.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:s,map:r})}for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)'xlink:href'===e?t.attr.href=s[e]:t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=B.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)m('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],E.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)m(0,t,n[s],k.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:r,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],r);c(t,Pe.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)m(0,t,n[e],Ve.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)m(0,t,n[e],De.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=B.get();if('svg'!==s.namespace)return;if(0===n.length)return;const r=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)S(i,t,r,s[e],Fe[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?g(t,n,N.bind(null,e)):N(e,n))})(n,s,e.text),x(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)m(1,t,n[s],C.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)m(1,t,n[s],I.bind(null,e))})(n,s,e.blur),e})();B.replace(i),b.visible=!v.visible||v.visible.getState(),s||G.length>0&&b.visible&&G[G.length-1].append.push(u)},exports.handler=X,exports.list=$,exports.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),V(e.map(t))),exports.node=j,exports.nodeMethod=e=>{let t;return j(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=_,exports.signalOwn=V,exports.spec=T,exports.storeField=(t,n)=>{const s=t.map(R(O,n)),r=B.get();return r&&e(r.signal,[s]),s},exports.style=W,exports.text=L,exports.transform=z,exports.tree=function e({key:t,child:n,source:s},r){$({source:s,key:t},({store:s,key:i,signal:l})=>{const o=_(s,n);r({store:s,key:i,signal:l},()=>{e({key:t,child:n,source:o},r)})})},exports.using=(e,t)=>{const n=e.namespaceURI,s=e.tagName.toLowerCase(),i='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',l=B.get(),a={parent:l,signal:l&&l.signal?l.signal:r(),namespace:i,targetElement:e,svgRoot:'svg'===s?e:l?l.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};B.replace(a),G.push({node:e,append:[],reverse:0});try{effector.withRegion(a.signal,t)}finally{o(G.pop()),B.replace(l)}},exports.variant=(e,t)=>{const n=effector.createStore(Object.entries(t).map(([e,t])=>({key:e,val:t}))),s=effector.combine(n,e,(e,t)=>e.map(e=>({key:e.key,val:e.val,visible:e.key===t})));$({source:s,key:'key',visible:({visible:e})=>e,fn({store:e}){e.getState().val()}})},exports.visible=q; | ||
//# sourceMappingURL=effector-dom.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,t){const n=ge(e);for(let e=0;e<t.length;e++){const s=ge(t[e]);s.family.type='crosslink';const l=me(s),i=be(n);l.includes(n)||l.push(n),i.includes(s)||i.push(s)}}function t(e,t){n(e,t),s(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function s(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function l(){const e={stack:null},t=de.get(),n=ne({node:[ve,ke],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function i(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(we,'')}}function r(e){return String(e).replace(xe,'')}function o(e,t){const n=e.namespaceURI,s=e.tagName.toLowerCase(),i='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',r=de.get(),o={parent:r,signal:r&&r.signal?r.signal:l(),namespace:i,targetElement:e,svgRoot:'svg'===s?e:r?r.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};de.replace(o),pe.push({node:e,append:[],reverse:0});try{ie(o.signal,t)}finally{a(pe.pop()),de.replace(r)}}function a({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=Ie.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function c(e,t){t.parent=e,t.signal.seq.push(Ne),t.signal.scope.stack=t,e.child.push(t)}function f(e,t){return ne({node:[_e],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function u(){Ve=0,Re()}function p(e,t,n){const s=(e=>'high'===We.get(e)?ze:Le)(e);let l=s.get(e);if(l||(l=[],s.set(e,l)),t)for(let e=0;e<n.length;e++)l.push(n[e]);else l.push(n);Fe()}function h(t,n,s=0,l="low"){const i=++Xe,r=re(),o=ae.store(a=t)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return ne({node:[He],parent:[o],scope:{taskID:i,flat:s},family:c}),e(t,[r]),Me.set(i,ne({node:[Je],child:[ne({node:[Be,Ue,Ze],scope:{taskID:i},family:c}),ne({node:[Ge,Ue],child:[r],family:c})],scope:{fn:n},family:c})),We.set(i,l),r}function d({trigger:e=re(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName}){const o=h(e.map(e=>[{inserted:Oe(),retry:0,value:e}]),(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const i=e[r],f=Oe();if(i.inserted+l>f){c.push(i);continue}if(i.inserted+s<f)continue;if(f-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:o,connect:t=>{ne({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function g({trigger:e=re(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName,flatten:o}){const a=h(e.map(e=>{const t=[],n=Oe();for(let s=0;s<e.length;s++){const l=o(e[s]);for(let e=0;e<l.length;e++)t.push({inserted:n,retry:0,value:l[e]})}return t}),(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const i=e[r],f=Oe();if(i.inserted+l>f){c.push(i);continue}if(i.inserted+s<f)continue;if(f-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{ne({node:[Ke],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function m(e,t,n){f(e,t.watch(n))}function b(e,t,n){ne({node:[Qe],parent:t,child:[et],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),ae.store(t)&&oe(et,{data:t.getState(),handler:n},1)}function y(e,t,n,s){ae.unit(n)?(e?m:b)(t,n,s):s(n)}function v(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=v(t);if(s)return s}return null}function k(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=v(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=v(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function w(e){return''!==e&&0!==e&&(0==e||null==e)}function x(e,t,n){w(n)?delete e[t]:e[t]=`${n}`}function S(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=k(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function E(e,t,n){if(null===n)return;const s=de.get().parent.targetElement;b(t,n,S.bind(null,e,s,de.get()))}function C(e,t,n){if(w(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function I(e,t,n,s,l,i){const r=e.createSVGTransform();switch(i){case'translate':case'scale':s=(e=>ae.store(e)?e:ae.store(e.x)?ae.store(e.y)?ce({x:e.x,y:e.y}):e.x.map(lt.bind(null,e.y)):ae.store(e.y)?e.y.map(rt.bind(null,e.x)):e)(s)}y(0,t,s,l.bind(null,r)),n.appendItem(r)}function N(e,t){const n=Ie.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function _(e){e.focus()}function $(e){e.blur()}function A(e,t,n){'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,i=de.get(),r=i?i.namespace:'html';let o=r,u='html';'type'in t?(u=t.type,o=t.type):o=u='svg'===r?'svg':'html','svg'===e&&(u='svg',o='svg');const p='svg'===u?Ie.createElementNS('http://www.w3.org/2000/svg',e):Ie.createElement(e);'foreignObject'===r?(p.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===e?(p.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===e&&(o='foreignObject');const h=l(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:h,namespace:o,targetElement:p,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};i&&c(i,g),'svg'===e?g.svgRoot=p:i&&(g.svgRoot=i.svgRoot),de.replace(g),n?((e,t,n,s)=>{let l=0;pe.push({node:t,append:[],reverse:0});try{ie(e,s),l=1}finally{a(pe.pop()),l||de.replace(n)}})(h,p,i,n):(d.pure=1,Y(t));const m=(()=>{const e=(()=>{const e=de.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:s,map:l}=e.handler[n];s.passive=s.prevent?0:s.passive;for(const e in l){const t=l[e];l[e]=e=>{s.prevent&&e.preventDefault(),s.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:s,map:l})}for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=de.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)y('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],C.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)y(0,t,n[s],x.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:l,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],l);f(t,tt.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)y(0,t,n[e],nt.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)y(0,t,n[e],st.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=de.get();if('svg'!==s.namespace)return;if(0===n.length)return;const l=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)I(i,t,l,s[e],ot[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(ae.unit(n)?b(t,n,N.bind(null,e)):N(e,n))})(n,s,e.text),E(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)y(1,t,n[s],_.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)y(1,t,n[s],$.bind(null,e))})(n,s,e.blur),e})();de.replace(i),g.visible=!m.visible||m.visible.getState(),s||pe.length>0&&g.visible&&pe[pe.length-1].append.push(p)}function O(e,t){return e.bind(null,t)}function R(t,n){const s=de.get();if(Array.isArray(n)){const l=[];for(let e=0;e<n.length;e++)l[e]=t.map(O(P,n[e]));return s&&e(s.signal,l),l}if('object'==typeof n&&null!==n){const l=[],i={};for(const e in n)i[e]=t.map(O(P,n[e])),l.push(i[e]);return s&&e(s.signal,l),i}const l=t.map(O(P,n));return s&&e(s.signal,l),l}function D(t,n){const s=t.map(O(P,n)),l=de.get();return l&&e(l.signal,[s]),s}function P(e,t){return t[e]}function V({key:e,child:t,source:n},s){T({source:n,key:e},({store:n,key:l,signal:i})=>{const r=R(n,t);s({store:n,key:l,signal:i},()=>{V({key:e,child:t,source:r},s)})})}function T(t,n=(()=>{})){let s;n=t.fn?t.fn:n;let i,r=0;ae.store(t)?(i=ft,s=t):(i=O(ut,t.key),s=t.source,r=!!t.reverse);const o=de.get(),a=l(),u={parent:o,signal:a,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:ae.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial',visible:1};c(o,u),de.replace(u);const p={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:r,parentStack:u,getID:i,fields:t.fields?t.fields:null,visible:t.visible?t.visible:null},h=fe(j(p,[],s.getState()));e(a,[h]),f(a,O(ht,h)),ue({source:h,clock:s,fn:O(j,p),target:h}),de.replace(o)}function j(i,r,o){const a=Array(o.length).fill(0),f=o.map(i.getID),u=[],p=[],h=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.node,s=f.indexOf(n.key);-1!==s?(p.push(t),a[s]=1,n.store.getState()!==o[s]&&oe({target:n.store,params:o[s],defer:1})):h.push(t)}if(h.length>0){for(let e=0;e<h.length;e++){const l=h[e],{node:i,locality:r}=l;i.active=0,i.store=null,t(r.sibling.left.ref,r.sibling.right.ref),n(l,null),s(l,null)}oe({target:pt,params:h,defer:1})}let d=p.length>0?p[p.length-1]:null;for(let n=0;n<o.length;n++){if(a[n])continue;const s=o[n],r=fe(s),f=l(),h=i.fields?R(r,i.fields):null;e(f,[r]);const g=i.getID(s,n),m={parent:i.parentStack,signal:f,namespace:i.parentStack.namespace,targetElement:i.parentStack.targetElement,svgRoot:i.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:r,signal:f,active:1,nodes:[],fields:h,visible:i.visible?[r.map(i.visible)]:[]},mountStatus:'initial',visible:1};t(d,m),d=m,c(i.parentStack,m),u.push(m),p.push(m)}return u.length>0&&oe({target:ct,params:{context:i,list:u},defer:1}),p}function F(e,t,n,s){const l=k(e);l&&s.contains(l.targetElement)?n?l.targetElement.before(t):l.targetElement.after(t):s.appendChild(t)}function M(e){const t=de.get();t&&ne({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})}function z(t){const n=de.get();return n&&e(n.signal,[t]),t}function L(e){const t=de.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function W(e){let t;return X(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}}function X(e){const t=de.get();t.targetElement.__STATIC__||e(t.targetElement)}function Y(e){e.attr&&q(e.attr),e.data&&G(e.data),e.transform&&B(e.transform),'text'in e&&U(e.text),'visible'in e&&Z(e.visible),(e.style||e.styleVar)&&H({prop:e.style,val:e.styleVar}),e.focus&&K(e.focus),e.handler&&J(e.handler)}function q(e){L('attr'),de.getElementNode().attr.push(e)}function G(e){L('data'),de.getElementNode().data.push(e)}function B(e){L('transform'),de.getElementNode().transform.push(e)}function U(e){L('text'),de.getElementNode().text.push(e)}function Z(e){const t=de.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);de.getElementNode().visible.push(e)}function H({prop:e,val:t}){L('style'),e&&de.getElementNode().styleProp.push(e),t&&de.getElementNode().styleVar.push(t)}function J(e,t){L('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0,prevent:l=0,stop:i=0}=e;de.getElementNode().handler.push({options:{passive:n,capture:s,prevent:l,stop:i},map:t})}function K({focus:e,blur:t}){L('focus');const n=de.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}function Q(e,{fn:t}){return console.error('separate map method is deprecated, use store.map as usual'),z(e.map(t))}function ee({source:e,fn:t}){return console.error('separate combine method is deprecated, use common combine method as usual'),z(ce(e,t))}function te(e,t){const n=fe(Object.entries(t).map(([e,t])=>({key:e,val:t}))),s=ce(n,e,(e,t)=>e.map(e=>({key:e.key,val:e.val,visible:e.key===t})));T({source:s,key:'key',visible:({visible:e})=>e,fn({store:e}){e.getState().val()}})}import{createNode as ne,step as se,clearNode as le,withRegion as ie,createEvent as re,launch as oe,is as ae,combine as ce,createStore as fe,sample as ue}from'effector';const pe=[];let he;const de={get:()=>he,replace(e){he=e},getElementNode:()=>he.node},ge=e=>e.graphite||e,me=e=>e.family.owners,be=e=>e.family.links,ye=ne({node:[se.run({fn(e){le(e)}})]}),ve=se.compute({fn(e,l){l.self.next.push(ye);const{stack:i}=l,{parent:r}=i,{left:o,right:a}=i.locality.sibling;r&&(r.locality.child.last.ref===i&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===i&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===i&&a.ref&&a.ref.locality.sibling.left.ref===i?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===i?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===i&&s(a.ref,null)}}),ke=se.compute({fn:(e,{self:t})=>t}),we=/[^a-zA-Z0-9\-]/g,xe=/[\\<>"]/g;class Se{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[i(e)]=r(t)}removeProperty(e){delete this.properties[i(e)]}}class Ee{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class Ce{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new Se,this.firstChild=null,this.transform={baseVal:new Ee},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[i(e)]=r(t)}removeAttribute(e){delete this.attributes[i(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new Ce}}).isBody=1;let Ie='undefined'!=typeof document?document:null;const Ne=se.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),_e=se.run({fn(e,{fn:t}){t(e)}});let $e,Ae,Oe;$e=()=>{},Ae=()=>{},Oe='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const Re=re();let De,Pe=0,Ve=0;const Te='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),je='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Fe=()=>{Ve||(Ve=1,De=Te(u))},Me=new Map,ze=new Map,Le=new Map,We=new Map;let Xe=0,Ye=0;const qe=ne({node:[se.run({fn:()=>{}}),se.filter({fn:()=>0===ze.size&&0===Le.size?0:Oe()-Ye>=10?0:(je(De),Pe=1,Ve=0,1)})],child:[Re]});Re.watch(()=>{if(Ve)return;if(0===ze.size&&0===Le.size)return void(Pe=0);let e=0;Pe||(Ye=Oe()),Pe=0;for(const[t,n]of ze){if(Oe()-Ye>=10){Fe(),e=1;break}ze.delete(t),oe({target:Me.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Le){if(Oe()-Ye>=10){Fe(),e=1;break}Le.delete(t),oe({target:Me.get(t),params:n,defer:1})}oe({target:qe,params:null,defer:1})});const Ge=se.compute({fn:({done:e})=>e}),Be=se.compute({fn:({fail:e})=>e}),Ue=se.filter({fn:e=>e.length>0}),Ze=se.compute({fn(e,{taskID:t}){p(t,1,e)}}),He=se.compute({fn(e,{taskID:t,flat:n}){p(t,n,e)}}),Je=se.run({fn:(e,{fn:t})=>t(e,Ye)}),Ke=se.compute({fn:e=>[e]}),Qe=se.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:et}=d({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),tt=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},nt=(e,t,n)=>{w(n)?delete e[t]:e[t]=n},st=(e,t,n)=>{w(n)?e.removeProperty(t):e.setProperty(t,n)},lt=(e,t)=>({x:t,y:e}),rt=(e,t)=>({x:e,y:t}),ot={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:at}=d({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=Ie.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);F(n.listItemStack,s,e.reverse,e.node)}}}),{trigger:ct}=d({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:i}=e,r=de.get();de.replace(n);const o=[],a=[];pe.push({node:s,append:a,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],r=n.node;if(r.active){de.replace(n),ie(n.signal,O(l,r));for(let e=0;e<a.length;e++)r.nodes.push(a[e]);r.visible.length>0?ie(n.signal,()=>{const e=r.visible[r.visible.length-1];e.updates.watch(e=>{if(0!=r.active)if(e){const e=Ie.createDocumentFragment();if(i)for(let t=r.nodes.length-1;t>=0;t--)e.appendChild(r.nodes[t]);else for(let t=0;t<r.nodes.length;t++)e.appendChild(r.nodes[t]);F(n,e,i,s)}else for(let e=0;e<r.nodes.length;e++)r.nodes[e].remove()}),e.getState()&&o.push({listItemStack:n,appended:a.slice(),listItem:r})}):o.push({listItemStack:n,appended:a.slice(),listItem:r}),a.length=0}}pe.pop(),o.length>0&&oe({target:at,params:{node:s,append:o,reverse:i},defer:1}),de.replace(r)}}),ft=(e,t)=>t,ut=(e,t)=>t[e],pt=re();g({trigger:pt,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&oe({target:e,params:null,defer:0})}}),g({trigger:pt,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const ht=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}oe({target:pt,params:t,defer:1})};export{q as attr,ee as combine,G as data,M as explicitUnmount,K as focus,A as h,J as handler,T as list,Q as map,X as node,W as nodeMethod,R as remap,z as signalOwn,Y as spec,D as storeField,H as style,U as text,B as transform,V as tree,o as using,te as variant,Z as visible}; | ||
function e(e,t){const n=de(e);for(let e=0;e<t.length;e++){const s=de(t[e]);s.family.type='crosslink';const l=ge(s),i=me(n);l.includes(n)||l.push(n),i.includes(s)||i.push(s)}}function t(e,t){n(e,t),s(t,e)}function n(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function s(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function l(){const e={stack:null},t=pe.get(),n=te({node:[ye,ve],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function i(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(ke,'')}}function r(e){return String(e).replace(we,'')}function o(e,t){const n=e.namespaceURI,s=e.tagName.toLowerCase(),i='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',r=pe.get(),o={parent:r,signal:r&&r.signal?r.signal:l(),namespace:i,targetElement:e,svgRoot:'svg'===s?e:r?r.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};pe.replace(o),ue.push({node:e,append:[],reverse:0});try{le(o.signal,t)}finally{a(ue.pop()),pe.replace(r)}}function a({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=Ce.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function c(e,t){t.parent=e,t.signal.seq.push(Ie),t.signal.scope.stack=t,e.child.push(t)}function f(e,t){return te({node:[Ne],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function u(){Ve=0,Oe()}function h(t,n,s){const l=++We,i=ie(),r=oe.store(t)?t.updates:t,o={type:'crosslink',owners:[r,i]};return te({node:[Ue],parent:[r],scope:{taskID:l},family:o}),e(t,[i]),Fe.set(l,te({node:[Ze],child:[te({node:[Ge,Be,Ue],scope:{taskID:l},family:o}),te({node:[qe,Be],child:[i],family:o})],scope:{fn:n},family:o})),Le.set(l,s),i}function p({trigger:e=ie(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName}){const o=e.map(e=>[{inserted:Ae(),retry:0,value:e}]);return{trigger:e,processed:h(o,(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const i=e[r],f=Ae();if(i.inserted+l>f){c.push(i);continue}if(i.inserted+s<f)continue;if(f-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function d({trigger:e=ie(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName,flatten:o}){const a=e.map(e=>{const t=[],n=Ae();for(let s=0;s<e.length;s++){const l=o(e[s]);for(let e=0;e<l.length;e++)t.push({inserted:n,retry:0,value:l[e]})}return t});return{trigger:e,processed:h(a,(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const i=e[r],f=Ae();if(i.inserted+l>f){c.push(i);continue}if(i.inserted+s<f)continue;if(f-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function g(e,t,n){f(e,t.watch(n))}function m(e,t,n){te({node:[He],parent:t,child:[Je],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),oe.store(t)&&re(Je,{data:t.getState(),handler:n},1)}function b(e,t,n,s){oe.unit(n)?(e?g:m)(t,n,s):s(n)}function y(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=y(t);if(s)return s}return null}function v(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=y(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=y(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function k(e){return''!==e&&0!==e&&(0==e||null==e)}function w(e,t,n){k(n)?delete e[t]:e[t]=`${n}`}function x(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=v(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function S(e,t,n){if(null===n)return;const s=pe.get().parent.targetElement;m(t,n,x.bind(null,e,s,pe.get()))}function E(e,t,n){if(k(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function C(e,t,n,s,l,i){const r=e.createSVGTransform();switch(i){case'translate':case'scale':s=(e=>oe.store(e)?e:oe.store(e.x)?oe.store(e.y)?ae({x:e.x,y:e.y}):e.x.map(tt.bind(null,e.y)):oe.store(e.y)?e.y.map(nt.bind(null,e.x)):e)(s)}b(0,t,s,l.bind(null,r)),n.appendItem(r)}function I(e,t){const n=Ce.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function N(e){e.focus()}function _(e){e.blur()}function $(e,t,n){'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,i=pe.get(),r=i?i.namespace:'html';let o=r,u='html';'type'in t?(u=t.type,o=t.type):o=u='svg'===r?'svg':'html','svg'===e&&(u='svg',o='svg');const h='svg'===u?Ce.createElementNS('http://www.w3.org/2000/svg',e):Ce.createElement(e);'foreignObject'===r?(h.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===e?(h.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===e&&(o='foreignObject');const p=l(),d={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:p,namespace:o,targetElement:h,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:d,mountStatus:'initial',visible:1};i&&c(i,g),'svg'===e?g.svgRoot=h:i&&(g.svgRoot=i.svgRoot),pe.replace(g),n?((e,t,n,s)=>{let l=0;ue.push({node:t,append:[],reverse:0});try{le(e,s),l=1}finally{a(ue.pop()),l||pe.replace(n)}})(p,h,i,n):(d.pure=1,X(t));const y=(()=>{const e=(()=>{const e=pe.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:s,map:l}=e.handler[n];s.passive=s.prevent?0:s.passive;for(const e in l){const t=l[e];l[e]=e=>{s.prevent&&e.preventDefault(),s.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:s,map:l})}for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)'xlink:href'===e?t.attr.href=s[e]:t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=pe.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)b('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],E.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)b(0,t,n[s],w.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:l,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],l);f(t,Ke.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],Qe.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)b(0,t,n[e],et.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=pe.get();if('svg'!==s.namespace)return;if(0===n.length)return;const l=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)C(i,t,l,s[e],st[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(oe.unit(n)?m(t,n,I.bind(null,e)):I(e,n))})(n,s,e.text),S(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],N.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],_.bind(null,e))})(n,s,e.blur),e})();pe.replace(i),g.visible=!y.visible||y.visible.getState(),s||ue.length>0&&g.visible&&ue[ue.length-1].append.push(h)}function A(e,t){return e.bind(null,t)}function O(t,n){const s=pe.get();if(Array.isArray(n)){const l=[];for(let e=0;e<n.length;e++)l[e]=t.map(A(P,n[e]));return s&&e(s.signal,l),l}if('object'==typeof n&&null!==n){const l=[],i={};for(const e in n)i[e]=t.map(A(P,n[e])),l.push(i[e]);return s&&e(s.signal,l),i}const l=t.map(A(P,n));return s&&e(s.signal,l),l}function R(t,n){const s=t.map(A(P,n)),l=pe.get();return l&&e(l.signal,[s]),s}function P(e,t){return t[e]}function V({key:e,child:t,source:n},s){D({source:n,key:e},({store:n,key:l,signal:i})=>{const r=O(n,t);s({store:n,key:l,signal:i},()=>{V({key:e,child:t,source:r},s)})})}function D(t,n=(()=>{})){let s;n=t.fn?t.fn:n;let i,r=0;oe.store(t)?(i=ot,s=t):(i=A(at,t.key),s=t.source,r=!!t.reverse);const o=pe.get(),a=l(),u={parent:o,signal:a,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:oe.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial',visible:1};c(o,u),pe.replace(u);const h={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:r,parentStack:u,getID:i,fields:t.fields?t.fields:null,visible:t.visible?t.visible:null},p=ce(T(h,[],s.getState()));e(a,[p]),f(a,A(ft,p)),fe({source:p,clock:s,fn:A(T,h),target:p}),pe.replace(o)}function T(i,r,o){const a=Array(o.length).fill(0),f=o.map(i.getID),u=[],h=[],p=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.node,s=f.indexOf(n.key);-1!==s?(h.push(t),a[s]=1,n.store.getState()!==o[s]&&re({target:n.store,params:o[s],defer:1})):p.push(t)}if(p.length>0){for(let e=0;e<p.length;e++){const l=p[e],{node:i,locality:r}=l;i.active=0,i.store=null,t(r.sibling.left.ref,r.sibling.right.ref),n(l,null),s(l,null)}re({target:ct,params:p,defer:1})}let d=h.length>0?h[h.length-1]:null;for(let n=0;n<o.length;n++){if(a[n])continue;const s=o[n],r=ce(s),f=l(),p=i.fields?O(r,i.fields):null;e(f,[r]);const g=i.getID(s,n),m={parent:i.parentStack,signal:f,namespace:i.parentStack.namespace,targetElement:i.parentStack.targetElement,svgRoot:i.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:r,signal:f,active:1,nodes:[],fields:p,visible:i.visible?[r.map(i.visible)]:[]},mountStatus:'initial',visible:1};t(d,m),d=m,c(i.parentStack,m),u.push(m),h.push(m)}return u.length>0&&re({target:rt,params:{context:i,list:u},defer:1}),h}function j(e,t,n,s){const l=v(e);l&&s.contains(l.targetElement)?n?l.targetElement.before(t):l.targetElement.after(t):s.appendChild(t)}function F(e){const t=pe.get();t&&te({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})}function M(t){const n=pe.get();return n&&e(n.signal,[t]),t}function z(e){const t=pe.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function L(e){let t;return W(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}}function W(e){const t=pe.get();t.targetElement.__STATIC__||e(t.targetElement)}function X(e){e.attr&&Y(e.attr),e.data&&q(e.data),e.transform&&G(e.transform),'text'in e&&B(e.text),'visible'in e&&U(e.visible),(e.style||e.styleVar)&&Z({prop:e.style,val:e.styleVar}),e.focus&&J(e.focus),e.handler&&H(e.handler)}function Y(e){z('attr'),pe.getElementNode().attr.push(e)}function q(e){z('data'),pe.getElementNode().data.push(e)}function G(e){z('transform'),pe.getElementNode().transform.push(e)}function B(e){z('text'),pe.getElementNode().text.push(e)}function U(e){const t=pe.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);pe.getElementNode().visible.push(e)}function Z({prop:e,val:t}){z('style'),e&&pe.getElementNode().styleProp.push(e),t&&pe.getElementNode().styleVar.push(t)}function H(e,t){z('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0,prevent:l=0,stop:i=0}=e;pe.getElementNode().handler.push({options:{passive:n,capture:s,prevent:l,stop:i},map:t})}function J({focus:e,blur:t}){z('focus');const n=pe.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}function K(e,{fn:t}){return console.error('separate map method is deprecated, use store.map as usual'),M(e.map(t))}function Q({source:e,fn:t}){return console.error('separate combine method is deprecated, use common combine method as usual'),M(ae(e,t))}function ee(e,t){const n=ce(Object.entries(t).map(([e,t])=>({key:e,val:t}))),s=ae(n,e,(e,t)=>e.map(e=>({key:e.key,val:e.val,visible:e.key===t})));D({source:s,key:'key',visible:({visible:e})=>e,fn({store:e}){e.getState().val()}})}import{createNode as te,step as ne,clearNode as se,withRegion as le,createEvent as ie,launch as re,is as oe,combine as ae,createStore as ce,sample as fe}from'effector';const ue=[];let he;const pe={get:()=>he,replace(e){he=e},getElementNode:()=>he.node},de=e=>e.graphite||e,ge=e=>e.family.owners,me=e=>e.family.links,be=te({node:[ne.run({fn(e){se(e)}})]}),ye=ne.compute({fn(e,l){l.self.next.push(be);const{stack:i}=l,{parent:r}=i,{left:o,right:a}=i.locality.sibling;r&&(r.locality.child.last.ref===i&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===i&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===i&&a.ref&&a.ref.locality.sibling.left.ref===i?t(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===i?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===i&&s(a.ref,null)}}),ve=ne.compute({fn:(e,{self:t})=>t}),ke=/[^a-zA-Z0-9\-]/g,we=/[\\<>"]/g;class xe{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[i(e)]=r(t)}removeProperty(e){delete this.properties[i(e)]}}class Se{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class Ee{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new xe,this.firstChild=null,this.transform={baseVal:new Se},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[i(e)]=r(t)}removeAttribute(e){delete this.attributes[i(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new Ee}}).isBody=1;let Ce='undefined'!=typeof document?document:null;const Ie=ne.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),Ne=ne.run({fn(e,{fn:t}){t(e)}});let _e,$e,Ae;_e=()=>{},$e=()=>{},Ae='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const Oe=ie();let Re,Pe=0,Ve=0;const De='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Te='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,je=()=>{Ve||(Ve=1,Re=De(u))},Fe=new Map,Me=new Map,ze=new Map,Le=new Map;let We=0,Xe=0;const Ye=te({node:[ne.run({fn:()=>{}}),ne.filter({fn:()=>0===Me.size&&0===ze.size?0:Ae()-Xe>=10?0:(Te(Re),Pe=1,Ve=0,1)})],child:[Oe]});Oe.watch(()=>{if(Ve)return;if(0===Me.size&&0===ze.size)return void(Pe=0);let e=0;Pe||(Xe=Ae()),Pe=0;for(const[t,n]of Me){if(Ae()-Xe>=10){je(),e=1;break}Me.delete(t),re({target:Fe.get(t),params:n,defer:1})}if(!e)for(const[t,n]of ze){if(Ae()-Xe>=10){je(),e=1;break}ze.delete(t),re({target:Fe.get(t),params:n,defer:1})}re({target:Ye,params:null,defer:1})});const qe=ne.compute({fn:({done:e})=>e}),Ge=ne.compute({fn:({fail:e})=>e}),Be=ne.filter({fn:e=>e.length>0}),Ue=ne.compute({fn(e,{taskID:t}){const n='high'===Le.get(t)?Me:ze;let s=n.get(t);s||(s=[],n.set(t,s));for(let t=0;t<e.length;t++)s.push(e[t]);je()}}),Ze=ne.run({fn:(e,{fn:t})=>t(e,Xe)}),He=ne.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Je}=p({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Ke=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Qe=(e,t,n)=>{k(n)?delete e[t]:e[t]=n},et=(e,t,n)=>{k(n)?e.removeProperty(t):e.setProperty(t,n)},tt=(e,t)=>({x:t,y:e}),nt=(e,t)=>({x:e,y:t}),st={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:lt}=p({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=Ce.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);j(n.listItemStack,s,e.reverse,e.node)}}}),{trigger:rt}=p({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:i}=e,r=pe.get();pe.replace(n);const o=[],a=[];ue.push({node:s,append:a,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],r=n.node;if(r.active){pe.replace(n),le(n.signal,A(l,r));for(let e=0;e<a.length;e++)r.nodes.push(a[e]);r.visible.length>0?le(n.signal,()=>{const e=r.visible[r.visible.length-1];e.updates.watch(e=>{if(0!=r.active)if(e){const e=Ce.createDocumentFragment();if(i)for(let t=r.nodes.length-1;t>=0;t--)e.appendChild(r.nodes[t]);else for(let t=0;t<r.nodes.length;t++)e.appendChild(r.nodes[t]);j(n,e,i,s)}else for(let e=0;e<r.nodes.length;e++)r.nodes[e].remove()}),e.getState()&&o.push({listItemStack:n,appended:a.slice(),listItem:r})}):o.push({listItemStack:n,appended:a.slice(),listItem:r}),a.length=0}}ue.pop(),o.length>0&&re({target:lt,params:{node:s,append:o,reverse:i},defer:1}),pe.replace(r)}}),ot=(e,t)=>t,at=(e,t)=>t[e],ct=ie();d({trigger:ct,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&re({target:e,params:null,defer:0})}}),d({trigger:ct,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const ft=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}re({target:ct,params:t,defer:1})};export{Y as attr,Q as combine,q as data,F as explicitUnmount,J as focus,$ as h,H as handler,D as list,K as map,W as node,L as nodeMethod,O as remap,M as signalOwn,X as spec,R as storeField,Z as style,B as text,G as transform,V as tree,o as using,ee as variant,U as visible}; | ||
//# sourceMappingURL=effector-dom.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)['effector-dom']={})})(this,(function(e){function t({node:e=[],from:t,source:n,parent:r=t||n,to:s,target:l,child:i=s||l,scope:o={},meta:a={},family:c={type:'regular'}}){const f=Pe(r),u=Pe(c.links),p=Pe(c.owners),d=[],h={};for(let t=0;t<e.length;t++){const n=e[t];n&&(d.push(n),Ve(n,h))}const g={seq:d,next:Pe(i),meta:a,scope:o,family:{type:c.type||'crosslink',links:u,owners:p},reg:h};for(let e=0;e<u.length;e++)_e(u[e]).push(g);for(let e=0;e<p.length;e++)$e(p[e]).push(g);for(let e=0;e<f.length;e++)f[e].next.push(g);return g}function n(e,t="combine"){let n=t+'(',r='',s=0;for(const t in e){const l=e[t];if(null!=l&&(n+=r,n+=se(l)?l.compositeName.fullName:l.toString()),s+=1,25===s)break;r=', '}return n+=')',n}function r(e,t){at={parent:at,value:e};try{return t()}finally{at=at.parent}}function s(e,n){const r=(e,...t)=>r.create(e,t,t);return r.graphite=t({meta:ut('event',r,n,e)}),r.create=e=>(Ue(r,e),e),r.watch=de(ct,r),r.map=e=>{let t,n;ae(e)&&(t=e,n=e.name,e=e.fn);const l=s(Ke(r,n),t);return pt(r,l,'map',e),l},r.filter=e=>ce(e)?(console.error('.filter(fn) is deprecated, use .filterMap instead'),l(r,e)):dt(r,'filter',e.fn,[xe({fn:Re})]),r.filterMap=de(l,r),r.prepend=e=>{const t=s('* → '+r.shortName,{parent:r.parent});return pt(t,r,'prepend',e),(({parent:e},t)=>{e&&e.hooks.event(t)})(r,t),t},r.subscribe=e=>ct(r,t=>e.next(t)),r[re]=()=>r,ot(r)}function l(e,t){return dt(e,'filterMap',t,[we({fn:Re}),ve()])}function i(e,n){const r=Ne(e),l=Ne(e),c=s({named:'updates'}),f={subscribers:new Map,updates:c,defaultState:e,stateRef:r,getState:de(Ce,r),setState(e){Ue({target:f,params:e,defer:1})}};if(f.graphite=t({scope:{state:r},node:[ve(),Ee({store:r}),ke({store:l}),Ee({store:l})],child:c,meta:ut('store',f,n)}),ft&&void 0===e)throw Error("current state can't be undefined, use null instead");return f.watch=f.subscribe=de(a,f),f.reset=(...e)=>{for(const t of e)f.on(t,()=>f.defaultState);return f},f.on=(e,t)=>(f.off(e),f.subscribers.set(e,st(ht(e,f,'on',1,t))),f),f.off=de(o,f),f.map=(e,t)=>{let n,r,s;ae(e)&&(n=e,r=e.name,t=e.firstState,e=e.fn);const l=f.getState();void 0!==l&&(s=e(l,t));const o=i(s,{name:Ke(f,r),config:n,strict:0});return ht(f,o,'map',0,e),o},f[re]=()=>({subscribe:e=>((e=>{if(!ae(e)&&!ce(e))throw Error('expect value to be an object')})(e),a(f,t=>{e.next&&e.next(t)})),[re](){return this}}),je(f,[c]),ot(f)}function o(e,t){const n=e.subscribers.get(t);return void 0!==n&&(n(),e.subscribers.delete(t)),e}function a(e,t,n){if(!n||!se(t)){if(!ce(t))throw Error('watch requires function handler');return t(e.getState()),ct(e,t)}if(!ce(n))throw Error('second argument should be a function');return t.watch(t=>n(e.getState(),t))}function c(...e){if(0===e.length)throw Error('at least one argument required');let t,n,r,s,l;'ɔ'in e[0]&&(r=e[0].config,e=e[0].ɔ);{const r=e[e.length-1];ce(r)?(n=e.slice(0,-1),t=r):n=e}if(1===n.length){const e=n[0];ie(e)||(s=e,l=1)}return l||(s=n,t&&(t=mt(t))),Array.isArray(s)?bt(s,e=>e.slice(),[],r,t):bt(s,e=>Object.assign({},e),{},r,t)}function f(e,t){const n=xt(e);for(let e=0;e<t.length;e++){const r=xt(t[e]);r.family.type='crosslink';const s=St(r),l=Et(n);s.includes(n)||s.push(n),l.includes(r)||l.push(r)}}function u(e,t){p(e,t),d(t,e)}function p(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function d(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function h(){const e={stack:null},n=wt.get(),r=t({node:[Ct,At],parent:[n&&n.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=r,r}function g(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(It,'')}}function m(e){return String(e).replace(Rt,'')}function b({node:e,append:t,reverse:n=0}){if(0===t.length)return;const r=Dt.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)r.appendChild(t[e]);e.prepend(r)}else{for(let e=0;e<t.length;e++)r.appendChild(t[e]);e.appendChild(r)}}function y(e,t){t.parent=e,t.signal.seq.push(jt),t.signal.scope.stack=t,e.child.push(t)}function v(e,n){return t({node:[Pt],parent:e,meta:{op:'watch'},scope:{fn:n},family:{type:'crosslink',owners:[e]}})}function k(){Lt=0,Tt()}function w(e,t,n){const r=(e=>'high'===Zt.get(e)?Ut:Bt)(e);let s=r.get(e);if(s||(s=[],r.set(e,s)),t)for(let e=0;e<n.length;e++)s.push(n[e]);else s.push(n);Yt()}function x(e,n,r=0,l="low"){const i=++Ht,o=s(),a=ie(c=e)?c.updates:c;var c;const u={type:'crosslink',owners:[a,o]};return t({node:[rn],parent:[a],scope:{taskID:i,flat:r},family:u}),f(e,[o]),Gt.set(i,t({node:[sn],child:[t({node:[en,tn,nn],scope:{taskID:i},family:u}),t({node:[Qt,tn],child:[o],family:u})],scope:{fn:n},family:u})),Zt.set(i,l),o}function S({trigger:e=s(),fn:n,priority:r="low",timeout:l=1/0,batchWindow:i=0,retries:o=1/0,mark:a=e.shortName}){const c=x(e.map(e=>[{inserted:Mt(),retry:0,value:e}]),(e,t)=>{let r,s=0;const a=[],c=[];for(r=0;r<e.length;r++){const o=e[r],f=Mt();if(o.inserted+i>f){c.push(o);continue}if(o.inserted+l<f)continue;if(f-t>=10){s=1;break}const u=n(o.value);void 0!==u&&a.push(u)}if(s)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=o||c.push(n)}return{done:a,fail:c}},1,r);return{trigger:e,processed:c,connect:n=>{t({node:[],parent:n,child:e,family:{type:'crosslink',owners:[n,e]}})}}}function E({trigger:e=s(),fn:n,priority:r="low",timeout:l=1/0,batchWindow:i=0,retries:o=1/0,mark:a=e.shortName,flatten:c}){const f=x(e.map(e=>{const t=[],n=Mt();for(let r=0;r<e.length;r++){const s=c(e[r]);for(let e=0;e<s.length;e++)t.push({inserted:n,retry:0,value:s[e]})}return t}),(e,t)=>{let r,s=0;const a=[],c=[];for(r=0;r<e.length;r++){const o=e[r],f=Mt();if(o.inserted+i>f){c.push(o);continue}if(o.inserted+l<f)continue;if(f-t>=10){s=1;break}const u=n(o.value);void 0!==u&&a.push(u)}if(s)for(let t=r;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=o||c.push(n)}return{done:a,fail:c}},1,r);return{trigger:e,processed:f,connect:n=>{t({node:[ln],parent:n,child:e,family:{type:'crosslink',owners:[n,e]}})}}}function N(e,t,n){v(e,t.watch(n))}function C(e,n,r){t({node:[on],parent:n,child:[an],family:{type:'crosslink',owners:e},scope:{handler:r},meta:{op:'debounceRaf'}}),ie(n)&&Ue(an,{data:n.getState(),handler:r},1)}function A(e,t,n,r){se(n)?(e?N:C)(t,n,r):r(n)}function I(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const r=I(t);if(r)return r}return null}function R(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=I(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=I(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function O(e){return''!==e&&0!==e&&(0==e||null==e)}function _(e,t,n){O(n)?delete e[t]:e[t]=`${n}`}function $(e,t,n,r){if(n.visible=r,r){if(!t.contains(e)){const r=R(n);r&&t.contains(r.targetElement)?r.targetElement.after(e):t.appendChild(e)}}else e.remove()}function D(e,t,n){if(null===n)return;const r=wt.get().parent.targetElement;C(t,n,$.bind(null,e,r,wt.get()))}function j(e,t,n){if(O(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function P(e,t,n,r,s,l){const i=e.createSVGTransform();switch(l){case'translate':case'scale':r=(e=>ie(e)?e:ie(e.x)?ie(e.y)?c({x:e.x,y:e.y}):e.x.map(pn.bind(null,e.y)):ie(e.y)?e.y.map(dn.bind(null,e.x)):e)(r)}A(0,t,r,s.bind(null,i)),n.appendItem(i)}function V(e,t){const n=Dt.createTextNode(`${t}`),r=e.firstChild;r?r.replaceWith(n):e.appendChild(n)}function z(e){e.focus()}function M(e){e.blur()}function T(e,t){return e.bind(null,t)}function F(e,t){const n=wt.get();if(Array.isArray(t)){const r=[];for(let n=0;n<t.length;n++)r[n]=e.map(T(q,t[n]));return n&&f(n.signal,r),r}if('object'==typeof t&&null!==t){const r=[],s={};for(const n in t)s[n]=e.map(T(q,t[n])),r.push(s[n]);return n&&f(n.signal,r),s}const r=e.map(T(q,t));return n&&f(n.signal,r),r}function q(e,t){return t[e]}function L(e,n=(()=>{})){let r;n=e.fn?e.fn:n;let l,o=0;ie(e)?(l=bn,r=e):(l=T(yn,e.key),r=e.source,o=!!e.reverse);const a=wt.get(),c=h(),u={parent:a,signal:c,namespace:a.namespace,targetElement:a.targetElement,svgRoot:a.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:o,key:ie(e)?{type:'index'}:{type:'key',key:e.key},store:r,cb:n},mountStatus:'initial',visible:1};y(a,u),wt.replace(u);const p={parentNode:a.targetElement,cb:n,shortName:r.shortName,reverse:o,parentStack:u,getID:l,fields:e.fields?e.fields:null,visible:e.visible?e.visible:null},d=i(W(p,[],r.getState()));f(c,[d]),v(c,T(kn,d)),((...e)=>{let n,r,l;'ɔ'in e[0]&&(l=e[0].config,e=e[0].ɔ);let[o,a,c,f=0]=e;if(void 0===a&&'source'in o){if('clock'in o&&null==o.clock)throw Error('config.clock should be defined');a=o.clock,c=o.fn,f=o.greedy,n=o.target,r=o.name,o=o.source}if(void 0===a&&(a=o),r=l||r||o.shortName,o=yt(o),a=yt(a),'boolean'==typeof c&&(f=c,c=null),n||(n=ie(o)&&ie(a)?i(c?c(Ce(De(o)),Ce(De(a))):Ce(De(o)),{name:r}):s(r)),ie(o))je(o,[ot(lt(a,n,{scope:{fn:c},node:[!f&&be({priority:'sampler'}),ye({store:De(o),to:c?'a':'stack'}),c&&we({fn:Ie})],meta:{op:'sample',sample:'store'}}))]);else{const e=Ne(0),r=Ne(),s=Ne();ot(t({parent:o,node:[Ee({store:r}),ye({from:'value',store:1,target:e})],family:{owners:[o,n,a],links:n},meta:{op:'sample',sample:'source'}})),je(o,[ot(lt(a,n,{scope:{fn:c},node:[Ee({store:s}),ye({store:e}),xe({fn:e=>e}),!f&&be({priority:'sampler'}),ye({store:r}),ye({store:s,to:'a'}),c&&we({fn:Ae})],meta:{op:'sample',sample:'clock'}}))])}})({source:d,clock:r,fn:T(W,p),target:d}),wt.replace(a)}function W(e,t,n){const r=Array(n.length).fill(0),s=n.map(e.getID),l=[],o=[],a=[];for(let e=0;e<t.length;e++){const l=t[e],i=l.node,c=s.indexOf(i.key);-1!==c?(o.push(l),r[c]=1,i.store.getState()!==n[c]&&Ue({target:i.store,params:n[c],defer:1})):a.push(l)}if(a.length>0){for(let e=0;e<a.length;e++){const t=a[e],{node:n,locality:r}=t;n.active=0,n.store=null,u(r.sibling.left.ref,r.sibling.right.ref),p(t,null),d(t,null)}Ue({target:vn,params:a,defer:1})}let c=o.length>0?o[o.length-1]:null;for(let t=0;t<n.length;t++){if(r[t])continue;const s=n[t],a=i(s),p=h(),d=e.fields?F(a,e.fields):null;f(p,[a]);const g=e.getID(s,t),m={parent:e.parentStack,signal:p,namespace:e.parentStack.namespace,targetElement:e.parentStack.targetElement,svgRoot:e.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:a,signal:p,active:1,nodes:[],fields:d,visible:e.visible?[a.map(e.visible)]:[]},mountStatus:'initial',visible:1};u(c,m),c=m,y(e.parentStack,m),l.push(m),o.push(m)}return l.length>0&&Ue({target:mn,params:{context:e,list:l},defer:1}),o}function X(e,t,n,r){const s=R(e);s&&r.contains(s.targetElement)?n?s.targetElement.before(t):s.targetElement.after(t):r.appendChild(t)}function Y(e){const t=wt.get();return t&&f(t.signal,[e]),e}function G(e){const t=wt.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function U(e){const t=wt.get();t.targetElement.__STATIC__||e(t.targetElement)}function B(e){e.attr&&Z(e.attr),e.data&&H(e.data),e.transform&&J(e.transform),'text'in e&&K(e.text),'visible'in e&&Q(e.visible),(e.style||e.styleVar)&&ee({prop:e.style,val:e.styleVar}),e.focus&&ne(e.focus),e.handler&&te(e.handler)}function Z(e){G('attr'),wt.getElementNode().attr.push(e)}function H(e){G('data'),wt.getElementNode().data.push(e)}function J(e){G('transform'),wt.getElementNode().transform.push(e)}function K(e){G('text'),wt.getElementNode().text.push(e)}function Q(e){const t=wt.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);wt.getElementNode().visible.push(e)}function ee({prop:e,val:t}){G('style'),e&&wt.getElementNode().styleProp.push(e),t&&wt.getElementNode().styleVar.push(t)}function te(e,t){G('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:r=0,prevent:s=0,stop:l=0}=e;wt.getElementNode().handler.push({options:{passive:n,capture:r,prevent:s,stop:l},map:t})}function ne({focus:e,blur:t}){G('focus');const n=wt.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}var re=(()=>{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 se=e=>(ce(e)||ae(e))&&'kind'in e,le=e=>t=>se(t)&&t.kind===e,ie=le('store'),oe=le('domain'),ae=e=>'object'==typeof e&&null!==e,ce=e=>'function'==typeof e,fe=()=>{let e=0;return()=>(++e).toString(36)},ue=fe(),pe=fe(),de=(e,t)=>e.bind(null,t),he=(e,t,n)=>e.bind(null,t,n),ge=(e,t,n)=>({id:pe(),type:e,data:n,hasRef:t});let me=0;const be=({priority:e="barrier"})=>ge('barrier',0,{barrierID:++me,priority:e}),ye=({from:e="store",store:t,target:n,to:r=(n?'store':'stack')})=>ge('mov','store'===e,{from:e,store:t,to:r,target:n}),ve=()=>ge('check',0,{type:'defined'}),ke=({store:e})=>ge('check',1,{type:'changed',store:e}),we=he(ge,'compute',0),xe=he(ge,'filter',0),Se=he(ge,'run',0),Ee=({store:e})=>ye({from:'stack',target:e}),Ne=e=>({id:pe(),current:e}),Ce=({current:e})=>e,Ae=(e,{fn:t},{a:n})=>t(e,n),Ie=(e,{fn:t},{a:n})=>t(n,e),Re=(e,{fn:t})=>t(e),Oe=e=>e.graphite||e,_e=e=>e.family.owners,$e=e=>e.family.links,De=e=>e.stateRef,je=(e,t)=>{const n=Oe(e);for(let e=0;e<t.length;e++){const r=Oe(t[e]);'domain'!==n.family.type&&(r.family.type='crosslink'),_e(r).push(n),$e(n).push(r)}},Pe=(e=[])=>{const t=[];if(Array.isArray(e))for(let n=0;n<e.length;n++)Array.isArray(e[n])?t.push(...e[n]):t.push(e[n]);else t.push(e);return t.map(Oe)},Ve=({hasRef:e,type:t,data:n},r)=>{let s;e&&(s=n.store,r[s.id]=s),'mov'===t&&'store'===n.to&&(s=n.target,r[s.id]=s)};let ze=null;const Me=(e,t)=>{if(!e)return t;if(!t)return e;let n;const r=e.v.type===t.v.type;return(r&&e.v.id>t.v.id||!r&&'sampler'===e.v.type)&&(n=e,e=t,t=n),n=Me(e.r,t),e.r=e.l,e.l=n,e},Te=[];let Fe=0;for(;Fe<5;)Te.push({first:null,last:null,size:0}),Fe+=1;const qe=()=>{for(let e=0;e<5;e++){const t=Te[e];if(t.size>0){if(2===e||3===e){t.size-=1;const e=ze.v;return ze=Me(ze.l,ze.r),e}1===t.size&&(t.last=null);const n=t.first;return t.first=n.right,t.size-=1,n.value}}},Le=(e,t,n,r)=>We(0,{a:null,b:null,node:t,parent:n,value:r},e),We=(e,t,n,r=0)=>{const s=Xe(n),l=Te[s],i={idx:e,stack:t,type:n,id:r};if(2===s||3===s)ze=Me(ze,{v:i,l:0,r:0});else{const e={right:null,value:i};0===l.size?l.first=e:l.last.right=e,l.last=e}l.size+=1},Xe=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}},Ye=new Set;let Ge=0;const Ue=(e,t,n)=>{if(e.target&&(t=e.params,n=e.defer,e=e.target),Array.isArray(e))for(let n=0;n<e.length;n++)Le('pure',Oe(e[n]),null,t[n]);else Le('pure',Oe(e),null,t);n&&Ge||(()=>{const e=Ge;Ge=1;const t={stop:0};let n,r;e:for(;r=qe();){const{idx:e,stack:s,type:l}=r;n=s.node;const i={skip:0,fail:0,ref:'',scope:n.scope};for(let r=e;r<n.seq.length&&!t.stop;r++){const o=n.seq[r],a=o.data;switch(o.type){case'barrier':{const t=a.barrierID,n=a.priority;if(r!==e||l!==n){Ye.has(t)||(Ye.add(t),We(r,s,n,t));continue e}Ye.delete(t);break}case'mov':{let e;switch(a.from){case'stack':e=s.value;break;case'a':e=s.a;break;case'b':e=s.b;break;case'value':e=a.store;break;case'store':e=Ce(n.reg[a.store.id])}switch(a.to){case'stack':s.value=e;break;case'a':s.a=e;break;case'b':s.b=e;break;case'store':n.reg[a.target.id].current=e}break}case'check':switch(a.type){case'defined':i.skip=void 0===s.value;break;case'changed':i.skip=s.value===Ce(n.reg[a.store.id])}break;case'filter':i.skip=!Be(i,a,s);break;case'run':if(r!==e||'effect'!==l){We(r,s,'effect');continue e}case'compute':s.value=Be(i,a,s)}t.stop=i.fail||i.skip}if(!t.stop)for(let e=0;e<n.next.length;e++)Le('child',n.next[e],s,s.value);t.stop=0}Ge=e})()},Be=(e,{fn:t},n)=>{try{return t(n.value,e.scope,n)}catch(t){console.error(t),e.fail=1}},Ze=(e,t={})=>(ae(e)&&(Ze(e.config,t),null!=e.name&&(ae(e.name)?Ze(e.name,t):t.name=e.name),e.loc&&(t.loc=e.loc),e.sid&&(t.sid=e.sid),e.handler&&(t.handler=e.handler),e.parent&&(t.parent=e.parent),'strict'in e&&(t.strict=e.strict),e.named&&(t.named=e.named),Ze(e.ɔ,t)),t),He=Ze,Je=(e,t)=>''+e.shortName+t,Ke=(e,t)=>null==t?Je(e,' → *'):t,Qe=(e,t)=>{const n=e.indexOf(t);-1!==n&&e.splice(n,1)},et=(e,t)=>{Qe(e.next,t),Qe(_e(e),t),Qe($e(e),t)},tt=(e,t,n)=>{let r;e.next.length=0,e.seq.length=0,e.scope=null;let s=$e(e);for(;r=s.pop();)et(r,e),(t||n&&!e.meta.sample||'crosslink'===r.family.type)&&tt(r,t,n);for(s=_e(e);r=s.pop();)et(r,e),n&&'crosslink'===r.family.type&&tt(r,t,n)},nt=e=>e.clear(),rt=(e,{deep:t}={})=>{let n=0;if(ie(e))nt(e.subscribers);else if(oe(e)){n=1;const t=e.history;nt(t.events),nt(t.effects),nt(t.stores),nt(t.domains)}tt(Oe(e),!!t,n)},st=e=>{const t=he(rt,e,void 0);return t.unsubscribe=t,t},lt=(e,n,{node:r,scope:s,meta:l})=>t({node:r,parent:e,child:n,scope:s,meta:l,family:{owners:[e,n],links:n}}),ot=e=>(at&&je(at.value,[e]),e);let at=null;const ct=(e,n)=>st(ot(t({scope:{fn:n},node:[Se({fn:Re})],parent:e,meta:{op:'watch'},family:{owners:e}})));let ft;const ut=(e,t,n,r)=>{const s=He({name:r,config:n}),l=ue(),{parent:i=null,sid:o=null,strict:a=1,named:c=null}=s,f=c||s.name||('domain'===e?'':l),u=((e,t)=>{let n,r,s;const l=e;return t?(s=t.compositeName,0===e.length?(n=s.path,r=s.fullName):(n=s.path.concat([e]),r=0===s.fullName.length?e:s.fullName+'/'+e)):(n=0===e.length?[]:[e],r=e),{shortName:l,fullName:r,path:n}})(f,i);return t.kind=e,t.id=l,t.sid=o,t.shortName=f,t.parent=i,t.compositeName=u,t.defaultConfig=s,t.thru=de(gt,t),t.getType=()=>u.fullName,ft=a,{unit:e,name:f,sid:o,named:c}},pt=(e,t,n,r)=>lt(e,t,{scope:{fn:r},node:[we({fn:Re})],meta:{op:n}}),dt=(e,t,n,r)=>{let l;ae(n)&&(l=n,n=n.fn);const i=s(Je(e,' →? *'),l);return lt(e,i,{scope:{fn:n},node:r,meta:{op:t}}),i},ht=(e,{graphite:t,stateRef:n},r,s,l)=>lt(e,t,{scope:{fn:l},node:[ye({store:n,to:'a'}),we({fn:s?Ie:Ae}),ve(),ke({store:n}),Ee({store:n})],meta:{op:r}}),gt=(e,t)=>t(e),mt=e=>t=>e(...t),bt=(e,t,r,s,l)=>{const o=t(r),a=i(o,{name:s||n(e)}),c=Ne(o),f=Ne(1),u=[ve(),ye({store:c,to:'a'}),xe({fn:(e,{key:t},{a:n})=>e!==n[t]}),ye({store:f,to:'b'}),we({fn(e,{clone:t,key:n},r){r.b&&(r.a=t(r.a)),r.a[n]=e}}),ye({from:'a',target:c}),ye({from:'value',store:0,target:f}),be({priority:'barrier'}),ye({from:'value',store:1,target:f}),ye({store:c}),l&&we({fn:l}),ke({store:De(a)})];for(const n in e){const s=e[n];ie(s)?(r[n]=s.defaultState,o[n]=s.getState(),lt(s,a,{scope:{key:n,clone:t},node:u,meta:{op:'combine'}})):o[n]=r[n]=s}return a.defaultShape=e,a.defaultState=l?De(a).current=l(o):r,a},yt=e=>se(e)?e:c(e),vt=(t({node:[Se({fn({fn:e,value:t}){e(t)}})],meta:{op:'fx',fx:'sidechain'}}),xe({fn:(e,{state:t})=>void 0!==e&&e!==Ce(t)}),we({fn:e=>e}),[]);let kt;const wt={get:()=>kt,replace(e){kt=e},getElementNode:()=>kt.node},xt=e=>e.graphite||e,St=e=>e.family.owners,Et=e=>e.family.links,Nt=t({node:[Se({fn(e){rt(e)}})]}),Ct=we({fn(e,t){t.self.next.push(Nt);const{stack:n}=t,{parent:r}=n,{left:s,right:l}=n.locality.sibling;r&&(r.locality.child.last.ref===n&&(r.locality.child.last.ref=s.ref),r.locality.child.first.ref===n&&(r.locality.child.first.ref=l.ref)),s.ref&&s.ref.locality.sibling.right.ref===n&&l.ref&&l.ref.locality.sibling.left.ref===n?u(s.ref,l.ref):s.ref&&s.ref.locality.sibling.right.ref===n?p(s.ref,null):l.ref&&l.ref.locality.sibling.left.ref===n&&d(l.ref,null)}}),At=we({fn:(e,{self:t})=>t}),It=/[^a-zA-Z0-9\-]/g,Rt=/[\\<>"]/g;class Ot{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[g(e)]=m(t)}removeProperty(e){delete this.properties[g(e)]}}class _t{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class $t{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new Ot,this.firstChild=null,this.transform={baseVal:new _t},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[g(e)]=m(t)}removeAttribute(e){delete this.attributes[g(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new $t}}).isBody=1;let Dt='undefined'!=typeof document?document:null;const jt=we({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const r=n.parent.child.indexOf(n);return-1!==r&&n.parent.child.splice(r,1),n.parent=null,e}}),Pt=Se({fn(e,{fn:t}){t(e)}});let Vt,zt,Mt;Vt=()=>{},zt=()=>{},Mt='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const Tt=s();let Ft,qt=0,Lt=0;const Wt='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Xt='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Yt=()=>{Lt||(Lt=1,Ft=Wt(k))},Gt=new Map,Ut=new Map,Bt=new Map,Zt=new Map;let Ht=0,Jt=0;const Kt=t({node:[Se({fn:()=>{}}),xe({fn:()=>0===Ut.size&&0===Bt.size?0:Mt()-Jt>=10?0:(Xt(Ft),qt=1,Lt=0,1)})],child:[Tt]});Tt.watch(()=>{if(Lt)return;if(0===Ut.size&&0===Bt.size)return void(qt=0);let e=0;qt||(Jt=Mt()),qt=0;for(const[t,n]of Ut){if(Mt()-Jt>=10){Yt(),e=1;break}Ut.delete(t),Ue({target:Gt.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Bt){if(Mt()-Jt>=10){Yt(),e=1;break}Bt.delete(t),Ue({target:Gt.get(t),params:n,defer:1})}Ue({target:Kt,params:null,defer:1})});const Qt=we({fn:({done:e})=>e}),en=we({fn:({fail:e})=>e}),tn=xe({fn:e=>e.length>0}),nn=we({fn(e,{taskID:t}){w(t,1,e)}}),rn=we({fn(e,{taskID:t,flat:n}){w(t,n,e)}}),sn=Se({fn:(e,{fn:t})=>t(e,Jt)}),ln=we({fn:e=>[e]}),on=Se({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:an}=S({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),cn=(e,{map:t,options:n})=>{for(const r in t)e.removeEventListener(r,t[r],n)},fn=(e,t,n)=>{O(n)?delete e[t]:e[t]=n},un=(e,t,n)=>{O(n)?e.removeProperty(t):e.setProperty(t,n)},pn=(e,t)=>({x:t,y:e}),dn=(e,t)=>({x:e,y:t}),hn={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:gn}=S({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const r=Dt.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)r.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)r.appendChild(n.appended[e]);X(n.listItemStack,r,e.reverse,e.node)}}}),{trigger:mn}=S({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:i}=e,o=wt.get();wt.replace(n);const a=[],c=[];vt.push({node:s,append:c,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],o=n.node;if(o.active){wt.replace(n),r(n.signal,T(l,o));for(let e=0;e<c.length;e++)o.nodes.push(c[e]);o.visible.length>0?r(n.signal,()=>{const e=o.visible[o.visible.length-1];e.updates.watch(e=>{if(0!=o.active)if(e){const e=Dt.createDocumentFragment();if(i)for(let t=o.nodes.length-1;t>=0;t--)e.appendChild(o.nodes[t]);else for(let t=0;t<o.nodes.length;t++)e.appendChild(o.nodes[t]);X(n,e,i,s)}else for(let e=0;e<o.nodes.length;e++)o.nodes[e].remove()}),e.getState()&&a.push({listItemStack:n,appended:c.slice(),listItem:o})}):a.push({listItemStack:n,appended:c.slice(),listItem:o}),c.length=0}}vt.pop(),a.length>0&&Ue({target:gn,params:{node:s,append:a,reverse:i},defer:1}),wt.replace(o)}}),bn=(e,t)=>t,yn=(e,t)=>t[e],vn=s();E({trigger:vn,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&Ue({target:e,params:null,defer:0})}}),E({trigger:vn,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const kn=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}Ue({target:vn,params:t,defer:1})};e.attr=Z,e.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),Y(c(e,t))),e.data=H,e.explicitUnmount=e=>{const n=wt.get();n&&t({node:[],parent:e,child:n.signal,family:{type:'crosslink',owners:[n.signal,e]}})},e.focus=ne,e.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,l=wt.get(),i=l?l.namespace:'html';let o=i,a='html';'type'in t?(a=t.type,o=t.type):o=a='svg'===i?'svg':'html','svg'===e&&(a='svg',o='svg');const c='svg'===a?Dt.createElementNS('http://www.w3.org/2000/svg',e):Dt.createElement(e);'foreignObject'===i?(c.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===e?(c.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===e&&(o='foreignObject');const f=h(),u={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},p={parent:null,signal:f,namespace:o,targetElement:c,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:u,mountStatus:'initial',visible:1};l&&y(l,p),'svg'===e?p.svgRoot=c:l&&(p.svgRoot=l.svgRoot),wt.replace(p),n?((e,t,n,s)=>{let l=0;vt.push({node:t,append:[],reverse:0});try{r(e,s),l=1}finally{b(vt.pop()),l||wt.replace(n)}})(f,c,l,n):(u.pure=1,B(t));const d=(()=>{const e=(()=>{const e=wt.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:r,map:s}=e.handler[n];r.passive=r.prevent?0:r.passive;for(const e in s){const t=s[e];s[e]=e=>{r.prevent&&e.preventDefault(),r.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:r,map:s})}for(let n=0;n<e.attr.length;n++){const r=e.attr[n];for(const e in r)t.attr[e]=r[e]}for(let n=0;n<e.data.length;n++){const r=e.data[n];for(const e in r)t.data[e]=r[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const r=e.styleVar[n];for(const e in r)t.styleVar[e]=r[e]}for(let n=0;n<e.styleProp.length;n++){const r=e.styleProp[n];for(const e in r)t.styleProp[e]=r[e]}return t})(),t=wt.get(),n=t.targetElement,r=t.signal;return((e,t,n)=>{for(const r in n)A('value'!==r&&'checked'!==r&&'min'!==r&&'max'!==r,t,n[r],j.bind(null,e,r))})(n,r,e.attr),((e,t,n)=>{for(const r in n)A(0,t,n[r],_.bind(null,e.dataset,r))})(n,r,e.data),((e,t,n)=>{for(let r=0;r<n.length;r++){const{options:s,map:l}=n[r];for(const t in l)e.addEventListener(t,l[t],s);v(t,cn.bind(null,e,n[r]))}})(n,r,e.handler),((e,t,n)=>{const r=e.style;for(const e in n)A(0,t,n[e],fn.bind(null,r,e))})(n,r,e.styleProp),((e,t,n)=>{const r=e.style;for(const e in n)A(0,t,n[e],un.bind(null,r,`--${e}`))})(n,r,e.styleVar),((e,t,n)=>{const r=wt.get();if('svg'!==r.namespace)return;if(0===n.length)return;const s=e.transform.baseVal,l=r.svgRoot;for(let e=0;e<n.length;e++){const r=n[e];for(const e in r)P(l,t,s,r[e],hn[e],e)}})(n,r,e.transform),((e,t,n)=>{null!==n&&(se(n)?C(t,n,V.bind(null,e)):V(e,n))})(n,r,e.text),D(n,r,e.visible),((e,t,n)=>{for(let r=0;r<n.length;r++)A(1,t,n[r],z.bind(null,e))})(n,r,e.focus),((e,t,n)=>{for(let r=0;r<n.length;r++)A(1,t,n[r],M.bind(null,e))})(n,r,e.blur),e})();wt.replace(l),p.visible=!d.visible||d.visible.getState(),s||vt.length>0&&p.visible&&vt[vt.length-1].append.push(c)},e.handler=te,e.list=L,e.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),Y(e.map(t))),e.node=U,e.nodeMethod=e=>{let t;return U(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},e.remap=F,e.signalOwn=Y,e.spec=B,e.storeField=(e,t)=>{const n=e.map(T(q,t)),r=wt.get();return r&&f(r.signal,[n]),n},e.style=ee,e.text=K,e.transform=J,e.tree=function e({key:t,child:n,source:r},s){L({source:r,key:t},({store:r,key:l,signal:i})=>{const o=F(r,n);s({store:r,key:l,signal:i},()=>{e({key:t,child:n,source:o},s)})})},e.using=(e,t)=>{const n=e.namespaceURI,s=e.tagName.toLowerCase(),l='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=wt.get(),o={parent:i,signal:i&&i.signal?i.signal:h(),namespace:l,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};wt.replace(o),vt.push({node:e,append:[],reverse:0});try{r(o.signal,t)}finally{b(vt.pop()),wt.replace(i)}},e.variant=(e,t)=>{const n=c(i(Object.entries(t).map(([e,t])=>({key:e,val:t}))),e,(e,t)=>e.map(e=>({key:e.key,val:e.val,visible:e.key===t})));L({source:n,key:'key',visible:({visible:e})=>e,fn({store:e}){e.getState().val()}})},e.visible=Q,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)['effector-dom']={})})(this,(function(e){function t({node:e=[],from:t,source:n,parent:r=t||n,to:s,target:l,child:i=s||l,scope:o={},meta:a={},family:c={type:'regular'}}){const f=ze(r),u=ze(c.links),p=ze(c.owners),d=[],h={};for(let t=0;t<e.length;t++){const n=e[t];n&&(d.push(n),Me(n,h))}const g={seq:d,next:ze(i),meta:a,scope:o,family:{type:c.type||'crosslink',links:u,owners:p},reg:h};for(let e=0;e<u.length;e++)te(u[e]).push(g);for(let e=0;e<p.length;e++)ne(p[e]).push(g);for(let e=0;e<f.length;e++)f[e].next.push(g);return g}function n(e,t="combine"){let n=t+'(',r='',s=0;for(const t in e){const l=e[t];if(null!=l&&(n+=r,n+=se(l)?l.compositeName.fullName:l.toString()),s+=1,25===s)break;r=', '}return n+=')',n}function r(e,t){st={parent:st,value:e};try{return t()}finally{st=st.parent}}function s(e,n){const r=(e,...t)=>r.create(e,t,t);return r.graphite=t({meta:at('event',r,n,e)}),r.create=e=>(Ze(r,e),e),r.watch=ve(lt,r),r.map=e=>{let t,n;ae(e)&&(t=e,n=e.name,e=e.fn);const l=s(et(r,n),t);return ct(r,l,'map',e),l},r.filter=e=>ce(e)?(console.error('.filter(fn) is deprecated, use .filterMap instead'),l(r,e)):ft(r,'filter',e.fn,[Ie({fn:Pe})]),r.filterMap=ve(l,r),r.prepend=e=>{const t=s('* → '+r.shortName,{parent:r.parent});return ct(t,r,'prepend',e),(({parent:e},t)=>{e&&e.hooks.event(t)})(r,t),t},ut(r,r),rt(r)}function l(e,t){return ft(e,'filterMap',t,[Ae({fn:Pe}),Ne()])}function i(e,n){const r=_e(e),l=_e(e),o=s({named:'updates'}),a={subscribers:new Map,updates:o,defaultState:e,stateRef:r,getState:ve($e,r),setState(e){Ze({target:a,params:e,defer:1})},reset(...e){for(const t of e)a.on(t,()=>a.defaultState);return a},on:(e,t)=>(a.off(e),a.subscribers.set(e,tt(pt(e,a,'on',1,t))),a),off(e){const t=a.subscribers.get(e);return t&&(t(),a.subscribers.delete(e)),a},map(e,t){let n,r,s;ae(e)&&(n=e,r=e.name,t=e.firstState,e=e.fn);const l=a.getState();void 0!==l&&(s=e(l,t));const o=i(s,{name:et(a,r),config:n,strict:0});return pt(a,o,'map',0,e),o},[ge]:()=>ut(a,{})};if(a.graphite=t({scope:{state:r},node:[Ne(),Oe({store:r}),Ce({store:l}),Oe({store:l})],child:o,meta:at('store',a,n)}),ot&&void 0===e)throw Error("current state can't be undefined, use null instead");return a.watch=a.subscribe=(e,t)=>{if(!t||!se(e)){if(!ce(e))throw Error('watch requires function handler');return e(a.getState()),lt(a,e)}if(!ce(t))throw Error('second argument should be a function');return e.watch(e=>t(a.getState(),e))},Ve(a,[o]),rt(a)}function o(...e){if(0===e.length)throw Error('at least one argument required');let t,n,r,s,l;'ɔ'in e[0]&&(r=e[0].config,e=e[0].ɔ);{const r=e[e.length-1];ce(r)?(n=e.slice(0,-1),t=r):n=e}if(1===n.length){const e=n[0];ie(e)||(s=e,l=1)}return l||(s=n,t&&(t=dt(t))),Array.isArray(s)?ht(s,e=>e.slice(),[],r,t):ht(s,e=>Object.assign({},e),{},r,t)}function a(e,t){const n=vt(e);for(let e=0;e<t.length;e++){const r=vt(t[e]);r.family.type='crosslink';const s=kt(r),l=wt(n);s.includes(n)||s.push(n),l.includes(r)||l.push(r)}}function c(e,t){f(e,t),u(t,e)}function f(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function u(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function p(){const e={stack:null},n=yt.get(),r=t({node:[St,Et],parent:[n&&n.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=r,r}function d(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(Nt,'')}}function h(e){return String(e).replace(Ct,'')}function g({node:e,append:t,reverse:n=0}){if(0===t.length)return;const r=Ot.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)r.appendChild(t[e]);e.prepend(r)}else{for(let e=0;e<t.length;e++)r.appendChild(t[e]);e.appendChild(r)}}function m(e,t){t.parent=e,t.signal.seq.push(_t),t.signal.scope.stack=t,e.child.push(t)}function b(e,n){return t({node:[$t],parent:e,meta:{op:'watch'},scope:{fn:n},family:{type:'crosslink',owners:[e]}})}function y(){Tt=0,Vt()}function v(e,n,r){const l=++Ut,i=s(),o=ie(e)?e.updates:e,c={type:'crosslink',owners:[o,i]};return t({node:[Qt],parent:[o],scope:{taskID:l},family:c}),a(e,[i]),Wt.set(l,t({node:[en],child:[t({node:[Jt,Kt,Qt],scope:{taskID:l},family:c}),t({node:[Ht,Kt],child:[i],family:c})],scope:{fn:n},family:c})),Gt.set(l,r),i}function k({trigger:e=s(),fn:t,priority:n="low",timeout:r=1/0,batchWindow:l=0,retries:i=1/0,mark:o=e.shortName}){const a=e.map(e=>[{inserted:Pt(),retry:0,value:e}]);return{trigger:e,processed:v(a,(e,n)=>{let s,o=0;const a=[],c=[];for(s=0;s<e.length;s++){const i=e[s],f=Pt();if(i.inserted+l>f){c.push(i);continue}if(i.inserted+r<f)continue;if(f-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=s;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function w({trigger:e=s(),fn:t,priority:n="low",timeout:r=1/0,batchWindow:l=0,retries:i=1/0,mark:o=e.shortName,flatten:a}){const c=e.map(e=>{const t=[],n=Pt();for(let r=0;r<e.length;r++){const s=a(e[r]);for(let e=0;e<s.length;e++)t.push({inserted:n,retry:0,value:s[e]})}return t});return{trigger:e,processed:v(c,(e,n)=>{let s,o=0;const a=[],c=[];for(s=0;s<e.length;s++){const i=e[s],f=Pt();if(i.inserted+l>f){c.push(i);continue}if(i.inserted+r<f)continue;if(f-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=s;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function x(e,t,n){b(e,t.watch(n))}function S(e,n,r){t({node:[tn],parent:n,child:[nn],family:{type:'crosslink',owners:e},scope:{handler:r},meta:{op:'debounceRaf'}}),ie(n)&&Ze(nn,{data:n.getState(),handler:r},1)}function E(e,t,n,r){se(n)?(e?x:S)(t,n,r):r(n)}function N(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const r=N(t);if(r)return r}return null}function C(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=N(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=N(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function A(e){return''!==e&&0!==e&&(0==e||null==e)}function I(e,t,n){A(n)?delete e[t]:e[t]=`${n}`}function R(e,t,n,r){if(n.visible=r,r){if(!t.contains(e)){const r=C(n);r&&t.contains(r.targetElement)?r.targetElement.after(e):t.appendChild(e)}}else e.remove()}function O(e,t,n){if(null===n)return;const r=yt.get().parent.targetElement;S(t,n,R.bind(null,e,r,yt.get()))}function _(e,t,n){if(A(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function $(e,t,n,r,s,l){const i=e.createSVGTransform();switch(l){case'translate':case'scale':r=(e=>ie(e)?e:ie(e.x)?ie(e.y)?o({x:e.x,y:e.y}):e.x.map(on.bind(null,e.y)):ie(e.y)?e.y.map(an.bind(null,e.x)):e)(r)}E(0,t,r,s.bind(null,i)),n.appendItem(i)}function j(e,t){const n=Ot.createTextNode(`${t}`),r=e.firstChild;r?r.replaceWith(n):e.appendChild(n)}function D(e){e.focus()}function P(e){e.blur()}function V(e,t){return e.bind(null,t)}function z(e,t){const n=yt.get();if(Array.isArray(t)){const r=[];for(let n=0;n<t.length;n++)r[n]=e.map(V(M,t[n]));return n&&a(n.signal,r),r}if('object'==typeof t&&null!==t){const r=[],s={};for(const n in t)s[n]=e.map(V(M,t[n])),r.push(s[n]);return n&&a(n.signal,r),s}const r=e.map(V(M,t));return n&&a(n.signal,r),r}function M(e,t){return t[e]}function T(e,n=(()=>{})){let r;n=e.fn?e.fn:n;let l,o=0;ie(e)?(l=pn,r=e):(l=V(dn,e.key),r=e.source,o=!!e.reverse);const c=yt.get(),f=p(),u={parent:c,signal:f,namespace:c.namespace,targetElement:c.targetElement,svgRoot:c.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:o,key:ie(e)?{type:'index'}:{type:'key',key:e.key},store:r,cb:n},mountStatus:'initial',visible:1};m(c,u),yt.replace(u);const d={parentNode:c.targetElement,cb:n,shortName:r.shortName,reverse:o,parentStack:u,getID:l,fields:e.fields?e.fields:null,visible:e.visible?e.visible:null},h=i(F(d,[],r.getState()));a(f,[h]),b(f,V(gn,h)),((...e)=>{let n,r,l;'ɔ'in e[0]&&(l=e[0].config,e=e[0].ɔ);let[o,a,c,f=0]=e;if(void 0===a&&'source'in o){if('clock'in o&&null==o.clock)throw Error('config.clock should be defined');a=o.clock,c=o.fn,f=o.greedy,n=o.target,r=o.name,o=o.source}if(void 0===a&&(a=o),r=l||r||o.shortName,o=gt(o),a=gt(a),'boolean'==typeof c&&(f=c,c=null),n||(n=ie(o)&&ie(a)?i(c?c($e(re(o)),$e(re(a))):$e(re(o)),{name:r}):s(r)),ie(o))Ve(o,[rt(nt(a,n,{scope:{fn:c},node:[!f&&Se({priority:'sampler'}),Ee({store:re(o),to:c?'a':'stack'}),c&&Ae({fn:De})],meta:{op:'sample',sample:'store'}}))]);else{const e=_e(0),r=_e(),s=_e();rt(t({parent:o,node:[Oe({store:r}),Ee({from:'value',store:1,target:e})],family:{owners:[o,n,a],links:n},meta:{op:'sample',sample:'source'}})),Ve(o,[rt(nt(a,n,{scope:{fn:c},node:[Oe({store:s}),Ee({store:e}),Ie({fn:e=>e}),!f&&Se({priority:'sampler'}),Ee({store:r}),Ee({store:s,to:'a'}),c&&Ae({fn:je})],meta:{op:'sample',sample:'clock'}}))])}})({source:h,clock:r,fn:V(F,d),target:h}),yt.replace(c)}function F(e,t,n){const r=Array(n.length).fill(0),s=n.map(e.getID),l=[],o=[],d=[];for(let e=0;e<t.length;e++){const l=t[e],i=l.node,a=s.indexOf(i.key);-1!==a?(o.push(l),r[a]=1,i.store.getState()!==n[a]&&Ze({target:i.store,params:n[a],defer:1})):d.push(l)}if(d.length>0){for(let e=0;e<d.length;e++){const t=d[e],{node:n,locality:r}=t;n.active=0,n.store=null,c(r.sibling.left.ref,r.sibling.right.ref),f(t,null),u(t,null)}Ze({target:hn,params:d,defer:1})}let h=o.length>0?o[o.length-1]:null;for(let t=0;t<n.length;t++){if(r[t])continue;const s=n[t],f=i(s),u=p(),d=e.fields?z(f,e.fields):null;a(u,[f]);const g=e.getID(s,t),b={parent:e.parentStack,signal:u,namespace:e.parentStack.namespace,targetElement:e.parentStack.targetElement,svgRoot:e.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:f,signal:u,active:1,nodes:[],fields:d,visible:e.visible?[f.map(e.visible)]:[]},mountStatus:'initial',visible:1};c(h,b),h=b,m(e.parentStack,b),l.push(b),o.push(b)}return l.length>0&&Ze({target:un,params:{context:e,list:l},defer:1}),o}function q(e,t,n,r){const s=C(e);s&&r.contains(s.targetElement)?n?s.targetElement.before(t):s.targetElement.after(t):r.appendChild(t)}function L(e){const t=yt.get();return t&&a(t.signal,[e]),e}function W(e){const t=yt.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function X(e){const t=yt.get();t.targetElement.__STATIC__||e(t.targetElement)}function Y(e){e.attr&&G(e.attr),e.data&&U(e.data),e.transform&&B(e.transform),'text'in e&&Z(e.text),'visible'in e&&H(e.visible),(e.style||e.styleVar)&&J({prop:e.style,val:e.styleVar}),e.focus&&Q(e.focus),e.handler&&K(e.handler)}function G(e){W('attr'),yt.getElementNode().attr.push(e)}function U(e){W('data'),yt.getElementNode().data.push(e)}function B(e){W('transform'),yt.getElementNode().transform.push(e)}function Z(e){W('text'),yt.getElementNode().text.push(e)}function H(e){const t=yt.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);yt.getElementNode().visible.push(e)}function J({prop:e,val:t}){W('style'),e&&yt.getElementNode().styleProp.push(e),t&&yt.getElementNode().styleVar.push(t)}function K(e,t){W('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:r=0,prevent:s=0,stop:l=0}=e;yt.getElementNode().handler.push({options:{passive:n,capture:r,prevent:s,stop:l},map:t})}function Q({focus:e,blur:t}){W('focus');const n=yt.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}const ee=e=>e.graphite||e,te=e=>e.family.owners,ne=e=>e.family.links,re=e=>e.stateRef,se=e=>(ce(e)||ae(e))&&'kind'in e,le=e=>t=>se(t)&&t.kind===e,ie=le('store'),oe=le('domain'),ae=e=>'object'==typeof e&&null!==e,ce=e=>'function'==typeof e,fe=(e,t)=>{const n=e.indexOf(t);-1!==n&&e.splice(n,1)},ue=(e,t)=>{fe(e.next,t),fe(te(e),t),fe(ne(e),t)},pe=(e,t,n)=>{let r;e.next.length=0,e.seq.length=0,e.scope=null;let s=ne(e);for(;r=s.pop();)ue(r,e),(t||n&&!e.meta.sample||'crosslink'===r.family.type)&&pe(r,t,n);for(s=te(e);r=s.pop();)ue(r,e),n&&'crosslink'===r.family.type&&pe(r,t,n)},de=e=>e.clear(),he=(e,{deep:t}={})=>{let n=0;if(ie(e))de(e.subscribers);else if(oe(e)){n=1;const t=e.history;de(t.events),de(t.effects),de(t.stores),de(t.domains)}pe(ee(e),!!t,n)};var ge=(()=>{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 me=()=>{let e=0;return()=>(++e).toString(36)},be=me(),ye=me(),ve=(e,t)=>e.bind(null,t),ke=(e,t,n)=>e.bind(null,t,n),we=(e,t,n)=>({id:ye(),type:e,data:n,hasRef:t});let xe=0;const Se=({priority:e="barrier"})=>we('barrier',0,{barrierID:++xe,priority:e}),Ee=({from:e="store",store:t,target:n,to:r=(n?'store':'stack')})=>we('mov','store'===e,{from:e,store:t,to:r,target:n}),Ne=()=>we('check',0,{type:'defined'}),Ce=({store:e})=>we('check',1,{type:'changed',store:e}),Ae=ke(we,'compute',0),Ie=ke(we,'filter',0),Re=ke(we,'run',0),Oe=({store:e})=>Ee({from:'stack',target:e}),_e=e=>({id:ye(),current:e}),$e=({current:e})=>e,je=(e,{fn:t},{a:n})=>t(e,n),De=(e,{fn:t},{a:n})=>t(n,e),Pe=(e,{fn:t})=>t(e),Ve=(e,t)=>{const n=ee(e);for(let e=0;e<t.length;e++){const r=ee(t[e]);'domain'!==n.family.type&&(r.family.type='crosslink'),te(r).push(n),ne(n).push(r)}},ze=(e=[])=>{const t=[];if(Array.isArray(e))for(let n=0;n<e.length;n++)Array.isArray(e[n])?t.push(...e[n]):t.push(e[n]);else t.push(e);return t.map(ee)},Me=({hasRef:e,type:t,data:n},r)=>{let s;e&&(s=n.store,r[s.id]=s),'mov'===t&&'store'===n.to&&(s=n.target,r[s.id]=s)};let Te=null;const Fe=(e,t)=>{if(!e)return t;if(!t)return e;let n;const r=e.v.type===t.v.type;return(r&&e.v.id>t.v.id||!r&&'sampler'===e.v.type)&&(n=e,e=t,t=n),n=Fe(e.r,t),e.r=e.l,e.l=n,e},qe=[];let Le=0;for(;Le<5;)qe.push({first:null,last:null,size:0}),Le+=1;const We=()=>{for(let e=0;e<5;e++){const t=qe[e];if(t.size>0){if(2===e||3===e){t.size-=1;const e=Te.v;return Te=Fe(Te.l,Te.r),e}1===t.size&&(t.last=null);const n=t.first;return t.first=n.r,t.size-=1,n.v}}},Xe=(e,t,n,r)=>Ye(0,{a:null,b:null,node:t,parent:n,value:r},e),Ye=(e,t,n,r=0)=>{const s=Ge(n),l=qe[s],i={v:{idx:e,stack:t,type:n,id:r},l:0,r:0};2===s||3===s?Te=Fe(Te,i):(0===l.size?l.first=i:l.last.r=i,l.last=i),l.size+=1},Ge=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}},Ue=new Set;let Be=0;const Ze=(e,t,n)=>{if(e.target&&(t=e.params,n=e.defer,e=e.target),Array.isArray(e))for(let n=0;n<e.length;n++)Xe('pure',ee(e[n]),null,t[n]);else Xe('pure',ee(e),null,t);n&&Be||(()=>{const e=Be;Be=1;const t={stop:0};let n,r;e:for(;r=We();){const{idx:e,stack:s,type:l}=r;n=s.node;const i={skip:0,fail:0,ref:'',scope:n.scope};for(let r=e;r<n.seq.length&&!t.stop;r++){const o=n.seq[r],a=o.data;switch(o.type){case'barrier':{const t=a.barrierID,n=a.priority;if(r!==e||l!==n){Ue.has(t)||(Ue.add(t),Ye(r,s,n,t));continue e}Ue.delete(t);break}case'mov':{let e;switch(a.from){case'stack':e=s.value;break;case'a':e=s.a;break;case'b':e=s.b;break;case'value':e=a.store;break;case'store':e=$e(n.reg[a.store.id])}switch(a.to){case'stack':s.value=e;break;case'a':s.a=e;break;case'b':s.b=e;break;case'store':n.reg[a.target.id].current=e}break}case'check':switch(a.type){case'defined':i.skip=void 0===s.value;break;case'changed':i.skip=s.value===$e(n.reg[a.store.id])}break;case'filter':i.skip=!He(i,a,s);break;case'run':if(r!==e||'effect'!==l){Ye(r,s,'effect');continue e}case'compute':s.value=He(i,a,s)}t.stop=i.fail||i.skip}if(!t.stop)for(let e=0;e<n.next.length;e++)Xe('child',n.next[e],s,s.value);t.stop=0}Be=e})()},He=(e,{fn:t},n)=>{try{return t(n.value,e.scope,n)}catch(t){console.error(t),e.fail=1}},Je=(e,t={})=>(ae(e)&&(Je(e.config,t),null!=e.name&&(ae(e.name)?Je(e.name,t):t.name=e.name),e.loc&&(t.loc=e.loc),e.sid&&(t.sid=e.sid),e.handler&&(t.handler=e.handler),e.parent&&(t.parent=e.parent),'strict'in e&&(t.strict=e.strict),e.named&&(t.named=e.named),Je(e.ɔ,t)),t),Ke=Je,Qe=(e,t)=>''+e.shortName+t,et=(e,t)=>null==t?Qe(e,' → *'):t,tt=e=>{const t=ke(he,e,void 0);return t.unsubscribe=t,t},nt=(e,n,{node:r,scope:s,meta:l})=>t({node:r,parent:e,child:n,scope:s,meta:l,family:{owners:[e,n],links:n}}),rt=e=>(st&&Ve(st.value,[e]),e);let st=null;const lt=(e,n)=>tt(rt(t({scope:{fn:n},node:[Re({fn:Pe})],parent:e,meta:{op:'watch'},family:{owners:e}})));let ot;const at=(e,t,n,r)=>{const s=Ke({name:r,config:n}),l=be(),{parent:i=null,sid:o=null,strict:a=1,named:c=null}=s,f=c||s.name||('domain'===e?'':l),u=((e,t)=>{let n,r,s;const l=e;return t?(s=t.compositeName,0===e.length?(n=s.path,r=s.fullName):(n=s.path.concat([e]),r=0===s.fullName.length?e:s.fullName+'/'+e)):(n=0===e.length?[]:[e],r=e),{shortName:l,fullName:r,path:n}})(f,i);return t.kind=e,t.id=l,t.sid=o,t.shortName=f,t.parent=i,t.compositeName=u,t.defaultConfig=s,t.thru=e=>e(t),t.getType=()=>u.fullName,ot=a,{unit:e,name:f,sid:o,named:c}},ct=(e,t,n,r)=>nt(e,t,{scope:{fn:r},node:[Ae({fn:Pe})],meta:{op:n}}),ft=(e,t,n,r)=>{let l;ae(n)&&(l=n,n=n.fn);const i=s(Qe(e,' →? *'),l);return nt(e,i,{scope:{fn:n},node:r,meta:{op:t}}),i},ut=(e,t)=>(t.subscribe=t=>((e=>{if(!ae(e)&&!ce(e))throw Error('expect value to be an object')})(t),e.watch(e=>{t.next&&t.next(e)})),t[ge]=()=>t,t),pt=(e,{graphite:t,stateRef:n},r,s,l)=>nt(e,t,{scope:{fn:l},node:[Ee({store:n,to:'a'}),Ae({fn:s?De:je}),Ne(),Ce({store:n}),Oe({store:n})],meta:{op:r}}),dt=e=>t=>e(...t),ht=(e,t,r,s,l)=>{const o=t(r),a=i(o,{name:s||n(e)}),c=_e(o),f=_e(1),u=[Ne(),Ee({store:c,to:'a'}),Ie({fn:(e,{key:t},{a:n})=>e!==n[t]}),Ee({store:f,to:'b'}),Ae({fn(e,{clone:t,key:n},r){r.b&&(r.a=t(r.a)),r.a[n]=e}}),Ee({from:'a',target:c}),Ee({from:'value',store:0,target:f}),Se({priority:'barrier'}),Ee({from:'value',store:1,target:f}),Ee({store:c}),l&&Ae({fn:l}),Ce({store:re(a)})];for(const n in e){const s=e[n];ie(s)?(r[n]=s.defaultState,o[n]=s.getState(),nt(s,a,{scope:{key:n,clone:t},node:u,meta:{op:'combine'}})):o[n]=r[n]=s}return a.defaultShape=e,a.defaultState=l?re(a).current=l(o):r,a},gt=(t({node:[Re({fn({fn:e,value:t}){e(t)}})],meta:{op:'fx',fx:'sidechain'}}),e=>se(e)?e:o(e)),mt=(Ie({fn:(e,{state:t})=>void 0!==e&&e!==$e(t)}),Ae({fn:e=>e}),[]);let bt;const yt={get:()=>bt,replace(e){bt=e},getElementNode:()=>bt.node},vt=e=>e.graphite||e,kt=e=>e.family.owners,wt=e=>e.family.links,xt=t({node:[Re({fn(e){he(e)}})]}),St=Ae({fn(e,t){t.self.next.push(xt);const{stack:n}=t,{parent:r}=n,{left:s,right:l}=n.locality.sibling;r&&(r.locality.child.last.ref===n&&(r.locality.child.last.ref=s.ref),r.locality.child.first.ref===n&&(r.locality.child.first.ref=l.ref)),s.ref&&s.ref.locality.sibling.right.ref===n&&l.ref&&l.ref.locality.sibling.left.ref===n?c(s.ref,l.ref):s.ref&&s.ref.locality.sibling.right.ref===n?f(s.ref,null):l.ref&&l.ref.locality.sibling.left.ref===n&&u(l.ref,null)}}),Et=Ae({fn:(e,{self:t})=>t}),Nt=/[^a-zA-Z0-9\-]/g,Ct=/[\\<>"]/g;class At{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[d(e)]=h(t)}removeProperty(e){delete this.properties[d(e)]}}class It{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class Rt{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}(new class{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new At,this.firstChild=null,this.transform={baseVal:new It},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[d(e)]=h(t)}removeAttribute(e){delete this.attributes[d(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new Rt}}).isBody=1;let Ot='undefined'!=typeof document?document:null;const _t=Ae({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const r=n.parent.child.indexOf(n);return-1!==r&&n.parent.child.splice(r,1),n.parent=null,e}}),$t=Re({fn(e,{fn:t}){t(e)}});let jt,Dt,Pt;jt=()=>{},Dt=()=>{},Pt='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const Vt=s();let zt,Mt=0,Tt=0;const Ft='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),qt='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Lt=()=>{Tt||(Tt=1,zt=Ft(y))},Wt=new Map,Xt=new Map,Yt=new Map,Gt=new Map;let Ut=0,Bt=0;const Zt=t({node:[Re({fn:()=>{}}),Ie({fn:()=>0===Xt.size&&0===Yt.size?0:Pt()-Bt>=10?0:(qt(zt),Mt=1,Tt=0,1)})],child:[Vt]});Vt.watch(()=>{if(Tt)return;if(0===Xt.size&&0===Yt.size)return void(Mt=0);let e=0;Mt||(Bt=Pt()),Mt=0;for(const[t,n]of Xt){if(Pt()-Bt>=10){Lt(),e=1;break}Xt.delete(t),Ze({target:Wt.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Yt){if(Pt()-Bt>=10){Lt(),e=1;break}Yt.delete(t),Ze({target:Wt.get(t),params:n,defer:1})}Ze({target:Zt,params:null,defer:1})});const Ht=Ae({fn:({done:e})=>e}),Jt=Ae({fn:({fail:e})=>e}),Kt=Ie({fn:e=>e.length>0}),Qt=Ae({fn(e,{taskID:t}){const n='high'===Gt.get(t)?Xt:Yt;let r=n.get(t);r||(r=[],n.set(t,r));for(let t=0;t<e.length;t++)r.push(e[t]);Lt()}}),en=Re({fn:(e,{fn:t})=>t(e,Bt)}),tn=Re({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:nn}=k({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),rn=(e,{map:t,options:n})=>{for(const r in t)e.removeEventListener(r,t[r],n)},sn=(e,t,n)=>{A(n)?delete e[t]:e[t]=n},ln=(e,t,n)=>{A(n)?e.removeProperty(t):e.setProperty(t,n)},on=(e,t)=>({x:t,y:e}),an=(e,t)=>({x:e,y:t}),cn={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:fn}=k({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const r=Ot.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)r.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)r.appendChild(n.appended[e]);q(n.listItemStack,r,e.reverse,e.node)}}}),{trigger:un}=k({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:i}=e,o=yt.get();yt.replace(n);const a=[],c=[];mt.push({node:s,append:c,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],o=n.node;if(o.active){yt.replace(n),r(n.signal,V(l,o));for(let e=0;e<c.length;e++)o.nodes.push(c[e]);o.visible.length>0?r(n.signal,()=>{const e=o.visible[o.visible.length-1];e.updates.watch(e=>{if(0!=o.active)if(e){const e=Ot.createDocumentFragment();if(i)for(let t=o.nodes.length-1;t>=0;t--)e.appendChild(o.nodes[t]);else for(let t=0;t<o.nodes.length;t++)e.appendChild(o.nodes[t]);q(n,e,i,s)}else for(let e=0;e<o.nodes.length;e++)o.nodes[e].remove()}),e.getState()&&a.push({listItemStack:n,appended:c.slice(),listItem:o})}):a.push({listItemStack:n,appended:c.slice(),listItem:o}),c.length=0}}mt.pop(),a.length>0&&Ze({target:fn,params:{node:s,append:a,reverse:i},defer:1}),yt.replace(o)}}),pn=(e,t)=>t,dn=(e,t)=>t[e],hn=s();w({trigger:hn,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&Ze({target:e,params:null,defer:0})}}),w({trigger:hn,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const gn=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}Ze({target:hn,params:t,defer:1})};e.attr=G,e.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),L(o(e,t))),e.data=U,e.explicitUnmount=e=>{const n=yt.get();n&&t({node:[],parent:e,child:n.signal,family:{type:'crosslink',owners:[n.signal,e]}})},e.focus=Q,e.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,l=yt.get(),i=l?l.namespace:'html';let o=i,a='html';'type'in t?(a=t.type,o=t.type):o=a='svg'===i?'svg':'html','svg'===e&&(a='svg',o='svg');const c='svg'===a?Ot.createElementNS('http://www.w3.org/2000/svg',e):Ot.createElement(e);'foreignObject'===i?(c.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===e?(c.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===e&&(o='foreignObject');const f=p(),u={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},d={parent:null,signal:f,namespace:o,targetElement:c,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:u,mountStatus:'initial',visible:1};l&&m(l,d),'svg'===e?d.svgRoot=c:l&&(d.svgRoot=l.svgRoot),yt.replace(d),n?((e,t,n,s)=>{let l=0;mt.push({node:t,append:[],reverse:0});try{r(e,s),l=1}finally{g(mt.pop()),l||yt.replace(n)}})(f,c,l,n):(u.pure=1,Y(t));const h=(()=>{const e=(()=>{const e=yt.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:r,map:s}=e.handler[n];r.passive=r.prevent?0:r.passive;for(const e in s){const t=s[e];s[e]=e=>{r.prevent&&e.preventDefault(),r.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:r,map:s})}for(let n=0;n<e.attr.length;n++){const r=e.attr[n];for(const e in r)'xlink:href'===e?t.attr.href=r[e]:t.attr[e]=r[e]}for(let n=0;n<e.data.length;n++){const r=e.data[n];for(const e in r)t.data[e]=r[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const r=e.styleVar[n];for(const e in r)t.styleVar[e]=r[e]}for(let n=0;n<e.styleProp.length;n++){const r=e.styleProp[n];for(const e in r)t.styleProp[e]=r[e]}return t})(),t=yt.get(),n=t.targetElement,r=t.signal;return((e,t,n)=>{for(const r in n)E('value'!==r&&'checked'!==r&&'min'!==r&&'max'!==r,t,n[r],_.bind(null,e,r))})(n,r,e.attr),((e,t,n)=>{for(const r in n)E(0,t,n[r],I.bind(null,e.dataset,r))})(n,r,e.data),((e,t,n)=>{for(let r=0;r<n.length;r++){const{options:s,map:l}=n[r];for(const t in l)e.addEventListener(t,l[t],s);b(t,rn.bind(null,e,n[r]))}})(n,r,e.handler),((e,t,n)=>{const r=e.style;for(const e in n)E(0,t,n[e],sn.bind(null,r,e))})(n,r,e.styleProp),((e,t,n)=>{const r=e.style;for(const e in n)E(0,t,n[e],ln.bind(null,r,`--${e}`))})(n,r,e.styleVar),((e,t,n)=>{const r=yt.get();if('svg'!==r.namespace)return;if(0===n.length)return;const s=e.transform.baseVal,l=r.svgRoot;for(let e=0;e<n.length;e++){const r=n[e];for(const e in r)$(l,t,s,r[e],cn[e],e)}})(n,r,e.transform),((e,t,n)=>{null!==n&&(se(n)?S(t,n,j.bind(null,e)):j(e,n))})(n,r,e.text),O(n,r,e.visible),((e,t,n)=>{for(let r=0;r<n.length;r++)E(1,t,n[r],D.bind(null,e))})(n,r,e.focus),((e,t,n)=>{for(let r=0;r<n.length;r++)E(1,t,n[r],P.bind(null,e))})(n,r,e.blur),e})();yt.replace(l),d.visible=!h.visible||h.visible.getState(),s||mt.length>0&&d.visible&&mt[mt.length-1].append.push(c)},e.handler=K,e.list=T,e.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),L(e.map(t))),e.node=X,e.nodeMethod=e=>{let t;return X(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},e.remap=z,e.signalOwn=L,e.spec=Y,e.storeField=(e,t)=>{const n=e.map(V(M,t)),r=yt.get();return r&&a(r.signal,[n]),n},e.style=J,e.text=Z,e.transform=B,e.tree=function e({key:t,child:n,source:r},s){T({source:r,key:t},({store:r,key:l,signal:i})=>{const o=z(r,n);s({store:r,key:l,signal:i},()=>{e({key:t,child:n,source:o},s)})})},e.using=(e,t)=>{const n=e.namespaceURI,s=e.tagName.toLowerCase(),l='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=yt.get(),o={parent:i,signal:i&&i.signal?i.signal:p(),namespace:l,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};yt.replace(o),mt.push({node:e,append:[],reverse:0});try{r(o.signal,t)}finally{g(mt.pop()),yt.replace(i)}},e.variant=(e,t)=>{const n=o(i(Object.entries(t).map(([e,t])=>({key:e,val:t}))),e,(e,t)=>e.map(e=>({key:e.key,val:e.val,visible:e.key===t})));T({source:n,key:'key',visible:({visible:e})=>e,fn({store:e}){e.getState().val()}})},e.visible=H,Object.defineProperty(e,'__esModule',{value:1})})); | ||
//# sourceMappingURL=effector-dom.umd.js.map |
{ | ||
"name": "effector-dom", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Effector package for working with dom", | ||
@@ -12,3 +12,3 @@ "main": "effector-dom.cjs.js", | ||
"peerDependencies": { | ||
"effector": "^20.11.5" | ||
"effector": "^20.12.0" | ||
}, | ||
@@ -23,3 +23,5 @@ "keywords": [ | ||
"data", | ||
"state" | ||
"state", | ||
"dom", | ||
"view" | ||
], | ||
@@ -26,0 +28,0 @@ "author": "Zero Bias", |
@@ -1,2 +0,2 @@ | ||
function e(e){return`-${e.toLowerCase()}`}function t(e){switch(e){case'&':return'&';case'<':return'<';case'>':return'>';case'"':return'"';case"'":return''';default:return e}}function n(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(K,'')}}function s(e){return String(e).replace(Q,'')}function r(){return new ne}function i(t){const r=[];(function t(r,i){if(null!==r.textContent&&i.push(r.textContent),r.isFragment){let e=r.firstChild;for(;e;)t(e,i),e=e.sibling.right;return}i.push('<',r.tagName);for(const e in r.attributes)i.push(' ',e,'=','"',s(r.attributes[e]),'"');for(const t in r.dataset)i.push(' ','data-',n(t).replace(ee,e),'=','"',s(r.dataset[t]),'"');const l=[];for(const e in r.style.properties)if(e.startsWith('--'))l.push(`${e}: ${r.style.properties[e]}`);else{const t=e.replace(/[A-Z]/,e=>`-${e.toLowerCase()}`);l.push(`${t}: ${r.style.properties[e]}`)}if(l.length>0&&i.push(' ','style','=','"',l.join(';'),'"'),r.transform.baseVal.items.length>0){i.push(' ','transform','=','"');const e=r.transform.baseVal.items.map(({value:e})=>e);i.push(e.join(' '),'"')}if(!r.firstChild)return void i.push('meta'===r.tagName||'link'===r.tagName?'>':'/>');i.push('>');let o=r.firstChild;for(;o;)t(o,i),o=o.sibling.right;i.push('</',r.tagName,'>')})(t,r);const i=r.join('');return function e(t){if('html'===t.tagName)return 1;if(t.isFragment&&null===t.textContent){const n=t.firstChild;if(n&&t.child.last===n)return e(n)}return 0}(t)?`<!DOCTYPE html>${i}`:i}function l(e,t){const n=ue(e);for(let e=0;e<t.length;e++){const s=ue(t[e]);s.family.type='crosslink';const r=he(s),i=de(n);r.includes(n)||r.push(n),i.includes(s)||i.push(s)}}function o(e,t){a(e,t),c(t,e)}function a(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function c(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function p(){const e={stack:null},t=fe.get(),n=effector.createNode({node:[me,be],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function f(e,t){const n=e.namespaceURI,s=e.tagName.toLowerCase(),r='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=fe.get(),l={parent:i,signal:i&&i.signal?i.signal:p(),namespace:r,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};fe.replace(l),ce.push({node:e,append:[],reverse:0});try{effector.withRegion(l.signal,t)}finally{u(ce.pop()),fe.replace(i)}}function u({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=ae.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function h(e,t){t.parent=e,t.signal.seq.push(ye),t.signal.scope.stack=t,e.child.push(t)}function d(e,t){return effector.createNode({node:[ve],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function g(){Ce=0,Ee()}function m(e,t,n){const s=(e=>'high'===De.get(e)?Ae:Oe)(e);let r=s.get(e);if(r||(r=[],s.set(e,r)),t)for(let e=0;e<n.length;e++)r.push(n[e]);else r.push(n);Ie()}function b(e,t,n=0,s="low"){const r=++Pe,i=effector.createEvent(),o=effector.is.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,i]};return effector.createNode({node:[qe],parent:[o],scope:{taskID:r,flat:n},family:c}),l(e,[i]),Re.set(r,effector.createNode({node:[ze],child:[effector.createNode({node:[je,Me,Le],scope:{taskID:r},family:c}),effector.createNode({node:[Te,Me],child:[i],family:c})],scope:{fn:t},family:c})),De.set(r,s),i}function y({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName}){const o=b(e.map(e=>[{inserted:ke(),retry:0,value:e}]),(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],p=ke();if(i.inserted+r>p){c.push(i);continue}if(i.inserted+s<p)continue;if(p-n>=10){o=1;break}const f=t(i.value);void 0!==f&&a.push(f)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:o,connect:t=>{effector.createNode({node:[],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function v({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName,flatten:o}){const a=b(e.map(e=>{const t=[],n=ke();for(let s=0;s<e.length;s++){const r=o(e[s]);for(let e=0;e<r.length;e++)t.push({inserted:n,retry:0,value:r[e]})}return t}),(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],p=ke();if(i.inserted+r>p){c.push(i);continue}if(i.inserted+s<p)continue;if(p-n>=10){o=1;break}const f=t(i.value);void 0!==f&&a.push(f)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[We],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function w(e,t,n){d(e,t.watch(n))}function x(e,t,n){effector.createNode({node:[Ye],parent:t,child:[Ue],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ue,{data:t.getState(),handler:n},1)}function k(e,t,n,s){effector.is.unit(n)?(e?w:x)(t,n,s):s(n)}function E(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=E(t);if(s)return s}return null}function N(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=E(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=E(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function S(e){return''!==e&&0!==e&&(0==e||null==e)}function C(e,t,n){S(n)?delete e[t]:e[t]=`${n}`}function $(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=N(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function _(e,t,n){if(null===n)return;const s=fe.get().parent.targetElement;x(t,n,$.bind(null,e,s,fe.get()))}function I(e,t,n){if(S(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function R(e,t,n,s,r,i){const l=e.createSVGTransform();switch(i){case'translate':case'scale':s=(e=>effector.is.store(e)?e:effector.is.store(e.x)?effector.is.store(e.y)?effector.combine({x:e.x,y:e.y}):e.x.map(Be.bind(null,e.y)):effector.is.store(e.y)?e.y.map(He.bind(null,e.x)):e)(s)}k(0,t,s,r.bind(null,l)),n.appendItem(l)}function A(e,t){const n=ae.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function O(e){e.focus()}function D(e){e.blur()}function P(e,t){return e.bind(null,t)}function F(e,t){const n=fe.get();if(Array.isArray(t)){const s=[];for(let n=0;n<t.length;n++)s[n]=e.map(P(V,t[n]));return n&&l(n.signal,s),s}if('object'==typeof t&&null!==t){const s=[],r={};for(const n in t)r[n]=e.map(P(V,t[n])),s.push(r[n]);return n&&l(n.signal,s),r}const s=e.map(P(V,t));return n&&l(n.signal,s),s}function V(e,t){return t[e]}function T(e,t=(()=>{})){let n;t=e.fn?e.fn:t;let s,r=0;effector.is.store(e)?(s=et,n=e):(s=P(tt,e.key),n=e.source,r=!!e.reverse);const i=fe.get(),o=p(),a={parent:i,signal:o,namespace:i.namespace,targetElement:i.targetElement,svgRoot:i.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},store:n,cb:t},mountStatus:'initial',visible:1};h(i,a),fe.replace(a);const c={parentNode:i.targetElement,cb:t,shortName:n.shortName,reverse:r,parentStack:a,getID:s,fields:e.fields?e.fields:null,visible:e.visible?e.visible:null},f=effector.createStore(j(c,[],n.getState()));l(o,[f]),d(o,P(st,f)),effector.sample({source:f,clock:n,fn:P(j,c),target:f}),fe.replace(i)}function j(e,t,n){const s=Array(n.length).fill(0),r=n.map(e.getID),i=[],f=[],u=[];for(let e=0;e<t.length;e++){const i=t[e],l=i.node,o=r.indexOf(l.key);-1!==o?(f.push(i),s[o]=1,l.store.getState()!==n[o]&&effector.launch({target:l.store,params:n[o],defer:1})):u.push(i)}if(u.length>0){for(let e=0;e<u.length;e++){const t=u[e],{node:n,locality:s}=t;n.active=0,n.store=null,o(s.sibling.left.ref,s.sibling.right.ref),a(t,null),c(t,null)}effector.launch({target:nt,params:u,defer:1})}let d=f.length>0?f[f.length-1]:null;for(let t=0;t<n.length;t++){if(s[t])continue;const r=n[t],a=effector.createStore(r),c=p(),u=e.fields?F(a,e.fields):null;l(c,[a]);const g=e.getID(r,t),m={parent:e.parentStack,signal:c,namespace:e.parentStack.namespace,targetElement:e.parentStack.targetElement,svgRoot:e.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:a,signal:c,active:1,nodes:[],fields:u,visible:e.visible?[a.map(e.visible)]:[]},mountStatus:'initial',visible:1};o(d,m),d=m,h(e.parentStack,m),i.push(m),f.push(m)}return i.length>0&&effector.launch({target:Qe,params:{context:e,list:i},defer:1}),f}function M(e,t,n,s){const r=N(e);r&&s.contains(r.targetElement)?n?r.targetElement.before(t):r.targetElement.after(t):s.appendChild(t)}function L(e){const t=fe.get();return t&&l(t.signal,[e]),e}function q(e){const t=fe.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function z(e){const t=fe.get();t.targetElement.__STATIC__||e(t.targetElement)}function W(e){e.attr&&Y(e.attr),e.data&&U(e.data),e.transform&&X(e.transform),'text'in e&&G(e.text),'visible'in e&&Z(e.visible),(e.style||e.styleVar)&&B({prop:e.style,val:e.styleVar}),e.focus&&J(e.focus),e.handler&&H(e.handler)}function Y(e){q('attr'),fe.getElementNode().attr.push(e)}function U(e){q('data'),fe.getElementNode().data.push(e)}function X(e){q('transform'),fe.getElementNode().transform.push(e)}function G(e){q('text'),fe.getElementNode().text.push(e)}function Z(e){const t=fe.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);fe.getElementNode().visible.push(e)}function B({prop:e,val:t}){q('style'),e&&fe.getElementNode().styleProp.push(e),t&&fe.getElementNode().styleVar.push(t)}function H(e,t){q('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0,prevent:r=0,stop:i=0}=e;fe.getElementNode().handler.push({options:{passive:n,capture:s,prevent:r,stop:i},map:t})}function J({focus:e,blur:t}){q('focus');const n=fe.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const K=/[^a-zA-Z0-9\-]/g,Q=/[\\<>"]/g,ee=/[A-Z]/g,te=/[&<>'"]/g;class ne{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new se,this.firstChild=null,this.transform={baseVal:new re},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[n(e)]=s(t)}removeAttribute(e){delete this.attributes[n(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new ie}}class se{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[n(e)]=s(t)}removeProperty(e){delete this.properties[n(e)]}}class re{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ie{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}const le=new ne;le.isBody=1;var oe={__proto__:null,body:le,createTextNode:e=>{const n=new ne;return n.textContent=String(e).replace(te,t),n},createElement:e=>{const t=new ne;return t.tagName=n(e),t.isFragment=0,t},createElementNS:(e,t)=>{switch(e){case'http://www.w3.org/1999/xhtml':case'http://www.w3.org/2000/svg':break;default:e='http://www.w3.org/1999/xhtml'}const s=new ne;return s.tagName=n(t),s.namespaceURI=e,s.isFragment=0,s},createDocumentFragment:r,render:i};let ae='undefined'!=typeof document?document:null;const ce=[];let pe;const fe={get:()=>pe,replace(e){pe=e},getElementNode:()=>pe.node},ue=e=>e.graphite||e,he=e=>e.family.owners,de=e=>e.family.links,ge=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),me=effector.step.compute({fn(e,t){t.self.next.push(ge);const{stack:n}=t,{parent:s}=n,{left:r,right:i}=n.locality.sibling;s&&(s.locality.child.last.ref===n&&(s.locality.child.last.ref=r.ref),s.locality.child.first.ref===n&&(s.locality.child.first.ref=i.ref)),r.ref&&r.ref.locality.sibling.right.ref===n&&i.ref&&i.ref.locality.sibling.left.ref===n?o(r.ref,i.ref):r.ref&&r.ref.locality.sibling.right.ref===n?a(r.ref,null):i.ref&&i.ref.locality.sibling.left.ref===n&&c(i.ref,null)}}),be=effector.step.compute({fn:(e,{self:t})=>t}),ye=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),ve=effector.step.run({fn(e,{fn:t}){t(e)}});let we,xe,ke;we=()=>{},xe=()=>{},ke='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const Ee=effector.createEvent();let Ne,Se=0,Ce=0;const $e='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),_e='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Ie=()=>{Ce||(Ce=1,Ne=$e(g))},Re=new Map,Ae=new Map,Oe=new Map,De=new Map;let Pe=0,Fe=0;const Ve=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===Ae.size&&0===Oe.size?0:ke()-Fe>=10?0:(_e(Ne),Se=1,Ce=0,1)})],child:[Ee]});Ee.watch(()=>{if(Ce)return;if(0===Ae.size&&0===Oe.size)return void(Se=0);let e=0;Se||(Fe=ke()),Se=0;for(const[t,n]of Ae){if(ke()-Fe>=10){Ie(),e=1;break}Ae.delete(t),effector.launch({target:Re.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Oe){if(ke()-Fe>=10){Ie(),e=1;break}Oe.delete(t),effector.launch({target:Re.get(t),params:n,defer:1})}effector.launch({target:Ve,params:null,defer:1})});const Te=effector.step.compute({fn:({done:e})=>e}),je=effector.step.compute({fn:({fail:e})=>e}),Me=effector.step.filter({fn:e=>e.length>0}),Le=effector.step.compute({fn(e,{taskID:t}){m(t,1,e)}}),qe=effector.step.compute({fn(e,{taskID:t,flat:n}){m(t,n,e)}}),ze=effector.step.run({fn:(e,{fn:t})=>t(e,Fe)}),We=effector.step.compute({fn:e=>[e]}),Ye=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ue}=y({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Xe=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Ge=(e,t,n)=>{S(n)?delete e[t]:e[t]=n},Ze=(e,t,n)=>{S(n)?e.removeProperty(t):e.setProperty(t,n)},Be=(e,t)=>({x:t,y:e}),He=(e,t)=>({x:e,y:t}),Je={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Ke}=y({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=ae.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);M(n.listItemStack,s,e.reverse,e.node)}}}),{trigger:Qe}=y({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:r,reverse:i}=e,l=fe.get();fe.replace(n);const o=[],a=[];ce.push({node:s,append:a,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],l=n.node;if(l.active){fe.replace(n),effector.withRegion(n.signal,P(r,l));for(let e=0;e<a.length;e++)l.nodes.push(a[e]);l.visible.length>0?effector.withRegion(n.signal,()=>{const e=l.visible[l.visible.length-1];e.updates.watch(e=>{if(0!=l.active)if(e){const e=ae.createDocumentFragment();if(i)for(let t=l.nodes.length-1;t>=0;t--)e.appendChild(l.nodes[t]);else for(let t=0;t<l.nodes.length;t++)e.appendChild(l.nodes[t]);M(n,e,i,s)}else for(let e=0;e<l.nodes.length;e++)l.nodes[e].remove()}),e.getState()&&o.push({listItemStack:n,appended:a.slice(),listItem:l})}):o.push({listItemStack:n,appended:a.slice(),listItem:l}),a.length=0}}ce.pop(),o.length>0&&effector.launch({target:Ke,params:{node:s,append:o,reverse:i},defer:1}),fe.replace(l)}}),et=(e,t)=>t,tt=(e,t)=>t[e],nt=effector.createEvent();v({trigger:nt,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch({target:e,params:null,defer:0})}}),v({trigger:nt,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const st=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch({target:nt,params:t,defer:1})};ae=oe,exports.attr=Y,exports.body=le,exports.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),L(effector.combine(e,t))),exports.createDocumentFragment=r,exports.data=U,exports.explicitUnmount=e=>{const t=fe.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=J,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,r=fe.get(),i=r?r.namespace:'html';let l=i,o='html';'type'in t?(o=t.type,l=t.type):l=o='svg'===i?'svg':'html','svg'===e&&(o='svg',l='svg');const a='svg'===o?ae.createElementNS('http://www.w3.org/2000/svg',e):ae.createElement(e);'foreignObject'===i?(a.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),l='html'):'svg'===e?(a.setAttribute('xmlns','http://www.w3.org/2000/svg'),l='svg'):'foreignObject'===e&&(l='foreignObject');const c=p(),f={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:c,namespace:l,targetElement:a,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:f,mountStatus:'initial',visible:1};r&&h(r,g),'svg'===e?g.svgRoot=a:r&&(g.svgRoot=r.svgRoot),fe.replace(g),n?((e,t,n,s)=>{let r=0;ce.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),r=1}finally{u(ce.pop()),r||fe.replace(n)}})(c,a,r,n):(f.pure=1,W(t));const m=(()=>{const e=(()=>{const e=fe.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:s,map:r}=e.handler[n];s.passive=s.prevent?0:s.passive;for(const e in r){const t=r[e];r[e]=e=>{s.prevent&&e.preventDefault(),s.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:s,map:r})}for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=fe.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)k('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],I.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)k(0,t,n[s],C.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:r,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],r);d(t,Xe.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)k(0,t,n[e],Ge.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)k(0,t,n[e],Ze.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=fe.get();if('svg'!==s.namespace)return;if(0===n.length)return;const r=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)R(i,t,r,s[e],Je[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?x(t,n,A.bind(null,e)):A(e,n))})(n,s,e.text),_(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)k(1,t,n[s],O.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)k(1,t,n[s],D.bind(null,e))})(n,s,e.blur),e})();fe.replace(r),g.visible=!m.visible||m.visible.getState(),s||ce.length>0&&g.visible&&ce[ce.length-1].append.push(a)},exports.handler=H,exports.list=T,exports.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),L(e.map(t))),exports.node=z,exports.nodeMethod=e=>{let t;return z(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=F,exports.render=i,exports.renderStatic=e=>{const t=r();return f(t,e),new Promise(e=>setTimeout(e,800)).then(()=>i(t))},exports.signalOwn=L,exports.spec=W,exports.storeField=(e,t)=>{const n=e.map(P(V,t)),s=fe.get();return s&&l(s.signal,[n]),n},exports.style=B,exports.text=G,exports.transform=X,exports.tree=function e({key:t,child:n,source:s},r){T({source:s,key:t},({store:s,key:i,signal:l})=>{const o=F(s,n);r({store:s,key:i,signal:l},()=>{e({key:t,child:n,source:o},r)})})},exports.using=f,exports.visible=Z; | ||
function e(e){return`-${e.toLowerCase()}`}function t(e){switch(e){case'&':return'&';case'<':return'<';case'>':return'>';case'"':return'"';case"'":return''';default:return e}}function n(e){switch(e=String(e)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return e.replace(J,'')}}function s(e){return String(e).replace(K,'')}function r(){return new te}function i(t){const r=[];(function t(r,i){if(null!==r.textContent&&i.push(r.textContent),r.isFragment){let e=r.firstChild;for(;e;)t(e,i),e=e.sibling.right;return}i.push('<',r.tagName);for(const e in r.attributes)i.push(' ',e,'=','"',s(r.attributes[e]),'"');for(const t in r.dataset)i.push(' ','data-',n(t).replace(Q,e),'=','"',s(r.dataset[t]),'"');const l=[];for(const e in r.style.properties)if(e.startsWith('--'))l.push(`${e}: ${r.style.properties[e]}`);else{const t=e.replace(/[A-Z]/,e=>`-${e.toLowerCase()}`);l.push(`${t}: ${r.style.properties[e]}`)}if(l.length>0&&i.push(' ','style','=','"',l.join(';'),'"'),r.transform.baseVal.items.length>0){i.push(' ','transform','=','"');const e=r.transform.baseVal.items.map(({value:e})=>e);i.push(e.join(' '),'"')}if(!r.firstChild)return void i.push('meta'===r.tagName||'link'===r.tagName?'>':'/>');i.push('>');let o=r.firstChild;for(;o;)t(o,i),o=o.sibling.right;i.push('</',r.tagName,'>')})(t,r);const i=r.join('');return function e(t){if('html'===t.tagName)return 1;if(t.isFragment&&null===t.textContent){const n=t.firstChild;if(n&&t.child.last===n)return e(n)}return 0}(t)?`<!DOCTYPE html>${i}`:i}function l(e,t){const n=ue(e);for(let e=0;e<t.length;e++){const s=ue(t[e]);s.family.type='crosslink';const r=fe(s),i=he(n);r.includes(n)||r.push(n),i.includes(s)||i.push(s)}}function o(e,t){a(e,t),c(t,e)}function a(e,t){e&&e!==t&&(e.locality.sibling.right.ref=t)}function c(e,t){e&&e!==t&&(e.locality.sibling.left.ref=t)}function p(){const e={stack:null},t=pe.get(),n=effector.createNode({node:[ge,me],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function u(e,t){const n=e.namespaceURI,s=e.tagName.toLowerCase(),r='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===s?'foreignObject':'html',i=pe.get(),l={parent:i,signal:i&&i.signal?i.signal:p(),namespace:r,targetElement:e,svgRoot:'svg'===s?e:i?i.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial',visible:1};pe.replace(l),ae.push({node:e,append:[],reverse:0});try{effector.withRegion(l.signal,t)}finally{f(ae.pop()),pe.replace(i)}}function f({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=oe.createDocumentFragment();if(n){for(let e=t.length-1;e>=0;e--)s.appendChild(t[e]);e.prepend(s)}else{for(let e=0;e<t.length;e++)s.appendChild(t[e]);e.appendChild(s)}}function h(e,t){t.parent=e,t.signal.seq.push(be),t.signal.scope.stack=t,e.child.push(t)}function d(e,t){return effector.createNode({node:[ye],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function g(){Se=0,ke()}function m(e,t,n){const s=++Pe,r=effector.createEvent(),i=effector.is.store(e)?e.updates:e,o={type:'crosslink',owners:[i,r]};return effector.createNode({node:[Me],parent:[i],scope:{taskID:s},family:o}),l(e,[r]),Ie.set(s,effector.createNode({node:[Le],child:[effector.createNode({node:[Te,je,Me],scope:{taskID:s},family:o}),effector.createNode({node:[Ve,je],child:[r],family:o})],scope:{fn:t},family:o})),Oe.set(s,n),r}function b({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName}){const o=e.map(e=>[{inserted:xe(),retry:0,value:e}]);return{trigger:e,processed:m(o,(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],p=xe();if(i.inserted+r>p){c.push(i);continue}if(i.inserted+s<p)continue;if(p-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function y({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:r=0,retries:i=1/0,mark:l=e.shortName,flatten:o}){const a=e.map(e=>{const t=[],n=xe();for(let s=0;s<e.length;s++){const r=o(e[s]);for(let e=0;e<r.length;e++)t.push({inserted:n,retry:0,value:r[e]})}return t});return{trigger:e,processed:m(a,(e,n)=>{let l,o=0;const a=[],c=[];for(l=0;l<e.length;l++){const i=e[l],p=xe();if(i.inserted+r>p){c.push(i);continue}if(i.inserted+s<p)continue;if(p-n>=10){o=1;break}const u=t(i.value);void 0!==u&&a.push(u)}if(o)for(let t=l;t<e.length;t++){const n=e[t];n.retry+=1,n.retry>=i||c.push(n)}return{done:a,fail:c}},n)}}function v(e,t,n){d(e,t.watch(n))}function w(e,t,n){effector.createNode({node:[qe],parent:t,child:[ze],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(ze,{data:t.getState(),handler:n},1)}function x(e,t,n,s){effector.is.unit(n)?(e?v:w)(t,n,s):s(n)}function k(e,t=e.child.length-1){for(let n=t;n>=0;n--){const t=e.child[n];switch(t.node.type){case'element':case'using':if(!t.visible)continue;return t}const s=k(t);if(s)return s}return null}function E(e){if(!e.parent)return null;switch(e.parent.node.type){case'element':case'using':{const t=k(e.parent,e.parent.child.indexOf(e)-1);if(t)return t;break}case'list':case'listItem':{let t=e,n=e.parent;for(;n;){const e=k(n,n.child.indexOf(t)-1);if(e)return e;t=n,n=n.parent}break}}return null}function N(e){return''!==e&&0!==e&&(0==e||null==e)}function S(e,t,n){N(n)?delete e[t]:e[t]=`${n}`}function C(e,t,n,s){if(n.visible=s,s){if(!t.contains(e)){const s=E(n);s&&t.contains(s.targetElement)?s.targetElement.after(e):t.appendChild(e)}}else e.remove()}function $(e,t,n){if(null===n)return;const s=pe.get().parent.targetElement;w(t,n,C.bind(null,e,s,pe.get()))}function _(e,t,n){if(N(n)){switch(t){case'value':delete e.value;break;case'checked':e.checked=0;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function I(e,t,n,s,r,i){const l=e.createSVGTransform();switch(i){case'translate':case'scale':s=(e=>effector.is.store(e)?e:effector.is.store(e.x)?effector.is.store(e.y)?effector.combine({x:e.x,y:e.y}):e.x.map(Xe.bind(null,e.y)):effector.is.store(e.y)?e.y.map(Ge.bind(null,e.x)):e)(s)}x(0,t,s,r.bind(null,l)),n.appendItem(l)}function R(e,t){const n=oe.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function A(e){e.focus()}function O(e){e.blur()}function P(e,t){return e.bind(null,t)}function D(e,t){const n=pe.get();if(Array.isArray(t)){const s=[];for(let n=0;n<t.length;n++)s[n]=e.map(P(F,t[n]));return n&&l(n.signal,s),s}if('object'==typeof t&&null!==t){const s=[],r={};for(const n in t)r[n]=e.map(P(F,t[n])),s.push(r[n]);return n&&l(n.signal,s),r}const s=e.map(P(F,t));return n&&l(n.signal,s),s}function F(e,t){return t[e]}function V(e,t=(()=>{})){let n;t=e.fn?e.fn:t;let s,r=0;effector.is.store(e)?(s=Je,n=e):(s=P(Ke,e.key),n=e.source,r=!!e.reverse);const i=pe.get(),o=p(),a={parent:i,signal:o,namespace:i.namespace,targetElement:i.targetElement,svgRoot:i.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:r,key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},store:n,cb:t},mountStatus:'initial',visible:1};h(i,a),pe.replace(a);const c={parentNode:i.targetElement,cb:t,shortName:n.shortName,reverse:r,parentStack:a,getID:s,fields:e.fields?e.fields:null,visible:e.visible?e.visible:null},u=effector.createStore(T(c,[],n.getState()));l(o,[u]),d(o,P(et,u)),effector.sample({source:u,clock:n,fn:P(T,c),target:u}),pe.replace(i)}function T(e,t,n){const s=Array(n.length).fill(0),r=n.map(e.getID),i=[],u=[],f=[];for(let e=0;e<t.length;e++){const i=t[e],l=i.node,o=r.indexOf(l.key);-1!==o?(u.push(i),s[o]=1,l.store.getState()!==n[o]&&effector.launch({target:l.store,params:n[o],defer:1})):f.push(i)}if(f.length>0){for(let e=0;e<f.length;e++){const t=f[e],{node:n,locality:s}=t;n.active=0,n.store=null,o(s.sibling.left.ref,s.sibling.right.ref),a(t,null),c(t,null)}effector.launch({target:Qe,params:f,defer:1})}let d=u.length>0?u[u.length-1]:null;for(let t=0;t<n.length;t++){if(s[t])continue;const r=n[t],a=effector.createStore(r),c=p(),f=e.fields?D(a,e.fields):null;l(c,[a]);const g=e.getID(r,t),m={parent:e.parentStack,signal:c,namespace:e.parentStack.namespace,targetElement:e.parentStack.targetElement,svgRoot:e.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:g,index:g,store:a,signal:c,active:1,nodes:[],fields:f,visible:e.visible?[a.map(e.visible)]:[]},mountStatus:'initial',visible:1};o(d,m),d=m,h(e.parentStack,m),i.push(m),u.push(m)}return i.length>0&&effector.launch({target:He,params:{context:e,list:i},defer:1}),u}function j(e,t,n,s){const r=E(e);r&&s.contains(r.targetElement)?n?r.targetElement.before(t):r.targetElement.after(t):s.appendChild(t)}function M(e){const t=pe.get();return t&&l(t.signal,[e]),e}function L(e){const t=pe.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`"${e}" extension can be used only with element nodes, got "${t.node.type}"`)}function q(e){const t=pe.get();t.targetElement.__STATIC__||e(t.targetElement)}function z(e){e.attr&&W(e.attr),e.data&&Y(e.data),e.transform&&U(e.transform),'text'in e&&X(e.text),'visible'in e&&G(e.visible),(e.style||e.styleVar)&&Z({prop:e.style,val:e.styleVar}),e.focus&&H(e.focus),e.handler&&B(e.handler)}function W(e){L('attr'),pe.getElementNode().attr.push(e)}function Y(e){L('data'),pe.getElementNode().data.push(e)}function U(e){L('transform'),pe.getElementNode().transform.push(e)}function X(e){L('text'),pe.getElementNode().text.push(e)}function G(e){const t=pe.get();if('element'!==t.node.type&&'using'!==t.node.type&&'listItem'!==t.node.type)throw Error(`"visible" extension can be used only with element or listItem nodes, got "${t.node.type}"`);pe.getElementNode().visible.push(e)}function Z({prop:e,val:t}){L('style'),e&&pe.getElementNode().styleProp.push(e),t&&pe.getElementNode().styleVar.push(t)}function B(e,t){L('handler'),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0,prevent:r=0,stop:i=0}=e;pe.getElementNode().handler.push({options:{passive:n,capture:s,prevent:r,stop:i},map:t})}function H({focus:e,blur:t}){L('focus');const n=pe.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const J=/[^a-zA-Z0-9\-]/g,K=/[\\<>"]/g,Q=/[A-Z]/g,ee=/[&<>'"]/g;class te{constructor(){this.child={first:null,last:null},this.sibling={left:null,right:null},this.parent=null,this.tagName='',this.namespaceURI='http://www.w3.org/1999/xhtml',this.dataset=Object.create(null),this.style=new ne,this.firstChild=null,this.transform={baseVal:new se},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(e){if(e.parent&&e.remove(),e.isFragment&&null===e.textContent){let t,n=e.firstChild;for(;n;)t=n.sibling.right,this.appendChild(n),n=t}else this.child.last?(this.child.last.sibling.right=e,e.sibling.left=this.child.last):(this.child.first=e,this.firstChild=e),this.child.last=e,e.parent=this}prepend(e){e.parent&&e.remove(),this.child.last?(this.child.first.sibling.left=e,e.sibling.right=this.child.first):(this.child.first=e,this.child.last=e),this.child.first=e,this.firstChild=e,e.parent=this}contains(e){let t=e;for(;t;){if(t===this)return 1;t=t.parent}return 0}remove(){if(!this.parent)return;const{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,this.sibling.left.sibling.right=null):(this.sibling.right.sibling.left=this.sibling.left,this.sibling.left.sibling.right=this.sibling.right),this.sibling.left=null,this.sibling.right=null,this.parent=null}addEventListener(e,t,n){}removeEventListener(e,t,n){}setAttribute(e,t){this.attributes[n(e)]=s(t)}removeAttribute(e){delete this.attributes[n(e)]}replaceWith(e){if(!this.parent)return;const{parent:t}=this;e.parent&&e.remove(),t.child.first===this&&t.child.last===this?(t.firstChild=e,t.child.first=e,t.child.last=e):t.child.first===this?(t.child.first=e,t.firstChild=e,this.sibling.right.sibling.left=e):t.child.last===this?(t.child.last=e,this.sibling.left.sibling.right=e):(this.sibling.right.sibling.left=e,this.sibling.left.sibling.right=e),e.sibling.left=this.sibling.left,e.sibling.right=this.sibling.right,e.parent=t,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new re}}class ne{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[n(e)]=s(t)}removeProperty(e){delete this.properties[n(e)]}}class se{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class re{constructor(){this.value=''}setTranslate(e,t){this.value=`translate(${e} ${t})`}setScale(e,t){this.value=`scale(${e} ${t})`}setRotate(e,t,n){this.value=0!==t||0!==n?`rotate(${e} ${t} ${n})`:`rotate(${e})`}setSkewX(e){this.value=`skewX(${e})`}setSkewY(e){this.value=`skewY(${e})`}}const ie=new te;ie.isBody=1;var le={__proto__:null,body:ie,createTextNode:e=>{const n=new te;return n.textContent=String(e).replace(ee,t),n},createElement:e=>{const t=new te;return t.tagName=n(e),t.isFragment=0,t},createElementNS:(e,t)=>{switch(e){case'http://www.w3.org/1999/xhtml':case'http://www.w3.org/2000/svg':break;default:e='http://www.w3.org/1999/xhtml'}const s=new te;return s.tagName=n(t),s.namespaceURI=e,s.isFragment=0,s},createDocumentFragment:r,render:i};let oe='undefined'!=typeof document?document:null;const ae=[];let ce;const pe={get:()=>ce,replace(e){ce=e},getElementNode:()=>ce.node},ue=e=>e.graphite||e,fe=e=>e.family.owners,he=e=>e.family.links,de=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),ge=effector.step.compute({fn(e,t){t.self.next.push(de);const{stack:n}=t,{parent:s}=n,{left:r,right:i}=n.locality.sibling;s&&(s.locality.child.last.ref===n&&(s.locality.child.last.ref=r.ref),s.locality.child.first.ref===n&&(s.locality.child.first.ref=i.ref)),r.ref&&r.ref.locality.sibling.right.ref===n&&i.ref&&i.ref.locality.sibling.left.ref===n?o(r.ref,i.ref):r.ref&&r.ref.locality.sibling.right.ref===n?a(r.ref,null):i.ref&&i.ref.locality.sibling.left.ref===n&&c(i.ref,null)}}),me=effector.step.compute({fn:(e,{self:t})=>t}),be=effector.step.compute({fn(e,t){if(!t.stack)return e;const{stack:n}=t;t.stack=null;const s=n.parent.child.indexOf(n);return-1!==s&&n.parent.child.splice(s,1),n.parent=null,e}}),ye=effector.step.run({fn(e,{fn:t}){t(e)}});let ve,we,xe;ve=()=>{},we=()=>{},xe='undefined'!=typeof performance&&performance.now?()=>performance.now():'undefined'!=typeof process&&process.hrtime?()=>{const e=process.hrtime();return(1e9*e[0]+e[1])/1e6}:()=>Date.now();const ke=effector.createEvent();let Ee,Ne=0,Se=0;const Ce='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),$e='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,_e=()=>{Se||(Se=1,Ee=Ce(g))},Ie=new Map,Re=new Map,Ae=new Map,Oe=new Map;let Pe=0,De=0;const Fe=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===Re.size&&0===Ae.size?0:xe()-De>=10?0:($e(Ee),Ne=1,Se=0,1)})],child:[ke]});ke.watch(()=>{if(Se)return;if(0===Re.size&&0===Ae.size)return void(Ne=0);let e=0;Ne||(De=xe()),Ne=0;for(const[t,n]of Re){if(xe()-De>=10){_e(),e=1;break}Re.delete(t),effector.launch({target:Ie.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Ae){if(xe()-De>=10){_e(),e=1;break}Ae.delete(t),effector.launch({target:Ie.get(t),params:n,defer:1})}effector.launch({target:Fe,params:null,defer:1})});const Ve=effector.step.compute({fn:({done:e})=>e}),Te=effector.step.compute({fn:({fail:e})=>e}),je=effector.step.filter({fn:e=>e.length>0}),Me=effector.step.compute({fn(e,{taskID:t}){const n='high'===Oe.get(t)?Re:Ae;let s=n.get(t);s||(s=[],n.set(t,s));for(let t=0;t<e.length;t++)s.push(e[t]);_e()}}),Le=effector.step.run({fn:(e,{fn:t})=>t(e,De)}),qe=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:ze}=b({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),We=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Ye=(e,t,n)=>{N(n)?delete e[t]:e[t]=n},Ue=(e,t,n)=>{N(n)?e.removeProperty(t):e.setProperty(t,n)},Xe=(e,t)=>({x:t,y:e}),Ge=(e,t)=>({x:e,y:t}),Ze={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:Be}=b({mark:'append DOM nodes',fn:e=>{for(let t=0;t<e.append.length;t++){const n=e.append[t];if(0==n.listItem.active)continue;if(0===n.appended.length)continue;const s=oe.createDocumentFragment();if(e.reverse)for(let e=n.appended.length-1;e>=0;e--)s.appendChild(n.appended[e]);else for(let e=0;e<n.appended.length;e++)s.appendChild(n.appended[e]);j(n.listItemStack,s,e.reverse,e.node)}}}),{trigger:He}=b({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:r,reverse:i}=e,l=pe.get();pe.replace(n);const o=[],a=[];ae.push({node:s,append:a,reverse:i});for(let e=0;e<t.length;e++){const n=t[e],l=n.node;if(l.active){pe.replace(n),effector.withRegion(n.signal,P(r,l));for(let e=0;e<a.length;e++)l.nodes.push(a[e]);l.visible.length>0?effector.withRegion(n.signal,()=>{const e=l.visible[l.visible.length-1];e.updates.watch(e=>{if(0!=l.active)if(e){const e=oe.createDocumentFragment();if(i)for(let t=l.nodes.length-1;t>=0;t--)e.appendChild(l.nodes[t]);else for(let t=0;t<l.nodes.length;t++)e.appendChild(l.nodes[t]);j(n,e,i,s)}else for(let e=0;e<l.nodes.length;e++)l.nodes[e].remove()}),e.getState()&&o.push({listItemStack:n,appended:a.slice(),listItem:l})}):o.push({listItemStack:n,appended:a.slice(),listItem:l}),a.length=0}}ae.pop(),o.length>0&&effector.launch({target:Be,params:{node:s,append:o,reverse:i},defer:1}),pe.replace(l)}}),Je=(e,t)=>t,Ke=(e,t)=>t[e],Qe=effector.createEvent();y({trigger:Qe,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch({target:e,params:null,defer:0})}}),y({trigger:Qe,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const et=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}effector.launch({target:Qe,params:t,defer:1})};oe=le,exports.attr=W,exports.body=ie,exports.combine=({source:e,fn:t})=>(console.error('separate combine method is deprecated, use common combine method as usual'),M(effector.combine(e,t))),exports.createDocumentFragment=r,exports.data=Y,exports.explicitUnmount=e=>{const t=pe.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=H,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,r=pe.get(),i=r?r.namespace:'html';let l=i,o='html';'type'in t?(o=t.type,l=t.type):l=o='svg'===i?'svg':'html','svg'===e&&(o='svg',l='svg');const a='svg'===o?oe.createElementNS('http://www.w3.org/2000/svg',e):oe.createElement(e);'foreignObject'===i?(a.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),l='html'):'svg'===e?(a.setAttribute('xmlns','http://www.w3.org/2000/svg'),l='svg'):'foreignObject'===e&&(l='foreignObject');const c=p(),u={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:c,namespace:l,targetElement:a,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:u,mountStatus:'initial',visible:1};r&&h(r,g),'svg'===e?g.svgRoot=a:r&&(g.svgRoot=r.svgRoot),pe.replace(g),n?((e,t,n,s)=>{let r=0;ae.push({node:t,append:[],reverse:0});try{effector.withRegion(e,s),r=1}finally{f(ae.pop()),r||pe.replace(n)}})(c,a,r,n):(u.pure=1,z(t));const m=(()=>{const e=(()=>{const e=pe.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:[],transform:e.transform,focus:e.focus,blur:e.blur};for(let n=0;n<e.handler.length;n++){const{options:s,map:r}=e.handler[n];s.passive=s.prevent?0:s.passive;for(const e in r){const t=r[e];r[e]=e=>{s.prevent&&e.preventDefault(),s.stop&&e.stopPropagation(),t(e)}}t.handler.push({options:s,map:r})}for(let n=0;n<e.attr.length;n++){const s=e.attr[n];for(const e in s)'xlink:href'===e?t.attr.href=s[e]:t.attr[e]=s[e]}for(let n=0;n<e.data.length;n++){const s=e.data[n];for(const e in s)t.data[e]=s[e]}e.visible.length>0&&(t.visible=e.visible[e.visible.length-1]),e.text.length>0&&(t.text=e.text[e.text.length-1]);for(let n=0;n<e.styleVar.length;n++){const s=e.styleVar[n];for(const e in s)t.styleVar[e]=s[e]}for(let n=0;n<e.styleProp.length;n++){const s=e.styleProp[n];for(const e in s)t.styleProp[e]=s[e]}return t})(),t=pe.get(),n=t.targetElement,s=t.signal;return((e,t,n)=>{for(const s in n)x('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],_.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)x(0,t,n[s],S.bind(null,e.dataset,s))})(n,s,e.data),((e,t,n)=>{for(let s=0;s<n.length;s++){const{options:r,map:i}=n[s];for(const t in i)e.addEventListener(t,i[t],r);d(t,We.bind(null,e,n[s]))}})(n,s,e.handler),((e,t,n)=>{const s=e.style;for(const e in n)x(0,t,n[e],Ye.bind(null,s,e))})(n,s,e.styleProp),((e,t,n)=>{const s=e.style;for(const e in n)x(0,t,n[e],Ue.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=pe.get();if('svg'!==s.namespace)return;if(0===n.length)return;const r=e.transform.baseVal,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)I(i,t,r,s[e],Ze[e],e)}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?w(t,n,R.bind(null,e)):R(e,n))})(n,s,e.text),$(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)x(1,t,n[s],A.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)x(1,t,n[s],O.bind(null,e))})(n,s,e.blur),e})();pe.replace(r),g.visible=!m.visible||m.visible.getState(),s||ae.length>0&&g.visible&&ae[ae.length-1].append.push(a)},exports.handler=B,exports.list=V,exports.map=(e,{fn:t})=>(console.error('separate map method is deprecated, use store.map as usual'),M(e.map(t))),exports.node=q,exports.nodeMethod=e=>{let t;return q(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=D,exports.render=i,exports.renderStatic=e=>{const t=r();return u(t,e),new Promise(e=>setTimeout(e,800)).then(()=>i(t))},exports.signalOwn=M,exports.spec=z,exports.storeField=(e,t)=>{const n=e.map(P(F,t)),s=pe.get();return s&&l(s.signal,[n]),n},exports.style=Z,exports.text=X,exports.transform=U,exports.tree=function e({key:t,child:n,source:s},r){V({source:s,key:t},({store:s,key:i,signal:l})=>{const o=D(s,n);r({store:s,key:i,signal:l},()=>{e({key:t,child:n,source:o},r)})})},exports.using=u,exports.visible=G; | ||
//# 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
582119
1231