@3sc/common-component 0.0.534 → 0.0.535
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-BrbKiqst.js → index-DQ1YEl5o.js} +4 -4
- package/dist/{index-BrbKiqst.js.map → index-DQ1YEl5o.js.map} +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/{nl-Bp7xukzz.js → nl-BWfddY7i.js} +2 -2
- package/dist/{nl-Bp7xukzz.js.map → nl-BWfddY7i.js.map} +1 -1
- package/dist/{tr-MQ5Kl5b6.js → tr-CTVa4ozy.js} +2 -2
- package/dist/{tr-MQ5Kl5b6.js.map → tr-CTVa4ozy.js.map} +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as t, i as e, B as i, C as o, D as r, G as c, H as d, I as n, L as l, N as u, S as x, h as A, g as S, T, e as f, f as h, t as y, u as C } from "./index-
|
|
1
|
+
import { A as t, i as e, B as i, C as o, D as r, G as c, H as d, I as n, L as l, N as u, S as x, h as A, g as S, T, e as f, f as h, t as y, u as C } from "./index-DQ1YEl5o.js";
|
|
2
2
|
export {
|
|
3
3
|
t as Accordion,
|
|
4
4
|
e as AnalyticsProvider,
|
package/dist/index.umd.js
CHANGED
|
@@ -253,5 +253,5 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
253
253
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[kv]=this[kv]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=xi(a);r[l]||(i4(o,a),r[l]=!0)}return H.isArray(t)?t.forEach(i):i(t),this}};Xt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),H.reduceDescriptors(Xt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),H.freezeMethods(Xt);function Xd(e,t){const n=this||vi,r=t||n,o=Xt.from(r.headers);let i=r.data;return H.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Ev(e){return!!(e&&e.__CANCEL__)}function Ko(e,t,n){Le.call(this,e??"canceled",Le.ERR_CANCELED,t,n),this.name="CanceledError"}H.inherits(Ko,Le,{__CANCEL__:!0});function Ov(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Le("Request failed with status code "+n.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function a4(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function l4(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];a||(a=u),n[o]=c,r[o]=u;let f=i,p=0;for(;f!==o;)p+=n[f++],f=f%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-a<t)return;const h=d&&u-d;return h?Math.round(p*1e3/h):void 0}}function c4(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(...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 Sl=(e,t,n=3)=>{let r=0;const o=l4(50,250);return c4(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)},Pv=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Mv=e=>(...t)=>H.asap(()=>e(...t)),u4=$t.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$t.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($t.origin),$t.navigator&&/(msie|trident)/i.test($t.navigator.userAgent)):()=>!0,d4=$t.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];H.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),H.isString(r)&&l.push(`path=${r}`),H.isString(o)&&l.push(`domain=${o}`),i===!0&&l.push("secure"),H.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function f4(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function p4(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Rv(e,t,n){let r=!f4(t);return e&&(r||n==!1)?p4(e,t):t}const Dv=e=>e instanceof Xt?{...e}:e;function Zr(e,t){t=t||{};const n={};function r(u,d,f,p){return H.isPlainObject(u)&&H.isPlainObject(d)?H.merge.call({caseless:p},u,d):H.isPlainObject(d)?H.merge({},d):H.isArray(d)?d.slice():d}function o(u,d,f,p){if(H.isUndefined(d)){if(!H.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!H.isUndefined(d))return r(void 0,d)}function a(u,d){if(H.isUndefined(d)){if(!H.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(Dv(u),Dv(d),f,!0)};return H.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||o,p=f(e[d],t[d],d);H.isUndefined(p)&&f!==l||(n[d]=p)}),n}const Av=e=>{const t=Zr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=Xt.from(a),t.url=wv(Rv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),H.isFormData(n)){if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(H.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&a.set(d,f)})}}if($t.hasStandardBrowserEnv&&(r&&H.isFunction(r)&&(r=r(t)),r||r!==!1&&u4(t.url))){const c=o&&i&&d4.read(i);c&&a.set(o,c)}return t},h4=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=Av(e);let i=o.data;const a=Xt.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=o,d,f,p,h,g;function m(){h&&h(),g&&g(),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 S(){if(!b)return;const w=Xt.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),x={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:e,request:b};Ov(function(P){n(P),m()},function(P){r(P),m()},x),b=null}"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(S)},b.onabort=function(){b&&(r(new Le("Request aborted",Le.ECONNABORTED,e,b)),b=null)},b.onerror=function(v){const x=v&&v.message?v.message:"Network Error",T=new Le(x,Le.ERR_NETWORK,e,b);T.event=v||null,r(T),b=null},b.ontimeout=function(){let v=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const x=o.transitional||Cv;o.timeoutErrorMessage&&(v=o.timeoutErrorMessage),r(new Le(v,x.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,e,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&H.forEach(a.toJSON(),function(v,x){b.setRequestHeader(x,v)}),H.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),l&&l!=="json"&&(b.responseType=o.responseType),u&&([p,g]=Sl(u,!0),b.addEventListener("progress",p)),c&&b.upload&&([f,h]=Sl(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(d=w=>{b&&(r(!w||w.type?new Ko(null,e,b):w),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const k=a4(o.url);if(k&&$t.protocols.indexOf(k)===-1){r(new Le("Unsupported protocol "+k+":",Le.ERR_BAD_REQUEST,e));return}b.send(i||null)})},m4=(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 Le?d:new Ko(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,i(new Le(`timeout ${t} of ms exceeded`,Le.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=()=>H.asap(l),c}},g4=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},y4=async function*(e,t){for await(const n of b4(e))yield*g4(n,t)},b4=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()}},jv=(e,t,n,r)=>{const o=y4(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})},Iv=64*1024,{isFunction:Cl}=H,v4=(({Request:e,Response:t})=>({Request:e,Response:t}))(H.global),{ReadableStream:Nv,TextEncoder:$v}=H.global,Bv=(e,...t)=>{try{return!!e(...t)}catch{return!1}},x4=e=>{e=H.merge.call({skipUndefined:!0},v4,e);const{fetch:t,Request:n,Response:r}=e,o=t?Cl(t):typeof fetch=="function",i=Cl(n),a=Cl(r);if(!o)return!1;const l=o&&Cl(Nv),c=o&&(typeof $v=="function"?(g=>m=>g.encode(m))(new $v):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=i&&l&&Bv(()=>{let g=!1;const m=new n($t.origin,{body:new Nv,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!m}),d=a&&l&&Bv(()=>H.isReadableStream(new r("").body)),f={stream:d&&(g=>g.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!f[g]&&(f[g]=(m,b)=>{let S=m&&m[g];if(S)return S.call(m);throw new Le(`Response type '${g}' is not supported`,Le.ERR_NOT_SUPPORT,b)})});const p=async g=>{if(g==null)return 0;if(H.isBlob(g))return g.size;if(H.isSpecCompliantForm(g))return(await new n($t.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(H.isArrayBufferView(g)||H.isArrayBuffer(g))return g.byteLength;if(H.isURLSearchParams(g)&&(g=g+""),H.isString(g))return(await c(g)).byteLength},h=async(g,m)=>{const b=H.toFiniteNumber(g.getContentLength());return b??p(m)};return async g=>{let{url:m,method:b,data:S,signal:k,cancelToken:w,timeout:v,onDownloadProgress:x,onUploadProgress:T,responseType:P,headers:M,withCredentials:R="same-origin",fetchOptions:A}=Av(g),$=t||fetch;P=P?(P+"").toLowerCase():"text";let C=m4([k,w&&w.toAbortSignal()],v),j=null;const N=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let B;try{if(T&&u&&b!=="get"&&b!=="head"&&(B=await h(M,S))!==0){let D=new n(m,{method:"POST",body:S,duplex:"half"}),W;if(H.isFormData(S)&&(W=D.headers.get("content-type"))&&M.setContentType(W),D.body){const[q,Q]=Pv(B,Sl(Mv(T)));S=jv(D.body,Iv,q,Q)}}H.isString(R)||(R=R?"include":"omit");const L=i&&"credentials"in n.prototype,V={...A,signal:C,method:b.toUpperCase(),headers:M.normalize().toJSON(),body:S,duplex:"half",credentials:L?R:void 0};j=i&&new n(m,V);let Y=await(i?$(j,A):$(m,V));const U=d&&(P==="stream"||P==="response");if(d&&(x||U&&N)){const D={};["status","statusText","headers"].forEach(te=>{D[te]=Y[te]});const W=H.toFiniteNumber(Y.headers.get("content-length")),[q,Q]=x&&Pv(W,Sl(Mv(x),!0))||[];Y=new r(jv(Y.body,Iv,q,()=>{Q&&Q(),N&&N()}),D)}P=P||"text";let _=await f[H.findKey(f,P)||"text"](Y,g);return!U&&N&&N(),await new Promise((D,W)=>{Ov(D,W,{data:_,headers:Xt.from(Y.headers),status:Y.status,statusText:Y.statusText,config:g,request:j})})}catch(L){throw N&&N(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,g,j),{cause:L.cause||L}):Le.from(L,L&&L.code,g,j)}}},w4=new Map,Lv=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a=i.length,l=a,c,u,d=w4;for(;l--;)c=i[l],u=d.get(c),u===void 0&&d.set(c,u=l?new Map:x4(t)),d=u;return u};Lv();const Zd={http:zI,xhr:h4,fetch:{get:Lv}};H.forEach(Zd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const _v=e=>`- ${e}`,S4=e=>H.isFunction(e)||e===null||e===!1;function C4(e,t){e=H.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a<n;a++){r=e[a];let l;if(o=r,!S4(r)&&(o=Zd[(l=String(r)).toLowerCase()],o===void 0))throw new Le(`Unknown adapter '${l}'`);if(o&&(H.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since :
|
|
254
254
|
`+a.map(_v).join(`
|
|
255
255
|
`):" "+_v(a[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o}const Fv={getAdapter:C4,adapters:Zd};function Jd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ko(null,e)}function Vv(e){return Jd(e),e.headers=Xt.from(e.headers),e.data=Xd.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Fv.getAdapter(e.adapter||vi.adapter,e)(e).then(function(r){return Jd(e),r.data=Xd.call(e,e.transformResponse,r),r.headers=Xt.from(r.headers),r},function(r){return Ev(r)||(Jd(e),r&&r.response&&(r.response.data=Xd.call(e,e.transformResponse,r.response),r.response.headers=Xt.from(r.response.headers))),Promise.reject(r)})}const Wv="1.13.2",Tl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Tl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const zv={};Tl.transitional=function(t,n,r){function o(i,a){return"[Axios v"+Wv+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new Le(o(a," has been removed"+(n?" in "+n:"")),Le.ERR_DEPRECATED);return n&&!zv[a]&&(zv[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}},Tl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function T4(e,t,n){if(typeof e!="object")throw new Le("options must be an object",Le.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 Le("option "+i+" must be "+c,Le.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Le("Unknown option "+i,Le.ERR_BAD_OPTION)}}const kl={assertOptions:T4,validators:Tl},Kn=kl.validators;let Jr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Sv,response:new Sv}}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+=`
|
|
256
|
-
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Zr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&kl.assertOptions(r,{silentJSONParsing:Kn.transitional(Kn.boolean),forcedJSONParsing:Kn.transitional(Kn.boolean),clarifyTimeoutError:Kn.transitional(Kn.boolean)},!1),o!=null&&(H.isFunction(o)?n.paramsSerializer={serialize:o}:kl.assertOptions(o,{encode:Kn.function,serialize:Kn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),kl.assertOptions(n,{baseUrl:Kn.spelling("baseURL"),withXsrfToken:Kn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&H.merge(i.common,i[n.method]);i&&H.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=Xt.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,p;if(!c){const g=[Vv.bind(this),void 0];for(g.unshift(...l),g.push(...u),p=g.length,d=Promise.resolve(n);f<p;)d=d.then(g[f++],g[f++]);return d}p=l.length;let h=n;for(;f<p;){const g=l[f++],m=l[f++];try{h=g(h)}catch(b){m.call(this,b);break}}try{d=Vv.call(this,h)}catch(g){return Promise.reject(g)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Zr(this.defaults,t);const n=Rv(t.baseURL,t.url,t.allowAbsoluteUrls);return wv(n,t.params,t.paramsSerializer)}};H.forEach(["delete","get","head","options"],function(t){Jr.prototype[t]=function(n,r){return this.request(Zr(r||{},{method:t,url:n,data:(r||{}).data}))}}),H.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(Zr(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Jr.prototype[t]=n(),Jr.prototype[t+"Form"]=n(!0)});let k4=class O2{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 Ko(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 O2(function(o){t=o}),cancel:t}}};function E4(e){return function(n){return e.apply(null,n)}}function O4(e){return H.isObject(e)&&e.isAxiosError===!0}const Qd={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Qd).forEach(([e,t])=>{Qd[t]=e});function Hv(e){const t=new Jr(e),n=iv(Jr.prototype.request,t);return H.extend(n,Jr.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Hv(Zr(e,o))},n}const dt=Hv(vi);dt.Axios=Jr,dt.CanceledError=Ko,dt.CancelToken=k4,dt.isCancel=Ev,dt.VERSION=Wv,dt.toFormData=xl,dt.AxiosError=Le,dt.Cancel=dt.CanceledError,dt.all=function(t){return Promise.all(t)},dt.spread=E4,dt.isAxiosError=O4,dt.mergeConfig=Zr,dt.AxiosHeaders=Xt,dt.formToJSON=e=>Tv(H.isHTMLForm(e)?new FormData(e):e),dt.getAdapter=Fv.getAdapter,dt.HttpStatusCode=Qd,dt.default=dt;const{Axios:E$,AxiosError:O$,CanceledError:P$,isCancel:M$,CancelToken:R$,VERSION:D$,all:A$,Cancel:j$,isAxiosError:I$,spread:N$,toFormData:$$,AxiosHeaders:B$,HttpStatusCode:L$,formToJSON:_$,getAdapter:F$,mergeConfig:V$}=dt,ef={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},wi={headers:{"Content-Type":"application/json"},withCredentials:!0},Uv=dt.create({baseURL:ef.BASE_URL,axiosConfig:wi});Uv.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Uv.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const cr={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Yv={TENANT_ID:"tenant_id",BU_ID:"bu_id"},P4=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),M4=[10,25,50,100],R4={MARK_ALL_READ:"MARK_ALL_READ"},D4=M4.map(e=>({label:e,value:e})),qv={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},El={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};function Ol(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 A4={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 tf(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Ol({},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,"",Ol({},i,{expires:-1}))},withAttributes:function(o){return tf(this.converter,Ol({},this.attributes,o))},withConverter:function(o){return tf(Ol({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var j4=tf(A4,{path:"/"});const I4=pl(cr.SNOP),N4=pl(cr.SELECTED_BU),$4=pl(cr.USER);pl(cr.SETTINGS);const Gv={BU_IDS:N4?.business_unit_id,TOKEN:JSON.parse(j4.get(cr.TOKEN)||null),TENANT_IDS:$4?.tenant_id,SNOP_IDS:I4?.snop_id},{TENANT_ID:B4,BU_ID:L4}=Yv,{TENANT_IDS:_4,BU_IDS:F4}=Gv,Pl=async({baseUrl:e,payload:t})=>{console.log("setting api",e,t);try{const n=`${e}${El.SETTING}/v1?${B4}=${_4}&${L4}=${F4}`;return await dt.post(n,t,wi)}catch(n){return n}},V4=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{const l=a?.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=ur(d),p=t.split("/").filter(Boolean),h=JSON.parse(localStorage.getItem(cr.SETTINGS));let g=p.reduce((w,v)=>w?.[v],h)||null;const m=ur(g?.columns||[]);if(!r&&t&&l){let w=(u&&nf({col:u,childUniqueKey:i,definitions:c}))??nf({col:c,childUniqueKey:i});const v=w.filter(T=>!m[T.key]),x=g&&g?.columns?.some(T=>T?.children&&T.children[i]);if(l&&(v.length||i&&x===!1)){if(x==!1&&i.length>0){const T=ur(w);w=g?.columns?.map(P=>P?.children&&!P.children[i]?{...P,children:{...P.children,[i]:T?.[P?.key]?.children[i]}}:P)}(async()=>{try{const P={...h||{platform:{theme:"light"}}},M=g?.pageSize??o;let R=P;for(let A=0;A<p.length;A++){const $=p[A];A===p.length-1?R[$]={columns:w,pageSize:M}:(R[$]={...R[$]||{}},R=R[$])}localStorage.setItem(cr.SETTINGS,JSON.stringify(P)),await Pl({baseUrl:n,payload:P})}catch(T){console.error(T)}})()}}u=(g?.columns&&z4(m,u,i))??u??nf({col:c});const b=[],S=ur(u);for(const w of c){const v=S[w.key]||{},x=f[w.key]||{},T=m[w.key],P=ur(v.children||[]),M=ur(x.children||[]);let R={...w,style:T?.style,...v,...x};w.children?.length&&(R.children=w.children.map(A=>({...A,...P[A.key],...M[A.key]}))),b.push(R)}return b.sort((w,v)=>w.sequenceId-v.sequenceId)},W4=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),Si=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e?.map(o=>{let i=r?.find(a=>a?.key===o?.key);return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||i?.style||{},...o?.children&&{children:t?{[t]:Si({columns:o.children,definitions:i?.children})}:Si({columns:o.children,definitions:i?.children})}}})},ur=e=>Array.isArray(e)&&e?.reduce((t,n)=>(t[n.key]=n,t),{}),nf=({col:e,childUniqueKey:t,definitions:n})=>Si({columns:e,childUniqueKey:t,definitions:n}),z4=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{const u=ur(Array.isArray(i?.children)?i?.children:i?.children?.[n])?.[l.key];return{...l,sequenceId:u?.sequenceId||l.sequenceId,isHidden:u?.isHidden??l.isHidden}}):void 0;return{...o,sequenceId:i?.sequenceId||o.sequenceId,isHidden:i?.isHidden??o.isHidden,...a?{children:a}:{}}}),H4=({t:e})=>{const t=[{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}],n=[{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"}}],r=[{id:1,key:"sku_name",label:e(rI),isLocalizable:!1},{id:2,key:"node",label:e(nI),isLocalizable:!1},{id:3,key:"channel_name",label:e(oI),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}},U4=e=>{let{disabled:t=!1,minWidth:n=0,maxWidth:r,className:o="",id:i,resizeStart:a,resizeEnd:l,defaultWidth:c,rowSpan:u=1,colSpan:d=1}=e;const[f,p]=O.useState(!1),[h,g]=O.useState(0),[m,b]=O.useState(0),[S,k]=O.useState(0),[w,v]=O.useState(null),x=O.useRef(null),T=O.useCallback(C=>{if(!t&&(v(i),a&&a(),p(!0),g(C),b(0),x.current)){const j=x.current.previousSibling;j&&b(j.clientWidth)}},[t,i,a]),P=O.useCallback(()=>{t||(f&&l&&w===i&&l(S),p(!1),v(null))},[t,l,w,i,S,f]),M=O.useCallback(C=>{if(t)return;const j=C instanceof TouchEvent?C.touches[0].screenX:C.screenX;if(!f)return;const N=x.current;if(!N||!N.previousSibling)return;const B=N.previousSibling,L=h-j;let V=m-L;n!==void 0&&V<n&&(V=n),r!==void 0&&V>r&&(V=r),B.style.width=V+"px",B.style.minWidth=V+"px",B.style.maxWidth=V+"px",B.style.setProperty("--column_resize_before_width",V+"px"),k(V)},[t,f,h,m,n,r]);O.useEffect(()=>{const C=x.current;if(C&&C.previousSibling){const j=C.previousSibling;c?(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")):n&&(j.style.minWidth=n+"px",j.style.width=n+"px",j.style.maxWidth=n+"px",j.style.setProperty("--column_resize_before_width",n+"px"))}},[c,n]),O.useEffect(()=>{const C=x.current;if(t&&C&&C.previousSibling){const j=C.previousSibling;c&&(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")),r&&(j.style.maxWidth=r+"px")}},[t,c,r]);const R=O.useCallback(()=>{document.addEventListener("mousemove",M),document.addEventListener("mouseup",P),document.addEventListener("touchmove",M),document.addEventListener("touchend",P)},[M,P]),A=O.useCallback(()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",P)},[M,P]);O.useEffect(()=>(t||R(),()=>{A()}),[t,R,A]);const $={userSelect:"none"};return t||($.cursor="ew-resize"),o===""&&($.width="6px",$.backgroundColor="rgba(0, 0, 0, 0.1)"),O.createElement("th",{ref:x,style:$,rowSpan:u,colSpan:d,className:"column_resizer_own_class ".concat(t?"disabled_column_resize":""," ").concat(o),onMouseDown:t?void 0:C=>T(C.screenX),onTouchStart:t?void 0:C=>T(C.touches[0].screenX)})};function rf({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=o?.length>20;return y.jsx(y.Fragment,{children:e?y.jsx(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t?.cellRenderer(n,{column:t,parent:r})}):y.jsx(y.Fragment,{children:i?y.jsx(ru,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:y.jsx(oe,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:y.jsx(at,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):y.jsx(oe,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}rf.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},J(Yc)(({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 Qr=J(at)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),Y4=J(Um)(({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)"})}})),q4=J(Oo)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),G4=J(Fc)(({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"}}));J(au)(({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 K4=J(c0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),of=J(Ym)(({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}})),Ml=J(Kh)(({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`}})),X4=J(Wa)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${su.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${su.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function Ci({children:e,...t}){return y.jsx(X4,{...t,children:e})}Ci.propTypes={children:s.node};const Z4=J(n0)(()=>({"&:last-child td":{borderBottom:"none"}}));function Xo({children:e,...t}){return y.jsx(Z4,{...t,children:e})}Xo.propTypes={children:s.node};const J4=O.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>y.jsx(Xo,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r?.(e),children:o},e?.fhi)),Q4=O.memo(({nestedData:e,nestedColumn:t,t:n})=>e?.length?y.jsx(y.Fragment,{children:e.map((r,o)=>y.jsx(Xo,{children:t.map((i,a)=>y.jsx(Ci,{style:i?.style,children:y.jsx(rf,{isRenderCellContent:!!i?.cellRenderer,column:i,row:r})},a))},`nested-${o}`))}):y.jsx(Xo,{children:y.jsx(Ci,{colSpan:t.length,children:y.jsx(Qr,{sx:{textAlign:"center"},children:n(Mr.NRF)})})})),eN=(e,t,n,r,o,i)=>{const[a,l]=O.useState({isOpen:!1,column:null}),c=(p,h,g)=>{l({isOpen:p.currentTarget,column:h,isChild:!!g})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(h=>{if(a?.isChild&&Array.isArray(h.children)){const g=h.children.map(b=>b.key===a.column?.key?{...b,isHidden:!0}:b),m=g.every(b=>b.isHidden);return{...h,isHidden:m?!0:h.isHidden,children:g}}return h.key===a.column?.key?{...h,isHidden:!0}:h});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:Re.SET_GRID_DATA,payload:{visibleGridColumns:p}});const h=r.split("/").filter(Boolean),g=JSON.parse(localStorage.getItem(cr.SETTINGS));let m=h.reduce((T,P)=>T?.[P],g)||null,b=Si({columns:p,childUniqueKey:i});const S=ur(m?.columns);b=b?.map(T=>{const P=T?.children||{},M=S?.[T?.key]?.children||{};return{...T,...(Object.keys(M)?.length>0||P?.[i])&&{children:{...M,[i]:P?.[i]}}}});const w={...g||{platform:{theme:"light"}}},v=m?.pageSize??o;let x=w;for(let T=0;T<h.length;T++){const P=h[T];T===h.length-1?x[P]={columns:b,pageSize:v}:(x[P]={...x[P]||{}},x=x[P])}localStorage.setItem(cr.SETTINGS,JSON.stringify(w)),await Pl({baseUrl:n,payload:w})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},tN=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>y.jsx(sr,{...i,styles:{...i.styles,iconPrimary:i?.styles?.variant=="filled"}}),select:i=>y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:i.styles?.width},children:y.jsx(rv,{...i,options:t})})};return o[r]?o[r](n):null},nN=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u?.[d],e)||null,a=Si({columns:t?.grid,childUniqueKey:r});const l=ur(i?.columns);a=a?.map(u=>{const d=u?.children||{},f=l?.[u?.key]?.children||{};return{...u,...(Object.keys(f)?.length>0||d?.[r])&&{children:{...f,[r]:d?.[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:t?.pageSize??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},rN=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=nN({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Pl({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},oN=({index:e,visibleGridColumns:t,width:n,columnUpdaterFunction:r})=>{if(!t||!t[e])return null;t[e];let o=`${n/10}rem`;const i=t.map((a,l)=>l===e?{...a,style:{...a.style,width:o,minWidth:o,maxWidth:o}}:a);return r({updatedColumns:i}),i[e]},Kv=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=wt(),d=async(f,p)=>{if(console.log("gridPath",p),!p)return;const h=p.split("/").filter(Boolean),g="settings",b={...JSON.parse(localStorage.getItem(g))||{}};let S=b;for(let k=0;k<h.length;k++){const w=h[k];k===h.length-1?S[w]={...S[w]||{},pageSize:f}:(S[w]={...S[w]||{}},S=S[w])}localStorage.setItem(g,JSON.stringify(b)),await Pl({baseUrl:n,payload:b})};return y.jsxs(oe,{sx:{display:"flex",p:"1rem 1.5rem"},children:[y.jsxs(oe,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[y.jsx(at,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{current:Math.min(o*i,a),total:a})}),y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:y.jsx(Yo,{options:D4,value:i,onChange:async f=>{c(f),d(f?.value,t)}})})]}),y.jsx(_m,{count:Math.ceil(a/i),page:o,onChange:async(f,p)=>{l(p)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.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 ${u.palette.primary.notifyBorderColor}`,color:u.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:u.palette.primary.notifyActiveText,backgroundColor:`${u.palette.brandColor.paginationBc} !important`}}})]})};Kv.propTypes={pagination:s.object.isRequired};const Xv=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=wt(),{t:o}=O.useContext(an);return y.jsx(zs,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:y.jsx(oe,{sx:{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(ja,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:o("LABEL_HIDE_COLUMN")})})})};Xv.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const Zv=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>y.jsx(ba,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:y.jsx(Gt,{url:i})});return y.jsx(y.Fragment,{children:o(t===e?n==="asc"?We.AscSort:We.DescSort:We.Unsort)})};Zv.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function Jv({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!t?.isMandatory||t?.isMandatory&&t?.showHide===!0),a=t?.label,l=t?.isSortable,c=n?.sortField,u=n?.sortDir,d=n?.onSort;return y.jsxs(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[y.jsx(oe,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:y.jsx(ru,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),y.jsxs(oe,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&y.jsx(Zv,{sortKey:e?`${e?.key}|${t?.key}`:t?.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),i&&y.jsx(ba,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:y.jsx(Gt,{url:We.Menu})})]})]})}Jv.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function Qv({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){const f=wt(),{visibleGridColumns:p}=O.useContext(ml),h=O.useContext(hi),{selectedColumn:g,handleMenuClick:m,handleClose:b,handleHideClick:S,columnUpdaterFunction:k}=eN(p,h,a,l,r?.rowPerPage,c),w=o?.isManageable,v=o?.isResizable,x=n?.length>0,T=O.useRef(null),P=O.useRef(null),M=45,R=10,A=n?.length,[$,C]=O.useState({start:0,end:10}),[j,N]=O.useState(null),[B,L]=O.useState(null),[V,Y]=O.useState(null);let U=null;const _=O.useRef(0),D=O.useRef(!1),W=O.useRef(null),q=W4(i?.column?.definitions||[]),Q=i?.isNested,te=i?.data||[],G=i?.hashKey,[Z,ie]=O.useState(0);O.useEffect(()=>{if(T.current){const ne=()=>{ie(T.current.offsetHeight)};return ne(),window.addEventListener("resize",ne),()=>window.removeEventListener("resize",ne)}},[n]),O.useEffect(()=>{const re=T.current?.querySelector("thead");if(!re)return;const ge=()=>{Y(null)};return re?.addEventListener("mousedown",ge),()=>{re?.removeEventListener("mousedown",ge)}},[]);const ae=(ne,re)=>{if(D.current){ne.preventDefault();return}N(re),Y(null),ne.dataTransfer.setData("colIndex",re);const ge=p[re],be=ge?.label,de=document.createElement("div");de.textContent=be,Object.assign(de.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:ge?.style?.minWidth,maxWidth:ge?.style?.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:f.palette.primary.notifyTextColor,background:f.palette.primary.notifyBackground,border:`0.1rem solid ${f.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(de);const{offsetWidth:Me,offsetHeight:Ie}=de;ne.dataTransfer.setDragImage(de,Me/2,Ie/2),requestAnimationFrame(()=>{document.body.removeChild(de)})},F=(ne,re)=>{ne.preventDefault(),L(re),we(ne)},z=async(ne,re)=>{if(ne.preventDefault(),clearInterval(U),j===null||j===re)return;const ge=[...p],[be]=ge.splice(j,1);ge.splice(re,0,be);const de=p.slice().sort((Ie,Ue)=>Ie.sequenceId-Ue.sequenceId).map(Ie=>Ie.sequenceId),Me=ge.map((Ie,Ue)=>({...Ie,sequenceId:de[Ue]??Ie.sequenceId}));k({updatedColumns:Me}),N(null),L(null)},I=()=>{N(null),L(null)},se=(ne,re,ge,be)=>{if(!ne)return null;const de=ne?.isMandatory&&ne?.isSticky,Me=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;re===0&&(_.current=0);const Ie=de?re===0?0:`${_.current}rem`:void 0;de&&(_.current+=Me);const Ue=j===re,ye=B==re||p?.[B]?.isMandatory,gt=Ye=>{ne.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),F?.(Ye,re)},lt=Ye=>{ne.isMandatory||z?.(Ye,re)};return be&&`${be?.key}${ne?.key}${re}`,y.jsx(Ci,{rowSpan:ne?.children?1:2,colSpan:ne?.children?.filter(Ye=>!Ye?.isHidden)?.length,style:ne?.style,draggable:ge&&!ne?.isMandatory,onDragStart:ge&&!ne?.isMandatory?Ye=>ae(Ye,re):Ye=>{Ye.preventDefault()},onDragOver:ge&&!ne?.isMandatory?gt:void 0,onDrop:ge&&!ne?.isMandatory?lt:void 0,onDragEnd:ge&&!ne?.isMandatory?I:void 0,sx:{...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...Ue&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...de&&{position:"sticky",left:Ie,zIndex:3},cursor:ye?"not-allowed":ge&&!ne?.isMandatory?"grab":"default"},children:y.jsx(Jv,{parent:be,column:ne,sort:t,handleMenuClick:m,isManageable:ge})},re)},ee=O.useCallback((ne,re,ge,be)=>{if(!ne)return null;const de=ne?.isMandatory&&ne?.isSticky,Me=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;ge===0&&(_.current=0);const Ie=de?ge===0?0:`${_.current}rem`:void 0;return de&&(_.current+=Me),y.jsxs(Ci,{colSpan:1,style:ne?.style,className:`${ne?.label}`,sx:{position:"relative",...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...de&&{position:"sticky",left:Ie,zIndex:2,backgroundColor:Ue=>e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh?Ue.palette.primary.appBackground:Ue.palette.primary.notifyBackground}},children:[(e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh)&&y.jsx(oe,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),y.jsx(rf,{isRenderCellContent:!!ne?.cellRenderer,column:ne,row:re,parent:be})]},ge)},[e?.selectedRow,f]),le=(ne,re,ge,be)=>y.jsx(y.Fragment,{children:ne&&ge&&!ne?.isMandatory?y.jsx(oe,{resizeStart:()=>{ne?.isMandatory&&!ne?.isResizable||(D.current=!0)},resizeEnd:de=>{ne?.isMandatory&&!ne?.isResizable||de<=20||(D.current=!1,oN({index:re,visibleGridColumns:p,width:de,columnUpdaterFunction:k}))},component:ne?.children||ne?.isMandatory?Wa:U4,rowSpan:ne?.children?1:2,colSpan:1,id:re,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1},...!ne?.isMandatory&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${Z}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),De=O.useCallback((ne,re,ge,be,de,Me,Ie)=>y.jsx(y.Fragment,{children:re&&be&&!re?.isMandatory?y.jsx(Wa,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`},children:(e?.selectedRow&&e?.selectedRow?.fhi===ne?.fhi||ne?.isHigh)&&y.jsx(oe,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ge}_${Ie}`):null}),[e?.selectedRow,f]),we=ne=>{const re=T.current,{left:ge,right:be}=re.getBoundingClientRect(),de=50,Me=ne.clientX>be-de?1:ne.clientX<ge+de?-1:0;Me!==0?(W.current&&clearInterval(W.current),W.current=setInterval(()=>{re.scrollLeft+=Me*10},50)):W.current&&(clearInterval(W.current),W.current=null)},Be=ne=>ne?.map((re,ge)=>{const be=$.start+ge,de=re[G],Me=te?.[de],Ie=e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi,Ue=re?.isHigh;return y.jsxs(O.Fragment,{children:[y.jsx(J4,{row:re,isSelected:Ie,isHigh:Ue,onRowClick:e?.onRowClick,children:p.map((ye,gt)=>ye?.isHidden||ye?.isVisible===!1?null:ye?.children?ye.children.map((lt,Ye)=>lt?.isHidden?null:y.jsxs(O.Fragment,{children:[ee(lt,re,Ye,ye),v&&De(re,lt,Ye,w,ye,"",be)]},`col-${gt}-${Ye}`)):y.jsxs(O.Fragment,{children:[ee(ye,re,gt),v&&De(re,ye,gt,w,"","",be)]},`col-${gt}`))}),Q&&Me&&y.jsx(Q4,{nestedData:Me,nestedColumn:q,t:d})]},`row-${be}`)}),je=()=>{const ne=P.current;if(!ne)return;const re=ne.scrollTop,ge=ne.clientHeight,be=Math.floor(re/M)-R,de=Math.ceil(ge/M)+2*R,Me=Math.max(0,Math.min(A-1,be)),Ie=Math.max(Me,Math.min(A,Me+de));C(Ue=>Ue.start===Me&&Ue.end===Ie?Ue:{start:Me,end:Ie})};O.useEffect(()=>{let ne;const re=()=>{ne&&cancelAnimationFrame(ne),ne=requestAnimationFrame(()=>{je()})},ge=P.current;if(!(!ge||!u))return je(),ge.addEventListener("scroll",re),()=>{cancelAnimationFrame(ne),ge.removeEventListener("scroll",re)}},[A]);const ze=$.start*M,Ae=(A-$.end)*M,he=u?n?.slice($.start,$.end):n;return x?y.jsxs(y.Fragment,{children:[y.jsx(Zm,{ref:P,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:y.jsxs(Gm,{ref:T,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:ne=>ne.palette.primary.notifyBackground},children:[y.jsxs(Qm,{children:[y.jsx(Xo,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:ne=>ne.palette.primary.notifyBackground},children:p.map((ne,re)=>ne?.isHidden||ne?.isVisible===!1?null:y.jsxs(O.Fragment,{children:[se(ne,re,w),le(ne,re,w)]},re))}),y.jsx(Xo,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((ne,re)=>ne?.isHidden||!ne?.children||ne?.isVisible===!1?[]:ne.children.map((ge,be)=>ge?.isHidden?null:y.jsxs(O.Fragment,{children:[se(ge,be,w,ne),v&&le(ge,be,w)]},`${re}-${be}`)))})]}),y.jsxs(Xm,{children:[u&&y.jsx("tr",{style:{height:ze}}),Be(he),u&&y.jsx("tr",{style:{height:Ae}})]})]})}),r&&y.jsx(Kv,{pagination:r,gridPath:l,baseUrl:a,t:d}),y.jsx(Xv,{menuOpen:g?.isOpen,handleClose:b,onHideClick:S})]}):y.jsx(Qr,{sx:{textAlign:"center"},children:d(Mr.NRF)})}Qv.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function e2({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o}){const{columns:i}=e,a=O.useContext(hi),{t:l}=O.useContext(an),c=V4({columns:i,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:e?.pagination?.rowPerPage,data:e?.data});return O.useEffect(()=>{c?.length&&e?.data?.length&&a?.({type:Re.SET_GRID_DATA,payload:{visibleGridColumns:c}})},[c,e?.data]),y.jsx(Qv,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l})}e2.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const t2=({type:e})=>{const r=wt()?.mode==="dark"?{bgcolor:"grey.800"}:{};return{grid:y.jsxs(oe,{sx:{borderRadius:2,overflow:"hidden"},children:[y.jsx(nr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>y.jsx(oe,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>y.jsx(oe,{sx:{flex:1},children:y.jsx(nr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:y.jsx(y.Fragment,{children:y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},sN=({customTools:e})=>{const t=e?.filter(r=>r?.type===qv.PRIMARY)?.sort((r,o)=>r.sequenceId-o.sequenceId),n=e?.filter(r=>r?.type===qv.SECONDARY)?.sort((r,o)=>r.sequenceId-o.sequenceId);return{primaryButtons:t,secondaryButtons:n}},n2=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=sN({customTools:e}),[i,a]=O.useState(r),l=o?.length>0,{t:c}=O.useContext(an),u=f=>{f?a([...r,...o]):setTimeout(()=>{a(r)},100)},d=()=>{const f=!t;n(f),u(f)};return O.useEffect(()=>{u(t)},[e]),y.jsxs(y.Fragment,{children:[t&&y.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),y.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[y.jsx(JP,{mode:"popLayout",children:i.map((f,p)=>y.jsx(Fo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:y.jsx(oe,{sx:{flexShrink:0,minWidth:"fit-content"},children:tN(f)})},`${f.id}_${p}`))}),l&&y.jsx(oe,{sx:{paddingLeft:t?"0.5rem":0},children:y.jsx(sr,{label:t?"":c("LABEL_MORE_ACTIONS"),styles:{iconPrimary:!0,icon:t?We.CrossWhite:We.More,colorType:t?"danger":""},onClick:d})})]})]})};n2.propTypes={customTools:s.array.isRequired};const r2=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{const{t:c}=O.useContext(an),u=O.useContext(hi),{visibleGridColumns:d,triggerApi:f}=O.useContext(ml),[p,h]=O.useState([]),[g,m]=O.useState(!1);O.useEffect(()=>{if(d.length){const w={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:"Horizons",isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let v=d.map(T=>(T?.children&&T.children.forEach(P=>{w.children.some(R=>R.key===P.key)||w.children.push({...P,showInHierarchy:!0})}),T)).filter(T=>T?.id!==w?.id);const x=w.children.length>0?[...v,w]:v;h(x)}},[d]);const b=async w=>{try{await rN({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:w,pageSize:i}})}catch(v){console.error(v)}finally{u({type:Re.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),u({type:Re.TRIGGER_API,payload:{triggerApi:!1}})}};O.useEffect(()=>{f&&b(d)},[f]);const S=w=>{const v=w?.map(P=>P.id),x=w?.flatMap(P=>P.children||[])?.map(P=>P.id),T=p?.map(P=>{const M=v?.includes(P.id);if(Array.isArray(P.children)&&P.children.length>0){const A=P?.children?.map(C=>{const j=x?.includes?.(C.id);return{...C,isHidden:!j}}),$=A?.filter(C=>p?.some(j=>j.children?.some(N=>N.id===C.id)))?.every(C=>C.isHidden);return{...P,...!P.children[0]?.showInHierarchy&&{isHidden:$||!M},children:A}}return{...P,isHidden:!M}});u({type:Re.SET_GRID_DATA,payload:{visibleGridColumns:T}}),u({type:Re.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},k=()=>p.map(v=>{const x=Array.isArray(v.children)?v.children.filter(T=>!T.isHidden):void 0;return!v.isHidden||v.isHidden&&v.showInHierarchy?{...v,children:x}:null}).filter(Boolean);return y.jsxs(oe,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[y.jsxs(oe,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[e?.search?.isRequired&&y.jsx(nv,{...e?.search,iconUrl:We.Search}),e?.refresh?.isRequired&&y.jsx(sr,{...e?.refresh,styles:{variant:"filled",icon:We.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),e?.groupBy?.isRequired&&y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Yo,{styles:{icon:We.Group},...e.groupBy})}),t&&y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Yo,{placeholder:c("LABEL_MANAGE_COLUMN"),options:p,value:k(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:S,disabled:!a.length,styles:{icon:We.Manage}})})]}),y.jsxs(oe,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&y.jsx(n2,{customTools:n,setIsExpanded:m,isExpanded:g}),e?.save?.isRequired&&y.jsx(oe,{sx:{px:"0.5rem"},children:y.jsx(sr,{label:g?"":"Save",styles:{icon:We.Save,colorType:"empty"},...e?.save})}),e?.upload?.isRequired&&y.jsx(sr,{...e?.upload,styles:{variant:g?"outlined":"filled",icon:g?We.UploadDark:We.Upload,iconPrimary:!g,colorType:"secondary",isAnimate:!0}}),e?.download?.isRequired&&y.jsx(sr,{...e?.download,styles:{variant:"outlined",icon:We.Download,isAnimate:!0}})]})]})};r2.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function sf({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){const o=e.columns?.isManageable;return y.jsx(Jb,{children:r?y.jsxs(y.Fragment,{children:[t&&y.jsx(t2,{type:"toolbar"}),e&&y.jsx(t2,{type:"grid"})]}):y.jsxs(oe,{sx:{position:"sticky"},children:[t&&y.jsx(r2,{...t,isManageable:o,pageSize:e?.pagination?.rowPerPage,gridData:e?.data}),y.jsx(e2,{tableProps:e,isDefaultConfig:n,gridPath:t?.gridPath||"",baseUrl:t?.baseUrl||"",childUniqueKey:t?.childUniqueKey||""})]})})}sf.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const o2=({list:e,handleLinkClick:t})=>{const n=wt(),{t:r}=O.useContext(an),o=({list:i})=>i?.sort((a,l)=>a.order-l.order)?.map((a,l)=>a?.link?y.jsx(Wr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a?.link,underline:"hover",onClick:()=>t(a),children:r(a?.title)},l):y.jsx(at,{component:"h3",sx:{fontSize:"1rem",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:r(a?.title)},l));return y.jsx(om,{separator:y.jsx(Gt,{url:We.ArrowRight}),children:o({list:e})})};o2.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const s2=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{const o=wt(),{t:i}=O.useContext(an),a=n?.filterBtnProps?.disabled;return y.jsxs(y.Fragment,{children:[y.jsxs(He,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[y.jsx(o2,{...e}),y.jsxs(He,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&y.jsx(sv,{...t}),n?.filterBtnProps&&y.jsxs(He,{direction:"row",children:[y.jsx(Oo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),y.jsxs(He,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:n?.filterBtnProps?.onFilterClick,sx:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[y.jsx(Gt,{url:We.Filter}),y.jsx(at,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:i(n?.filterBtnProps?.label)})]})]})]})]}),y.jsx(Fo.div,{layout:!0,initial:{height:"0rem"},animate:{height:n?.filterBtnProps?.filterContainerVisible?"5rem":"0rem",opacity:n?.filterBtnProps?.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden",width:n?.filterContainerProps?.isSideDrawerOpen?"75%":"100%"},children:y.jsxs(He,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[y.jsxs(at,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:[n?.labels?.description||i("Filters")," :"]}),y.jsx(oe,{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(He,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:n?.filterItems?.map((l,c)=>y.jsx(y.Fragment,{children:y.jsxs(oe,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,background:o.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[y.jsx(oe,{component:"img",src:We.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n?.onFilterChipClose(l)}),y.jsx(at,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:l?.filterLabel})]},c)}))})}),y.jsx(oe,{component:at,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:n?.filterContainerProps?.onClearClick,children:n?.labels?.button||i("Clear")})]})})]})};s2.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function i2({headerProps:e}){return y.jsx(rn,{children:y.jsx(s2,{...e})})}i2.propTypes={headerProps:s.object.isRequired};const af=O.createContext(null),a2=O.createContext(null);function l2({children:e}){const[t,n]=O.useReducer(iN,aN);return y.jsx(af.Provider,{value:t,children:y.jsx(a2.Provider,{value:n,children:e})})}function iN(e,t){switch(t.type){case Re.LOADING:return{...e,loading:t.loading};case Re.SUCCESS:return{...e,data:t.data?.sort((n,r)=>new Date(r.createdAt)-new Date(n.createdAt))};case Re.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case Re.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case Re.SET_MODE:return{...e,mode:t.mode};case Re.ERROR:return{...e,error:t.error};default:throw new Error(`${Mr.UNHANDLED}: ${t}`)}}const aN={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:lf,BU_ID:cf}=Yv,{TENANT_IDS:uf,BU_IDS:df}=Gv,lN=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${El.NOTIFICATION}/v1?${lf}=${uf}&${cf}=${df}&lang=${t}`;return await dt.get(n,wi)}catch(t){return t}},c2=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${El.NOTIFICATION}${ef.VERSION}?${lf}=${uf}&${cf}=${df}&lang=${r}`;return await dt.put(o,t,wi)}catch(r){return r}},cN=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${El.NOTIFICATION}${ef.VERSION}?${lf}=${uf}&${cf}=${df}&id=${t}&lang=${r}`;return await dt.get(o,wi)}catch(r){return r}},Zo={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},u2=({baseUrl:e})=>{const t=O.useContext(a2),[n,r]=O.useState(!1),[o,i]=O.useState(!1),[a,l]=O.useState(!1),[c,u]=O.useState({}),[d,f]=O.useState(null),[p,h]=O.useState(1),g=O.useRef(!1),{loading:m,data:b,isMarkAllAsRead:S,mode:k,activeTab:w}=O.useContext(af),[v,x]=O.useState([]);O.useEffect(()=>{x(b)},[b]);const T=O.useCallback(async()=>{if(!(g.current||!e))try{t({type:Re.LOADING,loading:!0}),t({type:Re.SUCCESS,data:[]});const j=await lN(e);if(j.status===Zo.UNAUTHORIZED){g.current=!0;return}if(j.status===Zo.OK){const N=j.data?.responseData?.response||[],B=hl(N);t({type:Re.SET_MODE,mode:!1}),t({type:Re.SUCCESS,data:hl(B)}),t({type:Re.MARK_ALL_AS_READ,isMarkAllAsRead:{count:Zb(N),boo:Zb(N)>0}}),t({type:Re.LOADING,loading:!1})}}catch(j){j?.response?.status===Zo.UNAUTHORIZED&&(g.current=!0),t({type:Re.ERROR,error:Mr.SWR}),t({type:Re.LOADING,loading:!1})}},[e,t]),P=j=>{const N=(b||[]).filter(B=>k?!B.isRead:!0);return{0:N,1:N.filter(B=>B?.type==="INFO"),2:N.filter(B=>B?.type==="ERROR")}};O.useEffect(()=>{T();const j=setInterval(T,3e5);return()=>clearInterval(j)},[T]);const M=async(j,N)=>{if(!(!j||!e)){f(j);try{const B=await cN({baseUrl:e,id:j,snopId:N});if(B.status===Zo.OK){const L=B.data?.responseData?.response||{};u(L||{}),l(!0)}else throw new Error}catch{t({type:Re.ERROR,error:Mr.SWR})}finally{f(null)}}},R=async(j,N)=>{if(!(!j.length||!e)){t({type:Re.LOADING,loading:!0});try{if((await c2(e,j,N)).status===Zo.OK){const L=b.map(Y=>j.includes(Y.id)?{...Y,isRead:!0}:Y),V=L.filter(Y=>!Y.isRead).length;V===0&&t({type:Re.SET_MODE,mode:!1}),t({type:Re.SUCCESS,data:hl(L)}),t({type:Re.MARK_ALL_AS_READ,isMarkAllAsRead:{count:V,boo:V>0}}),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},200)}}catch{t({type:Re.ERROR,error:Mr.SWR}),t({type:Re.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:Re.LOADING,loading:!0});try{const j=P9(b);if((await c2(e,j,R4.MARK_ALL_READ)).status===Zo.OK){const B=b.map(L=>({...L,isRead:!0}));t({type:Re.SET_MODE,mode:!1}),t({type:Re.SUCCESS,data:hl(B)}),t({type:Re.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},200)}}catch{t({type:Re.ERROR,error:Mr.SWR}),t({type:Re.LOADING,loading:!1})}}},$=(j,N)=>{t({type:Re.LOADING,loading:!0}),t({type:Re.SET_ACTIVE_TAB,activeTab:N}),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},400)},C=()=>{t({type:Re.LOADING,loading:!0});const j=k?b||[]:(v||[]).filter(N=>!N.isRead);t({type:Re.SET_MODE,mode:!k}),x(j),h(1),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},400)};return{fetchNotification:T,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:T,handleRead:R,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:M,clickId:d,isMainDialog:!0},activeTab:w,loading:m,tabData:P()[w],data:v,mode:k,handleTabChange:$,toggleAlertMode:C,page:p,setPage:h,isMarkAllAsRead:S}};var d2,f2,p2;function ff(){return ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ff.apply(null,arguments)}var uN=function(t){return E.createElement("svg",ff({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),d2||(d2=E.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"})),f2||(f2=E.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"})),p2||(p2=E.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 dN=({count:e})=>(wt(),y.jsxs(y.Fragment,{children:[y.jsx(oe,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:y.jsx(uN,{style:{scale:1.2}})}),y.jsx(G4,{badgeContent:e!=0?"":null,color:"error"})]}));function h2({children:e,handleClose:t,open:n,isMainDialog:r}){return y.jsx(Yc,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var m2;function pf(){return pf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pf.apply(null,arguments)}var fN=function(t){return E.createElement("svg",pf({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),m2||(m2=E.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"})))},g2,y2;function hf(){return hf=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},hf.apply(null,arguments)}var pN=function(t){return E.createElement("svg",hf({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),g2||(g2=E.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"})),y2||(y2=E.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"})))},b2;function mf(){return mf=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},mf.apply(null,arguments)}var hN=function(t){return E.createElement("svg",mf({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),b2||(b2=E.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 v2=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{const l=wt(),c=JSON.parse(localStorage.getItem("settings"))?.platform?.theme;return y.jsxs(oe,{className:"cards",sx:{pt:" 0.8rem"},children:[y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:y.jsx(Fc,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t?.isRead,children:y.jsx(Qr,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",t?.isRead&&"read"].join(" "),children:a(t?.message)})})}),y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:y.jsxs(He,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[t?.isNotificationDetails&&y.jsx(Ml,{icon:y.jsx(pN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===t?.id?y.jsx(yo,{color:"primary",size:13}):a("SHOW_DETAILS"),component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:l.palette.brandColor.orange,color:l.palette.brandColor.white}}),!t?.isRead&&y.jsx(Ml,{icon:y.jsx(hN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:a("ACKNOWLEDGE"),component:"button",variant:"outlined",clickable:!0,size:"small"}),t?.primaryCTAURL&&y.jsx(Ml,{disabled:t?.isPrimaryCTAClicked,onClick:()=>o({redirect:t?.isPrimaryCTARedirect,isClicked:t?.isPrimaryCTAClicked,url:t?.primaryCTAURL}),label:a(t?.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),t?.secondaryCTAURL&&y.jsx(Ml,{disabled:t?.isSecondaryCTAClicked,onClick:()=>o({redirect:t?.isSecondaryCTARedirect,isClicked:t?.isSecondaryCTAClicked,url:t?.secondaryCTAURL}),label:a(t?.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),y.jsxs(He,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[y.jsx(Qr,{sx:{fontSize:"0.8rem"},children:a(t?.product)}),y.jsx(Qr,{color:l.palette.primary.notifyTextColor,children:"•"}),y.jsx(Qr,{sx:{fontSize:"0.8rem"},children:O9(t?.createdAt,a)})]})]})};v2.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Rl=60,x2=2,w2=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,t:i})=>{const{isMarkAllAsRead:a}=O.useContext(af),l=O.useRef(null),[c,u]=O.useState({start:0,end:4}),d=e?.length,f=new Date,p=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(f),h=O.useMemo(()=>o?a?.count?e?.filter(v=>!v.isRead):[]:e||[],[e,o,a]),g=h.slice(c.start,c.end),m=c.start*Rl,b=(d-c.end)*Rl,S=()=>{const v=l.current;if(!v)return;const x=v.scrollTop,T=v.clientHeight,P=Math.floor(x/Rl)-x2,M=Math.ceil(T/Rl)+2*x2,R=Math.max(0,Math.min(d-1,P)),A=Math.max(R,Math.min(d,R+M));u($=>$.start===R&&$.end===A?$:{start:R,end:A})},k=({url:v})=>{window.open(v,"_blank")},w=O.useMemo(()=>D9(g),[g]);return O.useEffect(()=>{let v;const x=()=>{v&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{S()})},T=l.current;if(T)return S(),T.addEventListener("scroll",x),()=>{cancelAnimationFrame(v),T.removeEventListener("scroll",x)}},[d]),h.length||i("CONTAINER_MESSAGE"),y.jsxs(oe,{ref:l,sx:{height:"100%",overflowY:"auto"},children:[y.jsx(oe,{style:{height:m}}),Object.entries(w).map(([v,x])=>{const T=localStorage.getItem("i18nextLng"),P=new Date(v),M=new Intl.DateTimeFormat(T,{month:"long"}).format(P),R=P.getDate(),A=P.getFullYear(),$=`${M} ${R}, ${A}`;return y.jsxs(O.Fragment,{children:[v!==p&&y.jsx(q4,{children:$}),x.map((C,j)=>y.jsx(v2,{item:C,handleCTAClicked:k,handleShowDetails:()=>n(C.id,C.snopId),handleRead:()=>t([C.id],C.snopId),clickId:r,t:i},`${C.id}_${j}`))]},v)}),y.jsx(oe,{style:{height:b}})]})};w2.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const mN=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:h,toggleAlertMode:g}=u2({});return y.jsxs(y.Fragment,{children:[y.jsxs(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[y.jsx(at,{variant:"h2",sx:{fontSize:"1.2rem",color:m=>m.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),y.jsx(oe,{onClick:e,children:y.jsx(Gt,{url:We.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),y.jsx(oe,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:m=>m.palette.primary.notifyBorderColor},children:y.jsxs(K4,{value:l,onChange:h,children:[y.jsx(of,{label:y.jsx(oe,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(at,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:c?.filter(m=>!m?.isRead)?.length||0})})})}),y.jsx(of,{label:y.jsx(oe,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(at,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:c?.filter(m=>m?.type==="INFO"&&!m?.isRead)?.length||0})})}),sx:{color:m=>m.palette.brandColor.blue}}),y.jsx(of,{label:y.jsx(oe,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:c?.filter(m=>m?.type==="ERROR"&&!m?.isRead)?.length||0})}),sx:{color:m=>m.palette.brandColor.red}})]})}),y.jsx(Gc,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:m=>m.palette.primary.notifyBorderColor},tabIndex:-1,children:a&&!u.length?y.jsx(oe,{sx:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:y.jsx(yo,{size:30,sx:{color:m=>m.palette.primary.notifyIconColor}})}):y.jsx(y.Fragment,{children:y.jsx(w2,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),y.jsxs(qc,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[y.jsxs(He,{direction:"row",gap:1,children:[y.jsx(Qr,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),y.jsx(Y4,{disabled:a,checked:d,onChange:g})]}),y.jsx(ja,{variant:"outlined",className:"view-all",onClick:o,startIcon:y.jsx(fN,{}),disabled:!c?.filter(m=>!m?.isRead)?.length,style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:m=>m.palette.primary.notifyTextColor,"&:hover":{color:m=>m.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:m=>`${m.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},gN=({data:e,handleClose:t,t:n})=>{const[r,o]=O.useState(1),[i,a]=O.useState(10),[l,c]=O.useState(e?.notificationDetails?.length||0),[u,d]=O.useState("sku_name"),[f,p]=O.useState("asc"),[h,g]=O.useState([]),[m,b]=O.useState("");return O.useEffect(()=>{if((m||u)&&e?.notificationDetails?.length){const S=M9(e?.notificationDetails,P4,m);if(u){const k=R9(S,u,f);g(Fd(k,r,i)),c(k?.length||0);return}g(Fd(S,r,i)),c(S?.length||0);return}g(Fd(e?.notificationDetails,r,i)),c(e?.notificationDetails?.length)},[m,e,r,i,f,u]),y.jsxs(y.Fragment,{children:[y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[y.jsx(at,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:n(e?.message)||e?.message}),y.jsx(oe,{onClick:t,sx:{cursor:"pointer"},children:y.jsx(Gt,{url:We.CloseCircle})})]}),y.jsx(Gc,{children:y.jsx(sf,{t:n,tableProps:{data:h,columns:{...H4({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:S=>{const k=S?.column?.key;p(w=>u===k&&w==="asc"?"desc":"asc"),d(k)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:S=>{o(S)},onPageSizeChange:S=>{a(S?.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:S=>{const k=S.target.value;k&&o(1),b(k)},placeholder:`${n("SEARCH")}...`}}}})}),y.jsx(qc,{sx:{padding:"1.5rem 2rem"}})]})},yN=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=u2({baseUrl:e});return y.jsxs(y.Fragment,{children:[y.jsx(oe,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{o(),n?.setOpen?.(!0)},children:y.jsx(dN,{count:i.count})}),y.jsx(h2,{...n,children:y.jsx(mN,{...n,t})}),y.jsx(h2,{...r,children:y.jsx(gN,{...r,t})})]})},bN=({baseUrl:e,t})=>y.jsx(rn,{children:y.jsx(l2,{children:y.jsx(yN,{baseUrl:e,t})})}),vN=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f,isCloseVisible:p=!0})=>{const h=wt();return y.jsx(oe,{sx:{position:"relative",overflow:"hidden"},children:y.jsxs(_s,{container:!0,sx:{height:"100%"},children:[y.jsx(_s,{item:!0,sx:{width:n?d?.drawerWidth?`calc(${"100%"-d?.drawerWidth})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&y.jsx(y.Fragment,{children:y.jsx(oe,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}})}),e&&y.jsxs(_s,{item:!0,sx:{width:u?"90%":d?.drawerWidth||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:h.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 ${h.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[y.jsxs(He,{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(oe,{component:"img",src:We.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),y.jsx(Oo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:h.palette.primary.notifyBorderColor}})]}),y.jsxs(He,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[y.jsxs(He,{direction:"row",gap:"0.5rem",alignItems:"center",sx:{cursor:"pointer"},children:[p&&y.jsx(oe,{onClick:a,children:y.jsx(Gt,{url:We.CrossLight})}),y.jsx(at,{sx:{fontSize:"1.2rem",color:h.palette.primary.notifyTextColor},children:o})]}),y.jsx(He,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&y.jsx(oe,{onClick:c,sx:{cursor:"pointer"},children:y.jsx(oe,{component:"img",src:u?We.Collapse:We.Expand})})})]})]}),y.jsx(oe,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},S2=({layoutChildren:e,layoutProps:t})=>y.jsx(rn,{children:y.jsx(vN,{...e,...t})});S2.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const C2=({parentProps:e,childProps:t})=>{const n=wt();return y.jsxs(He,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[y.jsx(He,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{maxHeight:"10rem",p:"1.5rem",cursor:"pointer",zIndex:4},onClick:t.toggleExpand,children:e.content}),y.jsx(Fo.div,{layout:!0,initial:{opacity:0,maxHeight:0},animate:{opacity:t.isExpanded?1:0,maxHeight:t.isExpanded?"50rem":0},transition:{duration:.5,ease:"easeInOut"},style:{background:n.palette.primary.notifyBackground,overflow:"hidden",display:"flex",flexDirection:"column",width:"100%"},children:y.jsx(oe,{sx:{p:"1rem"},children:t.content})})]})};C2.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const T2=({accordionProps:e})=>y.jsx(rn,{children:y.jsx(l2,{children:y.jsx(C2,{...e})})});T2.propTypes={accordionProps:s.object.isRequired};const k2=O.createContext(null),xN=k2.Provider,wN=()=>{const e=O.useContext(k2);return e||console.warn("useAnalytics used outside AnalyticsProvider"),e};ct.Accordion=T2,ct.AnalyticsProvider=xN,ct.Button=sr,ct.Checkbox=cl,ct.DatePicker=F9,ct.Grid=sf,ct.Header=i2,ct.InputField=nv,ct.Loader=Q9,ct.Notification=bN,ct.Select=rv,ct.SliderLayout=S2,ct.Switch=sv,ct.TextField=fl,ct.ToastProvider=G9,ct.TranslationContext=an,ct.toast=H9,ct.useAnalytics=wN,Object.defineProperty(ct,Symbol.toStringTag,{value:"Module"})}));
|
|
256
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Zr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&kl.assertOptions(r,{silentJSONParsing:Kn.transitional(Kn.boolean),forcedJSONParsing:Kn.transitional(Kn.boolean),clarifyTimeoutError:Kn.transitional(Kn.boolean)},!1),o!=null&&(H.isFunction(o)?n.paramsSerializer={serialize:o}:kl.assertOptions(o,{encode:Kn.function,serialize:Kn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),kl.assertOptions(n,{baseUrl:Kn.spelling("baseURL"),withXsrfToken:Kn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&H.merge(i.common,i[n.method]);i&&H.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=Xt.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,p;if(!c){const g=[Vv.bind(this),void 0];for(g.unshift(...l),g.push(...u),p=g.length,d=Promise.resolve(n);f<p;)d=d.then(g[f++],g[f++]);return d}p=l.length;let h=n;for(;f<p;){const g=l[f++],m=l[f++];try{h=g(h)}catch(b){m.call(this,b);break}}try{d=Vv.call(this,h)}catch(g){return Promise.reject(g)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Zr(this.defaults,t);const n=Rv(t.baseURL,t.url,t.allowAbsoluteUrls);return wv(n,t.params,t.paramsSerializer)}};H.forEach(["delete","get","head","options"],function(t){Jr.prototype[t]=function(n,r){return this.request(Zr(r||{},{method:t,url:n,data:(r||{}).data}))}}),H.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,l){return this.request(Zr(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Jr.prototype[t]=n(),Jr.prototype[t+"Form"]=n(!0)});let k4=class O2{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 Ko(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 O2(function(o){t=o}),cancel:t}}};function E4(e){return function(n){return e.apply(null,n)}}function O4(e){return H.isObject(e)&&e.isAxiosError===!0}const Qd={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Qd).forEach(([e,t])=>{Qd[t]=e});function Hv(e){const t=new Jr(e),n=iv(Jr.prototype.request,t);return H.extend(n,Jr.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Hv(Zr(e,o))},n}const dt=Hv(vi);dt.Axios=Jr,dt.CanceledError=Ko,dt.CancelToken=k4,dt.isCancel=Ev,dt.VERSION=Wv,dt.toFormData=xl,dt.AxiosError=Le,dt.Cancel=dt.CanceledError,dt.all=function(t){return Promise.all(t)},dt.spread=E4,dt.isAxiosError=O4,dt.mergeConfig=Zr,dt.AxiosHeaders=Xt,dt.formToJSON=e=>Tv(H.isHTMLForm(e)?new FormData(e):e),dt.getAdapter=Fv.getAdapter,dt.HttpStatusCode=Qd,dt.default=dt;const{Axios:E$,AxiosError:O$,CanceledError:P$,isCancel:M$,CancelToken:R$,VERSION:D$,all:A$,Cancel:j$,isAxiosError:I$,spread:N$,toFormData:$$,AxiosHeaders:B$,HttpStatusCode:L$,formToJSON:_$,getAdapter:F$,mergeConfig:V$}=dt,ef={BASE_URL:"https://qa.3sc.ai/api",VERSION:"/v1"},wi={headers:{"Content-Type":"application/json"},withCredentials:!0},Uv=dt.create({baseURL:ef.BASE_URL,axiosConfig:wi});Uv.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),Uv.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});const cr={TOKEN:"token",USER:"user",SNOP:"snop",SELECTED_BU:"selected_business_unit",SETTINGS:"settings"},Yv={TENANT_ID:"tenant_id",BU_ID:"bu_id"},P4=Object.values({"SKU Name":"sku_name",Node:"node","Channel Name":"channel_name"}),M4=[10,25,50,100],R4={MARK_ALL_READ:"MARK_ALL_READ"},D4=M4.map(e=>({label:e,value:e})),qv={PRIMARY:"PRIMARY",SECONDARY:"SECONDARY"},El={NOTIFICATION:"/notifications",SETTING:"/configuration/setting"};function Ol(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 A4={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 tf(e,t){function n(o,i,a){if(!(typeof document>"u")){a=Ol({},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,"",Ol({},i,{expires:-1}))},withAttributes:function(o){return tf(this.converter,Ol({},this.attributes,o))},withConverter:function(o){return tf(Ol({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var j4=tf(A4,{path:"/"});const I4=pl(cr.SNOP),N4=pl(cr.SELECTED_BU),$4=pl(cr.USER);pl(cr.SETTINGS);const Gv={BU_IDS:N4?.business_unit_id,TOKEN:JSON.parse(j4.get(cr.TOKEN)||null),TENANT_IDS:$4?.tenant_id,SNOP_IDS:I4?.snop_id},{TENANT_ID:B4,BU_ID:L4}=Yv,{TENANT_IDS:_4,BU_IDS:F4}=Gv,Pl=async({baseUrl:e,payload:t})=>{console.log("setting api",e,t);try{const n=`${e}${El.SETTING}/v1?${B4}=${_4}&${L4}=${F4}`;return await dt.post(n,t,wi)}catch(n){return n}},V4=({columns:e,gridPath:t,baseUrl:n,isDefaultConfig:r,pageSize:o=10,childUniqueKey:i,data:a})=>{const l=a?.length;let{definitions:c,defaultUserSettings:u,labels:d}=e;const f=ur(d),p=t.split("/").filter(Boolean),h=JSON.parse(localStorage.getItem(cr.SETTINGS));let g=p.reduce((w,v)=>w?.[v],h)||null;const m=ur(g?.columns||[]);if(!r&&t&&l){let w=(u&&nf({col:u,childUniqueKey:i,definitions:c}))??nf({col:c,childUniqueKey:i});const v=w.filter(T=>!m[T.key]),x=g&&g?.columns?.some(T=>T?.children&&T.children[i]);if(l&&(v.length||i&&x===!1)){if(x==!1&&i.length>0){const T=ur(w);w=g?.columns?.map(P=>P?.children&&!P.children[i]?{...P,children:{...P.children,[i]:T?.[P?.key]?.children[i]}}:P)}(async()=>{try{const P={...h||{platform:{theme:"light"}}},M=g?.pageSize??o;let R=P;for(let A=0;A<p.length;A++){const $=p[A];A===p.length-1?R[$]={columns:w,pageSize:M}:(R[$]={...R[$]||{}},R=R[$])}localStorage.setItem(cr.SETTINGS,JSON.stringify(P)),await Pl({baseUrl:n,payload:P})}catch(T){console.error(T)}})()}}u=(g?.columns&&z4(m,u,i))??u??nf({col:c});const b=[],S=ur(u);for(const w of c){const v=S[w.key]||{},x=f[w.key]||{},T=m[w.key],P=ur(v.children||[]),M=ur(x.children||[]);let R={...w,style:T?.style,...v,...x};w.children?.length&&(R.children=w.children.map(A=>({...A,...P[A.key],...M[A.key]}))),b.push(R)}return b.sort((w,v)=>w.sequenceId-v.sequenceId)},W4=e=>e.sort((t,n)=>t.sequenceId-n.sequenceId),Si=({columns:e,childUniqueKey:t,definitions:n})=>{let r=n||e;return e?.map(o=>{let i=r?.find(a=>a?.key===o?.key);return{id:o.id,key:o.key,sequenceId:o.sequenceId||o.id,isHidden:o.isHidden||!1,style:o.style||i?.style||{},...o?.children&&{children:t?{[t]:Si({columns:o.children,definitions:i?.children})}:Si({columns:o.children,definitions:i?.children})}}})},ur=e=>Array.isArray(e)&&e?.reduce((t,n)=>(t[n.key]=n,t),{}),nf=({col:e,childUniqueKey:t,definitions:n})=>Si({columns:e,childUniqueKey:t,definitions:n}),z4=(e,t,n)=>t.map(o=>{const i=e[o.key],a=o.children?o.children.map(l=>{const u=ur(Array.isArray(i?.children)?i?.children:i?.children?.[n])?.[l.key];return{...l,sequenceId:u?.sequenceId||l.sequenceId,isHidden:u?.isHidden??l.isHidden}}):void 0;return{...o,sequenceId:i?.sequenceId||o.sequenceId,isHidden:i?.isHidden??o.isHidden,...a?{children:a}:{}}}),H4=({t:e})=>{const t=[{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}],n=[{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"}}],r=[{id:1,key:"sku_name",label:e(rI),isLocalizable:!1},{id:2,key:"node",label:e(nI),isLocalizable:!1},{id:3,key:"channel_name",label:e(oI),isLocalizable:!1}];return{definitions:t,defaultUserSettings:n,labels:r}},U4=e=>{let{disabled:t=!1,minWidth:n=0,maxWidth:r,className:o="",id:i,resizeStart:a,resizeEnd:l,defaultWidth:c,rowSpan:u=1,colSpan:d=1}=e;const[f,p]=O.useState(!1),[h,g]=O.useState(0),[m,b]=O.useState(0),[S,k]=O.useState(0),[w,v]=O.useState(null),x=O.useRef(null),T=O.useCallback(C=>{if(!t&&(v(i),a&&a(),p(!0),g(C),b(0),x.current)){const j=x.current.previousSibling;j&&b(j.clientWidth)}},[t,i,a]),P=O.useCallback(()=>{t||(f&&l&&w===i&&l(S),p(!1),v(null))},[t,l,w,i,S,f]),M=O.useCallback(C=>{if(t)return;const j=C instanceof TouchEvent?C.touches[0].screenX:C.screenX;if(!f)return;const N=x.current;if(!N||!N.previousSibling)return;const B=N.previousSibling,L=h-j;let V=m-L;n!==void 0&&V<n&&(V=n),r!==void 0&&V>r&&(V=r),B.style.width=V+"px",B.style.minWidth=V+"px",B.style.maxWidth=V+"px",B.style.setProperty("--column_resize_before_width",V+"px"),k(V)},[t,f,h,m,n,r]);O.useEffect(()=>{const C=x.current;if(C&&C.previousSibling){const j=C.previousSibling;c?(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")):n&&(j.style.minWidth=n+"px",j.style.width=n+"px",j.style.maxWidth=n+"px",j.style.setProperty("--column_resize_before_width",n+"px"))}},[c,n]),O.useEffect(()=>{const C=x.current;if(t&&C&&C.previousSibling){const j=C.previousSibling;c&&(j.style.minWidth=c+"px",j.style.width=c+"px",j.style.maxWidth=c+"px",j.style.setProperty("--column_resize_before_width",c+"px")),r&&(j.style.maxWidth=r+"px")}},[t,c,r]);const R=O.useCallback(()=>{document.addEventListener("mousemove",M),document.addEventListener("mouseup",P),document.addEventListener("touchmove",M),document.addEventListener("touchend",P)},[M,P]),A=O.useCallback(()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",M),document.removeEventListener("touchend",P)},[M,P]);O.useEffect(()=>(t||R(),()=>{A()}),[t,R,A]);const $={userSelect:"none"};return t||($.cursor="ew-resize"),o===""&&($.width="6px",$.backgroundColor="rgba(0, 0, 0, 0.1)"),O.createElement("th",{ref:x,style:$,rowSpan:u,colSpan:d,className:"column_resizer_own_class ".concat(t?"disabled_column_resize":""," ").concat(o),onMouseDown:t?void 0:C=>T(C.screenX),onTouchStart:t?void 0:C=>T(C.touches[0].screenX)})};function rf({isRenderCellContent:e,column:t,row:n,parent:r}){const o=n[t.key],i=o?.length>20;return y.jsx(y.Fragment,{children:e?y.jsx(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem"},children:t?.cellRenderer(n,{column:t,parent:r})}):y.jsx(y.Fragment,{children:i?y.jsx(ru,{title:o,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.5rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:y.jsx(oe,{sx:{maxWidth:"auto",whiteSpace:"normal"},children:y.jsx(at,{sx:{fontSize:"1.1rem",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none"},children:o})})}):y.jsx(oe,{sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textTransform:"none",fontSize:"1.1rem",m:0},id:t.key,component:"p",children:o??""})})})}rf.propTypes={isRenderCellContent:s.bool,column:s.object,row:s.object},J(Yc)(({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 Qr=J(at)(({theme:e})=>({color:e.palette.primary.notifyTextColor,fontSize:"1.1rem"})),Y4=J(Um)(({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)"})}})),q4=J(Oo)(({theme:e})=>({color:e.palette.primary.notifyTextColor,padding:"0.6rem 0",fontSize:"0.9rem",fontWeight:500,"&::before, &::after":{borderColor:`${e.palette.primary.notifyBorderColor}!important`}})),G4=J(Fc)(({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"}}));J(au)(({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 K4=J(c0)(({theme:e})=>({minHeight:"2rem","& .MuiTabs-indicator":{height:"0.1rem",backgroundColor:e.palette.primary.notifyActiveText}})),of=J(Ym)(({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}})),Ml=J(Kh)(({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`}})),X4=J(Wa)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"table-cell",[`&.${su.head}`]:{color:e.palette.primary.notifyTextColor,backgroundColor:e.palette.primary.notifyBackground,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center",lineHeight:"1.5rem"},[`&.${su.body}`]:{color:e.palette.primary.notifyTextColor,borderColor:e.palette.primary.notifyBorderColor,padding:"0rem",textAlign:"center"}}));function Ci({children:e,...t}){return y.jsx(X4,{...t,children:e})}Ci.propTypes={children:s.node};const Z4=J(n0)(()=>({"&:last-child td":{borderBottom:"none"}}));function Xo({children:e,...t}){return y.jsx(Z4,{...t,children:e})}Xo.propTypes={children:s.node};const J4=O.memo(({row:e,isSelected:t,isHigh:n,onRowClick:r,children:o})=>y.jsx(Xo,{sx:i=>({backgroundColor:t||n?i.palette.primary.appBackground:i.palette.primary.notifyBackground}),onClick:()=>r?.(e),children:o},e?.fhi)),Q4=O.memo(({nestedData:e,nestedColumn:t,t:n})=>e?.length?y.jsx(y.Fragment,{children:e.map((r,o)=>y.jsx(Xo,{children:t.map((i,a)=>y.jsx(Ci,{style:i?.style,children:y.jsx(rf,{isRenderCellContent:!!i?.cellRenderer,column:i,row:r})},a))},`nested-${o}`))}):y.jsx(Xo,{children:y.jsx(Ci,{colSpan:t.length,children:y.jsx(Qr,{sx:{textAlign:"center"},children:n(Mr.NRF)})})})),eN=(e,t,n,r,o,i)=>{const[a,l]=O.useState({isOpen:!1,column:null}),c=(p,h,g)=>{l({isOpen:p.currentTarget,column:h,isChild:!!g})},u=()=>{l({isOpen:!1,column:null,isChild:!1})},d=async()=>{u();const p=e.map(h=>{if(a?.isChild&&Array.isArray(h.children)){const g=h.children.map(b=>b.key===a.column?.key?{...b,isHidden:!0}:b),m=g.every(b=>b.isHidden);return{...h,isHidden:m?!0:h.isHidden,children:g}}return h.key===a.column?.key?{...h,isHidden:!0}:h});f({updatedColumns:p})},f=async({updatedColumns:p})=>{t({type:Re.SET_GRID_DATA,payload:{visibleGridColumns:p}});const h=r.split("/").filter(Boolean),g=JSON.parse(localStorage.getItem(cr.SETTINGS));let m=h.reduce((T,P)=>T?.[P],g)||null,b=Si({columns:p,childUniqueKey:i});const S=ur(m?.columns);b=b?.map(T=>{const P=T?.children||{},M=S?.[T?.key]?.children||{};return{...T,...(Object.keys(M)?.length>0||P?.[i])&&{children:{...M,[i]:P?.[i]}}}});const w={...g||{platform:{theme:"light"}}},v=m?.pageSize??o;let x=w;for(let T=0;T<h.length;T++){const P=h[T];T===h.length-1?x[P]={columns:b,pageSize:v}:(x[P]={...x[P]||{}},x=x[P])}localStorage.setItem(cr.SETTINGS,JSON.stringify(w)),await Pl({baseUrl:n,payload:w})};return{selectedColumn:a,handleMenuClick:c,handleClose:u,handleHideClick:d,columnUpdaterFunction:f}},tN=e=>{if(!e)return null;const{options:t,...n}=e,r=t?"select":"button",o={button:i=>y.jsx(sr,{...i,styles:{...i.styles,iconPrimary:i?.styles?.variant=="filled"}}),select:i=>y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"},width:i.styles?.width},children:y.jsx(rv,{...i,options:t})})};return o[r]?o[r](n):null},nN=({presentSetting:e,gridSetting:t,gridPath:n,childUniqueKey:r})=>{if(!n)return e;const o=n.split("/").filter(Boolean);let i=o.reduce((u,d)=>u?.[d],e)||null,a=Si({columns:t?.grid,childUniqueKey:r});const l=ur(i?.columns);a=a?.map(u=>{const d=u?.children||{},f=l?.[u?.key]?.children||{};return{...u,...(Object.keys(f)?.length>0||d?.[r])&&{children:{...f,[r]:d?.[r]}}}});let c=e;for(let u=0;u<o.length;u++){const d=o[u];u===o.length-1?c[d]={columns:a,pageSize:t?.pageSize??null}:(c[d]=c[d]||{},c=c[d])}return{settingObject:e,defaultUserSettings:a}},rN=async({baseUrl:e,gridSetting:t,childUniqueKey:n,gridPath:r})=>{try{const o=JSON.parse(localStorage.getItem("settings")),{settingObject:i,defaultUserSettings:a}=nN({presentSetting:o,gridSetting:t,gridPath:r,childUniqueKey:n});return localStorage.setItem("settings",JSON.stringify(i)),await Pl({baseUrl:e,payload:i}),a}catch(o){console.error(o)}},oN=({index:e,visibleGridColumns:t,width:n,columnUpdaterFunction:r})=>{if(!t||!t[e])return null;t[e];let o=`${n/10}rem`;const i=t.map((a,l)=>l===e?{...a,style:{...a.style,width:o,minWidth:o,maxWidth:o}}:a);return r({updatedColumns:i}),i[e]},Kv=({pagination:e,gridPath:t,baseUrl:n,t:r})=>{const{selectedPage:o,rowPerPage:i,totalRecords:a,onPageChange:l,onPageSizeChange:c}=e,u=wt(),d=async(f,p)=>{if(console.log("gridPath",p),!p)return;const h=p.split("/").filter(Boolean),g="settings",b={...JSON.parse(localStorage.getItem(g))||{}};let S=b;for(let k=0;k<h.length;k++){const w=h[k];k===h.length-1?S[w]={...S[w]||{},pageSize:f}:(S[w]={...S[w]||{}},S=S[w])}localStorage.setItem(g,JSON.stringify(b)),await Pl({baseUrl:n,payload:b})};return y.jsxs(oe,{sx:{display:"flex",p:"1rem 1.5rem"},children:[y.jsxs(oe,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"0.5rem",width:"100%"},children:[y.jsx(at,{sx:{fontSize:"1.1rem",color:u.palette.primary.notifyTextColor},children:r("SHOWING_ROWS",{current:Math.min(o*i,a),total:a})}),y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem 0.8rem!important"},width:"6rem"},children:y.jsx(Yo,{options:D4,value:i,onChange:async f=>{c(f),d(f?.value,t)}})})]}),y.jsx(_m,{count:Math.ceil(a/i),page:o,onChange:async(f,p)=>{l(p)},siblingCount:0,shape:"rounded",sx:{width:"100%","& .MuiPagination-ul":{width:"100%",display:"flex",justifyContent:"flex-end","& li:first-of-type":{border:`0.1rem solid ${u.palette.primary.notifyBorderColor}`,color:u.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 ${u.palette.primary.notifyBorderColor}`,color:u.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:u.palette.primary.notifyActiveText,backgroundColor:`${u.palette.brandColor.paginationBc} !important`}}})]})};Kv.propTypes={pagination:s.object.isRequired};const Xv=({menuOpen:e,handleClose:t,onHideClick:n})=>{const r=wt(),{t:o}=O.useContext(an);return y.jsx(zs,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:y.jsx(oe,{sx:{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(ja,{onClick:n,disableRipple:!0,sx:{textTransform:"none",fontSize:"1.1rem",p:"0.4rem 1rem",minHeight:"unset",fontWeight:500,color:r.palette.primary.notifyTextColor,backgroundColor:"transparent","&:hover":{backgroundColor:"transparent"},"&:active":{backgroundColor:"transparent"},"&:focus":{backgroundColor:"transparent"}},children:o("LABEL_HIDE_COLUMN")})})})};Xv.propTypes={menuOpen:s.object,handleClose:s.func,onHideClick:s.func};const Zv=({sortKey:e,sortField:t,sortDir:n,handleSortClick:r})=>{const o=i=>y.jsx(ba,{onClick:r,sx:{padding:"0.2rem"},draggable:!1,children:y.jsx(Gt,{url:i})});return y.jsx(y.Fragment,{children:o(t===e?n==="asc"?We.AscSort:We.DescSort:We.Unsort)})};Zv.propTypes={sortKey:s.string.isRequired,sortField:s.string,sortDir:s.string,handleSortClick:s.func};function Jv({parent:e,column:t,sort:n,handleMenuClick:r,isManageable:o}){const i=o&&(!t?.isMandatory||t?.isMandatory&&t?.showHide===!0),a=t?.label,l=t?.isSortable,c=n?.sortField,u=n?.sortDir,d=n?.onSort;return y.jsxs(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},draggable:!1,children:[y.jsx(oe,{sx:{fontWeight:"bold",fontSize:"1.1rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"0.5rem",textAlign:"center"},children:y.jsx(ru,{title:a,placement:"top",componentsProps:{tooltip:{sx:{fontSize:"1rem",padding:"0.6rem 1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"}}},children:a??""})}),y.jsxs(oe,{sx:{display:"flex",alignItems:"center"},draggable:!1,children:[l&&y.jsx(Zv,{sortKey:e?`${e?.key}|${t?.key}`:t?.key,sortField:c,sortDir:u,handleSortClick:()=>d({column:t,sortDir:u,sortField:c,parent:e})}),i&&y.jsx(ba,{draggable:!1,onClick:f=>r(f,t,e),sx:{padding:"0.2rem"},children:y.jsx(Gt,{url:We.Menu})})]})]})}Jv.propTypes={column:s.object.isRequired,sort:s.object.isRequired,handleMenuClick:s.func,isManageable:s.bool};function Qv({rows:e,sort:t,data:n,pagination:r,columns:o,nested:i,baseUrl:a,gridPath:l,childUniqueKey:c,isVirtualizedTable:u=!1,t:d}){const f=wt(),{visibleGridColumns:p}=O.useContext(ml),h=O.useContext(hi),{selectedColumn:g,handleMenuClick:m,handleClose:b,handleHideClick:S,columnUpdaterFunction:k}=eN(p,h,a,l,r?.rowPerPage,c),w=o?.isManageable,v=o?.isResizable,x=n?.length>0,T=O.useRef(null),P=O.useRef(null),M=45,R=10,A=n?.length,[$,C]=O.useState({start:0,end:10}),[j,N]=O.useState(null),[B,L]=O.useState(null),[V,Y]=O.useState(null);let U=null;const _=O.useRef(0),D=O.useRef(!1),W=O.useRef(null),q=W4(i?.column?.definitions||[]),Q=i?.isNested,te=i?.data||[],G=i?.hashKey,[Z,ie]=O.useState(0);O.useEffect(()=>{if(T.current){const ne=()=>{ie(T.current.offsetHeight)};return ne(),window.addEventListener("resize",ne),()=>window.removeEventListener("resize",ne)}},[n]),O.useEffect(()=>{const re=T.current?.querySelector("thead");if(!re)return;const ge=()=>{Y(null)};return re?.addEventListener("mousedown",ge),()=>{re?.removeEventListener("mousedown",ge)}},[]);const ae=(ne,re)=>{if(D.current){ne.preventDefault();return}N(re),Y(null),ne.dataTransfer.setData("colIndex",re);const ge=p[re],be=ge?.label,de=document.createElement("div");de.textContent=be,Object.assign(de.style,{display:"flex",alignItems:"center",justifyContent:"center",padding:"1.5rem 2.5rem",minWidth:ge?.style?.minWidth,maxWidth:ge?.style?.maxWidth,fontSize:"1.2rem",fontWeight:"500",color:f.palette.primary.notifyTextColor,background:f.palette.primary.notifyBackground,border:`0.1rem solid ${f.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(de);const{offsetWidth:Me,offsetHeight:Ie}=de;ne.dataTransfer.setDragImage(de,Me/2,Ie/2),requestAnimationFrame(()=>{document.body.removeChild(de)})},F=(ne,re)=>{ne.preventDefault(),L(re),we(ne)},z=async(ne,re)=>{if(ne.preventDefault(),clearInterval(U),j===null||j===re)return;const ge=[...p],[be]=ge.splice(j,1);ge.splice(re,0,be);const de=p.slice().sort((Ie,Ue)=>Ie.sequenceId-Ue.sequenceId).map(Ie=>Ie.sequenceId),Me=ge.map((Ie,Ue)=>({...Ie,sequenceId:de[Ue]??Ie.sequenceId}));k({updatedColumns:Me}),N(null),L(null)},I=()=>{N(null),L(null)},se=(ne,re,ge,be)=>{if(!ne)return null;const de=ne?.isMandatory&&ne?.isSticky,Me=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;re===0&&(_.current=0);const Ie=de?re===0?0:`${_.current}rem`:void 0;de&&(_.current+=Me);const Ue=j===re,ye=B==re||p?.[B]?.isMandatory,gt=Ye=>{ne.isMandatory?(Ye.preventDefault(),Ye.dataTransfer.dropEffect="none"):(Ye.preventDefault(),Ye.dataTransfer.dropEffect="move"),F?.(Ye,re)},lt=Ye=>{ne.isMandatory||z?.(Ye,re)};return be&&`${be?.key}${ne?.key}${re}`,y.jsx(Ci,{rowSpan:ne?.children?1:2,colSpan:ne?.children?.filter(Ye=>!Ye?.isHidden)?.length,style:ne?.style,draggable:ge&&!ne?.isMandatory,onDragStart:ge&&!ne?.isMandatory?Ye=>ae(Ye,re):Ye=>{Ye.preventDefault()},onDragOver:ge&&!ne?.isMandatory?gt:void 0,onDrop:ge&&!ne?.isMandatory?lt:void 0,onDragEnd:ge&&!ne?.isMandatory?I:void 0,sx:{...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...Ue&&{border:`0.1rem solid ${f.palette.brandColor.lightBlue}!important`},...de&&{position:"sticky",left:Ie,zIndex:3},cursor:ye?"not-allowed":ge&&!ne?.isMandatory?"grab":"default"},children:y.jsx(Jv,{parent:be,column:ne,sort:t,handleMenuClick:m,isManageable:ge})},re)},ee=O.useCallback((ne,re,ge,be)=>{if(!ne)return null;const de=ne?.isMandatory&&ne?.isSticky,Me=parseFloat(ne?.style?.minWidth?.toString().replace("rem",""))||7.5;ge===0&&(_.current=0);const Ie=de?ge===0?0:`${_.current}rem`:void 0;return de&&(_.current+=Me),y.jsxs(Ci,{colSpan:1,style:ne?.style,className:`${ne?.label}`,sx:{position:"relative",...ne.isCenterTable&&{borderRight:"0.1rem solid",borderBottom:"0.1rem solid",borderTop:"none",...ne?.key==="volume_value"&&{borderLeft:"1px solid"}},...ne?.isSticky&&{boxShadow:"rgba(17, 17, 26, 0.3) 4px 0px 6px -2px"},...de&&{position:"sticky",left:Ie,zIndex:2,backgroundColor:Ue=>e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh?Ue.palette.primary.appBackground:Ue.palette.primary.notifyBackground}},children:[(e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi||re?.isHigh)&&y.jsx(oe,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none",zIndex:1}}),y.jsx(rf,{isRenderCellContent:!!ne?.cellRenderer,column:ne,row:re,parent:be})]},ge)},[e?.selectedRow,f]),le=(ne,re,ge,be)=>y.jsx(y.Fragment,{children:ne&&ge&&!ne?.isMandatory?y.jsx(oe,{resizeStart:()=>{ne?.isMandatory&&!ne?.isResizable||(D.current=!0)},resizeEnd:de=>{ne?.isMandatory&&!ne?.isResizable||de<=20||(D.current=!1,oN({index:re,visibleGridColumns:p,width:de,columnUpdaterFunction:k}))},component:ne?.children||ne?.isMandatory?Wa:U4,rowSpan:ne?.children?1:2,colSpan:1,id:re,sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,cursor:"col-resize","&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0.15rem",height:"1.5rem",backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1},...!ne?.isMandatory&&{"&:hover::after":{content:'""',position:"absolute",top:0,left:"50%",transform:"translateX(-50%)",width:"0.2rem",height:`${Z}px`,backgroundColor:f.palette.primary.notifyBorderColor,zIndex:1}}}}):null}),De=O.useCallback((ne,re,ge,be,de,Me,Ie)=>y.jsx(y.Fragment,{children:re&&be&&!re?.isMandatory?y.jsx(Wa,{className:"column_resizer_body",sx:{width:"1rem",maxWidth:"1rem",minWidth:"1rem",padding:0,position:"relative",borderBottom:`0.1rem solid ${f.palette.primary.notifyBorderColor}`},children:(e?.selectedRow&&e?.selectedRow?.fhi===ne?.fhi||ne?.isHigh)&&y.jsx(oe,{sx:{position:"absolute",bottom:0,left:0,width:"100%",height:"0.08rem",background:"linear-gradient(#F9B16E, #F68080)",pointerEvents:"none"}})},`resize-${ge}_${Ie}`):null}),[e?.selectedRow,f]),we=ne=>{const re=T.current,{left:ge,right:be}=re.getBoundingClientRect(),de=50,Me=ne.clientX>be-de?1:ne.clientX<ge+de?-1:0;Me!==0?(W.current&&clearInterval(W.current),W.current=setInterval(()=>{re.scrollLeft+=Me*10},50)):W.current&&(clearInterval(W.current),W.current=null)},Be=ne=>ne?.map((re,ge)=>{const be=$.start+ge,de=re[G],Me=te?.[de],Ie=e?.selectedRow&&e?.selectedRow?.fhi===re?.fhi,Ue=re?.isHigh;return y.jsxs(O.Fragment,{children:[y.jsx(J4,{row:re,isSelected:Ie,isHigh:Ue,onRowClick:e?.onRowClick,children:p.map((ye,gt)=>ye?.isHidden||ye?.isVisible===!1?null:ye?.children?ye.children.map((lt,Ye)=>lt?.isHidden?null:y.jsxs(O.Fragment,{children:[ee(lt,re,Ye,ye),v&&De(re,lt,Ye,w,ye,"",be)]},`col-${gt}-${Ye}`)):y.jsxs(O.Fragment,{children:[ee(ye,re,gt),v&&De(re,ye,gt,w,"","",be)]},`col-${gt}`))}),Q&&Me&&y.jsx(Q4,{nestedData:Me,nestedColumn:q,t:d})]},`row-${be}`)}),je=()=>{const ne=P.current;if(!ne)return;const re=ne.scrollTop,ge=ne.clientHeight,be=Math.floor(re/M)-R,de=Math.ceil(ge/M)+2*R,Me=Math.max(0,Math.min(A-1,be)),Ie=Math.max(Me,Math.min(A,Me+de));C(Ue=>Ue.start===Me&&Ue.end===Ie?Ue:{start:Me,end:Ie})};O.useEffect(()=>{let ne;const re=()=>{ne&&cancelAnimationFrame(ne),ne=requestAnimationFrame(()=>{je()})},ge=P.current;if(!(!ge||!u))return je(),ge.addEventListener("scroll",re),()=>{cancelAnimationFrame(ne),ge.removeEventListener("scroll",re)}},[A]);const ze=$.start*M,Ae=(A-$.end)*M,he=u?n?.slice($.start,$.end):n;return x?y.jsxs(y.Fragment,{children:[y.jsx(Zm,{ref:P,sx:{willChange:"transform",WebkitTransform:"translateZ(0)",maxHeight:"40rem",whiteSpace:"nowrap",overflow:"auto",width:"100%",border:`0.1rem solid ${f.palette.primary.notifyBorderColor}`,borderRadius:"1.4rem",position:"relative"},children:y.jsxs(Gm,{ref:T,stickyHeader:!0,"aria-label":"sticky table",sx:{backgroundColor:ne=>ne.palette.primary.notifyBackground},children:[y.jsxs(Qm,{children:[y.jsx(Xo,{sx:{position:"sticky",top:0,zIndex:3,backgroundColor:ne=>ne.palette.primary.notifyBackground},children:p.map((ne,re)=>ne?.isHidden||ne?.isVisible===!1?null:y.jsxs(O.Fragment,{children:[se(ne,re,w),le(ne,re,w)]},re))}),y.jsx(Xo,{draggable:!1,sx:{position:"sticky",top:"2.5rem",backgroundColor:f.palette.primary.notifyBackground,zIndex:2},children:p.flatMap((ne,re)=>ne?.isHidden||!ne?.children||ne?.isVisible===!1?[]:ne.children.map((ge,be)=>ge?.isHidden?null:y.jsxs(O.Fragment,{children:[se(ge,be,w,ne),v&&le(ge,be,w)]},`${re}-${be}`)))})]}),y.jsxs(Xm,{children:[u&&y.jsx("tr",{style:{height:ze}}),Be(he),u&&y.jsx("tr",{style:{height:Ae}})]})]})}),r&&y.jsx(Kv,{pagination:r,gridPath:l,baseUrl:a,t:d}),y.jsx(Xv,{menuOpen:g?.isOpen,handleClose:b,onHideClick:S})]}):y.jsx(Qr,{sx:{textAlign:"center"},children:d(Mr.NRF)})}Qv.propTypes={sort:s.object,data:s.array,pagination:s.object,columns:s.object,nested:s.object};function e2({tableProps:e,isDefaultConfig:t,gridPath:n,baseUrl:r,childUniqueKey:o}){const{columns:i}=e,a=O.useContext(hi),{t:l}=O.useContext(an),c=V4({columns:i,gridPath:n,baseUrl:r,isDefaultConfig:t,childUniqueKey:o,pageSize:e?.pagination?.rowPerPage,data:e?.data});return O.useEffect(()=>{c?.length&&e?.data?.length&&a?.({type:Re.SET_GRID_DATA,payload:{visibleGridColumns:c}})},[c,e?.data]),y.jsx(Qv,{...e,gridPath:n,baseUrl:r,childUniqueKey:o,t:l})}e2.propTypes={tableProps:s.object.isRequired,mergedColumns:s.array.isRequired};const t2=({type:e})=>{const r=wt()?.mode==="dark"?{bgcolor:"grey.800"}:{};return{grid:y.jsxs(oe,{sx:{borderRadius:2,overflow:"hidden"},children:[y.jsx(nr,{variant:"text",width:"100%",height:60,sx:r}),Array.from({length:10}).map((i,a)=>y.jsx(oe,{sx:{display:"flex",alignItems:"center",padding:"0.5rem",gap:"3rem"},children:Array.from({length:5}).map((l,c)=>y.jsx(oe,{sx:{flex:1},children:y.jsx(nr,{variant:"text",height:45,sx:r})},c))},a))]}),toolbar:y.jsx(y.Fragment,{children:y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{display:"flex",gap:"1rem"},children:[y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"15.2rem",height:"5rem",sx:r})]}),y.jsxs(He,{direction:"row",gap:"1rem",children:[y.jsx(nr,{variant:"text",width:"10.2rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r}),y.jsx(nr,{variant:"text",width:"3.5rem",height:"5rem",sx:r})]})]})})}[e]},sN=({customTools:e})=>{const t=e?.filter(r=>r?.type===qv.PRIMARY)?.sort((r,o)=>r.sequenceId-o.sequenceId),n=e?.filter(r=>r?.type===qv.SECONDARY)?.sort((r,o)=>r.sequenceId-o.sequenceId);return{primaryButtons:t,secondaryButtons:n}},n2=({customTools:e,isExpanded:t,setIsExpanded:n})=>{const{primaryButtons:r,secondaryButtons:o}=sN({customTools:e}),[i,a]=O.useState(r),l=o?.length>0,{t:c}=O.useContext(an),u=f=>{f?a([...r,...o]):setTimeout(()=>{a(r)},100)},d=()=>{const f=!t;n(f),u(f)};return O.useEffect(()=>{u(t)},[e]),y.jsxs(y.Fragment,{children:[t&&y.jsx("div",{style:{position:"fixed",left:0,width:"100vw",height:"4rem",zIndex:998}}),y.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:"0.8rem",flexWrap:"nowrap",maxWidth:"100%",whiteSpace:"nowrap",zIndex:999},children:[y.jsx(JP,{mode:"popLayout",children:i.map((f,p)=>y.jsx(Fo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},layout:!0,children:y.jsx(oe,{sx:{flexShrink:0,minWidth:"fit-content"},children:tN(f)})},`${f.id}_${p}`))}),l&&y.jsx(oe,{sx:{paddingLeft:t?"0.5rem":0},children:y.jsx(sr,{label:t?"":c("LABEL_MORE_ACTIONS"),styles:{iconPrimary:!0,icon:t?We.CrossWhite:We.More,colorType:t?"danger":""},onClick:d})})]})]})};n2.propTypes={customTools:s.array.isRequired};const r2=({defaultTools:e,isManageable:t,customTools:n,baseUrl:r,gridPath:o,pageSize:i,gridData:a,childUniqueKey:l})=>{const{t:c}=O.useContext(an),u=O.useContext(hi),{visibleGridColumns:d,triggerApi:f}=O.useContext(ml),[p,h]=O.useState([]),[g,m]=O.useState(!1);O.useEffect(()=>{if(d.length){const w={id:99999,sequenceId:99999,isLocalizable:!1,key:"horizons",label:c("Horizons"),isSortable:!1,isHidden:!0,showChildCheckbox:!0,showCheckbox:!1,isMandatory:!0,showInHierarchy:!0,showHide:!0,children:[]};let v=d.map(T=>(T?.children&&T.children.forEach(P=>{w.children.some(R=>R.key===P.key)||w.children.push({...P,showInHierarchy:!0})}),T)).filter(T=>T?.id!==w?.id);const x=w.children.length>0?[...v,w]:v;h(x)}},[d]);const b=async w=>{try{await rN({baseUrl:r,gridPath:o,childUniqueKey:l,gridSetting:{grid:w,pageSize:i}})}catch(v){console.error(v)}finally{u({type:Re.HAS_SETTING_CHANGE,payload:{hasChange:!1}}),u({type:Re.TRIGGER_API,payload:{triggerApi:!1}})}};O.useEffect(()=>{f&&b(d)},[f]);const S=w=>{const v=w?.map(P=>P.id),x=w?.flatMap(P=>P.children||[])?.map(P=>P.id),T=p?.map(P=>{const M=v?.includes(P.id);if(Array.isArray(P.children)&&P.children.length>0){const A=P?.children?.map(C=>{const j=x?.includes?.(C.id);return{...C,isHidden:!j}}),$=A?.filter(C=>p?.some(j=>j.children?.some(N=>N.id===C.id)))?.every(C=>C.isHidden);return{...P,...!P.children[0]?.showInHierarchy&&{isHidden:$||!M},children:A}}return{...P,isHidden:!M}});u({type:Re.SET_GRID_DATA,payload:{visibleGridColumns:T}}),u({type:Re.HAS_SETTING_CHANGE,payload:{hasChange:!0}})},k=()=>p.map(v=>{const x=Array.isArray(v.children)?v.children.filter(T=>!T.isHidden):void 0;return!v.isHidden||v.isHidden&&v.showInHierarchy?{...v,children:x}:null}).filter(Boolean);return y.jsxs(oe,{sx:{margin:"1rem 0",position:"relative",zIndex:10,display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"0.6rem",width:"100%"},children:[y.jsxs(oe,{sx:{display:"flex",flexDirection:"row",gap:"0.6rem"},children:[e?.search?.isRequired&&y.jsx(nv,{...e?.search,iconUrl:We.Search}),e?.refresh?.isRequired&&y.jsx(sr,{...e?.refresh,styles:{variant:"filled",icon:We.Refresh,colorType:"empty",width:"3.2rem",height:"3.2rem"}}),e?.groupBy?.isRequired&&y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Yo,{styles:{icon:We.Group},...e.groupBy})}),t&&y.jsx(oe,{sx:{"& .MuiInputBase-input":{padding:"0rem!important"}},children:y.jsx(Yo,{placeholder:c("LABEL_MANAGE_COLUMN"),options:p,value:k(),isMulti:!0,isDraggable:!0,showSearch:!0,isManageColumn:!0,onChange:S,disabled:!a.length,styles:{icon:We.Manage}})})]}),y.jsxs(oe,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:"0.6rem"},children:[n&&y.jsx(n2,{customTools:n,setIsExpanded:m,isExpanded:g}),e?.save?.isRequired&&y.jsx(oe,{sx:{px:"0.5rem"},children:y.jsx(sr,{label:g?"":"Save",styles:{icon:We.Save,colorType:"empty"},...e?.save})}),e?.upload?.isRequired&&y.jsx(sr,{...e?.upload,styles:{variant:g?"outlined":"filled",icon:g?We.UploadDark:We.Upload,iconPrimary:!g,colorType:"secondary",isAnimate:!0}}),e?.download?.isRequired&&y.jsx(sr,{...e?.download,styles:{variant:"outlined",icon:We.Download,isAnimate:!0}})]})]})};r2.propTypes={defaultTools:s.object.isRequired,customTools:s.array,isManageable:s.bool,baseUrl:s.string,gridPath:s.gridPath};function sf({tableProps:e,toolbarProps:t,isDefaultConfig:n,isLoading:r}){const o=e.columns?.isManageable;return y.jsx(Jb,{children:r?y.jsxs(y.Fragment,{children:[t&&y.jsx(t2,{type:"toolbar"}),e&&y.jsx(t2,{type:"grid"})]}):y.jsxs(oe,{sx:{position:"sticky"},children:[t&&y.jsx(r2,{...t,isManageable:o,pageSize:e?.pagination?.rowPerPage,gridData:e?.data}),y.jsx(e2,{tableProps:e,isDefaultConfig:n,gridPath:t?.gridPath||"",baseUrl:t?.baseUrl||"",childUniqueKey:t?.childUniqueKey||""})]})})}sf.propTypes={tableProps:s.object.isRequired,toolbarProps:s.object,isDefaultConfig:s.bool};const o2=({list:e,handleLinkClick:t})=>{const n=wt(),{t:r}=O.useContext(an),o=({list:i})=>i?.sort((a,l)=>a.order-l.order)?.map((a,l)=>a?.link?y.jsx(Wr,{component:"h3",sx:{fontSize:"1rem",cursor:"pointer",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},href:a?.link,underline:"hover",onClick:()=>t(a),children:r(a?.title)},l):y.jsx(at,{component:"h3",sx:{fontSize:"1rem",color:l===i?.length-1?n.palette.brandColor.orange:n.palette.primary.notifyTextColor},children:r(a?.title)},l));return y.jsx(om,{separator:y.jsx(Gt,{url:We.ArrowRight}),children:o({list:e})})};o2.propTypes={list:s.array.isRequired,handleLinkClick:s.func};const s2=({breadcrumbProps:e,switchProps:t,filterComponentProps:n,metaDataProps:r})=>{const o=wt(),{t:i}=O.useContext(an),a=n?.filterBtnProps?.disabled;return y.jsxs(y.Fragment,{children:[y.jsxs(He,{sx:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,height:"3rem",p:"0px 1.5rem 0 1.5rem",zIndex:4,position:"relative"},direction:"row",justifyContent:"space-between",alignItems:"center",children:[y.jsx(o2,{...e}),y.jsxs(He,{direction:"row",gap:"1rem",alignItems:"center",children:[r,t&&y.jsx(sv,{...t}),n?.filterBtnProps&&y.jsxs(He,{direction:"row",children:[y.jsx(Oo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"2rem!important",opacity:"1!important",borderColor:o.palette.primary.notifyBorderColor}}),y.jsxs(He,{direction:"row",alignItems:"center",gap:"0.5rem",onClick:n?.filterBtnProps?.onFilterClick,sx:{opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},children:[y.jsx(Gt,{url:We.Filter}),y.jsx(at,{sx:{fontSize:"1.1rem",color:o.palette.primary.notifyActiveText},children:i(n?.filterBtnProps?.label)})]})]})]})]}),y.jsx(Fo.div,{layout:!0,initial:{height:"0rem"},animate:{height:n?.filterBtnProps?.filterContainerVisible?"5rem":"0rem",opacity:n?.filterBtnProps?.filterContainerVisible?1:0},transition:{duration:.5,ease:"easeInOut"},style:{background:o.palette.primary.notifyBackground,borderBottom:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,padding:"0px 5.5rem 0 1.5rem",position:"relative",alignItems:"center",display:"flex",overflow:"hidden",width:n?.filterContainerProps?.isSideDrawerOpen?"75%":"100%"},children:y.jsxs(He,{sx:{background:o.palette.primary.appBackground,height:"3.8rem",p:"0 2rem",width:"100%",borderRadius:"0.7rem",overflow:"visible"},direction:"row",alignItems:"center",children:[y.jsxs(at,{sx:{fontSize:"1.2rem",fontWeight:"500",color:o.palette.primary.notifyActiveText},children:[n?.labels?.description||i("Filters")," :"]}),y.jsx(oe,{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(He,{direction:"row",gap:"1.2rem",sx:{overflow:"visible"},children:n?.filterItems?.map((l,c)=>y.jsx(y.Fragment,{children:y.jsxs(oe,{sx:{position:"relative",overflow:"visible",border:`0.1rem solid ${o.palette.primary.notifyBorderColor}`,background:o.palette.primary.notifyBackground,borderRadius:"0.6rem",padding:"0.3rem 1.1rem",display:"inline-block"},children:[y.jsx(oe,{component:"img",src:We.FilterClose,sx:{position:"absolute",top:"-0.4rem",right:"-0.6rem",cursor:"pointer"},onClick:()=>n?.onFilterChipClose(l)}),y.jsx(at,{sx:{fontSize:"1rem",color:o.palette.primary.notifyTextColor},children:l?.filterLabel})]},c)}))})}),y.jsx(oe,{component:at,sx:{fontSize:"1.1rem",fontWeight:"500",textDecoration:"underline",color:o.palette.brandColor.red,cursor:"pointer"},onClick:n?.filterContainerProps?.onClearClick,children:n?.labels?.button||i("Clear")})]})})]})};s2.propTypes={breadcrumbProps:s.object.isRequired,switchProps:s.object};function i2({headerProps:e}){return y.jsx(rn,{children:y.jsx(s2,{...e})})}i2.propTypes={headerProps:s.object.isRequired};const af=O.createContext(null),a2=O.createContext(null);function l2({children:e}){const[t,n]=O.useReducer(iN,aN);return y.jsx(af.Provider,{value:t,children:y.jsx(a2.Provider,{value:n,children:e})})}function iN(e,t){switch(t.type){case Re.LOADING:return{...e,loading:t.loading};case Re.SUCCESS:return{...e,data:t.data?.sort((n,r)=>new Date(r.createdAt)-new Date(n.createdAt))};case Re.MARK_ALL_AS_READ:return{...e,isMarkAllAsRead:t.isMarkAllAsRead};case Re.SET_ACTIVE_TAB:return{...e,activeTab:t.activeTab};case Re.SET_MODE:return{...e,mode:t.mode};case Re.ERROR:return{...e,error:t.error};default:throw new Error(`${Mr.UNHANDLED}: ${t}`)}}const aN={loading:!1,data:[],error:"",isMarkAllAsRead:{count:0,boo:!1},mode:!1,activeTab:0},{TENANT_ID:lf,BU_ID:cf}=Yv,{TENANT_IDS:uf,BU_IDS:df}=Gv,lN=async e=>{try{const t=localStorage.getItem("i18nextLng"),n=`${e}${El.NOTIFICATION}/v1?${lf}=${uf}&${cf}=${df}&lang=${t}`;return await dt.get(n,wi)}catch(t){return t}},c2=async(e,t,n)=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${El.NOTIFICATION}${ef.VERSION}?${lf}=${uf}&${cf}=${df}&lang=${r}`;return await dt.put(o,t,wi)}catch(r){return r}},cN=async({baseUrl:e,id:t,snopId:n})=>{try{const r=localStorage.getItem("i18nextLng"),o=`${e}${El.NOTIFICATION}${ef.VERSION}?${lf}=${uf}&${cf}=${df}&id=${t}&lang=${r}`;return await dt.get(o,wi)}catch(r){return r}},Zo={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500},u2=({baseUrl:e})=>{const t=O.useContext(a2),[n,r]=O.useState(!1),[o,i]=O.useState(!1),[a,l]=O.useState(!1),[c,u]=O.useState({}),[d,f]=O.useState(null),[p,h]=O.useState(1),g=O.useRef(!1),{loading:m,data:b,isMarkAllAsRead:S,mode:k,activeTab:w}=O.useContext(af),[v,x]=O.useState([]);O.useEffect(()=>{x(b)},[b]);const T=O.useCallback(async()=>{if(!(g.current||!e))try{t({type:Re.LOADING,loading:!0}),t({type:Re.SUCCESS,data:[]});const j=await lN(e);if(j.status===Zo.UNAUTHORIZED){g.current=!0;return}if(j.status===Zo.OK){const N=j.data?.responseData?.response||[],B=hl(N);t({type:Re.SET_MODE,mode:!1}),t({type:Re.SUCCESS,data:hl(B)}),t({type:Re.MARK_ALL_AS_READ,isMarkAllAsRead:{count:Zb(N),boo:Zb(N)>0}}),t({type:Re.LOADING,loading:!1})}}catch(j){j?.response?.status===Zo.UNAUTHORIZED&&(g.current=!0),t({type:Re.ERROR,error:Mr.SWR}),t({type:Re.LOADING,loading:!1})}},[e,t]),P=j=>{const N=(b||[]).filter(B=>k?!B.isRead:!0);return{0:N,1:N.filter(B=>B?.type==="INFO"),2:N.filter(B=>B?.type==="ERROR")}};O.useEffect(()=>{T();const j=setInterval(T,3e5);return()=>clearInterval(j)},[T]);const M=async(j,N)=>{if(!(!j||!e)){f(j);try{const B=await cN({baseUrl:e,id:j,snopId:N});if(B.status===Zo.OK){const L=B.data?.responseData?.response||{};u(L||{}),l(!0)}else throw new Error}catch{t({type:Re.ERROR,error:Mr.SWR})}finally{f(null)}}},R=async(j,N)=>{if(!(!j.length||!e)){t({type:Re.LOADING,loading:!0});try{if((await c2(e,j,N)).status===Zo.OK){const L=b.map(Y=>j.includes(Y.id)?{...Y,isRead:!0}:Y),V=L.filter(Y=>!Y.isRead).length;V===0&&t({type:Re.SET_MODE,mode:!1}),t({type:Re.SUCCESS,data:hl(L)}),t({type:Re.MARK_ALL_AS_READ,isMarkAllAsRead:{count:V,boo:V>0}}),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},200)}}catch{t({type:Re.ERROR,error:Mr.SWR}),t({type:Re.LOADING,loading:!1})}}},A=async()=>{if(e){t({type:Re.LOADING,loading:!0});try{const j=P9(b);if((await c2(e,j,R4.MARK_ALL_READ)).status===Zo.OK){const B=b.map(L=>({...L,isRead:!0}));t({type:Re.SET_MODE,mode:!1}),t({type:Re.SUCCESS,data:hl(B)}),t({type:Re.MARK_ALL_AS_READ,isMarkAllAsRead:{count:0,boo:!1}}),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},200)}}catch{t({type:Re.ERROR,error:Mr.SWR}),t({type:Re.LOADING,loading:!1})}}},$=(j,N)=>{t({type:Re.LOADING,loading:!0}),t({type:Re.SET_ACTIVE_TAB,activeTab:N}),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},400)},C=()=>{t({type:Re.LOADING,loading:!0});const j=k?b||[]:(v||[]).filter(N=>!N.isRead);t({type:Re.SET_MODE,mode:!k}),x(j),h(1),setTimeout(()=>{t({type:Re.LOADING,loading:!1})},400)};return{fetchNotification:T,showDetailsProps:{open:a,handleClose:()=>l(!1),setOpen:l,data:c,clickId:d},alertDialogProps:{open:n,handleClose:()=>r(!1),onRefresh:T,handleRead:R,handleMarkAllAsRead:A,setOpen:r,handleShowDetails:M,clickId:d,isMainDialog:!0},activeTab:w,loading:m,tabData:P()[w],data:v,mode:k,handleTabChange:$,toggleAlertMode:C,page:p,setPage:h,isMarkAllAsRead:S}};var d2,f2,p2;function ff(){return ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ff.apply(null,arguments)}var uN=function(t){return E.createElement("svg",ff({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none"},t),d2||(d2=E.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"})),f2||(f2=E.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"})),p2||(p2=E.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 dN=({count:e})=>(wt(),y.jsxs(y.Fragment,{children:[y.jsx(oe,{sx:{gap:"0.5rem",display:"flex",justifyContent:"center",alignItems:"center","& svg":{transform:"scale(1)"}},children:y.jsx(uN,{style:{scale:1.2}})}),y.jsx(G4,{badgeContent:e!=0?"":null,color:"error"})]}));function h2({children:e,handleClose:t,open:n,isMainDialog:r}){return y.jsx(Yc,{open:n,onClose:t,scroll:r?"paper":void 0,fullWidth:!r,maxWidth:r?void 0:"md",PaperProps:{sx:r?{position:"fixed",top:30,right:30,m:0,width:400,height:450,display:"flex",flexDirection:"column",borderRadius:2,boxShadow:6,backgroundColor:o=>o.palette.primary.notifyBackground}:{minHeight:250,maxHeight:500,borderRadius:"1.5rem",boxShadow:6,backgroundColor:o=>o.palette.primary.appBackground}},children:e})}var m2;function pf(){return pf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pf.apply(null,arguments)}var fN=function(t){return E.createElement("svg",pf({xmlns:"http://www.w3.org/2000/svg",width:14,height:9,fill:"none",viewBox:"0 0 13 9"},t),m2||(m2=E.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"})))},g2,y2;function hf(){return hf=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},hf.apply(null,arguments)}var pN=function(t){return E.createElement("svg",hf({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},t),g2||(g2=E.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"})),y2||(y2=E.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"})))},b2;function mf(){return mf=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},mf.apply(null,arguments)}var hN=function(t){return E.createElement("svg",mf({xmlns:"http://www.w3.org/2000/svg",width:9,height:8,fill:"none"},t),b2||(b2=E.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 v2=({type:e,item:t,handleShowDetails:n,handleRead:r,handleCTAClicked:o,clickId:i,t:a})=>{const l=wt(),c=JSON.parse(localStorage.getItem("settings"))?.platform?.theme;return y.jsxs(oe,{className:"cards",sx:{pt:" 0.8rem"},children:[y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"start",justifyContent:"space-between",gap:1,children:y.jsx(Fc,{sx:{width:"calc(100% - 2%)","& .MuiBadge-badge":{backgroundColor:"#6041EA",height:"0.5rem",minWidth:"0.5rem"}},variant:"dot",invisible:t?.isRead,children:y.jsx(Qr,{sx:{color:l.palette.primary.notifyActiveText,whiteSpace:"normal",wordBreak:"break-word"},component:"p",className:["title-card",t?.isRead&&"read"].join(" "),children:a(t?.message)})})}),y.jsx(He,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:y.jsxs(He,{display:"flex",flexDirection:"row",justifyContent:"start",gap:1,sx:{p:"0.5rem 0"},children:[t?.isNotificationDetails&&y.jsx(Ml,{icon:y.jsx(pN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:n,label:i===t?.id?y.jsx(yo,{color:"primary",size:13}):a("SHOW_DETAILS"),component:"button",variant:"filled",clickable:!0,size:"small",sx:{backgroundColor:l.palette.brandColor.orange,color:l.palette.brandColor.white}}),!t?.isRead&&y.jsx(Ml,{icon:y.jsx(hN,{className:`${c==="light"?"chip-icon-light":"chip-icon-dark"}`}),disabled:i,onClick:r,label:a("ACKNOWLEDGE"),component:"button",variant:"outlined",clickable:!0,size:"small"}),t?.primaryCTAURL&&y.jsx(Ml,{disabled:t?.isPrimaryCTAClicked,onClick:()=>o({redirect:t?.isPrimaryCTARedirect,isClicked:t?.isPrimaryCTAClicked,url:t?.primaryCTAURL}),label:a(t?.primaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"}),t?.secondaryCTAURL&&y.jsx(Ml,{disabled:t?.isSecondaryCTAClicked,onClick:()=>o({redirect:t?.isSecondaryCTARedirect,isClicked:t?.isSecondaryCTAClicked,url:t?.secondaryCTAURL}),label:a(t?.secondaryCTALabel),component:"button",variant:"outlined",clickable:!0,size:"small"})]})}),y.jsxs(He,{display:"flex",flexDirection:"row",alignItems:"center",gap:.35,children:[y.jsx(Qr,{sx:{fontSize:"0.8rem"},children:a(t?.product)}),y.jsx(Qr,{color:l.palette.primary.notifyTextColor,children:"•"}),y.jsx(Qr,{sx:{fontSize:"0.8rem"},children:O9(t?.createdAt,a)})]})]})};v2.propTypes={type:s.string,title:s.string,subTitle:s.string,isRead:s.bool,handleShowDetails:s.func,handleRead:s.func};const Rl=60,x2=2,w2=({data:e,handleRead:t,handleShowDetails:n,clickId:r,mode:o,t:i})=>{const{isMarkAllAsRead:a}=O.useContext(af),l=O.useRef(null),[c,u]=O.useState({start:0,end:4}),d=e?.length,f=new Date,p=new Intl.DateTimeFormat("en-US",{day:"numeric",month:"long",year:"numeric"}).format(f),h=O.useMemo(()=>o?a?.count?e?.filter(v=>!v.isRead):[]:e||[],[e,o,a]),g=h.slice(c.start,c.end),m=c.start*Rl,b=(d-c.end)*Rl,S=()=>{const v=l.current;if(!v)return;const x=v.scrollTop,T=v.clientHeight,P=Math.floor(x/Rl)-x2,M=Math.ceil(T/Rl)+2*x2,R=Math.max(0,Math.min(d-1,P)),A=Math.max(R,Math.min(d,R+M));u($=>$.start===R&&$.end===A?$:{start:R,end:A})},k=({url:v})=>{window.open(v,"_blank")},w=O.useMemo(()=>D9(g),[g]);return O.useEffect(()=>{let v;const x=()=>{v&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{S()})},T=l.current;if(T)return S(),T.addEventListener("scroll",x),()=>{cancelAnimationFrame(v),T.removeEventListener("scroll",x)}},[d]),h.length||i("CONTAINER_MESSAGE"),y.jsxs(oe,{ref:l,sx:{height:"100%",overflowY:"auto"},children:[y.jsx(oe,{style:{height:m}}),Object.entries(w).map(([v,x])=>{const T=localStorage.getItem("i18nextLng"),P=new Date(v),M=new Intl.DateTimeFormat(T,{month:"long"}).format(P),R=P.getDate(),A=P.getFullYear(),$=`${M} ${R}, ${A}`;return y.jsxs(O.Fragment,{children:[v!==p&&y.jsx(q4,{children:$}),x.map((C,j)=>y.jsx(v2,{item:C,handleCTAClicked:k,handleShowDetails:()=>n(C.id,C.snopId),handleRead:()=>t([C.id],C.snopId),clickId:r,t:i},`${C.id}_${j}`))]},v)}),y.jsx(oe,{style:{height:b}})]})};w2.propTypes={data:s.array,handleRead:s.func,handleShowDetails:s.func};const mN=({onRefresh:e,handleShowDetails:t,clickId:n,handleRead:r,handleMarkAllAsRead:o,t:i})=>{const{loading:a,activeTab:l,data:c,tabData:u,mode:d,page:f,setPage:p,handleTabChange:h,toggleAlertMode:g}=u2({});return y.jsxs(y.Fragment,{children:[y.jsxs(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,pt:2},children:[y.jsx(at,{variant:"h2",sx:{fontSize:"1.2rem",color:m=>m.palette.primary.notifyTextColor},children:i("NOTIFICATION")}),y.jsx(oe,{onClick:e,children:y.jsx(Gt,{url:We.Refresh,alt:"refresh",sx:{cursor:"pointer"}})})]}),y.jsx(oe,{sx:{borderBottom:1,m:"1.2rem 1.2rem 0 1.2rem",borderColor:m=>m.palette.primary.notifyBorderColor},children:y.jsxs(K4,{value:l,onChange:h,children:[y.jsx(of,{label:y.jsx(oe,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(at,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("ALL",{count:c?.filter(m=>!m?.isRead)?.length||0})})})}),y.jsx(of,{label:y.jsx(oe,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:y.jsx(at,{component:"span",sx:{fontWeight:500,fontSize:"1rem"},children:i("INFO",{count:c?.filter(m=>m?.type==="INFO"&&!m?.isRead)?.length||0})})}),sx:{color:m=>m.palette.brandColor.blue}}),y.jsx(of,{label:y.jsx(oe,{sx:{display:"flex",alignItems:"center",fontSize:"1rem",fontWeight:"500"},children:i("ERROR",{count:c?.filter(m=>m?.type==="ERROR"&&!m?.isRead)?.length||0})}),sx:{color:m=>m.palette.brandColor.red}})]})}),y.jsx(Gc,{dividers:!0,sx:{p:0,...a&&!u.length&&{alignItems:"center",justifyContent:"center"},flexGrow:1,overflowY:"auto",mx:"1.2rem",borderColor:m=>m.palette.primary.notifyBorderColor},tabIndex:-1,children:a&&!u.length?y.jsx(oe,{sx:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:y.jsx(yo,{size:30,sx:{color:m=>m.palette.primary.notifyIconColor}})}):y.jsx(y.Fragment,{children:y.jsx(w2,{data:u,handleShowDetails:t,handleRead:r,clickId:n,page:f,setPage:p,mode:d,t:i})})}),y.jsxs(qc,{sx:{justifyContent:"space-between",px:"1.2rem"},children:[y.jsxs(He,{direction:"row",gap:1,children:[y.jsx(Qr,{sx:{fontSize:"1rem"},children:i("SHOW_UNREAD")}),y.jsx(Y4,{disabled:a,checked:d,onChange:g})]}),y.jsx(ja,{variant:"outlined",className:"view-all",onClick:o,startIcon:y.jsx(fN,{}),disabled:!c?.filter(m=>!m?.isRead)?.length,style:{backgroundColor:"transparent"},sx:{fontSize:"1rem",fontWeight:"300",p:0,border:"none",textTransform:"none",color:m=>m.palette.primary.notifyTextColor,"&:hover":{color:m=>m.palette.primary.notifyActiveText,background:"transparent",boxShadow:"none",border:"none"},"&.Mui-disabled":{opacity:.5,color:m=>`${m.palette.primary.notifyActiveText}!important`,background:"transparent",boxShadow:"none",border:"none"}},children:i("READ_ALL")})]})]})},gN=({data:e,handleClose:t,t:n})=>{const[r,o]=O.useState(1),[i,a]=O.useState(10),[l,c]=O.useState(e?.notificationDetails?.length||0),[u,d]=O.useState("sku_name"),[f,p]=O.useState("asc"),[h,g]=O.useState([]),[m,b]=O.useState("");return O.useEffect(()=>{if((m||u)&&e?.notificationDetails?.length){const S=M9(e?.notificationDetails,P4,m);if(u){const k=R9(S,u,f);g(Fd(k,r,i)),c(k?.length||0);return}g(Fd(S,r,i)),c(S?.length||0);return}g(Fd(e?.notificationDetails,r,i)),c(e?.notificationDetails?.length)},[m,e,r,i,f,u]),y.jsxs(y.Fragment,{children:[y.jsxs(He,{direction:"row",justifyContent:"space-between",sx:{padding:"1.5rem 2rem",borderBottom:"0.1rem solid",borderColor:S=>S.palette.primary.notifyBorderColor},children:[y.jsx(at,{component:"h2",sx:{fontSize:"1.4rem",color:S=>S.palette.primary.notifyActiveText},children:n(e?.message)||e?.message}),y.jsx(oe,{onClick:t,sx:{cursor:"pointer"},children:y.jsx(Gt,{url:We.CloseCircle})})]}),y.jsx(Gc,{children:y.jsx(sf,{t:n,tableProps:{data:h,columns:{...H4({t:n}),isManageable:!1},sort:{sortField:u,sortDir:f,onSort:S=>{const k=S?.column?.key;p(w=>u===k&&w==="asc"?"desc":"asc"),d(k)}},pagination:{selectedPage:r,rowPerPage:i,totalRecords:l,onPageChange:S=>{o(S)},onPageSizeChange:S=>{a(S?.value),o(1)}}},toolbarProps:{defaultTools:{search:{isRequired:!0,onChange:S=>{const k=S.target.value;k&&o(1),b(k)},placeholder:`${n("SEARCH")}...`}}}})}),y.jsx(qc,{sx:{padding:"1.5rem 2rem"}})]})},yN=({baseUrl:e,t})=>{const{alertDialogProps:n,showDetailsProps:r,fetchNotification:o,isMarkAllAsRead:i}=u2({baseUrl:e});return y.jsxs(y.Fragment,{children:[y.jsx(oe,{sx:{display:"flex",justifyContent:"center",cursor:"pointer",marginTop:"0.6rem"},onClick:()=>{o(),n?.setOpen?.(!0)},children:y.jsx(dN,{count:i.count})}),y.jsx(h2,{...n,children:y.jsx(mN,{...n,t})}),y.jsx(h2,{...r,children:y.jsx(gN,{...r,t})})]})},bN=({baseUrl:e,t})=>y.jsx(rn,{children:y.jsx(l2,{children:y.jsx(yN,{baseUrl:e,t})})}),vN=({rightChild:e,leftChild:t,isDrawerMerged:n,isDrawerOpen:r,drawerTitle:o,showExpand:i,onCloseClick:a,onMergeClick:l,onExpandClick:c,isDrawerExpanded:u,styles:d,showMerge:f,isCloseVisible:p=!0})=>{const h=wt();return y.jsx(oe,{sx:{position:"relative",overflow:"hidden"},children:y.jsxs(_s,{container:!0,sx:{height:"100%"},children:[y.jsx(_s,{item:!0,sx:{width:n?d?.drawerWidth?`calc(${"100%"-d?.drawerWidth})`:"75%":"100%",position:"relative",zIndex:3,height:"calc(100vh - 7rem)",p:"0rem 1.5rem",overflow:"auto"},children:t}),r&&!n&&y.jsx(y.Fragment,{children:y.jsx(oe,{onClick:a,sx:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"#07080B80",backdropFilter:"blur(3px)",zIndex:3,transition:"opacity 0.3s ease-in-out"}})}),e&&y.jsxs(_s,{item:!0,sx:{width:u?"90%":d?.drawerWidth||"25%",position:n?"relative":"absolute",top:0,right:0,height:"calc(100vh - 7rem)",backgroundColor:h.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 ${h.palette.primary.notifyBorderColor}`,display:"flex",flexDirection:"column"},children:[y.jsxs(He,{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(oe,{component:"img",src:We.Merge,sx:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},onClick:l}),y.jsx(Oo,{orientation:"vertical",flexItem:!0,sx:{mx:"1rem",height:"auto!important",borderColor:h.palette.primary.notifyBorderColor}})]}),y.jsxs(He,{direction:"row",justifyContent:"space-between",alignItems:"center",flexGrow:1,children:[y.jsxs(He,{direction:"row",gap:"0.5rem",alignItems:"center",sx:{cursor:"pointer"},children:[p&&y.jsx(oe,{onClick:a,children:y.jsx(Gt,{url:We.CrossLight})}),y.jsx(at,{sx:{fontSize:"1.2rem",color:h.palette.primary.notifyTextColor},children:o})]}),y.jsx(He,{direction:"row",gap:"0.5rem",alignItems:"center",children:i&&y.jsx(oe,{onClick:c,sx:{cursor:"pointer"},children:y.jsx(oe,{component:"img",src:u?We.Collapse:We.Expand})})})]})]}),y.jsx(oe,{sx:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},overflow:"auto",px:2},children:e})]})]})})},S2=({layoutChildren:e,layoutProps:t})=>y.jsx(rn,{children:y.jsx(vN,{...e,...t})});S2.propTypes={layoutChildren:s.object.isRequired,layoutProps:s.object.isRequired};const C2=({parentProps:e,childProps:t})=>{const n=wt();return y.jsxs(He,{sx:{background:n.palette.primary.notifyBackground,border:`0.1rem solid ${n.palette.primary.notifyBorderColor}`,borderRadius:"1rem",position:"relative",overflow:"hidden"},children:[y.jsx(He,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{maxHeight:"10rem",p:"1.5rem",cursor:"pointer",zIndex:4},onClick:t.toggleExpand,children:e.content}),y.jsx(Fo.div,{layout:!0,initial:{opacity:0,maxHeight:0},animate:{opacity:t.isExpanded?1:0,maxHeight:t.isExpanded?"50rem":0},transition:{duration:.5,ease:"easeInOut"},style:{background:n.palette.primary.notifyBackground,overflow:"hidden",display:"flex",flexDirection:"column",width:"100%"},children:y.jsx(oe,{sx:{p:"1rem"},children:t.content})})]})};C2.propTypes={parentProps:s.object.isRequired,childProps:s.object.isRequired};const T2=({accordionProps:e})=>y.jsx(rn,{children:y.jsx(l2,{children:y.jsx(C2,{...e})})});T2.propTypes={accordionProps:s.object.isRequired};const k2=O.createContext(null),xN=k2.Provider,wN=()=>{const e=O.useContext(k2);return e||console.warn("useAnalytics used outside AnalyticsProvider"),e};ct.Accordion=T2,ct.AnalyticsProvider=xN,ct.Button=sr,ct.Checkbox=cl,ct.DatePicker=F9,ct.Grid=sf,ct.Header=i2,ct.InputField=nv,ct.Loader=Q9,ct.Notification=bN,ct.Select=rv,ct.SliderLayout=S2,ct.Switch=sv,ct.TextField=fl,ct.ToastProvider=G9,ct.TranslationContext=an,ct.toast=H9,ct.useAnalytics=wN,Object.defineProperty(ct,Symbol.toStringTag,{value:"Module"})}));
|
|
257
257
|
//# sourceMappingURL=index.umd.js.map
|