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

patronum

Package Overview
Dependencies
Maintainers
0
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patronum - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

106

condition/index.d.ts

@@ -1,67 +0,41 @@

import { Effect, Event, Store, UnitTargetable, EventCallable } from 'effector';
type NoInfer<T> = T & {
[K in keyof T]: T[K];
};
type EventAsReturnType<Payload> = any extends Payload ? Event<Payload> : never;
export declare function condition<State>(options: {
source: Event<State>;
if: ((payload: State) => boolean) | Store<boolean> | State;
then: UnitTargetable<NoInfer<State> | void>;
else: UnitTargetable<NoInfer<State> | void>;
}): EventAsReturnType<State>;
export declare function condition<State>(options: {
source: Store<State>;
if: ((payload: State) => boolean) | Store<boolean> | State;
then: UnitTargetable<State | void>;
else: UnitTargetable<State | void>;
}): Store<State>;
export declare function condition<Params, Done, Fail>(options: {
source: Effect<Params, Done, Fail>;
if: ((payload: Params) => boolean) | Store<boolean> | Params;
then: UnitTargetable<NoInfer<Params> | void>;
else: UnitTargetable<NoInfer<Params> | void>;
}): Effect<Params, Done, Fail>;
export declare function condition<State>(options: {
source: Event<State>;
if: ((payload: State) => boolean) | Store<boolean> | State;
then: UnitTargetable<NoInfer<State> | void>;
}): EventAsReturnType<State>;
export declare function condition<State>(options: {
source: Store<State>;
if: ((payload: State) => boolean) | Store<boolean> | State;
then: UnitTargetable<NoInfer<State> | void>;
}): Store<State>;
export declare function condition<Params, Done, Fail>(options: {
source: Effect<Params, Done, Fail>;
if: ((payload: Params) => boolean) | Store<boolean> | Params;
then: UnitTargetable<NoInfer<Params> | void>;
}): Effect<Params, Done, Fail>;
export declare function condition<State>(options: {
source: Event<State>;
if: ((payload: State) => boolean) | Store<boolean> | State;
else: UnitTargetable<NoInfer<State> | void>;
}): EventAsReturnType<State>;
export declare function condition<State>(options: {
source: Store<State>;
if: ((payload: State) => boolean) | Store<boolean> | State;
else: UnitTargetable<NoInfer<State> | void>;
}): Store<State>;
export declare function condition<Params, Done, Fail>(options: {
source: Effect<Params, Done, Fail>;
if: ((payload: Params) => boolean) | Store<boolean> | Params;
else: UnitTargetable<NoInfer<Params> | void>;
}): Effect<Params, Done, Fail>;
export declare function condition<State>(options: {
if: ((payload: State) => boolean) | Store<boolean> | State;
then: UnitTargetable<NoInfer<State> | void>;
else: UnitTargetable<NoInfer<State> | void>;
}): EventCallable<State>;
export declare function condition<State>(options: {
if: ((payload: State) => boolean) | Store<boolean> | State;
then: UnitTargetable<NoInfer<State> | void>;
}): EventCallable<State>;
export declare function condition<State>(options: {
if: ((payload: State) => boolean) | Store<boolean> | State;
else: UnitTargetable<NoInfer<State> | void>;
}): EventCallable<State>;
import { Effect, Event, Store, UnitTargetable, UnitValue, EventCallable, EventCallableAsReturnType } from 'effector';
type NoInfer<T> = [T][T extends any ? 0 : never];
type NonFalsy<T> = T extends null | undefined | false | 0 | 0n | '' ? never : T;
type SourceUnit<T> = Store<T> | Event<T> | Effect<T, any, any>;
export declare function condition<Payload, Then extends Payload = Payload>(options: {
source?: undefined;
if: ((payload: Payload) => payload is Then) | Then;
then?: UnitTargetable<NoInfer<Then> | void>;
else?: UnitTargetable<Exclude<NoInfer<Payload>, Then> | void>;
}): EventCallableAsReturnType<Payload>;
export declare function condition<Payload, Then extends NonFalsy<Payload> = NonFalsy<Payload>>(options: {
source?: undefined;
if: BooleanConstructor;
then?: UnitTargetable<NoInfer<Then> | void>;
else?: UnitTargetable<Exclude<NoInfer<Payload>, Then> | void>;
}): EventCallableAsReturnType<Payload>;
export declare function condition<Payload>(options: {
source?: undefined;
if: ((payload: Payload) => boolean) | Store<boolean> | NoInfer<Payload>;
then?: UnitTargetable<NoInfer<Payload> | void>;
else?: UnitTargetable<NoInfer<Payload> | void>;
}): EventCallableAsReturnType<Payload>;
export declare function condition<Payload extends UnitValue<Source>, Then extends Payload = Payload, Source extends SourceUnit<any> = SourceUnit<Payload>>(options: {
source: Source;
if: ((payload: Payload) => payload is Then) | Then;
then?: UnitTargetable<NoInfer<Then>>;
else?: UnitTargetable<Exclude<NoInfer<Payload>, Then>>;
}): Source;
export declare function condition<Payload extends UnitValue<Source>, Then extends NonFalsy<Payload> = NonFalsy<Payload>, Source extends SourceUnit<any> = SourceUnit<Payload>>(options: {
source: Source;
if: BooleanConstructor;
then?: UnitTargetable<NoInfer<Then> | void>;
else?: UnitTargetable<Exclude<NoInfer<Payload>, Then>>;
}): EventCallable<Payload>;
export declare function condition<Payload extends UnitValue<Source>, Source extends SourceUnit<any> = SourceUnit<Payload>>(options: {
source: SourceUnit<Payload>;
if: ((payload: Payload) => boolean) | Store<boolean> | NoInfer<Payload>;
then?: UnitTargetable<NoInfer<Payload> | void>;
else?: UnitTargetable<NoInfer<Payload> | void>;
}): Source;
export {};
import { createEvent, sample, is, split } from 'effector';
export function condition(_ref) {
var {
if: test,
then: thenBranch,
else: elseBranch,
source = createEvent({
name: "source",
sid: "tdyoa4"
sid: "rytt3j"
}, {
name: "source",
sid: "tdyoa4"
})
sid: "rytt3j"
}),
if: test,
then: thenBranch,
else: elseBranch
} = _ref;

@@ -15,0 +15,0 @@ var checker = is.unit(test) || isFunction(test) ? test : value => value === test;

