@3sc/common-component 0.0.228 → 0.0.229

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.
package/dist/index.umd.js CHANGED
@@ -325,5 +325,5 @@ const theme2 = createTheme({ palette: {
325
325
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const o=new this(t);return n.forEach(s=>o.set(s)),o}static accessor(t){const o=(this[x2]=this[x2]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=Gi(a);o[l]||(F_(s,a),o[l]=!0)}return te.isArray(t)?t.forEach(i):i(t),this}};sn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(sn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(o){this[n]=o}}}),te.freezeMethods(sn);function Wp(e,t){const n=this||Yi,o=t||n,s=sn.from(o.headers);let i=o.data;return te.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function C2(e){return!!(e&&e.__CANCEL__)}function ps(e,t,n){Fe.call(this,e??"canceled",Fe.ERR_CANCELED,t,n),this.name="CanceledError"}te.inherits(ps,Fe,{__CANCEL__:!0});function w2(e,t,n){const o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(new Fe("Request failed with status code "+n.status,[Fe.ERR_BAD_REQUEST,Fe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function __(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function B_(e,t){e=e||10;const n=new Array(e),o=new Array(e);let s=0,i=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=o[i];a||(a=u),n[s]=c,o[s]=u;let p=i,f=0;for(;p!==s;)f+=n[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-a<t)return;const g=d&&u-d;return g?Math.round(f*1e3/g):void 0}}function V_(e,t){let n=0,o=1e3/t,s,i;const a=(u,d=Date.now())=>{n=d,s=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),p=d-n;p>=o?a(u,d):(s=u,i||(i=setTimeout(()=>{i=null,a(s)},o-p)))},()=>s&&a(s)]}const tc=(e,t,n=3)=>{let o=0;const s=B_(50,250);return V_(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-o,u=s(c),d=a<=l;o=a;const p={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(p)},n)},S2=(e,t)=>{const n=e!=null;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},T2=e=>(...t)=>te.asap(()=>e(...t)),z_=qt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,qt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,W_=qt.hasStandardBrowserEnv?{write(e,t,n,o,s,i){const a=[e+"="+encodeURIComponent(t)];te.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),te.isString(o)&&a.push("path="+o),te.isString(s)&&a.push("domain="+s),i===!0&&a.push("secure"),document.cookie=a.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 U_(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function H_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function E2(e,t,n){let o=!U_(t);return e&&(o||n==!1)?H_(e,t):t}const O2=e=>e instanceof sn?{...e}:e;function or(e,t){t=t||{};const n={};function o(u,d,p,f){return te.isPlainObject(u)&&te.isPlainObject(d)?te.merge.call({caseless:f},u,d):te.isPlainObject(d)?te.merge({},d):te.isArray(d)?d.slice():d}function s(u,d,p,f){if(te.isUndefined(d)){if(!te.isUndefined(u))return o(void 0,u,p,f)}else return o(u,d,p,f)}function i(u,d){if(!te.isUndefined(d))return o(void 0,d)}function a(u,d){if(te.isUndefined(d)){if(!te.isUndefined(u))return o(void 0,u)}else return o(void 0,d)}function l(u,d,p){if(p in t)return o(u,d);if(p in e)return o(void 0,u)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d,p)=>s(O2(u),O2(d),p,!0)};return te.forEach(Object.keys(Object.assign({},e,t)),function(d){const p=c[d]||s,f=p(e[d],t[d],d);te.isUndefined(f)&&p!==l||(n[d]=f)}),n}const k2=e=>{const t=or({},e);let{data:n,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=t;t.headers=a=sn.from(a),t.url=g2(E2(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(te.isFormData(n)){if(qt.hasStandardBrowserEnv||qt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(qt.hasStandardBrowserEnv&&(o&&te.isFunction(o)&&(o=o(t)),o||o!==!1&&z_(t.url))){const u=s&&i&&W_.read(i);u&&a.set(s,u)}return t},q_=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,o){const s=k2(e);let i=s.data;const a=sn.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,p,f,g,y;function h(){g&&g(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function w(){if(!b)return;const S=sn.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:S,config:e,request:b};w2(function(P){n(P),h()},function(P){o(P),h()},v),b=null}"onloadend"in b?b.onloadend=w:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(w)},b.onabort=function(){b&&(o(new Fe("Request aborted",Fe.ECONNABORTED,e,b)),b=null)},b.onerror=function(){o(new Fe("Network Error",Fe.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let E=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const v=s.transitional||b2;s.timeoutErrorMessage&&(E=s.timeoutErrorMessage),o(new Fe(E,v.clarifyTimeoutError?Fe.ETIMEDOUT:Fe.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&te.forEach(a.toJSON(),function(E,v){b.setRequestHeader(v,E)}),te.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),l&&l!=="json"&&(b.responseType=s.responseType),u&&([f,y]=tc(u,!0),b.addEventListener("progress",f)),c&&b.upload&&([p,g]=tc(c),b.upload.addEventListener("progress",p),b.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=S=>{b&&(o(!S||S.type?new ps(null,e,b):S),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const T=__(s.url);if(T&&qt.protocols.indexOf(T)===-1){o(new Fe("Unsupported protocol "+T+":",Fe.ERR_BAD_REQUEST,e));return}b.send(i||null)})},Y_=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let o=new AbortController,s;const i=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;o.abort(d instanceof Fe?d:new ps(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new Fe(`timeout ${t} of ms exceeded`,Fe.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=o;return c.unsubscribe=()=>te.asap(l),c}},G_=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let o=0,s;for(;o<n;)s=o+t,yield e.slice(o,s),o=s},K_=async function*(e,t){for await(const n of X_(e))yield*G_(n,t)},X_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:o}=await t.read();if(n)break;yield o}}finally{await t.cancel()}},P2=(e,t,n,o)=>{const s=K_(e,t);let i=0,a,l=c=>{a||(a=!0,o&&o(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let p=d.byteLength;if(n){let f=i+=p;n(f)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},nc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",R2=nc&&typeof ReadableStream=="function",Z_=nc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),M2=(e,...t)=>{try{return!!e(...t)}catch{return!1}},J_=R2&&M2(()=>{let e=!1;const t=new Request(qt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),D2=64*1024,Up=R2&&M2(()=>te.isReadableStream(new Response("").body)),oc={stream:Up&&(e=>e.body)};nc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!oc[t]&&(oc[t]=te.isFunction(e[t])?n=>n[t]():(n,o)=>{throw new Fe(`Response type '${t}' is not supported`,Fe.ERR_NOT_SUPPORT,o)})})})(new Response);const Q_=async e=>{if(e==null)return 0;if(te.isBlob(e))return e.size;if(te.isSpecCompliantForm(e))return(await new Request(qt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(te.isArrayBufferView(e)||te.isArrayBuffer(e))return e.byteLength;if(te.isURLSearchParams(e)&&(e=e+""),te.isString(e))return(await Z_(e)).byteLength},e9=async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??Q_(t)},Hp={http:C_,xhr:q_,fetch:nc&&(async e=>{let{url:t,method:n,data:o,signal:s,cancelToken:i,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:p="same-origin",fetchOptions:f}=k2(e);u=u?(u+"").toLowerCase():"text";let g=Y_([s,i&&i.toAbortSignal()],a),y;const h=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let b;try{if(c&&J_&&n!=="get"&&n!=="head"&&(b=await e9(d,o))!==0){let v=new Request(t,{method:"POST",body:o,duplex:"half"}),O;if(te.isFormData(o)&&(O=v.headers.get("content-type"))&&d.setContentType(O),v.body){const[P,j]=S2(b,tc(T2(c)));o=P2(v.body,D2,P,j)}}te.isString(p)||(p=p?"include":"omit");const w="credentials"in Request.prototype;y=new Request(t,{...f,signal:g,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:o,duplex:"half",credentials:w?p:void 0});let T=await fetch(y);const S=Up&&(u==="stream"||u==="response");if(Up&&(l||S&&h)){const v={};["status","statusText","headers"].forEach(N=>{v[N]=T[N]});const O=te.toFiniteNumber(T.headers.get("content-length")),[P,j]=l&&S2(O,tc(T2(l),!0))||[];T=new Response(P2(T.body,D2,P,()=>{j&&j(),h&&h()}),v)}u=u||"text";let E=await oc[te.findKey(oc,u)||"text"](T,e);return!S&&h&&h(),await new Promise((v,O)=>{w2(v,O,{data:E,headers:sn.from(T.headers),status:T.status,statusText:T.statusText,config:e,request:y})})}catch(w){throw h&&h(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new Fe("Network Error",Fe.ERR_NETWORK,e,y),{cause:w.cause||w}):Fe.from(w,w&&w.code,e,y)}})};te.forEach(Hp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const I2=e=>`- ${e}`,t9=e=>te.isFunction(e)||e===null||e===!1,A2={getAdapter:e=>{e=te.isArray(e)?e:[e];const{length:t}=e;let n,o;const s={};for(let i=0;i<t;i++){n=e[i];let a;if(o=n,!t9(n)&&(o=Hp[(a=String(n)).toLowerCase()],o===void 0))throw new Fe(`Unknown adapter '${a}'`);if(o)break;s[a||"#"+i]=o}if(!o){const i=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?i.length>1?`since :
326
326
  `+i.map(I2).join(`
327
327
  `):" "+I2(i[0]):"as no adapter specified";throw new Fe("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:Hp};function qp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ps(null,e)}function j2(e){return qp(e),e.headers=sn.from(e.headers),e.data=Wp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),A2.getAdapter(e.adapter||Yi.adapter)(e).then(function(o){return qp(e),o.data=Wp.call(e,e.transformResponse,o),o.headers=sn.from(o.headers),o},function(o){return C2(o)||(qp(e),o&&o.response&&(o.response.data=Wp.call(e,e.transformResponse,o.response),o.response.headers=sn.from(o.response.headers))),Promise.reject(o)})}const N2="1.8.4",rc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{rc[e]=function(o){return typeof o===e||"a"+(t<1?"n ":" ")+e}});const $2={};rc.transitional=function(t,n,o){function s(i,a){return"[Axios v"+N2+"] Transitional option '"+i+"'"+a+(o?". "+o:"")}return(i,a,l)=>{if(t===!1)throw new Fe(s(a," has been removed"+(n?" in "+n:"")),Fe.ERR_DEPRECATED);return n&&!$2[a]&&($2[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,l):!0}},rc.spelling=function(t){return(n,o)=>(console.warn(`${o} is likely a misspelling of ${t}`),!0)};function n9(e,t,n){if(typeof e!="object")throw new Fe("options must be an object",Fe.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let s=o.length;for(;s-- >0;){const i=o[s],a=t[i];if(a){const l=e[i],c=l===void 0||a(l,i,e);if(c!==!0)throw new Fe("option "+i+" must be "+c,Fe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Fe("Unknown option "+i,Fe.ERR_BAD_OPTION)}}const sc={assertOptions:n9,validators:rc},Qn=sc.validators;let rr=class{constructor(t){this.defaults=t,this.interceptors={request:new y2,response:new y2}}async request(t,n){try{return await this._request(t,n)}catch(o){if(o instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{o.stack?i&&!String(o.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(o.stack+=`
328
- `+i):o.stack=i}catch{}}throw o}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=or(this.defaults,n);const{transitional:o,paramsSerializer:s,headers:i}=n;o!==void 0&&sc.assertOptions(o,{silentJSONParsing:Qn.transitional(Qn.boolean),forcedJSONParsing:Qn.transitional(Qn.boolean),clarifyTimeoutError:Qn.transitional(Qn.boolean)},!1),s!=null&&(te.isFunction(s)?n.paramsSerializer={serialize:s}:sc.assertOptions(s,{encode:Qn.function,serialize:Qn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),sc.assertOptions(n,{baseUrl:Qn.spelling("baseURL"),withXsrfToken:Qn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&te.merge(i.common,i[n.method]);i&&te.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=sn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,p=0,f;if(!c){const y=[j2.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),f=y.length,d=Promise.resolve(n);p<f;)d=d.then(y[p++],y[p++]);return d}f=l.length;let g=n;for(p=0;p<f;){const y=l[p++],h=l[p++];try{g=y(g)}catch(b){h.call(this,b);break}}try{d=j2.call(this,g)}catch(y){return Promise.reject(y)}for(p=0,f=u.length;p<f;)d=d.then(u[p++],u[p++]);return d}getUri(t){t=or(this.defaults,t);const n=E2(t.baseURL,t.url,t.allowAbsoluteUrls);return g2(n,t.params,t.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(t){rr.prototype[t]=function(n,o){return this.request(or(o||{},{method:t,url:n,data:(o||{}).data}))}}),te.forEach(["post","put","patch"],function(t){function n(o){return function(i,a,l){return this.request(or(l||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}rr.prototype[t]=n(),rr.prototype[t+"Form"]=n(!0)});let o9=class y1{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 o=this;this.promise.then(s=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](s);o._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(l=>{o.subscribe(l),i=l}).then(s);return a.cancel=function(){o.unsubscribe(i)},a},t(function(i,a,l){o.reason||(o.reason=new ps(i,a,l),n(o.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=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new y1(function(s){t=s}),cancel:t}}};function r9(e){return function(n){return e.apply(null,n)}}function s9(e){return te.isObject(e)&&e.isAxiosError===!0}const Yp={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(Yp).forEach(([e,t])=>{Yp[t]=e});function L2(e){const t=new rr(e),n=n2(rr.prototype.request,t);return te.extend(n,rr.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return L2(or(e,s))},n}const mt=L2(Yi);mt.Axios=rr,mt.CanceledError=ps,mt.CancelToken=o9,mt.isCancel=C2,mt.VERSION=N2,mt.toFormData=Ql,mt.AxiosError=Fe,mt.Cancel=mt.CanceledError,mt.all=function(t){return Promise.all(t)},mt.spread=r9,mt.isAxiosError=s9,mt.mergeConfig=or,mt.AxiosHeaders=sn,mt.formToJSON=e=>v2(te.isHTMLForm(e)?new FormData(e):e),mt.getAdapter=A2.getAdapter,mt.HttpStatusCode=Yp,mt.default=mt;const{Axios:FB,AxiosError:_B,CanceledError:BB,isCancel:VB,CancelToken:zB,VERSION:WB,all:UB,Cancel:HB,isAxiosError:qB,spread:YB,toFormData:GB,AxiosHeaders:KB,HttpStatusCode:XB,formToJSON:ZB,getAdapter:JB,mergeConfig:QB}=mt,Gp={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"};/*! js-cookie v3.0.5 | MIT */function ic(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var i9={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Kp(e,t){function n(s,i,a){if(!(typeof document>"u")){a=ic({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=s+"="+e.write(i,s)+l}}function o(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),u=c.slice(1).join("=");try{var d=decodeURIComponent(c[0]);if(a[d]=e.read(u,d),s===d)break}catch{}}return s?a[s]:a}}return Object.create({set:n,get:o,remove:function(s,i){n(s,"",ic({},i,{expires:-1}))},withAttributes:function(s){return Kp(this.converter,ic({},this.attributes,s))},withConverter:function(s){return Kp(ic({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var a9=Kp(i9,{path:"/"});const Ro={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Xp={BEARER:"Bearer",TENANT_ID:"tenant_id",BU_ID:"bu_id",SNOP_ID:"snop_id"},l9=[10,25,50,100],F2={MARK_ALL_READ:"MARK_ALL_READ"},c9=l9.map(e=>({label:e,value:e})),_2={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Zp=ql(Ro.SNOP),Jp=ql(Ro.SELECTED_BU),Qp=ql(Ro.USER),u9=ql(Ro.SETTINGS),sr={BU_IDS:Jp==null?void 0:Jp.business_unit_id,TOKEN:JSON.parse(a9.get(Ro.TOKEN)||null),TENANT_IDS:Qp==null?void 0:Qp.tenant_id,SNOP_IDS:Zp==null?void 0:Zp.snop_id,GRID_SETTINGS:u9},Ki={headers:{"Content-Type":"application/json",Authorization:`${Xp.BEARER} ${sr.TOKEN}`}},B2=mt.create({baseURL:Gp.BASE_URL,axiosConfig:Ki});B2.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),B2.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const ac={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"},{TENANT_ID:d9,BU_ID:p9}=Xp,{TENANT_IDS:f9,BU_IDS:h9}=sr,lc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${ac.SETTING}/v1?${d9}=${f9}&${p9}=${h9}`;return await mt.post(n,t,Ki)}catch(n){return n}},m9=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:o,pageSize:s})=>{var y;let{definitions:i,defaultUserSettings:a,labels:l}=e;const c=t.split("/").filter(Boolean);let u=c.reduce((h,b)=>h==null?void 0:h[b],sr.GRID_SETTINGS)||null;o||!u&&!a&&(async()=>{try{a=V2({definitions:i});let h=sr.GRID_SETTINGS||{platform:{theme:"light"}};const b=(u==null?void 0:u.pageSize)??s;let w=h;for(let T=0;T<c.length;T++){const S=c[T];T===c.length-1?w[S]={columns:a,pageSize:b}:(w[S]=w[S]||{},w=w[S])}localStorage.setItem(Ro.SETTINGS,JSON.stringify(h)),await lc({baseUrl:n,payload:h})}catch(h){console.error(h)}})(),a=(u==null?void 0:u.columns)??a??V2({definitions:i});const d=a.reduce((h,b)=>(h[b.id]=b,h),{}),p=l.reduce((h,b)=>(h[b.id]=b,h),{}),f=[];for(const h of i){const b=d[h.id]||{},w=p[h.id]||{};let T={...h,...b,...w};if((y=h.children)!=null&&y.length){const S=b.children||[],E=w.children||[];T.children=h.children.map((v,O)=>({...v,...S[O],...E[O]}))}f.push(T)}return f.sort((h,b)=>h.sequenceId-b.sequenceId)},g9=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),V2=({definitions:e})=>e.map((t,n)=>({id:t.id,key:t.key,sequenceId:t.id,isHidden:!1,style:t.style||{}})),y9=()=>({definitions:[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],defaultUserSettings:[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],labels:[{id:1,key:"sku_name",label:"SKU",isLocalizable:!1},{id:2,key:"node",label:"Node",isLocalizable:!1},{id:3,key:"channel_name",label:"Channel",isLocalizable:!1}]});class ef extends U.Component{constructor(t){super(t),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.dragging=!1,this.mouseX=0,this.startPos=0,this.startWidthPrev=0,this.lastDraggedWidth=0,this.draggedCol=null,this.resizeRef=U.createRef()}startDrag(){if(!this.props.disabled&&(this.draggedCol=this.props.id,this.props.resizeStart&&this.draggedCol===this.props.id&&this.props.resizeStart(),this.dragging=!0,this.startPos=this.mouseX,this.startWidthPrev=0,this.resizeRef.current)){let t=this.resizeRef.current.previousSibling;t&&(this.startWidthPrev=t.clientWidth)}}endDrag(){this.props.disabled||(this.dragging=!1,this.props.resizeEnd&&this.draggedCol===this.props.id&&this.props.resizeEnd(this.lastDraggedWidth),this.draggedCol=null)}onMouseMove(t){if(this.props.disabled||(this.mouseX=t.touches?t.touches[0].screenX:t.screenX,!this.dragging))return;const n=this.resizeRef.current,o=this.startPos-this.mouseX;let s=this.startWidthPrev-o;(!this.props.minWidth||s>=this.props.minWidth)&&(!this.props.maxWidth||s<=this.props.maxWidth)&&(n.previousSibling.style.width=s+"px",n.previousSibling.style.minWidth=s+"px",n.previousSibling.style.maxWidth=s+"px",n.previousSibling.style.setProperty("--column_resize_before_width",s+"px"),this.lastDraggedWidth=s)}componentDidMount(){const t=this.resizeRef.current;if(t&&(this.props.defaultWidth?(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")):this.props.minWidth&&(t.previousSibling.style.minWidth=this.props.minWidth+"px",t.previousSibling.style.width=this.props.minWidth+"px",t.previousSibling.style.maxWidth=this.props.minWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.minWidth+"px"))),this.props.disabled){this.props.defaultWidth&&t&&(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")),this.props.maxWidth&&t&&(t.previousSibling.style.maxWidth=this.props.maxWidth+"px");return}this.addEventListenersToDocument()}componentWillUnmount(){this.props.disabled||this.removeEventListenersFromDocument()}componentDidUpdate(t,n){t.disabled&&!this.props.disabled&&this.addEventListenersToDocument(),!t.disabled&&this.props.disabled&&this.removeEventListenersFromDocument()}addEventListenersToDocument(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.endDrag),document.addEventListener("touchmove",this.onMouseMove),document.addEventListener("touchend",this.endDrag)}removeEventListenersFromDocument(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.endDrag),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("touchend",this.endDrag)}render(){var t={userSelect:"none"};return this.props.disabled||(t.cursor="ew-resize"),this.props.className===""&&(t.width="6px",t.backgroundColor="rgba(0, 0, 0, 0.1)"),U.createElement("th",{ref:this.resizeRef,style:t,disabled:this.props.disabled,rowSpan:this.props.rowSpan?this.props.rowSpan:1,colSpan:this.props.colSpan?this.props.colSpan:1,className:`column_resizer_own_class ${this.props.disabled?"disabled_column_resize":""} ${this.props.className}`,onMouseDown:this.props.disabled?null:this.startDrag,onTouchStart:this.props.disabled?null:this.startDrag})}}ef.defaultProps={disabled:!1,minWidth:0,className:""},ef.propTypes={disabled:"boolean",minWidth:"number",className:"string"};const b9=(e,t,n,o)=>{const[s,i]=U.useState({isOpen:!1,column:null}),a=(u,d)=>{i({isOpen:u.currentTarget,column:d})},l=()=>{i({isOpen:!1,column:null})};return{selectedColumn:s,handleMenuClick:a,handleClose:l,handleHideClick:async()=>{l();const u=e.map(p=>{var f;return p.id===((f=s==null?void 0:s.column)==null?void 0:f.id)?{...p,isHidden:!0}:p});t({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:u}});let d=sr.GRID_SETTINGS||{platform:{theme:"light"},grid:{}};d.grid=d.grid||{},d.grid[o]=u,localStorage.setItem(Ro.SETTINGS,JSON.stringify(d)),await lc({baseUrl:n,payload:d})}}},z2=({pagination:e})=>{const{selectedPage:t,rowPerPage:n,totalRecords:o,onPageChange:s,onPageSizeChange:i}=e,a=kt();return m.jsxs(ve,{sx:{display:"flex",p:"1rem 2rem"},children:[m.jsxs(ve,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[m.jsx(Qe,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:`Showing ${(t-1)*n+1} to ${Math.min(t*n,o)} of ${o} rows`}),m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:m.jsx(Gl,{options:c9,value:n,onChange:i})}),m.jsx(Qe,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:"records per page"})]}),m.jsx(Ug,{count:Math.ceil(o/n),page:t,onChange:(l,c)=>{s(c)},shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:a.palette.primary.notifyActiveText,backgroundColor:`${a.palette.brandColor.paginationBc} !important`}}})]})};z2.propTypes={pagination:r.object.isRequired};function tf({isRenderCellContent:e,column:t,row:n,parent:o}){const s=n[t.key];return m.jsx(m.Fragment,{children:e?m.jsx(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:t==null?void 0:t.cellRenderer(n,{column:t,parent:o})}):m.jsx(Qg,{title:(s==null?void 0:s.length)>20?s:"",arrow:!0,children:m.jsx(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:gF(s)})})})}tf.propTypes={isRenderCellContent:r.bool,column:r.object,row:r.object};const W2=({menuOpen:e,handleClose:t,onHideClick:n})=>{const o=kt();return m.jsx(sl,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:m.jsx(ve,{sx:{p:"0.4rem 1rem",backgroundColor:o.palette.primary.notifyBackground,border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:m.jsx(An,{onClick:n,sx:{textTransform:"none",fontSize:"1.1rem",p:0,minHeight:"unset",fontWeight:"500",color:o.palette.primary.notifyTextColor},children:"Hide Column"})})})};W2.propTypes={menuOpen:r.object,handleClose:r.func,onHideClick:r.func},Y(Ja)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:8,border:`1px solid ${e.palette.primary.notifyBorderColor}`,boxShadow:e.shadows[4],padding:"1rem 1rem 0rem 1rem",backgroundColor:e.palette.primary.notifyBackground}}));const ir=Y(Qe)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),v9=Y(e0)(({theme:e})=>({width:28,height:16,padding:0,display:"flex","&:active":{"& .MuiSwitch-thumb":{width:15},"& .MuiSwitch-switchBase.Mui-checked":{transform:"translateX(9px)"}},"& .MuiSwitch-switchBase":{padding:2,"&.Mui-checked":{transform:"translateX(12px)",color:"#fff","& + .MuiSwitch-track":{opacity:1,backgroundColor:"#1890ff",...e.applyStyles("dark",{backgroundColor:"#177ddc"})}}},"& .MuiSwitch-thumb":{boxShadow:"0 2px 4px 0 rgb(0 35 11 / 20%)",width:12,height:12,borderRadius:6,transition:e.transitions.create(["width"],{duration:200})},"& .MuiSwitch-track":{borderRadius:16/2,opacity:1,backgroundColor:"rgba(0,0,0,.25)",boxSizing:"border-box",...e.applyStyles("dark",{backgroundColor:"rgba(255,255,255,.35)"})}})),x9=Y(ei)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),C9=Y(Pu)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:2.34,border:`0.1rem solid ${e.palette.primary.notifyBackground}`,padding:"0 1.3px",borderRadius:"50%",backgroundColor:"#D44E40",fontSize:"0.725rem",minWidth:"0.7rem",height:"0.7rem"}}));Y(dl)(({theme:e})=>({"& .MuiInputBase-root":{height:"3.52rem"},"& .MuiFormLabel-root":{color:`${e.palette.primary.notifyBorderColor} !important`,fontSize:"1rem",marginTop:"0.4rem"},"& label.Mui-focused":{color:e.palette.primary.notifyTextColor},"& .MuiInput-underline:after":{borderBottomColor:e.palette.primary.notifyBorderColor,borderBottomWidth:"0.1rem"},"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&:hover fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&.Mui-focused fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"}}}));const w9=Y(v0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),nf=Y(t0)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),cc=Y(Eu)(({theme:e})=>({"&.MuiChip-outlined":{borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText},height:"2rem",fontSize:"0.9rem",fontWeight:"300",borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText,borderRadius:"0.6rem",padding:"0.2rem","&:hover":{backgroundColor:`${e.palette.brandColor.orange} !important`,color:`${e.palette.brandColor.white} !important`}})),U2=({sortKey:e,sortField:t,sortDir:n,handleSortClick:o})=>{const s=i=>m.jsx(fo,{onClick:o,sx:{padding:"0.5rem"},children:m.jsx(ve,{component:"img",src:i})});return m.jsx(m.Fragment,{children:s(t===e?n==="asc"?Xe.AscSort:Xe.DescSort:Xe.Unsort)})};U2.propTypes={sortKey:r.string.isRequired,sortField:r.string,sortDir:r.string,handleSortClick:r.func};function H2({parent:e,column:t,sort:n,handleMenuClick:o,isManageable:s}){const i=t==null?void 0:t.isMandatory,a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return m.jsxs(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",textAlign:"center",whiteSpace:"normal"},children:[a,m.jsxs(ve,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[l&&m.jsx(U2,{sortKey:e?`${e==null?void 0:e.key}|${t==null?void 0:t.key}`:t==null?void 0:t.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),s&&!i&&m.jsx(fo,{onClick:p=>o(p,t),sx:{padding:"0.5rem"},children:m.jsx(ve,{component:"img",src:Xe.Menu})})]})]})}H2.propTypes={column:r.object.isRequired,sort:r.object.isRequired,handleMenuClick:r.func,isManageable:r.bool};const S9=Y(i0)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Hu.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"},[`&.${Hu.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"}}));function fs({children:e,...t}){return m.jsx(S9,{...t,children:e})}fs.propTypes={children:r.node};const T9=Y(p0)(()=>({"&:last-child td":{borderBottom:0}}));function hs({children:e,...t}){return m.jsx(T9,{...t,children:e})}hs.propTypes={children:r.node};function q2({rows:e,sort:t,data:n,pagination:o,columns:s,nested:i,baseUrl:a,gridPath:l}){var L;const c=kt(),{visibleGridColumns:u}=U.useContext(Wi),d=U.useContext(Ui),{selectedColumn:p,handleMenuClick:f,handleClose:g,handleHideClick:y}=b9(u,d,a,l),h=s==null?void 0:s.isManageable,b=(n==null?void 0:n.length)>0,w=U.useRef(null),[T,S]=U.useState(null);let E=null;const v=U.useRef(0),O=g9(((L=i==null?void 0:i.column)==null?void 0:L.definitions)||[]),P=i==null?void 0:i.isNested,j=(i==null?void 0:i.data)||[],N=i==null?void 0:i.hashKey;if(!b)return m.jsx(ir,{sx:{textAlign:"center"},children:Po.NRF});const F=(R,D)=>{S(D),R.dataTransfer.setData("colIndex",D)},B=R=>{R.preventDefault(),V(R)},$=async(R,D)=>{if(R.preventDefault(),clearInterval(E),T===null||T===D)return;const _=[...u],[H]=_.splice(T,1);_.splice(D,0,H);const K=u.slice().sort((re,Z)=>re.sequenceId-Z.sequenceId).map(re=>re.sequenceId),q=_.map((re,Z)=>({...re,sequenceId:K[Z]??re.sequenceId})),J={...sr.GRID_SETTINGS||{platform:{theme:"light"}}},G=l.split("/").filter(Boolean);let ne=J;for(let re=0;re<G.length;re++){const Z=G[re];if(re===G.length-1){const ee=(o==null?void 0:o.rowPerPage)??null;ne[Z]={columns:q,pageSize:ee}}else ne[Z]=ne[Z]||{},ne=ne[Z]}localStorage.setItem(Ro.SETTINGS,JSON.stringify(J)),d({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:q}}),await lc({baseUrl:a,payload:J}),S(null)},V=R=>{const D=w.current,{left:_,right:H}=D.getBoundingClientRect(),K=50,q=R.clientX>H-K?1:R.clientX<_+K?-1:0;q!==0?(clearInterval(E),E=setInterval(()=>{D.scrollLeft+=q*10},50)):clearInterval(E)},I=(R,D,_,H)=>{var G,ne,re;const K=(R==null?void 0:R.isMandatory)&&(R==null?void 0:R.isSticky),q=parseFloat((ne=(G=R==null?void 0:R.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;D===0&&(v.current=0);const J=K?D===0?0:`${v.current}rem`:void 0;return K&&(v.current+=q),m.jsx(fs,{rowSpan:R!=null&&R.children?1:2,colSpan:(re=R==null?void 0:R.children)==null?void 0:re.length,style:R==null?void 0:R.style,draggable:_&&!H&&!(R!=null&&R.isMandatory),onDragStart:_?Z=>F(Z,D):void 0,onDragOver:_?B:void 0,onDrop:_?Z=>$(Z,D):void 0,sx:{...K&&{borderRadius:"0rem!important",position:"sticky",left:J,zIndex:3},...R!=null&&R.children||H?{borderRadius:"0rem!important",borderRight:Z=>`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}:{borderLeft:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`,borderRight:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}},children:m.jsx(H2,{parent:H,column:R,sort:t,handleMenuClick:f,isManageable:_})},D)},M=(R,D,_,H)=>!(R!=null&&R.isMandatory)&&_?m.jsx(ve,{component:ef,id:D,sx:{width:"4rem",maxWidth:"4rem",minWidth:"4rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:"50%",transform:"translate(0%, -50%)",width:"0.2rem",height:"50%",background:c.palette.primary.notifyBorderColor}},disabled:!_}):null,k=(R,D,_,H)=>{var G,ne,re;const K=(R==null?void 0:R.isMandatory)&&(R==null?void 0:R.isSticky),q=parseFloat((ne=(G=R==null?void 0:R.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;_===0&&(v.current=0);const J=K?_===0?0:`${v.current}rem`:void 0;return K&&(v.current+=q),m.jsxs(fs,{style:R==null?void 0:R.style,className:`${R==null?void 0:R.label}`,sx:{position:"relative",...K&&{position:"sticky",left:J,zIndex:2,backgroundColor:Z=>{var ee;return e&&((ee=e==null?void 0:e.selectedRow)==null?void 0:ee.fhi)===(D==null?void 0:D.fhi)||D!=null&&D.isHigh?Z.palette.primary.appBackground:Z.palette.primary.notifyBackground}},...H?{p:"0rem!important",borderRight:Z=>`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}:{px:"0rem!important",borderLeft:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`,borderRight:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}},children:[(e&&((re=e==null?void 0:e.selectedRow)==null?void 0:re.fhi)===(D==null?void 0:D.fhi)||(D==null?void 0:D.isHigh))&&m.jsx(ve,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.05rem",background:"linear-gradient(#F9B16E, #F68080)"}}),m.jsx(tf,{isRenderCellContent:!!(R!=null&&R.cellRenderer),column:R,row:D,parent:H})]},_)},A=(R,D,_,H)=>!(R!=null&&R.isMandatory)&&_?m.jsx(fs,{className:"column_resizer_body"},`resize-${D}`):null;return m.jsxs(m.Fragment,{children:[m.jsx(a0,{sx:{maxHeight:"100%",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem"},children:m.jsxs(o0,{ref:w,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:R=>R.palette.primary.notifyBackground},children:[m.jsxs(c0,{children:[m.jsx(hs,{children:u.map((R,D)=>R!=null&&R.isHidden?null:m.jsxs(U.Fragment,{children:[I(R,D,h),(s==null?void 0:s.isResizable)&&M(R,D,h)]},D))}),m.jsx(hs,{children:u.flatMap((R,D)=>R!=null&&R.isHidden||!(R!=null&&R.children)?[]:R.children.map((_,H)=>m.jsxs(U.Fragment,{children:[I(_,H,h,R),(s==null?void 0:s.isResizable)&&M(_,H,h)]},`${D}-${H}`)))})]}),m.jsx(s0,{children:n.map((R,D)=>{const _=R[N],H=j==null?void 0:j[_],K=(H==null?void 0:H.length)>0;return m.jsxs(U.Fragment,{children:[m.jsx(hs,{sx:{backgroundColor:q=>{var J;return e&&((J=e==null?void 0:e.selectedRow)==null?void 0:J.fhi)===(R==null?void 0:R.fhi)||R!=null&&R.isHigh?q.palette.primary.appBackground:q.palette.primary.notifyBackground}},onClick:()=>e==null?void 0:e.onRowClick(R),children:u.map((q,J)=>q!=null&&q.isHidden?null:q!=null&&q.children?q.children.map((G,ne)=>m.jsxs(U.Fragment,{children:[k(G,R,ne,q),(s==null?void 0:s.isResizable)&&A(G,ne,h)]},`${J}-${ne}`)):m.jsxs(U.Fragment,{children:[k(q,R,J),(s==null?void 0:s.isResizable)&&A(q,J,h)]},J))}),P&&H&&m.jsx(m.Fragment,{children:K?H.map((q,J)=>m.jsx(hs,{children:O.map((G,ne)=>m.jsx(fs,{style:G==null?void 0:G.style,children:m.jsx(tf,{isRenderCellContent:!!(G!=null&&G.cellRenderer),column:G,row:q})},ne))},`nested-${J}`)):m.jsx(hs,{children:m.jsx(fs,{colSpan:O.length,children:m.jsx(ir,{sx:{textAlign:"center"},children:Po.NRF})})})})]},D)})})]})}),o&&m.jsx(z2,{pagination:o}),m.jsx(W2,{menuOpen:p==null?void 0:p.isOpen,handleClose:g,onHideClick:y})]})}q2.propTypes={sort:r.object,data:r.array,pagination:r.object,columns:r.object,nested:r.object};function Y2({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:o}){var u;const{columns:s}=e,{visibleGridColumns:i=[]}=U.useContext(Wi)??{},a=U.useContext(Ui),l=U.useMemo(()=>{var d;return m9({columns:s,gridPath:n,baseUrl:o,isDefaultConfig:t,pageSize:(d=e==null?void 0:e.pagination)==null?void 0:d.rowPerPage})},[s,n,o,t,(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage]),c=U.useMemo(()=>{const d=new Map(i.map(p=>[p.key,p]));return l.map(p=>{const f=d.get(p.key);return{...p,...f&&{isHidden:f.isHidden,sequenceId:f.sequenceId}}})},[l,i]);return U.useEffect(()=>{a({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:i.length?c:l}})},[l]),m.jsx(q2,{...e,gridPath:n,baseUrl:o})}Y2.propTypes={tableProps:r.object.isRequired,mergedColumns:r.array.isRequired};const G2=({type:e})=>{const t=kt(),o=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:m.jsxs(ve,{sx:{borderRadius:2,overflow:"hidden"},children:[m.jsx(lo,{variant:"text",width:"100%",height:60,sx:o}),Array.from({length:10}).map((i,a)=>m.jsx(ve,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>m.jsx(ve,{sx:{flex:1},children:m.jsx(lo,{variant:"text",height:45,sx:o})},c))},a))]}),toolbar:m.jsx(m.Fragment,{children:m.jsxs(it,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[m.jsxs(it,{direction:"row",gap:"1rem",children:[m.jsx(lo,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"15.2rem",height:"5rem",sx:o})]}),m.jsxs(it,{direction:"row",gap:"1rem",children:[m.jsx(lo,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"3.5rem",height:"5rem",sx:o})]})]})})}[e]},E9=e=>{if(!e)return null;const{options:t,...n}=e,o=t?"select":"button",s={button:i=>m.jsx(Xo,{...i}),select:i=>{var a;return m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:m.jsx(Zx,{...i,options:t})})}};return s[o]?s[o](n):null},O9=({presentSetting:e,gridSetting:t,gridPath:n})=>{var a;if(!n)return e;const o=n.split("/").filter(Boolean),s=(a=t==null?void 0:t.grid)==null?void 0:a.map(({id:l,isHidden:c,isSortable:u,key:d,sequenceId:p})=>({id:l,isHidden:c,isSortable:u,key:d,sequenceId:p}));let i=e;for(let l=0;l<o.length;l++){const c=o[l];l===o.length-1?i[c]={columns:s,pageSize:(t==null?void 0:t.pageSize)??null}:(i[c]=i[c]||{},i=i[c])}return{settingObject:e,defaultUserSettings:s}},k9=async({baseUrl:e,gridSetting:t,gridPath:n})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:s,defaultUserSettings:i}=O9({presentSetting:o,gridSetting:t,gridPath:n});return localStorage.setItem("settings",JSON.stringify(s)),await lc({baseUrl:e,payload:s}),i}catch(o){console.error(o)}},P9=({customTools:e})=>{var o,s;const t=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===_2.PRIMARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId),n=(s=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===_2.SECONDARY))==null?void 0:s.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},K2=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:o,secondaryButtons:s}=P9({customTools:e}),[i,a]=U.useState(o),l=(s==null?void 0:s.length)>0,c=d=>{d?a([...o,...s]):setTimeout(()=>{a(o)},100)},u=()=>{const d=!t;n(d),c(d)};return U.useEffect(()=>{c(t)},[e]),m.jsxs(m.Fragment,{children:[t&&m.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),m.jsxs(ve,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[m.jsx(B5,{mode:"popLayout",children:i.map(d=>m.jsx(Mi.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:m.jsx(ve,{sx:{flexShrink:0,minWidth:"fit-content"},children:E9(d)})},d.id))}),l&&m.jsx(ve,{sx:{paddingLeft:t?"0.5rem":0},children:m.jsx(Xo,{label:t?"":"More Actions",styles:{icon:t?Xe.CrossWhite:Xe.More,colorType:t?"danger":""},onClick:u})})]})]})};K2.propTypes={customTools:r.array.isRequired};const X2=({defaultTools:e,isManageable:t,customTools:n,baseUrl:o,gridPath:s,managableColumns:i=[],pageSize:a})=>{var b,w,T,S,E,v;const l=U.useContext(Ui),{visibleGridColumns:c,triggerApi:u}=U.useContext(Wi),[d,p]=U.useState([]),[f,g]=U.useState(!1);U.useEffect(()=>{if(i.length){const O=i.length?c.filter(P=>i.includes(P.id)):c;p(O)}},[i,c]);const y=async O=>{try{await k9({baseUrl:o,gridPath:s,gridSetting:{grid:O,pageSize:a}})}catch(P){console.error(P)}finally{l({type:Ve.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),l({type:Ve.TRIGGER_API,payload:{triggerApi:!1}})}};U.useEffect(()=>{u&&y(c)},[u]);const h=O=>{const P=c.map(j=>d.some(F=>F.id===j.id)?{...j,isHidden:!O.some(F=>F.id===j.id)}:j);l({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:P}}),l({type:Ve.HAS_SETTING_CHANGE,payload:{hasChange:!0}})};return m.jsxs(ve,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[m.jsxs(ve,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((b=e==null?void 0:e.search)==null?void 0:b.isRequired)&&m.jsx(Gx,{...e==null?void 0:e.search}),((w=e==null?void 0:e.groupBy)==null?void 0:w.isRequired)&&m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(Gl,{styles:{icon:Xe.Group},...e.groupBy})}),((T=e==null?void 0:e.refresh)==null?void 0:T.isRequired)&&m.jsx(Xo,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Xe.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),t&&m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(Gl,{placeholder:"Manage Columns",options:d,value:d.filter(O=>!O.isHidden),isMulti:!0,isDraggable:!0,showSearch:!0,onChange:h,styles:{icon:Xe.Manage}})})]}),m.jsxs(ve,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&m.jsx(K2,{customTools:n,setIsExpanded:g,isExpanded:f}),((S=e==null?void 0:e.save)==null?void 0:S.isRequired)&&m.jsx(ve,{sx:{px:"0.5rem"},children:m.jsx(Xo,{label:f?"":"Save",styles:{icon:Xe.Save,colorType:"empty"},...e==null?void 0:e.save})}),((E=e==null?void 0:e.upload)==null?void 0:E.isRequired)&&m.jsx(Xo,{...e==null?void 0:e.upload,styles:{variant:f?"outlined":"filled",icon:f?Xe.UploadDark:Xe.Upload,colorType:"secondary",isAnimate:!0}}),((v=e==null?void 0:e.download)==null?void 0:v.isRequired)&&m.jsx(Xo,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Xe.Download,isAnimate:!0}})]})]})};X2.propTypes={defaultTools:r.object.isRequired,customTools:r.array,isManageable:r.bool,baseUrl:r.string,gridPath:r.gridPath};function of({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:o}){var i,a;const s=(i=e.columns)==null?void 0:i.isManageable;return m.jsx(Xx,{children:o?m.jsxs(m.Fragment,{children:[m.jsx(G2,{type:"toolbar"}),m.jsx(G2,{type:"grid"})]}):m.jsxs(m.Fragment,{children:[t&&m.jsx(X2,{...t,isManageable:s,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage}),m.jsx(Y2,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||""})]})})}of.propTypes={tableProps:r.object.isRequired,toolbarProps:r.object,isDefaultConfig:r.bool};const Z2=({list:e,handleLinkClick:t})=>{const n=kt(),o=({list:s})=>{var i;return(i=s==null?void 0:s.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?m.jsx(vo,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(s==null?void 0:s.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a==null?void 0:a.link,underline:"hover",onClick:()=>t(a),children:a==null?void 0:a.title},l):m.jsx(Qe,{component:"h3",sx:{fontSize:"1rem",color:l===(s==null?void 0:s.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return m.jsx(sg,{separator:m.jsx(ve,{component:"img",src:Xe.ArrowRight}),children:o({list:e})})};Z2.propTypes={list:r.array.isRequired,handleLinkClick:r.func};const J2=({breadcrumbProps:e,switchProps:t,filterComponentProps:n})=>{var s,i,a,l,c,u;const o=kt();return m.jsxs(m.Fragment,{children:[m.jsxs(it,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 5.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[m.jsx(Z2,{...e}),m.jsxs(it,{direction:"row",gap:"1rem",alignItems:"center",children:[t&&m.jsx(t2,{...t}),(n==null?void 0:n.filterBtnProps)&&m.jsxs(it,{direction:"row",children:[m.jsx(ei,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),m.jsxs(it,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(s=n==null?void 0:n.filterBtnProps)==null?void 0:s.onFilterClick,sx:{cursor:"pointer"},children:[m.jsx(ve,{component:"img",src:o.icons.filter}),m.jsx(Qe,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.label})]})]})]})]}),m.jsx(Mi.div,{layout:!0,initial:{height:"0rem"},animate:{height:(a=n==null?void 0:n.filterBtnProps)!=null&&a.filterContainerVisible?"5rem":"0rem",opacity:(l=n==null?void 0:n.filterBtnProps)!=null&&l.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden"},children:m.jsxs(it,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[m.jsx(Qe,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),m.jsx(ve,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:m.jsx(it,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(c=n==null?void 0:n.filterItems)==null?void 0:c.map((d,p)=>m.jsx(m.Fragment,{children:m.jsxs(ve,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,background:o.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[m.jsx(ve,{component:"img",src:Xe.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(d)}),m.jsx(Qe,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:d==null?void 0:d.filterLabel})]},p)}))})}),m.jsx(ve,{component:Qe,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(u=n==null?void 0:n.filterContainerProps)==null?void 0:u.onClearClick,children:"Clear"})]})})]})};J2.propTypes={breadcrumbProps:r.object.isRequired,switchProps:r.object};function Q2({headerProps:e}){return m.jsx(kn,{children:m.jsx(J2,{...e})})}Q2.propTypes={headerProps:r.object.isRequired};const rf=U.createContext(null),e1=U.createContext(null);function R9({children:e}){const[t,n]=U.useReducer(M9,D9);return m.jsx(rf.Provider,{value:t,children:m.jsx(e1.Provider,{value:n,children:e})})}function M9(e,t){var n;switch(t.type){case Ve.LOADING:return{...e,loading:t.loading};case Ve.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((o,s)=>new Date(s.createdAt)-new Date(o.createdAt))};case Ve.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case Ve.ERROR:return{...e,error:t.error};default:throw new Error(`${Po.UNHANDLED}: ${t}`)}}const D9={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:sf,BU_ID:af,SNOP_ID:t1}=Xp,{TENANT_IDS:lf,BU_IDS:cf}=sr,I9=async e=>{try{const t=`${e}${ac.NOTIFICATION}/v1?${sf}=${lf}&${af}=${cf}`;return await mt.get(t,Ki)}catch(t){return t}},n1=async(e,t,n)=>{try{const o=n===F2.MARK_ALL_READ?"":`&${t1}=${n}&`,s=`${e}${ac.NOTIFICATION}${Gp.VERSION}?${sf}=${lf}&${af}=${cf}${o}`;return await mt.put(s,t,Ki)}catch(o){return o}},A9=async({baseUrl:e,id:t,snopId:n})=>{try{const o=`${e}${ac.NOTIFICATION}${Gp.VERSION}?${sf}=${lf}&${af}=${cf}&${t1}=${n}&id=${t}`;return await mt.get(o,Ki)}catch(o){return o}},uc={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},o1=({baseUrl:e})=>{const t=U.useContext(e1),[n,o]=U.useState(!1),[s,i]=U.useState(!1),[a,l]=U.useState(!1),[c,u]=U.useState({}),[d,p]=U.useState(null),[f,g]=U.useState(1),[y,h]=U.useState(!1),[b,w]=U.useState(0),{loading:T,data:S,isMarkAllAsRead:E}=U.useContext(rf),[v,O]=U.useState([]);U.useEffect(()=>{O(S)},[S]);const P=U.useCallback(async()=>{var I,M;try{t({type:Ve.LOADING,loading:!0}),t({type:Ve.SUCCESS,data:[]});const k=await I9(e);if(k.status===uc.OK){const A=((M=(I=k.data)==null?void 0:I.responseData)==null?void 0:M.response)||[],L=Yl(A);t({type:Ve.SUCCESS,data:Yl(L)}),t({type:Ve.MARK_ALL_AS_READ,isMarkAllAsRead:{count:Kx(A),boo:Kx(A)>0}})}}catch{t({type:Ve.ERROR,error:Po.SWR})}finally{t({type:Ve.LOADING,loading:!1})}},[e,t]);U.useEffect(()=>{P();const I=setInterval(P,3e5);return()=>clearInterval(I)},[P]);const j=async(I,M)=>{var k,A,L;if(I){p(I);try{const R=await A9({baseUrl:e,id:I,snopId:M});if(R.status===uc.OK){const D=((L=(A=(k=R.data)==null?void 0:k.responseData)==null?void 0:A.response)==null?void 0:L[0])||{};u(D||{}),l(!0)}else throw new Error}catch{t({type:Ve.ERROR,error:Po.SWR})}finally{p(null)}}},N=async(I,M)=>{if(I.length){t({type:Ve.LOADING,loading:!0});try{if((await n1(e,I,M)).status===uc.OK){const A=S.map(R=>I.includes(R.id)?{...R,isRead:!0}:R),L=A.filter(R=>!R.isRead).length;t({type:Ve.SUCCESS,data:Yl(A)}),t({type:Ve.MARK_ALL_AS_READ,isMarkAllAsRead:{count:L,boo:L>0}}),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},200)}}catch{t({type:Ve.ERROR,error:Po.SWR}),t({type:Ve.LOADING,loading:!1})}}},F=async()=>{t({type:Ve.LOADING,loading:!0});try{const I=hF(S);if((await n1(e,I,F2.MARK_ALL_READ)).status===uc.OK){const k=S.map(A=>({...A,isRead:!0}));t({type:Ve.SUCCESS,data:Yl(k)}),t({type:Ve.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},200)}}catch{t({type:Ve.ERROR,error:Po.SWR}),t({type:Ve.LOADING,loading:!1})}},B=(I,M)=>{t({type:Ve.LOADING,loading:!0}),w(M),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},400)},$=I=>{const M=I||S||[];return{0:M,1:M.filter(k=>(k==null?void 0:k.type)==="INFO"),2:M.filter(k=>(k==null?void 0:k.type)==="ERROR")}},V=()=>{t({type:Ve.LOADING,loading:!0});const I=!y,M=I?(v||[]).filter(k=>!k.isRead):S||[];h(I),O(M),g(1),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},400)};return{fetchNotification:P,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>o(!1),onRefresh:P,handleRead:N,handleMarkAllAsRead:F,setOpen:o,handleShowDetails:j,clickId:d,isMainDialog:!0},activeTab:b,loading:T,tabData:$(v)[b],data:v,mode:y,handleTabChange:B,toggleAlertMode:V,page:f,setPage:g}};var r1,s1,i1,a1;function uf(){return uf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},uf.apply(null,arguments)}var j9=function(t){return x.createElement("svg",uf({xmlns:"http://www.w3.org/2000/svg",width:16,height:18,fill:"none"},t),r1||(r1=x.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 3.44c-2.206 0-4 1.793-4 4v1.927c0 .406-.173 1.026-.38 1.373l-.766 1.273c-.474.787-.147 1.66.72 1.954 2.873.96 5.973.96 8.846 0a1.335 1.335 0 0 0 .72-1.954l-.766-1.273c-.2-.347-.374-.967-.374-1.373V7.44c0-2.2-1.8-4-4-4Z"})),s1||(s1=x.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 3.633a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),i1||(i1=x.createElement("path",{stroke:"#666D80",strokeMiterlimit:10,d:"M10.014 14.207c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})),a1||(a1=x.createElement("circle",{cx:12.266,cy:3,r:2.5,fill:"#E85353",stroke:"#F8FAFB"})))};const N9=({count:e})=>(kt(),m.jsxs(m.Fragment,{children:[m.jsx(ve,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center"},className:"notify-icon-container",children:m.jsx(j9,{style:{scale:2}})}),m.jsx(C9,{badgeContent:e==0?"":null,color:"error"})]}));function l1({children:e,handleClose:t,open:n,isMainDialog:o}){return m.jsx(Ja,{open:n,onClose:t,...o?{scroll:"paper",PaperProps:{sx:{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:s=>s.palette.primary.notifyBackground}}}:{fullWidth:!0,maxWidth:"md",sx:{"& .MuiPaper-root":{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:s=>s.palette.primary.appBackground}}},children:e})}var c1;function df(){return df=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},df.apply(null,arguments)}var $9=function(t){return x.createElement("svg",df({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),c1||(c1=x.createElement("path",{fill:"#A8A8A8",fillRule:"evenodd",d:"M8.954 1.004a.406.406 0 0 1 0 .575L3.537 6.996a.406.406 0 0 1-.574 0L.796 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0m3.25 0a.406.406 0 0 1 0 .575L6.787 6.996a.406.406 0 1 1-.574-.575l5.416-5.417a.406.406 0 0 1 .575 0",clipRule:"evenodd"})))},u1,d1;function pf(){return pf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},pf.apply(null,arguments)}var L9=function(t){return x.createElement("svg",pf({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),u1||(u1=x.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.79 6c0 .99-.8 1.79-1.79 1.79S4.21 6.99 4.21 6 5.01 4.21 6 4.21s1.79.8 1.79 1.79"})),d1||(d1=x.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.135c1.765 0 3.41-1.04 4.555-2.84.45-.705.45-1.89 0-2.595C9.41 2.9 7.765 1.86 6 1.86S2.59 2.9 1.445 4.7c-.45.705-.45 1.89 0 2.595 1.145 1.8 2.79 2.84 4.555 2.84"})))},p1;function ff(){return ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ff.apply(null,arguments)}var F9=function(t){return x.createElement("svg",ff({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),p1||(p1=x.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.277 1.004a.406.406 0 0 1 0 .575L2.86 6.996a.406.406 0 0 1-.574 0L.119 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0",clipRule:"evenodd"})))};const f1=({type:e,item:t,handleShowDetails:n,handleRead:o,handleCTAClicked:s,clickId:i})=>{var c,u;const a=kt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return m.jsxs(ve,{className:"cards",sx:{padding:" 0.8rem 0"},children:[m.jsx(it,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:m.jsx(Pu,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA"}},variant:"dot",className:"badge",invisible:t==null?void 0:t.isRead,children:m.jsx(ir,{sx:{color:a.palette.primary.notifyActiveText},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:t==null?void 0:t.message})})}),m.jsx(it,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:m.jsxs(it,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&m.jsx(cc,{icon:m.jsx(L9,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?m.jsx(Za,{color:"primary",size:13}):"Show Details",component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:a.palette.brandColor.orange,color:a.palette.brandColor.white}}),!(t!=null&&t.isRead)&&m.jsx(cc,{icon:m.jsx(F9,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:o,label:"Acknowledge",component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&m.jsx(cc,{disabled:!(t!=null&&t.isPrimaryCTAClicked),onClick:()=>s({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:t==null?void 0:t.primaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&m.jsx(cc,{disabled:!(t!=null&&t.isSecondaryCTAClicked),onClick:()=>s({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:t==null?void 0:t.secondaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),m.jsxs(it,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[m.jsx(ir,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),m.jsx(ir,{color:a.palette.primary.notifyTextColor,children:"•"}),m.jsx(ir,{sx:{fontSize:"0.8rem"},children:fF(t==null?void 0:t.createdAt)})]})]})};f1.propTypes={type:r.string,title:r.string,subTitle:r.string,isRead:r.bool,handleShowDetails:r.func,handleRead:r.func};const h1=({data:e,handleRead:t,handleShowDetails:n,clickId:o,mode:s,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=U.useContext(rf),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,p]=U.useState([]),[f,g]=U.useState(!1),[y,h]=U.useState(!0),b=U.useRef(null),w=async S=>{g(!0);const E=e.slice((S-1)*10,S*10);await new Promise(v=>setTimeout(v,1e3)),p(v=>{const O=E.filter(P=>!v.some(j=>j.id===P.id));return[...v,...O]}),g(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&h(!1)};U.useEffect(()=>{var E;let S=[];s?l!=null&&l.count?S=(E=e==null?void 0:e.filter(v=>!v.isRead))==null?void 0:E.slice(0,10):S=[]:S=e.slice(0,10),(S==null?void 0:S.length)<10&&h(!1),p(S)},[e,s,l]),U.useEffect(()=>{y&&i!==1&&w(i)},[i,e]),U.useEffect(()=>{p([...e])},[e]),U.useEffect(()=>{const S=new IntersectionObserver(E=>{E[0].isIntersecting&&!f&&y&&a(v=>v+1)},{threshold:1});return b.current&&S.observe(b.current),()=>{b.current&&S.unobserve(b.current)}},[f,y]);const T=({redirect:S,isClicked:E,url:v})=>{window.open(v,"_blank")};return m.jsxs(ve,{sx:{width:"100%"},children:[Object.entries(mF(d)).map(([S,E])=>m.jsxs(U.Fragment,{children:[S!==u&&m.jsx(x9,{children:S}),E.map((v,O)=>m.jsx(U.Fragment,{children:m.jsx(f1,{item:v,handleCTAClicked:T,handleShowDetails:()=>n(v.id,v.snopId),handleRead:()=>t([v.id],v.snopId),clickId:o})},`${O}_${v.id}`))]},S)),f&&i>1&&!!(d!=null&&d.length)&&m.jsx(ve,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:m.jsx(Za,{size:20,sx:{color:S=>S.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&m.jsx(Qe,{sx:{fontSize:"1.1rem",color:S=>S.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:"You don't have any unread notification here. Use the toggle to switch between read and unread notification."}),m.jsx(ve,{ref:b,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};h1.propTypes={data:r.array,handleRead:r.func,handleShowDetails:r.func};const _9=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:o,handleMarkAllAsRead:s})=>{var y,h,b,w;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:p,handleTabChange:f,toggleAlertMode:g}=o1({});return m.jsxs(m.Fragment,{children:[m.jsxs(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[m.jsx(Qe,{variant:"h2",sx:{fontSize:"1.2rem",color:T=>T.palette.primary.notifyTextColor},children:"Notifications"}),m.jsx(ve,{component:"img",src:Xe.Refresh,alt:"refresh",onClick:e,sx:{cursor:"pointer"}})]}),m.jsx(ve,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},children:m.jsxs(w9,{value:a,onChange:f,children:[m.jsx(nf,{label:m.jsxs(ve,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",m.jsx(Qe,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((y=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))==null?void 0:y.length)||0}),")"]})}),m.jsx(nf,{label:m.jsxs(ve,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",m.jsx(Qe,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((h=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="INFO"&&!(T!=null&&T.isRead)))==null?void 0:h.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.blue}}),m.jsx(nf,{label:m.jsxs(ve,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",m.jsx(Qe,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((b=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="ERROR"&&!(T!=null&&T.isRead)))==null?void 0:b.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.red}})]})}),m.jsx(el,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},tabIndex:-1,children:i?m.jsx(Za,{size:30,sx:{color:T=>T.palette.primary.notifyIconColor}}):m.jsx(m.Fragment,{children:m.jsx(h1,{data:c,handleShowDetails:t,handleRead:o,clickId:n,page:d,setPage:p,mode:u})})}),m.jsxs(Qa,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[m.jsxs(it,{direction:"row",gap:1,children:[m.jsx(ir,{sx:{fontSize:"1rem"},children:"Only show unread"}),m.jsx(v9,{disabled:i,checked:u,onChange:g})]}),m.jsx(An,{variant:"outlined",className:"view-all",onClick:s,startIcon:m.jsx($9,{}),disabled:!((w=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))!=null&&w.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:T=>T.palette.primary.notifyTextColor,"&:hover":{color:T=>T.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:T=>`${T.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},B9=({data:e,handleClose:t})=>{var T;const[n,o]=U.useState(1),[s,i]=U.useState(10),[a,l]=U.useState(((T=e==null?void 0:e.notificationDetails)==null?void 0:T.length)||0),[c,u]=U.useState("sku_name"),[d,p]=U.useState("asc"),[f,g]=U.useState(""),y=["sku_name","node","channel_name"],h=U.useMemo(()=>!(e!=null&&e.notificationDetails)||!y.length?[]:f.trim()?e.notificationDetails.filter(S=>y.some(E=>{var v;return(v=S[E])==null?void 0:v.toString().toLowerCase().includes(f.toLowerCase())})):e.notificationDetails,[e,f,y]),b=U.useMemo(()=>c?[...h].sort((S,E)=>{const v=S[c],O=E[c];return v==null?1:O==null?-1:typeof v=="number"&&typeof O=="number"?d==="asc"?v-O:O-v:!isNaN(Date.parse(v))&&!isNaN(Date.parse(O))?d==="asc"?new Date(v).getTime()-new Date(O).getTime():new Date(O).getTime()-new Date(v).getTime():d==="asc"?v.toString().localeCompare(O.toString()):O.toString().localeCompare(v.toString())}):h,[h,c,d]),w=U.useMemo(()=>{const S=(n-1)*s,E=S+s;return b.slice(S,E)},[b,n,s]);return console.log({paginatedData:w}),m.jsxs(m.Fragment,{children:[m.jsxs(it,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[m.jsx(Qe,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),m.jsx(ve,{component:"img",src:Xe.CloseCircle,onClick:t,sx:{cursor:"pointer"}})]}),m.jsx(el,{children:m.jsx(of,{tableProps:{data:w,columns:{...y9(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:S=>{var v;const E=(v=S==null?void 0:S.column)==null?void 0:v.key;p(O=>c===E&&O==="asc"?"desc":"asc"),u(E)}},pagination:{selectedPage:n,rowPerPage:s,totalRecords:a,onPageChange:S=>{o(S)},onPageSizeChange:S=>{i(S==null?void 0:S.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:S=>{g(S.target.value)},placeholder:"Search..."}}}})}),m.jsx(Qa,{sx:{padding:"1.5rem 2rem"}})]})},V9=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:o}=o1({baseUrl:e});return m.jsxs(m.Fragment,{children:[m.jsx(ve,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var s;o(),(s=t==null?void 0:t.setOpen)==null||s.call(t,!0)},children:m.jsx(N9,{count:0})}),m.jsx(l1,{...t,children:m.jsx(_9,{...t})}),m.jsx(l1,{...n,children:m.jsx(B9,{...n})})]})},z9=({baseUrl:e})=>m.jsx(kn,{children:m.jsx(R9,{children:m.jsx(V9,{baseUrl:e})})}),W9=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:o,drawerTitle:s,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:p})=>{const f=kt();return m.jsx(ve,{sx:{position:"relative",overflow:"hidden"},children:m.jsxs(Wo,{container:!0,sx:{height:"100%"},children:[m.jsx(Wo,{item:!0,sx:{width:n?d!=null&&d.drawerWidth?`calc(${"100%"-(d==null?void 0:d.drawerWidth)})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),o&&!n&&m.jsxs(m.Fragment,{children:[m.jsx(ve,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}}),m.jsx(ve,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"transparent",zIndex:4}})]}),e&&m.jsxs(Wo,{item:!0,sx:{width:u?"90%":(d==null?void 0:d.drawerWidth)||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:f.palette.primary.notifyBackground,transform:o?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[m.jsxs(it,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:g=>`0.1rem solid ${g.palette.primary.notifyBorderColor}`},children:[!u&&p&&m.jsxs(m.Fragment,{children:[m.jsx(ve,{sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l,children:m.jsx(ve,{component:"img",src:Xe.Merge})}),m.jsx(ei,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:f.palette.primary.notifyBorderColor}})]}),m.jsxs(it,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[m.jsxs(it,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[m.jsx(ve,{component:"img",src:f.icons.close}),m.jsx(Qe,{sx:{fontSize:"1.2rem",color:f.palette.primary.notifyTextColor},children:s})]}),m.jsx(it,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&m.jsx(ve,{onClick:c,sx:{cursor:"pointer"},children:m.jsx(ve,{component:"img",src:u?Xe.Collapse:Xe.Expand})})})]})]}),m.jsx(ve,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},m1=({layoutChildren:e,layoutProps:t})=>m.jsx(kn,{children:m.jsx(W9,{...e,...t})});m1.propTypes={layoutChildren:r.object.isRequired,layoutProps:r.object.isRequired},dt.Button=Xo,dt.Checkbox=Il,dt.DatePicker=uF,dt.Grid=of,dt.Header=Q2,dt.InputField=Gx,dt.Loader=$F,dt.Notification=z9,dt.Select=Zx,dt.SliderLayout=m1,dt.Switch=t2,dt.TextField=Ip,dt.ToastProvider=DF,dt.toast=kF,Object.defineProperty(dt,Symbol.toStringTag,{value:"Module"})});
328
+ `+i):o.stack=i}catch{}}throw o}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=or(this.defaults,n);const{transitional:o,paramsSerializer:s,headers:i}=n;o!==void 0&&sc.assertOptions(o,{silentJSONParsing:Qn.transitional(Qn.boolean),forcedJSONParsing:Qn.transitional(Qn.boolean),clarifyTimeoutError:Qn.transitional(Qn.boolean)},!1),s!=null&&(te.isFunction(s)?n.paramsSerializer={serialize:s}:sc.assertOptions(s,{encode:Qn.function,serialize:Qn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),sc.assertOptions(n,{baseUrl:Qn.spelling("baseURL"),withXsrfToken:Qn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&te.merge(i.common,i[n.method]);i&&te.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=sn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,p=0,f;if(!c){const y=[j2.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),f=y.length,d=Promise.resolve(n);p<f;)d=d.then(y[p++],y[p++]);return d}f=l.length;let g=n;for(p=0;p<f;){const y=l[p++],h=l[p++];try{g=y(g)}catch(b){h.call(this,b);break}}try{d=j2.call(this,g)}catch(y){return Promise.reject(y)}for(p=0,f=u.length;p<f;)d=d.then(u[p++],u[p++]);return d}getUri(t){t=or(this.defaults,t);const n=E2(t.baseURL,t.url,t.allowAbsoluteUrls);return g2(n,t.params,t.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(t){rr.prototype[t]=function(n,o){return this.request(or(o||{},{method:t,url:n,data:(o||{}).data}))}}),te.forEach(["post","put","patch"],function(t){function n(o){return function(i,a,l){return this.request(or(l||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}rr.prototype[t]=n(),rr.prototype[t+"Form"]=n(!0)});let o9=class y1{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 o=this;this.promise.then(s=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](s);o._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(l=>{o.subscribe(l),i=l}).then(s);return a.cancel=function(){o.unsubscribe(i)},a},t(function(i,a,l){o.reason||(o.reason=new ps(i,a,l),n(o.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=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new y1(function(s){t=s}),cancel:t}}};function r9(e){return function(n){return e.apply(null,n)}}function s9(e){return te.isObject(e)&&e.isAxiosError===!0}const Yp={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(Yp).forEach(([e,t])=>{Yp[t]=e});function L2(e){const t=new rr(e),n=n2(rr.prototype.request,t);return te.extend(n,rr.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return L2(or(e,s))},n}const mt=L2(Yi);mt.Axios=rr,mt.CanceledError=ps,mt.CancelToken=o9,mt.isCancel=C2,mt.VERSION=N2,mt.toFormData=Ql,mt.AxiosError=Fe,mt.Cancel=mt.CanceledError,mt.all=function(t){return Promise.all(t)},mt.spread=r9,mt.isAxiosError=s9,mt.mergeConfig=or,mt.AxiosHeaders=sn,mt.formToJSON=e=>v2(te.isHTMLForm(e)?new FormData(e):e),mt.getAdapter=A2.getAdapter,mt.HttpStatusCode=Yp,mt.default=mt;const{Axios:FB,AxiosError:_B,CanceledError:BB,isCancel:VB,CancelToken:zB,VERSION:WB,all:UB,Cancel:HB,isAxiosError:qB,spread:YB,toFormData:GB,AxiosHeaders:KB,HttpStatusCode:XB,formToJSON:ZB,getAdapter:JB,mergeConfig:QB}=mt,Gp={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"};/*! js-cookie v3.0.5 | MIT */function ic(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var i9={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Kp(e,t){function n(s,i,a){if(!(typeof document>"u")){a=ic({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=s+"="+e.write(i,s)+l}}function o(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),u=c.slice(1).join("=");try{var d=decodeURIComponent(c[0]);if(a[d]=e.read(u,d),s===d)break}catch{}}return s?a[s]:a}}return Object.create({set:n,get:o,remove:function(s,i){n(s,"",ic({},i,{expires:-1}))},withAttributes:function(s){return Kp(this.converter,ic({},this.attributes,s))},withConverter:function(s){return Kp(ic({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var a9=Kp(i9,{path:"/"});const Ro={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Xp={BEARER:"Bearer",TENANT_ID:"tenant_id",BU_ID:"bu_id",SNOP_ID:"snop_id"},l9=[10,25,50,100],F2={MARK_ALL_READ:"MARK_ALL_READ"},c9=l9.map(e=>({label:e,value:e})),_2={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Zp=ql(Ro.SNOP),Jp=ql(Ro.SELECTED_BU),Qp=ql(Ro.USER),u9=ql(Ro.SETTINGS),sr={BU_IDS:Jp==null?void 0:Jp.business_unit_id,TOKEN:JSON.parse(a9.get(Ro.TOKEN)||null),TENANT_IDS:Qp==null?void 0:Qp.tenant_id,SNOP_IDS:Zp==null?void 0:Zp.snop_id,GRID_SETTINGS:u9},Ki={headers:{"Content-Type":"application/json",Authorization:`${Xp.BEARER} ${sr.TOKEN}`}},B2=mt.create({baseURL:Gp.BASE_URL,axiosConfig:Ki});B2.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),B2.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const ac={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"},{TENANT_ID:d9,BU_ID:p9}=Xp,{TENANT_IDS:f9,BU_IDS:h9}=sr,lc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${ac.SETTING}/v1?${d9}=${f9}&${p9}=${h9}`;return await mt.post(n,t,Ki)}catch(n){return n}},m9=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:o,pageSize:s})=>{var y;let{definitions:i,defaultUserSettings:a,labels:l}=e;const c=t.split("/").filter(Boolean);let u=c.reduce((h,b)=>h==null?void 0:h[b],sr.GRID_SETTINGS)||null;o||!u&&!a&&(async()=>{try{a=V2({definitions:i});let h=sr.GRID_SETTINGS||{platform:{theme:"light"}};const b=(u==null?void 0:u.pageSize)??s;let w=h;for(let T=0;T<c.length;T++){const S=c[T];T===c.length-1?w[S]={columns:a,pageSize:b}:(w[S]=w[S]||{},w=w[S])}localStorage.setItem(Ro.SETTINGS,JSON.stringify(h)),await lc({baseUrl:n,payload:h})}catch(h){console.error(h)}})(),a=(u==null?void 0:u.columns)??a??V2({definitions:i});const d=a.reduce((h,b)=>(h[b.id]=b,h),{}),p=l.reduce((h,b)=>(h[b.id]=b,h),{}),f=[];for(const h of i){const b=d[h.id]||{},w=p[h.id]||{};let T={...h,...b,...w};if((y=h.children)!=null&&y.length){const S=b.children||[],E=w.children||[];T.children=h.children.map((v,O)=>({...v,...S[O],...E[O]}))}f.push(T)}return f.sort((h,b)=>h.sequenceId-b.sequenceId)},g9=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),V2=({definitions:e})=>e.map((t,n)=>({id:t.id,key:t.key,sequenceId:t.id,isHidden:!1,style:t.style||{}})),y9=()=>({definitions:[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],defaultUserSettings:[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],labels:[{id:1,key:"sku_name",label:"SKU",isLocalizable:!1},{id:2,key:"node",label:"Node",isLocalizable:!1},{id:3,key:"channel_name",label:"Channel",isLocalizable:!1}]});class ef extends U.Component{constructor(t){super(t),this.startDrag=this.startDrag.bind(this),this.endDrag=this.endDrag.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.dragging=!1,this.mouseX=0,this.startPos=0,this.startWidthPrev=0,this.lastDraggedWidth=0,this.draggedCol=null,this.resizeRef=U.createRef()}startDrag(){if(!this.props.disabled&&(this.draggedCol=this.props.id,this.props.resizeStart&&this.draggedCol===this.props.id&&this.props.resizeStart(),this.dragging=!0,this.startPos=this.mouseX,this.startWidthPrev=0,this.resizeRef.current)){let t=this.resizeRef.current.previousSibling;t&&(this.startWidthPrev=t.clientWidth)}}endDrag(){this.props.disabled||(this.dragging=!1,this.props.resizeEnd&&this.draggedCol===this.props.id&&this.props.resizeEnd(this.lastDraggedWidth),this.draggedCol=null)}onMouseMove(t){if(this.props.disabled||(this.mouseX=t.touches?t.touches[0].screenX:t.screenX,!this.dragging))return;const n=this.resizeRef.current,o=this.startPos-this.mouseX;let s=this.startWidthPrev-o;(!this.props.minWidth||s>=this.props.minWidth)&&(!this.props.maxWidth||s<=this.props.maxWidth)&&(n.previousSibling.style.width=s+"px",n.previousSibling.style.minWidth=s+"px",n.previousSibling.style.maxWidth=s+"px",n.previousSibling.style.setProperty("--column_resize_before_width",s+"px"),this.lastDraggedWidth=s)}componentDidMount(){const t=this.resizeRef.current;if(t&&(this.props.defaultWidth?(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")):this.props.minWidth&&(t.previousSibling.style.minWidth=this.props.minWidth+"px",t.previousSibling.style.width=this.props.minWidth+"px",t.previousSibling.style.maxWidth=this.props.minWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.minWidth+"px"))),this.props.disabled){this.props.defaultWidth&&t&&(t.previousSibling.style.minWidth=this.props.defaultWidth+"px",t.previousSibling.style.width=this.props.defaultWidth+"px",t.previousSibling.style.maxWidth=this.props.defaultWidth+"px",t.previousSibling.style.setProperty("--column_resize_before_width",this.props.defaultWidth+"px")),this.props.maxWidth&&t&&(t.previousSibling.style.maxWidth=this.props.maxWidth+"px");return}this.addEventListenersToDocument()}componentWillUnmount(){this.props.disabled||this.removeEventListenersFromDocument()}componentDidUpdate(t,n){t.disabled&&!this.props.disabled&&this.addEventListenersToDocument(),!t.disabled&&this.props.disabled&&this.removeEventListenersFromDocument()}addEventListenersToDocument(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.endDrag),document.addEventListener("touchmove",this.onMouseMove),document.addEventListener("touchend",this.endDrag)}removeEventListenersFromDocument(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.endDrag),document.removeEventListener("touchmove",this.onMouseMove),document.removeEventListener("touchend",this.endDrag)}render(){var t={userSelect:"none"};return this.props.disabled||(t.cursor="ew-resize"),this.props.className===""&&(t.width="6px",t.backgroundColor="rgba(0, 0, 0, 0.1)"),U.createElement("th",{ref:this.resizeRef,style:t,disabled:this.props.disabled,rowSpan:this.props.rowSpan?this.props.rowSpan:1,colSpan:this.props.colSpan?this.props.colSpan:1,className:`column_resizer_own_class ${this.props.disabled?"disabled_column_resize":""} ${this.props.className}`,onMouseDown:this.props.disabled?null:this.startDrag,onTouchStart:this.props.disabled?null:this.startDrag})}}ef.defaultProps={disabled:!1,minWidth:0,className:""},ef.propTypes={disabled:"boolean",minWidth:"number",className:"string"};const b9=(e,t,n,o)=>{const[s,i]=U.useState({isOpen:!1,column:null}),a=(u,d)=>{i({isOpen:u.currentTarget,column:d})},l=()=>{i({isOpen:!1,column:null})};return{selectedColumn:s,handleMenuClick:a,handleClose:l,handleHideClick:async()=>{l();const u=e.map(p=>{var f;return p.id===((f=s==null?void 0:s.column)==null?void 0:f.id)?{...p,isHidden:!0}:p});t({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:u}});let d=sr.GRID_SETTINGS||{platform:{theme:"light"},grid:{}};d.grid=d.grid||{},d.grid[o]=u,localStorage.setItem(Ro.SETTINGS,JSON.stringify(d)),await lc({baseUrl:n,payload:d})}}},z2=({pagination:e})=>{const{selectedPage:t,rowPerPage:n,totalRecords:o,onPageChange:s,onPageSizeChange:i}=e,a=kt();return m.jsxs(ve,{sx:{display:"flex",p:"1rem 2rem"},children:[m.jsxs(ve,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[m.jsx(Qe,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:`Showing ${(t-1)*n+1} to ${Math.min(t*n,o)} of ${o} rows`}),m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:m.jsx(Gl,{options:c9,value:n,onChange:i})}),m.jsx(Qe,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:"records per page"})]}),m.jsx(Ug,{count:Math.ceil(o/n),page:t,onChange:(l,c)=>{s(c)},shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:a.palette.primary.notifyActiveText,backgroundColor:`${a.palette.brandColor.paginationBc} !important`}}})]})};z2.propTypes={pagination:r.object.isRequired};function tf({isRenderCellContent:e,column:t,row:n,parent:o}){const s=n[t.key];return m.jsx(m.Fragment,{children:e?m.jsx(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:t==null?void 0:t.cellRenderer(n,{column:t,parent:o})}):m.jsx(Qg,{title:(s==null?void 0:s.length)>20?s:"",arrow:!0,children:m.jsx(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},component:"label",children:gF(s)})})})}tf.propTypes={isRenderCellContent:r.bool,column:r.object,row:r.object};const W2=({menuOpen:e,handleClose:t,onHideClick:n})=>{const o=kt();return m.jsx(sl,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:m.jsx(ve,{sx:{p:"0.4rem 1rem",backgroundColor:o.palette.primary.notifyBackground,border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:m.jsx(An,{onClick:n,sx:{textTransform:"none",fontSize:"1.1rem",p:0,minHeight:"unset",fontWeight:"500",color:o.palette.primary.notifyTextColor},children:"Hide Column"})})})};W2.propTypes={menuOpen:r.object,handleClose:r.func,onHideClick:r.func},Y(Ja)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:8,border:`1px solid ${e.palette.primary.notifyBorderColor}`,boxShadow:e.shadows[4],padding:"1rem 1rem 0rem 1rem",backgroundColor:e.palette.primary.notifyBackground}}));const ir=Y(Qe)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),v9=Y(e0)(({theme:e})=>({width:28,height:16,padding:0,display:"flex","&:active":{"& .MuiSwitch-thumb":{width:15},"& .MuiSwitch-switchBase.Mui-checked":{transform:"translateX(9px)"}},"& .MuiSwitch-switchBase":{padding:2,"&.Mui-checked":{transform:"translateX(12px)",color:"#fff","& + .MuiSwitch-track":{opacity:1,backgroundColor:"#1890ff",...e.applyStyles("dark",{backgroundColor:"#177ddc"})}}},"& .MuiSwitch-thumb":{boxShadow:"0 2px 4px 0 rgb(0 35 11 / 20%)",width:12,height:12,borderRadius:6,transition:e.transitions.create(["width"],{duration:200})},"& .MuiSwitch-track":{borderRadius:16/2,opacity:1,backgroundColor:"rgba(0,0,0,.25)",boxSizing:"border-box",...e.applyStyles("dark",{backgroundColor:"rgba(255,255,255,.35)"})}})),x9=Y(ei)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),C9=Y(Pu)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:2.34,border:`0.1rem solid ${e.palette.primary.notifyBackground}`,padding:"0 1.3px",borderRadius:"50%",backgroundColor:"#D44E40",fontSize:"0.725rem",minWidth:"0.7rem",height:"0.7rem"}}));Y(dl)(({theme:e})=>({"& .MuiInputBase-root":{height:"3.52rem"},"& .MuiFormLabel-root":{color:`${e.palette.primary.notifyBorderColor} !important`,fontSize:"1rem",marginTop:"0.4rem"},"& label.Mui-focused":{color:e.palette.primary.notifyTextColor},"& .MuiInput-underline:after":{borderBottomColor:e.palette.primary.notifyBorderColor,borderBottomWidth:"0.1rem"},"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&:hover fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"},"&.Mui-focused fieldset":{borderColor:e.palette.primary.notifyBorderColor,borderWidth:"0.1rem"}}}));const w9=Y(v0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),nf=Y(t0)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),cc=Y(Eu)(({theme:e})=>({"&.MuiChip-outlined":{borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText},height:"2rem",fontSize:"0.9rem",fontWeight:"300",borderColor:e.palette.primary.notifyBorderColor,color:e.palette.primary.notifyActiveText,borderRadius:"0.6rem",padding:"0.2rem","&:hover":{backgroundColor:`${e.palette.brandColor.orange} !important`,color:`${e.palette.brandColor.white} !important`}})),U2=({sortKey:e,sortField:t,sortDir:n,handleSortClick:o})=>{const s=i=>m.jsx(fo,{onClick:o,sx:{padding:"0.5rem"},children:m.jsx(ve,{component:"img",src:i})});return m.jsx(m.Fragment,{children:s(t===e?n==="asc"?Xe.AscSort:Xe.DescSort:Xe.Unsort)})};U2.propTypes={sortKey:r.string.isRequired,sortField:r.string,sortDir:r.string,handleSortClick:r.func};function H2({parent:e,column:t,sort:n,handleMenuClick:o,isManageable:s}){const i=t==null?void 0:t.isMandatory,a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return m.jsxs(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",textAlign:"center",whiteSpace:"normal"},children:[a,m.jsxs(ve,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[l&&m.jsx(U2,{sortKey:e?`${e==null?void 0:e.key}|${t==null?void 0:t.key}`:t==null?void 0:t.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),s&&!i&&m.jsx(fo,{onClick:p=>o(p,t),sx:{padding:"0.5rem"},children:m.jsx(ve,{component:"img",src:Xe.Menu})})]})]})}H2.propTypes={column:r.object.isRequired,sort:r.object.isRequired,handleMenuClick:r.func,isManageable:r.bool};const S9=Y(i0)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Hu.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"},[`&.${Hu.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"}}));function fs({children:e,...t}){return m.jsx(S9,{...t,children:e})}fs.propTypes={children:r.node};const T9=Y(p0)(()=>({"&:last-child td":{borderBottom:0}}));function hs({children:e,...t}){return m.jsx(T9,{...t,children:e})}hs.propTypes={children:r.node};function q2({rows:e,sort:t,data:n,pagination:o,columns:s,nested:i,baseUrl:a,gridPath:l}){var L;const c=kt(),{visibleGridColumns:u}=U.useContext(Wi),d=U.useContext(Ui),{selectedColumn:p,handleMenuClick:f,handleClose:g,handleHideClick:y}=b9(u,d,a,l),h=s==null?void 0:s.isManageable,b=(n==null?void 0:n.length)>0,w=U.useRef(null),[T,S]=U.useState(null);let E=null;const v=U.useRef(0),O=g9(((L=i==null?void 0:i.column)==null?void 0:L.definitions)||[]),P=i==null?void 0:i.isNested,j=(i==null?void 0:i.data)||[],N=i==null?void 0:i.hashKey;if(!b)return m.jsx(ir,{sx:{textAlign:"center"},children:Po.NRF});const F=(R,D)=>{S(D),R.dataTransfer.setData("colIndex",D)},B=R=>{R.preventDefault(),V(R)},$=async(R,D)=>{if(R.preventDefault(),clearInterval(E),T===null||T===D)return;const _=[...u],[H]=_.splice(T,1);_.splice(D,0,H);const K=u.slice().sort((re,Z)=>re.sequenceId-Z.sequenceId).map(re=>re.sequenceId),q=_.map((re,Z)=>({...re,sequenceId:K[Z]??re.sequenceId})),J={...sr.GRID_SETTINGS||{platform:{theme:"light"}}},G=l.split("/").filter(Boolean);let ne=J;for(let re=0;re<G.length;re++){const Z=G[re];if(re===G.length-1){const ee=(o==null?void 0:o.rowPerPage)??null;ne[Z]={columns:q,pageSize:ee}}else ne[Z]=ne[Z]||{},ne=ne[Z]}localStorage.setItem(Ro.SETTINGS,JSON.stringify(J)),d({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:q}}),await lc({baseUrl:a,payload:J}),S(null)},V=R=>{const D=w.current,{left:_,right:H}=D.getBoundingClientRect(),K=50,q=R.clientX>H-K?1:R.clientX<_+K?-1:0;q!==0?(clearInterval(E),E=setInterval(()=>{D.scrollLeft+=q*10},50)):clearInterval(E)},I=(R,D,_,H)=>{var G,ne,re;const K=(R==null?void 0:R.isMandatory)&&(R==null?void 0:R.isSticky),q=parseFloat((ne=(G=R==null?void 0:R.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;D===0&&(v.current=0);const J=K?D===0?0:`${v.current}rem`:void 0;return K&&(v.current+=q),m.jsx(fs,{rowSpan:R!=null&&R.children?1:2,colSpan:(re=R==null?void 0:R.children)==null?void 0:re.length,style:R==null?void 0:R.style,draggable:_&&!H&&!(R!=null&&R.isMandatory),onDragStart:_?Z=>F(Z,D):void 0,onDragOver:_?B:void 0,onDrop:_?Z=>$(Z,D):void 0,sx:{...K&&{borderRadius:"0rem!important",position:"sticky",left:J,zIndex:3},...R!=null&&R.children||H?{borderRadius:"0rem!important",borderRight:Z=>`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}:{borderLeft:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`,borderRight:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}},children:m.jsx(H2,{parent:H,column:R,sort:t,handleMenuClick:f,isManageable:_})},D)},M=(R,D,_,H)=>!(R!=null&&R.isMandatory)&&_?m.jsx(ve,{component:ef,id:D,sx:{width:"4rem",maxWidth:"4rem",minWidth:"4rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:"50%",transform:"translate(0%, -50%)",width:"0.2rem",height:"50%",background:c.palette.primary.notifyBorderColor}},disabled:!_}):null,k=(R,D,_,H)=>{var G,ne,re;const K=(R==null?void 0:R.isMandatory)&&(R==null?void 0:R.isSticky),q=parseFloat((ne=(G=R==null?void 0:R.style)==null?void 0:G.minWidth)==null?void 0:ne.toString().replace("rem",""))||7.5;_===0&&(v.current=0);const J=K?_===0?0:`${v.current}rem`:void 0;return K&&(v.current+=q),m.jsxs(fs,{style:R==null?void 0:R.style,className:`${R==null?void 0:R.label}`,sx:{position:"relative",...K&&{position:"sticky",left:J,zIndex:2,backgroundColor:Z=>{var ee;return e&&((ee=e==null?void 0:e.selectedRow)==null?void 0:ee.fhi)===(D==null?void 0:D.fhi)||D!=null&&D.isHigh?Z.palette.primary.appBackground:Z.palette.primary.notifyBackground}},...H?{p:"0rem!important",borderRight:Z=>`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}:{px:"0rem!important",borderLeft:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`,borderRight:Z=>(R==null?void 0:R.key)==="volume_value"&&`0.1rem solid ${Z.palette.primary.notifyBorderColor}`}},children:[(e&&((re=e==null?void 0:e.selectedRow)==null?void 0:re.fhi)===(D==null?void 0:D.fhi)||(D==null?void 0:D.isHigh))&&m.jsx(ve,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.05rem",background:"linear-gradient(#F9B16E, #F68080)"}}),m.jsx(tf,{isRenderCellContent:!!(R!=null&&R.cellRenderer),column:R,row:D,parent:H})]},_)},A=(R,D,_,H)=>!(R!=null&&R.isMandatory)&&_?m.jsx(fs,{className:"column_resizer_body"},`resize-${D}`):null;return m.jsxs(m.Fragment,{children:[m.jsx(a0,{sx:{maxHeight:"100%",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem"},children:m.jsxs(o0,{ref:w,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:R=>R.palette.primary.notifyBackground},children:[m.jsxs(c0,{children:[m.jsx(hs,{children:u.map((R,D)=>R!=null&&R.isHidden?null:m.jsxs(U.Fragment,{children:[I(R,D,h),(s==null?void 0:s.isResizable)&&M(R,D,h)]},D))}),m.jsx(hs,{children:u.flatMap((R,D)=>R!=null&&R.isHidden||!(R!=null&&R.children)?[]:R.children.map((_,H)=>m.jsxs(U.Fragment,{children:[I(_,H,h,R),(s==null?void 0:s.isResizable)&&M(_,H,h)]},`${D}-${H}`)))})]}),m.jsx(s0,{children:n.map((R,D)=>{const _=R[N],H=j==null?void 0:j[_],K=(H==null?void 0:H.length)>0;return m.jsxs(U.Fragment,{children:[m.jsx(hs,{sx:{backgroundColor:q=>{var J;return e&&((J=e==null?void 0:e.selectedRow)==null?void 0:J.fhi)===(R==null?void 0:R.fhi)||R!=null&&R.isHigh?q.palette.primary.appBackground:q.palette.primary.notifyBackground}},onClick:()=>e==null?void 0:e.onRowClick(R),children:u.map((q,J)=>q!=null&&q.isHidden?null:q!=null&&q.children?q.children.map((G,ne)=>m.jsxs(U.Fragment,{children:[k(G,R,ne,q),(s==null?void 0:s.isResizable)&&A(G,ne,h)]},`${J}-${ne}`)):m.jsxs(U.Fragment,{children:[k(q,R,J),(s==null?void 0:s.isResizable)&&A(q,J,h)]},J))}),P&&H&&m.jsx(m.Fragment,{children:K?H.map((q,J)=>m.jsx(hs,{children:O.map((G,ne)=>m.jsx(fs,{style:G==null?void 0:G.style,children:m.jsx(tf,{isRenderCellContent:!!(G!=null&&G.cellRenderer),column:G,row:q})},ne))},`nested-${J}`)):m.jsx(hs,{children:m.jsx(fs,{colSpan:O.length,children:m.jsx(ir,{sx:{textAlign:"center"},children:Po.NRF})})})})]},D)})})]})}),o&&m.jsx(z2,{pagination:o}),m.jsx(W2,{menuOpen:p==null?void 0:p.isOpen,handleClose:g,onHideClick:y})]})}q2.propTypes={sort:r.object,data:r.array,pagination:r.object,columns:r.object,nested:r.object};function Y2({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:o}){var u;const{columns:s}=e,{visibleGridColumns:i=[]}=U.useContext(Wi)??{},a=U.useContext(Ui),l=U.useMemo(()=>{var d;return m9({columns:s,gridPath:n,baseUrl:o,isDefaultConfig:t,pageSize:(d=e==null?void 0:e.pagination)==null?void 0:d.rowPerPage})},[s,n,o,t,(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage]),c=U.useMemo(()=>{const d=new Map(i.map(p=>[p.key,p]));return l.map(p=>{const f=d.get(p.key);return{...p,...f&&{isHidden:f.isHidden,sequenceId:f.sequenceId}}})},[l,i]);return U.useEffect(()=>{a({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:i.length?c:l}})},[l]),m.jsx(q2,{...e,gridPath:n,baseUrl:o})}Y2.propTypes={tableProps:r.object.isRequired,mergedColumns:r.array.isRequired};const G2=({type:e})=>{const t=kt(),o=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:m.jsxs(ve,{sx:{borderRadius:2,overflow:"hidden"},children:[m.jsx(lo,{variant:"text",width:"100%",height:60,sx:o}),Array.from({length:10}).map((i,a)=>m.jsx(ve,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>m.jsx(ve,{sx:{flex:1},children:m.jsx(lo,{variant:"text",height:45,sx:o})},c))},a))]}),toolbar:m.jsx(m.Fragment,{children:m.jsxs(it,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[m.jsxs(it,{direction:"row",gap:"1rem",children:[m.jsx(lo,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"15.2rem",height:"5rem",sx:o})]}),m.jsxs(it,{direction:"row",gap:"1rem",children:[m.jsx(lo,{variant:"text",width:"10.2rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"3.5rem",height:"5rem",sx:o}),m.jsx(lo,{variant:"text",width:"3.5rem",height:"5rem",sx:o})]})]})})}[e]},E9=e=>{if(!e)return null;const{options:t,...n}=e,o=t?"select":"button",s={button:i=>m.jsx(Xo,{...i}),select:i=>{var a;return m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:m.jsx(Zx,{...i,options:t})})}};return s[o]?s[o](n):null},O9=({presentSetting:e,gridSetting:t,gridPath:n})=>{var a;if(!n)return e;const o=n.split("/").filter(Boolean),s=(a=t==null?void 0:t.grid)==null?void 0:a.map(({id:l,isHidden:c,isSortable:u,key:d,sequenceId:p})=>({id:l,isHidden:c,isSortable:u,key:d,sequenceId:p}));let i=e;for(let l=0;l<o.length;l++){const c=o[l];l===o.length-1?i[c]={columns:s,pageSize:(t==null?void 0:t.pageSize)??null}:(i[c]=i[c]||{},i=i[c])}return{settingObject:e,defaultUserSettings:s}},k9=async({baseUrl:e,gridSetting:t,gridPath:n})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:s,defaultUserSettings:i}=O9({presentSetting:o,gridSetting:t,gridPath:n});return localStorage.setItem("settings",JSON.stringify(s)),await lc({baseUrl:e,payload:s}),i}catch(o){console.error(o)}},P9=({customTools:e})=>{var o,s;const t=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===_2.PRIMARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId),n=(s=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===_2.SECONDARY))==null?void 0:s.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},K2=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:o,secondaryButtons:s}=P9({customTools:e}),[i,a]=U.useState(o),l=(s==null?void 0:s.length)>0,c=d=>{d?a([...o,...s]):setTimeout(()=>{a(o)},100)},u=()=>{const d=!t;n(d),c(d)};return U.useEffect(()=>{c(t)},[e]),m.jsxs(m.Fragment,{children:[t&&m.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),m.jsxs(ve,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[m.jsx(B5,{mode:"popLayout",children:i.map(d=>m.jsx(Mi.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:m.jsx(ve,{sx:{flexShrink:0,minWidth:"fit-content"},children:E9(d)})},d.id))}),l&&m.jsx(ve,{sx:{paddingLeft:t?"0.5rem":0},children:m.jsx(Xo,{label:t?"":"More Actions",styles:{icon:t?Xe.CrossWhite:Xe.More,colorType:t?"danger":""},onClick:u})})]})]})};K2.propTypes={customTools:r.array.isRequired};const X2=({defaultTools:e,isManageable:t,customTools:n,baseUrl:o,gridPath:s,managableColumns:i=[],pageSize:a})=>{var b,w,T,S,E,v;const l=U.useContext(Ui),{visibleGridColumns:c,triggerApi:u}=U.useContext(Wi),[d,p]=U.useState([]),[f,g]=U.useState(!1);U.useEffect(()=>{if(i.length){const O=i.length?c.filter(P=>i.includes(P.id)):c;p(O)}},[i,c]);const y=async O=>{try{await k9({baseUrl:o,gridPath:s,gridSetting:{grid:O,pageSize:a}})}catch(P){console.error(P)}finally{l({type:Ve.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),l({type:Ve.TRIGGER_API,payload:{triggerApi:!1}})}};U.useEffect(()=>{u&&y(c)},[u]);const h=O=>{const P=c.map(j=>d.some(F=>F.id===j.id)?{...j,isHidden:!O.some(F=>F.id===j.id)}:j);l({type:Ve.SET_GRID_DATA,payload:{visibleGridColumns:P}}),l({type:Ve.HAS_SETTING_CHANGE,payload:{hasChange:!0}})};return m.jsxs(ve,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[m.jsxs(ve,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((b=e==null?void 0:e.search)==null?void 0:b.isRequired)&&m.jsx(Gx,{...e==null?void 0:e.search}),((w=e==null?void 0:e.groupBy)==null?void 0:w.isRequired)&&m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(Gl,{styles:{icon:Xe.Group},...e.groupBy})}),((T=e==null?void 0:e.refresh)==null?void 0:T.isRequired)&&m.jsx(Xo,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Xe.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),t&&m.jsx(ve,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:m.jsx(Gl,{placeholder:"Manage Columns",options:d,value:d.filter(O=>!O.isHidden),isMulti:!0,isDraggable:!0,showSearch:!0,onChange:h,styles:{icon:Xe.Manage}})})]}),m.jsxs(ve,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&m.jsx(K2,{customTools:n,setIsExpanded:g,isExpanded:f}),((S=e==null?void 0:e.save)==null?void 0:S.isRequired)&&m.jsx(ve,{sx:{px:"0.5rem"},children:m.jsx(Xo,{label:f?"":"Save",styles:{icon:Xe.Save,colorType:"empty"},...e==null?void 0:e.save})}),((E=e==null?void 0:e.upload)==null?void 0:E.isRequired)&&m.jsx(Xo,{...e==null?void 0:e.upload,styles:{variant:f?"outlined":"filled",icon:f?Xe.UploadDark:Xe.Upload,colorType:"secondary",isAnimate:!0}}),((v=e==null?void 0:e.download)==null?void 0:v.isRequired)&&m.jsx(Xo,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Xe.Download,isAnimate:!0}})]})]})};X2.propTypes={defaultTools:r.object.isRequired,customTools:r.array,isManageable:r.bool,baseUrl:r.string,gridPath:r.gridPath};function of({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:o}){var i,a;const s=(i=e.columns)==null?void 0:i.isManageable;return m.jsx(Xx,{children:o?m.jsxs(m.Fragment,{children:[m.jsx(G2,{type:"toolbar"}),m.jsx(G2,{type:"grid"})]}):m.jsxs(m.Fragment,{children:[t&&m.jsx(X2,{...t,isManageable:s,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage}),m.jsx(Y2,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||""})]})})}of.propTypes={tableProps:r.object.isRequired,toolbarProps:r.object,isDefaultConfig:r.bool};const Z2=({list:e,handleLinkClick:t})=>{const n=kt(),o=({list:s})=>{var i;return(i=s==null?void 0:s.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?m.jsx(vo,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(s==null?void 0:s.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a==null?void 0:a.link,underline:"hover",onClick:()=>t(a),children:a==null?void 0:a.title},l):m.jsx(Qe,{component:"h3",sx:{fontSize:"1rem",color:l===(s==null?void 0:s.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return m.jsx(sg,{separator:m.jsx(ve,{component:"img",src:Xe.ArrowRight}),children:o({list:e})})};Z2.propTypes={list:r.array.isRequired,handleLinkClick:r.func};const J2=({breadcrumbProps:e,switchProps:t,filterComponentProps:n})=>{var s,i,a,l,c,u;const o=kt();return m.jsxs(m.Fragment,{children:[m.jsxs(it,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 5.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[m.jsx(Z2,{...e}),m.jsxs(it,{direction:"row",gap:"1rem",alignItems:"center",children:[t&&m.jsx(t2,{...t}),(n==null?void 0:n.filterBtnProps)&&m.jsxs(it,{direction:"row",children:[m.jsx(ei,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),m.jsxs(it,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(s=n==null?void 0:n.filterBtnProps)==null?void 0:s.onFilterClick,sx:{cursor:"pointer"},children:[m.jsx(ve,{component:"img",src:o.icons.filter}),m.jsx(Qe,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.label})]})]})]})]}),m.jsx(Mi.div,{layout:!0,initial:{height:"0rem"},animate:{height:(a=n==null?void 0:n.filterBtnProps)!=null&&a.filterContainerVisible?"5rem":"0rem",opacity:(l=n==null?void 0:n.filterBtnProps)!=null&&l.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden"},children:m.jsxs(it,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[m.jsx(Qe,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),m.jsx(ve,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:m.jsx(it,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(c=n==null?void 0:n.filterItems)==null?void 0:c.map((d,p)=>m.jsx(m.Fragment,{children:m.jsxs(ve,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,background:o.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[m.jsx(ve,{component:"img",src:Xe.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(d)}),m.jsx(Qe,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:d==null?void 0:d.filterLabel})]},p)}))})}),m.jsx(ve,{component:Qe,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(u=n==null?void 0:n.filterContainerProps)==null?void 0:u.onClearClick,children:"Clear"})]})})]})};J2.propTypes={breadcrumbProps:r.object.isRequired,switchProps:r.object};function Q2({headerProps:e}){return m.jsx(kn,{children:m.jsx(J2,{...e})})}Q2.propTypes={headerProps:r.object.isRequired};const rf=U.createContext(null),e1=U.createContext(null);function R9({children:e}){const[t,n]=U.useReducer(M9,D9);return m.jsx(rf.Provider,{value:t,children:m.jsx(e1.Provider,{value:n,children:e})})}function M9(e,t){var n;switch(t.type){case Ve.LOADING:return{...e,loading:t.loading};case Ve.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((o,s)=>new Date(s.createdAt)-new Date(o.createdAt))};case Ve.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case Ve.ERROR:return{...e,error:t.error};default:throw new Error(`${Po.UNHANDLED}: ${t}`)}}const D9={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:sf,BU_ID:af,SNOP_ID:t1}=Xp,{TENANT_IDS:lf,BU_IDS:cf}=sr,I9=async e=>{try{const t=`${e}${ac.NOTIFICATION}/v1?${sf}=${lf}&${af}=${cf}`;return await mt.get(t,Ki)}catch(t){return t}},n1=async(e,t,n)=>{try{const o=n===F2.MARK_ALL_READ?"":`&${t1}=${n}&`,s=`${e}${ac.NOTIFICATION}${Gp.VERSION}?${sf}=${lf}&${af}=${cf}${o}`;return await mt.put(s,t,Ki)}catch(o){return o}},A9=async({baseUrl:e,id:t,snopId:n})=>{try{const o=`${e}${ac.NOTIFICATION}${Gp.VERSION}?${sf}=${lf}&${af}=${cf}&${t1}=${n}&id=${t}`;return await mt.get(o,Ki)}catch(o){return o}},uc={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},o1=({baseUrl:e})=>{const t=U.useContext(e1),[n,o]=U.useState(!1),[s,i]=U.useState(!1),[a,l]=U.useState(!1),[c,u]=U.useState({}),[d,p]=U.useState(null),[f,g]=U.useState(1),[y,h]=U.useState(!1),[b,w]=U.useState(0),{loading:T,data:S,isMarkAllAsRead:E}=U.useContext(rf),[v,O]=U.useState([]);U.useEffect(()=>{O(S)},[S]);const P=U.useCallback(async()=>{var I,M;try{t({type:Ve.LOADING,loading:!0}),t({type:Ve.SUCCESS,data:[]});const k=await I9(e);if(k.status===uc.OK){const A=((M=(I=k.data)==null?void 0:I.responseData)==null?void 0:M.response)||[],L=Yl(A);t({type:Ve.SUCCESS,data:Yl(L)}),t({type:Ve.MARK_ALL_AS_READ,isMarkAllAsRead:{count:Kx(A),boo:Kx(A)>0}})}}catch{t({type:Ve.ERROR,error:Po.SWR})}finally{t({type:Ve.LOADING,loading:!1})}},[e,t]);U.useEffect(()=>{P();const I=setInterval(P,3e5);return()=>clearInterval(I)},[P]);const j=async(I,M)=>{var k,A,L;if(I){p(I);try{const R=await A9({baseUrl:e,id:I,snopId:M});if(R.status===uc.OK){const D=((L=(A=(k=R.data)==null?void 0:k.responseData)==null?void 0:A.response)==null?void 0:L[0])||{};u(D||{}),l(!0)}else throw new Error}catch{t({type:Ve.ERROR,error:Po.SWR})}finally{p(null)}}},N=async(I,M)=>{if(I.length){t({type:Ve.LOADING,loading:!0});try{if((await n1(e,I,M)).status===uc.OK){const A=S.map(R=>I.includes(R.id)?{...R,isRead:!0}:R),L=A.filter(R=>!R.isRead).length;t({type:Ve.SUCCESS,data:Yl(A)}),t({type:Ve.MARK_ALL_AS_READ,isMarkAllAsRead:{count:L,boo:L>0}}),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},200)}}catch{t({type:Ve.ERROR,error:Po.SWR}),t({type:Ve.LOADING,loading:!1})}}},F=async()=>{t({type:Ve.LOADING,loading:!0});try{const I=hF(S);if((await n1(e,I,F2.MARK_ALL_READ)).status===uc.OK){const k=S.map(A=>({...A,isRead:!0}));t({type:Ve.SUCCESS,data:Yl(k)}),t({type:Ve.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},200)}}catch{t({type:Ve.ERROR,error:Po.SWR}),t({type:Ve.LOADING,loading:!1})}},B=(I,M)=>{t({type:Ve.LOADING,loading:!0}),w(M),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},400)},$=I=>{const M=I||S||[];return{0:M,1:M.filter(k=>(k==null?void 0:k.type)==="INFO"),2:M.filter(k=>(k==null?void 0:k.type)==="ERROR")}},V=()=>{t({type:Ve.LOADING,loading:!0});const I=!y,M=I?(v||[]).filter(k=>!k.isRead):S||[];h(I),O(M),g(1),setTimeout(()=>{t({type:Ve.LOADING,loading:!1})},400)};return{fetchNotification:P,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>o(!1),onRefresh:P,handleRead:N,handleMarkAllAsRead:F,setOpen:o,handleShowDetails:j,clickId:d,isMainDialog:!0},activeTab:b,loading:T,tabData:$(v)[b],data:v,mode:y,handleTabChange:B,toggleAlertMode:V,page:f,setPage:g}};var r1,s1,i1,a1;function uf(){return uf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},uf.apply(null,arguments)}var j9=function(t){return x.createElement("svg",uf({xmlns:"http://www.w3.org/2000/svg",width:16,height:18,fill:"none"},t),r1||(r1=x.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 3.44c-2.206 0-4 1.793-4 4v1.927c0 .406-.173 1.026-.38 1.373l-.766 1.273c-.474.787-.147 1.66.72 1.954 2.873.96 5.973.96 8.846 0a1.335 1.335 0 0 0 .72-1.954l-.766-1.273c-.2-.347-.374-.967-.374-1.373V7.44c0-2.2-1.8-4-4-4Z"})),s1||(s1=x.createElement("path",{stroke:"#666D80",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 3.633a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),i1||(i1=x.createElement("path",{stroke:"#666D80",strokeMiterlimit:10,d:"M10.014 14.207c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})),a1||(a1=x.createElement("circle",{cx:12.266,cy:3,r:2.5,fill:"#E85353",stroke:"#F8FAFB"})))};const N9=({count:e})=>(kt(),m.jsxs(m.Fragment,{children:[m.jsx(ve,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:m.jsx(j9,{style:{scale:2}})}),m.jsx(C9,{badgeContent:e==0?"":null,color:"error"})]}));function l1({children:e,handleClose:t,open:n,isMainDialog:o}){return m.jsx(Ja,{open:n,onClose:t,...o?{scroll:"paper",PaperProps:{sx:{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:s=>s.palette.primary.notifyBackground}}}:{fullWidth:!0,maxWidth:"md",sx:{"& .MuiPaper-root":{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:s=>s.palette.primary.appBackground}}},children:e})}var c1;function df(){return df=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},df.apply(null,arguments)}var $9=function(t){return x.createElement("svg",df({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),c1||(c1=x.createElement("path",{fill:"#A8A8A8",fillRule:"evenodd",d:"M8.954 1.004a.406.406 0 0 1 0 .575L3.537 6.996a.406.406 0 0 1-.574 0L.796 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0m3.25 0a.406.406 0 0 1 0 .575L6.787 6.996a.406.406 0 1 1-.574-.575l5.416-5.417a.406.406 0 0 1 .575 0",clipRule:"evenodd"})))},u1,d1;function pf(){return pf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},pf.apply(null,arguments)}var L9=function(t){return x.createElement("svg",pf({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),u1||(u1=x.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.79 6c0 .99-.8 1.79-1.79 1.79S4.21 6.99 4.21 6 5.01 4.21 6 4.21s1.79.8 1.79 1.79"})),d1||(d1=x.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.135c1.765 0 3.41-1.04 4.555-2.84.45-.705.45-1.89 0-2.595C9.41 2.9 7.765 1.86 6 1.86S2.59 2.9 1.445 4.7c-.45.705-.45 1.89 0 2.595 1.145 1.8 2.79 2.84 4.555 2.84"})))},p1;function ff(){return ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ff.apply(null,arguments)}var F9=function(t){return x.createElement("svg",ff({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),p1||(p1=x.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.277 1.004a.406.406 0 0 1 0 .575L2.86 6.996a.406.406 0 0 1-.574 0L.119 4.829a.406.406 0 1 1 .575-.575l1.879 1.88 5.13-5.13a.406.406 0 0 1 .574 0",clipRule:"evenodd"})))};const f1=({type:e,item:t,handleShowDetails:n,handleRead:o,handleCTAClicked:s,clickId:i})=>{var c,u;const a=kt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return m.jsxs(ve,{className:"cards",sx:{padding:" 0.8rem 0"},children:[m.jsx(it,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:m.jsx(Pu,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA"}},variant:"dot",className:"badge",invisible:t==null?void 0:t.isRead,children:m.jsx(ir,{sx:{color:a.palette.primary.notifyActiveText},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:t==null?void 0:t.message})})}),m.jsx(it,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:m.jsxs(it,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&m.jsx(cc,{icon:m.jsx(L9,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?m.jsx(Za,{color:"primary",size:13}):"Show Details",component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:a.palette.brandColor.orange,color:a.palette.brandColor.white}}),!(t!=null&&t.isRead)&&m.jsx(cc,{icon:m.jsx(F9,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:o,label:"Acknowledge",component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&m.jsx(cc,{disabled:!(t!=null&&t.isPrimaryCTAClicked),onClick:()=>s({redirect:t==null?void 0:t.isPrimaryCTARedirect,isClicked:t==null?void 0:t.isPrimaryCTAClicked,url:t==null?void 0:t.primaryCTAURL}),label:t==null?void 0:t.primaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.secondaryCTAURL)&&m.jsx(cc,{disabled:!(t!=null&&t.isSecondaryCTAClicked),onClick:()=>s({redirect:t==null?void 0:t.isSecondaryCTARedirect,isClicked:t==null?void 0:t.isSecondaryCTAClicked,url:t==null?void 0:t.secondaryCTAURL}),label:t==null?void 0:t.secondaryCTALabel,component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),m.jsxs(it,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[m.jsx(ir,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),m.jsx(ir,{color:a.palette.primary.notifyTextColor,children:"•"}),m.jsx(ir,{sx:{fontSize:"0.8rem"},children:fF(t==null?void 0:t.createdAt)})]})]})};f1.propTypes={type:r.string,title:r.string,subTitle:r.string,isRead:r.bool,handleShowDetails:r.func,handleRead:r.func};const h1=({data:e,handleRead:t,handleShowDetails:n,clickId:o,mode:s,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=U.useContext(rf),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,p]=U.useState([]),[f,g]=U.useState(!1),[y,h]=U.useState(!0),b=U.useRef(null),w=async S=>{g(!0);const E=e.slice((S-1)*10,S*10);await new Promise(v=>setTimeout(v,1e3)),p(v=>{const O=E.filter(P=>!v.some(j=>j.id===P.id));return[...v,...O]}),g(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&h(!1)};U.useEffect(()=>{var E;let S=[];s?l!=null&&l.count?S=(E=e==null?void 0:e.filter(v=>!v.isRead))==null?void 0:E.slice(0,10):S=[]:S=e.slice(0,10),(S==null?void 0:S.length)<10&&h(!1),p(S)},[e,s,l]),U.useEffect(()=>{y&&i!==1&&w(i)},[i,e]),U.useEffect(()=>{p([...e])},[e]),U.useEffect(()=>{const S=new IntersectionObserver(E=>{E[0].isIntersecting&&!f&&y&&a(v=>v+1)},{threshold:1});return b.current&&S.observe(b.current),()=>{b.current&&S.unobserve(b.current)}},[f,y]);const T=({redirect:S,isClicked:E,url:v})=>{window.open(v,"_blank")};return m.jsxs(ve,{sx:{width:"100%"},children:[Object.entries(mF(d)).map(([S,E])=>m.jsxs(U.Fragment,{children:[S!==u&&m.jsx(x9,{children:S}),E.map((v,O)=>m.jsx(U.Fragment,{children:m.jsx(f1,{item:v,handleCTAClicked:T,handleShowDetails:()=>n(v.id,v.snopId),handleRead:()=>t([v.id],v.snopId),clickId:o})},`${O}_${v.id}`))]},S)),f&&i>1&&!!(d!=null&&d.length)&&m.jsx(ve,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:m.jsx(Za,{size:20,sx:{color:S=>S.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&m.jsx(Qe,{sx:{fontSize:"1.1rem",color:S=>S.palette.primary.notifyTextColor,textAlign:"center",px:"0.8rem"},children:"You don't have any unread notification here. Use the toggle to switch between read and unread notification."}),m.jsx(ve,{ref:b,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};h1.propTypes={data:r.array,handleRead:r.func,handleShowDetails:r.func};const _9=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:o,handleMarkAllAsRead:s})=>{var y,h,b,w;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:p,handleTabChange:f,toggleAlertMode:g}=o1({});return m.jsxs(m.Fragment,{children:[m.jsxs(ve,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[m.jsx(Qe,{variant:"h2",sx:{fontSize:"1.2rem",color:T=>T.palette.primary.notifyTextColor},children:"Notifications"}),m.jsx(ve,{component:"img",src:Xe.Refresh,alt:"refresh",onClick:e,sx:{cursor:"pointer"}})]}),m.jsx(ve,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},children:m.jsxs(w9,{value:a,onChange:f,children:[m.jsx(nf,{label:m.jsxs(ve,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",m.jsx(Qe,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((y=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))==null?void 0:y.length)||0}),")"]})}),m.jsx(nf,{label:m.jsxs(ve,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",m.jsx(Qe,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((h=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="INFO"&&!(T!=null&&T.isRead)))==null?void 0:h.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.blue}}),m.jsx(nf,{label:m.jsxs(ve,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",m.jsx(Qe,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((b=l==null?void 0:l.filter(T=>(T==null?void 0:T.type)==="ERROR"&&!(T!=null&&T.isRead)))==null?void 0:b.length)||0}),")"]}),sx:{color:T=>T.palette.brandColor.red}})]})}),m.jsx(el,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:T=>T.palette.primary.notifyBorderColor},tabIndex:-1,children:i?m.jsx(Za,{size:30,sx:{color:T=>T.palette.primary.notifyIconColor}}):m.jsx(m.Fragment,{children:m.jsx(h1,{data:c,handleShowDetails:t,handleRead:o,clickId:n,page:d,setPage:p,mode:u})})}),m.jsxs(Qa,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[m.jsxs(it,{direction:"row",gap:1,children:[m.jsx(ir,{sx:{fontSize:"1rem"},children:"Only show unread"}),m.jsx(v9,{disabled:i,checked:u,onChange:g})]}),m.jsx(An,{variant:"outlined",className:"view-all",onClick:s,startIcon:m.jsx($9,{}),disabled:!((w=l==null?void 0:l.filter(T=>!(T!=null&&T.isRead)))!=null&&w.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:T=>T.palette.primary.notifyTextColor,"&:hover":{color:T=>T.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:T=>`${T.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},B9=({data:e,handleClose:t})=>{var T;const[n,o]=U.useState(1),[s,i]=U.useState(10),[a,l]=U.useState(((T=e==null?void 0:e.notificationDetails)==null?void 0:T.length)||0),[c,u]=U.useState("sku_name"),[d,p]=U.useState("asc"),[f,g]=U.useState(""),y=["sku_name","node","channel_name"],h=U.useMemo(()=>!(e!=null&&e.notificationDetails)||!y.length?[]:f.trim()?e.notificationDetails.filter(S=>y.some(E=>{var v;return(v=S[E])==null?void 0:v.toString().toLowerCase().includes(f.toLowerCase())})):e.notificationDetails,[e,f,y]),b=U.useMemo(()=>c?[...h].sort((S,E)=>{const v=S[c],O=E[c];return v==null?1:O==null?-1:typeof v=="number"&&typeof O=="number"?d==="asc"?v-O:O-v:!isNaN(Date.parse(v))&&!isNaN(Date.parse(O))?d==="asc"?new Date(v).getTime()-new Date(O).getTime():new Date(O).getTime()-new Date(v).getTime():d==="asc"?v.toString().localeCompare(O.toString()):O.toString().localeCompare(v.toString())}):h,[h,c,d]),w=U.useMemo(()=>{const S=(n-1)*s,E=S+s;return b.slice(S,E)},[b,n,s]);return console.log({paginatedData:w}),m.jsxs(m.Fragment,{children:[m.jsxs(it,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[m.jsx(Qe,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),m.jsx(ve,{component:"img",src:Xe.CloseCircle,onClick:t,sx:{cursor:"pointer"}})]}),m.jsx(el,{children:m.jsx(of,{tableProps:{data:w,columns:{...y9(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:S=>{var v;const E=(v=S==null?void 0:S.column)==null?void 0:v.key;p(O=>c===E&&O==="asc"?"desc":"asc"),u(E)}},pagination:{selectedPage:n,rowPerPage:s,totalRecords:a,onPageChange:S=>{o(S)},onPageSizeChange:S=>{i(S==null?void 0:S.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:S=>{g(S.target.value)},placeholder:"Search..."}}}})}),m.jsx(Qa,{sx:{padding:"1.5rem 2rem"}})]})},V9=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:o}=o1({baseUrl:e});return m.jsxs(m.Fragment,{children:[m.jsx(ve,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var s;o(),(s=t==null?void 0:t.setOpen)==null||s.call(t,!0)},children:m.jsx(N9,{count:0})}),m.jsx(l1,{...t,children:m.jsx(_9,{...t})}),m.jsx(l1,{...n,children:m.jsx(B9,{...n})})]})},z9=({baseUrl:e})=>m.jsx(kn,{children:m.jsx(R9,{children:m.jsx(V9,{baseUrl:e})})}),W9=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:o,drawerTitle:s,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:p})=>{const f=kt();return m.jsx(ve,{sx:{position:"relative",overflow:"hidden"},children:m.jsxs(Wo,{container:!0,sx:{height:"100%"},children:[m.jsx(Wo,{item:!0,sx:{width:n?d!=null&&d.drawerWidth?`calc(${"100%"-(d==null?void 0:d.drawerWidth)})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),o&&!n&&m.jsxs(m.Fragment,{children:[m.jsx(ve,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}}),m.jsx(ve,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"transparent",zIndex:4}})]}),e&&m.jsxs(Wo,{item:!0,sx:{width:u?"90%":(d==null?void 0:d.drawerWidth)||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:f.palette.primary.notifyBackground,transform:o?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[m.jsxs(it,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:g=>`0.1rem solid ${g.palette.primary.notifyBorderColor}`},children:[!u&&p&&m.jsxs(m.Fragment,{children:[m.jsx(ve,{sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l,children:m.jsx(ve,{component:"img",src:Xe.Merge})}),m.jsx(ei,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:f.palette.primary.notifyBorderColor}})]}),m.jsxs(it,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[m.jsxs(it,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[m.jsx(ve,{component:"img",src:f.icons.close}),m.jsx(Qe,{sx:{fontSize:"1.2rem",color:f.palette.primary.notifyTextColor},children:s})]}),m.jsx(it,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&m.jsx(ve,{onClick:c,sx:{cursor:"pointer"},children:m.jsx(ve,{component:"img",src:u?Xe.Collapse:Xe.Expand})})})]})]}),m.jsx(ve,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},m1=({layoutChildren:e,layoutProps:t})=>m.jsx(kn,{children:m.jsx(W9,{...e,...t})});m1.propTypes={layoutChildren:r.object.isRequired,layoutProps:r.object.isRequired},dt.Button=Xo,dt.Checkbox=Il,dt.DatePicker=uF,dt.Grid=of,dt.Header=Q2,dt.InputField=Gx,dt.Loader=$F,dt.Notification=z9,dt.Select=Zx,dt.SliderLayout=m1,dt.Switch=t2,dt.TextField=Ip,dt.ToastProvider=DF,dt.toast=kF,Object.defineProperty(dt,Symbol.toStringTag,{value:"Module"})});
329
329
  //# sourceMappingURL=index.umd.js.map