septor-store-react 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ (function(C,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],L):(C=typeof globalThis<"u"?globalThis:C||self,L(C["septor-store-react"]={},C.React))})(this,(function(C,L){"use strict";var fe=typeof document<"u"?document.currentScript:null;function Ce(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ot}=Object.prototype,{getPrototypeOf:de}=Object,{iterator:Z,toStringTag:xe}=Symbol,Y=(e=>t=>{const n=Ot.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),P=e=>(e=e.toLowerCase(),t=>Y(t)===e),ee=e=>t=>typeof t===e,{isArray:M}=Array,q=ee("undefined");function v(e){return e!==null&&!q(e)&&e.constructor!==null&&!q(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ne=P("ArrayBuffer");function Tt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ne(e.buffer),t}const At=ee("string"),O=ee("function"),Pe=ee("number"),W=e=>e!==null&&typeof e=="object",Ct=e=>e===!0||e===!1,te=e=>{if(Y(e)!=="object")return!1;const t=de(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(xe in e)&&!(Z in e)},xt=e=>{if(!W(e)||v(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Nt=P("Date"),Pt=P("File"),kt=P("Blob"),Ft=P("FileList"),Ut=e=>W(e)&&O(e.pipe),Lt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||O(e.append)&&((t=Y(e))==="formdata"||t==="object"&&O(e.toString)&&e.toString()==="[object FormData]"))},_t=P("URLSearchParams"),[Bt,Dt,jt,It]=["ReadableStream","Request","Response","Headers"].map(P),Ht=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Q(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),M(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(v(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function ke(e,t){if(v(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const D=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Fe=e=>!q(e)&&e!==D;function pe(){const{caseless:e,skipUndefined:t}=Fe(this)&&this||{},n={},r=(s,i)=>{const o=e&&ke(n,i)||i;te(n[o])&&te(s)?n[o]=pe(n[o],s):te(s)?n[o]=pe({},s):M(s)?n[o]=s.slice():(!t||!q(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Q(arguments[s],r);return n}const $t=(e,t,n,{allOwnKeys:r}={})=>(Q(t,(s,i)=>{n&&O(s)?e[i]=Ce(s,n):e[i]=s},{allOwnKeys:r}),e),Mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),qt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Vt=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&de(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},zt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Jt=e=>{if(!e)return null;if(M(e))return e;let t=e.length;if(!Pe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},vt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&de(Uint8Array)),Wt=(e,t)=>{const r=(e&&e[Z]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Qt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Xt=P("HTMLFormElement"),Kt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ue=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Gt=P("RegExp"),Le=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Q(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Zt=e=>{Le(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(O(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Yt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return M(e)?r(e):r(String(e).split(t)),n},en=()=>{},tn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function nn(e){return!!(e&&O(e.append)&&e[xe]==="FormData"&&e[Z])}const rn=e=>{const t=new Array(10),n=(r,s)=>{if(W(r)){if(t.indexOf(r)>=0)return;if(v(r))return r;if(!("toJSON"in r)){t[s]=r;const i=M(r)?[]:{};return Q(r,(o,c)=>{const f=n(o,s+1);!q(f)&&(i[c]=f)}),t[s]=void 0,i}}return r};return n(e,0)},sn=P("AsyncFunction"),on=e=>e&&(W(e)||O(e))&&O(e.then)&&O(e.catch),_e=((e,t)=>e?setImmediate:t?((n,r)=>(D.addEventListener("message",({source:s,data:i})=>{s===D&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),D.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",O(D.postMessage)),an=typeof queueMicrotask<"u"?queueMicrotask.bind(D):typeof process<"u"&&process.nextTick||_e,a={isArray:M,isArrayBuffer:Ne,isBuffer:v,isFormData:Lt,isArrayBufferView:Tt,isString:At,isNumber:Pe,isBoolean:Ct,isObject:W,isPlainObject:te,isEmptyObject:xt,isReadableStream:Bt,isRequest:Dt,isResponse:jt,isHeaders:It,isUndefined:q,isDate:Nt,isFile:Pt,isBlob:kt,isRegExp:Gt,isFunction:O,isStream:Ut,isURLSearchParams:_t,isTypedArray:vt,isFileList:Ft,forEach:Q,merge:pe,extend:$t,trim:Ht,stripBOM:Mt,inherits:qt,toFlatObject:Vt,kindOf:Y,kindOfTest:P,endsWith:zt,toArray:Jt,forEachEntry:Wt,matchAll:Qt,isHTMLForm:Xt,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:Le,freezeMethods:Zt,toObjectSet:Yt,toCamelCase:Kt,noop:en,toFiniteNumber:tn,findKey:ke,global:D,isContextDefined:Fe,isSpecCompliantForm:nn,toJSONObject:rn,isAsyncFn:sn,isThenable:on,setImmediate:_e,asap:an,isIterable:e=>e!=null&&O(e[Z])};function y(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(y,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const Be=y.prototype,De={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{De[e]={value:e}}),Object.defineProperties(y,De),Object.defineProperty(Be,"isAxiosError",{value:!0}),y.from=(e,t,n,r,s,i)=>{const o=Object.create(Be);a.toFlatObject(e,o,function(u){return u!==Error.prototype},l=>l!=="isAxiosError");const c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return y.call(o,c,f,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const cn=null;function he(e){return a.isPlainObject(e)||a.isArray(e)}function je(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ie(e,t,n){return e?e.concat(t).map(function(s,i){return s=je(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function ln(e){return a.isArray(e)&&!e.some(he)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ne(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!a.isUndefined(h[m])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,m,h){let g=d;if(d&&!h&&typeof d=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&ln(d)||(a.isFileList(d)||a.endsWith(m,"[]"))&&(g=a.toArray(d)))return m=je(m),g.forEach(function(E,A){!(a.isUndefined(E)||E===null)&&t.append(o===!0?Ie([m],A,i):o===null?m:m+"[]",l(E))}),!1}return he(d)?!0:(t.append(Ie(h,m,i),l(d)),!1)}const p=[],b=Object.assign(un,{defaultVisitor:u,convertValue:l,isVisitable:he});function w(d,m){if(!a.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(d),a.forEach(d,function(g,x){(!(a.isUndefined(g)||g===null)&&s.call(t,g,a.isString(x)?x.trim():x,m,b))===!0&&w(g,m?m.concat(x):[x])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return w(e),t}function He(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function me(e,t){this._pairs=[],e&&ne(e,this,t)}const $e=me.prototype;$e.append=function(t,n){this._pairs.push([t,n])},$e.toString=function(t){const n=t?function(r){return t.call(this,r,He)}:He;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function fn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Me(e,t,n){if(!t)return e;const r=n&&n.encode||fn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new me(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class qe{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Ve={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:me,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ye=typeof window<"u"&&typeof document<"u",be=typeof navigator=="object"&&navigator||void 0,pn=ye&&(!be||["ReactNative","NativeScript","NS"].indexOf(be.product)<0),hn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mn=ye&&window.location.href||"http://localhost",R={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ye,hasStandardBrowserEnv:pn,hasStandardBrowserWebWorkerEnv:hn,navigator:be,origin:mn},Symbol.toStringTag,{value:"Module"})),...dn};function yn(e,t){return ne(e,new R.classes.URLSearchParams,{visitor:function(n,r,s,i){return R.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function bn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function wn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function ze(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),f=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=wn(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(bn(r),s,n,0)}),n}return null}function Sn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const X={transitional:Ve,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(ze(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return yn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return ne(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Sn(t)):t}],transformResponse:[function(t){const n=this.transitional||X.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:R.classes.FormData,Blob:R.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{X.headers[e]={}});const gn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),En=e=>{const t={};let n,r,s;return e&&e.split(`
2
+ `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&gn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Je=Symbol("internals");function K(e){return e&&String(e).trim().toLowerCase()}function re(e){return e===!1||e==null?e:a.isArray(e)?e.map(re):String(e)}function Rn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const On=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function we(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function Tn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function An(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let T=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(c,f,l){const u=K(f);if(!u)throw new Error("header name must be a non-empty string");const p=a.findKey(s,u);(!p||s[p]===void 0||l===!0||l===void 0&&s[p]!==!1)&&(s[p||f]=re(c))}const o=(c,f)=>a.forEach(c,(l,u)=>i(l,u,f));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!On(t))o(En(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,l;for(const u of t){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[l=u[0]]=(f=c[l])?a.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(c,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=K(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Rn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=K(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||we(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=K(o),o){const c=a.findKey(r,o);c&&(!n||we(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||we(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=re(s),delete n[i];return}const c=t?Tn(i):String(i).trim();c!==i&&delete n[i],n[c]=re(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Je]=this[Je]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=K(o);r[c]||(An(s,o),r[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};T.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(T.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(T);function Se(e,t){const n=this||X,r=t||n,s=T.from(r.headers);let i=r.data;return a.forEach(e,function(c){i=c.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function ve(e){return!!(e&&e.__CANCEL__)}function V(e,t,n){y.call(this,e??"canceled",y.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(V,y,{__CANCEL__:!0});function We(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Cn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function xn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),u=r[i];o||(o=l),n[s]=f,r[s]=l;let p=i,b=0;for(;p!==s;)b+=n[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),l-o<t)return;const w=u&&l-u;return w?Math.round(b*1e3/w):void 0}}function Nn(e,t){let n=0,r=1e3/t,s,i;const o=(l,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...l)};return[(...l)=>{const u=Date.now(),p=u-n;p>=r?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},r-p)))},()=>s&&o(s)]}const se=(e,t,n=3)=>{let r=0;const s=xn(50,250);return Nn(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,f=o-r,l=s(f),u=o<=c;r=o;const p={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-o)/l:void 0,event:i,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},n)},Qe=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Xe=e=>(...t)=>a.asap(()=>e(...t)),Pn=R.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,R.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(R.origin),R.navigator&&/(msie|trident)/i.test(R.navigator.userAgent)):()=>!0,kn=R.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Fn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Un(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ke(e,t,n){let r=!Fn(t);return e&&(r||n==!1)?Un(e,t):t}const Ge=e=>e instanceof T?{...e}:e;function j(e,t){t=t||{};const n={};function r(l,u,p,b){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:b},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,p,b){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l,p,b)}else return r(l,u,p,b)}function i(l,u){if(!a.isUndefined(u))return r(void 0,u)}function o(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function c(l,u,p){if(p in t)return r(l,u);if(p in e)return r(void 0,l)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(l,u,p)=>s(Ge(l),Ge(u),p,!0)};return a.forEach(Object.keys({...e,...t}),function(u){const p=f[u]||s,b=p(e[u],t[u],u);a.isUndefined(b)&&p!==c||(n[u]=b)}),n}const Ze=e=>{const t=j({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=t;if(t.headers=o=T.from(o),t.url=Me(Ke(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const f=n.getHeaders(),l=["content-type","content-length"];Object.entries(f).forEach(([u,p])=>{l.includes(u.toLowerCase())&&o.set(u,p)})}}if(R.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Pn(t.url))){const f=s&&i&&kn.read(i);f&&o.set(s,f)}return t},Ln=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=Ze(e);let i=s.data;const o=T.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=s,u,p,b,w,d;function m(){w&&w(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function g(){if(!h)return;const E=T.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),k={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:E,config:e,request:h};We(function(N){n(N),m()},function(N){r(N),m()},k),h=null}"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(g)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(A){const k=A&&A.message?A.message:"Network Error",H=new y(k,y.ERR_NETWORK,e,h);H.event=A||null,r(H),h=null},h.ontimeout=function(){let A=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const k=s.transitional||Ve;s.timeoutErrorMessage&&(A=s.timeoutErrorMessage),r(new y(A,k.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&a.forEach(o.toJSON(),function(A,k){h.setRequestHeader(k,A)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),l&&([b,d]=se(l,!0),h.addEventListener("progress",b)),f&&h.upload&&([p,w]=se(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(u=E=>{h&&(r(!E||E.type?new V(null,e,h):E),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const x=Cn(s.url);if(x&&R.protocols.indexOf(x)===-1){r(new y("Unsupported protocol "+x+":",y.ERR_BAD_REQUEST,e));return}h.send(i||null)})},_n=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(l){if(!s){s=!0,c();const u=l instanceof Error?l:this.reason;r.abort(u instanceof y?u:new V(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,i(new y(`timeout ${t} of ms exceeded`,y.ETIMEDOUT))},t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i));const{signal:f}=r;return f.unsubscribe=()=>a.asap(c),f}},Bn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},Dn=async function*(e,t){for await(const n of jn(e))yield*Bn(n,t)},jn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ye=(e,t,n,r)=>{const s=Dn(e,t);let i=0,o,c=f=>{o||(o=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await s.next();if(l){c(),f.close();return}let p=u.byteLength;if(n){let b=i+=p;n(b)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},et=64*1024,{isFunction:oe}=a,In=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:tt,TextEncoder:nt}=a.global,rt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Hn=e=>{e=a.merge.call({skipUndefined:!0},In,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",i=oe(n),o=oe(r);if(!s)return!1;const c=s&&oe(tt),f=s&&(typeof nt=="function"?(d=>m=>d.encode(m))(new nt):async d=>new Uint8Array(await new n(d).arrayBuffer())),l=i&&c&&rt(()=>{let d=!1;const m=new n(R.origin,{body:new tt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!m}),u=o&&c&&rt(()=>a.isReadableStream(new r("").body)),p={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(m,h)=>{let g=m&&m[d];if(g)return g.call(m);throw new y(`Response type '${d}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const b=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new n(R.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},w=async(d,m)=>{const h=a.toFiniteNumber(d.getContentLength());return h??b(m)};return async d=>{let{url:m,method:h,data:g,signal:x,cancelToken:E,timeout:A,onDownloadProgress:k,onUploadProgress:H,responseType:N,headers:Te,withCredentials:ce="same-origin",fetchOptions:yt}=Ze(d),bt=t||fetch;N=N?(N+"").toLowerCase():"text";let le=_n([x,E&&E.toAbortSignal()],A),G=null;const $=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let wt;try{if(H&&l&&h!=="get"&&h!=="head"&&(wt=await w(Te,g))!==0){let B=new n(m,{method:"POST",body:g,duplex:"half"}),J;if(a.isFormData(g)&&(J=B.headers.get("content-type"))&&Te.setContentType(J),B.body){const[Ae,ue]=Qe(wt,se(Xe(H)));g=Ye(B.body,et,Ae,ue)}}a.isString(ce)||(ce=ce?"include":"omit");const U=i&&"credentials"in n.prototype,St={...yt,signal:le,method:h.toUpperCase(),headers:Te.normalize().toJSON(),body:g,duplex:"half",credentials:U?ce:void 0};G=i&&new n(m,St);let _=await(i?bt(G,yt):bt(m,St));const gt=u&&(N==="stream"||N==="response");if(u&&(k||gt&&$)){const B={};["status","statusText","headers"].forEach(Et=>{B[Et]=_[Et]});const J=a.toFiniteNumber(_.headers.get("content-length")),[Ae,ue]=k&&Qe(J,se(Xe(k),!0))||[];_=new r(Ye(_.body,et,Ae,()=>{ue&&ue(),$&&$()}),B)}N=N||"text";let nr=await p[a.findKey(p,N)||"text"](_,d);return!gt&&$&&$(),await new Promise((B,J)=>{We(B,J,{data:nr,headers:T.from(_.headers),status:_.status,statusText:_.statusText,config:d,request:G})})}catch(U){throw $&&$(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,d,G),{cause:U.cause||U}):y.from(U,U&&U.code,d,G)}}},$n=new Map,st=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,c=o,f,l,u=$n;for(;c--;)f=i[c],l=u.get(f),l===void 0&&u.set(f,l=c?new Map:Hn(t)),u=l;return l};st();const ge={http:cn,xhr:Ln,fetch:{get:st}};a.forEach(ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ot=e=>`- ${e}`,Mn=e=>a.isFunction(e)||e===null||e===!1;function qn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let c;if(s=r,!Mn(r)&&(s=ge[(c=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let c=n?o.length>1?`since :
4
+ `+o.map(ot).join(`
5
+ `):" "+ot(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const it={getAdapter:qn,adapters:ge};function Ee(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new V(null,e)}function at(e){return Ee(e),e.headers=T.from(e.headers),e.data=Se.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),it.getAdapter(e.adapter||X.adapter,e)(e).then(function(r){return Ee(e),r.data=Se.call(e,e.transformResponse,r),r.headers=T.from(r.headers),r},function(r){return ve(r)||(Ee(e),r&&r.response&&(r.response.data=Se.call(e,e.transformResponse,r.response),r.response.headers=T.from(r.response.headers))),Promise.reject(r)})}const ct="1.13.2",ie={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ie[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const lt={};ie.transitional=function(t,n,r){function s(i,o){return"[Axios v"+ct+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new y(s(o," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!lt[o]&&(lt[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}},ie.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Vn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],f=c===void 0||o(c,i,e);if(f!==!0)throw new y("option "+i+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}const ae={assertOptions:Vn,validators:ie},F=ae.validators;let I=class{constructor(t){this.defaults=t||{},this.interceptors={request:new qe,response:new qe}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=j(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:F.transitional(F.boolean),forcedJSONParsing:F.transitional(F.boolean),clarifyTimeoutError:F.transitional(F.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:F.function,serialize:F.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:F.spelling("baseURL"),withXsrfToken:F.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),n.headers=T.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,p=0,b;if(!f){const d=[at.bind(this),void 0];for(d.unshift(...c),d.push(...l),b=d.length,u=Promise.resolve(n);p<b;)u=u.then(d[p++],d[p++]);return u}b=c.length;let w=n;for(;p<b;){const d=c[p++],m=c[p++];try{w=d(w)}catch(h){m.call(this,h);break}}try{u=at.call(this,w)}catch(d){return Promise.reject(d)}for(p=0,b=l.length;p<b;)u=u.then(l[p++],l[p++]);return u}getUri(t){t=j(this.defaults,t);const n=Ke(t.baseURL,t.url,t.allowAbsoluteUrls);return Me(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){I.prototype[t]=function(n,r){return this.request(j(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(j(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}I.prototype[t]=n(),I.prototype[t+"Form"]=n(!0)});let zn=class Rt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new V(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Rt(function(s){t=s}),cancel:t}}};function Jn(e){return function(n){return e.apply(null,n)}}function vn(e){return a.isObject(e)&&e.isAxiosError===!0}const Re={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Re).forEach(([e,t])=>{Re[t]=e});function ut(e){const t=new I(e),n=Ce(I.prototype.request,t);return a.extend(n,I.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ut(j(e,s))},n}const S=ut(X);S.Axios=I,S.CanceledError=V,S.CancelToken=zn,S.isCancel=ve,S.VERSION=ct,S.toFormData=ne,S.AxiosError=y,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=Jn,S.isAxiosError=vn,S.mergeConfig=j,S.AxiosHeaders=T,S.formToJSON=e=>ze(a.isHTMLForm(e)?new FormData(e):e),S.getAdapter=it.getAdapter,S.HttpStatusCode=Re,S.default=S;const{Axios:lr,AxiosError:ur,CanceledError:fr,isCancel:dr,CancelToken:pr,VERSION:hr,all:mr,Cancel:yr,isAxiosError:br,spread:wr,toFormData:Sr,AxiosHeaders:gr,HttpStatusCode:Er,formToJSON:Rr,getAdapter:Or,mergeConfig:Tr}=S,Wn={abortController:new AbortController};let Oe=(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:fe&&fe.tagName.toUpperCase()==="SCRIPT"&&fe.src||new URL("index.umd.cjs",document.baseURI).href}<"u","");const Qn=e=>{e.backendURL&&(Oe=e.backendURL,z.defaults.baseURL=Oe)},z=S.create({baseURL:Oe,signal:Wn.abortController.signal}),Xn=e=>{const t=dt(),n=t?.token??null,r=t?.expiresIn??null;if(r){const s=t?.timestamp??null,i=Date.now();if(r&&i-s>r*1e3)return console.warn("Token has expired."),localStorage.removeItem("logginToken"),null}if(e.headers={...e.headers},n&&(e.headers.Authorization=`Bearer ${n}`),e.data instanceof FormData){const s=e.data;e.data=s}else e.data&&(e.data={...e.data??{}});return e};z.interceptors.response.use(e=>e,e=>(console.log("Error.....",e),e.response?.status,Promise.reject(e))),z.interceptors.request.use(Xn,e=>Promise.reject(e));const Kn=async({url:e,method:t,data:n})=>{let r=n??{};try{let s=null;if(t.toLowerCase()==="get"){const o=ft(r??{});s=await z.get(`${e}${o}`)}else s=await z.post(e,r);return s?.data??{Empty:"Empty"}}catch(s){return console.error(s),{success:!1,error:s}}},ft=(e={})=>{try{let t="?";for(let n in e)if(Object.hasOwnProperty.call(e,n)&&e[n])if(Array.isArray(e[n])){const r=e[n];for(const s of r)t+=`${n}[]=${s}&`}else t+=`${n}=${e[n]}&`;return t.slice(0,-1)}catch(t){console.error(t)}};function Gn(e={token:null}){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("setBearerToken expects an object {token} with a 'token' property.");const t={token:null,...e,timestamp:Date.now()};localStorage.setItem("logginToken",JSON.stringify(t))}function dt(){const e=localStorage.getItem("logginToken");try{return e?JSON.parse(e):null}catch(t){return console.error("Invalid token format in localStorage:",t),null}}const pt=e=>{let t;const n=new Set,r=(l,u)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const b=t;t=u??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(w=>w(t,b))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>f,subscribe:l=>(n.add(l),()=>n.delete(l))},f=t=e(r,s,c);return c},Zn=(e=>e?pt(e):pt),Yn=e=>e;function er(e,t=Yn){const n=L.useSyncExternalStore(e.subscribe,L.useCallback(()=>t(e.getState()),[e,t]),L.useCallback(()=>t(e.getInitialState()),[e,t]));return L.useDebugValue(n),n}const ht=e=>{const t=Zn(e),n=r=>er(t,r);return Object.assign(n,t),n},mt=(e=>e?ht(e):ht)((e,t)=>({loading:!1,stateValue:{},checkQueriesInQue:{},isThereAnyDataChangeInAform:!1,setStateValue:(n,r)=>e(s=>({stateValue:{...s.stateValue,[n]:r}})),getStateItem:n=>t().stateValue[n],sleep:n=>new Promise(r=>setTimeout(r,n)),validateLength:n=>Array.isArray(n)?n.length:typeof n=="object"?Object.keys(n).length:0,callApiData:async(n,r,s,i=!1,o=!1)=>{const{checkQueriesInQue:c}=t();if(t().getStateItem("checkQueriesInQue")?.[r]){console.warn(`************************************* dont call this api again ${s.url} 🛩️ *************************************`,s);return}t().setStateValue("loading",!0),t().setStateValue("checkQueriesInQue",{...c,[r]:r});const f=await z(s);return f?.status==200?(e({[n]:f?.data}),t().setStateValue(n,f?.data),o&&sessionStorage.setItem(n,JSON.stringify(f?.data))):console.error(f),t().cleareQueApi(r),e({loading:!1}),f},cleareQueApi:n=>{const s={...t().stateValue.checkQueriesInQue||{}};delete s[n],t().setStateValue("checkQueriesInQue",s)},complatedTheCall:async(n,r,s,i,o,c,f)=>{const l=await n.callApiData(r,s,i,o,c);return l?.status==200?(f&&f(l?.data),l?.data):(f&&f([]),l?.data)},stateGeneratorApi:async({reload:n,stateKey:r,req:s,time:i=0,paginated:o=!1,mStore:c={}},f)=>{e({[r]:[]});const l=JSON.stringify(s);try{const u=c?.mUse,p=t();if(e({loading:!0}),u){const w=JSON.parse(sessionStorage.getItem(r)||"{}");if(p.validateLength(w)&&(f&&f(w),e({[r]:w}),t().setStateValue(r,w),console.log(w),!n))return w}const b=p?.[r]??t().getStateItem(r);return p.validateLength(b)&&f&&f(b),n&&i>0&&setTimeout(()=>{t().complatedTheCall(p,r,l,s,o,u,f)},i*1e3),await t().complatedTheCall(p,r,l,s,o,u,f)}catch(u){t().cleareQueApi(l),f&&f([]),console.error(u)}}}));function tr(){return mt()}C.Store=mt,C.default=tr,C.generateParams=ft,C.getBearerToken=dt,C.setBaseURL=Qn,C.setBearerToken=Gn,C.useFetch=Kn,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "septor-store-react",
3
+ "description": "PomStore is a lightweight, flexible global state & API store for React. It simplifies data fetching, caching, and shared state management—without Redux or heavy boilerplate. Built for real-world React apps that need fast data access, request de-duplication, and cache-first loading. PomStore is built on top of Zustand, a lightweight state management library for React.",
4
+ "version": "0.0.2",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "build": "vite build",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "axios": "^1.13.2",
23
+ "zustand": "^5.0.9"
24
+ },
25
+ "peerDependencies": {
26
+ "react": ">=18",
27
+ "react-dom": ">=18"
28
+ },
29
+ "devDependencies": {
30
+ "vite": "^7.3.1",
31
+ "@vitejs/plugin-react": "^5.1.2",
32
+ "typescript": "^5.9.3"
33
+ },
34
+ "keywords": [
35
+ "zustand",
36
+ "state management",
37
+ "store",
38
+ "node",
39
+ "Ajax",
40
+ "promise",
41
+ "react",
42
+ "react3",
43
+ "state",
44
+ "pom",
45
+ "pom-pattern",
46
+ "zustand-store",
47
+ "modular-state",
48
+ "api-cache",
49
+ "api-state-manager",
50
+ "typescript",
51
+ "react-typescript",
52
+ "zustand-plugin",
53
+ "state-library",
54
+ "frontend tools",
55
+ "reactive-state",
56
+ "session-storage",
57
+ "dynamic-store",
58
+ "paginated-api",
59
+ "react devtools",
60
+ "session persistence",
61
+ "reactx alternative",
62
+ "smart cache",
63
+ "Septor Store",
64
+ "api-queue",
65
+ "septor-store-react",
66
+ "reload-control"
67
+ ],
68
+ "funding": [
69
+ {
70
+ "type": "ko-fi",
71
+ "url": "https://ko-fi.com/ssengedonazil"
72
+ }
73
+ ],
74
+ "author": "Ssengendo Nazil",
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "https://github.com/ssengedonazil/septor-store-testing.git"
78
+ },
79
+ "bugs": {
80
+ "url": "https://github.com/ssengedonazil/septor-store-testing.git/issues"
81
+ },
82
+ "homepage": "https://github.com/ssengedonazil/septor-store-testing.git#readme",
83
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
84
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './setUp/GlobalScripts/useFetch'
2
+
3
+ export * from './setUp/GlobalScripts/Axios'
4
+ export * from './setUp/GlobalScripts/AbortHandler'
5
+ import usePomZStore, { Store } from './setUp/pomStore.jsx';
6
+ export default usePomZStore;
7
+ export { Store };
@@ -0,0 +1,13 @@
1
+ import customAxios from "./Axios";
2
+
3
+ const AbortHandler = {
4
+ abortController: new AbortController(),
5
+
6
+ abortHttpRequests() {
7
+ this.abortController.abort();
8
+ this.abortController = new AbortController();
9
+ customAxios.defaults.signal = this.abortController.signal;
10
+ },
11
+ };
12
+
13
+ export default AbortHandler;
@@ -0,0 +1,67 @@
1
+ import axios from "axios";
2
+ import { getBearerToken } from "./useFetch";
3
+ import AbortHandler from "./AbortHandler";
4
+
5
+ let baseURL =
6
+ typeof import.meta !== "undefined"
7
+ ? (import.meta.env.VITE_BACKEND_URL ?? "")
8
+ : "";
9
+ export const setBaseURL = (c: { backendURL?: string }) => {
10
+ if (c.backendURL) {
11
+ baseURL = c.backendURL;
12
+ customAxios.defaults.baseURL = baseURL;
13
+ }
14
+ };
15
+ const customAxios = axios.create({
16
+ baseURL: baseURL,
17
+ signal: AbortHandler.abortController.signal, // Signal that is assiciated with any request to be made with this axios instance
18
+ });
19
+
20
+ // Request Interceptor
21
+ const requestHandler = (request: any) => {
22
+ const tokenData = getBearerToken();
23
+ const token = tokenData?.token ?? null; // Always retrieve the latest token
24
+ const expiresIn = tokenData?.expiresIn ?? null;
25
+
26
+ if (expiresIn) {
27
+ const timestamp = tokenData?.timestamp ?? null;
28
+ const now = Date.now();
29
+ if (expiresIn && now - timestamp > expiresIn * 1000) {
30
+ console.warn("Token has expired.");
31
+ localStorage.removeItem("logginToken");
32
+ return null;
33
+ }
34
+ }
35
+ request.headers = { ...request.headers };
36
+ if (token) {
37
+ request.headers.Authorization = `Bearer ${token}`;
38
+ }
39
+
40
+ // Handle FormData explicitly if needed
41
+ if (request.data instanceof FormData) {
42
+ const formData = request.data;
43
+ request.data = formData;
44
+ } else if (request.data) {
45
+ request.data = { ...(request.data ?? {}) };
46
+ }
47
+
48
+ return request;
49
+ };
50
+
51
+ // Response Interceptor
52
+ customAxios.interceptors.response.use(
53
+ (response) => response, // Resolve response as is
54
+ (error) => {
55
+ console.log("Error.....", error);
56
+ if (error.response?.status === 401) {
57
+ }
58
+ return Promise.reject(error); // Reject the error for further handling
59
+ },
60
+ );
61
+
62
+ // Attach Request Interceptor
63
+ customAxios.interceptors.request.use(requestHandler, (error) =>
64
+ Promise.reject(error),
65
+ );
66
+
67
+ export default customAxios;
@@ -0,0 +1,65 @@
1
+ import customAxios from "./Axios";
2
+
3
+ const useFetch = async ({ url, method, data }:any) => {
4
+ let _data = data ?? {};
5
+ try {
6
+ let response=null;
7
+ const uniformMethod = method.toLowerCase();
8
+ if (uniformMethod === 'get') {
9
+ const params = generateParams(_data ?? {});
10
+ response = await customAxios.get(`${url}${params}`);
11
+ } else
12
+ response = await customAxios.post(url, _data);
13
+
14
+ return response?.data ?? { Empty: 'Empty' };
15
+ } catch (err) {
16
+ console.error(err);
17
+ return { success: false, error: err };
18
+ }
19
+ };
20
+
21
+ const generateParams = (params:any={}) => {
22
+ try {
23
+
24
+ let data = "?";
25
+ for (let key in params) {
26
+ if (Object.hasOwnProperty.call(params, key)) {
27
+ if (params[key]) {
28
+ if (Array.isArray(params[key])) {
29
+ const elements = params[key] ;
30
+ for (const ele of elements) {
31
+ data += `${key}[]=${ele}&`;
32
+ }
33
+ } else {
34
+ data += `${key}=${params[key]}&`;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ return data.slice(0, -1);
40
+ } catch (error) {
41
+ console.error(error);
42
+
43
+ }
44
+ };
45
+
46
+ function setBearerToken(name = { token: null }) {
47
+ if (typeof name !== "object" || name === null || Array.isArray(name))
48
+ throw new TypeError("setBearerToken expects an object {token} with a 'token' property.");
49
+
50
+ const tokenObj = { token: null, ...name,timestamp: Date.now() };
51
+ localStorage.setItem("logginToken", JSON.stringify(tokenObj));
52
+ }
53
+
54
+ function getBearerToken() {
55
+ const token = localStorage.getItem('logginToken');
56
+ try {
57
+ return token ? JSON.parse(token) : null;
58
+ } catch (e) {
59
+ console.error('Invalid token format in localStorage:', e);
60
+ return null;
61
+ }
62
+ }
63
+
64
+
65
+ export { useFetch, generateParams, setBearerToken, getBearerToken };
@@ -0,0 +1,170 @@
1
+ import { create } from "zustand";
2
+ import axios from "./GlobalScripts/Axios";
3
+
4
+
5
+ const ZpStore = create((set, get) => ({
6
+ loading: false,
7
+ stateValue: {},
8
+ checkQueriesInQue: {},
9
+ isThereAnyDataChangeInAform: false,
10
+
11
+ setStateValue: (key, value) =>
12
+ set((state) => ({
13
+ stateValue: { ...state.stateValue, [key]: value },
14
+ })),
15
+
16
+ getStateItem: (key) => get().stateValue[key],
17
+ // getStateItem: (key) => get().stateValue[key],
18
+ sleep: (ms) => new Promise((res) => setTimeout(res, ms)),
19
+
20
+ validateLength: (obj) => {
21
+ if (Array.isArray(obj)) return obj.length;
22
+ if (typeof obj === "object") return Object.keys(obj).length;
23
+ return 0;
24
+ },
25
+
26
+ callApiData: async (
27
+ stateKey,
28
+ callApiKey,
29
+ req,
30
+ paginated = false,
31
+ useSession = false,
32
+ ) => {
33
+ const { checkQueriesInQue } = get();
34
+ if (get().getStateItem("checkQueriesInQue")?.[callApiKey]) {
35
+ console.warn(
36
+ `************************************* dont call this api again ${req["url"]} 🛩️ *************************************`,
37
+ req,
38
+ );
39
+ return; //get().getStateItem(stateKey)
40
+ }
41
+
42
+ get().setStateValue("loading", true);
43
+ get().setStateValue("checkQueriesInQue", {
44
+ ...checkQueriesInQue,
45
+ [callApiKey]: callApiKey,
46
+ });
47
+ const res = await axios(req);
48
+ if (res?.status == 200) {
49
+ set({ [stateKey]: res?.data });
50
+ get().setStateValue(stateKey, res?.data);
51
+ // console.log( ({ [stateKey]: res.data }))
52
+ if (useSession) {
53
+ sessionStorage.setItem(stateKey, JSON.stringify(res?.data));
54
+ }
55
+ } else {
56
+ console.error(res);
57
+ }
58
+ get().cleareQueApi(callApiKey);
59
+ set({ loading: false });
60
+
61
+ return res;
62
+ },
63
+ cleareQueApi: (callApiKey) => {
64
+ const currentQueue = get().stateValue.checkQueriesInQue || {};
65
+ const newQueue = { ...currentQueue };
66
+ delete newQueue[callApiKey];
67
+ get().setStateValue("checkQueriesInQue", newQueue);
68
+ },
69
+
70
+ complatedTheCall: async (
71
+ state,
72
+ stateKey,
73
+ key,
74
+ req,
75
+ paginated,
76
+ useSession,
77
+ onData,
78
+ ) => {
79
+ const res = await state.callApiData(
80
+ stateKey,
81
+ key,
82
+ req,
83
+ paginated,
84
+ useSession,
85
+ );
86
+ if (res?.status == 200) {
87
+ onData && onData(res?.data);
88
+
89
+ return res?.data;
90
+ }
91
+
92
+ onData && onData([]);
93
+ return res?.data;
94
+ },
95
+
96
+ stateGeneratorApi: async (
97
+ { reload, stateKey, req, time = 0, paginated = false, mStore = {} },
98
+ onData,
99
+ ) => {
100
+ set({ [stateKey]: [] });
101
+ const key = JSON.stringify(req); // put it out to be seen in error section
102
+ try {
103
+ const useSession = mStore?.mUse;
104
+ const state = get();
105
+ set({ loading: true });
106
+
107
+ if (useSession) {
108
+ const data = JSON.parse(sessionStorage.getItem(stateKey) || "{}");
109
+
110
+ if (state.validateLength(data)) {
111
+
112
+ if (onData) {
113
+ onData(data);
114
+ }
115
+
116
+ set({ [stateKey]: data });
117
+ get().setStateValue(stateKey, data);
118
+ console.log(data)
119
+ if (!reload) return data;
120
+ }
121
+ }
122
+
123
+ // Use existing if not reloading
124
+ const existingData = state?.[stateKey]??get().getStateItem(stateKey);
125
+ // console.log({existingData});
126
+ if (state.validateLength(existingData)) {
127
+ if (onData) onData(existingData);
128
+ // set({ loading: false })
129
+ }
130
+
131
+ // Fetch new data
132
+ if (reload && time > 0) {
133
+ setTimeout(() => {
134
+ get().complatedTheCall(
135
+ state,
136
+ stateKey,
137
+ key,
138
+ req,
139
+ paginated,
140
+ useSession,
141
+ onData,
142
+ );
143
+ }, time * 1000);
144
+ }
145
+ return await get().complatedTheCall(
146
+ state,
147
+ stateKey,
148
+ key,
149
+ req,
150
+ paginated,
151
+ useSession,
152
+ onData,
153
+ );
154
+ } catch (error) {
155
+ get().cleareQueApi(key);
156
+ // get().cleareQueApi(stateKey)
157
+ if (onData) onData([]);
158
+ console.error(error);
159
+ }
160
+ },
161
+ }));
162
+
163
+ // console.log(import.meta.env.VITE_BACKEND_URL);
164
+
165
+ ;
166
+ export const Store = ZpStore
167
+
168
+ export default function usePomZStore() {
169
+ return Store();
170
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "jsx": "react-jsx",
6
+ "declaration": true,
7
+ "outDir": "dist",
8
+ "moduleResolution": "Node",
9
+ "strict": true,
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["src"]
13
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import path from "path";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ build: {
8
+ lib: {
9
+ entry: path.resolve(__dirname, "src/index.ts"),
10
+ name: "septor-store-react",
11
+ fileName: "index",
12
+ },
13
+ rollupOptions: {
14
+ external: ["react", "react-dom"],
15
+ output: {
16
+ globals: {
17
+ react: "React",
18
+ "react-dom": "ReactDOM",
19
+ },
20
+ },
21
+ },
22
+ },
23
+ });