{
"name": "patronum",
"version": "2.2.0",
"version": "2.3.0",
"description": "☄️ Effector utility library delivering modularity and convenience",

@@ -5,0 +5,0 @@ "type": "module",

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

import{combine as e,createEvent as r,is as t,withRegion as n,createStore as o,sample as i,split as a,attach as c,merge as s,createNode as u,step as d,clearNode as f,createEffect as l,launch as m,restore as p}from"effector";function v(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e({and:[t,e=>{for(var r of e)if(!r)return!1;return!0},{skipVoid:!1}],or:{sid:"-rbm5ks"}})}function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function y(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){var a=function(e){return Object.keys(e).some((r=>!["events","reset","target"].includes(r)&&t.unit(e[r])))}(e)?{events:e}:e,{events:c,reset:s,target:u=r({name:"target",sid:"p73fff"})}=a;return t.unit(u)&&t.targetable(u)||b("target should be a targetable unit"),s&&!t.unit(s)&&b("reset should be a unit"),n(u,(()=>{var e=Object.keys(c),r=Array.isArray(c)?[...e].fill(""):{},t=o(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-ahoahx"}),n=o(r,{and:{serialize:"ignore"},name:"$results",sid:"oy8iyn"});i({and:[{source:u,target:t.reinit}],or:{sid:"blex0c"}}),n.reset(u),s&&(i({and:[{source:s,target:t.reinit}],or:{sid:"bnm3fi"}}),n.reset(s));var a=function(e){var r=o(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"-rf2fac"}).on(c[e],(()=>!0)).reset(u);s&&r.reset(s),t.on(r,(e=>e-1)),n.on(c[e],((r,t)=>{var n=Array.isArray(r)?[...r]:function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?g(Object(t),!0).forEach((function(r){y(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},r);return n[e]=t,n}))};for(var d of e)a(d);var f=i({and:[{source:n,clock:[...Object.values(c)]}],or:{name:"eventsTrriggered",sid:"-lro8bq"}});i({and:[{source:f,filter:t.map((e=>0===e),{skipVoid:!1}),target:u}],or:{sid:"-dlkr2s"}})})),u}function b(e){throw new Error(e)}function k(e){var{if:n,then:o,else:c,source:s=r({name:"source",sid:"tdyoa4"},{name:"source",sid:"tdyoa4"})}=e,u=t.unit(n)||"function"==typeof n?n:e=>e===n;return o&&c?a({and:[{source:s,match:{then:u,else:w(u)},cases:{then:o,else:c}}],or:{sid:"aaw2hr"}}):o?i({and:[{source:s,filter:u,target:o}],or:{sid:"-dwrmbb"}}):c&&i({and:[{source:s,filter:w(u),target:c}],or:{sid:"-dsx25s"}}),s}function w(e){return t.unit(e)?e.map((e=>!e),{skipVoid:!1}):r=>!e(r)}function j(){var e,n=2===arguments.length?{source:arguments.length<=0?void 0:arguments[0],timeout:arguments.length<=1?void 0:arguments[1]}:arguments.length<=0?void 0:arguments[0],{source:a,timeout:u,target:d,name:f}=n;if(!t.unit(a))throw new TypeError("source must be unit from effector");if(t.domain(a,{sid:"jsc7s2"}))throw new TypeError("source cannot be domain");var l=O(u),m=r({name:"saveCancel",sid:"-kec0n3"}),p=o([],{and:{serialize:"ignore"},name:"$canceller",sid:"-tfm9fg"}).on(m,((e,r)=>r)),v=null!==(e=d)&&void 0!==e?e:r({name:"tick",sid:"-50e2rn"}),g=c({and:{name:f||"debounce(".concat((null==a?void 0:a.shortName)||a.kind,") effect"),source:p,effect(e,r){var[t,n]=e;return t&&clearTimeout(t),n&&n(),new Promise(((e,t)=>{m([setTimeout(e,r),t])}))}},or:{name:"timerFx",sid:"-jwso4j"}});p.reset(g.done);var y=o([],{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"-x9cllg"}).on(a,((e,r)=>[r])),h=o(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"8r2952"}),b=r({name:"triggerTick",sid:"-781myl"});h.on(b,(()=>!1)).on([v,l,g],(()=>!0));var k=s([a,i({and:[{clock:l,filter:g.pending}],or:{name:"requestTick",sid:"-khrpxp"}})],{name:"requestTick",sid:"2k0852"});return i({and:[{clock:k,filter:h,target:b}],or:{sid:"-31h8q8"}}),i({and:[{source:l,clock:b,target:g}],or:{sid:"-2y6h62"}}),i({and:[{source:y,clock:g.done,fn:e=>{var[r]=e;return r},target:v}],or:{sid:"-2jc15b"}}),v}function O(e){if(t.store(e,{sid:"-21qm2b"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"kbepy4"})}throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}function E(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function T(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?E(Object(t),!0).forEach((function(r){P(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function P(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var A={trace:!1,handler:e=>{if(!B(e.node)||"finally"!==e.node.meta.named){var{scope:r,scopeName:t,name:n,kind:o,value:i,loc:a,trace:c,node:s,logType:u}=e,d=r?" (scope: ".concat(t,")"):"",f=null!=n?n:a?"".concat(a.file,":").concat(a.line,":").concat(a.column):"",l="initial"===u?" [getState]":"";console.info("[".concat(o,"]").concat(d," ").concat(f).concat(l),i),c&&c.length>0&&!B(s)&&(console.groupCollapsed("[".concat(o,"]").concat(d," ").concat(f," trace")),c.forEach((e=>{var{name:r,kind:t,value:n,loc:o}=e,i=null!=r?r:o?"".concat(o.file,":").concat(o.line,":").concat(o.column):"";console.info("<- [".concat(t,"] ").concat(i),n)})),console.groupEnd())}}};function S(){var{config:e,units:r}=N(...arguments);r.forEach((r=>{t.store(r,{sid:"-foynff"})||t.event(r,{sid:"apy28p"})||t.effect(r,{sid:"apy3od"})?z(r,e):t.domain(r,{sid:"-rsqe9t"})&&x(r,e)}))}function x(e,r){e.onCreateStore((e=>z(e,r))),e.onCreateEvent((e=>z(e,r))),e.onCreateEffect((e=>z(e,r))),e.onCreateDomain((e=>x(e,r)))}function z(e,r){t.store(e,{sid:"w7ds2s"})?(!function(e,r){if(!r.handler)throw Error("patronum/debug must have the handler");var t={logType:"initial",scope:null,scopeName:null,node:U(e),kind:K(e),value:e.getState(),name:J(e),loc:Q(e),trace:[],stackMeta:{}};r.handler(t),R.forEach((t=>q(e,r,t))),C((t=>q(e,r,t)))}(e,r),V(e,r)):t.event(e,{sid:"fretyd"})?V(e,r):t.effect(e,{sid:"gpi2qr"})&&(V(e,r),V(e.finally,r),V(e.done,r),V(e.fail,r))}function V(e,r){var t=u({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[d.run({fn(t,n,o){var i,a=null!==(i=null==o?void 0:o.scope)&&void 0!==i?i:null,c={logType:"update",scope:a,scopeName:_(a),node:U(e),kind:K(e),value:t,name:J(e),loc:Q(e),stackMeta:W(o.parent),trace:r.trace?$(o):[]};if(!r.handler)throw Error("patronum/debug must have the handler");r.handler(c)}})]});return()=>f(t)}function $(e){for(var r=[],t=null==e?void 0:e.parent;t;){var{node:n,value:o}=t,i={node:n,value:o,name:J(n),loc:Q(n),kind:K(n),stackMeta:W(t)};r.push(i),t=t.parent}return r}function q(e,r,t){if(!r.handler)throw Error("patronum/debug must have the handler");var n=U(e),o={logType:"initial",scope:t,scopeName:_(t),node:n,kind:K(e),value:t.getState(e),name:J(e),loc:Q(e),trace:[],stackMeta:{}};r.handler(o)}function N(){for(var e=A,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var[i,...a]=n,c=[];if(D(i))e=T(T({},A),i);else if(t.unit(i))c.push(i);else for(var[s,u]of Object.entries(i))H.set(G(u).id,s),c.push(u);for(var d of a)if(t.unit(d))c.push(d);else for(var[f,l]of Object.entries(d))H.set(G(l).id,f),c.push(l);return{config:e,units:c}}function D(e){return!t.unit(e)&&!Object.values(e).every(t.unit)}var F=new Set,C=e=>(F.add(e),()=>{F.delete(e)});var I=0;var M=new Map,R={save(e,r){R.get(e)||M.set(e,r)},get(e){var r;return e&&null!==(r=M.get(e))&&void 0!==r?r:null},delete(e){M.delete(e)},forEach(e){M.forEach(((r,t)=>e(t,r)))},clear(){M.clear()}};function _(e){if(!e)return null;var r=R.get(e);return r?r.name:e._debugId||(e._debugId="unknown_".concat(I+=1))}function B(e){var r=U(e),{sid:t,named:n}=r.meta;return Boolean(!t&&("finally"===n||"done"===n||"doneData"===n||"fail"===n||"failData"===n||"inFlight"===n||"pending"===n))}function K(e){if(t.store(e,{sid:"4o7s04"}))return"store";if(t.effect(e,{sid:"4pv5s7"})||B(e))return"effect";if(t.event(e,{sid:"4rijka"}))return"event";if(t.domain(e,{sid:"54plsy"}))return"domain";if(t.unit(e))return"unit";var r=U(e);return r.meta.op?r.meta.op:"unknown"}S.registerScope=function(e,r){return R.save(e,{name:r.name}),F.forEach((r=>r(e))),()=>{R.delete(e)}},S.unregisterAllScopes=function(){R.clear()};var G=e=>e.graphite||e,H=new Map;function J(e){var r,n,o=H.get(G(e).id);if(o)return o;if(B(e)){var i=U(e),a=i.family.owners.find((e=>"effect"===e.meta.op));if(a){var c=L(a),s=c?"".concat(c,"/"):"";return"".concat(s).concat(J(a),".").concat(i.meta.named)}return i.meta.named}if(function(e){var r=U(e),{op:t}=r.meta;return"on"===t}(e)){var u=U(e),d=J(u.next[0]),f=J(u.family.owners[0]);return"".concat(d,".on(").concat(f,")")}if(t.unit(e)){var l;if(null!=e&&null!==(l=e.compositeName)&&void 0!==l&&l.fullName)return e.compositeName.fullName;var m=L(e),p=m?"".concat(m,"/"):"";if(null!=e&&e.shortName)return"".concat(p).concat(e.shortName);if(null!=e&&e.name)return"".concat(p).concat(e.name)}return null!==(r=U(e))&&void 0!==r&&null!==(n=r.meta)&&void 0!==n&&n.name?U(e).meta.name:null}function L(e){var r=U(e).family.owners.find((e=>"domain"===e.meta.op));return r?J(r):null}function Q(e){var r=function(e){var{meta:r}=e;return"config"in r?r.config.loc:r.loc}(U(e));if(r)return r}function U(e){return"graphite"in e?e.graphite:e}function W(e){return e&&e.meta||{}}function X(){var n=2===arguments.length?{source:arguments.length<=0?void 0:arguments[0],timeout:arguments.length<=1?void 0:arguments[1]}:arguments.length<=0?void 0:arguments[0],{source:o,timeout:a,target:c=r({name:"target",sid:"jucb8d"})}=n,s=Array.isArray(c)?c:[c];if(!t.unit(o))throw new TypeError("source must be a unit from effector");if(!s.every((e=>t.unit(e))))throw new TypeError("target must be a unit from effector");var u=Y(a),d=l((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-wp3hwr"});return i({and:[{source:e({and:[{milliseconds:u}],or:{name:"source",sid:"-gaikyz"}}),clock:o,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:d}],or:{sid:"-uuqxfw"}}),i({and:[{clock:d.doneData,target:s}],or:{sid:"-uc1x9m"}}),c}function Y(e){if(t.store(e,{sid:"-tvk3f2"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof e,'"'))}function Z(r,n,o){if(t.store(r,{sid:"ozzvoc"}))return e({and:[r,n,o,(e,r,t)=>e?r:t,{skipVoid:!1}],or:{sid:"-5vau2h"}});var i=r;return Z(i.filter,i.then,i.other)}function ee(e){return e.map((e=>null==e),{skipVoid:!1})}function re(r,t){return e({and:[r,t,(e,r)=>e===r,{skipVoid:!1}],or:{sid:"-pqjlti"}})}function te(r,n){var o,i=[],a=()=>!1;Array.isArray(r)?(i=r,a=n):Array.isArray(r.stores)&&(i=r.stores,a=r.predicate),o="function"==typeof a?a:t.store(a,{sid:"sid3ut"})?a.map((e=>r=>e===r),{skipVoid:!1}):e=>e===a;var c=e({and:[i],or:{name:"$values",sid:"rwb5jx"}});return e({and:[o,c,(e,r)=>r.every(e),{skipVoid:!1}],or:{sid:"hgnz2z"}})}function ne(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return e({and:[n,e=>r.reduce(((t,n,o)=>t.concat(ie(r,o)?n:"".concat(n).concat(oe(e[o])))),""),{skipVoid:!1}],or:{sid:"-yrbthp"}})}function oe(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function ie(e,r){return r===e.length-1}function ae(r){var t=Array.isArray(r)?{effects:r}:r,{effects:n,domain:o}=t;if(o){var i=o.createStore(0,{name:"$inFlight",sid:"-wboyn1"});return o.onCreateEffect((e=>{i.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),i}return e({and:[n.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0),{skipVoid:!1}],or:{sid:"udy3nn"}})}function ce(e){var{timeout:n,start:a,stop:s,leading:u=!1,trailing:d=!1}=e,f=r({name:"setup",sid:"-ajee8b"});a&&i({and:[{clock:a,target:f}],or:{sid:"-wq30tc"}});var l=r({name:"teardown",sid:"-on6wf8"});s&&i({and:[{clock:s,target:l}],or:{sid:"-wloo2g"}});var m=r({name:"tick",sid:"37avek"}),p=o(!1,{name:"$isRunning",sid:"amqfro"}),v=function(e){if(t.store(e,{sid:"90rxd3"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"-3ibdj9"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(n),g=p.map((e=>!e),{skipVoid:!1}),y=r({name:"saveTimeout",sid:"-goth3o"}),h=o(null,{name:"$timeoutId",sid:"xi134t"}).on(y,((e,r)=>{var{timeoutId:t}=r;return t})),b=o((()=>{}),{name:"$rejecter",sid:"-2am6sk"}).on(y,((e,r)=>{var{reject:t}=r;return t})),k=c({and:{source:{timeout:v,running:p},effect:e=>{var{timeout:r,running:t}=e;return t?new Promise(((e,t)=>{var n=setTimeout(e,r);y({timeoutId:n,reject:t})})):Promise.reject()}},or:{name:"timeoutFx",sid:"-hiem3q"}}),w=c({and:{source:{timeoutId:h,rejecter:b},effect:e=>{var{timeoutId:r,rejecter:t}=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"d148gq"}});if(i({and:[{clock:f,source:v,filter:g,target:k}],or:{sid:"-u9k5bx"}}),u){var j=i({and:[{clock:f,filter:g}],or:{name:"onReady",sid:"5o8c6v"}});i({and:[{clock:j,target:m}],or:{sid:"6njtce"}})}return i({and:[{clock:f,fn:()=>!0,target:p}],or:{sid:"6p772r"}}),i({and:[{clock:k.done,source:v,filter:p,target:k}],or:{sid:"741n3i"}}),i({and:[{clock:k.done,filter:p,target:m.prepend((()=>{}))}],or:{sid:"7jfvpm"}}),d&&i({and:[{clock:l,target:m}],or:{sid:"7zxpk6"}}),p.on(l,(()=>!1)),i({and:[{clock:l,target:w}],or:{sid:"84c29c"}}),{tick:m,isRunning:p,"@@trigger":()=>({setup:f,teardown:l,fired:m})}}function se(e){return e.map((e=>!e),{skipVoid:!1})}function ue(e){var r,n;t.unit(e)?r=e:({source:r,reset:n}=e);var a=o(!0,{name:"$canTrigger",sid:"ys2jl0"}),c=i({and:[{source:r,filter:a}],or:{name:"trigger",sid:"e3xto3"}});return a.on(c,(()=>!1)),n&&a.reset(n),c}function de(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e({and:[t,e=>{for(var r of e)if(r)return!0;return!1},{skipVoid:!1}],or:{sid:"-44722k"}})}var fe={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function le(r){var n=Array.isArray(r)?{effects:r}:r,{effects:o,domain:i,of:a="some"}=n;if(!t.domain(i,{sid:"98ymuf"})&&!o)throw new TypeError("domain or effects should be passed");if("some"!==a&&"every"!==a)throw new TypeError('strategy parameter "of" can be "every" or "some". Passed: "'.concat(a,'"'));var c=null!=o?o:[],s=fe[a];return i&&(c=[],i.onCreateEffect((e=>c.push(e)))),e({and:[c.map((e=>e.pending)),s,{skipVoid:!1}],or:{sid:"a4upb3"}})}function me(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var[i]=r,a=r.length<2?null:r[1];if(!t.store(i,{sid:"mzq5dc"}))throw Error("previous first argument should be a store");var c=o(a,{and:{serialize:"ignore",skipVoid:!1},name:"$prevValue",sid:"e05yob"}),s=i.graphite;return s.seq.push(d.compute({fn:(e,r,t)=>(m({target:c,params:t.a,defer:!0}),e)})),c}function pe(e){return t.targetable(e)?t.store(e,{sid:"-kqkmsc"})?e.map((e=>e),{skipVoid:!1}):t.event(e,{sid:"-kodgew"})?e.map((e=>e)):e:e}function ve(e){var{clock:t,target:n}=e,o=Array.isArray(n)?n:[n],i=Array.isArray(t)?t:[null!=t?t:r({name:"clocks",sid:"bqmea5"})];return o.forEach((e=>{e.reset(i)})),void 0===t?i[0]:void 0}function ge(e){var{source:r,shape:t}=e,n={},o=function(e){if(!Object.prototype.hasOwnProperty.call(t,e))return"continue";var o=t[e];n[e]=r.map((e=>{var r=o(e);return void 0===r?null:r}),{skipVoid:!1})};for(var i in t)o(i);return n}function ye(e){var{source:r,clock:t,fn:n=(e=>e)}=e,a=n(r.defaultState),c=i(t?{and:[{source:r,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-imuiws"}}:{and:[{source:r,fn:n}],or:{name:"onSnapshot",sid:"-imaqbf"}}),s=o(a,{name:"$snapshot",sid:"-63s6pn"});return s.on(c,((e,r)=>r)),s}function he(r,n){var o,i=[],a=()=>!1;Array.isArray(r)?(i=r,a=n):Array.isArray(r.stores)&&(i=r.stores,a=r.predicate),o="function"==typeof a?a:t.store(a,{sid:"zbwu0l"})?a.map((e=>r=>e===r),{skipVoid:!1}):e=>e===a;var c=e({and:[i],or:{name:"$values",sid:"-kx24vm"}});return e({and:[o,c,(e,r)=>r.some(e),{skipVoid:!1}],or:{sid:"-ee8kph"}})}function be(e){var{source:r,cases:n}=e,o={},i=t.store(r,{name:"current",sid:"-htjkz7"})?r.updates:r;for(var a in n)a in n&&function(){var e=n[a];o[a]=i.filterMap(e),i=i.filter({fn:r=>!e(r)})}();return o.__=i,o}var ke={}.hasOwnProperty;function we(e){var n=function(e){return Object.keys(e).some((r=>!["targets","source"].includes(r)&&t.unit(e[r])))}(e)?{targets:e}:e,{targets:o,source:a=r({name:"source",sid:"e9ipnn"})}=n,c=function(e){if(n=o,c=e,ke.call(n,c)){var r=o[e],t=i({and:[{source:a,batch:!1,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"eapc0z"}});i({and:[{batch:!1,clock:t,fn:r=>r[e],target:r}],or:{sid:"mkzcy4"}})}var n,c};for(var s in o)c(s);return a}function je(e){var{effect:r,defaultValue:n="initial"}=t.effect(e,{sid:"cn6w5b"})?{effect:e}:e,i=o(n,{name:"$status",sid:"ph7d4u"});if(!t.effect(r,{sid:"-kp39vu"}))throw TypeError('status: "effect" property is not an effect');return i.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),i}function Oe(){var e=2===arguments.length?{source:arguments.length<=0?void 0:arguments[0],timeout:arguments.length<=1?void 0:arguments[1]}:arguments.length<=0?void 0:arguments[0],{source:n,timeout:a,target:c=r({name:"target",sid:"-gyhb56"})}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");var s=Ee(a),u=l({name:"throttle(".concat(n.shortName||n.kind,") effect"),handler:e=>new Promise((r=>setTimeout(r,e)))},{name:"timerFx",sid:"-lp5bot"}),d=o(null,{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"w71tnu"}).on(n,((e,r)=>r)),f=r({name:"triggerTick",sid:"-dquigt"}),m=o(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"e2dxhp"}).on(f,(()=>!1)).on(c,(()=>!0));return i({and:[{clock:n,filter:m,target:f}],or:{sid:"-hifwv4"}}),i({and:[{source:s,clock:f,target:u}],or:{sid:"-h3lgud"}}),i({and:[{source:d,clock:u.done,target:c}],or:{sid:"-h0apa7"}}),c}function Ee(e){if(t.store(e,{sid:"-gj92sk"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"-2ktcsz"})}throw new TypeError('timeout parameter should be number or Store. "'.concat(typeof e,'" was passed'))}var Te=()=>Date.now();function Pe(e){var r=t.unit(e)?{clock:e}:e,{clock:n,getNow:o,initial:a}=r,c=null!=o?o:Te,s=l(c,{name:"readNowFx",sid:"ito90c"}),u=p(s,null!=a?a:c(),{name:"$time",sid:"-k3vl4d"});return i({and:[{clock:n,target:s}],or:{sid:"rul0o2"}}),u}export{v as and,h as combineEvents,k as condition,j as debounce,S as debug,X as delay,Z as either,ee as empty,re as equals,te as every,ne as format,ae as inFlight,ce as interval,se as not,ue as once,de as or,le as pending,me as previous,pe as readonly,ve as reset,ge as reshape,ye as snapshot,he as some,be as splitMap,we as spread,je as status,Oe as throttle,Pe as time};
import{combine as e,createEvent as r,is as t,withRegion as n,createStore as o,sample as i,split as a,attach as c,merge as s,createNode as u,step as d,clearNode as f,createEffect as l,launch as m,restore as p}from"effector";function v(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e({and:[t,e=>{for(var r of e)if(!r)return!1;return!0},{skipVoid:!1}],or:{sid:"-rbm5ks"}})}function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function y(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){var a=function(e){return Object.keys(e).some((r=>!["events","reset","target"].includes(r)&&t.unit(e[r])))}(e)?{events:e}:e,{events:c,reset:s,target:u=r({name:"target",sid:"p73fff"})}=a;return t.unit(u)&&t.targetable(u)||b("target should be a targetable unit"),s&&!t.unit(s)&&b("reset should be a unit"),n(u,(()=>{var e=Object.keys(c),r=Array.isArray(c)?[...e].fill(""):{},t=o(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-ahoahx"}),n=o(r,{and:{serialize:"ignore"},name:"$results",sid:"oy8iyn"});i({and:[{source:u,target:t.reinit}],or:{sid:"blex0c"}}),n.reset(u),s&&(i({and:[{source:s,target:t.reinit}],or:{sid:"bnm3fi"}}),n.reset(s));var a=function(e){var r=o(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"-rf2fac"}).on(c[e],(()=>!0)).reset(u);s&&r.reset(s),t.on(r,(e=>e-1)),n.on(c[e],((r,t)=>{var n=Array.isArray(r)?[...r]:function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?g(Object(t),!0).forEach((function(r){y(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},r);return n[e]=t,n}))};for(var d of e)a(d);var f=i({and:[{source:n,clock:[...Object.values(c)]}],or:{name:"eventsTrriggered",sid:"-lro8bq"}});i({and:[{source:f,filter:t.map((e=>0===e),{skipVoid:!1}),target:u}],or:{sid:"-dlkr2s"}})})),u}function b(e){throw new Error(e)}function k(e){var{source:n=r({name:"source",sid:"rytt3j"},{name:"source",sid:"rytt3j"}),if:o,then:c,else:s}=e,u=t.unit(o)||"function"==typeof o?o:e=>e===o;return c&&s?a({and:[{source:n,match:{then:u,else:w(u)},cases:{then:c,else:s}}],or:{sid:"aaw2hr"}}):c?i({and:[{source:n,filter:u,target:c}],or:{sid:"-dwrmbb"}}):s&&i({and:[{source:n,filter:w(u),target:s}],or:{sid:"-dsx25s"}}),n}function w(e){return t.unit(e)?e.map((e=>!e),{skipVoid:!1}):r=>!e(r)}function j(){var e,n=2===arguments.length?{source:arguments.length<=0?void 0:arguments[0],timeout:arguments.length<=1?void 0:arguments[1]}:arguments.length<=0?void 0:arguments[0],{source:a,timeout:u,target:d,name:f}=n;if(!t.unit(a))throw new TypeError("source must be unit from effector");if(t.domain(a,{sid:"jsc7s2"}))throw new TypeError("source cannot be domain");var l=O(u),m=r({name:"saveCancel",sid:"-kec0n3"}),p=o([],{and:{serialize:"ignore"},name:"$canceller",sid:"-tfm9fg"}).on(m,((e,r)=>r)),v=null!==(e=d)&&void 0!==e?e:r({name:"tick",sid:"-50e2rn"}),g=c({and:{name:f||"debounce(".concat((null==a?void 0:a.shortName)||a.kind,") effect"),source:p,effect(e,r){var[t,n]=e;return t&&clearTimeout(t),n&&n(),new Promise(((e,t)=>{m([setTimeout(e,r),t])}))}},or:{name:"timerFx",sid:"-jwso4j"}});p.reset(g.done);var y=o([],{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"-x9cllg"}).on(a,((e,r)=>[r])),h=o(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"8r2952"}),b=r({name:"triggerTick",sid:"-781myl"});h.on(b,(()=>!1)).on([v,l,g],(()=>!0));var k=s([a,i({and:[{clock:l,filter:g.pending}],or:{name:"requestTick",sid:"-khrpxp"}})],{name:"requestTick",sid:"2k0852"});return i({and:[{clock:k,filter:h,target:b}],or:{sid:"-31h8q8"}}),i({and:[{source:l,clock:b,target:g}],or:{sid:"-2y6h62"}}),i({and:[{source:y,clock:g.done,fn:e=>{var[r]=e;return r},target:v}],or:{sid:"-2jc15b"}}),v}function O(e){if(t.store(e,{sid:"-21qm2b"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"kbepy4"})}throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}function E(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function T(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?E(Object(t),!0).forEach((function(r){P(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function P(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var A={trace:!1,handler:e=>{if(!B(e.node)||"finally"!==e.node.meta.named){var{scope:r,scopeName:t,name:n,kind:o,value:i,loc:a,trace:c,node:s,logType:u}=e,d=r?" (scope: ".concat(t,")"):"",f=null!=n?n:a?"".concat(a.file,":").concat(a.line,":").concat(a.column):"",l="initial"===u?" [getState]":"";console.info("[".concat(o,"]").concat(d," ").concat(f).concat(l),i),c&&c.length>0&&!B(s)&&(console.groupCollapsed("[".concat(o,"]").concat(d," ").concat(f," trace")),c.forEach((e=>{var{name:r,kind:t,value:n,loc:o}=e,i=null!=r?r:o?"".concat(o.file,":").concat(o.line,":").concat(o.column):"";console.info("<- [".concat(t,"] ").concat(i),n)})),console.groupEnd())}}};function S(){var{config:e,units:r}=N(...arguments);r.forEach((r=>{t.store(r,{sid:"-foynff"})||t.event(r,{sid:"apy28p"})||t.effect(r,{sid:"apy3od"})?V(r,e):t.domain(r,{sid:"-rsqe9t"})&&x(r,e)}))}function x(e,r){e.onCreateStore((e=>V(e,r))),e.onCreateEvent((e=>V(e,r))),e.onCreateEffect((e=>V(e,r))),e.onCreateDomain((e=>x(e,r)))}function V(e,r){t.store(e,{sid:"w7ds2s"})?(!function(e,r){if(!r.handler)throw Error("patronum/debug must have the handler");var t={logType:"initial",scope:null,scopeName:null,node:U(e),kind:G(e),value:e.getState(),name:K(e),loc:Q(e),trace:[],stackMeta:{}};r.handler(t),R.forEach((t=>q(e,r,t))),C((t=>q(e,r,t)))}(e,r),$(e,r)):t.event(e,{sid:"fretyd"})?$(e,r):t.effect(e,{sid:"gpi2qr"})&&($(e,r),$(e.finally,r),$(e.done,r),$(e.fail,r))}function $(e,r){var t=u({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[d.run({fn(t,n,o){var i,a=null!==(i=null==o?void 0:o.scope)&&void 0!==i?i:null,c={logType:"update",scope:a,scopeName:_(a),node:U(e),kind:G(e),value:t,name:K(e),loc:Q(e),stackMeta:W(o.parent),trace:r.trace?z(o):[]};if(!r.handler)throw Error("patronum/debug must have the handler");r.handler(c)}})]});return()=>f(t)}function z(e){for(var r=[],t=null==e?void 0:e.parent;t;){var{node:n,value:o}=t,i={node:n,value:o,name:K(n),loc:Q(n),kind:G(n),stackMeta:W(t)};r.push(i),t=t.parent}return r}function q(e,r,t){if(!r.handler)throw Error("patronum/debug must have the handler");var n=U(e),o={logType:"initial",scope:t,scopeName:_(t),node:n,kind:G(e),value:t.getState(e),name:K(e),loc:Q(e),trace:[],stackMeta:{}};r.handler(o)}function N(){for(var e=A,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var[i,...a]=n,c=[];if(D(i))e=T(T({},A),i);else if(t.unit(i))c.push(i);else for(var[s,u]of Object.entries(i))J.set(H(u).id,s),c.push(u);for(var d of a)if(t.unit(d))c.push(d);else for(var[f,l]of Object.entries(d))J.set(H(l).id,f),c.push(l);return{config:e,units:c}}function D(e){return!t.unit(e)&&!Object.values(e).every(t.unit)}var F=new Set,C=e=>(F.add(e),()=>{F.delete(e)});var I=0;var M=new Map,R={save(e,r){R.get(e)||M.set(e,r)},get(e){var r;return e&&null!==(r=M.get(e))&&void 0!==r?r:null},delete(e){M.delete(e)},forEach(e){M.forEach(((r,t)=>e(t,r)))},clear(){M.clear()}};function _(e){if(!e)return null;var r=R.get(e);return r?r.name:e._debugId||(e._debugId="unknown_".concat(I+=1))}function B(e){var r=U(e),{sid:t,named:n}=r.meta;return Boolean(!t&&("finally"===n||"done"===n||"doneData"===n||"fail"===n||"failData"===n||"inFlight"===n||"pending"===n))}function G(e){if(t.store(e,{sid:"4o7s04"}))return"store";if(t.effect(e,{sid:"4pv5s7"})||B(e))return"effect";if(t.event(e,{sid:"4rijka"}))return"event";if(t.domain(e,{sid:"54plsy"}))return"domain";if(t.unit(e))return"unit";var r=U(e);return r.meta.op?r.meta.op:"unknown"}S.registerScope=function(e,r){return R.save(e,{name:r.name}),F.forEach((r=>r(e))),()=>{R.delete(e)}},S.unregisterAllScopes=function(){R.clear()};var H=e=>e.graphite||e,J=new Map;function K(e){var r,n,o=J.get(H(e).id);if(o)return o;if(B(e)){var i=U(e),a=i.family.owners.find((e=>"effect"===e.meta.op));if(a){var c=L(a),s=c?"".concat(c,"/"):"";return"".concat(s).concat(K(a),".").concat(i.meta.named)}return i.meta.named}if(function(e){var r=U(e),{op:t}=r.meta;return"on"===t}(e)){var u=U(e),d=K(u.next[0]),f=K(u.family.owners[0]);return"".concat(d,".on(").concat(f,")")}if(t.unit(e)){var l;if(null!=e&&null!==(l=e.compositeName)&&void 0!==l&&l.fullName)return e.compositeName.fullName;var m=L(e),p=m?"".concat(m,"/"):"";if(null!=e&&e.shortName)return"".concat(p).concat(e.shortName);if(null!=e&&e.name)return"".concat(p).concat(e.name)}return null!==(r=U(e))&&void 0!==r&&null!==(n=r.meta)&&void 0!==n&&n.name?U(e).meta.name:null}function L(e){var r=U(e).family.owners.find((e=>"domain"===e.meta.op));return r?K(r):null}function Q(e){var r=function(e){var{meta:r}=e;return"config"in r?r.config.loc:r.loc}(U(e));if(r)return r}function U(e){return"graphite"in e?e.graphite:e}function W(e){return e&&e.meta||{}}function X(){var n=2===arguments.length?{source:arguments.length<=0?void 0:arguments[0],timeout:arguments.length<=1?void 0:arguments[1]}:arguments.length<=0?void 0:arguments[0],{source:o,timeout:a,target:c=r({name:"target",sid:"jucb8d"})}=n,s=Array.isArray(c)?c:[c];if(!t.unit(o))throw new TypeError("source must be a unit from effector");if(!s.every((e=>t.unit(e))))throw new TypeError("target must be a unit from effector");var u=Y(a),d=l((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-wp3hwr"});return i({and:[{source:e({and:[{milliseconds:u}],or:{name:"source",sid:"-gaikyz"}}),clock:o,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:d}],or:{sid:"-uuqxfw"}}),i({and:[{clock:d.doneData,target:s}],or:{sid:"-uc1x9m"}}),c}function Y(e){if(t.store(e,{sid:"-tvk3f2"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof e,'"'))}function Z(r,n,o){if(t.store(r,{sid:"ozzvoc"}))return e({and:[r,n,o,(e,r,t)=>e?r:t,{skipVoid:!1}],or:{sid:"-5vau2h"}});var i=r;return Z(i.filter,i.then,i.other)}function ee(e){return e.map((e=>null==e),{skipVoid:!1})}function re(r,t){return e({and:[r,t,(e,r)=>e===r,{skipVoid:!1}],or:{sid:"-pqjlti"}})}function te(r,n){var o,i=[],a=()=>!1;Array.isArray(r)?(i=r,a=n):Array.isArray(r.stores)&&(i=r.stores,a=r.predicate),o="function"==typeof a?a:t.store(a,{sid:"sid3ut"})?a.map((e=>r=>e===r),{skipVoid:!1}):e=>e===a;var c=e({and:[i],or:{name:"$values",sid:"rwb5jx"}});return e({and:[o,c,(e,r)=>r.every(e),{skipVoid:!1}],or:{sid:"hgnz2z"}})}function ne(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return e({and:[n,e=>r.reduce(((t,n,o)=>t.concat(ie(r,o)?n:"".concat(n).concat(oe(e[o])))),""),{skipVoid:!1}],or:{sid:"-yrbthp"}})}function oe(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function ie(e,r){return r===e.length-1}function ae(r){var t=Array.isArray(r)?{effects:r}:r,{effects:n,domain:o}=t;if(o){var i=o.createStore(0,{name:"$inFlight",sid:"-wboyn1"});return o.onCreateEffect((e=>{i.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),i}return e({and:[n.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0),{skipVoid:!1}],or:{sid:"udy3nn"}})}function ce(e){var{timeout:n,start:a,stop:s,leading:u=!1,trailing:d=!1}=e,f=r({name:"setup",sid:"-ajee8b"});a&&i({and:[{clock:a,target:f}],or:{sid:"-wq30tc"}});var l=r({name:"teardown",sid:"-on6wf8"});s&&i({and:[{clock:s,target:l}],or:{sid:"-wloo2g"}});var m=r({name:"tick",sid:"37avek"}),p=o(!1,{name:"$isRunning",sid:"amqfro"}),v=function(e){if(t.store(e,{sid:"90rxd3"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"-3ibdj9"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(n),g=p.map((e=>!e),{skipVoid:!1}),y=r({name:"saveTimeout",sid:"-goth3o"}),h=o(null,{name:"$timeoutId",sid:"xi134t"}).on(y,((e,r)=>{var{timeoutId:t}=r;return t})),b=o((()=>{}),{name:"$rejecter",sid:"-2am6sk"}).on(y,((e,r)=>{var{reject:t}=r;return t})),k=c({and:{source:{timeout:v,running:p},effect:e=>{var{timeout:r,running:t}=e;return t?new Promise(((e,t)=>{var n=setTimeout(e,r);y({timeoutId:n,reject:t})})):Promise.reject()}},or:{name:"timeoutFx",sid:"-hiem3q"}}),w=c({and:{source:{timeoutId:h,rejecter:b},effect:e=>{var{timeoutId:r,rejecter:t}=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"d148gq"}});if(i({and:[{clock:f,source:v,filter:g,target:k}],or:{sid:"-u9k5bx"}}),u){var j=i({and:[{clock:f,filter:g}],or:{name:"onReady",sid:"5o8c6v"}});i({and:[{clock:j,target:m}],or:{sid:"6njtce"}})}return i({and:[{clock:f,fn:()=>!0,target:p}],or:{sid:"6p772r"}}),i({and:[{clock:k.done,source:v,filter:p,target:k}],or:{sid:"741n3i"}}),i({and:[{clock:k.done,filter:p,target:m.prepend((()=>{}))}],or:{sid:"7jfvpm"}}),d&&i({and:[{clock:l,target:m}],or:{sid:"7zxpk6"}}),p.on(l,(()=>!1)),i({and:[{clock:l,target:w}],or:{sid:"84c29c"}}),{tick:m,isRunning:p,"@@trigger":()=>({setup:f,teardown:l,fired:m})}}function se(e){return e.map((e=>!e),{skipVoid:!1})}function ue(e){var r,n;t.unit(e)?r=e:({source:r,reset:n}=e);var a=o(!0,{name:"$canTrigger",sid:"ys2jl0"}),c=i({and:[{source:r,filter:a}],or:{name:"trigger",sid:"e3xto3"}});return a.on(c,(()=>!1)),n&&a.reset(n),c}function de(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return e({and:[t,e=>{for(var r of e)if(r)return!0;return!1},{skipVoid:!1}],or:{sid:"-44722k"}})}var fe={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function le(r){var n=Array.isArray(r)?{effects:r}:r,{effects:o,domain:i,of:a="some"}=n;if(!t.domain(i,{sid:"98ymuf"})&&!o)throw new TypeError("domain or effects should be passed");if("some"!==a&&"every"!==a)throw new TypeError('strategy parameter "of" can be "every" or "some". Passed: "'.concat(a,'"'));var c=null!=o?o:[],s=fe[a];return i&&(c=[],i.onCreateEffect((e=>c.push(e)))),e({and:[c.map((e=>e.pending)),s,{skipVoid:!1}],or:{sid:"a4upb3"}})}function me(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var[i]=r,a=r.length<2?null:r[1];if(!t.store(i,{sid:"mzq5dc"}))throw Error("previous first argument should be a store");var c=o(a,{and:{serialize:"ignore",skipVoid:!1},name:"$prevValue",sid:"e05yob"}),s=i.graphite;return s.seq.push(d.compute({fn:(e,r,t)=>(m({target:c,params:t.a,defer:!0}),e)})),c}function pe(e){return t.targetable(e)?t.store(e,{sid:"-kqkmsc"})?e.map((e=>e),{skipVoid:!1}):t.event(e,{sid:"-kodgew"})?e.map((e=>e)):e:e}function ve(e){var{clock:t,target:n}=e,o=Array.isArray(n)?n:[n],i=Array.isArray(t)?t:[null!=t?t:r({name:"clocks",sid:"bqmea5"})];return o.forEach((e=>{e.reset(i)})),void 0===t?i[0]:void 0}function ge(e){var{source:r,shape:t}=e,n={},o=function(e){if(!Object.prototype.hasOwnProperty.call(t,e))return"continue";var o=t[e];n[e]=r.map((e=>{var r=o(e);return void 0===r?null:r}),{skipVoid:!1})};for(var i in t)o(i);return n}function ye(e){var{source:r,clock:t,fn:n=(e=>e)}=e,a=n(r.defaultState),c=i(t?{and:[{source:r,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-imuiws"}}:{and:[{source:r,fn:n}],or:{name:"onSnapshot",sid:"-imaqbf"}}),s=o(a,{name:"$snapshot",sid:"-63s6pn"});return s.on(c,((e,r)=>r)),s}function he(r,n){var o,i=[],a=()=>!1;Array.isArray(r)?(i=r,a=n):Array.isArray(r.stores)&&(i=r.stores,a=r.predicate),o="function"==typeof a?a:t.store(a,{sid:"zbwu0l"})?a.map((e=>r=>e===r),{skipVoid:!1}):e=>e===a;var c=e({and:[i],or:{name:"$values",sid:"-kx24vm"}});return e({and:[o,c,(e,r)=>r.some(e),{skipVoid:!1}],or:{sid:"-ee8kph"}})}function be(e){var{source:r,cases:n}=e,o={},i=t.store(r,{name:"current",sid:"-htjkz7"})?r.updates:r;for(var a in n)a in n&&function(){var e=n[a];o[a]=i.filterMap(e),i=i.filter({fn:r=>!e(r)})}();return o.__=i,o}var ke={}.hasOwnProperty;function we(e){var t=function(e){return!Object.keys(e).some((e=>["targets","source"].includes(e)))}(e)?{targets:e}:e,{targets:n,source:o=r({name:"source",sid:"-u92i8l"})}=t,a=function(e){if(t=n,a=e,ke.call(t,a)){var r=n[e];i({and:[{source:o,filter:r=>"object"==typeof r&&null!==r&&e in r,fn:r=>r[e],target:r,batch:!1}],or:{sid:"motx3n"}})}var t,a};for(var c in n)a(c);return o}function je(e){var{effect:r,defaultValue:n="initial"}=t.effect(e,{sid:"cn6w5b"})?{effect:e}:e,i=o(n,{name:"$status",sid:"ph7d4u"});if(!t.effect(r,{sid:"-kp39vu"}))throw TypeError('status: "effect" property is not an effect');return i.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),i}function Oe(){var e=2===arguments.length?{source:arguments.length<=0?void 0:arguments[0],timeout:arguments.length<=1?void 0:arguments[1]}:arguments.length<=0?void 0:arguments[0],{source:n,timeout:a,target:c=r({name:"target",sid:"-gyhb56"})}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");var s=Ee(a),u=l({name:"throttle(".concat(n.shortName||n.kind,") effect"),handler:e=>new Promise((r=>setTimeout(r,e)))},{name:"timerFx",sid:"-lp5bot"}),d=o(null,{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"w71tnu"}).on(n,((e,r)=>r)),f=r({name:"triggerTick",sid:"-dquigt"}),m=o(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"e2dxhp"}).on(f,(()=>!1)).on(c,(()=>!0));return i({and:[{clock:n,filter:m,target:f}],or:{sid:"-hifwv4"}}),i({and:[{source:s,clock:f,target:u}],or:{sid:"-h3lgud"}}),i({and:[{source:d,clock:u.done,target:c}],or:{sid:"-h0apa7"}}),c}function Ee(e){if(t.store(e,{sid:"-gj92sk"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error('timeout must be positive number or zero. Received: "'.concat(e,'"'));return o(e,{and:{name:"$timeout"},sid:"-2ktcsz"})}throw new TypeError('timeout parameter should be number or Store. "'.concat(typeof e,'" was passed'))}var Te=()=>Date.now();function Pe(e){var r=t.unit(e)?{clock:e}:e,{clock:n,getNow:o,initial:a}=r,c=null!=o?o:Te,s=l(c,{name:"readNowFx",sid:"ito90c"}),u=p(s,null!=a?a:c(),{name:"$time",sid:"-k3vl4d"});return i({and:[{clock:n,target:s}],or:{sid:"rul0o2"}}),u}export{v as and,h as combineEvents,k as condition,j as debounce,S as debug,X as delay,Z as either,ee as empty,re as equals,te as every,ne as format,ae as inFlight,ce as interval,se as not,ue as once,de as or,le as pending,me as previous,pe as readonly,ve as reset,ge as reshape,ye as snapshot,he as some,be as splitMap,we as spread,je as status,Oe as throttle,Pe as time};
//# sourceMappingURL=patronum.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.and=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(!t)return!1;return!0},{skipVoid:!1}],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function(e){const t=function(e){return Object.keys(e).some((t=>!["events","reset","target"].includes(t)&&r.default.is.unit(e[t])))}(e)?{events:e}:e,{events:o,reset:a,target:i=(0,r.default.createEvent)({name:"target",sid:"p73fff"})}=t;r.default.is.unit(i)&&r.default.is.targetable(i)||n("target should be a targetable unit");a&&!r.default.is.unit(a)&&n("reset should be a unit");return(0,r.default.withRegion)(i,(()=>{const e=Object.keys(o),t=Array.isArray(o)?[...e].fill(""):{},n=(0,r.default.createStore)(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-ahoahx"}),s=(0,r.default.createStore)(t,{and:{serialize:"ignore"},name:"$results",sid:"oy8iyn"});(0,r.default.sample)({and:[{source:i,target:n.reinit}],or:{sid:"blex0c"}}),s.reset(i),a&&((0,r.default.sample)({and:[{source:a,target:n.reinit}],or:{sid:"bnm3fi"}}),s.reset(a));for(const t of e){const e=(0,r.default.createStore)(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"-rf2fac"}).on(o[t],(()=>!0)).reset(i);a&&e.reset(a),n.on(e,(e=>e-1)),s.on(o[t],((e,n)=>{const r=Array.isArray(e)?[...e]:{...e};return r[t]=n,r}))}const u=(0,r.default.sample)({and:[{source:s,clock:[...Object.values(o)]}],or:{name:"eventsTrriggered",sid:"-lro8bq"}});(0,r.default.sample)({and:[{source:u,filter:n.map((e=>0===e),{skipVoid:!1}),target:i}],or:{sid:"-dlkr2s"}})})),i}})),s=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e),{skipVoid:!1}):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({if:e,then:t,else:o,source:a=(0,r.default.createEvent)({name:"source",sid:"tdyoa4"})}){const i=r.default.is.unit(e)||(s=e,"function"==typeof s)?e:t=>t===e;var s;t&&o?(0,r.default.split)({and:[{source:a,match:{then:i,else:n(i)},cases:{then:t,else:o}}],or:{sid:"aaw2hr"}}):t?(0,r.default.sample)({and:[{source:a,filter:i,target:t}],or:{sid:"-dwrmbb"}}):o&&(0,r.default.sample)({and:[{source:a,filter:n(i),target:o}],or:{sid:"-dsx25s"}});return a}})),u=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function(...e){var t;const n=2===e.length?{source:e[0],timeout:e[1]}:e[0],{source:o,timeout:a,target:i,name:s}=n;if(!r.default.is.unit(o))throw new TypeError("source must be unit from effector");if(r.default.is.domain(o,{sid:"jsc7s2"}))throw new TypeError("source cannot be domain");const u=function(e){if(r.default.is.store(e,{sid:"-21qm2b"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"kbepy4"})}throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(a),d=(0,r.default.createEvent)({name:"saveCancel",sid:"-kec0n3"}),c=(0,r.default.createStore)([],{and:{serialize:"ignore"},name:"$canceller",sid:"-tfm9fg"}).on(d,((e,t)=>t)),l=null!==(t=i)&&void 0!==t?t:(0,r.default.createEvent)({name:"tick",sid:"-50e2rn"}),f=(0,r.default.attach)({and:{name:s||`debounce(${o?.shortName||o.kind}) effect`,source:c,effect:([e,t],n)=>(e&&clearTimeout(e),t&&t(),new Promise(((e,t)=>{d([setTimeout(e,n),t])})))},or:{name:"timerFx",sid:"-jwso4j"}});c.reset(f.done);const m=(0,r.default.createStore)([],{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"-x9cllg"}).on(o,((e,t)=>[t])),p=(0,r.default.createStore)(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"8r2952"}),y=(0,r.default.createEvent)({name:"triggerTick",sid:"-781myl"});p.on(y,(()=>!1)).on([l,u,f],(()=>!0));const g=(0,r.default.merge)([o,(0,r.default.sample)({and:[{clock:u,filter:f.pending}],or:{name:"requestTick",sid:"-khrpxp"}})],{name:"requestTick",sid:"2k0852"});return(0,r.default.sample)({and:[{clock:g,filter:p,target:y}],or:{sid:"-31h8q8"}}),(0,r.default.sample)({and:[{source:u,clock:y,target:f}],or:{sid:"-2y6h62"}}),(0,r.default.sample)({and:[{source:m,clock:f.done,fn:([e])=>e,target:l}],or:{sid:"-2jc15b"}}),l}})),d=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debug=o;const n={trace:!1,handler:e=>{if(g(e.node)&&"finally"===e.node.meta.named)return;const{scope:t,scopeName:n,name:r,kind:o,value:a,loc:i,trace:s,node:u,logType:d}=e,c=t?` (scope: ${n})`:"",l=null!=r?r:i?`${i.file}:${i.line}:${i.column}`:"",f="initial"===d?" [getState]":"";console.info(`[${o}]${c} ${l}${f}`,a),s&&s.length>0&&!g(u)&&(console.groupCollapsed(`[${o}]${c} ${l} trace`),s.forEach((e=>{const{name:t,kind:n,value:r,loc:o}=e,a=null!=t?t:o?`${o.file}:${o.line}:${o.column}`:"";console.info(`<- [${n}] ${a}`,r)})),console.groupEnd())}};function o(...e){const{config:t,units:o}=function(...e){let t=n;const[o,...a]=e,i=[];if(function(e){if(!r.default.is.unit(e))return!Object.values(e).every(r.default.is.unit);return!1}(o))t={...n,...o};else if(r.default.is.unit(o))i.push(o);else for(const[e,t]of Object.entries(o))v.set(b(t).id,e),i.push(t);for(const e of a)if(r.default.is.unit(e))i.push(e);else for(const[t,n]of Object.entries(e))v.set(b(n).id,t),i.push(n);return{config:t,units:i}}(...e);o.forEach((e=>{r.default.is.store(e,{sid:"-foynff"})||r.default.is.event(e,{sid:"apy28p"})||r.default.is.effect(e,{sid:"apy3od"})?i(e,t):r.default.is.domain(e,{sid:"-rsqe9t"})&&a(e,t)}))}function a(e,t){e.onCreateStore((e=>i(e,t))),e.onCreateEvent((e=>i(e,t))),e.onCreateEffect((e=>i(e,t))),e.onCreateDomain((e=>a(e,t)))}function i(e,t){r.default.is.store(e,{sid:"w7ds2s"})?(!function(e,t){if(!t.handler)throw Error("patronum/debug must have the handler");const n={logType:"initial",scope:null,scopeName:null,node:_(e),kind:h(e),value:e.getState(),name:k(e),loc:j(e),trace:[],stackMeta:{}};t.handler(n),p.forEach((n=>d(e,t,n))),l((n=>d(e,t,n)))}(e,t),s(e,t)):r.default.is.event(e,{sid:"fretyd"})?s(e,t):r.default.is.effect(e,{sid:"gpi2qr"})&&(s(e,t),s(e.finally,t),s(e.done,t),s(e.fail,t))}function s(e,t){const n=(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(n,r,o){var a;const i=null!==(a=o?.scope)&&void 0!==a?a:null,s={logType:"update",scope:i,scopeName:y(i),node:_(e),kind:h(e),value:n,name:k(e),loc:j(e),stackMeta:$(o.parent),trace:t.trace?u(o):[]};if(!t.handler)throw Error("patronum/debug must have the handler");t.handler(s)}})]});return()=>(0,r.default.clearNode)(n)}function u(e){const t=[];let n=e?.parent;for(;n;){const{node:e,value:r}=n,o={node:e,value:r,name:k(e),loc:j(e),kind:h(e),stackMeta:$(n)};t.push(o),n=n.parent}return t}function d(e,t,n){if(!t.handler)throw Error("patronum/debug must have the handler");const r=_(e),o={logType:"initial",scope:n,scopeName:y(n),node:r,kind:h(e),value:n.getState(e),name:k(e),loc:j(e),trace:[],stackMeta:{}};t.handler(o)}const c=new Set,l=e=>(c.add(e),()=>{c.delete(e)});let f=0;const m=new Map,p={save(e,t){p.get(e)||m.set(e,t)},get(e){var t;return e&&null!==(t=m.get(e))&&void 0!==t?t:null},delete(e){m.delete(e)},forEach(e){m.forEach(((t,n)=>e(n,t)))},clear(){m.clear()}};function y(e){if(!e)return null;const t=p.get(e);if(!t){return e._debugId||(e._debugId=(f+=1,`unknown_${f}`))}return t.name}function g(e){const t=_(e),{sid:n,named:r}=t.meta;return Boolean(!n&&("finally"===r||"done"===r||"doneData"===r||"fail"===r||"failData"===r||"inFlight"===r||"pending"===r))}function h(e){if(r.default.is.store(e,{sid:"4o7s04"}))return"store";if(r.default.is.effect(e,{sid:"4pv5s7"})||g(e))return"effect";if(r.default.is.event(e,{sid:"4rijka"}))return"event";if(r.default.is.domain(e,{sid:"54plsy"}))return"domain";if(r.default.is.unit(e))return"unit";const t=_(e);return t.meta.op?t.meta.op:"unknown"}o.registerScope=function(e,t){return p.save(e,{name:t.name}),c.forEach((t=>t(e))),()=>{p.delete(e)}},o.unregisterAllScopes=function(){p.clear()};const b=e=>e.graphite||e,v=new Map;function k(e){const t=v.get(b(e).id);if(t)return t;if(g(e)){const t=_(e),n=t.family.owners.find((e=>"effect"===e.meta.op));if(n){const e=w(n);return`${e?`${e}/`:""}${k(n)}.${t.meta.named}`}return t.meta.named}if(function(e){const t=_(e),{op:n}=t.meta;return"on"===n}(e)){const t=_(e);return`${k(t.next[0])}.on(${k(t.family.owners[0])})`}if(r.default.is.unit(e)){if(e?.compositeName?.fullName)return e.compositeName.fullName;const t=w(e),n=t?`${t}/`:"";if(e?.shortName)return`${n}${e.shortName}`;if(e?.name)return`${n}${e.name}`}return _(e)?.meta?.name?_(e).meta.name:null}function w(e){const t=_(e).family.owners.find((e=>"domain"===e.meta.op));return t?k(t):null}function j(e){const t=function({meta:e}){return"config"in e?e.config.loc:e.loc}(_(e));if(t)return t}function _(e){return"graphite"in e?e.graphite:e}function $(e){if(!e)return{};return e.meta||{}}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function(...e){const t=2===e.length?{source:e[0],timeout:e[1]}:e[0],{source:n,timeout:o,target:a=(0,r.default.createEvent)({name:"target",sid:"jucb8d"})}=t,i=Array.isArray(a)?a:[a];if(!r.default.is.unit(n))throw new TypeError("source must be a unit from effector");if(!i.every((e=>r.default.is.unit(e))))throw new TypeError("target must be a unit from effector");const s=function(e){if(r.default.is.store(e,{sid:"-tvk3f2"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(o),u=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-wp3hwr"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:s}],or:{name:"source",sid:"-gaikyz"}}),clock:n,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:u}],or:{sid:"-uuqxfw"}}),(0,r.default.sample)({and:[{clock:u.doneData,target:i}],or:{sid:"-uc1x9m"}}),a}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.either=function e(t,n,o){if(r.default.is.store(t,{sid:"ozzvoc"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n,{skipVoid:!1}],or:{sid:"-5vau2h"}});const a=t;return e(a.filter,a.then,a.other)}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.empty=function(e){return e.map((e=>null==e),{skipVoid:!1})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function(e,t){return(0,r.default.combine)({and:[e,t,(e,t)=>e===t,{skipVoid:!1}],or:{sid:"-pqjlti"}})}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t),{skipVoid:!1}):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"rwb5jx"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.every(e),{skipVoid:!1}],or:{sid:"hgnz2z"}})}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),""),{skipVoid:!1}],or:{sid:"-yrbthp"}})}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function(e){const t=Array.isArray(e)?{effects:e}:e,{effects:n,domain:o}=t;if(o){const e=o.createStore(0,{name:"$inFlight",sid:"-wboyn1"});return o.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[n.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0),{skipVoid:!1}],or:{sid:"udy3nn"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"setup",sid:"-ajee8b"});t&&(0,r.default.sample)({and:[{clock:t,target:i}],or:{sid:"-wq30tc"}});const s=(0,r.default.createEvent)({name:"teardown",sid:"-on6wf8"});n&&(0,r.default.sample)({and:[{clock:n,target:s}],or:{sid:"-wloo2g"}});const u=(0,r.default.createEvent)({name:"tick",sid:"37avek"}),d=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"amqfro"}),c=function(e){if(r.default.is.store(e,{sid:"90rxd3"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-3ibdj9"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),l=d.map((e=>!e),{skipVoid:!1}),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"-goth3o"}),m=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"xi134t"}).on(f,((e,{timeoutId:t})=>t)),p=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"-2am6sk"}).on(f,((e,{reject:t})=>t)),y=(0,r.default.attach)({and:{source:{timeout:c,running:d},effect:({timeout:e,running:t})=>t?new Promise(((t,n)=>{const r=setTimeout(t,e);f({timeoutId:r,reject:n})})):Promise.reject()},or:{name:"timeoutFx",sid:"-hiem3q"}}),g=(0,r.default.attach)({and:{source:{timeoutId:m,rejecter:p},effect:({timeoutId:e,rejecter:t})=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"d148gq"}});if((0,r.default.sample)({and:[{clock:i,source:c,filter:l,target:y}],or:{sid:"-u9k5bx"}}),o){const e=(0,r.default.sample)({and:[{clock:i,filter:l}],or:{name:"onReady",sid:"5o8c6v"}});(0,r.default.sample)({and:[{clock:e,target:u}],or:{sid:"6njtce"}})}(0,r.default.sample)({and:[{clock:i,fn:()=>!0,target:d}],or:{sid:"6p772r"}}),(0,r.default.sample)({and:[{clock:y.done,source:c,filter:d,target:y}],or:{sid:"741n3i"}}),(0,r.default.sample)({and:[{clock:y.done,filter:d,target:u.prepend((()=>{}))}],or:{sid:"7jfvpm"}}),a&&(0,r.default.sample)({and:[{clock:s,target:u}],or:{sid:"7zxpk6"}});return d.on(s,(()=>!1)),(0,r.default.sample)({and:[{clock:s,target:g}],or:{sid:"84c29c"}}),{tick:u,isRunning:d,"@@trigger":()=>({setup:i,teardown:s,fired:u})}}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e),{skipVoid:!1})}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.once=function(e){let t,n;r.default.is.unit(e)?t=e:({source:t,reset:n}=e);const o=(0,r.default.createStore)(!0,{name:"$canTrigger",sid:"ys2jl0"}),a=(0,r.default.sample)({and:[{source:t,filter:o}],or:{name:"trigger",sid:"e3xto3"}});o.on(a,(()=>!1)),n&&o.reset(n);return a}})),k=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(t)return!0;return!1},{skipVoid:!1}],or:{sid:"-44722k"}})}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function(e){const t=Array.isArray(e)?{effects:e}:e,{effects:o,domain:a,of:i="some"}=t;if(!r.default.is.domain(a,{sid:"98ymuf"})&&!o)throw new TypeError("domain or effects should be passed");if("some"!==i&&"every"!==i)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${i}"`);let s=null!=o?o:[];const u=n[i];a&&(s=[],a.onCreateEffect((e=>s.push(e))));return(0,r.default.combine)({and:[s.map((e=>e.pending)),u,{skipVoid:!1}],or:{sid:"a4upb3"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.previous=function(...e){const[t]=e,n=e.length<2?null:e[1];if(!r.default.is.store(t,{sid:"mzq5dc"}))throw Error("previous first argument should be a store");const o=(0,r.default.createStore)(n,{and:{serialize:"ignore",skipVoid:!1},name:"$prevValue",sid:"e05yob"});return t.graphite.seq.push(r.default.step.compute({fn:(e,t,n)=>((0,r.default.launch)({target:o,params:n.a,defer:!0}),e)})),o}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.readonly=function(e){if(!r.default.is.targetable(e))return e;if(r.default.is.store(e,{sid:"-kqkmsc"}))return e.map((e=>e),{skipVoid:!1});if(r.default.is.event(e,{sid:"-kodgew"}))return e.map((e=>e));return e}})),$=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[null!=e?e:(0,r.default.createEvent)({name:"clocks",sid:"bqmea5"})];return n.forEach((e=>{e.reset(o)})),void 0===e?o[0]:void 0}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}),{skipVoid:!1})}return n}})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[{source:e,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-imuiws"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-imaqbf"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-63s6pn"});return i.on(a,((e,t)=>t)),i}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t),{skipVoid:!1}):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-kx24vm"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.some(e),{skipVoid:!1}],or:{sid:"-ee8kph"}})}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),S=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function(e){const t=function(e){return Object.keys(e).some((t=>!["targets","source"].includes(t)&&r.default.is.unit(e[t])))}(e)?{targets:e}:e,{targets:o,source:a=(0,r.default.createEvent)({name:"source",sid:"e9ipnn"})}=t;for(const e in o)if(i=o,s=e,n.call(i,s)){const t=o[e],n=(0,r.default.sample)({and:[{source:a,batch:!1,filter:t=>"object"==typeof t&&null!==t&&e in t}],or:{name:"hasTargetKey",sid:"eapc0z"}});(0,r.default.sample)({and:[{batch:!1,clock:n,fn:t=>t[e],target:t}],or:{sid:"mkzcy4"}})}var i,s;return a};const n={}.hasOwnProperty})),T=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function(e){const{effect:t,defaultValue:n="initial"}=r.default.is.effect(e,{sid:"cn6w5b"})?{effect:e}:e,o=(0,r.default.createStore)(n,{name:"$status",sid:"ph7d4u"});if(!r.default.is.effect(t,{sid:"-kp39vu"}))throw TypeError('status: "effect" property is not an effect');return o.on(t,(()=>"pending")).on(t.done,(()=>"done")).on(t.fail,(()=>"fail")),o}})),x=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function(...e){const t=2===e.length?{source:e[0],timeout:e[1]}:e[0],{source:n,timeout:o,target:a=(0,r.default.createEvent)({name:"target",sid:"-gyhb56"})}=t;if(!r.default.is.unit(n))throw new TypeError("source must be unit from effector");const i=function(e){if(r.default.is.store(e,{sid:"-gj92sk"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-2ktcsz"})}throw new TypeError(`timeout parameter should be number or Store. "${typeof e}" was passed`)}(o),s=(0,r.default.createEffect)({name:`throttle(${n.shortName||n.kind}) effect`,handler:e=>new Promise((t=>setTimeout(t,e)))},{name:"timerFx",sid:"-lp5bot"}),u=(0,r.default.createStore)(null,{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"w71tnu"}).on(n,((e,t)=>t)),d=(0,r.default.createEvent)({name:"triggerTick",sid:"-dquigt"}),c=(0,r.default.createStore)(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"e2dxhp"}).on(d,(()=>!1)).on(a,(()=>!0));return(0,r.default.sample)({and:[{clock:n,filter:c,target:d}],or:{sid:"-hifwv4"}}),(0,r.default.sample)({and:[{source:i,clock:d,target:s}],or:{sid:"-h3lgud"}}),(0,r.default.sample)({and:[{source:u,clock:s.done,target:a}],or:{sid:"-h0apa7"}}),a}})),q=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function(e){const t=r.default.is.unit(e)?{clock:e}:e,{clock:o,getNow:a,initial:i}=t,s=null!=a?a:n,u=(0,r.default.createEffect)(s,{name:"readNowFx",sid:"ito90c"}),d=(0,r.default.restore)(u,null!=i?i:s(),{name:"$time",sid:"-k3vl4d"});return(0,r.default.sample)({and:[{clock:o,target:u}],or:{sid:"rul0o2"}}),d};const n=()=>Date.now()})),A=a.and,z=i.combineEvents,V=s.condition,N=u.debounce,F=d.debug,C=c.delay,D=l.either,I=f.empty,R=m.equals,B=p.every,K=y.format,G=g.inFlight,H=h.interval,J=b.not,L=v.once,Q=k.or,U=w.pending,W=j.previous,X=_.readonly,Y=$.reset,Z=E.reshape,ee=M.snapshot,te=O.some,ne=P.splitMap,re=S.spread,oe=T.status,ae=x.throttle,ie=q.time,se={and:A,combineEvents:z,condition:V,debounce:N,debug:F,delay:C,either:D,empty:I,equals:R,every:B,format:K,inFlight:G,interval:H,not:J,once:L,or:Q,pending:U,previous:W,readonly:X,reset:Y,reshape:Z,snapshot:ee,some:te,splitMap:ne,spread:re,status:oe,throttle:ae,time:ie};e.and=A,e.combineEvents=z,e.condition=V,e.debounce=N,e.debug=F,e.default=se,e.delay=C,e.either=D,e.empty=I,e.equals=R,e.every=B,e.format=K,e.inFlight=G,e.interval=H,e.not=J,e.once=L,e.or=Q,e.pending=U,e.previous=W,e.readonly=X,e.reset=Y,e.reshape=Z,e.snapshot=ee,e.some=te,e.splitMap=ne,e.spread=re,e.status=oe,e.throttle=ae,e.time=ie,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.and=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(!t)return!1;return!0},{skipVoid:!1}],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function(e){const t=function(e){return Object.keys(e).some((t=>!["events","reset","target"].includes(t)&&r.default.is.unit(e[t])))}(e)?{events:e}:e,{events:o,reset:a,target:i=(0,r.default.createEvent)({name:"target",sid:"p73fff"})}=t;r.default.is.unit(i)&&r.default.is.targetable(i)||n("target should be a targetable unit");a&&!r.default.is.unit(a)&&n("reset should be a unit");return(0,r.default.withRegion)(i,(()=>{const e=Object.keys(o),t=Array.isArray(o)?[...e].fill(""):{},n=(0,r.default.createStore)(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-ahoahx"}),s=(0,r.default.createStore)(t,{and:{serialize:"ignore"},name:"$results",sid:"oy8iyn"});(0,r.default.sample)({and:[{source:i,target:n.reinit}],or:{sid:"blex0c"}}),s.reset(i),a&&((0,r.default.sample)({and:[{source:a,target:n.reinit}],or:{sid:"bnm3fi"}}),s.reset(a));for(const t of e){const e=(0,r.default.createStore)(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"-rf2fac"}).on(o[t],(()=>!0)).reset(i);a&&e.reset(a),n.on(e,(e=>e-1)),s.on(o[t],((e,n)=>{const r=Array.isArray(e)?[...e]:{...e};return r[t]=n,r}))}const u=(0,r.default.sample)({and:[{source:s,clock:[...Object.values(o)]}],or:{name:"eventsTrriggered",sid:"-lro8bq"}});(0,r.default.sample)({and:[{source:u,filter:n.map((e=>0===e),{skipVoid:!1}),target:i}],or:{sid:"-dlkr2s"}})})),i}})),s=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e),{skipVoid:!1}):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({source:e=(0,r.default.createEvent)({name:"source",sid:"rytt3j"}),if:t,then:o,else:a}){const i=r.default.is.unit(t)||(s=t,"function"==typeof s)?t:e=>e===t;var s;o&&a?(0,r.default.split)({and:[{source:e,match:{then:i,else:n(i)},cases:{then:o,else:a}}],or:{sid:"aaw2hr"}}):o?(0,r.default.sample)({and:[{source:e,filter:i,target:o}],or:{sid:"-dwrmbb"}}):a&&(0,r.default.sample)({and:[{source:e,filter:n(i),target:a}],or:{sid:"-dsx25s"}});return e}})),u=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function(...e){var t;const n=2===e.length?{source:e[0],timeout:e[1]}:e[0],{source:o,timeout:a,target:i,name:s}=n;if(!r.default.is.unit(o))throw new TypeError("source must be unit from effector");if(r.default.is.domain(o,{sid:"jsc7s2"}))throw new TypeError("source cannot be domain");const u=function(e){if(r.default.is.store(e,{sid:"-21qm2b"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"kbepy4"})}throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(a),d=(0,r.default.createEvent)({name:"saveCancel",sid:"-kec0n3"}),c=(0,r.default.createStore)([],{and:{serialize:"ignore"},name:"$canceller",sid:"-tfm9fg"}).on(d,((e,t)=>t)),l=null!==(t=i)&&void 0!==t?t:(0,r.default.createEvent)({name:"tick",sid:"-50e2rn"}),f=(0,r.default.attach)({and:{name:s||`debounce(${o?.shortName||o.kind}) effect`,source:c,effect:([e,t],n)=>(e&&clearTimeout(e),t&&t(),new Promise(((e,t)=>{d([setTimeout(e,n),t])})))},or:{name:"timerFx",sid:"-jwso4j"}});c.reset(f.done);const m=(0,r.default.createStore)([],{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"-x9cllg"}).on(o,((e,t)=>[t])),p=(0,r.default.createStore)(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"8r2952"}),y=(0,r.default.createEvent)({name:"triggerTick",sid:"-781myl"});p.on(y,(()=>!1)).on([l,u,f],(()=>!0));const g=(0,r.default.merge)([o,(0,r.default.sample)({and:[{clock:u,filter:f.pending}],or:{name:"requestTick",sid:"-khrpxp"}})],{name:"requestTick",sid:"2k0852"});return(0,r.default.sample)({and:[{clock:g,filter:p,target:y}],or:{sid:"-31h8q8"}}),(0,r.default.sample)({and:[{source:u,clock:y,target:f}],or:{sid:"-2y6h62"}}),(0,r.default.sample)({and:[{source:m,clock:f.done,fn:([e])=>e,target:l}],or:{sid:"-2jc15b"}}),l}})),d=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debug=o;const n={trace:!1,handler:e=>{if(g(e.node)&&"finally"===e.node.meta.named)return;const{scope:t,scopeName:n,name:r,kind:o,value:a,loc:i,trace:s,node:u,logType:d}=e,c=t?` (scope: ${n})`:"",l=null!=r?r:i?`${i.file}:${i.line}:${i.column}`:"",f="initial"===d?" [getState]":"";console.info(`[${o}]${c} ${l}${f}`,a),s&&s.length>0&&!g(u)&&(console.groupCollapsed(`[${o}]${c} ${l} trace`),s.forEach((e=>{const{name:t,kind:n,value:r,loc:o}=e,a=null!=t?t:o?`${o.file}:${o.line}:${o.column}`:"";console.info(`<- [${n}] ${a}`,r)})),console.groupEnd())}};function o(...e){const{config:t,units:o}=function(...e){let t=n;const[o,...a]=e,i=[];if(function(e){if(!r.default.is.unit(e))return!Object.values(e).every(r.default.is.unit);return!1}(o))t={...n,...o};else if(r.default.is.unit(o))i.push(o);else for(const[e,t]of Object.entries(o))v.set(b(t).id,e),i.push(t);for(const e of a)if(r.default.is.unit(e))i.push(e);else for(const[t,n]of Object.entries(e))v.set(b(n).id,t),i.push(n);return{config:t,units:i}}(...e);o.forEach((e=>{r.default.is.store(e,{sid:"-foynff"})||r.default.is.event(e,{sid:"apy28p"})||r.default.is.effect(e,{sid:"apy3od"})?i(e,t):r.default.is.domain(e,{sid:"-rsqe9t"})&&a(e,t)}))}function a(e,t){e.onCreateStore((e=>i(e,t))),e.onCreateEvent((e=>i(e,t))),e.onCreateEffect((e=>i(e,t))),e.onCreateDomain((e=>a(e,t)))}function i(e,t){r.default.is.store(e,{sid:"w7ds2s"})?(!function(e,t){if(!t.handler)throw Error("patronum/debug must have the handler");const n={logType:"initial",scope:null,scopeName:null,node:_(e),kind:h(e),value:e.getState(),name:k(e),loc:j(e),trace:[],stackMeta:{}};t.handler(n),p.forEach((n=>d(e,t,n))),l((n=>d(e,t,n)))}(e,t),s(e,t)):r.default.is.event(e,{sid:"fretyd"})?s(e,t):r.default.is.effect(e,{sid:"gpi2qr"})&&(s(e,t),s(e.finally,t),s(e.done,t),s(e.fail,t))}function s(e,t){const n=(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(n,r,o){var a;const i=null!==(a=o?.scope)&&void 0!==a?a:null,s={logType:"update",scope:i,scopeName:y(i),node:_(e),kind:h(e),value:n,name:k(e),loc:j(e),stackMeta:$(o.parent),trace:t.trace?u(o):[]};if(!t.handler)throw Error("patronum/debug must have the handler");t.handler(s)}})]});return()=>(0,r.default.clearNode)(n)}function u(e){const t=[];let n=e?.parent;for(;n;){const{node:e,value:r}=n,o={node:e,value:r,name:k(e),loc:j(e),kind:h(e),stackMeta:$(n)};t.push(o),n=n.parent}return t}function d(e,t,n){if(!t.handler)throw Error("patronum/debug must have the handler");const r=_(e),o={logType:"initial",scope:n,scopeName:y(n),node:r,kind:h(e),value:n.getState(e),name:k(e),loc:j(e),trace:[],stackMeta:{}};t.handler(o)}const c=new Set,l=e=>(c.add(e),()=>{c.delete(e)});let f=0;const m=new Map,p={save(e,t){p.get(e)||m.set(e,t)},get(e){var t;return e&&null!==(t=m.get(e))&&void 0!==t?t:null},delete(e){m.delete(e)},forEach(e){m.forEach(((t,n)=>e(n,t)))},clear(){m.clear()}};function y(e){if(!e)return null;const t=p.get(e);if(!t){return e._debugId||(e._debugId=(f+=1,`unknown_${f}`))}return t.name}function g(e){const t=_(e),{sid:n,named:r}=t.meta;return Boolean(!n&&("finally"===r||"done"===r||"doneData"===r||"fail"===r||"failData"===r||"inFlight"===r||"pending"===r))}function h(e){if(r.default.is.store(e,{sid:"4o7s04"}))return"store";if(r.default.is.effect(e,{sid:"4pv5s7"})||g(e))return"effect";if(r.default.is.event(e,{sid:"4rijka"}))return"event";if(r.default.is.domain(e,{sid:"54plsy"}))return"domain";if(r.default.is.unit(e))return"unit";const t=_(e);return t.meta.op?t.meta.op:"unknown"}o.registerScope=function(e,t){return p.save(e,{name:t.name}),c.forEach((t=>t(e))),()=>{p.delete(e)}},o.unregisterAllScopes=function(){p.clear()};const b=e=>e.graphite||e,v=new Map;function k(e){const t=v.get(b(e).id);if(t)return t;if(g(e)){const t=_(e),n=t.family.owners.find((e=>"effect"===e.meta.op));if(n){const e=w(n);return`${e?`${e}/`:""}${k(n)}.${t.meta.named}`}return t.meta.named}if(function(e){const t=_(e),{op:n}=t.meta;return"on"===n}(e)){const t=_(e);return`${k(t.next[0])}.on(${k(t.family.owners[0])})`}if(r.default.is.unit(e)){if(e?.compositeName?.fullName)return e.compositeName.fullName;const t=w(e),n=t?`${t}/`:"";if(e?.shortName)return`${n}${e.shortName}`;if(e?.name)return`${n}${e.name}`}return _(e)?.meta?.name?_(e).meta.name:null}function w(e){const t=_(e).family.owners.find((e=>"domain"===e.meta.op));return t?k(t):null}function j(e){const t=function({meta:e}){return"config"in e?e.config.loc:e.loc}(_(e));if(t)return t}function _(e){return"graphite"in e?e.graphite:e}function $(e){if(!e)return{};return e.meta||{}}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function(...e){const t=2===e.length?{source:e[0],timeout:e[1]}:e[0],{source:n,timeout:o,target:a=(0,r.default.createEvent)({name:"target",sid:"jucb8d"})}=t,i=Array.isArray(a)?a:[a];if(!r.default.is.unit(n))throw new TypeError("source must be a unit from effector");if(!i.every((e=>r.default.is.unit(e))))throw new TypeError("target must be a unit from effector");const s=function(e){if(r.default.is.store(e,{sid:"-tvk3f2"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(o),u=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-wp3hwr"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:s}],or:{name:"source",sid:"-gaikyz"}}),clock:n,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:u}],or:{sid:"-uuqxfw"}}),(0,r.default.sample)({and:[{clock:u.doneData,target:i}],or:{sid:"-uc1x9m"}}),a}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.either=function e(t,n,o){if(r.default.is.store(t,{sid:"ozzvoc"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n,{skipVoid:!1}],or:{sid:"-5vau2h"}});const a=t;return e(a.filter,a.then,a.other)}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.empty=function(e){return e.map((e=>null==e),{skipVoid:!1})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function(e,t){return(0,r.default.combine)({and:[e,t,(e,t)=>e===t,{skipVoid:!1}],or:{sid:"-pqjlti"}})}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t),{skipVoid:!1}):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"rwb5jx"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.every(e),{skipVoid:!1}],or:{sid:"hgnz2z"}})}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),""),{skipVoid:!1}],or:{sid:"-yrbthp"}})}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function(e){const t=Array.isArray(e)?{effects:e}:e,{effects:n,domain:o}=t;if(o){const e=o.createStore(0,{name:"$inFlight",sid:"-wboyn1"});return o.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[n.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0),{skipVoid:!1}],or:{sid:"udy3nn"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"setup",sid:"-ajee8b"});t&&(0,r.default.sample)({and:[{clock:t,target:i}],or:{sid:"-wq30tc"}});const s=(0,r.default.createEvent)({name:"teardown",sid:"-on6wf8"});n&&(0,r.default.sample)({and:[{clock:n,target:s}],or:{sid:"-wloo2g"}});const u=(0,r.default.createEvent)({name:"tick",sid:"37avek"}),d=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"amqfro"}),c=function(e){if(r.default.is.store(e,{sid:"90rxd3"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-3ibdj9"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),l=d.map((e=>!e),{skipVoid:!1}),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"-goth3o"}),m=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"xi134t"}).on(f,((e,{timeoutId:t})=>t)),p=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"-2am6sk"}).on(f,((e,{reject:t})=>t)),y=(0,r.default.attach)({and:{source:{timeout:c,running:d},effect:({timeout:e,running:t})=>t?new Promise(((t,n)=>{const r=setTimeout(t,e);f({timeoutId:r,reject:n})})):Promise.reject()},or:{name:"timeoutFx",sid:"-hiem3q"}}),g=(0,r.default.attach)({and:{source:{timeoutId:m,rejecter:p},effect:({timeoutId:e,rejecter:t})=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"d148gq"}});if((0,r.default.sample)({and:[{clock:i,source:c,filter:l,target:y}],or:{sid:"-u9k5bx"}}),o){const e=(0,r.default.sample)({and:[{clock:i,filter:l}],or:{name:"onReady",sid:"5o8c6v"}});(0,r.default.sample)({and:[{clock:e,target:u}],or:{sid:"6njtce"}})}(0,r.default.sample)({and:[{clock:i,fn:()=>!0,target:d}],or:{sid:"6p772r"}}),(0,r.default.sample)({and:[{clock:y.done,source:c,filter:d,target:y}],or:{sid:"741n3i"}}),(0,r.default.sample)({and:[{clock:y.done,filter:d,target:u.prepend((()=>{}))}],or:{sid:"7jfvpm"}}),a&&(0,r.default.sample)({and:[{clock:s,target:u}],or:{sid:"7zxpk6"}});return d.on(s,(()=>!1)),(0,r.default.sample)({and:[{clock:s,target:g}],or:{sid:"84c29c"}}),{tick:u,isRunning:d,"@@trigger":()=>({setup:i,teardown:s,fired:u})}}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e),{skipVoid:!1})}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.once=function(e){let t,n;r.default.is.unit(e)?t=e:({source:t,reset:n}=e);const o=(0,r.default.createStore)(!0,{name:"$canTrigger",sid:"ys2jl0"}),a=(0,r.default.sample)({and:[{source:t,filter:o}],or:{name:"trigger",sid:"e3xto3"}});o.on(a,(()=>!1)),n&&o.reset(n);return a}})),k=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>{for(const t of e)if(t)return!0;return!1},{skipVoid:!1}],or:{sid:"-44722k"}})}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function(e){const t=Array.isArray(e)?{effects:e}:e,{effects:o,domain:a,of:i="some"}=t;if(!r.default.is.domain(a,{sid:"98ymuf"})&&!o)throw new TypeError("domain or effects should be passed");if("some"!==i&&"every"!==i)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${i}"`);let s=null!=o?o:[];const u=n[i];a&&(s=[],a.onCreateEffect((e=>s.push(e))));return(0,r.default.combine)({and:[s.map((e=>e.pending)),u,{skipVoid:!1}],or:{sid:"a4upb3"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.previous=function(...e){const[t]=e,n=e.length<2?null:e[1];if(!r.default.is.store(t,{sid:"mzq5dc"}))throw Error("previous first argument should be a store");const o=(0,r.default.createStore)(n,{and:{serialize:"ignore",skipVoid:!1},name:"$prevValue",sid:"e05yob"});return t.graphite.seq.push(r.default.step.compute({fn:(e,t,n)=>((0,r.default.launch)({target:o,params:n.a,defer:!0}),e)})),o}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.readonly=function(e){if(!r.default.is.targetable(e))return e;if(r.default.is.store(e,{sid:"-kqkmsc"}))return e.map((e=>e),{skipVoid:!1});if(r.default.is.event(e,{sid:"-kodgew"}))return e.map((e=>e));return e}})),$=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[null!=e?e:(0,r.default.createEvent)({name:"clocks",sid:"bqmea5"})];return n.forEach((e=>{e.reset(o)})),void 0===e?o[0]:void 0}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}),{skipVoid:!1})}return n}})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[{source:e,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-imuiws"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-imaqbf"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-63s6pn"});return i.on(a,((e,t)=>t)),i}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t),{skipVoid:!1}):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-kx24vm"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.some(e),{skipVoid:!1}],or:{sid:"-ee8kph"}})}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),S=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function(e){const t=function(e){return!Object.keys(e).some((e=>["targets","source"].includes(e)))}(e)?{targets:e}:e,{targets:o,source:a=(0,r.default.createEvent)({name:"source",sid:"-u92i8l"})}=t;for(const e in o)if(i=o,s=e,n.call(i,s)){const t=o[e];(0,r.default.sample)({and:[{source:a,filter:t=>"object"==typeof t&&null!==t&&e in t,fn:t=>t[e],target:t,batch:!1}],or:{sid:"motx3n"}})}var i,s;return a};const n={}.hasOwnProperty})),T=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function(e){const{effect:t,defaultValue:n="initial"}=r.default.is.effect(e,{sid:"cn6w5b"})?{effect:e}:e,o=(0,r.default.createStore)(n,{name:"$status",sid:"ph7d4u"});if(!r.default.is.effect(t,{sid:"-kp39vu"}))throw TypeError('status: "effect" property is not an effect');return o.on(t,(()=>"pending")).on(t.done,(()=>"done")).on(t.fail,(()=>"fail")),o}})),x=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function(...e){const t=2===e.length?{source:e[0],timeout:e[1]}:e[0],{source:n,timeout:o,target:a=(0,r.default.createEvent)({name:"target",sid:"-gyhb56"})}=t;if(!r.default.is.unit(n))throw new TypeError("source must be unit from effector");const i=function(e){if(r.default.is.store(e,{sid:"-gj92sk"}))return e;if("number"==typeof e){if(e<0||!Number.isFinite(e))throw new Error(`timeout must be positive number or zero. Received: "${e}"`);return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"-2ktcsz"})}throw new TypeError(`timeout parameter should be number or Store. "${typeof e}" was passed`)}(o),s=(0,r.default.createEffect)({name:`throttle(${n.shortName||n.kind}) effect`,handler:e=>new Promise((t=>setTimeout(t,e)))},{name:"timerFx",sid:"-lp5bot"}),u=(0,r.default.createStore)(null,{and:{serialize:"ignore",skipVoid:!1},name:"$payload",sid:"w71tnu"}).on(n,((e,t)=>t)),d=(0,r.default.createEvent)({name:"triggerTick",sid:"-dquigt"}),c=(0,r.default.createStore)(!0,{and:{serialize:"ignore"},name:"$canTick",sid:"e2dxhp"}).on(d,(()=>!1)).on(a,(()=>!0));return(0,r.default.sample)({and:[{clock:n,filter:c,target:d}],or:{sid:"-hifwv4"}}),(0,r.default.sample)({and:[{source:i,clock:d,target:s}],or:{sid:"-h3lgud"}}),(0,r.default.sample)({and:[{source:u,clock:s.done,target:a}],or:{sid:"-h0apa7"}}),a}})),q=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function(e){const t=r.default.is.unit(e)?{clock:e}:e,{clock:o,getNow:a,initial:i}=t,s=null!=a?a:n,u=(0,r.default.createEffect)(s,{name:"readNowFx",sid:"ito90c"}),d=(0,r.default.restore)(u,null!=i?i:s(),{name:"$time",sid:"-k3vl4d"});return(0,r.default.sample)({and:[{clock:o,target:u}],or:{sid:"rul0o2"}}),d};const n=()=>Date.now()})),A=a.and,V=i.combineEvents,z=s.condition,N=u.debounce,F=d.debug,C=c.delay,D=l.either,I=f.empty,R=m.equals,B=p.every,G=y.format,H=g.inFlight,J=h.interval,K=b.not,L=v.once,Q=k.or,U=w.pending,W=j.previous,X=_.readonly,Y=$.reset,Z=E.reshape,ee=M.snapshot,te=O.some,ne=P.splitMap,re=S.spread,oe=T.status,ae=x.throttle,ie=q.time,se={and:A,combineEvents:V,condition:z,debounce:N,debug:F,delay:C,either:D,empty:I,equals:R,every:B,format:G,inFlight:H,interval:J,not:K,once:L,or:Q,pending:U,previous:W,readonly:X,reset:Y,reshape:Z,snapshot:ee,some:te,splitMap:ne,spread:re,status:oe,throttle:ae,time:ie};e.and=A,e.combineEvents=V,e.condition=z,e.debounce=N,e.debug=F,e.default=se,e.delay=C,e.either=D,e.empty=I,e.equals=R,e.every=B,e.format=G,e.inFlight=H,e.interval=J,e.not=K,e.once=L,e.or=Q,e.pending=U,e.previous=W,e.readonly=X,e.reset=Y,e.reshape=Z,e.snapshot=ee,e.some=te,e.splitMap=ne,e.spread=re,e.status=oe,e.throttle=ae,e.time=ie,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=patronum.umd.js.map
# <img src="logo.svg" title="effector patronum" alt="Effector Patronum logo" width="640px">
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ![Node.js CI](https://github.com/effector/patronum/workflows/Node.js%20CI/badge.svg) [![Rate on Openbase](https://badges.openbase.com/js/rating/patronum.svg)](https://openbase.com/js/patronum?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ![Node.js CI](https://github.com/effector/patronum/workflows/Node.js%20CI/badge.svg)
[![LICENSE](https://badgen.net/github/license/effector/patronum?color=green)](/LICENSE)

@@ -19,3 +19,3 @@ [![Stars](https://badgen.net/github/stars/effector/patronum?color=green)](https://github.com/effector/patronum)

[jsdelivr]: https://www.jsdelivr.com/package/npm/patronum
[unpkg]: https://unpkg.com/browse/patronum@1.7.0/
[unpkg]: https://unpkg.com/browse/patronum@2/
[npm]: https://www.npmjs.com/package/patronum

@@ -48,3 +48,3 @@ [github]: https://github.com/effector/patronum

You can read more at [documentation](https://patronum.effector.dev/docs/installation).
You can read more at [documentation](https://patronum.effector.dev/guides/installation/).

@@ -55,3 +55,3 @@ ## Migration guide

We have [migration guide](https://patronum.effector.dev/docs/migration-guide).
We have [migration guide](https://patronum.effector.dev/guides/migration).

@@ -58,0 +58,0 @@ # Development

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

import type { Event, Unit, StoreWritable } from 'effector';
import type { EventCallable, Unit, StoreWritable } from 'effector';
type Params = {

@@ -7,3 +7,3 @@ clock?: Unit<any> | Array<Unit<any>>;

export declare function reset(config: Required<Params>): void;
export declare function reset(config: Pick<Params, 'target'>): Event<void>;
export declare function reset(config: Pick<Params, 'target'>): EventCallable<void>;
export {};

@@ -1,17 +0,34 @@

import { EventCallable, Unit, UnitTargetable } from 'effector';
type NoInfer<T> = [T][T extends any ? 0 : never];
import { EventCallable, Tuple, Unit, UnitTargetable } from 'effector';
type TargetUnits<T> = UnitTargetable<T | void> | Tuple<UnitTargetable<T | void>> | ReadonlyArray<UnitTargetable<T | void>>;
/**
* @example
* spread({
* source: dataObject,
* targets: { first: targetA, second: [target1, target2] },
* })
*
* sample({
* source: dataObject,
* target: spread({ targets: { first: targetA, second: [target1, target2] } })
* })
*
* sample({
* source: dataObject,
* target: spread({ first: targetA, second: [target1, target2] })
* })
*/
export declare function spread<Payload>(config: {
targets: {
[Key in keyof Payload]?: UnitTargetable<Payload[Key]>;
[Key in keyof Payload]?: TargetUnits<Payload[Key]>;
};
}): EventCallable<Partial<Payload>>;
export declare function spread<Source, Payload extends Source extends Unit<infer S> ? S : never>(config: {
export declare function spread<Source, Payload extends Source extends Unit<infer S> ? S : never, Targets extends {
[Key in keyof Payload]?: Targets[Key] extends TargetUnits<infer TargetType> ? Payload[Key] extends TargetType ? TargetUnits<TargetType> : TargetUnits<Payload[Key]> : TargetUnits<Payload[Key]>;
}>(config: {
source: Source;
targets: {
[Key in keyof Payload]?: EventCallable<Partial<Payload[Key]>> | UnitTargetable<NoInfer<Payload[Key]>>;
};
targets: Targets;
}): Source;
export declare function spread<Payload>(targets: {
[Key in keyof Payload]?: UnitTargetable<Payload[Key]>;
[Key in keyof Payload]?: TargetUnits<Payload[Key]>;
}): EventCallable<Partial<Payload>>;
export {};

@@ -1,11 +0,23 @@

import { createEvent, is, sample } from 'effector';
import { createEvent, sample } from 'effector';
var hasPropBase = {}.hasOwnProperty;
var hasOwnProp = (object, key) => hasPropBase.call(object, key);
/**
* @example
* spread({ source: dataObject, targets: { first: targetA, second: targetB } })
* spread({
* source: dataObject,
* targets: { first: targetA, second: [target1, target2] },
* })
*
* sample({
* target: spread({targets: { first: targetA, second: targetB } })
* source: dataObject,
* target: spread({ targets: { first: targetA, second: [target1, target2] } })
* })
*
* sample({
* source: dataObject,
* target: spread({ first: targetA, second: [target1, target2] })
* })
*/
export function spread(args) {

@@ -19,3 +31,3 @@ var argsShape = isTargets(args) ? {

name: "source",
sid: "e9ipnn"
sid: "-u92i8l"
})

@@ -26,22 +38,14 @@ } = argsShape;

var currentTarget = targets[targetKey];
var hasTargetKey = sample({
sample({
and: [{
source,
batch: false,
filter: object => typeof object === 'object' && object !== null && targetKey in object
}],
or: {
name: "hasTargetKey",
sid: "eapc0z"
}
});
sample({
and: [{
batch: false,
clock: hasTargetKey,
filter: object => {
return typeof object === 'object' && object !== null && targetKey in object;
},
fn: object => object[targetKey],
target: currentTarget
target: currentTarget,
batch: false
}],
or: {
sid: "mkzcy4"
sid: "motx3n"
}

@@ -57,3 +61,3 @@ });

function isTargets(args) {
return Object.keys(args).some(key => !['targets', 'source'].includes(key) && is.unit(args[key]));
return !Object.keys(args).some(key => ['targets', 'source'].includes(key));
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc