mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 19:35:15 +00:00
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,c=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,a=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&c(e,n,t[n]);if(r)for(var n of r(t))i.call(t,n)&&c(e,n,t[n]);return e},s=(e,r)=>t(e,n(r));import{enableES5 as u}from"immer";export*from"redux";import{default as f,current as l,freeze as d,original as p,isDraft as m}from"immer";import{createSelector as y}from"reselect";import{current as h,isDraft as g}from"immer";import{createSelector as b}from"reselect";var O=(...e)=>{const t=b(...e);return(e,...n)=>t(g(e)?h(e):e,...n)};import{createStore as j,compose as v,applyMiddleware as w,combineReducers as E}from"redux";import{compose as S}from"redux";var A="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?S:S.apply(null,arguments)};function x(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window;import _ from"redux-thunk";var I=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,I.prototype)}static get[Symbol.species](){return I}concat(...e){return super.concat.apply(this,e)}prepend(...e){return 1===e.length&&Array.isArray(e[0])?new I(...e[0].concat(this)):new I(...e.concat(this))}};function P(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function M(e={}){return()=>e=>t=>e(t)}function C(e){const t=typeof e;return"undefined"===t||null===e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||x(e)}function q(e,t="",n=C,r,o=[]){let i;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;const c=null!=r?r(e):Object.entries(e),a=o.length>0;for(const[e,s]of c){const c=t?t+"."+e:e;if(!(a&&o.indexOf(c)>=0)){if(!n(s))return{keyPath:c,value:s};if("object"==typeof s&&(i=q(s,c,n,r,o),i))return i}}return!1}function D(e={}){return()=>e=>t=>e(t)}function k(e={}){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0}=e;let o=new I;return t&&o.push("boolean"==typeof t?_:_.withExtraArgument(t.extraArgument)),o}function R(e){const t=function(e){return k(e)},{reducer:n,middleware:r=t(),devTools:o=!0,preloadedState:i,enhancers:c}=e||{};let s;if("function"==typeof n)s=n;else{if(!x(n))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');s=E(n)}let u=r;"function"==typeof u&&(u=u(t));const f=w(...u);let l=v;o&&(l=A(a({trace:!1},"object"==typeof o&&o)));let d=[f];Array.isArray(c)?d=[f,...c]:"function"==typeof c&&(d=c(d));const p=l(...d);return j(s,i,p)}function T(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return a(a({type:e,payload:r.payload},"meta"in r&&{meta:r.meta}),"error"in r&&{error:r.error})}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>t.type===e,n}function V(e){return["type","payload","error","meta"].indexOf(e)>-1}function N(e){return`${e}`}import L,{isDraft as X,isDraftable as W}from"immer";function z(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(r in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[r]=n,o},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),o),addDefaultCase:e=>(r=e,o)};return e(o),[t,n,r]}function U(e,t,n=[],r){let[o,i,c]="function"==typeof t?z(t):[t,n,r];const a=L(e,(()=>{}));return function(e=a,t){let n=[o[t.type],...i.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===n.filter((e=>!!e)).length&&(n=[c]),n.reduce(((e,n)=>{if(n){if(X(e)){const r=n(e,t);return void 0===r?e:r}if(W(e))return L(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e}),e)}}function $(e){const{name:t,initialState:n}=e;if(!t)throw new Error("`name` is a required option for createSlice");const r=e.reducers||{},[o={},i=[],c]="function"==typeof e.extraReducers?z(e.extraReducers):[e.extraReducers],s=Object.keys(r),u={},f={},l={};s.forEach((e=>{const n=r[e],o=`${t}/${e}`;let i,c;"reducer"in n?(i=n.reducer,c=n.prepare):i=n,u[e]=i,f[o]=i,l[e]=c?T(o,c):T(o)}));const d=U(n,a(a({},o),f),i,c);return{name:t,reducer:d,actions:l,caseReducers:u}}import B,{isDraft as F}from"immer";function G(e){const t=H(((t,n)=>e(n)));return function(e){return t(e,void 0)}}function H(e){return function(t,n){const r=t=>{var r;x(r=n)&&"string"==typeof r.type&&Object.keys(r).every(V)?e(n.payload,t):e(n,t)};return F(t)?(r(t),t):B(t,r)}}function J(e,t){return t(e)}function K(e){return Array.isArray(e)||(e=Object.values(e)),e}function Q(e,t,n){e=K(e);const r=[],o=[];for(const i of e){const e=J(i,t);e in n.entities?o.push({id:e,changes:i}):r.push(i)}return[r,o]}function Y(e){function t(t,n){const r=J(t,e);r in n.entities||(n.ids.push(r),n.entities[r]=t)}function n(e,n){e=K(e);for(const r of e)t(r,n)}function r(t,n){const r=J(t,e);r in n.entities||n.ids.push(r),n.entities[r]=t}function o(e,t){let n=!1;e.forEach((e=>{e in t.entities&&(delete t.entities[e],n=!0)})),n&&(t.ids=t.ids.filter((e=>e in t.entities)))}function i(t,n){const r={},o={};t.forEach((e=>{e.id in n.entities&&(o[e.id]={id:e.id,changes:a(a({},o[e.id]?o[e.id].changes:null),e.changes)})})),(t=Object.values(o)).length>0&&t.filter((t=>function(t,n,r){const o=Object.assign({},r.entities[n.id],n.changes),i=J(o,e),c=i!==n.id;return c&&(t[n.id]=i,delete r.entities[n.id]),r.entities[i]=o,c}(r,t,n))).length>0&&(n.ids=n.ids.map((e=>r[e]||e)))}function c(t,r){const[o,c]=Q(t,e,r);i(c,r),n(o,r)}return{removeAll:G((function(e){Object.assign(e,{ids:[],entities:{}})})),addOne:H(t),addMany:H(n),setOne:H(r),setMany:H((function(e,t){e=K(e);for(const n of e)r(n,t)})),setAll:H((function(e,t){e=K(e),t.ids=[],t.entities={},n(e,t)})),updateOne:H((function(e,t){return i([e],t)})),updateMany:H(i),upsertOne:H((function(e,t){return c([e],t)})),upsertMany:H(c),removeOne:H((function(e,t){return o([e],t)})),removeMany:H(o)}}function Z(e={}){const{selectId:t,sortComparer:n}=a({sortComparer:!1,selectId:e=>e.id},e),r={getInitialState:function(e={}){return Object.assign({ids:[],entities:{}},e)}},o={getSelectors:function(e){const t=e=>e.ids,n=e=>e.entities,r=O(t,n,((e,t)=>e.map((e=>t[e])))),o=(e,t)=>t,i=(e,t)=>e[t],c=O(t,(e=>e.length));if(!e)return{selectIds:t,selectEntities:n,selectAll:r,selectTotal:c,selectById:O(n,o,i)};const a=O(e,n);return{selectIds:O(e,t),selectEntities:a,selectAll:O(e,r),selectTotal:O(e,c),selectById:O(a,o,i)}}},i=n?function(e,t){const{removeOne:n,removeMany:r,removeAll:o}=Y(e);function i(t,n){const r=(t=K(t)).filter((t=>!(J(t,e)in n.entities)));0!==r.length&&u(r,n)}function c(e,t){0!==(e=K(e)).length&&u(e,t)}function a(t,n){const r=[];t.forEach((t=>function(t,n,r){if(!(n.id in r.entities))return!1;const o=Object.assign({},r.entities[n.id],n.changes),i=J(o,e);return delete r.entities[n.id],t.push(o),i!==n.id}(r,t,n))),0!==r.length&&u(r,n)}function s(t,n){const[r,o]=Q(t,e,n);a(o,n),i(r,n)}function u(n,r){n.forEach((t=>{r.entities[e(t)]=t}));const o=Object.values(r.entities);o.sort(t);const i=o.map(e),{ids:c}=r;(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length&&n<t.length;n++)if(e[n]!==t[n])return!1;return!0})(c,i)||(r.ids=i)}return{removeOne:n,removeMany:r,removeAll:o,addOne:H((function(e,t){return i([e],t)})),updateOne:H((function(e,t){return a([e],t)})),upsertOne:H((function(e,t){return s([e],t)})),setOne:H((function(e,t){return c([e],t)})),setMany:H(c),setAll:H((function(e,t){e=K(e),t.entities={},t.ids=[],i(e,t)})),addMany:H(i),updateMany:H(a),upsertMany:H(s)}}(t,n):Y(t);return a(a(a({selectId:t,sortComparer:n},r),o),i)}var ee=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},te=["name","message","stack","code"],ne=class{constructor(e,t){this.payload=e,this.meta=t}},re=class{constructor(e,t){this.payload=e,this.meta=t}},oe=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of te)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}};function ie(e,t,n){const r=T(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:s(a({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}))),o=T(e+"/pending",((e,t,n)=>({payload:void 0,meta:s(a({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}))),i=T(e+"/rejected",((e,t,r,o,i)=>({payload:o,error:(n&&n.serializeError||oe)(e||"Rejected"),meta:s(a({},i||{}),{arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}))),c="undefined"!=typeof AbortController?AbortController:class{constructor(){this.signal={aborted:!1,addEventListener(){},dispatchEvent:()=>!1,onabort(){},removeEventListener(){}}}abort(){}};return Object.assign((function(e){return(a,s,u)=>{var f;const l=(null!=(f=null==n?void 0:n.idGenerator)?f:ee)(),d=new c;let p;const m=new Promise(((e,t)=>d.signal.addEventListener("abort",(()=>t({name:"AbortError",message:p||"Aborted"})))));let y=!1;const h=async function(){var c;let f;try{if(n&&n.condition&&!1===n.condition(e,{getState:s,extra:u}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};y=!0,a(o(l,e,null==(c=null==n?void 0:n.getPendingMeta)?void 0:c.call(n,{requestId:l,arg:e},{getState:s,extra:u}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:a,getState:s,extra:u,requestId:l,signal:d.signal,rejectWithValue:(e,t)=>new ne(e,t),fulfillWithValue:(e,t)=>new re(e,t)})).then((t=>{if(t instanceof ne)throw t;return t instanceof re?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof ne?i(null,l,e,t.payload,t.meta):i(t,l,e)}return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||a(f),f}();return Object.assign(h,{abort:function(e){y&&(p=e,d.abort())},requestId:l,arg:e,unwrap:()=>h.then(ce)})}}),{pending:o,rejected:i,fulfilled:r,typePrefix:e})}function ce(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var ae=(e,t)=>{return(n=e)&&"function"==typeof n.match?e.match(t):e(t);var n};function se(...e){return t=>e.some((e=>ae(e,t)))}function ue(...e){return t=>e.every((e=>ae(e,t)))}function fe(e,t){if(!e||!e.meta)return!1;const n="string"==typeof e.meta.requestId,r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function le(e){return"function"==typeof e[0]&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function de(...e){return 0===e.length?e=>fe(e,["pending"]):le(e)?t=>se(...e.map((e=>e.pending)))(t):de()(e[0])}function pe(...e){return 0===e.length?e=>fe(e,["rejected"]):le(e)?t=>se(...e.map((e=>e.rejected)))(t):pe()(e[0])}function me(...e){const t=e=>e&&e.meta&&e.meta.rejectedWithValue;return 0===e.length||le(e)?n=>ue(pe(...e),t)(n):me()(e[0])}function ye(...e){return 0===e.length?e=>fe(e,["fulfilled"]):le(e)?t=>se(...e.map((e=>e.fulfilled)))(t):ye()(e[0])}function he(...e){return 0===e.length?e=>fe(e,["pending","fulfilled","rejected"]):le(e)?t=>{const n=[];for(const t of e)n.push(t.pending,t.rejected,t.fulfilled);return se(...n)(t)}:he()(e[0])}u();export{I as MiddlewareArray,R as configureStore,T as createAction,ie as createAsyncThunk,O as createDraftSafeSelector,Z as createEntityAdapter,M as createImmutableStateInvariantMiddleware,f as createNextState,U as createReducer,y as createSelector,D as createSerializableStateInvariantMiddleware,$ as createSlice,l as current,q as findNonSerializableValue,d as freeze,k as getDefaultMiddleware,N as getType,ue as isAllOf,se as isAnyOf,he as isAsyncThunkAction,m as isDraft,ye as isFulfilled,P as isImmutableDefault,de as isPending,C as isPlain,x as isPlainObject,pe as isRejected,me as isRejectedWithValue,oe as miniSerializeError,ee as nanoid,p as original,ce as unwrapResult}; |