try{!function(){var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7442035a-2192-40d3-aaad-e6133acd9d41",e._sentryDebugIdIdentifier="sentry-dbid-7442035a-2192-40d3-aaad-e6133acd9d41")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6985],{17321:(e,t,r)=>{r.d(t,{e:()=>u});var a=r(12115),o=r(65148),n=r(85410);function l(e){return`reportMeta_${e}`}function s(e){return JSON.stringify([...e].sort((e,t)=>e.apiName.localeCompare(t.apiName)).map(e=>({apiName:e.apiName,dataType:e.dataType,sortable:e.sortable,hidden:e.hidden,label:e.label,labelKey:e.labelKey,format:e.format,group:e.group})))}function i(e){return JSON.stringify([...e].sort((e,t)=>e.name.localeCompare(t.name)).map(({appliedValue:e,...t})=>t))}function c(e){try{let t=l(e),r=localStorage.getItem(t);if(!r)return null;let a=JSON.parse(r);if(!function(e){try{if(!e||"object"!=typeof e)return!1;if(1!==e.version)return console.warn("[ReportMetadataCache] Version mismatch, invalidating"),!1;if("number"!=typeof e.cachedAt||Date.now()-e.cachedAt>864e5)return console.warn("[ReportMetadataCache] Cache expired"),!1;if(!Array.isArray(e.fields)||!Array.isArray(e.filters))return console.warn("[ReportMetadataCache] Invalid structure"),!1;for(let t of e.fields){if(!t||"object"!=typeof t)return!1;if("string"!=typeof t.apiName||"string"!=typeof t.dataType)return console.warn("[ReportMetadataCache] Invalid field structure"),!1}for(let t of e.filters){if(!t||"object"!=typeof t)return!1;if("string"!=typeof t.name||"string"!=typeof t.type)return console.warn("[ReportMetadataCache] Invalid filter structure"),!1}return!0}catch{return!1}}(a))return localStorage.removeItem(t),null;return a}catch(t){console.error("[ReportMetadataCache] Load failed, clearing:",t);try{localStorage.removeItem(l(e))}catch{}return null}}function u({reportName:e,filters:t,options:r,lang:u,enabled:f=!0,onSuccess:d,onError:m}){let{language:p}=(0,n.ok)(),y=u??("en"!==p?p:void 0),[S,b]=(0,a.useState)([]),[h,g]=(0,a.useState)(null),[R,D]=(0,a.useState)(0),[T,C]=(0,a.useState)(()=>{if(!e)return[];let t=c(e);return t?.fields||[]}),[E,B]=(0,a.useState)(()=>{if(!e)return[];let t=c(e);return t?.filters.map(e=>({...e,appliedValue:void 0}))||[]}),[U,I]=(0,a.useState)({}),[N,w]=(0,a.useState)(null),[v,A]=(0,a.useState)(null),[G,O]=(0,a.useState)(!1),[k,x]=(0,a.useState)(!1),[H,L]=(0,a.useState)(!0),[F,M]=(0,a.useState)(!1),[$,P]=(0,a.useState)(null),_=(0,a.useRef)(T),J=(0,a.useRef)(E),X=(0,a.useRef)(t),j=(0,a.useRef)(r);X.current=t,j.current=r;let Y=(0,a.useCallback)(async(t=!0)=>{if(!f||!e)return void L(!1);t?L(!0):M(!0),P(null);try{let t={report:e,filters:X.current,options:j.current,lang:y},r=await o.y.queryReport(t);!function(e,t){try{if(e.length!==t.length)return!1;let r=s(e),a=s(t);return r===a}catch{return!1}}(_.current,r.fields)&&(C(r.fields),_.current=r.fields),!function(e,t){try{if(e.length!==t.length)return!1;let r=i(e),a=i(t);return r===a}catch{return!1}}(J.current,r.filters)&&(J.current=r.filters),B(r.filters),I(r.appliedFilters),w(r.meta.reportType),A(r.meta.reportDescription||null),O(r.meta.exportable??!1),x(r.meta.emailDisabled??!1),"list"===r.meta.reportType?(b(r.rows||[]),D(r.total||0),g(null)):(g(r.totals||null),b([]),D(0)),function(e,t,r){try{let a=r.map(({appliedValue:e,...t})=>t),o={version:1,reportName:e,cachedAt:Date.now(),fieldsHash:s(t),filtersHash:i(r),fields:t,filters:a};localStorage.setItem(l(e),JSON.stringify(o))}catch(e){console.error("[ReportMetadataCache] Failed to save:",e)}}(e,r.fields,r.filters),d?.(r)}catch(r){try{localStorage.removeItem(l(e))}catch(e){console.error("[ReportMetadataCache] Failed to clear:",e)}let t=r instanceof Error?r.message:"Failed to fetch report data";P(t),m?.(r instanceof Error?r:Error(t))}finally{L(!1),M(!1)}},[e,y,f,d,m]),V=JSON.stringify(t),q=JSON.stringify(r),K=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{let e=!K.current;K.current=!0,Y(e)},[e,V,q,f,y]),{rows:S,totals:h,total:R,fields:T,filters:E,appliedFilters:U,reportType:N,reportDescription:v,exportable:G,emailDisabled:k,isLoading:H,isRefreshing:F,error:$,refetch:(0,a.useCallback)(()=>Y(!0),[Y]),softRefresh:(0,a.useCallback)(()=>Y(!1),[Y])}}},47790:(e,t,r)=>{r.d(t,{ef:()=>a.e,pg:()=>l});var a=r(17321),o=r(12115),n=r(65148);function l({reportName:e,enabled:t=!0}){let[r,a]=(0,o.useState)(null),[l,s]=(0,o.useState)(!0),[i,c]=(0,o.useState)(null),u=(0,o.useCallback)(async()=>{if(!t||!e)return void s(!1);s(!0),c(null);try{let t=await n.y.getReportSchema(e);a(t)}catch(e){c(e instanceof Error?e.message:"Failed to fetch report schema")}finally{s(!1)}},[e,t]);return(0,o.useEffect)(()=>{u()},[u]),{schema:r,reportType:r?.type||null,filters:r?.filters||[],columns:r?.columns||[],allowedSortColumns:r?.sorting?.allowed||[],defaultSort:r?.sorting?.default||null,pagination:r?.pagination||!1,permission:r?.permission||null,isLoading:l,error:i,refetch:u}}},71572:(e,t,r)=>{r.d(t,{BD:()=>p,Qn:()=>S,H2:()=>y});var a=r(95155),o=r(12115),n=r(62238),l=r(64469),s=r(29200),i=r(37780);class c extends i.W{async getCurrencyData(){return this.typedGet("/currency/rates/list",{},"Failed to get currency rates",{requireAuth:!1})}}let u=new c,f={USD:{code:"USD",symbol:"$",name:"US Dollar",locale:"en-US",decimals:2,position:"before"},TRY:{code:"TRY",symbol:"₺",name:"Turkish Lira",locale:"tr-TR",decimals:2,position:"after"},IDR:{code:"IDR",symbol:"Rp",name:"Indonesian Rupiah",locale:"id-ID",decimals:0,position:"before"},BRL:{code:"BRL",symbol:"R$",name:"Brazilian Real",locale:"pt-BR",decimals:2,position:"before"},INR:{code:"INR",symbol:"₹",name:"Indian Rupee",locale:"hi-IN",decimals:2,position:"before"},ARS:{code:"ARS",symbol:"$",name:"Argentine Peso",locale:"es-AR",decimals:2,position:"before"},USDT:{code:"USDT",symbol:"USDT",name:"Tether",locale:"en-US",decimals:6,position:"before"},BNB:{code:"BNB",symbol:"BNB",name:"Binance Coin",locale:"en-US",decimals:8,position:"before"},BTC:{code:"BTC",symbol:"₿",name:"Bitcoin",locale:"en-US",decimals:8,position:"before"},DOGE:{code:"DOGE",symbol:"DOGE",name:"Dogecoin",locale:"en-US",decimals:8,position:"before"},ETH:{code:"ETH",symbol:"Ξ",name:"Ethereum",locale:"en-US",decimals:8,position:"before"},LTC:{code:"LTC",symbol:"Ł",name:"Litecoin",locale:"en-US",decimals:8,position:"before"},TRX:{code:"TRX",symbol:"TRX",name:"Tron",locale:"en-US",decimals:6,position:"before"},USDC:{code:"USDC",symbol:"USDC",name:"USD Coin",locale:"en-US",decimals:6,position:"before"},EGP:{code:"EGP",symbol:"E\xa3",name:"Egyptian pound",locale:"ar-EG",decimals:6,position:"before"},THB:{code:"THB",symbol:"฿",name:"Thai Baht",locale:"th-TH",decimals:2,position:"before"}},d={USD:1,TRY:32.5,IDR:15500,BRL:5,INR:83,ARS:1e3,USDT:1,BNB:.0015,BTC:1e-5,DOGE:3,ETH:25e-5,LTC:.009,TRX:4,USDC:1,EGP:.021,THB:35,lastUpdated:new Date().toISOString()},m=(0,o.createContext)({currency:"USD",setCurrency:()=>{},currencyInfo:f.USD,exchangeRates:d,convert:e=>e,format:e=>e.toString(),formatWithSymbol:e=>`$${e}`,isLoading:!1,error:null}),p=o.memo(function({children:e}){let t=(0,s.GV)(l.mB),{countryConfig:r,currency:i}=(0,n.F)(),[c,p]=(0,o.useState)("USD"),[y,S]=(0,o.useState)(d),[b,h]=(0,o.useState)(!1),[g,R]=(0,o.useState)(null),D=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(t?.preferredCurrency&&f[t.preferredCurrency])return void p(t.preferredCurrency);let e=r?.defaultCurrency||i;e&&f[e]&&p(e)},[t?.preferredCurrency,r,i]),(0,o.useEffect)(()=>{D.current||(async()=>{h(!0),R(null);try{let e=localStorage.getItem("exchangeRates");if(e){let t=JSON.parse(e);if(Date.now()-new Date(t.lastUpdated).getTime()<36e5){S(t),D.current=!0,h(!1);return}}let t=await u.getCurrencyData();if(t.success){let e={USD:1,TRY:t.rates?.TRY||d.TRY,IDR:t.rates?.IDR||d.IDR,BRL:t.rates?.BRL||d.BRL,INR:t.rates?.INR||d.INR,lastUpdated:new Date().toISOString(),ARS:t.rates?.ARS||d.ARS,USDT:t.rates?.USDT||d.USDT,BNB:t.rates?.BNB||d.BNB,BTC:t.rates?.BTC||d.BTC,DOGE:t.rates?.DOGE||d.DOGE,ETH:t.rates?.ETH||d.ETH,LTC:t.rates?.LTC||d.LTC,TRX:t.rates?.TRX||d.TRX,USDC:t.rates?.USDC||d.USDC,EGP:t.rates?.EGP||d.EGP,THB:t.rates?.THB||d.THB};S(e),localStorage.setItem("exchangeRates",JSON.stringify(e)),D.current=!0}else throw Error("Failed to fetch exchange rates")}catch(e){console.error("Error fetching exchange rates:",e),R("Failed to load exchange rates. Using default values."),S(d)}finally{h(!1)}})()},[]);let T=(0,o.useCallback)((e,t="USD",r=c)=>{if(t===r)return e;let a="USD"===t?e:e/y[t];return"USD"===r?a:a*y[r]},[c,y]),C=(0,o.useCallback)((e,t={})=>{let r=f[c],{showSymbol:a=!1,decimals:o=r.decimals,useGrouping:n=!0,compact:l=!1}=t;return new Intl.NumberFormat(r.locale,{minimumFractionDigits:Math.min(2,o),maximumFractionDigits:o,useGrouping:n,numberingSystem:"latn",...l&&{notation:"compact",compactDisplay:"short"}}).format(e)},[c]),E=(0,o.useCallback)((e,t={})=>{let r=f[c],a=C(e,t);return"before"===r.position?`${r.symbol}${a}`:`${a} ${r.symbol}`},[c,C]),B=(0,o.useCallback)(e=>{p(e)},[]),U=(0,o.useMemo)(()=>({currency:c,setCurrency:B,currencyInfo:f[c],exchangeRates:y,convert:T,format:C,formatWithSymbol:E,isLoading:b,error:g}),[c,B,y,T,C,E,b,g]);return(0,a.jsx)(m.Provider,{value:U,children:e})}),y=()=>{let e=(0,o.useContext)(m);if(!e)throw Error("useCurrency must be used within a CurrencyProvider");return e},S=e=>f[e]?.symbol||"$"},87767:(e,t,r)=>{r.d(t,{F:()=>i,j:()=>c});var a=r(95155),o=r(12115),n=r(85410);let l=(0,o.createContext)({direction:"ltr"}),s=["ar","ar-EG"],i=o.memo(function({children:e}){let{language:t}=(0,n.ok)(),r=s.includes(t)?"rtl":"ltr";(0,o.useEffect)(()=>{"u">typeof document&&(document.documentElement.setAttribute("dir",r),document.documentElement.setAttribute("lang",t))},[r,t]);let i=o.useMemo(()=>({direction:r}),[r]);return(0,a.jsx)(l.Provider,{value:i,children:e})}),c=()=>(0,o.useContext)(l)}}]);