@3sc/common-component 0.0.262 → 0.0.263
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.es.js +9 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
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[M1]=this[M1]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=wa(a);r[l]||(A8(o,a),r[l]=!0)}return te.isArray(t)?t.forEach(i):i(t),this}};mn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(mn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),te.freezeMethods(mn);function wp(e,t){const n=this||xa,r=t||n,o=mn.from(r.headers);let i=r.data;return te.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function R1(e){return!!(e&&e.__CANCEL__)}function Ds(e,t,n){Ue.call(this,e??"canceled",Ue.ERR_CANCELED,t,n),this.name="CanceledError"}te.inherits(Ds,Ue,{__CANCEL__:!0});function D1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ue("Request failed with status code "+n.status,[Ue.ERR_BAD_REQUEST,Ue.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function j8(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function N8(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 g=d&&u-d;return g?Math.round(p*1e3/g):void 0}}function $8(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 Pc=(e,t,n=3)=>{let r=0;const o=N8(50,250);return $8(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)},I1=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},A1=e=>(...t)=>te.asap(()=>e(...t)),_8=en.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,en.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(en.origin),en.navigator&&/(msie|trident)/i.test(en.navigator.userAgent)):()=>!0,F8=en.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const a=[e+"="+encodeURIComponent(t)];te.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),te.isString(r)&&a.push("path="+r),te.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 B8(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function L8(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function j1(e,t,n){let r=!B8(t);return e&&(r||n==!1)?L8(e,t):t}const N1=e=>e instanceof mn?{...e}:e;function Co(e,t){t=t||{};const n={};function r(u,d,f,p){return te.isPlainObject(u)&&te.isPlainObject(d)?te.merge.call({caseless:p},u,d):te.isPlainObject(d)?te.merge({},d):te.isArray(d)?d.slice():d}function o(u,d,f,p){if(te.isUndefined(d)){if(!te.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!te.isUndefined(d))return r(void 0,d)}function a(u,d){if(te.isUndefined(d)){if(!te.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(N1(u),N1(d),f,!0)};return te.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||o,p=f(e[d],t[d],d);te.isUndefined(p)&&f!==l||(n[d]=p)}),n}const $1=e=>{const t=Co({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;t.headers=a=mn.from(a),t.url=O1(j1(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(te.isFormData(n)){if(en.hasStandardBrowserEnv||en.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(en.hasStandardBrowserEnv&&(r&&te.isFunction(r)&&(r=r(t)),r||r!==!1&&_8(t.url))){const u=o&&i&&F8.read(i);u&&a.set(o,u)}return t},V8=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=$1(e);let i=o.data;const a=mn.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,g,m;function h(){g&&g(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function w(){if(!b)return;const x=mn.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:x,config:e,request:b};D1(function(k){n(k),h()},function(k){r(k),h()},v),b=null}"onloadend"in b?b.onloadend=w:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(w)},b.onabort=function(){b&&(r(new Ue("Request aborted",Ue.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new Ue("Network Error",Ue.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let O=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const v=o.transitional||k1;o.timeoutErrorMessage&&(O=o.timeoutErrorMessage),r(new Ue(O,v.clarifyTimeoutError?Ue.ETIMEDOUT:Ue.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&te.forEach(a.toJSON(),function(O,v){b.setRequestHeader(v,O)}),te.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),l&&l!=="json"&&(b.responseType=o.responseType),u&&([p,m]=Pc(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,g]=Pc(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",g)),(o.cancelToken||o.signal)&&(d=x=>{b&&(r(!x||x.type?new Ds(null,e,b):x),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const S=j8(o.url);if(S&&en.protocols.indexOf(S)===-1){r(new Ue("Unsupported protocol "+S+":",Ue.ERR_BAD_REQUEST,e));return}b.send(i||null)})},W8=(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 Ue?d:new Ds(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new Ue(`timeout ${t} of ms exceeded`,Ue.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=()=>te.asap(l),c}},z8=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},U8=async function*(e,t){for await(const n of H8(e))yield*z8(n,t)},H8=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()}},_1=(e,t,n,r)=>{const o=U8(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})},Mc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",F1=Mc&&typeof ReadableStream=="function",q8=Mc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),B1=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Y8=F1&&B1(()=>{let e=!1;const t=new Request(en.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),L1=64*1024,Cp=F1&&B1(()=>te.isReadableStream(new Response("").body)),Rc={stream:Cp&&(e=>e.body)};Mc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Rc[t]&&(Rc[t]=te.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Ue(`Response type '${t}' is not supported`,Ue.ERR_NOT_SUPPORT,r)})})})(new Response);const G8=async e=>{if(e==null)return 0;if(te.isBlob(e))return e.size;if(te.isSpecCompliantForm(e))return(await new Request(en.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(te.isArrayBufferView(e)||te.isArrayBuffer(e))return e.byteLength;if(te.isURLSearchParams(e)&&(e=e+""),te.isString(e))return(await q8(e)).byteLength},K8=async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??G8(t)},Sp={http:g8,xhr:V8,fetch:Mc&&(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}=$1(e);u=u?(u+"").toLowerCase():"text";let g=W8([o,i&&i.toAbortSignal()],a),m;const h=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let b;try{if(c&&Y8&&n!=="get"&&n!=="head"&&(b=await K8(d,r))!==0){let v=new Request(t,{method:"POST",body:r,duplex:"half"}),E;if(te.isFormData(r)&&(E=v.headers.get("content-type"))&&d.setContentType(E),v.body){const[k,D]=I1(b,Pc(A1(c)));r=_1(v.body,L1,k,D)}}te.isString(f)||(f=f?"include":"omit");const w="credentials"in Request.prototype;m=new Request(t,{...p,signal:g,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:w?f:void 0});let S=await fetch(m);const x=Cp&&(u==="stream"||u==="response");if(Cp&&(l||x&&h)){const v={};["status","statusText","headers"].forEach(R=>{v[R]=S[R]});const E=te.toFiniteNumber(S.headers.get("content-length")),[k,D]=l&&I1(E,Pc(A1(l),!0))||[];S=new Response(_1(S.body,L1,k,()=>{D&&D(),h&&h()}),v)}u=u||"text";let O=await Rc[te.findKey(Rc,u)||"text"](S,e);return!x&&h&&h(),await new Promise((v,E)=>{D1(v,E,{data:O,headers:mn.from(S.headers),status:S.status,statusText:S.statusText,config:e,request:m})})}catch(w){throw h&&h(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new Ue("Network Error",Ue.ERR_NETWORK,e,m),{cause:w.cause||w}):Ue.from(w,w&&w.code,e,m)}})};te.forEach(Sp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const V1=e=>`- ${e}`,X8=e=>te.isFunction(e)||e===null||e===!1,W1={getAdapter:e=>{e=te.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,!X8(n)&&(r=Sp[(a=String(n)).toLowerCase()],r===void 0))throw new Ue(`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(V1).join(`
|
|
325
325
|
`):" "+V1(i[0]):"as no adapter specified";throw new Ue("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:Sp};function Tp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ds(null,e)}function z1(e){return Tp(e),e.headers=mn.from(e.headers),e.data=wp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),W1.getAdapter(e.adapter||xa.adapter)(e).then(function(r){return Tp(e),r.data=wp.call(e,e.transformResponse,r),r.headers=mn.from(r.headers),r},function(r){return R1(r)||(Tp(e),r&&r.response&&(r.response.data=wp.call(e,e.transformResponse,r.response),r.response.headers=mn.from(r.response.headers))),Promise.reject(r)})}const U1="1.8.4",Dc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Dc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const H1={};Dc.transitional=function(t,n,r){function o(i,a){return"[Axios v"+U1+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new Ue(o(a," has been removed"+(n?" in "+n:"")),Ue.ERR_DEPRECATED);return n&&!H1[a]&&(H1[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}},Dc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Z8(e,t,n){if(typeof e!="object")throw new Ue("options must be an object",Ue.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 Ue("option "+i+" must be "+c,Ue.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ue("Unknown option "+i,Ue.ERR_BAD_OPTION)}}const Ic={assertOptions:Z8,validators:Dc},hr=Ic.validators;let So=class{constructor(t){this.defaults=t,this.interceptors={request:new E1,response:new E1}}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=Co(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Ic.assertOptions(r,{silentJSONParsing:hr.transitional(hr.boolean),forcedJSONParsing:hr.transitional(hr.boolean),clarifyTimeoutError:hr.transitional(hr.boolean)},!1),o!=null&&(te.isFunction(o)?n.paramsSerializer={serialize:o}:Ic.assertOptions(o,{encode:hr.function,serialize:hr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ic.assertOptions(n,{baseUrl:hr.spelling("baseURL"),withXsrfToken:hr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&te.merge(i.common,i[n.method]);i&&te.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=mn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,p;if(!c){const m=[z1.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let g=n;for(f=0;f<p;){const m=l[f++],h=l[f++];try{g=m(g)}catch(b){h.call(this,b);break}}try{d=z1.call(this,g)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Co(this.defaults,t);const n=j1(t.baseURL,t.url,t.allowAbsoluteUrls);return O1(n,t.params,t.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(t){So.prototype[t]=function(n,r){return this.request(Co(r||{},{method:t,url:n,data:(r||{}).data}))}}),te.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(Co(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}So.prototype[t]=n(),So.prototype[t+"Form"]=n(!0)});let J8=class kw{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 Ds(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 kw(function(o){t=o}),cancel:t}}};function Q8(e){return function(n){return e.apply(null,n)}}function e7(e){return te.isObject(e)&&e.isAxiosError===!0}const Op={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(Op).forEach(([e,t])=>{Op[t]=e});function q1(e){const t=new So(e),n=d1(So.prototype.request,t);return te.extend(n,So.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return q1(Co(e,o))},n}const St=q1(xa);St.Axios=So,St.CanceledError=Ds,St.CancelToken=J8,St.isCancel=R1,St.VERSION=U1,St.toFormData=Ec,St.AxiosError=Ue,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=Q8,St.isAxiosError=e7,St.mergeConfig=Co,St.AxiosHeaders=mn,St.formToJSON=e=>P1(te.isHTMLForm(e)?new FormData(e):e),St.getAdapter=W1.getAdapter,St.HttpStatusCode=Op,St.default=St;const{Axios:_W,AxiosError:FW,CanceledError:BW,isCancel:LW,CancelToken:VW,VERSION:WW,all:zW,Cancel:UW,isAxiosError:HW,spread:qW,toFormData:YW,AxiosHeaders:GW,HttpStatusCode:KW,formToJSON:XW,getAdapter:ZW,mergeConfig:JW}=St,Ep={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"};/*! js-cookie v3.0.5 | MIT */function Ac(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 t7={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function kp(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Ac({},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,"",Ac({},i,{expires:-1}))},withAttributes:function(o){return kp(this.converter,Ac({},this.attributes,o))},withConverter:function(o){return kp(Ac({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var n7=kp(t7,{path:"/"});const Yr={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Pp={BEARER:"Bearer",TENANT_ID:"tenant_id",BU_ID:"bu_id",SNOP_ID:"snop_id"},r7=[10,25,50,100],Y1={MARK_ALL_READ:"MARK_ALL_READ"},o7=r7.map(e=>({label:e,value:e})),G1={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Mp=vc(Yr.SNOP),Rp=vc(Yr.SELECTED_BU),Dp=vc(Yr.USER),s7=vc(Yr.SETTINGS),Is={BU_IDS:Rp==null?void 0:Rp.business_unit_id,TOKEN:JSON.parse(n7.get(Yr.TOKEN)||null),TENANT_IDS:Dp==null?void 0:Dp.tenant_id,SNOP_IDS:Mp==null?void 0:Mp.snop_id,GRID_SETTINGS:s7},Ca={headers:{"Content-Type":"application/json",Authorization:`${Pp.BEARER} ${Is.TOKEN}`}},K1=St.create({baseURL:Ep.BASE_URL,axiosConfig:Ca});K1.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),K1.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const jc={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"},{TENANT_ID:i7,BU_ID:a7}=Pp,{TENANT_IDS:l7,BU_IDS:c7}=Is,Ip=async({baseUrl:e,payload:t})=>{try{const n=`${e}${jc.SETTING}/v1?${i7}=${l7}&${a7}=${c7}`;return await St.post(n,t,Ca)}catch(n){return n}},u7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o})=>{var m;let{definitions:i,defaultUserSettings:a,labels:l}=e;const c=t.split("/").filter(Boolean);let u=c.reduce((h,b)=>h==null?void 0:h[b],Is.GRID_SETTINGS)||null;r||!u&&!a&&(async()=>{try{a=X1({definitions:i});const b={...Is.GRID_SETTINGS||{platform:{theme:"light"}}},w=(u==null?void 0:u.pageSize)??o;let S=b;for(let x=0;x<c.length;x++){const O=c[x];x===c.length-1?S[O]={columns:updatedColumns,pageSize:w}:(S[O]={...S[O]||{}},S=S[O])}localStorage.setItem(Yr.SETTINGS,JSON.stringify(b)),await Ip({baseUrl:n,payload:b})}catch(h){console.error(h)}})(),a=(u==null?void 0:u.columns)??a??X1({definitions:i});const d=a.reduce((h,b)=>(h[b.id]=b,h),{}),f=l.reduce((h,b)=>(h[b.id]=b,h),{}),p=[];for(const h of i){const b=d[h.id]||{},w=f[h.id]||{};let S={...h,...b,...w};if((m=h.children)!=null&&m.length){const x=b.children||[],O=w.children||[];S.children=h.children.map((v,E)=>({...v,...x[E],...O[E]}))}p.push(S)}return p.sort((h,b)=>h.sequenceId-b.sequenceId)},d7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),X1=({definitions:e})=>e.map((t,n)=>({id:t.id,key:t.key,sequenceId:t.id,isHidden:!1,style:t.style||{}})),f7=()=>({definitions:[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],defaultUserSettings:[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],labels:[{id:1,key:"sku_name",label:"SKU",isLocalizable:!1},{id:2,key:"node",label:"Node",isLocalizable:!1},{id:3,key:"channel_name",label:"Channel",isLocalizable:!1}]});class Ap extends M.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=M.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)"),M.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})}}Ap.defaultProps={disabled:!1,minWidth:0,className:""},Ap.propTypes={disabled:"boolean",minWidth:"number",className:"string"};var Z1,J1;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 p7=function(t){return C.createElement("svg",jp({xmlns:"http://www.w3.org/2000/svg",width:17,height:7,fill:"none"},t),Z1||(Z1=C.createElement("path",{fill:"#0582CA",d:"M4.652.5.676 3.493l3.976 2.981V4.051h8.354V2.859H4.652z"})),J1||(J1=C.createElement("path",{fill:"#0582CA",d:"M12.36.5v2.384H4.008v1.193h8.352v2.396l.956-.716 3.022-2.265z"})))};const h7=(e,t,n,r,o)=>{const[i,a]=M.useState({isOpen:!1,column:null}),l=(f,p,g)=>{a({isOpen:f.currentTarget,column:p,isChild:!!g})},c=()=>{a({isOpen:!1,column:null,isChild:!1})},u=async()=>{c();const f=e.map(p=>{var g;if(i!=null&&i.isChild&&Array.isArray(p.children)){const m=p.children.map(b=>b.id===i.column.id?{...b,isHidden:!0}:b),h=m.every(b=>b.isHidden);return{...p,isHidden:h?!0:p.isHidden,children:m}}return p.id===((g=i==null?void 0:i.column)==null?void 0:g.id)?{...p,isHidden:!0}:p});d({updatedColumns:f})},d=async({updatedColumns:f})=>{t({type:He.SET_GRID_DATA,payload:{visibleGridColumns:f}});const p=r.split("/").filter(Boolean),h={...JSON.parse(localStorage.getItem(Yr.SETTINGS))||{platform:{theme:"light"}}},b=p.reduce((x,O)=>x==null?void 0:x[O],Is.GRID_SETTINGS)||null,w=(b==null?void 0:b.pageSize)??o;let S=h;for(let x=0;x<p.length;x++){const O=p[x];x===p.length-1?S[O]={columns:f,pageSize:w}:(S[O]={...S[O]||{}},S=S[O])}localStorage.setItem(Yr.SETTINGS,JSON.stringify(h)),await Ip({baseUrl:n,payload:h})};return{selectedColumn:i,handleMenuClick:l,handleClose:c,handleHideClick:u,columnUpdaterFunction:d}},Q1=({pagination:e})=>{const{selectedPage:t,rowPerPage:n,totalRecords:r,onPageChange:o,onPageSizeChange:i}=e,a=Nt();return y.jsxs(ge,{sx:{display:"flex",p:"1rem 2rem"},children:[y.jsxs(ge,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[y.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:`Showing ${(t-1)*n+1} to ${Math.min(t*n,r)} of ${r} rows`}),y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:y.jsx(wc,{options:o7,value:n,onChange:i})}),y.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:"records per page"})]}),y.jsx(C0,{count:Math.ceil(r/n),page:t,onChange:(l,c)=>{o(c)},shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:a.palette.primary.notifyActiveText,backgroundColor:`${a.palette.brandColor.paginationBc} !important`}}})]})};Q1.propTypes={pagination:s.object.isRequired};function Np({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key];return y.jsx(y.Fragment,{children:e?y.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t==null?void 0:t.cellRenderer(n,{column:t,parent:r})}):y.jsx(D0,{title:(o==null?void 0:o.length)>20?o:"",arrow:!0,children:y.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},id:t.key,component:"label",children:dV(o)})})})}Np.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object};const ew=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=Nt();return y.jsx(Si,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:y.jsx(ge,{sx:{p:"0.4rem 1rem",backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:y.jsx(Un,{onClick:n,sx:{textTransform:"none",fontSize:"1.1rem",p:0,minHeight:"unset",fontWeight:"500",color:r.palette.primary.notifyTextColor,"&:hover":{background:"none"}},children:"Hide Column"})})})};ew.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func},q(Ol)(({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 To=q(et)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),m7=q(I0)(({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)"})}})),g7=q(yi)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),y7=q(Qu)(({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"}}));q($l)(({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 b7=q(X0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),$p=q(A0)(({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}})),Nc=q(Xu)(({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`}})),tw=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>y.jsx(Rr,{onClick:r,sx:{padding:"0.5rem"},children:y.jsx(ge,{component:"img",src:i})});return y.jsx(y.Fragment,{children:o(t===e?n==="asc"?nt.AscSort:nt.DescSort:nt.Unsort)})};tw.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function nw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=t==null?void 0:t.isMandatory,a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return y.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",textAlign:"center",whiteSpace:"normal"},children:[a,y.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[l&&y.jsx(tw,{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})}),o&&!i&&y.jsx(Rr,{onClick:f=>r(f,t,e),sx:{padding:"0.5rem"},children:y.jsx(ge,{component:"img",src:nt.Menu})})]})]})}nw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};const v7=q(yd)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${gd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"},[`&.${gd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"}}));function Sa({children:e,...t}){return y.jsx(v7,{...t,children:e})}Sa.propTypes={children:s.node};const x7=q(z0)(()=>({"&:last-child td":{borderBottom:0}}));function As({children:e,...t}){return y.jsx(x7,{...t,children:e})}As.propTypes={children:s.node};function rw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l}){var ee;const c=Nt(),{visibleGridColumns:u}=M.useContext(ga),d=M.useContext(ya),{selectedColumn:f,handleMenuClick:p,handleClose:g,handleHideClick:m,columnUpdaterFunction:h}=h7(u,d,a,l,r==null?void 0:r.rowPerPage),b=o==null?void 0:o.isManageable,w=o==null?void 0:o.isResizable,S=(n==null?void 0:n.length)>0,x=M.useRef(null),[O,v]=M.useState(null),[E,k]=M.useState(null),[D,R]=M.useState(null);let A=null;const $=M.useRef(0),I=M.useRef(!1),W=d7(((ee=i==null?void 0:i.column)==null?void 0:ee.definitions)||[]),j=i==null?void 0:i.isNested,_=(i==null?void 0:i.data)||[],P=i==null?void 0:i.hashKey;if(!S)return y.jsx(To,{sx:{textAlign:"center"},children:qr.NRF});M.useEffect(()=>{const L=x.current,G=L==null?void 0:L.querySelector("thead");if(!G)return;const X=()=>{R(null)};return G.addEventListener("mouseleave",X),()=>{G.removeEventListener("mouseleave",X)}},[]);const N=(L,G)=>{var oe,ce;if(I.current){L.preventDefault();return}v(G),R(null),L.dataTransfer.setData("colIndex",G);const X=u[G],Q=X==null?void 0:X.label,Y=document.createElement("div");Y.textContent=Q,Object.assign(Y.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(oe=X==null?void 0:X.style)==null?void 0:oe.minWidth,maxWidth:(ce=X==null?void 0:X.style)==null?void 0:ce.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:c.palette.primary.notifyTextColor,background:c.palette.primary.notifyBackground,border:`0.1rem solid ${c.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(Y);const{offsetWidth:F,offsetHeight:K}=Y;L.dataTransfer.setDragImage(Y,F/2,K/2),requestAnimationFrame(()=>{document.body.removeChild(Y)})},B=(L,G)=>{L.preventDefault(),k(G),ie(L)},H=async(L,G)=>{if(L.preventDefault(),clearInterval(A),O===null||O===G)return;const X=[...u],[Q]=X.splice(O,1);X.splice(G,0,Q);const Y=u.slice().sort((K,oe)=>K.sequenceId-oe.sequenceId).map(K=>K.sequenceId),F=X.map((K,oe)=>({...K,sequenceId:Y[oe]??K.sequenceId}));h({updatedColumns:F}),v(null),k(null)},V=()=>{v(null),k(null)},z=(L,G,X,Q)=>{var ae,Ce,me,ye,_e,je,Re;if(!L)return null;const Y=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),F=parseFloat((Ce=(ae=L==null?void 0:L.style)==null?void 0:ae.minWidth)==null?void 0:Ce.toString().replace("rem",""))||7.5;G===0&&($.current=0);const K=Y?G===0?0:`${$.current}rem`:void 0;Y&&($.current+=F);const oe=O===G,ce=E==G||((me=u==null?void 0:u[E])==null?void 0:me.isMandatory),de=Ee=>{L.isMandatory?(Ee.preventDefault(),Ee.dataTransfer.dropEffect="none"):(Ee.preventDefault(),Ee.dataTransfer.dropEffect="move"),B==null||B(Ee,G)},we=Ee=>{L.isMandatory||H==null||H(Ee,G)};return y.jsx(Sa,{rowSpan:L!=null&&L.children?1:2,colSpan:w?((_e=(ye=L==null?void 0:L.children)==null?void 0:ye.filter(Ee=>!(Ee!=null&&Ee.isHidden)))==null?void 0:_e.length)*2-1:(Re=(je=L==null?void 0:L.children)==null?void 0:je.filter(Ee=>!(Ee!=null&&Ee.isHidden)))==null?void 0:Re.length,style:L==null?void 0:L.style,draggable:X&&!Q&&!(L!=null&&L.isMandatory),onDragStart:X?Ee=>N(Ee,G):void 0,onDragOver:X?de:void 0,onDrop:X?we:void 0,onDragEnd:X?V:void 0,sx:{...oe&&{border:`0.1rem solid ${c.palette.brandColor.lightBlue}!important`},...Y&&{borderRadius:"0rem!important",position:"sticky",left:K,zIndex:3},...!(L!=null&&L.children)&&{borderLeft:Ee=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${Ee.palette.primary.notifyBorderColor}`,borderRight:Ee=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${Ee.palette.primary.notifyBorderColor}`},cursor:ce?"not-allowed":X&&!(L!=null&&L.isMandatory)?"grab":"default"},children:y.jsx(nw,{parent:Q,column:L,sort:t,handleMenuClick:p,isManageable:X})},G)},Z=(L,G,X,Q)=>{var oe,ce,de;if(!L)return null;const Y=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),F=parseFloat((ce=(oe=L==null?void 0:L.style)==null?void 0:oe.minWidth)==null?void 0:ce.toString().replace("rem",""))||7.5;X===0&&($.current=0);const K=Y?X===0?0:`${$.current}rem`:void 0;return Y&&($.current+=F),y.jsxs(Sa,{colSpan:1,style:L==null?void 0:L.style,className:`${L==null?void 0:L.label}`,sx:{position:"relative",...Y&&{position:"sticky",left:K,zIndex:2,backgroundColor:we=>{var ae;return((ae=e==null?void 0:e.selectedRow)==null?void 0:ae.fhi)===(G==null?void 0:G.fhi)||G!=null&&G.isHigh?we.palette.primary.appBackground:we.palette.primary.notifyBackground}},...Q?{p:"0rem!important"}:{px:"0rem!important",borderLeft:we=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${we.palette.primary.notifyBorderColor}`,borderRight:we=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${we.palette.primary.notifyBorderColor}`}},children:[((e==null?void 0:e.selectedRow)&&((de=e==null?void 0:e.selectedRow)==null?void 0:de.fhi)===(G==null?void 0:G.fhi)||(G==null?void 0:G.isHigh))&&y.jsx(ge,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.05rem",background:"linear-gradient(#F9B16E, #F68080)"}}),y.jsx(Np,{isRenderCellContent:!!(L!=null&&L.cellRenderer),column:L,row:G,parent:Q})]},X)},ne=(L,G,X,Q)=>L&&!(L!=null&&L.isMandatory)&&X?y.jsx(ge,{resizeStart:()=>{I.current=!0},resizeEnd:()=>{I.current=!1},component:Ap,rowSpan:L!=null&&L.children?1:2,colSpan:1,id:G,sx:{width:"2rem",maxWidth:"2rem",minWidth:"2rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:0,transform:"translateX(-50%)",width:"0.15rem",height:"calc(100% + 0.1rem)",backgroundColor:D===G?c.palette.brandColor.lightBlue:Q||L!=null&&L.children?c.palette.primary.notifyBorderColor:"transparent",transition:"background-color 0.2s ease",zIndex:1}},disabled:!X}):null,J=(L,G,X,Q,Y)=>L&&!(L!=null&&L.isMandatory)&&X?y.jsx(yd,{className:"column_resizer_body",sx:{padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:0,transform:"translateX(-50%)",width:"0.15rem",height:"calc(100% + 0.1rem)",backgroundColor:D===G?c.palette.brandColor.lightBlue:Y||L!=null&&L.children?c.palette.primary.notifyBorderColor:"transparent",transition:"background-color 0.2s ease",zIndex:1}},children:Q===0&&D===G&&y.jsx(ge,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:3,pointerEvents:"none"},children:y.jsx(p7,{})})},`resize-${G}`):null,ie=L=>{const G=x.current,{left:X,right:Q}=G.getBoundingClientRect(),Y=50,F=L.clientX>Q-Y?1:L.clientX<X+Y?-1:0;F!==0?(clearInterval(A),A=setInterval(()=>{G.scrollLeft+=F*10},50)):clearInterval(A)};return y.jsxs(y.Fragment,{children:[y.jsx(F0,{sx:{maxHeight:"100%",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem"},children:y.jsxs(N0,{ref:x,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:L=>L.palette.primary.notifyBackground},children:[y.jsxs(L0,{children:[y.jsx(As,{children:u.map((L,G)=>L!=null&&L.isHidden?null:y.jsxs(M.Fragment,{children:[z(L,G,b),w&&ne(L,G,b)]},G))}),y.jsx(As,{children:u.flatMap((L,G)=>L!=null&&L.isHidden||!(L!=null&&L.children)?[]:L.children.map((X,Q)=>X!=null&&X.isHidden?null:y.jsxs(M.Fragment,{children:[z(X,Q,b,L),w&&ne(X,Q,b,L)]},`${G}-${Q}`)))})]}),y.jsx(_0,{children:n.map((L,G)=>{const X=L[P],Q=_==null?void 0:_[X],Y=(Q==null?void 0:Q.length)>0;return y.jsxs(M.Fragment,{children:[y.jsx(As,{sx:{backgroundColor:F=>{var K;return e&&((K=e==null?void 0:e.selectedRow)==null?void 0:K.fhi)===(L==null?void 0:L.fhi)||L!=null&&L.isHigh?F.palette.primary.appBackground:F.palette.primary.notifyBackground}},onClick:()=>e==null?void 0:e.onRowClick(L),children:u.map((F,K)=>F!=null&&F.isHidden?null:F!=null&&F.children?F.children.map((oe,ce)=>oe!=null&&oe.isHidden?null:y.jsxs(M.Fragment,{children:[Z(oe,L,ce,F),w&&J(oe,ce,b,G,F)]},`${K}-${ce}`)):y.jsxs(M.Fragment,{children:[Z(F,L,K),w&&J(F,K,b,G)]},K))}),j&&Q&&y.jsx(y.Fragment,{children:Y?Q.map((F,K)=>y.jsx(As,{children:W.map((oe,ce)=>y.jsx(Sa,{style:oe==null?void 0:oe.style,children:y.jsx(Np,{isRenderCellContent:!!(oe!=null&&oe.cellRenderer),column:oe,row:F})},ce))},`nested-${K}`)):y.jsx(As,{children:y.jsx(Sa,{colSpan:W.length,children:y.jsx(To,{sx:{textAlign:"center"},children:qr.NRF})})})})]},G)})})]})}),r&&y.jsx(Q1,{pagination:r}),y.jsx(ew,{menuOpen:f==null?void 0:f.isOpen,handleClose:g,onHideClick:m})]})}rw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function ow({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r}){var u;const{columns:o}=e,{visibleGridColumns:i=[]}=M.useContext(ga)??{},a=M.useContext(ya),l=M.useMemo(()=>{var d;return u7({columns:o,gridPath:n,baseUrl:r,isDefaultConfig:t,pageSize:(d=e==null?void 0:e.pagination)==null?void 0:d.rowPerPage})},[o,n,r,t,(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage]),c=M.useMemo(()=>{const d=new Map(i.map(f=>[f.key,f]));return l.map(f=>{const p=d.get(f.key);return{...f,...p&&{isHidden:p.isHidden,sequenceId:p.sequenceId}}}).sort((f,p)=>f.sequenceId-p.sequenceId)},[l,i]);return M.useEffect(()=>{a({type:He.SET_GRID_DATA,payload:{visibleGridColumns:i.length?c:l}})},[l]),y.jsx(rw,{...e,gridPath:n,baseUrl:r})}ow.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const sw=({type:e})=>{const t=Nt(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:y.jsxs(ge,{sx:{borderRadius:2,overflow:"hidden"},children:[y.jsx(Sr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>y.jsx(ge,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>y.jsx(ge,{sx:{flex:1},children:y.jsx(Sr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:y.jsx(y.Fragment,{children:y.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[y.jsxs(dt,{direction:"row",gap:"1rem",children:[y.jsx(Sr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),y.jsxs(dt,{direction:"row",gap:"1rem",children:[y.jsx(Sr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},w7=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>y.jsx(ho,{...i}),select:i=>{var a;return y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:y.jsx(i1,{...i,options:t})})}};return o[r]?o[r](n):null},C7=({presentSetting:e,gridSetting:t,gridPath:n})=>{var a;if(!n)return e;const r=n.split("/").filter(Boolean),o=(a=t==null?void 0:t.grid)==null?void 0:a.map(({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f})=>({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f}));let i=e;for(let l=0;l<r.length;l++){const c=r[l];l===r.length-1?i[c]={columns:o,pageSize:(t==null?void 0:t.pageSize)??null}:(i[c]=i[c]||{},i=i[c])}return{settingObject:e,defaultUserSettings:o}},S7=async({baseUrl:e,gridSetting:t,gridPath:n})=>{try{const r=JSON.parse(localStorage.getItem("settings")),{settingObject:o,defaultUserSettings:i}=C7({presentSetting:r,gridSetting:t,gridPath:n});return localStorage.setItem("settings",JSON.stringify(o)),await Ip({baseUrl:e,payload:o}),i}catch(r){console.error(r)}},T7=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===G1.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)===G1.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},iw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=T7({customTools:e}),[i,a]=M.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 M.useEffect(()=>{c(t)},[e]),y.jsxs(y.Fragment,{children:[t&&y.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),y.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[y.jsx(Z3,{mode:"popLayout",children:i.map((d,f)=>y.jsx(Gi.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:y.jsx(ge,{sx:{flexShrink:0,minWidth:"fit-content"},children:w7(d)})},`${d.id}_${f}`))}),l&&y.jsx(ge,{sx:{paddingLeft:t?"0.5rem":0},children:y.jsx(ho,{label:t?"":"More Actions",styles:{icon:t?nt.CrossWhite:nt.More,colorType:t?"danger":""},onClick:u})})]})]})};iw.propTypes={customTools:s.array.isRequired};const aw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,managableColumns:i=[],pageSize:a})=>{var b,w,S,x,O,v;const l=M.useContext(ya),{visibleGridColumns:c,triggerApi:u}=M.useContext(ga),[d,f]=M.useState([]),[p,g]=M.useState(!1);M.useEffect(()=>{if(i.length){const E=i.length?c.filter(k=>i.includes(k.id)):c;f(E)}},[i,c]);const m=async E=>{try{await S7({baseUrl:r,gridPath:o,gridSetting:{grid:E,pageSize:a}})}catch(k){console.error(k)}finally{l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),l({type:He.TRIGGER_API,payload:{triggerApi:!1}})}};M.useEffect(()=>{u&&m(c)},[u]);const h=E=>{const k=E.map(R=>R.id),D=c.map(R=>{if(!d.some(I=>I.id===R.id))return R;const $=k.includes(R.id);if(Array.isArray(R.children)&&R.children.length>0){const I=R.children.map(j=>d.some(P=>P.id===j.id)?{...j,isHidden:$?!1:!k.includes(j.id)}:j),W=I.filter(j=>d.some(_=>_.id===j.id)).every(j=>j.isHidden);return{...R,isHidden:$?!1:W,children:I}}return{...R,isHidden:!k.includes(R.id)}});l({type:He.SET_GRID_DATA,payload:{visibleGridColumns:D}}),l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!0}})};return y.jsxs(ge,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[y.jsxs(ge,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((b=e==null?void 0:e.search)==null?void 0:b.isRequired)&&y.jsx(r1,{...e==null?void 0:e.search}),((w=e==null?void 0:e.groupBy)==null?void 0:w.isRequired)&&y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(wc,{styles:{icon:nt.Group},...e.groupBy})}),((S=e==null?void 0:e.refresh)==null?void 0:S.isRequired)&&y.jsx(ho,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:nt.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),t&&y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(wc,{placeholder:"Manage Columns",options:d,value:d.filter(E=>!E.isHidden),isMulti:!0,isDraggable:!0,showSearch:!0,onChange:h,styles:{icon:nt.Manage}})})]}),y.jsxs(ge,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&y.jsx(iw,{customTools:n,setIsExpanded:g,isExpanded:p}),((x=e==null?void 0:e.save)==null?void 0:x.isRequired)&&y.jsx(ge,{sx:{px:"0.5rem"},children:y.jsx(ho,{label:p?"":"Save",styles:{icon:nt.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&y.jsx(ho,{...e==null?void 0:e.upload,styles:{variant:p?"outlined":"filled",icon:p?nt.UploadDark:nt.Upload,colorType:"secondary",isAnimate:!0}}),((v=e==null?void 0:e.download)==null?void 0:v.isRequired)&&y.jsx(ho,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:nt.Download,isAnimate:!0}})]})]})};aw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function _p({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){var i,a;const o=(i=e.columns)==null?void 0:i.isManageable;return y.jsx(s1,{children:r?y.jsxs(y.Fragment,{children:[y.jsx(sw,{type:"toolbar"}),y.jsx(sw,{type:"grid"})]}):y.jsxs(ge,{sx:{position:"sticky"},children:[t&&y.jsx(aw,{...t,isManageable:o,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage}),y.jsx(ow,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||""})]})})}_p.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const lw=({list:e,handleLinkClick:t})=>{const n=Nt(),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?y.jsx($r,{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):y.jsx(et,{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 y.jsx(Fg,{separator:y.jsx(ge,{component:"img",src:nt.ArrowRight}),children:r({list:e})})};lw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const cw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n})=>{var o,i,a,l,c,u;const r=Nt();return y.jsxs(y.Fragment,{children:[y.jsxs(dt,{sx:{background:r.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 5.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[y.jsx(lw,{...e}),y.jsxs(dt,{direction:"row",gap:"1rem",alignItems:"center",children:[t&&y.jsx(u1,{...t}),(n==null?void 0:n.filterBtnProps)&&y.jsxs(dt,{direction:"row",children:[y.jsx(yi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:r.palette.primary.notifyBorderColor}}),y.jsxs(dt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(o=n==null?void 0:n.filterBtnProps)==null?void 0:o.onFilterClick,sx:{cursor:"pointer"},children:[y.jsx(ge,{component:"img",src:r.icons.filter}),y.jsx(et,{sx:{fontSize:"1.1rem",color:r.palette.primary.notifyActiveText},children:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.label})]})]})]})]}),y.jsx(Gi.div,{layout:!0,initial:{height:"0rem"},animate:{height:(a=n==null?void 0:n.filterBtnProps)!=null&&a.filterContainerVisible?"5rem":"0rem",opacity:(l=n==null?void 0:n.filterBtnProps)!=null&&l.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:r.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden"},children:y.jsxs(dt,{sx:{background:r.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[y.jsx(et,{sx:{fontSize:"1.2rem",fontWeight:"500",color:r.palette.primary.notifyActiveText},children:"Filters:"}),y.jsx(ge,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:y.jsx(dt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(c=n==null?void 0:n.filterItems)==null?void 0:c.map((d,f)=>y.jsx(y.Fragment,{children:y.jsxs(ge,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,background:r.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[y.jsx(ge,{component:"img",src:nt.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(d)}),y.jsx(et,{sx:{fontSize:"1rem",color:r.palette.primary.notifyTextColor},children:d==null?void 0:d.filterLabel})]},f)}))})}),y.jsx(ge,{component:et,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:r.palette.brandColor.red,cursor:"pointer"},onClick:(u=n==null?void 0:n.filterContainerProps)==null?void 0:u.onClearClick,children:"Clear"})]})})]})};cw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function uw({headerProps:e}){return y.jsx(_n,{children:y.jsx(cw,{...e})})}uw.propTypes={headerProps:s.object.isRequired};const Fp=M.createContext(null),dw=M.createContext(null);function O7({children:e}){const[t,n]=M.useReducer(E7,k7);return y.jsx(Fp.Provider,{value:t,children:y.jsx(dw.Provider,{value:n,children:e})})}function E7(e,t){var n;switch(t.type){case He.LOADING:return{...e,loading:t.loading};case He.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case He.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case He.ERROR:return{...e,error:t.error};default:throw new Error(`${qr.UNHANDLED}: ${t}`)}}const k7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:Bp,BU_ID:Lp,SNOP_ID:fw}=Pp,{TENANT_IDS:Vp,BU_IDS:Wp}=Is,P7=async e=>{try{const t=`${e}${jc.NOTIFICATION}/v1?${Bp}=${Vp}&${Lp}=${Wp}`;return await St.get(t,Ca)}catch(t){return t}},pw=async(e,t,n)=>{try{const r=n===Y1.MARK_ALL_READ?"":`&${fw}=${n}&`,o=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${Bp}=${Vp}&${Lp}=${Wp}${r}`;return await St.put(o,t,Ca)}catch(r){return r}},M7=async({baseUrl:e,id:t,snopId:n})=>{try{const r=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${Bp}=${Vp}&${Lp}=${Wp}&${fw}=${n}&id=${t}`;return await St.get(r,Ca)}catch(r){return r}},$c={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},hw=({baseUrl:e})=>{const t=M.useContext(dw),[n,r]=M.useState(!1),[o,i]=M.useState(!1),[a,l]=M.useState(!1),[c,u]=M.useState({}),[d,f]=M.useState(null),[p,g]=M.useState(1),[m,h]=M.useState(!1),[b,w]=M.useState(0),{loading:S,data:x,isMarkAllAsRead:O}=M.useContext(Fp),[v,E]=M.useState([]);M.useEffect(()=>{E(x)},[x]);const k=M.useCallback(async()=>{var j,_;try{t({type:He.LOADING,loading:!0}),t({type:He.SUCCESS,data:[]});const P=await P7(e);if(P.status===$c.OK){const N=((_=(j=P.data)==null?void 0:j.responseData)==null?void 0:_.response)||[],B=xc(N);t({type:He.SUCCESS,data:xc(B)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:o1(N),boo:o1(N)>0}})}}catch{t({type:He.ERROR,error:qr.SWR})}finally{t({type:He.LOADING,loading:!1})}},[e,t]);M.useEffect(()=>{k();const j=setInterval(k,3e5);return()=>clearInterval(j)},[k]);const D=async(j,_)=>{var P,N,B;if(j){f(j);try{const H=await M7({baseUrl:e,id:j,snopId:_});if(H.status===$c.OK){const V=((B=(N=(P=H.data)==null?void 0:P.responseData)==null?void 0:N.response)==null?void 0:B[0])||{};u(V||{}),l(!0)}else throw new Error}catch{t({type:He.ERROR,error:qr.SWR})}finally{f(null)}}},R=async(j,_)=>{if(j.length){t({type:He.LOADING,loading:!0});try{if((await pw(e,j,_)).status===$c.OK){const N=x.map(H=>j.includes(H.id)?{...H,isRead:!0}:H),B=N.filter(H=>!H.isRead).length;t({type:He.SUCCESS,data:xc(N)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:B,boo:B>0}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:qr.SWR}),t({type:He.LOADING,loading:!1})}}},A=async()=>{t({type:He.LOADING,loading:!0});try{const j=cV(x);if((await pw(e,j,Y1.MARK_ALL_READ)).status===$c.OK){const P=x.map(N=>({...N,isRead:!0}));t({type:He.SUCCESS,data:xc(P)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:qr.SWR}),t({type:He.LOADING,loading:!1})}},$=(j,_)=>{t({type:He.LOADING,loading:!0}),w(_),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)},I=j=>{const _=j||x||[];return{0:_,1:_.filter(P=>(P==null?void 0:P.type)==="INFO"),2:_.filter(P=>(P==null?void 0:P.type)==="ERROR")}},W=()=>{t({type:He.LOADING,loading:!0});const j=!m,_=j?(v||[]).filter(P=>!P.isRead):x||[];h(j),E(_),g(1),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)};return{fetchNotification:k,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:k,handleRead:R,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:D,clickId:d,isMainDialog:!0},activeTab:b,loading:S,tabData:I(v)[b],data:v,mode:m,handleTabChange:$,toggleAlertMode:W,page:p,setPage:g,isMarkAllAsRead:O}};var mw,gw,yw;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 R7=function(t){return C.createElement("svg",zp({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),mw||(mw=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"})),gw||(gw=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"})),yw||(yw=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 D7=({count:e})=>(Nt(),y.jsxs(y.Fragment,{children:[y.jsx(ge,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:y.jsx(R7,{style:{scale:2}})}),y.jsx(y7,{badgeContent:e!=0?"":null,color:"error"})]}));function bw({children:e,handleClose:t,open:n,isMainDialog:r}){return y.jsx(Ol,{open:n,onClose:t,...r?{scroll:"paper",PaperProps:{sx:{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}}}:{fullWidth:!0,maxWidth:"md",sx:{"& .MuiPaper-root":{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}}},children:e})}var vw;function Up(){return Up=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},Up.apply(null,arguments)}var I7=function(t){return C.createElement("svg",Up({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),vw||(vw=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"})))},xw,ww;function Hp(){return Hp=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},Hp.apply(null,arguments)}var A7=function(t){return C.createElement("svg",Hp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),xw||(xw=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"})),ww||(ww=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"})))},Cw;function qp(){return qp=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},qp.apply(null,arguments)}var j7=function(t){return C.createElement("svg",qp({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Cw||(Cw=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 Sw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i})=>{var c,u;const a=Nt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return y.jsxs(ge,{className:"cards",sx:{pt:" 0.8rem"},children:[y.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:y.jsx(Qu,{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:y.jsx(To,{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})})}),y.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:y.jsxs(dt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&y.jsx(Nc,{icon:y.jsx(A7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?y.jsx(Tl,{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)&&y.jsx(Nc,{icon:y.jsx(j7,{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)&&y.jsx(Nc,{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)&&y.jsx(Nc,{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"})]})}),y.jsxs(dt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[y.jsx(To,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),y.jsx(To,{color:a.palette.primary.notifyTextColor,children:"•"}),y.jsx(To,{sx:{fontSize:"0.8rem"},children:lV(t==null?void 0:t.createdAt)})]})]})};Sw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Tw=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=M.useContext(Fp),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,f]=M.useState([]),[p,g]=M.useState(!1),[m,h]=M.useState(!0),b=M.useRef(null),w=async x=>{g(!0);const O=e.slice((x-1)*10,x*10);await new Promise(v=>setTimeout(v,1e3)),f(v=>{const E=O.filter(k=>!v.some(D=>D.id===k.id));return[...v,...E]}),g(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&h(!1)};M.useEffect(()=>{var O;let x=[];o?l!=null&&l.count?x=(O=e==null?void 0:e.filter(v=>!v.isRead))==null?void 0:O.slice(0,10):x=[]:x=e.slice(0,10),(x==null?void 0:x.length)<10&&h(!1),f(x)},[e,o,l]),M.useEffect(()=>{m&&i!==1&&w(i)},[i,e]),M.useEffect(()=>{f([...e])},[e]),M.useEffect(()=>{const x=new IntersectionObserver(O=>{O[0].isIntersecting&&!p&&m&&a(v=>v+1)},{threshold:1});return b.current&&x.observe(b.current),()=>{b.current&&x.unobserve(b.current)}},[p,m]);const S=({redirect:x,isClicked:O,url:v})=>{window.open(v,"_blank")};return y.jsxs(ge,{sx:{width:"100%"},children:[Object.entries(uV(d)).map(([x,O])=>y.jsxs(M.Fragment,{children:[x!==u&&y.jsx(g7,{children:x}),O.map((v,E)=>y.jsx(M.Fragment,{children:y.jsx(Sw,{item:v,handleCTAClicked:S,handleShowDetails:()=>n(v.id,v.snopId),handleRead:()=>t([v.id],v.snopId),clickId:r})},`${E}_${v.id}`))]},x)),p&&i>1&&!!(d!=null&&d.length)&&y.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:y.jsx(Tl,{size:20,sx:{color:x=>x.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&y.jsx(et,{sx:{fontSize:"1.1rem",color:x=>x.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."}),y.jsx(ge,{ref:b,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Tw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const N7=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o})=>{var m,h,b,w;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:f,handleTabChange:p,toggleAlertMode:g}=hw({});return y.jsxs(y.Fragment,{children:[y.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[y.jsx(et,{variant:"h2",sx:{fontSize:"1.2rem",color:S=>S.palette.primary.notifyTextColor},children:"Notifications"}),y.jsx(ge,{component:"img",src:nt.Refresh,alt:"refresh",onClick:e,sx:{cursor:"pointer"}})]}),y.jsx(ge,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:S=>S.palette.primary.notifyBorderColor},children:y.jsxs(b7,{value:a,onChange:p,children:[y.jsx($p,{label:y.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",y.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((m=l==null?void 0:l.filter(S=>!(S!=null&&S.isRead)))==null?void 0:m.length)||0}),")"]})}),y.jsx($p,{label:y.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",y.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((h=l==null?void 0:l.filter(S=>(S==null?void 0:S.type)==="INFO"&&!(S!=null&&S.isRead)))==null?void 0:h.length)||0}),")"]}),sx:{color:S=>S.palette.brandColor.blue}}),y.jsx($p,{label:y.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",y.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((b=l==null?void 0:l.filter(S=>(S==null?void 0:S.type)==="ERROR"&&!(S!=null&&S.isRead)))==null?void 0:b.length)||0}),")"]}),sx:{color:S=>S.palette.brandColor.red}})]})}),y.jsx(kl,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:S=>S.palette.primary.notifyBorderColor},tabIndex:-1,children:i?y.jsx(Tl,{size:30,sx:{color:S=>S.palette.primary.notifyIconColor}}):y.jsx(y.Fragment,{children:y.jsx(Tw,{data:c,handleShowDetails:t,handleRead:r,clickId:n,page:d,setPage:f,mode:u})})}),y.jsxs(El,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[y.jsxs(dt,{direction:"row",gap:1,children:[y.jsx(To,{sx:{fontSize:"1rem"},children:"Only show unread"}),y.jsx(m7,{disabled:i,checked:u,onChange:g})]}),y.jsx(Un,{variant:"outlined",className:"view-all",onClick:o,startIcon:y.jsx(I7,{}),disabled:!((w=l==null?void 0:l.filter(S=>!(S!=null&&S.isRead)))!=null&&w.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:S=>S.palette.primary.notifyTextColor,"&:hover":{color:S=>S.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:S=>`${S.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},$7=({data:e,handleClose:t})=>{var S;const[n,r]=M.useState(1),[o,i]=M.useState(10),[a,l]=M.useState(((S=e==null?void 0:e.notificationDetails)==null?void 0:S.length)||0),[c,u]=M.useState("sku_name"),[d,f]=M.useState("asc"),[p,g]=M.useState(""),m=["sku_name","node","channel_name"],h=M.useMemo(()=>!(e!=null&&e.notificationDetails)||!m.length?[]:p.trim()?e.notificationDetails.filter(x=>m.some(O=>{var v;return(v=x[O])==null?void 0:v.toString().toLowerCase().includes(p.toLowerCase())})):e.notificationDetails,[e,p,m]),b=M.useMemo(()=>c?[...h].sort((x,O)=>{const v=x[c],E=O[c];return v==null?1:E==null?-1:typeof v=="number"&&typeof E=="number"?d==="asc"?v-E:E-v:!isNaN(Date.parse(v))&&!isNaN(Date.parse(E))?d==="asc"?new Date(v).getTime()-new Date(E).getTime():new Date(E).getTime()-new Date(v).getTime():d==="asc"?v.toString().localeCompare(E.toString()):E.toString().localeCompare(v.toString())}):h,[h,c,d]),w=M.useMemo(()=>{const x=(n-1)*o,O=x+o;return b.slice(x,O)},[b,n,o]);return y.jsxs(y.Fragment,{children:[y.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:x=>x.palette.primary.notifyBorderColor},children:[y.jsx(et,{component:"h2",sx:{fontSize:"1.4rem",color:x=>x.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),y.jsx(ge,{component:"img",src:nt.CloseCircle,onClick:t,sx:{cursor:"pointer"}})]}),y.jsx(kl,{children:y.jsx(_p,{tableProps:{data:w,columns:{...f7(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:x=>{var v;const O=(v=x==null?void 0:x.column)==null?void 0:v.key;f(E=>c===O&&E==="asc"?"desc":"asc"),u(O)}},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=>{g(x.target.value)},placeholder:"Search..."}}}})}),y.jsx(El,{sx:{padding:"1.5rem 2rem"}})]})},_7=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:r,isMarkAllAsRead:o}=hw({baseUrl:e});return y.jsxs(y.Fragment,{children:[y.jsx(ge,{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:y.jsx(D7,{count:o.count})}),y.jsx(bw,{...t,children:y.jsx(N7,{...t})}),y.jsx(bw,{...n,children:y.jsx($7,{...n})})]})},F7=({baseUrl:e})=>y.jsx(_n,{children:y.jsx(O7,{children:y.jsx(_7,{baseUrl:e})})}),B7=({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=Nt();return y.jsx(ge,{sx:{position:"relative",overflow:"hidden"},children:y.jsxs(io,{container:!0,sx:{height:"100%"},children:[y.jsx(io,{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&&y.jsxs(y.Fragment,{children:[y.jsx(ge,{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"}}),y.jsx(ge,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"transparent",zIndex:4}})]}),e&&y.jsxs(io,{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:[y.jsxs(dt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:g=>`0.1rem solid ${g.palette.primary.notifyBorderColor}`},children:[!u&&f&&y.jsxs(y.Fragment,{children:[y.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l,children:y.jsx(ge,{component:"img",src:nt.Merge})}),y.jsx(yi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),y.jsxs(dt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[y.jsxs(dt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[y.jsx(ge,{component:"img",src:p.icons.close}),y.jsx(et,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),y.jsx(dt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&y.jsx(ge,{onClick:c,sx:{cursor:"pointer"},children:y.jsx(ge,{component:"img",src:u?nt.Collapse:nt.Expand})})})]})]}),y.jsx(ge,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Ow=({layoutChildren:e,layoutProps:t})=>y.jsx(_n,{children:y.jsx(B7,{...e,...t})});Ow.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},vt.Button=ho,vt.Checkbox=rc,vt.DatePicker=iV,vt.Grid=_p,vt.Header=uw,vt.InputField=r1,vt.Loader=DV,vt.Notification=F7,vt.Select=i1,vt.SliderLayout=Ow,vt.Switch=u1,vt.TextField=bc,vt.ToastProvider=EV,vt.toast=CV,Object.defineProperty(vt,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=Co(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Ic.assertOptions(r,{silentJSONParsing:hr.transitional(hr.boolean),forcedJSONParsing:hr.transitional(hr.boolean),clarifyTimeoutError:hr.transitional(hr.boolean)},!1),o!=null&&(te.isFunction(o)?n.paramsSerializer={serialize:o}:Ic.assertOptions(o,{encode:hr.function,serialize:hr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ic.assertOptions(n,{baseUrl:hr.spelling("baseURL"),withXsrfToken:hr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&te.merge(i.common,i[n.method]);i&&te.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=mn.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,l.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,p;if(!c){const m=[z1.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,u),p=m.length,d=Promise.resolve(n);f<p;)d=d.then(m[f++],m[f++]);return d}p=l.length;let g=n;for(f=0;f<p;){const m=l[f++],h=l[f++];try{g=m(g)}catch(b){h.call(this,b);break}}try{d=z1.call(this,g)}catch(m){return Promise.reject(m)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Co(this.defaults,t);const n=j1(t.baseURL,t.url,t.allowAbsoluteUrls);return O1(n,t.params,t.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(t){So.prototype[t]=function(n,r){return this.request(Co(r||{},{method:t,url:n,data:(r||{}).data}))}}),te.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(Co(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}So.prototype[t]=n(),So.prototype[t+"Form"]=n(!0)});let J8=class kw{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 Ds(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 kw(function(o){t=o}),cancel:t}}};function Q8(e){return function(n){return e.apply(null,n)}}function e7(e){return te.isObject(e)&&e.isAxiosError===!0}const Op={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(Op).forEach(([e,t])=>{Op[t]=e});function q1(e){const t=new So(e),n=d1(So.prototype.request,t);return te.extend(n,So.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return q1(Co(e,o))},n}const St=q1(xa);St.Axios=So,St.CanceledError=Ds,St.CancelToken=J8,St.isCancel=R1,St.VERSION=U1,St.toFormData=Ec,St.AxiosError=Ue,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=Q8,St.isAxiosError=e7,St.mergeConfig=Co,St.AxiosHeaders=mn,St.formToJSON=e=>P1(te.isHTMLForm(e)?new FormData(e):e),St.getAdapter=W1.getAdapter,St.HttpStatusCode=Op,St.default=St;const{Axios:_W,AxiosError:FW,CanceledError:BW,isCancel:LW,CancelToken:VW,VERSION:WW,all:zW,Cancel:UW,isAxiosError:HW,spread:qW,toFormData:YW,AxiosHeaders:GW,HttpStatusCode:KW,formToJSON:XW,getAdapter:ZW,mergeConfig:JW}=St,Ep={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"};/*! js-cookie v3.0.5 | MIT */function Ac(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 t7={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function kp(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Ac({},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,"",Ac({},i,{expires:-1}))},withAttributes:function(o){return kp(this.converter,Ac({},this.attributes,o))},withConverter:function(o){return kp(Ac({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var n7=kp(t7,{path:"/"});const Yr={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Pp={BEARER:"Bearer",TENANT_ID:"tenant_id",BU_ID:"bu_id",SNOP_ID:"snop_id"},r7=[10,25,50,100],Y1={MARK_ALL_READ:"MARK_ALL_READ"},o7=r7.map(e=>({label:e,value:e})),G1={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},Mp=vc(Yr.SNOP),Rp=vc(Yr.SELECTED_BU),Dp=vc(Yr.USER),s7=vc(Yr.SETTINGS),Is={BU_IDS:Rp==null?void 0:Rp.business_unit_id,TOKEN:JSON.parse(n7.get(Yr.TOKEN)||null),TENANT_IDS:Dp==null?void 0:Dp.tenant_id,SNOP_IDS:Mp==null?void 0:Mp.snop_id,GRID_SETTINGS:s7},Ca={headers:{"Content-Type":"application/json",Authorization:`${Pp.BEARER} ${Is.TOKEN}`}},K1=St.create({baseURL:Ep.BASE_URL,axiosConfig:Ca});K1.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),K1.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const jc={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"},{TENANT_ID:i7,BU_ID:a7}=Pp,{TENANT_IDS:l7,BU_IDS:c7}=Is,Ip=async({baseUrl:e,payload:t})=>{try{const n=`${e}${jc.SETTING}/v1?${i7}=${l7}&${a7}=${c7}`;return await St.post(n,t,Ca)}catch(n){return n}},u7=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o})=>{var m;let{definitions:i,defaultUserSettings:a,labels:l}=e;const c=t.split("/").filter(Boolean);let u=c.reduce((h,b)=>h==null?void 0:h[b],Is.GRID_SETTINGS)||null;r||!u&&!a&&(async()=>{try{a=X1({definitions:i});const b={...Is.GRID_SETTINGS||{platform:{theme:"light"}}},w=(u==null?void 0:u.pageSize)??o;let S=b;for(let x=0;x<c.length;x++){const O=c[x];x===c.length-1?S[O]={columns:updatedColumns,pageSize:w}:(S[O]={...S[O]||{}},S=S[O])}localStorage.setItem(Yr.SETTINGS,JSON.stringify(b)),await Ip({baseUrl:n,payload:b})}catch(h){console.error(h)}})(),a=(u==null?void 0:u.columns)??a??X1({definitions:i});const d=a.reduce((h,b)=>(h[b.id]=b,h),{}),f=l.reduce((h,b)=>(h[b.id]=b,h),{}),p=[];for(const h of i){const b=d[h.id]||{},w=f[h.id]||{};let S={...h,...b,...w};if((m=h.children)!=null&&m.length){const x=b.children||[],O=w.children||[];S.children=h.children.map((v,E)=>({...v,...x[E],...O[E]}))}p.push(S)}return p.sort((h,b)=>h.sequenceId-b.sequenceId)},d7=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),X1=({definitions:e})=>e.map((t,n)=>({id:t.id,key:t.key,sequenceId:t.id,isHidden:!1,style:t.style||{}})),f7=()=>({definitions:[{id:1,key:"sku_name",isSortable:!0,isMandatory:!0},{id:2,key:"node",isSortable:!0,isMandatory:!0},{id:3,key:"channel_name",isSortable:!0,isMandatory:!0}],defaultUserSettings:[{id:1,key:"sku_name",sequenceId:1,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:2,key:"node",sequenceId:2,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}},{id:3,key:"channel_name",sequenceId:3,isHidden:!1,style:{width:"20rem",minWidth:"20rem",maxWidth:"20rem"}}],labels:[{id:1,key:"sku_name",label:"SKU",isLocalizable:!1},{id:2,key:"node",label:"Node",isLocalizable:!1},{id:3,key:"channel_name",label:"Channel",isLocalizable:!1}]});class Ap extends M.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=M.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)"),M.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})}}Ap.defaultProps={disabled:!1,minWidth:0,className:""},Ap.propTypes={disabled:"boolean",minWidth:"number",className:"string"};var Z1,J1;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 p7=function(t){return C.createElement("svg",jp({xmlns:"http://www.w3.org/2000/svg",width:17,height:7,fill:"none"},t),Z1||(Z1=C.createElement("path",{fill:"#0582CA",d:"M4.652.5.676 3.493l3.976 2.981V4.051h8.354V2.859H4.652z"})),J1||(J1=C.createElement("path",{fill:"#0582CA",d:"M12.36.5v2.384H4.008v1.193h8.352v2.396l.956-.716 3.022-2.265z"})))};const h7=(e,t,n,r,o)=>{const[i,a]=M.useState({isOpen:!1,column:null}),l=(f,p,g)=>{a({isOpen:f.currentTarget,column:p,isChild:!!g})},c=()=>{a({isOpen:!1,column:null,isChild:!1})},u=async()=>{c();const f=e.map(p=>{var g;if(i!=null&&i.isChild&&Array.isArray(p.children)){const m=p.children.map(b=>b.id===i.column.id?{...b,isHidden:!0}:b),h=m.every(b=>b.isHidden);return{...p,isHidden:h?!0:p.isHidden,children:m}}return p.id===((g=i==null?void 0:i.column)==null?void 0:g.id)?{...p,isHidden:!0}:p});d({updatedColumns:f})},d=async({updatedColumns:f})=>{t({type:He.SET_GRID_DATA,payload:{visibleGridColumns:f}});const p=r.split("/").filter(Boolean),h={...JSON.parse(localStorage.getItem(Yr.SETTINGS))||{platform:{theme:"light"}}},b=p.reduce((x,O)=>x==null?void 0:x[O],Is.GRID_SETTINGS)||null,w=(b==null?void 0:b.pageSize)??o;let S=h;for(let x=0;x<p.length;x++){const O=p[x];x===p.length-1?S[O]={columns:f,pageSize:w}:(S[O]={...S[O]||{}},S=S[O])}localStorage.setItem(Yr.SETTINGS,JSON.stringify(h)),await Ip({baseUrl:n,payload:h})};return{selectedColumn:i,handleMenuClick:l,handleClose:c,handleHideClick:u,columnUpdaterFunction:d}},Q1=({pagination:e})=>{const{selectedPage:t,rowPerPage:n,totalRecords:r,onPageChange:o,onPageSizeChange:i}=e,a=Nt();return y.jsxs(ge,{sx:{display:"flex",p:"1rem 2rem"},children:[y.jsxs(ge,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[y.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:`Showing ${(t-1)*n+1} to ${Math.min(t*n,r)} of ${r} rows`}),y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:y.jsx(wc,{options:o7,value:n,onChange:i})}),y.jsx(et,{sx:{fontSize:"1.1rem",color:a.palette.primary.notifyTextColor},children:"records per page"})]}),y.jsx(C0,{count:Math.ceil(r/n),page:t,onChange:(l,c)=>{o(c)},shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginRight:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"},"& li:last-child":{border:`0.1rem solid ${a.palette.primary.notifyBorderColor}`,color:a.palette.primary.notifyActiveText,marginLeft:"1.5rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex"}},"& .MuiPaginationItem-root":{color:"#595959",fontSize:"1.1rem",borderRadius:"1rem",width:"3rem",height:"3rem",justifyContent:"center",alignItems:"center",display:"flex","& .MuiSvgIcon-root":{fontSize:"2.2rem"}},"& .Mui-selected":{color:a.palette.primary.notifyActiveText,backgroundColor:`${a.palette.brandColor.paginationBc} !important`}}})]})};Q1.propTypes={pagination:s.object.isRequired};function Np({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key];return y.jsx(y.Fragment,{children:e?y.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t==null?void 0:t.cellRenderer(n,{column:t,parent:r})}):y.jsx(D0,{title:(o==null?void 0:o.length)>20?o:"",arrow:!0,children:y.jsx(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},id:t.key,component:"label",children:dV(o)})})})}Np.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object};const ew=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=Nt();return y.jsx(Si,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:y.jsx(ge,{sx:{p:"0.4rem 1rem",backgroundColor:r.palette.primary.notifyBackground,border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,minHeight:"2.3rem",display:"flex",justifyContent:"center",alignItems:"center"},children:y.jsx(Un,{onClick:n,sx:{textTransform:"none",fontSize:"1.1rem",p:0,minHeight:"unset",fontWeight:"500",color:r.palette.primary.notifyTextColor,"&:hover":{background:"none"}},children:"Hide Column"})})})};ew.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func},q(Ol)(({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 To=q(et)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),m7=q(I0)(({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)"})}})),g7=q(yi)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),y7=q(Qu)(({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"}}));q($l)(({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 b7=q(X0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),$p=q(A0)(({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}})),Nc=q(Xu)(({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`}})),tw=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>y.jsx(Rr,{onClick:r,sx:{padding:"0.5rem"},children:y.jsx(ge,{component:"img",src:i})});return y.jsx(y.Fragment,{children:o(t===e?n==="asc"?nt.AscSort:nt.DescSort:nt.Unsort)})};tw.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function nw({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=t==null?void 0:t.isMandatory,a=t==null?void 0:t.label,l=t==null?void 0:t.isSortable,c=n==null?void 0:n.sortField,u=n==null?void 0:n.sortDir,d=n==null?void 0:n.onSort;return y.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",textAlign:"center",whiteSpace:"normal"},children:[a,y.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[l&&y.jsx(tw,{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})}),o&&!i&&y.jsx(Rr,{onClick:f=>r(f,t,e),sx:{padding:"0.5rem"},children:y.jsx(ge,{component:"img",src:nt.Menu})})]})]})}nw.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};const v7=q(yd)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${gd.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"},[`&.${gd.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0.3rem 1rem",textAlign:"center"}}));function Sa({children:e,...t}){return y.jsx(v7,{...t,children:e})}Sa.propTypes={children:s.node};const x7=q(z0)(()=>({"&:last-child td":{borderBottom:0}}));function As({children:e,...t}){return y.jsx(x7,{...t,children:e})}As.propTypes={children:s.node};function rw({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l}){var ee;const c=Nt(),{visibleGridColumns:u}=M.useContext(ga),d=M.useContext(ya),{selectedColumn:f,handleMenuClick:p,handleClose:g,handleHideClick:m,columnUpdaterFunction:h}=h7(u,d,a,l,r==null?void 0:r.rowPerPage),b=o==null?void 0:o.isManageable,w=o==null?void 0:o.isResizable,S=(n==null?void 0:n.length)>0,x=M.useRef(null),[O,v]=M.useState(null),[E,k]=M.useState(null),[D,R]=M.useState(null);let A=null;const $=M.useRef(0),I=M.useRef(!1),W=d7(((ee=i==null?void 0:i.column)==null?void 0:ee.definitions)||[]),j=i==null?void 0:i.isNested,_=(i==null?void 0:i.data)||[],P=i==null?void 0:i.hashKey;if(!S)return y.jsx(To,{sx:{textAlign:"center"},children:qr.NRF});M.useEffect(()=>{if(!S)return;const L=x.current;if(!L)return;const G=L==null?void 0:L.querySelector("thead");if(!G)return;const X=()=>{R(null)};return G==null||G.addEventListener("mouseleave",X),()=>{G==null||G.removeEventListener("mouseleave",X)}},[]);const N=(L,G)=>{var oe,ce;if(I.current){L.preventDefault();return}v(G),R(null),L.dataTransfer.setData("colIndex",G);const X=u[G],Q=X==null?void 0:X.label,Y=document.createElement("div");Y.textContent=Q,Object.assign(Y.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:(oe=X==null?void 0:X.style)==null?void 0:oe.minWidth,maxWidth:(ce=X==null?void 0:X.style)==null?void 0:ce.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:c.palette.primary.notifyTextColor,background:c.palette.primary.notifyBackground,border:`0.1rem solid ${c.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(Y);const{offsetWidth:F,offsetHeight:K}=Y;L.dataTransfer.setDragImage(Y,F/2,K/2),requestAnimationFrame(()=>{document.body.removeChild(Y)})},B=(L,G)=>{L.preventDefault(),k(G),ie(L)},H=async(L,G)=>{if(L.preventDefault(),clearInterval(A),O===null||O===G)return;const X=[...u],[Q]=X.splice(O,1);X.splice(G,0,Q);const Y=u.slice().sort((K,oe)=>K.sequenceId-oe.sequenceId).map(K=>K.sequenceId),F=X.map((K,oe)=>({...K,sequenceId:Y[oe]??K.sequenceId}));h({updatedColumns:F}),v(null),k(null)},V=()=>{v(null),k(null)},z=(L,G,X,Q)=>{var ae,Ce,me,ye,_e,je,Re;if(!L)return null;const Y=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),F=parseFloat((Ce=(ae=L==null?void 0:L.style)==null?void 0:ae.minWidth)==null?void 0:Ce.toString().replace("rem",""))||7.5;G===0&&($.current=0);const K=Y?G===0?0:`${$.current}rem`:void 0;Y&&($.current+=F);const oe=O===G,ce=E==G||((me=u==null?void 0:u[E])==null?void 0:me.isMandatory),de=Ee=>{L.isMandatory?(Ee.preventDefault(),Ee.dataTransfer.dropEffect="none"):(Ee.preventDefault(),Ee.dataTransfer.dropEffect="move"),B==null||B(Ee,G)},we=Ee=>{L.isMandatory||H==null||H(Ee,G)};return y.jsx(Sa,{rowSpan:L!=null&&L.children?1:2,colSpan:w?((_e=(ye=L==null?void 0:L.children)==null?void 0:ye.filter(Ee=>!(Ee!=null&&Ee.isHidden)))==null?void 0:_e.length)*2-1:(Re=(je=L==null?void 0:L.children)==null?void 0:je.filter(Ee=>!(Ee!=null&&Ee.isHidden)))==null?void 0:Re.length,style:L==null?void 0:L.style,onMouseEnter:()=>{D!==G&&R(G)},draggable:X&&!Q&&!(L!=null&&L.isMandatory),onDragStart:X?Ee=>N(Ee,G):void 0,onDragOver:X?de:void 0,onDrop:X?we:void 0,onDragEnd:X?V:void 0,sx:{...oe&&{border:`0.1rem solid ${c.palette.brandColor.lightBlue}!important`},...Y&&{borderRadius:"0rem!important",position:"sticky",left:K,zIndex:3},...!(L!=null&&L.children)&&{borderLeft:Ee=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${Ee.palette.primary.notifyBorderColor}`,borderRight:Ee=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${Ee.palette.primary.notifyBorderColor}`},cursor:ce?"not-allowed":X&&!(L!=null&&L.isMandatory)?"grab":"default"},children:y.jsx(nw,{parent:Q,column:L,sort:t,handleMenuClick:p,isManageable:X})},G)},Z=(L,G,X,Q)=>{var oe,ce,de;if(!L)return null;const Y=(L==null?void 0:L.isMandatory)&&(L==null?void 0:L.isSticky),F=parseFloat((ce=(oe=L==null?void 0:L.style)==null?void 0:oe.minWidth)==null?void 0:ce.toString().replace("rem",""))||7.5;X===0&&($.current=0);const K=Y?X===0?0:`${$.current}rem`:void 0;return Y&&($.current+=F),y.jsxs(Sa,{colSpan:1,style:L==null?void 0:L.style,className:`${L==null?void 0:L.label}`,sx:{position:"relative",...Y&&{position:"sticky",left:K,zIndex:2,backgroundColor:we=>{var ae;return((ae=e==null?void 0:e.selectedRow)==null?void 0:ae.fhi)===(G==null?void 0:G.fhi)||G!=null&&G.isHigh?we.palette.primary.appBackground:we.palette.primary.notifyBackground}},...Q?{p:"0rem!important"}:{px:"0rem!important",borderLeft:we=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${we.palette.primary.notifyBorderColor}`,borderRight:we=>(L==null?void 0:L.key)==="volume_value"&&`0.1rem solid ${we.palette.primary.notifyBorderColor}`}},children:[((e==null?void 0:e.selectedRow)&&((de=e==null?void 0:e.selectedRow)==null?void 0:de.fhi)===(G==null?void 0:G.fhi)||(G==null?void 0:G.isHigh))&&y.jsx(ge,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.05rem",background:"linear-gradient(#F9B16E, #F68080)"}}),y.jsx(Np,{isRenderCellContent:!!(L!=null&&L.cellRenderer),column:L,row:G,parent:Q})]},X)},ne=(L,G,X,Q)=>L&&!(L!=null&&L.isMandatory)&&X?y.jsx(ge,{resizeStart:()=>{I.current=!0},resizeEnd:()=>{I.current=!1},component:Ap,rowSpan:L!=null&&L.children?1:2,colSpan:1,id:G,sx:{width:"2rem",maxWidth:"2rem",minWidth:"2rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:0,transform:"translateX(-50%)",width:"0.15rem",height:"calc(100% + 0.1rem)",backgroundColor:D===G?c.palette.brandColor.lightBlue:Q||L!=null&&L.children?c.palette.primary.notifyBorderColor:"transparent",transition:"background-color 0.2s ease",zIndex:1}},disabled:!X}):null,J=(L,G,X,Q,Y)=>L&&!(L!=null&&L.isMandatory)&&X?y.jsx(yd,{className:"column_resizer_body",sx:{padding:0,position:"relative",borderBottom:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,"&::after":{content:'""',position:"absolute",left:"50%",top:0,transform:"translateX(-50%)",width:"0.15rem",height:"calc(100% + 0.1rem)",backgroundColor:D===G?c.palette.brandColor.lightBlue:Y||L!=null&&L.children?c.palette.primary.notifyBorderColor:"transparent",transition:"background-color 0.2s ease",zIndex:1}},children:Q===0&&D===G&&y.jsx(ge,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:3,pointerEvents:"none"},children:y.jsx(p7,{})})},`resize-${G}`):null,ie=L=>{const G=x.current,{left:X,right:Q}=G.getBoundingClientRect(),Y=50,F=L.clientX>Q-Y?1:L.clientX<X+Y?-1:0;F!==0?(clearInterval(A),A=setInterval(()=>{G.scrollLeft+=F*10},50)):clearInterval(A)};return y.jsxs(y.Fragment,{children:[y.jsx(F0,{sx:{maxHeight:"100%",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${c.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem"},children:y.jsxs(N0,{ref:x,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:L=>L.palette.primary.notifyBackground},children:[y.jsxs(L0,{children:[y.jsx(As,{children:u.map((L,G)=>L!=null&&L.isHidden?null:y.jsxs(M.Fragment,{children:[z(L,G,b),w&&ne(L,G,b)]},G))}),y.jsx(As,{children:u.flatMap((L,G)=>L!=null&&L.isHidden||!(L!=null&&L.children)?[]:L.children.map((X,Q)=>X!=null&&X.isHidden?null:y.jsxs(M.Fragment,{children:[z(X,Q,b,L),w&&ne(X,Q,b,L)]},`${G}-${Q}`)))})]}),y.jsx(_0,{children:n.map((L,G)=>{const X=L[P],Q=_==null?void 0:_[X],Y=(Q==null?void 0:Q.length)>0;return y.jsxs(M.Fragment,{children:[y.jsx(As,{sx:{backgroundColor:F=>{var K;return e&&((K=e==null?void 0:e.selectedRow)==null?void 0:K.fhi)===(L==null?void 0:L.fhi)||L!=null&&L.isHigh?F.palette.primary.appBackground:F.palette.primary.notifyBackground}},onClick:()=>e==null?void 0:e.onRowClick(L),children:u.map((F,K)=>F!=null&&F.isHidden?null:F!=null&&F.children?F.children.map((oe,ce)=>oe!=null&&oe.isHidden?null:y.jsxs(M.Fragment,{children:[Z(oe,L,ce,F),w&&J(oe,ce,b,G,F)]},`${K}-${ce}`)):y.jsxs(M.Fragment,{children:[Z(F,L,K),w&&J(F,K,b,G)]},K))}),j&&Q&&y.jsx(y.Fragment,{children:Y?Q.map((F,K)=>y.jsx(As,{children:W.map((oe,ce)=>y.jsx(Sa,{style:oe==null?void 0:oe.style,children:y.jsx(Np,{isRenderCellContent:!!(oe!=null&&oe.cellRenderer),column:oe,row:F})},ce))},`nested-${K}`)):y.jsx(As,{children:y.jsx(Sa,{colSpan:W.length,children:y.jsx(To,{sx:{textAlign:"center"},children:qr.NRF})})})})]},G)})})]})}),r&&y.jsx(Q1,{pagination:r}),y.jsx(ew,{menuOpen:f==null?void 0:f.isOpen,handleClose:g,onHideClick:m})]})}rw.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function ow({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r}){var u;const{columns:o}=e,{visibleGridColumns:i=[]}=M.useContext(ga)??{},a=M.useContext(ya),l=M.useMemo(()=>{var d;return u7({columns:o,gridPath:n,baseUrl:r,isDefaultConfig:t,pageSize:(d=e==null?void 0:e.pagination)==null?void 0:d.rowPerPage})},[o,n,r,t,(u=e==null?void 0:e.pagination)==null?void 0:u.rowPerPage]),c=M.useMemo(()=>{const d=new Map(i.map(f=>[f.key,f]));return l.map(f=>{const p=d.get(f.key);return{...f,...p&&{isHidden:p.isHidden,sequenceId:p.sequenceId}}}).sort((f,p)=>f.sequenceId-p.sequenceId)},[l,i]);return M.useEffect(()=>{a({type:He.SET_GRID_DATA,payload:{visibleGridColumns:i.length?c:l}})},[l]),y.jsx(rw,{...e,gridPath:n,baseUrl:r})}ow.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const sw=({type:e})=>{const t=Nt(),r=(t==null?void 0:t.mode)==="dark"?{bgcolor:"grey.800"}:{};return{grid:y.jsxs(ge,{sx:{borderRadius:2,overflow:"hidden"},children:[y.jsx(Sr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>y.jsx(ge,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>y.jsx(ge,{sx:{flex:1},children:y.jsx(Sr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:y.jsx(y.Fragment,{children:y.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[y.jsxs(dt,{direction:"row",gap:"1rem",children:[y.jsx(Sr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),y.jsxs(dt,{direction:"row",gap:"1rem",children:[y.jsx(Sr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(Sr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},w7=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>y.jsx(ho,{...i}),select:i=>{var a;return y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:(a=i.styles)==null?void 0:a.width},children:y.jsx(i1,{...i,options:t})})}};return o[r]?o[r](n):null},C7=({presentSetting:e,gridSetting:t,gridPath:n})=>{var a;if(!n)return e;const r=n.split("/").filter(Boolean),o=(a=t==null?void 0:t.grid)==null?void 0:a.map(({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f})=>({id:l,isHidden:c,isSortable:u,key:d,sequenceId:f}));let i=e;for(let l=0;l<r.length;l++){const c=r[l];l===r.length-1?i[c]={columns:o,pageSize:(t==null?void 0:t.pageSize)??null}:(i[c]=i[c]||{},i=i[c])}return{settingObject:e,defaultUserSettings:o}},S7=async({baseUrl:e,gridSetting:t,gridPath:n})=>{try{const r=JSON.parse(localStorage.getItem("settings")),{settingObject:o,defaultUserSettings:i}=C7({presentSetting:r,gridSetting:t,gridPath:n});return localStorage.setItem("settings",JSON.stringify(o)),await Ip({baseUrl:e,payload:o}),i}catch(r){console.error(r)}},T7=({customTools:e})=>{var r,o;const t=(r=e==null?void 0:e.filter(i=>(i==null?void 0:i.type)===G1.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)===G1.SECONDARY))==null?void 0:o.sort((i,a)=>i.sequenceId-a.sequenceId);return{primaryButtons:t,secondaryButtons:n}},iw=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=T7({customTools:e}),[i,a]=M.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 M.useEffect(()=>{c(t)},[e]),y.jsxs(y.Fragment,{children:[t&&y.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),y.jsxs(ge,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[y.jsx(Z3,{mode:"popLayout",children:i.map((d,f)=>y.jsx(Gi.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:y.jsx(ge,{sx:{flexShrink:0,minWidth:"fit-content"},children:w7(d)})},`${d.id}_${f}`))}),l&&y.jsx(ge,{sx:{paddingLeft:t?"0.5rem":0},children:y.jsx(ho,{label:t?"":"More Actions",styles:{icon:t?nt.CrossWhite:nt.More,colorType:t?"danger":""},onClick:u})})]})]})};iw.propTypes={customTools:s.array.isRequired};const aw=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,managableColumns:i=[],pageSize:a})=>{var b,w,S,x,O,v;const l=M.useContext(ya),{visibleGridColumns:c,triggerApi:u}=M.useContext(ga),[d,f]=M.useState([]),[p,g]=M.useState(!1);M.useEffect(()=>{if(i.length){const E=i.length?c.filter(k=>i.includes(k.id)):c;f(E)}},[i,c]);const m=async E=>{try{await S7({baseUrl:r,gridPath:o,gridSetting:{grid:E,pageSize:a}})}catch(k){console.error(k)}finally{l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),l({type:He.TRIGGER_API,payload:{triggerApi:!1}})}};M.useEffect(()=>{u&&m(c)},[u]);const h=E=>{const k=E.map(R=>R.id),D=c.map(R=>{if(!d.some(I=>I.id===R.id))return R;const $=k.includes(R.id);if(Array.isArray(R.children)&&R.children.length>0){const I=R.children.map(j=>d.some(P=>P.id===j.id)?{...j,isHidden:$?!1:!k.includes(j.id)}:j),W=I.filter(j=>d.some(_=>_.id===j.id)).every(j=>j.isHidden);return{...R,isHidden:$?!1:W,children:I}}return{...R,isHidden:!k.includes(R.id)}});l({type:He.SET_GRID_DATA,payload:{visibleGridColumns:D}}),l({type:He.HAS_SETTING_CHANGE,payload:{hasChange:!0}})};return y.jsxs(ge,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[y.jsxs(ge,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[((b=e==null?void 0:e.search)==null?void 0:b.isRequired)&&y.jsx(r1,{...e==null?void 0:e.search}),((w=e==null?void 0:e.groupBy)==null?void 0:w.isRequired)&&y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(wc,{styles:{icon:nt.Group},...e.groupBy})}),((S=e==null?void 0:e.refresh)==null?void 0:S.isRequired)&&y.jsx(ho,{...e==null?void 0:e.refresh,styles:{variant:"filled",icon:nt.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),t&&y.jsx(ge,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(wc,{placeholder:"Manage Columns",options:d,value:d.filter(E=>!E.isHidden),isMulti:!0,isDraggable:!0,showSearch:!0,onChange:h,styles:{icon:nt.Manage}})})]}),y.jsxs(ge,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&y.jsx(iw,{customTools:n,setIsExpanded:g,isExpanded:p}),((x=e==null?void 0:e.save)==null?void 0:x.isRequired)&&y.jsx(ge,{sx:{px:"0.5rem"},children:y.jsx(ho,{label:p?"":"Save",styles:{icon:nt.Save,colorType:"empty"},...e==null?void 0:e.save})}),((O=e==null?void 0:e.upload)==null?void 0:O.isRequired)&&y.jsx(ho,{...e==null?void 0:e.upload,styles:{variant:p?"outlined":"filled",icon:p?nt.UploadDark:nt.Upload,colorType:"secondary",isAnimate:!0}}),((v=e==null?void 0:e.download)==null?void 0:v.isRequired)&&y.jsx(ho,{...e==null?void 0:e.download,styles:{variant:"outlined",icon:nt.Download,isAnimate:!0}})]})]})};aw.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function _p({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){var i,a;const o=(i=e.columns)==null?void 0:i.isManageable;return y.jsx(s1,{children:r?y.jsxs(y.Fragment,{children:[y.jsx(sw,{type:"toolbar"}),y.jsx(sw,{type:"grid"})]}):y.jsxs(ge,{sx:{position:"sticky"},children:[t&&y.jsx(aw,{...t,isManageable:o,pageSize:(a=e==null?void 0:e.pagination)==null?void 0:a.rowPerPage}),y.jsx(ow,{tableProps:e,isDefaultConfig:n,gridPath:(t==null?void 0:t.gridPath)||"",baseUrl:(t==null?void 0:t.baseUrl)||""})]})})}_p.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const lw=({list:e,handleLinkClick:t})=>{const n=Nt(),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?y.jsx($r,{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):y.jsx(et,{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 y.jsx(Fg,{separator:y.jsx(ge,{component:"img",src:nt.ArrowRight}),children:r({list:e})})};lw.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const cw=({breadcrumbProps:e,switchProps:t,filterComponentProps:n})=>{var o,i,a,l,c,u;const r=Nt();return y.jsxs(y.Fragment,{children:[y.jsxs(dt,{sx:{background:r.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 5.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[y.jsx(lw,{...e}),y.jsxs(dt,{direction:"row",gap:"1rem",alignItems:"center",children:[t&&y.jsx(u1,{...t}),(n==null?void 0:n.filterBtnProps)&&y.jsxs(dt,{direction:"row",children:[y.jsx(yi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:r.palette.primary.notifyBorderColor}}),y.jsxs(dt,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:(o=n==null?void 0:n.filterBtnProps)==null?void 0:o.onFilterClick,sx:{cursor:"pointer"},children:[y.jsx(ge,{component:"img",src:r.icons.filter}),y.jsx(et,{sx:{fontSize:"1.1rem",color:r.palette.primary.notifyActiveText},children:(i=n==null?void 0:n.filterBtnProps)==null?void 0:i.label})]})]})]})]}),y.jsx(Gi.div,{layout:!0,initial:{height:"0rem"},animate:{height:(a=n==null?void 0:n.filterBtnProps)!=null&&a.filterContainerVisible?"5rem":"0rem",opacity:(l=n==null?void 0:n.filterBtnProps)!=null&&l.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:r.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden"},children:y.jsxs(dt,{sx:{background:r.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[y.jsx(et,{sx:{fontSize:"1.2rem",fontWeight:"500",color:r.palette.primary.notifyActiveText},children:"Filters:"}),y.jsx(ge,{sx:{overflowX:"auto",overflowY:"visible",whiteSpace:"nowrap",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},margin:"0 1rem",padding:"0.5rem 0",flexGrow:1},children:y.jsx(dt,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:(c=n==null?void 0:n.filterItems)==null?void 0:c.map((d,f)=>y.jsx(y.Fragment,{children:y.jsxs(ge,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${r.palette.primary.notifyBorderColor}`,background:r.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[y.jsx(ge,{component:"img",src:nt.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n==null?void 0:n.onFilterChipClose(d)}),y.jsx(et,{sx:{fontSize:"1rem",color:r.palette.primary.notifyTextColor},children:d==null?void 0:d.filterLabel})]},f)}))})}),y.jsx(ge,{component:et,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:r.palette.brandColor.red,cursor:"pointer"},onClick:(u=n==null?void 0:n.filterContainerProps)==null?void 0:u.onClearClick,children:"Clear"})]})})]})};cw.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function uw({headerProps:e}){return y.jsx(_n,{children:y.jsx(cw,{...e})})}uw.propTypes={headerProps:s.object.isRequired};const Fp=M.createContext(null),dw=M.createContext(null);function O7({children:e}){const[t,n]=M.useReducer(E7,k7);return y.jsx(Fp.Provider,{value:t,children:y.jsx(dw.Provider,{value:n,children:e})})}function E7(e,t){var n;switch(t.type){case He.LOADING:return{...e,loading:t.loading};case He.SUCCESS:return{...e,data:(n=t.data)==null?void 0:n.sort((r,o)=>new Date(o.createdAt)-new Date(r.createdAt))};case He.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case He.ERROR:return{...e,error:t.error};default:throw new Error(`${qr.UNHANDLED}: ${t}`)}}const k7={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1}},{TENANT_ID:Bp,BU_ID:Lp,SNOP_ID:fw}=Pp,{TENANT_IDS:Vp,BU_IDS:Wp}=Is,P7=async e=>{try{const t=`${e}${jc.NOTIFICATION}/v1?${Bp}=${Vp}&${Lp}=${Wp}`;return await St.get(t,Ca)}catch(t){return t}},pw=async(e,t,n)=>{try{const r=n===Y1.MARK_ALL_READ?"":`&${fw}=${n}&`,o=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${Bp}=${Vp}&${Lp}=${Wp}${r}`;return await St.put(o,t,Ca)}catch(r){return r}},M7=async({baseUrl:e,id:t,snopId:n})=>{try{const r=`${e}${jc.NOTIFICATION}${Ep.VERSION}?${Bp}=${Vp}&${Lp}=${Wp}&${fw}=${n}&id=${t}`;return await St.get(r,Ca)}catch(r){return r}},$c={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},hw=({baseUrl:e})=>{const t=M.useContext(dw),[n,r]=M.useState(!1),[o,i]=M.useState(!1),[a,l]=M.useState(!1),[c,u]=M.useState({}),[d,f]=M.useState(null),[p,g]=M.useState(1),[m,h]=M.useState(!1),[b,w]=M.useState(0),{loading:S,data:x,isMarkAllAsRead:O}=M.useContext(Fp),[v,E]=M.useState([]);M.useEffect(()=>{E(x)},[x]);const k=M.useCallback(async()=>{var j,_;try{t({type:He.LOADING,loading:!0}),t({type:He.SUCCESS,data:[]});const P=await P7(e);if(P.status===$c.OK){const N=((_=(j=P.data)==null?void 0:j.responseData)==null?void 0:_.response)||[],B=xc(N);t({type:He.SUCCESS,data:xc(B)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:o1(N),boo:o1(N)>0}})}}catch{t({type:He.ERROR,error:qr.SWR})}finally{t({type:He.LOADING,loading:!1})}},[e,t]);M.useEffect(()=>{k();const j=setInterval(k,3e5);return()=>clearInterval(j)},[k]);const D=async(j,_)=>{var P,N,B;if(j){f(j);try{const H=await M7({baseUrl:e,id:j,snopId:_});if(H.status===$c.OK){const V=((B=(N=(P=H.data)==null?void 0:P.responseData)==null?void 0:N.response)==null?void 0:B[0])||{};u(V||{}),l(!0)}else throw new Error}catch{t({type:He.ERROR,error:qr.SWR})}finally{f(null)}}},R=async(j,_)=>{if(j.length){t({type:He.LOADING,loading:!0});try{if((await pw(e,j,_)).status===$c.OK){const N=x.map(H=>j.includes(H.id)?{...H,isRead:!0}:H),B=N.filter(H=>!H.isRead).length;t({type:He.SUCCESS,data:xc(N)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:B,boo:B>0}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:qr.SWR}),t({type:He.LOADING,loading:!1})}}},A=async()=>{t({type:He.LOADING,loading:!0});try{const j=cV(x);if((await pw(e,j,Y1.MARK_ALL_READ)).status===$c.OK){const P=x.map(N=>({...N,isRead:!0}));t({type:He.SUCCESS,data:xc(P)}),t({type:He.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:He.LOADING,loading:!1})},200)}}catch{t({type:He.ERROR,error:qr.SWR}),t({type:He.LOADING,loading:!1})}},$=(j,_)=>{t({type:He.LOADING,loading:!0}),w(_),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)},I=j=>{const _=j||x||[];return{0:_,1:_.filter(P=>(P==null?void 0:P.type)==="INFO"),2:_.filter(P=>(P==null?void 0:P.type)==="ERROR")}},W=()=>{t({type:He.LOADING,loading:!0});const j=!m,_=j?(v||[]).filter(P=>!P.isRead):x||[];h(j),E(_),g(1),setTimeout(()=>{t({type:He.LOADING,loading:!1})},400)};return{fetchNotification:k,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:k,handleRead:R,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:D,clickId:d,isMainDialog:!0},activeTab:b,loading:S,tabData:I(v)[b],data:v,mode:m,handleTabChange:$,toggleAlertMode:W,page:p,setPage:g,isMarkAllAsRead:O}};var mw,gw,yw;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 R7=function(t){return C.createElement("svg",zp({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),mw||(mw=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"})),gw||(gw=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"})),yw||(yw=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 D7=({count:e})=>(Nt(),y.jsxs(y.Fragment,{children:[y.jsx(ge,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:y.jsx(R7,{style:{scale:2}})}),y.jsx(y7,{badgeContent:e!=0?"":null,color:"error"})]}));function bw({children:e,handleClose:t,open:n,isMainDialog:r}){return y.jsx(Ol,{open:n,onClose:t,...r?{scroll:"paper",PaperProps:{sx:{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}}}:{fullWidth:!0,maxWidth:"md",sx:{"& .MuiPaper-root":{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}}},children:e})}var vw;function Up(){return Up=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},Up.apply(null,arguments)}var I7=function(t){return C.createElement("svg",Up({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),vw||(vw=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"})))},xw,ww;function Hp(){return Hp=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},Hp.apply(null,arguments)}var A7=function(t){return C.createElement("svg",Hp({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),xw||(xw=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"})),ww||(ww=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"})))},Cw;function qp(){return qp=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},qp.apply(null,arguments)}var j7=function(t){return C.createElement("svg",qp({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),Cw||(Cw=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 Sw=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i})=>{var c,u;const a=Nt(),l=(u=(c=JSON.parse(localStorage.getItem("settings")))==null?void 0:c.platform)==null?void 0:u.theme;return y.jsxs(ge,{className:"cards",sx:{pt:" 0.8rem"},children:[y.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:y.jsx(Qu,{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:y.jsx(To,{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})})}),y.jsx(dt,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:y.jsxs(dt,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[(t==null?void 0:t.isNotificationDetails)&&y.jsx(Nc,{icon:y.jsx(A7,{className:`${l==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===(t==null?void 0:t.id)?y.jsx(Tl,{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)&&y.jsx(Nc,{icon:y.jsx(j7,{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)&&y.jsx(Nc,{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)&&y.jsx(Nc,{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"})]})}),y.jsxs(dt,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[y.jsx(To,{sx:{fontSize:"0.8rem"},children:t==null?void 0:t.product}),y.jsx(To,{color:a.palette.primary.notifyTextColor,children:"•"}),y.jsx(To,{sx:{fontSize:"0.8rem"},children:lV(t==null?void 0:t.createdAt)})]})]})};Sw.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Tw=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,page:i,setPage:a})=>{const{isMarkAllAsRead:l}=M.useContext(Fp),c=new Date,u=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(c),[d,f]=M.useState([]),[p,g]=M.useState(!1),[m,h]=M.useState(!0),b=M.useRef(null),w=async x=>{g(!0);const O=e.slice((x-1)*10,x*10);await new Promise(v=>setTimeout(v,1e3)),f(v=>{const E=O.filter(k=>!v.some(D=>D.id===k.id));return[...v,...E]}),g(!1),(d==null?void 0:d.length)>=(e==null?void 0:e.length)&&h(!1)};M.useEffect(()=>{var O;let x=[];o?l!=null&&l.count?x=(O=e==null?void 0:e.filter(v=>!v.isRead))==null?void 0:O.slice(0,10):x=[]:x=e.slice(0,10),(x==null?void 0:x.length)<10&&h(!1),f(x)},[e,o,l]),M.useEffect(()=>{m&&i!==1&&w(i)},[i,e]),M.useEffect(()=>{f([...e])},[e]),M.useEffect(()=>{const x=new IntersectionObserver(O=>{O[0].isIntersecting&&!p&&m&&a(v=>v+1)},{threshold:1});return b.current&&x.observe(b.current),()=>{b.current&&x.unobserve(b.current)}},[p,m]);const S=({redirect:x,isClicked:O,url:v})=>{window.open(v,"_blank")};return y.jsxs(ge,{sx:{width:"100%"},children:[Object.entries(uV(d)).map(([x,O])=>y.jsxs(M.Fragment,{children:[x!==u&&y.jsx(g7,{children:x}),O.map((v,E)=>y.jsx(M.Fragment,{children:y.jsx(Sw,{item:v,handleCTAClicked:S,handleShowDetails:()=>n(v.id,v.snopId),handleRead:()=>t([v.id],v.snopId),clickId:r})},`${E}_${v.id}`))]},x)),p&&i>1&&!!(d!=null&&d.length)&&y.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",pl:"0.5rem",py:"0.3rem"},children:y.jsx(Tl,{size:20,sx:{color:x=>x.palette.primary.notifyIconColor}})}),!(d!=null&&d.length)&&y.jsx(et,{sx:{fontSize:"1.1rem",color:x=>x.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."}),y.jsx(ge,{ref:b,style:{height:"0.1rem",backgroundColor:"transparent"}})]})};Tw.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const N7=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o})=>{var m,h,b,w;const{loading:i,activeTab:a,data:l,tabData:c,mode:u,page:d,setPage:f,handleTabChange:p,toggleAlertMode:g}=hw({});return y.jsxs(y.Fragment,{children:[y.jsxs(ge,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[y.jsx(et,{variant:"h2",sx:{fontSize:"1.2rem",color:S=>S.palette.primary.notifyTextColor},children:"Notifications"}),y.jsx(ge,{component:"img",src:nt.Refresh,alt:"refresh",onClick:e,sx:{cursor:"pointer"}})]}),y.jsx(ge,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:S=>S.palette.primary.notifyBorderColor},children:y.jsxs(b7,{value:a,onChange:p,children:[y.jsx($p,{label:y.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["All (",y.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((m=l==null?void 0:l.filter(S=>!(S!=null&&S.isRead)))==null?void 0:m.length)||0}),")"]})}),y.jsx($p,{label:y.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Info (",y.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((h=l==null?void 0:l.filter(S=>(S==null?void 0:S.type)==="INFO"&&!(S!=null&&S.isRead)))==null?void 0:h.length)||0}),")"]}),sx:{color:S=>S.palette.brandColor.blue}}),y.jsx($p,{label:y.jsxs(ge,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:["Error (",y.jsx(et,{component:"span",sx:{fontWeight:"500",fontSize:"1rem"},children:((b=l==null?void 0:l.filter(S=>(S==null?void 0:S.type)==="ERROR"&&!(S!=null&&S.isRead)))==null?void 0:b.length)||0}),")"]}),sx:{color:S=>S.palette.brandColor.red}})]})}),y.jsx(kl,{dividers:!0,sx:{p:0,...i&&!c.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:S=>S.palette.primary.notifyBorderColor},tabIndex:-1,children:i?y.jsx(Tl,{size:30,sx:{color:S=>S.palette.primary.notifyIconColor}}):y.jsx(y.Fragment,{children:y.jsx(Tw,{data:c,handleShowDetails:t,handleRead:r,clickId:n,page:d,setPage:f,mode:u})})}),y.jsxs(El,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[y.jsxs(dt,{direction:"row",gap:1,children:[y.jsx(To,{sx:{fontSize:"1rem"},children:"Only show unread"}),y.jsx(m7,{disabled:i,checked:u,onChange:g})]}),y.jsx(Un,{variant:"outlined",className:"view-all",onClick:o,startIcon:y.jsx(I7,{}),disabled:!((w=l==null?void 0:l.filter(S=>!(S!=null&&S.isRead)))!=null&&w.length),style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:S=>S.palette.primary.notifyTextColor,"&:hover":{color:S=>S.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:S=>`${S.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:"Mark all as read"})]})]})},$7=({data:e,handleClose:t})=>{var S;const[n,r]=M.useState(1),[o,i]=M.useState(10),[a,l]=M.useState(((S=e==null?void 0:e.notificationDetails)==null?void 0:S.length)||0),[c,u]=M.useState("sku_name"),[d,f]=M.useState("asc"),[p,g]=M.useState(""),m=["sku_name","node","channel_name"],h=M.useMemo(()=>!(e!=null&&e.notificationDetails)||!m.length?[]:p.trim()?e.notificationDetails.filter(x=>m.some(O=>{var v;return(v=x[O])==null?void 0:v.toString().toLowerCase().includes(p.toLowerCase())})):e.notificationDetails,[e,p,m]),b=M.useMemo(()=>c?[...h].sort((x,O)=>{const v=x[c],E=O[c];return v==null?1:E==null?-1:typeof v=="number"&&typeof E=="number"?d==="asc"?v-E:E-v:!isNaN(Date.parse(v))&&!isNaN(Date.parse(E))?d==="asc"?new Date(v).getTime()-new Date(E).getTime():new Date(E).getTime()-new Date(v).getTime():d==="asc"?v.toString().localeCompare(E.toString()):E.toString().localeCompare(v.toString())}):h,[h,c,d]),w=M.useMemo(()=>{const x=(n-1)*o,O=x+o;return b.slice(x,O)},[b,n,o]);return y.jsxs(y.Fragment,{children:[y.jsxs(dt,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:x=>x.palette.primary.notifyBorderColor},children:[y.jsx(et,{component:"h2",sx:{fontSize:"1.4rem",color:x=>x.palette.primary.notifyActiveText},children:(e==null?void 0:e.message)||""}),y.jsx(ge,{component:"img",src:nt.CloseCircle,onClick:t,sx:{cursor:"pointer"}})]}),y.jsx(kl,{children:y.jsx(_p,{tableProps:{data:w,columns:{...f7(),isManageable:!1},sort:{sortField:c,sortDir:d,onSort:x=>{var v;const O=(v=x==null?void 0:x.column)==null?void 0:v.key;f(E=>c===O&&E==="asc"?"desc":"asc"),u(O)}},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=>{g(x.target.value)},placeholder:"Search..."}}}})}),y.jsx(El,{sx:{padding:"1.5rem 2rem"}})]})},_7=({baseUrl:e})=>{const{alertDialogProps:t,showDetailsProps:n,fetchNotification:r,isMarkAllAsRead:o}=hw({baseUrl:e});return y.jsxs(y.Fragment,{children:[y.jsx(ge,{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:y.jsx(D7,{count:o.count})}),y.jsx(bw,{...t,children:y.jsx(N7,{...t})}),y.jsx(bw,{...n,children:y.jsx($7,{...n})})]})},F7=({baseUrl:e})=>y.jsx(_n,{children:y.jsx(O7,{children:y.jsx(_7,{baseUrl:e})})}),B7=({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=Nt();return y.jsx(ge,{sx:{position:"relative",overflow:"hidden"},children:y.jsxs(io,{container:!0,sx:{height:"100%"},children:[y.jsx(io,{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&&y.jsxs(y.Fragment,{children:[y.jsx(ge,{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"}}),y.jsx(ge,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"transparent",zIndex:4}})]}),e&&y.jsxs(io,{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:[y.jsxs(dt,{direction:"row",alignItems:"center",sx:{width:"100%",flexShrink:0,paddingBottom:"0.8rem",px:2,pt:"0.8rem",borderBottom:g=>`0.1rem solid ${g.palette.primary.notifyBorderColor}`},children:[!u&&f&&y.jsxs(y.Fragment,{children:[y.jsx(ge,{sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l,children:y.jsx(ge,{component:"img",src:nt.Merge})}),y.jsx(yi,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:p.palette.primary.notifyBorderColor}})]}),y.jsxs(dt,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[y.jsxs(dt,{direction:"row",gap:"0.5rem",alignItems:"center",onClick:a,sx:{cursor:"pointer"},children:[y.jsx(ge,{component:"img",src:p.icons.close}),y.jsx(et,{sx:{fontSize:"1.2rem",color:p.palette.primary.notifyTextColor},children:o})]}),y.jsx(dt,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&y.jsx(ge,{onClick:c,sx:{cursor:"pointer"},children:y.jsx(ge,{component:"img",src:u?nt.Collapse:nt.Expand})})})]})]}),y.jsx(ge,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},Ow=({layoutChildren:e,layoutProps:t})=>y.jsx(_n,{children:y.jsx(B7,{...e,...t})});Ow.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired},vt.Button=ho,vt.Checkbox=rc,vt.DatePicker=iV,vt.Grid=_p,vt.Header=uw,vt.InputField=r1,vt.Loader=DV,vt.Notification=F7,vt.Select=i1,vt.SliderLayout=Ow,vt.Switch=u1,vt.TextField=bc,vt.ToastProvider=EV,vt.toast=CV,Object.defineProperty(vt,Symbol.toStringTag,{value:"Module"})});
|
|
327
327
|
//# sourceMappingURL=index.umd.js.map
|