Comparing version 1.12.2 to 1.12.3
@@ -15,3 +15,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
return either(filterOptions); | ||
var objectForm = filterOptions; | ||
return either(objectForm.filter, objectForm.then, objectForm.other); | ||
} |
{ | ||
"name": "patronum", | ||
"version": "1.12.2", | ||
"version": "1.12.3", | ||
"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 a,guard as i,merge as c,split as s,createEffect as u,attach as d,forward as f,createNode as m,step as l,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}],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 in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){var{events:s,reset:u,target:d=r({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=e;return t.unit(d)||w("target should be a unit"),u&&!t.unit(u)&&w("reset should be a unit"),n(d,(()=>{var e=Object.keys(s),r=Array.isArray(s)?[...e].fill(""):{},t=o(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),n=o(r,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});t.reset(a({and:[{source:d}],or:{sid:"-8yzcn6"}})),n.reset(d),u&&(t.reset(a({and:[{source:u}],or:{sid:"-72suil"}})),n.reset(u));var f=function(e){var r=o(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"ucs7nc"}).on(s[e],(()=>!0)).reset(d);u&&r.reset(u),t.on(r,(e=>e-1)),n.on(s[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 m of e)f(m);i({and:[{source:a({and:[{source:n,clock:c(Object.values(s),{name:"clock",sid:"-5k316x"})}],or:{name:"source",sid:"uf92v9"}}),filter:t.map((e=>0===e)),target:d}],or:{sid:"ciekm0"}})})),d}function w(e){throw new Error(e)}function b(e){var{if:n,then:o,else:a,source:c=r({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=e,u=t.unit(n)||"function"==typeof n?n:e=>e===n;return o&&a?s({and:[{source:c,match:{then:u,else:j(u)},cases:{then:o,else:a}}],or:{sid:"9tug3k"}}):o?i({and:[{source:c,filter:u,target:o}],or:{sid:"abznoh"}}):a&&i({and:[{source:c,filter:j(u),target:a}],or:{sid:"-eb29qp"}}),c}function j(e){return t.unit(e)?e.map((e=>!e)):r=>!e(r)}function k(e){var{source:n,timeout:i,target:c}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");if(t.domain(n,{sid:"jne2ft"}))throw new TypeError("source cannot be domain");var s=function(e){if(t.store(e,{sid:"-2xmoh9"}))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:"-757cx6"})}throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(i),m=r({name:"saveTimeoutId",sid:"eqtrwk"}),l=o(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-5hlcyp"}).on(m,((e,r)=>r)),p=r({name:"saveReject",sid:"-m6vk0"}),v=o(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"tqvf32"}).on(p,((e,r)=>r)),g=null!=c?c:r({name:"tick",sid:"-6wklwe"}),y=u((e=>{var{parameter:r,timeout:t,timeoutId:n,rejectPromise:o}=e;return n&&clearTimeout(n),o&&o(),new Promise(((e,n)=>{p(n),m(setTimeout(e,t,r))}))}),{name:"timerBaseFx",sid:"-xd98qa"}),h=d({and:{source:{timeoutId:l,rejectPromise:v},mapParams:(e,r)=>{var{parameter:t,timeout:n}=e,{timeoutId:o,rejectPromise:a}=r;return{parameter:t,timeout:n,timeoutId:o,rejectPromise:a}},effect:y},or:{name:"timerFx",sid:"-4ab544"}});return v.reset(h.done),l.reset(h.done),a({and:[{source:s,clock:n,fn:(e,r)=>({timeout:e,parameter:r}),target:h}],or:{sid:"m29k3f"}}),f({and:{from:h.done.map((e=>{var{result:r}=e;return r})),to:g},or:{sid:"-32ktwy"}}),g}function E(e){return!t.unit(e)&&!Object.values(e).every(t.unit)}function z(){for(var e={trace:!1},r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var[a,...i]=n;if(E(a))e=a;else if(t.unit(a))N(a);else for(var[c,s]of Object.entries(a))x.set(D(s).id,c),N(s,e);for(var u of i)if(t.unit(u))N(u,e);else for(var[d,f]of Object.entries(u))x.set(D(f).id,d),N(f,e)}function O(e){return t.store(e,{sid:"-h7y2t9"})?"store":t.effect(e,{sid:"-h6ap16"})?"effect":t.event(e,{sid:"-h4nb93"})?"event":t.domain(e,{sid:"-grg90f"})?"domain":t.unit(e)?"unit":"unknown"}var A=[];function P(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=n+S(e);t.store(e,{sid:"-g609vc"})&&(q({type:r,name:o,value:e.getState()}),B.forEach(((t,n)=>{q({type:r,name:o,scopeName:n.name,value:t.getState(e)})})),A.push(e)),m({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(e,t,n){if(n.scope){B.get(n.scope)||B.save(n.scope);var a=B.get(n.scope);q({type:r,name:o,scopeName:null==a?void 0:a.name,value:e})}else q({type:r,name:o,value:e})}})]})}function T(e){P(e.done,"effect",S(e)+"."),P(e.fail,"effect",S(e)+".")}var x=new Map;function S(e){var r=x.get(D(e).id);return r||(e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:"")}function $(e){var r,t=function(e){var{meta:r}=e;return"config"in r?r.config.loc:r.loc}(e);return t?"".concat(null!==(r=t.file)&&void 0!==r?r:"",":").concat(t.line,":").concat(t.column):null}function N(e,r){var n=O(e);(t.store(e,{sid:"zfed9z"})||t.effect(e,{sid:"wsoi2z"})||t.event(e,{sid:"wsojji"}))&&(P(e,n),null!=r&&r.trace&&I(e)),t.effect(e,{sid:"-zhbby9"})&&T(e),t.domain(e,{sid:"-p5meu5"})&&(e.onCreateEvent((e=>{P(e,"event"),null!=r&&r.trace&&I(e)})),e.onCreateStore((e=>{P(e,"store"),null!=r&&r.trace&&I(e)})),e.onCreateEffect((e=>{P(e,"effect"),T(e),null!=r&&r.trace&&I(e)})))}function F(e){if(!e)return"";var{meta:r,id:t}=e,n=x.get(t);if(n)return n;if(!function(e){var r=function(e){return"graphite"in e?e.graphite:e}(e),{sid:t,named:n}=r.meta;return Boolean(!t&&("finally"===n||"done"===n||"doneData"===n||"fail"===n||"failData"===n||"inFlight"===n||"pending"===n))}(e))return r.name;var o=e.family.owners.find((e=>"effect"===e.meta.op));return o?"".concat(F(o),".").concat(r.named):r.named}function I(e){var r=O(e),t=S(e);m({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(e,n,o){var a=null==o?void 0:o.parent,i=B.get(null==o?void 0:o.scope),c=i?" (scope: ".concat(i.name,")"):"",s="[".concat(r,"]").concat(c," ").concat(t," trace");for(console.groupCollapsed(s);a;){var u,{node:d,value:f}=a,{meta:m}=d,l=m.op,p=F(d);if(!p)p=null!==(u=$(d))&&void 0!==u?u:"";if("on"===l){var v,g=F(d.next[0]);l="".concat(g,".").concat(m.op),p="".concat(g,".").concat(m.op,"(").concat(F(null===(v=a.parent)||void 0===v?void 0:v.node),")")}console.info("<- [".concat(l,"] ").concat(p),f),a=a.parent}console.groupEnd()}})]})}function q(e){var{type:r,scopeName:t,name:n,value:o}=e,a="[".concat(r,"]"),i=t?" (scope: ".concat(t,")"):"",c=" ".concat(n);console.info("".concat(a).concat(i).concat(c),o)}z.registerScope=function(e,r){return B.save(e,{name:r.name}),A.forEach((t=>{q({type:"store",name:S(t),scopeName:r.name,value:e.getState(t)})})),()=>{B.delete(e)}},z.unregisterAllScopes=function(){B.clear()};var D=e=>e.graphite||e,C=new Map,R=0;var B={save(e,r){B.get(e)||C.set(e,null!=r?r:{name:"unknown_scope_".concat(R+=1)})},get(e){var r;return e&&null!==(r=C.get(e))&&void 0!==r?r:null},delete(e){C.delete(e)},forEach(e){C.forEach(((r,t)=>e(t,r)))},clear(){C.clear()}};function _(n){var{source:o,timeout:i,target:c=r({name:"target",sid:"-z2vw3w"},{name:"target",sid:"-z2vw3w"})}=n;if(!t.unit(o))throw new TypeError("source must be a unit from effector");if(!t.unit(c))throw new TypeError("target must be a unit from effector");var s=function(e){if(t.store(e,{sid:"-va560a"})||"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,'"'))}(i),d=u((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-584o7j"});return a({and:[{source:e({and:[{milliseconds:s}],or:{name:"source",sid:"9rbdjo"}}),clock:o,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:d}],or:{sid:"-wmj29s"}}),f({and:{from:d.doneData,to:c},or:{sid:"-vsadmx"}}),c}function M(r,n,o){return t.store(r,{sid:"ozzvoc"})?e({and:[r,n,o,(e,r,t)=>e?r:t],or:{sid:"-5vau2h"}}):M(r)}function K(e){return e.map((e=>null===e))}function V(r,t){return e({and:[r,t,(e,r)=>e===r],or:{sid:"-pqjlti"}})}function G(r,n){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=n):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:t.store(i,{sid:"sid3ut"})?i.map((e=>r=>e===r)):e=>e===i;var c=e({and:[a],or:{name:"$values",sid:"h09uhg"}});return e({and:[o,c,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}function H(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(L(r,o)?n:"".concat(n).concat(J(e[o])))),"")],or:{sid:"-yrbthp"}})}function J(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function L(e,r){return r===e.length-1}function Q(r){var{effects:t,domain:n}=r;if(n){var o=n.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return n.onCreateEffect((e=>{o.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),o}return e({and:[t.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0)],or:{sid:"ubqxa7"}})}function U(e){var{timeout:n,start:c,stop:s,leading:u=!1,trailing:f=!1}=e,m=r({name:"tick",sid:"u782pl"}),l=o(!1,{name:"$isRunning",sid:"-xegewf"}),p=function(e){if(t.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(n),v=l.map((e=>!e)),g=r({name:"saveTimeout",sid:"ab3q7d"}),y=o(null,{name:"$timeoutId",sid:"-aj5rja"}).on(g,((e,r)=>{var{timeoutId:t}=r;return t})),h=o((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(g,((e,r)=>{var{reject:t}=r;return t})),w=d({and:{source:{timeout:p,running:l},effect:e=>{var{timeout:r,running:t}=e;return t?new Promise(((e,t)=>{var n=setTimeout(e,r);g({timeoutId:n,reject:t})})):Promise.reject()}},or:{name:"timeoutFx",sid:"9hil7b"}}),b=d({and:{source:{timeoutId:y,rejecter:h},effect:e=>{var{timeoutId:r,rejecter:t}=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if(i({and:[{clock:c,source:p,filter:v,target:w}],or:{sid:"-vop0ii"}}),u){var j=i({and:[{clock:c,filter:v}],or:{name:"onReady",sid:"-cmw7lh"}});a({and:[{clock:j,target:m}],or:{sid:"-v876ny"}})}return a({and:[{clock:c,fn:()=>!0,target:l}],or:{sid:"-v6jsxl"}}),i({and:[{clock:w.done,source:p,filter:l,target:w}],or:{sid:"-urpcwu"}}),i({and:[{clock:w.done,filter:l,target:m.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),s&&(f&&a({and:[{clock:s,target:m}],or:{sid:"6lcn0o"}}),l.on(s,(()=>!1)),a({and:[{clock:s,target:b}],or:{sid:"71ao6f"}})),{tick:m,isRunning:l}}function W(e){return e.map((e=>!e))}function X(){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}],or:{sid:"-44722k"}})}var Y={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function Z(r){var{effects:n,domain:o,of:a="some"}=r;if(!t.domain(o,{sid:"97b92c"})&&!n)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 i=null!=n?n:[],c=Y[a];return o&&(i=[],o.onCreateEffect((e=>i.push(e)))),e({and:[i.map((e=>e.pending)),c],or:{sid:"a37bj0"}})}function ee(e){var{clock:r,target:t}=e,n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];n.forEach((e=>{e.reset(o)}))}function re(e){var{source:r,shape:t}=e,n={};for(var o in t)o in t&&function(){var e=t[o];n[o]=r.map((r=>{var t=e(r);return void 0===t?null:t}))}();return n}function te(e){var{source:r,clock:t,fn:n=(e=>e)}=e,i=n(r.defaultState),c=a(t?{and:[{source:r,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-auitd0"}}:{and:[{source:r,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),s=o(i,{name:"$snapshot",sid:"-7zyoaf"});return s.on(c,((e,r)=>r)),s}function ne(r,n){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=n):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:t.store(i,{sid:"zbwu0l"})?i.map((e=>r=>e===r)):e=>e===i;var c=e({and:[a],or:{name:"$values",sid:"-lv5do0"}});return e({and:[o,c,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}function oe(e){var{source:r,cases:n}=e,o={},a=t.store(r,{name:"current",sid:"-htjkz7"})?r.updates:r;for(var i in n)i in n&&function(){var e=n[i];o[i]=a.filterMap(e),a=a.filter({fn:r=>!e(r)})}();return o.__=a,o}var ae={}.hasOwnProperty;function ie(e){var{targets:t,source:n=r({name:"source",sid:"-fkbi3c"},{name:"source",sid:"-fkbi3c"})}=e,o=function(e){if(c=t,s=e,ae.call(c,s)){var r=t[e],o=i({and:[{source:n,greedy:!0,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-cov4g4"}});a({and:[{greedy:!0,clock:o,fn:r=>r[e],target:r}],or:{sid:"lpn34j"}})}var c,s};for(var c in t)o(c);return n}function ce(e){var{effect:r,defaultValue:t="initial"}=e,n=o(t,{name:"$status",sid:"abrgim"});return n.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),n}function se(e){var{source:n,timeout:c,target:s=r({name:"target",sid:"r328r6"},{name:"target",sid:"r328r6"})}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");var d=function(e){if(t.store(e,{sid:"-hl6vqh"}))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:"pu8pon"})}throw new TypeError('timeout parameter should be number or Store. "'.concat(typeof e,'" was passed'))}(c),f=u((e=>new Promise((r=>setTimeout(r,e)))),{name:"timerFx",sid:"-pyjx8k"}),m=i({and:[{clock:n,filter:f.pending.map((e=>!e))}],or:{name:"start",sid:"-p67kgr"}});return a({and:[{source:d,clock:m,target:f}],or:{sid:"-ievrvf"}}),a({and:[{source:n,clock:f.done,target:s}],or:{sid:"-i01buo"}}),s}var ue=()=>Date.now();function de(e){var{clock:r,getNow:t,initial:n}=e,o=null!=t?t:ue,a=u(o,{name:"readNowFx",sid:"459ysb"}),i=p(a,null!=n?n:o(),{name:"$time",sid:"-ys9vce"});return f({and:{from:r,to:a},or:{sid:"rdje9v"}}),i}export{v as and,h as combineEvents,b as condition,k as debounce,z as debug,_ as delay,M as either,K as empty,V as equals,G as every,H as format,Q as inFlight,U as interval,W as not,X as or,Z as pending,ee as reset,re as reshape,te as snapshot,ne as some,oe as splitMap,ie as spread,ce as status,se as throttle,de as time}; | ||
import{combine as e,createEvent as r,is as t,withRegion as n,createStore as o,sample as a,guard as i,merge as c,split as s,createEffect as u,attach as d,forward as f,createNode as m,step as l,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}],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 in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e){var{events:s,reset:u,target:d=r({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=e;return t.unit(d)||w("target should be a unit"),u&&!t.unit(u)&&w("reset should be a unit"),n(d,(()=>{var e=Object.keys(s),r=Array.isArray(s)?[...e].fill(""):{},t=o(e.length,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),n=o(r,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});t.reset(a({and:[{source:d}],or:{sid:"-8yzcn6"}})),n.reset(d),u&&(t.reset(a({and:[{source:u}],or:{sid:"-72suil"}})),n.reset(u));var f=function(e){var r=o(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"ucs7nc"}).on(s[e],(()=>!0)).reset(d);u&&r.reset(u),t.on(r,(e=>e-1)),n.on(s[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 m of e)f(m);i({and:[{source:a({and:[{source:n,clock:c(Object.values(s),{name:"clock",sid:"-5k316x"})}],or:{name:"source",sid:"uf92v9"}}),filter:t.map((e=>0===e)),target:d}],or:{sid:"ciekm0"}})})),d}function w(e){throw new Error(e)}function b(e){var{if:n,then:o,else:a,source:c=r({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=e,u=t.unit(n)||"function"==typeof n?n:e=>e===n;return o&&a?s({and:[{source:c,match:{then:u,else:j(u)},cases:{then:o,else:a}}],or:{sid:"9tug3k"}}):o?i({and:[{source:c,filter:u,target:o}],or:{sid:"abznoh"}}):a&&i({and:[{source:c,filter:j(u),target:a}],or:{sid:"-eb29qp"}}),c}function j(e){return t.unit(e)?e.map((e=>!e)):r=>!e(r)}function k(e){var{source:n,timeout:i,target:c}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");if(t.domain(n,{sid:"jne2ft"}))throw new TypeError("source cannot be domain");var s=function(e){if(t.store(e,{sid:"-2xmoh9"}))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:"-757cx6"})}throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(i),m=r({name:"saveTimeoutId",sid:"eqtrwk"}),l=o(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-5hlcyp"}).on(m,((e,r)=>r)),p=r({name:"saveReject",sid:"-m6vk0"}),v=o(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"tqvf32"}).on(p,((e,r)=>r)),g=null!=c?c:r({name:"tick",sid:"-6wklwe"}),y=u((e=>{var{parameter:r,timeout:t,timeoutId:n,rejectPromise:o}=e;return n&&clearTimeout(n),o&&o(),new Promise(((e,n)=>{p(n),m(setTimeout(e,t,r))}))}),{name:"timerBaseFx",sid:"-xd98qa"}),h=d({and:{source:{timeoutId:l,rejectPromise:v},mapParams:(e,r)=>{var{parameter:t,timeout:n}=e,{timeoutId:o,rejectPromise:a}=r;return{parameter:t,timeout:n,timeoutId:o,rejectPromise:a}},effect:y},or:{name:"timerFx",sid:"-4ab544"}});return v.reset(h.done),l.reset(h.done),a({and:[{source:s,clock:n,fn:(e,r)=>({timeout:e,parameter:r}),target:h}],or:{sid:"m29k3f"}}),f({and:{from:h.done.map((e=>{var{result:r}=e;return r})),to:g},or:{sid:"-32ktwy"}}),g}function E(e){return!t.unit(e)&&!Object.values(e).every(t.unit)}function z(){for(var e={trace:!1},r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var[a,...i]=n;if(E(a))e=a;else if(t.unit(a))N(a);else for(var[c,s]of Object.entries(a))x.set(D(s).id,c),N(s,e);for(var u of i)if(t.unit(u))N(u,e);else for(var[d,f]of Object.entries(u))x.set(D(f).id,d),N(f,e)}function O(e){return t.store(e,{sid:"-h7y2t9"})?"store":t.effect(e,{sid:"-h6ap16"})?"effect":t.event(e,{sid:"-h4nb93"})?"event":t.domain(e,{sid:"-grg90f"})?"domain":t.unit(e)?"unit":"unknown"}var A=[];function P(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=n+S(e);t.store(e,{sid:"-g609vc"})&&(q({type:r,name:o,value:e.getState()}),B.forEach(((t,n)=>{q({type:r,name:o,scopeName:n.name,value:t.getState(e)})})),A.push(e)),m({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(e,t,n){if(n.scope){B.get(n.scope)||B.save(n.scope);var a=B.get(n.scope);q({type:r,name:o,scopeName:null==a?void 0:a.name,value:e})}else q({type:r,name:o,value:e})}})]})}function T(e){P(e.done,"effect",S(e)+"."),P(e.fail,"effect",S(e)+".")}var x=new Map;function S(e){var r=x.get(D(e).id);return r||(e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:"")}function $(e){var r,t=function(e){var{meta:r}=e;return"config"in r?r.config.loc:r.loc}(e);return t?"".concat(null!==(r=t.file)&&void 0!==r?r:"",":").concat(t.line,":").concat(t.column):null}function N(e,r){var n=O(e);(t.store(e,{sid:"zfed9z"})||t.effect(e,{sid:"wsoi2z"})||t.event(e,{sid:"wsojji"}))&&(P(e,n),null!=r&&r.trace&&I(e)),t.effect(e,{sid:"-zhbby9"})&&T(e),t.domain(e,{sid:"-p5meu5"})&&(e.onCreateEvent((e=>{P(e,"event"),null!=r&&r.trace&&I(e)})),e.onCreateStore((e=>{P(e,"store"),null!=r&&r.trace&&I(e)})),e.onCreateEffect((e=>{P(e,"effect"),T(e),null!=r&&r.trace&&I(e)})))}function F(e){if(!e)return"";var{meta:r,id:t}=e,n=x.get(t);if(n)return n;if(!function(e){var r=function(e){return"graphite"in e?e.graphite:e}(e),{sid:t,named:n}=r.meta;return Boolean(!t&&("finally"===n||"done"===n||"doneData"===n||"fail"===n||"failData"===n||"inFlight"===n||"pending"===n))}(e))return r.name;var o=e.family.owners.find((e=>"effect"===e.meta.op));return o?"".concat(F(o),".").concat(r.named):r.named}function I(e){var r=O(e),t=S(e);m({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[l.run({fn(e,n,o){var a=null==o?void 0:o.parent,i=B.get(null==o?void 0:o.scope),c=i?" (scope: ".concat(i.name,")"):"",s="[".concat(r,"]").concat(c," ").concat(t," trace");for(console.groupCollapsed(s);a;){var u,{node:d,value:f}=a,{meta:m}=d,l=m.op,p=F(d);if(!p)p=null!==(u=$(d))&&void 0!==u?u:"";if("on"===l){var v,g=F(d.next[0]);l="".concat(g,".").concat(m.op),p="".concat(g,".").concat(m.op,"(").concat(F(null===(v=a.parent)||void 0===v?void 0:v.node),")")}console.info("<- [".concat(l,"] ").concat(p),f),a=a.parent}console.groupEnd()}})]})}function q(e){var{type:r,scopeName:t,name:n,value:o}=e,a="[".concat(r,"]"),i=t?" (scope: ".concat(t,")"):"",c=" ".concat(n);console.info("".concat(a).concat(i).concat(c),o)}z.registerScope=function(e,r){return B.save(e,{name:r.name}),A.forEach((t=>{q({type:"store",name:S(t),scopeName:r.name,value:e.getState(t)})})),()=>{B.delete(e)}},z.unregisterAllScopes=function(){B.clear()};var D=e=>e.graphite||e,C=new Map,R=0;var B={save(e,r){B.get(e)||C.set(e,null!=r?r:{name:"unknown_scope_".concat(R+=1)})},get(e){var r;return e&&null!==(r=C.get(e))&&void 0!==r?r:null},delete(e){C.delete(e)},forEach(e){C.forEach(((r,t)=>e(t,r)))},clear(){C.clear()}};function _(n){var{source:o,timeout:i,target:c=r({name:"target",sid:"-z2vw3w"},{name:"target",sid:"-z2vw3w"})}=n;if(!t.unit(o))throw new TypeError("source must be a unit from effector");if(!t.unit(c))throw new TypeError("target must be a unit from effector");var s=function(e){if(t.store(e,{sid:"-va560a"})||"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,'"'))}(i),d=u((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-584o7j"});return a({and:[{source:e({and:[{milliseconds:s}],or:{name:"source",sid:"9rbdjo"}}),clock:o,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:d}],or:{sid:"-wmj29s"}}),f({and:{from:d.doneData,to:c},or:{sid:"-vsadmx"}}),c}function M(r,n,o){if(t.store(r,{sid:"ozzvoc"}))return e({and:[r,n,o,(e,r,t)=>e?r:t],or:{sid:"-5vau2h"}});var a=r;return M(a.filter,a.then,a.other)}function K(e){return e.map((e=>null===e))}function V(r,t){return e({and:[r,t,(e,r)=>e===r],or:{sid:"-pqjlti"}})}function G(r,n){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=n):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:t.store(i,{sid:"sid3ut"})?i.map((e=>r=>e===r)):e=>e===i;var c=e({and:[a],or:{name:"$values",sid:"h09uhg"}});return e({and:[o,c,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}function H(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(L(r,o)?n:"".concat(n).concat(J(e[o])))),"")],or:{sid:"-yrbthp"}})}function J(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function L(e,r){return r===e.length-1}function Q(r){var{effects:t,domain:n}=r;if(n){var o=n.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return n.onCreateEffect((e=>{o.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),o}return e({and:[t.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0)],or:{sid:"ubqxa7"}})}function U(e){var{timeout:n,start:c,stop:s,leading:u=!1,trailing:f=!1}=e,m=r({name:"tick",sid:"u782pl"}),l=o(!1,{name:"$isRunning",sid:"-xegewf"}),p=function(e){if(t.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return o(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(n),v=l.map((e=>!e)),g=r({name:"saveTimeout",sid:"ab3q7d"}),y=o(null,{name:"$timeoutId",sid:"-aj5rja"}).on(g,((e,r)=>{var{timeoutId:t}=r;return t})),h=o((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(g,((e,r)=>{var{reject:t}=r;return t})),w=d({and:{source:{timeout:p,running:l},effect:e=>{var{timeout:r,running:t}=e;return t?new Promise(((e,t)=>{var n=setTimeout(e,r);g({timeoutId:n,reject:t})})):Promise.reject()}},or:{name:"timeoutFx",sid:"9hil7b"}}),b=d({and:{source:{timeoutId:y,rejecter:h},effect:e=>{var{timeoutId:r,rejecter:t}=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if(i({and:[{clock:c,source:p,filter:v,target:w}],or:{sid:"-vop0ii"}}),u){var j=i({and:[{clock:c,filter:v}],or:{name:"onReady",sid:"-cmw7lh"}});a({and:[{clock:j,target:m}],or:{sid:"-v876ny"}})}return a({and:[{clock:c,fn:()=>!0,target:l}],or:{sid:"-v6jsxl"}}),i({and:[{clock:w.done,source:p,filter:l,target:w}],or:{sid:"-urpcwu"}}),i({and:[{clock:w.done,filter:l,target:m.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),s&&(f&&a({and:[{clock:s,target:m}],or:{sid:"6lcn0o"}}),l.on(s,(()=>!1)),a({and:[{clock:s,target:b}],or:{sid:"71ao6f"}})),{tick:m,isRunning:l}}function W(e){return e.map((e=>!e))}function X(){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}],or:{sid:"-44722k"}})}var Y={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};function Z(r){var{effects:n,domain:o,of:a="some"}=r;if(!t.domain(o,{sid:"97b92c"})&&!n)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 i=null!=n?n:[],c=Y[a];return o&&(i=[],o.onCreateEffect((e=>i.push(e)))),e({and:[i.map((e=>e.pending)),c],or:{sid:"a37bj0"}})}function ee(e){var{clock:r,target:t}=e,n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];n.forEach((e=>{e.reset(o)}))}function re(e){var{source:r,shape:t}=e,n={};for(var o in t)o in t&&function(){var e=t[o];n[o]=r.map((r=>{var t=e(r);return void 0===t?null:t}))}();return n}function te(e){var{source:r,clock:t,fn:n=(e=>e)}=e,i=n(r.defaultState),c=a(t?{and:[{source:r,clock:t,fn:n}],or:{name:"onSnapshot",sid:"-auitd0"}}:{and:[{source:r,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),s=o(i,{name:"$snapshot",sid:"-7zyoaf"});return s.on(c,((e,r)=>r)),s}function ne(r,n){var o,a=[],i=()=>!1;Array.isArray(r)?(a=r,i=n):Array.isArray(r.stores)&&(a=r.stores,i=r.predicate),o="function"==typeof i?i:t.store(i,{sid:"zbwu0l"})?i.map((e=>r=>e===r)):e=>e===i;var c=e({and:[a],or:{name:"$values",sid:"-lv5do0"}});return e({and:[o,c,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}function oe(e){var{source:r,cases:n}=e,o={},a=t.store(r,{name:"current",sid:"-htjkz7"})?r.updates:r;for(var i in n)i in n&&function(){var e=n[i];o[i]=a.filterMap(e),a=a.filter({fn:r=>!e(r)})}();return o.__=a,o}var ae={}.hasOwnProperty;function ie(e){var{targets:t,source:n=r({name:"source",sid:"-fkbi3c"},{name:"source",sid:"-fkbi3c"})}=e,o=function(e){if(c=t,s=e,ae.call(c,s)){var r=t[e],o=i({and:[{source:n,greedy:!0,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-cov4g4"}});a({and:[{greedy:!0,clock:o,fn:r=>r[e],target:r}],or:{sid:"lpn34j"}})}var c,s};for(var c in t)o(c);return n}function ce(e){var{effect:r,defaultValue:t="initial"}=e,n=o(t,{name:"$status",sid:"abrgim"});return n.on(r,(()=>"pending")).on(r.done,(()=>"done")).on(r.fail,(()=>"fail")),n}function se(e){var{source:n,timeout:c,target:s=r({name:"target",sid:"r328r6"},{name:"target",sid:"r328r6"})}=e;if(!t.unit(n))throw new TypeError("source must be unit from effector");var d=function(e){if(t.store(e,{sid:"-hl6vqh"}))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:"pu8pon"})}throw new TypeError('timeout parameter should be number or Store. "'.concat(typeof e,'" was passed'))}(c),f=u((e=>new Promise((r=>setTimeout(r,e)))),{name:"timerFx",sid:"-pyjx8k"}),m=i({and:[{clock:n,filter:f.pending.map((e=>!e))}],or:{name:"start",sid:"-p67kgr"}});return a({and:[{source:d,clock:m,target:f}],or:{sid:"-ievrvf"}}),a({and:[{source:n,clock:f.done,target:s}],or:{sid:"-i01buo"}}),s}var ue=()=>Date.now();function de(e){var{clock:r,getNow:t,initial:n}=e,o=null!=t?t:ue,a=u(o,{name:"readNowFx",sid:"459ysb"}),i=p(a,null!=n?n:o(),{name:"$time",sid:"-ys9vce"});return f({and:{from:r,to:a},or:{sid:"rdje9v"}}),i}export{v as and,h as combineEvents,b as condition,k as debounce,z as debug,_ as delay,M as either,K as empty,V as equals,G as every,H as format,Q as inFlight,U as interval,W as not,X as or,Z as pending,ee as reset,re as reshape,te as snapshot,ne as some,oe as splitMap,ie as spread,ce as status,se as throttle,de 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}],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[{source:o}],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[{source:t}],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),u.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[{source:u,clock:(0,r.default.merge)(Object.values(e),{name:"clock",sid:"-5k316x"})}],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),u=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):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:"epke23"})}){const i=r.default.is.unit(e)||(u=e,"function"==typeof u)?e:t=>t===e;var u;t&&o?(0,r.default.split)({and:[{source:a,match:{then:i,else:n(i)},cases:{then:t,else:o}}],or:{sid:"9tug3k"}}):t?(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"abznoh"}}):o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"-eb29qp"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"jne2ft"}))throw new TypeError("source cannot be domain");const o=function(e){if(r.default.is.store(e,{sid:"-2xmoh9"}))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:"-757cx6"})}throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEvent)({name:"saveTimeoutId",sid:"eqtrwk"}),i=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-5hlcyp"}).on(a,((e,t)=>t)),u=(0,r.default.createEvent)({name:"saveReject",sid:"-m6vk0"}),s=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"tqvf32"}).on(u,((e,t)=>t)),d=null!=n?n:(0,r.default.createEvent)({name:"tick",sid:"-6wklwe"}),c=(0,r.default.createEffect)((({parameter:e,timeout:t,timeoutId:n,rejectPromise:r})=>(n&&clearTimeout(n),r&&r(),new Promise(((n,r)=>{u(r),a(setTimeout(n,t,e))})))),{name:"timerBaseFx",sid:"-xd98qa"}),f=(0,r.default.attach)({and:{source:{timeoutId:i,rejectPromise:s},mapParams:({parameter:e,timeout:t},{timeoutId:n,rejectPromise:r})=>({parameter:e,timeout:t,timeoutId:n,rejectPromise:r}),effect:c},or:{name:"timerFx",sid:"-4ab544"}});return s.reset(f.done),i.reset(f.done),(0,r.default.sample)({and:[{source:o,clock:e,fn:(e,t)=>({timeout:e,parameter:t}),target:f}],or:{sid:"m29k3f"}}),(0,r.default.forward)({and:{from:f.done.map((({result:e})=>e)),to:d},or:{sid:"-32ktwy"}}),d}})),d=o((function(e,t){function n(...e){let t={trace:!1};const[n,...o]=e;if(function(e){return!r.default.is.unit(e)&&!Object.values(e).every(r.default.is.unit)}(n))t=n;else if(r.default.is.unit(n))f(n);else for(const[e,r]of Object.entries(n))s.set(y(r).id,e),f(r,t);for(const e of o)if(r.default.is.unit(e))f(e,t);else for(const[n,r]of Object.entries(e))s.set(y(r).id,n),f(r,t)}function o(e){return r.default.is.store(e,{sid:"-h7y2t9"})?"store":r.default.is.effect(e,{sid:"-h6ap16"})?"effect":r.default.is.event(e,{sid:"-h4nb93"})?"event":r.default.is.domain(e,{sid:"-grg90f"})?"domain":r.default.is.unit(e)?"unit":"unknown"}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=n;const a=[];function i(e,t,n=""){const o=n+d(e);r.default.is.store(e,{sid:"-g609vc"})&&(p({type:t,name:o,value:e.getState()}),b.forEach(((n,r)=>{p({type:t,name:o,scopeName:r.name,value:n.getState(e)})})),a.push(e)),(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(e,n,r){if(r.scope){b.get(r.scope)||b.save(r.scope);const n=b.get(r.scope);p({type:t,name:o,scopeName:n?.name,value:e})}else p({type:t,name:o,value:e})}})]})}function u(e){i(e.done,"effect",d(e)+"."),i(e.fail,"effect",d(e)+".")}const s=new Map;function d(e){const t=s.get(y(e).id);return t||(e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:"")}function c(e){var t;const n=function({meta:e}){return"config"in e?e.config.loc:e.loc}(e);return n?`${null!==(t=n.file)&&void 0!==t?t:""}:${n.line}:${n.column}`:null}function f(e,t){const n=o(e);(r.default.is.store(e,{sid:"zfed9z"})||r.default.is.effect(e,{sid:"wsoi2z"})||r.default.is.event(e,{sid:"wsojji"}))&&(i(e,n),t?.trace&&m(e)),r.default.is.effect(e,{sid:"-zhbby9"})&&u(e),r.default.is.domain(e,{sid:"-p5meu5"})&&(e.onCreateEvent((e=>{i(e,"event"),t?.trace&&m(e)})),e.onCreateStore((e=>{i(e,"store"),t?.trace&&m(e)})),e.onCreateEffect((e=>{i(e,"effect"),u(e),t?.trace&&m(e)})))}function l(e){if(!e)return"";const{meta:t,id:n}=e,r=s.get(n);if(r)return r;if(!function(e){const t=function(e){return"graphite"in e?e.graphite:e}(e),{sid:n,named:r}=t.meta;return Boolean(!n&&("finally"===r||"done"===r||"doneData"===r||"fail"===r||"failData"===r||"inFlight"===r||"pending"===r))}(e))return t.name;const o=e.family.owners.find((e=>"effect"===e.meta.op));return o?`${l(o)}.${t.named}`:t.named}function m(e){const t=o(e),n=d(e);(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(e,r,o){let a=o?.parent;const i=b.get(o?.scope),u=i?` (scope: ${i.name})`:"",s=`[${t}]${u} ${n} trace`;for(console.groupCollapsed(s);a;){const{node:e,value:t}=a,{meta:n}=e;let r=n.op,o=l(e);var d;if(!o)o=null!==(d=c(e))&&void 0!==d?d:"";if("on"===r){const t=l(e.next[0]);r=`${t}.${n.op}`,o=`${t}.${n.op}(${l(a.parent?.node)})`}console.info(`<- [${r}] ${o}`,t),a=a.parent}console.groupEnd()}})]})}function p({type:e,scopeName:t,name:n,value:r}){const o=`[${e}]`,a=t?` (scope: ${t})`:"",i=` ${n}`;console.info(`${o}${a}${i}`,r)}n.registerScope=function(e,t){return b.save(e,{name:t.name}),a.forEach((n=>{p({type:"store",name:d(n),scopeName:t.name,value:e.getState(n)})})),()=>{b.delete(e)}},n.unregisterAllScopes=function(){b.clear()};const y=e=>e.graphite||e,v=new Map;let g=0;const b={save(e,t){b.get(e)||v.set(e,null!=t?t:{name:(g+=1,`unknown_scope_${g}`)})},get(e){var t;return e&&null!==(t=v.get(e))&&void 0!==t?t:null},delete(e){v.delete(e)},forEach(e){v.forEach(((t,n)=>e(n,t)))},clear(){v.clear()}}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),f=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],or:{sid:"-5vau2h"}});return e(t)}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.empty=function(e){return e.map((e=>null===e))}})),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],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)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),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])}`)),"")],or:{sid:"-yrbthp"}})}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),g=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:"tick",sid:"u782pl"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-xegewf"}),s=function(e){if(r.default.is.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),c=(0,r.default.createEvent)({name:"saveTimeout",sid:"ab3q7d"}),f=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-aj5rja"}).on(c,((e,{timeoutId:t})=>t)),l=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(c,((e,{reject:t})=>t)),m=(0,r.default.attach)({and:{source:{timeout:s,running:u},effect:({timeout:e,running:t})=>t?new Promise(((t,n)=>{const r=setTimeout(t,e);c({timeoutId:r,reject:n})})):Promise.reject()},or:{name:"timeoutFx",sid:"9hil7b"}}),p=(0,r.default.attach)({and:{source:{timeoutId:f,rejecter:l},effect:({timeoutId:e,rejecter:t})=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if((0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:m}],or:{sid:"-vop0ii"}}),o){const e=(0,r.default.guard)({and:[{clock:t,filter:d}],or:{name:"onReady",sid:"-cmw7lh"}});(0,r.default.sample)({and:[{clock:e,target:i}],or:{sid:"-v876ny"}})}(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-v6jsxl"}}),(0,r.default.guard)({and:[{clock:m.done,source:s,filter:u,target:m}],or:{sid:"-urpcwu"}}),(0,r.default.guard)({and:[{clock:m.done,filter:u,target:i.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"6lcn0o"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:p}],or:{sid:"71ao6f"}}));return{tick:i,isRunning:u}}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e))}})),h=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}],or:{sid:"-44722k"}})}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=null!=e?e:[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset(r)}))}})),_=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(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),$=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:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),k=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)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),E=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}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-fkbi3c"})}){for(const i in e)if(o=e,a=i,n.call(o,a)){const n=e[i],o=(0,r.default.guard)({and:[{source:t,greedy:!0,filter:e=>"object"==typeof e&&null!==e&&i in e}],or:{name:"hasTargetKey",sid:"-cov4g4"}});(0,r.default.sample)({and:[{greedy:!0,clock:o,fn:e=>e[i],target:n}],or:{sid:"lpn34j"}})}var o,a;return t};const n={}.hasOwnProperty})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"r328r6"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-hl6vqh"}))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:"pu8pon"})}throw new TypeError(`timeout parameter should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEffect)((e=>new Promise((t=>setTimeout(t,e)))),{name:"timerFx",sid:"-pyjx8k"}),i=(0,r.default.guard)({and:[{clock:e,filter:a.pending.map((e=>!e))}],or:{name:"start",sid:"-p67kgr"}});return(0,r.default.sample)({and:[{source:o,clock:i,target:a}],or:{sid:"-ievrvf"}}),(0,r.default.sample)({and:[{source:e,clock:a.done,target:n}],or:{sid:"-i01buo"}}),n}})),S=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=null!=t?t:n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,null!=o?o:a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),u};const n=()=>Date.now()})),x=a.and,z=i.combineEvents,T=u.condition,A=s.debounce,q=d.debug,N=c.delay,F=f.either,I=l.empty,R=m.equals,C=p.every,D=y.format,B=v.inFlight,K=g.interval,V=b.not,G=h.or,H=w.pending,J=j.reset,L=_.reshape,Q=$.snapshot,U=k.some,W=E.splitMap,X=P.spread,Y=M.status,Z=O.throttle,ee=S.time,te={and:x,combineEvents:z,condition:T,debounce:A,debug:q,delay:N,either:F,empty:I,equals:R,every:C,format:D,inFlight:B,interval:K,not:V,or:G,pending:H,reset:J,reshape:L,snapshot:Q,some:U,splitMap:W,spread:X,status:Y,throttle:Z,time:ee};e.and=x,e.combineEvents=z,e.condition=T,e.debounce=A,e.debug=q,e.default=te,e.delay=N,e.either=F,e.empty=I,e.equals=R,e.every=C,e.format=D,e.inFlight=B,e.interval=K,e.not=V,e.or=G,e.pending=H,e.reset=J,e.reshape=L,e.snapshot=Q,e.some=U,e.splitMap=W,e.spread=X,e.status=Y,e.throttle=Z,e.time=ee,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}],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{and:{serialize:"ignore"},name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{and:{serialize:"ignore"},name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[{source:o}],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[{source:t}],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{and:{serialize:"ignore"},name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),u.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[{source:u,clock:(0,r.default.merge)(Object.values(e),{name:"clock",sid:"-5k316x"})}],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),u=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):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:"epke23"})}){const i=r.default.is.unit(e)||(u=e,"function"==typeof u)?e:t=>t===e;var u;t&&o?(0,r.default.split)({and:[{source:a,match:{then:i,else:n(i)},cases:{then:t,else:o}}],or:{sid:"9tug3k"}}):t?(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"abznoh"}}):o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"-eb29qp"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"jne2ft"}))throw new TypeError("source cannot be domain");const o=function(e){if(r.default.is.store(e,{sid:"-2xmoh9"}))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:"-757cx6"})}throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEvent)({name:"saveTimeoutId",sid:"eqtrwk"}),i=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$timeoutId",sid:"-5hlcyp"}).on(a,((e,t)=>t)),u=(0,r.default.createEvent)({name:"saveReject",sid:"-m6vk0"}),s=(0,r.default.createStore)(null,{and:{serialize:"ignore"},name:"$rejecter",sid:"tqvf32"}).on(u,((e,t)=>t)),d=null!=n?n:(0,r.default.createEvent)({name:"tick",sid:"-6wklwe"}),c=(0,r.default.createEffect)((({parameter:e,timeout:t,timeoutId:n,rejectPromise:r})=>(n&&clearTimeout(n),r&&r(),new Promise(((n,r)=>{u(r),a(setTimeout(n,t,e))})))),{name:"timerBaseFx",sid:"-xd98qa"}),f=(0,r.default.attach)({and:{source:{timeoutId:i,rejectPromise:s},mapParams:({parameter:e,timeout:t},{timeoutId:n,rejectPromise:r})=>({parameter:e,timeout:t,timeoutId:n,rejectPromise:r}),effect:c},or:{name:"timerFx",sid:"-4ab544"}});return s.reset(f.done),i.reset(f.done),(0,r.default.sample)({and:[{source:o,clock:e,fn:(e,t)=>({timeout:e,parameter:t}),target:f}],or:{sid:"m29k3f"}}),(0,r.default.forward)({and:{from:f.done.map((({result:e})=>e)),to:d},or:{sid:"-32ktwy"}}),d}})),d=o((function(e,t){function n(...e){let t={trace:!1};const[n,...o]=e;if(function(e){return!r.default.is.unit(e)&&!Object.values(e).every(r.default.is.unit)}(n))t=n;else if(r.default.is.unit(n))f(n);else for(const[e,r]of Object.entries(n))s.set(y(r).id,e),f(r,t);for(const e of o)if(r.default.is.unit(e))f(e,t);else for(const[n,r]of Object.entries(e))s.set(y(r).id,n),f(r,t)}function o(e){return r.default.is.store(e,{sid:"-h7y2t9"})?"store":r.default.is.effect(e,{sid:"-h6ap16"})?"effect":r.default.is.event(e,{sid:"-h4nb93"})?"event":r.default.is.domain(e,{sid:"-grg90f"})?"domain":r.default.is.unit(e)?"unit":"unknown"}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=n;const a=[];function i(e,t,n=""){const o=n+d(e);r.default.is.store(e,{sid:"-g609vc"})&&(p({type:t,name:o,value:e.getState()}),b.forEach(((n,r)=>{p({type:t,name:o,scopeName:r.name,value:n.getState(e)})})),a.push(e)),(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(e,n,r){if(r.scope){b.get(r.scope)||b.save(r.scope);const n=b.get(r.scope);p({type:t,name:o,scopeName:n?.name,value:e})}else p({type:t,name:o,value:e})}})]})}function u(e){i(e.done,"effect",d(e)+"."),i(e.fail,"effect",d(e)+".")}const s=new Map;function d(e){const t=s.get(y(e).id);return t||(e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:"")}function c(e){var t;const n=function({meta:e}){return"config"in e?e.config.loc:e.loc}(e);return n?`${null!==(t=n.file)&&void 0!==t?t:""}:${n.line}:${n.column}`:null}function f(e,t){const n=o(e);(r.default.is.store(e,{sid:"zfed9z"})||r.default.is.effect(e,{sid:"wsoi2z"})||r.default.is.event(e,{sid:"wsojji"}))&&(i(e,n),t?.trace&&m(e)),r.default.is.effect(e,{sid:"-zhbby9"})&&u(e),r.default.is.domain(e,{sid:"-p5meu5"})&&(e.onCreateEvent((e=>{i(e,"event"),t?.trace&&m(e)})),e.onCreateStore((e=>{i(e,"store"),t?.trace&&m(e)})),e.onCreateEffect((e=>{i(e,"effect"),u(e),t?.trace&&m(e)})))}function l(e){if(!e)return"";const{meta:t,id:n}=e,r=s.get(n);if(r)return r;if(!function(e){const t=function(e){return"graphite"in e?e.graphite:e}(e),{sid:n,named:r}=t.meta;return Boolean(!n&&("finally"===r||"done"===r||"doneData"===r||"fail"===r||"failData"===r||"inFlight"===r||"pending"===r))}(e))return t.name;const o=e.family.owners.find((e=>"effect"===e.meta.op));return o?`${l(o)}.${t.named}`:t.named}function m(e){const t=o(e),n=d(e);(0,r.default.createNode)({parent:[e],meta:{op:"watch"},family:{owners:e},regional:!0,node:[r.default.step.run({fn(e,r,o){let a=o?.parent;const i=b.get(o?.scope),u=i?` (scope: ${i.name})`:"",s=`[${t}]${u} ${n} trace`;for(console.groupCollapsed(s);a;){const{node:e,value:t}=a,{meta:n}=e;let r=n.op,o=l(e);var d;if(!o)o=null!==(d=c(e))&&void 0!==d?d:"";if("on"===r){const t=l(e.next[0]);r=`${t}.${n.op}`,o=`${t}.${n.op}(${l(a.parent?.node)})`}console.info(`<- [${r}] ${o}`,t),a=a.parent}console.groupEnd()}})]})}function p({type:e,scopeName:t,name:n,value:r}){const o=`[${e}]`,a=t?` (scope: ${t})`:"",i=` ${n}`;console.info(`${o}${a}${i}`,r)}n.registerScope=function(e,t){return b.save(e,{name:t.name}),a.forEach((n=>{p({type:"store",name:d(n),scopeName:t.name,value:e.getState(n)})})),()=>{b.delete(e)}},n.unregisterAllScopes=function(){b.clear()};const y=e=>e.graphite||e,v=new Map;let g=0;const b={save(e,t){b.get(e)||v.set(e,null!=t?t:{name:(g+=1,`unknown_scope_${g}`)})},get(e){var t;return e&&null!==(t=v.get(e))&&void 0!==t?t:null},delete(e){v.delete(e)},forEach(e){v.forEach(((t,n)=>e(n,t)))},clear(){v.clear()}}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),f=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],or:{sid:"-5vau2h"}});const a=t;return e(a.filter,a.then,a.other)}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.empty=function(e){return e.map((e=>null===e))}})),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],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)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),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])}`)),"")],or:{sid:"-yrbthp"}})}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),g=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:"tick",sid:"u782pl"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-xegewf"}),s=function(e){if(r.default.is.store(e,{sid:"7icamc"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"knc3em"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),c=(0,r.default.createEvent)({name:"saveTimeout",sid:"ab3q7d"}),f=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-aj5rja"}).on(c,((e,{timeoutId:t})=>t)),l=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"opb0ih"}).on(c,((e,{reject:t})=>t)),m=(0,r.default.attach)({and:{source:{timeout:s,running:u},effect:({timeout:e,running:t})=>t?new Promise(((t,n)=>{const r=setTimeout(t,e);c({timeoutId:r,reject:n})})):Promise.reject()},or:{name:"timeoutFx",sid:"9hil7b"}}),p=(0,r.default.attach)({and:{source:{timeoutId:f,rejecter:l},effect:({timeoutId:e,rejecter:t})=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"-v02m7d"}});if((0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:m}],or:{sid:"-vop0ii"}}),o){const e=(0,r.default.guard)({and:[{clock:t,filter:d}],or:{name:"onReady",sid:"-cmw7lh"}});(0,r.default.sample)({and:[{clock:e,target:i}],or:{sid:"-v876ny"}})}(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-v6jsxl"}}),(0,r.default.guard)({and:[{clock:m.done,source:s,filter:u,target:m}],or:{sid:"-urpcwu"}}),(0,r.default.guard)({and:[{clock:m.done,filter:u,target:i.prepend((()=>{}))}],or:{sid:"-ucb4aq"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"6lcn0o"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:p}],or:{sid:"71ao6f"}}));return{tick:i,isRunning:u}}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e))}})),h=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}],or:{sid:"-44722k"}})}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=null!=e?e:[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset(r)}))}})),_=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(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),$=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:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auiql4"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),k=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)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),E=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}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-fkbi3c"})}){for(const i in e)if(o=e,a=i,n.call(o,a)){const n=e[i],o=(0,r.default.guard)({and:[{source:t,greedy:!0,filter:e=>"object"==typeof e&&null!==e&&i in e}],or:{name:"hasTargetKey",sid:"-cov4g4"}});(0,r.default.sample)({and:[{greedy:!0,clock:o,fn:e=>e[i],target:n}],or:{sid:"lpn34j"}})}var o,a;return t};const n={}.hasOwnProperty})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"r328r6"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-hl6vqh"}))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:"pu8pon"})}throw new TypeError(`timeout parameter should be number or Store. "${typeof e}" was passed`)}(t),a=(0,r.default.createEffect)((e=>new Promise((t=>setTimeout(t,e)))),{name:"timerFx",sid:"-pyjx8k"}),i=(0,r.default.guard)({and:[{clock:e,filter:a.pending.map((e=>!e))}],or:{name:"start",sid:"-p67kgr"}});return(0,r.default.sample)({and:[{source:o,clock:i,target:a}],or:{sid:"-ievrvf"}}),(0,r.default.sample)({and:[{source:e,clock:a.done,target:n}],or:{sid:"-i01buo"}}),n}})),S=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=null!=t?t:n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,null!=o?o:a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),u};const n=()=>Date.now()})),x=a.and,z=i.combineEvents,T=u.condition,A=s.debounce,q=d.debug,N=c.delay,F=f.either,I=l.empty,R=m.equals,C=p.every,D=y.format,B=v.inFlight,K=g.interval,V=b.not,G=h.or,H=w.pending,J=j.reset,L=_.reshape,Q=$.snapshot,U=k.some,W=E.splitMap,X=P.spread,Y=M.status,Z=O.throttle,ee=S.time,te={and:x,combineEvents:z,condition:T,debounce:A,debug:q,delay:N,either:F,empty:I,equals:R,every:C,format:D,inFlight:B,interval:K,not:V,or:G,pending:H,reset:J,reshape:L,snapshot:Q,some:U,splitMap:W,spread:X,status:Y,throttle:Z,time:ee};e.and=x,e.combineEvents=z,e.condition=T,e.debounce=A,e.debug=q,e.default=te,e.delay=N,e.either=F,e.empty=I,e.equals=R,e.every=C,e.format=D,e.inFlight=B,e.interval=K,e.not=V,e.or=G,e.pending=H,e.reset=J,e.reshape=L,e.snapshot=Q,e.some=U,e.splitMap=W,e.spread=X,e.status=Y,e.throttle=Z,e.time=ee,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=patronum.umd.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
331320
3474