effector-dom
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -6,8 +6,9 @@ import {Store, Event, Step} from 'effector' | ||
export type DOMProperty = string | number | null | boolean | ||
export type PropertyMap = {[field: string]: StoreOrData<DOMProperty>} | ||
export type PropertyMap = {[field: string]: DOMProperty | AttributeStore} | ||
export type StylePropertyMap = Partial< | ||
{ | ||
[K in keyof CSSStyleDeclaration]: StoreOrData<DOMProperty> | ||
[K in keyof CSSStyleDeclaration]: DOMProperty | AttributeStore | ||
} | ||
> | ||
export type DOMTag = keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap | ||
export type TransformMap = { | ||
@@ -45,2 +46,18 @@ translate: | ||
export type DOMElement = HTMLElement | SVGElement | ||
export type AttributeStore = | ||
| Store<string> | ||
| Store<number> | ||
| Store<boolean> | ||
| Store<null> | ||
| Store<string | number> | ||
| Store<string | boolean> | ||
| Store<string | null> | ||
| Store<number | boolean> | ||
| Store<number | null> | ||
| Store<boolean | null> | ||
| Store<string | number | boolean> | ||
| Store<string | number | null> | ||
| Store<string | boolean | null> | ||
| Store<number | boolean | null> | ||
| Store<string | number | boolean | null> | ||
@@ -59,3 +76,3 @@ type Tuple<T = unknown> = [T] | T[] | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -89,5 +106,4 @@ style?: StylePropertyMap | ||
export function h(tag: string, cb: () => void): void | ||
export function h( | ||
tag: string, | ||
tag: DOMTag, | ||
spec: { | ||
@@ -97,3 +113,3 @@ attr?: PropertyMap | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -111,2 +127,3 @@ style?: StylePropertyMap | ||
): void | ||
export function h(tag: DOMTag, cb: () => void): void | ||
export function variant<Case extends string>( | ||
@@ -128,5 +145,16 @@ key: Store<Case>, | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
fields: Query | ||
fn?: (opts: { | ||
store: Store<T> | ||
fields: { | ||
[K in keyof Query]: Query[K] extends keyof T | ||
? Store<T[Query[K]]> | ||
: never | ||
} | ||
key: T[K] | ||
signal: Signal | ||
}) => void | ||
}, | ||
cb: (opts: { | ||
cb?: (opts: { | ||
store: Store<T> | ||
@@ -148,17 +176,9 @@ fields: { | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
reverse?: boolean | ||
fn?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void | ||
}, | ||
cb: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
cb?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
): void | ||
export function map<T, S>( | ||
store: Store<T>, | ||
config: {fn: (value: T) => S}, | ||
): Store<S> | ||
export function combine<A extends Combinable, B>(config: { | ||
source: A | ||
fn(source: GetCombinedValue<A>): B | ||
}): Store<B> | ||
export function node(fn: (node: DOMElement) => void): void | ||
@@ -165,0 +185,0 @@ export function signalOwn<T>(value: T): T |
@@ -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),i=K(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=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 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(ne,'')}}function r(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 i=++Se,r=effector.createEvent(),o=effector.is.store(a=t)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return effector.createNode({node:[$e],parent:[o],scope:{taskID:i,flat:s},family:c}),e(t,[r]),ke.set(i,effector.createNode({node:[Ae],child:[effector.createNode({node:[Re,_e,Oe],scope:{taskID:i},family:c}),effector.createNode({node:[Ie,_e],child:[r],family:c})],scope:{fn:n},family:c})),Ee.set(i,l),r}function h({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:s=1/0,batchWindow:l=0,retries:i=1/0,mark:r=e.shortName}){const o=u(e.map(e=>[{inserted:ue(),retry:0,value:e}]),(e,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const i=e[r],p=ue();if(i.inserted+l>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=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=>{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:i=1/0,mark:r=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 r,o=0;const a=[],c=[];for(r=0;r<e.length;r++){const i=e[r],p=ue();if(i.inserted+l>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=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=>{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,i){const r=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(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,r)),n.appendItem(r)}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=[],i={};for(const e in n)i[e]=t.map(_($,n[e])),l.push(i[e]);return s&&e(s.signal,l),i}const l=t.map(_($,n));return s&&e(s.signal,l),l}function $(e,t){return t[e]}function A(t,n){let s,i,r=0;effector.is.store(t)?(i=Xe,s=t):(i=_(Ye,t.key),s=t.source,r=!!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:r,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:r,parentStack:f,getID:i,fields:t.fields?t.fields: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(i,r,o){const c=Array(o.length).fill(0),p=o.map(i.getID),f=[],u=[],h=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.node,s=p.indexOf(n.key);-1!==s?(u.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch(n.store,o[s],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)}effector.launch(Ge,h,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],r=effector.createStore(s),p=l(),h=i.fields?O(r,i.fields):null;e(p,[r]);const g=i.getID(s,n),m={parent:i.parentStack,signal:p,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:p,active:1,nodes:[],fields:h,visible:[]},mountStatus:'initial',visible:1};t(d,m),d=m,a(i.parentStack,m),f.push(m),u.push(m)}return f.length>0&&effector.launch(We,{context:i,list:f},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:i=0}=e;Z.getElementNode().handler.push({options:{passive:n,capture:s,prevent:l,stop:i},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: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)}}),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[i(e)]=r(t)}removeProperty(e){delete this.properties[i(e)]}}class ie{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})`}}(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 ie},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 re}}).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:i}=e,r=Z.get();Z.replace(n);const o=[],a=[];U.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){Z.replace(n),effector.withRegion(n.signal,_(l,r));for(let e=0;e<a.length;e++)r.nodes.push(a[e]);r.visible.length>0?effector.withRegion(n.signal,()=>{const e=r.visible[r.visible.length-1];e.updates.watch(e=>{if(0!=r.active)if(e){const e=oe.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]);D(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}}U.pop(),o.length>0&&effector.launch({target:qe,params:{node:s,append:o,reverse:i},defer:1}),Z.replace(r)}}),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(e,null,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(Ge,t,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,i=Z.get(),r=i?i.namespace:'html';let p=r,f='html';'type'in t?(f=t.type,p=t.type):p=f='svg'===r?'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'===r?(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};i&&a(i,g),'svg'===e?g.svgRoot=u:i&&(g.svgRoot=i.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,i,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:i}=n[s];for(const t in i)e.addEventListener(t,i[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,i=s.svgRoot;for(let e=0;e<n.length;e++){const s=n[e];for(const e in s)N(i,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(i),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:i,signal:r})=>{const o=O(s,n);l({store:s,key:i,signal:r},()=>{e({key:t,child:n,source:o},l)})})},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',r=Z.get(),a={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};Z.replace(a),U.push({node:e,append:[],reverse:0});try{effector.withRegion(a.signal,t)}finally{o(U.pop()),Z.replace(r)}},exports.variant=(e,t)=>{A({source:effector.createStore(Object.entries(t).map(([e,t])=>({key:e,val:t}))),key:'key',fields:['key','val']},({fields:[t,n]})=>{F({visible:effector.combine(t,e,(e,t)=>e===t)}),n.getState()()})},exports.visible=W; | ||
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; | ||
//# sourceMappingURL=effector-dom.cjs.js.map |
@@ -6,8 +6,9 @@ import {Store, Event, Step} from 'effector' | ||
export type DOMProperty = string | number | null | boolean | ||
export type PropertyMap = {[field: string]: StoreOrData<DOMProperty>} | ||
export type PropertyMap = {[field: string]: DOMProperty | AttributeStore} | ||
export type StylePropertyMap = Partial< | ||
{ | ||
[K in keyof CSSStyleDeclaration]: StoreOrData<DOMProperty> | ||
[K in keyof CSSStyleDeclaration]: DOMProperty | AttributeStore | ||
} | ||
> | ||
export type DOMTag = keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap | ||
export type TransformMap = { | ||
@@ -45,2 +46,18 @@ translate: | ||
export type DOMElement = HTMLElement | SVGElement | ||
export type AttributeStore = | ||
| Store<string> | ||
| Store<number> | ||
| Store<boolean> | ||
| Store<null> | ||
| Store<string | number> | ||
| Store<string | boolean> | ||
| Store<string | null> | ||
| Store<number | boolean> | ||
| Store<number | null> | ||
| Store<boolean | null> | ||
| Store<string | number | boolean> | ||
| Store<string | number | null> | ||
| Store<string | boolean | null> | ||
| Store<number | boolean | null> | ||
| Store<string | number | boolean | null> | ||
@@ -59,3 +76,3 @@ type Tuple<T = unknown> = [T] | T[] | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -89,5 +106,4 @@ style?: StylePropertyMap | ||
export function h(tag: string, cb: () => void): void | ||
export function h( | ||
tag: string, | ||
tag: DOMTag, | ||
spec: { | ||
@@ -97,3 +113,3 @@ attr?: PropertyMap | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -111,2 +127,3 @@ style?: StylePropertyMap | ||
): void | ||
export function h(tag: DOMTag, cb: () => void): void | ||
export function variant<Case extends string>( | ||
@@ -128,5 +145,16 @@ key: Store<Case>, | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
fields: Query | ||
fn?: (opts: { | ||
store: Store<T> | ||
fields: { | ||
[K in keyof Query]: Query[K] extends keyof T | ||
? Store<T[Query[K]]> | ||
: never | ||
} | ||
key: T[K] | ||
signal: Signal | ||
}) => void | ||
}, | ||
cb: (opts: { | ||
cb?: (opts: { | ||
store: Store<T> | ||
@@ -148,17 +176,9 @@ fields: { | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
reverse?: boolean | ||
fn?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void | ||
}, | ||
cb: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
cb?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
): void | ||
export function map<T, S>( | ||
store: Store<T>, | ||
config: {fn: (value: T) => S}, | ||
): Store<S> | ||
export function combine<A extends Combinable, B>(config: { | ||
source: A | ||
fn(source: GetCombinedValue<A>): B | ||
}): Store<B> | ||
export function node(fn: (node: DOMElement) => void): void | ||
@@ -165,0 +185,0 @@ export function signalOwn<T>(value: T): T |
@@ -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),he.push({node:e,append:[],reverse:0});try{ie(o.signal,t)}finally{a(he.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 h(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 p(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=p(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=p(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 h='svg'===u?Ie.createElementNS('http://www.w3.org/2000/svg',e):Ie.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),de.replace(g),n?((e,t,n,s)=>{let l=0;he.push({node:t,append:[],reverse:0});try{ie(e,s),l=1}finally{a(he.pop()),l||de.replace(n)}})(p,h,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||he.length>0&&g.visible&&he[he.length-1].append.push(h)}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,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 h={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:r,parentStack:u,getID:i,fields:t.fields?t.fields:null},p=fe(j(h,[],s.getState()));e(a,[p]),f(a,O(pt,p)),ue({source:p,clock:s,fn:O(j,h),target:p}),de.replace(o)}function j(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]&&oe(n.store,o[s],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)}oe(ht,p,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=fe(s),f=l(),p=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:p,visible:[]},mountStatus:'initial',visible:1};t(d,m),d=m,c(i.parentStack,m),u.push(m),h.push(m)}return u.length>0&&oe(ct,{context:i,list:u},1),h}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){T({source:fe(Object.entries(t).map(([e,t])=>({key:e,val:t}))),key:'key',fields:['key','val']},({fields:[t,n]})=>{Y({visible:ce(t,e,(e,t)=>e===t)}),n.getState()()})}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 he=[];let pe;const de={get:()=>pe,replace(e){pe=e},getElementNode:()=>pe.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}){h(t,1,e)}}),He=se.compute({fn(e,{taskID:t,flat:n}){h(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=[];he.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}}he.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],ht=re();g({trigger:ht,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&oe(e,null,0)}}),g({trigger:ht,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const pt=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(ht,t,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=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}; | ||
//# sourceMappingURL=effector-dom.es.js.map |
@@ -6,8 +6,9 @@ import {Store, Event, Step} from 'effector' | ||
export type DOMProperty = string | number | null | boolean | ||
export type PropertyMap = {[field: string]: StoreOrData<DOMProperty>} | ||
export type PropertyMap = {[field: string]: DOMProperty | AttributeStore} | ||
export type StylePropertyMap = Partial< | ||
{ | ||
[K in keyof CSSStyleDeclaration]: StoreOrData<DOMProperty> | ||
[K in keyof CSSStyleDeclaration]: DOMProperty | AttributeStore | ||
} | ||
> | ||
export type DOMTag = keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap | ||
export type TransformMap = { | ||
@@ -45,2 +46,18 @@ translate: | ||
export type DOMElement = HTMLElement | SVGElement | ||
export type AttributeStore = | ||
| Store<string> | ||
| Store<number> | ||
| Store<boolean> | ||
| Store<null> | ||
| Store<string | number> | ||
| Store<string | boolean> | ||
| Store<string | null> | ||
| Store<number | boolean> | ||
| Store<number | null> | ||
| Store<boolean | null> | ||
| Store<string | number | boolean> | ||
| Store<string | number | null> | ||
| Store<string | boolean | null> | ||
| Store<number | boolean | null> | ||
| Store<string | number | boolean | null> | ||
@@ -59,3 +76,3 @@ type Tuple<T = unknown> = [T] | T[] | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -89,5 +106,4 @@ style?: StylePropertyMap | ||
export function h(tag: string, cb: () => void): void | ||
export function h( | ||
tag: string, | ||
tag: DOMTag, | ||
spec: { | ||
@@ -97,3 +113,3 @@ attr?: PropertyMap | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -111,2 +127,3 @@ style?: StylePropertyMap | ||
): void | ||
export function h(tag: DOMTag, cb: () => void): void | ||
export function variant<Case extends string>( | ||
@@ -128,5 +145,16 @@ key: Store<Case>, | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
fields: Query | ||
fn?: (opts: { | ||
store: Store<T> | ||
fields: { | ||
[K in keyof Query]: Query[K] extends keyof T | ||
? Store<T[Query[K]]> | ||
: never | ||
} | ||
key: T[K] | ||
signal: Signal | ||
}) => void | ||
}, | ||
cb: (opts: { | ||
cb?: (opts: { | ||
store: Store<T> | ||
@@ -148,17 +176,9 @@ fields: { | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
reverse?: boolean | ||
fn?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void | ||
}, | ||
cb: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
cb?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
): void | ||
export function map<T, S>( | ||
store: Store<T>, | ||
config: {fn: (value: T) => S}, | ||
): Store<S> | ||
export function combine<A extends Combinable, B>(config: { | ||
source: A | ||
fn(source: GetCombinedValue<A>): B | ||
}): Store<B> | ||
export function node(fn: (node: DOMElement) => void): void | ||
@@ -165,0 +185,0 @@ export function signalOwn<T>(value: T): T |
@@ -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=$e(r),u=$e(c.links),p=$e(c.owners),d=[],h={};for(let t=0;t<e.length;t++){const n=e[t];n&&(d.push(n),De(n,h))}const g={seq:d,next:$e(i),meta:a,scope:o,family:{type:c.type||'crosslink',links:u,owners:p},reg:h};for(let e=0;e<u.length;e++)Ee(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){lt={parent:lt,value:e};try{return t()}finally{lt=lt.parent}}function s(e,n){const r=(e,...t)=>r.create(e,t,t);return r.graphite=t({meta:ct('event',r,n,e)}),r.create=e=>(Ye(r,e),e),r.watch=ae(ot,r),r.map=e=>{let t,n;'object'==typeof e&&(t=e,n=e.name,e=e.fn);const l=s(He(r,n),t);return ft(r,l,'map',e),l},r.filter=e=>'function'==typeof e?(console.error('.filter(fn) is deprecated, use .filterMap instead'),l(r,e)):ut(r,'filter',e.fn,[ke({fn:je})]),r.filterMap=ae(l,r),r.prepend=e=>{const t=s('* → '+r.shortName,{parent:r.parent});return ft(t,r,'prepend',e),(({parent:e},t)=>{e&&e.hooks.event(t)})(r,t),t},r.subscribe=e=>ot(r,t=>e.next(t)),r[re]=()=>r,st(r)}function l(e,t){return ut(e,'filterMap',t,[ve({fn:je}),be()])}function i(e,n){const r=Ie(e),l=Ie(e),c=s({named:'updates'}),f={subscribers:new Map,updates:c,defaultState:e,stateRef:r,getState:ae(Oe,r),setState(e){Ye({target:f,params:e,defer:1})}};if(f.graphite=t({scope:{state:r},node:[be(),xe({store:r}),ye({store:l}),xe({store:l})],child:c,meta:ct('store',f,n)}),at&&void 0===e)throw Error("current state can't be undefined, use null instead");return f.watch=f.subscribe=ae(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,nt(pt(e,f,'on',1,t))),f),f.off=ae(o,f),f.map=(e,t)=>{let n,r,s;'object'==typeof 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:He(f,r),config:n,strict:0});return pt(f,o,'map',0,e),o},f[re]=()=>({subscribe(e){if(e!==Object(e))throw Error('expect observer to be an object');return a(f,t=>{e.next&&e.next(t)})},[re](){return this}}),Ae(f,[c]),st(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('function'!=typeof t)throw Error('watch requires function handler');return t(e.getState()),ot(e,t)}if('function'!=typeof 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];'function'==typeof 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=ht(t))),Array.isArray(s)?gt(s,e=>e.slice(),[],r,t):gt(s,e=>Object.assign({},e),{},r,t)}function f(e,t){const n=kt(e);for(let e=0;e<t.length;e++){const r=kt(t[e]);r.family.type='crosslink';const s=wt(r),l=xt(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=vt.get(),r=t({node:[Et,Nt],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(Ct,'')}}function m(e){return String(e).replace(At,'')}function b({node:e,append:t,reverse:n=0}){if(0===t.length)return;const r=_t.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:[$t],parent:e,meta:{op:'watch'},scope:{fn:n},family:{type:'crosslink',owners:[e]}})}function k(){Ft=0,zt()}function w(e,t,n){const r=(e=>'high'===Ut.get(e)?Yt:Gt)(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);Wt()}function x(e,n,r=0,l="low"){const i=++Bt,o=s(),a=ie(c=e)?c.updates:c;var c;const u={type:'crosslink',owners:[a,o]};return t({node:[tn],parent:[a],scope:{taskID:i,flat:r},family:u}),f(e,[o]),Xt.set(i,t({node:[nn],child:[t({node:[Kt,Qt,en],scope:{taskID:i},family:u}),t({node:[Jt,Qt],child:[o],family:u})],scope:{fn:n},family:u})),Ut.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:Vt(),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=Vt();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=Vt();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=Vt();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:[rn],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:[sn],parent:n,child:[ln],family:{type:'crosslink',owners:e},scope:{handler:r},meta:{op:'debounceRaf'}}),ie(n)&&Ye(ln,{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 O(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 R(e){return''!==e&&0!==e&&(0==e||null==e)}function _(e,t,n){R(n)?delete e[t]:e[t]=`${n}`}function j(e,t,n,r){if(n.visible=r,r){if(!t.contains(e)){const r=O(n);r&&t.contains(r.targetElement)?r.targetElement.after(e):t.appendChild(e)}}else e.remove()}function $(e,t,n){if(null===n)return;const r=vt.get().parent.targetElement;C(t,n,j.bind(null,e,r,vt.get()))}function D(e,t,n){if(R(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(fn.bind(null,e.y)):ie(e.y)?e.y.map(un.bind(null,e.x)):e)(r)}A(0,t,r,s.bind(null,i)),n.appendItem(i)}function V(e,t){const n=_t.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=vt.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,l,o=0;ie(e)?(l=gn,r=e):(l=T(mn,e.key),r=e.source,o=!!e.reverse);const a=vt.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),vt.replace(u);const p={parentNode:a.targetElement,cb:n,shortName:r.shortName,reverse:o,parentStack:u,getID:l,fields:e.fields?e.fields:null},d=i(W(p,[],r.getState()));f(c,[d]),v(c,T(yn,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=mt(o),a=mt(a),'boolean'==typeof c&&(f=c,c=null),n||(n=ie(o)&&ie(a)?i(c?c(Oe(Ce(o)),Oe(Ce(a))):Oe(Ce(o)),{name:r}):s(r)),ie(o))Ae(o,[st(rt(a,n,{scope:{fn:c},node:[!f&&ge({priority:'sampler'}),me({store:Ce(o),to:c?'a':'stack'}),c&&ve({fn:_e})],meta:{op:'sample',sample:'store'}}))]);else{const e=Ie(0),r=Ie(),s=Ie();st(t({parent:o,node:[xe({store:r}),me({from:'value',store:1,target:e})],family:{owners:[o,n,a],links:n},meta:{op:'sample',sample:'source'}})),Ae(o,[st(rt(a,n,{scope:{fn:c},node:[xe({store:s}),me({store:e}),ke({fn:e=>e}),!f&&ge({priority:'sampler'}),me({store:r}),me({store:s,to:'a'}),c&&ve({fn:Re})],meta:{op:'sample',sample:'clock'}}))])}})({source:d,clock:r,fn:T(W,p),target:d}),vt.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]&&Ye(i.store,n[c],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)}Ye(bn,a,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:[]},mountStatus:'initial',visible:1};u(c,m),c=m,y(e.parentStack,m),l.push(m),o.push(m)}return l.length>0&&Ye(hn,{context:e,list:l},1),o}function X(e,t,n,r){const s=O(e);s&&r.contains(s.targetElement)?n?s.targetElement.before(t):s.targetElement.after(t):r.appendChild(t)}function Y(e){const t=vt.get();return t&&f(t.signal,[e]),e}function G(e){const t=vt.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=vt.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'),vt.getElementNode().attr.push(e)}function H(e){G('data'),vt.getElementNode().data.push(e)}function J(e){G('transform'),vt.getElementNode().transform.push(e)}function K(e){G('text'),vt.getElementNode().text.push(e)}function Q(e){const t=vt.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}"`);vt.getElementNode().visible.push(e)}function ee({prop:e,val:t}){G('style'),e&&vt.getElementNode().styleProp.push(e),t&&vt.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;vt.getElementNode().handler.push({options:{passive:n,capture:r,prevent:s,stop:l},map:t})}function ne({focus:e,blur:t}){G('focus');const n=vt.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=>('function'==typeof e||'object'==typeof e&&null!==e)&&'kind'in e,le=e=>t=>se(t)&&t.kind===e,ie=le('store'),oe=le('domain'),ae=(e,t)=>e.bind(null,t),ce=(e,t,n)=>e.bind(null,t,n),fe=()=>{let e=0;return()=>(++e).toString(36)},ue=fe(),pe=fe(),de=(e,t,n)=>({id:pe(),type:e,data:n,hasRef:t});let he=0;const ge=({priority:e="barrier"})=>de('barrier',0,{barrierID:++he,priority:e}),me=({from:e="store",store:t,target:n,to:r=(n?'store':'stack')})=>de('mov','store'===e,{from:e,store:t,to:r,target:n}),be=()=>de('check',0,{type:'defined'}),ye=({store:e})=>de('check',1,{type:'changed',store:e}),ve=ce(de,'compute',0),ke=ce(de,'filter',0),we=ce(de,'run',0),xe=({store:e})=>me({from:'stack',target:e}),Se=e=>e.graphite||e,Ee=e=>e.family.owners,Ne=e=>e.family.links,Ce=e=>e.stateRef,Ae=(e,t)=>{const n=Se(e);for(let e=0;e<t.length;e++){const r=Se(t[e]);'domain'!==n.family.type&&(r.family.type='crosslink'),Ee(r).push(n),Ne(n).push(r)}},Ie=e=>({id:pe(),current:e}),Oe=({current:e})=>e,Re=(e,{fn:t},{a:n})=>t(e,n),_e=(e,{fn:t},{a:n})=>t(n,e),je=(e,{fn:t})=>t(e),$e=(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(Se)},De=({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 Pe=null;const Ve=(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=Ve(e.r,t),e.r=e.l,e.l=n,e},ze=[];let Me=0;for(;Me<5;)ze.push({first:null,last:null,size:0}),Me+=1;const Te=()=>{for(let e=0;e<5;e++){const t=ze[e];if(t.size>0){if(2===e||3===e){t.size-=1;const e=Pe.v;return Pe=Ve(Pe.l,Pe.r),e}1===t.size&&(t.last=null);const n=t.first;return t.first=n.right,t.size-=1,n.value}}},Fe=(e,t,n,r)=>qe(0,{a:null,b:null,node:t,parent:n,value:r},e),qe=(e,t,n,r=0)=>{const s=Le(n),l=ze[s],i={idx:e,stack:t,type:n,id:r};if(2===s||3===s)Pe=Ve(Pe,{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},Le=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}},We=new Set;let Xe=0;const Ye=(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++)Fe('pure',Se(e[n]),null,t[n]);else Fe('pure',Se(e),null,t);n&&Xe||(()=>{const e=Xe;Xe=1;const t={stop:0};let n,r;e:for(;r=Te();){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){We.has(t)||(We.add(t),qe(r,s,n,t));continue e}We.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=Oe(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===Oe(n.reg[a.store.id])}break;case'filter':i.skip=!Ge(i,a,s);break;case'run':if(r!==e||'effect'!==l){qe(r,s,'effect');continue e}case'compute':s.value=Ge(i,a,s)}t.stop=i.fail||i.skip}if(!t.stop)for(let e=0;e<n.next.length;e++)Fe('child',n.next[e],s,s.value);t.stop=0}Xe=e})()},Ge=(e,{fn:t},n)=>{try{return t(n.value,e.scope,n)}catch(t){console.error(t),e.fail=1}},Ue=(e,t={})=>(Object(e)===e&&(Ue(e.config,t),null!=e.name&&('object'==typeof e.name?Ue(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),Ue(e.ɔ,t)),t),Be=Ue,Ze=(e,t)=>''+e.shortName+t,He=(e,t)=>null==t?Ze(e,' → *'):t,Je=(e,t)=>{const n=e.indexOf(t);-1!==n&&e.splice(n,1)},Ke=(e,t)=>{Je(e.next,t),Je(Ee(e),t),Je(Ne(e),t)},Qe=(e,t,n)=>{let r;e.next.length=0,e.seq.length=0,e.scope=null;let s=Ne(e);for(;r=s.pop();)Ke(r,e),(t||n&&!e.meta.sample||'crosslink'===r.family.type)&&Qe(r,t,n);for(s=Ee(e);r=s.pop();)Ke(r,e),n&&'crosslink'===r.family.type&&Qe(r,t,n)},et=e=>e.clear(),tt=(e,{deep:t}={})=>{let n=0;if(ie(e))et(e.subscribers);else if(oe(e)){n=1;const t=e.history;et(t.events),et(t.effects),et(t.stores),et(t.domains)}Qe(Se(e),!!t,n)},nt=e=>{const t=ce(tt,e,void 0);return t.unsubscribe=t,t},rt=(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}}),st=e=>(lt&&Ae(lt.value,[e]),e);let lt=null;const ot=(e,n)=>nt(st(t({scope:{fn:n},node:[we({fn:je})],parent:e,meta:{op:'watch'},family:{owners:e}})));let at;const ct=(e,t,n,r)=>{const s=Be({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=ae(dt,t),t.getType=()=>u.fullName,at=a,{unit:e,name:f,sid:o,named:c}},ft=(e,t,n,r)=>rt(e,t,{scope:{fn:r},node:[ve({fn:je})],meta:{op:n}}),ut=(e,t,n,r)=>{const l=s(Ze(e,' →? *'));return rt(e,l,{scope:{fn:n},node:r,meta:{op:t}}),l},pt=(e,{graphite:t,stateRef:n},r,s,l)=>rt(e,t,{scope:{fn:l},node:[me({store:n,to:'a'}),ve({fn:s?_e:Re}),be(),ye({store:n}),xe({store:n})],meta:{op:r}}),dt=(e,t)=>t(e),ht=e=>t=>e(...t),gt=(e,t,r,s,l)=>{const o=t(r),a=i(o,{name:s||n(e)}),c=Ie(o),f=Ie(1),u=[be(),me({store:c,to:'a'}),ke({fn:(e,{key:t},{a:n})=>e!==n[t]}),me({store:f,to:'b'}),ve({fn(e,{clone:t,key:n},r){r.b&&(r.a=t(r.a)),r.a[n]=e}}),me({from:'a',target:c}),me({from:'value',store:0,target:f}),ge({priority:'barrier'}),me({from:'value',store:1,target:f}),me({store:c}),l&&ve({fn:l}),ye({store:Ce(a)})];for(const n in e){const s=e[n];ie(s)?(r[n]=s.defaultState,o[n]=s.getState(),rt(s,a,{scope:{key:n,clone:t},node:u,meta:{op:'combine'}})):o[n]=r[n]=s}return a.defaultShape=e,a.defaultState=l?Ce(a).current=l(o):r,a},mt=e=>se(e)?e:c(e),bt=(t({node:[we({fn({fn:e,value:t}){e(t)}})],meta:{op:'fx',fx:'sidechain'}}),ke({fn:(e,{state:t})=>void 0!==e&&e!==Oe(t)}),ve({fn:e=>e}),[]);let yt;const vt={get:()=>yt,replace(e){yt=e},getElementNode:()=>yt.node},kt=e=>e.graphite||e,wt=e=>e.family.owners,xt=e=>e.family.links,St=t({node:[we({fn(e){tt(e)}})]}),Et=ve({fn(e,t){t.self.next.push(St);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)}}),Nt=ve({fn:(e,{self:t})=>t}),Ct=/[^a-zA-Z0-9\-]/g,At=/[\\<>"]/g;class It{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[g(e)]=m(t)}removeProperty(e){delete this.properties[g(e)]}}class Ot{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 It,this.firstChild=null,this.transform={baseVal:new Ot},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 Rt}}).isBody=1;let _t='undefined'!=typeof document?document:null;const jt=ve({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=we({fn(e,{fn:t}){t(e)}});let Dt,Pt,Vt;Dt=()=>{},Pt=()=>{},Vt='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 zt=s();let Mt,Tt=0,Ft=0;const qt='undefined'!=typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,0),Lt='undefined'!=typeof cancelAnimationFrame?cancelAnimationFrame:clearTimeout,Wt=()=>{Ft||(Ft=1,Mt=qt(k))},Xt=new Map,Yt=new Map,Gt=new Map,Ut=new Map;let Bt=0,Zt=0;const Ht=t({node:[we({fn:()=>{}}),ke({fn:()=>0===Yt.size&&0===Gt.size?0:Vt()-Zt>=10?0:(Lt(Mt),Tt=1,Ft=0,1)})],child:[zt]});zt.watch(()=>{if(Ft)return;if(0===Yt.size&&0===Gt.size)return void(Tt=0);let e=0;Tt||(Zt=Vt()),Tt=0;for(const[t,n]of Yt){if(Vt()-Zt>=10){Wt(),e=1;break}Yt.delete(t),Ye({target:Xt.get(t),params:n,defer:1})}if(!e)for(const[t,n]of Gt){if(Vt()-Zt>=10){Wt(),e=1;break}Gt.delete(t),Ye({target:Xt.get(t),params:n,defer:1})}Ye({target:Ht,params:null,defer:1})});const Jt=ve({fn:({done:e})=>e}),Kt=ve({fn:({fail:e})=>e}),Qt=ke({fn:e=>e.length>0}),en=ve({fn(e,{taskID:t}){w(t,1,e)}}),tn=ve({fn(e,{taskID:t,flat:n}){w(t,n,e)}}),nn=we({fn:(e,{fn:t})=>t(e,Zt)}),rn=ve({fn:e=>[e]}),sn=we({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:ln}=S({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),on=(e,{map:t,options:n})=>{for(const r in t)e.removeEventListener(r,t[r],n)},an=(e,t,n)=>{R(n)?delete e[t]:e[t]=n},cn=(e,t,n)=>{R(n)?e.removeProperty(t):e.setProperty(t,n)},fn=(e,t)=>({x:t,y:e}),un=(e,t)=>({x:e,y:t}),pn={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:dn}=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=_t.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:hn}=S({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:i}=e,o=vt.get();vt.replace(n);const a=[],c=[];bt.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){vt.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=_t.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}}bt.pop(),a.length>0&&Ye({target:dn,params:{node:s,append:a,reverse:i},defer:1}),vt.replace(o)}}),gn=(e,t)=>t,mn=(e,t)=>t[e],bn=s();E({trigger:bn,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&Ye(e,null,0)}}),E({trigger:bn,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const yn=e=>{const t=e.getState();for(let e=0;e<t.length;e++){const n=t[e].node;n.active=0,n.store=null}Ye(bn,t,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=vt.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=vt.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?_t.createElementNS('http://www.w3.org/2000/svg',e):_t.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),vt.replace(p),n?((e,t,n,s)=>{let l=0;bt.push({node:t,append:[],reverse:0});try{r(e,s),l=1}finally{b(bt.pop()),l||vt.replace(n)}})(f,c,l,n):(u.pure=1,B(t));const d=(()=>{const e=(()=>{const e=vt.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=vt.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],D.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,on.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],an.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],cn.bind(null,r,`--${e}`))})(n,r,e.styleVar),((e,t,n)=>{const r=vt.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],pn[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),$(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})();vt.replace(l),p.visible=!d.visible||d.visible.getState(),s||bt.length>0&&p.visible&&bt[bt.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=vt.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=vt.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};vt.replace(o),bt.push({node:e,append:[],reverse:0});try{r(o.signal,t)}finally{b(bt.pop()),vt.replace(i)}},e.variant=(e,t)=>{L({source:i(Object.entries(t).map(([e,t])=>({key:e,val:t}))),key:'key',fields:['key','val']},({fields:[t,n]})=>{B({visible:c(t,e,(e,t)=>e===t)}),n.getState()()})},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=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})})); | ||
//# sourceMappingURL=effector-dom.umd.js.map |
@@ -6,8 +6,9 @@ import {Store, Event, Step} from 'effector' | ||
export type DOMProperty = string | number | null | boolean | ||
export type PropertyMap = {[field: string]: StoreOrData<DOMProperty>} | ||
export type PropertyMap = {[field: string]: DOMProperty | AttributeStore} | ||
export type StylePropertyMap = Partial< | ||
{ | ||
[K in keyof CSSStyleDeclaration]: StoreOrData<DOMProperty> | ||
[K in keyof CSSStyleDeclaration]: DOMProperty | AttributeStore | ||
} | ||
> | ||
export type DOMTag = keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap | ||
export type TransformMap = { | ||
@@ -45,2 +46,18 @@ translate: | ||
export type DOMElement = HTMLElement | SVGElement | ||
export type AttributeStore = | ||
| Store<string> | ||
| Store<number> | ||
| Store<boolean> | ||
| Store<null> | ||
| Store<string | number> | ||
| Store<string | boolean> | ||
| Store<string | null> | ||
| Store<number | boolean> | ||
| Store<number | null> | ||
| Store<boolean | null> | ||
| Store<string | number | boolean> | ||
| Store<string | number | null> | ||
| Store<string | boolean | null> | ||
| Store<number | boolean | null> | ||
| Store<string | number | boolean | null> | ||
@@ -59,3 +76,3 @@ type Tuple<T = unknown> = [T] | T[] | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -89,5 +106,4 @@ style?: StylePropertyMap | ||
export function h(tag: string, cb: () => void): void | ||
export function h( | ||
tag: string, | ||
tag: DOMTag, | ||
spec: { | ||
@@ -97,3 +113,3 @@ attr?: PropertyMap | ||
transform?: Partial<TransformMap> | ||
text?: StoreOrData<DOMProperty> | ||
text?: DOMProperty | AttributeStore | ||
visible?: Store<boolean> | ||
@@ -111,2 +127,3 @@ style?: StylePropertyMap | ||
): void | ||
export function h(tag: DOMTag, cb: () => void): void | ||
export function variant<Case extends string>( | ||
@@ -128,5 +145,16 @@ key: Store<Case>, | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
fields: Query | ||
fn?: (opts: { | ||
store: Store<T> | ||
fields: { | ||
[K in keyof Query]: Query[K] extends keyof T | ||
? Store<T[Query[K]]> | ||
: never | ||
} | ||
key: T[K] | ||
signal: Signal | ||
}) => void | ||
}, | ||
cb: (opts: { | ||
cb?: (opts: { | ||
store: Store<T> | ||
@@ -148,17 +176,9 @@ fields: { | ||
source: Store<T[]> | ||
visible?: (state: T) => boolean | ||
reverse?: boolean | ||
fn?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void | ||
}, | ||
cb: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
cb?: (opts: {store: Store<T>; key: T[K]; signal: Signal}) => void, | ||
): void | ||
export function map<T, S>( | ||
store: Store<T>, | ||
config: {fn: (value: T) => S}, | ||
): Store<S> | ||
export function combine<A extends Combinable, B>(config: { | ||
source: A | ||
fn(source: GetCombinedValue<A>): B | ||
}): Store<B> | ||
export function node(fn: (node: DOMElement) => void): void | ||
@@ -165,0 +185,0 @@ export function signalOwn<T>(value: T): T |
{ | ||
"name": "effector-dom", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Effector package for working with dom", | ||
@@ -5,0 +5,0 @@ "main": "effector-dom.cjs.js", |
@@ -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=fe(e);for(let e=0;e<t.length;e++){const s=fe(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=ue.get(),n=effector.createNode({node:[me,be],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=ue.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};ue.replace(l),ce.push({node:e,append:[],reverse:0});try{effector.withRegion(l.signal,t)}finally{f(ce.pop()),ue.replace(i)}}function f({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 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}},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 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}},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=ue.get().parent.targetElement;x(t,n,$.bind(null,e,s,ue.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=ue.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,s,r=0;effector.is.store(e)?(s=et,n=e):(s=P(tt,e.key),n=e.source,r=!!e.reverse);const i=ue.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),ue.replace(a);const c={parentNode:i.targetElement,cb:t,shortName:n.shortName,reverse:r,parentStack:a,getID:s,fields:e.fields?e.fields:null},u=effector.createStore(j(c,[],n.getState()));l(o,[u]),d(o,P(st,u)),effector.sample({source:u,clock:n,fn:P(j,c),target:u}),ue.replace(i)}function j(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(l.store,n[o],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(nt,f,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?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:f,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(Qe,{context:e,list:i},1),u}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=ue.get();return t&&l(t.signal,[e]),e}function q(e){const t=ue.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=ue.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'),ue.getElementNode().attr.push(e)}function U(e){q('data'),ue.getElementNode().data.push(e)}function X(e){q('transform'),ue.getElementNode().transform.push(e)}function G(e){q('text'),ue.getElementNode().text.push(e)}function Z(e){const t=ue.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}"`);ue.getElementNode().visible.push(e)}function B({prop:e,val:t}){q('style'),e&&ue.getElementNode().styleProp.push(e),t&&ue.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;ue.getElementNode().handler.push({options:{passive:n,capture:s,prevent:r,stop:i},map:t})}function J({focus:e,blur:t}){q('focus');const n=ue.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 ue={get:()=>pe,replace(e){pe=e},getElementNode:()=>pe.node},fe=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=ue.get();ue.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){ue.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}),ue.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(e,null,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(nt,t,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=ue.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=ue.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(),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),ue.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{f(ce.pop()),r||ue.replace(n)}})(c,a,r,n):(u.pure=1,W(t));const m=(()=>{const e=(()=>{const e=ue.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=ue.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=ue.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})();ue.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 u(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=ue.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=u,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(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; | ||
//# 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
593829
1236