2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
|
var a=a=>"@@redux-saga/"+a,r=a("CANCEL_PROMISE"),n=a("CHANNEL_END"),t=a("IO"),e=a("MATCH"),o=a("MULTICAST"),s=a("SAGA_ACTION"),u=a("SELF_CANCELLATION"),i=a("TASK"),c=a("TASK_CANCEL"),l=a("TERMINATE"),f=a("LOCATION");function v(){return(v=Object.assign||function(a){for(var r=1;arguments.length>r;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(a[t]=n[t])}return a}).apply(this,arguments)}var p=a=>null==a,y=a=>null!=a,A=a=>"function"==typeof a,E=a=>"string"==typeof a,C=Array.isArray,d=a=>a&&A(a.then),h=a=>a&&A(a.next)&&A(a.throw),T=a=>a&&(E(a)||L(a)||A(a)||C(a)&&a.every(T)),g=a=>a&&A(a.take)&&A(a.close),O=a=>A(a)&&a.hasOwnProperty("toString"),L=a=>!!a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype,m=a=>g(a)&&a[o],N=(a=>()=>a)(!0),b=()=>{},S=a=>a,_=(a,r)=>{v(a,r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(r).forEach(n=>{a[n]=r[n]})},w=(a,r)=>[].concat(...r.map(a));function I(a,r){var n=a.indexOf(r);0>n||a.splice(n,1)}function k(a){var r=!1;return()=>{r||(r=!0,a())}}var P=a=>{throw a},j=a=>({value:a,done:!0});function x(a,r,n){void 0===r&&(r=P),void 0===n&&(n="iterator");var t={meta:{name:n},next:a,throw:r,return:j,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(t[Symbol.iterator]=(()=>t)),t}function H(a,r){var{sagaStack:n}=r;console.error(a),console.error(n)}var K=a=>Array.apply(null,Array(a)),R=a=>r=>a(Object.defineProperty(r,s,{value:!0})),F=a=>a===l,M=a=>a===c,U=a=>F(a)||M(a);function X(a,r){var n,t=Object.keys(a),e=t.length,o=0,s=C(a)?K(e):{},u={};return t.forEach(a=>{var t=(t,u)=>{n||(u||U(t)?(r.cancel(),r(t,u)):(s[a]=t,++o===e&&(n=!0,r(s))))};t.cancel=b,u[a]=t}),r.cancel=(()=>{n||(n=!0,t.forEach(a=>u[a].cancel()))}),u}function D(a){return{name:a.name||"anonymous",location:G(a)}}function G(a){return a[f]}var z="Channel's Buffer overflow!",J=1,B=3,q=4,Q={isEmpty:N,put:b,take:b};function V(a,r){void 0===a&&(a=10);var n=Array(a),t=0,e=0,o=0,s=r=>{n[e]=r,e=(e+1)%a,t++},u=()=>{if(0!=t){var r=n[o];return n[o]=null,t--,o=(o+1)%a,r}},i=()=>{for(var a=[];t;)a.push(u());return a};return{isEmpty:()=>0==t,put:u=>{var c;if(a>t)s(u);else switch(r){case J:throw Error(z);case B:n[e]=u,o=e=(e+1)%a;break;case q:c=2*a,n=i(),t=n.length,e=n.length,o=0,n.length=c,a=c,s(u)}},take:u,flush:i}}var W=()=>Q,Y=a=>V(a,B),Z=a=>V(a,q),$=Object.freeze({__proto__:null,none:W,fixed:a=>V(a,J),dropping:a=>V(a,2),sliding:Y,expanding:Z}),aa="TAKE",ra="PUT",na="ALL",ta="RACE",ea="CALL",oa="CPS",sa="FORK",ua="JOIN",ia="CANCEL",ca="SELECT",la="ACTION_CHANNEL",fa="CANCELLED",va="FLUSH",pa="GET_CONTEXT",ya="SET_CONTEXT",Aa=Object.freeze({__proto__:null,TAKE:aa,PUT:ra,ALL:na,RACE:ta,CALL:ea,CPS:oa,FORK:sa,JOIN:ua,CANCEL:ia,SELECT:ca,ACTION_CHANNEL:la,CANCELLED:fa,FLUSH:va,GET_CONTEXT:pa,SET_CONTEXT:ya}),Ea=2147483647;function Ca(a,n){var t;void 0===n&&(n=!0);var e=new Promise(r=>{t=setTimeout(r,Math.min(Ea,a),n)});return e[r]=(()=>{clearTimeout(t)}),e}var da=(a,r)=>({[t]:!0,combinator:!1,type:a,payload:r}),ha=a=>da(sa,v({},a.payload,{detached:!0}));function Ta(a,r){return void 0===a&&(a="*"),T(a)?(y(r)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),da(aa,{pattern:a})):m(a)&&y(r)&&T(r)?da(aa,{channel:a,pattern:r}):g(a)?(y(r)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),da(aa,{channel:a})):void 0}var ga=function(){var a=Ta(...arguments);return a.payload.maybe=!0,a};function Oa(a,r){return p(r)&&(r=a,a=void 0),da(ra,{channel:a,action:r})}var La=function(){var a=Oa(...arguments);return a.payload.resolve=!0,a};function ma(a){var r=da(na,a);return r.combinator=!0,r}function Na(a){var r=da(ta,a);return r.combinator=!0,r}function ba(a,r){var n,t=null;return A(a)?n=a:(C(a)?[t,n]=a:({context:t,fn:n}=a),t&&E(n)&&A(t[n])&&(n=t[n])),{context:t,fn:n,args:r}}function Sa(a){for(var r=arguments.length,n=Array(r>1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];return da(ea,ba(a,n))}function _a(a,r,n){return void 0===n&&(n=[]),da(ea,ba([a,r],n))}function wa(a){for(v
|