@3sc/common-component 0.0.404 → 0.0.405

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
@@ -323,5 +323,5 @@ const theme2 = createTheme({ palette: {
323
323
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[j1]=this[j1]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Sa(a);r[l]||(W8(o,a),r[l]=!0)}return ne.isArray(t)?t.forEach(i):i(t),this}};bn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(bn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),ne.freezeMethods(bn);function Mp(e,t){const n=this||Ca,r=t||n,o=bn.from(r.headers);let i=r.data;return ne.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function N1(e){return!!(e&&e.__CANCEL__)}function Ns(e,t,n){He.call(this,e??"canceled",He.ERR_CANCELED,t,n),this.name="CanceledError"}ne.inherits(Ns,He,{__CANCEL__:!0});function F1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new He("Request failed with status code "+n.status,[He.ERR_BAD_REQUEST,He.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function z8(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function U8(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];a||(a=u),n[o]=c,r[o]=u;let f=i,p=0;for(;f!==o;)p+=n[f++],f=f%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-a<t)return;const h=d&&u-d;return h?Math.round(p*1e3/h):void 0}}function H8(e,t){let n=0,r=1e3/t,o,i;const a=(u,d=Date.now())=>{n=d,o=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?a(u,d):(o=u,i||(i=setTimeout(()=>{i=null,a(o)},r-f)))},()=>o&&a(o)]}const Ac=(e,t,n=3)=>{let r=0;const o=U8(50,250);return H8(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,u=o(c),d=a<=l;r=a;const f={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(f)},n)},_1=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},$1=e=>(...t)=>ne.asap(()=>e(...t)),q8=rn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,rn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(rn.origin),rn.navigator&&/(msie|trident)/i.test(rn.navigator.userAgent)):()=>!0,Y8=rn.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const a=[e+"="+encodeURIComponent(t)];ne.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),ne.isString(r)&&a.push("path="+r),ne.isString(o)&&a.push("domain="+o),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 G8(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function K8(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function B1(e,t,n){let r=!G8(t);return e&&(r||n==!1)?K8(e,t):t}const L1=e=>e instanceof bn?{...e}:e;function ko(e,t){t=t||{};const n={};function r(u,d,f,p){return ne.isPlainObject(u)&&ne.isPlainObject(d)?ne.merge.call({caseless:p},u,d):ne.isPlainObject(d)?ne.merge({},d):ne.isArray(d)?d.slice():d}function o(u,d,f,p){if(ne.isUndefined(d)){if(!ne.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!ne.isUndefined(d))return r(void 0,d)}function a(u,d){if(ne.isUndefined(d)){if(!ne.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(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,f)=>o(L1(u),L1(d),f,!0)};return ne.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||o,p=f(e[d],t[d],d);ne.isUndefined(p)&&f!==l||(n[d]=p)}),n}const V1=e=>{const t=ko({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;t.headers=a=bn.from(a),t.url=R1(B1(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(ne.isFormData(n)){if(rn.hasStandardBrowserEnv||rn.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(rn.hasStandardBrowserEnv&&(r&&ne.isFunction(r)&&(r=r(t)),r||r!==!1&&q8(t.url))){const u=o&&i&&Y8.read(i);u&&a.set(o,u)}return t},X8=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=V1(e);let i=o.data;const a=bn.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,h,y;function m(){h&&h(),y&&y(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let v=new XMLHttpRequest;v.open(o.method.toUpperCase(),o.url,!0),v.timeout=o.timeout;function x(){if(!v)return;const T=bn.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),b={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:T,config:e,request:v};F1(function(E){n(E),m()},function(E){r(E),m()},b),v=null}"onloadend"in v?v.onloadend=x:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(x)},v.onabort=function(){v&&(r(new He("Request aborted",He.ECONNABORTED,e,v)),v=null)},v.onerror=function(){r(new He("Network Error",He.ERR_NETWORK,e,v)),v=null},v.ontimeout=function(){let k=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const b=o.transitional||I1;o.timeoutErrorMessage&&(k=o.timeoutErrorMessage),r(new He(k,b.clarifyTimeoutError?He.ETIMEDOUT:He.ECONNABORTED,e,v)),v=null},i===void 0&&a.setContentType(null),"setRequestHeader"in v&&ne.forEach(a.toJSON(),function(k,b){v.setRequestHeader(b,k)}),ne.isUndefined(o.withCredentials)||(v.withCredentials=!!o.withCredentials),l&&l!=="json"&&(v.responseType=o.responseType),u&&([p,y]=Ac(u,!0),v.addEventListener("progress",p)),c&&v.upload&&([f,h]=Ac(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(d=T=>{v&&(r(!T||T.type?new Ns(null,e,v):T),v.abort(),v=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const w=z8(o.url);if(w&&rn.protocols.indexOf(w)===-1){r(new He("Unsupported protocol "+w+":",He.ERR_BAD_REQUEST,e));return}v.send(i||null)})},Z8=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const i=function(u){if(!o){o=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof He?d:new Ns(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new He(`timeout ${t} of ms exceeded`,He.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}=r;return c.unsubscribe=()=>ne.asap(l),c}},J8=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},Q8=async function*(e,t){for await(const n of e7(e))yield*J8(n,t)},e7=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},W1=(e,t,n,r)=>{const o=Q8(e,t);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await o.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),o.return()}},{highWaterMark:2})},jc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",z1=jc&&typeof ReadableStream=="function",t7=jc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),U1=(e,...t)=>{try{return!!e(...t)}catch{return!1}},n7=z1&&U1(()=>{let e=!1;const t=new Request(rn.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),H1=64*1024,Rp=z1&&U1(()=>ne.isReadableStream(new Response("").body)),Nc={stream:Rp&&(e=>e.body)};jc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Nc[t]&&(Nc[t]=ne.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new He(`Response type '${t}' is not supported`,He.ERR_NOT_SUPPORT,r)})})})(new Response);const r7=async e=>{if(e==null)return 0;if(ne.isBlob(e))return e.size;if(ne.isSpecCompliantForm(e))return(await new Request(rn.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ne.isArrayBufferView(e)||ne.isArrayBuffer(e))return e.byteLength;if(ne.isURLSearchParams(e)&&(e=e+""),ne.isString(e))return(await t7(e)).byteLength},o7=async(e,t)=>{const n=ne.toFiniteNumber(e.getContentLength());return n??r7(t)},Dp={http:k8,xhr:X8,fetch:jc&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:p}=V1(e);u=u?(u+"").toLowerCase():"text";let h=Z8([o,i&&i.toAbortSignal()],a),y;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let v;try{if(c&&n7&&n!=="get"&&n!=="head"&&(v=await o7(d,r))!==0){let b=new Request(t,{method:"POST",body:r,duplex:"half"}),O;if(ne.isFormData(r)&&(O=b.headers.get("content-type"))&&d.setContentType(O),b.body){const[E,P]=_1(v,Ac($1(c)));r=W1(b.body,H1,E,P)}}ne.isString(f)||(f=f?"include":"omit");const x="credentials"in Request.prototype;y=new Request(t,{...p,signal:h,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:x?f:void 0});let w=await fetch(y);const T=Rp&&(u==="stream"||u==="response");if(Rp&&(l||T&&m)){const b={};["status","statusText","headers"].forEach(I=>{b[I]=w[I]});const O=ne.toFiniteNumber(w.headers.get("content-length")),[E,P]=l&&_1(O,Ac($1(l),!0))||[];w=new Response(W1(w.body,H1,E,()=>{P&&P(),m&&m()}),b)}u=u||"text";let k=await Nc[ne.findKey(Nc,u)||"text"](w,e);return!T&&m&&m(),await new Promise((b,O)=>{F1(b,O,{data:k,headers:bn.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:y})})}catch(x){throw m&&m(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new He("Network Error",He.ERR_NETWORK,e,y),{cause:x.cause||x}):He.from(x,x&&x.code,e,y)}})};ne.forEach(Dp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const q1=e=>`- ${e}`,s7=e=>ne.isFunction(e)||e===null||e===!1,Y1={getAdapter:e=>{e=ne.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){n=e[i];let a;if(r=n,!s7(n)&&(r=Dp[(a=String(n)).toLowerCase()],r===void 0))throw new He(`Unknown adapter '${a}'`);if(r)break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).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 :
324
324
  `+i.map(q1).join(`
325
325
  `):" "+q1(i[0]):"as no adapter specified";throw new He("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:Dp};function Ip(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ns(null,e)}function G1(e){return Ip(e),e.headers=bn.from(e.headers),e.data=Mp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Y1.getAdapter(e.adapter||Ca.adapter)(e).then(function(r){return Ip(e),r.data=Mp.call(e,e.transformResponse,r),r.headers=bn.from(r.headers),r},function(r){return N1(r)||(Ip(e),r&&r.response&&(r.response.data=Mp.call(e,e.transformResponse,r.response),r.response.headers=bn.from(r.response.headers))),Promise.reject(r)})}const K1="1.8.4",Fc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Fc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const X1={};Fc.transitional=function(t,n,r){function o(i,a){return"[Axios v"+K1+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new He(o(a," has been removed"+(n?" in "+n:"")),He.ERR_DEPRECATED);return n&&!X1[a]&&(X1[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,l):!0}},Fc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function i7(e,t,n){if(typeof e!="object")throw new He("options must be an object",He.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const l=e[i],c=l===void 0||a(l,i,e);if(c!==!0)throw new He("option "+i+" must be "+c,He.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new He("Unknown option "+i,He.ERR_BAD_OPTION)}}const _c={assertOptions:i7,validators:Fc},vr=_c.validators;let Oo=class{constructor(t){this.defaults=t,this.interceptors={request:new D1,response:new D1}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
326
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ko(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&_c.assertOptions(r,{silentJSONParsing:vr.transitional(vr.boolean),forcedJSONParsing:vr.transitional(vr.boolean),clarifyTimeoutError:vr.transitional(vr.boolean)},!1),o!=null&&(ne.isFunction(o)?n.paramsSerializer={serialize:o}:_c.assertOptions(o,{encode:vr.function,serialize:vr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),_c.assertOptions(n,{baseUrl:vr.spelling("baseURL"),withXsrfToken:vr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&ne.merge(i.common,i[n.method]);i&&ne.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=bn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,p;if(!c){const y=[G1.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),p=y.length,d=Promise.resolve(n);f<p;)d=d.then(y[f++],y[f++]);return d}p=l.length;let h=n;for(f=0;f<p;){const y=l[f++],m=l[f++];try{h=y(h)}catch(v){m.call(this,v);break}}try{d=G1.call(this,h)}catch(y){return Promise.reject(y)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=ko(this.defaults,t);const n=B1(t.baseURL,t.url,t.allowAbsoluteUrls);return R1(n,t.params,t.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(t){Oo.prototype[t]=function(n,r){return this.request(ko(r||{},{method:t,url:n,data:(r||{}).data}))}}),ne.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(ko(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Oo.prototype[t]=n(),Oo.prototype[t+"Form"]=n(!0)});let a7=class Iw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Ns(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Iw(function(o){t=o}),cancel:t}}};function l7(e){return function(n){return e.apply(null,n)}}function c7(e){return ne.isObject(e)&&e.isAxiosError===!0}const Ap={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(Ap).forEach(([e,t])=>{Ap[t]=e});function Z1(e){const t=new Oo(e),n=g1(Oo.prototype.request,t);return ne.extend(n,Oo.prototype,t,{allOwnKeys:!0}),ne.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Z1(ko(e,o))},n}const Tt=Z1(Ca);Tt.Axios=Oo,Tt.CanceledError=Ns,Tt.CancelToken=a7,Tt.isCancel=N1,Tt.VERSION=K1,Tt.toFormData=Dc,Tt.AxiosError=He,Tt.Cancel=Tt.CanceledError,Tt.all=function(t){return Promise.all(t)},Tt.spread=l7,Tt.isAxiosError=c7,Tt.mergeConfig=ko,Tt.AxiosHeaders=bn,Tt.formToJSON=e=>A1(ne.isHTMLForm(e)?new FormData(e):e),Tt.getAdapter=Y1.getAdapter,Tt.HttpStatusCode=Ap,Tt.default=Tt;const{Axios:nz,AxiosError:rz,CanceledError:oz,isCancel:sz,CancelToken:iz,VERSION:az,all:lz,Cancel:cz,isAxiosError:uz,spread:dz,toFormData:fz,AxiosHeaders:pz,HttpStatusCode:hz,formToJSON:mz,getAdapter:gz,mergeConfig:yz}=Tt,jp={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Ta={headers:{"Content-Type":"application/json"},withCredentials:!0},J1=Tt.create({baseURL:jp.BASE_URL,axiosConfig:Ta});J1.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),J1.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const Ar={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Q1={TENANT_ID:"tenant_id",BU_ID:"bu_id"},u7=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),d7=[10,25,50,100],f7={MARK_ALL_READ:"MARK_ALL_READ"},p7=d7.map(e=>({label:e,value:e})),ew={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},$c={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};/*! js-cookie v3.0.5 | MIT */function Bc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var h7={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 Np(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Bc({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).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=o+"="+e.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){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),o===d)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",Bc({},i,{expires:-1}))},withAttributes:function(o){return Np(this.converter,Bc({},this.attributes,o))},withConverter:function(o){return Np(Bc({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var m7=Np(h7,{path:"/"});const Fp=Sc(Ar.SNOP),_p=Sc(Ar.SELECTED_BU),$p=Sc(Ar.USER);Sc(Ar.SETTINGS);const tw={BU_IDS:_p==null?void 0:_p.business_unit_id,TOKEN:JSON.parse(m7.get(Ar.TOKEN)||null),TENANT_IDS:$p==null?void 0:$p.tenant_id,SNOP_IDS:Fp==null?void 0:Fp.snop_id},{TENANT_ID:g7,BU_ID:y7}=Q1,{TENANT_IDS:b7,BU_IDS:v7}=tw,Lc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${$c.SETTING}/v1?${g7}=${b7}&${y7}=${v7}`;return await Tt.post(n,t,Ta)}catch(n){return n}},x7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{var w,T,k;let{definitions:l,defaultUserSettings:c,labels:u}=e;const d=jr(u),f=t.split("/").filter(Boolean),p=JSON.parse(localStorage.getItem(Ar.SETTINGS));let h=f.reduce((b,O)=>b==null?void 0:b[O],p)||null;const y=jr((h==null?void 0:h.columns)||[]);if(!r&&t){let b=(c&&Bp({childUniqueKey:i}))??Bp({definitions:l,childUniqueKey:i});b.filter(E=>!y[E.key]);const O=h&&((w=h==null?void 0:h.columns)==null?void 0:w.some(E=>(E==null?void 0:E.children)&&E.children[i]));if((!h||O==!1)&&(a==null?void 0:a.length)>0){if(O==!1){const E=jr(b);b=(T=h==null?void 0:h.columns)==null?void 0:T.map(P=>{var I;return P!=null&&P.children&&!P.children[i]?{...P,children:{...P.children,[i]:(I=E==null?void 0:E[P==null?void 0:P.key])==null?void 0:I.children[i]}}:P})}(async()=>{try{const P={...p||{platform:{theme:"light"}}},I=(h==null?void 0:h.pageSize)??o;let j=P;for(let N=0;N<f.length;N++){const D=f[N];N===f.length-1?j[D]={columns:b,pageSize:I}:(j[D]={...j[D]||{}},j=j[D])}localStorage.setItem(Ar.SETTINGS,JSON.stringify(P)),await Lc({baseUrl:n,payload:P})}catch(E){console.error(E)}})()}}c=((h==null?void 0:h.columns)&&C7(y,c,i))??c??Bp({definitions:l});const m=[],v=jr(c);for(const b of l){const O=v[b.key]||{},E=d[b.key]||{},P=jr(O.children||[]),I=jr(E.children||[]);let j={...b,...O,...E};(k=b.children)!=null&&k.length&&(j.children=b.children.map(N=>({...N,...P[N.key],...I[N.key]}))),m.push(j)}return m.sort((b,O)=>b.sequenceId-O.sequenceId)},w7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),ka=(e,t)=>e==null?void 0:e.map(n=>({id:n.id,key:n.key,sequenceId:n.sequenceId||n.id,isHidden:n.isHidden||!1,style:n.style||{},...(n==null?void 0:n.children)&&{children:t?{[t]:ka(n.children)}:ka(n.children)}})),jr=e=>Array.isArray(e)&&(e==null?void 0:e.reduce((t,n)=>(t[n.key]=n,t),{})),Bp=({definitions:e,childUniqueKey:t})=>ka(e,t),C7=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{var d;const c=jr(Array.isArray(i==null?void 0:i.children)?i==null?void 0:i.children:(d=i==null?void 0:i.children)==null?void 0:d[n]),u=c==null?void 0:c[l.key];return{...l,sequenceId:(u==null?void 0:u.sequenceId)||l.sequenceId,isHidden:(u==null?void 0:u.isHidden)??l.isHidden}}):void 0;return{...o,sequenceId:(i==null?void 0:i.sequenceId)||o.sequenceId,isHidden:(i==null?void 0:i.isHidden)??o.isHidden,...a?{children:a}:{}}}),S7=()=>({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:BV,isLocalizable:!1},{id:2,key:"node",label:$V,isLocalizable:!1},{id:3,key:"channel_name",label:LV,isLocalizable:!1}]});class Lp extends R.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=R.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,r=this.startPos-this.mouseX;let o=this.startWidthPrev-r;(!this.props.minWidth||o>=this.props.minWidth)&&(!this.props.maxWidth||o<=this.props.maxWidth)&&(n.previousSibling.style.width=o+"px",n.previousSibling.style.minWidth=o+"px",n.previousSibling.style.maxWidth=o+"px",n.previousSibling.style.setProperty("--column_resize_before_width",o+"px"),this.lastDraggedWidth=o)}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)"),R.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})}}Lp.defaultProps={disabled:!1,minWidth:0,className:""},Lp.propTypes={disabled:"boolean",minWidth:"number",className:"string"};const Vp=R.memo(function({isRenderCellContent:t,column:n,row:r,parent:o}){const i=r[n.key],a=typeof i=="string"&&i.length>20;return t&&(n!=null&&n.cellRenderer)?g.jsx(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:"1.1rem"},children:n.cellRenderer(r,{column:n,parent:o})}):a?g.jsx(xd,{title:i,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:g.jsx(we,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:g.jsx(rt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:i})})}):g.jsx(we,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:"1.1rem",m:0},id:n.key,component:"p",children:i})},(e,t)=>e.row[e.column.key]===t.row[t.column.key]&&e.isRenderCellContent===t.isRenderCellContent);Vp.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},G(Pl)(({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 Eo=G(rt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),T7=G(_g)(({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)"})}})),k7=G(wi)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),O7=G(od)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:1.8,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"}}));G(Ll)(({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 E7=G(ty)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),Wp=G($g)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem",paddingBottom:"1rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),Vc=G(td)(({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`}})),P7=G($l)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Cd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${Cd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}})),Oa=R.memo(function({children:t,...n}){return g.jsx(P7,{...n,children:t})});Oa.propTypes={children:s.node};const M7=G(Gg)(()=>({"&:last-child td":{borderBottom:"none"}}));function Fs({children:e,...t}){return g.jsx(M7,{...t,children:e})}Fs.propTypes={children:s.node};const R7=R.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>g.jsx(Fs,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r==null?void 0:r(e),children:o},e==null?void 0:e.fhi)),D7=R.memo(({nestedData:e,nestedColumn:t})=>e!=null&&e.length?g.jsx(g.Fragment,{children:e.map((n,r)=>g.jsx(Fs,{children:t.map((o,i)=>g.jsx(Oa,{style:o==null?void 0:o.style,children:g.jsx(Vp,{isRenderCellContent:!!(o!=null&&o.cellRenderer),column:o,row:n})},i))},`nested-${r}`))}):g.jsx(Fs,{children:g.jsx(Oa,{colSpan:t.length,children:g.jsx(Eo,{sx:{textAlign:"center"},children:Jr.NRF})})})),I7=(e,t,n,r,o,i)=>{const[a,l]=R.useState({isOpen:!1,column:null}),c=(p,h,y)=>{l({isOpen:p.currentTarget,column:h,isChild:!!y})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(h=>{var y;if(a!=null&&a.isChild&&Array.isArray(h.children)){const m=h.children.map(x=>{var w;return x.key===((w=a.column)==null?void 0:w.key)?{...x,isHidden:!0}:x}),v=m.every(x=>x.isHidden);return{...h,isHidden:v?!0:h.isHidden,children:m}}return h.key===((y=a.column)==null?void 0:y.key)?{...h,isHidden:!0}:h});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:p}});const h=r.split("/").filter(Boolean),y=JSON.parse(localStorage.getItem(Ar.SETTINGS));let m=h.reduce((O,E)=>O==null?void 0:O[E],y)||null,v=ka(p,i);const x=jr(m==null?void 0:m.columns);v=v==null?void 0:v.map(O=>{var I,j;const E=(O==null?void 0:O.children)||{},P=((I=x==null?void 0:x[O==null?void 0:O.key])==null?void 0:I.children)||{};return{...O,...(((j=Object.keys(P))==null?void 0:j.length)>0||(E==null?void 0:E[i]))&&{children:{...P,[i]:E==null?void 0:E[i]}}}});const T={...y||{platform:{theme:"light"}}},k=(m==null?void 0:m.pageSize)??o;let b=T;for(let O=0;O<h.length;O++){const E=h[O];O===h.length-1?b[E]={columns:v,pageSize:k}:(b[E]={...b[E]||{}},b=b[E])}localStorage.setItem(Ar.SETTINGS,JSON.stringify(T)),await Lc({baseUrl:n,payload:T})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},nw=({pagination:e,gridPath:t,baseUrl:n})=>{const{selectedPage:r,rowPerPage:o,totalRecords:i,onPageChange:a,onPageSizeChange:l}=e,c=jt(),u=async(d,f)=>{if(!f)return;const p=f.split("/").filter(Boolean),h="settings",m={...JSON.parse(localStorage.getItem(h))||{}};let v=m;for(let x=0;x<p.length;x++){const w=p[x];x===p.length-1?v[w]={...v[w]||{},pageSize:d}:(v[w]={...v[w]||{}},v=v[w])}localStorage.setItem(h,JSON.stringify(m)),await Lc({baseUrl:n,payload:m})};return g.jsxs(we,{sx:{display:"flex",p:"1rem 1.5rem"},children:[g.jsxs(we,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[g.jsx(rt,{sx:{fontSize:"1.1rem",color:c.palette.primary.notifyTextColor},children:`Showing ${Math.min(r*o,i)} of ${i} rows`}),g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:g.jsx(Oc,{options:p7,value:o,onChange:async d=>{l(d),u(d==null?void 0:d.value,t)}})})]}),g.jsx(Pg,{count:Math.ceil(i/o),page:r,onChange:async(d,f)=>{a(f)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,color:c.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 ${c.palette.primary.notifyBorderColor}`,color:c.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:c.palette.primary.notifyActiveText,backgroundColor:`${c.palette.brandColor.paginationBc} !important`}}})]})};nw.propTypes={pagination:s.object.isRequired};const rw=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=jt();return g.jsx(Ei,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:g.jsx(we,{sx:{backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:g.jsx(qn,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:"Hide Column"})})})};rw.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const ow=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>g.jsx(Fr,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:g.jsx(gn,{url:i})});return g.jsx(g.Fragment,{children:o(t===e?n==="asc"?Xe.AscSort:Xe.DescSort:Xe.Unsort)})};ow.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function sw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!(t!=null&&t.isMandatory)||(t==null?void 0:t.isMandatory)&&(t==null?void 0:t.showHide)===!0),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 g.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[g.jsx(we,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:g.jsx(xd,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a})}),g.jsxs(we,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&g.jsx(ow,{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})}),i&&g.jsx(Fr,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:g.jsx(gn,{url:Xe.Menu})})]})]})}sw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function iw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1}){var et;const d=jt(),{visibleGridColumns:f}=R.useContext(kc),p=R.useContext(va),{selectedColumn:h,handleMenuClick:y,handleClose:m,handleHideClick:v,columnUpdaterFunction:x}=I7(f,p,a,l,r==null?void 0:r.rowPerPage,c),w=o==null?void 0:o.isManageable,T=o==null?void 0:o.isResizable,k=(n==null?void 0:n.length)>0,b=R.useRef(null),O=R.useRef(null),E=40,P=10,I=n==null?void 0:n.length,[j,N]=R.useState({start:0,end:10}),[D,$]=R.useState({start:0,end:20}),[B,F]=R.useState(null),[_,W]=R.useState(null),[z,M]=R.useState(null);let A=null;R.useRef(0);const V=R.useRef(!1),X=R.useRef(null),[Q,q]=R.useState(!1);R.useRef(null);const ee=w7(((et=i==null?void 0:i.column)==null?void 0:et.definitions)||[]),K=i==null?void 0:i.isNested,oe=(i==null?void 0:i.data)||[],ae=i==null?void 0:i.hashKey,[se,le]=R.useState(0),[Z,U]=R.useState(null);R.useRef(null);const[te,de]=R.useState(!1),[ye,me]=R.useState(!1);R.useEffect(()=>{if(b.current){const L=()=>{le(b.current.offsetHeight)};return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)}},[n]),R.useEffect(()=>{const L=b.current,Y=L==null?void 0:L.querySelector("thead");if(!Y)return;const J=()=>{M(null)};return Y==null||Y.addEventListener("mousedown",J),()=>{Y==null||Y.removeEventListener("mousedown",J)}},[]);const Oe=(L,Y)=>{var Ee,De;if(V.current){L.preventDefault();return}F(Y),M(null),L.dataTransfer.setData("colIndex",Y);const J=f[Y],ue=J==null?void 0:J.label,ve=document.createElement("div");ve.textContent=ue,Object.assign(ve.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(Ee=J==null?void 0:J.style)==null?void 0:Ee.minWidth,maxWidth:(De=J==null?void 0:J.style)==null?void 0:De.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:d.palette.primary.notifyTextColor,background:d.palette.primary.notifyBackground,border:`0.1rem solid ${d.palette.primary.notifyBorderColor}`,borderRadius:"0rem",pointerEvents:"none",position:"absolute",top:"0",left:"0",zIndex:"-1",textAlign:"center",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.2)"}),document.body.appendChild(ve);const{offsetWidth:pe,offsetHeight:Ce}=ve;L.dataTransfer.setDragImage(ve,pe/2,Ce/2),requestAnimationFrame(()=>{document.body.removeChild(ve)})},ce=(L,Y)=>{L.preventDefault(),W(Y),Qe(L)},Se=async(L,Y)=>{if(L.preventDefault(),clearInterval(A),B===null||B===Y)return;const J=[...f],[ue]=J.splice(B,1);J.splice(Y,0,ue);const ve=f.slice().sort((Ce,Ee)=>Ce.sequenceId-Ee.sequenceId).map(Ce=>Ce.sequenceId),pe=J.map((Ce,Ee)=>({...Ce,sequenceId:ve[Ee]??Ce.sequenceId}));x({updatedColumns:pe}),F(null),W(null)},be=()=>{F(null),W(null)},xe=R.useMemo(()=>{let L=0;return f.map(Y=>{var J,ue;if(Y!=null&&Y.isMandatory&&(Y!=null&&Y.isSticky)||Y!=null&&Y.isVisible){const ve=L;return L+=parseFloat((ue=(J=Y==null?void 0:Y.style)==null?void 0:J.minWidth)==null?void 0:ue.replace("rem",""))||7.5,ve}return null})},[f]),$e=R.useCallback((L,Y,J,ue)=>{var Ft,er,cn;if(!L)return null;const ve=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),pe=ve?`${xe[Y]}rem`:void 0,Ce=B===Y,Ee=_===Y||((Ft=f==null?void 0:f[_])==null?void 0:Ft.isMandatory),De=J&&!(L!=null&&L.isMandatory),Ze=ue?`${ue==null?void 0:ue.key}_${L==null?void 0:L.key}_${Y}`:Y,Rt=((cn=(er=L==null?void 0:L.children)==null?void 0:er.filter(Dt=>!(Dt!=null&&Dt.isHidden)))==null?void 0:cn.length)||void 0,ht=Dt=>{if(!De)return Dt.preventDefault();Oe==null||Oe(Dt,Y)},Xt=Dt=>{Dt.preventDefault(),Dt.dataTransfer.dropEffect=L.isMandatory?"none":"move",ce==null||ce(Dt,Y)},Ke=Dt=>{L.isMandatory||Se==null||Se(Dt,Y)},gt={...ve&&{position:"sticky",left:pe,zIndex:3,boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...(L==null?void 0:L.isCenterTable)&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(L==null?void 0:L.key)==="volume_value"&&{borderLeft:"1px solid"}},...Ce&&{border:`0.1rem solid ${d.palette.brandColor.lightBlue}!important`},cursor:Ee?"not-allowed":De?"grab":"default"};return g.jsx(Oa,{rowSpan:L!=null&&L.children?1:2,colSpan:Rt,style:L==null?void 0:L.style,draggable:De,onMouseEnter:()=>z!==Ze&&M(Ze),onDragStart:ht,onDragOver:De?Xt:void 0,onDrop:De?Ke:void 0,onDragEnd:De?be:void 0,sx:gt,children:g.jsx(sw,{parent:ue,column:L,sort:t,handleMenuClick:y,isManageable:J})},Y)},[xe]),Ne=(L,Y,J,ue)=>{if(!L||!J||L!=null&&L.isMandatory)return null;const ve=L!=null&&L.children||L!=null&&L.isMandatory?$l:Lp,pe=d.palette.primary.notifyBorderColor;return g.jsx(we,{resizeStart:()=>{L!=null&&L.isResizable&&(V.current=!0)},resizeEnd:()=>{L!=null&&L.isResizable&&(V.current=!1)},component:ve,rowSpan:L!=null&&L.children?1:2,colSpan:1,id:Y,disabled:!J,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${pe}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:pe,zIndex:1},"&:hover::after":!(L!=null&&L.isMandatory)&&{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${se}px`,backgroundColor:pe,zIndex:1}}})},Re=R.useCallback((L,Y,J,ue)=>{var Ce,Ee;if(!L)return null;const ve=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),pe=ve?`${xe[J]}rem`:void 0;return g.jsxs(Oa,{colSpan:1,style:L==null?void 0:L.style,className:`${L==null?void 0:L.label}`,sx:{position:"relative",...L.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(L==null?void 0:L.key)==="volume_value"&&{borderLeft:"1px solid"}},...(L==null?void 0:L.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...ve&&{position:"sticky",left:pe,zIndex:2,backgroundColor:e!=null&&e.selectedRow&&((Ce=e==null?void 0:e.selectedRow)==null?void 0:Ce.fhi)===(Y==null?void 0:Y.fhi)||Y!=null&&Y.isHigh?d.palette.primary.appBackground:d.palette.primary.notifyBackground}},children:[((e==null?void 0:e.selectedRow)&&((Ee=e==null?void 0:e.selectedRow)==null?void 0:Ee.fhi)===(Y==null?void 0:Y.fhi)||(Y==null?void 0:Y.isHigh))&&g.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),Q?g.jsx(Yn,{variant:"text",height:"1rem"}):g.jsx(Vp,{isRenderCellContent:!!(L!=null&&L.cellRenderer),column:L,row:Y,parent:ue})]},J)},[e==null?void 0:e.selectedRow,xe]),Ue=R.useCallback((L,Y,J,ue,ve,pe,Ce)=>{var Ee;return g.jsx(g.Fragment,{children:Y&&ue&&!(Y!=null&&Y.isMandatory)?g.jsx($l,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${d.palette.primary.notifyBorderColor}`},children:((e==null?void 0:e.selectedRow)&&((Ee=e==null?void 0:e.selectedRow)==null?void 0:Ee.fhi)===(L==null?void 0:L.fhi)||(L==null?void 0:L.isHigh))&&g.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${J}_${Ce}`):null})},[e==null?void 0:e.selectedRow]),Qe=L=>{const Y=b.current,{left:J,right:ue}=Y.getBoundingClientRect(),ve=50,pe=L.clientX>ue-ve?1:L.clientX<J+ve?-1:0;pe!==0?(X.current&&clearInterval(X.current),X.current=setInterval(()=>{Y.scrollLeft+=pe*10},50)):X.current&&(clearInterval(X.current),X.current=null)},pt=R.memo(({row:L,actualIndex:Y})=>{var Ee;const J=L[ae],ue=oe==null?void 0:oe[J],ve=(e==null?void 0:e.selectedRow)&&((Ee=e==null?void 0:e.selectedRow)==null?void 0:Ee.fhi)===(L==null?void 0:L.fhi),pe=L==null?void 0:L.isHigh,Ce=()=>f.flatMap((De,Ze)=>De!=null&&De.isHidden||(De==null?void 0:De.isVisible)===!1?[]:De.children?De.children.flatMap((Rt,ht)=>Rt!=null&&Rt.isHidden?[]:[g.jsxs(R.Fragment,{children:[Re(Rt,L,ht,De),T&&Ue(L,Rt,ht,w,De,"",Y)]},`col-${Ze}-${ht}`)]):[g.jsxs(R.Fragment,{children:[Re(De,L,Ze),T&&Ue(L,De,Ze,w,"","",Y)]},`col-${Ze}`)]);return g.jsxs(R.Fragment,{children:[g.jsx(R7,{row:L,isSelected:ve,isHigh:pe,onRowClick:e==null?void 0:e.onRowClick,children:Ce()}),K&&ue&&g.jsx(D7,{nestedData:ue,nestedColumn:ee})]},`row-${Y}`)}),Be=L=>L==null?void 0:L.map((Y,J)=>{const ue=j.start+J;return g.jsx(pt,{row:Y,actualIndex:ue},ue)}),he=()=>{const L=O.current;if(!L)return;const Y=L.scrollTop,J=L.clientHeight,ue=Math.floor(Y/E)-P,ve=Math.ceil(J/E)+2*P,pe=Math.max(0,Math.min(I-1,ue)),Ce=Math.max(pe,Math.min(I,pe+ve));N(Ee=>Ee.start===pe&&Ee.end===Ce?Ee:{start:pe,end:Ce})};R.useEffect(()=>{let L;const Y=()=>{L&&cancelAnimationFrame(L),L=requestAnimationFrame(()=>{he()})},J=O.current;if(!(!J||!u))return he(),J.addEventListener("scroll",Y),()=>{cancelAnimationFrame(L),J.removeEventListener("scroll",Y)}},[I]);const Pe=j.start*E,Le=(I-j.end)*E,ze=u?n.slice(j.start,j.end):n;return k?g.jsxs(g.Fragment,{children:[g.jsx(zg,{ref:O,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${d.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:g.jsxs(Lg,{ref:b,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:d.palette.primary.notifyBackground},children:[g.jsxs(Hg,{children:[g.jsx(Fs,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:d.palette.primary.notifyBackground},children:f.map((L,Y)=>L!=null&&L.isHidden||(L==null?void 0:L.isVisible)===!1?null:g.jsxs(R.Fragment,{children:[$e(L,Y,w),Ne(L,Y,w)]},Y))}),g.jsx(Fs,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:d.palette.primary.notifyBackground,zIndex:2},children:f.flatMap((L,Y)=>L!=null&&L.isHidden||!(L!=null&&L.children)||(L==null?void 0:L.isVisible)===!1?[]:L.children.map((J,ue)=>J!=null&&J.isHidden?null:g.jsxs(R.Fragment,{children:[$e(J,ue,w,L),T&&Ne(J,ue,w)]},`${Y}-${ue}`)))})]}),g.jsxs(Wg,{children:[u&&g.jsx("tr",{style:{height:Pe}}),Be(ze),ze.length===0&&g.jsx("tr",{children:g.jsx("td",{colSpan:f.length,children:g.jsx(Yn,{height:E})})}),u&&g.jsx("tr",{style:{height:Le}})]})]})}),r&&g.jsx(nw,{pagination:r,gridPath:l,baseUrl:a}),g.jsx(rw,{menuOpen:h==null?void 0:h.isOpen,handleClose:m,onHideClick:v})]}):g.jsx(Eo,{sx:{textAlign:"center"},children:Jr.NRF})}iw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function aw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o}){var c;const{columns:i}=e,a=R.useContext(va),l=x7({columns:i,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:(c=e==null?void 0:e.pagination)==null?void 0:c.rowPerPage,data:e==null?void 0:e.data});return R.useEffect(()=>{l!=null&&l.length&&(a==null||a({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:l}}))},[l]),g.jsx(iw,{...e,gridPath:n,baseUrl:r,childUniqueKey:o})}aw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const lw=({type:e})=>{const t=jt(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:g.jsxs(we,{sx:{borderRadius:2,overflow:"hidden"},children:[g.jsx(Yn,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>g.jsx(we,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>g.jsx(we,{sx:{flex:1},children:g.jsx(Yn,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:g.jsx(g.Fragment,{children:g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(Yn,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(Yn,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},A7=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>{var a;return g.jsx(Pr,{...i,styles:{...i.styles,iconPrimary:((a=i==null?void 0:i.styles)==null?void 0:a.variant)=="filled"}})},select:i=>{var a;return g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:g.jsx(d1,{...i,options:t})})}};return o[r]?o[r](n):null},j7=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u==null?void 0:u[d],e)||null,a=ka(t==null?void 0:t.grid,r);const l=jr(i==null?void 0:i.columns);a=a==null?void 0:a.map(u=>{var p,h;const d=(u==null?void 0:u.children)||{},f=((p=l==null?void 0:l[u==null?void 0:u.key])==null?void 0:p.children)||{};return{...u,...(((h=Object.keys(f))==null?void 0:h.length)>0||(d==null?void 0:d[r]))&&{children:{...f,[r]:d==null?void 0:d[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:(t==null?void 0:t.pageSize)??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},N7=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=j7({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Lc({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},F7=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ew.PRIMARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId),n=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ew.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},cw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=F7({customTools:e}),[i,a]=R.useState(r),l=(o==null?void 0:o.length)>0,c=d=>{d?a([...r,...o]):setTimeout(()=>{a(r)},100)},u=()=>{const d=!t;n(d),c(d)};return R.useEffect(()=>{c(t)},[e]),g.jsxs(g.Fragment,{children:[t&&g.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),g.jsxs(we,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[g.jsx(nI,{mode:"popLayout",children:i.map((d,f)=>g.jsx(Ji.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:g.jsx(we,{sx:{flexShrink:0,minWidth:"fit-content"},children:A7(d)})},`${d.id}_${f}`))}),l&&g.jsx(we,{sx:{paddingLeft:t?"0.5rem":0},children:g.jsx(Pr,{label:t?"":"More Actions",styles:{iconPrimary:!0,icon:t?Xe.CrossWhite:Xe.More,colorType:t?"danger":""},onClick:u})})]})]})};cw.propTypes={customTools:s.array.isRequired};const uw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{var w,T,k,b,O,E;const c=R.useContext(va),{visibleGridColumns:u,triggerApi:d}=R.useContext(kc),[f,p]=R.useState([]),[h,y]=R.useState(!1);R.useEffect(()=>{if(u.length){const P={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let I=u.map(N=>(N!=null&&N.children&&N.children.forEach(D=>{P.children.some(B=>B.key===D.key)||P.children.push({...D,showInHierarchy:!0})}),N)).filter(N=>(N==null?void 0:N.id)!==(P==null?void 0:P.id));const j=P.children.length>0?[...I,P]:I;p(j)}},[u]);const m=async P=>{try{await N7({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:P,pageSize:i}})}catch(I){console.error(I)}finally{c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),c({type:qe.TRIGGER_API,payload:{triggerApi:!1}})}};R.useEffect(()=>{d&&m(u)},[d]);const v=P=>{var D;const I=P==null?void 0:P.map($=>$.id),j=(D=P==null?void 0:P.flatMap($=>$.children||[]))==null?void 0:D.map($=>$.id),N=f==null?void 0:f.map($=>{var _,W,z;const B=I==null?void 0:I.includes($.id);if(Array.isArray($.children)&&$.children.length>0){const M=(_=$==null?void 0:$.children)==null?void 0:_.map(V=>{var Q;const X=(Q=j==null?void 0:j.includes)==null?void 0:Q.call(j,V.id);return{...V,isHidden:!X}}),A=(W=M==null?void 0:M.filter(V=>f==null?void 0:f.some(X=>{var Q;return(Q=X.children)==null?void 0:Q.some(q=>q.id===V.id)})))==null?void 0:W.every(V=>V.isHidden);return{...$,...!((z=$.children[0])!=null&&z.showInHierarchy)&&{isHidden:A||!B},children:M}}return{...$,isHidden:!B}});c({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:N}}),c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},x=()=>f.map(I=>{const j=Array.isArray(I.children)?I.children.filter(N=>!N.isHidden):void 0;return!I.isHidden||I.isHidden&&I.showInHierarchy?{...I,children:j}:null}).filter(Boolean);return g.jsxs(we,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[g.jsxs(we,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((w=e==null?void 0:e.search)==null?void 0:w.isRequired)&&g.jsx(l1,{...e==null?void 0:e.search,iconUrl:Xe.Search}),((T=e==null?void 0:e.refresh)==null?void 0:T.isRequired)&&g.jsx(Pr,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Xe.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),((k=e==null?void 0:e.groupBy)==null?void 0:k.isRequired)&&g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Oc,{styles:{icon:Xe.Group},...e.groupBy})}),t&&g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Oc,{placeholder:"Manage Columns",options:f,value:x(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:v,disabled:!a.length,styles:{icon:Xe.Manage}})})]}),g.jsxs(we,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&g.jsx(cw,{customTools:n,setIsExpanded:y,isExpanded:h}),((b=e==null?void 0:e.save)==null?void 0:b.isRequired)&&g.jsx(we,{sx:{px:"0.5rem"},children:g.jsx(Pr,{label:h?"":"Save",styles:{icon:Xe.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&g.jsx(Pr,{...e==null?void 0:e.upload,styles:{variant:h?"outlined":"filled",icon:h?Xe.UploadDark:Xe.Upload,iconPrimary:!h,colorType:"secondary",isAnimate:!0}}),((E=e==null?void 0:e.download)==null?void 0:E.isRequired)&&g.jsx(Pr,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Xe.Download,isAnimate:!0}})]})]})};uw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function zp({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){var i,a;const o=(i=e.columns)==null?void 0:i.isManageable;return g.jsx(u1,{children:r?g.jsxs(g.Fragment,{children:[g.jsx(lw,{type:"toolbar"}),g.jsx(lw,{type:"grid"})]}):g.jsxs(we,{sx:{position:"sticky"},children:[t&&g.jsx(uw,{...t,isManageable:o,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage,gridData:e==null?void 0:e.data}),g.jsx(aw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||"",childUniqueKey:(t==null?void 0:t.childUniqueKey)||""})]})})}zp.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const dw=({list:e,handleLinkClick:t})=>{const n=jt(),r=({list:o})=>{var i;return(i=o==null?void 0:o.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?g.jsx(Wr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(o==null?void 0:o.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):g.jsx(rt,{component:"h3",sx:{fontSize:"1rem",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return g.jsx(U0,{separator:g.jsx(gn,{url:Xe.ArrowRight}),children:r({list:e})})};dw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const fw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{var i,a,l,c,u,d,f;const o=jt();return g.jsxs(g.Fragment,{children:[g.jsxs(dt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(dw,{...e}),g.jsxs(dt,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&g.jsx(m1,{...t}),(n==null?void 0:n.filterBtnProps)&&g.jsxs(dt,{direction:"row",children:[g.jsx(wi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),g.jsxs(dt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.onFilterClick,sx:{cursor:"pointer"},children:[g.jsx(gn,{url:Xe.Filter}),g.jsx(rt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(a=n==null?void 0:n.filterBtnProps)==null?void 0:a.label})]})]})]})]}),g.jsx(Ji.div,{layout:!0,initial:{height:"0rem"},animate:{height:(l=n==null?void 0:n.filterBtnProps)!=null&&l.filterContainerVisible?"5rem":"0rem",opacity:(c=n==null?void 0:n.filterBtnProps)!=null&&c.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",width:(u=n==null?void 0:n.filterContainerProps)!=null&&u.isSideDrawerOpen?"75%":"100%"},children:g.jsxs(dt,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[g.jsx(rt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),g.jsx(we,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:g.jsx(dt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(d=n==null?void 0:n.filterItems)==null?void 0:d.map((p,h)=>g.jsx(g.Fragment,{children:g.jsxs(we,{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:[g.jsx(we,{component:"img",src:Xe.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(p)}),g.jsx(rt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:p==null?void 0:p.filterLabel})]},h)}))})}),g.jsx(we,{component:rt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(f=n==null?void 0:n.filterContainerProps)==null?void 0:f.onClearClick,children:"Clear"})]})})]})};fw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function pw({headerProps:e}){return g.jsx(Ln,{children:g.jsx(fw,{...e})})}pw.propTypes={headerProps:s.object.isRequired};const Up=R.createContext(null),hw=R.createContext(null);function _7({children:e}){const[t,n]=R.useReducer($7,B7);return g.jsx(Up.Provider,{value:t,children:g.jsx(hw.Provider,{value:n,children:e})})}function $7(e,t){var n;switch(t.type){case qe.LOADING:return{...e,loading:t.loading};case qe.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case qe.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case qe.ERROR:return{...e,error:t.error};default:throw new Error(`${Jr.UNHANDLED}: ${t}`)}}const B7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:Hp,BU_ID:qp}=Q1,{TENANT_IDS:Yp,BU_IDS:Gp}=tw,L7=async e=>{try{const t=`${e}${$c.NOTIFICATION}/v1?${Hp}=${Yp}&${qp}=${Gp}`;return await Tt.get(t,Ta)}catch(t){return t}},mw=async(e,t,n)=>{try{const r=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}`;return await Tt.put(r,t,Ta)}catch(r){return r}},V7=async({baseUrl:e,id:t,snopId:n})=>{try{const r=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}&id=${t}`;return await Tt.get(r,Ta)}catch(r){return r}},_s={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},gw=({baseUrl:e})=>{const t=R.useContext(hw),[n,r]=R.useState(!1),[o,i]=R.useState(!1),[a,l]=R.useState(!1),[c,u]=R.useState({}),[d,f]=R.useState(null),[p,h]=R.useState(1),[y,m]=R.useState(!1),[v,x]=R.useState(0),w=R.useRef(!1),{loading:T,data:k,isMarkAllAsRead:b}=R.useContext(Up),[O,E]=R.useState([]);R.useEffect(()=>{E(k)},[k]);const P=R.useCallback(async()=>{var F,_,W;if(!w.current)try{t({type:qe.LOADING,loading:!0}),t({type:qe.SUCCESS,data:[]});const z=await L7(e);if(z.status===_s.UNAUTHORIZED){w.current=!0;return}if(z.status===_s.OK){const M=((_=(F=z.data)==null?void 0:F.responseData)==null?void 0:_.response)||[],A=Tc(M);t({type:qe.SUCCESS,data:Tc(A)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:c1(M),boo:c1(M)>0}})}}catch(z){((W=z==null?void 0:z.response)==null?void 0:W.status)===_s.UNAUTHORIZED&&(w.current=!0),t({type:qe.ERROR,error:Jr.SWR})}finally{t({type:qe.LOADING,loading:!1})}},[e,t]);R.useEffect(()=>{P();const F=setInterval(P,3e5);return()=>clearInterval(F)},[P]);const I=async(F,_)=>{var W,z,M;if(F){f(F);try{const A=await V7({baseUrl:e,id:F,snopId:_});if(A.status===_s.OK){const V=((M=(z=(W=A.data)==null?void 0:W.responseData)==null?void 0:z.response)==null?void 0:M[0])||{};u(V||{}),l(!0)}else throw new Error}catch{t({type:qe.ERROR,error:Jr.SWR})}finally{f(null)}}},j=async(F,_)=>{if(F.length){t({type:qe.LOADING,loading:!0});try{if((await mw(e,F,_)).status===_s.OK){const z=k.map(A=>F.includes(A.id)?{...A,isRead:!0}:A),M=z.filter(A=>!A.isRead).length;t({type:qe.SUCCESS,data:Tc(z)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:M,boo:M>0}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}}},N=async()=>{t({type:qe.LOADING,loading:!0});try{const F=hV(k);if((await mw(e,F,f7.MARK_ALL_READ)).status===_s.OK){const W=k.map(z=>({...z,isRead:!0}));t({type:qe.SUCCESS,data:Tc(W)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}},D=(F,_)=>{t({type:qe.LOADING,loading:!0}),x(_),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)},$=F=>{const _=F||k||[];return{0:_,1:_.filter(W=>(W==null?void 0:W.type)==="INFO"),2:_.filter(W=>(W==null?void 0:W.type)==="ERROR")}},B=()=>{t({type:qe.LOADING,loading:!0});const F=!y,_=F?(O||[]).filter(W=>!W.isRead):k||[];m(F),E(_),h(1),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)};return{fetchNotification:P,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:P,handleRead:j,handleMarkAllAsRead:N,setOpen:r,handleShowDetails:I,clickId:d,isMainDialog:!0},activeTab:v,loading:T,tabData:$(O)[v],data:O,mode:y,handleTabChange:D,toggleAlertMode:B,page:p,setPage:h,isMarkAllAsRead:b}};var yw,bw,vw;function Kp(){return Kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kp.apply(null,arguments)}var W7=function(t){return C.createElement("svg",Kp({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),yw||(yw=C.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 2.19c-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.373V6.19c0-2.2-1.8-4-4-4Z"})),bw||(bw=C.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 2.383a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),vw||(vw=C.createElement("path",{stroke:"#909090",strokeMiterlimit:10,d:"M10.013 12.957c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})))};const z7=({count:e})=>(jt(),g.jsxs(g.Fragment,{children:[g.jsx(we,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:g.jsx(W7,{style:{scale:2}})}),g.jsx(O7,{badgeContent:e!=0?"":null,color:"error"})]}));function xw({children:e,handleClose:t,open:n,isMainDialog:r}){return g.jsx(Pl,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var ww;function Xp(){return Xp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xp.apply(null,arguments)}var U7=function(t){return C.createElement("svg",Xp({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),ww||(ww=C.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"})))},Cw,Sw;function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zp.apply(null,arguments)}var H7=function(t){return C.createElement("svg",Zp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),Cw||(Cw=C.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"})),Sw||(Sw=C.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"})))},Tw;function Jp(){return Jp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jp.apply(null,arguments)}var q7=function(t){return C.createElement("svg",Jp({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Tw||(Tw=C.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 kw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i})=>{var c,u;const a=jt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return g.jsxs(we,{className:"cards",sx:{pt:" 0.8rem"},children:[g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:g.jsx(od,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t==null?void 0:t.isRead,children:g.jsx(Eo,{sx:{color:a.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:t==null?void 0:t.message})})}),g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:g.jsxs(dt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&g.jsx(Vc,{icon:g.jsx(H7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?g.jsx(El,{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)&&g.jsx(Vc,{icon:g.jsx(q7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:"Acknowledge",component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&g.jsx(Vc,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>o({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)&&g.jsx(Vc,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>o({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"})]})}),g.jsxs(dt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[g.jsx(Eo,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),g.jsx(Eo,{color:a.palette.primary.notifyTextColor,children:"•"}),g.jsx(Eo,{sx:{fontSize:"0.8rem"},children:pV(t==null?void 0:t.createdAt)})]})]})};kw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Ow=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=R.useContext(Up),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,f]=R.useState([]),[p,h]=R.useState(!1),[y,m]=R.useState(!0),v=R.useRef(null),x=async T=>{h(!0);const k=e.slice((T-1)*10,T*10);await new Promise(b=>setTimeout(b,1e3)),f(b=>{const O=k.filter(E=>!b.some(P=>P.id===E.id));return[...b,...O]}),h(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&m(!1)};R.useEffect(()=>{var k;let T=[];o?l!=null&&l.count?T=(k=e==null?void 0:e.filter(b=>!b.isRead))==null?void 0:k.slice(0,10):T=[]:T=e.slice(0,10),(T==null?void 0:T.length)<10&&m(!1),f(T)},[e,o,l]),R.useEffect(()=>{y&&i!==1&&x(i)},[i,e]),R.useEffect(()=>{f([...e])},[e]),R.useEffect(()=>{const T=new IntersectionObserver(k=>{k[0].isIntersecting&&!p&&y&&a(b=>b+1)},{threshold:1});return v.current&&T.observe(v.current),()=>{v.current&&T.unobserve(v.current)}},[p,y]);const w=({redirect:T,isClicked:k,url:b})=>{window.open(b,"_blank")};return g.jsxs(we,{sx:{width:"100%"},children:[Object.entries(yV(d)).map(([T,k])=>g.jsxs(R.Fragment,{children:[T!==u&&g.jsx(k7,{children:T}),k.map((b,O)=>g.jsx(R.Fragment,{children:g.jsx(kw,{item:b,handleCTAClicked:w,handleShowDetails:()=>n(b.id,b.snopId),handleRead:()=>t([b.id],b.snopId),clickId:r})},`${O}_${b.id}`))]},T)),p&&i>1&&!!(d!=null&&d.length)&&g.jsx(we,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:g.jsx(El,{size:20,sx:{color:T=>T.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&g.jsx(rt,{sx:{fontSize:"1.1rem",color:T=>T.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."}),g.jsx(we,{ref:v,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Ow.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const Y7=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o})=>{var y,m,v,x;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:f,handleTabChange:p,toggleAlertMode:h}=gw({});return g.jsxs(g.Fragment,{children:[g.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[g.jsx(rt,{variant:"h2",sx:{fontSize:"1.2rem",color:w=>w.palette.primary.notifyTextColor},children:"Notifications"}),g.jsx(we,{onClick:e,children:g.jsx(gn,{url:Xe.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),g.jsx(we,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},children:g.jsxs(E7,{value:a,onChange:p,children:[g.jsx(Wp,{label:g.jsxs(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",g.jsx(rt,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((y=l==null?void 0:l.filter(w=>!(w!=null&&w.isRead)))==null?void 0:y.length)||0}),")"]})}),g.jsx(Wp,{label:g.jsxs(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",g.jsx(rt,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((m=l==null?void 0:l.filter(w=>(w==null?void 0:w.type)==="INFO"&&!(w!=null&&w.isRead)))==null?void 0:m.length)||0}),")"]}),sx:{color:w=>w.palette.brandColor.blue}}),g.jsx(Wp,{label:g.jsxs(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",g.jsx(rt,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((v=l==null?void 0:l.filter(w=>(w==null?void 0:w.type)==="ERROR"&&!(w!=null&&w.isRead)))==null?void 0:v.length)||0}),")"]}),sx:{color:w=>w.palette.brandColor.red}})]})}),g.jsx(Rl,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},tabIndex:-1,children:i?g.jsx(El,{size:30,sx:{color:w=>w.palette.primary.notifyIconColor}}):g.jsx(g.Fragment,{children:g.jsx(Ow,{data:c,handleShowDetails:t,handleRead:r,clickId:n,page:d,setPage:f,mode:u})})}),g.jsxs(Ml,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[g.jsxs(dt,{direction:"row",gap:1,children:[g.jsx(Eo,{sx:{fontSize:"1rem"},children:"Only show unread"}),g.jsx(T7,{disabled:i,checked:u,onChange:h})]}),g.jsx(qn,{variant:"outlined",className:"view-all",onClick:o,startIcon:g.jsx(U7,{}),disabled:!((x=l==null?void 0:l.filter(w=>!(w!=null&&w.isRead)))!=null&&x.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:w=>w.palette.primary.notifyTextColor,"&:hover":{color:w=>w.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:w=>`${w.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},G7=({data:e,handleClose:t})=>{var v;const[n,r]=R.useState(1),[o,i]=R.useState(10),[a,l]=R.useState(((v=e==null?void 0:e.notificationDetails)==null?void 0:v.length)||0),[c,u]=R.useState("sku_name"),[d,f]=R.useState("asc"),[p,h]=R.useState([]),[y,m]=R.useState("");return R.useEffect(()=>{var x;if(y||c){const w=mV(e==null?void 0:e.notificationDetails,u7,y);if(c){const T=gV(w,c,d);h(gp(T,n,o)),l(T.length);return}h(gp(w,n,o)),l(w.length);return}h(gp(e==null?void 0:e.notificationDetails,n,o)),l((x=e==null?void 0:e.notificationDetails)==null?void 0:x.length)},[y,e==null?void 0:e.notificationDetails,n,o,d,c]),g.jsxs(g.Fragment,{children:[g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:x=>x.palette.primary.notifyBorderColor},children:[g.jsx(rt,{component:"h2",sx:{fontSize:"1.4rem",color:x=>x.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),g.jsx(we,{onClick:t,sx:{cursor:"pointer"},children:g.jsx(gn,{url:Xe.CloseCircle})})]}),g.jsx(Rl,{children:g.jsx(zp,{tableProps:{data:p,columns:{...S7(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:x=>{var T;const w=(T=x==null?void 0:x.column)==null?void 0:T.key;f(k=>c===w&&k==="asc"?"desc":"asc"),u(w)}},pagination:{selectedPage:n,rowPerPage:o,totalRecords:a,onPageChange:x=>{r(x)},onPageSizeChange:x=>{i(x==null?void 0:x.value),r(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:x=>{const w=x.target.value;w&&r(1),m(w)},placeholder:"Search..."}}}})}),g.jsx(Ml,{sx:{padding:"1.5rem 2rem"}})]})},K7=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:r,isMarkAllAsRead:o}=gw({baseUrl:e});return g.jsxs(g.Fragment,{children:[g.jsx(we,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var i;r(),(i=t==null?void 0:t.setOpen)==null||i.call(t,!0)},children:g.jsx(z7,{count:o.count})}),g.jsx(xw,{...t,children:g.jsx(Y7,{...t})}),g.jsx(xw,{...n,children:g.jsx(G7,{...n})})]})},X7=({baseUrl:e})=>g.jsx(Ln,{children:g.jsx(_7,{children:g.jsx(K7,{baseUrl:e})})}),Z7=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=jt();return g.jsx(we,{sx:{position:"relative",overflow:"hidden"},children:g.jsxs(uo,{container:!0,sx:{height:"100%"},children:[g.jsx(uo,{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}),r&&!n&&g.jsx(g.Fragment,{children:g.jsx(we,{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"}})}),e&&g.jsxs(uo,{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:p.palette.primary.notifyBackground,transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${p.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[g.jsxs(dt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:h=>`0.1rem solid ${h.palette.primary.notifyBorderColor}`},children:[!u&&f&&g.jsxs(g.Fragment,{children:[g.jsx(we,{component:"img",src:Xe.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),g.jsx(wi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),g.jsxs(dt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[g.jsxs(dt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[g.jsx(gn,{url:Xe.CrossLight}),g.jsx(rt,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),g.jsx(dt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&g.jsx(we,{onClick:c,sx:{cursor:"pointer"},children:g.jsx(we,{component:"img",src:u?Xe.Collapse:Xe.Expand})})})]})]}),g.jsx(we,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Ew=({layoutChildren:e,layoutProps:t})=>g.jsx(Ln,{children:g.jsx(Z7,{...e,...t})});Ew.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},wt.Button=Pr,wt.Checkbox=ac,wt.DatePicker=dV,wt.Grid=zp,wt.Header=pw,wt.InputField=l1,wt.Loader=_V,wt.Notification=X7,wt.Select=d1,wt.SliderLayout=Ew,wt.Switch=m1,wt.TextField=Cc,wt.ToastProvider=IV,wt.toast=PV,Object.defineProperty(wt,Symbol.toStringTag,{value:"Module"})});
326
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ko(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&_c.assertOptions(r,{silentJSONParsing:vr.transitional(vr.boolean),forcedJSONParsing:vr.transitional(vr.boolean),clarifyTimeoutError:vr.transitional(vr.boolean)},!1),o!=null&&(ne.isFunction(o)?n.paramsSerializer={serialize:o}:_c.assertOptions(o,{encode:vr.function,serialize:vr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),_c.assertOptions(n,{baseUrl:vr.spelling("baseURL"),withXsrfToken:vr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&ne.merge(i.common,i[n.method]);i&&ne.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=bn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,p;if(!c){const y=[G1.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),p=y.length,d=Promise.resolve(n);f<p;)d=d.then(y[f++],y[f++]);return d}p=l.length;let h=n;for(f=0;f<p;){const y=l[f++],m=l[f++];try{h=y(h)}catch(v){m.call(this,v);break}}try{d=G1.call(this,h)}catch(y){return Promise.reject(y)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=ko(this.defaults,t);const n=B1(t.baseURL,t.url,t.allowAbsoluteUrls);return R1(n,t.params,t.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(t){Oo.prototype[t]=function(n,r){return this.request(ko(r||{},{method:t,url:n,data:(r||{}).data}))}}),ne.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(ko(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Oo.prototype[t]=n(),Oo.prototype[t+"Form"]=n(!0)});let a7=class Iw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Ns(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Iw(function(o){t=o}),cancel:t}}};function l7(e){return function(n){return e.apply(null,n)}}function c7(e){return ne.isObject(e)&&e.isAxiosError===!0}const Ap={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(Ap).forEach(([e,t])=>{Ap[t]=e});function Z1(e){const t=new Oo(e),n=g1(Oo.prototype.request,t);return ne.extend(n,Oo.prototype,t,{allOwnKeys:!0}),ne.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Z1(ko(e,o))},n}const Tt=Z1(Ca);Tt.Axios=Oo,Tt.CanceledError=Ns,Tt.CancelToken=a7,Tt.isCancel=N1,Tt.VERSION=K1,Tt.toFormData=Dc,Tt.AxiosError=He,Tt.Cancel=Tt.CanceledError,Tt.all=function(t){return Promise.all(t)},Tt.spread=l7,Tt.isAxiosError=c7,Tt.mergeConfig=ko,Tt.AxiosHeaders=bn,Tt.formToJSON=e=>A1(ne.isHTMLForm(e)?new FormData(e):e),Tt.getAdapter=Y1.getAdapter,Tt.HttpStatusCode=Ap,Tt.default=Tt;const{Axios:nz,AxiosError:rz,CanceledError:oz,isCancel:sz,CancelToken:iz,VERSION:az,all:lz,Cancel:cz,isAxiosError:uz,spread:dz,toFormData:fz,AxiosHeaders:pz,HttpStatusCode:hz,formToJSON:mz,getAdapter:gz,mergeConfig:yz}=Tt,jp={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},Ta={headers:{"Content-Type":"application/json"},withCredentials:!0},J1=Tt.create({baseURL:jp.BASE_URL,axiosConfig:Ta});J1.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),J1.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const Ar={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Q1={TENANT_ID:"tenant_id",BU_ID:"bu_id"},u7=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),d7=[10,25,50,100],f7={MARK_ALL_READ:"MARK_ALL_READ"},p7=d7.map(e=>({label:e,value:e})),ew={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},$c={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};/*! js-cookie v3.0.5 | MIT */function Bc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var h7={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 Np(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Bc({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).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=o+"="+e.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){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),o===d)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",Bc({},i,{expires:-1}))},withAttributes:function(o){return Np(this.converter,Bc({},this.attributes,o))},withConverter:function(o){return Np(Bc({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var m7=Np(h7,{path:"/"});const Fp=Sc(Ar.SNOP),_p=Sc(Ar.SELECTED_BU),$p=Sc(Ar.USER);Sc(Ar.SETTINGS);const tw={BU_IDS:_p==null?void 0:_p.business_unit_id,TOKEN:JSON.parse(m7.get(Ar.TOKEN)||null),TENANT_IDS:$p==null?void 0:$p.tenant_id,SNOP_IDS:Fp==null?void 0:Fp.snop_id},{TENANT_ID:g7,BU_ID:y7}=Q1,{TENANT_IDS:b7,BU_IDS:v7}=tw,Lc=async({baseUrl:e,payload:t})=>{try{const n=`${e}${$c.SETTING}/v1?${g7}=${b7}&${y7}=${v7}`;return await Tt.post(n,t,Ta)}catch(n){return n}},x7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{var w,T,k;let{definitions:l,defaultUserSettings:c,labels:u}=e;const d=jr(u),f=t.split("/").filter(Boolean),p=JSON.parse(localStorage.getItem(Ar.SETTINGS));let h=f.reduce((b,O)=>b==null?void 0:b[O],p)||null;const y=jr((h==null?void 0:h.columns)||[]);if(!r&&t){let b=(c&&Bp({childUniqueKey:i}))??Bp({definitions:l,childUniqueKey:i});b.filter(E=>!y[E.key]);const O=h&&((w=h==null?void 0:h.columns)==null?void 0:w.some(E=>(E==null?void 0:E.children)&&E.children[i]));if((!h||O==!1)&&(a==null?void 0:a.length)>0){if(O==!1){const E=jr(b);b=(T=h==null?void 0:h.columns)==null?void 0:T.map(P=>{var I;return P!=null&&P.children&&!P.children[i]?{...P,children:{...P.children,[i]:(I=E==null?void 0:E[P==null?void 0:P.key])==null?void 0:I.children[i]}}:P})}(async()=>{try{const P={...p||{platform:{theme:"light"}}},I=(h==null?void 0:h.pageSize)??o;let j=P;for(let N=0;N<f.length;N++){const D=f[N];N===f.length-1?j[D]={columns:b,pageSize:I}:(j[D]={...j[D]||{}},j=j[D])}localStorage.setItem(Ar.SETTINGS,JSON.stringify(P)),await Lc({baseUrl:n,payload:P})}catch(E){console.error(E)}})()}}c=((h==null?void 0:h.columns)&&C7(y,c,i))??c??Bp({definitions:l});const m=[],v=jr(c);for(const b of l){const O=v[b.key]||{},E=d[b.key]||{},P=jr(O.children||[]),I=jr(E.children||[]);let j={...b,...O,...E};(k=b.children)!=null&&k.length&&(j.children=b.children.map(N=>({...N,...P[N.key],...I[N.key]}))),m.push(j)}return m.sort((b,O)=>b.sequenceId-O.sequenceId)},w7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),ka=(e,t)=>e==null?void 0:e.map(n=>({id:n.id,key:n.key,sequenceId:n.sequenceId||n.id,isHidden:n.isHidden||!1,style:n.style||{},...(n==null?void 0:n.children)&&{children:t?{[t]:ka(n.children)}:ka(n.children)}})),jr=e=>Array.isArray(e)&&(e==null?void 0:e.reduce((t,n)=>(t[n.key]=n,t),{})),Bp=({definitions:e,childUniqueKey:t})=>ka(e,t),C7=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{var d;const c=jr(Array.isArray(i==null?void 0:i.children)?i==null?void 0:i.children:(d=i==null?void 0:i.children)==null?void 0:d[n]),u=c==null?void 0:c[l.key];return{...l,sequenceId:(u==null?void 0:u.sequenceId)||l.sequenceId,isHidden:(u==null?void 0:u.isHidden)??l.isHidden}}):void 0;return{...o,sequenceId:(i==null?void 0:i.sequenceId)||o.sequenceId,isHidden:(i==null?void 0:i.isHidden)??o.isHidden,...a?{children:a}:{}}}),S7=()=>({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:BV,isLocalizable:!1},{id:2,key:"node",label:$V,isLocalizable:!1},{id:3,key:"channel_name",label:LV,isLocalizable:!1}]});class Lp extends R.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=R.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,r=this.startPos-this.mouseX;let o=this.startWidthPrev-r;(!this.props.minWidth||o>=this.props.minWidth)&&(!this.props.maxWidth||o<=this.props.maxWidth)&&(n.previousSibling.style.width=o+"px",n.previousSibling.style.minWidth=o+"px",n.previousSibling.style.maxWidth=o+"px",n.previousSibling.style.setProperty("--column_resize_before_width",o+"px"),this.lastDraggedWidth=o)}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)"),R.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})}}Lp.defaultProps={disabled:!1,minWidth:0,className:""},Lp.propTypes={disabled:"boolean",minWidth:"number",className:"string"};const Vp=R.memo(function({isRenderCellContent:t,column:n,row:r,parent:o}){const i=r[n.key],a=typeof i=="string"&&i.length>20;return t&&(n!=null&&n.cellRenderer)?g.jsx(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:"1.1rem"},children:n.cellRenderer(r,{column:n,parent:o})}):a?g.jsx(xd,{title:i,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:g.jsx(we,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:g.jsx(rt,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:i})})}):g.jsx(we,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:"1.1rem",m:0},id:n.key,component:"p",children:i})},(e,t)=>e.row[e.column.key]===t.row[t.column.key]&&e.isRenderCellContent===t.isRenderCellContent);Vp.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},G(Pl)(({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 Eo=G(rt)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),T7=G(_g)(({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)"})}})),k7=G(wi)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),O7=G(od)(({theme:e})=>({"& .MuiBadge-badge":{right:3.5,top:1.8,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"}}));G(Ll)(({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 E7=G(ty)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),Wp=G($g)(({theme:e})=>({color:e.palette.primary.notifyActiveText,textTransform:"none",fontWeight:"normal",padding:0,fontSize:"1rem",minHeight:"2rem",paddingBottom:"1rem","&.Mui-selected":{fontWeight:"bold",color:e.palette.primary.notifyActiveText}})),Vc=G(td)(({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`}})),P7=G($l)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${Cd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${Cd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}})),Oa=R.memo(function({children:t,...n}){return g.jsx(P7,{...n,children:t})});Oa.propTypes={children:s.node};const M7=G(Gg)(()=>({"&:last-child td":{borderBottom:"none"}}));function Fs({children:e,...t}){return g.jsx(M7,{...t,children:e})}Fs.propTypes={children:s.node};const R7=R.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>g.jsx(Fs,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r==null?void 0:r(e),children:o},e==null?void 0:e.fhi)),D7=R.memo(({nestedData:e,nestedColumn:t})=>e!=null&&e.length?g.jsx(g.Fragment,{children:e.map((n,r)=>g.jsx(Fs,{children:t.map((o,i)=>g.jsx(Oa,{style:o==null?void 0:o.style,children:g.jsx(Vp,{isRenderCellContent:!!(o!=null&&o.cellRenderer),column:o,row:n})},i))},`nested-${r}`))}):g.jsx(Fs,{children:g.jsx(Oa,{colSpan:t.length,children:g.jsx(Eo,{sx:{textAlign:"center"},children:Jr.NRF})})})),I7=(e,t,n,r,o,i)=>{const[a,l]=R.useState({isOpen:!1,column:null}),c=(p,h,y)=>{l({isOpen:p.currentTarget,column:h,isChild:!!y})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(h=>{var y;if(a!=null&&a.isChild&&Array.isArray(h.children)){const m=h.children.map(x=>{var w;return x.key===((w=a.column)==null?void 0:w.key)?{...x,isHidden:!0}:x}),v=m.every(x=>x.isHidden);return{...h,isHidden:v?!0:h.isHidden,children:m}}return h.key===((y=a.column)==null?void 0:y.key)?{...h,isHidden:!0}:h});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:p}});const h=r.split("/").filter(Boolean),y=JSON.parse(localStorage.getItem(Ar.SETTINGS));let m=h.reduce((O,E)=>O==null?void 0:O[E],y)||null,v=ka(p,i);const x=jr(m==null?void 0:m.columns);v=v==null?void 0:v.map(O=>{var I,j;const E=(O==null?void 0:O.children)||{},P=((I=x==null?void 0:x[O==null?void 0:O.key])==null?void 0:I.children)||{};return{...O,...(((j=Object.keys(P))==null?void 0:j.length)>0||(E==null?void 0:E[i]))&&{children:{...P,[i]:E==null?void 0:E[i]}}}});const T={...y||{platform:{theme:"light"}}},k=(m==null?void 0:m.pageSize)??o;let b=T;for(let O=0;O<h.length;O++){const E=h[O];O===h.length-1?b[E]={columns:v,pageSize:k}:(b[E]={...b[E]||{}},b=b[E])}localStorage.setItem(Ar.SETTINGS,JSON.stringify(T)),await Lc({baseUrl:n,payload:T})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},nw=({pagination:e,gridPath:t,baseUrl:n})=>{const{selectedPage:r,rowPerPage:o,totalRecords:i,onPageChange:a,onPageSizeChange:l}=e,c=jt(),u=async(d,f)=>{if(!f)return;const p=f.split("/").filter(Boolean),h="settings",m={...JSON.parse(localStorage.getItem(h))||{}};let v=m;for(let x=0;x<p.length;x++){const w=p[x];x===p.length-1?v[w]={...v[w]||{},pageSize:d}:(v[w]={...v[w]||{}},v=v[w])}localStorage.setItem(h,JSON.stringify(m)),await Lc({baseUrl:n,payload:m})};return g.jsxs(we,{sx:{display:"flex",p:"1rem 1.5rem"},children:[g.jsxs(we,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[g.jsx(rt,{sx:{fontSize:"1.1rem",color:c.palette.primary.notifyTextColor},children:`Showing ${Math.min(r*o,i)} of ${i} rows`}),g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:g.jsx(Oc,{options:p7,value:o,onChange:async d=>{l(d),u(d==null?void 0:d.value,t)}})})]}),g.jsx(Pg,{count:Math.ceil(i/o),page:r,onChange:async(d,f)=>{a(f)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,color:c.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 ${c.palette.primary.notifyBorderColor}`,color:c.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:c.palette.primary.notifyActiveText,backgroundColor:`${c.palette.brandColor.paginationBc} !important`}}})]})};nw.propTypes={pagination:s.object.isRequired};const rw=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=jt();return g.jsx(Ei,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:g.jsx(we,{sx:{backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:g.jsx(qn,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:"Hide Column"})})})};rw.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const ow=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>g.jsx(Fr,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:g.jsx(gn,{url:i})});return g.jsx(g.Fragment,{children:o(t===e?n==="asc"?Xe.AscSort:Xe.DescSort:Xe.Unsort)})};ow.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function sw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!(t!=null&&t.isMandatory)||(t==null?void 0:t.isMandatory)&&(t==null?void 0:t.showHide)===!0),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 g.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[g.jsx(we,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:g.jsx(xd,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a})}),g.jsxs(we,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&g.jsx(ow,{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})}),i&&g.jsx(Fr,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:g.jsx(gn,{url:Xe.Menu})})]})]})}sw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function iw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1}){var et;const d=jt(),{visibleGridColumns:f}=R.useContext(kc),p=R.useContext(va),{selectedColumn:h,handleMenuClick:y,handleClose:m,handleHideClick:v,columnUpdaterFunction:x}=I7(f,p,a,l,r==null?void 0:r.rowPerPage,c),w=o==null?void 0:o.isManageable,T=o==null?void 0:o.isResizable,k=(n==null?void 0:n.length)>0,b=R.useRef(null),O=R.useRef(null),E=40,P=10,I=n==null?void 0:n.length,[j,N]=R.useState({start:0,end:10}),[D,$]=R.useState({start:0,end:20}),[B,F]=R.useState(null),[_,W]=R.useState(null),[z,M]=R.useState(null);let A=null;R.useRef(0);const V=R.useRef(!1),X=R.useRef(null),[Q,q]=R.useState(!1);R.useRef(null);const ee=w7(((et=i==null?void 0:i.column)==null?void 0:et.definitions)||[]),K=i==null?void 0:i.isNested,oe=(i==null?void 0:i.data)||[],ae=i==null?void 0:i.hashKey,[se,le]=R.useState(0),[Z,U]=R.useState(null);R.useRef(null);const[te,de]=R.useState(!1),[ye,me]=R.useState(!1);R.useEffect(()=>{if(b.current){const L=()=>{le(b.current.offsetHeight)};return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)}},[n]),R.useEffect(()=>{const L=b.current,Y=L==null?void 0:L.querySelector("thead");if(!Y)return;const J=()=>{M(null)};return Y==null||Y.addEventListener("mousedown",J),()=>{Y==null||Y.removeEventListener("mousedown",J)}},[]);const Oe=(L,Y)=>{var Ee,De;if(V.current){L.preventDefault();return}F(Y),M(null),L.dataTransfer.setData("colIndex",Y);const J=f[Y],ue=J==null?void 0:J.label,ve=document.createElement("div");ve.textContent=ue,Object.assign(ve.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(Ee=J==null?void 0:J.style)==null?void 0:Ee.minWidth,maxWidth:(De=J==null?void 0:J.style)==null?void 0:De.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:d.palette.primary.notifyTextColor,background:d.palette.primary.notifyBackground,border:`0.1rem solid ${d.palette.primary.notifyBorderColor}`,borderRadius:"0rem",pointerEvents:"none",position:"absolute",top:"0",left:"0",zIndex:"-1",textAlign:"center",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.2)"}),document.body.appendChild(ve);const{offsetWidth:pe,offsetHeight:Ce}=ve;L.dataTransfer.setDragImage(ve,pe/2,Ce/2),requestAnimationFrame(()=>{document.body.removeChild(ve)})},ce=(L,Y)=>{L.preventDefault(),W(Y),Qe(L)},Se=async(L,Y)=>{if(L.preventDefault(),clearInterval(A),B===null||B===Y)return;const J=[...f],[ue]=J.splice(B,1);J.splice(Y,0,ue);const ve=f.slice().sort((Ce,Ee)=>Ce.sequenceId-Ee.sequenceId).map(Ce=>Ce.sequenceId),pe=J.map((Ce,Ee)=>({...Ce,sequenceId:ve[Ee]??Ce.sequenceId}));x({updatedColumns:pe}),F(null),W(null)},be=()=>{F(null),W(null)},xe=R.useMemo(()=>{let L=0;return f.map(Y=>{var J,ue;if(Y!=null&&Y.isMandatory&&(Y!=null&&Y.isSticky)&&(Y!=null&&Y.isVisible)){const ve=L;return L+=parseFloat((ue=(J=Y==null?void 0:Y.style)==null?void 0:J.minWidth)==null?void 0:ue.replace("rem",""))||7.5,ve}return null})},[f]),$e=R.useCallback((L,Y,J,ue)=>{var Ft,er,cn;if(!L)return null;const ve=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),pe=ve?`${xe[Y]}rem`:void 0,Ce=B===Y,Ee=_===Y||((Ft=f==null?void 0:f[_])==null?void 0:Ft.isMandatory),De=J&&!(L!=null&&L.isMandatory),Ze=ue?`${ue==null?void 0:ue.key}_${L==null?void 0:L.key}_${Y}`:Y,Rt=((cn=(er=L==null?void 0:L.children)==null?void 0:er.filter(Dt=>!(Dt!=null&&Dt.isHidden)))==null?void 0:cn.length)||void 0,ht=Dt=>{if(!De)return Dt.preventDefault();Oe==null||Oe(Dt,Y)},Xt=Dt=>{Dt.preventDefault(),Dt.dataTransfer.dropEffect=L.isMandatory?"none":"move",ce==null||ce(Dt,Y)},Ke=Dt=>{L.isMandatory||Se==null||Se(Dt,Y)},gt={...ve&&{position:"sticky",left:pe,zIndex:3,boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...(L==null?void 0:L.isCenterTable)&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(L==null?void 0:L.key)==="volume_value"&&{borderLeft:"1px solid"}},...Ce&&{border:`0.1rem solid ${d.palette.brandColor.lightBlue}!important`},cursor:Ee?"not-allowed":De?"grab":"default"};return g.jsx(Oa,{rowSpan:L!=null&&L.children?1:2,colSpan:Rt,style:L==null?void 0:L.style,draggable:De,onMouseEnter:()=>z!==Ze&&M(Ze),onDragStart:ht,onDragOver:De?Xt:void 0,onDrop:De?Ke:void 0,onDragEnd:De?be:void 0,sx:gt,children:g.jsx(sw,{parent:ue,column:L,sort:t,handleMenuClick:y,isManageable:J})},Y)},[xe]),Ne=(L,Y,J,ue)=>{if(!L||!J||L!=null&&L.isMandatory)return null;const ve=L!=null&&L.children||L!=null&&L.isMandatory?$l:Lp,pe=d.palette.primary.notifyBorderColor;return g.jsx(we,{resizeStart:()=>{L!=null&&L.isResizable&&(V.current=!0)},resizeEnd:()=>{L!=null&&L.isResizable&&(V.current=!1)},component:ve,rowSpan:L!=null&&L.children?1:2,colSpan:1,id:Y,disabled:!J,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${pe}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:pe,zIndex:1},"&:hover::after":!(L!=null&&L.isMandatory)&&{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${se}px`,backgroundColor:pe,zIndex:1}}})},Re=R.useCallback((L,Y,J,ue)=>{var Ce,Ee;if(!L)return null;const ve=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),pe=ve?`${xe[J]}rem`:void 0;return g.jsxs(Oa,{colSpan:1,style:L==null?void 0:L.style,className:`${L==null?void 0:L.label}`,sx:{position:"relative",...L.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...(L==null?void 0:L.key)==="volume_value"&&{borderLeft:"1px solid"}},...(L==null?void 0:L.isSticky)&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...ve&&{position:"sticky",left:pe,zIndex:2,backgroundColor:e!=null&&e.selectedRow&&((Ce=e==null?void 0:e.selectedRow)==null?void 0:Ce.fhi)===(Y==null?void 0:Y.fhi)||Y!=null&&Y.isHigh?d.palette.primary.appBackground:d.palette.primary.notifyBackground}},children:[((e==null?void 0:e.selectedRow)&&((Ee=e==null?void 0:e.selectedRow)==null?void 0:Ee.fhi)===(Y==null?void 0:Y.fhi)||(Y==null?void 0:Y.isHigh))&&g.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),Q?g.jsx(Yn,{variant:"text",height:"1rem"}):g.jsx(Vp,{isRenderCellContent:!!(L!=null&&L.cellRenderer),column:L,row:Y,parent:ue})]},J)},[e==null?void 0:e.selectedRow,xe]),Ue=R.useCallback((L,Y,J,ue,ve,pe,Ce)=>{var Ee;return g.jsx(g.Fragment,{children:Y&&ue&&!(Y!=null&&Y.isMandatory)?g.jsx($l,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${d.palette.primary.notifyBorderColor}`},children:((e==null?void 0:e.selectedRow)&&((Ee=e==null?void 0:e.selectedRow)==null?void 0:Ee.fhi)===(L==null?void 0:L.fhi)||(L==null?void 0:L.isHigh))&&g.jsx(we,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${J}_${Ce}`):null})},[e==null?void 0:e.selectedRow]),Qe=L=>{const Y=b.current,{left:J,right:ue}=Y.getBoundingClientRect(),ve=50,pe=L.clientX>ue-ve?1:L.clientX<J+ve?-1:0;pe!==0?(X.current&&clearInterval(X.current),X.current=setInterval(()=>{Y.scrollLeft+=pe*10},50)):X.current&&(clearInterval(X.current),X.current=null)},pt=R.memo(({row:L,actualIndex:Y})=>{var Ee;const J=L[ae],ue=oe==null?void 0:oe[J],ve=(e==null?void 0:e.selectedRow)&&((Ee=e==null?void 0:e.selectedRow)==null?void 0:Ee.fhi)===(L==null?void 0:L.fhi),pe=L==null?void 0:L.isHigh,Ce=()=>f.flatMap((De,Ze)=>De!=null&&De.isHidden||(De==null?void 0:De.isVisible)===!1?[]:De.children?De.children.flatMap((Rt,ht)=>Rt!=null&&Rt.isHidden?[]:[g.jsxs(R.Fragment,{children:[Re(Rt,L,ht,De),T&&Ue(L,Rt,ht,w,De,"",Y)]},`col-${Ze}-${ht}`)]):[g.jsxs(R.Fragment,{children:[Re(De,L,Ze),T&&Ue(L,De,Ze,w,"","",Y)]},`col-${Ze}`)]);return g.jsxs(R.Fragment,{children:[g.jsx(R7,{row:L,isSelected:ve,isHigh:pe,onRowClick:e==null?void 0:e.onRowClick,children:Ce()}),K&&ue&&g.jsx(D7,{nestedData:ue,nestedColumn:ee})]},`row-${Y}`)}),Be=L=>L==null?void 0:L.map((Y,J)=>{const ue=j.start+J;return g.jsx(pt,{row:Y,actualIndex:ue},ue)}),he=()=>{const L=O.current;if(!L)return;const Y=L.scrollTop,J=L.clientHeight,ue=Math.floor(Y/E)-P,ve=Math.ceil(J/E)+2*P,pe=Math.max(0,Math.min(I-1,ue)),Ce=Math.max(pe,Math.min(I,pe+ve));N(Ee=>Ee.start===pe&&Ee.end===Ce?Ee:{start:pe,end:Ce})};R.useEffect(()=>{let L;const Y=()=>{L&&cancelAnimationFrame(L),L=requestAnimationFrame(()=>{he()})},J=O.current;if(!(!J||!u))return he(),J.addEventListener("scroll",Y),()=>{cancelAnimationFrame(L),J.removeEventListener("scroll",Y)}},[I]);const Pe=j.start*E,Le=(I-j.end)*E,ze=u?n.slice(j.start,j.end):n;return k?g.jsxs(g.Fragment,{children:[g.jsx(zg,{ref:O,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${d.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:g.jsxs(Lg,{ref:b,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:d.palette.primary.notifyBackground},children:[g.jsxs(Hg,{children:[g.jsx(Fs,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:d.palette.primary.notifyBackground},children:f.map((L,Y)=>L!=null&&L.isHidden||(L==null?void 0:L.isVisible)===!1?null:g.jsxs(R.Fragment,{children:[$e(L,Y,w),Ne(L,Y,w)]},Y))}),g.jsx(Fs,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:d.palette.primary.notifyBackground,zIndex:2},children:f.flatMap((L,Y)=>L!=null&&L.isHidden||!(L!=null&&L.children)||(L==null?void 0:L.isVisible)===!1?[]:L.children.map((J,ue)=>J!=null&&J.isHidden?null:g.jsxs(R.Fragment,{children:[$e(J,ue,w,L),T&&Ne(J,ue,w)]},`${Y}-${ue}`)))})]}),g.jsxs(Wg,{children:[u&&g.jsx("tr",{style:{height:Pe}}),Be(ze),ze.length===0&&g.jsx("tr",{children:g.jsx("td",{colSpan:f.length,children:g.jsx(Yn,{height:E})})}),u&&g.jsx("tr",{style:{height:Le}})]})]})}),r&&g.jsx(nw,{pagination:r,gridPath:l,baseUrl:a}),g.jsx(rw,{menuOpen:h==null?void 0:h.isOpen,handleClose:m,onHideClick:v})]}):g.jsx(Eo,{sx:{textAlign:"center"},children:Jr.NRF})}iw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function aw({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o}){var c;const{columns:i}=e,a=R.useContext(va),l=x7({columns:i,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:(c=e==null?void 0:e.pagination)==null?void 0:c.rowPerPage,data:e==null?void 0:e.data});return R.useEffect(()=>{l!=null&&l.length&&(a==null||a({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:l}}))},[l]),g.jsx(iw,{...e,gridPath:n,baseUrl:r,childUniqueKey:o})}aw.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const lw=({type:e})=>{const t=jt(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:g.jsxs(we,{sx:{borderRadius:2,overflow:"hidden"},children:[g.jsx(Yn,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>g.jsx(we,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>g.jsx(we,{sx:{flex:1},children:g.jsx(Yn,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:g.jsx(g.Fragment,{children:g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(Yn,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),g.jsxs(dt,{direction:"row",gap:"1rem",children:[g.jsx(Yn,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),g.jsx(Yn,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},A7=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>{var a;return g.jsx(Pr,{...i,styles:{...i.styles,iconPrimary:((a=i==null?void 0:i.styles)==null?void 0:a.variant)=="filled"}})},select:i=>{var a;return g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:g.jsx(d1,{...i,options:t})})}};return o[r]?o[r](n):null},j7=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u==null?void 0:u[d],e)||null,a=ka(t==null?void 0:t.grid,r);const l=jr(i==null?void 0:i.columns);a=a==null?void 0:a.map(u=>{var p,h;const d=(u==null?void 0:u.children)||{},f=((p=l==null?void 0:l[u==null?void 0:u.key])==null?void 0:p.children)||{};return{...u,...(((h=Object.keys(f))==null?void 0:h.length)>0||(d==null?void 0:d[r]))&&{children:{...f,[r]:d==null?void 0:d[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:(t==null?void 0:t.pageSize)??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},N7=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=j7({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Lc({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},F7=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ew.PRIMARY))==null?void 0:r.sort((i,a)=>i.sequenceId-a.sequenceId),n=(o=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===ew.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},cw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=F7({customTools:e}),[i,a]=R.useState(r),l=(o==null?void 0:o.length)>0,c=d=>{d?a([...r,...o]):setTimeout(()=>{a(r)},100)},u=()=>{const d=!t;n(d),c(d)};return R.useEffect(()=>{c(t)},[e]),g.jsxs(g.Fragment,{children:[t&&g.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),g.jsxs(we,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[g.jsx(nI,{mode:"popLayout",children:i.map((d,f)=>g.jsx(Ji.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:g.jsx(we,{sx:{flexShrink:0,minWidth:"fit-content"},children:A7(d)})},`${d.id}_${f}`))}),l&&g.jsx(we,{sx:{paddingLeft:t?"0.5rem":0},children:g.jsx(Pr,{label:t?"":"More Actions",styles:{iconPrimary:!0,icon:t?Xe.CrossWhite:Xe.More,colorType:t?"danger":""},onClick:u})})]})]})};cw.propTypes={customTools:s.array.isRequired};const uw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{var w,T,k,b,O,E;const c=R.useContext(va),{visibleGridColumns:u,triggerApi:d}=R.useContext(kc),[f,p]=R.useState([]),[h,y]=R.useState(!1);R.useEffect(()=>{if(u.length){const P={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let I=u.map(N=>(N!=null&&N.children&&N.children.forEach(D=>{P.children.some(B=>B.key===D.key)||P.children.push({...D,showInHierarchy:!0})}),N)).filter(N=>(N==null?void 0:N.id)!==(P==null?void 0:P.id));const j=P.children.length>0?[...I,P]:I;p(j)}},[u]);const m=async P=>{try{await N7({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:P,pageSize:i}})}catch(I){console.error(I)}finally{c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),c({type:qe.TRIGGER_API,payload:{triggerApi:!1}})}};R.useEffect(()=>{d&&m(u)},[d]);const v=P=>{var D;const I=P==null?void 0:P.map($=>$.id),j=(D=P==null?void 0:P.flatMap($=>$.children||[]))==null?void 0:D.map($=>$.id),N=f==null?void 0:f.map($=>{var _,W,z;const B=I==null?void 0:I.includes($.id);if(Array.isArray($.children)&&$.children.length>0){const M=(_=$==null?void 0:$.children)==null?void 0:_.map(V=>{var Q;const X=(Q=j==null?void 0:j.includes)==null?void 0:Q.call(j,V.id);return{...V,isHidden:!X}}),A=(W=M==null?void 0:M.filter(V=>f==null?void 0:f.some(X=>{var Q;return(Q=X.children)==null?void 0:Q.some(q=>q.id===V.id)})))==null?void 0:W.every(V=>V.isHidden);return{...$,...!((z=$.children[0])!=null&&z.showInHierarchy)&&{isHidden:A||!B},children:M}}return{...$,isHidden:!B}});c({type:qe.SET_GRID_DATA,payload:{visibleGridColumns:N}}),c({type:qe.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},x=()=>f.map(I=>{const j=Array.isArray(I.children)?I.children.filter(N=>!N.isHidden):void 0;return!I.isHidden||I.isHidden&&I.showInHierarchy?{...I,children:j}:null}).filter(Boolean);return g.jsxs(we,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[g.jsxs(we,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((w=e==null?void 0:e.search)==null?void 0:w.isRequired)&&g.jsx(l1,{...e==null?void 0:e.search,iconUrl:Xe.Search}),((T=e==null?void 0:e.refresh)==null?void 0:T.isRequired)&&g.jsx(Pr,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:Xe.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),((k=e==null?void 0:e.groupBy)==null?void 0:k.isRequired)&&g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Oc,{styles:{icon:Xe.Group},...e.groupBy})}),t&&g.jsx(we,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:g.jsx(Oc,{placeholder:"Manage Columns",options:f,value:x(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:v,disabled:!a.length,styles:{icon:Xe.Manage}})})]}),g.jsxs(we,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&g.jsx(cw,{customTools:n,setIsExpanded:y,isExpanded:h}),((b=e==null?void 0:e.save)==null?void 0:b.isRequired)&&g.jsx(we,{sx:{px:"0.5rem"},children:g.jsx(Pr,{label:h?"":"Save",styles:{icon:Xe.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&g.jsx(Pr,{...e==null?void 0:e.upload,styles:{variant:h?"outlined":"filled",icon:h?Xe.UploadDark:Xe.Upload,iconPrimary:!h,colorType:"secondary",isAnimate:!0}}),((E=e==null?void 0:e.download)==null?void 0:E.isRequired)&&g.jsx(Pr,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:Xe.Download,isAnimate:!0}})]})]})};uw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function zp({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){var i,a;const o=(i=e.columns)==null?void 0:i.isManageable;return g.jsx(u1,{children:r?g.jsxs(g.Fragment,{children:[g.jsx(lw,{type:"toolbar"}),g.jsx(lw,{type:"grid"})]}):g.jsxs(we,{sx:{position:"sticky"},children:[t&&g.jsx(uw,{...t,isManageable:o,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage,gridData:e==null?void 0:e.data}),g.jsx(aw,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||"",childUniqueKey:(t==null?void 0:t.childUniqueKey)||""})]})})}zp.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const dw=({list:e,handleLinkClick:t})=>{const n=jt(),r=({list:o})=>{var i;return(i=o==null?void 0:o.sort((a,l)=>a.order-l.order))==null?void 0:i.map((a,l)=>a!=null&&a.link?g.jsx(Wr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===(o==null?void 0:o.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):g.jsx(rt,{component:"h3",sx:{fontSize:"1rem",color:l===(o==null?void 0:o.length)-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:a==null?void 0:a.title},l))};return g.jsx(U0,{separator:g.jsx(gn,{url:Xe.ArrowRight}),children:r({list:e})})};dw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const fw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{var i,a,l,c,u,d,f;const o=jt();return g.jsxs(g.Fragment,{children:[g.jsxs(dt,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(dw,{...e}),g.jsxs(dt,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&g.jsx(m1,{...t}),(n==null?void 0:n.filterBtnProps)&&g.jsxs(dt,{direction:"row",children:[g.jsx(wi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),g.jsxs(dt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.onFilterClick,sx:{cursor:"pointer"},children:[g.jsx(gn,{url:Xe.Filter}),g.jsx(rt,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:(a=n==null?void 0:n.filterBtnProps)==null?void 0:a.label})]})]})]})]}),g.jsx(Ji.div,{layout:!0,initial:{height:"0rem"},animate:{height:(l=n==null?void 0:n.filterBtnProps)!=null&&l.filterContainerVisible?"5rem":"0rem",opacity:(c=n==null?void 0:n.filterBtnProps)!=null&&c.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",width:(u=n==null?void 0:n.filterContainerProps)!=null&&u.isSideDrawerOpen?"75%":"100%"},children:g.jsxs(dt,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[g.jsx(rt,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:"Filters:"}),g.jsx(we,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:g.jsx(dt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(d=n==null?void 0:n.filterItems)==null?void 0:d.map((p,h)=>g.jsx(g.Fragment,{children:g.jsxs(we,{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:[g.jsx(we,{component:"img",src:Xe.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(p)}),g.jsx(rt,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:p==null?void 0:p.filterLabel})]},h)}))})}),g.jsx(we,{component:rt,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:(f=n==null?void 0:n.filterContainerProps)==null?void 0:f.onClearClick,children:"Clear"})]})})]})};fw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function pw({headerProps:e}){return g.jsx(Ln,{children:g.jsx(fw,{...e})})}pw.propTypes={headerProps:s.object.isRequired};const Up=R.createContext(null),hw=R.createContext(null);function _7({children:e}){const[t,n]=R.useReducer($7,B7);return g.jsx(Up.Provider,{value:t,children:g.jsx(hw.Provider,{value:n,children:e})})}function $7(e,t){var n;switch(t.type){case qe.LOADING:return{...e,loading:t.loading};case qe.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case qe.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case qe.ERROR:return{...e,error:t.error};default:throw new Error(`${Jr.UNHANDLED}: ${t}`)}}const B7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:Hp,BU_ID:qp}=Q1,{TENANT_IDS:Yp,BU_IDS:Gp}=tw,L7=async e=>{try{const t=`${e}${$c.NOTIFICATION}/v1?${Hp}=${Yp}&${qp}=${Gp}`;return await Tt.get(t,Ta)}catch(t){return t}},mw=async(e,t,n)=>{try{const r=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}`;return await Tt.put(r,t,Ta)}catch(r){return r}},V7=async({baseUrl:e,id:t,snopId:n})=>{try{const r=`${e}${$c.NOTIFICATION}${jp.VERSION}?${Hp}=${Yp}&${qp}=${Gp}&id=${t}`;return await Tt.get(r,Ta)}catch(r){return r}},_s={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},gw=({baseUrl:e})=>{const t=R.useContext(hw),[n,r]=R.useState(!1),[o,i]=R.useState(!1),[a,l]=R.useState(!1),[c,u]=R.useState({}),[d,f]=R.useState(null),[p,h]=R.useState(1),[y,m]=R.useState(!1),[v,x]=R.useState(0),w=R.useRef(!1),{loading:T,data:k,isMarkAllAsRead:b}=R.useContext(Up),[O,E]=R.useState([]);R.useEffect(()=>{E(k)},[k]);const P=R.useCallback(async()=>{var F,_,W;if(!w.current)try{t({type:qe.LOADING,loading:!0}),t({type:qe.SUCCESS,data:[]});const z=await L7(e);if(z.status===_s.UNAUTHORIZED){w.current=!0;return}if(z.status===_s.OK){const M=((_=(F=z.data)==null?void 0:F.responseData)==null?void 0:_.response)||[],A=Tc(M);t({type:qe.SUCCESS,data:Tc(A)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:c1(M),boo:c1(M)>0}})}}catch(z){((W=z==null?void 0:z.response)==null?void 0:W.status)===_s.UNAUTHORIZED&&(w.current=!0),t({type:qe.ERROR,error:Jr.SWR})}finally{t({type:qe.LOADING,loading:!1})}},[e,t]);R.useEffect(()=>{P();const F=setInterval(P,3e5);return()=>clearInterval(F)},[P]);const I=async(F,_)=>{var W,z,M;if(F){f(F);try{const A=await V7({baseUrl:e,id:F,snopId:_});if(A.status===_s.OK){const V=((M=(z=(W=A.data)==null?void 0:W.responseData)==null?void 0:z.response)==null?void 0:M[0])||{};u(V||{}),l(!0)}else throw new Error}catch{t({type:qe.ERROR,error:Jr.SWR})}finally{f(null)}}},j=async(F,_)=>{if(F.length){t({type:qe.LOADING,loading:!0});try{if((await mw(e,F,_)).status===_s.OK){const z=k.map(A=>F.includes(A.id)?{...A,isRead:!0}:A),M=z.filter(A=>!A.isRead).length;t({type:qe.SUCCESS,data:Tc(z)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:M,boo:M>0}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}}},N=async()=>{t({type:qe.LOADING,loading:!0});try{const F=hV(k);if((await mw(e,F,f7.MARK_ALL_READ)).status===_s.OK){const W=k.map(z=>({...z,isRead:!0}));t({type:qe.SUCCESS,data:Tc(W)}),t({type:qe.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},200)}}catch{t({type:qe.ERROR,error:Jr.SWR}),t({type:qe.LOADING,loading:!1})}},D=(F,_)=>{t({type:qe.LOADING,loading:!0}),x(_),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)},$=F=>{const _=F||k||[];return{0:_,1:_.filter(W=>(W==null?void 0:W.type)==="INFO"),2:_.filter(W=>(W==null?void 0:W.type)==="ERROR")}},B=()=>{t({type:qe.LOADING,loading:!0});const F=!y,_=F?(O||[]).filter(W=>!W.isRead):k||[];m(F),E(_),h(1),setTimeout(()=>{t({type:qe.LOADING,loading:!1})},400)};return{fetchNotification:P,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:P,handleRead:j,handleMarkAllAsRead:N,setOpen:r,handleShowDetails:I,clickId:d,isMainDialog:!0},activeTab:v,loading:T,tabData:$(O)[v],data:O,mode:y,handleTabChange:D,toggleAlertMode:B,page:p,setPage:h,isMarkAllAsRead:b}};var yw,bw,vw;function Kp(){return Kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kp.apply(null,arguments)}var W7=function(t){return C.createElement("svg",Kp({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),yw||(yw=C.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeMiterlimit:10,d:"M8.013 2.19c-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.373V6.19c0-2.2-1.8-4-4-4Z"})),bw||(bw=C.createElement("path",{stroke:"#909090",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M9.247 2.383a4.503 4.503 0 0 0-2.467 0 1.324 1.324 0 0 1 2.467 0"})),vw||(vw=C.createElement("path",{stroke:"#909090",strokeMiterlimit:10,d:"M10.013 12.957c0 1.1-.9 2-2 2a2.007 2.007 0 0 1-2-2"})))};const z7=({count:e})=>(jt(),g.jsxs(g.Fragment,{children:[g.jsx(we,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:g.jsx(W7,{style:{scale:2}})}),g.jsx(O7,{badgeContent:e!=0?"":null,color:"error"})]}));function xw({children:e,handleClose:t,open:n,isMainDialog:r}){return g.jsx(Pl,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var ww;function Xp(){return Xp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xp.apply(null,arguments)}var U7=function(t){return C.createElement("svg",Xp({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),ww||(ww=C.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"})))},Cw,Sw;function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zp.apply(null,arguments)}var H7=function(t){return C.createElement("svg",Zp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),Cw||(Cw=C.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"})),Sw||(Sw=C.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"})))},Tw;function Jp(){return Jp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jp.apply(null,arguments)}var q7=function(t){return C.createElement("svg",Jp({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Tw||(Tw=C.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 kw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i})=>{var c,u;const a=jt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return g.jsxs(we,{className:"cards",sx:{pt:" 0.8rem"},children:[g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:g.jsx(od,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t==null?void 0:t.isRead,children:g.jsx(Eo,{sx:{color:a.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",(t==null?void 0:t.isRead)&&"read"].join(" "),children:t==null?void 0:t.message})})}),g.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:g.jsxs(dt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&g.jsx(Vc,{icon:g.jsx(H7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?g.jsx(El,{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)&&g.jsx(Vc,{icon:g.jsx(q7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:"Acknowledge",component:"button",variant:"outlined",clickable:!0,size:"small"}),(t==null?void 0:t.primaryCTAURL)&&g.jsx(Vc,{disabled:t==null?void 0:t.isPrimaryCTAClicked,onClick:()=>o({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)&&g.jsx(Vc,{disabled:t==null?void 0:t.isSecondaryCTAClicked,onClick:()=>o({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"})]})}),g.jsxs(dt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[g.jsx(Eo,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),g.jsx(Eo,{color:a.palette.primary.notifyTextColor,children:"•"}),g.jsx(Eo,{sx:{fontSize:"0.8rem"},children:pV(t==null?void 0:t.createdAt)})]})]})};kw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Ow=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=R.useContext(Up),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,f]=R.useState([]),[p,h]=R.useState(!1),[y,m]=R.useState(!0),v=R.useRef(null),x=async T=>{h(!0);const k=e.slice((T-1)*10,T*10);await new Promise(b=>setTimeout(b,1e3)),f(b=>{const O=k.filter(E=>!b.some(P=>P.id===E.id));return[...b,...O]}),h(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&m(!1)};R.useEffect(()=>{var k;let T=[];o?l!=null&&l.count?T=(k=e==null?void 0:e.filter(b=>!b.isRead))==null?void 0:k.slice(0,10):T=[]:T=e.slice(0,10),(T==null?void 0:T.length)<10&&m(!1),f(T)},[e,o,l]),R.useEffect(()=>{y&&i!==1&&x(i)},[i,e]),R.useEffect(()=>{f([...e])},[e]),R.useEffect(()=>{const T=new IntersectionObserver(k=>{k[0].isIntersecting&&!p&&y&&a(b=>b+1)},{threshold:1});return v.current&&T.observe(v.current),()=>{v.current&&T.unobserve(v.current)}},[p,y]);const w=({redirect:T,isClicked:k,url:b})=>{window.open(b,"_blank")};return g.jsxs(we,{sx:{width:"100%"},children:[Object.entries(yV(d)).map(([T,k])=>g.jsxs(R.Fragment,{children:[T!==u&&g.jsx(k7,{children:T}),k.map((b,O)=>g.jsx(R.Fragment,{children:g.jsx(kw,{item:b,handleCTAClicked:w,handleShowDetails:()=>n(b.id,b.snopId),handleRead:()=>t([b.id],b.snopId),clickId:r})},`${O}_${b.id}`))]},T)),p&&i>1&&!!(d!=null&&d.length)&&g.jsx(we,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:g.jsx(El,{size:20,sx:{color:T=>T.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&g.jsx(rt,{sx:{fontSize:"1.1rem",color:T=>T.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."}),g.jsx(we,{ref:v,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Ow.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const Y7=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o})=>{var y,m,v,x;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:f,handleTabChange:p,toggleAlertMode:h}=gw({});return g.jsxs(g.Fragment,{children:[g.jsxs(we,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[g.jsx(rt,{variant:"h2",sx:{fontSize:"1.2rem",color:w=>w.palette.primary.notifyTextColor},children:"Notifications"}),g.jsx(we,{onClick:e,children:g.jsx(gn,{url:Xe.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),g.jsx(we,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},children:g.jsxs(E7,{value:a,onChange:p,children:[g.jsx(Wp,{label:g.jsxs(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",g.jsx(rt,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((y=l==null?void 0:l.filter(w=>!(w!=null&&w.isRead)))==null?void 0:y.length)||0}),")"]})}),g.jsx(Wp,{label:g.jsxs(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",g.jsx(rt,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((m=l==null?void 0:l.filter(w=>(w==null?void 0:w.type)==="INFO"&&!(w!=null&&w.isRead)))==null?void 0:m.length)||0}),")"]}),sx:{color:w=>w.palette.brandColor.blue}}),g.jsx(Wp,{label:g.jsxs(we,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",g.jsx(rt,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((v=l==null?void 0:l.filter(w=>(w==null?void 0:w.type)==="ERROR"&&!(w!=null&&w.isRead)))==null?void 0:v.length)||0}),")"]}),sx:{color:w=>w.palette.brandColor.red}})]})}),g.jsx(Rl,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:w=>w.palette.primary.notifyBorderColor},tabIndex:-1,children:i?g.jsx(El,{size:30,sx:{color:w=>w.palette.primary.notifyIconColor}}):g.jsx(g.Fragment,{children:g.jsx(Ow,{data:c,handleShowDetails:t,handleRead:r,clickId:n,page:d,setPage:f,mode:u})})}),g.jsxs(Ml,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[g.jsxs(dt,{direction:"row",gap:1,children:[g.jsx(Eo,{sx:{fontSize:"1rem"},children:"Only show unread"}),g.jsx(T7,{disabled:i,checked:u,onChange:h})]}),g.jsx(qn,{variant:"outlined",className:"view-all",onClick:o,startIcon:g.jsx(U7,{}),disabled:!((x=l==null?void 0:l.filter(w=>!(w!=null&&w.isRead)))!=null&&x.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:w=>w.palette.primary.notifyTextColor,"&:hover":{color:w=>w.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:w=>`${w.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},G7=({data:e,handleClose:t})=>{var v;const[n,r]=R.useState(1),[o,i]=R.useState(10),[a,l]=R.useState(((v=e==null?void 0:e.notificationDetails)==null?void 0:v.length)||0),[c,u]=R.useState("sku_name"),[d,f]=R.useState("asc"),[p,h]=R.useState([]),[y,m]=R.useState("");return R.useEffect(()=>{var x;if(y||c){const w=mV(e==null?void 0:e.notificationDetails,u7,y);if(c){const T=gV(w,c,d);h(gp(T,n,o)),l(T.length);return}h(gp(w,n,o)),l(w.length);return}h(gp(e==null?void 0:e.notificationDetails,n,o)),l((x=e==null?void 0:e.notificationDetails)==null?void 0:x.length)},[y,e==null?void 0:e.notificationDetails,n,o,d,c]),g.jsxs(g.Fragment,{children:[g.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:x=>x.palette.primary.notifyBorderColor},children:[g.jsx(rt,{component:"h2",sx:{fontSize:"1.4rem",color:x=>x.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),g.jsx(we,{onClick:t,sx:{cursor:"pointer"},children:g.jsx(gn,{url:Xe.CloseCircle})})]}),g.jsx(Rl,{children:g.jsx(zp,{tableProps:{data:p,columns:{...S7(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:x=>{var T;const w=(T=x==null?void 0:x.column)==null?void 0:T.key;f(k=>c===w&&k==="asc"?"desc":"asc"),u(w)}},pagination:{selectedPage:n,rowPerPage:o,totalRecords:a,onPageChange:x=>{r(x)},onPageSizeChange:x=>{i(x==null?void 0:x.value),r(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:x=>{const w=x.target.value;w&&r(1),m(w)},placeholder:"Search..."}}}})}),g.jsx(Ml,{sx:{padding:"1.5rem 2rem"}})]})},K7=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:r,isMarkAllAsRead:o}=gw({baseUrl:e});return g.jsxs(g.Fragment,{children:[g.jsx(we,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{var i;r(),(i=t==null?void 0:t.setOpen)==null||i.call(t,!0)},children:g.jsx(z7,{count:o.count})}),g.jsx(xw,{...t,children:g.jsx(Y7,{...t})}),g.jsx(xw,{...n,children:g.jsx(G7,{...n})})]})},X7=({baseUrl:e})=>g.jsx(Ln,{children:g.jsx(_7,{children:g.jsx(K7,{baseUrl:e})})}),Z7=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f})=>{const p=jt();return g.jsx(we,{sx:{position:"relative",overflow:"hidden"},children:g.jsxs(uo,{container:!0,sx:{height:"100%"},children:[g.jsx(uo,{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}),r&&!n&&g.jsx(g.Fragment,{children:g.jsx(we,{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"}})}),e&&g.jsxs(uo,{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:p.palette.primary.notifyBackground,transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.4s ease-in-out , width 0.4s ease-in-out",zIndex:4,borderLeft:`0.1rem solid ${p.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[g.jsxs(dt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:h=>`0.1rem solid ${h.palette.primary.notifyBorderColor}`},children:[!u&&f&&g.jsxs(g.Fragment,{children:[g.jsx(we,{component:"img",src:Xe.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),g.jsx(wi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),g.jsxs(dt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[g.jsxs(dt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[g.jsx(gn,{url:Xe.CrossLight}),g.jsx(rt,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),g.jsx(dt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&g.jsx(we,{onClick:c,sx:{cursor:"pointer"},children:g.jsx(we,{component:"img",src:u?Xe.Collapse:Xe.Expand})})})]})]}),g.jsx(we,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Ew=({layoutChildren:e,layoutProps:t})=>g.jsx(Ln,{children:g.jsx(Z7,{...e,...t})});Ew.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},wt.Button=Pr,wt.Checkbox=ac,wt.DatePicker=dV,wt.Grid=zp,wt.Header=pw,wt.InputField=l1,wt.Loader=_V,wt.Notification=X7,wt.Select=d1,wt.SliderLayout=Ew,wt.Switch=m1,wt.TextField=Cc,wt.ToastProvider=IV,wt.toast=PV,Object.defineProperty(wt,Symbol.toStringTag,{value:"Module"})});
327
327
  //# sourceMappingURL=index.umd.js.map