@accounter/client 0.0.11-alpha-20260126121840-9987d09cc7cb596314ad01124c1061feba2117b0 → 0.0.11-alpha-20260126134148-852996a09ceb3ee1b16fb7dc9eadb1e1407462c7

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-D5PsdcQv.js → Checkbox-Dmuz3t7B.js} +1 -1
  3. package/dist/assets/{MultiSelect-C5wjF9jC.js → MultiSelect-DBeIExB5.js} +1 -1
  4. package/dist/assets/{Progress-CUpt9lUI.js → Progress---sZILQb.js} +1 -1
  5. package/dist/assets/{Table-pGQWLQ8H.js → Table-BQv3frL8.js} +1 -1
  6. package/dist/assets/{Typography-B3aRT5ej.js → Typography-B8Kph7eR.js} +1 -1
  7. package/dist/assets/{accordion-Bd6kAhfN.js → accordion-Bn08_4fN.js} +1 -1
  8. package/dist/assets/{accountant-approvals-BJGkKn8O.js → accountant-approvals-DuNl7y6H.js} +1 -1
  9. package/dist/assets/{accounter-table-CioecC_Y.js → accounter-table-DTsgtq5M.js} +1 -1
  10. package/dist/assets/{addDays-DhQZBfTq.js → addDays-DTiBTTns.js} +1 -1
  11. package/dist/assets/{all-charges-UjLePnh5.js → all-charges-DPyM-a74.js} +1 -1
  12. package/dist/assets/{arrow-up-down-YhPbp1Ud.js → arrow-up-down-VY6mkkTR.js} +1 -1
  13. package/dist/assets/{building-2-Df516nsd.js → building-2-CMKd_bU8.js} +1 -1
  14. package/dist/assets/{business-CryBsRqy.js → business-BVMKhHFx.js} +1 -1
  15. package/dist/assets/{business-extended-info-zz1obrFs.js → business-extended-info-B94y5ZK6.js} +1 -1
  16. package/dist/assets/{business-header-DL-hzsQ4.js → business-header-BC86M-9m.js} +1 -1
  17. package/dist/assets/{business-ledger-filters-Dh6IJIbe.js → business-ledger-filters-es3H4rPK.js} +1 -1
  18. package/dist/assets/{business-ledger-single-ebXw596v.js → business-ledger-single-U3zkqgW2.js} +1 -1
  19. package/dist/assets/{business-trip-Bn5hm1D5.js → business-trip-BUKYnQkG.js} +1 -1
  20. package/dist/assets/charge-DuqIMfNm.js +1 -0
  21. package/dist/assets/{charges-filters-BLSfy08K.js → charges-filters-CFCAP-bP.js} +1 -1
  22. package/dist/assets/{charges-ledger-validation-BOn22w9P.js → charges-ledger-validation-CCTNRpCE.js} +1 -1
  23. package/dist/assets/charges-table-BJtpvXfL.js +7 -0
  24. package/dist/assets/{contracts-iKKpsNnL.js → contracts-ljjcB_x7.js} +1 -1
  25. package/dist/assets/{data-table-column-header--gzXkv5r.js → data-table-column-header-CZ1dXiU0.js} +1 -1
  26. package/dist/assets/{data-table-pagination-CLXUcmJJ.js → data-table-pagination-XAlQIbO9.js} +1 -1
  27. package/dist/assets/{deposits-transactions-table-CV-YceTW.js → deposits-transactions-table-2rtRFZgK.js} +1 -1
  28. package/dist/assets/{download-csv-weF1Lwst.js → download-csv-BSGaUZsM.js} +1 -1
  29. package/dist/assets/{download-csv-button-DVLHjMAB.js → download-csv-button-CMQBUQeX.js} +1 -1
  30. package/dist/assets/{editable-business-trip-DRSlJ54m.js → editable-business-trip-CED1Su3d.js} +1 -1
  31. package/dist/assets/{eye-off-DWYC0Eax.js → eye-off-Buv7eciz.js} +1 -1
  32. package/dist/assets/{funnel-0IvwyZBf.js → funnel-Cfb9Pxmr.js} +1 -1
  33. package/dist/assets/{index-D_XfDEW8.js → index-3ev2Q3E9.js} +1 -1
  34. package/dist/assets/{index-DZFQ92ui.js → index-7gCTV42h.js} +1 -1
  35. package/dist/assets/{index-BFEE5U-A.js → index-8fdLByFg.js} +1 -1
  36. package/dist/assets/{index-CVefTdZ8.js → index-B0hZ0TDG.js} +1 -1
  37. package/dist/assets/{index-B6VKQBtu.js → index-B4OP8iL7.js} +1 -1
  38. package/dist/assets/{index-CAAL0SGN.js → index-BN-I0GSO.js} +1 -1
  39. package/dist/assets/{index-DSAS0BpU.js → index-BhFsGqUx.js} +1 -1
  40. package/dist/assets/{index-DaDghnaZ.js → index-Bui9zV-z.js} +1 -1
  41. package/dist/assets/{index-BrgWieYs.js → index-C7p19nIa.js} +1 -1
  42. package/dist/assets/{index-1oajNqKA.js → index-CPMJQkvw.js} +1 -1
  43. package/dist/assets/{index-Bw_9Tifu.js → index-CSdQtH7c.js} +1 -1
  44. package/dist/assets/{index-AI_GyykK.js → index-CcZll7L2.js} +1 -1
  45. package/dist/assets/{index-v8SIf-h9.js → index-CjG9JDZB.js} +1 -1
  46. package/dist/assets/{index-BINmUTjA.js → index-DGAT1KYx.js} +1 -1
  47. package/dist/assets/{index-BA-I_zCt.js → index-DIrLsKod.js} +1 -1
  48. package/dist/assets/{index-MPZl3TTq.js → index-DJY6AKiM.js} +1 -1
  49. package/dist/assets/{index-CYLoUT7S.js → index-DOy0Yf1i.js} +1 -1
  50. package/dist/assets/{index-BESPuoZl.js → index-DRBzHdu9.js} +1 -1
  51. package/dist/assets/{index-CgvjLFyG.js → index-Dal_ULkA.js} +1 -1
  52. package/dist/assets/{index-BoVSybOL.js → index-DokXNUuN.js} +1 -1
  53. package/dist/assets/{index-CGpiJ6wl.js → index-Dq33WQoi.js} +1 -1
  54. package/dist/assets/{index-CkPv0ZF8.js → index-DzzUoyj4.js} +1 -1
  55. package/dist/assets/{index-ajJcMQms.js → index-GlUqZUgQ.js} +1 -1
  56. package/dist/assets/{index-Cm0VDoDd.js → index-X3RoQQa9.js} +1 -1
  57. package/dist/assets/{index-CHzieg87.js → index-X9rrwleE.js} +1 -1
  58. package/dist/assets/{index-D1_HHRLX.js → index-rI994S3C.js} +4 -4
  59. package/dist/assets/{index.es-Dkm1W8bL.js → index.es-C2YDJ0AL.js} +1 -1
  60. package/dist/assets/issue-document-zNxGzRkY.js +1 -0
  61. package/dist/assets/{login-page-B5bqhOTx.js → login-page-BimTSmTC.js} +1 -1
  62. package/dist/assets/{missing-info-charges-DiIM7lBQ.js → missing-info-charges-CVhY60ZL.js} +1 -1
  63. package/dist/assets/{modal-CNW2FGYc.js → modal-BXR_xgUm.js} +1 -1
  64. package/dist/assets/{modify-contract-dialog-BBPR_IL8.js → modify-contract-dialog-flMl2p_T.js} +1 -1
  65. package/dist/assets/{page-layout-BOjYoqoi.js → page-layout-DMGj5xhW.js} +1 -1
  66. package/dist/assets/{page-not-found-UQZi0ekr.js → page-not-found-B_GB5ntj.js} +1 -1
  67. package/dist/assets/{panel-top-open-Bxnxp1BU.js → panel-top-open-Bf39HBrp.js} +1 -1
  68. package/dist/assets/{report-commentary-row-BtmSnv64.js → report-commentary-row-BMyeQR9J.js} +1 -1
  69. package/dist/assets/{save-BHNOV5fu.js → save-jkuyCWyY.js} +1 -1
  70. package/dist/assets/{similar-transactions-modal-BTidmv0G.js → similar-transactions-modal-DX3CPrMo.js} +1 -1
  71. package/dist/assets/{sub-6-HnNA3H.js → sub-CEXBz_OW.js} +1 -1
  72. package/dist/assets/subMonths-DY4HlBVa.js +1 -0
  73. package/dist/assets/{summary-C5TvRXn1.js → summary-CPKS_69D.js} +1 -1
  74. package/dist/assets/{toggle-expansion-button-Dg_XsE6y.js → toggle-expansion-button-Y2eS7nqg.js} +1 -1
  75. package/dist/assets/{update-accountant-status-CU6mIJqS.js → update-accountant-status-zL6vnwU9.js} +1 -1
  76. package/dist/assets/{use-issue-monthly-documents-CdxtNiuP.js → use-issue-monthly-documents-D9vQpbaZ.js} +1 -1
  77. package/dist/assets/{use-url-query-RoURh24O.js → use-url-query-CqWra6gD.js} +1 -1
  78. package/dist/index.html +1 -1
  79. package/package.json +1 -1
  80. package/src/components/common/merge-charges/index.tsx +1 -1
  81. package/src/components/common/modals/preview-document-modal.tsx +2 -5
  82. package/src/gql/graphql.ts +1 -1
  83. package/dist/assets/charge-DhvD1RST.js +0 -1
  84. package/dist/assets/charges-table-Bjk5Mz--.js +0 -7
  85. package/dist/assets/issue-document-yi3XXbpe.js +0 -1
  86. package/dist/assets/subMonths-nC9-M0qS.js +0 -1
