@accounter/client 0.0.9-alpha-20260104192330-5023f4398b22d4c0c52b68b62c7a290e03de417e → 0.0.9-alpha-20260104194509-1bbd863eb3e889196f321663613c729992d236b4

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 (90) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/assets/{Checkbox-D1EYx-2R.js → Checkbox-Bqh8Rs3Y.js} +1 -1
  3. package/dist/assets/{MultiSelect-BYC23mXC.js → MultiSelect-BLtBUfDG.js} +1 -1
  4. package/dist/assets/{Progress-Bgh_hdHE.js → Progress-zdcZiq7-.js} +1 -1
  5. package/dist/assets/{Table-BPmZ5ljQ.js → Table-LzLjpZeA.js} +1 -1
  6. package/dist/assets/{Typography-IFt-aKsY.js → Typography-DemEN63p.js} +1 -1
  7. package/dist/assets/{YearPickerInput-DXpznBXd.js → YearPickerInput-wefUMrNX.js} +1 -1
  8. package/dist/assets/{accordion-DjXOBlUF.js → accordion-DY8sNVhh.js} +1 -1
  9. package/dist/assets/{accountant-approvals-Ddg6bDMn.js → accountant-approvals-DtBIRZC5.js} +1 -1
  10. package/dist/assets/{accounter-table-Cg2u2Bcd.js → accounter-table-pB9Clv36.js} +1 -1
  11. package/dist/assets/{addDays-CIRVLi_y.js → addDays-z7yxKvSG.js} +1 -1
  12. package/dist/assets/{all-charges-B53ChbBw.js → all-charges-BqRr5A4S.js} +1 -1
  13. package/dist/assets/{arrow-up-down-BMWCHusr.js → arrow-up-down-DB7wmydC.js} +1 -1
  14. package/dist/assets/{building-2-DvOC_0Kc.js → building-2-BUBxSuvf.js} +1 -1
  15. package/dist/assets/{business-C6EHWbDo.js → business-B33OdXng.js} +1 -1
  16. package/dist/assets/{business-extended-info-zo9fuTOe.js → business-extended-info-C3BaFkvQ.js} +1 -1
  17. package/dist/assets/{business-header-KFCqFju_.js → business-header-DH34C-UW.js} +1 -1
  18. package/dist/assets/{business-ledger-filters-CmCpp7PJ.js → business-ledger-filters-C_W4Kia6.js} +1 -1
  19. package/dist/assets/{business-ledger-single-DZyFn40E.js → business-ledger-single-CLw2fXXF.js} +1 -1
  20. package/dist/assets/{business-trip-Beo5bB1g.js → business-trip-BDIbjeVM.js} +1 -1
  21. package/dist/assets/{charge-Cvrsuvam.js → charge-BZqb4exj.js} +1 -1
  22. package/dist/assets/{charges-filters-BcdlXxSE.js → charges-filters-f-jBUxw-.js} +1 -1
  23. package/dist/assets/{charges-ledger-validation-K5bGVbfd.js → charges-ledger-validation-vQXFL31X.js} +1 -1
  24. package/dist/assets/{charges-table-BE8zAChh.js → charges-table-CYqBhSR-.js} +3 -3
  25. package/dist/assets/{chart-DyrsWjc9.js → chart-D-802gvL.js} +1 -1
  26. package/dist/assets/{contracts-CjRjQCRY.js → contracts-40v4c5wb.js} +1 -1
  27. package/dist/assets/{data-table-column-header-BN5-dHgb.js → data-table-column-header-RVA6DnfK.js} +1 -1
  28. package/dist/assets/{data-table-pagination-Dncu-pMI.js → data-table-pagination-UNpJ4XY4.js} +1 -1
  29. package/dist/assets/{deposits-transactions-table-D3Sw0OgH.js → deposits-transactions-table-CcCuygQV.js} +1 -1
  30. package/dist/assets/{download-csv-button-BzrwomIw.js → download-csv-button-C_FDbZVI.js} +1 -1
  31. package/dist/assets/{editable-business-trip-TNouMmtc.js → editable-business-trip-D7udcq6I.js} +1 -1
  32. package/dist/assets/{eye-off-Ct63cJU6.js → eye-off-A1glr3Lh.js} +1 -1
  33. package/dist/assets/{funnel-BpdROO69.js → funnel-BFG62oJX.js} +1 -1
  34. package/dist/assets/{index-B3P9rJGf.js → index-BANZ4FYC.js} +1 -1
  35. package/dist/assets/{index-CNNawG6D.js → index-BWAOW53d.js} +4 -4
  36. package/dist/assets/{index-CAoIWd0f.js → index-BXi4oDGN.js} +1 -1
  37. package/dist/assets/{index-fvfqfHgx.js → index-BhoUb_ON.js} +1 -1
  38. package/dist/assets/{index-VOgo1b_w.js → index-Bk6qb18g.js} +1 -1
  39. package/dist/assets/{index-DfyBVta3.js → index-BlXqh5bw.js} +1 -1
  40. package/dist/assets/{index-D0OFipbT.js → index-Bps1VY5w.js} +1 -1
  41. package/dist/assets/{index-BvqzqML_.js → index-CR08bGyj.js} +1 -1
  42. package/dist/assets/{index-i7Yf0n3Q.js → index-CV3eOseE.js} +1 -1
  43. package/dist/assets/{index-B4XWvHSY.js → index-C_D1SRFk.js} +1 -1
  44. package/dist/assets/{index-DDqBw1FZ.js → index-CcCOZohd.js} +1 -1
  45. package/dist/assets/{index-BgpzfaeJ.js → index-Clz8I9dK.js} +1 -1
  46. package/dist/assets/{index-CJ5SOHQ0.js → index-Cwq6ofsb.js} +1 -1
  47. package/dist/assets/{index-sl9J9RIm.js → index-DJDErZF_.js} +1 -1
  48. package/dist/assets/{index-1q5Bty_H.js → index-DLnIlpCq.js} +1 -1
  49. package/dist/assets/{index-DCrzzRDf.js → index-DhMdXJus.js} +1 -1
  50. package/dist/assets/{index-DWeUM89g.js → index-Djgjvx0H.js} +1 -1
  51. package/dist/assets/{index-C6PQh6Al.js → index-DqYn-i8w.js} +1 -1
  52. package/dist/assets/{index-lbcY8WB_.js → index-HOYMUDFE.js} +1 -1
  53. package/dist/assets/{index-LWqbIc1T.js → index-_JHX2B8O.js} +1 -1
  54. package/dist/assets/{index-CIRmhdDG.js → index-_kREhIPr.js} +1 -1
  55. package/dist/assets/{index-ComDmMDN.js → index-b-MiIoC6.js} +1 -1
  56. package/dist/assets/{index-Bpv_EQpT.js → index-hOl2Gwvk.js} +1 -1
  57. package/dist/assets/{index-CIoirABN.js → index-iu4sjTwc.js} +1 -1
  58. package/dist/assets/{index-Cs_wIQni.js → index-nugs82ok.js} +1 -1
  59. package/dist/assets/{index-D4AHtEfm.js → index-qqIdqRd-.js} +1 -1
  60. package/dist/assets/{index.es-BB65ERNg.js → index.es-DTX7vrgg.js} +1 -1
  61. package/dist/assets/{insert-business-trip-modal-CLVLw7m4.js → insert-business-trip-modal-C4MiJk_g.js} +1 -1
  62. package/dist/assets/issue-document-DlLf2ULj.js +1 -0
  63. package/dist/assets/{list-plus-wSEH8ky8.js → list-plus-C0XPnNVe.js} +1 -1
  64. package/dist/assets/{login-page-CQJsxqwG.js → login-page-Ck5nqn-L.js} +1 -1
  65. package/dist/assets/{match-document-modal-BVyNTaxu.js → match-document-modal-B8E3M5F6.js} +1 -1
  66. package/dist/assets/{missing-info-charges-DJbVpU3F.js → missing-info-charges-DGgTFt-D.js} +1 -1
  67. package/dist/assets/{modal-BghEq_eS.js → modal-DGBtDZun.js} +1 -1
  68. package/dist/assets/{modify-contract-dialog-DP5g5ngT.js → modify-contract-dialog-BoLoZhIr.js} +1 -1
  69. package/dist/assets/{page-layout-Dne17xLZ.js → page-layout-Ck_xKyt0.js} +1 -1
  70. package/dist/assets/{page-not-found-BoSNUBMS.js → page-not-found-BTbs3XmD.js} +1 -1
  71. package/dist/assets/{panel-top-open-muCAuRMw.js → panel-top-open-EMjzc-ww.js} +1 -1
  72. package/dist/assets/{report-commentary-row-Ch8YqjGk.js → report-commentary-row-C0J-6IpH.js} +1 -1
  73. package/dist/assets/{save-CY8EeuE7.js → save-BMNpevK9.js} +1 -1
  74. package/dist/assets/{similar-transactions-modal-vucNNAQ7.js → similar-transactions-modal--yMHokZr.js} +1 -1
  75. package/dist/assets/{sub-CjP3ABDx.js → sub-B9GwcGJi.js} +1 -1
  76. package/dist/assets/subMonths-KzuARV4a.js +1 -0
  77. package/dist/assets/{summary-CoPnqTel.js → summary-BU7IrLve.js} +1 -1
  78. package/dist/assets/{toggle-expansion-button-wmsjVpKZ.js → toggle-expansion-button-wXVsrHLI.js} +1 -1
  79. package/dist/assets/{use-issue-monthly-documents-CP0FLnjj.js → use-issue-monthly-documents-DEVr0ix_.js} +1 -1
  80. package/dist/assets/{use-url-query-D4K72DMD.js → use-url-query-DG-wQ19o.js} +1 -1
  81. package/dist/index.html +1 -1
  82. package/package.json +1 -1
  83. package/src/components/charges/charge-extended-info.tsx +11 -14
  84. package/src/components/documents-table/cells/creditor.tsx +1 -1
  85. package/src/components/documents-table/cells/debtor.tsx +1 -1
  86. package/src/components/documents-table/cells/description.tsx +1 -1
  87. package/src/components/documents-table/cells/remarks.tsx +1 -1
  88. package/src/components/documents-table/cells/type.tsx +1 -1
  89. package/dist/assets/issue-document-8tNe2T1W.js +0 -1
  90. package/dist/assets/subMonths-I2NCK3sY.js +0 -1
