adpro-react 0.0.23-rc.15 → 0.0.23-rc.16

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.
@@ -32,7 +32,7 @@ React keys must be passed directly to JSX without using spread:
32
32
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){const n=(this[ol]=this[ol]={accessors:{}}).accessors,o=this.prototype;function a(i){const l=z2(i);n[l]||(t7(o,i),n[l]=!0)}return B.isArray(t)?t.forEach(a):a(t),this}};Pt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(Pt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});B.freezeMethods(Pt);function Oo(e,t){const r=this||y1,n=t||r,o=Pt.from(n.headers);let a=n.data;return B.forEach(e,function(l){a=l.call(r,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function Z0(e){return!!(e&&e.__CANCEL__)}function D2(e,t,r){be.call(this,e??"canceled",be.ERR_CANCELED,t,r),this.name="CanceledError"}B.inherits(D2,be,{__CANCEL__:!0});function U0(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new be("Request failed with status code "+r.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function r7(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function n7(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),f=n[a];i||(i=u),r[o]=c,n[o]=u;let C=a,g=0;for(;C!==o;)g+=r[C++],C=C%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),u-i<t)return;const b=f&&u-f;return b?Math.round(g*1e3/b):void 0}}function o7(e,t){let r=0,n=1e3/t,o,a;const i=(u,f=Date.now())=>{r=f,o=null,a&&(clearTimeout(a),a=null),e.apply(null,u)};return[(...u)=>{const f=Date.now(),C=f-r;C>=n?i(u,f):(o=u,a||(a=setTimeout(()=>{a=null,i(o)},n-C)))},()=>o&&i(o)]}const ln=(e,t,r=3)=>{let n=0;const o=n7(50,250);return o7(a=>{const i=a.loaded,l=a.lengthComputable?a.total:void 0,c=i-n,u=o(c),f=i<=l;n=i;const C={loaded:i,total:l,progress:l?i/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&f?(l-i)/u:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(C)},r)},al=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},il=e=>(...t)=>B.asap(()=>e(...t)),a7=Et.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Et.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Et.origin),Et.navigator&&/(msie|trident)/i.test(Et.navigator.userAgent)):()=>!0,i7=Et.hasStandardBrowserEnv?{write(e,t,r,n,o,a){const i=[e+"="+encodeURIComponent(t)];B.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),B.isString(n)&&i.push("path="+n),B.isString(o)&&i.push("domain="+o),a===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function l7(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function s7(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function W0(e,t,r){let n=!l7(t);return e&&n||r==!1?s7(e,t):t}const ll=e=>e instanceof Pt?{...e}:e;function Kr(e,t){t=t||{};const r={};function n(u,f,C,g){return B.isPlainObject(u)&&B.isPlainObject(f)?B.merge.call({caseless:g},u,f):B.isPlainObject(f)?B.merge({},f):B.isArray(f)?f.slice():f}function o(u,f,C,g){if(B.isUndefined(f)){if(!B.isUndefined(u))return n(void 0,u,C,g)}else return n(u,f,C,g)}function a(u,f){if(!B.isUndefined(f))return n(void 0,f)}function i(u,f){if(B.isUndefined(f)){if(!B.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function l(u,f,C){if(C in t)return n(u,f);if(C in e)return n(void 0,u)}const c={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(u,f,C)=>o(ll(u),ll(f),C,!0)};return B.forEach(Object.keys(Object.assign({},e,t)),function(f){const C=c[f]||o,g=C(e[f],t[f],f);B.isUndefined(g)&&C!==l||(r[f]=g)}),r}const q0=e=>{const t=Kr({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:a,headers:i,auth:l}=t;t.headers=i=Pt.from(i),t.url=j0(W0(t.baseURL,t.url),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(B.isFormData(r)){if(Et.hasStandardBrowserEnv||Et.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((c=i.getContentType())!==!1){const[u,...f]=c?c.split(";").map(C=>C.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...f].join("; "))}}if(Et.hasStandardBrowserEnv&&(n&&B.isFunction(n)&&(n=n(t)),n||n!==!1&&a7(t.url))){const u=o&&a&&i7.read(a);u&&i.set(o,u)}return t},c7=typeof XMLHttpRequest<"u",u7=c7&&function(e){return new Promise(function(r,n){const o=q0(e);let a=o.data;const i=Pt.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,f,C,g,b,h;function d(){b&&b(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let v=new XMLHttpRequest;v.open(o.method.toUpperCase(),o.url,!0),v.timeout=o.timeout;function O(){if(!v)return;const E=Pt.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),y={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:E,config:e,request:v};U0(function(D){r(D),d()},function(D){n(D),d()},y),v=null}"onloadend"in v?v.onloadend=O:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(O)},v.onabort=function(){v&&(n(new be("Request aborted",be.ECONNABORTED,e,v)),v=null)},v.onerror=function(){n(new be("Network Error",be.ERR_NETWORK,e,v)),v=null},v.ontimeout=function(){let S=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const y=o.transitional||_0;o.timeoutErrorMessage&&(S=o.timeoutErrorMessage),n(new be(S,y.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,v)),v=null},a===void 0&&i.setContentType(null),"setRequestHeader"in v&&B.forEach(i.toJSON(),function(S,y){v.setRequestHeader(y,S)}),B.isUndefined(o.withCredentials)||(v.withCredentials=!!o.withCredentials),l&&l!=="json"&&(v.responseType=o.responseType),u&&([g,h]=ln(u,!0),v.addEventListener("progress",g)),c&&v.upload&&([C,b]=ln(c),v.upload.addEventListener("progress",C),v.upload.addEventListener("loadend",b)),(o.cancelToken||o.signal)&&(f=E=>{v&&(n(!E||E.type?new D2(null,e,v):E),v.abort(),v=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const w=r7(o.url);if(w&&Et.protocols.indexOf(w)===-1){n(new be("Unsupported protocol "+w+":",be.ERR_BAD_REQUEST,e));return}v.send(a||null)})},d7=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,o;const a=function(u){if(!o){o=!0,l();const f=u instanceof Error?u:this.reason;n.abort(f instanceof be?f:new D2(f instanceof Error?f.message:f))}};let i=t&&setTimeout(()=>{i=null,a(new be(`timeout ${t} of ms exceeded`,be.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));const{signal:c}=n;return c.unsubscribe=()=>B.asap(l),c}},p7=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},f7=async function*(e,t){for await(const r of m7(e))yield*p7(r,t)},m7=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},sl=(e,t,r,n)=>{const o=f7(e,t);let a=0,i,l=c=>{i||(i=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:f}=await o.next();if(u){l(),c.close();return}let C=f.byteLength;if(r){let g=a+=C;r(g)}c.enqueue(new Uint8Array(f))}catch(u){throw l(u),u}},cancel(c){return l(c),o.return()}},{highWaterMark:2})},kn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",G0=kn&&typeof ReadableStream=="function",C7=kn&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Y0=(e,...t)=>{try{return!!e(...t)}catch{return!1}},h7=G0&&Y0(()=>{let e=!1;const t=new Request(Et.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),cl=64*1024,ia=G0&&Y0(()=>B.isReadableStream(new Response("").body)),sn={stream:ia&&(e=>e.body)};kn&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!sn[t]&&(sn[t]=B.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new be(`Response type '${t}' is not supported`,be.ERR_NOT_SUPPORT,n)})})})(new Response);const g7=async e=>{if(e==null)return 0;if(B.isBlob(e))return e.size;if(B.isSpecCompliantForm(e))return(await new Request(Et.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(B.isArrayBufferView(e)||B.isArrayBuffer(e))return e.byteLength;if(B.isURLSearchParams(e)&&(e=e+""),B.isString(e))return(await C7(e)).byteLength},b7=async(e,t)=>{const r=B.toFiniteNumber(e.getContentLength());return r??g7(t)},y7=kn&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:a,timeout:i,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:f,withCredentials:C="same-origin",fetchOptions:g}=q0(e);u=u?(u+"").toLowerCase():"text";let b=d7([o,a&&a.toAbortSignal()],i),h;const d=b&&b.unsubscribe&&(()=>{b.unsubscribe()});let v;try{if(c&&h7&&r!=="get"&&r!=="head"&&(v=await b7(f,n))!==0){let y=new Request(t,{method:"POST",body:n,duplex:"half"}),k;if(B.isFormData(n)&&(k=y.headers.get("content-type"))&&f.setContentType(k),y.body){const[D,z]=al(v,ln(il(c)));n=sl(y.body,cl,D,z)}}B.isString(C)||(C=C?"include":"omit");const O="credentials"in Request.prototype;h=new Request(t,{...g,signal:b,method:r.toUpperCase(),headers:f.normalize().toJSON(),body:n,duplex:"half",credentials:O?C:void 0});let w=await fetch(h);const E=ia&&(u==="stream"||u==="response");if(ia&&(l||E&&d)){const y={};["status","statusText","headers"].forEach(N=>{y[N]=w[N]});const k=B.toFiniteNumber(w.headers.get("content-length")),[D,z]=l&&al(k,ln(il(l),!0))||[];w=new Response(sl(w.body,cl,D,()=>{z&&z(),d&&d()}),y)}u=u||"text";let S=await sn[B.findKey(sn,u)||"text"](w,e);return!E&&d&&d(),await new Promise((y,k)=>{U0(y,k,{data:S,headers:Pt.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:h})})}catch(O){throw d&&d(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,e,h),{cause:O.cause||O}):be.from(O,O&&O.code,e,h)}}),la={http:A4,xhr:u7,fetch:y7};B.forEach(la,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ul=e=>`- ${e}`,v7=e=>B.isFunction(e)||e===null||e===!1,K0={getAdapter:e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let a=0;a<t;a++){r=e[a];let i;if(n=r,!v7(r)&&(n=la[(i=String(r)).toLowerCase()],n===void 0))throw new be(`Unknown adapter '${i}'`);if(n)break;o[i||"#"+a]=n}if(!n){const a=Object.entries(o).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let i=t?a.length>1?`since :
33
33
  `+a.map(ul).join(`
34
34
  `):" "+ul(a[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:la};function Eo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new D2(null,e)}function dl(e){return Eo(e),e.headers=Pt.from(e.headers),e.data=Oo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),K0.getAdapter(e.adapter||y1.adapter)(e).then(function(n){return Eo(e),n.data=Oo.call(e,e.transformResponse,n),n.headers=Pt.from(n.headers),n},function(n){return Z0(n)||(Eo(e),n&&n.response&&(n.response.data=Oo.call(e,e.transformResponse,n.response),n.response.headers=Pt.from(n.response.headers))),Promise.reject(n)})}const Q0="1.8.2",Dn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Dn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const pl={};Dn.transitional=function(t,r,n){function o(a,i){return"[Axios v"+Q0+"] Transitional option '"+a+"'"+i+(n?". "+n:"")}return(a,i,l)=>{if(t===!1)throw new be(o(i," has been removed"+(r?" in "+r:"")),be.ERR_DEPRECATED);return r&&!pl[i]&&(pl[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(a,i,l):!0}};Dn.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function x7(e,t,r){if(typeof e!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const a=n[o],i=t[a];if(i){const l=e[a],c=l===void 0||i(l,a,e);if(c!==!0)throw new be("option "+a+" must be "+c,be.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new be("Unknown option "+a,be.ERR_BAD_OPTION)}}const J1={assertOptions:x7,validators:Dn},or=J1.validators;let Wr=class{constructor(t){this.defaults=t,this.interceptors={request:new nl,response:new nl}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const a=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?a&&!String(n.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(n.stack+=`
35
- `+a):n.stack=a}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Kr(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:a}=r;n!==void 0&&J1.assertOptions(n,{silentJSONParsing:or.transitional(or.boolean),forcedJSONParsing:or.transitional(or.boolean),clarifyTimeoutError:or.transitional(or.boolean)},!1),o!=null&&(B.isFunction(o)?r.paramsSerializer={serialize:o}:J1.assertOptions(o,{encode:or.function,serialize:or.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),J1.assertOptions(r,{baseUrl:or.spelling("baseURL"),withXsrfToken:or.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=a&&B.merge(a.common,a[r.method]);a&&B.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),r.headers=Pt.concat(i,a);const l=[];let c=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(r)===!1||(c=c&&d.synchronous,l.unshift(d.fulfilled,d.rejected))});const u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});let f,C=0,g;if(!c){const h=[dl.bind(this),void 0];for(h.unshift.apply(h,l),h.push.apply(h,u),g=h.length,f=Promise.resolve(r);C<g;)f=f.then(h[C++],h[C++]);return f}g=l.length;let b=r;for(C=0;C<g;){const h=l[C++],d=l[C++];try{b=h(b)}catch(v){d.call(this,v);break}}try{f=dl.call(this,b)}catch(h){return Promise.reject(h)}for(C=0,g=u.length;C<g;)f=f.then(u[C++],u[C++]);return f}getUri(t){t=Kr(this.defaults,t);const r=W0(t.baseURL,t.url,t.allowAbsoluteUrls);return j0(r,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){Wr.prototype[t]=function(r,n){return this.request(Kr(n||{},{method:t,url:r,data:(n||{}).data}))}});B.forEach(["post","put","patch"],function(t){function r(n){return function(a,i,l){return this.request(Kr(l||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Wr.prototype[t]=r(),Wr.prototype[t+"Form"]=r(!0)});let O7=class J0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(a){r=a});const n=this;this.promise.then(o=>{if(!n._listeners)return;let a=n._listeners.length;for(;a-- >0;)n._listeners[a](o);n._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(l=>{n.subscribe(l),a=l}).then(o);return i.cancel=function(){n.unsubscribe(a)},i},t(function(a,i,l){n.reason||(n.reason=new D2(a,i,l),r(n.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 r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new J0(function(o){t=o}),cancel:t}}};function E7(e){return function(r){return e.apply(null,r)}}function S7(e){return B.isObject(e)&&e.isAxiosError===!0}const sa={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};Object.entries(sa).forEach(([e,t])=>{sa[t]=e});function X0(e){const t=new Wr(e),r=R0(Wr.prototype.request,t);return B.extend(r,Wr.prototype,t,{allOwnKeys:!0}),B.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return X0(Kr(e,o))},r}const rt=X0(y1);rt.Axios=Wr;rt.CanceledError=D2;rt.CancelToken=O7;rt.isCancel=Z0;rt.VERSION=Q0;rt.toFormData=Pn;rt.AxiosError=be;rt.Cancel=rt.CanceledError;rt.all=function(t){return Promise.all(t)};rt.spread=E7;rt.isAxiosError=S7;rt.mergeConfig=Kr;rt.AxiosHeaders=Pt;rt.formToJSON=e=>z0(B.isHTMLForm(e)?new FormData(e):e);rt.getAdapter=K0.getAdapter;rt.HttpStatusCode=sa;rt.default=rt;const{Axios:Zv,AxiosError:Uv,CanceledError:Wv,isCancel:qv,CancelToken:Gv,VERSION:Yv,all:Kv,Cancel:Qv,isAxiosError:Jv,spread:Xv,toFormData:ex,AxiosHeaders:tx,HttpStatusCode:rx,formToJSON:nx,getAdapter:ox,mergeConfig:ax}=rt;let _r=`${window.location.href.split("#")[0].toLowerCase().split("v3")[0]}v3/adpro/api`;const es={async Send(e){const{serviceUrl:t,body:r,method:n="get",defaultToken:o=!0,hideError:a=!1,srm:i,core:l}=e;let{headers:c}=e;window.parent.location.href.includes("localhost")&&(l?_r="http://localhost:3500/core/api":_r="http://localhost:3500");const u=rt.create({baseURL:i?`${_r.toLowerCase().replace("/adpro/","/srm/")}`:l?`${_r.toLowerCase().replace("/adpro/api","/adpro/core/api")}`:_r});return c=c||{},o&&(c.Authorization=await ti(window)),await u[n](t,L7(r,n,c),{headers:c,validateStatus:function(C){return C<400}}).then(function(C){const{data:g,status:b}=C;return g||{data:null,httpCode:b,message:"Transacción exitosa",success:!0}}).catch(C=>{throw{data:C,httpCode:500,message:"Ha ocurrido un error en la petición",success:!1}}).finally(function(){})}},L7=(e,t,r)=>{const n=e;for(var o in e)e[o]===""&&(e[o]=null);return t==="get"||t==="delete"?{params:n,headers:r,data:n}:n},ti=async e=>{let t="";return window.parent.location.href.includes("localhost")?(_r="http://localhost:3500",`Bearer ${(await rt.get(`${_r}/token`)).data}`):(e.getToken!=null&&e.getToken!=null?t=e.getToken():(e.parent.getToken!=null&&e.parent.getToken!=null&&(t=e.parent.getToken()),t=await ti(e)),t)},w7=(e,t,r)=>e[t]!=="-1"&&e[t]!=="0"&&e[t]!==-1?e:r&&(r[t]==="-1"||r[t]===-1)?r:e;function ts(e){const{type:t,action:r="search",value:n,inputValue:o,handleValue:a,labelKey:i,labelText:l,optionAll:c}=e,u=t==="request"?e.request:null,f=t==="list"?e.list:null,[C,g]=p.useState(w7(n,i,c)),[b,h]=p.useState(o||""),[d,v]=p.useState(f||[]),[O,w]=p.useState("input"),[E,S]=p.useState(!1),[y,k]=p.useState(!1);p.useEffect(()=>{t==="list"?D(d):r==="all"&&N(V=>D(V))},[]),p.useEffect(()=>{t==="list"||r==="all"?z(d):c?b!==""&&(O==="input"||O==="reset"||O==="selectOption")&&g(n):g(n)},[n]),p.useEffect(()=>{let V=null;return t=="request"&&r==="search"&&b&&O==="input"&&S(!0),r==="search"&&b&&O==="input"&&(V=setTimeout(()=>{N()},800)),()=>{S(!1),V&&clearInterval(V)}},[b]),p.useEffect(()=>{f&&f.length>0?v(f):v([])},[f]);const D=p.useCallback(V=>{if(n){const $=n||"",_=V.find(G=>G[i]==$);_&&(g(_),h(_[l]))}},[n,i,l]),z=p.useCallback(V=>{if(n){const $=n||"",_=V.find(G=>G[i]==$);_&&(g(_),h(_[l]))}else g(null),h("")},[n,i,l]),N=p.useCallback(V=>{if(u){if(t==="request"&&r==="search"&&S(!0),t==="request"&&r==="all"&&d.length>0)return;let $=b.trim();if(($.trim()===""||$===" "||$===""||$==="-1"||$.trim()==="Todos")&&($="_"),C&&C[l]===$&&r==="search"){v([C]),S(!1);return}u.body={[u.filterName||"filter"]:$},es.Send(u).then(_=>{if(_){let G=_;G=u!=null&&G.length>20?G.slice(0,20):G??[],G.length===void 0&&(G=[]),v(G),V&&V(G)}S(!1)})}},[b,d,u,r,t,E]),m=V=>{V&&(g(V),a&&a(V))},P=p.useCallback(V=>{V?h(V):H()},[r,t]),A=p.useCallback(V=>{w(V)},[]);p.useEffect(()=>{if(t==="list"&&r==="search"&&O==="input"&&f)if(b.trim()==="")v(f);else{const V=f.filter($=>String($[l]).toLowerCase().includes(b.toLowerCase()));v(V)}},[b]);const H=()=>{if(t==="request")c?a&&a(c):(g(null),a&&a(null)),h(""),v([]),N();else if(f)if(c){const V=f.find($=>$[i]=="-1");V?(g(V),h(V[l]),a&&a(V)):(h(""),g(C||n),a&&a(C||n))}else{const V=n||"",$=f.find(_=>_[i]==V);$?(g($),h($[l]),a&&a($)):(h(""),g(C),a&&a(C))}};return p.useEffect(()=>{y?t==="request"&&N():(t==="list"&&r==="search"&&(g(C),h(C?C[l]:""),b===""&&v(f||[])),t==="request"&&(c?((O==="clear"||O==="blur")&&(n[i]==="-1"||n[i]===-1)&&(g(c),h(c[l]),a&&a(c)),O==="input"&&b===""&&(n[i]==="-1"||n[i]===-1)&&(g(c),h(c[l]),a&&a(c))):(g(C),h(C?C[l]:""))))},[y]),{dataList:d,loading:E,isFocused:y,autocompleteValue:C,textFieldValue:b,handleAutocompleteValue:m,handleTextFieldValue:P,handleReasonChangeTextField:A,setIsFocused:k,clearValues:H}}function A2(e,t){return process.env.NODE_ENV==="production"?()=>null:function(...n){return e(...n)||t(...n)}}var $1={exports:{}},$e={};/**
35
+ `+a):n.stack=a}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Kr(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:a}=r;n!==void 0&&J1.assertOptions(n,{silentJSONParsing:or.transitional(or.boolean),forcedJSONParsing:or.transitional(or.boolean),clarifyTimeoutError:or.transitional(or.boolean)},!1),o!=null&&(B.isFunction(o)?r.paramsSerializer={serialize:o}:J1.assertOptions(o,{encode:or.function,serialize:or.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),J1.assertOptions(r,{baseUrl:or.spelling("baseURL"),withXsrfToken:or.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=a&&B.merge(a.common,a[r.method]);a&&B.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),r.headers=Pt.concat(i,a);const l=[];let c=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(r)===!1||(c=c&&d.synchronous,l.unshift(d.fulfilled,d.rejected))});const u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});let f,C=0,g;if(!c){const h=[dl.bind(this),void 0];for(h.unshift.apply(h,l),h.push.apply(h,u),g=h.length,f=Promise.resolve(r);C<g;)f=f.then(h[C++],h[C++]);return f}g=l.length;let b=r;for(C=0;C<g;){const h=l[C++],d=l[C++];try{b=h(b)}catch(v){d.call(this,v);break}}try{f=dl.call(this,b)}catch(h){return Promise.reject(h)}for(C=0,g=u.length;C<g;)f=f.then(u[C++],u[C++]);return f}getUri(t){t=Kr(this.defaults,t);const r=W0(t.baseURL,t.url,t.allowAbsoluteUrls);return j0(r,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){Wr.prototype[t]=function(r,n){return this.request(Kr(n||{},{method:t,url:r,data:(n||{}).data}))}});B.forEach(["post","put","patch"],function(t){function r(n){return function(a,i,l){return this.request(Kr(l||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Wr.prototype[t]=r(),Wr.prototype[t+"Form"]=r(!0)});let O7=class J0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(a){r=a});const n=this;this.promise.then(o=>{if(!n._listeners)return;let a=n._listeners.length;for(;a-- >0;)n._listeners[a](o);n._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(l=>{n.subscribe(l),a=l}).then(o);return i.cancel=function(){n.unsubscribe(a)},i},t(function(a,i,l){n.reason||(n.reason=new D2(a,i,l),r(n.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 r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new J0(function(o){t=o}),cancel:t}}};function E7(e){return function(r){return e.apply(null,r)}}function S7(e){return B.isObject(e)&&e.isAxiosError===!0}const sa={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};Object.entries(sa).forEach(([e,t])=>{sa[t]=e});function X0(e){const t=new Wr(e),r=R0(Wr.prototype.request,t);return B.extend(r,Wr.prototype,t,{allOwnKeys:!0}),B.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return X0(Kr(e,o))},r}const rt=X0(y1);rt.Axios=Wr;rt.CanceledError=D2;rt.CancelToken=O7;rt.isCancel=Z0;rt.VERSION=Q0;rt.toFormData=Pn;rt.AxiosError=be;rt.Cancel=rt.CanceledError;rt.all=function(t){return Promise.all(t)};rt.spread=E7;rt.isAxiosError=S7;rt.mergeConfig=Kr;rt.AxiosHeaders=Pt;rt.formToJSON=e=>z0(B.isHTMLForm(e)?new FormData(e):e);rt.getAdapter=K0.getAdapter;rt.HttpStatusCode=sa;rt.default=rt;const{Axios:Zv,AxiosError:Uv,CanceledError:Wv,isCancel:qv,CancelToken:Gv,VERSION:Yv,all:Kv,Cancel:Qv,isAxiosError:Jv,spread:Xv,toFormData:ex,AxiosHeaders:tx,HttpStatusCode:rx,formToJSON:nx,getAdapter:ox,mergeConfig:ax}=rt;let _r=`${window.location.href.split("#")[0].toLowerCase().split("v3")[0]}v3/adpro/api`;const es={async Send(e){const{serviceUrl:t,body:r,method:n="get",defaultToken:o=!0,hideError:a=!1,srm:i,core:l}=e;let{headers:c}=e;window.parent.location.href.includes("localhost")&&(l?_r="http://localhost:3500/core/api":_r="http://localhost:3500");const u=rt.create({baseURL:i?`${_r.toLowerCase().replace("/adpro/","/srm/")}`:l?`${_r.toLowerCase().replace("/adpro/api","/adpro/core/api")}`:_r});return c=c||{},o&&(c.Authorization=await ti(window)),await u[n](t,L7(r,n,c),{headers:c,validateStatus:function(C){return C<400}}).then(function(C){const{data:g,status:b}=C;return g||{data:null,httpCode:b,message:"Transacción exitosa",success:!0}}).catch(C=>{throw{data:C,httpCode:500,message:"Ha ocurrido un error en la petición",success:!1}}).finally(function(){})}},L7=(e,t,r)=>{const n=e;for(var o in e)e[o]===""&&(e[o]=null);return t==="get"||t==="delete"?{params:n,headers:r,data:n}:n},ti=async e=>{let t="";return window.parent.location.href.includes("localhost")?(_r="http://localhost:3500",`Bearer ${(await rt.get(`${_r}/token`)).data}`):(e.getToken!=null&&e.getToken!=null?t=e.getToken():(e.parent.getToken!=null&&e.parent.getToken!=null&&(t=e.parent.getToken()),t=await ti(e)),t)},w7=(e,t,r)=>e[t]!=="-1"&&e[t]!=="0"&&e[t]!==-1?e:r&&(r[t]==="-1"||r[t]===-1)?r:e;function ts(e){const{type:t,action:r="search",value:n,inputValue:o,handleValue:a,labelKey:i,labelText:l,optionAll:c}=e,u=t==="request"?e.request:null,f=t==="list"?e.list:null,[C,g]=p.useState(w7(n,i,c)),[b,h]=p.useState(o||""),[d,v]=p.useState(f||[]),[O,w]=p.useState("input"),[E,S]=p.useState(!1),[y,k]=p.useState(!1);p.useEffect(()=>{t==="list"?D(d):r==="all"&&N(V=>D(V))},[]),p.useEffect(()=>{t==="list"||r==="all"?z(d):c?b!==""&&(O==="input"||O==="reset"||O==="selectOption")&&g(n):g(n)},[n]),p.useEffect(()=>{let V=null;return t=="request"&&r==="search"&&b&&O==="input"&&S(!0),r==="search"&&b&&O==="input"&&(V=setTimeout(()=>{N()},800)),()=>{S(!1),V&&clearInterval(V)}},[b]),p.useEffect(()=>{f&&f.length>0?v(f):v([])},[f]);const D=p.useCallback(V=>{if(n){const $=n?n[i]:"",_=V.find(G=>G[i]==$);_&&(g(_),h(_[l]))}},[n,i,l]),z=p.useCallback(V=>{if(n){const $=n[i]||"",_=V.find(G=>G[i]==$);_&&(g(_),h(_[l]))}else g(null),h("")},[n,i,l]),N=p.useCallback(V=>{if(u){if(t==="request"&&r==="search"&&S(!0),t==="request"&&r==="all"&&d.length>0)return;let $=b.trim();if(($.trim()===""||$===" "||$===""||$==="-1"||$.trim()==="Todos")&&($="_"),C&&C[l]===$&&r==="search"){v([C]),S(!1);return}u.body={[u.filterName||"filter"]:$},es.Send(u).then(_=>{if(_){let G=_;G=u!=null&&G.length>20?G.slice(0,20):G??[],G.length===void 0&&(G=[]),v(G),V&&V(G)}S(!1)})}},[b,d,u,r,t,E]),m=V=>{V&&(g(V),a&&a(V))},P=p.useCallback(V=>{V?h(V):H()},[r,t]),A=p.useCallback(V=>{w(V)},[]);p.useEffect(()=>{if(t==="list"&&r==="search"&&O==="input"&&f)if(b.trim()==="")v(f);else{const V=f.filter($=>String($[l]).toLowerCase().includes(b.toLowerCase()));v(V)}},[b]);const H=()=>{if(t==="request")c?a&&a(c):(g(null),a&&a(null)),h(""),v([]),N();else if(f)if(c){const V=f.find($=>$[i]=="-1");V?(g(V),h(V[l]),a&&a(V)):(h(""),g(C||n),a&&a(C||n))}else{const V=n?n[i]:"",$=f.find(_=>_[i]==V);$?(g($),h($[l]),a&&a($)):(h(""),g(C),a&&a(C))}};return p.useEffect(()=>{y?t==="request"&&N():(t==="list"&&r==="search"&&(g(C),h(C?C[l]:""),b===""&&v(f||[])),t==="request"&&(c?((O==="clear"||O==="blur")&&(n[i]==="-1"||n[i]===-1)&&(g(c),h(c[l]),a&&a(c)),O==="input"&&b===""&&(n[i]==="-1"||n[i]===-1)&&(g(c),h(c[l]),a&&a(c))):(g(C),h(C?C[l]:""))))},[y]),{dataList:d,loading:E,isFocused:y,autocompleteValue:C,textFieldValue:b,handleAutocompleteValue:m,handleTextFieldValue:P,handleReasonChangeTextField:A,setIsFocused:k,clearValues:H}}function A2(e,t){return process.env.NODE_ENV==="production"?()=>null:function(...n){return e(...n)||t(...n)}}var $1={exports:{}},$e={};/**
36
36
  * @license React
37
37
  * react-is.production.js
38
38
  *
@@ -2427,7 +2427,7 @@ function a5(e) {
2427
2427
  const D = M2(
2428
2428
  (V) => {
2429
2429
  if (n) {
2430
- const $ = n || "", _ = V.find((G) => G[i] == $);
2430
+ const $ = n ? n[i] : "", _ = V.find((G) => G[i] == $);
2431
2431
  _ && (g(_), h(_[l]));
2432
2432
  }
2433
2433
  },
@@ -2435,7 +2435,7 @@ function a5(e) {
2435
2435
  ), z = M2(
2436
2436
  (V) => {
2437
2437
  if (n) {
2438
- const $ = n || "", _ = V.find((G) => G[i] == $);
2438
+ const $ = n[i] || "", _ = V.find((G) => G[i] == $);
2439
2439
  _ && (g(_), h(_[l]));
2440
2440
  } else
2441
2441
  g(null), h("");
@@ -2488,7 +2488,7 @@ function a5(e) {
2488
2488
  const V = p.find(($) => $[i] == "-1");
2489
2489
  V ? (g(V), h(V[l]), a && a(V)) : (h(""), g(C || n), a && a(C || n));
2490
2490
  } else {
2491
- const V = n || "", $ = p.find((_) => _[i] == V);
2491
+ const V = n ? n[i] : "", $ = p.find((_) => _[i] == V);
2492
2492
  $ ? (g($), h($[l]), a && a($)) : (h(""), g(C), a && a(C));
2493
2493
  }
2494
2494
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adpro-react",
3
- "version": "0.0.23-rc.15",
3
+ "version": "0.0.23-rc.16",
4
4
  "author": "Joel Mateo Robles Atuesta",
5
5
  "main": "dist/adpro-react.cjs.js",
6
6
  "module": "dist/adpro-react.es.js",