@@ -1,4 +1,4 @@
1
- import{dd as so,de as Ds,df as Fs,dg as zs,r as v,aG as Ie,dh as $e,di as Ns,j as x,dj as or,dk as io,bB as oo,B as ao,E as lo,bE as In,bF as Br,bN as Vr,w as Le,bH as co,ay as En,bI as uo,dl as b,dm as Bs,a6 as fo,dn as ho,F as po,u as mo,dp as go,L as xo,dq as yo}from"./index-D1_HHRLX.js";import{u as Vs}from"./use-url-query-RoURh24O.js";import{P as vo}from"./page-layout-BOjYoqoi.js";import{P as bo}from"./modal-CNW2FGYc.js";import{F as wo}from"./funnel-0IvwyZBf.js";import{u as Pt,g as De,a as Fe,c as je,s as W,_ as X,b as Ao,T as Mn}from"./Typography-B3aRT5ej.js";import{c as Ue,t as jn,a as Co,d as hn,b as Po,e as ko,f as So,g as Io,h as Hs,o as Hr,i as Eo,s as Mo,l as jo,u as Ro,j as Us,k as Oo,p as To,m as _o,n as $o,q as Lo,r as Do,v as Fo,w as zo}from"./sequential-CjOfRLtc.js";import{s as Gs}from"./sub-6-HnNA3H.js";import"./addDays-DhQZBfTq.js";import"./subMonths-nC9-M0qS.js";function No(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:so(t.components[n].defaultProps,r)}function Bo({props:e,name:t,defaultTheme:n,themeId:r}){let s=Ds(n);return s=s[r]||s,No({theme:s,name:t,props:e})}function Lt(){const e=Ds(Fs);return e[zs]||e}function ze({props:e,name:t}){return Bo({props:e,name:t,defaultTheme:Fs,themeId:zs})}function Un(e){return e&&e.ownerDocument||document}function Vo(e){return Un(e).defaultView||window}function Ur(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ho(e){const{controlled:t,default:n}=e,{current:r}=v.useRef(t!==void 0),[s,i]=v.useState(n),o=r?t:s,a=v.useCallback(c=>{r||i(c)},[]);return[o,a]}function Uo(e){return typeof e=="string"}function Go(e,t,n){return e===void 0||Uo(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Xo(e,t,n){return typeof e=="function"?e(t,n):e}function Wo(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function Gr(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function Yo(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:s,className:i}=e;if(!t){const h=Ie(n?.className,i,s?.className,r?.className),m={...n?.style,...s?.style,...r?.style},p={...n,...s,...r};return h.length>0&&(p.className=h),Object.keys(m).length>0&&(p.style=m),{props:p,internalRef:void 0}}const o=Wo({...s,...r}),a=Gr(r),c=Gr(s),l=t(o),u=Ie(l?.className,n?.className,i,s?.className,r?.className),d={...l?.style,...n?.style,...s?.style,...r?.style},f={...l,...n,...c,...a};return u.length>0&&(f.className=u),Object.keys(d).length>0&&(f.style=d),{props:f,internalRef:l.ref}}var re="top",fe="bottom",he="right",se="left",ar="auto",Dt=[re,fe,he,se],nt="start",kt="end",qo="clippingParents",Xs="viewport",ht="popper",Ko="reference",Xr=Dt.reduce(function(e,t){return e.concat([t+"-"+nt,t+"-"+kt])},[]),Ws=[].concat(Dt,[ar]).reduce(function(e,t){return e.concat([t,t+"-"+nt,t+"-"+kt])},[]),Qo="beforeRead",Zo="read",Jo="afterRead",ea="beforeMain",ta="main",na="afterMain",ra="beforeWrite",sa="write",ia="afterWrite",oa=[Qo,Zo,Jo,ea,ta,na,ra,sa,ia];function Ae(e){return e?(e.nodeName||"").toLowerCase():null}function ae(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function qe(e){var t=ae(e).Element;return e instanceof t||e instanceof Element}function ue(e){var t=ae(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lr(e){if(typeof ShadowRoot>"u")return!1;var t=ae(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function aa(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},s=t.attributes[n]||{},i=t.elements[n];!ue(i)||!Ae(i)||(Object.assign(i.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?i.removeAttribute(o):i.setAttribute(o,a===!0?"":a)}))})}function la(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var s=t.elements[r],i=t.attributes[r]||{},o=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=o.reduce(function(c,l){return c[l]="",c},{});!ue(s)||!Ae(s)||(Object.assign(s.style,a),Object.keys(i).forEach(function(c){s.removeAttribute(c)}))})}}const ca={name:"applyStyles",enabled:!0,phase:"write",fn:aa,effect:la,requires:["computeStyles"]};function we(e){return e.split("-")[0]}var Ye=Math.max,sn=Math.min,rt=Math.round;function Gn(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ys(){return!/^((?!chrome|android).)*safari/i.test(Gn())}function st(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),s=1,i=1;t&&ue(e)&&(s=e.offsetWidth>0&&rt(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&rt(r.height)/e.offsetHeight||1);var o=qe(e)?ae(e):window,a=o.visualViewport,c=!Ys()&&n,l=(r.left+(c&&a?a.offsetLeft:0))/s,u=(r.top+(c&&a?a.offsetTop:0))/i,d=r.width/s,f=r.height/i;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l,x:l,y:u}}function cr(e){var t=st(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function qs(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lr(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Me(e){return ae(e).getComputedStyle(e)}function ua(e){return["table","td","th"].indexOf(Ae(e))>=0}function Ne(e){return((qe(e)?e.ownerDocument:e.document)||window.document).documentElement}function pn(e){return Ae(e)==="html"?e:e.assignedSlot||e.parentNode||(lr(e)?e.host:null)||Ne(e)}function Wr(e){return!ue(e)||Me(e).position==="fixed"?null:e.offsetParent}function da(e){var t=/firefox/i.test(Gn()),n=/Trident/i.test(Gn());if(n&&ue(e)){var r=Me(e);if(r.position==="fixed")return null}var s=pn(e);for(lr(s)&&(s=s.host);ue(s)&&["html","body"].indexOf(Ae(s))<0;){var i=Me(s);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return s;s=s.parentNode}return null}function Ft(e){for(var t=ae(e),n=Wr(e);n&&ua(n)&&Me(n).position==="static";)n=Wr(n);return n&&(Ae(n)==="html"||Ae(n)==="body"&&Me(n).position==="static")?t:n||da(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function yt(e,t,n){return Ye(e,sn(t,n))}function fa(e,t,n){var r=yt(e,t,n);return r>n?n:r}function Ks(){return{top:0,right:0,bottom:0,left:0}}function Qs(e){return Object.assign({},Ks(),e)}function Zs(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var ha=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Qs(typeof t!="number"?t:Zs(t,Dt))};function pa(e){var t,n=e.state,r=e.name,s=e.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,a=we(n.placement),c=ur(a),l=[se,he].indexOf(a)>=0,u=l?"height":"width";if(!(!i||!o)){var d=ha(s.padding,n),f=cr(i),h=c==="y"?re:se,m=c==="y"?fe:he,p=n.rects.reference[u]+n.rects.reference[c]-o[c]-n.rects.popper[u],g=o[c]-n.rects.reference[c],y=Ft(i),w=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,A=p/2-g/2,C=d[h],P=w-f[u]-d[m],k=w/2-f[u]/2+A,E=yt(C,k,P),O=c;n.modifiersData[r]=(t={},t[O]=E,t.centerOffset=E-k,t)}}function ma(e){var t=e.state,n=e.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||qs(t.elements.popper,s)&&(t.elements.arrow=s))}const ga={name:"arrow",enabled:!0,phase:"main",fn:pa,effect:ma,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function it(e){return e.split("-")[1]}var xa={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ya(e,t){var n=e.x,r=e.y,s=t.devicePixelRatio||1;return{x:rt(n*s)/s||0,y:rt(r*s)/s||0}}function Yr(e){var t,n=e.popper,r=e.popperRect,s=e.placement,i=e.variation,o=e.offsets,a=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,h=f===void 0?0:f,m=o.y,p=m===void 0?0:m,g=typeof u=="function"?u({x:h,y:p}):{x:h,y:p};h=g.x,p=g.y;var y=o.hasOwnProperty("x"),w=o.hasOwnProperty("y"),A=se,C=re,P=window;if(l){var k=Ft(n),E="clientHeight",O="clientWidth";if(k===ae(n)&&(k=Ne(n),Me(k).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),k=k,s===re||(s===se||s===he)&&i===kt){C=fe;var R=d&&k===P&&P.visualViewport?P.visualViewport.height:k[E];p-=R-r.height,p*=c?1:-1}if(s===se||(s===re||s===fe)&&i===kt){A=he;var j=d&&k===P&&P.visualViewport?P.visualViewport.width:k[O];h-=j-r.width,h*=c?1:-1}}var T=Object.assign({position:a},l&&xa),L=u===!0?ya({x:h,y:p},ae(n)):{x:h,y:p};if(h=L.x,p=L.y,c){var $;return Object.assign({},T,($={},$[C]=w?"0":"",$[A]=y?"0":"",$.transform=(P.devicePixelRatio||1)<=1?"translate("+h+"px, "+p+"px)":"translate3d("+h+"px, "+p+"px, 0)",$))}return Object.assign({},T,(t={},t[C]=w?p+"px":"",t[A]=y?h+"px":"",t.transform="",t))}function va(e){var t=e.state,n=e.options,r=n.gpuAcceleration,s=r===void 0?!0:r,i=n.adaptive,o=i===void 0?!0:i,a=n.roundOffsets,c=a===void 0?!0:a,l={placement:we(t.placement),variation:it(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Yr(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Yr(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const ba={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:va,data:{}};var Ut={passive:!0};function wa(e){var t=e.state,n=e.instance,r=e.options,s=r.scroll,i=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,c=ae(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&l.forEach(function(u){u.addEventListener("scroll",n.update,Ut)}),a&&c.addEventListener("resize",n.update,Ut),function(){i&&l.forEach(function(u){u.removeEventListener("scroll",n.update,Ut)}),a&&c.removeEventListener("resize",n.update,Ut)}}const Aa={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wa,data:{}};var Ca={left:"right",right:"left",bottom:"top",top:"bottom"};function en(e){return e.replace(/left|right|bottom|top/g,function(t){return Ca[t]})}var Pa={start:"end",end:"start"};function qr(e){return e.replace(/start|end/g,function(t){return Pa[t]})}function dr(e){var t=ae(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fr(e){return st(Ne(e)).left+dr(e).scrollLeft}function ka(e,t){var n=ae(e),r=Ne(e),s=n.visualViewport,i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;var l=Ys();(l||!l&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a+fr(e),y:c}}function Sa(e){var t,n=Ne(e),r=dr(e),s=(t=e.ownerDocument)==null?void 0:t.body,i=Ye(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ye(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+fr(e),c=-r.scrollTop;return Me(s||n).direction==="rtl"&&(a+=Ye(n.clientWidth,s?s.clientWidth:0)-i),{width:i,height:o,x:a,y:c}}function hr(e){var t=Me(e),n=t.overflow,r=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function Js(e){return["html","body","#document"].indexOf(Ae(e))>=0?e.ownerDocument.body:ue(e)&&hr(e)?e:Js(pn(e))}function vt(e,t){var n;t===void 0&&(t=[]);var r=Js(e),s=r===((n=e.ownerDocument)==null?void 0:n.body),i=ae(r),o=s?[i].concat(i.visualViewport||[],hr(r)?r:[]):r,a=t.concat(o);return s?a:a.concat(vt(pn(o)))}function Xn(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ia(e,t){var n=st(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Kr(e,t,n){return t===Xs?Xn(ka(e,n)):qe(t)?Ia(t,n):Xn(Sa(Ne(e)))}function Ea(e){var t=vt(pn(e)),n=["absolute","fixed"].indexOf(Me(e).position)>=0,r=n&&ue(e)?Ft(e):e;return qe(r)?t.filter(function(s){return qe(s)&&qs(s,r)&&Ae(s)!=="body"}):[]}function Ma(e,t,n,r){var s=t==="clippingParents"?Ea(e):[].concat(t),i=[].concat(s,[n]),o=i[0],a=i.reduce(function(c,l){var u=Kr(e,l,r);return c.top=Ye(u.top,c.top),c.right=sn(u.right,c.right),c.bottom=sn(u.bottom,c.bottom),c.left=Ye(u.left,c.left),c},Kr(e,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ei(e){var t=e.reference,n=e.element,r=e.placement,s=r?we(r):null,i=r?it(r):null,o=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,c;switch(s){case re:c={x:o,y:t.y-n.height};break;case fe:c={x:o,y:t.y+t.height};break;case he:c={x:t.x+t.width,y:a};break;case se:c={x:t.x-n.width,y:a};break;default:c={x:t.x,y:t.y}}var l=s?ur(s):null;if(l!=null){var u=l==="y"?"height":"width";switch(i){case nt:c[l]=c[l]-(t[u]/2-n[u]/2);break;case kt:c[l]=c[l]+(t[u]/2-n[u]/2);break}}return c}function St(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=r===void 0?e.placement:r,i=n.strategy,o=i===void 0?e.strategy:i,a=n.boundary,c=a===void 0?qo:a,l=n.rootBoundary,u=l===void 0?Xs:l,d=n.elementContext,f=d===void 0?ht:d,h=n.altBoundary,m=h===void 0?!1:h,p=n.padding,g=p===void 0?0:p,y=Qs(typeof g!="number"?g:Zs(g,Dt)),w=f===ht?Ko:ht,A=e.rects.popper,C=e.elements[m?w:f],P=Ma(qe(C)?C:C.contextElement||Ne(e.elements.popper),c,u,o),k=st(e.elements.reference),E=ei({reference:k,element:A,placement:s}),O=Xn(Object.assign({},A,E)),R=f===ht?O:k,j={top:P.top-R.top+y.top,bottom:R.bottom-P.bottom+y.bottom,left:P.left-R.left+y.left,right:R.right-P.right+y.right},T=e.modifiersData.offset;if(f===ht&&T){var L=T[s];Object.keys(j).forEach(function($){var I=[he,fe].indexOf($)>=0?1:-1,M=[re,fe].indexOf($)>=0?"y":"x";j[$]+=L[M]*I})}return j}function ja(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=n.boundary,i=n.rootBoundary,o=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?Ws:c,u=it(r),d=u?a?Xr:Xr.filter(function(m){return it(m)===u}):Dt,f=d.filter(function(m){return l.indexOf(m)>=0});f.length===0&&(f=d);var h=f.reduce(function(m,p){return m[p]=St(e,{placement:p,boundary:s,rootBoundary:i,padding:o})[we(p)],m},{});return Object.keys(h).sort(function(m,p){return h[m]-h[p]})}function Ra(e){if(we(e)===ar)return[];var t=en(e);return[qr(e),t,qr(t)]}function Oa(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!0:o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,p=n.allowedAutoPlacements,g=t.options.placement,y=we(g),w=y===g,A=c||(w||!m?[en(g)]:Ra(g)),C=[g].concat(A).reduce(function(K,H){return K.concat(we(H)===ar?ja(t,{placement:H,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:p}):H)},[]),P=t.rects.reference,k=t.rects.popper,E=new Map,O=!0,R=C[0],j=0;j<C.length;j++){var T=C[j],L=we(T),$=it(T)===nt,I=[re,fe].indexOf(L)>=0,M=I?"width":"height",_=St(t,{placement:T,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),D=I?$?he:se:$?fe:re;P[M]>k[M]&&(D=en(D));var F=en(D),V=[];if(i&&V.push(_[L]<=0),a&&V.push(_[D]<=0,_[F]<=0),V.every(function(K){return K})){R=T,O=!1;break}E.set(T,V)}if(O)for(var N=m?3:1,U=function(H){var Q=C.find(function(Y){var q=E.get(Y);if(q)return q.slice(0,H).every(function(Z){return Z})});if(Q)return R=Q,"break"},G=N;G>0;G--){var ie=U(G);if(ie==="break")break}t.placement!==R&&(t.modifiersData[r]._skip=!0,t.placement=R,t.reset=!0)}}const Ta={name:"flip",enabled:!0,phase:"main",fn:Oa,requiresIfExists:["offset"],data:{_skip:!1}};function Qr(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Zr(e){return[re,he,fe,se].some(function(t){return e[t]>=0})}function _a(e){var t=e.state,n=e.name,r=t.rects.reference,s=t.rects.popper,i=t.modifiersData.preventOverflow,o=St(t,{elementContext:"reference"}),a=St(t,{altBoundary:!0}),c=Qr(o,r),l=Qr(a,s,i),u=Zr(c),d=Zr(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const $a={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_a};function La(e,t,n){var r=we(e),s=[se,re].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,o=i[0],a=i[1];return o=o||0,a=(a||0)*s,[se,he].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Da(e){var t=e.state,n=e.options,r=e.name,s=n.offset,i=s===void 0?[0,0]:s,o=Ws.reduce(function(u,d){return u[d]=La(d,t.rects,i),u},{}),a=o[t.placement],c=a.x,l=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}const Fa={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Da};function za(e){var t=e.state,n=e.name;t.modifiersData[n]=ei({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Na={name:"popperOffsets",enabled:!0,phase:"read",fn:za,data:{}};function Ba(e){return e==="x"?"y":"x"}function Va(e){var t=e.state,n=e.options,r=e.name,s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!1:o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,p=m===void 0?0:m,g=St(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),y=we(t.placement),w=it(t.placement),A=!w,C=ur(y),P=Ba(C),k=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,R=typeof p=="function"?p(Object.assign({},t.rects,{placement:t.placement})):p,j=typeof R=="number"?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(k){if(i){var $,I=C==="y"?re:se,M=C==="y"?fe:he,_=C==="y"?"height":"width",D=k[C],F=D+g[I],V=D-g[M],N=h?-O[_]/2:0,U=w===nt?E[_]:O[_],G=w===nt?-O[_]:-E[_],ie=t.elements.arrow,K=h&&ie?cr(ie):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Ks(),Q=H[I],Y=H[M],q=yt(0,E[_],K[_]),Z=A?E[_]/2-N-q-Q-j.mainAxis:U-q-Q-j.mainAxis,oe=A?-E[_]/2+N+q+Y+j.mainAxis:G+q+Y+j.mainAxis,J=t.elements.arrow&&Ft(t.elements.arrow),Pe=J?C==="y"?J.clientTop||0:J.clientLeft||0:0,ke=($=T?.[C])!=null?$:0,ct=D+Z-ke-Pe,ut=D+oe-ke,Ve=yt(h?sn(F,ct):F,D,h?Ye(V,ut):V);k[C]=Ve,L[C]=Ve-D}if(a){var He,dt=C==="x"?re:se,ft=C==="x"?fe:he,ve=k[P],Ht=P==="y"?"height":"width",$r=ve+g[dt],Lr=ve-g[ft],Sn=[re,se].indexOf(y)!==-1,Dr=(He=T?.[P])!=null?He:0,Fr=Sn?$r:ve-E[Ht]-O[Ht]-Dr+j.altAxis,zr=Sn?ve+E[Ht]+O[Ht]-Dr-j.altAxis:Lr,Nr=h&&Sn?fa(Fr,ve,zr):yt(h?Fr:$r,ve,h?zr:Lr);k[P]=Nr,L[P]=Nr-ve}t.modifiersData[r]=L}}const Ha={name:"preventOverflow",enabled:!0,phase:"main",fn:Va,requiresIfExists:["offset"]};function Ua(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Ga(e){return e===ae(e)||!ue(e)?dr(e):Ua(e)}function Xa(e){var t=e.getBoundingClientRect(),n=rt(t.width)/e.offsetWidth||1,r=rt(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Wa(e,t,n){n===void 0&&(n=!1);var r=ue(t),s=ue(t)&&Xa(t),i=Ne(t),o=st(e,s,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Ae(t)!=="body"||hr(i))&&(a=Ga(t)),ue(t)?(c=st(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=fr(i))),{x:o.left+a.scrollLeft-c.x,y:o.top+a.scrollTop-c.y,width:o.width,height:o.height}}function Ya(e){var t=new Map,n=new Set,r=[];e.forEach(function(i){t.set(i.name,i)});function s(i){n.add(i.name);var o=[].concat(i.requires||[],i.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var c=t.get(a);c&&s(c)}}),r.push(i)}return e.forEach(function(i){n.has(i.name)||s(i)}),r}function qa(e){var t=Ya(e);return oa.reduce(function(n,r){return n.concat(t.filter(function(s){return s.phase===r}))},[])}function Ka(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Qa(e){var t=e.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Jr={placement:"bottom",modifiers:[],strategy:"absolute"};function es(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Za(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,s=t.defaultOptions,i=s===void 0?Jr:s;return function(a,c,l){l===void 0&&(l=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Jr,i),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;p(),u.options=Object.assign({},i,u.options,w),u.scrollParents={reference:qe(a)?vt(a):a.contextElement?vt(a.contextElement):[],popper:vt(c)};var A=qa(Qa([].concat(r,u.options.modifiers)));return u.orderedModifiers=A.filter(function(C){return C.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,A=y.popper;if(es(w,A)){u.rects={reference:Wa(w,Ft(A),u.options.strategy==="fixed"),popper:cr(A)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(j){return u.modifiersData[j.name]=Object.assign({},j.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var P=u.orderedModifiers[C],k=P.fn,E=P.options,O=E===void 0?{}:E,R=P.name;typeof k=="function"&&(u=k({state:u,options:O,name:R,instance:h})||u)}}}},update:Ka(function(){return new Promise(function(g){h.forceUpdate(),g(u)})}),destroy:function(){p(),f=!0}};if(!es(a,c))return h;h.setOptions(l).then(function(g){!f&&l.onFirstUpdate&&l.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,A=w===void 0?{}:w,C=g.effect;if(typeof C=="function"){var P=C({state:u,name:y,instance:h,options:A}),k=function(){};d.push(P||k)}})}function p(){d.forEach(function(g){return g()}),d=[]}return h}}var Ja=[Aa,Na,ba,ca,Fa,Ta,Ha,ga,$a],el=Za({defaultModifiers:Ja});function de(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:s=!1,...i}=e,o=s?{}:Xo(n,r),{props:a,internalRef:c}=Yo({...i,externalSlotProps:o}),l=Pt(c,o?.ref,e.additionalProps?.ref);return Go(t,{...a,ref:l},r)}function tl(e){return parseInt(v.version,10)>=19?e?.props?.ref||null:e?.ref||null}function nl(e){return typeof e=="function"?e():e}const rl=v.forwardRef(function(t,n){const{children:r,container:s,disablePortal:i=!1}=t,[o,a]=v.useState(null),c=Pt(v.isValidElement(r)?tl(r):null,n);if($e(()=>{i||a(nl(s)||document.body)},[s,i]),$e(()=>{if(o&&!i)return Ur(n,o),()=>{Ur(n,null)}},[n,o,i]),i){if(v.isValidElement(r)){const l={ref:c};return v.cloneElement(r,l)}return r}return o&&Ns.createPortal(r,o)});function sl(e){return De("MuiPopper",e)}Fe("MuiPopper",["root"]);function il(e,t){if(t==="ltr")return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function Wn(e){return typeof e=="function"?e():e}function ol(e){return e.nodeType!==void 0}const al=e=>{const{classes:t}=e;return je({root:["root"]},sl,t)},ll={},cl=v.forwardRef(function(t,n){const{anchorEl:r,children:s,direction:i,disablePortal:o,modifiers:a,open:c,placement:l,popperOptions:u,popperRef:d,slotProps:f={},slots:h={},TransitionProps:m,ownerState:p,...g}=t,y=v.useRef(null),w=Pt(y,n),A=v.useRef(null),C=Pt(A,d),P=v.useRef(C);$e(()=>{P.current=C},[C]),v.useImperativeHandle(d,()=>A.current,[]);const k=il(l,i),[E,O]=v.useState(k),[R,j]=v.useState(Wn(r));v.useEffect(()=>{A.current&&A.current.forceUpdate()}),v.useEffect(()=>{r&&j(Wn(r))},[r]),$e(()=>{if(!R||!c)return;const M=F=>{O(F.placement)};let _=[{name:"preventOverflow",options:{altBoundary:o}},{name:"flip",options:{altBoundary:o}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:F})=>{M(F)}}];a!=null&&(_=_.concat(a)),u&&u.modifiers!=null&&(_=_.concat(u.modifiers));const D=el(R,y.current,{placement:k,...u,modifiers:_});return P.current(D),()=>{D.destroy(),P.current(null)}},[R,o,a,c,u,k]);const T={placement:E};m!==null&&(T.TransitionProps=m);const L=al(t),$=h.root??"div",I=de({elementType:$,externalSlotProps:f.root,externalForwardedProps:g,additionalProps:{role:"tooltip",ref:w},ownerState:t,className:L.root});return x.jsx($,{...I,children:typeof s=="function"?s(T):s})}),ul=v.forwardRef(function(t,n){const{anchorEl:r,children:s,container:i,direction:o="ltr",disablePortal:a=!1,keepMounted:c=!1,modifiers:l,open:u,placement:d="bottom",popperOptions:f=ll,popperRef:h,style:m,transition:p=!1,slotProps:g={},slots:y={},...w}=t,[A,C]=v.useState(!0),P=()=>{C(!1)},k=()=>{C(!0)};if(!c&&!u&&(!p||A))return null;let E;if(i)E=i;else if(r){const j=Wn(r);E=j&&ol(j)?Un(j).body:Un(null).body}const O=!u&&c&&(!p||A)?"none":void 0,R=p?{in:u,onEnter:P,onExited:k}:void 0;return x.jsx(rl,{disablePortal:a,container:E,children:x.jsx(cl,{anchorEl:r,direction:o,disablePortal:a,modifiers:l,ref:n,open:p?!A:u,placement:d,popperOptions:f,popperRef:h,slotProps:g,slots:y,...w,style:{position:"fixed",top:0,left:0,display:O,...m},TransitionProps:R,children:s})})}),dl=W(ul,{name:"MuiPopper",slot:"Root"})({}),fl=v.forwardRef(function(t,n){const r=or(),s=io({props:t,name:"MuiPopper"}),{anchorEl:i,component:o,components:a,componentsProps:c,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,slots:w,slotProps:A,...C}=s,P=w?.root??a?.Root,k={anchorEl:i,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,...C};return x.jsx(dl,{as:o,direction:r?"rtl":"ltr",slots:{root:P},slotProps:A??c,...k,ref:n})});function ti(e){const{children:t,defer:n=!1,fallback:r=null}=e,[s,i]=v.useState(!1);return $e(()=>{n||i(!0)},[n]),v.useEffect(()=>{n&&i(!0)},[n]),s?t:r}function hl(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function pl(e){return e}function ml(){var e=pl,t=hl,n=null,r=Ue(0),s=Ue(jn),i=Ue(0);function o(a){var c,l=(a=Co(a)).length,u,d,f=0,h=new Array(l),m=new Array(l),p=+r.apply(this,arguments),g=Math.min(jn,Math.max(-jn,s.apply(this,arguments)-p)),y,w=Math.min(Math.abs(g)/l,i.apply(this,arguments)),A=w*(g<0?-1:1),C;for(c=0;c<l;++c)(C=m[h[c]=c]=+e(a[c],c,a))>0&&(f+=C);for(t!=null?h.sort(function(P,k){return t(m[P],m[k])}):n!=null&&h.sort(function(P,k){return n(a[P],a[k])}),c=0,d=f?(g-l*A)/f:0;c<l;++c,p=y)u=h[c],C=m[u],y=p+(C>0?C*d:0)+A,m[u]={data:a[u],index:c,value:C,startAngle:p,endAngle:y,padAngle:w};return m}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:Ue(+a),o):e},o.sortValues=function(a){return arguments.length?(t=a,n=null,o):t},o.sort=function(a){return arguments.length?(n=a,t=null,o):n},o.startAngle=function(a){return arguments.length?(r=typeof a=="function"?a:Ue(+a),o):r},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:Ue(+a),o):s},o.padAngle=function(a){return arguments.length?(i=typeof a=="function"?a:Ue(+a),o):i},o}function gl(e,t){if((c=e.length)>0)for(var n,r=0,s,i,o,a,c,l=e[t[0]].length;r<l;++r)for(o=a=0,n=0;n<c;++n)(i=(s=e[t[n]][r])[1]-s[0])>0?(s[0]=o,s[1]=o+=i):i<0?(s[1]=a,s[0]=a+=i):(s[0]=0,s[1]=i)}function ni(e){var t=e.map(xl);return hn(e).sort(function(n,r){return t[n]-t[r]})}function xl(e){for(var t=-1,n=0,r=e.length,s,i=-1/0;++t<r;)(s=+e[t][1])>i&&(i=s,n=t);return n}function ri(e){var t=e.map(si);return hn(e).sort(function(n,r){return t[n]-t[r]})}function si(e){for(var t=0,n=-1,r=e.length,s;++n<r;)(s=+e[n][1])&&(t+=s);return t}function yl(e){return ri(e).reverse()}function vl(e){var t=e.length,n,r,s=e.map(si),i=ni(e),o=0,a=0,c=[],l=[];for(n=0;n<t;++n)r=i[n],o<a?(o+=s[r],c.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(c)}function bl(e){return hn(e).reverse()}function wl({filter:e,setFilter:t,closeModal:n}){const{handleSubmit:r,control:s,trigger:i}=lo({defaultValues:{...e}}),o=a=>{t(a),n()};return x.jsxs("form",{onSubmit:r(o),children:[x.jsx(In,{name:"fromDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"From Date",value:a.value?new Date(a.value):null,onChange:l=>{i("fromDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"toDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"To Date",value:a.value?new Date(a.value):null,onChange:l=>{i("toDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"currency",control:s,render:({field:a,fieldState:c})=>x.jsx(co,{...a,label:"Currency",defaultValue:En.Usd,error:c.error?.message,data:Object.keys(En).map(l=>En[l])})}),x.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[x.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),x.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:n,children:"Cancel"})]})]})}function Al({filter:e,setFilter:t}){const[n,r]=v.useState(!1),{get:s,set:i}=Vs();function o(a){a||={fromDate:Le(new Date,"yyyy-MM-DD"),toDate:Le(new Date,"yyyy-MM-DD")},uo(a,e)||t(a)}return v.useEffect(()=>{const a=oo(e??{})?null:encodeURIComponent(JSON.stringify(e)),c=s("MonthlyIncomeExpenseChartFilters");a!==c&&i("MonthlyIncomeExpenseChartFilters",a)},[e,s,i]),x.jsxs(x.Fragment,{children:[x.jsx(bo,{opened:n,onClose:()=>r(!1),content:x.jsx(wl,{filter:e,setFilter:o,closeModal:()=>r(!1)})}),x.jsx(ao,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(!0),children:x.jsx(wo,{className:"size-5"})})]})}const pr="DEFAULT_X_AXIS_KEY",mr="DEFAULT_Y_AXIS_KEY",Cl={top:50,bottom:50,left:50,right:50},ii=v.createContext({isInitialized:!1,data:{highlightedItem:null,setHighlighted:()=>{},clearHighlighted:()=>{},isHighlighted:()=>!1,isFaded:()=>!1}}),Pl=(e,t)=>n=>e?e.fade==="series"?n.seriesId===t?.seriesId&&n.dataIndex!==t?.dataIndex:e.fade==="global"?n.seriesId!==t?.seriesId||n.dataIndex!==t?.dataIndex:!1:!1,kl=(e,t)=>n=>e?e.highlight==="series"?n.seriesId===t?.seriesId:e.highlight==="item"?n.dataIndex===t?.dataIndex&&n.seriesId===t?.seriesId:!1:!1,Sl=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];function Il(e,t,n=Sl){return e.type==="pie"?b({},e,{data:e.data.map((r,s)=>b({color:n[s%n.length]},r))}):b({color:n[t%n.length]},e)}const El=({series:e,colors:t,seriesFormatters:n,dataset:r})=>{const s={};e.forEach((o,a)=>{const{id:c=`auto-generated-id-${a}`,type:l}=o;if(s[l]===void 0&&(s[l]={series:{},seriesOrder:[]}),s[l]?.series[c]!==void 0)throw new Error(`MUI X: series' id "${c}" is not unique.`);s[l].series[c]=b({id:c},Il(o,a,t)),s[l].seriesOrder.push(c)});const i={};return Object.keys(n).forEach(o=>{const a=s[o];a!==void 0&&(i[o]=n[o]?.(a,r)??s[o])}),i},Ml=["#02B2AF","#2E96FF","#B800D8","#60009B","#2731C8","#03008D"],jl=["#02B2AF","#72CCFF","#DA00FF","#9001CB","#2E96FF","#3B48E0"],Rl=e=>e==="dark"?jl:Ml,oi=v.createContext({isInitialized:!1,data:{}}),zt=v.createContext({isInitialized:!1,data:{colorProcessors:{},seriesFormatters:{},xExtremumGetters:{},yExtremumGetters:{},rotationExtremumGetters:{},radiusExtremumGetters:{}}}),ts=(e,t)=>t==="x"?{x:e,y:null}:{x:null,y:e},ai=e=>{const{axis:t,getFilters:n,isDefaultAxis:r}=e,s=n?.({currentAxisId:t.id,isDefaultAxis:r}),i=s?t.data?.filter((c,l)=>s({x:null,y:null},l)):t.data,o=Math.min(...i??[]),a=Math.max(...i??[]);return[o,a]},li=e=>t=>{const{series:n,axis:r,getFilters:s,isDefaultAxis:i}=t;return Object.keys(n).filter(o=>{const a=n[o].yAxisId??n[o].yAxisKey;return a===r.id||i&&a===void 0}).reduce((o,a)=>{const{stackedData:c}=n[a],l=s?.({currentAxisId:r.id,isDefaultAxis:i,seriesXAxisId:n[a].xAxisId??n[a].xAxisKey,seriesYAxisId:n[a].yAxisId??n[a].yAxisKey}),[u,d]=c?.reduce((f,h,m)=>l&&(!l(ts(h[0],e),m)||!l(ts(h[1],e),m))?f:[Math.min(...h,f[0]),Math.max(...h,f[1])],[1/0,-1/0])??[1/0,-1/0];return[Math.min(u,o[0]),Math.max(d,o[1])]},[1/0,-1/0])},Ol=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?li("x")(e):ai(e),Tl=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?ai(e):li("y")(e),Rn={appearance:ni,ascending:ri,descending:yl,insideOut:vl,none:hn,reverse:bl},On={expand:Io,diverging:gl,none:Po,silhouette:So,wiggle:ko},ci=e=>{const{series:t,seriesOrder:n,defaultStrategy:r}=e,s=[],i={};return n.forEach(o=>{const{stack:a,stackOrder:c,stackOffset:l}=t[o];a===void 0?s.push({ids:[o],stackingOrder:Rn.none,stackingOffset:On.none}):i[a]===void 0?(i[a]=s.length,s.push({ids:[o],stackingOrder:Rn[c??r?.stackOrder??"none"],stackingOffset:On[l??r?.stackOffset??"diverging"]})):(s[i[a]].ids.push(o),c!==void 0&&(s[i[a]].stackingOrder=Rn[c]),l!==void 0&&(s[i[a]].stackingOffset=On[l]))}),s};function ui(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=b({},e[r],{valueFormatter:e[r].valueFormatter??t})}),n}const _l=(e,t)=>{const{seriesOrder:n,series:r}=e,s=ci(e),i=t??[];n.forEach(a=>{const c=r[a].data;if(c!==void 0)c.forEach((l,u)=>{i.length<=u?i.push({[a]:l}):i[u][a]=l});else if(t===void 0)throw new Error([`MUI X: bar series with id='${a}' has no data.`,"Either provide a data property to the series or use the dataset prop."].join(`
1
+ import{dd as so,de as Ds,df as Fs,dg as zs,r as v,aG as Ie,dh as $e,di as Ns,j as x,dj as or,dk as io,bB as oo,B as ao,E as lo,bE as In,bF as Br,bN as Vr,w as Le,bH as co,ay as En,bI as uo,dl as b,dm as Bs,a6 as fo,dn as ho,F as po,u as mo,dp as go,L as xo,dq as yo}from"./index-rI994S3C.js";import{u as Vs}from"./use-url-query-CqWra6gD.js";import{P as vo}from"./page-layout-DMGj5xhW.js";import{P as bo}from"./modal-BXR_xgUm.js";import{F as wo}from"./funnel-Cfb9Pxmr.js";import{u as Pt,g as De,a as Fe,c as je,s as W,_ as X,b as Ao,T as Mn}from"./Typography-B8Kph7eR.js";import{c as Ue,t as jn,a as Co,d as hn,b as Po,e as ko,f as So,g as Io,h as Hs,o as Hr,i as Eo,s as Mo,l as jo,u as Ro,j as Us,k as Oo,p as To,m as _o,n as $o,q as Lo,r as Do,v as Fo,w as zo}from"./sequential-CjOfRLtc.js";import{s as Gs}from"./sub-CEXBz_OW.js";import"./addDays-DTiBTTns.js";import"./subMonths-DY4HlBVa.js";function No(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:so(t.components[n].defaultProps,r)}function Bo({props:e,name:t,defaultTheme:n,themeId:r}){let s=Ds(n);return s=s[r]||s,No({theme:s,name:t,props:e})}function Lt(){const e=Ds(Fs);return e[zs]||e}function ze({props:e,name:t}){return Bo({props:e,name:t,defaultTheme:Fs,themeId:zs})}function Un(e){return e&&e.ownerDocument||document}function Vo(e){return Un(e).defaultView||window}function Ur(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ho(e){const{controlled:t,default:n}=e,{current:r}=v.useRef(t!==void 0),[s,i]=v.useState(n),o=r?t:s,a=v.useCallback(c=>{r||i(c)},[]);return[o,a]}function Uo(e){return typeof e=="string"}function Go(e,t,n){return e===void 0||Uo(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Xo(e,t,n){return typeof e=="function"?e(t,n):e}function Wo(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function Gr(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function Yo(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:s,className:i}=e;if(!t){const h=Ie(n?.className,i,s?.className,r?.className),m={...n?.style,...s?.style,...r?.style},p={...n,...s,...r};return h.length>0&&(p.className=h),Object.keys(m).length>0&&(p.style=m),{props:p,internalRef:void 0}}const o=Wo({...s,...r}),a=Gr(r),c=Gr(s),l=t(o),u=Ie(l?.className,n?.className,i,s?.className,r?.className),d={...l?.style,...n?.style,...s?.style,...r?.style},f={...l,...n,...c,...a};return u.length>0&&(f.className=u),Object.keys(d).length>0&&(f.style=d),{props:f,internalRef:l.ref}}var re="top",fe="bottom",he="right",se="left",ar="auto",Dt=[re,fe,he,se],nt="start",kt="end",qo="clippingParents",Xs="viewport",ht="popper",Ko="reference",Xr=Dt.reduce(function(e,t){return e.concat([t+"-"+nt,t+"-"+kt])},[]),Ws=[].concat(Dt,[ar]).reduce(function(e,t){return e.concat([t,t+"-"+nt,t+"-"+kt])},[]),Qo="beforeRead",Zo="read",Jo="afterRead",ea="beforeMain",ta="main",na="afterMain",ra="beforeWrite",sa="write",ia="afterWrite",oa=[Qo,Zo,Jo,ea,ta,na,ra,sa,ia];function Ae(e){return e?(e.nodeName||"").toLowerCase():null}function ae(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function qe(e){var t=ae(e).Element;return e instanceof t||e instanceof Element}function ue(e){var t=ae(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function lr(e){if(typeof ShadowRoot>"u")return!1;var t=ae(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function aa(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},s=t.attributes[n]||{},i=t.elements[n];!ue(i)||!Ae(i)||(Object.assign(i.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?i.removeAttribute(o):i.setAttribute(o,a===!0?"":a)}))})}function la(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var s=t.elements[r],i=t.attributes[r]||{},o=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=o.reduce(function(c,l){return c[l]="",c},{});!ue(s)||!Ae(s)||(Object.assign(s.style,a),Object.keys(i).forEach(function(c){s.removeAttribute(c)}))})}}const ca={name:"applyStyles",enabled:!0,phase:"write",fn:aa,effect:la,requires:["computeStyles"]};function we(e){return e.split("-")[0]}var Ye=Math.max,sn=Math.min,rt=Math.round;function Gn(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ys(){return!/^((?!chrome|android).)*safari/i.test(Gn())}function st(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),s=1,i=1;t&&ue(e)&&(s=e.offsetWidth>0&&rt(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&rt(r.height)/e.offsetHeight||1);var o=qe(e)?ae(e):window,a=o.visualViewport,c=!Ys()&&n,l=(r.left+(c&&a?a.offsetLeft:0))/s,u=(r.top+(c&&a?a.offsetTop:0))/i,d=r.width/s,f=r.height/i;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l,x:l,y:u}}function cr(e){var t=st(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function qs(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&lr(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Me(e){return ae(e).getComputedStyle(e)}function ua(e){return["table","td","th"].indexOf(Ae(e))>=0}function Ne(e){return((qe(e)?e.ownerDocument:e.document)||window.document).documentElement}function pn(e){return Ae(e)==="html"?e:e.assignedSlot||e.parentNode||(lr(e)?e.host:null)||Ne(e)}function Wr(e){return!ue(e)||Me(e).position==="fixed"?null:e.offsetParent}function da(e){var t=/firefox/i.test(Gn()),n=/Trident/i.test(Gn());if(n&&ue(e)){var r=Me(e);if(r.position==="fixed")return null}var s=pn(e);for(lr(s)&&(s=s.host);ue(s)&&["html","body"].indexOf(Ae(s))<0;){var i=Me(s);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return s;s=s.parentNode}return null}function Ft(e){for(var t=ae(e),n=Wr(e);n&&ua(n)&&Me(n).position==="static";)n=Wr(n);return n&&(Ae(n)==="html"||Ae(n)==="body"&&Me(n).position==="static")?t:n||da(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function yt(e,t,n){return Ye(e,sn(t,n))}function fa(e,t,n){var r=yt(e,t,n);return r>n?n:r}function Ks(){return{top:0,right:0,bottom:0,left:0}}function Qs(e){return Object.assign({},Ks(),e)}function Zs(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var ha=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Qs(typeof t!="number"?t:Zs(t,Dt))};function pa(e){var t,n=e.state,r=e.name,s=e.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,a=we(n.placement),c=ur(a),l=[se,he].indexOf(a)>=0,u=l?"height":"width";if(!(!i||!o)){var d=ha(s.padding,n),f=cr(i),h=c==="y"?re:se,m=c==="y"?fe:he,p=n.rects.reference[u]+n.rects.reference[c]-o[c]-n.rects.popper[u],g=o[c]-n.rects.reference[c],y=Ft(i),w=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,A=p/2-g/2,C=d[h],P=w-f[u]-d[m],k=w/2-f[u]/2+A,E=yt(C,k,P),O=c;n.modifiersData[r]=(t={},t[O]=E,t.centerOffset=E-k,t)}}function ma(e){var t=e.state,n=e.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||qs(t.elements.popper,s)&&(t.elements.arrow=s))}const ga={name:"arrow",enabled:!0,phase:"main",fn:pa,effect:ma,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function it(e){return e.split("-")[1]}var xa={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ya(e,t){var n=e.x,r=e.y,s=t.devicePixelRatio||1;return{x:rt(n*s)/s||0,y:rt(r*s)/s||0}}function Yr(e){var t,n=e.popper,r=e.popperRect,s=e.placement,i=e.variation,o=e.offsets,a=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,h=f===void 0?0:f,m=o.y,p=m===void 0?0:m,g=typeof u=="function"?u({x:h,y:p}):{x:h,y:p};h=g.x,p=g.y;var y=o.hasOwnProperty("x"),w=o.hasOwnProperty("y"),A=se,C=re,P=window;if(l){var k=Ft(n),E="clientHeight",O="clientWidth";if(k===ae(n)&&(k=Ne(n),Me(k).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),k=k,s===re||(s===se||s===he)&&i===kt){C=fe;var R=d&&k===P&&P.visualViewport?P.visualViewport.height:k[E];p-=R-r.height,p*=c?1:-1}if(s===se||(s===re||s===fe)&&i===kt){A=he;var j=d&&k===P&&P.visualViewport?P.visualViewport.width:k[O];h-=j-r.width,h*=c?1:-1}}var T=Object.assign({position:a},l&&xa),L=u===!0?ya({x:h,y:p},ae(n)):{x:h,y:p};if(h=L.x,p=L.y,c){var $;return Object.assign({},T,($={},$[C]=w?"0":"",$[A]=y?"0":"",$.transform=(P.devicePixelRatio||1)<=1?"translate("+h+"px, "+p+"px)":"translate3d("+h+"px, "+p+"px, 0)",$))}return Object.assign({},T,(t={},t[C]=w?p+"px":"",t[A]=y?h+"px":"",t.transform="",t))}function va(e){var t=e.state,n=e.options,r=n.gpuAcceleration,s=r===void 0?!0:r,i=n.adaptive,o=i===void 0?!0:i,a=n.roundOffsets,c=a===void 0?!0:a,l={placement:we(t.placement),variation:it(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Yr(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Yr(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const ba={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:va,data:{}};var Ut={passive:!0};function wa(e){var t=e.state,n=e.instance,r=e.options,s=r.scroll,i=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,c=ae(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&l.forEach(function(u){u.addEventListener("scroll",n.update,Ut)}),a&&c.addEventListener("resize",n.update,Ut),function(){i&&l.forEach(function(u){u.removeEventListener("scroll",n.update,Ut)}),a&&c.removeEventListener("resize",n.update,Ut)}}const Aa={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wa,data:{}};var Ca={left:"right",right:"left",bottom:"top",top:"bottom"};function en(e){return e.replace(/left|right|bottom|top/g,function(t){return Ca[t]})}var Pa={start:"end",end:"start"};function qr(e){return e.replace(/start|end/g,function(t){return Pa[t]})}function dr(e){var t=ae(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fr(e){return st(Ne(e)).left+dr(e).scrollLeft}function ka(e,t){var n=ae(e),r=Ne(e),s=n.visualViewport,i=r.clientWidth,o=r.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;var l=Ys();(l||!l&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a+fr(e),y:c}}function Sa(e){var t,n=Ne(e),r=dr(e),s=(t=e.ownerDocument)==null?void 0:t.body,i=Ye(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ye(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+fr(e),c=-r.scrollTop;return Me(s||n).direction==="rtl"&&(a+=Ye(n.clientWidth,s?s.clientWidth:0)-i),{width:i,height:o,x:a,y:c}}function hr(e){var t=Me(e),n=t.overflow,r=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function Js(e){return["html","body","#document"].indexOf(Ae(e))>=0?e.ownerDocument.body:ue(e)&&hr(e)?e:Js(pn(e))}function vt(e,t){var n;t===void 0&&(t=[]);var r=Js(e),s=r===((n=e.ownerDocument)==null?void 0:n.body),i=ae(r),o=s?[i].concat(i.visualViewport||[],hr(r)?r:[]):r,a=t.concat(o);return s?a:a.concat(vt(pn(o)))}function Xn(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ia(e,t){var n=st(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Kr(e,t,n){return t===Xs?Xn(ka(e,n)):qe(t)?Ia(t,n):Xn(Sa(Ne(e)))}function Ea(e){var t=vt(pn(e)),n=["absolute","fixed"].indexOf(Me(e).position)>=0,r=n&&ue(e)?Ft(e):e;return qe(r)?t.filter(function(s){return qe(s)&&qs(s,r)&&Ae(s)!=="body"}):[]}function Ma(e,t,n,r){var s=t==="clippingParents"?Ea(e):[].concat(t),i=[].concat(s,[n]),o=i[0],a=i.reduce(function(c,l){var u=Kr(e,l,r);return c.top=Ye(u.top,c.top),c.right=sn(u.right,c.right),c.bottom=sn(u.bottom,c.bottom),c.left=Ye(u.left,c.left),c},Kr(e,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ei(e){var t=e.reference,n=e.element,r=e.placement,s=r?we(r):null,i=r?it(r):null,o=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,c;switch(s){case re:c={x:o,y:t.y-n.height};break;case fe:c={x:o,y:t.y+t.height};break;case he:c={x:t.x+t.width,y:a};break;case se:c={x:t.x-n.width,y:a};break;default:c={x:t.x,y:t.y}}var l=s?ur(s):null;if(l!=null){var u=l==="y"?"height":"width";switch(i){case nt:c[l]=c[l]-(t[u]/2-n[u]/2);break;case kt:c[l]=c[l]+(t[u]/2-n[u]/2);break}}return c}function St(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=r===void 0?e.placement:r,i=n.strategy,o=i===void 0?e.strategy:i,a=n.boundary,c=a===void 0?qo:a,l=n.rootBoundary,u=l===void 0?Xs:l,d=n.elementContext,f=d===void 0?ht:d,h=n.altBoundary,m=h===void 0?!1:h,p=n.padding,g=p===void 0?0:p,y=Qs(typeof g!="number"?g:Zs(g,Dt)),w=f===ht?Ko:ht,A=e.rects.popper,C=e.elements[m?w:f],P=Ma(qe(C)?C:C.contextElement||Ne(e.elements.popper),c,u,o),k=st(e.elements.reference),E=ei({reference:k,element:A,placement:s}),O=Xn(Object.assign({},A,E)),R=f===ht?O:k,j={top:P.top-R.top+y.top,bottom:R.bottom-P.bottom+y.bottom,left:P.left-R.left+y.left,right:R.right-P.right+y.right},T=e.modifiersData.offset;if(f===ht&&T){var L=T[s];Object.keys(j).forEach(function($){var I=[he,fe].indexOf($)>=0?1:-1,M=[re,fe].indexOf($)>=0?"y":"x";j[$]+=L[M]*I})}return j}function ja(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=n.boundary,i=n.rootBoundary,o=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?Ws:c,u=it(r),d=u?a?Xr:Xr.filter(function(m){return it(m)===u}):Dt,f=d.filter(function(m){return l.indexOf(m)>=0});f.length===0&&(f=d);var h=f.reduce(function(m,p){return m[p]=St(e,{placement:p,boundary:s,rootBoundary:i,padding:o})[we(p)],m},{});return Object.keys(h).sort(function(m,p){return h[m]-h[p]})}function Ra(e){if(we(e)===ar)return[];var t=en(e);return[qr(e),t,qr(t)]}function Oa(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!0:o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,p=n.allowedAutoPlacements,g=t.options.placement,y=we(g),w=y===g,A=c||(w||!m?[en(g)]:Ra(g)),C=[g].concat(A).reduce(function(K,H){return K.concat(we(H)===ar?ja(t,{placement:H,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:p}):H)},[]),P=t.rects.reference,k=t.rects.popper,E=new Map,O=!0,R=C[0],j=0;j<C.length;j++){var T=C[j],L=we(T),$=it(T)===nt,I=[re,fe].indexOf(L)>=0,M=I?"width":"height",_=St(t,{placement:T,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),D=I?$?he:se:$?fe:re;P[M]>k[M]&&(D=en(D));var F=en(D),V=[];if(i&&V.push(_[L]<=0),a&&V.push(_[D]<=0,_[F]<=0),V.every(function(K){return K})){R=T,O=!1;break}E.set(T,V)}if(O)for(var N=m?3:1,U=function(H){var Q=C.find(function(Y){var q=E.get(Y);if(q)return q.slice(0,H).every(function(Z){return Z})});if(Q)return R=Q,"break"},G=N;G>0;G--){var ie=U(G);if(ie==="break")break}t.placement!==R&&(t.modifiersData[r]._skip=!0,t.placement=R,t.reset=!0)}}const Ta={name:"flip",enabled:!0,phase:"main",fn:Oa,requiresIfExists:["offset"],data:{_skip:!1}};function Qr(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Zr(e){return[re,he,fe,se].some(function(t){return e[t]>=0})}function _a(e){var t=e.state,n=e.name,r=t.rects.reference,s=t.rects.popper,i=t.modifiersData.preventOverflow,o=St(t,{elementContext:"reference"}),a=St(t,{altBoundary:!0}),c=Qr(o,r),l=Qr(a,s,i),u=Zr(c),d=Zr(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const $a={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:_a};function La(e,t,n){var r=we(e),s=[se,re].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,o=i[0],a=i[1];return o=o||0,a=(a||0)*s,[se,he].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Da(e){var t=e.state,n=e.options,r=e.name,s=n.offset,i=s===void 0?[0,0]:s,o=Ws.reduce(function(u,d){return u[d]=La(d,t.rects,i),u},{}),a=o[t.placement],c=a.x,l=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}const Fa={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Da};function za(e){var t=e.state,n=e.name;t.modifiersData[n]=ei({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Na={name:"popperOffsets",enabled:!0,phase:"read",fn:za,data:{}};function Ba(e){return e==="x"?"y":"x"}function Va(e){var t=e.state,n=e.options,r=e.name,s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,a=o===void 0?!1:o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,p=m===void 0?0:m,g=St(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),y=we(t.placement),w=it(t.placement),A=!w,C=ur(y),P=Ba(C),k=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,R=typeof p=="function"?p(Object.assign({},t.rects,{placement:t.placement})):p,j=typeof R=="number"?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(k){if(i){var $,I=C==="y"?re:se,M=C==="y"?fe:he,_=C==="y"?"height":"width",D=k[C],F=D+g[I],V=D-g[M],N=h?-O[_]/2:0,U=w===nt?E[_]:O[_],G=w===nt?-O[_]:-E[_],ie=t.elements.arrow,K=h&&ie?cr(ie):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Ks(),Q=H[I],Y=H[M],q=yt(0,E[_],K[_]),Z=A?E[_]/2-N-q-Q-j.mainAxis:U-q-Q-j.mainAxis,oe=A?-E[_]/2+N+q+Y+j.mainAxis:G+q+Y+j.mainAxis,J=t.elements.arrow&&Ft(t.elements.arrow),Pe=J?C==="y"?J.clientTop||0:J.clientLeft||0:0,ke=($=T?.[C])!=null?$:0,ct=D+Z-ke-Pe,ut=D+oe-ke,Ve=yt(h?sn(F,ct):F,D,h?Ye(V,ut):V);k[C]=Ve,L[C]=Ve-D}if(a){var He,dt=C==="x"?re:se,ft=C==="x"?fe:he,ve=k[P],Ht=P==="y"?"height":"width",$r=ve+g[dt],Lr=ve-g[ft],Sn=[re,se].indexOf(y)!==-1,Dr=(He=T?.[P])!=null?He:0,Fr=Sn?$r:ve-E[Ht]-O[Ht]-Dr+j.altAxis,zr=Sn?ve+E[Ht]+O[Ht]-Dr-j.altAxis:Lr,Nr=h&&Sn?fa(Fr,ve,zr):yt(h?Fr:$r,ve,h?zr:Lr);k[P]=Nr,L[P]=Nr-ve}t.modifiersData[r]=L}}const Ha={name:"preventOverflow",enabled:!0,phase:"main",fn:Va,requiresIfExists:["offset"]};function Ua(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Ga(e){return e===ae(e)||!ue(e)?dr(e):Ua(e)}function Xa(e){var t=e.getBoundingClientRect(),n=rt(t.width)/e.offsetWidth||1,r=rt(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Wa(e,t,n){n===void 0&&(n=!1);var r=ue(t),s=ue(t)&&Xa(t),i=Ne(t),o=st(e,s,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Ae(t)!=="body"||hr(i))&&(a=Ga(t)),ue(t)?(c=st(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=fr(i))),{x:o.left+a.scrollLeft-c.x,y:o.top+a.scrollTop-c.y,width:o.width,height:o.height}}function Ya(e){var t=new Map,n=new Set,r=[];e.forEach(function(i){t.set(i.name,i)});function s(i){n.add(i.name);var o=[].concat(i.requires||[],i.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var c=t.get(a);c&&s(c)}}),r.push(i)}return e.forEach(function(i){n.has(i.name)||s(i)}),r}function qa(e){var t=Ya(e);return oa.reduce(function(n,r){return n.concat(t.filter(function(s){return s.phase===r}))},[])}function Ka(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Qa(e){var t=e.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Jr={placement:"bottom",modifiers:[],strategy:"absolute"};function es(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Za(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,s=t.defaultOptions,i=s===void 0?Jr:s;return function(a,c,l){l===void 0&&(l=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Jr,i),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},d=[],f=!1,h={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;p(),u.options=Object.assign({},i,u.options,w),u.scrollParents={reference:qe(a)?vt(a):a.contextElement?vt(a.contextElement):[],popper:vt(c)};var A=qa(Qa([].concat(r,u.options.modifiers)));return u.orderedModifiers=A.filter(function(C){return C.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,A=y.popper;if(es(w,A)){u.rects={reference:Wa(w,Ft(A),u.options.strategy==="fixed"),popper:cr(A)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(j){return u.modifiersData[j.name]=Object.assign({},j.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var P=u.orderedModifiers[C],k=P.fn,E=P.options,O=E===void 0?{}:E,R=P.name;typeof k=="function"&&(u=k({state:u,options:O,name:R,instance:h})||u)}}}},update:Ka(function(){return new Promise(function(g){h.forceUpdate(),g(u)})}),destroy:function(){p(),f=!0}};if(!es(a,c))return h;h.setOptions(l).then(function(g){!f&&l.onFirstUpdate&&l.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,A=w===void 0?{}:w,C=g.effect;if(typeof C=="function"){var P=C({state:u,name:y,instance:h,options:A}),k=function(){};d.push(P||k)}})}function p(){d.forEach(function(g){return g()}),d=[]}return h}}var Ja=[Aa,Na,ba,ca,Fa,Ta,Ha,ga,$a],el=Za({defaultModifiers:Ja});function de(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:s=!1,...i}=e,o=s?{}:Xo(n,r),{props:a,internalRef:c}=Yo({...i,externalSlotProps:o}),l=Pt(c,o?.ref,e.additionalProps?.ref);return Go(t,{...a,ref:l},r)}function tl(e){return parseInt(v.version,10)>=19?e?.props?.ref||null:e?.ref||null}function nl(e){return typeof e=="function"?e():e}const rl=v.forwardRef(function(t,n){const{children:r,container:s,disablePortal:i=!1}=t,[o,a]=v.useState(null),c=Pt(v.isValidElement(r)?tl(r):null,n);if($e(()=>{i||a(nl(s)||document.body)},[s,i]),$e(()=>{if(o&&!i)return Ur(n,o),()=>{Ur(n,null)}},[n,o,i]),i){if(v.isValidElement(r)){const l={ref:c};return v.cloneElement(r,l)}return r}return o&&Ns.createPortal(r,o)});function sl(e){return De("MuiPopper",e)}Fe("MuiPopper",["root"]);function il(e,t){if(t==="ltr")return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function Wn(e){return typeof e=="function"?e():e}function ol(e){return e.nodeType!==void 0}const al=e=>{const{classes:t}=e;return je({root:["root"]},sl,t)},ll={},cl=v.forwardRef(function(t,n){const{anchorEl:r,children:s,direction:i,disablePortal:o,modifiers:a,open:c,placement:l,popperOptions:u,popperRef:d,slotProps:f={},slots:h={},TransitionProps:m,ownerState:p,...g}=t,y=v.useRef(null),w=Pt(y,n),A=v.useRef(null),C=Pt(A,d),P=v.useRef(C);$e(()=>{P.current=C},[C]),v.useImperativeHandle(d,()=>A.current,[]);const k=il(l,i),[E,O]=v.useState(k),[R,j]=v.useState(Wn(r));v.useEffect(()=>{A.current&&A.current.forceUpdate()}),v.useEffect(()=>{r&&j(Wn(r))},[r]),$e(()=>{if(!R||!c)return;const M=F=>{O(F.placement)};let _=[{name:"preventOverflow",options:{altBoundary:o}},{name:"flip",options:{altBoundary:o}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:F})=>{M(F)}}];a!=null&&(_=_.concat(a)),u&&u.modifiers!=null&&(_=_.concat(u.modifiers));const D=el(R,y.current,{placement:k,...u,modifiers:_});return P.current(D),()=>{D.destroy(),P.current(null)}},[R,o,a,c,u,k]);const T={placement:E};m!==null&&(T.TransitionProps=m);const L=al(t),$=h.root??"div",I=de({elementType:$,externalSlotProps:f.root,externalForwardedProps:g,additionalProps:{role:"tooltip",ref:w},ownerState:t,className:L.root});return x.jsx($,{...I,children:typeof s=="function"?s(T):s})}),ul=v.forwardRef(function(t,n){const{anchorEl:r,children:s,container:i,direction:o="ltr",disablePortal:a=!1,keepMounted:c=!1,modifiers:l,open:u,placement:d="bottom",popperOptions:f=ll,popperRef:h,style:m,transition:p=!1,slotProps:g={},slots:y={},...w}=t,[A,C]=v.useState(!0),P=()=>{C(!1)},k=()=>{C(!0)};if(!c&&!u&&(!p||A))return null;let E;if(i)E=i;else if(r){const j=Wn(r);E=j&&ol(j)?Un(j).body:Un(null).body}const O=!u&&c&&(!p||A)?"none":void 0,R=p?{in:u,onEnter:P,onExited:k}:void 0;return x.jsx(rl,{disablePortal:a,container:E,children:x.jsx(cl,{anchorEl:r,direction:o,disablePortal:a,modifiers:l,ref:n,open:p?!A:u,placement:d,popperOptions:f,popperRef:h,slotProps:g,slots:y,...w,style:{position:"fixed",top:0,left:0,display:O,...m},TransitionProps:R,children:s})})}),dl=W(ul,{name:"MuiPopper",slot:"Root"})({}),fl=v.forwardRef(function(t,n){const r=or(),s=io({props:t,name:"MuiPopper"}),{anchorEl:i,component:o,components:a,componentsProps:c,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,slots:w,slotProps:A,...C}=s,P=w?.root??a?.Root,k={anchorEl:i,container:l,disablePortal:u,keepMounted:d,modifiers:f,open:h,placement:m,popperOptions:p,popperRef:g,transition:y,...C};return x.jsx(dl,{as:o,direction:r?"rtl":"ltr",slots:{root:P},slotProps:A??c,...k,ref:n})});function ti(e){const{children:t,defer:n=!1,fallback:r=null}=e,[s,i]=v.useState(!1);return $e(()=>{n||i(!0)},[n]),v.useEffect(()=>{n&&i(!0)},[n]),s?t:r}function hl(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function pl(e){return e}function ml(){var e=pl,t=hl,n=null,r=Ue(0),s=Ue(jn),i=Ue(0);function o(a){var c,l=(a=Co(a)).length,u,d,f=0,h=new Array(l),m=new Array(l),p=+r.apply(this,arguments),g=Math.min(jn,Math.max(-jn,s.apply(this,arguments)-p)),y,w=Math.min(Math.abs(g)/l,i.apply(this,arguments)),A=w*(g<0?-1:1),C;for(c=0;c<l;++c)(C=m[h[c]=c]=+e(a[c],c,a))>0&&(f+=C);for(t!=null?h.sort(function(P,k){return t(m[P],m[k])}):n!=null&&h.sort(function(P,k){return n(a[P],a[k])}),c=0,d=f?(g-l*A)/f:0;c<l;++c,p=y)u=h[c],C=m[u],y=p+(C>0?C*d:0)+A,m[u]={data:a[u],index:c,value:C,startAngle:p,endAngle:y,padAngle:w};return m}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:Ue(+a),o):e},o.sortValues=function(a){return arguments.length?(t=a,n=null,o):t},o.sort=function(a){return arguments.length?(n=a,t=null,o):n},o.startAngle=function(a){return arguments.length?(r=typeof a=="function"?a:Ue(+a),o):r},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:Ue(+a),o):s},o.padAngle=function(a){return arguments.length?(i=typeof a=="function"?a:Ue(+a),o):i},o}function gl(e,t){if((c=e.length)>0)for(var n,r=0,s,i,o,a,c,l=e[t[0]].length;r<l;++r)for(o=a=0,n=0;n<c;++n)(i=(s=e[t[n]][r])[1]-s[0])>0?(s[0]=o,s[1]=o+=i):i<0?(s[1]=a,s[0]=a+=i):(s[0]=0,s[1]=i)}function ni(e){var t=e.map(xl);return hn(e).sort(function(n,r){return t[n]-t[r]})}function xl(e){for(var t=-1,n=0,r=e.length,s,i=-1/0;++t<r;)(s=+e[t][1])>i&&(i=s,n=t);return n}function ri(e){var t=e.map(si);return hn(e).sort(function(n,r){return t[n]-t[r]})}function si(e){for(var t=0,n=-1,r=e.length,s;++n<r;)(s=+e[n][1])&&(t+=s);return t}function yl(e){return ri(e).reverse()}function vl(e){var t=e.length,n,r,s=e.map(si),i=ni(e),o=0,a=0,c=[],l=[];for(n=0;n<t;++n)r=i[n],o<a?(o+=s[r],c.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(c)}function bl(e){return hn(e).reverse()}function wl({filter:e,setFilter:t,closeModal:n}){const{handleSubmit:r,control:s,trigger:i}=lo({defaultValues:{...e}}),o=a=>{t(a),n()};return x.jsxs("form",{onSubmit:r(o),children:[x.jsx(In,{name:"fromDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"From Date",value:a.value?new Date(a.value):null,onChange:l=>{i("fromDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"toDate",control:s,rules:{pattern:{value:Br,message:"Date must be im format yyyy-mm-dd"}},render:({field:a,fieldState:c})=>x.jsx(Vr,{...a,label:"To Date",value:a.value?new Date(a.value):null,onChange:l=>{i("toDate"),a.onChange(l?Le(l,"yyyy-MM-dd"):void 0)},error:c.error?.message,popoverProps:{withinPortal:!0}})}),x.jsx(In,{name:"currency",control:s,render:({field:a,fieldState:c})=>x.jsx(co,{...a,label:"Currency",defaultValue:En.Usd,error:c.error?.message,data:Object.keys(En).map(l=>En[l])})}),x.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[x.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),x.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:n,children:"Cancel"})]})]})}function Al({filter:e,setFilter:t}){const[n,r]=v.useState(!1),{get:s,set:i}=Vs();function o(a){a||={fromDate:Le(new Date,"yyyy-MM-DD"),toDate:Le(new Date,"yyyy-MM-DD")},uo(a,e)||t(a)}return v.useEffect(()=>{const a=oo(e??{})?null:encodeURIComponent(JSON.stringify(e)),c=s("MonthlyIncomeExpenseChartFilters");a!==c&&i("MonthlyIncomeExpenseChartFilters",a)},[e,s,i]),x.jsxs(x.Fragment,{children:[x.jsx(bo,{opened:n,onClose:()=>r(!1),content:x.jsx(wl,{filter:e,setFilter:o,closeModal:()=>r(!1)})}),x.jsx(ao,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>r(!0),children:x.jsx(wo,{className:"size-5"})})]})}const pr="DEFAULT_X_AXIS_KEY",mr="DEFAULT_Y_AXIS_KEY",Cl={top:50,bottom:50,left:50,right:50},ii=v.createContext({isInitialized:!1,data:{highlightedItem:null,setHighlighted:()=>{},clearHighlighted:()=>{},isHighlighted:()=>!1,isFaded:()=>!1}}),Pl=(e,t)=>n=>e?e.fade==="series"?n.seriesId===t?.seriesId&&n.dataIndex!==t?.dataIndex:e.fade==="global"?n.seriesId!==t?.seriesId||n.dataIndex!==t?.dataIndex:!1:!1,kl=(e,t)=>n=>e?e.highlight==="series"?n.seriesId===t?.seriesId:e.highlight==="item"?n.dataIndex===t?.dataIndex&&n.seriesId===t?.seriesId:!1:!1,Sl=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];function Il(e,t,n=Sl){return e.type==="pie"?b({},e,{data:e.data.map((r,s)=>b({color:n[s%n.length]},r))}):b({color:n[t%n.length]},e)}const El=({series:e,colors:t,seriesFormatters:n,dataset:r})=>{const s={};e.forEach((o,a)=>{const{id:c=`auto-generated-id-${a}`,type:l}=o;if(s[l]===void 0&&(s[l]={series:{},seriesOrder:[]}),s[l]?.series[c]!==void 0)throw new Error(`MUI X: series' id "${c}" is not unique.`);s[l].series[c]=b({id:c},Il(o,a,t)),s[l].seriesOrder.push(c)});const i={};return Object.keys(n).forEach(o=>{const a=s[o];a!==void 0&&(i[o]=n[o]?.(a,r)??s[o])}),i},Ml=["#02B2AF","#2E96FF","#B800D8","#60009B","#2731C8","#03008D"],jl=["#02B2AF","#72CCFF","#DA00FF","#9001CB","#2E96FF","#3B48E0"],Rl=e=>e==="dark"?jl:Ml,oi=v.createContext({isInitialized:!1,data:{}}),zt=v.createContext({isInitialized:!1,data:{colorProcessors:{},seriesFormatters:{},xExtremumGetters:{},yExtremumGetters:{},rotationExtremumGetters:{},radiusExtremumGetters:{}}}),ts=(e,t)=>t==="x"?{x:e,y:null}:{x:null,y:e},ai=e=>{const{axis:t,getFilters:n,isDefaultAxis:r}=e,s=n?.({currentAxisId:t.id,isDefaultAxis:r}),i=s?t.data?.filter((c,l)=>s({x:null,y:null},l)):t.data,o=Math.min(...i??[]),a=Math.max(...i??[]);return[o,a]},li=e=>t=>{const{series:n,axis:r,getFilters:s,isDefaultAxis:i}=t;return Object.keys(n).filter(o=>{const a=n[o].yAxisId??n[o].yAxisKey;return a===r.id||i&&a===void 0}).reduce((o,a)=>{const{stackedData:c}=n[a],l=s?.({currentAxisId:r.id,isDefaultAxis:i,seriesXAxisId:n[a].xAxisId??n[a].xAxisKey,seriesYAxisId:n[a].yAxisId??n[a].yAxisKey}),[u,d]=c?.reduce((f,h,m)=>l&&(!l(ts(h[0],e),m)||!l(ts(h[1],e),m))?f:[Math.min(...h,f[0]),Math.max(...h,f[1])],[1/0,-1/0])??[1/0,-1/0];return[Math.min(u,o[0]),Math.max(d,o[1])]},[1/0,-1/0])},Ol=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?li("x")(e):ai(e),Tl=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?ai(e):li("y")(e),Rn={appearance:ni,ascending:ri,descending:yl,insideOut:vl,none:hn,reverse:bl},On={expand:Io,diverging:gl,none:Po,silhouette:So,wiggle:ko},ci=e=>{const{series:t,seriesOrder:n,defaultStrategy:r}=e,s=[],i={};return n.forEach(o=>{const{stack:a,stackOrder:c,stackOffset:l}=t[o];a===void 0?s.push({ids:[o],stackingOrder:Rn.none,stackingOffset:On.none}):i[a]===void 0?(i[a]=s.length,s.push({ids:[o],stackingOrder:Rn[c??r?.stackOrder??"none"],stackingOffset:On[l??r?.stackOffset??"diverging"]})):(s[i[a]].ids.push(o),c!==void 0&&(s[i[a]].stackingOrder=Rn[c]),l!==void 0&&(s[i[a]].stackingOffset=On[l]))}),s};function ui(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=b({},e[r],{valueFormatter:e[r].valueFormatter??t})}),n}const _l=(e,t)=>{const{seriesOrder:n,series:r}=e,s=ci(e),i=t??[];n.forEach(a=>{const c=r[a].data;if(c!==void 0)c.forEach((l,u)=>{i.length<=u?i.push({[a]:l}):i[u][a]=l});else if(t===void 0)throw new Error([`MUI X: bar series with id='${a}' has no data.`,"Either provide a data property to the series or use the dataset prop."].join(`
2
2
  `))});const o={};return s.forEach(a=>{const{ids:c,stackingOffset:l,stackingOrder:u}=a,d=Hs().keys(c.map(f=>{const h=r[f].dataKey;return r[f].data===void 0&&h!==void 0?h:f})).value((f,h)=>f[h]??0).order(u).offset(l)(i);c.forEach((f,h)=>{const m=r[f].dataKey;o[f]=b({layout:"vertical"},r[f],{data:m?t.map(p=>{const g=p[m];return typeof g!="number"?0:g}):r[f].data,stackedData:d[h].map(([p,g])=>[p,g])})})}),{seriesOrder:n,stackingGroups:s,series:ui(o,a=>a==null?"":a.toLocaleString())}},di=(e,t,n)=>{const r=e.layout==="vertical",s=r?t?.colorScale:n?.colorScale,i=r?n?.colorScale:t?.colorScale,o=r?t?.data:n?.data;return i?a=>{const c=e.data[a],l=c===null?e.color:i(c);return l===null?e.color:l}:s&&o?a=>{const c=o[a],l=c===null?e.color:s(c);return l===null?e.color:l}:()=>e.color},$l={seriesType:"bar",seriesFormatter:_l,colorProcessor:di,xExtremumGetter:Ol,yExtremumGetter:Tl},on=(e,t)=>[t[0]===null?e[0]:Math.min(e[0],t[0]),t[1]===null?e[1]:Math.max(e[1],t[1])],Ll=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:s}=e;return Object.keys(t).filter(i=>{const o=t[i].xAxisId??t[i].xAxisKey;return o===n.id||o===void 0&&r}).reduce((i,o)=>{const a=s?.({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[o].xAxisId??t[o].xAxisKey,seriesYAxisId:t[o].yAxisId??t[o].yAxisKey}),c=t[o].data?.reduce((l,u,d)=>a&&!a(u,d)?l:on(l,[u.x,u.x]),[1/0,-1/0]);return on(i,c??[1/0,-1/0])},[1/0,-1/0])},Dl=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:s}=e;return Object.keys(t).filter(i=>{const o=t[i].yAxisId??t[i].yAxisKey;return o===n.id||o===void 0&&r}).reduce((i,o)=>{const a=s?.({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[o].xAxisId??t[o].xAxisKey,seriesYAxisId:t[o].yAxisId??t[o].yAxisKey}),c=t[o].data?.reduce((l,u,d)=>a&&!a(u,d)?l:on(l,[u.y,u.y]),[1/0,-1/0]);return on(i,c??[1/0,-1/0])},[1/0,-1/0])},Fl=({series:e,seriesOrder:t},n)=>({series:Object.fromEntries(Object.entries(e).map(([s,i])=>{const o=i?.datasetKeys,a=["x","y","id"].filter(l=>typeof o?.[l]!="string");if(i?.datasetKeys&&a.length>0)throw new Error([`MUI X: scatter series with id='${s}' has incomplete datasetKeys.`,`Properties ${a.map(l=>`"${l}"`).join(", ")} are missing.`].join(`
3
3
  `));const c=o?n?.map(l=>({x:l[o.x]??null,y:l[o.y]??null,z:o.z&&l[o.z],id:l[o.id]}))??[]:i.data??[];return[s,b({},i,{data:c,valueFormatter:i.valueFormatter??(l=>`(${l.x}, ${l.y})`)})]})),seriesOrder:t}),zl=(e,t,n,r)=>{const s=r?.colorScale,i=n?.colorScale,o=t?.colorScale;return s?a=>{if(r?.data?.[a]!==void 0){const u=s(r?.data?.[a]);if(u!==null)return u}const c=e.data[a],l=c===null?e.color:s(c.z);return l===null?e.color:l}:i?a=>{const c=e.data[a],l=c===null?e.color:i(c.y);return l===null?e.color:l}:o?a=>{const c=e.data[a],l=c===null?e.color:o(c.x);return l===null?e.color:l}:()=>e.color},Nl={seriesType:"scatter",seriesFormatter:Fl,colorProcessor:zl,xExtremumGetter:Ll,yExtremumGetter:Dl},Bl=e=>{const{axis:t}=e,n=Math.min(...t.data??[]),r=Math.max(...t.data??[]);return[n,r]};function Vl(e,t,n){return t.reduce((r,s,i)=>{const[o,a]=e(s);return n&&(!n({y:o,x:null},i)||!n({y:a,x:null},i))?r:[Math.min(o,a,r[0]),Math.max(o,a,r[1])]},[1/0,-1/0])}const Hl=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:s}=e;return Object.keys(t).filter(i=>{const o=t[i].yAxisId??t[i].yAxisKey;return o===n.id||r&&o===void 0}).reduce((i,o)=>{const{area:a,stackedData:c}=t[o],l=a!==void 0,u=s?.({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[o].xAxisId??t[o].xAxisKey,seriesYAxisId:t[o].yAxisId??t[o].yAxisKey}),d=l&&n.scaleType!=="log"&&typeof t[o].baseline!="string"?p=>p:p=>[p[1],p[1]],f=Vl(d,c,u),[h,m]=f;return[Math.min(h,i[0]),Math.max(m,i[1])]},[1/0,-1/0])},Ul=(e,t)=>{const{seriesOrder:n,series:r}=e,s=ci(b({},e,{defaultStrategy:{stackOffset:"none"}})),i=t??[];n.forEach(a=>{const c=r[a].data;c!==void 0&&c.forEach((l,u)=>{i.length<=u?i.push({[a]:l}):i[u][a]=l})});const o={};return s.forEach(a=>{const{ids:c,stackingOrder:l,stackingOffset:u}=a,d=Hs().keys(c.map(f=>{const h=r[f].dataKey;return r[f].data===void 0&&h!==void 0?h:f})).value((f,h)=>f[h]??0).order(l).offset(u)(i);c.forEach((f,h)=>{const m=r[f].dataKey;o[f]=b({},r[f],{data:m?t.map(p=>{const g=p[m];return typeof g!="number"?null:g}):r[f].data,stackedData:d[h].map(([p,g])=>[p,g])})})}),{seriesOrder:n,stackingGroups:s,series:ui(o,a=>a==null?"":a.toLocaleString())}},Gl=(e,t,n)=>{const r=n?.colorScale,s=t?.colorScale;return r?i=>{const o=e.data[i],a=o===null?e.color:r(o);return a===null?e.color:a}:s?i=>{const o=t.data?.[i],a=o===null?e.color:s(o);return a===null?e.color:a}:()=>e.color},Xl={seriesType:"line",colorProcessor:Gl,seriesFormatter:Ul,xExtremumGetter:Bl,yExtremumGetter:Hl};function Ee(e,t){return typeof e=="function"?e(t):e}const Wl=(e="none")=>{if(typeof e=="function")return e;switch(e){case"none":return null;case"desc":return(t,n)=>n-t;case"asc":return(t,n)=>t-n;default:return null}},Yl=e=>{const{seriesOrder:t,series:n}=e,r={};return t.forEach(s=>{const i=ml().startAngle(2*Math.PI*(n[s].startAngle??0)/360).endAngle(2*Math.PI*(n[s].endAngle??360)/360).padAngle(2*Math.PI*(n[s].paddingAngle??0)/360).sortValues(Wl(n[s].sortingValues??"none"))(n[s].data.map(o=>o.value));r[s]=b({valueFormatter:o=>o.value.toLocaleString()},n[s],{data:n[s].data.map((o,a)=>b({},o,{id:o.id??`auto-generated-pie-id-${s}-${a}`},i[a])).map((o,a)=>b({},o,{formattedValue:n[s].valueFormatter?.(b({},o,{label:Ee(o.label,"arc")}),{dataIndex:a})??o.value.toLocaleString()}))})}),{seriesOrder:t,series:r}},ql=e=>t=>e.data[t].color,Kl={seriesType:"pie",colorProcessor:ql,seriesFormatter:Yl},Ql=[$l,Nl,Xl,Kl];function Zl(e){const t=e??Ql,n={},r={},s={},i={},o={},a={};for(let c=0;c<t.length;c+=1){const l=t[c],u=l.seriesType;n[u]=l.seriesFormatter,r[u]=l.colorProcessor,l.xExtremumGetter&&(s[u]=l.xExtremumGetter),l.yExtremumGetter&&(i[u]=l.yExtremumGetter),l.rotationExtremumGetter&&(o[u]=l.rotationExtremumGetter),l.radiusExtremumGetter&&(a[u]=l.radiusExtremumGetter)}return{seriesFormatters:n,colorProcessors:r,xExtremumGetters:s,yExtremumGetters:i,rotationExtremumGetters:o,radiusExtremumGetters:a}}function Jl(e){const{children:t,plugins:n}=e,r=v.useMemo(()=>({isInitialized:!0,data:Zl(n)}),[n]);return x.jsx(zt.Provider,{value:r,children:t})}function fi(e){const{isInitialized:t,data:n}=v.useContext(zt);if(!t)throw new Error(["MUI X: Could not find the plugin context.","It looks like you rendered your component outside of a ChartsContainer parent component."].join(`
4
4
  `));return n.colorProcessors}function ec(e){const{isInitialized:t,data:n}=v.useContext(zt);if(!t)throw new Error(["MUI X: Could not find the plugin context.","It looks like you rendered your component outside of a ChartsContainer parent component."].join(`
@@ -1 +1 @@
1
- import{v as _,r as o,j as e,J as I,B as w,a6 as r,e9 as je,aP as T,ay as V,ea as fe,eb as u,ah as q,R as G,d7 as L,ec as Q,bY as J,ed as Y,c5 as Z,c6 as K,bp as W,bO as X,bP as ee,bQ as S,bR as te,c2 as E,b$ as se,dI as ae,bS as ne,bT as D,dw as re,ee as be,ef as N,eg as Ne,eh as we,ei as ye,u as oe,t as ve,ej as Se,T as Ce,ek as Ae,el as Te,aC as le,bB as Ve,E as De,em as Ie,bE as H,bH as $,en as B,bN as Re,w as P,bI as Me,F as Ee,L as Fe,eo as ze}from"./index-D1_HHRLX.js";import{d as ce}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{u as ie}from"./use-url-query-RoURh24O.js";import{C as O,a as de,b as me,M as ke}from"./charges-table-Bjk5Mz--.js";import{P as Le}from"./page-layout-BOjYoqoi.js";import{P as R,a as M}from"./panel-top-open-Bxnxp1BU.js";import{C as ue}from"./index-BrgWieYs.js";import{T as xe}from"./toggle-expansion-button-Dg_XsE6y.js";import{U as Be}from"./update-accountant-status-CU6mIJqS.js";import{c as Pe}from"./charges-filters-BLSfy08K.js";import{P as Oe}from"./modal-CNW2FGYc.js";import{F as Ue}from"./funnel-0IvwyZBf.js";import"./Table-pGQWLQ8H.js";import"./summary-C5TvRXn1.js";import"./accordion-Bd6kAhfN.js";import"./deposits-transactions-table-CV-YceTW.js";import"./Checkbox-D5PsdcQv.js";import"./data-table-column-header--gzXkv5r.js";import"./eye-off-DWYC0Eax.js";import"./similar-transactions-modal-BTidmv0G.js";import"./building-2-Df516nsd.js";import"./addDays-DhQZBfTq.js";import"./sub-6-HnNA3H.js";import"./subMonths-nC9-M0qS.js";import"./MultiSelect-C5wjF9jC.js";const He=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],pe=_("chart-column",He);const $e=[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]],_e=_("file-digit",$e),qe=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const a=r(je,t),[c,l]=o.useState(!0);return e.jsxs(I,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(p=>!p),disabled:!a||a.businessTrips.length===0,children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Business Trips"]})}),c&&a&&e.jsx(O,{data:a.businessTrips,isAllOpened:!1,toggleMergeCharge:s,mergeSelectedCharges:n})]})};function U(t){switch(t){case"C":case"M":return"Self Invoice";case"H":return"Single Doc By Law";case"I":return"Palestinian Customer";case"K":return"Petty Cash";case"L1":return"Unidentified Customer";case"L2":return"Unidentified Zero or Exempt";case"P":return"Palestinian Supplier";case"R":return"Import";case"S1":case"T":return"Regular";case"S2":return"Zero or Exempt";case"Y":return"Export";default:return"Unknown"}}const Ge=t=>{const s=t.reduce((n,a)=>(n[a.recordType]||={recordType:a.recordType,count:0,vatTotal:0,totalBeforeVat:0},n[a.recordType].count++,n[a.recordType].vatTotal+=a.roundedLocalVatAfterDeduction?.raw??0,n[a.recordType].totalBeforeVat+=a.taxReducedLocalAmount?.raw??0,n),{});return Object.values(s)},he=({records:t})=>{const s=o.useMemo(()=>Ge(t??[]),[t]);return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground",children:"Record Type"}),e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground text-right",children:"Count"}),e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground text-right",children:"Total Before VAT"}),e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground text-right",children:"VAT Total"})]})}),e.jsx("tbody",{children:s.map(n=>e.jsxs("tr",{className:"border-b border-border/50",children:[e.jsxs("td",{className:"py-3 text-sm font-medium",children:[U(n.recordType)," (",n.recordType,")"]}),e.jsx("td",{className:"py-3 text-sm text-right",children:n.count}),e.jsx("td",{className:"py-3 text-sm text-right",children:T(n.totalBeforeVat,V.Ils)}),e.jsx("td",{className:"py-3 text-sm text-right",children:T(n.vatTotal,V.Ils)})]},n.recordType))})]})})};function ge({data:t}){const{chargeId:s,chargeAccountantStatus:n}=r(fe,t);return e.jsx("td",{children:e.jsx(Be,{value:n??void 0,chargeId:s})})}const b=Q(),z=[b.accessor(t=>r(u,t.data).recordType,{id:"recordType",header:"Record Type",cell:t=>{const s=t.getValue();return e.jsx("p",{className:"whitespace-wrap",children:`${U(s)} (${s})`})}}),b.accessor(t=>r(u,t.data).business?.name??"",{id:"business",header:"Business",cell:t=>{const s=r(u,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-1",children:[s.business?.id?e.jsx(q,{to:G.BUSINESSES.DETAIL(s.business.id),target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"inline-flex items-center font-semibold",children:s.business.name}):e.jsx("span",{children:s.business?.name}),s.vatNumber&&e.jsx("span",{className:"text-[10px] text-gray-500",children:s.vatNumber})]})}}),b.display({id:"invoice",header:"Invoice",cell:t=>{const s=r(u,t.row.original.data);return s.image?e.jsx("a",{href:s.image,target:"_blank",rel:"noreferrer",children:e.jsx("img",{alt:"missing img",src:s.image,height:80,width:80})}):null}}),b.accessor(t=>r(u,t.data).documentSerial??"",{id:"documentSerial",header:"Invoice Serial#",cell:t=>{const s=r(u,t.row.original.data);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.getValue()}),s.allocationNumber&&e.jsxs("span",{className:"text-xs",children:["(",s.allocationNumber,")"]})]})}}),b.accessor(t=>r(u,t.data).documentDate??"",{id:"documentDate",header:"Invoice Date",cell:t=>t.getValue()}),b.accessor(t=>r(u,t.data).chargeDate??"",{id:"chargeDate",header:"Transaction Date",cell:t=>t.getValue()}),b.accessor(t=>r(u,t.data).amount.raw??0,{id:"amount",header:"Amount",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.amount.formatted})}}),b.accessor(t=>r(u,t.data).localAmount?.raw??0,{id:"localAmount",header:"Amount ₪",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.localAmount?.formatted})}}),b.accessor(t=>r(u,t.data).localVat?.raw??0,{id:"localVat",header:"VAT",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.localVat?.formatted})}}),b.accessor(t=>r(u,t.data).localVatAfterDeduction?.raw??0,{id:"localVatAfterDeduction",header:"VAT ₪",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.localVatAfterDeduction?.formatted})}}),b.accessor(t=>r(u,t.data).foreignVatAfterDeduction?.raw??0,{id:"foreignVatAfterDeduction",header:"Actual VAT",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.foreignVatAfterDeduction?.formatted})}}),b.accessor(t=>r(u,t.data).roundedLocalVatAfterDeduction?.raw??0,{id:"roundedLocalVatAfterDeduction",header:"Rounded VAT",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.roundedLocalVatAfterDeduction?.formatted})}}),b.accessor(t=>t.cumulativeVat,{id:"cumulativeVat",header:"Cumulative VAT",cell:t=>e.jsxs("span",{className:"whitespace-nowrap",children:["₪ ",L(t.getValue(),0)]})}),b.accessor(t=>r(u,t.data).taxReducedLocalAmount?.raw??0,{id:"taxReducedLocalAmount",header:"Amount without VAT ₪",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.taxReducedLocalAmount?.formatted})}}),b.accessor(t=>t.cumulativeAmount,{id:"cumulativeAmount",header:"Cumulative Amount without VAT ₪",cell:t=>e.jsxs("span",{className:"whitespace-nowrap",children:["₪ ",L(t.getValue(),0)]})}),b.display({id:"accountantApproval",header:"Accountant Approval",cell:t=>{const s=r(u,t.row.original.data);return e.jsx(ge,{data:s})}}),b.display({id:"actions",header:"Edit",cell:t=>{const s=r(u,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(xe,{toggleExpansion:()=>t.row.toggleExpanded(),isExpanded:t.row.getIsExpanded()}),e.jsx(de,{toggleMergeSelected:()=>t.row.original.toggleMergeCharge(s.chargeId),mergeSelected:t.row.original.mergeSelectedCharges.has(s.chargeId)}),e.jsx(ue,{chargeId:s.chargeId})]})}})],Qe=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const{expenses:a}=r(be,t)??{expenses:[]},[c,l]=o.useState(!0),[p,x]=o.useState([]),[j,i]=o.useState({}),[f,h]=o.useState({}),[g,C]=o.useState("detailed"),F=o.useMemo(()=>{let d=0,m=0;return a.map(y=>(d+=y.taxReducedLocalAmount?.raw??0,m+=y.roundedLocalVatAfterDeduction?.raw??0,{data:y,toggleMergeCharge:s,mergeSelectedCharges:n,cumulativeVat:m,cumulativeAmount:d}))},[a,s,n]),A=J({data:F,columns:z,getCoreRowModel:K(),onSortingChange:x,getSortedRowModel:Z(),onColumnVisibilityChange:i,onExpandedChange:h,getExpandedRowModel:Y(),state:{sorting:p,columnVisibility:j,expanded:f}});return e.jsxs(I,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(d=>!d),children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Expenses"]}),c&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:g==="detailed"?"default":"outline",size:"sm",onClick:()=>C("detailed"),children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Detailed"]}),e.jsxs(w,{variant:g==="summarized"?"default":"outline",size:"sm",onClick:()=>C("summarized"),children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),"Summarized"]})]})]}),c&&(g==="detailed"?e.jsxs(X,{children:[e.jsx(ee,{children:A.getHeaderGroups().map(d=>e.jsx(S,{children:d.headers.map(m=>e.jsx(te,{colSpan:m.colSpan,children:m.isPlaceholder?null:e.jsxs(w,{variant:"ghost",onClick:m.column.getToggleSortingHandler(),className:"h-auto p-0 hover:bg-transparent",children:[E(m.column.columnDef.header,m.getContext()),{asc:e.jsx(ae,{className:"size-5"}),desc:e.jsx(se,{className:"size-5"})}[m.column.getIsSorted()]??null]})},m.id))},d.id))}),e.jsx(ne,{children:A.getRowModel().rows?.length?A.getRowModel().rows.map(d=>{const m=r(u,d.original.data);return e.jsxs(o.Fragment,{children:[e.jsx(S,{"data-state":d.getIsSelected()&&"selected",children:d.getVisibleCells().map(y=>e.jsx(D,{children:E(y.column.columnDef.cell,y.getContext())},y.id))}),d.getIsExpanded()&&e.jsx(S,{children:e.jsx(D,{colSpan:z.length,children:e.jsx(re,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:e.jsx(me,{chargeID:m.chargeId,fetching:!!m})})})})]},d.id)}):e.jsx(S,{children:e.jsx(D,{colSpan:z.length,className:"h-24 text-center",children:"No results."})})})]}):e.jsx(he,{records:a}))]})},v=Q(),k=[v.accessor(t=>r(N,t.data).recordType,{id:"recordType",header:"Record Type",cell:t=>{const s=t.getValue();return e.jsx("p",{className:"whitespace-wrap",children:`${U(s)} (${s})`})}}),v.accessor(t=>r(N,t.data).business?.name??"",{id:"business",header:"Business",cell:t=>{const s=r(N,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-1",children:[s.business?.id?e.jsx(q,{to:G.BUSINESSES.DETAIL(s.business.id),target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"inline-flex items-center font-semibold",children:s.business.name}):e.jsx("span",{children:s.business?.name}),s.vatNumber&&e.jsx("span",{className:"text-[10px] text-gray-500",children:s.vatNumber})]})}}),v.display({id:"invoice",header:"Invoice",cell:t=>{const s=r(N,t.row.original.data);return s.image?e.jsx("a",{href:s.image,target:"_blank",rel:"noreferrer",children:e.jsx("img",{alt:"missing img",src:s.image,height:80,width:80})}):null}}),v.accessor(t=>r(N,t.data).documentSerial??"",{id:"documentSerial",header:"Invoice Serial#",cell:t=>{const s=r(N,t.row.original.data);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.getValue()}),s.allocationNumber&&e.jsxs("span",{className:"text-xs",children:["(",s.allocationNumber,")"]})]})}}),v.accessor(t=>r(N,t.data).documentDate??"",{id:"documentDate",header:"Invoice Date",cell:t=>t.getValue()}),v.accessor(t=>r(N,t.data).chargeDate??"",{id:"chargeDate",header:"Transaction Date",cell:t=>t.getValue()}),v.accessor(t=>r(N,t.data).taxReducedForeignAmount?.raw??0,{id:"amount",header:"Amount",cell:t=>r(N,t.row.original.data).taxReducedForeignAmount?.formatted??""}),v.accessor(t=>r(N,t.data).taxReducedLocalAmount?.raw??0,{id:"localAmount",header:"Amount ₪",cell:t=>r(N,t.row.original.data).taxReducedLocalAmount?.formatted??""}),v.accessor(t=>t.cumulativeAmount,{id:"cumulativeAmount",header:"Cumulative Amount ₪",cell:t=>e.jsxs("span",{className:"whitespace-nowrap",children:["₪ ",L(t.getValue(),0)]})}),v.display({id:"accountantApproval",header:"Accountant Approval",cell:t=>{const s=r(N,t.row.original.data);return e.jsx(ge,{data:s})}}),v.display({id:"actions",header:"Edit",cell:t=>{const s=r(N,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(xe,{toggleExpansion:()=>t.row.toggleExpanded(),isExpanded:t.row.getIsExpanded()}),e.jsx(de,{toggleMergeSelected:()=>t.row.original.toggleMergeCharge(s.chargeId),mergeSelected:t.row.original.mergeSelectedCharges.has(s.chargeId)}),e.jsx(ue,{chargeId:s.chargeId})]})}})],Je=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const{income:a}=r(Ne,t)??{income:[]},[c,l]=o.useState(!0),[p,x]=o.useState([]),[j,i]=o.useState({}),[f,h]=o.useState({}),[g,C]=o.useState("detailed"),F=o.useMemo(()=>{let d=0;return a.map(m=>(d+=m.taxReducedLocalAmount?.raw??0,{data:m,toggleMergeCharge:s,mergeSelectedCharges:n,cumulativeAmount:d}))},[a,s,n]),A=J({data:F,columns:k,getCoreRowModel:K(),onSortingChange:x,getSortedRowModel:Z(),onColumnVisibilityChange:i,onExpandedChange:h,getExpandedRowModel:Y(),state:{sorting:p,columnVisibility:j,expanded:f}});return e.jsxs(I,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(d=>!d),children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Income"]}),c&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:g==="detailed"?"default":"outline",size:"sm",onClick:()=>C("detailed"),children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Detailed"]}),e.jsxs(w,{variant:g==="summarized"?"default":"outline",size:"sm",onClick:()=>C("summarized"),children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),"Summarized"]})]})]}),c&&(g==="detailed"?e.jsxs(X,{children:[e.jsx(ee,{children:A.getHeaderGroups().map(d=>e.jsx(S,{children:d.headers.map(m=>e.jsx(te,{colSpan:m.colSpan,children:m.isPlaceholder?null:e.jsxs(w,{variant:"ghost",onClick:m.column.getToggleSortingHandler(),className:"h-auto p-0 hover:bg-transparent",children:[E(m.column.columnDef.header,m.getContext()),{asc:e.jsx(ae,{className:"size-5"}),desc:e.jsx(se,{className:"size-5"})}[m.column.getIsSorted()]??null]})},m.id))},d.id))}),e.jsx(ne,{children:A.getRowModel().rows?.length?A.getRowModel().rows.map(d=>{const m=r(N,d.original.data);return e.jsxs(o.Fragment,{children:[e.jsx(S,{"data-state":d.getIsSelected()&&"selected",children:d.getVisibleCells().map(y=>e.jsx(D,{children:E(y.column.columnDef.cell,y.getContext())},y.id))}),d.getIsExpanded()&&e.jsx(S,{children:e.jsx(D,{colSpan:k.length,children:e.jsx(re,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:e.jsx(me,{chargeID:m.chargeId,fetching:!!m})})})})]},d.id)}):e.jsx(S,{children:e.jsx(D,{colSpan:k.length,className:"h-24 text-center",children:"No results."})})})]}):e.jsx(he,{records:a}))]})},Ye=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const a=r(we,t),[c,l]=o.useState(!0);return e.jsxs(I,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(p=>!p),disabled:!a||a.differentMonthDoc.length===0,children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Misc Charges (which are not on the above tables)"]})}),c&&a&&e.jsx(O,{data:a.differentMonthDoc,isAllOpened:!1,toggleMergeCharge:s,mergeSelectedCharges:n})]})},Ze=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const a=r(ye,t),[c,l]=o.useState(!0);return e.jsxs(I,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(p=>!p),disabled:!a||a.missingInfo.length===0,children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Missing Info"]})}),c&&a&&e.jsx(O,{data:a.missingInfo,isAllOpened:!1,toggleMergeCharge:s,mergeSelectedCharges:n})]})},Ke=({filter:{monthDate:t,financialEntityId:s},isLoading:n})=>{const[{data:a,fetching:c,error:l},p]=oe({query:ce(Ae),pause:!0,variables:{monthDate:t,financialEntityId:s}});return o.useEffect(()=>{if(l){const x="Error generating PCN874 file";console.error(`${x}: ${l}`),ve.error("Error",{description:x,duration:5e3,closeButton:!0})}},[l]),o.useEffect(()=>{if(a){const x=new File([a.pcnFile.reportContent],"pcn874.txt",{type:"text/plain"});Se(x)}},[a]),e.jsx(Ce,{content:"Generate and Download PCN874 File",children:e.jsx(w,{disabled:c||n,variant:"outline",size:"icon",className:"size-7.5",onClick:p,children:e.jsx(_e,{className:"size-5"})})})},We=({data:t})=>{const s=r(Te,t),n=o.useMemo(()=>s?.expenses??[],[s?.expenses]),a=o.useMemo(()=>s?.income??[],[s?.income]),c=o.useMemo(()=>a.reduce((i,f)=>i+(f.taxReducedLocalAmount?.raw??0),0),[a]),l=o.useMemo(()=>a.reduce((i,f)=>i+(f.roundedLocalVatAfterDeduction?.raw??0),0),[a]),p=o.useMemo(()=>a.filter(i=>(i.roundedLocalVatAfterDeduction?.raw??0)===0).reduce((i,f)=>i+(f.taxReducedLocalAmount?.raw??0),0),[a]),x=o.useMemo(()=>n.filter(i=>i.isProperty).reduce((i,f)=>i+(f.taxReducedLocalAmount?.raw??0),0),[n]),j=o.useMemo(()=>l-n.reduce((i,f)=>i+(f.roundedLocalVatAfterDeduction?.raw??0),0),[l,n]);return e.jsxs(I,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Report Summary"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Taxable Sales Total"}),e.jsx("p",{className:"text-2xl font-bold",children:T(c,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Taxable Sales VAT"}),e.jsx("p",{className:"text-2xl font-bold",children:T(l,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Zero / Exempt Sales"}),e.jsx("p",{className:"text-2xl font-bold",children:T(p,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Equipment Inputs"}),e.jsx("p",{className:"text-2xl font-bold",children:T(x,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total VAT Amount"}),e.jsx("p",{className:"text-2xl font-bold",children:T(j,V.Ils)})]})]})]})};function Xe({filter:t,setFilter:s,closeModal:n}){const{control:a,handleSubmit:c,setValue:l}=De({defaultValues:{...t}}),{selectableAdminBusinesses:p,fetching:x}=Ie(),j=h=>{s(h),n()};function i(){s(),n()}function f(h){const g=new Date(h.getFullYear(),h.getMonth(),15);l("monthDate",P(g,"yyyy-MM-dd"))}return e.jsxs(e.Fragment,{children:[x?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsxs("form",{onSubmit:c(j),children:[e.jsx(H,{name:"financialEntityId",control:a,defaultValue:void 0,render:({field:h,fieldState:g})=>e.jsx($,{...h,data:p,value:h.value,disabled:x,label:"Report Issuer (Admin Business)",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:g.error?.message})}),e.jsx(H,{name:"chargesType",control:a,defaultValue:t.chargesType,render:({field:h,fieldState:g})=>e.jsx($,{...h,data:Pe,value:h.value??B.All,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:g.error?.message})}),e.jsx(Re,{defaultValue:t?.monthDate?new Date(t.monthDate):new Date,defaultDate:t?.monthDate?new Date(t.monthDate):new Date,onChange:f,popoverProps:{withinPortal:!0}}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:i,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:n,children:"Cancel"})]})]})]})}function et({filter:t,setFilter:s}){const[n,a]=o.useState(!1),{get:c,set:l}=ie(),{userContext:p}=o.useContext(le);function x(j){j||={financialEntityId:p?.context.adminBusinessId??t.financialEntityId,monthDate:P(new Date,"yyyy-MM-15")},Me(j,t)||s(j)}return o.useEffect(()=>{const j=Ve(t??{})?null:encodeURIComponent(JSON.stringify(t)),i=c("vatMonthlyReportFilters");j!==i&&l("vatMonthlyReportFilters",j)},[t,c,l]),e.jsxs(e.Fragment,{children:[e.jsx(Oe,{opened:n,onClose:()=>a(!1),content:e.jsx(Xe,{filter:t,setFilter:x,closeModal:()=>a(!1)})}),e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>a(!0),children:e.jsx(Ue,{className:"size-5"})})]})}const At=()=>{const{get:t}=ie(),{setFiltersContext:s}=o.useContext(Ee),{userContext:n}=o.useContext(le),[a,c]=o.useState(t("vatMonthlyReportFilters")?JSON.parse(decodeURIComponent(t("vatMonthlyReportFilters"))):{financialEntityId:n?.context.adminBusinessId??"",monthDate:P(new Date,"yyyy-MM-15")}),[l,p]=o.useState([]);o.useEffect(()=>{(!a.financialEntityId||a.financialEntityId==="")&&n?.context.adminBusinessId&&c({...a,financialEntityId:n.context.adminBusinessId})},[a,n?.context.adminBusinessId]);const[{data:x,fetching:j}]=oe({query:ce(ze),variables:{filters:a},pause:a.financialEntityId===""}),i=o.useCallback(g=>{l.includes(g)?p(l.filter(C=>C!==g)):p([...l,g])},[l]);function f(){p([])}o.useEffect(()=>{s(e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx(Ke,{filter:a,isLoading:j}),e.jsx(et,{filter:{...a},setFilter:c}),e.jsx(ke,{selected:l.map(g=>({id:g,onChange:()=>{}})),resetMerge:f})]}))},[x,a,j,s,l]);const h=o.useMemo(()=>new Set(l),[l]);return e.jsx(Le,{title:"VAT Monthly Report",children:j?e.jsx(Fe,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"min-h-screen",children:e.jsxs("div",{className:"space-y-4",children:[a.financialEntityId&&a.monthDate&&e.jsx(We,{data:x?.vatReport}),a.chargesType!==B.Expense&&e.jsx(Je,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),a.chargesType!==B.Income&&e.jsx(Qe,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),e.jsx(Ze,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),e.jsx(qe,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),e.jsx(Ye,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h})]})})})};export{At as VatMonthlyReport};
1
+ import{v as _,r as o,j as e,J as I,B as w,a6 as r,e9 as je,aP as T,ay as V,ea as fe,eb as u,ah as q,R as G,d7 as L,ec as Q,bY as J,ed as Y,c5 as Z,c6 as K,bp as W,bO as X,bP as ee,bQ as S,bR as te,c2 as E,b$ as se,dI as ae,bS as ne,bT as D,dw as re,ee as be,ef as N,eg as Ne,eh as we,ei as ye,u as oe,t as ve,ej as Se,T as Ce,ek as Ae,el as Te,aC as le,bB as Ve,E as De,em as Ie,bE as H,bH as $,en as B,bN as Re,w as P,bI as Me,F as Ee,L as Fe,eo as ze}from"./index-rI994S3C.js";import{d as ce}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{u as ie}from"./use-url-query-CqWra6gD.js";import{C as O,a as de,b as me,M as ke}from"./charges-table-BJtpvXfL.js";import{P as Le}from"./page-layout-DMGj5xhW.js";import{P as R,a as M}from"./panel-top-open-Bf39HBrp.js";import{C as ue}from"./index-C7p19nIa.js";import{T as xe}from"./toggle-expansion-button-Y2eS7nqg.js";import{U as Be}from"./update-accountant-status-zL6vnwU9.js";import{c as Pe}from"./charges-filters-CFCAP-bP.js";import{P as Oe}from"./modal-BXR_xgUm.js";import{F as Ue}from"./funnel-Cfb9Pxmr.js";import"./Table-BQv3frL8.js";import"./summary-CPKS_69D.js";import"./accordion-Bn08_4fN.js";import"./deposits-transactions-table-2rtRFZgK.js";import"./Checkbox-Dmuz3t7B.js";import"./data-table-column-header-CZ1dXiU0.js";import"./eye-off-Buv7eciz.js";import"./similar-transactions-modal-DX3CPrMo.js";import"./building-2-CMKd_bU8.js";import"./addDays-DTiBTTns.js";import"./sub-CEXBz_OW.js";import"./subMonths-DY4HlBVa.js";import"./MultiSelect-DBeIExB5.js";const He=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],pe=_("chart-column",He);const $e=[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]],_e=_("file-digit",$e),qe=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const a=r(je,t),[c,l]=o.useState(!0);return e.jsxs(I,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(p=>!p),disabled:!a||a.businessTrips.length===0,children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Business Trips"]})}),c&&a&&e.jsx(O,{data:a.businessTrips,isAllOpened:!1,toggleMergeCharge:s,mergeSelectedCharges:n})]})};function U(t){switch(t){case"C":case"M":return"Self Invoice";case"H":return"Single Doc By Law";case"I":return"Palestinian Customer";case"K":return"Petty Cash";case"L1":return"Unidentified Customer";case"L2":return"Unidentified Zero or Exempt";case"P":return"Palestinian Supplier";case"R":return"Import";case"S1":case"T":return"Regular";case"S2":return"Zero or Exempt";case"Y":return"Export";default:return"Unknown"}}const Ge=t=>{const s=t.reduce((n,a)=>(n[a.recordType]||={recordType:a.recordType,count:0,vatTotal:0,totalBeforeVat:0},n[a.recordType].count++,n[a.recordType].vatTotal+=a.roundedLocalVatAfterDeduction?.raw??0,n[a.recordType].totalBeforeVat+=a.taxReducedLocalAmount?.raw??0,n),{});return Object.values(s)},he=({records:t})=>{const s=o.useMemo(()=>Ge(t??[]),[t]);return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground",children:"Record Type"}),e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground text-right",children:"Count"}),e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground text-right",children:"Total Before VAT"}),e.jsx("th",{className:"pb-3 text-sm font-medium text-muted-foreground text-right",children:"VAT Total"})]})}),e.jsx("tbody",{children:s.map(n=>e.jsxs("tr",{className:"border-b border-border/50",children:[e.jsxs("td",{className:"py-3 text-sm font-medium",children:[U(n.recordType)," (",n.recordType,")"]}),e.jsx("td",{className:"py-3 text-sm text-right",children:n.count}),e.jsx("td",{className:"py-3 text-sm text-right",children:T(n.totalBeforeVat,V.Ils)}),e.jsx("td",{className:"py-3 text-sm text-right",children:T(n.vatTotal,V.Ils)})]},n.recordType))})]})})};function ge({data:t}){const{chargeId:s,chargeAccountantStatus:n}=r(fe,t);return e.jsx("td",{children:e.jsx(Be,{value:n??void 0,chargeId:s})})}const b=Q(),z=[b.accessor(t=>r(u,t.data).recordType,{id:"recordType",header:"Record Type",cell:t=>{const s=t.getValue();return e.jsx("p",{className:"whitespace-wrap",children:`${U(s)} (${s})`})}}),b.accessor(t=>r(u,t.data).business?.name??"",{id:"business",header:"Business",cell:t=>{const s=r(u,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-1",children:[s.business?.id?e.jsx(q,{to:G.BUSINESSES.DETAIL(s.business.id),target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"inline-flex items-center font-semibold",children:s.business.name}):e.jsx("span",{children:s.business?.name}),s.vatNumber&&e.jsx("span",{className:"text-[10px] text-gray-500",children:s.vatNumber})]})}}),b.display({id:"invoice",header:"Invoice",cell:t=>{const s=r(u,t.row.original.data);return s.image?e.jsx("a",{href:s.image,target:"_blank",rel:"noreferrer",children:e.jsx("img",{alt:"missing img",src:s.image,height:80,width:80})}):null}}),b.accessor(t=>r(u,t.data).documentSerial??"",{id:"documentSerial",header:"Invoice Serial#",cell:t=>{const s=r(u,t.row.original.data);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.getValue()}),s.allocationNumber&&e.jsxs("span",{className:"text-xs",children:["(",s.allocationNumber,")"]})]})}}),b.accessor(t=>r(u,t.data).documentDate??"",{id:"documentDate",header:"Invoice Date",cell:t=>t.getValue()}),b.accessor(t=>r(u,t.data).chargeDate??"",{id:"chargeDate",header:"Transaction Date",cell:t=>t.getValue()}),b.accessor(t=>r(u,t.data).amount.raw??0,{id:"amount",header:"Amount",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.amount.formatted})}}),b.accessor(t=>r(u,t.data).localAmount?.raw??0,{id:"localAmount",header:"Amount ₪",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.localAmount?.formatted})}}),b.accessor(t=>r(u,t.data).localVat?.raw??0,{id:"localVat",header:"VAT",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.localVat?.formatted})}}),b.accessor(t=>r(u,t.data).localVatAfterDeduction?.raw??0,{id:"localVatAfterDeduction",header:"VAT ₪",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.localVatAfterDeduction?.formatted})}}),b.accessor(t=>r(u,t.data).foreignVatAfterDeduction?.raw??0,{id:"foreignVatAfterDeduction",header:"Actual VAT",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.foreignVatAfterDeduction?.formatted})}}),b.accessor(t=>r(u,t.data).roundedLocalVatAfterDeduction?.raw??0,{id:"roundedLocalVatAfterDeduction",header:"Rounded VAT",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.roundedLocalVatAfterDeduction?.formatted})}}),b.accessor(t=>t.cumulativeVat,{id:"cumulativeVat",header:"Cumulative VAT",cell:t=>e.jsxs("span",{className:"whitespace-nowrap",children:["₪ ",L(t.getValue(),0)]})}),b.accessor(t=>r(u,t.data).taxReducedLocalAmount?.raw??0,{id:"taxReducedLocalAmount",header:"Amount without VAT ₪",cell:t=>{const s=r(u,t.row.original.data);return e.jsx("span",{className:"whitespace-nowrap",children:s.taxReducedLocalAmount?.formatted})}}),b.accessor(t=>t.cumulativeAmount,{id:"cumulativeAmount",header:"Cumulative Amount without VAT ₪",cell:t=>e.jsxs("span",{className:"whitespace-nowrap",children:["₪ ",L(t.getValue(),0)]})}),b.display({id:"accountantApproval",header:"Accountant Approval",cell:t=>{const s=r(u,t.row.original.data);return e.jsx(ge,{data:s})}}),b.display({id:"actions",header:"Edit",cell:t=>{const s=r(u,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(xe,{toggleExpansion:()=>t.row.toggleExpanded(),isExpanded:t.row.getIsExpanded()}),e.jsx(de,{toggleMergeSelected:()=>t.row.original.toggleMergeCharge(s.chargeId),mergeSelected:t.row.original.mergeSelectedCharges.has(s.chargeId)}),e.jsx(ue,{chargeId:s.chargeId})]})}})],Qe=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const{expenses:a}=r(be,t)??{expenses:[]},[c,l]=o.useState(!0),[p,x]=o.useState([]),[j,i]=o.useState({}),[f,h]=o.useState({}),[g,C]=o.useState("detailed"),F=o.useMemo(()=>{let d=0,m=0;return a.map(y=>(d+=y.taxReducedLocalAmount?.raw??0,m+=y.roundedLocalVatAfterDeduction?.raw??0,{data:y,toggleMergeCharge:s,mergeSelectedCharges:n,cumulativeVat:m,cumulativeAmount:d}))},[a,s,n]),A=J({data:F,columns:z,getCoreRowModel:K(),onSortingChange:x,getSortedRowModel:Z(),onColumnVisibilityChange:i,onExpandedChange:h,getExpandedRowModel:Y(),state:{sorting:p,columnVisibility:j,expanded:f}});return e.jsxs(I,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(d=>!d),children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Expenses"]}),c&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:g==="detailed"?"default":"outline",size:"sm",onClick:()=>C("detailed"),children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Detailed"]}),e.jsxs(w,{variant:g==="summarized"?"default":"outline",size:"sm",onClick:()=>C("summarized"),children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),"Summarized"]})]})]}),c&&(g==="detailed"?e.jsxs(X,{children:[e.jsx(ee,{children:A.getHeaderGroups().map(d=>e.jsx(S,{children:d.headers.map(m=>e.jsx(te,{colSpan:m.colSpan,children:m.isPlaceholder?null:e.jsxs(w,{variant:"ghost",onClick:m.column.getToggleSortingHandler(),className:"h-auto p-0 hover:bg-transparent",children:[E(m.column.columnDef.header,m.getContext()),{asc:e.jsx(ae,{className:"size-5"}),desc:e.jsx(se,{className:"size-5"})}[m.column.getIsSorted()]??null]})},m.id))},d.id))}),e.jsx(ne,{children:A.getRowModel().rows?.length?A.getRowModel().rows.map(d=>{const m=r(u,d.original.data);return e.jsxs(o.Fragment,{children:[e.jsx(S,{"data-state":d.getIsSelected()&&"selected",children:d.getVisibleCells().map(y=>e.jsx(D,{children:E(y.column.columnDef.cell,y.getContext())},y.id))}),d.getIsExpanded()&&e.jsx(S,{children:e.jsx(D,{colSpan:z.length,children:e.jsx(re,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:e.jsx(me,{chargeID:m.chargeId,fetching:!!m})})})})]},d.id)}):e.jsx(S,{children:e.jsx(D,{colSpan:z.length,className:"h-24 text-center",children:"No results."})})})]}):e.jsx(he,{records:a}))]})},v=Q(),k=[v.accessor(t=>r(N,t.data).recordType,{id:"recordType",header:"Record Type",cell:t=>{const s=t.getValue();return e.jsx("p",{className:"whitespace-wrap",children:`${U(s)} (${s})`})}}),v.accessor(t=>r(N,t.data).business?.name??"",{id:"business",header:"Business",cell:t=>{const s=r(N,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-1",children:[s.business?.id?e.jsx(q,{to:G.BUSINESSES.DETAIL(s.business.id),target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"inline-flex items-center font-semibold",children:s.business.name}):e.jsx("span",{children:s.business?.name}),s.vatNumber&&e.jsx("span",{className:"text-[10px] text-gray-500",children:s.vatNumber})]})}}),v.display({id:"invoice",header:"Invoice",cell:t=>{const s=r(N,t.row.original.data);return s.image?e.jsx("a",{href:s.image,target:"_blank",rel:"noreferrer",children:e.jsx("img",{alt:"missing img",src:s.image,height:80,width:80})}):null}}),v.accessor(t=>r(N,t.data).documentSerial??"",{id:"documentSerial",header:"Invoice Serial#",cell:t=>{const s=r(N,t.row.original.data);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:t.getValue()}),s.allocationNumber&&e.jsxs("span",{className:"text-xs",children:["(",s.allocationNumber,")"]})]})}}),v.accessor(t=>r(N,t.data).documentDate??"",{id:"documentDate",header:"Invoice Date",cell:t=>t.getValue()}),v.accessor(t=>r(N,t.data).chargeDate??"",{id:"chargeDate",header:"Transaction Date",cell:t=>t.getValue()}),v.accessor(t=>r(N,t.data).taxReducedForeignAmount?.raw??0,{id:"amount",header:"Amount",cell:t=>r(N,t.row.original.data).taxReducedForeignAmount?.formatted??""}),v.accessor(t=>r(N,t.data).taxReducedLocalAmount?.raw??0,{id:"localAmount",header:"Amount ₪",cell:t=>r(N,t.row.original.data).taxReducedLocalAmount?.formatted??""}),v.accessor(t=>t.cumulativeAmount,{id:"cumulativeAmount",header:"Cumulative Amount ₪",cell:t=>e.jsxs("span",{className:"whitespace-nowrap",children:["₪ ",L(t.getValue(),0)]})}),v.display({id:"accountantApproval",header:"Accountant Approval",cell:t=>{const s=r(N,t.row.original.data);return e.jsx(ge,{data:s})}}),v.display({id:"actions",header:"Edit",cell:t=>{const s=r(N,t.row.original.data);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(xe,{toggleExpansion:()=>t.row.toggleExpanded(),isExpanded:t.row.getIsExpanded()}),e.jsx(de,{toggleMergeSelected:()=>t.row.original.toggleMergeCharge(s.chargeId),mergeSelected:t.row.original.mergeSelectedCharges.has(s.chargeId)}),e.jsx(ue,{chargeId:s.chargeId})]})}})],Je=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const{income:a}=r(Ne,t)??{income:[]},[c,l]=o.useState(!0),[p,x]=o.useState([]),[j,i]=o.useState({}),[f,h]=o.useState({}),[g,C]=o.useState("detailed"),F=o.useMemo(()=>{let d=0;return a.map(m=>(d+=m.taxReducedLocalAmount?.raw??0,{data:m,toggleMergeCharge:s,mergeSelectedCharges:n,cumulativeAmount:d}))},[a,s,n]),A=J({data:F,columns:k,getCoreRowModel:K(),onSortingChange:x,getSortedRowModel:Z(),onColumnVisibilityChange:i,onExpandedChange:h,getExpandedRowModel:Y(),state:{sorting:p,columnVisibility:j,expanded:f}});return e.jsxs(I,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(d=>!d),children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Income"]}),c&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:g==="detailed"?"default":"outline",size:"sm",onClick:()=>C("detailed"),children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Detailed"]}),e.jsxs(w,{variant:g==="summarized"?"default":"outline",size:"sm",onClick:()=>C("summarized"),children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),"Summarized"]})]})]}),c&&(g==="detailed"?e.jsxs(X,{children:[e.jsx(ee,{children:A.getHeaderGroups().map(d=>e.jsx(S,{children:d.headers.map(m=>e.jsx(te,{colSpan:m.colSpan,children:m.isPlaceholder?null:e.jsxs(w,{variant:"ghost",onClick:m.column.getToggleSortingHandler(),className:"h-auto p-0 hover:bg-transparent",children:[E(m.column.columnDef.header,m.getContext()),{asc:e.jsx(ae,{className:"size-5"}),desc:e.jsx(se,{className:"size-5"})}[m.column.getIsSorted()]??null]})},m.id))},d.id))}),e.jsx(ne,{children:A.getRowModel().rows?.length?A.getRowModel().rows.map(d=>{const m=r(N,d.original.data);return e.jsxs(o.Fragment,{children:[e.jsx(S,{"data-state":d.getIsSelected()&&"selected",children:d.getVisibleCells().map(y=>e.jsx(D,{children:E(y.column.columnDef.cell,y.getContext())},y.id))}),d.getIsExpanded()&&e.jsx(S,{children:e.jsx(D,{colSpan:k.length,children:e.jsx(re,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:e.jsx(me,{chargeID:m.chargeId,fetching:!!m})})})})]},d.id)}):e.jsx(S,{children:e.jsx(D,{colSpan:k.length,className:"h-24 text-center",children:"No results."})})})]}):e.jsx(he,{records:a}))]})},Ye=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const a=r(we,t),[c,l]=o.useState(!0);return e.jsxs(I,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(p=>!p),disabled:!a||a.differentMonthDoc.length===0,children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Misc Charges (which are not on the above tables)"]})}),c&&a&&e.jsx(O,{data:a.differentMonthDoc,isAllOpened:!1,toggleMergeCharge:s,mergeSelectedCharges:n})]})},Ze=({data:t,toggleMergeCharge:s,mergeSelectedCharges:n})=>{const a=r(ye,t),[c,l]=o.useState(!0);return e.jsxs(I,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>l(p=>!p),disabled:!a||a.missingInfo.length===0,children:c?e.jsx(R,{className:"size-5"}):e.jsx(M,{className:"size-5"})}),"Missing Info"]})}),c&&a&&e.jsx(O,{data:a.missingInfo,isAllOpened:!1,toggleMergeCharge:s,mergeSelectedCharges:n})]})},Ke=({filter:{monthDate:t,financialEntityId:s},isLoading:n})=>{const[{data:a,fetching:c,error:l},p]=oe({query:ce(Ae),pause:!0,variables:{monthDate:t,financialEntityId:s}});return o.useEffect(()=>{if(l){const x="Error generating PCN874 file";console.error(`${x}: ${l}`),ve.error("Error",{description:x,duration:5e3,closeButton:!0})}},[l]),o.useEffect(()=>{if(a){const x=new File([a.pcnFile.reportContent],"pcn874.txt",{type:"text/plain"});Se(x)}},[a]),e.jsx(Ce,{content:"Generate and Download PCN874 File",children:e.jsx(w,{disabled:c||n,variant:"outline",size:"icon",className:"size-7.5",onClick:p,children:e.jsx(_e,{className:"size-5"})})})},We=({data:t})=>{const s=r(Te,t),n=o.useMemo(()=>s?.expenses??[],[s?.expenses]),a=o.useMemo(()=>s?.income??[],[s?.income]),c=o.useMemo(()=>a.reduce((i,f)=>i+(f.taxReducedLocalAmount?.raw??0),0),[a]),l=o.useMemo(()=>a.reduce((i,f)=>i+(f.roundedLocalVatAfterDeduction?.raw??0),0),[a]),p=o.useMemo(()=>a.filter(i=>(i.roundedLocalVatAfterDeduction?.raw??0)===0).reduce((i,f)=>i+(f.taxReducedLocalAmount?.raw??0),0),[a]),x=o.useMemo(()=>n.filter(i=>i.isProperty).reduce((i,f)=>i+(f.taxReducedLocalAmount?.raw??0),0),[n]),j=o.useMemo(()=>l-n.reduce((i,f)=>i+(f.roundedLocalVatAfterDeduction?.raw??0),0),[l,n]);return e.jsxs(I,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Report Summary"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Taxable Sales Total"}),e.jsx("p",{className:"text-2xl font-bold",children:T(c,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Taxable Sales VAT"}),e.jsx("p",{className:"text-2xl font-bold",children:T(l,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Zero / Exempt Sales"}),e.jsx("p",{className:"text-2xl font-bold",children:T(p,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Equipment Inputs"}),e.jsx("p",{className:"text-2xl font-bold",children:T(x,V.Ils)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total VAT Amount"}),e.jsx("p",{className:"text-2xl font-bold",children:T(j,V.Ils)})]})]})]})};function Xe({filter:t,setFilter:s,closeModal:n}){const{control:a,handleSubmit:c,setValue:l}=De({defaultValues:{...t}}),{selectableAdminBusinesses:p,fetching:x}=Ie(),j=h=>{s(h),n()};function i(){s(),n()}function f(h){const g=new Date(h.getFullYear(),h.getMonth(),15);l("monthDate",P(g,"yyyy-MM-dd"))}return e.jsxs(e.Fragment,{children:[x?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsxs("form",{onSubmit:c(j),children:[e.jsx(H,{name:"financialEntityId",control:a,defaultValue:void 0,render:({field:h,fieldState:g})=>e.jsx($,{...h,data:p,value:h.value,disabled:x,label:"Report Issuer (Admin Business)",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:g.error?.message})}),e.jsx(H,{name:"chargesType",control:a,defaultValue:t.chargesType,render:({field:h,fieldState:g})=>e.jsx($,{...h,data:Pe,value:h.value??B.All,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:g.error?.message})}),e.jsx(Re,{defaultValue:t?.monthDate?new Date(t.monthDate):new Date,defaultDate:t?.monthDate?new Date(t.monthDate):new Date,onChange:f,popoverProps:{withinPortal:!0}}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:i,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:n,children:"Cancel"})]})]})]})}function et({filter:t,setFilter:s}){const[n,a]=o.useState(!1),{get:c,set:l}=ie(),{userContext:p}=o.useContext(le);function x(j){j||={financialEntityId:p?.context.adminBusinessId??t.financialEntityId,monthDate:P(new Date,"yyyy-MM-15")},Me(j,t)||s(j)}return o.useEffect(()=>{const j=Ve(t??{})?null:encodeURIComponent(JSON.stringify(t)),i=c("vatMonthlyReportFilters");j!==i&&l("vatMonthlyReportFilters",j)},[t,c,l]),e.jsxs(e.Fragment,{children:[e.jsx(Oe,{opened:n,onClose:()=>a(!1),content:e.jsx(Xe,{filter:t,setFilter:x,closeModal:()=>a(!1)})}),e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>a(!0),children:e.jsx(Ue,{className:"size-5"})})]})}const At=()=>{const{get:t}=ie(),{setFiltersContext:s}=o.useContext(Ee),{userContext:n}=o.useContext(le),[a,c]=o.useState(t("vatMonthlyReportFilters")?JSON.parse(decodeURIComponent(t("vatMonthlyReportFilters"))):{financialEntityId:n?.context.adminBusinessId??"",monthDate:P(new Date,"yyyy-MM-15")}),[l,p]=o.useState([]);o.useEffect(()=>{(!a.financialEntityId||a.financialEntityId==="")&&n?.context.adminBusinessId&&c({...a,financialEntityId:n.context.adminBusinessId})},[a,n?.context.adminBusinessId]);const[{data:x,fetching:j}]=oe({query:ce(ze),variables:{filters:a},pause:a.financialEntityId===""}),i=o.useCallback(g=>{l.includes(g)?p(l.filter(C=>C!==g)):p([...l,g])},[l]);function f(){p([])}o.useEffect(()=>{s(e.jsxs("div",{className:"flex flex-row gap-2",children:[e.jsx(Ke,{filter:a,isLoading:j}),e.jsx(et,{filter:{...a},setFilter:c}),e.jsx(ke,{selected:l.map(g=>({id:g,onChange:()=>{}})),resetMerge:f})]}))},[x,a,j,s,l]);const h=o.useMemo(()=>new Set(l),[l]);return e.jsx(Le,{title:"VAT Monthly Report",children:j?e.jsx(Fe,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"min-h-screen",children:e.jsxs("div",{className:"space-y-4",children:[a.financialEntityId&&a.monthDate&&e.jsx(We,{data:x?.vatReport}),a.chargesType!==B.Expense&&e.jsx(Je,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),a.chargesType!==B.Income&&e.jsx(Qe,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),e.jsx(Ze,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),e.jsx(qe,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h}),e.jsx(Ye,{data:x?.vatReport,toggleMergeCharge:i,mergeSelectedCharges:h})]})})})};export{At as VatMonthlyReport};
@@ -1,4 +1,4 @@
1
- import{v as Ge,r as m,dh as Nc,aF as V,dl as kc,aG as ae,j as v,dk as vn,dK as It,dL as ge,dM as Ho,dm as Lc,dN as Vc,dO as nn,dP as jc,bB as Fi,D as _r,aL as zr,bC as Fc,B as ee,x as $r,al as Ur,am as Hr,E as Wo,bD as Bc,aC as _c,bE as An,bF as Bi,bG as _i,w as rn,at as Go,a2 as Ko,bI as zc,g as qo,dQ as $c,t as Pe,i as Yo,T as yn,u as rr,dR as Uc,bY as Hc,c3 as Wc,c5 as Gc,c4 as Kc,c6 as qc,L as Xo,I as Wr,bO as Yc,bP as Xc,bQ as Nn,bR as Zc,c2 as zi,bS as Jc,bT as $i,bZ as Zo,b_ as Jo,c0 as Qo,dS as Qc,dT as eu,dU as sn,dV as tu,G as nu,V as ru,Y as iu,Z as su,_ as ou,$ as au,a1 as lu,au as cu,aa as uu,ae as Ui,dW as du,e as hu,a4 as fu,af as Hi,dX as pu,dY as Wi,cw as gu,dZ as mu,ay as vu,F as yu,b3 as bu,d_ as Tu,d$ as xu}from"./index-D1_HHRLX.js";import{u as ea}from"./use-url-query-RoURh24O.js";import{A as Gi}from"./arrow-up-down-YhPbp1Ud.js";import{D as Su}from"./download-csv-button-DVLHjMAB.js";import{B as wu}from"./business-extended-info-zz1obrFs.js";import{_ as Du,a as bn,s as we,g as Gr,u as Ki,c as Kr,m as wt,d as ir,T as sr}from"./Typography-B3aRT5ej.js";import{P as Cu,a as Eu}from"./panel-top-open-Bxnxp1BU.js";import{F as Ou}from"./funnel-0IvwyZBf.js";import{M as Pu}from"./MultiSelect-C5wjF9jC.js";import"./data-table-column-header--gzXkv5r.js";import"./eye-off-DWYC0Eax.js";const Mu=[["path",{d:"m10.852 19.772-.383.924",key:"r7sl7d"}],["path",{d:"m13.148 14.228.383-.923",key:"1d5zpm"}],["path",{d:"M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1ydik7"}],["path",{d:"m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1m1vsf"}],["path",{d:"m14.772 15.852.923-.383",key:"660p6e"}],["path",{d:"m14.772 18.148.923.383",key:"hrcpis"}],["path",{d:"M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"j2q98n"}],["path",{d:"m9.228 15.852-.923-.383",key:"1p9ong"}],["path",{d:"m9.228 18.148-.923.383",key:"6558rz"}]],Iu=Ge("cloud-cog",Mu);const Ru=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Au=Ge("cloud-upload",Ru);const Nu=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],ta=Ge("ellipsis",Nu);const ku=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Lu=Ge("folder-open",ku);const Vu=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ju=Ge("folder-plus",Vu);const Fu=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Bu=Ge("folder",Fu);const _u=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],zu=Ge("pencil",_u);function Gt(t){const e=m.useRef(t);return Nc(()=>{e.current=t}),m.useRef((...n)=>(0,e.current)(...n)).current}function or(t,e){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},or(t,e)}function $u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,or(t,e)}const qi=V.createContext(null);function Uu(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qr(t,e){var n=function(s){return e&&m.isValidElement(s)?e(s):s},r=Object.create(null);return t&&m.Children.map(t,function(i){return i}).forEach(function(i){r[i.key]=n(i)}),r}function Hu(t,e){t=t||{},e=e||{};function n(u){return u in e?e[u]:t[u]}var r=Object.create(null),i=[];for(var s in t)s in e?i.length&&(r[s]=i,i=[]):i.push(s);var o,a={};for(var l in e){if(r[l])for(o=0;o<r[l].length;o++){var c=r[l][o];a[r[l][o]]=n(c)}a[l]=n(l)}for(o=0;o<i.length;o++)a[i[o]]=n(i[o]);return a}function _e(t,e,n){return n[e]!=null?n[e]:t.props[e]}function Wu(t,e){return qr(t.children,function(n){return m.cloneElement(n,{onExited:e.bind(null,n),in:!0,appear:_e(n,"appear",t),enter:_e(n,"enter",t),exit:_e(n,"exit",t)})})}function Gu(t,e,n){var r=qr(t.children),i=Hu(e,r);return Object.keys(i).forEach(function(s){var o=i[s];if(m.isValidElement(o)){var a=s in e,l=s in r,c=e[s],u=m.isValidElement(c)&&!c.props.in;l&&(!a||u)?i[s]=m.cloneElement(o,{onExited:n.bind(null,o),in:!0,exit:_e(o,"exit",t),enter:_e(o,"enter",t)}):!l&&a&&!u?i[s]=m.cloneElement(o,{in:!1}):l&&a&&m.isValidElement(c)&&(i[s]=m.cloneElement(o,{onExited:n.bind(null,o),in:c.props.in,exit:_e(o,"exit",t),enter:_e(o,"enter",t)}))}}),i}var Ku=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},qu={component:"div",childFactory:function(e){return e}},Yr=(function(t){$u(e,t);function e(r,i){var s;s=t.call(this,r,i)||this;var o=s.handleExited.bind(Uu(s));return s.state={contextValue:{isMounting:!0},handleExited:o,firstRender:!0},s}var n=e.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(i,s){var o=s.children,a=s.handleExited,l=s.firstRender;return{children:l?Wu(i,a):Gu(i,o,a),firstRender:!1}},n.handleExited=function(i,s){var o=qr(this.props.children);i.key in o||(i.props.onExited&&i.props.onExited(s),this.mounted&&this.setState(function(a){var l=kc({},a.children);return delete l[i.key],{children:l}}))},n.render=function(){var i=this.props,s=i.component,o=i.childFactory,a=Du(i,["component","childFactory"]),l=this.state.contextValue,c=Ku(this.state.children).map(o);return delete a.appear,delete a.enter,delete a.exit,s===null?V.createElement(qi.Provider,{value:l},c):V.createElement(qi.Provider,{value:l},V.createElement(s,a,c))},e})(V.Component);Yr.propTypes={};Yr.defaultProps=qu;const Yi={};function na(t,e){const n=m.useRef(Yi);return n.current===Yi&&(n.current=t(e)),n}const Yu=[];function Xu(t){m.useEffect(t,Yu)}class Xr{static create(){return new Xr}currentId=null;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},e)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function Zu(){const t=na(Xr.create).current;return Xu(t.disposeEffect),t}function Xi(t){try{return t.matches(":focus-visible")}catch{}return!1}class on{static create(){return new on}static use(){const e=na(on.create).current,[n,r]=m.useState(!1);return e.shouldMount=n,e.setShouldMount=r,m.useEffect(e.mountEffect,[n]),e}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=Qu(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...e){this.mount().then(()=>this.ref.current?.start(...e))}stop(...e){this.mount().then(()=>this.ref.current?.stop(...e))}pulsate(...e){this.mount().then(()=>this.ref.current?.pulsate(...e))}}function Ju(){return on.use()}function Qu(){let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n}function ed(t){const{className:e,classes:n,pulsate:r=!1,rippleX:i,rippleY:s,rippleSize:o,in:a,onExited:l,timeout:c}=t,[u,d]=m.useState(!1),h=ae(e,n.ripple,n.rippleVisible,r&&n.ripplePulsate),f={width:o,height:o,top:-(o/2)+s,left:-(o/2)+i},p=ae(n.child,u&&n.childLeaving,r&&n.childPulsate);return!a&&!u&&d(!0),m.useEffect(()=>{if(!a&&l!=null){const g=setTimeout(l,c);return()=>{clearTimeout(g)}}},[l,a,c]),v.jsx("span",{className:h,style:f,children:v.jsx("span",{className:p})})}const le=bn("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),ar=550,td=80,nd=It`
1
+ import{v as Ge,r as m,dh as Nc,aF as V,dl as kc,aG as ae,j as v,dk as vn,dK as It,dL as ge,dM as Ho,dm as Lc,dN as Vc,dO as nn,dP as jc,bB as Fi,D as _r,aL as zr,bC as Fc,B as ee,x as $r,al as Ur,am as Hr,E as Wo,bD as Bc,aC as _c,bE as An,bF as Bi,bG as _i,w as rn,at as Go,a2 as Ko,bI as zc,g as qo,dQ as $c,t as Pe,i as Yo,T as yn,u as rr,dR as Uc,bY as Hc,c3 as Wc,c5 as Gc,c4 as Kc,c6 as qc,L as Xo,I as Wr,bO as Yc,bP as Xc,bQ as Nn,bR as Zc,c2 as zi,bS as Jc,bT as $i,bZ as Zo,b_ as Jo,c0 as Qo,dS as Qc,dT as eu,dU as sn,dV as tu,G as nu,V as ru,Y as iu,Z as su,_ as ou,$ as au,a1 as lu,au as cu,aa as uu,ae as Ui,dW as du,e as hu,a4 as fu,af as Hi,dX as pu,dY as Wi,cw as gu,dZ as mu,ay as vu,F as yu,b3 as bu,d_ as Tu,d$ as xu}from"./index-rI994S3C.js";import{u as ea}from"./use-url-query-CqWra6gD.js";import{A as Gi}from"./arrow-up-down-VY6mkkTR.js";import{D as Su}from"./download-csv-button-CMQBUQeX.js";import{B as wu}from"./business-extended-info-B94y5ZK6.js";import{_ as Du,a as bn,s as we,g as Gr,u as Ki,c as Kr,m as wt,d as ir,T as sr}from"./Typography-B8Kph7eR.js";import{P as Cu,a as Eu}from"./panel-top-open-Bf39HBrp.js";import{F as Ou}from"./funnel-Cfb9Pxmr.js";import{M as Pu}from"./MultiSelect-DBeIExB5.js";import"./data-table-column-header-CZ1dXiU0.js";import"./eye-off-Buv7eciz.js";const Mu=[["path",{d:"m10.852 19.772-.383.924",key:"r7sl7d"}],["path",{d:"m13.148 14.228.383-.923",key:"1d5zpm"}],["path",{d:"M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1ydik7"}],["path",{d:"m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1m1vsf"}],["path",{d:"m14.772 15.852.923-.383",key:"660p6e"}],["path",{d:"m14.772 18.148.923.383",key:"hrcpis"}],["path",{d:"M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"j2q98n"}],["path",{d:"m9.228 15.852-.923-.383",key:"1p9ong"}],["path",{d:"m9.228 18.148-.923.383",key:"6558rz"}]],Iu=Ge("cloud-cog",Mu);const Ru=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Au=Ge("cloud-upload",Ru);const Nu=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],ta=Ge("ellipsis",Nu);const ku=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Lu=Ge("folder-open",ku);const Vu=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ju=Ge("folder-plus",Vu);const Fu=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Bu=Ge("folder",Fu);const _u=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],zu=Ge("pencil",_u);function Gt(t){const e=m.useRef(t);return Nc(()=>{e.current=t}),m.useRef((...n)=>(0,e.current)(...n)).current}function or(t,e){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},or(t,e)}function $u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,or(t,e)}const qi=V.createContext(null);function Uu(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qr(t,e){var n=function(s){return e&&m.isValidElement(s)?e(s):s},r=Object.create(null);return t&&m.Children.map(t,function(i){return i}).forEach(function(i){r[i.key]=n(i)}),r}function Hu(t,e){t=t||{},e=e||{};function n(u){return u in e?e[u]:t[u]}var r=Object.create(null),i=[];for(var s in t)s in e?i.length&&(r[s]=i,i=[]):i.push(s);var o,a={};for(var l in e){if(r[l])for(o=0;o<r[l].length;o++){var c=r[l][o];a[r[l][o]]=n(c)}a[l]=n(l)}for(o=0;o<i.length;o++)a[i[o]]=n(i[o]);return a}function _e(t,e,n){return n[e]!=null?n[e]:t.props[e]}function Wu(t,e){return qr(t.children,function(n){return m.cloneElement(n,{onExited:e.bind(null,n),in:!0,appear:_e(n,"appear",t),enter:_e(n,"enter",t),exit:_e(n,"exit",t)})})}function Gu(t,e,n){var r=qr(t.children),i=Hu(e,r);return Object.keys(i).forEach(function(s){var o=i[s];if(m.isValidElement(o)){var a=s in e,l=s in r,c=e[s],u=m.isValidElement(c)&&!c.props.in;l&&(!a||u)?i[s]=m.cloneElement(o,{onExited:n.bind(null,o),in:!0,exit:_e(o,"exit",t),enter:_e(o,"enter",t)}):!l&&a&&!u?i[s]=m.cloneElement(o,{in:!1}):l&&a&&m.isValidElement(c)&&(i[s]=m.cloneElement(o,{onExited:n.bind(null,o),in:c.props.in,exit:_e(o,"exit",t),enter:_e(o,"enter",t)}))}}),i}var Ku=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},qu={component:"div",childFactory:function(e){return e}},Yr=(function(t){$u(e,t);function e(r,i){var s;s=t.call(this,r,i)||this;var o=s.handleExited.bind(Uu(s));return s.state={contextValue:{isMounting:!0},handleExited:o,firstRender:!0},s}var n=e.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(i,s){var o=s.children,a=s.handleExited,l=s.firstRender;return{children:l?Wu(i,a):Gu(i,o,a),firstRender:!1}},n.handleExited=function(i,s){var o=qr(this.props.children);i.key in o||(i.props.onExited&&i.props.onExited(s),this.mounted&&this.setState(function(a){var l=kc({},a.children);return delete l[i.key],{children:l}}))},n.render=function(){var i=this.props,s=i.component,o=i.childFactory,a=Du(i,["component","childFactory"]),l=this.state.contextValue,c=Ku(this.state.children).map(o);return delete a.appear,delete a.enter,delete a.exit,s===null?V.createElement(qi.Provider,{value:l},c):V.createElement(qi.Provider,{value:l},V.createElement(s,a,c))},e})(V.Component);Yr.propTypes={};Yr.defaultProps=qu;const Yi={};function na(t,e){const n=m.useRef(Yi);return n.current===Yi&&(n.current=t(e)),n}const Yu=[];function Xu(t){m.useEffect(t,Yu)}class Xr{static create(){return new Xr}currentId=null;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},e)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function Zu(){const t=na(Xr.create).current;return Xu(t.disposeEffect),t}function Xi(t){try{return t.matches(":focus-visible")}catch{}return!1}class on{static create(){return new on}static use(){const e=na(on.create).current,[n,r]=m.useState(!1);return e.shouldMount=n,e.setShouldMount=r,m.useEffect(e.mountEffect,[n]),e}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=Qu(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...e){this.mount().then(()=>this.ref.current?.start(...e))}stop(...e){this.mount().then(()=>this.ref.current?.stop(...e))}pulsate(...e){this.mount().then(()=>this.ref.current?.pulsate(...e))}}function Ju(){return on.use()}function Qu(){let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n}function ed(t){const{className:e,classes:n,pulsate:r=!1,rippleX:i,rippleY:s,rippleSize:o,in:a,onExited:l,timeout:c}=t,[u,d]=m.useState(!1),h=ae(e,n.ripple,n.rippleVisible,r&&n.ripplePulsate),f={width:o,height:o,top:-(o/2)+s,left:-(o/2)+i},p=ae(n.child,u&&n.childLeaving,r&&n.childPulsate);return!a&&!u&&d(!0),m.useEffect(()=>{if(!a&&l!=null){const g=setTimeout(l,c);return()=>{clearTimeout(g)}}},[l,a,c]),v.jsx("span",{className:h,style:f,children:v.jsx("span",{className:p})})}const le=bn("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),ar=550,td=80,nd=It`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0.1;
@@ -1,4 +1,4 @@
1
- import{r as h,bB as D,j as e,bC as N,B as y,E as $,bD as k,aC as R,V as O,bE as f,bF as S,bG as C,w as F,Y as E,Z as A,_ as z,$ as P,at as M,bI as L,bv as w,T as B,aP as j,ay as p,a6 as V,d7 as v,dH as _,F as G,u as q,dI as U,b$ as Z,L as H,dJ as J}from"./index-D1_HHRLX.js";import{u as I}from"./use-url-query-RoURh24O.js";import{P as Q}from"./page-layout-BOjYoqoi.js";import{P as K}from"./modal-CNW2FGYc.js";import{F as W}from"./funnel-0IvwyZBf.js";import{M as T}from"./MultiSelect-C5wjF9jC.js";import{D as X}from"./download-csv-button-DVLHjMAB.js";import{B as Y}from"./business-extended-info-zz1obrFs.js";import{P as ee,a as te}from"./panel-top-open-Bxnxp1BU.js";import{T as se}from"./Table-pGQWLQ8H.js";import"./data-table-column-header--gzXkv5r.js";import"./eye-off-DWYC0Eax.js";function re({filter:t,setFilter:s,closeModal:i}){const n=$({defaultValues:{...t}}),{control:a,handleSubmit:o}=n,{selectableBusinesses:r,fetching:u}=k(),{userContext:m}=h.useContext(R),c=l=>{l.fromDate?.trim()===""&&(l.fromDate=void 0),l.toDate?.trim()===""&&(l.toDate=void 0),s(l),i()};function d(){s({}),i()}return e.jsxs(e.Fragment,{children:[u?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(O,{...n,children:e.jsxs("form",{onSubmit:o(c),className:"space-y-2",children:[e.jsx(f,{name:"ownerIds",control:a,defaultValue:void 0,render:({field:l,fieldState:b})=>e.jsx(T,{...l,data:r,value:l.value??(m?.context.adminBusinessId?[m?.context.adminBusinessId]:void 0),disabled:u,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(f,{name:"businessIDs",control:a,defaultValue:void 0,render:({field:l,fieldState:b})=>e.jsx(T,{...l,data:r,value:l.value??void 0,disabled:u,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(f,{name:"fromDate",control:a,defaultValue:t.fromDate,rules:{required:"Required",pattern:{value:S,message:"Date must be im format yyyy-mm-dd"}},render:({field:l,fieldState:b})=>e.jsx(C,{...l,onChange:x=>{const g=x?typeof x=="string"?x:F(x,"yyyy-MM-dd"):void 0;g!==l.value&&l.onChange(g)},value:l.value?new Date(l.value):void 0,label:"From Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(f,{name:"toDate",control:a,defaultValue:t.toDate,rules:{pattern:{value:S,message:"Date must be im format yyyy-mm-dd"}},render:({field:l,fieldState:b})=>e.jsx(C,{...l,onChange:x=>{const g=x?typeof x=="string"?x:F(x,"yyyy-MM-dd"):void 0;g!==l.value&&l.onChange(g)},value:l.value?new Date(l.value):void 0,label:"To Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(E,{name:"isShowZeroedAccounts",control:a,render:({field:l})=>e.jsxs(A,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(z,{children:"Show zeroed accounts"})}),e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(P,{children:e.jsx(M,{defaultChecked:t.isShowZeroedAccounts??!1,onCheckedChange:l.onChange,checked:l.value===!0})}),e.jsx("span",{children:l.value?"show":"remove"})]})]})}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:d,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:i,children:"Cancel"})]})]})})]})}function ae({filter:t,setFilter:s}){const[i,n]=h.useState(!1),[a,o]=h.useState(!D(t)),{get:r,set:u}=I();function m(d){return Object.entries(d??{}).filter(([b,x])=>x!==void 0&&Array.isArray(x)&&x.length>0).length>0}function c(d){L(d,t)||(s(d),o(m(d)))}return h.useEffect(()=>{const d=D(t)?null:encodeURIComponent(JSON.stringify(t)),l=r("trialBalanceReportFilters");d!==l&&u("trialBalanceReportFilters",d)},[t,r,u]),e.jsxs(e.Fragment,{children:[e.jsx(K,{opened:i,onClose:()=>n(!1),content:e.jsx(re,{filter:t,setFilter:c,closeModal:()=>n(!1)})}),e.jsx(N,{inline:!0,size:16,disabled:!a,children:e.jsx(y,{variant:"outline",onClick:()=>n(!0),className:"p-2",children:e.jsx(W,{size:20})})})]})}const ne=({data:t,fromDate:s,toDate:i})=>{const n=h.useCallback(async()=>{const a=oe(t),o=`trial_balance_report${s?`_${s}`:""}${i?`_${i}`:""}`;return{fileContent:a,fileName:o}},[t,s,i]);return e.jsx(X,{createFileVariables:n})},oe=t=>{let s="";s+=`Sort Code,Account Name,Debit,Credit,Balance\r
1
+ import{r as h,bB as D,j as e,bC as N,B as y,E as $,bD as k,aC as R,V as O,bE as f,bF as S,bG as C,w as F,Y as E,Z as A,_ as z,$ as P,at as M,bI as L,bv as w,T as B,aP as j,ay as p,a6 as V,d7 as v,dH as _,F as G,u as q,dI as U,b$ as Z,L as H,dJ as J}from"./index-rI994S3C.js";import{u as I}from"./use-url-query-CqWra6gD.js";import{P as Q}from"./page-layout-DMGj5xhW.js";import{P as K}from"./modal-BXR_xgUm.js";import{F as W}from"./funnel-Cfb9Pxmr.js";import{M as T}from"./MultiSelect-DBeIExB5.js";import{D as X}from"./download-csv-button-CMQBUQeX.js";import{B as Y}from"./business-extended-info-B94y5ZK6.js";import{P as ee,a as te}from"./panel-top-open-Bf39HBrp.js";import{T as se}from"./Table-BQv3frL8.js";import"./data-table-column-header-CZ1dXiU0.js";import"./eye-off-Buv7eciz.js";function re({filter:t,setFilter:s,closeModal:i}){const n=$({defaultValues:{...t}}),{control:a,handleSubmit:o}=n,{selectableBusinesses:r,fetching:u}=k(),{userContext:m}=h.useContext(R),c=l=>{l.fromDate?.trim()===""&&(l.fromDate=void 0),l.toDate?.trim()===""&&(l.toDate=void 0),s(l),i()};function d(){s({}),i()}return e.jsxs(e.Fragment,{children:[u?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(O,{...n,children:e.jsxs("form",{onSubmit:o(c),className:"space-y-2",children:[e.jsx(f,{name:"ownerIds",control:a,defaultValue:void 0,render:({field:l,fieldState:b})=>e.jsx(T,{...l,data:r,value:l.value??(m?.context.adminBusinessId?[m?.context.adminBusinessId]:void 0),disabled:u,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(f,{name:"businessIDs",control:a,defaultValue:void 0,render:({field:l,fieldState:b})=>e.jsx(T,{...l,data:r,value:l.value??void 0,disabled:u,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:b.error?.message})}),e.jsx(f,{name:"fromDate",control:a,defaultValue:t.fromDate,rules:{required:"Required",pattern:{value:S,message:"Date must be im format yyyy-mm-dd"}},render:({field:l,fieldState:b})=>e.jsx(C,{...l,onChange:x=>{const g=x?typeof x=="string"?x:F(x,"yyyy-MM-dd"):void 0;g!==l.value&&l.onChange(g)},value:l.value?new Date(l.value):void 0,label:"From Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(f,{name:"toDate",control:a,defaultValue:t.toDate,rules:{pattern:{value:S,message:"Date must be im format yyyy-mm-dd"}},render:({field:l,fieldState:b})=>e.jsx(C,{...l,onChange:x=>{const g=x?typeof x=="string"?x:F(x,"yyyy-MM-dd"):void 0;g!==l.value&&l.onChange(g)},value:l.value?new Date(l.value):void 0,label:"To Date",error:b.error?.message,required:!0,popoverProps:{withinPortal:!0}})}),e.jsx(E,{name:"isShowZeroedAccounts",control:a,render:({field:l})=>e.jsxs(A,{className:"flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(z,{children:"Show zeroed accounts"})}),e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(P,{children:e.jsx(M,{defaultChecked:t.isShowZeroedAccounts??!1,onCheckedChange:l.onChange,checked:l.value===!0})}),e.jsx("span",{children:l.value?"show":"remove"})]})]})}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:d,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:i,children:"Cancel"})]})]})})]})}function ae({filter:t,setFilter:s}){const[i,n]=h.useState(!1),[a,o]=h.useState(!D(t)),{get:r,set:u}=I();function m(d){return Object.entries(d??{}).filter(([b,x])=>x!==void 0&&Array.isArray(x)&&x.length>0).length>0}function c(d){L(d,t)||(s(d),o(m(d)))}return h.useEffect(()=>{const d=D(t)?null:encodeURIComponent(JSON.stringify(t)),l=r("trialBalanceReportFilters");d!==l&&u("trialBalanceReportFilters",d)},[t,r,u]),e.jsxs(e.Fragment,{children:[e.jsx(K,{opened:i,onClose:()=>n(!1),content:e.jsx(re,{filter:t,setFilter:c,closeModal:()=>n(!1)})}),e.jsx(N,{inline:!0,size:16,disabled:!a,children:e.jsx(y,{variant:"outline",onClick:()=>n(!0),className:"p-2",children:e.jsx(W,{size:20})})})]})}const ne=({data:t,fromDate:s,toDate:i})=>{const n=h.useCallback(async()=>{const a=oe(t),o=`trial_balance_report${s?`_${s}`:""}${i?`_${i}`:""}`;return{fileContent:a,fileName:o}},[t,s,i]);return e.jsx(X,{createFileVariables:n})},oe=t=>{let s="";s+=`Sort Code,Account Name,Debit,Credit,Balance\r
2
2
  `;for(const[i,n]of Object.entries(t)){const a=ie(i,n);s+=a}return s+=`Report total:,,${Object.values(t).reduce((i,n)=>i+n.totalDebit,0)},${Object.values(t).reduce((i,n)=>i+n.totalCredit,0)},${Object.values(t).reduce((i,n)=>i+n.sum,0)}\r
3
3
  `,s};function ie(t,s){let i="";return Object.values(s.sortCodes).sort((n,a)=>n.key-a.key).map(n=>{const a=le(n);i+=a}),i+=`${t.replaceAll("0","*")},Group Total:,${s.totalDebit??""},${s.totalCredit??""},${s.sum}\r
4
4
  `,i}function le(t){let s="";s+=`${t.name}\r
@@ -1 +1 @@
1
- import{r as a,u as y,dy as P,aJ as b,a6 as C,aK as S,j as e,D as O,aL as V,B as M,a3 as q,x as z,al as H,am as U,ao as K,ap as Q,aq as X,ar as $,as as J,w as I,dz as F,E as W,dA as Y,H as _,bK as G,V as Z,a2 as ee,bN as se,bO as te,bP as ae,bQ as E,bR as h,bS as ne,bT as x,ah as le,R as w,bU as re,bV as ce,a4 as oe,bW as ie,bX as ue,F as de,c as me}from"./index-D1_HHRLX.js";import{u as he,a as xe}from"./use-issue-monthly-documents-CdxtNiuP.js";import{s as A}from"./subMonths-nC9-M0qS.js";function fe({issueMonth:u,clients:r,onAdd:c}){const[j,o]=a.useState(!1),[f,d]=a.useState(""),[{data:m},n]=y({query:P,variables:{issueMonth:u,clientId:f},pause:!j}),p=a.useCallback(l=>{d(l),n()},[n,d]);return a.useEffect(()=>{f!==""&&m&&(c(b(C(S,m.clientMonthlyChargeDraft))),o(!1))},[f,m,c]),e.jsxs(O,{open:j,onOpenChange:o,children:[e.jsx(V,{asChild:!0,children:e.jsx(M,{variant:"outline",size:"icon",children:e.jsx(q,{})})}),e.jsxs(z,{className:"w-[400px] max-w-screen-md",children:[e.jsx(H,{children:e.jsx(U,{children:"Select document recipient"})}),e.jsxs(K,{onValueChange:p,children:[e.jsx(Q,{children:e.jsx(X,{placeholder:"Recipient"})}),e.jsx($,{children:r.map(l=>e.jsx(J,{value:l.id,children:l.name},l.id))})]})]})]})}const je=({drafts:u})=>{const[r,c]=a.useState(u.map(s=>b(C(S,s)))),j=I(A(new Date,1),"yyyy-MM-dd"),[o,f]=a.useState(j),[{data:d},m]=y({query:F,variables:{issueMonth:o},pause:!0});a.useEffect(()=>{d?.periodicalDocumentDrafts&&c(d.periodicalDocumentDrafts.map(s=>b(C(S,s))))},[d,c]),a.useEffect(()=>{m()},[o,m]);const n=W({values:{generateDocumentsInfo:r}}),{issueDocuments:p}=he(),[{data:l}]=y({query:Y}),{fields:v,append:k,remove:B,update:R}=_({control:n.control,name:"generateDocumentsInfo"}),T=n.watch("generateDocumentsInfo"),D=a.useMemo(()=>v.map((s,t)=>({...s,...T[t],id:s.client?.id})),[v,T]),N=a.useCallback(s=>{p(s)},[p]),L=a.useMemo(()=>l?.allOpenContracts.filter(s=>s.billingCycle===G.Monthly&&!D.some(t=>t.client?.id===s.client.id)),[D,l]);return e.jsx("div",{className:"p-2",children:e.jsx(Z,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(N),children:[e.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[e.jsx(ee,{children:"Issue Month:"}),e.jsx(se,{value:new Date(o),onChange:s=>{const t=new Date(s.getFullYear(),s.getMonth(),15);f(I(t,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}})]}),e.jsxs(te,{children:[e.jsx(ae,{children:e.jsxs(E,{children:[e.jsx(h,{children:"Name"}),e.jsx(h,{children:"Document"}),e.jsx(h,{children:"Amount"}),e.jsx(h,{children:"Remark"}),e.jsx(h,{children:"Recipients"}),e.jsx(h,{})]})}),e.jsx(ne,{children:D.map(({id:s,...t},g)=>e.jsxs(E,{children:[e.jsx(x,{children:e.jsx(le,{to:s?w.BUSINESSES.DETAIL(s):w.BUSINESSES.ALL,target:"_blank",rel:"noreferrer",onClick:i=>i.stopPropagation(),className:"inline-flex items-center font-semibold",children:t.client?.name})}),e.jsx(x,{children:t.type}),e.jsxs(x,{children:[t.income?.[0]?.price," ",t.income?.[0]?.currency]}),e.jsx(x,{children:e.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:t.remarks})}),e.jsx(x,{children:e.jsx("div",{className:"flex flex-col",children:t.client?.emails?.map(i=>e.jsx("span",{className:"text-sm text-gray-500",children:i},i))})}),e.jsx(x,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(re,{children:[e.jsx(ce,{asChild:!0,type:"button",children:e.jsx(M,{className:"size-7.5",variant:"secondary",onClick:()=>B(g),children:e.jsx(oe,{size:16})})}),e.jsx(ie,{children:e.jsx("p",{children:"Remove document"})})]}),e.jsx(xe,{draft:t,onApprove:i=>{n.setValue(`generateDocumentsInfo.${g}`,i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),R(g,{...i})}})]})})]},s))})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsx(fe,{clients:L?.map(s=>({id:s.client.originalBusiness.id,name:s.client.originalBusiness.name}))??[],onAdd:k,issueMonth:o}),e.jsx(ue,{onConfirm:n.handleSubmit(N),title:`Are you sure you want to issue ${D.length} documents?`,children:e.jsx(M,{children:"Issue"})})]})]})})})},ge=()=>{const{setFiltersContext:u}=a.useContext(de),[{data:r,fetching:c}]=y({query:F,variables:{issueMonth:I(A(new Date,1),"yyyy-MM-dd")}});return a.useEffect(()=>{r?.periodicalDocumentDrafts||u(null)},[r,u]),c?e.jsx(me,{}):e.jsx(je,{drafts:r?.periodicalDocumentDrafts??[]})};export{ge as IssueDocuments};
1
+ import{r as a,u as y,dy as P,aJ as b,a6 as C,aK as S,j as e,D as O,aL as V,B as M,a3 as q,x as z,al as H,am as U,ao as K,ap as Q,aq as X,ar as $,as as J,w as I,dz as F,E as W,dA as Y,H as _,bK as G,V as Z,a2 as ee,bN as se,bO as te,bP as ae,bQ as E,bR as h,bS as ne,bT as x,ah as le,R as w,bU as re,bV as ce,a4 as oe,bW as ie,bX as ue,F as de,c as me}from"./index-rI994S3C.js";import{u as he,a as xe}from"./use-issue-monthly-documents-D9vQpbaZ.js";import{s as A}from"./subMonths-DY4HlBVa.js";function fe({issueMonth:u,clients:r,onAdd:c}){const[j,o]=a.useState(!1),[f,d]=a.useState(""),[{data:m},n]=y({query:P,variables:{issueMonth:u,clientId:f},pause:!j}),p=a.useCallback(l=>{d(l),n()},[n,d]);return a.useEffect(()=>{f!==""&&m&&(c(b(C(S,m.clientMonthlyChargeDraft))),o(!1))},[f,m,c]),e.jsxs(O,{open:j,onOpenChange:o,children:[e.jsx(V,{asChild:!0,children:e.jsx(M,{variant:"outline",size:"icon",children:e.jsx(q,{})})}),e.jsxs(z,{className:"w-[400px] max-w-screen-md",children:[e.jsx(H,{children:e.jsx(U,{children:"Select document recipient"})}),e.jsxs(K,{onValueChange:p,children:[e.jsx(Q,{children:e.jsx(X,{placeholder:"Recipient"})}),e.jsx($,{children:r.map(l=>e.jsx(J,{value:l.id,children:l.name},l.id))})]})]})]})}const je=({drafts:u})=>{const[r,c]=a.useState(u.map(s=>b(C(S,s)))),j=I(A(new Date,1),"yyyy-MM-dd"),[o,f]=a.useState(j),[{data:d},m]=y({query:F,variables:{issueMonth:o},pause:!0});a.useEffect(()=>{d?.periodicalDocumentDrafts&&c(d.periodicalDocumentDrafts.map(s=>b(C(S,s))))},[d,c]),a.useEffect(()=>{m()},[o,m]);const n=W({values:{generateDocumentsInfo:r}}),{issueDocuments:p}=he(),[{data:l}]=y({query:Y}),{fields:v,append:k,remove:B,update:R}=_({control:n.control,name:"generateDocumentsInfo"}),T=n.watch("generateDocumentsInfo"),D=a.useMemo(()=>v.map((s,t)=>({...s,...T[t],id:s.client?.id})),[v,T]),N=a.useCallback(s=>{p(s)},[p]),L=a.useMemo(()=>l?.allOpenContracts.filter(s=>s.billingCycle===G.Monthly&&!D.some(t=>t.client?.id===s.client.id)),[D,l]);return e.jsx("div",{className:"p-2",children:e.jsx(Z,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(N),children:[e.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[e.jsx(ee,{children:"Issue Month:"}),e.jsx(se,{value:new Date(o),onChange:s=>{const t=new Date(s.getFullYear(),s.getMonth(),15);f(I(t,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}})]}),e.jsxs(te,{children:[e.jsx(ae,{children:e.jsxs(E,{children:[e.jsx(h,{children:"Name"}),e.jsx(h,{children:"Document"}),e.jsx(h,{children:"Amount"}),e.jsx(h,{children:"Remark"}),e.jsx(h,{children:"Recipients"}),e.jsx(h,{})]})}),e.jsx(ne,{children:D.map(({id:s,...t},g)=>e.jsxs(E,{children:[e.jsx(x,{children:e.jsx(le,{to:s?w.BUSINESSES.DETAIL(s):w.BUSINESSES.ALL,target:"_blank",rel:"noreferrer",onClick:i=>i.stopPropagation(),className:"inline-flex items-center font-semibold",children:t.client?.name})}),e.jsx(x,{children:t.type}),e.jsxs(x,{children:[t.income?.[0]?.price," ",t.income?.[0]?.currency]}),e.jsx(x,{children:e.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:t.remarks})}),e.jsx(x,{children:e.jsx("div",{className:"flex flex-col",children:t.client?.emails?.map(i=>e.jsx("span",{className:"text-sm text-gray-500",children:i},i))})}),e.jsx(x,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(re,{children:[e.jsx(ce,{asChild:!0,type:"button",children:e.jsx(M,{className:"size-7.5",variant:"secondary",onClick:()=>B(g),children:e.jsx(oe,{size:16})})}),e.jsx(ie,{children:e.jsx("p",{children:"Remove document"})})]}),e.jsx(xe,{draft:t,onApprove:i=>{n.setValue(`generateDocumentsInfo.${g}`,i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),R(g,{...i})}})]})})]},s))})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsx(fe,{clients:L?.map(s=>({id:s.client.originalBusiness.id,name:s.client.originalBusiness.name}))??[],onAdd:k,issueMonth:o}),e.jsx(ue,{onConfirm:n.handleSubmit(N),title:`Are you sure you want to issue ${D.length} documents?`,children:e.jsx(M,{children:"Issue"})})]})]})})})},ge=()=>{const{setFiltersContext:u}=a.useContext(de),[{data:r,fetching:c}]=y({query:F,variables:{issueMonth:I(A(new Date,1),"yyyy-MM-dd")}});return a.useEffect(()=>{r?.periodicalDocumentDrafts||u(null)},[r,u]),c?e.jsx(me,{}):e.jsx(je,{drafts:r?.periodicalDocumentDrafts??[]})};export{ge as IssueDocuments};
@@ -1 +1 @@
1
- import{g as T,i5 as N,r as u,t as l,i as f,E as y,j as e,V as b,eL as C,Y as $,Z as D,_ as F,$ as w,I as j,a1 as k,i6 as E,a6 as v,i7 as A,a9 as S,l as z,T as L,B as p,ag as M,n as O,i8 as P,i9 as B,F as q,u as _,ia as U,L as V,co as R,cp as G,ib as Q}from"./index-D1_HHRLX.js";import{P as Y}from"./page-layout-BOjYoqoi.js";const Z="updateTag",H=()=>{const[{fetching:c},r]=T(N),i=u.useCallback(async t=>{const a=`Error updating tag ID [${t.tagId}]`,s=`${Z}-${t.tagId}`;l.loading("Updating Tag...",{id:s});try{const n=await r(t),d=f(n,a,s,"updateTag");if(d)return l.success("Success",{id:s,description:"Tag updated"}),d.updateTag}catch(n){console.error(`${a}: ${n}`),l.error("Error",{id:s,description:a,duration:1e5,closeButton:!0})}return!1},[r]);return{fetching:c,updateTag:i}},J=({onDone:c,data:r,close:i})=>{const{updateTag:t,fetching:a}=H(),s=v(A,r),n=y({defaultValues:{name:s.name,parentId:s.parent?.id}}),{control:d,handleSubmit:m,formState:{dirtyFields:h}}=n,x=o=>{const g=S(o,h);i(),g&&Object.keys(g).length>0&&t({tagId:s.id,fields:g}).then(()=>c?.())};return e.jsx(b,{...n,children:e.jsxs("form",{onSubmit:m(x),children:[e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsxs(C,{cols:3,children:[e.jsx($,{name:"name",control:d,defaultValue:s.name,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o})=>e.jsxs(D,{children:[e.jsx(F,{children:"Name"}),e.jsx(w,{children:e.jsx(j,{...o,value:o.value??void 0})}),e.jsx(k,{})]})}),e.jsx(E,{formManager:n,tagsPath:"parentId",label:"Parent Tag"})]})}),e.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[e.jsx("button",{type:"submit",onClick:()=>m(x),className:"mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",disabled:a||Object.keys(h).length===0,children:"Accept"}),e.jsx("button",{type:"button",className:"mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:i,children:"Cancel"})]})]})})},K=({onDone:c,data:r})=>{const[i,{open:t,close:a}]=z(!1);function s(){a(),c?.()}return e.jsxs(e.Fragment,{children:[e.jsx(L,{content:"Edit Tag",children:e.jsx(p,{variant:"ghost",size:"icon",className:"size-7.5",onClick:t,children:e.jsx(M,{className:"size-5"})})}),e.jsx(O,{centered:!0,opened:i,onClose:a,title:"Insert Business Trip",children:e.jsx(J,{close:a,onDone:s,data:r})})]})},W="addTag",X=()=>{const[{fetching:c},r]=T(P),i=u.useCallback(async t=>{const a=`Error adding new tag [${t.tagName}]`,s=`${W}-${t.tagName}`;l.loading("Adding tag",{id:s});try{const n=await r(t);f(n,a,s)&&l.success("Success",{id:s,description:`"${t.tagName}" tag was successfully added`})}catch(n){console.error(`${a}: ${n}`),l.error("Error",{id:s,description:a,duration:1e5,closeButton:!0})}},[r]);return{fetching:c,addTag:i}},ee="deleteTag",se=()=>{const[{fetching:c},r]=T(B),i=u.useCallback(async t=>{const a=`Error deleting new tag [${t.name}]`,s=`${ee}-${t.tagId}`;l.loading(`Deleting tag [${t.name}]`,{id:s});try{const n=await r(t);f(n,a,s)&&l.success("Tag Deleted",{id:s,description:`[${t.name}] tag was successfully removed`})}catch(n){console.error(`${a}: ${n}`),l.error("Error",{id:s,description:a,duration:1e5,closeButton:!0})}},[r]);return{fetching:c,deleteTag:i}},ne=()=>{const{setFiltersContext:c}=u.useContext(q),[r,i]=u.useState(""),[{data:t,fetching:a},s]=_({query:Q}),{addTag:n}=X(),{deleteTag:d}=se();u.useEffect(()=>{c(null)},[c]);const m=U(t?.allTags??[]),h=u.useCallback(o=>{o.length>2&&n({tagName:o}).then(()=>{s()})},[n,s]),x=u.useCallback((o,g)=>{d({tagId:o,name:g}).then(()=>{s()})},[d,s]);return e.jsx(Y,{title:"Tags",description:"Manage tags for your bookmarks.",children:a?e.jsx(V,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[m?.map(o=>e.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-2",children:[e.jsxs("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:[o.namePath?.map((g,I)=>e.jsx("span",{className:"ms-2"},I)),o.name]}),e.jsx(K,{data:o}),e.jsx(p,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>x(o.id,o.name),children:e.jsx(R,{className:"size-5"})})]},o.id)),e.jsxs("div",{className:"flex justify-start items-center gap-2 text-gray-600 mb-2",children:[e.jsx(j,{className:"w-80",value:r,onChange:o=>i(o.currentTarget.value),placeholder:"Add new tag",required:!0}),e.jsx(p,{variant:"ghost",size:"icon",className:"size-7.5",disabled:r.length<2,onClick:()=>h(r),children:e.jsx(G,{className:"size-5"})})]})]})})};export{ne as TagsManager};
1
+ import{g as T,i5 as N,r as u,t as l,i as f,E as y,j as e,V as b,eL as C,Y as $,Z as D,_ as F,$ as w,I as j,a1 as k,i6 as E,a6 as v,i7 as A,a9 as S,l as z,T as L,B as p,ag as M,n as O,i8 as P,i9 as B,F as q,u as _,ia as U,L as V,co as R,cp as G,ib as Q}from"./index-rI994S3C.js";import{P as Y}from"./page-layout-DMGj5xhW.js";const Z="updateTag",H=()=>{const[{fetching:c},r]=T(N),i=u.useCallback(async t=>{const a=`Error updating tag ID [${t.tagId}]`,s=`${Z}-${t.tagId}`;l.loading("Updating Tag...",{id:s});try{const n=await r(t),d=f(n,a,s,"updateTag");if(d)return l.success("Success",{id:s,description:"Tag updated"}),d.updateTag}catch(n){console.error(`${a}: ${n}`),l.error("Error",{id:s,description:a,duration:1e5,closeButton:!0})}return!1},[r]);return{fetching:c,updateTag:i}},J=({onDone:c,data:r,close:i})=>{const{updateTag:t,fetching:a}=H(),s=v(A,r),n=y({defaultValues:{name:s.name,parentId:s.parent?.id}}),{control:d,handleSubmit:m,formState:{dirtyFields:h}}=n,x=o=>{const g=S(o,h);i(),g&&Object.keys(g).length>0&&t({tagId:s.id,fields:g}).then(()=>c?.())};return e.jsx(b,{...n,children:e.jsxs("form",{onSubmit:m(x),children:[e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsxs(C,{cols:3,children:[e.jsx($,{name:"name",control:d,defaultValue:s.name,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o})=>e.jsxs(D,{children:[e.jsx(F,{children:"Name"}),e.jsx(w,{children:e.jsx(j,{...o,value:o.value??void 0})}),e.jsx(k,{})]})}),e.jsx(E,{formManager:n,tagsPath:"parentId",label:"Parent Tag"})]})}),e.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[e.jsx("button",{type:"submit",onClick:()=>m(x),className:"mt-8 text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",disabled:a||Object.keys(h).length===0,children:"Accept"}),e.jsx("button",{type:"button",className:"mt-8 text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:i,children:"Cancel"})]})]})})},K=({onDone:c,data:r})=>{const[i,{open:t,close:a}]=z(!1);function s(){a(),c?.()}return e.jsxs(e.Fragment,{children:[e.jsx(L,{content:"Edit Tag",children:e.jsx(p,{variant:"ghost",size:"icon",className:"size-7.5",onClick:t,children:e.jsx(M,{className:"size-5"})})}),e.jsx(O,{centered:!0,opened:i,onClose:a,title:"Insert Business Trip",children:e.jsx(J,{close:a,onDone:s,data:r})})]})},W="addTag",X=()=>{const[{fetching:c},r]=T(P),i=u.useCallback(async t=>{const a=`Error adding new tag [${t.tagName}]`,s=`${W}-${t.tagName}`;l.loading("Adding tag",{id:s});try{const n=await r(t);f(n,a,s)&&l.success("Success",{id:s,description:`"${t.tagName}" tag was successfully added`})}catch(n){console.error(`${a}: ${n}`),l.error("Error",{id:s,description:a,duration:1e5,closeButton:!0})}},[r]);return{fetching:c,addTag:i}},ee="deleteTag",se=()=>{const[{fetching:c},r]=T(B),i=u.useCallback(async t=>{const a=`Error deleting new tag [${t.name}]`,s=`${ee}-${t.tagId}`;l.loading(`Deleting tag [${t.name}]`,{id:s});try{const n=await r(t);f(n,a,s)&&l.success("Tag Deleted",{id:s,description:`[${t.name}] tag was successfully removed`})}catch(n){console.error(`${a}: ${n}`),l.error("Error",{id:s,description:a,duration:1e5,closeButton:!0})}},[r]);return{fetching:c,deleteTag:i}},ne=()=>{const{setFiltersContext:c}=u.useContext(q),[r,i]=u.useState(""),[{data:t,fetching:a},s]=_({query:Q}),{addTag:n}=X(),{deleteTag:d}=se();u.useEffect(()=>{c(null)},[c]);const m=U(t?.allTags??[]),h=u.useCallback(o=>{o.length>2&&n({tagName:o}).then(()=>{s()})},[n,s]),x=u.useCallback((o,g)=>{d({tagId:o,name:g}).then(()=>{s()})},[d,s]);return e.jsx(Y,{title:"Tags",description:"Manage tags for your bookmarks.",children:a?e.jsx(V,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[m?.map(o=>e.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-2",children:[e.jsxs("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:[o.namePath?.map((g,I)=>e.jsx("span",{className:"ms-2"},I)),o.name]}),e.jsx(K,{data:o}),e.jsx(p,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>x(o.id,o.name),children:e.jsx(R,{className:"size-5"})})]},o.id)),e.jsxs("div",{className:"flex justify-start items-center gap-2 text-gray-600 mb-2",children:[e.jsx(j,{className:"w-80",value:r,onChange:o=>i(o.currentTarget.value),placeholder:"Add new tag",required:!0}),e.jsx(p,{variant:"ghost",size:"icon",className:"size-7.5",disabled:r.length<2,onClick:()=>h(r),children:e.jsx(G,{className:"size-5"})})]})]})})};export{ne as TagsManager};