effector-dom
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,2 +0,2 @@ | ||
function e(e,t){const n=G(e);for(let e=0;e<t.length;e++){const s=G(t[e]);s.family.type='crosslink';const l=U(s),r=B(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=q.get(),n=effector.createNode({node:[H,J],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(K,'')}}function i(e){return String(e).replace(Q,'')}function o({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=se.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(le),t.signal.scope.stack=t,e.child.push(t)}function c(e,t){return effector.createNode({node:[re],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function f(){fe=0,oe()}function h(e,t,n){const s=(e=>'high'===de.get(e)?ue:ge)(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);he()}function p(t,n,s=0,l="low"){const r=++me,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:[Ee],parent:[o],scope:{taskID:r,flat:s},family:c}),e(t,[i]),pe.set(r,effector.createNode({node:[Ne],child:[effector.createNode({node:[ke,we,xe],scope:{taskID:r},family:c}),effector.createNode({node:[ve,we],child:[i],family:c})],scope:{fn:n},family:c})),de.set(r,l),i}function u({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=p(e.map(e=>[{inserted:performance.now(),retry:0,value:e}]),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const r=e[i],f=performance.now();if(r.inserted+l>f){c.push(r);continue}if(r.inserted+s<f)continue;if(f-n>=ie){o=1;break}const h=t(r.value);void 0!==h&&a.push(h)}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 g({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=p(e.map(e=>{const t=[],n=performance.now();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],f=performance.now();if(r.inserted+l>f){c.push(r);continue}if(r.inserted+s<f)continue;if(f-n>=ie){o=1;break}const h=t(r.value);void 0!==h&&a.push(h)}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:[Se],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function d(e,t,n){c(e,t.watch(n))}function m(e,t,n){effector.createNode({node:[_e],parent:t,child:[Ce],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ce,{data:t.getState(),handler:n},1)}function b(e,t,n,s){effector.is.unit(n)?(e?d:m)(t,n,s):s(n)}function y(e){return''!==e&&0!==e&&(0==e||null==e)}function v(e,t,n){y(n)?delete e[t]:e[t]=`${n}`}function k(e,t,n){n?t.contains(e)||t.appendChild(e):e.remove()}function w(e,t,n){if(y(n)){switch(t){case'value':delete e.value;break;case'checked':delete e.checked;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 x(e,t,n,s,l){const r=e.createSVGTransform();b(0,t,s,l.bind(null,r)),n.appendItem(r)}function E(e,t){const n=se.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function N(e){e.focus()}function S(e){e.blur()}function _(e,t){return e.bind(null,t)}function C(t,n){const s=q.get();if(Array.isArray(n)){const l=[];for(let e=0;e<n.length;e++)l[e]=t.map(_(R,n[e]));return s&&e(s.signal,l),l}const l=[],r={};for(const e in n)r[e]=t.map(_(R,n[e])),l.push(r[e]);return s&&e(s.signal,l),r}function R(e,t){return t[e]}function O(t,n){let s,r,i=0;effector.is.store(t)?(r=Ve,s=t):(r=_(Te,t.key),s=t.source,i=!!t.reverse);const o=q.get(),f=l(),h={parent:o,signal:f,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:i,key:effector.is.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial'};a(o,h),q.replace(h);const p={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:i,parentStack:h,getID:r},u=effector.createStore($(p,[],s.getState()));e(f,[u]),c(f,_(je,u)),effector.sample({source:u,clock:s,fn:_($,p),target:u}),q.replace(o)}function $(r,i,o){const c=Array(o.length).fill(0),f=o.map(r.getID),h=[],p=[],u=[];for(let e=0;e<i.length;e++){const t=i[e],n=t.node,s=f.indexOf(n.key);-1!==s?(p.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch(n.store,o[s],1)):u.push(t)}if(u.length>0){for(let e=0;e<u.length;e++){const l=u[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(De,u,1)}let g=p.length>0?p[p.length-1]:null;for(let n=0;n<o.length;n++){if(c[n])continue;const s=o[n],i=effector.createStore(s),f=l();e(f,[i]);const u=r.getID(s,n),d={parent:r.parentStack,signal:f,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:u,index:u,store:i,signal:f,active:1,nodes:[]},mountStatus:'initial'};t(g,d),g=d,a(r.parentStack,d),h.push(d),p.push(d)}return h.length>0&&effector.launch(Pe,{context:r,list:h},1),p}function A(t){const n=q.get();return n&&e(n.signal,[t]),t}function I(){const e=q.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function P(e){const t=q.get();t.targetElement.__STATIC__||e(t.targetElement)}function V(e){e.attr&&T(e.attr),e.data&&D(e.data),e.transform&&j(e.transform),'text'in e&&M(e.text),'visible'in e&&F(e.visible),e.style&&z(e.style),e.focus&&W(e.focus),e.handler&&L(e.handler)}function T(e){I(),q.getElementNode().attr.push(e)}function D(e){I(),q.getElementNode().data.push(e)}function j(e){I(),q.getElementNode().transform.push(e)}function M(e){I(),q.getElementNode().text.push(e)}function F(e){I(),q.getElementNode().visible.push(e)}function z({prop:e,val:t}){I(),e&&q.getElementNode().styleProp.push(e),t&&q.getElementNode().styleVar.push(t)}function L(e,t){I(),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0}=e;q.getElementNode().handler.push({options:{passive:n,capture:s},map:t})}function W({focus:e,blur:t}){I();const n=q.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const X=[];let Y;const q={get:()=>Y,replace(e){Y=e},getElementNode:()=>Y.node},G=e=>e.graphite||e,U=e=>e.family.owners,B=e=>e.family.links,Z=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),H=effector.step.compute({fn(e,l){l.self.next.push(Z);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)}}),J=effector.step.compute({fn:(e,{self:t})=>t}),K=/[^a-zA-Z0-9\-]/g,Q=/[\\<>"]/g;class ee{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[r(e)]=i(t)}removeProperty(e){delete this.properties[r(e)]}}class te{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ne{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 ee,this.firstChild=null,this.transform={baseVal:new te},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 ne}}).isBody=1;let se='undefined'!=typeof globalThis&&globalThis.document||'undefined'!=typeof global&&global.document;const le=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}}),re=effector.step.run({fn(e,{fn:t}){t(e)}}),ie=10,oe=effector.createEvent();let ae,ce=0,fe=0;const he=()=>{fe||(fe=1,ae=requestAnimationFrame(f))},pe=new Map,ue=new Map,ge=new Map,de=new Map;let me=0,be=0;const ye=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===ue.size&&0===ge.size?0:performance.now()-be>=ie?0:(cancelAnimationFrame(ae),ce=1,fe=0,1)})],child:[oe]});oe.watch(()=>{if(fe)return;if(0===ue.size&&0===ge.size)return void(ce=0);let e=0;ce||(be=performance.now()),ce=0;for(const[t,n]of ue){if(performance.now()-be>=ie){he(),e=1;break}ue.delete(t);const s=pe.get(t);effector.launch(s,n,1)}if(!e)for(const[t,n]of ge){if(performance.now()-be>=ie){he(),e=1;break}ge.delete(t);const s=pe.get(t);effector.launch(s,n,1)}effector.launch(ye,null,1)});const ve=effector.step.compute({fn:({done:e})=>e}),ke=effector.step.compute({fn:({fail:e})=>e}),we=effector.step.filter({fn:e=>e.length>0}),xe=effector.step.compute({fn(e,{taskID:t}){h(t,1,e)}}),Ee=effector.step.compute({fn(e,{taskID:t,flat:n}){h(t,n,e)}}),Ne=effector.step.run({fn:(e,{fn:t})=>t(e,be)}),Se=effector.step.compute({fn:e=>[e]}),_e=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ce}=u({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Re=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Oe=(e,t,n)=>{y(n)?delete e[t]:e[t]=n},$e=(e,t,n)=>{y(n)?e.removeProperty(t):e.setProperty(t,n)},Ae={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:Ie}=u({mark:'append DOM nodes',fn:e=>{const t=[];for(let n=0;n<e.append.length;n++){const s=e.append[n];if(0!=s.listItem.active)for(let e=0;e<s.appended.length;e++)t.push(s.appended[e])}t.length>0&&o({node:e.node,append:t,reverse:e.reverse})}}),{trigger:Pe}=u({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:r}=e,i=q.get();q.replace(n);const o=[],a=[];X.push({node:s,append:a,reverse:r});for(let e=0;e<t.length;e++){const n=t[e],s=n.node;if(s.active){q.replace(n),l(s);for(let e=0;e<a.length;e++)s.nodes.push(a[e]);o.push({appended:a.slice(),listItem:s}),a.length=0}}X.pop(),o.length>0&&effector.launch(Ie,{node:s,append:o,reverse:r},1),q.replace(i)}}),Ve=(e,t)=>t,Te=(e,t)=>t[e],De=effector.createEvent();g({trigger:De,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),g({trigger:De,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const je=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(De,t,1)};exports.attr=T,exports.combine=({source:e,fn:t})=>A(effector.combine(e,t)),exports.data=D,exports.explicitUnmount=e=>{const t=q.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=W,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,r=q.get(),i=r?r.namespace:'html';let f=i,h='html';'type'in t?(h=t.type,f=t.type):f=h='svg'===i?'svg':'html','svg'===e&&(h='svg',f='svg');const p='svg'===h?se.createElementNS('http://www.w3.org/2000/svg',e):se.createElement(e);'foreignObject'===i?(p.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),f='html'):'svg'===e?(p.setAttribute('xmlns','http://www.w3.org/2000/svg'),f='svg'):'foreignObject'===e&&(f='foreignObject');const u={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:l(),namespace:f,targetElement:p,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:u,mountStatus:'initial'};return r&&a(r,g),'svg'===e?g.svgRoot=p:r&&(g.svgRoot=r.svgRoot),q.replace(g),n?((e,t,n)=>{let s=0;X.push({node:e,append:[],reverse:0});try{n(),s=1}finally{o(X.pop()),s||q.replace(t)}})(p,r,n):(u.pure=1,V(t)),(()=>{const e=(()=>{const e=q.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};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=q.get(),n=t.targetElement,s=t.signal;((e,t,n)=>{for(const s in n)b('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],w.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)b(0,t,n[s],v.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,Re.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],Oe.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],$e.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=q.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)x(r,t,l,s[e],Ae[e])}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?m(t,n,E.bind(null,e)):E(e,n))})(n,s,e.text),((e,t,n)=>{if(null===n)return;const s=q.get().parent.targetElement;m(t,n,k.bind(null,e,s))})(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],N.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],S.bind(null,e))})(n,s,e.blur)})(),q.replace(r),s||X.length>0&&X[X.length-1].append.push(p),p},exports.handler=L,exports.list=O,exports.map=(e,{fn:t})=>A(e.map(t)),exports.node=P,exports.nodeMethod=e=>{let t;return P(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=C,exports.signalOwn=A,exports.spec=V,exports.storeField=(t,n)=>{const s=t.map(_(R,n)),l=q.get();return l&&e(l.signal,[s]),s},exports.style=z,exports.text=M,exports.transform=j,exports.tree=function e({key:t,child:n,source:s},l){O({source:s,key:t},({store:s,key:r,signal:i})=>{const[o]=C(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=q.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'};q.replace(a),X.push({node:e,append:[],reverse:0});try{return t()}finally{o(X.pop()),q.replace(i)}},exports.visible=F; | ||
function e(e,t){const n=G(e);for(let e=0;e<t.length;e++){const s=G(t[e]);s.family.type='crosslink';const l=U(s),r=B(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=q.get(),n=effector.createNode({node:[H,J],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(K,'')}}function i(e){return String(e).replace(Q,'')}function o({node:e,append:t,reverse:n=0}){if(0===t.length)return;const s=se.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(le),t.signal.scope.stack=t,e.child.push(t)}function c(e,t){return effector.createNode({node:[re],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function f(){fe=0,oe()}function h(e,t,n){const s=(e=>'high'===de.get(e)?ue:ge)(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);he()}function p(t,n,s=0,l="low"){const r=++me,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:[Ee],parent:[o],scope:{taskID:r,flat:s},family:c}),e(t,[i]),pe.set(r,effector.createNode({node:[Ne],child:[effector.createNode({node:[ke,we,xe],scope:{taskID:r},family:c}),effector.createNode({node:[ve,we],child:[i],family:c})],scope:{fn:n},family:c})),de.set(r,l),i}function u({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=p(e.map(e=>[{inserted:performance.now(),retry:0,value:e}]),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const r=e[i],f=performance.now();if(r.inserted+l>f){c.push(r);continue}if(r.inserted+s<f)continue;if(f-n>=ie){o=1;break}const h=t(r.value);void 0!==h&&a.push(h)}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 g({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=p(e.map(e=>{const t=[],n=performance.now();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],f=performance.now();if(r.inserted+l>f){c.push(r);continue}if(r.inserted+s<f)continue;if(f-n>=ie){o=1;break}const h=t(r.value);void 0!==h&&a.push(h)}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:[Se],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function d(e,t,n){c(e,t.watch(n))}function m(e,t,n){effector.createNode({node:[_e],parent:t,child:[Ce],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(Ce,{data:t.getState(),handler:n},1)}function b(e,t,n,s){effector.is.unit(n)?(e?d:m)(t,n,s):s(n)}function y(e){return''!==e&&0!==e&&(0==e||null==e)}function v(e,t,n){y(n)?delete e[t]:e[t]=`${n}`}function k(e,t,n){n?t.contains(e)||t.appendChild(e):e.remove()}function w(e,t,n){if(y(n)){switch(t){case'value':delete e.value;break;case'checked':delete e.checked;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 x(e,t,n,s,l){const r=e.createSVGTransform();b(0,t,s,l.bind(null,r)),n.appendItem(r)}function E(e,t){const n=se.createTextNode(`${t}`),s=e.firstChild;s?s.replaceWith(n):e.appendChild(n)}function N(e){e.focus()}function S(e){e.blur()}function _(e,t){return e.bind(null,t)}function C(t,n){const s=q.get();if(Array.isArray(n)){const l=[];for(let e=0;e<n.length;e++)l[e]=t.map(_(R,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(_(R,n[e])),l.push(r[e]);return s&&e(s.signal,l),r}const l=t.map(_(R,n));return s&&e(s.signal,l),l}function R(e,t){return t[e]}function O(t,n){let s,r,i=0;effector.is.store(t)?(r=Ve,s=t):(r=_(Te,t.key),s=t.source,i=!!t.reverse);const o=q.get(),f=l(),h={parent:o,signal:f,namespace:o.namespace,targetElement:o.targetElement,svgRoot:o.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:i,key:effector.is.store(t)?{type:'index'}:{type:'key',key:t.key},store:s,cb:n},mountStatus:'initial'};a(o,h),q.replace(h);const p={parentNode:o.targetElement,cb:n,shortName:s.shortName,reverse:i,parentStack:h,getID:r},u=effector.createStore($(p,[],s.getState()));e(f,[u]),c(f,_(De,u)),effector.sample({source:u,clock:s,fn:_($,p),target:u}),q.replace(o)}function $(r,i,o){const c=Array(o.length).fill(0),f=o.map(r.getID),h=[],p=[],u=[];for(let e=0;e<i.length;e++){const t=i[e],n=t.node,s=f.indexOf(n.key);-1!==s?(p.push(t),c[s]=1,n.store.getState()!==o[s]&&effector.launch(n.store,o[s],1)):u.push(t)}if(u.length>0){for(let e=0;e<u.length;e++){const l=u[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(je,u,1)}let g=p.length>0?p[p.length-1]:null;for(let n=0;n<o.length;n++){if(c[n])continue;const s=o[n],i=effector.createStore(s),f=l();e(f,[i]);const u=r.getID(s,n),d={parent:r.parentStack,signal:f,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:u,index:u,store:i,signal:f,active:1,nodes:[]},mountStatus:'initial'};t(g,d),g=d,a(r.parentStack,d),h.push(d),p.push(d)}return h.length>0&&effector.launch(Pe,{context:r,list:h},1),p}function A(t){const n=q.get();return n&&e(n.signal,[t]),t}function I(){const e=q.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function P(e){const t=q.get();t.targetElement.__STATIC__||e(t.targetElement)}function V(e){e.attr&&T(e.attr),e.data&&j(e.data),e.transform&&D(e.transform),'text'in e&&M(e.text),'visible'in e&&F(e.visible),(e.style||e.styleVar)&&z({prop:e.style,val:e.styleVar}),e.focus&&W(e.focus),e.handler&&L(e.handler)}function T(e){I(),q.getElementNode().attr.push(e)}function j(e){I(),q.getElementNode().data.push(e)}function D(e){I(),q.getElementNode().transform.push(e)}function M(e){I(),q.getElementNode().text.push(e)}function F(e){I(),q.getElementNode().visible.push(e)}function z({prop:e,val:t}){I(),e&&q.getElementNode().styleProp.push(e),t&&q.getElementNode().styleVar.push(t)}function L(e,t){I(),void 0===t&&(t=e,e={});const{passive:n=1,capture:s=0}=e;q.getElementNode().handler.push({options:{passive:n,capture:s},map:t})}function W({focus:e,blur:t}){I();const n=q.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var effector=require('effector');const X=[];let Y;const q={get:()=>Y,replace(e){Y=e},getElementNode:()=>Y.node},G=e=>e.graphite||e,U=e=>e.family.owners,B=e=>e.family.links,Z=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),H=effector.step.compute({fn(e,l){l.self.next.push(Z);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)}}),J=effector.step.compute({fn:(e,{self:t})=>t}),K=/[^a-zA-Z0-9\-]/g,Q=/[\\<>"]/g;class ee{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[r(e)]=i(t)}removeProperty(e){delete this.properties[r(e)]}}class te{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ne{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 ee,this.firstChild=null,this.transform={baseVal:new te},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 ne}}).isBody=1;let se='undefined'!=typeof globalThis&&globalThis.document||'undefined'!=typeof global&&global.document;const le=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}}),re=effector.step.run({fn(e,{fn:t}){t(e)}}),ie=10,oe=effector.createEvent();let ae,ce=0,fe=0;const he=()=>{fe||(fe=1,ae=requestAnimationFrame(f))},pe=new Map,ue=new Map,ge=new Map,de=new Map;let me=0,be=0;const ye=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===ue.size&&0===ge.size?0:performance.now()-be>=ie?0:(cancelAnimationFrame(ae),ce=1,fe=0,1)})],child:[oe]});oe.watch(()=>{if(fe)return;if(0===ue.size&&0===ge.size)return void(ce=0);let e=0;ce||(be=performance.now()),ce=0;for(const[t,n]of ue){if(performance.now()-be>=ie){he(),e=1;break}ue.delete(t);const s=pe.get(t);effector.launch(s,n,1)}if(!e)for(const[t,n]of ge){if(performance.now()-be>=ie){he(),e=1;break}ge.delete(t);const s=pe.get(t);effector.launch(s,n,1)}effector.launch(ye,null,1)});const ve=effector.step.compute({fn:({done:e})=>e}),ke=effector.step.compute({fn:({fail:e})=>e}),we=effector.step.filter({fn:e=>e.length>0}),xe=effector.step.compute({fn(e,{taskID:t}){h(t,1,e)}}),Ee=effector.step.compute({fn(e,{taskID:t,flat:n}){h(t,n,e)}}),Ne=effector.step.run({fn:(e,{fn:t})=>t(e,be)}),Se=effector.step.compute({fn:e=>[e]}),_e=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:Ce}=u({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Re=(e,{map:t,options:n})=>{for(const s in t)e.removeEventListener(s,t[s],n)},Oe=(e,t,n)=>{y(n)?delete e[t]:e[t]=n},$e=(e,t,n)=>{y(n)?e.removeProperty(t):e.setProperty(t,n)},Ae={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:Ie}=u({mark:'append DOM nodes',fn:e=>{const t=[];for(let n=0;n<e.append.length;n++){const s=e.append[n];if(0!=s.listItem.active)for(let e=0;e<s.appended.length;e++)t.push(s.appended[e])}t.length>0&&o({node:e.node,append:t,reverse:e.reverse})}}),{trigger:Pe}=u({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:s,cb:l,reverse:r}=e,i=q.get();q.replace(n);const o=[],a=[];X.push({node:s,append:a,reverse:r});for(let e=0;e<t.length;e++){const n=t[e],s=n.node;if(s.active){q.replace(n),l(s);for(let e=0;e<a.length;e++)s.nodes.push(a[e]);o.push({appended:a.slice(),listItem:s}),a.length=0}}X.pop(),o.length>0&&effector.launch(Ie,{node:s,append:o,reverse:r},1),q.replace(i)}}),Ve=(e,t)=>t,Te=(e,t)=>t[e],je=effector.createEvent();g({trigger:je,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),g({trigger:je,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const De=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(je,t,1)};exports.attr=T,exports.combine=({source:e,fn:t})=>A(effector.combine(e,t)),exports.data=j,exports.explicitUnmount=e=>{const t=q.get();t&&effector.createNode({node:[],parent:e,child:t.signal,family:{type:'crosslink',owners:[t.signal,e]}})},exports.focus=W,exports.h=(e,t,n)=>{'function'==typeof t&&(n=t,t={}),void 0===t&&(t={});const{noAppend:s=0}=t,r=q.get(),i=r?r.namespace:'html';let f=i,h='html';'type'in t?(h=t.type,f=t.type):f=h='svg'===i?'svg':'html','svg'===e&&(h='svg',f='svg');const p='svg'===h?se.createElementNS('http://www.w3.org/2000/svg',e):se.createElement(e);'foreignObject'===i?(p.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),f='html'):'svg'===e?(p.setAttribute('xmlns','http://www.w3.org/2000/svg'),f='svg'):'foreignObject'===e&&(f='foreignObject');const u={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:l(),namespace:f,targetElement:p,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:u,mountStatus:'initial'};return r&&a(r,g),'svg'===e?g.svgRoot=p:r&&(g.svgRoot=r.svgRoot),q.replace(g),n?((e,t,n)=>{let s=0;X.push({node:e,append:[],reverse:0});try{n(),s=1}finally{o(X.pop()),s||q.replace(t)}})(p,r,n):(u.pure=1,V(t)),(()=>{const e=(()=>{const e=q.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};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=q.get(),n=t.targetElement,s=t.signal;((e,t,n)=>{for(const s in n)b('value'!==s&&'checked'!==s&&'min'!==s&&'max'!==s,t,n[s],w.bind(null,e,s))})(n,s,e.attr),((e,t,n)=>{for(const s in n)b(0,t,n[s],v.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,Re.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],Oe.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],$e.bind(null,s,`--${e}`))})(n,s,e.styleVar),((e,t,n)=>{const s=q.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)x(r,t,l,s[e],Ae[e])}})(n,s,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?m(t,n,E.bind(null,e)):E(e,n))})(n,s,e.text),((e,t,n)=>{if(null===n)return;const s=q.get().parent.targetElement;m(t,n,k.bind(null,e,s))})(n,s,e.visible),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],N.bind(null,e))})(n,s,e.focus),((e,t,n)=>{for(let s=0;s<n.length;s++)b(1,t,n[s],S.bind(null,e))})(n,s,e.blur)})(),q.replace(r),s||X.length>0&&X[X.length-1].append.push(p),p},exports.handler=L,exports.list=O,exports.map=(e,{fn:t})=>A(e.map(t)),exports.node=P,exports.nodeMethod=e=>{let t;return P(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=C,exports.signalOwn=A,exports.spec=V,exports.storeField=(t,n)=>{const s=t.map(_(R,n)),l=q.get();return l&&e(l.signal,[s]),s},exports.style=z,exports.text=M,exports.transform=D,exports.tree=function e({key:t,child:n,source:s},l){O({source:s,key:t},({store:s,key:r,signal:i})=>{const[o]=C(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=q.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'};q.replace(a),X.push({node:e,append:[],reverse:0});try{return t()}finally{o(X.pop()),q.replace(i)}},exports.visible=F; | ||
//# sourceMappingURL=effector-dom.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function t(t,e){const n=ft(t);for(let t=0;t<e.length;t++){const l=ft(e[t]);l.family.type='crosslink';const i=ht(l),s=ut(n);i.includes(n)||i.push(n),s.includes(l)||s.push(l)}}function e(t,e){n(t,e),l(e,t)}function n(t,e){t&&t!==e&&(t.locality.sibling.right.ref=e)}function l(t,e){t&&t!==e&&(t.locality.sibling.left.ref=e)}function i(){const t={stack:null},e=ct.get(),n=J({node:[gt,dt],parent:[e&&e.signal].filter(Boolean),meta:{unit:'signal'},scope:t});return t.self=n,n}function s(t){switch(t=String(t)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return t.replace(mt,'')}}function r(t){return String(t).replace(bt,'')}function o(t,e){const n=t.namespaceURI,l=t.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===l?'foreignObject':'html',r=ct.get(),o={parent:r,signal:r&&r.signal?r.signal:i(),namespace:s,targetElement:t,svgRoot:'svg'===l?t: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'};ct.replace(o),ot.push({node:t,append:[],reverse:0});try{return e()}finally{a(ot.pop()),ct.replace(r)}}function a({node:t,append:e,reverse:n=0}){if(0===e.length)return;const l=wt.createDocumentFragment();if(n){for(let t=e.length-1;t>=0;t--)l.appendChild(e[t]);t.prepend(l)}else{for(let t=0;t<e.length;t++)l.appendChild(e[t]);t.appendChild(l)}}function c(t,e){e.parent=t,e.signal.seq.push(xt),e.signal.scope.stack=e,t.child.push(e)}function f(t,e){return J({node:[St],parent:t,meta:{op:'watch'},scope:{fn:e},family:{type:'crosslink',owners:[t]}})}function h(){Rt=0,Ct()}function u(t,e,n){const l=(t=>'high'===Pt.get(t)?It:Ot)(t);let i=l.get(t);if(i||(i=[],l.set(t,i)),e)for(let t=0;t<n.length;t++)i.push(n[t]);else i.push(n);$t()}function p(e,n,l=0,i="low"){const s=++Vt,r=tt(),o=nt.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return J({node:[Lt],parent:[o],scope:{taskID:s,flat:l},family:c}),t(e,[r]),At.set(s,J({node:[Wt],child:[J({node:[Mt,zt,Ft],scope:{taskID:s},family:c}),J({node:[jt,zt],child:[r],family:c})],scope:{fn:n},family:c})),Pt.set(s,i),r}function g({trigger:t=tt(),fn:e,priority:n="low",timeout:l=1/0,batchWindow:i=0,retries:s=1/0,mark:r=t.shortName}){const o=p(t.map(t=>[{inserted:performance.now(),retry:0,value:t}]),(t,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<t.length;r++){const s=t[r],f=performance.now();if(s.inserted+i>f){c.push(s);continue}if(s.inserted+l<f)continue;if(f-n>=Et){o=1;break}const h=e(s.value);void 0!==h&&a.push(h)}if(o)for(let e=r;e<t.length;e++){const n=t[e];n.retry+=1,n.retry>=s||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:t,processed:o,connect:e=>{J({node:[],parent:e,child:t,family:{type:'crosslink',owners:[e,t]}})}}}function d({trigger:t=tt(),fn:e,priority:n="low",timeout:l=1/0,batchWindow:i=0,retries:s=1/0,mark:r=t.shortName,flatten:o}){const a=p(t.map(t=>{const e=[],n=performance.now();for(let l=0;l<t.length;l++){const i=o(t[l]);for(let t=0;t<i.length;t++)e.push({inserted:n,retry:0,value:i[t]})}return e}),(t,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<t.length;r++){const s=t[r],f=performance.now();if(s.inserted+i>f){c.push(s);continue}if(s.inserted+l<f)continue;if(f-n>=Et){o=1;break}const h=e(s.value);void 0!==h&&a.push(h)}if(o)for(let e=r;e<t.length;e++){const n=t[e];n.retry+=1,n.retry>=s||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:t,processed:a,connect:e=>{J({node:[Xt],parent:e,child:t,family:{type:'crosslink',owners:[e,t]}})}}}function m(t,e,n){f(t,e.watch(n))}function b(t,e,n){J({node:[Yt],parent:e,child:[Gt],family:{type:'crosslink',owners:t},scope:{handler:n},meta:{op:'debounceRaf'}}),nt.store(e)&&et(Gt,{data:e.getState(),handler:n},1)}function y(t,e,n,l){nt.unit(n)?(t?m:b)(e,n,l):l(n)}function v(t){return''!==t&&0!==t&&(0==t||null==t)}function k(t,e,n){v(n)?delete t[e]:t[e]=`${n}`}function w(t,e,n){n?e.contains(t)||e.appendChild(t):t.remove()}function x(t,e,n){if(v(n)){switch(e){case'value':delete t.value;break;case'checked':delete t.checked;break;case'spellcheck':if(0==n)return void t.setAttribute('spellcheck','false')}t.removeAttribute(e)}else{switch(e){case'value':t.value=`${n}`;break;case'checked':t.checked=`${n}`}t.setAttribute(e,`${n}`)}}function S(t,e,n,l,i){const s=t.createSVGTransform();y(0,e,l,i.bind(null,s)),n.appendItem(s)}function E(t,e){const n=wt.createTextNode(`${e}`),l=t.firstChild;l?l.replaceWith(n):t.appendChild(n)}function C(t){t.focus()}function N(t){t.blur()}function _(t,e,n){'function'==typeof e&&(n=e,e={}),void 0===e&&(e={});const{noAppend:l=0}=e,s=ct.get(),r=s?s.namespace:'html';let o=r,h='html';'type'in e?(h=e.type,o=e.type):o=h='svg'===r?'svg':'html','svg'===t&&(h='svg',o='svg');const u='svg'===h?wt.createElementNS('http://www.w3.org/2000/svg',t):wt.createElement(t);'foreignObject'===r?(u.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===t?(u.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===t&&(o='foreignObject');const p={type:'element',pure:0,tag:t,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:i(),namespace:o,targetElement:u,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:p,mountStatus:'initial'};return s&&c(s,g),'svg'===t?g.svgRoot=u:s&&(g.svgRoot=s.svgRoot),ct.replace(g),n?((t,e,n)=>{let l=0;ot.push({node:t,append:[],reverse:0});try{n(),l=1}finally{a(ot.pop()),l||ct.replace(e)}})(u,s,n):(p.pure=1,F(e)),(()=>{const t=(()=>{const t=ct.getElementNode(),e={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:t.handler,transform:t.transform,focus:t.focus,blur:t.blur};for(let n=0;n<t.attr.length;n++){const l=t.attr[n];for(const t in l)e.attr[t]=l[t]}for(let n=0;n<t.data.length;n++){const l=t.data[n];for(const t in l)e.data[t]=l[t]}t.visible.length>0&&(e.visible=t.visible[t.visible.length-1]),t.text.length>0&&(e.text=t.text[t.text.length-1]);for(let n=0;n<t.styleVar.length;n++){const l=t.styleVar[n];for(const t in l)e.styleVar[t]=l[t]}for(let n=0;n<t.styleProp.length;n++){const l=t.styleProp[n];for(const t in l)e.styleProp[t]=l[t]}return e})(),e=ct.get(),n=e.targetElement,l=e.signal;((t,e,n)=>{for(const l in n)y('value'!==l&&'checked'!==l&&'min'!==l&&'max'!==l,e,n[l],x.bind(null,t,l))})(n,l,t.attr),((t,e,n)=>{for(const l in n)y(0,e,n[l],k.bind(null,t.dataset,l))})(n,l,t.data),((t,e,n)=>{for(let l=0;l<n.length;l++){const{options:i,map:s}=n[l];for(const e in s)t.addEventListener(e,s[e],i);f(e,qt.bind(null,t,n[l]))}})(n,l,t.handler),((t,e,n)=>{const l=t.style;for(const t in n)y(0,e,n[t],Bt.bind(null,l,t))})(n,l,t.styleProp),((t,e,n)=>{const l=t.style;for(const t in n)y(0,e,n[t],Ut.bind(null,l,`--${t}`))})(n,l,t.styleVar),((t,e,n)=>{const l=ct.get();if('svg'!==l.namespace)return;if(0===n.length)return;const i=t.transform.baseVal,s=l.svgRoot;for(let t=0;t<n.length;t++){const l=n[t];for(const t in l)S(s,e,i,l[t],Zt[t])}})(n,l,t.transform),((t,e,n)=>{null!==n&&(nt.unit(n)?b(e,n,E.bind(null,t)):E(t,n))})(n,l,t.text),((t,e,n)=>{if(null===n)return;const l=ct.get().parent.targetElement;b(e,n,w.bind(null,t,l))})(n,l,t.visible),((t,e,n)=>{for(let l=0;l<n.length;l++)y(1,e,n[l],C.bind(null,t))})(n,l,t.focus),((t,e,n)=>{for(let l=0;l<n.length;l++)y(1,e,n[l],N.bind(null,t))})(n,l,t.blur)})(),ct.replace(s),l||ot.length>0&&ot[ot.length-1].append.push(u),u}function R(t,e){return t.bind(null,e)}function $(e,n){const l=ct.get();if(Array.isArray(n)){const i=[];for(let t=0;t<n.length;t++)i[t]=e.map(R(I,n[t]));return l&&t(l.signal,i),i}const i=[],s={};for(const t in n)s[t]=e.map(R(I,n[t])),i.push(s[t]);return l&&t(l.signal,i),s}function A(e,n){const l=e.map(R(I,n)),i=ct.get();return i&&t(i.signal,[l]),l}function I(t,e){return e[t]}function O({key:t,child:e,source:n},l){P({source:n,key:t},({store:n,key:i,signal:s})=>{const[r]=$(n,[e]);l({store:n,key:i,signal:s},()=>{O({key:t,child:e,source:r},l)})})}function P(e,n){let l,s,r=0;nt.store(e)?(s=Kt,l=e):(s=R(Qt,e.key),l=e.source,r=!!e.reverse);const o=ct.get(),a=i(),h={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:nt.store(e)?{type:'index'}:{type:'key',key:e.key},store:l,cb:n},mountStatus:'initial'};c(o,h),ct.replace(h);const u={parentNode:o.targetElement,cb:n,shortName:l.shortName,reverse:r,parentStack:h,getID:s},p=lt(V(u,[],l.getState()));t(a,[p]),f(a,R(ee,p)),st({source:p,clock:l,fn:R(V,u),target:p}),ct.replace(o)}function V(s,r,o){const a=Array(o.length).fill(0),f=o.map(s.getID),h=[],u=[],p=[];for(let t=0;t<r.length;t++){const e=r[t],n=e.node,l=f.indexOf(n.key);-1!==l?(u.push(e),a[l]=1,n.store.getState()!==o[l]&&et(n.store,o[l],1)):p.push(e)}if(p.length>0){for(let t=0;t<p.length;t++){const i=p[t],{node:s,locality:r}=i;s.active=0,s.store=null,e(r.sibling.left.ref,r.sibling.right.ref),n(i,null),l(i,null)}et(te,p,1)}let g=u.length>0?u[u.length-1]:null;for(let n=0;n<o.length;n++){if(a[n])continue;const l=o[n],r=lt(l),f=i();t(f,[r]);const p=s.getID(l,n),d={parent:s.parentStack,signal:f,namespace:s.parentStack.namespace,targetElement:s.parentStack.targetElement,svgRoot:s.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:p,index:p,store:r,signal:f,active:1,nodes:[]},mountStatus:'initial'};e(g,d),g=d,c(s.parentStack,d),h.push(d),u.push(d)}return h.length>0&&et(Jt,{context:s,list:h},1),u}function T(t){const e=ct.get();e&&J({node:[],parent:t,child:e.signal,family:{type:'crosslink',owners:[e.signal,t]}})}function D(e){const n=ct.get();return n&&t(n.signal,[e]),e}function j(){const t=ct.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`this extension can be used only with element nodes, got "${t.node.type}"`)}function M(t){let e;return z(t=>{e=t}),(...n)=>{if(e)return e[t](...n)}}function z(t){const e=ct.get();e.targetElement.__STATIC__||t(e.targetElement)}function F(t){t.attr&&L(t.attr),t.data&&W(t.data),t.transform&&X(t.transform),'text'in t&&Y(t.text),'visible'in t&&G(t.visible),t.style&&q(t.style),t.focus&&U(t.focus),t.handler&&B(t.handler)}function L(t){j(),ct.getElementNode().attr.push(t)}function W(t){j(),ct.getElementNode().data.push(t)}function X(t){j(),ct.getElementNode().transform.push(t)}function Y(t){j(),ct.getElementNode().text.push(t)}function G(t){j(),ct.getElementNode().visible.push(t)}function q({prop:t,val:e}){j(),t&&ct.getElementNode().styleProp.push(t),e&&ct.getElementNode().styleVar.push(e)}function B(t,e){j(),void 0===e&&(e=t,t={});const{passive:n=1,capture:l=0}=t;ct.getElementNode().handler.push({options:{passive:n,capture:l},map:e})}function U({focus:t,blur:e}){j();const n=ct.getElementNode();t&&n.focus.push(t),e&&n.blur.push(e)}function Z(t,{fn:e}){return D(t.map(e))}function H({source:t,fn:e}){return D(rt(t,e))}import{createNode as J,step as K,clearNode as Q,createEvent as tt,launch as et,is as nt,createStore as lt,sample as st,combine as rt}from'effector';const ot=[];let at;const ct={get:()=>at,replace(t){at=t},getElementNode:()=>at.node},ft=t=>t.graphite||t,ht=t=>t.family.owners,ut=t=>t.family.links,pt=J({node:[K.run({fn(t){Q(t)}})]}),gt=K.compute({fn(t,i){i.self.next.push(pt);const{stack:s}=i,{parent:r}=s,{left:o,right:a}=s.locality.sibling;r&&(r.locality.child.last.ref===s&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===s&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===s&&a.ref&&a.ref.locality.sibling.left.ref===s?e(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===s?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===s&&l(a.ref,null)}}),dt=K.compute({fn:(t,{self:e})=>e}),mt=/[^a-zA-Z0-9\-]/g,bt=/[\\<>"]/g;class yt{constructor(){this.properties=Object.create(null)}setProperty(t,e){this.properties[s(t)]=r(e)}removeProperty(t){delete this.properties[s(t)]}}class vt{constructor(){this.items=[]}appendItem(t){this.items.push(t)}}class kt{constructor(){this.value=''}setTranslate(t,e){this.value=`translate(${t} ${e})`}setScale(t,e){this.value=`scale(${t} ${e})`}setRotate(t,e,n){this.value=0!==e||0!==n?`rotate(${t} ${e} ${n})`:`rotate(${t})`}setSkewX(t){this.value=`skewX(${t})`}setSkewY(t){this.value=`skewY(${t})`}}(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 yt,this.firstChild=null,this.transform={baseVal:new vt},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(t){if(t.parent&&t.remove(),t.isFragment&&null===t.textContent){let e,n=t.firstChild;for(;n;)e=n.sibling.right,this.appendChild(n),n=e}else this.child.last?(this.child.last.sibling.right=t,t.sibling.left=this.child.last):(this.child.first=t,this.firstChild=t),this.child.last=t,t.parent=this}prepend(t){t.parent&&t.remove(),this.child.last?(this.child.first.sibling.left=t,t.sibling.right=this.child.first):(this.child.first=t,this.child.last=t),this.child.first=t,this.firstChild=t,t.parent=this}contains(t){let e=t;for(;e;){if(e===this)return 1;e=e.parent}return 0}remove(){if(!this.parent)return;const{parent:t}=this;t.child.first===this&&t.child.last===this?(t.firstChild=null,t.child.first=null,t.child.last=null):t.child.first===this?(t.child.first=this.sibling.right,t.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):t.child.last===this?(t.child.last=this.sibling.left,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(t,e,n){}removeEventListener(t,e,n){}setAttribute(t,e){this.attributes[s(t)]=r(e)}removeAttribute(t){delete this.attributes[s(t)]}replaceWith(t){if(!this.parent)return;const{parent:e}=this;t.parent&&t.remove(),e.child.first===this&&e.child.last===this?(e.firstChild=t,e.child.first=t,e.child.last=t):e.child.first===this?(e.child.first=t,e.firstChild=t,this.sibling.right.sibling.left=t):e.child.last===this?(e.child.last=t,this.sibling.left.sibling.right=t):(this.sibling.right.sibling.left=t,this.sibling.left.sibling.right=t),t.sibling.left=this.sibling.left,t.sibling.right=this.sibling.right,t.parent=e,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new kt}}).isBody=1;let wt='undefined'!=typeof globalThis&&globalThis.document||'undefined'!=typeof global&&global.document;const xt=K.compute({fn(t,e){if(!e.stack)return t;const{stack:n}=e;e.stack=null;const l=n.parent.child.indexOf(n);return-1!==l&&n.parent.child.splice(l,1),n.parent=null,t}}),St=K.run({fn(t,{fn:e}){e(t)}}),Et=10,Ct=tt();let Nt,_t=0,Rt=0;const $t=()=>{Rt||(Rt=1,Nt=requestAnimationFrame(h))},At=new Map,It=new Map,Ot=new Map,Pt=new Map;let Vt=0,Tt=0;const Dt=J({node:[K.run({fn:()=>{}}),K.filter({fn:()=>0===It.size&&0===Ot.size?0:performance.now()-Tt>=Et?0:(cancelAnimationFrame(Nt),_t=1,Rt=0,1)})],child:[Ct]});Ct.watch(()=>{if(Rt)return;if(0===It.size&&0===Ot.size)return void(_t=0);let t=0;_t||(Tt=performance.now()),_t=0;for(const[e,n]of It){if(performance.now()-Tt>=Et){$t(),t=1;break}It.delete(e);const l=At.get(e);et(l,n,1)}if(!t)for(const[e,n]of Ot){if(performance.now()-Tt>=Et){$t(),t=1;break}Ot.delete(e);const l=At.get(e);et(l,n,1)}et(Dt,null,1)});const jt=K.compute({fn:({done:t})=>t}),Mt=K.compute({fn:({fail:t})=>t}),zt=K.filter({fn:t=>t.length>0}),Ft=K.compute({fn(t,{taskID:e}){u(e,1,t)}}),Lt=K.compute({fn(t,{taskID:e,flat:n}){u(e,n,t)}}),Wt=K.run({fn:(t,{fn:e})=>e(t,Tt)}),Xt=K.compute({fn:t=>[t]}),Yt=K.run({fn:(t,{handler:e})=>({data:t,handler:e})}),{trigger:Gt}=g({priority:'high',mark:'domOperation',fn({handler:t,data:e}){t(e)}}),qt=(t,{map:e,options:n})=>{for(const l in e)t.removeEventListener(l,e[l],n)},Bt=(t,e,n)=>{v(n)?delete t[e]:t[e]=n},Ut=(t,e,n)=>{v(n)?t.removeProperty(e):t.setProperty(e,n)},Zt={translate(t,{x:e=0,y:n=0}){t.setTranslate(e,n)},scale(t,{x:e=0,y:n=0}){t.setScale(e,n)},rotate(t,e){'number'==typeof e?t.setRotate(e,0,0):t.setRotate(e.angle||0,e.x||0,e.y||0)},skewX(t,e){t.setSkewX(e)},skewY(t,e){t.setSkewY(e)}},{trigger:Ht}=g({mark:'append DOM nodes',fn:t=>{const e=[];for(let n=0;n<t.append.length;n++){const l=t.append[n];if(0!=l.listItem.active)for(let t=0;t<l.appended.length;t++)e.push(l.appended[t])}e.length>0&&a({node:t.node,append:e,reverse:t.reverse})}}),{trigger:Jt}=g({mark:'addRecords',fn:({context:t,list:e})=>{const{parentStack:n,parentNode:l,cb:i,reverse:s}=t,r=ct.get();ct.replace(n);const o=[],a=[];ot.push({node:l,append:a,reverse:s});for(let t=0;t<e.length;t++){const n=e[t],l=n.node;if(l.active){ct.replace(n),i(l);for(let t=0;t<a.length;t++)l.nodes.push(a[t]);o.push({appended:a.slice(),listItem:l}),a.length=0}}ot.pop(),o.length>0&&et(Ht,{node:l,append:o,reverse:s},1),ct.replace(r)}}),Kt=(t,e)=>e,Qt=(t,e)=>e[t],te=tt();d({trigger:te,priority:'high',mark:'runSignals',flatten:({signal:t})=>[t],fn:t=>{t.scope&&et(t,null,0)}}),d({trigger:te,priority:'high',mark:'remove DOM nodes',flatten({node:t}){const{nodes:e}=t;return e},fn:t=>(t.remove(),t)});const ee=t=>{const e=t.getState();for(let t=0;t<e.length;t++){const n=e[t].node;n.active=0,n.store=null}et(te,e,1)};export{L as attr,H as combine,W as data,T as explicitUnmount,U as focus,_ as h,B as handler,P as list,Z as map,z as node,M as nodeMethod,$ as remap,D as signalOwn,F as spec,A as storeField,q as style,Y as text,X as transform,O as tree,o as using,G as visible}; | ||
function t(t,e){const n=ft(t);for(let t=0;t<e.length;t++){const l=ft(e[t]);l.family.type='crosslink';const i=ht(l),s=ut(n);i.includes(n)||i.push(n),s.includes(l)||s.push(l)}}function e(t,e){n(t,e),l(e,t)}function n(t,e){t&&t!==e&&(t.locality.sibling.right.ref=e)}function l(t,e){t&&t!==e&&(t.locality.sibling.left.ref=e)}function i(){const t={stack:null},e=ct.get(),n=J({node:[gt,dt],parent:[e&&e.signal].filter(Boolean),meta:{unit:'signal'},scope:t});return t.self=n,n}function s(t){switch(t=String(t)){case'__proto__':case'__defineGetter__':case'__defineSetter__':case'constructor':case'prototype':case'hasOwnProperty':case'toString':case'valueOf':return'blacklisted';default:return t.replace(mt,'')}}function r(t){return String(t).replace(bt,'')}function o(t,e){const n=t.namespaceURI,l=t.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===l?'foreignObject':'html',r=ct.get(),o={parent:r,signal:r&&r.signal?r.signal:i(),namespace:s,targetElement:t,svgRoot:'svg'===l?t: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'};ct.replace(o),ot.push({node:t,append:[],reverse:0});try{return e()}finally{a(ot.pop()),ct.replace(r)}}function a({node:t,append:e,reverse:n=0}){if(0===e.length)return;const l=wt.createDocumentFragment();if(n){for(let t=e.length-1;t>=0;t--)l.appendChild(e[t]);t.prepend(l)}else{for(let t=0;t<e.length;t++)l.appendChild(e[t]);t.appendChild(l)}}function c(t,e){e.parent=t,e.signal.seq.push(xt),e.signal.scope.stack=e,t.child.push(e)}function f(t,e){return J({node:[St],parent:t,meta:{op:'watch'},scope:{fn:e},family:{type:'crosslink',owners:[t]}})}function h(){Rt=0,Ct()}function u(t,e,n){const l=(t=>'high'===Vt.get(t)?It:Ot)(t);let i=l.get(t);if(i||(i=[],l.set(t,i)),e)for(let t=0;t<n.length;t++)i.push(n[t]);else i.push(n);$t()}function p(e,n,l=0,i="low"){const s=++Pt,r=tt(),o=nt.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,r]};return J({node:[Lt],parent:[o],scope:{taskID:s,flat:l},family:c}),t(e,[r]),At.set(s,J({node:[Wt],child:[J({node:[Mt,zt,Ft],scope:{taskID:s},family:c}),J({node:[jt,zt],child:[r],family:c})],scope:{fn:n},family:c})),Vt.set(s,i),r}function g({trigger:t=tt(),fn:e,priority:n="low",timeout:l=1/0,batchWindow:i=0,retries:s=1/0,mark:r=t.shortName}){const o=p(t.map(t=>[{inserted:performance.now(),retry:0,value:t}]),(t,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<t.length;r++){const s=t[r],f=performance.now();if(s.inserted+i>f){c.push(s);continue}if(s.inserted+l<f)continue;if(f-n>=Et){o=1;break}const h=e(s.value);void 0!==h&&a.push(h)}if(o)for(let e=r;e<t.length;e++){const n=t[e];n.retry+=1,n.retry>=s||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:t,processed:o,connect:e=>{J({node:[],parent:e,child:t,family:{type:'crosslink',owners:[e,t]}})}}}function d({trigger:t=tt(),fn:e,priority:n="low",timeout:l=1/0,batchWindow:i=0,retries:s=1/0,mark:r=t.shortName,flatten:o}){const a=p(t.map(t=>{const e=[],n=performance.now();for(let l=0;l<t.length;l++){const i=o(t[l]);for(let t=0;t<i.length;t++)e.push({inserted:n,retry:0,value:i[t]})}return e}),(t,n)=>{let r,o=0;const a=[],c=[];for(r=0;r<t.length;r++){const s=t[r],f=performance.now();if(s.inserted+i>f){c.push(s);continue}if(s.inserted+l<f)continue;if(f-n>=Et){o=1;break}const h=e(s.value);void 0!==h&&a.push(h)}if(o)for(let e=r;e<t.length;e++){const n=t[e];n.retry+=1,n.retry>=s||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:t,processed:a,connect:e=>{J({node:[Xt],parent:e,child:t,family:{type:'crosslink',owners:[e,t]}})}}}function m(t,e,n){f(t,e.watch(n))}function b(t,e,n){J({node:[Yt],parent:e,child:[Gt],family:{type:'crosslink',owners:t},scope:{handler:n},meta:{op:'debounceRaf'}}),nt.store(e)&&et(Gt,{data:e.getState(),handler:n},1)}function y(t,e,n,l){nt.unit(n)?(t?m:b)(e,n,l):l(n)}function v(t){return''!==t&&0!==t&&(0==t||null==t)}function k(t,e,n){v(n)?delete t[e]:t[e]=`${n}`}function w(t,e,n){n?e.contains(t)||e.appendChild(t):t.remove()}function x(t,e,n){if(v(n)){switch(e){case'value':delete t.value;break;case'checked':delete t.checked;break;case'spellcheck':if(0==n)return void t.setAttribute('spellcheck','false')}t.removeAttribute(e)}else{switch(e){case'value':t.value=`${n}`;break;case'checked':t.checked=`${n}`}t.setAttribute(e,`${n}`)}}function S(t,e,n,l,i){const s=t.createSVGTransform();y(0,e,l,i.bind(null,s)),n.appendItem(s)}function E(t,e){const n=wt.createTextNode(`${e}`),l=t.firstChild;l?l.replaceWith(n):t.appendChild(n)}function C(t){t.focus()}function N(t){t.blur()}function _(t,e,n){'function'==typeof e&&(n=e,e={}),void 0===e&&(e={});const{noAppend:l=0}=e,s=ct.get(),r=s?s.namespace:'html';let o=r,h='html';'type'in e?(h=e.type,o=e.type):o=h='svg'===r?'svg':'html','svg'===t&&(h='svg',o='svg');const u='svg'===h?wt.createElementNS('http://www.w3.org/2000/svg',t):wt.createElement(t);'foreignObject'===r?(u.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),o='html'):'svg'===t?(u.setAttribute('xmlns','http://www.w3.org/2000/svg'),o='svg'):'foreignObject'===t&&(o='foreignObject');const p={type:'element',pure:0,tag:t,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},g={parent:null,signal:i(),namespace:o,targetElement:u,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:p,mountStatus:'initial'};return s&&c(s,g),'svg'===t?g.svgRoot=u:s&&(g.svgRoot=s.svgRoot),ct.replace(g),n?((t,e,n)=>{let l=0;ot.push({node:t,append:[],reverse:0});try{n(),l=1}finally{a(ot.pop()),l||ct.replace(e)}})(u,s,n):(p.pure=1,F(e)),(()=>{const t=(()=>{const t=ct.getElementNode(),e={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:t.handler,transform:t.transform,focus:t.focus,blur:t.blur};for(let n=0;n<t.attr.length;n++){const l=t.attr[n];for(const t in l)e.attr[t]=l[t]}for(let n=0;n<t.data.length;n++){const l=t.data[n];for(const t in l)e.data[t]=l[t]}t.visible.length>0&&(e.visible=t.visible[t.visible.length-1]),t.text.length>0&&(e.text=t.text[t.text.length-1]);for(let n=0;n<t.styleVar.length;n++){const l=t.styleVar[n];for(const t in l)e.styleVar[t]=l[t]}for(let n=0;n<t.styleProp.length;n++){const l=t.styleProp[n];for(const t in l)e.styleProp[t]=l[t]}return e})(),e=ct.get(),n=e.targetElement,l=e.signal;((t,e,n)=>{for(const l in n)y('value'!==l&&'checked'!==l&&'min'!==l&&'max'!==l,e,n[l],x.bind(null,t,l))})(n,l,t.attr),((t,e,n)=>{for(const l in n)y(0,e,n[l],k.bind(null,t.dataset,l))})(n,l,t.data),((t,e,n)=>{for(let l=0;l<n.length;l++){const{options:i,map:s}=n[l];for(const e in s)t.addEventListener(e,s[e],i);f(e,qt.bind(null,t,n[l]))}})(n,l,t.handler),((t,e,n)=>{const l=t.style;for(const t in n)y(0,e,n[t],Bt.bind(null,l,t))})(n,l,t.styleProp),((t,e,n)=>{const l=t.style;for(const t in n)y(0,e,n[t],Ut.bind(null,l,`--${t}`))})(n,l,t.styleVar),((t,e,n)=>{const l=ct.get();if('svg'!==l.namespace)return;if(0===n.length)return;const i=t.transform.baseVal,s=l.svgRoot;for(let t=0;t<n.length;t++){const l=n[t];for(const t in l)S(s,e,i,l[t],Zt[t])}})(n,l,t.transform),((t,e,n)=>{null!==n&&(nt.unit(n)?b(e,n,E.bind(null,t)):E(t,n))})(n,l,t.text),((t,e,n)=>{if(null===n)return;const l=ct.get().parent.targetElement;b(e,n,w.bind(null,t,l))})(n,l,t.visible),((t,e,n)=>{for(let l=0;l<n.length;l++)y(1,e,n[l],C.bind(null,t))})(n,l,t.focus),((t,e,n)=>{for(let l=0;l<n.length;l++)y(1,e,n[l],N.bind(null,t))})(n,l,t.blur)})(),ct.replace(s),l||ot.length>0&&ot[ot.length-1].append.push(u),u}function R(t,e){return t.bind(null,e)}function $(e,n){const l=ct.get();if(Array.isArray(n)){const i=[];for(let t=0;t<n.length;t++)i[t]=e.map(R(I,n[t]));return l&&t(l.signal,i),i}if('object'==typeof n&&null!==n){const i=[],s={};for(const t in n)s[t]=e.map(R(I,n[t])),i.push(s[t]);return l&&t(l.signal,i),s}const i=e.map(R(I,n));return l&&t(l.signal,i),i}function A(e,n){const l=e.map(R(I,n)),i=ct.get();return i&&t(i.signal,[l]),l}function I(t,e){return e[t]}function O({key:t,child:e,source:n},l){V({source:n,key:t},({store:n,key:i,signal:s})=>{const[r]=$(n,[e]);l({store:n,key:i,signal:s},()=>{O({key:t,child:e,source:r},l)})})}function V(e,n){let l,s,r=0;nt.store(e)?(s=Kt,l=e):(s=R(Qt,e.key),l=e.source,r=!!e.reverse);const o=ct.get(),a=i(),h={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:nt.store(e)?{type:'index'}:{type:'key',key:e.key},store:l,cb:n},mountStatus:'initial'};c(o,h),ct.replace(h);const u={parentNode:o.targetElement,cb:n,shortName:l.shortName,reverse:r,parentStack:h,getID:s},p=lt(P(u,[],l.getState()));t(a,[p]),f(a,R(ee,p)),st({source:p,clock:l,fn:R(P,u),target:p}),ct.replace(o)}function P(s,r,o){const a=Array(o.length).fill(0),f=o.map(s.getID),h=[],u=[],p=[];for(let t=0;t<r.length;t++){const e=r[t],n=e.node,l=f.indexOf(n.key);-1!==l?(u.push(e),a[l]=1,n.store.getState()!==o[l]&&et(n.store,o[l],1)):p.push(e)}if(p.length>0){for(let t=0;t<p.length;t++){const i=p[t],{node:s,locality:r}=i;s.active=0,s.store=null,e(r.sibling.left.ref,r.sibling.right.ref),n(i,null),l(i,null)}et(te,p,1)}let g=u.length>0?u[u.length-1]:null;for(let n=0;n<o.length;n++){if(a[n])continue;const l=o[n],r=lt(l),f=i();t(f,[r]);const p=s.getID(l,n),d={parent:s.parentStack,signal:f,namespace:s.parentStack.namespace,targetElement:s.parentStack.targetElement,svgRoot:s.parentStack.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'listItem',pure:0,key:p,index:p,store:r,signal:f,active:1,nodes:[]},mountStatus:'initial'};e(g,d),g=d,c(s.parentStack,d),h.push(d),u.push(d)}return h.length>0&&et(Jt,{context:s,list:h},1),u}function T(t){const e=ct.get();e&&J({node:[],parent:t,child:e.signal,family:{type:'crosslink',owners:[e.signal,t]}})}function D(e){const n=ct.get();return n&&t(n.signal,[e]),e}function j(){const t=ct.get();if('element'!==t.node.type&&'using'!==t.node.type)throw Error(`this extension can be used only with element nodes, got "${t.node.type}"`)}function M(t){let e;return z(t=>{e=t}),(...n)=>{if(e)return e[t](...n)}}function z(t){const e=ct.get();e.targetElement.__STATIC__||t(e.targetElement)}function F(t){t.attr&&L(t.attr),t.data&&W(t.data),t.transform&&X(t.transform),'text'in t&&Y(t.text),'visible'in t&&G(t.visible),(t.style||t.styleVar)&&q({prop:t.style,val:t.styleVar}),t.focus&&U(t.focus),t.handler&&B(t.handler)}function L(t){j(),ct.getElementNode().attr.push(t)}function W(t){j(),ct.getElementNode().data.push(t)}function X(t){j(),ct.getElementNode().transform.push(t)}function Y(t){j(),ct.getElementNode().text.push(t)}function G(t){j(),ct.getElementNode().visible.push(t)}function q({prop:t,val:e}){j(),t&&ct.getElementNode().styleProp.push(t),e&&ct.getElementNode().styleVar.push(e)}function B(t,e){j(),void 0===e&&(e=t,t={});const{passive:n=1,capture:l=0}=t;ct.getElementNode().handler.push({options:{passive:n,capture:l},map:e})}function U({focus:t,blur:e}){j();const n=ct.getElementNode();t&&n.focus.push(t),e&&n.blur.push(e)}function Z(t,{fn:e}){return D(t.map(e))}function H({source:t,fn:e}){return D(rt(t,e))}import{createNode as J,step as K,clearNode as Q,createEvent as tt,launch as et,is as nt,createStore as lt,sample as st,combine as rt}from'effector';const ot=[];let at;const ct={get:()=>at,replace(t){at=t},getElementNode:()=>at.node},ft=t=>t.graphite||t,ht=t=>t.family.owners,ut=t=>t.family.links,pt=J({node:[K.run({fn(t){Q(t)}})]}),gt=K.compute({fn(t,i){i.self.next.push(pt);const{stack:s}=i,{parent:r}=s,{left:o,right:a}=s.locality.sibling;r&&(r.locality.child.last.ref===s&&(r.locality.child.last.ref=o.ref),r.locality.child.first.ref===s&&(r.locality.child.first.ref=a.ref)),o.ref&&o.ref.locality.sibling.right.ref===s&&a.ref&&a.ref.locality.sibling.left.ref===s?e(o.ref,a.ref):o.ref&&o.ref.locality.sibling.right.ref===s?n(o.ref,null):a.ref&&a.ref.locality.sibling.left.ref===s&&l(a.ref,null)}}),dt=K.compute({fn:(t,{self:e})=>e}),mt=/[^a-zA-Z0-9\-]/g,bt=/[\\<>"]/g;class yt{constructor(){this.properties=Object.create(null)}setProperty(t,e){this.properties[s(t)]=r(e)}removeProperty(t){delete this.properties[s(t)]}}class vt{constructor(){this.items=[]}appendItem(t){this.items.push(t)}}class kt{constructor(){this.value=''}setTranslate(t,e){this.value=`translate(${t} ${e})`}setScale(t,e){this.value=`scale(${t} ${e})`}setRotate(t,e,n){this.value=0!==e||0!==n?`rotate(${t} ${e} ${n})`:`rotate(${t})`}setSkewX(t){this.value=`skewX(${t})`}setSkewY(t){this.value=`skewY(${t})`}}(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 yt,this.firstChild=null,this.transform={baseVal:new vt},this.isFragment=1,this.attributes=Object.create(null),this.textContent=null,this.__STATIC__=1}appendChild(t){if(t.parent&&t.remove(),t.isFragment&&null===t.textContent){let e,n=t.firstChild;for(;n;)e=n.sibling.right,this.appendChild(n),n=e}else this.child.last?(this.child.last.sibling.right=t,t.sibling.left=this.child.last):(this.child.first=t,this.firstChild=t),this.child.last=t,t.parent=this}prepend(t){t.parent&&t.remove(),this.child.last?(this.child.first.sibling.left=t,t.sibling.right=this.child.first):(this.child.first=t,this.child.last=t),this.child.first=t,this.firstChild=t,t.parent=this}contains(t){let e=t;for(;e;){if(e===this)return 1;e=e.parent}return 0}remove(){if(!this.parent)return;const{parent:t}=this;t.child.first===this&&t.child.last===this?(t.firstChild=null,t.child.first=null,t.child.last=null):t.child.first===this?(t.child.first=this.sibling.right,t.firstChild=this.sibling.right,this.sibling.right.sibling.left=null):t.child.last===this?(t.child.last=this.sibling.left,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(t,e,n){}removeEventListener(t,e,n){}setAttribute(t,e){this.attributes[s(t)]=r(e)}removeAttribute(t){delete this.attributes[s(t)]}replaceWith(t){if(!this.parent)return;const{parent:e}=this;t.parent&&t.remove(),e.child.first===this&&e.child.last===this?(e.firstChild=t,e.child.first=t,e.child.last=t):e.child.first===this?(e.child.first=t,e.firstChild=t,this.sibling.right.sibling.left=t):e.child.last===this?(e.child.last=t,this.sibling.left.sibling.right=t):(this.sibling.right.sibling.left=t,this.sibling.left.sibling.right=t),t.sibling.left=this.sibling.left,t.sibling.right=this.sibling.right,t.parent=e,this.sibling.left=null,this.sibling.right=null,this.parent=null}focus(){}blur(){}createSVGTransform(){return new kt}}).isBody=1;let wt='undefined'!=typeof globalThis&&globalThis.document||'undefined'!=typeof global&&global.document;const xt=K.compute({fn(t,e){if(!e.stack)return t;const{stack:n}=e;e.stack=null;const l=n.parent.child.indexOf(n);return-1!==l&&n.parent.child.splice(l,1),n.parent=null,t}}),St=K.run({fn(t,{fn:e}){e(t)}}),Et=10,Ct=tt();let Nt,_t=0,Rt=0;const $t=()=>{Rt||(Rt=1,Nt=requestAnimationFrame(h))},At=new Map,It=new Map,Ot=new Map,Vt=new Map;let Pt=0,Tt=0;const Dt=J({node:[K.run({fn:()=>{}}),K.filter({fn:()=>0===It.size&&0===Ot.size?0:performance.now()-Tt>=Et?0:(cancelAnimationFrame(Nt),_t=1,Rt=0,1)})],child:[Ct]});Ct.watch(()=>{if(Rt)return;if(0===It.size&&0===Ot.size)return void(_t=0);let t=0;_t||(Tt=performance.now()),_t=0;for(const[e,n]of It){if(performance.now()-Tt>=Et){$t(),t=1;break}It.delete(e);const l=At.get(e);et(l,n,1)}if(!t)for(const[e,n]of Ot){if(performance.now()-Tt>=Et){$t(),t=1;break}Ot.delete(e);const l=At.get(e);et(l,n,1)}et(Dt,null,1)});const jt=K.compute({fn:({done:t})=>t}),Mt=K.compute({fn:({fail:t})=>t}),zt=K.filter({fn:t=>t.length>0}),Ft=K.compute({fn(t,{taskID:e}){u(e,1,t)}}),Lt=K.compute({fn(t,{taskID:e,flat:n}){u(e,n,t)}}),Wt=K.run({fn:(t,{fn:e})=>e(t,Tt)}),Xt=K.compute({fn:t=>[t]}),Yt=K.run({fn:(t,{handler:e})=>({data:t,handler:e})}),{trigger:Gt}=g({priority:'high',mark:'domOperation',fn({handler:t,data:e}){t(e)}}),qt=(t,{map:e,options:n})=>{for(const l in e)t.removeEventListener(l,e[l],n)},Bt=(t,e,n)=>{v(n)?delete t[e]:t[e]=n},Ut=(t,e,n)=>{v(n)?t.removeProperty(e):t.setProperty(e,n)},Zt={translate(t,{x:e=0,y:n=0}){t.setTranslate(e,n)},scale(t,{x:e=0,y:n=0}){t.setScale(e,n)},rotate(t,e){'number'==typeof e?t.setRotate(e,0,0):t.setRotate(e.angle||0,e.x||0,e.y||0)},skewX(t,e){t.setSkewX(e)},skewY(t,e){t.setSkewY(e)}},{trigger:Ht}=g({mark:'append DOM nodes',fn:t=>{const e=[];for(let n=0;n<t.append.length;n++){const l=t.append[n];if(0!=l.listItem.active)for(let t=0;t<l.appended.length;t++)e.push(l.appended[t])}e.length>0&&a({node:t.node,append:e,reverse:t.reverse})}}),{trigger:Jt}=g({mark:'addRecords',fn:({context:t,list:e})=>{const{parentStack:n,parentNode:l,cb:i,reverse:s}=t,r=ct.get();ct.replace(n);const o=[],a=[];ot.push({node:l,append:a,reverse:s});for(let t=0;t<e.length;t++){const n=e[t],l=n.node;if(l.active){ct.replace(n),i(l);for(let t=0;t<a.length;t++)l.nodes.push(a[t]);o.push({appended:a.slice(),listItem:l}),a.length=0}}ot.pop(),o.length>0&&et(Ht,{node:l,append:o,reverse:s},1),ct.replace(r)}}),Kt=(t,e)=>e,Qt=(t,e)=>e[t],te=tt();d({trigger:te,priority:'high',mark:'runSignals',flatten:({signal:t})=>[t],fn:t=>{t.scope&&et(t,null,0)}}),d({trigger:te,priority:'high',mark:'remove DOM nodes',flatten({node:t}){const{nodes:e}=t;return e},fn:t=>(t.remove(),t)});const ee=t=>{const e=t.getState();for(let t=0;t<e.length;t++){const n=e[t].node;n.active=0,n.store=null}et(te,e,1)};export{L as attr,H as combine,W as data,T as explicitUnmount,U as focus,_ as h,B as handler,V as list,Z as map,z as node,M as nodeMethod,$ as remap,D as signalOwn,F as spec,A as storeField,q as style,Y as text,X as transform,O as tree,o as using,G as visible}; | ||
//# sourceMappingURL=effector-dom.es.js.map |
@@ -49,6 +49,4 @@ import {Store, Event, Step} from 'effector' | ||
visible?: Store<boolean> | ||
style?: { | ||
prop?: StylePropertyMap | ||
val?: PropertyMap | ||
} | ||
style?: StylePropertyMap | ||
styleVar?: PropertyMap | ||
focus?: { | ||
@@ -83,6 +81,4 @@ focus?: Event<any> | ||
visible?: Store<boolean> | ||
style?: { | ||
prop?: StylePropertyMap | ||
val?: PropertyMap | ||
} | ||
style?: StylePropertyMap | ||
styleVar?: PropertyMap | ||
focus?: { | ||
@@ -129,2 +125,6 @@ focus?: Event<any> | ||
export function remap<T extends {[field: string]: any}, S extends keyof T>( | ||
store: Store<T>, | ||
key: S, | ||
): Store<T[S]> | ||
export function remap< | ||
@@ -131,0 +131,0 @@ T extends {[field: string]: any}, |
{ | ||
"name": "effector-dom", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Effector package for working with dom", | ||
@@ -5,0 +5,0 @@ "main": "effector-dom.cjs.js", |
@@ -49,6 +49,4 @@ import {Store, Event, Step} from 'effector' | ||
visible?: Store<boolean> | ||
style?: { | ||
prop?: StylePropertyMap | ||
val?: PropertyMap | ||
} | ||
style?: StylePropertyMap | ||
styleVar?: PropertyMap | ||
focus?: { | ||
@@ -83,6 +81,4 @@ focus?: Event<any> | ||
visible?: Store<boolean> | ||
style?: { | ||
prop?: StylePropertyMap | ||
val?: PropertyMap | ||
} | ||
style?: StylePropertyMap | ||
styleVar?: PropertyMap | ||
focus?: { | ||
@@ -129,2 +125,6 @@ focus?: Event<any> | ||
export function remap<T extends {[field: string]: any}, S extends keyof T>( | ||
store: Store<T>, | ||
key: S, | ||
): Store<T[S]> | ||
export function remap< | ||
@@ -131,0 +131,0 @@ T extends {[field: string]: any}, |
@@ -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(B,'')}}function r(e){return String(e).replace(H,'')}function s(){return new Q}function l(t){const s=[];(function t(s,l){if(null!==s.textContent&&l.push(s.textContent),s.isFragment){let e=s.firstChild;for(;e;)t(e,l),e=e.sibling.right;return}l.push('<',s.tagName);for(const e in s.attributes)l.push(' ',e,'=','"',r(s.attributes[e]),'"');for(const t in s.dataset)l.push(' ','data-',n(t).replace(J,e),'=','"',r(s.dataset[t]),'"');const i=[];for(const e in s.style.properties)if(e.startsWith('--'))i.push(`${e}: ${s.style.properties[e]}`);else{const t=e.replace(/[A-Z]/,e=>`-${e.toLowerCase()}`);i.push(`${t}: ${s.style.properties[e]}`)}if(i.length>0&&l.push(' ','style','=','"',i.join(';'),'"'),s.transform.baseVal.items.length>0){l.push(' ','transform','=','"');const e=s.transform.baseVal.items.map(({value:e})=>e);l.push(e.join(' '),'"')}if(!s.firstChild)return void l.push('meta'===s.tagName||'link'===s.tagName?'>':'/>');l.push('>');let o=s.firstChild;for(;o;)t(o,l),o=o.sibling.right;l.push('</',s.tagName,'>')})(t,s);const l=s.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>${l}`:l}function i(e,t){const n=ce(e);for(let e=0;e<t.length;e++){const r=ce(t[e]);r.family.type='crosslink';const s=ue(r),l=fe(n);s.includes(n)||s.push(n),l.includes(r)||l.push(r)}}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 u(){const e={stack:null},t=ae.get(),n=effector.createNode({node:[pe,ge],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function f(e,t){const n=e.namespaceURI,r=e.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===r?'foreignObject':'html',l=ae.get(),i={parent:l,signal:l&&l.signal?l.signal:u(),namespace:s,targetElement:e,svgRoot:'svg'===r?e:l?l.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial'};ae.replace(i),ie.push({node:e,append:[],reverse:0});try{return t()}finally{h(ie.pop()),ae.replace(l)}}function h({node:e,append:t,reverse:n=0}){if(0===t.length)return;const r=le.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 p(e,t){t.parent=e,t.signal.seq.push(de),t.signal.scope.stack=t,e.child.push(t)}function g(e,t){return effector.createNode({node:[me],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function d(){ke=0,ye()}function m(e,t,n){const r=(e=>'high'===Ce.get(e)?Ee:Se)(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);xe()}function b(e,t,n=0,r="low"){const s=++_e,l=effector.createEvent(),o=effector.is.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,l]};return effector.createNode({node:[Pe],parent:[o],scope:{taskID:s,flat:n},family:c}),i(e,[l]),Ne.set(s,effector.createNode({node:[Fe],child:[effector.createNode({node:[Oe,Te,Ie],scope:{taskID:s},family:c}),effector.createNode({node:[Re,Te],child:[l],family:c})],scope:{fn:t},family:c})),Ce.set(s,r),l}function y({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:r=1/0,batchWindow:s=0,retries:l=1/0,mark:i=e.shortName}){const o=b(e.map(e=>[{inserted:performance.now(),retry:0,value:e}]),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const l=e[i],u=performance.now();if(l.inserted+s>u){c.push(l);continue}if(l.inserted+r<u)continue;if(u-n>=be){o=1;break}const f=t(l.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>=l||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:r=1/0,batchWindow:s=0,retries:l=1/0,mark:i=e.shortName,flatten:o}){const a=b(e.map(e=>{const t=[],n=performance.now();for(let r=0;r<e.length;r++){const s=o(e[r]);for(let e=0;e<s.length;e++)t.push({inserted:n,retry:0,value:s[e]})}return t}),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const l=e[i],u=performance.now();if(l.inserted+s>u){c.push(l);continue}if(l.inserted+r<u)continue;if(u-n>=be){o=1;break}const f=t(l.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>=l||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[Ve],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function w(e,t,n){g(e,t.watch(n))}function k(e,t,n){effector.createNode({node:[De],parent:t,child:[je],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(je,{data:t.getState(),handler:n},1)}function x(e,t,n,r){effector.is.unit(n)?(e?w:k)(t,n,r):r(n)}function N(e){return''!==e&&0!==e&&(0==e||null==e)}function E(e,t,n){N(n)?delete e[t]:e[t]=`${n}`}function S(e,t,n){n?t.contains(e)||t.appendChild(e):e.remove()}function C(e,t,n){if(N(n)){switch(t){case'value':delete e.value;break;case'checked':delete e.checked;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function _(e,t,n,r,s){const l=e.createSVGTransform();x(0,t,r,s.bind(null,l)),n.appendItem(l)}function $(e,t){const n=le.createTextNode(`${t}`),r=e.firstChild;r?r.replaceWith(n):e.appendChild(n)}function A(e){e.focus()}function R(e){e.blur()}function O(e,t){return e.bind(null,t)}function T(e,t){const n=ae.get();if(Array.isArray(t)){const r=[];for(let n=0;n<t.length;n++)r[n]=e.map(O(I,t[n]));return n&&i(n.signal,r),r}const r=[],s={};for(const n in t)s[n]=e.map(O(I,t[n])),r.push(s[n]);return n&&i(n.signal,r),s}function I(e,t){return t[e]}function P(e,t){let n,r,s=0;effector.is.store(e)?(r=Ue,n=e):(r=O(Xe,e.key),n=e.source,s=!!e.reverse);const l=ae.get(),o=u(),a={parent:l,signal:o,namespace:l.namespace,targetElement:l.targetElement,svgRoot:l.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:s,key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},store:n,cb:t},mountStatus:'initial'};p(l,a),ae.replace(a);const c={parentNode:l.targetElement,cb:t,shortName:n.shortName,reverse:s,parentStack:a,getID:r},f=effector.createStore(F(c,[],n.getState()));i(o,[f]),g(o,O(Ze,f)),effector.sample({source:f,clock:n,fn:O(F,c),target:f}),ae.replace(l)}function F(e,t,n){const r=Array(n.length).fill(0),s=n.map(e.getID),l=[],f=[],h=[];for(let e=0;e<t.length;e++){const l=t[e],i=l.node,o=s.indexOf(i.key);-1!==o?(f.push(l),r[o]=1,i.store.getState()!==n[o]&&effector.launch(i.store,n[o],1)):h.push(l)}if(h.length>0){for(let e=0;e<h.length;e++){const t=h[e],{node:n,locality:r}=t;n.active=0,n.store=null,o(r.sibling.left.ref,r.sibling.right.ref),a(t,null),c(t,null)}effector.launch(Ge,h,1)}let g=f.length>0?f[f.length-1]:null;for(let t=0;t<n.length;t++){if(r[t])continue;const s=n[t],a=effector.createStore(s),c=u();i(c,[a]);const h=e.getID(s,t),d={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:h,index:h,store:a,signal:c,active:1,nodes:[]},mountStatus:'initial'};o(g,d),g=d,p(e.parentStack,d),l.push(d),f.push(d)}return l.length>0&&effector.launch(Ye,{context:e,list:l},1),f}function V(e){const t=ae.get();return t&&i(t.signal,[e]),e}function D(){const e=ae.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function j(e){const t=ae.get();t.targetElement.__STATIC__||e(t.targetElement)}function M(e){e.attr&&q(e.attr),e.data&&L(e.data),e.transform&&z(e.transform),'text'in e&&W(e.text),'visible'in e&&Y(e.visible),e.style&&U(e.style),e.focus&&G(e.focus),e.handler&&X(e.handler)}function q(e){D(),ae.getElementNode().attr.push(e)}function L(e){D(),ae.getElementNode().data.push(e)}function z(e){D(),ae.getElementNode().transform.push(e)}function W(e){D(),ae.getElementNode().text.push(e)}function Y(e){D(),ae.getElementNode().visible.push(e)}function U({prop:e,val:t}){D(),e&&ae.getElementNode().styleProp.push(e),t&&ae.getElementNode().styleVar.push(t)}function X(e,t){D(),void 0===t&&(t=e,e={});const{passive:n=1,capture:r=0}=e;ae.getElementNode().handler.push({options:{passive:n,capture:r},map:t})}function G({focus:e,blur:t}){D();const n=ae.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var Z=require('perf_hooks'),effector=require('effector');const B=/[^a-zA-Z0-9\-]/g,H=/[\\<>"]/g,J=/[A-Z]/g,K=/[&<>'"]/g;class Q{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 ee,this.firstChild=null,this.transform={baseVal:new te},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)]=r(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 ne}}class ee{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[n(e)]=r(t)}removeProperty(e){delete this.properties[n(e)]}}class te{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ne{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 re=new Q;re.isBody=1;var se={__proto__:null,body:re,createTextNode:e=>{const n=new Q;return n.textContent=String(e).replace(K,t),n},createElement:e=>{const t=new Q;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 r=new Q;return r.tagName=n(t),r.namespaceURI=e,r.isFragment=0,r},createDocumentFragment:s,render:l};let le='undefined'!=typeof globalThis&&globalThis.document||'undefined'!=typeof global&&global.document;const ie=[];let oe;const ae={get:()=>oe,replace(e){oe=e},getElementNode:()=>oe.node},ce=e=>e.graphite||e,ue=e=>e.family.owners,fe=e=>e.family.links,he=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),pe=effector.step.compute({fn(e,t){t.self.next.push(he);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?o(s.ref,l.ref):s.ref&&s.ref.locality.sibling.right.ref===n?a(s.ref,null):l.ref&&l.ref.locality.sibling.left.ref===n&&c(l.ref,null)}}),ge=effector.step.compute({fn:(e,{self:t})=>t}),de=effector.step.compute({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}}),me=effector.step.run({fn(e,{fn:t}){t(e)}}),be=10,ye=effector.createEvent();let ve,we=0,ke=0;const xe=()=>{ke||(ke=1,ve=requestAnimationFrame(d))},Ne=new Map,Ee=new Map,Se=new Map,Ce=new Map;let _e=0,$e=0;const Ae=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===Ee.size&&0===Se.size?0:performance.now()-$e>=be?0:(cancelAnimationFrame(ve),we=1,ke=0,1)})],child:[ye]});ye.watch(()=>{if(ke)return;if(0===Ee.size&&0===Se.size)return void(we=0);let e=0;we||($e=performance.now()),we=0;for(const[t,n]of Ee){if(performance.now()-$e>=be){xe(),e=1;break}Ee.delete(t);const r=Ne.get(t);effector.launch(r,n,1)}if(!e)for(const[t,n]of Se){if(performance.now()-$e>=be){xe(),e=1;break}Se.delete(t);const r=Ne.get(t);effector.launch(r,n,1)}effector.launch(Ae,null,1)});const Re=effector.step.compute({fn:({done:e})=>e}),Oe=effector.step.compute({fn:({fail:e})=>e}),Te=effector.step.filter({fn:e=>e.length>0}),Ie=effector.step.compute({fn(e,{taskID:t}){m(t,1,e)}}),Pe=effector.step.compute({fn(e,{taskID:t,flat:n}){m(t,n,e)}}),Fe=effector.step.run({fn:(e,{fn:t})=>t(e,$e)}),Ve=effector.step.compute({fn:e=>[e]}),De=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:je}=y({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Me=(e,{map:t,options:n})=>{for(const r in t)e.removeEventListener(r,t[r],n)},qe=(e,t,n)=>{N(n)?delete e[t]:e[t]=n},Le=(e,t,n)=>{N(n)?e.removeProperty(t):e.setProperty(t,n)},ze={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:We}=y({mark:'append DOM nodes',fn:e=>{const t=[];for(let n=0;n<e.append.length;n++){const r=e.append[n];if(0!=r.listItem.active)for(let e=0;e<r.appended.length;e++)t.push(r.appended[e])}t.length>0&&h({node:e.node,append:t,reverse:e.reverse})}}),{trigger:Ye}=y({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:r,cb:s,reverse:l}=e,i=ae.get();ae.replace(n);const o=[],a=[];ie.push({node:r,append:a,reverse:l});for(let e=0;e<t.length;e++){const n=t[e],r=n.node;if(r.active){ae.replace(n),s(r);for(let e=0;e<a.length;e++)r.nodes.push(a[e]);o.push({appended:a.slice(),listItem:r}),a.length=0}}ie.pop(),o.length>0&&effector.launch(We,{node:r,append:o,reverse:l},1),ae.replace(i)}}),Ue=(e,t)=>t,Xe=(e,t)=>t[e],Ge=effector.createEvent();v({trigger:Ge,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),v({trigger:Ge,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const Ze=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)},Be=void 0!==typeof globalThis&&globalThis||void 0!==typeof global&&global||void 0!==typeof window&&window;Be&&(Be.performance||(Be.performance=Z.performance),Be.requestAnimationFrame||(Be.requestAnimationFrame=e=>setTimeout(e,0),Be.cancelAnimationFrame=clearTimeout)),le=se,exports.attr=q,exports.body=re,exports.combine=({source:e,fn:t})=>V(effector.combine(e,t)),exports.createDocumentFragment=s,exports.data=L,exports.explicitUnmount=e=>{const t=ae.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:r=0}=t,s=ae.get(),l=s?s.namespace:'html';let i=l,o='html';'type'in t?(o=t.type,i=t.type):i=o='svg'===l?'svg':'html','svg'===e&&(o='svg',i='svg');const a='svg'===o?le.createElementNS('http://www.w3.org/2000/svg',e):le.createElement(e);'foreignObject'===l?(a.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),i='html'):'svg'===e?(a.setAttribute('xmlns','http://www.w3.org/2000/svg'),i='svg'):'foreignObject'===e&&(i='foreignObject');const c={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},f={parent:null,signal:u(),namespace:i,targetElement:a,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:c,mountStatus:'initial'};return s&&p(s,f),'svg'===e?f.svgRoot=a:s&&(f.svgRoot=s.svgRoot),ae.replace(f),n?((e,t,n)=>{let r=0;ie.push({node:e,append:[],reverse:0});try{n(),r=1}finally{h(ie.pop()),r||ae.replace(t)}})(a,s,n):(c.pure=1,M(t)),(()=>{const e=(()=>{const e=ae.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};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=ae.get(),n=t.targetElement,r=t.signal;((e,t,n)=>{for(const r in n)x('value'!==r&&'checked'!==r&&'min'!==r&&'max'!==r,t,n[r],C.bind(null,e,r))})(n,r,e.attr),((e,t,n)=>{for(const r in n)x(0,t,n[r],E.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);g(t,Me.bind(null,e,n[r]))}})(n,r,e.handler),((e,t,n)=>{const r=e.style;for(const e in n)x(0,t,n[e],qe.bind(null,r,e))})(n,r,e.styleProp),((e,t,n)=>{const r=e.style;for(const e in n)x(0,t,n[e],Le.bind(null,r,`--${e}`))})(n,r,e.styleVar),((e,t,n)=>{const r=ae.get();if('svg'!==r.namespace)return;if(0===n.length)return;const s=e.transform.baseVal,l=r.svgRoot;for(let e=0;e<n.length;e++){const r=n[e];for(const e in r)_(l,t,s,r[e],ze[e])}})(n,r,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?k(t,n,$.bind(null,e)):$(e,n))})(n,r,e.text),((e,t,n)=>{if(null===n)return;const r=ae.get().parent.targetElement;k(t,n,S.bind(null,e,r))})(n,r,e.visible),((e,t,n)=>{for(let r=0;r<n.length;r++)x(1,t,n[r],A.bind(null,e))})(n,r,e.focus),((e,t,n)=>{for(let r=0;r<n.length;r++)x(1,t,n[r],R.bind(null,e))})(n,r,e.blur)})(),ae.replace(s),r||ie.length>0&&ie[ie.length-1].append.push(a),a},exports.handler=X,exports.list=P,exports.map=(e,{fn:t})=>V(e.map(t)),exports.node=j,exports.nodeMethod=e=>{let t;return j(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=T,exports.render=l,exports.renderStatic=e=>{const t=s();return f(t,e),new Promise(e=>setTimeout(e,800)).then(()=>l(t))},exports.signalOwn=V,exports.spec=M,exports.storeField=(e,t)=>{const n=e.map(O(I,t)),r=ae.get();return r&&i(r.signal,[n]),n},exports.style=U,exports.text=W,exports.transform=z,exports.tree=function e({key:t,child:n,source:r},s){P({source:r,key:t},({store:r,key:l,signal:i})=>{const[o]=T(r,[n]);s({store:r,key:l,signal:i},()=>{e({key:t,child:n,source:o},s)})})},exports.using=f,exports.visible=Y; | ||
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(B,'')}}function r(e){return String(e).replace(H,'')}function s(){return new Q}function l(t){const s=[];(function t(s,l){if(null!==s.textContent&&l.push(s.textContent),s.isFragment){let e=s.firstChild;for(;e;)t(e,l),e=e.sibling.right;return}l.push('<',s.tagName);for(const e in s.attributes)l.push(' ',e,'=','"',r(s.attributes[e]),'"');for(const t in s.dataset)l.push(' ','data-',n(t).replace(J,e),'=','"',r(s.dataset[t]),'"');const i=[];for(const e in s.style.properties)if(e.startsWith('--'))i.push(`${e}: ${s.style.properties[e]}`);else{const t=e.replace(/[A-Z]/,e=>`-${e.toLowerCase()}`);i.push(`${t}: ${s.style.properties[e]}`)}if(i.length>0&&l.push(' ','style','=','"',i.join(';'),'"'),s.transform.baseVal.items.length>0){l.push(' ','transform','=','"');const e=s.transform.baseVal.items.map(({value:e})=>e);l.push(e.join(' '),'"')}if(!s.firstChild)return void l.push('meta'===s.tagName||'link'===s.tagName?'>':'/>');l.push('>');let o=s.firstChild;for(;o;)t(o,l),o=o.sibling.right;l.push('</',s.tagName,'>')})(t,s);const l=s.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>${l}`:l}function i(e,t){const n=ce(e);for(let e=0;e<t.length;e++){const r=ce(t[e]);r.family.type='crosslink';const s=ue(r),l=fe(n);s.includes(n)||s.push(n),l.includes(r)||l.push(r)}}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 u(){const e={stack:null},t=ae.get(),n=effector.createNode({node:[pe,ge],parent:[t&&t.signal].filter(Boolean),meta:{unit:'signal'},scope:e});return e.self=n,n}function f(e,t){const n=e.namespaceURI,r=e.tagName.toLowerCase(),s='http://www.w3.org/2000/svg'===n?'svg':'foreignObject'===r?'foreignObject':'html',l=ae.get(),i={parent:l,signal:l&&l.signal?l.signal:u(),namespace:s,targetElement:e,svgRoot:'svg'===r?e:l?l.svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'using',pure:0,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},mountStatus:'initial'};ae.replace(i),ie.push({node:e,append:[],reverse:0});try{return t()}finally{h(ie.pop()),ae.replace(l)}}function h({node:e,append:t,reverse:n=0}){if(0===t.length)return;const r=le.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 p(e,t){t.parent=e,t.signal.seq.push(de),t.signal.scope.stack=t,e.child.push(t)}function g(e,t){return effector.createNode({node:[me],parent:e,meta:{op:'watch'},scope:{fn:t},family:{type:'crosslink',owners:[e]}})}function d(){ke=0,ye()}function m(e,t,n){const r=(e=>'high'===Ce.get(e)?Ee:Se)(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);xe()}function b(e,t,n=0,r="low"){const s=++_e,l=effector.createEvent(),o=effector.is.store(a=e)?a.updates:a;var a;const c={type:'crosslink',owners:[o,l]};return effector.createNode({node:[Pe],parent:[o],scope:{taskID:s,flat:n},family:c}),i(e,[l]),Ne.set(s,effector.createNode({node:[Ve],child:[effector.createNode({node:[Oe,Te,Ie],scope:{taskID:s},family:c}),effector.createNode({node:[Re,Te],child:[l],family:c})],scope:{fn:t},family:c})),Ce.set(s,r),l}function y({trigger:e=effector.createEvent(),fn:t,priority:n="low",timeout:r=1/0,batchWindow:s=0,retries:l=1/0,mark:i=e.shortName}){const o=b(e.map(e=>[{inserted:performance.now(),retry:0,value:e}]),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const l=e[i],u=performance.now();if(l.inserted+s>u){c.push(l);continue}if(l.inserted+r<u)continue;if(u-n>=be){o=1;break}const f=t(l.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>=l||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:r=1/0,batchWindow:s=0,retries:l=1/0,mark:i=e.shortName,flatten:o}){const a=b(e.map(e=>{const t=[],n=performance.now();for(let r=0;r<e.length;r++){const s=o(e[r]);for(let e=0;e<s.length;e++)t.push({inserted:n,retry:0,value:s[e]})}return t}),(e,n)=>{let i,o=0;const a=[],c=[];for(i=0;i<e.length;i++){const l=e[i],u=performance.now();if(l.inserted+s>u){c.push(l);continue}if(l.inserted+r<u)continue;if(u-n>=be){o=1;break}const f=t(l.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>=l||c.push(n)}return{done:a,fail:c}},1,n);return{trigger:e,processed:a,connect:t=>{effector.createNode({node:[Fe],parent:t,child:e,family:{type:'crosslink',owners:[t,e]}})}}}function w(e,t,n){g(e,t.watch(n))}function k(e,t,n){effector.createNode({node:[je],parent:t,child:[De],family:{type:'crosslink',owners:e},scope:{handler:n},meta:{op:'debounceRaf'}}),effector.is.store(t)&&effector.launch(De,{data:t.getState(),handler:n},1)}function x(e,t,n,r){effector.is.unit(n)?(e?w:k)(t,n,r):r(n)}function N(e){return''!==e&&0!==e&&(0==e||null==e)}function E(e,t,n){N(n)?delete e[t]:e[t]=`${n}`}function S(e,t,n){n?t.contains(e)||t.appendChild(e):e.remove()}function C(e,t,n){if(N(n)){switch(t){case'value':delete e.value;break;case'checked':delete e.checked;break;case'spellcheck':if(0==n)return void e.setAttribute('spellcheck','false')}e.removeAttribute(t)}else{switch(t){case'value':e.value=`${n}`;break;case'checked':e.checked=`${n}`}e.setAttribute(t,`${n}`)}}function _(e,t,n,r,s){const l=e.createSVGTransform();x(0,t,r,s.bind(null,l)),n.appendItem(l)}function $(e,t){const n=le.createTextNode(`${t}`),r=e.firstChild;r?r.replaceWith(n):e.appendChild(n)}function A(e){e.focus()}function R(e){e.blur()}function O(e,t){return e.bind(null,t)}function T(e,t){const n=ae.get();if(Array.isArray(t)){const r=[];for(let n=0;n<t.length;n++)r[n]=e.map(O(I,t[n]));return n&&i(n.signal,r),r}if('object'==typeof t&&null!==t){const r=[],s={};for(const n in t)s[n]=e.map(O(I,t[n])),r.push(s[n]);return n&&i(n.signal,r),s}const r=e.map(O(I,t));return n&&i(n.signal,r),r}function I(e,t){return t[e]}function P(e,t){let n,r,s=0;effector.is.store(e)?(r=Ue,n=e):(r=O(Xe,e.key),n=e.source,s=!!e.reverse);const l=ae.get(),o=u(),a={parent:l,signal:o,namespace:l.namespace,targetElement:l.targetElement,svgRoot:l.svgRoot,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:{type:'list',pure:0,reverse:s,key:effector.is.store(e)?{type:'index'}:{type:'key',key:e.key},store:n,cb:t},mountStatus:'initial'};p(l,a),ae.replace(a);const c={parentNode:l.targetElement,cb:t,shortName:n.shortName,reverse:s,parentStack:a,getID:r},f=effector.createStore(V(c,[],n.getState()));i(o,[f]),g(o,O(Ze,f)),effector.sample({source:f,clock:n,fn:O(V,c),target:f}),ae.replace(l)}function V(e,t,n){const r=Array(n.length).fill(0),s=n.map(e.getID),l=[],f=[],h=[];for(let e=0;e<t.length;e++){const l=t[e],i=l.node,o=s.indexOf(i.key);-1!==o?(f.push(l),r[o]=1,i.store.getState()!==n[o]&&effector.launch(i.store,n[o],1)):h.push(l)}if(h.length>0){for(let e=0;e<h.length;e++){const t=h[e],{node:n,locality:r}=t;n.active=0,n.store=null,o(r.sibling.left.ref,r.sibling.right.ref),a(t,null),c(t,null)}effector.launch(Ge,h,1)}let g=f.length>0?f[f.length-1]:null;for(let t=0;t<n.length;t++){if(r[t])continue;const s=n[t],a=effector.createStore(s),c=u();i(c,[a]);const h=e.getID(s,t),d={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:h,index:h,store:a,signal:c,active:1,nodes:[]},mountStatus:'initial'};o(g,d),g=d,p(e.parentStack,d),l.push(d),f.push(d)}return l.length>0&&effector.launch(Ye,{context:e,list:l},1),f}function F(e){const t=ae.get();return t&&i(t.signal,[e]),e}function j(){const e=ae.get();if('element'!==e.node.type&&'using'!==e.node.type)throw Error(`this extension can be used only with element nodes, got "${e.node.type}"`)}function D(e){const t=ae.get();t.targetElement.__STATIC__||e(t.targetElement)}function M(e){e.attr&&q(e.attr),e.data&&L(e.data),e.transform&&z(e.transform),'text'in e&&W(e.text),'visible'in e&&Y(e.visible),(e.style||e.styleVar)&&U({prop:e.style,val:e.styleVar}),e.focus&&G(e.focus),e.handler&&X(e.handler)}function q(e){j(),ae.getElementNode().attr.push(e)}function L(e){j(),ae.getElementNode().data.push(e)}function z(e){j(),ae.getElementNode().transform.push(e)}function W(e){j(),ae.getElementNode().text.push(e)}function Y(e){j(),ae.getElementNode().visible.push(e)}function U({prop:e,val:t}){j(),e&&ae.getElementNode().styleProp.push(e),t&&ae.getElementNode().styleVar.push(t)}function X(e,t){j(),void 0===t&&(t=e,e={});const{passive:n=1,capture:r=0}=e;ae.getElementNode().handler.push({options:{passive:n,capture:r},map:t})}function G({focus:e,blur:t}){j();const n=ae.getElementNode();e&&n.focus.push(e),t&&n.blur.push(t)}Object.defineProperty(exports,'__esModule',{value:1});var Z=require('perf_hooks'),effector=require('effector');const B=/[^a-zA-Z0-9\-]/g,H=/[\\<>"]/g,J=/[A-Z]/g,K=/[&<>'"]/g;class Q{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 ee,this.firstChild=null,this.transform={baseVal:new te},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)]=r(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 ne}}class ee{constructor(){this.properties=Object.create(null)}setProperty(e,t){this.properties[n(e)]=r(t)}removeProperty(e){delete this.properties[n(e)]}}class te{constructor(){this.items=[]}appendItem(e){this.items.push(e)}}class ne{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 re=new Q;re.isBody=1;var se={__proto__:null,body:re,createTextNode:e=>{const n=new Q;return n.textContent=String(e).replace(K,t),n},createElement:e=>{const t=new Q;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 r=new Q;return r.tagName=n(t),r.namespaceURI=e,r.isFragment=0,r},createDocumentFragment:s,render:l};let le='undefined'!=typeof globalThis&&globalThis.document||'undefined'!=typeof global&&global.document;const ie=[];let oe;const ae={get:()=>oe,replace(e){oe=e},getElementNode:()=>oe.node},ce=e=>e.graphite||e,ue=e=>e.family.owners,fe=e=>e.family.links,he=effector.createNode({node:[effector.step.run({fn(e){effector.clearNode(e)}})]}),pe=effector.step.compute({fn(e,t){t.self.next.push(he);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?o(s.ref,l.ref):s.ref&&s.ref.locality.sibling.right.ref===n?a(s.ref,null):l.ref&&l.ref.locality.sibling.left.ref===n&&c(l.ref,null)}}),ge=effector.step.compute({fn:(e,{self:t})=>t}),de=effector.step.compute({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}}),me=effector.step.run({fn(e,{fn:t}){t(e)}}),be=10,ye=effector.createEvent();let ve,we=0,ke=0;const xe=()=>{ke||(ke=1,ve=requestAnimationFrame(d))},Ne=new Map,Ee=new Map,Se=new Map,Ce=new Map;let _e=0,$e=0;const Ae=effector.createNode({node:[effector.step.run({fn:()=>{}}),effector.step.filter({fn:()=>0===Ee.size&&0===Se.size?0:performance.now()-$e>=be?0:(cancelAnimationFrame(ve),we=1,ke=0,1)})],child:[ye]});ye.watch(()=>{if(ke)return;if(0===Ee.size&&0===Se.size)return void(we=0);let e=0;we||($e=performance.now()),we=0;for(const[t,n]of Ee){if(performance.now()-$e>=be){xe(),e=1;break}Ee.delete(t);const r=Ne.get(t);effector.launch(r,n,1)}if(!e)for(const[t,n]of Se){if(performance.now()-$e>=be){xe(),e=1;break}Se.delete(t);const r=Ne.get(t);effector.launch(r,n,1)}effector.launch(Ae,null,1)});const Re=effector.step.compute({fn:({done:e})=>e}),Oe=effector.step.compute({fn:({fail:e})=>e}),Te=effector.step.filter({fn:e=>e.length>0}),Ie=effector.step.compute({fn(e,{taskID:t}){m(t,1,e)}}),Pe=effector.step.compute({fn(e,{taskID:t,flat:n}){m(t,n,e)}}),Ve=effector.step.run({fn:(e,{fn:t})=>t(e,$e)}),Fe=effector.step.compute({fn:e=>[e]}),je=effector.step.run({fn:(e,{handler:t})=>({data:e,handler:t})}),{trigger:De}=y({priority:'high',mark:'domOperation',fn({handler:e,data:t}){e(t)}}),Me=(e,{map:t,options:n})=>{for(const r in t)e.removeEventListener(r,t[r],n)},qe=(e,t,n)=>{N(n)?delete e[t]:e[t]=n},Le=(e,t,n)=>{N(n)?e.removeProperty(t):e.setProperty(t,n)},ze={translate(e,{x:t=0,y:n=0}){e.setTranslate(t,n)},scale(e,{x:t=0,y:n=0}){e.setScale(t,n)},rotate(e,t){'number'==typeof t?e.setRotate(t,0,0):e.setRotate(t.angle||0,t.x||0,t.y||0)},skewX(e,t){e.setSkewX(t)},skewY(e,t){e.setSkewY(t)}},{trigger:We}=y({mark:'append DOM nodes',fn:e=>{const t=[];for(let n=0;n<e.append.length;n++){const r=e.append[n];if(0!=r.listItem.active)for(let e=0;e<r.appended.length;e++)t.push(r.appended[e])}t.length>0&&h({node:e.node,append:t,reverse:e.reverse})}}),{trigger:Ye}=y({mark:'addRecords',fn:({context:e,list:t})=>{const{parentStack:n,parentNode:r,cb:s,reverse:l}=e,i=ae.get();ae.replace(n);const o=[],a=[];ie.push({node:r,append:a,reverse:l});for(let e=0;e<t.length;e++){const n=t[e],r=n.node;if(r.active){ae.replace(n),s(r);for(let e=0;e<a.length;e++)r.nodes.push(a[e]);o.push({appended:a.slice(),listItem:r}),a.length=0}}ie.pop(),o.length>0&&effector.launch(We,{node:r,append:o,reverse:l},1),ae.replace(i)}}),Ue=(e,t)=>t,Xe=(e,t)=>t[e],Ge=effector.createEvent();v({trigger:Ge,priority:'high',mark:'runSignals',flatten:({signal:e})=>[e],fn:e=>{e.scope&&effector.launch(e,null,0)}}),v({trigger:Ge,priority:'high',mark:'remove DOM nodes',flatten({node:e}){const{nodes:t}=e;return t},fn:e=>(e.remove(),e)});const Ze=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)},Be=void 0!==typeof globalThis&&globalThis||void 0!==typeof global&&global||void 0!==typeof window&&window;Be&&(Be.performance||(Be.performance=Z.performance),Be.requestAnimationFrame||(Be.requestAnimationFrame=e=>setTimeout(e,0),Be.cancelAnimationFrame=clearTimeout)),le=se,exports.attr=q,exports.body=re,exports.combine=({source:e,fn:t})=>F(effector.combine(e,t)),exports.createDocumentFragment=s,exports.data=L,exports.explicitUnmount=e=>{const t=ae.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:r=0}=t,s=ae.get(),l=s?s.namespace:'html';let i=l,o='html';'type'in t?(o=t.type,i=t.type):i=o='svg'===l?'svg':'html','svg'===e&&(o='svg',i='svg');const a='svg'===o?le.createElementNS('http://www.w3.org/2000/svg',e):le.createElement(e);'foreignObject'===l?(a.setAttribute('xmlns','http://www.w3.org/1999/xhtml'),i='html'):'svg'===e?(a.setAttribute('xmlns','http://www.w3.org/2000/svg'),i='svg'):'foreignObject'===e&&(i='foreignObject');const c={type:'element',pure:0,tag:e,attr:[],data:[],visible:[],text:[],styleVar:[],styleProp:[],handler:[],transform:[],focus:[],blur:[]},f={parent:null,signal:u(),namespace:i,targetElement:a,svgRoot:null,child:[],locality:{sibling:{left:{ref:null},right:{ref:null}},child:{first:{ref:null},last:{ref:null}}},node:c,mountStatus:'initial'};return s&&p(s,f),'svg'===e?f.svgRoot=a:s&&(f.svgRoot=s.svgRoot),ae.replace(f),n?((e,t,n)=>{let r=0;ie.push({node:e,append:[],reverse:0});try{n(),r=1}finally{h(ie.pop()),r||ae.replace(t)}})(a,s,n):(c.pure=1,M(t)),(()=>{const e=(()=>{const e=ae.getElementNode(),t={attr:{},data:{},visible:null,text:null,styleVar:{},styleProp:{},handler:e.handler,transform:e.transform,focus:e.focus,blur:e.blur};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=ae.get(),n=t.targetElement,r=t.signal;((e,t,n)=>{for(const r in n)x('value'!==r&&'checked'!==r&&'min'!==r&&'max'!==r,t,n[r],C.bind(null,e,r))})(n,r,e.attr),((e,t,n)=>{for(const r in n)x(0,t,n[r],E.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);g(t,Me.bind(null,e,n[r]))}})(n,r,e.handler),((e,t,n)=>{const r=e.style;for(const e in n)x(0,t,n[e],qe.bind(null,r,e))})(n,r,e.styleProp),((e,t,n)=>{const r=e.style;for(const e in n)x(0,t,n[e],Le.bind(null,r,`--${e}`))})(n,r,e.styleVar),((e,t,n)=>{const r=ae.get();if('svg'!==r.namespace)return;if(0===n.length)return;const s=e.transform.baseVal,l=r.svgRoot;for(let e=0;e<n.length;e++){const r=n[e];for(const e in r)_(l,t,s,r[e],ze[e])}})(n,r,e.transform),((e,t,n)=>{null!==n&&(effector.is.unit(n)?k(t,n,$.bind(null,e)):$(e,n))})(n,r,e.text),((e,t,n)=>{if(null===n)return;const r=ae.get().parent.targetElement;k(t,n,S.bind(null,e,r))})(n,r,e.visible),((e,t,n)=>{for(let r=0;r<n.length;r++)x(1,t,n[r],A.bind(null,e))})(n,r,e.focus),((e,t,n)=>{for(let r=0;r<n.length;r++)x(1,t,n[r],R.bind(null,e))})(n,r,e.blur)})(),ae.replace(s),r||ie.length>0&&ie[ie.length-1].append.push(a),a},exports.handler=X,exports.list=P,exports.map=(e,{fn:t})=>F(e.map(t)),exports.node=D,exports.nodeMethod=e=>{let t;return D(e=>{t=e}),(...n)=>{if(t)return t[e](...n)}},exports.remap=T,exports.render=l,exports.renderStatic=e=>{const t=s();return f(t,e),new Promise(e=>setTimeout(e,800)).then(()=>l(t))},exports.signalOwn=F,exports.spec=M,exports.storeField=(e,t)=>{const n=e.map(O(I,t)),r=ae.get();return r&&i(r.signal,[n]),n},exports.style=U,exports.text=W,exports.transform=z,exports.tree=function e({key:t,child:n,source:r},s){P({source:r,key:t},({store:r,key:l,signal:i})=>{const[o]=T(r,[n]);s({store:r,key:l,signal:i},()=>{e({key:t,child:n,source:o},s)})})},exports.using=f,exports.visible=Y; | ||
//# 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
332774
472
1