@@ -1 +1 @@
1
- import{v as B,bC as ce,r as g,z as X,b2 as de,u as L,em as me,t as S,en as ue,j as e,V as ee,eo as se,Y as D,Z as k,_ as w,$ as M,I as xe,a1 as he,bD as N,bG as E,at as I,a9 as fe,g as ge,ep as pe,i as je,eq as be,ay as ve,ca as ye,H as te,w as ne,cn as we,B as C,co as ae,b4 as Ne,b5 as Ce,er as De,es as $,d as ke,et as q,R,aO as P,dt as Me,G as Y,eu as Ie,ev as Se,ew as Te,ex as Fe,c as Ae}from"./index-CNNawG6D.js";import{c as Oe,d as Ee,e as W}from"./charges-table-BE8zAChh.js";import{Y as ze}from"./YearPickerInput-DXpznBXd.js";import{L as re}from"./list-plus-wSEH8ky8.js";import{I as Be}from"./insert-business-trip-modal-CLVLw7m4.js";import{a as Le}from"./accounter-table-Cg2u2Bcd.js";import{P as $e}from"./modal-BghEq_eS.js";const qe=[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]],Z=B("barcode",qe);const Re=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Q=B("bookmark",Re);const Ve=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],J=B("file-question-mark",Ve),z=s=>{const a=s.length,n=s.reduce((r,o)=>r+o)/a;return Math.sqrt(s.map(r=>Math.pow(r-n,2)).reduce((r,o)=>r+o)/a)},K=(s,a)=>{if(!s||!a)return 0;let n=0;const r=s.replace(/[^a-zA-Z0-9]/g,"").toLowerCase(),o=a.replace(/[^a-zA-Z0-9]/g,"").toLowerCase();for(let t=0;t<r.length;t++){let d=0;for(let i=0;i<o.length;i++)r[t+i]===o[i]?d+=1:(d>n&&(n=d),d=0);d>n&&(n=d),d=0}return n},_e=(s,a)=>{const n={providerIdents:{},dateDiffs:{},amountDiffs:{}};for(const i of a){const u=new Date(s.transactions[0].eventDate).getTime()-new Date(i.date).getTime();n.dateDiffs[s.id]=Math.abs(u);const p=(s.totalAmount?.raw??0)-i.amount.raw;n.amountDiffs[s.id]=Math.abs(p);const f=K(i.creditor?.name??"",s.counterparty?.name??""),x=K(i.creditor?.name??"",s.transactions[0].sourceDescription);n.providerIdents[s.id]=f>x?f:x}const r=z(Object.values(n.providerIdents)),o=z(Object.values(n.dateDiffs)),t=z(Object.values(n.amountDiffs)),d=[];for(const i of a){let u=0;u=(o?Math.abs((n.dateDiffs[s.id]-Math.min(...Object.values(n.dateDiffs)))/o):0)+(t?Math.abs((n.amountDiffs[s.id]-Math.min(...Object.values(n.amountDiffs)))/t):0)+(r?(Math.max(...Object.values(n.providerIdents))-Math.abs(n.providerIdents[s.id]))/r:0),d.push({score:u,document:i})}return d.sort((i,u)=>i.score>u.score?1:i.score<u.score?-1:0),d},Ge=({charge:s,close:a,onChange:n})=>{const{updateCharge:r,fetching:o}=Oe(),{selectableBusinesses:t,fetching:d}=ce(),[i,u]=g.useState([]),[p,f]=g.useState(!1),[x,m]=g.useState(void 0),b=X({defaultValues:{...s,yearsOfRelevance:s.yearsOfRelevance?.map(c=>({year:c.year,amount:c.amount})).sort((c,h)=>c.year>h.year?1:-1)}}),{control:l,handleSubmit:j,formState:{dirtyFields:y}}=b,T=async c=>{if(!s)return;const h=fe(c,y);if(h&&Object.keys(h).length>0)if(await r({chargeId:s.id,fields:{...h,yearsOfRelevance:c.yearsOfRelevance?Object.values(c.yearsOfRelevance):void 0}}),h.tags?.length||h.userDescription){const G={};if(h.tags){const oe=s.missingInfoSuggestions?.tags??[],U=new Set(oe.map(v=>v.id)),H=new Set(h.tags.map(v=>v.id));(U.size!==H.size||[...U].some(v=>!H.has(v)))&&(G.tagIds=h.tags.map(v=>({id:v.id})))}m(G),f(!0)}else a(),n?.()},{selectableTaxCategories:F,fetching:A}=de(),[{data:O,fetching:le,error:V},_]=L({query:me}),ie=g.useCallback(()=>{_()},[_]);return g.useEffect(()=>{V&&S.error("Error",{description:"An error occurred while fetching business trips."})},[V]),g.useEffect(()=>{O?.allBusinessTrips.length&&u([...O.allBusinessTrips.map(c=>({value:c.id,label:c.name})).sort((c,h)=>c.label>h.label?1:-1),{value:ue,label:"None"}])},[O,u]),e.jsxs(e.Fragment,{children:[e.jsx(ee,{...b,children:e.jsxs("form",{onSubmit:j(T),children:[e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsxs(se,{cols:3,children:[e.jsx(D,{name:"userDescription",control:l,defaultValue:s.userDescription,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:c})=>e.jsxs(k,{children:[e.jsx(w,{children:"Description"}),e.jsx(M,{children:e.jsx(xe,{...c,value:c.value??void 0})}),e.jsx(he,{})]})}),e.jsx(N,{name:"ownerId",control:l,defaultValue:s.owner?.id,rules:{required:"Required",minLength:{value:2,message:"Minimum 2 characters"}},render:({field:c,fieldState:h})=>e.jsx(E,{...c,data:t,value:c.value,disabled:d,label:"Owner",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:h.error?.message})}),e.jsx(N,{name:"defaultTaxCategoryID",control:l,defaultValue:s.taxCategory?.id,render:({field:c,fieldState:h})=>e.jsx(E,{...c,data:F,value:c.value,disabled:A,label:"Tax Category Override",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:h.error?.message})}),e.jsx(N,{name:"businessTripID",control:l,defaultValue:"businessTrip"in s?s.businessTrip?.id:void 0,render:({field:c,fieldState:h})=>e.jsx(E,{...c,data:i,value:c.value,disabled:le,label:"Business Trip",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:h.error?.message,rightSection:e.jsx(Be,{onDone:ie})})}),e.jsx(We,{formManager:b,tagsPath:"tags"}),e.jsx(D,{name:"isConversion",control:l,defaultValue:s.conversion,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Is Conversion"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(D,{name:"isInvoicePaymentDifferentCurrency",control:l,defaultValue:s.isInvoicePaymentDifferentCurrency,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Is Invoice-Payment currency difference"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(D,{name:"optionalVAT",control:l,defaultValue:s.optionalVAT??!1,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Optional VAT"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(D,{name:"optionalDocuments",control:l,defaultValue:s.optionalDocuments??!1,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Optional Documents"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(Ye,{formManager:b,chargeSpreadPath:"yearsOfRelevance"})]})}),e.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[e.jsx("button",{type:"submit",onClick:()=>j(T),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:o||Object.keys(y).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:a,children:"Cancel"})]})]})}),e.jsx(Ee,{chargeId:s.id,tagIds:x?.tagIds,description:x?.description,open:p,onOpenChange:f,onClose:()=>{a(),n?.()},showChargesWithExistingSuggestions:!0})]})},Ue="insertDocument",He=()=>{const[{fetching:s},a]=ge(pe),n=g.useCallback(async r=>{const o=`Error inserting document to charge ID [${r.record.chargeId}]`,t=Ue;S.loading("Adding document",{id:t});try{const d=await a(r),i=je(d,o,t,"insertDocument");if(i)return S.success("Success",{id:t,description:"Document added"}),i.insertDocument}catch(d){console.error(`${o}: ${d}`),S.error("Error",{id:t,description:o,duration:1e5,closeButton:!0})}},[a]);return{fetching:s,insertDocument:n}},Pe=({chargeId:s,onChange:a,closeModal:n})=>{const r=X(),{handleSubmit:o,formState:{dirtyFields:t},setValue:d,watch:i}=r,{insertDocument:u,fetching:p}=He(),f=m=>{if(m&&Object.keys(m).length>0){if(m.vat){if(!m.amount?.currency){S.error("Error",{description:"Couldn't figure out the currency of the document"});return}m.vat.currency=m.amount.currency}m.documentType??=ye.Unprocessed,u({record:{...m,chargeId:s}}).then(()=>a?.()),n?.()}},x=i("amount.currency");return g.useEffect(()=>{d("vat.currency",x)},[d,x]),e.jsx("div",{className:"px-5 w-max h-max justify-items-center",children:e.jsx(ee,{...r,children:e.jsxs("form",{onSubmit:o(f),children:[e.jsx(se,{cols:5,children:e.jsx(be,{formManager:r,defaultCurrency:ve.Ils})}),e.jsxs("div",{className:"flex justify-center gap-5 mt-5",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",disabled:p||Object.keys(t).length===0,children:"Accept"}),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 Ye({formManager:s,chargeSpreadPath:a}){const{control:n,watch:r,trigger:o}=s,{fields:t,append:d,remove:i}=te({control:n,name:a}),u=r(a),p=t.map((f,x)=>({...f,...u[x]}));return e.jsxs("div",{children:[e.jsx("span",{className:"mantine-InputWrapper-label mantine-Select-label",children:"Charge Spread"}),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[p?.map((f,x)=>e.jsxs("div",{className:"flex items-end gap-2 text-gray-600 mb-2",children:[e.jsx("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:e.jsx(N,{name:`${a}.${x}.year`,control:n,rules:{required:"Required",validate:m=>u.map(l=>l.year).filter(l=>l===m).length>1?"Years must be unique":!0},render:({field:{value:m,...b},fieldState:l})=>e.jsx(ze,{...b,label:"Year of relevance",value:m?new Date(m):null,error:l.error?.message,popoverProps:{withinPortal:!0},required:!0,onChange:j=>{o(a),b.onChange(j?ne(j,"yyyy-MM-dd"):void 0)}})})}),e.jsx("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:e.jsx(N,{control:n,name:`${a}.${x}.amount`,render:({field:m,fieldState:b})=>e.jsx(we,{className:"w-full",...m,min:0,label:"Amount",value:m.value??void 0,hideControls:!0,precision:2,error:b.error?.message,onChange:l=>m.onChange(l&&typeof l=="number"?l:void 0)})})}),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5 mb-2",onClick:()=>{i(x),o(a)},children:e.jsx(ae,{className:"size-5"})})]},f.id)),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>{d({year:`${new Date().getFullYear()}-01-01`}),o(a)},children:e.jsx(re,{className:"size-5"})})]})]})}function We({formManager:s,tagsPath:a,setFetching:n}){const{selectableTags:r,fetching:o}=Ne(),{control:t}=s,{fields:d,append:i,remove:u}=te({control:t,name:a,keyName:"id"});return g.useEffect(()=>{n&&n(o)},[o,n]),e.jsxs("div",{children:[e.jsx("span",{className:"mantine-InputWrapper-label mantine-Select-label",children:"Tags"}),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d?.map((p,f)=>e.jsxs("div",{className:" flex items-center gap-2 text-gray-600 mb-2",children:[e.jsx("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:e.jsx(N,{control:t,name:`${a}.${f}.id`,rules:{required:"Required",minLength:{value:2,message:"Minimum 2 characters"}},render:({field:x,fieldState:m})=>e.jsx(Ce,{...x,data:r,disabled:o,placeholder:"Scroll to see all options",error:m.error?.message})})}),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>u(f),children:e.jsx(ae,{className:"size-5"})})]},p.id)),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>i({}),children:e.jsx(re,{className:"size-5"})})]})]})}const os=({chargeId:s,close:a,onChange:n})=>s?e.jsx(Ze,{chargeId:s,close:a,onChange:n}):null,Ze=({chargeId:s,close:a,onChange:n=()=>{}})=>{const[{data:r,fetching:o}]=L({query:De,variables:{chargeId:s}}),t=r?.charge;return e.jsx($,{modalSize:"fit-content",position:"bottom",title:e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Edit Charge:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["ID: ",s,e.jsx(q,{isLink:!0,content:`${window.location.origin}${R.CHARGES.DETAIL(s)}`})]})]}),opened:!!s,onClose:a,children:o||!t?e.jsx(ke,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}):e.jsx(Ge,{charge:t,close:a,onChange:n})})},cs=({chargeId:s,close:a,onChange:n=()=>{}})=>e.jsx($,{modalSize:"40%",position:"bottom",title:e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Insert Document:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["Charge ID: ",s,e.jsx(q,{isLink:!0,content:`${window.location.origin}${R.CHARGES.DETAIL(s)}`})]})]}),opened:!!s,onClose:a,children:e.jsx(Pe,{chargeId:s,closeModal:a,onChange:n})});function Qe({charge:s,documents:a,toggleDocument:n,selectedDocuments:r}){const[o,t]=g.useState(!1),d=_e(s,a);return e.jsxs("div",{className:`relative p-2 space-y-3 overflow-hidden lg:space-y-0 lg:grid lg:grid-cols-${d.length>2?"4":String(d.length+1)} lg:gap-x-3 rounded-xl`,children:[e.jsx("div",{className:"relative flex flex-col p-5 bg-white",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-l font-semibold text-neutral-600",children:"Charge"}),e.jsx("p",{className:"flex items-baseline mt-4 text-neutral-600",children:e.jsx("span",{className:"text-5xl font-extrabold tracking-tight",children:s.totalAmount?.formatted})}),e.jsx("p",{className:"mt-6 text-gray-500",children:s.counterparty?.name}),e.jsxs("ul",{className:"pt-6 mt-6 space-y-6 border-t",children:[e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(J,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:"Charge"})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(Z,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600"})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(P,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:ne(new Date(s.transactions[0].eventDate),"yyyy-MM-dd")})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(W,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:s.totalAmount?.formatted})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(Q,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:s.transactions[0].sourceDescription})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("li",{}),e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!1),className:"inline-flex items-center mt-4 font-semibold text-blue-600 lg:mb-0 hover:text-neutral-600",title:"read less",children:[" ","« Less Info"," "]})})]}):e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!0),className:"inline-flex items-center mt-4 font-semibold text-blue-600 lg:mb-0 hover:text-neutral-600",title:"read more",children:[" ","More Info »"," "]})})]})]})}),d.map(({document:i})=>e.jsxs("div",{className:"relative flex flex-col p-5 bg-blue-600 rounded-2xl",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-white",children:i.documentType}),e.jsx("p",{className:"flex items-baseline mt-4 text-white",children:e.jsx("span",{className:"text-5xl font-extrabold tracking-tight",children:i.amount?.formatted})}),e.jsx("p",{className:"mt-6 text-gray-300",children:i.creditor?.name}),e.jsxs("ul",{className:"pt-6 mt-6 space-y-6 border-t",children:[e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(J,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.documentType})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(Z,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.serialNumber})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(P,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.date})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(W,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.amount?.formatted})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(Q,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.creditor?.name})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("li",{}),e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!1),className:"inline-flex items-center mt-4 font-semibold text-white lg:mb-0 hover:text-neutral-300",title:"read less",children:[" ","« Less Info"," "]})})]}):e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!0),className:"inline-flex items-center mt-4 font-semibold text-white lg:mb-0 hover:text-neutral-300",title:"read more",children:[" ","More Info »"," "]})})]})]}),e.jsx("div",{className:"z-50 mt-6 rounded-lg",children:e.jsx("button",{onClick:()=>{n(i.id)},className:"w-full items-center block px-10 py-3.5 text-base font-medium text-center text-blue-600 transition duration-500 ease-in-out transform border-2 border-white shadow-md rounded-xl focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 bg-white",style:r.includes(i.id)?{backgroundColor:"lightGreen"}:{},children:"Match"})})]},i.id))]})}function Je({documents:s,toggleDocument:a,selectedDocuments:n}){const[r,o]=g.useState(null);return e.jsxs(e.Fragment,{children:[r&&e.jsx($e,{modalSize:"45%",content:e.jsx(Me,{src:r}),opened:!!r,onClose:()=>o(null)}),e.jsx(Le,{stickyHeader:!0,items:s,columns:[{title:"Type",value:t=>t.__typename},{title:"Image",value:t=>t.image?e.jsx("button",{onClick:()=>o(t.image?.toString()??null),children:e.jsx("img",{alt:"missing img",src:t.image?.toString(),height:80,width:80})}):"No image"},{title:"File",value:t=>t.file&&e.jsx("a",{href:t.file?.toString(),target:"_blank",rel:"noreferrer",children:e.jsx(C,{children:"Open Link"})})},{title:"Date",value:t=>"date"in t?t.date:null},{title:"Serial Number",value:t=>"serialNumber"in t?t.serialNumber:null},{title:"Amount",value:t=>t.amount?.formatted??null},{title:"Provider",value:t=>t.creditor?.name??null},{title:"Match",value:t=>e.jsx("button",{onClick:()=>{a(t.id)},className:"w-full items-center block px-10 py-3.5 text-base font-medium text-center text-blue-600 transition duration-500 ease-in-out transform border-2 border-white shadow-md rounded-xl focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 bg-white",style:n.includes(t.id)?{backgroundColor:"lightGreen"}:{},children:"Match"})}]})]})}function Ke({chargeProps:s,documentsProps:a,onDone:n}){const r=Y(Te,s),o=g.useMemo(()=>a?.documentsByFilters.map(l=>Y(Ie,l))??[],[a]),[t,d]=g.useState([]),{updateDocument:i}=Se(),u=g.useMemo(()=>o.filter(l=>!(l.charge||l.__typename==="Unprocessed"||l.__typename==="OtherDocument"||l.amount?.raw==null||!l.date)).sort((l,j)=>l.date??(j.date??"")>""?1:l.date??(j.date??"")<""?-1:0),[o]),p=g.useMemo(()=>u.filter(l=>{if(l.charge||l.amount?.raw==null||!l.date)return!1;const j=Math.abs(r.totalAmount.raw),y=Math.abs(l.amount.raw),T=new Date(r.transactions[0].eventDate).getTime(),F=new Date(l.date).getTime(),A=y>3e3?30:0;return y>=Math.floor(j)&&y<=Math.ceil(j+A)&&Math.abs(F-T)<5184e6}),[u,r]),[f,x]=g.useState(p.length>0);if(u.length===0)return e.jsx("p",{children:"No matches found"});function m(l){t.includes(l)?d(t.filter(j=>j!==l)):d([...t,l])}const b=()=>{t.map(l=>i({documentId:l,fields:{chargeId:r.id}})),n()};return e.jsxs("div",{className:"relative items-center w-full mx-auto md:px-5 lg:px-2 max-w-8xl",children:[e.jsxs("div",{className:"flex flex-row justify-end",children:[p.length>0&&e.jsxs("div",{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(w,{children:"Filter Suggestions"})}),e.jsx(I,{checked:f,onCheckedChange:x})]}),e.jsx(C,{disabled:t.length===0,onClick:b,children:"Accept"})]}),e.jsx("div",{children:f?e.jsx(Qe,{charge:r,documents:p,toggleDocument:m,selectedDocuments:t}):e.jsx(Je,{charge:r,documents:u,toggleDocument:m,selectedDocuments:t})})]})}function Xe({chargeId:s,ownerId:a,onDone:n}){const[{data:r,fetching:o}]=L({query:Fe,variables:{chargeId:s,filters:{unmatched:!0,ownerIDs:a?[a]:void 0}}}),t=r?.documentsByFilters.length===0&&"No Document Found"||!r?.charge&&"Charge was not found"||r?.charge.totalAmount?.raw==null&&"Charge is missing amount"||!r?.charge.transactions[0]?.eventDate&&"Charge is missing date"||void 0;return e.jsx("div",{className:"text-gray-600 body-font",children:e.jsxs("div",{className:"container px-2 py-5 mx-auto",children:[o&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx(Ae,{})}),t&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx("h3",{className:"sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900",children:t})}),!t&&e.jsx("div",{className:"flex flex-col gap-3",children:e.jsx(Ke,{chargeProps:r.charge,documentsProps:r,onDone:n})})]})})}const ds=({chargeId:s,ownerId:a,setMatchDocuments:n})=>e.jsx($,{modalSize:"80%",position:"bottom",title:e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-5",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Match Documents:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["Charge ID: ",s,e.jsx(q,{isLink:!0,content:`${window.location.origin}${R.CHARGES.DETAIL(s)}`})]})]}),opened:!!s,onClose:()=>n(),children:e.jsx(Xe,{chargeId:s,ownerId:a,onDone:()=>n()})});export{os as E,cs as I,ds as M};
1
+ import{v as B,bC as ce,r as g,z as X,b2 as de,u as L,em as me,t as S,en as ue,j as e,V as ee,eo as se,Y as D,Z as k,_ as w,$ as M,I as xe,a1 as he,bD as N,bG as E,at as I,a9 as fe,g as ge,ep as pe,i as je,eq as be,ay as ve,ca as ye,H as te,w as ne,cn as we,B as C,co as ae,b4 as Ne,b5 as Ce,er as De,es as $,d as ke,et as q,R,aO as P,dt as Me,G as Y,eu as Ie,ev as Se,ew as Te,ex as Fe,c as Ae}from"./index-BWAOW53d.js";import{c as Oe,d as Ee,e as W}from"./charges-table-CYqBhSR-.js";import{Y as ze}from"./YearPickerInput-wefUMrNX.js";import{L as re}from"./list-plus-C0XPnNVe.js";import{I as Be}from"./insert-business-trip-modal-C4MiJk_g.js";import{a as Le}from"./accounter-table-pB9Clv36.js";import{P as $e}from"./modal-DGBtDZun.js";const qe=[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]],Z=B("barcode",qe);const Re=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Q=B("bookmark",Re);const Ve=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],J=B("file-question-mark",Ve),z=s=>{const a=s.length,n=s.reduce((r,o)=>r+o)/a;return Math.sqrt(s.map(r=>Math.pow(r-n,2)).reduce((r,o)=>r+o)/a)},K=(s,a)=>{if(!s||!a)return 0;let n=0;const r=s.replace(/[^a-zA-Z0-9]/g,"").toLowerCase(),o=a.replace(/[^a-zA-Z0-9]/g,"").toLowerCase();for(let t=0;t<r.length;t++){let d=0;for(let i=0;i<o.length;i++)r[t+i]===o[i]?d+=1:(d>n&&(n=d),d=0);d>n&&(n=d),d=0}return n},_e=(s,a)=>{const n={providerIdents:{},dateDiffs:{},amountDiffs:{}};for(const i of a){const u=new Date(s.transactions[0].eventDate).getTime()-new Date(i.date).getTime();n.dateDiffs[s.id]=Math.abs(u);const p=(s.totalAmount?.raw??0)-i.amount.raw;n.amountDiffs[s.id]=Math.abs(p);const f=K(i.creditor?.name??"",s.counterparty?.name??""),x=K(i.creditor?.name??"",s.transactions[0].sourceDescription);n.providerIdents[s.id]=f>x?f:x}const r=z(Object.values(n.providerIdents)),o=z(Object.values(n.dateDiffs)),t=z(Object.values(n.amountDiffs)),d=[];for(const i of a){let u=0;u=(o?Math.abs((n.dateDiffs[s.id]-Math.min(...Object.values(n.dateDiffs)))/o):0)+(t?Math.abs((n.amountDiffs[s.id]-Math.min(...Object.values(n.amountDiffs)))/t):0)+(r?(Math.max(...Object.values(n.providerIdents))-Math.abs(n.providerIdents[s.id]))/r:0),d.push({score:u,document:i})}return d.sort((i,u)=>i.score>u.score?1:i.score<u.score?-1:0),d},Ge=({charge:s,close:a,onChange:n})=>{const{updateCharge:r,fetching:o}=Oe(),{selectableBusinesses:t,fetching:d}=ce(),[i,u]=g.useState([]),[p,f]=g.useState(!1),[x,m]=g.useState(void 0),b=X({defaultValues:{...s,yearsOfRelevance:s.yearsOfRelevance?.map(c=>({year:c.year,amount:c.amount})).sort((c,h)=>c.year>h.year?1:-1)}}),{control:l,handleSubmit:j,formState:{dirtyFields:y}}=b,T=async c=>{if(!s)return;const h=fe(c,y);if(h&&Object.keys(h).length>0)if(await r({chargeId:s.id,fields:{...h,yearsOfRelevance:c.yearsOfRelevance?Object.values(c.yearsOfRelevance):void 0}}),h.tags?.length||h.userDescription){const G={};if(h.tags){const oe=s.missingInfoSuggestions?.tags??[],U=new Set(oe.map(v=>v.id)),H=new Set(h.tags.map(v=>v.id));(U.size!==H.size||[...U].some(v=>!H.has(v)))&&(G.tagIds=h.tags.map(v=>({id:v.id})))}m(G),f(!0)}else a(),n?.()},{selectableTaxCategories:F,fetching:A}=de(),[{data:O,fetching:le,error:V},_]=L({query:me}),ie=g.useCallback(()=>{_()},[_]);return g.useEffect(()=>{V&&S.error("Error",{description:"An error occurred while fetching business trips."})},[V]),g.useEffect(()=>{O?.allBusinessTrips.length&&u([...O.allBusinessTrips.map(c=>({value:c.id,label:c.name})).sort((c,h)=>c.label>h.label?1:-1),{value:ue,label:"None"}])},[O,u]),e.jsxs(e.Fragment,{children:[e.jsx(ee,{...b,children:e.jsxs("form",{onSubmit:j(T),children:[e.jsx("div",{className:"flex-row px-10 h-max justify-start block",children:e.jsxs(se,{cols:3,children:[e.jsx(D,{name:"userDescription",control:l,defaultValue:s.userDescription,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:c})=>e.jsxs(k,{children:[e.jsx(w,{children:"Description"}),e.jsx(M,{children:e.jsx(xe,{...c,value:c.value??void 0})}),e.jsx(he,{})]})}),e.jsx(N,{name:"ownerId",control:l,defaultValue:s.owner?.id,rules:{required:"Required",minLength:{value:2,message:"Minimum 2 characters"}},render:({field:c,fieldState:h})=>e.jsx(E,{...c,data:t,value:c.value,disabled:d,label:"Owner",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:h.error?.message})}),e.jsx(N,{name:"defaultTaxCategoryID",control:l,defaultValue:s.taxCategory?.id,render:({field:c,fieldState:h})=>e.jsx(E,{...c,data:F,value:c.value,disabled:A,label:"Tax Category Override",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:h.error?.message})}),e.jsx(N,{name:"businessTripID",control:l,defaultValue:"businessTrip"in s?s.businessTrip?.id:void 0,render:({field:c,fieldState:h})=>e.jsx(E,{...c,data:i,value:c.value,disabled:le,label:"Business Trip",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:h.error?.message,rightSection:e.jsx(Be,{onDone:ie})})}),e.jsx(We,{formManager:b,tagsPath:"tags"}),e.jsx(D,{name:"isConversion",control:l,defaultValue:s.conversion,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Is Conversion"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(D,{name:"isInvoicePaymentDifferentCurrency",control:l,defaultValue:s.isInvoicePaymentDifferentCurrency,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Is Invoice-Payment currency difference"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(D,{name:"optionalVAT",control:l,defaultValue:s.optionalVAT??!1,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Optional VAT"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(D,{name:"optionalDocuments",control:l,defaultValue:s.optionalDocuments??!1,render:({field:c})=>e.jsxs(k,{className:"flex flex-row h-fit items-center justify-between rounded-lg border p-3 shadow-sm",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(w,{children:"Optional Documents"})}),e.jsx(M,{children:e.jsx(I,{checked:c.value===!0,onCheckedChange:c.onChange})})]})}),e.jsx(Ye,{formManager:b,chargeSpreadPath:"yearsOfRelevance"})]})}),e.jsxs("div",{className:"mt-10 mb-5 flex justify-center gap-5",children:[e.jsx("button",{type:"submit",onClick:()=>j(T),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:o||Object.keys(y).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:a,children:"Cancel"})]})]})}),e.jsx(Ee,{chargeId:s.id,tagIds:x?.tagIds,description:x?.description,open:p,onOpenChange:f,onClose:()=>{a(),n?.()},showChargesWithExistingSuggestions:!0})]})},Ue="insertDocument",He=()=>{const[{fetching:s},a]=ge(pe),n=g.useCallback(async r=>{const o=`Error inserting document to charge ID [${r.record.chargeId}]`,t=Ue;S.loading("Adding document",{id:t});try{const d=await a(r),i=je(d,o,t,"insertDocument");if(i)return S.success("Success",{id:t,description:"Document added"}),i.insertDocument}catch(d){console.error(`${o}: ${d}`),S.error("Error",{id:t,description:o,duration:1e5,closeButton:!0})}},[a]);return{fetching:s,insertDocument:n}},Pe=({chargeId:s,onChange:a,closeModal:n})=>{const r=X(),{handleSubmit:o,formState:{dirtyFields:t},setValue:d,watch:i}=r,{insertDocument:u,fetching:p}=He(),f=m=>{if(m&&Object.keys(m).length>0){if(m.vat){if(!m.amount?.currency){S.error("Error",{description:"Couldn't figure out the currency of the document"});return}m.vat.currency=m.amount.currency}m.documentType??=ye.Unprocessed,u({record:{...m,chargeId:s}}).then(()=>a?.()),n?.()}},x=i("amount.currency");return g.useEffect(()=>{d("vat.currency",x)},[d,x]),e.jsx("div",{className:"px-5 w-max h-max justify-items-center",children:e.jsx(ee,{...r,children:e.jsxs("form",{onSubmit:o(f),children:[e.jsx(se,{cols:5,children:e.jsx(be,{formManager:r,defaultCurrency:ve.Ils})}),e.jsxs("div",{className:"flex justify-center gap-5 mt-5",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",disabled:p||Object.keys(t).length===0,children:"Accept"}),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 Ye({formManager:s,chargeSpreadPath:a}){const{control:n,watch:r,trigger:o}=s,{fields:t,append:d,remove:i}=te({control:n,name:a}),u=r(a),p=t.map((f,x)=>({...f,...u[x]}));return e.jsxs("div",{children:[e.jsx("span",{className:"mantine-InputWrapper-label mantine-Select-label",children:"Charge Spread"}),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[p?.map((f,x)=>e.jsxs("div",{className:"flex items-end gap-2 text-gray-600 mb-2",children:[e.jsx("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:e.jsx(N,{name:`${a}.${x}.year`,control:n,rules:{required:"Required",validate:m=>u.map(l=>l.year).filter(l=>l===m).length>1?"Years must be unique":!0},render:({field:{value:m,...b},fieldState:l})=>e.jsx(ze,{...b,label:"Year of relevance",value:m?new Date(m):null,error:l.error?.message,popoverProps:{withinPortal:!0},required:!0,onChange:j=>{o(a),b.onChange(j?ne(j,"yyyy-MM-dd"):void 0)}})})}),e.jsx("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:e.jsx(N,{control:n,name:`${a}.${x}.amount`,render:({field:m,fieldState:b})=>e.jsx(we,{className:"w-full",...m,min:0,label:"Amount",value:m.value??void 0,hideControls:!0,precision:2,error:b.error?.message,onChange:l=>m.onChange(l&&typeof l=="number"?l:void 0)})})}),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5 mb-2",onClick:()=>{i(x),o(a)},children:e.jsx(ae,{className:"size-5"})})]},f.id)),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>{d({year:`${new Date().getFullYear()}-01-01`}),o(a)},children:e.jsx(re,{className:"size-5"})})]})]})}function We({formManager:s,tagsPath:a,setFetching:n}){const{selectableTags:r,fetching:o}=Ne(),{control:t}=s,{fields:d,append:i,remove:u}=te({control:t,name:a,keyName:"id"});return g.useEffect(()=>{n&&n(o)},[o,n]),e.jsxs("div",{children:[e.jsx("span",{className:"mantine-InputWrapper-label mantine-Select-label",children:"Tags"}),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d?.map((p,f)=>e.jsxs("div",{className:" flex items-center gap-2 text-gray-600 mb-2",children:[e.jsx("div",{className:"w-full mt-1 relative rounded-md shadow-xs",children:e.jsx(N,{control:t,name:`${a}.${f}.id`,rules:{required:"Required",minLength:{value:2,message:"Minimum 2 characters"}},render:({field:x,fieldState:m})=>e.jsx(Ce,{...x,data:r,disabled:o,placeholder:"Scroll to see all options",error:m.error?.message})})}),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>u(f),children:e.jsx(ae,{className:"size-5"})})]},p.id)),e.jsx(C,{variant:"ghost",size:"icon",className:"size-7.5",onClick:()=>i({}),children:e.jsx(re,{className:"size-5"})})]})]})}const os=({chargeId:s,close:a,onChange:n})=>s?e.jsx(Ze,{chargeId:s,close:a,onChange:n}):null,Ze=({chargeId:s,close:a,onChange:n=()=>{}})=>{const[{data:r,fetching:o}]=L({query:De,variables:{chargeId:s}}),t=r?.charge;return e.jsx($,{modalSize:"fit-content",position:"bottom",title:e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Edit Charge:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["ID: ",s,e.jsx(q,{isLink:!0,content:`${window.location.origin}${R.CHARGES.DETAIL(s)}`})]})]}),opened:!!s,onClose:a,children:o||!t?e.jsx(ke,{className:"flex self-center my-5",color:"dark",size:"xl",variant:"dots"}):e.jsx(Ge,{charge:t,close:a,onChange:n})})},cs=({chargeId:s,close:a,onChange:n=()=>{}})=>e.jsx($,{modalSize:"40%",position:"bottom",title:e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-10",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Insert Document:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["Charge ID: ",s,e.jsx(q,{isLink:!0,content:`${window.location.origin}${R.CHARGES.DETAIL(s)}`})]})]}),opened:!!s,onClose:a,children:e.jsx(Pe,{chargeId:s,closeModal:a,onChange:n})});function Qe({charge:s,documents:a,toggleDocument:n,selectedDocuments:r}){const[o,t]=g.useState(!1),d=_e(s,a);return e.jsxs("div",{className:`relative p-2 space-y-3 overflow-hidden lg:space-y-0 lg:grid lg:grid-cols-${d.length>2?"4":String(d.length+1)} lg:gap-x-3 rounded-xl`,children:[e.jsx("div",{className:"relative flex flex-col p-5 bg-white",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-l font-semibold text-neutral-600",children:"Charge"}),e.jsx("p",{className:"flex items-baseline mt-4 text-neutral-600",children:e.jsx("span",{className:"text-5xl font-extrabold tracking-tight",children:s.totalAmount?.formatted})}),e.jsx("p",{className:"mt-6 text-gray-500",children:s.counterparty?.name}),e.jsxs("ul",{className:"pt-6 mt-6 space-y-6 border-t",children:[e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(J,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:"Charge"})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(Z,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600"})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(P,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:ne(new Date(s.transactions[0].eventDate),"yyyy-MM-dd")})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(W,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:s.totalAmount?.formatted})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-blue-600 rounded-xl p-0.5",children:e.jsx(Q,{color:"white"})}),e.jsx("span",{className:"ml-3 text-neutral-600",children:s.transactions[0].sourceDescription})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("li",{}),e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!1),className:"inline-flex items-center mt-4 font-semibold text-blue-600 lg:mb-0 hover:text-neutral-600",title:"read less",children:[" ","« Less Info"," "]})})]}):e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!0),className:"inline-flex items-center mt-4 font-semibold text-blue-600 lg:mb-0 hover:text-neutral-600",title:"read more",children:[" ","More Info »"," "]})})]})]})}),d.map(({document:i})=>e.jsxs("div",{className:"relative flex flex-col p-5 bg-blue-600 rounded-2xl",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-white",children:i.documentType}),e.jsx("p",{className:"flex items-baseline mt-4 text-white",children:e.jsx("span",{className:"text-5xl font-extrabold tracking-tight",children:i.amount?.formatted})}),e.jsx("p",{className:"mt-6 text-gray-300",children:i.creditor?.name}),e.jsxs("ul",{className:"pt-6 mt-6 space-y-6 border-t",children:[e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(J,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.documentType})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(Z,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.serialNumber})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(P,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.date})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(W,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.amount?.formatted})]}),e.jsxs("li",{className:"flex",children:[e.jsx("div",{className:"inline-flex items-center w-6 h-6 bg-white rounded-xl p-0.5",children:e.jsx(Q,{color:"blue"})}),e.jsx("span",{className:"ml-3 text-white",children:i.creditor?.name})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("li",{}),e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!1),className:"inline-flex items-center mt-4 font-semibold text-white lg:mb-0 hover:text-neutral-300",title:"read less",children:[" ","« Less Info"," "]})})]}):e.jsx("li",{children:e.jsxs("button",{onClick:()=>t(!0),className:"inline-flex items-center mt-4 font-semibold text-white lg:mb-0 hover:text-neutral-300",title:"read more",children:[" ","More Info »"," "]})})]})]}),e.jsx("div",{className:"z-50 mt-6 rounded-lg",children:e.jsx("button",{onClick:()=>{n(i.id)},className:"w-full items-center block px-10 py-3.5 text-base font-medium text-center text-blue-600 transition duration-500 ease-in-out transform border-2 border-white shadow-md rounded-xl focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 bg-white",style:r.includes(i.id)?{backgroundColor:"lightGreen"}:{},children:"Match"})})]},i.id))]})}function Je({documents:s,toggleDocument:a,selectedDocuments:n}){const[r,o]=g.useState(null);return e.jsxs(e.Fragment,{children:[r&&e.jsx($e,{modalSize:"45%",content:e.jsx(Me,{src:r}),opened:!!r,onClose:()=>o(null)}),e.jsx(Le,{stickyHeader:!0,items:s,columns:[{title:"Type",value:t=>t.__typename},{title:"Image",value:t=>t.image?e.jsx("button",{onClick:()=>o(t.image?.toString()??null),children:e.jsx("img",{alt:"missing img",src:t.image?.toString(),height:80,width:80})}):"No image"},{title:"File",value:t=>t.file&&e.jsx("a",{href:t.file?.toString(),target:"_blank",rel:"noreferrer",children:e.jsx(C,{children:"Open Link"})})},{title:"Date",value:t=>"date"in t?t.date:null},{title:"Serial Number",value:t=>"serialNumber"in t?t.serialNumber:null},{title:"Amount",value:t=>t.amount?.formatted??null},{title:"Provider",value:t=>t.creditor?.name??null},{title:"Match",value:t=>e.jsx("button",{onClick:()=>{a(t.id)},className:"w-full items-center block px-10 py-3.5 text-base font-medium text-center text-blue-600 transition duration-500 ease-in-out transform border-2 border-white shadow-md rounded-xl focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 bg-white",style:n.includes(t.id)?{backgroundColor:"lightGreen"}:{},children:"Match"})}]})]})}function Ke({chargeProps:s,documentsProps:a,onDone:n}){const r=Y(Te,s),o=g.useMemo(()=>a?.documentsByFilters.map(l=>Y(Ie,l))??[],[a]),[t,d]=g.useState([]),{updateDocument:i}=Se(),u=g.useMemo(()=>o.filter(l=>!(l.charge||l.__typename==="Unprocessed"||l.__typename==="OtherDocument"||l.amount?.raw==null||!l.date)).sort((l,j)=>l.date??(j.date??"")>""?1:l.date??(j.date??"")<""?-1:0),[o]),p=g.useMemo(()=>u.filter(l=>{if(l.charge||l.amount?.raw==null||!l.date)return!1;const j=Math.abs(r.totalAmount.raw),y=Math.abs(l.amount.raw),T=new Date(r.transactions[0].eventDate).getTime(),F=new Date(l.date).getTime(),A=y>3e3?30:0;return y>=Math.floor(j)&&y<=Math.ceil(j+A)&&Math.abs(F-T)<5184e6}),[u,r]),[f,x]=g.useState(p.length>0);if(u.length===0)return e.jsx("p",{children:"No matches found"});function m(l){t.includes(l)?d(t.filter(j=>j!==l)):d([...t,l])}const b=()=>{t.map(l=>i({documentId:l,fields:{chargeId:r.id}})),n()};return e.jsxs("div",{className:"relative items-center w-full mx-auto md:px-5 lg:px-2 max-w-8xl",children:[e.jsxs("div",{className:"flex flex-row justify-end",children:[p.length>0&&e.jsxs("div",{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(w,{children:"Filter Suggestions"})}),e.jsx(I,{checked:f,onCheckedChange:x})]}),e.jsx(C,{disabled:t.length===0,onClick:b,children:"Accept"})]}),e.jsx("div",{children:f?e.jsx(Qe,{charge:r,documents:p,toggleDocument:m,selectedDocuments:t}):e.jsx(Je,{charge:r,documents:u,toggleDocument:m,selectedDocuments:t})})]})}function Xe({chargeId:s,ownerId:a,onDone:n}){const[{data:r,fetching:o}]=L({query:Fe,variables:{chargeId:s,filters:{unmatched:!0,ownerIDs:a?[a]:void 0}}}),t=r?.documentsByFilters.length===0&&"No Document Found"||!r?.charge&&"Charge was not found"||r?.charge.totalAmount?.raw==null&&"Charge is missing amount"||!r?.charge.transactions[0]?.eventDate&&"Charge is missing date"||void 0;return e.jsx("div",{className:"text-gray-600 body-font",children:e.jsxs("div",{className:"container px-2 py-5 mx-auto",children:[o&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx(Ae,{})}),t&&e.jsx("div",{className:"flex flex-col text-center w-full mb-1",children:e.jsx("h3",{className:"sm:text-2xl text-xl font-medium title-font mb-6 text-gray-900",children:t})}),!t&&e.jsx("div",{className:"flex flex-col gap-3",children:e.jsx(Ke,{chargeProps:r.charge,documentsProps:r,onDone:n})})]})})}const ds=({chargeId:s,ownerId:a,setMatchDocuments:n})=>e.jsx($,{modalSize:"80%",position:"bottom",title:e.jsxs("div",{className:"flex flex-row mx-3 pt-3 sm:text-1xl gap-5",children:[e.jsx("h1",{className:"sm:text-2xl font-small text-gray-900",children:"Match Documents:"}),e.jsxs("div",{className:"flex flex-row gap-2",children:["Charge ID: ",s,e.jsx(q,{isLink:!0,content:`${window.location.origin}${R.CHARGES.DETAIL(s)}`})]})]}),opened:!!s,onClose:()=>n(),children:e.jsx(Xe,{chargeId:s,ownerId:a,onDone:()=>n()})});export{os as E,cs as I,ds as M};
@@ -1 +1 @@
1
- import{r as s,F as S,u as D,j as e,T as w,B as E,L as P,M as N}from"./index-CNNawG6D.js";import{u as R}from"./use-url-query-D4K72DMD.js";import{M as T,C as b}from"./charges-table-BE8zAChh.js";import{E as q,I as y,M as z}from"./match-document-modal-BVyNTaxu.js";import{P as A}from"./page-layout-Dne17xLZ.js";import{P as B,a as F}from"./panel-top-open-muCAuRMw.js";import"./toggle-expansion-button-wmsjVpKZ.js";import"./index-1q5Bty_H.js";import"./similar-transactions-modal-vucNNAQ7.js";import"./addDays-CIRVLi_y.js";import"./list-plus-wSEH8ky8.js";import"./Table-BPmZ5ljQ.js";import"./summary-CoPnqTel.js";import"./deposits-transactions-table-D3Sw0OgH.js";import"./Checkbox-D1EYx-2R.js";import"./accordion-DjXOBlUF.js";import"./data-table-column-header-BN5-dHgb.js";import"./eye-off-Ct63cJU6.js";import"./YearPickerInput-DXpznBXd.js";import"./insert-business-trip-modal-CLVLw7m4.js";import"./accounter-table-Cg2u2Bcd.js";import"./modal-BghEq_eS.js";const re=()=>{const{setFiltersContext:d}=s.useContext(S),[a,g]=s.useState(void 0),[i,p]=s.useState(void 0),[r,u]=s.useState(void 0),[n,h]=s.useState(!1),[t,c]=s.useState([]),{get:C}=R(),[x,M]=s.useState(C("page")?Number(C("page")):1),j=s.useCallback((o,v)=>{t.map(l=>l.id).includes(o)?c(t.filter(l=>l.id!==o)):c([...t,{id:o,onChange:v}])},[t]),[{data:m,fetching:f}]=D({query:N,variables:{page:x,limit:100}});function I(){c([])}return s.useEffect(()=>{d(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(w,{content:"Expand all accounts",children:e.jsx(E,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>h(o=>!o),children:n?e.jsx(B,{className:"size-5"}):e.jsx(F,{className:"size-5"})})}),e.jsx(T,{selected:t,resetMerge:I})]}))},[m,f,x,n,d,M,h,t]),e.jsxs(A,{title:"Missing Info Charges",description:"Review charges with missing required details",children:[!m?.chargesWithMissingRequiredInfo.nodes||f?e.jsx(P,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx(b,{setEditChargeId:g,setInsertDocument:p,setMatchDocuments:u,toggleMergeCharge:j,mergeSelectedCharges:new Set(t.map(o=>o.id)),data:m?.chargesWithMissingRequiredInfo?.nodes,isAllOpened:n}),a&&e.jsx(q,{chargeId:a?.id,close:()=>g(void 0),onChange:a.onChange}),i&&e.jsx(y,{chargeId:i.id,onChange:i.onChange,close:()=>p(void 0)}),r&&e.jsx(z,{chargeId:r.id,ownerId:r.ownerId,setMatchDocuments:()=>u(void 0)})]})};export{re as MissingInfoCharges};
1
+ import{r as s,F as S,u as D,j as e,T as w,B as E,L as P,M as N}from"./index-BWAOW53d.js";import{u as R}from"./use-url-query-DG-wQ19o.js";import{M as T,C as b}from"./charges-table-CYqBhSR-.js";import{E as q,I as y,M as z}from"./match-document-modal-B8E3M5F6.js";import{P as A}from"./page-layout-Ck_xKyt0.js";import{P as B,a as F}from"./panel-top-open-EMjzc-ww.js";import"./toggle-expansion-button-wXVsrHLI.js";import"./index-DLnIlpCq.js";import"./similar-transactions-modal--yMHokZr.js";import"./addDays-z7yxKvSG.js";import"./list-plus-C0XPnNVe.js";import"./Table-LzLjpZeA.js";import"./summary-BU7IrLve.js";import"./deposits-transactions-table-CcCuygQV.js";import"./Checkbox-Bqh8Rs3Y.js";import"./accordion-DY8sNVhh.js";import"./data-table-column-header-RVA6DnfK.js";import"./eye-off-A1glr3Lh.js";import"./YearPickerInput-wefUMrNX.js";import"./insert-business-trip-modal-C4MiJk_g.js";import"./accounter-table-pB9Clv36.js";import"./modal-DGBtDZun.js";const re=()=>{const{setFiltersContext:d}=s.useContext(S),[a,g]=s.useState(void 0),[i,p]=s.useState(void 0),[r,u]=s.useState(void 0),[n,h]=s.useState(!1),[t,c]=s.useState([]),{get:C}=R(),[x,M]=s.useState(C("page")?Number(C("page")):1),j=s.useCallback((o,v)=>{t.map(l=>l.id).includes(o)?c(t.filter(l=>l.id!==o)):c([...t,{id:o,onChange:v}])},[t]),[{data:m,fetching:f}]=D({query:N,variables:{page:x,limit:100}});function I(){c([])}return s.useEffect(()=>{d(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(w,{content:"Expand all accounts",children:e.jsx(E,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>h(o=>!o),children:n?e.jsx(B,{className:"size-5"}):e.jsx(F,{className:"size-5"})})}),e.jsx(T,{selected:t,resetMerge:I})]}))},[m,f,x,n,d,M,h,t]),e.jsxs(A,{title:"Missing Info Charges",description:"Review charges with missing required details",children:[!m?.chargesWithMissingRequiredInfo.nodes||f?e.jsx(P,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx(b,{setEditChargeId:g,setInsertDocument:p,setMatchDocuments:u,toggleMergeCharge:j,mergeSelectedCharges:new Set(t.map(o=>o.id)),data:m?.chargesWithMissingRequiredInfo?.nodes,isAllOpened:n}),a&&e.jsx(q,{chargeId:a?.id,close:()=>g(void 0),onChange:a.onChange}),i&&e.jsx(y,{chargeId:i.id,onChange:i.onChange,close:()=>p(void 0)}),r&&e.jsx(z,{chargeId:r.id,ownerId:r.ownerId,setMatchDocuments:()=>u(void 0)})]})};export{re as MissingInfoCharges};
@@ -1 +1 @@
1
- import{j as n,n as l}from"./index-CNNawG6D.js";const i=({content:s,title:r,opened:e=!1,onClose:o=()=>{},modalSize:a,withCloseButton:t=!1})=>n.jsx(l,{size:a,opened:e,onClose:o,title:r,withCloseButton:t,children:s});export{i as P};
1
+ import{j as n,n as l}from"./index-BWAOW53d.js";const i=({content:s,title:r,opened:e=!1,onClose:o=()=>{},modalSize:a,withCloseButton:t=!1})=>n.jsx(l,{size:a,opened:e,onClose:o,title:r,withCloseButton:t,children:s});export{i as P};
@@ -1 +1 @@
1
- import{v as re,bJ as N,bK as S,g as K,c8 as se,r as p,t as k,i as Q,c9 as ie,ca as B,bI as X,ay as V,u as ce,cb as oe,z as le,E as de,a7 as ue,w,j as e,D as me,aL as pe,B as C,ah as he,a3 as U,x as xe,al as je,am as ye,an as ge,V as Ce,Y as o,Z as l,_ as d,$ as u,I as f,a1 as m,ag as fe,a4 as De,ao as T,ap as I,aq as O,ar as A,as as L,at as _,aQ as be,bb as we,a2 as ke,au as ve,cc as Ne,aw as v,ab as H,ax as Te,be as Ie,ac as Oe,aa as Ae,ad as J,aA as Le,bf as Se}from"./index-CNNawG6D.js";const Pe=[["path",{d:"M5 7a2 2 0 0 0-2 2v11",key:"1yhqjt"}],["path",{d:"M5.803 18H5a2 2 0 0 0 0 4h9.5a.5.5 0 0 0 .5-.5V21",key:"edzzo5"}],["path",{d:"M9 15V4a2 2 0 0 1 2-2h9.5a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H11a2 2 0 0 1 0-4h10",key:"1nwzrg"}]],Ee=re("book-copy",Pe);function Me(c){switch(c){case N.Annual:return"Annual";case N.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${c}`)}}function Be(c){switch(c){case S.Enterprise:return"Enterprise";case S.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${c}`)}}const Ve="createContract",ze=()=>{const[{fetching:c},h]=K(se),g=p.useCallback(async x=>{const y=`Error creating new contract for client[${x.input.clientId}]`,s=`${Ve}-${x.input.clientId}`;k.loading("Creating contract",{id:s});try{const i=await h(x);Q(i,y,s)&&k.success("Success",{id:s,description:`Contract for client ${x.input.clientId} was successfully created`})}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{creating:c,createContract:g}},Fe="updateContract",$e=()=>{const[{fetching:c},h]=K(ie),g=p.useCallback(async x=>{const y=`Error updating contract ID [${x.contractId}]`,s=`${Fe}-${x.contractId}`;k.loading("Updating contract",{id:s});try{const i=await h(x),D=Q(i,y,s,"updateContract");if(D)return k.success("Success",{id:s,description:"Contract updated"}),D.updateContract}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{updating:c,updateContract:g}},Re=ue({id:Le().optional(),startDate:J("Start date is required"),endDate:J("End date is required"),pos:Ae(H()),paymentAmount:Oe().min(0,"Payment amount must be non-negative"),paymentCurrency:v(Object.values(V),"Currency is required"),productType:v(Object.values(X)).optional(),msCloudLink:Ie().optional().or(Se("")),billingCycle:v(Object.values(N)).optional(),subscriptionPlan:v(Object.values(S)).optional(),isActive:Te(),defaultRemark:H().optional(),defaultDocumentType:v(Object.values(B)),operationsLimit:Ne().min(BigInt(0),"Operations limit must be non-negative")}),qe={startDate:"",endDate:"",pos:[],paymentAmount:0,paymentCurrency:V.Usd,productType:X.Hive,msCloudLink:void 0,billingCycle:N.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:B.Proforma,operationsLimit:BigInt(0)};function _e({clientId:c,contract:h,contractId:g,onDone:x,duplicate:y}){const{isEditing:s,isDuplicating:i}=p.useMemo(()=>{const t=!!h||!!g,n=y===!0&&t;return{isEditing:t&&!n,isDuplicating:n}},[h,g,y]),[D,b]=p.useState(!1),[P,Y]=p.useState(!1),[r,z]=p.useState(qe),[F,$]=p.useState(""),{updateContract:R,updating:Z}=$e(),{createContract:E,creating:G}=ze(),[{data:M,fetching:W}]=ce({query:oe,pause:!g||!D,variables:{contractId:g??""}}),a=le({resolver:de(Re),defaultValues:r}),q=()=>{const t=F.trim();if(t){const n=a.getValues("pos");n.includes(t)||a.setValue("pos",[...n,t],{shouldDirty:!0}),$("")}},ee=t=>{const n=a.getValues("pos");a.setValue("pos",n.filter((j,ae)=>ae!==t),{shouldDirty:!0})};p.useEffect(()=>{h&&z(h)},[h]),p.useEffect(()=>{if(M?.contractsById){const t=M.contractsById,n={startDate:t.startDate,endDate:t.endDate,pos:t.purchaseOrders,paymentAmount:t.amount.raw,paymentCurrency:t.amount.currency,productType:t.product??void 0,msCloudLink:t.msCloud?.toString()??void 0,billingCycle:t.billingCycle,subscriptionPlan:t.plan??void 0,isActive:t.isActive,defaultRemark:t.remarks??void 0,defaultDocumentType:t.documentType,operationsLimit:BigInt(t.operationsLimit)};z({id:t.id,...n})}},[M]);const te=p.useMemo(()=>r?JSON.stringify(r):null,[r]);p.useEffect(()=>{r&&a.reset({startDate:r.startDate,endDate:r.endDate,pos:r.pos,paymentAmount:r.paymentAmount,paymentCurrency:r.paymentCurrency,productType:r.productType,msCloudLink:r.msCloudLink,billingCycle:r.billingCycle,subscriptionPlan:r.subscriptionPlan,isActive:r.isActive,defaultRemark:r.defaultRemark,defaultDocumentType:r.defaultDocumentType,operationsLimit:BigInt(r.operationsLimit)})},[te,a.reset]);const ne=p.useCallback(async t=>{if(i||s){if(!r?.id)return;if(i){if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit,deactivateContracts:P?[r.id]:void 0}})}else await R({contractId:r.id,input:{amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}else{if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}b(!1),x?.()},[r,x,E,R,c,a,s,i,P]);return e.jsxs(me,{open:D,onOpenChange:b,children:[e.jsx(pe,{asChild:!0,children:s?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(he,{className:"size-5"})}):i?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(Ee,{className:"size-5"})}):e.jsxs(C,{size:"sm",onClick:()=>b(!0),children:[e.jsx(U,{className:"size-4 mr-2"}),"New Contract"]})}),e.jsxs(xe,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(je,{children:[e.jsx(ye,{children:s?"Edit Contract":"Create New Contract"}),e.jsx(ge,{children:s?"Update contract details":i?"Create a new contract based on an existing one":"Add a new contract with all required details"})]}),W?e.jsx(e.Fragment,{children:"Fetching contract details..."}):e.jsx(Ce,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(ne),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"operationsLimit",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Operations Limit"}),e.jsx(u,{children:e.jsx(f,{placeholder:"500",...t,value:t.value?.toLocaleString(),onChange:n=>{const j=n.target.value.replace(/[^0-9]/g,"");t.onChange(BigInt(j||0))}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"pos",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Purchase Orders"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{placeholder:"Add PO...",value:F,onChange:n=>$(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),q())}}),e.jsx(C,{type:"button",size:"sm",onClick:q,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.value?.map((n,j)=>e.jsxs(fe,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[n,j===(t.value?.length??0)-1&&e.jsx(C,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>ee(j),children:e.jsx(De,{className:"size-3 cursor-pointer flex-shrink-0"})})]},n))}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"startDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"Start Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"endDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"End Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(o,{control:a.control,name:"paymentAmount",render:({field:t})=>e.jsxs(l,{className:"md:col-span-2",children:[e.jsx(d,{children:"Payment Amount"}),e.jsx(u,{children:e.jsx(f,{type:"number",placeholder:"24000",...t,onChange:n=>{t.onChange(n?.target.value?Number(n?.target.value):void 0)}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"paymentCurrency",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Currency"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(V).map(n=>e.jsx(L,{value:n,children:n},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"productType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Product Type"}),e.jsx(u,{children:e.jsx(f,{placeholder:"Cloud Services",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"billingCycle",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Billing Cycle"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(N).map(n=>e.jsx(L,{value:n,children:Me(n)},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"subscriptionPlan",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Subscription Plan"}),e.jsx(u,{children:e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(S).map(n=>e.jsx(L,{value:n,children:Be(n)},n))})]})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"isActive",render:({field:t})=>e.jsxs(l,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(d,{className:"text-base",children:"Active Status"})}),e.jsx(u,{children:e.jsx(_,{checked:t.value,onCheckedChange:t.onChange})})]})})]}),e.jsx(o,{control:a.control,name:"msCloudLink",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"MS Cloud Link"}),e.jsx(u,{children:e.jsx(f,{type:"url",placeholder:"https://portal.azure.com/contract-id",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultDocumentType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Document Type"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(B).map(n=>e.jsx(L,{value:n,children:be(n)},n))})]}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultRemark",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Remark"}),e.jsx(u,{children:e.jsx(we,{placeholder:"Enter default remark for this contract...",rows:3,...t})}),e.jsx(m,{})]})}),i&&e.jsxs("div",{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(ke,{className:"text-base",children:"Deactivate Original Contract"})}),e.jsx(_,{checked:P,onCheckedChange:Y})]})]}),e.jsxs(ve,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(C,{type:"submit",disabled:G||Z,children:s?"Update Contract":"Create Contract"})]})]})})]})]})}export{_e as M,Be as a,Me as s};
1
+ import{v as re,bJ as N,bK as S,g as K,c8 as se,r as p,t as k,i as Q,c9 as ie,ca as B,bI as X,ay as V,u as ce,cb as oe,z as le,E as de,a7 as ue,w,j as e,D as me,aL as pe,B as C,ah as he,a3 as U,x as xe,al as je,am as ye,an as ge,V as Ce,Y as o,Z as l,_ as d,$ as u,I as f,a1 as m,ag as fe,a4 as De,ao as T,ap as I,aq as O,ar as A,as as L,at as _,aQ as be,bb as we,a2 as ke,au as ve,cc as Ne,aw as v,ab as H,ax as Te,be as Ie,ac as Oe,aa as Ae,ad as J,aA as Le,bf as Se}from"./index-BWAOW53d.js";const Pe=[["path",{d:"M5 7a2 2 0 0 0-2 2v11",key:"1yhqjt"}],["path",{d:"M5.803 18H5a2 2 0 0 0 0 4h9.5a.5.5 0 0 0 .5-.5V21",key:"edzzo5"}],["path",{d:"M9 15V4a2 2 0 0 1 2-2h9.5a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H11a2 2 0 0 1 0-4h10",key:"1nwzrg"}]],Ee=re("book-copy",Pe);function Me(c){switch(c){case N.Annual:return"Annual";case N.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${c}`)}}function Be(c){switch(c){case S.Enterprise:return"Enterprise";case S.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${c}`)}}const Ve="createContract",ze=()=>{const[{fetching:c},h]=K(se),g=p.useCallback(async x=>{const y=`Error creating new contract for client[${x.input.clientId}]`,s=`${Ve}-${x.input.clientId}`;k.loading("Creating contract",{id:s});try{const i=await h(x);Q(i,y,s)&&k.success("Success",{id:s,description:`Contract for client ${x.input.clientId} was successfully created`})}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{creating:c,createContract:g}},Fe="updateContract",$e=()=>{const[{fetching:c},h]=K(ie),g=p.useCallback(async x=>{const y=`Error updating contract ID [${x.contractId}]`,s=`${Fe}-${x.contractId}`;k.loading("Updating contract",{id:s});try{const i=await h(x),D=Q(i,y,s,"updateContract");if(D)return k.success("Success",{id:s,description:"Contract updated"}),D.updateContract}catch(i){console.error(`${y}: ${i}`),k.error("Error",{id:s,description:y,duration:1e5,closeButton:!0})}},[h]);return{updating:c,updateContract:g}},Re=ue({id:Le().optional(),startDate:J("Start date is required"),endDate:J("End date is required"),pos:Ae(H()),paymentAmount:Oe().min(0,"Payment amount must be non-negative"),paymentCurrency:v(Object.values(V),"Currency is required"),productType:v(Object.values(X)).optional(),msCloudLink:Ie().optional().or(Se("")),billingCycle:v(Object.values(N)).optional(),subscriptionPlan:v(Object.values(S)).optional(),isActive:Te(),defaultRemark:H().optional(),defaultDocumentType:v(Object.values(B)),operationsLimit:Ne().min(BigInt(0),"Operations limit must be non-negative")}),qe={startDate:"",endDate:"",pos:[],paymentAmount:0,paymentCurrency:V.Usd,productType:X.Hive,msCloudLink:void 0,billingCycle:N.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:B.Proforma,operationsLimit:BigInt(0)};function _e({clientId:c,contract:h,contractId:g,onDone:x,duplicate:y}){const{isEditing:s,isDuplicating:i}=p.useMemo(()=>{const t=!!h||!!g,n=y===!0&&t;return{isEditing:t&&!n,isDuplicating:n}},[h,g,y]),[D,b]=p.useState(!1),[P,Y]=p.useState(!1),[r,z]=p.useState(qe),[F,$]=p.useState(""),{updateContract:R,updating:Z}=$e(),{createContract:E,creating:G}=ze(),[{data:M,fetching:W}]=ce({query:oe,pause:!g||!D,variables:{contractId:g??""}}),a=le({resolver:de(Re),defaultValues:r}),q=()=>{const t=F.trim();if(t){const n=a.getValues("pos");n.includes(t)||a.setValue("pos",[...n,t],{shouldDirty:!0}),$("")}},ee=t=>{const n=a.getValues("pos");a.setValue("pos",n.filter((j,ae)=>ae!==t),{shouldDirty:!0})};p.useEffect(()=>{h&&z(h)},[h]),p.useEffect(()=>{if(M?.contractsById){const t=M.contractsById,n={startDate:t.startDate,endDate:t.endDate,pos:t.purchaseOrders,paymentAmount:t.amount.raw,paymentCurrency:t.amount.currency,productType:t.product??void 0,msCloudLink:t.msCloud?.toString()??void 0,billingCycle:t.billingCycle,subscriptionPlan:t.plan??void 0,isActive:t.isActive,defaultRemark:t.remarks??void 0,defaultDocumentType:t.documentType,operationsLimit:BigInt(t.operationsLimit)};z({id:t.id,...n})}},[M]);const te=p.useMemo(()=>r?JSON.stringify(r):null,[r]);p.useEffect(()=>{r&&a.reset({startDate:r.startDate,endDate:r.endDate,pos:r.pos,paymentAmount:r.paymentAmount,paymentCurrency:r.paymentCurrency,productType:r.productType,msCloudLink:r.msCloudLink,billingCycle:r.billingCycle,subscriptionPlan:r.subscriptionPlan,isActive:r.isActive,defaultRemark:r.defaultRemark,defaultDocumentType:r.defaultDocumentType,operationsLimit:BigInt(r.operationsLimit)})},[te,a.reset]);const ne=p.useCallback(async t=>{if(i||s){if(!r?.id)return;if(i){if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit,deactivateContracts:P?[r.id]:void 0}})}else await R({contractId:r.id,input:{amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}else{if(!t.billingCycle){a.setError("billingCycle",{message:"Billing cycle is required"});return}await E({input:{clientId:c,amount:{raw:t.paymentAmount,currency:t.paymentCurrency},billingCycle:t.billingCycle,documentType:t.defaultDocumentType,endDate:w(new Date(t.endDate),"yyyy-MM-dd"),isActive:t.isActive,msCloud:t.msCloudLink,plan:t.subscriptionPlan,product:t.productType,purchaseOrders:t.pos,remarks:t.defaultRemark,startDate:w(new Date(t.startDate),"yyyy-MM-dd"),operationsLimit:t.operationsLimit}})}b(!1),x?.()},[r,x,E,R,c,a,s,i,P]);return e.jsxs(me,{open:D,onOpenChange:b,children:[e.jsx(pe,{asChild:!0,children:s?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(he,{className:"size-5"})}):i?e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>b(!0),children:e.jsx(Ee,{className:"size-5"})}):e.jsxs(C,{size:"sm",onClick:()=>b(!0),children:[e.jsx(U,{className:"size-4 mr-2"}),"New Contract"]})}),e.jsxs(xe,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(je,{children:[e.jsx(ye,{children:s?"Edit Contract":"Create New Contract"}),e.jsx(ge,{children:s?"Update contract details":i?"Create a new contract based on an existing one":"Add a new contract with all required details"})]}),W?e.jsx(e.Fragment,{children:"Fetching contract details..."}):e.jsx(Ce,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(ne),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"operationsLimit",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Operations Limit"}),e.jsx(u,{children:e.jsx(f,{placeholder:"500",...t,value:t.value?.toLocaleString(),onChange:n=>{const j=n.target.value.replace(/[^0-9]/g,"");t.onChange(BigInt(j||0))}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"pos",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Purchase Orders"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{placeholder:"Add PO...",value:F,onChange:n=>$(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),q())}}),e.jsx(C,{type:"button",size:"sm",onClick:q,children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.value?.map((n,j)=>e.jsxs(fe,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[n,j===(t.value?.length??0)-1&&e.jsx(C,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>ee(j),children:e.jsx(De,{className:"size-3 cursor-pointer flex-shrink-0"})})]},n))}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"startDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"Start Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"endDate",render:({field:{onChange:t,...n}})=>e.jsxs(l,{children:[e.jsx(d,{children:"End Date"}),e.jsx(u,{children:e.jsx(f,{type:"date",...n,onInput:j=>t(j)})}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(o,{control:a.control,name:"paymentAmount",render:({field:t})=>e.jsxs(l,{className:"md:col-span-2",children:[e.jsx(d,{children:"Payment Amount"}),e.jsx(u,{children:e.jsx(f,{type:"number",placeholder:"24000",...t,onChange:n=>{t.onChange(n?.target.value?Number(n?.target.value):void 0)}})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"paymentCurrency",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Currency"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(V).map(n=>e.jsx(L,{value:n,children:n},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"productType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Product Type"}),e.jsx(u,{children:e.jsx(f,{placeholder:"Cloud Services",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"billingCycle",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Billing Cycle"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(N).map(n=>e.jsx(L,{value:n,children:Me(n)},n))})]}),e.jsx(m,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(o,{control:a.control,name:"subscriptionPlan",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Subscription Plan"}),e.jsx(u,{children:e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(S).map(n=>e.jsx(L,{value:n,children:Be(n)},n))})]})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"isActive",render:({field:t})=>e.jsxs(l,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(d,{className:"text-base",children:"Active Status"})}),e.jsx(u,{children:e.jsx(_,{checked:t.value,onCheckedChange:t.onChange})})]})})]}),e.jsx(o,{control:a.control,name:"msCloudLink",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"MS Cloud Link"}),e.jsx(u,{children:e.jsx(f,{type:"url",placeholder:"https://portal.azure.com/contract-id",...t})}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultDocumentType",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Document Type"}),e.jsxs(T,{onValueChange:t.onChange,defaultValue:t.value,children:[e.jsx(u,{children:e.jsx(I,{children:e.jsx(O,{})})}),e.jsx(A,{children:Object.values(B).map(n=>e.jsx(L,{value:n,children:be(n)},n))})]}),e.jsx(m,{})]})}),e.jsx(o,{control:a.control,name:"defaultRemark",render:({field:t})=>e.jsxs(l,{children:[e.jsx(d,{children:"Default Remark"}),e.jsx(u,{children:e.jsx(we,{placeholder:"Enter default remark for this contract...",rows:3,...t})}),e.jsx(m,{})]})}),i&&e.jsxs("div",{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(ke,{className:"text-base",children:"Deactivate Original Contract"})}),e.jsx(_,{checked:P,onCheckedChange:Y})]})]}),e.jsxs(ve,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(C,{type:"submit",disabled:G||Z,children:s?"Update Contract":"Create Contract"})]})]})})]})]})}export{_e as M,Be as a,Me as s};
@@ -1 +1 @@
1
- import{j as e,X as x}from"./index-CNNawG6D.js";function r({children:t,title:a,description:s,headerActions:l}){return e.jsxs("div",{className:"flex flex-col gap-5",id:"main-page",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"w-full text-2xl font-bold tracking-tight md:text-3xl",children:a}),s&&e.jsx("p",{className:"mt-2 text-gray-500",children:s})]}),l]}),e.jsx(x,{}),t]})}export{r as P};
1
+ import{j as e,X as x}from"./index-BWAOW53d.js";function r({children:t,title:a,description:s,headerActions:l}){return e.jsxs("div",{className:"flex flex-col gap-5",id:"main-page",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"w-full text-2xl font-bold tracking-tight md:text-3xl",children:a}),s&&e.jsx("p",{className:"mt-2 text-gray-500",children:s})]}),l]}),e.jsx(x,{}),t]})}export{r as P};
@@ -1 +1 @@
1
- import{j as s,J as a,K as e,O as r,W as d}from"./index-CNNawG6D.js";const o=()=>s.jsxs(a,{className:"m-5",children:[s.jsx(e,{children:s.jsx(r,{children:"404"})}),s.jsx(d,{children:s.jsx("p",{children:"Page not found"})})]});export{o as PageNotFound};
1
+ import{j as s,J as a,K as e,O as r,W as d}from"./index-BWAOW53d.js";const o=()=>s.jsxs(a,{className:"m-5",children:[s.jsx(e,{children:s.jsx(r,{children:"404"})}),s.jsx(d,{children:s.jsx("p",{children:"Page not found"})})]});export{o as PageNotFound};
@@ -1 +1 @@
1
- import{v as e}from"./index-CNNawG6D.js";const t=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]],a=e("panel-top-close",t);const o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]],c=e("panel-top-open",o);export{a as P,c as a};
1
+ import{v as e}from"./index-BWAOW53d.js";const t=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]],a=e("panel-top-close",t);const o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]],c=e("panel-top-open",o);export{a as P,c as a};
@@ -1 +1 @@
1
- import{r as i,G as c,ge as m,j as t,gf as j}from"./index-CNNawG6D.js";import{T as h}from"./toggle-expansion-button-wmsjVpKZ.js";import{T as x}from"./Table-BPmZ5ljQ.js";const p=({subCommentaryData:o,dataRow:a})=>{const[s,l]=i.useState(!1),r=o.map(e=>c(m,e)),d=t.jsx(h,{toggleExpansion:l,isExpanded:s});return t.jsxs(t.Fragment,{children:[a(d),s&&t.jsx("tr",{children:t.jsx("td",{colSpan:99,children:t.jsxs(x,{striped:!0,highlightOnHover:!0,className:"ml-8 w-full h-full",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Entity"}),t.jsx("th",{children:"Amount"})]})}),t.jsxs("tbody",{children:[r?.sort((e,n)=>e.financialEntity.name.localeCompare(n.financialEntity.name)).map(e=>t.jsxs("tr",{children:[t.jsx("td",{children:e.financialEntity.name}),t.jsx("td",{children:e.amount.formatted})]},e.financialEntity.id)),t.jsx("tr",{children:t.jsx("td",{colSpan:8})})]})]})})})]})},f=({commentaryData:o,dataRow:a})=>{const[s,l]=i.useState(!1),{records:r}=c(j,o),d=r.length?t.jsx(h,{toggleExpansion:l,isExpanded:s}):null;return t.jsxs(t.Fragment,{children:[a(d),s&&t.jsx("tr",{children:t.jsx("td",{colSpan:99,children:t.jsxs(x,{striped:!0,highlightOnHover:!0,className:"ml-8 w-full h-full",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Sort Code"}),t.jsx("th",{children:"Amount"}),t.jsx("th",{})]})}),t.jsxs("tbody",{children:[r?.sort((e,n)=>e.sortCode.key-n.sortCode.key).map(e=>t.jsx(p,{dataRow:n=>t.jsxs("tr",{children:[t.jsxs("td",{children:[e.sortCode.key," - ",e.sortCode.name]}),t.jsx("td",{children:e.amount.formatted}),t.jsx("td",{children:n})]},e.sortCode.key),subCommentaryData:e.records},e.sortCode.key)),t.jsx("tr",{children:t.jsx("td",{colSpan:8})})]})]})})})]})};export{f as R};
1
+ import{r as i,G as c,ge as m,j as t,gf as j}from"./index-BWAOW53d.js";import{T as h}from"./toggle-expansion-button-wXVsrHLI.js";import{T as x}from"./Table-LzLjpZeA.js";const p=({subCommentaryData:o,dataRow:a})=>{const[s,l]=i.useState(!1),r=o.map(e=>c(m,e)),d=t.jsx(h,{toggleExpansion:l,isExpanded:s});return t.jsxs(t.Fragment,{children:[a(d),s&&t.jsx("tr",{children:t.jsx("td",{colSpan:99,children:t.jsxs(x,{striped:!0,highlightOnHover:!0,className:"ml-8 w-full h-full",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Entity"}),t.jsx("th",{children:"Amount"})]})}),t.jsxs("tbody",{children:[r?.sort((e,n)=>e.financialEntity.name.localeCompare(n.financialEntity.name)).map(e=>t.jsxs("tr",{children:[t.jsx("td",{children:e.financialEntity.name}),t.jsx("td",{children:e.amount.formatted})]},e.financialEntity.id)),t.jsx("tr",{children:t.jsx("td",{colSpan:8})})]})]})})})]})},f=({commentaryData:o,dataRow:a})=>{const[s,l]=i.useState(!1),{records:r}=c(j,o),d=r.length?t.jsx(h,{toggleExpansion:l,isExpanded:s}):null;return t.jsxs(t.Fragment,{children:[a(d),s&&t.jsx("tr",{children:t.jsx("td",{colSpan:99,children:t.jsxs(x,{striped:!0,highlightOnHover:!0,className:"ml-8 w-full h-full",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Sort Code"}),t.jsx("th",{children:"Amount"}),t.jsx("th",{})]})}),t.jsxs("tbody",{children:[r?.sort((e,n)=>e.sortCode.key-n.sortCode.key).map(e=>t.jsx(p,{dataRow:n=>t.jsxs("tr",{children:[t.jsxs("td",{children:[e.sortCode.key," - ",e.sortCode.name]}),t.jsx("td",{children:e.amount.formatted}),t.jsx("td",{children:n})]},e.sortCode.key),subCommentaryData:e.records},e.sortCode.key)),t.jsx("tr",{children:t.jsx("td",{colSpan:8})})]})]})})})]})};export{f as R};
@@ -1 +1 @@
1
- import{v as a}from"./index-CNNawG6D.js";const e=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],o=a("save",e);export{o as S};
1
+ import{v as a}from"./index-BWAOW53d.js";const e=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],o=a("save",e);export{o as S};
@@ -1 +1 @@
1
- import{g as j,h9 as S,r as g,t as h,i as w,ha as y,u as b,hb as C,j as a,D as v,x as R,y as I,c as M,aF as x,bX as k,c4 as A,c5 as E,al as $,am as N,B as V,J as F,bN as K,bO as U,bP as f,bQ as B,c1 as p,bR as H,bS as P,p as T,w as D}from"./index-CNNawG6D.js";const O="updateTransaction",X=()=>{const[{fetching:e},s]=j(S),n=g.useCallback(async i=>{const d=`Error updating transaction ID [${i.transactionId}]`,c=`${O}-${i.transactionId}`;h.loading("Updating Transaction",{id:c});try{const l=await s(i),o=w(l,d,c,"updateTransaction");if(o)return h.success("Success",{id:c,description:"Transaction updated"}),o.updateTransaction}catch(l){console.error(`${d}: ${l}`),h.error("Error",{id:c,description:d,duration:1e5,closeButton:!0})}},[s]);return{fetching:e,updateTransaction:n}},Q="updateTransactions",_=()=>{const[{fetching:e},s]=j(y),n=g.useCallback(async i=>{const d=Array.isArray(i.transactionIds)?i.transactionIds.join(", "):i.transactionIds,c=`Error updating transactions ID [${d}]`,l=`${Q}-${d}`;h.loading("Updating Transactions",{id:l});try{const o=await s(i),u=w(o,c,l,"updateTransactions");if(u)return h.success("Success",{id:l,description:"Transactions updated"}),u.updateTransactions.transactions.map(m=>m.id)}catch(o){console.error(`${c}: ${o}`),h.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[s]);return{fetching:e,updateTransactions:n}},q=[{id:"select",header:({table:e})=>a.jsx(T,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:s=>e.toggleAllPageRowsSelected(!!s),"aria-label":"Select all"}),cell:({row:e})=>a.jsx(T,{checked:e.getIsSelected(),onCheckedChange:s=>e.toggleSelected(!!s),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1},{accessorKey:"accountType",header:"Type",cell:({row:e})=>a.jsx("div",{children:e.getValue("accountType")})},{accessorKey:"accountName",header:"Account",cell:({row:e})=>a.jsx("div",{children:e.getValue("accountName")})},{accessorKey:"amountRaw",header:"Amount",cell:({row:e})=>a.jsx("div",{children:e.original.amountFormatted})},{accessorKey:"sourceDescription",header:"Description",cell:({row:e})=>a.jsx("div",{children:e.getValue("sourceDescription")})},{accessorKey:"eventDate",header:"Event Date",cell:({row:e})=>a.jsx("div",{children:D(e.getValue("eventDate"),"yyyy-MM-dd")})},{accessorKey:"valueDate",header:"Value Date",cell:({row:e})=>a.jsx("div",{children:e.getValue("valueDate")?D(e.getValue("valueDate"),"yyyy-MM-dd"):""})}];function z({transactionId:e,counterpartyId:s,open:n,onOpenChange:i,onClose:d}){const[{data:c,fetching:l},o]=b({pause:!0,query:C,variables:{transactionId:e,withMissingInfo:!0}});g.useEffect(()=>{n&&s&&o()},[n,s,o,e]);const u=g.useCallback(r=>{i(r),n&&!r&&d?.()},[i,d,n]),m=g.useMemo(()=>{const r=c?.similarTransactions.map(t=>({id:t.id,amountRaw:t.amount.raw,amountFormatted:t.amount.formatted,sourceDescription:t.sourceDescription,eventDate:new Date(t.eventDate),valueDate:t.effectiveDate?new Date(t.effectiveDate):void 0,accountType:t.account.type,accountName:t.account.name}))??[];return c&&r.length===0&&u(!1),r},[c,u]);return a.jsx(v,{open:n&&!!s&&m.length>0,onOpenChange:u,children:a.jsx(R,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",children:a.jsx(I,{fallback:a.jsx("div",{children:"Error fetching similar transactions"}),children:l?a.jsx(M,{}):s?a.jsx(J,{data:m,counterpartyId:s,onOpenChange:u}):null})})})}function J({data:e,counterpartyId:s,onOpenChange:n}){const[i,d]=x.useState([]),[c,l]=x.useState({}),o=k({data:e,columns:q,onSortingChange:d,getCoreRowModel:E(),getSortedRowModel:A(),onRowSelectionChange:l,state:{sorting:i,rowSelection:c}}),{updateTransactions:u}=_(),m=g.useCallback(async()=>{const r=o.getSelectedRowModel().rows.map(t=>t.original.id);await u({transactionIds:r,fields:{counterpartyId:s}}),n(!1)},[u,n,o,s]);return g.useEffect(()=>{e.length===0&&n(!1)},[e.length,n]),e.length?a.jsxs(a.Fragment,{children:[a.jsxs($,{className:"flex flex-row items-center justify-between",children:[a.jsx(N,{children:"Transactions"}),a.jsx(V,{onClick:m,children:"Approve selected"})]}),a.jsx(F,{children:a.jsxs(K,{children:[a.jsx(U,{children:o.getHeaderGroups().map(r=>a.jsx(f,{children:r.headers.map(t=>a.jsx(B,{children:t.isPlaceholder?null:p(t.column.columnDef.header,t.getContext())},t.id))},r.id))}),a.jsx(H,{children:o.getRowModel().rows.map(r=>a.jsx(f,{"data-state":r.getIsSelected()&&"selected",children:r.getVisibleCells().map(t=>a.jsx(P,{children:p(t.column.columnDef.cell,t.getContext())},t.id))},r.id))})]})})]}):null}export{z as S,X as u};
1
+ import{g as j,h9 as S,r as g,t as h,i as w,ha as y,u as b,hb as C,j as a,D as v,x as R,y as I,c as M,aF as x,bX as k,c4 as A,c5 as E,al as $,am as N,B as V,J as F,bN as K,bO as U,bP as f,bQ as B,c1 as p,bR as H,bS as P,p as T,w as D}from"./index-BWAOW53d.js";const O="updateTransaction",X=()=>{const[{fetching:e},s]=j(S),n=g.useCallback(async i=>{const d=`Error updating transaction ID [${i.transactionId}]`,c=`${O}-${i.transactionId}`;h.loading("Updating Transaction",{id:c});try{const l=await s(i),o=w(l,d,c,"updateTransaction");if(o)return h.success("Success",{id:c,description:"Transaction updated"}),o.updateTransaction}catch(l){console.error(`${d}: ${l}`),h.error("Error",{id:c,description:d,duration:1e5,closeButton:!0})}},[s]);return{fetching:e,updateTransaction:n}},Q="updateTransactions",_=()=>{const[{fetching:e},s]=j(y),n=g.useCallback(async i=>{const d=Array.isArray(i.transactionIds)?i.transactionIds.join(", "):i.transactionIds,c=`Error updating transactions ID [${d}]`,l=`${Q}-${d}`;h.loading("Updating Transactions",{id:l});try{const o=await s(i),u=w(o,c,l,"updateTransactions");if(u)return h.success("Success",{id:l,description:"Transactions updated"}),u.updateTransactions.transactions.map(m=>m.id)}catch(o){console.error(`${c}: ${o}`),h.error("Error",{id:l,description:c,duration:1e5,closeButton:!0})}},[s]);return{fetching:e,updateTransactions:n}},q=[{id:"select",header:({table:e})=>a.jsx(T,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:s=>e.toggleAllPageRowsSelected(!!s),"aria-label":"Select all"}),cell:({row:e})=>a.jsx(T,{checked:e.getIsSelected(),onCheckedChange:s=>e.toggleSelected(!!s),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1},{accessorKey:"accountType",header:"Type",cell:({row:e})=>a.jsx("div",{children:e.getValue("accountType")})},{accessorKey:"accountName",header:"Account",cell:({row:e})=>a.jsx("div",{children:e.getValue("accountName")})},{accessorKey:"amountRaw",header:"Amount",cell:({row:e})=>a.jsx("div",{children:e.original.amountFormatted})},{accessorKey:"sourceDescription",header:"Description",cell:({row:e})=>a.jsx("div",{children:e.getValue("sourceDescription")})},{accessorKey:"eventDate",header:"Event Date",cell:({row:e})=>a.jsx("div",{children:D(e.getValue("eventDate"),"yyyy-MM-dd")})},{accessorKey:"valueDate",header:"Value Date",cell:({row:e})=>a.jsx("div",{children:e.getValue("valueDate")?D(e.getValue("valueDate"),"yyyy-MM-dd"):""})}];function z({transactionId:e,counterpartyId:s,open:n,onOpenChange:i,onClose:d}){const[{data:c,fetching:l},o]=b({pause:!0,query:C,variables:{transactionId:e,withMissingInfo:!0}});g.useEffect(()=>{n&&s&&o()},[n,s,o,e]);const u=g.useCallback(r=>{i(r),n&&!r&&d?.()},[i,d,n]),m=g.useMemo(()=>{const r=c?.similarTransactions.map(t=>({id:t.id,amountRaw:t.amount.raw,amountFormatted:t.amount.formatted,sourceDescription:t.sourceDescription,eventDate:new Date(t.eventDate),valueDate:t.effectiveDate?new Date(t.effectiveDate):void 0,accountType:t.account.type,accountName:t.account.name}))??[];return c&&r.length===0&&u(!1),r},[c,u]);return a.jsx(v,{open:n&&!!s&&m.length>0,onOpenChange:u,children:a.jsx(R,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",children:a.jsx(I,{fallback:a.jsx("div",{children:"Error fetching similar transactions"}),children:l?a.jsx(M,{}):s?a.jsx(J,{data:m,counterpartyId:s,onOpenChange:u}):null})})})}function J({data:e,counterpartyId:s,onOpenChange:n}){const[i,d]=x.useState([]),[c,l]=x.useState({}),o=k({data:e,columns:q,onSortingChange:d,getCoreRowModel:E(),getSortedRowModel:A(),onRowSelectionChange:l,state:{sorting:i,rowSelection:c}}),{updateTransactions:u}=_(),m=g.useCallback(async()=>{const r=o.getSelectedRowModel().rows.map(t=>t.original.id);await u({transactionIds:r,fields:{counterpartyId:s}}),n(!1)},[u,n,o,s]);return g.useEffect(()=>{e.length===0&&n(!1)},[e.length,n]),e.length?a.jsxs(a.Fragment,{children:[a.jsxs($,{className:"flex flex-row items-center justify-between",children:[a.jsx(N,{children:"Transactions"}),a.jsx(V,{onClick:m,children:"Approve selected"})]}),a.jsx(F,{children:a.jsxs(K,{children:[a.jsx(U,{children:o.getHeaderGroups().map(r=>a.jsx(f,{children:r.headers.map(t=>a.jsx(B,{children:t.isPlaceholder?null:p(t.column.columnDef.header,t.getContext())},t.id))},r.id))}),a.jsx(H,{children:o.getRowModel().rows.map(r=>a.jsx(f,{"data-state":r.getIsSelected()&&"selected",children:r.getVisibleCells().map(t=>a.jsx(P,{children:p(t.column.columnDef.cell,t.getContext())},t.id))},r.id))})]})})]}):null}export{z as S,X as u};
@@ -1 +1 @@
1
- import{gP as f}from"./index-CNNawG6D.js";import{a as y}from"./addDays-CIRVLi_y.js";import{s as S}from"./subMonths-I2NCK3sY.js";function T(s,t,o){return y(s,-t,o)}function g(s,t,o){const{years:n=0,months:u=0,weeks:r=0,days:c=0,hours:m=0,minutes:a=0,seconds:e=0}=t,i=S(s,u+n*12,o),b=T(i,c+r*7,o),h=a+m*60,d=(e+h*60)*1e3;return f(s,+b-d)}export{g as s};
1
+ import{gP as f}from"./index-BWAOW53d.js";import{a as y}from"./addDays-z7yxKvSG.js";import{s as S}from"./subMonths-KzuARV4a.js";function T(s,t,o){return y(s,-t,o)}function g(s,t,o){const{years:n=0,months:u=0,weeks:r=0,days:c=0,hours:m=0,minutes:a=0,seconds:e=0}=t,i=S(s,u+n*12,o),b=T(i,c+r*7,o),h=a+m*60,d=(e+h*60)*1e3;return f(s,+b-d)}export{g as s};
@@ -0,0 +1 @@
1
+ import{gW as n}from"./index-BWAOW53d.js";function a(o,s,t){return n(o,-s,t)}export{a as s};
@@ -1 +1 @@
1
- import{fZ as Ct,f_ as Et,f$ as Nt,r as y,eT as X,fW as Dt,eD as pr,aF as m,bx as j,ci as P,by as b,bz as T,fq as ur,g0 as mr,g1 as Tt,dh as Rt,g2 as Mt,g3 as At,fX as Lt,fr as kt,ch as z,ez as Pe,ea as gr,g4 as vr,g5 as Bt,fU as Ie,d7 as be,eB as zt,bu as E,eU as Ht,g as _r,g6 as Ft,t as H,i as yr,G as xe,j as u,e9 as Vt,g7 as Ut,g8 as Xt,bW as Gt,g9 as Wt,et as Kt,R as qt,w as Ce,ga as Yt,gb as Zt,dn as V,ay as U}from"./index-CNNawG6D.js";import{T as Jt}from"./Table-BPmZ5ljQ.js";function Qt(e,r,t){const[n,o]=Ct(t?.in,e,r),a=Ee(n,o),s=Math.abs(Et(n,o));n.setDate(n.getDate()-a*s);const i=+(Ee(n,o)===-a),c=a*(s-i);return c===0?0:c}function Ee(e,r){const t=e.getFullYear()-r.getFullYear()||e.getMonth()-r.getMonth()||e.getDate()-r.getDate()||e.getHours()-r.getHours()||e.getMinutes()-r.getMinutes()||e.getSeconds()-r.getSeconds()||e.getMilliseconds()-r.getMilliseconds();return t<0?-1:t>0?1:t}function Ne(e,r,t){const n=Nt(e,t?.in);return n.setHours(r),n}function Z(e,r){let t=e;for(;(t=t.parentElement)&&!t.matches(r););return t}function en(e,r,t){for(let n=e-1;n>=0;n-=1)if(!r[n].disabled)return n;if(t){for(let n=r.length-1;n>-1;n-=1)if(!r[n].disabled)return n}return e}function rn(e,r,t){for(let n=e+1;n<r.length;n+=1)if(!r[n].disabled)return n;if(t){for(let n=0;n<r.length;n+=1)if(!r[n].disabled)return n}return e}function tn(e,r,t){return Z(e,t)===Z(r,t)}function hr({parentSelector:e,siblingSelector:r,onKeyDown:t,loop:n=!0,activateOnFocus:o=!1,dir:a="rtl",orientation:s}){return i=>{var c;t?.(i);const d=Array.from(((c=Z(i.currentTarget,e))==null?void 0:c.querySelectorAll(r))||[]).filter(_=>tn(i.currentTarget,_,e)),f=d.findIndex(_=>i.currentTarget===_),l=rn(f,d,n),v=en(f,d,n);switch(i.key){case"ArrowRight":break;case"ArrowLeft":break;case"ArrowUp":{i.stopPropagation(),i.preventDefault(),d[v].focus(),o&&d[v].click();break}case"ArrowDown":{i.stopPropagation(),i.preventDefault(),d[l].focus(),o&&d[l].click();break}case"Home":{i.stopPropagation(),i.preventDefault(),!d[0].disabled&&d[0].focus();break}case"End":{i.stopPropagation(),i.preventDefault();const _=d.length-1;!d[_].disabled&&d[_].focus();break}}}}function nn(e,r,t){var n;return t?Array.from(((n=Z(t,r))==null?void 0:n.querySelectorAll(e))||[]).findIndex(o=>o===t):null}function De(e,r){return t=>{if(typeof t!="string"||t.trim().length===0)throw new Error(r);return`${e}-${t}`}}function R(e,r){return t=>{e?.(t),r?.(t)}}function on(){const[e,r]=y.useState(-1);return[e,{setHovered:r,resetHovered:()=>r(-1)}]}const J={context:"Accordion component was not found in the tree",itemContext:"Accordion.Item component was not found in the tree",value:"Accordion.Item component was rendered with invalid value or without value"},[an,Q]=X(J.context);function sn({children:e,multiple:r,value:t,defaultValue:n,onChange:o,id:a,loop:s,transitionDuration:i,disableChevronRotation:c,chevronPosition:d,chevronSize:f,order:l,chevron:v,variant:_,radius:p,classNames:g,styles:h,unstyled:O}){const $=Dt(a),[w,N]=pr({value:t,defaultValue:n,finalValue:r?[]:null,onChange:o}),A=S=>Array.isArray(w)?w.includes(S):S===w,L=S=>{const k=Array.isArray(w)?w.includes(S)?w.filter(I=>I!==S):[...w,S]:S===w?null:S;N(k)};return m.createElement(an,{value:{isItemActive:A,onChange:L,getControlId:De(`${$}-control`,J.value),getRegionId:De(`${$}-panel`,J.value),transitionDuration:i,disableChevronRotation:c,chevronPosition:d,chevronSize:f,order:l,chevron:v,loop:s,variant:_,radius:p,classNames:g,styles:h,unstyled:O}},e)}const[ln,Or]=X(J.itemContext);function cn(e,r,{radius:t}){const n=e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3],o=e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],a=e.fn.radius(t);return r==="default"?{color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderBottom:`${P(1)} solid ${n}`}:r==="contained"?{border:`${P(1)} solid ${n}`,transition:"background-color 150ms ease","&[data-active]":{backgroundColor:o},"&:first-of-type":{borderTopRightRadius:a,borderTopLeftRadius:a,"& > [data-accordion-control]":{borderTopRightRadius:a,borderTopLeftRadius:a}},"&:last-of-type":{borderBottomRightRadius:a,borderBottomLeftRadius:a,"& > [data-accordion-control]":{borderBottomRightRadius:a,borderBottomLeftRadius:a}},"& + &":{borderTop:0}}:r==="filled"?{borderRadius:a,"&[data-active]":{backgroundColor:o}}:r==="separated"?{borderRadius:a,backgroundColor:o,border:`${P(1)} solid transparent`,transition:"background-color 150ms ease","& + &":{marginTop:e.spacing.md},"&[data-active]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,borderColor:n}}:{}}var dn=j((e,r,{variant:t})=>({item:cn(e,t,r)})),fn=Object.defineProperty,ee=Object.getOwnPropertySymbols,$r=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable,Te=(e,r,t)=>r in e?fn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,pn=(e,r)=>{for(var t in r||(r={}))$r.call(r,t)&&Te(e,t,r[t]);if(ee)for(var t of ee(r))wr.call(r,t)&&Te(e,t,r[t]);return e},un=(e,r)=>{var t={};for(var n in e)$r.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ee)for(var n of ee(e))r.indexOf(n)<0&&wr.call(e,n)&&(t[n]=e[n]);return t};const mn={},Pr=y.forwardRef((e,r)=>{const t=b("AccordionItem",mn,e),{children:n,className:o,value:a}=t,s=un(t,["children","className","value"]),i=Q(),{classes:c,cx:d}=dn({radius:i.radius},{name:"Accordion",classNames:i.classNames,styles:i.styles,unstyled:i.unstyled,variant:i.variant});return m.createElement(ln,{value:{value:a}},m.createElement(T,pn({ref:r,className:d(c.item,o),"data-active":i.isItemActive(a)||void 0},s),n))});Pr.displayName="@mantine/core/AccordionItem";var gn=Object.defineProperty,vn=Object.defineProperties,_n=Object.getOwnPropertyDescriptors,Re=Object.getOwnPropertySymbols,yn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,Me=(e,r,t)=>r in e?gn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,K=(e,r)=>{for(var t in r||(r={}))yn.call(r,t)&&Me(e,t,r[t]);if(Re)for(var t of Re(r))hn.call(r,t)&&Me(e,t,r[t]);return e},On=(e,r)=>vn(e,_n(r));function $n(e,r){return r==="default"||r==="contained"?e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]}):{}}var wn=j((e,{transitionDuration:r,chevronPosition:t,chevronSize:n},{variant:o})=>({icon:{display:"flex",alignItems:"center",justifyContent:"center",marginRight:t==="left"?0:e.spacing.sm,marginLeft:t==="left"?e.spacing.lg:0},chevron:{display:"flex",alignItems:"center",justifyContent:"center",transition:`transform ${r}ms ease`,marginRight:t==="right"?0:e.spacing.sm,marginLeft:t==="right"?e.spacing.lg:0,width:P(n),minWidth:P(n),"&[data-rotate]":{transform:"rotate(180deg)"}},label:{color:"inherit",fontWeight:400,flex:1,overflow:"hidden",textOverflow:"ellipsis",paddingTop:e.spacing.md,paddingBottom:e.spacing.md},itemTitle:{margin:0,padding:0},control:On(K(K(K({},e.fn.focusStyles()),e.fn.fontStyles()),$n(e,o)),{width:"100%",display:"flex",alignItems:"center",flexDirection:t==="right"?"row-reverse":"row",paddingRight:e.spacing.md,paddingLeft:t==="right"?`calc(${e.spacing.md} + ${P(4)})`:e.spacing.xs,textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,"&:disabled":K({opacity:.4,cursor:"not-allowed"},e.fn.hover({backgroundColor:"transparent"}))})})),Pn=Object.defineProperty,bn=Object.defineProperties,xn=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertySymbols,br=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,Ae=(e,r,t)=>r in e?Pn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Sn=(e,r)=>{for(var t in r||(r={}))br.call(r,t)&&Ae(e,t,r[t]);if(re)for(var t of re(r))xr.call(r,t)&&Ae(e,t,r[t]);return e},jn=(e,r)=>bn(e,xn(r)),In=(e,r)=>{var t={};for(var n in e)br.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&re)for(var n of re(e))r.indexOf(n)<0&&xr.call(e,n)&&(t[n]=e[n]);return t};const Cn={},Sr=y.forwardRef((e,r)=>{const t=b("AccordionControl",Cn,e),{disabled:n,onKeyDown:o,onClick:a,chevron:s,children:i,className:c,icon:d}=t,f=In(t,["disabled","onKeyDown","onClick","chevron","children","className","icon"]),l=Q(),{value:v}=Or(),{classes:_,cx:p}=wn({transitionDuration:l.transitionDuration,chevronPosition:l.chevronPosition,chevronSize:l.chevronSize,radius:l.radius},{name:"Accordion",classNames:l.classNames,styles:l.styles,unstyled:l.unstyled,variant:l.variant}),g=l.isItemActive(v),h=typeof l.order=="number",O=`h${l.order}`,$=m.createElement(ur,jn(Sn({},f),{ref:r,"data-accordion-control":!0,disabled:n,className:p(_.control,c),onClick:w=>{a?.(w),l.onChange(v)},type:"button","data-active":g||void 0,"aria-expanded":g,"aria-controls":l.getRegionId(v),id:l.getControlId(v),unstyled:l.unstyled,onKeyDown:hr({siblingSelector:"[data-accordion-control]",parentSelector:"[data-accordion]",activateOnFocus:!1,loop:l.loop,orientation:"vertical",onKeyDown:o})}),m.createElement("span",{className:_.chevron,"data-rotate":!l.disableChevronRotation&&g||void 0},s||l.chevron),m.createElement("span",{className:_.label},i),d&&m.createElement("span",{className:_.icon},d));return h?m.createElement(O,{className:_.itemTitle},$):$});Sr.displayName="@mantine/core/AccordionControl";var En=Object.defineProperty,Nn=Object.defineProperties,Dn=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,ke=(e,r,t)=>r in e?En(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Mn=(e,r)=>{for(var t in r||(r={}))Tn.call(r,t)&&ke(e,t,r[t]);if(Le)for(var t of Le(r))Rn.call(r,t)&&ke(e,t,r[t]);return e},An=(e,r)=>Nn(e,Dn(r)),Ln=j((e,r)=>({panel:An(Mn({},e.fn.fontStyles()),{wordBreak:"break-word",lineHeight:e.lineHeight}),content:{padding:e.spacing.md,paddingTop:`calc(${e.spacing.xs} / 2)`}})),kn=Object.defineProperty,Bn=Object.defineProperties,zn=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,Be=(e,r,t)=>r in e?kn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,B=(e,r)=>{for(var t in r||(r={}))jr.call(r,t)&&Be(e,t,r[t]);if(te)for(var t of te(r))Ir.call(r,t)&&Be(e,t,r[t]);return e},$e=(e,r)=>Bn(e,zn(r)),Hn=(e,r)=>{var t={};for(var n in e)jr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&te)for(var n of te(e))r.indexOf(n)<0&&Ir.call(e,n)&&(t[n]=e[n]);return t};function Fn(e){if(!e||typeof e=="string")return 0;const r=e/36;return Math.round((4+15*r**.25+r/5)*10)}function we(e){return e?.current?e.current.scrollHeight:"auto"}const q=typeof window<"u"&&window.requestAnimationFrame;function Vn({transitionDuration:e,transitionTimingFunction:r="ease",onTransitionEnd:t=()=>{},opened:n}){const o=y.useRef(null),a=0,s={display:"none",height:0,overflow:"hidden"},[i,c]=y.useState(n?{}:s),d=p=>{Rt.flushSync(()=>c(p))},f=p=>{d(g=>B(B({},g),p))};function l(p){return{transition:`height ${e||Fn(p)}ms ${r}`}}mr(()=>{q(n?()=>{f({willChange:"height",display:"block",overflow:"hidden"}),q(()=>{const p=we(o);f($e(B({},l(p)),{height:p}))})}:()=>{const p=we(o);f($e(B({},l(p)),{willChange:"height",height:p})),q(()=>f({height:a,overflow:"hidden"}))})},[n]);const v=p=>{if(!(p.target!==o.current||p.propertyName!=="height"))if(n){const g=we(o);g===i.height?d({}):f({height:g}),t()}else i.height===a&&(d(s),t())};function _(p={}){var g=p,{style:h={},refKey:O="ref"}=g,$=Hn(g,["style","refKey"]);const w=$[O];return $e(B({"aria-hidden":!n},$),{[O]:Tt(o,w),onTransitionEnd:v,style:B(B({boxSizing:"border-box"},h),i)})}return _}var Un=Object.defineProperty,ne=Object.getOwnPropertySymbols,Cr=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable,ze=(e,r,t)=>r in e?Un(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Y=(e,r)=>{for(var t in r||(r={}))Cr.call(r,t)&&ze(e,t,r[t]);if(ne)for(var t of ne(r))Er.call(r,t)&&ze(e,t,r[t]);return e},Xn=(e,r)=>{var t={};for(var n in e)Cr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ne)for(var n of ne(e))r.indexOf(n)<0&&Er.call(e,n)&&(t[n]=e[n]);return t};const Gn={transitionDuration:200,transitionTimingFunction:"ease",animateOpacity:!0},Nr=y.forwardRef((e,r)=>{const t=b("Collapse",Gn,e),{children:n,in:o,transitionDuration:a,transitionTimingFunction:s,style:i,onTransitionEnd:c,animateOpacity:d}=t,f=Xn(t,["children","in","transitionDuration","transitionTimingFunction","style","onTransitionEnd","animateOpacity"]),l=Mt(),v=At(),p=(l.respectReducedMotion?v:!1)?0:a,{systemStyles:g,rest:h}=Lt(f),O=Vn({opened:o,transitionDuration:p,transitionTimingFunction:s,onTransitionEnd:c});return p===0?o?m.createElement(T,Y({},h),n):null:m.createElement(T,Y({},O(Y(Y({style:i,ref:r},h),g))),m.createElement("div",{style:{opacity:o||!d?1:0,transition:d?`opacity ${p}ms ${s}`:"none"}},n))});Nr.displayName="@mantine/core/Collapse";var Wn=Object.defineProperty,Kn=Object.defineProperties,qn=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,Dr=Object.prototype.hasOwnProperty,Tr=Object.prototype.propertyIsEnumerable,He=(e,r,t)=>r in e?Wn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Yn=(e,r)=>{for(var t in r||(r={}))Dr.call(r,t)&&He(e,t,r[t]);if(oe)for(var t of oe(r))Tr.call(r,t)&&He(e,t,r[t]);return e},Zn=(e,r)=>Kn(e,qn(r)),Jn=(e,r)=>{var t={};for(var n in e)Dr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&oe)for(var n of oe(e))r.indexOf(n)<0&&Tr.call(e,n)&&(t[n]=e[n]);return t};const Qn={};function Rr(e){const r=b("AccordionPanel",Qn,e),{children:t,className:n}=r,o=Jn(r,["children","className"]),a=Q(),{value:s}=Or(),{classNames:i,styles:c,unstyled:d}=Q(),{classes:f,cx:l}=Ln({radius:a.radius},{name:"Accordion",classNames:i,styles:c,unstyled:d,variant:a.variant});return m.createElement(Nr,Zn(Yn({},o),{className:l(f.panel,n),in:a.isItemActive(s),transitionDuration:a.transitionDuration,role:"region",id:a.getRegionId(s),"aria-labelledby":a.getControlId(s)}),m.createElement("div",{className:f.content},t))}Rr.displayName="@mantine/core/AccordionPanel";var eo=Object.defineProperty,ro=Object.defineProperties,to=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,Fe=(e,r,t)=>r in e?eo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,no=(e,r)=>{for(var t in r||(r={}))Mr.call(r,t)&&Fe(e,t,r[t]);if(ae)for(var t of ae(r))Ar.call(r,t)&&Fe(e,t,r[t]);return e},oo=(e,r)=>ro(e,to(r)),ao=(e,r)=>{var t={};for(var n in e)Mr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ae)for(var n of ae(e))r.indexOf(n)<0&&Ar.call(e,n)&&(t[n]=e[n]);return t};const so={multiple:!1,disableChevronRotation:!1,transitionDuration:200,chevronPosition:"right",variant:"default",chevronSize:24,chevron:m.createElement(kt,null)};function Oe(e){const r=b("Accordion",so,e),{id:t,loop:n,children:o,multiple:a,value:s,defaultValue:i,onChange:c,transitionDuration:d,disableChevronRotation:f,chevronPosition:l,chevronSize:v,order:_,chevron:p,classNames:g,styles:h,unstyled:O,variant:$,radius:w}=r,N=ao(r,["id","loop","children","multiple","value","defaultValue","onChange","transitionDuration","disableChevronRotation","chevronPosition","chevronSize","order","chevron","classNames","styles","unstyled","variant","radius"]);return m.createElement(sn,{id:t,multiple:a,value:s,defaultValue:i,onChange:c,loop:n,transitionDuration:d,disableChevronRotation:f,chevronPosition:l,chevronSize:v,order:_,chevron:p,variant:$,radius:w,classNames:g,styles:h,unstyled:O},m.createElement(T,oo(no({},N),{"data-accordion":!0}),o))}Oe.Item=Pr;Oe.Control=Sr;Oe.Panel=Rr;Oe.displayName="@mantine/core/Accordion";const io={xs:P(12),sm:P(18),md:P(24),lg:P(34),xl:P(42)};var lo=j((e,{color:r,transitionDuration:t},{size:n})=>{const o=z({size:n,sizes:io}),a=r||(e.colorScheme==="dark"?e.white:e.black);return{root:{borderRadius:e.radius.sm,width:`calc(${o} + ${e.spacing.xs})`,height:`calc(${o} + ${e.spacing.xs})`,padding:`calc(${e.spacing.xs} / 2)`,cursor:"pointer"},burger:{position:"relative",userSelect:"none",boxSizing:"border-box","&, &::before, &::after":{display:"block",width:o,height:`calc(${o} / 12)`,backgroundColor:a,outline:`${P(1)} solid transparent`,transitionProperty:"background-color, transform",transitionDuration:`${t}ms`,"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?"0ms":void 0}},"&::before, &::after":{position:"absolute",content:'""',left:0},"&::before":{top:`calc((${o} / 3) * -1)`},"&::after":{top:`calc(${o} / 3)`},"&[data-opened]":{backgroundColor:"transparent","&::before":{transform:`translateY(calc(${o} / 3)) rotate(45deg)`},"&::after":{transform:`translateY(calc(-${o} / 3)) rotate(-45deg)`}}}}}),co=Object.defineProperty,se=Object.getOwnPropertySymbols,Lr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ve=(e,r,t)=>r in e?co(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,fo=(e,r)=>{for(var t in r||(r={}))Lr.call(r,t)&&Ve(e,t,r[t]);if(se)for(var t of se(r))kr.call(r,t)&&Ve(e,t,r[t]);return e},po=(e,r)=>{var t={};for(var n in e)Lr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&se)for(var n of se(e))r.indexOf(n)<0&&kr.call(e,n)&&(t[n]=e[n]);return t};const uo={size:"md",transitionDuration:300},Br=y.forwardRef((e,r)=>{const t=b("Burger",uo,e),{className:n,opened:o,color:a,size:s,classNames:i,styles:c,transitionDuration:d,variant:f}=t,l=po(t,["className","opened","color","size","classNames","styles","transitionDuration","variant"]),{classes:v,cx:_}=lo({color:a,transitionDuration:d},{classNames:i,styles:c,name:"Burger",variant:f,size:s});return m.createElement(ur,fo({className:_(v.root,n),ref:r},l),m.createElement("div",{"data-opened":o||void 0,className:v.burger}))});Br.displayName="@mantine/core/Burger";const zr=y.createContext({padding:0}),mo=zr.Provider,go=()=>y.useContext(zr).padding;var vo=j((e,{padding:r,withBorder:t,inheritPadding:n})=>{const o=z({size:r,sizes:e.spacing}),a=`calc(-1 * ${o})`,s=e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3];return{cardSection:{display:"block",marginLeft:a,marginRight:a,paddingLeft:n?o:void 0,paddingRight:n?o:void 0,borderTop:t?`${P(1)} solid ${s}`:void 0,borderBottom:t?`${P(1)} solid ${s}`:void 0,"& + &":{borderTop:0},"&[data-first]":{marginTop:a,borderTop:0,borderBottom:t?`${P(1)} solid ${s}`:void 0},"&[data-last]":{marginBottom:a,borderBottom:0}}}}),_o=Object.defineProperty,ie=Object.getOwnPropertySymbols,Hr=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable,Ue=(e,r,t)=>r in e?_o(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,yo=(e,r)=>{for(var t in r||(r={}))Hr.call(r,t)&&Ue(e,t,r[t]);if(ie)for(var t of ie(r))Fr.call(r,t)&&Ue(e,t,r[t]);return e},ho=(e,r)=>{var t={};for(var n in e)Hr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ie)for(var n of ie(e))r.indexOf(n)<0&&Fr.call(e,n)&&(t[n]=e[n]);return t};const Oo={withBorder:!1,inheritPadding:!1},Vr=y.forwardRef((e,r)=>{const t=b("CardSection",Oo,e),{className:n,withBorder:o,inheritPadding:a,unstyled:s,variant:i}=t,c=ho(t,["className","withBorder","inheritPadding","unstyled","variant"]),{classes:d,cx:f}=vo({padding:go(),withBorder:o,inheritPadding:a},{name:"Card",unstyled:s,variant:i});return m.createElement(T,yo({className:f(d.cardSection,n),ref:r},c))});Vr.displayName="@mantine/core/CardSection";const Ur=Pe(Vr);var $o=j(e=>({root:{position:"relative",overflow:"hidden",backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white}})),wo=Object.defineProperty,le=Object.getOwnPropertySymbols,Xr=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable,Xe=(e,r,t)=>r in e?wo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Po=(e,r)=>{for(var t in r||(r={}))Xr.call(r,t)&&Xe(e,t,r[t]);if(le)for(var t of le(r))Gr.call(r,t)&&Xe(e,t,r[t]);return e},bo=(e,r)=>{var t={};for(var n in e)Xr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&le)for(var n of le(e))r.indexOf(n)<0&&Gr.call(e,n)&&(t[n]=e[n]);return t};const xo={padding:"md"},Se=y.forwardRef((e,r)=>{const t=b("Card",xo,e),{className:n,padding:o,radius:a,children:s,unstyled:i,variant:c}=t,d=bo(t,["className","padding","radius","children","unstyled","variant"]),{classes:f,cx:l}=$o(null,{name:"Card",unstyled:i,variant:c}),v=y.Children.toArray(s),_=v.map((p,g)=>typeof p=="object"&&p&&"type"in p&&p.type===Ur?y.cloneElement(p,{variant:c,padding:o,"data-first":g===0||void 0,"data-last":g===v.length-1||void 0}):p);return m.createElement(mo,{value:{padding:o}},m.createElement(gr,Po({className:l(f.root,n),radius:a,p:o,ref:r},d),_))});Se.Section=Ur;Se.displayName="@mantine/core/Card";const us=Pe(Se),[So,jo]=X("Grid component was not found in tree");var Io=Object.defineProperty,Ge=Object.getOwnPropertySymbols,Co=Object.prototype.hasOwnProperty,Eo=Object.prototype.propertyIsEnumerable,We=(e,r,t)=>r in e?Io(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,No=(e,r)=>{for(var t in r||(r={}))Co.call(r,t)&&We(e,t,r[t]);if(Ge)for(var t of Ge(r))Eo.call(r,t)&&We(e,t,r[t]);return e};const je=(e,r)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(r/e)}%`:void 0,Wr=(e,r,t)=>t||e==="auto"||e==="content"?"unset":je(e,r),Kr=(e,r)=>{if(e)return e==="auto"||r?1:0},qr=(e,r)=>e===0?0:e?`${100/(r/e)}%`:void 0,Yr=(e,r)=>typeof e<"u"?`calc(${z({size:e,sizes:r.spacing})} / 2)`:void 0;function Do({sizes:e,offsets:r,orders:t,theme:n,columns:o,gutters:a,grow:s}){return vr.reduce((i,c)=>(i[`@media (min-width: ${Bt(n.breakpoints[c])})`]={order:t[c],flexBasis:je(e[c],o),padding:Yr(a[c],n),flexShrink:0,width:e[c]==="content"?"auto":void 0,maxWidth:Wr(e[c],o,s),marginLeft:qr(r[c],o),flexGrow:Kr(e[c],s)},i),{})}var To=j((e,{gutter:r,gutterXs:t,gutterSm:n,gutterMd:o,gutterLg:a,gutterXl:s,grow:i,offset:c,offsetXs:d,offsetSm:f,offsetMd:l,offsetLg:v,offsetXl:_,columns:p,span:g,xs:h,sm:O,md:$,lg:w,xl:N,order:A,orderXs:L,orderSm:S,orderMd:k,orderLg:I,orderXl:x})=>({col:No({boxSizing:"border-box",flexGrow:Kr(g,i),order:A,padding:Yr(r,e),marginLeft:qr(c,p),flexBasis:je(g,p),flexShrink:0,width:g==="content"?"auto":void 0,maxWidth:Wr(g,p,i)},Do({sizes:{xs:h,sm:O,md:$,lg:w,xl:N},offsets:{xs:d,sm:f,md:l,lg:v,xl:_},orders:{xs:L,sm:S,md:k,lg:I,xl:x},gutters:{xs:t,sm:n,md:o,lg:a,xl:s},theme:e,columns:p,grow:i}))})),Ro=Object.defineProperty,ce=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,Jr=Object.prototype.propertyIsEnumerable,Ke=(e,r,t)=>r in e?Ro(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Mo=(e,r)=>{for(var t in r||(r={}))Zr.call(r,t)&&Ke(e,t,r[t]);if(ce)for(var t of ce(r))Jr.call(r,t)&&Ke(e,t,r[t]);return e},Ao=(e,r)=>{var t={};for(var n in e)Zr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ce)for(var n of ce(e))r.indexOf(n)<0&&Jr.call(e,n)&&(t[n]=e[n]);return t};const Lo={};function ko(e){return e==="auto"||e==="content"?!0:typeof e=="number"&&e>0&&e%1===0}const Qr=y.forwardRef((e,r)=>{const t=b("GridCol",Lo,e),{children:n,span:o,offset:a,offsetXs:s,offsetSm:i,offsetMd:c,offsetLg:d,offsetXl:f,xs:l,sm:v,md:_,lg:p,xl:g,order:h,orderXs:O,orderSm:$,orderMd:w,orderLg:N,orderXl:A,className:L,unstyled:S,variant:k}=t,I=Ao(t,["children","span","offset","offsetXs","offsetSm","offsetMd","offsetLg","offsetXl","xs","sm","md","lg","xl","order","orderXs","orderSm","orderMd","orderLg","orderXl","className","unstyled","variant"]),x=jo(),M=o||x.columns,{classes:F,cx:W}=To({gutter:x.gutter,gutterXs:x.gutterXs,gutterSm:x.gutterSm,gutterMd:x.gutterMd,gutterLg:x.gutterLg,gutterXl:x.gutterXl,offset:a,offsetXs:s,offsetSm:i,offsetMd:c,offsetLg:d,offsetXl:f,xs:l,sm:v,md:_,lg:p,xl:g,order:h,orderXs:O,orderSm:$,orderMd:w,orderLg:N,orderXl:A,grow:x.grow,columns:x.columns,span:M},{unstyled:S,name:"Grid",variant:k});return!ko(M)||M>x.columns?null:m.createElement(T,Mo({className:W(F.col,L),ref:r},I),n)});Qr.displayName="@mantine/core/Col";var Bo=Object.defineProperty,qe=Object.getOwnPropertySymbols,zo=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable,Ye=(e,r,t)=>r in e?Bo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Fo=(e,r)=>{for(var t in r||(r={}))zo.call(r,t)&&Ye(e,t,r[t]);if(qe)for(var t of qe(r))Ho.call(r,t)&&Ye(e,t,r[t]);return e};function Vo(e,r){return vr.reduce((t,n)=>(typeof e[n]<"u"&&(t[`@media (min-width: ${r.breakpoints[n]})`]={margin:`calc(-${z({size:e[n],sizes:r.spacing})} / 2)`}),t),{})}var Uo=j((e,{justify:r,align:t,gutter:n,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c})=>({root:Fo({margin:`calc(-${z({size:n,sizes:e.spacing})} / 2)`,display:"flex",flexWrap:"wrap",justifyContent:r,alignItems:t},Vo({xs:o,sm:a,md:s,lg:i,xl:c},e))})),Xo=Object.defineProperty,de=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,Ze=(e,r,t)=>r in e?Xo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Go=(e,r)=>{for(var t in r||(r={}))et.call(r,t)&&Ze(e,t,r[t]);if(de)for(var t of de(r))rt.call(r,t)&&Ze(e,t,r[t]);return e},Wo=(e,r)=>{var t={};for(var n in e)et.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&de)for(var n of de(e))r.indexOf(n)<0&&rt.call(e,n)&&(t[n]=e[n]);return t};const Ko={gutter:"md",justify:"flex-start",align:"stretch",columns:12},C=y.forwardRef((e,r)=>{const t=b("Grid",Ko,e),{gutter:n,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c,children:d,grow:f,justify:l,align:v,columns:_,className:p,unstyled:g,variant:h}=t,O=Wo(t,["gutter","gutterXs","gutterSm","gutterMd","gutterLg","gutterXl","children","grow","justify","align","columns","className","unstyled","variant"]),{classes:$,cx:w}=Uo({gutter:n,justify:l,align:v,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c},{unstyled:g,name:"Grid",variant:h});return m.createElement(So,{value:{gutter:n,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c,grow:f,columns:_}},m.createElement(T,Go({className:w($.root,p),ref:r},O),d))});C.Col=Qr;C.displayName="@mantine/core/Grid";function qo({open:e,close:r,openDelay:t,closeDelay:n}){const o=y.useRef(-1),a=y.useRef(-1),s=()=>{window.clearTimeout(o.current),window.clearTimeout(a.current)},i=()=>{s(),t===0?e():o.current=window.setTimeout(e,t)},c=()=>{s(),n===0?r():a.current=window.setTimeout(r,n)};return y.useEffect(()=>s,[]),{openDropdown:i,closeDropdown:c}}const[Yo,Zo]=X("List component was not found in tree");var Jo=j((e,{spacing:r,center:t})=>({itemWrapper:{ref:Ie("itemWrapper"),display:"inline-flex",flexDirection:"column",whiteSpace:"normal"},item:{whiteSpace:"nowrap",lineHeight:t?1:e.lineHeight,"&:not(:first-of-type)":{marginTop:z({size:r,sizes:e.spacing})},"&[data-with-icon]":{listStyle:"none",[`& .${Ie("itemWrapper")}`]:{display:"inline-flex",alignItems:t?"center":"flex-start",flexDirection:"row"}}},itemIcon:{display:"inline-block",verticalAlign:"middle",marginRight:e.spacing.sm}})),Qo=Object.defineProperty,fe=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,Je=(e,r,t)=>r in e?Qo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ea=(e,r)=>{for(var t in r||(r={}))tt.call(r,t)&&Je(e,t,r[t]);if(fe)for(var t of fe(r))nt.call(r,t)&&Je(e,t,r[t]);return e},ra=(e,r)=>{var t={};for(var n in e)tt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&fe)for(var n of fe(e))r.indexOf(n)<0&&nt.call(e,n)&&(t[n]=e[n]);return t};const ta={},ot=y.forwardRef((e,r)=>{const t=b("ListItem",ta,e),{className:n,children:o,icon:a}=t,s=ra(t,["className","children","icon"]),{icon:i,spacing:c,center:d,listStyleType:f,size:l,withPadding:v,classNames:_,styles:p,unstyled:g,variant:h}=Zo(),O=a||i,{classes:$,cx:w}=Jo({withPadding:v,listStyleType:f,center:d,spacing:c},{classNames:_,styles:p,unstyled:g,name:"List",variant:h,size:l});return m.createElement(T,ea({component:"li",className:w($.item,n),"data-with-icon":!!O||void 0,ref:r},s),m.createElement("div",{className:$.itemWrapper},O&&m.createElement("span",{className:$.itemIcon},O),m.createElement("span",null,o)))});ot.displayName="@mantine/core/ListItem";var na=Object.defineProperty,oa=Object.defineProperties,aa=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,sa=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,er=(e,r,t)=>r in e?na(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,la=(e,r)=>{for(var t in r||(r={}))sa.call(r,t)&&er(e,t,r[t]);if(Qe)for(var t of Qe(r))ia.call(r,t)&&er(e,t,r[t]);return e},ca=(e,r)=>oa(e,aa(r)),da=j((e,{withPadding:r,listStyleType:t},{size:n})=>({root:ca(la({},e.fn.fontStyles()),{listStyleType:t,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,fontSize:z({size:n,sizes:e.fontSizes}),lineHeight:e.lineHeight,margin:0,paddingLeft:r?e.spacing.xl:0,listStylePosition:"inside"})})),fa=Object.defineProperty,pe=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,rr=(e,r,t)=>r in e?fa(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,pa=(e,r)=>{for(var t in r||(r={}))at.call(r,t)&&rr(e,t,r[t]);if(pe)for(var t of pe(r))st.call(r,t)&&rr(e,t,r[t]);return e},ua=(e,r)=>{var t={};for(var n in e)at.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&pe)for(var n of pe(e))r.indexOf(n)<0&&st.call(e,n)&&(t[n]=e[n]);return t};const ma={type:"unordered",size:"md",spacing:0},ue=y.forwardRef((e,r)=>{const t=b("List",ma,e),{children:n,type:o,size:a,listStyleType:s,withPadding:i,center:c,spacing:d,icon:f,className:l,styles:v,classNames:_,unstyled:p,variant:g}=t,h=ua(t,["children","type","size","listStyleType","withPadding","center","spacing","icon","className","styles","classNames","unstyled","variant"]),{classes:O,cx:$}=da({withPadding:i,listStyleType:s,center:c,spacing:d},{classNames:_,styles:v,name:"List",unstyled:p,size:a,variant:g});return m.createElement(Yo,{value:{spacing:d,center:c,icon:f,listStyleType:s,size:a,withPadding:i,classNames:_,styles:v,unstyled:p,variant:g}},m.createElement(T,pa({component:o==="unordered"?"ul":"ol",className:$(O.root,l),ref:r},h),n))});ue.Item=ot;ue.displayName="@mantine/core/List";const it={context:"Menu component was not found in the tree",children:"Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[ga,G]=X(it.context);var va=j(e=>({divider:{marginTop:P(4),marginBottom:P(4),borderTop:`${P(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`}})),_a=Object.defineProperty,me=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,tr=(e,r,t)=>r in e?_a(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ya=(e,r)=>{for(var t in r||(r={}))lt.call(r,t)&&tr(e,t,r[t]);if(me)for(var t of me(r))ct.call(r,t)&&tr(e,t,r[t]);return e},ha=(e,r)=>{var t={};for(var n in e)lt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&me)for(var n of me(e))r.indexOf(n)<0&&ct.call(e,n)&&(t[n]=e[n]);return t};const Oa={},dt=y.forwardRef((e,r)=>{const t=b("MenuDivider",Oa,e),{children:n,className:o}=t,a=ha(t,["children","className"]),{classNames:s,styles:i,unstyled:c,variant:d}=G(),{classes:f,cx:l}=va(null,{name:"Menu",classNames:s,styles:i,unstyled:c,variant:d});return m.createElement(T,ya({className:l(f.divider,o),ref:r},a))});dt.displayName="@mantine/core/MenuDivider";var $a=Object.defineProperty,ge=Object.getOwnPropertySymbols,ft=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,nr=(e,r,t)=>r in e?$a(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,wa=(e,r)=>{for(var t in r||(r={}))ft.call(r,t)&&nr(e,t,r[t]);if(ge)for(var t of ge(r))pt.call(r,t)&&nr(e,t,r[t]);return e},Pa=(e,r)=>{var t={};for(var n in e)ft.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ge)for(var n of ge(e))r.indexOf(n)<0&&pt.call(e,n)&&(t[n]=e[n]);return t};const ba={};function ut(e){const r=b("MenuDropdown",ba,e),{children:t,onMouseEnter:n,onMouseLeave:o}=r,a=Pa(r,["children","onMouseEnter","onMouseLeave"]),s=y.useRef(),i=G(),c=l=>{var v;(l.key==="ArrowUp"||l.key==="ArrowDown")&&(l.preventDefault(),(v=s.current.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||v.focus())},d=R(n,()=>i.trigger==="hover"&&i.openDropdown()),f=R(o,()=>i.trigger==="hover"&&i.closeDropdown());return m.createElement(be.Dropdown,wa({onMouseEnter:d,onMouseLeave:f,role:"menu","aria-orientation":"vertical"},a),m.createElement("div",{tabIndex:-1,"data-menu-dropdown":!0,"data-autofocus":!0,onKeyDown:c,ref:s,style:{outline:0}},t))}ut.displayName="@mantine/core/MenuDropdown";var xa=Object.defineProperty,Sa=Object.defineProperties,ja=Object.getOwnPropertyDescriptors,or=Object.getOwnPropertySymbols,Ia=Object.prototype.hasOwnProperty,Ca=Object.prototype.propertyIsEnumerable,ar=(e,r,t)=>r in e?xa(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Ea=(e,r)=>{for(var t in r||(r={}))Ia.call(r,t)&&ar(e,t,r[t]);if(or)for(var t of or(r))Ca.call(r,t)&&ar(e,t,r[t]);return e},Na=(e,r)=>Sa(e,ja(r)),Da=j((e,{color:r,radius:t})=>({item:Na(Ea({},e.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:e.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",textDecoration:"none",boxSizing:"border-box",padding:`${e.spacing.xs} ${e.spacing.sm}`,cursor:"pointer",borderRadius:e.fn.radius(t),color:r?e.fn.variant({variant:"filled",primaryFallback:!1,color:r}).background:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"flex",alignItems:"center","&:disabled":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],pointerEvents:"none",userSelect:"none"},"&[data-hovered]":{backgroundColor:r?e.fn.variant({variant:"light",color:r}).background:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[3],.35):e.colors.gray[1]}}),itemLabel:{flex:1},itemIcon:{display:"flex",justifyContent:"center",alignItems:"center",marginRight:e.spacing.xs},itemRightSection:{}})),Ta=Object.defineProperty,Ra=Object.defineProperties,Ma=Object.getOwnPropertyDescriptors,ve=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,sr=(e,r,t)=>r in e?Ta(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Aa=(e,r)=>{for(var t in r||(r={}))mt.call(r,t)&&sr(e,t,r[t]);if(ve)for(var t of ve(r))gt.call(r,t)&&sr(e,t,r[t]);return e},La=(e,r)=>Ra(e,Ma(r)),ka=(e,r)=>{var t={};for(var n in e)mt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ve)for(var n of ve(e))r.indexOf(n)<0&&gt.call(e,n)&&(t[n]=e[n]);return t};const Ba={},vt=y.forwardRef((e,r)=>{const t=b("MenuItem",Ba,e),{children:n,className:o,color:a,closeMenuOnClick:s,icon:i,rightSection:c}=t,d=ka(t,["children","className","color","closeMenuOnClick","icon","rightSection"]),f=G(),{classes:l,cx:v,theme:_}=Da({radius:f.radius,color:a},{name:"Menu",classNames:f.classNames,styles:f.styles,unstyled:f.unstyled,variant:f.variant}),p=y.useRef(),g=f.getItemIndex(p.current),h=d,O=R(h.onMouseLeave,()=>f.setHovered(-1)),$=R(h.onMouseEnter,()=>f.setHovered(f.getItemIndex(p.current))),w=R(h.onClick,()=>{typeof s=="boolean"?s&&f.closeDropdownImmediately():f.closeOnItemClick&&f.closeDropdownImmediately()}),N=R(h.onFocus,()=>f.setHovered(f.getItemIndex(p.current)));return m.createElement(T,La(Aa({component:"button",type:"button"},d),{tabIndex:-1,onFocus:N,className:v(l.item,o),ref:zt(p,r),role:"menuitem","data-menu-item":!0,"data-hovered":f.hovered===g?!0:void 0,onMouseEnter:$,onMouseLeave:O,onClick:w,onKeyDown:hr({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:f.loop,dir:_.dir,orientation:"vertical",onKeyDown:h.onKeydown})}),i&&m.createElement("div",{className:l.itemIcon},i),n&&m.createElement("div",{className:l.itemLabel},n),c&&m.createElement("div",{className:l.itemRightSection},c))});vt.displayName="@mantine/core/MenuItem";const za=Pe(vt);var Ha=j(e=>({label:{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontWeight:500,fontSize:e.fontSizes.xs,padding:`calc(${e.spacing.xs} / 2) ${e.spacing.sm}`,cursor:"default"}})),Fa=Object.defineProperty,_e=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable,ir=(e,r,t)=>r in e?Fa(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Va=(e,r)=>{for(var t in r||(r={}))_t.call(r,t)&&ir(e,t,r[t]);if(_e)for(var t of _e(r))yt.call(r,t)&&ir(e,t,r[t]);return e},Ua=(e,r)=>{var t={};for(var n in e)_t.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&_e)for(var n of _e(e))r.indexOf(n)<0&&yt.call(e,n)&&(t[n]=e[n]);return t};const Xa={},ht=y.forwardRef((e,r)=>{const t=b("MenuLabel",Xa,e),{children:n,className:o}=t,a=Ua(t,["children","className"]),{classNames:s,styles:i,unstyled:c,variant:d}=G(),{classes:f,cx:l}=Ha(null,{name:"Menu",classNames:s,styles:i,unstyled:c,variant:d});return m.createElement(E,Va({className:l(f.label,o),ref:r},a),n)});ht.displayName="@mantine/core/MenuLabel";var Ga=Object.defineProperty,ye=Object.getOwnPropertySymbols,Ot=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,lr=(e,r,t)=>r in e?Ga(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Wa=(e,r)=>{for(var t in r||(r={}))Ot.call(r,t)&&lr(e,t,r[t]);if(ye)for(var t of ye(r))$t.call(r,t)&&lr(e,t,r[t]);return e},Ka=(e,r)=>{var t={};for(var n in e)Ot.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ye)for(var n of ye(e))r.indexOf(n)<0&&$t.call(e,n)&&(t[n]=e[n]);return t};const qa={refProp:"ref"},wt=y.forwardRef((e,r)=>{const t=b("MenuTarget",qa,e),{children:n,refProp:o}=t,a=Ka(t,["children","refProp"]);if(!Ht(n))throw new Error(it.children);const s=G(),i=R(n.props.onClick,()=>s.trigger==="click"&&s.toggleDropdown()),c=R(n.props.onMouseEnter,()=>s.trigger==="hover"&&s.openDropdown()),d=R(n.props.onMouseLeave,()=>s.trigger==="hover"&&s.closeDropdown());return m.createElement(be.Target,Wa({refProp:o,popupType:"menu",ref:r},a),y.cloneElement(n,{onClick:i,onMouseEnter:c,onMouseLeave:d,"data-expanded":s.opened?!0:void 0}))});wt.displayName="@mantine/core/MenuTarget";var Ya=j({dropdown:{padding:P(4)}}),Za=Object.defineProperty,Ja=Object.defineProperties,Qa=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,cr=(e,r,t)=>r in e?Za(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,dr=(e,r)=>{for(var t in r||(r={}))Pt.call(r,t)&&cr(e,t,r[t]);if(he)for(var t of he(r))bt.call(r,t)&&cr(e,t,r[t]);return e},fr=(e,r)=>Ja(e,Qa(r)),es=(e,r)=>{var t={};for(var n in e)Pt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&he)for(var n of he(e))r.indexOf(n)<0&&bt.call(e,n)&&(t[n]=e[n]);return t};const rs={closeOnItemClick:!0,loop:!0,trigger:"click",openDelay:0,closeDelay:100};function D(e){const r=b("Menu",rs,e),{children:t,onOpen:n,onClose:o,opened:a,defaultOpened:s,onChange:i,closeOnItemClick:c,loop:d,closeOnEscape:f,trigger:l,openDelay:v,closeDelay:_,classNames:p,styles:g,unstyled:h,radius:O,variant:$}=r,w=es(r,["children","onOpen","onClose","opened","defaultOpened","onChange","closeOnItemClick","loop","closeOnEscape","trigger","openDelay","closeDelay","classNames","styles","unstyled","radius","variant"]),{classes:N,cx:A}=Ya(),[L,{setHovered:S,resetHovered:k}]=on(),[I,x]=pr({value:a,defaultValue:s,finalValue:!1,onChange:i}),M=()=>{x(!1),I&&o?.()},F=()=>{x(!0),!I&&n?.()},W=()=>I?M():F(),{openDropdown:xt,closeDropdown:St}=qo({open:F,close:M,closeDelay:_,openDelay:v}),jt=It=>nn("[data-menu-item]","[data-menu-dropdown]",It);return mr(()=>{k()},[I]),m.createElement(ga,{value:{opened:I,toggleDropdown:W,getItemIndex:jt,hovered:L,setHovered:S,closeOnItemClick:c,closeDropdown:l==="click"?M:St,openDropdown:l==="click"?F:xt,closeDropdownImmediately:M,loop:d,trigger:l,radius:O,classNames:p,styles:g,unstyled:h,variant:$}},m.createElement(be,fr(dr({},w),{radius:O,opened:I,onChange:W,defaultOpened:s,trapFocus:l==="click"&&I,closeOnEscape:f&&l==="click",__staticSelector:"Menu",classNames:fr(dr({},p),{dropdown:A(N.dropdown,p?.dropdown)}),styles:g,unstyled:h,variant:$}),t))}D.displayName="@mantine/core/Menu";D.Item=za;D.Label=ht;D.Dropdown=ut;D.Target=wt;D.Divider=dt;const ts="updateBusinessTripAccountantApproval",ns=()=>{const[{fetching:e},r]=_r(Ft),t=y.useCallback(async n=>{const o=`Error toggling accountant approval for trip [${n.businessTripId}]`,a=`${ts}-${n.businessTripId}`;H.loading("Updating accountant approval status",{id:a});try{const s=await r(n),i=yr(s,o,a);if(i)return H.success("Success",{id:a,description:"Accountant approval status updated"}),i.updateBusinessTripAccountantApproval}catch(s){console.error(`${o}: ${s}`),H.error("Error",{id:a,description:o,duration:1e5,closeButton:!0})}},[r]);return{fetching:e,updateBusinessTripAccountantApproval:t}};function os({data:e,onChange:r}){const t=xe(Ut,e),[n,o]=y.useState(t.accountantApproval),{updateBusinessTripAccountantApproval:a}=ns();return y.useEffect(()=>{n==null&&t.accountantApproval!=null&&o(t.accountantApproval)},[n,t.accountantApproval]),u.jsx(Vt,{value:n,onChange:s=>a({businessTripId:t.id,status:s}).then(r)})}const as="creditShareholdersBusinessTripTravelAndSubsistence",ss=()=>{const[{fetching:e},r]=_r(Xt),t=y.useCallback(async n=>{const o=`Error crediting shareholders for trip ID ${n.businessTripId}`,a=`${as}-${n.businessTripId}`;H.loading("Crediting Shareholders",{id:a});try{const s=await r(n),i=yr(s,o,a);i&&H.success("Shareholders Credited",{id:a,description:`${i.creditShareholdersBusinessTripTravelAndSubsistence.length} Corresponding charges were successfully generated`})}catch(s){console.error(`${o}: ${s}`),H.error("Error",{id:a,description:o,duration:1e5,closeButton:!0})}},[r]);return{fetching:e,creditShareholders:t}};function is({businessTripId:e}){const[r,t]=y.useState(!1),{creditShareholders:n}=ss();return u.jsxs(D,{shadow:"md",width:200,opened:r,children:[u.jsx(D.Target,{children:u.jsx(Br,{opened:r,onClick:o=>{o.stopPropagation(),t(a=>!a)}})}),u.jsxs(D.Dropdown,{children:[u.jsx(D.Label,{children:"Summarize Trip"}),u.jsx(Gt,{onConfirm:()=>{n({businessTripId:e})},title:"Credit shareholders with travel and subsistence surplus?",children:u.jsx(D.Item,{icon:u.jsx(Wt,{size:14}),children:"Credit surplus T&S"})})]})]})}const ms=({data:e,onChange:r})=>{const t=xe(Yt,e),{name:n,dates:o,purpose:a,destination:s}=t;return u.jsxs(C,{children:[u.jsxs(C.Col,{span:12,className:"flex flex-row justify-between items-center",children:[u.jsx(E,{fz:"xl",children:n}),u.jsxs("div",{className:"flex flex-row gap-2",children:[u.jsx(os,{data:t,onChange:r}),u.jsx(Kt,{isLink:!0,content:`${window.location.origin}${qt.BUSINESS_TRIPS.DETAIL(t.id)}`}),u.jsx(is,{businessTripId:t.id})]})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["From Date:",u.jsx(E,{fz:"lg",children:o?.start?Ce(new Date(o.start),"dd/MM/yy"):"Missing"})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["To Date:",u.jsx(E,{fz:"lg",children:o?.end?Ce(new Date(o.end),"dd/MM/yy"):"Missing"})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["Destination:",u.jsx(E,{fz:"lg",children:s?.name})]}),u.jsxs(C.Col,{xl:4,lg:6,md:12,orderMd:6,children:["Description:",u.jsx(E,{fz:"lg",children:a})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["Total Days:",u.jsx(E,{fz:"lg",children:o?ls(o.start,o.end):"Missing"})]})]})};function ls(e,r){return Qt(Ne(new Date(r),22),Ne(new Date(e),6))+1}function cs(e){return e.split("_").map(ds).join(" ")}function ds(e){return e.slice(0,1).toUpperCase()+e.slice(1,e.length).toLowerCase()}const gs=({data:e})=>{const{summary:r}=xe(Zt,e);return r?u.jsxs("div",{className:"flex flex-col gap-2 mt-5",children:[r.errors?.length&&u.jsxs(gr,{shadow:"xs",p:"md",children:[u.jsx(E,{c:"red",children:"Errors:"}),u.jsx(ue,{size:"sm",withPadding:!0,children:r.errors.map((t,n)=>u.jsx(ue.Item,{children:u.jsx(E,{c:"red",children:t})},n))})]}),u.jsxs(Jt,{highlightOnHover:!0,withBorder:!0,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Expense Type"}),u.jsxs("th",{children:["Total ",V(U.Usd)]}),u.jsxs("th",{children:["Total ",V(U.Ils)]}),u.jsxs("th",{children:["Max Taxable ",V(U.Usd)]}),u.jsxs("th",{children:["Taxable ",V(U.Usd)]}),u.jsxs("th",{children:["Taxable ",V(U.Ils)]}),u.jsx("th",{children:"Excess Expenditure"})]})}),u.jsx("tbody",{children:r.rows.map(t=>u.jsxs("tr",{children:[u.jsx("td",{children:cs(t.type)}),u.jsx("td",{children:t.totalForeignCurrency?.formatted}),u.jsx("td",{children:t.totalLocalCurrency?.formatted}),u.jsx("td",{children:t.maxTaxableForeignCurrency?.formatted}),u.jsx("td",{children:t.taxableForeignCurrency?.formatted}),u.jsx("td",{children:t.taxableLocalCurrency?.formatted}),u.jsx("td",{children:t.excessExpenditure?.formatted})]},t.type))})]}),u.jsxs(C,{justify:"flex-end",children:[u.jsxs(C.Col,{lg:2,md:4,children:["Excess Expenditure Tax:",u.jsxs(E,{fz:"lg",children:[r.excessTax??"0","%"]})]}),u.jsx(C.Col,{lg:2,md:3,className:"flex flex-col justify-end",children:u.jsx(E,{fz:"lg",children:r.excessExpenditure?.formatted??"0.00"})})]})]}):u.jsx(E,{children:"Loading..."})};export{Oe as A,Br as B,us as C,C as G,ue as L,D as M,ms as R,gs as S,Nr as a};
1
+ import{fZ as Ct,f_ as Et,f$ as Nt,r as y,eT as X,fW as Dt,eD as pr,aF as m,bx as j,ci as P,by as b,bz as T,fq as ur,g0 as mr,g1 as Tt,dh as Rt,g2 as Mt,g3 as At,fX as Lt,fr as kt,ch as z,ez as Pe,ea as gr,g4 as vr,g5 as Bt,fU as Ie,d7 as be,eB as zt,bu as E,eU as Ht,g as _r,g6 as Ft,t as H,i as yr,G as xe,j as u,e9 as Vt,g7 as Ut,g8 as Xt,bW as Gt,g9 as Wt,et as Kt,R as qt,w as Ce,ga as Yt,gb as Zt,dn as V,ay as U}from"./index-BWAOW53d.js";import{T as Jt}from"./Table-LzLjpZeA.js";function Qt(e,r,t){const[n,o]=Ct(t?.in,e,r),a=Ee(n,o),s=Math.abs(Et(n,o));n.setDate(n.getDate()-a*s);const i=+(Ee(n,o)===-a),c=a*(s-i);return c===0?0:c}function Ee(e,r){const t=e.getFullYear()-r.getFullYear()||e.getMonth()-r.getMonth()||e.getDate()-r.getDate()||e.getHours()-r.getHours()||e.getMinutes()-r.getMinutes()||e.getSeconds()-r.getSeconds()||e.getMilliseconds()-r.getMilliseconds();return t<0?-1:t>0?1:t}function Ne(e,r,t){const n=Nt(e,t?.in);return n.setHours(r),n}function Z(e,r){let t=e;for(;(t=t.parentElement)&&!t.matches(r););return t}function en(e,r,t){for(let n=e-1;n>=0;n-=1)if(!r[n].disabled)return n;if(t){for(let n=r.length-1;n>-1;n-=1)if(!r[n].disabled)return n}return e}function rn(e,r,t){for(let n=e+1;n<r.length;n+=1)if(!r[n].disabled)return n;if(t){for(let n=0;n<r.length;n+=1)if(!r[n].disabled)return n}return e}function tn(e,r,t){return Z(e,t)===Z(r,t)}function hr({parentSelector:e,siblingSelector:r,onKeyDown:t,loop:n=!0,activateOnFocus:o=!1,dir:a="rtl",orientation:s}){return i=>{var c;t?.(i);const d=Array.from(((c=Z(i.currentTarget,e))==null?void 0:c.querySelectorAll(r))||[]).filter(_=>tn(i.currentTarget,_,e)),f=d.findIndex(_=>i.currentTarget===_),l=rn(f,d,n),v=en(f,d,n);switch(i.key){case"ArrowRight":break;case"ArrowLeft":break;case"ArrowUp":{i.stopPropagation(),i.preventDefault(),d[v].focus(),o&&d[v].click();break}case"ArrowDown":{i.stopPropagation(),i.preventDefault(),d[l].focus(),o&&d[l].click();break}case"Home":{i.stopPropagation(),i.preventDefault(),!d[0].disabled&&d[0].focus();break}case"End":{i.stopPropagation(),i.preventDefault();const _=d.length-1;!d[_].disabled&&d[_].focus();break}}}}function nn(e,r,t){var n;return t?Array.from(((n=Z(t,r))==null?void 0:n.querySelectorAll(e))||[]).findIndex(o=>o===t):null}function De(e,r){return t=>{if(typeof t!="string"||t.trim().length===0)throw new Error(r);return`${e}-${t}`}}function R(e,r){return t=>{e?.(t),r?.(t)}}function on(){const[e,r]=y.useState(-1);return[e,{setHovered:r,resetHovered:()=>r(-1)}]}const J={context:"Accordion component was not found in the tree",itemContext:"Accordion.Item component was not found in the tree",value:"Accordion.Item component was rendered with invalid value or without value"},[an,Q]=X(J.context);function sn({children:e,multiple:r,value:t,defaultValue:n,onChange:o,id:a,loop:s,transitionDuration:i,disableChevronRotation:c,chevronPosition:d,chevronSize:f,order:l,chevron:v,variant:_,radius:p,classNames:g,styles:h,unstyled:O}){const $=Dt(a),[w,N]=pr({value:t,defaultValue:n,finalValue:r?[]:null,onChange:o}),A=S=>Array.isArray(w)?w.includes(S):S===w,L=S=>{const k=Array.isArray(w)?w.includes(S)?w.filter(I=>I!==S):[...w,S]:S===w?null:S;N(k)};return m.createElement(an,{value:{isItemActive:A,onChange:L,getControlId:De(`${$}-control`,J.value),getRegionId:De(`${$}-panel`,J.value),transitionDuration:i,disableChevronRotation:c,chevronPosition:d,chevronSize:f,order:l,chevron:v,loop:s,variant:_,radius:p,classNames:g,styles:h,unstyled:O}},e)}const[ln,Or]=X(J.itemContext);function cn(e,r,{radius:t}){const n=e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3],o=e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],a=e.fn.radius(t);return r==="default"?{color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderBottom:`${P(1)} solid ${n}`}:r==="contained"?{border:`${P(1)} solid ${n}`,transition:"background-color 150ms ease","&[data-active]":{backgroundColor:o},"&:first-of-type":{borderTopRightRadius:a,borderTopLeftRadius:a,"& > [data-accordion-control]":{borderTopRightRadius:a,borderTopLeftRadius:a}},"&:last-of-type":{borderBottomRightRadius:a,borderBottomLeftRadius:a,"& > [data-accordion-control]":{borderBottomRightRadius:a,borderBottomLeftRadius:a}},"& + &":{borderTop:0}}:r==="filled"?{borderRadius:a,"&[data-active]":{backgroundColor:o}}:r==="separated"?{borderRadius:a,backgroundColor:o,border:`${P(1)} solid transparent`,transition:"background-color 150ms ease","& + &":{marginTop:e.spacing.md},"&[data-active]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,borderColor:n}}:{}}var dn=j((e,r,{variant:t})=>({item:cn(e,t,r)})),fn=Object.defineProperty,ee=Object.getOwnPropertySymbols,$r=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable,Te=(e,r,t)=>r in e?fn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,pn=(e,r)=>{for(var t in r||(r={}))$r.call(r,t)&&Te(e,t,r[t]);if(ee)for(var t of ee(r))wr.call(r,t)&&Te(e,t,r[t]);return e},un=(e,r)=>{var t={};for(var n in e)$r.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ee)for(var n of ee(e))r.indexOf(n)<0&&wr.call(e,n)&&(t[n]=e[n]);return t};const mn={},Pr=y.forwardRef((e,r)=>{const t=b("AccordionItem",mn,e),{children:n,className:o,value:a}=t,s=un(t,["children","className","value"]),i=Q(),{classes:c,cx:d}=dn({radius:i.radius},{name:"Accordion",classNames:i.classNames,styles:i.styles,unstyled:i.unstyled,variant:i.variant});return m.createElement(ln,{value:{value:a}},m.createElement(T,pn({ref:r,className:d(c.item,o),"data-active":i.isItemActive(a)||void 0},s),n))});Pr.displayName="@mantine/core/AccordionItem";var gn=Object.defineProperty,vn=Object.defineProperties,_n=Object.getOwnPropertyDescriptors,Re=Object.getOwnPropertySymbols,yn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,Me=(e,r,t)=>r in e?gn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,K=(e,r)=>{for(var t in r||(r={}))yn.call(r,t)&&Me(e,t,r[t]);if(Re)for(var t of Re(r))hn.call(r,t)&&Me(e,t,r[t]);return e},On=(e,r)=>vn(e,_n(r));function $n(e,r){return r==="default"||r==="contained"?e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]}):{}}var wn=j((e,{transitionDuration:r,chevronPosition:t,chevronSize:n},{variant:o})=>({icon:{display:"flex",alignItems:"center",justifyContent:"center",marginRight:t==="left"?0:e.spacing.sm,marginLeft:t==="left"?e.spacing.lg:0},chevron:{display:"flex",alignItems:"center",justifyContent:"center",transition:`transform ${r}ms ease`,marginRight:t==="right"?0:e.spacing.sm,marginLeft:t==="right"?e.spacing.lg:0,width:P(n),minWidth:P(n),"&[data-rotate]":{transform:"rotate(180deg)"}},label:{color:"inherit",fontWeight:400,flex:1,overflow:"hidden",textOverflow:"ellipsis",paddingTop:e.spacing.md,paddingBottom:e.spacing.md},itemTitle:{margin:0,padding:0},control:On(K(K(K({},e.fn.focusStyles()),e.fn.fontStyles()),$n(e,o)),{width:"100%",display:"flex",alignItems:"center",flexDirection:t==="right"?"row-reverse":"row",paddingRight:e.spacing.md,paddingLeft:t==="right"?`calc(${e.spacing.md} + ${P(4)})`:e.spacing.xs,textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,"&:disabled":K({opacity:.4,cursor:"not-allowed"},e.fn.hover({backgroundColor:"transparent"}))})})),Pn=Object.defineProperty,bn=Object.defineProperties,xn=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertySymbols,br=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,Ae=(e,r,t)=>r in e?Pn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Sn=(e,r)=>{for(var t in r||(r={}))br.call(r,t)&&Ae(e,t,r[t]);if(re)for(var t of re(r))xr.call(r,t)&&Ae(e,t,r[t]);return e},jn=(e,r)=>bn(e,xn(r)),In=(e,r)=>{var t={};for(var n in e)br.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&re)for(var n of re(e))r.indexOf(n)<0&&xr.call(e,n)&&(t[n]=e[n]);return t};const Cn={},Sr=y.forwardRef((e,r)=>{const t=b("AccordionControl",Cn,e),{disabled:n,onKeyDown:o,onClick:a,chevron:s,children:i,className:c,icon:d}=t,f=In(t,["disabled","onKeyDown","onClick","chevron","children","className","icon"]),l=Q(),{value:v}=Or(),{classes:_,cx:p}=wn({transitionDuration:l.transitionDuration,chevronPosition:l.chevronPosition,chevronSize:l.chevronSize,radius:l.radius},{name:"Accordion",classNames:l.classNames,styles:l.styles,unstyled:l.unstyled,variant:l.variant}),g=l.isItemActive(v),h=typeof l.order=="number",O=`h${l.order}`,$=m.createElement(ur,jn(Sn({},f),{ref:r,"data-accordion-control":!0,disabled:n,className:p(_.control,c),onClick:w=>{a?.(w),l.onChange(v)},type:"button","data-active":g||void 0,"aria-expanded":g,"aria-controls":l.getRegionId(v),id:l.getControlId(v),unstyled:l.unstyled,onKeyDown:hr({siblingSelector:"[data-accordion-control]",parentSelector:"[data-accordion]",activateOnFocus:!1,loop:l.loop,orientation:"vertical",onKeyDown:o})}),m.createElement("span",{className:_.chevron,"data-rotate":!l.disableChevronRotation&&g||void 0},s||l.chevron),m.createElement("span",{className:_.label},i),d&&m.createElement("span",{className:_.icon},d));return h?m.createElement(O,{className:_.itemTitle},$):$});Sr.displayName="@mantine/core/AccordionControl";var En=Object.defineProperty,Nn=Object.defineProperties,Dn=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,ke=(e,r,t)=>r in e?En(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Mn=(e,r)=>{for(var t in r||(r={}))Tn.call(r,t)&&ke(e,t,r[t]);if(Le)for(var t of Le(r))Rn.call(r,t)&&ke(e,t,r[t]);return e},An=(e,r)=>Nn(e,Dn(r)),Ln=j((e,r)=>({panel:An(Mn({},e.fn.fontStyles()),{wordBreak:"break-word",lineHeight:e.lineHeight}),content:{padding:e.spacing.md,paddingTop:`calc(${e.spacing.xs} / 2)`}})),kn=Object.defineProperty,Bn=Object.defineProperties,zn=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,Be=(e,r,t)=>r in e?kn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,B=(e,r)=>{for(var t in r||(r={}))jr.call(r,t)&&Be(e,t,r[t]);if(te)for(var t of te(r))Ir.call(r,t)&&Be(e,t,r[t]);return e},$e=(e,r)=>Bn(e,zn(r)),Hn=(e,r)=>{var t={};for(var n in e)jr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&te)for(var n of te(e))r.indexOf(n)<0&&Ir.call(e,n)&&(t[n]=e[n]);return t};function Fn(e){if(!e||typeof e=="string")return 0;const r=e/36;return Math.round((4+15*r**.25+r/5)*10)}function we(e){return e?.current?e.current.scrollHeight:"auto"}const q=typeof window<"u"&&window.requestAnimationFrame;function Vn({transitionDuration:e,transitionTimingFunction:r="ease",onTransitionEnd:t=()=>{},opened:n}){const o=y.useRef(null),a=0,s={display:"none",height:0,overflow:"hidden"},[i,c]=y.useState(n?{}:s),d=p=>{Rt.flushSync(()=>c(p))},f=p=>{d(g=>B(B({},g),p))};function l(p){return{transition:`height ${e||Fn(p)}ms ${r}`}}mr(()=>{q(n?()=>{f({willChange:"height",display:"block",overflow:"hidden"}),q(()=>{const p=we(o);f($e(B({},l(p)),{height:p}))})}:()=>{const p=we(o);f($e(B({},l(p)),{willChange:"height",height:p})),q(()=>f({height:a,overflow:"hidden"}))})},[n]);const v=p=>{if(!(p.target!==o.current||p.propertyName!=="height"))if(n){const g=we(o);g===i.height?d({}):f({height:g}),t()}else i.height===a&&(d(s),t())};function _(p={}){var g=p,{style:h={},refKey:O="ref"}=g,$=Hn(g,["style","refKey"]);const w=$[O];return $e(B({"aria-hidden":!n},$),{[O]:Tt(o,w),onTransitionEnd:v,style:B(B({boxSizing:"border-box"},h),i)})}return _}var Un=Object.defineProperty,ne=Object.getOwnPropertySymbols,Cr=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable,ze=(e,r,t)=>r in e?Un(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Y=(e,r)=>{for(var t in r||(r={}))Cr.call(r,t)&&ze(e,t,r[t]);if(ne)for(var t of ne(r))Er.call(r,t)&&ze(e,t,r[t]);return e},Xn=(e,r)=>{var t={};for(var n in e)Cr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ne)for(var n of ne(e))r.indexOf(n)<0&&Er.call(e,n)&&(t[n]=e[n]);return t};const Gn={transitionDuration:200,transitionTimingFunction:"ease",animateOpacity:!0},Nr=y.forwardRef((e,r)=>{const t=b("Collapse",Gn,e),{children:n,in:o,transitionDuration:a,transitionTimingFunction:s,style:i,onTransitionEnd:c,animateOpacity:d}=t,f=Xn(t,["children","in","transitionDuration","transitionTimingFunction","style","onTransitionEnd","animateOpacity"]),l=Mt(),v=At(),p=(l.respectReducedMotion?v:!1)?0:a,{systemStyles:g,rest:h}=Lt(f),O=Vn({opened:o,transitionDuration:p,transitionTimingFunction:s,onTransitionEnd:c});return p===0?o?m.createElement(T,Y({},h),n):null:m.createElement(T,Y({},O(Y(Y({style:i,ref:r},h),g))),m.createElement("div",{style:{opacity:o||!d?1:0,transition:d?`opacity ${p}ms ${s}`:"none"}},n))});Nr.displayName="@mantine/core/Collapse";var Wn=Object.defineProperty,Kn=Object.defineProperties,qn=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,Dr=Object.prototype.hasOwnProperty,Tr=Object.prototype.propertyIsEnumerable,He=(e,r,t)=>r in e?Wn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Yn=(e,r)=>{for(var t in r||(r={}))Dr.call(r,t)&&He(e,t,r[t]);if(oe)for(var t of oe(r))Tr.call(r,t)&&He(e,t,r[t]);return e},Zn=(e,r)=>Kn(e,qn(r)),Jn=(e,r)=>{var t={};for(var n in e)Dr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&oe)for(var n of oe(e))r.indexOf(n)<0&&Tr.call(e,n)&&(t[n]=e[n]);return t};const Qn={};function Rr(e){const r=b("AccordionPanel",Qn,e),{children:t,className:n}=r,o=Jn(r,["children","className"]),a=Q(),{value:s}=Or(),{classNames:i,styles:c,unstyled:d}=Q(),{classes:f,cx:l}=Ln({radius:a.radius},{name:"Accordion",classNames:i,styles:c,unstyled:d,variant:a.variant});return m.createElement(Nr,Zn(Yn({},o),{className:l(f.panel,n),in:a.isItemActive(s),transitionDuration:a.transitionDuration,role:"region",id:a.getRegionId(s),"aria-labelledby":a.getControlId(s)}),m.createElement("div",{className:f.content},t))}Rr.displayName="@mantine/core/AccordionPanel";var eo=Object.defineProperty,ro=Object.defineProperties,to=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,Fe=(e,r,t)=>r in e?eo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,no=(e,r)=>{for(var t in r||(r={}))Mr.call(r,t)&&Fe(e,t,r[t]);if(ae)for(var t of ae(r))Ar.call(r,t)&&Fe(e,t,r[t]);return e},oo=(e,r)=>ro(e,to(r)),ao=(e,r)=>{var t={};for(var n in e)Mr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ae)for(var n of ae(e))r.indexOf(n)<0&&Ar.call(e,n)&&(t[n]=e[n]);return t};const so={multiple:!1,disableChevronRotation:!1,transitionDuration:200,chevronPosition:"right",variant:"default",chevronSize:24,chevron:m.createElement(kt,null)};function Oe(e){const r=b("Accordion",so,e),{id:t,loop:n,children:o,multiple:a,value:s,defaultValue:i,onChange:c,transitionDuration:d,disableChevronRotation:f,chevronPosition:l,chevronSize:v,order:_,chevron:p,classNames:g,styles:h,unstyled:O,variant:$,radius:w}=r,N=ao(r,["id","loop","children","multiple","value","defaultValue","onChange","transitionDuration","disableChevronRotation","chevronPosition","chevronSize","order","chevron","classNames","styles","unstyled","variant","radius"]);return m.createElement(sn,{id:t,multiple:a,value:s,defaultValue:i,onChange:c,loop:n,transitionDuration:d,disableChevronRotation:f,chevronPosition:l,chevronSize:v,order:_,chevron:p,variant:$,radius:w,classNames:g,styles:h,unstyled:O},m.createElement(T,oo(no({},N),{"data-accordion":!0}),o))}Oe.Item=Pr;Oe.Control=Sr;Oe.Panel=Rr;Oe.displayName="@mantine/core/Accordion";const io={xs:P(12),sm:P(18),md:P(24),lg:P(34),xl:P(42)};var lo=j((e,{color:r,transitionDuration:t},{size:n})=>{const o=z({size:n,sizes:io}),a=r||(e.colorScheme==="dark"?e.white:e.black);return{root:{borderRadius:e.radius.sm,width:`calc(${o} + ${e.spacing.xs})`,height:`calc(${o} + ${e.spacing.xs})`,padding:`calc(${e.spacing.xs} / 2)`,cursor:"pointer"},burger:{position:"relative",userSelect:"none",boxSizing:"border-box","&, &::before, &::after":{display:"block",width:o,height:`calc(${o} / 12)`,backgroundColor:a,outline:`${P(1)} solid transparent`,transitionProperty:"background-color, transform",transitionDuration:`${t}ms`,"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?"0ms":void 0}},"&::before, &::after":{position:"absolute",content:'""',left:0},"&::before":{top:`calc((${o} / 3) * -1)`},"&::after":{top:`calc(${o} / 3)`},"&[data-opened]":{backgroundColor:"transparent","&::before":{transform:`translateY(calc(${o} / 3)) rotate(45deg)`},"&::after":{transform:`translateY(calc(-${o} / 3)) rotate(-45deg)`}}}}}),co=Object.defineProperty,se=Object.getOwnPropertySymbols,Lr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ve=(e,r,t)=>r in e?co(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,fo=(e,r)=>{for(var t in r||(r={}))Lr.call(r,t)&&Ve(e,t,r[t]);if(se)for(var t of se(r))kr.call(r,t)&&Ve(e,t,r[t]);return e},po=(e,r)=>{var t={};for(var n in e)Lr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&se)for(var n of se(e))r.indexOf(n)<0&&kr.call(e,n)&&(t[n]=e[n]);return t};const uo={size:"md",transitionDuration:300},Br=y.forwardRef((e,r)=>{const t=b("Burger",uo,e),{className:n,opened:o,color:a,size:s,classNames:i,styles:c,transitionDuration:d,variant:f}=t,l=po(t,["className","opened","color","size","classNames","styles","transitionDuration","variant"]),{classes:v,cx:_}=lo({color:a,transitionDuration:d},{classNames:i,styles:c,name:"Burger",variant:f,size:s});return m.createElement(ur,fo({className:_(v.root,n),ref:r},l),m.createElement("div",{"data-opened":o||void 0,className:v.burger}))});Br.displayName="@mantine/core/Burger";const zr=y.createContext({padding:0}),mo=zr.Provider,go=()=>y.useContext(zr).padding;var vo=j((e,{padding:r,withBorder:t,inheritPadding:n})=>{const o=z({size:r,sizes:e.spacing}),a=`calc(-1 * ${o})`,s=e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3];return{cardSection:{display:"block",marginLeft:a,marginRight:a,paddingLeft:n?o:void 0,paddingRight:n?o:void 0,borderTop:t?`${P(1)} solid ${s}`:void 0,borderBottom:t?`${P(1)} solid ${s}`:void 0,"& + &":{borderTop:0},"&[data-first]":{marginTop:a,borderTop:0,borderBottom:t?`${P(1)} solid ${s}`:void 0},"&[data-last]":{marginBottom:a,borderBottom:0}}}}),_o=Object.defineProperty,ie=Object.getOwnPropertySymbols,Hr=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable,Ue=(e,r,t)=>r in e?_o(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,yo=(e,r)=>{for(var t in r||(r={}))Hr.call(r,t)&&Ue(e,t,r[t]);if(ie)for(var t of ie(r))Fr.call(r,t)&&Ue(e,t,r[t]);return e},ho=(e,r)=>{var t={};for(var n in e)Hr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ie)for(var n of ie(e))r.indexOf(n)<0&&Fr.call(e,n)&&(t[n]=e[n]);return t};const Oo={withBorder:!1,inheritPadding:!1},Vr=y.forwardRef((e,r)=>{const t=b("CardSection",Oo,e),{className:n,withBorder:o,inheritPadding:a,unstyled:s,variant:i}=t,c=ho(t,["className","withBorder","inheritPadding","unstyled","variant"]),{classes:d,cx:f}=vo({padding:go(),withBorder:o,inheritPadding:a},{name:"Card",unstyled:s,variant:i});return m.createElement(T,yo({className:f(d.cardSection,n),ref:r},c))});Vr.displayName="@mantine/core/CardSection";const Ur=Pe(Vr);var $o=j(e=>({root:{position:"relative",overflow:"hidden",backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white}})),wo=Object.defineProperty,le=Object.getOwnPropertySymbols,Xr=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable,Xe=(e,r,t)=>r in e?wo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Po=(e,r)=>{for(var t in r||(r={}))Xr.call(r,t)&&Xe(e,t,r[t]);if(le)for(var t of le(r))Gr.call(r,t)&&Xe(e,t,r[t]);return e},bo=(e,r)=>{var t={};for(var n in e)Xr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&le)for(var n of le(e))r.indexOf(n)<0&&Gr.call(e,n)&&(t[n]=e[n]);return t};const xo={padding:"md"},Se=y.forwardRef((e,r)=>{const t=b("Card",xo,e),{className:n,padding:o,radius:a,children:s,unstyled:i,variant:c}=t,d=bo(t,["className","padding","radius","children","unstyled","variant"]),{classes:f,cx:l}=$o(null,{name:"Card",unstyled:i,variant:c}),v=y.Children.toArray(s),_=v.map((p,g)=>typeof p=="object"&&p&&"type"in p&&p.type===Ur?y.cloneElement(p,{variant:c,padding:o,"data-first":g===0||void 0,"data-last":g===v.length-1||void 0}):p);return m.createElement(mo,{value:{padding:o}},m.createElement(gr,Po({className:l(f.root,n),radius:a,p:o,ref:r},d),_))});Se.Section=Ur;Se.displayName="@mantine/core/Card";const us=Pe(Se),[So,jo]=X("Grid component was not found in tree");var Io=Object.defineProperty,Ge=Object.getOwnPropertySymbols,Co=Object.prototype.hasOwnProperty,Eo=Object.prototype.propertyIsEnumerable,We=(e,r,t)=>r in e?Io(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,No=(e,r)=>{for(var t in r||(r={}))Co.call(r,t)&&We(e,t,r[t]);if(Ge)for(var t of Ge(r))Eo.call(r,t)&&We(e,t,r[t]);return e};const je=(e,r)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(r/e)}%`:void 0,Wr=(e,r,t)=>t||e==="auto"||e==="content"?"unset":je(e,r),Kr=(e,r)=>{if(e)return e==="auto"||r?1:0},qr=(e,r)=>e===0?0:e?`${100/(r/e)}%`:void 0,Yr=(e,r)=>typeof e<"u"?`calc(${z({size:e,sizes:r.spacing})} / 2)`:void 0;function Do({sizes:e,offsets:r,orders:t,theme:n,columns:o,gutters:a,grow:s}){return vr.reduce((i,c)=>(i[`@media (min-width: ${Bt(n.breakpoints[c])})`]={order:t[c],flexBasis:je(e[c],o),padding:Yr(a[c],n),flexShrink:0,width:e[c]==="content"?"auto":void 0,maxWidth:Wr(e[c],o,s),marginLeft:qr(r[c],o),flexGrow:Kr(e[c],s)},i),{})}var To=j((e,{gutter:r,gutterXs:t,gutterSm:n,gutterMd:o,gutterLg:a,gutterXl:s,grow:i,offset:c,offsetXs:d,offsetSm:f,offsetMd:l,offsetLg:v,offsetXl:_,columns:p,span:g,xs:h,sm:O,md:$,lg:w,xl:N,order:A,orderXs:L,orderSm:S,orderMd:k,orderLg:I,orderXl:x})=>({col:No({boxSizing:"border-box",flexGrow:Kr(g,i),order:A,padding:Yr(r,e),marginLeft:qr(c,p),flexBasis:je(g,p),flexShrink:0,width:g==="content"?"auto":void 0,maxWidth:Wr(g,p,i)},Do({sizes:{xs:h,sm:O,md:$,lg:w,xl:N},offsets:{xs:d,sm:f,md:l,lg:v,xl:_},orders:{xs:L,sm:S,md:k,lg:I,xl:x},gutters:{xs:t,sm:n,md:o,lg:a,xl:s},theme:e,columns:p,grow:i}))})),Ro=Object.defineProperty,ce=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,Jr=Object.prototype.propertyIsEnumerable,Ke=(e,r,t)=>r in e?Ro(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Mo=(e,r)=>{for(var t in r||(r={}))Zr.call(r,t)&&Ke(e,t,r[t]);if(ce)for(var t of ce(r))Jr.call(r,t)&&Ke(e,t,r[t]);return e},Ao=(e,r)=>{var t={};for(var n in e)Zr.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ce)for(var n of ce(e))r.indexOf(n)<0&&Jr.call(e,n)&&(t[n]=e[n]);return t};const Lo={};function ko(e){return e==="auto"||e==="content"?!0:typeof e=="number"&&e>0&&e%1===0}const Qr=y.forwardRef((e,r)=>{const t=b("GridCol",Lo,e),{children:n,span:o,offset:a,offsetXs:s,offsetSm:i,offsetMd:c,offsetLg:d,offsetXl:f,xs:l,sm:v,md:_,lg:p,xl:g,order:h,orderXs:O,orderSm:$,orderMd:w,orderLg:N,orderXl:A,className:L,unstyled:S,variant:k}=t,I=Ao(t,["children","span","offset","offsetXs","offsetSm","offsetMd","offsetLg","offsetXl","xs","sm","md","lg","xl","order","orderXs","orderSm","orderMd","orderLg","orderXl","className","unstyled","variant"]),x=jo(),M=o||x.columns,{classes:F,cx:W}=To({gutter:x.gutter,gutterXs:x.gutterXs,gutterSm:x.gutterSm,gutterMd:x.gutterMd,gutterLg:x.gutterLg,gutterXl:x.gutterXl,offset:a,offsetXs:s,offsetSm:i,offsetMd:c,offsetLg:d,offsetXl:f,xs:l,sm:v,md:_,lg:p,xl:g,order:h,orderXs:O,orderSm:$,orderMd:w,orderLg:N,orderXl:A,grow:x.grow,columns:x.columns,span:M},{unstyled:S,name:"Grid",variant:k});return!ko(M)||M>x.columns?null:m.createElement(T,Mo({className:W(F.col,L),ref:r},I),n)});Qr.displayName="@mantine/core/Col";var Bo=Object.defineProperty,qe=Object.getOwnPropertySymbols,zo=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable,Ye=(e,r,t)=>r in e?Bo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Fo=(e,r)=>{for(var t in r||(r={}))zo.call(r,t)&&Ye(e,t,r[t]);if(qe)for(var t of qe(r))Ho.call(r,t)&&Ye(e,t,r[t]);return e};function Vo(e,r){return vr.reduce((t,n)=>(typeof e[n]<"u"&&(t[`@media (min-width: ${r.breakpoints[n]})`]={margin:`calc(-${z({size:e[n],sizes:r.spacing})} / 2)`}),t),{})}var Uo=j((e,{justify:r,align:t,gutter:n,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c})=>({root:Fo({margin:`calc(-${z({size:n,sizes:e.spacing})} / 2)`,display:"flex",flexWrap:"wrap",justifyContent:r,alignItems:t},Vo({xs:o,sm:a,md:s,lg:i,xl:c},e))})),Xo=Object.defineProperty,de=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,Ze=(e,r,t)=>r in e?Xo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Go=(e,r)=>{for(var t in r||(r={}))et.call(r,t)&&Ze(e,t,r[t]);if(de)for(var t of de(r))rt.call(r,t)&&Ze(e,t,r[t]);return e},Wo=(e,r)=>{var t={};for(var n in e)et.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&de)for(var n of de(e))r.indexOf(n)<0&&rt.call(e,n)&&(t[n]=e[n]);return t};const Ko={gutter:"md",justify:"flex-start",align:"stretch",columns:12},C=y.forwardRef((e,r)=>{const t=b("Grid",Ko,e),{gutter:n,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c,children:d,grow:f,justify:l,align:v,columns:_,className:p,unstyled:g,variant:h}=t,O=Wo(t,["gutter","gutterXs","gutterSm","gutterMd","gutterLg","gutterXl","children","grow","justify","align","columns","className","unstyled","variant"]),{classes:$,cx:w}=Uo({gutter:n,justify:l,align:v,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c},{unstyled:g,name:"Grid",variant:h});return m.createElement(So,{value:{gutter:n,gutterXs:o,gutterSm:a,gutterMd:s,gutterLg:i,gutterXl:c,grow:f,columns:_}},m.createElement(T,Go({className:w($.root,p),ref:r},O),d))});C.Col=Qr;C.displayName="@mantine/core/Grid";function qo({open:e,close:r,openDelay:t,closeDelay:n}){const o=y.useRef(-1),a=y.useRef(-1),s=()=>{window.clearTimeout(o.current),window.clearTimeout(a.current)},i=()=>{s(),t===0?e():o.current=window.setTimeout(e,t)},c=()=>{s(),n===0?r():a.current=window.setTimeout(r,n)};return y.useEffect(()=>s,[]),{openDropdown:i,closeDropdown:c}}const[Yo,Zo]=X("List component was not found in tree");var Jo=j((e,{spacing:r,center:t})=>({itemWrapper:{ref:Ie("itemWrapper"),display:"inline-flex",flexDirection:"column",whiteSpace:"normal"},item:{whiteSpace:"nowrap",lineHeight:t?1:e.lineHeight,"&:not(:first-of-type)":{marginTop:z({size:r,sizes:e.spacing})},"&[data-with-icon]":{listStyle:"none",[`& .${Ie("itemWrapper")}`]:{display:"inline-flex",alignItems:t?"center":"flex-start",flexDirection:"row"}}},itemIcon:{display:"inline-block",verticalAlign:"middle",marginRight:e.spacing.sm}})),Qo=Object.defineProperty,fe=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,Je=(e,r,t)=>r in e?Qo(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ea=(e,r)=>{for(var t in r||(r={}))tt.call(r,t)&&Je(e,t,r[t]);if(fe)for(var t of fe(r))nt.call(r,t)&&Je(e,t,r[t]);return e},ra=(e,r)=>{var t={};for(var n in e)tt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&fe)for(var n of fe(e))r.indexOf(n)<0&&nt.call(e,n)&&(t[n]=e[n]);return t};const ta={},ot=y.forwardRef((e,r)=>{const t=b("ListItem",ta,e),{className:n,children:o,icon:a}=t,s=ra(t,["className","children","icon"]),{icon:i,spacing:c,center:d,listStyleType:f,size:l,withPadding:v,classNames:_,styles:p,unstyled:g,variant:h}=Zo(),O=a||i,{classes:$,cx:w}=Jo({withPadding:v,listStyleType:f,center:d,spacing:c},{classNames:_,styles:p,unstyled:g,name:"List",variant:h,size:l});return m.createElement(T,ea({component:"li",className:w($.item,n),"data-with-icon":!!O||void 0,ref:r},s),m.createElement("div",{className:$.itemWrapper},O&&m.createElement("span",{className:$.itemIcon},O),m.createElement("span",null,o)))});ot.displayName="@mantine/core/ListItem";var na=Object.defineProperty,oa=Object.defineProperties,aa=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,sa=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,er=(e,r,t)=>r in e?na(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,la=(e,r)=>{for(var t in r||(r={}))sa.call(r,t)&&er(e,t,r[t]);if(Qe)for(var t of Qe(r))ia.call(r,t)&&er(e,t,r[t]);return e},ca=(e,r)=>oa(e,aa(r)),da=j((e,{withPadding:r,listStyleType:t},{size:n})=>({root:ca(la({},e.fn.fontStyles()),{listStyleType:t,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,fontSize:z({size:n,sizes:e.fontSizes}),lineHeight:e.lineHeight,margin:0,paddingLeft:r?e.spacing.xl:0,listStylePosition:"inside"})})),fa=Object.defineProperty,pe=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,rr=(e,r,t)=>r in e?fa(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,pa=(e,r)=>{for(var t in r||(r={}))at.call(r,t)&&rr(e,t,r[t]);if(pe)for(var t of pe(r))st.call(r,t)&&rr(e,t,r[t]);return e},ua=(e,r)=>{var t={};for(var n in e)at.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&pe)for(var n of pe(e))r.indexOf(n)<0&&st.call(e,n)&&(t[n]=e[n]);return t};const ma={type:"unordered",size:"md",spacing:0},ue=y.forwardRef((e,r)=>{const t=b("List",ma,e),{children:n,type:o,size:a,listStyleType:s,withPadding:i,center:c,spacing:d,icon:f,className:l,styles:v,classNames:_,unstyled:p,variant:g}=t,h=ua(t,["children","type","size","listStyleType","withPadding","center","spacing","icon","className","styles","classNames","unstyled","variant"]),{classes:O,cx:$}=da({withPadding:i,listStyleType:s,center:c,spacing:d},{classNames:_,styles:v,name:"List",unstyled:p,size:a,variant:g});return m.createElement(Yo,{value:{spacing:d,center:c,icon:f,listStyleType:s,size:a,withPadding:i,classNames:_,styles:v,unstyled:p,variant:g}},m.createElement(T,pa({component:o==="unordered"?"ul":"ol",className:$(O.root,l),ref:r},h),n))});ue.Item=ot;ue.displayName="@mantine/core/List";const it={context:"Menu component was not found in the tree",children:"Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[ga,G]=X(it.context);var va=j(e=>({divider:{marginTop:P(4),marginBottom:P(4),borderTop:`${P(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`}})),_a=Object.defineProperty,me=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,tr=(e,r,t)=>r in e?_a(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ya=(e,r)=>{for(var t in r||(r={}))lt.call(r,t)&&tr(e,t,r[t]);if(me)for(var t of me(r))ct.call(r,t)&&tr(e,t,r[t]);return e},ha=(e,r)=>{var t={};for(var n in e)lt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&me)for(var n of me(e))r.indexOf(n)<0&&ct.call(e,n)&&(t[n]=e[n]);return t};const Oa={},dt=y.forwardRef((e,r)=>{const t=b("MenuDivider",Oa,e),{children:n,className:o}=t,a=ha(t,["children","className"]),{classNames:s,styles:i,unstyled:c,variant:d}=G(),{classes:f,cx:l}=va(null,{name:"Menu",classNames:s,styles:i,unstyled:c,variant:d});return m.createElement(T,ya({className:l(f.divider,o),ref:r},a))});dt.displayName="@mantine/core/MenuDivider";var $a=Object.defineProperty,ge=Object.getOwnPropertySymbols,ft=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,nr=(e,r,t)=>r in e?$a(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,wa=(e,r)=>{for(var t in r||(r={}))ft.call(r,t)&&nr(e,t,r[t]);if(ge)for(var t of ge(r))pt.call(r,t)&&nr(e,t,r[t]);return e},Pa=(e,r)=>{var t={};for(var n in e)ft.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ge)for(var n of ge(e))r.indexOf(n)<0&&pt.call(e,n)&&(t[n]=e[n]);return t};const ba={};function ut(e){const r=b("MenuDropdown",ba,e),{children:t,onMouseEnter:n,onMouseLeave:o}=r,a=Pa(r,["children","onMouseEnter","onMouseLeave"]),s=y.useRef(),i=G(),c=l=>{var v;(l.key==="ArrowUp"||l.key==="ArrowDown")&&(l.preventDefault(),(v=s.current.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||v.focus())},d=R(n,()=>i.trigger==="hover"&&i.openDropdown()),f=R(o,()=>i.trigger==="hover"&&i.closeDropdown());return m.createElement(be.Dropdown,wa({onMouseEnter:d,onMouseLeave:f,role:"menu","aria-orientation":"vertical"},a),m.createElement("div",{tabIndex:-1,"data-menu-dropdown":!0,"data-autofocus":!0,onKeyDown:c,ref:s,style:{outline:0}},t))}ut.displayName="@mantine/core/MenuDropdown";var xa=Object.defineProperty,Sa=Object.defineProperties,ja=Object.getOwnPropertyDescriptors,or=Object.getOwnPropertySymbols,Ia=Object.prototype.hasOwnProperty,Ca=Object.prototype.propertyIsEnumerable,ar=(e,r,t)=>r in e?xa(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Ea=(e,r)=>{for(var t in r||(r={}))Ia.call(r,t)&&ar(e,t,r[t]);if(or)for(var t of or(r))Ca.call(r,t)&&ar(e,t,r[t]);return e},Na=(e,r)=>Sa(e,ja(r)),Da=j((e,{color:r,radius:t})=>({item:Na(Ea({},e.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:e.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",textDecoration:"none",boxSizing:"border-box",padding:`${e.spacing.xs} ${e.spacing.sm}`,cursor:"pointer",borderRadius:e.fn.radius(t),color:r?e.fn.variant({variant:"filled",primaryFallback:!1,color:r}).background:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"flex",alignItems:"center","&:disabled":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],pointerEvents:"none",userSelect:"none"},"&[data-hovered]":{backgroundColor:r?e.fn.variant({variant:"light",color:r}).background:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[3],.35):e.colors.gray[1]}}),itemLabel:{flex:1},itemIcon:{display:"flex",justifyContent:"center",alignItems:"center",marginRight:e.spacing.xs},itemRightSection:{}})),Ta=Object.defineProperty,Ra=Object.defineProperties,Ma=Object.getOwnPropertyDescriptors,ve=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,sr=(e,r,t)=>r in e?Ta(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Aa=(e,r)=>{for(var t in r||(r={}))mt.call(r,t)&&sr(e,t,r[t]);if(ve)for(var t of ve(r))gt.call(r,t)&&sr(e,t,r[t]);return e},La=(e,r)=>Ra(e,Ma(r)),ka=(e,r)=>{var t={};for(var n in e)mt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ve)for(var n of ve(e))r.indexOf(n)<0&&gt.call(e,n)&&(t[n]=e[n]);return t};const Ba={},vt=y.forwardRef((e,r)=>{const t=b("MenuItem",Ba,e),{children:n,className:o,color:a,closeMenuOnClick:s,icon:i,rightSection:c}=t,d=ka(t,["children","className","color","closeMenuOnClick","icon","rightSection"]),f=G(),{classes:l,cx:v,theme:_}=Da({radius:f.radius,color:a},{name:"Menu",classNames:f.classNames,styles:f.styles,unstyled:f.unstyled,variant:f.variant}),p=y.useRef(),g=f.getItemIndex(p.current),h=d,O=R(h.onMouseLeave,()=>f.setHovered(-1)),$=R(h.onMouseEnter,()=>f.setHovered(f.getItemIndex(p.current))),w=R(h.onClick,()=>{typeof s=="boolean"?s&&f.closeDropdownImmediately():f.closeOnItemClick&&f.closeDropdownImmediately()}),N=R(h.onFocus,()=>f.setHovered(f.getItemIndex(p.current)));return m.createElement(T,La(Aa({component:"button",type:"button"},d),{tabIndex:-1,onFocus:N,className:v(l.item,o),ref:zt(p,r),role:"menuitem","data-menu-item":!0,"data-hovered":f.hovered===g?!0:void 0,onMouseEnter:$,onMouseLeave:O,onClick:w,onKeyDown:hr({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:f.loop,dir:_.dir,orientation:"vertical",onKeyDown:h.onKeydown})}),i&&m.createElement("div",{className:l.itemIcon},i),n&&m.createElement("div",{className:l.itemLabel},n),c&&m.createElement("div",{className:l.itemRightSection},c))});vt.displayName="@mantine/core/MenuItem";const za=Pe(vt);var Ha=j(e=>({label:{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontWeight:500,fontSize:e.fontSizes.xs,padding:`calc(${e.spacing.xs} / 2) ${e.spacing.sm}`,cursor:"default"}})),Fa=Object.defineProperty,_e=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable,ir=(e,r,t)=>r in e?Fa(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Va=(e,r)=>{for(var t in r||(r={}))_t.call(r,t)&&ir(e,t,r[t]);if(_e)for(var t of _e(r))yt.call(r,t)&&ir(e,t,r[t]);return e},Ua=(e,r)=>{var t={};for(var n in e)_t.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&_e)for(var n of _e(e))r.indexOf(n)<0&&yt.call(e,n)&&(t[n]=e[n]);return t};const Xa={},ht=y.forwardRef((e,r)=>{const t=b("MenuLabel",Xa,e),{children:n,className:o}=t,a=Ua(t,["children","className"]),{classNames:s,styles:i,unstyled:c,variant:d}=G(),{classes:f,cx:l}=Ha(null,{name:"Menu",classNames:s,styles:i,unstyled:c,variant:d});return m.createElement(E,Va({className:l(f.label,o),ref:r},a),n)});ht.displayName="@mantine/core/MenuLabel";var Ga=Object.defineProperty,ye=Object.getOwnPropertySymbols,Ot=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable,lr=(e,r,t)=>r in e?Ga(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Wa=(e,r)=>{for(var t in r||(r={}))Ot.call(r,t)&&lr(e,t,r[t]);if(ye)for(var t of ye(r))$t.call(r,t)&&lr(e,t,r[t]);return e},Ka=(e,r)=>{var t={};for(var n in e)Ot.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&ye)for(var n of ye(e))r.indexOf(n)<0&&$t.call(e,n)&&(t[n]=e[n]);return t};const qa={refProp:"ref"},wt=y.forwardRef((e,r)=>{const t=b("MenuTarget",qa,e),{children:n,refProp:o}=t,a=Ka(t,["children","refProp"]);if(!Ht(n))throw new Error(it.children);const s=G(),i=R(n.props.onClick,()=>s.trigger==="click"&&s.toggleDropdown()),c=R(n.props.onMouseEnter,()=>s.trigger==="hover"&&s.openDropdown()),d=R(n.props.onMouseLeave,()=>s.trigger==="hover"&&s.closeDropdown());return m.createElement(be.Target,Wa({refProp:o,popupType:"menu",ref:r},a),y.cloneElement(n,{onClick:i,onMouseEnter:c,onMouseLeave:d,"data-expanded":s.opened?!0:void 0}))});wt.displayName="@mantine/core/MenuTarget";var Ya=j({dropdown:{padding:P(4)}}),Za=Object.defineProperty,Ja=Object.defineProperties,Qa=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,cr=(e,r,t)=>r in e?Za(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,dr=(e,r)=>{for(var t in r||(r={}))Pt.call(r,t)&&cr(e,t,r[t]);if(he)for(var t of he(r))bt.call(r,t)&&cr(e,t,r[t]);return e},fr=(e,r)=>Ja(e,Qa(r)),es=(e,r)=>{var t={};for(var n in e)Pt.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&he)for(var n of he(e))r.indexOf(n)<0&&bt.call(e,n)&&(t[n]=e[n]);return t};const rs={closeOnItemClick:!0,loop:!0,trigger:"click",openDelay:0,closeDelay:100};function D(e){const r=b("Menu",rs,e),{children:t,onOpen:n,onClose:o,opened:a,defaultOpened:s,onChange:i,closeOnItemClick:c,loop:d,closeOnEscape:f,trigger:l,openDelay:v,closeDelay:_,classNames:p,styles:g,unstyled:h,radius:O,variant:$}=r,w=es(r,["children","onOpen","onClose","opened","defaultOpened","onChange","closeOnItemClick","loop","closeOnEscape","trigger","openDelay","closeDelay","classNames","styles","unstyled","radius","variant"]),{classes:N,cx:A}=Ya(),[L,{setHovered:S,resetHovered:k}]=on(),[I,x]=pr({value:a,defaultValue:s,finalValue:!1,onChange:i}),M=()=>{x(!1),I&&o?.()},F=()=>{x(!0),!I&&n?.()},W=()=>I?M():F(),{openDropdown:xt,closeDropdown:St}=qo({open:F,close:M,closeDelay:_,openDelay:v}),jt=It=>nn("[data-menu-item]","[data-menu-dropdown]",It);return mr(()=>{k()},[I]),m.createElement(ga,{value:{opened:I,toggleDropdown:W,getItemIndex:jt,hovered:L,setHovered:S,closeOnItemClick:c,closeDropdown:l==="click"?M:St,openDropdown:l==="click"?F:xt,closeDropdownImmediately:M,loop:d,trigger:l,radius:O,classNames:p,styles:g,unstyled:h,variant:$}},m.createElement(be,fr(dr({},w),{radius:O,opened:I,onChange:W,defaultOpened:s,trapFocus:l==="click"&&I,closeOnEscape:f&&l==="click",__staticSelector:"Menu",classNames:fr(dr({},p),{dropdown:A(N.dropdown,p?.dropdown)}),styles:g,unstyled:h,variant:$}),t))}D.displayName="@mantine/core/Menu";D.Item=za;D.Label=ht;D.Dropdown=ut;D.Target=wt;D.Divider=dt;const ts="updateBusinessTripAccountantApproval",ns=()=>{const[{fetching:e},r]=_r(Ft),t=y.useCallback(async n=>{const o=`Error toggling accountant approval for trip [${n.businessTripId}]`,a=`${ts}-${n.businessTripId}`;H.loading("Updating accountant approval status",{id:a});try{const s=await r(n),i=yr(s,o,a);if(i)return H.success("Success",{id:a,description:"Accountant approval status updated"}),i.updateBusinessTripAccountantApproval}catch(s){console.error(`${o}: ${s}`),H.error("Error",{id:a,description:o,duration:1e5,closeButton:!0})}},[r]);return{fetching:e,updateBusinessTripAccountantApproval:t}};function os({data:e,onChange:r}){const t=xe(Ut,e),[n,o]=y.useState(t.accountantApproval),{updateBusinessTripAccountantApproval:a}=ns();return y.useEffect(()=>{n==null&&t.accountantApproval!=null&&o(t.accountantApproval)},[n,t.accountantApproval]),u.jsx(Vt,{value:n,onChange:s=>a({businessTripId:t.id,status:s}).then(r)})}const as="creditShareholdersBusinessTripTravelAndSubsistence",ss=()=>{const[{fetching:e},r]=_r(Xt),t=y.useCallback(async n=>{const o=`Error crediting shareholders for trip ID ${n.businessTripId}`,a=`${as}-${n.businessTripId}`;H.loading("Crediting Shareholders",{id:a});try{const s=await r(n),i=yr(s,o,a);i&&H.success("Shareholders Credited",{id:a,description:`${i.creditShareholdersBusinessTripTravelAndSubsistence.length} Corresponding charges were successfully generated`})}catch(s){console.error(`${o}: ${s}`),H.error("Error",{id:a,description:o,duration:1e5,closeButton:!0})}},[r]);return{fetching:e,creditShareholders:t}};function is({businessTripId:e}){const[r,t]=y.useState(!1),{creditShareholders:n}=ss();return u.jsxs(D,{shadow:"md",width:200,opened:r,children:[u.jsx(D.Target,{children:u.jsx(Br,{opened:r,onClick:o=>{o.stopPropagation(),t(a=>!a)}})}),u.jsxs(D.Dropdown,{children:[u.jsx(D.Label,{children:"Summarize Trip"}),u.jsx(Gt,{onConfirm:()=>{n({businessTripId:e})},title:"Credit shareholders with travel and subsistence surplus?",children:u.jsx(D.Item,{icon:u.jsx(Wt,{size:14}),children:"Credit surplus T&S"})})]})]})}const ms=({data:e,onChange:r})=>{const t=xe(Yt,e),{name:n,dates:o,purpose:a,destination:s}=t;return u.jsxs(C,{children:[u.jsxs(C.Col,{span:12,className:"flex flex-row justify-between items-center",children:[u.jsx(E,{fz:"xl",children:n}),u.jsxs("div",{className:"flex flex-row gap-2",children:[u.jsx(os,{data:t,onChange:r}),u.jsx(Kt,{isLink:!0,content:`${window.location.origin}${qt.BUSINESS_TRIPS.DETAIL(t.id)}`}),u.jsx(is,{businessTripId:t.id})]})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["From Date:",u.jsx(E,{fz:"lg",children:o?.start?Ce(new Date(o.start),"dd/MM/yy"):"Missing"})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["To Date:",u.jsx(E,{fz:"lg",children:o?.end?Ce(new Date(o.end),"dd/MM/yy"):"Missing"})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["Destination:",u.jsx(E,{fz:"lg",children:s?.name})]}),u.jsxs(C.Col,{xl:4,lg:6,md:12,orderMd:6,children:["Description:",u.jsx(E,{fz:"lg",children:a})]}),u.jsxs(C.Col,{xl:2,lg:3,md:6,children:["Total Days:",u.jsx(E,{fz:"lg",children:o?ls(o.start,o.end):"Missing"})]})]})};function ls(e,r){return Qt(Ne(new Date(r),22),Ne(new Date(e),6))+1}function cs(e){return e.split("_").map(ds).join(" ")}function ds(e){return e.slice(0,1).toUpperCase()+e.slice(1,e.length).toLowerCase()}const gs=({data:e})=>{const{summary:r}=xe(Zt,e);return r?u.jsxs("div",{className:"flex flex-col gap-2 mt-5",children:[r.errors?.length&&u.jsxs(gr,{shadow:"xs",p:"md",children:[u.jsx(E,{c:"red",children:"Errors:"}),u.jsx(ue,{size:"sm",withPadding:!0,children:r.errors.map((t,n)=>u.jsx(ue.Item,{children:u.jsx(E,{c:"red",children:t})},n))})]}),u.jsxs(Jt,{highlightOnHover:!0,withBorder:!0,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Expense Type"}),u.jsxs("th",{children:["Total ",V(U.Usd)]}),u.jsxs("th",{children:["Total ",V(U.Ils)]}),u.jsxs("th",{children:["Max Taxable ",V(U.Usd)]}),u.jsxs("th",{children:["Taxable ",V(U.Usd)]}),u.jsxs("th",{children:["Taxable ",V(U.Ils)]}),u.jsx("th",{children:"Excess Expenditure"})]})}),u.jsx("tbody",{children:r.rows.map(t=>u.jsxs("tr",{children:[u.jsx("td",{children:cs(t.type)}),u.jsx("td",{children:t.totalForeignCurrency?.formatted}),u.jsx("td",{children:t.totalLocalCurrency?.formatted}),u.jsx("td",{children:t.maxTaxableForeignCurrency?.formatted}),u.jsx("td",{children:t.taxableForeignCurrency?.formatted}),u.jsx("td",{children:t.taxableLocalCurrency?.formatted}),u.jsx("td",{children:t.excessExpenditure?.formatted})]},t.type))})]}),u.jsxs(C,{justify:"flex-end",children:[u.jsxs(C.Col,{lg:2,md:4,children:["Excess Expenditure Tax:",u.jsxs(E,{fz:"lg",children:[r.excessTax??"0","%"]})]}),u.jsx(C.Col,{lg:2,md:3,className:"flex flex-col justify-end",children:u.jsx(E,{fz:"lg",children:r.excessExpenditure?.formatted??"0.00"})})]})]}):u.jsx(E,{children:"Loading..."})};export{Oe as A,Br as B,us as C,C as G,ue as L,D as M,ms as R,gs as S,Nr as a};
@@ -1 +1 @@
1
- import{j as n,T as l,B as p}from"./index-CNNawG6D.js";import{P as r,a as c}from"./panel-top-open-muCAuRMw.js";function u(t){const{toggleExpansion:e,isExpanded:o,onClickAction:s}=t;return n.jsx(l,{content:"Expand info",children:n.jsx(p,{variant:o?"default":"outline",onClick:i=>{i.stopPropagation(),e(a=>(s&&s(a),!a))},className:"size-7.5",children:o?n.jsx(r,{className:"size-5"}):n.jsx(c,{className:"size-5"})})})}export{u as T};
1
+ import{j as n,T as l,B as p}from"./index-BWAOW53d.js";import{P as r,a as c}from"./panel-top-open-EMjzc-ww.js";function u(t){const{toggleExpansion:e,isExpanded:o,onClickAction:s}=t;return n.jsx(l,{content:"Expand info",children:n.jsx(p,{variant:o?"default":"outline",onClick:i=>{i.stopPropagation(),e(a=>(s&&s(a),!a))},className:"size-7.5",children:o?n.jsx(r,{className:"size-5"}):n.jsx(c,{className:"size-5"})})})}export{u as T};
@@ -1 +1 @@
1
- import{r as a,j as e,D,aL as C,bT as I,bU as E,B as p,ah as T,bV as P,x as k,dz as F,dA as A,J as v,W as f,L as y,dB as S,e as B,K as O,O as G,dC as M,bp as R,bh as z,dD as L,g as q,t as h,i as H,dE as V}from"./index-CNNawG6D.js";function U({onApprove:u,draft:o}){const[l,r]=a.useState(!1),s=t=>{u(t),r(!1)};return e.jsxs(D,{open:l,onOpenChange:r,children:[e.jsx(C,{asChild:!0,type:"button",children:e.jsxs(I,{children:[e.jsx(E,{asChild:!0,type:"button",children:e.jsx(p,{className:"size-7.5",variant:"secondary",onClick:()=>r(t=>!t),type:"button",children:e.jsx(T,{className:"size-5"})})}),e.jsx(P,{children:e.jsx("p",{children:"Edit document"})})]})}),e.jsx(k,{className:"w-7xl sm:max-w-[95%] max-h-[90vh] overflow-y-auto",children:e.jsx("div",{className:"min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Edit Document"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Modify and preview your accounting document before issuing"})]}),e.jsx($,{onApprove:s,draft:o})]})})})]})}function $({onApprove:u,draft:o}){const[l,r]=a.useState(!1),[s,t]=a.useState(null),{previewDocument:d,fetching:i}=F(),[n,N]=a.useState(o),b=a.useCallback((c,m)=>{N(x=>({...x,[c]:m}))},[]);a.useEffect(()=>{r(!1)},[n]);const j=a.useCallback(async()=>{try{const c=await d({input:n});if(!c)throw new Error("No preview data returned");t(c),r(!0)}catch(c){console.error("Failed to generate preview:",c)}},[n,d]);a.useEffect(()=>{s||j()},[s,j]);const g=n.income?.reduce((c,m)=>{const x=m.price*m.quantity,w=x*((m.vatRate||0)/100);return c+x+w},0)||0;return e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{formData:n,updateFormData:b}),e.jsx(v,{children:e.jsxs(f,{className:"pt-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(p,{onClick:j,disabled:i||l,variant:"outline",className:"flex-1 bg-transparent",children:i?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),"Preview"]})}),e.jsxs(p,{onClick:()=>u(n),className:"flex-1",children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Accept Changes"]})]}),g>0&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"flex justify-between items-center font-medium text-blue-900",children:[e.jsx("span",{children:"Total Document Amount:"}),e.jsxs("span",{children:[g.toFixed(2)," ",n.currency]})]})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(v,{className:"h-fit",children:[e.jsx(O,{children:e.jsx(G,{children:"Document Preview"})}),e.jsx(f,{children:e.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50",children:i?e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"w-8 h-8 animate-spin mx-auto mb-4 text-gray-400"}),e.jsx("p",{className:"text-gray-500",children:"Generating document preview..."})]}):s?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"bg-white shadow-lg rounded-lg overflow-hidden",children:e.jsx("div",{className:"aspect-[8.5/11] bg-white border",children:e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(M,{src:s}),!l&&e.jsx("p",{className:"text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded",children:"Preview may be outdated"})]})})})})}):e.jsxs("div",{className:"text-center",children:[e.jsx(R,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-gray-500 mb-2",children:"No preview available"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Click Preview to generate document"})]})})})]}),n.client&&e.jsx(z,{businessId:n.client?.id,linkedDocumentIds:n.linkedDocumentIds??[]}),e.jsx(L,{documentType:n.type})]})]})}const J="issue-monthly-documents",W=()=>{const[{fetching:u},o]=q(V),l=a.useCallback(async r=>{const s="Error issuing monthly documents",t=J;h.loading("Issuing documents",{id:t});try{const d=await o(r),i=H(d,s,t);if(i?.issueGreenInvoiceDocuments?.success){h.success("Success",{id:t,description:"Documents issued successfully"});return}i?.issueGreenInvoiceDocuments?.errors&&console.error(i.issueGreenInvoiceDocuments.errors),h.error("Error",{id:t,description:s,duration:1e5,closeButton:!0})}catch(d){console.error(`${s}: ${d}`),h.error("Error",{id:t,description:s,duration:1e5,closeButton:!0})}},[o]);return{fetching:u,issueDocuments:l}};export{$ as E,U as a,W as u};
1
+ import{r as a,j as e,D,aL as C,bT as I,bU as E,B as p,ah as T,bV as P,x as k,dz as F,dA as A,J as v,W as f,L as y,dB as S,e as B,K as O,O as G,dC as M,bp as R,bh as z,dD as L,g as q,t as h,i as H,dE as V}from"./index-BWAOW53d.js";function U({onApprove:u,draft:o}){const[l,r]=a.useState(!1),s=t=>{u(t),r(!1)};return e.jsxs(D,{open:l,onOpenChange:r,children:[e.jsx(C,{asChild:!0,type:"button",children:e.jsxs(I,{children:[e.jsx(E,{asChild:!0,type:"button",children:e.jsx(p,{className:"size-7.5",variant:"secondary",onClick:()=>r(t=>!t),type:"button",children:e.jsx(T,{className:"size-5"})})}),e.jsx(P,{children:e.jsx("p",{children:"Edit document"})})]})}),e.jsx(k,{className:"w-7xl sm:max-w-[95%] max-h-[90vh] overflow-y-auto",children:e.jsx("div",{className:"min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Edit Document"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Modify and preview your accounting document before issuing"})]}),e.jsx($,{onApprove:s,draft:o})]})})})]})}function $({onApprove:u,draft:o}){const[l,r]=a.useState(!1),[s,t]=a.useState(null),{previewDocument:d,fetching:i}=F(),[n,N]=a.useState(o),b=a.useCallback((c,m)=>{N(x=>({...x,[c]:m}))},[]);a.useEffect(()=>{r(!1)},[n]);const j=a.useCallback(async()=>{try{const c=await d({input:n});if(!c)throw new Error("No preview data returned");t(c),r(!0)}catch(c){console.error("Failed to generate preview:",c)}},[n,d]);a.useEffect(()=>{s||j()},[s,j]);const g=n.income?.reduce((c,m)=>{const x=m.price*m.quantity,w=x*((m.vatRate||0)/100);return c+x+w},0)||0;return e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{formData:n,updateFormData:b}),e.jsx(v,{children:e.jsxs(f,{className:"pt-6",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(p,{onClick:j,disabled:i||l,variant:"outline",className:"flex-1 bg-transparent",children:i?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),"Preview"]})}),e.jsxs(p,{onClick:()=>u(n),className:"flex-1",children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Accept Changes"]})]}),g>0&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:e.jsxs("div",{className:"flex justify-between items-center font-medium text-blue-900",children:[e.jsx("span",{children:"Total Document Amount:"}),e.jsxs("span",{children:[g.toFixed(2)," ",n.currency]})]})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(v,{className:"h-fit",children:[e.jsx(O,{children:e.jsx(G,{children:"Document Preview"})}),e.jsx(f,{children:e.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg min-h-[600px] flex items-center justify-center bg-gray-50",children:i?e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"w-8 h-8 animate-spin mx-auto mb-4 text-gray-400"}),e.jsx("p",{className:"text-gray-500",children:"Generating document preview..."})]}):s?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"bg-white shadow-lg rounded-lg overflow-hidden",children:e.jsx("div",{className:"aspect-[8.5/11] bg-white border",children:e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(M,{src:s}),!l&&e.jsx("p",{className:"text-xs text-amber-600 mt-3 bg-amber-50 px-2 py-1 rounded",children:"Preview may be outdated"})]})})})})}):e.jsxs("div",{className:"text-center",children:[e.jsx(R,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"text-gray-500 mb-2",children:"No preview available"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Click Preview to generate document"})]})})})]}),n.client&&e.jsx(z,{businessId:n.client?.id,linkedDocumentIds:n.linkedDocumentIds??[]}),e.jsx(L,{documentType:n.type})]})]})}const J="issue-monthly-documents",W=()=>{const[{fetching:u},o]=q(V),l=a.useCallback(async r=>{const s="Error issuing monthly documents",t=J;h.loading("Issuing documents",{id:t});try{const d=await o(r),i=H(d,s,t);if(i?.issueGreenInvoiceDocuments?.success){h.success("Success",{id:t,description:"Documents issued successfully"});return}i?.issueGreenInvoiceDocuments?.errors&&console.error(i.issueGreenInvoiceDocuments.errors),h.error("Error",{id:t,description:s,duration:1e5,closeButton:!0})}catch(d){console.error(`${s}: ${d}`),h.error("Error",{id:t,description:s,duration:1e5,closeButton:!0})}},[o]);return{fetching:u,issueDocuments:l}};export{$ as E,U as a,W as u};
@@ -1 +1 @@
1
- import{i7 as a,r as s}from"./index-CNNawG6D.js";function c(){const{search:n}=a(),t=s.useMemo(()=>new URLSearchParams(n),[n]),r=s.useCallback(()=>{if(window.history.pushState){const o=t.keys().next().done?"":`?${t.toString()}`,e=window.location.protocol+"//"+window.location.host+window.location.pathname+o;window.history.pushState({path:e},"",e)}},[t]);return{query:t,queryString:()=>t.toString(),get:o=>t?.get(o),set:(o,e)=>{e==null?t.delete(o):t.set(o,e),r()}}}export{c as u};
1
+ import{i7 as a,r as s}from"./index-BWAOW53d.js";function c(){const{search:n}=a(),t=s.useMemo(()=>new URLSearchParams(n),[n]),r=s.useCallback(()=>{if(window.history.pushState){const o=t.keys().next().done?"":`?${t.toString()}`,e=window.location.protocol+"//"+window.location.host+window.location.pathname+o;window.history.pushState({path:e},"",e)}},[t]);return{query:t,queryString:()=>t.toString(),get:o=>t?.get(o),set:(o,e)=>{e==null?t.delete(o):t.set(o,e),r()}}}export{c as u};
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" href="/icons/accounter-logo.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Accounter</title>
8
- <script type="module" crossorigin src="/assets/index-CNNawG6D.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BWAOW53d.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-B0-LYemC.css">
10
10
  </head>
11
11
  <body>